From 7697695137e5d545f925a5672b6753bcd568a262 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Fri, 16 Oct 2020 15:35:52 +0200 Subject: [PATCH 1/2] Only load plugins with @next prefix Given that plugins are still experimental and plugins hasn't been worked on for a while I'm going to change the default loading for now. --- packages/next/build/plugins/collect-plugins.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/next/build/plugins/collect-plugins.ts b/packages/next/build/plugins/collect-plugins.ts index f81ba230432af2c..ad9b4ebfc4c38b7 100644 --- a/packages/next/build/plugins/collect-plugins.ts +++ b/packages/next/build/plugins/collect-plugins.ts @@ -182,11 +182,9 @@ async function _collectPlugins( } // find packages with the naming convention - // @scope/next-plugin-[name] // @next/plugin-[name] - // next-plugin-[name] const filteredDeps = dependencies.filter((name) => { - return name.match(/(^@next\/plugin|next-plugin-)/) + return name.match(/^@next\/plugin/) }) if (nextPluginConfigNames) { From a10598ab6be7c9684728f32eb6364e908e3f4ae9 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Fri, 16 Oct 2020 16:21:15 +0200 Subject: [PATCH 2/2] Update tests --- .../node_modules/@zeit/next-plugin-scope/package.json | 11 ----------- .../@zeit/next-plugin-scope/src/on-init-client.js | 3 --- .../app/node_modules/next-plugin-normal/package.json | 11 ----------- .../next-plugin-normal/src/dir-with-ext.js/index.js | 1 - .../next-plugin-normal/src/dir-without-ext/index.js | 1 - .../next-plugin-normal/src/on-init-client.js | 3 --- test/integration/next-plugins/app/package.json | 4 +--- test/integration/next-plugins/test/index.test.js | 4 ---- 8 files changed, 1 insertion(+), 37 deletions(-) delete mode 100644 test/integration/next-plugins/app/node_modules/@zeit/next-plugin-scope/package.json delete mode 100644 test/integration/next-plugins/app/node_modules/@zeit/next-plugin-scope/src/on-init-client.js delete mode 100644 test/integration/next-plugins/app/node_modules/next-plugin-normal/package.json delete mode 100644 test/integration/next-plugins/app/node_modules/next-plugin-normal/src/dir-with-ext.js/index.js delete mode 100644 test/integration/next-plugins/app/node_modules/next-plugin-normal/src/dir-without-ext/index.js delete mode 100644 test/integration/next-plugins/app/node_modules/next-plugin-normal/src/on-init-client.js diff --git a/test/integration/next-plugins/app/node_modules/@zeit/next-plugin-scope/package.json b/test/integration/next-plugins/app/node_modules/@zeit/next-plugin-scope/package.json deleted file mode 100644 index 4525eb1b1592cdb..000000000000000 --- a/test/integration/next-plugins/app/node_modules/@zeit/next-plugin-scope/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "@zeit/next-plugin-scope", - "version": "0.0.1", - "nextjs": { - "name": "Scoped Package Test", - "required-env": [] - }, - "peerDependencies": { - "next": "*" - } -} diff --git a/test/integration/next-plugins/app/node_modules/@zeit/next-plugin-scope/src/on-init-client.js b/test/integration/next-plugins/app/node_modules/@zeit/next-plugin-scope/src/on-init-client.js deleted file mode 100644 index 8b056831d809f6e..000000000000000 --- a/test/integration/next-plugins/app/node_modules/@zeit/next-plugin-scope/src/on-init-client.js +++ /dev/null @@ -1,3 +0,0 @@ -export default async function initClient() { - window.didScopedInit = true -} \ No newline at end of file diff --git a/test/integration/next-plugins/app/node_modules/next-plugin-normal/package.json b/test/integration/next-plugins/app/node_modules/next-plugin-normal/package.json deleted file mode 100644 index 590a3cda9afc57e..000000000000000 --- a/test/integration/next-plugins/app/node_modules/next-plugin-normal/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "next-plugin-normal", - "version": "0.0.1", - "nextjs": { - "name": "Normal Package Test", - "required-env": [] - }, - "peerDependencies": { - "next": "*" - } -} diff --git a/test/integration/next-plugins/app/node_modules/next-plugin-normal/src/dir-with-ext.js/index.js b/test/integration/next-plugins/app/node_modules/next-plugin-normal/src/dir-with-ext.js/index.js deleted file mode 100644 index 4cfbbe36f2f9870..000000000000000 --- a/test/integration/next-plugins/app/node_modules/next-plugin-normal/src/dir-with-ext.js/index.js +++ /dev/null @@ -1 +0,0 @@ -throw new Error('This file should never be loaded') diff --git a/test/integration/next-plugins/app/node_modules/next-plugin-normal/src/dir-without-ext/index.js b/test/integration/next-plugins/app/node_modules/next-plugin-normal/src/dir-without-ext/index.js deleted file mode 100644 index 4cfbbe36f2f9870..000000000000000 --- a/test/integration/next-plugins/app/node_modules/next-plugin-normal/src/dir-without-ext/index.js +++ /dev/null @@ -1 +0,0 @@ -throw new Error('This file should never be loaded') diff --git a/test/integration/next-plugins/app/node_modules/next-plugin-normal/src/on-init-client.js b/test/integration/next-plugins/app/node_modules/next-plugin-normal/src/on-init-client.js deleted file mode 100644 index 7b6f96c57001c1f..000000000000000 --- a/test/integration/next-plugins/app/node_modules/next-plugin-normal/src/on-init-client.js +++ /dev/null @@ -1,3 +0,0 @@ -export default async function initClient() { - window.didNormalInit = true -} \ No newline at end of file diff --git a/test/integration/next-plugins/app/package.json b/test/integration/next-plugins/app/package.json index 3a9403050e037b9..ae559b125d822d4 100644 --- a/test/integration/next-plugins/app/package.json +++ b/test/integration/next-plugins/app/package.json @@ -1,7 +1,5 @@ { "dependencies": { - "@next/plugin-google-analytics": "latest", - "@zeit/next-plugin-scope": "latest", - "next-plugin-normal": "latest" + "@next/plugin-google-analytics": "latest" } } diff --git a/test/integration/next-plugins/test/index.test.js b/test/integration/next-plugins/test/index.test.js index 433bee3d6b02c9a..51189da43f6b1be 100644 --- a/test/integration/next-plugins/test/index.test.js +++ b/test/integration/next-plugins/test/index.test.js @@ -44,8 +44,6 @@ function runTests() { it('should list loaded plugins', async () => { expect(stdout).toMatch(/loaded plugin: @next\/plugin-google-analytics/i) - expect(stdout).toMatch(/loaded plugin: @zeit\/next-plugin-scope/i) - expect(stdout).toMatch(/loaded plugin: next-plugin-normal/i) }) it('should ignore directories in plugins', async () => { @@ -111,8 +109,6 @@ describe('Next.js plugins', () => { it('should disable auto detecting plugins when plugin config is used', async () => { expect(stdout).toMatch(/loaded plugin: @next\/plugin-google-analytics/i) - expect(stdout).not.toMatch(/loaded plugin: @zeit\/next-plugin-scope/i) - expect(stdout).not.toMatch(/loaded plugin: next-plugin-normal/i) }) it('should expose a plugins config', async () => {