@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,488 +0,0 @@
|
|
|
1
|
-
import os from 'node:os';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import crypto from 'node:crypto';
|
|
4
|
-
import { Worker } from 'node:worker_threads';
|
|
5
|
-
import { PackageManager } from '@tinkoff/package-manager-wrapper';
|
|
6
|
-
import { Logger } from '../logger';
|
|
7
|
-
import { createMemoryMonitor } from '../../utils/memoryUsage';
|
|
8
|
-
import { enumerateErrorProperties } from '../../utils/errors';
|
|
9
|
-
|
|
10
|
-
declare global {
|
|
11
|
-
// eslint-disable-next-line no-var, vars-on-top
|
|
12
|
-
var __TRAMVAI_EXIT_HANDLERS__: Array<() => Promise<any>>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type LEVEL = 'INFO' | 'WARN' | 'ERROR';
|
|
16
|
-
|
|
17
|
-
export type COMMANDS =
|
|
18
|
-
| 'start'
|
|
19
|
-
| 'build'
|
|
20
|
-
| 'start-prod'
|
|
21
|
-
| 'static'
|
|
22
|
-
| 'analyze'
|
|
23
|
-
| 'new'
|
|
24
|
-
| 'add'
|
|
25
|
-
| 'update';
|
|
26
|
-
|
|
27
|
-
export type Event = {
|
|
28
|
-
/**
|
|
29
|
-
* @description ISO-8601 + timezone
|
|
30
|
-
*/
|
|
31
|
-
timestamp: string;
|
|
32
|
-
/**
|
|
33
|
-
* @description Unique identifier for the current cli execution
|
|
34
|
-
*/
|
|
35
|
-
'x-command-id': string;
|
|
36
|
-
level: LEVEL;
|
|
37
|
-
event: string;
|
|
38
|
-
message: string;
|
|
39
|
-
system: string;
|
|
40
|
-
tramvai: TramvaiProperties;
|
|
41
|
-
os: SystemProperties;
|
|
42
|
-
// process.env.CI
|
|
43
|
-
vcs?: VcsProperties;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export type ProjectProperties = {
|
|
47
|
-
name: string;
|
|
48
|
-
type?: 'application' | 'child-app' | 'module' | 'package' | 'unknown';
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export type TramvaiProperties = {
|
|
52
|
-
name: '@tramvai/cli';
|
|
53
|
-
version: string;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export type DependenciesProperties = {
|
|
57
|
-
react?: string;
|
|
58
|
-
webpack?: string;
|
|
59
|
-
babel?: string;
|
|
60
|
-
swc?: string;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export type SystemProperties = {
|
|
64
|
-
nodeVersion: string;
|
|
65
|
-
packageManager: {
|
|
66
|
-
name: string;
|
|
67
|
-
};
|
|
68
|
-
platform: string;
|
|
69
|
-
arch: string;
|
|
70
|
-
cpus: {
|
|
71
|
-
model: string;
|
|
72
|
-
count: number;
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export type FeaturesProperties = {
|
|
77
|
-
swc?: boolean;
|
|
78
|
-
fileSystemRouting?: boolean;
|
|
79
|
-
reactCompiler?: boolean;
|
|
80
|
-
devTools?: boolean;
|
|
81
|
-
moduleImage?: boolean;
|
|
82
|
-
modulePwa?: boolean;
|
|
83
|
-
viewTransitions?: boolean;
|
|
84
|
-
transitionsRouterProvider?: boolean;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
export type VcsProperties = {
|
|
88
|
-
// process.env.CI_PROJECT_NAMESPACE
|
|
89
|
-
tenant?: string;
|
|
90
|
-
// process.env.CI_PROJECT_NAME
|
|
91
|
-
repository?: string;
|
|
92
|
-
// process.env.CI_PIPELINE_URL
|
|
93
|
-
pipelineUrl?: string;
|
|
94
|
-
// process.env.CI_JOB_URL
|
|
95
|
-
jobUrl?: string;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
export type MemoryUsageProperties = {
|
|
99
|
-
// in bytes
|
|
100
|
-
maxHeapTotal: number;
|
|
101
|
-
// in bytes
|
|
102
|
-
maxHeapUsed: number;
|
|
103
|
-
// in bytes
|
|
104
|
-
maxRss: number;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
export type AnalyticsEvents = {
|
|
108
|
-
'cli:init': {
|
|
109
|
-
event: 'cli:init';
|
|
110
|
-
level: 'INFO';
|
|
111
|
-
message: string;
|
|
112
|
-
arguments: string[];
|
|
113
|
-
/**
|
|
114
|
-
* @description CLI uptime in milliseconds before the AnalyticsService was initialized
|
|
115
|
-
*/
|
|
116
|
-
uptime: number;
|
|
117
|
-
// TODO: max used old space size flag
|
|
118
|
-
// TODO: detect cold start?
|
|
119
|
-
dependencies: DependenciesProperties;
|
|
120
|
-
};
|
|
121
|
-
'cli:error': {
|
|
122
|
-
event: 'cli:error';
|
|
123
|
-
level: 'ERROR';
|
|
124
|
-
message: string;
|
|
125
|
-
arguments: string[];
|
|
126
|
-
error: Error;
|
|
127
|
-
/**
|
|
128
|
-
* @description CLI uptime in milliseconds before the AnalyticsService was initialized
|
|
129
|
-
*/
|
|
130
|
-
uptime: number;
|
|
131
|
-
};
|
|
132
|
-
'cli:command:start': {
|
|
133
|
-
event: 'cli:command:start';
|
|
134
|
-
level: 'INFO';
|
|
135
|
-
message: string;
|
|
136
|
-
command: COMMANDS;
|
|
137
|
-
parameters: Record<string, any>;
|
|
138
|
-
project?: ProjectProperties;
|
|
139
|
-
features?: FeaturesProperties;
|
|
140
|
-
};
|
|
141
|
-
'cli:command:end': {
|
|
142
|
-
event: 'cli:command:end';
|
|
143
|
-
level: 'INFO';
|
|
144
|
-
message: string;
|
|
145
|
-
command: COMMANDS;
|
|
146
|
-
/**
|
|
147
|
-
* @description duration in milliseconds
|
|
148
|
-
*/
|
|
149
|
-
duration: number;
|
|
150
|
-
memoryUsage?: MemoryUsageProperties;
|
|
151
|
-
parameters: Record<string, any>;
|
|
152
|
-
project: ProjectProperties;
|
|
153
|
-
};
|
|
154
|
-
'cli:command:build:stats': {
|
|
155
|
-
event: 'cli:command:build:stats';
|
|
156
|
-
level: 'INFO';
|
|
157
|
-
message: string;
|
|
158
|
-
command: 'build';
|
|
159
|
-
// TODO: compilation and stats info
|
|
160
|
-
parameters: Record<string, any>;
|
|
161
|
-
project: ProjectProperties;
|
|
162
|
-
};
|
|
163
|
-
'cli:command:error': {
|
|
164
|
-
event: 'cli:command:error';
|
|
165
|
-
level: 'ERROR';
|
|
166
|
-
message: string;
|
|
167
|
-
command: COMMANDS;
|
|
168
|
-
/**
|
|
169
|
-
* @description duration in milliseconds
|
|
170
|
-
*/
|
|
171
|
-
duration: number;
|
|
172
|
-
memoryUsage?: MemoryUsageProperties;
|
|
173
|
-
error: Error;
|
|
174
|
-
parameters: Record<string, any>;
|
|
175
|
-
project?: ProjectProperties;
|
|
176
|
-
};
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
export class AnalyticsService {
|
|
180
|
-
#enabled: boolean;
|
|
181
|
-
#endpoint: string;
|
|
182
|
-
#system: string;
|
|
183
|
-
#debug: boolean;
|
|
184
|
-
#dryRun: boolean;
|
|
185
|
-
#logger: Logger;
|
|
186
|
-
#packageManager: PackageManager;
|
|
187
|
-
#xCommandId: string;
|
|
188
|
-
#worker: Worker | null = null;
|
|
189
|
-
|
|
190
|
-
memoryMonitor: ReturnType<typeof createMemoryMonitor> | null = null;
|
|
191
|
-
|
|
192
|
-
constructor({
|
|
193
|
-
enabled = true,
|
|
194
|
-
endpoint = '',
|
|
195
|
-
system,
|
|
196
|
-
logger,
|
|
197
|
-
packageManager,
|
|
198
|
-
}: {
|
|
199
|
-
enabled?: boolean;
|
|
200
|
-
endpoint?: string;
|
|
201
|
-
system?: string;
|
|
202
|
-
logger: Logger;
|
|
203
|
-
packageManager: PackageManager;
|
|
204
|
-
}) {
|
|
205
|
-
this.#enabled = process.env.TRAMVAI_ANALYTICS_DISABLED
|
|
206
|
-
? process.env.TRAMVAI_ANALYTICS_DISABLED !== 'true'
|
|
207
|
-
: enabled;
|
|
208
|
-
this.#endpoint = process.env.TRAMVAI_ANALYTICS_ENDPOINT ?? endpoint;
|
|
209
|
-
this.#system = process.env.TRAMVAI_ANALYTICS_SYSTEM ?? system ?? 'tramvai-cli';
|
|
210
|
-
this.#debug = process.env.TRAMVAI_ANALYTICS_DEBUG === 'true';
|
|
211
|
-
this.#dryRun = process.env.TRAMVAI_ANALYTICS_DRY_RUN === 'true';
|
|
212
|
-
this.#logger = logger;
|
|
213
|
-
this.#packageManager = packageManager;
|
|
214
|
-
this.#xCommandId = crypto.randomUUID();
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
async init() {
|
|
218
|
-
if (!this.#worker && this.#enabled && this.#endpoint) {
|
|
219
|
-
await this.#spawnWorker();
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if (!this.memoryMonitor) {
|
|
223
|
-
this.#initMemoryMonitor();
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
this.#initErrorHandlers();
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
#initMemoryMonitor() {
|
|
230
|
-
this.memoryMonitor = createMemoryMonitor({ sampleInterval: 250 });
|
|
231
|
-
this.memoryMonitor.start();
|
|
232
|
-
|
|
233
|
-
// CLI will wait for this handlers before exiting
|
|
234
|
-
// @reference `packages/cli/src/cli/runCLI.ts`
|
|
235
|
-
if (!global.__TRAMVAI_EXIT_HANDLERS__) {
|
|
236
|
-
global.__TRAMVAI_EXIT_HANDLERS__ = [];
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
global.__TRAMVAI_EXIT_HANDLERS__.push(async () => {
|
|
240
|
-
this.memoryMonitor?.stop();
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
#initErrorHandlers() {
|
|
245
|
-
const sendErrorEvent = async (message: string, error: Error) => {
|
|
246
|
-
await this?.send({
|
|
247
|
-
event: 'cli:error',
|
|
248
|
-
message,
|
|
249
|
-
level: 'ERROR',
|
|
250
|
-
arguments: process.argv.slice(2),
|
|
251
|
-
error,
|
|
252
|
-
uptime: performance.now(),
|
|
253
|
-
});
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
process.on('uncaughtException', (error) => {
|
|
257
|
-
sendErrorEvent('uncaughtException', error);
|
|
258
|
-
});
|
|
259
|
-
|
|
260
|
-
process.on('unhandledRejection', (error) => {
|
|
261
|
-
sendErrorEvent('unhandledRejection', error as Error);
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
async send<E extends keyof AnalyticsEvents>(event: AnalyticsEvents[E]): Promise<void> {
|
|
266
|
-
return this.sendRawEvent(event);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
async sendRawEvent(
|
|
270
|
-
rawEvent: Pick<Event, 'event' | 'message' | 'level'> & Record<string, any>
|
|
271
|
-
): Promise<void> {
|
|
272
|
-
if (!this.#enabled || !this.#endpoint) {
|
|
273
|
-
return;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
try {
|
|
277
|
-
const event: Event & Record<string, any> = {
|
|
278
|
-
...rawEvent,
|
|
279
|
-
timestamp: new Date().toISOString(),
|
|
280
|
-
'x-command-id': this.#xCommandId,
|
|
281
|
-
system: this.#system,
|
|
282
|
-
tramvai: getTramvaiProperties(),
|
|
283
|
-
os: getOsProperties({ packageManager: this.#packageManager }),
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
if (process.env.CI) {
|
|
287
|
-
event.vcs = getVcsProperties();
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
if ('error' in event && event.error instanceof Error) {
|
|
291
|
-
enumerateErrorProperties(event.error);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
if (!this.#worker) {
|
|
295
|
-
await this.#spawnWorker();
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
this.#worker?.postMessage({
|
|
299
|
-
event: 'SEND_EVENT',
|
|
300
|
-
payload: event,
|
|
301
|
-
});
|
|
302
|
-
} catch (error) {
|
|
303
|
-
this.#logger.event({
|
|
304
|
-
type: 'error',
|
|
305
|
-
event: 'analytics-send-failed',
|
|
306
|
-
message: `Error sending analytics data: ${error instanceof Error ? error.message : String(error)}`,
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
async #spawnWorker() {
|
|
312
|
-
this.#worker = new Worker(path.resolve(__dirname, './analytics.worker.js'), {
|
|
313
|
-
workerData: {
|
|
314
|
-
endpoint: this.#endpoint,
|
|
315
|
-
debug: this.#debug,
|
|
316
|
-
dryRun: this.#dryRun,
|
|
317
|
-
},
|
|
318
|
-
name: 'analytics-worker',
|
|
319
|
-
});
|
|
320
|
-
|
|
321
|
-
this.#worker.on('error', (err) => {
|
|
322
|
-
this.#logger.event({
|
|
323
|
-
type: `error`,
|
|
324
|
-
event: 'analytics-worker-error',
|
|
325
|
-
message: `[analytics] worker error: ${err instanceof Error ? err.message : String(err)}`,
|
|
326
|
-
});
|
|
327
|
-
});
|
|
328
|
-
|
|
329
|
-
this.#worker.on('exit', (code) => {
|
|
330
|
-
if (code !== 0) {
|
|
331
|
-
this.#logger.event({
|
|
332
|
-
type: `error`,
|
|
333
|
-
event: 'analytics-worker-exit',
|
|
334
|
-
message: `[analytics] worker exit with code: ${code}`,
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
});
|
|
338
|
-
|
|
339
|
-
// CLI will wait for this handlers before exiting
|
|
340
|
-
// @reference `packages/cli/src/cli/runCLI.ts`
|
|
341
|
-
if (!global.__TRAMVAI_EXIT_HANDLERS__) {
|
|
342
|
-
global.__TRAMVAI_EXIT_HANDLERS__ = [];
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
// We need to ensure that the analytics is sent before the process exits.
|
|
346
|
-
// To ensure that, we implement a graceful worker shutdown:
|
|
347
|
-
// - send `EXIT` message to the worker
|
|
348
|
-
// - wait for the worker to respond with `SHUTDOWN_COMPLETE` message
|
|
349
|
-
// - worker will wait for all pending requests, send `SHUTDOWN_COMPLETE` to the parent and exit
|
|
350
|
-
global.__TRAMVAI_EXIT_HANDLERS__.push(async () => {
|
|
351
|
-
this.#logger.event({
|
|
352
|
-
type: 'info',
|
|
353
|
-
event: 'analytics-worker-exit',
|
|
354
|
-
message: 'Process shutting down, waiting for pending analytics to be sent',
|
|
355
|
-
});
|
|
356
|
-
|
|
357
|
-
const promise = new Promise<void>((resolve) => {
|
|
358
|
-
this.#worker?.on('message', async (message) => {
|
|
359
|
-
if (message.event === 'SHUTDOWN_COMPLETE') {
|
|
360
|
-
this.#worker = null;
|
|
361
|
-
resolve();
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
this.#worker?.postMessage({
|
|
367
|
-
event: 'EXIT',
|
|
368
|
-
});
|
|
369
|
-
|
|
370
|
-
await Promise.race([promise, new Promise<void>((resolve) => setTimeout(resolve, 5000))]);
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
await new Promise((resolve) => {
|
|
374
|
-
this.#worker?.once('online', resolve);
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
const cache: {
|
|
380
|
-
tramvaiProperties?: TramvaiProperties;
|
|
381
|
-
osProperties?: SystemProperties;
|
|
382
|
-
vcsProperties?: VcsProperties;
|
|
383
|
-
dependenciesProperties?: DependenciesProperties;
|
|
384
|
-
} = {};
|
|
385
|
-
|
|
386
|
-
function getTramvaiProperties(): TramvaiProperties {
|
|
387
|
-
if (cache.tramvaiProperties) {
|
|
388
|
-
return cache.tramvaiProperties;
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
const packageJson = require(path.resolve(__dirname, '../../../package.json'));
|
|
392
|
-
|
|
393
|
-
const tramvaiProperties: TramvaiProperties = {
|
|
394
|
-
name: '@tramvai/cli',
|
|
395
|
-
version: packageJson.version,
|
|
396
|
-
};
|
|
397
|
-
|
|
398
|
-
cache.tramvaiProperties = tramvaiProperties;
|
|
399
|
-
|
|
400
|
-
return tramvaiProperties;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
function getOsProperties({ packageManager }: { packageManager: PackageManager }): SystemProperties {
|
|
404
|
-
if (cache.osProperties) {
|
|
405
|
-
return cache.osProperties;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
const osProperties = {
|
|
409
|
-
nodeVersion: process.version,
|
|
410
|
-
packageManager: {
|
|
411
|
-
name: packageManager.name,
|
|
412
|
-
},
|
|
413
|
-
platform: os.platform(),
|
|
414
|
-
arch: os.arch(),
|
|
415
|
-
cpus: {
|
|
416
|
-
model: os.cpus()[0].model,
|
|
417
|
-
count: os.cpus().length,
|
|
418
|
-
},
|
|
419
|
-
};
|
|
420
|
-
|
|
421
|
-
cache.osProperties = osProperties;
|
|
422
|
-
|
|
423
|
-
return osProperties;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
function getVcsProperties(): VcsProperties {
|
|
427
|
-
if (cache.vcsProperties) {
|
|
428
|
-
return cache.vcsProperties;
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
const vcsProperties: VcsProperties = {};
|
|
432
|
-
|
|
433
|
-
if (process.env.CI_PROJECT_NAMESPACE) {
|
|
434
|
-
vcsProperties.tenant = process.env.CI_PROJECT_NAMESPACE;
|
|
435
|
-
}
|
|
436
|
-
if (process.env.CI_PROJECT_NAME) {
|
|
437
|
-
vcsProperties.repository = process.env.CI_PROJECT_NAME;
|
|
438
|
-
}
|
|
439
|
-
if (process.env.CI_PIPELINE_URL) {
|
|
440
|
-
vcsProperties.pipelineUrl = process.env.CI_PIPELINE_URL;
|
|
441
|
-
}
|
|
442
|
-
if (process.env.CI_JOB_URL) {
|
|
443
|
-
vcsProperties.jobUrl = process.env.CI_JOB_URL;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
cache.vcsProperties = vcsProperties;
|
|
447
|
-
|
|
448
|
-
return vcsProperties;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
export function resolveDependenciesProperties(): DependenciesProperties {
|
|
452
|
-
if (cache.dependenciesProperties) {
|
|
453
|
-
return cache.dependenciesProperties;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
const dependencies: DependenciesProperties = {};
|
|
457
|
-
|
|
458
|
-
try {
|
|
459
|
-
dependencies.react = require('react/package.json').version;
|
|
460
|
-
} catch (e) {
|
|
461
|
-
// do nothing
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
try {
|
|
465
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
466
|
-
dependencies.webpack = require('webpack/package.json').version;
|
|
467
|
-
} catch (e) {
|
|
468
|
-
// do nothing
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
try {
|
|
472
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
473
|
-
dependencies.babel = require('@babel/core/package.json').version;
|
|
474
|
-
} catch (e) {
|
|
475
|
-
// do nothing
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
try {
|
|
479
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
480
|
-
dependencies.swc = require('@swc/core/package.json').version;
|
|
481
|
-
} catch (e) {
|
|
482
|
-
// do nothing
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
cache.dependenciesProperties = dependencies;
|
|
486
|
-
|
|
487
|
-
return dependencies;
|
|
488
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { parentPort, workerData } from 'node:worker_threads';
|
|
2
|
-
import { logger } from '../logger';
|
|
3
|
-
import { enumerateErrorProperties } from '../../utils/errors';
|
|
4
|
-
|
|
5
|
-
declare global {
|
|
6
|
-
// eslint-disable-next-line no-var, vars-on-top
|
|
7
|
-
var __TRAMVAI_EXIT_HANDLERS__: Array<() => Promise<any>>;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const { endpoint, debug, dryRun } = workerData;
|
|
11
|
-
|
|
12
|
-
const queue: Promise<any>[] = [];
|
|
13
|
-
|
|
14
|
-
parentPort?.on('message', async (message) => {
|
|
15
|
-
switch (message.event) {
|
|
16
|
-
case 'SEND_EVENT': {
|
|
17
|
-
sendEvent(message.payload);
|
|
18
|
-
break;
|
|
19
|
-
}
|
|
20
|
-
case 'EXIT': {
|
|
21
|
-
await Promise.allSettled(queue);
|
|
22
|
-
parentPort?.postMessage({ event: 'SHUTDOWN_COMPLETE' });
|
|
23
|
-
process.exit(0);
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
async function sendEvent(event: Record<string, any>) {
|
|
30
|
-
try {
|
|
31
|
-
if (debug || dryRun) {
|
|
32
|
-
logger.event({
|
|
33
|
-
type: event.level.toLowerCase() as 'error' | 'warning' | 'info',
|
|
34
|
-
event: event.event,
|
|
35
|
-
message: event.message,
|
|
36
|
-
payload: event,
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if ('error' in event && event.error instanceof Error) {
|
|
41
|
-
enumerateErrorProperties(event.error);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (!dryRun) {
|
|
45
|
-
const abortController = new AbortController();
|
|
46
|
-
setTimeout(() => abortController.abort(new Error('request timeout')), 5000);
|
|
47
|
-
|
|
48
|
-
const request = fetch(endpoint, {
|
|
49
|
-
method: 'POST',
|
|
50
|
-
headers: { 'Content-Type': 'application/json' },
|
|
51
|
-
body: JSON.stringify([event]),
|
|
52
|
-
signal: abortController.signal,
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
queue.push(request);
|
|
56
|
-
|
|
57
|
-
const response = await request;
|
|
58
|
-
|
|
59
|
-
if (!response.ok || response.status >= 400) {
|
|
60
|
-
logger.event({
|
|
61
|
-
type: 'error',
|
|
62
|
-
event: 'analytics-send-failed',
|
|
63
|
-
message: `Error sending analytics data, response with status: ${response.status}`,
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
// prevent infinite loop in case of error
|
|
67
|
-
if (event.event !== 'cli:analytics:send-failed') {
|
|
68
|
-
sendEvent({
|
|
69
|
-
event: 'cli:analytics:send-failed',
|
|
70
|
-
level: 'ERROR',
|
|
71
|
-
message: `Error sending analytics data, response with status: ${response.status}`,
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
} catch (error) {
|
|
77
|
-
logger.event({
|
|
78
|
-
type: 'error',
|
|
79
|
-
event: 'analytics-send-failed',
|
|
80
|
-
message: `Error sending analytics data: ${error instanceof Error ? error.message : String(error)}`,
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
// prevent infinite loop in case of error
|
|
84
|
-
if (event.event !== 'cli:analytics:send-failed') {
|
|
85
|
-
sendEvent({
|
|
86
|
-
event: 'cli:analytics:send-failed',
|
|
87
|
-
level: 'ERROR',
|
|
88
|
-
message: `Error sending analytics data: ${error instanceof Error ? error.message : String(error)}`,
|
|
89
|
-
error,
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
async function runExitHandlersAndQuit(code: number) {
|
|
96
|
-
if (global.__TRAMVAI_EXIT_HANDLERS__) {
|
|
97
|
-
await Promise.allSettled(global.__TRAMVAI_EXIT_HANDLERS__.map((handler) => handler()));
|
|
98
|
-
}
|
|
99
|
-
process.exit(code);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
process.on('exit', async (code) => runExitHandlersAndQuit(code));
|
package/src/typings/pwa/index.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
export type WebManifestOptions = {
|
|
2
|
-
/**
|
|
3
|
-
* @title Create webmanifest file
|
|
4
|
-
* @default false
|
|
5
|
-
*/
|
|
6
|
-
enabled?: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* @title Name of generated manifest file (will be placed in "output.client" directory). You can use `[hash]` placeholder for manifest cache busting in production mode
|
|
9
|
-
* @default "/manifest.[hash].json"
|
|
10
|
-
*/
|
|
11
|
-
dest?: string;
|
|
12
|
-
/**
|
|
13
|
-
* @title prefer to use "pwa.sw.scope" instead, this field will be generated automatically
|
|
14
|
-
*/
|
|
15
|
-
scope?: string;
|
|
16
|
-
name?: string;
|
|
17
|
-
short_name?: string;
|
|
18
|
-
description?: string;
|
|
19
|
-
// @todo - example or default with `/?standalone=true`?
|
|
20
|
-
start_url?: string;
|
|
21
|
-
display?: string;
|
|
22
|
-
/**
|
|
23
|
-
* @title prefer to use "pwa.meta.themeColor" instead, this field will be generated automatically
|
|
24
|
-
*/
|
|
25
|
-
theme_color?: string;
|
|
26
|
-
background_color?: string;
|
|
27
|
-
/**
|
|
28
|
-
* @title prefer to use "pwa.icon" instead, this field will be generated automatically
|
|
29
|
-
*/
|
|
30
|
-
icons?: Array<PwaIconItem>;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export type PwaIconItem = {
|
|
34
|
-
src: string;
|
|
35
|
-
sizes: string;
|
|
36
|
-
type?: string;
|
|
37
|
-
density?: number;
|
|
38
|
-
purpose?: string;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export type PwaIconOptions = {
|
|
42
|
-
/**
|
|
43
|
-
* @title Path to icon file (relative to "root" directory)
|
|
44
|
-
*/
|
|
45
|
-
src: string;
|
|
46
|
-
/**
|
|
47
|
-
* @title Folder for generated icons (will be placed in "output.client" directory)
|
|
48
|
-
* @default "pwa-icons"
|
|
49
|
-
*/
|
|
50
|
-
dest?: string;
|
|
51
|
-
/**
|
|
52
|
-
* @title Icon sizes
|
|
53
|
-
* @default [36, 48, 72, 96, 144, 192, 512]
|
|
54
|
-
*/
|
|
55
|
-
sizes?: number[];
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export type PwaMetaOptions = {
|
|
59
|
-
/**
|
|
60
|
-
* @title "viewport" meta tag
|
|
61
|
-
*/
|
|
62
|
-
viewport?: string;
|
|
63
|
-
/**
|
|
64
|
-
* @title "theme-color" meta tag
|
|
65
|
-
*/
|
|
66
|
-
themeColor?: string;
|
|
67
|
-
/**
|
|
68
|
-
* @title "mobile-web-app-capable" meta tag
|
|
69
|
-
*/
|
|
70
|
-
mobileApp?: string;
|
|
71
|
-
/**
|
|
72
|
-
* @title "apple-mobile-web-app-capable" meta tag
|
|
73
|
-
*/
|
|
74
|
-
mobileAppIOS?: string;
|
|
75
|
-
/**
|
|
76
|
-
* @title "apple-mobile-web-app-title" meta tag
|
|
77
|
-
*/
|
|
78
|
-
appleTitle?: string;
|
|
79
|
-
/**
|
|
80
|
-
* @title "apple-mobile-web-app-status-bar-style" meta tag
|
|
81
|
-
*/
|
|
82
|
-
appleStatusBarStyle?: string;
|
|
83
|
-
};
|
package/src/utils/errors.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description By default, `Error` properties are not enumerable.
|
|
3
|
-
* So when you use `Object.keys()`, `JSON.stringify()`, or `postMessage()`,
|
|
4
|
-
* the `message`, `stack`, and `cause` properties are not included.
|
|
5
|
-
*/
|
|
6
|
-
export function enumerateErrorProperties(error: Error) {
|
|
7
|
-
Object.defineProperties(error, {
|
|
8
|
-
message: {
|
|
9
|
-
configurable: true,
|
|
10
|
-
enumerable: true,
|
|
11
|
-
writable: true,
|
|
12
|
-
},
|
|
13
|
-
stack: {
|
|
14
|
-
configurable: true,
|
|
15
|
-
enumerable: true,
|
|
16
|
-
// stack is getter
|
|
17
|
-
},
|
|
18
|
-
cause: {
|
|
19
|
-
configurable: true,
|
|
20
|
-
enumerable: true,
|
|
21
|
-
writable: true,
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
if ('cause' in error && typeof error.cause === 'object') {
|
|
26
|
-
Object.defineProperties(error.cause, {
|
|
27
|
-
message: {
|
|
28
|
-
configurable: true,
|
|
29
|
-
enumerable: true,
|
|
30
|
-
writable: true,
|
|
31
|
-
},
|
|
32
|
-
stack: {
|
|
33
|
-
configurable: true,
|
|
34
|
-
enumerable: true,
|
|
35
|
-
// stack is getter
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}
|