@tramvai/cli 5.53.80 → 6.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/spawn.js +8 -2
- package/lib/api/start/application.experimental.d.ts +7 -0
- package/lib/api/start/application.experimental.d.ts.map +1 -0
- package/lib/api/start/application.experimental.js +275 -0
- package/lib/api/start/application.experimental.js.map +1 -0
- package/lib/api/start/index.d.ts +1 -0
- package/lib/api/start/index.d.ts.map +1 -1
- package/lib/api/start/index.js +17 -6
- package/lib/api/start/index.js.map +1 -1
- package/lib/builder/webpack/devServer/setup.d.ts.map +1 -1
- package/lib/builder/webpack/devServer/setup.js +3 -1
- package/lib/builder/webpack/devServer/setup.js.map +1 -1
- package/lib/builder/webpack/providers/analyze/shared.d.ts.map +1 -1
- package/lib/builder/webpack/providers/analyze/shared.js +5 -9
- package/lib/builder/webpack/providers/analyze/shared.js.map +1 -1
- package/lib/builder/webpack/providers/client.d.ts.map +1 -1
- package/lib/builder/webpack/providers/client.js +10 -9
- package/lib/builder/webpack/providers/client.js.map +1 -1
- package/lib/builder/webpack/providers/server.d.ts.map +1 -1
- package/lib/builder/webpack/providers/server.js +10 -9
- package/lib/builder/webpack/providers/server.js.map +1 -1
- package/lib/cli/CLI.d.ts +1 -1
- package/lib/cli/CLI.d.ts.map +1 -1
- package/lib/cli/CLI.js.map +1 -1
- package/lib/cli/bin-init.js +0 -2
- package/lib/cli/bin-init.js.map +1 -1
- package/lib/cli/index.d.ts.map +1 -1
- package/lib/cli/index.js +1 -12
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/runCLI.d.ts.map +1 -1
- package/lib/cli/runCLI.js.map +1 -1
- package/lib/commands/add/command.d.ts +1 -4
- package/lib/commands/add/command.d.ts.map +1 -1
- package/lib/commands/add/command.js +3 -2
- package/lib/commands/add/command.js.map +1 -1
- package/lib/commands/analyze/command.d.ts +1 -1
- package/lib/commands/analyze/command.d.ts.map +1 -1
- package/lib/commands/analyze/command.js +11 -13
- package/lib/commands/analyze/command.js.map +1 -1
- package/lib/commands/benchmark/command.d.ts +1 -1
- package/lib/commands/benchmark/command.d.ts.map +1 -1
- package/lib/commands/benchmark/command.js +8 -9
- package/lib/commands/benchmark/command.js.map +1 -1
- package/lib/commands/build/build.d.ts.map +1 -1
- package/lib/commands/build/build.js +1 -0
- package/lib/commands/build/build.js.map +1 -1
- package/lib/commands/build/command.d.ts +1 -1
- package/lib/commands/build/command.d.ts.map +1 -1
- package/lib/commands/build/command.js +12 -15
- package/lib/commands/build/command.js.map +1 -1
- package/lib/commands/generate/command.d.ts +1 -1
- package/lib/commands/generate/command.d.ts.map +1 -1
- package/lib/commands/generate/command.js +3 -2
- package/lib/commands/generate/command.js.map +1 -1
- package/lib/commands/lint/command.d.ts +1 -1
- package/lib/commands/lint/command.d.ts.map +1 -1
- package/lib/commands/lint/command.js +3 -2
- package/lib/commands/lint/command.js.map +1 -1
- package/lib/commands/new/command.d.ts +0 -1
- package/lib/commands/new/command.d.ts.map +1 -1
- package/lib/commands/new/command.js +0 -1
- package/lib/commands/new/command.js.map +1 -1
- package/lib/commands/new/steps/installDependencies.js +3 -3
- package/lib/commands/new/steps/installDependencies.js.map +1 -1
- package/lib/commands/start/command.d.ts +1 -1
- package/lib/commands/start/command.d.ts.map +1 -1
- package/lib/commands/start/command.js +18 -15
- package/lib/commands/start/command.js.map +1 -1
- package/lib/commands/start-prod/command.d.ts +1 -1
- package/lib/commands/start-prod/command.d.ts.map +1 -1
- package/lib/commands/start-prod/command.js +11 -13
- package/lib/commands/start-prod/command.js.map +1 -1
- package/lib/commands/static/command.d.ts +1 -1
- package/lib/commands/static/command.d.ts.map +1 -1
- package/lib/commands/static/command.js +7 -3
- package/lib/commands/static/command.js.map +1 -1
- package/lib/commands/update/command.d.ts +1 -4
- package/lib/commands/update/command.d.ts.map +1 -1
- package/lib/commands/update/command.js +3 -2
- package/lib/commands/update/command.js.map +1 -1
- package/lib/external/config.d.ts.map +1 -1
- package/lib/external/config.js.map +1 -1
- package/lib/library/babel/index.d.ts +3 -9
- package/lib/library/babel/index.d.ts.map +1 -1
- package/lib/library/babel/index.js +3 -132
- package/lib/library/babel/index.js.map +1 -1
- package/lib/library/swc/index.d.ts +3 -3
- package/lib/library/swc/index.d.ts.map +1 -1
- package/lib/library/swc/index.js +4 -114
- package/lib/library/swc/index.js.map +1 -1
- package/lib/library/webpack/application/client/common.d.ts.map +1 -1
- package/lib/library/webpack/application/client/common.js +10 -9
- package/lib/library/webpack/application/client/common.js.map +1 -1
- package/lib/library/webpack/application/common.d.ts.map +1 -1
- package/lib/library/webpack/application/common.js +3 -4
- package/lib/library/webpack/application/common.js.map +1 -1
- package/lib/library/webpack/blocks/pwa/client.d.ts.map +1 -1
- package/lib/library/webpack/blocks/pwa/client.js +9 -58
- package/lib/library/webpack/blocks/pwa/client.js.map +1 -1
- package/lib/library/webpack/blocks/resolve.d.ts.map +1 -1
- package/lib/library/webpack/blocks/resolve.js +1 -0
- package/lib/library/webpack/blocks/resolve.js.map +1 -1
- package/lib/library/webpack/child-app/client/common.d.ts.map +1 -1
- package/lib/library/webpack/child-app/client/common.js +2 -2
- package/lib/library/webpack/child-app/client/common.js.map +1 -1
- package/lib/library/webpack/child-app/common.d.ts.map +1 -1
- package/lib/library/webpack/child-app/common.js +3 -4
- package/lib/library/webpack/child-app/common.js.map +1 -1
- package/lib/library/webpack/utils/threadLoader.d.ts.map +1 -1
- package/lib/library/webpack/utils/threadLoader.js +20 -3
- package/lib/library/webpack/utils/threadLoader.js.map +1 -1
- package/lib/library/webpack/utils/transpiler.js +1 -1
- package/lib/library/webpack/utils/transpiler.js.map +1 -1
- package/lib/models/analytics/utils.d.ts +2 -1
- package/lib/models/analytics/utils.d.ts.map +1 -1
- package/lib/models/analytics/utils.js +3 -0
- package/lib/models/analytics/utils.js.map +1 -1
- package/lib/models/command.d.ts +1 -1
- package/lib/models/command.d.ts.map +1 -1
- package/lib/models/command.js +1 -1
- package/lib/models/command.js.map +1 -1
- package/lib/models/context.d.ts +1 -1
- package/lib/models/context.d.ts.map +1 -1
- package/lib/models/logger.d.ts +0 -1
- package/lib/models/logger.d.ts.map +1 -1
- package/lib/models/logger.js +2 -3
- package/lib/models/logger.js.map +1 -1
- package/lib/schema/autogeneratedSchema.json +15 -15
- package/lib/typings/configEntry/application.d.ts +1 -1
- package/lib/typings/configEntry/application.d.ts.map +1 -1
- package/lib/typings/public.d.ts +0 -1
- package/lib/typings/public.d.ts.map +1 -1
- package/lib/typings/public.js +0 -2
- package/lib/typings/public.js.map +1 -1
- package/lib/utils/cpu-profile.d.ts.map +1 -1
- package/lib/utils/cpu-profile.js +0 -1
- package/lib/utils/cpu-profile.js.map +1 -1
- package/package.json +23 -27
- package/schema.json +15 -15
- package/src/api/start/__integration__/start.test.ts +8 -0
- package/src/api/start/application.experimental.ts +305 -0
- package/src/api/start/index.ts +20 -4
- package/src/builder/webpack/devServer/setup.ts +1 -0
- package/src/builder/webpack/providers/analyze/shared.ts +6 -10
- package/src/builder/webpack/providers/client.ts +15 -10
- package/src/builder/webpack/providers/server.ts +15 -10
- package/src/cli/CLI.ts +1 -1
- package/src/cli/bin-init.ts +0 -2
- package/src/cli/index.ts +4 -11
- package/src/cli/runCLI.ts +0 -1
- package/src/commands/add/command.ts +3 -2
- package/src/commands/analyze/command.ts +12 -14
- package/src/commands/benchmark/command.ts +9 -10
- package/src/commands/build/build.ts +2 -0
- package/src/commands/build/command.ts +13 -16
- package/src/commands/generate/command.ts +3 -2
- package/src/commands/lint/command.ts +3 -2
- package/src/commands/new/command.ts +0 -2
- package/src/commands/new/steps/installDependencies.ts +3 -3
- package/src/commands/new/templates/shared/_prettierrc.js.hbs +1 -1
- package/src/commands/start/command.ts +20 -16
- package/src/commands/start-prod/command.ts +12 -14
- package/src/commands/static/command.ts +7 -3
- package/src/commands/update/command.ts +3 -2
- package/src/external/config.ts +1 -0
- package/src/library/babel/index.ts +3 -160
- package/src/library/swc/__integration__/__snapshots__/swc.build.test.ts.snap +46 -28
- package/src/library/swc/__integration__/__snapshots__/swc.start.test.ts.snap +12 -8
- package/src/library/swc/__integration__/swc.start.test.ts +4 -4
- package/src/library/swc/index.ts +3 -139
- package/src/library/webpack/application/client/common.ts +12 -7
- package/src/library/webpack/application/common.ts +8 -4
- package/src/library/webpack/blocks/pwa/client.ts +13 -64
- package/src/library/webpack/blocks/resolve.ts +1 -0
- package/src/library/webpack/child-app/client/common.ts +2 -2
- package/src/library/webpack/child-app/common.ts +7 -5
- package/src/library/webpack/utils/threadLoader.ts +21 -0
- package/src/library/webpack/utils/transpiler.ts +2 -2
- package/src/models/analytics/utils.ts +6 -2
- package/src/models/command.ts +3 -4
- package/src/models/context.ts +1 -1
- package/src/models/logger.ts +1 -3
- package/src/schema/autogeneratedSchema.json +15 -15
- package/src/typings/configEntry/application.ts +5 -1
- package/src/typings/public.ts +0 -2
- package/src/utils/cpu-profile.ts +0 -1
- package/lib/library/babel/plugins/create-token-pure.d.ts +0 -7
- package/lib/library/babel/plugins/create-token-pure.d.ts.map +0 -1
- package/lib/library/babel/plugins/create-token-pure.js +0 -39
- package/lib/library/babel/plugins/create-token-pure.js.map +0 -1
- package/lib/library/babel/plugins/fill-action-name.d.ts +0 -3
- package/lib/library/babel/plugins/fill-action-name.d.ts.map +0 -1
- package/lib/library/babel/plugins/fill-action-name.js +0 -107
- package/lib/library/babel/plugins/fill-action-name.js.map +0 -1
- package/lib/library/babel/plugins/fill-declare-action-name.d.ts +0 -6
- package/lib/library/babel/plugins/fill-declare-action-name.d.ts.map +0 -1
- package/lib/library/babel/plugins/fill-declare-action-name.js +0 -94
- package/lib/library/babel/plugins/fill-declare-action-name.js.map +0 -1
- package/lib/library/babel/plugins/lazy-component/lazy-component.d.ts +0 -7
- package/lib/library/babel/plugins/lazy-component/lazy-component.d.ts.map +0 -1
- package/lib/library/babel/plugins/lazy-component/lazy-component.js +0 -75
- package/lib/library/babel/plugins/lazy-component/lazy-component.js.map +0 -1
- package/lib/library/babel/plugins/lazy-component/legacy-universal-replace.d.ts +0 -14
- package/lib/library/babel/plugins/lazy-component/legacy-universal-replace.d.ts.map +0 -1
- package/lib/library/babel/plugins/lazy-component/legacy-universal-replace.js +0 -53
- package/lib/library/babel/plugins/lazy-component/legacy-universal-replace.js.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/chunkName.d.ts +0 -3
- package/lib/library/babel/plugins/lazy-component/properties/chunkName.d.ts.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/chunkName.js +0 -133
- package/lib/library/babel/plugins/lazy-component/properties/chunkName.js.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/importAsync.d.ts +0 -3
- package/lib/library/babel/plugins/lazy-component/properties/importAsync.d.ts.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/importAsync.js +0 -11
- package/lib/library/babel/plugins/lazy-component/properties/importAsync.js.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/isReady.d.ts +0 -3
- package/lib/library/babel/plugins/lazy-component/properties/isReady.d.ts.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/isReady.js +0 -14
- package/lib/library/babel/plugins/lazy-component/properties/isReady.js.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/requireAsync.d.ts +0 -3
- package/lib/library/babel/plugins/lazy-component/properties/requireAsync.d.ts.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/requireAsync.js +0 -15
- package/lib/library/babel/plugins/lazy-component/properties/requireAsync.js.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/requireSync.d.ts +0 -3
- package/lib/library/babel/plugins/lazy-component/properties/requireSync.d.ts.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/requireSync.js +0 -16
- package/lib/library/babel/plugins/lazy-component/properties/requireSync.js.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/resolve.d.ts +0 -3
- package/lib/library/babel/plugins/lazy-component/properties/resolve.d.ts.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/resolve.js +0 -14
- package/lib/library/babel/plugins/lazy-component/properties/resolve.js.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/types.d.ts +0 -14
- package/lib/library/babel/plugins/lazy-component/properties/types.d.ts.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/types.js +0 -3
- package/lib/library/babel/plugins/lazy-component/properties/types.js.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/utils/webpackComments.d.ts +0 -14
- package/lib/library/babel/plugins/lazy-component/properties/utils/webpackComments.d.ts.map +0 -1
- package/lib/library/babel/plugins/lazy-component/properties/utils/webpackComments.js +0 -57
- package/lib/library/babel/plugins/lazy-component/properties/utils/webpackComments.js.map +0 -1
- package/lib/library/babel/plugins/provider-stack.d.ts +0 -4
- package/lib/library/babel/plugins/provider-stack.d.ts.map +0 -1
- package/lib/library/babel/plugins/provider-stack.js +0 -63
- package/lib/library/babel/plugins/provider-stack.js.map +0 -1
- package/lib/library/babel/plugins/react-compiler.d.ts +0 -13
- package/lib/library/babel/plugins/react-compiler.d.ts.map +0 -1
- package/lib/library/babel/plugins/react-compiler.js +0 -27
- package/lib/library/babel/plugins/react-compiler.js.map +0 -1
- package/lib/library/babel/plugins/react-element-info-unique.d.ts +0 -26
- package/lib/library/babel/plugins/react-element-info-unique.d.ts.map +0 -1
- package/lib/library/babel/plugins/react-element-info-unique.js +0 -112
- package/lib/library/babel/plugins/react-element-info-unique.js.map +0 -1
- package/lib/library/babel/plugins/types.h.d.ts +0 -7
- package/lib/library/babel/plugins/types.h.d.ts.map +0 -1
- package/lib/library/babel/plugins/types.h.js +0 -3
- package/lib/library/babel/plugins/types.h.js.map +0 -1
- package/lib/library/webpack/plugins/AssetsIntegritiesPlugin.d.ts +0 -8
- package/lib/library/webpack/plugins/AssetsIntegritiesPlugin.d.ts.map +0 -1
- package/lib/library/webpack/plugins/AssetsIntegritiesPlugin.js +0 -29
- package/lib/library/webpack/plugins/AssetsIntegritiesPlugin.js.map +0 -1
- package/lib/library/webpack/plugins/AutoPublicPathPlugin.d.ts +0 -4
- package/lib/library/webpack/plugins/AutoPublicPathPlugin.d.ts.map +0 -1
- package/lib/library/webpack/plugins/AutoPublicPathPlugin.js +0 -23
- package/lib/library/webpack/plugins/AutoPublicPathPlugin.js.map +0 -1
- package/lib/library/webpack/plugins/ModuleFederationFixRange.d.ts +0 -24
- package/lib/library/webpack/plugins/ModuleFederationFixRange.d.ts.map +0 -1
- package/lib/library/webpack/plugins/ModuleFederationFixRange.js +0 -127
- package/lib/library/webpack/plugins/ModuleFederationFixRange.js.map +0 -1
- package/lib/library/webpack/plugins/ModuleFederationIgnoreEntries.d.ts +0 -15
- package/lib/library/webpack/plugins/ModuleFederationIgnoreEntries.d.ts.map +0 -1
- package/lib/library/webpack/plugins/ModuleFederationIgnoreEntries.js +0 -49
- package/lib/library/webpack/plugins/ModuleFederationIgnoreEntries.js.map +0 -1
- package/lib/library/webpack/plugins/PolyfillCondition.d.ts +0 -8
- package/lib/library/webpack/plugins/PolyfillCondition.d.ts.map +0 -1
- package/lib/library/webpack/plugins/PolyfillCondition.js +0 -46
- package/lib/library/webpack/plugins/PolyfillCondition.js.map +0 -1
- package/lib/library/webpack/plugins/PurifyStatsPlugin.d.ts +0 -15
- package/lib/library/webpack/plugins/PurifyStatsPlugin.d.ts.map +0 -1
- package/lib/library/webpack/plugins/PurifyStatsPlugin.js +0 -47
- package/lib/library/webpack/plugins/PurifyStatsPlugin.js.map +0 -1
- package/lib/library/webpack/plugins/PwaIconsPlugin.d.ts +0 -12
- package/lib/library/webpack/plugins/PwaIconsPlugin.d.ts.map +0 -1
- package/lib/library/webpack/plugins/PwaIconsPlugin.js +0 -78
- package/lib/library/webpack/plugins/PwaIconsPlugin.js.map +0 -1
- package/lib/library/webpack/plugins/WebManifestPlugin.d.ts +0 -13
- package/lib/library/webpack/plugins/WebManifestPlugin.d.ts.map +0 -1
- package/lib/library/webpack/plugins/WebManifestPlugin.js +0 -47
- package/lib/library/webpack/plugins/WebManifestPlugin.js.map +0 -1
- package/lib/library/webpack/utils/polyfills/const.d.ts +0 -3
- package/lib/library/webpack/utils/polyfills/const.d.ts.map +0 -1
- package/lib/library/webpack/utils/polyfills/const.js +0 -49
- package/lib/library/webpack/utils/polyfills/const.js.map +0 -1
- package/lib/library/webpack/utils/polyfills/polyfillCondition.d.ts +0 -8
- package/lib/library/webpack/utils/polyfills/polyfillCondition.d.ts.map +0 -1
- package/lib/library/webpack/utils/polyfills/polyfillCondition.js +0 -51
- package/lib/library/webpack/utils/polyfills/polyfillCondition.js.map +0 -1
- package/lib/library/webpack/utils/polyfills/specToFeature.d.ts +0 -7
- package/lib/library/webpack/utils/polyfills/specToFeature.d.ts.map +0 -1
- package/lib/library/webpack/utils/polyfills/specToFeature.js +0 -207
- package/lib/library/webpack/utils/polyfills/specToFeature.js.map +0 -1
- package/lib/models/analytics/analytics.d.ts +0 -156
- package/lib/models/analytics/analytics.d.ts.map +0 -1
- package/lib/models/analytics/analytics.js +0 -259
- package/lib/models/analytics/analytics.js.map +0 -1
- package/lib/models/analytics/analytics.worker.d.ts +0 -5
- package/lib/models/analytics/analytics.worker.d.ts.map +0 -1
- package/lib/models/analytics/analytics.worker.js +0 -87
- package/lib/models/analytics/analytics.worker.js.map +0 -1
- package/lib/typings/pwa/index.d.ts +0 -80
- package/lib/typings/pwa/index.d.ts.map +0 -1
- package/lib/typings/pwa/index.js +0 -3
- package/lib/typings/pwa/index.js.map +0 -1
- package/lib/utils/errors.d.ts +0 -7
- package/lib/utils/errors.d.ts.map +0 -1
- package/lib/utils/errors.js +0 -43
- package/lib/utils/errors.js.map +0 -1
- package/lib/utils/memoryUsage.d.ts +0 -20
- package/lib/utils/memoryUsage.d.ts.map +0 -1
- package/lib/utils/memoryUsage.js +0 -51
- package/lib/utils/memoryUsage.js.map +0 -1
- package/lib/utils/sentry.d.ts +0 -2
- package/lib/utils/sentry.d.ts.map +0 -1
- package/lib/utils/sentry.js +0 -27
- package/lib/utils/sentry.js.map +0 -1
- package/src/library/babel/plugins/__fixtures__/create-token-pure/already-has-comment.ts +0 -5
- package/src/library/babel/plugins/__fixtures__/create-token-pure/do-nothing.ts +0 -10
- package/src/library/babel/plugins/__fixtures__/create-token-pure/from-core.ts +0 -5
- package/src/library/babel/plugins/__fixtures__/create-token-pure/from-dippy.ts +0 -5
- package/src/library/babel/plugins/__fixtures__/create-token-pure/many-imports.ts +0 -9
- package/src/library/babel/plugins/__fixtures__/fill-declare-action-name/import-mixed.ts +0 -17
- package/src/library/babel/plugins/__fixtures__/fill-declare-action-name/import-with-name.ts +0 -28
- package/src/library/babel/plugins/__fixtures__/fill-declare-action-name/import-without-name.ts +0 -25
- package/src/library/babel/plugins/__fixtures__/fill-declare-action-name/require-with-name.ts +0 -21
- package/src/library/babel/plugins/__fixtures__/fill-declare-action-name/require-without-name.ts +0 -19
- package/src/library/babel/plugins/__fixtures__/lazy-component/base.ts +0 -3
- package/src/library/babel/plugins/__fixtures__/lazy-component/cmp.tsx +0 -7
- package/src/library/babel/plugins/__fixtures__/lazy-component/comments.ts +0 -7
- package/src/library/babel/plugins/__fixtures__/lazy-component/dynamic.ts +0 -3
- package/src/library/babel/plugins/__fixtures__/lazy-component/inner/first.tsx +0 -7
- package/src/library/babel/plugins/__fixtures__/lazy-component/inner/path/cmp.tsx +0 -7
- package/src/library/babel/plugins/__fixtures__/lazy-component/inner/second.tsx +0 -7
- package/src/library/babel/plugins/__fixtures__/lazy-component/inner/third.tsx +0 -7
- package/src/library/babel/plugins/__fixtures__/lazy-component/lazy+hmr.ts +0 -3
- package/src/library/babel/plugins/__fixtures__/lazy-component/long-import.ts +0 -3
- package/src/library/babel/plugins/__fixtures__/lazy-component/not-lazy-import.ts +0 -7
- package/src/library/babel/plugins/__fixtures__/lazy-component/not-lazy.ts +0 -8
- package/src/library/babel/plugins/__fixtures__/legacy-universal-replace/cmp.tsx +0 -7
- package/src/library/babel/plugins/__fixtures__/legacy-universal-replace/not-universal.ts +0 -8
- package/src/library/babel/plugins/__fixtures__/legacy-universal-replace/platform-legacy.ts +0 -5
- package/src/library/babel/plugins/__fixtures__/legacy-universal-replace/react-universal.ts +0 -3
- package/src/library/babel/plugins/__fixtures__/legacy-universal-replace/tramvai/react/index.es.ts +0 -3
- package/src/library/babel/plugins/__fixtures__/provider-stack/add-stack.ts +0 -22
- package/src/library/babel/plugins/__fixtures__/provider-stack/check-function-name.ts +0 -10
- package/src/library/babel/plugins/__fixtures__/provider-stack/do-nothing.ts +0 -16
- package/src/library/babel/plugins/__fixtures__/provider-stack/error-in-scope.ts +0 -24
- package/src/library/babel/plugins/__fixtures__/provider-stack/inside-await.ts +0 -12
- package/src/library/babel/plugins/__fixtures__/provider-stack/module-decorator.ts +0 -27
- package/src/library/babel/plugins/__snapshots__/create-token-pure.spec.ts.snap +0 -108
- package/src/library/babel/plugins/__snapshots__/fill-declare-action-name.spec.ts.snap +0 -264
- package/src/library/babel/plugins/__snapshots__/provider-stack.spec.ts.snap +0 -362
- package/src/library/babel/plugins/create-token-pure.spec.ts +0 -39
- package/src/library/babel/plugins/create-token-pure.ts +0 -47
- package/src/library/babel/plugins/fill-action-name.ts +0 -126
- package/src/library/babel/plugins/fill-declare-action-name.spec.ts +0 -37
- package/src/library/babel/plugins/fill-declare-action-name.ts +0 -110
- package/src/library/babel/plugins/lazy-component/__snapshots__/lazy-component.spec.ts.snap +0 -313
- package/src/library/babel/plugins/lazy-component/__snapshots__/legacy-universal-replace.spec.ts.snap +0 -114
- package/src/library/babel/plugins/lazy-component/lazy-component.spec.ts +0 -46
- package/src/library/babel/plugins/lazy-component/lazy-component.ts +0 -91
- package/src/library/babel/plugins/lazy-component/legacy-universal-replace.spec.ts +0 -33
- package/src/library/babel/plugins/lazy-component/legacy-universal-replace.ts +0 -88
- package/src/library/babel/plugins/lazy-component/properties/chunkName.ts +0 -185
- package/src/library/babel/plugins/lazy-component/properties/importAsync.ts +0 -8
- package/src/library/babel/plugins/lazy-component/properties/isReady.ts +0 -19
- package/src/library/babel/plugins/lazy-component/properties/requireAsync.ts +0 -20
- package/src/library/babel/plugins/lazy-component/properties/requireSync.ts +0 -21
- package/src/library/babel/plugins/lazy-component/properties/resolve.ts +0 -21
- package/src/library/babel/plugins/lazy-component/properties/types.ts +0 -20
- package/src/library/babel/plugins/lazy-component/properties/utils/webpackComments.ts +0 -61
- package/src/library/babel/plugins/provider-stack.spec.ts +0 -55
- package/src/library/babel/plugins/provider-stack.ts +0 -88
- package/src/library/babel/plugins/react-compiler.ts +0 -39
- package/src/library/babel/plugins/react-element-info-unique.ts +0 -144
- package/src/library/babel/plugins/types.h.ts +0 -8
- package/src/library/webpack/plugins/AssetsIntegritiesPlugin.ts +0 -34
- package/src/library/webpack/plugins/AutoPublicPathPlugin.ts +0 -23
- package/src/library/webpack/plugins/ModuleFederationFixRange.ts +0 -181
- package/src/library/webpack/plugins/ModuleFederationIgnoreEntries.ts +0 -59
- package/src/library/webpack/plugins/PolyfillCondition.ts +0 -62
- package/src/library/webpack/plugins/PurifyStatsPlugin.ts +0 -57
- package/src/library/webpack/plugins/PwaIconsPlugin.ts +0 -94
- package/src/library/webpack/plugins/WebManifestPlugin.ts +0 -62
- package/src/library/webpack/utils/polyfills/__integration__/__snapshots__/condition.test.ts.snap +0 -1348
- package/src/library/webpack/utils/polyfills/__integration__/condition.test.ts +0 -128
- package/src/library/webpack/utils/polyfills/const.ts +0 -46
- package/src/library/webpack/utils/polyfills/polyfillCondition.ts +0 -63
- package/src/library/webpack/utils/polyfills/specToFeature.ts +0 -243
- package/src/models/analytics/analytics.ts +0 -488
- package/src/models/analytics/analytics.worker.ts +0 -102
- package/src/typings/pwa/index.ts +0 -83
- package/src/utils/errors.ts +0 -39
- package/src/utils/memoryUsage.ts +0 -58
- package/src/utils/sentry.ts +0 -25
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import type { Plugin } from './types.h';
|
|
2
|
-
|
|
3
|
-
function hashCode(s: string) {
|
|
4
|
-
let h = 0;
|
|
5
|
-
let i = 0;
|
|
6
|
-
// eslint-disable-next-line no-bitwise
|
|
7
|
-
if (s.length > 0) while (i < s.length) h = ((h << 5) - h + s.charCodeAt(i++)) | 0;
|
|
8
|
-
return h.toString(36);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const fillDeclareActionName: Plugin<{ declareActionName: string | null }> = (babel) => {
|
|
12
|
-
const { types: t } = babel;
|
|
13
|
-
|
|
14
|
-
return {
|
|
15
|
-
pre() {
|
|
16
|
-
this.declareActionName = null;
|
|
17
|
-
},
|
|
18
|
-
visitor: {
|
|
19
|
-
Program: {
|
|
20
|
-
enter(enterPath) {
|
|
21
|
-
enterPath.traverse({
|
|
22
|
-
ImportDeclaration: (path) => {
|
|
23
|
-
if (this.declareActionName) return; // нет смысла идти дальше
|
|
24
|
-
if (path.node.source.value !== '@tramvai/core') return;
|
|
25
|
-
|
|
26
|
-
const specifier = path.node.specifiers.find(
|
|
27
|
-
(s) =>
|
|
28
|
-
t.isImportSpecifier(s) &&
|
|
29
|
-
'name' in s.imported &&
|
|
30
|
-
s.imported.name === 'declareAction'
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
if (specifier) {
|
|
34
|
-
this.declareActionName = specifier.local.name;
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
// тут смотрим на const {declareAction} = require('@tramvai/core')
|
|
38
|
-
VariableDeclarator: (path) => {
|
|
39
|
-
if (this.declareActionName) return; // нет смысла идти дальше
|
|
40
|
-
|
|
41
|
-
if (
|
|
42
|
-
!t.isCallExpression(path.node.init) ||
|
|
43
|
-
!t.isIdentifier(path.node.init.callee) ||
|
|
44
|
-
path.node.init.callee.name !== 'require'
|
|
45
|
-
) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const [argument] = path.node.init.arguments;
|
|
50
|
-
|
|
51
|
-
if (!argument || ('value' in argument && argument.value !== '@tramvai/core')) return;
|
|
52
|
-
if (!t.isObjectPattern(path.node.id)) return;
|
|
53
|
-
|
|
54
|
-
const declareActionNameProperty = path.node.id.properties.find(
|
|
55
|
-
(p) => 'key' in p && 'name' in p.key && p.key.name === 'declareAction'
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
if (
|
|
59
|
-
declareActionNameProperty &&
|
|
60
|
-
'value' in declareActionNameProperty &&
|
|
61
|
-
'name' in declareActionNameProperty.value
|
|
62
|
-
) {
|
|
63
|
-
this.declareActionName = declareActionNameProperty.value.name;
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
});
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
CallExpression(path) {
|
|
70
|
-
if (!this.declareActionName) return;
|
|
71
|
-
if ('name' in path.node.callee && path.node.callee.name !== this.declareActionName) return;
|
|
72
|
-
|
|
73
|
-
const args = path.node.arguments;
|
|
74
|
-
|
|
75
|
-
if (args.length !== 1) return;
|
|
76
|
-
if (!t.isObjectExpression(args[0])) return;
|
|
77
|
-
|
|
78
|
-
const nameProperty = args[0].properties.find(
|
|
79
|
-
(p) => 'key' in p && 'name' in p.key && p.key.name === 'name'
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
if (nameProperty) return;
|
|
83
|
-
|
|
84
|
-
let additionalDebugName: string;
|
|
85
|
-
|
|
86
|
-
// @ts-expect-error easier to write this rather than adding if statements and type assertions
|
|
87
|
-
const potentialVariableName = path.parentPath.node.id?.name as string | undefined;
|
|
88
|
-
|
|
89
|
-
if (!potentialVariableName) {
|
|
90
|
-
additionalDebugName = this.file.opts.generatorOpts.sourceFileName ?? '';
|
|
91
|
-
} else {
|
|
92
|
-
additionalDebugName = potentialVariableName;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const filePath = this.file.opts.filename;
|
|
96
|
-
const cwd = this.file.opts.cwd ?? '';
|
|
97
|
-
const projectFilePath = filePath.replace(cwd, '');
|
|
98
|
-
const { line, column } = path.node.loc.start;
|
|
99
|
-
|
|
100
|
-
const sid = hashCode(`${projectFilePath}:${line}:${column}`);
|
|
101
|
-
|
|
102
|
-
const name = `${additionalDebugName}__${sid}`;
|
|
103
|
-
|
|
104
|
-
args[0].properties.unshift(t.objectProperty(t.identifier('name'), t.stringLiteral(name)));
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export default fillDeclareActionName;
|
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`lazy-component base: base 1`] = `
|
|
4
|
-
|
|
5
|
-
import { lazy } from '@tramvai/react';
|
|
6
|
-
|
|
7
|
-
lazy(() => import('./cmp'))
|
|
8
|
-
|
|
9
|
-
↓ ↓ ↓ ↓ ↓ ↓
|
|
10
|
-
|
|
11
|
-
import { lazy } from '@tramvai/react';
|
|
12
|
-
lazy({
|
|
13
|
-
chunkName() {
|
|
14
|
-
return 'cmp';
|
|
15
|
-
},
|
|
16
|
-
requireSync(props) {
|
|
17
|
-
return __webpack_require__(this.resolve(props));
|
|
18
|
-
},
|
|
19
|
-
isReady(props) {
|
|
20
|
-
const key = this.resolve(props);
|
|
21
|
-
return !!__webpack_modules__[key];
|
|
22
|
-
},
|
|
23
|
-
importAsync: () => import(/* webpackChunkName: "cmp" */ './cmp'),
|
|
24
|
-
requireAsync(props) {
|
|
25
|
-
const key = this.resolve(props);
|
|
26
|
-
return this.importAsync(props).then((resolved) => {
|
|
27
|
-
return resolved;
|
|
28
|
-
});
|
|
29
|
-
},
|
|
30
|
-
resolve() {
|
|
31
|
-
return require.resolveWeak('./cmp');
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
`;
|
|
37
|
-
|
|
38
|
-
exports[`lazy-component comments: comments 1`] = `
|
|
39
|
-
|
|
40
|
-
import { lazy } from '@tramvai/react';
|
|
41
|
-
|
|
42
|
-
lazy(() => import(/* webpackChunkName: 'main' */'./inner/first'))
|
|
43
|
-
lazy(() => import(/* stupid comments */'./inner/second'))
|
|
44
|
-
lazy(() => import(/* webpackPreload: true */'./inner/third'))
|
|
45
|
-
|
|
46
|
-
lazy(() => import(/* webpackPrefetch: true, webpackChunkName: "component" */'./cmp'))
|
|
47
|
-
|
|
48
|
-
↓ ↓ ↓ ↓ ↓ ↓
|
|
49
|
-
|
|
50
|
-
import { lazy } from '@tramvai/react';
|
|
51
|
-
lazy({
|
|
52
|
-
chunkName() {
|
|
53
|
-
return 'main';
|
|
54
|
-
},
|
|
55
|
-
requireSync(props) {
|
|
56
|
-
return __webpack_require__(this.resolve(props));
|
|
57
|
-
},
|
|
58
|
-
isReady(props) {
|
|
59
|
-
const key = this.resolve(props);
|
|
60
|
-
return !!__webpack_modules__[key];
|
|
61
|
-
},
|
|
62
|
-
importAsync: () => import(/* webpackChunkName: "main" */ './inner/first'),
|
|
63
|
-
requireAsync(props) {
|
|
64
|
-
const key = this.resolve(props);
|
|
65
|
-
return this.importAsync(props).then((resolved) => {
|
|
66
|
-
return resolved;
|
|
67
|
-
});
|
|
68
|
-
},
|
|
69
|
-
resolve() {
|
|
70
|
-
return require.resolveWeak('./inner/first');
|
|
71
|
-
},
|
|
72
|
-
});
|
|
73
|
-
lazy({
|
|
74
|
-
chunkName() {
|
|
75
|
-
return 'inner-second';
|
|
76
|
-
},
|
|
77
|
-
requireSync(props) {
|
|
78
|
-
return __webpack_require__(this.resolve(props));
|
|
79
|
-
},
|
|
80
|
-
isReady(props) {
|
|
81
|
-
const key = this.resolve(props);
|
|
82
|
-
return !!__webpack_modules__[key];
|
|
83
|
-
},
|
|
84
|
-
importAsync: () =>
|
|
85
|
-
import(
|
|
86
|
-
/* webpackChunkName: "inner-second" */
|
|
87
|
-
/* stupid comments */
|
|
88
|
-
'./inner/second'
|
|
89
|
-
),
|
|
90
|
-
requireAsync(props) {
|
|
91
|
-
const key = this.resolve(props);
|
|
92
|
-
return this.importAsync(props).then((resolved) => {
|
|
93
|
-
return resolved;
|
|
94
|
-
});
|
|
95
|
-
},
|
|
96
|
-
resolve() {
|
|
97
|
-
return require.resolveWeak('./inner/second');
|
|
98
|
-
},
|
|
99
|
-
});
|
|
100
|
-
lazy({
|
|
101
|
-
chunkName() {
|
|
102
|
-
return 'inner-third';
|
|
103
|
-
},
|
|
104
|
-
requireSync(props) {
|
|
105
|
-
return __webpack_require__(this.resolve(props));
|
|
106
|
-
},
|
|
107
|
-
isReady(props) {
|
|
108
|
-
const key = this.resolve(props);
|
|
109
|
-
return !!__webpack_modules__[key];
|
|
110
|
-
},
|
|
111
|
-
importAsync: () =>
|
|
112
|
-
import(
|
|
113
|
-
/* webpackChunkName: "inner-third" */
|
|
114
|
-
/* webpackPreload: true */
|
|
115
|
-
'./inner/third'
|
|
116
|
-
),
|
|
117
|
-
requireAsync(props) {
|
|
118
|
-
const key = this.resolve(props);
|
|
119
|
-
return this.importAsync(props).then((resolved) => {
|
|
120
|
-
return resolved;
|
|
121
|
-
});
|
|
122
|
-
},
|
|
123
|
-
resolve() {
|
|
124
|
-
return require.resolveWeak('./inner/third');
|
|
125
|
-
},
|
|
126
|
-
});
|
|
127
|
-
lazy({
|
|
128
|
-
chunkName() {
|
|
129
|
-
return 'component';
|
|
130
|
-
},
|
|
131
|
-
requireSync(props) {
|
|
132
|
-
return __webpack_require__(this.resolve(props));
|
|
133
|
-
},
|
|
134
|
-
isReady(props) {
|
|
135
|
-
const key = this.resolve(props);
|
|
136
|
-
return !!__webpack_modules__[key];
|
|
137
|
-
},
|
|
138
|
-
importAsync: () =>
|
|
139
|
-
import(/* webpackPrefetch: true, webpackChunkName: "component" */ './cmp'),
|
|
140
|
-
requireAsync(props) {
|
|
141
|
-
const key = this.resolve(props);
|
|
142
|
-
return this.importAsync(props).then((resolved) => {
|
|
143
|
-
return resolved;
|
|
144
|
-
});
|
|
145
|
-
},
|
|
146
|
-
resolve() {
|
|
147
|
-
return require.resolveWeak('./cmp');
|
|
148
|
-
},
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
`;
|
|
153
|
-
|
|
154
|
-
exports[`lazy-component dynamic: dynamic 1`] = `
|
|
155
|
-
|
|
156
|
-
import { lazy } from '@tramvai/react';
|
|
157
|
-
|
|
158
|
-
lazy((props) => import(\`./inner/\${props.name}.js\`))
|
|
159
|
-
|
|
160
|
-
↓ ↓ ↓ ↓ ↓ ↓
|
|
161
|
-
|
|
162
|
-
import { lazy } from '@tramvai/react';
|
|
163
|
-
lazy({
|
|
164
|
-
chunkName(props) {
|
|
165
|
-
return \`inner-\${props.name}-js\`.replace(/[^a-zA-Z0-9_!§$()=\\-^°]+/g, '-');
|
|
166
|
-
},
|
|
167
|
-
requireSync(props) {
|
|
168
|
-
return __webpack_require__(this.resolve(props));
|
|
169
|
-
},
|
|
170
|
-
isReady(props) {
|
|
171
|
-
const key = this.resolve(props);
|
|
172
|
-
return !!__webpack_modules__[key];
|
|
173
|
-
},
|
|
174
|
-
importAsync: (props) =>
|
|
175
|
-
import(
|
|
176
|
-
/* webpackChunkName: "inner-[request]" */ \`./inner/\${props.name}.js\`
|
|
177
|
-
),
|
|
178
|
-
requireAsync(props) {
|
|
179
|
-
const key = this.resolve(props);
|
|
180
|
-
return this.importAsync(props).then((resolved) => {
|
|
181
|
-
return resolved;
|
|
182
|
-
});
|
|
183
|
-
},
|
|
184
|
-
resolve(props) {
|
|
185
|
-
return require.resolveWeak(\`./inner/\${props.name}.js\`);
|
|
186
|
-
},
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
`;
|
|
191
|
-
|
|
192
|
-
exports[`lazy-component hmr: hmr 1`] = `
|
|
193
|
-
|
|
194
|
-
import { lazy } from '@tramvai/react';
|
|
195
|
-
|
|
196
|
-
const MainPage = lazy(() => import('./inner/first'));
|
|
197
|
-
|
|
198
|
-
↓ ↓ ↓ ↓ ↓ ↓
|
|
199
|
-
|
|
200
|
-
import { lazy } from '@tramvai/react';
|
|
201
|
-
const MainPage = lazy(
|
|
202
|
-
(_c = {
|
|
203
|
-
chunkName() {
|
|
204
|
-
return 'inner-first';
|
|
205
|
-
},
|
|
206
|
-
requireSync(props) {
|
|
207
|
-
return __webpack_require__(this.resolve(props));
|
|
208
|
-
},
|
|
209
|
-
isReady(props) {
|
|
210
|
-
const key = this.resolve(props);
|
|
211
|
-
return !!__webpack_modules__[key];
|
|
212
|
-
},
|
|
213
|
-
importAsync: () =>
|
|
214
|
-
import(/* webpackChunkName: "inner-first" */ './inner/first'),
|
|
215
|
-
requireAsync(props) {
|
|
216
|
-
const key = this.resolve(props);
|
|
217
|
-
return this.importAsync(props).then((resolved) => {
|
|
218
|
-
return resolved;
|
|
219
|
-
});
|
|
220
|
-
},
|
|
221
|
-
resolve() {
|
|
222
|
-
return require.resolveWeak('./inner/first');
|
|
223
|
-
},
|
|
224
|
-
})
|
|
225
|
-
);
|
|
226
|
-
_c2 = MainPage;
|
|
227
|
-
var _c, _c2;
|
|
228
|
-
$RefreshReg$(_c, 'MainPage$lazy');
|
|
229
|
-
$RefreshReg$(_c2, 'MainPage');
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
`;
|
|
233
|
-
|
|
234
|
-
exports[`lazy-component long import: long import 1`] = `
|
|
235
|
-
|
|
236
|
-
import { lazy } from '@tramvai/react';
|
|
237
|
-
|
|
238
|
-
lazy(() => import('./inner/path/cmp'))
|
|
239
|
-
|
|
240
|
-
↓ ↓ ↓ ↓ ↓ ↓
|
|
241
|
-
|
|
242
|
-
import { lazy } from '@tramvai/react';
|
|
243
|
-
lazy({
|
|
244
|
-
chunkName() {
|
|
245
|
-
return 'inner-path-cmp';
|
|
246
|
-
},
|
|
247
|
-
requireSync(props) {
|
|
248
|
-
return __webpack_require__(this.resolve(props));
|
|
249
|
-
},
|
|
250
|
-
isReady(props) {
|
|
251
|
-
const key = this.resolve(props);
|
|
252
|
-
return !!__webpack_modules__[key];
|
|
253
|
-
},
|
|
254
|
-
importAsync: () =>
|
|
255
|
-
import(/* webpackChunkName: "inner-path-cmp" */ './inner/path/cmp'),
|
|
256
|
-
requireAsync(props) {
|
|
257
|
-
const key = this.resolve(props);
|
|
258
|
-
return this.importAsync(props).then((resolved) => {
|
|
259
|
-
return resolved;
|
|
260
|
-
});
|
|
261
|
-
},
|
|
262
|
-
resolve() {
|
|
263
|
-
return require.resolveWeak('./inner/path/cmp');
|
|
264
|
-
},
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
`;
|
|
269
|
-
|
|
270
|
-
exports[`lazy-component not lazy: not lazy 1`] = `
|
|
271
|
-
|
|
272
|
-
const lazy = (imp) => console.log(imp);
|
|
273
|
-
const load = lazy(() => import('./cmp'));
|
|
274
|
-
|
|
275
|
-
(async () => {
|
|
276
|
-
const {default: cmp} = await import('./cmp');
|
|
277
|
-
|
|
278
|
-
console.log((cmp as any).actions)
|
|
279
|
-
})();
|
|
280
|
-
|
|
281
|
-
↓ ↓ ↓ ↓ ↓ ↓
|
|
282
|
-
|
|
283
|
-
const lazy = (imp) => console.log(imp);
|
|
284
|
-
const load = lazy(() => import('./cmp'));
|
|
285
|
-
(async () => {
|
|
286
|
-
const { default: cmp } = await import('./cmp');
|
|
287
|
-
console.log(cmp.actions);
|
|
288
|
-
})();
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
`;
|
|
292
|
-
|
|
293
|
-
exports[`lazy-component tramvai react but not lazy: tramvai react but not lazy 1`] = `
|
|
294
|
-
|
|
295
|
-
import { withError } from '@tramvai/react';
|
|
296
|
-
|
|
297
|
-
export const compose = () => {
|
|
298
|
-
return (cmp) => {
|
|
299
|
-
withError()(cmp);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
↓ ↓ ↓ ↓ ↓ ↓
|
|
304
|
-
|
|
305
|
-
import { withError } from '@tramvai/react';
|
|
306
|
-
export const compose = () => {
|
|
307
|
-
return (cmp) => {
|
|
308
|
-
withError()(cmp);
|
|
309
|
-
};
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
`;
|
package/src/library/babel/plugins/lazy-component/__snapshots__/legacy-universal-replace.spec.ts.snap
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`legacy-universal-replace not universal: not universal 1`] = `
|
|
4
|
-
|
|
5
|
-
const lazy = (imp) => console.log(imp);
|
|
6
|
-
const load = lazy(() => import('./cmp'));
|
|
7
|
-
|
|
8
|
-
(async () => {
|
|
9
|
-
const {default: cmp} = await import('./cmp');
|
|
10
|
-
|
|
11
|
-
console.log((cmp as any).actions)
|
|
12
|
-
})();
|
|
13
|
-
|
|
14
|
-
↓ ↓ ↓ ↓ ↓ ↓
|
|
15
|
-
|
|
16
|
-
const lazy = (imp) => console.log(imp);
|
|
17
|
-
const load = lazy(() => import('./cmp'));
|
|
18
|
-
(async () => {
|
|
19
|
-
const { default: cmp } = await import('./cmp');
|
|
20
|
-
console.log(cmp.actions);
|
|
21
|
-
})();
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
`;
|
|
25
|
-
|
|
26
|
-
exports[`legacy-universal-replace platform legacy: platform legacy 1`] = `
|
|
27
|
-
|
|
28
|
-
import asyncUniversal, {asyncUniversalPack} from '@tinkoff/platform-legacy/utils/decorators/asyncUniversal';
|
|
29
|
-
|
|
30
|
-
asyncUniversal(import('./cmp'))
|
|
31
|
-
|
|
32
|
-
export const packed = asyncUniversalPack({});
|
|
33
|
-
|
|
34
|
-
↓ ↓ ↓ ↓ ↓ ↓
|
|
35
|
-
|
|
36
|
-
import asyncUniversal, {
|
|
37
|
-
asyncUniversalPack,
|
|
38
|
-
} from '@tinkoff/platform-legacy/utils/decorators/asyncUniversal';
|
|
39
|
-
import { lazy as _lazy } from '@tramvai/react';
|
|
40
|
-
_lazy({
|
|
41
|
-
chunkName() {
|
|
42
|
-
return 'cmp';
|
|
43
|
-
},
|
|
44
|
-
requireSync(props) {
|
|
45
|
-
return __webpack_require__(this.resolve(props));
|
|
46
|
-
},
|
|
47
|
-
isReady(props) {
|
|
48
|
-
const key = this.resolve(props);
|
|
49
|
-
return !!__webpack_modules__[key];
|
|
50
|
-
},
|
|
51
|
-
importAsync: () => import(/* webpackChunkName: "cmp" */ './cmp'),
|
|
52
|
-
requireAsync(props) {
|
|
53
|
-
const key = this.resolve(props);
|
|
54
|
-
return this.importAsync(props).then((resolved) => {
|
|
55
|
-
return resolved;
|
|
56
|
-
});
|
|
57
|
-
},
|
|
58
|
-
resolve() {
|
|
59
|
-
return require.resolveWeak('./cmp');
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
export const packed = asyncUniversalPack({});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
`;
|
|
66
|
-
|
|
67
|
-
exports[`legacy-universal-replace react-universal: react-universal 1`] = `
|
|
68
|
-
|
|
69
|
-
import universal from 'react-universal-component';
|
|
70
|
-
|
|
71
|
-
universal(import('./cmp'))
|
|
72
|
-
|
|
73
|
-
↓ ↓ ↓ ↓ ↓ ↓
|
|
74
|
-
|
|
75
|
-
import { lazy as _lazy } from '@tramvai/react';
|
|
76
|
-
_lazy({
|
|
77
|
-
chunkName() {
|
|
78
|
-
return 'cmp';
|
|
79
|
-
},
|
|
80
|
-
requireSync(props) {
|
|
81
|
-
return __webpack_require__(this.resolve(props));
|
|
82
|
-
},
|
|
83
|
-
isReady(props) {
|
|
84
|
-
const key = this.resolve(props);
|
|
85
|
-
return !!__webpack_modules__[key];
|
|
86
|
-
},
|
|
87
|
-
importAsync: () => import(/* webpackChunkName: "cmp" */ './cmp'),
|
|
88
|
-
requireAsync(props) {
|
|
89
|
-
const key = this.resolve(props);
|
|
90
|
-
return this.importAsync(props).then((resolved) => {
|
|
91
|
-
return resolved;
|
|
92
|
-
});
|
|
93
|
-
},
|
|
94
|
-
resolve() {
|
|
95
|
-
return require.resolveWeak('./cmp');
|
|
96
|
-
},
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
`;
|
|
101
|
-
|
|
102
|
-
exports[`legacy-universal-replace tramvai-react: tramvai-react 1`] = `
|
|
103
|
-
|
|
104
|
-
import universal from 'react-universal-component';
|
|
105
|
-
|
|
106
|
-
export const lazy = (loader) => universal(loader);
|
|
107
|
-
|
|
108
|
-
↓ ↓ ↓ ↓ ↓ ↓
|
|
109
|
-
|
|
110
|
-
import universal from '@loadable/component';
|
|
111
|
-
export const lazy = (loader) => universal(loader);
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
`;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import pluginTester from 'babel-plugin-tester';
|
|
3
|
-
import babelConfig from '../../index';
|
|
4
|
-
|
|
5
|
-
pluginTester({
|
|
6
|
-
plugin: {}, // плагин уже есть в основном конфиге, если подключить ещё тут то babel упадёт
|
|
7
|
-
pluginName: 'lazy-component',
|
|
8
|
-
filename: path.join(__dirname, '..', '__fixtures__', 'lazy-component', 'test'),
|
|
9
|
-
babelOptions: babelConfig({
|
|
10
|
-
typescript: true,
|
|
11
|
-
generateDataQaTag: false,
|
|
12
|
-
loader: false,
|
|
13
|
-
hot: true,
|
|
14
|
-
browsersListTargets: ['defaults'],
|
|
15
|
-
}),
|
|
16
|
-
tests: {
|
|
17
|
-
'not lazy': {
|
|
18
|
-
fixture: 'not-lazy.ts',
|
|
19
|
-
snapshot: true,
|
|
20
|
-
},
|
|
21
|
-
'tramvai react but not lazy': {
|
|
22
|
-
fixture: 'not-lazy-import.ts',
|
|
23
|
-
snapshot: true,
|
|
24
|
-
},
|
|
25
|
-
base: {
|
|
26
|
-
fixture: 'base.ts',
|
|
27
|
-
snapshot: true,
|
|
28
|
-
},
|
|
29
|
-
'long import': {
|
|
30
|
-
fixture: 'long-import.ts',
|
|
31
|
-
snapshot: true,
|
|
32
|
-
},
|
|
33
|
-
dynamic: {
|
|
34
|
-
fixture: 'dynamic.ts',
|
|
35
|
-
snapshot: true,
|
|
36
|
-
},
|
|
37
|
-
comments: {
|
|
38
|
-
fixture: 'comments.ts',
|
|
39
|
-
snapshot: true,
|
|
40
|
-
},
|
|
41
|
-
hmr: {
|
|
42
|
-
fixture: 'lazy+hmr.ts',
|
|
43
|
-
snapshot: true,
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
});
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import type { NodePath } from '@babel/traverse';
|
|
2
|
-
import type { CallExpression, Import } from '@babel/types';
|
|
3
|
-
import type { Plugin } from '../types.h';
|
|
4
|
-
import { resolveMethod } from './properties/resolve';
|
|
5
|
-
import { requireSyncMethod } from './properties/requireSync';
|
|
6
|
-
import { isReadyMethod } from './properties/isReady';
|
|
7
|
-
import { importAsyncMethod } from './properties/importAsync';
|
|
8
|
-
import { requireAsyncMethod } from './properties/requireAsync';
|
|
9
|
-
import { chunkNameMethod } from './properties/chunkName';
|
|
10
|
-
|
|
11
|
-
interface InnerState {
|
|
12
|
-
tramvaiReactLazyLocal: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const lazyComponentPlugin: Plugin<InnerState> = (api) => {
|
|
16
|
-
const { types: t } = api;
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
pre() {
|
|
20
|
-
this.tramvaiReactLazyLocal = null;
|
|
21
|
-
},
|
|
22
|
-
visitor: {
|
|
23
|
-
// находим импорты `import { lazy } from '@tramvai/react'` т.к. будем преобразовывать импорты только для них
|
|
24
|
-
ImportDeclaration(path) {
|
|
25
|
-
if (path.get('source').node.value === '@tramvai/react') {
|
|
26
|
-
const specifiers = path.get('specifiers');
|
|
27
|
-
|
|
28
|
-
for (const specifier of specifiers) {
|
|
29
|
-
if (
|
|
30
|
-
t.isImportSpecifier(specifier.node) &&
|
|
31
|
-
t.isIdentifier(specifier.node.imported) &&
|
|
32
|
-
specifier.node.imported.name === 'lazy'
|
|
33
|
-
) {
|
|
34
|
-
// учитываем что локальная переменная в файле может быть названа по-другому
|
|
35
|
-
this.tramvaiReactLazyLocal = specifier.node.local.name;
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
CallExpression(path) {
|
|
42
|
-
if (!this.tramvaiReactLazyLocal) {
|
|
43
|
-
// если импорт lazy не был найден, то нет смысла работать с файлом дальше
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// проверяет только вызовы lazy
|
|
48
|
-
if (path.get('callee').isIdentifier({ name: this.tramvaiReactLazyLocal })) {
|
|
49
|
-
const imports: NodePath<Import>[] = [];
|
|
50
|
-
|
|
51
|
-
// ищем импорты внутри вызова lazy
|
|
52
|
-
path.traverse({
|
|
53
|
-
Import(importPath) {
|
|
54
|
-
imports.push(importPath);
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
if (imports.length !== 1) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// локальное имя для lazy из @tramvai/react
|
|
63
|
-
const lazyCallPath = path;
|
|
64
|
-
// ссылка на вызов импорта - чтобы можно было получить аргументы импорта
|
|
65
|
-
const importPath = imports[0].parentPath as NodePath<CallExpression>;
|
|
66
|
-
// ссылка на функцию, которая была передана в lazy
|
|
67
|
-
const funcPath = importPath.parentPath;
|
|
68
|
-
|
|
69
|
-
if (!funcPath.isFunctionExpression() && !funcPath.isArrowFunctionExpression()) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const properties = [
|
|
74
|
-
chunkNameMethod,
|
|
75
|
-
requireSyncMethod,
|
|
76
|
-
isReadyMethod,
|
|
77
|
-
importAsyncMethod,
|
|
78
|
-
requireAsyncMethod,
|
|
79
|
-
resolveMethod,
|
|
80
|
-
].map((init) => init(api));
|
|
81
|
-
|
|
82
|
-
const opts = { lazyCallPath, funcPath, importPath };
|
|
83
|
-
|
|
84
|
-
funcPath.replaceWith(t.objectExpression(properties.map((factory) => factory(opts))));
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export default lazyComponentPlugin;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import pluginTester from 'babel-plugin-tester';
|
|
3
|
-
import babelConfig from '../../index';
|
|
4
|
-
|
|
5
|
-
pluginTester({
|
|
6
|
-
plugin: {}, // плагин уже есть в основном конфиге, если подключить ещё тут то babel упадёт
|
|
7
|
-
pluginName: 'legacy-universal-replace',
|
|
8
|
-
filename: path.join(__dirname, '..', '__fixtures__', 'legacy-universal-replace', 'test'),
|
|
9
|
-
babelOptions: babelConfig({
|
|
10
|
-
typescript: true,
|
|
11
|
-
generateDataQaTag: false,
|
|
12
|
-
loader: false,
|
|
13
|
-
browsersListTargets: ['defaults'],
|
|
14
|
-
}),
|
|
15
|
-
tests: {
|
|
16
|
-
'not universal': {
|
|
17
|
-
fixture: 'not-universal.ts',
|
|
18
|
-
snapshot: true,
|
|
19
|
-
},
|
|
20
|
-
'react-universal': {
|
|
21
|
-
fixture: 'react-universal.ts',
|
|
22
|
-
snapshot: true,
|
|
23
|
-
},
|
|
24
|
-
'platform legacy': {
|
|
25
|
-
fixture: 'platform-legacy.ts',
|
|
26
|
-
snapshot: true,
|
|
27
|
-
},
|
|
28
|
-
'tramvai-react': {
|
|
29
|
-
fixture: 'tramvai/react/index.es.ts',
|
|
30
|
-
snapshot: true,
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
});
|