@servicetitan/startup 36.0.0 → 36.1.1-beta.1
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.map +1 -1
- package/dist/cli/commands/build.js +14 -9
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/bundle-vite.d.ts +6 -0
- package/dist/cli/commands/bundle-vite.d.ts.map +1 -0
- package/dist/cli/commands/bundle-vite.js +110 -0
- package/dist/cli/commands/bundle-vite.js.map +1 -0
- package/dist/cli/commands/bundle-webpack.d.ts +6 -0
- package/dist/cli/commands/bundle-webpack.d.ts.map +1 -0
- package/dist/cli/commands/{bundle-package.js → bundle-webpack.js} +8 -6
- package/dist/cli/commands/bundle-webpack.js.map +1 -0
- package/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +2 -1
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/mfe-check.d.ts.map +1 -1
- package/dist/cli/commands/mfe-check.js +2 -2
- package/dist/cli/commands/mfe-check.js.map +1 -1
- package/dist/cli/commands/mfe-generate-metadata.js +2 -2
- package/dist/cli/commands/mfe-generate-metadata.js.map +1 -1
- package/dist/cli/commands/mfe-list.js +1 -1
- package/dist/cli/commands/mfe-list.js.map +1 -1
- package/dist/cli/commands/mfe-package-publish.js.map +1 -1
- package/dist/cli/commands/mfe-publish.js +1 -1
- package/dist/cli/commands/mfe-publish.js.map +1 -1
- package/dist/cli/commands/registry/build.d.ts +8 -0
- package/dist/cli/commands/registry/build.d.ts.map +1 -1
- package/dist/cli/commands/registry/build.js +8 -0
- package/dist/cli/commands/registry/build.js.map +1 -1
- package/dist/cli/commands/registry/bundle-vite.d.ts +33 -0
- package/dist/cli/commands/registry/bundle-vite.d.ts.map +1 -0
- package/dist/cli/commands/registry/bundle-vite.js +45 -0
- package/dist/cli/commands/registry/bundle-vite.js.map +1 -0
- package/dist/cli/commands/registry/{bundle-package.d.ts → bundle-webpack.d.ts} +1 -1
- package/dist/cli/commands/registry/bundle-webpack.d.ts.map +1 -0
- package/dist/cli/commands/registry/{bundle-package.js → bundle-webpack.js} +1 -1
- package/dist/cli/commands/registry/{bundle-package.js.map → bundle-webpack.js.map} +1 -1
- package/dist/cli/commands/registry/command-registry.d.ts +72 -0
- package/dist/cli/commands/registry/command-registry.d.ts.map +1 -1
- package/dist/cli/commands/registry/command-registry.js +7 -2
- package/dist/cli/commands/registry/command-registry.js.map +1 -1
- package/dist/cli/commands/registry/start.d.ts +4 -0
- package/dist/cli/commands/registry/start.d.ts.map +1 -1
- package/dist/cli/commands/registry/start.js +4 -0
- package/dist/cli/commands/registry/start.js.map +1 -1
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +11 -9
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/index.js +2 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/tasks/tsc-compile/tsc-compile.js +1 -1
- package/dist/cli/tasks/tsc-compile/tsc-compile.js.map +1 -1
- package/dist/cli/utils/copy-files.js +1 -0
- package/dist/cli/utils/copy-files.js.map +1 -1
- package/dist/cli/utils/index.d.ts +0 -1
- package/dist/cli/utils/index.d.ts.map +1 -1
- package/dist/cli/utils/index.js +0 -1
- package/dist/cli/utils/index.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/{webpack/configs/plugins/ignore-plugin → core/check-resource}/check-resource.js +2 -2
- package/dist/core/check-resource/check-resource.js.map +1 -0
- package/dist/core/check-resource/get-package-json.d.ts +7 -0
- package/dist/core/check-resource/get-package-json.d.ts.map +1 -0
- package/dist/{webpack/configs/plugins/ignore-plugin → core/check-resource}/get-package-json.js +1 -1
- 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.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.map +1 -0
- package/dist/core/constants.d.ts +17 -0
- package/dist/core/constants.d.ts.map +1 -0
- package/dist/core/constants.js +28 -0
- package/dist/core/constants.js.map +1 -0
- package/dist/core/create-build-context.d.ts +13 -0
- package/dist/core/create-build-context.d.ts.map +1 -0
- package/dist/core/create-build-context.js +51 -0
- package/dist/core/create-build-context.js.map +1 -0
- package/dist/core/defines/define-exposed-dependencies.d.ts +5 -0
- package/dist/core/defines/define-exposed-dependencies.d.ts.map +1 -0
- package/dist/core/defines/define-exposed-dependencies.js +26 -0
- package/dist/core/defines/define-exposed-dependencies.js.map +1 -0
- package/dist/core/defines/define-exposed-instance-dependencies.d.ts +5 -0
- package/dist/core/defines/define-exposed-instance-dependencies.d.ts.map +1 -0
- package/dist/core/defines/define-exposed-instance-dependencies.js +29 -0
- package/dist/core/defines/define-exposed-instance-dependencies.js.map +1 -0
- package/dist/core/defines/define-web-component-name.d.ts +5 -0
- package/dist/core/defines/define-web-component-name.d.ts.map +1 -0
- package/dist/core/defines/define-web-component-name.js +23 -0
- package/dist/core/defines/define-web-component-name.js.map +1 -0
- package/dist/core/defines/index.d.ts +4 -0
- package/dist/core/defines/index.d.ts.map +1 -0
- package/dist/core/defines/index.js +26 -0
- package/dist/core/defines/index.js.map +1 -0
- package/dist/core/externals.d.ts +3 -0
- package/dist/core/externals.d.ts.map +1 -0
- package/dist/core/externals.js +28 -0
- package/dist/core/externals.js.map +1 -0
- package/dist/core/get-build-name.d.ts +2 -0
- package/dist/core/get-build-name.d.ts.map +1 -0
- package/dist/core/get-build-name.js +24 -0
- package/dist/core/get-build-name.js.map +1 -0
- package/dist/core/get-bundle-type.d.ts +3 -0
- package/dist/core/get-bundle-type.d.ts.map +1 -0
- package/dist/{webpack/configs/utils → core}/get-bundle-type.js +4 -2
- package/dist/core/get-bundle-type.js.map +1 -0
- package/dist/core/get-exposed-dependencies.d.ts.map +1 -0
- package/dist/core/get-exposed-dependencies.js.map +1 -0
- package/dist/core/get-output-path.d.ts +3 -0
- package/dist/core/get-output-path.d.ts.map +1 -0
- package/dist/core/get-output-path.js +32 -0
- package/dist/core/get-output-path.js.map +1 -0
- package/dist/core/get-shared-entry-points.d.ts +11 -0
- package/dist/core/get-shared-entry-points.d.ts.map +1 -0
- package/dist/core/get-shared-entry-points.js +43 -0
- package/dist/core/get-shared-entry-points.js.map +1 -0
- package/dist/core/get-version/get-launchdarkly-sdk-version.d.ts.map +1 -0
- package/dist/{webpack/configs/utils → core/get-version}/get-launchdarkly-sdk-version.js +1 -1
- package/dist/core/get-version/get-launchdarkly-sdk-version.js.map +1 -0
- package/dist/core/get-version/get-startup-version.d.ts.map +1 -0
- package/dist/{utils → core/get-version}/get-startup-version.js +2 -2
- package/dist/core/get-version/get-startup-version.js.map +1 -0
- package/dist/core/get-version/get-web-components-version.d.ts.map +1 -0
- package/dist/{webpack/configs/utils → core/get-version}/get-web-components-version.js +1 -1
- package/dist/core/get-version/get-web-components-version.js.map +1 -0
- package/dist/core/get-version/index.d.ts +4 -0
- package/dist/core/get-version/index.d.ts.map +1 -0
- package/dist/core/get-version/index.js +22 -0
- package/dist/core/get-version/index.js.map +1 -0
- package/dist/core/index.d.ts +16 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +33 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/metadata/build-metadata.d.ts.map +1 -0
- package/dist/{webpack/configs/utils → core/metadata}/build-metadata.js +5 -6
- package/dist/core/metadata/build-metadata.js.map +1 -0
- package/dist/core/metadata/generate-exposed-dependencies-metadata.d.ts +3 -0
- package/dist/core/metadata/generate-exposed-dependencies-metadata.d.ts.map +1 -0
- package/dist/core/metadata/generate-exposed-dependencies-metadata.js +42 -0
- package/dist/core/metadata/generate-exposed-dependencies-metadata.js.map +1 -0
- package/dist/core/metadata/generate-metadata.d.ts +3 -0
- package/dist/core/metadata/generate-metadata.d.ts.map +1 -0
- package/dist/{webpack/configs/utils → core/metadata}/generate-metadata.js +5 -4
- package/dist/core/metadata/generate-metadata.js.map +1 -0
- package/dist/core/metadata/index.d.ts +4 -0
- package/dist/core/metadata/index.d.ts.map +1 -0
- package/dist/{webpack/configs/utils → core/metadata}/index.js +2 -2
- package/dist/core/metadata/index.js.map +1 -0
- package/dist/core/stringify-config.d.ts.map +1 -0
- package/dist/core/stringify-config.js.map +1 -0
- package/dist/core/types.d.ts +51 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/virtual-modules.d.ts +8 -0
- package/dist/core/virtual-modules.d.ts.map +1 -0
- package/dist/core/virtual-modules.js +83 -0
- package/dist/core/virtual-modules.js.map +1 -0
- package/dist/cypress/config/webpack-config.d.ts +1 -1
- package/dist/cypress/config/webpack-config.d.ts.map +1 -1
- package/dist/cypress/config/webpack-config.js +19 -6
- package/dist/cypress/config/webpack-config.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/storybook-config/webpack-final.d.ts +1 -1
- package/dist/storybook-config/webpack-final.d.ts.map +1 -1
- package/dist/storybook-config/webpack-final.js +17 -6
- package/dist/storybook-config/webpack-final.js.map +1 -1
- package/dist/utils/get-configuration.d.ts +31 -1
- package/dist/utils/get-configuration.d.ts.map +1 -1
- package/dist/utils/get-configuration.js +12 -8
- package/dist/utils/get-configuration.js.map +1 -1
- package/dist/utils/get-package-data.d.ts.map +1 -1
- package/dist/utils/get-package-data.js +3 -2
- package/dist/utils/get-package-data.js.map +1 -1
- package/dist/utils/get-packages.d.ts +1 -1
- package/dist/utils/get-packages.d.ts.map +1 -1
- package/dist/utils/get-packages.js +1 -1
- package/dist/utils/get-packages.js.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/validate-shared-dependencies.d.ts +2 -0
- package/dist/utils/validate-shared-dependencies.d.ts.map +1 -0
- package/dist/utils/validate-shared-dependencies.js +26 -0
- package/dist/utils/validate-shared-dependencies.js.map +1 -0
- package/dist/vite/build-shared-dependencies.d.ts +3 -0
- package/dist/vite/build-shared-dependencies.d.ts.map +1 -0
- package/dist/vite/build-shared-dependencies.js +59 -0
- package/dist/vite/build-shared-dependencies.js.map +1 -0
- package/dist/vite/config/base-config.d.ts +4 -0
- package/dist/vite/config/base-config.d.ts.map +1 -0
- package/dist/vite/config/base-config.js +139 -0
- package/dist/vite/config/base-config.js.map +1 -0
- package/dist/vite/config/create-vite-build-context.d.ts +5 -0
- package/dist/vite/config/create-vite-build-context.d.ts.map +1 -0
- package/dist/vite/config/create-vite-build-context.js +43 -0
- package/dist/vite/config/create-vite-build-context.js.map +1 -0
- package/dist/vite/config/create-vite-config.d.ts +3 -0
- package/dist/vite/config/create-vite-config.d.ts.map +1 -0
- package/dist/vite/config/create-vite-config.js +43 -0
- package/dist/vite/config/create-vite-config.js.map +1 -0
- package/dist/vite/config/define-config.d.ts +13 -0
- package/dist/vite/config/define-config.d.ts.map +1 -0
- package/dist/vite/config/define-config.js +15 -0
- package/dist/vite/config/define-config.js.map +1 -0
- package/dist/vite/config/index.d.ts +6 -0
- package/dist/vite/config/index.d.ts.map +1 -0
- package/dist/vite/config/index.js +24 -0
- package/dist/vite/config/index.js.map +1 -0
- package/dist/vite/config/load-config-file.d.ts +4 -0
- package/dist/vite/config/load-config-file.d.ts.map +1 -0
- package/dist/vite/config/load-config-file.js +103 -0
- package/dist/vite/config/load-config-file.js.map +1 -0
- package/dist/vite/config/merge-vite-configs.d.ts +5 -0
- package/dist/vite/config/merge-vite-configs.d.ts.map +1 -0
- package/dist/vite/config/merge-vite-configs.js +17 -0
- package/dist/vite/config/merge-vite-configs.js.map +1 -0
- package/dist/vite/index.d.ts +2 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.html +36 -0
- package/dist/vite/index.js +20 -0
- package/dist/vite/index.js.map +1 -0
- package/dist/vite/plugins/css-injector-plugin.d.ts +4 -0
- package/dist/vite/plugins/css-injector-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/css-injector-plugin.js +57 -0
- package/dist/vite/plugins/css-injector-plugin.js.map +1 -0
- package/dist/vite/plugins/dev-server-routing-plugin.d.ts +24 -0
- package/dist/vite/plugins/dev-server-routing-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/dev-server-routing-plugin.js +85 -0
- package/dist/vite/plugins/dev-server-routing-plugin.js.map +1 -0
- package/dist/vite/plugins/externals-plugin.d.ts +4 -0
- package/dist/vite/plugins/externals-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/externals-plugin.js +60 -0
- package/dist/vite/plugins/externals-plugin.js.map +1 -0
- package/dist/vite/plugins/html-plugin.d.ts +4 -0
- package/dist/vite/plugins/html-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/html-plugin.js +102 -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 +78 -0
- package/dist/vite/plugins/metadata-plugin.js.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin.d.ts +8 -0
- package/dist/vite/plugins/shared-dependencies-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/shared-dependencies-plugin.js +252 -0
- package/dist/vite/plugins/shared-dependencies-plugin.js.map +1 -0
- package/dist/vite/plugins/style-urls-plugin.d.ts +4 -0
- package/dist/vite/plugins/style-urls-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/style-urls-plugin.js +31 -0
- package/dist/vite/plugins/style-urls-plugin.js.map +1 -0
- package/dist/vite/plugins/svgr-plugin.d.ts +4 -0
- package/dist/vite/plugins/svgr-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/svgr-plugin.js +33 -0
- package/dist/vite/plugins/svgr-plugin.js.map +1 -0
- package/dist/vite/plugins/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 +63 -0
- package/dist/vite/plugins/virtual-modules-plugin.js.map +1 -0
- package/dist/vite/types.d.ts +4 -0
- package/dist/vite/types.d.ts.map +1 -0
- package/dist/vite/types.js +6 -0
- package/dist/vite/types.js.map +1 -0
- package/dist/vite/validate-shared-dependencies.d.ts +2 -0
- package/dist/vite/validate-shared-dependencies.d.ts.map +1 -0
- package/dist/vite/validate-shared-dependencies.js +27 -0
- package/dist/vite/validate-shared-dependencies.js.map +1 -0
- package/dist/webpack/bundle-webpack.d.ts +11 -0
- package/dist/webpack/bundle-webpack.d.ts.map +1 -0
- package/dist/webpack/bundle-webpack.js +107 -0
- package/dist/webpack/bundle-webpack.js.map +1 -0
- package/dist/webpack/configs/amd-config.d.ts +3 -2
- package/dist/webpack/configs/amd-config.d.ts.map +1 -1
- package/dist/webpack/configs/amd-config.js.map +1 -1
- package/dist/webpack/configs/cache-config.d.ts +3 -2
- package/dist/webpack/configs/cache-config.d.ts.map +1 -1
- package/dist/webpack/configs/cache-config.js +1 -1
- package/dist/webpack/configs/cache-config.js.map +1 -1
- package/dist/webpack/configs/dev-server-config.d.ts +2 -2
- package/dist/webpack/configs/dev-server-config.d.ts.map +1 -1
- package/dist/webpack/configs/dev-server-config.js +8 -8
- package/dist/webpack/configs/dev-server-config.js.map +1 -1
- package/dist/webpack/configs/devtool-config.d.ts +3 -2
- package/dist/webpack/configs/devtool-config.d.ts.map +1 -1
- package/dist/webpack/configs/devtool-config.js +1 -1
- package/dist/webpack/configs/devtool-config.js.map +1 -1
- package/dist/webpack/configs/entry.config.d.ts +3 -2
- package/dist/webpack/configs/entry.config.d.ts.map +1 -1
- package/dist/webpack/configs/entry.config.js +6 -5
- package/dist/webpack/configs/entry.config.js.map +1 -1
- package/dist/webpack/configs/externals-config.d.ts +3 -2
- package/dist/webpack/configs/externals-config.d.ts.map +1 -1
- package/dist/webpack/configs/externals-config.js +4 -14
- package/dist/webpack/configs/externals-config.js.map +1 -1
- package/dist/webpack/configs/index.d.ts +0 -1
- package/dist/webpack/configs/index.d.ts.map +1 -1
- package/dist/webpack/configs/index.js.map +1 -1
- package/dist/webpack/configs/loaders/css-loader.d.ts +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 +3 -1
- package/dist/webpack/configs/loaders/style-loader.js.map +1 -1
- package/dist/webpack/configs/module-config.d.ts +2 -2
- package/dist/webpack/configs/module-config.d.ts.map +1 -1
- package/dist/webpack/configs/module-config.js.map +1 -1
- package/dist/webpack/configs/optimization-config.d.ts +2 -2
- package/dist/webpack/configs/optimization-config.d.ts.map +1 -1
- package/dist/webpack/configs/optimization-config.js +9 -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 +10 -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 +4 -2
- package/dist/webpack/configs/plugins/html-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/html-tags-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/html-tags-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/html-tags-plugin.js +8 -19
- package/dist/webpack/configs/plugins/html-tags-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts +15 -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 +41 -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 +2 -2
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.js +4 -2
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/moment-locales-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/moment-locales-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/moment-locales-plugin.js.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 +2 -2
- package/dist/webpack/configs/rules-config.d.ts.map +1 -1
- package/dist/webpack/configs/rules-config.js +2 -2
- package/dist/webpack/configs/rules-config.js.map +1 -1
- package/dist/webpack/configs/stats-config.d.ts +3 -2
- package/dist/webpack/configs/stats-config.d.ts.map +1 -1
- package/dist/webpack/configs/stats-config.js.map +1 -1
- package/dist/webpack/configs/watch-options-config.d.ts +2 -2
- package/dist/webpack/configs/watch-options-config.d.ts.map +1 -1
- package/dist/webpack/configs/watch-options-config.js +2 -2
- package/dist/webpack/configs/watch-options-config.js.map +1 -1
- package/dist/webpack/create-webpack-config.d.ts +2 -0
- package/dist/webpack/create-webpack-config.d.ts.map +1 -1
- package/dist/webpack/create-webpack-config.js +36 -46
- package/dist/webpack/create-webpack-config.js.map +1 -1
- package/dist/webpack/create-webpack-configs.d.ts +16 -0
- package/dist/webpack/create-webpack-configs.d.ts.map +1 -0
- package/dist/webpack/create-webpack-configs.js +82 -0
- package/dist/webpack/create-webpack-configs.js.map +1 -0
- package/dist/webpack/index.d.ts +2 -0
- package/dist/webpack/index.d.ts.map +1 -1
- package/dist/webpack/index.js +2 -0
- package/dist/webpack/index.js.map +1 -1
- package/dist/webpack/types.d.ts +4 -11
- package/dist/webpack/types.d.ts.map +1 -1
- package/dist/webpack/utils/create-webpack-build-context.d.ts +4 -0
- package/dist/webpack/utils/create-webpack-build-context.d.ts.map +1 -0
- package/dist/webpack/utils/create-webpack-build-context.js +21 -0
- package/dist/webpack/utils/create-webpack-build-context.js.map +1 -0
- package/dist/webpack/utils/index.d.ts +1 -1
- package/dist/webpack/utils/index.d.ts.map +1 -1
- package/dist/webpack/utils/index.js +1 -1
- package/dist/webpack/utils/index.js.map +1 -1
- package/jest/babel-plugin-import-meta-env.js +18 -0
- package/jest/jest-preset.js +4 -1
- package/package.json +24 -17
- package/patches/vite-plugin-css-injected-by-js+3.5.2.patch +63 -0
- package/src/cli/commands/__tests__/build.test.ts +2 -2
- package/src/cli/commands/__tests__/bundle-vite.test.ts +228 -0
- package/src/cli/commands/__tests__/{bundle-package.test.ts → bundle-webpack.test.ts} +26 -17
- package/src/cli/commands/__tests__/install.test.ts +6 -2
- package/src/cli/commands/__tests__/mfe-generate-metadata.test.ts +13 -10
- package/src/cli/commands/__tests__/mfe-publish.test.ts +4 -4
- package/src/cli/commands/__tests__/start.test.ts +1 -1
- package/src/cli/commands/build.ts +14 -11
- package/src/cli/commands/bundle-vite.ts +82 -0
- package/src/cli/commands/{bundle-package.ts → bundle-webpack.ts} +9 -6
- package/src/cli/commands/install.ts +2 -1
- package/src/cli/commands/mfe-check.ts +1 -2
- package/src/cli/commands/mfe-generate-metadata.ts +1 -1
- package/src/cli/commands/mfe-list.ts +1 -1
- package/src/cli/commands/mfe-package-publish.ts +1 -1
- package/src/cli/commands/mfe-publish.ts +1 -1
- package/src/cli/commands/registry/__tests__/command-registry.test.ts +1 -0
- package/src/cli/commands/registry/build.ts +2 -0
- package/src/cli/commands/registry/bundle-vite.ts +14 -0
- package/src/cli/commands/registry/command-registry.ts +5 -2
- package/src/cli/commands/registry/start.ts +1 -0
- package/src/cli/commands/start.ts +13 -11
- package/src/cli/index.ts +2 -1
- package/src/cli/tasks/tsc-compile/tsc-compile.ts +1 -1
- package/src/cli/utils/copy-files.ts +1 -1
- package/src/cli/utils/index.ts +0 -1
- 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}/__tests__/get-package-json.test.ts +1 -1
- 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 +6 -1
- package/src/core/check-resource/index.ts +1 -0
- package/src/core/constants.ts +16 -0
- package/src/core/create-build-context.ts +57 -0
- package/src/core/defines/define-exposed-dependencies.ts +21 -0
- package/src/core/defines/define-exposed-instance-dependencies.ts +19 -0
- package/src/core/defines/define-web-component-name.ts +15 -0
- package/src/core/defines/index.ts +3 -0
- package/src/core/externals.ts +22 -0
- package/src/core/get-build-name.ts +11 -0
- package/src/core/get-bundle-type.ts +19 -0
- package/src/core/get-output-path.ts +18 -0
- package/src/core/get-shared-entry-points.ts +37 -0
- package/src/{webpack/configs/utils → core/get-version}/get-launchdarkly-sdk-version.ts +1 -1
- package/src/core/get-version/get-startup-version.ts +6 -0
- package/src/{webpack/configs/utils → core/get-version}/get-web-components-version.ts +1 -1
- package/src/core/get-version/index.ts +3 -0
- package/src/core/index.ts +15 -0
- package/src/{webpack/configs/utils → core/metadata}/__tests__/build-metadata.test.ts +10 -6
- package/src/{webpack/configs/utils → core/metadata}/__tests__/generate-metadata.test.ts +27 -13
- package/src/{webpack/configs/utils → core/metadata}/build-metadata.ts +6 -3
- package/src/core/metadata/generate-exposed-dependencies-metadata.ts +20 -0
- package/src/{webpack/configs/utils → core/metadata}/generate-metadata.ts +7 -6
- package/src/core/metadata/index.ts +3 -0
- package/src/core/types.ts +50 -0
- package/src/core/virtual-modules.ts +74 -0
- package/src/cypress/config/__tests__/webpack-config.test.ts +12 -2
- package/src/cypress/config/webpack-config.ts +23 -9
- package/src/index.ts +1 -0
- package/src/storybook-config/__tests__/webpack-final.test.ts +5 -2
- package/src/storybook-config/webpack-final.ts +22 -10
- package/src/utils/__tests__/get-configuration.test.ts +28 -7
- package/src/utils/__tests__/get-package-data.test.ts +35 -1
- package/src/utils/__tests__/get-packages.test.ts +3 -3
- package/src/utils/__tests__/validate-shared-dependencies.test.ts +55 -0
- package/src/utils/get-configuration.ts +48 -6
- package/src/utils/get-package-data.ts +3 -1
- package/src/utils/get-packages.ts +2 -2
- package/src/utils/index.ts +1 -1
- package/src/utils/validate-shared-dependencies.ts +32 -0
- package/src/vite/__tests__/build-shared-dependencies.test.ts +165 -0
- package/src/vite/__tests__/validate-shared-dependencies.test.ts +34 -0
- package/src/vite/build-shared-dependencies.ts +47 -0
- package/src/vite/config/__tests__/base-config.test.ts +291 -0
- package/src/vite/config/__tests__/create-vite-build-context.test.ts +86 -0
- package/src/vite/config/__tests__/create-vite-config.test.ts +141 -0
- package/src/vite/config/__tests__/define-config.test.ts +23 -0
- package/src/vite/config/__tests__/load-config-file.test.ts +191 -0
- package/src/vite/config/__tests__/merge-vite-configs.test.ts +84 -0
- package/src/vite/config/base-config.ts +127 -0
- package/src/vite/config/create-vite-build-context.ts +45 -0
- package/src/vite/config/create-vite-config.ts +33 -0
- package/src/vite/config/define-config.ts +18 -0
- package/src/vite/config/index.ts +5 -0
- package/src/vite/config/load-config-file.ts +52 -0
- package/src/vite/config/merge-vite-configs.ts +15 -0
- package/src/vite/index.html +36 -0
- package/src/vite/index.ts +1 -0
- package/src/vite/plugins/__tests__/css-injector-plugin.test.ts +61 -0
- package/src/vite/plugins/__tests__/dev-server-routing-plugin.test.ts +255 -0
- package/src/vite/plugins/__tests__/externals-plugin.test.ts +138 -0
- package/src/vite/plugins/__tests__/html-plugin.test.ts +308 -0
- package/src/vite/plugins/__tests__/ignore-modules-plugin.test.ts +80 -0
- package/src/vite/plugins/__tests__/metadata-plugin.test.ts +163 -0
- package/src/vite/plugins/__tests__/shared-dependencies-plugin.test.ts +427 -0
- package/src/vite/plugins/__tests__/style-urls-plugin.test.ts +76 -0
- package/src/vite/plugins/__tests__/svgr-plugin.test.ts +67 -0
- package/src/vite/plugins/__tests__/virtual-modules-plugin.test.ts +120 -0
- package/src/vite/plugins/css-injector-plugin.ts +60 -0
- package/src/vite/plugins/dev-server-routing-plugin.ts +96 -0
- package/src/vite/plugins/externals-plugin.ts +81 -0
- package/src/vite/plugins/html-plugin.ts +94 -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 +66 -0
- package/src/vite/plugins/shared-dependencies-plugin.ts +273 -0
- package/src/vite/plugins/style-urls-plugin.ts +28 -0
- package/src/vite/plugins/svgr-plugin.ts +17 -0
- package/src/vite/plugins/virtual-modules-plugin.ts +59 -0
- package/src/vite/types.ts +6 -0
- package/src/vite/validate-shared-dependencies.ts +27 -0
- package/src/{cli/utils/__tests__/bundle.test.ts → webpack/__tests__/bundle-webpack.test.ts} +26 -19
- package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +23 -9
- package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +17 -16
- package/src/webpack/__tests__/create-webpack-config.test.ts +10 -8
- package/src/webpack/bundle-webpack.ts +107 -0
- 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 +16 -17
- package/src/webpack/configs/devtool-config.ts +4 -3
- package/src/webpack/configs/entry.config.ts +8 -7
- package/src/webpack/configs/externals-config.ts +5 -21
- package/src/webpack/configs/index.ts +0 -1
- package/src/webpack/configs/loaders/css-loader.ts +3 -2
- package/src/webpack/configs/loaders/style-loader.ts +4 -5
- package/src/webpack/configs/module-config.ts +2 -2
- package/src/webpack/configs/optimization-config.ts +17 -11
- package/src/webpack/configs/output-config.ts +11 -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 +6 -6
- package/src/webpack/configs/plugins/html-tags-plugin.ts +7 -16
- package/src/webpack/configs/plugins/ignore-plugin/__tests__/ignore-plugin.test.ts +92 -0
- package/src/webpack/configs/plugins/ignore-plugin/empty-module.js +6 -0
- package/src/webpack/configs/plugins/ignore-plugin/ignore-plugin.ts +44 -6
- package/src/webpack/configs/plugins/mini-css-extract-plugin.ts +9 -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 +11 -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 +6 -5
- package/src/webpack/configs/stats-config.ts +3 -2
- package/src/webpack/configs/watch-options-config.ts +3 -3
- package/src/webpack/create-webpack-config.ts +18 -49
- package/src/webpack/create-webpack-configs.ts +77 -0
- package/src/webpack/index.ts +2 -0
- package/src/webpack/types.ts +8 -11
- package/src/webpack/utils/__tests__/split-by-entry.test.ts +33 -0
- package/src/webpack/utils/create-webpack-build-context.ts +12 -0
- package/src/webpack/utils/index.ts +1 -1
- package/dist/cli/commands/bundle-package.d.ts +0 -6
- package/dist/cli/commands/bundle-package.d.ts.map +0 -1
- package/dist/cli/commands/bundle-package.js.map +0 -1
- package/dist/cli/commands/registry/bundle-package.d.ts.map +0 -1
- package/dist/cli/utils/bundle.d.ts +0 -14
- package/dist/cli/utils/bundle.d.ts.map +0 -1
- package/dist/cli/utils/bundle.js +0 -187
- package/dist/cli/utils/bundle.js.map +0 -1
- package/dist/utils/get-startup-version.d.ts.map +0 -1
- package/dist/utils/get-startup-version.js.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.d.ts +0 -3
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.d.ts.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.js.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.d.ts +0 -2
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.d.ts.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.js.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.d.ts.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.js.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-react-dom-peer-dependency.d.ts.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-react-dom-peer-dependency.js.map +0 -1
- package/dist/webpack/configs/types.d.ts +0 -35
- package/dist/webpack/configs/types.d.ts.map +0 -1
- package/dist/webpack/configs/types.js.map +0 -1
- package/dist/webpack/configs/utils/build-metadata.d.ts.map +0 -1
- package/dist/webpack/configs/utils/build-metadata.js.map +0 -1
- package/dist/webpack/configs/utils/generate-metadata.d.ts +0 -3
- package/dist/webpack/configs/utils/generate-metadata.d.ts.map +0 -1
- package/dist/webpack/configs/utils/generate-metadata.js.map +0 -1
- package/dist/webpack/configs/utils/get-bundle-type.d.ts +0 -3
- package/dist/webpack/configs/utils/get-bundle-type.d.ts.map +0 -1
- package/dist/webpack/configs/utils/get-bundle-type.js.map +0 -1
- package/dist/webpack/configs/utils/get-exposed-dependencies.d.ts.map +0 -1
- package/dist/webpack/configs/utils/get-exposed-dependencies.js.map +0 -1
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.d.ts.map +0 -1
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.js.map +0 -1
- package/dist/webpack/configs/utils/get-web-components-version.d.ts.map +0 -1
- package/dist/webpack/configs/utils/get-web-components-version.js.map +0 -1
- package/dist/webpack/configs/utils/index.d.ts +0 -4
- package/dist/webpack/configs/utils/index.d.ts.map +0 -1
- package/dist/webpack/configs/utils/index.js.map +0 -1
- package/dist/webpack/utils/stringify-config.d.ts.map +0 -1
- package/dist/webpack/utils/stringify-config.js.map +0 -1
- package/src/cli/utils/bundle.ts +0 -191
- package/src/utils/get-startup-version.ts +0 -6
- package/src/webpack/configs/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}/is-optional-peer-dependency.d.ts +0 -0
- /package/dist/{webpack/configs/plugins/ignore-plugin → core/check-resource}/is-optional-peer-dependency.js +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/plugins/ignore-plugin → core/check-resource}/is-optional-react-dom-peer-dependency.js +0 -0
- /package/dist/{webpack/configs/utils → core}/get-exposed-dependencies.d.ts +0 -0
- /package/dist/{webpack/configs/utils → core}/get-exposed-dependencies.js +0 -0
- /package/dist/{webpack/configs/utils → core/get-version}/get-launchdarkly-sdk-version.d.ts +0 -0
- /package/dist/{utils → core/get-version}/get-startup-version.d.ts +0 -0
- /package/dist/{webpack/configs/utils → core/get-version}/get-web-components-version.d.ts +0 -0
- /package/dist/{webpack/configs/utils → core/metadata}/build-metadata.d.ts +0 -0
- /package/dist/{webpack/utils → core}/stringify-config.d.ts +0 -0
- /package/dist/{webpack/utils → core}/stringify-config.js +0 -0
- /package/dist/{webpack/configs → core}/types.js +0 -0
- /package/src/cli/commands/registry/{bundle-package.ts → bundle-webpack.ts} +0 -0
- /package/src/{webpack/configs/utils → core}/__tests__/get-exposed-dependencies.test.ts +0 -0
- /package/src/{webpack/configs/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/utils → core}/get-exposed-dependencies.ts +0 -0
- /package/src/{webpack/configs/utils → core/get-version}/__tests__/get-launchdarkly-sdk-version.test.ts +0 -0
- /package/src/{utils → core/get-version}/__tests__/get-startup-version.test.ts +0 -0
- /package/src/{webpack/configs/utils → core/get-version}/__tests__/get-web-components-version.test.ts +0 -0
- /package/src/{webpack/utils → core}/stringify-config.ts +0 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import os from 'os';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { rolldown } from 'rolldown'; // eslint-disable-line import/no-extraneous-dependencies
|
|
5
|
+
import type { BuildContext } from '../../../core/types';
|
|
6
|
+
import { loadConfigFile } from '../load-config-file';
|
|
7
|
+
|
|
8
|
+
jest.mock('rolldown', () => ({ rolldown: jest.fn() }));
|
|
9
|
+
|
|
10
|
+
describe('[startup] loadConfigFile', () => {
|
|
11
|
+
const emptyModule = 'module.exports = {};';
|
|
12
|
+
const config = { foo: 'bar' };
|
|
13
|
+
|
|
14
|
+
let root: string;
|
|
15
|
+
let context: BuildContext;
|
|
16
|
+
|
|
17
|
+
beforeAll(() => (root = fs.mkdtempSync(path.join(os.tmpdir(), 'startup-test-'))));
|
|
18
|
+
afterAll(() => fs.rmSync(root, { recursive: true, force: true }));
|
|
19
|
+
|
|
20
|
+
beforeEach(() => {
|
|
21
|
+
jest.clearAllMocks();
|
|
22
|
+
context = { build: { isProduction: true } } as BuildContext;
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
function setup({
|
|
26
|
+
configFiles,
|
|
27
|
+
generatedOutput = emptyModule,
|
|
28
|
+
}: {
|
|
29
|
+
configFiles: string[];
|
|
30
|
+
generatedOutput?: string;
|
|
31
|
+
}) {
|
|
32
|
+
for (const entry of fs.readdirSync(root)) {
|
|
33
|
+
fs.rmSync(path.join(root, entry), { recursive: true, force: true });
|
|
34
|
+
}
|
|
35
|
+
for (const file of configFiles) {
|
|
36
|
+
fs.writeFileSync(path.join(root, file), '');
|
|
37
|
+
}
|
|
38
|
+
jest.mocked(rolldown).mockResolvedValue({
|
|
39
|
+
generate: jest.fn().mockResolvedValue({ output: [{ code: generatedOutput }] }),
|
|
40
|
+
} as any);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function cjsExport(value: Record<string, any>) {
|
|
44
|
+
return `module.exports = ${JSON.stringify(value)};`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const subject = () => loadConfigFile(root, context);
|
|
48
|
+
|
|
49
|
+
function itReturnsEmptyObject() {
|
|
50
|
+
test('returns empty object', async () => {
|
|
51
|
+
expect(await subject()).toEqual({});
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
itReturnsEmptyObject();
|
|
56
|
+
|
|
57
|
+
test('does not call rolldown', async () => {
|
|
58
|
+
await subject();
|
|
59
|
+
|
|
60
|
+
expect(rolldown).not.toHaveBeenCalled();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
describe('with a prod config file', () => {
|
|
64
|
+
const prodConfigTs = 'vite.prod.config.ts';
|
|
65
|
+
const prodConfigJs = 'vite.prod.config.js';
|
|
66
|
+
|
|
67
|
+
beforeEach(() => {
|
|
68
|
+
setup({ configFiles: [prodConfigTs], generatedOutput: cjsExport(config) });
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test('returns the config', async () => {
|
|
72
|
+
expect(await subject()).toEqual(config);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('passes the config path to rolldown', async () => {
|
|
76
|
+
await subject();
|
|
77
|
+
|
|
78
|
+
expect(rolldown).toHaveBeenCalledWith(
|
|
79
|
+
expect.objectContaining({ input: path.join(root, prodConfigTs) })
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
test('generates CJS output', async () => {
|
|
84
|
+
await subject();
|
|
85
|
+
|
|
86
|
+
const { generate } = (await jest.mocked(rolldown).mock.results[0].value) as any;
|
|
87
|
+
expect(generate).toHaveBeenCalledWith({ format: 'cjs' });
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
test('externalizes bare imports and keeps relative/absolute paths', async () => {
|
|
91
|
+
await subject();
|
|
92
|
+
|
|
93
|
+
const { external } = jest.mocked(rolldown).mock.calls[0][0] as any;
|
|
94
|
+
expect(external('lodash')).toBe(true);
|
|
95
|
+
expect(external('@servicetitan/startup')).toBe(true);
|
|
96
|
+
expect(external('./shared-config')).toBe(false);
|
|
97
|
+
expect(external('/Users/dev/project/shared-config.ts')).toBe(false);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
function itCleansTempFile() {
|
|
101
|
+
test('cleans up temp file', async () => {
|
|
102
|
+
await subject().catch(() => {});
|
|
103
|
+
|
|
104
|
+
const tmpDir = path.join(root, 'node_modules', '.startup');
|
|
105
|
+
const files = fs.existsSync(tmpDir) ? fs.readdirSync(tmpDir) : [];
|
|
106
|
+
expect(files).toHaveLength(0);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
itCleansTempFile();
|
|
111
|
+
|
|
112
|
+
describe('when import throws', () => {
|
|
113
|
+
beforeEach(() => {
|
|
114
|
+
setup({
|
|
115
|
+
configFiles: [prodConfigTs],
|
|
116
|
+
generatedOutput: 'throw new Error("bad config");',
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
itCleansTempFile();
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
describe('when config exports a function', () => {
|
|
124
|
+
beforeEach(() => {
|
|
125
|
+
setup({
|
|
126
|
+
configFiles: [prodConfigTs],
|
|
127
|
+
generatedOutput:
|
|
128
|
+
'module.exports = (ctx) => ({ config: { minify: ctx.build.isProduction } });',
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test('returns the result of calling the function', async () => {
|
|
133
|
+
expect(await subject()).toEqual({ config: { minify: true } });
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
describe('when config exports null', () => {
|
|
138
|
+
beforeEach(() => {
|
|
139
|
+
setup({ configFiles: [prodConfigTs], generatedOutput: 'module.exports = null;' });
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
itReturnsEmptyObject();
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
describe('when .js also exists', () => {
|
|
146
|
+
beforeEach(() => {
|
|
147
|
+
setup({ configFiles: [prodConfigTs, prodConfigJs] });
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
test('prefers .ts over .js', async () => {
|
|
151
|
+
await subject();
|
|
152
|
+
|
|
153
|
+
expect(rolldown).toHaveBeenCalledWith(
|
|
154
|
+
expect.objectContaining({ input: path.join(root, prodConfigTs) })
|
|
155
|
+
);
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
describe('when only .js exists', () => {
|
|
160
|
+
beforeEach(() => {
|
|
161
|
+
setup({ configFiles: [prodConfigJs] });
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
test('loads .js config', async () => {
|
|
165
|
+
await subject();
|
|
166
|
+
|
|
167
|
+
expect(rolldown).toHaveBeenCalledWith(
|
|
168
|
+
expect.objectContaining({ input: path.join(root, prodConfigJs) })
|
|
169
|
+
);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
describe('with a dev config file', () => {
|
|
175
|
+
const devConfigTs = 'vite.dev.config.ts';
|
|
176
|
+
|
|
177
|
+
beforeEach(() => {
|
|
178
|
+
setup({ configFiles: [devConfigTs], generatedOutput: cjsExport(config) });
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
itReturnsEmptyObject();
|
|
182
|
+
|
|
183
|
+
describe('with dev context', () => {
|
|
184
|
+
beforeEach(() => (context.build.isProduction = false));
|
|
185
|
+
|
|
186
|
+
test('returns the config', async () => {
|
|
187
|
+
expect(await subject()).toEqual(config);
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { VitePackageJsonOverride } from '../../../utils/get-configuration';
|
|
2
|
+
import type { ViteConfigFileOverride } from '../define-config';
|
|
3
|
+
|
|
4
|
+
jest.mock('vite', () => ({
|
|
5
|
+
mergeConfig: (a: Record<string, any>, b: Record<string, any>) => ({ ...a, ...b }),
|
|
6
|
+
}));
|
|
7
|
+
|
|
8
|
+
import { mergeViteConfigs } from '../merge-vite-configs';
|
|
9
|
+
|
|
10
|
+
describe(mergeViteConfigs.name, () => {
|
|
11
|
+
const baseConfig = {
|
|
12
|
+
root: '/app',
|
|
13
|
+
build: { outDir: 'dist' },
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
let packageJsonConfig: VitePackageJsonOverride;
|
|
17
|
+
let fileConfig: ViteConfigFileOverride;
|
|
18
|
+
|
|
19
|
+
beforeEach(() => {
|
|
20
|
+
packageJsonConfig = {};
|
|
21
|
+
fileConfig = {};
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const subject = () => mergeViteConfigs(baseConfig, packageJsonConfig, fileConfig);
|
|
25
|
+
|
|
26
|
+
test('returns base config', () => {
|
|
27
|
+
expect(subject()).toEqual(baseConfig);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe('when package.json has config', () => {
|
|
31
|
+
beforeEach(() => {
|
|
32
|
+
packageJsonConfig = { config: { server: { port: 3000 } } };
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
test('merges into base', () => {
|
|
36
|
+
expect(subject()).toEqual({
|
|
37
|
+
...baseConfig,
|
|
38
|
+
server: { port: 3000 },
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
describe('when config file has config', () => {
|
|
44
|
+
beforeEach(() => {
|
|
45
|
+
fileConfig = { config: { server: { port: 4000 } } };
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('merges into base', () => {
|
|
49
|
+
expect(subject()).toEqual({
|
|
50
|
+
...baseConfig,
|
|
51
|
+
server: { port: 4000 },
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
describe('when both package.json and config file have config', () => {
|
|
57
|
+
beforeEach(() => {
|
|
58
|
+
packageJsonConfig = { config: { server: { port: 3000 } } };
|
|
59
|
+
fileConfig = { config: { server: { port: 4000 } } };
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test('file config takes precedence', () => {
|
|
63
|
+
expect(subject()).toEqual({
|
|
64
|
+
...baseConfig,
|
|
65
|
+
server: { port: 4000 },
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
describe('when configs have non-overlapping keys', () => {
|
|
71
|
+
beforeEach(() => {
|
|
72
|
+
packageJsonConfig = { config: { resolve: { alias: { '@': '/src' } } } };
|
|
73
|
+
fileConfig = { config: { server: { port: 4000 } } };
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
test('merges all three together', () => {
|
|
77
|
+
expect(subject()).toEqual({
|
|
78
|
+
...baseConfig,
|
|
79
|
+
resolve: { alias: { '@': '/src' } },
|
|
80
|
+
server: { port: 4000 },
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
});
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type { InlineConfig, Plugin } from 'vite';
|
|
2
|
+
import {
|
|
3
|
+
bundleConstants,
|
|
4
|
+
defineExposedDependencies,
|
|
5
|
+
defineExposedInstanceDependencies,
|
|
6
|
+
defineWebComponentName,
|
|
7
|
+
getBundleType,
|
|
8
|
+
getOutputPath,
|
|
9
|
+
} from '../../core';
|
|
10
|
+
import { omit } from '../../utils';
|
|
11
|
+
import {
|
|
12
|
+
cssInjectorPlugin,
|
|
13
|
+
devServerRoutingPlugin,
|
|
14
|
+
externalsPlugin,
|
|
15
|
+
htmlPlugin,
|
|
16
|
+
ignoreModulesPlugin,
|
|
17
|
+
metadataPlugin,
|
|
18
|
+
styleUrlsPlugin,
|
|
19
|
+
svgrPlugin,
|
|
20
|
+
virtualModulesPlugin,
|
|
21
|
+
} from '../plugins';
|
|
22
|
+
import { ViteBuildContext } from '../types';
|
|
23
|
+
|
|
24
|
+
function importMetaRemap(
|
|
25
|
+
...definitions: (Record<string, string> | undefined)[]
|
|
26
|
+
): Record<string, string> {
|
|
27
|
+
const result: Record<string, string> = {};
|
|
28
|
+
|
|
29
|
+
definitions
|
|
30
|
+
.filter(definition => definition !== undefined)
|
|
31
|
+
.forEach(definition =>
|
|
32
|
+
Object.keys(definition).forEach(item => {
|
|
33
|
+
result[`import.meta.env.${item}`] = definition[item];
|
|
34
|
+
})
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function createPlugins(context: ViteBuildContext) {
|
|
41
|
+
const entries: [string, Plugin[] | Plugin | undefined][] = [
|
|
42
|
+
['html', htmlPlugin(context)],
|
|
43
|
+
['svgr', svgrPlugin(context)],
|
|
44
|
+
['externals', externalsPlugin(context)],
|
|
45
|
+
['virtualModules', virtualModulesPlugin(context)],
|
|
46
|
+
['cssInjector', cssInjectorPlugin(context)],
|
|
47
|
+
['styleUrls', styleUrlsPlugin(context)],
|
|
48
|
+
['metadata', metadataPlugin(context)],
|
|
49
|
+
['devServerRouting', devServerRoutingPlugin(context)],
|
|
50
|
+
['ignoreModules', ignoreModulesPlugin(context)],
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
return entries
|
|
54
|
+
.filter(
|
|
55
|
+
([name, plugin]) =>
|
|
56
|
+
plugin && !context.bundlerConfig.omitDefault?.includes(`plugins.${name}`)
|
|
57
|
+
)
|
|
58
|
+
.flatMap(([, plugin]) => plugin);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function createBaseConfig(context: ViteBuildContext): InlineConfig {
|
|
62
|
+
const { isProduction } = context.build;
|
|
63
|
+
const { isWebComponent } = context.package;
|
|
64
|
+
|
|
65
|
+
let config: InlineConfig = {
|
|
66
|
+
cacheDir: `node_modules/.vite/${getBundleType(context) ?? 'host'}`,
|
|
67
|
+
server: {
|
|
68
|
+
port: context.bundlerConfig.port ?? (isWebComponent ? 8888 : 8080),
|
|
69
|
+
warmup: {
|
|
70
|
+
// Pre-warms compiled files to avoid multiple page reloads at dev session start
|
|
71
|
+
clientFiles: [`${context.package.destination}/**/*.js`],
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
mode: isProduction ? bundleConstants.mode.production : bundleConstants.mode.development,
|
|
75
|
+
configFile: false,
|
|
76
|
+
oxc: { legalComments: 'none' },
|
|
77
|
+
base: './',
|
|
78
|
+
css: {
|
|
79
|
+
modules: {
|
|
80
|
+
localsConvention: bundleConstants.postcss.localsConvention,
|
|
81
|
+
generateScopedName: isProduction
|
|
82
|
+
? bundleConstants.postcss.classnameTemplate.production
|
|
83
|
+
: bundleConstants.postcss.classnameTemplate.development,
|
|
84
|
+
},
|
|
85
|
+
preprocessorOptions: {
|
|
86
|
+
less: { math: bundleConstants.less.math },
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
build: {
|
|
90
|
+
/*
|
|
91
|
+
* MFEs render inside shadow DOM — lazy CSS chunks would inject into document.head,
|
|
92
|
+
* leaking styles into the host. Bundling all CSS into one file avoids this.
|
|
93
|
+
*/
|
|
94
|
+
cssCodeSplit: !isWebComponent,
|
|
95
|
+
/*
|
|
96
|
+
* MFE bundle dirs (full/light/headless) are safe to clean — no shared deps inside.
|
|
97
|
+
* Host outDir (dist/bundle/) contains shared/, so cleaning would delete shared deps.
|
|
98
|
+
*/
|
|
99
|
+
emptyOutDir: isWebComponent,
|
|
100
|
+
outDir: getOutputPath(context),
|
|
101
|
+
sourcemap: true,
|
|
102
|
+
},
|
|
103
|
+
define: importMetaRemap(
|
|
104
|
+
defineExposedDependencies(context),
|
|
105
|
+
defineExposedInstanceDependencies(context),
|
|
106
|
+
defineWebComponentName(context)
|
|
107
|
+
),
|
|
108
|
+
optimizeDeps: {
|
|
109
|
+
include: ['@servicetitan/startup-utils'],
|
|
110
|
+
},
|
|
111
|
+
plugins: createPlugins(context),
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const omitKeys = context.bundlerConfig.omitDefault?.filter(k => !k.startsWith('plugins.'));
|
|
115
|
+
if (omitKeys?.length) {
|
|
116
|
+
config = omit({ ...config }, omitKeys);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (context.bundlerConfig.minify.js !== undefined) {
|
|
120
|
+
config.build = { ...config.build, minify: !!context.bundlerConfig.minify.js };
|
|
121
|
+
}
|
|
122
|
+
if (context.bundlerConfig.minify.css !== undefined) {
|
|
123
|
+
config.build = { ...config.build, cssMinify: !!context.bundlerConfig.minify.css };
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return config;
|
|
127
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { VitePackageJsonOverride } from '../../utils';
|
|
2
|
+
import { ViteBuildContext } from '../types';
|
|
3
|
+
import { BuildContext, ViteConfigFileOverride } from './define-config';
|
|
4
|
+
|
|
5
|
+
function createBundlerConfig(
|
|
6
|
+
packageJsonConfig: VitePackageJsonOverride,
|
|
7
|
+
fileConfig: ViteConfigFileOverride
|
|
8
|
+
): ViteBuildContext['bundlerConfig'] {
|
|
9
|
+
const {
|
|
10
|
+
port: pkgPort,
|
|
11
|
+
omitDefault: pkgOmit = [],
|
|
12
|
+
pluginOverrides: pkgPluginOverrides = {},
|
|
13
|
+
minify: pkgMinify = {},
|
|
14
|
+
} = packageJsonConfig;
|
|
15
|
+
const {
|
|
16
|
+
port: filePort,
|
|
17
|
+
omitDefault: fileOmit = [],
|
|
18
|
+
pluginOverrides: filePluginOverrides = {},
|
|
19
|
+
minify: fileMinify = {},
|
|
20
|
+
} = fileConfig;
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
port: filePort ?? pkgPort,
|
|
24
|
+
omitDefault: [...pkgOmit, ...fileOmit],
|
|
25
|
+
pluginOverrides: {
|
|
26
|
+
html: {
|
|
27
|
+
...pkgPluginOverrides.html,
|
|
28
|
+
...filePluginOverrides.html,
|
|
29
|
+
},
|
|
30
|
+
svgr: { ...pkgPluginOverrides.svgr, ...filePluginOverrides.svgr },
|
|
31
|
+
},
|
|
32
|
+
minify: { ...pkgMinify, ...fileMinify },
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function createViteBuildContext(
|
|
37
|
+
context: BuildContext,
|
|
38
|
+
pkgJsonConfig: VitePackageJsonOverride,
|
|
39
|
+
fileConfig: ViteConfigFileOverride
|
|
40
|
+
): ViteBuildContext {
|
|
41
|
+
return {
|
|
42
|
+
...context,
|
|
43
|
+
bundlerConfig: createBundlerConfig(pkgJsonConfig, fileConfig),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BuildContextOptions, createBuildContext, stringifyConfig } from '../../core';
|
|
2
|
+
import { getViteConfiguration, log } from '../../utils';
|
|
3
|
+
import { createBaseConfig } from './base-config';
|
|
4
|
+
import { createViteBuildContext } from './create-vite-build-context';
|
|
5
|
+
import { loadConfigFile } from './load-config-file';
|
|
6
|
+
import { mergeViteConfigs } from './merge-vite-configs';
|
|
7
|
+
|
|
8
|
+
export async function createViteConfig(options: BuildContextOptions) {
|
|
9
|
+
const context = createBuildContext(options);
|
|
10
|
+
const packageJsonConfig = getViteConfiguration();
|
|
11
|
+
const fileConfig = await loadConfigFile('./', context);
|
|
12
|
+
const viteContext = createViteBuildContext(context, packageJsonConfig, fileConfig);
|
|
13
|
+
const baseConfig = createBaseConfig(viteContext);
|
|
14
|
+
const finalConfig = mergeViteConfigs(baseConfig, packageJsonConfig, fileConfig);
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
* Background dev servers (light/headless) must use a random port to avoid
|
|
18
|
+
* conflicting with the full bundle's user-configured port.
|
|
19
|
+
*/
|
|
20
|
+
if (context.build.light || context.build.headless) {
|
|
21
|
+
finalConfig.server = { ...finalConfig.server, port: 0 };
|
|
22
|
+
} else if (!context.build.emitExposedDependencies) {
|
|
23
|
+
finalConfig.server = {
|
|
24
|
+
...finalConfig.server,
|
|
25
|
+
port: Number(process.env.PORT) || finalConfig.server?.port,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* istanbul ignore next: debug only */
|
|
30
|
+
log.debug('create-vite-config', () => stringifyConfig(finalConfig));
|
|
31
|
+
|
|
32
|
+
return finalConfig;
|
|
33
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { UserConfig } from 'vite';
|
|
2
|
+
import type { BuildContext } from '../../core/types';
|
|
3
|
+
import type { ViteBundlerConfig } from '../../utils/get-configuration';
|
|
4
|
+
|
|
5
|
+
export type { BuildContext };
|
|
6
|
+
export interface ViteConfigFileOverride extends ViteBundlerConfig {
|
|
7
|
+
config?: UserConfig;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Identity function that provides type checking and autocomplete for Vite
|
|
12
|
+
* config files (vite.dev.config.ts / vite.prod.config.ts). No-op at runtime.
|
|
13
|
+
*/
|
|
14
|
+
export function defineConfig<
|
|
15
|
+
T extends ViteConfigFileOverride | ((context: BuildContext) => ViteConfigFileOverride),
|
|
16
|
+
>(config: T): T {
|
|
17
|
+
return config;
|
|
18
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import crypto from 'crypto';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { rolldown } from 'rolldown'; // eslint-disable-line import/no-extraneous-dependencies
|
|
5
|
+
import type { BuildContext } from '../../core/types';
|
|
6
|
+
import type { ViteConfigFileOverride } from './define-config';
|
|
7
|
+
|
|
8
|
+
export async function loadConfigFile(
|
|
9
|
+
root: string,
|
|
10
|
+
context: BuildContext
|
|
11
|
+
): Promise<ViteConfigFileOverride> {
|
|
12
|
+
const baseName = context.build.isProduction ? 'vite.prod.config' : 'vite.dev.config';
|
|
13
|
+
const configPath = ['.ts', '.js']
|
|
14
|
+
.map(ext => path.join(root, baseName + ext))
|
|
15
|
+
.find(path => fs.existsSync(path));
|
|
16
|
+
|
|
17
|
+
if (!configPath) {
|
|
18
|
+
return {};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/*
|
|
22
|
+
* Write to node_modules/.startup/ so Node can resolve package imports
|
|
23
|
+
* relative to the project's node_modules. The leading dot follows the
|
|
24
|
+
* convention for tool-managed directories (like .cache, .vite) — npm
|
|
25
|
+
* ignores dotfiles inside node_modules. The directory persists after the
|
|
26
|
+
* temp file is cleaned up, avoiding re-creation on subsequent runs.
|
|
27
|
+
*/
|
|
28
|
+
const tmpDir = path.resolve(root, 'node_modules', '.startup');
|
|
29
|
+
fs.mkdirSync(tmpDir, { recursive: true });
|
|
30
|
+
const tmpFile = path.join(tmpDir, `vite-config-${crypto.randomUUID()}.cjs`);
|
|
31
|
+
|
|
32
|
+
const bundle = await rolldown({
|
|
33
|
+
input: configPath,
|
|
34
|
+
/*
|
|
35
|
+
* Externalize bare imports (node_modules) — only bundle relative files
|
|
36
|
+
* like ./vite.shared.ts. Rolldown calls external() twice per import: once
|
|
37
|
+
* with the original specifier (./foo) and once with the resolved absolute
|
|
38
|
+
* path (/Users/.../foo.ts or C:\...\foo.ts). Both must return false to
|
|
39
|
+
* keep the import internal.
|
|
40
|
+
*/
|
|
41
|
+
external: id => !id.startsWith('.') && !path.isAbsolute(id),
|
|
42
|
+
});
|
|
43
|
+
const code = (await bundle.generate({ format: 'cjs' })).output[0].code;
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
fs.writeFileSync(tmpFile, code);
|
|
47
|
+
const exported = (await import(tmpFile)).default;
|
|
48
|
+
return typeof exported === 'function' ? exported(context) : (exported ?? {});
|
|
49
|
+
} finally {
|
|
50
|
+
fs.unlinkSync(tmpFile);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { InlineConfig } from 'vite';
|
|
2
|
+
import { mergeConfig } from 'vite';
|
|
3
|
+
import type { VitePackageJsonOverride } from '../../utils/get-configuration';
|
|
4
|
+
import type { ViteConfigFileOverride } from './define-config';
|
|
5
|
+
|
|
6
|
+
export function mergeViteConfigs(
|
|
7
|
+
baseConfig: InlineConfig,
|
|
8
|
+
packageJsonConfig: VitePackageJsonOverride,
|
|
9
|
+
fileConfig: ViteConfigFileOverride
|
|
10
|
+
): InlineConfig {
|
|
11
|
+
return mergeConfig(
|
|
12
|
+
mergeConfig(baseConfig, packageJsonConfig.config ?? {}),
|
|
13
|
+
fileConfig.config ?? {}
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<title><%= it.title %></title>
|
|
6
|
+
<% if (it.favicon) { %>
|
|
7
|
+
<link rel="icon" href="<%= it.favicon %>" />
|
|
8
|
+
<% } %>
|
|
9
|
+
<% it.css.forEach(function(item) { %>
|
|
10
|
+
<link href="./<%= item %>" rel="stylesheet" />
|
|
11
|
+
<% }); %> <% it.js.forEach(function(item) { %>
|
|
12
|
+
<script src="./<%= item %>"></script>
|
|
13
|
+
<% }); %>
|
|
14
|
+
<script type="text/javascript">
|
|
15
|
+
<% if (it.isWebComponent) { %>
|
|
16
|
+
<% if (!it.isProduction) { %>
|
|
17
|
+
window.__mfeSelfHosted__ = true;
|
|
18
|
+
<% } %>
|
|
19
|
+
/* Simulate host initialization */
|
|
20
|
+
window.onload = () =>
|
|
21
|
+
document.querySelector('<%= it.name %>')?.provide({ onReady() {} });
|
|
22
|
+
<% } %>
|
|
23
|
+
</script>
|
|
24
|
+
</head>
|
|
25
|
+
<body>
|
|
26
|
+
<script type="module">
|
|
27
|
+
<% if (it.isWebComponent) { %>
|
|
28
|
+
import './index';
|
|
29
|
+
<% } else { %>
|
|
30
|
+
import './dist/index';
|
|
31
|
+
<% } %>
|
|
32
|
+
</script>
|
|
33
|
+
<% if (it.isWebComponent) { %><<%~ it.name %> style-urls="<%=
|
|
34
|
+
encodeURIComponent(JSON.stringify([])) %>" /><% } %>
|
|
35
|
+
</body>
|
|
36
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './config/define-config';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';
|
|
2
|
+
import type { BuildContext } from '../../../core';
|
|
3
|
+
import { cssInjectorPlugin } from '../css-injector-plugin';
|
|
4
|
+
|
|
5
|
+
jest.mock('vite-plugin-css-injected-by-js', () => jest.fn(() => [{ name: 'css-injected-by-js' }]));
|
|
6
|
+
|
|
7
|
+
describe(cssInjectorPlugin.name, () => {
|
|
8
|
+
let context: BuildContext;
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
context = {
|
|
12
|
+
build: { name: 'my-component', isProduction: false },
|
|
13
|
+
package: { isWebComponent: true },
|
|
14
|
+
} as BuildContext;
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const subject = () => cssInjectorPlugin(context);
|
|
18
|
+
|
|
19
|
+
test('returns plugins from css-injected-by-js', () => {
|
|
20
|
+
expect(subject()).toEqual([{ name: 'css-injected-by-js' }]);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test('passes component name as styleId', () => {
|
|
24
|
+
subject();
|
|
25
|
+
|
|
26
|
+
expect(cssInjectedByJsPlugin).toHaveBeenCalledWith(
|
|
27
|
+
expect.objectContaining({ styleId: context.build.name })
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('enables dev mode', () => {
|
|
32
|
+
subject();
|
|
33
|
+
|
|
34
|
+
expect(cssInjectedByJsPlugin).toHaveBeenCalledWith(
|
|
35
|
+
expect.objectContaining({ dev: { enableDev: true } })
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test('passes injectCodeFunction', () => {
|
|
40
|
+
subject();
|
|
41
|
+
|
|
42
|
+
const call = jest.mocked(cssInjectedByJsPlugin).mock.calls[0][0]!;
|
|
43
|
+
expect(call.injectCodeFunction).toBeInstanceOf(Function);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
describe('when package is not a web component', () => {
|
|
47
|
+
beforeEach(() => (context.package.isWebComponent = false));
|
|
48
|
+
|
|
49
|
+
test('returns empty array', () => {
|
|
50
|
+
expect(subject()).toEqual([]);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
describe('when build is production', () => {
|
|
55
|
+
beforeEach(() => (context.build.isProduction = true));
|
|
56
|
+
|
|
57
|
+
test('returns empty array', () => {
|
|
58
|
+
expect(subject()).toEqual([]);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
});
|