diff --git a/.changeset/ai-hungry-cat.md b/.changeset/ai-hungry-cat.md new file mode 100644 index 00000000000..23a864762da --- /dev/null +++ b/.changeset/ai-hungry-cat.md @@ -0,0 +1,7 @@ +--- +"@module-federation/enhanced": patch +--- + +Reordered the "import" and "require" fields in export mappings for consistency. + +``` diff --git a/.changeset/config.json b/.changeset/config.json index 9dd29034192..49f63eeabba 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -23,7 +23,8 @@ "@module-federation/retry-plugin", "@module-federation/data-prefetch", "@module-federation/rsbuild-plugin", - "@module-federation/error-codes" + "@module-federation/error-codes", + "@module-federation/inject-external-runtime-core-plugin" ] ], "ignorePatterns": ["^alpha|^beta"], diff --git a/.changeset/lucky-shirts-listen.md b/.changeset/lucky-shirts-listen.md deleted file mode 100644 index 4e772a07c22..00000000000 --- a/.changeset/lucky-shirts-listen.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@module-federation/sdk': patch ---- - -chore: bump logger diff --git a/.changeset/shaggy-flowers-cry.md b/.changeset/shaggy-flowers-cry.md deleted file mode 100644 index 81d0608025d..00000000000 --- a/.changeset/shaggy-flowers-cry.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@module-federation/error-codes': patch -'@module-federation/enhanced': patch -'@module-federation/sdk': patch ---- - -fix(enhanced): abort process if not find expose modules diff --git a/.changeset/smart-crabs-burn.md b/.changeset/smart-crabs-burn.md deleted file mode 100644 index 9faa96774d6..00000000000 --- a/.changeset/smart-crabs-burn.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@module-federation/error-codes': patch -'@module-federation/runtime': patch -'@module-federation/sdk': patch ---- - -fix: throw RUNTIME-008 Error when script resources load failed diff --git a/.changeset/sour-carpets-walk.md b/.changeset/sour-carpets-walk.md deleted file mode 100644 index becbc9cb025..00000000000 --- a/.changeset/sour-carpets-walk.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@module-federation/modern-js': patch ---- - -chore(modern-js-plugin): add ssr option diff --git a/.changeset/twelve-pumpkins-film.md b/.changeset/twelve-pumpkins-film.md deleted file mode 100644 index 45441ad7f90..00000000000 --- a/.changeset/twelve-pumpkins-film.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@module-federation/bridge-react': patch ---- - -feat: support basename passed by remote module props diff --git a/.cursorignore b/.cursorignore index 4a2b9586d04..2ab6da1ea8a 100644 --- a/.cursorignore +++ b/.cursorignore @@ -1,16 +1,75 @@ -# Add directories or file patterns to ignore during indexing (e.g. foo/ or *.csv) -./tmp -./scripts -./.git -packages/storybook-addon -packages/core -packages/utilities -packages/typescript +# Cache and temporary files +**/.cache/ +**/.temp/ +**/coverage/ +**/dist/ + +# Documentation and config files +**/*.md +**/*.yaml +**/*.yml +**/.eslintrc* +**/.prettierrc* +**/.swcrc +**/jest.config.* +**/tsconfig.* +**/*/stats.json + +# First ignore everything +* + +# Then allow specific packages and their contents +!packages/webpack-bundler-runtime/ +!packages/webpack-bundler-runtime/**/* +!packages/sdk/ +!packages/sdk/**/* +!packages/enhanced/ +!packages/enhanced/**/* + +# Allow package.json files +!package.json +!packages/*/package.json +!**/package.json + +# Explicitly ignore specific packages +packages/dts-plugin/ +packages/typescript/ packages/native-* -apps -**/configCases -**/dist -apps/** -*.snap -*.js +packages/core/ +packages/assemble-release-plan/ +packages/native-federation-typescript/ +packages/esbuild/ + +# Ignore specific directories +apps/ +webpack/tooling/ +webpack/setup/ +webpack/test/ +webpack/benchmark/ +tools/ +.husky/ +.github/ +.vscode/ +.verdaccio/ +# Ignore specific files +.cursorignore +jest.preset.js +babel.config.json +nx.json +LICENSE +.nxignore +netlify.toml +renovate.json +.npmrc +.cursorrules +.prettierignore +.editorconfig +ai-lint-fix.js +manifest.json +typedoc.json +typedoc.base.json +commitlint.config.js +.eslintignore +commit-gen.js +main.py diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index b5bbe7e8367..05052e6bc74 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -36,7 +36,7 @@ body: label: Validations description: Before submitting the issue, please make sure you do the following options: - - label: Read the [Contributing Guidelines](https://github.com/module-federation/core/blob/canary/CONTRIBUTING.md). + - label: Read the [Contributing Guidelines](https://github.com/module-federation/core/blob/main/CONTRIBUTING.md). required: true - label: Check that there isn't already an issue that request the same feature to avoid creating a duplicate. required: true diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 3b6dc3a57fe..45d94adafa5 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -42,6 +42,20 @@ jobs: - name: Run Build for All run: npx nx run-many --targets=build --projects=tag:type:pkg --skip-nx-cache + - name: Check Package Publishing Compatibility + run: | + for pkg in packages/*; do + if [ -f "$pkg/package.json" ] && \ + [ "$pkg" != "packages/assemble-release-plan" ] && \ + [ "$pkg" != "packages/chrome-devtools" ] && \ + [ "$pkg" != "packages/core" ] && \ + [ "$pkg" != "packages/esbuild" ] && \ + [ "$pkg" != "packages/utilities" ]; then + echo "Checking $pkg..." + npx publint "$pkg" + fi + done + - name: Run Affected Test uses: nick-fields/retry@v3 with: diff --git a/apps/manifest-demo/3009-webpack-provider/webpack.config.js b/apps/manifest-demo/3009-webpack-provider/webpack.config.js index c25224153af..6df53bd0864 100644 --- a/apps/manifest-demo/3009-webpack-provider/webpack.config.js +++ b/apps/manifest-demo/3009-webpack-provider/webpack.config.js @@ -46,6 +46,9 @@ module.exports = composePlugins( requiredVersion: '^18.3.1', }, }, + experiments: { + externalRuntime: true, + }, }), ); diff --git a/apps/manifest-demo/3010-rspack-provider/rspack.config.js b/apps/manifest-demo/3010-rspack-provider/rspack.config.js index a6aa815f2da..a293c22657f 100644 --- a/apps/manifest-demo/3010-rspack-provider/rspack.config.js +++ b/apps/manifest-demo/3010-rspack-provider/rspack.config.js @@ -101,6 +101,9 @@ module.exports = composePlugins( }, }, dataPrefetch: true, + experiments: { + externalRuntime: true, + }, }), ); (config.devServer = { diff --git a/apps/manifest-demo/3011-rspack-manifest-provider/rspack.config.js b/apps/manifest-demo/3011-rspack-manifest-provider/rspack.config.js index 835d52fe5d9..bc6e806fa8f 100644 --- a/apps/manifest-demo/3011-rspack-manifest-provider/rspack.config.js +++ b/apps/manifest-demo/3011-rspack-manifest-provider/rspack.config.js @@ -84,6 +84,9 @@ module.exports = composePlugins( requiredVersion: '^18.3.1', }, }, + experiments: { + externalRuntime: true, + }, }), ); (config.devServer = { diff --git a/apps/manifest-demo/3012-rspack-js-entry-provider/rspack.config.js b/apps/manifest-demo/3012-rspack-js-entry-provider/rspack.config.js index 3966a868337..2d0e69f10e1 100644 --- a/apps/manifest-demo/3012-rspack-js-entry-provider/rspack.config.js +++ b/apps/manifest-demo/3012-rspack-js-entry-provider/rspack.config.js @@ -85,6 +85,9 @@ module.exports = composePlugins( }, }, manifest: false, + experiments: { + externalRuntime: true, + }, }), ); (config.devServer = { diff --git a/apps/manifest-demo/webpack-host/src/bootstrap.tsx b/apps/manifest-demo/webpack-host/src/bootstrap.tsx deleted file mode 100644 index a2de88b3cd9..00000000000 --- a/apps/manifest-demo/webpack-host/src/bootstrap.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import React, { StrictMode, lazy } from 'react'; -import { init } from '@module-federation/runtime'; -import * as ReactDOM from 'react-dom/client'; -import { - createBrowserRouter, - createRoutesFromElements, - Route, - RouterProvider, -} from 'react-router-dom'; -import App from './App'; -import Root from './Root'; -import customPlugin from './runtimePlugin'; - -const router = createBrowserRouter([ - { - path: '/', - element: , - children: [ - { - path: 'basic', - element: , - }, - { - path: 'preload', - Component: lazy(() => import('./Preload')), - }, - ], - }, -]); - -init({ - name: 'manifest_host', - remotes: [ - { - name: 'rspack_provider', - alias: 'dynamic-remote', - entry: 'http://localhost:3010/mf-manifest.json', - }, - ], - plugins: [customPlugin()], -}); - -const root = ReactDOM.createRoot( - document.getElementById('root') as HTMLElement, -); -root.render( - - - , -); diff --git a/apps/manifest-demo/webpack-host/webpack.config.js b/apps/manifest-demo/webpack-host/webpack.config.js index 6f32d5c8c70..b9efd43734a 100644 --- a/apps/manifest-demo/webpack-host/webpack.config.js +++ b/apps/manifest-demo/webpack-host/webpack.config.js @@ -23,9 +23,6 @@ module.exports = composePlugins(withNx(), withReact(), (config, context) => { 'modern-js-provider': 'app1@http://127.0.0.1:4001/mf-manifest.json', }, filename: 'remoteEntry.js', - exposes: { - './Button': './src/Button.tsx', - }, shared: { lodash: {}, antd: {}, @@ -47,8 +44,12 @@ module.exports = composePlugins(withNx(), withReact(), (config, context) => { }, }, dataPrefetch: true, - experiments: { federationRuntime: 'hoisted' }, + // experiments: { federationRuntime: 'hoisted' }, runtimePlugins: [path.join(__dirname, './runtimePlugin.ts')], + experiments: { + provideExternalRuntime: true, + federationRuntime: 'hoisted', + }, }), ); diff --git a/apps/modernjs/CHANGELOG.md b/apps/modernjs/CHANGELOG.md index 8109a0398a8..a8392961f33 100644 --- a/apps/modernjs/CHANGELOG.md +++ b/apps/modernjs/CHANGELOG.md @@ -1,5 +1,13 @@ # @module-federation/modernjsapp +## 0.1.78 + +### Patch Changes + +- Updated dependencies [f573ad0] +- Updated dependencies [336f3d8] + - @module-federation/enhanced@0.8.7 + ## 0.1.77 ### Patch Changes diff --git a/apps/modernjs/package.json b/apps/modernjs/package.json index 3493cdb4fcb..a6a08ca2d6e 100644 --- a/apps/modernjs/package.json +++ b/apps/modernjs/package.json @@ -1,7 +1,7 @@ { "name": "@module-federation/modernjsapp", "private": true, - "version": "0.1.77", + "version": "0.1.78", "scripts": { "reset": "npx rimraf ./**/node_modules", "dev": "modern dev", diff --git a/apps/website-new/CHANGELOG.md b/apps/website-new/CHANGELOG.md index 2568bc067ae..cec4b9fd8cc 100644 --- a/apps/website-new/CHANGELOG.md +++ b/apps/website-new/CHANGELOG.md @@ -1,5 +1,13 @@ # website-new +## 1.0.20 + +### Patch Changes + +- Updated dependencies [336f3d8] +- Updated dependencies [4fd33fb] + - @module-federation/error-codes@0.8.7 + ## 1.0.19 ### Patch Changes diff --git a/apps/website-new/docs/en/configure/experiments.mdx b/apps/website-new/docs/en/configure/experiments.mdx index 423e4ba57b8..dc4c1fad936 100644 --- a/apps/website-new/docs/en/configure/experiments.mdx +++ b/apps/website-new/docs/en/configure/experiments.mdx @@ -63,3 +63,22 @@ There should be no "eager consumption" errors possible, as the initialization of Instead of federation runtime initilizing in the entrypoint code, it is initialized in a RuntimeModule, within the webpack runtime. This allows module federation to be avaliable ahead of time, thus enabling "Async Startup" capabilities etc. +## externalRuntime + +- Type: `boolean` +- Required: No +- Default: `false` + +After setting `true`, the external MF runtime will be used and the runtime provided by the consumer will be used. (Please make sure your consumer has `provideExternalRuntime: true` set, otherwise it will not run properly!) + +## provideExternalRuntime + +- Type: `boolean` +- Required: No +- Default: `false` + +::: warning note +Make sure to only configure it on the topmost consumer! If multiple consumers inject runtime at the same time, the ones executed later will not overwrite the existing runtime. +::: + +Setting `true` will inject the MF runtime at the consumer. diff --git a/apps/website-new/docs/en/configure/shared.mdx b/apps/website-new/docs/en/configure/shared.mdx index 4a2ad2e2d31..9be6d34233a 100644 --- a/apps/website-new/docs/en/configure/shared.mdx +++ b/apps/website-new/docs/en/configure/shared.mdx @@ -44,7 +44,7 @@ new ModuleFederationPlugin({ - Type: `boolean` - Required: No -- Default: `true` +- Default: `false` Whether to allow only one version of the shared module within the shared scope (singleton mode). diff --git a/apps/website-new/docs/en/guide/start/index.mdx b/apps/website-new/docs/en/guide/start/index.mdx index 6c5d57e230b..377406e9dd8 100644 --- a/apps/website-new/docs/en/guide/start/index.mdx +++ b/apps/website-new/docs/en/guide/start/index.mdx @@ -17,7 +17,7 @@ Module Federation is an architectural pattern for the decentralization of JavaSc Module Federation has the following features: -- ⚡ Code sharing、Dependency reuse +- ⚡ Code sharing, Dependency reuse - 📝 Manifest - 🎨 [Module Federation Runtime](../basic/runtime.mdx) - 🧩 [Runtime Plugins System](../../plugin/dev/index.mdx) diff --git a/apps/website-new/docs/zh/configure/_meta.json b/apps/website-new/docs/zh/configure/_meta.json index 753828e13be..eb0be1fa07c 100644 --- a/apps/website-new/docs/zh/configure/_meta.json +++ b/apps/website-new/docs/zh/configure/_meta.json @@ -63,5 +63,10 @@ "type": "file", "name": "shareStrategy", "label": "shareStrategy" + }, + { + "type": "file", + "name": "experiments", + "label": "experiments" } ] diff --git a/apps/website-new/docs/zh/configure/experiments.mdx b/apps/website-new/docs/zh/configure/experiments.mdx new file mode 100644 index 00000000000..ca1fda1f90e --- /dev/null +++ b/apps/website-new/docs/zh/configure/experiments.mdx @@ -0,0 +1,88 @@ +# Experiments + +`experiments` 配置用于启用插件中的实验功能。 + +- Example + +```ts +new ModuleFederationPlugin({ + name: '@demo/host', + experiments: { + federationRuntime: 'hoisted' + }, + shared: { + react: { + singleton: true, + }, + 'react-dom': { + singleton: true, + }, + }, + //... +}); +``` + +## federationRuntime + +- Type: `enum` +- Required: No +- Default: `false` +- Options: `false | "hoisted"` + +### `Hoisted` Runtime + +当设置 `federationRuntime: 'hoisted'` 时,会发生以下情况: + +这些配置可用于下列场景: + +- 设置`runtimeChunk: 'single'`。 +- 避免在应用程序顶部或用户代码入口点使用“import()”,以防止急切消费错误。过去,这通常是强制性的,并且在示例应用程序中通常被视为“import('./bootstrap.js')”。 +- 将模块联合运行时包移动到运行时块中,使它们远离入口点 - 减少代码重复 + +下面会详细解释对应的场景。 + +1)优化 + +原先 `module-federation/runtime` 会被加入到编译入口,这意味着在多 entry 的情况下会打包多次 mf runtime,会增大产物体积。 +当设置了某些特定的分包策略,还会导致共享依赖 `eager consumption` 的问题。 + +并且 `federationRuntime: 'hoisted'` 还允许设置 `runtimeChunk: "single"`。 + +2)异步启动 + +:::警告 +此模式仍然允许设置异步入口。导出 UMD 库时,它会返回 Promise resolve 导出。 +如果您手动 require() Node 中的入口点,它将 module.exports 设置为 Promise.resolve(exports)。 +::: + +入口启动将切换到“主动”初始化并使用异步依赖项启动。 + +你将不再需要强制的设置异步入口:`“import('./bootsrtap')”`。 + +不再出现共享依赖 `eager consumption` 错误,因为文件本身的初始化表现为异步块。 + +3) 提升 MF 运行时访问优先级 + +与原先在入口挂载 MF runtime 不同,现在将会提升到 bundler runtime 初始化阶段挂载 MF runtime 。 + +这允许 MF runtime 提前可用,从而支持 “异步启动”(不再需要异步入口) 功能等。 + +## externalRuntime + +- Type: `boolean` +- Required: No +- Default: `false` + +设置 `true` 后 会 external MF runtime,并使用消费者提供的 runtime 。(请确保你的消费者有设置 `provideExternalRuntime: true`,否则无法正常运行!) + +## provideExternalRuntime + +- Type: `boolean` +- Required: No +- Default: `false` + +::: warning 注意 +请确保仅在最顶层消费者配置!若同时有多个消费者注入 runtime,后执行的不会覆盖已有的 runtime。 +::: + +设置 `true` 后会在消费者处注入 MF runtime。 diff --git a/apps/website-new/docs/zh/configure/shared.mdx b/apps/website-new/docs/zh/configure/shared.mdx index da1dd1ce37d..b2aebb33d4d 100644 --- a/apps/website-new/docs/zh/configure/shared.mdx +++ b/apps/website-new/docs/zh/configure/shared.mdx @@ -44,13 +44,13 @@ new ModuleFederationPlugin({ - 类型:`boolean` - 是否必填:否 -- 默认值:`true` +- 默认值:`false` 是否在共享作用域中只允许共享模块的一个版本 (单例模式). - 如果值为 true,开启单例模式;值为 false,不开启单例模式。 -- 如果启用单例模式,那么 remote 应用组件和 host 应用共享的依赖只加载一次,当版本不一致时加载更高的版本。此时对于版本更低的那一方会给出警告: -- 不开启单例模式下,如果 remote 应用和 host 应用共享依赖的版本不一致,则 remote 应用和 host 应用加载各自的依赖 +- 如果启用单例模式,那么 remote 应用组件和 host 应用共享的依赖只加载一次,当版本不一致时加载更高的版本。此时对于版本更低的那一方会给出警告。 +- 不开启单例模式下,如果 remote 应用和 host 应用共享依赖的版本不一致,则 remote 应用和 host 应用加载各自的依赖。 ## requiredVersion @@ -61,7 +61,7 @@ new ModuleFederationPlugin({ 所需版本,可以是一个版本区间。默认值为当前应用的依赖版本。 - 在使用共享依赖时,会判断该依赖版本是否大于等于 requiredVersion ,如果是则会正常使用。如果小于 requiredVersion 那么会在控制台警告,并使用当前共享依赖中最小的版本。 -- 当一方设置 requiredVersion ,另一方设置 singleton 时,会加载 requiredVersion 的依赖,singleton 方直接使用 requiredVersion 的依赖,不论版本高低 +- 当一方设置 requiredVersion ,另一方设置 singleton 时,会加载 requiredVersion 的依赖,singleton 方直接使用 requiredVersion 的依赖,不论版本高低。 ## eager @@ -121,13 +121,13 @@ new ModuleFederationPlugin({ ```ts new ModuleFederationPlugin({ name: '@demo/button', - shared: { - react: { - singleton: true, - requiredVersion: '~18.2.0' - fixedDependencies: true - } + shared: { + react: { + singleton: true, + requiredVersion: '~18.2.0', + fixedDependencies: true } + }, //... }); ``` diff --git a/apps/website-new/package.json b/apps/website-new/package.json index ad8fe50d7b8..895a9516b91 100644 --- a/apps/website-new/package.json +++ b/apps/website-new/package.json @@ -1,6 +1,6 @@ { "name": "website-new", - "version": "1.0.19", + "version": "1.0.20", "private": true, "scripts": { "dev": "rspress dev", diff --git a/package.json b/package.json index c95024c8eb0..9579b6f7f2b 100644 --- a/package.json +++ b/package.json @@ -208,6 +208,7 @@ "postcss-url": "10.1.3", "prettier": "3.3.3", "prettier-eslint": "16.3.0", + "publint": "^0.2.12", "react-refresh": "0.14.2", "rimraf": "^3.0.2", "rollup-plugin-copy": "3.5.0", diff --git a/packages/bridge/bridge-react-webpack-plugin/CHANGELOG.md b/packages/bridge/bridge-react-webpack-plugin/CHANGELOG.md index 5065140ea92..eb7819a4de4 100644 --- a/packages/bridge/bridge-react-webpack-plugin/CHANGELOG.md +++ b/packages/bridge/bridge-react-webpack-plugin/CHANGELOG.md @@ -1,5 +1,14 @@ # @module-federation/bridge-react-webpack-plugin +## 0.8.7 + +### Patch Changes + +- Updated dependencies [835b09c] +- Updated dependencies [336f3d8] +- Updated dependencies [4fd33fb] + - @module-federation/sdk@0.8.7 + ## 0.8.6 ### Patch Changes diff --git a/packages/bridge/bridge-react-webpack-plugin/package.json b/packages/bridge/bridge-react-webpack-plugin/package.json index 854081d516a..ab88b97660d 100644 --- a/packages/bridge/bridge-react-webpack-plugin/package.json +++ b/packages/bridge/bridge-react-webpack-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/bridge-react-webpack-plugin", - "version": "0.8.6", + "version": "0.8.7", "publishConfig": { "access": "public" }, diff --git a/packages/bridge/bridge-react/CHANGELOG.md b/packages/bridge/bridge-react/CHANGELOG.md index 2bc3aae8a63..c41103656b3 100644 --- a/packages/bridge/bridge-react/CHANGELOG.md +++ b/packages/bridge/bridge-react/CHANGELOG.md @@ -1,5 +1,16 @@ # @module-federation/bridge-react +## 0.8.7 + +### Patch Changes + +- 4102786: feat: support basename passed by remote module props +- Updated dependencies [835b09c] +- Updated dependencies [336f3d8] +- Updated dependencies [4fd33fb] + - @module-federation/sdk@0.8.7 + - @module-federation/bridge-shared@0.8.7 + ## 0.8.6 ### Patch Changes diff --git a/packages/bridge/bridge-react/package.json b/packages/bridge/bridge-react/package.json index 1910e90639d..fbd5ecc19d7 100644 --- a/packages/bridge/bridge-react/package.json +++ b/packages/bridge/bridge-react/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/bridge-react", - "version": "0.8.6", + "version": "0.8.7", "publishConfig": { "access": "public" }, diff --git a/packages/bridge/bridge-shared/CHANGELOG.md b/packages/bridge/bridge-shared/CHANGELOG.md index 8f6d318a5c9..f2682b09b9c 100644 --- a/packages/bridge/bridge-shared/CHANGELOG.md +++ b/packages/bridge/bridge-shared/CHANGELOG.md @@ -1,5 +1,7 @@ # @module-federation/bridge-shared +## 0.8.7 + ## 0.8.6 ## 0.8.5 diff --git a/packages/bridge/bridge-shared/package.json b/packages/bridge/bridge-shared/package.json index 1f8a76b8ac1..4c9bdbc2c4e 100644 --- a/packages/bridge/bridge-shared/package.json +++ b/packages/bridge/bridge-shared/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/bridge-shared", - "version": "0.8.6", + "version": "0.8.7", "publishConfig": { "access": "public" }, diff --git a/packages/bridge/vue3-bridge/CHANGELOG.md b/packages/bridge/vue3-bridge/CHANGELOG.md index b86f7b1aac1..d6df94dc8fa 100644 --- a/packages/bridge/vue3-bridge/CHANGELOG.md +++ b/packages/bridge/vue3-bridge/CHANGELOG.md @@ -1,5 +1,17 @@ # @module-federation/bridge-vue3 +## 0.8.7 + +### Patch Changes + +- Updated dependencies [835b09c] +- Updated dependencies [f573ad0] +- Updated dependencies [336f3d8] +- Updated dependencies [4fd33fb] + - @module-federation/sdk@0.8.7 + - @module-federation/runtime@0.8.7 + - @module-federation/bridge-shared@0.8.7 + ## 0.8.6 ### Patch Changes diff --git a/packages/bridge/vue3-bridge/package.json b/packages/bridge/vue3-bridge/package.json index f7015e5ff0a..83559f250ab 100644 --- a/packages/bridge/vue3-bridge/package.json +++ b/packages/bridge/vue3-bridge/package.json @@ -7,7 +7,7 @@ "url": "https://github.com/module-federation/core", "directory": "packages/vue3-bridge" }, - "version": "0.8.6", + "version": "0.8.7", "publishConfig": { "access": "public" }, diff --git a/packages/chrome-devtools/CHANGELOG.md b/packages/chrome-devtools/CHANGELOG.md index 475019ee5a0..ebcfd02863c 100644 --- a/packages/chrome-devtools/CHANGELOG.md +++ b/packages/chrome-devtools/CHANGELOG.md @@ -1,5 +1,14 @@ # @module-federation/devtools +## 0.8.7 + +### Patch Changes + +- Updated dependencies [835b09c] +- Updated dependencies [336f3d8] +- Updated dependencies [4fd33fb] + - @module-federation/sdk@0.8.7 + ## 0.8.6 ### Patch Changes diff --git a/packages/chrome-devtools/package.json b/packages/chrome-devtools/package.json index 6ca6da2d216..bafa931b14e 100644 --- a/packages/chrome-devtools/package.json +++ b/packages/chrome-devtools/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/devtools", - "version": "0.8.6", + "version": "0.8.7", "license": "MIT", "repository": { "type": "git", @@ -18,7 +18,7 @@ "release": "npm publish --tag canary", "test": "vitest run", "test:e2e": "E2ETEST=true pnpm build && playwright test", - "test:e2e:ui": "E2ETEST=true pnpm build && playwright test --ui", + "test:e2e:ui": "E2ETEST=true pnpm build && playwright test --ui", "start": "modern start", "serve": "modern serve", "new": "modern new", diff --git a/packages/chrome-devtools/playwright.config.ts b/packages/chrome-devtools/playwright.config.ts index bb398ea5b09..e0ad353e7d3 100644 --- a/packages/chrome-devtools/playwright.config.ts +++ b/packages/chrome-devtools/playwright.config.ts @@ -1,7 +1,7 @@ import { defineConfig, devices } from '@playwright/test'; export default defineConfig({ - timeout: 2 * 60 * 1000, + timeout: 90000, testDir: './e2e', fullyParallel: true, forbidOnly: Boolean(process.env.CI), @@ -10,6 +10,9 @@ export default defineConfig({ use: { trace: 'on-first-retry', }, + expect: { + timeout: 10000, + }, projects: [ { name: 'chromium', diff --git a/packages/chrome-devtools/src/component/Layout/index.tsx b/packages/chrome-devtools/src/component/Layout/index.tsx index f1577fed729..3b1cec50fcf 100644 --- a/packages/chrome-devtools/src/component/Layout/index.tsx +++ b/packages/chrome-devtools/src/component/Layout/index.tsx @@ -5,6 +5,7 @@ import { GlobalModuleInfo, MODULE_DEVTOOL_IDENTIFIER, } from '@module-federation/sdk'; +import type { Federation } from '@module-federation/runtime'; import FormComponent from '../Form'; import Dependency from '../Graph'; @@ -33,12 +34,19 @@ import { BROWSER_ENV_KEY, __FEDERATION_DEVTOOLS__, } from '../../template/constant'; - interface FormItemType { key: string; value: string; checked: boolean; } +declare global { + interface Window { + __FEDERATION__: Federation & { + originModuleInfo: GlobalModuleInfo; + moduleInfo: GlobalModuleInfo; + }; + } +} const Layout = ( props: { moduleInfo: GlobalModuleInfo } & RootComponentProps, diff --git a/packages/data-prefetch/CHANGELOG.md b/packages/data-prefetch/CHANGELOG.md index a2f77f379ed..4bfacdaf09f 100644 --- a/packages/data-prefetch/CHANGELOG.md +++ b/packages/data-prefetch/CHANGELOG.md @@ -1,5 +1,16 @@ # @module-federation/data-prefetch +## 0.8.7 + +### Patch Changes + +- Updated dependencies [835b09c] +- Updated dependencies [f573ad0] +- Updated dependencies [336f3d8] +- Updated dependencies [4fd33fb] + - @module-federation/sdk@0.8.7 + - @module-federation/runtime@0.8.7 + ## 0.8.6 ### Patch Changes diff --git a/packages/data-prefetch/package.json b/packages/data-prefetch/package.json index 996f11c5317..484869de06b 100644 --- a/packages/data-prefetch/package.json +++ b/packages/data-prefetch/package.json @@ -1,7 +1,7 @@ { "name": "@module-federation/data-prefetch", "description": "Module Federation Data Prefetch", - "version": "0.8.6", + "version": "0.8.7", "author": "nieyan ", "homepage": "https://github.com/module-federation/core", "license": "MIT", @@ -16,31 +16,36 @@ "publishConfig": { "access": "public" }, + "files": [ + "dist", + "README.md", + "LICENSE" + ], "exports": { ".": { + "types": "./dist/index.cjs.d.ts", "import": "./dist/index.esm.mjs", - "require": "./dist/index.cjs", - "types": "./dist/index.cjs.d.ts" + "require": "./dist/index.cjs.js" }, "./react": { + "types": "./dist/react.cjs.d.ts", "import": "./dist/react.esm.mjs", - "require": "./dist/react.cjs.js", - "types": "./dist/react.cjs.d.ts" + "require": "./dist/react.cjs.js" }, "./cli": { + "types": "./dist/cli.cjs.d.ts", "import": "./dist/cli.esm.mjs", - "require": "./dist/cli.cjs.js", - "types": "./dist/cli.cjs.d.ts" + "require": "./dist/cli.cjs.js" }, "./babel-plugin": { + "types": "./dist/babel.cjs.d.ts", "import": "./dist/babel.esm.mjs", - "require": "./dist/babel.cjs.js", - "types": "./dist/babel.cjs.d.ts" + "require": "./dist/babel.cjs.js" }, "./universal": { + "types": "./dist/universal.cjs.d.ts", "import": "./dist/universal.esm.mjs", - "require": "./dist/universal.cjs.js", - "types": "./dist/universal.cjs.d.ts" + "require": "./dist/universal.cjs.js" } }, "typesVersions": { @@ -62,7 +67,7 @@ ] } }, - "main": "dist/index.cjs", + "main": "dist/index.cjs.js", "module": "dist/index.esm.mjs", "peerDependencies": { "react": ">=16.9.0", diff --git a/packages/data-prefetch/src/prefetch.ts b/packages/data-prefetch/src/prefetch.ts index f60f25309c6..1dbd23ff006 100644 --- a/packages/data-prefetch/src/prefetch.ts +++ b/packages/data-prefetch/src/prefetch.ts @@ -9,17 +9,16 @@ import { ProviderModuleInfo, } from '@module-federation/sdk'; import { Remote } from '@module-federation/runtime/types'; - +import type { Federation } from '@module-federation/runtime'; import { getPrefetchId, compatGetPrefetchId } from './common/runtime-utils'; -declare module '@module-federation/runtime' { - export interface Federation { - __PREFETCH__: { - entryLoading: Record>; - instance: Map; - __PREFETCH_EXPORTS__: Record Promise>>; - }; - } +// Define an interface that extends Federation to include __PREFETCH__ +interface FederationWithPrefetch extends Federation { + __PREFETCH__: { + entryLoading: Record>; + instance: Map; + __PREFETCH_EXPORTS__: Record Promise>>; + }; } type PrefetchExports = Record; @@ -40,11 +39,13 @@ export interface prefetchOptions { // @ts-ignore init global variable for test globalThis.__FEDERATION__ ??= {}; -globalThis.__FEDERATION__.__PREFETCH__ ??= { +( + globalThis.__FEDERATION__ as unknown as FederationWithPrefetch +).__PREFETCH__ ??= { entryLoading: {}, instance: new Map(), __PREFETCH_EXPORTS__: {}, -}; +} as FederationWithPrefetch['__PREFETCH__']; export class MFDataPrefetch { public prefetchMemory: Map>; public recordOutdate: Record>; @@ -59,12 +60,15 @@ export class MFDataPrefetch { this.global.instance.set(options.name, this); } - get global(): Record { - return globalThis.__FEDERATION__.__PREFETCH__; + get global(): FederationWithPrefetch['__PREFETCH__'] { + return (globalThis.__FEDERATION__ as unknown as FederationWithPrefetch) + .__PREFETCH__; } static getInstance(id: string): MFDataPrefetch | undefined { - return globalThis.__FEDERATION__.__PREFETCH__.instance.get(id); + return ( + globalThis.__FEDERATION__ as unknown as FederationWithPrefetch + ).__PREFETCH__.instance.get(id); } async loadEntry(entry: string | undefined): Promise { @@ -94,8 +98,9 @@ export class MFDataPrefetch { return this._exports; } const { name } = this._options; - const exportsPromiseFn = - globalThis.__FEDERATION__.__PREFETCH__.__PREFETCH_EXPORTS__?.[name]; + const exportsPromiseFn = ( + globalThis.__FEDERATION__ as unknown as FederationWithPrefetch + ).__PREFETCH__.__PREFETCH_EXPORTS__?.[name]; const exportsPromise = typeof exportsPromiseFn === 'function' ? exportsPromiseFn() diff --git a/packages/dts-plugin/CHANGELOG.md b/packages/dts-plugin/CHANGELOG.md index 7189be4410c..3b9c5044142 100644 --- a/packages/dts-plugin/CHANGELOG.md +++ b/packages/dts-plugin/CHANGELOG.md @@ -1,5 +1,17 @@ # @module-federation/dts-plugin +## 0.8.7 + +### Patch Changes + +- Updated dependencies [835b09c] +- Updated dependencies [336f3d8] +- Updated dependencies [4fd33fb] + - @module-federation/sdk@0.8.7 + - @module-federation/error-codes@0.8.7 + - @module-federation/managers@0.8.7 + - @module-federation/third-party-dts-extractor@0.8.7 + ## 0.8.6 ### Patch Changes diff --git a/packages/dts-plugin/package.json b/packages/dts-plugin/package.json index be7344fae95..713cbb681e5 100644 --- a/packages/dts-plugin/package.json +++ b/packages/dts-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/dts-plugin", - "version": "0.8.6", + "version": "0.8.7", "author": "hanric ", "main": "./dist/index.js", "module": "./dist/index.js", diff --git a/packages/enhanced/CHANGELOG.md b/packages/enhanced/CHANGELOG.md index 49b65a935aa..2397590ba10 100644 --- a/packages/enhanced/CHANGELOG.md +++ b/packages/enhanced/CHANGELOG.md @@ -1,5 +1,26 @@ # @module-federation/enhanced +## 0.8.7 + +### Patch Changes + +- f573ad0: feat: add externalRuntime and provideExternalRuntime fields to help optimize assets size +- 336f3d8: fix(enhanced): abort process if not find expose modules +- Updated dependencies [835b09c] +- Updated dependencies [f573ad0] +- Updated dependencies [336f3d8] +- Updated dependencies [4fd33fb] + - @module-federation/sdk@0.8.7 + - @module-federation/inject-external-runtime-core-plugin@0.8.7 + - @module-federation/error-codes@0.8.7 + - @module-federation/bridge-react-webpack-plugin@0.8.7 + - @module-federation/data-prefetch@0.8.7 + - @module-federation/dts-plugin@0.8.7 + - @module-federation/managers@0.8.7 + - @module-federation/manifest@0.8.7 + - @module-federation/rspack@0.8.7 + - @module-federation/runtime-tools@0.8.7 + ## 0.8.6 ### Patch Changes diff --git a/packages/enhanced/package.json b/packages/enhanced/package.json index 76ee4ec0adf..3da16c1591f 100644 --- a/packages/enhanced/package.json +++ b/packages/enhanced/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/enhanced", - "version": "0.8.6", + "version": "0.8.7", "main": "./dist/src/index.js", "types": "./dist/src/index.d.ts", "repository": { @@ -35,28 +35,28 @@ "exports": { ".": { "types": "./dist/src/index.d.ts", - "require": "./dist/src/index.js", - "import": "./dist/src/index.js" + "import": "./dist/src/index.js", + "require": "./dist/src/index.js" }, "./webpack": { "types": "./dist/src/webpack.d.ts", - "require": "./dist/src/webpack.js", - "import": "./dist/src/webpack.js" + "import": "./dist/src/webpack.js", + "require": "./dist/src/webpack.js" }, "./rspack": { "types": "./dist/src/rspack.d.ts", - "require": "./dist/src/rspack.js", - "import": "./dist/src/rspack.js" + "import": "./dist/src/rspack.js", + "require": "./dist/src/rspack.js" }, "./runtime": { "types": "./dist/src/runtime.d.ts", - "require": "./dist/src/runtime.js", - "import": "./dist/src/runtime.js" + "import": "./dist/src/runtime.js", + "require": "./dist/src/runtime.js" }, "./prefetch": { "types": "./dist/src/prefetch.d.ts", - "require": "./dist/src/prefetch.js", - "import": "./dist/src/prefetch.js" + "import": "./dist/src/prefetch.js", + "require": "./dist/src/prefetch.js" } }, "typesVersions": { @@ -93,6 +93,7 @@ "@module-federation/rspack": "workspace:*", "@module-federation/bridge-react-webpack-plugin": "workspace:*", "@module-federation/data-prefetch": "workspace:*", + "@module-federation/inject-external-runtime-core-plugin": "workspace:*", "upath": "2.0.1", "btoa": "^1.2.1" } diff --git a/packages/enhanced/src/lib/container/ModuleFederationPlugin.ts b/packages/enhanced/src/lib/container/ModuleFederationPlugin.ts index e03f8bdbb14..3dd5dbb9e1d 100644 --- a/packages/enhanced/src/lib/container/ModuleFederationPlugin.ts +++ b/packages/enhanced/src/lib/container/ModuleFederationPlugin.ts @@ -30,6 +30,10 @@ const isValidExternalsType = require( ), ) as typeof import('webpack/schemas/plugins/container/ExternalsType.check.js'); +const { ExternalsPlugin } = require( + normalizeWebpackPath('webpack'), +) as typeof import('webpack'); + class ModuleFederationPlugin implements WebpackPluginInstance { private _options: moduleFederationPlugin.ModuleFederationPluginOptions; private _statsPlugin?: StatsPlugin; @@ -68,6 +72,27 @@ class ModuleFederationPlugin implements WebpackPluginInstance { compiler, ); } + if (options.experiments?.provideExternalRuntime) { + if (options.exposes) { + throw new Error( + 'You can only set provideExternalRuntime: true in pure consumer which not expose modules.', + ); + } + const runtimePlugins = options.runtimePlugins || []; + options.runtimePlugins = runtimePlugins.concat( + require.resolve( + '@module-federation/inject-external-runtime-core-plugin', + ), + ); + } + + if (options.experiments?.externalRuntime === true) { + const Externals = compiler.webpack.ExternalsPlugin || ExternalsPlugin; + new Externals(compiler.options.externalsType || 'global', { + '@module-federation/runtime-core': '_FEDERATION_RUNTIME_CORE', + }).apply(compiler); + } + if (options.experiments?.federationRuntime) { new FederationModulesPlugin().apply(compiler); new StartupChunkDependenciesPlugin({ diff --git a/packages/enhanced/src/schemas/container/ContainerPlugin.check.ts b/packages/enhanced/src/schemas/container/ContainerPlugin.check.ts index d7ccb04b3bd..c80302d72da 100644 --- a/packages/enhanced/src/schemas/container/ContainerPlugin.check.ts +++ b/packages/enhanced/src/schemas/container/ContainerPlugin.check.ts @@ -5,2326 +5,1469 @@ * DO NOT MODIFY BY HAND. * Run `yarn special-lint-fix` to update */ -const absolutePathRegExp = /^(?:[A-Za-z]:[\\/]|\\\\|\/)/; +const r = /^(?:[A-Za-z]:[\\/]|\\\\|\/)/; -const runtimePlugin = { - type: 'array', - items: { - anyOf: [ - { - type: 'string', - minLength: 1, - description: 'Runtime Plugin File Path.', - }, - { - type: 'object', - required: ['import', 'async'], - properties: { - import: { - type: 'string', - minLength: 1, - description: 'Runtime Plugin File Path.', - }, - async: { - type: 'boolean', - }, - }, - additionalProperties: false, - }, - ], - }, -}; - -const schema21 = { - definitions: { - AmdContainer: { - type: 'string', - minLength: 1, - }, - AuxiliaryComment: { - anyOf: [ - { - type: 'string', - }, - { - $ref: '#/definitions/LibraryCustomUmdCommentObject', - }, - ], - }, - EntryRuntime: { - anyOf: [ - { - enum: [false], - }, - { - type: 'string', - minLength: 1, - }, - ], - }, - Exposes: { - anyOf: [ +function t( + r, + { + instancePath: e = '', + parentData: n, + parentDataProperty: s, + rootData: a = r, + } = {}, +) { + if (!Array.isArray(r)) + return ( + (t.errors = [ { - type: 'array', - items: { - anyOf: [ - { - $ref: '#/definitions/ExposesItem', - }, - { - $ref: '#/definitions/ExposesObject', - }, - ], + params: { + type: 'array', }, }, - { - $ref: '#/definitions/ExposesObject', - }, - ], - }, - ExposesConfig: { - type: 'object', - additionalProperties: false, - properties: { - import: { - anyOf: [ - { - $ref: '#/definitions/ExposesItem', - }, + ]), + !1 + ); + { + const e = r.length; + for (let n = 0; n < e; n++) { + let e = r[n]; + const s = 0; + if ('string' != typeof e) + return ( + (t.errors = [ { - $ref: '#/definitions/ExposesItems', - }, - ], - }, - name: { - type: 'string', - }, - }, - required: ['import'], - }, - ExposesItem: { - type: 'string', - minLength: 1, - }, - ExposesItems: { - type: 'array', - items: { - $ref: '#/definitions/ExposesItem', - }, - }, - ExposesObject: { - type: 'object', - additionalProperties: { - anyOf: [ - { - $ref: '#/definitions/ExposesConfig', - }, - { - $ref: '#/definitions/ExposesItem', - }, - { - $ref: '#/definitions/ExposesItems', - }, - ], - }, - }, - LibraryCustomUmdCommentObject: { - type: 'object', - additionalProperties: false, - properties: { - amd: { - type: 'string', - }, - commonjs: { - type: 'string', - }, - commonjs2: { - type: 'string', - }, - root: { - type: 'string', - }, - }, - }, - LibraryCustomUmdObject: { - type: 'object', - additionalProperties: false, - properties: { - amd: { - type: 'string', - minLength: 1, - }, - commonjs: { - type: 'string', - minLength: 1, - }, - root: { - anyOf: [ - { - type: 'array', - items: { + params: { type: 'string', - minLength: 1, }, }, + ]), + !1 + ); + if (e.length < 1) + return ( + (t.errors = [ { - type: 'string', - minLength: 1, + params: {}, }, - ], - }, - }, - }, - LibraryExport: { - anyOf: [ - { - type: 'array', - items: { - type: 'string', - minLength: 1, - }, - }, - { - type: 'string', - minLength: 1, - }, - ], - }, - LibraryName: { - anyOf: [ - { - type: 'array', - items: { - type: 'string', - minLength: 1, - }, - minItems: 1, - }, - { - type: 'string', - minLength: 1, - }, - { - $ref: '#/definitions/LibraryCustomUmdObject', - }, - ], - }, - LibraryOptions: { - type: 'object', - additionalProperties: false, - properties: { - amdContainer: { - $ref: '#/definitions/AmdContainer', - }, - auxiliaryComment: { - $ref: '#/definitions/AuxiliaryComment', - }, - export: { - $ref: '#/definitions/LibraryExport', - }, - name: { - $ref: '#/definitions/LibraryName', - }, - type: { - $ref: '#/definitions/LibraryType', - }, - umdNamedDefine: { - $ref: '#/definitions/UmdNamedDefine', - }, - }, - required: ['type'], - }, - LibraryType: { - anyOf: [ - { - enum: [ - 'var', - 'module', - 'assign', - 'assign-properties', - 'this', - 'window', - 'self', - 'global', - 'commonjs', - 'commonjs2', - 'commonjs-module', - 'commonjs-static', - 'amd', - 'amd-require', - 'umd', - 'umd2', - 'jsonp', - 'system', - ], - }, - { - type: 'string', - }, - ], - }, - UmdNamedDefine: { - type: 'boolean', - }, - }, - type: 'object', - additionalProperties: false, - properties: { - exposes: { - $ref: '#/definitions/Exposes', - }, - filename: { - type: 'string', - absolutePath: false, - minLength: 1, - }, - library: { - $ref: '#/definitions/LibraryOptions', - }, - name: { - type: 'string', - minLength: 1, - }, - runtime: { - $ref: '#/definitions/EntryRuntime', - }, - runtimePlugins: runtimePlugin, - shareScope: { - type: 'string', - minLength: 1, - }, - experiments: { - type: 'object', - properties: { - federationRuntime: { - anyOf: [{ type: 'boolean' }, { enum: ['hoisted'] }], - }, - }, - additionalProperties: false, - }, - }, - required: ['name', 'exposes'], -}; -const schema39 = { - anyOf: [ - { - enum: [false], - }, - { - type: 'string', - minLength: 1, - }, - ], -}; -const schema22 = { - anyOf: [ - { - type: 'array', - items: { - anyOf: [ - { - $ref: '#/definitions/ExposesItem', - }, - { - $ref: '#/definitions/ExposesObject', - }, - ], - }, - }, - { - $ref: '#/definitions/ExposesObject', - }, - ], -}; -const schema23 = { - type: 'string', - minLength: 1, -}; -const schema24 = { - type: 'object', - additionalProperties: { - anyOf: [ - { - $ref: '#/definitions/ExposesConfig', - }, - { - $ref: '#/definitions/ExposesItem', - }, - { - $ref: '#/definitions/ExposesItems', - }, - ], - }, -}; -const schema25 = { - type: 'object', - additionalProperties: false, - properties: { - import: { - anyOf: [ - { - $ref: '#/definitions/ExposesItem', - }, - { - $ref: '#/definitions/ExposesItems', - }, - ], - }, - name: { - type: 'string', - }, - }, - required: ['import'], -}; -const schema27 = { - type: 'array', - items: { - $ref: '#/definitions/ExposesItem', - }, -}; - -function validate23( - data, - { instancePath = '', parentData, parentDataProperty, rootData = data } = {}, -) { - let vErrors = null; - let errors = 0; - if (errors === 0) { - if (Array.isArray(data)) { - var valid0 = true; - const len0 = data.length; - for (let i0 = 0; i0 < len0; i0++) { - let data0 = data[i0]; - const _errs1 = errors; - const _errs2 = errors; - if (errors === _errs2) { - if (typeof data0 === 'string') { - if (data0.length < 1) { - validate23.errors = [ - { - params: {}, - }, - ]; - return false; - } - } else { - validate23.errors = [ - { - params: { - type: 'string', - }, - }, - ]; - return false; - } - } - var valid0 = _errs1 === errors; - if (!valid0) { - break; - } - } - } else { - validate23.errors = [ - { - params: { - type: 'array', - }, - }, - ]; - return false; + ]), + !1 + ); + if (0 !== s) break; } } - validate23.errors = vErrors; - return errors === 0; + return (t.errors = null), !0; } -function validate22( - data, - { instancePath = '', parentData, parentDataProperty, rootData = data } = {}, +function e( + r, + { + instancePath: n = '', + parentData: s, + parentDataProperty: a, + rootData: o = r, + } = {}, ) { - let vErrors = null; - let errors = 0; - if (errors === 0) { - if (data && typeof data == 'object' && !Array.isArray(data)) { - let missing0; - if (data.import === undefined && (missing0 = 'import')) { - validate22.errors = [ + let i = null, + l = 0; + if (0 === l) { + if (!r || 'object' != typeof r || Array.isArray(r)) + return ( + (e.errors = [ { params: { - missingProperty: missing0, + type: 'object', }, }, - ]; - return false; - } else { - const _errs1 = errors; - for (const key0 in data) { - if (!(key0 === 'import' || key0 === 'name')) { - validate22.errors = [ - { - params: { - additionalProperty: key0, - }, + ]), + !1 + ); + { + let s; + if (void 0 === r.import && (s = 'import')) + return ( + (e.errors = [ + { + params: { + missingProperty: s, }, - ]; - return false; - break; - } - } - if (_errs1 === errors) { - if (data.import !== undefined) { - let data0 = data.import; - const _errs2 = errors; - const _errs3 = errors; - let valid1 = false; - const _errs4 = errors; - const _errs5 = errors; - if (errors === _errs5) { - if (typeof data0 === 'string') { - if (data0.length < 1) { - const err0 = { + }, + ]), + !1 + ); + { + const s = l; + for (const t in r) + if ('import' !== t && 'name' !== t) + return ( + (e.errors = [ + { + params: { + additionalProperty: t, + }, + }, + ]), + !1 + ); + if (s === l) { + if (void 0 !== r.import) { + let s = r.import; + const a = l, + u = l; + let c = !1; + const m = l; + if (l == l) + if ('string' == typeof s) { + if (s.length < 1) { + const r = { params: {}, }; - if (vErrors === null) { - vErrors = [err0]; - } else { - vErrors.push(err0); - } - errors++; + null === i ? (i = [r]) : i.push(r), l++; } } else { - const err1 = { + const r = { params: { type: 'string', }, }; - if (vErrors === null) { - vErrors = [err1]; - } else { - vErrors.push(err1); - } - errors++; - } - } - var _valid0 = _errs4 === errors; - valid1 = valid1 || _valid0; - if (!valid1) { - const _errs7 = errors; - if ( - !validate23(data0, { - instancePath: instancePath + '/import', - parentData: data, - parentDataProperty: 'import', - rootData, - }) - ) { - vErrors = - vErrors === null - ? validate23.errors - : vErrors.concat(validate23.errors); - errors = vErrors.length; + null === i ? (i = [r]) : i.push(r), l++; } - var _valid0 = _errs7 === errors; - valid1 = valid1 || _valid0; + var p = m === l; + if (((c = c || p), !c)) { + const e = l; + t(s, { + instancePath: n + '/import', + parentData: r, + parentDataProperty: 'import', + rootData: o, + }) || + ((i = null === i ? t.errors : i.concat(t.errors)), + (l = i.length)), + (p = e === l), + (c = c || p); } - if (!valid1) { - const err2 = { + if (!c) { + const r = { params: {}, }; - if (vErrors === null) { - vErrors = [err2]; - } else { - vErrors.push(err2); - } - errors++; - validate22.errors = vErrors; - return false; - } else { - errors = _errs3; - if (vErrors !== null) { - if (_errs3) { - vErrors.length = _errs3; - } else { - vErrors = null; - } - } + return ( + null === i ? (i = [r]) : i.push(r), l++, (e.errors = i), !1 + ); } - var valid0 = _errs2 === errors; - } else { - var valid0 = true; - } - if (valid0) { - if (data.name !== undefined) { - const _errs8 = errors; - if (typeof data.name !== 'string') { - validate22.errors = [ - { - params: { - type: 'string', + (l = u), null !== i && (u ? (i.length = u) : (i = null)); + var f = a === l; + } else f = !0; + if (f) + if (void 0 !== r.name) { + const t = l; + if ('string' != typeof r.name) + return ( + (e.errors = [ + { + params: { + type: 'string', + }, }, - }, - ]; - return false; - } - var valid0 = _errs8 === errors; - } else { - var valid0 = true; - } - } + ]), + !1 + ); + f = t === l; + } else f = !0; } } - } else { - validate22.errors = [ - { - params: { - type: 'object', - }, - }, - ]; - return false; } } - validate22.errors = vErrors; - return errors === 0; + return (e.errors = i), 0 === l; } -function validate21( - data, - { instancePath = '', parentData, parentDataProperty, rootData = data } = {}, +function n( + r, + { + instancePath: s = '', + parentData: a, + parentDataProperty: o, + rootData: i = r, + } = {}, ) { - let vErrors = null; - let errors = 0; - if (errors === 0) { - if (data && typeof data == 'object' && !Array.isArray(data)) { - for (const key0 in data) { - let data0 = data[key0]; - const _errs2 = errors; - const _errs3 = errors; - let valid1 = false; - const _errs4 = errors; - if ( - !validate22(data0, { - instancePath: - instancePath + - '/' + - key0.replace(/~/g, '~0').replace(/\//g, '~1'), - parentData: data, - parentDataProperty: key0, - rootData, - }) - ) { - vErrors = - vErrors === null - ? validate22.errors - : vErrors.concat(validate22.errors); - errors = vErrors.length; - } - var _valid0 = _errs4 === errors; - valid1 = valid1 || _valid0; - if (!valid1) { - const _errs5 = errors; - const _errs6 = errors; - if (errors === _errs6) { - if (typeof data0 === 'string') { - if (data0.length < 1) { - const err0 = { - params: {}, - }; - if (vErrors === null) { - vErrors = [err0]; - } else { - vErrors.push(err0); - } - errors++; - } - } else { - const err1 = { - params: { - type: 'string', - }, + let l = null, + p = 0; + if (0 === p) { + if (!r || 'object' != typeof r || Array.isArray(r)) + return ( + (n.errors = [ + { + params: { + type: 'object', + }, + }, + ]), + !1 + ); + for (const a in r) { + let o = r[a]; + const u = p, + c = p; + let m = !1; + const y = p; + e(o, { + instancePath: s + '/' + a.replace(/~/g, '~0').replace(/\//g, '~1'), + parentData: r, + parentDataProperty: a, + rootData: i, + }) || ((l = null === l ? e.errors : l.concat(e.errors)), (p = l.length)); + var f = y === p; + if (((m = m || f), !m)) { + const e = p; + if (p == p) + if ('string' == typeof o) { + if (o.length < 1) { + const r = { + params: {}, }; - if (vErrors === null) { - vErrors = [err1]; - } else { - vErrors.push(err1); - } - errors++; - } - } - var _valid0 = _errs5 === errors; - valid1 = valid1 || _valid0; - if (!valid1) { - const _errs8 = errors; - if ( - !validate23(data0, { - instancePath: - instancePath + - '/' + - key0.replace(/~/g, '~0').replace(/\//g, '~1'), - parentData: data, - parentDataProperty: key0, - rootData, - }) - ) { - vErrors = - vErrors === null - ? validate23.errors - : vErrors.concat(validate23.errors); - errors = vErrors.length; + null === l ? (l = [r]) : l.push(r), p++; } - var _valid0 = _errs8 === errors; - valid1 = valid1 || _valid0; - } - } - if (!valid1) { - const err2 = { - params: {}, - }; - if (vErrors === null) { - vErrors = [err2]; } else { - vErrors.push(err2); - } - errors++; - validate21.errors = vErrors; - return false; - } else { - errors = _errs3; - if (vErrors !== null) { - if (_errs3) { - vErrors.length = _errs3; - } else { - vErrors = null; - } + const r = { + params: { + type: 'string', + }, + }; + null === l ? (l = [r]) : l.push(r), p++; } - } - var valid0 = _errs2 === errors; - if (!valid0) { - break; + if (((f = e === p), (m = m || f), !m)) { + const e = p; + t(o, { + instancePath: s + '/' + a.replace(/~/g, '~0').replace(/\//g, '~1'), + parentData: r, + parentDataProperty: a, + rootData: i, + }) || + ((l = null === l ? t.errors : l.concat(t.errors)), (p = l.length)), + (f = e === p), + (m = m || f); } } - } else { - validate21.errors = [ - { - params: { - type: 'object', - }, - }, - ]; - return false; + if (!m) { + const r = { + params: {}, + }; + return null === l ? (l = [r]) : l.push(r), p++, (n.errors = l), !1; + } + if (((p = c), null !== l && (c ? (l.length = c) : (l = null)), u !== p)) + break; } } - validate21.errors = vErrors; - return errors === 0; + return (n.errors = l), 0 === p; } -function validate20( - data, - { instancePath = '', parentData, parentDataProperty, rootData = data } = {}, +function s( + r, + { + instancePath: t = '', + parentData: e, + parentDataProperty: a, + rootData: o = r, + } = {}, ) { - let vErrors = null; - let errors = 0; - const _errs0 = errors; - let valid0 = false; - const _errs1 = errors; - if (errors === _errs1) { - if (Array.isArray(data)) { - var valid1 = true; - const len0 = data.length; - for (let i0 = 0; i0 < len0; i0++) { - let data0 = data[i0]; - const _errs3 = errors; - const _errs4 = errors; - let valid2 = false; - const _errs5 = errors; - const _errs6 = errors; - if (errors === _errs6) { - if (typeof data0 === 'string') { - if (data0.length < 1) { - const err0 = { + let i = null, + l = 0; + const p = l; + let f = !1; + const u = l; + if (l === u) + if (Array.isArray(r)) { + const e = r.length; + for (let s = 0; s < e; s++) { + let e = r[s]; + const a = l, + p = l; + let f = !1; + const u = l; + if (l == l) + if ('string' == typeof e) { + if (e.length < 1) { + const r = { params: {}, }; - if (vErrors === null) { - vErrors = [err0]; - } else { - vErrors.push(err0); - } - errors++; + null === i ? (i = [r]) : i.push(r), l++; } } else { - const err1 = { + const r = { params: { type: 'string', }, }; - if (vErrors === null) { - vErrors = [err1]; - } else { - vErrors.push(err1); - } - errors++; - } - } - var _valid1 = _errs5 === errors; - valid2 = valid2 || _valid1; - if (!valid2) { - const _errs8 = errors; - if ( - !validate21(data0, { - instancePath: instancePath + '/' + i0, - parentData: data, - parentDataProperty: i0, - rootData, - }) - ) { - vErrors = - vErrors === null - ? validate21.errors - : vErrors.concat(validate21.errors); - errors = vErrors.length; + null === i ? (i = [r]) : i.push(r), l++; } - var _valid1 = _errs8 === errors; - valid2 = valid2 || _valid1; + var c = u === l; + if (((f = f || c), !f)) { + const a = l; + n(e, { + instancePath: t + '/' + s, + parentData: r, + parentDataProperty: s, + rootData: o, + }) || + ((i = null === i ? n.errors : i.concat(n.errors)), (l = i.length)), + (c = a === l), + (f = f || c); } - if (!valid2) { - const err2 = { + if (f) (l = p), null !== i && (p ? (i.length = p) : (i = null)); + else { + const r = { params: {}, }; - if (vErrors === null) { - vErrors = [err2]; - } else { - vErrors.push(err2); - } - errors++; - } else { - errors = _errs4; - if (vErrors !== null) { - if (_errs4) { - vErrors.length = _errs4; - } else { - vErrors = null; - } - } - } - var valid1 = _errs3 === errors; - if (!valid1) { - break; + null === i ? (i = [r]) : i.push(r), l++; } + if (a !== l) break; } } else { - const err3 = { + const r = { params: { type: 'array', }, }; - if (vErrors === null) { - vErrors = [err3]; - } else { - vErrors.push(err3); - } - errors++; + null === i ? (i = [r]) : i.push(r), l++; } + var m = u === l; + if (((f = f || m), !f)) { + const s = l; + n(r, { + instancePath: t, + parentData: e, + parentDataProperty: a, + rootData: o, + }) || ((i = null === i ? n.errors : i.concat(n.errors)), (l = i.length)), + (m = s === l), + (f = f || m); } - var _valid0 = _errs1 === errors; - valid0 = valid0 || _valid0; - if (!valid0) { - const _errs9 = errors; - if ( - !validate21(data, { - instancePath, - parentData, - parentDataProperty, - rootData, - }) - ) { - vErrors = - vErrors === null - ? validate21.errors - : vErrors.concat(validate21.errors); - errors = vErrors.length; - } - var _valid0 = _errs9 === errors; - valid0 = valid0 || _valid0; - } - if (!valid0) { - const err4 = { + if (!f) { + const r = { params: {}, }; - if (vErrors === null) { - vErrors = [err4]; - } else { - vErrors.push(err4); - } - errors++; - validate20.errors = vErrors; - return false; - } else { - errors = _errs0; - if (vErrors !== null) { - if (_errs0) { - vErrors.length = _errs0; - } else { - vErrors = null; - } - } + return null === i ? (i = [r]) : i.push(r), l++, (s.errors = i), !1; } - validate20.errors = vErrors; - return errors === 0; + return ( + (l = p), + null !== i && (p ? (i.length = p) : (i = null)), + (s.errors = i), + 0 === l + ); } -const schema30 = { - type: 'object', - additionalProperties: false, - properties: { - amdContainer: { - $ref: '#/definitions/AmdContainer', - }, - auxiliaryComment: { - $ref: '#/definitions/AuxiliaryComment', - }, - export: { - $ref: '#/definitions/LibraryExport', - }, - name: { - $ref: '#/definitions/LibraryName', - }, - type: { - $ref: '#/definitions/LibraryType', - }, - umdNamedDefine: { - $ref: '#/definitions/UmdNamedDefine', - }, - }, - required: ['type'], -}; -const schema31 = { - type: 'string', - minLength: 1, -}; -const schema34 = { - anyOf: [ - { - type: 'array', - items: { - type: 'string', - minLength: 1, - }, - }, - { - type: 'string', - minLength: 1, - }, - ], -}; -const schema37 = { - anyOf: [ - { - enum: [ - 'var', - 'module', - 'assign', - 'assign-properties', - 'this', - 'window', - 'self', - 'global', - 'commonjs', - 'commonjs2', - 'commonjs-module', - 'commonjs-static', - 'amd', - 'amd-require', - 'umd', - 'umd2', - 'jsonp', - 'system', - ], - }, - { - type: 'string', - }, - ], -}; -const schema38 = { - type: 'boolean', -}; -const schema32 = { - anyOf: [ - { - type: 'string', - }, - { - $ref: '#/definitions/LibraryCustomUmdCommentObject', - }, - ], -}; -const schema33 = { - type: 'object', - additionalProperties: false, - properties: { - amd: { - type: 'string', - }, - commonjs: { - type: 'string', - }, - commonjs2: { - type: 'string', - }, - root: { - type: 'string', - }, - }, -}; -function validate31( - data, - { instancePath = '', parentData, parentDataProperty, rootData = data } = {}, +function a( + r, + { + instancePath: t = '', + parentData: e, + parentDataProperty: n, + rootData: s = r, + } = {}, ) { - let vErrors = null; - let errors = 0; - const _errs0 = errors; - let valid0 = false; - const _errs1 = errors; - if (typeof data !== 'string') { - const err0 = { + let o = null, + i = 0; + const l = i; + let p = !1; + const f = i; + if ('string' != typeof r) { + const r = { params: { type: 'string', }, }; - if (vErrors === null) { - vErrors = [err0]; - } else { - vErrors.push(err0); - } - errors++; + null === o ? (o = [r]) : o.push(r), i++; } - var _valid0 = _errs1 === errors; - valid0 = valid0 || _valid0; - if (!valid0) { - const _errs3 = errors; - const _errs4 = errors; - if (errors === _errs4) { - if (data && typeof data == 'object' && !Array.isArray(data)) { - const _errs6 = errors; - for (const key0 in data) { + var u = f === i; + if (((p = p || u), !p)) { + const t = i; + if (i == i) + if (r && 'object' == typeof r && !Array.isArray(r)) { + const t = i; + for (const t in r) if ( - !( - key0 === 'amd' || - key0 === 'commonjs' || - key0 === 'commonjs2' || - key0 === 'root' - ) + 'amd' !== t && + 'commonjs' !== t && + 'commonjs2' !== t && + 'root' !== t ) { - const err1 = { + const r = { params: { - additionalProperty: key0, + additionalProperty: t, }, }; - if (vErrors === null) { - vErrors = [err1]; - } else { - vErrors.push(err1); - } - errors++; + null === o ? (o = [r]) : o.push(r), i++; break; } - } - if (_errs6 === errors) { - if (data.amd !== undefined) { - const _errs7 = errors; - if (typeof data.amd !== 'string') { - const err2 = { + if (t === i) { + if (void 0 !== r.amd) { + const t = i; + if ('string' != typeof r.amd) { + const r = { params: { type: 'string', }, }; - if (vErrors === null) { - vErrors = [err2]; - } else { - vErrors.push(err2); - } - errors++; + null === o ? (o = [r]) : o.push(r), i++; } - var valid2 = _errs7 === errors; - } else { - var valid2 = true; - } - if (valid2) { - if (data.commonjs !== undefined) { - const _errs9 = errors; - if (typeof data.commonjs !== 'string') { - const err3 = { + var c = t === i; + } else c = !0; + if (c) { + if (void 0 !== r.commonjs) { + const t = i; + if ('string' != typeof r.commonjs) { + const r = { params: { type: 'string', }, }; - if (vErrors === null) { - vErrors = [err3]; - } else { - vErrors.push(err3); - } - errors++; + null === o ? (o = [r]) : o.push(r), i++; } - var valid2 = _errs9 === errors; - } else { - var valid2 = true; - } - if (valid2) { - if (data.commonjs2 !== undefined) { - const _errs11 = errors; - if (typeof data.commonjs2 !== 'string') { - const err4 = { + c = t === i; + } else c = !0; + if (c) { + if (void 0 !== r.commonjs2) { + const t = i; + if ('string' != typeof r.commonjs2) { + const r = { params: { type: 'string', }, }; - if (vErrors === null) { - vErrors = [err4]; - } else { - vErrors.push(err4); - } - errors++; + null === o ? (o = [r]) : o.push(r), i++; } - var valid2 = _errs11 === errors; - } else { - var valid2 = true; - } - if (valid2) { - if (data.root !== undefined) { - const _errs13 = errors; - if (typeof data.root !== 'string') { - const err5 = { + c = t === i; + } else c = !0; + if (c) + if (void 0 !== r.root) { + const t = i; + if ('string' != typeof r.root) { + const r = { params: { type: 'string', }, }; - if (vErrors === null) { - vErrors = [err5]; - } else { - vErrors.push(err5); - } - errors++; + null === o ? (o = [r]) : o.push(r), i++; } - var valid2 = _errs13 === errors; - } else { - var valid2 = true; - } - } + c = t === i; + } else c = !0; } } } } else { - const err6 = { + const r = { params: { type: 'object', }, }; - if (vErrors === null) { - vErrors = [err6]; - } else { - vErrors.push(err6); - } - errors++; + null === o ? (o = [r]) : o.push(r), i++; } - } - var _valid0 = _errs3 === errors; - valid0 = valid0 || _valid0; + (u = t === i), (p = p || u); } - if (!valid0) { - const err7 = { + if (!p) { + const r = { params: {}, }; - if (vErrors === null) { - vErrors = [err7]; - } else { - vErrors.push(err7); - } - errors++; - validate31.errors = vErrors; - return false; - } else { - errors = _errs0; - if (vErrors !== null) { - if (_errs0) { - vErrors.length = _errs0; - } else { - vErrors = null; - } - } + return null === o ? (o = [r]) : o.push(r), i++, (a.errors = o), !1; } - validate31.errors = vErrors; - return errors === 0; + return ( + (i = l), + null !== o && (l ? (o.length = l) : (o = null)), + (a.errors = o), + 0 === i + ); } -const schema35 = { - anyOf: [ - { - type: 'array', - items: { - type: 'string', - minLength: 1, - }, - minItems: 1, - }, - { - type: 'string', - minLength: 1, - }, - { - $ref: '#/definitions/LibraryCustomUmdObject', - }, - ], -}; -const schema36 = { - type: 'object', - additionalProperties: false, - properties: { - amd: { - type: 'string', - minLength: 1, - }, - commonjs: { - type: 'string', - minLength: 1, - }, - root: { - anyOf: [ - { - type: 'array', - items: { - type: 'string', - minLength: 1, - }, - }, - { - type: 'string', - minLength: 1, - }, - ], - }, - }, -}; -function validate33( - data, - { instancePath = '', parentData, parentDataProperty, rootData = data } = {}, +function o( + r, + { + instancePath: t = '', + parentData: e, + parentDataProperty: n, + rootData: s = r, + } = {}, ) { - let vErrors = null; - let errors = 0; - const _errs0 = errors; - let valid0 = false; - const _errs1 = errors; - if (errors === _errs1) { - if (Array.isArray(data)) { - if (data.length < 1) { - const err0 = { + let a = null, + i = 0; + const l = i; + let p = !1; + const f = i; + if (i === f) + if (Array.isArray(r)) + if (r.length < 1) { + const r = { params: { limit: 1, }, }; - if (vErrors === null) { - vErrors = [err0]; - } else { - vErrors.push(err0); - } - errors++; + null === a ? (a = [r]) : a.push(r), i++; } else { - var valid1 = true; - const len0 = data.length; - for (let i0 = 0; i0 < len0; i0++) { - let data0 = data[i0]; - const _errs3 = errors; - if (errors === _errs3) { - if (typeof data0 === 'string') { - if (data0.length < 1) { - const err1 = { + const t = r.length; + for (let e = 0; e < t; e++) { + let t = r[e]; + const n = i; + if (i === n) + if ('string' == typeof t) { + if (t.length < 1) { + const r = { params: {}, }; - if (vErrors === null) { - vErrors = [err1]; - } else { - vErrors.push(err1); - } - errors++; + null === a ? (a = [r]) : a.push(r), i++; } } else { - const err2 = { + const r = { params: { type: 'string', }, }; - if (vErrors === null) { - vErrors = [err2]; - } else { - vErrors.push(err2); - } - errors++; + null === a ? (a = [r]) : a.push(r), i++; } - } - var valid1 = _errs3 === errors; - if (!valid1) { - break; - } + if (n !== i) break; } } - } else { - const err3 = { + else { + const r = { params: { type: 'array', }, }; - if (vErrors === null) { - vErrors = [err3]; - } else { - vErrors.push(err3); - } - errors++; + null === a ? (a = [r]) : a.push(r), i++; } - } - var _valid0 = _errs1 === errors; - valid0 = valid0 || _valid0; - if (!valid0) { - const _errs5 = errors; - if (errors === _errs5) { - if (typeof data === 'string') { - if (data.length < 1) { - const err4 = { + var u = f === i; + if (((p = p || u), !p)) { + const t = i; + if (i === t) + if ('string' == typeof r) { + if (r.length < 1) { + const r = { params: {}, }; - if (vErrors === null) { - vErrors = [err4]; - } else { - vErrors.push(err4); - } - errors++; + null === a ? (a = [r]) : a.push(r), i++; } } else { - const err5 = { + const r = { params: { type: 'string', }, }; - if (vErrors === null) { - vErrors = [err5]; - } else { - vErrors.push(err5); - } - errors++; + null === a ? (a = [r]) : a.push(r), i++; } - } - var _valid0 = _errs5 === errors; - valid0 = valid0 || _valid0; - if (!valid0) { - const _errs7 = errors; - const _errs8 = errors; - if (errors === _errs8) { - if (data && typeof data == 'object' && !Array.isArray(data)) { - const _errs10 = errors; - for (const key0 in data) { - if (!(key0 === 'amd' || key0 === 'commonjs' || key0 === 'root')) { - const err6 = { + if (((u = t === i), (p = p || u), !p)) { + const t = i; + if (i == i) + if (r && 'object' == typeof r && !Array.isArray(r)) { + const t = i; + for (const t in r) + if ('amd' !== t && 'commonjs' !== t && 'root' !== t) { + const r = { params: { - additionalProperty: key0, + additionalProperty: t, }, }; - if (vErrors === null) { - vErrors = [err6]; - } else { - vErrors.push(err6); - } - errors++; + null === a ? (a = [r]) : a.push(r), i++; break; } - } - if (_errs10 === errors) { - if (data.amd !== undefined) { - let data1 = data.amd; - const _errs11 = errors; - if (errors === _errs11) { - if (typeof data1 === 'string') { - if (data1.length < 1) { - const err7 = { + if (t === i) { + if (void 0 !== r.amd) { + let t = r.amd; + const e = i; + if (i === e) + if ('string' == typeof t) { + if (t.length < 1) { + const r = { params: {}, }; - if (vErrors === null) { - vErrors = [err7]; - } else { - vErrors.push(err7); - } - errors++; + null === a ? (a = [r]) : a.push(r), i++; } } else { - const err8 = { + const r = { params: { type: 'string', }, }; - if (vErrors === null) { - vErrors = [err8]; - } else { - vErrors.push(err8); - } - errors++; + null === a ? (a = [r]) : a.push(r), i++; } - } - var valid3 = _errs11 === errors; - } else { - var valid3 = true; - } - if (valid3) { - if (data.commonjs !== undefined) { - let data2 = data.commonjs; - const _errs13 = errors; - if (errors === _errs13) { - if (typeof data2 === 'string') { - if (data2.length < 1) { - const err9 = { + var c = e === i; + } else c = !0; + if (c) { + if (void 0 !== r.commonjs) { + let t = r.commonjs; + const e = i; + if (i === e) + if ('string' == typeof t) { + if (t.length < 1) { + const r = { params: {}, }; - if (vErrors === null) { - vErrors = [err9]; - } else { - vErrors.push(err9); - } - errors++; + null === a ? (a = [r]) : a.push(r), i++; } } else { - const err10 = { + const r = { params: { type: 'string', }, }; - if (vErrors === null) { - vErrors = [err10]; - } else { - vErrors.push(err10); - } - errors++; + null === a ? (a = [r]) : a.push(r), i++; } - } - var valid3 = _errs13 === errors; - } else { - var valid3 = true; - } - if (valid3) { - if (data.root !== undefined) { - let data3 = data.root; - const _errs15 = errors; - const _errs16 = errors; - let valid4 = false; - const _errs17 = errors; - if (errors === _errs17) { - if (Array.isArray(data3)) { - var valid5 = true; - const len1 = data3.length; - for (let i1 = 0; i1 < len1; i1++) { - let data4 = data3[i1]; - const _errs19 = errors; - if (errors === _errs19) { - if (typeof data4 === 'string') { - if (data4.length < 1) { - const err11 = { + c = e === i; + } else c = !0; + if (c) + if (void 0 !== r.root) { + let t = r.root; + const e = i, + n = i; + let s = !1; + const o = i; + if (i === o) + if (Array.isArray(t)) { + const r = t.length; + for (let e = 0; e < r; e++) { + let r = t[e]; + const n = i; + if (i === n) + if ('string' == typeof r) { + if (r.length < 1) { + const r = { params: {}, }; - if (vErrors === null) { - vErrors = [err11]; - } else { - vErrors.push(err11); - } - errors++; + null === a ? (a = [r]) : a.push(r), i++; } } else { - const err12 = { + const r = { params: { type: 'string', }, }; - if (vErrors === null) { - vErrors = [err12]; - } else { - vErrors.push(err12); - } - errors++; + null === a ? (a = [r]) : a.push(r), i++; } - } - var valid5 = _errs19 === errors; - if (!valid5) { - break; - } + if (n !== i) break; } } else { - const err13 = { + const r = { params: { type: 'array', }, }; - if (vErrors === null) { - vErrors = [err13]; - } else { - vErrors.push(err13); - } - errors++; + null === a ? (a = [r]) : a.push(r), i++; } - } - var _valid1 = _errs17 === errors; - valid4 = valid4 || _valid1; - if (!valid4) { - const _errs21 = errors; - if (errors === _errs21) { - if (typeof data3 === 'string') { - if (data3.length < 1) { - const err14 = { + var m = o === i; + if (((s = s || m), !s)) { + const r = i; + if (i === r) + if ('string' == typeof t) { + if (t.length < 1) { + const r = { params: {}, }; - if (vErrors === null) { - vErrors = [err14]; - } else { - vErrors.push(err14); - } - errors++; + null === a ? (a = [r]) : a.push(r), i++; } } else { - const err15 = { + const r = { params: { type: 'string', }, }; - if (vErrors === null) { - vErrors = [err15]; - } else { - vErrors.push(err15); - } - errors++; + null === a ? (a = [r]) : a.push(r), i++; } - } - var _valid1 = _errs21 === errors; - valid4 = valid4 || _valid1; + (m = r === i), (s = s || m); } - if (!valid4) { - const err16 = { + if (s) + (i = n), null !== a && (n ? (a.length = n) : (a = null)); + else { + const r = { params: {}, }; - if (vErrors === null) { - vErrors = [err16]; - } else { - vErrors.push(err16); - } - errors++; - } else { - errors = _errs16; - if (vErrors !== null) { - if (_errs16) { - vErrors.length = _errs16; - } else { - vErrors = null; - } - } + null === a ? (a = [r]) : a.push(r), i++; } - var valid3 = _errs15 === errors; - } else { - var valid3 = true; - } - } + c = e === i; + } else c = !0; } } } else { - const err17 = { + const r = { params: { type: 'object', }, }; - if (vErrors === null) { - vErrors = [err17]; - } else { - vErrors.push(err17); - } - errors++; + null === a ? (a = [r]) : a.push(r), i++; } - } - var _valid0 = _errs7 === errors; - valid0 = valid0 || _valid0; + (u = t === i), (p = p || u); } } - if (!valid0) { - const err18 = { + if (!p) { + const r = { params: {}, }; - if (vErrors === null) { - vErrors = [err18]; - } else { - vErrors.push(err18); - } - errors++; - validate33.errors = vErrors; - return false; - } else { - errors = _errs0; - if (vErrors !== null) { - if (_errs0) { - vErrors.length = _errs0; - } else { - vErrors = null; - } - } + return null === a ? (a = [r]) : a.push(r), i++, (o.errors = a), !1; } - validate33.errors = vErrors; - return errors === 0; + return ( + (i = l), + null !== a && (l ? (a.length = l) : (a = null)), + (o.errors = a), + 0 === i + ); } -function validate30( - data, - { instancePath = '', parentData, parentDataProperty, rootData = data } = {}, +function i( + r, + { + instancePath: t = '', + parentData: e, + parentDataProperty: n, + rootData: s = r, + } = {}, ) { - let vErrors = null; - let errors = 0; - if (errors === 0) { - if (data && typeof data == 'object' && !Array.isArray(data)) { - let missing0; - if (data.type === undefined && (missing0 = 'type')) { - validate30.errors = [ + let l = null, + p = 0; + if (0 === p) { + if (!r || 'object' != typeof r || Array.isArray(r)) + return ( + (i.errors = [ { params: { - missingProperty: missing0, + type: 'object', }, }, - ]; - return false; - } else { - const _errs1 = errors; - for (const key0 in data) { + ]), + !1 + ); + { + let e; + if (void 0 === r.type && (e = 'type')) + return ( + (i.errors = [ + { + params: { + missingProperty: e, + }, + }, + ]), + !1 + ); + { + const e = p; + for (const t in r) if ( - !( - key0 === 'amdContainer' || - key0 === 'auxiliaryComment' || - key0 === 'export' || - key0 === 'name' || - key0 === 'type' || - key0 === 'umdNamedDefine' - ) - ) { - validate30.errors = [ - { - params: { - additionalProperty: key0, + 'amdContainer' !== t && + 'auxiliaryComment' !== t && + 'export' !== t && + 'name' !== t && + 'type' !== t && + 'umdNamedDefine' !== t + ) + return ( + (i.errors = [ + { + params: { + additionalProperty: t, + }, }, - }, - ]; - return false; - break; - } - } - if (_errs1 === errors) { - if (data.amdContainer !== undefined) { - let data0 = data.amdContainer; - const _errs2 = errors; - const _errs3 = errors; - if (errors === _errs3) { - if (typeof data0 === 'string') { - if (data0.length < 1) { - validate30.errors = [ + ]), + !1 + ); + if (e === p) { + if (void 0 !== r.amdContainer) { + let t = r.amdContainer; + const e = p; + if (p == p) { + if ('string' != typeof t) + return ( + (i.errors = [ + { + params: { + type: 'string', + }, + }, + ]), + !1 + ); + if (t.length < 1) + return ( + (i.errors = [ { params: {}, }, - ]; - return false; - } - } else { - validate30.errors = [ - { - params: { - type: 'string', - }, - }, - ]; - return false; - } - } - var valid0 = _errs2 === errors; - } else { - var valid0 = true; - } - if (valid0) { - if (data.auxiliaryComment !== undefined) { - const _errs5 = errors; - if ( - !validate31(data.auxiliaryComment, { - instancePath: instancePath + '/auxiliaryComment', - parentData: data, - parentDataProperty: 'auxiliaryComment', - rootData, - }) - ) { - vErrors = - vErrors === null - ? validate31.errors - : vErrors.concat(validate31.errors); - errors = vErrors.length; - } - var valid0 = _errs5 === errors; - } else { - var valid0 = true; + ]), + !1 + ); } - if (valid0) { - if (data.export !== undefined) { - let data2 = data.export; - const _errs6 = errors; - const _errs8 = errors; - let valid3 = false; - const _errs9 = errors; - if (errors === _errs9) { - if (Array.isArray(data2)) { - var valid4 = true; - const len0 = data2.length; - for (let i0 = 0; i0 < len0; i0++) { - let data3 = data2[i0]; - const _errs11 = errors; - if (errors === _errs11) { - if (typeof data3 === 'string') { - if (data3.length < 1) { - const err0 = { + var f = e === p; + } else f = !0; + if (f) { + if (void 0 !== r.auxiliaryComment) { + const e = p; + a(r.auxiliaryComment, { + instancePath: t + '/auxiliaryComment', + parentData: r, + parentDataProperty: 'auxiliaryComment', + rootData: s, + }) || + ((l = null === l ? a.errors : l.concat(a.errors)), + (p = l.length)), + (f = e === p); + } else f = !0; + if (f) { + if (void 0 !== r.export) { + let t = r.export; + const e = p, + n = p; + let s = !1; + const a = p; + if (p === a) + if (Array.isArray(t)) { + const r = t.length; + for (let e = 0; e < r; e++) { + let r = t[e]; + const n = p; + if (p === n) + if ('string' == typeof r) { + if (r.length < 1) { + const r = { params: {}, }; - if (vErrors === null) { - vErrors = [err0]; - } else { - vErrors.push(err0); - } - errors++; + null === l ? (l = [r]) : l.push(r), p++; } } else { - const err1 = { + const r = { params: { type: 'string', }, }; - if (vErrors === null) { - vErrors = [err1]; - } else { - vErrors.push(err1); - } - errors++; + null === l ? (l = [r]) : l.push(r), p++; } - } - var valid4 = _errs11 === errors; - if (!valid4) { - break; - } + if (n !== p) break; } } else { - const err2 = { + const r = { params: { type: 'array', }, }; - if (vErrors === null) { - vErrors = [err2]; - } else { - vErrors.push(err2); - } - errors++; + null === l ? (l = [r]) : l.push(r), p++; } - } - var _valid0 = _errs9 === errors; - valid3 = valid3 || _valid0; - if (!valid3) { - const _errs13 = errors; - if (errors === _errs13) { - if (typeof data2 === 'string') { - if (data2.length < 1) { - const err3 = { + var u = a === p; + if (((s = s || u), !s)) { + const r = p; + if (p === r) + if ('string' == typeof t) { + if (t.length < 1) { + const r = { params: {}, }; - if (vErrors === null) { - vErrors = [err3]; - } else { - vErrors.push(err3); - } - errors++; + null === l ? (l = [r]) : l.push(r), p++; } } else { - const err4 = { + const r = { params: { type: 'string', }, }; - if (vErrors === null) { - vErrors = [err4]; - } else { - vErrors.push(err4); - } - errors++; + null === l ? (l = [r]) : l.push(r), p++; } - } - var _valid0 = _errs13 === errors; - valid3 = valid3 || _valid0; + (u = r === p), (s = s || u); } - if (!valid3) { - const err5 = { + if (!s) { + const r = { params: {}, }; - if (vErrors === null) { - vErrors = [err5]; - } else { - vErrors.push(err5); - } - errors++; - validate30.errors = vErrors; - return false; - } else { - errors = _errs8; - if (vErrors !== null) { - if (_errs8) { - vErrors.length = _errs8; - } else { - vErrors = null; - } - } - } - var valid0 = _errs6 === errors; - } else { - var valid0 = true; - } - if (valid0) { - if (data.name !== undefined) { - const _errs15 = errors; - if ( - !validate33(data.name, { - instancePath: instancePath + '/name', - parentData: data, - parentDataProperty: 'name', - rootData, - }) - ) { - vErrors = - vErrors === null - ? validate33.errors - : vErrors.concat(validate33.errors); - errors = vErrors.length; - } - var valid0 = _errs15 === errors; - } else { - var valid0 = true; + return ( + null === l ? (l = [r]) : l.push(r), p++, (i.errors = l), !1 + ); } - if (valid0) { - if (data.type !== undefined) { - let data5 = data.type; - const _errs16 = errors; - const _errs18 = errors; - let valid6 = false; - const _errs19 = errors; + (p = n), + null !== l && (n ? (l.length = n) : (l = null)), + (f = e === p); + } else f = !0; + if (f) { + if (void 0 !== r.name) { + const e = p; + o(r.name, { + instancePath: t + '/name', + parentData: r, + parentDataProperty: 'name', + rootData: s, + }) || + ((l = null === l ? o.errors : l.concat(o.errors)), + (p = l.length)), + (f = e === p); + } else f = !0; + if (f) { + if (void 0 !== r.type) { + let t = r.type; + const e = p, + n = p; + let s = !1; + const a = p; if ( - data5 !== 'var' && - data5 !== 'module' && - data5 !== 'assign' && - data5 !== 'assign-properties' && - data5 !== 'this' && - data5 !== 'window' && - data5 !== 'self' && - data5 !== 'global' && - data5 !== 'commonjs' && - data5 !== 'commonjs2' && - data5 !== 'commonjs-module' && - data5 !== 'commonjs-static' && - data5 !== 'amd' && - data5 !== 'amd-require' && - data5 !== 'umd' && - data5 !== 'umd2' && - data5 !== 'jsonp' && - data5 !== 'system' + 'var' !== t && + 'module' !== t && + 'assign' !== t && + 'assign-properties' !== t && + 'this' !== t && + 'window' !== t && + 'self' !== t && + 'global' !== t && + 'commonjs' !== t && + 'commonjs2' !== t && + 'commonjs-module' !== t && + 'commonjs-static' !== t && + 'amd' !== t && + 'amd-require' !== t && + 'umd' !== t && + 'umd2' !== t && + 'jsonp' !== t && + 'system' !== t ) { - const err6 = { + const r = { params: {}, }; - if (vErrors === null) { - vErrors = [err6]; - } else { - vErrors.push(err6); - } - errors++; + null === l ? (l = [r]) : l.push(r), p++; } - var _valid1 = _errs19 === errors; - valid6 = valid6 || _valid1; - if (!valid6) { - const _errs20 = errors; - if (typeof data5 !== 'string') { - const err7 = { + var c = a === p; + if (((s = s || c), !s)) { + const r = p; + if ('string' != typeof t) { + const r = { params: { type: 'string', }, }; - if (vErrors === null) { - vErrors = [err7]; - } else { - vErrors.push(err7); - } - errors++; + null === l ? (l = [r]) : l.push(r), p++; } - var _valid1 = _errs20 === errors; - valid6 = valid6 || _valid1; + (c = r === p), (s = s || c); } - if (!valid6) { - const err8 = { + if (!s) { + const r = { params: {}, }; - if (vErrors === null) { - vErrors = [err8]; - } else { - vErrors.push(err8); - } - errors++; - validate30.errors = vErrors; - return false; - } else { - errors = _errs18; - if (vErrors !== null) { - if (_errs18) { - vErrors.length = _errs18; - } else { - vErrors = null; - } - } + return ( + null === l ? (l = [r]) : l.push(r), + p++, + (i.errors = l), + !1 + ); } - var valid0 = _errs16 === errors; - } else { - var valid0 = true; - } - if (valid0) { - if (data.umdNamedDefine !== undefined) { - const _errs22 = errors; - if (typeof data.umdNamedDefine !== 'boolean') { - validate30.errors = [ - { - params: { - type: 'boolean', + (p = n), + null !== l && (n ? (l.length = n) : (l = null)), + (f = e === p); + } else f = !0; + if (f) + if (void 0 !== r.umdNamedDefine) { + const t = p; + if ('boolean' != typeof r.umdNamedDefine) + return ( + (i.errors = [ + { + params: { + type: 'boolean', + }, }, - }, - ]; - return false; - } - var valid0 = _errs22 === errors; - } else { - var valid0 = true; - } - } + ]), + !1 + ); + f = t === p; + } else f = !0; } } } } } } - } else { - validate30.errors = [ - { - params: { - type: 'object', - }, - }, - ]; - return false; } } - validate30.errors = vErrors; - return errors === 0; + return (i.errors = l), 0 === p; } -function validate19( - data, - { instancePath = '', parentData, parentDataProperty, rootData = data } = {}, +function l( + t, + { + instancePath: e = '', + parentData: n, + parentDataProperty: a, + rootData: o = t, + } = {}, ) { - /*# sourceURL="" */ let vErrors = null; - let errors = 0; - if (errors === 0) { - if (data && typeof data == 'object' && !Array.isArray(data)) { - let missing0; - if ( - (data.name === undefined && (missing0 = 'name')) || - (data.exposes === undefined && (missing0 = 'exposes')) - ) { - validate19.errors = [ + let p = null, + f = 0; + if (0 === f) { + if (!t || 'object' != typeof t || Array.isArray(t)) + return ( + (l.errors = [ { params: { - missingProperty: missing0, + type: 'object', }, }, - ]; - return false; - } else { - const _errs1 = errors; - for (const key0 in data) { + ]), + !1 + ); + { + let n; + if ( + (void 0 === t.name && (n = 'name')) || + (void 0 === t.exposes && (n = 'exposes')) + ) + return ( + (l.errors = [ + { + params: { + missingProperty: n, + }, + }, + ]), + !1 + ); + { + const n = f; + for (const r in t) if ( - !( - key0 === 'exposes' || - key0 === 'filename' || - key0 === 'library' || - key0 === 'name' || - key0 === 'runtime' || - key0 === 'runtimePlugins' || - key0 === 'shareScope' || - key0 === 'experiments' - ) - ) { - validate19.errors = [ - { - params: { - additionalProperty: key0, + 'experiments' !== r && + 'exposes' !== r && + 'filename' !== r && + 'library' !== r && + 'name' !== r && + 'runtime' !== r && + 'runtimePlugins' !== r && + 'shareScope' !== r + ) + return ( + (l.errors = [ + { + params: { + additionalProperty: r, + }, }, - }, - ]; - return false; - break; - } - } - if (_errs1 === errors) { - if (data.exposes !== undefined) { - const _errs2 = errors; - if ( - !validate20(data.exposes, { - instancePath: instancePath + '/exposes', - parentData: data, - parentDataProperty: 'exposes', - rootData, - }) - ) { - vErrors = - vErrors === null - ? validate20.errors - : vErrors.concat(validate20.errors); - errors = vErrors.length; - } - var valid0 = _errs2 === errors; - } else { - var valid0 = true; - } - if (valid0) { - if (data.filename !== undefined) { - let data1 = data.filename; - const _errs3 = errors; - if (errors === _errs3) { - if (typeof data1 === 'string') { - if ( - data1.includes('!') || - absolutePathRegExp.test(data1) !== false - ) { - validate19.errors = [ - { - params: {}, - }, - ]; - return false; - } else { - if (data1.length < 1) { - validate19.errors = [ - { - params: {}, - }, - ]; - return false; - } - } - } else { - validate19.errors = [ + ]), + !1 + ); + if (n === f) { + if (void 0 !== t.experiments) { + let r = t.experiments; + const e = f; + if (f === e) { + if (!r || 'object' != typeof r || Array.isArray(r)) + return ( + (l.errors = [ { params: { - type: 'string', + type: 'object', }, }, - ]; - return false; - } - } - var valid0 = _errs3 === errors; - } else { - var valid0 = true; - } - if (valid0) { - if (data.library !== undefined) { - const _errs5 = errors; - if ( - !validate30(data.library, { - instancePath: instancePath + '/library', - parentData: data, - parentDataProperty: 'library', - rootData, - }) - ) { - vErrors = - vErrors === null - ? validate30.errors - : vErrors.concat(validate30.errors); - errors = vErrors.length; - } - var valid0 = _errs5 === errors; - } else { - var valid0 = true; - } - if (valid0) { - if (data.name !== undefined) { - let data3 = data.name; - const _errs6 = errors; - if (errors === _errs6) { - if (typeof data3 === 'string') { - if (data3.length < 1) { - validate19.errors = [ - { - params: {}, - }, - ]; - return false; - } - } else { - validate19.errors = [ + ]), + !1 + ); + { + const t = f; + for (const t in r) + if ( + 'externalRuntime' !== t && + 'federationRuntime' !== t && + 'provideExternalRuntime' !== t + ) + return ( + (l.errors = [ { params: { - type: 'string', + additionalProperty: t, }, }, - ]; - return false; - } - } - var valid0 = _errs6 === errors; - } else { - var valid0 = true; - } - if (valid0) { - if (data.runtime !== undefined) { - let data4 = data.runtime; - const _errs8 = errors; - const _errs10 = errors; - let valid2 = false; - const _errs11 = errors; - if (data4 !== false) { - const err0 = { - params: {}, - }; - if (vErrors === null) { - vErrors = [err0]; - } else { - vErrors.push(err0); + ]), + !1 + ); + if (t === f) { + if (void 0 !== r.externalRuntime) { + const t = f; + if ('boolean' != typeof r.externalRuntime) + return ( + (l.errors = [ + { + params: { + type: 'boolean', + }, + }, + ]), + !1 + ); + var u = t === f; + } else u = !0; + if (u) { + if (void 0 !== r.federationRuntime) { + let t = r.federationRuntime; + const e = f, + n = f; + let s = !1; + const a = f; + if ('hoisted' !== t) { + const r = { + params: {}, + }; + null === p ? (p = [r]) : p.push(r), f++; } - errors++; - } - var _valid0 = _errs11 === errors; - valid2 = valid2 || _valid0; - if (!valid2) { - const _errs12 = errors; - if (errors === _errs12) { - if (typeof data4 === 'string') { - if (data4.length < 1) { - const err1 = { - params: {}, - }; - if (vErrors === null) { - vErrors = [err1]; - } else { - vErrors.push(err1); - } - errors++; - } - } else { - const err2 = { + var c = a === f; + if (((s = s || c), !s)) { + const r = f; + if ('boolean' != typeof t) { + const r = { params: { - type: 'string', + type: 'boolean', }, }; - if (vErrors === null) { - vErrors = [err2]; - } else { - vErrors.push(err2); - } - errors++; + null === p ? (p = [r]) : p.push(r), f++; } + (c = r === f), (s = s || c); } - var _valid0 = _errs12 === errors; - valid2 = valid2 || _valid0; - } - if (!valid2) { - const err3 = { - params: {}, - }; - if (vErrors === null) { - vErrors = [err3]; - } else { - vErrors.push(err3); - } - errors++; - validate19.errors = vErrors; - return false; - } else { - errors = _errs10; - if (vErrors !== null) { - if (_errs10) { - vErrors.length = _errs10; - } else { - vErrors = null; - } + if (!s) { + const r = { + params: {}, + }; + return ( + null === p ? (p = [r]) : p.push(r), + f++, + (l.errors = p), + !1 + ); } - } - var valid0 = _errs8 === errors; - } else { - var valid0 = true; + (f = n), + null !== p && (n ? (p.length = n) : (p = null)), + (u = e === f); + } else u = !0; + if (u) + if (void 0 !== r.provideExternalRuntime) { + const t = f; + if ('boolean' != typeof r.provideExternalRuntime) + return ( + (l.errors = [ + { + params: { + type: 'boolean', + }, + }, + ]), + !1 + ); + u = t === f; + } else u = !0; } - if (valid0) { - if (data.runtimePlugins !== undefined) { - let data5 = data.runtimePlugins; - const _errs14 = errors; - if (errors === _errs14) { - if (Array.isArray(data5)) { - var valid3 = true; - const len0 = data5.length; - for (let i0 = 0; i0 < len0; i0++) { - let data6 = data5[i0]; - const _errs16 = errors; - if (errors === _errs16) { - if (typeof data6 === 'string') { - if (data6.length < 1) { - validate19.errors = [ - { - params: {}, - }, - ]; - return false; - } - } else { - validate19.errors = [ - { - params: { - type: 'string', - }, - }, - ]; - return false; - } - } - var valid3 = _errs16 === errors; - if (!valid3) { - break; - } - } - } else { - validate19.errors = [ + } + } + } + var m = e === f; + } else m = !0; + if (m) { + if (void 0 !== t.exposes) { + const r = f; + s(t.exposes, { + instancePath: e + '/exposes', + parentData: t, + parentDataProperty: 'exposes', + rootData: o, + }) || + ((p = null === p ? s.errors : p.concat(s.errors)), + (f = p.length)), + (m = r === f); + } else m = !0; + if (m) { + if (void 0 !== t.filename) { + let e = t.filename; + const n = f; + if (f === n) { + if ('string' != typeof e) + return ( + (l.errors = [ + { + params: { + type: 'string', + }, + }, + ]), + !1 + ); + if (e.includes('!') || !1 !== r.test(e)) + return ( + (l.errors = [ + { + params: {}, + }, + ]), + !1 + ); + if (e.length < 1) + return ( + (l.errors = [ + { + params: {}, + }, + ]), + !1 + ); + } + m = n === f; + } else m = !0; + if (m) { + if (void 0 !== t.library) { + const r = f; + i(t.library, { + instancePath: e + '/library', + parentData: t, + parentDataProperty: 'library', + rootData: o, + }) || + ((p = null === p ? i.errors : p.concat(i.errors)), + (f = p.length)), + (m = r === f); + } else m = !0; + if (m) { + if (void 0 !== t.name) { + let r = t.name; + const e = f; + if (f === e) { + if ('string' != typeof r) + return ( + (l.errors = [ { params: { - type: 'array', + type: 'string', }, }, - ]; - return false; - } - } - var valid0 = _errs14 === errors; - } else { - var valid0 = true; + ]), + !1 + ); + if (r.length < 1) + return ( + (l.errors = [ + { + params: {}, + }, + ]), + !1 + ); } - if (valid0) { - if (data.shareScope !== undefined) { - let data7 = data.shareScope; - const _errs18 = errors; - if (errors === _errs18) { - if (typeof data7 === 'string') { - if (data7.length < 1) { - validate19.errors = [ - { - params: {}, - }, - ]; - return false; + m = e === f; + } else m = !0; + if (m) { + if (void 0 !== t.runtime) { + let r = t.runtime; + const e = f, + n = f; + let s = !1; + const a = f; + if (!1 !== r) { + const r = { + params: {}, + }; + null === p ? (p = [r]) : p.push(r), f++; + } + var y = a === f; + if (((s = s || y), !s)) { + const t = f; + if (f === t) + if ('string' == typeof r) { + if (r.length < 1) { + const r = { + params: {}, + }; + null === p ? (p = [r]) : p.push(r), f++; } } else { - validate19.errors = [ - { - params: { - type: 'string', - }, + const r = { + params: { + type: 'string', }, - ]; - return false; + }; + null === p ? (p = [r]) : p.push(r), f++; } - } - var valid0 = _errs18 === errors; - } else { - var valid0 = true; + (y = t === f), (s = s || y); } - if (valid0) { - if (data.experiments !== undefined) { - let data8 = data.experiments; - const _errs20 = errors; - if (errors === _errs20) { - if ( - typeof data8 === 'object' && - !Array.isArray(data8) - ) { - let missing1; - if ( - data8.federationRuntime === undefined && - (missing1 = 'federationRuntime') - ) { - validate19.errors = [ - { + if (!s) { + const r = { + params: {}, + }; + return ( + null === p ? (p = [r]) : p.push(r), + f++, + (l.errors = p), + !1 + ); + } + (f = n), + null !== p && (n ? (p.length = n) : (p = null)), + (m = e === f); + } else m = !0; + if (m) { + if (void 0 !== t.runtimePlugins) { + let r = t.runtimePlugins; + const e = f; + if (f === e) { + if (!Array.isArray(r)) + return ( + (l.errors = [ + { + params: { + type: 'array', + }, + }, + ]), + !1 + ); + { + const t = r.length; + for (let e = 0; e < t; e++) { + let t = r[e]; + const n = f, + s = f; + let a = !1; + const o = f; + if (f === o) + if ('string' == typeof t) { + if (t.length < 1) { + const r = { + params: {}, + }; + null === p ? (p = [r]) : p.push(r), f++; + } + } else { + const r = { params: { - missingProperty: missing1, + type: 'string', }, - }, - ]; - return false; - } else { - const _errs21 = errors; - for (const key1 in data8) { - if (!(key1 === 'federationRuntime')) { - validate19.errors = [ - { + }; + null === p ? (p = [r]) : p.push(r), f++; + } + var h = o === f; + if (((a = a || h), !a)) { + const r = f; + if (f === r) + if ( + t && + 'object' == typeof t && + !Array.isArray(t) + ) { + let r; + if ( + (void 0 === t.import && (r = 'import')) || + (void 0 === t.async && (r = 'async')) + ) { + const t = { params: { - additionalProperty: key1, + missingProperty: r, }, - }, - ]; - return false; - break; - } - } - if (_errs21 === errors) { - if (data8.federationRuntime !== undefined) { - let data9 = data8.federationRuntime; - const _errs22 = errors; - if (errors === _errs22) { - if ( - typeof data9 === 'boolean' || - (typeof data9 === 'string' && - data9 === 'hoisted') - ) { - // Valid - } else { - validate19.errors = [ - { + }; + null === p ? (p = [t]) : p.push(t), f++; + } else { + const r = f; + for (const r in t) + if ('async' !== r && 'import' !== r) { + const t = { params: { - type: 'boolean or "hoisted"', + additionalProperty: r, }, - }, - ]; - return false; + }; + null === p ? (p = [t]) : p.push(t), + f++; + break; + } + if (r === f) { + if (void 0 !== t.async) { + const r = f; + if ('boolean' != typeof t.async) { + const r = { + params: { + type: 'boolean', + }, + }; + null === p ? (p = [r]) : p.push(r), + f++; + } + var g = r === f; + } else g = !0; + if (g) + if (void 0 !== t.import) { + let r = t.import; + const e = f; + if (f === e) + if ('string' == typeof r) { + if (r.length < 1) { + const r = { + params: {}, + }; + null === p + ? (p = [r]) + : p.push(r), + f++; + } + } else { + const r = { + params: { + type: 'string', + }, + }; + null === p + ? (p = [r]) + : p.push(r), + f++; + } + g = e === f; + } else g = !0; } } - var valid0 = _errs22 === errors; } else { - var valid0 = true; + const r = { + params: { + type: 'object', + }, + }; + null === p ? (p = [r]) : p.push(r), f++; } - } + (h = r === f), (a = a || h); } - } else { - validate19.errors = [ - { - params: { - type: 'object', - }, - }, - ]; - return false; + if (!a) { + const r = { + params: {}, + }; + return ( + null === p ? (p = [r]) : p.push(r), + f++, + (l.errors = p), + !1 + ); + } + if ( + ((f = s), + null !== p && (s ? (p.length = s) : (p = null)), + n !== f) + ) + break; } } - var valid0 = _errs20 === errors; - } else { - var valid0 = true; } - } + m = e === f; + } else m = !0; + if (m) + if (void 0 !== t.shareScope) { + let r = t.shareScope; + const e = f; + if (f === e) { + if ('string' != typeof r) + return ( + (l.errors = [ + { + params: { + type: 'string', + }, + }, + ]), + !1 + ); + if (r.length < 1) + return ( + (l.errors = [ + { + params: {}, + }, + ]), + !1 + ); + } + m = e === f; + } else m = !0; } } } @@ -2333,18 +1476,8 @@ function validate19( } } } - } else { - validate19.errors = [ - { - params: { - type: 'object', - }, - }, - ]; - return false; } } - validate19.errors = vErrors; - return errors === 0; + return (l.errors = p), 0 === f; } -export default validate19; +export default l; diff --git a/packages/enhanced/src/schemas/container/ContainerPlugin.ts b/packages/enhanced/src/schemas/container/ContainerPlugin.ts index bd4fc7b7917..58747f5a66d 100644 --- a/packages/enhanced/src/schemas/container/ContainerPlugin.ts +++ b/packages/enhanced/src/schemas/container/ContainerPlugin.ts @@ -343,6 +343,9 @@ export default { federationRuntime: { anyOf: [{ type: 'boolean' }, { enum: ['hoisted'] }], }, + externalRuntime: { + anyOf: [{ type: 'boolean' }, { enum: ['provide'] }], + }, }, additionalProperties: false, }, diff --git a/packages/error-codes/CHANGELOG.md b/packages/error-codes/CHANGELOG.md index f307c928600..e1d26693d7a 100644 --- a/packages/error-codes/CHANGELOG.md +++ b/packages/error-codes/CHANGELOG.md @@ -1,5 +1,12 @@ # @module-federation/error-codes +## 0.8.7 + +### Patch Changes + +- 336f3d8: fix(enhanced): abort process if not find expose modules +- 4fd33fb: fix: throw RUNTIME-008 Error when script resources load failed + ## 0.8.6 ## 0.8.5 diff --git a/packages/error-codes/package.json b/packages/error-codes/package.json index d02eb5e4614..385fd888e93 100644 --- a/packages/error-codes/package.json +++ b/packages/error-codes/package.json @@ -4,7 +4,7 @@ "author": "zhanghang ", "public": true, "sideEffects": false, - "version": "0.8.6", + "version": "0.8.7", "license": "MIT", "repository": { "type": "git", diff --git a/packages/esbuild/CHANGELOG.md b/packages/esbuild/CHANGELOG.md index 313f27329e1..f6a7af0bd1f 100644 --- a/packages/esbuild/CHANGELOG.md +++ b/packages/esbuild/CHANGELOG.md @@ -1,5 +1,14 @@ # @module-federation/esbuild +## 0.0.50 + +### Patch Changes + +- Updated dependencies [835b09c] +- Updated dependencies [336f3d8] +- Updated dependencies [4fd33fb] + - @module-federation/sdk@0.8.7 + ## 0.0.49 ### Patch Changes diff --git a/packages/esbuild/package.json b/packages/esbuild/package.json index 268f60da35f..47865b092ee 100644 --- a/packages/esbuild/package.json +++ b/packages/esbuild/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/esbuild", - "version": "0.0.49", + "version": "0.0.50", "author": "Zack Jackson (@ScriptedAlchemy)", "main": "./dist/index.cjs.js", "module": "./dist/index.esm.js", diff --git a/packages/managers/CHANGELOG.md b/packages/managers/CHANGELOG.md index ebe504892c7..b152c05f4f6 100644 --- a/packages/managers/CHANGELOG.md +++ b/packages/managers/CHANGELOG.md @@ -1,5 +1,14 @@ # @module-federation/managers +## 0.8.7 + +### Patch Changes + +- Updated dependencies [835b09c] +- Updated dependencies [336f3d8] +- Updated dependencies [4fd33fb] + - @module-federation/sdk@0.8.7 + ## 0.8.6 ### Patch Changes diff --git a/packages/managers/package.json b/packages/managers/package.json index 1c623bc19b7..9038fd99db4 100644 --- a/packages/managers/package.json +++ b/packages/managers/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/managers", - "version": "0.8.6", + "version": "0.8.7", "license": "MIT", "description": "Provide managers for helping handle mf data .", "keywords": [ @@ -33,9 +33,9 @@ }, "exports": { ".": { + "types": "./dist/index.cjs.d.ts", "import": "./dist/index.esm.js", - "require": "./dist/index.cjs.js", - "types": "./dist/index.cjs.d.ts" + "require": "./dist/index.cjs.js" } }, "typesVersions": { diff --git a/packages/manifest/CHANGELOG.md b/packages/manifest/CHANGELOG.md index 09acd7380f8..a2bbffbc16f 100644 --- a/packages/manifest/CHANGELOG.md +++ b/packages/manifest/CHANGELOG.md @@ -1,5 +1,16 @@ # @module-federation/manifest +## 0.8.7 + +### Patch Changes + +- Updated dependencies [835b09c] +- Updated dependencies [336f3d8] +- Updated dependencies [4fd33fb] + - @module-federation/sdk@0.8.7 + - @module-federation/dts-plugin@0.8.7 + - @module-federation/managers@0.8.7 + ## 0.8.6 ### Patch Changes diff --git a/packages/manifest/package.json b/packages/manifest/package.json index d775b39591e..a853d43b715 100644 --- a/packages/manifest/package.json +++ b/packages/manifest/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/manifest", - "version": "0.8.6", + "version": "0.8.7", "license": "MIT", "description": "Provide manifest/stats for webpack/rspack MF project .", "keywords": [ @@ -35,9 +35,9 @@ }, "exports": { ".": { + "types": "./dist/index.cjs.d.ts", "import": "./dist/index.esm.js", - "require": "./dist/index.cjs.js", - "types": "./dist/index.cjs.d.ts" + "require": "./dist/index.cjs.js" } }, "typesVersions": { diff --git a/packages/modernjs/CHANGELOG.md b/packages/modernjs/CHANGELOG.md index 63bd682c4b0..231672010ab 100644 --- a/packages/modernjs/CHANGELOG.md +++ b/packages/modernjs/CHANGELOG.md @@ -1,5 +1,19 @@ # @module-federation/modern-js +## 0.8.7 + +### Patch Changes + +- 5f67582: chore(modern-js-plugin): add ssr option +- Updated dependencies [835b09c] +- Updated dependencies [f573ad0] +- Updated dependencies [336f3d8] +- Updated dependencies [4fd33fb] + - @module-federation/sdk@0.8.7 + - @module-federation/enhanced@0.8.7 + - @module-federation/node@2.6.20 + - @module-federation/rsbuild-plugin@0.8.7 + ## 0.8.6 ### Patch Changes diff --git a/packages/modernjs/package.json b/packages/modernjs/package.json index b3b9912f1ba..7aa46b54e22 100644 --- a/packages/modernjs/package.json +++ b/packages/modernjs/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/modern-js", - "version": "0.8.6", + "version": "0.8.7", "files": [ "dist/", "types.d.ts", @@ -19,9 +19,9 @@ }, "exports": { ".": { + "types": "./dist/types/cli/index.d.ts", "import": "./dist/esm/cli/index.js", - "require": "./dist/cjs/cli/index.js", - "types": "./dist/types/cli/index.d.ts" + "require": "./dist/cjs/cli/index.js" }, "./runtime": { "types": "./dist/types/runtime/index.d.ts", @@ -32,29 +32,29 @@ "default": "./dist/esm/ssr-runtime/index.js" }, "./config-plugin": { + "types": "./dist/types/cli/configPlugin.d.ts", "import": "./dist/esm/cli/configPlugin.js", - "require": "./dist/cjs/cli/configPlugin.js", - "types": "./dist/types/cli/configPlugin.d.ts" + "require": "./dist/cjs/cli/configPlugin.js" }, "./ssr-plugin": { + "types": "./dist/types/cli/ssrPlugin.d.ts", "import": "./dist/esm/cli/ssrPlugin.js", - "require": "./dist/cjs/cli/ssrPlugin.js", - "types": "./dist/types/cli/ssrPlugin.d.ts" + "require": "./dist/cjs/cli/ssrPlugin.js" }, "./shared-strategy": { + "types": "./dist/types/cli/mfRuntimePlugins/shared-strategy.d.ts", "import": "./dist/esm/cli/mfRuntimePlugins/shared-strategy.js", - "require": "./dist/esm/cli/mfRuntimePlugins/shared-strategy.js", - "types": "./dist/types/cli/mfRuntimePlugins/shared-strategy.d.ts" + "require": "./dist/esm/cli/mfRuntimePlugins/shared-strategy.js" }, "./resolve-entry-ipv4": { + "types": "./dist/types/cli/mfRuntimePlugins/resolve-entry-ipv4.d.ts", "import": "./dist/esm/cli/mfRuntimePlugins/resolve-entry-ipv4.js", - "require": "./dist/esm/cli/mfRuntimePlugins/resolve-entry-ipv4.js", - "types": "./dist/types/cli/mfRuntimePlugins/resolve-entry-ipv4.d.ts" + "require": "./dist/esm/cli/mfRuntimePlugins/resolve-entry-ipv4.js" }, "./inject-node-fetch": { + "types": "./dist/types/cli/mfRuntimePlugins/inject-node-fetch.d.ts", "import": "./dist/esm/cli/mfRuntimePlugins/inject-node-fetch.js", - "require": "./dist/esm/cli/mfRuntimePlugins/inject-node-fetch.js", - "types": "./dist/types/cli/mfRuntimePlugins/inject-node-fetch.d.ts" + "require": "./dist/esm/cli/mfRuntimePlugins/inject-node-fetch.js" } }, "typesVersions": { diff --git a/packages/native-federation-tests/package.json b/packages/native-federation-tests/package.json index ab685cdc2a3..ecf4bbbfa04 100644 --- a/packages/native-federation-tests/package.json +++ b/packages/native-federation-tests/package.json @@ -11,9 +11,9 @@ ], "exports": { ".": { + "types": "./dist/index.d.ts", "import": "./dist/index.mjs", - "require": "./dist/index.js", - "types": "./dist/index.d.ts" + "require": "./dist/index.js" }, "./rollup": { "types": "./dist/rollup.d.ts", diff --git a/packages/native-federation-typescript/package.json b/packages/native-federation-typescript/package.json index f51c99cbc16..8ad682a7454 100644 --- a/packages/native-federation-typescript/package.json +++ b/packages/native-federation-typescript/package.json @@ -17,9 +17,9 @@ }, "exports": { ".": { + "types": "./dist/index.d.ts", "import": "./dist/index.mjs", - "require": "./dist/index.js", - "types": "./dist/index.d.ts" + "require": "./dist/index.js" }, "./rollup": { "types": "./dist/rollup.d.ts", diff --git a/packages/nextjs-mf/CHANGELOG.md b/packages/nextjs-mf/CHANGELOG.md index 41483428159..f1175ebb437 100644 --- a/packages/nextjs-mf/CHANGELOG.md +++ b/packages/nextjs-mf/CHANGELOG.md @@ -1,5 +1,19 @@ # @module-federation/nextjs-mf +## 8.8.10 + +### Patch Changes + +- Updated dependencies [835b09c] +- Updated dependencies [f573ad0] +- Updated dependencies [336f3d8] +- Updated dependencies [4fd33fb] + - @module-federation/sdk@0.8.7 + - @module-federation/enhanced@0.8.7 + - @module-federation/runtime@0.8.7 + - @module-federation/node@2.6.20 + - @module-federation/webpack-bundler-runtime@0.8.7 + ## 8.8.9 ### Patch Changes diff --git a/packages/nextjs-mf/package.json b/packages/nextjs-mf/package.json index f2663d113b5..6e2ffe317d4 100644 --- a/packages/nextjs-mf/package.json +++ b/packages/nextjs-mf/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/nextjs-mf", - "version": "8.8.9", + "version": "8.8.10", "license": "MIT", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", diff --git a/packages/node/CHANGELOG.md b/packages/node/CHANGELOG.md index 1717aa1229b..67c7852585d 100644 --- a/packages/node/CHANGELOG.md +++ b/packages/node/CHANGELOG.md @@ -1,5 +1,18 @@ # @module-federation/node +## 2.6.20 + +### Patch Changes + +- Updated dependencies [835b09c] +- Updated dependencies [f573ad0] +- Updated dependencies [336f3d8] +- Updated dependencies [4fd33fb] + - @module-federation/sdk@0.8.7 + - @module-federation/enhanced@0.8.7 + - @module-federation/runtime@0.8.7 + - @module-federation/utilities@3.1.38 + ## 2.6.19 ### Patch Changes diff --git a/packages/node/package.json b/packages/node/package.json index 54c5699944d..0dbaa3bd7da 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -1,7 +1,7 @@ { "public": true, "name": "@module-federation/node", - "version": "2.6.19", + "version": "2.6.20", "type": "commonjs", "main": "./dist/src/index.js", "exports": { @@ -16,7 +16,6 @@ "import": "./dist/src/utils/index.js", "require": "./dist/src/utils/index.js" }, - "./src/plugins/RemotePublicPathPlugin.js": "./dist/src/plugins/RemotePublicPathPlugin.js", "./src/plugins/NodeFederationPlugin.js": "./dist/src/plugins/NodeFederationPlugin.js", "./universe-entry-chunk-tracker-plugin": "./dist/src/plugins/UniverseEntryChunkTrackerPlugin.js", "./src/": "./dist/src/" diff --git a/packages/retry-plugin/CHANGELOG.md b/packages/retry-plugin/CHANGELOG.md index 59431a14d9c..5aee5442146 100644 --- a/packages/retry-plugin/CHANGELOG.md +++ b/packages/retry-plugin/CHANGELOG.md @@ -1,5 +1,14 @@ # @module-federation/retry-plugin +## 0.8.7 + +### Patch Changes + +- Updated dependencies [835b09c] +- Updated dependencies [336f3d8] +- Updated dependencies [4fd33fb] + - @module-federation/sdk@0.8.7 + ## 0.8.6 ### Patch Changes diff --git a/packages/retry-plugin/package.json b/packages/retry-plugin/package.json index e4fbd4022fc..611d4854534 100644 --- a/packages/retry-plugin/package.json +++ b/packages/retry-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/retry-plugin", - "version": "0.8.6", + "version": "0.8.7", "author": "danpeen ", "main": "./dist/index.js", "module": "./dist/esm/index.js", diff --git a/packages/rsbuild-plugin/CHANGELOG.md b/packages/rsbuild-plugin/CHANGELOG.md index da8690393f9..7914f201204 100644 --- a/packages/rsbuild-plugin/CHANGELOG.md +++ b/packages/rsbuild-plugin/CHANGELOG.md @@ -1,5 +1,16 @@ # @module-federation/rsbuild-plugin +## 0.8.7 + +### Patch Changes + +- Updated dependencies [835b09c] +- Updated dependencies [f573ad0] +- Updated dependencies [336f3d8] +- Updated dependencies [4fd33fb] + - @module-federation/sdk@0.8.7 + - @module-federation/enhanced@0.8.7 + ## 0.8.6 ### Patch Changes diff --git a/packages/rsbuild-plugin/package.json b/packages/rsbuild-plugin/package.json index cb7331fbd41..efcd89cc185 100644 --- a/packages/rsbuild-plugin/package.json +++ b/packages/rsbuild-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/rsbuild-plugin", - "version": "0.8.6", + "version": "0.8.7", "description": "Module Federation plugin for Rsbuild", "homepage": "https://module-federation.io", "bugs": { diff --git a/packages/rsbuild-plugin/src/cli/index.ts b/packages/rsbuild-plugin/src/cli/index.ts index 84d0be0909f..04d6454a5ae 100644 --- a/packages/rsbuild-plugin/src/cli/index.ts +++ b/packages/rsbuild-plugin/src/cli/index.ts @@ -18,6 +18,8 @@ import logger from '../logger'; type ModuleFederationOptions = moduleFederationPlugin.ModuleFederationPluginOptions; +export type { ModuleFederationOptions }; + const RSBUILD_PLUGIN_MODULE_FEDERATION_NAME = 'rsbuild:module-federation-enhanced'; const RSPACK_PLUGIN_MODULE_FEDERATION_NAME = 'module-federation'; diff --git a/packages/rspack/CHANGELOG.md b/packages/rspack/CHANGELOG.md index dd62413475f..f8eb6c360e0 100644 --- a/packages/rspack/CHANGELOG.md +++ b/packages/rspack/CHANGELOG.md @@ -1,5 +1,21 @@ # @module-federation/rspack +## 0.8.7 + +### Patch Changes + +- Updated dependencies [835b09c] +- Updated dependencies [f573ad0] +- Updated dependencies [336f3d8] +- Updated dependencies [4fd33fb] + - @module-federation/sdk@0.8.7 + - @module-federation/inject-external-runtime-core-plugin@0.8.7 + - @module-federation/bridge-react-webpack-plugin@0.8.7 + - @module-federation/dts-plugin@0.8.7 + - @module-federation/managers@0.8.7 + - @module-federation/manifest@0.8.7 + - @module-federation/runtime-tools@0.8.7 + ## 0.8.6 ### Patch Changes diff --git a/packages/rspack/package.json b/packages/rspack/package.json index c47cf6237e1..7adab5899cd 100644 --- a/packages/rspack/package.json +++ b/packages/rspack/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/rspack", - "version": "0.8.6", + "version": "0.8.7", "license": "MIT", "keywords": [ "Module Federation", @@ -21,7 +21,7 @@ "author": "hanric ", "sideEffects": false, "main": "./dist/index.cjs.js", - "module": "./dist/index.esm.js", + "module": "./dist/index.esm.mjs", "types": "./dist/index.cjs.d.ts", "dependencies": { "@module-federation/bridge-react-webpack-plugin": "workspace:*", @@ -29,6 +29,7 @@ "@module-federation/managers": "workspace:*", "@module-federation/manifest": "workspace:*", "@module-federation/runtime-tools": "workspace:*", + "@module-federation/inject-external-runtime-core-plugin": "workspace:*", "@module-federation/sdk": "workspace:*" }, "devDependencies": { @@ -36,9 +37,9 @@ }, "exports": { ".": { - "import": "./dist/index.esm.js", - "require": "./dist/index.cjs.js", - "types": "./dist/index.cjs.d.ts" + "types": "./dist/index.cjs.d.ts", + "import": "./dist/index.esm.mjs", + "require": "./dist/index.cjs.js" }, "./plugin": { "types": "./dist/plugin.cjs.d.ts", diff --git a/packages/rspack/rollup.config.js b/packages/rspack/rollup.config.js index bb37e988aa1..8fb6f4719a4 100644 --- a/packages/rspack/rollup.config.js +++ b/packages/rspack/rollup.config.js @@ -9,6 +9,35 @@ module.exports = (rollupConfig, projectOptions) => { process.cwd(), './packages/rspack/src/ModuleFederationPlugin.ts', ); + + if (Array.isArray(rollupConfig.output)) { + rollupConfig.output = rollupConfig.output.map((c) => ({ + ...c, + hoistTransitiveImports: false, + entryFileNames: + c.format === 'esm' + ? c.entryFileNames.replace('.js', '.mjs') + : c.entryFileNames, + chunkFileNames: + c.format === 'esm' + ? c.chunkFileNames.replace('.js', '.mjs') + : c.chunkFileNames, + })); + } else { + rollupConfig.output = { + ...rollupConfig.output, + hoistTransitiveImports: false, + entryFileNames: + rollupConfig.output.format === 'esm' + ? rollupConfig.output.entryFileNames.replace('.js', '.mjs') + : rollupConfig.output.entryFileNames, + chunkFileNames: + rollupConfig.output.format === 'esm' + ? rollupConfig.output.chunkFileNames.replace('.js', '.mjs') + : rollupConfig.output.chunkFileNames, + }; + } + rollupConfig.plugins.push( replace({ __VERSION__: JSON.stringify(pkg.version), diff --git a/packages/rspack/src/ModuleFederationPlugin.ts b/packages/rspack/src/ModuleFederationPlugin.ts index af6efa1c37f..5142f895661 100644 --- a/packages/rspack/src/ModuleFederationPlugin.ts +++ b/packages/rspack/src/ModuleFederationPlugin.ts @@ -75,6 +75,28 @@ export class ModuleFederationPlugin implements RspackPluginInstance { this._patchChunkSplit(compiler, options.name); } + if (options.experiments?.provideExternalRuntime) { + if (options.exposes) { + throw new Error( + 'You can only set provideExternalRuntime: true in pure consumer which not expose modules.', + ); + } + + const runtimePlugins = options.runtimePlugins || []; + options.runtimePlugins = runtimePlugins.concat( + require.resolve( + '@module-federation/inject-external-runtime-core-plugin', + ), + ); + } + + if (options.experiments?.externalRuntime === true) { + const Externals = compiler.webpack.ExternalsPlugin; + new Externals(compiler.options.externalsType || 'global', { + '@module-federation/runtime-core': '_FEDERATION_RUNTIME_CORE', + }).apply(compiler); + } + options.implementation = options.implementation || RuntimeToolsPath; let disableManifest = options.manifest === false; let disableDts = options.dts === false; diff --git a/packages/runtime-core/.eslintrc.json b/packages/runtime-core/.eslintrc.json new file mode 100644 index 00000000000..2564a6e49bd --- /dev/null +++ b/packages/runtime-core/.eslintrc.json @@ -0,0 +1,23 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.json"], + "parser": "jsonc-eslint-parser", + "rules": {} + } + ] +} diff --git a/packages/runtime-core/.swcrc b/packages/runtime-core/.swcrc new file mode 100644 index 00000000000..28e88ec1cdc --- /dev/null +++ b/packages/runtime-core/.swcrc @@ -0,0 +1,29 @@ +{ + "jsc": { + "target": "es2017", + "parser": { + "syntax": "typescript", + "decorators": true, + "dynamicImport": true + }, + "transform": { + "decoratorMetadata": true, + "legacyDecorator": true + }, + "keepClassNames": true, + "externalHelpers": true, + "loose": true + }, + "module": { + "type": "es6" + }, + "sourceMaps": true, + "exclude": [ + "jest.config.ts", + ".*\\.spec.tsx?$", + ".*\\.test.tsx?$", + "./src/jest-setup.ts$", + "./**/jest-setup.ts$", + ".*.js$" + ] +} diff --git a/packages/runtime-core/CHANGELOG.md b/packages/runtime-core/CHANGELOG.md new file mode 100644 index 00000000000..a4b347063be --- /dev/null +++ b/packages/runtime-core/CHANGELOG.md @@ -0,0 +1,582 @@ +# @module-federation/runtime + +## 0.6.15 + +### Patch Changes + +- f573ad0: feat: add externalRuntime and provideExternalRuntime fields to help optimize assets size +- Updated dependencies [835b09c] +- Updated dependencies [336f3d8] +- Updated dependencies [4fd33fb] + - @module-federation/sdk@0.8.7 + - @module-federation/error-codes@0.8.7 + +## 0.6.14 + +### Patch Changes + +- ad605d2: chore: unified logger +- Updated dependencies [ad605d2] + - @module-federation/sdk@0.6.14 + +## 0.6.13 + +### Patch Changes + +- @module-federation/sdk@0.6.13 + +## 0.6.12 + +### Patch Changes + +- @module-federation/sdk@0.6.12 + +## 0.6.11 + +### Patch Changes + +- ea6d417: Replaced dynamic module import using `new Function` with a safer direct `import` call. + + - Removed usage of `new Function` to execute dynamic import + - Implemented a direct async import with `/* webpackIgnore: true */` for proper bundler handling + +- Updated dependencies [d5a3072] + - @module-federation/sdk@0.6.11 + +## 0.6.10 + +### Patch Changes + +- b704f30: fix(runtime): remove crossorigin attr from link tag which not preload success +- Updated dependencies [22a3b83] + - @module-federation/sdk@0.6.10 + +## 0.6.9 + +### Patch Changes + +- @module-federation/sdk@0.6.9 + +## 0.6.8 + +### Patch Changes + +- 32db0ac: Manifest protocol to support more than global remote type +- 6c5f444: load entry to support delegate module responses +- fac6ecf: fix(runtime): catch init remote error in errorLoadRemote hook +- Updated dependencies [32db0ac] + - @module-federation/sdk@0.6.8 + +## 0.6.7 + +### Patch Changes + +- 9e32644: Added comprehensive integration tests for the API synchronization and enhanced the embedded module proxy implementation. + + - Added detailed integration tests for API consistency between embedded and index modules. + - Tests include export comparison and method consistency for `FederationHost` and `Module` classes. + - Introduced and updated the `embedded.ts` file to dynamically access the runtime modules at runtime. + - Included detailed implementations for accessing and wrapping existing runtime functions. + - Exposed the previously private `formatOptions` method in the `FederationHost` class publicly. + - Enhanced error handling for uninstantiated or unregistered runtime access. + +- 9e32644: - Refactor `embedded.ts` to use a proxy pattern for better runtime compatibility: + - Implement FederationHost and Module classes that delegate to the actual runtime implementation + - Expose all public methods and properties from the original classes + - Use a lazy initialization approach to ensure proper runtime loading + - Add comprehensive test suite for API synchronization between embedded.ts and index.ts + - Introduce new test file `sync.spec.ts` with extensive tests for API compatibility + - Ensure FederationHost and Module classes have the same methods in both files + - Test various scenarios including remote loading, manifest handling, and circular dependencies + - Modify `core.ts` to make `formatOptions` method public +- Updated dependencies [9e32644] + - @module-federation/sdk@0.6.7 + +## 0.6.6 + +### Patch Changes + +- @module-federation/sdk@0.6.6 + +## 0.6.5 + +### Patch Changes + +- @module-federation/sdk@0.6.5 + +## 0.6.4 + +### Patch Changes + +- @module-federation/sdk@0.6.4 + +## 0.6.3 + +### Patch Changes + +- @module-federation/sdk@0.6.3 + +## 0.6.2 + +### Patch Changes + +- 9f98292: fix(runtime): set loading if registeredShared not set + - @module-federation/sdk@0.6.2 + +## 0.6.1 + +### Patch Changes + +- 2855583: externalize swc helpers and add them as a dependency +- 813680f: Remove duplicated util functions and reference central ones in sdk +- Updated dependencies [2855583] +- Updated dependencies [813680f] + - @module-federation/sdk@0.6.1 + +## 0.6.0 + +### Patch Changes + +- Updated dependencies [1d9bb77] + - @module-federation/sdk@0.6.0 + +## 0.5.2 + +### Patch Changes + +- 24ba96e: fix: handle circular init shared +- b90fa7d: feat: add shareStrategy option +- Updated dependencies [b90fa7d] + - @module-federation/sdk@0.5.2 + +## 0.5.1 + +### Patch Changes + +- @module-federation/sdk@0.5.1 + +## 0.5.0 + +### Minor Changes + +- 8378a77: feat(runtime): add loadEntry hook + +### Patch Changes + +- 5c7ac8a: provide error message when remote entry init fails +- Updated dependencies [8378a77] + - @module-federation/sdk@0.5.0 + +## 0.4.0 + +### Minor Changes + +- f2f02c9: provide users to mark shared module as loaded + +### Patch Changes + +- a6e2bed: fix: add attrs option to createLink hook +- Updated dependencies [a6e2bed] +- Updated dependencies [a6e2bed] + - @module-federation/sdk@0.4.0 + +## 0.3.5 + +### Patch Changes + +- @module-federation/sdk@0.3.5 + +## 0.3.4 + +### Patch Changes + +- 67ea678: checking for remote entry type when loading assets +- d26d7e6: Ensured createScript runtime hook always receives `attrs` + - @module-federation/sdk@0.3.4 + +## 0.3.3 + +### Patch Changes + +- @module-federation/sdk@0.3.3 + +## 0.3.2 + +### Patch Changes + +- @module-federation/sdk@0.3.2 + +## 0.3.1 + +### Patch Changes + +- @module-federation/sdk@0.3.1 + +## 0.3.0 + +### Minor Changes + +- fa37cc4: feat: support modern.js ssr [#2348](https://github.com/module-federation/core/issues/2348) + +### Patch Changes + +- Updated dependencies [fa37cc4] + - @module-federation/sdk@0.3.0 + +## 0.2.8 + +### Patch Changes + +- @module-federation/sdk@0.2.8 + +## 0.2.7 + +### Patch Changes + +- Updated dependencies [b00ef13] + - @module-federation/sdk@0.2.7 + +## 0.2.6 + +### Patch Changes + +- Updated dependencies [91bf689] + - @module-federation/sdk@0.2.6 + +## 0.2.5 + +### Patch Changes + +- 8cce571: fix(runtime): Fixed an issue where script failed to load properly when static resources were set to cross-domain response headers due to the default setting of script crossorigin to anonymous (this issue appeared in next.js) +- Updated dependencies [8cce571] + - @module-federation/sdk@0.2.5 + +## 0.2.4 + +### Patch Changes + +- 60cd259: adding support for loading systemjs based remotes +- 09b792d: connect attrs to create script hook +- Updated dependencies [09b792d] +- Updated dependencies [09b792d] + - @module-federation/sdk@0.2.4 + +## 0.2.3 + +### Patch Changes + +- 32f26af: fix fetch hook types on runtime plugin interfaces +- Updated dependencies [32f26af] +- Updated dependencies [32f26af] + - @module-federation/sdk@0.2.3 + +## 0.2.2 + +### Patch Changes + +- @module-federation/sdk@0.2.2 + +## 0.2.1 + +### Patch Changes + +- Updated dependencies [88445e7] + - @module-federation/sdk@0.2.1 + +## 0.2.0 + +### Patch Changes + +- @module-federation/sdk@0.2.0 + +## 0.1.21 + +### Patch Changes + +- Updated dependencies [88900ad] + - @module-federation/sdk@0.1.21 + +## 0.1.20 + +### Patch Changes + +- 652c8a2: do not apply symbol if object not extensible +- 685c607: feat: support dynamic remote type hints +- 05c43f3: feat: support pass shareScopeMap +- Updated dependencies [685c607] +- Updated dependencies [e8e0969] +- Updated dependencies [349c381] + - @module-federation/sdk@0.1.20 + +## 0.1.19 + +### Patch Changes + +- 031454d: fix: do not delete link tag if no preload +- a2bfb9b: fix: In load remote, link preload is not used to preload resources, preventing resource reloading +- Updated dependencies [031454d] +- Updated dependencies [b0a31a7] +- Updated dependencies [a2bfb9b] + - @module-federation/sdk@0.1.19 + +## 0.1.18 + +### Patch Changes + +- 80af3f3: fix: add protocol in node automaticly +- Updated dependencies [80af3f3] + - @module-federation/sdk@0.1.18 + +## 0.1.17 + +### Patch Changes + +- 26bff6e: feat: add mf_module_id to remote to add module debugging information + - @module-federation/sdk@0.1.17 + +## 0.1.16 + +### Patch Changes + +- 103cd07: fix types for beforePreloadRemote args hook +- 425fc9d: fix: only delete can be configurable descriptor +- Updated dependencies [364f2bc] + - @module-federation/sdk@0.1.16 + +## 0.1.15 + +### Patch Changes + +- @module-federation/sdk@0.1.15 + +## 0.1.14 + +### Patch Changes + +- 103b2b8: Script timeout options for createScript hook +- Updated dependencies [103b2b8] + - @module-federation/sdk@0.1.14 + +## 0.1.13 + +### Patch Changes + +- d259a37: chore: extract sharedHandler +- 08740a0: fix: should use userOptions.shared to apply hooks +- 0113b81: chore: delete references to used shared to prevent memory leaks +- d259a37: chore: extract remoteHandler +- Updated dependencies [2e52e51] + - @module-federation/sdk@0.1.13 + +## 0.1.12 + +### Patch Changes + +- 371d1f1: Before Request throws to errorLoadRemote + - @module-federation/sdk@0.1.12 + +## 0.1.11 + +### Patch Changes + +- 328cd99: package json main definition + - @module-federation/sdk@0.1.11 + +## 0.1.10 + +### Patch Changes + +- @module-federation/sdk@0.1.10 + +## 0.1.9 + +### Patch Changes + +- 5ef0150: fix: preserve generic in loadRemote/loadShare/loadShareSync + - @module-federation/sdk@0.1.9 + +## 0.1.8 + +### Patch Changes + +- @module-federation/sdk@0.1.8 + +## 0.1.7 + +### Patch Changes + +- 648353b: Filter falsey runtime plugins from registerPlugins +- 35ebb46: fix: support config string shareScope + - @module-federation/sdk@0.1.7 + +## 0.1.6 + +### Patch Changes + +- 72c7b80: chore: fix release tag +- Updated dependencies [72c7b80] + - @module-federation/sdk@0.1.6 + +## 0.1.5 + +### Patch Changes + +- 876a4ff: feat: support config shared import:false in runtime +- f26aa2d: chore: prevent plugins from losing information +- 1a9c6e7: feat: support config multiple versions shared +- Updated dependencies [ca271ab] +- Updated dependencies [1a9c6e7] + - @module-federation/sdk@0.1.5 + +## 0.1.4 + +### Patch Changes + +- 2f697b9: fix: fixed type declaration in pkg +- Updated dependencies [8f3a440] +- Updated dependencies [2f697b9] + - @module-federation/sdk@0.1.4 + +## 0.1.3 + +### Patch Changes + +- 6b3b210: Add Register plugins api + - @module-federation/sdk@0.1.3 + +## 0.1.2 + +### Patch Changes + +- Updated dependencies [c8c0ad2] + - @module-federation/sdk@0.1.2 + +## 0.1.1 + +### Patch Changes + +- @module-federation/sdk@0.1.1 + +## 0.1.0 + +### Patch Changes + +- df3ef24: chore: adjust add federation init process +- df3ef24: chore: redefine prefetch types +- Updated dependencies [df3ef24] +- Updated dependencies [df3ef24] +- Updated dependencies [df3ef24] +- Updated dependencies [df3ef24] + - @module-federation/sdk@0.1.0 + +## 0.0.17 + +### Patch Changes + +- ce0597e: feat: add registerRemotes api + - @module-federation/sdk@0.0.17 + +## 0.0.16 + +### Patch Changes + +- @module-federation/sdk@0.0.16 + +## 0.0.15 + +### Patch Changes + +- 6e9b6d5: fix(runtime): preserve error.stack instead of throwing new error +- Updated dependencies [3a45d99] +- Updated dependencies [ba5bedd] + - @module-federation/sdk@0.0.15 + +## 0.0.14 + +### Patch Changes + +- a050645: Expose node script loaders to bundler runtime. Replace require.loadScript from federation/node to use federation.runtime.loadScriptNode +- 4fc20cc: adding reject to args in loadEsmEntry +- Updated dependencies [cd8c7bf] +- Updated dependencies [5576c6b] + - @module-federation/sdk@0.0.14 + +## 0.0.13 + +### Patch Changes + +- 804447c: fix(runtime): use link to preload js +- Updated dependencies [804447c] + - @module-federation/sdk@0.0.13 + +## 0.0.12 + +### Patch Changes + +- @module-federation/sdk@0.0.12 + +## 0.0.11 + +### Patch Changes + +- b2ead7a: fix(runtime): nativeGlobal is undefined +- 589a3bd: fix(runtime): runtime should not pre-register shared while strategy is 'loaded-first' + - @module-federation/sdk@0.0.11 + +## 0.0.10 + +### Patch Changes + +- 2d774d1: onLoad hook will allow you to return a custom module factory or proxy +- 2097daa: feat(runtime): automatically complete the snapshot so that devtool can visualize it + - @module-federation/sdk@0.0.10 + +## 0.0.9 + +### Patch Changes + +- 2ad29a6: fix: remove duplicate init shareScopeMap + fix: normalize schemas path + fix: shared is loaded if it has lib attr +- b129098: fix: window.location.origin will be "null" in iframe srcDoc + - @module-federation/sdk@0.0.9 + +## 0.0.8 + +### Patch Changes + +- 98eb40d: Support offline remotes recovery in errorLoadRemote. Allows hook to return a Module / factory / fallback mock when a request fails or container cannot be accessed +- 98eb40d: feat: enhanced +- Updated dependencies [98eb40d] +- Updated dependencies [98eb40d] + - @module-federation/sdk@0.0.8 + +## 0.0.7 + +### Patch Changes + +- 7df24df: only both version and name matched instance can be re-use +- 7df24df: feat: add initContainer and beforeInitContainer hook + - @module-federation/sdk@0.0.7 + +## 0.0.6 + +### Patch Changes + +- b505deb: fix: rename usePlugins to prevent swc react-refresh from throwing errors when replacing variables + - @module-federation/sdk@0.0.6 + +## 0.0.5 + +### Patch Changes + +- 0dce151: chore(runtime): support entry with query +- Updated dependencies [5a79cb3] + - @module-federation/sdk@0.0.5 + +## 0.0.4 + +### Patch Changes + +- 3af2723: fix: add runtime api + - @module-federation/sdk@0.0.4 diff --git a/packages/runtime-core/LICENSE b/packages/runtime-core/LICENSE new file mode 100644 index 00000000000..f3ef66ec65e --- /dev/null +++ b/packages/runtime-core/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023-present zhouxiao(zhoushaw) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/runtime-core/README.md b/packages/runtime-core/README.md new file mode 100644 index 00000000000..21fdf58e127 --- /dev/null +++ b/packages/runtime-core/README.md @@ -0,0 +1,13 @@ +# @module-federation/runtime + +- Can be combined with the build plug-in to share basic dependencies according to policies to reduce the number of module downloads and improve the loading speed of modules. +- Only consume part of the export of the remote module and will not fully download the remote module +- The runtime calling process can be extended through the module-runtime plug-in mechanism + +## Documentation + +See [https://module-federation.io/guide/basic/runtime.html](https://module-federation.io/guide/basic/runtime.html) for details. + +## License + +`@module-federation/runtime` is [MIT licensed](https://github.com/module-federation/core/blob/main/packages/runtime/LICENSE). diff --git a/packages/runtime-core/__tests__/__snapshots__/preload-remote.spec.ts.snap b/packages/runtime-core/__tests__/__snapshots__/preload-remote.spec.ts.snap new file mode 100644 index 00000000000..2d845938dc4 --- /dev/null +++ b/packages/runtime-core/__tests__/__snapshots__/preload-remote.spec.ts.snap @@ -0,0 +1,126 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`preload-remote inBrowser > 1 preload with default config 1`] = ` +{ + "links": [ + { + "href": "http://localhost:1111/resources/preload/preload-resource/button.sync.css", + "rel": "preload", + "type": "style", + }, + { + "href": "http://localhost:1111/resources/preload/preload-resource/button.sync.js", + "rel": "preload", + "type": "script", + }, + { + "href": "http://localhost:1111/resources/preload/preload-resource/sub1-button/button.sync.js", + "rel": "preload", + "type": "script", + }, + ], + "scripts": [ + { + "crossorigin": "", + "src": "http://localhost:1111/resources/preload/preload-resource/federation-remote-entry.js", + }, + { + "crossorigin": "", + "src": "http://localhost:1111/resources/preload/preload-resource/sub1-button/federation-remote-entry.js", + }, + ], +} +`; + +exports[`preload-remote inBrowser > 2 preload with all config 1`] = ` +{ + "links": [ + { + "href": "http://localhost:1111/resources/preload/preload-resource/sub2/button.async.css", + "rel": "preload", + "type": "style", + }, + { + "href": "http://localhost:1111/resources/preload/preload-resource/sub2/button.sync.css", + "rel": "preload", + "type": "style", + }, + { + "href": "http://localhost:1111/resources/preload/preload-resource/sub2/button.async.js", + "rel": "preload", + "type": "script", + }, + { + "href": "http://localhost:1111/resources/preload/preload-resource/sub2/button.sync.js", + "rel": "preload", + "type": "script", + }, + { + "href": "http://localhost:1111/resources/preload/preload-resource/sub2-button/button.async.js", + "rel": "preload", + "type": "script", + }, + { + "href": "http://localhost:1111/resources/preload/preload-resource/sub2-button/button.sync.js", + "rel": "preload", + "type": "script", + }, + { + "href": "http://localhost:1111/resources/preload/preload-resource/sub2-add/add.async.js", + "rel": "preload", + "type": "script", + }, + { + "href": "http://localhost:1111/resources/preload/preload-resource/sub2-add/add.sync.js", + "rel": "preload", + "type": "script", + }, + ], + "scripts": [ + { + "crossorigin": "", + "src": "http://localhost:1111/resources/preload/preload-resource/sub2/federation-remote-entry.js", + }, + { + "crossorigin": "", + "src": "http://localhost:1111/resources/preload/preload-resource/sub2-button/federation-remote-entry.js", + }, + ], +} +`; + +exports[`preload-remote inBrowser > 3 preload with expose config 1`] = ` +{ + "links": [ + { + "href": "http://localhost:1111/resources/preload/preload-resource/sub3/add.sync.js", + "rel": "preload", + "type": "script", + }, + ], + "scripts": [ + { + "crossorigin": "", + "src": "http://localhost:1111/resources/preload/preload-resource/sub3/federation-remote-entry.js", + }, + ], +} +`; + +exports[`preload-remote inBrowser > 3 preload with expose config 2`] = ` +{ + "links": [ + { + "href": "http://localhost:1111/resources/preload/preload-resource/sub3/add.sync.js", + "rel": "preload", + "type": "script", + }, + ], + "scripts": [ + { + "crossorigin": "", + "src": "http://localhost:1111/resources/preload/preload-resource/sub3/federation-remote-entry.js", + }, + ], +} +`; diff --git a/packages/runtime-core/__tests__/hooks.spec.ts b/packages/runtime-core/__tests__/hooks.spec.ts new file mode 100644 index 00000000000..0f9ec6dd240 --- /dev/null +++ b/packages/runtime-core/__tests__/hooks.spec.ts @@ -0,0 +1,349 @@ +import { assert, describe, test, it } from 'vitest'; +import { FederationHost } from '../src/core'; +import { FederationRuntimePlugin } from '../src/type/plugin'; +import { mockStaticServer, removeScriptTags } from './mock/utils'; +import { addGlobalSnapshot } from '../src/global'; + +// eslint-disable-next-line max-lines-per-function +describe('hooks', () => { + mockStaticServer({ + baseDir: __dirname, + filterKeywords: [], + basename: 'http://localhost:1111/', + }); + beforeEach(() => { + removeScriptTags(); + }); + + it('core hooks args', async () => { + let beforeInitArgs: any, + initArgs: any, + beforeLoadRemoteArgs, + loadRemoteArgs; + const testPlugin: () => FederationRuntimePlugin = () => ({ + name: 'testPlugin', + beforeInit(args) { + beforeInitArgs = args; + return args; + }, + init(args) { + initArgs = args; + }, + beforeRequest(args) { + return new Promise((resolve) => { + beforeLoadRemoteArgs = args; + setTimeout( + () => + resolve({ + ...args, + id: '@demo/main/add', + }), + 1000, + ); + }); + }, + onLoad(args) { + loadRemoteArgs = args; + }, + }); + + const options = { + name: '@federation/hooks', + remotes: [ + { + name: '@demo/main', + alias: 'main', + entry: + 'http://localhost:1111/resources/main/federation-manifest.json', + }, + ], + plugins: [testPlugin()], + }; + const GM = new FederationHost(options); + assert(beforeInitArgs, "beforeInitArgs can't be undefined"); + expect(beforeInitArgs).toMatchObject({ + options: { + name: options.name, + remotes: options.remotes, + }, + origin: GM, + }); + expect(beforeInitArgs.userOptions.plugins).toEqual( + expect.arrayContaining(options.plugins), + ); + expect(initArgs).toMatchObject({ + options: GM.options, + origin: GM, + }); + assert(initArgs, "initArgs can't be undefined"); + expect(initArgs.options.plugins).toEqual( + expect.arrayContaining(options.plugins), + ); + // Modify ./sub to expose ./add + const module = + await GM.loadRemote<(...args: Array) => number>('@demo/main/sub'); + assert(module, 'loadRemote should return a module'); + expect(beforeLoadRemoteArgs).toMatchObject({ + id: '@demo/main/sub', + options: GM.options, + origin: GM, + }); + expect(loadRemoteArgs).toMatchObject({ + id: '@demo/main/add', + pkgNameOrAlias: '@demo/main', + expose: './add', + origin: GM, + }); + expect(module(1, 2, 3, 4, 5)).toBe(15); + }); + + it('loader hooks', async () => { + const testRemoteEntry = + 'http://localhost:1111/resources/hooks/app2/federation-remote-entry.js'; + const preloadRemoteEntry = + 'http://localhost:1111/resources/hooks/app3/federation-remote-entry.js'; + const remotePublicPath = 'http://localhost:1111/'; + const reset = addGlobalSnapshot({ + '@loader-hooks/globalinfo': { + globalName: '', + buildVersion: '', + publicPath: '', + remoteTypes: '', + shared: [], + remoteEntry: '', + remoteEntryType: 'global', + modules: [], + version: '0.0.1', + remotesInfo: { + '@loader-hooks/app2': { + matchedVersion: '0.0.1', + }, + '@loader-hooks/app3': { + matchedVersion: '0.0.1', + }, + }, + }, + '@loader-hooks/app2:0.0.1': { + globalName: '@loader-hooks/app2', + publicPath: remotePublicPath, + remoteTypes: '', + shared: [], + buildVersion: 'custom', + remotesInfo: {}, + remoteEntryType: 'global', + modules: [], + version: '0.0.1', + remoteEntry: 'resources/hooks/app2/federation-remote-entry.js', + }, + '@loader-hooks/app3:0.0.1': { + globalName: '@loader-hooks/app3', + publicPath: remotePublicPath, + remoteTypes: '', + shared: [], + buildVersion: 'custom', + remotesInfo: {}, + remoteEntryType: 'global', + modules: [], + version: '0.0.1', + remoteEntry: 'resources/hooks/app3/federation-remote-entry.js', + }, + }); + + const INSTANCE = new FederationHost({ + name: '@loader-hooks/globalinfo', + remotes: [ + { + name: '@loader-hooks/app2', + version: '*', + }, + { + name: '@loader-hooks/app3', + version: '*', + }, + ], + plugins: [ + { + name: 'change-script-attribute', + createScript({ url }) { + const script = document.createElement('script'); + script.src = url; + if (url === testRemoteEntry) { + script.setAttribute('loader-hooks', 'isTrue'); + script.setAttribute('crossorigin', 'anonymous'); + return script; + } else if (url === preloadRemoteEntry) { + script.setAttribute('loader-hooks', 'isFalse'); + return script; + } + }, + }, + ], + }); + + const res = await INSTANCE.loadRemote<() => string>( + '@loader-hooks/app2/say', + ); + assert(res); + expect(res()).toBe('hello app2'); + const testLoadedScript = [...document.querySelectorAll('script')].find( + // @ts-ignore fakeSrc is local mock attr, which value is the same as src + (script) => script.fakeSrc === testRemoteEntry, + ); + assert(testLoadedScript); + expect(testLoadedScript.getAttribute('loader-hooks')).toBe('isTrue'); + expect(testLoadedScript.getAttribute('crossorigin')).toBe('anonymous'); + + await INSTANCE.preloadRemote([{ nameOrAlias: '@loader-hooks/app3' }]); + const testLoadedScript1 = [...document.querySelectorAll('script')].find( + (script) => (script as any).fakeSrc === preloadRemoteEntry, + ); + assert(testLoadedScript1); + expect(testLoadedScript1.getAttribute('loader-hooks')).toBe('isFalse'); + + reset(); + }); + + it('loader fetch hooks', async () => { + const data = { + id: '@loader-hooks/app2', + name: '@loader-hooks/app2', + metaData: { + name: '@loader-hooks/app2', + publicPath: 'http://localhost:1111/', + type: 'app', + buildInfo: { + buildVersion: 'custom', + }, + remoteEntry: { + name: 'federation-remote-entry.js', + path: 'resources/hooks/app2/', + }, + types: { + name: 'index.d.ts', + path: './', + }, + globalName: '@loader-hooks/app2', + }, + remotes: [], + shared: [], + exposes: [], + }; + + const responseBody = new Response(JSON.stringify(data), { + status: 200, + statusText: 'OK', + headers: { 'Content-Type': 'application/json' }, + }); + const fetchPlugin: () => FederationRuntimePlugin = () => ({ + name: 'fetch-plugin', + fetch(url, options) { + if (url === 'http://mockxxx.com/loader-fetch-hooks-mf-manifest.json') { + return Promise.resolve(responseBody); + } + }, + }); + const INSTANCE = new FederationHost({ + name: '@loader-hooks/fetch', + remotes: [ + { + name: '@loader-hooks/app2', + entry: 'http://mockxxx.com/loader-fetch-hooks-mf-manifest.json', + }, + ], + plugins: [fetchPlugin()], + }); + + const res = await INSTANCE.loadRemote<() => string>( + '@loader-hooks/app2/say', + ); + assert(res); + expect(res()).toBe('hello app2'); + }); + + it('loaderEntry hooks', async () => { + const data = { + id: '@loader-hooks/app2', + name: '@loader-hooks/app2', + metaData: { + name: '@loader-hooks/app2', + publicPath: 'http://localhost:1111/', + type: 'app', + buildInfo: { + buildVersion: 'custom', + }, + remoteEntry: { + name: 'federation-remote-entry.js', + path: 'resources/hooks/app2/', + }, + types: { + name: 'index.d.ts', + path: './', + }, + globalName: '@loader-hooks/app2', + }, + remotes: [], + shared: [], + exposes: [], + }; + + const responseBody = new Response(JSON.stringify(data), { + status: 200, + statusText: 'OK', + headers: { 'Content-Type': 'application/json' }, + }); + + const fetchPlugin: () => FederationRuntimePlugin = function () { + return { + name: 'fetch-plugin', + fetch(url, options) { + if ( + url === 'http://mockxxx.com/loader-fetch-hooks-mf-manifest.json' + ) { + return Promise.resolve(responseBody); + } + }, + }; + }; + const loadEntryPlugin = function (): FederationRuntimePlugin { + return { + name: 'load-entry-plugin', + loadEntry({ remoteInfo }) { + if (remoteInfo.name === '@loader-hooks/app3') { + return { + init() {}, + get(path) { + return () => path; + }, + }; + } + }, + } as any; + }; + + const INSTANCE = new FederationHost({ + name: '@loader-hooks/fetch', + remotes: [ + { + name: '@loader-hooks/app2', + entry: 'http://mockxxx.com/loader-fetch-hooks-mf-manifest.json', + }, + { + name: '@loader-hooks/app3', + entry: 'http://mockxxx.com/loader-fetch-hooks-mf-manifest.json', + }, + ], + plugins: [fetchPlugin(), loadEntryPlugin()], + }); + + const res = await INSTANCE.loadRemote<() => string>( + '@loader-hooks/app2/say', + ); + assert(res); + expect(res()).toBe('hello app2'); + const loadEntryTestRes = await INSTANCE.loadRemote<() => string>( + '@loader-hooks/app3/testtest', + ); + assert(loadEntryTestRes); + expect(loadEntryTestRes).toBe('./testtest'); + }); +}); diff --git a/packages/runtime-core/__tests__/instance.spec.ts b/packages/runtime-core/__tests__/instance.spec.ts new file mode 100644 index 00000000000..185c285dc3e --- /dev/null +++ b/packages/runtime-core/__tests__/instance.spec.ts @@ -0,0 +1,12 @@ +import { assert, describe, test, it } from 'vitest'; +import { FederationHost } from '../src/index'; + +describe('FederationHost', () => { + it('should initialize with provided arguments', () => { + const GM = new FederationHost({ + name: '@federation/instance', + version: '1.0.1', + remotes: [], + }); + }); +}); diff --git a/packages/runtime-core/__tests__/is-static-resources-equal.spec.ts b/packages/runtime-core/__tests__/is-static-resources-equal.spec.ts new file mode 100644 index 00000000000..9c0da61c6aa --- /dev/null +++ b/packages/runtime-core/__tests__/is-static-resources-equal.spec.ts @@ -0,0 +1,47 @@ +import { describe, it, expect } from 'vitest'; +import { isStaticResourcesEqual } from '../src/utils/tool'; +describe('isStaticResourcesEqual', () => { + it('verify resources when URL does not specify protocol', () => { + const url = '//a.b.c'; + const scriptElement = document.createElement('script'); + scriptElement.src = url; + expect(scriptElement.src).toBe('http://a.b.c/'); + expect(isStaticResourcesEqual(scriptElement.src, url)).toBe(true); + expect(isStaticResourcesEqual(scriptElement.src, 'http://a.b.c/')).toBe( + true, + ); + expect(isStaticResourcesEqual(scriptElement.src, 'http://a.b.c')).toBe( + true, + ); + }); + it('verify resources when URL specifies protocol (https)', () => { + const url = 'https://a.b.c'; + const scriptElement = document.createElement('script'); + scriptElement.src = url; + expect(scriptElement.src).toBe('https://a.b.c/'); + expect(isStaticResourcesEqual(scriptElement.src, url)).toBe(true); + expect(isStaticResourcesEqual(scriptElement.src, 'https://a.b.c/')).toBe( + true, + ); + expect(isStaticResourcesEqual(scriptElement.src, '//a.b.c')).toBe(true); + expect(isStaticResourcesEqual(scriptElement.src, 'a.b.c')).toBe(true); + expect(isStaticResourcesEqual(scriptElement.src, 'http://a.b.c')).toBe( + true, + ); + }); + it('verify resources when URL specifies protocol (http)', () => { + const url = 'http://a.b.c'; + const scriptElement = document.createElement('script'); + scriptElement.src = url; + expect(scriptElement.src).toBe('http://a.b.c/'); + expect(isStaticResourcesEqual(scriptElement.src, url)).toBe(true); + expect(isStaticResourcesEqual(scriptElement.src, 'http://a.b.c/')).toBe( + true, + ); + expect(isStaticResourcesEqual(scriptElement.src, '//a.b.c')).toBe(true); + expect(isStaticResourcesEqual(scriptElement.src, 'a.b.c')).toBe(true); + expect(isStaticResourcesEqual(scriptElement.src, 'https://a.b.c')).toBe( + true, + ); + }); +}); diff --git a/packages/runtime-core/__tests__/mock/env.ts b/packages/runtime-core/__tests__/mock/env.ts new file mode 100644 index 00000000000..5328ee87478 --- /dev/null +++ b/packages/runtime-core/__tests__/mock/env.ts @@ -0,0 +1 @@ +export const requestList: Map = new Map(); diff --git a/packages/runtime-core/__tests__/mock/handlers.ts b/packages/runtime-core/__tests__/mock/handlers.ts new file mode 100644 index 00000000000..aa5578ee3ea --- /dev/null +++ b/packages/runtime-core/__tests__/mock/handlers.ts @@ -0,0 +1,41 @@ +import { rest } from 'msw'; +import fs from 'fs'; +import path from 'path'; +import { requestList } from './env'; + +// Define handlers that catch the corresponding requests and returns the mock data. +const mainMainifestUrl = + 'http://localhost:1111/resources/main/federation-manifest.json'; + +export const handlers = [ + rest.get(mainMainifestUrl, (req, res, ctx) => { + requestList.set( + mainMainifestUrl, + (requestList.get(mainMainifestUrl) || 0) + 1, + ); + const manifestJson = fs.readFileSync( + path.resolve(__dirname, '../resources/main/federation-manifest.json'), + 'utf-8', + ); + return res(ctx.status(200), ctx.json(JSON.parse(manifestJson))); + }), + rest.get( + 'http://localhost:1111/resources/:category/:app/:file', + (req, res, ctx) => { + const category = req.params.category; + const app = req.params.app; + const file = req.params.file; + const filepath = path.resolve( + __dirname, + `../resources/${category}/${app}/${file}`, + ); + + const content = fs.readFileSync(filepath, 'utf-8'); + if (typeof file === 'string' && file.includes('json')) { + return res(ctx.status(200), ctx.json(JSON.parse(content))); + } else { + return res(ctx.status(200), ctx.text(content)); + } + }, + ), +]; diff --git a/packages/runtime-core/__tests__/mock/mock-script.ts b/packages/runtime-core/__tests__/mock/mock-script.ts new file mode 100644 index 00000000000..d5e8ab002b0 --- /dev/null +++ b/packages/runtime-core/__tests__/mock/mock-script.ts @@ -0,0 +1,132 @@ +import { safeWrapper } from '../../src/utils'; +import fs from 'fs'; +import path from 'path'; + +const mountElementMethods = [ + 'append', + 'appendChild', + 'insertBefore', + 'insertAdjacentElement', +]; + +const rawElementMethods = Object.create(null); + +type MatchInfo = { + baseUrl: string; + baseDir: string; +}; + +const responseMatchInfo: { + [key: string]: MatchInfo; +} = {}; + +// eslint-disable-next-line @typescript-eslint/ban-types +function injector(current: Function, methodName: string) { + return function (this: Element) { + const index = methodName === 'insertAdjacentElement' ? 1 : 0; + // eslint-disable-next-line prefer-rest-params + const el = arguments[index]; + // eslint-disable-next-line prefer-rest-params + const oriArguments = arguments; + + // eslint-disable-next-line prefer-rest-params + const originProcess = () => current.apply(this, oriArguments); + function evalScript(element: HTMLScriptElement, preload?: boolean) { + const matchInfoKey = Object.keys(responseMatchInfo).find( + (matchKey) => element?.src?.indexOf(matchKey) > -1, + ); + const matchInfo = matchInfoKey && responseMatchInfo[matchInfoKey]; + if ( + matchInfo && + element.tagName === 'SCRIPT' && + !element.src.includes('preload-resource') + ) { + element.setAttribute('innerHTML', matchInfoKey); + const nEl = document.createElement('script'); + const attrs = element.attributes; + for (let j = 0; j < attrs.length; j++) { + // Setting src causes a timeout + if (attrs[j].name !== 'src') { + nEl.setAttribute(attrs[j].name, attrs[j].value); + } + } + // eslint-disable-next-line no-restricted-syntax + for (const key in element) { + if (key !== 'src') { + safeWrapper(() => { + (nEl as any)[key] = (element as any)[key]; + }, true); + } else { + // Setting src causes a timeout + (nEl as any)['fakeSrc'] = (element as any)[key]; + } + } + const filePath = element.src + .replace(matchInfo.baseUrl, '') + .replace(/\?.*$/, ''); + + const execScriptContent = fs.readFileSync( + path.resolve(matchInfo.baseDir, filePath), + 'utf-8', + ); + // nEl.innerHTML = fs.readFileSync( + // path.resolve(matchInfo.baseDir, matchInfo.innerHTML), + // 'utf-8', + // ); + nEl.innerHTML = execScriptContent; + // vitest 无法让 jsdom 和当前环境处于同一个执行环境 + if (!preload) { + new Function(execScriptContent)(); + } + if (element && element.onload) { + element.onload.call(element); + } + // eslint-disable-next-line prefer-rest-params + oriArguments[index] = nEl; + } + } + if (el instanceof DocumentFragment) { + const listEl = el.querySelectorAll('script'); + listEl.forEach((element) => { + evalScript(element, true); + }); + } else if (el instanceof HTMLScriptElement) { + evalScript(el); + } + return originProcess(); + }; +} + +const rewrite = (methods: Array, builder: typeof injector) => { + for (const name of methods) { + const fn = (window.Element as any).prototype[name]; + rawElementMethods[name] = fn; + const wrapper = builder(fn, name); + (window.Element as any).prototype[name] = wrapper; + } +}; + +rewrite(mountElementMethods, injector); + +/** + * vite 无法让 jsdom 和当前环境处于同一个执行环境 + * 所以需要 mock script dom response + * 直接代理 http 返回结果无法对 script dom 进行处理 + * 目前实现的方式是通过劫持添加 script dom 的方法,将 script dom 的 src 替换为 script dom 的 innerHTML + */ +export const mockScriptDomResponse = ({ + baseUrl, + baseDir, +}: { + baseDir: string; + baseUrl: string; +}): (() => void) => { + responseMatchInfo[baseUrl] = { + baseDir, + baseUrl, + }; + + return () => { + delete responseMatchInfo[baseUrl]; + }; +}; diff --git a/packages/runtime-core/__tests__/mock/moduleInfo.ts b/packages/runtime-core/__tests__/mock/moduleInfo.ts new file mode 100644 index 00000000000..05a8f832916 --- /dev/null +++ b/packages/runtime-core/__tests__/mock/moduleInfo.ts @@ -0,0 +1,13 @@ +import { GlobalModuleInfo } from '@module-federation/sdk'; +import '../../src/global'; + +export function setMockModuleInfos(modules: GlobalModuleInfo): () => void { + globalThis.__FEDERATION__.moduleInfo = { + ...modules, + }; + return () => { + Object.keys(modules).forEach((key) => { + delete globalThis.__FEDERATION__.moduleInfo[key]; + }); + }; +} diff --git a/packages/runtime-core/__tests__/mock/server.ts b/packages/runtime-core/__tests__/mock/server.ts new file mode 100644 index 00000000000..2b79acb58ea --- /dev/null +++ b/packages/runtime-core/__tests__/mock/server.ts @@ -0,0 +1,4 @@ +import { setupServer } from 'msw/node'; +import { handlers } from './handlers'; +// This configures a Service Worker with the given request handlers. +export const server = setupServer(...handlers); diff --git a/packages/runtime-core/__tests__/mock/utils.ts b/packages/runtime-core/__tests__/mock/utils.ts new file mode 100644 index 00000000000..4ad4f3eafab --- /dev/null +++ b/packages/runtime-core/__tests__/mock/utils.ts @@ -0,0 +1,128 @@ +import createFetchMock from 'vitest-fetch-mock'; +import { vi } from 'vitest'; +import path from 'path'; +import fs from 'fs'; + +function isAbsolute(url: string) { + // `c:\\` 这种 case 返回 false,在浏览器中使用本地图片,应该用 file 协议 + if (!/^[a-zA-Z]:\\/.test(url)) { + if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(url)) { + return true; + } + } + return false; +} + +const fetchMocker = createFetchMock(vi); + +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +export function mockStaticServer({ + baseDir, + filterKeywords, + customerHeaders = {}, + basename = '', + responseMatchs = {}, +}: { + baseDir: string; + basename?: string; + filterKeywords?: Array; + customerHeaders?: Record>; + responseMatchs?: Record; +}) { + const match = (input: Request) => + Array.isArray(filterKeywords) + ? !filterKeywords.some((words) => input.url.includes(words)) + : true; + + fetchMocker.enableMocks(); + fetchMocker.doMock(); + + fetchMocker.mockIf(match, (req) => { + let pathname = req.url; + if (isAbsolute(req.url)) { + // eslint-disable-next-line prefer-destructuring + pathname = new URL(req.url).pathname; + if (basename) { + pathname = pathname.replace(basename, './'); + } + } + const fullDir = path.resolve(baseDir, `./${pathname}`); + const { ext } = path.parse(fullDir); + // prettier-ignore + const mimeType = + // eslint-disable-next-line no-nested-ternary + ext === '.html' ? + 'text/html' : + // eslint-disable-next-line no-nested-ternary + ext === '.js' ? + 'text/javascript' : + ext === '.css' ? + 'text/css' : + 'text/plain'; + const { timeConsuming = 0, ...headers } = customerHeaders[pathname] || { + timeConsuming: 0, + }; + + return new Promise((resolve, reject) => { + try { + const body = + responseMatchs[pathname] || fs.readFileSync(fullDir, 'utf-8'); + const res = { + url: req.url, + body, + headers: { + 'Content-Type': mimeType, + ...(headers || {}), + }, + }; + if (timeConsuming) { + setTimeout(() => resolve(res), timeConsuming); + } else { + resolve(res); + } + } catch (err) { + console.error( + `mockStaticServer: request ${pathname}, fullDir: ${fullDir}`, + ); + return reject(err); + } + }); + }); +} + +import { FederationRuntimePlugin } from '../../src/type'; +import { ProviderModuleInfo } from '@module-federation/sdk'; + +export const mockRemoteSnapshot: ( + uniqueId: string, + remoteSnapshots: { + [name: string]: ProviderModuleInfo; + }, +) => FederationRuntimePlugin = function (uniqueId, remoteSnapshots) { + return { + name: `mock-snapshot-${uniqueId}`, + loadSnapshot({ moduleInfo, ...info }) { + const key = `${moduleInfo.name}:${(moduleInfo as any).version}`; + const remoteSnapshot = remoteSnapshots[key]; + + if (remoteSnapshot) { + return { + moduleInfo, + ...info, + remoteSnapshot: remoteSnapshot, + globalSnapshot: remoteSnapshots, + }; + } + + return { moduleInfo, ...info, globalSnapshot: remoteSnapshots }; + }, + }; +}; + +export function removeScriptTags() { + const scriptTags = document.querySelectorAll('script'); // 获取页面中所有的 script 标签 + for (let i = 0; i < scriptTags.length; i++) { + // 循环所有 script 标签 + scriptTags[i].remove(); // 移除当前 script 标签 + } +} diff --git a/packages/runtime-core/__tests__/register-remotes.spec.ts b/packages/runtime-core/__tests__/register-remotes.spec.ts new file mode 100644 index 00000000000..b8295c8dbd2 --- /dev/null +++ b/packages/runtime-core/__tests__/register-remotes.spec.ts @@ -0,0 +1,105 @@ +import { assert, describe, it, expect } from 'vitest'; +import { FederationHost } from '../src/index'; + +describe('FederationHost', () => { + it('registers new remotes and loads them correctly', async () => { + const FM = new FederationHost({ + name: '@federation/instance', + version: '1.0.1', + remotes: [ + { + name: '@register-remotes/app1', + entry: + 'http://localhost:1111/resources/register-remotes/app1/federation-remote-entry.js', + }, + ], + }); + + const app1Module = await FM.loadRemote string>>( + '@register-remotes/app1/say', + ); + assert(app1Module); + const app1Res = await app1Module(); + expect(app1Res).toBe('hello app1 entry1'); + // Register new remotes + FM.registerRemotes([ + { + name: '@register-remotes/app2', + entry: + 'http://localhost:1111/resources/register-remotes/app2/federation-remote-entry.js', + }, + ]); + const app2Module = await FM.loadRemote string>>( + '@register-remotes/app2/say', + ); + assert(app2Module); + const res = await app2Module(); + expect(res).toBe('hello app2'); + }); + it('does not merge loaded remote by default', async () => { + const FM = new FederationHost({ + name: '@federation/instance', + version: '1.0.1', + remotes: [ + { + name: '@register-remotes/app1', + entry: + 'http://localhost:1111/resources/register-remotes/app1/federation-remote-entry.js', + }, + ], + }); + FM.registerRemotes([ + { + name: '@register-remotes/app1', + // Entry is different from the registered remote + entry: + 'http://localhost:1111/resources/register-remotes/app1/federation-remote-entry2.js', + }, + ]); + + const app1Module = await FM.loadRemote string>>( + '@register-remotes/app1/say', + ); + assert(app1Module); + const app1Res = await app1Module(); + expect(app1Res).toBe('hello app1 entry1'); + }); + it('merges loaded remote by setting "force: true"', async () => { + const FM = new FederationHost({ + name: '@federation/instance', + version: '1.0.1', + remotes: [ + { + name: '@register-remotes/app1', + entry: + 'http://localhost:1111/resources/register-remotes/app1/federation-remote-entry.js', + }, + ], + }); + const app1Module = await FM.loadRemote string>>( + '@register-remotes/app1/say', + ); + assert(app1Module); + const app1Res = await app1Module(); + expect(app1Res).toBe('hello app1 entry1'); + + FM.registerRemotes( + [ + { + name: '@register-remotes/app1', + // Entry is different from the registered remote + entry: + 'http://localhost:1111/resources/register-remotes/app1/federation-remote-entry2.js', + }, + ], + { force: true }, + ); + const newApp1Module = await FM.loadRemote string>>( + '@register-remotes/app1/say', + ); + assert(newApp1Module); + const newApp1Res = await newApp1Module(); + // Value is different from the registered remote + expect(newApp1Res).toBe('hello app1 entry2'); + }); +}); diff --git a/packages/runtime-core/__tests__/resources/app2/federation-remote-entry.js b/packages/runtime-core/__tests__/resources/app2/federation-remote-entry.js new file mode 100644 index 00000000000..e612ba419c4 --- /dev/null +++ b/packages/runtime-core/__tests__/resources/app2/federation-remote-entry.js @@ -0,0 +1,11 @@ +globalThis[`__FEDERATION_${'@federation-test/app2:custom'}__`] = { + get(scope) { + const moduleMap = { + './say'() { + return () => 'hello app2'; + }, + }; + return moduleMap[scope]; + }, + init() {}, +}; diff --git a/packages/runtime-core/__tests__/resources/hooks/app2/federation-remote-entry.js b/packages/runtime-core/__tests__/resources/hooks/app2/federation-remote-entry.js new file mode 100644 index 00000000000..6208ccec3f6 --- /dev/null +++ b/packages/runtime-core/__tests__/resources/hooks/app2/federation-remote-entry.js @@ -0,0 +1,11 @@ +globalThis[`@loader-hooks/app2`] = { + get(scope) { + const moduleMap = { + './say'() { + return () => 'hello app2'; + }, + }; + return moduleMap[scope]; + }, + init() {}, +}; diff --git a/packages/runtime-core/__tests__/resources/hooks/app3/federation-remote-entry.js b/packages/runtime-core/__tests__/resources/hooks/app3/federation-remote-entry.js new file mode 100644 index 00000000000..9b646215b9f --- /dev/null +++ b/packages/runtime-core/__tests__/resources/hooks/app3/federation-remote-entry.js @@ -0,0 +1,11 @@ +globalThis[`@loader-hooks/app3`] = { + get(scope) { + const moduleMap = { + './say'() { + return () => 'hello app3'; + }, + }; + return moduleMap[scope]; + }, + init() {}, +}; diff --git a/packages/runtime-core/__tests__/resources/load-remote/app1/federation-remote-entry.js b/packages/runtime-core/__tests__/resources/load-remote/app1/federation-remote-entry.js new file mode 100644 index 00000000000..15303841e90 --- /dev/null +++ b/packages/runtime-core/__tests__/resources/load-remote/app1/federation-remote-entry.js @@ -0,0 +1,11 @@ +globalThis[`__FEDERATION_${'@load-remote/app1:custom'}__`] = { + get(scope) { + const moduleMap = { + './say'() { + return () => 'hello app1'; + }, + }; + return moduleMap[scope]; + }, + init() {}, +}; diff --git a/packages/runtime-core/__tests__/resources/load-remote/app2/federation-remote-entry.js b/packages/runtime-core/__tests__/resources/load-remote/app2/federation-remote-entry.js new file mode 100644 index 00000000000..82dac44dbe6 --- /dev/null +++ b/packages/runtime-core/__tests__/resources/load-remote/app2/federation-remote-entry.js @@ -0,0 +1,11 @@ +globalThis[`__FEDERATION_${'@load-remote/app2:custom'}__`] = { + get(scope) { + const moduleMap = { + './say'() { + return () => 'hello app2'; + }, + }; + return moduleMap[scope]; + }, + init() {}, +}; diff --git a/packages/runtime-core/__tests__/resources/load-remote/app2/say.sync.js b/packages/runtime-core/__tests__/resources/load-remote/app2/say.sync.js new file mode 100644 index 00000000000..e7afb6d561a --- /dev/null +++ b/packages/runtime-core/__tests__/resources/load-remote/app2/say.sync.js @@ -0,0 +1 @@ +console.log('load-remote say.sync.js loaded'); diff --git a/packages/runtime-core/__tests__/resources/load-remote/circulate-dep-app1/federation-manifest.json b/packages/runtime-core/__tests__/resources/load-remote/circulate-dep-app1/federation-manifest.json new file mode 100644 index 00000000000..bfe3e3ee89b --- /dev/null +++ b/packages/runtime-core/__tests__/resources/load-remote/circulate-dep-app1/federation-manifest.json @@ -0,0 +1,51 @@ +{ + "id": "@circulate-deps/app1", + "name": "@circulate-deps/app1", + "metaData": { + "name": "@circulate-deps/app1", + "publicPath": "http://localhost:1111/", + "type": "app", + "buildInfo": { + "buildVersion": "custom" + }, + "remoteEntry": { + "name": "federation-remote-entry.js", + "path": "resources/load-remote/circulate-dep-app1/" + }, + "types": { + "name": "index.d.ts", + "path": "./" + }, + "globalName": "__FEDERATION_@circulate-deps/app1:local__" + }, + "remotes": [ + { + "alias": "@circulate-deps/app2", + "consumingFederationContainerName": "@circulate-deps/app1", + "federationContainerName": "@circulate-deps/app2", + "moduleName": "Say", + "usedIn": ["src/routes/user/page.tsx"], + "entry": "http://localhost:1111/resources/load-remote/circulate-dep-app2/federation-manifest.json" + } + ], + "shared": [], + "exposes": [ + { + "id": "@circulate-deps/app1:shared-button", + "name": "say", + "requires": [], + "file": "./src/say.tsx", + "federationContainerName": "@circulate-deps/app1", + "assets": { + "js": { + "sync": [], + "async": [] + }, + "css": { + "sync": [], + "async": [] + } + } + } + ] +} diff --git a/packages/runtime-core/__tests__/resources/load-remote/circulate-dep-app1/federation-remote-entry.js b/packages/runtime-core/__tests__/resources/load-remote/circulate-dep-app1/federation-remote-entry.js new file mode 100644 index 00000000000..e5601d6762c --- /dev/null +++ b/packages/runtime-core/__tests__/resources/load-remote/circulate-dep-app1/federation-remote-entry.js @@ -0,0 +1,13 @@ +globalThis[`__FEDERATION_@circulate-deps/app1:local__`] = { + get(scope) { + const moduleMap = { + './say'() { + return () => { + return '@circulate-deps/app1'; + }; + }, + }; + return moduleMap[scope]; + }, + init() {}, +}; diff --git a/packages/runtime-core/__tests__/resources/load-remote/circulate-dep-app2/federation-manifest.json b/packages/runtime-core/__tests__/resources/load-remote/circulate-dep-app2/federation-manifest.json new file mode 100644 index 00000000000..cfa534bd237 --- /dev/null +++ b/packages/runtime-core/__tests__/resources/load-remote/circulate-dep-app2/federation-manifest.json @@ -0,0 +1,51 @@ +{ + "id": "@circulate-deps/app2", + "name": "@circulate-deps/app2", + "metaData": { + "name": "@circulate-deps/app2", + "publicPath": "http://localhost:1111/", + "type": "app", + "buildInfo": { + "buildVersion": "custom" + }, + "remoteEntry": { + "name": "federation-remote-entry.js", + "path": "resources/load-remote/circulate-dep-app2/" + }, + "types": { + "name": "index.d.ts", + "path": "./" + }, + "globalName": "__FEDERATION_@circulate-deps/app2:local__" + }, + "remotes": [ + { + "alias": "@circulate-deps/app1", + "consumingFederationContainerName": "@circulate-deps/app2", + "federationContainerName": "@circulate-deps/app1", + "moduleName": "Say", + "usedIn": ["src/routes/user/page.tsx"], + "entry": "http://localhost:1111/resources/load-remote/circulate-dep-app1/federation-manifest.json" + } + ], + "shared": [], + "exposes": [ + { + "id": "@circulate-deps/app2:shared-button", + "name": "say", + "requires": [], + "file": "./src/say.tsx", + "federationContainerName": "@circulate-deps/app2", + "assets": { + "js": { + "sync": [], + "async": [] + }, + "css": { + "sync": [], + "async": [] + } + } + } + ] +} diff --git a/packages/runtime-core/__tests__/resources/load-remote/circulate-dep-app2/federation-remote-entry.js b/packages/runtime-core/__tests__/resources/load-remote/circulate-dep-app2/federation-remote-entry.js new file mode 100644 index 00000000000..6a8f1252dc1 --- /dev/null +++ b/packages/runtime-core/__tests__/resources/load-remote/circulate-dep-app2/federation-remote-entry.js @@ -0,0 +1,34 @@ +globalThis[`__FEDERATION_@circulate-deps/app2:local__`] = { + get(scope) { + const moduleMap = { + './say'() { + return () => { + return new Promise((resolve) => { + const remoteId = '@circulate-deps/app1/say'; + const federationInstance = + globalThis.__FEDERATION__.__INSTANCES__[1]; + federationInstance.loadRemote(remoteId).then((m) => { + m(); + resolve('@circulate-deps/app2'); + }); + }); + }; + }, + }; + return moduleMap[scope]; + }, + init() { + const ins = new globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__({ + name: '@circulate-deps/app2', + version: '0.0.1', + remotes: [ + { + name: '@circulate-deps/app1', + entry: + 'http://localhost:1111/resources/load-remote/circulate-dep-app1/federation-manifest.json', + }, + ], + }); + globalThis.__FEDERATION__.__INSTANCES__.push(ins); + }, +}; diff --git a/packages/runtime-core/__tests__/resources/load-remote/diff-instance/federation-remote-entry.js b/packages/runtime-core/__tests__/resources/load-remote/diff-instance/federation-remote-entry.js new file mode 100644 index 00000000000..ed95063ad11 --- /dev/null +++ b/packages/runtime-core/__tests__/resources/load-remote/diff-instance/federation-remote-entry.js @@ -0,0 +1,16 @@ +if (!globalThis.execTime) { + globalThis.execTime = 0; +} +globalThis.execTime++; + +globalThis[`__FEDERATION_${'@module-federation/sub1:1.0.2'}__`] = { + get(scope) { + const moduleMap = { + '.'() { + return () => 'hello world'; + }, + }; + return moduleMap[scope]; + }, + init() {}, +}; diff --git a/packages/runtime-core/__tests__/resources/main/federation-manifest.json b/packages/runtime-core/__tests__/resources/main/federation-manifest.json new file mode 100644 index 00000000000..a79ad883fb7 --- /dev/null +++ b/packages/runtime-core/__tests__/resources/main/federation-manifest.json @@ -0,0 +1,38 @@ +{ + "id": "@demo/main", + "name": "@demo/main", + "metaData": { + "name": "@demo/main", + "publicPath": "http://localhost:1111/", + "type": "app", + "buildInfo": { + "buildVersion": "custom" + }, + "remoteEntry": { + "name": "federation-remote-entry.js", + "path": "resources/main/" + }, + "types": { + "name": "index.d.ts", + "path": "./" + } + }, + "remotes": [], + "shared": [], + "exposes": [ + { + "id": "@demo/main:shared-button", + "name": "shared-button", + "requires": [], + "file": "./src/button.tsx", + "federationContainerName": "@demo/main", + "assets": { + "sync": [ + "src_button_tsx.87761dde02c2b29b68b3.js", + "vendors-_eden-mono_temp_node_modules_pnpm_react_17_0_2_node_modules_react_index_js.782f16d0ce02b62c1fe3.js" + ], + "async": [] + } + } + ] +} diff --git a/packages/runtime-core/__tests__/resources/main/federation-remote-entry.js b/packages/runtime-core/__tests__/resources/main/federation-remote-entry.js new file mode 100644 index 00000000000..653efb660d6 --- /dev/null +++ b/packages/runtime-core/__tests__/resources/main/federation-remote-entry.js @@ -0,0 +1,14 @@ +globalThis[`__FEDERATION_${'@demo/main:custom'}__`] = { + get(scope) { + const moduleMap = { + './say'() { + return () => 'hello world'; + }, + './add'() { + return (...args) => args.reduce((cur, next) => cur + next, 0); + }, + }; + return moduleMap[scope]; + }, + init() {}, +}; diff --git a/packages/runtime-core/__tests__/resources/preload/preload-resource/federation-remote-entry.js b/packages/runtime-core/__tests__/resources/preload/preload-resource/federation-remote-entry.js new file mode 100644 index 00000000000..d22ad4fce62 --- /dev/null +++ b/packages/runtime-core/__tests__/resources/preload/preload-resource/federation-remote-entry.js @@ -0,0 +1,16 @@ +// eslint-disable-next-line no-var +var pkgName = '@federation/sub1'; +// eslint-disable-next-line no-var +var version = 'custom'; + +globalThis[`__FEDERATION_${`${pkgName}:${version}`}__`] = { + get(scope) { + const moduleMap = { + './say'() { + return () => 'hello app2'; + }, + }; + return moduleMap[scope]; + }, + init() {}, +}; diff --git a/packages/runtime-core/__tests__/resources/register-remotes/app1/federation-remote-entry.js b/packages/runtime-core/__tests__/resources/register-remotes/app1/federation-remote-entry.js new file mode 100644 index 00000000000..ca083a5256c --- /dev/null +++ b/packages/runtime-core/__tests__/resources/register-remotes/app1/federation-remote-entry.js @@ -0,0 +1,11 @@ +globalThis[`@register-remotes/app1`] = { + get(scope) { + const moduleMap = { + './say'() { + return () => 'hello app1 entry1'; + }, + }; + return moduleMap[scope]; + }, + init() {}, +}; diff --git a/packages/runtime-core/__tests__/resources/register-remotes/app1/federation-remote-entry2.js b/packages/runtime-core/__tests__/resources/register-remotes/app1/federation-remote-entry2.js new file mode 100644 index 00000000000..081aa3c23bc --- /dev/null +++ b/packages/runtime-core/__tests__/resources/register-remotes/app1/federation-remote-entry2.js @@ -0,0 +1,11 @@ +globalThis[`@register-remotes/app1`] = { + get(scope) { + const moduleMap = { + './say'() { + return () => 'hello app1 entry2'; + }, + }; + return moduleMap[scope]; + }, + init() {}, +}; diff --git a/packages/runtime-core/__tests__/resources/register-remotes/app2/federation-remote-entry.js b/packages/runtime-core/__tests__/resources/register-remotes/app2/federation-remote-entry.js new file mode 100644 index 00000000000..6014cc9afe8 --- /dev/null +++ b/packages/runtime-core/__tests__/resources/register-remotes/app2/federation-remote-entry.js @@ -0,0 +1,11 @@ +globalThis[`@register-remotes/app2`] = { + get(scope) { + const moduleMap = { + './say'() { + return () => 'hello app2'; + }, + }; + return moduleMap[scope]; + }, + init() {}, +}; diff --git a/packages/runtime-core/__tests__/resources/snapshot/remote1/federation-manifest.json b/packages/runtime-core/__tests__/resources/snapshot/remote1/federation-manifest.json new file mode 100644 index 00000000000..c0308650dc6 --- /dev/null +++ b/packages/runtime-core/__tests__/resources/snapshot/remote1/federation-manifest.json @@ -0,0 +1,24 @@ +{ + "id": "@snapshot/remote1", + "name": "@snapshot/remote1", + "metaData": { + "name": "@snapshot/remote1", + "publicPath": "http://localhost:1111/", + "type": "app", + "globalName": "@snapshot/remote1", + "buildInfo": { + "buildVersion": "custom" + }, + "remoteEntry": { + "name": "federation-remote-entry.js", + "path": "resources/snapshot/remote1" + }, + "types": { + "name": "index.d.ts", + "path": "./" + } + }, + "remotes": [], + "shared": [], + "exposes": [] +} diff --git a/packages/runtime-core/__tests__/resources/snapshot/remote1/federation-remote-entry.js b/packages/runtime-core/__tests__/resources/snapshot/remote1/federation-remote-entry.js new file mode 100644 index 00000000000..b3927ef9b8a --- /dev/null +++ b/packages/runtime-core/__tests__/resources/snapshot/remote1/federation-remote-entry.js @@ -0,0 +1,11 @@ +globalThis[`@snapshot/remote1`] = { + get(scope) { + const moduleMap = { + './say'() { + return () => 'hello world "@snapshot/remote1"'; + }, + }; + return moduleMap[scope]; + }, + init() {}, +}; diff --git a/packages/runtime-core/__tests__/resources/snapshot/remote2/federation-manifest.json b/packages/runtime-core/__tests__/resources/snapshot/remote2/federation-manifest.json new file mode 100644 index 00000000000..8501bc698f2 --- /dev/null +++ b/packages/runtime-core/__tests__/resources/snapshot/remote2/federation-manifest.json @@ -0,0 +1,24 @@ +{ + "id": "@snapshot/remote2", + "name": "@snapshot/remote2", + "metaData": { + "name": "@snapshot/remote2", + "publicPath": "http://localhost:1111/", + "type": "app", + "globalName": "@snapshot/remote2", + "buildInfo": { + "buildVersion": "custom" + }, + "remoteEntry": { + "name": "federation-remote-entry.js", + "path": "resources/snapshot/remote2" + }, + "types": { + "name": "index.d.ts", + "path": "./" + } + }, + "remotes": [], + "shared": [], + "exposes": [] +} diff --git a/packages/runtime-core/__tests__/resources/snapshot/remote2/federation-remote-entry.js b/packages/runtime-core/__tests__/resources/snapshot/remote2/federation-remote-entry.js new file mode 100644 index 00000000000..f91555f6aaa --- /dev/null +++ b/packages/runtime-core/__tests__/resources/snapshot/remote2/federation-remote-entry.js @@ -0,0 +1,11 @@ +globalThis[`@snapshot/remote2`] = { + get(scope) { + const moduleMap = { + './say'() { + return () => 'hello world "@snapshot/remote2"'; + }, + }; + return moduleMap[scope]; + }, + init() {}, +}; diff --git a/packages/runtime-core/__tests__/resources/version-strategy-app2/federation-remote-entry.js b/packages/runtime-core/__tests__/resources/version-strategy-app2/federation-remote-entry.js new file mode 100644 index 00000000000..3ec1c2bd6aa --- /dev/null +++ b/packages/runtime-core/__tests__/resources/version-strategy-app2/federation-remote-entry.js @@ -0,0 +1,32 @@ +globalThis[ + `__FEDERATION_${'@federation-test/version-strategy-app2:custom'}__` +] = { + get(scope) { + const moduleMap = { + './say'() { + return () => 'hello app2'; + }, + }; + return moduleMap[scope]; + }, + init(shareScope) { + const ins = new globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__({ + name: '@shared-test/version-strategy-app2', + version: '0.0.1', + shared: { + 'runtime-react': { + version: '16.2.0', + scope: 'default', + strategy: 'loaded-first', + get: () => () => { + return { from: '@shared-test/version-strategy-app2' }; + }, + }, + }, + }); + globalThis.__FEDERATION__.__INSTANCES__.push(ins); + ins.initShareScopeMap('default', shareScope); + + return ins.initializeSharing(); + }, +}; diff --git a/packages/runtime-core/__tests__/semver.spec.ts b/packages/runtime-core/__tests__/semver.spec.ts new file mode 100644 index 00000000000..8bd41e475df --- /dev/null +++ b/packages/runtime-core/__tests__/semver.spec.ts @@ -0,0 +1,228 @@ +// Test cases for semver ranges taken from https://devhints.io/semver +import { describe, expect, test } from 'vitest'; +import { satisfy } from '../src/utils/semver'; + +const version = '1.2.3'; +const belowVersion = '1.2.2'; +const aboveVersion = '1.2.4'; +const tildeMaxVersion = '1.3.0'; +const caretMaxVersion = '2.0.0'; + +const tilde = '~1.2.3'; +const specialTilde1 = '~1.2'; +const specialTilde2 = '~1'; + +const caret = '^1.2.3'; +const specialCaret1 = '^0.2.3'; +const specialCaret2 = '^0.0.1'; +const specialCaret3 = '^1.2'; +const specialCaret4 = '^1'; + +const xRange = '1'; +const xRange1 = '*'; +const xRange2 = 'x'; +const specialXRange1 = '1.x'; +const specialXRange2 = '1.*'; + +describe('satisfy ranges', () => { + test('tilde', () => { + expect(satisfy(version, tilde)).toBe(true); + expect(satisfy(belowVersion, tilde)).toBe(false); + expect(satisfy(aboveVersion, tilde)).toBe(true); + expect(satisfy(tildeMaxVersion, tilde)).toBe(false); + }); + + describe('special tilde', () => { + test('special tilde 1', () => { + expect(satisfy('1.2.0', specialTilde1)).toBe(true); + expect(satisfy('1.2.4', specialTilde1)).toBe(true); + expect(satisfy('1.1.9', specialTilde1)).toBe(false); + expect(satisfy('1.3.0', specialTilde1)).toBe(false); + }); + + test('special tilde 2', () => { + expect(satisfy('1.0.0', specialTilde2)).toBe(true); + expect(satisfy('0.0.9', specialTilde2)).toBe(false); + expect(satisfy('1.3.0', specialTilde2)).toBe(true); + expect(satisfy('2.0.0', specialTilde2)).toBe(false); + }); + }); + + test('caret', () => { + expect(satisfy(version, caret)).toBe(true); + expect(satisfy(belowVersion, caret)).toBe(false); + expect(satisfy(aboveVersion, caret)).toBe(true); + expect(satisfy(caretMaxVersion, caret)).toBe(false); + }); + + describe('special caret', () => { + test('special caret 1', () => { + expect(satisfy('0.2.3', specialCaret1)).toBe(true); + expect(satisfy('0.2.2', specialCaret1)).toBe(false); + expect(satisfy('0.2.5', specialCaret1)).toBe(true); + expect(satisfy('0.3.0', specialCaret1)).toBe(false); + }); + + test('special caret 2', () => { + expect(satisfy('0.0.1', specialCaret2)).toBe(true); + expect(satisfy('0.0.0', specialCaret2)).toBe(false); + expect(satisfy('0.0.2', specialCaret2)).toBe(false); + }); + + test('special caret 3', () => { + expect(satisfy('1.2.0', specialCaret3)).toBe(true); + expect(satisfy('1.3.3', specialCaret3)).toBe(true); + expect(satisfy('1.1.9', specialCaret3)).toBe(false); + expect(satisfy('2.0.0', specialCaret3)).toBe(false); + }); + + test('special caret 4', () => { + expect(satisfy('1.0.0', specialCaret4)).toBe(true); + expect(satisfy('0.0.9', specialCaret4)).toBe(false); + expect(satisfy('1.3.0', specialCaret4)).toBe(true); + expect(satisfy('2.0.0', specialCaret4)).toBe(false); + }); + }); + + describe('x ranges', () => { + test('x range', () => { + expect(satisfy('1.0.0', xRange)).toBe(true); + expect(satisfy('0.0.9', xRange)).toBe(false); + expect(satisfy('1.3.0', xRange)).toBe(true); + expect(satisfy('2.0.0', xRange)).toBe(false); + }); + + test('x range 1', () => { + expect(satisfy('1.0.0', xRange1)).toBe(true); + expect(satisfy('0.0.9', xRange1)).toBe(true); + expect(satisfy('1.3.0', xRange1)).toBe(true); + expect(satisfy('2.0.0', xRange1)).toBe(true); + }); + + test('x range 2', () => { + expect(satisfy('1.0.0', xRange2)).toBe(true); + expect(satisfy('0.0.9', xRange2)).toBe(true); + expect(satisfy('1.3.0', xRange2)).toBe(true); + expect(satisfy('2.0.0', xRange2)).toBe(true); + }); + }); + + describe('special x range', () => { + test('special x range 1', () => { + expect(satisfy('1.0.0', specialXRange1)).toBe(true); + expect(satisfy('0.0.9', specialXRange1)).toBe(false); + expect(satisfy('1.3.0', specialXRange1)).toBe(true); + expect(satisfy('2.0.0', specialXRange1)).toBe(false); + }); + + test('special x range 2', () => { + expect(satisfy('1.0.0', specialXRange2)).toBe(true); + expect(satisfy('0.0.9', specialXRange2)).toBe(false); + expect(satisfy('1.3.0', specialXRange2)).toBe(true); + expect(satisfy('2.0.0', specialXRange2)).toBe(false); + }); + }); +}); + +describe('simple ranges', () => { + test('empty operator', () => { + expect(satisfy('1.2.3', '1.2.3')).toBe(true); + expect(satisfy('1.2.2', '1.2.3')).toBe(false); + expect(satisfy('1.2.4', '1.2.3')).toBe(false); + }); + + test('= operator', () => { + expect(satisfy('1.2.3', '=1.2.3')).toBe(true); + expect(satisfy('1.2.2', '=1.2.3')).toBe(false); + expect(satisfy('1.2.4', '=1.2.3')).toBe(false); + }); + + test('> operator', () => { + expect(satisfy('1.2.3', '>1.2.3')).toBe(false); + expect(satisfy('1.2.2', '>1.2.3')).toBe(false); + expect(satisfy('1.2.4', '>1.2.3')).toBe(true); + }); + + test('< operator', () => { + expect(satisfy('1.2.3', '<1.2.3')).toBe(false); + expect(satisfy('1.2.2', '<1.2.3')).toBe(true); + expect(satisfy('1.2.4', '<1.2.3')).toBe(false); + }); + + test('>= operator', () => { + expect(satisfy('1.2.3', '>=1.2.3')).toBe(true); + expect(satisfy('1.2.2', '>=1.2.3')).toBe(false); + expect(satisfy('1.2.4', '>=1.2.3')).toBe(true); + }); + + test('<= operator', () => { + expect(satisfy('1.2.3', '<=1.2.3')).toBe(true); + expect(satisfy('1.2.2', '<=1.2.3')).toBe(true); + expect(satisfy('1.2.4', '<=1.2.3')).toBe(false); + }); + test('>= Array', () => { + const array = ['1.2.3', '1.2.4', '1.2.0', '1.2.9']; + const map = array.sort((a, b) => { + if (satisfy(a, '<=' + b)) { + return 1; + } else { + return -1; + } + }); + expect(map).toEqual(expect.arrayContaining(array)); + }); +}); + +describe('hyphenated ranges', () => { + test('normal hyphen', () => { + expect(satisfy('1.2.3', '1.2.3 - 2.3.4')).toBe(true); + expect(satisfy('1.2.2', '1.2.3 - 2.3.4')).toBe(false); + expect(satisfy('1.3.3', '1.2.3 - 2.3.4')).toBe(true); + expect(satisfy('2.3.4', '1.2.3 - 2.3.4')).toBe(true); + expect(satisfy('2.3.5', '1.2.3 - 2.3.4')).toBe(false); + }); + + test('partial right hyphen', () => { + expect(satisfy('1.2.3', '1.2.3 - 2.3')).toBe(true); + expect(satisfy('1.2.2', '1.2.3 - 2.3')).toBe(false); + expect(satisfy('1.3.3', '1.2.3 - 2.3')).toBe(true); + expect(satisfy('2.3.9', '1.2.3 - 2.3')).toBe(true); + expect(satisfy('2.4.0', '1.2.3 - 2.3')).toBe(false); + + expect(satisfy('1.2.3', '1.2.3 - 2')).toBe(true); + expect(satisfy('1.2.2', '1.2.3 - 2')).toBe(false); + expect(satisfy('1.3.3', '1.2.3 - 2')).toBe(true); + expect(satisfy('2.9.9', '1.2.3 - 2')).toBe(true); + expect(satisfy('3.0.0', '1.2.3 - 2')).toBe(false); + }); + + test('partial left hyphen', () => { + expect(satisfy('1.2.0', '1.2 - 2.3.0')).toBe(true); + expect(satisfy('1.1.0', '1.2 - 2.3.0')).toBe(false); + expect(satisfy('1.2.2', '1.2 - 2.3.0')).toBe(true); + expect(satisfy('1.3.3', '1.2 - 2.3.0')).toBe(true); + expect(satisfy('2.3.0', '1.2 - 2.3.0')).toBe(true); + expect(satisfy('2.4.0', '1.2 - 2.3.0')).toBe(false); + }); +}); + +describe('pre-release', () => { + test('fixed version', () => { + expect(satisfy('1.2.3-prerelease+build', '1.2.3-prerelease+build')).toBe( + true, + ); + expect(satisfy('1.2.3-prerelease', '1.2.3-prerelease+build')).toBe(true); + expect(satisfy('4.0.0', '4.0.0-alpha.57')).toBe(false); + expect(satisfy('4.0.0-alpha.57', '4.0.0-alpha.57')).toBe(true); + expect(satisfy('4.0.0-alpha.58', '4.0.0-alpha.57')).toBe(false); + expect(satisfy('4.0.0-alpha.56', '4.0.0-alpha.57')).toBe(false); + }); + + test('caret version', () => { + expect(satisfy('4.0.0', '^4.0.0-alpha.57')).toBe(true); + expect(satisfy('4.0.0-alpha.58', '^4.0.0-alpha.57')).toBe(true); + expect(satisfy('4.0.0-alpha.56', '^4.0.0-alpha.57')).toBe(false); + expect(satisfy('4.0.0-beta.56', '^4.0.0-alpha.57')).toBe(true); + expect(satisfy('4.0.0-alpha.58', '^4.0.0-beta.57')).toBe(false); + }); +}); diff --git a/packages/runtime-core/__tests__/setup.ts b/packages/runtime-core/__tests__/setup.ts new file mode 100644 index 00000000000..4c7f9efcca8 --- /dev/null +++ b/packages/runtime-core/__tests__/setup.ts @@ -0,0 +1,18 @@ +import 'whatwg-fetch'; +import { server } from './mock/server'; +import { mockScriptDomResponse } from './mock/mock-script'; +import { requestList } from './mock/env'; +import { resetFederationGlobalInfo } from '../src/global'; + +mockScriptDomResponse({ + baseDir: __dirname, + baseUrl: 'http://localhost:1111/', +}); + +beforeAll(() => server.listen({ onUnhandledRequest: 'bypass' })); +afterAll(() => server.close()); +afterEach(() => { + resetFederationGlobalInfo(); + requestList.clear(); + server.resetHandlers(); +}); diff --git a/packages/runtime-core/__tests__/share.ts b/packages/runtime-core/__tests__/share.ts new file mode 100644 index 00000000000..df07b6bdf91 --- /dev/null +++ b/packages/runtime-core/__tests__/share.ts @@ -0,0 +1,156 @@ +import { GlobalShareScopeMap, Options } from '../src/type'; +export const mergeShareInfo1 = { + name: '@federation/merge-shared', + remotes: [], + shared: { + react: { + version: '16.0.0', + scope: ['default'], + shareConfig: { + singleton: true, + requiredVersion: '^16.0.0', + eager: false, + }, + get: () => + Promise.resolve(() => ({ + default: 'react', + version: '16.0.0', + from: '@federation/merge-shared', + })), + }, + }, +}; + +export const mergeShareInfo2 = { + name: '@federation/merge-shared', + remotes: [], + shared: { + 'react-dom': { + version: '17.0.0', + scope: ['default', 'sub2'], + get: () => + Promise.resolve(() => ({ + default: 'react-dom', + version: '17.0.0', + from: '@federation/merge-shared', + })), + }, + }, +}; + +export const mergeShareInfo3 = { + name: '@federation/merge-shared3', + remotes: [], + shared: { + 'react-dom': { + version: '16.0.0', + scope: ['default', 'sub2'], + get: () => + Promise.resolve(() => ({ + default: 'react-dom', + version: '16.0.0', + from: '@federation/merge-shared3', + })), + }, + }, +}; + +export const localMergeShareInfos: Options['shared'] = { + react: [ + { + version: '16.0.0', + from: mergeShareInfo1.name, + get: mergeShareInfo1.shared.react.get, + shareConfig: { + singleton: true, + requiredVersion: '^16.0.0', + eager: false, + }, + scope: ['default'], + useIn: [], + deps: [], + strategy: 'version-first', + }, + ], + 'react-dom': [ + { + version: '17.0.0', + from: mergeShareInfo2.name, + get: mergeShareInfo2.shared['react-dom'].get, + shareConfig: { + singleton: false, + requiredVersion: '^17.0.0', + eager: false, + }, + scope: ['default', 'sub2'], + useIn: [], + deps: [], + strategy: 'version-first', + }, + ], +}; + +export const arrayShared = { + name: '@federation/array-shared', + remotes: [], + shared: { + 'react-dom': [ + { + version: '16.0.0', + scope: ['default', 'sub2'], + get: () => + Promise.resolve(() => ({ + default: 'react-dom', + version: '16.0.0', + from: '@federation/array-shared', + })), + }, + { + version: '17.0.0', + scope: ['default', 'sub2'], + get: () => + Promise.resolve(() => ({ + default: 'react-dom', + version: '17.0.0', + from: '@federation/array-shared', + })), + }, + ], + }, +}; + +export const arraySharedInfos = { + 'react-dom': arrayShared.shared['react-dom'], +}; + +export const shareInfoWithoutLibAndGetConsumer = { + name: '@federation/shared-config-consumer', + remotes: [], + shared: { + 'react-dom': { + scope: ['default'], + shareConfig: { + singleton: true, + requiredVersion: '^16.0.0', + eager: false, + }, + }, + }, +}; + +export const shareInfoWithoutLibAndGetProvider = { + name: '@federation/shared-config-provider', + remotes: [], + shared: { + 'react-dom': { + version: '16.0.0', + scope: ['default'], + get: () => + Promise.resolve(() => ({ + default: 'react-dom', + version: '16.0.0', + from: '@federation/shared-config-provider', + })), + }, + }, +}; diff --git a/packages/runtime-core/__tests__/snapshot.spec.ts b/packages/runtime-core/__tests__/snapshot.spec.ts new file mode 100644 index 00000000000..64e31c00512 --- /dev/null +++ b/packages/runtime-core/__tests__/snapshot.spec.ts @@ -0,0 +1,49 @@ +import { assert, describe, it } from 'vitest'; +import { FederationHost } from '../src'; +import { getGlobalSnapshot, resetFederationGlobalInfo } from '../src/global'; + +describe('snapshot', () => { + beforeEach(() => { + resetFederationGlobalInfo(); + }); + + it('The host snapshot is automatically completed', async () => { + const Remote1Entry = + 'http://localhost:1111/resources/snapshot/remote1/federation-manifest.json'; + const Remote2Entry = + 'http://localhost:1111/resources/snapshot/remote2/federation-manifest.json'; + const FM1 = new FederationHost({ + name: '@snapshot/host', + version: '0.0.3', + remotes: [ + { + name: '@snapshot/remote1', + entry: Remote1Entry, + }, + { + name: '@snapshot/remote2', + entry: Remote2Entry, + }, + ], + }); + + const module = await FM1.loadRemote<() => string>('@snapshot/remote1/say'); + assert(module); + expect(module()).toBe('hello world "@snapshot/remote1"'); + + const module2 = await FM1.loadRemote<() => string>('@snapshot/remote2/say'); + assert(module2); + expect(module2()).toBe('hello world "@snapshot/remote2"'); + + const globalSnapshot = getGlobalSnapshot(); + + assert(globalSnapshot['@snapshot/host']); + expect(globalSnapshot['@snapshot/host']).toMatchObject({ + version: '0.0.3', + remotesInfo: { + '@snapshot/remote1': { matchedVersion: Remote1Entry }, + '@snapshot/remote2': { matchedVersion: Remote2Entry }, + }, + }); + }); +}); diff --git a/packages/runtime-core/global.d.ts b/packages/runtime-core/global.d.ts new file mode 100644 index 00000000000..a74d2d87a02 --- /dev/null +++ b/packages/runtime-core/global.d.ts @@ -0,0 +1,5 @@ +declare const __VERSION__: string; +declare const FEDERATION_DEBUG: string; +declare const FEDERATION_BUILD_IDENTIFIER: string | undefined; +declare const __RELEASE_NUMBER__: number; +declare const FEDERATION_ALLOW_NEW_FUNCTION: string | undefined; diff --git a/packages/runtime-core/jest.config.ts b/packages/runtime-core/jest.config.ts new file mode 100644 index 00000000000..68edd54f0a7 --- /dev/null +++ b/packages/runtime-core/jest.config.ts @@ -0,0 +1,30 @@ +/* eslint-disable */ +import { readFileSync } from 'fs'; + +// Reading the SWC compilation config and remove the "exclude" +// for the test files to be compiled by SWC +const { exclude: _, ...swcJestConfig } = JSON.parse( + readFileSync(`${__dirname}/.swcrc`, 'utf-8'), +); + +// disable .swcrc look-up by SWC core because we're passing in swcJestConfig ourselves. +// If we do not disable this, SWC Core will read .swcrc and won't transform our test files due to "exclude" +if (swcJestConfig.swcrc === undefined) { + swcJestConfig.swcrc = false; +} + +// Uncomment if using global setup/teardown files being transformed via swc +// https://nx.dev/packages/jest/documents/overview#global-setup/teardown-with-nx-libraries +// jest needs EsModule Interop to find the default exported setup/teardown functions +// swcJestConfig.module.noInterop = false; + +export default { + displayName: 'runtime', + preset: '../../jest.preset.js', + transform: { + '^.+\\.[tj]s$': ['@swc/jest', swcJestConfig], + }, + moduleFileExtensions: ['ts', 'js', 'html'], + testEnvironment: 'node', + coverageDirectory: '../../coverage/packages/runtime', +}; diff --git a/packages/runtime-core/package.json b/packages/runtime-core/package.json new file mode 100644 index 00000000000..b9147ec9f1a --- /dev/null +++ b/packages/runtime-core/package.json @@ -0,0 +1,42 @@ +{ + "name": "@module-federation/runtime-core", + "version": "0.6.15", + "author": "zhouxiao ", + "main": "./dist/index.cjs.js", + "module": "./dist/index.esm.mjs", + "types": "./dist/index.cjs.d.ts", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "files": [ + "dist/", + "README.md" + ], + "exports": { + ".": { + "types": "./dist/index.cjs.d.ts", + "import": "./dist/index.esm.mjs", + "require": "./dist/index.cjs.js" + }, + "./types": { + "types": "./dist/types.cjs.d.ts", + "import": "./dist/types.esm.mjs", + "require": "./dist/types.cjs.js" + } + }, + "typesVersions": { + "*": { + ".": [ + "./dist/index.cjs.d.ts" + ], + "types": [ + "./dist/types.cjs.d.ts" + ] + } + }, + "dependencies": { + "@module-federation/sdk": "workspace:*", + "@module-federation/error-codes": "workspace:*" + } +} diff --git a/packages/runtime-core/project.json b/packages/runtime-core/project.json new file mode 100644 index 00000000000..9da5c2e4cfc --- /dev/null +++ b/packages/runtime-core/project.json @@ -0,0 +1,83 @@ +{ + "name": "runtime-core", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "packages/runtime-core/src", + "projectType": "library", + "tags": ["type:pkg"], + "targets": { + "build": { + "executor": "@nx/rollup:rollup", + "outputs": ["{workspaceRoot}/packages/runtime-core/dist"], + "options": { + "parallel": false, + "outputPath": "packages/runtime-core/dist", + "main": "packages/runtime-core/src/index.ts", + "additionalEntryPoints": ["packages/runtime-core/src/types.ts"], + "tsConfig": "packages/runtime-core/tsconfig.lib.json", + "assets": [], + "external": ["@module-federation/*"], + "project": "packages/runtime-core/package.json", + "compiler": "swc", + "rollupConfig": "packages/runtime-core/rollup.config.js", + "format": ["cjs", "esm"], + "generatePackageJson": false + }, + "dependsOn": [ + { + "target": "build", + "dependencies": true + } + ] + }, + "lint": { + "executor": "@nx/eslint:lint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": [ + "packages/runtime-core/**/*.ts", + "packages/runtime-core/package.json" + ] + } + }, + "build-debug": { + "executor": "nx:run-commands", + "options": { + "parallel": false, + "commands": [ + { + "command": "FEDERATION_DEBUG=true nx run runtime-core:build", + "forwardAllArgs": false + } + ] + } + }, + "pre-release": { + "executor": "nx:run-commands", + "options": { + "parallel": false, + "commands": [ + { + "command": "nx run runtime-core:test", + "forwardAllArgs": false + }, + { + "command": "nx run runtime-core:build", + "forwardAllArgs": false + } + ] + } + }, + "test": { + "executor": "nx:run-commands", + "options": { + "parallel": false, + "commands": [ + { + "command": "vitest run -u -c packages/runtime-core/vitest.config.ts", + "forwardAllArgs": false + } + ] + } + } + } +} diff --git a/packages/runtime-core/rollup.config.js b/packages/runtime-core/rollup.config.js new file mode 100644 index 00000000000..697ff772fc4 --- /dev/null +++ b/packages/runtime-core/rollup.config.js @@ -0,0 +1,77 @@ +const replace = require('@rollup/plugin-replace'); +const copy = require('rollup-plugin-copy'); + +const FEDERATION_DEBUG = process.env.FEDERATION_DEBUG || ''; + +module.exports = (rollupConfig, projectOptions) => { + rollupConfig.input = { + index: 'packages/runtime-core/src/index.ts', + types: 'packages/runtime-core/src/types.ts', + }; + + const pkg = require('./package.json'); + + if (rollupConfig.output.format === 'esm' && FEDERATION_DEBUG) { + rollupConfig.output.format = 'iife'; + rollupConfig.output.inlineDynamicImports = true; + delete rollupConfig.external; + delete rollupConfig.input.type; + delete rollupConfig.input.helpers; + } + + if (Array.isArray(rollupConfig.output)) { + rollupConfig.output = rollupConfig.output.map((c) => ({ + ...c, + manualChunks: (id) => { + if (id.includes('@swc/helpers')) { + return 'polyfills'; + } + }, + hoistTransitiveImports: false, + entryFileNames: + c.format === 'esm' + ? c.entryFileNames.replace('.js', '.mjs') + : c.entryFileNames, + chunkFileNames: + c.format === 'esm' + ? c.chunkFileNames.replace('.js', '.mjs') + : c.chunkFileNames, + })); + } else { + rollupConfig.output = { + ...rollupConfig.output, + manualChunks: (id) => { + if (id.includes('@swc/helpers')) { + return 'polyfills'; + } + }, + hoistTransitiveImports: false, + entryFileNames: + rollupConfig.output.format === 'esm' + ? rollupConfig.output.entryFileNames.replace('.js', '.mjs') + : rollupConfig.output.entryFileNames, + chunkFileNames: + rollupConfig.output.format === 'esm' + ? rollupConfig.output.chunkFileNames.replace('.js', '.mjs') + : rollupConfig.output.chunkFileNames, + }; + } + + rollupConfig.plugins.push( + replace({ + preventAssignment: true, + __VERSION__: JSON.stringify(pkg.version), + FEDERATION_DEBUG: JSON.stringify(FEDERATION_DEBUG), + }), + copy({ + targets: [ + { + src: 'packages/runtime-core/LICENSE', + dest: 'packages/runtime-core/dist', + }, + ], + }), + ); + + return rollupConfig; +}; diff --git a/packages/runtime/src/constant.ts b/packages/runtime-core/src/constant.ts similarity index 100% rename from packages/runtime/src/constant.ts rename to packages/runtime-core/src/constant.ts diff --git a/packages/runtime/src/core.md b/packages/runtime-core/src/core.md similarity index 100% rename from packages/runtime/src/core.md rename to packages/runtime-core/src/core.md diff --git a/packages/runtime-core/src/core.ts b/packages/runtime-core/src/core.ts new file mode 100644 index 00000000000..e4c27a82cf6 --- /dev/null +++ b/packages/runtime-core/src/core.ts @@ -0,0 +1,336 @@ +import { isBrowserEnv } from '@module-federation/sdk'; +import type { + CreateScriptHookReturn, + ModuleInfo, +} from '@module-federation/sdk'; +import { + Options, + PreloadRemoteArgs, + RemoteEntryExports, + Remote, + Shared, + ShareInfos, + UserOptions, + RemoteInfo, + ShareScopeMap, + InitScope, + RemoteEntryInitOptions, + InitTokens, + CallFrom, +} from './type'; +import { getBuilderId, registerPlugins, getRemoteEntry } from './utils'; +import { Module } from './module'; +import { + AsyncHook, + AsyncWaterfallHook, + PluginSystem, + SyncHook, + SyncWaterfallHook, +} from './utils/hooks'; +import { generatePreloadAssetsPlugin } from './plugins/generate-preload-assets'; +import { snapshotPlugin } from './plugins/snapshot'; +import { getRemoteInfo } from './utils/load'; +import { DEFAULT_SCOPE } from './constant'; +import { SnapshotHandler } from './plugins/snapshot/SnapshotHandler'; +import { SharedHandler } from './shared'; +import { RemoteHandler } from './remote'; +import { formatShareConfigs } from './utils/share'; + +export class FederationHost { + options: Options; + hooks = new PluginSystem({ + beforeInit: new SyncWaterfallHook<{ + userOptions: UserOptions; + options: Options; + origin: FederationHost; + shareInfo: ShareInfos; + }>('beforeInit'), + init: new SyncHook< + [ + { + options: Options; + origin: FederationHost; + }, + ], + void + >(), + // maybe will change, temporarily for internal use only + beforeInitContainer: new AsyncWaterfallHook<{ + shareScope: ShareScopeMap[string]; + initScope: InitScope; + remoteEntryInitOptions: RemoteEntryInitOptions; + remoteInfo: RemoteInfo; + origin: FederationHost; + }>('beforeInitContainer'), + // maybe will change, temporarily for internal use only + initContainer: new AsyncWaterfallHook<{ + shareScope: ShareScopeMap[string]; + initScope: InitScope; + remoteEntryInitOptions: RemoteEntryInitOptions; + remoteInfo: RemoteInfo; + remoteEntryExports: RemoteEntryExports; + origin: FederationHost; + id: string; + remoteSnapshot?: ModuleInfo; + }>('initContainer'), + }); + version: string = __VERSION__; + name: string; + moduleCache: Map = new Map(); + snapshotHandler: SnapshotHandler; + sharedHandler: SharedHandler; + remoteHandler: RemoteHandler; + shareScopeMap: ShareScopeMap; + loaderHook = new PluginSystem({ + // FIXME: may not be suitable , not open to the public yet + getModuleInfo: new SyncHook< + [ + { + target: Record; + key: any; + }, + ], + { value: any | undefined; key: string } | void + >(), + createScript: new SyncHook< + [ + { + url: string; + attrs?: Record; + }, + ], + CreateScriptHookReturn + >(), + createLink: new SyncHook< + [ + { + url: string; + attrs?: Record; + }, + ], + HTMLLinkElement | void + >(), + fetch: new AsyncHook< + [string, RequestInit], + Promise | void | false + >(), + loadEntryError: new AsyncHook< + [ + { + getRemoteEntry: typeof getRemoteEntry; + origin: FederationHost; + remoteInfo: RemoteInfo; + remoteEntryExports?: RemoteEntryExports | undefined; + globalLoading: Record< + string, + Promise | undefined + >; + uniqueKey: string; + }, + ], + Promise<(() => Promise) | undefined> + >(), + getModuleFactory: new AsyncHook< + [ + { + remoteEntryExports: RemoteEntryExports; + expose: string; + moduleInfo: RemoteInfo; + }, + ], + Promise<(() => Promise) | undefined> + >(), + }); + bridgeHook = new PluginSystem({ + beforeBridgeRender: new SyncHook< + [Record], + void | Record + >(), + afterBridgeRender: new SyncHook< + [Record], + void | Record + >(), + beforeBridgeDestroy: new SyncHook< + [Record], + void | Record + >(), + afterBridgeDestroy: new SyncHook< + [Record], + void | Record + >(), + }); + + constructor(userOptions: UserOptions) { + // TODO: Validate the details of the options + // Initialize options with default values + const defaultOptions: Options = { + id: getBuilderId(), + name: userOptions.name, + plugins: [snapshotPlugin(), generatePreloadAssetsPlugin()], + remotes: [], + shared: {}, + inBrowser: isBrowserEnv(), + }; + + this.name = userOptions.name; + this.options = defaultOptions; + this.snapshotHandler = new SnapshotHandler(this); + this.sharedHandler = new SharedHandler(this); + this.remoteHandler = new RemoteHandler(this); + this.shareScopeMap = this.sharedHandler.shareScopeMap; + this.registerPlugins([ + ...defaultOptions.plugins, + ...(userOptions.plugins || []), + ]); + this.options = this.formatOptions(defaultOptions, userOptions); + } + + initOptions(userOptions: UserOptions): Options { + this.registerPlugins(userOptions.plugins); + const options = this.formatOptions(this.options, userOptions); + + this.options = options; + + return options; + } + + async loadShare( + pkgName: string, + extraOptions?: { + customShareInfo?: Partial; + resolver?: (sharedOptions: ShareInfos[string]) => Shared; + }, + ): Promise T | undefined)> { + return this.sharedHandler.loadShare(pkgName, extraOptions); + } + + // The lib function will only be available if the shared set by eager or runtime init is set or the shared is successfully loaded. + // 1. If the loaded shared already exists globally, then it will be reused + // 2. If lib exists in local shared, it will be used directly + // 3. If the local get returns something other than Promise, then it will be used directly + loadShareSync( + pkgName: string, + extraOptions?: { + customShareInfo?: Partial; + from?: 'build' | 'runtime'; + resolver?: (sharedOptions: ShareInfos[string]) => Shared; + }, + ): () => T | never { + return this.sharedHandler.loadShareSync(pkgName, extraOptions); + } + + initializeSharing( + shareScopeName = DEFAULT_SCOPE, + extraOptions?: { + initScope?: InitScope; + from?: CallFrom; + strategy?: Shared['strategy']; + }, + ): Array> { + return this.sharedHandler.initializeSharing(shareScopeName, extraOptions); + } + + initRawContainer( + name: string, + url: string, + container: RemoteEntryExports, + ): Module { + const remoteInfo = getRemoteInfo({ name, entry: url }); + const module = new Module({ host: this, remoteInfo }); + + module.remoteEntryExports = container; + this.moduleCache.set(name, module); + + return module; + } + + // eslint-disable-next-line max-lines-per-function + // eslint-disable-next-line @typescript-eslint/member-ordering + async loadRemote( + id: string, + options?: { loadFactory?: boolean; from: CallFrom }, + ): Promise { + return this.remoteHandler.loadRemote(id, options); + } + + // eslint-disable-next-line @typescript-eslint/member-ordering + async preloadRemote(preloadOptions: Array): Promise { + return this.remoteHandler.preloadRemote(preloadOptions); + } + + initShareScopeMap( + scopeName: string, + shareScope: ShareScopeMap[string], + extraOptions: { hostShareScopeMap?: ShareScopeMap } = {}, + ): void { + this.sharedHandler.initShareScopeMap(scopeName, shareScope, extraOptions); + } + + formatOptions(globalOptions: Options, userOptions: UserOptions): Options { + const { shared } = formatShareConfigs(globalOptions, userOptions); + const { userOptions: userOptionsRes, options: globalOptionsRes } = + this.hooks.lifecycle.beforeInit.emit({ + origin: this, + userOptions, + options: globalOptions, + shareInfo: shared, + }); + + const remotes = this.remoteHandler.formatAndRegisterRemote( + globalOptionsRes, + userOptionsRes, + ); + + const { shared: handledShared } = this.sharedHandler.registerShared( + globalOptionsRes, + userOptionsRes, + ); + + const plugins = [...globalOptionsRes.plugins]; + + if (userOptionsRes.plugins) { + userOptionsRes.plugins.forEach((plugin) => { + if (!plugins.includes(plugin)) { + plugins.push(plugin); + } + }); + } + + const optionsRes: Options = { + ...globalOptions, + ...userOptions, + plugins, + remotes, + shared: handledShared, + }; + + this.hooks.lifecycle.init.emit({ + origin: this, + options: optionsRes, + }); + return optionsRes; + } + + registerPlugins(plugins: UserOptions['plugins']) { + const pluginRes = registerPlugins(plugins, [ + this.hooks, + this.remoteHandler.hooks, + this.sharedHandler.hooks, + this.snapshotHandler.hooks, + this.loaderHook, + this.bridgeHook, + ]); + // Merge plugin + this.options.plugins = this.options.plugins.reduce((res, plugin) => { + if (!plugin) return res; + if (res && !res.find((item) => item.name === plugin.name)) { + res.push(plugin); + } + return res; + }, pluginRes || []); + } + + registerRemotes(remotes: Remote[], options?: { force?: boolean }): void { + return this.remoteHandler.registerRemotes(remotes, options); + } +} diff --git a/packages/runtime/src/global.ts b/packages/runtime-core/src/global.ts similarity index 93% rename from packages/runtime/src/global.ts rename to packages/runtime-core/src/global.ts index 49185718ea2..0c8bb7531ea 100644 --- a/packages/runtime/src/global.ts +++ b/packages/runtime-core/src/global.ts @@ -119,35 +119,6 @@ export function resetFederationGlobalInfo(): void { }); } -export function getGlobalFederationInstance( - name: string, - version: string | undefined, -): FederationHost | undefined { - const buildId = getBuilderId(); - return CurrentGlobal.__FEDERATION__.__INSTANCES__.find((GMInstance) => { - if (buildId && GMInstance.options.id === getBuilderId()) { - return true; - } - - if ( - GMInstance.options.name === name && - !GMInstance.options.version && - !version - ) { - return true; - } - - if ( - GMInstance.options.name === name && - version && - GMInstance.options.version === version - ) { - return true; - } - return false; - }); -} - export function setGlobalFederationInstance( FederationInstance: FederationHost, ): void { diff --git a/packages/runtime-core/src/helpers.ts b/packages/runtime-core/src/helpers.ts new file mode 100644 index 00000000000..8f4560bb3ba --- /dev/null +++ b/packages/runtime-core/src/helpers.ts @@ -0,0 +1,76 @@ +import { + nativeGlobal, + resetFederationGlobalInfo, + setGlobalFederationInstance, + getGlobalFederationConstructor, + setGlobalFederationConstructor, + getInfoWithoutType, + getGlobalSnapshot, + getTargetSnapshotInfoByModuleInfo, + getGlobalSnapshotInfoByModuleInfo, + setGlobalSnapshotInfoByModuleInfo, + addGlobalSnapshot, + getRemoteEntryExports, + registerGlobalPlugins, + getGlobalHostPlugins, + getPreloaded, + setPreloaded, + Global, +} from './global'; +import { getRegisteredShare, getGlobalShareScope } from './utils/share'; + +interface IShareUtils { + getRegisteredShare: typeof getRegisteredShare; + getGlobalShareScope: typeof getGlobalShareScope; +} +const ShareUtils: IShareUtils = { + getRegisteredShare, + getGlobalShareScope, +}; + +interface IGlobalUtils { + Global: typeof Global; + nativeGlobal: typeof global; + resetFederationGlobalInfo: typeof resetFederationGlobalInfo; + setGlobalFederationInstance: typeof setGlobalFederationInstance; + getGlobalFederationConstructor: typeof getGlobalFederationConstructor; + setGlobalFederationConstructor: typeof setGlobalFederationConstructor; + getInfoWithoutType: typeof getInfoWithoutType; + getGlobalSnapshot: typeof getGlobalSnapshot; + getTargetSnapshotInfoByModuleInfo: typeof getTargetSnapshotInfoByModuleInfo; + getGlobalSnapshotInfoByModuleInfo: typeof getGlobalSnapshotInfoByModuleInfo; + setGlobalSnapshotInfoByModuleInfo: typeof setGlobalSnapshotInfoByModuleInfo; + addGlobalSnapshot: typeof addGlobalSnapshot; + getRemoteEntryExports: typeof getRemoteEntryExports; + registerGlobalPlugins: typeof registerGlobalPlugins; + getGlobalHostPlugins: typeof getGlobalHostPlugins; + getPreloaded: typeof getPreloaded; + setPreloaded: typeof setPreloaded; +} + +const GlobalUtils: IGlobalUtils = { + Global, + nativeGlobal, + resetFederationGlobalInfo, + setGlobalFederationInstance, + getGlobalFederationConstructor, + setGlobalFederationConstructor, + getInfoWithoutType, + getGlobalSnapshot, + getTargetSnapshotInfoByModuleInfo, + getGlobalSnapshotInfoByModuleInfo, + setGlobalSnapshotInfoByModuleInfo, + addGlobalSnapshot, + getRemoteEntryExports, + registerGlobalPlugins, + getGlobalHostPlugins, + getPreloaded, + setPreloaded, +}; + +export default { + global: GlobalUtils, + share: ShareUtils, +}; + +export type { IGlobalUtils, IShareUtils }; diff --git a/packages/runtime-core/src/index.ts b/packages/runtime-core/src/index.ts new file mode 100644 index 00000000000..400f85d47cc --- /dev/null +++ b/packages/runtime-core/src/index.ts @@ -0,0 +1,31 @@ +import helpers, { type IGlobalUtils, type IShareUtils } from './helpers'; +export { FederationHost } from './core'; +export { + type Federation, + CurrentGlobal, + Global, + getGlobalFederationConstructor, + setGlobalFederationInstance, + setGlobalFederationConstructor, + resetFederationGlobalInfo, + addGlobalSnapshot, + getGlobalSnapshot, + getInfoWithoutType, +} from './global'; +export type { UserOptions, FederationRuntimePlugin } from './type'; +export { assert } from './utils/logger'; +export { registerGlobalPlugins } from './global'; +export { + getRemoteEntry, + getRemoteInfo, + isStaticResourcesEqual, + matchRemoteWithNameAndExpose, + safeWrapper, +} from './utils'; +export { getRegisteredShare } from '../src/utils/share'; +export { loadScript, loadScriptNode } from '@module-federation/sdk'; +export { Module } from './module'; +export * as types from './type'; +export { helpers }; +export { satisfy } from '../src/utils/semver'; +export type { IGlobalUtils, IShareUtils }; diff --git a/packages/runtime/src/module/index.ts b/packages/runtime-core/src/module/index.ts similarity index 100% rename from packages/runtime/src/module/index.ts rename to packages/runtime-core/src/module/index.ts diff --git a/packages/runtime/src/plugins/generate-preload-assets.ts b/packages/runtime-core/src/plugins/generate-preload-assets.ts similarity index 100% rename from packages/runtime/src/plugins/generate-preload-assets.ts rename to packages/runtime-core/src/plugins/generate-preload-assets.ts diff --git a/packages/runtime/src/plugins/snapshot/SnapshotHandler.ts b/packages/runtime-core/src/plugins/snapshot/SnapshotHandler.ts similarity index 100% rename from packages/runtime/src/plugins/snapshot/SnapshotHandler.ts rename to packages/runtime-core/src/plugins/snapshot/SnapshotHandler.ts diff --git a/packages/runtime/src/plugins/snapshot/index.ts b/packages/runtime-core/src/plugins/snapshot/index.ts similarity index 100% rename from packages/runtime/src/plugins/snapshot/index.ts rename to packages/runtime-core/src/plugins/snapshot/index.ts diff --git a/packages/runtime/src/remote/index.ts b/packages/runtime-core/src/remote/index.ts similarity index 100% rename from packages/runtime/src/remote/index.ts rename to packages/runtime-core/src/remote/index.ts diff --git a/packages/runtime/src/shared/index.ts b/packages/runtime-core/src/shared/index.ts similarity index 100% rename from packages/runtime/src/shared/index.ts rename to packages/runtime-core/src/shared/index.ts diff --git a/packages/runtime/src/type/config.ts b/packages/runtime-core/src/type/config.ts similarity index 100% rename from packages/runtime/src/type/config.ts rename to packages/runtime-core/src/type/config.ts diff --git a/packages/runtime/src/type/index.ts b/packages/runtime-core/src/type/index.ts similarity index 100% rename from packages/runtime/src/type/index.ts rename to packages/runtime-core/src/type/index.ts diff --git a/packages/runtime/src/type/plugin.ts b/packages/runtime-core/src/type/plugin.ts similarity index 100% rename from packages/runtime/src/type/plugin.ts rename to packages/runtime-core/src/type/plugin.ts diff --git a/packages/runtime/src/type/preload.ts b/packages/runtime-core/src/type/preload.ts similarity index 100% rename from packages/runtime/src/type/preload.ts rename to packages/runtime-core/src/type/preload.ts diff --git a/packages/runtime-core/src/types.ts b/packages/runtime-core/src/types.ts new file mode 100644 index 00000000000..b38ebc9a19d --- /dev/null +++ b/packages/runtime-core/src/types.ts @@ -0,0 +1 @@ +export * from './type'; diff --git a/packages/runtime/src/utils/env.ts b/packages/runtime-core/src/utils/env.ts similarity index 100% rename from packages/runtime/src/utils/env.ts rename to packages/runtime-core/src/utils/env.ts diff --git a/packages/runtime/src/utils/hooks/asyncHook.ts b/packages/runtime-core/src/utils/hooks/asyncHook.ts similarity index 100% rename from packages/runtime/src/utils/hooks/asyncHook.ts rename to packages/runtime-core/src/utils/hooks/asyncHook.ts diff --git a/packages/runtime/src/utils/hooks/asyncWaterfallHooks.ts b/packages/runtime-core/src/utils/hooks/asyncWaterfallHooks.ts similarity index 100% rename from packages/runtime/src/utils/hooks/asyncWaterfallHooks.ts rename to packages/runtime-core/src/utils/hooks/asyncWaterfallHooks.ts diff --git a/packages/runtime/src/utils/hooks/index.ts b/packages/runtime-core/src/utils/hooks/index.ts similarity index 100% rename from packages/runtime/src/utils/hooks/index.ts rename to packages/runtime-core/src/utils/hooks/index.ts diff --git a/packages/runtime/src/utils/hooks/pluginSystem.ts b/packages/runtime-core/src/utils/hooks/pluginSystem.ts similarity index 100% rename from packages/runtime/src/utils/hooks/pluginSystem.ts rename to packages/runtime-core/src/utils/hooks/pluginSystem.ts diff --git a/packages/runtime/src/utils/hooks/syncHook.ts b/packages/runtime-core/src/utils/hooks/syncHook.ts similarity index 100% rename from packages/runtime/src/utils/hooks/syncHook.ts rename to packages/runtime-core/src/utils/hooks/syncHook.ts diff --git a/packages/runtime/src/utils/hooks/syncWaterfallHook.ts b/packages/runtime-core/src/utils/hooks/syncWaterfallHook.ts similarity index 100% rename from packages/runtime/src/utils/hooks/syncWaterfallHook.ts rename to packages/runtime-core/src/utils/hooks/syncWaterfallHook.ts diff --git a/packages/runtime/src/utils/index.ts b/packages/runtime-core/src/utils/index.ts similarity index 100% rename from packages/runtime/src/utils/index.ts rename to packages/runtime-core/src/utils/index.ts diff --git a/packages/runtime/src/utils/load.ts b/packages/runtime-core/src/utils/load.ts similarity index 100% rename from packages/runtime/src/utils/load.ts rename to packages/runtime-core/src/utils/load.ts diff --git a/packages/runtime/src/utils/logger.ts b/packages/runtime-core/src/utils/logger.ts similarity index 100% rename from packages/runtime/src/utils/logger.ts rename to packages/runtime-core/src/utils/logger.ts diff --git a/packages/runtime/src/utils/manifest.ts b/packages/runtime-core/src/utils/manifest.ts similarity index 100% rename from packages/runtime/src/utils/manifest.ts rename to packages/runtime-core/src/utils/manifest.ts diff --git a/packages/runtime/src/utils/plugin.ts b/packages/runtime-core/src/utils/plugin.ts similarity index 100% rename from packages/runtime/src/utils/plugin.ts rename to packages/runtime-core/src/utils/plugin.ts diff --git a/packages/runtime/src/utils/preload.ts b/packages/runtime-core/src/utils/preload.ts similarity index 100% rename from packages/runtime/src/utils/preload.ts rename to packages/runtime-core/src/utils/preload.ts diff --git a/packages/runtime/src/utils/semver/compare.ts b/packages/runtime-core/src/utils/semver/compare.ts similarity index 100% rename from packages/runtime/src/utils/semver/compare.ts rename to packages/runtime-core/src/utils/semver/compare.ts diff --git a/packages/runtime/src/utils/semver/constants.ts b/packages/runtime-core/src/utils/semver/constants.ts similarity index 100% rename from packages/runtime/src/utils/semver/constants.ts rename to packages/runtime-core/src/utils/semver/constants.ts diff --git a/packages/runtime/src/utils/semver/index.ts b/packages/runtime-core/src/utils/semver/index.ts similarity index 100% rename from packages/runtime/src/utils/semver/index.ts rename to packages/runtime-core/src/utils/semver/index.ts diff --git a/packages/runtime/src/utils/semver/parser.ts b/packages/runtime-core/src/utils/semver/parser.ts similarity index 100% rename from packages/runtime/src/utils/semver/parser.ts rename to packages/runtime-core/src/utils/semver/parser.ts diff --git a/packages/runtime/src/utils/semver/utils.ts b/packages/runtime-core/src/utils/semver/utils.ts similarity index 100% rename from packages/runtime/src/utils/semver/utils.ts rename to packages/runtime-core/src/utils/semver/utils.ts diff --git a/packages/runtime/src/utils/share.ts b/packages/runtime-core/src/utils/share.ts similarity index 100% rename from packages/runtime/src/utils/share.ts rename to packages/runtime-core/src/utils/share.ts diff --git a/packages/runtime/src/utils/tool.ts b/packages/runtime-core/src/utils/tool.ts similarity index 100% rename from packages/runtime/src/utils/tool.ts rename to packages/runtime-core/src/utils/tool.ts diff --git a/packages/runtime-core/tsconfig.json b/packages/runtime-core/tsconfig.json new file mode 100644 index 00000000000..ea7082763db --- /dev/null +++ b/packages/runtime-core/tsconfig.json @@ -0,0 +1,20 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "module": "commonjs", + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ] +} diff --git a/packages/runtime-core/tsconfig.lib.json b/packages/runtime-core/tsconfig.lib.json new file mode 100644 index 00000000000..a51e17924d1 --- /dev/null +++ b/packages/runtime-core/tsconfig.lib.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": ["node"] + }, + "include": ["src/**/*.ts", "global.d.ts"], + "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"] +} diff --git a/packages/runtime-core/vitest.config.ts b/packages/runtime-core/vitest.config.ts new file mode 100644 index 00000000000..148b62d42b7 --- /dev/null +++ b/packages/runtime-core/vitest.config.ts @@ -0,0 +1,19 @@ +import { defineConfig } from 'vitest/config'; +import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; +import path from 'path'; +export default defineConfig({ + define: { + __DEV__: true, + __TEST__: true, + __BROWSER__: false, + __VERSION__: '"unknown"', + }, + plugins: [nxViteTsPaths()], + test: { + environment: 'jsdom', + include: [path.resolve(__dirname, '__tests__/*.spec.ts')], + globals: true, + setupFiles: [path.resolve(__dirname, './__tests__/setup.ts')], + testTimeout: 10000, + }, +}); diff --git a/packages/runtime-plugins/inject-external-runtime-core-plugin/.swcrc b/packages/runtime-plugins/inject-external-runtime-core-plugin/.swcrc new file mode 100644 index 00000000000..12b7fbc9c8c --- /dev/null +++ b/packages/runtime-plugins/inject-external-runtime-core-plugin/.swcrc @@ -0,0 +1,27 @@ +{ + "jsc": { + "target": "es2017", + "parser": { + "syntax": "typescript", + "decorators": true, + "dynamicImport": true + }, + "transform": { + "decoratorMetadata": true, + "legacyDecorator": true + }, + "keepClassNames": true, + "externalHelpers": true, + "loose": true + }, + "module": { + "type": "es6" + }, + "sourceMaps": true, + "exclude": [ + "jest.config.ts", + "./src/jest-setup.ts$", + "./**/jest-setup.ts$", + ".*.js$" + ] +} diff --git a/packages/runtime-plugins/inject-external-runtime-core-plugin/CHANGELOG.md b/packages/runtime-plugins/inject-external-runtime-core-plugin/CHANGELOG.md new file mode 100644 index 00000000000..c730b5fa7b3 --- /dev/null +++ b/packages/runtime-plugins/inject-external-runtime-core-plugin/CHANGELOG.md @@ -0,0 +1,8 @@ +# @module-federation/inject-external-runtime-core-plugin + +## 0.8.7 + +### Patch Changes + +- f573ad0: feat: add externalRuntime and provideExternalRuntime fields to help optimize assets size + - @module-federation/runtime-tools@0.8.7 diff --git a/packages/runtime-plugins/inject-external-runtime-core-plugin/LICENSE b/packages/runtime-plugins/inject-external-runtime-core-plugin/LICENSE new file mode 100644 index 00000000000..f74c11c43d6 --- /dev/null +++ b/packages/runtime-plugins/inject-external-runtime-core-plugin/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024-present zhanghang(2heal1) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/runtime-plugins/inject-external-runtime-core-plugin/README.md b/packages/runtime-plugins/inject-external-runtime-core-plugin/README.md new file mode 100644 index 00000000000..692932534d5 --- /dev/null +++ b/packages/runtime-plugins/inject-external-runtime-core-plugin/README.md @@ -0,0 +1,7 @@ +# `@module-federation/inject-external-runtime-core-plugin` + +This runtime plugin will inject `@module-federation/runtime-core` . + +And the plugin will be automatic applied when set `experiments.externalRuntime: 'provide'` by build plugin. + +The provider can use host's runtime when set `experiments.externalRuntime: true`. diff --git a/packages/runtime-plugins/inject-external-runtime-core-plugin/package.json b/packages/runtime-plugins/inject-external-runtime-core-plugin/package.json new file mode 100644 index 00000000000..120bf0c1ac4 --- /dev/null +++ b/packages/runtime-plugins/inject-external-runtime-core-plugin/package.json @@ -0,0 +1,42 @@ +{ + "name": "@module-federation/inject-external-runtime-core-plugin", + "version": "0.8.7", + "license": "MIT", + "description": "A sdk for support module federation", + "keywords": [ + "Module Federation", + "sdk" + ], + "files": [ + "dist/", + "README.md" + ], + "publishConfig": { + "access": "public" + }, + "author": "zhanghang ", + "sideEffects": false, + "main": "./dist/index.cjs.js", + "module": "./dist/index.esm.mjs", + "types": "./dist/index.cjs.d.ts", + "exports": { + ".": { + "types": "./dist/index.cjs.d.ts", + "import": "./dist/index.esm.mjs", + "require": "./dist/index.cjs.js" + } + }, + "typesVersions": { + "*": { + ".": [ + "./dist/index.cjs.d.ts" + ] + } + }, + "peerDependencies": { + "@module-federation/runtime-tools": "workspace:*" + }, + "devDependencies": { + "@module-federation/runtime-tools": "workspace:*" + } +} diff --git a/packages/runtime-plugins/inject-external-runtime-core-plugin/project.json b/packages/runtime-plugins/inject-external-runtime-core-plugin/project.json new file mode 100644 index 00000000000..ea89cf66db3 --- /dev/null +++ b/packages/runtime-plugins/inject-external-runtime-core-plugin/project.json @@ -0,0 +1,49 @@ +{ + "name": "inject-external-runtime-core-plugin", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "packages/runtime-plugins/inject-external-runtime-core-plugin/src", + "projectType": "library", + "tags": ["type:pkg"], + "targets": { + "build": { + "executor": "@nx/rollup:rollup", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "packages/runtime-plugins/inject-external-runtime-core-plugin/dist", + "main": "packages/runtime-plugins/inject-external-runtime-core-plugin/src/index.ts", + "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, + "format": ["cjs", "esm"] + } + }, + "lint": { + "executor": "@nx/eslint:lint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": [ + "packages/runtime-plugins/inject-external-runtime-core-plugin/**/*.ts", + "packages/runtime-plugins/inject-external-runtime-core-plugin/package.json" + ] + } + }, + "pre-release": { + "executor": "nx:run-commands", + "options": { + "parallel": false, + "commands": [ + { + "command": "nx run inject-external-runtime-core-plugin:build", + "forwardAllArgs": false + } + ] + } + } + } +} diff --git a/packages/runtime-plugins/inject-external-runtime-core-plugin/rollup.config.js b/packages/runtime-plugins/inject-external-runtime-core-plugin/rollup.config.js new file mode 100644 index 00000000000..092af6b0ef3 --- /dev/null +++ b/packages/runtime-plugins/inject-external-runtime-core-plugin/rollup.config.js @@ -0,0 +1,64 @@ +const copy = require('rollup-plugin-copy'); +const replace = require('@rollup/plugin-replace'); +const pkg = require('./package.json'); + +module.exports = (rollupConfig, _projectOptions) => { + rollupConfig.plugins.push( + copy({ + targets: [ + { + src: 'packages/runtime-plugins/inject-external-runtime-core-plugin/LICENSE', + dest: 'packages/runtime-plugins/inject-external-runtime-core-plugin/dist', + }, + ], + }), + ); + + rollupConfig.external = [/@module-federation/]; + + if (Array.isArray(rollupConfig.output)) { + rollupConfig.output = rollupConfig.output.map((c) => ({ + ...c, + manualChunks: (id) => { + if (id.includes('@swc/helpers')) { + return 'polyfills'; + } + }, + hoistTransitiveImports: false, + entryFileNames: + c.format === 'esm' + ? c.entryFileNames.replace('.js', '.mjs') + : c.entryFileNames, + chunkFileNames: + c.format === 'esm' + ? c.chunkFileNames.replace('.js', '.mjs') + : c.chunkFileNames, + })); + } else { + rollupConfig.output = { + ...rollupConfig.output, + manualChunks: (id) => { + if (id.includes('@swc/helpers')) { + return 'polyfills'; + } + }, + hoistTransitiveImports: false, + entryFileNames: + rollupConfig.output.format === 'esm' + ? rollupConfig.output.entryFileNames.replace('.js', '.mjs') + : rollupConfig.output.entryFileNames, + chunkFileNames: + rollupConfig.output.format === 'esm' + ? rollupConfig.output.chunkFileNames.replace('.js', '.mjs') + : rollupConfig.output.chunkFileNames, + }; + } + + rollupConfig.plugins.push( + replace({ + preventAssignment: true, + __VERSION__: JSON.stringify(pkg.version), + }), + ); + return rollupConfig; +}; diff --git a/packages/runtime-plugins/inject-external-runtime-core-plugin/src/index.ts b/packages/runtime-plugins/inject-external-runtime-core-plugin/src/index.ts new file mode 100644 index 00000000000..995b238bf2d --- /dev/null +++ b/packages/runtime-plugins/inject-external-runtime-core-plugin/src/index.ts @@ -0,0 +1,41 @@ +import * as runtimeCore from '@module-federation/runtime-tools/runtime-core'; + +import type { FederationRuntimePlugin } from '@module-federation/runtime-tools/runtime-core'; +declare global { + var __VERSION__: string; + var _FEDERATION_RUNTIME_CORE: typeof runtimeCore; + var _FEDERATION_RUNTIME_CORE_FROM: { + version: string; + name: string; + }; +} + +function injectExternalRuntimeCorePlugin(): FederationRuntimePlugin { + return { + name: 'inject-external-runtime-core-plugin', + version: __VERSION__, + beforeInit(args) { + const name = args.options.name; + const version = __VERSION__; + if ( + runtimeCore.Global._FEDERATION_RUNTIME_CORE && + runtimeCore.Global._FEDERATION_RUNTIME_CORE_FROM && + (runtimeCore.Global._FEDERATION_RUNTIME_CORE_FROM.name !== name || + runtimeCore.Global._FEDERATION_RUNTIME_CORE_FROM.version !== version) + ) { + console.warn( + `Detect multiple module federation runtime! Injected runtime from ${runtimeCore.Global._FEDERATION_RUNTIME_CORE_FROM.name}@${runtimeCore.Global._FEDERATION_RUNTIME_CORE_FROM.version} and current is ${name}@${version}, pleasure ensure there is only one consumer to provider runtime!`, + ); + return args; + } + runtimeCore.Global._FEDERATION_RUNTIME_CORE = runtimeCore; + runtimeCore.Global._FEDERATION_RUNTIME_CORE_FROM = { + version, + name, + }; + return args; + }, + }; +} + +export default injectExternalRuntimeCorePlugin; diff --git a/packages/runtime-plugins/inject-external-runtime-core-plugin/tsconfig.json b/packages/runtime-plugins/inject-external-runtime-core-plugin/tsconfig.json new file mode 100644 index 00000000000..bb69d249599 --- /dev/null +++ b/packages/runtime-plugins/inject-external-runtime-core-plugin/tsconfig.json @@ -0,0 +1,29 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "module": "commonjs", + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "moduleResolution": "node", + "resolveJsonModule": true, + "esModuleInterop": true, + "skipLibCheck": true, + "skipDefaultLibCheck": true, + "declaration": true + }, + "files": [], + "include": [], + "exclude": ["node_modules"], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/packages/runtime-plugins/inject-external-runtime-core-plugin/tsconfig.lib.json b/packages/runtime-plugins/inject-external-runtime-core-plugin/tsconfig.lib.json new file mode 100644 index 00000000000..33eca2c2cdf --- /dev/null +++ b/packages/runtime-plugins/inject-external-runtime-core-plugin/tsconfig.lib.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": ["node"] + }, + "include": ["src/**/*.ts"], + "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"] +} diff --git a/packages/runtime-plugins/inject-external-runtime-core-plugin/tsconfig.spec.json b/packages/runtime-plugins/inject-external-runtime-core-plugin/tsconfig.spec.json new file mode 100644 index 00000000000..9b2a121d114 --- /dev/null +++ b/packages/runtime-plugins/inject-external-runtime-core-plugin/tsconfig.spec.json @@ -0,0 +1,14 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": [ + "jest.config.ts", + "src/**/*.test.ts", + "src/**/*.spec.ts", + "src/**/*.d.ts" + ] +} diff --git a/packages/runtime-tools/CHANGELOG.md b/packages/runtime-tools/CHANGELOG.md index 1bf6949748c..68fa7674b2f 100644 --- a/packages/runtime-tools/CHANGELOG.md +++ b/packages/runtime-tools/CHANGELOG.md @@ -1,5 +1,14 @@ # @module-federation/runtime-tools +## 0.8.7 + +### Patch Changes + +- Updated dependencies [f573ad0] +- Updated dependencies [4fd33fb] + - @module-federation/runtime@0.8.7 + - @module-federation/webpack-bundler-runtime@0.8.7 + ## 0.8.6 ### Patch Changes diff --git a/packages/runtime-tools/package.json b/packages/runtime-tools/package.json index 62815076dd6..116c5ededbe 100644 --- a/packages/runtime-tools/package.json +++ b/packages/runtime-tools/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/runtime-tools", - "version": "0.8.6", + "version": "0.8.7", "author": "zhanghang ", "main": "./dist/index.cjs", "module": "./dist/index.esm.mjs", @@ -25,6 +25,11 @@ "import": "./dist/runtime.esm.mjs", "require": "./dist/runtime.cjs.js" }, + "./runtime-core": { + "types": "./dist/runtime-core.cjs.d.ts", + "import": "./dist/runtime-core.esm.mjs", + "require": "./dist/runtime-core.cjs.js" + }, "./webpack-bundler-runtime": { "types": "./dist/webpack-bundler-runtime.cjs.d.ts", "import": "./dist/webpack-bundler-runtime.esm.mjs", @@ -42,6 +47,9 @@ ], "webpack-bundler-runtime": [ "./dist/webpack-bundler-runtime.cjs.d.ts" + ], + "runtime-core": [ + "./dist/runtime-core.cjs.d.ts" ] } }, diff --git a/packages/runtime-tools/rollup.config.js b/packages/runtime-tools/rollup.config.js index d49f0a2bddd..8ff3b1ee10c 100644 --- a/packages/runtime-tools/rollup.config.js +++ b/packages/runtime-tools/rollup.config.js @@ -4,6 +4,7 @@ module.exports = (rollupConfig) => { runtime: 'packages/runtime-tools/src/runtime.ts', 'webpack-bundler-runtime': 'packages/runtime-tools/src/webpack-bundler-runtime.ts', + 'runtime-core': 'packages/runtime-tools/src/runtime-core.ts', }; // Check if output is an array and add hoistTransitiveImports: false diff --git a/packages/runtime-tools/src/runtime-core.ts b/packages/runtime-tools/src/runtime-core.ts new file mode 100644 index 00000000000..be5188aa845 --- /dev/null +++ b/packages/runtime-tools/src/runtime-core.ts @@ -0,0 +1 @@ +export * from '@module-federation/runtime/core'; diff --git a/packages/runtime/CHANGELOG.md b/packages/runtime/CHANGELOG.md index 6d129756f02..875d6f763c8 100644 --- a/packages/runtime/CHANGELOG.md +++ b/packages/runtime/CHANGELOG.md @@ -1,5 +1,19 @@ # @module-federation/runtime +## 0.8.7 + +### Patch Changes + +- f573ad0: feat: add externalRuntime and provideExternalRuntime fields to help optimize assets size +- 4fd33fb: fix: throw RUNTIME-008 Error when script resources load failed +- Updated dependencies [835b09c] +- Updated dependencies [f573ad0] +- Updated dependencies [336f3d8] +- Updated dependencies [4fd33fb] + - @module-federation/sdk@0.8.7 + - @module-federation/runtime-core@0.6.15 + - @module-federation/error-codes@0.8.7 + ## 0.8.6 ### Patch Changes diff --git a/packages/runtime/__tests__/get-registered-share.spec.ts b/packages/runtime/__tests__/get-registered-share.spec.ts index 8c6073d49a3..37a4136bdfd 100644 --- a/packages/runtime/__tests__/get-registered-share.spec.ts +++ b/packages/runtime/__tests__/get-registered-share.spec.ts @@ -1,6 +1,5 @@ import { describe, it, expect } from 'vitest'; -import { getRegisteredShare } from '../src/utils/share'; -import { assert } from '../src/utils/logger'; +import { assert, getRegisteredShare } from '@module-federation/runtime-core'; describe('get expected shared', () => { it('get loading shared if sharedStrategy is "loaded-first"', () => { diff --git a/packages/runtime/__tests__/global.spec.ts b/packages/runtime/__tests__/global.spec.ts index 7b9a07203d9..9aaf4e0d256 100644 --- a/packages/runtime/__tests__/global.spec.ts +++ b/packages/runtime/__tests__/global.spec.ts @@ -1,6 +1,6 @@ import { expectTypeOf, describe, it, vi, expect } from 'vitest'; import { init, loadRemote, loadShare, loadShareSync } from '../src/index'; -import { getInfoWithoutType } from '../src/global'; +import { getInfoWithoutType } from '@module-federation/runtime-core'; describe('global', () => { it('inject mode', () => { diff --git a/packages/runtime/__tests__/hooks.spec.ts b/packages/runtime/__tests__/hooks.spec.ts index 0f9ec6dd240..a322b7e7f6b 100644 --- a/packages/runtime/__tests__/hooks.spec.ts +++ b/packages/runtime/__tests__/hooks.spec.ts @@ -1,8 +1,10 @@ import { assert, describe, test, it } from 'vitest'; -import { FederationHost } from '../src/core'; -import { FederationRuntimePlugin } from '../src/type/plugin'; +import { + FederationHost, + addGlobalSnapshot, +} from '@module-federation/runtime-core'; +import { FederationRuntimePlugin } from '@module-federation/runtime-core/types'; import { mockStaticServer, removeScriptTags } from './mock/utils'; -import { addGlobalSnapshot } from '../src/global'; // eslint-disable-next-line max-lines-per-function describe('hooks', () => { diff --git a/packages/runtime/__tests__/is-static-resources-equal.spec.ts b/packages/runtime/__tests__/is-static-resources-equal.spec.ts index 9c0da61c6aa..a3691577c2d 100644 --- a/packages/runtime/__tests__/is-static-resources-equal.spec.ts +++ b/packages/runtime/__tests__/is-static-resources-equal.spec.ts @@ -1,5 +1,5 @@ import { describe, it, expect } from 'vitest'; -import { isStaticResourcesEqual } from '../src/utils/tool'; +import { isStaticResourcesEqual } from '@module-federation/runtime-core'; describe('isStaticResourcesEqual', () => { it('verify resources when URL does not specify protocol', () => { const url = '//a.b.c'; diff --git a/packages/runtime/__tests__/load-remote.spec.ts b/packages/runtime/__tests__/load-remote.spec.ts index 26964b97893..b072baccd6d 100644 --- a/packages/runtime/__tests__/load-remote.spec.ts +++ b/packages/runtime/__tests__/load-remote.spec.ts @@ -2,13 +2,13 @@ import 'whatwg-fetch'; import { assert, describe, it } from 'vitest'; import { FederationHost, init } from '../src/index'; import { mockRemoteSnapshot } from './mock/utils'; -import { matchRemoteWithNameAndExpose } from '../src/utils/manifest'; +import { matchRemoteWithNameAndExpose } from '@module-federation/runtime-core'; import { addGlobalSnapshot, getGlobalSnapshot, Global, setGlobalFederationConstructor, -} from '../src/global'; +} from '@module-federation/runtime-core'; import { requestList } from './mock/env'; describe('matchRemote', () => { diff --git a/packages/runtime/__tests__/mock/mock-script.ts b/packages/runtime/__tests__/mock/mock-script.ts index d5e8ab002b0..e391c7210ab 100644 --- a/packages/runtime/__tests__/mock/mock-script.ts +++ b/packages/runtime/__tests__/mock/mock-script.ts @@ -1,4 +1,4 @@ -import { safeWrapper } from '../../src/utils'; +import { safeWrapper } from '@module-federation/runtime-core'; import fs from 'fs'; import path from 'path'; diff --git a/packages/runtime/__tests__/preload-remote.spec.ts b/packages/runtime/__tests__/preload-remote.spec.ts index 0fd85689733..32e570f092d 100644 --- a/packages/runtime/__tests__/preload-remote.spec.ts +++ b/packages/runtime/__tests__/preload-remote.spec.ts @@ -1,7 +1,7 @@ import { describe, it } from 'vitest'; import { init } from '../src/index'; import { mockStaticServer } from './mock/utils'; -import { Global, addGlobalSnapshot } from '../src/global'; +import { Global, addGlobalSnapshot } from '@module-federation/runtime-core'; interface LinkInfo { type: string; href: string; diff --git a/packages/runtime/__tests__/semver.spec.ts b/packages/runtime/__tests__/semver.spec.ts index 8bd41e475df..fe52928fa11 100644 --- a/packages/runtime/__tests__/semver.spec.ts +++ b/packages/runtime/__tests__/semver.spec.ts @@ -1,6 +1,6 @@ // Test cases for semver ranges taken from https://devhints.io/semver import { describe, expect, test } from 'vitest'; -import { satisfy } from '../src/utils/semver'; +import { satisfy } from '@module-federation/runtime-core'; const version = '1.2.3'; const belowVersion = '1.2.2'; diff --git a/packages/runtime/__tests__/setup.ts b/packages/runtime/__tests__/setup.ts index 4c7f9efcca8..a4ba173efe5 100644 --- a/packages/runtime/__tests__/setup.ts +++ b/packages/runtime/__tests__/setup.ts @@ -2,7 +2,7 @@ import 'whatwg-fetch'; import { server } from './mock/server'; import { mockScriptDomResponse } from './mock/mock-script'; import { requestList } from './mock/env'; -import { resetFederationGlobalInfo } from '../src/global'; +import { resetFederationGlobalInfo } from '@module-federation/runtime-core'; mockScriptDomResponse({ baseDir: __dirname, diff --git a/packages/runtime/__tests__/share.ts b/packages/runtime/__tests__/share.ts index df07b6bdf91..5b6745e0047 100644 --- a/packages/runtime/__tests__/share.ts +++ b/packages/runtime/__tests__/share.ts @@ -1,4 +1,7 @@ -import { GlobalShareScopeMap, Options } from '../src/type'; +import { + GlobalShareScopeMap, + Options, +} from '@module-federation/runtime-core/types'; export const mergeShareInfo1 = { name: '@federation/merge-shared', remotes: [], diff --git a/packages/runtime/__tests__/shares.spec.ts b/packages/runtime/__tests__/shares.spec.ts index c83d61aefa8..7194bee6e55 100644 --- a/packages/runtime/__tests__/shares.spec.ts +++ b/packages/runtime/__tests__/shares.spec.ts @@ -11,9 +11,16 @@ import { shareInfoWithoutLibAndGetProvider, } from './share'; // import { assert } from '../src/utils/logger'; -import { FederationHost } from '../src/core'; -import { UserOptions, ShareScopeMap, Options } from '../src/type'; -import { Global, setGlobalFederationConstructor } from '../src/global'; +import { FederationHost } from '@module-federation/runtime-core'; +import { + UserOptions, + ShareScopeMap, + Options, +} from '@module-federation/runtime-core/types'; +import { + Global, + setGlobalFederationConstructor, +} from '@module-federation/runtime-core'; // eslint-disable-next-line max-lines-per-function // TODO: add new load share test cases diff --git a/packages/runtime/__tests__/snapshot.spec.ts b/packages/runtime/__tests__/snapshot.spec.ts index 64e31c00512..483140c1888 100644 --- a/packages/runtime/__tests__/snapshot.spec.ts +++ b/packages/runtime/__tests__/snapshot.spec.ts @@ -1,6 +1,9 @@ import { assert, describe, it } from 'vitest'; import { FederationHost } from '../src'; -import { getGlobalSnapshot, resetFederationGlobalInfo } from '../src/global'; +import { + getGlobalSnapshot, + resetFederationGlobalInfo, +} from '@module-federation/runtime-core'; describe('snapshot', () => { beforeEach(() => { diff --git a/packages/runtime/__tests__/sync.spec.ts b/packages/runtime/__tests__/sync.spec.ts index 929c434350a..3e263550da5 100644 --- a/packages/runtime/__tests__/sync.spec.ts +++ b/packages/runtime/__tests__/sync.spec.ts @@ -1,11 +1,12 @@ import { describe, it, expect, beforeAll, afterAll, assert } from 'vitest'; -import { matchRemoteWithNameAndExpose } from '../src/utils'; +import { matchRemoteWithNameAndExpose } from '@module-federation/runtime-core'; import { addGlobalSnapshot, getGlobalSnapshot, Global, setGlobalFederationConstructor, -} from '../src/global'; +} from '@module-federation/runtime-core'; + import { requestList } from './mock/env'; // Helper function to check if a method is private diff --git a/packages/runtime/package.json b/packages/runtime/package.json index 31ee4fe7e13..6ce6ea28d4c 100644 --- a/packages/runtime/package.json +++ b/packages/runtime/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/runtime", - "version": "0.8.6", + "version": "0.8.7", "author": "zhouxiao ", "main": "./dist/index.cjs.js", "module": "./dist/index.esm.mjs", @@ -34,6 +34,11 @@ "import": "./dist/types.esm.mjs", "require": "./dist/types.cjs.js" }, + "./core": { + "types": "./dist/core.cjs.d.ts", + "import": "./dist/core.esm.mjs", + "require": "./dist/core.cjs.js" + }, "./embedded": { "types": "./dist/embedded.cjs.d.ts", "import": "./dist/embedded.esm.mjs", @@ -51,11 +56,15 @@ ], "types": [ "./dist/types.cjs.d.ts" + ], + "core": [ + "./dist/core.cjs.d.ts" ] } }, "dependencies": { "@module-federation/sdk": "workspace:*", - "@module-federation/error-codes": "workspace:*" + "@module-federation/error-codes": "workspace:*", + "@module-federation/runtime-core": "workspace:*" } } diff --git a/packages/runtime/rollup.config.js b/packages/runtime/rollup.config.js index 2a027eb64da..9069278988b 100644 --- a/packages/runtime/rollup.config.js +++ b/packages/runtime/rollup.config.js @@ -9,6 +9,7 @@ module.exports = (rollupConfig, projectOptions) => { types: 'packages/runtime/src/types.ts', helpers: 'packages/runtime/src/helpers.ts', embedded: 'packages/runtime/src/embedded.ts', + core: 'packages/runtime/src/core.ts', }; const pkg = require('./package.json'); diff --git a/packages/runtime/src/core.ts b/packages/runtime/src/core.ts index e4c27a82cf6..e4dad252725 100644 --- a/packages/runtime/src/core.ts +++ b/packages/runtime/src/core.ts @@ -1,336 +1,5 @@ -import { isBrowserEnv } from '@module-federation/sdk'; -import type { - CreateScriptHookReturn, - ModuleInfo, -} from '@module-federation/sdk'; -import { - Options, - PreloadRemoteArgs, - RemoteEntryExports, - Remote, - Shared, - ShareInfos, - UserOptions, - RemoteInfo, - ShareScopeMap, - InitScope, - RemoteEntryInitOptions, - InitTokens, - CallFrom, -} from './type'; -import { getBuilderId, registerPlugins, getRemoteEntry } from './utils'; -import { Module } from './module'; -import { - AsyncHook, - AsyncWaterfallHook, - PluginSystem, - SyncHook, - SyncWaterfallHook, -} from './utils/hooks'; -import { generatePreloadAssetsPlugin } from './plugins/generate-preload-assets'; -import { snapshotPlugin } from './plugins/snapshot'; -import { getRemoteInfo } from './utils/load'; -import { DEFAULT_SCOPE } from './constant'; -import { SnapshotHandler } from './plugins/snapshot/SnapshotHandler'; -import { SharedHandler } from './shared'; -import { RemoteHandler } from './remote'; -import { formatShareConfigs } from './utils/share'; +import runtimeCore from '@module-federation/runtime-core'; -export class FederationHost { - options: Options; - hooks = new PluginSystem({ - beforeInit: new SyncWaterfallHook<{ - userOptions: UserOptions; - options: Options; - origin: FederationHost; - shareInfo: ShareInfos; - }>('beforeInit'), - init: new SyncHook< - [ - { - options: Options; - origin: FederationHost; - }, - ], - void - >(), - // maybe will change, temporarily for internal use only - beforeInitContainer: new AsyncWaterfallHook<{ - shareScope: ShareScopeMap[string]; - initScope: InitScope; - remoteEntryInitOptions: RemoteEntryInitOptions; - remoteInfo: RemoteInfo; - origin: FederationHost; - }>('beforeInitContainer'), - // maybe will change, temporarily for internal use only - initContainer: new AsyncWaterfallHook<{ - shareScope: ShareScopeMap[string]; - initScope: InitScope; - remoteEntryInitOptions: RemoteEntryInitOptions; - remoteInfo: RemoteInfo; - remoteEntryExports: RemoteEntryExports; - origin: FederationHost; - id: string; - remoteSnapshot?: ModuleInfo; - }>('initContainer'), - }); - version: string = __VERSION__; - name: string; - moduleCache: Map = new Map(); - snapshotHandler: SnapshotHandler; - sharedHandler: SharedHandler; - remoteHandler: RemoteHandler; - shareScopeMap: ShareScopeMap; - loaderHook = new PluginSystem({ - // FIXME: may not be suitable , not open to the public yet - getModuleInfo: new SyncHook< - [ - { - target: Record; - key: any; - }, - ], - { value: any | undefined; key: string } | void - >(), - createScript: new SyncHook< - [ - { - url: string; - attrs?: Record; - }, - ], - CreateScriptHookReturn - >(), - createLink: new SyncHook< - [ - { - url: string; - attrs?: Record; - }, - ], - HTMLLinkElement | void - >(), - fetch: new AsyncHook< - [string, RequestInit], - Promise | void | false - >(), - loadEntryError: new AsyncHook< - [ - { - getRemoteEntry: typeof getRemoteEntry; - origin: FederationHost; - remoteInfo: RemoteInfo; - remoteEntryExports?: RemoteEntryExports | undefined; - globalLoading: Record< - string, - Promise | undefined - >; - uniqueKey: string; - }, - ], - Promise<(() => Promise) | undefined> - >(), - getModuleFactory: new AsyncHook< - [ - { - remoteEntryExports: RemoteEntryExports; - expose: string; - moduleInfo: RemoteInfo; - }, - ], - Promise<(() => Promise) | undefined> - >(), - }); - bridgeHook = new PluginSystem({ - beforeBridgeRender: new SyncHook< - [Record], - void | Record - >(), - afterBridgeRender: new SyncHook< - [Record], - void | Record - >(), - beforeBridgeDestroy: new SyncHook< - [Record], - void | Record - >(), - afterBridgeDestroy: new SyncHook< - [Record], - void | Record - >(), - }); +export * from '@module-federation/runtime-core'; - constructor(userOptions: UserOptions) { - // TODO: Validate the details of the options - // Initialize options with default values - const defaultOptions: Options = { - id: getBuilderId(), - name: userOptions.name, - plugins: [snapshotPlugin(), generatePreloadAssetsPlugin()], - remotes: [], - shared: {}, - inBrowser: isBrowserEnv(), - }; - - this.name = userOptions.name; - this.options = defaultOptions; - this.snapshotHandler = new SnapshotHandler(this); - this.sharedHandler = new SharedHandler(this); - this.remoteHandler = new RemoteHandler(this); - this.shareScopeMap = this.sharedHandler.shareScopeMap; - this.registerPlugins([ - ...defaultOptions.plugins, - ...(userOptions.plugins || []), - ]); - this.options = this.formatOptions(defaultOptions, userOptions); - } - - initOptions(userOptions: UserOptions): Options { - this.registerPlugins(userOptions.plugins); - const options = this.formatOptions(this.options, userOptions); - - this.options = options; - - return options; - } - - async loadShare( - pkgName: string, - extraOptions?: { - customShareInfo?: Partial; - resolver?: (sharedOptions: ShareInfos[string]) => Shared; - }, - ): Promise T | undefined)> { - return this.sharedHandler.loadShare(pkgName, extraOptions); - } - - // The lib function will only be available if the shared set by eager or runtime init is set or the shared is successfully loaded. - // 1. If the loaded shared already exists globally, then it will be reused - // 2. If lib exists in local shared, it will be used directly - // 3. If the local get returns something other than Promise, then it will be used directly - loadShareSync( - pkgName: string, - extraOptions?: { - customShareInfo?: Partial; - from?: 'build' | 'runtime'; - resolver?: (sharedOptions: ShareInfos[string]) => Shared; - }, - ): () => T | never { - return this.sharedHandler.loadShareSync(pkgName, extraOptions); - } - - initializeSharing( - shareScopeName = DEFAULT_SCOPE, - extraOptions?: { - initScope?: InitScope; - from?: CallFrom; - strategy?: Shared['strategy']; - }, - ): Array> { - return this.sharedHandler.initializeSharing(shareScopeName, extraOptions); - } - - initRawContainer( - name: string, - url: string, - container: RemoteEntryExports, - ): Module { - const remoteInfo = getRemoteInfo({ name, entry: url }); - const module = new Module({ host: this, remoteInfo }); - - module.remoteEntryExports = container; - this.moduleCache.set(name, module); - - return module; - } - - // eslint-disable-next-line max-lines-per-function - // eslint-disable-next-line @typescript-eslint/member-ordering - async loadRemote( - id: string, - options?: { loadFactory?: boolean; from: CallFrom }, - ): Promise { - return this.remoteHandler.loadRemote(id, options); - } - - // eslint-disable-next-line @typescript-eslint/member-ordering - async preloadRemote(preloadOptions: Array): Promise { - return this.remoteHandler.preloadRemote(preloadOptions); - } - - initShareScopeMap( - scopeName: string, - shareScope: ShareScopeMap[string], - extraOptions: { hostShareScopeMap?: ShareScopeMap } = {}, - ): void { - this.sharedHandler.initShareScopeMap(scopeName, shareScope, extraOptions); - } - - formatOptions(globalOptions: Options, userOptions: UserOptions): Options { - const { shared } = formatShareConfigs(globalOptions, userOptions); - const { userOptions: userOptionsRes, options: globalOptionsRes } = - this.hooks.lifecycle.beforeInit.emit({ - origin: this, - userOptions, - options: globalOptions, - shareInfo: shared, - }); - - const remotes = this.remoteHandler.formatAndRegisterRemote( - globalOptionsRes, - userOptionsRes, - ); - - const { shared: handledShared } = this.sharedHandler.registerShared( - globalOptionsRes, - userOptionsRes, - ); - - const plugins = [...globalOptionsRes.plugins]; - - if (userOptionsRes.plugins) { - userOptionsRes.plugins.forEach((plugin) => { - if (!plugins.includes(plugin)) { - plugins.push(plugin); - } - }); - } - - const optionsRes: Options = { - ...globalOptions, - ...userOptions, - plugins, - remotes, - shared: handledShared, - }; - - this.hooks.lifecycle.init.emit({ - origin: this, - options: optionsRes, - }); - return optionsRes; - } - - registerPlugins(plugins: UserOptions['plugins']) { - const pluginRes = registerPlugins(plugins, [ - this.hooks, - this.remoteHandler.hooks, - this.sharedHandler.hooks, - this.snapshotHandler.hooks, - this.loaderHook, - this.bridgeHook, - ]); - // Merge plugin - this.options.plugins = this.options.plugins.reduce((res, plugin) => { - if (!plugin) return res; - if (res && !res.find((item) => item.name === plugin.name)) { - res.push(plugin); - } - return res; - }, pluginRes || []); - } - - registerRemotes(remotes: Remote[], options?: { force?: boolean }): void { - return this.remoteHandler.registerRemotes(remotes, options); - } -} +export default runtimeCore; diff --git a/packages/runtime/src/helpers.ts b/packages/runtime/src/helpers.ts index 3332fb617db..ee21f6d2e5d 100644 --- a/packages/runtime/src/helpers.ts +++ b/packages/runtime/src/helpers.ts @@ -1,79 +1,14 @@ -import { - nativeGlobal, - resetFederationGlobalInfo, - getGlobalFederationInstance, - setGlobalFederationInstance, - getGlobalFederationConstructor, - setGlobalFederationConstructor, - getInfoWithoutType, - getGlobalSnapshot, - getTargetSnapshotInfoByModuleInfo, - getGlobalSnapshotInfoByModuleInfo, - setGlobalSnapshotInfoByModuleInfo, - addGlobalSnapshot, - getRemoteEntryExports, - registerGlobalPlugins, - getGlobalHostPlugins, - getPreloaded, - setPreloaded, - Global, -} from './global'; -import { getRegisteredShare, getGlobalShareScope } from './utils/share'; - -interface IShareUtils { - getRegisteredShare: typeof getRegisteredShare; - getGlobalShareScope: typeof getGlobalShareScope; -} -const ShareUtils: IShareUtils = { - getRegisteredShare, - getGlobalShareScope, -}; - -interface IGlobalUtils { - Global: typeof Global; - nativeGlobal: typeof global; - resetFederationGlobalInfo: typeof resetFederationGlobalInfo; - getGlobalFederationInstance: typeof getGlobalFederationInstance; - setGlobalFederationInstance: typeof setGlobalFederationInstance; - getGlobalFederationConstructor: typeof getGlobalFederationConstructor; - setGlobalFederationConstructor: typeof setGlobalFederationConstructor; - getInfoWithoutType: typeof getInfoWithoutType; - getGlobalSnapshot: typeof getGlobalSnapshot; - getTargetSnapshotInfoByModuleInfo: typeof getTargetSnapshotInfoByModuleInfo; - getGlobalSnapshotInfoByModuleInfo: typeof getGlobalSnapshotInfoByModuleInfo; - setGlobalSnapshotInfoByModuleInfo: typeof setGlobalSnapshotInfoByModuleInfo; - addGlobalSnapshot: typeof addGlobalSnapshot; - getRemoteEntryExports: typeof getRemoteEntryExports; - registerGlobalPlugins: typeof registerGlobalPlugins; - getGlobalHostPlugins: typeof getGlobalHostPlugins; - getPreloaded: typeof getPreloaded; - setPreloaded: typeof setPreloaded; -} - -const GlobalUtils: IGlobalUtils = { - Global, - nativeGlobal, - resetFederationGlobalInfo, - getGlobalFederationInstance, - setGlobalFederationInstance, - getGlobalFederationConstructor, - setGlobalFederationConstructor, - getInfoWithoutType, - getGlobalSnapshot, - getTargetSnapshotInfoByModuleInfo, - getGlobalSnapshotInfoByModuleInfo, - setGlobalSnapshotInfoByModuleInfo, - addGlobalSnapshot, - getRemoteEntryExports, - registerGlobalPlugins, - getGlobalHostPlugins, - getPreloaded, - setPreloaded, -}; +import { helpers } from '@module-federation/runtime-core'; +import { getGlobalFederationInstance } from './utils'; +export type { + IGlobalUtils, + IShareUtils, +} from '@module-federation/runtime-core'; export default { - global: GlobalUtils, - share: ShareUtils, + global: { + ...helpers.global, + getGlobalFederationInstance, + }, + share: helpers.share, }; - -export type { IGlobalUtils, IShareUtils }; diff --git a/packages/runtime/src/index.ts b/packages/runtime/src/index.ts index 2d0eec68af1..6ddb0a6e15c 100644 --- a/packages/runtime/src/index.ts +++ b/packages/runtime/src/index.ts @@ -1,22 +1,24 @@ -import { FederationHost } from './core'; import { - getGlobalFederationInstance, + FederationHost, + type UserOptions, getGlobalFederationConstructor, setGlobalFederationInstance, + assert, setGlobalFederationConstructor, -} from './global'; -import { UserOptions, FederationRuntimePlugin } from './type'; -import { assert } from './utils/logger'; - -export { FederationHost } from './core'; -export { registerGlobalPlugins } from './global'; -export { getRemoteEntry, getRemoteInfo } from './utils'; -export { loadScript, loadScriptNode } from '@module-federation/sdk'; -export { Module } from './module'; - -export type { Federation } from './global'; -export type { FederationRuntimePlugin }; +} from '@module-federation/runtime-core'; +import { getGlobalFederationInstance } from './utils'; +export { + loadScript, + loadScriptNode, + Module, + getRemoteEntry, + getRemoteInfo, + registerGlobalPlugins, + type FederationRuntimePlugin, + type Federation, +} from '@module-federation/runtime-core'; +export { FederationHost }; let FederationInstance: FederationHost | null = null; export function init(options: UserOptions): FederationHost { // Retrieve the same instance with the same name diff --git a/packages/runtime/src/types.ts b/packages/runtime/src/types.ts index b38ebc9a19d..d1b9ff1ea51 100644 --- a/packages/runtime/src/types.ts +++ b/packages/runtime/src/types.ts @@ -1 +1 @@ -export * from './type'; +export * from '@module-federation/runtime-core/types'; diff --git a/packages/runtime/src/utils.ts b/packages/runtime/src/utils.ts new file mode 100644 index 00000000000..0dd3fefb120 --- /dev/null +++ b/packages/runtime/src/utils.ts @@ -0,0 +1,40 @@ +import { FederationHost } from '@module-federation/runtime-core'; +import { CurrentGlobal } from '@module-federation/runtime-core'; + +// injected by bundler, so it can not use runtime-core stuff +export function getBuilderId(): string { + //@ts-ignore + return typeof FEDERATION_BUILD_IDENTIFIER !== 'undefined' + ? //@ts-ignore + FEDERATION_BUILD_IDENTIFIER + : ''; +} + +export function getGlobalFederationInstance( + name: string, + version: string | undefined, +): FederationHost | undefined { + const buildId = getBuilderId(); + return CurrentGlobal.__FEDERATION__.__INSTANCES__.find((GMInstance) => { + if (buildId && GMInstance.options.id === getBuilderId()) { + return true; + } + + if ( + GMInstance.options.name === name && + !GMInstance.options.version && + !version + ) { + return true; + } + + if ( + GMInstance.options.name === name && + version && + GMInstance.options.version === version + ) { + return true; + } + return false; + }); +} diff --git a/packages/runtime/vitest.config.ts b/packages/runtime/vitest.config.ts index 148b62d42b7..48c8523de52 100644 --- a/packages/runtime/vitest.config.ts +++ b/packages/runtime/vitest.config.ts @@ -1,5 +1,6 @@ import { defineConfig } from 'vitest/config'; import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; +//@ts-ignore import path from 'path'; export default defineConfig({ define: { diff --git a/packages/sdk/CHANGELOG.md b/packages/sdk/CHANGELOG.md index 9680b8fe3db..e4aa62ff384 100644 --- a/packages/sdk/CHANGELOG.md +++ b/packages/sdk/CHANGELOG.md @@ -1,5 +1,13 @@ # @module-federation/sdk +## 0.8.7 + +### Patch Changes + +- 835b09c: chore: bump logger +- 336f3d8: fix(enhanced): abort process if not find expose modules +- 4fd33fb: fix: throw RUNTIME-008 Error when script resources load failed + ## 0.8.6 ## 0.8.5 diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 7312f037b06..a71493ff9b2 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/sdk", - "version": "0.8.6", + "version": "0.8.7", "license": "MIT", "description": "A sdk for support module federation", "keywords": [ diff --git a/packages/sdk/src/types/plugins/ModuleFederationPlugin.ts b/packages/sdk/src/types/plugins/ModuleFederationPlugin.ts index 074ab98329a..eaebe467176 100644 --- a/packages/sdk/src/types/plugins/ModuleFederationPlugin.ts +++ b/packages/sdk/src/types/plugins/ModuleFederationPlugin.ts @@ -236,6 +236,8 @@ export interface ModuleFederationPluginOptions { virtualRuntimeEntry?: boolean; experiments?: { federationRuntime?: false | 'hoisted'; + externalRuntime?: boolean; + provideExternalRuntime?: boolean; }; bridge?: { /** diff --git a/packages/storybook-addon/CHANGELOG.md b/packages/storybook-addon/CHANGELOG.md index 71a9d67a677..55158868a0c 100644 --- a/packages/storybook-addon/CHANGELOG.md +++ b/packages/storybook-addon/CHANGELOG.md @@ -1,5 +1,17 @@ # @module-federation/storybook-addon +## 3.0.18 + +### Patch Changes + +- Updated dependencies [835b09c] +- Updated dependencies [f573ad0] +- Updated dependencies [336f3d8] +- Updated dependencies [4fd33fb] + - @module-federation/sdk@0.8.7 + - @module-federation/enhanced@0.8.7 + - @module-federation/utilities@3.1.38 + ## 3.0.17 ### Patch Changes diff --git a/packages/storybook-addon/package.json b/packages/storybook-addon/package.json index f61fe489f50..289c4537529 100644 --- a/packages/storybook-addon/package.json +++ b/packages/storybook-addon/package.json @@ -2,6 +2,7 @@ "name": "@module-federation/storybook-addon", "version": "3.1.0", "description": "Storybook addon to consume remote module federated apps/components", + "type": "commonjs", "license": "MIT", "repository": { "type": "git", @@ -25,18 +26,15 @@ ], "author": "Fiodorov Andrei (https://github.com/fyodorovandrei)", "main": "dist/src/index.js", - "module": "dist/src/index.js", "types": "dist/src/index.d.ts", "exports": { ".": { - "import": "./dist/src/index.js", - "require": "./dist/src/index.js", - "types": "./dist/src/index.d.ts" + "types": "./dist/src/index.d.ts", + "default": "./dist/src/index.js" }, "./preset": { - "import": "./dist/preset.js", - "require": "./dist/preset.js", - "types": "./dist/preset.d.ts" + "types": "./dist/preset.d.ts", + "default": "./dist/preset.js" }, "./*": "./*" }, @@ -65,7 +63,7 @@ }, "peerDependencies": { "@rsbuild/core": "^1.0.1", - "@module-federation/utilities": "^3.1.37", + "@module-federation/utilities": "^3.1.38", "@module-federation/sdk": "^0.8.0", "@nx/react": ">= 16.0.0", "@nx/webpack": ">= 16.0.0", diff --git a/packages/third-party-dts-extractor/CHANGELOG.md b/packages/third-party-dts-extractor/CHANGELOG.md index 38d653ab917..f97f42f486a 100644 --- a/packages/third-party-dts-extractor/CHANGELOG.md +++ b/packages/third-party-dts-extractor/CHANGELOG.md @@ -1,5 +1,7 @@ # @module-federation/third-party-dts-extractor +## 0.8.7 + ## 0.8.6 ## 0.8.5 diff --git a/packages/third-party-dts-extractor/package.json b/packages/third-party-dts-extractor/package.json index 1db3cff13cb..1f5fabe515b 100644 --- a/packages/third-party-dts-extractor/package.json +++ b/packages/third-party-dts-extractor/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/third-party-dts-extractor", - "version": "0.8.6", + "version": "0.8.7", "files": [ "dist/", "README.md" @@ -15,9 +15,9 @@ }, "exports": { ".": { + "types": "./dist/index.d.ts", "import": "./dist/index.mjs", - "require": "./dist/index.js", - "types": "./dist/index.d.ts" + "require": "./dist/index.js" } }, "typesVersions": { diff --git a/packages/typescript/package.json b/packages/typescript/package.json index d031d7e6409..e0b0501c2ac 100644 --- a/packages/typescript/package.json +++ b/packages/typescript/package.json @@ -58,8 +58,8 @@ }, "exports": { ".": { - "require": "./dist/src/index.js", - "types": "./dist/src/index.d.ts" + "types": "./dist/src/index.d.ts", + "require": "./dist/src/index.js" } } } diff --git a/packages/utilities/CHANGELOG.md b/packages/utilities/CHANGELOG.md index d61f12b8691..f8583960fe3 100644 --- a/packages/utilities/CHANGELOG.md +++ b/packages/utilities/CHANGELOG.md @@ -1,5 +1,14 @@ # @module-federation/utilities +## 3.1.38 + +### Patch Changes + +- Updated dependencies [835b09c] +- Updated dependencies [336f3d8] +- Updated dependencies [4fd33fb] + - @module-federation/sdk@0.8.7 + ## 3.1.37 ### Patch Changes diff --git a/packages/utilities/package.json b/packages/utilities/package.json index 114ad624265..d2e67d47397 100644 --- a/packages/utilities/package.json +++ b/packages/utilities/package.json @@ -1,6 +1,6 @@ { "name": "@module-federation/utilities", - "version": "3.1.37", + "version": "3.1.38", "main": "./dist/index.cjs.js", "module": "./dist/index.esm.js", "types": "./dist/index.cjs.d.ts", diff --git a/packages/webpack-bundler-runtime/CHANGELOG.md b/packages/webpack-bundler-runtime/CHANGELOG.md index 373af496057..aa1d9803adc 100644 --- a/packages/webpack-bundler-runtime/CHANGELOG.md +++ b/packages/webpack-bundler-runtime/CHANGELOG.md @@ -1,5 +1,16 @@ # @module-federation/webpack-bundler-runtime +## 0.8.7 + +### Patch Changes + +- Updated dependencies [835b09c] +- Updated dependencies [f573ad0] +- Updated dependencies [336f3d8] +- Updated dependencies [4fd33fb] + - @module-federation/sdk@0.8.7 + - @module-federation/runtime@0.8.7 + ## 0.8.6 ### Patch Changes diff --git a/packages/webpack-bundler-runtime/package.json b/packages/webpack-bundler-runtime/package.json index 5112d609e95..1f6b5b7aac0 100644 --- a/packages/webpack-bundler-runtime/package.json +++ b/packages/webpack-bundler-runtime/package.json @@ -1,7 +1,7 @@ { "public": true, "name": "@module-federation/webpack-bundler-runtime", - "version": "0.8.6", + "version": "0.8.7", "license": "MIT", "description": "Module Federation Runtime for webpack", "keywords": [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d30084cb625..faa01cc23b7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -431,6 +431,9 @@ importers: prettier-eslint: specifier: 16.3.0 version: 16.3.0 + publint: + specifier: ^0.2.12 + version: 0.2.12 react-refresh: specifier: 0.14.2 version: 0.14.2 @@ -2182,6 +2185,9 @@ importers: '@module-federation/error-codes': specifier: workspace:* version: link:../error-codes + '@module-federation/inject-external-runtime-core-plugin': + specifier: workspace:* + version: link:../runtime-plugins/inject-external-runtime-core-plugin '@module-federation/managers': specifier: workspace:* version: link:../managers @@ -2520,6 +2526,9 @@ importers: '@module-federation/dts-plugin': specifier: workspace:* version: link:../dts-plugin + '@module-federation/inject-external-runtime-core-plugin': + specifier: workspace:* + version: link:../runtime-plugins/inject-external-runtime-core-plugin '@module-federation/managers': specifier: workspace:* version: link:../managers @@ -2548,10 +2557,28 @@ importers: '@module-federation/error-codes': specifier: workspace:* version: link:../error-codes + '@module-federation/runtime-core': + specifier: workspace:* + version: link:../runtime-core '@module-federation/sdk': specifier: workspace:* version: link:../sdk + packages/runtime-core: + dependencies: + '@module-federation/error-codes': + specifier: workspace:* + version: link:../error-codes + '@module-federation/sdk': + specifier: workspace:* + version: link:../sdk + + packages/runtime-plugins/inject-external-runtime-core-plugin: + devDependencies: + '@module-federation/runtime-tools': + specifier: workspace:* + version: link:../../runtime-tools + packages/runtime-tools: dependencies: '@module-federation/runtime': @@ -2942,10 +2969,10 @@ packages: '@babel/helpers': 7.26.0 '@babel/parser': 7.26.2 '@babel/template': 7.25.9 - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) '@babel/types': 7.26.0 convert-source-map: 1.9.0 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) gensync: 1.0.0-beta.2 json5: 2.2.3 lodash: 4.17.21 @@ -2971,7 +2998,7 @@ packages: '@babel/traverse': 7.25.7 '@babel/types': 7.25.7 convert-source-map: 2.0.0 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -2990,10 +3017,10 @@ packages: '@babel/helpers': 7.26.0 '@babel/parser': 7.26.2 '@babel/template': 7.25.9 - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) '@babel/types': 7.26.0 convert-source-map: 2.0.0 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -3013,10 +3040,10 @@ packages: '@babel/helpers': 7.26.0 '@babel/parser': 7.26.2 '@babel/template': 7.25.9 - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) '@babel/types': 7.26.0 convert-source-map: 2.0.0 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -3036,10 +3063,10 @@ packages: '@babel/helpers': 7.26.0 '@babel/parser': 7.26.2 '@babel/template': 7.25.9 - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) '@babel/types': 7.26.0 convert-source-map: 2.0.0 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -3127,7 +3154,7 @@ packages: resolution: {integrity: sha512-C47lC7LIDCnz0h4vai/tpNOI95tCd5ZT3iBt/DBH5lXKHZsyNQv18yf1wIIg2ntiQNgmAvA+DgZ82iW8Qdym8g==} engines: {node: '>=6.9.0'} dependencies: - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color @@ -3164,7 +3191,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 + '@babel/traverse': 7.25.9(supports-color@5.5.0) semver: 6.3.1 transitivePeerDependencies: - supports-color @@ -3182,7 +3209,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 + '@babel/traverse': 7.25.9(supports-color@5.5.0) semver: 6.3.1 transitivePeerDependencies: - supports-color @@ -3200,7 +3227,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 + '@babel/traverse': 7.25.9(supports-color@5.5.0) semver: 6.3.1 transitivePeerDependencies: - supports-color @@ -3217,7 +3244,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 + '@babel/traverse': 7.25.9(supports-color@5.5.0) semver: 6.3.1 transitivePeerDependencies: - supports-color @@ -3235,7 +3262,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 + '@babel/traverse': 7.25.9(supports-color@5.5.0) semver: 6.3.1 transitivePeerDependencies: - supports-color @@ -3294,7 +3321,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@9.3.1) + debug: 4.3.7(supports-color@5.5.0) lodash.debounce: 4.0.8 resolve: 1.22.8 transitivePeerDependencies: @@ -3309,7 +3336,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@9.3.1) + debug: 4.3.7(supports-color@5.5.0) lodash.debounce: 4.0.8 resolve: 1.22.8 transitivePeerDependencies: @@ -3319,7 +3346,7 @@ packages: resolution: {integrity: sha512-O31Ssjd5K6lPbTX9AAYpSKrZmLeagt9uwschJd+Ixo6QiRyfpvgtVQp8qrDR9UNFjZ8+DO34ZkdrN+BnPXemeA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color @@ -3328,7 +3355,7 @@ packages: resolution: {integrity: sha512-wbfdZ9w5vk0C0oyHqAJbc62+vet5prjj01jjJ8sKn3j9h3MQQlflEdXYvuqRWjHnM12coDEqiC1IRCi0U/EKwQ==} engines: {node: '>=6.9.0'} dependencies: - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color @@ -3337,16 +3364,7 @@ packages: resolution: {integrity: sha512-o0xCgpNmRohmnoWKQ0Ij8IdddjyBFE4T2kagL/x6M3+4zUgc+4qTOUBoNe4XxDskt1HPKO007ZPiMgLDq2s7Kw==} engines: {node: '>=6.9.0'} dependencies: - '@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/traverse': 7.25.9(supports-color@5.5.0) '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color @@ -3370,7 +3388,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 + '@babel/traverse': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -3381,9 +3399,9 @@ packages: '@babel/core': ^7.0.0 dependencies: '@babel/core': 7.12.9 - '@babel/helper-module-imports': 7.25.9 + '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) '@babel/helper-validator-identifier': 7.25.9 - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -3395,9 +3413,9 @@ packages: '@babel/core': ^7.0.0 dependencies: '@babel/core': 7.25.7 - '@babel/helper-module-imports': 7.25.9 + '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) '@babel/helper-validator-identifier': 7.25.9 - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -3409,9 +3427,9 @@ packages: '@babel/core': ^7.0.0 dependencies: '@babel/core': 7.25.8 - '@babel/helper-module-imports': 7.25.9 + '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) '@babel/helper-validator-identifier': 7.25.9 - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -3423,9 +3441,9 @@ packages: '@babel/core': ^7.0.0 dependencies: '@babel/core': 7.26.0 - '@babel/helper-module-imports': 7.25.9 + '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) '@babel/helper-validator-identifier': 7.25.9 - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -3458,7 +3476,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 + '@babel/traverse': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -3472,7 +3490,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 + '@babel/traverse': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -3485,7 +3503,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 + '@babel/traverse': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -3499,7 +3517,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 + '@babel/traverse': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -3513,7 +3531,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 + '@babel/traverse': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -3526,7 +3544,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 + '@babel/traverse': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -3540,7 +3558,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 + '@babel/traverse': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -3548,7 +3566,7 @@ packages: resolution: {integrity: sha512-zBAIvbCMh5Ts+b86r/CjU+4XGYIs+R1j951gxI3KmmxBMhCg4oQMsv6ZXQ64XOm/cvzfU1FmoCyt6+owc5QMYg==} engines: {node: '>=6.9.0'} dependencies: - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color @@ -3557,7 +3575,7 @@ packages: resolution: {integrity: sha512-FPGAkJmyoChQeM+ruBGIDyrT2tKfZJO8NcxdC+CWNJi7N8/rZpSxK7yvBJ5O/nF1gfu5KzN7VKG3YVSLFfRSxQ==} engines: {node: '>=6.9.0'} dependencies: - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color @@ -3567,7 +3585,7 @@ packages: resolution: {integrity: sha512-c6WHXuiaRsJTyHYLJV75t9IqsmTbItYfdj99PnzYGQZkYKvan5/2jKJ7gu31J3/BJ/A18grImSPModuyG/Eo0Q==} engines: {node: '>=6.9.0'} dependencies: - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color @@ -3576,7 +3594,7 @@ packages: resolution: {integrity: sha512-pPbNbchZBkPMD50K0p3JGcFMNLVUCuU/ABybm/PGNj4JiHrpmNyqqCphBk4i19xXtNV0JhldQJJtbSW5aUvbyA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color @@ -3585,7 +3603,7 @@ packages: resolution: {integrity: sha512-K4Du3BFa3gvyhzgPcntrkDgZzQaq6uozzcpGbOO1OEJaI+EJdqWIMTLgFgQf6lrfiDFo5FU+BxKepI9RmZqahA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color @@ -3623,7 +3641,7 @@ packages: engines: {node: '>=6.9.0'} dependencies: '@babel/template': 7.25.9 - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) '@babel/types': 7.26.0 transitivePeerDependencies: - supports-color @@ -3690,7 +3708,7 @@ packages: dependencies: '@babel/core': 7.25.7 '@babel/helper-plugin-utils': 7.25.9 - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -3703,7 +3721,7 @@ packages: dependencies: '@babel/core': 7.26.0 '@babel/helper-plugin-utils': 7.25.9 - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -3780,7 +3798,7 @@ packages: dependencies: '@babel/core': 7.25.7 '@babel/helper-plugin-utils': 7.25.9 - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -3793,7 +3811,7 @@ packages: dependencies: '@babel/core': 7.26.0 '@babel/helper-plugin-utils': 7.25.9 - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -4529,7 +4547,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 + '@babel/traverse': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -4543,7 +4561,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 + '@babel/traverse': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -4554,7 +4572,7 @@ packages: '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.25.7 - '@babel/helper-module-imports': 7.25.9 + '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) '@babel/helper-plugin-utils': 7.25.9 '@babel/helper-remap-async-to-generator': 7.25.9(@babel/core@7.25.7) transitivePeerDependencies: @@ -4568,7 +4586,7 @@ packages: '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.26.0 - '@babel/helper-module-imports': 7.25.9 + '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) '@babel/helper-plugin-utils': 7.25.9 '@babel/helper-remap-async-to-generator': 7.25.9(@babel/core@7.26.0) transitivePeerDependencies: @@ -4686,7 +4704,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 + '@babel/traverse': 7.25.9(supports-color@5.5.0) globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -4703,7 +4721,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 + '@babel/traverse': 7.25.9(supports-color@5.5.0) globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -4928,7 +4946,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 + '@babel/traverse': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -4942,7 +4960,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 + '@babel/traverse': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -5098,7 +5116,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 + '@babel/traverse': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -5113,7 +5131,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 + '@babel/traverse': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -5605,7 +5623,7 @@ packages: dependencies: '@babel/core': 7.25.2 '@babel/helper-annotate-as-pure': 7.25.9 - '@babel/helper-module-imports': 7.25.9 + '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) '@babel/helper-plugin-utils': 7.25.9 '@babel/plugin-syntax-jsx': 7.25.9(@babel/core@7.25.2) '@babel/types': 7.26.0 @@ -5621,7 +5639,7 @@ packages: dependencies: '@babel/core': 7.25.7 '@babel/helper-annotate-as-pure': 7.25.9 - '@babel/helper-module-imports': 7.25.9 + '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) '@babel/helper-plugin-utils': 7.25.9 '@babel/plugin-syntax-jsx': 7.25.9(@babel/core@7.25.7) '@babel/types': 7.26.0 @@ -5637,7 +5655,7 @@ packages: dependencies: '@babel/core': 7.25.8 '@babel/helper-annotate-as-pure': 7.25.9 - '@babel/helper-module-imports': 7.25.9 + '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) '@babel/helper-plugin-utils': 7.25.9 '@babel/plugin-syntax-jsx': 7.25.9(@babel/core@7.25.8) '@babel/types': 7.26.0 @@ -5653,7 +5671,7 @@ packages: dependencies: '@babel/core': 7.26.0 '@babel/helper-annotate-as-pure': 7.25.9 - '@babel/helper-module-imports': 7.25.9 + '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) '@babel/helper-plugin-utils': 7.25.9 '@babel/plugin-syntax-jsx': 7.25.9(@babel/core@7.26.0) '@babel/types': 7.26.0 @@ -5771,7 +5789,7 @@ packages: '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.25.7 - '@babel/helper-module-imports': 7.25.9 + '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) '@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) @@ -5788,7 +5806,7 @@ packages: '@babel/core': ^7.0.0-0 dependencies: '@babel/core': 7.26.0 - '@babel/helper-module-imports': 7.25.9 + '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) '@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) @@ -6382,21 +6400,7 @@ packages: '@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 - - /@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) + debug: 4.3.7(supports-color@5.5.0) globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -7039,7 +7043,7 @@ packages: /@emotion/babel-plugin@11.12.0: resolution: {integrity: sha512-y2WQb+oP8Jqvvclh8Q55gLUyb7UFvgv7eJfsj7td5TToBrIUtPay2kMrZi4xjq9qw2vD0ZR5fSho0yqoFgX7Rw==} dependencies: - '@babel/helper-module-imports': 7.25.9 + '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) '@babel/runtime': 7.26.0 '@emotion/hash': 0.9.2 '@emotion/memoize': 0.9.0 @@ -8585,7 +8589,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) espree: 9.6.1 globals: 13.24.0 ignore: 5.3.2 @@ -8661,7 +8665,7 @@ packages: deprecated: Use @eslint/config-array instead dependencies: '@humanwhocodes/object-schema': 2.0.3 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -11709,7 +11713,7 @@ packages: '@open-draft/until': 1.0.3 '@types/debug': 4.1.12 '@xmldom/xmldom': 0.8.10 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) headers-polyfill: 3.2.5 outvariant: 1.4.3 strict-event-emitter: 0.2.8 @@ -14758,7 +14762,7 @@ packages: optional: true dependencies: '@babel/core': 7.25.2 - '@babel/helper-module-imports': 7.25.9 + '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) '@rollup/pluginutils': 5.1.3(rollup@4.24.0) rollup: 4.24.0 transitivePeerDependencies: @@ -17058,7 +17062,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@9.3.1) + debug: 4.3.7(supports-color@5.5.0) import-from-esm: 1.3.4 lodash-es: 4.17.21 micromatch: 4.0.8 @@ -17085,7 +17089,7 @@ packages: dependencies: '@semantic-release/error': 3.0.0 aggregate-error: 3.1.0 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) execa: 5.1.1 lodash: 4.17.21 parse-json: 5.2.0 @@ -17102,7 +17106,7 @@ packages: dependencies: '@semantic-release/error': 3.0.0 aggregate-error: 3.1.0 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) dir-glob: 3.0.1 execa: 5.1.1 lodash: 4.17.21 @@ -17125,7 +17129,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@9.3.1) + debug: 4.3.7(supports-color@5.5.0) dir-glob: 3.0.1 globby: 14.0.2 http-proxy-agent: 7.0.2 @@ -17194,7 +17198,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@9.3.1) + debug: 4.3.7(supports-color@5.5.0) get-stream: 7.0.1 import-from-esm: 1.3.4 into-stream: 7.0.0 @@ -18133,7 +18137,7 @@ packages: dependencies: '@babel/generator': 7.26.2 '@babel/parser': 7.26.2 - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) '@babel/types': 7.26.0 '@storybook/csf': 0.1.11 '@storybook/types': 7.6.20 @@ -18149,7 +18153,7 @@ packages: dependencies: '@babel/generator': 7.26.2 '@babel/parser': 7.26.2 - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) '@babel/types': 7.26.0 '@storybook/csf': 0.1.11 '@storybook/types': 8.1.11 @@ -18428,7 +18432,7 @@ packages: typescript: '>= 3.x' webpack: '>= 4' dependencies: - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) endent: 2.1.0 find-cache-dir: 3.3.2 flat-cache: 3.2.0 @@ -18447,7 +18451,7 @@ packages: typescript: '>= 4.x' webpack: '>= 4' dependencies: - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) endent: 2.1.0 find-cache-dir: 3.3.2 flat-cache: 3.2.0 @@ -18466,7 +18470,7 @@ packages: typescript: '>= 4.x' webpack: '>= 4' dependencies: - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) endent: 2.1.0 find-cache-dir: 3.3.2 flat-cache: 3.2.0 @@ -18944,7 +18948,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@9.3.1) + debug: 4.3.7(supports-color@5.5.0) oxc-resolver: 1.12.0 pirates: 4.0.6 tslib: 2.6.3 @@ -20187,7 +20191,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@9.3.1) + debug: 4.3.7(supports-color@5.5.0) eslint: 8.57.1 graphemer: 1.4.0 ignore: 5.3.2 @@ -20239,7 +20243,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@9.3.1) + debug: 4.3.7(supports-color@5.5.0) eslint: 8.57.1 typescript: 5.0.4 transitivePeerDependencies: @@ -20260,7 +20264,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@9.3.1) + debug: 4.3.7(supports-color@5.5.0) eslint: 8.57.1 typescript: 5.5.2 transitivePeerDependencies: @@ -20281,7 +20285,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@9.3.1) + debug: 4.3.7(supports-color@5.5.0) eslint: 8.57.1 typescript: 5.5.2 transitivePeerDependencies: @@ -20340,7 +20344,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@9.3.1) + debug: 4.3.7(supports-color@5.5.0) eslint: 8.57.1 tsutils: 3.21.0(typescript@5.0.4) typescript: 5.0.4 @@ -20360,7 +20364,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@9.3.1) + debug: 4.3.7(supports-color@5.5.0) eslint: 8.57.1 ts-api-utils: 1.3.0(typescript@5.5.2) typescript: 5.5.2 @@ -20379,7 +20383,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@9.3.1) + debug: 4.3.7(supports-color@5.5.0) ts-api-utils: 1.3.0(typescript@5.5.2) typescript: 5.5.2 transitivePeerDependencies: @@ -20423,7 +20427,7 @@ packages: dependencies: '@typescript-eslint/types': 5.62.0 '@typescript-eslint/visitor-keys': 5.62.0 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) globby: 11.1.0 is-glob: 4.0.3 semver: 7.6.3 @@ -20444,7 +20448,7 @@ packages: dependencies: '@typescript-eslint/types': 6.21.0 '@typescript-eslint/visitor-keys': 6.21.0 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.3 @@ -20466,7 +20470,7 @@ packages: dependencies: '@typescript-eslint/types': 7.18.0 '@typescript-eslint/visitor-keys': 7.18.0 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) globby: 11.1.0 is-glob: 4.0.3 minimatch: 9.0.5 @@ -20488,7 +20492,7 @@ packages: dependencies: '@typescript-eslint/types': 8.14.0 '@typescript-eslint/visitor-keys': 8.14.0 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) fast-glob: 3.3.2 is-glob: 4.0.3 minimatch: 9.0.5 @@ -20510,7 +20514,7 @@ packages: dependencies: '@typescript-eslint/types': 8.8.0 '@typescript-eslint/visitor-keys': 8.8.0 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) fast-glob: 3.3.2 is-glob: 4.0.3 minimatch: 9.0.5 @@ -20860,7 +20864,7 @@ packages: peerDependencies: vitest: 1.6.0 dependencies: - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) istanbul-lib-coverage: 3.2.2 istanbul-lib-instrument: 6.0.3 istanbul-lib-report: 3.0.1 @@ -20881,7 +20885,7 @@ packages: dependencies: '@ampproject/remapping': 2.3.0 '@bcoe/v8-coverage': 0.2.3 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) istanbul-lib-coverage: 3.2.2 istanbul-lib-report: 3.0.1 istanbul-lib-source-maps: 5.0.6 @@ -21075,11 +21079,11 @@ packages: optional: true dependencies: '@babel/core': 7.25.2 - '@babel/helper-module-imports': 7.25.9 + '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) '@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 + '@babel/traverse': 7.25.9(supports-color@5.5.0) '@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) @@ -21096,7 +21100,7 @@ packages: dependencies: '@babel/code-frame': 7.26.2 '@babel/core': 7.25.2 - '@babel/helper-module-imports': 7.25.9 + '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) '@babel/helper-plugin-utils': 7.25.9 '@babel/parser': 7.26.2 '@vue/compiler-sfc': 3.5.10 @@ -21643,7 +21647,7 @@ packages: resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} engines: {node: '>= 6.0.0'} dependencies: - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -21651,7 +21655,7 @@ packages: resolution: {integrity: sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==} engines: {node: '>= 14'} dependencies: - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -22533,7 +22537,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 + '@babel/traverse': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -22552,7 +22556,7 @@ packages: /babel-plugin-import@1.13.5: resolution: {integrity: sha512-IkqnoV+ov1hdJVofly9pXRJmeDm9EtROfrc5i6eII0Hix2xMs5FEm8FG3ExMvazbnZBbgHIt6qdO8And6lCloQ==} dependencies: - '@babel/helper-module-imports': 7.25.9 + '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -22560,7 +22564,7 @@ packages: /babel-plugin-import@1.13.8: resolution: {integrity: sha512-36babpjra5m3gca44V6tSTomeBlPA7cHUynrE2WiQIm3rEGD9xy28MKsx5IdO45EbnpJY7Jrgd00C6Dwt/l/2Q==} dependencies: - '@babel/helper-module-imports': 7.25.9 + '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -22679,7 +22683,7 @@ packages: styled-components: '>= 2' dependencies: '@babel/helper-annotate-as-pure': 7.25.9 - '@babel/helper-module-imports': 7.25.9 + '@babel/helper-module-imports': 7.25.9(supports-color@5.5.0) 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) @@ -24178,7 +24182,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.18.20) + webpack: 5.93.0(@swc/core@1.7.26)(esbuild@0.24.0) /copy-webpack-plugin@11.0.0(webpack@5.93.0): resolution: {integrity: sha512-fX2MWpamkW0hZxMEg0+mYnA40LTosOSa5TqZ9GYIBzyJa9C3QUaMPSE2xAi/buNr8u89SfD9wHSQVBzrRa/SOQ==} @@ -24523,7 +24527,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.18.20) + webpack: 5.93.0(@swc/core@1.7.26)(esbuild@0.24.0) /css-loader@6.11.0(@rspack/core@1.1.1)(webpack@5.93.0): resolution: {integrity: sha512-CTJ+AEQJjq5NzLga5pE39qdiSV56F8ywCIsqNIRF0r7BDgWsN25aazToqAFg7ZrtA/U016xudB3ffgweORxX7g==} @@ -25273,6 +25277,7 @@ packages: dependencies: ms: 2.1.3 supports-color: 8.1.1 + dev: true /debug@4.3.7(supports-color@9.3.1): resolution: {integrity: sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==} @@ -25285,6 +25290,7 @@ packages: dependencies: ms: 2.1.3 supports-color: 9.3.1 + dev: true /decimal.js@10.4.3: resolution: {integrity: sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA==} @@ -25531,7 +25537,7 @@ packages: hasBin: true dependencies: address: 1.2.2 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -26216,7 +26222,7 @@ packages: peerDependencies: esbuild: '>=0.12 <1' dependencies: - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) esbuild: 0.17.19 transitivePeerDependencies: - supports-color @@ -26227,7 +26233,7 @@ packages: peerDependencies: esbuild: '>=0.12 <1' dependencies: - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) esbuild: 0.18.20 transitivePeerDependencies: - supports-color @@ -26238,7 +26244,7 @@ packages: peerDependencies: esbuild: '>=0.12 <1' dependencies: - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) esbuild: 0.23.1 transitivePeerDependencies: - supports-color @@ -26627,7 +26633,7 @@ packages: optional: true dependencies: '@nolyfill/is-core-module': 1.0.39 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) 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) @@ -27057,7 +27063,7 @@ packages: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.3 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.2.2 @@ -27134,7 +27140,7 @@ packages: resolution: {integrity: sha512-YNF+mZ/Wu2FU/gvmzuWtYc8rloubL7wfXCTgouFrnjGVXPA/EeYYA7pupXWrb3Iv1cTBeSSxxJIbK23l4MRNqg==} engines: {node: '>=8.3.0'} dependencies: - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) '@babel/types': 7.26.0 c8: 7.14.0 transitivePeerDependencies: @@ -27989,7 +27995,7 @@ packages: debug: optional: true dependencies: - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) /for-each@0.3.3: resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} @@ -29563,7 +29569,7 @@ packages: dependencies: '@tootallnate/once': 2.0.0 agent-base: 6.0.2 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -29573,7 +29579,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.1 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -29601,7 +29607,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@9.3.1) + debug: 4.3.7(supports-color@5.5.0) http-proxy: 1.18.1(debug@4.3.7) is-glob: 4.0.3 is-plain-object: 5.0.0 @@ -29681,7 +29687,7 @@ packages: engines: {node: '>= 6.0.0'} dependencies: agent-base: 5.1.1 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -29691,7 +29697,7 @@ packages: engines: {node: '>= 6'} dependencies: agent-base: 6.0.2 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) transitivePeerDependencies: - supports-color @@ -29700,7 +29706,7 @@ packages: engines: {node: '>= 14'} dependencies: agent-base: 7.1.1 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) transitivePeerDependencies: - supports-color dev: true @@ -29797,6 +29803,13 @@ packages: minimatch: 3.1.2 dev: true + /ignore-walk@5.0.1: + resolution: {integrity: sha512-yemi4pMf51WKT7khInJqAvsIGzoqYXblnsz0ql8tM+yi1EKYTY1evX4NAbJrLL/Aanr2HyZeluqU+Oi7MGHokw==} + engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + dependencies: + minimatch: 5.1.6 + dev: true + /ignore@5.3.2: resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} engines: {node: '>= 4'} @@ -29840,7 +29853,7 @@ packages: resolution: {integrity: sha512-7EyUlPFC0HOlBDpUFGfYstsU7XHxZJKAAMzCT8wZ0hMW7b+hG51LIKTDcsgtz8Pu6YC0HqRVbX+rVUtsGMUKvg==} engines: {node: '>=16.20'} dependencies: - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) import-meta-resolve: 4.1.0 transitivePeerDependencies: - supports-color @@ -30674,7 +30687,7 @@ packages: resolution: {integrity: sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==} engines: {node: '>=10'} dependencies: - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) istanbul-lib-coverage: 3.2.2 source-map: 0.6.1 transitivePeerDependencies: @@ -30686,7 +30699,7 @@ packages: engines: {node: '>=10'} dependencies: '@jridgewell/trace-mapping': 0.3.25 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) istanbul-lib-coverage: 3.2.2 transitivePeerDependencies: - supports-color @@ -31728,7 +31741,7 @@ packages: content-disposition: 0.5.4 content-type: 1.0.5 cookies: 0.9.1 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) delegates: 1.0.0 depd: 2.0.0 destroy: 1.2.0 @@ -31882,7 +31895,7 @@ packages: webpack-sources: optional: true dependencies: - webpack: 5.93.0(@swc/core@1.7.26)(esbuild@0.18.20) + webpack: 5.93.0(@swc/core@1.7.26)(esbuild@0.24.0) webpack-sources: 3.2.3 /lilconfig@2.1.0: @@ -32185,7 +32198,7 @@ packages: engines: {node: '>=8.0'} dependencies: date-format: 4.0.14 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) flatted: 3.3.1 rfdc: 1.4.1 streamroller: 3.1.5 @@ -33046,7 +33059,7 @@ packages: resolution: {integrity: sha512-uD66tJj54JLYq0De10AhWycZWGQNUvDI55xPgk2sQM5kn1JYlhbCMTtEeT27+vAhW2FBQxLlOmS3pmA7/2z4aA==} dependencies: '@types/debug': 4.1.12 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) decode-named-character-reference: 1.0.2 micromark-core-commonmark: 1.1.0 micromark-factory-space: 1.1.0 @@ -33832,10 +33845,22 @@ packages: npm-normalize-package-bin: 1.0.1 dev: true + /npm-bundled@2.0.1: + resolution: {integrity: sha512-gZLxXdjEzE/+mOstGDqR6b0EkhJ+kM6fxM6vUuckuctuVPh80Q6pw/rSZj9s4Gex9GxWtIicO1pc8DB9KZWudw==} + engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + dependencies: + npm-normalize-package-bin: 2.0.0 + dev: true + /npm-normalize-package-bin@1.0.1: resolution: {integrity: sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==} dev: true + /npm-normalize-package-bin@2.0.0: + resolution: {integrity: sha512-awzfKUO7v0FscrSpRoogyNm0sajikhBWpU0QMrW09AMi9n1PoKU6WaIqUzuJSQnpciZZmJ/jMZ2Egfmb/9LiWQ==} + engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + dev: true + /npm-package-arg@11.0.1: resolution: {integrity: sha512-M7s1BD4NxdAvBKUPqqRW957Xwcl/4Zvo8Aj+ANrzvIPzGJZElrH7Z//rSaec2ORcND6FHHLnZeY8qgTpXDMFQQ==} engines: {node: ^16.14.0 || >=18.0.0} @@ -33856,6 +33881,17 @@ packages: npm-normalize-package-bin: 1.0.1 dev: true + /npm-packlist@5.1.3: + resolution: {integrity: sha512-263/0NGrn32YFYi4J533qzrQ/krmmrWwhKkzwTuM4f/07ug51odoaNjUexxO4vxlzURHcmYMH1QjvHjsNDKLVg==} + engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + hasBin: true + dependencies: + glob: 8.1.0 + ignore-walk: 5.0.1 + npm-bundled: 2.0.1 + npm-normalize-package-bin: 2.0.0 + dev: true + /npm-run-path@2.0.2: resolution: {integrity: sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==} engines: {node: '>=4'} @@ -36484,6 +36520,16 @@ packages: safe-buffer: 5.2.1 dev: true + /publint@0.2.12: + resolution: {integrity: sha512-YNeUtCVeM4j9nDiTT2OPczmlyzOkIXNtdDZnSuajAxS/nZ6j3t7Vs9SUB4euQNddiltIwu7Tdd3s+hr08fAsMw==} + engines: {node: '>=16'} + hasBin: true + dependencies: + npm-packlist: 5.1.3 + picocolors: 1.1.1 + sade: 1.8.1 + dev: true + /pug-attrs@3.0.0: resolution: {integrity: sha512-azINV9dUtzPMFQktvTXciNAfAuVh/L/JCl0vtPCwvOA21uZrC08K/UnmrL+SXGEVc1FwzjW62+xw5S/uaLj6cA==} dependencies: @@ -36610,7 +36656,7 @@ packages: engines: {node: '>=8.16.0'} dependencies: '@types/mime-types': 2.1.4 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) extract-zip: 1.7.0 https-proxy-agent: 4.0.0 mime: 2.6.0 @@ -37781,7 +37827,7 @@ packages: engines: {node: '>=16.14.0'} dependencies: '@babel/core': 7.26.0 - '@babel/traverse': 7.25.9 + '@babel/traverse': 7.25.9(supports-color@5.5.0) '@babel/types': 7.26.0 '@types/babel__core': 7.20.5 '@types/babel__traverse': 7.20.6 @@ -39068,7 +39114,6 @@ packages: engines: {node: '>=6'} dependencies: mri: 1.2.0 - dev: false /safe-array-concat@1.1.2: resolution: {integrity: sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q==} @@ -39564,7 +39609,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.18.20) + webpack: 5.93.0(@swc/core@1.7.26)(esbuild@0.24.0) /sass-loader@13.3.3(webpack@5.93.0): resolution: {integrity: sha512-mt5YN2F1MOZr3d/wBRcZxeFgwgkH44wVc2zohO2YF6JiOMkiXe4BYRZpSu2sO1g71mo/j16txzUhsKZlqjVGzA==} @@ -39687,7 +39732,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@9.3.1) + debug: 4.3.7(supports-color@5.5.0) env-ci: 11.1.0 execa: 9.4.0 figures: 6.1.0 @@ -39798,7 +39843,7 @@ packages: resolution: {integrity: sha512-v67WcEouB5GxbTWL/4NeToqcZiAWEq90N888fczVArY8A79J0L4FD7vj5hm3eUMua5EpoQ59wa/oovY6TLvRUA==} engines: {node: '>= 18'} dependencies: - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) destroy: 1.2.0 encodeurl: 2.0.0 escape-html: 1.0.3 @@ -40282,7 +40327,7 @@ packages: /spdy-transport@3.0.0: resolution: {integrity: sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==} dependencies: - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) detect-node: 2.1.0 hpack.js: 2.1.6 obuf: 1.1.2 @@ -40295,7 +40340,7 @@ packages: resolution: {integrity: sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==} engines: {node: '>=6.0.0'} dependencies: - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) handle-thing: 2.0.1 http-deceiver: 1.2.7 select-hose: 2.0.0 @@ -40565,7 +40610,7 @@ packages: engines: {node: '>=8.0'} dependencies: date-format: 4.0.14 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) fs-extra: 8.1.0 transitivePeerDependencies: - supports-color @@ -40817,7 +40862,7 @@ packages: peerDependencies: webpack: ^5.0.0 dependencies: - webpack: 5.93.0(@swc/core@1.7.26)(esbuild@0.18.20) + webpack: 5.93.0(@swc/core@1.7.26)(esbuild@0.24.0) /style-to-object@0.3.0: resolution: {integrity: sha512-CzFnRRXhzWIdItT3OmF8SQfWyahHhjq3HwcMNCNLn+N7klOOqPjMeG/4JSu77D7ypZdGvSzvkrbyeTMizz2VrA==} @@ -40989,7 +41034,7 @@ packages: hasBin: true dependencies: '@adobe/css-tools': 4.3.3 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) glob: 10.4.5 sax: 1.4.1 source-map: 0.7.4 @@ -41056,6 +41101,7 @@ 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==} @@ -42141,7 +42187,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@9.3.1) + debug: 4.3.7(supports-color@5.5.0) esbuild: 0.18.20 execa: 5.1.1 globby: 11.1.0 @@ -42183,7 +42229,7 @@ packages: cac: 6.7.14 chokidar: 3.6.0 consola: 3.2.3 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) esbuild: 0.23.0 execa: 5.1.1 joycon: 3.1.1 @@ -42985,7 +43031,7 @@ packages: compression: 1.7.4 cookies: 0.9.1 cors: 2.8.5 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) envinfo: 7.11.0 express: 4.18.2 express-rate-limit: 5.5.1 @@ -43100,7 +43146,7 @@ packages: hasBin: true dependencies: cac: 6.7.14 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) 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) @@ -43121,7 +43167,7 @@ packages: hasBin: true dependencies: cac: 6.7.14 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) 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) @@ -43151,7 +43197,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@9.3.1) + debug: 4.3.7(supports-color@5.5.0) kolorist: 1.8.0 local-pkg: 0.5.0 magic-string: 0.30.12 @@ -43178,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@9.3.1) + debug: 4.3.7(supports-color@5.5.0) kolorist: 1.8.0 local-pkg: 0.5.0 magic-string: 0.30.12 @@ -43198,7 +43244,7 @@ packages: vite: optional: true dependencies: - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) 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) @@ -43368,7 +43414,7 @@ packages: acorn-walk: 8.3.4 cac: 6.7.14 chai: 4.5.0 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) execa: 8.0.1 local-pkg: 0.5.0 magic-string: 0.30.11 @@ -43425,7 +43471,7 @@ packages: '@vitest/utils': 1.6.0 acorn-walk: 8.3.4 chai: 4.5.0 - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) execa: 8.0.1 local-pkg: 0.5.0 magic-string: 0.30.11 @@ -43474,7 +43520,7 @@ packages: peerDependencies: eslint: '>=6.0.0' dependencies: - debug: 4.3.7(supports-color@9.3.1) + debug: 4.3.7(supports-color@5.5.0) eslint: 8.57.1 eslint-scope: 7.2.2 eslint-visitor-keys: 3.4.3 @@ -43678,7 +43724,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.18.20) + webpack: 5.93.0(@swc/core@1.7.26)(esbuild@0.24.0) /webpack-dev-server@5.0.4(webpack@5.93.0): resolution: {integrity: sha512-dljXhUgx3HqKP2d8J/fUMvhxGhzjeNVarDLcbO/EWMSgRizDkxHQDZQaLFL5VJY9tRBj2Gz+rvCEYYvhbqPHNA==} @@ -43831,7 +43877,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.18.20) + webpack: 5.93.0(@swc/core@1.7.26)(esbuild@0.24.0) /webpack-subresource-integrity@5.1.0(html-webpack-plugin@5.6.3)(webpack@5.95.0): resolution: {integrity: sha512-sacXoX+xd8r4WKsy9MvH/q/vBtEHr86cpImXwyg74pFIpERKt6FmB8cXpeuh0ZLgclOlHI4Wcll7+R5L02xk9Q==} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 242f663bada..961800d398d 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -11,3 +11,4 @@ packages: - 'apps/*' - 'webpack' - 'assemble-release-plan' + - 'packages/runtime-plugins/*'