@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,112 +0,0 @@
|
|
|
1
|
-
import { build, createServer, preview as previewServer } from 'vite';
|
|
2
|
-
import { CreateBuildContextInput, getName, stringifyConfig } from '../../core';
|
|
3
|
-
import {
|
|
4
|
-
hasHeadlessBundle,
|
|
5
|
-
isExposeSharedDependencies,
|
|
6
|
-
isWebComponent,
|
|
7
|
-
log,
|
|
8
|
-
logErrors,
|
|
9
|
-
validateSharedDependenciesConsistency,
|
|
10
|
-
validateSharedDependenciesMigration,
|
|
11
|
-
} from '../../utils';
|
|
12
|
-
import { buildSharedDeps } from '../../vite/build-shared-deps';
|
|
13
|
-
import { createViteConfig } from '../../vite/create-vite-config';
|
|
14
|
-
import { Command, CommandOptions } from './types';
|
|
15
|
-
|
|
16
|
-
const options = {
|
|
17
|
-
codeCoverage: { boolean: true, hidden: true },
|
|
18
|
-
exposedDependencies: { boolean: true, hidden: true },
|
|
19
|
-
preview: { boolean: true, hidden: true },
|
|
20
|
-
printConfig: { boolean: true, hidden: true },
|
|
21
|
-
stat: { boolean: true, hidden: true },
|
|
22
|
-
useWatchConfig: { boolean: true, hidden: true },
|
|
23
|
-
watch: { boolean: true, hidden: true },
|
|
24
|
-
} satisfies CommandOptions;
|
|
25
|
-
|
|
26
|
-
export class BundleVite extends Command<typeof options> {
|
|
27
|
-
static readonly options = options;
|
|
28
|
-
@logErrors
|
|
29
|
-
async execute() {
|
|
30
|
-
validateSharedDependenciesConsistency();
|
|
31
|
-
validateSharedDependenciesMigration();
|
|
32
|
-
|
|
33
|
-
const { preview = false, useWatchConfig = false, watch = false } = this.args;
|
|
34
|
-
const isProduction = !(watch || useWatchConfig);
|
|
35
|
-
|
|
36
|
-
const baseInput: CreateBuildContextInput = {
|
|
37
|
-
name: getName(),
|
|
38
|
-
isProduction,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
if (this.args.printConfig) {
|
|
42
|
-
const config = await createViteConfig(baseInput);
|
|
43
|
-
log.text(stringifyConfig(config));
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (this.args.exposedDependencies) {
|
|
48
|
-
if (watch) {
|
|
49
|
-
throw new Error('cannot bundle exposed dependencies in watch mode');
|
|
50
|
-
}
|
|
51
|
-
if (!isExposeSharedDependencies()) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
await buildSharedDeps(baseInput);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (isWebComponent()) {
|
|
59
|
-
if (watch) {
|
|
60
|
-
/*
|
|
61
|
-
* Start dev servers sequentially to avoid I/O contention during startup.
|
|
62
|
-
* Full first — it serves metadata.json and the standalone MFE dev page.
|
|
63
|
-
*/
|
|
64
|
-
await buildAndServe(baseInput, { watch, preview });
|
|
65
|
-
await buildAndServe({ ...baseInput, light: true }, { watch });
|
|
66
|
-
if (hasHeadlessBundle()) {
|
|
67
|
-
await buildAndServe({ ...baseInput, headless: true }, { watch });
|
|
68
|
-
}
|
|
69
|
-
} else {
|
|
70
|
-
// TODO: test if sequential is faster
|
|
71
|
-
await Promise.all([
|
|
72
|
-
buildAndServe(baseInput, { watch, preview }),
|
|
73
|
-
buildAndServe({ ...baseInput, light: true }, { watch }),
|
|
74
|
-
hasHeadlessBundle() &&
|
|
75
|
-
buildAndServe({ ...baseInput, headless: true }, { watch }),
|
|
76
|
-
]);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
await buildAndServe(baseInput, { watch, preview });
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
async function buildAndServe(
|
|
87
|
-
input: CreateBuildContextInput,
|
|
88
|
-
{ watch, preview = false }: { watch: boolean; preview?: boolean }
|
|
89
|
-
): Promise<void> {
|
|
90
|
-
const config = await createViteConfig(input);
|
|
91
|
-
|
|
92
|
-
// TODO: look into isDevServerDisabled webpack's counterpart
|
|
93
|
-
if (watch) {
|
|
94
|
-
await serve(config);
|
|
95
|
-
} else {
|
|
96
|
-
await build(config);
|
|
97
|
-
|
|
98
|
-
if (preview) {
|
|
99
|
-
await serve({ ...config, preview: { port: config.server?.port, open: true } }, true);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
async function serve(config: import('vite').InlineConfig, preview = false) {
|
|
105
|
-
const server = preview ? await previewServer(config) : await createServer(config);
|
|
106
|
-
if ('listen' in server) {
|
|
107
|
-
await server.listen();
|
|
108
|
-
}
|
|
109
|
-
server.printUrls();
|
|
110
|
-
server.bindCLIShortcuts({ print: true });
|
|
111
|
-
return server;
|
|
112
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { checkResource } from './check-resource';
|
package/src/core/context.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import crypto from 'crypto';
|
|
2
|
-
import {
|
|
3
|
-
getFolders,
|
|
4
|
-
getPackageData,
|
|
5
|
-
getPackageName,
|
|
6
|
-
isExposeSharedDependencies,
|
|
7
|
-
isLegacyRoot,
|
|
8
|
-
isWebComponent,
|
|
9
|
-
loadSharedDependencies,
|
|
10
|
-
} from '../utils';
|
|
11
|
-
import { BuildContext, BundlerConfig } from './types';
|
|
12
|
-
export type { BuildContext } from './types';
|
|
13
|
-
|
|
14
|
-
export interface CreateBuildContextInput {
|
|
15
|
-
name: string;
|
|
16
|
-
isProduction: boolean;
|
|
17
|
-
light?: boolean;
|
|
18
|
-
headless?: boolean;
|
|
19
|
-
codeCoverage?: boolean;
|
|
20
|
-
buildStat?: boolean;
|
|
21
|
-
bundlerConfig?: BundlerConfig;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function getName() {
|
|
25
|
-
const packageName = getPackageName()
|
|
26
|
-
.replace(/\//g, '-')
|
|
27
|
-
.replace(/[^\w-]/g, '');
|
|
28
|
-
const hash = crypto.randomBytes(4).toString('hex');
|
|
29
|
-
|
|
30
|
-
return `${packageName}-${hash}`;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function createBuildContext(input: CreateBuildContextInput): BuildContext {
|
|
34
|
-
const { source, destination } = getFolders();
|
|
35
|
-
const packageData = getPackageData();
|
|
36
|
-
const sharedDependencies = loadSharedDependencies(
|
|
37
|
-
packageData.dependencies,
|
|
38
|
-
packageData.sharedDependencies
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
return {
|
|
42
|
-
package: {
|
|
43
|
-
name: packageData.name,
|
|
44
|
-
version: packageData.version,
|
|
45
|
-
destination,
|
|
46
|
-
source,
|
|
47
|
-
dependencies: packageData.dependencies,
|
|
48
|
-
sharedDependencies,
|
|
49
|
-
isWebComponent: isWebComponent(),
|
|
50
|
-
isLegacyRoot: isLegacyRoot(),
|
|
51
|
-
isExposeSharedDependencies: isExposeSharedDependencies(),
|
|
52
|
-
},
|
|
53
|
-
build: {
|
|
54
|
-
name: input.name,
|
|
55
|
-
isProduction: input.isProduction,
|
|
56
|
-
light: input.light,
|
|
57
|
-
headless: input.headless,
|
|
58
|
-
},
|
|
59
|
-
options: {
|
|
60
|
-
codeCoverage: input.codeCoverage,
|
|
61
|
-
buildStat: input.buildStat,
|
|
62
|
-
bundlerConfig: input.bundlerConfig ?? {},
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { getPackageDependencyVersion } from '../../utils';
|
|
2
|
-
import { BuildContext } from '../types';
|
|
3
|
-
import { getExposedDependencies } from '../utils/get-exposed-dependencies';
|
|
4
|
-
|
|
5
|
-
export function defineExposedDependencies(context: BuildContext) {
|
|
6
|
-
const { isExposeSharedDependencies, sharedDependencies, dependencies } = context.package;
|
|
7
|
-
const { emitExposedDependencies } = context.options.bundlerConfig;
|
|
8
|
-
|
|
9
|
-
if (!isExposeSharedDependencies || emitExposedDependencies) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const exposedDependencies = getExposedDependencies(sharedDependencies, dependency =>
|
|
14
|
-
getPackageDependencyVersion(dependency, dependencies?.[dependency])
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
return {
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
19
|
-
EXPOSED_DEPENDENCIES: JSON.stringify(exposedDependencies),
|
|
20
|
-
};
|
|
21
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { BuildContext } from '../types';
|
|
2
|
-
import { getLaunchDarklySdkVersion } from '../utils/get-launchdarkly-sdk-version';
|
|
3
|
-
|
|
4
|
-
export function defineExposedInstanceDependencies(context: BuildContext) {
|
|
5
|
-
const { isExposeSharedDependencies } = context.package;
|
|
6
|
-
const { emitExposedDependencies } = context.options.bundlerConfig;
|
|
7
|
-
if (!isExposeSharedDependencies || emitExposedDependencies) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const instanceDependencies = {
|
|
12
|
-
launchDarkly: { version: getLaunchDarklySdkVersion() },
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
return {
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
17
|
-
EXPOSED_INSTANCE_DEPENDENCIES: JSON.stringify(instanceDependencies),
|
|
18
|
-
};
|
|
19
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { BuildContext } from '../types';
|
|
2
|
-
|
|
3
|
-
export function defineWebComponentName(context: BuildContext) {
|
|
4
|
-
const { isWebComponent } = context.package;
|
|
5
|
-
const { name } = context.build;
|
|
6
|
-
|
|
7
|
-
if (!isWebComponent) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return {
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
|
-
WEB_COMPONENT_NAME: JSON.stringify(name),
|
|
14
|
-
};
|
|
15
|
-
}
|
package/src/core/externals.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { BuildContext } from './types';
|
|
2
|
-
|
|
3
|
-
export function getExternalsMapping(context: BuildContext): Record<string, string> | undefined {
|
|
4
|
-
if (!needsExternals(context)) {
|
|
5
|
-
return;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const { sharedDependencies, isWebComponent } = context.package;
|
|
9
|
-
const name = isWebComponent ? context.build.name : context.package.name;
|
|
10
|
-
return Object.fromEntries(
|
|
11
|
-
Object.entries(sharedDependencies).map(([dependency, variable]) => [
|
|
12
|
-
dependency,
|
|
13
|
-
`${variable}['${name}']`,
|
|
14
|
-
])
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function needsExternals(context: BuildContext) {
|
|
19
|
-
const { light } = context.build;
|
|
20
|
-
const { isExposeSharedDependencies } = context.package;
|
|
21
|
-
const { emitExposedDependencies } = context.options.bundlerConfig;
|
|
22
|
-
return !!light || (isExposeSharedDependencies && !emitExposedDependencies);
|
|
23
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { readJsonSafe } from '../utils';
|
|
4
|
-
import { BuildContext } from './types';
|
|
5
|
-
import { getBundleType } from './utils';
|
|
6
|
-
|
|
7
|
-
interface ExposedDepsMetadata {
|
|
8
|
-
entryPointsPath: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface EntryPoints {
|
|
12
|
-
css: string[];
|
|
13
|
-
js: string[];
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function getExposedDependenciesEntryPoints(context: BuildContext) {
|
|
17
|
-
const metadataPath = getExposedDependenciesMetadataPath(context);
|
|
18
|
-
const metadata = readJsonSafe<ExposedDepsMetadata>(metadataPath);
|
|
19
|
-
if (metadata?.entryPointsPath) {
|
|
20
|
-
return readJsonSafe<EntryPoints>(metadata.entryPointsPath);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function getExposedDependenciesMetadataPath(context: BuildContext) {
|
|
25
|
-
return path.join(context.package.destination, 'exposed-dependencies-metadata.json');
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function getSharedEntryPoints(context: BuildContext): EntryPoints {
|
|
29
|
-
const dirname = getBundleType({
|
|
30
|
-
...context,
|
|
31
|
-
options: {
|
|
32
|
-
...context.options,
|
|
33
|
-
bundlerConfig: { ...context.options.bundlerConfig, emitExposedDependencies: true },
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
if (!dirname) {
|
|
37
|
-
return { css: [], js: [] };
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const { css = [], js = [] } = getExposedDependenciesEntryPoints(context) ?? {};
|
|
41
|
-
return {
|
|
42
|
-
css: css.map(name => `${dirname}/${name}`),
|
|
43
|
-
js: js.map(name => `${dirname}/${name}`),
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export function generateExposedDependenciesMetadata(
|
|
48
|
-
context: BuildContext,
|
|
49
|
-
getOutputPath: () => string
|
|
50
|
-
) {
|
|
51
|
-
const { destination } = context.package;
|
|
52
|
-
if (!fs.existsSync(destination)) {
|
|
53
|
-
fs.mkdirSync(destination, { recursive: true });
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const metadataPath = getExposedDependenciesMetadataPath(context);
|
|
57
|
-
const metadata: ExposedDepsMetadata = { entryPointsPath: getOutputPath() };
|
|
58
|
-
fs.writeFileSync(metadataPath, JSON.stringify(metadata, null, 2), 'utf-8');
|
|
59
|
-
}
|
package/src/core/index.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from './check-resource';
|
|
2
|
-
export * from './context';
|
|
3
|
-
export * from './defines';
|
|
4
|
-
export * from './externals';
|
|
5
|
-
export * from './get-exposed-dependencies-entry-points';
|
|
6
|
-
export type * from './types';
|
|
7
|
-
export * from './utils';
|
|
8
|
-
export * from './virtual-modules';
|
package/src/core/types.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { MinifyOptions } from '../utils';
|
|
2
|
-
|
|
3
|
-
export interface BuildContext {
|
|
4
|
-
package: PackageContext;
|
|
5
|
-
build: BuildIdentity;
|
|
6
|
-
options: BuildOptions;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface PackageContext {
|
|
10
|
-
name: string;
|
|
11
|
-
version: string;
|
|
12
|
-
destination: string;
|
|
13
|
-
source: string;
|
|
14
|
-
dependencies: Record<string, string>;
|
|
15
|
-
sharedDependencies: Record<string, string>;
|
|
16
|
-
isWebComponent: boolean;
|
|
17
|
-
isLegacyRoot: boolean;
|
|
18
|
-
isExposeSharedDependencies: boolean;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface BuildIdentity {
|
|
22
|
-
name: string;
|
|
23
|
-
isProduction: boolean;
|
|
24
|
-
light?: boolean;
|
|
25
|
-
headless?: boolean;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface BuildOptions {
|
|
29
|
-
codeCoverage?: boolean;
|
|
30
|
-
buildStat?: boolean;
|
|
31
|
-
bundlerConfig: BundlerConfig;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface BundlerConfig {
|
|
35
|
-
isCustomStyleRules?: boolean;
|
|
36
|
-
minify?: MinifyOptions;
|
|
37
|
-
emitExposedDependencies?: boolean | { output?: { path?: string } };
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Re-export types that were on the old Context and are used by both bundlers
|
|
41
|
-
export interface EntryPoint {
|
|
42
|
-
css?: string[];
|
|
43
|
-
js?: string[];
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface EntryPoints {
|
|
47
|
-
full?: EntryPoint;
|
|
48
|
-
light?: EntryPoint;
|
|
49
|
-
headless?: EntryPoint;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface Metadata {
|
|
53
|
-
name: string;
|
|
54
|
-
version: string;
|
|
55
|
-
bundledWith: Record<string, string | undefined>;
|
|
56
|
-
sharedDependencies: Record<string, string>;
|
|
57
|
-
dependencies: Record<string, string>;
|
|
58
|
-
entrypoints: EntryPoints;
|
|
59
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { BuildContext } from '../types';
|
|
2
|
-
|
|
3
|
-
export function getBundleType(context: BuildContext) {
|
|
4
|
-
const { light, headless } = context.build;
|
|
5
|
-
const { isExposeSharedDependencies, isWebComponent } = context.package;
|
|
6
|
-
const { emitExposedDependencies } = context.options.bundlerConfig;
|
|
7
|
-
|
|
8
|
-
if (isExposeSharedDependencies && emitExposedDependencies) {
|
|
9
|
-
return 'shared';
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
if (isWebComponent) {
|
|
13
|
-
if (headless) {
|
|
14
|
-
return 'headless';
|
|
15
|
-
}
|
|
16
|
-
return light ? 'light' : 'full';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return undefined;
|
|
20
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import { BuildContext } from '../types';
|
|
3
|
-
import { getBundleType } from './get-bundle-type';
|
|
4
|
-
|
|
5
|
-
export function getOutputPath(context: BuildContext) {
|
|
6
|
-
const { destination } = context.package;
|
|
7
|
-
const { emitExposedDependencies } = context.options.bundlerConfig;
|
|
8
|
-
|
|
9
|
-
const subdir = getBundleType(context) ?? '';
|
|
10
|
-
if (typeof emitExposedDependencies === 'object') {
|
|
11
|
-
const { output } = emitExposedDependencies;
|
|
12
|
-
if (output?.path) {
|
|
13
|
-
return path.join(output.path, subdir);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return path.join(process.cwd(), destination, 'bundle', subdir);
|
|
18
|
-
}
|
package/src/core/utils/index.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from './build-metadata';
|
|
2
|
-
export * from './generate-metadata';
|
|
3
|
-
export * from './get-bundle-type';
|
|
4
|
-
export * from './get-exposed-dependencies';
|
|
5
|
-
export * from './get-launchdarkly-sdk-version';
|
|
6
|
-
export * from './get-output-path';
|
|
7
|
-
export * from './get-web-components-version';
|
|
8
|
-
export * from './stringify-config';
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { BuildContext } from './types';
|
|
4
|
-
|
|
5
|
-
export function virtualModules(context: BuildContext) {
|
|
6
|
-
const modules: { [key: string]: string | undefined; index?: string; designSystem?: string } =
|
|
7
|
-
{};
|
|
8
|
-
|
|
9
|
-
if (context.package.isWebComponent) {
|
|
10
|
-
modules.index = indexCode(context);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (needsToIncludeDesignSystem(context)) {
|
|
14
|
-
const designSystemPath = getDesignSystemPath(context);
|
|
15
|
-
if (!fs.existsSync(designSystemPath)) {
|
|
16
|
-
modules.designSystem = designSystemCode();
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return modules;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function getDesignSystemPath(context: BuildContext) {
|
|
24
|
-
return path.join(process.cwd(), context.package.destination, 'design-system.css');
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function designSystemCode() {
|
|
28
|
-
return [
|
|
29
|
-
`@import '@servicetitan/tokens/core/tokens.css';`,
|
|
30
|
-
`@import '@servicetitan/anvil-fonts/dist/css/anvil-fonts.css';`,
|
|
31
|
-
`@import '@servicetitan/design-system/dist/system.min.css';`,
|
|
32
|
-
].join('\n');
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function indexCode(context: BuildContext) {
|
|
36
|
-
const { light = false, headless } = context.build;
|
|
37
|
-
const { isLegacyRoot, sharedDependencies } = context.package;
|
|
38
|
-
if (headless) {
|
|
39
|
-
return headlessIndex();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const options = `{ legacyRoot: ${isLegacyRoot}, sharedDependenciesNames: ${JSON.stringify(
|
|
43
|
-
Object.keys(sharedDependencies)
|
|
44
|
-
)} }`;
|
|
45
|
-
|
|
46
|
-
return [
|
|
47
|
-
...(needsToIncludeDesignSystem(context) ? [`import './design-system.css';`] : []),
|
|
48
|
-
`import { register } from '@servicetitan/web-components';`,
|
|
49
|
-
`import { App } from './app';`,
|
|
50
|
-
`register(App, ${light}, ${options});`,
|
|
51
|
-
].join('\n');
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export function needsToIncludeDesignSystem(context: BuildContext) {
|
|
55
|
-
const { light, headless } = context.build;
|
|
56
|
-
const { isWebComponent, dependencies, sharedDependencies } = context.package;
|
|
57
|
-
const { emitExposedDependencies } = context.options.bundlerConfig;
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
(!!emitExposedDependencies && !!sharedDependencies['@servicetitan/design-system']) ||
|
|
61
|
-
(isWebComponent &&
|
|
62
|
-
!headless &&
|
|
63
|
-
// Depends on design system
|
|
64
|
-
!!dependencies['@servicetitan/design-system'] &&
|
|
65
|
-
// ... and is not light bundle with private copy of design system
|
|
66
|
-
!(light && !!sharedDependencies['@servicetitan/design-system']))
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function headlessIndex() {
|
|
71
|
-
return [
|
|
72
|
-
"import { registerHeadless } from '@servicetitan/web-components';",
|
|
73
|
-
"import { connectedCallback, disconnectedCallback } from './headless';",
|
|
74
|
-
'registerHeadless(connectedCallback, disconnectedCallback);',
|
|
75
|
-
].join('\n');
|
|
76
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from '../define-config';
|
|
2
|
-
|
|
3
|
-
describe('defineConfig', () => {
|
|
4
|
-
test('returns object config as-is', () => {
|
|
5
|
-
const config = { config: { build: { minify: false } } };
|
|
6
|
-
expect(defineConfig(config)).toBe(config);
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
test('returns function config as-is', () => {
|
|
10
|
-
const fn = () => ({ config: { build: { minify: false } } });
|
|
11
|
-
expect(defineConfig(fn)).toBe(fn);
|
|
12
|
-
});
|
|
13
|
-
});
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { fs, vol } from 'memfs';
|
|
2
|
-
import { loadConfigFile } from '../load-config-file';
|
|
3
|
-
|
|
4
|
-
jest.mock('fs', () => fs);
|
|
5
|
-
|
|
6
|
-
jest.mock('../load-config-file', () => {
|
|
7
|
-
const realPath = jest.requireActual('path') as typeof import('path');
|
|
8
|
-
|
|
9
|
-
return {
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/require-await
|
|
11
|
-
loadConfigFile: async (root: string, isProduction: boolean) => {
|
|
12
|
-
const candidates = isProduction
|
|
13
|
-
? ['vite.prod.config.ts', 'vite.prod.config.js']
|
|
14
|
-
: ['vite.dev.config.ts', 'vite.dev.config.js'];
|
|
15
|
-
|
|
16
|
-
const configPath = candidates
|
|
17
|
-
.map((f: string) => realPath.join(root, f))
|
|
18
|
-
.find((f: string) => {
|
|
19
|
-
try {
|
|
20
|
-
fs.statSync(f);
|
|
21
|
-
return true;
|
|
22
|
-
} catch {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
if (!configPath) {
|
|
28
|
-
return undefined;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const content = fs.readFileSync(configPath, 'utf-8') as string;
|
|
32
|
-
|
|
33
|
-
// Parse simple export default { ... } or export default (ctx) => ...
|
|
34
|
-
if (content.includes('=>')) {
|
|
35
|
-
// Function export
|
|
36
|
-
// eslint-disable-next-line @typescript-eslint/no-implied-eval
|
|
37
|
-
return new Function('return ' + content.replace('export default ', ''))();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Object export — extract the object literal
|
|
41
|
-
const match = content.match(/export default\s+({[\s\S]*});?\s*$/);
|
|
42
|
-
if (match) {
|
|
43
|
-
// eslint-disable-next-line @typescript-eslint/no-implied-eval
|
|
44
|
-
return new Function('return ' + match[1])();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return undefined;
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
describe('loadConfigFile', () => {
|
|
53
|
-
afterEach(() => vol.reset());
|
|
54
|
-
|
|
55
|
-
test('returns undefined when no config file exists', async () => {
|
|
56
|
-
vol.fromJSON({ '/project/dummy': '' });
|
|
57
|
-
const result = await loadConfigFile('/project', true);
|
|
58
|
-
expect(result).toBeUndefined();
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
test('loads prod config file', async () => {
|
|
62
|
-
vol.fromJSON({
|
|
63
|
-
'/project/vite.prod.config.ts':
|
|
64
|
-
'export default { config: { build: { minify: false } } };',
|
|
65
|
-
});
|
|
66
|
-
const result = await loadConfigFile('/project', true);
|
|
67
|
-
expect(result).toEqual({ config: { build: { minify: false } } });
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
test('loads dev config when isProduction is false', async () => {
|
|
71
|
-
vol.fromJSON({
|
|
72
|
-
'/project/vite.dev.config.ts': 'export default { config: { server: { port: 3000 } } };',
|
|
73
|
-
});
|
|
74
|
-
const result = await loadConfigFile('/project', false);
|
|
75
|
-
expect(result).toEqual({ config: { server: { port: 3000 } } });
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
test('prefers .ts over .js', async () => {
|
|
79
|
-
vol.fromJSON({
|
|
80
|
-
'/project/vite.prod.config.ts':
|
|
81
|
-
'export default { config: { build: { minify: true } } };',
|
|
82
|
-
'/project/vite.prod.config.js':
|
|
83
|
-
'export default { config: { build: { minify: false } } };',
|
|
84
|
-
});
|
|
85
|
-
const result = await loadConfigFile('/project', true);
|
|
86
|
-
expect(result).toEqual({ config: { build: { minify: true } } });
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
test('falls back to .js when .ts does not exist', async () => {
|
|
90
|
-
vol.fromJSON({
|
|
91
|
-
'/project/vite.prod.config.js':
|
|
92
|
-
'export default { config: { server: { port: 9000 } } };',
|
|
93
|
-
});
|
|
94
|
-
const result = await loadConfigFile('/project', true);
|
|
95
|
-
expect(result).toEqual({ config: { server: { port: 9000 } } });
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
test('returns function export without calling it', async () => {
|
|
99
|
-
vol.fromJSON({
|
|
100
|
-
'/project/vite.prod.config.ts':
|
|
101
|
-
'export default (context) => ({ config: { build: { minify: true } } });',
|
|
102
|
-
});
|
|
103
|
-
const result = await loadConfigFile('/project', true);
|
|
104
|
-
expect(typeof result).toBe('function');
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
test('does not find prod config when looking for dev', async () => {
|
|
108
|
-
vol.fromJSON({
|
|
109
|
-
'/project/vite.prod.config.ts':
|
|
110
|
-
'export default { config: { build: { minify: false } } };',
|
|
111
|
-
});
|
|
112
|
-
const result = await loadConfigFile('/project', false);
|
|
113
|
-
expect(result).toBeUndefined();
|
|
114
|
-
});
|
|
115
|
-
});
|