@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
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`fill-declare-action-name import: do nothing: import: do nothing 1`] = `
|
|
4
|
-
|
|
5
|
-
import { declareAction } from '@tramvai/core';
|
|
6
|
-
|
|
7
|
-
const action = declareAction({
|
|
8
|
-
name: 'action',
|
|
9
|
-
fn: () => {
|
|
10
|
-
console.log('action');
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
const secondAction = declareAction({
|
|
15
|
-
name: 'secondAction',
|
|
16
|
-
fn: () => {
|
|
17
|
-
console.log('second action');
|
|
18
|
-
},
|
|
19
|
-
conditions: {
|
|
20
|
-
onlyBrowser: true,
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
export default declareAction({
|
|
25
|
-
name: 'anonymousAction',
|
|
26
|
-
fn: () => {
|
|
27
|
-
console.log('anonymous action');
|
|
28
|
-
},
|
|
29
|
-
conditions: {
|
|
30
|
-
onlyBrowser: true,
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
↓ ↓ ↓ ↓ ↓ ↓
|
|
35
|
-
|
|
36
|
-
import { declareAction } from '@tramvai/core';
|
|
37
|
-
var action = declareAction({
|
|
38
|
-
name: 'action',
|
|
39
|
-
fn: function fn() {
|
|
40
|
-
console.log('action');
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
var secondAction = declareAction({
|
|
44
|
-
name: 'secondAction',
|
|
45
|
-
fn: function fn() {
|
|
46
|
-
console.log('second action');
|
|
47
|
-
},
|
|
48
|
-
conditions: {
|
|
49
|
-
onlyBrowser: true,
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
export default declareAction({
|
|
53
|
-
name: 'anonymousAction',
|
|
54
|
-
fn: function fn() {
|
|
55
|
-
console.log('anonymous action');
|
|
56
|
-
},
|
|
57
|
-
conditions: {
|
|
58
|
-
onlyBrowser: true,
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
`;
|
|
64
|
-
|
|
65
|
-
exports[`fill-declare-action-name import: fill absent name: import: fill absent name 1`] = `
|
|
66
|
-
|
|
67
|
-
import { declareAction } from '@tramvai/core';
|
|
68
|
-
|
|
69
|
-
const action = declareAction({
|
|
70
|
-
name: 'action',
|
|
71
|
-
fn: () => {
|
|
72
|
-
console.log('action');
|
|
73
|
-
},
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
const secondAction = declareAction({
|
|
77
|
-
fn: () => {
|
|
78
|
-
console.log('second action');
|
|
79
|
-
},
|
|
80
|
-
conditions: {
|
|
81
|
-
onlyBrowser: true,
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
↓ ↓ ↓ ↓ ↓ ↓
|
|
86
|
-
|
|
87
|
-
import { declareAction } from '@tramvai/core';
|
|
88
|
-
var action = declareAction({
|
|
89
|
-
name: 'action',
|
|
90
|
-
fn: function fn() {
|
|
91
|
-
console.log('action');
|
|
92
|
-
},
|
|
93
|
-
});
|
|
94
|
-
var secondAction = declareAction({
|
|
95
|
-
name: 'secondAction__-5f0ssw',
|
|
96
|
-
fn: function fn() {
|
|
97
|
-
console.log('second action');
|
|
98
|
-
},
|
|
99
|
-
conditions: {
|
|
100
|
-
onlyBrowser: true,
|
|
101
|
-
},
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
`;
|
|
106
|
-
|
|
107
|
-
exports[`fill-declare-action-name import: fill all actions: import: fill all actions 1`] = `
|
|
108
|
-
|
|
109
|
-
import { declareAction } from '@tramvai/core';
|
|
110
|
-
|
|
111
|
-
const action = declareAction({
|
|
112
|
-
fn: () => {
|
|
113
|
-
console.log('action');
|
|
114
|
-
},
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
const secondAction = declareAction({
|
|
118
|
-
fn: () => {
|
|
119
|
-
console.log('second action');
|
|
120
|
-
},
|
|
121
|
-
conditions: {
|
|
122
|
-
onlyBrowser: true,
|
|
123
|
-
},
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
export default declareAction({
|
|
127
|
-
fn: () => {
|
|
128
|
-
console.log('anonymous action');
|
|
129
|
-
},
|
|
130
|
-
conditions: {
|
|
131
|
-
onlyBrowser: true,
|
|
132
|
-
},
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
↓ ↓ ↓ ↓ ↓ ↓
|
|
136
|
-
|
|
137
|
-
import { declareAction } from '@tramvai/core';
|
|
138
|
-
var action = declareAction({
|
|
139
|
-
name: 'action__n5c5ae',
|
|
140
|
-
fn: function fn() {
|
|
141
|
-
console.log('action');
|
|
142
|
-
},
|
|
143
|
-
});
|
|
144
|
-
var secondAction = declareAction({
|
|
145
|
-
name: 'secondAction__n5fz8b',
|
|
146
|
-
fn: function fn() {
|
|
147
|
-
console.log('second action');
|
|
148
|
-
},
|
|
149
|
-
conditions: {
|
|
150
|
-
onlyBrowser: true,
|
|
151
|
-
},
|
|
152
|
-
});
|
|
153
|
-
export default declareAction({
|
|
154
|
-
name: 'import-without-name.ts__797bng',
|
|
155
|
-
fn: function fn() {
|
|
156
|
-
console.log('anonymous action');
|
|
157
|
-
},
|
|
158
|
-
conditions: {
|
|
159
|
-
onlyBrowser: true,
|
|
160
|
-
},
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
`;
|
|
165
|
-
|
|
166
|
-
exports[`fill-declare-action-name require: do nothing: require: do nothing 1`] = `
|
|
167
|
-
|
|
168
|
-
// @ts-ignore
|
|
169
|
-
const { declareAction } = require('@tramvai/core');
|
|
170
|
-
|
|
171
|
-
// @ts-ignore
|
|
172
|
-
const action = declareAction({
|
|
173
|
-
name: 'action',
|
|
174
|
-
fn: () => {
|
|
175
|
-
console.log('action');
|
|
176
|
-
},
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
// @ts-ignore
|
|
180
|
-
const secondAction = declareAction({
|
|
181
|
-
name: 'secondAction',
|
|
182
|
-
fn: () => {
|
|
183
|
-
console.log('second action');
|
|
184
|
-
},
|
|
185
|
-
conditions: {
|
|
186
|
-
onlyBrowser: true,
|
|
187
|
-
},
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
↓ ↓ ↓ ↓ ↓ ↓
|
|
191
|
-
|
|
192
|
-
// @ts-ignore
|
|
193
|
-
var _require = require('@tramvai/core'),
|
|
194
|
-
declareAction = _require.declareAction;
|
|
195
|
-
|
|
196
|
-
// @ts-ignore
|
|
197
|
-
var action = declareAction({
|
|
198
|
-
name: 'action',
|
|
199
|
-
fn: function fn() {
|
|
200
|
-
console.log('action');
|
|
201
|
-
},
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
// @ts-ignore
|
|
205
|
-
var secondAction = declareAction({
|
|
206
|
-
name: 'secondAction',
|
|
207
|
-
fn: function fn() {
|
|
208
|
-
console.log('second action');
|
|
209
|
-
},
|
|
210
|
-
conditions: {
|
|
211
|
-
onlyBrowser: true,
|
|
212
|
-
},
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
`;
|
|
217
|
-
|
|
218
|
-
exports[`fill-declare-action-name require: fill all actions: require: fill all actions 1`] = `
|
|
219
|
-
|
|
220
|
-
// @ts-ignore
|
|
221
|
-
const { declareAction } = require('@tramvai/core');
|
|
222
|
-
|
|
223
|
-
// @ts-ignore
|
|
224
|
-
const action = declareAction({
|
|
225
|
-
fn: () => {
|
|
226
|
-
console.log('action');
|
|
227
|
-
},
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
// @ts-ignore
|
|
231
|
-
const secondAction = declareAction({
|
|
232
|
-
fn: () => {
|
|
233
|
-
console.log('second action');
|
|
234
|
-
},
|
|
235
|
-
conditions: {
|
|
236
|
-
onlyBrowser: true,
|
|
237
|
-
},
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
↓ ↓ ↓ ↓ ↓ ↓
|
|
241
|
-
|
|
242
|
-
// @ts-ignore
|
|
243
|
-
var _require = require('@tramvai/core'),
|
|
244
|
-
declareAction = _require.declareAction;
|
|
245
|
-
|
|
246
|
-
// @ts-ignore
|
|
247
|
-
var action = declareAction({
|
|
248
|
-
name: 'action__l6frq0',
|
|
249
|
-
fn: function fn() {
|
|
250
|
-
console.log('action');
|
|
251
|
-
},
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
// @ts-ignore
|
|
255
|
-
var secondAction = declareAction({
|
|
256
|
-
name: 'secondAction__h789zd',
|
|
257
|
-
fn: function fn() {
|
|
258
|
-
console.log('second action');
|
|
259
|
-
},
|
|
260
|
-
conditions: {
|
|
261
|
-
onlyBrowser: true,
|
|
262
|
-
},
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
`;
|
|
@@ -1,381 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`provider-stack add __stack property external providers: add __stack property external providers 1`] = `
|
|
4
|
-
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
// eslint-disable-next-line import/no-unresolved
|
|
7
|
-
import { Provider, Scope } from '@tramvai/core';
|
|
8
|
-
|
|
9
|
-
export const providers: Provider[] = [
|
|
10
|
-
{
|
|
11
|
-
provide: 'a',
|
|
12
|
-
useValue: 1,
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
provide: 'b',
|
|
16
|
-
multi: true,
|
|
17
|
-
deps: {},
|
|
18
|
-
useFactory: () => {},
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
provide: 'c',
|
|
22
|
-
scope: Scope.SINGLETON,
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
24
|
-
useClass: class {},
|
|
25
|
-
},
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
↓ ↓ ↓ ↓ ↓ ↓
|
|
29
|
-
|
|
30
|
-
var _ref, _ref2, _ref3;
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
// eslint-disable-next-line import/no-unresolved
|
|
33
|
-
import { Scope } from '@tramvai/core';
|
|
34
|
-
export var providers = [
|
|
35
|
-
((_ref =
|
|
36
|
-
/*__tramvai_stack_provider__*/
|
|
37
|
-
{
|
|
38
|
-
provide: 'a',
|
|
39
|
-
useValue: 1,
|
|
40
|
-
}),
|
|
41
|
-
Object.defineProperty(_ref, '__stack', {
|
|
42
|
-
enumerable: false,
|
|
43
|
-
value: new Error().stack,
|
|
44
|
-
}),
|
|
45
|
-
_ref),
|
|
46
|
-
((_ref2 =
|
|
47
|
-
/*__tramvai_stack_provider__*/
|
|
48
|
-
{
|
|
49
|
-
provide: 'b',
|
|
50
|
-
multi: true,
|
|
51
|
-
deps: {},
|
|
52
|
-
useFactory: function useFactory() {},
|
|
53
|
-
}),
|
|
54
|
-
Object.defineProperty(_ref2, '__stack', {
|
|
55
|
-
enumerable: false,
|
|
56
|
-
value: new Error().stack,
|
|
57
|
-
}),
|
|
58
|
-
_ref2),
|
|
59
|
-
((_ref3 =
|
|
60
|
-
/*__tramvai_stack_provider__*/
|
|
61
|
-
{
|
|
62
|
-
provide: 'c',
|
|
63
|
-
scope: Scope.SINGLETON,
|
|
64
|
-
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
65
|
-
useClass: function useClass() {},
|
|
66
|
-
}),
|
|
67
|
-
Object.defineProperty(_ref3, '__stack', {
|
|
68
|
-
enumerable: false,
|
|
69
|
-
value: new Error().stack,
|
|
70
|
-
}),
|
|
71
|
-
_ref3),
|
|
72
|
-
];
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
`;
|
|
76
|
-
|
|
77
|
-
exports[`provider-stack add __stack property if Error in scope: add __stack property if Error in scope 1`] = `
|
|
78
|
-
|
|
79
|
-
// @ts-ignore
|
|
80
|
-
// eslint-disable-next-line import/no-unresolved
|
|
81
|
-
import { Provider, Scope, Error } from '@tramvai/core';
|
|
82
|
-
|
|
83
|
-
export const providers: Provider[] = [
|
|
84
|
-
{
|
|
85
|
-
provide: 'a',
|
|
86
|
-
useValue: 1,
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
provide: 'b',
|
|
90
|
-
multi: true,
|
|
91
|
-
deps: {},
|
|
92
|
-
useFactory: () => {
|
|
93
|
-
console.log(Error);
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
provide: 'c',
|
|
98
|
-
scope: Scope.SINGLETON,
|
|
99
|
-
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
100
|
-
useClass: class {},
|
|
101
|
-
},
|
|
102
|
-
];
|
|
103
|
-
|
|
104
|
-
↓ ↓ ↓ ↓ ↓ ↓
|
|
105
|
-
|
|
106
|
-
var _ref, _ref2, _ref3;
|
|
107
|
-
// @ts-ignore
|
|
108
|
-
// eslint-disable-next-line import/no-unresolved
|
|
109
|
-
import { Scope, Error as _Error } from '@tramvai/core';
|
|
110
|
-
export var providers = [
|
|
111
|
-
((_ref =
|
|
112
|
-
/*__tramvai_stack_provider__*/
|
|
113
|
-
{
|
|
114
|
-
provide: 'a',
|
|
115
|
-
useValue: 1,
|
|
116
|
-
}),
|
|
117
|
-
Object.defineProperty(_ref, '__stack', {
|
|
118
|
-
enumerable: false,
|
|
119
|
-
value: new Error().stack,
|
|
120
|
-
}),
|
|
121
|
-
_ref),
|
|
122
|
-
((_ref2 =
|
|
123
|
-
/*__tramvai_stack_provider__*/
|
|
124
|
-
{
|
|
125
|
-
provide: 'b',
|
|
126
|
-
multi: true,
|
|
127
|
-
deps: {},
|
|
128
|
-
useFactory: function useFactory() {
|
|
129
|
-
console.log(_Error);
|
|
130
|
-
},
|
|
131
|
-
}),
|
|
132
|
-
Object.defineProperty(_ref2, '__stack', {
|
|
133
|
-
enumerable: false,
|
|
134
|
-
value: new Error().stack,
|
|
135
|
-
}),
|
|
136
|
-
_ref2),
|
|
137
|
-
((_ref3 =
|
|
138
|
-
/*__tramvai_stack_provider__*/
|
|
139
|
-
{
|
|
140
|
-
provide: 'c',
|
|
141
|
-
scope: Scope.SINGLETON,
|
|
142
|
-
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
143
|
-
useClass: function useClass() {},
|
|
144
|
-
}),
|
|
145
|
-
Object.defineProperty(_ref3, '__stack', {
|
|
146
|
-
enumerable: false,
|
|
147
|
-
value: new Error().stack,
|
|
148
|
-
}),
|
|
149
|
-
_ref3),
|
|
150
|
-
];
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
`;
|
|
154
|
-
|
|
155
|
-
exports[`provider-stack add __stack property to module decorator providers: add __stack property to module decorator providers 1`] = `
|
|
156
|
-
|
|
157
|
-
// @ts-ignore
|
|
158
|
-
// eslint-disable-next-line import/no-unresolved
|
|
159
|
-
import { module, Scope } from '@tramvai/core';
|
|
160
|
-
|
|
161
|
-
@module({
|
|
162
|
-
providers: [
|
|
163
|
-
{
|
|
164
|
-
provide: 'provide',
|
|
165
|
-
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
166
|
-
useClass: class {},
|
|
167
|
-
multi: true,
|
|
168
|
-
deps: {},
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
provide: 'test',
|
|
172
|
-
useFactory: () => {},
|
|
173
|
-
multi: false,
|
|
174
|
-
scope: Scope.SINGLETON,
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
provide: 'abc',
|
|
178
|
-
useValue: 3,
|
|
179
|
-
},
|
|
180
|
-
],
|
|
181
|
-
})
|
|
182
|
-
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
183
|
-
export class ClassModule {}
|
|
184
|
-
|
|
185
|
-
↓ ↓ ↓ ↓ ↓ ↓
|
|
186
|
-
|
|
187
|
-
var _dec, _ref, _ref2, _ref3, _class;
|
|
188
|
-
// @ts-ignore
|
|
189
|
-
// eslint-disable-next-line import/no-unresolved
|
|
190
|
-
import { module, Scope } from '@tramvai/core';
|
|
191
|
-
export var ClassModule =
|
|
192
|
-
((_dec = module({
|
|
193
|
-
providers: [
|
|
194
|
-
((_ref =
|
|
195
|
-
/*__tramvai_stack_provider__*/
|
|
196
|
-
{
|
|
197
|
-
provide: 'provide',
|
|
198
|
-
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
199
|
-
useClass: function useClass() {},
|
|
200
|
-
multi: true,
|
|
201
|
-
deps: {},
|
|
202
|
-
}),
|
|
203
|
-
Object.defineProperty(_ref, '__stack', {
|
|
204
|
-
enumerable: false,
|
|
205
|
-
value: new Error().stack,
|
|
206
|
-
}),
|
|
207
|
-
_ref),
|
|
208
|
-
((_ref2 =
|
|
209
|
-
/*__tramvai_stack_provider__*/
|
|
210
|
-
{
|
|
211
|
-
provide: 'test',
|
|
212
|
-
useFactory: function useFactory() {},
|
|
213
|
-
multi: false,
|
|
214
|
-
scope: Scope.SINGLETON,
|
|
215
|
-
}),
|
|
216
|
-
Object.defineProperty(_ref2, '__stack', {
|
|
217
|
-
enumerable: false,
|
|
218
|
-
value: new Error().stack,
|
|
219
|
-
}),
|
|
220
|
-
_ref2),
|
|
221
|
-
((_ref3 =
|
|
222
|
-
/*__tramvai_stack_provider__*/
|
|
223
|
-
{
|
|
224
|
-
provide: 'abc',
|
|
225
|
-
useValue: 3,
|
|
226
|
-
}),
|
|
227
|
-
Object.defineProperty(_ref3, '__stack', {
|
|
228
|
-
enumerable: false,
|
|
229
|
-
value: new Error().stack,
|
|
230
|
-
}),
|
|
231
|
-
_ref3),
|
|
232
|
-
],
|
|
233
|
-
})),
|
|
234
|
-
_dec((_class = function ClassModule() {})) || _class);
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
`;
|
|
238
|
-
|
|
239
|
-
exports[`provider-stack check function naming: check function naming 1`] = `
|
|
240
|
-
|
|
241
|
-
// @ts-ignore
|
|
242
|
-
// eslint-disable-next-line import/no-unresolved
|
|
243
|
-
import { Provider } from '@tramvai/core';
|
|
244
|
-
|
|
245
|
-
export const providers: Provider[] = [
|
|
246
|
-
{
|
|
247
|
-
provide: 'a',
|
|
248
|
-
useFactory: () => {},
|
|
249
|
-
},
|
|
250
|
-
];
|
|
251
|
-
|
|
252
|
-
↓ ↓ ↓ ↓ ↓ ↓
|
|
253
|
-
|
|
254
|
-
var _ref;
|
|
255
|
-
// @ts-ignore
|
|
256
|
-
// eslint-disable-next-line import/no-unresolved
|
|
257
|
-
|
|
258
|
-
export var providers = [
|
|
259
|
-
((_ref =
|
|
260
|
-
/*__tramvai_stack_provider__*/
|
|
261
|
-
{
|
|
262
|
-
provide: 'a',
|
|
263
|
-
useFactory: function () {},
|
|
264
|
-
}),
|
|
265
|
-
Object.defineProperty(_ref, '__stack', {
|
|
266
|
-
enumerable: false,
|
|
267
|
-
value: new Error().stack,
|
|
268
|
-
}),
|
|
269
|
-
_ref),
|
|
270
|
-
];
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
`;
|
|
274
|
-
|
|
275
|
-
exports[`provider-stack do nothing: do nothing 1`] = `
|
|
276
|
-
|
|
277
|
-
export const providers = [
|
|
278
|
-
{
|
|
279
|
-
provide: 'test',
|
|
280
|
-
},
|
|
281
|
-
{
|
|
282
|
-
provide: 'a',
|
|
283
|
-
a: 'a',
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
useClass: 'test',
|
|
287
|
-
b: 'b',
|
|
288
|
-
},
|
|
289
|
-
{
|
|
290
|
-
useValue: 'c',
|
|
291
|
-
},
|
|
292
|
-
];
|
|
293
|
-
|
|
294
|
-
↓ ↓ ↓ ↓ ↓ ↓
|
|
295
|
-
|
|
296
|
-
export var providers = [
|
|
297
|
-
{
|
|
298
|
-
provide: 'test',
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
provide: 'a',
|
|
302
|
-
a: 'a',
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
useClass: 'test',
|
|
306
|
-
b: 'b',
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
useValue: 'c',
|
|
310
|
-
},
|
|
311
|
-
];
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
`;
|
|
315
|
-
|
|
316
|
-
exports[`provider-stack inside await: inside await 1`] = `
|
|
317
|
-
|
|
318
|
-
export const func = async () => {
|
|
319
|
-
await Promise.resolve([
|
|
320
|
-
{
|
|
321
|
-
provide: 'a',
|
|
322
|
-
useValue: 'a',
|
|
323
|
-
},
|
|
324
|
-
{
|
|
325
|
-
provide: 'b',
|
|
326
|
-
useValue: 'b',
|
|
327
|
-
},
|
|
328
|
-
]);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
↓ ↓ ↓ ↓ ↓ ↓
|
|
332
|
-
|
|
333
|
-
import _asyncToGenerator from '@babel/runtime/helpers/esm/asyncToGenerator';
|
|
334
|
-
import _regeneratorRuntime from '@babel/runtime/regenerator';
|
|
335
|
-
export var func = /*#__PURE__*/ (function () {
|
|
336
|
-
var _ref = _asyncToGenerator(
|
|
337
|
-
/*#__PURE__*/ _regeneratorRuntime.mark(function _callee() {
|
|
338
|
-
var _ref2, _ref3;
|
|
339
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
340
|
-
while (1)
|
|
341
|
-
switch ((_context.prev = _context.next)) {
|
|
342
|
-
case 0:
|
|
343
|
-
_context.next = 2;
|
|
344
|
-
return Promise.resolve([
|
|
345
|
-
((_ref2 =
|
|
346
|
-
/*__tramvai_stack_provider__*/
|
|
347
|
-
{
|
|
348
|
-
provide: 'a',
|
|
349
|
-
useValue: 'a',
|
|
350
|
-
}),
|
|
351
|
-
Object.defineProperty(_ref2, '__stack', {
|
|
352
|
-
enumerable: false,
|
|
353
|
-
value: new Error().stack,
|
|
354
|
-
}),
|
|
355
|
-
_ref2),
|
|
356
|
-
((_ref3 =
|
|
357
|
-
/*__tramvai_stack_provider__*/
|
|
358
|
-
{
|
|
359
|
-
provide: 'b',
|
|
360
|
-
useValue: 'b',
|
|
361
|
-
}),
|
|
362
|
-
Object.defineProperty(_ref3, '__stack', {
|
|
363
|
-
enumerable: false,
|
|
364
|
-
value: new Error().stack,
|
|
365
|
-
}),
|
|
366
|
-
_ref3),
|
|
367
|
-
]);
|
|
368
|
-
case 2:
|
|
369
|
-
case 'end':
|
|
370
|
-
return _context.stop();
|
|
371
|
-
}
|
|
372
|
-
}, _callee);
|
|
373
|
-
})
|
|
374
|
-
);
|
|
375
|
-
return function func() {
|
|
376
|
-
return _ref.apply(this, arguments);
|
|
377
|
-
};
|
|
378
|
-
})();
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
`;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import pluginTester from 'babel-plugin-tester';
|
|
3
|
-
import { createTokenPurePlugin } from './create-token-pure';
|
|
4
|
-
import babelConfig from '../index';
|
|
5
|
-
|
|
6
|
-
pluginTester({
|
|
7
|
-
plugin: createTokenPurePlugin,
|
|
8
|
-
pluginName: 'create-token-pure',
|
|
9
|
-
filename: path.join(__dirname, '__fixtures__', 'create-token-pure', 'test'),
|
|
10
|
-
babelOptions: babelConfig({
|
|
11
|
-
typescript: true,
|
|
12
|
-
generateDataQaTag: false,
|
|
13
|
-
loader: false,
|
|
14
|
-
// @ts-expect-error
|
|
15
|
-
markCreateTokenAsPure: false,
|
|
16
|
-
}),
|
|
17
|
-
tests: {
|
|
18
|
-
'do nothing': {
|
|
19
|
-
fixture: 'do-nothing.ts',
|
|
20
|
-
snapshot: true,
|
|
21
|
-
},
|
|
22
|
-
'add pure annotation when createToken from @tramvai/core': {
|
|
23
|
-
fixture: 'from-core.ts',
|
|
24
|
-
snapshot: true,
|
|
25
|
-
},
|
|
26
|
-
'add pure annotation when createToken from @tinkoff/dippy': {
|
|
27
|
-
fixture: 'from-dippy.ts',
|
|
28
|
-
snapshot: true,
|
|
29
|
-
},
|
|
30
|
-
'do not annotate more again': {
|
|
31
|
-
fixture: 'already-has-comment.ts',
|
|
32
|
-
snapshot: true,
|
|
33
|
-
},
|
|
34
|
-
'do not miss createToken on many imports': {
|
|
35
|
-
fixture: 'many-imports.ts',
|
|
36
|
-
snapshot: true,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import annotateAsPure from '@babel/helper-annotate-as-pure';
|
|
2
|
-
import type { Plugin } from './types.h';
|
|
3
|
-
|
|
4
|
-
interface InnerState {
|
|
5
|
-
hasCreateToken: boolean;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const createTokenPurePlugin: Plugin<InnerState> = ({ types: t }) => {
|
|
9
|
-
return {
|
|
10
|
-
pre() {
|
|
11
|
-
this.hasCreateToken = false;
|
|
12
|
-
},
|
|
13
|
-
visitor: {
|
|
14
|
-
ImportDeclaration(path) {
|
|
15
|
-
if (this.hasCreateToken) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const { node } = path;
|
|
20
|
-
const sourceValue = node.source.value;
|
|
21
|
-
|
|
22
|
-
if (sourceValue === '@tramvai/core' || sourceValue === '@tinkoff/dippy') {
|
|
23
|
-
this.hasCreateToken = node.specifiers.some(
|
|
24
|
-
(s) => s.type === 'ImportSpecifier' && s.local?.name === 'createToken'
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
CallExpression(path) {
|
|
29
|
-
const { node } = path;
|
|
30
|
-
|
|
31
|
-
if (!this.hasCreateToken) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const { callee } = node;
|
|
36
|
-
|
|
37
|
-
if (callee?.type === 'Identifier') {
|
|
38
|
-
if (callee?.name === 'createToken') {
|
|
39
|
-
annotateAsPure(path);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export default createTokenPurePlugin;
|