@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
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
import type { BuildContext } from '../../core';
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* Replaces Vite's default CSS injection (<style> tags in document.head) with
|
|
6
|
+
* MfeStyleRegistry.injectSheet() from @servicetitan/web-components, which
|
|
7
|
+
* creates CSSStyleSheet objects that can be adopted into shadow roots.
|
|
8
|
+
*
|
|
9
|
+
* Works by transforming Vite's CSS module output at enforce:'post'. Vite
|
|
10
|
+
* transforms CSS imports into JS modules that call updateStyle(id, css) from
|
|
11
|
+
* /@vite/client — this plugin replaces that call with injectSheet().
|
|
12
|
+
*
|
|
13
|
+
* HMR works automatically: when a CSS file changes, Vite re-evaluates the
|
|
14
|
+
* module, which re-runs injectSheet(). Existing CSSStyleSheet objects are
|
|
15
|
+
* updated via replaceSync(), so all shadow roots that adopted them see the
|
|
16
|
+
* change immediately.
|
|
17
|
+
*/
|
|
18
|
+
export function cssInjectorPlugin(context: BuildContext): Plugin | undefined {
|
|
19
|
+
const { name, isProduction } = context.build;
|
|
20
|
+
const { isWebComponent } = context.package;
|
|
21
|
+
if (!isWebComponent || isProduction) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
name: 'mfe-css-injector',
|
|
27
|
+
enforce: 'post',
|
|
28
|
+
transform(code, id) {
|
|
29
|
+
if (!id.endsWith('.css') && !id.endsWith('.less') && !id.endsWith('.scss')) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (!code.includes('__vite__updateStyle')) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let transformed = code;
|
|
37
|
+
|
|
38
|
+
const importPattern =
|
|
39
|
+
/import \{ updateStyle as __vite__updateStyle, removeStyle as __vite__removeStyle \} from [^\n]+/;
|
|
40
|
+
const callPattern = '__vite__updateStyle(__vite__id, __vite__css)';
|
|
41
|
+
|
|
42
|
+
if (!importPattern.test(transformed) || !transformed.includes(callPattern)) {
|
|
43
|
+
this.error(
|
|
44
|
+
`[startup] Failed to transform CSS module — Vite's internal output format may have changed. File: ${id}`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
transformed = transformed
|
|
49
|
+
.replace(
|
|
50
|
+
importPattern,
|
|
51
|
+
`import { MfeStyleRegistry as __mfe__Registry } from '@servicetitan/web-components'`
|
|
52
|
+
)
|
|
53
|
+
.replace(
|
|
54
|
+
callPattern,
|
|
55
|
+
`__mfe__Registry.for(${JSON.stringify(name)}).injectSheet(__vite__id, __vite__css)`
|
|
56
|
+
)
|
|
57
|
+
.replace(
|
|
58
|
+
/import\.meta\.hot\.prune\(\(\) => __vite__removeStyle\(__vite__id\)\)/,
|
|
59
|
+
''
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
return { code: transformed, map: null };
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import type { Plugin } from 'vite';
|
|
3
|
+
import { BuildContext } from '../../core';
|
|
4
|
+
|
|
5
|
+
const DESIGN_SYSTEM = '@servicetitan/design-system';
|
|
6
|
+
const DESIGN_SYSTEM_CSS = /[\\/]design-system\.css$/;
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Errors when a host's own code imports design-system.css while it exposes the design
|
|
10
|
+
* system as a shared dependency. The CSS already ships in the shared bundle, so a direct
|
|
11
|
+
* import would load the design system twice. Mirrors the webpack guard in css-rules.ts.
|
|
12
|
+
*/
|
|
13
|
+
export function designSystemGuardPlugin(context: BuildContext): Plugin {
|
|
14
|
+
const { isExposeSharedDependencies, sharedDependencies } = context.package;
|
|
15
|
+
const { emitExposedDependencies } = context.build;
|
|
16
|
+
|
|
17
|
+
const designSystemInSharedBundle =
|
|
18
|
+
isExposeSharedDependencies &&
|
|
19
|
+
!!sharedDependencies[DESIGN_SYSTEM] &&
|
|
20
|
+
!emitExposedDependencies;
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
name: 'design-system-guard',
|
|
24
|
+
enforce: 'pre',
|
|
25
|
+
resolveId(source, importer) {
|
|
26
|
+
if (designSystemInSharedBundle && importer && DESIGN_SYSTEM_CSS.test(source)) {
|
|
27
|
+
const filename = path.parse(importer).name;
|
|
28
|
+
this.error(
|
|
29
|
+
`do not import design-system.css in "${filename}"; it is automatically included as a shared dependency`
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import type { Plugin } from 'vite';
|
|
4
|
+
import { getBundleType, type BuildContext } from '../../core';
|
|
5
|
+
import { log } from '../../utils';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* URL rewrites for dev and preview servers.
|
|
9
|
+
*
|
|
10
|
+
* Dev serves from the project root, preview serves from outDir. Production builds output to
|
|
11
|
+
* dist/bundle/. Paths that work in prod (relative to index.html in outDir) break in dev and
|
|
12
|
+
* preview because the server root differs.
|
|
13
|
+
*
|
|
14
|
+
* - Host dev (root: project root): template uses ./shared/... which resolves to /shared/...
|
|
15
|
+
* but files are at dist/bundle/shared/. Rewrites to /dist/bundle/shared/... so Vite serves them.
|
|
16
|
+
*
|
|
17
|
+
* - MFE dev (root: project root): Loader reads entrypoints.json and requests assets at
|
|
18
|
+
* production output paths (e.g. /dist/bundle/full/index.js). Strips the outDir prefix
|
|
19
|
+
* so files resolve from root.
|
|
20
|
+
*
|
|
21
|
+
* - Host preview (root: dist/bundle/): shared/ is inside outDir, no rewrites needed.
|
|
22
|
+
*
|
|
23
|
+
* - MFE preview (root: dist/bundle/full/): host requests metadata.json from the parent
|
|
24
|
+
* dist/bundle/ and sibling bundle assets (light/, headless/). Serves the entire destination
|
|
25
|
+
* directory as static files.
|
|
26
|
+
*/
|
|
27
|
+
export function devServerRoutingPlugin(context: BuildContext): Plugin {
|
|
28
|
+
const { isWebComponent, destination } = context.package;
|
|
29
|
+
let outDir = '';
|
|
30
|
+
|
|
31
|
+
const sharedDepsDirname = getBundleType({
|
|
32
|
+
...context,
|
|
33
|
+
build: { ...context.build, emitExposedDependencies: true },
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const logRequest = (req: import('http').IncomingMessage) => {
|
|
37
|
+
log.info(`[${log.timestamp}]: ${req.method} ${req.url}`);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
name: 'dev-server-routing',
|
|
42
|
+
|
|
43
|
+
configResolved(config) {
|
|
44
|
+
outDir = config.build.outDir;
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
configureServer(server) {
|
|
48
|
+
const outDirRelative = `/${path.relative(process.cwd(), outDir)}/`;
|
|
49
|
+
|
|
50
|
+
server.middlewares.use((req, _res, next) => {
|
|
51
|
+
logRequest(req);
|
|
52
|
+
const url = req.url ?? '';
|
|
53
|
+
if (isWebComponent) {
|
|
54
|
+
if (url.startsWith(outDirRelative)) {
|
|
55
|
+
req.url = url.slice(outDirRelative.length - 1);
|
|
56
|
+
}
|
|
57
|
+
} else if (url.startsWith(`/${sharedDepsDirname}/`)) {
|
|
58
|
+
req.url = `${outDirRelative}${url.slice(1)}`;
|
|
59
|
+
}
|
|
60
|
+
next();
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
configurePreviewServer(server) {
|
|
65
|
+
server.middlewares.use((req, _res, next) => {
|
|
66
|
+
logRequest(req);
|
|
67
|
+
next();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
if (!isWebComponent) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const destDir = path.resolve(destination);
|
|
75
|
+
const mountPath = '/' + path.relative(process.cwd(), destDir);
|
|
76
|
+
|
|
77
|
+
const contentTypes: Record<string, string> = {
|
|
78
|
+
'.js': 'application/javascript',
|
|
79
|
+
'.css': 'text/css',
|
|
80
|
+
'.json': 'application/json',
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
server.middlewares.use(mountPath, (req, res, next) => {
|
|
84
|
+
const filePath = path.join(destDir, req.url ?? '');
|
|
85
|
+
if (!filePath.startsWith(destDir + path.sep) || !fs.existsSync(filePath)) {
|
|
86
|
+
return next();
|
|
87
|
+
}
|
|
88
|
+
const contentType = contentTypes[path.extname(filePath)];
|
|
89
|
+
if (contentType) {
|
|
90
|
+
res.setHeader('Content-Type', contentType);
|
|
91
|
+
}
|
|
92
|
+
fs.createReadStream(filePath).pipe(res);
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import type { Plugin } from 'vite';
|
|
4
|
+
import { BuildContext, getExternals } from '../../core';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Externalizes shared dependencies by redirecting imports to CJS proxy modules
|
|
8
|
+
* that read from the host's global shared deps registry at runtime.
|
|
9
|
+
*
|
|
10
|
+
* Each shared dep gets a fake package on disk (node_modules/.startup/externals/)
|
|
11
|
+
* with `module.exports = SharedDependencies.Foo['scope']`.
|
|
12
|
+
*
|
|
13
|
+
* Three mechanisms work together, each handling a different mode:
|
|
14
|
+
*
|
|
15
|
+
* - resolve.alias (dev) — exact-match regex redirects `react` to the proxy package.
|
|
16
|
+
* Subpath imports (react/jsx-runtime) are NOT matched and resolve normally.
|
|
17
|
+
*
|
|
18
|
+
* - optimizeDeps.include (dev) — forces Vite to pre-bundle the proxy packages.
|
|
19
|
+
* This triggers Vite's CJS-to-ESM interop: the pre-bundled output has `export default`,
|
|
20
|
+
* and Vite's import-analysis plugin rewrites consumers' named imports to property access
|
|
21
|
+
* on the default export (e.g. `import { useState } from 'react'` becomes
|
|
22
|
+
* `const useState = __default["useState"]`). Without optimizeDeps, the raw CJS proxy
|
|
23
|
+
* would be served to the browser and fail on named imports.
|
|
24
|
+
*
|
|
25
|
+
* - resolveId (prod) — resolve.alias doesn't run during Rolldown bundling, so resolveId
|
|
26
|
+
* with enforce:'pre' intercepts shared dep imports before Vite's default resolver.
|
|
27
|
+
* Rolldown handles CJS-to-ESM interop natively via __commonJSMin/__toESM helpers.
|
|
28
|
+
* Only exact matches — subpath imports must NOT be redirected because they export
|
|
29
|
+
* different things than the barrel.
|
|
30
|
+
*
|
|
31
|
+
* The disk-based proxy + optimizeDeps complexity exists because Vite's dev server serves
|
|
32
|
+
* modules as native ESM without bundling — CJS virtual modules can't be served to the browser.
|
|
33
|
+
* When Vite's "full bundle" dev mode ships (Rolldown bundles in dev, like prod), this can be
|
|
34
|
+
* simplified to a single resolveId + load with a virtual CJS module for both modes (see 9ffd1815).
|
|
35
|
+
*/
|
|
36
|
+
export function externalsPlugin(context: BuildContext): Plugin | undefined {
|
|
37
|
+
const entries = getExternals(context);
|
|
38
|
+
if (!entries) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const proxyModulesDir = path.resolve('node_modules', '.startup', 'externals');
|
|
43
|
+
for (const [dep, proxy] of Object.entries(entries)) {
|
|
44
|
+
const pkgDir = path.join(proxyModulesDir, 'node_modules', dep);
|
|
45
|
+
fs.mkdirSync(pkgDir, { recursive: true });
|
|
46
|
+
fs.writeFileSync(path.join(pkgDir, 'index.cjs'), `module.exports = ${proxy};`);
|
|
47
|
+
fs.writeFileSync(
|
|
48
|
+
path.join(pkgDir, 'package.json'),
|
|
49
|
+
JSON.stringify({ name: dep, main: './index.cjs' })
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const proxyNodeModules = path.join(proxyModulesDir, 'node_modules');
|
|
54
|
+
|
|
55
|
+
const { isProduction } = context.build;
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
name: 'externals',
|
|
59
|
+
enforce: 'pre',
|
|
60
|
+
config: isProduction
|
|
61
|
+
? undefined
|
|
62
|
+
: () => ({
|
|
63
|
+
resolve: {
|
|
64
|
+
alias: Object.keys(entries).map(dep => ({
|
|
65
|
+
find: new RegExp(`^${dep.replace('/', '\\/')}$`),
|
|
66
|
+
replacement: path.join(proxyNodeModules, dep),
|
|
67
|
+
})),
|
|
68
|
+
},
|
|
69
|
+
optimizeDeps: {
|
|
70
|
+
include: Object.keys(entries),
|
|
71
|
+
},
|
|
72
|
+
}),
|
|
73
|
+
resolveId: isProduction
|
|
74
|
+
? (source: string) => {
|
|
75
|
+
if (source in entries) {
|
|
76
|
+
return path.join(proxyNodeModules, source, 'index.cjs');
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
: undefined,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Eta } from 'eta';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import type { Plugin } from 'vite';
|
|
5
|
+
import { getSharedEntryPoints } from '../../core';
|
|
6
|
+
import { ViteBuildContext } from '../types';
|
|
7
|
+
|
|
8
|
+
export function htmlPlugin(context: ViteBuildContext): Plugin {
|
|
9
|
+
const { name, isProduction } = context.build;
|
|
10
|
+
const { isWebComponent } = context.package;
|
|
11
|
+
const { css, js } = getSharedEntryPoints(context);
|
|
12
|
+
const { pluginOverrides } = context.bundlerConfig;
|
|
13
|
+
|
|
14
|
+
const htmlTemplatePath = resolveTemplatePath(context);
|
|
15
|
+
|
|
16
|
+
const eta = new Eta({ views: path.dirname(htmlTemplatePath) });
|
|
17
|
+
|
|
18
|
+
let detectedFavicon: string | undefined;
|
|
19
|
+
|
|
20
|
+
function renderHtml() {
|
|
21
|
+
return eta.render(path.basename(htmlTemplatePath), {
|
|
22
|
+
title: pluginOverrides.html?.title ?? 'ServiceTitan',
|
|
23
|
+
favicon: pluginOverrides.html?.favicon ?? detectedFavicon,
|
|
24
|
+
css,
|
|
25
|
+
js,
|
|
26
|
+
isProduction,
|
|
27
|
+
isWebComponent,
|
|
28
|
+
name,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/*
|
|
33
|
+
* Virtual entry point for the HTML module. The file doesn't exist on disk —
|
|
34
|
+
* resolveId claims this path and load returns Eta-rendered HTML.
|
|
35
|
+
*
|
|
36
|
+
* Uses an absolute path (e.g., /path/to/project/index.html) instead of a
|
|
37
|
+
* synthetic prefix because Vite resolves asset references in HTML (favicon,
|
|
38
|
+
* CSS links) relative to the HTML file's directory. A non-filesystem path
|
|
39
|
+
* would break those references.
|
|
40
|
+
*/
|
|
41
|
+
const INDEX_HTML = 'index.html';
|
|
42
|
+
const VIRTUAL_HTML_PATH = path.resolve(INDEX_HTML);
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
name: 'html',
|
|
46
|
+
/*
|
|
47
|
+
* Auto-detect favicon.ico in vite's publicDir so projects following
|
|
48
|
+
* the convention get a working favicon link without explicit config.
|
|
49
|
+
*/
|
|
50
|
+
configResolved(config) {
|
|
51
|
+
if (config.publicDir && fs.existsSync(path.join(config.publicDir, 'favicon.ico'))) {
|
|
52
|
+
detectedFavicon = '/favicon.ico';
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
/*
|
|
56
|
+
* Dev server serves HTML via middleware (load is not called in dev mode).
|
|
57
|
+
* Returns a callback so middleware registers after Vite's built-in middleware.
|
|
58
|
+
*/
|
|
59
|
+
configureServer(server) {
|
|
60
|
+
return () => {
|
|
61
|
+
server.middlewares.use(async (req, res, next) => {
|
|
62
|
+
if (!req.url?.endsWith(INDEX_HTML)) {
|
|
63
|
+
return next();
|
|
64
|
+
}
|
|
65
|
+
let html = renderHtml();
|
|
66
|
+
html = await server.transformIndexHtml(req.url, html);
|
|
67
|
+
res.end(html);
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
resolveId(source: string, importer: string | undefined) {
|
|
72
|
+
/*
|
|
73
|
+
* Claim the HTML entry so Vite doesn't look for it on disk (it's virtual, rendered by Eta).
|
|
74
|
+
* Only needed for production builds — dev mode serves HTML via configureServer middleware.
|
|
75
|
+
*/
|
|
76
|
+
if (source === VIRTUAL_HTML_PATH) {
|
|
77
|
+
return VIRTUAL_HTML_PATH;
|
|
78
|
+
}
|
|
79
|
+
if (importer?.includes(INDEX_HTML) && source.startsWith('.')) {
|
|
80
|
+
const resolved = path.resolve(source + '.js');
|
|
81
|
+
if (fs.existsSync(resolved)) {
|
|
82
|
+
return resolved;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
load(id: string) {
|
|
87
|
+
if (id === VIRTUAL_HTML_PATH) {
|
|
88
|
+
return renderHtml();
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/*
|
|
95
|
+
* Resolve the HTML template, mirroring webpack HtmlWebpackPlugin's "auto" default:
|
|
96
|
+
* an explicit override wins, then a project template (index.ejs, then index.html)
|
|
97
|
+
* under the package source directory, then the built-in template. Eta renders .ejs
|
|
98
|
+
* and .html identically, so the extension is a convention, not a syntax switch.
|
|
99
|
+
*/
|
|
100
|
+
function resolveTemplatePath(context: ViteBuildContext): string {
|
|
101
|
+
const { template } = context.bundlerConfig.pluginOverrides.html ?? {};
|
|
102
|
+
if (template) {
|
|
103
|
+
return path.resolve(template);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const projectTemplate = ['index.ejs', 'index.html']
|
|
107
|
+
.map(file => path.resolve(context.package.source, file))
|
|
108
|
+
.find(file => fs.existsSync(file));
|
|
109
|
+
|
|
110
|
+
return projectTemplate ?? path.resolve(__dirname, '../index.html');
|
|
111
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
import { BuildContext, checkResource } from '../../core';
|
|
3
|
+
|
|
4
|
+
export const THROW_PREFIX = '\0IGNORE_THROW:';
|
|
5
|
+
export const EMPTY_PREFIX = '\0IGNORE_EMPTY:';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Handles optional peer dependencies that are not installed.
|
|
9
|
+
*
|
|
10
|
+
* @see {@link file://./../../webpack/configs/plugins/ignore-plugin/ignore-plugin.ts} for the webpack counterpart.
|
|
11
|
+
*
|
|
12
|
+
* 'throw' mode: substitutes a virtual module whose body throws "Cannot find module" on
|
|
13
|
+
* evaluation. Mirrors webpack's `webpackMissingModule()` semantics. Top-level static
|
|
14
|
+
* imports of the resource crash module evaluation, and `try { await import(...) } catch {}`
|
|
15
|
+
* (or `try { require(...) } catch {}` in CJS code Rolldown bundles) work as expected.
|
|
16
|
+
* This is the default for matched optional peers.
|
|
17
|
+
*
|
|
18
|
+
* 'empty' mode: substitutes a virtual module with no exports. Required for top-level
|
|
19
|
+
* `import * as X from 'optional'` followed by `X.foo === undefined` detection. Opt in via
|
|
20
|
+
* `cli.peerDependenciesMeta["pkg"].fallback = "empty"` in the importer's package.json.
|
|
21
|
+
*/
|
|
22
|
+
export function ignoreModulesPlugin(context: BuildContext): Plugin {
|
|
23
|
+
const checker = checkResource(context);
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
name: 'ignore-modules',
|
|
27
|
+
enforce: 'pre',
|
|
28
|
+
resolveId(source, importer) {
|
|
29
|
+
if (!importer) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const mode = checker({ resource: source, importer });
|
|
33
|
+
if (mode === 'throw') {
|
|
34
|
+
return `${THROW_PREFIX}${source}`;
|
|
35
|
+
}
|
|
36
|
+
if (mode === 'empty') {
|
|
37
|
+
return `${EMPTY_PREFIX}${source}`;
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
load(id) {
|
|
41
|
+
if (id.startsWith(THROW_PREFIX)) {
|
|
42
|
+
const source = id.slice(THROW_PREFIX.length);
|
|
43
|
+
const message = JSON.stringify(`Cannot find module '${source}'`);
|
|
44
|
+
return `throw Object.assign(new Error(${message}), { code: 'MODULE_NOT_FOUND' });`;
|
|
45
|
+
}
|
|
46
|
+
if (id.startsWith(EMPTY_PREFIX)) {
|
|
47
|
+
return 'export {};';
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from './bundle-stat-plugin';
|
|
2
|
+
export * from './chain-source-maps-plugin';
|
|
3
|
+
export * from './clean-plugin';
|
|
4
|
+
export * from './css-injector-plugin';
|
|
5
|
+
export * from './design-system-guard-plugin';
|
|
6
|
+
export * from './dev-server-routing-plugin';
|
|
7
|
+
export * from './externals-plugin';
|
|
8
|
+
export * from './html-plugin';
|
|
9
|
+
export * from './ignore-modules-plugin';
|
|
10
|
+
export * from './istanbul-plugin';
|
|
11
|
+
export * from './magic-comments-plugin';
|
|
12
|
+
export * from './metadata-plugin';
|
|
13
|
+
export * from './moment-locales-plugin';
|
|
14
|
+
export * from './style-urls-plugin';
|
|
15
|
+
export * from './svgr-plugin';
|
|
16
|
+
export * from './virtual-modules-plugin';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
import { ViteBuildContext } from '../types';
|
|
3
|
+
import { importEsm } from './utils';
|
|
4
|
+
|
|
5
|
+
export function istanbulPlugin(context: ViteBuildContext): Promise<Plugin> | undefined {
|
|
6
|
+
if (!context.options.codeCoverage) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
// vite-plugin-istanbul is ESM-only; load it natively so SWC doesn't rewrite to require.
|
|
11
|
+
return importEsm<typeof import('vite-plugin-istanbul')>('vite-plugin-istanbul').then(
|
|
12
|
+
({ default: istanbul }) =>
|
|
13
|
+
istanbul({
|
|
14
|
+
exclude: ['**/node_modules/**', '**/.yalc/**'],
|
|
15
|
+
requireEnv: false,
|
|
16
|
+
forceBuildInstrument: true,
|
|
17
|
+
})
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { ViteBuildContext } from '../../../types';
|
|
2
|
+
import { magicCommentsPlugin } from '../magic-comments-plugin';
|
|
3
|
+
|
|
4
|
+
describe(`[startup] ${magicCommentsPlugin.name}`, () => {
|
|
5
|
+
const importPath = './feature';
|
|
6
|
+
const resolve = jest.fn();
|
|
7
|
+
const warn = jest.fn();
|
|
8
|
+
let context: ViteBuildContext;
|
|
9
|
+
let code: string;
|
|
10
|
+
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
jest.clearAllMocks();
|
|
13
|
+
resolve.mockImplementation(path => ({ id: path }));
|
|
14
|
+
context = { build: { isProduction: true } } as ViteBuildContext;
|
|
15
|
+
code = `import('${importPath}');`;
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const subject = async () => {
|
|
19
|
+
const plugin = magicCommentsPlugin(context)!;
|
|
20
|
+
const { chunkFileNames } = (plugin.config as Function)().build.rolldownOptions.output;
|
|
21
|
+
// Returns chunk name the plugin produces for module imported by `code`
|
|
22
|
+
await (plugin.transform as { handler: Function }).handler.call({ resolve, warn }, code, '');
|
|
23
|
+
return chunkFileNames({ facadeModuleId: importPath });
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
function itReturnsDefaultChunkName() {
|
|
27
|
+
test('returns the default chunk name', async () => {
|
|
28
|
+
expect(await subject()).toBe('assets/[name]-[hash].js');
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
itReturnsDefaultChunkName();
|
|
33
|
+
|
|
34
|
+
describe('when code contains webpackChunkName comment', () => {
|
|
35
|
+
const webpackChunkName = 'dashboard';
|
|
36
|
+
|
|
37
|
+
beforeEach(
|
|
38
|
+
() =>
|
|
39
|
+
(code = code.replace(
|
|
40
|
+
'import(',
|
|
41
|
+
`import(/* webpackChunkName: '${webpackChunkName}' */`
|
|
42
|
+
))
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
test('renames the chunk', async () => {
|
|
46
|
+
expect(await subject()).toBe(`assets/${webpackChunkName}-[hash].js`);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
describe('when the import cannot be resolved', () => {
|
|
50
|
+
beforeEach(() => resolve.mockReturnValue(null));
|
|
51
|
+
|
|
52
|
+
itReturnsDefaultChunkName();
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
describe('when a chunk name is reused for different modules', () => {
|
|
57
|
+
beforeEach(() => {
|
|
58
|
+
code = [
|
|
59
|
+
"import(/* webpackChunkName: 'shared' */ './a')",
|
|
60
|
+
"import(/* webpackChunkName: 'shared' */ './b')",
|
|
61
|
+
].join(';');
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
test('warns that the modules will not be merged', async () => {
|
|
65
|
+
await subject();
|
|
66
|
+
|
|
67
|
+
expect(warn).toHaveBeenCalledWith(expect.stringMatching(/used by multiple modules/));
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
describe('when the same module is imported twice with one name', () => {
|
|
72
|
+
beforeEach(() => {
|
|
73
|
+
code = [
|
|
74
|
+
`import(/* webpackChunkName: 'dashboard' */ './a')`,
|
|
75
|
+
`import(/* webpackChunkName: 'dashboard' */ './a')`,
|
|
76
|
+
].join(';');
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('does not warn', async () => {
|
|
80
|
+
await subject();
|
|
81
|
+
|
|
82
|
+
expect(warn).not.toHaveBeenCalled();
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
describe('transform filter', () => {
|
|
87
|
+
const subject = () =>
|
|
88
|
+
(magicCommentsPlugin(context) as { transform: { filter: unknown } }).transform.filter;
|
|
89
|
+
|
|
90
|
+
test('excludes node_modules and requires the magic comment', () => {
|
|
91
|
+
expect(subject()).toEqual({
|
|
92
|
+
id: { exclude: /node_modules/ },
|
|
93
|
+
code: 'webpackChunkName',
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
describe('when not a production build', () => {
|
|
99
|
+
beforeEach(() => (context.build.isProduction = false));
|
|
100
|
+
|
|
101
|
+
test('is undefined', () => {
|
|
102
|
+
expect(magicCommentsPlugin(context)).toBeUndefined();
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { parseMagicComments } from '../parse-magic-comments';
|
|
2
|
+
|
|
3
|
+
describe(`[startup] ${parseMagicComments.name}`, () => {
|
|
4
|
+
const cases = [
|
|
5
|
+
// single-quoted comment and import path
|
|
6
|
+
{
|
|
7
|
+
code: "import(/* webpackChunkName: 'feature' */ './module');",
|
|
8
|
+
result: [{ chunkName: 'feature', importPath: './module' }],
|
|
9
|
+
},
|
|
10
|
+
// double-quoted comment and import path
|
|
11
|
+
{
|
|
12
|
+
code: 'import(/* webpackChunkName: "feature" */ "./module");',
|
|
13
|
+
result: [{ chunkName: 'feature', importPath: './module' }],
|
|
14
|
+
},
|
|
15
|
+
// multiple dynamic imports; the unannotated one is dropped
|
|
16
|
+
{
|
|
17
|
+
code: [
|
|
18
|
+
"import(/* webpackChunkName: 'featureA' */ './moduleA')",
|
|
19
|
+
"import(/* webpackChunkName: 'featureB' */ './moduleB')",
|
|
20
|
+
"import('./moduleC')",
|
|
21
|
+
].join(';'),
|
|
22
|
+
result: [
|
|
23
|
+
{ chunkName: 'featureA', importPath: './moduleA' },
|
|
24
|
+
{ chunkName: 'featureB', importPath: './moduleB' },
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
// dynamic import without a magic comment
|
|
28
|
+
{ code: "import('./module');", result: [] },
|
|
29
|
+
// non-string (computed) import path
|
|
30
|
+
{ code: "import(/* webpackChunkName: 'feature' */ modulePath);", result: [] },
|
|
31
|
+
// static import
|
|
32
|
+
{ code: "import /* webpackChunkName: 'feature' */ './module';", result: [] },
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
cases.forEach(({ code, result }) => {
|
|
36
|
+
test(`with ${code} returns ${JSON.stringify(result)}`, async () => {
|
|
37
|
+
await expect(parseMagicComments(code)).resolves.toEqual(result);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './magic-comments-plugin';
|