@tramvai/cli 5.49.1 → 6.59.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/__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 +76 -4
- 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/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 -1
- 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/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/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/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/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/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 +10 -22
- 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/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/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 +28 -18
- 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/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 +2 -2
- package/lib/commands/build/command.d.ts.map +1 -1
- package/lib/commands/build/command.js +53 -28
- 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/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/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/new/steps/installDependencies.js +3 -3
- package/lib/commands/new/steps/installDependencies.js.map +1 -1
- package/lib/commands/start/command.d.ts +2 -2
- package/lib/commands/start/command.d.ts.map +1 -1
- package/lib/commands/start/command.js +57 -22
- 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/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/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/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 +7 -5
- package/lib/commands/update/command.d.ts.map +1 -1
- package/lib/commands/update/command.js +11 -3
- 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/external/config.d.ts.map +1 -1
- package/lib/external/config.js.map +1 -1
- package/lib/library/babel/index.d.ts +3 -53
- package/lib/library/babel/index.d.ts.map +1 -1
- package/lib/library/babel/index.js +3 -139
- 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/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 +45 -10
- 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.d.ts.map +1 -1
- package/lib/library/webpack/application/common.js +4 -5
- 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 +11 -63
- 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.d.ts.map +1 -1
- package/lib/library/webpack/blocks/resolve.js +3 -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 +4 -9
- 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/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/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.d.ts +0 -1
- package/lib/library/webpack/utils/transpiler.d.ts.map +1 -1
- package/lib/library/webpack/utils/transpiler.js +2 -6
- package/lib/library/webpack/utils/transpiler.js.map +1 -1
- package/lib/models/analytics/utils.d.ts +16 -0
- package/lib/models/analytics/utils.d.ts.map +1 -0
- package/lib/models/analytics/utils.js +88 -0
- package/lib/models/analytics/utils.js.map +1 -0
- package/lib/models/command.d.ts +1 -1
- package/lib/models/command.d.ts.map +1 -1
- package/lib/models/command.js +2 -8
- 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.js +1 -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 +11 -6
- 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/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/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 -4
- package/lib/utils/cpu-profile.js.map +1 -1
- 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 +26 -32
- 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 +10 -1
- package/src/api/start/application.experimental.ts +305 -0
- package/src/api/start/index.ts +20 -5
- 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/devServer/setup.ts +1 -0
- package/src/builder/webpack/index.ts +3 -5
- package/src/builder/webpack/providers/analyze/shared.ts +6 -10
- 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 +16 -29
- package/src/builder/webpack/providers/server.ts +15 -10
- 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/bin-init.ts +0 -2
- package/src/cli/index.ts +36 -18
- package/src/cli/runCLI.ts +26 -6
- 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 +58 -29
- package/src/commands/createApp.ts +0 -2
- 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/new.ts +39 -7
- package/src/commands/new/steps/installDependencies.ts +3 -3
- 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/_prettierrc.js.hbs +1 -1
- package/src/commands/new/templates/shared/package.json.hbs +5 -1
- package/src/commands/start/command.ts +62 -23
- package/src/commands/start/start.ts +7 -1
- package/src/commands/start-prod/command.ts +12 -14
- package/src/commands/static/application.ts +0 -1
- package/src/commands/static/command.ts +7 -3
- package/src/commands/update/command.ts +12 -3
- 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/external/config.ts +1 -0
- package/src/library/babel/index.ts +3 -166
- package/src/library/swc/__integration__/__snapshots__/swc.build.test.ts.snap +61 -236
- package/src/library/swc/__integration__/__snapshots__/swc.start.test.ts.snap +19 -18
- package/src/library/swc/__integration__/swc.build.test.ts +1 -13
- package/src/library/swc/__integration__/swc.start.test.ts +4 -1
- package/src/library/swc/index.ts +3 -139
- package/src/library/typescript/index.ts +1 -3
- package/src/library/webpack/application/client/common.ts +71 -9
- 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 +9 -5
- 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 +14 -70
- package/src/library/webpack/blocks/pwa/shared.ts +1 -3
- package/src/library/webpack/blocks/resolve.ts +3 -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 +8 -12
- 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/RuntimePathPlugin.ts +8 -3
- package/src/library/webpack/utils/threadLoader.ts +21 -0
- package/src/library/webpack/utils/transpiler.ts +3 -7
- package/src/models/analytics/utils.ts +126 -0
- package/src/models/command.ts +4 -12
- package/src/models/config.spec.ts +6 -2
- package/src/models/context.ts +4 -5
- package/src/models/logger.ts +1 -1
- 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 +16 -7
- package/src/typings/configEntry/cli.ts +14 -0
- package/src/typings/projectType.ts +5 -0
- package/src/typings/public.ts +0 -2
- 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 -4
- 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/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/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/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.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/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/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/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/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 -266
- package/src/library/babel/plugins/__snapshots__/provider-stack.spec.ts.snap +0 -381
- 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 -47
- 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 -34
- 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/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/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.ts +0 -116
- package/src/typings/pwa/index.ts +0 -83
- package/src/utils/sentry.ts +0 -25
- /package/src/commands/new/templates/{shared → packageManagerConfig/defaultPackageManagerConfig}/_npmrc.hbs +0 -0
|
@@ -237,7 +237,8 @@ let internalFunc;
|
|
|
237
237
|
if (true) {
|
|
238
238
|
internalFunc = ()=>"Are you developer, for sure?";
|
|
239
239
|
}
|
|
240
|
-
if (false)
|
|
240
|
+
if (false) // removed by dead control flow
|
|
241
|
+
{}
|
|
241
242
|
const func = ()=>{
|
|
242
243
|
return internalFunc();
|
|
243
244
|
};
|
|
@@ -469,7 +470,8 @@ let internalFunc;
|
|
|
469
470
|
if (true) {
|
|
470
471
|
internalFunc = ()=>"Hello, I'm in browser";
|
|
471
472
|
}
|
|
472
|
-
if (false)
|
|
473
|
+
if (false) // removed by dead control flow
|
|
474
|
+
{}
|
|
473
475
|
const func = ()=>{
|
|
474
476
|
return internalFunc();
|
|
475
477
|
};
|
|
@@ -611,12 +613,12 @@ exports[`server: lazy-component.tsx 1`] = `
|
|
|
611
613
|
/* harmony export */ });
|
|
612
614
|
/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("webpack/sharing/consume/default/react/jsx-dev-runtime/react/jsx-dev-runtime");
|
|
613
615
|
/* harmony import */ var react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_dev_runtime__WEBPACK_IMPORTED_MODULE_0__);
|
|
614
|
-
/* harmony import */ var
|
|
615
|
-
/* harmony import */ var
|
|
616
|
+
/* harmony import */ var _swc_helpers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/@swc/helpers/esm/_interop_require_wildcard.js");
|
|
617
|
+
/* harmony import */ var _tramvai_react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./src/library/swc/__integration__/mocks/tramvai-react.ts");
|
|
616
618
|
|
|
617
619
|
|
|
618
620
|
|
|
619
|
-
const LazyComponent = (0,
|
|
621
|
+
const LazyComponent = (0,_tramvai_react__WEBPACK_IMPORTED_MODULE_2__.lazy)({
|
|
620
622
|
chunkName () {
|
|
621
623
|
return "components-lazy-inner";
|
|
622
624
|
},
|
|
@@ -627,7 +629,7 @@ const LazyComponent = (0,_tramvai_react__WEBPACK_IMPORTED_MODULE_1__.lazy)({
|
|
|
627
629
|
const key = this.resolve(props);
|
|
628
630
|
return !!__webpack_require__.m[key];
|
|
629
631
|
},
|
|
630
|
-
importAsync: ()=>Promise.resolve().then(()=>(0,
|
|
632
|
+
importAsync: ()=>Promise.resolve().then(()=>(0,_swc_helpers__WEBPACK_IMPORTED_MODULE_1__._interop_require_wildcard)(__webpack_require__(/* webpackChunkName: "components-lazy-inner" */ "./src/library/swc/__integration__/components/lazy-inner.tsx"))),
|
|
631
633
|
requireAsync (props) {
|
|
632
634
|
return this.importAsync(props).then((resolved)=>{
|
|
633
635
|
return resolved;
|
|
@@ -669,7 +671,8 @@ let internalFunc;
|
|
|
669
671
|
if (true) {
|
|
670
672
|
internalFunc = ()=>"Are you developer, for sure?";
|
|
671
673
|
}
|
|
672
|
-
if (false)
|
|
674
|
+
if (false) // removed by dead control flow
|
|
675
|
+
{}
|
|
673
676
|
const func = ()=>{
|
|
674
677
|
return internalFunc();
|
|
675
678
|
};
|
|
@@ -735,19 +738,16 @@ exports[`server: server.inline.ts 1`] = `
|
|
|
735
738
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
736
739
|
/* harmony export */ ForBrowser: function() { return /* binding */ ForBrowser; }
|
|
737
740
|
/* harmony export */ });
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
741
|
+
class ForBrowser {
|
|
742
|
+
test() {
|
|
743
|
+
console.log("Ok");
|
|
744
|
+
}
|
|
745
|
+
constructor(){
|
|
746
|
+
this.property = ()=>{
|
|
742
747
|
console.log("Ok");
|
|
743
748
|
};
|
|
744
749
|
}
|
|
745
|
-
|
|
746
|
-
_proto.test = function test() {
|
|
747
|
-
console.log("Ok");
|
|
748
|
-
};
|
|
749
|
-
return ForBrowser;
|
|
750
|
-
}();
|
|
750
|
+
}
|
|
751
751
|
ForBrowser.prop = "static";
|
|
752
752
|
|
|
753
753
|
|
|
@@ -760,7 +760,8 @@ exports[`server: typeof-window.ts 1`] = `
|
|
|
760
760
|
/* harmony export */ func: function() { return /* binding */ func; }
|
|
761
761
|
/* harmony export */ });
|
|
762
762
|
let internalFunc;
|
|
763
|
-
if (false)
|
|
763
|
+
if (false) // removed by dead control flow
|
|
764
|
+
{}
|
|
764
765
|
if (true) {
|
|
765
766
|
internalFunc = ()=>"I'm a big server";
|
|
766
767
|
}
|
|
@@ -3,7 +3,6 @@ import { promises as fs } from 'fs';
|
|
|
3
3
|
import { build } from '@tramvai/cli';
|
|
4
4
|
|
|
5
5
|
let clientCode: string;
|
|
6
|
-
let clientModernCode: string;
|
|
7
6
|
let serverCode: string;
|
|
8
7
|
|
|
9
8
|
const getModuleCode = (code: string, name: string) => {
|
|
@@ -39,17 +38,11 @@ beforeAll(async () => {
|
|
|
39
38
|
serverCode = await fs.readFile(path.resolve(distRoot, 'server/server.js'), 'utf-8');
|
|
40
39
|
|
|
41
40
|
const stats = require(path.resolve(distRoot, 'client/stats.json'));
|
|
42
|
-
const modernStats = require(path.resolve(distRoot, 'client/stats.modern.json'));
|
|
43
41
|
|
|
44
42
|
clientCode = await fs.readFile(
|
|
45
43
|
path.resolve(distRoot, 'client', stats.assetsByChunkName.platform[0]),
|
|
46
44
|
'utf-8'
|
|
47
45
|
);
|
|
48
|
-
|
|
49
|
-
clientModernCode = await fs.readFile(
|
|
50
|
-
path.resolve(distRoot, 'client', modernStats.assetsByChunkName.platform[0]),
|
|
51
|
-
'utf-8'
|
|
52
|
-
);
|
|
53
46
|
}, 180000);
|
|
54
47
|
|
|
55
48
|
const MODULES = [
|
|
@@ -65,15 +58,10 @@ const MODULES = [
|
|
|
65
58
|
|
|
66
59
|
for (const mod of MODULES) {
|
|
67
60
|
// eslint-disable-next-line no-loop-func
|
|
68
|
-
it(`client
|
|
61
|
+
it(`client: ${mod}`, () => {
|
|
69
62
|
expect(getModuleCode(clientCode, mod)).toMatchSnapshot();
|
|
70
63
|
});
|
|
71
64
|
|
|
72
|
-
// eslint-disable-next-line no-loop-func
|
|
73
|
-
it(`client-modern: ${mod}`, () => {
|
|
74
|
-
expect(getModuleCode(clientModernCode, mod)).toMatchSnapshot();
|
|
75
|
-
});
|
|
76
|
-
|
|
77
65
|
// eslint-disable-next-line no-loop-func
|
|
78
66
|
it(`server: ${mod}`, () => {
|
|
79
67
|
expect(getModuleCode(serverCode, mod)).toMatchSnapshot();
|
|
@@ -16,7 +16,7 @@ const normalizeCode = (code: string) => {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
const getModuleCode = (code: string, name: string) => {
|
|
19
|
-
const regexp = new RegExp(`swc/__integration__/${name}":.+?eval\\("(.+?)//# sourceURL=`, 's');
|
|
19
|
+
const regexp = new RegExp(`swc/__integration__/${name}":.+?eval\\("{(.+?)//# sourceURL=`, 's');
|
|
20
20
|
|
|
21
21
|
const match = code.match(regexp);
|
|
22
22
|
|
|
@@ -42,6 +42,9 @@ beforeAll(async () => {
|
|
|
42
42
|
transpilation: {
|
|
43
43
|
loader: 'swc',
|
|
44
44
|
},
|
|
45
|
+
// for threads "chdir" is used, cwd is changed and it breaks some integration tests,
|
|
46
|
+
// because current "tsconfig.json" is used, where @tramvai/core and @tramvai/react is mocked in "paths"
|
|
47
|
+
serverRunner: 'process',
|
|
45
48
|
},
|
|
46
49
|
},
|
|
47
50
|
});
|
package/src/library/swc/index.ts
CHANGED
|
@@ -1,140 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { existsSync } from 'fs';
|
|
4
|
-
import { sync as resolve } from 'resolve';
|
|
5
|
-
import findCacheDir from 'find-cache-dir';
|
|
6
|
-
import type { Options as SwcOptions } from '@swc/core';
|
|
7
|
-
import type { TranspilerConfig } from '../webpack/utils/transpiler';
|
|
1
|
+
import { configFactory } from '@tramvai/plugin-swc-transpiler/lib/config-factory';
|
|
8
2
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const NOT_SUPPORTED_FIELDS = ['alias', 'enableFillActionNamePlugin'];
|
|
12
|
-
let warningWasShown = false;
|
|
13
|
-
|
|
14
|
-
export const getSwcOptions = (config: TranspilerConfig): SwcOptions => {
|
|
15
|
-
const {
|
|
16
|
-
env = 'development',
|
|
17
|
-
isServer = false,
|
|
18
|
-
modules = false,
|
|
19
|
-
excludesPresetEnv,
|
|
20
|
-
browsersListTargets,
|
|
21
|
-
typescript = false,
|
|
22
|
-
hot = false,
|
|
23
|
-
removeTypeofWindow,
|
|
24
|
-
tramvai = false,
|
|
25
|
-
rootDir = process.cwd(),
|
|
26
|
-
generateDataQaTag = false,
|
|
27
|
-
// disabled because `arrayLikeIsIterable` and `iterableIsArray` assumtions is not supported yet in swc,
|
|
28
|
-
// this can leads to incorrect code generation e.g. when Set with spread is used - `[...new Set()] => [].concat(new Set())`
|
|
29
|
-
// TCORE-4904
|
|
30
|
-
loose = false,
|
|
31
|
-
externalHelpers = true,
|
|
32
|
-
} = config;
|
|
33
|
-
|
|
34
|
-
if (!warningWasShown) {
|
|
35
|
-
for (const field of NOT_SUPPORTED_FIELDS) {
|
|
36
|
-
if (config[field] && !isEmpty(config[field])) {
|
|
37
|
-
console.warn(
|
|
38
|
-
`@tramvai/swc-integration do not support "${field}" configuration. Consider removing it from tramvai.json`
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
warningWasShown = true;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const swcrcPath = path.resolve(rootDir, '.swcrc');
|
|
46
|
-
|
|
47
|
-
if (existsSync(swcrcPath)) {
|
|
48
|
-
console.warn(
|
|
49
|
-
`Found .swcrc config in the app root directory ("${swcrcPath}").
|
|
50
|
-
Having swc config may conflict with @tramvai/cli configuration`
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
warningWasShown = true;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const resolveWasmFile = (pluginName: string, type: 'debug' | 'release') => {
|
|
58
|
-
return resolve(`${TRAMVAI_SWC_TARGET_PATH}/${type}/${pluginName}.wasm`);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const resolveTramvaiSwcPlugin = (pluginName: string) => {
|
|
62
|
-
try {
|
|
63
|
-
return resolveWasmFile(pluginName, 'debug');
|
|
64
|
-
} catch (_) {
|
|
65
|
-
try {
|
|
66
|
-
return resolveWasmFile(pluginName, 'release');
|
|
67
|
-
} catch (__) {
|
|
68
|
-
throw new Error(
|
|
69
|
-
`Cannot find tramvai swc-plugin "${pluginName}" related to the "${rootDir}" directory`
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
function hasJsxRuntime() {
|
|
75
|
-
try {
|
|
76
|
-
resolve('react/jsx-runtime', { basedir: rootDir });
|
|
77
|
-
return true;
|
|
78
|
-
} catch (e) {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return {
|
|
84
|
-
env: {
|
|
85
|
-
targets: browsersListTargets,
|
|
86
|
-
// Use relevant core-js version, because it affects which polyfills are included
|
|
87
|
-
// https://github.com/swc-project/swc/blob/main/crates/swc_ecma_preset_env/data/core-js-compat/modules-by-versions.json
|
|
88
|
-
coreJs: require('core-js/package.json').version,
|
|
89
|
-
// disabled because `arrayLikeIsIterable` and `iterableIsArray` assumtions is not supported yet in swc,
|
|
90
|
-
// this can leads to incorrect code generation e.g. when Set with spread is used - `[...new Set()] => [].concat(new Set())`
|
|
91
|
-
// TCORE-4904
|
|
92
|
-
loose,
|
|
93
|
-
exclude: excludesPresetEnv,
|
|
94
|
-
mode: 'entry',
|
|
95
|
-
},
|
|
96
|
-
module: {
|
|
97
|
-
type: modules || 'es6',
|
|
98
|
-
},
|
|
99
|
-
isModule: 'unknown',
|
|
100
|
-
jsc: {
|
|
101
|
-
externalHelpers,
|
|
102
|
-
parser: {
|
|
103
|
-
syntax: typescript ? 'typescript' : 'ecmascript',
|
|
104
|
-
decorators: true,
|
|
105
|
-
tsx: true,
|
|
106
|
-
jsx: true,
|
|
107
|
-
exportDefaultFrom: true,
|
|
108
|
-
},
|
|
109
|
-
transform: {
|
|
110
|
-
legacyDecorator: true,
|
|
111
|
-
react: {
|
|
112
|
-
runtime: hasJsxRuntime() ? 'automatic' : 'classic',
|
|
113
|
-
development: env === 'development',
|
|
114
|
-
refresh: hot && env === 'development' && !isServer,
|
|
115
|
-
},
|
|
116
|
-
optimizer: {
|
|
117
|
-
globals: {
|
|
118
|
-
// let the webpack replace NODE_ENV as replacement with swc may mess up with tests
|
|
119
|
-
envs: [],
|
|
120
|
-
typeofs: removeTypeofWindow
|
|
121
|
-
? {
|
|
122
|
-
window: isServer ? 'undefined' : 'object',
|
|
123
|
-
}
|
|
124
|
-
: {},
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
experimental: {
|
|
129
|
-
cacheRoot: findCacheDir({ cwd: rootDir, name: 'swc' }),
|
|
130
|
-
plugins: [
|
|
131
|
-
[resolveTramvaiSwcPlugin('create_token_pure'), {}],
|
|
132
|
-
[resolveTramvaiSwcPlugin('lazy_component'), {}],
|
|
133
|
-
isServer && [resolveTramvaiSwcPlugin('dynamic_import_to_require'), {}],
|
|
134
|
-
tramvai && env === 'development' && [resolveTramvaiSwcPlugin('provider_stack'), {}],
|
|
135
|
-
generateDataQaTag && [resolveTramvaiSwcPlugin('react_element_info_unique'), {}],
|
|
136
|
-
].filter(Boolean) as Array<[string, Record<string, any>]>,
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
|
-
};
|
|
140
|
-
};
|
|
3
|
+
export { configFactory as swcConfigFactory };
|
|
4
|
+
export default configFactory;
|
|
@@ -7,13 +7,12 @@ const rootDir = process.cwd();
|
|
|
7
7
|
|
|
8
8
|
interface Options {
|
|
9
9
|
env: Env;
|
|
10
|
-
modern: boolean;
|
|
11
10
|
isServer: boolean;
|
|
12
11
|
tramvai?: boolean;
|
|
13
12
|
}
|
|
14
13
|
|
|
15
14
|
export default (options: Options) => {
|
|
16
|
-
const { env,
|
|
15
|
+
const { env, isServer, tramvai } = options;
|
|
17
16
|
|
|
18
17
|
return {
|
|
19
18
|
errorsAsWarnings: true,
|
|
@@ -27,7 +26,6 @@ export default (options: Options) => {
|
|
|
27
26
|
babelConfigFactory({
|
|
28
27
|
env,
|
|
29
28
|
isServer,
|
|
30
|
-
modern,
|
|
31
29
|
tramvai,
|
|
32
30
|
})
|
|
33
31
|
),
|
|
@@ -2,6 +2,12 @@ import path from 'path';
|
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import type Config from 'webpack-chain';
|
|
4
4
|
import { StatsWriterPlugin } from 'webpack-stats-plugin';
|
|
5
|
+
import { SubresourceIntegrityPlugin } from 'webpack-subresource-integrity';
|
|
6
|
+
import {
|
|
7
|
+
AssetsIntegritiesPlugin,
|
|
8
|
+
PolyfillConditionPlugin,
|
|
9
|
+
PurifyStatsPlugin,
|
|
10
|
+
} from '@tramvai/plugin-webpack-builder';
|
|
5
11
|
|
|
6
12
|
import type { ConfigManager } from '../../../../config/configManager';
|
|
7
13
|
import type { ApplicationConfigEntry } from '../../../../typings/configEntry/application';
|
|
@@ -26,20 +32,35 @@ import {
|
|
|
26
32
|
WEBPACK_DEBUG_STATS_OPTIONS,
|
|
27
33
|
WEBPACK_DEBUG_STATS_FIELDS,
|
|
28
34
|
} from '../../constants/stats';
|
|
29
|
-
import {
|
|
30
|
-
import PolyfillConditionPlugin from '../../plugins/PolyfillCondition';
|
|
35
|
+
import type { IntegrityOptions } from '../../../../typings/configEntry/cli';
|
|
31
36
|
|
|
32
37
|
export default (configManager: ConfigManager<ApplicationConfigEntry>) => (config: Config) => {
|
|
33
|
-
const {
|
|
38
|
+
const {
|
|
39
|
+
polyfill,
|
|
40
|
+
modernPolyfill,
|
|
41
|
+
fileSystemPages,
|
|
42
|
+
env,
|
|
43
|
+
integrity,
|
|
44
|
+
experiments: { runtimeChunk, pwa },
|
|
45
|
+
} = configManager;
|
|
34
46
|
|
|
35
47
|
const portal = path.resolve(configManager.rootDir, `packages/${process.env.APP_ID}/portal.js`);
|
|
36
|
-
const polyfillPath = path.resolve(configManager.rootDir, polyfill ?? 'src/polyfill');
|
|
37
48
|
const portalExists = fs.existsSync(portal);
|
|
38
|
-
|
|
49
|
+
|
|
50
|
+
const polyfillPath = safeRequireResolve(
|
|
51
|
+
polyfill ?? './src/polyfill',
|
|
52
|
+
configManager.rootDir,
|
|
53
|
+
typeof polyfill === 'undefined'
|
|
54
|
+
);
|
|
55
|
+
const modernPolyfillPath = safeRequireResolve(
|
|
56
|
+
modernPolyfill ?? './src/modern.polyfill',
|
|
57
|
+
configManager.rootDir,
|
|
58
|
+
typeof modernPolyfill === 'undefined'
|
|
59
|
+
);
|
|
39
60
|
|
|
40
61
|
config
|
|
41
62
|
.name('client')
|
|
42
|
-
.target(
|
|
63
|
+
.target(['web'])
|
|
43
64
|
.batch(common(configManager))
|
|
44
65
|
.batch(commonApplication(configManager))
|
|
45
66
|
.batch(configToEnv(configManager))
|
|
@@ -50,17 +71,26 @@ export default (configManager: ConfigManager<ApplicationConfigEntry>) => (config
|
|
|
50
71
|
.batch(css(configManager))
|
|
51
72
|
.batch(nodeClient(configManager))
|
|
52
73
|
.batch(postcssAssets(configManager))
|
|
53
|
-
.batch(pwaBlock(configManager))
|
|
54
74
|
.when(fileSystemPages.enabled, (cfg) => cfg.batch(pagesResolve(configManager)));
|
|
55
75
|
|
|
76
|
+
config.optimization.set('runtimeChunk', runtimeChunk);
|
|
77
|
+
// move require of pwa build part under if for performance
|
|
78
|
+
if (pwa.workbox?.enabled || pwa.webmanifest?.enabled) {
|
|
79
|
+
const { pwaBlock } = require('../../blocks/pwa/client');
|
|
80
|
+
config.batch(pwaBlock(configManager));
|
|
81
|
+
}
|
|
82
|
+
|
|
56
83
|
config
|
|
57
84
|
.entry('platform')
|
|
58
85
|
.add(path.resolve(configManager.rootDir, `${configManager.root}/index`))
|
|
59
86
|
.end()
|
|
60
87
|
.when(portalExists, (cfg) => cfg.entry('portal').add(portal))
|
|
61
|
-
.when(
|
|
88
|
+
.when(Boolean(polyfillPath), (cfg) => cfg.entry('polyfill').add(polyfillPath))
|
|
89
|
+
.when(Boolean(modernPolyfillPath), (cfg) =>
|
|
90
|
+
cfg.entry('modern.polyfill').add(modernPolyfillPath)
|
|
91
|
+
);
|
|
62
92
|
|
|
63
|
-
const statsFileName =
|
|
93
|
+
const statsFileName = 'stats.json';
|
|
64
94
|
|
|
65
95
|
config
|
|
66
96
|
.plugin('stats-plugin')
|
|
@@ -90,5 +120,37 @@ export default (configManager: ConfigManager<ApplicationConfigEntry>) => (config
|
|
|
90
120
|
},
|
|
91
121
|
]);
|
|
92
122
|
|
|
123
|
+
if (integrity) {
|
|
124
|
+
const defaultIntegrityOptions: IntegrityOptions = {
|
|
125
|
+
enabled: 'auto',
|
|
126
|
+
hashFuncNames: ['sha256'],
|
|
127
|
+
hashLoading: 'eager',
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
let integrityOptions;
|
|
131
|
+
if (typeof integrity === 'object') {
|
|
132
|
+
integrityOptions = {
|
|
133
|
+
...defaultIntegrityOptions,
|
|
134
|
+
...integrity,
|
|
135
|
+
};
|
|
136
|
+
} else {
|
|
137
|
+
integrityOptions = defaultIntegrityOptions;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
config
|
|
141
|
+
.plugin('integrity-plugin')
|
|
142
|
+
.use(SubresourceIntegrityPlugin, [integrityOptions])
|
|
143
|
+
.end()
|
|
144
|
+
// Plugin for transform integrity-plugin result into single integrities field in stats.json
|
|
145
|
+
.plugin('assets-integrity-plugin')
|
|
146
|
+
.use(AssetsIntegritiesPlugin, [{ fileName: statsFileName }])
|
|
147
|
+
.end();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
config
|
|
151
|
+
.plugin('assets-purify-plugin')
|
|
152
|
+
.use(PurifyStatsPlugin, [{ fileName: statsFileName, target: 'application' }])
|
|
153
|
+
.end();
|
|
154
|
+
|
|
93
155
|
return config;
|
|
94
156
|
};
|
|
@@ -48,7 +48,7 @@ export const webpackClientConfig = ({
|
|
|
48
48
|
config.devtool(configManager.webpack.devtool ?? false);
|
|
49
49
|
|
|
50
50
|
if (configManager.sourceMap) {
|
|
51
|
-
config.batch(sourcemaps(configManager));
|
|
51
|
+
config.batch(sourcemaps(configManager, 'client'));
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
if (configManager.noClientRebuild) {
|
|
@@ -151,7 +151,7 @@ export const webpackClientConfig = ({
|
|
|
151
151
|
if (hotRefresh?.enabled) {
|
|
152
152
|
extendEntry(config.entry('platform'), {
|
|
153
153
|
import: [
|
|
154
|
-
'webpack-hot-middleware/client?name=client&dynamicPublicPath=true&path=__webpack_hmr',
|
|
154
|
+
'webpack-hot-middleware/client?name=client&dynamicPublicPath=true&path=__webpack_hmr&reload=true',
|
|
155
155
|
],
|
|
156
156
|
});
|
|
157
157
|
|
|
@@ -27,7 +27,6 @@ const generateFilename = (
|
|
|
27
27
|
[
|
|
28
28
|
'[name]',
|
|
29
29
|
!configManager.disableProdOptimization && '[contenthash]',
|
|
30
|
-
configManager.disableProdOptimization && configManager.modern && 'modern',
|
|
31
30
|
isChunk && 'chunk',
|
|
32
31
|
extension,
|
|
33
32
|
]
|
|
@@ -106,7 +105,7 @@ export const webpackClientConfig = ({
|
|
|
106
105
|
}
|
|
107
106
|
|
|
108
107
|
if (sourceMap) {
|
|
109
|
-
config.batch(sourcemaps(configManager));
|
|
108
|
+
config.batch(sourcemaps(configManager, 'client'));
|
|
110
109
|
}
|
|
111
110
|
|
|
112
111
|
if (process.env.TRAMVAI_REACT_PROFILE) {
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import type Config from 'webpack-chain';
|
|
2
2
|
import { container } from 'webpack';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
ModuleFederationFixRange,
|
|
6
|
+
ModuleFederationFixRangeOptions,
|
|
7
|
+
ModuleFederationIgnoreEntries,
|
|
8
|
+
ModuleFederationIgnoreEntriesOptions,
|
|
9
|
+
} from '@tramvai/plugin-webpack-builder';
|
|
10
|
+
|
|
3
11
|
import { getSharedModules } from '../child-app/moduleFederationShared';
|
|
4
12
|
import type { ModuleFederationPluginOptions } from '../types/webpack';
|
|
5
13
|
import type { ConfigManager } from '../../../config/configManager';
|
|
6
14
|
import type { ApplicationConfigEntry } from '../../../typings/configEntry/application';
|
|
7
|
-
import type { ModuleFederationIgnoreEntriesOptions } from '../plugins/ModuleFederationIgnoreEntries';
|
|
8
|
-
import { ModuleFederationIgnoreEntries } from '../plugins/ModuleFederationIgnoreEntries';
|
|
9
15
|
import { rootErrorBoundaryFactory } from '../blocks/rootErrorBoundary';
|
|
10
|
-
import type { ModuleFederationFixRangeOptions } from '../plugins/ModuleFederationFixRange';
|
|
11
|
-
import { ModuleFederationFixRange } from '../plugins/ModuleFederationFixRange';
|
|
12
16
|
import { FileStatsPlugin } from '../plugins/FileStats';
|
|
13
17
|
|
|
14
18
|
export const commonApplication =
|
|
@@ -35,7 +39,7 @@ export const commonApplication =
|
|
|
35
39
|
config
|
|
36
40
|
.plugin('module-federation-ignore-entries')
|
|
37
41
|
.use(ModuleFederationIgnoreEntries, [
|
|
38
|
-
{ entries: ['polyfill'] } as ModuleFederationIgnoreEntriesOptions,
|
|
42
|
+
{ entries: ['polyfill', 'modern.polyfill'] } as ModuleFederationIgnoreEntriesOptions,
|
|
39
43
|
]);
|
|
40
44
|
|
|
41
45
|
config.plugin('module-federation-validate-duplicates').use(ModuleFederationFixRange, [
|
|
@@ -39,7 +39,7 @@ export const webpackServerConfig = ({
|
|
|
39
39
|
config.devtool(configManager.webpack.devtool ?? false);
|
|
40
40
|
|
|
41
41
|
if (configManager.sourceMap) {
|
|
42
|
-
config.batch(sourcemaps(configManager));
|
|
42
|
+
config.batch(sourcemaps(configManager, 'server'));
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
if (configManager.noServerRebuild) {
|
|
@@ -73,6 +73,22 @@ export const cssWebpackRulesFactory =
|
|
|
73
73
|
typeof postcssConfig === 'undefined'
|
|
74
74
|
) ?? {};
|
|
75
75
|
|
|
76
|
+
const postcssOptionsFn = (...args) => ({
|
|
77
|
+
...postcssCfg,
|
|
78
|
+
plugins: [
|
|
79
|
+
require('postcss-modules-tilda'),
|
|
80
|
+
require('postcss-modules-values-replace')({ importsAsModuleRequests: true }),
|
|
81
|
+
// TODO: придумать как прокинуть настройки browserslist в autoprefixer - сейчас autoprefixer добавляется в самом приложении и из
|
|
82
|
+
// конфига нет возможности задавать динамический env в зависимости от сборки. Подсунуть в сам autoprefixer после его инициализации тоже
|
|
83
|
+
// тоже не получится - https://github.com/postcss/autoprefixer/blob/10.3.1/lib/autoprefixer.js#L108
|
|
84
|
+
...(applyOrReturn(args, postcssCfg.plugins) || []),
|
|
85
|
+
],
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// otherwise postcss-loader will use cosmiconfig to resolve postcss configuration file
|
|
89
|
+
// https://github.com/webpack-contrib/postcss-loader/blob/6f470db420f6febbea729080921050e8fe353226/src/index.js#L38
|
|
90
|
+
Object.assign(postcssOptionsFn, { config: false });
|
|
91
|
+
|
|
76
92
|
config.module
|
|
77
93
|
.rule('css')
|
|
78
94
|
.test(/\.css$/)
|
|
@@ -81,17 +97,7 @@ export const cssWebpackRulesFactory =
|
|
|
81
97
|
.loader('postcss-loader')
|
|
82
98
|
.options({
|
|
83
99
|
sourceMap,
|
|
84
|
-
postcssOptions:
|
|
85
|
-
...postcssCfg,
|
|
86
|
-
plugins: [
|
|
87
|
-
require('postcss-modules-tilda'),
|
|
88
|
-
require('postcss-modules-values-replace')({ importsAsModuleRequests: true }),
|
|
89
|
-
// TODO: придумать как прокинуть настройки browserslist в autoprefixer - сейчас autoprefixer добавляется в самом приложении и из
|
|
90
|
-
// конфига нет возможности задавать динамический env в зависимости от сборки. Подсунуть в сам autoprefixer после его инициализации тоже
|
|
91
|
-
// тоже не получится - https://github.com/postcss/autoprefixer/blob/10.3.1/lib/autoprefixer.js#L108
|
|
92
|
-
...(applyOrReturn(args, postcssCfg.plugins) || []),
|
|
93
|
-
],
|
|
94
|
-
}),
|
|
100
|
+
postcssOptions: postcssOptionsFn,
|
|
95
101
|
});
|
|
96
102
|
};
|
|
97
103
|
|
|
@@ -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
|