From 3fb4e091bcecc2fcca5860d946c37325f5e30f9a Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Thu, 15 Apr 2021 09:50:36 -0500 Subject: [PATCH 01/20] v10.1.4-canary.8 --- lerna.json | 2 +- packages/create-next-app/package.json | 2 +- packages/eslint-plugin-next/package.json | 2 +- packages/next-bundle-analyzer/package.json | 2 +- packages/next-codemod/package.json | 2 +- packages/next-env/package.json | 2 +- packages/next-mdx/package.json | 2 +- packages/next-plugin-google-analytics/package.json | 2 +- packages/next-plugin-sentry/package.json | 2 +- packages/next-plugin-storybook/package.json | 2 +- packages/next-polyfill-module/package.json | 2 +- packages/next-polyfill-nomodule/package.json | 2 +- packages/next/package.json | 12 ++++++------ packages/react-dev-overlay/package.json | 2 +- packages/react-refresh-utils/package.json | 2 +- 15 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lerna.json b/lerna.json index 9355fbe99c56e6..d961b3b65ecc5b 100644 --- a/lerna.json +++ b/lerna.json @@ -17,5 +17,5 @@ "registry": "https://registry.npmjs.org/" } }, - "version": "10.1.4-canary.7" + "version": "10.1.4-canary.8" } diff --git a/packages/create-next-app/package.json b/packages/create-next-app/package.json index 6f3d24e9dcfa27..5f8a479b90912b 100644 --- a/packages/create-next-app/package.json +++ b/packages/create-next-app/package.json @@ -1,6 +1,6 @@ { "name": "create-next-app", - "version": "10.1.4-canary.7", + "version": "10.1.4-canary.8", "keywords": [ "react", "next", diff --git a/packages/eslint-plugin-next/package.json b/packages/eslint-plugin-next/package.json index 91e89d1df88cd9..eebfbebcbf775c 100644 --- a/packages/eslint-plugin-next/package.json +++ b/packages/eslint-plugin-next/package.json @@ -1,6 +1,6 @@ { "name": "@next/eslint-plugin-next", - "version": "10.1.4-canary.7", + "version": "10.1.4-canary.8", "description": "ESLint plugin for NextJS.", "main": "lib/index.js", "license": "MIT", diff --git a/packages/next-bundle-analyzer/package.json b/packages/next-bundle-analyzer/package.json index 59375fa4447a55..4c89dc655d93ef 100644 --- a/packages/next-bundle-analyzer/package.json +++ b/packages/next-bundle-analyzer/package.json @@ -1,6 +1,6 @@ { "name": "@next/bundle-analyzer", - "version": "10.1.4-canary.7", + "version": "10.1.4-canary.8", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-codemod/package.json b/packages/next-codemod/package.json index 1ddaaee909f167..bedddaa0fcbc4f 100644 --- a/packages/next-codemod/package.json +++ b/packages/next-codemod/package.json @@ -1,6 +1,6 @@ { "name": "@next/codemod", - "version": "10.1.4-canary.7", + "version": "10.1.4-canary.8", "license": "MIT", "dependencies": { "chalk": "4.1.0", diff --git a/packages/next-env/package.json b/packages/next-env/package.json index f5959c1bea53f6..0f75d933a1d7f0 100644 --- a/packages/next-env/package.json +++ b/packages/next-env/package.json @@ -1,6 +1,6 @@ { "name": "@next/env", - "version": "10.1.4-canary.7", + "version": "10.1.4-canary.8", "keywords": [ "react", "next", diff --git a/packages/next-mdx/package.json b/packages/next-mdx/package.json index 50570b0ecc1fb9..e2a6f290850105 100644 --- a/packages/next-mdx/package.json +++ b/packages/next-mdx/package.json @@ -1,6 +1,6 @@ { "name": "@next/mdx", - "version": "10.1.4-canary.7", + "version": "10.1.4-canary.8", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-plugin-google-analytics/package.json b/packages/next-plugin-google-analytics/package.json index dce3be8f167bd6..6fc5974f3d0f42 100644 --- a/packages/next-plugin-google-analytics/package.json +++ b/packages/next-plugin-google-analytics/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-google-analytics", - "version": "10.1.4-canary.7", + "version": "10.1.4-canary.8", "repository": { "url": "vercel/next.js", "directory": "packages/next-plugin-google-analytics" diff --git a/packages/next-plugin-sentry/package.json b/packages/next-plugin-sentry/package.json index f6834afceb6348..42590d4820aabf 100644 --- a/packages/next-plugin-sentry/package.json +++ b/packages/next-plugin-sentry/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-sentry", - "version": "10.1.4-canary.7", + "version": "10.1.4-canary.8", "repository": { "url": "vercel/next.js", "directory": "packages/next-plugin-sentry" diff --git a/packages/next-plugin-storybook/package.json b/packages/next-plugin-storybook/package.json index 0eea3a00f0062f..fee94233152831 100644 --- a/packages/next-plugin-storybook/package.json +++ b/packages/next-plugin-storybook/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-storybook", - "version": "10.1.4-canary.7", + "version": "10.1.4-canary.8", "repository": { "url": "vercel/next.js", "directory": "packages/next-plugin-storybook" diff --git a/packages/next-polyfill-module/package.json b/packages/next-polyfill-module/package.json index febafe25e237dc..52791ca2a188e2 100644 --- a/packages/next-polyfill-module/package.json +++ b/packages/next-polyfill-module/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-module", - "version": "10.1.4-canary.7", + "version": "10.1.4-canary.8", "description": "A standard library polyfill for ES Modules supporting browsers (Edge 16+, Firefox 60+, Chrome 61+, Safari 10.1+)", "main": "dist/polyfill-module.js", "license": "MIT", diff --git a/packages/next-polyfill-nomodule/package.json b/packages/next-polyfill-nomodule/package.json index 9ebbaa0abac38c..d76667dc2e0f1f 100644 --- a/packages/next-polyfill-nomodule/package.json +++ b/packages/next-polyfill-nomodule/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-nomodule", - "version": "10.1.4-canary.7", + "version": "10.1.4-canary.8", "description": "A polyfill for non-dead, nomodule browsers.", "main": "dist/polyfill-nomodule.js", "license": "MIT", diff --git a/packages/next/package.json b/packages/next/package.json index fc43bbfb74c7cc..9e829d0d54f256 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "10.1.4-canary.7", + "version": "10.1.4-canary.8", "description": "The React Framework", "main": "./dist/server/next.js", "license": "MIT", @@ -62,10 +62,10 @@ "dependencies": { "@babel/runtime": "7.12.5", "@hapi/accept": "5.0.1", - "@next/env": "10.1.4-canary.7", - "@next/polyfill-module": "10.1.4-canary.7", - "@next/react-dev-overlay": "10.1.4-canary.7", - "@next/react-refresh-utils": "10.1.4-canary.7", + "@next/env": "10.1.4-canary.8", + "@next/polyfill-module": "10.1.4-canary.8", + "@next/react-dev-overlay": "10.1.4-canary.8", + "@next/react-refresh-utils": "10.1.4-canary.8", "@opentelemetry/api": "0.14.0", "assert": "2.0.0", "ast-types": "0.13.2", @@ -148,7 +148,7 @@ "@babel/preset-typescript": "7.12.7", "@babel/traverse": "^7.12.10", "@babel/types": "7.12.12", - "@next/polyfill-nomodule": "10.1.4-canary.7", + "@next/polyfill-nomodule": "10.1.4-canary.8", "@taskr/clear": "1.1.0", "@taskr/esnext": "1.1.0", "@taskr/watch": "1.1.0", diff --git a/packages/react-dev-overlay/package.json b/packages/react-dev-overlay/package.json index 61aed2c5e85808..079d1a2dd6118b 100644 --- a/packages/react-dev-overlay/package.json +++ b/packages/react-dev-overlay/package.json @@ -1,6 +1,6 @@ { "name": "@next/react-dev-overlay", - "version": "10.1.4-canary.7", + "version": "10.1.4-canary.8", "description": "A development-only overlay for developing React applications.", "repository": { "url": "vercel/next.js", diff --git a/packages/react-refresh-utils/package.json b/packages/react-refresh-utils/package.json index 2d8961c2d5039d..60ee363d906f1f 100644 --- a/packages/react-refresh-utils/package.json +++ b/packages/react-refresh-utils/package.json @@ -1,6 +1,6 @@ { "name": "@next/react-refresh-utils", - "version": "10.1.4-canary.7", + "version": "10.1.4-canary.8", "description": "An experimental package providing utilities for React Refresh.", "repository": { "url": "vercel/next.js", From 35258650acb5bc17555e8e8c37845540f609ee9d Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Thu, 15 Apr 2021 10:21:32 -0500 Subject: [PATCH 02/20] Update with-electron test (#24036) * Use ssh for git regexr dependency * remove .git from dep * update * update test * update step * update install * remove dep temporarily * remove extra change * move deps to specific test --- .github/workflows/build_test_deploy.yml | 2 +- test/integration/with-electron/app/.gitignore | 1 + .../integration/with-electron/{ => app}/next.config.js | 0 test/integration/with-electron/app/package.json | 10 ++++++++++ .../integration/with-electron/{ => app}/pages/about.js | 0 .../integration/with-electron/{ => app}/pages/index.js | 0 .../integration/with-electron/{ => app}/public/main.js | 0 test/integration/with-electron/test/index.test.js | 8 ++++---- 8 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 test/integration/with-electron/app/.gitignore rename test/integration/with-electron/{ => app}/next.config.js (100%) create mode 100644 test/integration/with-electron/app/package.json rename test/integration/with-electron/{ => app}/pages/about.js (100%) rename test/integration/with-electron/{ => app}/pages/index.js (100%) rename test/integration/with-electron/{ => app}/public/main.js (100%) diff --git a/.github/workflows/build_test_deploy.yml b/.github/workflows/build_test_deploy.yml index 1bd1f3252a5371..8fe06a8b3e5e82 100644 --- a/.github/workflows/build_test_deploy.yml +++ b/.github/workflows/build_test_deploy.yml @@ -126,7 +126,7 @@ jobs: - run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p if: ${{needs.build.outputs.docsChange != 'docs only change'}} - - run: yarn add -W --dev spectron@7.0.0 electron@5.0.0 + - run: cd test/integration/with-electron/app && yarn if: ${{needs.build.outputs.docsChange != 'docs only change'}} - run: xvfb-run node run-tests.js test/integration/with-electron/test/index.test.js diff --git a/test/integration/with-electron/app/.gitignore b/test/integration/with-electron/app/.gitignore new file mode 100644 index 00000000000000..3c3629e647f5dd --- /dev/null +++ b/test/integration/with-electron/app/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/test/integration/with-electron/next.config.js b/test/integration/with-electron/app/next.config.js similarity index 100% rename from test/integration/with-electron/next.config.js rename to test/integration/with-electron/app/next.config.js diff --git a/test/integration/with-electron/app/package.json b/test/integration/with-electron/app/package.json new file mode 100644 index 00000000000000..237fbaf1a647d5 --- /dev/null +++ b/test/integration/with-electron/app/package.json @@ -0,0 +1,10 @@ +{ + "name": "with-electron", + "version": "1.0.0", + "main": "index.js", + "license": "MIT", + "dependencies": { + "electron": "5.0.0", + "spectron": "7.0.0" + } +} diff --git a/test/integration/with-electron/pages/about.js b/test/integration/with-electron/app/pages/about.js similarity index 100% rename from test/integration/with-electron/pages/about.js rename to test/integration/with-electron/app/pages/about.js diff --git a/test/integration/with-electron/pages/index.js b/test/integration/with-electron/app/pages/index.js similarity index 100% rename from test/integration/with-electron/pages/index.js rename to test/integration/with-electron/app/pages/index.js diff --git a/test/integration/with-electron/public/main.js b/test/integration/with-electron/app/public/main.js similarity index 100% rename from test/integration/with-electron/public/main.js rename to test/integration/with-electron/app/public/main.js diff --git a/test/integration/with-electron/test/index.test.js b/test/integration/with-electron/test/index.test.js index 8981729f68701f..47174913e80fda 100644 --- a/test/integration/with-electron/test/index.test.js +++ b/test/integration/with-electron/test/index.test.js @@ -1,18 +1,18 @@ -/* eslint-env jest */ +// /* eslint-env jest */ import { join } from 'path' import { nextBuild, nextExport } from 'next-test-utils' jest.setTimeout(1000 * 60 * 2) -const nextdir = join(__dirname, '../') +const nextdir = join(__dirname, '../app') const outdir = join(nextdir, 'out') const appdir = join(outdir, 'main.js') let app = null if (process.env.TEST_ELECTRON) { - const electron = require('electron') - const { Application } = require('spectron') + const electron = require(join(nextdir, 'node_modules/electron')) + const { Application } = require(join(nextdir, 'node_modules/spectron')) describe('Parse Relative Url', () => { describe('File Protocol via Electron', () => { From b2ee0a93fe5653a050550455d817f7e460205b4a Mon Sep 17 00:00:00 2001 From: Martin Alix Date: Thu, 15 Apr 2021 12:34:52 -0400 Subject: [PATCH 03/20] Fix IE11 incompatibility due to string litterals (#23784) Fixes #22270 ## Bug - [X] Related issues linked using `fixes #number` - [ ] Integration tests added --- azure-pipelines.yml | 4 +- .../runtime/injectStylesIntoStyleTag.js | 19 +++--- .../css-client-nav/test/index.test.js | 62 ++++++++++++------- 3 files changed, 52 insertions(+), 33 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 008c8f15e76507..7f95822f0e86f9 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -69,7 +69,7 @@ stages: - stage: Test dependsOn: Build jobs: - - job: test_ie11_production + - job: test_ie11 pool: vmImage: 'windows-2019' steps: @@ -86,7 +86,7 @@ stages: path: $(System.DefaultWorkingDirectory) displayName: Cache Build - script: | - yarn testie --forceExit test/integration/production/ + yarn testie --forceExit test/integration/production/ test/integration/css-client-nav/ displayName: 'Run tests' - job: test_unit diff --git a/packages/next/build/webpack/loaders/next-style-loader/runtime/injectStylesIntoStyleTag.js b/packages/next/build/webpack/loaders/next-style-loader/runtime/injectStylesIntoStyleTag.js index 12fcbb2c6f3ab8..8df13e1fdbf46d 100644 --- a/packages/next/build/webpack/loaders/next-style-loader/runtime/injectStylesIntoStyleTag.js +++ b/packages/next/build/webpack/loaders/next-style-loader/runtime/injectStylesIntoStyleTag.js @@ -67,7 +67,7 @@ function modulesToDom(list, options) { const item = list[i] const id = options.base ? item[0] + options.base : item[0] const count = idCountMap[id] || 0 - const identifier = `${id} ${count}` + const identifier = id + ' ' + count.toString() idCountMap[id] = count + 1 @@ -83,7 +83,7 @@ function modulesToDom(list, options) { stylesInDom[index].updater(obj) } else { stylesInDom.push({ - identifier, + identifier: identifier, updater: addStyle(obj, options), references: 1, }) @@ -109,7 +109,7 @@ function insertStyleElement(options) { } } - Object.keys(attributes).forEach((key) => { + Object.keys(attributes).forEach(function (key) { style.setAttribute(key, attributes[key]) }) @@ -154,7 +154,7 @@ function applyToSingletonTag(style, index, remove, obj) { const css = remove ? '' : obj.media - ? `@media ${obj.media} {${obj.css}}` + ? '@media ' + obj.media + ' {' + obj.css + '}' : obj.css // For old IE @@ -189,9 +189,10 @@ function applyToTag(style, options, obj) { } if (sourceMap && typeof btoa !== 'undefined') { - css += `\n/*# sourceMappingURL=data:application/json;base64,${btoa( - unescape(encodeURIComponent(JSON.stringify(sourceMap))) - )} */` + css += + '\n/*# sourceMappingURL=data:application/json;base64,' + + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + + ' */' } // For old IE @@ -226,7 +227,7 @@ function addStyle(obj, options) { style = insertStyleElement(options) update = applyToTag.bind(null, style, options) - remove = () => { + remove = function () { removeStyleElement(style) } } @@ -250,7 +251,7 @@ function addStyle(obj, options) { } } -module.exports = (list, options) => { +module.exports = function (list, options) { options = options || {} // Force single-tag solution on IE6-9, which has a hard limit on the # of