@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
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
jest.mock('vite', () => ({
|
|
2
|
+
mergeConfig: (a: any, b: any) => {
|
|
3
|
+
const result = { ...a };
|
|
4
|
+
for (const key of Object.keys(b)) {
|
|
5
|
+
if (Array.isArray(a[key]) && Array.isArray(b[key])) {
|
|
6
|
+
result[key] = [...a[key], ...b[key]];
|
|
7
|
+
} else if (
|
|
8
|
+
typeof a[key] === 'object' &&
|
|
9
|
+
a[key] !== null &&
|
|
10
|
+
typeof b[key] === 'object' &&
|
|
11
|
+
b[key] !== null &&
|
|
12
|
+
!Array.isArray(a[key])
|
|
13
|
+
) {
|
|
14
|
+
result[key] = { ...a[key], ...b[key] };
|
|
15
|
+
} else {
|
|
16
|
+
result[key] = b[key];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
},
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
const mockHtmlPlugin = jest.fn(() => ({ name: 'html-template' }));
|
|
24
|
+
const mockSvgrPlugin = jest.fn(() => ({ name: 'svgr' }));
|
|
25
|
+
const mockExternalsPlugin = jest.fn(() => []);
|
|
26
|
+
const mockVirtualModulesPlugin = jest.fn(() => []);
|
|
27
|
+
const mockCssInjectorPlugin = jest.fn(() => []);
|
|
28
|
+
const mockStyleUrlsPlugin = jest.fn(() => []);
|
|
29
|
+
const mockMetadataPlugin = jest.fn(() => ({ name: 'metadata' }));
|
|
30
|
+
const mockDevServerRoutingPlugin = jest.fn(() => ({ name: 'dev-server-routing' }));
|
|
31
|
+
const mockIgnoreModulesPlugin = jest.fn(() => ({ name: 'ignore-modules' }));
|
|
32
|
+
|
|
33
|
+
jest.mock('../plugins', () => ({
|
|
34
|
+
htmlPlugin: mockHtmlPlugin,
|
|
35
|
+
svgrPlugin: mockSvgrPlugin,
|
|
36
|
+
externalsPlugin: mockExternalsPlugin,
|
|
37
|
+
virtualModulesPlugin: mockVirtualModulesPlugin,
|
|
38
|
+
cssInjectorPlugin: mockCssInjectorPlugin,
|
|
39
|
+
styleUrlsPlugin: mockStyleUrlsPlugin,
|
|
40
|
+
metadataPlugin: mockMetadataPlugin,
|
|
41
|
+
devServerRoutingPlugin: mockDevServerRoutingPlugin,
|
|
42
|
+
ignoreModulesPlugin: mockIgnoreModulesPlugin,
|
|
43
|
+
}));
|
|
44
|
+
|
|
45
|
+
import type { BuildContext } from '../../core/types';
|
|
46
|
+
import { mergeViteConfigs } from '../merge-config';
|
|
47
|
+
|
|
48
|
+
const stubContext = {} as BuildContext;
|
|
49
|
+
|
|
50
|
+
describe('mergeViteConfigs', () => {
|
|
51
|
+
const baseConfig = {
|
|
52
|
+
server: { port: 8080 },
|
|
53
|
+
build: { sourcemap: true, minify: true },
|
|
54
|
+
css: { modules: { localsConvention: 'camelCaseOnly' as const } },
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
beforeEach(() => jest.clearAllMocks());
|
|
58
|
+
|
|
59
|
+
test('returns base config when no overrides', () => {
|
|
60
|
+
const result = mergeViteConfigs(baseConfig, {}, {}, stubContext);
|
|
61
|
+
expect(result.server?.port).toBe(8080);
|
|
62
|
+
expect(result.build?.sourcemap).toBe(true);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('package.json config overrides base', () => {
|
|
66
|
+
const result = mergeViteConfigs(
|
|
67
|
+
baseConfig,
|
|
68
|
+
{ config: { server: { port: 9000 } } },
|
|
69
|
+
{},
|
|
70
|
+
stubContext
|
|
71
|
+
);
|
|
72
|
+
expect(result.server?.port).toBe(9000);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('config file overrides package.json', () => {
|
|
76
|
+
const result = mergeViteConfigs(
|
|
77
|
+
baseConfig,
|
|
78
|
+
{ config: { server: { port: 9000 } } },
|
|
79
|
+
{ config: { server: { port: 3000 } } },
|
|
80
|
+
stubContext
|
|
81
|
+
);
|
|
82
|
+
expect(result.server?.port).toBe(3000);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test('deep merges nested objects', () => {
|
|
86
|
+
const result = mergeViteConfigs(
|
|
87
|
+
baseConfig,
|
|
88
|
+
{ config: { build: { sourcemap: false } } },
|
|
89
|
+
{},
|
|
90
|
+
stubContext
|
|
91
|
+
);
|
|
92
|
+
expect(result.build?.sourcemap).toBe(false);
|
|
93
|
+
expect(result.build?.minify).toBe(true);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test('concatenates user plugins with built-in plugins', () => {
|
|
97
|
+
const userPlugin = { name: 'user-plugin' };
|
|
98
|
+
const result = mergeViteConfigs(
|
|
99
|
+
baseConfig,
|
|
100
|
+
{},
|
|
101
|
+
{ config: { plugins: [userPlugin as any] } },
|
|
102
|
+
stubContext
|
|
103
|
+
);
|
|
104
|
+
expect(result.plugins).toContain(userPlugin);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test('filters plugins by omitDefault', () => {
|
|
108
|
+
const result = mergeViteConfigs(
|
|
109
|
+
baseConfig,
|
|
110
|
+
{ omitDefault: ['plugins.svgr'] },
|
|
111
|
+
{},
|
|
112
|
+
stubContext
|
|
113
|
+
);
|
|
114
|
+
const pluginNames = (result.plugins as any[])?.map((p: any) => p.name) ?? [];
|
|
115
|
+
expect(pluginNames).not.toContain('svgr');
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
test('omits base config keys', () => {
|
|
119
|
+
const result = mergeViteConfigs(
|
|
120
|
+
baseConfig,
|
|
121
|
+
{ omitDefault: ['css.modules'] },
|
|
122
|
+
{},
|
|
123
|
+
stubContext
|
|
124
|
+
);
|
|
125
|
+
expect(result.css?.modules).toBeUndefined();
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
test('applies minify.js shortcut', () => {
|
|
129
|
+
const result = mergeViteConfigs(baseConfig, { minify: { js: false } }, {}, stubContext);
|
|
130
|
+
expect(result.build?.minify).toBe(false);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test('applies minify.css shortcut', () => {
|
|
134
|
+
const result = mergeViteConfigs(baseConfig, { minify: { css: false } }, {}, stubContext);
|
|
135
|
+
expect(result.build?.cssMinify).toBe(false);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
test('passes merged pluginOverrides to plugin factories', () => {
|
|
139
|
+
mergeViteConfigs(
|
|
140
|
+
baseConfig,
|
|
141
|
+
{ pluginOverrides: { htmlTemplate: { title: 'From PkgJson' } } },
|
|
142
|
+
{ pluginOverrides: { htmlTemplate: { title: 'From File', favicon: './icon.ico' } } },
|
|
143
|
+
stubContext
|
|
144
|
+
);
|
|
145
|
+
expect(mockHtmlPlugin).toHaveBeenCalledWith(
|
|
146
|
+
stubContext,
|
|
147
|
+
expect.objectContaining({ title: 'From File', favicon: './icon.ico' })
|
|
148
|
+
);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
test('unions omitDefault from both sources', () => {
|
|
152
|
+
const result = mergeViteConfigs(
|
|
153
|
+
baseConfig,
|
|
154
|
+
{ omitDefault: ['plugins.svgr'] },
|
|
155
|
+
{ omitDefault: ['plugins.htmlTemplate'] },
|
|
156
|
+
stubContext
|
|
157
|
+
);
|
|
158
|
+
const pluginNames = (result.plugins as any[])?.map((p: any) => p.name) ?? [];
|
|
159
|
+
expect(pluginNames).not.toContain('svgr');
|
|
160
|
+
expect(pluginNames).not.toContain('html-template');
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
test('merges minify from both sources', () => {
|
|
164
|
+
const result = mergeViteConfigs(
|
|
165
|
+
baseConfig,
|
|
166
|
+
{ minify: { js: false } },
|
|
167
|
+
{ minify: { css: false } },
|
|
168
|
+
stubContext
|
|
169
|
+
);
|
|
170
|
+
expect(result.build?.minify).toBe(false);
|
|
171
|
+
expect(result.build?.cssMinify).toBe(false);
|
|
172
|
+
});
|
|
173
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { InlineConfig } from 'vite';
|
|
2
|
+
import {
|
|
3
|
+
BuildContext,
|
|
4
|
+
defineExposedDependencies,
|
|
5
|
+
defineExposedInstanceDependencies,
|
|
6
|
+
defineWebComponentName,
|
|
7
|
+
getBundleType,
|
|
8
|
+
getOutputPath,
|
|
9
|
+
} from '../core';
|
|
10
|
+
|
|
11
|
+
function importMetaRemap(
|
|
12
|
+
...definitions: (Record<string, string> | undefined)[]
|
|
13
|
+
): Record<string, string> {
|
|
14
|
+
const result: Record<string, string> = {};
|
|
15
|
+
|
|
16
|
+
definitions
|
|
17
|
+
.filter(definition => definition !== undefined)
|
|
18
|
+
.forEach(definition =>
|
|
19
|
+
Object.keys(definition).forEach(item => {
|
|
20
|
+
result[`import.meta.env.${item}`] = definition[item];
|
|
21
|
+
})
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function createBaseConfig(context: BuildContext): InlineConfig {
|
|
28
|
+
const { isProduction } = context.build;
|
|
29
|
+
const { isWebComponent } = context.package;
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
cacheDir: `node_modules/.vite/${getBundleType(context) ?? 'host'}`,
|
|
33
|
+
server: {
|
|
34
|
+
// TODO: need default port for MFE?
|
|
35
|
+
port: isWebComponent ? 8888 : 8080,
|
|
36
|
+
warmup: {
|
|
37
|
+
/*
|
|
38
|
+
* TODO: dist duplication/use destination
|
|
39
|
+
* Pre-warms compiled files to avoid multiple page reloads at dev session start
|
|
40
|
+
*/
|
|
41
|
+
clientFiles: ['dist/**/*.js'],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
mode: isProduction ? 'production' : 'development',
|
|
45
|
+
configFile: false,
|
|
46
|
+
oxc: { legalComments: 'none' },
|
|
47
|
+
base: './',
|
|
48
|
+
build: {
|
|
49
|
+
outDir: getOutputPath(context),
|
|
50
|
+
// Preserves shared deps in dist/bundle/shared/ when host rebuilds into dist/bundle/
|
|
51
|
+
emptyOutDir: false,
|
|
52
|
+
sourcemap: true,
|
|
53
|
+
commonjsOptions: {
|
|
54
|
+
include: [
|
|
55
|
+
// TODO: move to config override
|
|
56
|
+
/startup-utils/,
|
|
57
|
+
/\/node_modules\//,
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
define: importMetaRemap(
|
|
62
|
+
defineExposedDependencies(context),
|
|
63
|
+
defineExposedInstanceDependencies(context),
|
|
64
|
+
defineWebComponentName(context)
|
|
65
|
+
),
|
|
66
|
+
optimizeDeps: {
|
|
67
|
+
include: ['@servicetitan/startup-utils'],
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import crypto from 'crypto';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { build, Plugin } from 'vite';
|
|
5
|
+
import { createBuildContext, CreateBuildContextInput, getOutputPath } from '../core';
|
|
6
|
+
import { createViteConfig } from './create-vite-config';
|
|
7
|
+
|
|
8
|
+
function getShortName(dep: string) {
|
|
9
|
+
return dep.split('/').pop()!;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function contentHash(content: string) {
|
|
13
|
+
return crypto.createHash('md5').update(content).digest('hex').slice(0, 20);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function bundleName(name: string, ext: string, content?: string) {
|
|
17
|
+
return content ? `${name}.${contentHash(content)}.bundle${ext}` : `${name}.bundle${ext}`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface SharedDepsPluginOptions {
|
|
21
|
+
dependencies: Record<string, string>;
|
|
22
|
+
css?: Record<string, string[]>;
|
|
23
|
+
metadataDir?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const CSS_VIRTUAL_PREFIX = '\0shared-deps-css:';
|
|
27
|
+
|
|
28
|
+
function sharedDepsPlugin({ dependencies, css, metadataDir }: SharedDepsPluginOptions): Plugin {
|
|
29
|
+
const depNames = Object.keys(dependencies);
|
|
30
|
+
const depSet = new Set(depNames);
|
|
31
|
+
const cssEntries = css ?? {};
|
|
32
|
+
const depShortNames = new Set(depNames.map(getShortName));
|
|
33
|
+
const cssInputNames = new Map<string, string>();
|
|
34
|
+
for (const name of Object.keys(cssEntries)) {
|
|
35
|
+
cssInputNames.set(depShortNames.has(name) ? `${name}-css` : name, name);
|
|
36
|
+
}
|
|
37
|
+
let isProduction = false;
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
name: 'shared-deps',
|
|
41
|
+
enforce: 'pre',
|
|
42
|
+
|
|
43
|
+
config(_, env) {
|
|
44
|
+
isProduction = env.mode === 'production';
|
|
45
|
+
|
|
46
|
+
const input: Record<string, string> = {};
|
|
47
|
+
for (const dep of depNames) {
|
|
48
|
+
input[getShortName(dep)] = dep;
|
|
49
|
+
}
|
|
50
|
+
for (const [inputName, originalName] of cssInputNames) {
|
|
51
|
+
input[inputName] = CSS_VIRTUAL_PREFIX + originalName;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
// Relative base so CSS font URLs resolve from the CSS file's directory, not site root
|
|
56
|
+
base: './',
|
|
57
|
+
// Must match host build mode — mismatch causes react-dom/client usingClientEntryPoint errors
|
|
58
|
+
define: {
|
|
59
|
+
'process.env.NODE_ENV': JSON.stringify(env.mode),
|
|
60
|
+
},
|
|
61
|
+
build: {
|
|
62
|
+
commonjsOptions: {
|
|
63
|
+
include: [/\/node_modules\//],
|
|
64
|
+
transformMixedEsModules: true,
|
|
65
|
+
},
|
|
66
|
+
rollupOptions: {
|
|
67
|
+
// Vite defaults to false which strips all CJS exports from entry chunks
|
|
68
|
+
preserveEntrySignatures: 'exports-only',
|
|
69
|
+
input,
|
|
70
|
+
output: {
|
|
71
|
+
/*
|
|
72
|
+
* CJS format + named exports: the factory system wraps each entry's
|
|
73
|
+
* code in function(module, exports, require) { ... }
|
|
74
|
+
*/
|
|
75
|
+
format: 'cjs',
|
|
76
|
+
exports: 'named',
|
|
77
|
+
entryFileNames: '[name].cjs.js',
|
|
78
|
+
chunkFileNames: '_[name]-[hash].js',
|
|
79
|
+
assetFileNames: assetInfo => {
|
|
80
|
+
const ext = assetInfo.names?.[0]?.split('.').pop() ?? '';
|
|
81
|
+
if (ext === 'css') {
|
|
82
|
+
return isProduction
|
|
83
|
+
? '[name].[hash].bundle[extname]'
|
|
84
|
+
: '[name].bundle[extname]';
|
|
85
|
+
}
|
|
86
|
+
return isProduction ? '[name].[hash][extname]' : '[name][extname]';
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
// Disabled: we don't know which exports MFEs will use at runtime
|
|
90
|
+
treeshake: false,
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
resolveId(source: string, importer: string | undefined) {
|
|
97
|
+
if (source.startsWith(CSS_VIRTUAL_PREFIX)) {
|
|
98
|
+
return source;
|
|
99
|
+
}
|
|
100
|
+
if (!importer) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (depSet.has(source)) {
|
|
104
|
+
return { id: source, external: true };
|
|
105
|
+
}
|
|
106
|
+
if (!source.startsWith('.') && !source.startsWith('/')) {
|
|
107
|
+
try {
|
|
108
|
+
return require.resolve(source);
|
|
109
|
+
} catch {
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
load(id: string) {
|
|
116
|
+
if (!id.startsWith(CSS_VIRTUAL_PREFIX)) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const name = id.slice(CSS_VIRTUAL_PREFIX.length);
|
|
120
|
+
const imports = cssEntries[name];
|
|
121
|
+
if (!imports) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
return imports.map(p => `import '${p}';`).join('\n');
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
generateBundle(_options, bundle) {
|
|
128
|
+
const factories: string[] = [];
|
|
129
|
+
const exposes: string[] = [];
|
|
130
|
+
|
|
131
|
+
for (const [fileName, chunk] of Object.entries(bundle)) {
|
|
132
|
+
if (chunk.type !== 'chunk') {
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
if (!chunk.isEntry) {
|
|
136
|
+
factories.push(
|
|
137
|
+
`'./${fileName}': function(module, exports, require) {\n${chunk.code}\n}`
|
|
138
|
+
);
|
|
139
|
+
delete bundle[fileName];
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
for (const [dep, variable] of Object.entries(dependencies)) {
|
|
144
|
+
const entryFileName = `${getShortName(dep)}.cjs.js`;
|
|
145
|
+
const chunk = bundle[entryFileName];
|
|
146
|
+
if (chunk?.type !== 'chunk') {
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
factories.push(`'${dep}': function(module, exports, require) {\n${chunk.code}\n}`);
|
|
150
|
+
exposes.push(`expose('${variable}', '${dep}');`);
|
|
151
|
+
delete bundle[entryFileName];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/*
|
|
155
|
+
* Rename CSS assets from collision-avoidance names back to original names
|
|
156
|
+
* (e.g. design-system-css → design-system). Rolldown's bundle proxy doesn't
|
|
157
|
+
* support delete or assignment, so we track renamed prefixes and filter them
|
|
158
|
+
* out when building the entrypoints list.
|
|
159
|
+
*/
|
|
160
|
+
const renamedPrefixes: string[] = [];
|
|
161
|
+
for (const [inputName, originalName] of cssInputNames) {
|
|
162
|
+
delete bundle[`${inputName}.cjs.js`];
|
|
163
|
+
if (inputName !== originalName) {
|
|
164
|
+
renamedPrefixes.push(inputName);
|
|
165
|
+
for (const [fileName, asset] of Object.entries(bundle)) {
|
|
166
|
+
if (asset.type === 'asset' && fileName.startsWith(inputName)) {
|
|
167
|
+
this.emitFile({
|
|
168
|
+
type: 'asset',
|
|
169
|
+
fileName: fileName.replace(inputName, originalName),
|
|
170
|
+
source: asset.source,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const code = assembleIIFE(factories, exposes);
|
|
178
|
+
const sharedFileName = bundleName('shared', '.js', isProduction ? code : undefined);
|
|
179
|
+
|
|
180
|
+
this.emitFile({
|
|
181
|
+
type: 'asset',
|
|
182
|
+
fileName: sharedFileName,
|
|
183
|
+
source: code,
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
const cssFiles = Object.keys(bundle)
|
|
187
|
+
.filter(f => f.endsWith('.bundle.css'))
|
|
188
|
+
.filter(f => !renamedPrefixes.some(p => f.startsWith(p)))
|
|
189
|
+
.concat(
|
|
190
|
+
renamedPrefixes.flatMap(p =>
|
|
191
|
+
Object.keys(bundle)
|
|
192
|
+
.filter(f => f.startsWith(p) && f.endsWith('.bundle.css'))
|
|
193
|
+
.map(f => f.replace(p, cssInputNames.get(p)!))
|
|
194
|
+
)
|
|
195
|
+
);
|
|
196
|
+
const entrypoints = { css: cssFiles, js: [sharedFileName] };
|
|
197
|
+
this.emitFile({
|
|
198
|
+
type: 'asset',
|
|
199
|
+
fileName: 'entrypoints.json',
|
|
200
|
+
source: JSON.stringify(entrypoints, null, 2),
|
|
201
|
+
});
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
writeBundle(options) {
|
|
205
|
+
if (!metadataDir) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
const outDir = options.dir ?? '';
|
|
209
|
+
const metadata = {
|
|
210
|
+
entryPointsPath: path.resolve(outDir, 'entrypoints.json'),
|
|
211
|
+
};
|
|
212
|
+
if (!fs.existsSync(metadataDir)) {
|
|
213
|
+
fs.mkdirSync(metadataDir, { recursive: true });
|
|
214
|
+
}
|
|
215
|
+
fs.writeFileSync(
|
|
216
|
+
path.join(metadataDir, 'exposed-dependencies-metadata.json'),
|
|
217
|
+
JSON.stringify(metadata, null, 2)
|
|
218
|
+
);
|
|
219
|
+
},
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function assembleIIFE(factories: string[], exposes: string[]): string {
|
|
224
|
+
return `(function() {
|
|
225
|
+
var STORAGE_KEY = Symbol.for('SERVICETITAN_EXPOSE_LOADER_STORAGE');
|
|
226
|
+
var g = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {};
|
|
227
|
+
if (g[STORAGE_KEY] === undefined) {
|
|
228
|
+
g[STORAGE_KEY] = Object.assign(Object.create(null), {
|
|
229
|
+
clear: function(scope) { delete this[scope]; }
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
var storage = g[STORAGE_KEY];
|
|
233
|
+
|
|
234
|
+
var modules = {
|
|
235
|
+
${factories.join(',\n')}
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
function createScopedRequire(scope) {
|
|
239
|
+
var cache = storage[scope] = storage[scope] || Object.create(null);
|
|
240
|
+
function require(id) {
|
|
241
|
+
if (cache[id]) return cache[id].exports;
|
|
242
|
+
if (!modules[id]) throw new Error('Module not found: ' + id);
|
|
243
|
+
var module = cache[id] = { id: id, loaded: false, exports: {} };
|
|
244
|
+
modules[id](module, module.exports, require);
|
|
245
|
+
module.loaded = true;
|
|
246
|
+
var keys = Object.keys(module.exports);
|
|
247
|
+
if (module.exports.__esModule && keys.length === 1 && keys[0] === 'default') {
|
|
248
|
+
module.exports = module.exports.default;
|
|
249
|
+
}
|
|
250
|
+
return module.exports;
|
|
251
|
+
}
|
|
252
|
+
Object.setPrototypeOf(require, { resolve: function(id) { return id; } });
|
|
253
|
+
return require;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function expose(path, moduleId) {
|
|
257
|
+
var parts = path.split('.');
|
|
258
|
+
var obj = g;
|
|
259
|
+
for (var i = 0; i < parts.length - 1; i++) {
|
|
260
|
+
if (obj[parts[i]] === undefined) { obj[parts[i]] = Object.create(null); }
|
|
261
|
+
obj = obj[parts[i]];
|
|
262
|
+
}
|
|
263
|
+
obj[parts[parts.length - 1]] = new Proxy(
|
|
264
|
+
Object.assign(Object.create(null), { getStorage: function() { return storage; } }),
|
|
265
|
+
{
|
|
266
|
+
get: function(target, scope, receiver) {
|
|
267
|
+
if (scope === 'getStorage') return Reflect.get(target, scope, receiver);
|
|
268
|
+
return createScopedRequire(scope)(moduleId);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
${exposes.join('\n')}
|
|
275
|
+
})();
|
|
276
|
+
`;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export async function buildSharedDeps(input: CreateBuildContextInput) {
|
|
280
|
+
// Get merged config to read custom outDir (parity with webpack)
|
|
281
|
+
const config = await createViteConfig(input);
|
|
282
|
+
const customOutDir = config.build?.outDir;
|
|
283
|
+
|
|
284
|
+
const context = createBuildContext({
|
|
285
|
+
...input,
|
|
286
|
+
bundlerConfig: customOutDir
|
|
287
|
+
? { emitExposedDependencies: { output: { path: customOutDir } } }
|
|
288
|
+
: undefined,
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
const { destination, sharedDependencies } = context.package;
|
|
292
|
+
const outputDir = getOutputPath(context);
|
|
293
|
+
const mode = context.build.isProduction ? 'production' : 'development';
|
|
294
|
+
|
|
295
|
+
const css: Record<string, string[]> = {};
|
|
296
|
+
if (sharedDependencies['@servicetitan/design-system']) {
|
|
297
|
+
css['design-system'] = [
|
|
298
|
+
'@servicetitan/tokens/core/tokens.css',
|
|
299
|
+
'@servicetitan/anvil-fonts/dist/css/anvil-fonts.css',
|
|
300
|
+
'@servicetitan/design-system/dist/system.min.css',
|
|
301
|
+
];
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
await build({
|
|
305
|
+
configFile: false,
|
|
306
|
+
logLevel: 'warn',
|
|
307
|
+
oxc: { legalComments: 'none' },
|
|
308
|
+
mode,
|
|
309
|
+
plugins: [
|
|
310
|
+
sharedDepsPlugin({
|
|
311
|
+
dependencies: sharedDependencies,
|
|
312
|
+
css,
|
|
313
|
+
metadataDir: destination,
|
|
314
|
+
}),
|
|
315
|
+
],
|
|
316
|
+
build: {
|
|
317
|
+
outDir: outputDir,
|
|
318
|
+
},
|
|
319
|
+
});
|
|
320
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { createBuildContext, CreateBuildContextInput, stringifyConfig } from '../core';
|
|
2
|
+
import { getViteConfiguration, log } from '../utils';
|
|
3
|
+
import { createBaseConfig } from './base-config';
|
|
4
|
+
import { loadConfigFile } from './load-config-file';
|
|
5
|
+
import { mergeViteConfigs } from './merge-config';
|
|
6
|
+
|
|
7
|
+
export async function createViteConfig(input: CreateBuildContextInput) {
|
|
8
|
+
const context = createBuildContext(input);
|
|
9
|
+
const { isProduction } = context.build;
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
* TODO: distinguish between apps in debugging (NOT SUPPORTED)
|
|
13
|
+
* TODO: look into request logging similar to webpack
|
|
14
|
+
* TODO: make it the Task
|
|
15
|
+
* TODO: consolidate shared configuration (add plugins depending on context)
|
|
16
|
+
* TODO: dist folder cleaning? MFE cleaning
|
|
17
|
+
* TODO: check full bundle bundles (number and names compared to wp)
|
|
18
|
+
* TODO: standalone MFE host needs to have anvil stylesheet? (only in dev?)
|
|
19
|
+
* TODO: vite's index.html in dist/src??
|
|
20
|
+
* TODO: urls to page resources are inconsistent. some are dist/bundle some are direct
|
|
21
|
+
* TODO: full bundle injected css uses absolute URL and doesn't seem cached?
|
|
22
|
+
* TODO: test ts config override
|
|
23
|
+
* TODO: rename bundle-package to bundle-webpack?
|
|
24
|
+
* REVIEWS: plugins especially style injection, loading config file, base config, shared deps, context files, weird config shortcuts like isCustomStyleRules, bundlerConfig in context
|
|
25
|
+
* TESTS: fix existing and add new, bff and token server
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
const pkgJsonConfig = getViteConfiguration();
|
|
29
|
+
const configFileExport = await loadConfigFile('./', isProduction);
|
|
30
|
+
const fileConfig =
|
|
31
|
+
typeof configFileExport === 'function'
|
|
32
|
+
? configFileExport(context)
|
|
33
|
+
: (configFileExport ?? {});
|
|
34
|
+
|
|
35
|
+
const baseConfig = createBaseConfig(context);
|
|
36
|
+
const finalConfig = mergeViteConfigs(baseConfig, pkgJsonConfig, fileConfig, context);
|
|
37
|
+
|
|
38
|
+
/*
|
|
39
|
+
* Background dev servers (light/headless) must use a random port to avoid
|
|
40
|
+
* conflicting with the full bundle's user-configured port.
|
|
41
|
+
*/
|
|
42
|
+
if (context.build.light || context.build.headless) {
|
|
43
|
+
finalConfig.server = { ...finalConfig.server, port: 0 };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* istanbul ignore next: debug only */
|
|
47
|
+
log.debug('create-vite-config', () => stringifyConfig(finalConfig));
|
|
48
|
+
|
|
49
|
+
return finalConfig;
|
|
50
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { UserConfig } from 'vite';
|
|
2
|
+
import type { BuildContext } from '../core/types';
|
|
3
|
+
import type { MinifyOptions, PluginOverrides } from '../utils/get-configuration';
|
|
4
|
+
|
|
5
|
+
export interface ViteConfigOverride {
|
|
6
|
+
omitDefault?: string[];
|
|
7
|
+
minify?: MinifyOptions;
|
|
8
|
+
pluginOverrides?: PluginOverrides;
|
|
9
|
+
config?: UserConfig;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function defineConfig(config: ViteConfigOverride): ViteConfigOverride;
|
|
13
|
+
export function defineConfig(
|
|
14
|
+
fn: (context: BuildContext) => ViteConfigOverride
|
|
15
|
+
): (context: BuildContext) => ViteConfigOverride;
|
|
16
|
+
export function defineConfig(
|
|
17
|
+
configOrFn: ViteConfigOverride | ((context: BuildContext) => ViteConfigOverride)
|
|
18
|
+
) {
|
|
19
|
+
return configOrFn;
|
|
20
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<title><%= it.title %></title>
|
|
6
|
+
<link rel="icon" href="<%= it.favicon ?? 'favicon.ico' %>" />
|
|
7
|
+
<% it.css.forEach(function(item) { %>
|
|
8
|
+
<link href="./<%= item %>" rel="stylesheet" />
|
|
9
|
+
<% }); %> <% it.js.forEach(function(item) { %>
|
|
10
|
+
<script src="./<%= item %>"></script>
|
|
11
|
+
<% }); %>
|
|
12
|
+
<script type="text/javascript">
|
|
13
|
+
/* Simulate host initialization */
|
|
14
|
+
window.onload = () =>
|
|
15
|
+
document.querySelector('<%= it.name %>')?.provide({ onReady() {} });
|
|
16
|
+
</script>
|
|
17
|
+
</head>
|
|
18
|
+
<body>
|
|
19
|
+
<script type="module">
|
|
20
|
+
<% if (it.isWebComponent) { %>
|
|
21
|
+
import './index';
|
|
22
|
+
<% } else { %>
|
|
23
|
+
import './dist/index';
|
|
24
|
+
<% } %>
|
|
25
|
+
</script>
|
|
26
|
+
<% if (it.isWebComponent) { %><<%~ it.name %> style-urls="<%=
|
|
27
|
+
encodeURIComponent(JSON.stringify([])) %>" /><% } %>
|
|
28
|
+
</body>
|
|
29
|
+
</html>
|