From 06162220d3ad978e06b804bacaeb955882c4b80e Mon Sep 17 00:00:00 2001 From: 2heal1 Date: Fri, 3 Jan 2025 11:18:50 +0800 Subject: [PATCH 1/8] fix(rspack): support getPublicPath --- .changeset/shiny-geckos-switch.md | 5 + .../router-host-vue3-2100/rsbuild.config.ts | 2 - .../router-remote1-2001/rsbuild.config.ts | 7 - .../router-remote2-2002/rsbuild.config.ts | 22 -- .../router-remote3-2003/rsbuild.config.ts | 8 - .../router-remote4-2004/rsbuild.config.ts | 26 +- packages/data-prefetch/tsconfig.json | 1 - packages/rspack/package.json | 2 + packages/rspack/src/ModuleFederationPlugin.ts | 8 + packages/rspack/src/RemoteEntryPlugin.ts | 27 ++ packages/rspack/tsconfig.json | 1 - .../project.json | 3 - .../tsconfig.json | 1 - pnpm-lock.yaml | 327 ++++++++++-------- 14 files changed, 220 insertions(+), 220 deletions(-) create mode 100644 .changeset/shiny-geckos-switch.md create mode 100644 packages/rspack/src/RemoteEntryPlugin.ts diff --git a/.changeset/shiny-geckos-switch.md b/.changeset/shiny-geckos-switch.md new file mode 100644 index 00000000000..60870b263e6 --- /dev/null +++ b/.changeset/shiny-geckos-switch.md @@ -0,0 +1,5 @@ +--- +'@module-federation/rspack': patch +--- + +fix(rspack): support getPublicPath diff --git a/apps/router-demo/router-host-vue3-2100/rsbuild.config.ts b/apps/router-demo/router-host-vue3-2100/rsbuild.config.ts index c2247d2c6b5..956b8604d5e 100644 --- a/apps/router-demo/router-host-vue3-2100/rsbuild.config.ts +++ b/apps/router-demo/router-host-vue3-2100/rsbuild.config.ts @@ -15,8 +15,6 @@ export default defineConfig({ port: 2100, }, dev: { - // It is necessary to configure assetPrefix, and in the production environment, you need to configure output.assetPrefix - assetPrefix: 'http://localhost:2100', writeToDisk: true, }, plugins: [ diff --git a/apps/router-demo/router-remote1-2001/rsbuild.config.ts b/apps/router-demo/router-remote1-2001/rsbuild.config.ts index 8d7ac525d59..2f010576f7e 100644 --- a/apps/router-demo/router-remote1-2001/rsbuild.config.ts +++ b/apps/router-demo/router-remote1-2001/rsbuild.config.ts @@ -20,15 +20,8 @@ export default defineConfig({ port: 2001, }, dev: { - // It is necessary to configure assetPrefix, and in the production environment, you need to configure output.assetPrefix - assetPrefix: 'http://localhost:2001', writeToDisk: true, }, - tools: { - rspack: (config, { appendPlugins }) => { - delete config.optimization?.splitChunks; - }, - }, plugins: [ pluginReact(), pluginModuleFederation({ diff --git a/apps/router-demo/router-remote2-2002/rsbuild.config.ts b/apps/router-demo/router-remote2-2002/rsbuild.config.ts index 7b35db967fd..3a3901f5423 100644 --- a/apps/router-demo/router-remote2-2002/rsbuild.config.ts +++ b/apps/router-demo/router-remote2-2002/rsbuild.config.ts @@ -17,28 +17,6 @@ export default defineConfig({ server: { port: 2002, }, - dev: { - // It is necessary to configure assetPrefix, and in the production environment, you need to configure output.assetPrefix - assetPrefix: 'http://localhost:2002', - }, - tools: { - // cssExtract: { - // pluginOptions: { - // insert(element) { - // console.log('element22222233333333333333',document.querySelector("#remote2-style-component")); - // document.querySelector("#remote2-style-component")?.appendChild(element); - // }, - // } - // }, - // styleLoader: { - // insert: (element)=> { - // debugger - // const styleContainer = document.querySelector(".remote2_export-app") || document.head; - // styleContainer.appendChild(element); - // console.log('styleContainer', styleContainer) - // }, - // }, - }, plugins: [ pluginReact(), pluginModuleFederation({ diff --git a/apps/router-demo/router-remote3-2003/rsbuild.config.ts b/apps/router-demo/router-remote3-2003/rsbuild.config.ts index 49430a9d0ac..19e3da710d1 100644 --- a/apps/router-demo/router-remote3-2003/rsbuild.config.ts +++ b/apps/router-demo/router-remote3-2003/rsbuild.config.ts @@ -13,16 +13,8 @@ export default defineConfig({ port: 2003, }, dev: { - // It is necessary to configure assetPrefix, and in the production environment, you need to configure output.assetPrefix - assetPrefix: 'http://localhost:2003', writeToDisk: true, }, - tools: { - rspack: (config, { appendPlugins }) => { - delete config.optimization?.splitChunks; - }, - }, - plugins: [ pluginVue(), pluginModuleFederation({ diff --git a/apps/router-demo/router-remote4-2004/rsbuild.config.ts b/apps/router-demo/router-remote4-2004/rsbuild.config.ts index 3af7ef6c96d..006bd5ef799 100644 --- a/apps/router-demo/router-remote4-2004/rsbuild.config.ts +++ b/apps/router-demo/router-remote4-2004/rsbuild.config.ts @@ -17,31 +17,6 @@ export default defineConfig({ server: { port: 2004, }, - dev: { - // It is necessary to configure assetPrefix, and in the production environment, you need to configure output.assetPrefix - assetPrefix: 'http://localhost:2004', - }, - tools: { - rspack: (config, { appendPlugins }) => { - delete config.optimization?.splitChunks; - }, - // cssExtract: { - // pluginOptions: { - // insert(element) { - // console.log('element22222233333333333333',document.querySelector("#remote2-style-component")); - // document.querySelector("#remote2-style-component")?.appendChild(element); - // }, - // } - // }, - // styleLoader: { - // insert: (element)=> { - // debugger - // const styleContainer = document.querySelector(".remote2_export-app") || document.head; - // styleContainer.appendChild(element); - // console.log('styleContainer', styleContainer) - // }, - // }, - }, plugins: [ pluginReact(), pluginModuleFederation({ @@ -50,6 +25,7 @@ export default defineConfig({ './export-app': './src/export-App.tsx', }, shared: ['react', 'react-dom'], + getPublicPath: `return 'http://localhost:2004/'`, }), ], }); diff --git a/packages/data-prefetch/tsconfig.json b/packages/data-prefetch/tsconfig.json index fcf1b213e09..c047eec85c8 100644 --- a/packages/data-prefetch/tsconfig.json +++ b/packages/data-prefetch/tsconfig.json @@ -9,7 +9,6 @@ "skipLibCheck": true, "moduleResolution": "node", "allowJs": false, - "strict": true, "types": ["jest", "node"], "experimentalDecorators": true, "resolveJsonModule": true, diff --git a/packages/rspack/package.json b/packages/rspack/package.json index 7adab5899cd..2b4ce19549c 100644 --- a/packages/rspack/package.json +++ b/packages/rspack/package.json @@ -24,6 +24,7 @@ "module": "./dist/index.esm.mjs", "types": "./dist/index.cjs.d.ts", "dependencies": { + "btoa": "1.2.1", "@module-federation/bridge-react-webpack-plugin": "workspace:*", "@module-federation/dts-plugin": "workspace:*", "@module-federation/managers": "workspace:*", @@ -33,6 +34,7 @@ "@module-federation/sdk": "workspace:*" }, "devDependencies": { + "@types/btoa": "1.2.5", "@rspack/core": "^1.0.2" }, "exports": { diff --git a/packages/rspack/src/ModuleFederationPlugin.ts b/packages/rspack/src/ModuleFederationPlugin.ts index 5142f895661..6aa2f0ffd48 100644 --- a/packages/rspack/src/ModuleFederationPlugin.ts +++ b/packages/rspack/src/ModuleFederationPlugin.ts @@ -13,6 +13,7 @@ import { DtsPlugin } from '@module-federation/dts-plugin'; import ReactBridgePlugin from '@module-federation/bridge-react-webpack-plugin'; import path from 'node:path'; import fs from 'node:fs'; +import { RemoteEntryPlugin } from './RemoteEntryPlugin'; type ExcludeFalse = T extends undefined | false ? never : T; type SplitChunks = Compiler['options']['optimization']['splitChunks']; @@ -75,6 +76,13 @@ export class ModuleFederationPlugin implements RspackPluginInstance { this._patchChunkSplit(compiler, options.name); } + // must before ModuleFederationPlugin + if (options.getPublicPath && options.name) { + new RemoteEntryPlugin(options.name, options.getPublicPath).apply( + compiler, + ); + } + if (options.experiments?.provideExternalRuntime) { if (options.exposes) { throw new Error( diff --git a/packages/rspack/src/RemoteEntryPlugin.ts b/packages/rspack/src/RemoteEntryPlugin.ts new file mode 100644 index 00000000000..67133f302a3 --- /dev/null +++ b/packages/rspack/src/RemoteEntryPlugin.ts @@ -0,0 +1,27 @@ +import type { Compiler, RspackPluginInstance } from '@rspack/core'; +import pBtoa from 'btoa'; + +export class RemoteEntryPlugin implements RspackPluginInstance { + readonly name = 'VmokRemoteEntryPlugin'; + private _name: string; + private _getPublicPath: string; + + constructor(name: string, getPublicPath: string) { + this._name = name; + this._getPublicPath = getPublicPath; + } + + apply(compiler: Compiler): void { + const code = `${ + compiler.webpack.RuntimeGlobals.publicPath + } = new Function(${JSON.stringify(this._getPublicPath)})()`; + const base64Code = pBtoa(code); + const dataUrl = `data:text/javascript;base64,${base64Code}`; + + compiler.hooks.afterPlugins.tap('VmokRemoteEntryPlugin', () => { + new compiler.webpack.EntryPlugin(compiler.context, dataUrl, { + name: this._name, + }).apply(compiler); + }); + } +} diff --git a/packages/rspack/tsconfig.json b/packages/rspack/tsconfig.json index 77578113c20..6aa567f44f4 100644 --- a/packages/rspack/tsconfig.json +++ b/packages/rspack/tsconfig.json @@ -3,7 +3,6 @@ "compilerOptions": { "module": "commonjs", "forceConsistentCasingInFileNames": true, - "strict": true, "noImplicitOverride": true, "noPropertyAccessFromIndexSignature": true, "noImplicitReturns": true, diff --git a/packages/runtime-plugins/inject-external-runtime-core-plugin/project.json b/packages/runtime-plugins/inject-external-runtime-core-plugin/project.json index ea89cf66db3..d8ebac08321 100644 --- a/packages/runtime-plugins/inject-external-runtime-core-plugin/project.json +++ b/packages/runtime-plugins/inject-external-runtime-core-plugin/project.json @@ -14,9 +14,6 @@ "tsConfig": "packages/runtime-plugins/inject-external-runtime-core-plugin/tsconfig.lib.json", "assets": [], "project": "packages/runtime-plugins/inject-external-runtime-core-plugin/package.json", - "additionalEntryPoints": [ - "packages/runtime-plugins/inject-external-runtime-core-plugin/src/normalize-webpack-path.ts" - ], "rollupConfig": "packages/runtime-plugins/inject-external-runtime-core-plugin/rollup.config.js", "compiler": "swc", "generatePackageJson": false, diff --git a/packages/runtime-plugins/inject-external-runtime-core-plugin/tsconfig.json b/packages/runtime-plugins/inject-external-runtime-core-plugin/tsconfig.json index bb69d249599..c45d1f4d3b0 100644 --- a/packages/runtime-plugins/inject-external-runtime-core-plugin/tsconfig.json +++ b/packages/runtime-plugins/inject-external-runtime-core-plugin/tsconfig.json @@ -3,7 +3,6 @@ "compilerOptions": { "module": "commonjs", "forceConsistentCasingInFileNames": true, - "strict": true, "noImplicitOverride": true, "noPropertyAccessFromIndexSignature": true, "noImplicitReturns": true, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index faa01cc23b7..8dc0c44af21 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2541,6 +2541,9 @@ importers: '@module-federation/sdk': specifier: workspace:* version: link:../sdk + btoa: + specifier: 1.2.1 + version: 1.2.1 typescript: specifier: ^4.9.0 || ^5.0.0 version: 5.5.2 @@ -2551,6 +2554,9 @@ importers: '@rspack/core': specifier: ^1.0.2 version: 1.0.8(@swc/helpers@0.5.13) + '@types/btoa': + specifier: 1.2.5 + version: 1.2.5 packages/runtime: dependencies: @@ -2969,10 +2975,10 @@ packages: '@babel/helpers': 7.26.0 '@babel/parser': 7.26.2 '@babel/template': 7.25.9 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 '@babel/types': 7.26.0 convert-source-map: 1.9.0 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) gensync: 1.0.0-beta.2 json5: 2.2.3 lodash: 4.17.21 @@ -2998,7 +3004,7 @@ packages: '@babel/traverse': 7.25.7 '@babel/types': 7.25.7 convert-source-map: 2.0.0 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -3017,10 +3023,10 @@ packages: '@babel/helpers': 7.26.0 '@babel/parser': 7.26.2 '@babel/template': 7.25.9 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 '@babel/types': 7.26.0 convert-source-map: 2.0.0 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -3040,10 +3046,10 @@ packages: '@babel/helpers': 7.26.0 '@babel/parser': 7.26.2 '@babel/template': 7.25.9 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 '@babel/types': 7.26.0 convert-source-map: 2.0.0 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -3063,10 +3069,10 @@ packages: '@babel/helpers': 7.26.0 '@babel/parser': 7.26.2 '@babel/template': 7.25.9 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 '@babel/types': 7.26.0 convert-source-map: 2.0.0 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -3154,7 +3160,7 @@ packages: resolution: {integrity: sha512-C47lC7LIDCnz0h4vai/tpNOI95tCd5ZT3iBt/DBH5lXKHZsyNQv18yf1wIIg2ntiQNgmAvA+DgZ82iW8Qdym8g==} engines: {node: '>=6.9.0'} dependencies: - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color @@ -3191,7 +3197,7 @@ packages: '@babel/helper-optimise-call-expression': 7.25.7 '@babel/helper-replace-supers': 7.25.7(@babel/core@7.25.2) '@babel/helper-skip-transparent-expression-wrappers': 7.25.7 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 semver: 6.3.1 transitivePeerDependencies: - supports-color @@ -3209,7 +3215,7 @@ packages: '@babel/helper-optimise-call-expression': 7.25.7 '@babel/helper-replace-supers': 7.25.7(@babel/core@7.25.7) '@babel/helper-skip-transparent-expression-wrappers': 7.25.7 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 semver: 6.3.1 transitivePeerDependencies: - supports-color @@ -3227,7 +3233,7 @@ packages: '@babel/helper-optimise-call-expression': 7.25.7 '@babel/helper-replace-supers': 7.25.7(@babel/core@7.26.0) '@babel/helper-skip-transparent-expression-wrappers': 7.25.7 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 semver: 6.3.1 transitivePeerDependencies: - supports-color @@ -3244,7 +3250,7 @@ packages: '@babel/helper-optimise-call-expression': 7.25.9 '@babel/helper-replace-supers': 7.25.9(@babel/core@7.25.7) '@babel/helper-skip-transparent-expression-wrappers': 7.25.9 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 semver: 6.3.1 transitivePeerDependencies: - supports-color @@ -3262,7 +3268,7 @@ packages: '@babel/helper-optimise-call-expression': 7.25.9 '@babel/helper-replace-supers': 7.25.9(@babel/core@7.26.0) '@babel/helper-skip-transparent-expression-wrappers': 7.25.9 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 semver: 6.3.1 transitivePeerDependencies: - supports-color @@ -3321,7 +3327,7 @@ packages: '@babel/core': 7.25.7 '@babel/helper-compilation-targets': 7.25.9 '@babel/helper-plugin-utils': 7.25.9 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) lodash.debounce: 4.0.8 resolve: 1.22.8 transitivePeerDependencies: @@ -3336,7 +3342,7 @@ packages: '@babel/core': 7.26.0 '@babel/helper-compilation-targets': 7.25.9 '@babel/helper-plugin-utils': 7.25.9 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) lodash.debounce: 4.0.8 resolve: 1.22.8 transitivePeerDependencies: @@ -3346,7 +3352,7 @@ packages: resolution: {integrity: sha512-O31Ssjd5K6lPbTX9AAYpSKrZmLeagt9uwschJd+Ixo6QiRyfpvgtVQp8qrDR9UNFjZ8+DO34ZkdrN+BnPXemeA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color @@ -3355,7 +3361,7 @@ packages: resolution: {integrity: sha512-wbfdZ9w5vk0C0oyHqAJbc62+vet5prjj01jjJ8sKn3j9h3MQQlflEdXYvuqRWjHnM12coDEqiC1IRCi0U/EKwQ==} engines: {node: '>=6.9.0'} dependencies: - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color @@ -3364,7 +3370,16 @@ packages: resolution: {integrity: sha512-o0xCgpNmRohmnoWKQ0Ij8IdddjyBFE4T2kagL/x6M3+4zUgc+4qTOUBoNe4XxDskt1HPKO007ZPiMgLDq2s7Kw==} engines: {node: '>=6.9.0'} dependencies: - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 + '@babel/types': 7.26.0 + transitivePeerDependencies: + - supports-color + + /@babel/helper-module-imports@7.25.9: + resolution: {integrity: sha512-tnUA4RsrmflIM6W6RFTLFSXITtl0wKjgpnLgXyowocVPrbYrLUXSBXDgTs8BlbmIzIdlBySRQjINYs2BAkiLtw==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/traverse': 7.25.9 '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color @@ -3388,7 +3403,7 @@ packages: '@babel/helper-module-imports': 7.25.7 '@babel/helper-simple-access': 7.24.7 '@babel/helper-validator-identifier': 7.24.7 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color @@ -3399,9 +3414,9 @@ packages: '@babel/core': ^7.0.0 dependencies: '@babel/core': 7.12.9 - '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) + '@babel/helper-module-imports': 7.25.9 '@babel/helper-validator-identifier': 7.25.9 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color dev: true @@ -3413,9 +3428,9 @@ packages: '@babel/core': ^7.0.0 dependencies: '@babel/core': 7.25.7 - '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) + '@babel/helper-module-imports': 7.25.9 '@babel/helper-validator-identifier': 7.25.9 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color dev: true @@ -3427,9 +3442,9 @@ packages: '@babel/core': ^7.0.0 dependencies: '@babel/core': 7.25.8 - '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) + '@babel/helper-module-imports': 7.25.9 '@babel/helper-validator-identifier': 7.25.9 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color dev: true @@ -3441,9 +3456,9 @@ packages: '@babel/core': ^7.0.0 dependencies: '@babel/core': 7.26.0 - '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) + '@babel/helper-module-imports': 7.25.9 '@babel/helper-validator-identifier': 7.25.9 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color @@ -3476,7 +3491,7 @@ packages: '@babel/core': 7.25.7 '@babel/helper-annotate-as-pure': 7.25.9 '@babel/helper-wrap-function': 7.25.9 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color dev: true @@ -3490,7 +3505,7 @@ packages: '@babel/core': 7.26.0 '@babel/helper-annotate-as-pure': 7.25.9 '@babel/helper-wrap-function': 7.25.9 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color @@ -3503,7 +3518,7 @@ packages: '@babel/core': 7.25.2 '@babel/helper-member-expression-to-functions': 7.25.7 '@babel/helper-optimise-call-expression': 7.25.7 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color dev: true @@ -3517,7 +3532,7 @@ packages: '@babel/core': 7.25.7 '@babel/helper-member-expression-to-functions': 7.25.7 '@babel/helper-optimise-call-expression': 7.25.7 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color dev: true @@ -3531,7 +3546,7 @@ packages: '@babel/core': 7.26.0 '@babel/helper-member-expression-to-functions': 7.25.7 '@babel/helper-optimise-call-expression': 7.25.7 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color @@ -3544,7 +3559,7 @@ packages: '@babel/core': 7.25.7 '@babel/helper-member-expression-to-functions': 7.25.9 '@babel/helper-optimise-call-expression': 7.25.9 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color dev: true @@ -3558,7 +3573,7 @@ packages: '@babel/core': 7.26.0 '@babel/helper-member-expression-to-functions': 7.25.9 '@babel/helper-optimise-call-expression': 7.25.9 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color @@ -3566,7 +3581,7 @@ packages: resolution: {integrity: sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg==} engines: {node: '>=6.9.0'} dependencies: - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color @@ -3575,7 +3590,7 @@ packages: resolution: {integrity: sha512-FPGAkJmyoChQeM+ruBGIDyrT2tKfZJO8NcxdC+CWNJi7N8/rZpSxK7yvBJ5O/nF1gfu5KzN7VKG3YVSLFfRSxQ==} engines: {node: '>=6.9.0'} dependencies: - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color @@ -3585,7 +3600,7 @@ packages: resolution: {integrity: sha512-c6WHXuiaRsJTyHYLJV75t9IqsmTbItYfdj99PnzYGQZkYKvan5/2jKJ7gu31J3/BJ/A18grImSPModuyG/Eo0Q==} engines: {node: '>=6.9.0'} dependencies: - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color @@ -3594,7 +3609,7 @@ packages: resolution: {integrity: sha512-pPbNbchZBkPMD50K0p3JGcFMNLVUCuU/ABybm/PGNj4JiHrpmNyqqCphBk4i19xXtNV0JhldQJJtbSW5aUvbyA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color @@ -3603,7 +3618,7 @@ packages: resolution: {integrity: sha512-K4Du3BFa3gvyhzgPcntrkDgZzQaq6uozzcpGbOO1OEJaI+EJdqWIMTLgFgQf6lrfiDFo5FU+BxKepI9RmZqahA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color @@ -3641,7 +3656,7 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/template': 7.25.9 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color @@ -3708,7 +3723,7 @@ packages: dependencies: '@babel/core': 7.25.7 '@babel/helper-plugin-utils': 7.25.9 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color dev: true @@ -3721,7 +3736,7 @@ packages: dependencies: '@babel/core': 7.26.0 '@babel/helper-plugin-utils': 7.25.9 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color @@ -3798,7 +3813,7 @@ packages: dependencies: '@babel/core': 7.25.7 '@babel/helper-plugin-utils': 7.25.9 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color dev: true @@ -3811,7 +3826,7 @@ packages: dependencies: '@babel/core': 7.26.0 '@babel/helper-plugin-utils': 7.25.9 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color @@ -4547,7 +4562,7 @@ packages: '@babel/core': 7.25.7 '@babel/helper-plugin-utils': 7.25.9 '@babel/helper-remap-async-to-generator': 7.25.9(@babel/core@7.25.7) - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color dev: true @@ -4561,7 +4576,7 @@ packages: '@babel/core': 7.26.0 '@babel/helper-plugin-utils': 7.25.9 '@babel/helper-remap-async-to-generator': 7.25.9(@babel/core@7.26.0) - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color @@ -4572,7 +4587,7 @@ packages: '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.25.7 - '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) + '@babel/helper-module-imports': 7.25.9 '@babel/helper-plugin-utils': 7.25.9 '@babel/helper-remap-async-to-generator': 7.25.9(@babel/core@7.25.7) transitivePeerDependencies: @@ -4586,7 +4601,7 @@ packages: '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.26.0 - '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) + '@babel/helper-module-imports': 7.25.9 '@babel/helper-plugin-utils': 7.25.9 '@babel/helper-remap-async-to-generator': 7.25.9(@babel/core@7.26.0) transitivePeerDependencies: @@ -4704,7 +4719,7 @@ packages: '@babel/helper-compilation-targets': 7.25.9 '@babel/helper-plugin-utils': 7.25.9 '@babel/helper-replace-supers': 7.25.9(@babel/core@7.25.7) - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -4721,7 +4736,7 @@ packages: '@babel/helper-compilation-targets': 7.25.9 '@babel/helper-plugin-utils': 7.25.9 '@babel/helper-replace-supers': 7.25.9(@babel/core@7.26.0) - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -4946,7 +4961,7 @@ packages: '@babel/core': 7.25.7 '@babel/helper-compilation-targets': 7.25.9 '@babel/helper-plugin-utils': 7.25.9 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color dev: true @@ -4960,7 +4975,7 @@ packages: '@babel/core': 7.26.0 '@babel/helper-compilation-targets': 7.25.9 '@babel/helper-plugin-utils': 7.25.9 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color @@ -5116,7 +5131,7 @@ packages: '@babel/helper-module-transforms': 7.26.0(@babel/core@7.25.7) '@babel/helper-plugin-utils': 7.25.9 '@babel/helper-validator-identifier': 7.25.9 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color dev: true @@ -5131,7 +5146,7 @@ packages: '@babel/helper-module-transforms': 7.26.0(@babel/core@7.26.0) '@babel/helper-plugin-utils': 7.25.9 '@babel/helper-validator-identifier': 7.25.9 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color @@ -5623,7 +5638,7 @@ packages: dependencies: '@babel/core': 7.25.2 '@babel/helper-annotate-as-pure': 7.25.9 - '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) + '@babel/helper-module-imports': 7.25.9 '@babel/helper-plugin-utils': 7.25.9 '@babel/plugin-syntax-jsx': 7.25.9(@babel/core@7.25.2) '@babel/types': 7.26.0 @@ -5639,7 +5654,7 @@ packages: dependencies: '@babel/core': 7.25.7 '@babel/helper-annotate-as-pure': 7.25.9 - '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) + '@babel/helper-module-imports': 7.25.9 '@babel/helper-plugin-utils': 7.25.9 '@babel/plugin-syntax-jsx': 7.25.9(@babel/core@7.25.7) '@babel/types': 7.26.0 @@ -5655,7 +5670,7 @@ packages: dependencies: '@babel/core': 7.25.8 '@babel/helper-annotate-as-pure': 7.25.9 - '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) + '@babel/helper-module-imports': 7.25.9 '@babel/helper-plugin-utils': 7.25.9 '@babel/plugin-syntax-jsx': 7.25.9(@babel/core@7.25.8) '@babel/types': 7.26.0 @@ -5671,7 +5686,7 @@ packages: dependencies: '@babel/core': 7.26.0 '@babel/helper-annotate-as-pure': 7.25.9 - '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) + '@babel/helper-module-imports': 7.25.9 '@babel/helper-plugin-utils': 7.25.9 '@babel/plugin-syntax-jsx': 7.25.9(@babel/core@7.26.0) '@babel/types': 7.26.0 @@ -5789,7 +5804,7 @@ packages: '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.25.7 - '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) + '@babel/helper-module-imports': 7.25.9 '@babel/helper-plugin-utils': 7.25.9 babel-plugin-polyfill-corejs2: 0.4.11(@babel/core@7.25.7) babel-plugin-polyfill-corejs3: 0.10.6(@babel/core@7.25.7) @@ -5806,7 +5821,7 @@ packages: '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.26.0 - '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) + '@babel/helper-module-imports': 7.25.9 '@babel/helper-plugin-utils': 7.25.9 babel-plugin-polyfill-corejs2: 0.4.11(@babel/core@7.26.0) babel-plugin-polyfill-corejs3: 0.10.6(@babel/core@7.26.0) @@ -6400,7 +6415,21 @@ packages: '@babel/parser': 7.26.2 '@babel/template': 7.25.9 '@babel/types': 7.26.0 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) + globals: 11.12.0 + transitivePeerDependencies: + - supports-color + + /@babel/traverse@7.25.9: + resolution: {integrity: sha512-ZCuvfwOwlz/bawvAuvcj8rrithP2/N55Tzz342AkTvq4qaWbGfmCk/tKhNaV2cthijKrPAA8SRJV5WWe7IBMJw==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/code-frame': 7.26.2 + '@babel/generator': 7.26.2 + '@babel/parser': 7.26.2 + '@babel/template': 7.25.9 + '@babel/types': 7.26.0 + debug: 4.3.7(supports-color@9.3.1) globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -7043,7 +7072,7 @@ packages: /@emotion/babel-plugin@11.12.0: resolution: {integrity: sha512-y2WQb+oP8Jqvvclh8Q55gLUyb7UFvgv7eJfsj7td5TToBrIUtPay2kMrZi4xjq9qw2vD0ZR5fSho0yqoFgX7Rw==} dependencies: - '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) + '@babel/helper-module-imports': 7.25.9 '@babel/runtime': 7.26.0 '@emotion/hash': 0.9.2 '@emotion/memoize': 0.9.0 @@ -8589,7 +8618,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) espree: 9.6.1 globals: 13.24.0 ignore: 5.3.2 @@ -8665,7 +8694,7 @@ packages: deprecated: Use @eslint/config-array instead dependencies: '@humanwhocodes/object-schema': 2.0.3 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -11713,7 +11742,7 @@ packages: '@open-draft/until': 1.0.3 '@types/debug': 4.1.12 '@xmldom/xmldom': 0.8.10 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) headers-polyfill: 3.2.5 outvariant: 1.4.3 strict-event-emitter: 0.2.8 @@ -14762,7 +14791,7 @@ packages: optional: true dependencies: '@babel/core': 7.25.2 - '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) + '@babel/helper-module-imports': 7.25.9 '@rollup/pluginutils': 5.1.3(rollup@4.24.0) rollup: 4.24.0 transitivePeerDependencies: @@ -17062,7 +17091,7 @@ packages: conventional-changelog-writer: 8.0.0 conventional-commits-filter: 5.0.0 conventional-commits-parser: 6.0.0 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) import-from-esm: 1.3.4 lodash-es: 4.17.21 micromatch: 4.0.8 @@ -17089,7 +17118,7 @@ packages: dependencies: '@semantic-release/error': 3.0.0 aggregate-error: 3.1.0 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) execa: 5.1.1 lodash: 4.17.21 parse-json: 5.2.0 @@ -17106,7 +17135,7 @@ packages: dependencies: '@semantic-release/error': 3.0.0 aggregate-error: 3.1.0 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) dir-glob: 3.0.1 execa: 5.1.1 lodash: 4.17.21 @@ -17129,7 +17158,7 @@ packages: '@octokit/plugin-throttling': 9.3.1(@octokit/core@6.1.2) '@semantic-release/error': 4.0.0 aggregate-error: 5.0.0 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) dir-glob: 3.0.1 globby: 14.0.2 http-proxy-agent: 7.0.2 @@ -17198,7 +17227,7 @@ packages: conventional-changelog-writer: 8.0.0 conventional-commits-filter: 5.0.0 conventional-commits-parser: 6.0.0 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) get-stream: 7.0.1 import-from-esm: 1.3.4 into-stream: 7.0.0 @@ -18137,7 +18166,7 @@ packages: dependencies: '@babel/generator': 7.26.2 '@babel/parser': 7.26.2 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 '@babel/types': 7.26.0 '@storybook/csf': 0.1.11 '@storybook/types': 7.6.20 @@ -18153,7 +18182,7 @@ packages: dependencies: '@babel/generator': 7.26.2 '@babel/parser': 7.26.2 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 '@babel/types': 7.26.0 '@storybook/csf': 0.1.11 '@storybook/types': 8.1.11 @@ -18432,7 +18461,7 @@ packages: typescript: '>= 3.x' webpack: '>= 4' dependencies: - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) endent: 2.1.0 find-cache-dir: 3.3.2 flat-cache: 3.2.0 @@ -18451,7 +18480,7 @@ packages: typescript: '>= 4.x' webpack: '>= 4' dependencies: - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) endent: 2.1.0 find-cache-dir: 3.3.2 flat-cache: 3.2.0 @@ -18470,7 +18499,7 @@ packages: typescript: '>= 4.x' webpack: '>= 4' dependencies: - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) endent: 2.1.0 find-cache-dir: 3.3.2 flat-cache: 3.2.0 @@ -18948,7 +18977,7 @@ packages: '@swc-node/sourcemap-support': 0.5.1 '@swc/core': 1.7.26(@swc/helpers@0.5.13) colorette: 2.0.20 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) oxc-resolver: 1.12.0 pirates: 4.0.6 tslib: 2.6.3 @@ -20191,7 +20220,7 @@ packages: '@typescript-eslint/scope-manager': 5.62.0 '@typescript-eslint/type-utils': 5.62.0(eslint@8.57.1)(typescript@5.0.4) '@typescript-eslint/utils': 5.62.0(eslint@8.57.1)(typescript@5.0.4) - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) eslint: 8.57.1 graphemer: 1.4.0 ignore: 5.3.2 @@ -20243,7 +20272,7 @@ packages: '@typescript-eslint/scope-manager': 5.62.0 '@typescript-eslint/types': 5.62.0 '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.0.4) - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) eslint: 8.57.1 typescript: 5.0.4 transitivePeerDependencies: @@ -20264,7 +20293,7 @@ packages: '@typescript-eslint/types': 6.21.0 '@typescript-eslint/typescript-estree': 6.21.0(typescript@5.5.2) '@typescript-eslint/visitor-keys': 6.21.0 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) eslint: 8.57.1 typescript: 5.5.2 transitivePeerDependencies: @@ -20285,7 +20314,7 @@ packages: '@typescript-eslint/types': 7.18.0 '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.5.2) '@typescript-eslint/visitor-keys': 7.18.0 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) eslint: 8.57.1 typescript: 5.5.2 transitivePeerDependencies: @@ -20344,7 +20373,7 @@ packages: dependencies: '@typescript-eslint/typescript-estree': 5.62.0(typescript@5.0.4) '@typescript-eslint/utils': 5.62.0(eslint@8.57.1)(typescript@5.0.4) - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) eslint: 8.57.1 tsutils: 3.21.0(typescript@5.0.4) typescript: 5.0.4 @@ -20364,7 +20393,7 @@ packages: dependencies: '@typescript-eslint/typescript-estree': 7.18.0(typescript@5.5.2) '@typescript-eslint/utils': 7.18.0(eslint@8.57.1)(typescript@5.5.2) - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) eslint: 8.57.1 ts-api-utils: 1.3.0(typescript@5.5.2) typescript: 5.5.2 @@ -20383,7 +20412,7 @@ packages: dependencies: '@typescript-eslint/typescript-estree': 8.8.0(typescript@5.5.2) '@typescript-eslint/utils': 8.8.0(eslint@8.57.1)(typescript@5.5.2) - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) ts-api-utils: 1.3.0(typescript@5.5.2) typescript: 5.5.2 transitivePeerDependencies: @@ -20427,7 +20456,7 @@ packages: dependencies: '@typescript-eslint/types': 5.62.0 '@typescript-eslint/visitor-keys': 5.62.0 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) globby: 11.1.0 is-glob: 4.0.3 semver: 7.6.3 @@ -20448,7 +20477,7 @@ packages: dependencies: '@typescript-eslint/types': 6.21.0 '@typescript-eslint/visitor-keys': 6.21.0 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.3 @@ -20470,7 +20499,7 @@ packages: dependencies: '@typescript-eslint/types': 7.18.0 '@typescript-eslint/visitor-keys': 7.18.0 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.5 @@ -20492,7 +20521,7 @@ packages: dependencies: '@typescript-eslint/types': 8.14.0 '@typescript-eslint/visitor-keys': 8.14.0 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) fast-glob: 3.3.2 is-glob: 4.0.3 minimatch: 9.0.5 @@ -20514,7 +20543,7 @@ packages: dependencies: '@typescript-eslint/types': 8.8.0 '@typescript-eslint/visitor-keys': 8.8.0 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) fast-glob: 3.3.2 is-glob: 4.0.3 minimatch: 9.0.5 @@ -20864,7 +20893,7 @@ packages: peerDependencies: vitest: 1.6.0 dependencies: - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) istanbul-lib-coverage: 3.2.2 istanbul-lib-instrument: 6.0.3 istanbul-lib-report: 3.0.1 @@ -20885,7 +20914,7 @@ packages: dependencies: '@ampproject/remapping': 2.3.0 '@bcoe/v8-coverage': 0.2.3 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) istanbul-lib-coverage: 3.2.2 istanbul-lib-report: 3.0.1 istanbul-lib-source-maps: 5.0.6 @@ -21079,11 +21108,11 @@ packages: optional: true dependencies: '@babel/core': 7.25.2 - '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) + '@babel/helper-module-imports': 7.25.9 '@babel/helper-plugin-utils': 7.25.9 '@babel/plugin-syntax-jsx': 7.25.7(@babel/core@7.25.2) '@babel/template': 7.25.9 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 '@babel/types': 7.26.0 '@vue/babel-helper-vue-transform-on': 1.2.5 '@vue/babel-plugin-resolve-type': 1.2.5(@babel/core@7.25.2) @@ -21100,7 +21129,7 @@ packages: dependencies: '@babel/code-frame': 7.26.2 '@babel/core': 7.25.2 - '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) + '@babel/helper-module-imports': 7.25.9 '@babel/helper-plugin-utils': 7.25.9 '@babel/parser': 7.26.2 '@vue/compiler-sfc': 3.5.10 @@ -21647,7 +21676,7 @@ packages: resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} engines: {node: '>= 6.0.0'} dependencies: - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) transitivePeerDependencies: - supports-color @@ -21655,7 +21684,7 @@ packages: resolution: {integrity: sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==} engines: {node: '>= 14'} dependencies: - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) transitivePeerDependencies: - supports-color dev: true @@ -22537,7 +22566,7 @@ packages: '@babel/core': 7.26.0 '@babel/helper-plugin-utils': 7.25.9 '@babel/plugin-syntax-typescript': 7.25.9(@babel/core@7.26.0) - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 transitivePeerDependencies: - supports-color @@ -22556,7 +22585,7 @@ packages: /babel-plugin-import@1.13.5: resolution: {integrity: sha512-IkqnoV+ov1hdJVofly9pXRJmeDm9EtROfrc5i6eII0Hix2xMs5FEm8FG3ExMvazbnZBbgHIt6qdO8And6lCloQ==} dependencies: - '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) + '@babel/helper-module-imports': 7.25.9 transitivePeerDependencies: - supports-color dev: true @@ -22564,7 +22593,7 @@ packages: /babel-plugin-import@1.13.8: resolution: {integrity: sha512-36babpjra5m3gca44V6tSTomeBlPA7cHUynrE2WiQIm3rEGD9xy28MKsx5IdO45EbnpJY7Jrgd00C6Dwt/l/2Q==} dependencies: - '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) + '@babel/helper-module-imports': 7.25.9 transitivePeerDependencies: - supports-color dev: true @@ -22683,7 +22712,7 @@ packages: styled-components: '>= 2' dependencies: '@babel/helper-annotate-as-pure': 7.25.9 - '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) + '@babel/helper-module-imports': 7.25.9 babel-plugin-syntax-jsx: 6.18.0 lodash: 4.17.21 styled-components: 6.1.13(react-dom@18.3.1)(react@18.3.1) @@ -24182,7 +24211,7 @@ packages: normalize-path: 3.0.0 schema-utils: 4.2.0 serialize-javascript: 6.0.2 - webpack: 5.93.0(@swc/core@1.7.26)(esbuild@0.24.0) + webpack: 5.93.0(@swc/core@1.7.26)(esbuild@0.18.20) /copy-webpack-plugin@11.0.0(webpack@5.93.0): resolution: {integrity: sha512-fX2MWpamkW0hZxMEg0+mYnA40LTosOSa5TqZ9GYIBzyJa9C3QUaMPSE2xAi/buNr8u89SfD9wHSQVBzrRa/SOQ==} @@ -24527,7 +24556,7 @@ packages: postcss-modules-values: 4.0.0(postcss@8.4.47) postcss-value-parser: 4.2.0 semver: 7.6.3 - webpack: 5.93.0(@swc/core@1.7.26)(esbuild@0.24.0) + webpack: 5.93.0(@swc/core@1.7.26)(esbuild@0.18.20) /css-loader@6.11.0(@rspack/core@1.1.1)(webpack@5.93.0): resolution: {integrity: sha512-CTJ+AEQJjq5NzLga5pE39qdiSV56F8ywCIsqNIRF0r7BDgWsN25aazToqAFg7ZrtA/U016xudB3ffgweORxX7g==} @@ -25290,7 +25319,6 @@ packages: dependencies: ms: 2.1.3 supports-color: 9.3.1 - dev: true /decimal.js@10.4.3: resolution: {integrity: sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==} @@ -25537,7 +25565,7 @@ packages: hasBin: true dependencies: address: 1.2.2 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) transitivePeerDependencies: - supports-color @@ -26222,7 +26250,7 @@ packages: peerDependencies: esbuild: '>=0.12 <1' dependencies: - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) esbuild: 0.17.19 transitivePeerDependencies: - supports-color @@ -26233,7 +26261,7 @@ packages: peerDependencies: esbuild: '>=0.12 <1' dependencies: - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) esbuild: 0.18.20 transitivePeerDependencies: - supports-color @@ -26244,7 +26272,7 @@ packages: peerDependencies: esbuild: '>=0.12 <1' dependencies: - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) esbuild: 0.23.1 transitivePeerDependencies: - supports-color @@ -26633,7 +26661,7 @@ packages: optional: true dependencies: '@nolyfill/is-core-module': 1.0.39 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) enhanced-resolve: 5.17.1 eslint: 8.57.1 eslint-module-utils: 2.12.0(@typescript-eslint/parser@7.18.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.1) @@ -27063,7 +27091,7 @@ packages: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.3 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.2.2 @@ -27140,7 +27168,7 @@ packages: resolution: {integrity: sha512-YNF+mZ/Wu2FU/gvmzuWtYc8rloubL7wfXCTgouFrnjGVXPA/EeYYA7pupXWrb3Iv1cTBeSSxxJIbK23l4MRNqg==} engines: {node: '>=8.3.0'} dependencies: - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 '@babel/types': 7.26.0 c8: 7.14.0 transitivePeerDependencies: @@ -27995,7 +28023,7 @@ packages: debug: optional: true dependencies: - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) /for-each@0.3.3: resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} @@ -29569,7 +29597,7 @@ packages: dependencies: '@tootallnate/once': 2.0.0 agent-base: 6.0.2 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) transitivePeerDependencies: - supports-color dev: true @@ -29579,7 +29607,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.1 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) transitivePeerDependencies: - supports-color dev: true @@ -29607,7 +29635,7 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@types/http-proxy': 1.17.15 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) http-proxy: 1.18.1(debug@4.3.7) is-glob: 4.0.3 is-plain-object: 5.0.0 @@ -29687,7 +29715,7 @@ packages: engines: {node: '>= 6.0.0'} dependencies: agent-base: 5.1.1 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) transitivePeerDependencies: - supports-color dev: true @@ -29697,7 +29725,7 @@ packages: engines: {node: '>= 6'} dependencies: agent-base: 6.0.2 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) transitivePeerDependencies: - supports-color @@ -29706,7 +29734,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.1 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) transitivePeerDependencies: - supports-color dev: true @@ -29853,7 +29881,7 @@ packages: resolution: {integrity: sha512-7EyUlPFC0HOlBDpUFGfYstsU7XHxZJKAAMzCT8wZ0hMW7b+hG51LIKTDcsgtz8Pu6YC0HqRVbX+rVUtsGMUKvg==} engines: {node: '>=16.20'} dependencies: - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) import-meta-resolve: 4.1.0 transitivePeerDependencies: - supports-color @@ -30687,7 +30715,7 @@ packages: resolution: {integrity: sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==} engines: {node: '>=10'} dependencies: - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) istanbul-lib-coverage: 3.2.2 source-map: 0.6.1 transitivePeerDependencies: @@ -30699,7 +30727,7 @@ packages: engines: {node: '>=10'} dependencies: '@jridgewell/trace-mapping': 0.3.25 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) istanbul-lib-coverage: 3.2.2 transitivePeerDependencies: - supports-color @@ -31741,7 +31769,7 @@ packages: content-disposition: 0.5.4 content-type: 1.0.5 cookies: 0.9.1 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) delegates: 1.0.0 depd: 2.0.0 destroy: 1.2.0 @@ -31895,7 +31923,7 @@ packages: webpack-sources: optional: true dependencies: - webpack: 5.93.0(@swc/core@1.7.26)(esbuild@0.24.0) + webpack: 5.93.0(@swc/core@1.7.26)(esbuild@0.18.20) webpack-sources: 3.2.3 /lilconfig@2.1.0: @@ -32198,7 +32226,7 @@ packages: engines: {node: '>=8.0'} dependencies: date-format: 4.0.14 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) flatted: 3.3.1 rfdc: 1.4.1 streamroller: 3.1.5 @@ -33059,7 +33087,7 @@ packages: resolution: {integrity: sha512-uD66tJj54JLYq0De10AhWycZWGQNUvDI55xPgk2sQM5kn1JYlhbCMTtEeT27+vAhW2FBQxLlOmS3pmA7/2z4aA==} dependencies: '@types/debug': 4.1.12 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) decode-named-character-reference: 1.0.2 micromark-core-commonmark: 1.1.0 micromark-factory-space: 1.1.0 @@ -36656,7 +36684,7 @@ packages: engines: {node: '>=8.16.0'} dependencies: '@types/mime-types': 2.1.4 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) extract-zip: 1.7.0 https-proxy-agent: 4.0.0 mime: 2.6.0 @@ -37827,7 +37855,7 @@ packages: engines: {node: '>=16.14.0'} dependencies: '@babel/core': 7.26.0 - '@babel/traverse': 7.25.9(supports-color@5.5.0) + '@babel/traverse': 7.25.9 '@babel/types': 7.26.0 '@types/babel__core': 7.20.5 '@types/babel__traverse': 7.20.6 @@ -39609,7 +39637,7 @@ packages: klona: 2.0.6 neo-async: 2.6.2 sass: 1.79.4 - webpack: 5.93.0(@swc/core@1.7.26)(esbuild@0.24.0) + webpack: 5.93.0(@swc/core@1.7.26)(esbuild@0.18.20) /sass-loader@13.3.3(webpack@5.93.0): resolution: {integrity: sha512-mt5YN2F1MOZr3d/wBRcZxeFgwgkH44wVc2zohO2YF6JiOMkiXe4BYRZpSu2sO1g71mo/j16txzUhsKZlqjVGzA==} @@ -39732,7 +39760,7 @@ packages: '@semantic-release/release-notes-generator': 14.0.1(semantic-release@24.1.2) aggregate-error: 5.0.0 cosmiconfig: 9.0.0(typescript@5.5.2) - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) env-ci: 11.1.0 execa: 9.4.0 figures: 6.1.0 @@ -39843,7 +39871,7 @@ packages: resolution: {integrity: sha512-v67WcEouB5GxbTWL/4NeToqcZiAWEq90N888fczVArY8A79J0L4FD7vj5hm3eUMua5EpoQ59wa/oovY6TLvRUA==} engines: {node: '>= 18'} dependencies: - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) destroy: 1.2.0 encodeurl: 2.0.0 escape-html: 1.0.3 @@ -40327,7 +40355,7 @@ packages: /spdy-transport@3.0.0: resolution: {integrity: sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==} dependencies: - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) detect-node: 2.1.0 hpack.js: 2.1.6 obuf: 1.1.2 @@ -40340,7 +40368,7 @@ packages: resolution: {integrity: sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==} engines: {node: '>=6.0.0'} dependencies: - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) handle-thing: 2.0.1 http-deceiver: 1.2.7 select-hose: 2.0.0 @@ -40610,7 +40638,7 @@ packages: engines: {node: '>=8.0'} dependencies: date-format: 4.0.14 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) fs-extra: 8.1.0 transitivePeerDependencies: - supports-color @@ -40862,7 +40890,7 @@ packages: peerDependencies: webpack: ^5.0.0 dependencies: - webpack: 5.93.0(@swc/core@1.7.26)(esbuild@0.24.0) + webpack: 5.93.0(@swc/core@1.7.26)(esbuild@0.18.20) /style-to-object@0.3.0: resolution: {integrity: sha512-CzFnRRXhzWIdItT3OmF8SQfWyahHhjq3HwcMNCNLn+N7klOOqPjMeG/4JSu77D7ypZdGvSzvkrbyeTMizz2VrA==} @@ -41034,7 +41062,7 @@ packages: hasBin: true dependencies: '@adobe/css-tools': 4.3.3 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) glob: 10.4.5 sax: 1.4.1 source-map: 0.7.4 @@ -41101,7 +41129,6 @@ packages: /supports-color@9.3.1: resolution: {integrity: sha512-knBY82pjmnIzK3NifMo3RxEIRD9E0kIzV4BKcyTZ9+9kWgLMxd4PrsTSMoFQUabgRBbF8KOLRDCyKgNV+iK44Q==} engines: {node: '>=12'} - dev: true /supports-hyperlinks@2.3.0: resolution: {integrity: sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA==} @@ -42187,7 +42214,7 @@ packages: bundle-require: 4.2.1(esbuild@0.18.20) cac: 6.7.14 chokidar: 3.6.0 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) esbuild: 0.18.20 execa: 5.1.1 globby: 11.1.0 @@ -42229,7 +42256,7 @@ packages: cac: 6.7.14 chokidar: 3.6.0 consola: 3.2.3 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) esbuild: 0.23.0 execa: 5.1.1 joycon: 3.1.1 @@ -43031,7 +43058,7 @@ packages: compression: 1.7.4 cookies: 0.9.1 cors: 2.8.5 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) envinfo: 7.11.0 express: 4.18.2 express-rate-limit: 5.5.1 @@ -43146,7 +43173,7 @@ packages: hasBin: true dependencies: cac: 6.7.14 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) pathe: 1.1.2 picocolors: 1.1.1 vite: 5.2.14(@types/node@20.12.14)(less@4.2.0)(stylus@0.64.0) @@ -43167,7 +43194,7 @@ packages: hasBin: true dependencies: cac: 6.7.14 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) pathe: 1.1.2 picocolors: 1.1.1 vite: 5.2.14(@types/node@18.16.9)(less@4.2.0)(stylus@0.64.0) @@ -43197,7 +43224,7 @@ packages: '@volar/typescript': 2.4.5 '@vue/language-core': 2.1.6(typescript@5.5.2) compare-versions: 6.1.1 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) kolorist: 1.8.0 local-pkg: 0.5.0 magic-string: 0.30.12 @@ -43224,7 +43251,7 @@ packages: '@volar/typescript': 2.4.5 '@vue/language-core': 2.1.6(typescript@5.5.2) compare-versions: 6.1.1 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) kolorist: 1.8.0 local-pkg: 0.5.0 magic-string: 0.30.12 @@ -43244,7 +43271,7 @@ packages: vite: optional: true dependencies: - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) globrex: 0.1.2 tsconfck: 2.1.2(typescript@5.5.2) vite: 5.2.14(@types/node@18.16.9)(less@4.2.0)(stylus@0.64.0) @@ -43414,7 +43441,7 @@ packages: acorn-walk: 8.3.4 cac: 6.7.14 chai: 4.5.0 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) execa: 8.0.1 local-pkg: 0.5.0 magic-string: 0.30.11 @@ -43471,7 +43498,7 @@ packages: '@vitest/utils': 1.6.0 acorn-walk: 8.3.4 chai: 4.5.0 - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) execa: 8.0.1 local-pkg: 0.5.0 magic-string: 0.30.11 @@ -43520,7 +43547,7 @@ packages: peerDependencies: eslint: '>=6.0.0' dependencies: - debug: 4.3.7(supports-color@5.5.0) + debug: 4.3.7(supports-color@9.3.1) eslint: 8.57.1 eslint-scope: 7.2.2 eslint-visitor-keys: 3.4.3 @@ -43724,7 +43751,7 @@ packages: on-finished: 2.4.1 range-parser: 1.2.1 schema-utils: 4.2.0 - webpack: 5.93.0(@swc/core@1.7.26)(esbuild@0.24.0) + webpack: 5.93.0(@swc/core@1.7.26)(esbuild@0.18.20) /webpack-dev-server@5.0.4(webpack@5.93.0): resolution: {integrity: sha512-dljXhUgx3HqKP2d8J/fUMvhxGhzjeNVarDLcbO/EWMSgRizDkxHQDZQaLFL5VJY9tRBj2Gz+rvCEYYvhbqPHNA==} @@ -43877,7 +43904,7 @@ packages: dependencies: html-webpack-plugin: 5.6.2(@rspack/core@1.0.8)(webpack@5.93.0) typed-assert: 1.0.9 - webpack: 5.93.0(@swc/core@1.7.26)(esbuild@0.24.0) + webpack: 5.93.0(@swc/core@1.7.26)(esbuild@0.18.20) /webpack-subresource-integrity@5.1.0(html-webpack-plugin@5.6.3)(webpack@5.95.0): resolution: {integrity: sha512-sacXoX+xd8r4WKsy9MvH/q/vBtEHr86cpImXwyg74pFIpERKt6FmB8cXpeuh0ZLgclOlHI4Wcll7+R5L02xk9Q==} From 50f4e770f6548ffbb92b5d759e54c3719c58a22f Mon Sep 17 00:00:00 2001 From: 2heal1 Date: Fri, 3 Jan 2025 14:57:49 +0800 Subject: [PATCH 2/8] chore: sanitizedPublicPath --- .../router-remote4-2004/rsbuild.config.ts | 3 +++ .../container/runtime/RemoteEntryPlugin.ts | 25 +++++++++++++++++-- packages/rspack/src/RemoteEntryPlugin.ts | 22 +++++++++++++++- 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/apps/router-demo/router-remote4-2004/rsbuild.config.ts b/apps/router-demo/router-remote4-2004/rsbuild.config.ts index 006bd5ef799..a69a7b5e0d8 100644 --- a/apps/router-demo/router-remote4-2004/rsbuild.config.ts +++ b/apps/router-demo/router-remote4-2004/rsbuild.config.ts @@ -14,6 +14,9 @@ export default defineConfig({ 'react-dom': path.resolve(__dirname, 'node_modules/react-dom'), }, }, + dev: { + writeToDisk: true, + }, server: { port: 2004, }, diff --git a/packages/enhanced/src/lib/container/runtime/RemoteEntryPlugin.ts b/packages/enhanced/src/lib/container/runtime/RemoteEntryPlugin.ts index 5588a2c2e5a..a96372f8a32 100644 --- a/packages/enhanced/src/lib/container/runtime/RemoteEntryPlugin.ts +++ b/packages/enhanced/src/lib/container/runtime/RemoteEntryPlugin.ts @@ -1,6 +1,25 @@ import type { Compiler, WebpackPluginInstance } from 'webpack'; import pBtoa from 'btoa'; +const charMap: Record = { + '<': '\\u003C', + '>': '\\u003E', + '/': '\\u002F', + '\\': '\\\\', + '\b': '\\b', + '\f': '\\f', + '\n': '\\n', + '\r': '\\r', + '\t': '\\t', + '\0': '\\0', + '\u2028': '\\u2028', + '\u2029': '\\u2029', +}; + +function escapeUnsafeChars(str: string) { + return str.replace(/[<>\b\f\n\r\t\0\u2028\u2029]/g, (x) => charMap[x]); +} + export class RemoteEntryPlugin implements WebpackPluginInstance { readonly name = 'VmokRemoteEntryPlugin'; private _name: string; @@ -13,12 +32,14 @@ export class RemoteEntryPlugin implements WebpackPluginInstance { apply(compiler: Compiler): void { let code; + const sanitizedPublicPath = escapeUnsafeChars(this._getPublicPath); + if (!this._getPublicPath.startsWith('function')) { code = `${ compiler.webpack.RuntimeGlobals.publicPath - } = new Function(${JSON.stringify(this._getPublicPath)})()`; + } = new Function(${JSON.stringify(sanitizedPublicPath)})()`; } else { - code = `(${this._getPublicPath})()`; + code = `(${sanitizedPublicPath})()`; } const base64Code = pBtoa(code); const dataUrl = `data:text/javascript;base64,${base64Code}`; diff --git a/packages/rspack/src/RemoteEntryPlugin.ts b/packages/rspack/src/RemoteEntryPlugin.ts index 67133f302a3..cda7509ec9d 100644 --- a/packages/rspack/src/RemoteEntryPlugin.ts +++ b/packages/rspack/src/RemoteEntryPlugin.ts @@ -1,6 +1,25 @@ import type { Compiler, RspackPluginInstance } from '@rspack/core'; import pBtoa from 'btoa'; +const charMap = { + '<': '\\u003C', + '>': '\\u003E', + '/': '\\u002F', + '\\': '\\\\', + '\b': '\\b', + '\f': '\\f', + '\n': '\\n', + '\r': '\\r', + '\t': '\\t', + '\0': '\\0', + '\u2028': '\\u2028', + '\u2029': '\\u2029', +}; + +function escapeUnsafeChars(str) { + return str.replace(/[<>\b\f\n\r\t\0\u2028\u2029]/g, (x) => charMap[x]); +} + export class RemoteEntryPlugin implements RspackPluginInstance { readonly name = 'VmokRemoteEntryPlugin'; private _name: string; @@ -12,9 +31,10 @@ export class RemoteEntryPlugin implements RspackPluginInstance { } apply(compiler: Compiler): void { + const sanitizedPublicPath = escapeUnsafeChars(this._getPublicPath); const code = `${ compiler.webpack.RuntimeGlobals.publicPath - } = new Function(${JSON.stringify(this._getPublicPath)})()`; + } = new Function(${JSON.stringify(sanitizedPublicPath)})()`; const base64Code = pBtoa(code); const dataUrl = `data:text/javascript;base64,${base64Code}`; From 6a229809648ec70ddb7a6f5a808067560b9b18a2 Mon Sep 17 00:00:00 2001 From: 2heal1 Date: Fri, 3 Jan 2025 15:54:20 +0800 Subject: [PATCH 3/8] chore: reuse common plugin --- .../lib/container/ModuleFederationPlugin.ts | 3 +- .../container/runtime/RemoteEntryPlugin.ts | 53 ------------------- packages/rspack/package.json | 8 +++ packages/rspack/rollup.config.js | 4 ++ packages/rspack/src/RemoteEntryPlugin.ts | 16 ++++-- 5 files changed, 25 insertions(+), 59 deletions(-) delete mode 100644 packages/enhanced/src/lib/container/runtime/RemoteEntryPlugin.ts diff --git a/packages/enhanced/src/lib/container/ModuleFederationPlugin.ts b/packages/enhanced/src/lib/container/ModuleFederationPlugin.ts index 3dd5dbb9e1d..3ed66f775b4 100644 --- a/packages/enhanced/src/lib/container/ModuleFederationPlugin.ts +++ b/packages/enhanced/src/lib/container/ModuleFederationPlugin.ts @@ -19,7 +19,7 @@ import SharePlugin from '../sharing/SharePlugin'; import ContainerPlugin from './ContainerPlugin'; import ContainerReferencePlugin from './ContainerReferencePlugin'; import FederationRuntimePlugin from './runtime/FederationRuntimePlugin'; -import { RemoteEntryPlugin } from './runtime/RemoteEntryPlugin'; +import { RemoteEntryPlugin } from '@module-federation/rspack/remote-entry-plugin'; import { ExternalsType } from 'webpack/declarations/WebpackOptions'; import StartupChunkDependenciesPlugin from '../startup/MfStartupChunkDependenciesPlugin'; import FederationModulesPlugin from './runtime/FederationModulesPlugin'; @@ -69,6 +69,7 @@ class ModuleFederationPlugin implements WebpackPluginInstance { // must before ModuleFederationPlugin if (options.getPublicPath && options.name) { new RemoteEntryPlugin(options.name, options.getPublicPath).apply( + // @ts-ignore compiler, ); } diff --git a/packages/enhanced/src/lib/container/runtime/RemoteEntryPlugin.ts b/packages/enhanced/src/lib/container/runtime/RemoteEntryPlugin.ts deleted file mode 100644 index a96372f8a32..00000000000 --- a/packages/enhanced/src/lib/container/runtime/RemoteEntryPlugin.ts +++ /dev/null @@ -1,53 +0,0 @@ -import type { Compiler, WebpackPluginInstance } from 'webpack'; -import pBtoa from 'btoa'; - -const charMap: Record = { - '<': '\\u003C', - '>': '\\u003E', - '/': '\\u002F', - '\\': '\\\\', - '\b': '\\b', - '\f': '\\f', - '\n': '\\n', - '\r': '\\r', - '\t': '\\t', - '\0': '\\0', - '\u2028': '\\u2028', - '\u2029': '\\u2029', -}; - -function escapeUnsafeChars(str: string) { - return str.replace(/[<>\b\f\n\r\t\0\u2028\u2029]/g, (x) => charMap[x]); -} - -export class RemoteEntryPlugin implements WebpackPluginInstance { - readonly name = 'VmokRemoteEntryPlugin'; - private _name: string; - private _getPublicPath: string; - - constructor(name: string, getPublicPath: string) { - this._name = name; - this._getPublicPath = getPublicPath; - } - - apply(compiler: Compiler): void { - let code; - const sanitizedPublicPath = escapeUnsafeChars(this._getPublicPath); - - if (!this._getPublicPath.startsWith('function')) { - code = `${ - compiler.webpack.RuntimeGlobals.publicPath - } = new Function(${JSON.stringify(sanitizedPublicPath)})()`; - } else { - code = `(${sanitizedPublicPath})()`; - } - const base64Code = pBtoa(code); - const dataUrl = `data:text/javascript;base64,${base64Code}`; - - compiler.hooks.afterPlugins.tap('VmokRemoteEntryPlugin', () => { - new compiler.webpack.EntryPlugin(compiler.context, dataUrl, { - name: this._name, - }).apply(compiler); - }); - } -} diff --git a/packages/rspack/package.json b/packages/rspack/package.json index 2b4ce19549c..d68efb3b375 100644 --- a/packages/rspack/package.json +++ b/packages/rspack/package.json @@ -47,6 +47,11 @@ "types": "./dist/plugin.cjs.d.ts", "import": "./dist/plugin.esm.mjs", "require": "./dist/plugin.cjs.js" + }, + "./remote-entry-plugin": { + "types": "./dist/remote-entry-plugin.cjs.d.ts", + "import": "./dist/remote-entry-plugin.esm.mjs", + "require": "./dist/remote-entry-plugin.cjs.js" } }, "typesVersions": { @@ -56,6 +61,9 @@ ], "plugin": [ "./dist/plugin.cjs.d.ts" + ], + "remote-entry-plugin": [ + "./dist/remote-entry-plugin.cjs.d.ts" ] } }, diff --git a/packages/rspack/rollup.config.js b/packages/rspack/rollup.config.js index 8fb6f4719a4..3ab641f2c10 100644 --- a/packages/rspack/rollup.config.js +++ b/packages/rspack/rollup.config.js @@ -9,6 +9,10 @@ module.exports = (rollupConfig, projectOptions) => { process.cwd(), './packages/rspack/src/ModuleFederationPlugin.ts', ); + rollupConfig.input['remote-entry-plugin'] = path.resolve( + process.cwd(), + './packages/rspack/src/RemoteEntryPlugin.ts', + ); if (Array.isArray(rollupConfig.output)) { rollupConfig.output = rollupConfig.output.map((c) => ({ diff --git a/packages/rspack/src/RemoteEntryPlugin.ts b/packages/rspack/src/RemoteEntryPlugin.ts index cda7509ec9d..aa5a9cb142a 100644 --- a/packages/rspack/src/RemoteEntryPlugin.ts +++ b/packages/rspack/src/RemoteEntryPlugin.ts @@ -1,7 +1,7 @@ import type { Compiler, RspackPluginInstance } from '@rspack/core'; import pBtoa from 'btoa'; -const charMap = { +const charMap: Record = { '<': '\\u003C', '>': '\\u003E', '/': '\\u002F', @@ -16,7 +16,7 @@ const charMap = { '\u2029': '\\u2029', }; -function escapeUnsafeChars(str) { +function escapeUnsafeChars(str: string) { return str.replace(/[<>\b\f\n\r\t\0\u2028\u2029]/g, (x) => charMap[x]); } @@ -31,10 +31,16 @@ export class RemoteEntryPlugin implements RspackPluginInstance { } apply(compiler: Compiler): void { + let code; const sanitizedPublicPath = escapeUnsafeChars(this._getPublicPath); - const code = `${ - compiler.webpack.RuntimeGlobals.publicPath - } = new Function(${JSON.stringify(sanitizedPublicPath)})()`; + + if (!this._getPublicPath.startsWith('function')) { + code = `${ + compiler.webpack.RuntimeGlobals.publicPath + } = new Function(${JSON.stringify(sanitizedPublicPath)})()`; + } else { + code = `(${sanitizedPublicPath})()`; + } const base64Code = pBtoa(code); const dataUrl = `data:text/javascript;base64,${base64Code}`; From 2dc813bca865a62af1c884af5f6668600321dcee Mon Sep 17 00:00:00 2001 From: 2heal1 Date: Fri, 3 Jan 2025 15:59:26 +0800 Subject: [PATCH 4/8] chore: optimize safe --- packages/rspack/src/RemoteEntryPlugin.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/rspack/src/RemoteEntryPlugin.ts b/packages/rspack/src/RemoteEntryPlugin.ts index aa5a9cb142a..4c077fe3eae 100644 --- a/packages/rspack/src/RemoteEntryPlugin.ts +++ b/packages/rspack/src/RemoteEntryPlugin.ts @@ -17,7 +17,12 @@ const charMap: Record = { }; function escapeUnsafeChars(str: string) { - return str.replace(/[<>\b\f\n\r\t\0\u2028\u2029]/g, (x) => charMap[x]); + return str + .replace(/[<>\b\f\n\r\t\0\u2028\u2029]/g, (x) => charMap[x]) + .replace( + /[\u0022\u0027\u0060]/g, + (x) => `\\u${x.charCodeAt(0).toString(16).padStart(4, '0')}`, + ); } export class RemoteEntryPlugin implements RspackPluginInstance { From bc517c68f1baee8db481a188d9d2408453849dba Mon Sep 17 00:00:00 2001 From: 2heal1 Date: Fri, 3 Jan 2025 16:03:39 +0800 Subject: [PATCH 5/8] fix: safe issue --- packages/rspack/src/RemoteEntryPlugin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/rspack/src/RemoteEntryPlugin.ts b/packages/rspack/src/RemoteEntryPlugin.ts index 4c077fe3eae..a1187c9d875 100644 --- a/packages/rspack/src/RemoteEntryPlugin.ts +++ b/packages/rspack/src/RemoteEntryPlugin.ts @@ -18,7 +18,7 @@ const charMap: Record = { function escapeUnsafeChars(str: string) { return str - .replace(/[<>\b\f\n\r\t\0\u2028\u2029]/g, (x) => charMap[x]) + .replace(/[<>\b\f\n\r\t\0\u2028\u2029\\]/g, (x) => charMap[x]) .replace( /[\u0022\u0027\u0060]/g, (x) => `\\u${x.charCodeAt(0).toString(16).padStart(4, '0')}`, From 605f7924fb0d2268ffe16dd5dd17a5a43451b512 Mon Sep 17 00:00:00 2001 From: 2heal1 Date: Fri, 3 Jan 2025 16:07:02 +0800 Subject: [PATCH 6/8] fix: safe issue --- apps/router-demo/router-remote4-2004/rsbuild.config.ts | 1 + packages/rspack/src/RemoteEntryPlugin.ts | 7 +------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/apps/router-demo/router-remote4-2004/rsbuild.config.ts b/apps/router-demo/router-remote4-2004/rsbuild.config.ts index a69a7b5e0d8..0a9d0c7d9ee 100644 --- a/apps/router-demo/router-remote4-2004/rsbuild.config.ts +++ b/apps/router-demo/router-remote4-2004/rsbuild.config.ts @@ -28,6 +28,7 @@ export default defineConfig({ './export-app': './src/export-App.tsx', }, shared: ['react', 'react-dom'], + // getPublicPath: `return 'http://localhost:2004/'`, getPublicPath: `return 'http://localhost:2004/'`, }), ], diff --git a/packages/rspack/src/RemoteEntryPlugin.ts b/packages/rspack/src/RemoteEntryPlugin.ts index a1187c9d875..5ffb2242574 100644 --- a/packages/rspack/src/RemoteEntryPlugin.ts +++ b/packages/rspack/src/RemoteEntryPlugin.ts @@ -17,12 +17,7 @@ const charMap: Record = { }; function escapeUnsafeChars(str: string) { - return str - .replace(/[<>\b\f\n\r\t\0\u2028\u2029\\]/g, (x) => charMap[x]) - .replace( - /[\u0022\u0027\u0060]/g, - (x) => `\\u${x.charCodeAt(0).toString(16).padStart(4, '0')}`, - ); + return str.replace(/[<>\b\f\n\r\t\0\u2028\u2029\\]/g, (x) => charMap[x]); } export class RemoteEntryPlugin implements RspackPluginInstance { From 6709d80404d16e85f8b30fd3b696175ff5cd86d1 Mon Sep 17 00:00:00 2001 From: 2heal1 Date: Fri, 3 Jan 2025 16:48:04 +0800 Subject: [PATCH 7/8] fix: add webpackRequire.p= --- apps/router-demo/router-remote3-2003/rsbuild.config.ts | 1 + apps/router-demo/router-remote4-2004/rsbuild.config.ts | 2 +- packages/rspack/src/RemoteEntryPlugin.ts | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/router-demo/router-remote3-2003/rsbuild.config.ts b/apps/router-demo/router-remote3-2003/rsbuild.config.ts index 19e3da710d1..248bbcc1424 100644 --- a/apps/router-demo/router-remote3-2003/rsbuild.config.ts +++ b/apps/router-demo/router-remote3-2003/rsbuild.config.ts @@ -23,6 +23,7 @@ export default defineConfig({ './export-app': './src/export-app.ts', }, shared: ['vue', 'vue-router'], + getPublicPath: `return 'http://localhost:2003/'`, }), ], }); diff --git a/apps/router-demo/router-remote4-2004/rsbuild.config.ts b/apps/router-demo/router-remote4-2004/rsbuild.config.ts index 0a9d0c7d9ee..ed6ae4ff1e5 100644 --- a/apps/router-demo/router-remote4-2004/rsbuild.config.ts +++ b/apps/router-demo/router-remote4-2004/rsbuild.config.ts @@ -29,7 +29,7 @@ export default defineConfig({ }, shared: ['react', 'react-dom'], // getPublicPath: `return 'http://localhost:2004/'`, - getPublicPath: `return 'http://localhost:2004/'`, + getPublicPath: `function(){return 'http://localhost:2004/'}`, }), ], }); diff --git a/packages/rspack/src/RemoteEntryPlugin.ts b/packages/rspack/src/RemoteEntryPlugin.ts index 5ffb2242574..03ebbc54365 100644 --- a/packages/rspack/src/RemoteEntryPlugin.ts +++ b/packages/rspack/src/RemoteEntryPlugin.ts @@ -39,7 +39,9 @@ export class RemoteEntryPlugin implements RspackPluginInstance { compiler.webpack.RuntimeGlobals.publicPath } = new Function(${JSON.stringify(sanitizedPublicPath)})()`; } else { - code = `(${sanitizedPublicPath})()`; + code = `${ + compiler.webpack.RuntimeGlobals.publicPath + } = (${sanitizedPublicPath})()`; } const base64Code = pBtoa(code); const dataUrl = `data:text/javascript;base64,${base64Code}`; From f07aee443dde948b092c98d93e60c56b405b7ca7 Mon Sep 17 00:00:00 2001 From: 2heal1 Date: Mon, 6 Jan 2025 10:58:01 +0800 Subject: [PATCH 8/8] chore: update usage --- apps/router-demo/router-remote4-2004/rsbuild.config.ts | 2 +- packages/rspack/package.json | 1 - packages/rspack/src/RemoteEntryPlugin.ts | 5 ++--- pnpm-lock.yaml | 3 --- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/apps/router-demo/router-remote4-2004/rsbuild.config.ts b/apps/router-demo/router-remote4-2004/rsbuild.config.ts index ed6ae4ff1e5..6adce577df8 100644 --- a/apps/router-demo/router-remote4-2004/rsbuild.config.ts +++ b/apps/router-demo/router-remote4-2004/rsbuild.config.ts @@ -29,7 +29,7 @@ export default defineConfig({ }, shared: ['react', 'react-dom'], // getPublicPath: `return 'http://localhost:2004/'`, - getPublicPath: `function(){return 'http://localhost:2004/'}`, + getPublicPath: `function(originalPublicPath){console.log(originalPublicPath);__webpack_require__.p = 'http://localhost:2004/'}`, }), ], }); diff --git a/packages/rspack/package.json b/packages/rspack/package.json index d68efb3b375..11915c23326 100644 --- a/packages/rspack/package.json +++ b/packages/rspack/package.json @@ -34,7 +34,6 @@ "@module-federation/sdk": "workspace:*" }, "devDependencies": { - "@types/btoa": "1.2.5", "@rspack/core": "^1.0.2" }, "exports": { diff --git a/packages/rspack/src/RemoteEntryPlugin.ts b/packages/rspack/src/RemoteEntryPlugin.ts index 03ebbc54365..984da4918dd 100644 --- a/packages/rspack/src/RemoteEntryPlugin.ts +++ b/packages/rspack/src/RemoteEntryPlugin.ts @@ -1,4 +1,5 @@ import type { Compiler, RspackPluginInstance } from '@rspack/core'; +// @ts-ignore import pBtoa from 'btoa'; const charMap: Record = { @@ -39,9 +40,7 @@ export class RemoteEntryPlugin implements RspackPluginInstance { compiler.webpack.RuntimeGlobals.publicPath } = new Function(${JSON.stringify(sanitizedPublicPath)})()`; } else { - code = `${ - compiler.webpack.RuntimeGlobals.publicPath - } = (${sanitizedPublicPath})()`; + code = `(${sanitizedPublicPath}(${compiler.webpack.RuntimeGlobals.publicPath}))`; } const base64Code = pBtoa(code); const dataUrl = `data:text/javascript;base64,${base64Code}`; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8dc0c44af21..60811f96692 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2554,9 +2554,6 @@ importers: '@rspack/core': specifier: ^1.0.2 version: 1.0.8(@swc/helpers@0.5.13) - '@types/btoa': - specifier: 1.2.5 - version: 1.2.5 packages/runtime: dependencies: