@servicetitan/startup 34.2.0 → 34.3.0-beta.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/dist/cli/commands/build.d.ts +16 -0
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +15 -2
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/bundle-vite.d.ts +66 -0
- package/dist/cli/commands/bundle-vite.d.ts.map +1 -0
- package/dist/cli/commands/bundle-vite.js +184 -0
- package/dist/cli/commands/bundle-vite.js.map +1 -0
- package/dist/cli/commands/get-command.d.ts.map +1 -1
- package/dist/cli/commands/get-command.js +2 -0
- package/dist/cli/commands/get-command.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-package-publish.js.map +1 -1
- package/dist/cli/commands/start.d.ts +8 -0
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +8 -2
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/tasks/swc-compile-package.js +127 -0
- package/dist/cli/tasks/swc-compile-package.js.map +1 -0
- package/dist/cli/tasks/tsc-compile-package.js +46 -0
- package/dist/cli/tasks/tsc-compile-package.js.map +1 -0
- package/dist/cli/tasks/tsc-compile.js +68 -0
- package/dist/cli/tasks/tsc-compile.js.map +1 -0
- package/dist/cli/utils/bundle.d.ts +2 -5
- package/dist/cli/utils/bundle.d.ts.map +1 -1
- package/dist/cli/utils/bundle.js +18 -98
- package/dist/cli/utils/bundle.js.map +1 -1
- package/dist/core/check-resource/check-resource.d.ts +3 -0
- package/dist/core/check-resource/check-resource.d.ts.map +1 -0
- package/dist/core/check-resource/check-resource.js +40 -0
- package/dist/core/check-resource/check-resource.js.map +1 -0
- package/dist/core/check-resource/get-package-json.d.ts.map +1 -0
- package/dist/core/check-resource/get-package-json.js +37 -0
- package/dist/core/check-resource/get-package-json.js.map +1 -0
- package/dist/core/check-resource/index.d.ts +2 -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-optional-peer-dependency.d.ts.map +1 -0
- package/dist/core/check-resource/is-optional-peer-dependency.js +27 -0
- package/dist/core/check-resource/is-optional-peer-dependency.js.map +1 -0
- package/dist/core/check-resource/is-optional-react-dom-peer-dependency.d.ts.map +1 -0
- package/dist/core/check-resource/is-optional-react-dom-peer-dependency.js +15 -0
- package/dist/core/check-resource/is-optional-react-dom-peer-dependency.js.map +1 -0
- package/dist/core/context.d.ts +14 -0
- package/dist/core/context.d.ts.map +1 -0
- package/dist/core/context.js +62 -0
- package/dist/core/context.js.map +1 -0
- package/dist/core/defines/exposed-dependencies.d.ts +5 -0
- package/dist/core/defines/exposed-dependencies.d.ts.map +1 -0
- package/dist/core/defines/exposed-dependencies.js +26 -0
- package/dist/core/defines/exposed-dependencies.js.map +1 -0
- package/dist/core/defines/exposed-instance-dependencies.d.ts +5 -0
- package/dist/core/defines/exposed-instance-dependencies.d.ts.map +1 -0
- package/dist/core/defines/exposed-instance-dependencies.js +29 -0
- package/dist/core/defines/exposed-instance-dependencies.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/defines/web-component-name.d.ts +5 -0
- package/dist/core/defines/web-component-name.d.ts.map +1 -0
- package/dist/core/defines/web-component-name.js +23 -0
- package/dist/core/defines/web-component-name.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 +29 -0
- package/dist/core/externals.js.map +1 -0
- package/dist/core/get-exposed-dependencies-entry-points.d.ts +11 -0
- package/dist/core/get-exposed-dependencies-entry-points.d.ts.map +1 -0
- package/dist/core/get-exposed-dependencies-entry-points.js +82 -0
- package/dist/core/get-exposed-dependencies-entry-points.js.map +1 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +26 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/types.d.ts +55 -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/utils/build-metadata.d.ts.map +1 -0
- package/dist/core/utils/build-metadata.js +50 -0
- package/dist/core/utils/build-metadata.js.map +1 -0
- package/dist/core/utils/generate-metadata.d.ts +3 -0
- package/dist/core/utils/generate-metadata.d.ts.map +1 -0
- package/dist/core/utils/generate-metadata.js +40 -0
- package/dist/core/utils/generate-metadata.js.map +1 -0
- package/dist/core/utils/get-bundle-type.d.ts +3 -0
- package/dist/core/utils/get-bundle-type.d.ts.map +1 -0
- package/dist/core/utils/get-bundle-type.js +27 -0
- package/dist/core/utils/get-bundle-type.js.map +1 -0
- package/dist/core/utils/get-exposed-dependencies.d.ts.map +1 -0
- package/dist/core/utils/get-exposed-dependencies.js +21 -0
- package/dist/core/utils/get-exposed-dependencies.js.map +1 -0
- package/dist/core/utils/get-launchdarkly-sdk-version.d.ts.map +1 -0
- package/dist/core/utils/get-launchdarkly-sdk-version.js +26 -0
- package/dist/core/utils/get-launchdarkly-sdk-version.js.map +1 -0
- package/dist/core/utils/get-output-path.d.ts +3 -0
- package/dist/core/utils/get-output-path.d.ts.map +1 -0
- package/dist/core/utils/get-output-path.js +32 -0
- package/dist/core/utils/get-output-path.js.map +1 -0
- package/dist/core/utils/get-web-components-version.d.ts.map +1 -0
- package/dist/core/utils/get-web-components-version.js +22 -0
- package/dist/core/utils/get-web-components-version.js.map +1 -0
- package/dist/core/utils/index.d.ts +9 -0
- package/dist/core/utils/index.d.ts.map +1 -0
- package/dist/core/utils/index.js +27 -0
- package/dist/core/utils/index.js.map +1 -0
- package/dist/core/utils/stringify-config.d.ts +2 -0
- package/dist/core/utils/stringify-config.d.ts.map +1 -0
- package/dist/core/utils/stringify-config.js +35 -0
- package/dist/core/utils/stringify-config.js.map +1 -0
- package/dist/core/virtual-modules.d.ts +9 -0
- package/dist/core/virtual-modules.d.ts.map +1 -0
- package/dist/core/virtual-modules.js +84 -0
- package/dist/core/virtual-modules.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- 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 -6
- package/dist/storybook-config/webpack-final.js.map +1 -1
- package/dist/utils/get-configuration.d.ts +28 -0
- package/dist/utils/get-configuration.d.ts.map +1 -1
- package/dist/utils/get-configuration.js +42 -1
- 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/vite/base-config.d.ts +4 -0
- package/dist/vite/base-config.d.ts.map +1 -0
- package/dist/vite/base-config.js +65 -0
- package/dist/vite/base-config.js.map +1 -0
- package/dist/vite/build-shared-deps.d.ts +3 -0
- package/dist/vite/build-shared-deps.d.ts.map +1 -0
- package/dist/vite/build-shared-deps.js +310 -0
- package/dist/vite/build-shared-deps.js.map +1 -0
- package/dist/vite/create-vite-config.d.ts +3 -0
- package/dist/vite/create-vite-config.d.ts.map +1 -0
- package/dist/vite/create-vite-config.js +52 -0
- package/dist/vite/create-vite-config.js.map +1 -0
- package/dist/vite/define-config.d.ts +12 -0
- package/dist/vite/define-config.d.ts.map +1 -0
- package/dist/vite/define-config.js +15 -0
- package/dist/vite/define-config.js.map +1 -0
- package/dist/vite/load-config-file.d.ts +6 -0
- package/dist/vite/load-config-file.d.ts.map +1 -0
- package/dist/vite/load-config-file.js +107 -0
- package/dist/vite/load-config-file.js.map +1 -0
- package/dist/vite/merge-config.d.ts +6 -0
- package/dist/vite/merge-config.d.ts.map +1 -0
- package/dist/vite/merge-config.js +106 -0
- package/dist/vite/merge-config.js.map +1 -0
- package/dist/vite/plugins/css-injector-plugin.d.ts +15 -0
- package/dist/vite/plugins/css-injector-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/css-injector-plugin.js +76 -0
- package/dist/vite/plugins/css-injector-plugin.js.map +1 -0
- package/dist/vite/plugins/dev-bundle-routing-plugin.d.ts +7 -0
- package/dist/vite/plugins/dev-bundle-routing-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/dev-bundle-routing-plugin.js +48 -0
- package/dist/vite/plugins/dev-bundle-routing-plugin.js.map +1 -0
- package/dist/vite/plugins/dev-server-routing-plugin.d.ts +12 -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 +39 -0
- package/dist/vite/plugins/externals-plugin.js.map +1 -0
- package/dist/vite/plugins/full-bundle-proxy-plugin.d.ts +14 -0
- package/dist/vite/plugins/full-bundle-proxy-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/full-bundle-proxy-plugin.js +48 -0
- package/dist/vite/plugins/full-bundle-proxy-plugin.js.map +1 -0
- package/dist/vite/plugins/html-plugin.d.ts +5 -0
- package/dist/vite/plugins/html-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/html-plugin.js +74 -0
- package/dist/vite/plugins/html-plugin.js.map +1 -0
- package/dist/vite/plugins/ignore-modules-plugin.d.ts +4 -0
- package/dist/vite/plugins/ignore-modules-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/ignore-modules-plugin.js +30 -0
- package/dist/vite/plugins/ignore-modules-plugin.js.map +1 -0
- package/dist/vite/plugins/index.d.ts +10 -0
- package/dist/vite/plugins/index.d.ts.map +1 -0
- package/dist/vite/plugins/index.js +28 -0
- package/dist/vite/plugins/index.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 +86 -0
- package/dist/vite/plugins/metadata-plugin.js.map +1 -0
- package/dist/vite/plugins/outdir-rewrite-plugin.d.ts +9 -0
- package/dist/vite/plugins/outdir-rewrite-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/preview-static-files-plugin.d.ts +9 -0
- package/dist/vite/plugins/preview-static-files-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/preview-static-files-plugin.js +50 -0
- package/dist/vite/plugins/preview-static-files-plugin.js.map +1 -0
- package/dist/vite/plugins/shared-deps-dev-server-plugin.d.ts +11 -0
- package/dist/vite/plugins/shared-deps-dev-server-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/shared-deps-rewrite-plugin.d.ts +10 -0
- package/dist/vite/plugins/shared-deps-rewrite-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/shared-deps-rewrite-plugin.js +51 -0
- package/dist/vite/plugins/shared-deps-rewrite-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 +29 -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 +31 -0
- package/dist/vite/plugins/svgr-plugin.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 +71 -0
- package/dist/vite/plugins/virtual-modules-plugin.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 +1 -1
- package/dist/webpack/configs/cache-config.js.map +1 -1
- package/dist/webpack/configs/dev-server-config.d.ts +3 -2
- package/dist/webpack/configs/dev-server-config.d.ts.map +1 -1
- package/dist/webpack/configs/dev-server-config.js +1 -1
- 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 +2 -2
- package/dist/webpack/configs/loaders/css-loader.d.ts.map +1 -1
- package/dist/webpack/configs/loaders/css-loader.js +2 -1
- 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 +4 -1
- package/dist/webpack/configs/loaders/style-loader.js.map +1 -1
- package/dist/webpack/configs/module-config.d.ts +3 -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 +3 -2
- package/dist/webpack/configs/optimization-config.d.ts.map +1 -1
- package/dist/webpack/configs/optimization-config.js +10 -7
- 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 +15 -24
- 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 +10 -47
- 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 +6 -6
- 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 -13
- 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-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 +5 -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 +8 -19
- package/dist/webpack/configs/plugins/html-tags-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.js +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts +17 -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 +45 -6
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.d.ts +3 -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.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.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.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.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.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 +3 -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 +3 -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 +10 -0
- package/dist/webpack/create-webpack-config.d.ts.map +1 -1
- package/dist/webpack/create-webpack-config.js +109 -41
- package/dist/webpack/create-webpack-config.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/index.d.ts +0 -1
- package/dist/webpack/utils/index.d.ts.map +1 -1
- package/dist/webpack/utils/index.js +0 -1
- package/dist/webpack/utils/index.js.map +1 -1
- package/package.json +13 -10
- package/patches/vite-plugin-css-injected-by-js+3.5.2.patch +63 -0
- package/src/cli/commands/__tests__/mfe-generate-metadata.test.ts +3 -4
- package/src/cli/commands/build.ts +7 -2
- package/src/cli/commands/bundle-vite.ts +112 -0
- package/src/cli/commands/get-command.ts +2 -0
- package/src/cli/commands/mfe-check.ts +1 -2
- package/src/cli/commands/mfe-generate-metadata.ts +1 -1
- package/src/cli/commands/mfe-package-publish.ts +1 -1
- package/src/cli/commands/start.ts +5 -2
- package/src/cli/utils/__tests__/bundle.test.ts +20 -11
- package/src/cli/utils/bundle.ts +20 -101
- package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/__tests__/check-resource.test.ts +18 -5
- package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/check-resource.ts +4 -4
- package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/get-package-json.ts +2 -2
- package/src/core/check-resource/index.ts +1 -0
- package/src/core/context.ts +65 -0
- package/src/core/defines/exposed-dependencies.ts +21 -0
- package/src/core/defines/exposed-instance-dependencies.ts +19 -0
- package/src/core/defines/index.ts +3 -0
- package/src/core/defines/web-component-name.ts +15 -0
- package/src/core/externals.ts +23 -0
- package/src/core/get-exposed-dependencies-entry-points.ts +59 -0
- package/src/core/index.ts +8 -0
- package/src/core/types.ts +59 -0
- package/src/{webpack/configs → core}/utils/__tests__/build-metadata.test.ts +2 -2
- package/src/{webpack/configs → core}/utils/__tests__/generate-metadata.test.ts +27 -13
- package/src/{webpack/configs → core}/utils/build-metadata.ts +1 -1
- package/src/{webpack/configs → core}/utils/generate-metadata.ts +7 -6
- package/src/core/utils/get-bundle-type.ts +20 -0
- package/src/{webpack/configs → core}/utils/get-launchdarkly-sdk-version.ts +1 -1
- package/src/core/utils/get-output-path.ts +18 -0
- package/src/{webpack/configs → core}/utils/get-web-components-version.ts +1 -1
- package/src/core/utils/index.ts +8 -0
- package/src/core/virtual-modules.ts +76 -0
- package/src/index.ts +1 -0
- package/src/storybook-config/__tests__/webpack-final.test.ts +5 -2
- package/src/storybook-config/webpack-final.ts +24 -10
- package/src/utils/__tests__/get-configuration.test.ts +99 -1
- package/src/utils/__tests__/get-package-data.test.ts +35 -1
- package/src/utils/get-configuration.ts +92 -1
- package/src/utils/get-package-data.ts +3 -1
- package/src/vite/__tests__/define-config.test.ts +13 -0
- package/src/vite/__tests__/load-config-file.test.ts +115 -0
- package/src/vite/__tests__/merge-config.test.ts +173 -0
- package/src/vite/base-config.ts +70 -0
- package/src/vite/build-shared-deps.ts +320 -0
- package/src/vite/create-vite-config.ts +50 -0
- package/src/vite/define-config.ts +20 -0
- package/src/vite/index.html +29 -0
- package/src/vite/load-config-file.ts +54 -0
- package/src/vite/merge-config.ts +93 -0
- package/src/vite/plugins/css-injector-plugin.ts +85 -0
- package/src/vite/plugins/dev-server-routing-plugin.ts +89 -0
- package/src/vite/plugins/externals-plugin.ts +27 -0
- package/src/vite/plugins/html-plugin.ts +65 -0
- package/src/vite/plugins/ignore-modules-plugin.ts +22 -0
- package/src/vite/plugins/index.ts +9 -0
- package/src/vite/plugins/metadata-plugin.ts +78 -0
- package/src/vite/plugins/style-urls-plugin.ts +34 -0
- package/src/vite/plugins/svgr-plugin.ts +11 -0
- package/src/vite/plugins/virtual-modules-plugin.ts +74 -0
- package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +2 -2
- package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +11 -11
- package/src/webpack/__tests__/create-webpack-config.test.ts +3 -2
- package/src/webpack/configs/amd-config.ts +3 -2
- package/src/webpack/configs/cache-config.ts +4 -3
- package/src/webpack/configs/dev-server-config.ts +8 -3
- 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 +3 -2
- package/src/webpack/configs/loaders/style-loader.ts +5 -5
- package/src/webpack/configs/module-config.ts +3 -2
- package/src/webpack/configs/optimization-config.ts +16 -11
- package/src/webpack/configs/output-config.ts +16 -22
- package/src/webpack/configs/plugins/assets-manifest-plugin.ts +9 -36
- package/src/webpack/configs/plugins/bundle-analyser-plugin.ts +8 -8
- package/src/webpack/configs/plugins/define-exposed-dependencies-plugin.ts +7 -15
- package/src/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.ts +7 -13
- 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 +7 -6
- package/src/webpack/configs/plugins/html-tags-plugin.ts +7 -16
- package/src/webpack/configs/plugins/ignore-plugin/empty-module.js +1 -0
- package/src/webpack/configs/plugins/ignore-plugin/ignore-plugin.ts +48 -6
- package/src/webpack/configs/plugins/mini-css-extract-plugin.ts +10 -5
- package/src/webpack/configs/plugins/moment-locales-plugin.ts +3 -2
- package/src/webpack/configs/plugins/remove-empty-scripts-plugin.ts +4 -3
- package/src/webpack/configs/plugins/virtual-modules-plugin.ts +13 -65
- package/src/webpack/configs/plugins/watch-run-plugin.ts +3 -2
- package/src/webpack/configs/plugins-config.ts +3 -2
- package/src/webpack/configs/resolve-config.ts +3 -2
- package/src/webpack/configs/rules/css-rules.ts +4 -3
- package/src/webpack/configs/rules/font-rules.ts +2 -2
- package/src/webpack/configs/rules/image-rules.ts +2 -2
- package/src/webpack/configs/rules/js-rules.ts +4 -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 +9 -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 +88 -43
- package/src/webpack/types.ts +7 -11
- package/src/webpack/utils/index.ts +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/get-package-json.d.ts.map +0 -1
- 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-react-dom-peer-dependency.d.ts.map +0 -1
- package/dist/webpack/configs/types.d.ts +0 -35
- package/dist/webpack/configs/types.d.ts.map +0 -1
- package/dist/webpack/configs/utils/build-metadata.d.ts.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/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-exposed-dependencies.d.ts.map +0 -1
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.d.ts.map +0 -1
- package/dist/webpack/configs/utils/get-web-components-version.d.ts.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/src/webpack/configs/types.ts +0 -38
- package/src/webpack/configs/utils/get-bundle-type.ts +0 -22
- package/src/webpack/configs/utils/index.ts +0 -3
- /package/dist/{webpack/configs/plugins/ignore-plugin → core/check-resource}/get-package-json.d.ts +0 -0
- /package/dist/{webpack/configs/plugins/ignore-plugin → core/check-resource}/is-optional-peer-dependency.d.ts +0 -0
- /package/dist/{webpack/configs/plugins/ignore-plugin → core/check-resource}/is-optional-react-dom-peer-dependency.d.ts +0 -0
- /package/dist/{webpack/configs → core}/utils/build-metadata.d.ts +0 -0
- /package/dist/{webpack/configs → core}/utils/get-exposed-dependencies.d.ts +0 -0
- /package/dist/{webpack/configs → core}/utils/get-launchdarkly-sdk-version.d.ts +0 -0
- /package/dist/{webpack/configs → core}/utils/get-web-components-version.d.ts +0 -0
- /package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/__tests__/get-package-json.test.ts +0 -0
- /package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/__tests__/is-optional-peer-dependency.test.ts +0 -0
- /package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/__tests__/is-optional-react-dom-peer-dependency.test.ts +0 -0
- /package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/is-optional-peer-dependency.ts +0 -0
- /package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/is-optional-react-dom-peer-dependency.ts +0 -0
- /package/src/{webpack/configs → core}/utils/__tests__/get-exposed-dependencies.test.ts +0 -0
- /package/src/{webpack/configs → core}/utils/__tests__/get-launchdarkly-sdk-version.test.ts +0 -0
- /package/src/{webpack/configs → core}/utils/__tests__/get-web-components-version.test.ts +0 -0
- /package/src/{webpack/configs → core}/utils/get-exposed-dependencies.ts +0 -0
- /package/src/{webpack → core}/utils/stringify-config.ts +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Configuration } from 'webpack';
|
|
2
|
-
import {
|
|
2
|
+
import { rulesConfig } from '../../webpack/configs';
|
|
3
|
+
import { Overrides } from '../../webpack/types';
|
|
3
4
|
import { miniCssExtractPlugin } from '../../webpack/configs/plugins';
|
|
4
5
|
import { webpackFinal } from '../webpack-final';
|
|
5
6
|
|
|
@@ -89,7 +90,9 @@ describe(`[startup/storybook-config] ${webpackFinal.name}`, () => {
|
|
|
89
90
|
subject();
|
|
90
91
|
|
|
91
92
|
expect(rulesConfig).toHaveBeenCalledWith(
|
|
92
|
-
expect.objectContaining({
|
|
93
|
+
expect.objectContaining({
|
|
94
|
+
build: expect.objectContaining({ isProduction: true }),
|
|
95
|
+
}),
|
|
93
96
|
expect.anything()
|
|
94
97
|
);
|
|
95
98
|
});
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { inspect } from 'node:util';
|
|
2
2
|
import type { Configuration } from 'webpack';
|
|
3
|
+
import { BuildContext } from '../core';
|
|
3
4
|
import { log } from '../utils';
|
|
4
|
-
import {
|
|
5
|
+
import { rulesConfig } from '../webpack/configs';
|
|
5
6
|
import { miniCssExtractPlugin } from '../webpack/configs/plugins';
|
|
7
|
+
import { Overrides } from '../webpack/types';
|
|
6
8
|
|
|
7
9
|
export function webpackFinal(config: Configuration, overrides: Overrides = {}): Configuration {
|
|
8
10
|
const context = getContext(config);
|
|
@@ -22,22 +24,34 @@ export function webpackFinal(config: Configuration, overrides: Overrides = {}):
|
|
|
22
24
|
};
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
function getContext(config: Configuration):
|
|
27
|
+
function getContext(config: Configuration): BuildContext {
|
|
26
28
|
return {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
package: {
|
|
30
|
+
name: '',
|
|
31
|
+
version: '',
|
|
32
|
+
destination: '',
|
|
33
|
+
source: '',
|
|
34
|
+
dependencies: {},
|
|
35
|
+
sharedDependencies: {},
|
|
36
|
+
isWebComponent: false,
|
|
37
|
+
isLegacyRoot: false,
|
|
38
|
+
isExposeSharedDependencies: false,
|
|
39
|
+
},
|
|
40
|
+
build: {
|
|
41
|
+
name: '',
|
|
42
|
+
isProduction: config.mode === 'production',
|
|
43
|
+
},
|
|
44
|
+
options: {
|
|
45
|
+
bundlerConfig: {},
|
|
46
|
+
},
|
|
33
47
|
};
|
|
34
48
|
}
|
|
35
49
|
|
|
36
|
-
function getPlugins(context:
|
|
50
|
+
function getPlugins(context: BuildContext, overrides: Overrides) {
|
|
37
51
|
return [miniCssExtractPlugin(context, overrides)].filter(plugin => !!plugin);
|
|
38
52
|
}
|
|
39
53
|
|
|
40
|
-
function getRules(context:
|
|
54
|
+
function getRules(context: BuildContext, overrides: Overrides) {
|
|
41
55
|
const include = ['.module.css', '.module.less', '.less', '.svg'];
|
|
42
56
|
const exclude = ['.css'];
|
|
43
57
|
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
getJestConfiguration,
|
|
8
8
|
getReviewConfiguration,
|
|
9
9
|
getStylelintConfiguration,
|
|
10
|
+
getViteConfiguration,
|
|
10
11
|
getVitestConfiguration,
|
|
11
12
|
getWebComponentBranchConfigs,
|
|
12
13
|
getWebComponentConfiguration,
|
|
@@ -19,6 +20,8 @@ import {
|
|
|
19
20
|
isLegacyRoot,
|
|
20
21
|
isStyleCheckDisabled,
|
|
21
22
|
isWebComponent,
|
|
23
|
+
validateSharedDependenciesConsistency,
|
|
24
|
+
validateSharedDependenciesMigration,
|
|
22
25
|
} from '../get-configuration';
|
|
23
26
|
import { log } from '../log';
|
|
24
27
|
|
|
@@ -225,6 +228,29 @@ describe('[startup] Utils', () => {
|
|
|
225
228
|
});
|
|
226
229
|
});
|
|
227
230
|
|
|
231
|
+
describe(getViteConfiguration.name, () => {
|
|
232
|
+
const subject = () => getViteConfiguration();
|
|
233
|
+
|
|
234
|
+
itReturns(subject, {});
|
|
235
|
+
|
|
236
|
+
describe('with "cli.vite"', () => {
|
|
237
|
+
const content = {
|
|
238
|
+
cli: {
|
|
239
|
+
vite: {
|
|
240
|
+
omitDefault: ['plugins.svgr'],
|
|
241
|
+
config: { server: { port: 9000 }, build: { minify: false } },
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
beforeEach(() => mockPackageJson(content));
|
|
247
|
+
|
|
248
|
+
test('returns "cli.vite"', () => {
|
|
249
|
+
expect(subject()).toEqual(content.cli.vite);
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
|
|
228
254
|
describe(getVitestConfiguration.name, () => {
|
|
229
255
|
const subject = () => getVitestConfiguration();
|
|
230
256
|
|
|
@@ -407,7 +433,10 @@ describe('[startup] Utils', () => {
|
|
|
407
433
|
{
|
|
408
434
|
fn: isExposeSharedDependencies,
|
|
409
435
|
defaultValue: false,
|
|
410
|
-
trigger:
|
|
436
|
+
trigger: [
|
|
437
|
+
{ cli: { 'expose-shared-dependencies': true } },
|
|
438
|
+
{ cli: { webpack: { 'expose-shared-dependencies': true } } },
|
|
439
|
+
],
|
|
411
440
|
},
|
|
412
441
|
{
|
|
413
442
|
fn: isLegacy,
|
|
@@ -446,6 +475,75 @@ describe('[startup] Utils', () => {
|
|
|
446
475
|
});
|
|
447
476
|
});
|
|
448
477
|
|
|
478
|
+
describe(validateSharedDependenciesConsistency.name, () => {
|
|
479
|
+
test('passes when neither is set', () => {
|
|
480
|
+
expect(() => validateSharedDependenciesConsistency()).not.toThrow();
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
test('passes when only cli top level is set', () => {
|
|
484
|
+
mockPackageJson({ cli: { 'shared-dependencies': { defaults: '' } } });
|
|
485
|
+
expect(() => validateSharedDependenciesConsistency()).not.toThrow();
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
test('passes when only cli.webpack is set', () => {
|
|
489
|
+
mockPackageJson({ cli: { webpack: { 'shared-dependencies': { defaults: '' } } } });
|
|
490
|
+
expect(() => validateSharedDependenciesConsistency()).not.toThrow();
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
test('passes when both are set and identical', () => {
|
|
494
|
+
const deps = { defaults: '', lodash: 'SharedDependencies.Lodash' };
|
|
495
|
+
mockPackageJson({
|
|
496
|
+
cli: { 'shared-dependencies': deps, 'webpack': { 'shared-dependencies': deps } },
|
|
497
|
+
});
|
|
498
|
+
expect(() => validateSharedDependenciesConsistency()).not.toThrow();
|
|
499
|
+
});
|
|
500
|
+
|
|
501
|
+
test('throws when shared-dependencies both exist and differ', () => {
|
|
502
|
+
mockPackageJson({
|
|
503
|
+
cli: {
|
|
504
|
+
'shared-dependencies': { defaults: '' },
|
|
505
|
+
'webpack': { 'shared-dependencies': { defaults: '', extra: 'foo' } },
|
|
506
|
+
},
|
|
507
|
+
});
|
|
508
|
+
expect(() => validateSharedDependenciesConsistency()).toThrow(/both set but differ/);
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
test('throws when expose-shared-dependencies both exist and differ', () => {
|
|
512
|
+
mockPackageJson({
|
|
513
|
+
cli: {
|
|
514
|
+
'expose-shared-dependencies': true,
|
|
515
|
+
'webpack': { 'expose-shared-dependencies': false },
|
|
516
|
+
},
|
|
517
|
+
});
|
|
518
|
+
expect(() => validateSharedDependenciesConsistency()).toThrow(/both set but differ/);
|
|
519
|
+
});
|
|
520
|
+
});
|
|
521
|
+
|
|
522
|
+
describe(validateSharedDependenciesMigration.name, () => {
|
|
523
|
+
test('passes when neither is set', () => {
|
|
524
|
+
expect(() => validateSharedDependenciesMigration()).not.toThrow();
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
test('passes when only cli top level is set', () => {
|
|
528
|
+
mockPackageJson({ cli: { 'expose-shared-dependencies': true } });
|
|
529
|
+
expect(() => validateSharedDependenciesMigration()).not.toThrow();
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
test('throws when webpack shared-dependencies is set but top level is not', () => {
|
|
533
|
+
mockPackageJson({ cli: { webpack: { 'shared-dependencies': { defaults: '' } } } });
|
|
534
|
+
expect(() => validateSharedDependenciesMigration()).toThrow(
|
|
535
|
+
/Move your shared-dependencies/
|
|
536
|
+
);
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
test('throws when webpack expose-shared-dependencies is set but top level is not', () => {
|
|
540
|
+
mockPackageJson({ cli: { webpack: { 'expose-shared-dependencies': true } } });
|
|
541
|
+
expect(() => validateSharedDependenciesMigration()).toThrow(
|
|
542
|
+
/Move your expose-shared-dependencies/
|
|
543
|
+
);
|
|
544
|
+
});
|
|
545
|
+
});
|
|
546
|
+
|
|
449
547
|
describe(isLegacy.name, () => {
|
|
450
548
|
const trigger = { cli: { legacy: true } };
|
|
451
549
|
let location: string | undefined;
|
|
@@ -32,7 +32,7 @@ describe(`[startup] Utils`, () => {
|
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
describe(`when ${packageJson} contains sharedDependencies`, () => {
|
|
35
|
+
describe(`when ${packageJson} contains sharedDependencies in cli.webpack`, () => {
|
|
36
36
|
const sharedDependencies = { react: 'SharedDependencies.React' };
|
|
37
37
|
|
|
38
38
|
beforeEach(() => {
|
|
@@ -45,6 +45,40 @@ describe(`[startup] Utils`, () => {
|
|
|
45
45
|
expect(subject()).toEqual(expect.objectContaining({ sharedDependencies }));
|
|
46
46
|
});
|
|
47
47
|
});
|
|
48
|
+
|
|
49
|
+
describe(`when ${packageJson} contains sharedDependencies in cli top level`, () => {
|
|
50
|
+
const sharedDependencies = { mobx: 'SharedDependencies.MobX' };
|
|
51
|
+
|
|
52
|
+
beforeEach(() => {
|
|
53
|
+
Object.assign(packages[packageJson], {
|
|
54
|
+
cli: { 'shared-dependencies': sharedDependencies },
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
test('returns sharedDependencies from cli top level', () => {
|
|
59
|
+
expect(subject()).toEqual(expect.objectContaining({ sharedDependencies }));
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
describe(`when ${packageJson} contains sharedDependencies in both locations`, () => {
|
|
64
|
+
const topLevel = { react: 'SharedDependencies.React' };
|
|
65
|
+
const webpack = { mobx: 'SharedDependencies.MobX' };
|
|
66
|
+
|
|
67
|
+
beforeEach(() => {
|
|
68
|
+
Object.assign(packages[packageJson], {
|
|
69
|
+
cli: {
|
|
70
|
+
'shared-dependencies': topLevel,
|
|
71
|
+
'webpack': { 'shared-dependencies': webpack },
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test('prefers cli top level', () => {
|
|
77
|
+
expect(subject()).toEqual(
|
|
78
|
+
expect.objectContaining({ sharedDependencies: topLevel })
|
|
79
|
+
);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
48
82
|
});
|
|
49
83
|
|
|
50
84
|
describe(`${getPackageDependencyVersion.name}`, () => {
|
|
@@ -38,6 +38,7 @@ export interface WebpackConfiguration extends Omit<
|
|
|
38
38
|
'disable-style-check'?: boolean;
|
|
39
39
|
'minify'?: MinifyOptions;
|
|
40
40
|
'proxy'?: WebpackDevServerConfiguration['proxy'] | string;
|
|
41
|
+
'shared-dependencies'?: Record<string, string>;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
export interface ESLintConfiguration extends ESLint.Options {
|
|
@@ -62,6 +63,7 @@ export interface NodeConfiguration {
|
|
|
62
63
|
export enum CommandName {
|
|
63
64
|
'build' = 'build',
|
|
64
65
|
'bundle-package' = 'bundle-package',
|
|
66
|
+
'bundle-vite' = 'bundle-vite',
|
|
65
67
|
'clean' = 'clean',
|
|
66
68
|
'convert-eslint-config' = 'convert-eslint-config',
|
|
67
69
|
'eslint' = 'eslint',
|
|
@@ -91,6 +93,30 @@ export type VitestConfiguration = ViteUserConfig['test'] & {
|
|
|
91
93
|
omitDefault?: string[];
|
|
92
94
|
};
|
|
93
95
|
|
|
96
|
+
export interface HtmlTemplatePluginOptions {
|
|
97
|
+
title?: string;
|
|
98
|
+
favicon?: string;
|
|
99
|
+
template?: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface SvgrPluginOptions {
|
|
103
|
+
include?: string | RegExp | (string | RegExp)[];
|
|
104
|
+
exclude?: string | RegExp | (string | RegExp)[];
|
|
105
|
+
svgrOptions?: Record<string, any>;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface PluginOverrides {
|
|
109
|
+
htmlTemplate?: HtmlTemplatePluginOptions;
|
|
110
|
+
svgr?: SvgrPluginOptions;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface ViteConfiguration {
|
|
114
|
+
omitDefault?: string[];
|
|
115
|
+
minify?: MinifyOptions;
|
|
116
|
+
pluginOverrides?: PluginOverrides;
|
|
117
|
+
config?: Omit<import('vite').UserConfig, 'plugins'>;
|
|
118
|
+
}
|
|
119
|
+
|
|
94
120
|
export interface WebComponentBranchConfigs {
|
|
95
121
|
publishTag?: string;
|
|
96
122
|
uploadSourcemaps?: boolean;
|
|
@@ -113,6 +139,9 @@ type Configuration = {
|
|
|
113
139
|
'swc-compile-package'?: Parameters<typeof swcDir>[0];
|
|
114
140
|
'test'?: JestConfiguration; // for backward-compatibility
|
|
115
141
|
'testRunner'?: string;
|
|
142
|
+
'expose-shared-dependencies'?: boolean;
|
|
143
|
+
'shared-dependencies'?: Record<string, string>;
|
|
144
|
+
'vite'?: ViteConfiguration;
|
|
116
145
|
'vitest'?: VitestConfiguration;
|
|
117
146
|
'web-component'?: boolean | string | WebComponentOptions;
|
|
118
147
|
'webpack'?: false | WebpackConfiguration;
|
|
@@ -155,6 +184,10 @@ export function getStylelintConfiguration() {
|
|
|
155
184
|
return getConfiguration().lint?.stylelint ?? {};
|
|
156
185
|
}
|
|
157
186
|
|
|
187
|
+
export function getViteConfiguration(): ViteConfiguration {
|
|
188
|
+
return getConfiguration().vite ?? {};
|
|
189
|
+
}
|
|
190
|
+
|
|
158
191
|
export function getVitestConfiguration() {
|
|
159
192
|
return getConfiguration().vitest ?? {};
|
|
160
193
|
}
|
|
@@ -225,7 +258,65 @@ export function isDevServerDisabled() {
|
|
|
225
258
|
}
|
|
226
259
|
|
|
227
260
|
export function isExposeSharedDependencies() {
|
|
228
|
-
return
|
|
261
|
+
return (
|
|
262
|
+
(getConfiguration()['expose-shared-dependencies'] ??
|
|
263
|
+
getWebpackConfiguration()['expose-shared-dependencies']) === true
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export function validateSharedDependenciesConsistency() {
|
|
268
|
+
const config = getConfiguration();
|
|
269
|
+
const webpackSharedDependencies = getWebpackConfiguration()['shared-dependencies'];
|
|
270
|
+
const topLevelSharedDependencies = config['shared-dependencies'];
|
|
271
|
+
|
|
272
|
+
if (
|
|
273
|
+
webpackSharedDependencies &&
|
|
274
|
+
topLevelSharedDependencies &&
|
|
275
|
+
JSON.stringify(webpackSharedDependencies) !== JSON.stringify(topLevelSharedDependencies)
|
|
276
|
+
) {
|
|
277
|
+
throw new Error(
|
|
278
|
+
'cli.shared-dependencies and cli.webpack.shared-dependencies are both set but differ. ' +
|
|
279
|
+
'Remove cli.webpack.shared-dependencies and use cli.shared-dependencies only.'
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
const webpackExpose = getWebpackConfiguration()['expose-shared-dependencies'];
|
|
284
|
+
const topLevelExpose = config['expose-shared-dependencies'];
|
|
285
|
+
|
|
286
|
+
if (
|
|
287
|
+
webpackExpose !== undefined &&
|
|
288
|
+
topLevelExpose !== undefined &&
|
|
289
|
+
webpackExpose !== topLevelExpose
|
|
290
|
+
) {
|
|
291
|
+
throw new Error(
|
|
292
|
+
'cli.expose-shared-dependencies and cli.webpack.expose-shared-dependencies are both set but differ. ' +
|
|
293
|
+
'Remove cli.webpack.expose-shared-dependencies and use cli.expose-shared-dependencies only.'
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export function validateSharedDependenciesMigration() {
|
|
299
|
+
const config = getConfiguration();
|
|
300
|
+
const webpackSharedDependencies = getWebpackConfiguration()['shared-dependencies'];
|
|
301
|
+
const topLevelSharedDependencies = config['shared-dependencies'];
|
|
302
|
+
|
|
303
|
+
if (webpackSharedDependencies && !topLevelSharedDependencies) {
|
|
304
|
+
throw new Error(
|
|
305
|
+
'cli.webpack.shared-dependencies is set but cli.shared-dependencies is not. ' +
|
|
306
|
+
'Vite reads shared-dependencies from cli top level. ' +
|
|
307
|
+
'Move your shared-dependencies config from cli.webpack to cli.'
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
const webpackExpose = getWebpackConfiguration()['expose-shared-dependencies'];
|
|
312
|
+
const topLevelExpose = config['expose-shared-dependencies'];
|
|
313
|
+
|
|
314
|
+
if (webpackExpose !== undefined && topLevelExpose === undefined) {
|
|
315
|
+
throw new Error(
|
|
316
|
+
'cli.webpack.expose-shared-dependencies is set but cli.expose-shared-dependencies is not. ' +
|
|
317
|
+
'Move your expose-shared-dependencies config from cli.webpack to cli.'
|
|
318
|
+
);
|
|
319
|
+
}
|
|
229
320
|
}
|
|
230
321
|
|
|
231
322
|
export function isLegacy(locationOrJson?: LocationOrJson) {
|
|
@@ -17,7 +17,9 @@ export function getPackageData(): PackageData {
|
|
|
17
17
|
...readJson('../../package.json').dependencies,
|
|
18
18
|
...packageJson.dependencies,
|
|
19
19
|
},
|
|
20
|
-
sharedDependencies:
|
|
20
|
+
sharedDependencies:
|
|
21
|
+
packageJson.cli?.['shared-dependencies'] ??
|
|
22
|
+
packageJson.cli?.webpack?.['shared-dependencies'],
|
|
21
23
|
};
|
|
22
24
|
}
|
|
23
25
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineConfig } from '../define-config';
|
|
2
|
+
|
|
3
|
+
describe('defineConfig', () => {
|
|
4
|
+
test('returns object config as-is', () => {
|
|
5
|
+
const config = { config: { build: { minify: false } } };
|
|
6
|
+
expect(defineConfig(config)).toBe(config);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
test('returns function config as-is', () => {
|
|
10
|
+
const fn = () => ({ config: { build: { minify: false } } });
|
|
11
|
+
expect(defineConfig(fn)).toBe(fn);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { fs, vol } from 'memfs';
|
|
2
|
+
import { loadConfigFile } from '../load-config-file';
|
|
3
|
+
|
|
4
|
+
jest.mock('fs', () => fs);
|
|
5
|
+
|
|
6
|
+
jest.mock('../load-config-file', () => {
|
|
7
|
+
const realPath = jest.requireActual('path') as typeof import('path');
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
11
|
+
loadConfigFile: async (root: string, isProduction: boolean) => {
|
|
12
|
+
const candidates = isProduction
|
|
13
|
+
? ['vite.prod.config.ts', 'vite.prod.config.js']
|
|
14
|
+
: ['vite.dev.config.ts', 'vite.dev.config.js'];
|
|
15
|
+
|
|
16
|
+
const configPath = candidates
|
|
17
|
+
.map((f: string) => realPath.join(root, f))
|
|
18
|
+
.find((f: string) => {
|
|
19
|
+
try {
|
|
20
|
+
fs.statSync(f);
|
|
21
|
+
return true;
|
|
22
|
+
} catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
if (!configPath) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const content = fs.readFileSync(configPath, 'utf-8') as string;
|
|
32
|
+
|
|
33
|
+
// Parse simple export default { ... } or export default (ctx) => ...
|
|
34
|
+
if (content.includes('=>')) {
|
|
35
|
+
// Function export
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-implied-eval
|
|
37
|
+
return new Function('return ' + content.replace('export default ', ''))();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Object export — extract the object literal
|
|
41
|
+
const match = content.match(/export default\s+({[\s\S]*});?\s*$/);
|
|
42
|
+
if (match) {
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-implied-eval
|
|
44
|
+
return new Function('return ' + match[1])();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return undefined;
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
describe('loadConfigFile', () => {
|
|
53
|
+
afterEach(() => vol.reset());
|
|
54
|
+
|
|
55
|
+
test('returns undefined when no config file exists', async () => {
|
|
56
|
+
vol.fromJSON({ '/project/dummy': '' });
|
|
57
|
+
const result = await loadConfigFile('/project', true);
|
|
58
|
+
expect(result).toBeUndefined();
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('loads prod config file', async () => {
|
|
62
|
+
vol.fromJSON({
|
|
63
|
+
'/project/vite.prod.config.ts':
|
|
64
|
+
'export default { config: { build: { minify: false } } };',
|
|
65
|
+
});
|
|
66
|
+
const result = await loadConfigFile('/project', true);
|
|
67
|
+
expect(result).toEqual({ config: { build: { minify: false } } });
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('loads dev config when isProduction is false', async () => {
|
|
71
|
+
vol.fromJSON({
|
|
72
|
+
'/project/vite.dev.config.ts': 'export default { config: { server: { port: 3000 } } };',
|
|
73
|
+
});
|
|
74
|
+
const result = await loadConfigFile('/project', false);
|
|
75
|
+
expect(result).toEqual({ config: { server: { port: 3000 } } });
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test('prefers .ts over .js', async () => {
|
|
79
|
+
vol.fromJSON({
|
|
80
|
+
'/project/vite.prod.config.ts':
|
|
81
|
+
'export default { config: { build: { minify: true } } };',
|
|
82
|
+
'/project/vite.prod.config.js':
|
|
83
|
+
'export default { config: { build: { minify: false } } };',
|
|
84
|
+
});
|
|
85
|
+
const result = await loadConfigFile('/project', true);
|
|
86
|
+
expect(result).toEqual({ config: { build: { minify: true } } });
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test('falls back to .js when .ts does not exist', async () => {
|
|
90
|
+
vol.fromJSON({
|
|
91
|
+
'/project/vite.prod.config.js':
|
|
92
|
+
'export default { config: { server: { port: 9000 } } };',
|
|
93
|
+
});
|
|
94
|
+
const result = await loadConfigFile('/project', true);
|
|
95
|
+
expect(result).toEqual({ config: { server: { port: 9000 } } });
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
test('returns function export without calling it', async () => {
|
|
99
|
+
vol.fromJSON({
|
|
100
|
+
'/project/vite.prod.config.ts':
|
|
101
|
+
'export default (context) => ({ config: { build: { minify: true } } });',
|
|
102
|
+
});
|
|
103
|
+
const result = await loadConfigFile('/project', true);
|
|
104
|
+
expect(typeof result).toBe('function');
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test('does not find prod config when looking for dev', async () => {
|
|
108
|
+
vol.fromJSON({
|
|
109
|
+
'/project/vite.prod.config.ts':
|
|
110
|
+
'export default { config: { build: { minify: false } } };',
|
|
111
|
+
});
|
|
112
|
+
const result = await loadConfigFile('/project', false);
|
|
113
|
+
expect(result).toBeUndefined();
|
|
114
|
+
});
|
|
115
|
+
});
|