@tramvai/cli 5.53.80 → 6.62.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/bin/spawn.js +8 -2
- package/lib/api/start/application.experimental.d.ts +7 -0
- package/lib/api/start/application.experimental.d.ts.map +1 -0
- package/lib/api/start/application.experimental.js +275 -0
- package/lib/api/start/application.experimental.js.map +1 -0
- package/lib/api/start/index.d.ts +1 -0
- package/lib/api/start/index.d.ts.map +1 -1
- package/lib/api/start/index.js +17 -6
- package/lib/api/start/index.js.map +1 -1
- package/lib/builder/webpack/devServer/setup.d.ts.map +1 -1
- package/lib/builder/webpack/devServer/setup.js +3 -1
- package/lib/builder/webpack/devServer/setup.js.map +1 -1
- package/lib/builder/webpack/providers/analyze/shared.d.ts.map +1 -1
- package/lib/builder/webpack/providers/analyze/shared.js +5 -9
- package/lib/builder/webpack/providers/analyze/shared.js.map +1 -1
- package/lib/builder/webpack/providers/client.d.ts.map +1 -1
- package/lib/builder/webpack/providers/client.js +10 -9
- package/lib/builder/webpack/providers/client.js.map +1 -1
- package/lib/builder/webpack/providers/server.d.ts.map +1 -1
- package/lib/builder/webpack/providers/server.js +10 -9
- package/lib/builder/webpack/providers/server.js.map +1 -1
- package/lib/cli/CLI.d.ts +1 -1
- package/lib/cli/CLI.d.ts.map +1 -1
- package/lib/cli/CLI.js.map +1 -1
- package/lib/cli/bin-init.js +0 -2
- package/lib/cli/bin-init.js.map +1 -1
- package/lib/cli/index.d.ts.map +1 -1
- package/lib/cli/index.js +1 -12
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/runCLI.d.ts.map +1 -1
- package/lib/cli/runCLI.js.map +1 -1
- package/lib/commands/add/command.d.ts +1 -4
- package/lib/commands/add/command.d.ts.map +1 -1
- package/lib/commands/add/command.js +3 -2
- package/lib/commands/add/command.js.map +1 -1
- package/lib/commands/analyze/command.d.ts +1 -1
- package/lib/commands/analyze/command.d.ts.map +1 -1
- package/lib/commands/analyze/command.js +11 -13
- package/lib/commands/analyze/command.js.map +1 -1
- package/lib/commands/benchmark/command.d.ts +1 -1
- package/lib/commands/benchmark/command.d.ts.map +1 -1
- package/lib/commands/benchmark/command.js +8 -9
- package/lib/commands/benchmark/command.js.map +1 -1
- package/lib/commands/build/build.d.ts.map +1 -1
- package/lib/commands/build/build.js +1 -0
- package/lib/commands/build/build.js.map +1 -1
- package/lib/commands/build/command.d.ts +1 -1
- package/lib/commands/build/command.d.ts.map +1 -1
- package/lib/commands/build/command.js +12 -15
- package/lib/commands/build/command.js.map +1 -1
- package/lib/commands/generate/command.d.ts +1 -1
- package/lib/commands/generate/command.d.ts.map +1 -1
- package/lib/commands/generate/command.js +3 -2
- package/lib/commands/generate/command.js.map +1 -1
- package/lib/commands/lint/command.d.ts +1 -1
- package/lib/commands/lint/command.d.ts.map +1 -1
- package/lib/commands/lint/command.js +3 -2
- package/lib/commands/lint/command.js.map +1 -1
- package/lib/commands/new/command.d.ts +0 -1
- package/lib/commands/new/command.d.ts.map +1 -1
- package/lib/commands/new/command.js +0 -1
- package/lib/commands/new/command.js.map +1 -1
- package/lib/commands/new/steps/installDependencies.js +3 -3
- package/lib/commands/new/steps/installDependencies.js.map +1 -1
- package/lib/commands/start/command.d.ts +1 -1
- package/lib/commands/start/command.d.ts.map +1 -1
- package/lib/commands/start/command.js +18 -15
- package/lib/commands/start/command.js.map +1 -1
- package/lib/commands/start-prod/command.d.ts +1 -1
- package/lib/commands/start-prod/command.d.ts.map +1 -1
- package/lib/commands/start-prod/command.js +11 -13
- package/lib/commands/start-prod/command.js.map +1 -1
- package/lib/commands/static/command.d.ts +1 -1
- package/lib/commands/static/command.d.ts.map +1 -1
- package/lib/commands/static/command.js +7 -3
- package/lib/commands/static/command.js.map +1 -1
- package/lib/commands/update/command.d.ts +1 -4
- package/lib/commands/update/command.d.ts.map +1 -1
- package/lib/commands/update/command.js +3 -2
- package/lib/commands/update/command.js.map +1 -1
- package/lib/external/config.d.ts.map +1 -1
- package/lib/external/config.js.map +1 -1
- package/lib/library/babel/index.d.ts +3 -9
- package/lib/library/babel/index.d.ts.map +1 -1
- package/lib/library/babel/index.js +3 -132
- package/lib/library/babel/index.js.map +1 -1
- package/lib/library/swc/index.d.ts +3 -3
- package/lib/library/swc/index.d.ts.map +1 -1
- package/lib/library/swc/index.js +4 -114
- package/lib/library/swc/index.js.map +1 -1
- package/lib/library/webpack/application/client/common.d.ts.map +1 -1
- package/lib/library/webpack/application/client/common.js +10 -9
- package/lib/library/webpack/application/client/common.js.map +1 -1
- package/lib/library/webpack/application/common.d.ts.map +1 -1
- package/lib/library/webpack/application/common.js +3 -4
- package/lib/library/webpack/application/common.js.map +1 -1
- package/lib/library/webpack/blocks/pwa/client.d.ts.map +1 -1
- package/lib/library/webpack/blocks/pwa/client.js +9 -58
- package/lib/library/webpack/blocks/pwa/client.js.map +1 -1
- package/lib/library/webpack/blocks/resolve.d.ts.map +1 -1
- package/lib/library/webpack/blocks/resolve.js +1 -0
- package/lib/library/webpack/blocks/resolve.js.map +1 -1
- package/lib/library/webpack/child-app/client/common.d.ts.map +1 -1
- package/lib/library/webpack/child-app/client/common.js +2 -2
- package/lib/library/webpack/child-app/client/common.js.map +1 -1
- package/lib/library/webpack/child-app/common.d.ts.map +1 -1
- package/lib/library/webpack/child-app/common.js +3 -4
- package/lib/library/webpack/child-app/common.js.map +1 -1
- package/lib/library/webpack/utils/threadLoader.d.ts.map +1 -1
- package/lib/library/webpack/utils/threadLoader.js +20 -3
- package/lib/library/webpack/utils/threadLoader.js.map +1 -1
- package/lib/library/webpack/utils/transpiler.js +1 -1
- package/lib/library/webpack/utils/transpiler.js.map +1 -1
- package/lib/models/analytics/utils.d.ts +2 -1
- package/lib/models/analytics/utils.d.ts.map +1 -1
- package/lib/models/analytics/utils.js +3 -0
- package/lib/models/analytics/utils.js.map +1 -1
- package/lib/models/command.d.ts +1 -1
- package/lib/models/command.d.ts.map +1 -1
- package/lib/models/command.js +1 -1
- package/lib/models/command.js.map +1 -1
- package/lib/models/context.d.ts +1 -1
- package/lib/models/context.d.ts.map +1 -1
- package/lib/models/logger.d.ts +0 -1
- package/lib/models/logger.d.ts.map +1 -1
- package/lib/models/logger.js +2 -3
- package/lib/models/logger.js.map +1 -1
- package/lib/schema/autogeneratedSchema.json +15 -15
- package/lib/typings/configEntry/application.d.ts +1 -1
- package/lib/typings/configEntry/application.d.ts.map +1 -1
- package/lib/typings/public.d.ts +0 -1
- package/lib/typings/public.d.ts.map +1 -1
- package/lib/typings/public.js +0 -2
- package/lib/typings/public.js.map +1 -1
- package/lib/utils/cpu-profile.d.ts.map +1 -1
- package/lib/utils/cpu-profile.js +0 -1
- package/lib/utils/cpu-profile.js.map +1 -1
- package/package.json +23 -27
- package/schema.json +15 -15
- package/src/api/start/__integration__/start.test.ts +8 -0
- package/src/api/start/application.experimental.ts +305 -0
- package/src/api/start/index.ts +20 -4
- package/src/builder/webpack/devServer/setup.ts +1 -0
- package/src/builder/webpack/providers/analyze/shared.ts +6 -10
- package/src/builder/webpack/providers/client.ts +15 -10
- package/src/builder/webpack/providers/server.ts +15 -10
- package/src/cli/CLI.ts +1 -1
- package/src/cli/bin-init.ts +0 -2
- package/src/cli/index.ts +4 -11
- package/src/cli/runCLI.ts +0 -1
- package/src/commands/add/command.ts +3 -2
- package/src/commands/analyze/command.ts +12 -14
- package/src/commands/benchmark/command.ts +9 -10
- package/src/commands/build/build.ts +2 -0
- package/src/commands/build/command.ts +13 -16
- package/src/commands/generate/command.ts +3 -2
- package/src/commands/lint/command.ts +3 -2
- package/src/commands/new/command.ts +0 -2
- package/src/commands/new/steps/installDependencies.ts +3 -3
- package/src/commands/new/templates/shared/_prettierrc.js.hbs +1 -1
- package/src/commands/start/command.ts +20 -16
- package/src/commands/start-prod/command.ts +12 -14
- package/src/commands/static/command.ts +7 -3
- package/src/commands/update/command.ts +3 -2
- package/src/external/config.ts +1 -0
- package/src/library/babel/index.ts +3 -160
- package/src/library/swc/__integration__/__snapshots__/swc.build.test.ts.snap +46 -28
- package/src/library/swc/__integration__/__snapshots__/swc.start.test.ts.snap +12 -8
- package/src/library/swc/__integration__/swc.start.test.ts +4 -4
- package/src/library/swc/index.ts +3 -139
- package/src/library/webpack/application/client/common.ts +12 -7
- package/src/library/webpack/application/common.ts +8 -4
- package/src/library/webpack/blocks/pwa/client.ts +13 -64
- package/src/library/webpack/blocks/resolve.ts +1 -0
- package/src/library/webpack/child-app/client/common.ts +2 -2
- package/src/library/webpack/child-app/common.ts +7 -5
- package/src/library/webpack/utils/threadLoader.ts +21 -0
- package/src/library/webpack/utils/transpiler.ts +2 -2
- package/src/models/analytics/utils.ts +6 -2
- package/src/models/command.ts +3 -4
- package/src/models/context.ts +1 -1
- package/src/models/logger.ts +1 -3
- package/src/schema/autogeneratedSchema.json +15 -15
- package/src/typings/configEntry/application.ts +5 -1
- package/src/typings/public.ts +0 -2
- package/src/utils/cpu-profile.ts +0 -1
- package/lib/library/babel/plugins/create-token-pure.d.ts +0 -7
- package/lib/library/babel/plugins/create-token-pure.d.ts.map +0 -1
- package/lib/library/babel/plugins/create-token-pure.js +0 -39
- package/lib/library/babel/plugins/create-token-pure.js.map +0 -1
- package/lib/library/babel/plugins/fill-action-name.d.ts +0 -3
- package/lib/library/babel/plugins/fill-action-name.d.ts.map +0 -1
- package/lib/library/babel/plugins/fill-action-name.js +0 -107
- package/lib/library/babel/plugins/fill-action-name.js.map +0 -1
- package/lib/library/babel/plugins/fill-declare-action-name.d.ts +0 -6
- package/lib/library/babel/plugins/fill-declare-action-name.d.ts.map +0 -1
- package/lib/library/babel/plugins/fill-declare-action-name.js +0 -94
- package/lib/library/babel/plugins/fill-declare-action-name.js.map +0 -1
- package/lib/library/babel/plugins/lazy-component/lazy-component.d.ts +0 -7
- package/lib/library/babel/plugins/lazy-component/lazy-component.d.ts.map +0 -1
- package/lib/library/babel/plugins/lazy-component/lazy-component.js +0 -75
- package/lib/library/babel/plugins/lazy-component/lazy-component.js.map +0 -1
- package/lib/library/babel/plugins/lazy-component/legacy-universal-replace.d.ts +0 -14
- package/lib/library/babel/plugins/lazy-component/legacy-universal-replace.d.ts.map +0 -1
- package/lib/library/babel/plugins/lazy-component/legacy-universal-replace.js +0 -53
- package/lib/library/babel/plugins/lazy-component/legacy-universal-replace.js.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/chunkName.d.ts +0 -3
- package/lib/library/babel/plugins/lazy-component/properties/chunkName.d.ts.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/chunkName.js +0 -133
- package/lib/library/babel/plugins/lazy-component/properties/chunkName.js.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/importAsync.d.ts +0 -3
- package/lib/library/babel/plugins/lazy-component/properties/importAsync.d.ts.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/importAsync.js +0 -11
- package/lib/library/babel/plugins/lazy-component/properties/importAsync.js.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/isReady.d.ts +0 -3
- package/lib/library/babel/plugins/lazy-component/properties/isReady.d.ts.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/isReady.js +0 -14
- package/lib/library/babel/plugins/lazy-component/properties/isReady.js.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/requireAsync.d.ts +0 -3
- package/lib/library/babel/plugins/lazy-component/properties/requireAsync.d.ts.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/requireAsync.js +0 -15
- package/lib/library/babel/plugins/lazy-component/properties/requireAsync.js.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/requireSync.d.ts +0 -3
- package/lib/library/babel/plugins/lazy-component/properties/requireSync.d.ts.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/requireSync.js +0 -16
- package/lib/library/babel/plugins/lazy-component/properties/requireSync.js.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/resolve.d.ts +0 -3
- package/lib/library/babel/plugins/lazy-component/properties/resolve.d.ts.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/resolve.js +0 -14
- package/lib/library/babel/plugins/lazy-component/properties/resolve.js.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/types.d.ts +0 -14
- package/lib/library/babel/plugins/lazy-component/properties/types.d.ts.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/types.js +0 -3
- package/lib/library/babel/plugins/lazy-component/properties/types.js.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/utils/webpackComments.d.ts +0 -14
- package/lib/library/babel/plugins/lazy-component/properties/utils/webpackComments.d.ts.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/utils/webpackComments.js +0 -57
- package/lib/library/babel/plugins/lazy-component/properties/utils/webpackComments.js.map +0 -1
- package/lib/library/babel/plugins/provider-stack.d.ts +0 -4
- package/lib/library/babel/plugins/provider-stack.d.ts.map +0 -1
- package/lib/library/babel/plugins/provider-stack.js +0 -63
- package/lib/library/babel/plugins/provider-stack.js.map +0 -1
- package/lib/library/babel/plugins/react-compiler.d.ts +0 -13
- package/lib/library/babel/plugins/react-compiler.d.ts.map +0 -1
- package/lib/library/babel/plugins/react-compiler.js +0 -27
- package/lib/library/babel/plugins/react-compiler.js.map +0 -1
- package/lib/library/babel/plugins/react-element-info-unique.d.ts +0 -26
- package/lib/library/babel/plugins/react-element-info-unique.d.ts.map +0 -1
- package/lib/library/babel/plugins/react-element-info-unique.js +0 -112
- package/lib/library/babel/plugins/react-element-info-unique.js.map +0 -1
- package/lib/library/babel/plugins/types.h.d.ts +0 -7
- package/lib/library/babel/plugins/types.h.d.ts.map +0 -1
- package/lib/library/babel/plugins/types.h.js +0 -3
- package/lib/library/babel/plugins/types.h.js.map +0 -1
- package/lib/library/webpack/plugins/AssetsIntegritiesPlugin.d.ts +0 -8
- package/lib/library/webpack/plugins/AssetsIntegritiesPlugin.d.ts.map +0 -1
- package/lib/library/webpack/plugins/AssetsIntegritiesPlugin.js +0 -29
- package/lib/library/webpack/plugins/AssetsIntegritiesPlugin.js.map +0 -1
- package/lib/library/webpack/plugins/AutoPublicPathPlugin.d.ts +0 -4
- package/lib/library/webpack/plugins/AutoPublicPathPlugin.d.ts.map +0 -1
- package/lib/library/webpack/plugins/AutoPublicPathPlugin.js +0 -23
- package/lib/library/webpack/plugins/AutoPublicPathPlugin.js.map +0 -1
- package/lib/library/webpack/plugins/ModuleFederationFixRange.d.ts +0 -24
- package/lib/library/webpack/plugins/ModuleFederationFixRange.d.ts.map +0 -1
- package/lib/library/webpack/plugins/ModuleFederationFixRange.js +0 -127
- package/lib/library/webpack/plugins/ModuleFederationFixRange.js.map +0 -1
- package/lib/library/webpack/plugins/ModuleFederationIgnoreEntries.d.ts +0 -15
- package/lib/library/webpack/plugins/ModuleFederationIgnoreEntries.d.ts.map +0 -1
- package/lib/library/webpack/plugins/ModuleFederationIgnoreEntries.js +0 -49
- package/lib/library/webpack/plugins/ModuleFederationIgnoreEntries.js.map +0 -1
- package/lib/library/webpack/plugins/PolyfillCondition.d.ts +0 -8
- package/lib/library/webpack/plugins/PolyfillCondition.d.ts.map +0 -1
- package/lib/library/webpack/plugins/PolyfillCondition.js +0 -46
- package/lib/library/webpack/plugins/PolyfillCondition.js.map +0 -1
- package/lib/library/webpack/plugins/PurifyStatsPlugin.d.ts +0 -15
- package/lib/library/webpack/plugins/PurifyStatsPlugin.d.ts.map +0 -1
- package/lib/library/webpack/plugins/PurifyStatsPlugin.js +0 -47
- package/lib/library/webpack/plugins/PurifyStatsPlugin.js.map +0 -1
- package/lib/library/webpack/plugins/PwaIconsPlugin.d.ts +0 -12
- package/lib/library/webpack/plugins/PwaIconsPlugin.d.ts.map +0 -1
- package/lib/library/webpack/plugins/PwaIconsPlugin.js +0 -78
- package/lib/library/webpack/plugins/PwaIconsPlugin.js.map +0 -1
- package/lib/library/webpack/plugins/WebManifestPlugin.d.ts +0 -13
- package/lib/library/webpack/plugins/WebManifestPlugin.d.ts.map +0 -1
- package/lib/library/webpack/plugins/WebManifestPlugin.js +0 -47
- package/lib/library/webpack/plugins/WebManifestPlugin.js.map +0 -1
- package/lib/library/webpack/utils/polyfills/const.d.ts +0 -3
- package/lib/library/webpack/utils/polyfills/const.d.ts.map +0 -1
- package/lib/library/webpack/utils/polyfills/const.js +0 -49
- package/lib/library/webpack/utils/polyfills/const.js.map +0 -1
- package/lib/library/webpack/utils/polyfills/polyfillCondition.d.ts +0 -8
- package/lib/library/webpack/utils/polyfills/polyfillCondition.d.ts.map +0 -1
- package/lib/library/webpack/utils/polyfills/polyfillCondition.js +0 -51
- package/lib/library/webpack/utils/polyfills/polyfillCondition.js.map +0 -1
- package/lib/library/webpack/utils/polyfills/specToFeature.d.ts +0 -7
- package/lib/library/webpack/utils/polyfills/specToFeature.d.ts.map +0 -1
- package/lib/library/webpack/utils/polyfills/specToFeature.js +0 -207
- package/lib/library/webpack/utils/polyfills/specToFeature.js.map +0 -1
- package/lib/models/analytics/analytics.d.ts +0 -156
- package/lib/models/analytics/analytics.d.ts.map +0 -1
- package/lib/models/analytics/analytics.js +0 -259
- package/lib/models/analytics/analytics.js.map +0 -1
- package/lib/models/analytics/analytics.worker.d.ts +0 -5
- package/lib/models/analytics/analytics.worker.d.ts.map +0 -1
- package/lib/models/analytics/analytics.worker.js +0 -87
- package/lib/models/analytics/analytics.worker.js.map +0 -1
- package/lib/typings/pwa/index.d.ts +0 -80
- package/lib/typings/pwa/index.d.ts.map +0 -1
- package/lib/typings/pwa/index.js +0 -3
- package/lib/typings/pwa/index.js.map +0 -1
- package/lib/utils/errors.d.ts +0 -7
- package/lib/utils/errors.d.ts.map +0 -1
- package/lib/utils/errors.js +0 -43
- package/lib/utils/errors.js.map +0 -1
- package/lib/utils/memoryUsage.d.ts +0 -20
- package/lib/utils/memoryUsage.d.ts.map +0 -1
- package/lib/utils/memoryUsage.js +0 -51
- package/lib/utils/memoryUsage.js.map +0 -1
- package/lib/utils/sentry.d.ts +0 -2
- package/lib/utils/sentry.d.ts.map +0 -1
- package/lib/utils/sentry.js +0 -27
- package/lib/utils/sentry.js.map +0 -1
- package/src/library/babel/plugins/__fixtures__/create-token-pure/already-has-comment.ts +0 -5
- package/src/library/babel/plugins/__fixtures__/create-token-pure/do-nothing.ts +0 -10
- package/src/library/babel/plugins/__fixtures__/create-token-pure/from-core.ts +0 -5
- package/src/library/babel/plugins/__fixtures__/create-token-pure/from-dippy.ts +0 -5
- package/src/library/babel/plugins/__fixtures__/create-token-pure/many-imports.ts +0 -9
- package/src/library/babel/plugins/__fixtures__/fill-declare-action-name/import-mixed.ts +0 -17
- package/src/library/babel/plugins/__fixtures__/fill-declare-action-name/import-with-name.ts +0 -28
- package/src/library/babel/plugins/__fixtures__/fill-declare-action-name/import-without-name.ts +0 -25
- package/src/library/babel/plugins/__fixtures__/fill-declare-action-name/require-with-name.ts +0 -21
- package/src/library/babel/plugins/__fixtures__/fill-declare-action-name/require-without-name.ts +0 -19
- package/src/library/babel/plugins/__fixtures__/lazy-component/base.ts +0 -3
- package/src/library/babel/plugins/__fixtures__/lazy-component/cmp.tsx +0 -7
- package/src/library/babel/plugins/__fixtures__/lazy-component/comments.ts +0 -7
- package/src/library/babel/plugins/__fixtures__/lazy-component/dynamic.ts +0 -3
- package/src/library/babel/plugins/__fixtures__/lazy-component/inner/first.tsx +0 -7
- package/src/library/babel/plugins/__fixtures__/lazy-component/inner/path/cmp.tsx +0 -7
- package/src/library/babel/plugins/__fixtures__/lazy-component/inner/second.tsx +0 -7
- package/src/library/babel/plugins/__fixtures__/lazy-component/inner/third.tsx +0 -7
- package/src/library/babel/plugins/__fixtures__/lazy-component/lazy+hmr.ts +0 -3
- package/src/library/babel/plugins/__fixtures__/lazy-component/long-import.ts +0 -3
- package/src/library/babel/plugins/__fixtures__/lazy-component/not-lazy-import.ts +0 -7
- package/src/library/babel/plugins/__fixtures__/lazy-component/not-lazy.ts +0 -8
- package/src/library/babel/plugins/__fixtures__/legacy-universal-replace/cmp.tsx +0 -7
- package/src/library/babel/plugins/__fixtures__/legacy-universal-replace/not-universal.ts +0 -8
- package/src/library/babel/plugins/__fixtures__/legacy-universal-replace/platform-legacy.ts +0 -5
- package/src/library/babel/plugins/__fixtures__/legacy-universal-replace/react-universal.ts +0 -3
- package/src/library/babel/plugins/__fixtures__/legacy-universal-replace/tramvai/react/index.es.ts +0 -3
- package/src/library/babel/plugins/__fixtures__/provider-stack/add-stack.ts +0 -22
- package/src/library/babel/plugins/__fixtures__/provider-stack/check-function-name.ts +0 -10
- package/src/library/babel/plugins/__fixtures__/provider-stack/do-nothing.ts +0 -16
- package/src/library/babel/plugins/__fixtures__/provider-stack/error-in-scope.ts +0 -24
- package/src/library/babel/plugins/__fixtures__/provider-stack/inside-await.ts +0 -12
- package/src/library/babel/plugins/__fixtures__/provider-stack/module-decorator.ts +0 -27
- package/src/library/babel/plugins/__snapshots__/create-token-pure.spec.ts.snap +0 -108
- package/src/library/babel/plugins/__snapshots__/fill-declare-action-name.spec.ts.snap +0 -264
- package/src/library/babel/plugins/__snapshots__/provider-stack.spec.ts.snap +0 -362
- package/src/library/babel/plugins/create-token-pure.spec.ts +0 -39
- package/src/library/babel/plugins/create-token-pure.ts +0 -47
- package/src/library/babel/plugins/fill-action-name.ts +0 -126
- package/src/library/babel/plugins/fill-declare-action-name.spec.ts +0 -37
- package/src/library/babel/plugins/fill-declare-action-name.ts +0 -110
- package/src/library/babel/plugins/lazy-component/__snapshots__/lazy-component.spec.ts.snap +0 -313
- package/src/library/babel/plugins/lazy-component/__snapshots__/legacy-universal-replace.spec.ts.snap +0 -114
- package/src/library/babel/plugins/lazy-component/lazy-component.spec.ts +0 -46
- package/src/library/babel/plugins/lazy-component/lazy-component.ts +0 -91
- package/src/library/babel/plugins/lazy-component/legacy-universal-replace.spec.ts +0 -33
- package/src/library/babel/plugins/lazy-component/legacy-universal-replace.ts +0 -88
- package/src/library/babel/plugins/lazy-component/properties/chunkName.ts +0 -185
- package/src/library/babel/plugins/lazy-component/properties/importAsync.ts +0 -8
- package/src/library/babel/plugins/lazy-component/properties/isReady.ts +0 -19
- package/src/library/babel/plugins/lazy-component/properties/requireAsync.ts +0 -20
- package/src/library/babel/plugins/lazy-component/properties/requireSync.ts +0 -21
- package/src/library/babel/plugins/lazy-component/properties/resolve.ts +0 -21
- package/src/library/babel/plugins/lazy-component/properties/types.ts +0 -20
- package/src/library/babel/plugins/lazy-component/properties/utils/webpackComments.ts +0 -61
- package/src/library/babel/plugins/provider-stack.spec.ts +0 -55
- package/src/library/babel/plugins/provider-stack.ts +0 -88
- package/src/library/babel/plugins/react-compiler.ts +0 -39
- package/src/library/babel/plugins/react-element-info-unique.ts +0 -144
- package/src/library/babel/plugins/types.h.ts +0 -8
- package/src/library/webpack/plugins/AssetsIntegritiesPlugin.ts +0 -34
- package/src/library/webpack/plugins/AutoPublicPathPlugin.ts +0 -23
- package/src/library/webpack/plugins/ModuleFederationFixRange.ts +0 -181
- package/src/library/webpack/plugins/ModuleFederationIgnoreEntries.ts +0 -59
- package/src/library/webpack/plugins/PolyfillCondition.ts +0 -62
- package/src/library/webpack/plugins/PurifyStatsPlugin.ts +0 -57
- package/src/library/webpack/plugins/PwaIconsPlugin.ts +0 -94
- package/src/library/webpack/plugins/WebManifestPlugin.ts +0 -62
- package/src/library/webpack/utils/polyfills/__integration__/__snapshots__/condition.test.ts.snap +0 -1348
- package/src/library/webpack/utils/polyfills/__integration__/condition.test.ts +0 -128
- package/src/library/webpack/utils/polyfills/const.ts +0 -46
- package/src/library/webpack/utils/polyfills/polyfillCondition.ts +0 -63
- package/src/library/webpack/utils/polyfills/specToFeature.ts +0 -243
- package/src/models/analytics/analytics.ts +0 -488
- package/src/models/analytics/analytics.worker.ts +0 -102
- package/src/typings/pwa/index.ts +0 -83
- package/src/utils/errors.ts +0 -39
- package/src/utils/memoryUsage.ts +0 -58
- package/src/utils/sentry.ts +0 -25
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const os = require('os');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
|
|
5
|
-
const tmpFilePath = path.resolve(os.tmpdir(), 'changedFiles.json');
|
|
6
|
-
const FRAGMENT = 'Fragment';
|
|
7
|
-
let filesChanged: { name: string; files: string[] };
|
|
8
|
-
|
|
9
|
-
try {
|
|
10
|
-
if (process.env.ADD_VERSION_ATTRIBUTE_FOR_JSX) {
|
|
11
|
-
filesChanged = JSON.parse(process.env.ADD_VERSION_ATTRIBUTE_FOR_JSX);
|
|
12
|
-
}
|
|
13
|
-
if (fs.existsSync(tmpFilePath)) {
|
|
14
|
-
filesChanged = JSON.parse(fs.readFileSync(tmpFilePath, 'utf8'));
|
|
15
|
-
}
|
|
16
|
-
} catch (e) {
|
|
17
|
-
filesChanged = null;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function attrName(attr) {
|
|
21
|
-
return attr.name && attr.name.name;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function attrValue(attr) {
|
|
25
|
-
return attr.value && attr.value.value;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function isEqualAttr(attr1, attr2) {
|
|
29
|
-
if (!attr1 || !attr2) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
return attrName(attr1) === attrName(attr2) && attrValue(attr1) === attrValue(attr2);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Не будем проставлять data-qa-атрибуты в случае использования React.Fragment
|
|
36
|
-
// На данный момент поддерживаются 2 вида синтаксисов: <Fragment> и <React.Fragment>
|
|
37
|
-
function isOpeningElementFragment(element) {
|
|
38
|
-
if (!element.name) {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
(element.name.property && element.name.property.name === FRAGMENT) ||
|
|
44
|
-
element.name.name === FRAGMENT
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function isCallExpressionFragment(nodeArguments) {
|
|
49
|
-
if (!nodeArguments[0]) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
(nodeArguments[0].property && nodeArguments[0].property.name === FRAGMENT) ||
|
|
55
|
-
nodeArguments[0].name === FRAGMENT
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const getBaseName = (filename) => {
|
|
60
|
-
return path.basename(filename, path.extname(filename));
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
/** @deprecated */
|
|
64
|
-
function babelPluginReactElementInfo({ types: t }) {
|
|
65
|
-
const defaultPrefix = 'data-qa';
|
|
66
|
-
let prefix;
|
|
67
|
-
let filenameAttr;
|
|
68
|
-
let changedVersionAttr;
|
|
69
|
-
|
|
70
|
-
const visitor = {
|
|
71
|
-
Program(nodePath, state) {
|
|
72
|
-
if (state.opts.prefix) {
|
|
73
|
-
prefix = `data-${state.opts.prefix}`;
|
|
74
|
-
} else {
|
|
75
|
-
prefix = defaultPrefix;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
changedVersionAttr = `${prefix}-changed-version`;
|
|
79
|
-
filenameAttr = `${prefix}-file`;
|
|
80
|
-
},
|
|
81
|
-
JSXOpeningElement(nodePath, state) {
|
|
82
|
-
const { openingElement } = nodePath.container;
|
|
83
|
-
const { attributes } = openingElement;
|
|
84
|
-
const newAttributes = [];
|
|
85
|
-
const isFragment = isOpeningElementFragment(openingElement);
|
|
86
|
-
|
|
87
|
-
if (
|
|
88
|
-
!isFragment &&
|
|
89
|
-
filesChanged &&
|
|
90
|
-
state.file &&
|
|
91
|
-
state.file.opts &&
|
|
92
|
-
state.file.opts.sourceFileName &&
|
|
93
|
-
filesChanged.files.includes(state.file.opts.sourceFileName)
|
|
94
|
-
) {
|
|
95
|
-
newAttributes.push(
|
|
96
|
-
t.jsxAttribute(t.jsxIdentifier(changedVersionAttr), t.stringLiteral(filesChanged.name))
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (!isFragment && state.file && state.file.opts && state.file.opts.filename) {
|
|
101
|
-
const name = getBaseName(state.file.opts.filename);
|
|
102
|
-
const attrDataQaFile = t.jsxAttribute(t.jsxIdentifier(filenameAttr), t.stringLiteral(name));
|
|
103
|
-
|
|
104
|
-
if (attributes.find((item) => isEqualAttr(item, attrDataQaFile)) === undefined) {
|
|
105
|
-
newAttributes.push(attrDataQaFile);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
attributes.push(...newAttributes);
|
|
110
|
-
},
|
|
111
|
-
CallExpression(nodePath, state) {
|
|
112
|
-
if (
|
|
113
|
-
(nodePath.node.callee.type === 'MemberExpression' &&
|
|
114
|
-
nodePath.node.callee.object.name === 'React' &&
|
|
115
|
-
nodePath.node.callee.property.name === 'createElement') ||
|
|
116
|
-
(nodePath.node.callee.type === 'Identifier' &&
|
|
117
|
-
nodePath.node.callee.name === 'createElement')
|
|
118
|
-
) {
|
|
119
|
-
const name = getBaseName(state.file.opts.filename);
|
|
120
|
-
const properties = nodePath.node.arguments[1] && nodePath.node.arguments[1].properties;
|
|
121
|
-
const isFragment = isCallExpressionFragment(nodePath.node.arguments);
|
|
122
|
-
|
|
123
|
-
if (
|
|
124
|
-
!isFragment &&
|
|
125
|
-
properties &&
|
|
126
|
-
!properties.find(
|
|
127
|
-
(property) =>
|
|
128
|
-
property.type === 'ObjectProperty' &&
|
|
129
|
-
property.key.type === 'StringLiteral' &&
|
|
130
|
-
property.key.value === filenameAttr
|
|
131
|
-
)
|
|
132
|
-
) {
|
|
133
|
-
properties.push(t.objectProperty(t.stringLiteral(filenameAttr), t.stringLiteral(name)));
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
return {
|
|
140
|
-
visitor,
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
module.exports = babelPluginReactElementInfo;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
const TARGET_PLUGIN_NAME = 'stats-writer-plugin';
|
|
2
|
-
|
|
3
|
-
// Generate integrities field for stats.json
|
|
4
|
-
export default class AssetsIntegritiesPlugin {
|
|
5
|
-
constructor(private options: { fileName: string }) {
|
|
6
|
-
this.options = options;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
apply(compiler) {
|
|
10
|
-
compiler.hooks.thisCompilation.tap(TARGET_PLUGIN_NAME, (compilation) => {
|
|
11
|
-
compilation.hooks.processAssets.tap(
|
|
12
|
-
{
|
|
13
|
-
name: TARGET_PLUGIN_NAME,
|
|
14
|
-
stage: compilation.constructor.PROCESS_ASSETS_STAGE_REPORT,
|
|
15
|
-
},
|
|
16
|
-
() => {
|
|
17
|
-
const { fileName } = this.options;
|
|
18
|
-
const statsJSON = JSON.parse(compilation.assets[fileName].source().toString());
|
|
19
|
-
const { assets } = statsJSON;
|
|
20
|
-
|
|
21
|
-
statsJSON.integrities = assets.reduce((acc, item) => {
|
|
22
|
-
acc[item.name] = item.integrity;
|
|
23
|
-
return acc;
|
|
24
|
-
}, {});
|
|
25
|
-
|
|
26
|
-
compilation.updateAsset(
|
|
27
|
-
fileName,
|
|
28
|
-
new compiler.webpack.sources.RawSource(JSON.stringify(statsJSON))
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// Fixes webpack AutoPublicPathPlugin error when fallback load of shared microfrontend chunk
|
|
2
|
-
// this happens because currentScript.src is not defined for an inline script
|
|
3
|
-
export class PatchAutoPublicPathPlugin {
|
|
4
|
-
apply(compiler) {
|
|
5
|
-
compiler.hooks.compilation.tap('PatchAutoPublicPathPlugin', (compilation) => {
|
|
6
|
-
compilation.hooks.runtimeModule.tap('PatchAutoPublicPathPlugin', (module) => {
|
|
7
|
-
if (module.constructor.name === 'AutoPublicPathRuntimeModule') {
|
|
8
|
-
const base = module.generate.bind(module);
|
|
9
|
-
|
|
10
|
-
// eslint-disable-next-line no-param-reassign
|
|
11
|
-
module.generate = function (...args) {
|
|
12
|
-
const result = base(...args);
|
|
13
|
-
|
|
14
|
-
return result.replace(
|
|
15
|
-
'document.currentScript.src',
|
|
16
|
-
'document.currentScript.src || document.currentScript.dataset.src'
|
|
17
|
-
);
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import type webpack from 'webpack';
|
|
2
|
-
import type { Compiler, NormalModule } from 'webpack';
|
|
3
|
-
import { WebpackError } from 'webpack';
|
|
4
|
-
// eslint-disable-next-line no-restricted-imports
|
|
5
|
-
import { parseRange, satisfy } from 'webpack/lib/util/semver';
|
|
6
|
-
import { isDependantLib, isUnifiedVersion } from '../../../utils/tramvaiVersions';
|
|
7
|
-
|
|
8
|
-
const PLUGIN_NAME = 'ModuleFederationValidateDuplicates';
|
|
9
|
-
|
|
10
|
-
type SemverRange = [number, number, number, number];
|
|
11
|
-
|
|
12
|
-
interface SharedModuleOptions {
|
|
13
|
-
shareKey: string;
|
|
14
|
-
requiredVersion?: SemverRange;
|
|
15
|
-
importResolved: string;
|
|
16
|
-
singleton?: boolean;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface SharedModule extends NormalModule {
|
|
20
|
-
options?: SharedModuleOptions;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface ModuleFederationFixRangeOptions {
|
|
24
|
-
flexibleTramvaiVersions: boolean;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export class ModuleFederationFixRange implements webpack.WebpackPluginInstance {
|
|
28
|
-
private flexibleTramvaiVersions: boolean;
|
|
29
|
-
// { name: { importResolved: { number }} }
|
|
30
|
-
private sharedModules: Map<string, Map<string, Set<SharedModule>>> = new Map();
|
|
31
|
-
|
|
32
|
-
constructor({ flexibleTramvaiVersions }: ModuleFederationFixRangeOptions) {
|
|
33
|
-
this.flexibleTramvaiVersions = flexibleTramvaiVersions ?? false;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
apply(compiler: Compiler) {
|
|
37
|
-
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation, { normalModuleFactory }) => {
|
|
38
|
-
normalModuleFactory.hooks.factorize.intercept({
|
|
39
|
-
register: (tap) => {
|
|
40
|
-
if (tap.name === 'ConsumeSharedPlugin') {
|
|
41
|
-
const originalFn = tap.fn;
|
|
42
|
-
// eslint-disable-next-line no-param-reassign
|
|
43
|
-
tap.fn = async (...args) => {
|
|
44
|
-
const module: SharedModule | undefined = await originalFn(...args);
|
|
45
|
-
|
|
46
|
-
if (module?.options) {
|
|
47
|
-
const { shareKey: name, importResolved } = module.options;
|
|
48
|
-
|
|
49
|
-
let shared = this.sharedModules.get(name);
|
|
50
|
-
|
|
51
|
-
if (!shared) {
|
|
52
|
-
shared = new Map();
|
|
53
|
-
this.sharedModules.set(name, shared);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
let modules = shared.get(importResolved);
|
|
57
|
-
|
|
58
|
-
if (!modules) {
|
|
59
|
-
modules = new Set();
|
|
60
|
-
shared.set(importResolved, modules);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// save major version of the semver array
|
|
64
|
-
modules.add(module);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return module;
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return tap;
|
|
72
|
-
},
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
// eslint-disable-next-line max-statements
|
|
76
|
-
compilation.hooks.optimizeDependencies.tap(PLUGIN_NAME, () => {
|
|
77
|
-
for (const [name, sharedModulesByName] of this.sharedModules.entries()) {
|
|
78
|
-
const hasDuplicates = sharedModulesByName.size > 1;
|
|
79
|
-
|
|
80
|
-
for (const [importResolved, sharedModulesByPath] of sharedModulesByName.entries()) {
|
|
81
|
-
if (hasDuplicates) {
|
|
82
|
-
const error = new WebpackError(
|
|
83
|
-
`This file is a duplicate for a module "${name}" that resolved to different path`
|
|
84
|
-
);
|
|
85
|
-
error.file = importResolved;
|
|
86
|
-
compilation.warnings.push(error);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
let validModule: SharedModule;
|
|
90
|
-
let validVersion: string;
|
|
91
|
-
const invalidModules = new Set<SharedModule>();
|
|
92
|
-
|
|
93
|
-
for (const sharedModule of sharedModulesByPath) {
|
|
94
|
-
const connections = compilation.moduleGraph.getOutgoingConnections(sharedModule);
|
|
95
|
-
|
|
96
|
-
// eslint-disable-next-line no-unreachable-loop
|
|
97
|
-
for (const { module } of connections) {
|
|
98
|
-
const resolvedVersion = module.resourceResolveData?.descriptionFileData?.version;
|
|
99
|
-
this.fixVersionRange(sharedModule, resolvedVersion);
|
|
100
|
-
|
|
101
|
-
const requiredVersion = sharedModule?.options?.requiredVersion;
|
|
102
|
-
|
|
103
|
-
if (requiredVersion && resolvedVersion) {
|
|
104
|
-
if (satisfy(requiredVersion, resolvedVersion)) {
|
|
105
|
-
validModule = sharedModule;
|
|
106
|
-
validVersion = resolvedVersion;
|
|
107
|
-
} else {
|
|
108
|
-
invalidModules.add(sharedModule);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
// there should by only one outgoing module for ConsumeSharedModule
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (invalidModules.size > 0 && validModule) {
|
|
117
|
-
for (const sharedModule of invalidModules) {
|
|
118
|
-
const error = new WebpackError(
|
|
119
|
-
`Shared module has been actually resolved to ${validVersion} instead of the expected`
|
|
120
|
-
);
|
|
121
|
-
error.module = sharedModule;
|
|
122
|
-
compilation.warnings.push(error);
|
|
123
|
-
|
|
124
|
-
// replace invalid module with valid version (invalid anyway are resolved to wrong version)
|
|
125
|
-
// to prevent any issues with shared dependencies
|
|
126
|
-
compilation.moduleGraph.moveModuleConnections(
|
|
127
|
-
sharedModule,
|
|
128
|
-
validModule,
|
|
129
|
-
(connection) => {
|
|
130
|
-
// ignore any outgoing connections as we want to ignore that module entirely and all its dependencies
|
|
131
|
-
return connection.originModule !== sharedModule;
|
|
132
|
-
}
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// reset sharedModules info after validation
|
|
140
|
-
this.sharedModules = new Map();
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
fixVersionRange(sharedModule: SharedModule, resolvedVersion?: string) {
|
|
146
|
-
const {
|
|
147
|
-
options,
|
|
148
|
-
options: { shareKey: name, singleton },
|
|
149
|
-
context,
|
|
150
|
-
} = sharedModule;
|
|
151
|
-
let { requiredVersion } = options;
|
|
152
|
-
|
|
153
|
-
// if version was not resolved automatically then get the version
|
|
154
|
-
// from actual module
|
|
155
|
-
// ignore singletons as the actual version won't change anything
|
|
156
|
-
// and usually it is just a react and co libraries
|
|
157
|
-
if (!requiredVersion && context && !singleton) {
|
|
158
|
-
if (resolvedVersion) {
|
|
159
|
-
requiredVersion = parseRange(resolvedVersion);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
if (!requiredVersion) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (requiredVersion && this.flexibleTramvaiVersions) {
|
|
168
|
-
const isTramvai = isUnifiedVersion(name) || isDependantLib(name);
|
|
169
|
-
|
|
170
|
-
// exclude local stub versions, because `^0.0.0-stub` will have lowest priority and unexpected versions can be used
|
|
171
|
-
if (isTramvai && requiredVersion[0] > 2 && resolvedVersion !== '0.0.0-stub') {
|
|
172
|
-
// 1 is used for `^` range modifier
|
|
173
|
-
// see https://github.com/webpack/webpack/blob/56363993156e06a1230c9759eba277a22e6b6604/lib/util/semver.js#LL235C20-L235C20
|
|
174
|
-
requiredVersion[0] = 1;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// change version in webpack module
|
|
179
|
-
options.requiredVersion = requiredVersion;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type webpack from 'webpack';
|
|
2
|
-
import type { Compiler } from 'webpack';
|
|
3
|
-
|
|
4
|
-
const PLUGIN_NAME = 'ModuleFederationIgnoreEntires';
|
|
5
|
-
|
|
6
|
-
export interface ModuleFederationIgnoreEntriesOptions {
|
|
7
|
-
entries: string[];
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Temporary fix of usage ModuleFederation with multiple entries
|
|
12
|
-
* [open discussion](https://github.com/webpack/webpack/discussions/14985) how to do it properly
|
|
13
|
-
*/
|
|
14
|
-
export class ModuleFederationIgnoreEntries implements webpack.WebpackPluginInstance {
|
|
15
|
-
protected entries: Set<string>;
|
|
16
|
-
|
|
17
|
-
constructor(options: ModuleFederationIgnoreEntriesOptions) {
|
|
18
|
-
this.entries = new Set(options.entries);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
apply(compiler: Compiler) {
|
|
22
|
-
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => {
|
|
23
|
-
compilation.hooks.beforeChunks.tap(PLUGIN_NAME, () => {
|
|
24
|
-
const { includeDependencies } = compilation.globalEntry;
|
|
25
|
-
|
|
26
|
-
for (const [entryName, entry] of compilation.entries) {
|
|
27
|
-
if (!this.entries.has(entryName)) {
|
|
28
|
-
// includeDependencies are set by ModuleFederationPlugin and consist of shared modules
|
|
29
|
-
// as it is added to globalEntry it will be copied to every entry chunk
|
|
30
|
-
// move these modules from global entry to every entry that should have containers runtime
|
|
31
|
-
entry.includeDependencies.push(...includeDependencies);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// eslint-disable-next-line no-param-reassign
|
|
36
|
-
compilation.globalEntry.includeDependencies = [];
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
// through that hook ModuleFederationPlugin adds some runtime code for the containers
|
|
40
|
-
// intercept this call to prevent this function from execution for the entries that
|
|
41
|
-
// should not have containers runtime
|
|
42
|
-
compilation.hooks.additionalTreeRuntimeRequirements.intercept({
|
|
43
|
-
register: (tap) => {
|
|
44
|
-
if (tap.name === 'ConsumeSharedPlugin') {
|
|
45
|
-
const originalFn = tap.fn;
|
|
46
|
-
// eslint-disable-next-line no-param-reassign
|
|
47
|
-
tap.fn = (chunk, ...args) => {
|
|
48
|
-
if (!this.entries.has(chunk.name)) {
|
|
49
|
-
originalFn(chunk, ...args);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return tap;
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getPolyfillCondition,
|
|
3
|
-
getMaxBrowserVersionsByFeatures,
|
|
4
|
-
} from '../utils/polyfills/polyfillCondition';
|
|
5
|
-
|
|
6
|
-
const TARGET_PLUGIN_NAME = 'stats-writer-plugin';
|
|
7
|
-
|
|
8
|
-
export default class PolyfillConditionPlugin {
|
|
9
|
-
constructor(private options: { filename: string }) {
|
|
10
|
-
this.options = options;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
apply(compiler) {
|
|
14
|
-
compiler.hooks.thisCompilation.tap(TARGET_PLUGIN_NAME, (compilation) => {
|
|
15
|
-
compilation.hooks.processAssets.tap(
|
|
16
|
-
{
|
|
17
|
-
name: TARGET_PLUGIN_NAME,
|
|
18
|
-
stage: compilation.constructor.PROCESS_ASSETS_STAGE_REPORT,
|
|
19
|
-
},
|
|
20
|
-
() => {
|
|
21
|
-
const { entrypoints } = compilation;
|
|
22
|
-
const polyfillEntrypoint = entrypoints.get('polyfill');
|
|
23
|
-
|
|
24
|
-
// If no polyfill entrypoint presented do nothing
|
|
25
|
-
if (!polyfillEntrypoint) return;
|
|
26
|
-
|
|
27
|
-
const polyfillChunk = polyfillEntrypoint.getEntrypointChunk();
|
|
28
|
-
const polyfillModules = compilation.chunkGraph.getChunkModulesIterable(polyfillChunk);
|
|
29
|
-
const coreJsModules = [];
|
|
30
|
-
|
|
31
|
-
for (const module of polyfillModules) {
|
|
32
|
-
if (module.resource && /\/core-js\/modules\//.test(module.resource)) {
|
|
33
|
-
coreJsModules.push(module);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const features = coreJsModules.map((module) =>
|
|
38
|
-
getFeatureNameFromModulePath(module.resource)
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
const browserVersionsByFeatures = getMaxBrowserVersionsByFeatures(features);
|
|
42
|
-
const polyfillCondition = getPolyfillCondition(browserVersionsByFeatures);
|
|
43
|
-
const { filename } = this.options;
|
|
44
|
-
const statsJSON = JSON.parse(compilation.assets[filename].source().toString());
|
|
45
|
-
|
|
46
|
-
statsJSON.polyfillCondition = polyfillCondition;
|
|
47
|
-
statsJSON.features = browserVersionsByFeatures;
|
|
48
|
-
|
|
49
|
-
compilation.updateAsset(
|
|
50
|
-
filename,
|
|
51
|
-
new compiler.webpack.sources.RawSource(JSON.stringify(statsJSON))
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// node_modules/core-js/modules/es.array.push.js => es.array.push
|
|
60
|
-
function getFeatureNameFromModulePath(modulePath) {
|
|
61
|
-
return modulePath.split('/').at(-1).replace(/\.js$/, '');
|
|
62
|
-
}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
const targetStatsWriters = {
|
|
2
|
-
'child-app': '@loadable/webpack-plugin',
|
|
3
|
-
application: 'stats-writer-plugin',
|
|
4
|
-
} as const;
|
|
5
|
-
|
|
6
|
-
type BuildTarget = keyof typeof targetStatsWriters;
|
|
7
|
-
|
|
8
|
-
const getTargetPluginName = (target: BuildTarget) => targetStatsWriters[target];
|
|
9
|
-
|
|
10
|
-
// Purify unused information from stats.json
|
|
11
|
-
export const purifyStatsPluginFactory = (target: BuildTarget) => {
|
|
12
|
-
const targetPluginName = getTargetPluginName(target);
|
|
13
|
-
|
|
14
|
-
return class PurifyStatsPlugin {
|
|
15
|
-
fileName: string;
|
|
16
|
-
|
|
17
|
-
constructor(options: { fileName: string }) {
|
|
18
|
-
this.fileName = options.fileName;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
apply(compiler) {
|
|
22
|
-
compiler.hooks.make.tap(targetPluginName, (compilation) => {
|
|
23
|
-
compilation.hooks.processAssets.tap(
|
|
24
|
-
{
|
|
25
|
-
name: targetPluginName,
|
|
26
|
-
stage: compilation.constructor.PROCESS_ASSETS_STAGE_REPORT,
|
|
27
|
-
},
|
|
28
|
-
() => {
|
|
29
|
-
const { fileName } = this;
|
|
30
|
-
const statsJSON = JSON.parse(compilation.assets[fileName].source().toString());
|
|
31
|
-
const { assets } = statsJSON;
|
|
32
|
-
|
|
33
|
-
if (assets) {
|
|
34
|
-
if (target === 'application') {
|
|
35
|
-
delete statsJSON.assets;
|
|
36
|
-
} else {
|
|
37
|
-
statsJSON.assets = assets
|
|
38
|
-
.filter((asset) => /\.(js|mjs|cjs|css)$/.test(asset.name))
|
|
39
|
-
.map(({ name, type, chunks, chunkNames }) => ({
|
|
40
|
-
name,
|
|
41
|
-
type,
|
|
42
|
-
chunks,
|
|
43
|
-
chunkNames,
|
|
44
|
-
}));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
compilation.updateAsset(
|
|
49
|
-
fileName,
|
|
50
|
-
new compiler.webpack.sources.RawSource(JSON.stringify(statsJSON))
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
);
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
};
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import type webpack from 'webpack';
|
|
2
|
-
import type { Compiler } from 'webpack';
|
|
3
|
-
import type Sharp from 'sharp';
|
|
4
|
-
import type { PwaIconOptions } from '../../../typings/pwa';
|
|
5
|
-
|
|
6
|
-
const pluginName = 'PwaIconsPlugin';
|
|
7
|
-
|
|
8
|
-
export class PwaIconsPlugin implements webpack.WebpackPluginInstance {
|
|
9
|
-
private hash: string;
|
|
10
|
-
|
|
11
|
-
constructor(
|
|
12
|
-
private options: PwaIconOptions & {
|
|
13
|
-
mode: 'production' | 'development';
|
|
14
|
-
}
|
|
15
|
-
) {
|
|
16
|
-
this.options = options;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
apply(compiler: Compiler) {
|
|
20
|
-
const { webpack } = compiler;
|
|
21
|
-
const { Compilation } = webpack;
|
|
22
|
-
const { RawSource } = webpack.sources;
|
|
23
|
-
const { src, dest, sizes, mode } = this.options;
|
|
24
|
-
|
|
25
|
-
compiler.hooks.thisCompilation.tap(pluginName, (compilation) => {
|
|
26
|
-
// watch icon source file
|
|
27
|
-
if (!compilation.fileDependencies.has(src)) {
|
|
28
|
-
compilation.fileDependencies.add(src);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
compilation.hooks.processAssets.tapPromise(
|
|
32
|
-
{
|
|
33
|
-
name: pluginName,
|
|
34
|
-
// to work before WebManifestPlugin
|
|
35
|
-
stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS - 1,
|
|
36
|
-
},
|
|
37
|
-
async () => {
|
|
38
|
-
try {
|
|
39
|
-
const sharp: typeof Sharp = require('sharp');
|
|
40
|
-
// check icon source file updates
|
|
41
|
-
const nextHash = await new Promise<string>((resolve) => {
|
|
42
|
-
compilation.fileSystemInfo.getFileHash(src, (_, hash) => {
|
|
43
|
-
resolve(hash);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
if (!this.hash) {
|
|
48
|
-
this.hash = nextHash;
|
|
49
|
-
} else if (this.hash === nextHash) {
|
|
50
|
-
// skip if icon source file not changed
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// @todo persistent cache between builds !!!
|
|
55
|
-
const promises = sizes.map((size) => {
|
|
56
|
-
return sharp(src)
|
|
57
|
-
.resize({ width: size, height: size })
|
|
58
|
-
.png({
|
|
59
|
-
quality: 95,
|
|
60
|
-
compressionLevel: 8,
|
|
61
|
-
adaptiveFiltering: true,
|
|
62
|
-
progressive: true,
|
|
63
|
-
force: true,
|
|
64
|
-
})
|
|
65
|
-
.toBuffer()
|
|
66
|
-
.then((content) => ({
|
|
67
|
-
filename: `${dest}/${size}x${size}${
|
|
68
|
-
mode === 'development' ? '' : `.${this.hash}`
|
|
69
|
-
}.png`,
|
|
70
|
-
content,
|
|
71
|
-
}));
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
const results = await Promise.all(promises);
|
|
75
|
-
|
|
76
|
-
results.forEach(({ filename, content }, i) => {
|
|
77
|
-
const source = new RawSource(content);
|
|
78
|
-
const asset = compilation.getAsset(filename);
|
|
79
|
-
|
|
80
|
-
if (asset) {
|
|
81
|
-
compilation.updateAsset(filename, source, { _pwaIconSize: sizes[i] });
|
|
82
|
-
} else {
|
|
83
|
-
compilation.emitAsset(filename, source, { _pwaIconSize: sizes[i] });
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
} catch (e) {
|
|
87
|
-
// @todo: throw error?
|
|
88
|
-
console.error('PWA icons processing error:', e);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
);
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}
|