@tramvai/cli 2.64.0 → 2.65.9
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/README.md +46 -38
- package/lib/api/analyze/providers/shared.js +1 -1
- package/lib/api/analyze/providers/shared.js.map +1 -1
- package/lib/api/benchmark/index.d.ts +1 -1
- package/lib/api/build/child-app.js +3 -2
- package/lib/api/build/child-app.js.map +1 -1
- package/lib/api/build/module.js +1 -2
- package/lib/api/build/module.js.map +1 -1
- package/lib/api/build/providers/shared.js +1 -1
- package/lib/api/build/providers/shared.js.map +1 -1
- package/lib/api/index.d.ts +6 -2
- package/lib/api/index.js +3 -3
- package/lib/api/index.js.map +1 -1
- package/lib/api/shared/types/withConfig.d.ts +3 -2
- package/lib/api/start/providers/application/shared.js +1 -1
- package/lib/api/start/providers/application/shared.js.map +1 -1
- package/lib/api/start/providers/child-app/shared.js +8 -7
- package/lib/api/start/providers/child-app/shared.js.map +1 -1
- package/lib/api/start/providers/module/shared.js +14 -13
- package/lib/api/start/providers/module/shared.js.map +1 -1
- package/lib/api/start/utils/banner.js +3 -2
- package/lib/api/start/utils/banner.js.map +1 -1
- package/lib/api/start/utils/tips/tips.js +10 -8
- package/lib/api/start/utils/tips/tips.js.map +1 -1
- package/lib/api/start-prod/providers/application.js +5 -5
- package/lib/api/start-prod/providers/application.js.map +1 -1
- package/lib/api/start-prod/providers/child-app.js +2 -2
- package/lib/api/start-prod/providers/child-app.js.map +1 -1
- package/lib/api/start-prod/providers/shared.js +3 -3
- package/lib/api/start-prod/providers/shared.js.map +1 -1
- package/lib/builder/webpack/devServer/client.js +18 -15
- package/lib/builder/webpack/devServer/client.js.map +1 -1
- package/lib/builder/webpack/devServer/notifier.d.ts +2 -2
- package/lib/builder/webpack/devServer/notifier.js +3 -3
- package/lib/builder/webpack/devServer/notifier.js.map +1 -1
- package/lib/builder/webpack/devServer/pool/process/pool.js +3 -2
- package/lib/builder/webpack/devServer/pool/process/pool.js.map +1 -1
- package/lib/builder/webpack/devServer/pool/thread/pool.js +7 -0
- package/lib/builder/webpack/devServer/pool/thread/pool.js.map +1 -1
- package/lib/builder/webpack/devServer/server.js +7 -2
- package/lib/builder/webpack/devServer/server.js.map +1 -1
- package/lib/builder/webpack/providers/analyze/shared.js +3 -3
- package/lib/builder/webpack/providers/analyze/shared.js.map +1 -1
- package/lib/builder/webpack/providers/build/application/server.js.map +1 -1
- package/lib/builder/webpack/providers/build/client.js +3 -3
- package/lib/builder/webpack/providers/build/client.js.map +1 -1
- package/lib/builder/webpack/providers/build/server.js +1 -1
- package/lib/builder/webpack/providers/build/server.js.map +1 -1
- package/lib/builder/webpack/tokens.d.ts +313 -3
- package/lib/builder/webpack/tokens.js.map +1 -1
- package/lib/builder/webpack/utils/copyBuildFile.d.ts +2 -1
- package/lib/builder/webpack/utils/copyBuildFile.js +2 -3
- package/lib/builder/webpack/utils/copyBuildFile.js.map +1 -1
- package/lib/builder/webpack/utils/copyStatsJsonFile.d.ts +2 -1
- package/lib/builder/webpack/utils/copyStatsJsonFile.js +1 -1
- package/lib/builder/webpack/utils/copyStatsJsonFile.js.map +1 -1
- package/lib/cli/CLI.d.ts +2 -2
- package/lib/cli/CLI.js +2 -2
- package/lib/cli/CLI.js.map +1 -1
- package/lib/cli/index.js.map +1 -1
- package/lib/commands/analyze/command.d.ts +1 -1
- package/lib/commands/analyze/command.js.map +1 -1
- package/lib/commands/benchmark/command.d.ts +1 -1
- package/lib/commands/benchmark/command.js.map +1 -1
- package/lib/commands/build/command.d.ts +1 -1
- package/lib/commands/build/command.js.map +1 -1
- package/lib/commands/new/new.js +0 -1
- package/lib/commands/new/new.js.map +1 -1
- package/lib/commands/new/questions/packageManager.d.ts +1 -1
- package/lib/commands/new/questions/packageManager.js.map +1 -1
- package/lib/commands/new/questions/template.d.ts +1 -1
- package/lib/commands/new/questions/template.js.map +1 -1
- package/lib/commands/new/questions/testingFramework.d.ts +1 -1
- package/lib/commands/new/questions/testingFramework.js.map +1 -1
- package/lib/commands/new/questions/type.d.ts +1 -1
- package/lib/commands/new/questions/type.js.map +1 -1
- package/lib/commands/new/steps/initializationGit.d.ts +1 -1
- package/lib/commands/new/steps/initializationGit.js.map +1 -1
- package/lib/commands/start/command.d.ts +1 -1
- package/lib/commands/start/command.js.map +1 -1
- package/lib/commands/start-prod/command.d.ts +1 -1
- package/lib/commands/start-prod/command.js.map +1 -1
- package/lib/commands/static/application.js +4 -4
- package/lib/commands/static/application.js.map +1 -1
- package/lib/commands/static/command.d.ts +1 -1
- package/lib/commands/static/command.js.map +1 -1
- package/lib/commands/static/generate.js +2 -2
- package/lib/commands/static/generate.js.map +1 -1
- package/lib/commands/static/server.d.ts +2 -1
- package/lib/commands/static/server.js +1 -1
- package/lib/commands/static/server.js.map +1 -1
- package/lib/commands/static/staticServer.d.ts +2 -1
- package/lib/commands/static/staticServer.js +1 -1
- package/lib/commands/static/staticServer.js.map +1 -1
- package/lib/commands/update/updatePackageJson.js +3 -0
- package/lib/commands/update/updatePackageJson.js.map +1 -1
- package/lib/config/configManager.d.ts +12 -73
- package/lib/config/configManager.js +61 -92
- package/lib/config/configManager.js.map +1 -1
- package/lib/config/showConfig.d.ts +1 -1
- package/lib/config/showConfig.js +1 -1
- package/lib/config/showConfig.js.map +1 -1
- package/lib/config/validate.d.ts +5 -4
- package/lib/config/validate.js +2 -9
- package/lib/config/validate.js.map +1 -1
- package/lib/di/tokens/config.d.ts +106 -1
- package/lib/di/tokens/config.js.map +1 -1
- package/lib/external/config.d.ts +2 -2
- package/lib/library/babel/index.js +1 -0
- 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/webpack/application/client/common.js +6 -4
- package/lib/library/webpack/application/client/common.js.map +1 -1
- package/lib/library/webpack/application/client/dev.js +9 -8
- package/lib/library/webpack/application/client/dev.js.map +1 -1
- package/lib/library/webpack/application/client/prod/optimization/splitChunks.js +40 -39
- package/lib/library/webpack/application/client/prod/optimization/splitChunks.js.map +1 -1
- package/lib/library/webpack/application/client/prod.js +3 -4
- package/lib/library/webpack/application/client/prod.js.map +1 -1
- package/lib/library/webpack/application/server/common.js +5 -5
- package/lib/library/webpack/application/server/common.js.map +1 -1
- package/lib/library/webpack/application/server/dev.js +3 -6
- package/lib/library/webpack/application/server/dev.js.map +1 -1
- package/lib/library/webpack/application/server/prod.js +3 -4
- package/lib/library/webpack/application/server/prod.js.map +1 -1
- package/lib/library/webpack/blocks/apiResolve.js +1 -1
- package/lib/library/webpack/blocks/apiResolve.js.map +1 -1
- package/lib/library/webpack/blocks/configResolve.js +2 -2
- package/lib/library/webpack/blocks/configResolve.js.map +1 -1
- package/lib/library/webpack/blocks/configToEnv.js +5 -2
- package/lib/library/webpack/blocks/configToEnv.js.map +1 -1
- package/lib/library/webpack/blocks/css.d.ts +3 -1
- package/lib/library/webpack/blocks/css.js +17 -6
- package/lib/library/webpack/blocks/css.js.map +1 -1
- package/lib/library/webpack/blocks/extractCssPlugin.d.ts +4 -3
- package/lib/library/webpack/blocks/extractCssPlugin.js +4 -6
- package/lib/library/webpack/blocks/extractCssPlugin.js.map +1 -1
- package/lib/library/webpack/blocks/filesClient.d.ts +3 -2
- package/lib/library/webpack/blocks/filesClient.js +7 -7
- package/lib/library/webpack/blocks/filesClient.js.map +1 -1
- package/lib/library/webpack/blocks/filesServer.d.ts +2 -1
- package/lib/library/webpack/blocks/filesServer.js +3 -3
- package/lib/library/webpack/blocks/filesServer.js.map +1 -1
- package/lib/library/webpack/blocks/js.d.ts +2 -1
- package/lib/library/webpack/blocks/js.js +1 -1
- package/lib/library/webpack/blocks/js.js.map +1 -1
- package/lib/library/webpack/blocks/nodeClient.d.ts +2 -1
- package/lib/library/webpack/blocks/nodeClient.js +2 -2
- package/lib/library/webpack/blocks/nodeClient.js.map +1 -1
- package/lib/library/webpack/blocks/optimize.d.ts +2 -1
- package/lib/library/webpack/blocks/optimize.js +3 -3
- package/lib/library/webpack/blocks/optimize.js.map +1 -1
- package/lib/library/webpack/blocks/pagesResolve.js +1 -1
- package/lib/library/webpack/blocks/pagesResolve.js.map +1 -1
- package/lib/library/webpack/blocks/postcssAssets.d.ts +2 -1
- package/lib/library/webpack/blocks/postcssAssets.js +2 -2
- package/lib/library/webpack/blocks/postcssAssets.js.map +1 -1
- package/lib/library/webpack/blocks/serverInline.d.ts +2 -1
- package/lib/library/webpack/blocks/serverInline.js.map +1 -1
- package/lib/library/webpack/blocks/ts.d.ts +2 -1
- package/lib/library/webpack/blocks/ts.js.map +1 -1
- package/lib/library/webpack/child-app/client/common.d.ts +2 -2
- package/lib/library/webpack/child-app/client/common.js +1 -1
- package/lib/library/webpack/child-app/client/common.js.map +1 -1
- package/lib/library/webpack/child-app/client/dev.d.ts +2 -2
- package/lib/library/webpack/child-app/client/dev.js +6 -5
- package/lib/library/webpack/child-app/client/dev.js.map +1 -1
- package/lib/library/webpack/child-app/client/prod.d.ts +2 -2
- package/lib/library/webpack/child-app/client/prod.js.map +1 -1
- package/lib/library/webpack/child-app/common.d.ts +2 -2
- package/lib/library/webpack/child-app/common.js.map +1 -1
- package/lib/library/webpack/child-app/server/common.d.ts +2 -2
- package/lib/library/webpack/child-app/server/common.js +1 -1
- package/lib/library/webpack/child-app/server/common.js.map +1 -1
- package/lib/library/webpack/child-app/server/dev.d.ts +2 -2
- package/lib/library/webpack/child-app/server/dev.js.map +1 -1
- package/lib/library/webpack/child-app/server/prod.d.ts +2 -2
- package/lib/library/webpack/child-app/server/prod.js.map +1 -1
- package/lib/library/webpack/common/client/prod.d.ts +2 -1
- package/lib/library/webpack/common/client/prod.js +4 -5
- package/lib/library/webpack/common/client/prod.js.map +1 -1
- package/lib/library/webpack/common/main.d.ts +2 -1
- package/lib/library/webpack/common/main.js +3 -3
- package/lib/library/webpack/common/main.js.map +1 -1
- package/lib/library/webpack/common/server/prod.d.ts +2 -1
- package/lib/library/webpack/common/server/prod.js +4 -5
- package/lib/library/webpack/common/server/prod.js.map +1 -1
- package/lib/library/webpack/index.js +1 -2
- package/lib/library/webpack/index.js.map +1 -1
- package/lib/library/webpack/loaders/image-loader/index.d.ts +2 -1
- package/lib/library/webpack/loaders/image-loader/index.js.map +1 -1
- package/lib/library/webpack/loaders/pagesResolve.d.ts +10 -1
- package/lib/library/webpack/loaders/pagesResolve.js +4 -3
- package/lib/library/webpack/loaders/pagesResolve.js.map +1 -1
- package/lib/library/webpack/loaders/replaceContent.d.ts +6 -1
- package/lib/library/webpack/loaders/replaceContent.js +4 -3
- package/lib/library/webpack/loaders/replaceContent.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.d.ts +1 -1
- package/lib/library/webpack/module/externals.js.map +1 -1
- package/lib/library/webpack/module/resolveExternal.d.ts +1 -1
- package/lib/library/webpack/module/resolveExternal.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/LazyModuleInitialization.d.ts +2 -2
- package/lib/library/webpack/plugins/LazyModuleInitialization.js +1 -0
- package/lib/library/webpack/plugins/LazyModuleInitialization.js.map +1 -1
- package/lib/library/webpack/plugins/WebpackBar/utils/index.d.ts +7 -7
- package/lib/library/webpack/plugins/WebpackBar/utils/index.js.map +1 -1
- package/lib/library/webpack/plugins/WebpackBar/utils/webpack.d.ts +2 -2
- package/lib/library/webpack/plugins/WebpackBar/utils/webpack.js.map +1 -1
- package/lib/library/webpack/types/webpack.d.ts +2 -2
- package/lib/library/webpack/utils/files.d.ts +4 -3
- package/lib/library/webpack/utils/files.js +2 -2
- package/lib/library/webpack/utils/files.js.map +1 -1
- package/lib/library/webpack/utils/transpiler.d.ts +3 -2
- package/lib/library/webpack/utils/transpiler.js +2 -2
- package/lib/library/webpack/utils/transpiler.js.map +1 -1
- package/lib/library/webpack/utils/workersPool.d.ts +3 -6
- package/lib/library/webpack/utils/workersPool.js +1 -1
- package/lib/library/webpack/utils/workersPool.js.map +1 -1
- package/lib/models/config.d.ts +2 -3
- package/lib/models/config.js +32 -3
- package/lib/models/config.js.map +1 -1
- package/lib/schema/ConfigSchema.d.ts +13 -4
- package/lib/schema/autogeneratedSchema.json +1808 -2074
- package/lib/typings/configEntry/application.d.ts +81 -86
- package/lib/typings/configEntry/child-app.d.ts +10 -29
- package/lib/typings/configEntry/cli.d.ts +254 -0
- package/lib/typings/configEntry/{CheckAsyncTsConfig.js → cli.js} +1 -1
- package/lib/typings/configEntry/cli.js.map +1 -0
- package/lib/typings/configEntry/common.d.ts +16 -276
- package/lib/typings/configEntry/common.js +15 -0
- package/lib/typings/configEntry/common.js.map +1 -1
- package/lib/typings/configEntry/module.d.ts +10 -29
- package/lib/typings/configEntry/package.d.ts +2 -1
- package/lib/ui/commander.js +1 -1
- package/lib/ui/commander.js.map +1 -1
- package/lib/utils/applyTemplate.js.map +1 -1
- package/lib/utils/safeRequire.js +5 -1
- package/lib/utils/safeRequire.js.map +1 -1
- package/lib/utils/webpackBuild.d.ts +2 -1
- package/lib/utils/webpackBuild.js +3 -3
- package/lib/utils/webpackBuild.js.map +1 -1
- package/package.json +13 -9
- package/schema.json +1802 -2068
- package/src/api/analyze/providers/shared.ts +3 -2
- package/src/api/benchmark/__integration__/__fixtures__/tramvai.json +1 -8
- package/src/api/benchmark/index.ts +1 -1
- package/src/api/build/__integration__/__fixtures__/app/App.tsx +0 -1
- package/src/api/build/__integration__/__fixtures__/app/index.tsx +14 -8
- package/src/api/build/__integration__/__fixtures__/app/server.tsx +0 -1
- package/src/api/build/__integration__/__fixtures__/tramvai.json +1 -10
- package/src/api/build/__integration__/build.test.ts +4 -13
- package/src/api/build/child-app.ts +4 -4
- package/src/api/build/module.ts +2 -4
- package/src/api/build/providers/shared.ts +2 -2
- package/src/api/index.ts +6 -2
- package/src/api/shared/types/withConfig.ts +5 -6
- package/src/api/start/__integration__/__fixtures__/app/index.tsx +11 -7
- package/src/api/start/__integration__/__fixtures__/tramvai.json +6 -17
- package/src/api/start/__integration__/start.test.ts +1 -12
- package/src/api/start/providers/application/shared.ts +2 -2
- package/src/api/start/providers/child-app/shared.ts +9 -14
- package/src/api/start/providers/module/shared.ts +19 -30
- package/src/api/start/utils/banner.ts +3 -2
- package/src/api/start/utils/tips/tips.ts +11 -8
- package/src/api/start-prod/providers/application.ts +10 -14
- package/src/api/start-prod/providers/child-app.ts +4 -5
- package/src/api/start-prod/providers/shared.ts +4 -8
- package/src/builder/webpack/devServer/client.ts +22 -15
- package/src/builder/webpack/devServer/notifier.ts +6 -6
- package/src/builder/webpack/devServer/pool/process/pool.ts +3 -3
- package/src/builder/webpack/devServer/pool/thread/pool.ts +7 -0
- package/src/builder/webpack/devServer/server.ts +13 -6
- package/src/builder/webpack/providers/analyze/shared.ts +3 -2
- package/src/builder/webpack/providers/build/application/server.ts +5 -1
- package/src/builder/webpack/providers/build/client.ts +3 -2
- package/src/builder/webpack/providers/build/server.ts +1 -1
- package/src/builder/webpack/tokens.ts +4 -3
- package/src/builder/webpack/utils/copyBuildFile.ts +4 -5
- package/src/builder/webpack/utils/copyStatsJsonFile.ts +5 -2
- package/src/cli/CLI.ts +6 -6
- package/src/cli/index.ts +1 -1
- package/src/commands/analyze/command.ts +1 -1
- package/src/commands/benchmark/command.ts +1 -1
- package/src/commands/build/command.ts +2 -2
- package/src/commands/new/new.ts +0 -1
- package/src/commands/new/questions/packageManager.ts +1 -1
- package/src/commands/new/questions/template.ts +1 -1
- package/src/commands/new/questions/testingFramework.ts +1 -1
- package/src/commands/new/questions/type.ts +1 -1
- package/src/commands/new/steps/initializationGit.ts +1 -1
- package/src/commands/new/templates/app/monorepo/tramvai.json.hbs +6 -32
- package/src/commands/new/templates/app/multirepo/tramvai.json.hbs +6 -23
- package/src/commands/new/templates/child-app/monorepo/tramvai.json.hbs +3 -18
- package/src/commands/new/templates/child-app/multirepo/tramvai.json.hbs +3 -9
- package/src/commands/start/command.ts +2 -2
- package/src/commands/start-prod/command.ts +2 -2
- package/src/commands/static/application.ts +5 -14
- package/src/commands/static/command.ts +1 -1
- package/src/commands/static/generate.ts +2 -2
- package/src/commands/static/server.ts +5 -2
- package/src/commands/static/staticServer.ts +6 -3
- package/src/commands/update/updatePackageJson.ts +6 -2
- package/src/config/configManager.spec.ts +49 -0
- package/src/config/configManager.ts +123 -197
- package/src/config/showConfig.ts +2 -2
- package/src/config/validate.ts +14 -25
- package/src/di/tokens/config.ts +2 -1
- package/src/library/babel/index.ts +1 -0
- package/src/library/swc/__integration__/swc.build.test.ts +3 -21
- package/src/library/swc/__integration__/swc.start.test.ts +3 -21
- package/src/library/swc/index.ts +1 -1
- package/src/library/webpack/application/client/common.ts +7 -7
- package/src/library/webpack/application/client/dev.ts +9 -9
- package/src/library/webpack/application/client/prod/optimization/splitChunks.ts +43 -44
- package/src/library/webpack/application/client/prod.ts +3 -5
- package/src/library/webpack/application/server/common.ts +5 -8
- package/src/library/webpack/application/server/dev.ts +5 -6
- package/src/library/webpack/application/server/prod.ts +3 -9
- package/src/library/webpack/blocks/apiResolve.ts +1 -1
- package/src/library/webpack/blocks/configResolve.ts +2 -2
- package/src/library/webpack/blocks/configToEnv.ts +5 -2
- package/src/library/webpack/blocks/css.ts +26 -17
- package/src/library/webpack/blocks/extractCssPlugin.ts +11 -10
- package/src/library/webpack/blocks/filesClient.ts +52 -50
- package/src/library/webpack/blocks/filesServer.ts +4 -3
- package/src/library/webpack/blocks/js.ts +3 -2
- package/src/library/webpack/blocks/nodeClient.ts +4 -3
- package/src/library/webpack/blocks/optimize.ts +5 -6
- package/src/library/webpack/blocks/pagesResolve.ts +1 -1
- package/src/library/webpack/blocks/postcssAssets.ts +6 -7
- package/src/library/webpack/blocks/serverInline.ts +2 -1
- package/src/library/webpack/blocks/ts.ts +2 -1
- package/src/library/webpack/child-app/client/common.ts +3 -3
- package/src/library/webpack/child-app/client/dev.ts +8 -8
- package/src/library/webpack/child-app/client/prod.ts +2 -2
- package/src/library/webpack/child-app/common.ts +2 -2
- package/src/library/webpack/child-app/server/common.ts +3 -3
- package/src/library/webpack/child-app/server/dev.ts +2 -2
- package/src/library/webpack/child-app/server/prod.ts +2 -2
- package/src/library/webpack/common/client/prod.ts +10 -6
- package/src/library/webpack/common/main.ts +9 -4
- package/src/library/webpack/common/server/prod.ts +10 -6
- package/src/library/webpack/index.ts +2 -3
- package/src/library/webpack/loaders/image-loader/index.ts +2 -1
- package/src/library/webpack/loaders/pagesResolve.ts +17 -5
- package/src/library/webpack/loaders/replaceContent.ts +11 -2
- package/src/library/webpack/module/client/common.ts +1 -1
- package/src/library/webpack/module/externals.ts +1 -1
- package/src/library/webpack/module/resolveExternal.ts +1 -1
- package/src/library/webpack/module/server/common.ts +1 -1
- package/src/library/webpack/plugins/LazyModuleInitialization.ts +6 -1
- package/src/library/webpack/plugins/WebpackBar/utils/index.ts +8 -8
- package/src/library/webpack/plugins/WebpackBar/utils/webpack.ts +1 -1
- package/src/library/webpack/types/webpack.ts +2 -2
- package/src/library/webpack/utils/files.ts +4 -3
- package/src/library/webpack/utils/transpiler.ts +6 -11
- package/src/library/webpack/utils/workersPool.ts +6 -9
- package/src/models/config.spec.ts +352 -0
- package/src/models/config.ts +41 -9
- package/src/schema/ConfigSchema.ts +15 -4
- package/src/schema/autogeneratedSchema.json +1808 -2074
- package/src/schema/tramvai.spec.ts +89 -184
- package/src/typings/configEntry/application.ts +85 -87
- package/src/typings/configEntry/child-app.ts +10 -30
- package/src/typings/configEntry/cli.ts +271 -0
- package/src/typings/configEntry/common.ts +26 -278
- package/src/typings/configEntry/module.ts +11 -30
- package/src/typings/configEntry/package.ts +3 -1
- package/src/ui/commander.ts +1 -1
- package/src/utils/applyTemplate.ts +2 -2
- package/src/utils/safeRequire.ts +6 -1
- package/src/utils/webpackBuild.ts +4 -3
- package/lib/library/webpack/plugins/DedupePlugin/DedupePlugin.d.ts +0 -37
- package/lib/library/webpack/plugins/DedupePlugin/DedupePlugin.js +0 -241
- package/lib/library/webpack/plugins/DedupePlugin/DedupePlugin.js.map +0 -1
- package/lib/library/webpack/plugins/DedupePlugin/index.d.ts +0 -1
- package/lib/library/webpack/plugins/DedupePlugin/index.js +0 -6
- package/lib/library/webpack/plugins/DedupePlugin/index.js.map +0 -1
- package/lib/typings/configEntry/CheckAsyncTsConfig.d.ts +0 -13
- package/lib/typings/configEntry/CheckAsyncTsConfig.js.map +0 -1
- package/src/library/webpack/plugins/DedupePlugin/DedupePlugin.spec.ts +0 -95
- package/src/library/webpack/plugins/DedupePlugin/DedupePlugin.ts +0 -307
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-1/index.js +0 -3
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-1/node_modules/package-dep/index.js +0 -1
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-1/node_modules/package-dep/package.json +0 -7
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-1/package.json +0 -7
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-2/index.js +0 -3
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-2/node_modules/package-dep/index.js +0 -1
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-2/node_modules/package-dep/package.json +0 -7
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-2/package.json +0 -7
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-3/index.js +0 -3
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-3/node_modules/package-dep/index.js +0 -1
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-3/node_modules/package-dep/package.json +0 -7
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-3/package.json +0 -7
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-dep/index.js +0 -1
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-dep/package.json +0 -7
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-esm-1/index.js +0 -3
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-esm-1/node_modules/package-esm-dep/index.js +0 -1
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-esm-1/node_modules/package-esm-dep/package.json +0 -8
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-esm-1/package.json +0 -8
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-esm-2/index.js +0 -3
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-esm-2/node_modules/package-esm-dep/index.js +0 -1
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-esm-2/node_modules/package-esm-dep/package.json +0 -8
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/node_modules/package-esm-2/package.json +0 -8
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/package-lock.json +0 -0
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/package.json +0 -14
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/src/index.js +0 -9
- package/src/library/webpack/plugins/DedupePlugin/__fixtures__/dedupe/tramvai.json +0 -67
- package/src/library/webpack/plugins/DedupePlugin/__integration__/DedupePlugin.test.ts +0 -90
- package/src/library/webpack/plugins/DedupePlugin/index.ts +0 -1
- package/src/typings/configEntry/CheckAsyncTsConfig.ts +0 -15
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import readDir from 'fs-readdir-recursive';
|
|
3
3
|
import fs from 'fs';
|
|
4
|
+
import type { LoaderDefinitionFunction } from 'webpack';
|
|
5
|
+
import type { ApplicationConfigEntry } from '../../../api';
|
|
4
6
|
|
|
5
7
|
const LAYOUT_FILENAME = '_layout.tsx';
|
|
6
8
|
const ERROR_BOUNDARY_FILENAME = '_error.tsx';
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
interface Options {
|
|
11
|
+
rootDir: string;
|
|
12
|
+
root: string;
|
|
13
|
+
extensions: string[];
|
|
14
|
+
fileSystemPages: ApplicationConfigEntry['fileSystemPages'];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line func-style
|
|
18
|
+
const pagesResolve: LoaderDefinitionFunction<Options> = function () {
|
|
9
19
|
const { fileSystemPages, rootDir, root, extensions } = this.getOptions();
|
|
10
|
-
const fsLayouts = [];
|
|
11
|
-
const fsErrorBoundaries = [];
|
|
20
|
+
const fsLayouts: string[] = [];
|
|
21
|
+
const fsErrorBoundaries: string[] = [];
|
|
12
22
|
|
|
13
23
|
this.cacheable(false);
|
|
14
24
|
|
|
@@ -24,7 +34,7 @@ export default function () {
|
|
|
24
34
|
this.addContextDependency(pagesDir);
|
|
25
35
|
|
|
26
36
|
// skip files whose name starts with dot or underscore symbols
|
|
27
|
-
const pagesFiles = readDir(pagesDir, (name) => name[0] !== '.' && name[0] !== '_');
|
|
37
|
+
const pagesFiles = readDir(pagesDir, (name: string) => name[0] !== '.' && name[0] !== '_');
|
|
28
38
|
const fsPages = [];
|
|
29
39
|
|
|
30
40
|
for (const file of pagesFiles) {
|
|
@@ -103,4 +113,6 @@ export default function () {
|
|
|
103
113
|
}`;
|
|
104
114
|
|
|
105
115
|
return code;
|
|
106
|
-
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export default pagesResolve;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import type { LoaderDefinition } from 'webpack';
|
|
2
|
+
|
|
3
|
+
interface Options {
|
|
4
|
+
code: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line func-style
|
|
8
|
+
const replaceContent: LoaderDefinition<Options> = function () {
|
|
2
9
|
const { code } = this.getOptions();
|
|
3
10
|
|
|
4
11
|
// выставляем флаг, что данный модуль не кешируется т.к. в контенте могут быть данные которые будут меняться от сборки к сборке,
|
|
@@ -6,4 +13,6 @@ export default function () {
|
|
|
6
13
|
this.cacheable(false);
|
|
7
14
|
|
|
8
15
|
return code;
|
|
9
|
-
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default replaceContent;
|
|
@@ -20,7 +20,7 @@ export default (configManager: ConfigManager<ModuleConfigEntry>) => (config: Con
|
|
|
20
20
|
config.target(['web', 'es5']);
|
|
21
21
|
|
|
22
22
|
config.output
|
|
23
|
-
.path(configManager.
|
|
23
|
+
.path(configManager.buildPath)
|
|
24
24
|
.publicPath('')
|
|
25
25
|
.library(configManager.name)
|
|
26
26
|
.libraryTarget('lazy')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default (name) => ['__externals', name];
|
|
1
|
+
export default (name: string) => ['__externals', name];
|
|
@@ -15,7 +15,7 @@ export default (configManager: ConfigManager<ModuleConfigEntry>) => (config: Con
|
|
|
15
15
|
config.target('node');
|
|
16
16
|
|
|
17
17
|
config.output
|
|
18
|
-
.path(configManager.
|
|
18
|
+
.path(configManager.buildPath)
|
|
19
19
|
.publicPath('')
|
|
20
20
|
.filename('[name]_server.js')
|
|
21
21
|
.chunkFilename('[name]_server.chunk.js')
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Compiler, LibraryOptions } from 'webpack';
|
|
2
2
|
import { library, sources } from 'webpack';
|
|
3
|
+
// @ts-ignore
|
|
3
4
|
// eslint-disable-next-line no-restricted-imports
|
|
4
5
|
import ExportPropertyLibraryPlugin from 'webpack/lib/library/ExportPropertyLibraryPlugin';
|
|
5
6
|
|
|
@@ -35,7 +36,11 @@ export default class LazyModuleInitialization extends library.AbstractLibraryPlu
|
|
|
35
36
|
};
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
render(
|
|
39
|
+
render(
|
|
40
|
+
source: sources.Source,
|
|
41
|
+
context: unknown,
|
|
42
|
+
{ options: { name } }: { options: { name: string } }
|
|
43
|
+
) {
|
|
39
44
|
// оборачиваем код модуля в lazy-обёртку
|
|
40
45
|
return new sources.ConcatSource(
|
|
41
46
|
'window.__externals = window.__externals || {};\n',
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
import { sep } from 'path';
|
|
2
2
|
|
|
3
|
-
export function first(arr) {
|
|
3
|
+
export function first<T>(arr: T[]): T {
|
|
4
4
|
return arr[0];
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
export function last(arr) {
|
|
7
|
+
export function last<T>(arr: T[]): T | null {
|
|
8
8
|
return arr.length ? arr[arr.length - 1] : null;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export function startCase(str) {
|
|
11
|
+
export function startCase(str: string) {
|
|
12
12
|
return str[0].toUpperCase() + str.substr(1);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export function firstMatch(regex, str) {
|
|
15
|
+
export function firstMatch(regex: RegExp, str: string) {
|
|
16
16
|
const m = regex.exec(str);
|
|
17
17
|
return m ? m[0] : null;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export function hasValue(s) {
|
|
20
|
+
export function hasValue(s: any) {
|
|
21
21
|
return s && s.length;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export function removeAfter(delimiter, str) {
|
|
24
|
+
export function removeAfter(delimiter: string, str: string) {
|
|
25
25
|
return first(str.split(delimiter)) || '';
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export function removeBefore(delimiter, str) {
|
|
28
|
+
export function removeBefore(delimiter: string, str: string) {
|
|
29
29
|
return last(str.split(delimiter)) || '';
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export function range(len) {
|
|
32
|
+
export function range(len: number) {
|
|
33
33
|
const arr = [];
|
|
34
34
|
for (let i = 0; i < len; i++) {
|
|
35
35
|
arr.push(i);
|
|
@@ -4,7 +4,7 @@ import { nodeModules, NEXT } from './consts';
|
|
|
4
4
|
|
|
5
5
|
import { removeAfter, removeBefore, hasValue, firstMatch } from '.';
|
|
6
6
|
|
|
7
|
-
export const parseRequest = (requestStr) => {
|
|
7
|
+
export const parseRequest = (requestStr: string) => {
|
|
8
8
|
const parts = (requestStr || '').split('!');
|
|
9
9
|
|
|
10
10
|
const file = path.relative(
|
|
@@ -6,7 +6,7 @@ export type ModuleFederationPluginOptions = ConstructorParameters<
|
|
|
6
6
|
|
|
7
7
|
export type ModuleFederationSharedObject = Record<
|
|
8
8
|
string,
|
|
9
|
-
Exclude<Exclude<ModuleFederationPluginOptions['shared'], any[]>[string], string>
|
|
9
|
+
Exclude<Exclude<Required<ModuleFederationPluginOptions>['shared'], any[]>[string], string>
|
|
10
10
|
>;
|
|
11
11
|
|
|
12
|
-
export type SplitChunksOptions = Configuration['optimization']['splitChunks'];
|
|
12
|
+
export type SplitChunksOptions = Required<Required<Configuration>['optimization']>['splitChunks'];
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type Config from 'webpack-chain';
|
|
2
2
|
import type { ConfigManager } from '../../../config/configManager';
|
|
3
|
+
import type { CliConfigEntry } from '../../../typings/configEntry/cli';
|
|
3
4
|
import { addTranspilerLoader, getTranspilerConfig } from './transpiler';
|
|
4
5
|
|
|
5
6
|
export const addSvgrLoader = (
|
|
6
|
-
configManager: ConfigManager
|
|
7
|
+
configManager: ConfigManager<CliConfigEntry>,
|
|
7
8
|
config: Config,
|
|
8
9
|
svgoOptions: Record<string, any>
|
|
9
10
|
) => {
|
|
@@ -23,9 +24,9 @@ export const addSvgrLoader = (
|
|
|
23
24
|
svgrConfig.use('svgr').loader('@svgr/webpack').options({ babel: false, svgo: svgoOptions }).end();
|
|
24
25
|
};
|
|
25
26
|
|
|
26
|
-
export const getSvgoOptions = (configManager: ConfigManager) => {
|
|
27
|
+
export const getSvgoOptions = (configManager: ConfigManager<CliConfigEntry>) => {
|
|
27
28
|
return {
|
|
28
|
-
plugins: configManager.
|
|
29
|
+
plugins: configManager.svgo?.plugins ?? [
|
|
29
30
|
{
|
|
30
31
|
cleanupIDs: false,
|
|
31
32
|
},
|
|
@@ -5,6 +5,7 @@ import { getSwcOptions } from '../../swc';
|
|
|
5
5
|
import babelConfig from '../../babel';
|
|
6
6
|
import type { Env } from '../../../typings/Env';
|
|
7
7
|
import type { Target } from '../../../typings/target';
|
|
8
|
+
import type { CliConfigEntry } from '../../../typings/configEntry/cli';
|
|
8
9
|
|
|
9
10
|
export type TranspilerConfig = {
|
|
10
11
|
env: Env;
|
|
@@ -25,7 +26,7 @@ export type TranspilerConfig = {
|
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
export const addTranspilerLoader = (
|
|
28
|
-
configManager: ConfigManager
|
|
29
|
+
configManager: ConfigManager<CliConfigEntry>,
|
|
29
30
|
rule: Config.Use,
|
|
30
31
|
transpilerConfig: TranspilerConfig
|
|
31
32
|
) => {
|
|
@@ -49,16 +50,10 @@ Please run "tramvai add --dev @tramvai/swc-integration" to fix the problem
|
|
|
49
50
|
};
|
|
50
51
|
|
|
51
52
|
export const getTranspilerConfig = (
|
|
52
|
-
configManager: ConfigManager
|
|
53
|
+
configManager: ConfigManager<CliConfigEntry>,
|
|
53
54
|
overrideOptions: Partial<TranspilerConfig> = {}
|
|
54
55
|
): TranspilerConfig => {
|
|
55
|
-
const {
|
|
56
|
-
generateDataQaTag,
|
|
57
|
-
alias,
|
|
58
|
-
removeTypeofWindow,
|
|
59
|
-
enableFillActionNamePlugin,
|
|
60
|
-
excludesPresetEnv,
|
|
61
|
-
} = configManager.build.configurations;
|
|
56
|
+
const { generateDataQaTag, alias, enableFillActionNamePlugin, excludesPresetEnv } = configManager;
|
|
62
57
|
const { env, modern } = configManager;
|
|
63
58
|
|
|
64
59
|
return {
|
|
@@ -68,8 +63,8 @@ export const getTranspilerConfig = (
|
|
|
68
63
|
modern,
|
|
69
64
|
alias,
|
|
70
65
|
tramvai: true,
|
|
71
|
-
removeTypeofWindow,
|
|
72
|
-
hot: configManager.hotRefresh,
|
|
66
|
+
removeTypeofWindow: true,
|
|
67
|
+
hot: !!configManager.hotRefresh.enabled,
|
|
73
68
|
excludesPresetEnv,
|
|
74
69
|
enableFillActionNamePlugin,
|
|
75
70
|
rootDir: configManager.rootDir,
|
|
@@ -2,6 +2,7 @@ import * as threadLoader from 'thread-loader';
|
|
|
2
2
|
import { getPool } from 'thread-loader/dist/workerPools';
|
|
3
3
|
import os from 'os';
|
|
4
4
|
import type { ConfigManager } from '../../../config/configManager';
|
|
5
|
+
import type { CliConfigEntry } from '../../../typings/configEntry/cli';
|
|
5
6
|
|
|
6
7
|
// fork https://github.com/webpack-contrib/thread-loader/blob/76535bfaafd70bd1ec50e66541d2ad8a64175880/src/workerPools.js#L6
|
|
7
8
|
function getCpuNumber() {
|
|
@@ -15,17 +16,13 @@ function calculateNumberOfWorkers() {
|
|
|
15
16
|
return Math.max(1, cpus / 2 - 1);
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
const getCustomConfig = (configManager: ConfigManager) => {
|
|
19
|
-
const {
|
|
20
|
-
build: {
|
|
21
|
-
configurations: { threadLoader: additionalConfig },
|
|
22
|
-
},
|
|
23
|
-
} = configManager;
|
|
19
|
+
const getCustomConfig = (configManager: ConfigManager<CliConfigEntry>): any => {
|
|
20
|
+
const { threadLoader: additionalConfig } = configManager;
|
|
24
21
|
|
|
25
22
|
return additionalConfig || {};
|
|
26
23
|
};
|
|
27
24
|
|
|
28
|
-
const createTranspilerConfig = (configManager: ConfigManager) => {
|
|
25
|
+
const createTranspilerConfig = (configManager: ConfigManager<CliConfigEntry>) => {
|
|
29
26
|
return {
|
|
30
27
|
name: 'transpiler',
|
|
31
28
|
poolTimeout: configManager.env === 'development' ? Infinity : undefined,
|
|
@@ -34,7 +31,7 @@ const createTranspilerConfig = (configManager: ConfigManager) => {
|
|
|
34
31
|
};
|
|
35
32
|
};
|
|
36
33
|
|
|
37
|
-
export const createWorkerPoolTranspiler = (configManager: ConfigManager) => {
|
|
34
|
+
export const createWorkerPoolTranspiler = (configManager: ConfigManager<CliConfigEntry>) => {
|
|
38
35
|
const config = createTranspilerConfig(configManager);
|
|
39
36
|
|
|
40
37
|
if (!(createWorkerPoolTranspiler as any).warmup) {
|
|
@@ -56,6 +53,6 @@ export const createWorkerPoolTranspiler = (configManager: ConfigManager) => {
|
|
|
56
53
|
return config;
|
|
57
54
|
};
|
|
58
55
|
|
|
59
|
-
export const closeWorkerPoolTranspiler = (configManager: ConfigManager) => {
|
|
56
|
+
export const closeWorkerPoolTranspiler = (configManager: ConfigManager<CliConfigEntry>) => {
|
|
60
57
|
getPool(createTranspilerConfig(configManager))?.disposeWorkers();
|
|
61
58
|
};
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { ConfigManager } from './config';
|
|
2
|
+
|
|
3
|
+
const syncConfigFile = jest.fn();
|
|
4
|
+
|
|
5
|
+
it('should populate defaults for config', () => {
|
|
6
|
+
const config: any = {
|
|
7
|
+
projects: {
|
|
8
|
+
app: {
|
|
9
|
+
name: 'test-app',
|
|
10
|
+
root: 'src',
|
|
11
|
+
type: 'application',
|
|
12
|
+
},
|
|
13
|
+
'child-app': {
|
|
14
|
+
name: 'test-child-app',
|
|
15
|
+
root: 'packages/child-app',
|
|
16
|
+
type: 'child-app',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const configManager = new ConfigManager({ config, syncConfigFile });
|
|
22
|
+
|
|
23
|
+
expect(configManager.config).toMatchInlineSnapshot(`
|
|
24
|
+
{
|
|
25
|
+
"projects": {
|
|
26
|
+
"app": {
|
|
27
|
+
"checkAsyncTs": false,
|
|
28
|
+
"cssMinimize": "css-minimizer",
|
|
29
|
+
"dedupe": {
|
|
30
|
+
"enabled": true,
|
|
31
|
+
"strategy": "equality",
|
|
32
|
+
},
|
|
33
|
+
"define": {
|
|
34
|
+
"development": {},
|
|
35
|
+
"production": {},
|
|
36
|
+
"shared": {},
|
|
37
|
+
},
|
|
38
|
+
"enableFillActionNamePlugin": false,
|
|
39
|
+
"experiments": {
|
|
40
|
+
"minicss": {
|
|
41
|
+
"useImportModule": true,
|
|
42
|
+
},
|
|
43
|
+
"serverRunner": "process",
|
|
44
|
+
"transpilation": {
|
|
45
|
+
"loader": "babel",
|
|
46
|
+
},
|
|
47
|
+
"webpack": {
|
|
48
|
+
"backCompat": false,
|
|
49
|
+
"cacheUnaffected": true,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
"externals": [],
|
|
53
|
+
"fileSystemPages": {
|
|
54
|
+
"enabled": false,
|
|
55
|
+
"pagesDir": "pages",
|
|
56
|
+
"routesDir": "routes",
|
|
57
|
+
},
|
|
58
|
+
"generateDataQaTag": false,
|
|
59
|
+
"hotRefresh": {
|
|
60
|
+
"enabled": true,
|
|
61
|
+
},
|
|
62
|
+
"modern": true,
|
|
63
|
+
"name": "test-app",
|
|
64
|
+
"notifications": {},
|
|
65
|
+
"output": {
|
|
66
|
+
"client": "dist/client",
|
|
67
|
+
"server": "dist/server",
|
|
68
|
+
"static": "dist/static",
|
|
69
|
+
},
|
|
70
|
+
"postcss": {},
|
|
71
|
+
"root": "src",
|
|
72
|
+
"serverApiDir": "src/api",
|
|
73
|
+
"sourceMap": false,
|
|
74
|
+
"splitChunks": {
|
|
75
|
+
"commonChunkSplitNumber": 3,
|
|
76
|
+
"granularChunksMinSize": 20000,
|
|
77
|
+
"granularChunksSplitNumber": 2,
|
|
78
|
+
"mode": "granularChunks",
|
|
79
|
+
},
|
|
80
|
+
"terser": {
|
|
81
|
+
"parallel": true,
|
|
82
|
+
},
|
|
83
|
+
"transpileOnlyModernLibs": true,
|
|
84
|
+
"type": "application",
|
|
85
|
+
"webpack": {},
|
|
86
|
+
},
|
|
87
|
+
"child-app": {
|
|
88
|
+
"cssMinimize": "css-minimizer",
|
|
89
|
+
"dedupe": {
|
|
90
|
+
"enabled": true,
|
|
91
|
+
"strategy": "equality",
|
|
92
|
+
},
|
|
93
|
+
"define": {
|
|
94
|
+
"development": {},
|
|
95
|
+
"production": {},
|
|
96
|
+
"shared": {},
|
|
97
|
+
},
|
|
98
|
+
"enableFillActionNamePlugin": false,
|
|
99
|
+
"experiments": {
|
|
100
|
+
"minicss": {
|
|
101
|
+
"useImportModule": true,
|
|
102
|
+
},
|
|
103
|
+
"transpilation": {
|
|
104
|
+
"loader": "babel",
|
|
105
|
+
},
|
|
106
|
+
"webpack": {
|
|
107
|
+
"backCompat": false,
|
|
108
|
+
"cacheUnaffected": true,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
"generateDataQaTag": false,
|
|
112
|
+
"hotRefresh": {
|
|
113
|
+
"enabled": true,
|
|
114
|
+
},
|
|
115
|
+
"name": "test-child-app",
|
|
116
|
+
"notifications": {},
|
|
117
|
+
"output": "dist/child-app",
|
|
118
|
+
"postcss": {
|
|
119
|
+
"cssLocalIdentName": "[hash:base64:5]",
|
|
120
|
+
},
|
|
121
|
+
"root": "packages/child-app",
|
|
122
|
+
"sourceMap": false,
|
|
123
|
+
"terser": {
|
|
124
|
+
"parallel": true,
|
|
125
|
+
},
|
|
126
|
+
"transpileOnlyModernLibs": true,
|
|
127
|
+
"type": "child-app",
|
|
128
|
+
"webpack": {},
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
}
|
|
132
|
+
`);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it('should populate defaults for overridable options', () => {
|
|
136
|
+
const config: any = {
|
|
137
|
+
projects: {
|
|
138
|
+
app: {
|
|
139
|
+
name: 'test-app',
|
|
140
|
+
root: 'src',
|
|
141
|
+
type: 'application',
|
|
142
|
+
output: {
|
|
143
|
+
client: 'assets/compiled',
|
|
144
|
+
},
|
|
145
|
+
sourceMap: false,
|
|
146
|
+
externals: ['test'],
|
|
147
|
+
fileSystemPages: { enabled: true },
|
|
148
|
+
experiments: {
|
|
149
|
+
webpack: {
|
|
150
|
+
backCompat: true,
|
|
151
|
+
},
|
|
152
|
+
transpilation: {
|
|
153
|
+
loader: {
|
|
154
|
+
development: 'swc',
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
dedupe: {
|
|
159
|
+
strategy: 'semver',
|
|
160
|
+
},
|
|
161
|
+
define: {
|
|
162
|
+
shared: {
|
|
163
|
+
'process.env.APP_ID': 'app',
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
svgo: {
|
|
167
|
+
plugins: [
|
|
168
|
+
{
|
|
169
|
+
'test-plugin': true,
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
'child-app': {
|
|
175
|
+
name: 'test-child-app',
|
|
176
|
+
root: 'packages/child-app',
|
|
177
|
+
type: 'child-app',
|
|
178
|
+
sourceMap: {
|
|
179
|
+
development: true,
|
|
180
|
+
},
|
|
181
|
+
experiments: {
|
|
182
|
+
transpilation: {
|
|
183
|
+
loader: {},
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
define: {
|
|
187
|
+
shared: {
|
|
188
|
+
commonProp: 'unknown',
|
|
189
|
+
},
|
|
190
|
+
production: {
|
|
191
|
+
'process.env.PROD': 'true',
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
webpack: {
|
|
195
|
+
resolveAlias: {
|
|
196
|
+
stream: 'browser-stream',
|
|
197
|
+
},
|
|
198
|
+
provide: {
|
|
199
|
+
Buffer: ['buffer', 'Buffer'],
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const configManager = new ConfigManager({ config, syncConfigFile });
|
|
207
|
+
|
|
208
|
+
expect(configManager.config).toMatchInlineSnapshot(`
|
|
209
|
+
{
|
|
210
|
+
"projects": {
|
|
211
|
+
"app": {
|
|
212
|
+
"checkAsyncTs": false,
|
|
213
|
+
"cssMinimize": "css-minimizer",
|
|
214
|
+
"dedupe": {
|
|
215
|
+
"enabled": true,
|
|
216
|
+
"strategy": "semver",
|
|
217
|
+
},
|
|
218
|
+
"define": {
|
|
219
|
+
"development": {},
|
|
220
|
+
"production": {},
|
|
221
|
+
"shared": {
|
|
222
|
+
"process.env.APP_ID": "app",
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
"enableFillActionNamePlugin": false,
|
|
226
|
+
"experiments": {
|
|
227
|
+
"minicss": {
|
|
228
|
+
"useImportModule": true,
|
|
229
|
+
},
|
|
230
|
+
"serverRunner": "process",
|
|
231
|
+
"transpilation": {
|
|
232
|
+
"loader": {
|
|
233
|
+
"development": "swc",
|
|
234
|
+
"production": "babel",
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
"webpack": {
|
|
238
|
+
"backCompat": true,
|
|
239
|
+
"cacheUnaffected": true,
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
"externals": [
|
|
243
|
+
"test",
|
|
244
|
+
],
|
|
245
|
+
"fileSystemPages": {
|
|
246
|
+
"enabled": true,
|
|
247
|
+
"pagesDir": "pages",
|
|
248
|
+
"routesDir": "routes",
|
|
249
|
+
},
|
|
250
|
+
"generateDataQaTag": false,
|
|
251
|
+
"hotRefresh": {
|
|
252
|
+
"enabled": true,
|
|
253
|
+
},
|
|
254
|
+
"modern": true,
|
|
255
|
+
"name": "test-app",
|
|
256
|
+
"notifications": {},
|
|
257
|
+
"output": {
|
|
258
|
+
"client": "assets/compiled",
|
|
259
|
+
"server": "dist/server",
|
|
260
|
+
"static": "dist/static",
|
|
261
|
+
},
|
|
262
|
+
"postcss": {},
|
|
263
|
+
"root": "src",
|
|
264
|
+
"serverApiDir": "src/api",
|
|
265
|
+
"sourceMap": false,
|
|
266
|
+
"splitChunks": {
|
|
267
|
+
"commonChunkSplitNumber": 3,
|
|
268
|
+
"granularChunksMinSize": 20000,
|
|
269
|
+
"granularChunksSplitNumber": 2,
|
|
270
|
+
"mode": "granularChunks",
|
|
271
|
+
},
|
|
272
|
+
"svgo": {
|
|
273
|
+
"plugins": [
|
|
274
|
+
{
|
|
275
|
+
"test-plugin": true,
|
|
276
|
+
},
|
|
277
|
+
],
|
|
278
|
+
},
|
|
279
|
+
"terser": {
|
|
280
|
+
"parallel": true,
|
|
281
|
+
},
|
|
282
|
+
"transpileOnlyModernLibs": true,
|
|
283
|
+
"type": "application",
|
|
284
|
+
"webpack": {},
|
|
285
|
+
},
|
|
286
|
+
"child-app": {
|
|
287
|
+
"cssMinimize": "css-minimizer",
|
|
288
|
+
"dedupe": {
|
|
289
|
+
"enabled": true,
|
|
290
|
+
"strategy": "equality",
|
|
291
|
+
},
|
|
292
|
+
"define": {
|
|
293
|
+
"development": {},
|
|
294
|
+
"production": {
|
|
295
|
+
"process.env.PROD": "true",
|
|
296
|
+
},
|
|
297
|
+
"shared": {
|
|
298
|
+
"commonProp": "unknown",
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
"enableFillActionNamePlugin": false,
|
|
302
|
+
"experiments": {
|
|
303
|
+
"minicss": {
|
|
304
|
+
"useImportModule": true,
|
|
305
|
+
},
|
|
306
|
+
"transpilation": {
|
|
307
|
+
"loader": {
|
|
308
|
+
"development": "babel",
|
|
309
|
+
"production": "babel",
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
"webpack": {
|
|
313
|
+
"backCompat": false,
|
|
314
|
+
"cacheUnaffected": true,
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
"generateDataQaTag": false,
|
|
318
|
+
"hotRefresh": {
|
|
319
|
+
"enabled": true,
|
|
320
|
+
},
|
|
321
|
+
"name": "test-child-app",
|
|
322
|
+
"notifications": {},
|
|
323
|
+
"output": "dist/child-app",
|
|
324
|
+
"postcss": {
|
|
325
|
+
"cssLocalIdentName": "[hash:base64:5]",
|
|
326
|
+
},
|
|
327
|
+
"root": "packages/child-app",
|
|
328
|
+
"sourceMap": {
|
|
329
|
+
"development": true,
|
|
330
|
+
"production": false,
|
|
331
|
+
},
|
|
332
|
+
"terser": {
|
|
333
|
+
"parallel": true,
|
|
334
|
+
},
|
|
335
|
+
"transpileOnlyModernLibs": true,
|
|
336
|
+
"type": "child-app",
|
|
337
|
+
"webpack": {
|
|
338
|
+
"provide": {
|
|
339
|
+
"Buffer": [
|
|
340
|
+
"buffer",
|
|
341
|
+
"Buffer",
|
|
342
|
+
],
|
|
343
|
+
},
|
|
344
|
+
"resolveAlias": {
|
|
345
|
+
"stream": "browser-stream",
|
|
346
|
+
},
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
}
|
|
351
|
+
`);
|
|
352
|
+
});
|