@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
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import type { Container } from '@tinkoff/dippy';
|
|
3
|
+
import { StartParameters, start } from '@tramvai/api/lib/api/start';
|
|
4
|
+
import { ApplicationProject, Configuration } from '@tramvai/api/lib/config';
|
|
5
|
+
import {
|
|
6
|
+
COMMAND_PARAMETERS_TOKEN,
|
|
7
|
+
CONFIG_ENTRY_TOKEN,
|
|
8
|
+
CONFIG_ROOT_DIR_TOKEN,
|
|
9
|
+
} from '../../di/tokens';
|
|
10
|
+
import { getTramvaiConfig } from '../../utils/getTramvaiConfig';
|
|
11
|
+
import { ApplicationConfigEntry } from '../../typings/configEntry/application';
|
|
12
|
+
import type { Params, Result } from './index';
|
|
13
|
+
|
|
14
|
+
declare global {
|
|
15
|
+
// eslint-disable-next-line no-var, vars-on-top
|
|
16
|
+
var __TRAMVAI_EXIT_HANDLERS__: Array<() => Promise<any>>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const startApplicationExperimental = async (di: Container): Result => {
|
|
20
|
+
const configEntry = di.get(CONFIG_ENTRY_TOKEN);
|
|
21
|
+
const options = di.get(COMMAND_PARAMETERS_TOKEN as Params);
|
|
22
|
+
const rootDir = di.get(CONFIG_ROOT_DIR_TOKEN);
|
|
23
|
+
|
|
24
|
+
const inputParameters: StartParameters = {
|
|
25
|
+
name: configEntry.name,
|
|
26
|
+
mode: 'development',
|
|
27
|
+
buildType: options.buildType,
|
|
28
|
+
port: options.port,
|
|
29
|
+
host: options.host,
|
|
30
|
+
staticPort: options.staticPort,
|
|
31
|
+
staticHost: options.staticHost,
|
|
32
|
+
noServerRebuild: options.noServerRebuild,
|
|
33
|
+
noClientRebuild: options.noClientRebuild,
|
|
34
|
+
resolveSymlinks: options.resolveSymlinks,
|
|
35
|
+
fileCache: options.fileCache,
|
|
36
|
+
showProgress: true,
|
|
37
|
+
verboseLogging: options.verboseWebpack,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const { content, projects } = mapTramvaiJsonToNewTsConfig({ rootDir });
|
|
41
|
+
|
|
42
|
+
const hasSwcTranspiler = Object.values(content.projects).some((project) => {
|
|
43
|
+
if (
|
|
44
|
+
project.type !== 'application' ||
|
|
45
|
+
!(project as ApplicationConfigEntry).experiments?.transpilation
|
|
46
|
+
) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
const { loader } = (project as ApplicationConfigEntry).experiments.transpilation;
|
|
50
|
+
|
|
51
|
+
if (typeof loader === 'string') {
|
|
52
|
+
// @ts-expect-error
|
|
53
|
+
return loader === 'swc';
|
|
54
|
+
}
|
|
55
|
+
// @ts-expect-error
|
|
56
|
+
return loader.development === 'swc';
|
|
57
|
+
});
|
|
58
|
+
const hasPwa = Object.values(content.projects).some((project) => {
|
|
59
|
+
if (project.type !== 'application' || !(project as ApplicationConfigEntry).experiments) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
const { pwa } = (project as ApplicationConfigEntry).experiments;
|
|
63
|
+
return !!pwa;
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const extraConfiguration: Partial<Configuration> = {
|
|
67
|
+
projects,
|
|
68
|
+
plugins: [
|
|
69
|
+
'@tramvai/plugin-webpack-builder',
|
|
70
|
+
hasSwcTranspiler ? '@tramvai/plugin-swc-transpiler' : '@tramvai/plugin-babel-transpiler',
|
|
71
|
+
hasPwa && '@tramvai/plugin-webpack-pwa',
|
|
72
|
+
].filter(Boolean),
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const devServer = await start(inputParameters, extraConfiguration);
|
|
76
|
+
|
|
77
|
+
// CLI will wait for this handlers before exiting
|
|
78
|
+
// @reference `packages/cli/src/cli/runCLI.ts`
|
|
79
|
+
if (!global.__TRAMVAI_EXIT_HANDLERS__) {
|
|
80
|
+
global.__TRAMVAI_EXIT_HANDLERS__ = [];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
global.__TRAMVAI_EXIT_HANDLERS__.push(async () => {
|
|
84
|
+
await devServer?.close?.();
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
try {
|
|
88
|
+
await devServer.buildPromise;
|
|
89
|
+
} catch (e) {
|
|
90
|
+
// some webpack build errors can be safely ignored
|
|
91
|
+
// TODO: strictErrorHandle parameter? used in `packages/cli/src/library/swc/__integration__/swc.start.test.ts` for old cli
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
server: devServer.httpServer,
|
|
96
|
+
staticServer: devServer.staticHttpServer,
|
|
97
|
+
close: async () => {
|
|
98
|
+
await devServer.close();
|
|
99
|
+
},
|
|
100
|
+
invalidate: async () => {
|
|
101
|
+
await devServer.invalidate();
|
|
102
|
+
},
|
|
103
|
+
getBuildStats: () => {
|
|
104
|
+
return {};
|
|
105
|
+
},
|
|
106
|
+
builder: {
|
|
107
|
+
name: '@tramvai/plugin-webpack-builder',
|
|
108
|
+
start: async (options) => {
|
|
109
|
+
return {
|
|
110
|
+
close: async () => {
|
|
111
|
+
await devServer.close();
|
|
112
|
+
},
|
|
113
|
+
invalidate: async () => {
|
|
114
|
+
await devServer.invalidate();
|
|
115
|
+
},
|
|
116
|
+
getBuildStats: () => {
|
|
117
|
+
return {};
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
},
|
|
121
|
+
build: async (options) => {
|
|
122
|
+
return {
|
|
123
|
+
getBuildStats: () => {
|
|
124
|
+
return {};
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
},
|
|
128
|
+
analyze: async (options) => {},
|
|
129
|
+
on: (event, callback) => {
|
|
130
|
+
// TODO useful events as public new devServer API
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Mapping from tramvai.json config format to new tramvai.config.ts,
|
|
138
|
+
* for seamless migration
|
|
139
|
+
*/
|
|
140
|
+
// eslint-disable-next-line max-statements, complexity
|
|
141
|
+
function mapTramvaiJsonToNewTsConfig({ rootDir }: { rootDir: string }) {
|
|
142
|
+
const { content } = getTramvaiConfig(rootDir);
|
|
143
|
+
const projects: Configuration['projects'] = {};
|
|
144
|
+
|
|
145
|
+
for (const projectName in content.projects) {
|
|
146
|
+
const project = content.projects[projectName];
|
|
147
|
+
|
|
148
|
+
if (project.type === 'application') {
|
|
149
|
+
const applicationProject = project as ApplicationConfigEntry;
|
|
150
|
+
|
|
151
|
+
const mappedProject: ApplicationProject = {
|
|
152
|
+
name: projectName,
|
|
153
|
+
type: 'application',
|
|
154
|
+
deprecatedLessSupport: true,
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
if (applicationProject.root) {
|
|
158
|
+
mappedProject.sourceDir = applicationProject.root;
|
|
159
|
+
}
|
|
160
|
+
if (applicationProject.output) {
|
|
161
|
+
mappedProject.output = {};
|
|
162
|
+
|
|
163
|
+
if (applicationProject.output.server) {
|
|
164
|
+
mappedProject.output.server = applicationProject.output.server;
|
|
165
|
+
}
|
|
166
|
+
if (applicationProject.output.client) {
|
|
167
|
+
mappedProject.output.client = applicationProject.output.client;
|
|
168
|
+
}
|
|
169
|
+
if (applicationProject.output.static) {
|
|
170
|
+
mappedProject.output.static = applicationProject.output.static;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (applicationProject.fileSystemPages) {
|
|
174
|
+
mappedProject.fileSystemPages = applicationProject.fileSystemPages;
|
|
175
|
+
}
|
|
176
|
+
if (applicationProject.experiments && 'runtimeChunk' in applicationProject.experiments) {
|
|
177
|
+
mappedProject.runtimeChunk = applicationProject.experiments.runtimeChunk;
|
|
178
|
+
}
|
|
179
|
+
if (applicationProject.experiments && 'viewTransitions' in applicationProject.experiments) {
|
|
180
|
+
mappedProject.experiments.viewTransitions = applicationProject.experiments.viewTransitions;
|
|
181
|
+
}
|
|
182
|
+
if (applicationProject.experiments && 'reactTransitions' in applicationProject.experiments) {
|
|
183
|
+
mappedProject.experiments.reactTransitions =
|
|
184
|
+
applicationProject.experiments.reactTransitions;
|
|
185
|
+
}
|
|
186
|
+
if (
|
|
187
|
+
applicationProject.experiments &&
|
|
188
|
+
'enableFillDeclareActionNamePlugin' in applicationProject.experiments
|
|
189
|
+
) {
|
|
190
|
+
mappedProject.enableFillDeclareActionNamePlugin =
|
|
191
|
+
applicationProject.experiments.enableFillDeclareActionNamePlugin;
|
|
192
|
+
}
|
|
193
|
+
if (applicationProject.serverApiDir) {
|
|
194
|
+
mappedProject.fileSystemPapiDir = path.resolve(applicationProject.serverApiDir);
|
|
195
|
+
}
|
|
196
|
+
if (applicationProject.postcss) {
|
|
197
|
+
mappedProject.postcss = applicationProject.postcss;
|
|
198
|
+
|
|
199
|
+
if (mappedProject.postcss.config) {
|
|
200
|
+
// TODO file outside src dir
|
|
201
|
+
if (mappedProject.postcss.config.startsWith(applicationProject.root)) {
|
|
202
|
+
mappedProject.postcss.config = mappedProject.postcss.config.replace(
|
|
203
|
+
`${applicationProject.root}/`,
|
|
204
|
+
''
|
|
205
|
+
);
|
|
206
|
+
} else if (mappedProject.postcss.config.startsWith('./')) {
|
|
207
|
+
mappedProject.postcss.config = path.resolve(mappedProject.postcss.config);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (applicationProject.polyfill) {
|
|
212
|
+
try {
|
|
213
|
+
if (require.resolve(mappedProject.polyfill).includes('node_modules')) {
|
|
214
|
+
mappedProject.polyfill = require.resolve(applicationProject.polyfill);
|
|
215
|
+
} else {
|
|
216
|
+
mappedProject.polyfill = path.resolve(applicationProject.polyfill);
|
|
217
|
+
}
|
|
218
|
+
} catch (e) {
|
|
219
|
+
mappedProject.polyfill = path.resolve(applicationProject.polyfill);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
if (applicationProject.modernPolyfill) {
|
|
223
|
+
try {
|
|
224
|
+
if (require.resolve(mappedProject.modernPolyfill).includes('node_modules')) {
|
|
225
|
+
mappedProject.polyfill = require.resolve(applicationProject.modernPolyfill);
|
|
226
|
+
} else {
|
|
227
|
+
mappedProject.polyfill = path.resolve(applicationProject.modernPolyfill);
|
|
228
|
+
}
|
|
229
|
+
} catch (e) {
|
|
230
|
+
mappedProject.polyfill = path.resolve(applicationProject.modernPolyfill);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
if (applicationProject.dedupe) {
|
|
234
|
+
mappedProject.dedupe = applicationProject.dedupe;
|
|
235
|
+
}
|
|
236
|
+
if ('integrity' in applicationProject) {
|
|
237
|
+
if (typeof applicationProject.integrity === 'boolean') {
|
|
238
|
+
mappedProject.integrity = {
|
|
239
|
+
enabled: applicationProject.integrity,
|
|
240
|
+
};
|
|
241
|
+
} else {
|
|
242
|
+
// @ts-expect-error inconsistent `hashFuncNames` types
|
|
243
|
+
mappedProject.integrity = applicationProject.integrity;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (
|
|
247
|
+
applicationProject.splitChunks &&
|
|
248
|
+
(applicationProject.splitChunks.mode === 'granularChunks' ||
|
|
249
|
+
applicationProject.splitChunks.mode === false)
|
|
250
|
+
) {
|
|
251
|
+
// @ts-expect-error `commonChunk` is not supported in new cli
|
|
252
|
+
mappedProject.splitChunks = applicationProject.splitChunks;
|
|
253
|
+
}
|
|
254
|
+
if (applicationProject.webpack?.resolveAlias) {
|
|
255
|
+
if (!mappedProject.webpack) {
|
|
256
|
+
mappedProject.webpack = {};
|
|
257
|
+
}
|
|
258
|
+
mappedProject.webpack.resolveAlias = applicationProject.webpack.resolveAlias;
|
|
259
|
+
}
|
|
260
|
+
if (applicationProject.webpack?.provide) {
|
|
261
|
+
if (!mappedProject.webpack) {
|
|
262
|
+
mappedProject.webpack = {};
|
|
263
|
+
}
|
|
264
|
+
mappedProject.webpack.provide = applicationProject.webpack.provide;
|
|
265
|
+
}
|
|
266
|
+
if (applicationProject.webpack?.watchOptions) {
|
|
267
|
+
if (!mappedProject.webpack) {
|
|
268
|
+
mappedProject.webpack = {};
|
|
269
|
+
}
|
|
270
|
+
mappedProject.webpack.watchOptions = applicationProject.webpack.watchOptions;
|
|
271
|
+
}
|
|
272
|
+
if (applicationProject.webpack && 'devtool' in applicationProject.webpack) {
|
|
273
|
+
if (!mappedProject.webpack) {
|
|
274
|
+
mappedProject.webpack = {};
|
|
275
|
+
}
|
|
276
|
+
mappedProject.webpack.devtool = applicationProject.webpack.devtool;
|
|
277
|
+
}
|
|
278
|
+
if (applicationProject.experiments?.pwa) {
|
|
279
|
+
mappedProject.pwa = {
|
|
280
|
+
workbox: {
|
|
281
|
+
...applicationProject.experiments.pwa.workbox,
|
|
282
|
+
enabled:
|
|
283
|
+
typeof applicationProject.experiments.pwa.workbox.enabled === 'boolean'
|
|
284
|
+
? applicationProject.experiments.pwa.workbox.enabled
|
|
285
|
+
: applicationProject.experiments.pwa.workbox.enabled.development,
|
|
286
|
+
},
|
|
287
|
+
sw: applicationProject.experiments.pwa.sw,
|
|
288
|
+
webmanifest: applicationProject.experiments.pwa.webmanifest,
|
|
289
|
+
icon: applicationProject.experiments.pwa.icon,
|
|
290
|
+
meta: applicationProject.experiments.pwa.meta,
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
if (applicationProject.externals) {
|
|
294
|
+
if (!mappedProject.webpack) {
|
|
295
|
+
mappedProject.webpack = {};
|
|
296
|
+
}
|
|
297
|
+
mappedProject.webpack.externals = applicationProject.externals;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
projects[projectName] = mappedProject;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
return { content, projects };
|
|
305
|
+
}
|
package/src/api/start/index.ts
CHANGED
|
@@ -3,10 +3,7 @@ import type { PromiseType } from 'utility-types';
|
|
|
3
3
|
import type { Provider } from '@tinkoff/dippy';
|
|
4
4
|
import { createCommand } from '../../commands/createCommand';
|
|
5
5
|
import type { WithConfig } from '../shared/types/withConfig';
|
|
6
|
-
import {
|
|
7
|
-
import { startModule } from './module';
|
|
8
|
-
import { CONFIG_ENTRY_TOKEN, PORT_MANAGER_TOKEN } from '../../di/tokens';
|
|
9
|
-
import { startChildApp } from './child-app';
|
|
6
|
+
import { COMMAND_PARAMETERS_TOKEN, CONFIG_ENTRY_TOKEN, PORT_MANAGER_TOKEN } from '../../di/tokens';
|
|
10
7
|
import type { Builder } from '../../typings/build/Builder';
|
|
11
8
|
|
|
12
9
|
export type Params = WithConfig<{
|
|
@@ -33,6 +30,7 @@ export type Params = WithConfig<{
|
|
|
33
30
|
onlyBundles?: string[];
|
|
34
31
|
strictErrorHandle?: boolean;
|
|
35
32
|
fileCache?: boolean;
|
|
33
|
+
experimentalWebpackWorkerThreads?: boolean;
|
|
36
34
|
}>;
|
|
37
35
|
|
|
38
36
|
export type Result<T extends string = any> = Promise<
|
|
@@ -49,17 +47,35 @@ export type StartCommand = (params: Params, providers?: Provider[]) => Result;
|
|
|
49
47
|
export default createCommand({
|
|
50
48
|
name: 'start',
|
|
51
49
|
command: async (di): Result => {
|
|
50
|
+
const options = di.get(COMMAND_PARAMETERS_TOKEN as Params);
|
|
52
51
|
const configEntry = di.get(CONFIG_ENTRY_TOKEN);
|
|
53
52
|
const portManager = di.get(PORT_MANAGER_TOKEN);
|
|
54
53
|
|
|
54
|
+
if (options.experimentalWebpackWorkerThreads) {
|
|
55
|
+
if (configEntry.type !== 'application') {
|
|
56
|
+
throw new Error(
|
|
57
|
+
'--experimentalWebpackWorkerThreads option is only available for application project'
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const { startApplicationExperimental } = require('./application.experimental');
|
|
62
|
+
return startApplicationExperimental(di);
|
|
63
|
+
}
|
|
64
|
+
|
|
55
65
|
await portManager.computeAvailablePorts();
|
|
56
66
|
|
|
57
67
|
switch (configEntry.type) {
|
|
58
68
|
case 'application':
|
|
69
|
+
// eslint-disable-next-line no-case-declarations
|
|
70
|
+
const { startApplication } = require('./application');
|
|
59
71
|
return startApplication(di);
|
|
60
72
|
case 'module':
|
|
73
|
+
// eslint-disable-next-line no-case-declarations
|
|
74
|
+
const { startModule } = require('./module');
|
|
61
75
|
return startModule(di);
|
|
62
76
|
case 'child-app':
|
|
77
|
+
// eslint-disable-next-line no-case-declarations
|
|
78
|
+
const { startChildApp } = require('./child-app');
|
|
63
79
|
return startChildApp(di);
|
|
64
80
|
}
|
|
65
81
|
},
|
|
@@ -84,6 +84,7 @@ export const createDevServer = ({
|
|
|
84
84
|
if (configManager.hotRefresh.enabled) {
|
|
85
85
|
app.use(
|
|
86
86
|
getHotModulePrefix(configManager),
|
|
87
|
+
// @ts-ignore - https://github.com/DefinitelyTyped/DefinitelyTyped/pull/73338
|
|
87
88
|
webpackHotMiddleware(compiler, { log: false, statsOptions: { cached: false } })
|
|
88
89
|
);
|
|
89
90
|
}
|
|
@@ -10,10 +10,6 @@ import {
|
|
|
10
10
|
} from '../../../../di/tokens';
|
|
11
11
|
import { toWebpackConfig } from '../../../../library/webpack/utils/toWebpackConfig';
|
|
12
12
|
import { npmRequire, npmRequireList } from '../../../../utils/npmRequire';
|
|
13
|
-
import { BundleAnalyzePlugin } from '../../analyzePlugins/bundle';
|
|
14
|
-
import { StatoscopeAnalyzePlugin } from '../../analyzePlugins/statoscope';
|
|
15
|
-
import { WhyBundledAnalyzePlugin } from '../../analyzePlugins/whyBundled';
|
|
16
|
-
import { RsdoctorAnalyzePlugin } from '../../analyzePlugins/rsdoctor';
|
|
17
13
|
import {
|
|
18
14
|
CLIENT_CONFIG_MANAGER_TOKEN,
|
|
19
15
|
INIT_HANDLER_TOKEN,
|
|
@@ -31,18 +27,18 @@ interface Type<T> extends Function {
|
|
|
31
27
|
new (...args: any[]): T;
|
|
32
28
|
}
|
|
33
29
|
|
|
34
|
-
const pluginMap: Record<string, Type<AnalyzePlugin>> = {
|
|
35
|
-
bundle: BundleAnalyzePlugin,
|
|
36
|
-
whybundled: WhyBundledAnalyzePlugin,
|
|
37
|
-
statoscope: StatoscopeAnalyzePlugin,
|
|
38
|
-
rsdoctor: RsdoctorAnalyzePlugin,
|
|
30
|
+
const pluginMap: Record<string, () => Type<AnalyzePlugin>> = {
|
|
31
|
+
bundle: () => require('../../analyzePlugins/bundle').BundleAnalyzePlugin,
|
|
32
|
+
whybundled: () => require('../../analyzePlugins/whyBundled').WhyBundledAnalyzePlugin,
|
|
33
|
+
statoscope: () => require('../../analyzePlugins/statoscope').StatoscopeAnalyzePlugin,
|
|
34
|
+
rsdoctor: () => require('../../analyzePlugins/rsdoctor').RsdoctorAnalyzePlugin,
|
|
39
35
|
};
|
|
40
36
|
|
|
41
37
|
export const analyzeSharedProviders: Provider[] = [
|
|
42
38
|
provide({
|
|
43
39
|
provide: WEBPACK_ANALYZE_PLUGIN_TOKEN,
|
|
44
40
|
useFactory: ({ pluginName }) => {
|
|
45
|
-
const PluginClass = pluginMap[pluginName];
|
|
41
|
+
const PluginClass = pluginMap[pluginName]();
|
|
46
42
|
|
|
47
43
|
if (!PluginClass) {
|
|
48
44
|
throw new Error('Set correct plugin option');
|
|
@@ -7,18 +7,21 @@ import { CLIENT_CONFIG_MANAGER_TOKEN, WEBPACK_CLIENT_CONFIG_TOKEN } from '../tok
|
|
|
7
7
|
import { CONFIG_GENERATOR_STUB } from '../stubs/config';
|
|
8
8
|
import type { ConfigGenerator } from '../types';
|
|
9
9
|
|
|
10
|
-
const CONFIG_MAP: Record<Env, Record<ProjectType, ConfigGenerator>> = {
|
|
10
|
+
const CONFIG_MAP: Record<Env, Record<ProjectType, () => ConfigGenerator>> = {
|
|
11
11
|
development: {
|
|
12
|
-
application:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
application: () =>
|
|
13
|
+
require('../../../library/webpack/application/client/dev').webpackClientConfig,
|
|
14
|
+
module: () => require('../../../library/webpack/module/client/dev').webpackClientConfig,
|
|
15
|
+
'child-app': () => require('../../../library/webpack/child-app/client/dev').webpackClientConfig,
|
|
16
|
+
package: () => CONFIG_GENERATOR_STUB,
|
|
16
17
|
},
|
|
17
18
|
production: {
|
|
18
|
-
application:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
application: () =>
|
|
20
|
+
require('../../../library/webpack/application/client/prod').webpackClientConfig,
|
|
21
|
+
module: () => require('../../../library/webpack/module/client/prod').webpackClientConfig,
|
|
22
|
+
'child-app': () =>
|
|
23
|
+
require('../../../library/webpack/child-app/client/prod').webpackClientConfig,
|
|
24
|
+
package: () => CONFIG_GENERATOR_STUB,
|
|
22
25
|
},
|
|
23
26
|
};
|
|
24
27
|
|
|
@@ -26,7 +29,9 @@ export const clientProviders: Provider[] = [
|
|
|
26
29
|
provide({
|
|
27
30
|
provide: WEBPACK_CLIENT_CONFIG_TOKEN,
|
|
28
31
|
useFactory: ({ configManager, showProgress }) => {
|
|
29
|
-
|
|
32
|
+
const webpackConfigFactory = CONFIG_MAP[configManager.env][configManager.type]();
|
|
33
|
+
|
|
34
|
+
return webpackConfigFactory({
|
|
30
35
|
configManager,
|
|
31
36
|
showProgress,
|
|
32
37
|
});
|
|
@@ -7,18 +7,21 @@ import { SERVER_CONFIG_MANAGER_TOKEN, WEBPACK_SERVER_CONFIG_TOKEN } from '../tok
|
|
|
7
7
|
import { CONFIG_GENERATOR_STUB } from '../stubs/config';
|
|
8
8
|
import type { ConfigGenerator } from '../types';
|
|
9
9
|
|
|
10
|
-
const CONFIG_MAP: Record<Env, Record<ProjectType, ConfigGenerator>> = {
|
|
10
|
+
const CONFIG_MAP: Record<Env, Record<ProjectType, () => ConfigGenerator>> = {
|
|
11
11
|
development: {
|
|
12
|
-
application:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
application: () =>
|
|
13
|
+
require('../../../library/webpack/application/server/dev').webpackServerConfig,
|
|
14
|
+
module: () => require('../../../library/webpack/module/server/dev').webpackServerConfig,
|
|
15
|
+
'child-app': () => require('../../../library/webpack/child-app/server/dev').webpackServerConfig,
|
|
16
|
+
package: () => CONFIG_GENERATOR_STUB,
|
|
16
17
|
},
|
|
17
18
|
production: {
|
|
18
|
-
application:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
application: () =>
|
|
20
|
+
require('../../../library/webpack/application/server/prod').webpackServerConfig,
|
|
21
|
+
module: () => require('../../../library/webpack/module/server/prod').webpackServerConfig,
|
|
22
|
+
'child-app': () =>
|
|
23
|
+
require('../../../library/webpack/child-app/server/prod').webpackServerConfig,
|
|
24
|
+
package: () => CONFIG_GENERATOR_STUB,
|
|
22
25
|
},
|
|
23
26
|
};
|
|
24
27
|
|
|
@@ -37,7 +40,9 @@ export const serverProviders: Provider[] = [
|
|
|
37
40
|
provide({
|
|
38
41
|
provide: WEBPACK_SERVER_CONFIG_TOKEN,
|
|
39
42
|
useFactory: ({ configManager, showProgress }) => {
|
|
40
|
-
|
|
43
|
+
const webpackConfigFactory = CONFIG_MAP[configManager.env][configManager.type]();
|
|
44
|
+
|
|
45
|
+
return webpackConfigFactory({
|
|
41
46
|
configManager,
|
|
42
47
|
showProgress,
|
|
43
48
|
});
|
package/src/cli/CLI.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { PackageManager } from '@tinkoff/package-manager-wrapper';
|
|
2
|
+
import { AnalyticsService } from '@tramvai/api/lib/services/analytics';
|
|
2
3
|
import { commander } from '../ui/commander';
|
|
3
4
|
import { Context } from '../models/context';
|
|
4
5
|
import type { Command, CommandMap, CommandResult } from '../models/command';
|
|
5
6
|
import type { Logger } from '../models/logger';
|
|
6
7
|
import type { Task, TaskMap } from '../models/task';
|
|
7
8
|
import type { ConfigManager } from '../models/config';
|
|
8
|
-
import { AnalyticsService } from '../models/analytics/analytics';
|
|
9
9
|
|
|
10
10
|
export class CLI {
|
|
11
11
|
context: Context;
|
package/src/cli/bin-init.ts
CHANGED
package/src/cli/index.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { resolvePackageManager, NpmPackageManager } from '@tinkoff/package-manager-wrapper';
|
|
3
|
+
import {
|
|
4
|
+
AnalyticsService,
|
|
5
|
+
resolveDependenciesProperties,
|
|
6
|
+
} from '@tramvai/api/lib/services/analytics';
|
|
3
7
|
import { CLI } from './CLI';
|
|
4
8
|
import { Logger } from '../models/logger';
|
|
5
9
|
import { ConfigManager } from '../models/config';
|
|
6
|
-
import { initSentry } from '../utils/sentry';
|
|
7
10
|
|
|
8
11
|
import type { CommandMap } from '../models/command';
|
|
9
12
|
|
|
@@ -26,7 +29,6 @@ import type { TaskMap } from '../models/task';
|
|
|
26
29
|
import { getRootFile } from '../utils/getRootFile';
|
|
27
30
|
import { getTramvaiConfig } from '../utils/getTramvaiConfig';
|
|
28
31
|
import { syncJsonFile } from '../utils/syncJsonFile';
|
|
29
|
-
import { AnalyticsService, resolveDependenciesProperties } from '../models/analytics/analytics';
|
|
30
32
|
|
|
31
33
|
async function loadCommands(): Promise<CommandMap> {
|
|
32
34
|
return [
|
|
@@ -54,14 +56,8 @@ const defaultPackageInfo = { name: 'init app', version: '0.0.1' };
|
|
|
54
56
|
export async function cliInitialized(cliArgs = process.argv) {
|
|
55
57
|
const logger = new Logger();
|
|
56
58
|
let analytics: AnalyticsService;
|
|
57
|
-
const sentry = initSentry();
|
|
58
59
|
|
|
59
60
|
try {
|
|
60
|
-
const commandContext = {
|
|
61
|
-
command: cliArgs[2] || '',
|
|
62
|
-
argv: cliArgs,
|
|
63
|
-
};
|
|
64
|
-
sentry.setContext('command', commandContext);
|
|
65
61
|
const commandsMap = await loadCommands();
|
|
66
62
|
const tasksMap = await loadTasks();
|
|
67
63
|
|
|
@@ -126,10 +122,7 @@ export async function cliInitialized(cliArgs = process.argv) {
|
|
|
126
122
|
message: e.message || e,
|
|
127
123
|
payload: e.details || e.stack,
|
|
128
124
|
});
|
|
129
|
-
sentry.captureException(e);
|
|
130
125
|
|
|
131
126
|
throw e;
|
|
132
|
-
} finally {
|
|
133
|
-
await sentry.close();
|
|
134
127
|
}
|
|
135
128
|
}
|
package/src/cli/runCLI.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CLICommand } from '../../models/command';
|
|
2
|
-
import { checkPackage } from './checkPackageValidator';
|
|
3
2
|
import type { Params } from './add';
|
|
4
3
|
|
|
5
4
|
class AddCommand extends CLICommand {
|
|
@@ -23,7 +22,9 @@ class AddCommand extends CLICommand {
|
|
|
23
22
|
|
|
24
23
|
alias = '';
|
|
25
24
|
|
|
26
|
-
validators
|
|
25
|
+
validators() {
|
|
26
|
+
return [require('./checkPackageValidator').checkPackage];
|
|
27
|
+
}
|
|
27
28
|
|
|
28
29
|
async action(parameters: Params) {
|
|
29
30
|
// used require for lazy code execution
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import { CLICommand } from '../../models/command';
|
|
2
|
-
import { checkApplication } from '../../validators/commands/checkBuild';
|
|
3
|
-
import { checkConfigExists } from '../../validators/commands/checkConfigExists';
|
|
4
|
-
import { checkPwaDependencies } from '../../validators/commands/checkPwaDependencies';
|
|
5
|
-
import { runMigrationsAndCheckVersions } from '../../validators/commands/runMigrationsAndCheckVersions';
|
|
6
|
-
import { checkSwcDependencies } from '../../validators/commands/checkSwcDependencies';
|
|
7
|
-
import { checkReactCompilerDependencies } from '../../validators/commands/checkReactCompilerDependencies';
|
|
8
2
|
|
|
9
3
|
export type Params = {
|
|
10
4
|
target: string;
|
|
@@ -46,14 +40,18 @@ class AnalyzeCommand extends CLICommand<Params> {
|
|
|
46
40
|
|
|
47
41
|
alias = 'a';
|
|
48
42
|
|
|
49
|
-
validators
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
43
|
+
validators() {
|
|
44
|
+
return [
|
|
45
|
+
require('../../validators/commands/checkConfigExists').checkConfigExists,
|
|
46
|
+
require('../../validators/commands/checkBuild').checkApplication,
|
|
47
|
+
require('../../validators/commands/runMigrationsAndCheckVersions')
|
|
48
|
+
.runMigrationsAndCheckVersions,
|
|
49
|
+
require('../../validators/commands/checkPwaDependencies').checkPwaDependencies,
|
|
50
|
+
require('../../validators/commands/checkSwcDependencies').checkSwcDependencies,
|
|
51
|
+
require('../../validators/commands/checkReactCompilerDependencies')
|
|
52
|
+
.checkReactCompilerDependencies,
|
|
53
|
+
];
|
|
54
|
+
}
|
|
57
55
|
|
|
58
56
|
action(parameters: Params) {
|
|
59
57
|
// used require for lazy code execution
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { CLICommand } from '../../models/command';
|
|
2
|
-
import { checkApplication } from '../../validators/commands/checkBuild';
|
|
3
|
-
import { checkConfigExists } from '../../validators/commands/checkConfigExists';
|
|
4
|
-
import { checkDependencies } from '../../validators/commands/checkDependencies';
|
|
5
|
-
import { runMigrationsAndCheckVersions } from '../../validators/commands/runMigrationsAndCheckVersions';
|
|
6
2
|
import type { Params as StartParams } from '../start/command';
|
|
7
3
|
|
|
8
4
|
export type Params = StartParams & {
|
|
@@ -45,12 +41,15 @@ export class BenchmarkCommand extends CLICommand<Params> {
|
|
|
45
41
|
|
|
46
42
|
alias = 'bench';
|
|
47
43
|
|
|
48
|
-
validators
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
validators() {
|
|
45
|
+
return [
|
|
46
|
+
require('../../validators/commands/checkConfigExists').checkConfigExists,
|
|
47
|
+
require('../../validators/commands/checkBuild').checkApplication,
|
|
48
|
+
require('../../validators/commands/runMigrationsAndCheckVersions')
|
|
49
|
+
.runMigrationsAndCheckVersions,
|
|
50
|
+
require('../../validators/commands/checkDependencies').checkDependencies,
|
|
51
|
+
];
|
|
52
|
+
}
|
|
54
53
|
|
|
55
54
|
action(parameters) {
|
|
56
55
|
// used require for lazy code execution
|
|
@@ -5,6 +5,8 @@ import { app } from '../index';
|
|
|
5
5
|
export default async (context: Context, parameters): Promise<CommandResult> => {
|
|
6
6
|
await app.run('build', parameters);
|
|
7
7
|
|
|
8
|
+
// todo builder.getBuildStats and send analytics event "cli:command:build:stats"
|
|
9
|
+
|
|
8
10
|
return Promise.resolve({
|
|
9
11
|
status: 'ok',
|
|
10
12
|
});
|