@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,62 @@
|
|
|
1
|
+
import type { ViteBuildContext } from '../../types';
|
|
2
|
+
import { istanbulPlugin } from '../istanbul-plugin';
|
|
3
|
+
import { importEsm } from '../utils';
|
|
4
|
+
|
|
5
|
+
jest.mock('../utils/import-esm');
|
|
6
|
+
|
|
7
|
+
describe(istanbulPlugin.name, () => {
|
|
8
|
+
const mockIstanbul = jest.fn(() => ({ name: 'vite-plugin-istanbul' }));
|
|
9
|
+
let context: ViteBuildContext;
|
|
10
|
+
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
jest.clearAllMocks();
|
|
13
|
+
jest.mocked(importEsm).mockResolvedValue({ default: mockIstanbul });
|
|
14
|
+
context = { options: {} } as ViteBuildContext;
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const subject = () => istanbulPlugin(context);
|
|
18
|
+
|
|
19
|
+
test('returns undefined', () => {
|
|
20
|
+
expect(subject()).toBeUndefined();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
describe('when code coverage is enabled', () => {
|
|
24
|
+
beforeEach(() => {
|
|
25
|
+
context.options.codeCoverage = true;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test('loads vite-plugin-istanbul', async () => {
|
|
29
|
+
await subject();
|
|
30
|
+
|
|
31
|
+
expect(importEsm).toHaveBeenCalledWith('vite-plugin-istanbul');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('returns the istanbul plugin', async () => {
|
|
35
|
+
expect(await subject()).toEqual({ name: 'vite-plugin-istanbul' });
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('instruments production builds', async () => {
|
|
39
|
+
await subject();
|
|
40
|
+
|
|
41
|
+
expect(mockIstanbul).toHaveBeenCalledWith(
|
|
42
|
+
expect.objectContaining({ forceBuildInstrument: true })
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
test('instruments without requiring an env flag', async () => {
|
|
47
|
+
await subject();
|
|
48
|
+
|
|
49
|
+
expect(mockIstanbul).toHaveBeenCalledWith(
|
|
50
|
+
expect.objectContaining({ requireEnv: false })
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('excludes node_modules and yalc', async () => {
|
|
55
|
+
await subject();
|
|
56
|
+
|
|
57
|
+
expect(mockIstanbul).toHaveBeenCalledWith(
|
|
58
|
+
expect.objectContaining({ exclude: ['**/node_modules/**', '**/.yalc/**'] })
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
});
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { fs, vol } from 'memfs';
|
|
2
|
+
import type { OutputBundle } from 'rolldown';
|
|
3
|
+
import { type BuildContext, generateMetadata } from '../../../core';
|
|
4
|
+
import { metadataPlugin } from '../metadata-plugin';
|
|
5
|
+
|
|
6
|
+
jest.mock('fs', () => fs);
|
|
7
|
+
jest.mock('../../../core', () => ({
|
|
8
|
+
generateMetadata: jest.fn(),
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
describe(metadataPlugin.name, () => {
|
|
12
|
+
let context: BuildContext;
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
jest.clearAllMocks();
|
|
16
|
+
vol.fromJSON({});
|
|
17
|
+
context = {
|
|
18
|
+
package: { isWebComponent: true },
|
|
19
|
+
} as BuildContext;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
afterEach(() => vol.reset());
|
|
23
|
+
|
|
24
|
+
const subject = () => metadataPlugin(context);
|
|
25
|
+
|
|
26
|
+
describe('when package is not a web component', () => {
|
|
27
|
+
beforeEach(() => (context.package.isWebComponent = false));
|
|
28
|
+
|
|
29
|
+
test('returns undefined', () => {
|
|
30
|
+
expect(subject()).toBeUndefined();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('returns plugin with correct name', () => {
|
|
35
|
+
expect(subject()!.name).toBe('metadata');
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const defaultAddress = { port: 3000 };
|
|
39
|
+
|
|
40
|
+
const setupServer = ({
|
|
41
|
+
outDir,
|
|
42
|
+
address = () => defaultAddress,
|
|
43
|
+
}: {
|
|
44
|
+
outDir: string;
|
|
45
|
+
address?: () => unknown;
|
|
46
|
+
}) => {
|
|
47
|
+
const plugin = subject()!;
|
|
48
|
+
(plugin.configResolved as Function).call(plugin, {
|
|
49
|
+
build: { outDir },
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
let listener!: Function;
|
|
53
|
+
const server: any = {
|
|
54
|
+
httpServer: {
|
|
55
|
+
once: (_event: string, cb: Function) => (listener = cb),
|
|
56
|
+
address,
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
(plugin.configureServer as Function).call(plugin, server);
|
|
60
|
+
listener();
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
describe('configResolved', () => {
|
|
64
|
+
const outDir = '/custom-output';
|
|
65
|
+
|
|
66
|
+
beforeEach(() => setupServer({ outDir }));
|
|
67
|
+
|
|
68
|
+
test('captures outDir for use by configureServer', () => {
|
|
69
|
+
expect(fs.existsSync(`${outDir}/entrypoints.json`)).toBe(true);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
describe('configureServer', () => {
|
|
74
|
+
const outDir = '/output';
|
|
75
|
+
|
|
76
|
+
test('writes entrypoints.json', () => {
|
|
77
|
+
setupServer({ outDir });
|
|
78
|
+
|
|
79
|
+
const written = JSON.parse(
|
|
80
|
+
fs.readFileSync(`${outDir}/entrypoints.json`, 'utf8') as string
|
|
81
|
+
);
|
|
82
|
+
expect(written).toEqual({
|
|
83
|
+
module: true,
|
|
84
|
+
port: defaultAddress.port,
|
|
85
|
+
css: [],
|
|
86
|
+
js: ['@vite/client', '@id/__x00__VIRTUAL./index'],
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
test('calls generateMetadata', () => {
|
|
91
|
+
setupServer({ outDir });
|
|
92
|
+
|
|
93
|
+
expect(generateMetadata).toHaveBeenCalledWith(context);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
describe('when address is a string', () => {
|
|
97
|
+
beforeEach(() => setupServer({ outDir, address: () => 'pipe-path' }));
|
|
98
|
+
|
|
99
|
+
test('does not write entrypoints', () => {
|
|
100
|
+
expect(fs.existsSync(`${outDir}/entrypoints.json`)).toBe(false);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test('does not generate metadata', () => {
|
|
104
|
+
expect(generateMetadata).not.toHaveBeenCalled();
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
describe('writeBundle', () => {
|
|
110
|
+
const bundle = {
|
|
111
|
+
'main.js': { type: 'chunk', isEntry: true, fileName: 'assets/main.js' },
|
|
112
|
+
'vendor.js': { type: 'chunk', isEntry: false, fileName: 'assets/vendor.js' },
|
|
113
|
+
'style.css': { type: 'asset', fileName: 'assets/style.css' },
|
|
114
|
+
} as unknown as OutputBundle;
|
|
115
|
+
|
|
116
|
+
let options: { dir?: string };
|
|
117
|
+
|
|
118
|
+
beforeEach(() => {
|
|
119
|
+
options = { dir: '/build' };
|
|
120
|
+
fs.mkdirSync(options.dir!, { recursive: true });
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const subject = () => {
|
|
124
|
+
const plugin = metadataPlugin(context)!;
|
|
125
|
+
return (plugin.writeBundle as Function).call(plugin, options, bundle);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
test('writes entrypoints.json with entry JS and CSS files', () => {
|
|
129
|
+
subject();
|
|
130
|
+
|
|
131
|
+
const entries = Object.values(bundle);
|
|
132
|
+
const expectedJs = entries
|
|
133
|
+
.filter(e => e.type === 'chunk' && e.isEntry)
|
|
134
|
+
.map(e => e.fileName);
|
|
135
|
+
const expectedCss = entries
|
|
136
|
+
.filter(e => e.type === 'asset' && e.fileName.endsWith('.css'))
|
|
137
|
+
.map(e => e.fileName);
|
|
138
|
+
|
|
139
|
+
const written = JSON.parse(
|
|
140
|
+
fs.readFileSync(`${options.dir}/entrypoints.json`, 'utf8') as string
|
|
141
|
+
);
|
|
142
|
+
expect(written).toEqual({
|
|
143
|
+
module: true,
|
|
144
|
+
css: expectedCss,
|
|
145
|
+
js: expectedJs,
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
test('calls generateMetadata', () => {
|
|
150
|
+
subject();
|
|
151
|
+
|
|
152
|
+
expect(generateMetadata).toHaveBeenCalledWith(context);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
describe('when options.dir is not set', () => {
|
|
156
|
+
beforeEach(() => (options.dir = undefined));
|
|
157
|
+
|
|
158
|
+
test('throws error', () => {
|
|
159
|
+
expect(() => subject()).toThrow('web-component build requires output.dir');
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
});
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { BuildContext } from '../../../core';
|
|
2
|
+
import { VIRTUAL_MOMENT, momentLocalesPlugin } from '../moment-locales-plugin';
|
|
3
|
+
|
|
4
|
+
const LOCALES_TO_KEEP = ['en-au', 'en-ca', 'en-gb'];
|
|
5
|
+
const context = {} as BuildContext;
|
|
6
|
+
|
|
7
|
+
describe(momentLocalesPlugin.name, () => {
|
|
8
|
+
const subject = () => momentLocalesPlugin(context);
|
|
9
|
+
|
|
10
|
+
test('creates plugin with correct name', () => {
|
|
11
|
+
expect(subject().name).toBe('moment-locales');
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
test('enforces pre order so it runs before built-in resolvers', () => {
|
|
15
|
+
expect(subject().enforce).toBe('pre');
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
describe('resolveId', () => {
|
|
19
|
+
const importer = 'importer.ts';
|
|
20
|
+
let source: string;
|
|
21
|
+
let resolve: jest.Mock;
|
|
22
|
+
|
|
23
|
+
beforeEach(() => {
|
|
24
|
+
source = 'react';
|
|
25
|
+
resolve = jest.fn(() => `resolved: ${source}`);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const subject = () => {
|
|
29
|
+
const plugin = momentLocalesPlugin(context);
|
|
30
|
+
return (plugin.resolveId as Function).call({ resolve }, source, importer, {});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const itReturnsUndefined = () => {
|
|
34
|
+
test('returns undefined', () => {
|
|
35
|
+
expect(subject()).toBeUndefined();
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
itReturnsUndefined();
|
|
40
|
+
|
|
41
|
+
describe('when source is "moment"', () => {
|
|
42
|
+
beforeEach(() => (source = 'moment'));
|
|
43
|
+
|
|
44
|
+
test('returns the virtual module', () => {
|
|
45
|
+
expect(subject()).toBe(VIRTUAL_MOMENT);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
describe('when source is a UMD moment path', () => {
|
|
50
|
+
beforeEach(() => (source = 'moment/locale/fr'));
|
|
51
|
+
|
|
52
|
+
test('resolves the ESM moment path', async () => {
|
|
53
|
+
await subject();
|
|
54
|
+
|
|
55
|
+
expect(resolve).toHaveBeenCalledWith(
|
|
56
|
+
source.replace('/locale/', '/dist/locale/'),
|
|
57
|
+
importer,
|
|
58
|
+
{}
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test('returns the resolved ESM moment path', async () => {
|
|
63
|
+
expect(await subject()).toEqual(resolve(source));
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
describe('when source is already an ESM moment path', () => {
|
|
68
|
+
beforeEach(() => (source = 'moment/dist/locale/fr'));
|
|
69
|
+
|
|
70
|
+
itReturnsUndefined();
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe('load', () => {
|
|
75
|
+
let id: string;
|
|
76
|
+
|
|
77
|
+
beforeEach(() => (id = 'react'));
|
|
78
|
+
|
|
79
|
+
const subject = () => {
|
|
80
|
+
const plugin = momentLocalesPlugin(context);
|
|
81
|
+
return (plugin.load as Function).call(plugin, id) as string | undefined;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
test('returns undefined', () => {
|
|
85
|
+
expect(subject()).toBeUndefined();
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
describe('when id is the virtual module', () => {
|
|
89
|
+
beforeEach(() => (id = VIRTUAL_MOMENT));
|
|
90
|
+
|
|
91
|
+
test.each(LOCALES_TO_KEEP)('imports the ESM %s locale', locale => {
|
|
92
|
+
expect(subject()).toContain(`import 'moment/dist/locale/${locale}';`);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test('imports moment from the ESM build', () => {
|
|
96
|
+
expect(subject()).toContain("import moment from 'moment/dist/moment.js';");
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
test('re-exports moment as the default', () => {
|
|
100
|
+
expect(subject()).toContain('export default moment;');
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { BuildContext } from '../../../core';
|
|
2
|
+
import { styleUrlsPlugin } from '../style-urls-plugin';
|
|
3
|
+
|
|
4
|
+
describe(styleUrlsPlugin.name, () => {
|
|
5
|
+
const name = 'test-mfe';
|
|
6
|
+
let context: BuildContext;
|
|
7
|
+
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
context = {
|
|
10
|
+
build: { name, isProduction: true },
|
|
11
|
+
package: { isWebComponent: true },
|
|
12
|
+
} as BuildContext;
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const subject = () => styleUrlsPlugin(context);
|
|
16
|
+
|
|
17
|
+
const itReturnsUndefined = () => {
|
|
18
|
+
test('returns undefined', () => {
|
|
19
|
+
expect(subject()).toBeUndefined();
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
test('returns plugin with correct name', () => {
|
|
24
|
+
expect(subject()!.name).toBe('style-urls');
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe('when package is not a web component', () => {
|
|
28
|
+
beforeEach(() => (context.package.isWebComponent = false));
|
|
29
|
+
|
|
30
|
+
itReturnsUndefined();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe('when build is not production', () => {
|
|
34
|
+
beforeEach(() => (context.build.isProduction = false));
|
|
35
|
+
|
|
36
|
+
itReturnsUndefined();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
describe('transformIndexHtml', () => {
|
|
40
|
+
const styleUrlsHtml = (urls: string[]) =>
|
|
41
|
+
`<${name} style-urls="${encodeURIComponent(JSON.stringify(urls))}" />`;
|
|
42
|
+
|
|
43
|
+
let bundle: Record<string, { type: string; fileName: string }>;
|
|
44
|
+
|
|
45
|
+
beforeEach(() => {
|
|
46
|
+
bundle = {};
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const subject = () => {
|
|
50
|
+
const plugin = styleUrlsPlugin(context)!;
|
|
51
|
+
const transform = (plugin.transformIndexHtml as any).handler;
|
|
52
|
+
return transform(`<${name} />`, { bundle });
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
test('adds empty style-urls when no CSS assets', () => {
|
|
56
|
+
expect(subject()).toBe(styleUrlsHtml([]));
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
describe('when bundle has CSS and non-CSS assets', () => {
|
|
60
|
+
beforeEach(() => {
|
|
61
|
+
bundle = {
|
|
62
|
+
'style.css': { type: 'asset', fileName: 'assets/style-abc123.css' },
|
|
63
|
+
'main.js': { type: 'chunk', fileName: 'assets/main-def456.js' },
|
|
64
|
+
'other.css': { type: 'asset', fileName: 'assets/other-789.css' },
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('adds style-urls with CSS file names', () => {
|
|
69
|
+
const cssFileNames = Object.values(bundle)
|
|
70
|
+
.filter(b => b.type === 'asset' && b.fileName.endsWith('.css'))
|
|
71
|
+
.map(b => b.fileName);
|
|
72
|
+
|
|
73
|
+
expect(subject()).toBe(styleUrlsHtml(cssFileNames));
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import svgr from 'vite-plugin-svgr';
|
|
2
|
+
import type { ViteBuildContext } from '../../types';
|
|
3
|
+
import { svgrPlugin } from '../svgr-plugin';
|
|
4
|
+
|
|
5
|
+
jest.mock('vite-plugin-svgr', () => jest.fn(() => ({ name: 'vite-plugin-svgr' })));
|
|
6
|
+
|
|
7
|
+
describe(svgrPlugin.name, () => {
|
|
8
|
+
let context: ViteBuildContext;
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
context = {
|
|
12
|
+
bundlerConfig: { pluginOverrides: {} },
|
|
13
|
+
} as ViteBuildContext;
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const subject = () => svgrPlugin(context);
|
|
17
|
+
|
|
18
|
+
test('calls svgr with default include patterns', () => {
|
|
19
|
+
subject();
|
|
20
|
+
|
|
21
|
+
expect(svgr).toHaveBeenCalledWith({
|
|
22
|
+
include: ['**/*.svg?component', '**/@servicetitan/anvil2/**/*.svg'],
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
describe('when include is overridden', () => {
|
|
27
|
+
const include = ['**/*.svg'];
|
|
28
|
+
|
|
29
|
+
beforeEach(() => {
|
|
30
|
+
context.bundlerConfig.pluginOverrides.svgr = { include };
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test('passes include to svgr', () => {
|
|
34
|
+
subject();
|
|
35
|
+
|
|
36
|
+
expect(svgr).toHaveBeenCalledWith(expect.objectContaining({ include }));
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe('when exclude is overridden', () => {
|
|
41
|
+
const exclude = ['**/icons/**'];
|
|
42
|
+
|
|
43
|
+
beforeEach(() => {
|
|
44
|
+
context.bundlerConfig.pluginOverrides.svgr = { exclude };
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('passes exclude to svgr', () => {
|
|
48
|
+
subject();
|
|
49
|
+
|
|
50
|
+
expect(svgr).toHaveBeenCalledWith(expect.objectContaining({ exclude }));
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
describe('when svgrOptions is overridden', () => {
|
|
55
|
+
const svgrOptions = { icon: true };
|
|
56
|
+
|
|
57
|
+
beforeEach(() => {
|
|
58
|
+
context.bundlerConfig.pluginOverrides.svgr = { svgrOptions };
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('passes svgrOptions to svgr', () => {
|
|
62
|
+
subject();
|
|
63
|
+
|
|
64
|
+
expect(svgr).toHaveBeenCalledWith(expect.objectContaining({ svgrOptions }));
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
});
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import { virtualModules } from '../../../core';
|
|
3
|
+
import { virtualModulesPlugin } from '../virtual-modules-plugin';
|
|
4
|
+
|
|
5
|
+
jest.mock('../../../core', () => ({
|
|
6
|
+
virtualModules: jest.fn(),
|
|
7
|
+
}));
|
|
8
|
+
|
|
9
|
+
describe(virtualModulesPlugin.name, () => {
|
|
10
|
+
const VIRTUAL_PREFIX = '\0VIRTUAL';
|
|
11
|
+
const indexCode = "import App from './app';\nregister(App, 'my-component');";
|
|
12
|
+
const designSystemCss = '@import "design-system";';
|
|
13
|
+
|
|
14
|
+
let context: any;
|
|
15
|
+
let modules: { index?: string; designSystem?: string };
|
|
16
|
+
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
context = {
|
|
19
|
+
build: { isProduction: true },
|
|
20
|
+
package: { destination: '/dist', isWebComponent: false },
|
|
21
|
+
};
|
|
22
|
+
modules = {};
|
|
23
|
+
jest.mocked(virtualModules).mockReturnValue(modules);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const subject = () => virtualModulesPlugin(context);
|
|
27
|
+
|
|
28
|
+
test('returns undefined when no virtual modules exist', () => {
|
|
29
|
+
expect(subject()).toBeUndefined();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
describe('when index module exists', () => {
|
|
33
|
+
beforeEach(() => (modules.index = indexCode));
|
|
34
|
+
|
|
35
|
+
test('returns plugin with correct name', () => {
|
|
36
|
+
expect(subject()!.name).toBe('virtual-modules');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
describe('resolveId', () => {
|
|
40
|
+
const subject = () => {
|
|
41
|
+
const plugin = virtualModulesPlugin(context)!;
|
|
42
|
+
return (source: string, importer?: string) =>
|
|
43
|
+
(plugin.resolveId as Function).call(plugin, source, importer);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
test('resolves known module to virtual id', () => {
|
|
47
|
+
expect(subject()('./index')).toBe(`${VIRTUAL_PREFIX}./index`);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test('returns undefined for unknown module', () => {
|
|
51
|
+
expect(subject()('./unknown')).toBeUndefined();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('resolves relative import from virtual module to destination', () => {
|
|
55
|
+
const result = subject()('./app', `${VIRTUAL_PREFIX}./index`);
|
|
56
|
+
|
|
57
|
+
expect(result).toBe(path.resolve('/dist', './app.js'));
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test('returns undefined for relative import from non-virtual module', () => {
|
|
61
|
+
expect(subject()('./app', '/src/index.ts')).toBeUndefined();
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
describe('load', () => {
|
|
66
|
+
const subject = () => {
|
|
67
|
+
const plugin = virtualModulesPlugin(context)!;
|
|
68
|
+
return (id: string) => (plugin.load as Function).call(plugin, id);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
test('returns module code for virtual id', () => {
|
|
72
|
+
expect(subject()(`${VIRTUAL_PREFIX}./index`)).toBe(indexCode);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('returns undefined for non-virtual id', () => {
|
|
76
|
+
expect(subject()('./index')).toBeUndefined();
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
describe('when design system module exists', () => {
|
|
82
|
+
beforeEach(() => (modules.designSystem = designSystemCss));
|
|
83
|
+
|
|
84
|
+
test('resolves design-system.css to virtual id', () => {
|
|
85
|
+
const plugin = subject()!;
|
|
86
|
+
const result = (plugin.resolveId as Function).call(plugin, './design-system.css');
|
|
87
|
+
|
|
88
|
+
expect(result).toBe(`${VIRTUAL_PREFIX}./design-system.css`);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
test('loads design system code', () => {
|
|
92
|
+
const plugin = subject()!;
|
|
93
|
+
const result = (plugin.load as Function).call(
|
|
94
|
+
plugin,
|
|
95
|
+
`${VIRTUAL_PREFIX}./design-system.css`
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
expect(result).toBe(designSystemCss);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import os from 'os';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import type { Plugin } from 'vite';
|
|
4
|
+
import { analyzer, unstableRolldownAdapter } from 'vite-bundle-analyzer';
|
|
5
|
+
import { bundleReportFileName, bundleReportTitle } from '../../core';
|
|
6
|
+
import { ViteBuildContext } from '../types';
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Writes a static bundle-size treemap to the temp directory when --stat is passed, parity with the webpack build.
|
|
10
|
+
*/
|
|
11
|
+
export function bundleStatPlugin(context: ViteBuildContext): Plugin | undefined {
|
|
12
|
+
if (!context.options.buildStat) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return unstableRolldownAdapter(
|
|
17
|
+
analyzer({
|
|
18
|
+
analyzerMode: 'static',
|
|
19
|
+
fileName: () => path.join(os.tmpdir(), bundleReportFileName(context)),
|
|
20
|
+
reportTitle: bundleReportTitle(context),
|
|
21
|
+
openAnalyzer: true,
|
|
22
|
+
})
|
|
23
|
+
) as Plugin;
|
|
24
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import type { Plugin } from 'rolldown';
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Return each compiled `.js` file's external `.js.map` (emitted by SWC) from the
|
|
7
|
+
* load hook so Rolldown chains it, making source maps resolve to the original
|
|
8
|
+
* `.ts` instead of stopping at the compiled `.js`.
|
|
9
|
+
*/
|
|
10
|
+
export function chainSourceMapsPlugin(): Plugin {
|
|
11
|
+
return {
|
|
12
|
+
name: 'chain-source-maps',
|
|
13
|
+
load(id) {
|
|
14
|
+
const mapPath = `${id}.map`;
|
|
15
|
+
if (id.endsWith('.js') && fs.existsSync(mapPath)) {
|
|
16
|
+
const map = JSON.parse(fs.readFileSync(mapPath, 'utf8'));
|
|
17
|
+
const dir = path.dirname(mapPath);
|
|
18
|
+
// Absolute paths let Rolldown resolve the sources; source maps require `/` separators.
|
|
19
|
+
map.sources = map.sources.map((source: string) =>
|
|
20
|
+
path.resolve(dir, source).replace(/\\/g, '/')
|
|
21
|
+
);
|
|
22
|
+
return { code: fs.readFileSync(id, 'utf8'), map };
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import type { Plugin } from 'vite';
|
|
4
|
+
import { BuildContext, getBundleType } from '../../core';
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* Removes stale artifacts from the output directory. MFE builds use Vite's `emptyOutDir`.
|
|
8
|
+
* Host builds can't, since their outDir holds the shared dependencies subdir, so
|
|
9
|
+
* `buildStart` empties it while keeping shared dependencies.
|
|
10
|
+
*/
|
|
11
|
+
export function cleanPlugin(context: BuildContext): Plugin {
|
|
12
|
+
const { isWebComponent } = context.package;
|
|
13
|
+
let outDir = '';
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
name: 'clean',
|
|
17
|
+
apply: 'build',
|
|
18
|
+
config: () => ({ build: { emptyOutDir: isWebComponent } }),
|
|
19
|
+
configResolved(config) {
|
|
20
|
+
outDir = config.build.outDir;
|
|
21
|
+
},
|
|
22
|
+
buildStart() {
|
|
23
|
+
if (isWebComponent || !fs.existsSync(outDir)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const keep = getKeepDir(context);
|
|
27
|
+
for (const entry of fs.readdirSync(outDir)) {
|
|
28
|
+
if (entry === keep) {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
fs.rmSync(path.join(outDir, entry), { recursive: true, force: true });
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* The shared deps subdirectory to preserve, or undefined to clean everything. */
|
|
38
|
+
function getKeepDir(context: BuildContext): string | undefined {
|
|
39
|
+
if (context.build.emitExposedDependencies) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
return getBundleType({
|
|
43
|
+
...context,
|
|
44
|
+
build: { ...context.build, emitExposedDependencies: true },
|
|
45
|
+
});
|
|
46
|
+
}
|