From 5585bf24f101f5d2f7b4ca73e7b7383a86b3e769 Mon Sep 17 00:00:00 2001 From: kumard3 Date: Fri, 24 Dec 2021 23:55:25 +0530 Subject: [PATCH 1/4] Created tailwind and typescript starter --- .../with-typescript-tailwind/.eslintrc.json | 3 + examples/with-typescript-tailwind/.gitignore | 37 +++++++++ examples/with-typescript-tailwind/README.md | 75 ++++++++++++++++++ .../components/Seo.tsx | 42 ++++++++++ .../with-typescript-tailwind/next-env.d.ts | 2 + .../with-typescript-tailwind/next.config.js | 4 + .../with-typescript-tailwind/package.json | 24 ++++++ .../with-typescript-tailwind/pages/_app.tsx | 8 ++ .../pages/api/hello.ts | 13 +++ .../with-typescript-tailwind/pages/index.tsx | 25 ++++++ .../postcss.config.js | 6 ++ .../public/favicon.ico | Bin 0 -> 25931 bytes .../public/vercel.svg | 4 + .../styles/globals.css | 3 + .../tailwind.config.js | 10 +++ .../with-typescript-tailwind/tsconfig.json | 20 +++++ 16 files changed, 276 insertions(+) create mode 100644 examples/with-typescript-tailwind/.eslintrc.json create mode 100644 examples/with-typescript-tailwind/.gitignore create mode 100644 examples/with-typescript-tailwind/README.md create mode 100644 examples/with-typescript-tailwind/components/Seo.tsx create mode 100644 examples/with-typescript-tailwind/next-env.d.ts create mode 100644 examples/with-typescript-tailwind/next.config.js create mode 100644 examples/with-typescript-tailwind/package.json create mode 100644 examples/with-typescript-tailwind/pages/_app.tsx create mode 100644 examples/with-typescript-tailwind/pages/api/hello.ts create mode 100644 examples/with-typescript-tailwind/pages/index.tsx create mode 100644 examples/with-typescript-tailwind/postcss.config.js create mode 100644 examples/with-typescript-tailwind/public/favicon.ico create mode 100644 examples/with-typescript-tailwind/public/vercel.svg create mode 100644 examples/with-typescript-tailwind/styles/globals.css create mode 100644 examples/with-typescript-tailwind/tailwind.config.js create mode 100644 examples/with-typescript-tailwind/tsconfig.json diff --git a/examples/with-typescript-tailwind/.eslintrc.json b/examples/with-typescript-tailwind/.eslintrc.json new file mode 100644 index 0000000000000..bffb357a71225 --- /dev/null +++ b/examples/with-typescript-tailwind/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "next/core-web-vitals" +} diff --git a/examples/with-typescript-tailwind/.gitignore b/examples/with-typescript-tailwind/.gitignore new file mode 100644 index 0000000000000..88b6f0d981643 --- /dev/null +++ b/examples/with-typescript-tailwind/.gitignore @@ -0,0 +1,37 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# next.js +/.next/ +/out/ + +# production +/build + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# local env files +.env.local +.env.development.local +.env.test.local +.env.production.local + +# vercel +.vercel + +# typescript +*.tsbuildinfo diff --git a/examples/with-typescript-tailwind/README.md b/examples/with-typescript-tailwind/README.md new file mode 100644 index 0000000000000..bdf29a25c489f --- /dev/null +++ b/examples/with-typescript-tailwind/README.md @@ -0,0 +1,75 @@ + +

+ +Next.js TypeScript Starter + +

+ + + +
+ + + +
TypeScript with Tailwind starter for Next.js
+ + + +
+ + + +## Features + + + +- ⚡️ Next.js 12 + +- ⚛️ React 17 + +- ⛑ TypeScript +- +- 📏 ESLint — Find and fix problems in your code + + +## Quick Start + + + +The best way to start with this template is using [Create Next App](https://nextjs.org/docs/api-reference/create-next-app). + + + +``` + +npx create-next-app --example with-typescript-tailwind with-typescript-tailwind-app + +or + +yarn create next-app --example with-typescript-tailwind with-typescript-tailwind-app + +``` + + + +### Development + + + +To start the project locally, run: + + + +```bash + +yarn dev + +``` + + + +Open `http://localhost:3000` with your browser to see the result. + + + + diff --git a/examples/with-typescript-tailwind/components/Seo.tsx b/examples/with-typescript-tailwind/components/Seo.tsx new file mode 100644 index 0000000000000..f68669b70db63 --- /dev/null +++ b/examples/with-typescript-tailwind/components/Seo.tsx @@ -0,0 +1,42 @@ +import React from "react"; +import Head from "next/head"; +interface Props { + data: any +} +function SEO({ data }: Props) { + return ( + + {data.title} + + + + + + {/* Open Graph / Facebook */} + + + + + + + {/* Twitter */} + + + + + + + + {/* Favicon */} + + + + + + ); +} + +export default SEO; \ No newline at end of file diff --git a/examples/with-typescript-tailwind/next-env.d.ts b/examples/with-typescript-tailwind/next-env.d.ts new file mode 100644 index 0000000000000..6080addc2d959 --- /dev/null +++ b/examples/with-typescript-tailwind/next-env.d.ts @@ -0,0 +1,2 @@ +/// +/// diff --git a/examples/with-typescript-tailwind/next.config.js b/examples/with-typescript-tailwind/next.config.js new file mode 100644 index 0000000000000..8b61df4e50f8a --- /dev/null +++ b/examples/with-typescript-tailwind/next.config.js @@ -0,0 +1,4 @@ +/** @type {import('next').NextConfig} */ +module.exports = { + reactStrictMode: true, +} diff --git a/examples/with-typescript-tailwind/package.json b/examples/with-typescript-tailwind/package.json new file mode 100644 index 0000000000000..2020ba950f038 --- /dev/null +++ b/examples/with-typescript-tailwind/package.json @@ -0,0 +1,24 @@ +{ + "private": true, + "scripts": { + "dev": "next dev", + "build": "next build", + "start": "next start", + "lint": "next lint" + }, + "dependencies": { + "next": "12.0.7", + "react": "17.0.2", + "react-dom": "17.0.2" + }, + "devDependencies": { + "@types/node": "17.0.4", + "@types/react": "17.0.38", + "autoprefixer": "^10.4.0", + "eslint": "8.5.0", + "eslint-config-next": "12.0.7", + "postcss": "^8.4.5", + "tailwindcss": "^3.0.7", + "typescript": "4.5.4" + } +} diff --git a/examples/with-typescript-tailwind/pages/_app.tsx b/examples/with-typescript-tailwind/pages/_app.tsx new file mode 100644 index 0000000000000..3f5c9d5485860 --- /dev/null +++ b/examples/with-typescript-tailwind/pages/_app.tsx @@ -0,0 +1,8 @@ +import '../styles/globals.css' +import type { AppProps } from 'next/app' + +function MyApp({ Component, pageProps }: AppProps) { + return +} + +export default MyApp diff --git a/examples/with-typescript-tailwind/pages/api/hello.ts b/examples/with-typescript-tailwind/pages/api/hello.ts new file mode 100644 index 0000000000000..f8bcc7e5caed1 --- /dev/null +++ b/examples/with-typescript-tailwind/pages/api/hello.ts @@ -0,0 +1,13 @@ +// Next.js API route support: https://nextjs.org/docs/api-routes/introduction +import type { NextApiRequest, NextApiResponse } from 'next' + +type Data = { + name: string +} + +export default function handler( + req: NextApiRequest, + res: NextApiResponse +) { + res.status(200).json({ name: 'John Doe' }) +} diff --git a/examples/with-typescript-tailwind/pages/index.tsx b/examples/with-typescript-tailwind/pages/index.tsx new file mode 100644 index 0000000000000..59d7d4a72bbe6 --- /dev/null +++ b/examples/with-typescript-tailwind/pages/index.tsx @@ -0,0 +1,25 @@ +/* eslint-disable @next/next/link-passhref */ +import Link from 'next/link'; +import * as React from 'react'; + +export default function Home() { + return ( +
+
+
+

Next.js + Tailwind CSS + TypeScript Starter

+

+ A starter for Next.js, Tailwind CSS, and TypeScript with Seo. +

+

+ + + See the repository + + +

+
+
+
+ ); +} \ No newline at end of file diff --git a/examples/with-typescript-tailwind/postcss.config.js b/examples/with-typescript-tailwind/postcss.config.js new file mode 100644 index 0000000000000..33ad091d26d8a --- /dev/null +++ b/examples/with-typescript-tailwind/postcss.config.js @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} diff --git a/examples/with-typescript-tailwind/public/favicon.ico b/examples/with-typescript-tailwind/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..718d6fea4835ec2d246af9800eddb7ffb276240c GIT binary patch literal 25931 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 LrJugUA?W`A8`#=m literal 0 HcmV?d00001 diff --git a/examples/with-typescript-tailwind/public/vercel.svg b/examples/with-typescript-tailwind/public/vercel.svg new file mode 100644 index 0000000000000..fbf0e25a651c2 --- /dev/null +++ b/examples/with-typescript-tailwind/public/vercel.svg @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/examples/with-typescript-tailwind/styles/globals.css b/examples/with-typescript-tailwind/styles/globals.css new file mode 100644 index 0000000000000..bd6213e1dfe6b --- /dev/null +++ b/examples/with-typescript-tailwind/styles/globals.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; \ No newline at end of file diff --git a/examples/with-typescript-tailwind/tailwind.config.js b/examples/with-typescript-tailwind/tailwind.config.js new file mode 100644 index 0000000000000..6b9e53b5373ae --- /dev/null +++ b/examples/with-typescript-tailwind/tailwind.config.js @@ -0,0 +1,10 @@ +module.exports = { + purge: { enabled: true, content: [ + "./pages/**/*.{js,ts,jsx,tsx}", + "./components/**/*.{js,ts,jsx,tsx}", + ],}, + theme: { + extend: {}, + }, + plugins: [], +} \ No newline at end of file diff --git a/examples/with-typescript-tailwind/tsconfig.json b/examples/with-typescript-tailwind/tsconfig.json new file mode 100644 index 0000000000000..99710e857874f --- /dev/null +++ b/examples/with-typescript-tailwind/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "target": "es5", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true, + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true + }, + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], + "exclude": ["node_modules"] +} From 665a36a9ca469679edf769a6f608334f03d26fb6 Mon Sep 17 00:00:00 2001 From: kumard3 Date: Wed, 5 Jan 2022 04:01:42 +0530 Subject: [PATCH 2/4] reverted all the unrelated files --- .github/ISSUE_TEMPLATE/1.bug_report.yml | 6 + .github/workflows/build_test_deploy.yml | 277 +++++++++--------- .github/workflows/stale.yml | 3 +- .../measuring-performance.md | 2 +- docs/advanced-features/react-18.md | 2 + docs/api-reference/cli.md | 35 ++- docs/api-reference/next/link.md | 2 +- docs/basic-features/eslint.md | 13 +- errors/manifest.json | 1 + errors/no-head-element.md | 30 ++ errors/no-page-custom-font.md | 2 +- .../cms-kontent/components/cover-image.js | 2 +- examples/cms-kontent/lib/api.js | 4 +- examples/with-docker/Dockerfile | 4 +- examples/with-jest/package.json | 4 +- examples/with-segment-analytics/pages/_app.js | 5 +- examples/with-semantic-ui/.nowignore | 5 - examples/with-semantic-ui/next.config.js | 17 -- examples/with-semantic-ui/package.json | 9 +- .../with-semantic-ui/pages/SmallImage.png | Bin 7395 -> 0 bytes examples/with-semantic-ui/pages/_app.js | 6 +- examples/with-semantic-ui/pages/index.js | 72 +++-- .../LargeImage.png => public/image.png} | Bin .../{pages/styles.css => styles/global.css} | 0 .../.eslintrc.json | 0 examples/with-tailwindcss/.gitignore | 3 + examples/with-tailwindcss/README.md | 8 + examples/with-tailwindcss/next-env.d.ts | 5 + .../next.config.js | 0 examples/with-tailwindcss/package.json | 9 +- examples/with-tailwindcss/pages/_app.js | 7 - .../pages/_app.tsx | 0 examples/with-tailwindcss/pages/api/hello.js | 5 - .../pages/api/hello.ts | 0 .../pages/{index.js => index.tsx} | 2 +- examples/with-tailwindcss/postcss.config.js | 2 - .../tsconfig.json | 0 examples/with-typescript-tailwind/.gitignore | 37 --- examples/with-typescript-tailwind/README.md | 75 ----- .../components/Seo.tsx | 42 --- .../with-typescript-tailwind/next-env.d.ts | 2 - .../with-typescript-tailwind/package.json | 24 -- .../with-typescript-tailwind/pages/index.tsx | 25 -- .../postcss.config.js | 6 - .../public/favicon.ico | Bin 25931 -> 0 bytes .../public/vercel.svg | 4 - .../styles/globals.css | 3 - .../tailwind.config.js | 10 - lerna.json | 2 +- package.json | 5 +- packages/create-next-app/package.json | 2 +- packages/eslint-config-next/package.json | 4 +- packages/eslint-plugin-next/lib/index.js | 2 + .../lib/rules/google-font-display.js | 2 +- .../lib/rules/google-font-preconnect.js | 2 +- .../lib/rules/link-passhref.js | 2 +- .../lib/rules/next-script-for-ga.js | 2 +- .../lib/rules/no-css-tags.js | 2 +- .../lib/rules/no-document-import-in-page.js | 2 +- .../lib/rules/no-head-element.js | 26 ++ .../lib/rules/no-head-import-in-document.js | 2 +- .../lib/rules/no-html-link-for-pages.js | 10 +- .../lib/rules/no-img-element.js | 2 +- .../lib/rules/no-page-custom-font.js | 2 +- .../lib/rules/no-script-in-document.js | 2 +- .../lib/rules/no-script-in-head.js | 2 +- .../lib/rules/no-server-import-in-page.js | 2 +- .../lib/rules/no-sync-scripts.js | 2 +- .../lib/rules/no-title-in-document-head.js | 2 +- .../lib/rules/no-unwanted-polyfillio.js | 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-mdx/readme.md | 2 +- packages/next-plugin-storybook/package.json | 2 +- packages/next-polyfill-module/package.json | 2 +- packages/next-polyfill-nomodule/package.json | 2 +- packages/next-swc/package.json | 2 +- packages/next/bin/next.ts | 1 + packages/next/build/entries.ts | 6 + packages/next/build/index.ts | 22 +- packages/next/build/utils.ts | 49 +++- packages/next/build/webpack-config.ts | 9 +- .../build/webpack/config/blocks/css/index.ts | 15 +- .../loaders/next-serverless-loader/index.ts | 4 +- .../loaders/resolve-url-loader/index.js | 103 +++++++ .../resolve-url-loader/lib/file-protocol.js | 65 ++++ .../resolve-url-loader/lib/join-function.js | 233 +++++++++++++++ .../loaders/resolve-url-loader/lib/postcss.js | 97 ++++++ .../resolve-url-loader/lib/value-processor.js | 125 ++++++++ packages/next/cli/next-info.ts | 76 +++++ packages/next/client/image.tsx | 42 +-- packages/next/compiled/chalk/index.js | 2 +- .../compiled/escape-string-regexp/LICENSE | 9 - .../compiled/escape-string-regexp/index.js | 1 - .../escape-string-regexp/package.json | 1 - packages/next/compiled/ora/index.js | 2 +- packages/next/compiled/punycode/package.json | 1 + packages/next/compiled/punycode/punycode.js | 1 + .../resolve-url-loader/engine/fail.js | 1 - .../resolve-url-loader/engine/postcss.js | 1 - .../resolve-url-loader/engine/rework.js | 1 - .../next/compiled/resolve-url-loader/index.js | 1 - .../compiled/resolve-url-loader/package.json | 1 - .../next/compiled/setimmediate/package.json | 1 + .../compiled/setimmediate/setImmediate.js | 1 + .../next/compiled/timers-browserify/main.js | 2 +- packages/next/lib/load-custom-routes.ts | 2 +- packages/next/package.json | 18 +- packages/next/pages/_document.tsx | 27 +- packages/next/shared/lib/escape-regexp.ts | 4 + packages/next/shared/lib/post-process.ts | 4 +- packages/next/shared/lib/router/router.ts | 6 +- .../lib/router/utils/prepare-destination.ts | 2 +- packages/next/shared/lib/utils.ts | 2 +- packages/next/taskfile.js | 61 ++-- packages/next/trace/report/to-json.ts | 8 +- packages/next/trace/shared.ts | 4 +- packages/next/trace/trace.ts | 8 +- packages/next/types/misc.d.ts | 4 - packages/react-dev-overlay/package.json | 2 +- packages/react-refresh-utils/package.json | 2 +- scripts/send-trace-to-jaeger.mjs | 68 ----- scripts/send-trace-to-jaeger/src/main.rs | 18 ++ .../basic/node-browser-polyfills.test.ts} | 24 +- .../node-browser-polyfills/pages/index.js} | 43 +-- .../404-page/pages/invalidExtension.d.ts | 1 + test/integration/404-page/test/index.test.js | 5 + .../api-body-parser/test/index.test.js | 8 +- test/integration/cli/test/index.test.js | 43 +++ .../custom-server/test/index.test.js | 4 +- .../test/index.test.js | 11 +- .../fetch-polyfill/test/index.test.js | 11 +- .../filesystempublicroutes/test/index.test.js | 8 +- .../pages/_document.js | 36 +++ .../pages/index.js | 8 + .../font-optimization/test/index.test.js | 6 + .../core/pages/rewrites/_middleware.js | 10 +- .../core/pages/rewrites/about-bypass.js | 12 + .../middleware/core/test/index.test.js | 12 + test/integration/ondemand/test/index.test.js | 4 +- .../pages/invalidExtension.d.ts | 1 + .../page-extensions/test/index.test.js | 13 + .../polyfill-node-modules/next.config.js | 6 - .../router-hash-navigation/pages/index.js | 16 + .../router-hash-navigation/test/index.test.js | 51 ++++ .../url-global-partial/assets/light.svg | 17 ++ .../url-global-partial/pages/_app.js | 13 + .../url-global-partial/pages/index.js | 3 + .../url-global-partial/styles/dark2.svg | 17 ++ .../url-global-partial/styles/global1.scss | 3 + .../url-global-partial/styles/global2.scss | 6 + .../url-global-partial/styles/global2b.scss | 6 + .../styles/subdirectory/_partial.scss | 4 + .../styles/subdirectory/darka.svg | 17 ++ .../styles/subdirectory/darkb.svg | 17 ++ test/integration/scss/test/index.test.js | 48 +++ test/production/required-server-files.test.ts | 16 + .../pages/middleware/_middleware.js | 3 + .../google-font-display.test.ts | 8 +- .../google-font-preconnect.test.ts | 4 +- .../eslint-plugin-next/link-passhref.test.ts | 4 +- .../next-script-for-ga.test.ts | 2 +- .../eslint-plugin-next/no-css-tags.test.ts | 4 +- .../no-document-import-in-page.test.ts | 6 +- .../no-head-element.test.ts | 102 +++++++ .../no-head-import-in-document.test.ts | 8 +- .../no-html-link-for-pages.test.ts | 29 +- .../eslint-plugin-next/no-img-element.test.ts | 2 +- .../no-page-custom-font.test.ts | 6 +- .../no-script-in-document.test.ts | 4 +- .../no-script-in-head.test.ts | 2 +- .../no-server-import-in-page.test.ts | 6 +- .../no-sync-scripts.test.ts | 4 +- .../no-title-in-document-head.test.ts | 2 +- .../no-unwanted-polyfillio.test.ts | 6 +- test/unit/image-rendering.test.ts | 26 ++ yarn.lock | 207 ++++++------- 180 files changed, 1992 insertions(+), 927 deletions(-) create mode 100644 errors/no-head-element.md delete mode 100644 examples/with-semantic-ui/.nowignore delete mode 100644 examples/with-semantic-ui/next.config.js delete mode 100644 examples/with-semantic-ui/pages/SmallImage.png rename examples/with-semantic-ui/{pages/LargeImage.png => public/image.png} (100%) rename examples/with-semantic-ui/{pages/styles.css => styles/global.css} (100%) rename examples/{with-typescript-tailwind => with-tailwindcss}/.eslintrc.json (100%) create mode 100644 examples/with-tailwindcss/next-env.d.ts rename examples/{with-typescript-tailwind => with-tailwindcss}/next.config.js (100%) delete mode 100644 examples/with-tailwindcss/pages/_app.js rename examples/{with-typescript-tailwind => with-tailwindcss}/pages/_app.tsx (100%) delete mode 100644 examples/with-tailwindcss/pages/api/hello.js rename examples/{with-typescript-tailwind => with-tailwindcss}/pages/api/hello.ts (100%) rename examples/with-tailwindcss/pages/{index.js => index.tsx} (99%) rename examples/{with-typescript-tailwind => with-tailwindcss}/tsconfig.json (100%) delete mode 100644 examples/with-typescript-tailwind/.gitignore delete mode 100644 examples/with-typescript-tailwind/README.md delete mode 100644 examples/with-typescript-tailwind/components/Seo.tsx delete mode 100644 examples/with-typescript-tailwind/next-env.d.ts delete mode 100644 examples/with-typescript-tailwind/package.json delete mode 100644 examples/with-typescript-tailwind/pages/index.tsx delete mode 100644 examples/with-typescript-tailwind/postcss.config.js delete mode 100644 examples/with-typescript-tailwind/public/favicon.ico delete mode 100644 examples/with-typescript-tailwind/public/vercel.svg delete mode 100644 examples/with-typescript-tailwind/styles/globals.css delete mode 100644 examples/with-typescript-tailwind/tailwind.config.js create mode 100644 packages/eslint-plugin-next/lib/rules/no-head-element.js create mode 100644 packages/next/build/webpack/loaders/resolve-url-loader/index.js create mode 100644 packages/next/build/webpack/loaders/resolve-url-loader/lib/file-protocol.js create mode 100644 packages/next/build/webpack/loaders/resolve-url-loader/lib/join-function.js create mode 100644 packages/next/build/webpack/loaders/resolve-url-loader/lib/postcss.js create mode 100644 packages/next/build/webpack/loaders/resolve-url-loader/lib/value-processor.js create mode 100755 packages/next/cli/next-info.ts delete mode 100644 packages/next/compiled/escape-string-regexp/LICENSE delete mode 100644 packages/next/compiled/escape-string-regexp/index.js delete mode 100644 packages/next/compiled/escape-string-regexp/package.json create mode 100644 packages/next/compiled/punycode/package.json create mode 100644 packages/next/compiled/punycode/punycode.js delete mode 100644 packages/next/compiled/resolve-url-loader/engine/fail.js delete mode 100644 packages/next/compiled/resolve-url-loader/engine/postcss.js delete mode 100644 packages/next/compiled/resolve-url-loader/engine/rework.js delete mode 100644 packages/next/compiled/resolve-url-loader/index.js delete mode 100644 packages/next/compiled/resolve-url-loader/package.json create mode 100644 packages/next/compiled/setimmediate/package.json create mode 100644 packages/next/compiled/setimmediate/setImmediate.js create mode 100644 packages/next/shared/lib/escape-regexp.ts delete mode 100644 scripts/send-trace-to-jaeger.mjs rename test/{integration/polyfill-node-modules/test/index.test.js => development/basic/node-browser-polyfills.test.ts} (70%) rename test/{integration/polyfill-node-modules/pages/node-browser-polyfills.js => development/basic/node-browser-polyfills/pages/index.js} (69%) create mode 100644 test/integration/404-page/pages/invalidExtension.d.ts create mode 100644 test/integration/font-optimization/fixtures/make-stylesheet-inert-regression/pages/_document.js create mode 100644 test/integration/font-optimization/fixtures/make-stylesheet-inert-regression/pages/index.js create mode 100644 test/integration/middleware/core/pages/rewrites/about-bypass.js create mode 100644 test/integration/page-extensions/pages/invalidExtension.d.ts delete mode 100644 test/integration/polyfill-node-modules/next.config.js create mode 100644 test/integration/router-hash-navigation/pages/index.js create mode 100644 test/integration/router-hash-navigation/test/index.test.js create mode 100644 test/integration/scss-fixtures/url-global-partial/assets/light.svg create mode 100644 test/integration/scss-fixtures/url-global-partial/pages/_app.js create mode 100644 test/integration/scss-fixtures/url-global-partial/pages/index.js create mode 100644 test/integration/scss-fixtures/url-global-partial/styles/dark2.svg create mode 100644 test/integration/scss-fixtures/url-global-partial/styles/global1.scss create mode 100644 test/integration/scss-fixtures/url-global-partial/styles/global2.scss create mode 100644 test/integration/scss-fixtures/url-global-partial/styles/global2b.scss create mode 100644 test/integration/scss-fixtures/url-global-partial/styles/subdirectory/_partial.scss create mode 100644 test/integration/scss-fixtures/url-global-partial/styles/subdirectory/darka.svg create mode 100644 test/integration/scss-fixtures/url-global-partial/styles/subdirectory/darkb.svg create mode 100644 test/production/required-server-files/pages/middleware/_middleware.js create mode 100644 test/unit/eslint-plugin-next/no-head-element.test.ts diff --git a/.github/ISSUE_TEMPLATE/1.bug_report.yml b/.github/ISSUE_TEMPLATE/1.bug_report.yml index 440f9434bf332..d0aa0b7589ace 100644 --- a/.github/ISSUE_TEMPLATE/1.bug_report.yml +++ b/.github/ISSUE_TEMPLATE/1.bug_report.yml @@ -14,6 +14,12 @@ body: - type: markdown attributes: value: 'next@canary is the beta version of Next.js. It includes all features and fixes that are pending to land on the stable release line.' + - type: textarea + attributes: + label: Run `next info` (available from version 12.0.8 and up) + description: Please run `next info` in the root directory of your project and paste the results. You might need to use `npx --no-install next info` if next is not in the current PATH. + validations: + required: false - type: input attributes: label: What version of Next.js are you using? diff --git a/.github/workflows/build_test_deploy.yml b/.github/workflows/build_test_deploy.yml index 3e0072d48d0f5..d3a4ecb10f452 100644 --- a/.github/workflows/build_test_deploy.yml +++ b/.github/workflows/build_test_deploy.yml @@ -552,7 +552,7 @@ jobs: - build-windows-aarch64 - build-linux-musl - build-linux-arm7 - - build-linux-aarch64 + - build-linux-aarch64-gnu - build-android-aarch64 - build-linux-aarch64-musl env: @@ -664,16 +664,17 @@ jobs: - id: get-week run: echo ::set-output name=WEEK::$(date +%U) - # - name: Turbo Cache - # id: turbo-cache - # uses: actions/cache@v2 - # if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} - # with: - # path: .turbo - # key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ steps.get-week.outputs.WEEK }}-${{ github.sha }} - # restore-keys: | - # turbo-${{ github.job }}-${{ github.ref_name }}-${{ steps.get-week.outputs.WEEK }}- - # turbo-${{ github.job }}-canary-${{ steps.get-week.outputs.WEEK }}- + - name: Turbo Cache + id: turbo-cache + uses: actions/cache@v2 + if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} + with: + path: .turbo + key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ steps.get-week.outputs.WEEK }}-${{ github.sha }} + restore-keys: | + turbo-${{ github.job }}- + turbo-${{ github.job }}-${{ github.ref_name }}-${{ steps.get-week.outputs.WEEK }}- + turbo-${{ github.job }}-canary-${{ steps.get-week.outputs.WEEK }}- # We use restore-key to pick latest cache. # We will not get exact match, but doc says @@ -683,19 +684,18 @@ jobs: uses: actions/cache@v2 with: path: ./packages/next-swc/target - key: next-swc-cargo-cache-ubuntu-18.04--${{ hashFiles('**/Cargo.lock') }} + key: next-swc-cargo-cache-dev-ubuntu-18.04-${{ hashFiles('**/Cargo.lock') }} restore-keys: | - next-swc-cargo-cache-ubuntu-18.04 + next-swc-cargo-cache-dev-ubuntu-18.04 # since the repo's dependencies aren't installed we need # to install napi globally - run: npm i -g @napi-rs/cli@1.2.1 - - run: npm i -g turbo@1.0.14 + - run: npm i -g turbo@1.0.24 - name: Build if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} - working-directory: packages/next-swc - run: yarn build-native + run: turbo run build-native --cache-dir=".turbo" env: MACOSX_DEPLOYMENT_TARGET: '10.13' TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} @@ -829,6 +829,7 @@ jobs: # since the repo's dependencies aren't installed we need # to install napi globally - run: npm i -g @napi-rs/cli@1.2.1 + - run: npm i -g turbo@1.0.24 - name: Install uses: actions-rs/toolchain@v1 @@ -849,15 +850,16 @@ jobs: path: ~/.cargo/git key: stable-${{ matrix.os }}-node@14-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }} - # - name: Turbo cache - # id: turbo-cache - # uses: actions/cache@v2 - # with: - # path: .turbo - # key: turbo-${{ github.job }}-${{ matrix.name }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} - # restore-keys: | - # turbo-${{ github.job }}-${{ matrix.name }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- - # turbo-${{ github.job }}-${{ matrix.name }}-canary-${{ needs.build.outputs.weekNum }}- + - name: Turbo cache + id: turbo-cache + uses: actions/cache@v2 + with: + path: .turbo + key: turbo-${{ github.job }}-${{ matrix.name }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} + restore-keys: | + turbo-${{ github.job }}-${{ matrix.name }}- + turbo-${{ github.job }}-${{ matrix.name }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- + turbo-${{ github.job }}-${{ matrix.name }}-canary-${{ needs.build.outputs.weekNum }}- - name: Cross build aarch64 setup if: ${{ matrix.target == 'aarch64-apple-darwin' }} @@ -880,8 +882,8 @@ jobs: next-swc-cargo-cache-${{ matrix.os }} - name: 'Build' - working-directory: packages/next-swc - run: yarn build-native --release --target ${{ matrix.target }} + shell: bash + run: turbo run build-native --cache-dir=".turbo" -- --release --target ${{ matrix.target }} env: MACOSX_DEPLOYMENT_TARGET: '10.13' TURBO_TOKEN: ${{secrets.TURBO_TOKEN}} @@ -928,7 +930,7 @@ jobs: # since the repo's dependencies aren't installed we need # to install napi globally - run: npm i -g @napi-rs/cli@1.2.1 - - run: npm i -g turbo@1.0.14 + - run: npm i -g turbo@1.0.24 - name: Install Rust uses: actions-rs/toolchain@v1 with: @@ -937,20 +939,20 @@ jobs: override: true target: i686-pc-windows-msvc - # - name: Turbo Cache - # id: turbo-cache - # uses: actions/cache@v2 - # with: - # path: .turbo - # key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} - # restore-keys: | - # turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- - # turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}- + - name: Turbo Cache + id: turbo-cache + uses: actions/cache@v2 + with: + path: .turbo + key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} + restore-keys: | + turbo-${{ github.job }}- + turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- + turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}- - name: Build shell: bash - working-directory: packages/next-swc - run: yarn build-native --release --target i686-pc-windows-msvc + run: turbo run build-native --cache-dir=".turbo" -- --release --target i686-pc-windows-msvc - name: Upload artifact uses: actions/upload-artifact@v2 @@ -976,7 +978,7 @@ jobs: # since the repo's dependencies aren't installed we need # to install napi globally - run: npm i -g @napi-rs/cli@1.2.1 - - run: npm i -g turbo@1.0.14 + - run: npm i -g turbo@1.0.24 - name: Install Rust uses: actions-rs/toolchain@v1 with: @@ -985,20 +987,20 @@ jobs: override: true target: aarch64-pc-windows-msvc - # - name: Turbo Cache - # id: turbo-cache - # uses: actions/cache@v2 - # with: - # path: .turbo - # key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} - # restore-keys: | - # turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- - # turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}- + - name: Turbo Cache + id: turbo-cache + uses: actions/cache@v2 + with: + path: .turbo + key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} + restore-keys: | + turbo-${{ github.job }}- + turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- + turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}- - name: Build shell: bash - working-directory: packages/next-swc - run: yarn build-native --release --target aarch64-pc-windows-msvc + run: turbo run build-native --cache-dir=".turbo" -- --release --target aarch64-pc-windows-msvc - name: Upload artifact uses: actions/upload-artifact@v2 @@ -1036,19 +1038,20 @@ jobs: docker pull ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine docker tag ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine builder - # - name: Turbo Cache - # id: turbo-cache - # uses: actions/cache@v2 - # with: - # path: .turbo - # key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} - # restore-keys: | - # turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- - # turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}- + - name: Turbo Cache + id: turbo-cache + uses: actions/cache@v2 + with: + path: .turbo + key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} + restore-keys: | + turbo-${{ github.job }}- + turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- + turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}- - name: 'Build' run: | - docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd)/packages/next-swc:/build -w /build builder sh -c "npm i -g @napi-rs/cli@1.2.1 && npm i -g turbo@1.0.14 && yarn build-native --release --target x86_64-unknown-linux-musl" + docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/build -w /build builder sh -c "npm i -g @napi-rs/cli@1.2.1 && npm i -g turbo@1.0.24 && turbo run build-native --cache-dir=".turbo" -- --release --target x86_64-unknown-linux-musl" - name: Upload artifact uses: actions/upload-artifact@v2 @@ -1056,7 +1059,7 @@ jobs: name: next-swc-binaries path: packages/next-swc/native/next-swc.linux-x64-musl.node - build-linux-aarch64: + build-linux-aarch64-gnu: needs: build if: ${{ needs.build.outputs.isRelease == 'true' }} name: next-swc - aarch64-unknown-linux-gnu - node@14 @@ -1076,7 +1079,7 @@ jobs: # since the repo's dependencies aren't installed we need # to install napi globally - run: npm i -g @napi-rs/cli@1.2.1 - - run: npm i -g turbo@1.0.14 + - run: npm i -g turbo@1.0.24 - name: Install Rust uses: actions-rs/toolchain@v1 @@ -1098,20 +1101,20 @@ jobs: sudo apt-get update sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu -y - # - name: Turbo Cache - # id: turbo-cache - # uses: actions/cache@v2 - # with: - # path: .turbo - # key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} - # restore-keys: | - # turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- - # turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}- + - name: Turbo Cache + id: turbo-cache + uses: actions/cache@v2 + with: + path: .turbo + key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} + restore-keys: | + turbo-${{ github.job }}- + turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- + turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}- - name: Cross build aarch64 - working-directory: packages/next-swc if: ${{ steps.binary-cache.outputs.cache-hit != 'true' }} - run: yarn build-native --release --target aarch64-unknown-linux-gnu + run: turbo run build-native --cache-dir=".turbo" -- --release --target aarch64-unknown-linux-gnu - name: Upload artifact uses: actions/upload-artifact@v2 @@ -1137,7 +1140,7 @@ jobs: # since the repo's dependencies aren't installed we need # to install napi globally - run: npm i -g @napi-rs/cli@1.2.1 - - run: npm i -g turbo@1.0.14 + - run: npm i -g turbo@1.0.24 - name: Install Rust uses: actions-rs/toolchain@v1 with: @@ -1158,19 +1161,19 @@ jobs: sudo apt-get update sudo apt-get install gcc-aarch64-linux-gnu -y - # - name: Turbo Cache - # id: turbo-cache - # uses: actions/cache@v2 - # with: - # path: .turbo - # key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} - # restore-keys: | - # turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- - # turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}- + - name: Turbo Cache + id: turbo-cache + uses: actions/cache@v2 + with: + path: .turbo + key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} + restore-keys: | + turbo-${{ github.job }}- + turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- + turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}- - name: Cross build aarch64 - working-directory: packages/next-swc - run: yarn build-native --release --target aarch64-unknown-linux-musl + run: turbo run build-native --cache-dir=".turbo" -- --release --target aarch64-unknown-linux-musl - name: Upload artifact uses: actions/upload-artifact@v2 @@ -1198,7 +1201,7 @@ jobs: # since the repo's dependencies aren't installed we need # to install napi globally - run: npm i -g @napi-rs/cli@1.2.1 - - run: npm i -g turbo@1.0.14 + - run: npm i -g turbo@1.0.24 - name: Install Rust uses: actions-rs/toolchain@v1 @@ -1220,19 +1223,19 @@ jobs: sudo apt-get update sudo apt-get install gcc-arm-linux-gnueabihf -y - # - name: Turbo Cache - # id: turbo-cache - # uses: actions/cache@v2 - # with: - # path: .turbo - # key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} - # restore-keys: | - # turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- - # turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}- + - name: Turbo Cache + id: turbo-cache + uses: actions/cache@v2 + with: + path: .turbo + key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} + restore-keys: | + turbo-${{ github.job }}- + turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- + turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}- - name: Cross build aarch64 - working-directory: packages/next-swc - run: yarn build-native --release --target armv7-unknown-linux-gnueabihf + run: turbo run build-native --cache-dir=".turbo" -- --release --target armv7-unknown-linux-gnueabihf - name: Upload artifact uses: actions/upload-artifact@v2 @@ -1258,7 +1261,7 @@ jobs: # since the repo's dependencies aren't installed we need # to install napi globally - run: npm i -g @napi-rs/cli@1.2.1 - - run: npm i -g turbo@1.0.14 + - run: npm i -g turbo@1.0.24 - name: Install Rust uses: actions-rs/toolchain@v1 @@ -1268,22 +1271,22 @@ jobs: override: true target: aarch64-linux-android - # - name: Turbo Cache - # id: turbo-cache - # uses: actions/cache@v2 - # with: - # path: .turbo - # key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} - # restore-keys: | - # turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- - # turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}- + - name: Turbo Cache + id: turbo-cache + uses: actions/cache@v2 + with: + path: .turbo + key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} + restore-keys: | + turbo-${{ github.job }}- + turbo-${{ github.job }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- + turbo-${{ github.job }}-canary-${{ needs.build.outputs.weekNum }}- - name: Build shell: bash - working-directory: packages/next-swc run: | export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android24-clang" - yarn build-native --release --target aarch64-linux-android + turbo run build-native --cache-dir=".turbo" -- --release --target aarch64-linux-android - name: Upload artifact uses: actions/upload-artifact@v2 @@ -1318,22 +1321,27 @@ jobs: override: true target: wasm32-unknown-unknown - - name: Cache + - run: npm i -g turbo@1.0.24 + + - name: Turbo cache + id: turbo-cache uses: actions/cache@v2 with: - path: | - ~/.cargo/ - **/target/ - key: ${{ runner.os }}-publish-integration + path: .turbo + key: turbo-${{ github.job }}-${{ matrix.target }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}-${{ github.sha }} + restore-keys: | + turbo-${{ github.job }}-${{ matrix.target }}- + turbo-${{ github.job }}-${{ matrix.target }}-${{ github.ref_name }}-${{ needs.build.outputs.weekNum }}- + turbo-${{ github.job }}-${{ matrix.target }}-canary-${{ needs.build.outputs.weekNum }}- - name: Install wasm-pack run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - name: Build - run: (wasm-pack build packages/next-swc/crates/wasm --release --scope=next --target ${{ matrix.target }}) + run: turbo run build-wasm --cache-dir=".turbo" -- --target ${{ matrix.target }} - name: Add target to folder name - run: mv packages/next-swc/crates/wasm/pkg packages/next-swc/crates/wasm/pkg-${{ matrix.target }} + run: '[[ -d "packages/next-swc/crates/wasm/pkg" ]] && mv packages/next-swc/crates/wasm/pkg packages/next-swc/crates/wasm/pkg-${{ matrix.target }} || ls packages/next-swc/crates/wasm' - name: Upload artifact uses: actions/upload-artifact@v2 @@ -1358,6 +1366,8 @@ jobs: with: node-version: 14 + - run: npm i -g turbo@1.0.24 + - name: Install Rust if: ${{needs.build.outputs.docsChange != 'docs only change'}} uses: actions-rs/toolchain@v1 @@ -1367,34 +1377,29 @@ jobs: override: true target: wasm32-unknown-unknown - - name: Cache - if: ${{needs.build.outputs.docsChange != 'docs only change'}} - uses: actions/cache@v2 - with: - path: | - ~/.cargo/ - **/target/ - key: ${{ runner.os }}-publish-integration - - - name: Cache wasm binary - if: ${{needs.build.outputs.docsChange != 'docs only change'}} - id: binary-cache + - name: Turbo Cache + id: turbo-cache uses: actions/cache@v2 + if: ${{ steps.docs-change.outputs.DOCS_CHANGE != 'docs only change' }} with: - path: packages/next-swc/crates/wasm/pkg-nodejs - key: dev-wasm-next-swc-nightly-2021-11-15-${{ hashFiles('.github/workflows/build_test_deploy.yml', 'packages/next-swc/**') }} + path: .turbo + key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ steps.get-week.outputs.WEEK }}-${{ github.sha }} + restore-keys: | + turbo-${{ github.job }}- + turbo-${{ github.job }}-${{ github.ref_name }}-${{ steps.get-week.outputs.WEEK }}- + turbo-${{ github.job }}-canary-${{ steps.get-week.outputs.WEEK }}- - name: Install wasm-pack - if: ${{needs.build.outputs.docsChange != 'docs only change' && steps.binary-cache.outputs.cache-hit != 'true'}} + if: ${{needs.build.outputs.docsChange != 'docs only change'}} run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - name: Build - if: ${{needs.build.outputs.docsChange != 'docs only change' && steps.binary-cache.outputs.cache-hit != 'true'}} - run: (wasm-pack build packages/next-swc/crates/wasm --dev --scope=next --target nodejs) + if: ${{needs.build.outputs.docsChange != 'docs only change'}} + run: turbo run build-wasm --cache-dir=".turbo" -- --target nodejs --dev - name: Add target to folder name - if: ${{needs.build.outputs.docsChange != 'docs only change' && steps.binary-cache.outputs.cache-hit != 'true'}} - run: mv packages/next-swc/crates/wasm/pkg packages/next-swc/crates/wasm/pkg-nodejs + if: ${{needs.build.outputs.docsChange != 'docs only change'}} + run: '[[ -d "packages/next-swc/crates/wasm/pkg" ]] && mv packages/next-swc/crates/wasm/pkg packages/next-swc/crates/wasm/pkg-nodejs || ls packages/next-swc/crates/wasm' - name: Upload artifact if: ${{needs.build.outputs.docsChange != 'docs only change'}} diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 2e779633de1af..4d15b37533f69 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -14,7 +14,8 @@ jobs: with: only-labels: 'please add a complete reproduction' close-issue-message: 'This issue has been automatically closed after 30 days of inactivity with no reproduction. If you are running into a similar issue, please open a new issue with a reproduction. Thank you.' - days-before-issue-close: 30 + days-before-issue-close: 1 + days-before-issue-stale: 30 days-before-pr-close: -1 days-before-pr-stale: -1 exempt-issue-labels: 'blocked,must,should,keep' diff --git a/docs/advanced-features/measuring-performance.md b/docs/advanced-features/measuring-performance.md index 789d94bb8759c..0a861b416473d 100644 --- a/docs/advanced-features/measuring-performance.md +++ b/docs/advanced-features/measuring-performance.md @@ -164,7 +164,7 @@ export function reportWebVitals(metric) { > ```js > export function reportWebVitals({ id, name, label, value }) { > // Use `window.gtag` if you initialized Google Analytics as this example: -> // https://github.com/vercel/next.js/blob/canary/examples/with-google-analytics/pages/_document.js +> // https://github.com/vercel/next.js/blob/canary/examples/with-google-analytics/pages/_app.js > window.gtag('event', name, { > event_category: > label === 'web-vital' ? 'Web Vitals' : 'Next.js custom metric', diff --git a/docs/advanced-features/react-18.md b/docs/advanced-features/react-18.md index 60f7504837f55..1d82c82b71b47 100644 --- a/docs/advanced-features/react-18.md +++ b/docs/advanced-features/react-18.md @@ -12,6 +12,8 @@ Ensure you have the `rc` npm tag of React installed: npm install next@latest react@rc react-dom@rc ``` +That's all! You can now start using React 18's new APIs like `startTransition` and `Suspense` in Next.js. + ### Enable SSR Streaming (Alpha) Concurrent features in React 18 include built-in support for server-side Suspense and SSR streaming support, allowing you to server-render pages using HTTP streaming. diff --git a/docs/api-reference/cli.md b/docs/api-reference/cli.md index b79edb5f0bbce..20b36920d7bf3 100644 --- a/docs/api-reference/cli.md +++ b/docs/api-reference/cli.md @@ -21,7 +21,7 @@ Usage $ next Available commands - build, start, export, dev, lint, telemetry + build, start, export, dev, lint, telemetry, info Options --version, -v Version number @@ -125,3 +125,36 @@ Next.js collects **completely anonymous** telemetry data about general usage. Participation in this anonymous program is optional, and you may opt-out if you'd not like to share any information. To learn more about Telemetry, [please read this document](https://nextjs.org/telemetry/). + +## Info + +`next info` prints relevant details about the current system which can be used to report Next.js bugs. +This information includes Operating System platform/arch/version, Binaries (Node.js, npm, Yarn, pnpm) and npm package versions (`next`, `react`, `react-dom`). + +Running the following in your project's root directory: + +```bash +next info +``` + +will give you information like this example: + +```bash + + Operating System: + Platform: linux + Arch: x64 + Version: #22-Ubuntu SMP Fri Nov 5 13:21:36 UTC 2021 + Binaries: + Node: 16.13.0 + npm: 8.1.0 + Yarn: 1.22.17 + pnpm: 6.24.2 + Relevant packages: + next: 12.0.8 + react: 17.0.2 + react-dom: 17.0.2 + +``` + +This information should then be pasted into GitHub Issues. diff --git a/docs/api-reference/next/link.md b/docs/api-reference/next/link.md index ba6b656b7aa9b..a7ad63ca27047 100644 --- a/docs/api-reference/next/link.md +++ b/docs/api-reference/next/link.md @@ -204,7 +204,7 @@ The default behavior of the `Link` component is to `push` a new URL into the `hi The default behavior of `Link` is to scroll to the top of the page. When there is a hash defined it will scroll to the specific id, like a normal `` tag. To prevent scrolling to the top / hash `scroll={false}` can be added to `Link`: ```jsx - + Disables scrolling to the top ``` diff --git a/docs/basic-features/eslint.md b/docs/basic-features/eslint.md index 5e50cc656c4fb..1ce00e9cdaf00 100644 --- a/docs/basic-features/eslint.md +++ b/docs/basic-features/eslint.md @@ -90,6 +90,7 @@ Next.js provides an ESLint plugin, [`eslint-plugin-next`](https://www.npmjs.com/ | ✔️ | [next/no-head-import-in-document](https://nextjs.org/docs/messages/no-head-import-in-document) | Disallow importing next/head in pages/document.js | | ✔️ | [next/no-html-link-for-pages](https://nextjs.org/docs/messages/no-html-link-for-pages) | Prohibit HTML anchor links to pages without a Link component | | ✔️ | [next/no-img-element](https://nextjs.org/docs/messages/no-img-element) | Prohibit usage of HTML <img> element | +| ✔️ | [next/no-head-element](https://nextjs.org/docs/messages/no-head-element) | Prohibit usage of HTML <head> element | | ✔️ | [next/no-page-custom-font](https://nextjs.org/docs/messages/no-page-custom-font) | Prevent page-only custom fonts | | ✔️ | [next/no-sync-scripts](https://nextjs.org/docs/messages/no-sync-scripts) | Forbid synchronous scripts | | ✔️ | [next/no-title-in-document-head](https://nextjs.org/docs/messages/no-title-in-document-head) | Disallow using <title> with Head from next/document | @@ -202,11 +203,15 @@ Then, add `prettier` to your existing ESLint config: If you would like to use `next lint` with [lint-staged](https://github.com/okonet/lint-staged) to run the linter on staged git files, you'll have to add the following to the `.lintstagedrc.js` file in the root of your project in order to specify usage of the `--file` flag. ```js +const path = require('path') + +const buildEslintCommand = (filenames) => + `next lint --fix --file ${filenames + .map((f) => path.relative(process.cwd(), f)) + .join(' --file ')}` + module.exports = { - '**/*.js?(x)': (filenames) => - `next lint --fix --file ${filenames - .map((file) => file.split(process.cwd())[1]) - .join(' --file ')}`, + '*.{js,jsx,ts,tsx}': [buildEslintCommand], } ``` diff --git a/errors/manifest.json b/errors/manifest.json index bb7a91f4a85c7..4aaeead555a5a 100644 --- a/errors/manifest.json +++ b/errors/manifest.json @@ -447,6 +447,7 @@ "path": "/errors/link-multiple-children.md" }, { "title": "no-img-element", "path": "/errors/no-img-element.md" }, + { "title": "no-head-element", "path": "/errors/no-head-element.md" }, { "title": "non-dynamic-getstaticpaths-usage", "path": "/errors/non-dynamic-getstaticpaths-usage.md" diff --git a/errors/no-head-element.md b/errors/no-head-element.md new file mode 100644 index 0000000000000..670894e64a445 --- /dev/null +++ b/errors/no-head-element.md @@ -0,0 +1,30 @@ +# No Head Element + +### Why This Error Occurred + +An HTML `` element was used to include page-level metadata, but this can cause unexpected behavior in a Next.js application. Use Next.js' built-in `` component instead. + +### Possible Ways to Fix It + +Import and use the `` component: + +```jsx +import Head from 'next/head' + +function Index() { + return ( + <> + + My page title + + + + ) +} + +export default Index +``` + +### Useful Links + +- [next/head](https://nextjs.org/docs/api-reference/next/head) diff --git a/errors/no-page-custom-font.md b/errors/no-page-custom-font.md index 51052a34422cb..edcea71d99b33 100644 --- a/errors/no-page-custom-font.md +++ b/errors/no-page-custom-font.md @@ -3,7 +3,7 @@ ### Why This Error Occurred - The custom font you're adding was added to a page - this only adds the font to the specific page and not the entire application. -- The custom font you're adding was added to a separate component within `Document` - this disables automatic font optimiztion. +- The custom font you're adding was added to a separate component within `Document` - this disables automatic font optimization. ### Possible Ways to Fix It diff --git a/examples/cms-kontent/components/cover-image.js b/examples/cms-kontent/components/cover-image.js index 7b00d3adf6a44..cf76be52975fd 100644 --- a/examples/cms-kontent/components/cover-image.js +++ b/examples/cms-kontent/components/cover-image.js @@ -17,7 +17,7 @@ export default function CoverImage({ title, src, slug }) { return (
{slug ? ( - + {image} ) : ( diff --git a/examples/cms-kontent/lib/api.js b/examples/cms-kontent/lib/api.js index a56eaea502017..e764e982e9f43 100644 --- a/examples/cms-kontent/lib/api.js +++ b/examples/cms-kontent/lib/api.js @@ -1,5 +1,5 @@ import { DeliveryClient } from '@kentico/kontent-delivery' -import { name, version } from '../package.json' +import pkg from '../package.json' const sourceTrackingHeaderName = 'X-KC-SOURCE' @@ -9,7 +9,7 @@ const client = new DeliveryClient({ globalHeaders: (_queryConfig) => [ { header: sourceTrackingHeaderName, - value: `@vercel/next.js/example/${name};${version}`, + value: `@vercel/next.js/example/${pkg.name};${pkg.version}`, }, ], }) diff --git a/examples/with-docker/Dockerfile b/examples/with-docker/Dockerfile index 57e44c4e05ced..aa4b329d5e399 100644 --- a/examples/with-docker/Dockerfile +++ b/examples/with-docker/Dockerfile @@ -9,9 +9,9 @@ RUN yarn install --frozen-lockfile # Rebuild the source code only when needed FROM node:16-alpine AS builder WORKDIR /app -COPY . . COPY --from=deps /app/node_modules ./node_modules -RUN yarn build && yarn install --production --ignore-scripts --prefer-offline +COPY . . +RUN yarn build # Production image, copy all the files and run next FROM node:16-alpine AS runner diff --git a/examples/with-jest/package.json b/examples/with-jest/package.json index a2a95622fd778..23e5d9ed94c85 100644 --- a/examples/with-jest/package.json +++ b/examples/with-jest/package.json @@ -17,10 +17,12 @@ "@testing-library/jest-dom": "5.16.1", "@testing-library/react": "12.1.2", "@testing-library/user-event": "13.5.0", + "@types/react": "17.0.38", "babel-jest": "27.4.5", "eslint": "8.5.0", "eslint-config-next": "latest", "eslint-plugin-testing-library": "5.0.1", - "jest": "27.4.5" + "jest": "27.4.5", + "typescript": "4.5.4" } } diff --git a/examples/with-segment-analytics/pages/_app.js b/examples/with-segment-analytics/pages/_app.js index 402797f3fa0b1..5c2c2bf7d0a2d 100644 --- a/examples/with-segment-analytics/pages/_app.js +++ b/examples/with-segment-analytics/pages/_app.js @@ -24,7 +24,10 @@ function MyApp({ Component, pageProps }) { return ( {/* Inject the Segment snippet into the of the document */} - - - ); -} - -export default SEO; \ No newline at end of file diff --git a/examples/with-typescript-tailwind/next-env.d.ts b/examples/with-typescript-tailwind/next-env.d.ts deleted file mode 100644 index 6080addc2d959..0000000000000 --- a/examples/with-typescript-tailwind/next-env.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -/// -/// diff --git a/examples/with-typescript-tailwind/package.json b/examples/with-typescript-tailwind/package.json deleted file mode 100644 index 2020ba950f038..0000000000000 --- a/examples/with-typescript-tailwind/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "private": true, - "scripts": { - "dev": "next dev", - "build": "next build", - "start": "next start", - "lint": "next lint" - }, - "dependencies": { - "next": "12.0.7", - "react": "17.0.2", - "react-dom": "17.0.2" - }, - "devDependencies": { - "@types/node": "17.0.4", - "@types/react": "17.0.38", - "autoprefixer": "^10.4.0", - "eslint": "8.5.0", - "eslint-config-next": "12.0.7", - "postcss": "^8.4.5", - "tailwindcss": "^3.0.7", - "typescript": "4.5.4" - } -} diff --git a/examples/with-typescript-tailwind/pages/index.tsx b/examples/with-typescript-tailwind/pages/index.tsx deleted file mode 100644 index 59d7d4a72bbe6..0000000000000 --- a/examples/with-typescript-tailwind/pages/index.tsx +++ /dev/null @@ -1,25 +0,0 @@ -/* eslint-disable @next/next/link-passhref */ -import Link from 'next/link'; -import * as React from 'react'; - -export default function Home() { - return ( -
-
-
-

Next.js + Tailwind CSS + TypeScript Starter

-

- A starter for Next.js, Tailwind CSS, and TypeScript with Seo. -

-

- - - See the repository - - -

-
-
-
- ); -} \ No newline at end of file diff --git a/examples/with-typescript-tailwind/postcss.config.js b/examples/with-typescript-tailwind/postcss.config.js deleted file mode 100644 index 33ad091d26d8a..0000000000000 --- a/examples/with-typescript-tailwind/postcss.config.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {}, - }, -} diff --git a/examples/with-typescript-tailwind/public/favicon.ico b/examples/with-typescript-tailwind/public/favicon.ico deleted file mode 100644 index 718d6fea4835ec2d246af9800eddb7ffb276240c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 25931 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 LrJugUA?W`A8`#=m diff --git a/examples/with-typescript-tailwind/public/vercel.svg b/examples/with-typescript-tailwind/public/vercel.svg deleted file mode 100644 index fbf0e25a651c2..0000000000000 --- a/examples/with-typescript-tailwind/public/vercel.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - \ No newline at end of file diff --git a/examples/with-typescript-tailwind/styles/globals.css b/examples/with-typescript-tailwind/styles/globals.css deleted file mode 100644 index bd6213e1dfe6b..0000000000000 --- a/examples/with-typescript-tailwind/styles/globals.css +++ /dev/null @@ -1,3 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; \ No newline at end of file diff --git a/examples/with-typescript-tailwind/tailwind.config.js b/examples/with-typescript-tailwind/tailwind.config.js deleted file mode 100644 index 6b9e53b5373ae..0000000000000 --- a/examples/with-typescript-tailwind/tailwind.config.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - purge: { enabled: true, content: [ - "./pages/**/*.{js,ts,jsx,tsx}", - "./components/**/*.{js,ts,jsx,tsx}", - ],}, - theme: { - extend: {}, - }, - plugins: [], -} \ No newline at end of file diff --git a/lerna.json b/lerna.json index 71fe03a602351..f975ce5a8ff8f 100644 --- a/lerna.json +++ b/lerna.json @@ -17,5 +17,5 @@ "registry": "https://registry.npmjs.org/" } }, - "version": "12.0.8-canary.13" + "version": "12.0.8-canary.17" } diff --git a/package.json b/package.json index 57b89394cb885..1d2b13d141d41 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "@types/fs-extra": "8.1.0", "@types/http-proxy": "1.17.3", "@types/jest": "24.0.13", + "@types/node": "13.11.0", "@types/selenium-webdriver": "4.0.15", "@types/sharp": "0.29.3", "@types/string-hash": "1.1.1", @@ -87,13 +88,13 @@ "async-sema": "3.0.1", "browserslist": "4.18.1", "cheerio": "0.22.0", - "clone": "2.1.2", "cookie": "0.4.1", "cors": "2.8.5", "coveralls": "3.0.3", "critters": "0.0.6", "cross-env": "6.0.3", "cross-spawn": "6.0.5", + "es5-ext": "0.10.53", "escape-string-regexp": "2.0.0", "eslint": "7.24.0", "eslint-plugin-import": "2.22.1", @@ -153,7 +154,7 @@ "tailwindcss": "1.1.3", "taskr": "1.1.0", "tree-kill": "1.2.2", - "turbo": "1.0.14", + "turbo": "1.0.24", "typescript": "4.4.3", "wait-port": "0.2.2", "web-streams-polyfill": "2.1.1", diff --git a/packages/create-next-app/package.json b/packages/create-next-app/package.json index 32ea613a75377..a095e220fc013 100644 --- a/packages/create-next-app/package.json +++ b/packages/create-next-app/package.json @@ -1,6 +1,6 @@ { "name": "create-next-app", - "version": "12.0.8-canary.13", + "version": "12.0.8-canary.17", "keywords": [ "react", "next", diff --git a/packages/eslint-config-next/package.json b/packages/eslint-config-next/package.json index d52e6803fd7b6..97a558e6f4a10 100644 --- a/packages/eslint-config-next/package.json +++ b/packages/eslint-config-next/package.json @@ -1,6 +1,6 @@ { "name": "eslint-config-next", - "version": "12.0.8-canary.13", + "version": "12.0.8-canary.17", "description": "ESLint configuration used by NextJS.", "main": "index.js", "license": "MIT", @@ -9,7 +9,7 @@ "directory": "packages/eslint-config-next" }, "dependencies": { - "@next/eslint-plugin-next": "12.0.8-canary.13", + "@next/eslint-plugin-next": "12.0.8-canary.17", "@rushstack/eslint-patch": "^1.0.8", "@typescript-eslint/parser": "^5.0.0", "eslint-import-resolver-node": "^0.3.4", diff --git a/packages/eslint-plugin-next/lib/index.js b/packages/eslint-plugin-next/lib/index.js index e793d37e6d1d5..c5ef6936c09a7 100644 --- a/packages/eslint-plugin-next/lib/index.js +++ b/packages/eslint-plugin-next/lib/index.js @@ -4,6 +4,7 @@ module.exports = { 'no-sync-scripts': require('./rules/no-sync-scripts'), 'no-html-link-for-pages': require('./rules/no-html-link-for-pages'), 'no-img-element': require('./rules/no-img-element'), + 'no-head-element': require('./rules/no-head-element'), 'no-unwanted-polyfillio': require('./rules/no-unwanted-polyfillio'), 'no-page-custom-font': require('./rules/no-page-custom-font'), 'no-title-in-document-head': require('./rules/no-title-in-document-head'), @@ -28,6 +29,7 @@ module.exports = { '@next/next/no-sync-scripts': 1, '@next/next/no-html-link-for-pages': 1, '@next/next/no-img-element': 1, + '@next/next/no-head-element': 1, '@next/next/no-unwanted-polyfillio': 1, '@next/next/no-page-custom-font': 1, '@next/next/no-title-in-document-head': 1, diff --git a/packages/eslint-plugin-next/lib/rules/google-font-display.js b/packages/eslint-plugin-next/lib/rules/google-font-display.js index e81ff0760ddee..7a0995eb7a6fc 100644 --- a/packages/eslint-plugin-next/lib/rules/google-font-display.js +++ b/packages/eslint-plugin-next/lib/rules/google-font-display.js @@ -48,7 +48,7 @@ module.exports = { if (message) { context.report({ node, - message: `${message} See https://nextjs.org/docs/messages/google-font-display.`, + message: `${message} See: https://nextjs.org/docs/messages/google-font-display`, }) } }, diff --git a/packages/eslint-plugin-next/lib/rules/google-font-preconnect.js b/packages/eslint-plugin-next/lib/rules/google-font-preconnect.js index 70df0aa691db5..a217618905a5e 100644 --- a/packages/eslint-plugin-next/lib/rules/google-font-preconnect.js +++ b/packages/eslint-plugin-next/lib/rules/google-font-preconnect.js @@ -33,7 +33,7 @@ module.exports = { ) { context.report({ node, - message: `Preconnect is missing. See https://nextjs.org/docs/messages/google-font-preconnect.`, + message: `Preconnect is missing. See: https://nextjs.org/docs/messages/google-font-preconnect`, }) } }, diff --git a/packages/eslint-plugin-next/lib/rules/link-passhref.js b/packages/eslint-plugin-next/lib/rules/link-passhref.js index 10bf740904167..44f233395144d 100644 --- a/packages/eslint-plugin-next/lib/rules/link-passhref.js +++ b/packages/eslint-plugin-next/lib/rules/link-passhref.js @@ -55,7 +55,7 @@ module.exports = { attributes.value('passHref') !== true ? 'must be set to true' : 'is missing' - }. See https://nextjs.org/docs/messages/link-passhref`, + }. See: https://nextjs.org/docs/messages/link-passhref`, }) } }, diff --git a/packages/eslint-plugin-next/lib/rules/next-script-for-ga.js b/packages/eslint-plugin-next/lib/rules/next-script-for-ga.js index 1b13266ab3487..6d934d3c567cd 100644 --- a/packages/eslint-plugin-next/lib/rules/next-script-for-ga.js +++ b/packages/eslint-plugin-next/lib/rules/next-script-for-ga.js @@ -9,7 +9,7 @@ const SUPPORTED_HTML_CONTENT_URLS = [ 'www.googletagmanager.com/gtm.js', ] const ERROR_MSG = - 'Use the `next/script` component for loading third party scripts. See: https://nextjs.org/docs/messages/next-script-for-ga.' + 'Use the `next/script` component for loading third party scripts. See: https://nextjs.org/docs/messages/next-script-for-ga' // Check if one of the items in the list is a substring of the passed string const containsStr = (str, strList) => { diff --git a/packages/eslint-plugin-next/lib/rules/no-css-tags.js b/packages/eslint-plugin-next/lib/rules/no-css-tags.js index 83b40f51f0df1..e361ab137d0d7 100644 --- a/packages/eslint-plugin-next/lib/rules/no-css-tags.js +++ b/packages/eslint-plugin-next/lib/rules/no-css-tags.js @@ -26,7 +26,7 @@ module.exports = function (context) { context.report({ node, message: - 'Do not include stylesheets manually. See: https://nextjs.org/docs/messages/no-css-tags.', + 'Do not include stylesheets manually. See: https://nextjs.org/docs/messages/no-css-tags', }) } }, diff --git a/packages/eslint-plugin-next/lib/rules/no-document-import-in-page.js b/packages/eslint-plugin-next/lib/rules/no-document-import-in-page.js index c7aff15bc0105..1b7fbeb8f0512 100644 --- a/packages/eslint-plugin-next/lib/rules/no-document-import-in-page.js +++ b/packages/eslint-plugin-next/lib/rules/no-document-import-in-page.js @@ -29,7 +29,7 @@ module.exports = { context.report({ node, - message: `next/document should not be imported outside of pages/_document.js. See https://nextjs.org/docs/messages/no-document-import-in-page.`, + message: `next/document should not be imported outside of pages/_document.js. See: https://nextjs.org/docs/messages/no-document-import-in-page`, }) }, } diff --git a/packages/eslint-plugin-next/lib/rules/no-head-element.js b/packages/eslint-plugin-next/lib/rules/no-head-element.js new file mode 100644 index 0000000000000..ae8def43c5934 --- /dev/null +++ b/packages/eslint-plugin-next/lib/rules/no-head-element.js @@ -0,0 +1,26 @@ +module.exports = { + meta: { + docs: { + description: 'Prohibit usage of HTML element', + category: 'HTML', + recommended: true, + url: 'https://nextjs.org/docs/messages/no-head-element', + }, + fixable: 'code', + }, + + create: function (context) { + return { + JSXOpeningElement(node) { + if (node.name.name !== 'head') { + return + } + + context.report({ + node, + message: `Do not use . Use Head from 'next/head' instead. See: https://nextjs.org/docs/messages/no-head-element`, + }) + }, + } + }, +} diff --git a/packages/eslint-plugin-next/lib/rules/no-head-import-in-document.js b/packages/eslint-plugin-next/lib/rules/no-head-import-in-document.js index cb0bb7717cf87..e65deb425dc16 100644 --- a/packages/eslint-plugin-next/lib/rules/no-head-import-in-document.js +++ b/packages/eslint-plugin-next/lib/rules/no-head-import-in-document.js @@ -28,7 +28,7 @@ module.exports = { ) { context.report({ node, - message: `next/head should not be imported in pages${document}. Import Head from next/document instead. See https://nextjs.org/docs/messages/no-head-import-in-document.`, + message: `next/head should not be imported in pages${document}. Import Head from next/document instead. See: https://nextjs.org/docs/messages/no-head-import-in-document`, }) } }, diff --git a/packages/eslint-plugin-next/lib/rules/no-html-link-for-pages.js b/packages/eslint-plugin-next/lib/rules/no-html-link-for-pages.js index e7a07aa9f30d1..c26f72e851a07 100644 --- a/packages/eslint-plugin-next/lib/rules/no-html-link-for-pages.js +++ b/packages/eslint-plugin-next/lib/rules/no-html-link-for-pages.js @@ -90,6 +90,14 @@ module.exports = { return } + const target = node.attributes.find( + (attr) => attr.type === 'JSXAttribute' && attr.name.name === 'target' + ) + + if (target && target.value.value === '_blank') { + return + } + const href = node.attributes.find( (attr) => attr.type === 'JSXAttribute' && attr.name.name === 'href' ) @@ -117,7 +125,7 @@ module.exports = { if (url.test(normalizeURL(hrefPath))) { context.report({ node, - message: `Do not use the HTML tag to navigate to ${hrefPath}. Use Link from 'next/link' instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages.`, + message: `Do not use the HTML tag to navigate to ${hrefPath}. Use Link from 'next/link' instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages`, }) } }) diff --git a/packages/eslint-plugin-next/lib/rules/no-img-element.js b/packages/eslint-plugin-next/lib/rules/no-img-element.js index e32279d495b22..8f015e59283a6 100644 --- a/packages/eslint-plugin-next/lib/rules/no-img-element.js +++ b/packages/eslint-plugin-next/lib/rules/no-img-element.js @@ -22,7 +22,7 @@ module.exports = { context.report({ node, - message: `Do not use . Use Image from 'next/image' instead. See https://nextjs.org/docs/messages/no-img-element.`, + message: `Do not use . Use Image from 'next/image' instead. See: https://nextjs.org/docs/messages/no-img-element`, }) }, } diff --git a/packages/eslint-plugin-next/lib/rules/no-page-custom-font.js b/packages/eslint-plugin-next/lib/rules/no-page-custom-font.js index a825db1ee2180..7475bedf213bc 100644 --- a/packages/eslint-plugin-next/lib/rules/no-page-custom-font.js +++ b/packages/eslint-plugin-next/lib/rules/no-page-custom-font.js @@ -138,7 +138,7 @@ module.exports = { if (isGoogleFont) { const end = - 'This is discouraged. See https://nextjs.org/docs/messages/no-page-custom-font.' + 'This is discouraged. See: https://nextjs.org/docs/messages/no-page-custom-font' const message = is_Document ? `Rendering this not inline within of Document disables font optimization. ${end}` diff --git a/packages/eslint-plugin-next/lib/rules/no-script-in-document.js b/packages/eslint-plugin-next/lib/rules/no-script-in-document.js index 5860d856e070f..a503975d812b9 100644 --- a/packages/eslint-plugin-next/lib/rules/no-script-in-document.js +++ b/packages/eslint-plugin-next/lib/rules/no-script-in-document.js @@ -22,7 +22,7 @@ module.exports = { context.report({ node, - message: `next/script should not be used in pages/_document.js. See: https://nextjs.org/docs/messages/no-script-in-document-page `, + message: `next/script should not be used in pages/_document.js. See: https://nextjs.org/docs/messages/no-script-in-document-page`, }) }, } diff --git a/packages/eslint-plugin-next/lib/rules/no-script-in-head.js b/packages/eslint-plugin-next/lib/rules/no-script-in-head.js index 3ecca07172842..499832796c89d 100644 --- a/packages/eslint-plugin-next/lib/rules/no-script-in-head.js +++ b/packages/eslint-plugin-next/lib/rules/no-script-in-head.js @@ -43,7 +43,7 @@ module.exports = { context.report({ node, message: - "next/script shouldn't be used inside next/head. See: https://nextjs.org/docs/messages/no-script-in-head-component ", + "next/script shouldn't be used inside next/head. See: https://nextjs.org/docs/messages/no-script-in-head-component", }) } }, diff --git a/packages/eslint-plugin-next/lib/rules/no-server-import-in-page.js b/packages/eslint-plugin-next/lib/rules/no-server-import-in-page.js index 4bc873952246e..3cec735da7d82 100644 --- a/packages/eslint-plugin-next/lib/rules/no-server-import-in-page.js +++ b/packages/eslint-plugin-next/lib/rules/no-server-import-in-page.js @@ -29,7 +29,7 @@ module.exports = { context.report({ node, - message: `next/server should not be imported outside of pages/_middleware.js. See https://nextjs.org/docs/messages/no-server-import-in-page.`, + message: `next/server should not be imported outside of pages/_middleware.js. See: https://nextjs.org/docs/messages/no-server-import-in-page`, }) }, } diff --git a/packages/eslint-plugin-next/lib/rules/no-sync-scripts.js b/packages/eslint-plugin-next/lib/rules/no-sync-scripts.js index fb4326c19fb50..ac3e21302895a 100644 --- a/packages/eslint-plugin-next/lib/rules/no-sync-scripts.js +++ b/packages/eslint-plugin-next/lib/rules/no-sync-scripts.js @@ -18,7 +18,7 @@ module.exports = function (context) { context.report({ node, message: - 'External synchronous scripts are forbidden. See: https://nextjs.org/docs/messages/no-sync-scripts.', + 'External synchronous scripts are forbidden. See: https://nextjs.org/docs/messages/no-sync-scripts', }) } }, diff --git a/packages/eslint-plugin-next/lib/rules/no-title-in-document-head.js b/packages/eslint-plugin-next/lib/rules/no-title-in-document-head.js index fc45305d304b8..9d193362f9543 100644 --- a/packages/eslint-plugin-next/lib/rules/no-title-in-document-head.js +++ b/packages/eslint-plugin-next/lib/rules/no-title-in-document-head.js @@ -40,7 +40,7 @@ module.exports = { context.report({ node: titleTag, message: - 'Titles should be defined at the page-level using next/head. See https://nextjs.org/docs/messages/no-title-in-document-head.', + 'Titles should be defined at the page-level using next/head. See: https://nextjs.org/docs/messages/no-title-in-document-head', }) } }, diff --git a/packages/eslint-plugin-next/lib/rules/no-unwanted-polyfillio.js b/packages/eslint-plugin-next/lib/rules/no-unwanted-polyfillio.js index a233bdde7a3d4..891903d18977e 100644 --- a/packages/eslint-plugin-next/lib/rules/no-unwanted-polyfillio.js +++ b/packages/eslint-plugin-next/lib/rules/no-unwanted-polyfillio.js @@ -118,7 +118,7 @@ module.exports = { ', ' )} ${ unwantedFeatures.length > 1 ? 'are' : 'is' - } already shipped with Next.js. See: https://nextjs.org/docs/messages/no-unwanted-polyfillio.`, + } already shipped with Next.js. See: https://nextjs.org/docs/messages/no-unwanted-polyfillio`, }) } } diff --git a/packages/eslint-plugin-next/package.json b/packages/eslint-plugin-next/package.json index 236bebf7b317f..c25236678930a 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": "12.0.8-canary.13", + "version": "12.0.8-canary.17", "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 2e1d8803d8846..9f0b2fcb47532 100644 --- a/packages/next-bundle-analyzer/package.json +++ b/packages/next-bundle-analyzer/package.json @@ -1,6 +1,6 @@ { "name": "@next/bundle-analyzer", - "version": "12.0.8-canary.13", + "version": "12.0.8-canary.17", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-codemod/package.json b/packages/next-codemod/package.json index 8c047f9cde7e6..f4d5bbf559895 100644 --- a/packages/next-codemod/package.json +++ b/packages/next-codemod/package.json @@ -1,6 +1,6 @@ { "name": "@next/codemod", - "version": "12.0.8-canary.13", + "version": "12.0.8-canary.17", "license": "MIT", "dependencies": { "chalk": "4.1.0", diff --git a/packages/next-env/package.json b/packages/next-env/package.json index 3307a20722109..261cf37790415 100644 --- a/packages/next-env/package.json +++ b/packages/next-env/package.json @@ -1,6 +1,6 @@ { "name": "@next/env", - "version": "12.0.8-canary.13", + "version": "12.0.8-canary.17", "keywords": [ "react", "next", diff --git a/packages/next-mdx/package.json b/packages/next-mdx/package.json index db8d4a55ec5a7..10a51f853ae26 100644 --- a/packages/next-mdx/package.json +++ b/packages/next-mdx/package.json @@ -1,6 +1,6 @@ { "name": "@next/mdx", - "version": "12.0.8-canary.13", + "version": "12.0.8-canary.17", "main": "index.js", "license": "MIT", "repository": { diff --git a/packages/next-mdx/readme.md b/packages/next-mdx/readme.md index 12f0020ca85bf..e45ac2c203d7c 100644 --- a/packages/next-mdx/readme.md +++ b/packages/next-mdx/readme.md @@ -69,7 +69,7 @@ const withMDX = require('@next/mdx')({ extension: /\.mdx?$/, }) module.exports = withMDX({ - pageExtensions: ['js', 'jsx', 'md', 'mdx'], + pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'md', 'mdx'], }) ``` diff --git a/packages/next-plugin-storybook/package.json b/packages/next-plugin-storybook/package.json index 9fabe297f5388..7792749f169c6 100644 --- a/packages/next-plugin-storybook/package.json +++ b/packages/next-plugin-storybook/package.json @@ -1,6 +1,6 @@ { "name": "@next/plugin-storybook", - "version": "12.0.8-canary.13", + "version": "12.0.8-canary.17", "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 8eca7135ccc2e..34924c34e3f15 100644 --- a/packages/next-polyfill-module/package.json +++ b/packages/next-polyfill-module/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-module", - "version": "12.0.8-canary.13", + "version": "12.0.8-canary.17", "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 a3ba50fb0edfe..c7a2fc585bc0f 100644 --- a/packages/next-polyfill-nomodule/package.json +++ b/packages/next-polyfill-nomodule/package.json @@ -1,6 +1,6 @@ { "name": "@next/polyfill-nomodule", - "version": "12.0.8-canary.13", + "version": "12.0.8-canary.17", "description": "A polyfill for non-dead, nomodule browsers.", "main": "dist/polyfill-nomodule.js", "license": "MIT", diff --git a/packages/next-swc/package.json b/packages/next-swc/package.json index 7f7ce4d19db3e..8da471a5622b1 100644 --- a/packages/next-swc/package.json +++ b/packages/next-swc/package.json @@ -1,6 +1,6 @@ { "name": "@next/swc", - "version": "12.0.8-canary.13", + "version": "12.0.8-canary.17", "private": true, "scripts": { "build-native": "napi build --platform --cargo-name next_swc_napi native", diff --git a/packages/next/bin/next.ts b/packages/next/bin/next.ts index e8df92a3c8ae8..283e0996b7477 100755 --- a/packages/next/bin/next.ts +++ b/packages/next/bin/next.ts @@ -23,6 +23,7 @@ const commands: { [command: string]: () => Promise } = { lint: () => Promise.resolve(require('../cli/next-lint').nextLint), telemetry: () => Promise.resolve(require('../cli/next-telemetry').nextTelemetry), + info: () => Promise.resolve(require('../cli/next-info').nextInfo), } const args = arg( diff --git a/packages/next/build/entries.ts b/packages/next/build/entries.ts index 46780e62b161b..262d0da81425b 100644 --- a/packages/next/build/entries.ts +++ b/packages/next/build/entries.ts @@ -36,6 +36,12 @@ export function createPagesMapping( } ): PagesMapping { const previousPages: PagesMapping = {} + + // Do not process .d.ts files inside the `pages` folder + pagePaths = extensions.includes('ts') + ? pagePaths.filter((pagePath) => !pagePath.endsWith('.d.ts')) + : pagePaths + const pages: PagesMapping = pagePaths.reduce( (result: PagesMapping, pagePath): PagesMapping => { let page = pagePath.replace( diff --git a/packages/next/build/index.ts b/packages/next/build/index.ts index 7c88a08164746..08adb67428e13 100644 --- a/packages/next/build/index.ts +++ b/packages/next/build/index.ts @@ -5,7 +5,7 @@ import { isMatch } from 'next/dist/compiled/micromatch' import { promises, writeFileSync } from 'fs' import { Worker } from '../lib/worker' import devalue from 'next/dist/compiled/devalue' -import escapeStringRegexp from 'next/dist/compiled/escape-string-regexp' +import { escapeStringRegexp } from '../shared/lib/escape-regexp' import findUp from 'next/dist/compiled/find-up' import { nanoid } from 'next/dist/compiled/nanoid/index.cjs' import { pathToRegexp } from 'next/dist/compiled/path-to-regexp' @@ -1400,6 +1400,13 @@ export default async function build( 'utf8' ) + const middlewareManifest: MiddlewareManifest = JSON.parse( + await promises.readFile( + path.join(distDir, SERVER_DIRECTORY, MIDDLEWARE_MANIFEST), + 'utf8' + ) + ) + const outputFileTracingRoot = config.experimental.outputFileTracingRoot || dir @@ -1412,7 +1419,8 @@ export default async function build( distDir, pageKeys, outputFileTracingRoot, - requiredServerFiles.config + requiredServerFiles.config, + middlewareManifest ) }) } @@ -1961,13 +1969,6 @@ export default async function build( ) } - const middlewareManifest: MiddlewareManifest = JSON.parse( - await promises.readFile( - path.join(distDir, SERVER_DIRECTORY, MIDDLEWARE_MANIFEST), - 'utf8' - ) - ) - await promises.writeFile( path.join( distDir, @@ -2032,7 +2033,8 @@ export default async function build( path.relative(outputFileTracingRoot, distDir), SERVER_DIRECTORY, 'pages' - ) + ), + { overwrite: true } ) } diff --git a/packages/next/build/utils.ts b/packages/next/build/utils.ts index 6140d8c4388ef..b0332a1f5a898 100644 --- a/packages/next/build/utils.ts +++ b/packages/next/build/utils.ts @@ -16,6 +16,7 @@ import { SSG_GET_INITIAL_PROPS_CONFLICT, SERVER_PROPS_GET_INIT_PROPS_CONFLICT, SERVER_PROPS_SSG_CONFLICT, + MIDDLEWARE_ROUTE, } from '../lib/constants' import prettyBytes from '../lib/pretty-bytes' import { recursiveReadDir } from '../lib/recursive-readdir' @@ -40,6 +41,7 @@ import { NextConfigComplete } from '../server/config-shared' import isError from '../lib/is-error' import { recursiveDelete } from '../lib/recursive-delete' import { Sema } from 'next/dist/compiled/async-sema' +import { MiddlewareManifest } from './webpack/plugins/middleware-plugin' const { builtinModules } = require('module') const RESERVED_PAGE = /^\/(_app|_error|_document|api(\/|$))/ @@ -1156,7 +1158,8 @@ export async function copyTracedFiles( distDir: string, pageKeys: string[], tracingRoot: string, - serverConfig: { [key: string]: any } + serverConfig: { [key: string]: any }, + middlewareManifest: MiddlewareManifest ) { const outputPath = path.join(distDir, 'standalone') const copiedFiles = new Set() @@ -1202,6 +1205,23 @@ export async function copyTracedFiles( } for (const page of pageKeys) { + if (MIDDLEWARE_ROUTE.test(page)) { + const { files } = + middlewareManifest.middleware[page.replace(/\/_middleware$/, '')] + + for (const file of files) { + const originalPath = path.join(distDir, file) + const fileOutputPath = path.join( + outputPath, + path.relative(tracingRoot, distDir), + file + ) + await fs.mkdir(path.dirname(fileOutputPath), { recursive: true }) + await fs.copyFile(originalPath, fileOutputPath) + } + continue + } + const pageFile = path.join( distDir, 'server', @@ -1226,16 +1246,7 @@ const NextServer = require('next/dist/server/next-server').default const http = require('http') const path = require('path') -const nextServer = new NextServer({ - dir: path.join(__dirname), - dev: false, - conf: ${JSON.stringify({ - ...serverConfig, - distDir: `./${path.relative(dir, distDir)}`, - })}, -}) - -const handler = nextServer.getRequestHandler() +let handler const server = http.createServer(async (req, res) => { try { @@ -1246,12 +1257,26 @@ const server = http.createServer(async (req, res) => { res.end('internal server error') } }) -const currentPort = process.env.PORT || 3000 +const currentPort = parseInt(process.env.PORT, 10) || 3000 + server.listen(currentPort, (err) => { if (err) { console.error("Failed to start server", err) process.exit(1) } + const addr = server.address() + const nextServer = new NextServer({ + hostname: 'localhost', + port: currentPort, + dir: path.join(__dirname), + dev: false, + conf: ${JSON.stringify({ + ...serverConfig, + distDir: `./${path.relative(dir, distDir)}`, + })}, + }) + handler = nextServer.getRequestHandler() + console.log("Listening on port", currentPort) }) ` diff --git a/packages/next/build/webpack-config.ts b/packages/next/build/webpack-config.ts index f6c8c376bd940..bbac49486d94a 100644 --- a/packages/next/build/webpack-config.ts +++ b/packages/next/build/webpack-config.ts @@ -6,7 +6,7 @@ import semver from 'next/dist/compiled/semver' import { webpack } from 'next/dist/compiled/webpack/webpack' import type { webpack5 } from 'next/dist/compiled/webpack/webpack' import path, { join as pathJoin, relative as relativePath } from 'path' -import escapeRegExp from 'next/dist/compiled/escape-string-regexp' +import { escapeStringRegexp } from '../shared/lib/escape-regexp' import { DOT_NEXT_ALIAS, NEXT_PROJECT_ROOT, @@ -615,6 +615,8 @@ export default async function getBaseWebpackConfig( : 'react-dom/cjs/react-dom-server.browser.production.min', } : {}), + + setimmediate: 'next/dist/compiled/setimmediate', }, ...(targetWeb ? { @@ -632,7 +634,7 @@ export default async function getBaseWebpackConfig( https: require.resolve('next/dist/compiled/https-browserify'), os: require.resolve('next/dist/compiled/os-browserify'), path: require.resolve('next/dist/compiled/path-browserify'), - punycode: require.resolve('punycode'), + punycode: require.resolve('next/dist/compiled/punycode'), process: require.resolve('next/dist/compiled/process'), // Handled in separate alias querystring: require.resolve('next/dist/compiled/querystring-es3'), @@ -650,6 +652,7 @@ export default async function getBaseWebpackConfig( vm: require.resolve('next/dist/compiled/vm-browserify'), zlib: require.resolve('next/dist/compiled/browserify-zlib'), events: require.resolve('next/dist/compiled/events/'), + setImmediate: require.resolve('next/dist/compiled/setimmediate'), }, } : undefined), @@ -1694,7 +1697,7 @@ export default async function getBaseWebpackConfig( webpackConfig = await buildConfiguration(webpackConfig, { supportedBrowsers, rootDirectory: dir, - customAppFile: new RegExp(escapeRegExp(path.join(pagesDir, `_app`))), + customAppFile: new RegExp(escapeStringRegexp(path.join(pagesDir, `_app`))), isDevelopment: dev, isServer, webServerRuntime, diff --git a/packages/next/build/webpack/config/blocks/css/index.ts b/packages/next/build/webpack/config/blocks/css/index.ts index 61576638150f9..b44c4294591c2 100644 --- a/packages/next/build/webpack/config/blocks/css/index.ts +++ b/packages/next/build/webpack/config/blocks/css/index.ts @@ -139,7 +139,7 @@ export const css = curry(async function css( ...sassOptions } = ctx.sassOptions - const lazyPostCSSInitalizer = () => + const lazyPostCSSInitializer = () => lazyPostCSS( ctx.rootDirectory, ctx.supportedBrowsers, @@ -165,8 +165,9 @@ export const css = curry(async function css( // To fix this, we use `resolve-url-loader` to rewrite the CSS // imports to real file paths. { - loader: require.resolve('next/dist/compiled/resolve-url-loader'), + loader: require.resolve('../../../loaders/resolve-url-loader/index'), options: { + postcss: lazyPostCSSInitializer, // Source maps are not required here, but we may as well emit // them. sourceMap: true, @@ -216,7 +217,7 @@ export const css = curry(async function css( and: [ctx.rootDirectory], not: [/node_modules/], }, - use: getCssModuleLoader(ctx, lazyPostCSSInitalizer), + use: getCssModuleLoader(ctx, lazyPostCSSInitializer), }), ], }) @@ -241,7 +242,7 @@ export const css = curry(async function css( }, use: getCssModuleLoader( ctx, - lazyPostCSSInitalizer, + lazyPostCSSInitializer, sassPreprocessors ), }), @@ -303,7 +304,7 @@ export const css = curry(async function css( and: [ctx.rootDirectory], not: [/node_modules/], }, - use: getGlobalCssLoader(ctx, lazyPostCSSInitalizer), + use: getGlobalCssLoader(ctx, lazyPostCSSInitializer), }), ], }) @@ -321,7 +322,7 @@ export const css = curry(async function css( sideEffects: true, test: regexCssGlobal, issuer: { and: [ctx.customAppFile] }, - use: getGlobalCssLoader(ctx, lazyPostCSSInitalizer), + use: getGlobalCssLoader(ctx, lazyPostCSSInitializer), }), ], }) @@ -339,7 +340,7 @@ export const css = curry(async function css( issuer: { and: [ctx.customAppFile] }, use: getGlobalCssLoader( ctx, - lazyPostCSSInitalizer, + lazyPostCSSInitializer, sassPreprocessors ), }), diff --git a/packages/next/build/webpack/loaders/next-serverless-loader/index.ts b/packages/next/build/webpack/loaders/next-serverless-loader/index.ts index f61e1ecc2c8e3..fba18ce964f7a 100644 --- a/packages/next/build/webpack/loaders/next-serverless-loader/index.ts +++ b/packages/next/build/webpack/loaders/next-serverless-loader/index.ts @@ -1,10 +1,10 @@ import devalue from 'next/dist/compiled/devalue' -import escapeRegexp from 'next/dist/compiled/escape-string-regexp' import { join } from 'path' import { parse } from 'querystring' import { webpack } from 'next/dist/compiled/webpack/webpack' import { API_ROUTE } from '../../../../lib/constants' import { isDynamicRoute } from '../../../../shared/lib/router/utils' +import { escapeStringRegexp } from '../../../../shared/lib/escape-regexp' import { __ApiPreviewProps } from '../../../../server/api-utils' import { BUILD_MANIFEST, @@ -62,7 +62,7 @@ const nextServerlessLoader: webpack.loader.Loader = function () { ) const routesManifest = join(distDir, ROUTES_MANIFEST).replace(/\\/g, '/') - const escapedBuildId = escapeRegexp(buildId) + const escapedBuildId = escapeStringRegexp(buildId) const pageIsDynamicRoute = isDynamicRoute(page) const encodedPreviewProps = devalue( diff --git a/packages/next/build/webpack/loaders/resolve-url-loader/index.js b/packages/next/build/webpack/loaders/resolve-url-loader/index.js new file mode 100644 index 0000000000000..4c1bc2522d896 --- /dev/null +++ b/packages/next/build/webpack/loaders/resolve-url-loader/index.js @@ -0,0 +1,103 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016 Ben Holloway + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +import { SourceMapConsumer } from 'next/dist/compiled/source-map' +import valueProcessor from './lib/value-processor' +import { defaultJoin } from './lib/join-function' +import process from './lib/postcss' +/** + * A webpack loader that resolves absolute url() paths relative to their original source file. + * Requires source-maps to do any meaningful work. + * @param {string} content Css content + * @param {object} sourceMap The source-map + * @returns {string|String} + */ +export default async function resolveUrlLoader(content, sourceMap) { + const options = Object.assign( + { + sourceMap: this.sourceMap, + silent: false, + absolute: false, + keepQuery: false, + root: false, + debug: false, + join: defaultJoin, + }, + this.getOptions() + ) + + let sourceMapConsumer + if (sourceMap) { + sourceMapConsumer = new SourceMapConsumer(sourceMap) + } + + const callback = this.async() + const { postcss } = await options.postcss() + process(postcss, this.resourcePath, content, { + outputSourceMap: Boolean(options.sourceMap), + transformDeclaration: valueProcessor(this.resourcePath, options), + inputSourceMap: sourceMap, + sourceMapConsumer: sourceMapConsumer, + }) + .catch(onFailure) + .then(onSuccess) + + function onFailure(error) { + callback(encodeError('CSS error', error)) + } + + function onSuccess(reworked) { + if (reworked) { + // complete with source-map + // source-map sources are relative to the file being processed + if (options.sourceMap) { + callback(null, reworked.content, reworked.map) + } + // complete without source-map + else { + callback(null, reworked.content) + } + } + } + + function encodeError(label, exception) { + return new Error( + [ + 'resolve-url-loader', + ': ', + [label] + .concat( + (typeof exception === 'string' && exception) || + (exception instanceof Error && [ + exception.message, + exception.stack.split('\n')[1].trim(), + ]) || + [] + ) + .filter(Boolean) + .join('\n '), + ].join('') + ) + } +} diff --git a/packages/next/build/webpack/loaders/resolve-url-loader/lib/file-protocol.js b/packages/next/build/webpack/loaders/resolve-url-loader/lib/file-protocol.js new file mode 100644 index 0000000000000..dc2c08de86b4f --- /dev/null +++ b/packages/next/build/webpack/loaders/resolve-url-loader/lib/file-protocol.js @@ -0,0 +1,65 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016 Ben Holloway + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +/** + * Prepend file:// protocol to source path string or source-map sources. + */ +function prepend(candidate) { + if (typeof candidate === 'string') { + return 'file://' + candidate + } else if ( + candidate && + typeof candidate === 'object' && + Array.isArray(candidate.sources) + ) { + return Object.assign({}, candidate, { + sources: candidate.sources.map(prepend), + }) + } else { + throw new Error('expected string|object') + } +} + +exports.prepend = prepend + +/** + * Remove file:// protocol from source path string or source-map sources. + */ +function remove(candidate) { + if (typeof candidate === 'string') { + return candidate.replace(/^file:\/{2}/, '') + } else if ( + candidate && + typeof candidate === 'object' && + Array.isArray(candidate.sources) + ) { + return Object.assign({}, candidate, { + sources: candidate.sources.map(remove), + }) + } else { + throw new Error('expected string|object') + } +} + +exports.remove = remove diff --git a/packages/next/build/webpack/loaders/resolve-url-loader/lib/join-function.js b/packages/next/build/webpack/loaders/resolve-url-loader/lib/join-function.js new file mode 100644 index 0000000000000..b57d3c2df5582 --- /dev/null +++ b/packages/next/build/webpack/loaders/resolve-url-loader/lib/join-function.js @@ -0,0 +1,233 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016 Ben Holloway + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ +import path from 'path' +import fs from 'fs' + +const compose = + (f, g) => + (...args) => + f(g(...args)) + +const simpleJoin = compose(path.normalize, path.join) + +/** + * The default join function iterates over possible base paths until a suitable join is found. + * + * The first base path is used as fallback for the case where none of the base paths can locate the actual file. + * + * @type {function} + */ +export const defaultJoin = createJoinForPredicate(function predicate( + _, + uri, + base, + i, + next +) { + const absolute = simpleJoin(base, uri) + return fs.existsSync(absolute) ? absolute : next(i === 0 ? absolute : null) +}, +'defaultJoin') + +function* createIterator(arr) { + for (const i of arr) { + yield i + } +} + +/** + * Define a join function by a predicate that tests possible base paths from an iterator. + * + * The `predicate` is of the form: + * + * ``` + * function(filename, uri, base, i, next):string|null + * ``` + * + * Given the uri and base it should either return: + * - an absolute path success + * - a call to `next(null)` as failure + * - a call to `next(absolute)` where absolute is placeholder and the iterator continues + * + * The value given to `next(...)` is only used if success does not eventually occur. + * + * The `file` value is typically unused but useful if you would like to differentiate behaviour. + * + * You can write a much simpler function than this if you have specific requirements. + * + * @param {function} predicate A function that tests values + * @param {string} [name] Optional name for the resulting join function + */ +function createJoinForPredicate(predicate, name) { + /** + * A factory for a join function with logging. + * + * @param {string} filename The current file being processed + * @param {{debug:function|boolean,root:string}} options An options hash + */ + function join(filename, options) { + const log = createDebugLogger(options.debug) + + /** + * Join function proper. + * + * For absolute uri only `uri` will be provided. In this case we substitute any `root` given in options. + * + * @param {string} uri A uri path, relative or absolute + * @param {string|Iterator.} [baseOrIteratorOrAbsent] Optional absolute base path or iterator thereof + * @return {string} Just the uri where base is empty or the uri appended to the base + */ + return function joinProper(uri, baseOrIteratorOrAbsent) { + const iterator = + (typeof baseOrIteratorOrAbsent === 'undefined' && + createIterator([options.root])) || + (typeof baseOrIteratorOrAbsent === 'string' && + createIterator([baseOrIteratorOrAbsent])) || + baseOrIteratorOrAbsent + + const result = runIterator([]) + log(createJoinMsg, [filename, uri, result, result.isFound]) + + return typeof result.absolute === 'string' ? result.absolute : uri + + function runIterator(accumulator) { + const nextItem = iterator.next() + var base = !nextItem.done && nextItem.value + if (typeof base === 'string') { + const element = predicate( + filename, + uri, + base, + accumulator.length, + next + ) + + if (typeof element === 'string' && path.isAbsolute(element)) { + return Object.assign(accumulator.concat(base), { + isFound: true, + absolute: element, + }) + } else if (Array.isArray(element)) { + return element + } else { + throw new Error( + 'predicate must return an absolute path or the result of calling next()' + ) + } + } else { + return accumulator + } + + function next(fallback) { + return runIterator( + Object.assign( + accumulator.concat(base), + typeof fallback === 'string' && { absolute: fallback } + ) + ) + } + } + } + } + + function toString() { + return '[Function: ' + name + ']' + } + + return Object.assign( + join, + name && { + valueOf: toString, + toString: toString, + } + ) +} + +/** + * Format a debug message. + * + * @param {string} file The file being processed by webpack + * @param {string} uri A uri path, relative or absolute + * @param {Array.} bases Absolute base paths up to and including the found one + * @param {boolean} isFound Indicates the last base was correct + * @return {string} Formatted message + */ +function createJoinMsg(file, uri, bases, isFound) { + return ['resolve-url-loader: ' + pathToString(file) + ': ' + uri] + .concat(bases.map(pathToString).filter(Boolean)) + .concat(isFound ? 'FOUND' : 'NOT FOUND') + .join('\n ') + + /** + * If given path is within `process.cwd()` then show relative posix path, otherwise show absolute posix path. + * + * @param {string} absolute An absolute path + * @return {string} A relative or absolute path + */ + function pathToString(absolute) { + if (!absolute) { + return null + } else { + const relative = path.relative(process.cwd(), absolute).split(path.sep) + + return ( + relative[0] === '..' + ? absolute.split(path.sep) + : ['.'].concat(relative).filter(Boolean) + ).join('/') + } + } +} + +exports.createJoinMsg = createJoinMsg + +/** + * A factory for a log function predicated on the given debug parameter. + * + * The logging function created accepts a function that formats a message and parameters that the function utilises. + * Presuming the message function may be expensive we only call it if logging is enabled. + * + * The log messages are de-duplicated based on the parameters, so it is assumed they are simple types that stringify + * well. + * + * @param {function|boolean} debug A boolean or debug function + * @return {function(function, array)} A logging function possibly degenerate + */ +function createDebugLogger(debug) { + const log = !!debug && (typeof debug === 'function' ? debug : console.log) + const cache = {} + return log ? actuallyLog : noop + + function noop() {} + + function actuallyLog(msgFn, params) { + const key = JSON.stringify(params) + if (!cache[key]) { + cache[key] = true + log(msgFn.apply(null, params)) + } + } +} + +exports.createDebugLogger = createDebugLogger diff --git a/packages/next/build/webpack/loaders/resolve-url-loader/lib/postcss.js b/packages/next/build/webpack/loaders/resolve-url-loader/lib/postcss.js new file mode 100644 index 0000000000000..90144c1e8b9d2 --- /dev/null +++ b/packages/next/build/webpack/loaders/resolve-url-loader/lib/postcss.js @@ -0,0 +1,97 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016 Ben Holloway + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +import path from 'path' +import fileProtocol from './file-protocol' + +const ORPHAN_CR_REGEX = /\r(?!\n)(.|\n)?/g + +export default function process(postcss, sourceFile, sourceContent, params) { + // #107 libsass emits orphan CR not considered newline, postcss does consider newline (content vs source-map mismatch) + + // prepend file protocol to all sources to avoid problems with source map + return postcss([postcss.plugin('postcss-resolve-url', postcssPlugin)]) + .process(sourceContent, { + from: fileProtocol.prepend(sourceFile), + map: params.outputSourceMap && { + prev: + !!params.inputSourceMap && + fileProtocol.prepend(params.inputSourceMap), + inline: false, + annotation: false, + sourcesContent: true, // #98 sourcesContent missing from output map + }, + }) + .then((result) => ({ + content: result.css, + map: params.outputSourceMap + ? fileProtocol.remove(result.map.toJSON()) + : null, + })) + + /** + * Plugin for postcss that follows SASS transpilation. + */ + function postcssPlugin() { + return function (styles) { + styles.walkDecls(eachDeclaration) + } + + /** + * Process a declaration from the syntax tree. + * @param declaration + */ + function eachDeclaration(declaration) { + const isValid = declaration.value && declaration.value.indexOf('url') >= 0 + if (isValid) { + // reverse the original source-map to find the original source file before transpilation + const startPosApparent = declaration.source.start, + startPosOriginal = + params.sourceMapConsumer && + params.sourceMapConsumer.originalPositionFor(startPosApparent) + + // we require a valid directory for the specified file + const directory = + startPosOriginal && + startPosOriginal.source && + fileProtocol.remove(path.dirname(startPosOriginal.source)) + if (directory) { + declaration.value = params.transformDeclaration( + declaration.value, + directory + ) + } + // source-map present but invalid entry + else if (params.sourceMapConsumer) { + throw new Error( + 'source-map information is not available at url() declaration ' + + (ORPHAN_CR_REGEX.test(sourceContent) + ? '(found orphan CR, try removeCR option)' + : '(no orphan CR found)') + ) + } + } + } + } +} diff --git a/packages/next/build/webpack/loaders/resolve-url-loader/lib/value-processor.js b/packages/next/build/webpack/loaders/resolve-url-loader/lib/value-processor.js new file mode 100644 index 0000000000000..9eda67562c00e --- /dev/null +++ b/packages/next/build/webpack/loaders/resolve-url-loader/lib/value-processor.js @@ -0,0 +1,125 @@ +/* +The MIT License (MIT) + +Copyright (c) 2016 Ben Holloway + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +import loaderUtils from 'next/dist/compiled/loader-utils2' +import path from 'path' + +function valueProcessor(filename, options) { + const URL_STATEMENT_REGEX = + /(url\s*\()\s*(?:(['"])((?:(?!\2).)*)(\2)|([^'"](?:(?!\)).)*[^'"]))\s*(\))/g + const directory = path.dirname(filename) + const join = options.join(filename, options) + + /** + * Process the given CSS declaration value. + * + * @param {string} value A declaration value that may or may not contain a url() statement + * @param {string|Iterator.} candidate An absolute path that may be the correct base or an Iterator thereof + */ + return function transformValue(value, candidate) { + // allow multiple url() values in the declaration + // split by url statements and process the content + // additional capture groups are needed to match quotations correctly + // escaped quotations are not considered + return value + .split(URL_STATEMENT_REGEX) + .map((token, i, arr) => { + // we can get groups as undefined under certain match circumstances + const initialised = token || '' + + // the content of the url() statement is either in group 3 or group 5 + const mod = i % 7 + if (mod === 3 || mod === 5) { + // detect quoted url and unescape backslashes + const before = arr[i - 1], + after = arr[i + 1], + isQuoted = before === after && (before === "'" || before === '"'), + unescaped = isQuoted + ? initialised.replace(/\\{2}/g, '\\') + : initialised + + // split into uri and query/hash and then find the absolute path to the uri + const split = unescaped.split(/([?#])/g), + uri = split[0], + absolute = + (testIsRelative(uri) && join(uri, candidate)) || + (testIsAbsolute(uri) && join(uri)), + query = options.keepQuery ? split.slice(1).join('') : '' + + // use the absolute path in absolute mode or else relative path (or default to initialised) + // #6 - backslashes are not legal in URI + if (!absolute) { + return initialised + } else if (options.absolute) { + return absolute.replace(/\\/g, '/') + query + } else { + return loaderUtils.urlToRequest( + path.relative(directory, absolute).replace(/\\/g, '/') + query + ) + } + } + // everything else, including parentheses and quotation (where present) and media statements + else { + return initialised + } + }) + .join('') + } + + /** + * The loaderUtils.isUrlRequest() doesn't support windows absolute paths on principle. We do not subscribe to that + * dogma so we add path.isAbsolute() check to allow them. + * + * We also eliminate module relative (~) paths. + * + * @param {string|undefined} uri A uri string possibly empty or undefined + * @return {boolean} True for relative uri + */ + function testIsRelative(uri) { + return ( + !!uri && + loaderUtils.isUrlRequest(uri, false) && + !path.isAbsolute(uri) && + uri.indexOf('~') !== 0 + ) + } + + /** + * The loaderUtils.isUrlRequest() doesn't support windows absolute paths on principle. We do not subscribe to that + * dogma so we add path.isAbsolute() check to allow them. + * + * @param {string|undefined} uri A uri string possibly empty or undefined + * @return {boolean} True for absolute uri + */ + function testIsAbsolute(uri) { + return ( + !!uri && + typeof options.root === 'string' && + loaderUtils.isUrlRequest(uri, options.root) && + (/^\//.test(uri) || path.isAbsolute(uri)) + ) + } +} + +module.exports = valueProcessor diff --git a/packages/next/cli/next-info.ts b/packages/next/cli/next-info.ts new file mode 100755 index 0000000000000..b0e957bc8dcc7 --- /dev/null +++ b/packages/next/cli/next-info.ts @@ -0,0 +1,76 @@ +#!/usr/bin/env node +import os from 'os' +import childProcess from 'child_process' + +import chalk from 'next/dist/compiled/chalk' +import arg from 'next/dist/compiled/arg/index.js' +import { printAndExit } from '../server/lib/utils' +import { cliCommand } from '../bin/next' +import isError from '../lib/is-error' + +const nextInfo: cliCommand = async (argv) => { + const validArgs: arg.Spec = { + // Types + '--help': Boolean, + // Aliases + '-h': '--help', + } + let args: arg.Result + try { + args = arg(validArgs, { argv }) + } catch (error) { + if (isError(error) && error.code === 'ARG_UNKNOWN_OPTION') { + return printAndExit(error.message, 1) + } + throw error + } + + if (args['--help']) { + console.log( + ` + Description + Prints relevant details about the current system which can be used to report Next.js bugs + + Usage + $ next info + + Learn more: ${chalk.cyan( + 'https://nextjs.org/docs/api-reference/cli#info' + )}` + ) + return + } + + console.log(` + Operating System: + Platform: ${os.platform()} + Arch: ${os.arch()} + Version: ${os.version()} + Binaries: + Node: ${process.versions.node} + npm: ${getBinaryVersion('npm')} + Yarn: ${getBinaryVersion('yarn')} + pnpm: ${getBinaryVersion('pnpm')} + Relevant packages: + next: ${getPackageVersion('next')} + react: ${getPackageVersion('react')} + react-dom: ${getPackageVersion('react-dom')}`) +} + +export { nextInfo } + +function getPackageVersion(packageName: string) { + try { + return require(`${packageName}/package.json`).version + } catch { + return 'N/A' + } +} + +function getBinaryVersion(binaryName: string) { + try { + return childProcess.execSync(`${binaryName} --version`).toString().trim() + } catch { + return 'N/A' + } +} diff --git a/packages/next/client/image.tsx b/packages/next/client/image.tsx index dcf9601a318b7..92f0b5147c158 100644 --- a/packages/next/client/image.tsx +++ b/packages/next/client/image.tsx @@ -693,26 +693,28 @@ export default function Image({ }} style={{ ...imgStyle, ...blurStyle }} /> - + {isLazy && ( + + )} {priority ? ( // Note how we omit the `href` attribute, as it would only be relevant diff --git a/packages/next/compiled/chalk/index.js b/packages/next/compiled/chalk/index.js index 14127eca449e0..3a71fd9e86b1d 100644 --- a/packages/next/compiled/chalk/index.js +++ b/packages/next/compiled/chalk/index.js @@ -1 +1 @@ -(()=>{var r={598:(r,e,n)=>{var t=n(120);var a={};for(var o in t){if(t.hasOwnProperty(o)){a[t[o]]=o}}var s=r.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var l in s){if(s.hasOwnProperty(l)){if(!("channels"in s[l])){throw new Error("missing channels property: "+l)}if(!("labels"in s[l])){throw new Error("missing channel labels property: "+l)}if(s[l].labels.length!==s[l].channels){throw new Error("channel and label counts mismatch: "+l)}var i=s[l].channels;var c=s[l].labels;delete s[l].channels;delete s[l].labels;Object.defineProperty(s[l],"channels",{value:i});Object.defineProperty(s[l],"labels",{value:c})}}s.rgb.hsl=function(r){var e=r[0]/255;var n=r[1]/255;var t=r[2]/255;var a=Math.min(e,n,t);var o=Math.max(e,n,t);var s=o-a;var l;var i;var c;if(o===a){l=0}else if(e===o){l=(n-t)/s}else if(n===o){l=2+(t-e)/s}else if(t===o){l=4+(e-n)/s}l=Math.min(l*60,360);if(l<0){l+=360}c=(a+o)/2;if(o===a){i=0}else if(c<=.5){i=s/(o+a)}else{i=s/(2-o-a)}return[l,i*100,c*100]};s.rgb.hsv=function(r){var e;var n;var t;var a;var o;var s=r[0]/255;var l=r[1]/255;var i=r[2]/255;var c=Math.max(s,l,i);var u=c-Math.min(s,l,i);var diffc=function(r){return(c-r)/6/u+1/2};if(u===0){a=o=0}else{o=u/c;e=diffc(s);n=diffc(l);t=diffc(i);if(s===c){a=t-n}else if(l===c){a=1/3+e-t}else if(i===c){a=2/3+n-e}if(a<0){a+=1}else if(a>1){a-=1}}return[a*360,o*100,c*100]};s.rgb.hwb=function(r){var e=r[0];var n=r[1];var t=r[2];var a=s.rgb.hsl(r)[0];var o=1/255*Math.min(e,Math.min(n,t));t=1-1/255*Math.max(e,Math.max(n,t));return[a,o*100,t*100]};s.rgb.cmyk=function(r){var e=r[0]/255;var n=r[1]/255;var t=r[2]/255;var a;var o;var s;var l;l=Math.min(1-e,1-n,1-t);a=(1-e-l)/(1-l)||0;o=(1-n-l)/(1-l)||0;s=(1-t-l)/(1-l)||0;return[a*100,o*100,s*100,l*100]};function comparativeDistance(r,e){return Math.pow(r[0]-e[0],2)+Math.pow(r[1]-e[1],2)+Math.pow(r[2]-e[2],2)}s.rgb.keyword=function(r){var e=a[r];if(e){return e}var n=Infinity;var o;for(var s in t){if(t.hasOwnProperty(s)){var l=t[s];var i=comparativeDistance(r,l);if(i.04045?Math.pow((e+.055)/1.055,2.4):e/12.92;n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92;t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92;var a=e*.4124+n*.3576+t*.1805;var o=e*.2126+n*.7152+t*.0722;var s=e*.0193+n*.1192+t*.9505;return[a*100,o*100,s*100]};s.rgb.lab=function(r){var e=s.rgb.xyz(r);var n=e[0];var t=e[1];var a=e[2];var o;var l;var i;n/=95.047;t/=100;a/=108.883;n=n>.008856?Math.pow(n,1/3):7.787*n+16/116;t=t>.008856?Math.pow(t,1/3):7.787*t+16/116;a=a>.008856?Math.pow(a,1/3):7.787*a+16/116;o=116*t-16;l=500*(n-t);i=200*(t-a);return[o,l,i]};s.hsl.rgb=function(r){var e=r[0]/360;var n=r[1]/100;var t=r[2]/100;var a;var o;var s;var l;var i;if(n===0){i=t*255;return[i,i,i]}if(t<.5){o=t*(1+n)}else{o=t+n-t*n}a=2*t-o;l=[0,0,0];for(var c=0;c<3;c++){s=e+1/3*-(c-1);if(s<0){s++}if(s>1){s--}if(6*s<1){i=a+(o-a)*6*s}else if(2*s<1){i=o}else if(3*s<2){i=a+(o-a)*(2/3-s)*6}else{i=a}l[c]=i*255}return l};s.hsl.hsv=function(r){var e=r[0];var n=r[1]/100;var t=r[2]/100;var a=n;var o=Math.max(t,.01);var s;var l;t*=2;n*=t<=1?t:2-t;a*=o<=1?o:2-o;l=(t+n)/2;s=t===0?2*a/(o+a):2*n/(t+n);return[e,s*100,l*100]};s.hsv.rgb=function(r){var e=r[0]/60;var n=r[1]/100;var t=r[2]/100;var a=Math.floor(e)%6;var o=e-Math.floor(e);var s=255*t*(1-n);var l=255*t*(1-n*o);var i=255*t*(1-n*(1-o));t*=255;switch(a){case 0:return[t,i,s];case 1:return[l,t,s];case 2:return[s,t,i];case 3:return[s,l,t];case 4:return[i,s,t];case 5:return[t,s,l]}};s.hsv.hsl=function(r){var e=r[0];var n=r[1]/100;var t=r[2]/100;var a=Math.max(t,.01);var o;var s;var l;l=(2-n)*t;o=(2-n)*a;s=n*a;s/=o<=1?o:2-o;s=s||0;l/=2;return[e,s*100,l*100]};s.hwb.rgb=function(r){var e=r[0]/360;var n=r[1]/100;var t=r[2]/100;var a=n+t;var o;var s;var l;var i;if(a>1){n/=a;t/=a}o=Math.floor(6*e);s=1-t;l=6*e-o;if((o&1)!==0){l=1-l}i=n+l*(s-n);var c;var u;var v;switch(o){default:case 6:case 0:c=s;u=i;v=n;break;case 1:c=i;u=s;v=n;break;case 2:c=n;u=s;v=i;break;case 3:c=n;u=i;v=s;break;case 4:c=i;u=n;v=s;break;case 5:c=s;u=n;v=i;break}return[c*255,u*255,v*255]};s.cmyk.rgb=function(r){var e=r[0]/100;var n=r[1]/100;var t=r[2]/100;var a=r[3]/100;var o;var s;var l;o=1-Math.min(1,e*(1-a)+a);s=1-Math.min(1,n*(1-a)+a);l=1-Math.min(1,t*(1-a)+a);return[o*255,s*255,l*255]};s.xyz.rgb=function(r){var e=r[0]/100;var n=r[1]/100;var t=r[2]/100;var a;var o;var s;a=e*3.2406+n*-1.5372+t*-.4986;o=e*-.9689+n*1.8758+t*.0415;s=e*.0557+n*-.204+t*1.057;a=a>.0031308?1.055*Math.pow(a,1/2.4)-.055:a*12.92;o=o>.0031308?1.055*Math.pow(o,1/2.4)-.055:o*12.92;s=s>.0031308?1.055*Math.pow(s,1/2.4)-.055:s*12.92;a=Math.min(Math.max(0,a),1);o=Math.min(Math.max(0,o),1);s=Math.min(Math.max(0,s),1);return[a*255,o*255,s*255]};s.xyz.lab=function(r){var e=r[0];var n=r[1];var t=r[2];var a;var o;var s;e/=95.047;n/=100;t/=108.883;e=e>.008856?Math.pow(e,1/3):7.787*e+16/116;n=n>.008856?Math.pow(n,1/3):7.787*n+16/116;t=t>.008856?Math.pow(t,1/3):7.787*t+16/116;a=116*n-16;o=500*(e-n);s=200*(n-t);return[a,o,s]};s.lab.xyz=function(r){var e=r[0];var n=r[1];var t=r[2];var a;var o;var s;o=(e+16)/116;a=n/500+o;s=o-t/200;var l=Math.pow(o,3);var i=Math.pow(a,3);var c=Math.pow(s,3);o=l>.008856?l:(o-16/116)/7.787;a=i>.008856?i:(a-16/116)/7.787;s=c>.008856?c:(s-16/116)/7.787;a*=95.047;o*=100;s*=108.883;return[a,o,s]};s.lab.lch=function(r){var e=r[0];var n=r[1];var t=r[2];var a;var o;var s;a=Math.atan2(t,n);o=a*360/2/Math.PI;if(o<0){o+=360}s=Math.sqrt(n*n+t*t);return[e,s,o]};s.lch.lab=function(r){var e=r[0];var n=r[1];var t=r[2];var a;var o;var s;s=t/360*2*Math.PI;a=n*Math.cos(s);o=n*Math.sin(s);return[e,a,o]};s.rgb.ansi16=function(r){var e=r[0];var n=r[1];var t=r[2];var a=1 in arguments?arguments[1]:s.rgb.hsv(r)[2];a=Math.round(a/50);if(a===0){return 30}var o=30+(Math.round(t/255)<<2|Math.round(n/255)<<1|Math.round(e/255));if(a===2){o+=60}return o};s.hsv.ansi16=function(r){return s.rgb.ansi16(s.hsv.rgb(r),r[2])};s.rgb.ansi256=function(r){var e=r[0];var n=r[1];var t=r[2];if(e===n&&n===t){if(e<8){return 16}if(e>248){return 231}return Math.round((e-8)/247*24)+232}var a=16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(t/255*5);return a};s.ansi16.rgb=function(r){var e=r%10;if(e===0||e===7){if(r>50){e+=3.5}e=e/10.5*255;return[e,e,e]}var n=(~~(r>50)+1)*.5;var t=(e&1)*n*255;var a=(e>>1&1)*n*255;var o=(e>>2&1)*n*255;return[t,a,o]};s.ansi256.rgb=function(r){if(r>=232){var e=(r-232)*10+8;return[e,e,e]}r-=16;var n;var t=Math.floor(r/36)/5*255;var a=Math.floor((n=r%36)/6)/5*255;var o=n%6/5*255;return[t,a,o]};s.rgb.hex=function(r){var e=((Math.round(r[0])&255)<<16)+((Math.round(r[1])&255)<<8)+(Math.round(r[2])&255);var n=e.toString(16).toUpperCase();return"000000".substring(n.length)+n};s.hex.rgb=function(r){var e=r.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e){return[0,0,0]}var n=e[0];if(e[0].length===3){n=n.split("").map((function(r){return r+r})).join("")}var t=parseInt(n,16);var a=t>>16&255;var o=t>>8&255;var s=t&255;return[a,o,s]};s.rgb.hcg=function(r){var e=r[0]/255;var n=r[1]/255;var t=r[2]/255;var a=Math.max(Math.max(e,n),t);var o=Math.min(Math.min(e,n),t);var s=a-o;var l;var i;if(s<1){l=o/(1-s)}else{l=0}if(s<=0){i=0}else if(a===e){i=(n-t)/s%6}else if(a===n){i=2+(t-e)/s}else{i=4+(e-n)/s+4}i/=6;i%=1;return[i*360,s*100,l*100]};s.hsl.hcg=function(r){var e=r[1]/100;var n=r[2]/100;var t=1;var a=0;if(n<.5){t=2*e*n}else{t=2*e*(1-n)}if(t<1){a=(n-.5*t)/(1-t)}return[r[0],t*100,a*100]};s.hsv.hcg=function(r){var e=r[1]/100;var n=r[2]/100;var t=e*n;var a=0;if(t<1){a=(n-t)/(1-t)}return[r[0],t*100,a*100]};s.hcg.rgb=function(r){var e=r[0]/360;var n=r[1]/100;var t=r[2]/100;if(n===0){return[t*255,t*255,t*255]}var a=[0,0,0];var o=e%1*6;var s=o%1;var l=1-s;var i=0;switch(Math.floor(o)){case 0:a[0]=1;a[1]=s;a[2]=0;break;case 1:a[0]=l;a[1]=1;a[2]=0;break;case 2:a[0]=0;a[1]=1;a[2]=s;break;case 3:a[0]=0;a[1]=l;a[2]=1;break;case 4:a[0]=s;a[1]=0;a[2]=1;break;default:a[0]=1;a[1]=0;a[2]=l}i=(1-n)*t;return[(n*a[0]+i)*255,(n*a[1]+i)*255,(n*a[2]+i)*255]};s.hcg.hsv=function(r){var e=r[1]/100;var n=r[2]/100;var t=e+n*(1-e);var a=0;if(t>0){a=e/t}return[r[0],a*100,t*100]};s.hcg.hsl=function(r){var e=r[1]/100;var n=r[2]/100;var t=n*(1-e)+.5*e;var a=0;if(t>0&&t<.5){a=e/(2*t)}else if(t>=.5&&t<1){a=e/(2*(1-t))}return[r[0],a*100,t*100]};s.hcg.hwb=function(r){var e=r[1]/100;var n=r[2]/100;var t=e+n*(1-e);return[r[0],(t-e)*100,(1-t)*100]};s.hwb.hcg=function(r){var e=r[1]/100;var n=r[2]/100;var t=1-n;var a=t-e;var o=0;if(a<1){o=(t-a)/(1-a)}return[r[0],a*100,o*100]};s.apple.rgb=function(r){return[r[0]/65535*255,r[1]/65535*255,r[2]/65535*255]};s.rgb.apple=function(r){return[r[0]/255*65535,r[1]/255*65535,r[2]/255*65535]};s.gray.rgb=function(r){return[r[0]/100*255,r[0]/100*255,r[0]/100*255]};s.gray.hsl=s.gray.hsv=function(r){return[0,0,r[0]]};s.gray.hwb=function(r){return[0,100,r[0]]};s.gray.cmyk=function(r){return[0,0,0,r[0]]};s.gray.lab=function(r){return[r[0],0,0]};s.gray.hex=function(r){var e=Math.round(r[0]/100*255)&255;var n=(e<<16)+(e<<8)+e;var t=n.toString(16).toUpperCase();return"000000".substring(t.length)+t};s.rgb.gray=function(r){var e=(r[0]+r[1]+r[2])/3;return[e/255*100]}},830:(r,e,n)=>{var t=n(598);var a=n(180);var o={};var s=Object.keys(t);function wrapRaw(r){var wrappedFn=function(e){if(e===undefined||e===null){return e}if(arguments.length>1){e=Array.prototype.slice.call(arguments)}return r(e)};if("conversion"in r){wrappedFn.conversion=r.conversion}return wrappedFn}function wrapRounded(r){var wrappedFn=function(e){if(e===undefined||e===null){return e}if(arguments.length>1){e=Array.prototype.slice.call(arguments)}var n=r(e);if(typeof n==="object"){for(var t=n.length,a=0;a{"use strict";r.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},180:(r,e,n)=>{var t=n(598);function buildGraph(){var r={};var e=Object.keys(t);for(var n=e.length,a=0;a{"use strict";r=n.nmd(r);const t=n(830);const wrapAnsi16=(r,e)=>function(){const n=r.apply(t,arguments);return`[${n+e}m`};const wrapAnsi256=(r,e)=>function(){const n=r.apply(t,arguments);return`[${38+e};5;${n}m`};const wrapAnsi16m=(r,e)=>function(){const n=r.apply(t,arguments);return`[${38+e};2;${n[0]};${n[1]};${n[2]}m`};function assembleStyles(){const r=new Map;const e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.grey=e.color.gray;for(const n of Object.keys(e)){const t=e[n];for(const n of Object.keys(t)){const a=t[n];e[n]={open:`[${a[0]}m`,close:`[${a[1]}m`};t[n]=e[n];r.set(a[0],a[1])}Object.defineProperty(e,n,{value:t,enumerable:false});Object.defineProperty(e,"codes",{value:r,enumerable:false})}const ansi2ansi=r=>r;const rgb2rgb=(r,e,n)=>[r,e,n];e.color.close="";e.bgColor.close="";e.color.ansi={ansi:wrapAnsi16(ansi2ansi,0)};e.color.ansi256={ansi256:wrapAnsi256(ansi2ansi,0)};e.color.ansi16m={rgb:wrapAnsi16m(rgb2rgb,0)};e.bgColor.ansi={ansi:wrapAnsi16(ansi2ansi,10)};e.bgColor.ansi256={ansi256:wrapAnsi256(ansi2ansi,10)};e.bgColor.ansi16m={rgb:wrapAnsi16m(rgb2rgb,10)};for(let r of Object.keys(t)){if(typeof t[r]!=="object"){continue}const n=t[r];if(r==="ansi16"){r="ansi"}if("ansi16"in n){e.color.ansi[r]=wrapAnsi16(n.ansi16,0);e.bgColor.ansi[r]=wrapAnsi16(n.ansi16,10)}if("ansi256"in n){e.color.ansi256[r]=wrapAnsi256(n.ansi256,0);e.bgColor.ansi256[r]=wrapAnsi256(n.ansi256,10)}if("rgb"in n){e.color.ansi16m[r]=wrapAnsi16m(n.rgb,0);e.bgColor.ansi16m[r]=wrapAnsi16m(n.rgb,10)}}return e}Object.defineProperty(r,"exports",{enumerable:true,get:assembleStyles})},437:(r,e,n)=>{"use strict";const t=n(556);const a=n(694);const o=n(937).stdout;const s=n(900);const l=process.platform==="win32"&&!(process.env.TERM||"").toLowerCase().startsWith("xterm");const i=["ansi","ansi","ansi256","ansi16m"];const c=new Set(["gray"]);const u=Object.create(null);function applyOptions(r,e){e=e||{};const n=o?o.level:0;r.level=e.level===undefined?n:e.level;r.enabled="enabled"in e?e.enabled:r.level>0}function Chalk(r){if(!this||!(this instanceof Chalk)||this.template){const e={};applyOptions(e,r);e.template=function(){const r=[].slice.call(arguments);return chalkTag.apply(null,[e.template].concat(r))};Object.setPrototypeOf(e,Chalk.prototype);Object.setPrototypeOf(e.template,e);e.template.constructor=Chalk;return e.template}applyOptions(this,r)}if(l){a.blue.open=""}for(const r of Object.keys(a)){a[r].closeRe=new RegExp(t(a[r].close),"g");u[r]={get(){const e=a[r];return build.call(this,this._styles?this._styles.concat(e):[e],this._empty,r)}}}u.visible={get(){return build.call(this,this._styles||[],true,"visible")}};a.color.closeRe=new RegExp(t(a.color.close),"g");for(const r of Object.keys(a.color.ansi)){if(c.has(r)){continue}u[r]={get(){const e=this.level;return function(){const n=a.color[i[e]][r].apply(null,arguments);const t={open:n,close:a.color.close,closeRe:a.color.closeRe};return build.call(this,this._styles?this._styles.concat(t):[t],this._empty,r)}}}}a.bgColor.closeRe=new RegExp(t(a.bgColor.close),"g");for(const r of Object.keys(a.bgColor.ansi)){if(c.has(r)){continue}const e="bg"+r[0].toUpperCase()+r.slice(1);u[e]={get(){const e=this.level;return function(){const n=a.bgColor[i[e]][r].apply(null,arguments);const t={open:n,close:a.bgColor.close,closeRe:a.bgColor.closeRe};return build.call(this,this._styles?this._styles.concat(t):[t],this._empty,r)}}}}const v=Object.defineProperties((()=>{}),u);function build(r,e,n){const builder=function(){return applyStyle.apply(builder,arguments)};builder._styles=r;builder._empty=e;const t=this;Object.defineProperty(builder,"level",{enumerable:true,get(){return t.level},set(r){t.level=r}});Object.defineProperty(builder,"enabled",{enumerable:true,get(){return t.enabled},set(r){t.enabled=r}});builder.hasGrey=this.hasGrey||n==="gray"||n==="grey";builder.__proto__=v;return builder}function applyStyle(){const r=arguments;const e=r.length;let n=String(arguments[0]);if(e===0){return""}if(e>1){for(let t=1;t{"use strict";const e=/(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;const n=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;const t=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;const a=/\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;const o=new Map([["n","\n"],["r","\r"],["t","\t"],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e",""],["a",""]]);function unescape(r){if(r[0]==="u"&&r.length===5||r[0]==="x"&&r.length===3){return String.fromCharCode(parseInt(r.slice(1),16))}return o.get(r)||r}function parseArguments(r,e){const n=[];const o=e.trim().split(/\s*,\s*/g);let s;for(const e of o){if(!isNaN(e)){n.push(Number(e))}else if(s=e.match(t)){n.push(s[2].replace(a,((r,e,n)=>e?unescape(e):n)))}else{throw new Error(`Invalid Chalk template style argument: ${e} (in style '${r}')`)}}return n}function parseStyle(r){n.lastIndex=0;const e=[];let t;while((t=n.exec(r))!==null){const r=t[1];if(t[2]){const n=parseArguments(r,t[2]);e.push([r].concat(n))}else{e.push([r])}}return e}function buildStyle(r,e){const n={};for(const r of e){for(const e of r.styles){n[e[0]]=r.inverse?null:e.slice(1)}}let t=r;for(const r of Object.keys(n)){if(Array.isArray(n[r])){if(!(r in t)){throw new Error(`Unknown Chalk style: ${r}`)}if(n[r].length>0){t=t[r].apply(t,n[r])}else{t=t[r]}}}return t}r.exports=(r,n)=>{const t=[];const a=[];let o=[];n.replace(e,((e,n,s,l,i,c)=>{if(n){o.push(unescape(n))}else if(l){const e=o.join("");o=[];a.push(t.length===0?e:buildStyle(r,t)(e));t.push({inverse:s,styles:parseStyle(l)})}else if(i){if(t.length===0){throw new Error("Found extraneous } in Chalk template literal")}a.push(buildStyle(r,t)(o.join("")));o=[];t.pop()}else{o.push(c)}}));a.push(o.join(""));if(t.length>0){const r=`Chalk template literal is missing ${t.length} closing bracket${t.length===1?"":"s"} (\`}\`)`;throw new Error(r)}return a.join("")}},135:r=>{"use strict";r.exports=(r,e)=>{e=e||process.argv;const n=r.startsWith("-")?"":r.length===1?"-":"--";const t=e.indexOf(n+r);const a=e.indexOf("--");return t!==-1&&(a===-1?true:t{"use strict";const t=n(37);const a=n(135);const o=process.env;let s;if(a("no-color")||a("no-colors")||a("color=false")){s=false}else if(a("color")||a("colors")||a("color=true")||a("color=always")){s=true}if("FORCE_COLOR"in o){s=o.FORCE_COLOR.length===0||parseInt(o.FORCE_COLOR,10)!==0}function translateLevel(r){if(r===0){return false}return{level:r,hasBasic:true,has256:r>=2,has16m:r>=3}}function supportsColor(r){if(s===false){return 0}if(a("color=16m")||a("color=full")||a("color=truecolor")){return 3}if(a("color=256")){return 2}if(r&&!r.isTTY&&s!==true){return 0}const e=s?1:0;if(process.platform==="win32"){const r=t.release().split(".");if(Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586){return Number(r[2])>=14931?3:2}return 1}if("CI"in o){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((r=>r in o))||o.CI_NAME==="codeship"){return 1}return e}if("TEAMCITY_VERSION"in o){return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(o.TEAMCITY_VERSION)?1:0}if(o.COLORTERM==="truecolor"){return 3}if("TERM_PROGRAM"in o){const r=parseInt((o.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(o.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(o.TERM)){return 2}if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(o.TERM)){return 1}if("COLORTERM"in o){return 1}if(o.TERM==="dumb"){return e}return e}function getSupportLevel(r){const e=supportsColor(r);return translateLevel(e)}r.exports={supportsColor:getSupportLevel,stdout:getSupportLevel(process.stdout),stderr:getSupportLevel(process.stderr)}},556:r=>{"use strict";r.exports=require("next/dist/compiled/escape-string-regexp")},37:r=>{"use strict";r.exports=require("os")}};var e={};function __nccwpck_require__(n){var t=e[n];if(t!==undefined){return t.exports}var a=e[n]={id:n,loaded:false,exports:{}};var o=true;try{r[n](a,a.exports,__nccwpck_require__);o=false}finally{if(o)delete e[n]}a.loaded=true;return a.exports}(()=>{__nccwpck_require__.nmd=r=>{r.paths=[];if(!r.children)r.children=[];return r}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var n=__nccwpck_require__(437);module.exports=n})(); \ No newline at end of file +(()=>{var r={598:(r,e,n)=>{var t=n(120);var a={};for(var o in t){if(t.hasOwnProperty(o)){a[t[o]]=o}}var s=r.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var l in s){if(s.hasOwnProperty(l)){if(!("channels"in s[l])){throw new Error("missing channels property: "+l)}if(!("labels"in s[l])){throw new Error("missing channel labels property: "+l)}if(s[l].labels.length!==s[l].channels){throw new Error("channel and label counts mismatch: "+l)}var i=s[l].channels;var c=s[l].labels;delete s[l].channels;delete s[l].labels;Object.defineProperty(s[l],"channels",{value:i});Object.defineProperty(s[l],"labels",{value:c})}}s.rgb.hsl=function(r){var e=r[0]/255;var n=r[1]/255;var t=r[2]/255;var a=Math.min(e,n,t);var o=Math.max(e,n,t);var s=o-a;var l;var i;var c;if(o===a){l=0}else if(e===o){l=(n-t)/s}else if(n===o){l=2+(t-e)/s}else if(t===o){l=4+(e-n)/s}l=Math.min(l*60,360);if(l<0){l+=360}c=(a+o)/2;if(o===a){i=0}else if(c<=.5){i=s/(o+a)}else{i=s/(2-o-a)}return[l,i*100,c*100]};s.rgb.hsv=function(r){var e;var n;var t;var a;var o;var s=r[0]/255;var l=r[1]/255;var i=r[2]/255;var c=Math.max(s,l,i);var u=c-Math.min(s,l,i);var diffc=function(r){return(c-r)/6/u+1/2};if(u===0){a=o=0}else{o=u/c;e=diffc(s);n=diffc(l);t=diffc(i);if(s===c){a=t-n}else if(l===c){a=1/3+e-t}else if(i===c){a=2/3+n-e}if(a<0){a+=1}else if(a>1){a-=1}}return[a*360,o*100,c*100]};s.rgb.hwb=function(r){var e=r[0];var n=r[1];var t=r[2];var a=s.rgb.hsl(r)[0];var o=1/255*Math.min(e,Math.min(n,t));t=1-1/255*Math.max(e,Math.max(n,t));return[a,o*100,t*100]};s.rgb.cmyk=function(r){var e=r[0]/255;var n=r[1]/255;var t=r[2]/255;var a;var o;var s;var l;l=Math.min(1-e,1-n,1-t);a=(1-e-l)/(1-l)||0;o=(1-n-l)/(1-l)||0;s=(1-t-l)/(1-l)||0;return[a*100,o*100,s*100,l*100]};function comparativeDistance(r,e){return Math.pow(r[0]-e[0],2)+Math.pow(r[1]-e[1],2)+Math.pow(r[2]-e[2],2)}s.rgb.keyword=function(r){var e=a[r];if(e){return e}var n=Infinity;var o;for(var s in t){if(t.hasOwnProperty(s)){var l=t[s];var i=comparativeDistance(r,l);if(i.04045?Math.pow((e+.055)/1.055,2.4):e/12.92;n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92;t=t>.04045?Math.pow((t+.055)/1.055,2.4):t/12.92;var a=e*.4124+n*.3576+t*.1805;var o=e*.2126+n*.7152+t*.0722;var s=e*.0193+n*.1192+t*.9505;return[a*100,o*100,s*100]};s.rgb.lab=function(r){var e=s.rgb.xyz(r);var n=e[0];var t=e[1];var a=e[2];var o;var l;var i;n/=95.047;t/=100;a/=108.883;n=n>.008856?Math.pow(n,1/3):7.787*n+16/116;t=t>.008856?Math.pow(t,1/3):7.787*t+16/116;a=a>.008856?Math.pow(a,1/3):7.787*a+16/116;o=116*t-16;l=500*(n-t);i=200*(t-a);return[o,l,i]};s.hsl.rgb=function(r){var e=r[0]/360;var n=r[1]/100;var t=r[2]/100;var a;var o;var s;var l;var i;if(n===0){i=t*255;return[i,i,i]}if(t<.5){o=t*(1+n)}else{o=t+n-t*n}a=2*t-o;l=[0,0,0];for(var c=0;c<3;c++){s=e+1/3*-(c-1);if(s<0){s++}if(s>1){s--}if(6*s<1){i=a+(o-a)*6*s}else if(2*s<1){i=o}else if(3*s<2){i=a+(o-a)*(2/3-s)*6}else{i=a}l[c]=i*255}return l};s.hsl.hsv=function(r){var e=r[0];var n=r[1]/100;var t=r[2]/100;var a=n;var o=Math.max(t,.01);var s;var l;t*=2;n*=t<=1?t:2-t;a*=o<=1?o:2-o;l=(t+n)/2;s=t===0?2*a/(o+a):2*n/(t+n);return[e,s*100,l*100]};s.hsv.rgb=function(r){var e=r[0]/60;var n=r[1]/100;var t=r[2]/100;var a=Math.floor(e)%6;var o=e-Math.floor(e);var s=255*t*(1-n);var l=255*t*(1-n*o);var i=255*t*(1-n*(1-o));t*=255;switch(a){case 0:return[t,i,s];case 1:return[l,t,s];case 2:return[s,t,i];case 3:return[s,l,t];case 4:return[i,s,t];case 5:return[t,s,l]}};s.hsv.hsl=function(r){var e=r[0];var n=r[1]/100;var t=r[2]/100;var a=Math.max(t,.01);var o;var s;var l;l=(2-n)*t;o=(2-n)*a;s=n*a;s/=o<=1?o:2-o;s=s||0;l/=2;return[e,s*100,l*100]};s.hwb.rgb=function(r){var e=r[0]/360;var n=r[1]/100;var t=r[2]/100;var a=n+t;var o;var s;var l;var i;if(a>1){n/=a;t/=a}o=Math.floor(6*e);s=1-t;l=6*e-o;if((o&1)!==0){l=1-l}i=n+l*(s-n);var c;var u;var v;switch(o){default:case 6:case 0:c=s;u=i;v=n;break;case 1:c=i;u=s;v=n;break;case 2:c=n;u=s;v=i;break;case 3:c=n;u=i;v=s;break;case 4:c=i;u=n;v=s;break;case 5:c=s;u=n;v=i;break}return[c*255,u*255,v*255]};s.cmyk.rgb=function(r){var e=r[0]/100;var n=r[1]/100;var t=r[2]/100;var a=r[3]/100;var o;var s;var l;o=1-Math.min(1,e*(1-a)+a);s=1-Math.min(1,n*(1-a)+a);l=1-Math.min(1,t*(1-a)+a);return[o*255,s*255,l*255]};s.xyz.rgb=function(r){var e=r[0]/100;var n=r[1]/100;var t=r[2]/100;var a;var o;var s;a=e*3.2406+n*-1.5372+t*-.4986;o=e*-.9689+n*1.8758+t*.0415;s=e*.0557+n*-.204+t*1.057;a=a>.0031308?1.055*Math.pow(a,1/2.4)-.055:a*12.92;o=o>.0031308?1.055*Math.pow(o,1/2.4)-.055:o*12.92;s=s>.0031308?1.055*Math.pow(s,1/2.4)-.055:s*12.92;a=Math.min(Math.max(0,a),1);o=Math.min(Math.max(0,o),1);s=Math.min(Math.max(0,s),1);return[a*255,o*255,s*255]};s.xyz.lab=function(r){var e=r[0];var n=r[1];var t=r[2];var a;var o;var s;e/=95.047;n/=100;t/=108.883;e=e>.008856?Math.pow(e,1/3):7.787*e+16/116;n=n>.008856?Math.pow(n,1/3):7.787*n+16/116;t=t>.008856?Math.pow(t,1/3):7.787*t+16/116;a=116*n-16;o=500*(e-n);s=200*(n-t);return[a,o,s]};s.lab.xyz=function(r){var e=r[0];var n=r[1];var t=r[2];var a;var o;var s;o=(e+16)/116;a=n/500+o;s=o-t/200;var l=Math.pow(o,3);var i=Math.pow(a,3);var c=Math.pow(s,3);o=l>.008856?l:(o-16/116)/7.787;a=i>.008856?i:(a-16/116)/7.787;s=c>.008856?c:(s-16/116)/7.787;a*=95.047;o*=100;s*=108.883;return[a,o,s]};s.lab.lch=function(r){var e=r[0];var n=r[1];var t=r[2];var a;var o;var s;a=Math.atan2(t,n);o=a*360/2/Math.PI;if(o<0){o+=360}s=Math.sqrt(n*n+t*t);return[e,s,o]};s.lch.lab=function(r){var e=r[0];var n=r[1];var t=r[2];var a;var o;var s;s=t/360*2*Math.PI;a=n*Math.cos(s);o=n*Math.sin(s);return[e,a,o]};s.rgb.ansi16=function(r){var e=r[0];var n=r[1];var t=r[2];var a=1 in arguments?arguments[1]:s.rgb.hsv(r)[2];a=Math.round(a/50);if(a===0){return 30}var o=30+(Math.round(t/255)<<2|Math.round(n/255)<<1|Math.round(e/255));if(a===2){o+=60}return o};s.hsv.ansi16=function(r){return s.rgb.ansi16(s.hsv.rgb(r),r[2])};s.rgb.ansi256=function(r){var e=r[0];var n=r[1];var t=r[2];if(e===n&&n===t){if(e<8){return 16}if(e>248){return 231}return Math.round((e-8)/247*24)+232}var a=16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(t/255*5);return a};s.ansi16.rgb=function(r){var e=r%10;if(e===0||e===7){if(r>50){e+=3.5}e=e/10.5*255;return[e,e,e]}var n=(~~(r>50)+1)*.5;var t=(e&1)*n*255;var a=(e>>1&1)*n*255;var o=(e>>2&1)*n*255;return[t,a,o]};s.ansi256.rgb=function(r){if(r>=232){var e=(r-232)*10+8;return[e,e,e]}r-=16;var n;var t=Math.floor(r/36)/5*255;var a=Math.floor((n=r%36)/6)/5*255;var o=n%6/5*255;return[t,a,o]};s.rgb.hex=function(r){var e=((Math.round(r[0])&255)<<16)+((Math.round(r[1])&255)<<8)+(Math.round(r[2])&255);var n=e.toString(16).toUpperCase();return"000000".substring(n.length)+n};s.hex.rgb=function(r){var e=r.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e){return[0,0,0]}var n=e[0];if(e[0].length===3){n=n.split("").map((function(r){return r+r})).join("")}var t=parseInt(n,16);var a=t>>16&255;var o=t>>8&255;var s=t&255;return[a,o,s]};s.rgb.hcg=function(r){var e=r[0]/255;var n=r[1]/255;var t=r[2]/255;var a=Math.max(Math.max(e,n),t);var o=Math.min(Math.min(e,n),t);var s=a-o;var l;var i;if(s<1){l=o/(1-s)}else{l=0}if(s<=0){i=0}else if(a===e){i=(n-t)/s%6}else if(a===n){i=2+(t-e)/s}else{i=4+(e-n)/s+4}i/=6;i%=1;return[i*360,s*100,l*100]};s.hsl.hcg=function(r){var e=r[1]/100;var n=r[2]/100;var t=1;var a=0;if(n<.5){t=2*e*n}else{t=2*e*(1-n)}if(t<1){a=(n-.5*t)/(1-t)}return[r[0],t*100,a*100]};s.hsv.hcg=function(r){var e=r[1]/100;var n=r[2]/100;var t=e*n;var a=0;if(t<1){a=(n-t)/(1-t)}return[r[0],t*100,a*100]};s.hcg.rgb=function(r){var e=r[0]/360;var n=r[1]/100;var t=r[2]/100;if(n===0){return[t*255,t*255,t*255]}var a=[0,0,0];var o=e%1*6;var s=o%1;var l=1-s;var i=0;switch(Math.floor(o)){case 0:a[0]=1;a[1]=s;a[2]=0;break;case 1:a[0]=l;a[1]=1;a[2]=0;break;case 2:a[0]=0;a[1]=1;a[2]=s;break;case 3:a[0]=0;a[1]=l;a[2]=1;break;case 4:a[0]=s;a[1]=0;a[2]=1;break;default:a[0]=1;a[1]=0;a[2]=l}i=(1-n)*t;return[(n*a[0]+i)*255,(n*a[1]+i)*255,(n*a[2]+i)*255]};s.hcg.hsv=function(r){var e=r[1]/100;var n=r[2]/100;var t=e+n*(1-e);var a=0;if(t>0){a=e/t}return[r[0],a*100,t*100]};s.hcg.hsl=function(r){var e=r[1]/100;var n=r[2]/100;var t=n*(1-e)+.5*e;var a=0;if(t>0&&t<.5){a=e/(2*t)}else if(t>=.5&&t<1){a=e/(2*(1-t))}return[r[0],a*100,t*100]};s.hcg.hwb=function(r){var e=r[1]/100;var n=r[2]/100;var t=e+n*(1-e);return[r[0],(t-e)*100,(1-t)*100]};s.hwb.hcg=function(r){var e=r[1]/100;var n=r[2]/100;var t=1-n;var a=t-e;var o=0;if(a<1){o=(t-a)/(1-a)}return[r[0],a*100,o*100]};s.apple.rgb=function(r){return[r[0]/65535*255,r[1]/65535*255,r[2]/65535*255]};s.rgb.apple=function(r){return[r[0]/255*65535,r[1]/255*65535,r[2]/255*65535]};s.gray.rgb=function(r){return[r[0]/100*255,r[0]/100*255,r[0]/100*255]};s.gray.hsl=s.gray.hsv=function(r){return[0,0,r[0]]};s.gray.hwb=function(r){return[0,100,r[0]]};s.gray.cmyk=function(r){return[0,0,0,r[0]]};s.gray.lab=function(r){return[r[0],0,0]};s.gray.hex=function(r){var e=Math.round(r[0]/100*255)&255;var n=(e<<16)+(e<<8)+e;var t=n.toString(16).toUpperCase();return"000000".substring(t.length)+t};s.rgb.gray=function(r){var e=(r[0]+r[1]+r[2])/3;return[e/255*100]}},830:(r,e,n)=>{var t=n(598);var a=n(180);var o={};var s=Object.keys(t);function wrapRaw(r){var wrappedFn=function(e){if(e===undefined||e===null){return e}if(arguments.length>1){e=Array.prototype.slice.call(arguments)}return r(e)};if("conversion"in r){wrappedFn.conversion=r.conversion}return wrappedFn}function wrapRounded(r){var wrappedFn=function(e){if(e===undefined||e===null){return e}if(arguments.length>1){e=Array.prototype.slice.call(arguments)}var n=r(e);if(typeof n==="object"){for(var t=n.length,a=0;a{"use strict";r.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},180:(r,e,n)=>{var t=n(598);function buildGraph(){var r={};var e=Object.keys(t);for(var n=e.length,a=0;a{"use strict";r=n.nmd(r);const t=n(830);const wrapAnsi16=(r,e)=>function(){const n=r.apply(t,arguments);return`[${n+e}m`};const wrapAnsi256=(r,e)=>function(){const n=r.apply(t,arguments);return`[${38+e};5;${n}m`};const wrapAnsi16m=(r,e)=>function(){const n=r.apply(t,arguments);return`[${38+e};2;${n[0]};${n[1]};${n[2]}m`};function assembleStyles(){const r=new Map;const e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.grey=e.color.gray;for(const n of Object.keys(e)){const t=e[n];for(const n of Object.keys(t)){const a=t[n];e[n]={open:`[${a[0]}m`,close:`[${a[1]}m`};t[n]=e[n];r.set(a[0],a[1])}Object.defineProperty(e,n,{value:t,enumerable:false});Object.defineProperty(e,"codes",{value:r,enumerable:false})}const ansi2ansi=r=>r;const rgb2rgb=(r,e,n)=>[r,e,n];e.color.close="";e.bgColor.close="";e.color.ansi={ansi:wrapAnsi16(ansi2ansi,0)};e.color.ansi256={ansi256:wrapAnsi256(ansi2ansi,0)};e.color.ansi16m={rgb:wrapAnsi16m(rgb2rgb,0)};e.bgColor.ansi={ansi:wrapAnsi16(ansi2ansi,10)};e.bgColor.ansi256={ansi256:wrapAnsi256(ansi2ansi,10)};e.bgColor.ansi16m={rgb:wrapAnsi16m(rgb2rgb,10)};for(let r of Object.keys(t)){if(typeof t[r]!=="object"){continue}const n=t[r];if(r==="ansi16"){r="ansi"}if("ansi16"in n){e.color.ansi[r]=wrapAnsi16(n.ansi16,0);e.bgColor.ansi[r]=wrapAnsi16(n.ansi16,10)}if("ansi256"in n){e.color.ansi256[r]=wrapAnsi256(n.ansi256,0);e.bgColor.ansi256[r]=wrapAnsi256(n.ansi256,10)}if("rgb"in n){e.color.ansi16m[r]=wrapAnsi16m(n.rgb,0);e.bgColor.ansi16m[r]=wrapAnsi16m(n.rgb,10)}}return e}Object.defineProperty(r,"exports",{enumerable:true,get:assembleStyles})},437:(r,e,n)=>{"use strict";const t=n(426);const a=n(694);const o=n(937).stdout;const s=n(900);const l=process.platform==="win32"&&!(process.env.TERM||"").toLowerCase().startsWith("xterm");const i=["ansi","ansi","ansi256","ansi16m"];const c=new Set(["gray"]);const u=Object.create(null);function applyOptions(r,e){e=e||{};const n=o?o.level:0;r.level=e.level===undefined?n:e.level;r.enabled="enabled"in e?e.enabled:r.level>0}function Chalk(r){if(!this||!(this instanceof Chalk)||this.template){const e={};applyOptions(e,r);e.template=function(){const r=[].slice.call(arguments);return chalkTag.apply(null,[e.template].concat(r))};Object.setPrototypeOf(e,Chalk.prototype);Object.setPrototypeOf(e.template,e);e.template.constructor=Chalk;return e.template}applyOptions(this,r)}if(l){a.blue.open=""}for(const r of Object.keys(a)){a[r].closeRe=new RegExp(t(a[r].close),"g");u[r]={get(){const e=a[r];return build.call(this,this._styles?this._styles.concat(e):[e],this._empty,r)}}}u.visible={get(){return build.call(this,this._styles||[],true,"visible")}};a.color.closeRe=new RegExp(t(a.color.close),"g");for(const r of Object.keys(a.color.ansi)){if(c.has(r)){continue}u[r]={get(){const e=this.level;return function(){const n=a.color[i[e]][r].apply(null,arguments);const t={open:n,close:a.color.close,closeRe:a.color.closeRe};return build.call(this,this._styles?this._styles.concat(t):[t],this._empty,r)}}}}a.bgColor.closeRe=new RegExp(t(a.bgColor.close),"g");for(const r of Object.keys(a.bgColor.ansi)){if(c.has(r)){continue}const e="bg"+r[0].toUpperCase()+r.slice(1);u[e]={get(){const e=this.level;return function(){const n=a.bgColor[i[e]][r].apply(null,arguments);const t={open:n,close:a.bgColor.close,closeRe:a.bgColor.closeRe};return build.call(this,this._styles?this._styles.concat(t):[t],this._empty,r)}}}}const v=Object.defineProperties((()=>{}),u);function build(r,e,n){const builder=function(){return applyStyle.apply(builder,arguments)};builder._styles=r;builder._empty=e;const t=this;Object.defineProperty(builder,"level",{enumerable:true,get(){return t.level},set(r){t.level=r}});Object.defineProperty(builder,"enabled",{enumerable:true,get(){return t.enabled},set(r){t.enabled=r}});builder.hasGrey=this.hasGrey||n==="gray"||n==="grey";builder.__proto__=v;return builder}function applyStyle(){const r=arguments;const e=r.length;let n=String(arguments[0]);if(e===0){return""}if(e>1){for(let t=1;t{"use strict";const e=/(?:\\(u[a-f\d]{4}|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;const n=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;const t=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;const a=/\\(u[a-f\d]{4}|x[a-f\d]{2}|.)|([^\\])/gi;const o=new Map([["n","\n"],["r","\r"],["t","\t"],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e",""],["a",""]]);function unescape(r){if(r[0]==="u"&&r.length===5||r[0]==="x"&&r.length===3){return String.fromCharCode(parseInt(r.slice(1),16))}return o.get(r)||r}function parseArguments(r,e){const n=[];const o=e.trim().split(/\s*,\s*/g);let s;for(const e of o){if(!isNaN(e)){n.push(Number(e))}else if(s=e.match(t)){n.push(s[2].replace(a,((r,e,n)=>e?unescape(e):n)))}else{throw new Error(`Invalid Chalk template style argument: ${e} (in style '${r}')`)}}return n}function parseStyle(r){n.lastIndex=0;const e=[];let t;while((t=n.exec(r))!==null){const r=t[1];if(t[2]){const n=parseArguments(r,t[2]);e.push([r].concat(n))}else{e.push([r])}}return e}function buildStyle(r,e){const n={};for(const r of e){for(const e of r.styles){n[e[0]]=r.inverse?null:e.slice(1)}}let t=r;for(const r of Object.keys(n)){if(Array.isArray(n[r])){if(!(r in t)){throw new Error(`Unknown Chalk style: ${r}`)}if(n[r].length>0){t=t[r].apply(t,n[r])}else{t=t[r]}}}return t}r.exports=(r,n)=>{const t=[];const a=[];let o=[];n.replace(e,((e,n,s,l,i,c)=>{if(n){o.push(unescape(n))}else if(l){const e=o.join("");o=[];a.push(t.length===0?e:buildStyle(r,t)(e));t.push({inverse:s,styles:parseStyle(l)})}else if(i){if(t.length===0){throw new Error("Found extraneous } in Chalk template literal")}a.push(buildStyle(r,t)(o.join("")));o=[];t.pop()}else{o.push(c)}}));a.push(o.join(""));if(t.length>0){const r=`Chalk template literal is missing ${t.length} closing bracket${t.length===1?"":"s"} (\`}\`)`;throw new Error(r)}return a.join("")}},426:r=>{"use strict";var e=/[|\\{}()[\]^$+*?.]/g;r.exports=function(r){if(typeof r!=="string"){throw new TypeError("Expected a string")}return r.replace(e,"\\$&")}},135:r=>{"use strict";r.exports=(r,e)=>{e=e||process.argv;const n=r.startsWith("-")?"":r.length===1?"-":"--";const t=e.indexOf(n+r);const a=e.indexOf("--");return t!==-1&&(a===-1?true:t{"use strict";const t=n(37);const a=n(135);const o=process.env;let s;if(a("no-color")||a("no-colors")||a("color=false")){s=false}else if(a("color")||a("colors")||a("color=true")||a("color=always")){s=true}if("FORCE_COLOR"in o){s=o.FORCE_COLOR.length===0||parseInt(o.FORCE_COLOR,10)!==0}function translateLevel(r){if(r===0){return false}return{level:r,hasBasic:true,has256:r>=2,has16m:r>=3}}function supportsColor(r){if(s===false){return 0}if(a("color=16m")||a("color=full")||a("color=truecolor")){return 3}if(a("color=256")){return 2}if(r&&!r.isTTY&&s!==true){return 0}const e=s?1:0;if(process.platform==="win32"){const r=t.release().split(".");if(Number(process.versions.node.split(".")[0])>=8&&Number(r[0])>=10&&Number(r[2])>=10586){return Number(r[2])>=14931?3:2}return 1}if("CI"in o){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((r=>r in o))||o.CI_NAME==="codeship"){return 1}return e}if("TEAMCITY_VERSION"in o){return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(o.TEAMCITY_VERSION)?1:0}if(o.COLORTERM==="truecolor"){return 3}if("TERM_PROGRAM"in o){const r=parseInt((o.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(o.TERM_PROGRAM){case"iTerm.app":return r>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(o.TERM)){return 2}if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(o.TERM)){return 1}if("COLORTERM"in o){return 1}if(o.TERM==="dumb"){return e}return e}function getSupportLevel(r){const e=supportsColor(r);return translateLevel(e)}r.exports={supportsColor:getSupportLevel,stdout:getSupportLevel(process.stdout),stderr:getSupportLevel(process.stderr)}},37:r=>{"use strict";r.exports=require("os")}};var e={};function __nccwpck_require__(n){var t=e[n];if(t!==undefined){return t.exports}var a=e[n]={id:n,loaded:false,exports:{}};var o=true;try{r[n](a,a.exports,__nccwpck_require__);o=false}finally{if(o)delete e[n]}a.loaded=true;return a.exports}(()=>{__nccwpck_require__.nmd=r=>{r.paths=[];if(!r.children)r.children=[];return r}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var n=__nccwpck_require__(437);module.exports=n})(); \ No newline at end of file diff --git a/packages/next/compiled/escape-string-regexp/LICENSE b/packages/next/compiled/escape-string-regexp/LICENSE deleted file mode 100644 index e7af2f77107d7..0000000000000 --- a/packages/next/compiled/escape-string-regexp/LICENSE +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packages/next/compiled/escape-string-regexp/index.js b/packages/next/compiled/escape-string-regexp/index.js deleted file mode 100644 index 8a404254e2cf7..0000000000000 --- a/packages/next/compiled/escape-string-regexp/index.js +++ /dev/null @@ -1 +0,0 @@ -(function(){"use strict";var e={3:function(e){const r=/[|\\{}()[\]^$+*?.-]/g;e.exports=e=>{if(typeof e!=="string"){throw new TypeError("Expected a string")}return e.replace(r,"\\$&")}}};var r={};function __nccwpck_require__(_){var t=r[_];if(t!==undefined){return t.exports}var i=r[_]={exports:{}};var n=true;try{e[_](i,i.exports,__nccwpck_require__);n=false}finally{if(n)delete r[_]}return i.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var _=__nccwpck_require__(3);module.exports=_})(); \ No newline at end of file diff --git a/packages/next/compiled/escape-string-regexp/package.json b/packages/next/compiled/escape-string-regexp/package.json deleted file mode 100644 index c4201a4b4a115..0000000000000 --- a/packages/next/compiled/escape-string-regexp/package.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"escape-string-regexp","main":"index.js","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"license":"MIT"} diff --git a/packages/next/compiled/ora/index.js b/packages/next/compiled/ora/index.js index e566c8357af69..8e2ef8746b6a1 100644 --- a/packages/next/compiled/ora/index.js +++ b/packages/next/compiled/ora/index.js @@ -1 +1 @@ -(()=>{var e={420:(e,t,r)=>{var s=r(321);e.exports=function(e,t){e=e||{};Object.keys(t).forEach((function(r){if(typeof e[r]==="undefined"){e[r]=s(t[r])}}));return e}},321:e=>{var t=function(){"use strict";function clone(e,t,r,s){var i;if(typeof t==="object"){r=t.depth;s=t.prototype;i=t.filter;t=t.circular}var n=[];var o=[];var a=typeof Buffer!="undefined";if(typeof t=="undefined")t=true;if(typeof r=="undefined")r=Infinity;function _clone(e,r){if(e===null)return null;if(r==0)return e;var i;var _;if(typeof e!="object"){return e}if(clone.__isArray(e)){i=[]}else if(clone.__isRegExp(e)){i=new RegExp(e.source,__getRegExpFlags(e));if(e.lastIndex)i.lastIndex=e.lastIndex}else if(clone.__isDate(e)){i=new Date(e.getTime())}else if(a&&Buffer.isBuffer(e)){if(Buffer.allocUnsafe){i=Buffer.allocUnsafe(e.length)}else{i=new Buffer(e.length)}e.copy(i);return i}else{if(typeof s=="undefined"){_=Object.getPrototypeOf(e);i=Object.create(_)}else{i=Object.create(s);_=s}}if(t){var l=n.indexOf(e);if(l!=-1){return o[l]}n.push(e);o.push(i)}for(var f in e){var u;if(_){u=Object.getOwnPropertyDescriptor(_,f)}if(u&&u.set==null){continue}i[f]=_clone(e[f],r-1)}return i}return _clone(e,r)}clone.clonePrototype=function clonePrototype(e){if(e===null)return null;var c=function(){};c.prototype=e;return new c};function __objToStr(e){return Object.prototype.toString.call(e)}clone.__objToStr=__objToStr;function __isDate(e){return typeof e==="object"&&__objToStr(e)==="[object Date]"}clone.__isDate=__isDate;function __isArray(e){return typeof e==="object"&&__objToStr(e)==="[object Array]"}clone.__isArray=__isArray;function __isRegExp(e){return typeof e==="object"&&__objToStr(e)==="[object RegExp]"}clone.__isRegExp=__isRegExp;function __getRegExpFlags(e){var t="";if(e.global)t+="g";if(e.ignoreCase)t+="i";if(e.multiline)t+="m";return t}clone.__getRegExpFlags=__getRegExpFlags;return clone}();if(true&&e.exports){e.exports=t}},890:e=>{"use strict";e.exports=({stream:e=process.stdout}={})=>Boolean(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))},203:(e,t,r)=>{"use strict";const s=r(542);const i=process.platform!=="win32"||process.env.CI||process.env.TERM==="xterm-256color";const n={info:s.blue("ℹ"),success:s.green("✔"),warning:s.yellow("⚠"),error:s.red("✖")};const o={info:s.blue("i"),success:s.green("√"),warning:s.yellow("‼"),error:s.red("×")};e.exports=i?n:o},481:e=>{"use strict";const mimicFn=(e,t)=>{for(const r of Reflect.ownKeys(t)){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}return e};e.exports=mimicFn;e.exports["default"]=mimicFn},471:(e,t,r)=>{var s=r(781);e.exports=MuteStream;function MuteStream(e){s.apply(this);e=e||{};this.writable=this.readable=true;this.muted=false;this.on("pipe",this._onpipe);this.replace=e.replace;this._prompt=e.prompt||null;this._hadControl=false}MuteStream.prototype=Object.create(s.prototype);Object.defineProperty(MuteStream.prototype,"constructor",{value:MuteStream,enumerable:false});MuteStream.prototype.mute=function(){this.muted=true};MuteStream.prototype.unmute=function(){this.muted=false};Object.defineProperty(MuteStream.prototype,"_onpipe",{value:onPipe,enumerable:false,writable:true,configurable:true});function onPipe(e){this._src=e}Object.defineProperty(MuteStream.prototype,"isTTY",{get:getIsTTY,set:setIsTTY,enumerable:true,configurable:true});function getIsTTY(){return this._dest?this._dest.isTTY:this._src?this._src.isTTY:false}function setIsTTY(e){Object.defineProperty(this,"isTTY",{value:e,enumerable:true,writable:true,configurable:true})}Object.defineProperty(MuteStream.prototype,"rows",{get:function(){return this._dest?this._dest.rows:this._src?this._src.rows:undefined},enumerable:true,configurable:true});Object.defineProperty(MuteStream.prototype,"columns",{get:function(){return this._dest?this._dest.columns:this._src?this._src.columns:undefined},enumerable:true,configurable:true});MuteStream.prototype.pipe=function(e,t){this._dest=e;return s.prototype.pipe.call(this,e,t)};MuteStream.prototype.pause=function(){if(this._src)return this._src.pause()};MuteStream.prototype.resume=function(){if(this._src)return this._src.resume()};MuteStream.prototype.write=function(e){if(this.muted){if(!this.replace)return true;if(e.match(/^\u001b/)){if(e.indexOf(this._prompt)===0){e=e.substr(this._prompt.length);e=e.replace(/./g,this.replace);e=this._prompt+e}this._hadControl=true;return this.emit("data",e)}else{if(this._prompt&&this._hadControl&&e.indexOf(this._prompt)===0){this._hadControl=false;this.emit("data",this._prompt);e=e.substr(this._prompt.length)}e=e.toString().replace(/./g,this.replace)}}this.emit("data",e)};MuteStream.prototype.end=function(e){if(this.muted){if(e&&this.replace){e=e.toString().replace(/./g,this.replace)}else{e=null}}if(e)this.emit("data",e);this.emit("end")};function proxy(e){return function(){var t=this._dest;var r=this._src;if(t&&t[e])t[e].apply(t,arguments);if(r&&r[e])r[e].apply(r,arguments)}}MuteStream.prototype.destroy=proxy("destroy");MuteStream.prototype.destroySoon=proxy("destroySoon");MuteStream.prototype.close=proxy("close")},462:(e,t,r)=>{"use strict";const s=r(481);const i=new WeakMap;const oneTime=(e,t={})=>{if(typeof e!=="function"){throw new TypeError("Expected a function")}let r;let n=false;let o=0;const a=e.displayName||e.name||"";const onetime=function(...s){i.set(onetime,++o);if(n){if(t.throw===true){throw new Error(`Function \`${a}\` can only be called once`)}return r}n=true;r=e.apply(this,s);e=null;return r};s(onetime,e);i.set(onetime,o);return onetime};e.exports=oneTime;e.exports["default"]=oneTime;e.exports.callCount=e=>{if(!i.has(e)){throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`)}return i.get(e)}},28:(e,t,r)=>{var s=r(491);var i=r(19);var n=r(361);if(typeof n!=="function"){n=n.EventEmitter}var o;if(process.__signal_exit_emitter__){o=process.__signal_exit_emitter__}else{o=process.__signal_exit_emitter__=new n;o.count=0;o.emitted={}}if(!o.infinite){o.setMaxListeners(Infinity);o.infinite=true}e.exports=function(e,t){s.equal(typeof e,"function","a callback must be provided for exit handler");if(_===false){load()}var r="exit";if(t&&t.alwaysLast){r="afterexit"}var remove=function(){o.removeListener(r,e);if(o.listeners("exit").length===0&&o.listeners("afterexit").length===0){unload()}};o.on(r,e);return remove};e.exports.unload=unload;function unload(){if(!_){return}_=false;i.forEach((function(e){try{process.removeListener(e,a[e])}catch(e){}}));process.emit=f;process.reallyExit=l;o.count-=1}function emit(e,t,r){if(o.emitted[e]){return}o.emitted[e]=true;o.emit(e,t,r)}var a={};i.forEach((function(e){a[e]=function listener(){var t=process.listeners(e);if(t.length===o.count){unload();emit("exit",null,e);emit("afterexit",null,e);process.kill(process.pid,e)}}}));e.exports.signals=function(){return i};e.exports.load=load;var _=false;function load(){if(_){return}_=true;o.count+=1;i=i.filter((function(e){try{process.on(e,a[e]);return true}catch(e){return false}}));process.emit=processEmit;process.reallyExit=processReallyExit}var l=process.reallyExit;function processReallyExit(e){process.exitCode=e||0;emit("exit",process.exitCode,null);emit("afterexit",process.exitCode,null);l.call(process,process.exitCode)}var f=process.emit;function processEmit(e,t){if(e==="exit"){if(t!==undefined){process.exitCode=t}var r=f.apply(this,arguments);emit("exit",process.exitCode,null);emit("afterexit",process.exitCode,null);return r}else{return f.apply(this,arguments)}}},19:e=>{e.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32"){e.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT")}if(process.platform==="linux"){e.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")}},523:e=>{e.exports=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]]},205:(e,t,r)=>{"use strict";var s=r(420);var i=r(523);var n={nul:0,control:0};e.exports=function wcwidth(e){return wcswidth(e,n)};e.exports.config=function(e){e=s(e||{},n);return function wcwidth(t){return wcswidth(t,e)}};function wcswidth(e,t){if(typeof e!=="string")return wcwidth(e,t);var r=0;for(var s=0;s=127&&e<160)return t.control;if(bisearch(e))return 0;return 1+(e>=4352&&(e<=4447||e==9001||e==9002||e>=11904&&e<=42191&&e!=12351||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510||e>=131072&&e<=196605||e>=196608&&e<=262141))}function bisearch(e){var t=0;var r=i.length-1;var s;if(ei[r][1])return false;while(r>=t){s=Math.floor((t+r)/2);if(e>i[s][1])t=s+1;else if(e{"use strict";const s=r(841);let i=false;t.show=(e=process.stderr)=>{if(!e.isTTY){return}i=false;e.write("[?25h")};t.hide=(e=process.stderr)=>{if(!e.isTTY){return}s();i=true;e.write("[?25l")};t.toggle=(e,r)=>{if(e!==undefined){i=e}if(i){t.show(r)}else{t.hide(r)}}},419:(e,t,r)=>{"use strict";const s=Object.assign({},r(374));e.exports=s;e.exports["default"]=s},244:(e,t,r)=>{"use strict";const s=r(521);const i=r(542);const n=r(938);const o=r(419);const a=r(203);const _=r(518);const l=r(205);const f=r(890);const u=r(471);const p=Symbol("text");const h=Symbol("prefixText");const d=3;class StdinDiscarder{constructor(){this.requests=0;this.mutedStream=new u;this.mutedStream.pipe(process.stdout);this.mutedStream.mute();const e=this;this.ourEmit=function(t,r,...s){const{stdin:i}=process;if(e.requests>0||i.emit===e.ourEmit){if(t==="keypress"){return}if(t==="data"&&r.includes(d)){process.emit("SIGINT")}Reflect.apply(e.oldEmit,this,[t,r,...s])}else{Reflect.apply(process.stdin.emit,this,[t,r,...s])}}}start(){this.requests++;if(this.requests===1){this.realStart()}}stop(){if(this.requests<=0){throw new Error("`stop` called more times than `start`")}this.requests--;if(this.requests===0){this.realStop()}}realStart(){if(process.platform==="win32"){return}this.rl=s.createInterface({input:process.stdin,output:this.mutedStream});this.rl.on("SIGINT",(()=>{if(process.listenerCount("SIGINT")===0){process.emit("SIGINT")}else{this.rl.close();process.kill(process.pid,"SIGINT")}}))}realStop(){if(process.platform==="win32"){return}this.rl.close();this.rl=undefined}}const m=new StdinDiscarder;class Ora{constructor(e){if(typeof e==="string"){e={text:e}}this.options={text:"",color:"cyan",stream:process.stderr,discardStdin:true,...e};this.spinner=this.options.spinner;this.color=this.options.color;this.hideCursor=this.options.hideCursor!==false;this.interval=this.options.interval||this.spinner.interval||100;this.stream=this.options.stream;this.id=undefined;this.isEnabled=typeof this.options.isEnabled==="boolean"?this.options.isEnabled:f({stream:this.stream});this.text=this.options.text;this.prefixText=this.options.prefixText;this.linesToClear=0;this.indent=this.options.indent;this.discardStdin=this.options.discardStdin;this.isDiscardingStdin=false}get indent(){return this._indent}set indent(e=0){if(!(e>=0&&Number.isInteger(e))){throw new Error("The `indent` option must be an integer from 0 and up")}this._indent=e}_updateInterval(e){if(e!==undefined){this.interval=e}}get spinner(){return this._spinner}set spinner(e){this.frameIndex=0;if(typeof e==="object"){if(e.frames===undefined){throw new Error("The given spinner must have a `frames` property")}this._spinner=e}else if(process.platform==="win32"){this._spinner=o.line}else if(e===undefined){this._spinner=o.dots}else if(o[e]){this._spinner=o[e]}else{throw new Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/master/spinners.json for a full list.`)}this._updateInterval(this._spinner.interval)}get text(){return this[p]}get prefixText(){return this[h]}get isSpinning(){return this.id!==undefined}updateLineCount(){const e=this.stream.columns||80;const t=typeof this[h]==="string"?this[h]+"-":"";this.lineCount=_(t+"--"+this[p]).split("\n").reduce(((t,r)=>t+Math.max(1,Math.ceil(l(r)/e))),0)}set text(e){this[p]=e;this.updateLineCount()}set prefixText(e){this[h]=e;this.updateLineCount()}frame(){const{frames:e}=this.spinner;let t=e[this.frameIndex];if(this.color){t=i[this.color](t)}this.frameIndex=++this.frameIndex%e.length;const r=typeof this.prefixText==="string"&&this.prefixText!==""?this.prefixText+" ":"";const s=typeof this.text==="string"?" "+this.text:"";return r+t+s}clear(){if(!this.isEnabled||!this.stream.isTTY){return this}for(let e=0;e0){this.stream.moveCursor(0,-1)}this.stream.clearLine();this.stream.cursorTo(this.indent)}this.linesToClear=0;return this}render(){this.clear();this.stream.write(this.frame());this.linesToClear=this.lineCount;return this}start(e){if(e){this.text=e}if(!this.isEnabled){if(this.text){this.stream.write(`- ${this.text}\n`)}return this}if(this.isSpinning){return this}if(this.hideCursor){n.hide(this.stream)}if(this.discardStdin&&process.stdin.isTTY){this.isDiscardingStdin=true;m.start()}this.render();this.id=setInterval(this.render.bind(this),this.interval);return this}stop(){if(!this.isEnabled){return this}clearInterval(this.id);this.id=undefined;this.frameIndex=0;this.clear();if(this.hideCursor){n.show(this.stream)}if(this.discardStdin&&process.stdin.isTTY&&this.isDiscardingStdin){m.stop();this.isDiscardingStdin=false}return this}succeed(e){return this.stopAndPersist({symbol:a.success,text:e})}fail(e){return this.stopAndPersist({symbol:a.error,text:e})}warn(e){return this.stopAndPersist({symbol:a.warning,text:e})}info(e){return this.stopAndPersist({symbol:a.info,text:e})}stopAndPersist(e={}){const t=e.prefixText||this.prefixText;const r=typeof t==="string"&&t!==""?t+" ":"";const s=e.text||this.text;const i=typeof s==="string"?" "+s:"";this.stop();this.stream.write(`${r}${e.symbol||" "}${i}\n`);return this}}const oraFactory=function(e){return new Ora(e)};e.exports=oraFactory;e.exports.promise=(e,t)=>{if(typeof e.then!=="function"){throw new TypeError("Parameter `action` must be a Promise")}const r=new Ora(t);r.start();(async()=>{try{await e;r.succeed()}catch(e){r.fail()}})();return r}},841:(e,t,r)=>{"use strict";const s=r(462);const i=r(28);e.exports=s((()=>{i((()=>{process.stderr.write("[?25h")}),{alwaysLast:true})}))},491:e=>{"use strict";e.exports=require("assert")},361:e=>{"use strict";e.exports=require("events")},542:e=>{"use strict";e.exports=require("next/dist/compiled/chalk")},518:e=>{"use strict";e.exports=require("next/dist/compiled/strip-ansi")},521:e=>{"use strict";e.exports=require("readline")},781:e=>{"use strict";e.exports=require("stream")},374:e=>{"use strict";e.exports=JSON.parse('{"dots":{"interval":80,"frames":["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"]},"dots2":{"interval":80,"frames":["⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"]},"dots3":{"interval":80,"frames":["⠋","⠙","⠚","⠞","⠖","⠦","⠴","⠲","⠳","⠓"]},"dots4":{"interval":80,"frames":["⠄","⠆","⠇","⠋","⠙","⠸","⠰","⠠","⠰","⠸","⠙","⠋","⠇","⠆"]},"dots5":{"interval":80,"frames":["⠋","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋"]},"dots6":{"interval":80,"frames":["⠁","⠉","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠤","⠄","⠄","⠤","⠴","⠲","⠒","⠂","⠂","⠒","⠚","⠙","⠉","⠁"]},"dots7":{"interval":80,"frames":["⠈","⠉","⠋","⠓","⠒","⠐","⠐","⠒","⠖","⠦","⠤","⠠","⠠","⠤","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋","⠉","⠈"]},"dots8":{"interval":80,"frames":["⠁","⠁","⠉","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠤","⠄","⠄","⠤","⠠","⠠","⠤","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋","⠉","⠈","⠈"]},"dots9":{"interval":80,"frames":["⢹","⢺","⢼","⣸","⣇","⡧","⡗","⡏"]},"dots10":{"interval":80,"frames":["⢄","⢂","⢁","⡁","⡈","⡐","⡠"]},"dots11":{"interval":100,"frames":["⠁","⠂","⠄","⡀","⢀","⠠","⠐","⠈"]},"dots12":{"interval":80,"frames":["⢀⠀","⡀⠀","⠄⠀","⢂⠀","⡂⠀","⠅⠀","⢃⠀","⡃⠀","⠍⠀","⢋⠀","⡋⠀","⠍⠁","⢋⠁","⡋⠁","⠍⠉","⠋⠉","⠋⠉","⠉⠙","⠉⠙","⠉⠩","⠈⢙","⠈⡙","⢈⠩","⡀⢙","⠄⡙","⢂⠩","⡂⢘","⠅⡘","⢃⠨","⡃⢐","⠍⡐","⢋⠠","⡋⢀","⠍⡁","⢋⠁","⡋⠁","⠍⠉","⠋⠉","⠋⠉","⠉⠙","⠉⠙","⠉⠩","⠈⢙","⠈⡙","⠈⠩","⠀⢙","⠀⡙","⠀⠩","⠀⢘","⠀⡘","⠀⠨","⠀⢐","⠀⡐","⠀⠠","⠀⢀","⠀⡀"]},"dots8Bit":{"interval":80,"frames":["⠀","⠁","⠂","⠃","⠄","⠅","⠆","⠇","⡀","⡁","⡂","⡃","⡄","⡅","⡆","⡇","⠈","⠉","⠊","⠋","⠌","⠍","⠎","⠏","⡈","⡉","⡊","⡋","⡌","⡍","⡎","⡏","⠐","⠑","⠒","⠓","⠔","⠕","⠖","⠗","⡐","⡑","⡒","⡓","⡔","⡕","⡖","⡗","⠘","⠙","⠚","⠛","⠜","⠝","⠞","⠟","⡘","⡙","⡚","⡛","⡜","⡝","⡞","⡟","⠠","⠡","⠢","⠣","⠤","⠥","⠦","⠧","⡠","⡡","⡢","⡣","⡤","⡥","⡦","⡧","⠨","⠩","⠪","⠫","⠬","⠭","⠮","⠯","⡨","⡩","⡪","⡫","⡬","⡭","⡮","⡯","⠰","⠱","⠲","⠳","⠴","⠵","⠶","⠷","⡰","⡱","⡲","⡳","⡴","⡵","⡶","⡷","⠸","⠹","⠺","⠻","⠼","⠽","⠾","⠿","⡸","⡹","⡺","⡻","⡼","⡽","⡾","⡿","⢀","⢁","⢂","⢃","⢄","⢅","⢆","⢇","⣀","⣁","⣂","⣃","⣄","⣅","⣆","⣇","⢈","⢉","⢊","⢋","⢌","⢍","⢎","⢏","⣈","⣉","⣊","⣋","⣌","⣍","⣎","⣏","⢐","⢑","⢒","⢓","⢔","⢕","⢖","⢗","⣐","⣑","⣒","⣓","⣔","⣕","⣖","⣗","⢘","⢙","⢚","⢛","⢜","⢝","⢞","⢟","⣘","⣙","⣚","⣛","⣜","⣝","⣞","⣟","⢠","⢡","⢢","⢣","⢤","⢥","⢦","⢧","⣠","⣡","⣢","⣣","⣤","⣥","⣦","⣧","⢨","⢩","⢪","⢫","⢬","⢭","⢮","⢯","⣨","⣩","⣪","⣫","⣬","⣭","⣮","⣯","⢰","⢱","⢲","⢳","⢴","⢵","⢶","⢷","⣰","⣱","⣲","⣳","⣴","⣵","⣶","⣷","⢸","⢹","⢺","⢻","⢼","⢽","⢾","⢿","⣸","⣹","⣺","⣻","⣼","⣽","⣾","⣿"]},"line":{"interval":130,"frames":["-","\\\\","|","/"]},"line2":{"interval":100,"frames":["⠂","-","–","—","–","-"]},"pipe":{"interval":100,"frames":["┤","┘","┴","└","├","┌","┬","┐"]},"simpleDots":{"interval":400,"frames":[". ",".. ","..."," "]},"simpleDotsScrolling":{"interval":200,"frames":[". ",".. ","..."," .."," ."," "]},"star":{"interval":70,"frames":["✶","✸","✹","✺","✹","✷"]},"star2":{"interval":80,"frames":["+","x","*"]},"flip":{"interval":70,"frames":["_","_","_","-","`","`","\'","´","-","_","_","_"]},"hamburger":{"interval":100,"frames":["☱","☲","☴"]},"growVertical":{"interval":120,"frames":["▁","▃","▄","▅","▆","▇","▆","▅","▄","▃"]},"growHorizontal":{"interval":120,"frames":["▏","▎","▍","▌","▋","▊","▉","▊","▋","▌","▍","▎"]},"balloon":{"interval":140,"frames":[" ",".","o","O","@","*"," "]},"balloon2":{"interval":120,"frames":[".","o","O","°","O","o","."]},"noise":{"interval":100,"frames":["▓","▒","░"]},"bounce":{"interval":120,"frames":["⠁","⠂","⠄","⠂"]},"boxBounce":{"interval":120,"frames":["▖","▘","▝","▗"]},"boxBounce2":{"interval":100,"frames":["▌","▀","▐","▄"]},"triangle":{"interval":50,"frames":["◢","◣","◤","◥"]},"arc":{"interval":100,"frames":["◜","◠","◝","◞","◡","◟"]},"circle":{"interval":120,"frames":["◡","⊙","◠"]},"squareCorners":{"interval":180,"frames":["◰","◳","◲","◱"]},"circleQuarters":{"interval":120,"frames":["◴","◷","◶","◵"]},"circleHalves":{"interval":50,"frames":["◐","◓","◑","◒"]},"squish":{"interval":100,"frames":["╫","╪"]},"toggle":{"interval":250,"frames":["⊶","⊷"]},"toggle2":{"interval":80,"frames":["▫","▪"]},"toggle3":{"interval":120,"frames":["□","■"]},"toggle4":{"interval":100,"frames":["■","□","▪","▫"]},"toggle5":{"interval":100,"frames":["▮","▯"]},"toggle6":{"interval":300,"frames":["ဝ","၀"]},"toggle7":{"interval":80,"frames":["⦾","⦿"]},"toggle8":{"interval":100,"frames":["◍","◌"]},"toggle9":{"interval":100,"frames":["◉","◎"]},"toggle10":{"interval":100,"frames":["㊂","㊀","㊁"]},"toggle11":{"interval":50,"frames":["⧇","⧆"]},"toggle12":{"interval":120,"frames":["☗","☖"]},"toggle13":{"interval":80,"frames":["=","*","-"]},"arrow":{"interval":100,"frames":["←","↖","↑","↗","→","↘","↓","↙"]},"arrow2":{"interval":80,"frames":["⬆️ ","↗️ ","➡️ ","↘️ ","⬇️ ","↙️ ","⬅️ ","↖️ "]},"arrow3":{"interval":120,"frames":["▹▹▹▹▹","▸▹▹▹▹","▹▸▹▹▹","▹▹▸▹▹","▹▹▹▸▹","▹▹▹▹▸"]},"bouncingBar":{"interval":80,"frames":["[ ]","[= ]","[== ]","[=== ]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},"bouncingBall":{"interval":80,"frames":["( ● )","( ● )","( ● )","( ● )","( ●)","( ● )","( ● )","( ● )","( ● )","(● )"]},"smiley":{"interval":200,"frames":["😄 ","😝 "]},"monkey":{"interval":300,"frames":["🙈 ","🙈 ","🙉 ","🙊 "]},"hearts":{"interval":100,"frames":["💛 ","💙 ","💜 ","💚 ","❤️ "]},"clock":{"interval":100,"frames":["🕛 ","🕐 ","🕑 ","🕒 ","🕓 ","🕔 ","🕕 ","🕖 ","🕗 ","🕘 ","🕙 ","🕚 "]},"earth":{"interval":180,"frames":["🌍 ","🌎 ","🌏 "]},"moon":{"interval":80,"frames":["🌑 ","🌒 ","🌓 ","🌔 ","🌕 ","🌖 ","🌗 ","🌘 "]},"runner":{"interval":140,"frames":["🚶 ","🏃 "]},"pong":{"interval":80,"frames":["▐⠂ ▌","▐⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂▌","▐ ⠠▌","▐ ⡀▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐⠠ ▌"]},"shark":{"interval":120,"frames":["▐|\\\\____________▌","▐_|\\\\___________▌","▐__|\\\\__________▌","▐___|\\\\_________▌","▐____|\\\\________▌","▐_____|\\\\_______▌","▐______|\\\\______▌","▐_______|\\\\_____▌","▐________|\\\\____▌","▐_________|\\\\___▌","▐__________|\\\\__▌","▐___________|\\\\_▌","▐____________|\\\\▌","▐____________/|▌","▐___________/|_▌","▐__________/|__▌","▐_________/|___▌","▐________/|____▌","▐_______/|_____▌","▐______/|______▌","▐_____/|_______▌","▐____/|________▌","▐___/|_________▌","▐__/|__________▌","▐_/|___________▌","▐/|____________▌"]},"dqpb":{"interval":100,"frames":["d","q","p","b"]},"weather":{"interval":100,"frames":["☀️ ","☀️ ","☀️ ","🌤 ","⛅️ ","🌥 ","☁️ ","🌧 ","🌨 ","🌧 ","🌨 ","🌧 ","🌨 ","⛈ ","🌨 ","🌧 ","🌨 ","☁️ ","🌥 ","⛅️ ","🌤 ","☀️ ","☀️ "]},"christmas":{"interval":400,"frames":["🌲","🎄"]},"grenade":{"interval":80,"frames":["، ","′ "," ´ "," ‾ "," ⸌"," ⸊"," |"," ⁎"," ⁕"," ෴ "," ⁓"," "," "," "]},"point":{"interval":125,"frames":["∙∙∙","●∙∙","∙●∙","∙∙●","∙∙∙"]},"layer":{"interval":150,"frames":["-","=","≡"]},"betaWave":{"interval":80,"frames":["ρββββββ","βρβββββ","ββρββββ","βββρβββ","ββββρββ","βββββρβ","ββββββρ"]}}')}};var t={};function __nccwpck_require__(r){var s=t[r];if(s!==undefined){return s.exports}var i=t[r]={exports:{}};var n=true;try{e[r](i,i.exports,__nccwpck_require__);n=false}finally{if(n)delete t[r]}return i.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(244);module.exports=r})(); \ No newline at end of file +(()=>{var e={845:e=>{var t=function(){"use strict";function clone(e,t,r,s){var i;if(typeof t==="object"){r=t.depth;s=t.prototype;i=t.filter;t=t.circular}var n=[];var o=[];var a=typeof Buffer!="undefined";if(typeof t=="undefined")t=true;if(typeof r=="undefined")r=Infinity;function _clone(e,r){if(e===null)return null;if(r==0)return e;var i;var _;if(typeof e!="object"){return e}if(clone.__isArray(e)){i=[]}else if(clone.__isRegExp(e)){i=new RegExp(e.source,__getRegExpFlags(e));if(e.lastIndex)i.lastIndex=e.lastIndex}else if(clone.__isDate(e)){i=new Date(e.getTime())}else if(a&&Buffer.isBuffer(e)){if(Buffer.allocUnsafe){i=Buffer.allocUnsafe(e.length)}else{i=new Buffer(e.length)}e.copy(i);return i}else{if(typeof s=="undefined"){_=Object.getPrototypeOf(e);i=Object.create(_)}else{i=Object.create(s);_=s}}if(t){var l=n.indexOf(e);if(l!=-1){return o[l]}n.push(e);o.push(i)}for(var f in e){var u;if(_){u=Object.getOwnPropertyDescriptor(_,f)}if(u&&u.set==null){continue}i[f]=_clone(e[f],r-1)}return i}return _clone(e,r)}clone.clonePrototype=function clonePrototype(e){if(e===null)return null;var c=function(){};c.prototype=e;return new c};function __objToStr(e){return Object.prototype.toString.call(e)}clone.__objToStr=__objToStr;function __isDate(e){return typeof e==="object"&&__objToStr(e)==="[object Date]"}clone.__isDate=__isDate;function __isArray(e){return typeof e==="object"&&__objToStr(e)==="[object Array]"}clone.__isArray=__isArray;function __isRegExp(e){return typeof e==="object"&&__objToStr(e)==="[object RegExp]"}clone.__isRegExp=__isRegExp;function __getRegExpFlags(e){var t="";if(e.global)t+="g";if(e.ignoreCase)t+="i";if(e.multiline)t+="m";return t}clone.__getRegExpFlags=__getRegExpFlags;return clone}();if(true&&e.exports){e.exports=t}},420:(e,t,r)=>{var s=r(845);e.exports=function(e,t){e=e||{};Object.keys(t).forEach((function(r){if(typeof e[r]==="undefined"){e[r]=s(t[r])}}));return e}},890:e=>{"use strict";e.exports=({stream:e=process.stdout}={})=>Boolean(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))},203:(e,t,r)=>{"use strict";const s=r(542);const i=process.platform!=="win32"||process.env.CI||process.env.TERM==="xterm-256color";const n={info:s.blue("ℹ"),success:s.green("✔"),warning:s.yellow("⚠"),error:s.red("✖")};const o={info:s.blue("i"),success:s.green("√"),warning:s.yellow("‼"),error:s.red("×")};e.exports=i?n:o},481:e=>{"use strict";const mimicFn=(e,t)=>{for(const r of Reflect.ownKeys(t)){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}return e};e.exports=mimicFn;e.exports["default"]=mimicFn},471:(e,t,r)=>{var s=r(781);e.exports=MuteStream;function MuteStream(e){s.apply(this);e=e||{};this.writable=this.readable=true;this.muted=false;this.on("pipe",this._onpipe);this.replace=e.replace;this._prompt=e.prompt||null;this._hadControl=false}MuteStream.prototype=Object.create(s.prototype);Object.defineProperty(MuteStream.prototype,"constructor",{value:MuteStream,enumerable:false});MuteStream.prototype.mute=function(){this.muted=true};MuteStream.prototype.unmute=function(){this.muted=false};Object.defineProperty(MuteStream.prototype,"_onpipe",{value:onPipe,enumerable:false,writable:true,configurable:true});function onPipe(e){this._src=e}Object.defineProperty(MuteStream.prototype,"isTTY",{get:getIsTTY,set:setIsTTY,enumerable:true,configurable:true});function getIsTTY(){return this._dest?this._dest.isTTY:this._src?this._src.isTTY:false}function setIsTTY(e){Object.defineProperty(this,"isTTY",{value:e,enumerable:true,writable:true,configurable:true})}Object.defineProperty(MuteStream.prototype,"rows",{get:function(){return this._dest?this._dest.rows:this._src?this._src.rows:undefined},enumerable:true,configurable:true});Object.defineProperty(MuteStream.prototype,"columns",{get:function(){return this._dest?this._dest.columns:this._src?this._src.columns:undefined},enumerable:true,configurable:true});MuteStream.prototype.pipe=function(e,t){this._dest=e;return s.prototype.pipe.call(this,e,t)};MuteStream.prototype.pause=function(){if(this._src)return this._src.pause()};MuteStream.prototype.resume=function(){if(this._src)return this._src.resume()};MuteStream.prototype.write=function(e){if(this.muted){if(!this.replace)return true;if(e.match(/^\u001b/)){if(e.indexOf(this._prompt)===0){e=e.substr(this._prompt.length);e=e.replace(/./g,this.replace);e=this._prompt+e}this._hadControl=true;return this.emit("data",e)}else{if(this._prompt&&this._hadControl&&e.indexOf(this._prompt)===0){this._hadControl=false;this.emit("data",this._prompt);e=e.substr(this._prompt.length)}e=e.toString().replace(/./g,this.replace)}}this.emit("data",e)};MuteStream.prototype.end=function(e){if(this.muted){if(e&&this.replace){e=e.toString().replace(/./g,this.replace)}else{e=null}}if(e)this.emit("data",e);this.emit("end")};function proxy(e){return function(){var t=this._dest;var r=this._src;if(t&&t[e])t[e].apply(t,arguments);if(r&&r[e])r[e].apply(r,arguments)}}MuteStream.prototype.destroy=proxy("destroy");MuteStream.prototype.destroySoon=proxy("destroySoon");MuteStream.prototype.close=proxy("close")},462:(e,t,r)=>{"use strict";const s=r(481);const i=new WeakMap;const oneTime=(e,t={})=>{if(typeof e!=="function"){throw new TypeError("Expected a function")}let r;let n=false;let o=0;const a=e.displayName||e.name||"";const onetime=function(...s){i.set(onetime,++o);if(n){if(t.throw===true){throw new Error(`Function \`${a}\` can only be called once`)}return r}n=true;r=e.apply(this,s);e=null;return r};s(onetime,e);i.set(onetime,o);return onetime};e.exports=oneTime;e.exports["default"]=oneTime;e.exports.callCount=e=>{if(!i.has(e)){throw new Error(`The given function \`${e.name}\` is not wrapped by the \`onetime\` package`)}return i.get(e)}},28:(e,t,r)=>{var s=r(491);var i=r(19);var n=r(361);if(typeof n!=="function"){n=n.EventEmitter}var o;if(process.__signal_exit_emitter__){o=process.__signal_exit_emitter__}else{o=process.__signal_exit_emitter__=new n;o.count=0;o.emitted={}}if(!o.infinite){o.setMaxListeners(Infinity);o.infinite=true}e.exports=function(e,t){s.equal(typeof e,"function","a callback must be provided for exit handler");if(_===false){load()}var r="exit";if(t&&t.alwaysLast){r="afterexit"}var remove=function(){o.removeListener(r,e);if(o.listeners("exit").length===0&&o.listeners("afterexit").length===0){unload()}};o.on(r,e);return remove};e.exports.unload=unload;function unload(){if(!_){return}_=false;i.forEach((function(e){try{process.removeListener(e,a[e])}catch(e){}}));process.emit=f;process.reallyExit=l;o.count-=1}function emit(e,t,r){if(o.emitted[e]){return}o.emitted[e]=true;o.emit(e,t,r)}var a={};i.forEach((function(e){a[e]=function listener(){var t=process.listeners(e);if(t.length===o.count){unload();emit("exit",null,e);emit("afterexit",null,e);process.kill(process.pid,e)}}}));e.exports.signals=function(){return i};e.exports.load=load;var _=false;function load(){if(_){return}_=true;o.count+=1;i=i.filter((function(e){try{process.on(e,a[e]);return true}catch(e){return false}}));process.emit=processEmit;process.reallyExit=processReallyExit}var l=process.reallyExit;function processReallyExit(e){process.exitCode=e||0;emit("exit",process.exitCode,null);emit("afterexit",process.exitCode,null);l.call(process,process.exitCode)}var f=process.emit;function processEmit(e,t){if(e==="exit"){if(t!==undefined){process.exitCode=t}var r=f.apply(this,arguments);emit("exit",process.exitCode,null);emit("afterexit",process.exitCode,null);return r}else{return f.apply(this,arguments)}}},19:e=>{e.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32"){e.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT")}if(process.platform==="linux"){e.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")}},523:e=>{e.exports=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531],[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]]},205:(e,t,r)=>{"use strict";var s=r(420);var i=r(523);var n={nul:0,control:0};e.exports=function wcwidth(e){return wcswidth(e,n)};e.exports.config=function(e){e=s(e||{},n);return function wcwidth(t){return wcswidth(t,e)}};function wcswidth(e,t){if(typeof e!=="string")return wcwidth(e,t);var r=0;for(var s=0;s=127&&e<160)return t.control;if(bisearch(e))return 0;return 1+(e>=4352&&(e<=4447||e==9001||e==9002||e>=11904&&e<=42191&&e!=12351||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65135||e>=65280&&e<=65376||e>=65504&&e<=65510||e>=131072&&e<=196605||e>=196608&&e<=262141))}function bisearch(e){var t=0;var r=i.length-1;var s;if(ei[r][1])return false;while(r>=t){s=Math.floor((t+r)/2);if(e>i[s][1])t=s+1;else if(e{"use strict";const s=r(841);let i=false;t.show=(e=process.stderr)=>{if(!e.isTTY){return}i=false;e.write("[?25h")};t.hide=(e=process.stderr)=>{if(!e.isTTY){return}s();i=true;e.write("[?25l")};t.toggle=(e,r)=>{if(e!==undefined){i=e}if(i){t.show(r)}else{t.hide(r)}}},419:(e,t,r)=>{"use strict";const s=Object.assign({},r(374));e.exports=s;e.exports["default"]=s},244:(e,t,r)=>{"use strict";const s=r(521);const i=r(542);const n=r(938);const o=r(419);const a=r(203);const _=r(518);const l=r(205);const f=r(890);const u=r(471);const p=Symbol("text");const h=Symbol("prefixText");const d=3;class StdinDiscarder{constructor(){this.requests=0;this.mutedStream=new u;this.mutedStream.pipe(process.stdout);this.mutedStream.mute();const e=this;this.ourEmit=function(t,r,...s){const{stdin:i}=process;if(e.requests>0||i.emit===e.ourEmit){if(t==="keypress"){return}if(t==="data"&&r.includes(d)){process.emit("SIGINT")}Reflect.apply(e.oldEmit,this,[t,r,...s])}else{Reflect.apply(process.stdin.emit,this,[t,r,...s])}}}start(){this.requests++;if(this.requests===1){this.realStart()}}stop(){if(this.requests<=0){throw new Error("`stop` called more times than `start`")}this.requests--;if(this.requests===0){this.realStop()}}realStart(){if(process.platform==="win32"){return}this.rl=s.createInterface({input:process.stdin,output:this.mutedStream});this.rl.on("SIGINT",(()=>{if(process.listenerCount("SIGINT")===0){process.emit("SIGINT")}else{this.rl.close();process.kill(process.pid,"SIGINT")}}))}realStop(){if(process.platform==="win32"){return}this.rl.close();this.rl=undefined}}const m=new StdinDiscarder;class Ora{constructor(e){if(typeof e==="string"){e={text:e}}this.options={text:"",color:"cyan",stream:process.stderr,discardStdin:true,...e};this.spinner=this.options.spinner;this.color=this.options.color;this.hideCursor=this.options.hideCursor!==false;this.interval=this.options.interval||this.spinner.interval||100;this.stream=this.options.stream;this.id=undefined;this.isEnabled=typeof this.options.isEnabled==="boolean"?this.options.isEnabled:f({stream:this.stream});this.text=this.options.text;this.prefixText=this.options.prefixText;this.linesToClear=0;this.indent=this.options.indent;this.discardStdin=this.options.discardStdin;this.isDiscardingStdin=false}get indent(){return this._indent}set indent(e=0){if(!(e>=0&&Number.isInteger(e))){throw new Error("The `indent` option must be an integer from 0 and up")}this._indent=e}_updateInterval(e){if(e!==undefined){this.interval=e}}get spinner(){return this._spinner}set spinner(e){this.frameIndex=0;if(typeof e==="object"){if(e.frames===undefined){throw new Error("The given spinner must have a `frames` property")}this._spinner=e}else if(process.platform==="win32"){this._spinner=o.line}else if(e===undefined){this._spinner=o.dots}else if(o[e]){this._spinner=o[e]}else{throw new Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/master/spinners.json for a full list.`)}this._updateInterval(this._spinner.interval)}get text(){return this[p]}get prefixText(){return this[h]}get isSpinning(){return this.id!==undefined}updateLineCount(){const e=this.stream.columns||80;const t=typeof this[h]==="string"?this[h]+"-":"";this.lineCount=_(t+"--"+this[p]).split("\n").reduce(((t,r)=>t+Math.max(1,Math.ceil(l(r)/e))),0)}set text(e){this[p]=e;this.updateLineCount()}set prefixText(e){this[h]=e;this.updateLineCount()}frame(){const{frames:e}=this.spinner;let t=e[this.frameIndex];if(this.color){t=i[this.color](t)}this.frameIndex=++this.frameIndex%e.length;const r=typeof this.prefixText==="string"&&this.prefixText!==""?this.prefixText+" ":"";const s=typeof this.text==="string"?" "+this.text:"";return r+t+s}clear(){if(!this.isEnabled||!this.stream.isTTY){return this}for(let e=0;e0){this.stream.moveCursor(0,-1)}this.stream.clearLine();this.stream.cursorTo(this.indent)}this.linesToClear=0;return this}render(){this.clear();this.stream.write(this.frame());this.linesToClear=this.lineCount;return this}start(e){if(e){this.text=e}if(!this.isEnabled){if(this.text){this.stream.write(`- ${this.text}\n`)}return this}if(this.isSpinning){return this}if(this.hideCursor){n.hide(this.stream)}if(this.discardStdin&&process.stdin.isTTY){this.isDiscardingStdin=true;m.start()}this.render();this.id=setInterval(this.render.bind(this),this.interval);return this}stop(){if(!this.isEnabled){return this}clearInterval(this.id);this.id=undefined;this.frameIndex=0;this.clear();if(this.hideCursor){n.show(this.stream)}if(this.discardStdin&&process.stdin.isTTY&&this.isDiscardingStdin){m.stop();this.isDiscardingStdin=false}return this}succeed(e){return this.stopAndPersist({symbol:a.success,text:e})}fail(e){return this.stopAndPersist({symbol:a.error,text:e})}warn(e){return this.stopAndPersist({symbol:a.warning,text:e})}info(e){return this.stopAndPersist({symbol:a.info,text:e})}stopAndPersist(e={}){const t=e.prefixText||this.prefixText;const r=typeof t==="string"&&t!==""?t+" ":"";const s=e.text||this.text;const i=typeof s==="string"?" "+s:"";this.stop();this.stream.write(`${r}${e.symbol||" "}${i}\n`);return this}}const oraFactory=function(e){return new Ora(e)};e.exports=oraFactory;e.exports.promise=(e,t)=>{if(typeof e.then!=="function"){throw new TypeError("Parameter `action` must be a Promise")}const r=new Ora(t);r.start();(async()=>{try{await e;r.succeed()}catch(e){r.fail()}})();return r}},841:(e,t,r)=>{"use strict";const s=r(462);const i=r(28);e.exports=s((()=>{i((()=>{process.stderr.write("[?25h")}),{alwaysLast:true})}))},491:e=>{"use strict";e.exports=require("assert")},361:e=>{"use strict";e.exports=require("events")},542:e=>{"use strict";e.exports=require("next/dist/compiled/chalk")},518:e=>{"use strict";e.exports=require("next/dist/compiled/strip-ansi")},521:e=>{"use strict";e.exports=require("readline")},781:e=>{"use strict";e.exports=require("stream")},374:e=>{"use strict";e.exports=JSON.parse('{"dots":{"interval":80,"frames":["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"]},"dots2":{"interval":80,"frames":["⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"]},"dots3":{"interval":80,"frames":["⠋","⠙","⠚","⠞","⠖","⠦","⠴","⠲","⠳","⠓"]},"dots4":{"interval":80,"frames":["⠄","⠆","⠇","⠋","⠙","⠸","⠰","⠠","⠰","⠸","⠙","⠋","⠇","⠆"]},"dots5":{"interval":80,"frames":["⠋","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋"]},"dots6":{"interval":80,"frames":["⠁","⠉","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠤","⠄","⠄","⠤","⠴","⠲","⠒","⠂","⠂","⠒","⠚","⠙","⠉","⠁"]},"dots7":{"interval":80,"frames":["⠈","⠉","⠋","⠓","⠒","⠐","⠐","⠒","⠖","⠦","⠤","⠠","⠠","⠤","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋","⠉","⠈"]},"dots8":{"interval":80,"frames":["⠁","⠁","⠉","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠤","⠄","⠄","⠤","⠠","⠠","⠤","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋","⠉","⠈","⠈"]},"dots9":{"interval":80,"frames":["⢹","⢺","⢼","⣸","⣇","⡧","⡗","⡏"]},"dots10":{"interval":80,"frames":["⢄","⢂","⢁","⡁","⡈","⡐","⡠"]},"dots11":{"interval":100,"frames":["⠁","⠂","⠄","⡀","⢀","⠠","⠐","⠈"]},"dots12":{"interval":80,"frames":["⢀⠀","⡀⠀","⠄⠀","⢂⠀","⡂⠀","⠅⠀","⢃⠀","⡃⠀","⠍⠀","⢋⠀","⡋⠀","⠍⠁","⢋⠁","⡋⠁","⠍⠉","⠋⠉","⠋⠉","⠉⠙","⠉⠙","⠉⠩","⠈⢙","⠈⡙","⢈⠩","⡀⢙","⠄⡙","⢂⠩","⡂⢘","⠅⡘","⢃⠨","⡃⢐","⠍⡐","⢋⠠","⡋⢀","⠍⡁","⢋⠁","⡋⠁","⠍⠉","⠋⠉","⠋⠉","⠉⠙","⠉⠙","⠉⠩","⠈⢙","⠈⡙","⠈⠩","⠀⢙","⠀⡙","⠀⠩","⠀⢘","⠀⡘","⠀⠨","⠀⢐","⠀⡐","⠀⠠","⠀⢀","⠀⡀"]},"dots8Bit":{"interval":80,"frames":["⠀","⠁","⠂","⠃","⠄","⠅","⠆","⠇","⡀","⡁","⡂","⡃","⡄","⡅","⡆","⡇","⠈","⠉","⠊","⠋","⠌","⠍","⠎","⠏","⡈","⡉","⡊","⡋","⡌","⡍","⡎","⡏","⠐","⠑","⠒","⠓","⠔","⠕","⠖","⠗","⡐","⡑","⡒","⡓","⡔","⡕","⡖","⡗","⠘","⠙","⠚","⠛","⠜","⠝","⠞","⠟","⡘","⡙","⡚","⡛","⡜","⡝","⡞","⡟","⠠","⠡","⠢","⠣","⠤","⠥","⠦","⠧","⡠","⡡","⡢","⡣","⡤","⡥","⡦","⡧","⠨","⠩","⠪","⠫","⠬","⠭","⠮","⠯","⡨","⡩","⡪","⡫","⡬","⡭","⡮","⡯","⠰","⠱","⠲","⠳","⠴","⠵","⠶","⠷","⡰","⡱","⡲","⡳","⡴","⡵","⡶","⡷","⠸","⠹","⠺","⠻","⠼","⠽","⠾","⠿","⡸","⡹","⡺","⡻","⡼","⡽","⡾","⡿","⢀","⢁","⢂","⢃","⢄","⢅","⢆","⢇","⣀","⣁","⣂","⣃","⣄","⣅","⣆","⣇","⢈","⢉","⢊","⢋","⢌","⢍","⢎","⢏","⣈","⣉","⣊","⣋","⣌","⣍","⣎","⣏","⢐","⢑","⢒","⢓","⢔","⢕","⢖","⢗","⣐","⣑","⣒","⣓","⣔","⣕","⣖","⣗","⢘","⢙","⢚","⢛","⢜","⢝","⢞","⢟","⣘","⣙","⣚","⣛","⣜","⣝","⣞","⣟","⢠","⢡","⢢","⢣","⢤","⢥","⢦","⢧","⣠","⣡","⣢","⣣","⣤","⣥","⣦","⣧","⢨","⢩","⢪","⢫","⢬","⢭","⢮","⢯","⣨","⣩","⣪","⣫","⣬","⣭","⣮","⣯","⢰","⢱","⢲","⢳","⢴","⢵","⢶","⢷","⣰","⣱","⣲","⣳","⣴","⣵","⣶","⣷","⢸","⢹","⢺","⢻","⢼","⢽","⢾","⢿","⣸","⣹","⣺","⣻","⣼","⣽","⣾","⣿"]},"line":{"interval":130,"frames":["-","\\\\","|","/"]},"line2":{"interval":100,"frames":["⠂","-","–","—","–","-"]},"pipe":{"interval":100,"frames":["┤","┘","┴","└","├","┌","┬","┐"]},"simpleDots":{"interval":400,"frames":[". ",".. ","..."," "]},"simpleDotsScrolling":{"interval":200,"frames":[". ",".. ","..."," .."," ."," "]},"star":{"interval":70,"frames":["✶","✸","✹","✺","✹","✷"]},"star2":{"interval":80,"frames":["+","x","*"]},"flip":{"interval":70,"frames":["_","_","_","-","`","`","\'","´","-","_","_","_"]},"hamburger":{"interval":100,"frames":["☱","☲","☴"]},"growVertical":{"interval":120,"frames":["▁","▃","▄","▅","▆","▇","▆","▅","▄","▃"]},"growHorizontal":{"interval":120,"frames":["▏","▎","▍","▌","▋","▊","▉","▊","▋","▌","▍","▎"]},"balloon":{"interval":140,"frames":[" ",".","o","O","@","*"," "]},"balloon2":{"interval":120,"frames":[".","o","O","°","O","o","."]},"noise":{"interval":100,"frames":["▓","▒","░"]},"bounce":{"interval":120,"frames":["⠁","⠂","⠄","⠂"]},"boxBounce":{"interval":120,"frames":["▖","▘","▝","▗"]},"boxBounce2":{"interval":100,"frames":["▌","▀","▐","▄"]},"triangle":{"interval":50,"frames":["◢","◣","◤","◥"]},"arc":{"interval":100,"frames":["◜","◠","◝","◞","◡","◟"]},"circle":{"interval":120,"frames":["◡","⊙","◠"]},"squareCorners":{"interval":180,"frames":["◰","◳","◲","◱"]},"circleQuarters":{"interval":120,"frames":["◴","◷","◶","◵"]},"circleHalves":{"interval":50,"frames":["◐","◓","◑","◒"]},"squish":{"interval":100,"frames":["╫","╪"]},"toggle":{"interval":250,"frames":["⊶","⊷"]},"toggle2":{"interval":80,"frames":["▫","▪"]},"toggle3":{"interval":120,"frames":["□","■"]},"toggle4":{"interval":100,"frames":["■","□","▪","▫"]},"toggle5":{"interval":100,"frames":["▮","▯"]},"toggle6":{"interval":300,"frames":["ဝ","၀"]},"toggle7":{"interval":80,"frames":["⦾","⦿"]},"toggle8":{"interval":100,"frames":["◍","◌"]},"toggle9":{"interval":100,"frames":["◉","◎"]},"toggle10":{"interval":100,"frames":["㊂","㊀","㊁"]},"toggle11":{"interval":50,"frames":["⧇","⧆"]},"toggle12":{"interval":120,"frames":["☗","☖"]},"toggle13":{"interval":80,"frames":["=","*","-"]},"arrow":{"interval":100,"frames":["←","↖","↑","↗","→","↘","↓","↙"]},"arrow2":{"interval":80,"frames":["⬆️ ","↗️ ","➡️ ","↘️ ","⬇️ ","↙️ ","⬅️ ","↖️ "]},"arrow3":{"interval":120,"frames":["▹▹▹▹▹","▸▹▹▹▹","▹▸▹▹▹","▹▹▸▹▹","▹▹▹▸▹","▹▹▹▹▸"]},"bouncingBar":{"interval":80,"frames":["[ ]","[= ]","[== ]","[=== ]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},"bouncingBall":{"interval":80,"frames":["( ● )","( ● )","( ● )","( ● )","( ●)","( ● )","( ● )","( ● )","( ● )","(● )"]},"smiley":{"interval":200,"frames":["😄 ","😝 "]},"monkey":{"interval":300,"frames":["🙈 ","🙈 ","🙉 ","🙊 "]},"hearts":{"interval":100,"frames":["💛 ","💙 ","💜 ","💚 ","❤️ "]},"clock":{"interval":100,"frames":["🕛 ","🕐 ","🕑 ","🕒 ","🕓 ","🕔 ","🕕 ","🕖 ","🕗 ","🕘 ","🕙 ","🕚 "]},"earth":{"interval":180,"frames":["🌍 ","🌎 ","🌏 "]},"moon":{"interval":80,"frames":["🌑 ","🌒 ","🌓 ","🌔 ","🌕 ","🌖 ","🌗 ","🌘 "]},"runner":{"interval":140,"frames":["🚶 ","🏃 "]},"pong":{"interval":80,"frames":["▐⠂ ▌","▐⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂▌","▐ ⠠▌","▐ ⡀▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐ ⠠ ▌","▐ ⠂ ▌","▐ ⠈ ▌","▐ ⠂ ▌","▐ ⠠ ▌","▐ ⡀ ▌","▐⠠ ▌"]},"shark":{"interval":120,"frames":["▐|\\\\____________▌","▐_|\\\\___________▌","▐__|\\\\__________▌","▐___|\\\\_________▌","▐____|\\\\________▌","▐_____|\\\\_______▌","▐______|\\\\______▌","▐_______|\\\\_____▌","▐________|\\\\____▌","▐_________|\\\\___▌","▐__________|\\\\__▌","▐___________|\\\\_▌","▐____________|\\\\▌","▐____________/|▌","▐___________/|_▌","▐__________/|__▌","▐_________/|___▌","▐________/|____▌","▐_______/|_____▌","▐______/|______▌","▐_____/|_______▌","▐____/|________▌","▐___/|_________▌","▐__/|__________▌","▐_/|___________▌","▐/|____________▌"]},"dqpb":{"interval":100,"frames":["d","q","p","b"]},"weather":{"interval":100,"frames":["☀️ ","☀️ ","☀️ ","🌤 ","⛅️ ","🌥 ","☁️ ","🌧 ","🌨 ","🌧 ","🌨 ","🌧 ","🌨 ","⛈ ","🌨 ","🌧 ","🌨 ","☁️ ","🌥 ","⛅️ ","🌤 ","☀️ ","☀️ "]},"christmas":{"interval":400,"frames":["🌲","🎄"]},"grenade":{"interval":80,"frames":["، ","′ "," ´ "," ‾ "," ⸌"," ⸊"," |"," ⁎"," ⁕"," ෴ "," ⁓"," "," "," "]},"point":{"interval":125,"frames":["∙∙∙","●∙∙","∙●∙","∙∙●","∙∙∙"]},"layer":{"interval":150,"frames":["-","=","≡"]},"betaWave":{"interval":80,"frames":["ρββββββ","βρβββββ","ββρββββ","βββρβββ","ββββρββ","βββββρβ","ββββββρ"]}}')}};var t={};function __nccwpck_require__(r){var s=t[r];if(s!==undefined){return s.exports}var i=t[r]={exports:{}};var n=true;try{e[r](i,i.exports,__nccwpck_require__);n=false}finally{if(n)delete t[r]}return i.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(244);module.exports=r})(); \ No newline at end of file diff --git a/packages/next/compiled/punycode/package.json b/packages/next/compiled/punycode/package.json new file mode 100644 index 0000000000000..cf52cbab85fed --- /dev/null +++ b/packages/next/compiled/punycode/package.json @@ -0,0 +1 @@ +{"name":"punycode","main":"punycode.js","author":{"name":"Mathias Bynens","url":"https://mathiasbynens.be/"},"license":"MIT"} diff --git a/packages/next/compiled/punycode/punycode.js b/packages/next/compiled/punycode/punycode.js new file mode 100644 index 0000000000000..ae4e2f0f0b46a --- /dev/null +++ b/packages/next/compiled/punycode/punycode.js @@ -0,0 +1 @@ +(function(){"use strict";var t={701:function(t){const e=2147483647;const o=36;const n=1;const r=26;const c=38;const s=700;const i=72;const f=128;const u="-";const l=/^xn--/;const a=/[^\0-\x7E]/;const p=/[\x2E\u3002\uFF0E\uFF61]/g;const d={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"};const _=o-n;const h=Math.floor;const w=String.fromCharCode;function error(t){throw new RangeError(d[t])}function map(t,e){const o=[];let n=t.length;while(n--){o[n]=e(t[n])}return o}function mapDomain(t,e){const o=t.split("@");let n="";if(o.length>1){n=o[0]+"@";t=o[1]}t=t.replace(p,".");const r=t.split(".");const c=map(r,e).join(".");return n+c}function ucs2decode(t){const e=[];let o=0;const n=t.length;while(o=55296&&r<=56319&&oString.fromCodePoint(...t);const basicToDigit=function(t){if(t-48<10){return t-22}if(t-65<26){return t-65}if(t-97<26){return t-97}return o};const digitToBasic=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)};const adapt=function(t,e,n){let i=0;t=n?h(t/s):t>>1;t+=h(t/e);for(;t>_*r>>1;i+=o){t=h(t/_)}return h(i+(_+1)*t/(t+c))};const decode=function(t){const c=[];const s=t.length;let l=0;let a=f;let p=i;let d=t.lastIndexOf(u);if(d<0){d=0}for(let e=0;e=128){error("not-basic")}c.push(t.charCodeAt(e))}for(let i=d>0?d+1:0;i=s){error("invalid-input")}const u=basicToDigit(t.charCodeAt(i++));if(u>=o||u>h((e-l)/c)){error("overflow")}l+=u*c;const a=f<=p?n:f>=p+r?r:f-p;if(uh(e/d)){error("overflow")}c*=d}const u=c.length+1;p=adapt(l-f,u,f==0);if(h(l/u)>e-a){error("overflow")}a+=h(l/u);l%=u;c.splice(l++,0,a)}return String.fromCodePoint(...c)};const encode=function(t){const c=[];t=ucs2decode(t);let s=t.length;let l=f;let a=0;let p=i;for(const e of t){if(e<128){c.push(w(e))}}let d=c.length;let _=d;if(d){c.push(u)}while(_=l&&eh((e-a)/i)){error("overflow")}a+=(s-l)*i;l=s;for(const s of t){if(se){error("overflow")}if(s==l){let t=a;for(let e=o;;e+=o){const s=e<=p?n:e>=p+r?r:e-p;if(t{"use strict";var e={948:e=>{function process(){return new Promise((function(e,r){setTimeout((function(){r(new Error('This "engine" is designed to fail, for testing purposes only'))}),100)}))}e.exports=process}};var r={};function __nccwpck_require__(_){var i=r[_];if(i!==undefined){return i.exports}var n=r[_]={exports:{}};var t=true;try{e[_](n,n.exports,__nccwpck_require__);t=false}finally{if(t)delete r[_]}return n.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var _=__nccwpck_require__(948);module.exports=_})(); \ No newline at end of file diff --git a/packages/next/compiled/resolve-url-loader/engine/postcss.js b/packages/next/compiled/resolve-url-loader/engine/postcss.js deleted file mode 100644 index 76672d3c282cc..0000000000000 --- a/packages/next/compiled/resolve-url-loader/engine/postcss.js +++ /dev/null @@ -1 +0,0 @@ -(()=>{"use strict";var e={26:(e,r,o)=>{var s=o(37),t=o(17),n=o(977);var a=o(57);var u=/\r(?!\n)(.|\n)?/g;function process(e,r,o){var p=o.removeCR&&s.EOL!=="\r"?r.replace(u," $1"):r;return n([n.plugin("postcss-resolve-url",postcssPlugin)]).process(p,{from:a.prepend(e),map:o.outputSourceMap&&{prev:!!o.absSourceMap&&a.prepend(o.absSourceMap),inline:false,annotation:false,sourcesContent:true}}).then((e=>({content:e.css,map:o.outputSourceMap?a.remove(e.map.toJSON()):null})));function postcssPlugin(){return function(e){e.walkDecls(eachDeclaration)};function eachDeclaration(e){var s=e.value&&e.value.indexOf("url")>=0;if(s){var n=e.source.start,p=o.sourceMapConsumer&&o.sourceMapConsumer.originalPositionFor(n);var i=p&&p.source&&a.remove(t.dirname(p.source));if(i){e.value=o.transformDeclaration(e.value,i)}else if(o.sourceMapConsumer){throw new Error("source-map information is not available at url() declaration "+(u.test(r)?"(found orphan CR, try removeCR option)":"(no orphan CR found)"))}}}}}e.exports=process},57:(e,r)=>{function prepend(e){if(typeof e==="string"){return"file://"+e}else if(e&&typeof e==="object"&&Array.isArray(e.sources)){return Object.assign({},e,{sources:e.sources.map(prepend)})}else{throw new Error("expected string|object")}}r.prepend=prepend;function remove(e){if(typeof e==="string"){return e.replace(/^file:\/{2}/,"")}else if(e&&typeof e==="object"&&Array.isArray(e.sources)){return Object.assign({},e,{sources:e.sources.map(remove)})}else{throw new Error("expected string|object")}}r.remove=remove},37:e=>{e.exports=require("os")},17:e=>{e.exports=require("path")},977:e=>{e.exports=require("postcss")}};var r={};function __nccwpck_require__(o){var s=r[o];if(s!==undefined){return s.exports}var t=r[o]={exports:{}};var n=true;try{e[o](t,t.exports,__nccwpck_require__);n=false}finally{if(n)delete r[o]}return t.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var o=__nccwpck_require__(26);module.exports=o})(); \ No newline at end of file diff --git a/packages/next/compiled/resolve-url-loader/engine/rework.js b/packages/next/compiled/resolve-url-loader/engine/rework.js deleted file mode 100644 index 816e370eae331..0000000000000 --- a/packages/next/compiled/resolve-url-loader/engine/rework.js +++ /dev/null @@ -1 +0,0 @@ -(()=>{var e={248:e=>{"use strict";function atob(e){return Buffer.from(e,"base64").toString("binary")}e.exports=atob.atob=atob},270:(e,t,r)=>{"use strict";var n=r(147);var o=r(17);var i=r(454);Object.defineProperty(t,"commentRegex",{get:function getCommentRegex(){return/^\s*\/(?:\/|\*)[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/gm}});Object.defineProperty(t,"mapFileCommentRegex",{get:function getMapFileCommentRegex(){return/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"`]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/gm}});function decodeBase64(e){return i.Buffer.from(e,"base64").toString()}function stripComment(e){return e.split(",").pop()}function readFromFileMap(e,r){var i=t.mapFileCommentRegex.exec(e);var s=i[1]||i[2];var a=o.resolve(r,s);try{return n.readFileSync(a,"utf8")}catch(e){throw new Error("An error occurred while trying to read the map file at "+a+"\n"+e)}}function Converter(e,t){t=t||{};if(t.isFileComment)e=readFromFileMap(e,t.commentFileDir);if(t.hasComment)e=stripComment(e);if(t.isEncoded)e=decodeBase64(e);if(t.isJSON||t.isEncoded)e=JSON.parse(e);this.sourcemap=e}Converter.prototype.toJSON=function(e){return JSON.stringify(this.sourcemap,null,e)};Converter.prototype.toBase64=function(){var e=this.toJSON();return i.Buffer.from(e,"utf8").toString("base64")};Converter.prototype.toComment=function(e){var t=this.toBase64();var r="sourceMappingURL=data:application/json;charset=utf-8;base64,"+t;return e&&e.multiline?"/*# "+r+" */":"//# "+r};Converter.prototype.toObject=function(){return JSON.parse(this.toJSON())};Converter.prototype.addProperty=function(e,t){if(this.sourcemap.hasOwnProperty(e))throw new Error('property "'+e+'" already exists on the sourcemap, use set property instead');return this.setProperty(e,t)};Converter.prototype.setProperty=function(e,t){this.sourcemap[e]=t;return this};Converter.prototype.getProperty=function(e){return this.sourcemap[e]};t.fromObject=function(e){return new Converter(e)};t.fromJSON=function(e){return new Converter(e,{isJSON:true})};t.fromBase64=function(e){return new Converter(e,{isEncoded:true})};t.fromComment=function(e){e=e.replace(/^\/\*/g,"//").replace(/\*\/$/g,"");return new Converter(e,{isEncoded:true,hasComment:true})};t.fromMapFileComment=function(e,t){return new Converter(e,{commentFileDir:t,isFileComment:true,isJSON:true})};t.fromSource=function(e){var r=e.match(t.commentRegex);return r?t.fromComment(r.pop()):null};t.fromMapFileSource=function(e,r){var n=e.match(t.mapFileCommentRegex);return n?t.fromMapFileComment(n.pop(),r):null};t.removeComments=function(e){return e.replace(t.commentRegex,"")};t.removeMapFileComments=function(e){return e.replace(t.mapFileCommentRegex,"")};t.generateMapFileComment=function(e,t){var r="sourceMappingURL="+e;return t&&t.multiline?"/*# "+r+" */":"//# "+r}},454:(e,t,r)=>{var n=r(300);var o=n.Buffer;function copyProps(e,t){for(var r in e){t[r]=e[r]}}if(o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow){e.exports=n}else{copyProps(n,t);t.Buffer=SafeBuffer}function SafeBuffer(e,t,r){return o(e,t,r)}copyProps(o,SafeBuffer);SafeBuffer.from=function(e,t,r){if(typeof e==="number"){throw new TypeError("Argument must not be a number")}return o(e,t,r)};SafeBuffer.alloc=function(e,t,r){if(typeof e!=="number"){throw new TypeError("Argument must be a number")}var n=o(e);if(t!==undefined){if(typeof r==="string"){n.fill(t,r)}else{n.fill(t)}}else{n.fill(0)}return n};SafeBuffer.allocUnsafe=function(e){if(typeof e!=="number"){throw new TypeError("Argument must be a number")}return o(e)};SafeBuffer.allocUnsafeSlow=function(e){if(typeof e!=="number"){throw new TypeError("Argument must be a number")}return n.SlowBuffer(e)}},800:e=>{"use strict";var t="%[a-f0-9]{2}";var r=new RegExp(t,"gi");var n=new RegExp("("+t+")+","gi");function decodeComponents(e,t){try{return decodeURIComponent(e.join(""))}catch(e){}if(e.length===1){return e}t=t||1;var r=e.slice(0,t);var n=e.slice(t);return Array.prototype.concat.call([],decodeComponents(r),decodeComponents(n))}function decode(e){try{return decodeURIComponent(e)}catch(o){var t=e.match(r);for(var n=1;n{try{var n=r(837);if(typeof n.inherits!=="function")throw"";e.exports=n.inherits}catch(t){e.exports=r(526)}},526:e=>{if(typeof Object.create==="function"){e.exports=function inherits(e,t){if(t){e.super_=t;e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}})}}}else{e.exports=function inherits(e,t){if(t){e.super_=t;var TempCtor=function(){};TempCtor.prototype=t.prototype;e.prototype=new TempCtor;e.prototype.constructor=e}}}},620:(e,t,r)=>{"use strict";var n=r(17),o=r(270),i=r(56),s=r(59);var a=r(57);function process(e,t,r){var u=t+(r.absSourceMap?o.fromObject(a.prepend(r.absSourceMap)).toComment({multiline:true}):"");var c=i(u,{source:a.prepend(e)}).use(reworkPlugin).toString({sourcemap:r.outputSourceMap,sourcemapAsObject:r.outputSourceMap});if(r.outputSourceMap){return{content:c.code,map:a.remove(c.map)}}else{return{content:c,map:null}}function reworkPlugin(e){s(e,(function visitor(e){if(e){e.forEach(eachDeclaration)}}));function eachDeclaration(e){var t=e.value&&e.value.indexOf("url")>=0;if(t){var o=e.position.start,i=r.sourceMapConsumer&&r.sourceMapConsumer.originalPositionFor(o);var s=i&&i.source&&a.remove(n.dirname(i.source));if(s){e.value=r.transformDeclaration(e.value,s)}else if(r.sourceMapConsumer){throw new Error("source-map information is not available at url() declaration")}}}}}e.exports=process},57:(e,t)=>{"use strict";function prepend(e){if(typeof e==="string"){return"file://"+e}else if(e&&typeof e==="object"&&Array.isArray(e.sources)){return Object.assign({},e,{sources:e.sources.map(prepend)})}else{throw new Error("expected string|object")}}t.prepend=prepend;function remove(e){if(typeof e==="string"){return e.replace(/^file:\/{2}/,"")}else if(e&&typeof e==="object"&&Array.isArray(e.sources)){return Object.assign({},e,{sources:e.sources.map(remove)})}else{throw new Error("expected string|object")}}t.remove=remove},59:e=>{e.exports=visit;function visit(e,t){e.rules.forEach((function(r){if(r.rules){visit(r,t);return}if(r.keyframes){r.keyframes.forEach((function(e){t(e.declarations,r)}));return}if(!r.declarations)return;t(r.declarations,e)}))}},56:(e,t,r)=>{var n=r(520);var o=r(869);var i=n.parse;var s=n.stringify;t=e.exports=rework;function rework(e,t){return new Rework(i(e,t))}function Rework(e){this.obj=e}Rework.prototype.use=function(e){e(this.obj.stylesheet,this);return this};Rework.prototype.toString=function(e){e=e||{};var t=s(this.obj,e);if(e.sourcemap&&!e.sourcemapAsObject){t=t.code+"\n"+sourcemapToComment(t.map)}return t};function sourcemapToComment(e){var t=o.fromObject(e).toBase64();return"/*# sourceMappingURL=data:application/json;base64,"+t+" */"}},869:(e,t,r)=>{"use strict";var n=r(147);var o=r(17);var i=/^[ \t]*(?:\/\/|\/\*)[@#][ \t]+sourceMappingURL=data:(?:application|text)\/json;base64,(.+)(?:\*\/)?/gm;var s=/(?:^[ \t]*\/\/[@|#][ \t]+sourceMappingURL=(.+?)[ \t]*$)|(?:^[ \t]*\/\*[@#][ \t]+sourceMappingURL=(.+?)[ \t]*\*\/[ \t]*$)/gm;function decodeBase64(e){return new Buffer(e,"base64").toString()}function stripComment(e){return e.split(",").pop()}function readFromFileMap(e,t){var r=s.exec(e);s.lastIndex=0;var i=r[1]||r[2];var a=o.join(t,i);try{return n.readFileSync(a,"utf8")}catch(e){throw new Error("An error occurred while trying to read the map file at "+a+"\n"+e)}}function Converter(e,t){t=t||{};try{if(t.isFileComment)e=readFromFileMap(e,t.commentFileDir);if(t.hasComment)e=stripComment(e);if(t.isEncoded)e=decodeBase64(e);if(t.isJSON||t.isEncoded)e=JSON.parse(e);this.sourcemap=e}catch(e){console.error(e);return null}}Converter.prototype.toJSON=function(e){return JSON.stringify(this.sourcemap,null,e)};Converter.prototype.toBase64=function(){var e=this.toJSON();return new Buffer(e).toString("base64")};Converter.prototype.toComment=function(){var e=this.toBase64();return"//# sourceMappingURL=data:application/json;base64,"+e};Converter.prototype.toObject=function(){return JSON.parse(this.toJSON())};Converter.prototype.addProperty=function(e,t){if(this.sourcemap.hasOwnProperty(e))throw new Error("property %s already exists on the sourcemap, use set property instead");return this.setProperty(e,t)};Converter.prototype.setProperty=function(e,t){this.sourcemap[e]=t;return this};Converter.prototype.getProperty=function(e){return this.sourcemap[e]};t.fromObject=function(e){return new Converter(e)};t.fromJSON=function(e){return new Converter(e,{isJSON:true})};t.fromBase64=function(e){return new Converter(e,{isEncoded:true})};t.fromComment=function(e){e=e.replace(/^\/\*/g,"//").replace(/\*\/$/g,"");return new Converter(e,{isEncoded:true,hasComment:true})};t.fromMapFileComment=function(e,t){return new Converter(e,{commentFileDir:t,isFileComment:true,isJSON:true})};t.fromSource=function(e){var r=e.match(i);i.lastIndex=0;return r?t.fromComment(r.pop()):null};t.fromMapFileSource=function(e,r){var n=e.match(s);s.lastIndex=0;return n?t.fromMapFileComment(n.pop(),r):null};t.removeComments=function(e){i.lastIndex=0;return e.replace(i,"")};t.removeMapFileComments=function(e){s.lastIndex=0;return e.replace(s,"")};t.__defineGetter__("commentRegex",(function(){i.lastIndex=0;return i}));t.__defineGetter__("mapFileCommentRegex",(function(){s.lastIndex=0;return s}))},520:(e,t,r)=>{t.parse=r(611);t.stringify=r(753)},611:e=>{var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;e.exports=function(e,r){r=r||{};var n=1;var o=1;function updatePosition(e){var t=e.match(/\n/g);if(t)n+=t.length;var r=e.lastIndexOf("\n");o=~r?e.length-r:o+e.length}function position(){var e={line:n,column:o};return function(t){t.position=new Position(e);whitespace();return t}}function Position(e){this.start=e;this.end={line:n,column:o};this.source=r.source}Position.prototype.content=e;var i=[];function error(t){var s=new Error(r.source+":"+n+":"+o+": "+t);s.reason=t;s.filename=r.source;s.line=n;s.column=o;s.source=e;if(r.silent){i.push(s)}else{throw s}}function stylesheet(){var e=rules();return{type:"stylesheet",stylesheet:{source:r.source,rules:e,parsingErrors:i}}}function open(){return match(/^{\s*/)}function close(){return match(/^}/)}function rules(){var t;var r=[];whitespace();comments(r);while(e.length&&e.charAt(0)!="}"&&(t=atrule()||rule())){if(t!==false){r.push(t);comments(r)}}return r}function match(t){var r=t.exec(e);if(!r)return;var n=r[0];updatePosition(n);e=e.slice(n.length);return r}function whitespace(){match(/^\s*/)}function comments(e){var t;e=e||[];while(t=comment()){if(t!==false){e.push(t)}}return e}function comment(){var t=position();if("/"!=e.charAt(0)||"*"!=e.charAt(1))return;var r=2;while(""!=e.charAt(r)&&("*"!=e.charAt(r)||"/"!=e.charAt(r+1)))++r;r+=2;if(""===e.charAt(r-1)){return error("End of comment missing")}var n=e.slice(2,r-2);o+=2;updatePosition(n);e=e.slice(r);o+=2;return t({type:"comment",comment:n})}function selector(){var e=match(/^([^{]+)/);if(!e)return;return trim(e[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,(function(e){return e.replace(/,/g,"‌")})).split(/\s*(?![^(]*\)),\s*/).map((function(e){return e.replace(/\u200C/g,",")}))}function declaration(){var e=position();var r=match(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(!r)return;r=trim(r[0]);if(!match(/^:\s*/))return error("property missing ':'");var n=match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/);var o=e({type:"declaration",property:r.replace(t,""),value:n?trim(n[0]).replace(t,""):""});match(/^[;\s]*/);return o}function declarations(){var e=[];if(!open())return error("missing '{'");comments(e);var t;while(t=declaration()){if(t!==false){e.push(t);comments(e)}}if(!close())return error("missing '}'");return e}function keyframe(){var e;var t=[];var r=position();while(e=match(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/)){t.push(e[1]);match(/^,\s*/)}if(!t.length)return;return r({type:"keyframe",values:t,declarations:declarations()})}function atkeyframes(){var e=position();var t=match(/^@([-\w]+)?keyframes\s*/);if(!t)return;var r=t[1];var t=match(/^([-\w]+)\s*/);if(!t)return error("@keyframes missing name");var n=t[1];if(!open())return error("@keyframes missing '{'");var o;var i=comments();while(o=keyframe()){i.push(o);i=i.concat(comments())}if(!close())return error("@keyframes missing '}'");return e({type:"keyframes",name:n,vendor:r,keyframes:i})}function atsupports(){var e=position();var t=match(/^@supports *([^{]+)/);if(!t)return;var r=trim(t[1]);if(!open())return error("@supports missing '{'");var n=comments().concat(rules());if(!close())return error("@supports missing '}'");return e({type:"supports",supports:r,rules:n})}function athost(){var e=position();var t=match(/^@host\s*/);if(!t)return;if(!open())return error("@host missing '{'");var r=comments().concat(rules());if(!close())return error("@host missing '}'");return e({type:"host",rules:r})}function atmedia(){var e=position();var t=match(/^@media *([^{]+)/);if(!t)return;var r=trim(t[1]);if(!open())return error("@media missing '{'");var n=comments().concat(rules());if(!close())return error("@media missing '}'");return e({type:"media",media:r,rules:n})}function atcustommedia(){var e=position();var t=match(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(!t)return;return e({type:"custom-media",name:trim(t[1]),media:trim(t[2])})}function atpage(){var e=position();var t=match(/^@page */);if(!t)return;var r=selector()||[];if(!open())return error("@page missing '{'");var n=comments();var o;while(o=declaration()){n.push(o);n=n.concat(comments())}if(!close())return error("@page missing '}'");return e({type:"page",selectors:r,declarations:n})}function atdocument(){var e=position();var t=match(/^@([-\w]+)?document *([^{]+)/);if(!t)return;var r=trim(t[1]);var n=trim(t[2]);if(!open())return error("@document missing '{'");var o=comments().concat(rules());if(!close())return error("@document missing '}'");return e({type:"document",document:n,vendor:r,rules:o})}function atfontface(){var e=position();var t=match(/^@font-face\s*/);if(!t)return;if(!open())return error("@font-face missing '{'");var r=comments();var n;while(n=declaration()){r.push(n);r=r.concat(comments())}if(!close())return error("@font-face missing '}'");return e({type:"font-face",declarations:r})}var s=_compileAtrule("import");var a=_compileAtrule("charset");var u=_compileAtrule("namespace");function _compileAtrule(e){var t=new RegExp("^@"+e+"\\s*([^;]+);");return function(){var r=position();var n=match(t);if(!n)return;var o={type:e};o[e]=n[1].trim();return r(o)}}function atrule(){if(e[0]!="@")return;return atkeyframes()||atmedia()||atcustommedia()||atsupports()||s()||a()||u()||atdocument()||atpage()||athost()||atfontface()}function rule(){var e=position();var t=selector();if(!t)return error("selector missing");comments();return e({type:"rule",selectors:t,declarations:declarations()})}return addParent(stylesheet())};function trim(e){return e?e.replace(/^\s+|\s+$/g,""):""}function addParent(e,t){var r=e&&typeof e.type==="string";var n=r?e:t;for(var o in e){var i=e[o];if(Array.isArray(i)){i.forEach((function(e){addParent(e,n)}))}else if(i&&typeof i==="object"){addParent(i,n)}}if(r){Object.defineProperty(e,"parent",{configurable:true,writable:true,enumerable:false,value:t||null})}return e}},438:e=>{e.exports=Compiler;function Compiler(e){this.options=e||{}}Compiler.prototype.emit=function(e){return e};Compiler.prototype.visit=function(e){return this[e.type](e)};Compiler.prototype.mapVisit=function(e,t){var r="";t=t||"";for(var n=0,o=e.length;n{var n=r(438);var o=r(919);e.exports=Compiler;function Compiler(e){n.call(this,e)}o(Compiler,n);Compiler.prototype.compile=function(e){return e.stylesheet.rules.map(this.visit,this).join("")};Compiler.prototype.comment=function(e){return this.emit("",e.position)};Compiler.prototype.import=function(e){return this.emit("@import "+e.import+";",e.position)};Compiler.prototype.media=function(e){return this.emit("@media "+e.media,e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}")};Compiler.prototype.document=function(e){var t="@"+(e.vendor||"")+"document "+e.document;return this.emit(t,e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}")};Compiler.prototype.charset=function(e){return this.emit("@charset "+e.charset+";",e.position)};Compiler.prototype.namespace=function(e){return this.emit("@namespace "+e.namespace+";",e.position)};Compiler.prototype.supports=function(e){return this.emit("@supports "+e.supports,e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}")};Compiler.prototype.keyframes=function(e){return this.emit("@"+(e.vendor||"")+"keyframes "+e.name,e.position)+this.emit("{")+this.mapVisit(e.keyframes)+this.emit("}")};Compiler.prototype.keyframe=function(e){var t=e.declarations;return this.emit(e.values.join(","),e.position)+this.emit("{")+this.mapVisit(t)+this.emit("}")};Compiler.prototype.page=function(e){var t=e.selectors.length?e.selectors.join(", "):"";return this.emit("@page "+t,e.position)+this.emit("{")+this.mapVisit(e.declarations)+this.emit("}")};Compiler.prototype["font-face"]=function(e){return this.emit("@font-face",e.position)+this.emit("{")+this.mapVisit(e.declarations)+this.emit("}")};Compiler.prototype.host=function(e){return this.emit("@host",e.position)+this.emit("{")+this.mapVisit(e.rules)+this.emit("}")};Compiler.prototype["custom-media"]=function(e){return this.emit("@custom-media "+e.name+" "+e.media+";",e.position)};Compiler.prototype.rule=function(e){var t=e.declarations;if(!t.length)return"";return this.emit(e.selectors.join(","),e.position)+this.emit("{")+this.mapVisit(t)+this.emit("}")};Compiler.prototype.declaration=function(e){return this.emit(e.property+":"+e.value,e.position)+this.emit(";")}},121:(e,t,r)=>{var n=r(438);var o=r(919);e.exports=Compiler;function Compiler(e){e=e||{};n.call(this,e);this.indentation=e.indent}o(Compiler,n);Compiler.prototype.compile=function(e){return this.stylesheet(e)};Compiler.prototype.stylesheet=function(e){return this.mapVisit(e.stylesheet.rules,"\n\n")};Compiler.prototype.comment=function(e){return this.emit(this.indent()+"/*"+e.comment+"*/",e.position)};Compiler.prototype.import=function(e){return this.emit("@import "+e.import+";",e.position)};Compiler.prototype.media=function(e){return this.emit("@media "+e.media,e.position)+this.emit(" {\n"+this.indent(1))+this.mapVisit(e.rules,"\n\n")+this.emit(this.indent(-1)+"\n}")};Compiler.prototype.document=function(e){var t="@"+(e.vendor||"")+"document "+e.document;return this.emit(t,e.position)+this.emit(" "+" {\n"+this.indent(1))+this.mapVisit(e.rules,"\n\n")+this.emit(this.indent(-1)+"\n}")};Compiler.prototype.charset=function(e){return this.emit("@charset "+e.charset+";",e.position)};Compiler.prototype.namespace=function(e){return this.emit("@namespace "+e.namespace+";",e.position)};Compiler.prototype.supports=function(e){return this.emit("@supports "+e.supports,e.position)+this.emit(" {\n"+this.indent(1))+this.mapVisit(e.rules,"\n\n")+this.emit(this.indent(-1)+"\n}")};Compiler.prototype.keyframes=function(e){return this.emit("@"+(e.vendor||"")+"keyframes "+e.name,e.position)+this.emit(" {\n"+this.indent(1))+this.mapVisit(e.keyframes,"\n")+this.emit(this.indent(-1)+"}")};Compiler.prototype.keyframe=function(e){var t=e.declarations;return this.emit(this.indent())+this.emit(e.values.join(", "),e.position)+this.emit(" {\n"+this.indent(1))+this.mapVisit(t,"\n")+this.emit(this.indent(-1)+"\n"+this.indent()+"}\n")};Compiler.prototype.page=function(e){var t=e.selectors.length?e.selectors.join(", ")+" ":"";return this.emit("@page "+t,e.position)+this.emit("{\n")+this.emit(this.indent(1))+this.mapVisit(e.declarations,"\n")+this.emit(this.indent(-1))+this.emit("\n}")};Compiler.prototype["font-face"]=function(e){return this.emit("@font-face ",e.position)+this.emit("{\n")+this.emit(this.indent(1))+this.mapVisit(e.declarations,"\n")+this.emit(this.indent(-1))+this.emit("\n}")};Compiler.prototype.host=function(e){return this.emit("@host",e.position)+this.emit(" {\n"+this.indent(1))+this.mapVisit(e.rules,"\n\n")+this.emit(this.indent(-1)+"\n}")};Compiler.prototype["custom-media"]=function(e){return this.emit("@custom-media "+e.name+" "+e.media+";",e.position)};Compiler.prototype.rule=function(e){var t=this.indent();var r=e.declarations;if(!r.length)return"";return this.emit(e.selectors.map((function(e){return t+e})).join(",\n"),e.position)+this.emit(" {\n")+this.emit(this.indent(1))+this.mapVisit(r,"\n")+this.emit(this.indent(-1))+this.emit("\n"+this.indent()+"}")};Compiler.prototype.declaration=function(e){return this.emit(this.indent())+this.emit(e.property+": "+e.value,e.position)+this.emit(";")};Compiler.prototype.indent=function(e){this.level=this.level||1;if(null!=e){this.level+=e;return""}return Array(this.level).join(this.indentation||" ")}},753:(e,t,r)=>{var n=r(867);var o=r(121);e.exports=function(e,t){t=t||{};var i=t.compress?new n(t):new o(t);if(t.sourcemap){var s=r(781);s(i);var a=i.compile(e);i.applySourceMaps();var u=t.sourcemap==="generator"?i.map:i.map.toJSON();return{code:a,map:u}}var a=i.compile(e);return a}},781:(e,t,r)=>{var n=r(749).SourceMapGenerator;var o=r(749).SourceMapConsumer;var i=r(561);var s=r(803);var a=r(147);var u=r(17);e.exports=mixin;function mixin(e){e._comment=e.comment;e.map=new n;e.position={line:1,column:1};e.files={};for(var r in t)e[r]=t[r]}t.updatePosition=function(e){var t=e.match(/\n/g);if(t)this.position.line+=t.length;var r=e.lastIndexOf("\n");this.position.column=~r?e.length-r:this.position.column+e.length};t.emit=function(e,t){if(t){var r=s(t.source||"source.css");this.map.addMapping({source:r,generated:{line:this.position.line,column:Math.max(this.position.column-1,0)},original:{line:t.start.line,column:t.start.column-1}});this.addFile(r,t)}this.updatePosition(e);return e};t.addFile=function(e,t){if(typeof t.content!=="string")return;if(Object.prototype.hasOwnProperty.call(this.files,e))return;this.files[e]=t.content};t.applySourceMaps=function(){Object.keys(this.files).forEach((function(e){var t=this.files[e];this.map.setSourceContent(e,t);if(this.options.inputSourcemaps!==false){var r=i.resolveSync(t,e,a.readFileSync);if(r){var n=new o(r.map);var c=r.sourcesRelativeTo;this.map.applySourceMap(n,e,s(u.dirname(c)))}}}),this)};t.comment=function(e){if(/^# sourceMappingURL=/.test(e.comment))return this.emit("",e.position);else return this._comment(e)}},737:(e,t,r)=>{var n=r(800);function customDecodeUriComponent(e){return n(e.replace(/\+/g,"%2B"))}e.exports=customDecodeUriComponent},522:(e,t,r)=>{var n=r(310);function resolveUrl(){return Array.prototype.reduce.call(arguments,(function(e,t){return n.resolve(e,t)}))}e.exports=resolveUrl},561:(e,t,r)=>{var n=r(849);var o=r(522);var i=r(737);var s=r(803);var a=r(248);function callbackAsync(e,t,r){setImmediate((function(){e(t,r)}))}function parseMapToJSON(e,t){try{return JSON.parse(e.replace(/^\)\]\}'/,""))}catch(e){e.sourceMapData=t;throw e}}function readSync(e,t,r){var n=i(t);try{return String(e(n))}catch(e){e.sourceMapData=r;throw e}}function resolveSourceMap(e,t,r,n){var o;try{o=resolveSourceMapHelper(e,t)}catch(e){return callbackAsync(n,e)}if(!o||o.map){return callbackAsync(n,null,o)}var s=i(o.url);r(s,(function(e,t){if(e){e.sourceMapData=o;return n(e)}o.map=String(t);try{o.map=parseMapToJSON(o.map,o)}catch(e){return n(e)}n(null,o)}))}function resolveSourceMapSync(e,t,r){var n=resolveSourceMapHelper(e,t);if(!n||n.map){return n}n.map=readSync(r,n.url,n);n.map=parseMapToJSON(n.map,n);return n}var u=/^data:([^,;]*)(;[^,;]*)*(?:,(.*))?$/;var c=/^(?:application|text)\/json$/;var p="utf-8";function base64ToBuf(e){var t=a(e);var r=t.length;var n=new Uint8Array(r);for(var o=0;o{var n=r(17);"use strict";function urix(e){if(n.sep==="\\"){return e.replace(/\\/g,"/").replace(/^[a-z]:\/?/i,"/")}return e}e.exports=urix},300:e=>{"use strict";e.exports=require("buffer")},147:e=>{"use strict";e.exports=require("fs")},749:e=>{"use strict";e.exports=require("next/dist/compiled/source-map")},17:e=>{"use strict";e.exports=require("path")},310:e=>{"use strict";e.exports=require("url")},837:e=>{"use strict";e.exports=require("util")}};var t={};function __nccwpck_require__(r){var n=t[r];if(n!==undefined){return n.exports}var o=t[r]={exports:{}};var i=true;try{e[r].call(o.exports,o,o.exports,__nccwpck_require__);i=false}finally{if(i)delete t[r]}return o.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(620);module.exports=r})(); \ No newline at end of file diff --git a/packages/next/compiled/resolve-url-loader/index.js b/packages/next/compiled/resolve-url-loader/index.js deleted file mode 100644 index a722cf3639409..0000000000000 --- a/packages/next/compiled/resolve-url-loader/index.js +++ /dev/null @@ -1 +0,0 @@ -(()=>{var e={3265:(e,t,r)=>{"use strict";var n=r(1017),o=r(7147);e.exports={name:"absolute",decode:decode,encode:encode,root:root};function decode(e){return n.isAbsolute(e)&&o.existsSync(e)&&o.statSync(e).isFile()&&e}function encode(e){return e}function root(){}},4459:e=>{"use strict";e.exports={name:"bowerComponent",decode:decode,abstract:true};function decode(e){return/^\/?([\w-]+)\s+\(bower component\)$/.test(e)}},6088:(e,t,r)=>{e.exports=[r(7728),r(5817),r(4459),r(7808),r(9476),r(4398),r(8561),r(3265)]},7808:(e,t,r)=>{"use strict";var n=r(1017),o=r(7147);var i=r(9240);var s=r(3182);e.exports={name:"npmModule",decode:decode};function decode(e){if(/~/.test(e)){var t=i.urlToRequest(e),r=s.call(this),a=n.normalize(n.join(r,"node_modules",t)),u=!!a&&o.existsSync(a)&&o.statSync(a).isFile();return u&&a}}},9476:(e,t,r)=>{"use strict";var n=r(1017),o=r(7147);var i=r(9528);e.exports={name:"outputRelative",decode:decode,encode:encode,root:i};function decode(e){var t=i.call(this),r=!!t&&n.normalize(n.join(t,e)),s=!!r&&o.existsSync(r)&&o.statSync(r).isFile();return s&&r}function encode(e){var t=i.call(this);if(!t){throw new Error("Cannot locate the Webpack output directory")}else{return n.relative(t,e)}}},4398:(e,t,r)=>{"use strict";var n=r(1017),o=r(7147);var i=r(3182),s=r(8543);e.exports={name:"projectRelative",decode:decode,encode:encode,root:i};function decode(e){var t=i.call(this),r=n.normalize(n.join(t,e)),s=!!r&&o.existsSync(r)&&o.statSync(r).isFile();return s&&r}function encode(e){var t=i.call(this);if(!t){throw new Error("Cannot locate the Webpack project directory")}else{return"/"+s(t,e)}}},8561:(e,t,r)=>{"use strict";var n=r(1017),o=r(7147);e.exports={name:"sourceRelative",decode:decode,encode:encode,root:root};function decode(e){var t=this.context,r=!!t&&n.normalize(n.join(t,e)),i=!!r&&o.existsSync(r)&&o.statSync(r).isFile();return i&&r}function encode(e){return n.relative(this.context,e)}function root(){return this.context}},8543:(e,t,r)=>{"use strict";var n=r(7147),o=r(1017);var i;function enhancedRelative(e,t){var r=o.relative(e,t);var s=r.replace(/^\.{2}[\\\/]/,""),a=t.replace(s,"");var u=r===s;if(u){return r}else{var c=s.split(/[\\\/]/);for(var l=i?2:1,f=false;l>0&&!f;l--){i=i||indexLinkedModules(e);for(var p=0;p0){var i=t.shift(),s=o.join(i,"package.json"),a=n.existsSync(s)&&require(s).name;if(a){r[a]=r[a]||i;t.push.apply(t,listSymLinkedModules(i))}}return r;function listSymLinkedModules(e){var t=o.join(e,"node_modules"),r=n.existsSync(t)&&n.statSync(t).isDirectory(),i=!!r&&n.readdirSync(t)||[];return i.map(joinDirectory).filter(testIsSymLink);function joinDirectory(e){return o.join(t,e)}function testIsSymLink(e){return n.lstatSync(e).isSymbolicLink()}}}},3182:(e,t,r)=>{"use strict";var n=r(1017);function getContextDirectory(){var e=this.options?this.options.context:null;return!!e&&n.resolve(e)||process.cwd()}e.exports=getContextDirectory},9528:(e,t,r)=>{"use strict";var n=r(1017),o=r(7147);var i=r(3182);function getOutputDirectory(){var e=this.options&&this.options.output?this.options.output.directory:null,t=!!e&&n.resolve(i.call(this),e),r=!!t&&o.existsSync(t)&&o.statSync(t).isDirectory();return r?t:undefined}e.exports=getOutputDirectory},5817:e=>{"use strict";e.exports={name:"webpackBootstrap",decode:decode,abstract:true};function decode(e){return/^webpack\/bootstrap\s+\w{20}$/.test(e)}},7728:(e,t,r)=>{"use strict";var n=r(4398);e.exports={name:"webpackProtocol",decode:decode,encode:encode,root:root};function decode(e){var t=/^webpack:\/{2}(.*)$/.exec(e);return!!t&&n.decode.call(this,t[1])}function encode(e){return"webpack://"+n.encode.call(this,e)}function root(){}},2294:(e,t,r)=>{"use strict";var n=r(7515).u2,o=new Array(11).join(" ");function debugMessage(e,t){return[" ",n+":"," "+e.resourcePath,formatField("@",precedingRequest(e)),formatField("INPUT",t.input||"(source-map absent)"),formatField("ABSOLUTE",t.absolute),formatField("OUTPUT",t.output),formatField("ROOT",t.root)].filter(Boolean).join("\n")}e.exports=debugMessage;function precedingRequest(e){var t="loaderIndex"in e&&"loaders"in e&&Array.isArray(e.loaders);if(t){var r=e.loaderIndex+1;return r in e.loaders?e.loaders[r].request:"(no preceding loader)"}}function formatField(e,t){return!!t&&rightAlign(e)+formatData(t);function rightAlign(e){return(o+e+" ").slice(-o.length)}function formatData(e){return Array.isArray(e)?e.join("\n"+o):e}}},5142:(e,t,r)=>{"use strict";var n=r(8965);function decodeSourcesWith(e,t){var r=this;var n=[].concat(e).reduce(reduceValidDecoder.bind(null,e),[]);return function decode(e){for(var o=0,i=null;o{"use strict";var n=r(8965),o=r(9114);function encodeSourcesWith(e){var t=this,r=n("encode")(e);if(!r){return new o('Specified format does not support encoding (it lacks an "encoder" function)')}else{return function encode(n){var o;try{o=n&&r.call(t,n)}catch(e){return getNamedError(e)}return o;function getNamedError(t){var r=e.name||"(unnamed)",o=["Encoding with codec: "+r,"Absolute source: "+n,t&&(t.stack?t.stack:t)].filter(Boolean).join("\n");return new Error(o)}}}}e.exports=encodeSourcesWith},9114:(e,t,r)=>{"use strict";var n=r(7515).u2;function getError(){var e=(n+":\n"+Array.prototype.slice.call(arguments).join(" ")).split(/\s*\n\s*/).join("\n ");return new Error(e)}e.exports=getError},8965:e=>{"use strict";function getFieldAsFn(e){return function getFromValue(t){return!!t&&typeof t==="object"&&typeof t[e]==="function"&&t[e]}}e.exports=getFieldAsFn},6906:(e,t,r)=>{"use strict";var n=r(2294),o=r(2320),i=r(873),s=r(5142),a=r(1907),u=r(8536),c=r(6799);var l=r(6088);function process(e,t,r){var f=Object.assign({sep:"/",debug:false,fail:false,format:false,root:false,codecs:l},t);var p=f.codecs.filter(c);var d=!!r&&typeof r==="object"&&r,v=typeof r==="string"&&r,h=d&&d.sources||v&&[v];var y,g,_,b;if(h){y=h.map(s.call(e,p,f.fail));i(e.resourcePath,y);b=!d||f.format==="remove"?undefined:Object.assign({},d);if(f.format){var m=p.filter(testNamedCodec).pop();if(!m){throw new Error('Specified format "'+f.format+'" does not match any available codec.')}g=y.map(u.call(e,m)).map(insertAbstractSources).map(convertPathSep);_=!!f.root&&a.call(e,m)()||undefined;i(e.resourcePath,g.concat(_));if(b){b.sources=g;b.sourceRoot=_}}}var x=o(f.debug).test(e.resourcePath);if(x){console.log(n(e,{input:h,absolute:y,output:g,root:_}))}return d?b:g?g[0]:undefined;function testNamedCodec(e){return e.name===f.format}function insertAbstractSources(e,t){return e||h[t]}function convertPathSep(e){return e instanceof Error?e:e.replace(/[\\\/]/g,f.sep)}}e.exports=process},1907:(e,t,r)=>{"use strict";var n=r(8965),o=r(9114);function locateRootWith(e){var t=this,r=n("root")(e);if(!r){return new o('Specified format does not support encoding (it lacks a "root" function)')}else{return function locate(){var n;try{n=r.call(t)}catch(e){return getNamedError(e)}return n;function getNamedError(t){var r=e.name||"(unnamed)",n=["Locating root with codec: "+r,t&&(t.stack?t.stack:t)].filter(Boolean).join("\n");return new Error(n)}}}}e.exports=locateRootWith},6799:(e,t,r)=>{"use strict";var n=r(9491);function testCodec(e){n(!!e&&typeof e==="object","Codec must be an object");n(typeof e.name==="string"&&/^[\w-]+$/.test(e.name),"Codec.name must be a kebab-case string");n(typeof e.decode==="function"&&e.decode.length===1,"Codec.decode must be a function that accepts a single source string");n(typeof e.encode==="undefined"||typeof e.encode==="function"&&e.encode.length===1,"Codec.encode must be a function that accepts a single absolute path string, or else be omitted");n(typeof e.root==="undefined"||typeof e.root==="function"&&e.root.length===0,"Codec.root must be a function that accepts no arguments, or else be omitted");return true}e.exports=testCodec},873:(e,t,r)=>{"use strict";var n=r(9114);function throwErrors(e,t){var r=!!t&&t.filter(testIsError).map(getMessage);var o=!!r&&r.length;if(o){throw n(["For resource: "+e].concat(r).join("\n"))}function testIsError(e){return!!e&&typeof e==="object"&&e instanceof Error}function getMessage(e){return e.message}}e.exports=throwErrors},2320:(e,t,r)=>{"use strict";var n=r(2683);var o=/(\/?)(.+)\1([a-z]*)/i;function toRegExp(e){return typeof e==="object"&&typeof e.test==="function"&&e||typeof e==="string"&&o.test(e)&&n(e)||/^true$|^$/.test(e)&&/.*/||/matchnone^/}e.exports=toRegExp},6361:e=>{e.exports=function(e){return function(){return e.apply(null,arguments)}}},4326:e=>{e.exports=function(e){return function(t){return e.apply(null,arguments)}}},7925:e=>{e.exports=function(e){return function(t,r){return e.apply(null,arguments)}}},3094:e=>{e.exports=function(e){return function(t,r,n){return e.apply(null,arguments)}}},3758:e=>{e.exports=function(e){return function(t,r,n,o){return e.apply(null,arguments)}}},4752:e=>{e.exports=function(e){return function(t,r,n,o,i){return e.apply(null,arguments)}}},7097:(e,t,r)=>{var n=[r(6361),r(4326),r(7925),r(3094),r(3758),r(4752)];e.exports=function(e,t){if(t&&t<=5){return n[t](e)}else{return e}}},4093:e=>{"use strict";const preserveCamelCase=e=>{let t=false;let r=false;let n=false;for(let o=0;o{if(!(typeof e==="string"||Array.isArray(e))){throw new TypeError("Expected the input to be `string | string[]`")}t=Object.assign({pascalCase:false},t);const postProcess=e=>t.pascalCase?e.charAt(0).toUpperCase()+e.slice(1):e;if(Array.isArray(e)){e=e.map((e=>e.trim())).filter((e=>e.length)).join("-")}else{e=e.trim()}if(e.length===0){return""}if(e.length===1){return t.pascalCase?e.toUpperCase():e.toLowerCase()}const r=e!==e.toLowerCase();if(r){e=preserveCamelCase(e)}e=e.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,((e,t)=>t.toUpperCase())).replace(/\d+(\w|$)/g,(e=>e.toUpperCase()));return postProcess(e)};e.exports=camelCase;e.exports["default"]=camelCase},1402:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t["default"]=compose;function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var n=r(7097);var o=_interopRequireDefault(n);var i=function compose2(e,t){return function(){return e(t.apply(undefined,arguments))}};function compose(){for(var e=arguments.length,t=Array(e),r=0;r=0&&n[s]){a=n[s].length}return(0,o["default"])(n.reduce(i),a)}e.exports=t["default"]},1849:(e,t,r)=>{"use strict";var n=r(2778),o=r(6123),i=r(1893),s=r(7909),a=r(5811),u=r(8894);var c=Function.prototype.bind,l=Object.defineProperty,f=Object.prototype.hasOwnProperty,p;p=function(e,t,r){var n=o(t)&&i(t.value),a;a=s(t);delete a.writable;delete a.value;a.get=function(){if(!r.overwriteDefinition&&f.call(this,e))return n;t.value=c.call(n,r.resolveContext?r.resolveContext(this):this);l(this,e,t);return this[e]};return a};e.exports=function(e){var t=a(arguments[1]);if(n(t.resolveContext))i(t.resolveContext);return u(e,(function(e,r){return p(r,e,t)}))}},1496:(e,t,r)=>{"use strict";var n=r(2778),o=r(604),i=r(1915),s=r(5811),a=r(9162);var u=e.exports=function(e,t){var r,o,u,c,l;if(arguments.length<2||typeof e!=="string"){c=t;t=e;e=null}else{c=arguments[2]}if(n(e)){r=a.call(e,"c");o=a.call(e,"e");u=a.call(e,"w")}else{r=u=true;o=false}l={value:t,configurable:r,enumerable:o,writable:u};return!c?l:i(s(c),l)};u.gs=function(e,t,r){var u,c,l,f;if(typeof e!=="string"){l=r;r=t;t=e;e=null}else{l=arguments[3]}if(!n(t)){t=undefined}else if(!o(t)){l=t;t=r=undefined}else if(!n(r)){r=undefined}else if(!o(r)){l=r;r=undefined}if(n(e)){u=a.call(e,"c");c=a.call(e,"e")}else{u=true;c=false}f={get:t,set:r,configurable:u,enumerable:c};return!l?f:i(s(l),f)}},6340:(e,t,r)=>{"use strict";var n=r(8734);e.exports=function(){n(this).length=0;return this}},7287:(e,t,r)=>{"use strict";e.exports=r(8779)()?Array.from:r(1095)},8779:e=>{"use strict";e.exports=function(){var e=Array.from,t,r;if(typeof e!=="function")return false;t=["raz","dwa"];r=e(t);return Boolean(r&&r!==t&&r[1]==="dwa")}},1095:(e,t,r)=>{"use strict";var n=r(7974).iterator,o=r(4277),i=r(53),s=r(7354),a=r(8801),u=r(8734),c=r(6446),l=r(3184),f=Array.isArray,p=Function.prototype.call,d={configurable:true,enumerable:true,writable:true,value:null},v=Object.defineProperty;e.exports=function(e){var t=arguments[1],r=arguments[2],h,y,g,_,b,m,x,w,S,j;e=Object(u(e));if(c(t))a(t);if(!this||this===Array||!i(this)){if(!t){if(o(e)){b=e.length;if(b!==1)return Array.apply(null,e);_=new Array(1);_[0]=e[0];return _}if(f(e)){_=new Array(b=e.length);for(y=0;y=55296&&m<=56319)j+=e[++y]}j=t?p.call(t,r,j,g):j;if(h){d.value=j;v(_,g,d)}else{_[g]=j}++g}b=g}}if(b===undefined){b=s(e.length);if(h)_=new h(b);for(y=0;y{"use strict";var t=Object.prototype.toString,r=t.call(function(){return arguments}());e.exports=function(e){return t.call(e)===r}},53:e=>{"use strict";var t=Object.prototype.toString,r=RegExp.prototype.test.bind(/^[object [A-Za-z0-9]*Function]$/);e.exports=function(e){return typeof e==="function"&&r(t.call(e))}},9953:e=>{"use strict";e.exports=function(){}},6666:(e,t,r)=>{"use strict";e.exports=r(8912)()?Math.sign:r(5375)},8912:e=>{"use strict";e.exports=function(){var e=Math.sign;if(typeof e!=="function")return false;return e(10)===1&&e(-20)===-1}},5375:e=>{"use strict";e.exports=function(e){e=Number(e);if(isNaN(e)||e===0)return e;return e>0?1:-1}},5034:(e,t,r)=>{"use strict";var n=r(6666),o=Math.abs,i=Math.floor;e.exports=function(e){if(isNaN(e))return 0;e=Number(e);if(e===0||!isFinite(e))return e;return n(e)*i(o(e))}},7354:(e,t,r)=>{"use strict";var n=r(5034),o=Math.max;e.exports=function(e){return o(0,n(e))}},2858:(e,t,r)=>{"use strict";var n=r(8801),o=r(8734),i=Function.prototype.bind,s=Function.prototype.call,a=Object.keys,u=Object.prototype.propertyIsEnumerable;e.exports=function(e,t){return function(r,c){var l,f=arguments[2],p=arguments[3];r=Object(o(r));n(c);l=a(r);if(p){l.sort(typeof p==="function"?i.call(p,r):undefined)}if(typeof e!=="function")e=l[e];return s.call(e,l,(function(e,n){if(!u.call(r,e))return t;return s.call(c,f,r[e],e,r,n)}))}}},1915:(e,t,r)=>{"use strict";e.exports=r(4479)()?Object.assign:r(3804)},4479:e=>{"use strict";e.exports=function(){var e=Object.assign,t;if(typeof e!=="function")return false;t={foo:"raz"};e(t,{bar:"dwa"},{trzy:"trzy"});return t.foo+t.bar+t.trzy==="razdwatrzy"}},3804:(e,t,r)=>{"use strict";var n=r(4407),o=r(8734),i=Math.max;e.exports=function(e,t){var r,s,a=i(arguments.length,2),u;e=Object(o(e));u=function(n){try{e[n]=t[n]}catch(e){if(!r)r=e}};for(s=1;s{"use strict";var n=r(7287),o=r(1915),i=r(8734);e.exports=function(e){var t=Object(i(e)),r=arguments[1],s=Object(arguments[2]);if(t!==e&&!r)return t;var a={};if(r){n(r,(function(t){if(s.ensure||t in e)a[t]=e[t]}))}else{o(a,e)}return a}},5576:(e,t,r)=>{"use strict";e.exports=r(2858)("forEach")},6446:(e,t,r)=>{"use strict";var n=r(9953)();e.exports=function(e){return e!==n&&e!==null}},4407:(e,t,r)=>{"use strict";e.exports=r(8829)()?Object.keys:r(5859)},8829:e=>{"use strict";e.exports=function(){try{Object.keys("primitive");return true}catch(e){return false}}},5859:(e,t,r)=>{"use strict";var n=r(6446);var o=Object.keys;e.exports=function(e){return o(n(e)?Object(e):e)}},8894:(e,t,r)=>{"use strict";var n=r(8801),o=r(5576),i=Function.prototype.call;e.exports=function(e,t){var r={},s=arguments[2];n(t);o(e,(function(e,n,o,a){r[n]=i.call(t,s,e,n,o,a)}));return r}},5811:(e,t,r)=>{"use strict";var n=r(6446);var o=Array.prototype.forEach,i=Object.create;var process=function(e,t){var r;for(r in e)t[r]=e[r]};e.exports=function(e){var t=i(null);o.call(arguments,(function(e){if(!n(e))return;process(Object(e),t)}));return t}},8801:e=>{"use strict";e.exports=function(e){if(typeof e!=="function")throw new TypeError(e+" is not a function");return e}},8734:(e,t,r)=>{"use strict";var n=r(6446);e.exports=function(e){if(!n(e))throw new TypeError("Cannot use null or undefined");return e}},9162:(e,t,r)=>{"use strict";e.exports=r(8447)()?String.prototype.contains:r(2433)},8447:e=>{"use strict";var t="razdwatrzy";e.exports=function(){if(typeof t.contains!=="function")return false;return t.contains("dwa")===true&&t.contains("foo")===false}},2433:e=>{"use strict";var t=String.prototype.indexOf;e.exports=function(e){return t.call(this,e,arguments[1])>-1}},3184:e=>{"use strict";var t=Object.prototype.toString,r=t.call("");e.exports=function(e){return typeof e==="string"||e&&typeof e==="object"&&(e instanceof String||t.call(e)===r)||false}},9553:(e,t,r)=>{"use strict";var n=r(6340),o=r(1915),i=r(8801),s=r(8734),a=r(1496),u=r(1849),c=r(7974);var l=Object.defineProperty,f=Object.defineProperties,p;e.exports=p=function(e,t){if(!(this instanceof p))throw new TypeError("Constructor requires 'new'");f(this,{__list__:a("w",s(e)),__context__:a("w",t),__nextIndex__:a("w",0)});if(!t)return;i(t.on);t.on("_add",this._onAdd);t.on("_delete",this._onDelete);t.on("_clear",this._onClear)};delete p.prototype.constructor;f(p.prototype,o({_next:a((function(){var e;if(!this.__list__)return undefined;if(this.__redo__){e=this.__redo__.shift();if(e!==undefined)return e}if(this.__nextIndex__=this.__nextIndex__)return;++this.__nextIndex__;if(!this.__redo__){l(this,"__redo__",a("c",[e]));return}this.__redo__.forEach((function(t,r){if(t>=e)this.__redo__[r]=++t}),this);this.__redo__.push(e)})),_onDelete:a((function(e){var t;if(e>=this.__nextIndex__)return;--this.__nextIndex__;if(!this.__redo__)return;t=this.__redo__.indexOf(e);if(t!==-1)this.__redo__.splice(t,1);this.__redo__.forEach((function(t,r){if(t>e)this.__redo__[r]=--t}),this)})),_onClear:a((function(){if(this.__redo__)n.call(this.__redo__);this.__nextIndex__=0}))})));l(p.prototype,c.iterator,a((function(){return this})))},7974:(e,t,r)=>{"use strict";e.exports=r(8802)()?r(1902).Symbol:r(627)},8802:(e,t,r)=>{"use strict";var n=r(1902),o={object:true,symbol:true};e.exports=function(){var e=n.Symbol;var t;if(typeof e!=="function")return false;t=e("test symbol");try{String(t)}catch(e){return false}if(!o[typeof e.iterator])return false;if(!o[typeof e.toPrimitive])return false;if(!o[typeof e.toStringTag])return false;return true}},8424:e=>{"use strict";e.exports=function(e){if(!e)return false;if(typeof e==="symbol")return true;if(!e.constructor)return false;if(e.constructor.name!=="Symbol")return false;return e[e.constructor.toStringTag]==="Symbol"}},3540:(e,t,r)=>{"use strict";var n=r(1496);var o=Object.create,i=Object.defineProperty,s=Object.prototype;var a=o(null);e.exports=function(e){var t=0,r,o;while(a[e+(t||"")])++t;e+=t||"";a[e]=true;r="@@"+e;i(s,r,n.gs(null,(function(e){if(o)return;o=true;i(this,r,n(e));o=false})));return r}},1427:(e,t,r)=>{"use strict";var n=r(1496),o=r(1902).Symbol;e.exports=function(e){return Object.defineProperties(e,{hasInstance:n("",o&&o.hasInstance||e("hasInstance")),isConcatSpreadable:n("",o&&o.isConcatSpreadable||e("isConcatSpreadable")),iterator:n("",o&&o.iterator||e("iterator")),match:n("",o&&o.match||e("match")),replace:n("",o&&o.replace||e("replace")),search:n("",o&&o.search||e("search")),species:n("",o&&o.species||e("species")),split:n("",o&&o.split||e("split")),toPrimitive:n("",o&&o.toPrimitive||e("toPrimitive")),toStringTag:n("",o&&o.toStringTag||e("toStringTag")),unscopables:n("",o&&o.unscopables||e("unscopables"))})}},4802:(e,t,r)=>{"use strict";var n=r(1496),o=r(7650);var i=Object.create(null);e.exports=function(e){return Object.defineProperties(e,{for:n((function(t){if(i[t])return i[t];return i[t]=e(String(t))})),keyFor:n((function(e){var t;o(e);for(t in i){if(i[t]===e)return t}return undefined}))})}},627:(e,t,r)=>{"use strict";var n=r(1496),o=r(7650),i=r(1902).Symbol,s=r(3540),a=r(1427),u=r(4802);var c=Object.create,l=Object.defineProperties,f=Object.defineProperty;var p,d,v;if(typeof i==="function"){try{String(i());v=true}catch(e){}}else{i=null}d=function Symbol(e){if(this instanceof d)throw new TypeError("Symbol is not a constructor");return p(e)};e.exports=p=function Symbol(e){var t;if(this instanceof Symbol)throw new TypeError("Symbol is not a constructor");if(v)return i(e);t=c(d.prototype);e=e===undefined?"":String(e);return l(t,{__description__:n("",e),__name__:n("",s(e))})};a(p);u(p);l(d.prototype,{constructor:n(p),toString:n("",(function(){return this.__name__}))});l(p.prototype,{toString:n((function(){return"Symbol ("+o(this).__description__+")"})),valueOf:n((function(){return o(this)}))});f(p.prototype,p.toPrimitive,n("",(function(){var e=o(this);if(typeof e==="symbol")return e;return e.toString()})));f(p.prototype,p.toStringTag,n("c","Symbol"));f(d.prototype,p.toStringTag,n("c",p.prototype[p.toStringTag]));f(d.prototype,p.toPrimitive,n("c",p.prototype[p.toPrimitive]))},7650:(e,t,r)=>{"use strict";var n=r(8424);e.exports=function(e){if(!n(e))throw new TypeError(e+" is not a symbol");return e}},8995:e=>{var naiveFallback=function(){if(typeof self==="object"&&self)return self;if(typeof window==="object"&&window)return window;throw new Error("Unable to resolve global `this`")};e.exports=function(){if(this)return this;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:true})}catch(e){return naiveFallback()}try{if(!__global__)return naiveFallback();return __global__}finally{delete Object.prototype.__global__}}()},1902:(e,t,r)=>{"use strict";e.exports=r(5088)()?globalThis:r(8995)},5088:e=>{"use strict";e.exports=function(){if(typeof globalThis!=="object")return false;if(!globalThis)return false;return globalThis.Array===Array}},2683:e=>{"use strict";var t=e.exports=function(e){if(typeof e!=="string"){throw new Error("Invalid input. Input must be a string")}var t=e.match(/(\/?)(.+)\1([a-z]*)/i);if(t[3]&&!/^(?!.*?(.).*?\1)[gmixXsuUAJ]+$/.test(t[3])){return RegExp(e)}return new RegExp(t[2],t[3])}},3444:(e,t,r)=>{"use strict";var n=r(1017),o=r(7147),i=r(9240),s=r(4093),a=r(4749).SourceMapConsumer;var u=r(6906);var c=r(8264);var l=r(6108);var f=r(2242);var p=r(6169).u2;function resolveUrlLoader(e,t){var d=this;if(/^\./.test(d.context)){return handleAsError("webpack misconfiguration","loader.context is relative, expected absolute")}var v=Object.assign({sourceMap:d.sourceMap,engine:"postcss",silent:false,absolute:false,keepQuery:false,removeCR:false,root:false,debug:false,join:l.defaultJoin},!!d.options&&d.options[s(p)],i.getOptions(d));f(v);if("attempts"in v){handleAsWarning("loader misconfiguration",'"attempts" option is defunct (consider "join" option if search is needed)')}if("includeRoot"in v){handleAsWarning("loader misconfiguration",'"includeRoot" option is defunct (consider "join" option if search is needed)')}if("fail"in v){handleAsWarning("loader misconfiguration",'"fail" option is defunct')}if(typeof v.join!=="function"){return handleAsError("loader misconfiguration",'"join" option must be a Function')}else if(v.join.length!==2){return handleAsError("loader misconfiguration",'"join" Function must take exactly 2 arguments (filename and options hash)')}if(typeof v.root==="string"){var h=v.root===""||n.isAbsolute(v.root)&&o.existsSync(v.root)&&o.statSync(v.root).isDirectory();if(!h){return handleAsError("loader misconfiguration",'"root" option must be an empty string or an absolute path to an existing directory')}}else if(v.root!==false){handleAsWarning("loader misconfiguration",'"root" option must be string where used or false where unused')}d.cacheable();var y,g;if(t){if(typeof t==="string"){try{t=JSON.parse(t)}catch(e){return handleAsError("source-map error","cannot parse source-map string (from less-loader?)")}}try{g=u(d,{format:"absolute"},t)}catch(e){return handleAsError("source-map error",e.message)}y=new a(g)}var _=/^\w+$/.test(v.engine)&&r.ab+"engine/"+v.engine+".js";var b=o.existsSync(_);if(!b){return handleAsError("loader misconfiguration",'"engine" option is not valid')}var m=d.async();Promise.resolve(require(_)(d.resourcePath,e,{outputSourceMap:!!v.sourceMap,transformDeclaration:c(d.resourcePath,v),absSourceMap:g,sourceMapConsumer:y,removeCR:v.removeCR})).catch(onFailure).then(onSuccess);function onFailure(e){m(encodeError("CSS error",e))}function onSuccess(e){if(e){if(v.sourceMap){var t=u(d,{format:"sourceRelative"},e.map);m(null,e.content,t)}else{m(null,e.content)}}}function handleAsWarning(t,r){if(!v.silent){d.emitWarning(encodeError(t,r))}return e}function handleAsError(t,r){d.emitError(encodeError(t,r));return e}function encodeError(e,t){return new Error([p,": ",[e].concat(typeof t==="string"&&t||t instanceof Error&&[t.message,t.stack.split("\n")[1].trim()]||[]).filter(Boolean).join("\n ")].join(""))}}e.exports=Object.assign(resolveUrlLoader,l)},6108:(e,t,r)=>{"use strict";var n=r(1017),o=r(7147),i=r(1402),s=r(9553);var a=r(6169).u2;var u=i(n.normalize,n.join);t.defaultJoin=createJoinForPredicate((function predicate(e,t,r,n,i){var s=u(r,t);return o.existsSync(s)?s:i(n===0?s:null)}),"defaultJoin");function createJoinForPredicate(e,t){function join(t,r){var o=createDebugLogger(r.debug);return function joinProper(i,a){var u=typeof a==="undefined"&&new s([r.root])||typeof a==="string"&&new s([a])||a;var c=runIterator([]);o(createJoinMsg,[t,i,c,c.isFound]);return typeof c.absolute==="string"?c.absolute:i;function runIterator(r){var o=u.next();var s=!o.done&&o.value;if(typeof s==="string"){var a=e(t,i,s,r.length,next);if(typeof a==="string"&&n.isAbsolute(a)){return Object.assign(r.concat(s),{isFound:true,absolute:a})}else if(Array.isArray(a)){return a}else{throw new Error("predicate must return an absolute path or the result of calling next()")}}else{return r}function next(e){return runIterator(Object.assign(r.concat(s),typeof e==="string"&&{absolute:e}))}}}}function toString(){return"[Function: "+t+"]"}return Object.assign(join,t&&{valueOf:toString,toString:toString})}t.createJoinForPredicate=createJoinForPredicate;function createJoinMsg(e,t,r,o){return[a+": "+pathToString(e)+": "+t].concat(r.map(pathToString).filter(Boolean)).concat(o?"FOUND":"NOT FOUND").join("\n ");function pathToString(e){if(!e){return null}else{var t=n.relative(process.cwd(),e).split(n.sep);return(t[0]===".."?e.split(n.sep):["."].concat(t).filter(Boolean)).join("/")}}}t.createJoinMsg=createJoinMsg;function createDebugLogger(e){var t=!!e&&(typeof e==="function"?e:console.log);var r={};return t?actuallyLog:noop;function noop(){}function actuallyLog(e,n){var o=JSON.stringify(n);if(!r[o]){r[o]=true;t(e.apply(null,n))}}}t.createDebugLogger=createDebugLogger},2242:(e,t,r)=>{"use strict";var n=r(2781);var o=process[process.env.RESOLVE_URL_LOADER_TEST_HARNESS];function logToTestHarness(e){if(!!o&&typeof o==="object"&&o instanceof n.Writable){Object.keys(e).map(eachOptionKey);o=null}function eachOptionKey(t){var r=e[t];var n=typeof r==="undefined"?String(r):JSON.stringify(r.valueOf())||"-unstringifyable-";o.write(t+": "+n+"\n")}}e.exports=logToTestHarness},8264:(e,t,r)=>{"use strict";var n=r(1017),o=r(9240);function valueProcessor(e,t){var r=/(url\s*\()\s*(?:(['"])((?:(?!\2).)*)(\2)|([^'"](?:(?!\)).)*[^'"]))\s*(\))/g;var i=n.dirname(e);var s=t.join(e,t);return function transformValue(e,a){return e.split(r).map(eachSplitOrGroup).join("");function eachSplitOrGroup(e,r,u){var c=e||"";var l=r%7;if(l===3||l===5){var f=u[r-1],p=u[r+1],d=f===p&&(f==="'"||f==='"'),v=d?c.replace(/\\{2}/g,"\\"):c;var h=v.split(/([?#])/g),y=h[0],g=testIsRelative(y)&&s(y,a)||testIsAbsolute(y)&&s(y),_=t.keepQuery?h.slice(1).join(""):"";if(!g){return c}else if(t.absolute){return g.replace(/\\/g,"/")+_}else{return o.urlToRequest(n.relative(i,g).replace(/\\/g,"/")+_)}}else{return c}}};function testIsRelative(e){return!!e&&o.isUrlRequest(e,false)&&!n.isAbsolute(e)&&e.indexOf("~")!==0}function testIsAbsolute(e){return!!e&&typeof t.root==="string"&&o.isUrlRequest(e,t.root)&&(/^\//.test(e)||n.isAbsolute(e))}}e.exports=valueProcessor},2686:(e,t,r)=>{"use strict";var n=r(1466);e.exports=function(e){if(typeof e!=="function")return false;if(!hasOwnProperty.call(e,"length"))return false;try{if(typeof e.length!=="number")return false;if(typeof e.call!=="function")return false;if(typeof e.apply!=="function")return false}catch(e){return false}return!n(e)}},901:(e,t,r)=>{"use strict";var n=r(2778),o=r(678),i=r(5534),s=r(8513);var resolveMessage=function(e,t){return e.replace("%v",s(t))};e.exports=function(e,t,r){if(!o(r))throw new TypeError(resolveMessage(t,e));if(!n(e)){if("default"in r)return r["default"];if(r.isOptional)return null}var s=i(r.errorMessage);if(!n(s))s=t;throw new TypeError(resolveMessage(s,e))}},9831:e=>{"use strict";e.exports=function(e){try{return e.toString()}catch(t){try{return String(e)}catch(e){return null}}}},8513:(e,t,r)=>{"use strict";var n=r(9831);var o=/[\n\r\u2028\u2029]/g;e.exports=function(e){var t=n(e);if(t===null)return"";if(t.length>100)t=t.slice(0,99)+"…";t=t.replace(o,(function(e){switch(e){case"\n":return"\\n";case"\r":return"\\r";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw new Error("Unexpected character")}}));return t}},678:(e,t,r)=>{"use strict";var n=r(2778);var o={object:true,function:true,undefined:true};e.exports=function(e){if(!n(e))return false;return hasOwnProperty.call(o,typeof e)}},1893:(e,t,r)=>{"use strict";var n=r(901),o=r(604);e.exports=function(e){if(o(e))return e;return n(e,"%v is not a plain function",arguments[1])}},604:(e,t,r)=>{"use strict";var n=r(2686);var o=/^\s*class[\s{/}]/,i=Function.prototype.toString;e.exports=function(e){if(!n(e))return false;if(o.test(i.call(e)))return false;return true}},1466:(e,t,r)=>{"use strict";var n=r(678);e.exports=function(e){if(!n(e))return false;try{if(!e.constructor)return false;return e.constructor.prototype===e}catch(e){return false}}},5534:(e,t,r)=>{"use strict";var n=r(2778),o=r(678);var i=Object.prototype.toString;e.exports=function(e){if(!n(e))return null;if(o(e)){var t=e.toString;if(typeof t!=="function")return null;if(t===i)return null}try{return""+e}catch(e){return null}}},6123:(e,t,r)=>{"use strict";var n=r(901),o=r(2778);e.exports=function(e){if(o(e))return e;return n(e,"Cannot use %v",arguments[1])}},2778:e=>{"use strict";var t=void 0;e.exports=function(e){return e!==t&&e!==null}},9491:e=>{"use strict";e.exports=require("assert")},7147:e=>{"use strict";e.exports=require("fs")},9240:e=>{"use strict";e.exports=require("next/dist/compiled/loader-utils2")},4749:e=>{"use strict";e.exports=require("next/dist/compiled/source-map")},1017:e=>{"use strict";e.exports=require("path")},2781:e=>{"use strict";e.exports=require("stream")},7515:e=>{"use strict";e.exports=JSON.parse('{"u2":"adjust-sourcemap-loader"}')},6169:e=>{"use strict";e.exports=JSON.parse('{"u2":"resolve-url-loader"}')}};var t={};function __nccwpck_require__(r){var n=t[r];if(n!==undefined){return n.exports}var o=t[r]={exports:{}};var i=true;try{e[r](o,o.exports,__nccwpck_require__);i=false}finally{if(i)delete t[r]}return o.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(3444);module.exports=r})(); \ No newline at end of file diff --git a/packages/next/compiled/resolve-url-loader/package.json b/packages/next/compiled/resolve-url-loader/package.json deleted file mode 100644 index bfb22b9e82b87..0000000000000 --- a/packages/next/compiled/resolve-url-loader/package.json +++ /dev/null @@ -1 +0,0 @@ -{"name":"resolve-url-loader","main":"index.js","author":"bholloway","license":"MIT"} diff --git a/packages/next/compiled/setimmediate/package.json b/packages/next/compiled/setimmediate/package.json new file mode 100644 index 0000000000000..71242d0ebed17 --- /dev/null +++ b/packages/next/compiled/setimmediate/package.json @@ -0,0 +1 @@ +{"name":"setimmediate","main":"setImmediate.js","author":"YuzuJS","license":"MIT"} diff --git a/packages/next/compiled/setimmediate/setImmediate.js b/packages/next/compiled/setimmediate/setImmediate.js new file mode 100644 index 0000000000000..774689c569e11 --- /dev/null +++ b/packages/next/compiled/setimmediate/setImmediate.js @@ -0,0 +1 @@ +(function(){var e={619:function(){(function(e,t){"use strict";if(e.setImmediate){return}var n=1;var a={};var s=false;var i=e.document;var r;function setImmediate(e){if(typeof e!=="function"){e=new Function(""+e)}var t=new Array(arguments.length-1);for(var s=0;s=0){e._idleTimeoutId=setTimeout((function onTimeout(){if(e._onTimeout)e._onTimeout()}),t)}};n(619);t.setImmediate=typeof self!=="undefined"&&self.setImmediate||typeof global!=="undefined"&&global.setImmediate||this&&this.setImmediate;t.clearImmediate=typeof self!=="undefined"&&self.clearImmediate||typeof global!=="undefined"&&global.clearImmediate||this&&this.clearImmediate}};var t={};function __nccwpck_require__(n){var a=t[n];if(a!==undefined){return a.exports}var i=t[n]={exports:{}};var o=true;try{e[n].call(i.exports,i,i.exports,__nccwpck_require__);o=false}finally{if(o)delete t[n]}return i.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var n=__nccwpck_require__(832);module.exports=n})(); \ No newline at end of file +(function(){var e={832:function(e,t,i){var o=typeof global!=="undefined"&&global||typeof self!=="undefined"&&self||window;var n=Function.prototype.apply;t.setTimeout=function(){return new Timeout(n.call(setTimeout,o,arguments),clearTimeout)};t.setInterval=function(){return new Timeout(n.call(setInterval,o,arguments),clearInterval)};t.clearTimeout=t.clearInterval=function(e){if(e){e.close()}};function Timeout(e,t){this._id=e;this._clearFn=t}Timeout.prototype.unref=Timeout.prototype.ref=function(){};Timeout.prototype.close=function(){this._clearFn.call(o,this._id)};t.enroll=function(e,t){clearTimeout(e._idleTimeoutId);e._idleTimeout=t};t.unenroll=function(e){clearTimeout(e._idleTimeoutId);e._idleTimeout=-1};t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;if(t>=0){e._idleTimeoutId=setTimeout((function onTimeout(){if(e._onTimeout)e._onTimeout()}),t)}};i(505);t.setImmediate=typeof self!=="undefined"&&self.setImmediate||typeof global!=="undefined"&&global.setImmediate||this&&this.setImmediate;t.clearImmediate=typeof self!=="undefined"&&self.clearImmediate||typeof global!=="undefined"&&global.clearImmediate||this&&this.clearImmediate},505:function(e){"use strict";e.exports=require("next/dist/compiled/setimmediate")}};var t={};function __nccwpck_require__(i){var o=t[i];if(o!==undefined){return o.exports}var n=t[i]={exports:{}};var r=true;try{e[i].call(n.exports,n,n.exports,__nccwpck_require__);r=false}finally{if(r)delete t[i]}return n.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var i=__nccwpck_require__(832);module.exports=i})(); \ No newline at end of file diff --git a/packages/next/lib/load-custom-routes.ts b/packages/next/lib/load-custom-routes.ts index c80c2eeb3ae8c..1cad863a23274 100644 --- a/packages/next/lib/load-custom-routes.ts +++ b/packages/next/lib/load-custom-routes.ts @@ -2,7 +2,7 @@ import chalk from 'next/dist/compiled/chalk' import { parse as parseUrl } from 'url' import { NextConfig } from '../server/config' import * as pathToRegexp from 'next/dist/compiled/path-to-regexp' -import escapeStringRegexp from 'next/dist/compiled/escape-string-regexp' +import { escapeStringRegexp } from '../shared/lib/escape-regexp' import { PERMANENT_REDIRECT_STATUS, TEMPORARY_REDIRECT_STATUS, diff --git a/packages/next/package.json b/packages/next/package.json index c06afd862a7e1..e7442ee8955a3 100644 --- a/packages/next/package.json +++ b/packages/next/package.json @@ -1,6 +1,6 @@ { "name": "next", - "version": "12.0.8-canary.13", + "version": "12.0.8-canary.17", "description": "The React Framework", "main": "./dist/server/next.js", "license": "MIT", @@ -71,8 +71,8 @@ ] }, "dependencies": { - "@next/env": "12.0.8-canary.13", - "@next/react-refresh-utils": "12.0.8-canary.13", + "@next/env": "12.0.8-canary.17", + "@next/react-refresh-utils": "12.0.8-canary.17", "caniuse-lite": "^1.0.30001283", "jest-worker": "27.0.0-next.5", "node-fetch": "2.6.1", @@ -125,10 +125,10 @@ "@hapi/accept": "5.0.2", "@napi-rs/cli": "1.2.1", "@napi-rs/triples": "1.0.3", - "@next/polyfill-module": "12.0.8-canary.13", - "@next/polyfill-nomodule": "12.0.8-canary.13", - "@next/react-dev-overlay": "12.0.8-canary.13", - "@next/swc": "12.0.8-canary.13", + "@next/polyfill-module": "12.0.8-canary.17", + "@next/polyfill-nomodule": "12.0.8-canary.17", + "@next/react-dev-overlay": "12.0.8-canary.17", + "@next/swc": "12.0.8-canary.17", "@peculiar/webcrypto": "1.1.7", "@taskr/clear": "1.1.0", "@taskr/esnext": "1.1.0", @@ -194,7 +194,6 @@ "debug": "4.1.1", "devalue": "2.0.1", "domain-browser": "4.19.0", - "escape-string-regexp": "2.0.0", "etag": "1.8.1", "events": "3.3.0", "find-cache-dir": "3.3.1", @@ -238,16 +237,17 @@ "postcss-scss": "3.0.5", "postcss-value-parser": "4.1.0", "process": "0.11.10", + "punycode": "2.1.1", "querystring-es3": "0.2.1", "raw-body": "2.4.1", "react-server-dom-webpack": "0.0.0-experimental-13455d26d-20211104", "regenerator-runtime": "0.13.4", - "resolve-url-loader": "3.1.2", "sass-loader": "10.2.0", "schema-utils2": "npm:schema-utils@2.7.1", "schema-utils3": "npm:schema-utils@3.0.0", "semver": "7.3.2", "send": "0.17.1", + "setimmediate": "1.0.5", "source-map": "0.6.1", "stream-http": "3.1.1", "string-hash": "1.1.3", diff --git a/packages/next/pages/_document.tsx b/packages/next/pages/_document.tsx index c1c00608dc5fb..8d314577f4584 100644 --- a/packages/next/pages/_document.tsx +++ b/packages/next/pages/_document.tsx @@ -452,21 +452,30 @@ export class Head extends Component< makeStylesheetInert(node: ReactNode): ReactNode[] { return React.Children.map(node, (c: any) => { if ( - c.type === 'link' && - c.props['href'] && + c?.type === 'link' && + c?.props?.href && OPTIMIZED_FONT_PROVIDERS.some(({ url }) => - c.props['href'].startsWith(url) + c?.props?.href?.startsWith(url) ) ) { - const newProps = { ...(c.props || {}) } - newProps['data-href'] = newProps['href'] - newProps['href'] = undefined + const newProps = { + ...(c.props || {}), + 'data-href': c.props.href, + href: undefined, + } + + return React.cloneElement(c, newProps) + } else if (c?.props?.children) { + const newProps = { + ...(c.props || {}), + children: this.makeStylesheetInert(c.props.children), + } + return React.cloneElement(c, newProps) - } else if (c.props && c.props['children']) { - c.props['children'] = this.makeStylesheetInert(c.props['children']) } + return c - }) + }).filter(Boolean) } render() { diff --git a/packages/next/shared/lib/escape-regexp.ts b/packages/next/shared/lib/escape-regexp.ts new file mode 100644 index 0000000000000..4d009f53b6f0a --- /dev/null +++ b/packages/next/shared/lib/escape-regexp.ts @@ -0,0 +1,4 @@ +// regexp from https://github.com/sindresorhus/escape-string-regexp +export function escapeStringRegexp(str: string) { + return str.replace(/[|\\{}()[\]^$+*?.-]/g, '\\$&') +} diff --git a/packages/next/shared/lib/post-process.ts b/packages/next/shared/lib/post-process.ts index ad76b736bba4f..f214c37df7099 100644 --- a/packages/next/shared/lib/post-process.ts +++ b/packages/next/shared/lib/post-process.ts @@ -1,4 +1,4 @@ -import escapeRegexp from 'next/dist/compiled/escape-string-regexp' +import { escapeStringRegexp } from './escape-regexp' import { parse, HTMLElement } from 'next/dist/compiled/node-html-parser' import { OPTIMIZED_FONT_PROVIDERS } from './constants' @@ -216,7 +216,7 @@ function isImgEligible(imgElement: HTMLElement): boolean { } function preloadTagAlreadyExists(html: string, href: string) { - const escapedHref = escapeRegexp(href) + const escapedHref = escapeStringRegexp(href) const regex = new RegExp(`]*href[^>]*${escapedHref}`) return html.match(regex) } diff --git a/packages/next/shared/lib/router/router.ts b/packages/next/shared/lib/router/router.ts index af1eaf0656fc4..0245de4740487 100644 --- a/packages/next/shared/lib/router/router.ts +++ b/packages/next/shared/lib/router/router.ts @@ -63,6 +63,7 @@ interface NextHistoryState { } interface PreflightData { + cache?: string | null redirect?: string | null refresh?: boolean rewrite?: string | null @@ -1615,7 +1616,7 @@ export default class Router implements BaseRouter { } scrollToHash(as: string): void { - const [, hash] = as.split('#') + const [, hash = ''] = as.split('#') // Scroll to top if the hash is just `#` with no value or `#top` // To mirror browsers if (hash === '' || hash === 'top') { @@ -1950,6 +1951,7 @@ export default class Router implements BaseRouter { } return { + cache: res.headers.get('x-middleware-cache'), redirect: res.headers.get('Location'), refresh: res.headers.has('x-middleware-refresh'), rewrite: res.headers.get('x-middleware-rewrite'), @@ -1957,7 +1959,7 @@ export default class Router implements BaseRouter { } }) .then((data) => { - if (shouldCache) { + if (shouldCache && data.cache !== 'no-cache') { this.sde[cacheKey] = data } diff --git a/packages/next/shared/lib/router/utils/prepare-destination.ts b/packages/next/shared/lib/router/utils/prepare-destination.ts index 37a296728df61..991d125f7307b 100644 --- a/packages/next/shared/lib/router/utils/prepare-destination.ts +++ b/packages/next/shared/lib/router/utils/prepare-destination.ts @@ -4,7 +4,7 @@ import type { NextParsedUrlQuery } from '../../../../server/request-meta' import type { Params } from '../../../../server/router' import type { RouteHas } from '../../../../lib/load-custom-routes' import { compile, pathToRegexp } from 'next/dist/compiled/path-to-regexp' -import escapeStringRegexp from 'next/dist/compiled/escape-string-regexp' +import { escapeStringRegexp } from '../../escape-regexp' import { parseUrl } from './parse-url' export function matchHas( diff --git a/packages/next/shared/lib/utils.ts b/packages/next/shared/lib/utils.ts index 34b948691263e..bbee6dc34aa6c 100644 --- a/packages/next/shared/lib/utils.ts +++ b/packages/next/shared/lib/utils.ts @@ -456,6 +456,6 @@ export interface CacheFs { readFile(f: string): Promise readFileSync(f: string): string writeFile(f: string, d: any): Promise - mkdir(dir: string): Promise + mkdir(dir: string): Promise stat(f: string): Promise<{ mtime: Date }> } diff --git a/packages/next/taskfile.js b/packages/next/taskfile.js index 650cd3a1dcf9c..f0c348e9c57c9 100644 --- a/packages/next/taskfile.js +++ b/packages/next/taskfile.js @@ -510,6 +510,32 @@ export async function ncc_util(task, opts) { .target('compiled/util') } +// eslint-disable-next-line camelcase +export async function ncc_punycode(task, opts) { + await task + .source(opts.src || relative(__dirname, require.resolve('punycode/'))) + .ncc({ + packageName: 'punycode', + externals, + mainFields: ['browser', 'main'], + target: 'es5', + }) + .target('compiled/punycode') +} + +// eslint-disable-next-line camelcase +export async function ncc_set_immediate(task, opts) { + await task + .source(opts.src || relative(__dirname, require.resolve('setimmediate/'))) + .ncc({ + packageName: 'setimmediate', + externals, + mainFields: ['browser', 'main'], + target: 'es5', + }) + .target('compiled/setimmediate') +} + // eslint-disable-next-line camelcase export async function ncc_timers_browserify(task, opts) { await task @@ -518,7 +544,10 @@ export async function ncc_timers_browserify(task, opts) { ) .ncc({ packageName: 'timers-browserify', - externals, + externals: { + ...externals, + setimmediate: 'next/dist/compiled/setimmediate', + }, mainFields: ['browser', 'main'], target: 'es5', }) @@ -741,16 +770,6 @@ export async function ncc_devalue(task, opts) { .ncc({ packageName: 'devalue', externals }) .target('compiled/devalue') } -externals['escape-string-regexp'] = 'next/dist/compiled/escape-string-regexp' -// eslint-disable-next-line camelcase -export async function ncc_escape_string_regexp(task, opts) { - await task - .source( - opts.src || relative(__dirname, require.resolve('escape-string-regexp')) - ) - .ncc({ packageName: 'escape-string-regexp', externals, target: 'es5' }) - .target('compiled/escape-string-regexp') -} // eslint-disable-next-line camelcase externals['find-cache-dir'] = 'next/dist/compiled/find-cache-dir' @@ -1099,22 +1118,6 @@ export async function copy_react_server_dom_webpack(task, opts) { .target('compiled/react-server-dom-webpack') } -// eslint-disable-next-line camelcase -externals['resolve-url-loader'] = 'next/dist/compiled/resolve-url-loader' -export async function ncc_resolve_url_loader(task, opts) { - await task - .source( - opts.src || relative(__dirname, require.resolve('resolve-url-loader')) - ) - .ncc({ - packageName: 'resolve-url-loader', - externals: { - ...externals, - 'loader-utils': externals['loader-utils2'], // actually loader-utils@1 but that is compatible - }, - }) - .target('compiled/resolve-url-loader') -} // eslint-disable-next-line camelcase externals['sass-loader'] = 'next/dist/compiled/sass-loader' export async function ncc_sass_loader(task, opts) { @@ -1470,6 +1473,8 @@ export async function ncc(task, opts) { 'ncc_querystring_es3', 'ncc_string_decoder', 'ncc_util', + 'ncc_punycode', + 'ncc_set_immediate', 'ncc_timers_browserify', 'ncc_tty_browserify', 'ncc_vm_browserify', @@ -1485,7 +1490,6 @@ export async function ncc(task, opts) { 'ncc_cross_spawn', 'ncc_debug', 'ncc_devalue', - 'ncc_escape_string_regexp', 'ncc_find_cache_dir', 'ncc_find_up', 'ncc_fresh', @@ -1516,7 +1520,6 @@ export async function ncc(task, opts) { 'ncc_postcss_modules_values', 'ncc_postcss_value_parser', 'ncc_icss_utils', - 'ncc_resolve_url_loader', 'ncc_sass_loader', 'ncc_schema_utils2', 'ncc_schema_utils3', diff --git a/packages/next/trace/report/to-json.ts b/packages/next/trace/report/to-json.ts index 188ed48bdf5e2..0007f420ea01e 100644 --- a/packages/next/trace/report/to-json.ts +++ b/packages/next/trace/report/to-json.ts @@ -12,9 +12,9 @@ const localEndpoint = { type Event = { traceId: string - parentId?: string + parentId?: number name: string - id: string + id: number timestamp: number duration: number localEndpoint?: typeof localEndpoint @@ -119,8 +119,8 @@ const reportToLocalHost = ( name: string, duration: number, timestamp: number, - id: string, - parentId?: string, + id: number, + parentId?: number, attrs?: Object ) => { const distDir = traceGlobals.get('distDir') diff --git a/packages/next/trace/shared.ts b/packages/next/trace/shared.ts index 159218db82085..1c04cc8ce442e 100644 --- a/packages/next/trace/shared.ts +++ b/packages/next/trace/shared.ts @@ -1,6 +1,4 @@ -// eslint typescript has a bug with TS enums - -export type SpanId = string +export type SpanId = number export const traceGlobals: Map = new Map() export const setGlobal = (key: any, val: any) => { diff --git a/packages/next/trace/trace.ts b/packages/next/trace/trace.ts index 06fc6d0b9dfd6..fcebd1813e2a4 100644 --- a/packages/next/trace/trace.ts +++ b/packages/next/trace/trace.ts @@ -1,10 +1,12 @@ -import { customAlphabet } from 'next/dist/compiled/nanoid/index.cjs' import { SpanId } from './shared' import { reporter } from './report' const NUM_OF_MICROSEC_IN_SEC = BigInt('1000') -const nanoid = customAlphabet('0123456789abcdefghijklmnopqrstuvwxyz', 8) -const getId = () => Buffer.from(nanoid(), 'utf8').toString('hex') +let count = 0 +const getId = () => { + count++ + return count +} // eslint typescript has a bug with TS enums /* eslint-disable no-shadow */ diff --git a/packages/next/types/misc.d.ts b/packages/next/types/misc.d.ts index 24ea1ee3ea244..e6754f991e750 100644 --- a/packages/next/types/misc.d.ts +++ b/packages/next/types/misc.d.ts @@ -164,10 +164,6 @@ declare module 'next/dist/compiled/devalue' { import m from 'devalue' export = m } -declare module 'next/dist/compiled/escape-string-regexp' { - import m from 'escape-string-regexp' - export = m -} declare module 'next/dist/compiled/find-up' { import m from 'find-up' export = m diff --git a/packages/react-dev-overlay/package.json b/packages/react-dev-overlay/package.json index 9f76cba49ae42..a22e41895c55c 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": "12.0.8-canary.13", + "version": "12.0.8-canary.17", "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 98a633e3b1530..447adca6df43d 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": "12.0.8-canary.13", + "version": "12.0.8-canary.17", "description": "An experimental package providing utilities for React Refresh.", "repository": { "url": "vercel/next.js", diff --git a/scripts/send-trace-to-jaeger.mjs b/scripts/send-trace-to-jaeger.mjs deleted file mode 100644 index 60add090a536f..0000000000000 --- a/scripts/send-trace-to-jaeger.mjs +++ /dev/null @@ -1,68 +0,0 @@ -import fs from 'fs' -import eventStream from 'event-stream' -import retry from 'async-retry' -import fetch from 'node-fetch' - -const file = fs.createReadStream(process.argv[2]) - -const localEndpoint = { - serviceName: 'nextjs', - ipv4: '127.0.0.1', - port: 9411, -} - -// Jaeger supports Zipkin's reporting API -const zipkinUrl = `http://${localEndpoint.ipv4}:${localEndpoint.port}` -const jaegerWebUiUrl = `http://${localEndpoint.ipv4}:16686` -const zipkinAPI = `${zipkinUrl}/api/v2/spans` - -let loggedUrl = false - -function logWebUrl(traceId) { - console.log( - `Jaeger trace will be available on ${jaegerWebUiUrl}/trace/${traceId}` - ) -} -file.pipe(eventStream.split()).pipe( - eventStream.map((data, cb) => { - if (data === '') { - return cb(null, '') - } - - const eventsJson = JSON.parse(data).map((item) => { - item.localEndpoint = localEndpoint - return item - }) - if (!loggedUrl) { - logWebUrl(eventsJson[0].traceId) - loggedUrl = true - } - retry( - () => - // Send events to zipkin - fetch(zipkinAPI, { - method: 'POST', - headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(eventsJson), - }), - { minTimeout: 500, retries: 3, factor: 1 } - ) - .then(async (res) => { - if (res.status !== 202) { - console.dir( - { - status: res.status, - body: await res.text(), - events: eventsJson, - }, - { depth: null } - ) - } - cb(null, '') - }) - .catch((err) => { - console.log(err) - cb(null, '') - }) - }) -) diff --git a/scripts/send-trace-to-jaeger/src/main.rs b/scripts/send-trace-to-jaeger/src/main.rs index d291b2ed24927..a785171bd37ee 100644 --- a/scripts/send-trace-to-jaeger/src/main.rs +++ b/scripts/send-trace-to-jaeger/src/main.rs @@ -37,6 +37,15 @@ fn send_json_to_zipkin(zipkin_api: &str, value: String) { println!("body = {:?}", res.text()); } +// function to append zero to a number until 16 characters +fn pad_zeros(num: u64) -> String { + let mut num_str = num.to_string(); + while num_str.len() < 16 { + num_str = format!("0{}", num_str); + } + num_str +} + fn main() { let service_name = "nextjs"; let ipv4 = "127.0.0.1"; @@ -68,6 +77,13 @@ fn main() { logged_url = true; } data["localEndpoint"] = Value::Object(local_endpoint.clone()); + + data["id"] = Value::String(pad_zeros(data["id"].as_u64().unwrap())); + if data["parentId"] != Value::Null { + data["parentId"] = + Value::String(pad_zeros(data["parentId"].as_u64().unwrap())); + } + data }) .collect::(), @@ -79,6 +95,8 @@ fn main() { let json_map = serde_json::to_string(&v).expect("Failed to serialize"); + // println!("{:}", json_map); + send_json_to_zipkin(&zipkin_api, json_map); } } diff --git a/test/integration/polyfill-node-modules/test/index.test.js b/test/development/basic/node-browser-polyfills.test.ts similarity index 70% rename from test/integration/polyfill-node-modules/test/index.test.js rename to test/development/basic/node-browser-polyfills.test.ts index 0b10c4d09c546..de6352b400231 100644 --- a/test/integration/polyfill-node-modules/test/index.test.js +++ b/test/development/basic/node-browser-polyfills.test.ts @@ -1,22 +1,22 @@ -/* eslint-env jest */ - import { join } from 'path' import webdriver from 'next-webdriver' -import { findPort, launchApp, killApp } from 'next-test-utils' +import { createNext, FileRef } from 'e2e-utils' +import { NextInstance } from 'test/lib/next-modes/base' -const appDir = join(__dirname, '../') -let appPort -let app +describe('theme-ui SWC option', () => { + let next: NextInstance -describe('Basic Features', () => { beforeAll(async () => { - appPort = await findPort() - app = await launchApp(appDir, appPort) + next = await createNext({ + files: { + pages: new FileRef(join(__dirname, 'node-browser-polyfills/pages')), + }, + }) }) - afterAll(() => killApp(app)) + afterAll(() => next.destroy()) - it('should polyfill Node.js modules', async () => { - const browser = await webdriver(appPort, '/node-browser-polyfills') + it('should have polyfilled correctly', async () => { + const browser = await webdriver(next.url, '/') await browser.waitForCondition('window.didRender') diff --git a/test/integration/polyfill-node-modules/pages/node-browser-polyfills.js b/test/development/basic/node-browser-polyfills/pages/index.js similarity index 69% rename from test/integration/polyfill-node-modules/pages/node-browser-polyfills.js rename to test/development/basic/node-browser-polyfills/pages/index.js index 46fd712929db3..8f3c6e39be1f9 100644 --- a/test/integration/polyfill-node-modules/pages/node-browser-polyfills.js +++ b/test/development/basic/node-browser-polyfills/pages/index.js @@ -19,6 +19,7 @@ import timers from 'timers' import tty from 'tty' import util from 'util' import zlib from 'zlib' +import 'setimmediate' export default function NodeBrowserPolyfillPage() { const [state, setState] = useState({}) @@ -50,26 +51,28 @@ export default function NodeBrowserPolyfillPage() { assert.ok(!!util.inspect) assert.ok(!!zlib.Gzip) - setState({ - assert: true, - buffer: Buffer.from('hello world').toString('utf8'), - constants: constants.E2BIG, - hash: crypto.createHash('sha256').update('hello world').digest('hex'), - domain: true, - os: os.EOL, - path: path.join('/hello/world', 'test.txt'), - process: process.title, - querystring: querystring.stringify({ a: 'b' }), - stream: closedStream, - stringDecoder: true, - sys: true, - timers: true, - tty: true, - util: true, - http: true, - https: true, - vm: vm.runInNewContext('a + 5', { a: 100 }), - zlib: true, + setImmediate(() => { + setState({ + assert: true, + buffer: Buffer.from('hello world').toString('utf8'), + constants: constants.E2BIG, + hash: crypto.createHash('sha256').update('hello world').digest('hex'), + domain: true, + os: os.EOL, + path: path.join('/hello/world', 'test.txt'), + process: process.title, + querystring: querystring.stringify({ a: 'b' }), + stream: closedStream, + stringDecoder: true, + sys: true, + timers: true, + tty: true, + util: true, + http: true, + https: true, + vm: vm.runInNewContext('a + 5', { a: 100 }), + zlib: true, + }) }) }, []) diff --git a/test/integration/404-page/pages/invalidExtension.d.ts b/test/integration/404-page/pages/invalidExtension.d.ts new file mode 100644 index 0000000000000..2b11604abb89d --- /dev/null +++ b/test/integration/404-page/pages/invalidExtension.d.ts @@ -0,0 +1 @@ +export const container: string diff --git a/test/integration/404-page/test/index.test.js b/test/integration/404-page/test/index.test.js index 60e263acf191e..a5df93cceec57 100644 --- a/test/integration/404-page/test/index.test.js +++ b/test/integration/404-page/test/index.test.js @@ -38,6 +38,11 @@ const runTests = (mode = 'server') => { expect(res.status).toBe(404) }) + it('should use pages/404 for .d.ts file', async () => { + const html = await renderViaHTTP(appPort, '/invalidExtension') + expect(html).toContain('custom 404 page') + }) + it('should not error when visited directly', async () => { const res = await fetchViaHTTP(appPort, '/404') expect(res.status).toBe(404) diff --git a/test/integration/api-body-parser/test/index.test.js b/test/integration/api-body-parser/test/index.test.js index 4cfb0100523e8..ddca1496237bd 100644 --- a/test/integration/api-body-parser/test/index.test.js +++ b/test/integration/api-body-parser/test/index.test.js @@ -8,7 +8,6 @@ import { fetchViaHTTP, initNextServerScript, } from 'next-test-utils' -import clone from 'clone' import getPort from 'get-port' const appDir = join(__dirname, '../') @@ -70,12 +69,7 @@ async function makeRequestWithInvalidContentType() { const startServer = async (optEnv = {}, opts) => { const scriptPath = join(appDir, 'server.js') context.appPort = appPort = await getPort() - const env = Object.assign( - {}, - clone(process.env), - { PORT: `${appPort}` }, - optEnv - ) + const env = Object.assign({ ...process.env }, { PORT: `${appPort}` }, optEnv) server = await initNextServerScript( scriptPath, diff --git a/test/integration/cli/test/index.test.js b/test/integration/cli/test/index.test.js index 3ed7724fe325c..e4ff3f49099c4 100644 --- a/test/integration/cli/test/index.test.js +++ b/test/integration/cli/test/index.test.js @@ -400,4 +400,47 @@ describe('CLI Usage', () => { expect(stderr).not.toContain('UnhandledPromiseRejectionWarning') }) }) + + describe('info', () => { + test('--help', async () => { + const help = await runNextCommand(['info', '--help'], { + stdout: true, + }) + expect(help.stdout).toMatch( + /Prints relevant details about the current system which can be used to report Next\.js bugs/ + ) + }) + + test('-h', async () => { + const help = await runNextCommand(['info', '-h'], { + stdout: true, + }) + expect(help.stdout).toMatch( + /Prints relevant details about the current system which can be used to report Next\.js bugs/ + ) + }) + + test('should print output', async () => { + const info = await runNextCommand(['info'], { + stdout: true, + }) + expect(info.stdout).toMatch( + new RegExp(` + Operating System: + Platform: .* + Arch: .* + Version: .* + Binaries: + Node: .* + npm: .* + Yarn: .* + pnpm: .* + Relevant packages: + next: .* + react: .* + react-dom: .* +`) + ) + }) + }) }) diff --git a/test/integration/custom-server/test/index.test.js b/test/integration/custom-server/test/index.test.js index 3bcb0ede83531..c64615fc413fd 100644 --- a/test/integration/custom-server/test/index.test.js +++ b/test/integration/custom-server/test/index.test.js @@ -4,7 +4,6 @@ import webdriver from 'next-webdriver' import { join } from 'path' import getPort from 'get-port' import cheerio from 'cheerio' -import clone from 'clone' import { initNextServerScript, killApp, @@ -27,8 +26,7 @@ const startServer = async (optEnv = {}, opts) => { const scriptPath = join(appDir, 'server.js') context.appPort = appPort = await getPort() const env = Object.assign( - {}, - clone(process.env), + { ...process.env }, { PORT: `${appPort}`, __NEXT_TEST_MODE: 'true' }, optEnv ) diff --git a/test/integration/fetch-polyfill-ky-universal/test/index.test.js b/test/integration/fetch-polyfill-ky-universal/test/index.test.js index abce71b101741..5c54ac7eeca5f 100644 --- a/test/integration/fetch-polyfill-ky-universal/test/index.test.js +++ b/test/integration/fetch-polyfill-ky-universal/test/index.test.js @@ -11,7 +11,6 @@ import { nextBuild, nextStart, } from 'next-test-utils' -import clone from 'clone' const appDir = join(__dirname, '../') const nextConfig = join(appDir, 'next.config.js') @@ -24,8 +23,7 @@ const startApiServer = async (optEnv = {}, opts) => { const scriptPath = join(appDir, 'api-server.js') apiServerPort = await findPort() const env = Object.assign( - {}, - clone(process.env), + { ...process.env }, { PORT: `${apiServerPort}` }, optEnv ) @@ -42,12 +40,7 @@ const startApiServer = async (optEnv = {}, opts) => { const startServerlessServer = async (optEnv = {}, opts) => { const scriptPath = join(appDir, 'serverless-server.js') appPort = await findPort() - const env = Object.assign( - {}, - clone(process.env), - { PORT: `${appPort}` }, - optEnv - ) + const env = Object.assign({ ...process.env }, { PORT: `${appPort}` }, optEnv) return await initNextServerScript( scriptPath, diff --git a/test/integration/fetch-polyfill/test/index.test.js b/test/integration/fetch-polyfill/test/index.test.js index b74d23525994b..a0aa4cd19e21b 100644 --- a/test/integration/fetch-polyfill/test/index.test.js +++ b/test/integration/fetch-polyfill/test/index.test.js @@ -12,7 +12,6 @@ import { nextBuild, nextStart, } from 'next-test-utils' -import clone from 'clone' import cheerio from 'cheerio' const appDir = join(__dirname, '../') @@ -26,8 +25,7 @@ const startApiServer = async (optEnv = {}, opts) => { const scriptPath = join(appDir, 'api-server.js') apiServerPort = await findPort() const env = Object.assign( - {}, - clone(process.env), + { ...process.env }, { PORT: `${apiServerPort}` }, optEnv ) @@ -44,12 +42,7 @@ const startApiServer = async (optEnv = {}, opts) => { const startServerlessServer = async (optEnv = {}, opts) => { const scriptPath = join(appDir, 'serverless-server.js') appPort = await findPort() - const env = Object.assign( - {}, - clone(process.env), - { PORT: `${appPort}` }, - optEnv - ) + const env = Object.assign({ ...process.env }, { PORT: `${appPort}` }, optEnv) return await initNextServerScript( scriptPath, diff --git a/test/integration/filesystempublicroutes/test/index.test.js b/test/integration/filesystempublicroutes/test/index.test.js index 93a756fc1167d..428bb2ee52b0f 100644 --- a/test/integration/filesystempublicroutes/test/index.test.js +++ b/test/integration/filesystempublicroutes/test/index.test.js @@ -8,7 +8,6 @@ import { killApp, getPageFileFromBuildManifest, } from 'next-test-utils' -import clone from 'clone' const appDir = join(__dirname, '../') let appPort @@ -19,12 +18,7 @@ const context = {} const startServer = async (optEnv = {}) => { const scriptPath = join(appDir, 'server.js') context.appPort = appPort = await getPort() - const env = Object.assign( - {}, - clone(process.env), - { PORT: `${appPort}` }, - optEnv - ) + const env = Object.assign({ ...process.env }, { PORT: `${appPort}` }, optEnv) server = await initNextServerScript(scriptPath, /ready on/i, env) } diff --git a/test/integration/font-optimization/fixtures/make-stylesheet-inert-regression/pages/_document.js b/test/integration/font-optimization/fixtures/make-stylesheet-inert-regression/pages/_document.js new file mode 100644 index 0000000000000..34851fcae15cb --- /dev/null +++ b/test/integration/font-optimization/fixtures/make-stylesheet-inert-regression/pages/_document.js @@ -0,0 +1,36 @@ +import Document, { Html, Head, Main, NextScript } from 'next/document' + +class MyDocument extends Document { + static async getInitialProps(ctx) { + const initialProps = await Document.getInitialProps(ctx) + return { ...initialProps } + } + + render() { + return ( + + + <> + {false && } + + + + + + +
+ + + + ) + } +} + +export default MyDocument diff --git a/test/integration/font-optimization/fixtures/make-stylesheet-inert-regression/pages/index.js b/test/integration/font-optimization/fixtures/make-stylesheet-inert-regression/pages/index.js new file mode 100644 index 0000000000000..136175234f558 --- /dev/null +++ b/test/integration/font-optimization/fixtures/make-stylesheet-inert-regression/pages/index.js @@ -0,0 +1,8 @@ +export default function Home() { + return ( +

+ Falsey values contained in an element contained in Head should not result + in an error! +

+ ) +} diff --git a/test/integration/font-optimization/test/index.test.js b/test/integration/font-optimization/test/index.test.js index a4d6f216f65a3..f4a4bdd18c6b4 100644 --- a/test/integration/font-optimization/test/index.test.js +++ b/test/integration/font-optimization/test/index.test.js @@ -328,4 +328,10 @@ describe('Font Optimization', () => { const { code } = await nextBuild(appDir) expect(code).toBe(0) }) + + test('makeStylesheetInert regression', async () => { + const appDir = join(fixturesDir, 'make-stylesheet-inert-regression') + const { code } = await nextBuild(appDir) + expect(code).toBe(0) + }) }) diff --git a/test/integration/middleware/core/pages/rewrites/_middleware.js b/test/integration/middleware/core/pages/rewrites/_middleware.js index 28aaa19127207..13d4453938251 100644 --- a/test/integration/middleware/core/pages/rewrites/_middleware.js +++ b/test/integration/middleware/core/pages/rewrites/_middleware.js @@ -30,8 +30,14 @@ export async function middleware(request) { } if (url.pathname === '/rewrites/rewrite-me-without-hard-navigation') { - url.pathname = '/rewrites/about' url.searchParams.set('middleware', 'foo') - return NextResponse.rewrite(url) + url.pathname = + request.cookies['about-bypass'] === '1' + ? '/rewrites/about-bypass' + : '/rewrites/about' + + const response = NextResponse.rewrite(url) + response.headers.set('x-middleware-cache', 'no-cache') + return response } } diff --git a/test/integration/middleware/core/pages/rewrites/about-bypass.js b/test/integration/middleware/core/pages/rewrites/about-bypass.js new file mode 100644 index 0000000000000..4039fc76ad86b --- /dev/null +++ b/test/integration/middleware/core/pages/rewrites/about-bypass.js @@ -0,0 +1,12 @@ +export default function AboutBypass({ message }) { + return ( +
+

About Bypassed Page

+

{message}

+
+ ) +} + +export const getServerSideProps = ({ query }) => ({ + props: { message: query.message || '' }, +}) diff --git a/test/integration/middleware/core/test/index.test.js b/test/integration/middleware/core/test/index.test.js index 3aa3dea0e4057..43c24df8df3f2 100644 --- a/test/integration/middleware/core/test/index.test.js +++ b/test/integration/middleware/core/test/index.test.js @@ -213,6 +213,18 @@ function rewriteTests(locale = '') { const element = await browser.elementByCss('.middleware') expect(await element.text()).toEqual('foo') }) + + it('should allow to opt-out preflight caching', async () => { + const browser = await webdriver(context.appPort, '/rewrites/') + await browser.addCookie({ name: 'about-bypass', value: '1' }) + await browser.eval('window.__SAME_PAGE = true') + await browser.elementByCss('#link-with-rewritten-url').click() + await browser.waitForElementByCss('.refreshed') + await browser.deleteCookies() + expect(await browser.eval('window.__SAME_PAGE')).toBe(true) + const element = await browser.elementByCss('.title') + expect(await element.text()).toEqual('About Bypassed Page') + }) } function redirectTests(locale = '') { diff --git a/test/integration/ondemand/test/index.test.js b/test/integration/ondemand/test/index.test.js index a89278743632e..79690a38a3713 100644 --- a/test/integration/ondemand/test/index.test.js +++ b/test/integration/ondemand/test/index.test.js @@ -3,7 +3,6 @@ import WebSocket from 'ws' import { join } from 'path' import webdriver from 'next-webdriver' import getPort from 'get-port' -import clone from 'clone' import { renderViaHTTP, fetchViaHTTP, @@ -24,8 +23,7 @@ const startServer = async (optEnv = {}, opts) => { const scriptPath = join(appDir, 'server.js') context.appPort = await getPort() const env = Object.assign( - {}, - clone(process.env), + { ...process.env }, { PORT: `${context.appPort}` }, optEnv ) diff --git a/test/integration/page-extensions/pages/invalidExtension.d.ts b/test/integration/page-extensions/pages/invalidExtension.d.ts new file mode 100644 index 0000000000000..2b11604abb89d --- /dev/null +++ b/test/integration/page-extensions/pages/invalidExtension.d.ts @@ -0,0 +1 @@ +export const container: string diff --git a/test/integration/page-extensions/test/index.test.js b/test/integration/page-extensions/test/index.test.js index b3e97dedfc773..6f52bc29dc522 100644 --- a/test/integration/page-extensions/test/index.test.js +++ b/test/integration/page-extensions/test/index.test.js @@ -64,4 +64,17 @@ describe('Page Extensions', () => { '@zeit/next-typescript is no longer needed since Next.js has built-in support for TypeScript now' ) }) + + it('should not throw if .d.ts file inside the pages folder', async () => { + await fs.writeFile( + nextConfig, + `module.exports = { pageExtensions: ['js', 'ts', 'tsx'] }` + ) + + const { stdout } = await runNextCommand(['build', appDir], { stdout: true }) + + await fs.remove(nextConfig) + + expect(stdout).toContain('Compiled successfully') + }) }) diff --git a/test/integration/polyfill-node-modules/next.config.js b/test/integration/polyfill-node-modules/next.config.js deleted file mode 100644 index cc17cf48c578f..0000000000000 --- a/test/integration/polyfill-node-modules/next.config.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - onDemandEntries: { - // Make sure entries are not getting disposed. - maxInactiveAge: 1000 * 60 * 60, - }, -} diff --git a/test/integration/router-hash-navigation/pages/index.js b/test/integration/router-hash-navigation/pages/index.js new file mode 100644 index 0000000000000..0170d3ea19e58 --- /dev/null +++ b/test/integration/router-hash-navigation/pages/index.js @@ -0,0 +1,16 @@ +import Link from 'next/link' + +export default function Page() { + return ( +
+
+ + top + + + section link + +
section content
+
+ ) +} diff --git a/test/integration/router-hash-navigation/test/index.test.js b/test/integration/router-hash-navigation/test/index.test.js new file mode 100644 index 0000000000000..3e65ed752d12a --- /dev/null +++ b/test/integration/router-hash-navigation/test/index.test.js @@ -0,0 +1,51 @@ +/* eslint-env jest */ + +import { join } from 'path' +import webdriver from 'next-webdriver' +import { + findPort, + launchApp, + killApp, + nextStart, + nextBuild, +} from 'next-test-utils' + +let app +let appPort +const appDir = join(__dirname, '../') + +function runTests() { + it('scrolls to top when href="/" and url already contains a hash', async () => { + const browser = await webdriver(appPort, '/#section') + expect(await browser.eval(() => window.scrollY)).not.toBe(0) + await browser.elementByCss('#top-link').click() + expect(await browser.eval(() => window.scrollY)).toBe(0) + await browser.close() + }) +} + +describe('router.isReady', () => { + describe('dev mode', () => { + beforeAll(async () => { + appPort = await findPort() + app = await launchApp(appDir, appPort) + }) + afterAll(async () => { + await killApp(app) + }) + + runTests() + }) + + describe('production mode', () => { + beforeAll(async () => { + await nextBuild(appDir) + + appPort = await findPort() + app = await nextStart(appDir, appPort) + }) + afterAll(() => killApp(app)) + + runTests() + }) +}) diff --git a/test/integration/scss-fixtures/url-global-partial/assets/light.svg b/test/integration/scss-fixtures/url-global-partial/assets/light.svg new file mode 100644 index 0000000000000..0194cbce06561 --- /dev/null +++ b/test/integration/scss-fixtures/url-global-partial/assets/light.svg @@ -0,0 +1,17 @@ + + + + Logotype - White + Created with Sketch. + + + + + + + + + + + + diff --git a/test/integration/scss-fixtures/url-global-partial/pages/_app.js b/test/integration/scss-fixtures/url-global-partial/pages/_app.js new file mode 100644 index 0000000000000..29beb9fdb3cc5 --- /dev/null +++ b/test/integration/scss-fixtures/url-global-partial/pages/_app.js @@ -0,0 +1,13 @@ +import React from 'react' +import App from 'next/app' +import '../styles/global1.scss' +import '../styles/global2.scss' + +class MyApp extends App { + render() { + const { Component, pageProps } = this.props + return + } +} + +export default MyApp diff --git a/test/integration/scss-fixtures/url-global-partial/pages/index.js b/test/integration/scss-fixtures/url-global-partial/pages/index.js new file mode 100644 index 0000000000000..5cbac8a153d77 --- /dev/null +++ b/test/integration/scss-fixtures/url-global-partial/pages/index.js @@ -0,0 +1,3 @@ +export default function Home() { + return
This text should be red.
+} diff --git a/test/integration/scss-fixtures/url-global-partial/styles/dark2.svg b/test/integration/scss-fixtures/url-global-partial/styles/dark2.svg new file mode 100644 index 0000000000000..bdae3d6587872 --- /dev/null +++ b/test/integration/scss-fixtures/url-global-partial/styles/dark2.svg @@ -0,0 +1,17 @@ + + + + Logotype - Black + Created with Sketch. + + + + + + + + + + + + diff --git a/test/integration/scss-fixtures/url-global-partial/styles/global1.scss b/test/integration/scss-fixtures/url-global-partial/styles/global1.scss new file mode 100644 index 0000000000000..e6697aa7027e1 --- /dev/null +++ b/test/integration/scss-fixtures/url-global-partial/styles/global1.scss @@ -0,0 +1,3 @@ +$var: red; + +@import './subdirectory/partial'; diff --git a/test/integration/scss-fixtures/url-global-partial/styles/global2.scss b/test/integration/scss-fixtures/url-global-partial/styles/global2.scss new file mode 100644 index 0000000000000..4b659d369c561 --- /dev/null +++ b/test/integration/scss-fixtures/url-global-partial/styles/global2.scss @@ -0,0 +1,6 @@ +@import './global2b.scss'; + +$var: blue; +.blue-text { + color: $var; +} diff --git a/test/integration/scss-fixtures/url-global-partial/styles/global2b.scss b/test/integration/scss-fixtures/url-global-partial/styles/global2b.scss new file mode 100644 index 0000000000000..0fe57600718f5 --- /dev/null +++ b/test/integration/scss-fixtures/url-global-partial/styles/global2b.scss @@ -0,0 +1,6 @@ +$var: orange; +.blue-text { + color: $var; + font-weight: bolder; + background-image: url(../assets/light.svg); +} diff --git a/test/integration/scss-fixtures/url-global-partial/styles/subdirectory/_partial.scss b/test/integration/scss-fixtures/url-global-partial/styles/subdirectory/_partial.scss new file mode 100644 index 0000000000000..1663b72cc13f6 --- /dev/null +++ b/test/integration/scss-fixtures/url-global-partial/styles/subdirectory/_partial.scss @@ -0,0 +1,4 @@ +.red-text { + color: $var; + background-image: url('./darka.svg'), url(darkb.svg); +} diff --git a/test/integration/scss-fixtures/url-global-partial/styles/subdirectory/darka.svg b/test/integration/scss-fixtures/url-global-partial/styles/subdirectory/darka.svg new file mode 100644 index 0000000000000..bdae3d6587872 --- /dev/null +++ b/test/integration/scss-fixtures/url-global-partial/styles/subdirectory/darka.svg @@ -0,0 +1,17 @@ + + + + Logotype - Black + Created with Sketch. + + + + + + + + + + + + diff --git a/test/integration/scss-fixtures/url-global-partial/styles/subdirectory/darkb.svg b/test/integration/scss-fixtures/url-global-partial/styles/subdirectory/darkb.svg new file mode 100644 index 0000000000000..bdae3d6587872 --- /dev/null +++ b/test/integration/scss-fixtures/url-global-partial/styles/subdirectory/darkb.svg @@ -0,0 +1,17 @@ + + + + Logotype - Black + Created with Sketch. + + + + + + + + + + + + diff --git a/test/integration/scss/test/index.test.js b/test/integration/scss/test/index.test.js index f37de98c8bd2a..1414818e02b99 100644 --- a/test/integration/scss/test/index.test.js +++ b/test/integration/scss/test/index.test.js @@ -659,6 +659,54 @@ describe('SCSS Support', () => { }) }) + describe('CSS URL via file-loader sass partial', () => { + const appDir = join(fixturesDir, 'url-global-partial') + + beforeAll(async () => { + await remove(join(appDir, '.next')) + }) + + it('should compile successfully', async () => { + const { code, stdout } = await nextBuild(appDir, [], { + stdout: true, + }) + expect(code).toBe(0) + expect(stdout).toMatch(/Compiled successfully/) + }) + + it(`should've emitted expected files`, async () => { + const cssFolder = join(appDir, '.next/static/css') + const mediaFolder = join(appDir, '.next/static/media') + + const files = await readdir(cssFolder) + const cssFiles = files.filter((f) => /\.css$/.test(f)) + + expect(cssFiles.length).toBe(1) + const cssContent = await readFile(join(cssFolder, cssFiles[0]), 'utf8') + expect( + cssContent.replace(/\/\*.*?\*\//g, '').trim() + ).toMatchInlineSnapshot( + '".red-text{color:red;background-image:url(/_next/static/media/darka.6b01655b.svg),url(/_next/static/media/darkb.6b01655b.svg)}.blue-text{color:orange;font-weight:bolder;background-image:url(/_next/static/media/light.2da1d3d6.svg);color:blue}"' + ) + + const mediaFiles = await readdir(mediaFolder) + expect(mediaFiles.length).toBe(3) + expect( + mediaFiles + .map((fileName) => + /^(.+?)\..{8}\.(.+?)$/.exec(fileName).slice(1).join('.') + ) + .sort() + ).toMatchInlineSnapshot(` + Array [ + "darka.svg", + "darkb.svg", + "light.svg", + ] + `) + }) + }) + describe('CSS URL via `file-loader` and asset prefix (1)', () => { const appDir = join(fixturesDir, 'url-global-asset-prefix-1') diff --git a/test/production/required-server-files.test.ts b/test/production/required-server-files.test.ts index 22459d8c1c343..61794732f0410 100644 --- a/test/production/required-server-files.test.ts +++ b/test/production/required-server-files.test.ts @@ -107,6 +107,22 @@ describe('should set-up next', () => { if (server) await killApp(server) }) + it('should output middleware correctly', async () => { + // the middleware-runtime is located in .next/static/chunks so ensure + // the folder is present + expect( + await fs.pathExists(join(next.testDir, 'standalone/.next/static/chunks')) + ).toBe(true) + expect( + await fs.pathExists( + join( + next.testDir, + 'standalone/.next/server/pages/middleware/_middleware.js' + ) + ) + ).toBe(true) + }) + it('should output required-server-files manifest correctly', async () => { expect(requiredFilesManifest.version).toBe(1) expect(Array.isArray(requiredFilesManifest.files)).toBe(true) diff --git a/test/production/required-server-files/pages/middleware/_middleware.js b/test/production/required-server-files/pages/middleware/_middleware.js new file mode 100644 index 0000000000000..c07ee4d1f4f82 --- /dev/null +++ b/test/production/required-server-files/pages/middleware/_middleware.js @@ -0,0 +1,3 @@ +export async function middleware(req) { + return new Response('hello from middleware') +} diff --git a/test/unit/eslint-plugin-next/google-font-display.test.ts b/test/unit/eslint-plugin-next/google-font-display.test.ts index 60d95765662d2..75d40748c7381 100644 --- a/test/unit/eslint-plugin-next/google-font-display.test.ts +++ b/test/unit/eslint-plugin-next/google-font-display.test.ts @@ -76,7 +76,7 @@ ruleTester.run('google-font-display', rule, { errors: [ { message: - 'Display parameter is missing. See https://nextjs.org/docs/messages/google-font-display.', + 'Display parameter is missing. See: https://nextjs.org/docs/messages/google-font-display', type: 'JSXOpeningElement', }, ], @@ -98,7 +98,7 @@ ruleTester.run('google-font-display', rule, { errors: [ { message: - 'Block behavior is not recommended. See https://nextjs.org/docs/messages/google-font-display.', + 'Block behavior is not recommended. See: https://nextjs.org/docs/messages/google-font-display', type: 'JSXOpeningElement', }, ], @@ -120,7 +120,7 @@ ruleTester.run('google-font-display', rule, { errors: [ { message: - 'Auto behavior is not recommended. See https://nextjs.org/docs/messages/google-font-display.', + 'Auto behavior is not recommended. See: https://nextjs.org/docs/messages/google-font-display', type: 'JSXOpeningElement', }, ], @@ -142,7 +142,7 @@ ruleTester.run('google-font-display', rule, { errors: [ { message: - 'Fallback behavior is not recommended. See https://nextjs.org/docs/messages/google-font-display.', + 'Fallback behavior is not recommended. See: https://nextjs.org/docs/messages/google-font-display', type: 'JSXOpeningElement', }, ], diff --git a/test/unit/eslint-plugin-next/google-font-preconnect.test.ts b/test/unit/eslint-plugin-next/google-font-preconnect.test.ts index 178b17eede7b5..e5669c91acaa2 100644 --- a/test/unit/eslint-plugin-next/google-font-preconnect.test.ts +++ b/test/unit/eslint-plugin-next/google-font-preconnect.test.ts @@ -42,7 +42,7 @@ ruleTester.run('google-font-preconnect', rule, { errors: [ { message: - 'Preconnect is missing. See https://nextjs.org/docs/messages/google-font-preconnect.', + 'Preconnect is missing. See: https://nextjs.org/docs/messages/google-font-preconnect', type: 'JSXOpeningElement', }, ], @@ -58,7 +58,7 @@ ruleTester.run('google-font-preconnect', rule, { errors: [ { message: - 'Preconnect is missing. See https://nextjs.org/docs/messages/google-font-preconnect.', + 'Preconnect is missing. See: https://nextjs.org/docs/messages/google-font-preconnect', type: 'JSXOpeningElement', }, ], diff --git a/test/unit/eslint-plugin-next/link-passhref.test.ts b/test/unit/eslint-plugin-next/link-passhref.test.ts index b493ceafba306..6c864a879d621 100644 --- a/test/unit/eslint-plugin-next/link-passhref.test.ts +++ b/test/unit/eslint-plugin-next/link-passhref.test.ts @@ -52,7 +52,7 @@ ruleTester.run('link-passhref', rule, { errors: [ { message: - 'passHref is missing. See https://nextjs.org/docs/messages/link-passhref', + 'passHref is missing. See: https://nextjs.org/docs/messages/link-passhref', type: 'JSXOpeningElement', }, ], @@ -69,7 +69,7 @@ ruleTester.run('link-passhref', rule, { errors: [ { message: - 'passHref must be set to true. See https://nextjs.org/docs/messages/link-passhref', + 'passHref must be set to true. See: https://nextjs.org/docs/messages/link-passhref', type: 'JSXOpeningElement', }, ], diff --git a/test/unit/eslint-plugin-next/next-script-for-ga.test.ts b/test/unit/eslint-plugin-next/next-script-for-ga.test.ts index 19fdde7b0c421..a40772eeb2e77 100644 --- a/test/unit/eslint-plugin-next/next-script-for-ga.test.ts +++ b/test/unit/eslint-plugin-next/next-script-for-ga.test.ts @@ -12,7 +12,7 @@ import { RuleTester } from 'eslint' }) const ERROR_MSG = - 'Use the `next/script` component for loading third party scripts. See: https://nextjs.org/docs/messages/next-script-for-ga.' + 'Use the `next/script` component for loading third party scripts. See: https://nextjs.org/docs/messages/next-script-for-ga' const ruleTester = new RuleTester() diff --git a/test/unit/eslint-plugin-next/no-css-tags.test.ts b/test/unit/eslint-plugin-next/no-css-tags.test.ts index c8312fb452468..4dd04ea80514c 100644 --- a/test/unit/eslint-plugin-next/no-css-tags.test.ts +++ b/test/unit/eslint-plugin-next/no-css-tags.test.ts @@ -81,7 +81,7 @@ ruleTester.run('no-css-tags', rule, { errors: [ { message: - 'Do not include stylesheets manually. See: https://nextjs.org/docs/messages/no-css-tags.', + 'Do not include stylesheets manually. See: https://nextjs.org/docs/messages/no-css-tags', type: 'JSXOpeningElement', }, ], @@ -94,7 +94,7 @@ ruleTester.run('no-css-tags', rule, { errors: [ { message: - 'Do not include stylesheets manually. See: https://nextjs.org/docs/messages/no-css-tags.', + 'Do not include stylesheets manually. See: https://nextjs.org/docs/messages/no-css-tags', type: 'JSXOpeningElement', }, ], diff --git a/test/unit/eslint-plugin-next/no-document-import-in-page.test.ts b/test/unit/eslint-plugin-next/no-document-import-in-page.test.ts index 2698b26592070..72ee7a7f3530e 100644 --- a/test/unit/eslint-plugin-next/no-document-import-in-page.test.ts +++ b/test/unit/eslint-plugin-next/no-document-import-in-page.test.ts @@ -125,7 +125,7 @@ ruleTester.run('no-document-import-in-page', rule, { errors: [ { message: - 'next/document should not be imported outside of pages/_document.js. See https://nextjs.org/docs/messages/no-document-import-in-page.', + 'next/document should not be imported outside of pages/_document.js. See: https://nextjs.org/docs/messages/no-document-import-in-page', type: 'ImportDeclaration', }, ], @@ -139,7 +139,7 @@ ruleTester.run('no-document-import-in-page', rule, { errors: [ { message: - 'next/document should not be imported outside of pages/_document.js. See https://nextjs.org/docs/messages/no-document-import-in-page.', + 'next/document should not be imported outside of pages/_document.js. See: https://nextjs.org/docs/messages/no-document-import-in-page', type: 'ImportDeclaration', }, ], @@ -153,7 +153,7 @@ ruleTester.run('no-document-import-in-page', rule, { errors: [ { message: - 'next/document should not be imported outside of pages/_document.js. See https://nextjs.org/docs/messages/no-document-import-in-page.', + 'next/document should not be imported outside of pages/_document.js. See: https://nextjs.org/docs/messages/no-document-import-in-page', type: 'ImportDeclaration', }, ], diff --git a/test/unit/eslint-plugin-next/no-head-element.test.ts b/test/unit/eslint-plugin-next/no-head-element.test.ts new file mode 100644 index 0000000000000..d1014b9374ef5 --- /dev/null +++ b/test/unit/eslint-plugin-next/no-head-element.test.ts @@ -0,0 +1,102 @@ +import rule from '@next/eslint-plugin-next/lib/rules/no-head-element' +import { RuleTester } from 'eslint' +;(RuleTester as any).setDefaultConfig({ + parserOptions: { + ecmaVersion: 2018, + sourceType: 'module', + ecmaFeatures: { + modules: true, + jsx: true, + }, + }, +}) +const ruleTester = new RuleTester() + +ruleTester.run('no-head-element', rule, { + valid: [ + { + code: `import Head from 'next/head'; + + export class MyComponent { + render() { + return ( +
+ + My page title + +
+ ); + } + } + `, + filename: 'pages/index.js', + }, + { + code: `import Head from 'next/head'; + + export class MyComponent { + render() { + return ( +
+ + My page title + +
+ ); + } + } + `, + filename: 'pages/index.tsx', + }, + ], + invalid: [ + { + code: ` + export class MyComponent { + render() { + return ( +
+ + My page title + +
+ ); + } + }`, + filename: 'pages/index.js', + errors: [ + { + message: + "Do not use . Use Head from 'next/head' instead. See: https://nextjs.org/docs/messages/no-head-element", + type: 'JSXOpeningElement', + }, + ], + }, + { + code: `import Head from 'next/head'; + + export class MyComponent { + render() { + return ( +
+ + My page title + + + My page title + +
+ ); + } + }`, + filename: 'pages/index.ts', + errors: [ + { + message: + "Do not use . Use Head from 'next/head' instead. See: https://nextjs.org/docs/messages/no-head-element", + type: 'JSXOpeningElement', + }, + ], + }, + ], +}) diff --git a/test/unit/eslint-plugin-next/no-head-import-in-document.test.ts b/test/unit/eslint-plugin-next/no-head-import-in-document.test.ts index f6840651e8802..8e6edbd7e4ea8 100644 --- a/test/unit/eslint-plugin-next/no-head-import-in-document.test.ts +++ b/test/unit/eslint-plugin-next/no-head-import-in-document.test.ts @@ -77,7 +77,7 @@ ruleTester.run('no-head-import-in-document', rule, { errors: [ { message: - 'next/head should not be imported in pages/_document.js. Import Head from next/document instead. See https://nextjs.org/docs/messages/no-head-import-in-document.', + 'next/head should not be imported in pages/_document.js. Import Head from next/document instead. See: https://nextjs.org/docs/messages/no-head-import-in-document', type: 'ImportDeclaration', }, ], @@ -107,7 +107,7 @@ ruleTester.run('no-head-import-in-document', rule, { errors: [ { message: - 'next/head should not be imported in pages/_document.page.tsx. Import Head from next/document instead. See https://nextjs.org/docs/messages/no-head-import-in-document.', + 'next/head should not be imported in pages/_document.page.tsx. Import Head from next/document instead. See: https://nextjs.org/docs/messages/no-head-import-in-document', type: 'ImportDeclaration', }, ], @@ -137,7 +137,7 @@ ruleTester.run('no-head-import-in-document', rule, { errors: [ { message: - 'next/head should not be imported in pages/_document/index.js. Import Head from next/document instead. See https://nextjs.org/docs/messages/no-head-import-in-document.', + 'next/head should not be imported in pages/_document/index.js. Import Head from next/document instead. See: https://nextjs.org/docs/messages/no-head-import-in-document', type: 'ImportDeclaration', }, ], @@ -167,7 +167,7 @@ ruleTester.run('no-head-import-in-document', rule, { errors: [ { message: - 'next/head should not be imported in pages/_document/index.tsx. Import Head from next/document instead. See https://nextjs.org/docs/messages/no-head-import-in-document.', + 'next/head should not be imported in pages/_document/index.tsx. Import Head from next/document instead. See: https://nextjs.org/docs/messages/no-head-import-in-document', type: 'ImportDeclaration', }, ], diff --git a/test/unit/eslint-plugin-next/no-html-link-for-pages.test.ts b/test/unit/eslint-plugin-next/no-html-link-for-pages.test.ts index fa868428bf843..93cacf99edc75 100644 --- a/test/unit/eslint-plugin-next/no-html-link-for-pages.test.ts +++ b/test/unit/eslint-plugin-next/no-html-link-for-pages.test.ts @@ -96,6 +96,20 @@ export class Blah extends Head { } } ` +const validTargetBlankLinkCode = ` +import Link from 'next/link'; + +export class Blah extends Head { + render() { + return ( +
+ New Tab +

Hello title

+
+ ); + } +} +` const validPublicFile = ` import Link from 'next/link'; @@ -211,6 +225,13 @@ describe('no-html-link-for-pages', function () { assert.deepEqual(report, []) }) + it('valid target="_blank" link element', function () { + const report = linter.verify(validTargetBlankLinkCode, linterConfig, { + filename: 'foo.js', + }) + assert.deepEqual(report, []) + }) + it('valid public file link element', function () { const report = linter.verify(validPublicFile, linterConfig, { filename: 'foo.js', @@ -225,7 +246,7 @@ describe('no-html-link-for-pages', function () { assert.notEqual(report, undefined, 'No lint errors found.') assert.equal( report.message, - "Do not use the HTML tag to navigate to /. Use Link from 'next/link' instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages." + "Do not use the HTML tag to navigate to /. Use Link from 'next/link' instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages" ) }) @@ -236,7 +257,7 @@ describe('no-html-link-for-pages', function () { assert.notEqual(report, undefined, 'No lint errors found.') assert.equal( report.message, - "Do not use the HTML tag to navigate to /list/foo/bar/. Use Link from 'next/link' instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages." + "Do not use the HTML tag to navigate to /list/foo/bar/. Use Link from 'next/link' instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages" ) const [secondReport] = linter.verify( secondInvalidDynamicCode, @@ -248,7 +269,7 @@ describe('no-html-link-for-pages', function () { assert.notEqual(secondReport, undefined, 'No lint errors found.') assert.equal( secondReport.message, - "Do not use the HTML tag to navigate to /list/foo/. Use Link from 'next/link' instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages." + "Do not use the HTML tag to navigate to /list/foo/. Use Link from 'next/link' instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages" ) const [thirdReport] = linter.verify(thirdInvalidDynamicCode, linterConfig, { filename: 'foo.js', @@ -256,7 +277,7 @@ describe('no-html-link-for-pages', function () { assert.notEqual(thirdReport, undefined, 'No lint errors found.') assert.equal( thirdReport.message, - "Do not use the HTML tag to navigate to /list/lorem-ipsum/. Use Link from 'next/link' instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages." + "Do not use the HTML tag to navigate to /list/lorem-ipsum/. Use Link from 'next/link' instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages" ) }) }) diff --git a/test/unit/eslint-plugin-next/no-img-element.test.ts b/test/unit/eslint-plugin-next/no-img-element.test.ts index 0c86d83467f97..0db0d7f2a9a3d 100644 --- a/test/unit/eslint-plugin-next/no-img-element.test.ts +++ b/test/unit/eslint-plugin-next/no-img-element.test.ts @@ -51,7 +51,7 @@ ruleTester.run('no-img-element', rule, { errors: [ { message: - "Do not use . Use Image from 'next/image' instead. See https://nextjs.org/docs/messages/no-img-element.", + "Do not use . Use Image from 'next/image' instead. See: https://nextjs.org/docs/messages/no-img-element", type: 'JSXOpeningElement', }, ], diff --git a/test/unit/eslint-plugin-next/no-page-custom-font.test.ts b/test/unit/eslint-plugin-next/no-page-custom-font.test.ts index d508924164af8..9318010ef262c 100644 --- a/test/unit/eslint-plugin-next/no-page-custom-font.test.ts +++ b/test/unit/eslint-plugin-next/no-page-custom-font.test.ts @@ -148,7 +148,7 @@ ruleTester.run('no-page-custom-font', rule, { errors: [ { message: - 'Custom fonts not added at the document level will only load for a single page. This is discouraged. See https://nextjs.org/docs/messages/no-page-custom-font.', + 'Custom fonts not added at the document level will only load for a single page. This is discouraged. See: https://nextjs.org/docs/messages/no-page-custom-font', type: 'JSXOpeningElement', }, ], @@ -188,11 +188,11 @@ ruleTester.run('no-page-custom-font', rule, { errors: [ { message: - 'Rendering this not inline within of Document disables font optimization. This is discouraged. See https://nextjs.org/docs/messages/no-page-custom-font.', + 'Rendering this not inline within of Document disables font optimization. This is discouraged. See: https://nextjs.org/docs/messages/no-page-custom-font', }, { message: - 'Rendering this not inline within of Document disables font optimization. This is discouraged. See https://nextjs.org/docs/messages/no-page-custom-font.', + 'Rendering this not inline within of Document disables font optimization. This is discouraged. See: https://nextjs.org/docs/messages/no-page-custom-font', }, ], }, diff --git a/test/unit/eslint-plugin-next/no-script-in-document.test.ts b/test/unit/eslint-plugin-next/no-script-in-document.test.ts index 5ae5df29f8858..d019e6d0018c8 100644 --- a/test/unit/eslint-plugin-next/no-script-in-document.test.ts +++ b/test/unit/eslint-plugin-next/no-script-in-document.test.ts @@ -76,7 +76,7 @@ ruleTester.run('no-script-import-in-document', rule, { filename: 'pages/_document.js', errors: [ { - message: `next/script should not be used in pages/_document.js. See: https://nextjs.org/docs/messages/no-script-in-document-page `, + message: `next/script should not be used in pages/_document.js. See: https://nextjs.org/docs/messages/no-script-in-document-page`, }, ], }, @@ -107,7 +107,7 @@ ruleTester.run('no-script-import-in-document', rule, { filename: 'pages/_document.js', errors: [ { - message: `next/script should not be used in pages/_document.js. See: https://nextjs.org/docs/messages/no-script-in-document-page `, + message: `next/script should not be used in pages/_document.js. See: https://nextjs.org/docs/messages/no-script-in-document-page`, }, ], }, diff --git a/test/unit/eslint-plugin-next/no-script-in-head.test.ts b/test/unit/eslint-plugin-next/no-script-in-head.test.ts index 0b750d5ed95da..f8220f252e8e2 100644 --- a/test/unit/eslint-plugin-next/no-script-in-head.test.ts +++ b/test/unit/eslint-plugin-next/no-script-in-head.test.ts @@ -44,7 +44,7 @@ ruleTester.run('no-script-in-head', rule, { errors: [ { message: - "next/script shouldn't be used inside next/head. See: https://nextjs.org/docs/messages/no-script-in-head-component ", + "next/script shouldn't be used inside next/head. See: https://nextjs.org/docs/messages/no-script-in-head-component", }, ], }, diff --git a/test/unit/eslint-plugin-next/no-server-import-in-page.test.ts b/test/unit/eslint-plugin-next/no-server-import-in-page.test.ts index 156aabd09fbe4..da1dbad31d239 100644 --- a/test/unit/eslint-plugin-next/no-server-import-in-page.test.ts +++ b/test/unit/eslint-plugin-next/no-server-import-in-page.test.ts @@ -98,7 +98,7 @@ ruleTester.run('no-server-import-in-page', rule, { errors: [ { message: - 'next/server should not be imported outside of pages/_middleware.js. See https://nextjs.org/docs/messages/no-server-import-in-page.', + 'next/server should not be imported outside of pages/_middleware.js. See: https://nextjs.org/docs/messages/no-server-import-in-page', type: 'ImportDeclaration', }, ], @@ -112,7 +112,7 @@ ruleTester.run('no-server-import-in-page', rule, { errors: [ { message: - 'next/server should not be imported outside of pages/_middleware.js. See https://nextjs.org/docs/messages/no-server-import-in-page.', + 'next/server should not be imported outside of pages/_middleware.js. See: https://nextjs.org/docs/messages/no-server-import-in-page', type: 'ImportDeclaration', }, ], @@ -126,7 +126,7 @@ ruleTester.run('no-server-import-in-page', rule, { errors: [ { message: - 'next/server should not be imported outside of pages/_middleware.js. See https://nextjs.org/docs/messages/no-server-import-in-page.', + 'next/server should not be imported outside of pages/_middleware.js. See: https://nextjs.org/docs/messages/no-server-import-in-page', type: 'ImportDeclaration', }, ], diff --git a/test/unit/eslint-plugin-next/no-sync-scripts.test.ts b/test/unit/eslint-plugin-next/no-sync-scripts.test.ts index 9d402c3a13d2c..bf006441cd5c4 100644 --- a/test/unit/eslint-plugin-next/no-sync-scripts.test.ts +++ b/test/unit/eslint-plugin-next/no-sync-scripts.test.ts @@ -58,7 +58,7 @@ ruleTester.run('sync-scripts', rule, { errors: [ { message: - 'External synchronous scripts are forbidden. See: https://nextjs.org/docs/messages/no-sync-scripts.', + 'External synchronous scripts are forbidden. See: https://nextjs.org/docs/messages/no-sync-scripts', type: 'JSXOpeningElement', }, ], @@ -80,7 +80,7 @@ ruleTester.run('sync-scripts', rule, { errors: [ { message: - 'External synchronous scripts are forbidden. See: https://nextjs.org/docs/messages/no-sync-scripts.', + 'External synchronous scripts are forbidden. See: https://nextjs.org/docs/messages/no-sync-scripts', type: 'JSXOpeningElement', }, ], diff --git a/test/unit/eslint-plugin-next/no-title-in-document-head.test.ts b/test/unit/eslint-plugin-next/no-title-in-document-head.test.ts index e05bf21b7165b..d0630191a47cf 100644 --- a/test/unit/eslint-plugin-next/no-title-in-document-head.test.ts +++ b/test/unit/eslint-plugin-next/no-title-in-document-head.test.ts @@ -60,7 +60,7 @@ ruleTester.run('no-title-in-document-head', rule, { errors: [ { message: - 'Titles should be defined at the page-level using next/head. See https://nextjs.org/docs/messages/no-title-in-document-head.', + 'Titles should be defined at the page-level using next/head. See: https://nextjs.org/docs/messages/no-title-in-document-head', type: 'JSXElement', }, ], diff --git a/test/unit/eslint-plugin-next/no-unwanted-polyfillio.test.ts b/test/unit/eslint-plugin-next/no-unwanted-polyfillio.test.ts index 4c2996d55ebbd..5cf18a1700234 100644 --- a/test/unit/eslint-plugin-next/no-unwanted-polyfillio.test.ts +++ b/test/unit/eslint-plugin-next/no-unwanted-polyfillio.test.ts @@ -67,7 +67,7 @@ ruleTester.run('unwanted-polyfillsio', rule, { errors: [ { message: - 'No duplicate polyfills from Polyfill.io are allowed. WeakSet, Promise, Promise.prototype.finally, es2015, es5, es6 are already shipped with Next.js. See: https://nextjs.org/docs/messages/no-unwanted-polyfillio.', + 'No duplicate polyfills from Polyfill.io are allowed. WeakSet, Promise, Promise.prototype.finally, es2015, es5, es6 are already shipped with Next.js. See: https://nextjs.org/docs/messages/no-unwanted-polyfillio', type: 'JSXOpeningElement', }, ], @@ -87,7 +87,7 @@ ruleTester.run('unwanted-polyfillsio', rule, { errors: [ { message: - 'No duplicate polyfills from Polyfill.io are allowed. Array.prototype.copyWithin is already shipped with Next.js. See: https://nextjs.org/docs/messages/no-unwanted-polyfillio.', + 'No duplicate polyfills from Polyfill.io are allowed. Array.prototype.copyWithin is already shipped with Next.js. See: https://nextjs.org/docs/messages/no-unwanted-polyfillio', type: 'JSXOpeningElement', }, ], @@ -106,7 +106,7 @@ ruleTester.run('unwanted-polyfillsio', rule, { errors: [ { message: - 'No duplicate polyfills from Polyfill.io are allowed. Array.prototype.copyWithin is already shipped with Next.js. See: https://nextjs.org/docs/messages/no-unwanted-polyfillio.', + 'No duplicate polyfills from Polyfill.io are allowed. Array.prototype.copyWithin is already shipped with Next.js. See: https://nextjs.org/docs/messages/no-unwanted-polyfillio', type: 'JSXOpeningElement', }, ], diff --git a/test/unit/image-rendering.test.ts b/test/unit/image-rendering.test.ts index 551670804e696..0a84e3e443c23 100644 --- a/test/unit/image-rendering.test.ts +++ b/test/unit/image-rendering.test.ts @@ -20,4 +20,30 @@ describe('Image rendering', () => { expect(img.attr('src')).toContain('test.png') expect(img.attr('srcset')).toContain('test.png') }) + + it('should only render noscript element when lazy loading', async () => { + const element = React.createElement(Image, { + src: '/test.png', + width: 100, + height: 100, + loading: 'eager', + }) + const element2 = React.createElement(Image, { + src: '/test.png', + width: 100, + height: 100, + priority: true, + }) + const elementLazy = React.createElement(Image, { + src: '/test.png', + width: 100, + height: 100, + }) + const $ = cheerio.load(ReactDOM.renderToString(element)) + const $2 = cheerio.load(ReactDOM.renderToString(element2)) + const $lazy = cheerio.load(ReactDOM.renderToString(elementLazy)) + expect($('noscript').length).toBe(0) + expect($2('noscript').length).toBe(0) + expect($lazy('noscript').length).toBe(1) + }) }) diff --git a/yarn.lock b/yarn.lock index 7c905ee74367b..e81e097372622 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4694,9 +4694,10 @@ dependencies: "@types/node" "*" -"@types/node@*", "@types/node@>= 8": - version "13.1.4" - resolved "https://registry.yarnpkg.com/@types/node/-/node-13.1.4.tgz#4cfd90175a200ee9b02bd6b1cd19bc349741607e" +"@types/node@*", "@types/node@13.11.0", "@types/node@>= 8": + version "13.11.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-13.11.0.tgz#390ea202539c61c8fa6ba4428b57e05bc36dc47b" + integrity sha512-uM4mnmsIIPK/yeO+42F2RQhGUIs39K2RFmugcJANppXe6J1nvH87PvzPZYpza7Xhhs8Yn9yIAVdLZ84z61+0xQ== "@types/node@10.12.18": version "10.12.18" @@ -5528,14 +5529,6 @@ add-stream@^1.0.0: resolved "https://registry.yarnpkg.com/add-stream/-/add-stream-1.0.0.tgz#6a7990437ca736d5e1288db92bd3266d5f5cb2aa" integrity sha1-anmQQ3ynNtXhKI25K9MmbV9csqo= -adjust-sourcemap-loader@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/adjust-sourcemap-loader/-/adjust-sourcemap-loader-3.0.0.tgz#5ae12fb5b7b1c585e80bbb5a63ec163a1a45e61e" - integrity sha512-YBrGyT2/uVQ/c6Rr+t6ZJXniY03YtHGMJQYal368burRGYKqhx9qGTWqcBU5s1CwYY9E/ri63RYyG1IacMZtqw== - dependencies: - loader-utils "^2.0.0" - regex-parser "^2.2.11" - after-all-results@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/after-all-results/-/after-all-results-2.0.0.tgz#6ac2fc202b500f88da8f4f5530cfa100f4c6a2d0" @@ -5782,10 +5775,6 @@ aria-query@^4.2.2: "@babel/runtime" "^7.10.2" "@babel/runtime-corejs3" "^7.10.2" -arity-n@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/arity-n/-/arity-n-1.0.4.tgz#d9e76b11733e08569c0847ae7b39b2860b30b745" - arr-diff@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" @@ -6724,14 +6713,14 @@ camelcase@5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.0.0.tgz#03295527d58bd3cd4aa75363f35b2e8d97be2f42" -camelcase@5.3.1, camelcase@^5.0.0, camelcase@^5.3.1: - version "5.3.1" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" - camelcase@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f" +camelcase@^5.0.0, camelcase@^5.3.1: + version "5.3.1" + resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" + camelcase@^6.0.0, camelcase@^6.2.0: version "6.2.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.2.0.tgz#924af881c9d525ac9d87f40d964e5cea982a1809" @@ -7112,10 +7101,6 @@ clone-response@^1.0.2: dependencies: mimic-response "^1.0.0" -clone@2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" - clone@^1.0.2: version "1.0.4" resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" @@ -7294,12 +7279,6 @@ component-emitter@^1.2.0, component-emitter@^1.2.1: version "1.3.0" resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" -compose-function@3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/compose-function/-/compose-function-3.0.3.tgz#9ed675f13cc54501d30950a486ff6a7ba3ab185f" - dependencies: - arity-n "^1.0.4" - compressible@~2.0.16: version "2.0.18" resolved "https://registry.yarnpkg.com/compressible/-/compressible-2.0.18.tgz#af53cca6b070d4c3c0750fbd77286a6d7cc46fba" @@ -7519,10 +7498,6 @@ convert-source-map@1.7.0, convert-source-map@^1.4.0, convert-source-map@^1.6.0, dependencies: safe-buffer "~5.1.1" -convert-source-map@^0.3.3: - version "0.3.5" - resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-0.3.5.tgz#f1d802950af7dd2631a1febe0596550c86ab3190" - cookie-signature@1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/cookie-signature/-/cookie-signature-1.0.6.tgz#e303a882b342cc3ee8ca513a79999734dab3ae2c" @@ -7899,15 +7874,6 @@ css.escape@1.5.1: resolved "https://registry.yarnpkg.com/css.escape/-/css.escape-1.5.1.tgz#42e27d4fa04ae32f931a4b4d4191fa9cddee97cb" integrity sha1-QuJ9T6BK4y+TGktNQZH6nN3ul8s= -css@^2.0.0: - version "2.2.4" - resolved "https://registry.yarnpkg.com/css/-/css-2.2.4.tgz#c646755c73971f2bba6a601e2cf2fd71b1298929" - dependencies: - inherits "^2.0.3" - source-map "^0.6.1" - source-map-resolve "^0.5.2" - urix "^0.1.0" - css@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/css/-/css-3.0.0.tgz#4447a4d58fdd03367c516ca9f64ae365cee4aa5d" @@ -8069,6 +8035,7 @@ cyclist@^1.0.1: d@1, d@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/d/-/d-1.0.1.tgz#8698095372d58dbee346ffd0c7093f99f8f9eb5a" + integrity sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA== dependencies: es5-ext "^0.10.50" type "^1.0.1" @@ -8805,17 +8772,19 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" -es5-ext@^0.10.35, es5-ext@^0.10.50: +es5-ext@0.10.53, es5-ext@^0.10.35, es5-ext@^0.10.50: version "0.10.53" resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.53.tgz#93c5a3acfdbef275220ad72644ad02ee18368de1" + integrity sha512-Xs2Stw6NiNHWypzRTY1MtaG/uJlwCk8kH81920ma8mvN8Xq1gsfhZvpkImLQArw8AHnv8MT2I45J3c0R8slE+Q== dependencies: es6-iterator "~2.0.3" es6-symbol "~3.1.3" next-tick "~1.0.0" -es6-iterator@2.0.3, es6-iterator@~2.0.3: +es6-iterator@~2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.3.tgz#a7de889141a05a94b0854403b2d0a0fbfa98f3b7" + integrity sha1-p96IkUGgWpSwhUQDstCg+/qY87c= dependencies: d "1" es5-ext "^0.10.35" @@ -8839,6 +8808,7 @@ es6-promisify@^5.0.0: es6-symbol@^3.1.1, es6-symbol@~3.1.3: version "3.1.3" resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.3.tgz#bad5d3c1bcdac28269f4cb331e431c78ac705d18" + integrity sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA== dependencies: d "^1.0.1" ext "^1.1.2" @@ -9402,10 +9372,11 @@ express@4.17.0: vary "~1.1.2" ext@^1.1.2: - version "1.4.0" - resolved "https://registry.yarnpkg.com/ext/-/ext-1.4.0.tgz#89ae7a07158f79d35517882904324077e4379244" + version "1.6.0" + resolved "https://registry.yarnpkg.com/ext/-/ext-1.6.0.tgz#3871d50641e874cc172e2b53f919842d19db4c52" + integrity sha512-sdBImtzkq2HpkdRLtlLWDa6w4DX22ijZLKx8BMPUuKe1c5lbN6xwQDQCxSfxBQnHZ13ls/FH0MQZx/q/gr6FQg== dependencies: - type "^2.0.0" + type "^2.5.0" extend-shallow@^2.0.1: version "2.0.1" @@ -13988,6 +13959,7 @@ nested-error-stacks@^2.0.0, nested-error-stacks@^2.1.0: next-tick@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/next-tick/-/next-tick-1.0.0.tgz#ca86d1fe8828169b0120208e3dc8424b9db8342c" + integrity sha1-yobR/ogoFpsBICCOPchCS524NCw= nice-try@^1.0.4: version "1.0.5" @@ -15942,14 +15914,6 @@ postcss@7.0.14: source-map "^0.6.1" supports-color "^6.1.0" -postcss@7.0.21: - version "7.0.21" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.21.tgz#06bb07824c19c2021c5d056d5b10c35b989f7e17" - dependencies: - chalk "^2.4.2" - source-map "^0.6.1" - supports-color "^6.1.0" - postcss@7.0.32, postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.11, postcss@^7.0.14, postcss@^7.0.17, postcss@^7.0.18, postcss@^7.0.2, postcss@^7.0.21, postcss@^7.0.26, postcss@^7.0.32, postcss@^7.0.5, postcss@^7.0.6, postcss@^7.0.7: version "7.0.32" resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.32.tgz#4310d6ee347053da3433db2be492883d62cec59d" @@ -16314,14 +16278,14 @@ punycode@1.3.2: resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" integrity sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0= +punycode@2.1.1, punycode@^2.1.0, punycode@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" + punycode@^1.2.4: version "1.4.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" -punycode@^2.1.0, punycode@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" - pupa@^2.0.1: version "2.1.1" resolved "https://registry.yarnpkg.com/pupa/-/pupa-2.1.1.tgz#f5e8fd4afc2c5d97828faa523549ed8744a20d62" @@ -16799,11 +16763,6 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" -regex-parser@^2.2.11: - version "2.2.11" - resolved "https://registry.yarnpkg.com/regex-parser/-/regex-parser-2.2.11.tgz#3b37ec9049e19479806e878cabe7c1ca83ccfe58" - integrity sha512-jbD/FT0+9MBU2XAZluI7w2OBs1RBi6p9M83nkoZayQXXU9e8Robt69FcZc7wU4eJD/YFTjn1JdCk3rbMJajz8Q== - regexp.prototype.flags@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.3.1.tgz#7ef352ae8d159e758c0eadca6f8fcb4eef07be26" @@ -17110,22 +17069,6 @@ resolve-from@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" -resolve-url-loader@3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/resolve-url-loader/-/resolve-url-loader-3.1.2.tgz#235e2c28e22e3e432ba7a5d4e305c59a58edfc08" - integrity sha512-QEb4A76c8Mi7I3xNKXlRKQSlLBwjUV/ULFMP+G7n3/7tJZ8MG5wsZ3ucxP1Jz8Vevn6fnJsxDx9cIls+utGzPQ== - dependencies: - adjust-sourcemap-loader "3.0.0" - camelcase "5.3.1" - compose-function "3.0.3" - convert-source-map "1.7.0" - es6-iterator "2.0.3" - loader-utils "1.2.3" - postcss "7.0.21" - rework "1.0.1" - rework-visit "1.0.0" - source-map "0.6.1" - resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" @@ -17239,17 +17182,6 @@ reusify@^1.0.4: resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== -rework-visit@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/rework-visit/-/rework-visit-1.0.0.tgz#9945b2803f219e2f7aca00adb8bc9f640f842c9a" - -rework@1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/rework/-/rework-1.0.1.tgz#30806a841342b54510aa4110850cd48534144aa7" - dependencies: - convert-source-map "^0.3.3" - css "^2.0.0" - rewrite-imports@^1.0.0: version "1.4.0" resolved "https://registry.yarnpkg.com/rewrite-imports/-/rewrite-imports-1.4.0.tgz#198ebb73f59cfee8d214516c774b6aeef2c54a6e" @@ -17634,7 +17566,7 @@ set-value@^2.0.0, set-value@^2.0.1: is-plain-object "^2.0.3" split-string "^3.0.1" -setimmediate@^1.0.4: +setimmediate@1.0.5, setimmediate@^1.0.4: version "1.0.5" resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" integrity sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU= @@ -17844,7 +17776,7 @@ source-list-map@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34" -source-map-resolve@^0.5.0, source-map-resolve@^0.5.2: +source-map-resolve@^0.5.0: version "0.5.3" resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.3.tgz#190866bece7553e1f8f267a2ee82c606b5509a1a" dependencies: @@ -19085,10 +19017,83 @@ tunnel-agent@^0.6.0: dependencies: safe-buffer "^5.0.1" -turbo@1.0.14: - version "1.0.14" - resolved "https://registry.yarnpkg.com/turbo/-/turbo-1.0.14.tgz#42ace0d1c699f0c1cb19b589b6d629dfa72b62b4" - integrity sha512-FfKP1rjx8LF/n8eibVOVlv7XzTszMHCg43RHCLFxGAEKluDCw3hyFAFNJumECktiGOt19M54h+HEGW/BDZeW2g== +turbo-darwin-64@1.0.24: + version "1.0.24" + resolved "https://registry.yarnpkg.com/turbo-darwin-64/-/turbo-darwin-64-1.0.24.tgz#f135baff0e44f9160c9b027e8c4dd2d5c8bb10a7" + integrity sha512-A65Wxp+jBMfI3QX2uObX6DKvk+TxNXTf7ufQTHvRSLeAreB8QiVzJdYE0nC6YdrRwfPgFY3L72dhYd2v8ouXDg== + +turbo-darwin-arm64@1.0.24: + version "1.0.24" + resolved "https://registry.yarnpkg.com/turbo-darwin-arm64/-/turbo-darwin-arm64-1.0.24.tgz#c360d7cc6a7403855733e3aebb841b1227fbbb2e" + integrity sha512-31zfexqUhvk/CIfAUk2mwjlpEjIURXu4QG8hoWlGxpcpAhlnkIX6CXle+LoQSnU3+4EbNe2SE92fYXsT/SnHAg== + +turbo-freebsd-64@1.0.24: + version "1.0.24" + resolved "https://registry.yarnpkg.com/turbo-freebsd-64/-/turbo-freebsd-64-1.0.24.tgz#9ef8914e7d1aaa995a8001a0ad81f7cc4520d332" + integrity sha512-vZYbDkOHH5eeQrxsAYldrh2nDY884irtmgJdGbpjryJgnJx+xzriZfoFalm/d1ZfG3ArENRJqGU+k6BriefZzw== + +turbo-freebsd-arm64@1.0.24: + version "1.0.24" + resolved "https://registry.yarnpkg.com/turbo-freebsd-arm64/-/turbo-freebsd-arm64-1.0.24.tgz#12644e8f1b077f9d7afb367f2b8c2a2e0592ca72" + integrity sha512-TDIu1PlyusY8AB69KGM4wGrCjtfbzmVF4Hlgf9mVeSWVKzqkRASorOEq1k8KvfZ+sBTS2GBMpqwpa1KVkYpVhw== + +turbo-linux-32@1.0.24: + version "1.0.24" + resolved "https://registry.yarnpkg.com/turbo-linux-32/-/turbo-linux-32-1.0.24.tgz#6129f7560f5c48214c1724ae7e8196dedc56de21" + integrity sha512-lhhK7914sUtuWYcDO8LV7NQkvTIwpAZlYH0XEOC/OTiYRQJvtKbEySLvefvtwuGjx7cGNI6OYraUsY3WWoK3FA== + +turbo-linux-64@1.0.24: + version "1.0.24" + resolved "https://registry.yarnpkg.com/turbo-linux-64/-/turbo-linux-64-1.0.24.tgz#221e3e14037e8fc3108e12a62de209d8a47f0348" + integrity sha512-EbfdrkwVsHDG7AIVQ1enWHoD6riAApx4VRAuFcQHTvJU9e+BuOQBMjb7e9jO4mUrpumtN3n20tP+86odRwsk5g== + +turbo-linux-arm64@1.0.24: + version "1.0.24" + resolved "https://registry.yarnpkg.com/turbo-linux-arm64/-/turbo-linux-arm64-1.0.24.tgz#95891e7d4375ccbf2478677568557948be33717a" + integrity sha512-H4rqlgP2L7G3iAB/un/7DclExzLUkQ1NoZ0p/1Oa7Wb8H1YUlc8GkwUmpIFd5AOFSPL75DjYvlS8T5Tm23i+1A== + +turbo-linux-arm@1.0.24: + version "1.0.24" + resolved "https://registry.yarnpkg.com/turbo-linux-arm/-/turbo-linux-arm-1.0.24.tgz#f5acb74170a8b5a787915e799e7b52840c7c6982" + integrity sha512-lCNDVEkwxcn0acyPFVJgV5N5vKAP4LfXb+8uW/JpGHVoPHSONKtzYQG05J1KbHXpIjUT+DNgFtshtsdZYOewZQ== + +turbo-linux-mips64le@1.0.24: + version "1.0.24" + resolved "https://registry.yarnpkg.com/turbo-linux-mips64le/-/turbo-linux-mips64le-1.0.24.tgz#f2cc99570222ac42fdcc0d0638f13bc0176859f9" + integrity sha512-AmrgQUDIe9AdNyh5YrI6pfMTUHD/gYfbylNmedLuN5Al3xINdZObcISzd/7VWd+V8wNW/1b9lUnt70Rv/KExfA== + +turbo-linux-ppc64le@1.0.24: + version "1.0.24" + resolved "https://registry.yarnpkg.com/turbo-linux-ppc64le/-/turbo-linux-ppc64le-1.0.24.tgz#4d9508290d24cfdbaca24e57d8bcd0127281e2ed" + integrity sha512-+6ESjsfrvRUr1AsurNcRTrqYr+XHG8g763+hXLog1MP9mn1cufZqWlAyE4G8/MLXDHsEKgK+tXqPLIyLBRjLEw== + +turbo-windows-32@1.0.24: + version "1.0.24" + resolved "https://registry.yarnpkg.com/turbo-windows-32/-/turbo-windows-32-1.0.24.tgz#2bf906c0cc9d675afc4693221fc339ade29e6c13" + integrity sha512-pqRys+FfHxuLVmW/AariITL5qpItp4WPAsYnWLx4u7VpCOO/qmTAI/SL7/jnTm4gxjBv3uf//lisu0AvEZd+TA== + +turbo-windows-64@1.0.24: + version "1.0.24" + resolved "https://registry.yarnpkg.com/turbo-windows-64/-/turbo-windows-64-1.0.24.tgz#5dd30b10110f2bb69caa479ddd72b4c471fb0dea" + integrity sha512-YHAWha5XkW0Ate1HtwhzFD32kZFXtC8KB4ReEvHc9GM2inQob1ZinvktS0xi5MC5Sxl9+bObOWmsxeZPOgNCFA== + +turbo@1.0.24: + version "1.0.24" + resolved "https://registry.yarnpkg.com/turbo/-/turbo-1.0.24.tgz#5efdeb44aab2f5e97b24a3e0ed4a159bfcd0a877" + integrity sha512-bfOr7iW48+chDl+yKiZ5FIWzXOF6xOIyrAGPaWI+I5CdD27IZCEGvqvTV/weaHvjLbV7otybHQ56XCybBlVjoA== + optionalDependencies: + turbo-darwin-64 "1.0.24" + turbo-darwin-arm64 "1.0.24" + turbo-freebsd-64 "1.0.24" + turbo-freebsd-arm64 "1.0.24" + turbo-linux-32 "1.0.24" + turbo-linux-64 "1.0.24" + turbo-linux-arm "1.0.24" + turbo-linux-arm64 "1.0.24" + turbo-linux-mips64le "1.0.24" + turbo-linux-ppc64le "1.0.24" + turbo-windows-32 "1.0.24" + turbo-windows-64 "1.0.24" tweetnacl@^0.14.3, tweetnacl@~0.14.0: version "0.14.5" @@ -19157,10 +19162,12 @@ type-is@~1.6.17, type-is@~1.6.18: type@^1.0.1: version "1.2.0" resolved "https://registry.yarnpkg.com/type/-/type-1.2.0.tgz#848dd7698dafa3e54a6c479e759c4bc3f18847a0" + integrity sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg== -type@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/type/-/type-2.0.0.tgz#5f16ff6ef2eb44f260494dae271033b29c09a9c3" +type@^2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/type/-/type-2.5.0.tgz#0a2e78c2e77907b252abe5f298c1b01c63f0db3d" + integrity sha512-180WMDQaIMm3+7hGXWf12GtdniDEy7nYcyFMKJn/eZz/6tSLXrUN9V0wKSbMjej0I1WHWbpREDEKHtqPQa9NNw== typedarray-to-buffer@^3.1.5: version "3.1.5" From 971b13c98ea8211338bcacd8b41ab4f7526e39af Mon Sep 17 00:00:00 2001 From: kumard3 Date: Sat, 8 Jan 2022 08:14:20 +0530 Subject: [PATCH 3/4] progressive web app converted to typescript --- examples/progressive-web-app/next-env.d.ts | 5 +++++ examples/progressive-web-app/next.config.js | 1 + examples/progressive-web-app/package.json | 5 +++++ .../pages/{_app.js => _app.tsx} | 0 .../pages/api/{hello.js => hello.ts} | 0 .../pages/{index.js => index.tsx} | 0 examples/progressive-web-app/tsconfig.json | 20 +++++++++++++++++++ 7 files changed, 31 insertions(+) create mode 100644 examples/progressive-web-app/next-env.d.ts rename examples/progressive-web-app/pages/{_app.js => _app.tsx} (100%) rename examples/progressive-web-app/pages/api/{hello.js => hello.ts} (100%) rename examples/progressive-web-app/pages/{index.js => index.tsx} (100%) create mode 100644 examples/progressive-web-app/tsconfig.json diff --git a/examples/progressive-web-app/next-env.d.ts b/examples/progressive-web-app/next-env.d.ts new file mode 100644 index 0000000000000..4f11a03dc6cc3 --- /dev/null +++ b/examples/progressive-web-app/next-env.d.ts @@ -0,0 +1,5 @@ +/// +/// + +// NOTE: This file should not be edited +// see https://nextjs.org/docs/basic-features/typescript for more information. diff --git a/examples/progressive-web-app/next.config.js b/examples/progressive-web-app/next.config.js index 778ea93311dec..a62a930ff3634 100644 --- a/examples/progressive-web-app/next.config.js +++ b/examples/progressive-web-app/next.config.js @@ -1,3 +1,4 @@ +/** @type {import('next').NextConfig} */ const withPWA = require('next-pwa') const runtimeCaching = require('next-pwa/cache') diff --git a/examples/progressive-web-app/package.json b/examples/progressive-web-app/package.json index c16f55ccc4985..1c8039c1130c0 100644 --- a/examples/progressive-web-app/package.json +++ b/examples/progressive-web-app/package.json @@ -10,5 +10,10 @@ "next-pwa": "^5.4.1", "react": "^17.0.2", "react-dom": "^17.0.2" + }, + "devDependencies": { + "@types/node": "17.0.4", + "@types/react": "17.0.38", + "typescript": "4.5.4" } } diff --git a/examples/progressive-web-app/pages/_app.js b/examples/progressive-web-app/pages/_app.tsx similarity index 100% rename from examples/progressive-web-app/pages/_app.js rename to examples/progressive-web-app/pages/_app.tsx diff --git a/examples/progressive-web-app/pages/api/hello.js b/examples/progressive-web-app/pages/api/hello.ts similarity index 100% rename from examples/progressive-web-app/pages/api/hello.js rename to examples/progressive-web-app/pages/api/hello.ts diff --git a/examples/progressive-web-app/pages/index.js b/examples/progressive-web-app/pages/index.tsx similarity index 100% rename from examples/progressive-web-app/pages/index.js rename to examples/progressive-web-app/pages/index.tsx diff --git a/examples/progressive-web-app/tsconfig.json b/examples/progressive-web-app/tsconfig.json new file mode 100644 index 0000000000000..99710e857874f --- /dev/null +++ b/examples/progressive-web-app/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "target": "es5", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true, + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true + }, + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], + "exclude": ["node_modules"] +} From 325b5cb6dde2e7decfd566025139ee114fc2466a Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Sun, 6 Feb 2022 15:11:04 -0600 Subject: [PATCH 4/4] update types --- examples/progressive-web-app/pages/_app.tsx | 3 ++- examples/progressive-web-app/pages/api/hello.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/progressive-web-app/pages/_app.tsx b/examples/progressive-web-app/pages/_app.tsx index cca47aae9e44a..3601ddfa987de 100644 --- a/examples/progressive-web-app/pages/_app.tsx +++ b/examples/progressive-web-app/pages/_app.tsx @@ -1,7 +1,8 @@ import Head from 'next/head' import '../styles/globals.css' +import { AppProps } from 'next/app' -export default function MyApp({ Component, pageProps }) { +export default function MyApp({ Component, pageProps }: AppProps) { return ( <> diff --git a/examples/progressive-web-app/pages/api/hello.ts b/examples/progressive-web-app/pages/api/hello.ts index 1424b47343d64..a42f4634c2b13 100644 --- a/examples/progressive-web-app/pages/api/hello.ts +++ b/examples/progressive-web-app/pages/api/hello.ts @@ -1,6 +1,7 @@ // Next.js API route support: https://nextjs.org/docs/api-routes/introduction +import { NextApiRequest, NextApiResponse } from 'next' -const hello = (req, res) => { +const hello = (req: NextApiRequest, res: NextApiResponse) => { res.status(200).json({ name: 'John Doe' }) }