@tramvai/cli 5.50.0 → 5.53.78
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/__migrations__/d2023-02-01b-tramvai-config-refactoring.js +78 -80
- package/__migrations__/d2025-04-11b-tramvai-config-remove-modern.js +13 -0
- package/bin/spawn.js +69 -3
- package/lib/api/analyze/index.d.ts +0 -1
- package/lib/api/analyze/index.d.ts.map +1 -1
- package/lib/api/analyze/index.js +2 -2
- package/lib/api/analyze/index.js.map +1 -1
- package/lib/api/build/application.d.ts.map +1 -1
- package/lib/api/build/application.js +2 -5
- package/lib/api/build/application.js.map +1 -1
- package/lib/api/build/child-app.d.ts.map +1 -1
- package/lib/api/build/child-app.js +1 -5
- package/lib/api/build/child-app.js.map +1 -1
- package/lib/api/build/index.d.ts +0 -2
- package/lib/api/build/index.d.ts.map +1 -1
- package/lib/api/build/index.js.map +1 -1
- package/lib/api/build/module.d.ts.map +1 -1
- package/lib/api/build/module.js +1 -3
- package/lib/api/build/module.js.map +1 -1
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.js +0 -4
- package/lib/api/index.js.map +1 -1
- package/lib/api/start/index.d.ts +0 -1
- package/lib/api/start/index.d.ts.map +1 -1
- package/lib/api/start/index.js.map +1 -1
- package/lib/api/start/utils/banner.d.ts.map +1 -1
- package/lib/api/start/utils/banner.js +0 -1
- package/lib/api/start/utils/banner.js.map +1 -1
- package/lib/api/start/utils/tips/tips.d.ts.map +1 -1
- package/lib/api/start/utils/tips/tips.js +0 -8
- package/lib/api/start/utils/tips/tips.js.map +1 -1
- package/lib/builder/webpack/devServer/pool/process/pool.d.ts.map +1 -1
- package/lib/builder/webpack/devServer/pool/process/pool.js +0 -2
- package/lib/builder/webpack/devServer/pool/process/pool.js.map +1 -1
- package/lib/builder/webpack/devServer/server.d.ts.map +1 -1
- package/lib/builder/webpack/devServer/server.js +4 -0
- package/lib/builder/webpack/devServer/server.js.map +1 -1
- package/lib/builder/webpack/index.d.ts.map +1 -1
- package/lib/builder/webpack/index.js +3 -5
- package/lib/builder/webpack/index.js.map +1 -1
- package/lib/builder/webpack/providers/build/client.d.ts.map +1 -1
- package/lib/builder/webpack/providers/build/client.js +0 -1
- package/lib/builder/webpack/providers/build/client.js.map +1 -1
- package/lib/builder/webpack/providers/build/clientShared.d.ts.map +1 -1
- package/lib/builder/webpack/providers/build/clientShared.js +4 -6
- package/lib/builder/webpack/providers/build/clientShared.js.map +1 -1
- package/lib/builder/webpack/providers/client.d.ts.map +1 -1
- package/lib/builder/webpack/providers/client.js +0 -13
- package/lib/builder/webpack/providers/client.js.map +1 -1
- package/lib/builder/webpack/providers/shared.d.ts.map +1 -1
- package/lib/builder/webpack/providers/shared.js +2 -8
- package/lib/builder/webpack/providers/shared.js.map +1 -1
- package/lib/builder/webpack/tokens.d.ts +4 -139
- package/lib/builder/webpack/tokens.d.ts.map +1 -1
- package/lib/builder/webpack/tokens.js +1 -4
- package/lib/builder/webpack/tokens.js.map +1 -1
- package/lib/builder/webpack/utils/copyStatsJsonFile.d.ts.map +1 -1
- package/lib/builder/webpack/utils/copyStatsJsonFile.js +0 -11
- package/lib/builder/webpack/utils/copyStatsJsonFile.js.map +1 -1
- package/lib/cli/CLI.d.ts +2 -2
- package/lib/cli/CLI.d.ts.map +1 -1
- package/lib/cli/CLI.js +2 -2
- package/lib/cli/CLI.js.map +1 -1
- package/lib/cli/index.d.ts.map +1 -1
- package/lib/cli/index.js +28 -7
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/runCLI.d.ts +3 -0
- package/lib/cli/runCLI.d.ts.map +1 -1
- package/lib/cli/runCLI.js +18 -6
- package/lib/cli/runCLI.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 +41 -13
- package/lib/commands/build/command.js.map +1 -1
- package/lib/commands/createApp.d.ts.map +1 -1
- package/lib/commands/createApp.js +0 -1
- package/lib/commands/createApp.js.map +1 -1
- package/lib/commands/new/new.d.ts.map +1 -1
- package/lib/commands/new/new.js +28 -3
- package/lib/commands/new/new.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 +39 -7
- package/lib/commands/start/command.js.map +1 -1
- package/lib/commands/start/start.d.ts +1 -1
- package/lib/commands/start/start.d.ts.map +1 -1
- package/lib/commands/start/start.js +2 -1
- package/lib/commands/start/start.js.map +1 -1
- package/lib/commands/static/application.d.ts.map +1 -1
- package/lib/commands/static/application.js +0 -1
- package/lib/commands/static/application.js.map +1 -1
- package/lib/commands/update/command.d.ts +6 -1
- package/lib/commands/update/command.d.ts.map +1 -1
- package/lib/commands/update/command.js +8 -1
- package/lib/commands/update/command.js.map +1 -1
- package/lib/commands/update/dependantLibs.d.ts +2 -1
- package/lib/commands/update/dependantLibs.d.ts.map +1 -1
- package/lib/commands/update/dependantLibs.js +17 -4
- package/lib/commands/update/dependantLibs.js.map +1 -1
- package/lib/commands/update/update.d.ts +2 -1
- package/lib/commands/update/update.d.ts.map +1 -1
- package/lib/commands/update/update.js +6 -6
- package/lib/commands/update/update.js.map +1 -1
- package/lib/commands/update/updatePackageJson.d.ts +1 -1
- package/lib/commands/update/updatePackageJson.d.ts.map +1 -1
- package/lib/commands/update/updatePackageJson.js +10 -14
- package/lib/commands/update/updatePackageJson.js.map +1 -1
- package/lib/config/configManager.d.ts +0 -1
- package/lib/config/configManager.d.ts.map +1 -1
- package/lib/config/configManager.js +2 -17
- package/lib/config/configManager.js.map +1 -1
- package/lib/config/validate.d.ts.map +1 -1
- package/lib/config/validate.js +8 -1
- package/lib/config/validate.js.map +1 -1
- package/lib/di/providers/index.d.ts +0 -1
- package/lib/di/providers/index.d.ts.map +1 -1
- package/lib/di/providers/index.js +0 -1
- package/lib/di/providers/index.js.map +1 -1
- package/lib/di/tokens/config.d.ts +2 -0
- package/lib/di/tokens/config.d.ts.map +1 -1
- package/lib/di/tokens/index.d.ts +0 -1
- package/lib/di/tokens/index.d.ts.map +1 -1
- package/lib/di/tokens/index.js +0 -1
- package/lib/di/tokens/index.js.map +1 -1
- package/lib/library/babel/index.d.ts +0 -44
- package/lib/library/babel/index.d.ts.map +1 -1
- package/lib/library/babel/index.js +6 -13
- package/lib/library/babel/index.js.map +1 -1
- package/lib/library/swc/index.js +1 -1
- package/lib/library/swc/index.js.map +1 -1
- package/lib/library/typescript/index.d.ts +0 -23
- package/lib/library/typescript/index.d.ts.map +1 -1
- package/lib/library/typescript/index.js +1 -2
- package/lib/library/typescript/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 +40 -6
- package/lib/library/webpack/application/client/common.js.map +1 -1
- package/lib/library/webpack/application/client/dev.js +2 -2
- package/lib/library/webpack/application/client/dev.js.map +1 -1
- package/lib/library/webpack/application/client/prod.d.ts.map +1 -1
- package/lib/library/webpack/application/client/prod.js +1 -2
- package/lib/library/webpack/application/client/prod.js.map +1 -1
- package/lib/library/webpack/application/common.js +1 -1
- package/lib/library/webpack/application/common.js.map +1 -1
- package/lib/library/webpack/application/server/common.js +1 -1
- package/lib/library/webpack/application/server/common.js.map +1 -1
- package/lib/library/webpack/application/server/dev.js +1 -1
- package/lib/library/webpack/application/server/dev.js.map +1 -1
- package/lib/library/webpack/application/server/prod.js +1 -1
- package/lib/library/webpack/application/server/prod.js.map +1 -1
- package/lib/library/webpack/blocks/css.d.ts.map +1 -1
- package/lib/library/webpack/blocks/css.js +15 -11
- package/lib/library/webpack/blocks/css.js.map +1 -1
- package/lib/library/webpack/blocks/optimize.js +2 -2
- package/lib/library/webpack/blocks/optimize.js.map +1 -1
- package/lib/library/webpack/blocks/pwa/client.d.ts.map +1 -1
- package/lib/library/webpack/blocks/pwa/client.js +2 -5
- package/lib/library/webpack/blocks/pwa/client.js.map +1 -1
- package/lib/library/webpack/blocks/pwa/shared.d.ts.map +1 -1
- package/lib/library/webpack/blocks/pwa/shared.js +2 -3
- package/lib/library/webpack/blocks/pwa/shared.js.map +1 -1
- package/lib/library/webpack/blocks/resolve.js +2 -2
- package/lib/library/webpack/blocks/resolve.js.map +1 -1
- package/lib/library/webpack/blocks/serverInline.d.ts.map +1 -1
- package/lib/library/webpack/blocks/serverInline.js +1 -2
- package/lib/library/webpack/blocks/serverInline.js.map +1 -1
- package/lib/library/webpack/blocks/sourcemaps.d.ts +1 -1
- package/lib/library/webpack/blocks/sourcemaps.d.ts.map +1 -1
- package/lib/library/webpack/blocks/sourcemaps.js +4 -2
- package/lib/library/webpack/blocks/sourcemaps.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 +8 -3
- package/lib/library/webpack/child-app/client/common.js.map +1 -1
- package/lib/library/webpack/child-app/client/dev.d.ts.map +1 -1
- package/lib/library/webpack/child-app/client/dev.js +5 -1
- package/lib/library/webpack/child-app/client/dev.js.map +1 -1
- package/lib/library/webpack/child-app/client/prod.d.ts.map +1 -1
- package/lib/library/webpack/child-app/client/prod.js +4 -0
- package/lib/library/webpack/child-app/client/prod.js.map +1 -1
- package/lib/library/webpack/child-app/common.d.ts.map +1 -1
- package/lib/library/webpack/child-app/common.js +1 -5
- package/lib/library/webpack/child-app/common.js.map +1 -1
- package/lib/library/webpack/child-app/server/dev.d.ts.map +1 -1
- package/lib/library/webpack/child-app/server/dev.js +4 -0
- package/lib/library/webpack/child-app/server/dev.js.map +1 -1
- package/lib/library/webpack/child-app/server/prod.d.ts.map +1 -1
- package/lib/library/webpack/child-app/server/prod.js +4 -0
- package/lib/library/webpack/child-app/server/prod.js.map +1 -1
- package/lib/library/webpack/common/client/prod.js +1 -1
- package/lib/library/webpack/common/client/prod.js.map +1 -1
- package/lib/library/webpack/common/main.d.ts.map +1 -1
- package/lib/library/webpack/common/main.js +1 -2
- package/lib/library/webpack/common/main.js.map +1 -1
- package/lib/library/webpack/constants/stats.d.ts.map +1 -1
- package/lib/library/webpack/constants/stats.js +2 -0
- package/lib/library/webpack/constants/stats.js.map +1 -1
- package/lib/library/webpack/loaders/image-loader/getImageMiniatureURL.js +1 -1
- package/lib/library/webpack/loaders/image-loader/getImageMiniatureURL.js.map +1 -1
- package/lib/library/webpack/module/client/common.js +1 -1
- package/lib/library/webpack/module/client/common.js.map +1 -1
- package/lib/library/webpack/module/externals.js +1 -1
- package/lib/library/webpack/module/externals.js.map +1 -1
- package/lib/library/webpack/module/server/common.js +1 -1
- package/lib/library/webpack/module/server/common.js.map +1 -1
- package/lib/library/webpack/plugins/AssetsIntegritiesPlugin.d.ts +8 -0
- package/lib/library/webpack/plugins/AssetsIntegritiesPlugin.d.ts.map +1 -0
- package/lib/library/webpack/plugins/AssetsIntegritiesPlugin.js +29 -0
- package/lib/library/webpack/plugins/AssetsIntegritiesPlugin.js.map +1 -0
- package/lib/library/webpack/plugins/PurifyStatsPlugin.d.ts +15 -0
- package/lib/library/webpack/plugins/PurifyStatsPlugin.d.ts.map +1 -0
- package/lib/library/webpack/plugins/PurifyStatsPlugin.js +47 -0
- package/lib/library/webpack/plugins/PurifyStatsPlugin.js.map +1 -0
- package/lib/library/webpack/plugins/RuntimePathPlugin.d.ts.map +1 -1
- package/lib/library/webpack/plugins/RuntimePathPlugin.js +7 -3
- package/lib/library/webpack/plugins/RuntimePathPlugin.js.map +1 -1
- package/lib/library/webpack/utils/transpiler.d.ts +0 -1
- package/lib/library/webpack/utils/transpiler.d.ts.map +1 -1
- package/lib/library/webpack/utils/transpiler.js +1 -5
- package/lib/library/webpack/utils/transpiler.js.map +1 -1
- package/lib/models/analytics/analytics.d.ts +156 -0
- package/lib/models/analytics/analytics.d.ts.map +1 -0
- package/lib/models/analytics/analytics.js +259 -0
- package/lib/models/analytics/analytics.js.map +1 -0
- package/lib/models/analytics/analytics.worker.d.ts +5 -0
- package/lib/models/analytics/analytics.worker.d.ts.map +1 -0
- package/lib/models/analytics/analytics.worker.js +87 -0
- package/lib/models/analytics/analytics.worker.js.map +1 -0
- package/lib/models/analytics/utils.d.ts +15 -0
- package/lib/models/analytics/utils.d.ts.map +1 -0
- package/lib/models/analytics/utils.js +85 -0
- package/lib/models/analytics/utils.js.map +1 -0
- package/lib/models/command.d.ts.map +1 -1
- package/lib/models/command.js +1 -7
- package/lib/models/command.js.map +1 -1
- package/lib/models/context.d.ts +4 -4
- package/lib/models/context.d.ts.map +1 -1
- package/lib/models/context.js +3 -2
- package/lib/models/context.js.map +1 -1
- package/lib/models/logger.d.ts +1 -0
- package/lib/models/logger.d.ts.map +1 -1
- package/lib/models/logger.js +2 -1
- package/lib/models/logger.js.map +1 -1
- package/lib/models/task.d.ts.map +1 -1
- package/lib/models/task.js +1 -7
- package/lib/models/task.js.map +1 -1
- package/lib/schema/autogeneratedSchema.json +161 -20
- package/lib/schema/topLevelSchema.d.ts +14 -0
- package/lib/schema/topLevelSchema.d.ts.map +1 -1
- package/lib/schema/topLevelSchema.js +14 -0
- package/lib/schema/topLevelSchema.js.map +1 -1
- package/lib/typings/build/Builder.d.ts +2 -6
- package/lib/typings/build/Builder.d.ts.map +1 -1
- package/lib/typings/configEntry/application.d.ts +10 -5
- package/lib/typings/configEntry/application.d.ts.map +1 -1
- package/lib/typings/configEntry/cli.d.ts +13 -0
- package/lib/typings/configEntry/cli.d.ts.map +1 -1
- package/lib/typings/projectType.d.ts +5 -0
- package/lib/typings/projectType.d.ts.map +1 -1
- package/lib/typings/target.d.ts +1 -1
- package/lib/typings/target.d.ts.map +1 -1
- package/lib/utils/commands/dependencies/findTramvaiVersion.d.ts +1 -1
- package/lib/utils/commands/dependencies/findTramvaiVersion.d.ts.map +1 -1
- package/lib/utils/commands/dependencies/findTramvaiVersion.js +4 -11
- package/lib/utils/commands/dependencies/findTramvaiVersion.js.map +1 -1
- package/lib/utils/commands/dependencies/getLatestPackageVersion.d.ts +1 -1
- package/lib/utils/commands/dependencies/getLatestPackageVersion.d.ts.map +1 -1
- package/lib/utils/commands/dependencies/getLatestPackageVersion.js +7 -3
- package/lib/utils/commands/dependencies/getLatestPackageVersion.js.map +1 -1
- package/lib/utils/cpu-profile.d.ts +3 -0
- package/lib/utils/cpu-profile.d.ts.map +1 -1
- package/lib/utils/cpu-profile.js +8 -3
- package/lib/utils/cpu-profile.js.map +1 -1
- package/lib/utils/errors.d.ts +7 -0
- package/lib/utils/errors.d.ts.map +1 -0
- package/lib/utils/errors.js +43 -0
- package/lib/utils/errors.js.map +1 -0
- package/lib/utils/memoryUsage.d.ts +20 -0
- package/lib/utils/memoryUsage.d.ts.map +1 -0
- package/lib/utils/memoryUsage.js +51 -0
- package/lib/utils/memoryUsage.js.map +1 -0
- package/lib/utils/safeRequire.d.ts +1 -1
- package/lib/utils/safeRequire.d.ts.map +1 -1
- package/lib/utils/safeRequire.js +13 -3
- package/lib/utils/safeRequire.js.map +1 -1
- package/package.json +13 -15
- package/schema.json +175 -20
- package/src/api/analyze/index.ts +2 -3
- package/src/api/benchmark/__integration__/__fixtures__/tramvai.json +3 -0
- package/src/api/build/__integration__/__fixtures__/tramvai.json +4 -2
- package/src/api/build/__integration__/build.test.ts +0 -1
- package/src/api/build/application.ts +2 -5
- package/src/api/build/child-app.ts +1 -5
- package/src/api/build/index.ts +0 -2
- package/src/api/build/module.ts +1 -3
- package/src/api/index.ts +1 -10
- package/src/api/start/__integration__/__fixtures__/app/server.tsx +1 -0
- package/src/api/start/__integration__/__fixtures__/package.json +0 -3
- package/src/api/start/__integration__/__fixtures__/tramvai.json +3 -0
- package/src/api/start/__integration__/start.test.ts +2 -1
- package/src/api/start/index.ts +0 -1
- package/src/api/start/utils/banner.ts +0 -1
- package/src/api/start/utils/tips/tips.ts +0 -9
- package/src/builder/webpack/devServer/pool/process/pool.ts +0 -2
- package/src/builder/webpack/devServer/server.ts +5 -0
- package/src/builder/webpack/index.ts +3 -5
- package/src/builder/webpack/providers/build/client.ts +0 -1
- package/src/builder/webpack/providers/build/clientShared.ts +5 -11
- package/src/builder/webpack/providers/client.ts +1 -19
- package/src/builder/webpack/providers/shared.ts +2 -9
- package/src/builder/webpack/tokens.ts +0 -9
- package/src/builder/webpack/utils/copyStatsJsonFile.ts +0 -17
- package/src/cli/CLI.ts +6 -4
- package/src/cli/index.ts +33 -8
- package/src/cli/runCLI.ts +26 -5
- package/src/commands/build/command.ts +45 -13
- package/src/commands/createApp.ts +0 -2
- package/src/commands/new/new.ts +39 -7
- package/src/commands/new/templates/packageManagerConfig/yarnPackageManagerConfig/_yarnrc.yml.hbs +9 -0
- package/src/commands/new/templates/shared/_gitignore.hbs +10 -0
- package/src/commands/new/templates/shared/package.json.hbs +5 -1
- package/src/commands/start/command.ts +42 -7
- package/src/commands/start/start.ts +7 -1
- package/src/commands/static/application.ts +0 -1
- package/src/commands/update/command.ts +9 -1
- package/src/commands/update/dependantLibs.ts +23 -8
- package/src/commands/update/update.ts +7 -6
- package/src/commands/update/updatePackageJson.spec.ts +66 -3
- package/src/commands/update/updatePackageJson.ts +28 -16
- package/src/config/__integration__/__fixtures__/relative/src/index.ts +0 -0
- package/src/config/__integration__/__fixtures__/relative/src/polyfill.ts +0 -0
- package/src/config/__integration__/validate.test.ts +94 -0
- package/src/config/configManager.ts +2 -19
- package/src/config/validate.ts +8 -1
- package/src/di/providers/index.ts +0 -1
- package/src/di/tokens/index.ts +0 -1
- package/src/library/babel/index.ts +8 -14
- package/src/library/babel/plugins/__snapshots__/create-token-pure.spec.ts.snap +6 -6
- package/src/library/babel/plugins/__snapshots__/fill-declare-action-name.spec.ts.snap +24 -26
- package/src/library/babel/plugins/__snapshots__/provider-stack.spec.ts.snap +40 -59
- package/src/library/babel/plugins/lazy-component/lazy-component.spec.ts +0 -1
- package/src/library/babel/plugins/lazy-component/legacy-universal-replace.spec.ts +0 -1
- package/src/library/swc/__integration__/__snapshots__/swc.build.test.ts.snap +15 -208
- package/src/library/swc/__integration__/__snapshots__/swc.start.test.ts.snap +7 -10
- package/src/library/swc/__integration__/swc.build.test.ts +1 -13
- package/src/library/swc/__integration__/swc.start.test.ts +3 -0
- package/src/library/swc/index.ts +1 -1
- package/src/library/typescript/index.ts +1 -3
- package/src/library/webpack/application/client/common.ts +63 -6
- package/src/library/webpack/application/client/dev.ts +2 -2
- package/src/library/webpack/application/client/prod.ts +1 -2
- package/src/library/webpack/application/common.ts +1 -1
- package/src/library/webpack/application/server/common.ts +1 -1
- package/src/library/webpack/application/server/dev.ts +1 -1
- package/src/library/webpack/application/server/prod.ts +1 -1
- package/src/library/webpack/blocks/css.ts +17 -11
- package/src/library/webpack/blocks/optimize.ts +2 -2
- package/src/library/webpack/blocks/pwa/client.ts +1 -6
- package/src/library/webpack/blocks/pwa/shared.ts +1 -3
- package/src/library/webpack/blocks/resolve.ts +2 -2
- package/src/library/webpack/blocks/serverInline.ts +1 -2
- package/src/library/webpack/blocks/sourcemaps.ts +4 -2
- package/src/library/webpack/child-app/client/common.ts +9 -3
- package/src/library/webpack/child-app/client/dev.ts +6 -1
- package/src/library/webpack/child-app/client/prod.ts +5 -0
- package/src/library/webpack/child-app/common.ts +1 -7
- package/src/library/webpack/child-app/server/dev.ts +5 -0
- package/src/library/webpack/child-app/server/prod.ts +5 -0
- package/src/library/webpack/common/client/prod.ts +1 -1
- package/src/library/webpack/common/main.ts +1 -5
- package/src/library/webpack/constants/stats.ts +2 -0
- package/src/library/webpack/loaders/image-loader/getImageMiniatureURL.ts +1 -1
- package/src/library/webpack/module/client/common.ts +1 -1
- package/src/library/webpack/module/externals.ts +1 -1
- package/src/library/webpack/module/server/common.ts +1 -1
- package/src/library/webpack/plugins/AssetsIntegritiesPlugin.ts +34 -0
- package/src/library/webpack/plugins/PurifyStatsPlugin.ts +57 -0
- package/src/library/webpack/plugins/RuntimePathPlugin.ts +8 -3
- package/src/library/webpack/utils/polyfills/__integration__/__snapshots__/condition.test.ts.snap +16 -16
- package/src/library/webpack/utils/transpiler.ts +1 -5
- package/src/models/analytics/analytics.ts +488 -0
- package/src/models/analytics/analytics.worker.ts +102 -0
- package/src/models/analytics/utils.ts +122 -0
- package/src/models/command.ts +1 -8
- package/src/models/config.spec.ts +6 -2
- package/src/models/context.ts +4 -5
- package/src/models/logger.ts +2 -0
- package/src/models/task.ts +1 -7
- package/src/schema/autogeneratedSchema.json +161 -20
- package/src/schema/topLevelSchema.js +14 -0
- package/src/schema/tramvai.spec.ts +3 -1
- package/src/typings/build/Builder.ts +3 -8
- package/src/typings/configEntry/application.ts +11 -6
- package/src/typings/configEntry/cli.ts +14 -0
- package/src/typings/projectType.ts +5 -0
- package/src/typings/target.ts +1 -1
- package/src/utils/commands/dependencies/findTramvaiVersion.ts +5 -12
- package/src/utils/commands/dependencies/getLatestPackageVersion.ts +11 -3
- package/src/utils/cpu-profile.ts +14 -3
- package/src/utils/errors.ts +39 -0
- package/src/utils/memoryUsage.ts +58 -0
- package/src/utils/safeRequire.spec.ts +36 -0
- package/src/utils/safeRequire.ts +12 -3
- package/lib/builder/webpack/providers/build/clientModern.d.ts +0 -3
- package/lib/builder/webpack/providers/build/clientModern.d.ts.map +0 -1
- package/lib/builder/webpack/providers/build/clientModern.js +0 -60
- package/lib/builder/webpack/providers/build/clientModern.js.map +0 -1
- package/lib/di/providers/analytics.d.ts +0 -3
- package/lib/di/providers/analytics.d.ts.map +0 -1
- package/lib/di/providers/analytics.js +0 -20
- package/lib/di/providers/analytics.js.map +0 -1
- package/lib/di/tokens/analytics.d.ts +0 -14
- package/lib/di/tokens/analytics.d.ts.map +0 -1
- package/lib/di/tokens/analytics.js +0 -8
- package/lib/di/tokens/analytics.js.map +0 -1
- package/lib/models/analytics.d.ts +0 -31
- package/lib/models/analytics.d.ts.map +0 -1
- package/lib/models/analytics.js +0 -79
- package/lib/models/analytics.js.map +0 -1
- package/src/builder/webpack/providers/build/clientModern.ts +0 -64
- package/src/di/providers/analytics.ts +0 -22
- package/src/di/tokens/analytics.ts +0 -8
- package/src/models/analytics.ts +0 -116
- /package/src/commands/new/templates/{shared → packageManagerConfig/defaultPackageManagerConfig}/_npmrc.hbs +0 -0
|
@@ -6,7 +6,7 @@ import type { ConfigManager } from '../../../config/configManager';
|
|
|
6
6
|
import type { CliConfigEntry } from '../../../typings/configEntry/cli';
|
|
7
7
|
|
|
8
8
|
export default (configManager: ConfigManager<CliConfigEntry>) => (config: Config) => {
|
|
9
|
-
const {
|
|
9
|
+
const { debug, disableProdOptimization } = configManager;
|
|
10
10
|
|
|
11
11
|
const isProductionProfilingEnabled = !!process.env.TRAMVAI_REACT_PROFILE;
|
|
12
12
|
const tramvaiReactProfileTerserOptions = {
|
|
@@ -60,7 +60,7 @@ export default (configManager: ConfigManager<CliConfigEntry>) => (config: Config
|
|
|
60
60
|
parallel: terser.parallel,
|
|
61
61
|
terserOptions: {
|
|
62
62
|
...tramvaiReactProfileTerserOptions,
|
|
63
|
-
ecma:
|
|
63
|
+
ecma: 6,
|
|
64
64
|
mangle: {
|
|
65
65
|
// https://github.com/node-fetch/node-fetch/issues/667
|
|
66
66
|
// иначе AbortSignal минифицируется и на сервере падает ошибка в node-fetch
|
|
@@ -18,7 +18,6 @@ export const pwaBlock =
|
|
|
18
18
|
root,
|
|
19
19
|
output,
|
|
20
20
|
env,
|
|
21
|
-
modern,
|
|
22
21
|
sourceMap,
|
|
23
22
|
assetsPrefix,
|
|
24
23
|
} = configManager;
|
|
@@ -26,7 +25,7 @@ export const pwaBlock =
|
|
|
26
25
|
config.batch(pwaSharedBlock(configManager));
|
|
27
26
|
|
|
28
27
|
if (
|
|
29
|
-
!safeRequireResolve('@tramvai/module-progressive-web-app', true) &&
|
|
28
|
+
!safeRequireResolve('@tramvai/module-progressive-web-app', rootDir, true) &&
|
|
30
29
|
(pwa.workbox?.enabled || pwa.webmanifest?.enabled)
|
|
31
30
|
) {
|
|
32
31
|
throw Error('PWA functional requires @tramvai/module-progressive-web-app installed');
|
|
@@ -101,10 +100,6 @@ export const pwaBlock =
|
|
|
101
100
|
};
|
|
102
101
|
}
|
|
103
102
|
|
|
104
|
-
if (modern) {
|
|
105
|
-
workboxOptions.swDest = workboxOptions.swDest.replace(/\.js$/, '.modern.js');
|
|
106
|
-
}
|
|
107
|
-
|
|
108
103
|
// @todo: break hmr on client when sw.ts is changed - infinity loop !!!
|
|
109
104
|
|
|
110
105
|
const workboxPlugin = new InjectManifest(workboxOptions);
|
|
@@ -9,7 +9,6 @@ export const pwaSharedBlock =
|
|
|
9
9
|
experiments: { pwa },
|
|
10
10
|
rootDir,
|
|
11
11
|
root,
|
|
12
|
-
modern,
|
|
13
12
|
} = configManager;
|
|
14
13
|
|
|
15
14
|
config.plugin('define').tap((args) => [
|
|
@@ -22,9 +21,8 @@ export const pwaSharedBlock =
|
|
|
22
21
|
'process.env.TRAMVAI_PWA_SW_SCOPE': JSON.stringify(pwa.sw?.scope),
|
|
23
22
|
'process.env.TRAMVAI_PWA_MANIFEST_ENABLED': JSON.stringify(pwa.webmanifest?.enabled),
|
|
24
23
|
'process.env.TRAMVAI_PWA_MANIFEST_DEST': JSON.stringify(pwa.webmanifest?.dest),
|
|
24
|
+
'process.env.TRAMVAI_PWA_MANIFEST_SCOPE': JSON.stringify(pwa.webmanifest?.scope),
|
|
25
25
|
'process.env.TRAMVAI_PWA_META': `'${JSON.stringify(pwa?.meta ?? {})}'`,
|
|
26
|
-
// allows to detect that sw.modern.js is exists or not
|
|
27
|
-
'process.env.TRAMVAI_MODERN_BUILD': JSON.stringify(modern),
|
|
28
26
|
},
|
|
29
27
|
]);
|
|
30
28
|
};
|
|
@@ -6,11 +6,11 @@ import type { ConfigManager } from '../../../config/configManager';
|
|
|
6
6
|
import { extensions } from '../../../config/constants';
|
|
7
7
|
|
|
8
8
|
export default (configManager: ConfigManager) => (config: Config) => {
|
|
9
|
-
const { rootDir, root,
|
|
9
|
+
const { rootDir, root, buildType } = configManager;
|
|
10
10
|
|
|
11
11
|
config.resolve.mainFields.merge(
|
|
12
12
|
[
|
|
13
|
-
...(
|
|
13
|
+
...(buildType === 'client' ? ['es2017', 'es2016', 'es2015'] : []),
|
|
14
14
|
buildType === 'client' && 'browser',
|
|
15
15
|
'module',
|
|
16
16
|
'main',
|
|
@@ -4,8 +4,7 @@ import type { CliConfigEntry } from '../../../typings/configEntry/cli';
|
|
|
4
4
|
import { addTranspilerLoader, getTranspilerConfig } from '../utils/transpiler';
|
|
5
5
|
|
|
6
6
|
export const serverInline = (configManager: ConfigManager<CliConfigEntry>) => (config: Config) => {
|
|
7
|
-
|
|
8
|
-
const clientConfigManager = configManager.withSettings({ buildType: 'client', modern: false });
|
|
7
|
+
const clientConfigManager = configManager.withSettings({ buildType: 'client' });
|
|
9
8
|
|
|
10
9
|
const addInlineHandler = (type: string) => {
|
|
11
10
|
config.module
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type Config from 'webpack-chain';
|
|
2
2
|
import type { ConfigManager } from '../../../config/configManager';
|
|
3
3
|
|
|
4
|
-
export default (configManager: ConfigManager) => (config: Config) => {
|
|
4
|
+
export default (configManager: ConfigManager, target: 'client' | 'server') => (config: Config) => {
|
|
5
5
|
if (configManager.debug || configManager.env === 'development') {
|
|
6
6
|
config.module
|
|
7
7
|
.rule('source-map-loader')
|
|
@@ -10,7 +10,9 @@ export default (configManager: ConfigManager) => (config: Config) => {
|
|
|
10
10
|
.use('source-map')
|
|
11
11
|
.loader('source-map-loader');
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
// Chrome devtools does not support source maps with remote debug nodejs
|
|
14
|
+
// PR with fix: https://github.com/nodejs/node/pull/58077
|
|
15
|
+
config.devtool(target === 'server' ? 'inline-source-map' : 'source-map');
|
|
14
16
|
} else {
|
|
15
17
|
config.devtool('hidden-source-map');
|
|
16
18
|
}
|
|
@@ -9,6 +9,7 @@ import files from '../../blocks/filesClient';
|
|
|
9
9
|
import nodeClient from '../../blocks/nodeClient';
|
|
10
10
|
import postcssAssets from '../../blocks/postcssAssets';
|
|
11
11
|
import type { ChildAppConfigEntry } from '../../../../typings/configEntry/child-app';
|
|
12
|
+
import { purifyStatsPluginFactory } from '../../plugins/PurifyStatsPlugin';
|
|
12
13
|
|
|
13
14
|
const IDENTIFIER_NAME_REPLACE_REGEX = /^([^a-zA-Z$_])/;
|
|
14
15
|
const IDENTIFIER_ALPHA_NUMERIC_NAME_REPLACE_REGEX = /[^a-zA-Z0-9$]+/g;
|
|
@@ -26,7 +27,7 @@ export default (configManager: ConfigManager<ChildAppConfigEntry>) => (config: C
|
|
|
26
27
|
|
|
27
28
|
config.batch(common(configManager));
|
|
28
29
|
|
|
29
|
-
config.target(['web'
|
|
30
|
+
config.target(['web']);
|
|
30
31
|
|
|
31
32
|
config.output
|
|
32
33
|
.path(configManager.buildPath)
|
|
@@ -44,14 +45,19 @@ export default (configManager: ConfigManager<ChildAppConfigEntry>) => (config: C
|
|
|
44
45
|
},
|
|
45
46
|
]);
|
|
46
47
|
|
|
48
|
+
const statsFileName = `${name}_stats_loadable@${version}.json`;
|
|
47
49
|
config.plugin('loadable-stats-plugin').use(LoadablePlugin, [
|
|
48
50
|
{
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
filename: statsFileName,
|
|
52
|
+
outputAsset: true,
|
|
51
53
|
// to prevent webpack modules with same id collision, because Child Apps builds are independent of each other
|
|
52
54
|
chunkLoadingGlobal: toIdentifier(`__LOADABLE_LOADED_CHUNKS__child_app_${name}_${version}__`),
|
|
53
55
|
},
|
|
54
56
|
]);
|
|
55
57
|
|
|
58
|
+
config
|
|
59
|
+
.plugin('assets-purify-plugin')
|
|
60
|
+
.use(purifyStatsPluginFactory('child-app'), [{ fileName: statsFileName }]);
|
|
61
|
+
|
|
56
62
|
config.batch(files(configManager)).batch(nodeClient(configManager));
|
|
57
63
|
};
|
|
@@ -9,6 +9,7 @@ import type { UI_SHOW_PROGRESS_TOKEN } from '../../../../di/tokens';
|
|
|
9
9
|
import { extendEntry } from '../../utils/extendEntry';
|
|
10
10
|
import type { ChildAppConfigEntry } from '../../../../typings/configEntry/child-app';
|
|
11
11
|
import FancyReporter from '../../plugins/WebpackBar/reporters/fancy';
|
|
12
|
+
import sourcemaps from '../../blocks/sourcemaps';
|
|
12
13
|
|
|
13
14
|
export const webpackClientConfig = ({
|
|
14
15
|
configManager,
|
|
@@ -25,6 +26,10 @@ export const webpackClientConfig = ({
|
|
|
25
26
|
config.mode('development');
|
|
26
27
|
config.devtool(configManager.webpack.devtool ?? false);
|
|
27
28
|
|
|
29
|
+
if (configManager.sourceMap) {
|
|
30
|
+
config.batch(sourcemaps(configManager, 'client'));
|
|
31
|
+
}
|
|
32
|
+
|
|
28
33
|
if (showProgress) {
|
|
29
34
|
config.plugin('progress').use(WebpackBar, [
|
|
30
35
|
{
|
|
@@ -59,7 +64,7 @@ export const webpackClientConfig = ({
|
|
|
59
64
|
|
|
60
65
|
extendEntry(config.entry(configManager.name), {
|
|
61
66
|
import: [
|
|
62
|
-
'webpack-hot-middleware/client?name=client&dynamicPublicPath=true&path=__webpack_hmr',
|
|
67
|
+
'webpack-hot-middleware/client?name=client&dynamicPublicPath=true&path=__webpack_hmr&reload=true',
|
|
63
68
|
],
|
|
64
69
|
});
|
|
65
70
|
}
|
|
@@ -4,6 +4,7 @@ import common from './common';
|
|
|
4
4
|
import optimize from '../../blocks/optimize';
|
|
5
5
|
import commonProd from '../../common/client/prod';
|
|
6
6
|
import type { ChildAppConfigEntry } from '../../../../typings/configEntry/child-app';
|
|
7
|
+
import sourcemaps from '../../blocks/sourcemaps';
|
|
7
8
|
|
|
8
9
|
export const webpackClientConfig = ({
|
|
9
10
|
configManager,
|
|
@@ -15,6 +16,10 @@ export const webpackClientConfig = ({
|
|
|
15
16
|
config.batch(common(configManager));
|
|
16
17
|
config.batch(commonProd(configManager));
|
|
17
18
|
|
|
19
|
+
if (configManager.sourceMap) {
|
|
20
|
+
config.batch(sourcemaps(configManager, 'client'));
|
|
21
|
+
}
|
|
22
|
+
|
|
18
23
|
config.batch(optimize(configManager));
|
|
19
24
|
|
|
20
25
|
return config;
|
|
@@ -14,7 +14,6 @@ import nodeClient from '../blocks/nodeClient';
|
|
|
14
14
|
import type { SplitChunksOptions, UniversalFederationPluginOptions } from '../types/webpack';
|
|
15
15
|
import { getSharedModules } from './moduleFederationShared';
|
|
16
16
|
import { configToEnv } from '../blocks/configToEnv';
|
|
17
|
-
import sourcemaps from '../blocks/sourcemaps';
|
|
18
17
|
import type { ChildAppConfigEntry } from '../../../typings/configEntry/child-app';
|
|
19
18
|
import { extractCssPluginFactory } from '../blocks/extractCssPlugin';
|
|
20
19
|
import type { ModuleFederationFixRangeOptions } from '../plugins/ModuleFederationFixRange';
|
|
@@ -24,8 +23,7 @@ import { PatchAutoPublicPathPlugin } from '../plugins/AutoPublicPathPlugin';
|
|
|
24
23
|
|
|
25
24
|
// eslint-disable-next-line max-statements
|
|
26
25
|
export default (configManager: ConfigManager<ChildAppConfigEntry>) => (config: Config) => {
|
|
27
|
-
const { name, root, rootDir,
|
|
28
|
-
configManager;
|
|
26
|
+
const { name, root, rootDir, buildType, shared, env, target } = configManager;
|
|
29
27
|
|
|
30
28
|
const cssLocalIdentName =
|
|
31
29
|
configManager.env === 'production'
|
|
@@ -54,10 +52,6 @@ export default (configManager: ConfigManager<ChildAppConfigEntry>) => (config: C
|
|
|
54
52
|
})
|
|
55
53
|
);
|
|
56
54
|
|
|
57
|
-
if (sourceMap) {
|
|
58
|
-
config.batch(sourcemaps(configManager));
|
|
59
|
-
}
|
|
60
|
-
|
|
61
55
|
config.batch(
|
|
62
56
|
extractCssPluginFactory(configManager, {
|
|
63
57
|
filename: `[name]@${configManager.version}.css`,
|
|
@@ -6,6 +6,7 @@ import commonDev from '../../common/dev';
|
|
|
6
6
|
import type { UI_SHOW_PROGRESS_TOKEN } from '../../../../di/tokens';
|
|
7
7
|
import type { ChildAppConfigEntry } from '../../../../typings/configEntry/child-app';
|
|
8
8
|
import FancyReporter from '../../plugins/WebpackBar/reporters/fancy';
|
|
9
|
+
import sourcemaps from '../../blocks/sourcemaps';
|
|
9
10
|
|
|
10
11
|
export const webpackServerConfig = ({
|
|
11
12
|
configManager,
|
|
@@ -22,6 +23,10 @@ export const webpackServerConfig = ({
|
|
|
22
23
|
config.mode('development');
|
|
23
24
|
config.devtool(configManager.webpack.devtool ?? false);
|
|
24
25
|
|
|
26
|
+
if (configManager.sourceMap) {
|
|
27
|
+
config.batch(sourcemaps(configManager, 'server'));
|
|
28
|
+
}
|
|
29
|
+
|
|
25
30
|
if (showProgress) {
|
|
26
31
|
config.plugin('progress').use(WebpackBar, [
|
|
27
32
|
{
|
|
@@ -4,6 +4,7 @@ import common from './common';
|
|
|
4
4
|
import optimize from '../../blocks/optimize';
|
|
5
5
|
import commonProd from '../../common/server/prod';
|
|
6
6
|
import type { ChildAppConfigEntry } from '../../../../typings/configEntry/child-app';
|
|
7
|
+
import sourcemaps from '../../blocks/sourcemaps';
|
|
7
8
|
|
|
8
9
|
export const webpackServerConfig = ({
|
|
9
10
|
configManager,
|
|
@@ -17,5 +18,9 @@ export const webpackServerConfig = ({
|
|
|
17
18
|
|
|
18
19
|
config.batch(optimize(configManager));
|
|
19
20
|
|
|
21
|
+
if (configManager.sourceMap) {
|
|
22
|
+
config.batch(sourcemaps(configManager, 'server'));
|
|
23
|
+
}
|
|
24
|
+
|
|
20
25
|
return config;
|
|
21
26
|
};
|
|
@@ -19,7 +19,6 @@ const filterNonExisted = (filePaths: string[]) => {
|
|
|
19
19
|
|
|
20
20
|
const getConfigCacheNameAdditionalFlags = (configManager: ConfigManager<CliConfigEntry>) => {
|
|
21
21
|
return [
|
|
22
|
-
configManager.buildType === 'client' && configManager.modern ? 'modern' : '',
|
|
23
22
|
configManager.debug ? 'debug' : '',
|
|
24
23
|
process.env.TRAMVAI_REACT_PROFILE ? 'tramvai_react_profile' : '',
|
|
25
24
|
configManager.resolveSymlinks ? '' : 'preserve_symlinks',
|
|
@@ -88,10 +87,7 @@ export default (configManager: ConfigManager<CliConfigEntry>) => (config: Config
|
|
|
88
87
|
// It may be missing in cases when cli is running programmaticaly
|
|
89
88
|
config: filterNonExisted([path.resolve(configManager.rootDir, 'tramvai.json')]),
|
|
90
89
|
css: filterNonExisted([
|
|
91
|
-
safeRequireResolve(
|
|
92
|
-
path.resolve(configManager.rootDir, getPostcssConfigPath(configManager)),
|
|
93
|
-
true
|
|
94
|
-
),
|
|
90
|
+
safeRequireResolve(getPostcssConfigPath(configManager), configManager.rootDir, true),
|
|
95
91
|
]),
|
|
96
92
|
},
|
|
97
93
|
// https://github.com/vercel/next.js/commit/ff5338ce03a3240a97a5c84f5ad5c31c0f53a6ce
|
|
@@ -5,6 +5,7 @@ export const DEFAULT_STATS_OPTIONS: StatsOptions = {
|
|
|
5
5
|
|
|
6
6
|
publicPath: true,
|
|
7
7
|
assets: true,
|
|
8
|
+
cachedAssets: true,
|
|
8
9
|
outputPath: true, // выводит информацию о том в какой папке хранится билд на диске
|
|
9
10
|
chunkGroups: true, // позволяет получить в stats поле namedChunkGroups которое потом используется в webpack-flush-chunks для получения чанков-зависимостей
|
|
10
11
|
ids: true, // необходимо чтобы в chunksGroups были выставлены связи между модулями
|
|
@@ -14,6 +15,7 @@ export const DEFAULT_STATS_OPTIONS: StatsOptions = {
|
|
|
14
15
|
export const DEFAULT_STATS_FIELDS: string[] = [
|
|
15
16
|
'publicPath',
|
|
16
17
|
'outputPath',
|
|
18
|
+
'assets',
|
|
17
19
|
'assetsByChunkName',
|
|
18
20
|
'namedChunkGroups',
|
|
19
21
|
'entrypoints',
|
|
@@ -4,7 +4,7 @@ const BLUR_WIDTH = 10;
|
|
|
4
4
|
const BLUR_HEIGHT = 10;
|
|
5
5
|
|
|
6
6
|
export const getImageMiniatureDataURL = async (content: Buffer, extension: string) => {
|
|
7
|
-
const isSharpInstalled = Boolean(safeRequireResolve('sharp'));
|
|
7
|
+
const isSharpInstalled = Boolean(safeRequireResolve('sharp', __dirname));
|
|
8
8
|
if (!isSharpInstalled) {
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const TARGET_PLUGIN_NAME = 'stats-writer-plugin';
|
|
2
|
+
|
|
3
|
+
// Generate integrities field for stats.json
|
|
4
|
+
export default class AssetsIntegritiesPlugin {
|
|
5
|
+
constructor(private options: { fileName: string }) {
|
|
6
|
+
this.options = options;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
apply(compiler) {
|
|
10
|
+
compiler.hooks.thisCompilation.tap(TARGET_PLUGIN_NAME, (compilation) => {
|
|
11
|
+
compilation.hooks.processAssets.tap(
|
|
12
|
+
{
|
|
13
|
+
name: TARGET_PLUGIN_NAME,
|
|
14
|
+
stage: compilation.constructor.PROCESS_ASSETS_STAGE_REPORT,
|
|
15
|
+
},
|
|
16
|
+
() => {
|
|
17
|
+
const { fileName } = this.options;
|
|
18
|
+
const statsJSON = JSON.parse(compilation.assets[fileName].source().toString());
|
|
19
|
+
const { assets } = statsJSON;
|
|
20
|
+
|
|
21
|
+
statsJSON.integrities = assets.reduce((acc, item) => {
|
|
22
|
+
acc[item.name] = item.integrity;
|
|
23
|
+
return acc;
|
|
24
|
+
}, {});
|
|
25
|
+
|
|
26
|
+
compilation.updateAsset(
|
|
27
|
+
fileName,
|
|
28
|
+
new compiler.webpack.sources.RawSource(JSON.stringify(statsJSON))
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const targetStatsWriters = {
|
|
2
|
+
'child-app': '@loadable/webpack-plugin',
|
|
3
|
+
application: 'stats-writer-plugin',
|
|
4
|
+
} as const;
|
|
5
|
+
|
|
6
|
+
type BuildTarget = keyof typeof targetStatsWriters;
|
|
7
|
+
|
|
8
|
+
const getTargetPluginName = (target: BuildTarget) => targetStatsWriters[target];
|
|
9
|
+
|
|
10
|
+
// Purify unused information from stats.json
|
|
11
|
+
export const purifyStatsPluginFactory = (target: BuildTarget) => {
|
|
12
|
+
const targetPluginName = getTargetPluginName(target);
|
|
13
|
+
|
|
14
|
+
return class PurifyStatsPlugin {
|
|
15
|
+
fileName: string;
|
|
16
|
+
|
|
17
|
+
constructor(options: { fileName: string }) {
|
|
18
|
+
this.fileName = options.fileName;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
apply(compiler) {
|
|
22
|
+
compiler.hooks.make.tap(targetPluginName, (compilation) => {
|
|
23
|
+
compilation.hooks.processAssets.tap(
|
|
24
|
+
{
|
|
25
|
+
name: targetPluginName,
|
|
26
|
+
stage: compilation.constructor.PROCESS_ASSETS_STAGE_REPORT,
|
|
27
|
+
},
|
|
28
|
+
() => {
|
|
29
|
+
const { fileName } = this;
|
|
30
|
+
const statsJSON = JSON.parse(compilation.assets[fileName].source().toString());
|
|
31
|
+
const { assets } = statsJSON;
|
|
32
|
+
|
|
33
|
+
if (assets) {
|
|
34
|
+
if (target === 'application') {
|
|
35
|
+
delete statsJSON.assets;
|
|
36
|
+
} else {
|
|
37
|
+
statsJSON.assets = assets
|
|
38
|
+
.filter((asset) => /\.(js|mjs|cjs|css)$/.test(asset.name))
|
|
39
|
+
.map(({ name, type, chunks, chunkNames }) => ({
|
|
40
|
+
name,
|
|
41
|
+
type,
|
|
42
|
+
chunks,
|
|
43
|
+
chunkNames,
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
compilation.updateAsset(
|
|
49
|
+
fileName,
|
|
50
|
+
new compiler.webpack.sources.RawSource(JSON.stringify(statsJSON))
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
};
|
|
@@ -28,11 +28,16 @@ export default class RuntimePathPlugin implements webpack.WebpackPluginInstance
|
|
|
28
28
|
compilation.hooks.runtimeRequirementInTree
|
|
29
29
|
.for(RuntimeGlobals.publicPath)
|
|
30
30
|
.tap(PLUGIN_NAME, (chunk) => {
|
|
31
|
-
// set custom public path only to entries as this way public path will be constructed in runtime
|
|
31
|
+
// set custom public path only to entries and webpack runtime as this way public path will be constructed in runtime
|
|
32
32
|
// some of the webpack plugins may use [importModule](https://webpack.js.org/api/loaders/#thisimportmodule) that allows execute modules at build time
|
|
33
33
|
// for example mini-css-extract-plugin uses this method that leads to error `window is not defined` at build if we don't
|
|
34
34
|
// prevent adding dynamic code to every chunk altogether
|
|
35
|
-
const
|
|
35
|
+
const chunkName = chunk.name.toString();
|
|
36
|
+
const isEntry = compilation.entries.has(chunkName);
|
|
37
|
+
// webpack runtime chunk with runtimeChunk: 'single' option
|
|
38
|
+
const isWebpackRuntime = chunkName === 'runtime';
|
|
39
|
+
|
|
40
|
+
const needToPatchRuntime = isEntry || isWebpackRuntime;
|
|
36
41
|
|
|
37
42
|
compilation.addRuntimeModule(
|
|
38
43
|
chunk,
|
|
@@ -40,7 +45,7 @@ export default class RuntimePathPlugin implements webpack.WebpackPluginInstance
|
|
|
40
45
|
generate() {
|
|
41
46
|
// setting dynamic publicPath
|
|
42
47
|
return `${RuntimeGlobals.publicPath} = ${
|
|
43
|
-
|
|
48
|
+
needToPatchRuntime ? publicPathEval : defaultPublicPath
|
|
44
49
|
};`;
|
|
45
50
|
}
|
|
46
51
|
} as any)('runtime-path-module')
|
package/src/library/webpack/utils/polyfills/__integration__/__snapshots__/condition.test.ts.snap
CHANGED
|
@@ -87,7 +87,7 @@ exports[`polyfills spec to feature generator all feature expresssion should be v
|
|
|
87
87
|
"es.array.to-spliced": true,
|
|
88
88
|
"es.array.unshift": true,
|
|
89
89
|
"es.array.with": true,
|
|
90
|
-
"es.async-disposable-stack":
|
|
90
|
+
"es.async-disposable-stack": true,
|
|
91
91
|
"es.data-view": true,
|
|
92
92
|
"es.date": true,
|
|
93
93
|
"es.date.get-year": true,
|
|
@@ -97,7 +97,7 @@ exports[`polyfills spec to feature generator all feature expresssion should be v
|
|
|
97
97
|
"es.date.to-iso-string": true,
|
|
98
98
|
"es.date.to-json": true,
|
|
99
99
|
"es.date.to-string": true,
|
|
100
|
-
"es.disposable-stack":
|
|
100
|
+
"es.disposable-stack": true,
|
|
101
101
|
"es.error.cause": true,
|
|
102
102
|
"es.escape": true,
|
|
103
103
|
"es.function": true,
|
|
@@ -169,7 +169,7 @@ exports[`polyfills spec to feature generator all feature expresssion should be v
|
|
|
169
169
|
"es.object.seal": true,
|
|
170
170
|
"es.object.set-prototype-of": true,
|
|
171
171
|
"es.object.values": true,
|
|
172
|
-
"es.observable":
|
|
172
|
+
"es.observable": true,
|
|
173
173
|
"es.parse-float": true,
|
|
174
174
|
"es.parse-int": true,
|
|
175
175
|
"es.promise": true,
|
|
@@ -236,7 +236,7 @@ exports[`polyfills spec to feature generator all feature expresssion should be v
|
|
|
236
236
|
"es.string.trim": true,
|
|
237
237
|
"es.string.trim-end": true,
|
|
238
238
|
"es.string.trim-start": true,
|
|
239
|
-
"es.suppressed-error":
|
|
239
|
+
"es.suppressed-error": true,
|
|
240
240
|
"es.symbol": true,
|
|
241
241
|
"es.symbol.description": true,
|
|
242
242
|
"es.symbol.has-instance": true,
|
|
@@ -347,16 +347,16 @@ exports[`polyfills spec to feature generator all feature expresssion should be v
|
|
|
347
347
|
"esnext.array.unique-by": false,
|
|
348
348
|
"esnext.array.unshift": true,
|
|
349
349
|
"esnext.array.with": true,
|
|
350
|
-
"esnext.async-disposable-stack":
|
|
351
|
-
"esnext.async-disposable-stack.constructor":
|
|
350
|
+
"esnext.async-disposable-stack": true,
|
|
351
|
+
"esnext.async-disposable-stack.constructor": true,
|
|
352
352
|
"esnext.async-iterator": false,
|
|
353
353
|
"esnext.bigint.range": false,
|
|
354
354
|
"esnext.composite-key": false,
|
|
355
355
|
"esnext.composite-symbol": false,
|
|
356
356
|
"esnext.data-view": true,
|
|
357
|
-
"esnext.data-view.get-float16":
|
|
357
|
+
"esnext.data-view.get-float16": true,
|
|
358
358
|
"esnext.data-view.get-uint8-clamped": false,
|
|
359
|
-
"esnext.data-view.set-float16":
|
|
359
|
+
"esnext.data-view.set-float16": true,
|
|
360
360
|
"esnext.data-view.set-uint8-clamped": false,
|
|
361
361
|
"esnext.date": true,
|
|
362
362
|
"esnext.date.get-year": true,
|
|
@@ -366,10 +366,10 @@ exports[`polyfills spec to feature generator all feature expresssion should be v
|
|
|
366
366
|
"esnext.date.to-iso-string": true,
|
|
367
367
|
"esnext.date.to-json": true,
|
|
368
368
|
"esnext.date.to-string": true,
|
|
369
|
-
"esnext.disposable-stack":
|
|
370
|
-
"esnext.disposable-stack.constructor":
|
|
369
|
+
"esnext.disposable-stack": true,
|
|
370
|
+
"esnext.disposable-stack.constructor": true,
|
|
371
371
|
"esnext.error.cause": true,
|
|
372
|
-
"esnext.error.is-error":
|
|
372
|
+
"esnext.error.is-error": true,
|
|
373
373
|
"esnext.escape": true,
|
|
374
374
|
"esnext.function": true,
|
|
375
375
|
"esnext.function.bind": true,
|
|
@@ -417,7 +417,7 @@ exports[`polyfills spec to feature generator all feature expresssion should be v
|
|
|
417
417
|
"esnext.math.deg-per-rad": false,
|
|
418
418
|
"esnext.math.degrees": false,
|
|
419
419
|
"esnext.math.expm1": true,
|
|
420
|
-
"esnext.math.f16round":
|
|
420
|
+
"esnext.math.f16round": true,
|
|
421
421
|
"esnext.math.fround": true,
|
|
422
422
|
"esnext.math.fscale": false,
|
|
423
423
|
"esnext.math.hypot": true,
|
|
@@ -483,7 +483,7 @@ exports[`polyfills spec to feature generator all feature expresssion should be v
|
|
|
483
483
|
"esnext.object.seal": true,
|
|
484
484
|
"esnext.object.set-prototype-of": true,
|
|
485
485
|
"esnext.object.values": true,
|
|
486
|
-
"esnext.observable":
|
|
486
|
+
"esnext.observable": true,
|
|
487
487
|
"esnext.parse-float": true,
|
|
488
488
|
"esnext.parse-int": true,
|
|
489
489
|
"esnext.promise": true,
|
|
@@ -518,7 +518,7 @@ exports[`polyfills spec to feature generator all feature expresssion should be v
|
|
|
518
518
|
"esnext.regexp": true,
|
|
519
519
|
"esnext.regexp.constructor": true,
|
|
520
520
|
"esnext.regexp.dot-all": true,
|
|
521
|
-
"esnext.regexp.escape":
|
|
521
|
+
"esnext.regexp.escape": true,
|
|
522
522
|
"esnext.regexp.exec": true,
|
|
523
523
|
"esnext.regexp.flags": true,
|
|
524
524
|
"esnext.regexp.sticky": true,
|
|
@@ -582,8 +582,8 @@ exports[`polyfills spec to feature generator all feature expresssion should be v
|
|
|
582
582
|
"esnext.string.trim": true,
|
|
583
583
|
"esnext.string.trim-end": true,
|
|
584
584
|
"esnext.string.trim-start": true,
|
|
585
|
-
"esnext.suppressed-error":
|
|
586
|
-
"esnext.suppressed-error.constructor":
|
|
585
|
+
"esnext.suppressed-error": true,
|
|
586
|
+
"esnext.suppressed-error.constructor": true,
|
|
587
587
|
"esnext.symbol": true,
|
|
588
588
|
"esnext.symbol.async-dispose": true,
|
|
589
589
|
"esnext.symbol.custom-matcher": false,
|
|
@@ -13,7 +13,6 @@ export type TranspilerConfig = {
|
|
|
13
13
|
env: Env;
|
|
14
14
|
target: Target;
|
|
15
15
|
actualTarget: Target;
|
|
16
|
-
modern: boolean;
|
|
17
16
|
isServer: boolean;
|
|
18
17
|
generateDataQaTag: boolean;
|
|
19
18
|
enableFillActionNamePlugin: boolean;
|
|
@@ -77,7 +76,7 @@ export const getTranspilerConfig = (
|
|
|
77
76
|
excludesPresetEnv,
|
|
78
77
|
experiments: { enableFillDeclareActionNamePlugin, reactCompiler },
|
|
79
78
|
} = configManager;
|
|
80
|
-
const { env
|
|
79
|
+
const { env } = configManager;
|
|
81
80
|
const isServer = configManager.buildType === 'server';
|
|
82
81
|
|
|
83
82
|
if (alias) {
|
|
@@ -90,8 +89,6 @@ Just check or add configuration to your tsconfig file and remove alias from tram
|
|
|
90
89
|
if (!target) {
|
|
91
90
|
if (isServer) {
|
|
92
91
|
actualTarget = 'node';
|
|
93
|
-
} else if (modern) {
|
|
94
|
-
actualTarget = 'modern';
|
|
95
92
|
}
|
|
96
93
|
}
|
|
97
94
|
|
|
@@ -110,7 +107,6 @@ Just check or add configuration to your tsconfig file and remove alias from tram
|
|
|
110
107
|
isServer,
|
|
111
108
|
env,
|
|
112
109
|
generateDataQaTag,
|
|
113
|
-
modern,
|
|
114
110
|
tramvai: true,
|
|
115
111
|
removeTypeofWindow: true,
|
|
116
112
|
hot: !!configManager.hotRefresh.enabled,
|