@servicetitan/startup 34.2.1 → 34.3.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/commands/build.d.ts +16 -0
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +15 -2
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/bundle-vite.d.ts +66 -0
- package/dist/cli/commands/bundle-vite.d.ts.map +1 -0
- package/dist/cli/commands/bundle-vite.js +184 -0
- package/dist/cli/commands/bundle-vite.js.map +1 -0
- package/dist/cli/commands/get-command.d.ts.map +1 -1
- package/dist/cli/commands/get-command.js +2 -0
- package/dist/cli/commands/get-command.js.map +1 -1
- package/dist/cli/commands/mfe-check.d.ts.map +1 -1
- package/dist/cli/commands/mfe-check.js +2 -2
- package/dist/cli/commands/mfe-check.js.map +1 -1
- package/dist/cli/commands/mfe-generate-metadata.js +2 -2
- package/dist/cli/commands/mfe-generate-metadata.js.map +1 -1
- package/dist/cli/commands/mfe-package-publish.js.map +1 -1
- package/dist/cli/commands/start.d.ts +8 -0
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +8 -2
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/tasks/swc-compile-package.js +127 -0
- package/dist/cli/tasks/swc-compile-package.js.map +1 -0
- package/dist/cli/tasks/tsc-compile-package.js +46 -0
- package/dist/cli/tasks/tsc-compile-package.js.map +1 -0
- package/dist/cli/tasks/tsc-compile.js +68 -0
- package/dist/cli/tasks/tsc-compile.js.map +1 -0
- package/dist/cli/utils/bundle.d.ts +2 -5
- package/dist/cli/utils/bundle.d.ts.map +1 -1
- package/dist/cli/utils/bundle.js +18 -98
- package/dist/cli/utils/bundle.js.map +1 -1
- package/dist/core/check-resource/check-resource.d.ts +3 -0
- package/dist/core/check-resource/check-resource.d.ts.map +1 -0
- package/dist/core/check-resource/check-resource.js +40 -0
- package/dist/core/check-resource/check-resource.js.map +1 -0
- package/dist/core/check-resource/get-package-json.d.ts.map +1 -0
- package/dist/core/check-resource/get-package-json.js +37 -0
- package/dist/core/check-resource/get-package-json.js.map +1 -0
- package/dist/core/check-resource/index.d.ts +2 -0
- package/dist/core/check-resource/index.d.ts.map +1 -0
- package/dist/core/check-resource/index.js +13 -0
- package/dist/core/check-resource/index.js.map +1 -0
- package/dist/core/check-resource/is-optional-peer-dependency.d.ts.map +1 -0
- package/dist/core/check-resource/is-optional-peer-dependency.js +27 -0
- package/dist/core/check-resource/is-optional-peer-dependency.js.map +1 -0
- package/dist/core/check-resource/is-optional-react-dom-peer-dependency.d.ts.map +1 -0
- package/dist/core/check-resource/is-optional-react-dom-peer-dependency.js +15 -0
- package/dist/core/check-resource/is-optional-react-dom-peer-dependency.js.map +1 -0
- package/dist/core/context.d.ts +14 -0
- package/dist/core/context.d.ts.map +1 -0
- package/dist/core/context.js +62 -0
- package/dist/core/context.js.map +1 -0
- package/dist/core/defines/exposed-dependencies.d.ts +5 -0
- package/dist/core/defines/exposed-dependencies.d.ts.map +1 -0
- package/dist/core/defines/exposed-dependencies.js +26 -0
- package/dist/core/defines/exposed-dependencies.js.map +1 -0
- package/dist/core/defines/exposed-instance-dependencies.d.ts +5 -0
- package/dist/core/defines/exposed-instance-dependencies.d.ts.map +1 -0
- package/dist/core/defines/exposed-instance-dependencies.js +29 -0
- package/dist/core/defines/exposed-instance-dependencies.js.map +1 -0
- package/dist/core/defines/index.d.ts +4 -0
- package/dist/core/defines/index.d.ts.map +1 -0
- package/dist/core/defines/index.js +26 -0
- package/dist/core/defines/index.js.map +1 -0
- package/dist/core/defines/web-component-name.d.ts +5 -0
- package/dist/core/defines/web-component-name.d.ts.map +1 -0
- package/dist/core/defines/web-component-name.js +23 -0
- package/dist/core/defines/web-component-name.js.map +1 -0
- package/dist/core/externals.d.ts +3 -0
- package/dist/core/externals.d.ts.map +1 -0
- package/dist/core/externals.js +29 -0
- package/dist/core/externals.js.map +1 -0
- package/dist/core/get-exposed-dependencies-entry-points.d.ts +11 -0
- package/dist/core/get-exposed-dependencies-entry-points.d.ts.map +1 -0
- package/dist/core/get-exposed-dependencies-entry-points.js +82 -0
- package/dist/core/get-exposed-dependencies-entry-points.js.map +1 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +26 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/types.d.ts +55 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +6 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/utils/build-metadata.d.ts.map +1 -0
- package/dist/core/utils/build-metadata.js +50 -0
- package/dist/core/utils/build-metadata.js.map +1 -0
- package/dist/core/utils/generate-metadata.d.ts +3 -0
- package/dist/core/utils/generate-metadata.d.ts.map +1 -0
- package/dist/core/utils/generate-metadata.js +40 -0
- package/dist/core/utils/generate-metadata.js.map +1 -0
- package/dist/core/utils/get-bundle-type.d.ts +3 -0
- package/dist/core/utils/get-bundle-type.d.ts.map +1 -0
- package/dist/core/utils/get-bundle-type.js +27 -0
- package/dist/core/utils/get-bundle-type.js.map +1 -0
- package/dist/core/utils/get-exposed-dependencies.d.ts.map +1 -0
- package/dist/core/utils/get-exposed-dependencies.js +21 -0
- package/dist/core/utils/get-exposed-dependencies.js.map +1 -0
- package/dist/core/utils/get-launchdarkly-sdk-version.d.ts.map +1 -0
- package/dist/core/utils/get-launchdarkly-sdk-version.js +26 -0
- package/dist/core/utils/get-launchdarkly-sdk-version.js.map +1 -0
- package/dist/core/utils/get-output-path.d.ts +3 -0
- package/dist/core/utils/get-output-path.d.ts.map +1 -0
- package/dist/core/utils/get-output-path.js +32 -0
- package/dist/core/utils/get-output-path.js.map +1 -0
- package/dist/core/utils/get-web-components-version.d.ts.map +1 -0
- package/dist/core/utils/get-web-components-version.js +22 -0
- package/dist/core/utils/get-web-components-version.js.map +1 -0
- package/dist/core/utils/index.d.ts +9 -0
- package/dist/core/utils/index.d.ts.map +1 -0
- package/dist/core/utils/index.js +27 -0
- package/dist/core/utils/index.js.map +1 -0
- package/dist/core/utils/stringify-config.d.ts +2 -0
- package/dist/core/utils/stringify-config.d.ts.map +1 -0
- package/dist/core/utils/stringify-config.js +35 -0
- package/dist/core/utils/stringify-config.js.map +1 -0
- package/dist/core/virtual-modules.d.ts +9 -0
- package/dist/core/virtual-modules.d.ts.map +1 -0
- package/dist/core/virtual-modules.js +84 -0
- package/dist/core/virtual-modules.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/storybook-config/webpack-final.d.ts +1 -1
- package/dist/storybook-config/webpack-final.d.ts.map +1 -1
- package/dist/storybook-config/webpack-final.js +18 -6
- package/dist/storybook-config/webpack-final.js.map +1 -1
- package/dist/utils/get-configuration.d.ts +28 -0
- package/dist/utils/get-configuration.d.ts.map +1 -1
- package/dist/utils/get-configuration.js +42 -1
- package/dist/utils/get-configuration.js.map +1 -1
- package/dist/utils/get-package-data.d.ts.map +1 -1
- package/dist/utils/get-package-data.js +3 -2
- package/dist/utils/get-package-data.js.map +1 -1
- package/dist/vite/base-config.d.ts +4 -0
- package/dist/vite/base-config.d.ts.map +1 -0
- package/dist/vite/base-config.js +65 -0
- package/dist/vite/base-config.js.map +1 -0
- package/dist/vite/build-shared-deps.d.ts +3 -0
- package/dist/vite/build-shared-deps.d.ts.map +1 -0
- package/dist/vite/build-shared-deps.js +310 -0
- package/dist/vite/build-shared-deps.js.map +1 -0
- package/dist/vite/create-vite-config.d.ts +3 -0
- package/dist/vite/create-vite-config.d.ts.map +1 -0
- package/dist/vite/create-vite-config.js +52 -0
- package/dist/vite/create-vite-config.js.map +1 -0
- package/dist/vite/define-config.d.ts +12 -0
- package/dist/vite/define-config.d.ts.map +1 -0
- package/dist/vite/define-config.js +15 -0
- package/dist/vite/define-config.js.map +1 -0
- package/dist/vite/load-config-file.d.ts +6 -0
- package/dist/vite/load-config-file.d.ts.map +1 -0
- package/dist/vite/load-config-file.js +107 -0
- package/dist/vite/load-config-file.js.map +1 -0
- package/dist/vite/merge-config.d.ts +6 -0
- package/dist/vite/merge-config.d.ts.map +1 -0
- package/dist/vite/merge-config.js +106 -0
- package/dist/vite/merge-config.js.map +1 -0
- package/dist/vite/plugins/css-injector-plugin.d.ts +15 -0
- package/dist/vite/plugins/css-injector-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/css-injector-plugin.js +76 -0
- package/dist/vite/plugins/css-injector-plugin.js.map +1 -0
- package/dist/vite/plugins/dev-bundle-routing-plugin.d.ts +7 -0
- package/dist/vite/plugins/dev-bundle-routing-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/dev-bundle-routing-plugin.js +48 -0
- package/dist/vite/plugins/dev-bundle-routing-plugin.js.map +1 -0
- package/dist/vite/plugins/dev-server-routing-plugin.d.ts +12 -0
- package/dist/vite/plugins/dev-server-routing-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/dev-server-routing-plugin.js +85 -0
- package/dist/vite/plugins/dev-server-routing-plugin.js.map +1 -0
- package/dist/vite/plugins/externals-plugin.d.ts +4 -0
- package/dist/vite/plugins/externals-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/externals-plugin.js +39 -0
- package/dist/vite/plugins/externals-plugin.js.map +1 -0
- package/dist/vite/plugins/full-bundle-proxy-plugin.d.ts +14 -0
- package/dist/vite/plugins/full-bundle-proxy-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/full-bundle-proxy-plugin.js +48 -0
- package/dist/vite/plugins/full-bundle-proxy-plugin.js.map +1 -0
- package/dist/vite/plugins/html-plugin.d.ts +5 -0
- package/dist/vite/plugins/html-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/html-plugin.js +74 -0
- package/dist/vite/plugins/html-plugin.js.map +1 -0
- package/dist/vite/plugins/ignore-modules-plugin.d.ts +4 -0
- package/dist/vite/plugins/ignore-modules-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/ignore-modules-plugin.js +30 -0
- package/dist/vite/plugins/ignore-modules-plugin.js.map +1 -0
- package/dist/vite/plugins/index.d.ts +10 -0
- package/dist/vite/plugins/index.d.ts.map +1 -0
- package/dist/vite/plugins/index.js +28 -0
- package/dist/vite/plugins/index.js.map +1 -0
- package/dist/vite/plugins/metadata-plugin.d.ts +4 -0
- package/dist/vite/plugins/metadata-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/metadata-plugin.js +86 -0
- package/dist/vite/plugins/metadata-plugin.js.map +1 -0
- package/dist/vite/plugins/outdir-rewrite-plugin.d.ts +9 -0
- package/dist/vite/plugins/outdir-rewrite-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/preview-static-files-plugin.d.ts +9 -0
- package/dist/vite/plugins/preview-static-files-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/preview-static-files-plugin.js +50 -0
- package/dist/vite/plugins/preview-static-files-plugin.js.map +1 -0
- package/dist/vite/plugins/shared-deps-dev-server-plugin.d.ts +11 -0
- package/dist/vite/plugins/shared-deps-dev-server-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/shared-deps-rewrite-plugin.d.ts +10 -0
- package/dist/vite/plugins/shared-deps-rewrite-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/shared-deps-rewrite-plugin.js +51 -0
- package/dist/vite/plugins/shared-deps-rewrite-plugin.js.map +1 -0
- package/dist/vite/plugins/style-urls-plugin.d.ts +4 -0
- package/dist/vite/plugins/style-urls-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/style-urls-plugin.js +29 -0
- package/dist/vite/plugins/style-urls-plugin.js.map +1 -0
- package/dist/vite/plugins/svgr-plugin.d.ts +4 -0
- package/dist/vite/plugins/svgr-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/svgr-plugin.js +31 -0
- package/dist/vite/plugins/svgr-plugin.js.map +1 -0
- package/dist/vite/plugins/virtual-modules-plugin.d.ts +4 -0
- package/dist/vite/plugins/virtual-modules-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/virtual-modules-plugin.js +71 -0
- package/dist/vite/plugins/virtual-modules-plugin.js.map +1 -0
- package/dist/webpack/configs/amd-config.d.ts +3 -2
- package/dist/webpack/configs/amd-config.d.ts.map +1 -1
- package/dist/webpack/configs/amd-config.js.map +1 -1
- package/dist/webpack/configs/cache-config.d.ts +3 -2
- package/dist/webpack/configs/cache-config.d.ts.map +1 -1
- package/dist/webpack/configs/cache-config.js +1 -1
- package/dist/webpack/configs/cache-config.js.map +1 -1
- package/dist/webpack/configs/dev-server-config.d.ts +3 -2
- package/dist/webpack/configs/dev-server-config.d.ts.map +1 -1
- package/dist/webpack/configs/dev-server-config.js +1 -1
- package/dist/webpack/configs/dev-server-config.js.map +1 -1
- package/dist/webpack/configs/devtool-config.d.ts +3 -2
- package/dist/webpack/configs/devtool-config.d.ts.map +1 -1
- package/dist/webpack/configs/devtool-config.js +1 -1
- package/dist/webpack/configs/devtool-config.js.map +1 -1
- package/dist/webpack/configs/entry.config.d.ts +3 -2
- package/dist/webpack/configs/entry.config.d.ts.map +1 -1
- package/dist/webpack/configs/entry.config.js +6 -5
- package/dist/webpack/configs/entry.config.js.map +1 -1
- package/dist/webpack/configs/externals-config.d.ts +3 -2
- package/dist/webpack/configs/externals-config.d.ts.map +1 -1
- package/dist/webpack/configs/externals-config.js +4 -14
- package/dist/webpack/configs/externals-config.js.map +1 -1
- package/dist/webpack/configs/index.d.ts +0 -1
- package/dist/webpack/configs/index.d.ts.map +1 -1
- package/dist/webpack/configs/index.js.map +1 -1
- package/dist/webpack/configs/loaders/css-loader.d.ts +2 -2
- package/dist/webpack/configs/loaders/css-loader.d.ts.map +1 -1
- package/dist/webpack/configs/loaders/css-loader.js +2 -1
- package/dist/webpack/configs/loaders/css-loader.js.map +1 -1
- package/dist/webpack/configs/loaders/style-loader.d.ts +2 -2
- package/dist/webpack/configs/loaders/style-loader.d.ts.map +1 -1
- package/dist/webpack/configs/loaders/style-loader.js +4 -1
- package/dist/webpack/configs/loaders/style-loader.js.map +1 -1
- package/dist/webpack/configs/module-config.d.ts +3 -2
- package/dist/webpack/configs/module-config.d.ts.map +1 -1
- package/dist/webpack/configs/module-config.js.map +1 -1
- package/dist/webpack/configs/optimization-config.d.ts +3 -2
- package/dist/webpack/configs/optimization-config.d.ts.map +1 -1
- package/dist/webpack/configs/optimization-config.js +10 -7
- package/dist/webpack/configs/optimization-config.js.map +1 -1
- package/dist/webpack/configs/output-config.d.ts +3 -2
- package/dist/webpack/configs/output-config.d.ts.map +1 -1
- package/dist/webpack/configs/output-config.js +15 -24
- package/dist/webpack/configs/output-config.js.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts +3 -8
- package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js +10 -47
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js +6 -6
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js +4 -13
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.js +4 -12
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-web-component-name-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/define-web-component-name-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/define-web-component-name-plugin.js +4 -6
- package/dist/webpack/configs/plugins/define-web-component-name-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/filter-warnings-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/filter-warnings-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/filter-warnings-plugin.js +2 -2
- package/dist/webpack/configs/plugins/filter-warnings-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/html-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/html-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/html-plugin.js +5 -2
- package/dist/webpack/configs/plugins/html-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/html-tags-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/html-tags-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/html-tags-plugin.js +8 -19
- package/dist/webpack/configs/plugins/html-tags-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.js +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts +17 -3
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js +45 -6
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.js +4 -2
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/moment-locales-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/moment-locales-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/moment-locales-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.js +1 -1
- package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/virtual-modules-plugin.d.ts +3 -3
- package/dist/webpack/configs/plugins/virtual-modules-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/virtual-modules-plugin.js +13 -56
- package/dist/webpack/configs/plugins/virtual-modules-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/watch-run-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/watch-run-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/watch-run-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins-config.d.ts +3 -2
- package/dist/webpack/configs/plugins-config.d.ts.map +1 -1
- package/dist/webpack/configs/plugins-config.js.map +1 -1
- package/dist/webpack/configs/resolve-config.d.ts +3 -2
- package/dist/webpack/configs/resolve-config.d.ts.map +1 -1
- package/dist/webpack/configs/resolve-config.js.map +1 -1
- package/dist/webpack/configs/rules/css-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/css-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/css-rules.js +2 -1
- package/dist/webpack/configs/rules/css-rules.js.map +1 -1
- package/dist/webpack/configs/rules/font-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/font-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/font-rules.js.map +1 -1
- package/dist/webpack/configs/rules/image-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/image-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/image-rules.js.map +1 -1
- package/dist/webpack/configs/rules/js-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/js-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/js-rules.js +3 -1
- package/dist/webpack/configs/rules/js-rules.js.map +1 -1
- package/dist/webpack/configs/rules/less-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/less-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/less-rules.js.map +1 -1
- package/dist/webpack/configs/rules/scss-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/scss-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/scss-rules.js.map +1 -1
- package/dist/webpack/configs/rules/svg-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/svg-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/svg-rules.js.map +1 -1
- package/dist/webpack/configs/rules-config.d.ts +3 -2
- package/dist/webpack/configs/rules-config.d.ts.map +1 -1
- package/dist/webpack/configs/rules-config.js +2 -2
- package/dist/webpack/configs/rules-config.js.map +1 -1
- package/dist/webpack/configs/stats-config.d.ts +3 -2
- package/dist/webpack/configs/stats-config.d.ts.map +1 -1
- package/dist/webpack/configs/stats-config.js.map +1 -1
- package/dist/webpack/configs/watch-options-config.d.ts +2 -2
- package/dist/webpack/configs/watch-options-config.d.ts.map +1 -1
- package/dist/webpack/configs/watch-options-config.js +2 -2
- package/dist/webpack/configs/watch-options-config.js.map +1 -1
- package/dist/webpack/create-webpack-config.d.ts +10 -0
- package/dist/webpack/create-webpack-config.d.ts.map +1 -1
- package/dist/webpack/create-webpack-config.js +109 -41
- package/dist/webpack/create-webpack-config.js.map +1 -1
- package/dist/webpack/types.d.ts +4 -11
- package/dist/webpack/types.d.ts.map +1 -1
- package/dist/webpack/utils/index.d.ts +0 -1
- package/dist/webpack/utils/index.d.ts.map +1 -1
- package/dist/webpack/utils/index.js +0 -1
- package/dist/webpack/utils/index.js.map +1 -1
- package/package.json +13 -10
- package/patches/vite-plugin-css-injected-by-js+3.5.2.patch +63 -0
- package/src/cli/commands/__tests__/mfe-generate-metadata.test.ts +3 -4
- package/src/cli/commands/build.ts +7 -2
- package/src/cli/commands/bundle-vite.ts +112 -0
- package/src/cli/commands/get-command.ts +2 -0
- package/src/cli/commands/mfe-check.ts +1 -2
- package/src/cli/commands/mfe-generate-metadata.ts +1 -1
- package/src/cli/commands/mfe-package-publish.ts +1 -1
- package/src/cli/commands/start.ts +5 -2
- package/src/cli/utils/__tests__/bundle.test.ts +19 -10
- package/src/cli/utils/bundle.ts +20 -101
- package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/__tests__/check-resource.test.ts +18 -5
- package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/check-resource.ts +4 -4
- package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/get-package-json.ts +2 -2
- package/src/core/check-resource/index.ts +1 -0
- package/src/core/context.ts +65 -0
- package/src/core/defines/exposed-dependencies.ts +21 -0
- package/src/core/defines/exposed-instance-dependencies.ts +19 -0
- package/src/core/defines/index.ts +3 -0
- package/src/core/defines/web-component-name.ts +15 -0
- package/src/core/externals.ts +23 -0
- package/src/core/get-exposed-dependencies-entry-points.ts +59 -0
- package/src/core/index.ts +8 -0
- package/src/core/types.ts +59 -0
- package/src/{webpack/configs → core}/utils/__tests__/build-metadata.test.ts +2 -2
- package/src/{webpack/configs → core}/utils/__tests__/generate-metadata.test.ts +27 -13
- package/src/{webpack/configs → core}/utils/build-metadata.ts +1 -1
- package/src/{webpack/configs → core}/utils/generate-metadata.ts +7 -6
- package/src/core/utils/get-bundle-type.ts +20 -0
- package/src/{webpack/configs → core}/utils/get-launchdarkly-sdk-version.ts +1 -1
- package/src/core/utils/get-output-path.ts +18 -0
- package/src/{webpack/configs → core}/utils/get-web-components-version.ts +1 -1
- package/src/core/utils/index.ts +8 -0
- package/src/core/virtual-modules.ts +76 -0
- package/src/index.ts +1 -0
- package/src/storybook-config/__tests__/webpack-final.test.ts +5 -2
- package/src/storybook-config/webpack-final.ts +24 -10
- package/src/utils/__tests__/get-configuration.test.ts +99 -1
- package/src/utils/__tests__/get-package-data.test.ts +35 -1
- package/src/utils/get-configuration.ts +92 -1
- package/src/utils/get-package-data.ts +3 -1
- package/src/vite/__tests__/define-config.test.ts +13 -0
- package/src/vite/__tests__/load-config-file.test.ts +115 -0
- package/src/vite/__tests__/merge-config.test.ts +173 -0
- package/src/vite/base-config.ts +70 -0
- package/src/vite/build-shared-deps.ts +320 -0
- package/src/vite/create-vite-config.ts +50 -0
- package/src/vite/define-config.ts +20 -0
- package/src/vite/index.html +29 -0
- package/src/vite/load-config-file.ts +54 -0
- package/src/vite/merge-config.ts +93 -0
- package/src/vite/plugins/css-injector-plugin.ts +85 -0
- package/src/vite/plugins/dev-server-routing-plugin.ts +89 -0
- package/src/vite/plugins/externals-plugin.ts +27 -0
- package/src/vite/plugins/html-plugin.ts +65 -0
- package/src/vite/plugins/ignore-modules-plugin.ts +22 -0
- package/src/vite/plugins/index.ts +9 -0
- package/src/vite/plugins/metadata-plugin.ts +78 -0
- package/src/vite/plugins/style-urls-plugin.ts +34 -0
- package/src/vite/plugins/svgr-plugin.ts +11 -0
- package/src/vite/plugins/virtual-modules-plugin.ts +74 -0
- package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +2 -2
- package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +11 -11
- package/src/webpack/__tests__/create-webpack-config.test.ts +3 -2
- package/src/webpack/configs/amd-config.ts +3 -2
- package/src/webpack/configs/cache-config.ts +4 -3
- package/src/webpack/configs/dev-server-config.ts +8 -3
- package/src/webpack/configs/devtool-config.ts +4 -3
- package/src/webpack/configs/entry.config.ts +8 -7
- package/src/webpack/configs/externals-config.ts +5 -21
- package/src/webpack/configs/index.ts +0 -1
- package/src/webpack/configs/loaders/css-loader.ts +3 -2
- package/src/webpack/configs/loaders/style-loader.ts +5 -5
- package/src/webpack/configs/module-config.ts +3 -2
- package/src/webpack/configs/optimization-config.ts +16 -11
- package/src/webpack/configs/output-config.ts +16 -22
- package/src/webpack/configs/plugins/assets-manifest-plugin.ts +9 -36
- package/src/webpack/configs/plugins/bundle-analyser-plugin.ts +8 -8
- package/src/webpack/configs/plugins/define-exposed-dependencies-plugin.ts +7 -15
- package/src/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.ts +7 -13
- package/src/webpack/configs/plugins/define-web-component-name-plugin.ts +7 -8
- package/src/webpack/configs/plugins/filter-warnings-plugin.ts +4 -3
- package/src/webpack/configs/plugins/html-plugin.ts +7 -6
- package/src/webpack/configs/plugins/html-tags-plugin.ts +7 -16
- package/src/webpack/configs/plugins/ignore-plugin/empty-module.js +1 -0
- package/src/webpack/configs/plugins/ignore-plugin/ignore-plugin.ts +48 -6
- package/src/webpack/configs/plugins/mini-css-extract-plugin.ts +10 -5
- package/src/webpack/configs/plugins/moment-locales-plugin.ts +3 -2
- package/src/webpack/configs/plugins/remove-empty-scripts-plugin.ts +4 -3
- package/src/webpack/configs/plugins/virtual-modules-plugin.ts +13 -65
- package/src/webpack/configs/plugins/watch-run-plugin.ts +3 -2
- package/src/webpack/configs/plugins-config.ts +3 -2
- package/src/webpack/configs/resolve-config.ts +3 -2
- package/src/webpack/configs/rules/css-rules.ts +4 -3
- package/src/webpack/configs/rules/font-rules.ts +2 -2
- package/src/webpack/configs/rules/image-rules.ts +2 -2
- package/src/webpack/configs/rules/js-rules.ts +4 -2
- package/src/webpack/configs/rules/less-rules.ts +2 -2
- package/src/webpack/configs/rules/scss-rules.ts +2 -2
- package/src/webpack/configs/rules/svg-rules.ts +2 -2
- package/src/webpack/configs/rules-config.ts +9 -5
- package/src/webpack/configs/stats-config.ts +3 -2
- package/src/webpack/configs/watch-options-config.ts +3 -3
- package/src/webpack/create-webpack-config.ts +88 -43
- package/src/webpack/types.ts +7 -11
- package/src/webpack/utils/index.ts +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.d.ts +0 -3
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.d.ts.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.d.ts.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.d.ts.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-react-dom-peer-dependency.d.ts.map +0 -1
- package/dist/webpack/configs/types.d.ts +0 -35
- package/dist/webpack/configs/types.d.ts.map +0 -1
- package/dist/webpack/configs/utils/build-metadata.d.ts.map +0 -1
- package/dist/webpack/configs/utils/generate-metadata.d.ts +0 -3
- package/dist/webpack/configs/utils/generate-metadata.d.ts.map +0 -1
- package/dist/webpack/configs/utils/get-bundle-type.d.ts +0 -3
- package/dist/webpack/configs/utils/get-bundle-type.d.ts.map +0 -1
- package/dist/webpack/configs/utils/get-exposed-dependencies.d.ts.map +0 -1
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.d.ts.map +0 -1
- package/dist/webpack/configs/utils/get-web-components-version.d.ts.map +0 -1
- package/dist/webpack/configs/utils/index.d.ts +0 -4
- package/dist/webpack/configs/utils/index.d.ts.map +0 -1
- package/src/webpack/configs/types.ts +0 -38
- package/src/webpack/configs/utils/get-bundle-type.ts +0 -22
- package/src/webpack/configs/utils/index.ts +0 -3
- /package/dist/{webpack/configs/plugins/ignore-plugin → core/check-resource}/get-package-json.d.ts +0 -0
- /package/dist/{webpack/configs/plugins/ignore-plugin → core/check-resource}/is-optional-peer-dependency.d.ts +0 -0
- /package/dist/{webpack/configs/plugins/ignore-plugin → core/check-resource}/is-optional-react-dom-peer-dependency.d.ts +0 -0
- /package/dist/{webpack/configs → core}/utils/build-metadata.d.ts +0 -0
- /package/dist/{webpack/configs → core}/utils/get-exposed-dependencies.d.ts +0 -0
- /package/dist/{webpack/configs → core}/utils/get-launchdarkly-sdk-version.d.ts +0 -0
- /package/dist/{webpack/configs → core}/utils/get-web-components-version.d.ts +0 -0
- /package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/__tests__/get-package-json.test.ts +0 -0
- /package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/__tests__/is-optional-peer-dependency.test.ts +0 -0
- /package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/__tests__/is-optional-react-dom-peer-dependency.test.ts +0 -0
- /package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/is-optional-peer-dependency.ts +0 -0
- /package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/is-optional-react-dom-peer-dependency.ts +0 -0
- /package/src/{webpack/configs → core}/utils/__tests__/get-exposed-dependencies.test.ts +0 -0
- /package/src/{webpack/configs → core}/utils/__tests__/get-launchdarkly-sdk-version.test.ts +0 -0
- /package/src/{webpack/configs → core}/utils/__tests__/get-web-components-version.test.ts +0 -0
- /package/src/{webpack/configs → core}/utils/get-exposed-dependencies.ts +0 -0
- /package/src/{webpack → core}/utils/stringify-config.ts +0 -0
|
@@ -1,28 +1,19 @@
|
|
|
1
1
|
import HtmlWebpackTagsPlugin from 'html-webpack-tags-plugin';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { getExposedDependenciesEntryPoints } from './assets-manifest-plugin';
|
|
2
|
+
import { BuildContext, getSharedEntryPoints } from '../../../core';
|
|
3
|
+
import { Overrides } from '../../types';
|
|
5
4
|
|
|
6
|
-
export function htmlTagsPlugin(context:
|
|
7
|
-
const {
|
|
5
|
+
export function htmlTagsPlugin(context: BuildContext, _overrides: Overrides) {
|
|
6
|
+
const { isExposeSharedDependencies } = context.package;
|
|
7
|
+
const { emitExposedDependencies } = context.options.bundlerConfig;
|
|
8
8
|
if (!isExposeSharedDependencies || emitExposedDependencies) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const { css, js } = getSharedEntryPoints(context);
|
|
13
|
+
const sharedEntryPoints = [...css, ...js];
|
|
13
14
|
if (!sharedEntryPoints.length) {
|
|
14
15
|
return;
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
return new HtmlWebpackTagsPlugin({ tags: sharedEntryPoints, append: false });
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
function getSharedEntryPoints(context: Context) {
|
|
21
|
-
const dirname = getBundleType({ ...context, emitExposedDependencies: true });
|
|
22
|
-
if (!dirname) {
|
|
23
|
-
return [];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const { css = [], js = [] } = getExposedDependenciesEntryPoints(context) ?? {};
|
|
27
|
-
return [...css, ...js].map(name => `${dirname}/${name}`);
|
|
28
|
-
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = {};
|
|
@@ -1,13 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Compiler } from 'webpack';
|
|
2
|
+
import { BuildContext, checkResource } from '../../../../core';
|
|
3
|
+
import { Overrides } from '../../../types';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* TODO: backward compatibility
|
|
7
|
+
* TODO: rename things
|
|
8
|
+
* Custom plugin to replace optional peer dependencies with an empty module
|
|
9
|
+
* Follows the same pattern as IgnorePlugin by tapping into normalModuleFactory hooks
|
|
10
|
+
*/
|
|
11
|
+
class ReplaceOptionalDependenciesPlugin {
|
|
12
|
+
private readonly checkResource: (resource: string, context: string) => boolean;
|
|
13
|
+
private readonly emptyModulePath: string;
|
|
14
|
+
|
|
15
|
+
constructor(checkResource: (resource: string, context: string) => boolean) {
|
|
16
|
+
this.checkResource = checkResource;
|
|
17
|
+
this.emptyModulePath = require.resolve('./empty-module.js');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
apply(compiler: Compiler) {
|
|
21
|
+
compiler.hooks.normalModuleFactory.tap(
|
|
22
|
+
'ReplaceOptionalDependenciesPlugin',
|
|
23
|
+
normalModuleFactory => {
|
|
24
|
+
normalModuleFactory.hooks.beforeResolve.tap(
|
|
25
|
+
'ReplaceOptionalDependenciesPlugin',
|
|
26
|
+
resolveData => {
|
|
27
|
+
if (!resolveData) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const { request, context } = resolveData;
|
|
32
|
+
|
|
33
|
+
// Check if this module should be replaced
|
|
34
|
+
if (this.checkResource(request, context)) {
|
|
35
|
+
// Replace the request with the empty module path
|
|
36
|
+
resolveData.request = this.emptyModulePath;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function ignorePlugin(context: BuildContext, _: Overrides) {
|
|
6
46
|
/**
|
|
7
|
-
* Ignore optional peer dependencies
|
|
47
|
+
* Ignore optional peer dependencies by replacing them with an empty module
|
|
8
48
|
* @see {@link: file://./../../../../../../web-components/src/register.tsx}
|
|
9
49
|
* @see {@link: file://./../../../../../../web-components/src/render.ts}
|
|
10
50
|
* @see {@link: file://./../../../../../../ko-bridge/src/ko-binding-handlers.tsx}
|
|
11
51
|
*/
|
|
12
|
-
|
|
52
|
+
const shouldIgnore = checkResource(context);
|
|
53
|
+
|
|
54
|
+
return new ReplaceOptionalDependenciesPlugin(shouldIgnore);
|
|
13
55
|
}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
2
|
-
import {
|
|
2
|
+
import { BuildContext } from '../../../core';
|
|
3
|
+
import { Overrides } from '../../types';
|
|
3
4
|
|
|
4
|
-
export function miniCssExtractPlugin(context:
|
|
5
|
-
const {
|
|
6
|
-
|
|
5
|
+
export function miniCssExtractPlugin(context: BuildContext, overrides: Overrides) {
|
|
6
|
+
const { isProduction } = context.build;
|
|
7
|
+
const { isExposeSharedDependencies, isWebComponent } = context.package;
|
|
8
|
+
const { isCustomStyleRules, emitExposedDependencies } = context.options.bundlerConfig;
|
|
7
9
|
|
|
8
|
-
if (
|
|
10
|
+
if (
|
|
11
|
+
(!isCustomStyleRules || emitExposedDependencies) &&
|
|
12
|
+
(isProduction || isWebComponent || isExposeSharedDependencies)
|
|
13
|
+
) {
|
|
9
14
|
return new MiniCssExtractPlugin({
|
|
10
15
|
filename: isProduction ? '[name].[contenthash].bundle.css' : '[name].bundle.css',
|
|
11
16
|
...overrides.plugins?.MiniCssExtractPlugin,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BuildContext } from '../../../core';
|
|
2
|
+
import { Overrides } from '../../types';
|
|
2
3
|
|
|
3
4
|
const MomentLocalesPlugin: typeof import('moment-locales-webpack-plugin') | undefined =
|
|
4
5
|
isMomentInstalled() ? require('moment-locales-webpack-plugin') : undefined;
|
|
5
6
|
|
|
6
|
-
export function momentLocalesPlugin(_:
|
|
7
|
+
export function momentLocalesPlugin(_: BuildContext, _overrides: Overrides) {
|
|
7
8
|
return (
|
|
8
9
|
MomentLocalesPlugin &&
|
|
9
10
|
new MomentLocalesPlugin({
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import RemoveEmptyScriptsPlugin from 'webpack-remove-empty-scripts';
|
|
2
|
-
import {
|
|
2
|
+
import { BuildContext } from '../../../core';
|
|
3
|
+
import { Overrides } from '../../types';
|
|
3
4
|
|
|
4
|
-
export function removeEmptyScriptsPlugin(context:
|
|
5
|
-
const { emitExposedDependencies } = context;
|
|
5
|
+
export function removeEmptyScriptsPlugin(context: BuildContext, _overrides: Overrides) {
|
|
6
|
+
const { emitExposedDependencies } = context.options.bundlerConfig;
|
|
6
7
|
if (!emitExposedDependencies) {
|
|
7
8
|
return;
|
|
8
9
|
}
|
|
@@ -1,80 +1,28 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import VirtualModulesPlugin from 'webpack-virtual-modules';
|
|
4
|
-
import {
|
|
4
|
+
import { BuildContext, getDesignSystemPath, virtualModules } from '../../../core';
|
|
5
|
+
import { Overrides } from '../../types';
|
|
5
6
|
|
|
6
|
-
export function virtualModulesPlugin(context:
|
|
7
|
-
const { destination } = context;
|
|
7
|
+
export function virtualModulesPlugin(context: BuildContext, _: Overrides) {
|
|
8
|
+
const { destination } = context.package;
|
|
8
9
|
|
|
9
|
-
const modules
|
|
10
|
+
const modules = virtualModules(context);
|
|
11
|
+
const webpackModules: ConstructorParameters<typeof VirtualModulesPlugin>[0] = {};
|
|
10
12
|
|
|
11
|
-
if (
|
|
13
|
+
if (modules.index) {
|
|
12
14
|
const indexPath = path.join(process.cwd(), destination, 'index');
|
|
13
|
-
|
|
15
|
+
webpackModules[indexPath] = modules.index;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
if (
|
|
18
|
+
if (modules.designSystem) {
|
|
17
19
|
const designSystemPath = getDesignSystemPath(context);
|
|
18
20
|
if (!fs.existsSync(designSystemPath)) {
|
|
19
|
-
|
|
21
|
+
webpackModules[designSystemPath] = modules.designSystem;
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
|
|
23
|
-
return Object.keys(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export function getDesignSystemPath({ destination }: Context) {
|
|
27
|
-
return path.join(process.cwd(), destination, 'design-system.css');
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function designSystemCode() {
|
|
31
|
-
return [
|
|
32
|
-
`@import '~@servicetitan/tokens/core/tokens.css';`,
|
|
33
|
-
`@import '~@servicetitan/anvil-fonts/dist/css/anvil-fonts.css';`,
|
|
34
|
-
`@import '~@servicetitan/design-system/dist/system.min.css';`,
|
|
35
|
-
].join('\n');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function indexCode(context: Context) {
|
|
39
|
-
const { embed = false, headless, isLegacyRoot, sharedDependencies } = context;
|
|
40
|
-
if (headless) {
|
|
41
|
-
return headlessIndex();
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const options = `{ legacyRoot: ${isLegacyRoot}, sharedDependenciesNames: ${JSON.stringify(
|
|
45
|
-
Object.keys(sharedDependencies)
|
|
46
|
-
)} }`;
|
|
47
|
-
return [
|
|
48
|
-
...(needsToIncludeDesignSystem(context) ? [`require('./design-system.css');`] : []),
|
|
49
|
-
`import { register } from '@servicetitan/web-components';`,
|
|
50
|
-
`import { App } from './app';`,
|
|
51
|
-
`register(App, ${embed}, ${options});`,
|
|
52
|
-
].join('\n');
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function needsToIncludeDesignSystem({
|
|
56
|
-
embed,
|
|
57
|
-
emitExposedDependencies,
|
|
58
|
-
headless,
|
|
59
|
-
isWebComponent,
|
|
60
|
-
packageData,
|
|
61
|
-
sharedDependencies,
|
|
62
|
-
}: Context) {
|
|
63
|
-
return (
|
|
64
|
-
(!!emitExposedDependencies && !!sharedDependencies['@servicetitan/design-system']) ||
|
|
65
|
-
(isWebComponent &&
|
|
66
|
-
!headless &&
|
|
67
|
-
// Depends on design system
|
|
68
|
-
!!packageData.dependencies['@servicetitan/design-system'] &&
|
|
69
|
-
// ... and is not light bundle with private copy of design system
|
|
70
|
-
!(embed && !!sharedDependencies['@servicetitan/design-system']))
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function headlessIndex() {
|
|
75
|
-
return [
|
|
76
|
-
"import { registerHeadless } from '@servicetitan/web-components';",
|
|
77
|
-
"import { connectedCallback, disconnectedCallback } from './headless';",
|
|
78
|
-
'registerHeadless(connectedCallback, disconnectedCallback);',
|
|
79
|
-
].join('\n');
|
|
25
|
+
return Object.keys(webpackModules).length
|
|
26
|
+
? new VirtualModulesPlugin(webpackModules)
|
|
27
|
+
: undefined;
|
|
80
28
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { Compiler } from 'webpack';
|
|
3
|
+
import { BuildContext } from '../../../core';
|
|
3
4
|
import { log } from '../../../utils';
|
|
4
|
-
import {
|
|
5
|
+
import { Overrides } from '../../types';
|
|
5
6
|
|
|
6
|
-
export function watchRunPlugin(_context:
|
|
7
|
+
export function watchRunPlugin(_context: BuildContext, _overrides: Overrides) {
|
|
7
8
|
/* istanbul ignore next: debug only */
|
|
8
9
|
if (log.debug('modified-files').enabled) {
|
|
9
10
|
return new WatchRunPlugin();
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Configuration } from 'webpack';
|
|
2
|
+
import { BuildContext } from '../../core';
|
|
3
|
+
import { Overrides } from '../types';
|
|
2
4
|
import {
|
|
3
5
|
assetsManifestPlugin,
|
|
4
6
|
bundleAnalyzerPlugin,
|
|
@@ -15,12 +17,11 @@ import {
|
|
|
15
17
|
virtualModulesPlugin,
|
|
16
18
|
watchRunPlugin,
|
|
17
19
|
} from './plugins';
|
|
18
|
-
import { Context, Overrides } from './types';
|
|
19
20
|
|
|
20
21
|
type Config = Configuration['plugins'];
|
|
21
22
|
type Result = Pick<Configuration, 'plugins'>;
|
|
22
23
|
|
|
23
|
-
export function pluginsConfig(context:
|
|
24
|
+
export function pluginsConfig(context: BuildContext, overrides: Overrides): Result {
|
|
24
25
|
const plugins: Config = [
|
|
25
26
|
assetsManifestPlugin,
|
|
26
27
|
bundleAnalyzerPlugin,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Configuration } from 'webpack';
|
|
2
|
-
import {
|
|
2
|
+
import { BuildContext } from '../../core';
|
|
3
|
+
import { Overrides } from '../types';
|
|
3
4
|
|
|
4
5
|
type Config = Configuration['resolve'];
|
|
5
6
|
type Result = Pick<Configuration, 'resolve'>;
|
|
6
7
|
|
|
7
|
-
export function resolveConfig(_context:
|
|
8
|
+
export function resolveConfig(_context: BuildContext, _: Overrides): Result {
|
|
8
9
|
const resolve: Config = {
|
|
9
10
|
extensions: ['.js'],
|
|
10
11
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { RuleSetRule } from 'webpack';
|
|
3
|
+
import { BuildContext } from '../../../core';
|
|
3
4
|
import { log } from '../../../utils';
|
|
4
5
|
import { cssLoader, styleLoader } from '../loaders';
|
|
5
|
-
import { Context } from '../types';
|
|
6
6
|
|
|
7
|
-
export function cssRules(context:
|
|
8
|
-
const {
|
|
7
|
+
export function cssRules(context: BuildContext): RuleSetRule[] {
|
|
8
|
+
const { isExposeSharedDependencies, sharedDependencies } = context.package;
|
|
9
|
+
const { emitExposedDependencies } = context.options.bundlerConfig;
|
|
9
10
|
const result: RuleSetRule[] = [
|
|
10
11
|
{
|
|
11
12
|
test: /\.module.css$/,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RuleSetRule } from 'webpack';
|
|
2
|
-
import {
|
|
2
|
+
import { BuildContext } from '../../../core';
|
|
3
3
|
|
|
4
|
-
export function fontRules(_:
|
|
4
|
+
export function fontRules(_: BuildContext): RuleSetRule[] {
|
|
5
5
|
return [
|
|
6
6
|
{
|
|
7
7
|
test: /\.(woff|woff2|eot|ttf|otf)$/i,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RuleSetRule } from 'webpack';
|
|
2
|
-
import {
|
|
2
|
+
import { BuildContext } from '../../../core';
|
|
3
3
|
|
|
4
|
-
export function imageRules(_:
|
|
4
|
+
export function imageRules(_: BuildContext): RuleSetRule[] {
|
|
5
5
|
return [
|
|
6
6
|
{
|
|
7
7
|
test: /\.(png|jpg|jpeg|gif)$/i,
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { RuleSetRule } from 'webpack';
|
|
3
|
-
import {
|
|
3
|
+
import { BuildContext } from '../../../core';
|
|
4
4
|
|
|
5
|
-
export function jsRules(
|
|
5
|
+
export function jsRules(context: BuildContext): RuleSetRule[] {
|
|
6
|
+
const { destination } = context.package;
|
|
7
|
+
const { codeCoverage } = context.options;
|
|
6
8
|
const result: RuleSetRule[] = [
|
|
7
9
|
{
|
|
8
10
|
enforce: 'pre',
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RuleSetRule } from 'webpack';
|
|
2
|
+
import { BuildContext } from '../../../core';
|
|
2
3
|
import { cssLoader, lessLoader, styleLoader } from '../loaders';
|
|
3
|
-
import { Context } from '../types';
|
|
4
4
|
|
|
5
|
-
export function lessRules(context:
|
|
5
|
+
export function lessRules(context: BuildContext): RuleSetRule[] {
|
|
6
6
|
return [
|
|
7
7
|
{
|
|
8
8
|
test: /\.module.less$/,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RuleSetRule } from 'webpack';
|
|
2
|
+
import { BuildContext } from '../../../core';
|
|
2
3
|
import { cssLoader, styleLoader } from '../loaders';
|
|
3
|
-
import { Context } from '../types';
|
|
4
4
|
|
|
5
|
-
export function scssRules(context:
|
|
5
|
+
export function scssRules(context: BuildContext): RuleSetRule[] {
|
|
6
6
|
return [
|
|
7
7
|
{
|
|
8
8
|
test: /\.module.scss$/,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RuleSetRule } from 'webpack';
|
|
2
|
-
import {
|
|
2
|
+
import { BuildContext } from '../../../core';
|
|
3
3
|
|
|
4
|
-
export function svgRules(_:
|
|
4
|
+
export function svgRules(_: BuildContext): RuleSetRule[] {
|
|
5
5
|
// Using [\\\/] because Windows uses backslash as path separator
|
|
6
6
|
const librariesRegEx = /node_modules[\\\/]@servicetitan[\\\/]anvil2/;
|
|
7
7
|
|
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
import { RuleSetRule } from 'webpack';
|
|
2
|
+
import { BuildContext } from '../../core';
|
|
3
|
+
import { Overrides } from '../types';
|
|
2
4
|
import { getModuleEntryPath } from '../utils';
|
|
3
5
|
import { cssRules, fontRules, imageRules, jsRules, lessRules, scssRules, svgRules } from './rules';
|
|
4
|
-
import { Context, Overrides } from './types';
|
|
5
6
|
|
|
6
7
|
interface Result {
|
|
7
8
|
rules: RuleSetRule[];
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
export function rulesConfig(context:
|
|
11
|
+
export function rulesConfig(context: BuildContext, _: Overrides): Result {
|
|
11
12
|
const rules = [jsRules, imageRules, fontRules, svgRules, sharedDependenciesRules].flatMap(fn =>
|
|
12
13
|
fn(context)
|
|
13
14
|
);
|
|
14
15
|
|
|
15
|
-
if (
|
|
16
|
+
if (
|
|
17
|
+
!context.options.bundlerConfig.isCustomStyleRules ||
|
|
18
|
+
context.options.bundlerConfig.emitExposedDependencies
|
|
19
|
+
) {
|
|
16
20
|
rules.push(...[scssRules, lessRules, cssRules].flatMap(fn => fn(context)));
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
return { rules };
|
|
20
24
|
}
|
|
21
25
|
|
|
22
|
-
function sharedDependenciesRules(context:
|
|
23
|
-
const { isExposeSharedDependencies, sharedDependencies } = context;
|
|
26
|
+
function sharedDependenciesRules(context: BuildContext): RuleSetRule[] {
|
|
27
|
+
const { isExposeSharedDependencies, sharedDependencies } = context.package;
|
|
24
28
|
if (!isExposeSharedDependencies) {
|
|
25
29
|
return [];
|
|
26
30
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Configuration } from 'webpack';
|
|
2
|
-
import {
|
|
2
|
+
import { BuildContext } from '../../core';
|
|
3
|
+
import { Overrides } from '../types';
|
|
3
4
|
|
|
4
5
|
type Config = Configuration['stats'];
|
|
5
6
|
type Result = Pick<Configuration, 'stats'>;
|
|
6
7
|
|
|
7
|
-
export function statsConfig(_context:
|
|
8
|
+
export function statsConfig(_context: BuildContext, _: Overrides): Result {
|
|
8
9
|
const stats: Config = {
|
|
9
10
|
all: false,
|
|
10
11
|
errors: true,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Configuration } from 'webpack';
|
|
2
|
-
import {
|
|
2
|
+
import { BuildContext } from '../../core';
|
|
3
3
|
|
|
4
4
|
type Config = Configuration['watchOptions'];
|
|
5
5
|
type Result = Pick<Configuration, 'watchOptions'> | undefined;
|
|
6
6
|
|
|
7
|
-
export function watchOptionsConfig(
|
|
8
|
-
if (isProduction) {
|
|
7
|
+
export function watchOptionsConfig(context: BuildContext): Result {
|
|
8
|
+
if (context.build.isProduction) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
1
3
|
import { Configuration } from 'webpack';
|
|
2
4
|
import { merge } from 'webpack-merge';
|
|
3
|
-
import
|
|
4
|
-
import { hideBin } from 'yargs/helpers';
|
|
5
|
-
import { webpackDevConfigFileName, webpackProdConfigFileName } from '../cli/utils';
|
|
5
|
+
import { createBuildContext, getName, stringifyConfig } from '../core';
|
|
6
6
|
import {
|
|
7
|
-
getFolders,
|
|
8
|
-
getPackageData,
|
|
9
7
|
getWebpackConfiguration,
|
|
8
|
+
hasHeadlessBundle,
|
|
10
9
|
isCustomStyleRules,
|
|
11
|
-
isExposeSharedDependencies,
|
|
12
|
-
isLegacyRoot,
|
|
13
10
|
isWebComponent,
|
|
14
|
-
loadSharedDependencies,
|
|
15
11
|
log,
|
|
12
|
+
validateSharedDependenciesConsistency,
|
|
16
13
|
} from '../utils';
|
|
17
14
|
import {
|
|
18
|
-
Context,
|
|
19
15
|
amdConfig,
|
|
20
16
|
cacheConfig,
|
|
21
17
|
devServerConfig,
|
|
@@ -31,15 +27,31 @@ import {
|
|
|
31
27
|
watchOptionsConfig,
|
|
32
28
|
} from './configs';
|
|
33
29
|
import { Options, Overrides } from './types';
|
|
34
|
-
import { getCallerFile
|
|
30
|
+
import { getCallerFile } from './utils';
|
|
31
|
+
|
|
32
|
+
export const webpackDevConfigFileName = 'webpack.dev.config.js';
|
|
33
|
+
export const webpackProdConfigFileName = 'webpack.prod.config.js';
|
|
35
34
|
|
|
36
35
|
export function createWebpackConfig(overrides: Overrides, options: Options = {}): Configuration {
|
|
37
|
-
const context =
|
|
38
|
-
|
|
36
|
+
const context = createBuildContext({
|
|
37
|
+
name: options.name ?? '',
|
|
38
|
+
isProduction: overrides.configuration?.mode !== 'development',
|
|
39
|
+
light: options.light,
|
|
40
|
+
headless: options.headless,
|
|
41
|
+
codeCoverage: options.codeCoverage,
|
|
42
|
+
buildStat: options.buildStat,
|
|
43
|
+
bundlerConfig: {
|
|
44
|
+
emitExposedDependencies: options.emitExposedDependencies,
|
|
45
|
+
minify: getWebpackConfiguration().minify,
|
|
46
|
+
isCustomStyleRules: isCustomStyleRules(),
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
if (context.package.isWebComponent && isCalledFromCustomWebpackConfigFile()) {
|
|
39
51
|
throw new Error(WEB_COMPONENT_CONFIG_ERROR);
|
|
40
52
|
}
|
|
41
53
|
|
|
42
|
-
if (options.emitExposedDependencies && !context.isExposeSharedDependencies) {
|
|
54
|
+
if (options.emitExposedDependencies && !context.package.isExposeSharedDependencies) {
|
|
43
55
|
throw new Error('package does not expose shared dependencies');
|
|
44
56
|
}
|
|
45
57
|
|
|
@@ -70,36 +82,6 @@ export function createWebpackConfig(overrides: Overrides, options: Options = {})
|
|
|
70
82
|
return result;
|
|
71
83
|
}
|
|
72
84
|
|
|
73
|
-
function getContext({ configuration = {} }: Overrides, options: Options): Context {
|
|
74
|
-
const { source, destination } = getFolders();
|
|
75
|
-
const { minify } = getWebpackConfiguration();
|
|
76
|
-
const packageData = getPackageData();
|
|
77
|
-
const sharedDependencies = loadSharedDependencies(
|
|
78
|
-
packageData.dependencies,
|
|
79
|
-
packageData.sharedDependencies
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
const args = yargs(hideBin(process.argv)).argv as Arguments;
|
|
83
|
-
const emitExposedDependencies = options.emitExposedDependencies;
|
|
84
|
-
|
|
85
|
-
return {
|
|
86
|
-
codeCoverage: options.codeCoverage ?? !!args['code-coverage'],
|
|
87
|
-
destination,
|
|
88
|
-
emitExposedDependencies,
|
|
89
|
-
isCustomStyleRules: !emitExposedDependencies && isCustomStyleRules(),
|
|
90
|
-
isExposeSharedDependencies: isExposeSharedDependencies(),
|
|
91
|
-
isLegacyRoot: isLegacyRoot(),
|
|
92
|
-
isProduction: configuration.mode === 'production',
|
|
93
|
-
isWebComponent: isWebComponent(),
|
|
94
|
-
minify,
|
|
95
|
-
name: '',
|
|
96
|
-
...options,
|
|
97
|
-
packageData,
|
|
98
|
-
sharedDependencies,
|
|
99
|
-
source,
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
|
|
103
85
|
function isCalledFromCustomWebpackConfigFile() {
|
|
104
86
|
const callerFileName = getCallerFile();
|
|
105
87
|
return [webpackDevConfigFileName, webpackProdConfigFileName].some(configFileName =>
|
|
@@ -113,3 +95,66 @@ const WEB_COMPONENT_CONFIG_ERROR = `
|
|
|
113
95
|
`
|
|
114
96
|
.replace(/\n\s*/g, ' ')
|
|
115
97
|
.trim();
|
|
98
|
+
|
|
99
|
+
export function createWebpackConfigs(options: {
|
|
100
|
+
buildStat?: boolean;
|
|
101
|
+
codeCoverage?: boolean;
|
|
102
|
+
config?: string;
|
|
103
|
+
emitExposedDependencies?: boolean;
|
|
104
|
+
useWatchConfig?: boolean;
|
|
105
|
+
watch?: boolean;
|
|
106
|
+
}): Configuration[] {
|
|
107
|
+
validateSharedDependenciesConsistency();
|
|
108
|
+
|
|
109
|
+
const { watch, useWatchConfig } = options;
|
|
110
|
+
const mode = watch || useWatchConfig ? 'development' : 'production';
|
|
111
|
+
const fallback = watch || useWatchConfig ? webpackDevConfigFileName : webpackProdConfigFileName;
|
|
112
|
+
const customConfig = readWebpackConfig({ config: options.config, fallback });
|
|
113
|
+
|
|
114
|
+
/* istanbul ignore next: debug only */
|
|
115
|
+
log.debug('custom-webpack-config', () => stringifyConfig(customConfig));
|
|
116
|
+
|
|
117
|
+
const emitExposedDependencies =
|
|
118
|
+
options.emitExposedDependencies && customConfig
|
|
119
|
+
? { output: customConfig.output }
|
|
120
|
+
: options.emitExposedDependencies;
|
|
121
|
+
|
|
122
|
+
const resolved: Options = {
|
|
123
|
+
buildStat: options.buildStat,
|
|
124
|
+
codeCoverage: options.codeCoverage,
|
|
125
|
+
emitExposedDependencies,
|
|
126
|
+
name: getName(),
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
if (isWebComponent()) {
|
|
130
|
+
const overrides: Overrides = {
|
|
131
|
+
configuration: { ...customConfig?.configuration, mode },
|
|
132
|
+
plugins: customConfig?.plugins,
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const configs = [
|
|
136
|
+
createWebpackConfig(overrides, resolved),
|
|
137
|
+
createWebpackConfig(overrides, { ...resolved, light: true }),
|
|
138
|
+
];
|
|
139
|
+
if (hasHeadlessBundle()) {
|
|
140
|
+
configs.push(createWebpackConfig(overrides, { ...resolved, headless: true }));
|
|
141
|
+
}
|
|
142
|
+
return configs;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (customConfig && !emitExposedDependencies) {
|
|
146
|
+
return [customConfig];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return [createWebpackConfig({ configuration: { mode } }, resolved)];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function readWebpackConfig({ config, fallback }: { config?: string; fallback: string }) {
|
|
153
|
+
return readConfig(config) ?? readConfig(fallback);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function readConfig(relativePath?: string): Record<string, any> | undefined {
|
|
157
|
+
if (relativePath && fs.existsSync(relativePath)) {
|
|
158
|
+
return require(path.resolve(relativePath));
|
|
159
|
+
}
|
|
160
|
+
}
|
package/src/webpack/types.ts
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import { Options as HtmlWebpackPluginOptions } from 'html-webpack-plugin';
|
|
2
2
|
import { PluginOptions as MiniCssExtractPlugInOptions } from 'mini-css-extract-plugin';
|
|
3
3
|
import { Configuration } from 'webpack';
|
|
4
|
+
import { BuildIdentity, BuildOptions, BundlerConfig } from '../core';
|
|
4
5
|
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
embed?: boolean;
|
|
12
|
-
emitExposedDependencies?: boolean | ExposedDependenciesConfig;
|
|
13
|
-
headless?: boolean;
|
|
14
|
-
name?: string;
|
|
15
|
-
}
|
|
6
|
+
export type Options = Partial<
|
|
7
|
+
Pick<BuildIdentity, 'name' | 'light' | 'headless'> &
|
|
8
|
+
Pick<BuildOptions, 'codeCoverage' | 'buildStat'>
|
|
9
|
+
> & {
|
|
10
|
+
emitExposedDependencies?: BundlerConfig['emitExposedDependencies'];
|
|
11
|
+
};
|
|
16
12
|
|
|
17
13
|
export interface Overrides {
|
|
18
14
|
configuration?: Configuration;
|