@servicetitan/startup 34.3.0-beta.2 → 35.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/commands/build.d.ts +0 -16
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +2 -15
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/bundle-package.d.ts.map +1 -1
- package/dist/cli/commands/bundle-package.js +0 -1
- package/dist/cli/commands/bundle-package.js.map +1 -1
- package/dist/cli/commands/get-command.js +2 -2
- 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.d.ts +10 -0
- package/dist/cli/commands/mfe-package-publish.d.ts.map +1 -1
- package/dist/cli/commands/mfe-package-publish.js +12 -0
- package/dist/cli/commands/mfe-package-publish.js.map +1 -1
- package/dist/cli/commands/mfe-package-rollback.d.ts +10 -1
- package/dist/cli/commands/mfe-package-rollback.d.ts.map +1 -1
- package/dist/cli/commands/mfe-package-rollback.js +15 -3
- package/dist/cli/commands/mfe-package-rollback.js.map +1 -1
- package/dist/cli/commands/mfe-publish.d.ts.map +1 -1
- package/dist/cli/commands/mfe-publish.js +10 -4
- package/dist/cli/commands/mfe-publish.js.map +1 -1
- package/dist/cli/commands/mfe-purge-cache.d.ts +57 -0
- package/dist/cli/commands/mfe-purge-cache.d.ts.map +1 -0
- package/dist/cli/commands/mfe-purge-cache.js +101 -0
- package/dist/cli/commands/mfe-purge-cache.js.map +1 -0
- package/dist/cli/commands/start.d.ts +0 -8
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +2 -8
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/{utils.d.ts → utils/build-rollback-tag.d.ts} +1 -2
- package/dist/cli/commands/utils/build-rollback-tag.d.ts.map +1 -0
- package/dist/cli/commands/{utils.js → utils/build-rollback-tag.js} +1 -5
- package/dist/cli/commands/utils/build-rollback-tag.js.map +1 -0
- package/dist/cli/commands/utils/constants.d.ts +2 -0
- package/dist/cli/commands/utils/constants.d.ts.map +1 -0
- package/dist/cli/commands/utils/constants.js +13 -0
- package/dist/cli/commands/utils/constants.js.map +1 -0
- package/dist/cli/commands/utils/index.d.ts +4 -0
- package/dist/cli/commands/utils/index.d.ts.map +1 -0
- package/dist/{core → cli/commands/utils}/index.js +3 -7
- package/dist/cli/commands/utils/index.js.map +1 -0
- package/dist/cli/commands/utils/purge-cache.d.ts +6 -0
- package/dist/cli/commands/utils/purge-cache.d.ts.map +1 -0
- package/dist/cli/commands/utils/purge-cache.js +21 -0
- package/dist/cli/commands/utils/purge-cache.js.map +1 -0
- package/dist/cli/utils/bundle.d.ts +5 -2
- package/dist/cli/utils/bundle.d.ts.map +1 -1
- package/dist/cli/utils/bundle.js +98 -18
- package/dist/cli/utils/bundle.js.map +1 -1
- package/dist/cli/utils/cli-os.js +1 -1
- package/dist/cli/utils/cli-os.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -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 +6 -18
- package/dist/storybook-config/webpack-final.js.map +1 -1
- package/dist/utils/get-configuration.d.ts +1 -28
- package/dist/utils/get-configuration.d.ts.map +1 -1
- package/dist/utils/get-configuration.js +2 -42
- 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 +2 -3
- package/dist/utils/get-package-data.js.map +1 -1
- package/dist/webpack/configs/amd-config.d.ts +2 -3
- 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 +2 -3
- 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 -3
- 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 +2 -3
- 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 +2 -3
- package/dist/webpack/configs/entry.config.d.ts.map +1 -1
- package/dist/webpack/configs/entry.config.js +5 -6
- package/dist/webpack/configs/entry.config.js.map +1 -1
- package/dist/webpack/configs/externals-config.d.ts +2 -3
- package/dist/webpack/configs/externals-config.d.ts.map +1 -1
- package/dist/webpack/configs/externals-config.js +14 -4
- package/dist/webpack/configs/externals-config.js.map +1 -1
- package/dist/webpack/configs/index.d.ts +1 -0
- 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 +1 -2
- 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 +1 -4
- package/dist/webpack/configs/loaders/style-loader.js.map +1 -1
- package/dist/webpack/configs/module-config.d.ts +2 -3
- 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 -3
- package/dist/webpack/configs/optimization-config.d.ts.map +1 -1
- package/dist/webpack/configs/optimization-config.js +7 -10
- package/dist/webpack/configs/optimization-config.js.map +1 -1
- package/dist/webpack/configs/output-config.d.ts +2 -3
- package/dist/webpack/configs/output-config.d.ts.map +1 -1
- package/dist/webpack/configs/output-config.js +24 -15
- package/dist/webpack/configs/output-config.js.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts +8 -3
- package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js +47 -10
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.d.ts +2 -3
- 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 +2 -3
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js +13 -4
- 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 +2 -3
- 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 +12 -4
- 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 +2 -3
- 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 +6 -4
- package/dist/webpack/configs/plugins/define-web-component-name-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/filter-warnings-plugin.d.ts +2 -3
- 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 +2 -3
- package/dist/webpack/configs/plugins/html-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/html-plugin.js +2 -5
- package/dist/webpack/configs/plugins/html-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/html-tags-plugin.d.ts +2 -3
- package/dist/webpack/configs/plugins/html-tags-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/html-tags-plugin.js +19 -8
- package/dist/webpack/configs/plugins/html-tags-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.d.ts +3 -0
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.d.ts.map +1 -0
- package/dist/{core/check-resource → webpack/configs/plugins/ignore-plugin}/check-resource.js +2 -2
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.js.map +1 -0
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.d.ts.map +1 -0
- package/dist/{core/check-resource → webpack/configs/plugins/ignore-plugin}/get-package-json.js +2 -2
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.js.map +1 -0
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts +3 -17
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js +6 -45
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.d.ts.map +1 -0
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.js.map +1 -0
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-react-dom-peer-dependency.d.ts.map +1 -0
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-react-dom-peer-dependency.js.map +1 -0
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.d.ts +2 -3
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.js +2 -4
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/moment-locales-plugin.d.ts +2 -3
- 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 +2 -3
- 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 +56 -13
- package/dist/webpack/configs/plugins/virtual-modules-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/watch-run-plugin.d.ts +2 -3
- 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 +2 -3
- 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 +2 -3
- 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 +1 -2
- 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 +1 -3
- 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 -3
- 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 +2 -3
- 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/types.d.ts +35 -0
- package/dist/webpack/configs/types.d.ts.map +1 -0
- package/dist/webpack/configs/types.js.map +1 -0
- package/dist/webpack/configs/utils/build-metadata.d.ts.map +1 -0
- package/dist/{core → webpack/configs}/utils/build-metadata.js +1 -1
- package/dist/webpack/configs/utils/build-metadata.js.map +1 -0
- package/dist/webpack/configs/utils/generate-metadata.d.ts +3 -0
- package/dist/webpack/configs/utils/generate-metadata.d.ts.map +1 -0
- package/dist/{core → webpack/configs}/utils/generate-metadata.js +4 -5
- package/dist/webpack/configs/utils/generate-metadata.js.map +1 -0
- package/dist/webpack/configs/utils/get-bundle-type.d.ts +3 -0
- package/dist/webpack/configs/utils/get-bundle-type.d.ts.map +1 -0
- package/dist/{core → webpack/configs}/utils/get-bundle-type.js +2 -5
- package/dist/webpack/configs/utils/get-bundle-type.js.map +1 -0
- package/dist/webpack/configs/utils/get-exposed-dependencies.d.ts.map +1 -0
- package/dist/webpack/configs/utils/get-exposed-dependencies.js.map +1 -0
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.d.ts.map +1 -0
- package/dist/{core → webpack/configs}/utils/get-launchdarkly-sdk-version.js +1 -1
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.js.map +1 -0
- package/dist/webpack/configs/utils/get-web-components-version.d.ts.map +1 -0
- package/dist/{core → webpack/configs}/utils/get-web-components-version.js +1 -1
- package/dist/webpack/configs/utils/get-web-components-version.js.map +1 -0
- package/dist/webpack/configs/utils/index.d.ts +4 -0
- package/dist/webpack/configs/utils/index.d.ts.map +1 -0
- package/dist/{core → webpack/configs}/utils/index.js +0 -5
- package/dist/webpack/configs/utils/index.js.map +1 -0
- 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 +0 -10
- package/dist/webpack/create-webpack-config.d.ts.map +1 -1
- package/dist/webpack/create-webpack-config.js +41 -108
- package/dist/webpack/create-webpack-config.js.map +1 -1
- package/dist/webpack/types.d.ts +11 -4
- package/dist/webpack/types.d.ts.map +1 -1
- package/dist/webpack/utils/index.d.ts +1 -0
- package/dist/webpack/utils/index.d.ts.map +1 -1
- package/dist/webpack/utils/index.js +1 -0
- package/dist/webpack/utils/index.js.map +1 -1
- package/dist/webpack/utils/stringify-config.d.ts.map +1 -0
- package/dist/webpack/utils/stringify-config.js.map +1 -0
- package/package.json +16 -19
- package/src/cli/commands/__tests__/mfe-generate-metadata.test.ts +4 -3
- package/src/cli/commands/__tests__/mfe-package-publish.test.ts +27 -1
- package/src/cli/commands/__tests__/mfe-package-rollback.test.ts +31 -0
- package/src/cli/commands/__tests__/mfe-publish.test.ts +4 -2
- package/src/cli/commands/__tests__/mfe-purge-cache.test.ts +141 -0
- package/src/cli/commands/build.ts +2 -7
- package/src/cli/commands/bundle-package.ts +1 -3
- package/src/cli/commands/get-command.ts +2 -2
- package/src/cli/commands/mfe-check.ts +2 -1
- package/src/cli/commands/mfe-generate-metadata.ts +1 -1
- package/src/cli/commands/mfe-package-publish.ts +12 -2
- package/src/cli/commands/mfe-package-rollback.ts +15 -5
- package/src/cli/commands/mfe-publish.ts +14 -3
- package/src/cli/commands/mfe-purge-cache.ts +75 -0
- package/src/cli/commands/start.ts +2 -5
- package/src/cli/commands/utils/__tests__/purge-cache.test.ts +40 -0
- package/src/cli/commands/{utils.ts → utils/build-rollback-tag.ts} +0 -1
- package/src/cli/commands/utils/constants.ts +1 -0
- package/src/cli/commands/utils/index.ts +3 -0
- package/src/cli/commands/utils/purge-cache.ts +13 -0
- package/src/cli/utils/__tests__/bundle.test.ts +10 -19
- package/src/cli/utils/bundle.ts +101 -20
- package/src/cli/utils/cli-os.ts +1 -1
- package/src/index.ts +0 -1
- package/src/storybook-config/__tests__/webpack-final.test.ts +2 -5
- package/src/storybook-config/webpack-final.ts +10 -24
- package/src/utils/__tests__/get-configuration.test.ts +1 -99
- package/src/utils/__tests__/get-package-data.test.ts +1 -35
- package/src/utils/get-configuration.ts +2 -92
- package/src/utils/get-package-data.ts +1 -3
- 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 +2 -3
- package/src/webpack/configs/amd-config.ts +2 -3
- package/src/webpack/configs/cache-config.ts +3 -4
- package/src/webpack/configs/dev-server-config.ts +3 -8
- package/src/webpack/configs/devtool-config.ts +3 -4
- package/src/webpack/configs/entry.config.ts +7 -8
- package/src/webpack/configs/externals-config.ts +21 -5
- package/src/webpack/configs/index.ts +1 -0
- package/src/webpack/configs/loaders/css-loader.ts +2 -3
- package/src/webpack/configs/loaders/style-loader.ts +5 -5
- package/src/webpack/configs/module-config.ts +2 -3
- package/src/webpack/configs/optimization-config.ts +11 -16
- package/src/webpack/configs/output-config.ts +22 -16
- package/src/webpack/configs/plugins/assets-manifest-plugin.ts +36 -9
- package/src/webpack/configs/plugins/bundle-analyser-plugin.ts +8 -8
- package/src/webpack/configs/plugins/define-exposed-dependencies-plugin.ts +15 -7
- package/src/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.ts +13 -7
- package/src/webpack/configs/plugins/define-web-component-name-plugin.ts +8 -7
- package/src/webpack/configs/plugins/filter-warnings-plugin.ts +3 -4
- package/src/webpack/configs/plugins/html-plugin.ts +6 -7
- package/src/webpack/configs/plugins/html-tags-plugin.ts +16 -7
- package/src/{core/check-resource → webpack/configs/plugins/ignore-plugin}/__tests__/check-resource.test.ts +5 -18
- package/src/{core/check-resource → webpack/configs/plugins/ignore-plugin}/check-resource.ts +4 -4
- package/src/{core/check-resource → webpack/configs/plugins/ignore-plugin}/get-package-json.ts +2 -2
- package/src/webpack/configs/plugins/ignore-plugin/ignore-plugin.ts +6 -48
- package/src/webpack/configs/plugins/mini-css-extract-plugin.ts +5 -10
- package/src/webpack/configs/plugins/moment-locales-plugin.ts +2 -3
- package/src/webpack/configs/plugins/remove-empty-scripts-plugin.ts +3 -4
- package/src/webpack/configs/plugins/virtual-modules-plugin.ts +65 -13
- package/src/webpack/configs/plugins/watch-run-plugin.ts +2 -3
- package/src/webpack/configs/plugins-config.ts +2 -3
- package/src/webpack/configs/resolve-config.ts +2 -3
- package/src/webpack/configs/rules/css-rules.ts +3 -4
- 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 +2 -4
- 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 +5 -9
- package/src/webpack/configs/stats-config.ts +2 -3
- package/src/webpack/configs/types.ts +38 -0
- package/src/{core → webpack/configs}/utils/__tests__/build-metadata.test.ts +2 -2
- package/src/{core → webpack/configs}/utils/__tests__/generate-metadata.test.ts +13 -27
- package/src/{core → webpack/configs}/utils/build-metadata.ts +1 -1
- package/src/{core → webpack/configs}/utils/generate-metadata.ts +6 -7
- package/src/webpack/configs/utils/get-bundle-type.ts +22 -0
- package/src/{core → webpack/configs}/utils/get-launchdarkly-sdk-version.ts +1 -1
- package/src/{core → webpack/configs}/utils/get-web-components-version.ts +1 -1
- package/src/webpack/configs/utils/index.ts +3 -0
- package/src/webpack/configs/watch-options-config.ts +3 -3
- package/src/webpack/create-webpack-config.ts +43 -85
- package/src/webpack/types.ts +11 -7
- package/src/webpack/utils/index.ts +1 -0
- package/dist/cli/commands/bundle-vite.d.ts +0 -66
- package/dist/cli/commands/bundle-vite.d.ts.map +0 -1
- package/dist/cli/commands/bundle-vite.js +0 -184
- package/dist/cli/commands/bundle-vite.js.map +0 -1
- package/dist/cli/commands/utils.d.ts.map +0 -1
- package/dist/cli/commands/utils.js.map +0 -1
- package/dist/core/check-resource/check-resource.d.ts +0 -3
- package/dist/core/check-resource/check-resource.d.ts.map +0 -1
- package/dist/core/check-resource/check-resource.js.map +0 -1
- package/dist/core/check-resource/get-package-json.d.ts.map +0 -1
- package/dist/core/check-resource/get-package-json.js.map +0 -1
- package/dist/core/check-resource/index.d.ts +0 -2
- package/dist/core/check-resource/index.d.ts.map +0 -1
- package/dist/core/check-resource/index.js +0 -13
- package/dist/core/check-resource/index.js.map +0 -1
- package/dist/core/check-resource/is-optional-peer-dependency.d.ts.map +0 -1
- package/dist/core/check-resource/is-optional-peer-dependency.js.map +0 -1
- package/dist/core/check-resource/is-optional-react-dom-peer-dependency.d.ts.map +0 -1
- package/dist/core/check-resource/is-optional-react-dom-peer-dependency.js.map +0 -1
- package/dist/core/context.d.ts +0 -14
- package/dist/core/context.d.ts.map +0 -1
- package/dist/core/context.js +0 -62
- package/dist/core/context.js.map +0 -1
- package/dist/core/defines/exposed-dependencies.d.ts +0 -5
- package/dist/core/defines/exposed-dependencies.d.ts.map +0 -1
- package/dist/core/defines/exposed-dependencies.js +0 -26
- package/dist/core/defines/exposed-dependencies.js.map +0 -1
- package/dist/core/defines/exposed-instance-dependencies.d.ts +0 -5
- package/dist/core/defines/exposed-instance-dependencies.d.ts.map +0 -1
- package/dist/core/defines/exposed-instance-dependencies.js +0 -29
- package/dist/core/defines/exposed-instance-dependencies.js.map +0 -1
- package/dist/core/defines/index.d.ts +0 -4
- package/dist/core/defines/index.d.ts.map +0 -1
- package/dist/core/defines/index.js +0 -26
- package/dist/core/defines/index.js.map +0 -1
- package/dist/core/defines/web-component-name.d.ts +0 -5
- package/dist/core/defines/web-component-name.d.ts.map +0 -1
- package/dist/core/defines/web-component-name.js +0 -23
- package/dist/core/defines/web-component-name.js.map +0 -1
- package/dist/core/externals.d.ts +0 -3
- package/dist/core/externals.d.ts.map +0 -1
- package/dist/core/externals.js +0 -29
- package/dist/core/externals.js.map +0 -1
- package/dist/core/get-exposed-dependencies-entry-points.d.ts +0 -11
- package/dist/core/get-exposed-dependencies-entry-points.d.ts.map +0 -1
- package/dist/core/get-exposed-dependencies-entry-points.js +0 -82
- package/dist/core/get-exposed-dependencies-entry-points.js.map +0 -1
- package/dist/core/index.d.ts +0 -9
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/core/types.d.ts +0 -55
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/types.js.map +0 -1
- package/dist/core/utils/build-metadata.d.ts.map +0 -1
- package/dist/core/utils/build-metadata.js.map +0 -1
- package/dist/core/utils/generate-metadata.d.ts +0 -3
- package/dist/core/utils/generate-metadata.d.ts.map +0 -1
- package/dist/core/utils/generate-metadata.js.map +0 -1
- package/dist/core/utils/get-bundle-type.d.ts +0 -3
- package/dist/core/utils/get-bundle-type.d.ts.map +0 -1
- package/dist/core/utils/get-bundle-type.js.map +0 -1
- package/dist/core/utils/get-exposed-dependencies.d.ts.map +0 -1
- package/dist/core/utils/get-exposed-dependencies.js.map +0 -1
- package/dist/core/utils/get-launchdarkly-sdk-version.d.ts.map +0 -1
- package/dist/core/utils/get-launchdarkly-sdk-version.js.map +0 -1
- package/dist/core/utils/get-output-path.d.ts +0 -3
- package/dist/core/utils/get-output-path.d.ts.map +0 -1
- package/dist/core/utils/get-output-path.js +0 -32
- package/dist/core/utils/get-output-path.js.map +0 -1
- package/dist/core/utils/get-web-components-version.d.ts.map +0 -1
- package/dist/core/utils/get-web-components-version.js.map +0 -1
- package/dist/core/utils/index.d.ts +0 -9
- package/dist/core/utils/index.d.ts.map +0 -1
- package/dist/core/utils/index.js.map +0 -1
- package/dist/core/utils/stringify-config.d.ts.map +0 -1
- package/dist/core/utils/stringify-config.js.map +0 -1
- package/dist/core/virtual-modules.d.ts +0 -9
- package/dist/core/virtual-modules.d.ts.map +0 -1
- package/dist/core/virtual-modules.js +0 -84
- package/dist/core/virtual-modules.js.map +0 -1
- package/dist/vite/base-config.d.ts +0 -4
- package/dist/vite/base-config.d.ts.map +0 -1
- package/dist/vite/base-config.js +0 -76
- package/dist/vite/base-config.js.map +0 -1
- package/dist/vite/build-shared-deps.d.ts +0 -3
- package/dist/vite/build-shared-deps.d.ts.map +0 -1
- package/dist/vite/build-shared-deps.js +0 -310
- package/dist/vite/build-shared-deps.js.map +0 -1
- package/dist/vite/create-vite-config.d.ts +0 -3
- package/dist/vite/create-vite-config.d.ts.map +0 -1
- package/dist/vite/create-vite-config.js +0 -52
- package/dist/vite/create-vite-config.js.map +0 -1
- package/dist/vite/define-config.d.ts +0 -12
- package/dist/vite/define-config.d.ts.map +0 -1
- package/dist/vite/define-config.js +0 -15
- package/dist/vite/define-config.js.map +0 -1
- package/dist/vite/load-config-file.d.ts +0 -6
- package/dist/vite/load-config-file.d.ts.map +0 -1
- package/dist/vite/load-config-file.js +0 -107
- package/dist/vite/load-config-file.js.map +0 -1
- package/dist/vite/merge-config.d.ts +0 -6
- package/dist/vite/merge-config.d.ts.map +0 -1
- package/dist/vite/merge-config.js +0 -106
- package/dist/vite/merge-config.js.map +0 -1
- package/dist/vite/plugins/css-injector-plugin.d.ts +0 -15
- package/dist/vite/plugins/css-injector-plugin.d.ts.map +0 -1
- package/dist/vite/plugins/css-injector-plugin.js +0 -76
- package/dist/vite/plugins/css-injector-plugin.js.map +0 -1
- package/dist/vite/plugins/dev-server-routing-plugin.d.ts +0 -12
- package/dist/vite/plugins/dev-server-routing-plugin.d.ts.map +0 -1
- package/dist/vite/plugins/dev-server-routing-plugin.js +0 -85
- package/dist/vite/plugins/dev-server-routing-plugin.js.map +0 -1
- package/dist/vite/plugins/externals-plugin.d.ts +0 -4
- package/dist/vite/plugins/externals-plugin.d.ts.map +0 -1
- package/dist/vite/plugins/externals-plugin.js +0 -39
- package/dist/vite/plugins/externals-plugin.js.map +0 -1
- package/dist/vite/plugins/html-plugin.d.ts +0 -5
- package/dist/vite/plugins/html-plugin.d.ts.map +0 -1
- package/dist/vite/plugins/html-plugin.js +0 -74
- package/dist/vite/plugins/html-plugin.js.map +0 -1
- package/dist/vite/plugins/ignore-modules-plugin.d.ts +0 -4
- package/dist/vite/plugins/ignore-modules-plugin.d.ts.map +0 -1
- package/dist/vite/plugins/ignore-modules-plugin.js +0 -30
- package/dist/vite/plugins/ignore-modules-plugin.js.map +0 -1
- package/dist/vite/plugins/index.d.ts +0 -10
- package/dist/vite/plugins/index.d.ts.map +0 -1
- package/dist/vite/plugins/index.js +0 -28
- package/dist/vite/plugins/index.js.map +0 -1
- package/dist/vite/plugins/metadata-plugin.d.ts +0 -4
- package/dist/vite/plugins/metadata-plugin.d.ts.map +0 -1
- package/dist/vite/plugins/metadata-plugin.js +0 -86
- package/dist/vite/plugins/metadata-plugin.js.map +0 -1
- package/dist/vite/plugins/style-urls-plugin.d.ts +0 -4
- package/dist/vite/plugins/style-urls-plugin.d.ts.map +0 -1
- package/dist/vite/plugins/style-urls-plugin.js +0 -29
- package/dist/vite/plugins/style-urls-plugin.js.map +0 -1
- package/dist/vite/plugins/svgr-plugin.d.ts +0 -4
- package/dist/vite/plugins/svgr-plugin.d.ts.map +0 -1
- package/dist/vite/plugins/svgr-plugin.js +0 -31
- package/dist/vite/plugins/svgr-plugin.js.map +0 -1
- package/dist/vite/plugins/virtual-modules-plugin.d.ts +0 -4
- package/dist/vite/plugins/virtual-modules-plugin.d.ts.map +0 -1
- package/dist/vite/plugins/virtual-modules-plugin.js +0 -71
- package/dist/vite/plugins/virtual-modules-plugin.js.map +0 -1
- package/patches/vite-plugin-css-injected-by-js+3.5.2.patch +0 -63
- package/src/cli/commands/bundle-vite.ts +0 -112
- package/src/core/check-resource/index.ts +0 -1
- package/src/core/context.ts +0 -65
- package/src/core/defines/exposed-dependencies.ts +0 -21
- package/src/core/defines/exposed-instance-dependencies.ts +0 -19
- package/src/core/defines/index.ts +0 -3
- package/src/core/defines/web-component-name.ts +0 -15
- package/src/core/externals.ts +0 -23
- package/src/core/get-exposed-dependencies-entry-points.ts +0 -59
- package/src/core/index.ts +0 -8
- package/src/core/types.ts +0 -59
- package/src/core/utils/get-bundle-type.ts +0 -20
- package/src/core/utils/get-output-path.ts +0 -18
- package/src/core/utils/index.ts +0 -8
- package/src/core/virtual-modules.ts +0 -76
- package/src/vite/__tests__/define-config.test.ts +0 -13
- package/src/vite/__tests__/load-config-file.test.ts +0 -115
- package/src/vite/__tests__/merge-config.test.ts +0 -173
- package/src/vite/base-config.ts +0 -79
- package/src/vite/build-shared-deps.ts +0 -320
- package/src/vite/create-vite-config.ts +0 -50
- package/src/vite/define-config.ts +0 -20
- package/src/vite/index.html +0 -29
- package/src/vite/load-config-file.ts +0 -54
- package/src/vite/merge-config.ts +0 -93
- package/src/vite/plugins/css-injector-plugin.ts +0 -85
- package/src/vite/plugins/dev-server-routing-plugin.ts +0 -89
- package/src/vite/plugins/externals-plugin.ts +0 -27
- package/src/vite/plugins/html-plugin.ts +0 -65
- package/src/vite/plugins/ignore-modules-plugin.ts +0 -22
- package/src/vite/plugins/index.ts +0 -9
- package/src/vite/plugins/metadata-plugin.ts +0 -78
- package/src/vite/plugins/style-urls-plugin.ts +0 -34
- package/src/vite/plugins/svgr-plugin.ts +0 -11
- package/src/vite/plugins/virtual-modules-plugin.ts +0 -74
- package/src/webpack/configs/plugins/ignore-plugin/empty-module.js +0 -1
- /package/dist/{core/check-resource → webpack/configs/plugins/ignore-plugin}/get-package-json.d.ts +0 -0
- /package/dist/{core/check-resource → webpack/configs/plugins/ignore-plugin}/is-optional-peer-dependency.d.ts +0 -0
- /package/dist/{core/check-resource → webpack/configs/plugins/ignore-plugin}/is-optional-peer-dependency.js +0 -0
- /package/dist/{core/check-resource → webpack/configs/plugins/ignore-plugin}/is-optional-react-dom-peer-dependency.d.ts +0 -0
- /package/dist/{core/check-resource → webpack/configs/plugins/ignore-plugin}/is-optional-react-dom-peer-dependency.js +0 -0
- /package/dist/{core → webpack/configs}/types.js +0 -0
- /package/dist/{core → webpack/configs}/utils/build-metadata.d.ts +0 -0
- /package/dist/{core → webpack/configs}/utils/get-exposed-dependencies.d.ts +0 -0
- /package/dist/{core → webpack/configs}/utils/get-exposed-dependencies.js +0 -0
- /package/dist/{core → webpack/configs}/utils/get-launchdarkly-sdk-version.d.ts +0 -0
- /package/dist/{core → webpack/configs}/utils/get-web-components-version.d.ts +0 -0
- /package/dist/{core → webpack}/utils/stringify-config.d.ts +0 -0
- /package/dist/{core → webpack}/utils/stringify-config.js +0 -0
- /package/src/{core/check-resource → webpack/configs/plugins/ignore-plugin}/__tests__/get-package-json.test.ts +0 -0
- /package/src/{core/check-resource → webpack/configs/plugins/ignore-plugin}/__tests__/is-optional-peer-dependency.test.ts +0 -0
- /package/src/{core/check-resource → webpack/configs/plugins/ignore-plugin}/__tests__/is-optional-react-dom-peer-dependency.test.ts +0 -0
- /package/src/{core/check-resource → webpack/configs/plugins/ignore-plugin}/is-optional-peer-dependency.ts +0 -0
- /package/src/{core/check-resource → webpack/configs/plugins/ignore-plugin}/is-optional-react-dom-peer-dependency.ts +0 -0
- /package/src/{core → webpack/configs}/utils/__tests__/get-exposed-dependencies.test.ts +0 -0
- /package/src/{core → webpack/configs}/utils/__tests__/get-launchdarkly-sdk-version.test.ts +0 -0
- /package/src/{core → webpack/configs}/utils/__tests__/get-web-components-version.test.ts +0 -0
- /package/src/{core → webpack/configs}/utils/get-exposed-dependencies.ts +0 -0
- /package/src/{core → webpack}/utils/stringify-config.ts +0 -0
|
@@ -1,173 +0,0 @@
|
|
|
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
|
-
});
|
package/src/vite/base-config.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
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
|
-
css: {
|
|
49
|
-
modules: {
|
|
50
|
-
localsConvention: 'camelCaseOnly',
|
|
51
|
-
generateScopedName: isProduction ? '[local]__[hash:base64:5]' : '[local]',
|
|
52
|
-
},
|
|
53
|
-
preprocessorOptions: {
|
|
54
|
-
less: { math: 'always' },
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
build: {
|
|
58
|
-
outDir: getOutputPath(context),
|
|
59
|
-
// Preserves shared deps in dist/bundle/shared/ when host rebuilds into dist/bundle/
|
|
60
|
-
emptyOutDir: false,
|
|
61
|
-
sourcemap: true,
|
|
62
|
-
commonjsOptions: {
|
|
63
|
-
include: [
|
|
64
|
-
// TODO: move to config override
|
|
65
|
-
/startup-utils/,
|
|
66
|
-
/\/node_modules\//,
|
|
67
|
-
],
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
define: importMetaRemap(
|
|
71
|
-
defineExposedDependencies(context),
|
|
72
|
-
defineExposedInstanceDependencies(context),
|
|
73
|
-
defineWebComponentName(context)
|
|
74
|
-
),
|
|
75
|
-
optimizeDeps: {
|
|
76
|
-
include: ['@servicetitan/startup-utils'],
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
}
|
|
@@ -1,320 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
}
|
package/src/vite/index.html
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
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>
|