@nativescript/vite 8.0.0-alpha.9 → 8.0.0-dev.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/README.md +89 -14
- package/bin/cli.cjs +8 -14
- package/configuration/angular.d.ts +34 -1
- package/configuration/angular.js +196 -217
- package/configuration/angular.js.map +1 -1
- package/configuration/base.js +152 -104
- package/configuration/base.js.map +1 -1
- package/configuration/javascript.js +14 -93
- package/configuration/javascript.js.map +1 -1
- package/configuration/react.js +41 -73
- package/configuration/react.js.map +1 -1
- package/configuration/solid.js +51 -6
- package/configuration/solid.js.map +1 -1
- package/configuration/typescript.js +11 -92
- package/configuration/typescript.js.map +1 -1
- package/framework.d.ts +22 -0
- package/framework.js +18 -0
- package/framework.js.map +1 -0
- package/helpers/app-components.d.ts +2 -1
- package/helpers/app-components.js.map +1 -1
- package/helpers/app-css-refresh.d.ts +31 -0
- package/helpers/app-css-refresh.js +43 -0
- package/helpers/app-css-refresh.js.map +1 -0
- package/helpers/app-css-state.d.ts +17 -0
- package/helpers/app-css-state.js +51 -0
- package/helpers/app-css-state.js.map +1 -0
- package/helpers/bundler-context.d.ts +11 -0
- package/helpers/bundler-context.js +71 -0
- package/helpers/bundler-context.js.map +1 -0
- package/helpers/cli-flags.d.ts +12 -0
- package/helpers/cli-flags.js +34 -0
- package/helpers/cli-flags.js.map +1 -1
- package/helpers/css-platform-plugin.d.ts +14 -0
- package/helpers/css-platform-plugin.js +43 -25
- package/helpers/css-platform-plugin.js.map +1 -1
- package/helpers/dev-host.d.ts +360 -0
- package/helpers/dev-host.js +694 -0
- package/helpers/dev-host.js.map +1 -0
- package/helpers/dynamic-import-plugin.d.ts +2 -1
- package/helpers/dynamic-import-plugin.js +59 -53
- package/helpers/dynamic-import-plugin.js.map +1 -1
- package/helpers/esbuild-platform-resolver.js +4 -1
- package/helpers/esbuild-platform-resolver.js.map +1 -1
- package/helpers/external-configs.d.ts +10 -12
- package/helpers/external-configs.js +58 -35
- package/helpers/external-configs.js.map +1 -1
- package/helpers/flavor.d.ts +31 -0
- package/helpers/flavor.js +53 -2
- package/helpers/flavor.js.map +1 -1
- package/helpers/global-defines.d.ts +100 -33
- package/helpers/global-defines.js +192 -66
- package/helpers/global-defines.js.map +1 -1
- package/helpers/hmr-scope.d.ts +26 -0
- package/helpers/hmr-scope.js +67 -0
- package/helpers/hmr-scope.js.map +1 -0
- package/helpers/init.js +24 -26
- package/helpers/init.js.map +1 -1
- package/helpers/logging.d.ts +11 -1
- package/helpers/logging.js +45 -2
- package/helpers/logging.js.map +1 -1
- package/helpers/main-entry.d.ts +4 -1
- package/helpers/main-entry.js +293 -40
- package/helpers/main-entry.js.map +1 -1
- package/helpers/nativeclass-esbuild-plugin.d.ts +2 -1
- package/helpers/nativeclass-esbuild-plugin.js +6 -1
- package/helpers/nativeclass-esbuild-plugin.js.map +1 -1
- package/helpers/nativeclass-transform.d.ts +13 -0
- package/helpers/nativeclass-transform.js +37 -7
- package/helpers/nativeclass-transform.js.map +1 -1
- package/helpers/nativeclass-transformer-plugin.js +8 -3
- package/helpers/nativeclass-transformer-plugin.js.map +1 -1
- package/helpers/nativescript-package-resolver.js +10 -62
- package/helpers/nativescript-package-resolver.js.map +1 -1
- package/helpers/normalize-id.d.ts +42 -0
- package/helpers/normalize-id.js +60 -0
- package/helpers/normalize-id.js.map +1 -0
- package/helpers/ns-core-external-urls.d.ts +32 -0
- package/helpers/ns-core-external-urls.js +107 -0
- package/helpers/ns-core-external-urls.js.map +1 -0
- package/helpers/ns-core-url.d.ts +26 -3
- package/helpers/ns-core-url.js +66 -8
- package/helpers/ns-core-url.js.map +1 -1
- package/helpers/optimize-deps.d.ts +16 -0
- package/helpers/optimize-deps.js +17 -0
- package/helpers/optimize-deps.js.map +1 -0
- package/helpers/package-platform-aliases.js +34 -49
- package/helpers/package-platform-aliases.js.map +1 -1
- package/helpers/platform-types.d.ts +2 -0
- package/helpers/platform-types.js +2 -0
- package/helpers/platform-types.js.map +1 -0
- package/helpers/postcss-platform-config.d.ts +17 -1
- package/helpers/postcss-platform-config.js +20 -37
- package/helpers/postcss-platform-config.js.map +1 -1
- package/helpers/resolve-main-field-platform.d.ts +20 -0
- package/helpers/resolve-main-field-platform.js +49 -0
- package/helpers/resolve-main-field-platform.js.map +1 -0
- package/helpers/resolver.js +17 -2
- package/helpers/resolver.js.map +1 -1
- package/helpers/theme-core-plugins.js +1 -1
- package/helpers/theme-core-plugins.js.map +1 -1
- package/helpers/ts-config-paths.d.ts +32 -0
- package/helpers/ts-config-paths.js +143 -62
- package/helpers/ts-config-paths.js.map +1 -1
- package/helpers/typescript-check.d.ts +3 -3
- package/helpers/typescript-check.js +4 -4
- package/helpers/typescript-check.js.map +1 -1
- package/helpers/ui-registration.d.ts +21 -0
- package/helpers/ui-registration.js +156 -0
- package/helpers/ui-registration.js.map +1 -0
- package/helpers/utils.d.ts +9 -0
- package/helpers/utils.js +22 -2
- package/helpers/utils.js.map +1 -1
- package/helpers/vite-package-version.d.ts +7 -0
- package/helpers/vite-package-version.js +44 -0
- package/helpers/vite-package-version.js.map +1 -0
- package/helpers/workers.d.ts +33 -0
- package/helpers/workers.js +237 -10
- package/helpers/workers.js.map +1 -1
- package/hmr/client/css-handler.d.ts +2 -1
- package/hmr/client/css-handler.js +63 -32
- package/hmr/client/css-handler.js.map +1 -1
- package/hmr/client/css-update-overlay.d.ts +18 -0
- package/hmr/client/css-update-overlay.js +27 -0
- package/hmr/client/css-update-overlay.js.map +1 -0
- package/hmr/client/framework-client-strategy.d.ts +117 -0
- package/hmr/client/framework-client-strategy.js +18 -0
- package/hmr/client/framework-client-strategy.js.map +1 -0
- package/hmr/client/framework.d.ts +31 -0
- package/hmr/client/framework.js +17 -0
- package/hmr/client/framework.js.map +1 -0
- package/hmr/client/hmr-pending-overlay.d.ts +0 -14
- package/hmr/client/hmr-pending-overlay.js +2 -11
- package/hmr/client/hmr-pending-overlay.js.map +1 -1
- package/hmr/client/hot-context.d.ts +89 -0
- package/hmr/client/hot-context.js +404 -0
- package/hmr/client/hot-context.js.map +1 -0
- package/hmr/client/index.d.ts +9 -1
- package/hmr/client/index.js +70 -1970
- package/hmr/client/index.js.map +1 -1
- package/hmr/client/overlay-driver.d.ts +10 -0
- package/hmr/client/overlay-driver.js +33 -0
- package/hmr/client/overlay-driver.js.map +1 -0
- package/hmr/client/protocol-dispatch.d.ts +8 -0
- package/hmr/client/protocol-dispatch.js +308 -0
- package/hmr/client/protocol-dispatch.js.map +1 -0
- package/hmr/client/root-reset.d.ts +15 -0
- package/hmr/client/root-reset.js +358 -0
- package/hmr/client/root-reset.js.map +1 -0
- package/hmr/client/strategy-loader.d.ts +24 -0
- package/hmr/client/strategy-loader.js +136 -0
- package/hmr/client/strategy-loader.js.map +1 -0
- package/hmr/client/update-pipeline.d.ts +27 -0
- package/hmr/client/update-pipeline.js +489 -0
- package/hmr/client/update-pipeline.js.map +1 -0
- package/hmr/client/utils.d.ts +9 -1
- package/hmr/client/utils.js +117 -97
- package/hmr/client/utils.js.map +1 -1
- package/hmr/client/ws-transport.d.ts +21 -0
- package/hmr/client/ws-transport.js +323 -0
- package/hmr/client/ws-transport.js.map +1 -0
- package/hmr/entry-runtime.d.ts +2 -1
- package/hmr/entry-runtime.js +279 -44
- package/hmr/entry-runtime.js.map +1 -1
- package/hmr/framework-flavors.d.ts +59 -0
- package/hmr/framework-flavors.js +108 -0
- package/hmr/framework-flavors.js.map +1 -0
- package/hmr/frameworks/angular/build/angular-linker.d.ts +12 -0
- package/hmr/frameworks/angular/build/angular-linker.js +113 -0
- package/hmr/frameworks/angular/build/angular-linker.js.map +1 -0
- package/{helpers/angular → hmr/frameworks/angular/build}/inject-component-hmr-registration.js +2 -70
- package/hmr/frameworks/angular/build/inject-component-hmr-registration.js.map +1 -0
- package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.d.ts +75 -0
- package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.js +221 -0
- package/hmr/frameworks/angular/build/inject-hmr-vite-ignore.js.map +1 -0
- package/{helpers/angular → hmr/frameworks/angular/build}/inline-decorator-component-templates.js +1 -170
- package/hmr/frameworks/angular/build/inline-decorator-component-templates.js.map +1 -0
- package/hmr/frameworks/angular/build/js-lexer.d.ts +4 -0
- package/{helpers/angular/synthesize-decorator-ctor-parameters.js → hmr/frameworks/angular/build/js-lexer.js} +22 -96
- package/hmr/frameworks/angular/build/js-lexer.js.map +1 -0
- package/hmr/frameworks/angular/build/linker-stats.d.ts +18 -0
- package/hmr/frameworks/angular/build/linker-stats.js +29 -0
- package/hmr/frameworks/angular/build/linker-stats.js.map +1 -0
- package/hmr/frameworks/angular/build/shared-linker.d.ts +39 -0
- package/hmr/frameworks/angular/build/shared-linker.js +128 -0
- package/hmr/frameworks/angular/build/shared-linker.js.map +1 -0
- package/hmr/frameworks/angular/build/synthesize-decorator-ctor-parameters.js +88 -0
- package/hmr/frameworks/angular/build/synthesize-decorator-ctor-parameters.js.map +1 -0
- package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-injectable-factories.js +1 -174
- package/hmr/frameworks/angular/build/synthesize-injectable-factories.js.map +1 -0
- package/hmr/frameworks/angular/build/ts-fallback-transform.d.ts +5 -0
- package/hmr/frameworks/angular/build/ts-fallback-transform.js +138 -0
- package/hmr/frameworks/angular/build/ts-fallback-transform.js.map +1 -0
- package/hmr/frameworks/angular/build/util.js.map +1 -0
- package/hmr/frameworks/angular/build/worker-url-preserve.d.ts +5 -0
- package/hmr/frameworks/angular/build/worker-url-preserve.js +140 -0
- package/hmr/frameworks/angular/build/worker-url-preserve.js.map +1 -0
- package/hmr/frameworks/angular/client/index.d.ts +0 -1
- package/hmr/frameworks/angular/client/index.js +360 -194
- package/hmr/frameworks/angular/client/index.js.map +1 -1
- package/hmr/frameworks/angular/client/strategy.d.ts +9 -0
- package/hmr/frameworks/angular/client/strategy.js +19 -0
- package/hmr/frameworks/angular/client/strategy.js.map +1 -0
- package/hmr/frameworks/angular/server/angular-root-component.d.ts +79 -0
- package/hmr/frameworks/angular/server/angular-root-component.js +149 -0
- package/hmr/frameworks/angular/server/angular-root-component.js.map +1 -0
- package/hmr/frameworks/angular/server/ng-component-route.d.ts +43 -0
- package/hmr/frameworks/angular/server/ng-component-route.js +113 -0
- package/hmr/frameworks/angular/server/ng-component-route.js.map +1 -0
- package/hmr/frameworks/angular/server/strategy.js +668 -13
- package/hmr/frameworks/angular/server/strategy.js.map +1 -1
- package/hmr/{server → frameworks/angular/server}/websocket-angular-entry.js +2 -2
- package/hmr/frameworks/angular/server/websocket-angular-entry.js.map +1 -0
- package/hmr/{server → frameworks/angular/server}/websocket-angular-hot-update.d.ts +27 -11
- package/hmr/{server → frameworks/angular/server}/websocket-angular-hot-update.js +179 -107
- package/hmr/frameworks/angular/server/websocket-angular-hot-update.js.map +1 -0
- package/hmr/frameworks/react/client/strategy.d.ts +12 -0
- package/hmr/frameworks/react/client/strategy.js +27 -0
- package/hmr/frameworks/react/client/strategy.js.map +1 -0
- package/hmr/frameworks/react/server/strategy.d.ts +2 -0
- package/hmr/frameworks/react/server/strategy.js +230 -0
- package/hmr/frameworks/react/server/strategy.js.map +1 -0
- package/hmr/frameworks/solid/build/solid-jsx-deps.d.ts +15 -0
- package/hmr/frameworks/solid/build/solid-jsx-deps.js +178 -0
- package/hmr/frameworks/solid/build/solid-jsx-deps.js.map +1 -0
- package/hmr/frameworks/solid/client/app-runtime.d.ts +68 -0
- package/hmr/frameworks/solid/client/app-runtime.js +252 -0
- package/hmr/frameworks/solid/client/app-runtime.js.map +1 -0
- package/hmr/frameworks/solid/client/strategy.d.ts +7 -0
- package/hmr/frameworks/solid/client/strategy.js +391 -0
- package/hmr/frameworks/solid/client/strategy.js.map +1 -0
- package/hmr/frameworks/solid/server/strategy.js +293 -16
- package/hmr/frameworks/solid/server/strategy.js.map +1 -1
- package/hmr/frameworks/typescript/client/strategy.d.ts +7 -0
- package/hmr/frameworks/typescript/client/strategy.js +418 -0
- package/hmr/frameworks/typescript/client/strategy.js.map +1 -0
- package/hmr/frameworks/typescript/server/strategy.js +40 -14
- package/hmr/frameworks/typescript/server/strategy.js.map +1 -1
- package/hmr/frameworks/vue/client/dep-propagation.d.ts +44 -0
- package/hmr/frameworks/vue/client/dep-propagation.js +148 -0
- package/hmr/frameworks/vue/client/dep-propagation.js.map +1 -0
- package/hmr/frameworks/vue/client/index.d.ts +10 -1
- package/hmr/frameworks/vue/client/index.js +270 -521
- package/hmr/frameworks/vue/client/index.js.map +1 -1
- package/hmr/frameworks/vue/client/navigate-app.d.ts +3 -0
- package/hmr/frameworks/vue/client/navigate-app.js +178 -0
- package/hmr/frameworks/vue/client/navigate-app.js.map +1 -0
- package/hmr/frameworks/vue/client/strategy.d.ts +33 -0
- package/hmr/frameworks/vue/client/strategy.js +152 -0
- package/hmr/frameworks/vue/client/strategy.js.map +1 -0
- package/hmr/frameworks/vue/client/vue-sfc-update-overlay.d.ts +49 -0
- package/hmr/frameworks/vue/client/vue-sfc-update-overlay.js +124 -0
- package/hmr/frameworks/vue/client/vue-sfc-update-overlay.js.map +1 -0
- package/hmr/frameworks/vue/server/compiler.d.ts +3 -1
- package/hmr/frameworks/vue/server/compiler.js +3 -1
- package/hmr/frameworks/vue/server/compiler.js.map +1 -1
- package/hmr/frameworks/vue/server/sfc-route-assemble.d.ts +7 -0
- package/hmr/frameworks/vue/server/sfc-route-assemble.js +823 -0
- package/hmr/frameworks/vue/server/sfc-route-assemble.js.map +1 -0
- package/hmr/frameworks/vue/server/sfc-route-meta.d.ts +7 -0
- package/hmr/frameworks/vue/server/sfc-route-meta.js +80 -0
- package/hmr/frameworks/vue/server/sfc-route-meta.js.map +1 -0
- package/hmr/frameworks/vue/server/sfc-route-serve.d.ts +8 -0
- package/hmr/frameworks/vue/server/sfc-route-serve.js +462 -0
- package/hmr/frameworks/vue/server/sfc-route-serve.js.map +1 -0
- package/hmr/frameworks/vue/server/sfc-route-shared.d.ts +45 -0
- package/hmr/frameworks/vue/server/sfc-route-shared.js +105 -0
- package/hmr/frameworks/vue/server/sfc-route-shared.js.map +1 -0
- package/hmr/frameworks/vue/server/strategy.d.ts +35 -0
- package/hmr/frameworks/vue/server/strategy.js +291 -7
- package/hmr/frameworks/vue/server/strategy.js.map +1 -1
- package/hmr/frameworks/vue/server/websocket-sfc.d.ts +15 -0
- package/hmr/frameworks/vue/server/websocket-sfc.js +20 -0
- package/hmr/frameworks/vue/server/websocket-sfc.js.map +1 -0
- package/hmr/helpers/ast-normalizer.d.ts +3 -1
- package/hmr/helpers/ast-normalizer.js +109 -14
- package/hmr/helpers/ast-normalizer.js.map +1 -1
- package/hmr/helpers/package-exports.d.ts +16 -0
- package/hmr/helpers/package-exports.js +396 -0
- package/hmr/helpers/package-exports.js.map +1 -0
- package/hmr/helpers/vendor-rewrite.d.ts +1 -1
- package/hmr/helpers/vendor-rewrite.js +5 -3
- package/hmr/helpers/vendor-rewrite.js.map +1 -1
- package/hmr/server/boot-recording.d.ts +51 -0
- package/hmr/server/boot-recording.js +214 -0
- package/hmr/server/boot-recording.js.map +1 -0
- package/hmr/server/constants.js +7 -1
- package/hmr/server/constants.js.map +1 -1
- package/hmr/server/content-css-update.d.ts +54 -0
- package/hmr/server/content-css-update.js +78 -0
- package/hmr/server/content-css-update.js.map +1 -0
- package/hmr/server/core-bundle.d.ts +140 -0
- package/hmr/server/core-bundle.js +614 -0
- package/hmr/server/core-bundle.js.map +1 -0
- package/hmr/server/core-sanitize.d.ts +86 -7
- package/hmr/server/core-sanitize.js +155 -37
- package/hmr/server/core-sanitize.js.map +1 -1
- package/hmr/server/css-connect-sync.d.ts +28 -0
- package/hmr/server/css-connect-sync.js +59 -0
- package/hmr/server/css-connect-sync.js.map +1 -0
- package/hmr/server/css-device-module.d.ts +28 -0
- package/hmr/server/css-device-module.js +44 -0
- package/hmr/server/css-device-module.js.map +1 -0
- package/hmr/server/css-update-message.d.ts +23 -0
- package/hmr/server/css-update-message.js +41 -0
- package/hmr/server/css-update-message.js.map +1 -0
- package/hmr/server/deps-bundle.d.ts +233 -0
- package/hmr/server/deps-bundle.js +1022 -0
- package/hmr/server/deps-bundle.js.map +1 -0
- package/hmr/server/device-transform-helpers.d.ts +24 -0
- package/hmr/server/device-transform-helpers.js +408 -0
- package/hmr/server/device-transform-helpers.js.map +1 -0
- package/hmr/server/framework-strategy.d.ts +182 -11
- package/hmr/server/hmr-module-graph.d.ts +37 -0
- package/hmr/server/hmr-module-graph.js +215 -0
- package/hmr/server/hmr-module-graph.js.map +1 -0
- package/hmr/server/import-map.d.ts +57 -23
- package/hmr/server/import-map.js +142 -70
- package/hmr/server/import-map.js.map +1 -1
- package/hmr/server/index.js +7 -16
- package/hmr/server/index.js.map +1 -1
- package/hmr/server/node-builtins-route.d.ts +12 -0
- package/hmr/server/node-builtins-route.js +86 -0
- package/hmr/server/node-builtins-route.js.map +1 -0
- package/hmr/server/ns-m-response-memo.d.ts +10 -0
- package/hmr/server/ns-m-response-memo.js +33 -0
- package/hmr/server/ns-m-response-memo.js.map +1 -0
- package/hmr/server/ns-rt-bridge.d.ts +51 -0
- package/hmr/server/ns-rt-bridge.js +131 -0
- package/hmr/server/ns-rt-bridge.js.map +1 -0
- package/hmr/server/ns-rt-route.d.ts +5 -0
- package/hmr/server/ns-rt-route.js +39 -0
- package/hmr/server/ns-rt-route.js.map +1 -0
- package/hmr/server/perf-instrumentation.d.ts +1 -1
- package/hmr/server/perf-instrumentation.js +3 -1
- package/hmr/server/perf-instrumentation.js.map +1 -1
- package/hmr/server/process-code-for-device.d.ts +54 -0
- package/hmr/server/process-code-for-device.js +832 -0
- package/hmr/server/process-code-for-device.js.map +1 -0
- package/hmr/server/require-guard.d.ts +1 -0
- package/hmr/server/require-guard.js +12 -0
- package/hmr/server/require-guard.js.map +1 -0
- package/hmr/server/rewrite-imports.d.ts +2 -0
- package/hmr/server/rewrite-imports.js +631 -0
- package/hmr/server/rewrite-imports.js.map +1 -0
- package/hmr/server/route-helpers.d.ts +7 -0
- package/hmr/server/route-helpers.js +13 -0
- package/hmr/server/route-helpers.js.map +1 -0
- package/hmr/server/runtime-graph-filter.js +8 -1
- package/hmr/server/runtime-graph-filter.js.map +1 -1
- package/hmr/server/server-origin.d.ts +2 -0
- package/hmr/server/server-origin.js +88 -0
- package/hmr/server/server-origin.js.map +1 -0
- package/hmr/server/shared-transform-request.js +1 -2
- package/hmr/server/shared-transform-request.js.map +1 -1
- package/hmr/server/socket-utils.d.ts +10 -0
- package/hmr/server/socket-utils.js +14 -0
- package/hmr/server/socket-utils.js.map +1 -0
- package/hmr/server/transform-cache-invalidation.d.ts +37 -0
- package/hmr/server/transform-cache-invalidation.js +156 -0
- package/hmr/server/transform-cache-invalidation.js.map +1 -0
- package/hmr/server/vendor-bare-module-shims.d.ts +4 -0
- package/hmr/server/vendor-bare-module-shims.js +80 -0
- package/hmr/server/vendor-bare-module-shims.js.map +1 -0
- package/hmr/server/vite-plugin.d.ts +1 -0
- package/hmr/server/vite-plugin.js +211 -53
- package/hmr/server/vite-plugin.js.map +1 -1
- package/hmr/server/websocket-core-bridge.d.ts +51 -4
- package/hmr/server/websocket-core-bridge.js +62 -49
- package/hmr/server/websocket-core-bridge.js.map +1 -1
- package/hmr/server/websocket-device-transform.d.ts +3 -0
- package/hmr/server/websocket-device-transform.js +7 -0
- package/hmr/server/websocket-device-transform.js.map +1 -0
- package/hmr/server/websocket-hmr-pending.d.ts +2 -16
- package/hmr/server/websocket-hmr-pending.js +0 -22
- package/hmr/server/websocket-hmr-pending.js.map +1 -1
- package/hmr/server/websocket-hot-update.d.ts +80 -0
- package/hmr/server/websocket-hot-update.js +299 -0
- package/hmr/server/websocket-hot-update.js.map +1 -0
- package/hmr/server/websocket-import-map-route.d.ts +15 -0
- package/hmr/server/websocket-import-map-route.js +51 -0
- package/hmr/server/websocket-import-map-route.js.map +1 -0
- package/hmr/server/websocket-module-bindings.d.ts +15 -0
- package/hmr/server/websocket-module-bindings.js +36 -3
- package/hmr/server/websocket-module-bindings.js.map +1 -1
- package/hmr/server/websocket-module-specifiers.d.ts +2 -5
- package/hmr/server/websocket-module-specifiers.js +42 -30
- package/hmr/server/websocket-module-specifiers.js.map +1 -1
- package/hmr/server/websocket-ns-core.d.ts +34 -0
- package/hmr/server/websocket-ns-core.js +414 -0
- package/hmr/server/websocket-ns-core.js.map +1 -0
- package/hmr/server/websocket-ns-entry.d.ts +21 -0
- package/hmr/server/websocket-ns-entry.js +163 -0
- package/hmr/server/websocket-ns-entry.js.map +1 -0
- package/hmr/server/websocket-ns-m-paths.d.ts +19 -3
- package/hmr/server/websocket-ns-m-paths.js +98 -75
- package/hmr/server/websocket-ns-m-paths.js.map +1 -1
- package/hmr/server/websocket-ns-m-request.d.ts +2 -1
- package/hmr/server/websocket-ns-m-request.js +3 -2
- package/hmr/server/websocket-ns-m-request.js.map +1 -1
- package/hmr/server/websocket-ns-m.d.ts +52 -0
- package/hmr/server/websocket-ns-m.js +592 -0
- package/hmr/server/websocket-ns-m.js.map +1 -0
- package/hmr/server/websocket-served-module-helpers.d.ts +65 -3
- package/hmr/server/websocket-served-module-helpers.js +457 -140
- package/hmr/server/websocket-served-module-helpers.js.map +1 -1
- package/hmr/server/websocket-txn.js +6 -9
- package/hmr/server/websocket-txn.js.map +1 -1
- package/hmr/server/websocket-vendor-unifier.d.ts +0 -1
- package/hmr/server/websocket-vendor-unifier.js +4 -9
- package/hmr/server/websocket-vendor-unifier.js.map +1 -1
- package/hmr/server/websocket.d.ts +6 -40
- package/hmr/server/websocket.js +661 -6751
- package/hmr/server/websocket.js.map +1 -1
- package/hmr/shared/ns-globals.d.ts +108 -0
- package/hmr/shared/ns-globals.js +29 -0
- package/hmr/shared/ns-globals.js.map +1 -0
- package/hmr/shared/protocol.d.ts +157 -0
- package/hmr/shared/protocol.js +28 -0
- package/hmr/shared/protocol.js.map +1 -0
- package/hmr/shared/runtime/boot-complete.d.ts +14 -0
- package/hmr/shared/runtime/boot-complete.js +32 -0
- package/hmr/shared/runtime/boot-complete.js.map +1 -0
- package/hmr/shared/runtime/boot-placeholder-ui.d.ts +69 -0
- package/hmr/shared/runtime/boot-placeholder-ui.js +101 -0
- package/hmr/shared/runtime/boot-placeholder-ui.js.map +1 -0
- package/hmr/shared/runtime/boot-progress.d.ts +44 -0
- package/hmr/shared/runtime/boot-progress.js +134 -0
- package/hmr/shared/runtime/boot-progress.js.map +1 -0
- package/hmr/shared/runtime/boot-timeline.d.ts +1 -1
- package/hmr/shared/runtime/boot-timeline.js +8 -19
- package/hmr/shared/runtime/boot-timeline.js.map +1 -1
- package/hmr/shared/runtime/browser-runtime-contract.d.ts +58 -25
- package/hmr/shared/runtime/browser-runtime-contract.js +21 -9
- package/hmr/shared/runtime/browser-runtime-contract.js.map +1 -1
- package/hmr/shared/runtime/dev-overlay-ios.d.ts +87 -0
- package/hmr/shared/runtime/dev-overlay-ios.js +521 -0
- package/hmr/shared/runtime/dev-overlay-ios.js.map +1 -0
- package/hmr/shared/runtime/dev-overlay-shared.d.ts +58 -0
- package/hmr/shared/runtime/dev-overlay-shared.js +116 -0
- package/hmr/shared/runtime/dev-overlay-shared.js.map +1 -0
- package/hmr/shared/runtime/dev-overlay-snapshots.d.ts +31 -0
- package/hmr/shared/runtime/dev-overlay-snapshots.js +324 -0
- package/hmr/shared/runtime/dev-overlay-snapshots.js.map +1 -0
- package/hmr/shared/runtime/dev-overlay-tree.d.ts +59 -0
- package/hmr/shared/runtime/dev-overlay-tree.js +712 -0
- package/hmr/shared/runtime/dev-overlay-tree.js.map +1 -0
- package/hmr/shared/runtime/dev-overlay.d.ts +23 -69
- package/hmr/shared/runtime/dev-overlay.js +67 -1011
- package/hmr/shared/runtime/dev-overlay.js.map +1 -1
- package/hmr/shared/runtime/global-scope.d.ts +18 -0
- package/hmr/shared/runtime/global-scope.js +21 -0
- package/hmr/shared/runtime/global-scope.js.map +1 -0
- package/hmr/shared/runtime/hooks.js +2 -1
- package/hmr/shared/runtime/hooks.js.map +1 -1
- package/hmr/shared/runtime/launch-bridge.d.ts +9 -0
- package/hmr/shared/runtime/launch-bridge.js +98 -0
- package/hmr/shared/runtime/launch-bridge.js.map +1 -0
- package/hmr/shared/runtime/module-provenance.js +3 -2
- package/hmr/shared/runtime/module-provenance.js.map +1 -1
- package/hmr/shared/runtime/ns-runtime-test-double.d.ts +21 -0
- package/hmr/shared/runtime/ns-runtime-test-double.js +20 -0
- package/hmr/shared/runtime/ns-runtime-test-double.js.map +1 -0
- package/hmr/shared/runtime/overlay-flag.d.ts +9 -0
- package/hmr/shared/runtime/overlay-flag.js +34 -0
- package/hmr/shared/runtime/overlay-flag.js.map +1 -0
- package/hmr/shared/runtime/root-placeholder-view.d.ts +19 -0
- package/hmr/shared/runtime/root-placeholder-view.js +311 -0
- package/hmr/shared/runtime/root-placeholder-view.js.map +1 -0
- package/hmr/shared/runtime/root-placeholder.js +382 -157
- package/hmr/shared/runtime/root-placeholder.js.map +1 -1
- package/hmr/shared/runtime/session-bootstrap.js +209 -54
- package/hmr/shared/runtime/session-bootstrap.js.map +1 -1
- package/hmr/shared/runtime/vendor-bootstrap.js +2 -1
- package/hmr/shared/runtime/vendor-bootstrap.js.map +1 -1
- package/hmr/shared/runtime/vendor-resolve.d.ts +22 -0
- package/hmr/shared/runtime/vendor-resolve.js +45 -0
- package/hmr/shared/runtime/vendor-resolve.js.map +1 -0
- package/hmr/shared/runtime/worker-tracking.d.ts +28 -0
- package/hmr/shared/runtime/worker-tracking.js +114 -0
- package/hmr/shared/runtime/worker-tracking.js.map +1 -0
- package/hmr/shared/vendor/manifest-collect.d.ts +4 -0
- package/hmr/shared/vendor/manifest-collect.js +909 -0
- package/hmr/shared/vendor/manifest-collect.js.map +1 -0
- package/hmr/shared/vendor/manifest-loader.d.ts +2 -1
- package/hmr/shared/vendor/manifest-loader.js +5 -3
- package/hmr/shared/vendor/manifest-loader.js.map +1 -1
- package/hmr/shared/vendor/manifest.d.ts +10 -35
- package/hmr/shared/vendor/manifest.js +154 -978
- package/hmr/shared/vendor/manifest.js.map +1 -1
- package/hmr/shared/vendor/registry.d.ts +2 -0
- package/hmr/shared/vendor/registry.js +14 -0
- package/hmr/shared/vendor/registry.js.map +1 -1
- package/hmr/shared/vendor/vendor-device-shim.d.ts +1 -0
- package/hmr/shared/vendor/vendor-device-shim.js +208 -0
- package/hmr/shared/vendor/vendor-device-shim.js.map +1 -0
- package/hmr/shared/vendor/vendor-esbuild-plugins.d.ts +107 -0
- package/hmr/shared/vendor/vendor-esbuild-plugins.js +540 -0
- package/hmr/shared/vendor/vendor-esbuild-plugins.js.map +1 -0
- package/package.json +70 -13
- package/runtime/core-aliases-early.js +11 -16
- package/runtime/core-aliases-early.js.map +1 -1
- package/shims/react-jsx-runtime.d.ts +4 -0
- package/shims/react-jsx-runtime.js +61 -0
- package/shims/react-jsx-runtime.js.map +1 -0
- package/helpers/angular/angular-linker.d.ts +0 -13
- package/helpers/angular/angular-linker.js +0 -185
- package/helpers/angular/angular-linker.js.map +0 -1
- package/helpers/angular/inject-component-hmr-registration.js.map +0 -1
- package/helpers/angular/inline-decorator-component-templates.js.map +0 -1
- package/helpers/angular/shared-linker.d.ts +0 -11
- package/helpers/angular/shared-linker.js +0 -75
- package/helpers/angular/shared-linker.js.map +0 -1
- package/helpers/angular/synthesize-decorator-ctor-parameters.js.map +0 -1
- package/helpers/angular/synthesize-injectable-factories.js.map +0 -1
- package/helpers/angular/util.js.map +0 -1
- package/helpers/module-runner-patch.d.ts +0 -3
- package/helpers/module-runner-patch.js +0 -63
- package/helpers/module-runner-patch.js.map +0 -1
- package/helpers/prelink-angular.d.ts +0 -2
- package/helpers/prelink-angular.js +0 -114
- package/helpers/prelink-angular.js.map +0 -1
- package/hmr/server/websocket-angular-entry.js.map +0 -1
- package/hmr/server/websocket-angular-hot-update.js.map +0 -1
- package/hmr/server/websocket-ns-m-finalize.d.ts +0 -22
- package/hmr/server/websocket-ns-m-finalize.js +0 -88
- package/hmr/server/websocket-ns-m-finalize.js.map +0 -1
- package/hmr/server/websocket-runtime-compat.d.ts +0 -19
- package/hmr/server/websocket-runtime-compat.js +0 -287
- package/hmr/server/websocket-runtime-compat.js.map +0 -1
- package/hmr/server/websocket-vue-sfc.d.ts +0 -27
- package/hmr/server/websocket-vue-sfc.js +0 -1069
- package/hmr/server/websocket-vue-sfc.js.map +0 -1
- package/hmr/shared/runtime/http-only-boot.d.ts +0 -2
- package/hmr/shared/runtime/http-only-boot.js +0 -171
- package/hmr/shared/runtime/http-only-boot.js.map +0 -1
- package/hmr/vendor-bootstrap.d.ts +0 -3
- package/hmr/vendor-bootstrap.js +0 -32
- package/hmr/vendor-bootstrap.js.map +0 -1
- package/shims/react-reconciler-constants.d.ts +0 -14
- package/shims/react-reconciler-constants.js +0 -21
- package/shims/react-reconciler-constants.js.map +0 -1
- package/shims/react-reconciler.d.ts +0 -8
- package/shims/react-reconciler.js +0 -15
- package/shims/react-reconciler.js.map +0 -1
- package/transformers/NativeClass/index.d.ts +0 -2
- package/transformers/NativeClass/index.js +0 -222
- package/transformers/NativeClass/index.js.map +0 -1
- /package/{helpers/angular → hmr/frameworks/angular/build}/inject-component-hmr-registration.d.ts +0 -0
- /package/{helpers/angular → hmr/frameworks/angular/build}/inline-decorator-component-templates.d.ts +0 -0
- /package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-decorator-ctor-parameters.d.ts +0 -0
- /package/{helpers/angular → hmr/frameworks/angular/build}/synthesize-injectable-factories.d.ts +0 -0
- /package/{helpers/angular → hmr/frameworks/angular/build}/util.d.ts +0 -0
- /package/{helpers/angular → hmr/frameworks/angular/build}/util.js +0 -0
- /package/hmr/{server → frameworks/angular/server}/websocket-angular-entry.d.ts +0 -0
package/configuration/angular.js
CHANGED
|
@@ -1,139 +1,72 @@
|
|
|
1
1
|
import { mergeConfig } from 'vite';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import fs from 'node:fs';
|
|
4
|
-
import { createRequire } from 'node:module';
|
|
5
4
|
import angular from '@analogjs/vite-plugin-angular';
|
|
6
|
-
import { angularLinkerVitePlugin, angularLinkerVitePluginPost } from '../
|
|
7
|
-
import { synthesizeMissingInjectableFactories } from '../
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
5
|
+
import { angularLinkerVitePlugin, angularLinkerVitePluginPost } from '../hmr/frameworks/angular/build/angular-linker.js';
|
|
6
|
+
import { synthesizeMissingInjectableFactories } from '../hmr/frameworks/angular/build/synthesize-injectable-factories.js';
|
|
7
|
+
import { getAngularLinkerFactory, runAngularLinker } from '../hmr/frameworks/angular/build/shared-linker.js';
|
|
8
|
+
import { recordLinkerHit, reportLinkerLayerStats } from '../hmr/frameworks/angular/build/linker-stats.js';
|
|
9
|
+
import { inlineDecoratorComponentTemplates } from '../hmr/frameworks/angular/build/inline-decorator-component-templates.js';
|
|
10
|
+
import { appendComponentHmrRegistration, findComponentClassNames, INJECTION_MARKER as HMR_REGISTER_MARKER } from '../hmr/frameworks/angular/build/inject-component-hmr-registration.js';
|
|
11
|
+
import { injectAngularHmrViteIgnore } from '../hmr/frameworks/angular/build/inject-hmr-vite-ignore.js';
|
|
12
|
+
import { synthesizeDecoratorCtorParameters } from '../hmr/frameworks/angular/build/synthesize-decorator-ctor-parameters.js';
|
|
13
|
+
import { containsRealNgDeclare, stripJsComments } from '../hmr/frameworks/angular/build/util.js';
|
|
13
14
|
import { baseConfig } from './base.js';
|
|
14
15
|
import { getCliFlags } from '../helpers/cli-flags.js';
|
|
16
|
+
import { getMonorepoWorkspaceRoot } from '../helpers/project.js';
|
|
15
17
|
import { resolveRelativeToImportMeta } from '../helpers/import-meta-path.js';
|
|
16
18
|
import { resolveVerboseFlag } from '../helpers/logging.js';
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
async function importLinkerFactory() {
|
|
21
|
-
if (_cachedLinkerFactory)
|
|
22
|
-
return _cachedLinkerFactory;
|
|
23
|
-
const req = createRequire(process.cwd() + '/package.json');
|
|
24
|
-
try {
|
|
25
|
-
const linkerPath = req.resolve('@angular/compiler-cli/linker/babel');
|
|
26
|
-
const linkerMod = await import(linkerPath);
|
|
27
|
-
_cachedLinkerFactory = linkerMod.createLinkerPlugin || linkerMod.createEs2015LinkerPlugin || null;
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
try {
|
|
31
|
-
const linkerMod = await import('@angular/compiler-cli/linker/babel');
|
|
32
|
-
_cachedLinkerFactory = linkerMod.createLinkerPlugin || linkerMod.createEs2015LinkerPlugin || null;
|
|
33
|
-
}
|
|
34
|
-
catch { }
|
|
35
|
-
}
|
|
36
|
-
return _cachedLinkerFactory;
|
|
19
|
+
import { NS_OPTIMIZE_DEPS_EXCLUDE } from '../helpers/optimize-deps.js';
|
|
20
|
+
function hasNgDeclarePartial(code) {
|
|
21
|
+
return code.indexOf('\u0275\u0275ngDeclare') !== -1 || code.indexOf('ɵɵngDeclare') !== -1 || code.indexOf('ngDeclare') !== -1;
|
|
37
22
|
}
|
|
38
23
|
// Rollup-level linker to guarantee Angular libraries are linked when included in the bundle graph.
|
|
39
24
|
function angularRollupLinker(projectRoot) {
|
|
40
|
-
let babel = null;
|
|
41
|
-
let createLinker = null;
|
|
42
|
-
let angularFileSystem = null;
|
|
43
25
|
const FILTER = /node_modules\/(?:@angular|@nativescript\/angular)\/.*\.[mc]?js$/;
|
|
44
|
-
|
|
45
|
-
if (babel && createLinker)
|
|
46
|
-
return;
|
|
47
|
-
try {
|
|
48
|
-
const req = createRequire((projectRoot ? projectRoot + '/package.json' : import.meta.url));
|
|
49
|
-
const babelPath = req.resolve('@babel/core');
|
|
50
|
-
const linkerPath = req.resolve('@angular/compiler-cli/linker/babel');
|
|
51
|
-
babel = await import(babelPath);
|
|
52
|
-
const linkerMod = await import(linkerPath);
|
|
53
|
-
createLinker = linkerMod.createLinkerPlugin || linkerMod.createEs2015LinkerPlugin;
|
|
54
|
-
}
|
|
55
|
-
catch {
|
|
56
|
-
try {
|
|
57
|
-
babel = await import('@babel/core');
|
|
58
|
-
}
|
|
59
|
-
catch { }
|
|
60
|
-
try {
|
|
61
|
-
const linkerMod = await import('@angular/compiler-cli/linker/babel');
|
|
62
|
-
createLinker = linkerMod.createLinkerPlugin || linkerMod.createEs2015LinkerPlugin;
|
|
63
|
-
}
|
|
64
|
-
catch { }
|
|
65
|
-
}
|
|
66
|
-
if (!angularFileSystem) {
|
|
67
|
-
angularFileSystem = await resolveAngularFileSystem(projectRoot);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
26
|
+
const debug = process.env.VITE_DEBUG_LOGS === 'true' || process.env.VITE_DEBUG_LOGS === '1';
|
|
70
27
|
return {
|
|
71
28
|
name: 'ns-angular-linker-rollup',
|
|
72
29
|
enforce: 'pre',
|
|
73
30
|
apply: 'build',
|
|
74
31
|
async load(id) {
|
|
75
|
-
const
|
|
76
|
-
const cleanId = id.split('?', 1)[0];
|
|
32
|
+
const cleanId = normalizeAngularWatchPath(id);
|
|
77
33
|
if (!FILTER.test(cleanId))
|
|
78
34
|
return null;
|
|
79
35
|
try {
|
|
80
|
-
await ensureDeps();
|
|
81
|
-
if (!babel || !createLinker)
|
|
82
|
-
return null;
|
|
83
36
|
const fs = await import('node:fs/promises');
|
|
84
37
|
const code = await fs.readFile(cleanId, 'utf8');
|
|
85
38
|
const forceLink = cleanId.includes('/node_modules/@nativescript/angular/') && cleanId.includes('polyfills');
|
|
86
39
|
if (!code)
|
|
87
40
|
return null;
|
|
88
|
-
if (!forceLink &&
|
|
41
|
+
if (!forceLink && !hasNgDeclarePartial(code))
|
|
89
42
|
return null;
|
|
90
|
-
const
|
|
91
|
-
if (
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
configFile: false,
|
|
97
|
-
babelrc: false,
|
|
98
|
-
sourceMaps: false,
|
|
99
|
-
compact: false,
|
|
100
|
-
plugins: [plugin],
|
|
101
|
-
});
|
|
102
|
-
if (result?.code && result.code !== code) {
|
|
103
|
-
return { code: result.code, map: null };
|
|
43
|
+
const linked = await runAngularLinker(code, { filename: cleanId, projectRoot, freshPlugin: true });
|
|
44
|
+
if (linked) {
|
|
45
|
+
recordLinkerHit('rollup-load');
|
|
46
|
+
if (debug)
|
|
47
|
+
console.log('[ns-angular-linker][rollup-load] linked', cleanId);
|
|
48
|
+
return { code: linked, map: null };
|
|
104
49
|
}
|
|
105
50
|
}
|
|
106
51
|
catch { }
|
|
107
52
|
return null;
|
|
108
53
|
},
|
|
109
54
|
async transform(code, id) {
|
|
110
|
-
const
|
|
111
|
-
const cleanId = id.split('?', 1)[0];
|
|
55
|
+
const cleanId = normalizeAngularWatchPath(id);
|
|
112
56
|
if (!FILTER.test(cleanId))
|
|
113
57
|
return null;
|
|
114
58
|
const forceLink = cleanId.includes('/node_modules/@nativescript/angular/') && cleanId.includes('polyfills');
|
|
115
59
|
if (!code)
|
|
116
60
|
return null;
|
|
117
|
-
if (!forceLink &&
|
|
118
|
-
return null;
|
|
119
|
-
await ensureDeps();
|
|
120
|
-
if (!babel || !createLinker)
|
|
61
|
+
if (!forceLink && !hasNgDeclarePartial(code))
|
|
121
62
|
return null;
|
|
122
63
|
try {
|
|
123
|
-
const
|
|
124
|
-
if (
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
configFile: false,
|
|
130
|
-
babelrc: false,
|
|
131
|
-
sourceMaps: false,
|
|
132
|
-
compact: false,
|
|
133
|
-
plugins: [plugin],
|
|
134
|
-
});
|
|
135
|
-
if (result?.code && result.code !== code) {
|
|
136
|
-
return { code: result.code, map: null };
|
|
64
|
+
const linked = await runAngularLinker(code, { filename: cleanId, projectRoot, freshPlugin: true });
|
|
65
|
+
if (linked) {
|
|
66
|
+
recordLinkerHit('rollup');
|
|
67
|
+
if (debug)
|
|
68
|
+
console.log('[ns-angular-linker][rollup] linked', cleanId);
|
|
69
|
+
return { code: linked, map: null };
|
|
137
70
|
}
|
|
138
71
|
}
|
|
139
72
|
catch { }
|
|
@@ -144,6 +77,24 @@ function angularRollupLinker(projectRoot) {
|
|
|
144
77
|
const cliFlags = getCliFlags();
|
|
145
78
|
const isDevEnv = process.env.NODE_ENV !== 'production';
|
|
146
79
|
const hmrActive = isDevEnv && !!cliFlags.hmr;
|
|
80
|
+
/**
|
|
81
|
+
* Web-style template HMR opt-out (`NS_VITE_ANGULAR_LIVE_RELOAD=0`).
|
|
82
|
+
*
|
|
83
|
+
* With HMR active we default to the in-place template-replacement pipeline
|
|
84
|
+
* (see the `liveReload` option below). If a project hits a regression
|
|
85
|
+
* (broken styling, unresolved `?ngcomp=` imports), this env flag rolls back
|
|
86
|
+
* to the legacy reboot pipeline without an upstream patch. `0`, `false`,
|
|
87
|
+
* `off`, and `no` (case-insensitive) mean "off"; anything else — including
|
|
88
|
+
* unset — keeps the new path on. Read once at module load, like `hmrActive`.
|
|
89
|
+
*/
|
|
90
|
+
const angularLiveReloadDisabledByEnv = (() => {
|
|
91
|
+
const raw = process.env.NS_VITE_ANGULAR_LIVE_RELOAD;
|
|
92
|
+
if (typeof raw !== 'string')
|
|
93
|
+
return false;
|
|
94
|
+
const v = raw.trim().toLowerCase();
|
|
95
|
+
return v === '0' || v === 'false' || v === 'off' || v === 'no';
|
|
96
|
+
})();
|
|
97
|
+
const hmrAngularLiveReload = hmrActive && !angularLiveReloadDisabledByEnv;
|
|
147
98
|
const projectRoot = process.cwd();
|
|
148
99
|
const tsConfigAppPath = path.resolve(projectRoot, 'tsconfig.app.json');
|
|
149
100
|
const tsConfigPath = path.resolve(projectRoot, 'tsconfig.json');
|
|
@@ -266,48 +217,31 @@ function createAngularPlugins(opts) {
|
|
|
266
217
|
return true;
|
|
267
218
|
};
|
|
268
219
|
return [
|
|
269
|
-
// HMR self-registration runs in two
|
|
270
|
-
//
|
|
271
|
-
// 1. (this plugin, `enforce: 'pre'`) Walk the raw TypeScript
|
|
272
|
-
// source for each user `.ts` file and record the names of
|
|
273
|
-
// any `@Component`-decorated classes into the shared
|
|
274
|
-
// `componentsByCleanId` map. Discovery has to happen on the
|
|
275
|
-
// raw source because the Analog Angular plugin rewrites
|
|
276
|
-
// `@Component(...)` into static metadata calls and removes
|
|
277
|
-
// the textual decorator pattern.
|
|
220
|
+
// HMR self-registration runs in two steps:
|
|
278
221
|
//
|
|
279
|
-
//
|
|
280
|
-
//
|
|
281
|
-
//
|
|
282
|
-
//
|
|
222
|
+
// 1. (this plugin, `enforce: 'pre'`) Record the names of
|
|
223
|
+
// `@Component`-decorated classes from the RAW TypeScript source
|
|
224
|
+
// into `componentsByCleanId` — discovery must happen pre-compile
|
|
225
|
+
// because the Analog plugin rewrites the textual decorator away.
|
|
226
|
+
// 2. (`ns-component-hmr-register-post`, `enforce: 'post'`) Append the
|
|
227
|
+
// `__NS_HMR_REGISTER_COMPONENT__` calls to the COMPILED output.
|
|
283
228
|
//
|
|
284
|
-
//
|
|
285
|
-
//
|
|
286
|
-
//
|
|
287
|
-
//
|
|
288
|
-
// previously appended the registration snippet here, in the pre
|
|
289
|
-
// plugin, and the snippet was silently dropped — leaving the
|
|
290
|
-
// HMR class registry empty and `getFreshComponentClass` returning
|
|
291
|
-
// `found=false reason=no-registry` after every reboot.
|
|
229
|
+
// The split is mandatory: Analog's `transform` returns its own compiled
|
|
230
|
+
// output (from its `outputFiles` cache), silently discarding any code
|
|
231
|
+
// modification made earlier in the pipeline — appending in the pre
|
|
232
|
+
// plugin leaves the HMR class registry empty.
|
|
292
233
|
//
|
|
293
|
-
//
|
|
294
|
-
//
|
|
295
|
-
//
|
|
296
|
-
//
|
|
297
|
-
//
|
|
298
|
-
// `typeof globalThis.__NS_HMR_REGISTER_COMPONENT__ === 'function'`,
|
|
299
|
-
// so it's a no-op when the runtime hook isn't installed
|
|
300
|
-
// (e.g. `--no-hmr` users still serving modules through
|
|
301
|
-
// Vite). Gating the transform itself on `hmrActive` produced
|
|
302
|
-
// a silent failure mode where `--no-hmr` users got HMR
|
|
303
|
-
// machinery up but never got the registration calls
|
|
304
|
-
// injected, leaving the registry empty.
|
|
234
|
+
// `apply: 'serve'` (registry hook is dev-only) but intentionally NOT
|
|
235
|
+
// gated on `hmrActive`: the injected snippet self-guards on
|
|
236
|
+
// `typeof globalThis.__NS_HMR_REGISTER_COMPONENT__ === 'function'`, and
|
|
237
|
+
// gating the transform itself left `--no-hmr` users with an empty
|
|
238
|
+
// registry.
|
|
305
239
|
{
|
|
306
240
|
name: 'ns-component-hmr-register',
|
|
307
241
|
enforce: 'pre',
|
|
308
242
|
apply: 'serve',
|
|
309
243
|
transform(code, id) {
|
|
310
|
-
const cleanId = id
|
|
244
|
+
const cleanId = normalizeAngularWatchPath(id);
|
|
311
245
|
if (!isCandidateComponentTs(cleanId))
|
|
312
246
|
return null;
|
|
313
247
|
const componentNames = findComponentClassNames(code);
|
|
@@ -320,7 +254,7 @@ function createAngularPlugins(opts) {
|
|
|
320
254
|
}
|
|
321
255
|
componentsByCleanId.set(cleanId, componentNames);
|
|
322
256
|
if (verbose) {
|
|
323
|
-
console.info(`[ns-hmr
|
|
257
|
+
console.info(`[ns-hmr][ns-component-hmr-register] discovered ${componentNames.length} component(s) in ${cleanId} (${componentNames.join(', ')})`);
|
|
324
258
|
}
|
|
325
259
|
// Discovery only — never modify the raw TS source. Any
|
|
326
260
|
// modification here is discarded by the Analog Angular
|
|
@@ -329,43 +263,31 @@ function createAngularPlugins(opts) {
|
|
|
329
263
|
return null;
|
|
330
264
|
},
|
|
331
265
|
},
|
|
332
|
-
//
|
|
333
|
-
//
|
|
334
|
-
// `enforce: 'post'` so we see the post-Angular code (where the
|
|
335
|
-
// pre plugin's work would otherwise be discarded). Reads the
|
|
336
|
-
// component names recorded by the pre plugin via
|
|
337
|
-
// `componentsByCleanId`.
|
|
266
|
+
// Step 2: append the HMR registration snippet to the compiled output
|
|
267
|
+
// (post-Analog), keyed by the names recorded in step 1.
|
|
338
268
|
{
|
|
339
269
|
name: 'ns-component-hmr-register-post',
|
|
340
270
|
enforce: 'post',
|
|
341
271
|
apply: 'serve',
|
|
342
272
|
transform(code, id) {
|
|
343
|
-
const cleanId = id
|
|
273
|
+
const cleanId = normalizeAngularWatchPath(id);
|
|
344
274
|
if (!isCandidateComponentTs(cleanId))
|
|
345
275
|
return null;
|
|
346
276
|
const componentNames = componentsByCleanId.get(cleanId);
|
|
347
277
|
if (!componentNames || componentNames.length === 0)
|
|
348
278
|
return null;
|
|
349
|
-
// Idempotency:
|
|
350
|
-
//
|
|
351
|
-
// inserted by `appendComponentHmrRegistration` and
|
|
352
|
-
// guards against double-injection. We also defensively
|
|
353
|
-
// short-circuit here so we don't have to allocate the
|
|
354
|
-
// suffix string on every cached re-run.
|
|
279
|
+
// Idempotency: Vite may replay transforms on cached modules; the
|
|
280
|
+
// marker guards against double-injection.
|
|
355
281
|
if (code.includes(HMR_REGISTER_MARKER))
|
|
356
282
|
return null;
|
|
357
283
|
const result = appendComponentHmrRegistration(code, componentNames);
|
|
358
284
|
if (!result.code)
|
|
359
285
|
return null;
|
|
360
286
|
if (verbose) {
|
|
361
|
-
console.info(`[ns-hmr
|
|
287
|
+
console.info(`[ns-hmr][ns-component-hmr-register-post] appended registrations for ${result.componentNames.length} component(s) in ${cleanId} (${result.componentNames.join(', ')})`);
|
|
362
288
|
}
|
|
363
|
-
//
|
|
364
|
-
//
|
|
365
|
-
// the upstream Angular source map; the appended snippet
|
|
366
|
-
// is invisible to debuggers but harmless. For
|
|
367
|
-
// production-grade source maps a MagicString-based
|
|
368
|
-
// pass-through could be used; not required for HMR.
|
|
289
|
+
// map: null is fine for dev — the appended snippet sits after the
|
|
290
|
+
// original body, so upstream line mappings stay valid.
|
|
369
291
|
return { code: result.code, map: null };
|
|
370
292
|
},
|
|
371
293
|
},
|
|
@@ -383,14 +305,10 @@ function createAngularPlugins(opts) {
|
|
|
383
305
|
for (const assetPath of assetPaths) {
|
|
384
306
|
this.addWatchFile(assetPath);
|
|
385
307
|
}
|
|
386
|
-
//
|
|
387
|
-
//
|
|
388
|
-
// the first fence the HTML→TS invalidation pipeline must
|
|
389
|
-
// pass — if we never see a [tracking] log for the
|
|
390
|
-
// component we're editing, the watcher will never fire
|
|
391
|
-
// and `pendingComponentInvalidations` stays empty.
|
|
308
|
+
// First fence of the HTML→TS invalidation pipeline: no [tracking]
|
|
309
|
+
// log for a component means the watcher can never fire for it.
|
|
392
310
|
if (verbose) {
|
|
393
|
-
console.info(`[ns-hmr
|
|
311
|
+
console.info(`[ns-hmr][angular-template-deps] [tracking] componentKey=${componentKey} assets=${assetPaths.length} (${assetPaths.slice(0, 4).join(', ')})`);
|
|
394
312
|
}
|
|
395
313
|
return null;
|
|
396
314
|
},
|
|
@@ -407,7 +325,7 @@ function createAngularPlugins(opts) {
|
|
|
407
325
|
pendingComponentInvalidations.add(componentPath);
|
|
408
326
|
}
|
|
409
327
|
if (verbose) {
|
|
410
|
-
console.info(`[ns-hmr
|
|
328
|
+
console.info(`[ns-hmr][angular-template-deps] watchChange [via assetToComponents] changed=${changedPath} → invalidating ${components.size} component(s):`, Array.from(components));
|
|
411
329
|
}
|
|
412
330
|
return;
|
|
413
331
|
}
|
|
@@ -418,11 +336,15 @@ function createAngularPlugins(opts) {
|
|
|
418
336
|
const componentKey = normalizeAngularWatchKey(componentPath);
|
|
419
337
|
pendingComponentInvalidations.add(componentKey);
|
|
420
338
|
if (verbose) {
|
|
421
|
-
console.info(`[ns-hmr
|
|
339
|
+
console.info(`[ns-hmr][angular-template-deps] watchChange [via fallback .html→.ts] changed=${changedPath} componentKey=${componentKey}`);
|
|
422
340
|
}
|
|
423
341
|
}
|
|
424
|
-
else
|
|
425
|
-
|
|
342
|
+
else {
|
|
343
|
+
// Truly anomalous: a watched template/style asset has no companion
|
|
344
|
+
// `.ts` file, so we cannot route the edit through the Angular
|
|
345
|
+
// HMR pipeline. Always-on warning so it surfaces in non-verbose
|
|
346
|
+
// runs — silent fallback would hide a real wiring break.
|
|
347
|
+
console.warn(`[ns-hmr][angular-template-deps] watchChange [no companion .ts found] changed=${changedPath} expectedTs=${componentPath}`);
|
|
426
348
|
}
|
|
427
349
|
}
|
|
428
350
|
},
|
|
@@ -432,7 +354,7 @@ function createAngularPlugins(opts) {
|
|
|
432
354
|
return null;
|
|
433
355
|
pendingComponentInvalidations.delete(componentPath);
|
|
434
356
|
if (verbose) {
|
|
435
|
-
console.info(`[ns-hmr
|
|
357
|
+
console.info(`[ns-hmr][angular-template-deps] shouldTransformCachedModule → re-transform componentKey=${componentPath}`);
|
|
436
358
|
}
|
|
437
359
|
return true;
|
|
438
360
|
},
|
|
@@ -440,17 +362,94 @@ function createAngularPlugins(opts) {
|
|
|
440
362
|
// Transform Angular partial declarations in node_modules to avoid runtime JIT
|
|
441
363
|
// Pass the project root so linker deps resolve from the app, not the plugin package.
|
|
442
364
|
angularLinkerVitePlugin(process.cwd()),
|
|
443
|
-
//
|
|
444
|
-
//
|
|
365
|
+
// A Rollup-phase linker safety net (angularRollupLinker) is additionally
|
|
366
|
+
// appended for HMR sessions — see `enableRollupLinker` below.
|
|
445
367
|
...angular({
|
|
446
368
|
experimental: {
|
|
447
369
|
useAngularCompilationAPI: opts.useAngularCompilationAPI,
|
|
448
370
|
},
|
|
449
|
-
liveReload
|
|
371
|
+
// `liveReload` enables Angular's web-style in-place template HMR:
|
|
372
|
+
// 1. `_enableHmr = true` on the TS compiler — each compiled component
|
|
373
|
+
// `.mjs` emits `<ClassName>_HmrLoad` plus an
|
|
374
|
+
// `import.meta.hot.on('angular:component-update', ...)` listener.
|
|
375
|
+
// 2. A `/@ng/component?c=<id>` middleware serving recompiled
|
|
376
|
+
// `_UpdateMetadata` sources on demand.
|
|
377
|
+
// 3. `angular:component-update` broadcasts on `.html`/style edits so
|
|
378
|
+
// the runtime calls `ɵɵreplaceMetadata` on the live class — views
|
|
379
|
+
// recreate in-place with NO reboot and NO route navigation (the
|
|
380
|
+
// reboot path via `__reboot_ng_modules__` remains for `.ts` edits).
|
|
381
|
+
//
|
|
382
|
+
// Load-bearing interactions:
|
|
383
|
+
// - Analog's middleware matches `req.url.includes('/@ng/component')`
|
|
384
|
+
// (substring), so the `/ns/m/`-prefixed device fetch still hits it.
|
|
385
|
+
// - The device client (`hmr/client/protocol-dispatch.ts`) forwards
|
|
386
|
+
// `{ type: 'custom', event, data }` to `import.meta.hot.on`
|
|
387
|
+
// listeners and short-circuits before the reboot path for
|
|
388
|
+
// `angular:component-update`.
|
|
389
|
+
// - `hmr/server/websocket.ts` skips its own `ns:angular-update`
|
|
390
|
+
// broadcast for `.html`/component-style edits to avoid double-fire.
|
|
391
|
+
// - Rollback to reboot-only: set `NS_VITE_ANGULAR_LIVE_RELOAD=0`.
|
|
392
|
+
liveReload: hmrAngularLiveReload,
|
|
393
|
+
// NativeScript can't consume `externalRuntimeStyles` (runtime-loaded
|
|
394
|
+
// `<hash>.css` URLs need a browser CSSOM/`<link>` pipeline), so keep
|
|
395
|
+
// component styles inlined in the metadata's `styles: [...]` array.
|
|
396
|
+
// Independent of `liveReload` — template HMR stays on. The option is
|
|
397
|
+
// honored by our patched Analog plugin (upstream PR pending) and is a
|
|
398
|
+
// no-op on stock releases; not yet in the published `PluginOptions`.
|
|
399
|
+
// @ts-expect-error -- pending upstream Analog type publish
|
|
400
|
+
externalRuntimeStyles: false,
|
|
450
401
|
tsconfig: tsConfig,
|
|
402
|
+
// Forward Angular-style file replacements (e.g. `environment.ts`
|
|
403
|
+
// → `environment.stg.ts`) directly into the Analog plugin so the
|
|
404
|
+
// Angular TypeScript host (which reads source files via its own
|
|
405
|
+
// CompilerHost, bypassing Vite's load chain) sees the swap. This
|
|
406
|
+
// is the same hook Angular CLI uses for `fileReplacements` in
|
|
407
|
+
// `angular.json` build configurations.
|
|
408
|
+
fileReplacements: opts.fileReplacements ?? [],
|
|
409
|
+
// Component-HMR id alignment. Angular's compiler embeds each
|
|
410
|
+
// component's HMR id relative to the TS compilation's base path —
|
|
411
|
+
// in an Nx monorepo that's the WORKSPACE root (tsconfig.base.json's
|
|
412
|
+
// baseUrl), not the app dir. Analog uses `workspaceRoot` both to
|
|
413
|
+
// build the `angular:component-update` broadcast id
|
|
414
|
+
// (`relative(workspaceRoot, file)`) and to resolve `/@ng/component?c=`
|
|
415
|
+
// fetches back to absolute paths (`resolve(workspaceRoot, id)`).
|
|
416
|
+
// Defaulting to `process.cwd()` (the app dir) makes the broadcast id
|
|
417
|
+
// `src/...` while every compiled listener guards on
|
|
418
|
+
// `apps/<app>/src/...` — `d.id === id` never matches, so template
|
|
419
|
+
// edits dispatch cleanly but visually apply nothing. Default to the
|
|
420
|
+
// monorepo root when one exists so all three id producers agree;
|
|
421
|
+
// standalone apps (no monorepo root) keep the cwd behavior.
|
|
422
|
+
workspaceRoot: opts.workspaceRoot ?? getMonorepoWorkspaceRoot(process.cwd()) ?? process.cwd(),
|
|
451
423
|
}),
|
|
452
424
|
// Post-phase linker to catch any declarations introduced after other transforms (including project code)
|
|
453
425
|
angularLinkerVitePluginPost(process.cwd()),
|
|
426
|
+
// Re-inject `/* @vite-ignore */` onto Angular's HMR initializer dynamic
|
|
427
|
+
// imports. Angular emits `import(/* @vite-ignore */ i0.ɵɵgetReplaceMetadataURL(...))`,
|
|
428
|
+
// but the annotation gets stripped in the post-Angular pipeline
|
|
429
|
+
// (empirically the linker's `compact: false` Babel pass) — Vite's static
|
|
430
|
+
// analyzer then rewrites the call through its runtime resolver, which
|
|
431
|
+
// throws `TypeError at ɵɵgetReplaceMetadataURL` on the iOS device.
|
|
432
|
+
// `enforce: 'post'` sees the file after every comment-stripping
|
|
433
|
+
// transform; `apply: 'serve'` because the initializer is `ngDevMode`-
|
|
434
|
+
// gated and never runs in production. Idempotent.
|
|
435
|
+
{
|
|
436
|
+
name: 'ns-angular-hmr-vite-ignore',
|
|
437
|
+
enforce: 'post',
|
|
438
|
+
apply: 'serve',
|
|
439
|
+
transform(code, id) {
|
|
440
|
+
if (!hmrAngularLiveReload)
|
|
441
|
+
return null;
|
|
442
|
+
const cleanId = normalizeAngularWatchPath(id);
|
|
443
|
+
if (!cleanId.endsWith('.ts') && !cleanId.endsWith('.mjs') && !cleanId.endsWith('.js'))
|
|
444
|
+
return null;
|
|
445
|
+
if (cleanId.includes('/node_modules/'))
|
|
446
|
+
return null;
|
|
447
|
+
const next = injectAngularHmrViteIgnore(code);
|
|
448
|
+
if (next === code)
|
|
449
|
+
return null;
|
|
450
|
+
return { code: next, map: null };
|
|
451
|
+
},
|
|
452
|
+
},
|
|
454
453
|
// Enforce: fully disable dependency optimization during serve to avoid rxjs esm5 crawling and OOM
|
|
455
454
|
{
|
|
456
455
|
name: 'ns-disable-optimize-deps',
|
|
@@ -460,7 +459,7 @@ function createAngularPlugins(opts) {
|
|
|
460
459
|
const od = userConfig?.optimizeDeps || {};
|
|
461
460
|
const prevExclude = Array.isArray(od.exclude) ? od.exclude : [];
|
|
462
461
|
const exclude = new Set(prevExclude);
|
|
463
|
-
[
|
|
462
|
+
[...NS_OPTIMIZE_DEPS_EXCLUDE, 'rxjs'].forEach((x) => exclude.add(x));
|
|
464
463
|
return {
|
|
465
464
|
optimizeDeps: {
|
|
466
465
|
noDiscovery: true,
|
|
@@ -481,7 +480,7 @@ function createAngularPlugins(opts) {
|
|
|
481
480
|
deps.entries = [];
|
|
482
481
|
deps.include = [];
|
|
483
482
|
const exclude = new Set(Array.isArray(deps.exclude) ? deps.exclude : []);
|
|
484
|
-
[
|
|
483
|
+
[...NS_OPTIMIZE_DEPS_EXCLUDE, 'rxjs'].forEach((x) => exclude.add(x));
|
|
485
484
|
deps.exclude = Array.from(exclude);
|
|
486
485
|
const rolldownOptions = (deps.rolldownOptions || (deps.rolldownOptions = {}));
|
|
487
486
|
rolldownOptions.plugins = [];
|
|
@@ -489,7 +488,7 @@ function createAngularPlugins(opts) {
|
|
|
489
488
|
},
|
|
490
489
|
];
|
|
491
490
|
}
|
|
492
|
-
export const angularConfig = ({ mode }) => {
|
|
491
|
+
export const angularConfig = ({ mode, fileReplacements, workspaceRoot, }) => {
|
|
493
492
|
const useSingleBundleDevOutput = mode === 'development' && !hmrActive;
|
|
494
493
|
const plugins = createAngularPlugins({
|
|
495
494
|
// Vite build --watch with the legacy Analog compilation path can regress
|
|
@@ -497,10 +496,11 @@ export const angularConfig = ({ mode }) => {
|
|
|
497
496
|
// Restrict the newer compilation API to NativeScript's development no-HMR
|
|
498
497
|
// flow, which is where the unstable rebuilds occur today.
|
|
499
498
|
useAngularCompilationAPI: useSingleBundleDevOutput,
|
|
499
|
+
fileReplacements,
|
|
500
|
+
workspaceRoot,
|
|
500
501
|
});
|
|
502
|
+
// Angular browser animations are never used in NativeScript; the stub alias below is unconditional.
|
|
501
503
|
const disableAnimations = true;
|
|
502
|
-
//process.env.NS_DISABLE_NG_ANIMATIONS === "1" ||
|
|
503
|
-
//process.env.NS_DISABLE_NG_ANIMATIONS === "true";
|
|
504
504
|
// Post-link emitted chunks to catch any remaining partial declarations that slipped through
|
|
505
505
|
// due to plugin order or external transforms.
|
|
506
506
|
const applyAngularChunkPostProcessing = (code, options = {}) => {
|
|
@@ -517,17 +517,16 @@ export const angularConfig = ({ mode }) => {
|
|
|
517
517
|
apply: 'build',
|
|
518
518
|
enforce: 'post',
|
|
519
519
|
async generateBundle(_options, bundle) {
|
|
520
|
+
function isNsAngularPolyfillsModule(id) {
|
|
521
|
+
return normalizeAngularWatchPath(id).includes('node_modules/@nativescript/angular/fesm2022/nativescript-angular-polyfills.mjs');
|
|
522
|
+
}
|
|
520
523
|
function isNsAngularPolyfillsChunk(chunk) {
|
|
521
524
|
if (!chunk || !chunk.modules)
|
|
522
525
|
return false;
|
|
523
|
-
return Object.keys(chunk.modules).some(
|
|
526
|
+
return Object.keys(chunk.modules).some(isNsAngularPolyfillsModule);
|
|
524
527
|
}
|
|
525
|
-
const { babel } = await
|
|
526
|
-
if (!babel)
|
|
527
|
-
return;
|
|
528
|
-
const fileSystem = await resolveAngularFileSystem(process.cwd());
|
|
529
|
-
const linkerFactory = await importLinkerFactory();
|
|
530
|
-
if (!linkerFactory)
|
|
528
|
+
const { babel, createLinker } = await getAngularLinkerFactory(process.cwd());
|
|
529
|
+
if (!babel || !createLinker)
|
|
531
530
|
return;
|
|
532
531
|
const strict = process.env.NS_STRICT_NG_LINK === '1' || process.env.NS_STRICT_NG_LINK === 'true';
|
|
533
532
|
const enforceStrict = process.env.NS_STRICT_NG_LINK_ENFORCE === '1' || process.env.NS_STRICT_NG_LINK_ENFORCE === 'true';
|
|
@@ -547,21 +546,12 @@ export const angularConfig = ({ mode }) => {
|
|
|
547
546
|
continue;
|
|
548
547
|
const isNsPolyfills = isNsAngularPolyfillsChunk(chunk);
|
|
549
548
|
try {
|
|
550
|
-
//
|
|
551
|
-
|
|
552
|
-
const
|
|
553
|
-
const res = await babel.transformAsync(code, {
|
|
554
|
-
filename: fileName,
|
|
555
|
-
configFile: false,
|
|
556
|
-
babelrc: false,
|
|
557
|
-
sourceMaps: false,
|
|
558
|
-
compact: false,
|
|
559
|
-
plugins: [freshPlugin],
|
|
560
|
-
});
|
|
561
|
-
const linkedCode = res?.code && res.code !== code ? res.code : code;
|
|
562
|
-
const finalCode = applyAngularChunkPostProcessing(linkedCode, { vendorInjectExport });
|
|
549
|
+
// Fresh plugin per chunk — avoids stale linker state across watch-mode rebuilds.
|
|
550
|
+
const linked = await runAngularLinker(code, { filename: fileName, projectRoot: process.cwd(), freshPlugin: true });
|
|
551
|
+
const finalCode = applyAngularChunkPostProcessing(linked ?? code, { vendorInjectExport });
|
|
563
552
|
if (finalCode !== code) {
|
|
564
553
|
chunk.code = finalCode;
|
|
554
|
+
recordLinkerHit('post');
|
|
565
555
|
if (debug) {
|
|
566
556
|
console.log('[ns-angular-linker][post] linked', fileName, isNsPolyfills ? '(polyfills)' : '');
|
|
567
557
|
}
|
|
@@ -577,16 +567,20 @@ export const angularConfig = ({ mode }) => {
|
|
|
577
567
|
}
|
|
578
568
|
}
|
|
579
569
|
}
|
|
570
|
+
// Evidence for pruning the stacked linker layers: print which of the
|
|
571
|
+
// five layers actually linked anything this build. A layer that
|
|
572
|
+
// reports 0 across the full flavor matrix is a candidate for removal.
|
|
573
|
+
reportLinkerLayerStats();
|
|
580
574
|
if (strict && unlinked.length) {
|
|
581
575
|
const details = [];
|
|
582
576
|
for (const fname of unlinked) {
|
|
583
577
|
const chunk = bundle[fname];
|
|
584
578
|
const modIds = chunk?.modules
|
|
585
579
|
? Object.keys(chunk.modules)
|
|
586
|
-
.filter((m) => /node_modules\/(?:@angular|@nativescript\/angular)\//.test(m))
|
|
580
|
+
.filter((m) => /node_modules\/(?:@angular|@nativescript\/angular)\//.test(normalizeAngularWatchPath(m)))
|
|
587
581
|
.slice(0, 8)
|
|
588
582
|
: [];
|
|
589
|
-
const isOnlyPolyfills = modIds.length > 0 && modIds.every(
|
|
583
|
+
const isOnlyPolyfills = modIds.length > 0 && modIds.every(isNsAngularPolyfillsModule);
|
|
590
584
|
if (isOnlyPolyfills)
|
|
591
585
|
continue;
|
|
592
586
|
let snippet = '';
|
|
@@ -629,32 +623,18 @@ export const angularConfig = ({ mode }) => {
|
|
|
629
623
|
try {
|
|
630
624
|
let transformed = code;
|
|
631
625
|
if (containsRealNgDeclare(code)) {
|
|
632
|
-
const { babel } = await
|
|
633
|
-
if (!babel)
|
|
634
|
-
return null;
|
|
635
|
-
const fileSystem = await resolveAngularFileSystem(process.cwd());
|
|
636
|
-
// Fresh plugin per chunk — avoids stale linker state across watch-mode rebuilds
|
|
637
|
-
const freshPlugin = (await importLinkerFactory())?.({ sourceMapping: false, fileSystem });
|
|
638
|
-
if (!freshPlugin)
|
|
626
|
+
const { babel, createLinker } = await getAngularLinkerFactory(process.cwd());
|
|
627
|
+
if (!babel || !createLinker)
|
|
639
628
|
return null;
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
filename,
|
|
643
|
-
configFile: false,
|
|
644
|
-
babelrc: false,
|
|
645
|
-
sourceMaps: false,
|
|
646
|
-
compact: false,
|
|
647
|
-
plugins: [freshPlugin],
|
|
648
|
-
});
|
|
649
|
-
return result?.code ?? input;
|
|
650
|
-
};
|
|
651
|
-
transformed = await runLink(code);
|
|
629
|
+
// Fresh plugin per pass — avoids stale linker state across watch-mode rebuilds.
|
|
630
|
+
transformed = (await runAngularLinker(code, { filename, projectRoot: process.cwd(), freshPlugin: true })) ?? code;
|
|
652
631
|
if (containsRealNgDeclare(transformed)) {
|
|
653
|
-
transformed = await
|
|
632
|
+
transformed = (await runAngularLinker(transformed, { filename, projectRoot: process.cwd(), freshPlugin: true })) ?? transformed;
|
|
654
633
|
}
|
|
655
634
|
}
|
|
656
635
|
transformed = applyAngularChunkPostProcessing(transformed);
|
|
657
636
|
if (transformed !== code) {
|
|
637
|
+
recordLinkerHit('render');
|
|
658
638
|
if (debug) {
|
|
659
639
|
console.log('[ns-angular-linker][render] linked', filename);
|
|
660
640
|
}
|
|
@@ -668,9 +648,8 @@ export const angularConfig = ({ mode }) => {
|
|
|
668
648
|
},
|
|
669
649
|
};
|
|
670
650
|
const enableRollupLinker = process.env.NS_ENABLE_ROLLUP_LINKER === '1' || process.env.NS_ENABLE_ROLLUP_LINKER === 'true' || hmrActive;
|
|
671
|
-
//
|
|
672
|
-
//
|
|
673
|
-
// that silently clobbered the fesm2022 and RxJS aliases.
|
|
651
|
+
// Single merged alias array — a second `resolve` key from a conditional
|
|
652
|
+
// spread would silently clobber the fesm2022 and RxJS aliases.
|
|
674
653
|
const angularAliases = [
|
|
675
654
|
// Map Angular deep ESM paths to bare package ids
|
|
676
655
|
{ find: /^@angular\/([^/]+)\/fesm2022\/.*\.mjs$/, replacement: '@angular/$1' },
|