@servicetitan/startup 36.3.1 → 37.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/analyze.js +3 -0
- package/bin/vite.js +3 -0
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +13 -9
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/bundle-vite.d.ts +6 -0
- package/dist/cli/commands/bundle-vite.d.ts.map +1 -0
- package/dist/cli/commands/bundle-vite.js +127 -0
- package/dist/cli/commands/bundle-vite.js.map +1 -0
- package/dist/cli/commands/bundle-webpack.d.ts +6 -0
- package/dist/cli/commands/bundle-webpack.d.ts.map +1 -0
- package/dist/cli/commands/{bundle-package.js → bundle-webpack.js} +8 -6
- package/dist/cli/commands/bundle-webpack.js.map +1 -0
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +2 -1
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/mfe-check.d.ts.map +1 -1
- package/dist/cli/commands/mfe-check.js +2 -2
- package/dist/cli/commands/mfe-check.js.map +1 -1
- package/dist/cli/commands/mfe-generate-metadata.js +2 -2
- package/dist/cli/commands/mfe-generate-metadata.js.map +1 -1
- package/dist/cli/commands/mfe-list.js +1 -1
- package/dist/cli/commands/mfe-list.js.map +1 -1
- package/dist/cli/commands/mfe-package-publish.js.map +1 -1
- package/dist/cli/commands/mfe-publish.js +1 -1
- package/dist/cli/commands/mfe-publish.js.map +1 -1
- package/dist/cli/commands/registry/build.d.ts +14 -0
- package/dist/cli/commands/registry/build.d.ts.map +1 -1
- package/dist/cli/commands/registry/build.js +17 -0
- package/dist/cli/commands/registry/build.js.map +1 -1
- package/dist/cli/commands/registry/bundle-vite.d.ts +33 -0
- package/dist/cli/commands/registry/bundle-vite.d.ts.map +1 -0
- package/dist/cli/commands/registry/bundle-vite.js +45 -0
- package/dist/cli/commands/registry/bundle-vite.js.map +1 -0
- package/dist/cli/commands/registry/{bundle-package.d.ts → bundle-webpack.d.ts} +1 -1
- package/dist/cli/commands/registry/bundle-webpack.d.ts.map +1 -0
- package/dist/cli/commands/registry/{bundle-package.js → bundle-webpack.js} +1 -1
- package/dist/cli/commands/registry/{bundle-package.js.map → bundle-webpack.js.map} +1 -1
- package/dist/cli/commands/registry/command-registry.d.ts +57 -1
- package/dist/cli/commands/registry/command-registry.d.ts.map +1 -1
- package/dist/cli/commands/registry/command-registry.js +4 -2
- package/dist/cli/commands/registry/command-registry.js.map +1 -1
- package/dist/cli/commands/registry/start.d.ts +10 -0
- package/dist/cli/commands/registry/start.d.ts.map +1 -1
- package/dist/cli/commands/registry/start.js +13 -0
- package/dist/cli/commands/registry/start.js.map +1 -1
- package/dist/cli/commands/review/rules/index.d.ts.map +1 -1
- package/dist/cli/commands/review/rules/index.js +2 -0
- package/dist/cli/commands/review/rules/index.js.map +1 -1
- package/dist/cli/commands/review/rules/require-compatible-typescript.d.ts +13 -0
- package/dist/cli/commands/review/rules/require-compatible-typescript.d.ts.map +1 -0
- package/dist/cli/commands/review/rules/require-compatible-typescript.js +72 -0
- package/dist/cli/commands/review/rules/require-compatible-typescript.js.map +1 -0
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +11 -22
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/index.js +3 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/tasks/swc-compile-package/swc-compile-package.d.ts.map +1 -1
- package/dist/cli/tasks/swc-compile-package/swc-compile-package.js +8 -3
- package/dist/cli/tasks/swc-compile-package/swc-compile-package.js.map +1 -1
- package/dist/cli/tasks/tsc-compile/tsc-compile.js +1 -1
- package/dist/cli/tasks/tsc-compile/tsc-compile.js.map +1 -1
- package/dist/cli/utils/copy-files.js +1 -0
- package/dist/cli/utils/copy-files.js.map +1 -1
- package/dist/cli/utils/get-bundle-command.d.ts +3 -0
- package/dist/cli/utils/get-bundle-command.d.ts.map +1 -0
- package/dist/cli/utils/get-bundle-command.js +16 -0
- package/dist/cli/utils/get-bundle-command.js.map +1 -0
- package/dist/cli/utils/get-exit-code.d.ts +12 -0
- package/dist/cli/utils/get-exit-code.d.ts.map +1 -0
- package/dist/cli/utils/get-exit-code.js +26 -0
- package/dist/cli/utils/get-exit-code.js.map +1 -0
- package/dist/cli/utils/index.d.ts +3 -1
- package/dist/cli/utils/index.d.ts.map +1 -1
- package/dist/cli/utils/index.js +3 -1
- package/dist/cli/utils/index.js.map +1 -1
- package/dist/cli/utils/resolve-bundler.d.ts +8 -0
- package/dist/cli/utils/resolve-bundler.d.ts.map +1 -0
- package/dist/cli/utils/resolve-bundler.js +24 -0
- package/dist/cli/utils/resolve-bundler.js.map +1 -0
- package/dist/core/bundle-report.d.ts +4 -0
- package/dist/core/bundle-report.d.ts.map +1 -0
- package/dist/core/bundle-report.js +43 -0
- package/dist/core/bundle-report.js.map +1 -0
- package/dist/core/check-resource/check-resource.d.ts +4 -0
- package/dist/core/check-resource/check-resource.d.ts.map +1 -0
- package/dist/core/check-resource/check-resource.js +51 -0
- package/dist/core/check-resource/check-resource.js.map +1 -0
- package/dist/core/check-resource/get-package-json.d.ts +10 -0
- package/dist/core/check-resource/get-package-json.d.ts.map +1 -0
- package/dist/{webpack/configs/plugins/ignore-plugin → core/check-resource}/get-package-json.js +12 -10
- package/dist/core/check-resource/get-package-json.js.map +1 -0
- package/dist/core/check-resource/get-peer-dependency-meta.d.ts +17 -0
- package/dist/core/check-resource/get-peer-dependency-meta.d.ts.map +1 -0
- package/dist/core/check-resource/get-peer-dependency-meta.js +73 -0
- package/dist/core/check-resource/get-peer-dependency-meta.js.map +1 -0
- package/dist/core/check-resource/index.d.ts +3 -0
- package/dist/core/check-resource/index.d.ts.map +1 -0
- package/dist/core/check-resource/index.js +13 -0
- package/dist/core/check-resource/index.js.map +1 -0
- package/dist/core/check-resource/is-managed-react-dom-client-dependency.d.ts +8 -0
- package/dist/core/check-resource/is-managed-react-dom-client-dependency.d.ts.map +1 -0
- package/dist/core/check-resource/is-managed-react-dom-client-dependency.js +15 -0
- package/dist/core/check-resource/is-managed-react-dom-client-dependency.js.map +1 -0
- package/dist/core/check-resource/is-resolvable.d.ts +7 -0
- package/dist/core/check-resource/is-resolvable.d.ts.map +1 -0
- package/dist/core/check-resource/is-resolvable.js +31 -0
- package/dist/core/check-resource/is-resolvable.js.map +1 -0
- package/dist/core/check-resource/types.d.ts +6 -0
- package/dist/core/check-resource/types.d.ts.map +1 -0
- package/dist/core/check-resource/types.js.map +1 -0
- package/dist/core/chunk-patterns.d.ts +7 -0
- package/dist/core/chunk-patterns.d.ts.map +1 -0
- package/dist/core/chunk-patterns.js +37 -0
- package/dist/core/chunk-patterns.js.map +1 -0
- package/dist/core/constants.d.ts +17 -0
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/constants.js +28 -0
- package/dist/core/constants.js.map +1 -0
- package/dist/core/create-build-context.d.ts +13 -0
- package/dist/core/create-build-context.d.ts.map +1 -0
- package/dist/core/create-build-context.js +54 -0
- package/dist/core/create-build-context.js.map +1 -0
- package/dist/core/create-extension-regexp.d.ts +5 -0
- package/dist/core/create-extension-regexp.d.ts.map +1 -0
- package/dist/core/create-extension-regexp.js +45 -0
- package/dist/core/create-extension-regexp.js.map +1 -0
- package/dist/core/defines/define-exposed-dependencies.d.ts +5 -0
- package/dist/core/defines/define-exposed-dependencies.d.ts.map +1 -0
- package/dist/core/defines/define-exposed-dependencies.js +32 -0
- package/dist/core/defines/define-exposed-dependencies.js.map +1 -0
- package/dist/core/defines/define-exposed-instance-dependencies.d.ts +5 -0
- package/dist/core/defines/define-exposed-instance-dependencies.d.ts.map +1 -0
- package/dist/core/defines/define-exposed-instance-dependencies.js +29 -0
- package/dist/core/defines/define-exposed-instance-dependencies.js.map +1 -0
- package/dist/core/defines/define-web-component-name.d.ts +5 -0
- package/dist/core/defines/define-web-component-name.d.ts.map +1 -0
- package/dist/core/defines/define-web-component-name.js +23 -0
- package/dist/core/defines/define-web-component-name.js.map +1 -0
- package/dist/core/defines/index.d.ts +4 -0
- package/dist/core/defines/index.d.ts.map +1 -0
- package/dist/core/defines/index.js +26 -0
- package/dist/core/defines/index.js.map +1 -0
- package/dist/core/externals.d.ts +3 -0
- package/dist/core/externals.d.ts.map +1 -0
- package/dist/core/externals.js +28 -0
- package/dist/core/externals.js.map +1 -0
- package/dist/core/get-build-name.d.ts +2 -0
- package/dist/core/get-build-name.d.ts.map +1 -0
- package/dist/core/get-build-name.js +24 -0
- package/dist/core/get-build-name.js.map +1 -0
- package/dist/core/get-bundle-type.d.ts +3 -0
- package/dist/core/get-bundle-type.d.ts.map +1 -0
- package/dist/{webpack/configs/utils → core}/get-bundle-type.js +4 -2
- package/dist/core/get-bundle-type.js.map +1 -0
- package/dist/core/get-cdn-path.d.ts +3 -0
- package/dist/core/get-cdn-path.d.ts.map +1 -0
- package/dist/core/get-cdn-path.js +15 -0
- package/dist/core/get-cdn-path.js.map +1 -0
- package/dist/core/get-exposed-dependencies.d.ts.map +1 -0
- package/dist/core/get-exposed-dependencies.js.map +1 -0
- package/dist/core/get-process-env.d.ts +3 -0
- package/dist/core/get-process-env.d.ts.map +1 -0
- package/dist/core/get-process-env.js +25 -0
- package/dist/core/get-process-env.js.map +1 -0
- package/dist/core/get-shared-entry-points.d.ts +11 -0
- package/dist/core/get-shared-entry-points.d.ts.map +1 -0
- package/dist/core/get-shared-entry-points.js +43 -0
- package/dist/core/get-shared-entry-points.js.map +1 -0
- package/dist/core/get-version/get-launchdarkly-sdk-version.d.ts.map +1 -0
- package/dist/core/get-version/get-launchdarkly-sdk-version.js.map +1 -0
- package/dist/core/get-version/get-startup-version.d.ts.map +1 -0
- package/dist/{utils → core/get-version}/get-startup-version.js +2 -2
- package/dist/core/get-version/get-startup-version.js.map +1 -0
- package/dist/core/get-version/get-web-components-version.d.ts.map +1 -0
- package/dist/core/get-version/get-web-components-version.js.map +1 -0
- package/dist/core/get-version/index.d.ts +4 -0
- package/dist/core/get-version/index.d.ts.map +1 -0
- package/dist/core/get-version/index.js +22 -0
- package/dist/core/get-version/index.js.map +1 -0
- package/dist/core/index.d.ts +24 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +41 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/metadata/build-metadata.d.ts.map +1 -0
- package/dist/{webpack/configs/utils → core/metadata}/build-metadata.js +5 -6
- package/dist/core/metadata/build-metadata.js.map +1 -0
- package/dist/core/metadata/generate-exposed-dependencies-metadata.d.ts +3 -0
- package/dist/core/metadata/generate-exposed-dependencies-metadata.d.ts.map +1 -0
- package/dist/core/metadata/generate-exposed-dependencies-metadata.js +42 -0
- package/dist/core/metadata/generate-exposed-dependencies-metadata.js.map +1 -0
- package/dist/core/metadata/generate-metadata.d.ts +3 -0
- package/dist/core/metadata/generate-metadata.d.ts.map +1 -0
- package/dist/{webpack/configs/utils → core/metadata}/generate-metadata.js +5 -4
- package/dist/core/metadata/generate-metadata.js.map +1 -0
- package/dist/core/metadata/index.d.ts +4 -0
- package/dist/core/metadata/index.d.ts.map +1 -0
- package/dist/{webpack/configs/utils → core/metadata}/index.js +2 -2
- package/dist/core/metadata/index.js.map +1 -0
- package/dist/core/moment-locales.d.ts +2 -0
- package/dist/core/moment-locales.d.ts.map +1 -0
- package/dist/core/moment-locales.js +21 -0
- package/dist/core/moment-locales.js.map +1 -0
- package/dist/core/resolve-output-path.d.ts +3 -0
- package/dist/core/resolve-output-path.d.ts.map +1 -0
- package/dist/core/resolve-output-path.js +25 -0
- package/dist/core/resolve-output-path.js.map +1 -0
- package/dist/core/resolve-output-root.d.ts +3 -0
- package/dist/core/resolve-output-root.d.ts.map +1 -0
- package/dist/core/resolve-output-root.js +23 -0
- package/dist/core/resolve-output-root.js.map +1 -0
- package/dist/core/sort-shared-css.d.ts +2 -0
- package/dist/core/sort-shared-css.d.ts.map +1 -0
- package/dist/core/sort-shared-css.js +20 -0
- package/dist/core/sort-shared-css.js.map +1 -0
- package/dist/core/stringify-config.d.ts.map +1 -0
- package/dist/core/stringify-config.js.map +1 -0
- package/dist/core/types.d.ts +50 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +6 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/virtual-modules.d.ts +8 -0
- package/dist/core/virtual-modules.d.ts.map +1 -0
- package/dist/core/virtual-modules.js +83 -0
- package/dist/core/virtual-modules.js.map +1 -0
- package/dist/cypress/config/index.d.ts +1 -0
- package/dist/cypress/config/index.d.ts.map +1 -1
- package/dist/cypress/config/index.js +1 -0
- package/dist/cypress/config/index.js.map +1 -1
- package/dist/cypress/config/vite-config.d.ts +3 -0
- package/dist/cypress/config/vite-config.d.ts.map +1 -0
- package/dist/cypress/config/vite-config.js +58 -0
- package/dist/cypress/config/vite-config.js.map +1 -0
- package/dist/cypress/config/webpack-config.d.ts +1 -1
- package/dist/cypress/config/webpack-config.d.ts.map +1 -1
- package/dist/cypress/config/webpack-config.js +20 -8
- package/dist/cypress/config/webpack-config.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/storybook-config/index.d.ts +1 -0
- package/dist/storybook-config/index.d.ts.map +1 -1
- package/dist/storybook-config/index.js +1 -0
- package/dist/storybook-config/index.js.map +1 -1
- package/dist/storybook-config/vite-final.d.ts +7 -0
- package/dist/storybook-config/vite-final.d.ts.map +1 -0
- package/dist/storybook-config/vite-final.js +86 -0
- package/dist/storybook-config/vite-final.js.map +1 -0
- package/dist/storybook-config/webpack-final.d.ts +1 -1
- package/dist/storybook-config/webpack-final.d.ts.map +1 -1
- package/dist/storybook-config/webpack-final.js +18 -13
- package/dist/storybook-config/webpack-final.js.map +1 -1
- package/dist/utils/get-configuration.d.ts +47 -11
- package/dist/utils/get-configuration.d.ts.map +1 -1
- package/dist/utils/get-configuration.js +43 -9
- package/dist/utils/get-configuration.js.map +1 -1
- package/dist/utils/get-package-data.d.ts.map +1 -1
- package/dist/utils/get-package-data.js +3 -2
- package/dist/utils/get-package-data.js.map +1 -1
- package/dist/utils/get-package-name.d.ts +2 -1
- package/dist/utils/get-package-name.d.ts.map +1 -1
- package/dist/utils/get-package-name.js +4 -2
- package/dist/utils/get-package-name.js.map +1 -1
- package/dist/utils/get-packages.d.ts +1 -1
- package/dist/utils/get-packages.d.ts.map +1 -1
- package/dist/utils/get-packages.js +1 -1
- package/dist/utils/get-packages.js.map +1 -1
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/types.d.ts +2 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/types.js +6 -0
- package/dist/utils/types.js.map +1 -0
- package/dist/utils/validate-shared-dependencies.d.ts +2 -0
- package/dist/utils/validate-shared-dependencies.d.ts.map +1 -0
- package/dist/utils/validate-shared-dependencies.js +30 -0
- package/dist/utils/validate-shared-dependencies.js.map +1 -0
- package/dist/vite/build-shared-dependencies.d.ts +3 -0
- package/dist/vite/build-shared-dependencies.d.ts.map +1 -0
- package/dist/vite/build-shared-dependencies.js +60 -0
- package/dist/vite/build-shared-dependencies.js.map +1 -0
- package/dist/vite/config/asset-file-names.d.ts +4 -0
- package/dist/vite/config/asset-file-names.d.ts.map +1 -0
- package/dist/vite/config/asset-file-names.js +29 -0
- package/dist/vite/config/asset-file-names.js.map +1 -0
- package/dist/vite/config/base-config.d.ts +4 -0
- package/dist/vite/config/base-config.d.ts.map +1 -0
- package/dist/vite/config/base-config.js +176 -0
- package/dist/vite/config/base-config.js.map +1 -0
- package/dist/vite/config/code-splitting.d.ts +4 -0
- package/dist/vite/config/code-splitting.d.ts.map +1 -0
- package/dist/vite/config/code-splitting.js +48 -0
- package/dist/vite/config/code-splitting.js.map +1 -0
- package/dist/vite/config/create-css-config.d.ts +3 -0
- package/dist/vite/config/create-css-config.d.ts.map +1 -0
- package/dist/vite/config/create-css-config.js +26 -0
- package/dist/vite/config/create-css-config.js.map +1 -0
- package/dist/vite/config/create-filtering-logger.d.ts +3 -0
- package/dist/vite/config/create-filtering-logger.d.ts.map +1 -0
- package/dist/vite/config/create-filtering-logger.js +37 -0
- package/dist/vite/config/create-filtering-logger.js.map +1 -0
- package/dist/vite/config/create-vite-build-context.d.ts +6 -0
- package/dist/vite/config/create-vite-build-context.d.ts.map +1 -0
- package/dist/vite/config/create-vite-build-context.js +43 -0
- package/dist/vite/config/create-vite-build-context.js.map +1 -0
- package/dist/vite/config/create-vite-config.d.ts +3 -0
- package/dist/vite/config/create-vite-config.d.ts.map +1 -0
- package/dist/vite/config/create-vite-config.js +60 -0
- package/dist/vite/config/create-vite-config.js.map +1 -0
- package/dist/vite/config/define-config.d.ts +13 -0
- package/dist/vite/config/define-config.d.ts.map +1 -0
- package/dist/vite/config/define-config.js +15 -0
- package/dist/vite/config/define-config.js.map +1 -0
- package/dist/vite/config/get-warmup-client-files.d.ts +3 -0
- package/dist/vite/config/get-warmup-client-files.d.ts.map +1 -0
- package/dist/vite/config/get-warmup-client-files.js +26 -0
- package/dist/vite/config/get-warmup-client-files.js.map +1 -0
- package/dist/vite/config/index.d.ts +6 -0
- package/dist/vite/config/index.d.ts.map +1 -0
- package/dist/vite/config/index.js +24 -0
- package/dist/vite/config/index.js.map +1 -0
- package/dist/vite/config/load-config-file.d.ts +4 -0
- package/dist/vite/config/load-config-file.d.ts.map +1 -0
- package/dist/vite/config/load-config-file.js +103 -0
- package/dist/vite/config/load-config-file.js.map +1 -0
- package/dist/vite/config/merge-vite-configs.d.ts +5 -0
- package/dist/vite/config/merge-vite-configs.d.ts.map +1 -0
- package/dist/vite/config/merge-vite-configs.js +17 -0
- package/dist/vite/config/merge-vite-configs.js.map +1 -0
- package/dist/vite/index.d.ts +2 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.html +33 -0
- package/dist/vite/index.js +20 -0
- package/dist/vite/index.js.map +1 -0
- package/dist/vite/plugins/bundle-stat-plugin.d.ts +4 -0
- package/dist/vite/plugins/bundle-stat-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/bundle-stat-plugin.js +32 -0
- package/dist/vite/plugins/bundle-stat-plugin.js.map +1 -0
- package/dist/vite/plugins/chain-source-maps-plugin.d.ts +3 -0
- package/dist/vite/plugins/chain-source-maps-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/chain-source-maps-plugin.js +37 -0
- package/dist/vite/plugins/chain-source-maps-plugin.js.map +1 -0
- package/dist/vite/plugins/clean-plugin.d.ts +4 -0
- package/dist/vite/plugins/clean-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/clean-plugin.js +63 -0
- package/dist/vite/plugins/clean-plugin.js.map +1 -0
- package/dist/vite/plugins/css-injector-plugin.d.ts +4 -0
- package/dist/vite/plugins/css-injector-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/css-injector-plugin.js +42 -0
- package/dist/vite/plugins/css-injector-plugin.js.map +1 -0
- package/dist/vite/plugins/design-system-guard-plugin.d.ts +4 -0
- package/dist/vite/plugins/design-system-guard-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/design-system-guard-plugin.js +35 -0
- package/dist/vite/plugins/design-system-guard-plugin.js.map +1 -0
- package/dist/vite/plugins/dev-server-routing-plugin.d.ts +24 -0
- package/dist/vite/plugins/dev-server-routing-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/dev-server-routing-plugin.js +85 -0
- package/dist/vite/plugins/dev-server-routing-plugin.js.map +1 -0
- package/dist/vite/plugins/externals-plugin.d.ts +4 -0
- package/dist/vite/plugins/externals-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/externals-plugin.js +60 -0
- package/dist/vite/plugins/externals-plugin.js.map +1 -0
- package/dist/vite/plugins/html-plugin.d.ts +4 -0
- package/dist/vite/plugins/html-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/html-plugin.js +118 -0
- package/dist/vite/plugins/html-plugin.js.map +1 -0
- package/dist/vite/plugins/ignore-modules-plugin.d.ts +21 -0
- package/dist/vite/plugins/ignore-modules-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/ignore-modules-plugin.js +58 -0
- package/dist/vite/plugins/ignore-modules-plugin.js.map +1 -0
- package/dist/vite/plugins/index.d.ts +17 -0
- package/dist/vite/plugins/index.d.ts.map +1 -0
- package/dist/vite/plugins/index.js +35 -0
- package/dist/vite/plugins/index.js.map +1 -0
- package/dist/vite/plugins/istanbul-plugin.d.ts +4 -0
- package/dist/vite/plugins/istanbul-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/istanbul-plugin.js +27 -0
- package/dist/vite/plugins/istanbul-plugin.js.map +1 -0
- package/dist/vite/plugins/magic-comments-plugin/index.d.ts +2 -0
- package/dist/vite/plugins/magic-comments-plugin/index.d.ts.map +1 -0
- package/dist/vite/plugins/magic-comments-plugin/index.js +20 -0
- package/dist/vite/plugins/magic-comments-plugin/index.js.map +1 -0
- package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.d.ts +4 -0
- package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.js +63 -0
- package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.js.map +1 -0
- package/dist/vite/plugins/magic-comments-plugin/parse-magic-comments.d.ts +6 -0
- package/dist/vite/plugins/magic-comments-plugin/parse-magic-comments.d.ts.map +1 -0
- package/dist/vite/plugins/magic-comments-plugin/parse-magic-comments.js +40 -0
- package/dist/vite/plugins/magic-comments-plugin/parse-magic-comments.js.map +1 -0
- package/dist/vite/plugins/metadata-plugin.d.ts +4 -0
- package/dist/vite/plugins/metadata-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/metadata-plugin.js +76 -0
- package/dist/vite/plugins/metadata-plugin.js.map +1 -0
- package/dist/vite/plugins/moment-locales-plugin.d.ts +5 -0
- package/dist/vite/plugins/moment-locales-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/moment-locales-plugin.js +50 -0
- package/dist/vite/plugins/moment-locales-plugin.js.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/assemble-iife.d.ts +14 -0
- package/dist/vite/plugins/shared-dependencies-plugin/assemble-iife.d.ts.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/assemble-iife.js +100 -0
- package/dist/vite/plugins/shared-dependencies-plugin/assemble-iife.js.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.d.ts +3 -0
- package/dist/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.d.ts.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.js +56 -0
- package/dist/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.js.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/flatten.d.ts +2 -0
- package/dist/vite/plugins/shared-dependencies-plugin/flatten.d.ts.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/flatten.js +19 -0
- package/dist/vite/plugins/shared-dependencies-plugin/flatten.js.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/index.d.ts +2 -0
- package/dist/vite/plugins/shared-dependencies-plugin/index.d.ts.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/index.js +20 -0
- package/dist/vite/plugins/shared-dependencies-plugin/index.js.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.d.ts +8 -0
- package/dist/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.js +174 -0
- package/dist/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.js.map +1 -0
- package/dist/vite/plugins/style-urls-plugin.d.ts +4 -0
- package/dist/vite/plugins/style-urls-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/style-urls-plugin.js +31 -0
- package/dist/vite/plugins/style-urls-plugin.js.map +1 -0
- package/dist/vite/plugins/svgr-plugin.d.ts +4 -0
- package/dist/vite/plugins/svgr-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/svgr-plugin.js +33 -0
- package/dist/vite/plugins/svgr-plugin.js.map +1 -0
- package/dist/vite/plugins/utils/get-css-file-names.d.ts +5 -0
- package/dist/vite/plugins/utils/get-css-file-names.d.ts.map +1 -0
- package/dist/vite/plugins/utils/get-css-file-names.js +21 -0
- package/dist/vite/plugins/utils/get-css-file-names.js.map +1 -0
- package/dist/vite/plugins/utils/import-esm.d.ts +2 -0
- package/dist/vite/plugins/utils/import-esm.d.ts.map +1 -0
- package/dist/vite/plugins/utils/import-esm.js +22 -0
- package/dist/vite/plugins/utils/import-esm.js.map +1 -0
- package/dist/vite/plugins/utils/index.d.ts +3 -0
- package/dist/vite/plugins/utils/index.d.ts.map +1 -0
- package/dist/vite/plugins/utils/index.js +21 -0
- package/dist/vite/plugins/utils/index.js.map +1 -0
- package/dist/vite/plugins/virtual-modules-plugin.d.ts +4 -0
- package/dist/vite/plugins/virtual-modules-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/virtual-modules-plugin.js +54 -0
- package/dist/vite/plugins/virtual-modules-plugin.js.map +1 -0
- package/dist/vite/types.d.ts +4 -0
- package/dist/vite/types.d.ts.map +1 -0
- package/dist/vite/types.js +6 -0
- package/dist/vite/types.js.map +1 -0
- package/dist/vite/validate-shared-dependencies.d.ts +2 -0
- package/dist/vite/validate-shared-dependencies.d.ts.map +1 -0
- package/dist/vite/validate-shared-dependencies.js +27 -0
- package/dist/vite/validate-shared-dependencies.js.map +1 -0
- package/dist/webpack/bundle-webpack.d.ts +11 -0
- package/dist/webpack/bundle-webpack.d.ts.map +1 -0
- package/dist/webpack/bundle-webpack.js +107 -0
- package/dist/webpack/bundle-webpack.js.map +1 -0
- package/dist/webpack/configs/amd-config.d.ts +3 -2
- package/dist/webpack/configs/amd-config.d.ts.map +1 -1
- package/dist/webpack/configs/amd-config.js.map +1 -1
- package/dist/webpack/configs/cache-config.d.ts +3 -2
- package/dist/webpack/configs/cache-config.d.ts.map +1 -1
- package/dist/webpack/configs/cache-config.js +5 -18
- package/dist/webpack/configs/cache-config.js.map +1 -1
- package/dist/webpack/configs/dev-server-config.d.ts +2 -2
- package/dist/webpack/configs/dev-server-config.d.ts.map +1 -1
- package/dist/webpack/configs/dev-server-config.js +8 -8
- package/dist/webpack/configs/dev-server-config.js.map +1 -1
- package/dist/webpack/configs/devtool-config.d.ts +3 -2
- package/dist/webpack/configs/devtool-config.d.ts.map +1 -1
- package/dist/webpack/configs/devtool-config.js +1 -1
- package/dist/webpack/configs/devtool-config.js.map +1 -1
- package/dist/webpack/configs/entry.config.d.ts +3 -2
- package/dist/webpack/configs/entry.config.d.ts.map +1 -1
- package/dist/webpack/configs/entry.config.js +6 -5
- package/dist/webpack/configs/entry.config.js.map +1 -1
- package/dist/webpack/configs/externals-config.d.ts +3 -2
- package/dist/webpack/configs/externals-config.d.ts.map +1 -1
- package/dist/webpack/configs/externals-config.js +4 -14
- package/dist/webpack/configs/externals-config.js.map +1 -1
- package/dist/webpack/configs/index.d.ts +0 -1
- package/dist/webpack/configs/index.d.ts.map +1 -1
- package/dist/webpack/configs/index.js.map +1 -1
- package/dist/webpack/configs/loaders/css-loader.d.ts +3 -3
- package/dist/webpack/configs/loaders/css-loader.d.ts.map +1 -1
- package/dist/webpack/configs/loaders/css-loader.js +5 -4
- package/dist/webpack/configs/loaders/css-loader.js.map +1 -1
- package/dist/webpack/configs/loaders/style-loader.d.ts +2 -2
- package/dist/webpack/configs/loaders/style-loader.d.ts.map +1 -1
- package/dist/webpack/configs/loaders/style-loader.js +3 -1
- package/dist/webpack/configs/loaders/style-loader.js.map +1 -1
- package/dist/webpack/configs/module-config.d.ts +2 -2
- package/dist/webpack/configs/module-config.d.ts.map +1 -1
- package/dist/webpack/configs/module-config.js.map +1 -1
- package/dist/webpack/configs/optimization-config.d.ts +2 -2
- package/dist/webpack/configs/optimization-config.d.ts.map +1 -1
- package/dist/webpack/configs/optimization-config.js +62 -31
- package/dist/webpack/configs/optimization-config.js.map +1 -1
- package/dist/webpack/configs/output-config.d.ts +3 -2
- package/dist/webpack/configs/output-config.d.ts.map +1 -1
- package/dist/webpack/configs/output-config.js +10 -25
- package/dist/webpack/configs/output-config.js.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts +3 -8
- package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js +21 -50
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js +4 -23
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js +4 -17
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.js +4 -12
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-process-env-plugin.d.ts +5 -0
- package/dist/webpack/configs/plugins/define-process-env-plugin.d.ts.map +1 -0
- package/dist/webpack/configs/plugins/define-process-env-plugin.js +20 -0
- package/dist/webpack/configs/plugins/define-process-env-plugin.js.map +1 -0
- package/dist/webpack/configs/plugins/define-web-component-name-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/define-web-component-name-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/define-web-component-name-plugin.js +4 -6
- package/dist/webpack/configs/plugins/define-web-component-name-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/filter-warnings-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/filter-warnings-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/filter-warnings-plugin.js +2 -2
- package/dist/webpack/configs/plugins/filter-warnings-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/html-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/html-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/html-plugin.js +4 -2
- package/dist/webpack/configs/plugins/html-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/html-tags-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/html-tags-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/html-tags-plugin.js +16 -21
- package/dist/webpack/configs/plugins/html-tags-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/empty-module.d.ts +2 -0
- package/dist/webpack/configs/plugins/ignore-plugin/empty-module.d.ts.map +1 -0
- package/dist/webpack/configs/plugins/ignore-plugin/empty-module.js +11 -0
- package/dist/webpack/configs/plugins/ignore-plugin/empty-module.js.map +1 -0
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts +27 -3
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js +42 -10
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/index.d.ts +1 -0
- package/dist/webpack/configs/plugins/index.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/index.js +1 -0
- package/dist/webpack/configs/plugins/index.js.map +1 -1
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.d.ts +2 -2
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.js +4 -2
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/moment-locales-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/moment-locales-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/moment-locales-plugin.js +2 -5
- package/dist/webpack/configs/plugins/moment-locales-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.js +1 -1
- package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/virtual-modules-plugin.d.ts +3 -3
- package/dist/webpack/configs/plugins/virtual-modules-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/virtual-modules-plugin.js +13 -56
- package/dist/webpack/configs/plugins/virtual-modules-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/watch-run-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/watch-run-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/watch-run-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins-config.d.ts +3 -2
- package/dist/webpack/configs/plugins-config.d.ts.map +1 -1
- package/dist/webpack/configs/plugins-config.js +1 -0
- package/dist/webpack/configs/plugins-config.js.map +1 -1
- package/dist/webpack/configs/resolve-config.d.ts +3 -2
- package/dist/webpack/configs/resolve-config.d.ts.map +1 -1
- package/dist/webpack/configs/resolve-config.js +2 -1
- package/dist/webpack/configs/resolve-config.js.map +1 -1
- package/dist/webpack/configs/rules/css-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/css-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/css-rules.js +2 -1
- package/dist/webpack/configs/rules/css-rules.js.map +1 -1
- package/dist/webpack/configs/rules/font-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/font-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/font-rules.js +2 -1
- package/dist/webpack/configs/rules/font-rules.js.map +1 -1
- package/dist/webpack/configs/rules/image-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/image-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/image-rules.js +2 -1
- package/dist/webpack/configs/rules/image-rules.js.map +1 -1
- package/dist/webpack/configs/rules/js-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/js-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/js-rules.js +2 -1
- package/dist/webpack/configs/rules/js-rules.js.map +1 -1
- package/dist/webpack/configs/rules/less-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/less-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/less-rules.js.map +1 -1
- package/dist/webpack/configs/rules/scss-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/scss-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/scss-rules.js.map +1 -1
- package/dist/webpack/configs/rules/svg-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/svg-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/svg-rules.js.map +1 -1
- package/dist/webpack/configs/rules-config.d.ts +2 -2
- package/dist/webpack/configs/rules-config.d.ts.map +1 -1
- package/dist/webpack/configs/rules-config.js +2 -2
- package/dist/webpack/configs/rules-config.js.map +1 -1
- package/dist/webpack/configs/stats-config.d.ts +3 -2
- package/dist/webpack/configs/stats-config.d.ts.map +1 -1
- package/dist/webpack/configs/stats-config.js.map +1 -1
- package/dist/webpack/configs/watch-options-config.d.ts +2 -2
- package/dist/webpack/configs/watch-options-config.d.ts.map +1 -1
- package/dist/webpack/configs/watch-options-config.js +2 -2
- package/dist/webpack/configs/watch-options-config.js.map +1 -1
- package/dist/webpack/create-webpack-config.d.ts +2 -0
- package/dist/webpack/create-webpack-config.d.ts.map +1 -1
- package/dist/webpack/create-webpack-config.js +43 -49
- package/dist/webpack/create-webpack-config.js.map +1 -1
- package/dist/webpack/create-webpack-configs.d.ts +16 -0
- package/dist/webpack/create-webpack-configs.d.ts.map +1 -0
- package/dist/webpack/create-webpack-configs.js +80 -0
- package/dist/webpack/create-webpack-configs.js.map +1 -0
- package/dist/webpack/index.d.ts +2 -0
- package/dist/webpack/index.d.ts.map +1 -1
- package/dist/webpack/index.js +2 -0
- package/dist/webpack/index.js.map +1 -1
- package/dist/webpack/types.d.ts +4 -11
- package/dist/webpack/types.d.ts.map +1 -1
- package/dist/webpack/utils/create-webpack-build-context.d.ts +4 -0
- package/dist/webpack/utils/create-webpack-build-context.d.ts.map +1 -0
- package/dist/webpack/utils/create-webpack-build-context.js +20 -0
- package/dist/webpack/utils/create-webpack-build-context.js.map +1 -0
- package/dist/webpack/utils/index.d.ts +1 -1
- package/dist/webpack/utils/index.d.ts.map +1 -1
- package/dist/webpack/utils/index.js +1 -1
- package/dist/webpack/utils/index.js.map +1 -1
- package/jest/babel-plugin-import-meta-env.js +18 -0
- package/jest/jest-preset.js +5 -2
- package/package.json +40 -28
- package/src/cli/commands/__tests__/build.test.ts +35 -7
- package/src/cli/commands/__tests__/bundle-vite.test.ts +277 -0
- package/src/cli/commands/__tests__/{bundle-package.test.ts → bundle-webpack.test.ts} +26 -17
- package/src/cli/commands/__tests__/install.test.ts +6 -2
- package/src/cli/commands/__tests__/mfe-generate-metadata.test.ts +13 -10
- package/src/cli/commands/__tests__/mfe-publish.test.ts +4 -4
- package/src/cli/commands/__tests__/start.test.ts +18 -5
- package/src/cli/commands/build.ts +14 -12
- package/src/cli/commands/bundle-vite.ts +95 -0
- package/src/cli/commands/{bundle-package.ts → bundle-webpack.ts} +9 -6
- package/src/cli/commands/install.ts +2 -1
- package/src/cli/commands/mfe-check.ts +1 -2
- package/src/cli/commands/mfe-generate-metadata.ts +1 -1
- package/src/cli/commands/mfe-list.ts +1 -1
- package/src/cli/commands/mfe-package-publish.ts +1 -1
- package/src/cli/commands/mfe-publish.ts +1 -1
- package/src/cli/commands/registry/__tests__/command-registry.test.ts +1 -0
- package/src/cli/commands/registry/build.ts +7 -0
- package/src/cli/commands/registry/bundle-vite.ts +14 -0
- package/src/cli/commands/registry/command-registry.ts +4 -2
- package/src/cli/commands/registry/start.ts +6 -0
- package/src/cli/commands/review/rules/__tests__/require-compatible-typescript.test.ts +127 -0
- package/src/cli/commands/review/rules/index.ts +2 -0
- package/src/cli/commands/review/rules/require-compatible-typescript.ts +64 -0
- package/src/cli/commands/start.ts +15 -29
- package/src/cli/index.ts +4 -3
- package/src/cli/tasks/swc-compile-package/__tests__/swc-compile-package.test.ts +21 -1
- package/src/cli/tasks/swc-compile-package/swc-cli.d.ts +1 -1
- package/src/cli/tasks/swc-compile-package/swc-compile-package.ts +9 -3
- package/src/cli/tasks/tsc-compile/tsc-compile.ts +1 -1
- package/src/cli/utils/__tests__/get-bundle-command.test.ts +23 -0
- package/src/cli/utils/__tests__/get-exit-code.test.ts +41 -0
- package/src/cli/utils/__tests__/resolve-bundler.test.ts +64 -0
- package/src/cli/utils/copy-files.ts +1 -1
- package/src/cli/utils/get-bundle-command.ts +5 -0
- package/src/cli/utils/get-exit-code.ts +17 -0
- package/src/cli/utils/index.ts +3 -1
- package/src/cli/utils/resolve-bundler.ts +23 -0
- package/src/core/__tests__/bundle-report.test.ts +60 -0
- package/src/core/__tests__/create-extension-regexp.test.ts +32 -0
- package/src/core/__tests__/get-cdn-path.test.ts +27 -0
- package/src/core/__tests__/resolve-output-path.test.ts +45 -0
- package/src/core/__tests__/resolve-output-root.test.ts +37 -0
- package/src/core/__tests__/sort-shared-css.test.ts +39 -0
- package/src/core/bundle-report.ts +33 -0
- package/src/core/check-resource/__tests__/check-resource.test.ts +72 -0
- package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/__tests__/get-package-json.test.ts +2 -1
- package/src/core/check-resource/__tests__/get-peer-dependency-meta.test.ts +108 -0
- package/src/core/check-resource/__tests__/is-managed-react-dom-client-dependency.test.ts +35 -0
- package/src/core/check-resource/__tests__/is-resolvable.test.ts +20 -0
- package/src/core/check-resource/check-resource.ts +31 -0
- package/src/core/check-resource/get-package-json.ts +33 -0
- package/src/core/check-resource/get-peer-dependency-meta.ts +78 -0
- package/src/core/check-resource/index.ts +2 -0
- package/src/core/check-resource/is-managed-react-dom-client-dependency.ts +13 -0
- package/src/core/check-resource/is-resolvable.ts +19 -0
- package/src/core/check-resource/types.ts +6 -0
- package/src/core/chunk-patterns.ts +30 -0
- package/src/core/constants.ts +16 -0
- package/src/core/create-build-context.ts +61 -0
- package/src/core/create-extension-regexp.ts +7 -0
- package/src/core/defines/define-exposed-dependencies.ts +25 -0
- package/src/core/defines/define-exposed-instance-dependencies.ts +19 -0
- package/src/core/defines/define-web-component-name.ts +15 -0
- package/src/core/defines/index.ts +3 -0
- package/src/core/externals.ts +22 -0
- package/src/core/get-build-name.ts +11 -0
- package/src/core/get-bundle-type.ts +19 -0
- package/src/core/get-cdn-path.ts +5 -0
- package/src/core/get-process-env.ts +17 -0
- package/src/core/get-shared-entry-points.ts +37 -0
- package/src/core/get-version/get-startup-version.ts +6 -0
- package/src/core/get-version/index.ts +3 -0
- package/src/core/index.ts +23 -0
- package/src/{webpack/configs/utils → core/metadata}/__tests__/build-metadata.test.ts +10 -6
- package/src/{webpack/configs/utils → core/metadata}/__tests__/generate-metadata.test.ts +25 -13
- package/src/{webpack/configs/utils → core/metadata}/build-metadata.ts +6 -3
- package/src/core/metadata/generate-exposed-dependencies-metadata.ts +20 -0
- package/src/{webpack/configs/utils → core/metadata}/generate-metadata.ts +8 -6
- package/src/core/metadata/index.ts +3 -0
- package/src/core/moment-locales.ts +6 -0
- package/src/core/resolve-output-path.ts +10 -0
- package/src/core/resolve-output-root.ts +8 -0
- package/src/core/sort-shared-css.ts +7 -0
- package/src/core/types.ts +54 -0
- package/src/core/virtual-modules.ts +74 -0
- package/src/cypress/config/__tests__/vite-config.test.ts +72 -0
- package/src/cypress/config/__tests__/webpack-config.test.ts +4 -3
- package/src/cypress/config/index.ts +1 -0
- package/src/cypress/config/vite-config.ts +37 -0
- package/src/cypress/config/webpack-config.ts +24 -11
- package/src/index.ts +1 -0
- package/src/storybook-config/__tests__/vite-final.test.ts +122 -0
- package/src/storybook-config/__tests__/webpack-final.test.ts +5 -27
- package/src/storybook-config/index.ts +1 -0
- package/src/storybook-config/vite-final.ts +65 -0
- package/src/storybook-config/webpack-final.ts +23 -15
- package/src/utils/__tests__/get-configuration.test.ts +109 -11
- package/src/utils/__tests__/get-package-data.test.ts +35 -1
- package/src/utils/__tests__/get-package-name.test.ts +57 -0
- package/src/utils/__tests__/get-packages.test.ts +4 -4
- package/src/utils/__tests__/validate-shared-dependencies.test.ts +70 -0
- package/src/utils/get-configuration.ts +96 -17
- package/src/utils/get-package-data.ts +3 -1
- package/src/utils/get-package-name.ts +8 -2
- package/src/utils/get-packages.ts +2 -2
- package/src/utils/index.ts +2 -1
- package/src/utils/types.ts +1 -0
- package/src/utils/validate-shared-dependencies.ts +46 -0
- package/src/vite/__tests__/build-shared-dependencies.test.ts +234 -0
- package/src/vite/__tests__/validate-shared-dependencies.test.ts +45 -0
- package/src/vite/build-shared-dependencies.ts +52 -0
- package/src/vite/config/__tests__/asset-file-names.test.ts +40 -0
- package/src/vite/config/__tests__/base-config.test.ts +377 -0
- package/src/vite/config/__tests__/code-splitting.test.ts +34 -0
- package/src/vite/config/__tests__/create-css-config.test.ts +58 -0
- package/src/vite/config/__tests__/create-filtering-logger.test.ts +51 -0
- package/src/vite/config/__tests__/create-vite-build-context.test.ts +89 -0
- package/src/vite/config/__tests__/create-vite-config.test.ts +219 -0
- package/src/vite/config/__tests__/define-config.test.ts +23 -0
- package/src/vite/config/__tests__/get-warmup-client-files.test.ts +20 -0
- package/src/vite/config/__tests__/load-config-file.test.ts +191 -0
- package/src/vite/config/__tests__/merge-vite-configs.test.ts +84 -0
- package/src/vite/config/asset-file-names.ts +20 -0
- package/src/vite/config/base-config.ts +145 -0
- package/src/vite/config/code-splitting.ts +23 -0
- package/src/vite/config/create-css-config.ts +16 -0
- package/src/vite/config/create-filtering-logger.ts +34 -0
- package/src/vite/config/create-vite-build-context.ts +43 -0
- package/src/vite/config/create-vite-config.ts +66 -0
- package/src/vite/config/define-config.ts +18 -0
- package/src/vite/config/get-warmup-client-files.ts +13 -0
- package/src/vite/config/index.ts +5 -0
- package/src/vite/config/load-config-file.ts +52 -0
- package/src/vite/config/merge-vite-configs.ts +15 -0
- package/src/vite/index.html +33 -0
- package/src/vite/index.ts +1 -0
- package/src/vite/plugins/__tests__/bundle-stat-plugin.test.ts +70 -0
- package/src/vite/plugins/__tests__/chain-source-maps-plugin.test.ts +58 -0
- package/src/vite/plugins/__tests__/clean-plugin.test.ts +121 -0
- package/src/vite/plugins/__tests__/css-injector-plugin.test.ts +119 -0
- package/src/vite/plugins/__tests__/design-system-guard-plugin.test.ts +83 -0
- package/src/vite/plugins/__tests__/dev-server-routing-plugin.test.ts +255 -0
- package/src/vite/plugins/__tests__/externals-plugin.test.ts +138 -0
- package/src/vite/plugins/__tests__/html-plugin.test.ts +360 -0
- package/src/vite/plugins/__tests__/html-template.test.ts +103 -0
- package/src/vite/plugins/__tests__/ignore-modules-plugin.test.ts +107 -0
- package/src/vite/plugins/__tests__/istanbul-plugin.test.ts +62 -0
- package/src/vite/plugins/__tests__/metadata-plugin.test.ts +163 -0
- package/src/vite/plugins/__tests__/moment-locales-plugin.test.ts +104 -0
- package/src/vite/plugins/__tests__/style-urls-plugin.test.ts +77 -0
- package/src/vite/plugins/__tests__/svgr-plugin.test.ts +67 -0
- package/src/vite/plugins/__tests__/virtual-modules-plugin.test.ts +101 -0
- package/src/vite/plugins/bundle-stat-plugin.ts +24 -0
- package/src/vite/plugins/chain-source-maps-plugin.ts +26 -0
- package/src/vite/plugins/clean-plugin.ts +46 -0
- package/src/vite/plugins/css-injector-plugin.ts +65 -0
- package/src/vite/plugins/design-system-guard-plugin.ts +34 -0
- package/src/vite/plugins/dev-server-routing-plugin.ts +96 -0
- package/src/vite/plugins/externals-plugin.ts +81 -0
- package/src/vite/plugins/html-plugin.ts +111 -0
- package/src/vite/plugins/ignore-modules-plugin.ts +51 -0
- package/src/vite/plugins/index.ts +16 -0
- package/src/vite/plugins/istanbul-plugin.ts +19 -0
- package/src/vite/plugins/magic-comments-plugin/__tests__/magic-comments-plugin.test.ts +105 -0
- package/src/vite/plugins/magic-comments-plugin/__tests__/parse-magic-comments.test.ts +40 -0
- package/src/vite/plugins/magic-comments-plugin/index.ts +1 -0
- package/src/vite/plugins/magic-comments-plugin/magic-comments-plugin.ts +63 -0
- package/src/vite/plugins/magic-comments-plugin/parse-magic-comments.ts +39 -0
- package/src/vite/plugins/metadata-plugin.ts +65 -0
- package/src/vite/plugins/moment-locales-plugin.ts +41 -0
- package/src/vite/plugins/shared-dependencies-plugin/__tests__/assemble-iife.test.ts +29 -0
- package/src/vite/plugins/shared-dependencies-plugin/__tests__/assert-no-dynamic-css.test.ts +113 -0
- package/src/vite/plugins/shared-dependencies-plugin/__tests__/flatten.test.ts +23 -0
- package/src/vite/plugins/shared-dependencies-plugin/__tests__/shared-dependencies-plugin.test.ts +461 -0
- package/src/vite/plugins/shared-dependencies-plugin/assemble-iife.ts +114 -0
- package/src/vite/plugins/shared-dependencies-plugin/assert-no-dynamic-css.ts +58 -0
- package/src/vite/plugins/shared-dependencies-plugin/flatten.ts +8 -0
- package/src/vite/plugins/shared-dependencies-plugin/index.ts +1 -0
- package/src/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.ts +182 -0
- package/src/vite/plugins/style-urls-plugin.ts +21 -0
- package/src/vite/plugins/svgr-plugin.ts +17 -0
- package/src/vite/plugins/utils/get-css-file-names.ts +11 -0
- package/src/vite/plugins/utils/import-esm.ts +15 -0
- package/src/vite/plugins/utils/index.ts +2 -0
- package/src/vite/plugins/virtual-modules-plugin.ts +46 -0
- package/src/vite/rolldown-oxc.d.ts +20 -0
- package/src/vite/types.ts +6 -0
- package/src/vite/validate-shared-dependencies.ts +27 -0
- package/src/webpack/__mocks__/style-rules.ts +15 -3
- package/src/{cli/utils/__tests__/bundle.test.ts → webpack/__tests__/bundle-webpack.test.ts} +33 -26
- package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +91 -16
- package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +85 -26
- package/src/webpack/__tests__/create-webpack-config.test.ts +97 -13
- package/src/webpack/bundle-webpack.ts +107 -0
- package/src/webpack/configs/amd-config.ts +3 -2
- package/src/webpack/configs/cache-config.ts +7 -15
- package/src/webpack/configs/dev-server-config.ts +16 -17
- package/src/webpack/configs/devtool-config.ts +4 -3
- package/src/webpack/configs/entry.config.ts +8 -7
- package/src/webpack/configs/externals-config.ts +5 -21
- package/src/webpack/configs/index.ts +0 -1
- package/src/webpack/configs/loaders/css-loader.ts +7 -3
- package/src/webpack/configs/loaders/style-loader.ts +4 -5
- package/src/webpack/configs/module-config.ts +2 -2
- package/src/webpack/configs/optimization-config.ts +64 -36
- package/src/webpack/configs/output-config.ts +12 -24
- package/src/webpack/configs/plugins/assets-manifest-plugin.ts +24 -39
- package/src/webpack/configs/plugins/bundle-analyser-plugin.ts +6 -28
- package/src/webpack/configs/plugins/define-exposed-dependencies-plugin.ts +7 -18
- package/src/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.ts +7 -13
- package/src/webpack/configs/plugins/define-process-env-plugin.ts +10 -0
- package/src/webpack/configs/plugins/define-web-component-name-plugin.ts +7 -8
- package/src/webpack/configs/plugins/filter-warnings-plugin.ts +4 -3
- package/src/webpack/configs/plugins/html-plugin.ts +6 -6
- package/src/webpack/configs/plugins/html-tags-plugin.ts +10 -17
- package/src/webpack/configs/plugins/ignore-plugin/__tests__/ignore-plugin.test.ts +119 -0
- package/src/webpack/configs/plugins/ignore-plugin/empty-module.ts +7 -0
- package/src/webpack/configs/plugins/ignore-plugin/ignore-plugin.ts +62 -12
- package/src/webpack/configs/plugins/index.ts +1 -0
- package/src/webpack/configs/plugins/mini-css-extract-plugin.ts +9 -5
- package/src/webpack/configs/plugins/moment-locales-plugin.ts +4 -3
- package/src/webpack/configs/plugins/remove-empty-scripts-plugin.ts +4 -3
- package/src/webpack/configs/plugins/virtual-modules-plugin.ts +11 -65
- package/src/webpack/configs/plugins/watch-run-plugin.ts +3 -2
- package/src/webpack/configs/plugins-config.ts +5 -2
- package/src/webpack/configs/resolve-config.ts +4 -2
- package/src/webpack/configs/rules/css-rules.ts +4 -3
- package/src/webpack/configs/rules/font-rules.ts +3 -3
- package/src/webpack/configs/rules/image-rules.ts +3 -3
- package/src/webpack/configs/rules/js-rules.ts +3 -2
- package/src/webpack/configs/rules/less-rules.ts +2 -2
- package/src/webpack/configs/rules/scss-rules.ts +2 -2
- package/src/webpack/configs/rules/svg-rules.ts +2 -2
- package/src/webpack/configs/rules-config.ts +6 -5
- package/src/webpack/configs/stats-config.ts +3 -2
- package/src/webpack/configs/watch-options-config.ts +3 -3
- package/src/webpack/create-webpack-config.ts +28 -53
- package/src/webpack/create-webpack-configs.ts +77 -0
- package/src/webpack/index.ts +2 -0
- package/src/webpack/types.ts +8 -11
- package/src/webpack/utils/__tests__/split-by-entry.test.ts +33 -0
- package/src/webpack/utils/create-webpack-build-context.ts +7 -0
- package/src/webpack/utils/index.ts +1 -1
- package/tsconfig/base.json +1 -1
- package/tsconfig/types.d.ts +10 -0
- package/dist/cli/commands/bundle-package.d.ts +0 -6
- package/dist/cli/commands/bundle-package.d.ts.map +0 -1
- package/dist/cli/commands/bundle-package.js.map +0 -1
- package/dist/cli/commands/registry/bundle-package.d.ts.map +0 -1
- package/dist/cli/utils/bundle.d.ts +0 -14
- package/dist/cli/utils/bundle.d.ts.map +0 -1
- package/dist/cli/utils/bundle.js +0 -187
- package/dist/cli/utils/bundle.js.map +0 -1
- package/dist/utils/get-startup-version.d.ts.map +0 -1
- package/dist/utils/get-startup-version.js.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.d.ts +0 -3
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.d.ts.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.js +0 -40
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.js.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.d.ts +0 -2
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.d.ts.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.js.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.d.ts +0 -2
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.d.ts.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.js +0 -27
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.js.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-react-dom-peer-dependency.d.ts +0 -7
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-react-dom-peer-dependency.d.ts.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-react-dom-peer-dependency.js +0 -15
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-react-dom-peer-dependency.js.map +0 -1
- package/dist/webpack/configs/types.d.ts +0 -37
- package/dist/webpack/configs/types.d.ts.map +0 -1
- package/dist/webpack/configs/types.js.map +0 -1
- package/dist/webpack/configs/utils/build-metadata.d.ts.map +0 -1
- package/dist/webpack/configs/utils/build-metadata.js.map +0 -1
- package/dist/webpack/configs/utils/generate-metadata.d.ts +0 -3
- package/dist/webpack/configs/utils/generate-metadata.d.ts.map +0 -1
- package/dist/webpack/configs/utils/generate-metadata.js.map +0 -1
- package/dist/webpack/configs/utils/get-bundle-type.d.ts +0 -3
- package/dist/webpack/configs/utils/get-bundle-type.d.ts.map +0 -1
- package/dist/webpack/configs/utils/get-bundle-type.js.map +0 -1
- package/dist/webpack/configs/utils/get-exposed-dependencies.d.ts.map +0 -1
- package/dist/webpack/configs/utils/get-exposed-dependencies.js.map +0 -1
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.d.ts.map +0 -1
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.js.map +0 -1
- package/dist/webpack/configs/utils/get-web-components-version.d.ts.map +0 -1
- package/dist/webpack/configs/utils/get-web-components-version.js.map +0 -1
- package/dist/webpack/configs/utils/index.d.ts +0 -4
- package/dist/webpack/configs/utils/index.d.ts.map +0 -1
- package/dist/webpack/configs/utils/index.js.map +0 -1
- package/dist/webpack/utils/stringify-config.d.ts.map +0 -1
- package/dist/webpack/utils/stringify-config.js.map +0 -1
- package/src/cli/utils/bundle.ts +0 -191
- package/src/utils/get-startup-version.ts +0 -6
- package/src/webpack/configs/plugins/ignore-plugin/__tests__/check-resource.test.ts +0 -62
- package/src/webpack/configs/plugins/ignore-plugin/__tests__/is-optional-peer-dependency.test.ts +0 -47
- package/src/webpack/configs/plugins/ignore-plugin/__tests__/is-optional-react-dom-peer-dependency.test.ts +0 -35
- package/src/webpack/configs/plugins/ignore-plugin/check-resource.ts +0 -29
- package/src/webpack/configs/plugins/ignore-plugin/get-package-json.ts +0 -23
- package/src/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.ts +0 -12
- package/src/webpack/configs/plugins/ignore-plugin/is-optional-react-dom-peer-dependency.ts +0 -11
- package/src/webpack/configs/types.ts +0 -40
- package/src/webpack/configs/utils/get-bundle-type.ts +0 -22
- package/src/webpack/configs/utils/index.ts +0 -3
- /package/dist/{webpack/configs → core/check-resource}/types.js +0 -0
- /package/dist/{webpack/configs/utils → core}/get-exposed-dependencies.d.ts +0 -0
- /package/dist/{webpack/configs/utils → core}/get-exposed-dependencies.js +0 -0
- /package/dist/{webpack/configs/utils → core/get-version}/get-launchdarkly-sdk-version.d.ts +0 -0
- /package/dist/{webpack/configs/utils → core/get-version}/get-launchdarkly-sdk-version.js +0 -0
- /package/dist/{utils → core/get-version}/get-startup-version.d.ts +0 -0
- /package/dist/{webpack/configs/utils → core/get-version}/get-web-components-version.d.ts +0 -0
- /package/dist/{webpack/configs/utils → core/get-version}/get-web-components-version.js +0 -0
- /package/dist/{webpack/configs/utils → core/metadata}/build-metadata.d.ts +0 -0
- /package/dist/{webpack/utils → core}/stringify-config.d.ts +0 -0
- /package/dist/{webpack/utils → core}/stringify-config.js +0 -0
- /package/src/cli/commands/registry/{bundle-package.ts → bundle-webpack.ts} +0 -0
- /package/src/{webpack/configs/utils → core}/__tests__/get-exposed-dependencies.test.ts +0 -0
- /package/src/{webpack/configs/utils → core}/get-exposed-dependencies.ts +0 -0
- /package/src/{webpack/configs/utils → core/get-version}/__tests__/get-launchdarkly-sdk-version.test.ts +0 -0
- /package/src/{utils → core/get-version}/__tests__/get-startup-version.test.ts +0 -0
- /package/src/{webpack/configs/utils → core/get-version}/__tests__/get-web-components-version.test.ts +0 -0
- /package/src/{webpack/configs/utils → core/get-version}/get-launchdarkly-sdk-version.ts +0 -0
- /package/src/{webpack/configs/utils → core/get-version}/get-web-components-version.ts +0 -0
- /package/src/{webpack/utils → core}/stringify-config.ts +0 -0
package/src/vite/plugins/shared-dependencies-plugin/__tests__/shared-dependencies-plugin.test.ts
ADDED
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { bundleConstants, generateExposedDependenciesMetadata } from '../../../../core';
|
|
3
|
+
import {
|
|
4
|
+
sharedDependenciesPlugin,
|
|
5
|
+
type SharedDependenciesPluginOptions,
|
|
6
|
+
} from '../shared-dependencies-plugin';
|
|
7
|
+
|
|
8
|
+
jest.mock('../../../../core', () => ({
|
|
9
|
+
...jest.requireActual('../../../../core'),
|
|
10
|
+
bundleConstants: {
|
|
11
|
+
mode: { production: 'production', development: 'development' },
|
|
12
|
+
},
|
|
13
|
+
generateExposedDependenciesMetadata: jest.fn(),
|
|
14
|
+
}));
|
|
15
|
+
|
|
16
|
+
describe(sharedDependenciesPlugin.name, () => {
|
|
17
|
+
const CSS_VIRTUAL_PREFIX = '\0SHARED_DEPENDENCY_CSS';
|
|
18
|
+
const mockDependencies: Record<string, string> = {
|
|
19
|
+
'react': 'globalReact',
|
|
20
|
+
'@scope/lib': 'globalScopeLib',
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
let options: SharedDependenciesPluginOptions;
|
|
24
|
+
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
jest.clearAllMocks();
|
|
27
|
+
options = {
|
|
28
|
+
dependencies: mockDependencies,
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const subject = () => sharedDependenciesPlugin(options);
|
|
33
|
+
|
|
34
|
+
test('returns plugin with correct name', () => {
|
|
35
|
+
expect(subject().name).toBe('shared-dependencies');
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('enforces pre', () => {
|
|
39
|
+
expect(subject().enforce).toBe('pre');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('config', () => {
|
|
43
|
+
let mode: string;
|
|
44
|
+
|
|
45
|
+
beforeEach(() => {
|
|
46
|
+
mode = bundleConstants.mode.development;
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const subject = () => {
|
|
50
|
+
const plugin = sharedDependenciesPlugin(options);
|
|
51
|
+
return (plugin.config as Function).call(plugin, {}, { mode });
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
test('sets base to relative path', () => {
|
|
55
|
+
expect(subject().base).toBe('./');
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test('defines process.env.NODE_ENV from mode', () => {
|
|
59
|
+
expect(subject().define['process.env.NODE_ENV']).toBe(JSON.stringify(mode));
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test('creates input entry for each dependency', () => {
|
|
63
|
+
const { input } = subject().build.rolldownOptions;
|
|
64
|
+
|
|
65
|
+
const expected: Record<string, string> = {};
|
|
66
|
+
for (const dependency of Object.keys(options.dependencies)) {
|
|
67
|
+
expected[dependency.replace('/', '-')] = dependency;
|
|
68
|
+
}
|
|
69
|
+
expect(input).toEqual(expected);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
test('uses CJS format with named exports', () => {
|
|
73
|
+
expect(subject().build.rolldownOptions.output).toEqual(
|
|
74
|
+
expect.objectContaining({ format: 'cjs', exports: 'named' })
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test('preserves entry signatures', () => {
|
|
79
|
+
expect(subject().build.rolldownOptions.preserveEntrySignatures).toBe('exports-only');
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test('disables treeshake', () => {
|
|
83
|
+
expect(subject().build.rolldownOptions.treeshake).toBe(false);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test('configures entry and chunk file names', () => {
|
|
87
|
+
expect(subject().build.rolldownOptions.output).toEqual(
|
|
88
|
+
expect.objectContaining({
|
|
89
|
+
entryFileNames: '[name].cjs.js',
|
|
90
|
+
chunkFileNames: '_[name]-[hash].js',
|
|
91
|
+
})
|
|
92
|
+
);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
describe('with CSS entries', () => {
|
|
96
|
+
beforeEach(() => {
|
|
97
|
+
options.css = { 'design-system': ['tokens.css'] };
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test('adds CSS virtual inputs', () => {
|
|
101
|
+
const { input } = subject().build.rolldownOptions;
|
|
102
|
+
|
|
103
|
+
for (const name of Object.keys(options.css!)) {
|
|
104
|
+
expect(input[name]).toBe(CSS_VIRTUAL_PREFIX + name);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
describe('assetFileNames', () => {
|
|
110
|
+
let assetNames: string[];
|
|
111
|
+
|
|
112
|
+
beforeEach(() => {
|
|
113
|
+
assetNames = ['font.woff2'];
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const subject = () => {
|
|
117
|
+
const plugin = sharedDependenciesPlugin(options);
|
|
118
|
+
const config = (plugin.config as Function).call(plugin, {}, { mode });
|
|
119
|
+
return config.build.rolldownOptions.output.assetFileNames({ names: assetNames });
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
test('generates name from asset', () => {
|
|
123
|
+
expect(subject()).toBe('font[extname]');
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
describe('when asset is CSS', () => {
|
|
127
|
+
beforeEach(() => (assetNames = ['styles.css']));
|
|
128
|
+
|
|
129
|
+
test('adds bundle suffix', () => {
|
|
130
|
+
expect(subject()).toBe('styles.bundle[extname]');
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
describe('when asset has scope prefix', () => {
|
|
135
|
+
beforeEach(() => (assetNames = ['@scope-lib.css']));
|
|
136
|
+
|
|
137
|
+
test('strips scope prefix', () => {
|
|
138
|
+
expect(subject()).toBe('lib.bundle[extname]');
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
describe('when production', () => {
|
|
143
|
+
beforeEach(() => (mode = bundleConstants.mode.production));
|
|
144
|
+
|
|
145
|
+
test('includes hash in filename', () => {
|
|
146
|
+
expect(subject()).toBe('font.[hash][extname]');
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
describe('when asset is CSS', () => {
|
|
150
|
+
beforeEach(() => (assetNames = ['styles.css']));
|
|
151
|
+
|
|
152
|
+
test('includes hash in filename', () => {
|
|
153
|
+
expect(subject()).toBe('styles.[hash].bundle[extname]');
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
describe('resolveId', () => {
|
|
161
|
+
const knownDependency = Object.keys(mockDependencies)[0];
|
|
162
|
+
|
|
163
|
+
let source: string;
|
|
164
|
+
let importer: string | undefined;
|
|
165
|
+
|
|
166
|
+
beforeEach(() => {
|
|
167
|
+
source = knownDependency;
|
|
168
|
+
importer = '/path/to/file.ts';
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
const subject = () => {
|
|
172
|
+
const plugin = sharedDependenciesPlugin(options);
|
|
173
|
+
return (plugin.resolveId as Function).call(plugin, source, importer);
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const itReturnsUndefined = () => {
|
|
177
|
+
test('returns undefined', () => {
|
|
178
|
+
expect(subject()).toBeUndefined();
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
test('marks dependency as external', () => {
|
|
183
|
+
expect(subject()).toEqual({ id: source, external: true });
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
describe('when source is CSS virtual module', () => {
|
|
187
|
+
beforeEach(() => (source = CSS_VIRTUAL_PREFIX + 'design-system'));
|
|
188
|
+
|
|
189
|
+
test('returns source', () => {
|
|
190
|
+
expect(subject()).toBe(source);
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
describe('when source is an unknown dependency', () => {
|
|
195
|
+
beforeEach(() => (source = 'unknown'));
|
|
196
|
+
|
|
197
|
+
itReturnsUndefined();
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
describe('when importer is not present', () => {
|
|
201
|
+
beforeEach(() => (importer = undefined));
|
|
202
|
+
|
|
203
|
+
itReturnsUndefined();
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
describe('load', () => {
|
|
208
|
+
const cssName = 'design-system';
|
|
209
|
+
const cssImports = ['tokens.css', 'fonts.css'];
|
|
210
|
+
|
|
211
|
+
let id: string;
|
|
212
|
+
|
|
213
|
+
beforeEach(() => {
|
|
214
|
+
id = CSS_VIRTUAL_PREFIX + cssName;
|
|
215
|
+
options.css = { [cssName]: cssImports };
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
const subject = () => {
|
|
219
|
+
const plugin = sharedDependenciesPlugin(options);
|
|
220
|
+
return (plugin.load as Function).call(plugin, id);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
const itReturnsUndefined = () => {
|
|
224
|
+
test('returns undefined', () => {
|
|
225
|
+
expect(subject()).toBeUndefined();
|
|
226
|
+
});
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
test('returns import statements', () => {
|
|
230
|
+
expect(subject()).toBe(cssImports.map(p => `import '${p}';`).join('\n'));
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
describe('when id is not a CSS virtual module', () => {
|
|
234
|
+
beforeEach(() => (id = ''));
|
|
235
|
+
|
|
236
|
+
itReturnsUndefined();
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
describe('with unknown CSS module', () => {
|
|
240
|
+
beforeEach(() => (id = CSS_VIRTUAL_PREFIX + 'unknown'));
|
|
241
|
+
|
|
242
|
+
itReturnsUndefined();
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
describe('generateBundle', () => {
|
|
247
|
+
const sharedChunk = { fileName: '_helper-abc.js', code: 'helper code' };
|
|
248
|
+
|
|
249
|
+
let bundle: Record<string, any>;
|
|
250
|
+
let emitFile: jest.Mock;
|
|
251
|
+
let mode: string;
|
|
252
|
+
|
|
253
|
+
const entryFileName = (dependency: string) => `${dependency.replace('/', '-')}.cjs.js`;
|
|
254
|
+
|
|
255
|
+
beforeEach(() => {
|
|
256
|
+
mode = bundleConstants.mode.development;
|
|
257
|
+
emitFile = jest.fn();
|
|
258
|
+
bundle = {
|
|
259
|
+
[sharedChunk.fileName]: {
|
|
260
|
+
type: 'chunk',
|
|
261
|
+
isEntry: false,
|
|
262
|
+
code: sharedChunk.code,
|
|
263
|
+
imports: [],
|
|
264
|
+
dynamicImports: [],
|
|
265
|
+
},
|
|
266
|
+
...Object.fromEntries(
|
|
267
|
+
Object.keys(mockDependencies).map(dependency => [
|
|
268
|
+
entryFileName(dependency),
|
|
269
|
+
{
|
|
270
|
+
type: 'chunk',
|
|
271
|
+
isEntry: true,
|
|
272
|
+
code: `${dependency} code`,
|
|
273
|
+
imports: [],
|
|
274
|
+
dynamicImports: [],
|
|
275
|
+
},
|
|
276
|
+
])
|
|
277
|
+
),
|
|
278
|
+
'styles.bundle.css': { type: 'asset' },
|
|
279
|
+
};
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
const subject = () => {
|
|
283
|
+
const plugin = sharedDependenciesPlugin(options);
|
|
284
|
+
(plugin.config as Function).call(plugin, {}, { mode });
|
|
285
|
+
(plugin.generateBundle as Function).call({ emitFile }, {}, bundle);
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
const emittedBundleCode = () => {
|
|
289
|
+
const call = emitFile.mock.calls.find((c: any) =>
|
|
290
|
+
c[0].fileName?.endsWith('.bundle.js')
|
|
291
|
+
);
|
|
292
|
+
return call[0].source as string;
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
const expectBundleContains = (...fragments: string[]) => {
|
|
296
|
+
const code = emittedBundleCode();
|
|
297
|
+
for (const fragment of fragments) {
|
|
298
|
+
expect(code).toContain(fragment);
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
test('emits shared bundle as asset', () => {
|
|
303
|
+
subject();
|
|
304
|
+
|
|
305
|
+
expect(emitFile).toHaveBeenCalledWith(
|
|
306
|
+
expect.objectContaining({
|
|
307
|
+
type: 'asset',
|
|
308
|
+
fileName: 'shared.bundle.js',
|
|
309
|
+
})
|
|
310
|
+
);
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
test('emits entrypoints.json with CSS and JS files', () => {
|
|
314
|
+
subject();
|
|
315
|
+
|
|
316
|
+
expect(emitFile).toHaveBeenCalledWith({
|
|
317
|
+
type: 'asset',
|
|
318
|
+
fileName: 'entrypoints.json',
|
|
319
|
+
source: JSON.stringify(
|
|
320
|
+
{ css: ['styles.bundle.css'], js: ['shared.bundle.js'] },
|
|
321
|
+
null,
|
|
322
|
+
2
|
|
323
|
+
),
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
test('includes dependency entry code in emitted bundle', () => {
|
|
328
|
+
subject();
|
|
329
|
+
|
|
330
|
+
expectBundleContains(
|
|
331
|
+
...Object.keys(mockDependencies).flatMap(dependency => [
|
|
332
|
+
`'${dependency}'`,
|
|
333
|
+
`${dependency} code`,
|
|
334
|
+
])
|
|
335
|
+
);
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
test('includes shared chunk code in emitted bundle', () => {
|
|
339
|
+
subject();
|
|
340
|
+
|
|
341
|
+
expectBundleContains(`'./${sharedChunk.fileName}'`, sharedChunk.code);
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
test('generates expose call for each dependency', () => {
|
|
345
|
+
subject();
|
|
346
|
+
|
|
347
|
+
expectBundleContains(
|
|
348
|
+
...Object.entries(mockDependencies).map(
|
|
349
|
+
([dependency, variable]) => `expose('${variable}', '${dependency}')`
|
|
350
|
+
)
|
|
351
|
+
);
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
test('removes shared chunks from bundle', () => {
|
|
355
|
+
subject();
|
|
356
|
+
|
|
357
|
+
expect(bundle[sharedChunk.fileName]).toBeUndefined();
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
test('removes dependency entry chunks from bundle', () => {
|
|
361
|
+
subject();
|
|
362
|
+
|
|
363
|
+
for (const dependency of Object.keys(mockDependencies)) {
|
|
364
|
+
expect(bundle[entryFileName(dependency)]).toBeUndefined();
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
describe('when production', () => {
|
|
369
|
+
beforeEach(() => (mode = bundleConstants.mode.production));
|
|
370
|
+
|
|
371
|
+
test('includes hash in bundle filename', () => {
|
|
372
|
+
subject();
|
|
373
|
+
|
|
374
|
+
expect(emitFile.mock.calls[0][0].fileName).toMatch(
|
|
375
|
+
/^shared\.[a-f0-9]+\.bundle\.js$/
|
|
376
|
+
);
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
describe('when dependency entry chunk is missing', () => {
|
|
381
|
+
const missingDependency = Object.keys(mockDependencies)[0];
|
|
382
|
+
|
|
383
|
+
beforeEach(() => delete bundle[entryFileName(missingDependency)]);
|
|
384
|
+
|
|
385
|
+
test('throws error', () => {
|
|
386
|
+
expect(() => subject()).toThrow(
|
|
387
|
+
new RegExp(`Expected entry chunk for ${missingDependency}`)
|
|
388
|
+
);
|
|
389
|
+
});
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
describe('with CSS entries', () => {
|
|
393
|
+
beforeEach(() => {
|
|
394
|
+
options.css = { 'design-system': ['tokens.css'] };
|
|
395
|
+
bundle['design-system.cjs.js'] = {
|
|
396
|
+
type: 'chunk',
|
|
397
|
+
isEntry: true,
|
|
398
|
+
code: '',
|
|
399
|
+
imports: [],
|
|
400
|
+
dynamicImports: [],
|
|
401
|
+
};
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
test('removes CSS entry chunks from bundle', () => {
|
|
405
|
+
subject();
|
|
406
|
+
|
|
407
|
+
expect(bundle['design-system.cjs.js']).toBeUndefined();
|
|
408
|
+
});
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
describe('when bundle has anvil2 CSS before design-system CSS', () => {
|
|
412
|
+
beforeEach(() => {
|
|
413
|
+
bundle['anvil2.bundle.css'] = { type: 'asset' };
|
|
414
|
+
bundle['design-system.bundle.css'] = { type: 'asset' };
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
test('puts design-system CSS before anvil2 CSS in entrypoints.json', () => {
|
|
418
|
+
subject();
|
|
419
|
+
|
|
420
|
+
const call = emitFile.mock.calls.find(
|
|
421
|
+
(c: any) => c[0].fileName === 'entrypoints.json'
|
|
422
|
+
);
|
|
423
|
+
const { css } = JSON.parse(call[0].source);
|
|
424
|
+
expect(css.indexOf('design-system.bundle.css')).toBeLessThan(
|
|
425
|
+
css.indexOf('anvil2.bundle.css')
|
|
426
|
+
);
|
|
427
|
+
});
|
|
428
|
+
});
|
|
429
|
+
});
|
|
430
|
+
|
|
431
|
+
describe('writeBundle', () => {
|
|
432
|
+
let outputDir: string;
|
|
433
|
+
|
|
434
|
+
beforeEach(() => (outputDir = '/output/dist'));
|
|
435
|
+
|
|
436
|
+
const subject = () => {
|
|
437
|
+
const plugin = sharedDependenciesPlugin(options);
|
|
438
|
+
return (plugin.writeBundle as Function).call(plugin, { dir: outputDir });
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
test('is undefined', () => {
|
|
442
|
+
expect(sharedDependenciesPlugin(options).writeBundle).toBeUndefined();
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
describe('when metadataDir is set', () => {
|
|
446
|
+
beforeEach(() => (options.metadataDir = '/output/metadata'));
|
|
447
|
+
|
|
448
|
+
test('calls generateExposedDependenciesMetadata with entrypoints.json resolver', () => {
|
|
449
|
+
subject();
|
|
450
|
+
|
|
451
|
+
expect(generateExposedDependenciesMetadata).toHaveBeenCalledWith(
|
|
452
|
+
options.metadataDir,
|
|
453
|
+
expect.any(Function)
|
|
454
|
+
);
|
|
455
|
+
const pathResolver = jest.mocked(generateExposedDependenciesMetadata).mock
|
|
456
|
+
.calls[0][1];
|
|
457
|
+
expect(pathResolver()).toBe(path.resolve(outputDir, 'entrypoints.json'));
|
|
458
|
+
});
|
|
459
|
+
});
|
|
460
|
+
});
|
|
461
|
+
});
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
export interface ModuleFactory {
|
|
2
|
+
/** Module id used as the factory's key and require() argument (e.g. `react`, `./_chunk.js`). */
|
|
3
|
+
id: string;
|
|
4
|
+
/** The chunk's generated code, run inside `function(module, exports, require) { ... }`. */
|
|
5
|
+
code: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface Expose {
|
|
9
|
+
/** Global path the dependency is published under (e.g. `SharedDependencies.React`). */
|
|
10
|
+
variable: string;
|
|
11
|
+
/** Module id resolved through the scoped require when the global is accessed. */
|
|
12
|
+
dependency: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function indent(spaces: number) {
|
|
16
|
+
return ' '.repeat(spaces);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
* Wraps the bundle's module factories and expose calls in the runtime IIFE.
|
|
21
|
+
* The IIFE installs a per-scope require system on globalThis so each MFE gets
|
|
22
|
+
* isolated module instances of the shared dependencies.
|
|
23
|
+
*/
|
|
24
|
+
export function assembleIife(modules: ModuleFactory[], exposes: Expose[]): string {
|
|
25
|
+
const factories = modules.map(
|
|
26
|
+
({ id, code }) =>
|
|
27
|
+
`'${id}': function(module, exports, require) {\n${indent(12)}${code}\n${indent(8)}}`
|
|
28
|
+
);
|
|
29
|
+
const exposeCalls = exposes.map(
|
|
30
|
+
({ variable, dependency }) => `expose('${variable}', '${dependency}');`
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
return `\
|
|
34
|
+
(function () {
|
|
35
|
+
const STORAGE_KEY = Symbol.for('SERVICETITAN_EXPOSE_LOADER_STORAGE');
|
|
36
|
+
const g = globalThis;
|
|
37
|
+
|
|
38
|
+
if (g[STORAGE_KEY] === undefined) {
|
|
39
|
+
g[STORAGE_KEY] = Object.assign(Object.create(null), {
|
|
40
|
+
clear(scope) {
|
|
41
|
+
delete this[scope];
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
var storage = g[STORAGE_KEY];
|
|
47
|
+
|
|
48
|
+
var modules = {
|
|
49
|
+
${factories.join(`,\n${indent(8)}`)}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
function createScopedRequire(scope) {
|
|
53
|
+
const cache = (storage[scope] = storage[scope] || Object.create(null));
|
|
54
|
+
|
|
55
|
+
function require(id) {
|
|
56
|
+
if (cache[id]) {
|
|
57
|
+
return cache[id].exports;
|
|
58
|
+
}
|
|
59
|
+
if (!modules[id]) {
|
|
60
|
+
throw new Error('Module not found: ' + id);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const module = (cache[id] = { id, loaded: false, exports: {} });
|
|
64
|
+
modules[id](module, module.exports, require);
|
|
65
|
+
module.loaded = true;
|
|
66
|
+
|
|
67
|
+
const keys = Object.keys(module.exports);
|
|
68
|
+
if (module.exports.__esModule && keys.length === 1 && keys[0] === 'default') {
|
|
69
|
+
module.exports = module.exports.default;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return module.exports;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
Object.setPrototypeOf(require, {
|
|
76
|
+
resolve(id) {
|
|
77
|
+
return id;
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
return require;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function expose(path, moduleId) {
|
|
84
|
+
const parts = path.split('.');
|
|
85
|
+
let obj = g;
|
|
86
|
+
|
|
87
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
88
|
+
if (obj[parts[i]] === undefined) {
|
|
89
|
+
obj[parts[i]] = Object.create(null);
|
|
90
|
+
}
|
|
91
|
+
obj = obj[parts[i]];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
obj[parts[parts.length - 1]] = new Proxy(
|
|
95
|
+
Object.assign(Object.create(null), {
|
|
96
|
+
getStorage() {
|
|
97
|
+
return storage;
|
|
98
|
+
},
|
|
99
|
+
}),
|
|
100
|
+
{
|
|
101
|
+
get(target, scope, receiver) {
|
|
102
|
+
if (scope === 'getStorage') {
|
|
103
|
+
return Reflect.get(target, scope, receiver);
|
|
104
|
+
}
|
|
105
|
+
return createScopedRequire(scope)(moduleId);
|
|
106
|
+
},
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
${exposeCalls.join(`\n${indent(4)}`)}
|
|
112
|
+
})();
|
|
113
|
+
`;
|
|
114
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { OutputBundle, OutputChunk } from 'rolldown';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Output bundles only include statically imported CSS. CSS pulled in by a dynamic
|
|
5
|
+
* import() lands in a separate async chunk that is omitted from entrypoints.json
|
|
6
|
+
* and silently fails to load. Fail the build when the bundle references CSS that
|
|
7
|
+
* does not land in entrypoints.json.
|
|
8
|
+
*/
|
|
9
|
+
export function assertNoDynamicCss(bundle: OutputBundle): void {
|
|
10
|
+
for (const entry of Object.values(bundle)) {
|
|
11
|
+
if (!(entry.type === 'chunk' && entry.isEntry)) {
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const includedCss = importedCss(entry);
|
|
16
|
+
const excludedCss = [...allCss(entry, bundle)].filter(css => !includedCss.has(css));
|
|
17
|
+
|
|
18
|
+
if (excludedCss.length > 0) {
|
|
19
|
+
throw new Error(
|
|
20
|
+
`Shared dependency chunk "${entry.name}" pulls in CSS through a dynamic import ` +
|
|
21
|
+
`(${excludedCss.join(', ')}). Shared dependencies only include statically imported ` +
|
|
22
|
+
`CSS. Dynamically imported CSS will not load on the host.`
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/*
|
|
29
|
+
* Return every CSS file imported by the entry and recursively by anything it imports.
|
|
30
|
+
*/
|
|
31
|
+
function allCss(entry: OutputChunk, bundle: OutputBundle): Set<string> {
|
|
32
|
+
const result = new Set<string>();
|
|
33
|
+
const visited = new Set<string>();
|
|
34
|
+
const stack = [entry];
|
|
35
|
+
|
|
36
|
+
while (stack.length > 0) {
|
|
37
|
+
const chunk = stack.pop()!;
|
|
38
|
+
importedCss(chunk).forEach(file => result.add(file));
|
|
39
|
+
|
|
40
|
+
for (const fileName of [...chunk.imports, ...chunk.dynamicImports]) {
|
|
41
|
+
const imported = bundle[fileName];
|
|
42
|
+
if (imported?.type === 'chunk' && !visited.has(fileName)) {
|
|
43
|
+
visited.add(fileName);
|
|
44
|
+
stack.push(imported);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function importedCss(chunk: OutputChunk): ReadonlySet<string> {
|
|
53
|
+
return (
|
|
54
|
+
// Vite adds `viteMetadata` to Rolldown chunks; cast because its type augmentation is not in scope here.
|
|
55
|
+
(chunk as { viteMetadata?: { importedCss?: Set<string> } }).viteMetadata?.importedCss ??
|
|
56
|
+
new Set<string>()
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Replaces `/` with `-` so scoped packages stay flat in Rolldown output.
|
|
3
|
+
* Without this, `@scope/foo` emits into a subdirectory and its require()
|
|
4
|
+
* calls use `../` paths that don't match the IIFE's flat module keys.
|
|
5
|
+
*/
|
|
6
|
+
export function flatten(dep: string): string {
|
|
7
|
+
return dep.replace(/\//g, '-');
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './shared-dependencies-plugin';
|