From 24cce84e4bfccb1539053179e966647fdd26a3c9 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Sat, 29 Apr 2023 23:51:28 +0100 Subject: [PATCH 01/25] feat(nuxt): add layer meta and env overrides to config types (#20329) --- packages/nuxt/config.d.ts | 3 ++- packages/nuxt/package.json | 1 + pnpm-lock.yaml | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/nuxt/config.d.ts b/packages/nuxt/config.d.ts index 8d844bad60..ddd2beade0 100644 --- a/packages/nuxt/config.d.ts +++ b/packages/nuxt/config.d.ts @@ -1,4 +1,5 @@ import type { NuxtConfig } from 'nuxt/schema' +import type { DefineConfig, InputConfig, UserInputConfig, ConfigLayerMeta } from 'c12' export { NuxtConfig } from 'nuxt/schema' -export declare function defineNuxtConfig(config: NuxtConfig): NuxtConfig +export declare const defineNuxtConfig: DefineConfig diff --git a/packages/nuxt/package.json b/packages/nuxt/package.json index 2dabc903b3..4a53a1a102 100644 --- a/packages/nuxt/package.json +++ b/packages/nuxt/package.json @@ -61,6 +61,7 @@ "@unhead/ssr": "^1.1.26", "@unhead/vue": "^1.1.26", "@vue/shared": "^3.2.47", + "c12": "^1.3.0", "chokidar": "^3.5.3", "cookie-es": "^0.5.0", "defu": "^6.1.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b89cd58db9..b2aaefb3ed 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -587,6 +587,9 @@ importers: '@vue/shared': specifier: ^3.2.47 version: 3.2.47 + c12: + specifier: ^1.3.0 + version: 1.4.1 chokidar: specifier: ^3.5.3 version: 3.5.3 From 4e7206bfabbb56e5d0814e91720213693d2b111b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C5=91=20Jedlicska?= <57442769+gjedlicska@users.noreply.github.com> Date: Sun, 30 Apr 2023 00:01:10 +0100 Subject: [PATCH 02/25] feat(test-utils): add option to configure test server port (#20443) --- docs/1.getting-started/11.testing.md | 7 +++++++ packages/test-utils/src/server.ts | 2 +- packages/test-utils/src/types.ts | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/1.getting-started/11.testing.md b/docs/1.getting-started/11.testing.md index 45f06b5707..6ae12d8375 100644 --- a/docs/1.getting-started/11.testing.md +++ b/docs/1.getting-started/11.testing.md @@ -84,6 +84,13 @@ Whether to launch a server to respond to requests in the test suite. * Type: `boolean` * Default: `true` +#### `port` + +If provided, set the launched test server port to the value. + +* Type: `number | undefined` +* Default: `undefined` + #### `build` Whether to run a separate build step. diff --git a/packages/test-utils/src/server.ts b/packages/test-utils/src/server.ts index 78e803b8ba..99c55e60b4 100644 --- a/packages/test-utils/src/server.ts +++ b/packages/test-utils/src/server.ts @@ -13,7 +13,7 @@ const kit: typeof _kit = _kit.default || _kit export async function startServer () { const ctx = useTestContext() await stopServer() - const port = await getRandomPort() + const port = ctx.options.port || await getRandomPort() ctx.url = 'http://127.0.0.1:' + port if (ctx.options.dev) { const nuxiCLI = await kit.resolvePath('nuxi/cli') diff --git a/packages/test-utils/src/types.ts b/packages/test-utils/src/types.ts index ab8612ff21..e40e389da6 100644 --- a/packages/test-utils/src/types.ts +++ b/packages/test-utils/src/types.ts @@ -23,6 +23,7 @@ export interface TestOptions { launch?: LaunchOptions } server: boolean + port?: number } export interface TestContext { From 9b956c9689b84cdb9450ee99f09fa10b29fbdbad Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 30 Apr 2023 00:27:12 +0100 Subject: [PATCH 03/25] chore(deps): update all non-major dependencies (main) (#20570) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- package.json | 2 +- packages/nuxt/package.json | 2 +- packages/webpack/package.json | 2 +- pnpm-lock.yaml | 203 ++++++++-------------------------- 4 files changed, 50 insertions(+), 159 deletions(-) diff --git a/package.json b/package.json index 2880b7be5c..98185d2cab 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "@nuxt/webpack-builder": "workspace:*", "@nuxtjs/eslint-config-typescript": "^12.0.0", "@types/crawler": "^1.2.2", - "@types/node": "^18.16.2", + "@types/node": "^18.16.3", "@types/semver": "^7.3.13", "case-police": "^0.5.14", "changelogen": "^0.5.3", diff --git a/packages/nuxt/package.json b/packages/nuxt/package.json index 4a53a1a102..64b23e13fa 100644 --- a/packages/nuxt/package.json +++ b/packages/nuxt/package.json @@ -61,7 +61,7 @@ "@unhead/ssr": "^1.1.26", "@unhead/vue": "^1.1.26", "@vue/shared": "^3.2.47", - "c12": "^1.3.0", + "c12": "^1.4.1", "chokidar": "^3.5.3", "cookie-es": "^0.5.0", "defu": "^6.1.2", diff --git a/packages/webpack/package.json b/packages/webpack/package.json index 9df1ef9fa8..be0d63e036 100644 --- a/packages/webpack/package.json +++ b/packages/webpack/package.json @@ -43,7 +43,7 @@ "pify": "^6.1.0", "postcss": "^8.4.23", "postcss-import": "^15.1.0", - "postcss-loader": "^7.2.4", + "postcss-loader": "^7.3.0", "postcss-url": "^10.1.3", "std-env": "^3.3.2", "time-fix-plugin": "^2.0.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b2aaefb3ed..3872cca27b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -34,8 +34,8 @@ importers: specifier: ^1.2.2 version: 1.2.2 '@types/node': - specifier: ^18.16.2 - version: 18.16.2 + specifier: ^18.16.3 + version: 18.16.3 '@types/semver': specifier: ^7.3.13 version: 7.3.13 @@ -116,7 +116,7 @@ importers: version: 1.2.1 vite: specifier: ^4.3.3 - version: 4.3.3(@types/node@18.16.2) + version: 4.3.3(@types/node@18.16.3) vitest: specifier: ^0.30.1 version: 0.30.1(playwright@1.33.0) @@ -447,7 +447,7 @@ importers: version: 1.2.1 vite: specifier: ^4.3.3 - version: 4.3.3(@types/node@18.16.2) + version: 4.3.3(@types/node@18.16.3) vitest: specifier: ^0.30.1 version: 0.30.1(playwright@1.33.0) @@ -577,7 +577,7 @@ importers: version: link:../vite '@types/node': specifier: ^14.18.0 || >=16.10.0 - version: 18.16.2 + version: 18.16.3 '@unhead/ssr': specifier: ^1.1.26 version: 1.1.26 @@ -588,7 +588,7 @@ importers: specifier: ^3.2.47 version: 3.2.47 c12: - specifier: ^1.3.0 + specifier: ^1.4.1 version: 1.4.1 chokidar: specifier: ^3.5.3 @@ -725,7 +725,7 @@ importers: version: 1.2.1 vite: specifier: ^4.3.3 - version: 4.3.3(@types/node@18.16.2) + version: 4.3.3(@types/node@18.16.3) vitest: specifier: ^0.30.1 version: 0.30.1(playwright@1.33.0) @@ -789,7 +789,7 @@ importers: version: 2.3.0 vite: specifier: ^4.3.3 - version: 4.3.3(@types/node@18.16.2) + version: 4.3.3(@types/node@18.16.3) vue: specifier: 3.2.47 version: 3.2.47 @@ -943,10 +943,10 @@ importers: version: 1.3.1 vite: specifier: ^4.3.3 - version: 4.3.3(@types/node@18.16.2) + version: 4.3.3(@types/node@18.16.3) vite-node: specifier: ^0.30.1 - version: 0.30.1(@types/node@18.16.2) + version: 0.30.1(@types/node@18.16.3) vite-plugin-checker: specifier: ^0.5.6 version: 0.5.6(eslint@8.39.0)(typescript@5.0.4)(vite@4.3.3)(vue-tsc@1.6.1) @@ -1042,8 +1042,8 @@ importers: specifier: ^15.1.0 version: 15.1.0(postcss@8.4.23) postcss-loader: - specifier: ^7.2.4 - version: 7.2.4(@types/node@18.16.2)(postcss@8.4.23)(ts-node@10.9.1)(typescript@5.0.4)(webpack@5.81.0) + specifier: ^7.3.0 + version: 7.3.0(postcss@8.4.23)(webpack@5.81.0) postcss-url: specifier: ^10.1.3 version: 10.1.3(postcss@8.4.23) @@ -1537,13 +1537,6 @@ packages: dependencies: mime: 3.0.0 - /@cspotcode/source-map-support@0.8.1: - resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} - engines: {node: '>=12'} - dependencies: - '@jridgewell/trace-mapping': 0.3.9 - dev: false - /@discoveryjs/json-ext@0.5.7: resolution: {integrity: sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==} engines: {node: '>=10.0.0'} @@ -1850,7 +1843,7 @@ packages: dependencies: '@jest/fake-timers': 29.5.0 '@jest/types': 29.5.0 - '@types/node': 18.16.2 + '@types/node': 18.16.3 jest-mock: 29.5.0 dev: true @@ -1877,7 +1870,7 @@ packages: dependencies: '@jest/types': 29.5.0 '@sinonjs/fake-timers': 10.0.2 - '@types/node': 18.16.2 + '@types/node': 18.16.3 jest-message-util: 29.5.0 jest-mock: 29.5.0 jest-util: 29.5.0 @@ -1931,7 +1924,7 @@ packages: '@jest/schemas': 29.4.3 '@types/istanbul-lib-coverage': 2.0.4 '@types/istanbul-reports': 3.0.1 - '@types/node': 18.16.2 + '@types/node': 18.16.3 '@types/yargs': 17.0.22 chalk: 4.1.2 @@ -1973,13 +1966,6 @@ packages: '@jridgewell/resolve-uri': 3.1.0 '@jridgewell/sourcemap-codec': 1.4.14 - /@jridgewell/trace-mapping@0.3.9: - resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} - dependencies: - '@jridgewell/resolve-uri': 3.1.0 - '@jridgewell/sourcemap-codec': 1.4.14 - dev: false - /@mapbox/node-pre-gyp@1.0.10: resolution: {integrity: sha512-4ySo4CjzStuprMwk35H5pPbkymjv1SF3jGLj6rAHp/xT/RF7TL7bd9CTm1xDY49K2qF7jmR/g7k+SkLETP6opA==} hasBin: true @@ -2331,22 +2317,6 @@ packages: engines: {node: '>=10.13.0'} dev: false - /@tsconfig/node10@1.0.9: - resolution: {integrity: sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==} - dev: false - - /@tsconfig/node12@1.0.11: - resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==} - dev: false - - /@tsconfig/node14@1.0.3: - resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==} - dev: false - - /@tsconfig/node16@1.0.3: - resolution: {integrity: sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==} - dev: false - /@types/babel__traverse@7.18.3: resolution: {integrity: sha512-1kbcJ40lLB7MHsj39U4Sh1uTd2E7rLEa79kmDpI6cy+XiXsteB3POdQomoq4FxszMrO3ZYchkhYJw7A2862b3w==} dependencies: @@ -2366,7 +2336,7 @@ packages: /@types/cheerio@0.22.31: resolution: {integrity: sha512-Kt7Cdjjdi2XWSfrZ53v4Of0wG3ZcmaegFXjMmz9tfNrZSkzzo36G0AL1YqSdcIA78Etjt6E609pt5h1xnQkPUw==} dependencies: - '@types/node': 18.16.2 + '@types/node': 18.16.3 dev: true /@types/clear@0.1.2: @@ -2376,7 +2346,7 @@ packages: /@types/connect@3.4.35: resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==} dependencies: - '@types/node': 18.16.2 + '@types/node': 18.16.3 dev: true /@types/crawler@1.2.2: @@ -2408,13 +2378,13 @@ packages: resolution: {integrity: sha512-MxObHvNl4A69ofaTRU8DFqvgzzv8s9yRtaPPm5gud9HDNvpB3GPQFvNuTWAI59B9huVGV5jXYJwbCsmBsOGYWA==} dependencies: '@types/jsonfile': 6.1.1 - '@types/node': 18.16.2 + '@types/node': 18.16.3 dev: true /@types/graceful-fs@4.1.6: resolution: {integrity: sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==} dependencies: - '@types/node': 18.16.2 + '@types/node': 18.16.3 dev: true /@types/hash-sum@1.0.0: @@ -2444,7 +2414,7 @@ packages: /@types/jsonfile@6.1.1: resolution: {integrity: sha512-GSgiRCVeapDN+3pqA35IkQwasaCh/0YFH5dEF6S88iDvEn901DjOeH3/QPY+XYP1DFzDZPvIvfeEgk+7br5png==} dependencies: - '@types/node': 18.16.2 + '@types/node': 18.16.3 dev: true /@types/lodash-es@4.17.7: @@ -2467,8 +2437,8 @@ packages: resolution: {integrity: sha512-nJOuiTlsvmClSr3+a/trTSx4DTuY/VURsWGKSf/eeavh0LRMqdsK60ti0TlwM5iHiGOK3/Ibkxsbr7i9rzGreA==} dev: true - /@types/node@18.16.2: - resolution: {integrity: sha512-GQW/JL/5Fz/0I8RpeBG9lKp0+aNcXEaVL71c0D2Q0QHDTFvlYKT7an0onCUXj85anv7b4/WesqdfchLc0jtsCg==} + /@types/node@18.16.3: + resolution: {integrity: sha512-OPs5WnnT1xkCBiuQrZA4+YAV4HEJejmHneyraIaxsbev5yCEr6KMwINNFP9wQeFIw8FWcoTqF3vQsa5CDaI+8Q==} /@types/normalize-package-data@2.4.1: resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==} @@ -2489,7 +2459,7 @@ packages: /@types/prompts@2.4.4: resolution: {integrity: sha512-p5N9uoTH76lLvSAaYSZtBCdEXzpOOufsRjnhjVSrZGXikVGHX9+cc9ERtHRV4hvBKHyZb1bg4K+56Bd2TqUn4A==} dependencies: - '@types/node': 18.16.2 + '@types/node': 18.16.3 kleur: 3.0.3 dev: true @@ -2525,7 +2495,7 @@ packages: /@types/webpack-bundle-analyzer@4.6.0: resolution: {integrity: sha512-XeQmQCCXdZdap+A/60UKmxW5Mz31Vp9uieGlHB3T4z/o2OLVLtTI3bvTuS6A2OWd/rbAAQiGGWIEFQACu16szA==} dependencies: - '@types/node': 18.16.2 + '@types/node': 18.16.3 tapable: 2.2.1 webpack: 5.81.0 transitivePeerDependencies: @@ -2551,7 +2521,7 @@ packages: /@types/webpack-sources@3.2.0: resolution: {integrity: sha512-Ft7YH3lEVRQ6ls8k4Ff1oB4jN6oy/XmU6tQISKdhfh+1mR+viZFphS6WL0IrtDOzvefmJg5a0s7ZQoRXwqTEFg==} dependencies: - '@types/node': 18.16.2 + '@types/node': 18.16.3 '@types/source-list-map': 0.1.2 source-map: 0.7.4 dev: true @@ -2565,7 +2535,7 @@ packages: /@types/webpack@4.41.33: resolution: {integrity: sha512-PPajH64Ft2vWevkerISMtnZ8rTs4YmRbs+23c402J0INmxDKCrhZNvwZYtzx96gY2wAtXdrK1BS2fiC8MlLr3g==} dependencies: - '@types/node': 18.16.2 + '@types/node': 18.16.3 '@types/tapable': 1.0.8 '@types/uglify-js': 3.17.1 '@types/webpack-sources': 3.2.0 @@ -2926,7 +2896,7 @@ packages: '@unocss/scope': 0.45.30 '@unocss/transformer-directives': 0.45.30 magic-string: 0.30.0 - vite: 3.2.5(@types/node@18.16.2) + vite: 3.2.5(@types/node@18.16.3) transitivePeerDependencies: - rollup dev: true @@ -2978,7 +2948,7 @@ packages: '@babel/core': 7.21.4 '@babel/plugin-transform-typescript': 7.21.0(@babel/core@7.21.4) '@vue/babel-plugin-jsx': 1.1.1(@babel/core@7.21.4) - vite: 4.3.3(@types/node@18.16.2) + vite: 4.3.3(@types/node@18.16.3) vue: 3.2.47 transitivePeerDependencies: - supports-color @@ -2990,7 +2960,7 @@ packages: vite: ^4.0.0 vue: ^3.2.25 dependencies: - vite: 4.3.3(@types/node@18.16.2) + vite: 4.3.3(@types/node@18.16.3) vue: 3.2.47 /@vitest/expect@0.30.1: @@ -3530,10 +3500,6 @@ packages: delegates: 1.0.0 readable-stream: 3.6.2 - /arg@4.1.3: - resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} - dev: false - /argparse@1.0.10: resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} dependencies: @@ -4146,21 +4112,6 @@ packages: /core-util-is@1.0.3: resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} - /cosmiconfig-typescript-loader@4.3.0(@types/node@18.16.2)(cosmiconfig@8.1.3)(ts-node@10.9.1)(typescript@5.0.4): - resolution: {integrity: sha512-NTxV1MFfZDLPiBMjxbHRwSh5LaLcPMwNdCutmnHJCKoVnlvldPWlllonKwrsRJ5pYZBIBGRWWU2tfvzxgeSW5Q==} - engines: {node: '>=12', npm: '>=6'} - peerDependencies: - '@types/node': '*' - cosmiconfig: '>=7' - ts-node: '>=10' - typescript: '>=3' - dependencies: - '@types/node': 18.16.2 - cosmiconfig: 8.1.3 - ts-node: 10.9.1(@types/node@18.16.2)(typescript@5.0.4) - typescript: 5.0.4 - dev: false - /cosmiconfig@7.1.0: resolution: {integrity: sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==} engines: {node: '>=10'} @@ -4551,11 +4502,6 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dev: true - /diff@4.0.2: - resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} - engines: {node: '>=0.3.1'} - dev: false - /dir-glob@3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} @@ -6481,7 +6427,7 @@ packages: dependencies: '@jest/types': 29.5.0 '@types/graceful-fs': 4.1.6 - '@types/node': 18.16.2 + '@types/node': 18.16.3 anymatch: 3.1.3 fb-watchman: 2.0.2 graceful-fs: 4.2.10 @@ -6524,7 +6470,7 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.5.0 - '@types/node': 18.16.2 + '@types/node': 18.16.3 jest-util: 29.5.0 dev: true @@ -6569,7 +6515,7 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.5.0 - '@types/node': 18.16.2 + '@types/node': 18.16.3 chalk: 4.1.2 ci-info: 3.8.0 graceful-fs: 4.2.10 @@ -6579,7 +6525,7 @@ packages: resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==} engines: {node: '>= 10.13.0'} dependencies: - '@types/node': 18.16.2 + '@types/node': 18.16.3 merge-stream: 2.0.0 supports-color: 8.1.1 @@ -6587,7 +6533,7 @@ packages: resolution: {integrity: sha512-NcrQnevGoSp4b5kg+akIpthoAFHxPBcb5P6mYPY0fUNT+sSvmtu6jlkEle3anczUKIKEbMxFimk9oTP/tpIPgA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@types/node': 18.16.2 + '@types/node': 18.16.3 jest-util: 29.5.0 merge-stream: 2.0.0 supports-color: 8.1.1 @@ -6906,10 +6852,6 @@ packages: dependencies: semver: 6.3.0 - /make-error@1.3.6: - resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} - dev: false - /makeerror@1.0.12: resolution: {integrity: sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==} dependencies: @@ -7766,30 +7708,19 @@ packages: resolve: 1.22.1 dev: false - /postcss-loader@7.2.4(@types/node@18.16.2)(postcss@8.4.23)(ts-node@10.9.1)(typescript@5.0.4)(webpack@5.81.0): - resolution: {integrity: sha512-F88rpxxNspo5hatIc+orYwZDtHFaVFOSIVAx+fBfJC1GmhWbVmPWtmg2gXKE1OxJbneOSGn8PWdIwsZFcruS+w==} + /postcss-loader@7.3.0(postcss@8.4.23)(webpack@5.81.0): + resolution: {integrity: sha512-qLAFjvR2BFNz1H930P7mj1iuWJFjGey/nVhimfOAAQ1ZyPpcClAxP8+A55Sl8mBvM+K2a9Pjgdj10KpANWrNfw==} engines: {node: '>= 14.15.0'} peerDependencies: postcss: ^7.0.0 || ^8.0.1 - ts-node: '>=10' - typescript: '>=4' webpack: ^5.0.0 - peerDependenciesMeta: - ts-node: - optional: true - typescript: - optional: true dependencies: cosmiconfig: 8.1.3 - cosmiconfig-typescript-loader: 4.3.0(@types/node@18.16.2)(cosmiconfig@8.1.3)(ts-node@10.9.1)(typescript@5.0.4) + jiti: 1.18.2 klona: 2.0.6 postcss: 8.4.23 semver: 7.5.0 - ts-node: 10.9.1(@types/node@18.16.2)(typescript@5.0.4) - typescript: 5.0.4 webpack: 5.81.0 - transitivePeerDependencies: - - '@types/node' dev: false /postcss-merge-longhand@6.0.0(postcss@8.4.23): @@ -8993,37 +8924,6 @@ packages: /tr46@0.0.3: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} - /ts-node@10.9.1(@types/node@18.16.2)(typescript@5.0.4): - resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} - hasBin: true - peerDependencies: - '@swc/core': '>=1.2.50' - '@swc/wasm': '>=1.2.50' - '@types/node': '*' - typescript: '>=2.7' - peerDependenciesMeta: - '@swc/core': - optional: true - '@swc/wasm': - optional: true - dependencies: - '@cspotcode/source-map-support': 0.8.1 - '@tsconfig/node10': 1.0.9 - '@tsconfig/node12': 1.0.11 - '@tsconfig/node14': 1.0.3 - '@tsconfig/node16': 1.0.3 - '@types/node': 18.16.2 - acorn: 8.8.2 - acorn-walk: 8.2.0 - arg: 4.1.3 - create-require: 1.1.1 - diff: 4.0.2 - make-error: 1.3.6 - typescript: 5.0.4 - v8-compile-cache-lib: 3.0.1 - yn: 3.1.1 - dev: false - /tsconfig-paths@3.14.2: resolution: {integrity: sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==} dependencies: @@ -9397,10 +9297,6 @@ packages: hasBin: true dev: true - /v8-compile-cache-lib@3.0.1: - resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} - dev: false - /validate-npm-package-license@3.0.4: resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} dependencies: @@ -9417,7 +9313,7 @@ packages: extsprintf: 1.3.0 dev: true - /vite-node@0.30.1(@types/node@18.16.2): + /vite-node@0.30.1(@types/node@18.16.3): resolution: {integrity: sha512-vTikpU/J7e6LU/8iM3dzBo8ZhEiKZEKRznEMm+mJh95XhWaPrJQraT/QsT2NWmuEf+zgAoMe64PKT7hfZ1Njmg==} engines: {node: '>=v14.18.0'} hasBin: true @@ -9427,7 +9323,7 @@ packages: mlly: 1.2.0 pathe: 1.1.0 picocolors: 1.0.0 - vite: 4.3.3(@types/node@18.16.2) + vite: 4.3.3(@types/node@18.16.3) transitivePeerDependencies: - '@types/node' - less @@ -9482,7 +9378,7 @@ packages: strip-ansi: 6.0.1 tiny-invariant: 1.3.1 typescript: 5.0.4 - vite: 4.3.3(@types/node@18.16.2) + vite: 4.3.3(@types/node@18.16.3) vscode-languageclient: 7.0.0 vscode-languageserver: 7.0.0 vscode-languageserver-textdocument: 1.0.8 @@ -9490,7 +9386,7 @@ packages: vue-tsc: 1.6.1(typescript@5.0.4) dev: false - /vite@3.2.5(@types/node@18.16.2): + /vite@3.2.5(@types/node@18.16.3): resolution: {integrity: sha512-4mVEpXpSOgrssFZAOmGIr85wPHKvaDAcXqxVxVRZhljkJOMZi1ibLibzjLHzJvcok8BMguLc7g1W6W/GqZbLdQ==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true @@ -9515,7 +9411,7 @@ packages: terser: optional: true dependencies: - '@types/node': 18.16.2 + '@types/node': 18.16.3 esbuild: 0.15.18 postcss: 8.4.23 resolve: 1.22.1 @@ -9524,7 +9420,7 @@ packages: fsevents: 2.3.2 dev: true - /vite@4.3.3(@types/node@18.16.2): + /vite@4.3.3(@types/node@18.16.3): resolution: {integrity: sha512-MwFlLBO4udZXd+VBcezo3u8mC77YQk+ik+fbc0GZWGgzfbPP+8Kf0fldhARqvSYmtIWoAJ5BXPClUbMTlqFxrA==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true @@ -9549,7 +9445,7 @@ packages: terser: optional: true dependencies: - '@types/node': 18.16.2 + '@types/node': 18.16.3 esbuild: 0.17.18 postcss: 8.4.23 rollup: 3.21.0 @@ -9589,7 +9485,7 @@ packages: dependencies: '@types/chai': 4.3.4 '@types/chai-subset': 1.3.3 - '@types/node': 18.16.2 + '@types/node': 18.16.3 '@vitest/expect': 0.30.1 '@vitest/runner': 0.30.1 '@vitest/snapshot': 0.30.1 @@ -9611,8 +9507,8 @@ packages: strip-literal: 1.0.1 tinybench: 2.4.0 tinypool: 0.4.0 - vite: 4.3.3(@types/node@18.16.2) - vite-node: 0.30.1(@types/node@18.16.2) + vite: 4.3.3(@types/node@18.16.3) + vite-node: 0.30.1(@types/node@18.16.3) why-is-node-running: 2.2.2 transitivePeerDependencies: - less @@ -10043,11 +9939,6 @@ packages: y18n: 5.0.8 yargs-parser: 21.1.1 - /yn@3.1.1: - resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} - engines: {node: '>=6'} - dev: false - /yocto-queue@0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} From a13b18eddfe73976464656920da7ce8755a9fa0a Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sun, 30 Apr 2023 11:06:43 +0200 Subject: [PATCH 04/25] fix(nuxt): add `@nuxt/devtools` module before core modules (#20595) --- packages/nuxt/src/core/nuxt.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/nuxt/src/core/nuxt.ts b/packages/nuxt/src/core/nuxt.ts index 638fd6a29b..ee55729ca0 100644 --- a/packages/nuxt/src/core/nuxt.ts +++ b/packages/nuxt/src/core/nuxt.ts @@ -358,6 +358,17 @@ export async function loadNuxt (opts: LoadNuxtOptions): Promise { // Temporary until finding better placement for each options.appDir = options.alias['#app'] = resolve(distDir, 'app') options._majorVersion = 3 + + // Nuxt DevTools is currently opt-in + if (options.devtools === true || (options.devtools && options.devtools.enabled !== false)) { + if (await import('./features').then(r => r.ensurePackageInstalled(options.rootDir, '@nuxt/devtools', options.modulesDir))) { + options._modules.push('@nuxt/devtools') + } else { + logger.warn('Failed to install `@nuxt/devtools`, please install it manually, or disable `devtools` in `nuxt.config`') + } + } + + // Add core modules options._modules.push(pagesModule, metaModule, componentsModule) options._modules.push([importsModule, { transform: { @@ -376,15 +387,6 @@ export async function loadNuxt (opts: LoadNuxtOptions): Promise { options._modules.push('@nuxt/telemetry') } - // Nuxt DevTools is currently opt-in - if (options.devtools === true || (options.devtools && options.devtools.enabled !== false)) { - if (await import('./features').then(r => r.ensurePackageInstalled(options.rootDir, '@nuxt/devtools', options.modulesDir))) { - options._modules.push('@nuxt/devtools') - } else { - logger.warn('Failed to install `@nuxt/devtools`, please install it manually, or disable `devtools` in `nuxt.config`') - } - } - const nuxt = createNuxt(options) if (nuxt.options.debug) { From d2fc6ae614bef0d4c188db2ed4040288f5b07332 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sun, 30 Apr 2023 11:08:08 +0200 Subject: [PATCH 05/25] fix(nuxt): properly handle query for component wrapper (#20591) --- packages/nuxt/src/components/transform.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/nuxt/src/components/transform.ts b/packages/nuxt/src/components/transform.ts index d16b7b3538..2a6c5dba6e 100644 --- a/packages/nuxt/src/components/transform.ts +++ b/packages/nuxt/src/components/transform.ts @@ -21,15 +21,19 @@ export function createTransformPlugin (nuxt: Nuxt, getComponents: getComponentsT function getComponentsImports (): Import[] { const components = getComponents(mode) return components.flatMap((c): Import[] => { + const withMode = (mode: string | undefined) => mode + ? `${c.filePath}${c.filePath.includes('?') ? '&' : '?'}nuxt_component=${mode}` + : c.filePath + return [ { as: c.pascalName, - from: c.filePath + (c.mode === 'client' ? '?component=client' : ''), + from: withMode(c.mode === 'client' ? 'client' : undefined), name: 'default' }, { as: 'Lazy' + c.pascalName, - from: c.filePath + '?component=' + [c.mode === 'client' ? 'client' : '', 'async'].filter(Boolean).join(','), + from: withMode([c.mode === 'client' ? 'client' : '', 'async'].filter(Boolean).join(',')), name: 'default' } ] @@ -43,10 +47,10 @@ export function createTransformPlugin (nuxt: Nuxt, getComponents: getComponentsT }, async transform (code, id) { // Virtual component wrapper - if (id.includes('?component')) { + if (id.match(/[?&]nuxt_component=/)) { const { search } = parseURL(id) const query = parseQuery(search) - const mode = query.component + const mode = query.nuxt_component const bare = id.replace(/\?.*/, '') if (mode === 'async') { return [ From d2170b80b9b8ef1db840aa4dff1ccaa8f9521167 Mon Sep 17 00:00:00 2001 From: Harlan Wilton Date: Sun, 30 Apr 2023 16:10:09 +0700 Subject: [PATCH 06/25] fix(nuxt): skip payload extraction for island context (#20590) --- packages/nuxt/src/core/runtime/nitro/renderer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nuxt/src/core/runtime/nitro/renderer.ts b/packages/nuxt/src/core/runtime/nitro/renderer.ts index 77f3a1378b..0ec0d5d4be 100644 --- a/packages/nuxt/src/core/runtime/nitro/renderer.ts +++ b/packages/nuxt/src/core/runtime/nitro/renderer.ts @@ -199,7 +199,7 @@ export default defineRenderHandler(async (event): Promise Date: Mon, 1 May 2023 04:41:59 +0800 Subject: [PATCH 07/25] docs: update tailwind configuration guide (#20598) --- docs/1.getting-started/3.configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/1.getting-started/3.configuration.md b/docs/1.getting-started/3.configuration.md index 7a79927616..c7e3dc7457 100644 --- a/docs/1.getting-started/3.configuration.md +++ b/docs/1.getting-started/3.configuration.md @@ -131,5 +131,5 @@ Name | Config File | How To | [ESLint](https://eslint.org) | `.eslintrc.js` | [More Info](https://eslint.org/docs/latest/user-guide/configuring/configuration-files) | [Prettier](https://prettier.io) | `.prettierrc.json` | [More Info](https://prettier.io/docs/en/configuration.html) | [Stylelint](https://stylelint.io) | `.stylelintrc.json` | [More Info](https://stylelint.io/user-guide/configure) -| [TailwindCSS](https://tailwindcss.com) | `tailwind.config.js` | [More Info](https://tailwindcss.nuxt.dev/tailwind/config/) +| [TailwindCSS](https://tailwindcss.com) | `tailwind.config.js` | [More Info](https://tailwindcss.nuxtjs.org/tailwind/config/) | [Vitest](https://vitest.dev) | `vitest.config.ts` | [More Info](https://vitest.dev/config/) From c9c51cb3d8ac4d4a92d3d560536164f5833eb648 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 30 Apr 2023 22:27:31 +0100 Subject: [PATCH 08/25] chore(deps): update all non-major dependencies (main) (#20588) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- package.json | 2 +- packages/vite/package.json | 4 +- packages/webpack/package.json | 2 +- pnpm-lock.yaml | 136 ++++++++++++++++++++-------------- 4 files changed, 86 insertions(+), 58 deletions(-) diff --git a/package.json b/package.json index 98185d2cab..25c87f72bc 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "globby": "^13.1.4", "h3": "^1.6.4", "jiti": "^1.18.2", - "markdownlint-cli": "^0.33.0", + "markdownlint-cli": "^0.34.0", "nuxi": "workspace:*", "nuxt": "workspace:*", "ofetch": "^1.0.1", diff --git a/packages/vite/package.json b/packages/vite/package.json index d829e7fb87..b10d48675a 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -30,7 +30,7 @@ "@vitejs/plugin-vue-jsx": "^3.0.1", "autoprefixer": "^10.4.14", "clear": "^0.1.0", - "cssnano": "^6.0.0", + "cssnano": "^6.0.1", "defu": "^6.1.2", "esbuild": "^0.17.18", "escape-string-regexp": "^5.0.0", @@ -56,7 +56,7 @@ "unplugin": "^1.3.1", "vite": "~4.3.3", "vite-node": "^0.30.1", - "vite-plugin-checker": "^0.5.6", + "vite-plugin-checker": "^0.6.0", "vue-bundle-renderer": "^1.0.3" }, "peerDependencies": { diff --git a/packages/webpack/package.json b/packages/webpack/package.json index be0d63e036..c9be9c27dc 100644 --- a/packages/webpack/package.json +++ b/packages/webpack/package.json @@ -24,7 +24,7 @@ "autoprefixer": "^10.4.14", "css-loader": "^6.7.3", "css-minimizer-webpack-plugin": "^5.0.0", - "cssnano": "^6.0.0", + "cssnano": "^6.0.1", "esbuild-loader": "^3.0.1", "escape-string-regexp": "^5.0.0", "estree-walker": "^3.0.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3872cca27b..143cd434fb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -79,8 +79,8 @@ importers: specifier: ^1.18.2 version: 1.18.2 markdownlint-cli: - specifier: ^0.33.0 - version: 0.33.0 + specifier: ^0.34.0 + version: 0.34.0 nuxi: specifier: workspace:* version: link:packages/nuxi @@ -870,8 +870,8 @@ importers: specifier: ^0.1.0 version: 0.1.0 cssnano: - specifier: ^6.0.0 - version: 6.0.0(postcss@8.4.23) + specifier: ^6.0.1 + version: 6.0.1(postcss@8.4.23) defu: specifier: ^6.1.2 version: 6.1.2 @@ -948,8 +948,8 @@ importers: specifier: ^0.30.1 version: 0.30.1(@types/node@18.16.3) vite-plugin-checker: - specifier: ^0.5.6 - version: 0.5.6(eslint@8.39.0)(typescript@5.0.4)(vite@4.3.3)(vue-tsc@1.6.1) + specifier: ^0.6.0 + version: 0.6.0(eslint@8.39.0)(typescript@5.0.4)(vite@4.3.3)(vue-tsc@1.6.1) vue-bundle-renderer: specifier: ^1.0.3 version: 1.0.3 @@ -985,8 +985,8 @@ importers: specifier: ^5.0.0 version: 5.0.0(webpack@5.81.0) cssnano: - specifier: ^6.0.0 - version: 6.0.0(postcss@8.4.23) + specifier: ^6.0.1 + version: 6.0.1(postcss@8.4.23) esbuild-loader: specifier: ^3.0.1 version: 3.0.1(webpack@5.81.0) @@ -2151,6 +2151,13 @@ packages: node-gyp-build: 4.6.0 dev: true + /@pkgjs/parseargs@0.11.0: + resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} + engines: {node: '>=14'} + requiresBuild: true + dev: true + optional: true + /@pkgr/utils@2.3.1: resolution: {integrity: sha512-wfzX8kc1PMyUILA+1Z/EqoE4UCXGy0iRGMhPwdfae1+f0OXlLqCk+By+aMzgJBzR9AzS4CDizioG6Ss1gvAFJw==} engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} @@ -4030,6 +4037,11 @@ packages: delayed-stream: 1.0.0 dev: true + /commander@10.0.1: + resolution: {integrity: sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==} + engines: {node: '>=14'} + dev: true + /commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} @@ -4043,11 +4055,6 @@ packages: engines: {node: '>= 12'} dev: false - /commander@9.4.1: - resolution: {integrity: sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw==} - engines: {node: ^12.20.0 || >=14} - dev: true - /comment-parser@1.3.1: resolution: {integrity: sha512-B52sN2VNghyq5ofvUsqZjmk6YkihBX5vMSChmSK9v4ShjKf3Vk5Xcmgpw4o+iIgtrnM/u5FiMpz9VKb8lpBveA==} engines: {node: '>= 12.0.0'} @@ -4219,7 +4226,7 @@ packages: lightningcss: optional: true dependencies: - cssnano: 6.0.0(postcss@8.4.23) + cssnano: 6.0.1(postcss@8.4.23) jest-worker: 29.5.0 postcss: 8.4.23 schema-utils: 4.0.0 @@ -4276,8 +4283,8 @@ packages: engines: {node: '>=4'} hasBin: true - /cssnano-preset-default@6.0.0(postcss@8.4.23): - resolution: {integrity: sha512-BDxlaFzObRDXUiCCBQUNQcI+f1/aX2mgoNtXGjV6PG64POcHoDUoX+LgMWw+Q4609QhxwkcSnS65YFs42RA6qQ==} + /cssnano-preset-default@6.0.1(postcss@8.4.23): + resolution: {integrity: sha512-7VzyFZ5zEB1+l1nToKyrRkuaJIx0zi/1npjvZfbBwbtNTzhLtlvYraK/7/uqmX2Wb2aQtd983uuGw79jAjLSuQ==} engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 @@ -4285,7 +4292,7 @@ packages: css-declaration-sorter: 6.3.1(postcss@8.4.23) cssnano-utils: 4.0.0(postcss@8.4.23) postcss: 8.4.23 - postcss-calc: 8.2.4(postcss@8.4.23) + postcss-calc: 9.0.0(postcss@8.4.23) postcss-colormin: 6.0.0(postcss@8.4.23) postcss-convert-values: 6.0.0(postcss@8.4.23) postcss-discard-comments: 6.0.0(postcss@8.4.23) @@ -4293,7 +4300,7 @@ packages: postcss-discard-empty: 6.0.0(postcss@8.4.23) postcss-discard-overridden: 6.0.0(postcss@8.4.23) postcss-merge-longhand: 6.0.0(postcss@8.4.23) - postcss-merge-rules: 6.0.0(postcss@8.4.23) + postcss-merge-rules: 6.0.1(postcss@8.4.23) postcss-minify-font-values: 6.0.0(postcss@8.4.23) postcss-minify-gradients: 6.0.0(postcss@8.4.23) postcss-minify-params: 6.0.0(postcss@8.4.23) @@ -4323,13 +4330,13 @@ packages: postcss: 8.4.23 dev: false - /cssnano@6.0.0(postcss@8.4.23): - resolution: {integrity: sha512-RGlcbzGhzEBCHuQe3k+Udyj5M00z0pm9S+VurHXFEOXxH+y0sVrJH2sMzoyz2d8N1EScazg+DVvmgyx0lurwwA==} + /cssnano@6.0.1(postcss@8.4.23): + resolution: {integrity: sha512-fVO1JdJ0LSdIGJq68eIxOqFpIJrZqXUsBt8fkrBcztCQqAjQD51OhZp7tc0ImcbwXD4k7ny84QTV90nZhmqbkg==} engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 dependencies: - cssnano-preset-default: 6.0.0(postcss@8.4.23) + cssnano-preset-default: 6.0.1(postcss@8.4.23) lilconfig: 2.1.0 postcss: 8.4.23 dev: false @@ -5591,6 +5598,14 @@ packages: is-callable: 1.2.7 dev: true + /foreground-child@3.1.1: + resolution: {integrity: sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==} + engines: {node: '>=14'} + dependencies: + cross-spawn: 7.0.3 + signal-exit: 4.0.1 + dev: true + /forever-agent@0.6.1: resolution: {integrity: sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==} dev: true @@ -5809,14 +5824,16 @@ packages: /glob-to-regexp@0.4.1: resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==} - /glob@10.0.0: - resolution: {integrity: sha512-zmp9ZDC6NpDNLujV2W2n+3lH+BafIVZ4/ct+Yj3BMZTH/+bgm/eVjHzeFLwxJrrIGgjjS2eiQLlpurHsNlEAtQ==} + /glob@10.2.2: + resolution: {integrity: sha512-Xsa0BcxIC6th9UwNjZkhrMtNo/MnyRL8jGCP+uEwhA5oFOCY1f2s1/oNKY47xQ0Bg5nkjsfAEIej1VeH62bDDQ==} engines: {node: '>=16 || 14 >=14.17'} + hasBin: true dependencies: - fs.realpath: 1.0.0 + foreground-child: 3.1.1 + jackspeak: 2.1.1 minimatch: 9.0.0 minipass: 5.0.0 - path-scurry: 1.6.4 + path-scurry: 1.7.0 dev: true /glob@7.2.3: @@ -5829,17 +5846,6 @@ packages: once: 1.4.0 path-is-absolute: 1.0.1 - /glob@8.0.3: - resolution: {integrity: sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==} - engines: {node: '>=12'} - dependencies: - fs.realpath: 1.0.0 - inflight: 1.0.6 - inherits: 2.0.4 - minimatch: 5.1.6 - once: 1.4.0 - dev: true - /glob@8.1.0: resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} engines: {node: '>=12'} @@ -6406,6 +6412,15 @@ packages: - supports-color dev: true + /jackspeak@2.1.1: + resolution: {integrity: sha512-juf9stUEwUaILepraGOWIJTLwg48bUnBmRqd2ln2Os1sW987zeoj/hzhbvRB95oMuS2ZTpjULmdwHNX4rzZIZw==} + engines: {node: '>=14'} + dependencies: + cliui: 8.0.1 + optionalDependencies: + '@pkgjs/parseargs': 0.11.0 + dev: true + /jest-diff@29.5.0: resolution: {integrity: sha512-LtxijLLZBduXnHSniy0WMdaHjmQnt3g5sa16W4p0HqukYTTsyTW3GD1q41TyGl5YFXj/5B2U6dlh5FM1LIMgxw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -6869,27 +6884,33 @@ packages: uc.micro: 1.0.6 dev: true - /markdownlint-cli@0.33.0: - resolution: {integrity: sha512-zMK1oHpjYkhjO+94+ngARiBBrRDEUMzooDHBAHtmEIJ9oYddd9l3chCReY2mPlecwH7gflQp1ApilTo+o0zopQ==} + /markdownlint-cli@0.34.0: + resolution: {integrity: sha512-4G9I++VBTZkaye6Yfc/7dU6HQHcyldZEVB+bYyQJLcpJOHKk/q5ZpGqK80oKMIdlxzsA3aWOJLZ4DkoaoUWXbQ==} engines: {node: '>=14'} hasBin: true dependencies: - commander: 9.4.1 + commander: 10.0.1 get-stdin: 9.0.0 - glob: 8.0.3 + glob: 10.2.2 ignore: 5.2.4 js-yaml: 4.1.0 jsonc-parser: 3.2.0 - markdownlint: 0.27.0 - minimatch: 5.1.6 + markdownlint: 0.28.2 + minimatch: 9.0.0 run-con: 1.2.11 dev: true - /markdownlint@0.27.0: - resolution: {integrity: sha512-HtfVr/hzJJmE0C198F99JLaeada+646B5SaG2pVoEakLFI6iRGsvMqrnnrflq8hm1zQgwskEgqSnhDW11JBp0w==} + /markdownlint-micromark@0.1.2: + resolution: {integrity: sha512-jRxlQg8KpOfM2IbCL9RXM8ZiYWz2rv6DlZAnGv8ASJQpUh6byTBnEsbuMZ6T2/uIgntyf7SKg/mEaEBo1164fQ==} + engines: {node: '>=14.18.0'} + dev: true + + /markdownlint@0.28.2: + resolution: {integrity: sha512-yYaQXoKKPV1zgrFsyAuZPEQoe+JrY9GDag9ObKpk09twx4OCU5lut+0/kZPrQ3W7w82SmgKhd7D8m34aG1unVw==} engines: {node: '>=14.18.0'} dependencies: markdown-it: 13.0.1 + markdownlint-micromark: 0.1.2 dev: true /md5-hex@3.0.1: @@ -7541,8 +7562,8 @@ packages: /path-parse@1.0.7: resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} - /path-scurry@1.6.4: - resolution: {integrity: sha512-Qp/9IHkdNiXJ3/Kon++At2nVpnhRiPq/aSvQN+H3U1WZbvNRK0RIQK/o4HMqPoXjpuGJUEWpHSs6Mnjxqh3TQg==} + /path-scurry@1.7.0: + resolution: {integrity: sha512-UkZUeDjczjYRE495+9thsgcVgsaCPkaw80slmfVFgllxY+IO8ubTsOpFVjDPROBqJdHfVPUFRHPBV/WciOVfWg==} engines: {node: '>=16 || 14 >=14.17'} dependencies: lru-cache: 9.0.0 @@ -7620,8 +7641,9 @@ packages: engines: {node: '>=4'} dev: true - /postcss-calc@8.2.4(postcss@8.4.23): - resolution: {integrity: sha512-SmWMSJmB8MRnnULldx0lQIyhSNvuDl9HfrZkaqqE/WHAhToYsAvDq+yAsA/kIyINDszOp3Rh0GFoNuH5Ypsm3Q==} + /postcss-calc@9.0.0(postcss@8.4.23): + resolution: {integrity: sha512-B9BNW/SVh4SMJfoCQ6D9h1Wo7Yjqks7UdbiARJ16J5TIsQn5NEqwMF5joSgOYb26oJPUR5Uv3fCQ/4PvmZWeJQ==} + engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.2 dependencies: @@ -7734,8 +7756,8 @@ packages: stylehacks: 6.0.0(postcss@8.4.23) dev: false - /postcss-merge-rules@6.0.0(postcss@8.4.23): - resolution: {integrity: sha512-rCXkklftzEkniyv3f4mRCQzxD6oE4Quyh61uyWTUbCJ26Pv2hoz+fivJSsSBWxDBeScR4fKCfF3HHTcD7Ybqnw==} + /postcss-merge-rules@6.0.1(postcss@8.4.23): + resolution: {integrity: sha512-a4tlmJIQo9SCjcfiCcCMg/ZCEe0XTkl/xK0XHBs955GWg9xDX3NwP9pwZ78QUOWB8/0XCjZeJn98Dae0zg6AAw==} engines: {node: ^14 || ^16 || >=18.0} peerDependencies: postcss: ^8.2.15 @@ -8260,7 +8282,7 @@ packages: engines: {node: '>=14'} hasBin: true dependencies: - glob: 10.0.0 + glob: 10.2.2 dev: true /rollup-plugin-dts@5.3.0(rollup@3.21.0)(typescript@5.0.4): @@ -8477,6 +8499,11 @@ packages: /signal-exit@3.0.7: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} + /signal-exit@4.0.1: + resolution: {integrity: sha512-uUWsN4aOxJAS8KOuf3QMyFtgm1pkb6I+KRZbRF/ghdf5T7sM+B1lLLzPDxswUjkmHyxQAVzEgG35E3NzDM9GVw==} + engines: {node: '>=14'} + dev: true + /sirv@1.0.19: resolution: {integrity: sha512-JuLThK3TnZG1TAKDwNIqNq6QA2afLOCcm+iE8D1Kj3GA40pSPsxQjjJl0J8X3tsR7T+CP1GavpzLwYkgVLWrZQ==} engines: {node: '>= 10'} @@ -9333,8 +9360,8 @@ packages: - supports-color - terser - /vite-plugin-checker@0.5.6(eslint@8.39.0)(typescript@5.0.4)(vite@4.3.3)(vue-tsc@1.6.1): - resolution: {integrity: sha512-ftRyON0gORUHDxcDt2BErmsikKSkfvl1i2DoP6Jt2zDO9InfvM6tqO1RkXhSjkaXEhKPea6YOnhFaZxW3BzudQ==} + /vite-plugin-checker@0.6.0(eslint@8.39.0)(typescript@5.0.4)(vite@4.3.3)(vue-tsc@1.6.1): + resolution: {integrity: sha512-DWZ9Hv2TkpjviPxAelNUt4Q3IhSGrx7xrwdM64NI+Q4dt8PaMWJJh4qGNtSrfEuiuIzWWo00Ksvh5It4Y3L9xQ==} engines: {node: '>=14.16'} peerDependencies: eslint: '>=7' @@ -9345,7 +9372,7 @@ packages: vite: '>=2.0.0' vls: '*' vti: '*' - vue-tsc: '*' + vue-tsc: '>=1.3.9' peerDependenciesMeta: eslint: optional: true @@ -9375,6 +9402,7 @@ packages: lodash.debounce: 4.0.8 lodash.pick: 4.4.0 npm-run-path: 4.0.1 + semver: 7.5.0 strip-ansi: 6.0.1 tiny-invariant: 1.3.1 typescript: 5.0.4 From 2c55bb6f84673b3add3a60c243d5796e04492f81 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 1 May 2023 12:56:30 +0100 Subject: [PATCH 09/25] fix(nuxt): remove internal `` (#20607) --- packages/nuxt/src/app/components/utils.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/packages/nuxt/src/app/components/utils.ts b/packages/nuxt/src/app/components/utils.ts index 5865558278..8fe1ec3c2c 100644 --- a/packages/nuxt/src/app/components/utils.ts +++ b/packages/nuxt/src/app/components/utils.ts @@ -1,22 +1,16 @@ -import { defineComponent, h } from 'vue' +import { h } from 'vue' import type { Component } from 'vue' // eslint-disable-next-line import { isString, isPromise, isArray } from '@vue/shared' -const Fragment = defineComponent({ - name: 'FragmentWrapper', - setup (_props, { slots }) { - return () => slots.default?.() - } -}) - /** * Internal utility * * @private */ export const _wrapIf = (component: Component, props: any, slots: any) => { - return { default: () => props ? h(component, props === true ? {} : props, slots) : h(Fragment, {}, slots) } + props = props === true ? {} : props + return { default: () => props ? h(component, props, slots) : slots.default?.() } } // eslint-disable-next-line no-use-before-define From da29dea5c7b9d31dda2e30189e52636962106ae5 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 1 May 2023 13:24:05 +0100 Subject: [PATCH 10/25] chore: revert markdownlint upgrade --- package.json | 2 +- pnpm-lock.yaml | 47 ++++++++++++++++++++++++++--------------------- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index 25c87f72bc..98185d2cab 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "globby": "^13.1.4", "h3": "^1.6.4", "jiti": "^1.18.2", - "markdownlint-cli": "^0.34.0", + "markdownlint-cli": "^0.33.0", "nuxi": "workspace:*", "nuxt": "workspace:*", "ofetch": "^1.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 143cd434fb..b818386774 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -79,8 +79,8 @@ importers: specifier: ^1.18.2 version: 1.18.2 markdownlint-cli: - specifier: ^0.34.0 - version: 0.34.0 + specifier: ^0.33.0 + version: 0.33.0 nuxi: specifier: workspace:* version: link:packages/nuxi @@ -4037,11 +4037,6 @@ packages: delayed-stream: 1.0.0 dev: true - /commander@10.0.1: - resolution: {integrity: sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==} - engines: {node: '>=14'} - dev: true - /commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} @@ -4055,6 +4050,11 @@ packages: engines: {node: '>= 12'} dev: false + /commander@9.4.1: + resolution: {integrity: sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw==} + engines: {node: ^12.20.0 || >=14} + dev: true + /comment-parser@1.3.1: resolution: {integrity: sha512-B52sN2VNghyq5ofvUsqZjmk6YkihBX5vMSChmSK9v4ShjKf3Vk5Xcmgpw4o+iIgtrnM/u5FiMpz9VKb8lpBveA==} engines: {node: '>= 12.0.0'} @@ -5846,6 +5846,17 @@ packages: once: 1.4.0 path-is-absolute: 1.0.1 + /glob@8.0.3: + resolution: {integrity: sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==} + engines: {node: '>=12'} + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 5.1.6 + once: 1.4.0 + dev: true + /glob@8.1.0: resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} engines: {node: '>=12'} @@ -6884,33 +6895,27 @@ packages: uc.micro: 1.0.6 dev: true - /markdownlint-cli@0.34.0: - resolution: {integrity: sha512-4G9I++VBTZkaye6Yfc/7dU6HQHcyldZEVB+bYyQJLcpJOHKk/q5ZpGqK80oKMIdlxzsA3aWOJLZ4DkoaoUWXbQ==} + /markdownlint-cli@0.33.0: + resolution: {integrity: sha512-zMK1oHpjYkhjO+94+ngARiBBrRDEUMzooDHBAHtmEIJ9oYddd9l3chCReY2mPlecwH7gflQp1ApilTo+o0zopQ==} engines: {node: '>=14'} hasBin: true dependencies: - commander: 10.0.1 + commander: 9.4.1 get-stdin: 9.0.0 - glob: 10.2.2 + glob: 8.0.3 ignore: 5.2.4 js-yaml: 4.1.0 jsonc-parser: 3.2.0 - markdownlint: 0.28.2 - minimatch: 9.0.0 + markdownlint: 0.27.0 + minimatch: 5.1.6 run-con: 1.2.11 dev: true - /markdownlint-micromark@0.1.2: - resolution: {integrity: sha512-jRxlQg8KpOfM2IbCL9RXM8ZiYWz2rv6DlZAnGv8ASJQpUh6byTBnEsbuMZ6T2/uIgntyf7SKg/mEaEBo1164fQ==} - engines: {node: '>=14.18.0'} - dev: true - - /markdownlint@0.28.2: - resolution: {integrity: sha512-yYaQXoKKPV1zgrFsyAuZPEQoe+JrY9GDag9ObKpk09twx4OCU5lut+0/kZPrQ3W7w82SmgKhd7D8m34aG1unVw==} + /markdownlint@0.27.0: + resolution: {integrity: sha512-HtfVr/hzJJmE0C198F99JLaeada+646B5SaG2pVoEakLFI6iRGsvMqrnnrflq8hm1zQgwskEgqSnhDW11JBp0w==} engines: {node: '>=14.18.0'} dependencies: markdown-it: 13.0.1 - markdownlint-micromark: 0.1.2 dev: true /md5-hex@3.0.1: From c536e5a635562341385ce3a92096799f1eccc85c Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 1 May 2023 13:27:07 +0100 Subject: [PATCH 11/25] chore: run docs lint workflow on dep upgrades --- .github/workflows/autofix-docs.yml | 2 ++ .github/workflows/docs.yml | 1 + 2 files changed, 3 insertions(+) diff --git a/.github/workflows/autofix-docs.yml b/.github/workflows/autofix-docs.yml index 44f5ede60f..137d5bab6a 100644 --- a/.github/workflows/autofix-docs.yml +++ b/.github/workflows/autofix-docs.yml @@ -5,6 +5,8 @@ on: paths: - "docs/**" - ".github/workflows/docs.yml" + branches: + - "renovate/**" permissions: contents: read diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index f83eecede6..fbf88268f3 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -8,6 +8,7 @@ on: # autofix workflow will be triggered instead for PRs branches: - main + - "renovate/**" - "!v[0-9]*" # Remove default permissions of GITHUB_TOKEN for security From ecb2fda113182c0f41a2748a94076149bd358eda Mon Sep 17 00:00:00 2001 From: Enkot Date: Mon, 1 May 2023 15:41:17 +0300 Subject: [PATCH 12/25] docs: fix fetch composable examples (#20603) --- docs/3.api/1.composables/use-fetch.md | 2 +- .../composables/useCustomFetch.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/3.api/1.composables/use-fetch.md b/docs/3.api/1.composables/use-fetch.md index 364ff36684..9541b15ad9 100644 --- a/docs/3.api/1.composables/use-fetch.md +++ b/docs/3.api/1.composables/use-fetch.md @@ -114,7 +114,7 @@ const { data, pending, error, refresh } = await useFetch('/api/auth/login', { }, onResponse({ request, response, options }) { // Process the response data - return response._data + localStorage.setItem('token', response._data.token) }, onResponseError({ request, response, options }) { // Handle the response errors diff --git a/examples/other/use-custom-fetch-composable/composables/useCustomFetch.ts b/examples/other/use-custom-fetch-composable/composables/useCustomFetch.ts index 56365292b7..2464b3cd45 100644 --- a/examples/other/use-custom-fetch-composable/composables/useCustomFetch.ts +++ b/examples/other/use-custom-fetch-composable/composables/useCustomFetch.ts @@ -15,12 +15,12 @@ export function useCustomFetch (url: string, options: UseFetchOptions = {} ? { Authorization: `Bearer ${userAuth.value}` } : {}, - onResponse (__ctx) { - // return new myBusinessResponse(response._data) + onResponse (_ctx) { + // _ctx.response._data = new myBusinessResponse(_ctx.response._data) }, - onResponseError (__ctx) { - // return new myBusinessError(error) + onResponseError (_ctx) { + // throw new myBusinessError() } } From 8353e4c66eaae7d390c67e03c6217060786aef27 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 1 May 2023 17:35:00 +0100 Subject: [PATCH 13/25] feat(nuxt): allow access to components within app (#20604) --- packages/nuxt/src/components/module.ts | 11 ++++++----- packages/nuxt/src/components/templates.ts | 19 ++++++++++--------- packages/nuxt/src/core/app.ts | 1 + packages/schema/src/types/nuxt.ts | 2 ++ 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/packages/nuxt/src/components/module.ts b/packages/nuxt/src/components/module.ts index 5372d5faa4..4882bfc961 100644 --- a/packages/nuxt/src/components/module.ts +++ b/packages/nuxt/src/components/module.ts @@ -113,14 +113,14 @@ export default defineNuxtModule({ }) // components.d.ts - addTemplate({ ...componentsTypeTemplate, options: { getComponents } }) + addTemplate({ ...componentsTypeTemplate }) // components.plugin.mjs - addPluginTemplate({ ...componentsPluginTemplate, options: { getComponents } } as any) + addPluginTemplate({ ...componentsPluginTemplate } as any) // component-names.mjs - addTemplate({ ...componentNamesTemplate, options: { getComponents, mode: 'all' } }) + addTemplate({ ...componentNamesTemplate, options: { mode: 'all' } }) // components.islands.mjs if (nuxt.options.experimental.componentIslands) { - addTemplate({ ...componentsIslandsTemplate, filename: 'components.islands.mjs', options: { getComponents } }) + addTemplate({ ...componentsIslandsTemplate, filename: 'components.islands.mjs' }) } else { addTemplate({ filename: 'components.islands.mjs', getContents: () => 'export default {}' }) } @@ -158,7 +158,7 @@ export default defineNuxtModule({ }) // Scan components and add to plugin - nuxt.hook('app:templates', async () => { + nuxt.hook('app:templates', async (app) => { const newComponents = await scanComponents(componentDirs, nuxt.options.srcDir!) await nuxt.callHook('components:extend', newComponents) // add server placeholder for .client components server side. issue: #7085 @@ -173,6 +173,7 @@ export default defineNuxtModule({ } } context.components = newComponents + app.components = newComponents }) nuxt.hook('prepare:types', ({ references, tsConfig }) => { diff --git a/packages/nuxt/src/components/templates.ts b/packages/nuxt/src/components/templates.ts index b91ba871c6..fa2c7eb6d1 100644 --- a/packages/nuxt/src/components/templates.ts +++ b/packages/nuxt/src/components/templates.ts @@ -1,8 +1,9 @@ import { isAbsolute, relative } from 'pathe' import { genDynamicImport } from 'knitwork' -import type { Component, Nuxt, NuxtPluginTemplate, NuxtTemplate } from 'nuxt/schema' +import type { Component, Nuxt, NuxtApp, NuxtPluginTemplate, NuxtTemplate } from 'nuxt/schema' export interface ComponentsTemplateContext { + app: NuxtApp nuxt: Nuxt options: { getComponents: (mode?: 'client' | 'server' | 'all') => Component[] @@ -34,8 +35,8 @@ export default defineNuxtPlugin({ export const componentsPluginTemplate: NuxtPluginTemplate = { filename: 'components.plugin.mjs', - getContents ({ options }) { - const globalComponents = options.getComponents().filter(c => c.global) + getContents ({ app }) { + const globalComponents = app.components.filter(c => c.global) if (!globalComponents.length) { return emptyComponentsPlugin } return `import { defineNuxtPlugin } from '#app/nuxt' @@ -59,15 +60,15 @@ export default defineNuxtPlugin({ export const componentNamesTemplate: NuxtPluginTemplate = { filename: 'component-names.mjs', - getContents ({ options }) { - return `export const componentNames = ${JSON.stringify(options.getComponents().filter(c => !c.island).map(c => c.pascalName))}` + getContents ({ app }) { + return `export const componentNames = ${JSON.stringify(app.components.filter(c => !c.island).map(c => c.pascalName))}` } } export const componentsIslandsTemplate: NuxtTemplate = { // components.islands.mjs' - getContents ({ options }) { - const components = options.getComponents() + getContents ({ app }) { + const components = app.components const islands = components.filter(component => component.island || // .server components without a corresponding .client component will need to be rendered as an island @@ -85,9 +86,9 @@ export const componentsIslandsTemplate: NuxtTemplate export const componentsTypeTemplate: NuxtTemplate = { filename: 'components.d.ts', - getContents: ({ options, nuxt }) => { + getContents: ({ app, nuxt }) => { const buildDir = nuxt.options.buildDir - const componentTypes = options.getComponents().filter(c => !c.island).map(c => [ + const componentTypes = app.components.filter(c => !c.island).map(c => [ c.pascalName, `typeof ${genDynamicImport(isAbsolute(c.filePath) ? relative(buildDir, c.filePath).replace(/(?<=\w)\.(?!vue)\w+$/g, '') diff --git a/packages/nuxt/src/core/app.ts b/packages/nuxt/src/core/app.ts index e20b5da32f..38bef2b1cc 100644 --- a/packages/nuxt/src/core/app.ts +++ b/packages/nuxt/src/core/app.ts @@ -12,6 +12,7 @@ export function createApp (nuxt: Nuxt, options: Partial = {}): NuxtApp dir: nuxt.options.srcDir, extensions: nuxt.options.extensions, plugins: [], + components: [], templates: [] } as unknown as NuxtApp) as NuxtApp } diff --git a/packages/schema/src/types/nuxt.ts b/packages/schema/src/types/nuxt.ts index 85e40e3678..9e6de78335 100644 --- a/packages/schema/src/types/nuxt.ts +++ b/packages/schema/src/types/nuxt.ts @@ -1,6 +1,7 @@ import type { Hookable } from 'hookable' import type { Ignore } from 'ignore' import type { NuxtHooks, NuxtLayout, NuxtMiddleware } from './hooks' +import type { Component } from './components' import type { NuxtOptions } from './config' export interface Nuxt { @@ -58,6 +59,7 @@ export interface NuxtApp { dir: string extensions: string[] plugins: NuxtPlugin[] + components: Component[] layouts: Record middleware: NuxtMiddleware[] templates: NuxtTemplate[] From 8b86d39e30ca970fb0adf2b5665a77f8dbbfb439 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 1 May 2023 17:39:07 +0100 Subject: [PATCH 14/25] refactor(schema): move `runtimeCompiler` option out of experimental (#20606) --- packages/nuxt/src/core/nitro.ts | 6 +++--- packages/schema/src/config/app.ts | 7 +++++++ packages/schema/src/config/experimental.ts | 6 ------ test/fixtures/runtime-compiler/nuxt.config.ts | 4 +++- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/nuxt/src/core/nitro.ts b/packages/nuxt/src/core/nitro.ts index 964263b6dd..4e0e5dce9f 100644 --- a/packages/nuxt/src/core/nitro.ts +++ b/packages/nuxt/src/core/nitro.ts @@ -130,7 +130,7 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) { ], traceInclude: [ // force include files used in generated code from the runtime-compiler - ...(nuxt.options.experimental.runtimeVueCompiler && !nuxt.options.experimental.externalVue) + ...(nuxt.options.vue.runtimeCompiler && !nuxt.options.experimental.externalVue) ? [ ...nuxt.options.modulesDir.reduce((targets, path) => { const serverRendererPath = resolve(path, 'vue/server-renderer/index.js') @@ -150,7 +150,7 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) { vue: await resolvePath(`vue/dist/vue.cjs${nuxt.options.dev ? '' : '.prod'}.js`) }, // Vue 3 mocks - ...nuxt.options.experimental.runtimeVueCompiler || nuxt.options.experimental.externalVue + ...nuxt.options.vue.runtimeCompiler || nuxt.options.experimental.externalVue ? {} : { 'estree-walker': 'unenv/runtime/mock/proxy', @@ -253,7 +253,7 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) { }) // Enable runtime compiler client side - if (nuxt.options.experimental.runtimeVueCompiler) { + if (nuxt.options.vue.runtimeCompiler) { nuxt.hook('vite:extendConfig', (config, { isClient }) => { if (isClient) { if (Array.isArray(config.resolve!.alias)) { diff --git a/packages/schema/src/config/app.ts b/packages/schema/src/config/app.ts index c9a42f37db..357e937ad9 100644 --- a/packages/schema/src/config/app.ts +++ b/packages/schema/src/config/app.ts @@ -13,6 +13,13 @@ export default defineUntypedSchema({ * @type {typeof import('@vue/compiler-core').CompilerOptions} */ compilerOptions: {}, + + /** + * Include Vue compiler in runtime bundle. + */ + runtimeCompiler: { + $resolve: async (val, get) => val ?? await get('experimental.runtimeVueCompiler') ?? false, + }, }, /** diff --git a/packages/schema/src/config/experimental.ts b/packages/schema/src/config/experimental.ts index ab0023d520..f5227d9ed9 100644 --- a/packages/schema/src/config/experimental.ts +++ b/packages/schema/src/config/experimental.ts @@ -23,12 +23,6 @@ export default defineUntypedSchema({ */ externalVue: true, - // TODO: move to `vue.runtimeCompiler` in v3.5 - /** - * Include Vue compiler in runtime bundle. - */ - runtimeVueCompiler: false, - /** * Tree shakes contents of client-only components from server bundle. * @see https://github.com/nuxt/framework/pull/5750 diff --git a/test/fixtures/runtime-compiler/nuxt.config.ts b/test/fixtures/runtime-compiler/nuxt.config.ts index 604986a3fc..d321af9c18 100644 --- a/test/fixtures/runtime-compiler/nuxt.config.ts +++ b/test/fixtures/runtime-compiler/nuxt.config.ts @@ -1,8 +1,10 @@ // https://nuxt.com/docs/api/configuration/nuxt-config export default defineNuxtConfig({ experimental: { - runtimeVueCompiler: true, externalVue: false }, + vue: { + runtimeCompiler: true + }, builder: process.env.TEST_BUILDER as 'webpack' | 'vite' ?? 'vite' }) From f3cfb5f630604fb664197e8981966784edba2a7d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 1 May 2023 23:46:29 +0100 Subject: [PATCH 15/25] chore(deps): update all non-major dependencies (main) (#20609) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Daniel Roe --- package.json | 4 +- packages/nuxt/src/app/components/nuxt-link.ts | 2 +- pnpm-lock.yaml | 134 ++++++++++++------ 3 files changed, 93 insertions(+), 47 deletions(-) diff --git a/package.json b/package.json index 98185d2cab..badc4c6d7b 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "globby": "^13.1.4", "h3": "^1.6.4", "jiti": "^1.18.2", - "markdownlint-cli": "^0.33.0", + "markdownlint-cli": "^0.34.0", "nuxi": "workspace:*", "nuxt": "workspace:*", "ofetch": "^1.0.1", @@ -77,7 +77,7 @@ "vitest": "^0.30.1", "vue": "3.2.47", "vue-eslint-parser": "^9.1.1", - "vue-tsc": "^1.6.1" + "vue-tsc": "^1.6.3" }, "packageManager": "pnpm@8.3.1", "engines": { diff --git a/packages/nuxt/src/app/components/nuxt-link.ts b/packages/nuxt/src/app/components/nuxt-link.ts index 32b572ae5d..b2859cf388 100644 --- a/packages/nuxt/src/app/components/nuxt-link.ts +++ b/packages/nuxt/src/app/components/nuxt-link.ts @@ -212,7 +212,7 @@ export function defineNuxtLink (options: NuxtLinkOptions) { onNuxtReady(() => { idleId = requestIdleCallback(() => { if (el?.value?.tagName) { - unobserve = observer!.observe(el.value, async () => { + unobserve = observer!.observe(el.value as Element, async () => { unobserve?.() unobserve = null diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b818386774..9378397a12 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -79,8 +79,8 @@ importers: specifier: ^1.18.2 version: 1.18.2 markdownlint-cli: - specifier: ^0.33.0 - version: 0.33.0 + specifier: ^0.34.0 + version: 0.34.0 nuxi: specifier: workspace:* version: link:packages/nuxi @@ -127,8 +127,8 @@ importers: specifier: ^9.1.1 version: 9.1.1(eslint@8.39.0) vue-tsc: - specifier: ^1.6.1 - version: 1.6.1(typescript@5.0.4) + specifier: ^1.6.3 + version: 1.6.3(typescript@5.0.4) examples/advanced/config-extends: devDependencies: @@ -949,7 +949,7 @@ importers: version: 0.30.1(@types/node@18.16.3) vite-plugin-checker: specifier: ^0.6.0 - version: 0.6.0(eslint@8.39.0)(typescript@5.0.4)(vite@4.3.3)(vue-tsc@1.6.1) + version: 0.6.0(eslint@8.39.0)(typescript@5.0.4)(vite@4.3.3)(vue-tsc@1.6.3) vue-bundle-renderer: specifier: ^1.0.3 version: 1.0.3 @@ -3027,26 +3027,26 @@ packages: '@volar/language-core': 1.4.1 typescript: 5.0.4 - /@volar/vue-language-core@1.6.1: - resolution: {integrity: sha512-lIuxzvIx5U8MfoF+vrXNG1aZgmk8T0uyPEwI8g3EUJdESuU0qIKM84o+L4TUw77IQCYXiSefaJmsSSY87/VWnA==} + /@volar/vue-language-core@1.6.3: + resolution: {integrity: sha512-e9OTDCPa8Wuh0ORhD4z++qTIcrsrqcI9waspr93YcQCq6j+Q+JTFuy7HBSQgyezSAsP6x1WWokKVk4fWWDJQOw==} dependencies: '@volar/language-core': 1.4.1 '@volar/source-map': 1.4.1 - '@vue/compiler-dom': 3.2.47 - '@vue/compiler-sfc': 3.2.47 - '@vue/reactivity': 3.2.47 - '@vue/shared': 3.2.47 + '@vue/compiler-dom': 3.3.0-beta.3 + '@vue/compiler-sfc': 3.3.0-beta.3 + '@vue/reactivity': 3.3.0-beta.3 + '@vue/shared': 3.3.0-beta.3 minimatch: 9.0.0 muggle-string: 0.2.2 vue-template-compiler: 2.7.14 - /@volar/vue-typescript@1.6.1(typescript@5.0.4): - resolution: {integrity: sha512-5mhG6Lv2niq/AGNvHy4RSAGlJhkR+EcH7zRQ19JlffzhWDVXEdDp8luSSabCkrJzejXIMh0rsTGlKy2EFYy7vQ==} + /@volar/vue-typescript@1.6.3(typescript@5.0.4): + resolution: {integrity: sha512-Dz29Qym33P1MSZDTZJ6PPLN1TLQfkX+g2pRnHqLCsFdSUu4yWYnElBURCn5WJkekxV/v+k2T43aur2RCSY3Ovg==} peerDependencies: typescript: '*' dependencies: '@volar/typescript': 1.4.1(typescript@5.0.4) - '@volar/vue-language-core': 1.6.1 + '@volar/vue-language-core': 1.6.3 typescript: 5.0.4 /@vue/babel-helper-vue-transform-on@1.0.2: @@ -3076,12 +3076,26 @@ packages: estree-walker: 2.0.2 source-map: 0.6.1 + /@vue/compiler-core@3.3.0-beta.3: + resolution: {integrity: sha512-mv2rPo4JHou6ebm7+U/wO1HpA6W1zDfTqbt4fqjoXrMwU4DWNgRcLKTXG6G3cXV4mOe+2YgWspfxEzo7fPTMKg==} + dependencies: + '@babel/parser': 7.21.4 + '@vue/shared': 3.3.0-beta.3 + estree-walker: 2.0.2 + source-map-js: 1.0.2 + /@vue/compiler-dom@3.2.47: resolution: {integrity: sha512-dBBnEHEPoftUiS03a4ggEig74J2YBZ2UIeyfpcRM2tavgMWo4bsEfgCGsu+uJIL/vax9S+JztH8NmQerUo7shQ==} dependencies: '@vue/compiler-core': 3.2.47 '@vue/shared': 3.2.47 + /@vue/compiler-dom@3.3.0-beta.3: + resolution: {integrity: sha512-e7VpjN9wYiuJdJos6Uoe501CzdMkfaEr/27Ks4Ss7Irtcj5YA/S1OROZ35Xl2Pc3ctx6beq5RpcOvnMqh0hcaA==} + dependencies: + '@vue/compiler-core': 3.3.0-beta.3 + '@vue/shared': 3.3.0-beta.3 + /@vue/compiler-sfc@3.2.47: resolution: {integrity: sha512-rog05W+2IFfxjMcFw10tM9+f7i/+FFpZJJ5XHX72NP9eC2uRD+42M3pYcQqDXVYoj74kHMSEdQ/WmCjt8JFksQ==} dependencies: @@ -3096,12 +3110,32 @@ packages: postcss: 8.4.23 source-map: 0.6.1 + /@vue/compiler-sfc@3.3.0-beta.3: + resolution: {integrity: sha512-6shZNooetShjSMHJvgVoE0EM8pOMV5vnrzsHoCU06stzV+kqRJQpbN7xf2s9wK2fgHMIBSMINrM9AuZiQnNCJg==} + dependencies: + '@babel/parser': 7.21.4 + '@vue/compiler-core': 3.3.0-beta.3 + '@vue/compiler-dom': 3.3.0-beta.3 + '@vue/compiler-ssr': 3.3.0-beta.3 + '@vue/reactivity-transform': 3.3.0-beta.3 + '@vue/shared': 3.3.0-beta.3 + estree-walker: 2.0.2 + magic-string: 0.30.0 + postcss: 8.4.23 + source-map-js: 1.0.2 + /@vue/compiler-ssr@3.2.47: resolution: {integrity: sha512-wVXC+gszhulcMD8wpxMsqSOpvDZ6xKXSVWkf50Guf/S+28hTAXPDYRTbLQ3EDkOP5Xz/+SY37YiwDquKbJOgZw==} dependencies: '@vue/compiler-dom': 3.2.47 '@vue/shared': 3.2.47 + /@vue/compiler-ssr@3.3.0-beta.3: + resolution: {integrity: sha512-egJ0lEVAod3Hpnw96cJ/0a9qv5f5h5/VCBpKYT8scqkzoMsikh8AJant2omokBCL/Ut5UAMLVQlA5b66+2Ys/g==} + dependencies: + '@vue/compiler-dom': 3.3.0-beta.3 + '@vue/shared': 3.3.0-beta.3 + /@vue/devtools-api@6.5.0: resolution: {integrity: sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q==} @@ -3114,11 +3148,25 @@ packages: estree-walker: 2.0.2 magic-string: 0.30.0 + /@vue/reactivity-transform@3.3.0-beta.3: + resolution: {integrity: sha512-aM3TgBca9QMMu/9B9ASRVvckeZpAdJO9nmQh5UCznhoDYjVxQPS+sCQvH6TLOjPB1MDQMVQYg4ZiPqfVVo7NbA==} + dependencies: + '@babel/parser': 7.21.4 + '@vue/compiler-core': 3.3.0-beta.3 + '@vue/shared': 3.3.0-beta.3 + estree-walker: 2.0.2 + magic-string: 0.30.0 + /@vue/reactivity@3.2.47: resolution: {integrity: sha512-7khqQ/75oyyg+N/e+iwV6lpy1f5wq759NdlS1fpAhFXa8VeAIKGgk2E/C4VF59lx5b+Ezs5fpp/5WsRYXQiKxQ==} dependencies: '@vue/shared': 3.2.47 + /@vue/reactivity@3.3.0-beta.3: + resolution: {integrity: sha512-9VjWfWgZJ18YXEkfnDfZr33RyLBa6zc0RARLkMqMApWvM26eusZAZ4hhyxlgODBU/mEFk4XOGIAtwwSQedA0MQ==} + dependencies: + '@vue/shared': 3.3.0-beta.3 + /@vue/runtime-core@3.2.47: resolution: {integrity: sha512-RZxbLQIRB/K0ev0K9FXhNbBzT32H9iRtYbaXb0ZIz2usLms/D55dJR2t6cIEUn6vyhS3ALNvNthI+Q95C+NOpA==} dependencies: @@ -3144,6 +3192,9 @@ packages: /@vue/shared@3.2.47: resolution: {integrity: sha512-BHGyyGN3Q97EZx0taMQ+OLNuZcW3d37ZEVmEAyeoA9ERdGvm9Irc/0Fua8SNyOtV1w6BS4q25wbMzJujO9HIfQ==} + /@vue/shared@3.3.0-beta.3: + resolution: {integrity: sha512-st1SnB/Bkbb9TsieeI4TRX9TqHYIR5wvIma3ZtEben55EYSWa1q5u2BhTNgABSdH+rv3Xwfrvpwh5PmCw6Y53g==} + /@vueuse/core@9.13.0(vue@3.2.47): resolution: {integrity: sha512-pujnclbeHWxxPRqXWmdkKV5OX4Wk4YeK7wusHqRwU0Q7EFusHoqNA/aPhB6KCh9hEqJkLAJo7bb0Lh9b+OIVzw==} dependencies: @@ -4037,6 +4088,11 @@ packages: delayed-stream: 1.0.0 dev: true + /commander@10.0.1: + resolution: {integrity: sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==} + engines: {node: '>=14'} + dev: true + /commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} @@ -4050,11 +4106,6 @@ packages: engines: {node: '>= 12'} dev: false - /commander@9.4.1: - resolution: {integrity: sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw==} - engines: {node: ^12.20.0 || >=14} - dev: true - /comment-parser@1.3.1: resolution: {integrity: sha512-B52sN2VNghyq5ofvUsqZjmk6YkihBX5vMSChmSK9v4ShjKf3Vk5Xcmgpw4o+iIgtrnM/u5FiMpz9VKb8lpBveA==} engines: {node: '>= 12.0.0'} @@ -5846,17 +5897,6 @@ packages: once: 1.4.0 path-is-absolute: 1.0.1 - /glob@8.0.3: - resolution: {integrity: sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==} - engines: {node: '>=12'} - dependencies: - fs.realpath: 1.0.0 - inflight: 1.0.6 - inherits: 2.0.4 - minimatch: 5.1.6 - once: 1.4.0 - dev: true - /glob@8.1.0: resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} engines: {node: '>=12'} @@ -6895,27 +6935,33 @@ packages: uc.micro: 1.0.6 dev: true - /markdownlint-cli@0.33.0: - resolution: {integrity: sha512-zMK1oHpjYkhjO+94+ngARiBBrRDEUMzooDHBAHtmEIJ9oYddd9l3chCReY2mPlecwH7gflQp1ApilTo+o0zopQ==} + /markdownlint-cli@0.34.0: + resolution: {integrity: sha512-4G9I++VBTZkaye6Yfc/7dU6HQHcyldZEVB+bYyQJLcpJOHKk/q5ZpGqK80oKMIdlxzsA3aWOJLZ4DkoaoUWXbQ==} engines: {node: '>=14'} hasBin: true dependencies: - commander: 9.4.1 + commander: 10.0.1 get-stdin: 9.0.0 - glob: 8.0.3 + glob: 10.2.2 ignore: 5.2.4 js-yaml: 4.1.0 jsonc-parser: 3.2.0 - markdownlint: 0.27.0 - minimatch: 5.1.6 + markdownlint: 0.28.2 + minimatch: 9.0.0 run-con: 1.2.11 dev: true - /markdownlint@0.27.0: - resolution: {integrity: sha512-HtfVr/hzJJmE0C198F99JLaeada+646B5SaG2pVoEakLFI6iRGsvMqrnnrflq8hm1zQgwskEgqSnhDW11JBp0w==} + /markdownlint-micromark@0.1.2: + resolution: {integrity: sha512-jRxlQg8KpOfM2IbCL9RXM8ZiYWz2rv6DlZAnGv8ASJQpUh6byTBnEsbuMZ6T2/uIgntyf7SKg/mEaEBo1164fQ==} + engines: {node: '>=14.18.0'} + dev: true + + /markdownlint@0.28.2: + resolution: {integrity: sha512-yYaQXoKKPV1zgrFsyAuZPEQoe+JrY9GDag9ObKpk09twx4OCU5lut+0/kZPrQ3W7w82SmgKhd7D8m34aG1unVw==} engines: {node: '>=14.18.0'} dependencies: markdown-it: 13.0.1 + markdownlint-micromark: 0.1.2 dev: true /md5-hex@3.0.1: @@ -9365,7 +9411,7 @@ packages: - supports-color - terser - /vite-plugin-checker@0.6.0(eslint@8.39.0)(typescript@5.0.4)(vite@4.3.3)(vue-tsc@1.6.1): + /vite-plugin-checker@0.6.0(eslint@8.39.0)(typescript@5.0.4)(vite@4.3.3)(vue-tsc@1.6.3): resolution: {integrity: sha512-DWZ9Hv2TkpjviPxAelNUt4Q3IhSGrx7xrwdM64NI+Q4dt8PaMWJJh4qGNtSrfEuiuIzWWo00Ksvh5It4Y3L9xQ==} engines: {node: '>=14.16'} peerDependencies: @@ -9416,7 +9462,7 @@ packages: vscode-languageserver: 7.0.0 vscode-languageserver-textdocument: 1.0.8 vscode-uri: 3.0.7 - vue-tsc: 1.6.1(typescript@5.0.4) + vue-tsc: 1.6.3(typescript@5.0.4) dev: false /vite@3.2.5(@types/node@18.16.3): @@ -9667,14 +9713,14 @@ packages: de-indent: 1.0.2 he: 1.2.0 - /vue-tsc@1.6.1(typescript@5.0.4): - resolution: {integrity: sha512-cKKKrv98MdU9kgd434fkjcIpU7a5bUflhklF9usf/GzebjmZpaht7tYGm/MNdBz7V9icySceCzCr3RiG02mOJg==} + /vue-tsc@1.6.3(typescript@5.0.4): + resolution: {integrity: sha512-q7l27j0eSJgyGat0khetrvoeaAHieRZFnf8WAJyKvB3eF0AxmLqfs4ahwZhaojBJjZ/lAXZa+Xt8EX54KzQ34w==} hasBin: true peerDependencies: typescript: '*' dependencies: - '@volar/vue-language-core': 1.6.1 - '@volar/vue-typescript': 1.6.1(typescript@5.0.4) + '@volar/vue-language-core': 1.6.3 + '@volar/vue-typescript': 1.6.3(typescript@5.0.4) semver: 7.5.0 typescript: 5.0.4 From 675445f98ab9240ace12e61aaced68f8e24c6282 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 1 May 2023 23:48:11 +0100 Subject: [PATCH 16/25] chore: revert `markdownlint-cli` update and prevent auto-update --- package.json | 2 +- pnpm-lock.yaml | 47 ++++++++++++++++++++++++++--------------------- renovate.json | 4 ++-- 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index badc4c6d7b..4ede718bda 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "globby": "^13.1.4", "h3": "^1.6.4", "jiti": "^1.18.2", - "markdownlint-cli": "^0.34.0", + "markdownlint-cli": "^0.33.0", "nuxi": "workspace:*", "nuxt": "workspace:*", "ofetch": "^1.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9378397a12..17dba00079 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -79,8 +79,8 @@ importers: specifier: ^1.18.2 version: 1.18.2 markdownlint-cli: - specifier: ^0.34.0 - version: 0.34.0 + specifier: ^0.33.0 + version: 0.33.0 nuxi: specifier: workspace:* version: link:packages/nuxi @@ -4088,11 +4088,6 @@ packages: delayed-stream: 1.0.0 dev: true - /commander@10.0.1: - resolution: {integrity: sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==} - engines: {node: '>=14'} - dev: true - /commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} @@ -4106,6 +4101,11 @@ packages: engines: {node: '>= 12'} dev: false + /commander@9.4.1: + resolution: {integrity: sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw==} + engines: {node: ^12.20.0 || >=14} + dev: true + /comment-parser@1.3.1: resolution: {integrity: sha512-B52sN2VNghyq5ofvUsqZjmk6YkihBX5vMSChmSK9v4ShjKf3Vk5Xcmgpw4o+iIgtrnM/u5FiMpz9VKb8lpBveA==} engines: {node: '>= 12.0.0'} @@ -5897,6 +5897,17 @@ packages: once: 1.4.0 path-is-absolute: 1.0.1 + /glob@8.0.3: + resolution: {integrity: sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==} + engines: {node: '>=12'} + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 5.1.6 + once: 1.4.0 + dev: true + /glob@8.1.0: resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} engines: {node: '>=12'} @@ -6935,33 +6946,27 @@ packages: uc.micro: 1.0.6 dev: true - /markdownlint-cli@0.34.0: - resolution: {integrity: sha512-4G9I++VBTZkaye6Yfc/7dU6HQHcyldZEVB+bYyQJLcpJOHKk/q5ZpGqK80oKMIdlxzsA3aWOJLZ4DkoaoUWXbQ==} + /markdownlint-cli@0.33.0: + resolution: {integrity: sha512-zMK1oHpjYkhjO+94+ngARiBBrRDEUMzooDHBAHtmEIJ9oYddd9l3chCReY2mPlecwH7gflQp1ApilTo+o0zopQ==} engines: {node: '>=14'} hasBin: true dependencies: - commander: 10.0.1 + commander: 9.4.1 get-stdin: 9.0.0 - glob: 10.2.2 + glob: 8.0.3 ignore: 5.2.4 js-yaml: 4.1.0 jsonc-parser: 3.2.0 - markdownlint: 0.28.2 - minimatch: 9.0.0 + markdownlint: 0.27.0 + minimatch: 5.1.6 run-con: 1.2.11 dev: true - /markdownlint-micromark@0.1.2: - resolution: {integrity: sha512-jRxlQg8KpOfM2IbCL9RXM8ZiYWz2rv6DlZAnGv8ASJQpUh6byTBnEsbuMZ6T2/uIgntyf7SKg/mEaEBo1164fQ==} - engines: {node: '>=14.18.0'} - dev: true - - /markdownlint@0.28.2: - resolution: {integrity: sha512-yYaQXoKKPV1zgrFsyAuZPEQoe+JrY9GDag9ObKpk09twx4OCU5lut+0/kZPrQ3W7w82SmgKhd7D8m34aG1unVw==} + /markdownlint@0.27.0: + resolution: {integrity: sha512-HtfVr/hzJJmE0C198F99JLaeada+646B5SaG2pVoEakLFI6iRGsvMqrnnrflq8hm1zQgwskEgqSnhDW11JBp0w==} engines: {node: '>=14.18.0'} dependencies: markdown-it: 13.0.1 - markdownlint-micromark: 0.1.2 dev: true /md5-hex@3.0.1: diff --git a/renovate.json b/renovate.json index 98b45a9ff5..c323b09b1f 100644 --- a/renovate.json +++ b/renovate.json @@ -13,10 +13,10 @@ "main" ], "ignoreDeps": [ + "markdownlint-cli", "nuxt", "nuxt3", - "@nuxt/kit", - "parse5" + "@nuxt/kit" ] }, { From 16bf228437736099f07e678a1c0628d829f56c47 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 1 May 2023 23:55:24 +0100 Subject: [PATCH 17/25] fix(nuxt): ensure `useError` is called with nuxt app context (#20585) --- docs/1.getting-started/6.data-fetching.md | 4 ++-- docs/1.getting-started/8.error-handling.md | 4 ++++ packages/nuxt/src/app/components/nuxt-island.ts | 4 ++-- packages/nuxt/src/app/composables/cookie.ts | 9 ++++----- packages/nuxt/src/app/composables/error.ts | 4 +++- .../src/components/runtime/server-component.ts | 4 ++-- packages/nuxt/src/core/runtime/nitro/renderer.ts | 4 ++-- test/basic.test.ts | 14 ++++++++++---- test/fixtures/basic/plugins/cookie.ts | 3 +++ 9 files changed, 32 insertions(+), 18 deletions(-) create mode 100644 test/fixtures/basic/plugins/cookie.ts diff --git a/docs/1.getting-started/6.data-fetching.md b/docs/1.getting-started/6.data-fetching.md index 7800cb16d3..69f1da51f2 100644 --- a/docs/1.getting-started/6.data-fetching.md +++ b/docs/1.getting-started/6.data-fetching.md @@ -314,13 +314,13 @@ Be very careful before proxying headers to an external API and just include head If you want to pass on/proxy cookies in the other direction, from an internal request back to the client, you will need to handle this yourself. ```ts [composables/fetch.ts] -import { appendHeader, H3Event } from 'h3' +import { appendResponseHeader, H3Event } from 'h3' export const fetchWithCookie = async (event: H3Event, url: string) => { const res = await $fetch.raw(url) const cookies = (res.headers.get('set-cookie') || '').split(',') for (const cookie of cookies) { - appendHeader(event, 'set-cookie', cookie) + appendResponseHeader(event, 'set-cookie', cookie) } return res._data } diff --git a/docs/1.getting-started/8.error-handling.md b/docs/1.getting-started/8.error-handling.md index e340967ec1..eeb004d2f1 100644 --- a/docs/1.getting-started/8.error-handling.md +++ b/docs/1.getting-started/8.error-handling.md @@ -67,6 +67,10 @@ When you are ready to remove the error page, you can call the `clearError` helpe Make sure to check before using anything dependent on Nuxt plugins, such as `$route` or `useRouter`, as if a plugin threw an error, then it won't be re-run until you clear the error. :: +::alert{type="warning"} +If you are running on Node 16 and you set any cookies when rendering your error page, they will [overwrite cookies previously set](https://github.com/nuxt/nuxt/pull/20585). We recommend using a newer version of Node as Node 16 will reach end-of-life in September 2023. +:: + ### Example ```vue [error.vue] diff --git a/packages/nuxt/src/app/components/nuxt-island.ts b/packages/nuxt/src/app/components/nuxt-island.ts index 69ebb5e523..ea78923984 100644 --- a/packages/nuxt/src/app/components/nuxt-island.ts +++ b/packages/nuxt/src/app/components/nuxt-island.ts @@ -2,7 +2,7 @@ import type { RendererNode } from 'vue' import { computed, createStaticVNode, defineComponent, getCurrentInstance, h, ref, watch } from 'vue' import { debounce } from 'perfect-debounce' import { hash } from 'ohash' -import { appendHeader } from 'h3' +import { appendResponseHeader } from 'h3' import { useHead } from '@unhead/vue' // eslint-disable-next-line import/no-restricted-paths @@ -42,7 +42,7 @@ export default defineComponent({ const url = `/__nuxt_island/${props.name}:${hashId.value}` if (process.server && process.env.prerender) { // Hint to Nitro to prerender the island component - appendHeader(event, 'x-nitro-prerender', url) + appendResponseHeader(event, 'x-nitro-prerender', url) } // TODO: Validate response return $fetch(url, { diff --git a/packages/nuxt/src/app/composables/cookie.ts b/packages/nuxt/src/app/composables/cookie.ts index a578b85e49..a05773cd79 100644 --- a/packages/nuxt/src/app/composables/cookie.ts +++ b/packages/nuxt/src/app/composables/cookie.ts @@ -2,7 +2,7 @@ import type { Ref } from 'vue' import { ref, watch } from 'vue' import type { CookieParseOptions, CookieSerializeOptions } from 'cookie-es' import { parse, serialize } from 'cookie-es' -import { appendHeader } from 'h3' +import { appendResponseHeader } from 'h3' import type { H3Event } from 'h3' import destr from 'destr' import { isEqual } from 'ohash' @@ -48,11 +48,10 @@ export function useCookie (name: string, _opts?: } } const unhook = nuxtApp.hooks.hookOnce('app:rendered', writeFinalCookieValue) - const writeAndUnhook = () => { + nuxtApp.hooks.hookOnce('app:error', () => { unhook() // don't write cookie subsequently when app:rendered is called return writeFinalCookieValue() - } - nuxtApp.hooks.hookOnce('app:error', writeAndUnhook) + }) } return cookie as CookieRef @@ -82,6 +81,6 @@ function writeClientCookie (name: string, value: any, opts: CookieSerializeOptio function writeServerCookie (event: H3Event, name: string, value: any, opts: CookieSerializeOptions = {}) { if (event) { // TODO: Try to smart join with existing Set-Cookie headers - appendHeader(event, 'Set-Cookie', serializeCookie(name, value, opts)) + appendResponseHeader(event, 'Set-Cookie', serializeCookie(name, value, opts)) } } diff --git a/packages/nuxt/src/app/composables/error.ts b/packages/nuxt/src/app/composables/error.ts index 3d1820f139..b23fcd32ee 100644 --- a/packages/nuxt/src/app/composables/error.ts +++ b/packages/nuxt/src/app/composables/error.ts @@ -13,8 +13,10 @@ export const showError = (_err: string | Error | Partial) => { try { const nuxtApp = useNuxtApp() - nuxtApp.callHook('app:error', err) const error = useError() + if (process.client) { + nuxtApp.hooks.callHook('app:error', err) + } error.value = error.value || err } catch { throw err diff --git a/packages/nuxt/src/components/runtime/server-component.ts b/packages/nuxt/src/components/runtime/server-component.ts index bef75caf4a..cdd9e69d47 100644 --- a/packages/nuxt/src/components/runtime/server-component.ts +++ b/packages/nuxt/src/components/runtime/server-component.ts @@ -1,7 +1,7 @@ import { Fragment, computed, createStaticVNode, createVNode, defineComponent, h, ref, watch } from 'vue' import { debounce } from 'perfect-debounce' import { hash } from 'ohash' -import { appendHeader } from 'h3' +import { appendResponseHeader } from 'h3' import { useHead } from '@unhead/vue' import type { NuxtIslandResponse } from '../../core/runtime/nitro/renderer' @@ -51,7 +51,7 @@ const NuxtServerComponent = defineComponent({ const url = `/__nuxt_island/${props.name}:${hashId.value}` if (process.server && process.env.prerender) { // Hint to Nitro to prerender the island component - appendHeader(event, 'x-nitro-prerender', url) + appendResponseHeader(event, 'x-nitro-prerender', url) } // TODO: Validate response return $fetch(url, { diff --git a/packages/nuxt/src/core/runtime/nitro/renderer.ts b/packages/nuxt/src/core/runtime/nitro/renderer.ts index 0ec0d5d4be..f997c85acd 100644 --- a/packages/nuxt/src/core/runtime/nitro/renderer.ts +++ b/packages/nuxt/src/core/runtime/nitro/renderer.ts @@ -2,7 +2,7 @@ import { createRenderer, renderResourceHeaders } from 'vue-bundle-renderer/runti import type { RenderResponse } from 'nitropack' import type { Manifest } from 'vite' import type { H3Event } from 'h3' -import { appendHeader, createError, getQuery, readBody, writeEarlyHints } from 'h3' +import { appendResponseHeader, createError, getQuery, readBody, writeEarlyHints } from 'h3' import devalue from '@nuxt/devalue' import { stringify, uneval } from 'devalue' import destr from 'destr' @@ -275,7 +275,7 @@ export default defineRenderHandler(async (event): Promise { }) it('validates routes', async () => { - const { status } = await fetch('/forbidden') + const { status, headers } = await fetch('/forbidden') expect(status).toEqual(404) + expect(headers.get('Set-Cookie')).toBe('set-in-plugin=true; Path=/') const page = await createPage('/navigate-to-forbidden') await page.waitForLoadState('networkidle') @@ -135,8 +136,11 @@ describe('pages', () => { expect(status).toEqual(500) }) - it('render 404', async () => { - const html = await $fetch('/not-found') + it('render catchall page', async () => { + const res = await fetch('/not-found') + expect(res.status).toEqual(200) + + const html = await res.text() // Snapshot // expect(html).toMatchInlineSnapshot() @@ -578,7 +582,9 @@ describe('errors', () => { it('should render a HTML error page', async () => { const res = await fetch('/error') - expect(res.headers.get('Set-Cookie')).toBe('some-error=was%20set; Path=/') + expect(res.headers.get('Set-Cookie')).toBe('set-in-plugin=true; Path=/') + // TODO: enable when we update test to node v16 + // expect(res.headers.get('Set-Cookie')).toBe('set-in-plugin=true; Path=/, some-error=was%20set; Path=/') expect(await res.text()).toContain('This is a custom error') }) diff --git a/test/fixtures/basic/plugins/cookie.ts b/test/fixtures/basic/plugins/cookie.ts new file mode 100644 index 0000000000..8e969548c9 --- /dev/null +++ b/test/fixtures/basic/plugins/cookie.ts @@ -0,0 +1,3 @@ +export default defineNuxtPlugin(() => { + useCookie('set-in-plugin').value = 'true' +}) From 787d5e953ebe2e1155be6e1e35a42b3d1ba6fbe1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 2 May 2023 12:12:31 +0100 Subject: [PATCH 18/25] chore(deps): update dependency vite to v4.3.4 (main) (#20619) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 4 +-- packages/kit/package.json | 2 +- packages/nuxt/package.json | 2 +- packages/schema/package.json | 2 +- packages/vite/package.json | 2 +- pnpm-lock.yaml | 54 ++++++++++++++++++------------------ 6 files changed, 33 insertions(+), 33 deletions(-) diff --git a/package.json b/package.json index 4ede718bda..4e03255c38 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "nuxt": "workspace:*", "nuxt3": "workspace:nuxt@*", "unbuild": "^1.2.1", - "vite": "^4.3.3", + "vite": "^4.3.4", "vue": "3.2.47", "magic-string": "^0.30.0" }, @@ -73,7 +73,7 @@ "typescript": "^5.0.4", "ufo": "^1.1.1", "unbuild": "^1.2.1", - "vite": "^4.3.3", + "vite": "^4.3.4", "vitest": "^0.30.1", "vue": "3.2.47", "vue-eslint-parser": "^9.1.1", diff --git a/packages/kit/package.json b/packages/kit/package.json index 3d0c75e46e..b76bb28891 100644 --- a/packages/kit/package.json +++ b/packages/kit/package.json @@ -45,7 +45,7 @@ "@types/semver": "^7.3.13", "nitropack": "^2.3.3", "unbuild": "latest", - "vite": "^4.3.3", + "vite": "^4.3.4", "vitest": "^0.30.1", "webpack": "^5.81.0" }, diff --git a/packages/nuxt/package.json b/packages/nuxt/package.json index 64b23e13fa..b613d3e947 100644 --- a/packages/nuxt/package.json +++ b/packages/nuxt/package.json @@ -108,7 +108,7 @@ "@vitejs/plugin-vue": "^4.2.1", "acorn": "^8.8.2", "unbuild": "latest", - "vite": "^4.3.3", + "vite": "^4.3.4", "vitest": "^0.30.1" }, "peerDependencies": { diff --git a/packages/schema/package.json b/packages/schema/package.json index 6601c4517a..35bf81ce7c 100644 --- a/packages/schema/package.json +++ b/packages/schema/package.json @@ -30,7 +30,7 @@ "nitropack": "^2.3.3", "unbuild": "latest", "unctx": "^2.3.0", - "vite": "~4.3.3", + "vite": "~4.3.4", "vue": "3.2.47", "vue-bundle-renderer": "^1.0.3", "vue-router": "^4.1.6", diff --git a/packages/vite/package.json b/packages/vite/package.json index b10d48675a..dd027daae6 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -54,7 +54,7 @@ "strip-literal": "^1.0.1", "ufo": "^1.1.1", "unplugin": "^1.3.1", - "vite": "~4.3.3", + "vite": "~4.3.4", "vite-node": "^0.30.1", "vite-plugin-checker": "^0.6.0", "vue-bundle-renderer": "^1.0.3" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 17dba00079..1cb297cb47 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,7 +10,7 @@ overrides: nuxt: workspace:* nuxt3: workspace:nuxt@* unbuild: ^1.2.1 - vite: ^4.3.3 + vite: ^4.3.4 vue: 3.2.47 magic-string: ^0.30.0 @@ -115,8 +115,8 @@ importers: specifier: ^1.2.1 version: 1.2.1 vite: - specifier: ^4.3.3 - version: 4.3.3(@types/node@18.16.3) + specifier: ^4.3.4 + version: 4.3.4(@types/node@18.16.3) vitest: specifier: ^0.30.1 version: 0.30.1(playwright@1.33.0) @@ -446,8 +446,8 @@ importers: specifier: ^1.2.1 version: 1.2.1 vite: - specifier: ^4.3.3 - version: 4.3.3(@types/node@18.16.3) + specifier: ^4.3.4 + version: 4.3.4(@types/node@18.16.3) vitest: specifier: ^0.30.1 version: 0.30.1(playwright@1.33.0) @@ -716,7 +716,7 @@ importers: version: 2.4.4 '@vitejs/plugin-vue': specifier: ^4.2.1 - version: 4.2.1(vite@4.3.3)(vue@3.2.47) + version: 4.2.1(vite@4.3.4)(vue@3.2.47) acorn: specifier: ^8.8.2 version: 8.8.2 @@ -724,8 +724,8 @@ importers: specifier: ^1.2.1 version: 1.2.1 vite: - specifier: ^4.3.3 - version: 4.3.3(@types/node@18.16.3) + specifier: ^4.3.4 + version: 4.3.4(@types/node@18.16.3) vitest: specifier: ^0.30.1 version: 0.30.1(playwright@1.33.0) @@ -768,10 +768,10 @@ importers: version: 1.1.26 '@vitejs/plugin-vue': specifier: ^4.2.1 - version: 4.2.1(vite@4.3.3)(vue@3.2.47) + version: 4.2.1(vite@4.3.4)(vue@3.2.47) '@vitejs/plugin-vue-jsx': specifier: ^3.0.1 - version: 3.0.1(vite@4.3.3)(vue@3.2.47) + version: 3.0.1(vite@4.3.4)(vue@3.2.47) h3: specifier: ^1.6.4 version: 1.6.4 @@ -788,8 +788,8 @@ importers: specifier: ^2.3.0 version: 2.3.0 vite: - specifier: ^4.3.3 - version: 4.3.3(@types/node@18.16.3) + specifier: ^4.3.4 + version: 4.3.4(@types/node@18.16.3) vue: specifier: 3.2.47 version: 3.2.47 @@ -859,10 +859,10 @@ importers: version: 5.0.2(rollup@3.21.0) '@vitejs/plugin-vue': specifier: ^4.2.1 - version: 4.2.1(vite@4.3.3)(vue@3.2.47) + version: 4.2.1(vite@4.3.4)(vue@3.2.47) '@vitejs/plugin-vue-jsx': specifier: ^3.0.1 - version: 3.0.1(vite@4.3.3)(vue@3.2.47) + version: 3.0.1(vite@4.3.4)(vue@3.2.47) autoprefixer: specifier: ^10.4.14 version: 10.4.14(postcss@8.4.23) @@ -942,14 +942,14 @@ importers: specifier: ^1.3.1 version: 1.3.1 vite: - specifier: ^4.3.3 - version: 4.3.3(@types/node@18.16.3) + specifier: ^4.3.4 + version: 4.3.4(@types/node@18.16.3) vite-node: specifier: ^0.30.1 version: 0.30.1(@types/node@18.16.3) vite-plugin-checker: specifier: ^0.6.0 - version: 0.6.0(eslint@8.39.0)(typescript@5.0.4)(vite@4.3.3)(vue-tsc@1.6.3) + version: 0.6.0(eslint@8.39.0)(typescript@5.0.4)(vite@4.3.4)(vue-tsc@1.6.3) vue-bundle-renderer: specifier: ^1.0.3 version: 1.0.3 @@ -2945,7 +2945,7 @@ packages: - encoding - supports-color - /@vitejs/plugin-vue-jsx@3.0.1(vite@4.3.3)(vue@3.2.47): + /@vitejs/plugin-vue-jsx@3.0.1(vite@4.3.4)(vue@3.2.47): resolution: {integrity: sha512-+Jb7ggL48FSPS1uhPnJbJwWa9Sr90vQ+d0InW+AhBM22n+cfuYqJZDckBc+W3QSHe1WDvewMZfa4wZOtk5pRgw==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: @@ -2955,19 +2955,19 @@ packages: '@babel/core': 7.21.4 '@babel/plugin-transform-typescript': 7.21.0(@babel/core@7.21.4) '@vue/babel-plugin-jsx': 1.1.1(@babel/core@7.21.4) - vite: 4.3.3(@types/node@18.16.3) + vite: 4.3.4(@types/node@18.16.3) vue: 3.2.47 transitivePeerDependencies: - supports-color - /@vitejs/plugin-vue@4.2.1(vite@4.3.3)(vue@3.2.47): + /@vitejs/plugin-vue@4.2.1(vite@4.3.4)(vue@3.2.47): resolution: {integrity: sha512-ZTZjzo7bmxTRTkb8GSTwkPOYDIP7pwuyV+RV53c9PYUouwcbkIZIvWvNWlX2b1dYZqtOv7D6iUAnJLVNGcLrSw==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: vite: ^4.0.0 vue: ^3.2.25 dependencies: - vite: 4.3.3(@types/node@18.16.3) + vite: 4.3.4(@types/node@18.16.3) vue: 3.2.47 /@vitest/expect@0.30.1: @@ -9406,7 +9406,7 @@ packages: mlly: 1.2.0 pathe: 1.1.0 picocolors: 1.0.0 - vite: 4.3.3(@types/node@18.16.3) + vite: 4.3.4(@types/node@18.16.3) transitivePeerDependencies: - '@types/node' - less @@ -9416,7 +9416,7 @@ packages: - supports-color - terser - /vite-plugin-checker@0.6.0(eslint@8.39.0)(typescript@5.0.4)(vite@4.3.3)(vue-tsc@1.6.3): + /vite-plugin-checker@0.6.0(eslint@8.39.0)(typescript@5.0.4)(vite@4.3.4)(vue-tsc@1.6.3): resolution: {integrity: sha512-DWZ9Hv2TkpjviPxAelNUt4Q3IhSGrx7xrwdM64NI+Q4dt8PaMWJJh4qGNtSrfEuiuIzWWo00Ksvh5It4Y3L9xQ==} engines: {node: '>=14.16'} peerDependencies: @@ -9462,7 +9462,7 @@ packages: strip-ansi: 6.0.1 tiny-invariant: 1.3.1 typescript: 5.0.4 - vite: 4.3.3(@types/node@18.16.3) + vite: 4.3.4(@types/node@18.16.3) vscode-languageclient: 7.0.0 vscode-languageserver: 7.0.0 vscode-languageserver-textdocument: 1.0.8 @@ -9504,8 +9504,8 @@ packages: fsevents: 2.3.2 dev: true - /vite@4.3.3(@types/node@18.16.3): - resolution: {integrity: sha512-MwFlLBO4udZXd+VBcezo3u8mC77YQk+ik+fbc0GZWGgzfbPP+8Kf0fldhARqvSYmtIWoAJ5BXPClUbMTlqFxrA==} + /vite@4.3.4(@types/node@18.16.3): + resolution: {integrity: sha512-f90aqGBoxSFxWph2b39ae2uHAxm5jFBBdnfueNxZAT1FTpM13ccFQExCaKbR2xFW5atowjleRniQ7onjJ22QEg==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true peerDependencies: @@ -9591,7 +9591,7 @@ packages: strip-literal: 1.0.1 tinybench: 2.4.0 tinypool: 0.4.0 - vite: 4.3.3(@types/node@18.16.3) + vite: 4.3.4(@types/node@18.16.3) vite-node: 0.30.1(@types/node@18.16.3) why-is-node-running: 2.2.2 transitivePeerDependencies: From 84559e84aa054e2448d7a5ad9fec0de44205e090 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Tue, 2 May 2023 13:17:41 +0200 Subject: [PATCH 19/25] feat(kit): support passing getter to `addVitePlugin` and `addWebpackPlugin` (#20525) --- packages/kit/src/build.ts | 12 ++++++++---- packages/nuxt/src/core/nuxt.ts | 24 ++++++++++++------------ packages/nuxt/src/imports/module.ts | 4 ++-- packages/nuxt/src/pages/module.ts | 4 ++-- test/fixtures/basic/nuxt.config.ts | 4 ++-- 5 files changed, 26 insertions(+), 22 deletions(-) diff --git a/packages/kit/src/build.ts b/packages/kit/src/build.ts index 1ad1ad8b4f..c8cb90c3fa 100644 --- a/packages/kit/src/build.ts +++ b/packages/kit/src/build.ts @@ -106,9 +106,11 @@ export function extendViteConfig ( /** * Append webpack plugin to the config. */ -export function addWebpackPlugin (plugin: WebpackPluginInstance | WebpackPluginInstance[], options?: ExtendWebpackConfigOptions) { - const method: 'push' | 'unshift' = options?.prepend ? 'unshift' : 'push' +export function addWebpackPlugin (pluginOrGetter: WebpackPluginInstance | WebpackPluginInstance[] | (() => WebpackPluginInstance | WebpackPluginInstance[]), options?: ExtendWebpackConfigOptions) { extendWebpackConfig((config) => { + const method: 'push' | 'unshift' = options?.prepend ? 'unshift' : 'push' + const plugin = typeof pluginOrGetter === 'function' ? pluginOrGetter() : pluginOrGetter + config.plugins = config.plugins || [] if (Array.isArray(plugin)) { config.plugins[method](...plugin) @@ -121,9 +123,11 @@ export function addWebpackPlugin (plugin: WebpackPluginInstance | WebpackPluginI /** * Append Vite plugin to the config. */ -export function addVitePlugin (plugin: VitePlugin | VitePlugin[], options?: ExtendViteConfigOptions) { - const method: 'push' | 'unshift' = options?.prepend ? 'unshift' : 'push' +export function addVitePlugin (pluginOrGetter: VitePlugin | VitePlugin[] | (() => VitePlugin | VitePlugin[]), options?: ExtendViteConfigOptions) { extendViteConfig((config) => { + const method: 'push' | 'unshift' = options?.prepend ? 'unshift' : 'push' + const plugin = typeof pluginOrGetter === 'function' ? pluginOrGetter() : pluginOrGetter + config.plugins = config.plugins || [] if (Array.isArray(plugin)) { config.plugins[method](...plugin) diff --git a/packages/nuxt/src/core/nuxt.ts b/packages/nuxt/src/core/nuxt.ts index ee55729ca0..d1a0bfa160 100644 --- a/packages/nuxt/src/core/nuxt.ts +++ b/packages/nuxt/src/core/nuxt.ts @@ -78,17 +78,17 @@ async function initNuxt (nuxt: Nuxt) { exclude: [join(nuxt.options.rootDir, 'index.html')], patterns: vueAppPatterns(nuxt) } - addVitePlugin(ImportProtectionPlugin.vite(config)) - addWebpackPlugin(ImportProtectionPlugin.webpack(config)) + addVitePlugin(() => ImportProtectionPlugin.vite(config)) + addWebpackPlugin(() => ImportProtectionPlugin.webpack(config)) if (nuxt.options.experimental.localLayerAliases) { // Add layer aliasing support for ~, ~~, @ and @@ aliases - addVitePlugin(LayerAliasingPlugin.vite({ + addVitePlugin(() => LayerAliasingPlugin.vite({ sourcemap: nuxt.options.sourcemap.server || nuxt.options.sourcemap.client, // skip top-level layer (user's project) as the aliases will already be correctly resolved layers: nuxt.options._layers.slice(1) })) - addWebpackPlugin(LayerAliasingPlugin.webpack({ + addWebpackPlugin(() => LayerAliasingPlugin.webpack({ sourcemap: nuxt.options.sourcemap.server || nuxt.options.sourcemap.client, // skip top-level layer (user's project) as the aliases will already be correctly resolved layers: nuxt.options._layers.slice(1), @@ -102,8 +102,8 @@ async function initNuxt (nuxt: Nuxt) { sourcemap: nuxt.options.sourcemap.server || nuxt.options.sourcemap.client, transformerOptions: nuxt.options.optimization.asyncTransforms } - addVitePlugin(UnctxTransformPlugin.vite(options)) - addWebpackPlugin(UnctxTransformPlugin.webpack(options)) + addVitePlugin(() => UnctxTransformPlugin.vite(options)) + addWebpackPlugin(() => UnctxTransformPlugin.webpack(options)) // Add composable tree-shaking optimisations const serverTreeShakeOptions: TreeShakeComposablesPluginOptions = { @@ -111,23 +111,23 @@ async function initNuxt (nuxt: Nuxt) { composables: nuxt.options.optimization.treeShake.composables.server } if (Object.keys(serverTreeShakeOptions.composables).length) { - addVitePlugin(TreeShakeComposablesPlugin.vite(serverTreeShakeOptions), { client: false }) - addWebpackPlugin(TreeShakeComposablesPlugin.webpack(serverTreeShakeOptions), { client: false }) + addVitePlugin(() => TreeShakeComposablesPlugin.vite(serverTreeShakeOptions), { client: false }) + addWebpackPlugin(() => TreeShakeComposablesPlugin.webpack(serverTreeShakeOptions), { client: false }) } const clientTreeShakeOptions: TreeShakeComposablesPluginOptions = { sourcemap: nuxt.options.sourcemap.client, composables: nuxt.options.optimization.treeShake.composables.client } if (Object.keys(clientTreeShakeOptions.composables).length) { - addVitePlugin(TreeShakeComposablesPlugin.vite(clientTreeShakeOptions), { server: false }) - addWebpackPlugin(TreeShakeComposablesPlugin.webpack(clientTreeShakeOptions), { server: false }) + addVitePlugin(() => TreeShakeComposablesPlugin.vite(clientTreeShakeOptions), { server: false }) + addWebpackPlugin(() => TreeShakeComposablesPlugin.webpack(clientTreeShakeOptions), { server: false }) } }) if (!nuxt.options.dev) { // DevOnly component tree-shaking - build time only - addVitePlugin(DevOnlyPlugin.vite({ sourcemap: nuxt.options.sourcemap.server || nuxt.options.sourcemap.client })) - addWebpackPlugin(DevOnlyPlugin.webpack({ sourcemap: nuxt.options.sourcemap.server || nuxt.options.sourcemap.client })) + addVitePlugin(() => DevOnlyPlugin.vite({ sourcemap: nuxt.options.sourcemap.server || nuxt.options.sourcemap.client })) + addWebpackPlugin(() => DevOnlyPlugin.webpack({ sourcemap: nuxt.options.sourcemap.server || nuxt.options.sourcemap.client })) } // TODO: [Experimental] Avoid emitting assets when flag is enabled diff --git a/packages/nuxt/src/imports/module.ts b/packages/nuxt/src/imports/module.ts index acca6057b7..8910b40aa7 100644 --- a/packages/nuxt/src/imports/module.ts +++ b/packages/nuxt/src/imports/module.ts @@ -81,8 +81,8 @@ export default defineNuxtModule>({ nuxt.options.alias['#imports'] = join(nuxt.options.buildDir, 'imports') // Transform to inject imports in production mode - addVitePlugin(TransformPlugin.vite({ ctx, options, sourcemap: nuxt.options.sourcemap.server || nuxt.options.sourcemap.client })) - addWebpackPlugin(TransformPlugin.webpack({ ctx, options, sourcemap: nuxt.options.sourcemap.server || nuxt.options.sourcemap.client })) + addVitePlugin(() => TransformPlugin.vite({ ctx, options, sourcemap: nuxt.options.sourcemap.server || nuxt.options.sourcemap.client })) + addWebpackPlugin(() => TransformPlugin.webpack({ ctx, options, sourcemap: nuxt.options.sourcemap.server || nuxt.options.sourcemap.client })) const priorities = nuxt.options._layers.map((layer, i) => [layer.config.srcDir, -i] as const).sort(([a], [b]) => b.length - a.length) diff --git a/packages/nuxt/src/pages/module.ts b/packages/nuxt/src/pages/module.ts index 8997954d9a..b19e528e1e 100644 --- a/packages/nuxt/src/pages/module.ts +++ b/packages/nuxt/src/pages/module.ts @@ -157,8 +157,8 @@ export default defineNuxtModule({ ) } nuxt.hook('modules:done', () => { - addVitePlugin(PageMetaPlugin.vite(pageMetaOptions)) - addWebpackPlugin(PageMetaPlugin.webpack(pageMetaOptions)) + addVitePlugin(() => PageMetaPlugin.vite(pageMetaOptions)) + addWebpackPlugin(() => PageMetaPlugin.webpack(pageMetaOptions)) }) // Add prefetching support for middleware & layouts diff --git a/test/fixtures/basic/nuxt.config.ts b/test/fixtures/basic/nuxt.config.ts index 8377002374..59b947e0f7 100644 --- a/test/fixtures/basic/nuxt.config.ts +++ b/test/fixtures/basic/nuxt.config.ts @@ -106,8 +106,8 @@ export default defineNuxtConfig({ if (id === 'virtual.css') { return ':root { --virtual: red }' } } })) - addVitePlugin(plugin.vite()) - addWebpackPlugin(plugin.webpack()) + addVitePlugin(() => plugin.vite()) + addWebpackPlugin(() => plugin.webpack()) }, function (_options, nuxt) { const routesToDuplicate = ['/async-parent', '/fixed-keyed-child-parent', '/keyed-child-parent', '/with-layout', '/with-layout2'] From fb76b3931ac9ee0c7ebdad4085a93e10d447f4ce Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Tue, 2 May 2023 15:24:11 +0200 Subject: [PATCH 20/25] feat(nuxi): allow greater control of `nuxi analyze` from cli (#20387) --- packages/nuxi/src/commands/analyze.ts | 103 +++++++++++++++++--------- packages/nuxi/src/commands/build.ts | 4 +- packages/nuxi/src/commands/dev.ts | 5 +- packages/nuxi/src/commands/prepare.ts | 4 +- packages/nuxi/src/utils/fs.ts | 21 +++++- packages/nuxt/src/core/nitro.ts | 2 +- packages/schema/src/config/build.ts | 3 +- packages/schema/src/config/common.ts | 40 ++++++---- packages/schema/src/config/webpack.ts | 3 +- packages/schema/src/types/hooks.ts | 17 +++++ 10 files changed, 142 insertions(+), 60 deletions(-) diff --git a/packages/nuxi/src/commands/analyze.ts b/packages/nuxi/src/commands/analyze.ts index f450897a79..09987c5324 100644 --- a/packages/nuxi/src/commands/analyze.ts +++ b/packages/nuxi/src/commands/analyze.ts @@ -2,7 +2,7 @@ import { promises as fsp } from 'node:fs' import { join, resolve } from 'pathe' import { createApp, eventHandler, lazyEventHandler, toNodeListener } from 'h3' import { listen } from 'listhen' -import { writeTypes } from '../utils/prepare' +import type { NuxtAnalyzeMeta } from '@nuxt/schema' import { loadKit } from '../utils/kit' import { clearDir } from '../utils/fs' import { overrideEnv } from '../utils/env' @@ -11,62 +11,99 @@ import { defineNuxtCommand } from './index' export default defineNuxtCommand({ meta: { name: 'analyze', - usage: 'npx nuxi analyze [--log-level] [rootDir]', + usage: 'npx nuxi analyze [--log-level] [--name] [--no-serve] [rootDir]', description: 'Build nuxt and analyze production bundle (experimental)' }, async invoke (args) { overrideEnv('production') + const name = args.name || 'default' + const slug = name.trim().replace(/[^a-z0-9_-]/gi, '_') const rootDir = resolve(args._[0] || '.') - const statsDir = join(rootDir, '.nuxt/stats') + + let analyzeDir = join(rootDir, '.nuxt/analyze', slug) + let buildDir = join(analyzeDir, '.nuxt') + let outDir = join(analyzeDir, '.output') + + const startTime = Date.now() const { loadNuxt, buildNuxt } = await loadKit(rootDir) const nuxt = await loadNuxt({ rootDir, overrides: { - build: { analyze: true }, + build: { + analyze: true + }, + analyzeDir, + buildDir, + nitro: { + output: { + dir: outDir + } + }, logLevel: args['log-level'] } }) - await clearDir(nuxt.options.buildDir) - await writeTypes(nuxt) + analyzeDir = nuxt.options.analyzeDir + buildDir = nuxt.options.buildDir + outDir = nuxt.options.nitro.output?.dir || outDir + + await clearDir(analyzeDir) await buildNuxt(nuxt) - const app = createApp() + const endTime = Date.now() - const serveFile = (filePath: string) => lazyEventHandler(async () => { - const contents = await fsp.readFile(filePath, 'utf-8') - return eventHandler((event) => { event.node.res.end(contents) }) - }) + const meta: NuxtAnalyzeMeta = { + name, + slug, + startTime, + endTime, + analyzeDir, + buildDir, + outDir + } + await nuxt.callHook('build:analyze:done', meta) + await fsp.writeFile(join(analyzeDir, 'meta.json'), JSON.stringify(meta, null, 2), 'utf-8') + + console.info('Analyze results are available at: `' + analyzeDir + '`') console.warn('Do not deploy analyze results! Use `nuxi build` before deploying.') - console.info('Starting stats server...') + if (args.serve !== false && !process.env.CI) { + const app = createApp() - app.use('/client', serveFile(join(statsDir, 'client.html'))) - app.use('/nitro', serveFile(join(statsDir, 'nitro.html'))) - app.use(eventHandler(() => ` - - - - Nuxt Bundle Stats (experimental) - -

Nuxt Bundle Stats (experimental)

- - - `)) + const serveFile = (filePath: string) => lazyEventHandler(async () => { + const contents = await fsp.readFile(filePath, 'utf-8') + return eventHandler((event) => { event.node.res.end(contents) }) + }) - await listen(toNodeListener(app)) + console.info('Starting stats server...') - return 'wait' as const + app.use('/client', serveFile(join(analyzeDir, 'client.html'))) + app.use('/nitro', serveFile(join(analyzeDir, 'nitro.html'))) + app.use(eventHandler(() => ` + + + + Nuxt Bundle Stats (experimental) + +

Nuxt Bundle Stats (experimental)

+ + + `)) + + await listen(toNodeListener(app)) + + return 'wait' as const + } } }) diff --git a/packages/nuxi/src/commands/build.ts b/packages/nuxi/src/commands/build.ts index dc2c2ab545..a582d1209d 100644 --- a/packages/nuxi/src/commands/build.ts +++ b/packages/nuxi/src/commands/build.ts @@ -2,7 +2,7 @@ import { relative, resolve } from 'pathe' import { consola } from 'consola' import { writeTypes } from '../utils/prepare' import { loadKit } from '../utils/kit' -import { clearDir } from '../utils/fs' +import { clearBuildDir } from '../utils/fs' import { overrideEnv } from '../utils/env' import { showVersions } from '../utils/banner' import { defineNuxtCommand } from './index' @@ -36,7 +36,7 @@ export default defineNuxtCommand({ // Use ? for backward compatibility for Nuxt <= RC.10 const nitro = useNitro?.() - await clearDir(nuxt.options.buildDir) + await clearBuildDir(nuxt.options.buildDir) await writeTypes(nuxt) diff --git a/packages/nuxi/src/commands/dev.ts b/packages/nuxi/src/commands/dev.ts index ee527aff48..b2c488de67 100644 --- a/packages/nuxi/src/commands/dev.ts +++ b/packages/nuxi/src/commands/dev.ts @@ -12,7 +12,8 @@ import { writeTypes } from '../utils/prepare' import { loadKit } from '../utils/kit' import { importModule } from '../utils/esm' import { overrideEnv } from '../utils/env' -import { cleanupNuxtDirs, loadNuxtManifest, writeNuxtManifest } from '../utils/nuxt' +import { loadNuxtManifest, writeNuxtManifest } from '../utils/nuxt' +import { clearBuildDir } from '../utils/fs' import { defineNuxtCommand } from './index' export default defineNuxtCommand({ @@ -110,7 +111,7 @@ export default defineNuxtCommand({ const previousManifest = await loadNuxtManifest(currentNuxt.options.buildDir) const newManifest = await writeNuxtManifest(currentNuxt) if (previousManifest && newManifest && previousManifest._hash !== newManifest._hash) { - await cleanupNuxtDirs(currentNuxt.options.rootDir) + await clearBuildDir(currentNuxt.options.buildDir) } } diff --git a/packages/nuxi/src/commands/prepare.ts b/packages/nuxi/src/commands/prepare.ts index 4e194e03eb..43cd2f0561 100644 --- a/packages/nuxi/src/commands/prepare.ts +++ b/packages/nuxi/src/commands/prepare.ts @@ -1,6 +1,6 @@ import { relative, resolve } from 'pathe' import { consola } from 'consola' -import { clearDir } from '../utils/fs' +import { clearBuildDir } from '../utils/fs' import { loadKit } from '../utils/kit' import { writeTypes } from '../utils/prepare' import { defineNuxtCommand } from './index' @@ -23,7 +23,7 @@ export default defineNuxtCommand({ logLevel: args['log-level'] } }) - await clearDir(nuxt.options.buildDir) + await clearBuildDir(nuxt.options.buildDir) await buildNuxt(nuxt) await writeTypes(nuxt) diff --git a/packages/nuxi/src/utils/fs.ts b/packages/nuxi/src/utils/fs.ts index 857cb47f2d..7f8640eb4f 100644 --- a/packages/nuxi/src/utils/fs.ts +++ b/packages/nuxi/src/utils/fs.ts @@ -1,5 +1,5 @@ -import { promises as fsp } from 'node:fs' -import { dirname } from 'pathe' +import { existsSync, promises as fsp } from 'node:fs' +import { dirname, join } from 'pathe' import { consola } from 'consola' // Check if a file exists @@ -12,11 +12,24 @@ export async function exists (path: string) { } } -export async function clearDir (path: string) { - await fsp.rm(path, { recursive: true, force: true }) +export async function clearDir (path: string, exclude?: string[]) { + if (!exclude) { + await fsp.rm(path, { recursive: true, force: true }) + } else if (existsSync(path)) { + const files = await fsp.readdir(path) + await Promise.all(files.map(async (name) => { + if (!exclude.includes(name)) { + await fsp.rm(join(path, name), { recursive: true, force: true }) + } + })) + } await fsp.mkdir(path, { recursive: true }) } +export function clearBuildDir (path: string) { + return clearDir(path, ['cache', 'analyze']) +} + export async function rmRecursive (paths: string[]) { await Promise.all(paths.filter(p => typeof p === 'string').map(async (path) => { consola.debug('Removing recursive path', path) diff --git a/packages/nuxt/src/core/nitro.ts b/packages/nuxt/src/core/nitro.ts index 4e0e5dce9f..10d0ba12b6 100644 --- a/packages/nuxt/src/core/nitro.ts +++ b/packages/nuxt/src/core/nitro.ts @@ -65,7 +65,7 @@ export async function initNitro (nuxt: Nuxt & { _nitro?: Nitro }) { analyze: nuxt.options.build.analyze && { template: 'treemap', projectRoot: nuxt.options.rootDir, - filename: join(nuxt.options.rootDir, '.nuxt/stats', '{name}.html') + filename: join(nuxt.options.analyzeDir, '{name}.html') }, scanDirs: nuxt.options._layers.map(layer => (layer.config.serverDir || layer.config.srcDir) && resolve(layer.cwd, layer.config.serverDir || resolve(layer.config.srcDir, 'server'))).filter(Boolean), renderer: resolve(distDir, 'core/runtime/nitro/renderer'), diff --git a/packages/schema/src/config/build.ts b/packages/schema/src/config/build.ts index c905fae4ce..cccdd038fa 100644 --- a/packages/schema/src/config/build.ts +++ b/packages/schema/src/config/build.ts @@ -119,10 +119,11 @@ export default defineUntypedSchema({ return val ?? false } const rootDir = await get('rootDir') + const analyzeDir = await get('analyzeDir') return { template: 'treemap', projectRoot: rootDir, - filename: join(rootDir, '.nuxt/stats', '{name}.html') + filename: join(analyzeDir, '{name}.html') } } }, diff --git a/packages/schema/src/config/common.ts b/packages/schema/src/config/common.ts index bc0437e454..16ebeaeef0 100644 --- a/packages/schema/src/config/common.ts +++ b/packages/schema/src/config/common.ts @@ -117,20 +117,20 @@ export default defineUntypedSchema({ }, /** - * Used to set the modules directories for path resolving (for example, webpack's - * `resolveLoading`, `nodeExternals` and `postcss`). - * - * The configuration path is relative to `options.rootDir` (default is current working directory). - * - * Setting this field may be necessary if your project is organized as a yarn workspace-styled mono-repository. - * - * @example - * ```js - * export default { - * modulesDir: ['../../node_modules'] - * } - * ``` - */ + * Used to set the modules directories for path resolving (for example, webpack's + * `resolveLoading`, `nodeExternals` and `postcss`). + * + * The configuration path is relative to `options.rootDir` (default is current working directory). + * + * Setting this field may be necessary if your project is organized as a yarn workspace-styled mono-repository. + * + * @example + * ```js + * export default { + * modulesDir: ['../../node_modules'] + * } + * ``` + */ modulesDir: { $default: ['node_modules'], $resolve: async (val, get) => [ @@ -139,6 +139,17 @@ export default defineUntypedSchema({ ] }, + /** + * The directory where Nuxt will store the generated files when running `nuxt analyze`. + * + * If a relative path is specified, it will be relative to your `rootDir`. + */ + analyzeDir: { + $resolve: async (val, get) => val + ? resolve(await get('rootDir'), val) + : resolve(await get('buildDir'), 'analyze') + }, + /** * Whether Nuxt is running in development mode. * @@ -346,6 +357,7 @@ export default defineUntypedSchema({ '**/*.d.ts', // ignore type declarations '.output', '.git', + await get('analyzeDir'), await get('ignorePrefix') && `**/${await get('ignorePrefix')}*.*` ].concat(val).filter(Boolean) }, diff --git a/packages/schema/src/config/webpack.ts b/packages/schema/src/config/webpack.ts index edd3cf4689..6675d44a56 100644 --- a/packages/schema/src/config/webpack.ts +++ b/packages/schema/src/config/webpack.ts @@ -22,10 +22,11 @@ export default defineUntypedSchema({ return val ?? false } const rootDir = await get('rootDir') + const analyzeDir = await get('analyzeDir') return { template: 'treemap', projectRoot: rootDir, - filename: join(rootDir, '.nuxt/stats', '{name}.html') + filename: join(analyzeDir, '{name}.html') } } }, diff --git a/packages/schema/src/types/hooks.ts b/packages/schema/src/types/hooks.ts index b11ed93fa6..e314336975 100644 --- a/packages/schema/src/types/hooks.ts +++ b/packages/schema/src/types/hooks.ts @@ -47,6 +47,16 @@ export interface GenerateAppOptions { filter?: (template: ResolvedNuxtTemplate) => boolean } +export interface NuxtAnalyzeMeta { + name: string + slug: string + startTime: number + endTime: number + analyzeDir: string + buildDir: string + outDir: string +} + /** * The listeners to Nuxt build time events */ @@ -131,6 +141,13 @@ export interface NuxtHooks { */ 'build:manifest': (manifest: Manifest) => HookResult + /** + * Called when `nuxt analyze` is finished + * @param meta the analyze meta object, mutations will be saved to `meta.json` + * @returns Promise + */ + 'build:analyze:done': (meta: NuxtAnalyzeMeta) => HookResult + /** * Called before generating the app. * @param options GenerateAppOptions object From af75f18cf5203fe4ac3c8a674ea44aa84a178f70 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 2 May 2023 21:11:13 +0100 Subject: [PATCH 21/25] ci: run autofix on renovate branches --- .github/workflows/autofix-docs.yml | 1 + .github/workflows/docs.yml | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/autofix-docs.yml b/.github/workflows/autofix-docs.yml index 137d5bab6a..4d72bd1a06 100644 --- a/.github/workflows/autofix-docs.yml +++ b/.github/workflows/autofix-docs.yml @@ -5,6 +5,7 @@ on: paths: - "docs/**" - ".github/workflows/docs.yml" + push: branches: - "renovate/**" diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index fbf88268f3..f83eecede6 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -8,7 +8,6 @@ on: # autofix workflow will be triggered instead for PRs branches: - main - - "renovate/**" - "!v[0-9]*" # Remove default permissions of GITHUB_TOKEN for security From 3306cfe29219b30090fee0d43a2203bc82592ea2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 3 May 2023 07:00:29 +0100 Subject: [PATCH 22/25] chore(deps): update all non-major dependencies (main) (#20632) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 4 +-- packages/kit/package.json | 2 +- packages/nuxi/package.json | 2 +- packages/nuxt/package.json | 2 +- packages/schema/package.json | 2 +- packages/vite/package.json | 2 +- pnpm-lock.yaml | 50 ++++++++++++++++++------------------ 7 files changed, 32 insertions(+), 32 deletions(-) diff --git a/package.json b/package.json index 4e03255c38..7aa286136f 100644 --- a/package.json +++ b/package.json @@ -76,10 +76,10 @@ "vite": "^4.3.4", "vitest": "^0.30.1", "vue": "3.2.47", - "vue-eslint-parser": "^9.1.1", + "vue-eslint-parser": "^9.2.0", "vue-tsc": "^1.6.3" }, - "packageManager": "pnpm@8.3.1", + "packageManager": "pnpm@8.4.0", "engines": { "node": "^14.18.0 || >=16.10.0" } diff --git a/packages/kit/package.json b/packages/kit/package.json index b76bb28891..f8da00d7b2 100644 --- a/packages/kit/package.json +++ b/packages/kit/package.json @@ -32,7 +32,7 @@ "lodash.template": "^4.5.0", "mlly": "^1.2.0", "pathe": "^1.1.0", - "pkg-types": "^1.0.2", + "pkg-types": "^1.0.3", "scule": "^1.0.0", "semver": "^7.5.0", "unctx": "^2.3.0", diff --git a/packages/nuxi/package.json b/packages/nuxi/package.json index ccd9f95fe3..379416a419 100644 --- a/packages/nuxi/package.json +++ b/packages/nuxi/package.json @@ -44,7 +44,7 @@ "ohash": "^1.1.2", "pathe": "^1.1.0", "perfect-debounce": "^0.1.3", - "pkg-types": "^1.0.2", + "pkg-types": "^1.0.3", "scule": "^1.0.0", "semver": "^7.5.0", "ufo": "^1.1.1", diff --git a/packages/nuxt/package.json b/packages/nuxt/package.json index b613d3e947..6546d3a795 100644 --- a/packages/nuxt/package.json +++ b/packages/nuxt/package.json @@ -52,7 +52,7 @@ "prepack": "unbuild" }, "dependencies": { - "@nuxt/devalue": "^2.0.0", + "@nuxt/devalue": "^2.0.2", "@nuxt/kit": "workspace:../kit", "@nuxt/schema": "workspace:../schema", "@nuxt/telemetry": "^2.2.0", diff --git a/packages/schema/package.json b/packages/schema/package.json index 35bf81ce7c..e1ae365c05 100644 --- a/packages/schema/package.json +++ b/packages/schema/package.json @@ -40,7 +40,7 @@ "defu": "^6.1.2", "hookable": "^5.5.3", "pathe": "^1.1.0", - "pkg-types": "^1.0.2", + "pkg-types": "^1.0.3", "postcss-import-resolver": "^2.0.0", "std-env": "^3.3.2", "ufo": "^1.1.1", diff --git a/packages/vite/package.json b/packages/vite/package.json index dd027daae6..13162468e7 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -45,7 +45,7 @@ "ohash": "^1.1.2", "pathe": "^1.1.0", "perfect-debounce": "^0.1.3", - "pkg-types": "^1.0.2", + "pkg-types": "^1.0.3", "postcss": "^8.4.23", "postcss-import": "^15.1.0", "postcss-url": "^10.1.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1cb297cb47..adebfd9d45 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -124,8 +124,8 @@ importers: specifier: 3.2.47 version: 3.2.47 vue-eslint-parser: - specifier: ^9.1.1 - version: 9.1.1(eslint@8.39.0) + specifier: ^9.2.0 + version: 9.2.0(eslint@8.39.0) vue-tsc: specifier: ^1.6.3 version: 1.6.3(typescript@5.0.4) @@ -412,8 +412,8 @@ importers: specifier: ^1.1.0 version: 1.1.0 pkg-types: - specifier: ^1.0.2 - version: 1.0.2 + specifier: ^1.0.3 + version: 1.0.3 scule: specifier: ^1.0.0 version: 1.0.0 @@ -540,8 +540,8 @@ importers: specifier: ^0.1.3 version: 0.1.3 pkg-types: - specifier: ^1.0.2 - version: 1.0.2 + specifier: ^1.0.3 + version: 1.0.3 scule: specifier: ^1.0.0 version: 1.0.0 @@ -558,8 +558,8 @@ importers: packages/nuxt: dependencies: '@nuxt/devalue': - specifier: ^2.0.0 - version: 2.0.0 + specifier: ^2.0.2 + version: 2.0.2 '@nuxt/kit': specifier: workspace:* version: link:../kit @@ -742,8 +742,8 @@ importers: specifier: ^1.1.0 version: 1.1.0 pkg-types: - specifier: ^1.0.2 - version: 1.0.2 + specifier: ^1.0.3 + version: 1.0.3 postcss-import-resolver: specifier: ^2.0.0 version: 2.0.0 @@ -915,8 +915,8 @@ importers: specifier: ^0.1.3 version: 0.1.3 pkg-types: - specifier: ^1.0.2 - version: 1.0.2 + specifier: ^1.0.3 + version: 1.0.3 postcss: specifier: ^8.4.23 version: 8.4.23 @@ -2007,8 +2007,8 @@ packages: '@nodelib/fs.scandir': 2.1.5 fastq: 1.15.0 - /@nuxt/devalue@2.0.0: - resolution: {integrity: sha512-YBI/6o2EBz02tdEJRBK8xkt3zvOFOWlLBf7WKYGBsSYSRtjjgrqPe2skp6VLLmKx5WbHHDNcW+6oACaurxGzeA==} + /@nuxt/devalue@2.0.2: + resolution: {integrity: sha512-GBzP8zOc7CGWyFQS6dv1lQz8VVpz5C2yRszbXufwG/9zhStTIH50EtD87NmWbTMwXDvZLNg8GIpb1UFdH93JCA==} dev: false /@nuxt/friendly-errors-webpack-plugin@2.5.2(webpack@5.81.0): @@ -3846,7 +3846,7 @@ packages: ohash: 1.1.2 pathe: 1.1.0 perfect-debounce: 0.1.3 - pkg-types: 1.0.2 + pkg-types: 1.0.3 rc9: 2.1.0 transitivePeerDependencies: - supports-color @@ -3942,7 +3942,7 @@ packages: ofetch: 1.0.1 open: 9.1.0 pathe: 1.1.0 - pkg-types: 1.0.2 + pkg-types: 1.0.3 scule: 1.0.0 semver: 7.5.0 yaml: 2.2.1 @@ -5304,7 +5304,7 @@ packages: nth-check: 2.1.1 postcss-selector-parser: 6.0.11 semver: 7.5.0 - vue-eslint-parser: 9.1.1(eslint@8.39.0) + vue-eslint-parser: 9.2.0(eslint@8.39.0) xml-name-validator: 4.0.0 transitivePeerDependencies: - supports-color @@ -7152,7 +7152,7 @@ packages: dependencies: acorn: 8.8.2 pathe: 1.1.0 - pkg-types: 1.0.2 + pkg-types: 1.0.3 ufo: 1.1.1 /mri@1.2.0: @@ -7247,7 +7247,7 @@ packages: ohash: 1.1.2 pathe: 1.1.0 perfect-debounce: 0.1.3 - pkg-types: 1.0.2 + pkg-types: 1.0.3 pretty-bytes: 6.1.0 radix3: 1.0.1 rollup: 3.21.0 @@ -7670,8 +7670,8 @@ packages: engines: {node: '>= 6'} dev: true - /pkg-types@1.0.2: - resolution: {integrity: sha512-hM58GKXOcj8WTqUXnsQyJYXdeAPbythQgEF3nTcEo+nkD49chjQ9IKm/QJy9xf6JakXptz86h7ecP2024rrLaQ==} + /pkg-types@1.0.3: + resolution: {integrity: sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==} dependencies: jsonc-parser: 3.2.0 mlly: 1.2.0 @@ -9149,7 +9149,7 @@ packages: mlly: 1.2.0 mri: 1.2.0 pathe: 1.1.0 - pkg-types: 1.0.2 + pkg-types: 1.0.3 pretty-bytes: 6.1.0 rollup: 3.21.0 rollup-plugin-dts: 5.3.0(rollup@3.21.0)(typescript@5.0.4) @@ -9214,7 +9214,7 @@ packages: magic-string: 0.30.0 mlly: 1.2.0 pathe: 1.1.0 - pkg-types: 1.0.2 + pkg-types: 1.0.3 scule: 1.0.0 strip-literal: 1.0.1 unplugin: 1.3.1 @@ -9667,8 +9667,8 @@ packages: resolution: {integrity: sha512-RutnB7X8c5hjq39NceArgXg28WZtZpGc3+J16ljMiYnFhKvd8hITxSWQSQ5bvldxMDU6gG5mkxl1MTQLXckVSQ==} dev: false - /vue-eslint-parser@9.1.1(eslint@8.39.0): - resolution: {integrity: sha512-C2aI/r85Q6tYcz4dpgvrs4wH/MqVrRAVIdpYedrxnATDHHkb+TroeRcDpKWGZCx/OcECMWfz7tVwQ8e+Opy6rA==} + /vue-eslint-parser@9.2.0(eslint@8.39.0): + resolution: {integrity: sha512-aFXipsUbKU4TzgP9OU6cXIm2Nnp9ryKJc2mzY0s2xzwfjHg6WDT33LUAQRGR9K0NFncBgUEZ2njdrS3Lj/sOLw==} engines: {node: ^14.17.0 || >=16.0.0} peerDependencies: eslint: '>=6.0.0' From a81f9e4c821fa034e70ea2fdae322e9d223daf54 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 3 May 2023 09:51:00 +0100 Subject: [PATCH 23/25] ci: run 2.x nightly release on node 16 --- .github/workflows/nuxt2-edge.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nuxt2-edge.yml b/.github/workflows/nuxt2-edge.yml index a3f60fc55e..ac1e94a414 100644 --- a/.github/workflows/nuxt2-edge.yml +++ b/.github/workflows/nuxt2-edge.yml @@ -20,7 +20,7 @@ jobs: run: git fetch --depth=1 origin "+refs/tags/*:refs/tags/*" - uses: actions/setup-node@v3 with: - node-version: 14 + node-version: 16 registry-url: 'https://registry.npmjs.org' - name: install run: yarn --check-files --frozen-lockfile --non-interactive From da3357449f456632bb2f07893c5d24065b081f53 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Wed, 3 May 2023 11:02:07 +0100 Subject: [PATCH 24/25] feat(nuxt): add `nuxtApp.runWithContext` (#20608) --- packages/nuxt/src/app/components/nuxt-root.vue | 4 ++-- packages/nuxt/src/app/composables/component.ts | 8 ++++---- packages/nuxt/src/app/nuxt.ts | 7 +++++-- .../src/app/plugins/revive-payload.client.ts | 4 ++-- packages/nuxt/src/app/plugins/router.ts | 10 +++++----- .../nuxt/src/pages/runtime/plugins/router.ts | 18 +++++++++--------- packages/nuxt/src/pages/runtime/validate.ts | 4 ++-- test/bundle.test.ts | 4 ++-- test/fixtures/basic/types.ts | 6 +++++- 9 files changed, 36 insertions(+), 29 deletions(-) diff --git a/packages/nuxt/src/app/components/nuxt-root.vue b/packages/nuxt/src/app/components/nuxt-root.vue index b4c71f871b..7dbac43d2e 100644 --- a/packages/nuxt/src/app/components/nuxt-root.vue +++ b/packages/nuxt/src/app/components/nuxt-root.vue @@ -9,7 +9,7 @@ + + diff --git a/test/fixtures/minimal/app.vue b/test/fixtures/minimal/app.vue index b75ed9fa67..b112b78c63 100644 --- a/test/fixtures/minimal/app.vue +++ b/test/fixtures/minimal/app.vue @@ -1,6 +1,11 @@