@servicetitan/startup 34.2.0 → 34.3.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/commands/build.d.ts +16 -0
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +15 -2
- package/dist/cli/commands/build.js.map +1 -1
- package/dist/cli/commands/bundle-vite.d.ts +66 -0
- package/dist/cli/commands/bundle-vite.d.ts.map +1 -0
- package/dist/cli/commands/bundle-vite.js +184 -0
- package/dist/cli/commands/bundle-vite.js.map +1 -0
- package/dist/cli/commands/get-command.d.ts.map +1 -1
- package/dist/cli/commands/get-command.js +2 -0
- package/dist/cli/commands/get-command.js.map +1 -1
- package/dist/cli/commands/mfe-check.d.ts.map +1 -1
- package/dist/cli/commands/mfe-check.js +2 -2
- package/dist/cli/commands/mfe-check.js.map +1 -1
- package/dist/cli/commands/mfe-generate-metadata.js +2 -2
- package/dist/cli/commands/mfe-generate-metadata.js.map +1 -1
- package/dist/cli/commands/mfe-package-publish.js.map +1 -1
- package/dist/cli/commands/start.d.ts +8 -0
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +8 -2
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/tasks/swc-compile-package.js +127 -0
- package/dist/cli/tasks/swc-compile-package.js.map +1 -0
- package/dist/cli/tasks/tsc-compile-package.js +46 -0
- package/dist/cli/tasks/tsc-compile-package.js.map +1 -0
- package/dist/cli/tasks/tsc-compile.js +68 -0
- package/dist/cli/tasks/tsc-compile.js.map +1 -0
- package/dist/cli/utils/bundle.d.ts +2 -5
- package/dist/cli/utils/bundle.d.ts.map +1 -1
- package/dist/cli/utils/bundle.js +18 -98
- package/dist/cli/utils/bundle.js.map +1 -1
- package/dist/core/check-resource/check-resource.d.ts +3 -0
- package/dist/core/check-resource/check-resource.d.ts.map +1 -0
- package/dist/core/check-resource/check-resource.js +40 -0
- package/dist/core/check-resource/check-resource.js.map +1 -0
- package/dist/core/check-resource/get-package-json.d.ts.map +1 -0
- package/dist/core/check-resource/get-package-json.js +37 -0
- package/dist/core/check-resource/get-package-json.js.map +1 -0
- package/dist/core/check-resource/index.d.ts +2 -0
- package/dist/core/check-resource/index.d.ts.map +1 -0
- package/dist/core/check-resource/index.js +13 -0
- package/dist/core/check-resource/index.js.map +1 -0
- package/dist/core/check-resource/is-optional-peer-dependency.d.ts.map +1 -0
- package/dist/core/check-resource/is-optional-peer-dependency.js +27 -0
- package/dist/core/check-resource/is-optional-peer-dependency.js.map +1 -0
- package/dist/core/check-resource/is-optional-react-dom-peer-dependency.d.ts.map +1 -0
- package/dist/core/check-resource/is-optional-react-dom-peer-dependency.js +15 -0
- package/dist/core/check-resource/is-optional-react-dom-peer-dependency.js.map +1 -0
- package/dist/core/context.d.ts +14 -0
- package/dist/core/context.d.ts.map +1 -0
- package/dist/core/context.js +62 -0
- package/dist/core/context.js.map +1 -0
- package/dist/core/defines/exposed-dependencies.d.ts +5 -0
- package/dist/core/defines/exposed-dependencies.d.ts.map +1 -0
- package/dist/core/defines/exposed-dependencies.js +26 -0
- package/dist/core/defines/exposed-dependencies.js.map +1 -0
- package/dist/core/defines/exposed-instance-dependencies.d.ts +5 -0
- package/dist/core/defines/exposed-instance-dependencies.d.ts.map +1 -0
- package/dist/core/defines/exposed-instance-dependencies.js +29 -0
- package/dist/core/defines/exposed-instance-dependencies.js.map +1 -0
- package/dist/core/defines/index.d.ts +4 -0
- package/dist/core/defines/index.d.ts.map +1 -0
- package/dist/core/defines/index.js +26 -0
- package/dist/core/defines/index.js.map +1 -0
- package/dist/core/defines/web-component-name.d.ts +5 -0
- package/dist/core/defines/web-component-name.d.ts.map +1 -0
- package/dist/core/defines/web-component-name.js +23 -0
- package/dist/core/defines/web-component-name.js.map +1 -0
- package/dist/core/externals.d.ts +3 -0
- package/dist/core/externals.d.ts.map +1 -0
- package/dist/core/externals.js +29 -0
- package/dist/core/externals.js.map +1 -0
- package/dist/core/get-exposed-dependencies-entry-points.d.ts +11 -0
- package/dist/core/get-exposed-dependencies-entry-points.d.ts.map +1 -0
- package/dist/core/get-exposed-dependencies-entry-points.js +82 -0
- package/dist/core/get-exposed-dependencies-entry-points.js.map +1 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +26 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/types.d.ts +55 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +6 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/utils/build-metadata.d.ts.map +1 -0
- package/dist/core/utils/build-metadata.js +50 -0
- package/dist/core/utils/build-metadata.js.map +1 -0
- package/dist/core/utils/generate-metadata.d.ts +3 -0
- package/dist/core/utils/generate-metadata.d.ts.map +1 -0
- package/dist/core/utils/generate-metadata.js +40 -0
- package/dist/core/utils/generate-metadata.js.map +1 -0
- package/dist/core/utils/get-bundle-type.d.ts +3 -0
- package/dist/core/utils/get-bundle-type.d.ts.map +1 -0
- package/dist/core/utils/get-bundle-type.js +27 -0
- package/dist/core/utils/get-bundle-type.js.map +1 -0
- package/dist/core/utils/get-exposed-dependencies.d.ts.map +1 -0
- package/dist/core/utils/get-exposed-dependencies.js +21 -0
- package/dist/core/utils/get-exposed-dependencies.js.map +1 -0
- package/dist/core/utils/get-launchdarkly-sdk-version.d.ts.map +1 -0
- package/dist/core/utils/get-launchdarkly-sdk-version.js +26 -0
- package/dist/core/utils/get-launchdarkly-sdk-version.js.map +1 -0
- package/dist/core/utils/get-output-path.d.ts +3 -0
- package/dist/core/utils/get-output-path.d.ts.map +1 -0
- package/dist/core/utils/get-output-path.js +32 -0
- package/dist/core/utils/get-output-path.js.map +1 -0
- package/dist/core/utils/get-web-components-version.d.ts.map +1 -0
- package/dist/core/utils/get-web-components-version.js +22 -0
- package/dist/core/utils/get-web-components-version.js.map +1 -0
- package/dist/core/utils/index.d.ts +9 -0
- package/dist/core/utils/index.d.ts.map +1 -0
- package/dist/core/utils/index.js +27 -0
- package/dist/core/utils/index.js.map +1 -0
- package/dist/core/utils/stringify-config.d.ts +2 -0
- package/dist/core/utils/stringify-config.d.ts.map +1 -0
- package/dist/core/utils/stringify-config.js +35 -0
- package/dist/core/utils/stringify-config.js.map +1 -0
- package/dist/core/virtual-modules.d.ts +9 -0
- package/dist/core/virtual-modules.d.ts.map +1 -0
- package/dist/core/virtual-modules.js +84 -0
- package/dist/core/virtual-modules.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/storybook-config/webpack-final.d.ts +1 -1
- package/dist/storybook-config/webpack-final.d.ts.map +1 -1
- package/dist/storybook-config/webpack-final.js +18 -6
- package/dist/storybook-config/webpack-final.js.map +1 -1
- package/dist/utils/get-configuration.d.ts +28 -0
- package/dist/utils/get-configuration.d.ts.map +1 -1
- package/dist/utils/get-configuration.js +42 -1
- package/dist/utils/get-configuration.js.map +1 -1
- package/dist/utils/get-package-data.d.ts.map +1 -1
- package/dist/utils/get-package-data.js +3 -2
- package/dist/utils/get-package-data.js.map +1 -1
- package/dist/vite/base-config.d.ts +4 -0
- package/dist/vite/base-config.d.ts.map +1 -0
- package/dist/vite/base-config.js +65 -0
- package/dist/vite/base-config.js.map +1 -0
- package/dist/vite/build-shared-deps.d.ts +3 -0
- package/dist/vite/build-shared-deps.d.ts.map +1 -0
- package/dist/vite/build-shared-deps.js +310 -0
- package/dist/vite/build-shared-deps.js.map +1 -0
- package/dist/vite/create-vite-config.d.ts +3 -0
- package/dist/vite/create-vite-config.d.ts.map +1 -0
- package/dist/vite/create-vite-config.js +52 -0
- package/dist/vite/create-vite-config.js.map +1 -0
- package/dist/vite/define-config.d.ts +12 -0
- package/dist/vite/define-config.d.ts.map +1 -0
- package/dist/vite/define-config.js +15 -0
- package/dist/vite/define-config.js.map +1 -0
- package/dist/vite/load-config-file.d.ts +6 -0
- package/dist/vite/load-config-file.d.ts.map +1 -0
- package/dist/vite/load-config-file.js +107 -0
- package/dist/vite/load-config-file.js.map +1 -0
- package/dist/vite/merge-config.d.ts +6 -0
- package/dist/vite/merge-config.d.ts.map +1 -0
- package/dist/vite/merge-config.js +106 -0
- package/dist/vite/merge-config.js.map +1 -0
- package/dist/vite/plugins/css-injector-plugin.d.ts +15 -0
- package/dist/vite/plugins/css-injector-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/css-injector-plugin.js +76 -0
- package/dist/vite/plugins/css-injector-plugin.js.map +1 -0
- package/dist/vite/plugins/dev-bundle-routing-plugin.d.ts +7 -0
- package/dist/vite/plugins/dev-bundle-routing-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/dev-bundle-routing-plugin.js +48 -0
- package/dist/vite/plugins/dev-bundle-routing-plugin.js.map +1 -0
- package/dist/vite/plugins/dev-server-routing-plugin.d.ts +12 -0
- package/dist/vite/plugins/dev-server-routing-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/dev-server-routing-plugin.js +85 -0
- package/dist/vite/plugins/dev-server-routing-plugin.js.map +1 -0
- package/dist/vite/plugins/externals-plugin.d.ts +4 -0
- package/dist/vite/plugins/externals-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/externals-plugin.js +39 -0
- package/dist/vite/plugins/externals-plugin.js.map +1 -0
- package/dist/vite/plugins/full-bundle-proxy-plugin.d.ts +14 -0
- package/dist/vite/plugins/full-bundle-proxy-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/full-bundle-proxy-plugin.js +48 -0
- package/dist/vite/plugins/full-bundle-proxy-plugin.js.map +1 -0
- package/dist/vite/plugins/html-plugin.d.ts +5 -0
- package/dist/vite/plugins/html-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/html-plugin.js +74 -0
- package/dist/vite/plugins/html-plugin.js.map +1 -0
- package/dist/vite/plugins/ignore-modules-plugin.d.ts +4 -0
- package/dist/vite/plugins/ignore-modules-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/ignore-modules-plugin.js +30 -0
- package/dist/vite/plugins/ignore-modules-plugin.js.map +1 -0
- package/dist/vite/plugins/index.d.ts +10 -0
- package/dist/vite/plugins/index.d.ts.map +1 -0
- package/dist/vite/plugins/index.js +28 -0
- package/dist/vite/plugins/index.js.map +1 -0
- package/dist/vite/plugins/metadata-plugin.d.ts +4 -0
- package/dist/vite/plugins/metadata-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/metadata-plugin.js +86 -0
- package/dist/vite/plugins/metadata-plugin.js.map +1 -0
- package/dist/vite/plugins/outdir-rewrite-plugin.d.ts +9 -0
- package/dist/vite/plugins/outdir-rewrite-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/preview-static-files-plugin.d.ts +9 -0
- package/dist/vite/plugins/preview-static-files-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/preview-static-files-plugin.js +50 -0
- package/dist/vite/plugins/preview-static-files-plugin.js.map +1 -0
- package/dist/vite/plugins/shared-deps-dev-server-plugin.d.ts +11 -0
- package/dist/vite/plugins/shared-deps-dev-server-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/shared-deps-rewrite-plugin.d.ts +10 -0
- package/dist/vite/plugins/shared-deps-rewrite-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/shared-deps-rewrite-plugin.js +51 -0
- package/dist/vite/plugins/shared-deps-rewrite-plugin.js.map +1 -0
- package/dist/vite/plugins/style-urls-plugin.d.ts +4 -0
- package/dist/vite/plugins/style-urls-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/style-urls-plugin.js +29 -0
- package/dist/vite/plugins/style-urls-plugin.js.map +1 -0
- package/dist/vite/plugins/svgr-plugin.d.ts +4 -0
- package/dist/vite/plugins/svgr-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/svgr-plugin.js +31 -0
- package/dist/vite/plugins/svgr-plugin.js.map +1 -0
- package/dist/vite/plugins/virtual-modules-plugin.d.ts +4 -0
- package/dist/vite/plugins/virtual-modules-plugin.d.ts.map +1 -0
- package/dist/vite/plugins/virtual-modules-plugin.js +71 -0
- package/dist/vite/plugins/virtual-modules-plugin.js.map +1 -0
- package/dist/webpack/configs/amd-config.d.ts +3 -2
- package/dist/webpack/configs/amd-config.d.ts.map +1 -1
- package/dist/webpack/configs/amd-config.js.map +1 -1
- package/dist/webpack/configs/cache-config.d.ts +3 -2
- package/dist/webpack/configs/cache-config.d.ts.map +1 -1
- package/dist/webpack/configs/cache-config.js +1 -1
- package/dist/webpack/configs/cache-config.js.map +1 -1
- package/dist/webpack/configs/dev-server-config.d.ts +3 -2
- package/dist/webpack/configs/dev-server-config.d.ts.map +1 -1
- package/dist/webpack/configs/dev-server-config.js +1 -1
- package/dist/webpack/configs/dev-server-config.js.map +1 -1
- package/dist/webpack/configs/devtool-config.d.ts +3 -2
- package/dist/webpack/configs/devtool-config.d.ts.map +1 -1
- package/dist/webpack/configs/devtool-config.js +1 -1
- package/dist/webpack/configs/devtool-config.js.map +1 -1
- package/dist/webpack/configs/entry.config.d.ts +3 -2
- package/dist/webpack/configs/entry.config.d.ts.map +1 -1
- package/dist/webpack/configs/entry.config.js +6 -5
- package/dist/webpack/configs/entry.config.js.map +1 -1
- package/dist/webpack/configs/externals-config.d.ts +3 -2
- package/dist/webpack/configs/externals-config.d.ts.map +1 -1
- package/dist/webpack/configs/externals-config.js +4 -14
- package/dist/webpack/configs/externals-config.js.map +1 -1
- package/dist/webpack/configs/index.d.ts +0 -1
- package/dist/webpack/configs/index.d.ts.map +1 -1
- package/dist/webpack/configs/index.js.map +1 -1
- package/dist/webpack/configs/loaders/css-loader.d.ts +2 -2
- package/dist/webpack/configs/loaders/css-loader.d.ts.map +1 -1
- package/dist/webpack/configs/loaders/css-loader.js +2 -1
- package/dist/webpack/configs/loaders/css-loader.js.map +1 -1
- package/dist/webpack/configs/loaders/style-loader.d.ts +2 -2
- package/dist/webpack/configs/loaders/style-loader.d.ts.map +1 -1
- package/dist/webpack/configs/loaders/style-loader.js +4 -1
- package/dist/webpack/configs/loaders/style-loader.js.map +1 -1
- package/dist/webpack/configs/module-config.d.ts +3 -2
- package/dist/webpack/configs/module-config.d.ts.map +1 -1
- package/dist/webpack/configs/module-config.js.map +1 -1
- package/dist/webpack/configs/optimization-config.d.ts +3 -2
- package/dist/webpack/configs/optimization-config.d.ts.map +1 -1
- package/dist/webpack/configs/optimization-config.js +10 -7
- package/dist/webpack/configs/optimization-config.js.map +1 -1
- package/dist/webpack/configs/output-config.d.ts +3 -2
- package/dist/webpack/configs/output-config.d.ts.map +1 -1
- package/dist/webpack/configs/output-config.js +15 -24
- package/dist/webpack/configs/output-config.js.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts +3 -8
- package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js +10 -47
- package/dist/webpack/configs/plugins/assets-manifest-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js +6 -6
- package/dist/webpack/configs/plugins/bundle-analyser-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js +4 -13
- package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.js +4 -12
- package/dist/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/define-web-component-name-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/define-web-component-name-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/define-web-component-name-plugin.js +4 -6
- package/dist/webpack/configs/plugins/define-web-component-name-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/filter-warnings-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/filter-warnings-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/filter-warnings-plugin.js +2 -2
- package/dist/webpack/configs/plugins/filter-warnings-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/html-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/html-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/html-plugin.js +5 -2
- package/dist/webpack/configs/plugins/html-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/html-tags-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/html-tags-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/html-tags-plugin.js +8 -19
- package/dist/webpack/configs/plugins/html-tags-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.js +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.js.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts +17 -3
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js +45 -6
- package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.js +4 -2
- package/dist/webpack/configs/plugins/mini-css-extract-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/moment-locales-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/moment-locales-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/moment-locales-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.js +1 -1
- package/dist/webpack/configs/plugins/remove-empty-scripts-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/virtual-modules-plugin.d.ts +3 -3
- package/dist/webpack/configs/plugins/virtual-modules-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/virtual-modules-plugin.js +13 -56
- package/dist/webpack/configs/plugins/virtual-modules-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins/watch-run-plugin.d.ts +3 -2
- package/dist/webpack/configs/plugins/watch-run-plugin.d.ts.map +1 -1
- package/dist/webpack/configs/plugins/watch-run-plugin.js.map +1 -1
- package/dist/webpack/configs/plugins-config.d.ts +3 -2
- package/dist/webpack/configs/plugins-config.d.ts.map +1 -1
- package/dist/webpack/configs/plugins-config.js.map +1 -1
- package/dist/webpack/configs/resolve-config.d.ts +3 -2
- package/dist/webpack/configs/resolve-config.d.ts.map +1 -1
- package/dist/webpack/configs/resolve-config.js.map +1 -1
- package/dist/webpack/configs/rules/css-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/css-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/css-rules.js +2 -1
- package/dist/webpack/configs/rules/css-rules.js.map +1 -1
- package/dist/webpack/configs/rules/font-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/font-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/font-rules.js.map +1 -1
- package/dist/webpack/configs/rules/image-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/image-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/image-rules.js.map +1 -1
- package/dist/webpack/configs/rules/js-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/js-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/js-rules.js +3 -1
- package/dist/webpack/configs/rules/js-rules.js.map +1 -1
- package/dist/webpack/configs/rules/less-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/less-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/less-rules.js.map +1 -1
- package/dist/webpack/configs/rules/scss-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/scss-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/scss-rules.js.map +1 -1
- package/dist/webpack/configs/rules/svg-rules.d.ts +2 -2
- package/dist/webpack/configs/rules/svg-rules.d.ts.map +1 -1
- package/dist/webpack/configs/rules/svg-rules.js.map +1 -1
- package/dist/webpack/configs/rules-config.d.ts +3 -2
- package/dist/webpack/configs/rules-config.d.ts.map +1 -1
- package/dist/webpack/configs/rules-config.js +2 -2
- package/dist/webpack/configs/rules-config.js.map +1 -1
- package/dist/webpack/configs/stats-config.d.ts +3 -2
- package/dist/webpack/configs/stats-config.d.ts.map +1 -1
- package/dist/webpack/configs/stats-config.js.map +1 -1
- package/dist/webpack/configs/watch-options-config.d.ts +2 -2
- package/dist/webpack/configs/watch-options-config.d.ts.map +1 -1
- package/dist/webpack/configs/watch-options-config.js +2 -2
- package/dist/webpack/configs/watch-options-config.js.map +1 -1
- package/dist/webpack/create-webpack-config.d.ts +10 -0
- package/dist/webpack/create-webpack-config.d.ts.map +1 -1
- package/dist/webpack/create-webpack-config.js +109 -41
- package/dist/webpack/create-webpack-config.js.map +1 -1
- package/dist/webpack/types.d.ts +4 -11
- package/dist/webpack/types.d.ts.map +1 -1
- package/dist/webpack/utils/index.d.ts +0 -1
- package/dist/webpack/utils/index.d.ts.map +1 -1
- package/dist/webpack/utils/index.js +0 -1
- package/dist/webpack/utils/index.js.map +1 -1
- package/package.json +13 -10
- package/patches/vite-plugin-css-injected-by-js+3.5.2.patch +63 -0
- package/src/cli/commands/__tests__/mfe-generate-metadata.test.ts +3 -4
- package/src/cli/commands/build.ts +7 -2
- package/src/cli/commands/bundle-vite.ts +112 -0
- package/src/cli/commands/get-command.ts +2 -0
- package/src/cli/commands/mfe-check.ts +1 -2
- package/src/cli/commands/mfe-generate-metadata.ts +1 -1
- package/src/cli/commands/mfe-package-publish.ts +1 -1
- package/src/cli/commands/start.ts +5 -2
- package/src/cli/utils/__tests__/bundle.test.ts +20 -11
- package/src/cli/utils/bundle.ts +20 -101
- package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/__tests__/check-resource.test.ts +18 -5
- package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/check-resource.ts +4 -4
- package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/get-package-json.ts +2 -2
- package/src/core/check-resource/index.ts +1 -0
- package/src/core/context.ts +65 -0
- package/src/core/defines/exposed-dependencies.ts +21 -0
- package/src/core/defines/exposed-instance-dependencies.ts +19 -0
- package/src/core/defines/index.ts +3 -0
- package/src/core/defines/web-component-name.ts +15 -0
- package/src/core/externals.ts +23 -0
- package/src/core/get-exposed-dependencies-entry-points.ts +59 -0
- package/src/core/index.ts +8 -0
- package/src/core/types.ts +59 -0
- package/src/{webpack/configs → core}/utils/__tests__/build-metadata.test.ts +2 -2
- package/src/{webpack/configs → core}/utils/__tests__/generate-metadata.test.ts +27 -13
- package/src/{webpack/configs → core}/utils/build-metadata.ts +1 -1
- package/src/{webpack/configs → core}/utils/generate-metadata.ts +7 -6
- package/src/core/utils/get-bundle-type.ts +20 -0
- package/src/{webpack/configs → core}/utils/get-launchdarkly-sdk-version.ts +1 -1
- package/src/core/utils/get-output-path.ts +18 -0
- package/src/{webpack/configs → core}/utils/get-web-components-version.ts +1 -1
- package/src/core/utils/index.ts +8 -0
- package/src/core/virtual-modules.ts +76 -0
- package/src/index.ts +1 -0
- package/src/storybook-config/__tests__/webpack-final.test.ts +5 -2
- package/src/storybook-config/webpack-final.ts +24 -10
- package/src/utils/__tests__/get-configuration.test.ts +99 -1
- package/src/utils/__tests__/get-package-data.test.ts +35 -1
- package/src/utils/get-configuration.ts +92 -1
- package/src/utils/get-package-data.ts +3 -1
- package/src/vite/__tests__/define-config.test.ts +13 -0
- package/src/vite/__tests__/load-config-file.test.ts +115 -0
- package/src/vite/__tests__/merge-config.test.ts +173 -0
- package/src/vite/base-config.ts +70 -0
- package/src/vite/build-shared-deps.ts +320 -0
- package/src/vite/create-vite-config.ts +50 -0
- package/src/vite/define-config.ts +20 -0
- package/src/vite/index.html +29 -0
- package/src/vite/load-config-file.ts +54 -0
- package/src/vite/merge-config.ts +93 -0
- package/src/vite/plugins/css-injector-plugin.ts +85 -0
- package/src/vite/plugins/dev-server-routing-plugin.ts +89 -0
- package/src/vite/plugins/externals-plugin.ts +27 -0
- package/src/vite/plugins/html-plugin.ts +65 -0
- package/src/vite/plugins/ignore-modules-plugin.ts +22 -0
- package/src/vite/plugins/index.ts +9 -0
- package/src/vite/plugins/metadata-plugin.ts +78 -0
- package/src/vite/plugins/style-urls-plugin.ts +34 -0
- package/src/vite/plugins/svgr-plugin.ts +11 -0
- package/src/vite/plugins/virtual-modules-plugin.ts +74 -0
- package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +2 -2
- package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +11 -11
- package/src/webpack/__tests__/create-webpack-config.test.ts +3 -2
- package/src/webpack/configs/amd-config.ts +3 -2
- package/src/webpack/configs/cache-config.ts +4 -3
- package/src/webpack/configs/dev-server-config.ts +8 -3
- package/src/webpack/configs/devtool-config.ts +4 -3
- package/src/webpack/configs/entry.config.ts +8 -7
- package/src/webpack/configs/externals-config.ts +5 -21
- package/src/webpack/configs/index.ts +0 -1
- package/src/webpack/configs/loaders/css-loader.ts +3 -2
- package/src/webpack/configs/loaders/style-loader.ts +5 -5
- package/src/webpack/configs/module-config.ts +3 -2
- package/src/webpack/configs/optimization-config.ts +16 -11
- package/src/webpack/configs/output-config.ts +16 -22
- package/src/webpack/configs/plugins/assets-manifest-plugin.ts +9 -36
- package/src/webpack/configs/plugins/bundle-analyser-plugin.ts +8 -8
- package/src/webpack/configs/plugins/define-exposed-dependencies-plugin.ts +7 -15
- package/src/webpack/configs/plugins/define-exposed-instance-dependencies-plugin.ts +7 -13
- package/src/webpack/configs/plugins/define-web-component-name-plugin.ts +7 -8
- package/src/webpack/configs/plugins/filter-warnings-plugin.ts +4 -3
- package/src/webpack/configs/plugins/html-plugin.ts +7 -6
- package/src/webpack/configs/plugins/html-tags-plugin.ts +7 -16
- package/src/webpack/configs/plugins/ignore-plugin/empty-module.js +1 -0
- package/src/webpack/configs/plugins/ignore-plugin/ignore-plugin.ts +48 -6
- package/src/webpack/configs/plugins/mini-css-extract-plugin.ts +10 -5
- package/src/webpack/configs/plugins/moment-locales-plugin.ts +3 -2
- package/src/webpack/configs/plugins/remove-empty-scripts-plugin.ts +4 -3
- package/src/webpack/configs/plugins/virtual-modules-plugin.ts +13 -65
- package/src/webpack/configs/plugins/watch-run-plugin.ts +3 -2
- package/src/webpack/configs/plugins-config.ts +3 -2
- package/src/webpack/configs/resolve-config.ts +3 -2
- package/src/webpack/configs/rules/css-rules.ts +4 -3
- package/src/webpack/configs/rules/font-rules.ts +2 -2
- package/src/webpack/configs/rules/image-rules.ts +2 -2
- package/src/webpack/configs/rules/js-rules.ts +4 -2
- package/src/webpack/configs/rules/less-rules.ts +2 -2
- package/src/webpack/configs/rules/scss-rules.ts +2 -2
- package/src/webpack/configs/rules/svg-rules.ts +2 -2
- package/src/webpack/configs/rules-config.ts +9 -5
- package/src/webpack/configs/stats-config.ts +3 -2
- package/src/webpack/configs/watch-options-config.ts +3 -3
- package/src/webpack/create-webpack-config.ts +88 -43
- package/src/webpack/types.ts +7 -11
- package/src/webpack/utils/index.ts +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.d.ts +0 -3
- package/dist/webpack/configs/plugins/ignore-plugin/check-resource.d.ts.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/get-package-json.d.ts.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-peer-dependency.d.ts.map +0 -1
- package/dist/webpack/configs/plugins/ignore-plugin/is-optional-react-dom-peer-dependency.d.ts.map +0 -1
- package/dist/webpack/configs/types.d.ts +0 -35
- package/dist/webpack/configs/types.d.ts.map +0 -1
- package/dist/webpack/configs/utils/build-metadata.d.ts.map +0 -1
- package/dist/webpack/configs/utils/generate-metadata.d.ts +0 -3
- package/dist/webpack/configs/utils/generate-metadata.d.ts.map +0 -1
- package/dist/webpack/configs/utils/get-bundle-type.d.ts +0 -3
- package/dist/webpack/configs/utils/get-bundle-type.d.ts.map +0 -1
- package/dist/webpack/configs/utils/get-exposed-dependencies.d.ts.map +0 -1
- package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.d.ts.map +0 -1
- package/dist/webpack/configs/utils/get-web-components-version.d.ts.map +0 -1
- package/dist/webpack/configs/utils/index.d.ts +0 -4
- package/dist/webpack/configs/utils/index.d.ts.map +0 -1
- package/src/webpack/configs/types.ts +0 -38
- package/src/webpack/configs/utils/get-bundle-type.ts +0 -22
- package/src/webpack/configs/utils/index.ts +0 -3
- /package/dist/{webpack/configs/plugins/ignore-plugin → core/check-resource}/get-package-json.d.ts +0 -0
- /package/dist/{webpack/configs/plugins/ignore-plugin → core/check-resource}/is-optional-peer-dependency.d.ts +0 -0
- /package/dist/{webpack/configs/plugins/ignore-plugin → core/check-resource}/is-optional-react-dom-peer-dependency.d.ts +0 -0
- /package/dist/{webpack/configs → core}/utils/build-metadata.d.ts +0 -0
- /package/dist/{webpack/configs → core}/utils/get-exposed-dependencies.d.ts +0 -0
- /package/dist/{webpack/configs → core}/utils/get-launchdarkly-sdk-version.d.ts +0 -0
- /package/dist/{webpack/configs → core}/utils/get-web-components-version.d.ts +0 -0
- /package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/__tests__/get-package-json.test.ts +0 -0
- /package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/__tests__/is-optional-peer-dependency.test.ts +0 -0
- /package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/__tests__/is-optional-react-dom-peer-dependency.test.ts +0 -0
- /package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/is-optional-peer-dependency.ts +0 -0
- /package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/is-optional-react-dom-peer-dependency.ts +0 -0
- /package/src/{webpack/configs → core}/utils/__tests__/get-exposed-dependencies.test.ts +0 -0
- /package/src/{webpack/configs → core}/utils/__tests__/get-launchdarkly-sdk-version.test.ts +0 -0
- /package/src/{webpack/configs → core}/utils/__tests__/get-web-components-version.test.ts +0 -0
- /package/src/{webpack/configs → core}/utils/get-exposed-dependencies.ts +0 -0
- /package/src/{webpack → core}/utils/stringify-config.ts +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BuildContext } from '../../types';
|
|
2
2
|
import { checkResource } from '../check-resource';
|
|
3
3
|
import { isOptionalPeerDependency } from '../is-optional-peer-dependency';
|
|
4
4
|
import { isOptionalReactDomPeerDependency } from '../is-optional-react-dom-peer-dependency';
|
|
@@ -8,7 +8,7 @@ jest.mock('../is-optional-react-dom-peer-dependency');
|
|
|
8
8
|
|
|
9
9
|
describe(`${checkResource.name}`, () => {
|
|
10
10
|
const context = 'node_modules/web-components/dist';
|
|
11
|
-
let packageContext:
|
|
11
|
+
let packageContext: BuildContext;
|
|
12
12
|
let resource: string;
|
|
13
13
|
|
|
14
14
|
beforeEach(() => {
|
|
@@ -16,15 +16,28 @@ describe(`${checkResource.name}`, () => {
|
|
|
16
16
|
|
|
17
17
|
resource = '@servicetitan/foo';
|
|
18
18
|
packageContext = {
|
|
19
|
-
|
|
19
|
+
build: {
|
|
20
|
+
name: 'application',
|
|
21
|
+
isProduction: false,
|
|
22
|
+
},
|
|
23
|
+
package: {
|
|
20
24
|
name: 'application',
|
|
21
25
|
version: '1.0.0',
|
|
26
|
+
destination: 'dist',
|
|
27
|
+
source: 'src',
|
|
22
28
|
dependencies: {},
|
|
29
|
+
sharedDependencies: {},
|
|
30
|
+
isWebComponent: false,
|
|
31
|
+
isLegacyRoot: false,
|
|
32
|
+
isExposeSharedDependencies: false,
|
|
33
|
+
},
|
|
34
|
+
options: {
|
|
35
|
+
bundlerConfig: {},
|
|
23
36
|
},
|
|
24
37
|
};
|
|
25
38
|
});
|
|
26
39
|
|
|
27
|
-
const subject = () => checkResource(packageContext
|
|
40
|
+
const subject = () => checkResource(packageContext)(resource, context);
|
|
28
41
|
|
|
29
42
|
function itReturns(value: boolean) {
|
|
30
43
|
test(`returns ${value}`, () => expect(subject()).toBe(value));
|
|
@@ -38,7 +51,7 @@ describe(`${checkResource.name}`, () => {
|
|
|
38
51
|
itReturns(true);
|
|
39
52
|
|
|
40
53
|
describe('when resource is package dependency', () => {
|
|
41
|
-
beforeEach(() => (packageContext.
|
|
54
|
+
beforeEach(() => (packageContext.package.dependencies[resource] = '*'));
|
|
42
55
|
|
|
43
56
|
itReturns(false);
|
|
44
57
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { log } from '
|
|
2
|
-
import {
|
|
1
|
+
import { log } from '../../utils';
|
|
2
|
+
import { BuildContext } from '../types';
|
|
3
3
|
import { isOptionalPeerDependency } from './is-optional-peer-dependency';
|
|
4
4
|
import { isOptionalReactDomPeerDependency } from './is-optional-react-dom-peer-dependency';
|
|
5
5
|
|
|
6
|
-
export function checkResource(packageContext:
|
|
6
|
+
export function checkResource(packageContext: BuildContext) {
|
|
7
7
|
return function (resource: string, context: string) {
|
|
8
8
|
if (
|
|
9
|
-
!packageContext.
|
|
9
|
+
!packageContext.package.dependencies[resource] &&
|
|
10
10
|
isOptionalPeerDependency(resource, context)
|
|
11
11
|
) {
|
|
12
12
|
log.debug('check-resource', `${JSON.stringify({ resource, context })} => true`);
|
package/src/{webpack/configs/plugins/ignore-plugin → core/check-resource}/get-package-json.ts
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import { log, readJson } from '
|
|
3
|
+
import { log, readJson } from '../../utils';
|
|
4
4
|
|
|
5
|
-
const containsNodeModules = /[\\/](node_modules|\.yalc)[\\/]/;
|
|
5
|
+
const containsNodeModules = /[\\/](node_modules|\.yalc|uikit)[\\/]/;
|
|
6
6
|
const isNodeModules = /(node_modules|\.yalc)/;
|
|
7
7
|
|
|
8
8
|
export function getPackageJson(context: string) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { checkResource } from './check-resource';
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
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';
|
|
@@ -0,0 +1,59 @@
|
|
|
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,11 +1,11 @@
|
|
|
1
1
|
import { fs, vol } from 'memfs';
|
|
2
|
-
import { getStartupVersion } from '
|
|
2
|
+
import { getStartupVersion } from '../../../utils/get-startup-version';
|
|
3
3
|
import { buildMetadata, BuildMetadataParams } from '../build-metadata';
|
|
4
4
|
import { getLaunchDarklySdkVersion } from '../get-launchdarkly-sdk-version';
|
|
5
5
|
import { getWebComponentsVersion } from '../get-web-components-version';
|
|
6
6
|
|
|
7
7
|
jest.mock('fs', () => fs);
|
|
8
|
-
jest.mock('
|
|
8
|
+
jest.mock('../../../utils/get-startup-version');
|
|
9
9
|
jest.mock('../get-launchdarkly-sdk-version');
|
|
10
10
|
jest.mock('../get-web-components-version');
|
|
11
11
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { fs, vol } from 'memfs';
|
|
2
2
|
|
|
3
3
|
import * as mockedFs from 'fs';
|
|
4
|
-
import { createPackage } from '
|
|
5
|
-
import {
|
|
4
|
+
import { createPackage } from '../../../__mocks__';
|
|
5
|
+
import { BuildContext } from '../../types';
|
|
6
6
|
import { buildMetadata } from '../build-metadata';
|
|
7
7
|
import { generateMetadata } from '../generate-metadata';
|
|
8
8
|
|
|
@@ -16,7 +16,7 @@ function generatedMetadata(dest: string) {
|
|
|
16
16
|
describe(`[startup] ${generateMetadata.name}`, () => {
|
|
17
17
|
const pkg = createPackage({});
|
|
18
18
|
const destination = 'dist';
|
|
19
|
-
let context:
|
|
19
|
+
let context: BuildContext;
|
|
20
20
|
|
|
21
21
|
const mockMetadata = {
|
|
22
22
|
name: pkg.name,
|
|
@@ -36,16 +36,30 @@ describe(`[startup] ${generateMetadata.name}`, () => {
|
|
|
36
36
|
jest.mocked(buildMetadata).mockReturnValue(mockMetadata);
|
|
37
37
|
|
|
38
38
|
context = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
build: {
|
|
40
|
+
name: pkg.name,
|
|
41
|
+
isProduction: false,
|
|
42
|
+
},
|
|
43
|
+
package: {
|
|
44
|
+
name: pkg.name,
|
|
45
|
+
version: pkg.version,
|
|
46
|
+
destination,
|
|
47
|
+
source: 'src',
|
|
48
|
+
dependencies: { foo: '1.0.1' },
|
|
49
|
+
sharedDependencies: { react: 'SharedDependencies.React' },
|
|
50
|
+
isWebComponent: false,
|
|
51
|
+
isLegacyRoot: false,
|
|
52
|
+
isExposeSharedDependencies: false,
|
|
53
|
+
},
|
|
54
|
+
options: {
|
|
55
|
+
bundlerConfig: {},
|
|
56
|
+
},
|
|
43
57
|
};
|
|
44
58
|
});
|
|
45
59
|
|
|
46
60
|
afterEach(() => vol.reset());
|
|
47
61
|
|
|
48
|
-
const subject = () => generateMetadata(context
|
|
62
|
+
const subject = () => generateMetadata(context);
|
|
49
63
|
|
|
50
64
|
function itWritesMetadataToDestination(destination: string) {
|
|
51
65
|
test('writes metadata to output file', () => {
|
|
@@ -60,10 +74,10 @@ describe(`[startup] ${generateMetadata.name}`, () => {
|
|
|
60
74
|
|
|
61
75
|
expect(buildMetadata).toHaveBeenCalledWith({
|
|
62
76
|
destination,
|
|
63
|
-
name: context.name,
|
|
64
|
-
version: context.
|
|
65
|
-
dependencies: context.
|
|
66
|
-
sharedDependencies: context.sharedDependencies,
|
|
77
|
+
name: context.build.name,
|
|
78
|
+
version: context.package.version,
|
|
79
|
+
dependencies: context.package.dependencies,
|
|
80
|
+
sharedDependencies: context.package.sharedDependencies,
|
|
67
81
|
});
|
|
68
82
|
});
|
|
69
83
|
|
|
@@ -72,7 +86,7 @@ describe(`[startup] ${generateMetadata.name}`, () => {
|
|
|
72
86
|
describe('when destination directory does not exist', () => {
|
|
73
87
|
const nestedDestination = 'nested/path/dist';
|
|
74
88
|
|
|
75
|
-
beforeEach(() => (context.destination = nestedDestination));
|
|
89
|
+
beforeEach(() => (context.package.destination = nestedDestination));
|
|
76
90
|
|
|
77
91
|
test('creates destination directory', () => {
|
|
78
92
|
subject();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
|
-
import { getStartupVersion, readJsonSafe } from '
|
|
2
|
+
import { getStartupVersion, readJsonSafe } from '../../utils';
|
|
3
3
|
import { EntryPoints, Metadata } from '../types';
|
|
4
4
|
import { getLaunchDarklySdkVersion } from './get-launchdarkly-sdk-version';
|
|
5
5
|
import { getWebComponentsVersion } from './get-web-components-version';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
-
import { log } from '
|
|
4
|
-
import {
|
|
3
|
+
import { log } from '../../utils';
|
|
4
|
+
import { BuildContext } from '../types';
|
|
5
5
|
import { buildMetadata } from './build-metadata';
|
|
6
6
|
|
|
7
|
-
export function generateMetadata(context:
|
|
8
|
-
const { destination,
|
|
7
|
+
export function generateMetadata(context: BuildContext) {
|
|
8
|
+
const { destination, sharedDependencies, version, dependencies } = context.package;
|
|
9
|
+
const { name } = context.build;
|
|
9
10
|
|
|
10
11
|
if (!fs.existsSync(destination)) {
|
|
11
12
|
fs.mkdirSync(destination, { recursive: true });
|
|
@@ -14,8 +15,8 @@ export function generateMetadata(context: Context) {
|
|
|
14
15
|
const metadata = buildMetadata({
|
|
15
16
|
destination,
|
|
16
17
|
name,
|
|
17
|
-
version
|
|
18
|
-
dependencies
|
|
18
|
+
version,
|
|
19
|
+
dependencies,
|
|
19
20
|
sharedDependencies,
|
|
20
21
|
});
|
|
21
22
|
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
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';
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
}
|
package/src/index.ts
CHANGED