@nativescript/vite 8.0.0-alpha.7 → 8.0.0-alpha.8
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/configuration/angular.js +155 -22
- package/configuration/angular.js.map +1 -1
- package/configuration/base.js +1 -4
- package/configuration/base.js.map +1 -1
- package/configuration/typescript.js +1 -1
- package/configuration/typescript.js.map +1 -1
- package/helpers/angular/angular-linker.js +3 -12
- package/helpers/angular/angular-linker.js.map +1 -1
- package/helpers/angular/inject-component-hmr-registration.d.ts +112 -0
- package/helpers/angular/inject-component-hmr-registration.js +359 -0
- package/helpers/angular/inject-component-hmr-registration.js.map +1 -0
- package/helpers/main-entry.js +1 -1
- package/helpers/main-entry.js.map +1 -1
- package/helpers/prelink-angular.js +1 -4
- package/helpers/prelink-angular.js.map +1 -1
- package/hmr/entry-runtime.js +11 -29
- package/hmr/entry-runtime.js.map +1 -1
- package/hmr/frameworks/angular/client/index.js +40 -50
- package/hmr/frameworks/angular/client/index.js.map +1 -1
- package/hmr/frameworks/angular/server/linker.js +1 -4
- package/hmr/frameworks/angular/server/linker.js.map +1 -1
- package/hmr/frameworks/vue/client/index.js +18 -42
- package/hmr/frameworks/vue/client/index.js.map +1 -1
- package/hmr/server/ns-core-cjs-shape.js +1 -1
- package/hmr/server/ns-core-cjs-shape.js.map +1 -1
- package/hmr/server/websocket-angular-hot-update.d.ts +1 -0
- package/hmr/server/websocket-angular-hot-update.js +15 -1
- package/hmr/server/websocket-angular-hot-update.js.map +1 -1
- package/hmr/server/websocket-core-bridge.js +1 -1
- package/hmr/server/websocket-core-bridge.js.map +1 -1
- package/hmr/server/websocket-module-bindings.js +2 -2
- package/hmr/server/websocket-module-bindings.js.map +1 -1
- package/hmr/server/websocket-runtime-compat.js +1 -1
- package/hmr/server/websocket-runtime-compat.js.map +1 -1
- package/hmr/server/websocket-vue-sfc.js +15 -60
- package/hmr/server/websocket-vue-sfc.js.map +1 -1
- package/hmr/server/websocket.js +73 -144
- package/hmr/server/websocket.js.map +1 -1
- package/hmr/shared/runtime/dev-overlay.js +5 -17
- package/hmr/shared/runtime/dev-overlay.js.map +1 -1
- package/hmr/shared/runtime/module-provenance.js +1 -4
- package/hmr/shared/runtime/module-provenance.js.map +1 -1
- package/hmr/shared/runtime/root-placeholder.js +38 -68
- package/hmr/shared/runtime/root-placeholder.js.map +1 -1
- package/hmr/shared/runtime/session-bootstrap.js +1 -4
- package/hmr/shared/runtime/session-bootstrap.js.map +1 -1
- package/hmr/shared/runtime/vendor-bootstrap.js +1 -9
- package/hmr/shared/runtime/vendor-bootstrap.js.map +1 -1
- package/hmr/shared/vendor/manifest.js +4 -16
- package/hmr/shared/vendor/manifest.js.map +1 -1
- package/package.json +1 -1
- package/runtime/core-aliases-early.js +17 -41
- package/runtime/core-aliases-early.js.map +1 -1
package/hmr/server/websocket.js
CHANGED
|
@@ -387,10 +387,7 @@ async function expandStarExports(code, server, projectRoot, verbose, sharedTrans
|
|
|
387
387
|
if (!names.length)
|
|
388
388
|
return null;
|
|
389
389
|
if (verbose) {
|
|
390
|
-
|
|
391
|
-
console.log(`[ns/m] expanded export* -> ${names.length} names from ${vitePath}`);
|
|
392
|
-
}
|
|
393
|
-
catch { }
|
|
390
|
+
console.log(`[ns/m] expanded export* -> ${names.length} names from ${vitePath}`);
|
|
394
391
|
}
|
|
395
392
|
return { rep, names };
|
|
396
393
|
}
|
|
@@ -453,7 +450,7 @@ function stripViteDynamicImportVirtual(code) {
|
|
|
453
450
|
}
|
|
454
451
|
return code;
|
|
455
452
|
}
|
|
456
|
-
const REQUIRE_GUARD_SNIPPET = `// [guard] install require('http(s)://') detector\n(()=>{try{var g=globalThis;if(g.__NS_REQUIRE_GUARD_INSTALLED__){}else{var mk=function(o,l){return function(){try{var s=arguments[0];if(typeof s==='string'&&/^(?:https?:)\\/\\//.test(s)){var e=new Error('[ns-hmr][require-guard] require of URL: '+s+' via '+l);
|
|
453
|
+
const REQUIRE_GUARD_SNIPPET = `// [guard] install require('http(s)://') detector\n(()=>{try{var g=globalThis;if(g.__NS_REQUIRE_GUARD_INSTALLED__){}else{var mk=function(o,l){return function(){try{var s=arguments[0];if(typeof s==='string'&&/^(?:https?:)\\/\\//.test(s)){var e=new Error('[ns-hmr][require-guard] require of URL: '+s+' via '+l);console.error(e.message+'\\n'+(e.stack||''));try{g.__NS_REQUIRE_GUARD_LAST__={spec:s,stack:e.stack,label:l,ts:Date.now()};}catch(e3){}}}catch(e1){}return o.apply(this, arguments);};};if(typeof g.require==='function'&&!g.require.__NS_REQ_GUARDED__){var o1=g.require;g.require=mk(o1,'require');g.require.__NS_REQ_GUARDED__=true;}if(typeof g.__nsRequire==='function'&&!g.__nsRequire.__NS_REQ_GUARDED__){var o2=g.__nsRequire;g.__nsRequire=mk(o2,'__nsRequire');g.__nsRequire.__NS_REQ_GUARDED__=true;}g.__NS_REQUIRE_GUARD_INSTALLED__=true;}}catch(e){}})();\n`;
|
|
457
454
|
function shouldRemapImport(spec) {
|
|
458
455
|
if (!spec || typeof spec !== 'string')
|
|
459
456
|
return false;
|
|
@@ -1962,10 +1959,7 @@ export function rewriteImports(code, importerPath, sfcFileMap, depFileMap, proje
|
|
|
1962
1959
|
if (spec === '@') {
|
|
1963
1960
|
const stub = `/ns/m/__invalid_at__.mjs`;
|
|
1964
1961
|
if (verbose) {
|
|
1965
|
-
|
|
1966
|
-
console.warn(`[rewrite] mapped bare '@' spec to stub: ${stub}`);
|
|
1967
|
-
}
|
|
1968
|
-
catch { }
|
|
1962
|
+
console.warn(`[rewrite] mapped bare '@' spec to stub: ${stub}`);
|
|
1969
1963
|
}
|
|
1970
1964
|
return `${prefix}${stub}${suffix}`;
|
|
1971
1965
|
}
|
|
@@ -2186,10 +2180,7 @@ export function rewriteImports(code, importerPath, sfcFileMap, depFileMap, proje
|
|
|
2186
2180
|
result = result.replace(/(import\(\s*['"])@(['"]\s*\))/g, (_m) => {
|
|
2187
2181
|
const stubExpr = `import(new URL('/ns/m/__invalid_at__.mjs', import.meta.url).href)`;
|
|
2188
2182
|
if (verbose) {
|
|
2189
|
-
|
|
2190
|
-
console.warn(`[rewrite] mapped dynamic import('@') to /ns/m/__invalid_at__.mjs via import.meta.url`);
|
|
2191
|
-
}
|
|
2192
|
-
catch { }
|
|
2183
|
+
console.warn(`[rewrite] mapped dynamic import('@') to /ns/m/__invalid_at__.mjs via import.meta.url`);
|
|
2193
2184
|
}
|
|
2194
2185
|
return stubExpr;
|
|
2195
2186
|
});
|
|
@@ -2198,10 +2189,7 @@ export function rewriteImports(code, importerPath, sfcFileMap, depFileMap, proje
|
|
|
2198
2189
|
result = result.replace(/(from\s*['"])@(['"])/g, (_m, p1, p2) => {
|
|
2199
2190
|
const stub = `/ns/m/__invalid_at__.mjs`;
|
|
2200
2191
|
if (verbose) {
|
|
2201
|
-
|
|
2202
|
-
console.warn(`[rewrite] mapped static from '@' to ${stub}`);
|
|
2203
|
-
}
|
|
2204
|
-
catch { }
|
|
2192
|
+
console.warn(`[rewrite] mapped static from '@' to ${stub}`);
|
|
2205
2193
|
}
|
|
2206
2194
|
return `${p1}${stub}${p2}`;
|
|
2207
2195
|
});
|
|
@@ -2209,10 +2197,7 @@ export function rewriteImports(code, importerPath, sfcFileMap, depFileMap, proje
|
|
|
2209
2197
|
result = result.replace(/(import\s*(?!\()\s*['"])@(['"])/g, (_m, p1, p2) => {
|
|
2210
2198
|
const stub = `/ns/m/__invalid_at__.mjs`;
|
|
2211
2199
|
if (verbose) {
|
|
2212
|
-
|
|
2213
|
-
console.warn(`[rewrite] mapped side-effect import '@' to ${stub}`);
|
|
2214
|
-
}
|
|
2215
|
-
catch { }
|
|
2200
|
+
console.warn(`[rewrite] mapped side-effect import '@' to ${stub}`);
|
|
2216
2201
|
}
|
|
2217
2202
|
return `${p1}${stub}${p2}`;
|
|
2218
2203
|
});
|
|
@@ -2504,11 +2489,8 @@ function createHmrWebSocketPlugin(opts) {
|
|
|
2504
2489
|
const gm = { id, deps: normDeps, hash };
|
|
2505
2490
|
graph.set(id, gm);
|
|
2506
2491
|
if (verbose) {
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
console.log('[hmr-ws][graph] size', graph.size);
|
|
2510
|
-
}
|
|
2511
|
-
catch { }
|
|
2492
|
+
console.log('[hmr-ws][graph] upsert', { id, deps: normDeps, hash, graphVersion, classification, bumpVersion });
|
|
2493
|
+
console.log('[hmr-ws][graph] size', graph.size);
|
|
2512
2494
|
}
|
|
2513
2495
|
if (shouldBroadcastGraphUpsertDelta(classification, options?.emitDeltaOnInsert === true, options?.broadcastDelta !== false)) {
|
|
2514
2496
|
emitDelta([gm], []);
|
|
@@ -2609,15 +2591,12 @@ function createHmrWebSocketPlugin(opts) {
|
|
|
2609
2591
|
// `bumpedVersion=no` result is the happy path, `yes`
|
|
2610
2592
|
// indicates a regression.
|
|
2611
2593
|
if (verbose) {
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
}));
|
|
2619
|
-
}
|
|
2620
|
-
catch { }
|
|
2594
|
+
console.info(formatPopulateInitialGraphSummary({
|
|
2595
|
+
moduleCount: graph.size,
|
|
2596
|
+
durationMs: Date.now() - tStart,
|
|
2597
|
+
graphVersion,
|
|
2598
|
+
bumpedVersion: graphVersion !== versionAtStart,
|
|
2599
|
+
}));
|
|
2621
2600
|
}
|
|
2622
2601
|
}
|
|
2623
2602
|
// Kick off `populateInitialGraph` in the background (non-awaited) so /ns/m
|
|
@@ -2682,10 +2661,7 @@ function createHmrWebSocketPlugin(opts) {
|
|
|
2682
2661
|
const configuredTransformCacheMs = Number.parseInt(process.env.NS_VITE_HMR_TRANSFORM_CACHE_MS || '', 10);
|
|
2683
2662
|
const transformCacheMs = Number.isFinite(configuredTransformCacheMs) && configuredTransformCacheMs >= 0 ? configuredTransformCacheMs : 60000;
|
|
2684
2663
|
sharedTransformRequest = createSharedTransformRequestRunner((url) => server.transformRequest(url), (url, timeoutMs) => {
|
|
2685
|
-
|
|
2686
|
-
console.warn('[ns:m] slow transformRequest for', url, '(>' + timeoutMs + 'ms)');
|
|
2687
|
-
}
|
|
2688
|
-
catch { }
|
|
2664
|
+
console.warn('[ns:m] slow transformRequest for', url, '(>' + timeoutMs + 'ms)');
|
|
2689
2665
|
}, {
|
|
2690
2666
|
maxConcurrent: transformConcurrency,
|
|
2691
2667
|
resultCacheTtlMs: transformCacheMs,
|
|
@@ -2752,10 +2728,7 @@ function createHmrWebSocketPlugin(opts) {
|
|
|
2752
2728
|
log: (line) => {
|
|
2753
2729
|
if (!verbose)
|
|
2754
2730
|
return;
|
|
2755
|
-
|
|
2756
|
-
console.info(line);
|
|
2757
|
-
}
|
|
2758
|
-
catch { }
|
|
2731
|
+
console.info(line);
|
|
2759
2732
|
},
|
|
2760
2733
|
});
|
|
2761
2734
|
}
|
|
@@ -2874,10 +2847,7 @@ function createHmrWebSocketPlugin(opts) {
|
|
|
2874
2847
|
});
|
|
2875
2848
|
});
|
|
2876
2849
|
wss.on('error', (err) => {
|
|
2877
|
-
|
|
2878
|
-
console.warn('[hmr-ws] server error:', err?.message || String(err));
|
|
2879
|
-
}
|
|
2880
|
-
catch { }
|
|
2850
|
+
console.warn('[hmr-ws] server error:', err?.message || String(err));
|
|
2881
2851
|
});
|
|
2882
2852
|
// Import map endpoint: GET /ns/import-map.json
|
|
2883
2853
|
// Returns the import map + runtime config for __nsConfigureRuntime()
|
|
@@ -3386,10 +3356,7 @@ function createHmrWebSocketPlugin(opts) {
|
|
|
3386
3356
|
if (isApp && /\.(ts|tsx|js|jsx|mjs|mts|cts)$/i.test(id) && !isRuntimeGraphExcludedPath(id)) {
|
|
3387
3357
|
const deps = Array.from(collectImportDependencies(code, id));
|
|
3388
3358
|
if (verbose) {
|
|
3389
|
-
|
|
3390
|
-
console.log('[hmr-ws][ts-graph] candidate', { id, depsCount: deps.length });
|
|
3391
|
-
}
|
|
3392
|
-
catch { }
|
|
3359
|
+
console.log('[hmr-ws][ts-graph] candidate', { id, depsCount: deps.length });
|
|
3393
3360
|
}
|
|
3394
3361
|
// Serve-time warm-up: no live edit happened, so don't bump
|
|
3395
3362
|
// graphVersion.
|
|
@@ -3808,10 +3775,7 @@ export const piniaSymbol = p.piniaSymbol;
|
|
|
3808
3775
|
const hasCjsPattern = /\bmodule\s*\.\s*exports\b/.test(targetCode) || /\bexports\s*\.\s*\w/.test(targetCode);
|
|
3809
3776
|
if (hasCjsPattern) {
|
|
3810
3777
|
if (verbose) {
|
|
3811
|
-
|
|
3812
|
-
console.warn(`[ns:m][link-check] CJS module without export default: ${u.pathname} (will be CJS-wrapped at serve time)`);
|
|
3813
|
-
}
|
|
3814
|
-
catch { }
|
|
3778
|
+
console.warn(`[ns:m][link-check] CJS module without export default: ${u.pathname} (will be CJS-wrapped at serve time)`);
|
|
3815
3779
|
}
|
|
3816
3780
|
continue;
|
|
3817
3781
|
}
|
|
@@ -3827,20 +3791,14 @@ export const piniaSymbol = p.piniaSymbol;
|
|
|
3827
3791
|
}
|
|
3828
3792
|
catch (eLC) {
|
|
3829
3793
|
if (verbose) {
|
|
3830
|
-
|
|
3831
|
-
console.warn('[ns:m][link-check] failed', eLC?.message || eLC);
|
|
3832
|
-
}
|
|
3833
|
-
catch { }
|
|
3794
|
+
console.warn('[ns:m][link-check] failed', eLC?.message || eLC);
|
|
3834
3795
|
}
|
|
3835
3796
|
}
|
|
3836
3797
|
res.statusCode = 200;
|
|
3837
3798
|
res.end(code);
|
|
3838
3799
|
}
|
|
3839
3800
|
catch (e) {
|
|
3840
|
-
|
|
3841
|
-
console.warn('[sfc-asm] error serving', req.url, e && e.message ? e.message : e);
|
|
3842
|
-
}
|
|
3843
|
-
catch { }
|
|
3801
|
+
console.warn('[sfc-asm] error serving', req.url, e && e.message ? e.message : e);
|
|
3844
3802
|
res.statusCode = 500;
|
|
3845
3803
|
res.end('export {}\n');
|
|
3846
3804
|
}
|
|
@@ -3968,7 +3926,7 @@ export const piniaSymbol = p.piniaSymbol;
|
|
|
3968
3926
|
`export const vShow = (__ensure().vShow);\n` +
|
|
3969
3927
|
`export const createApp = (...a) => (__ensure().createApp)(...a);\n` +
|
|
3970
3928
|
`export const registerElement = (...a) => (__ensure().registerElement)(...a);\n` +
|
|
3971
|
-
`export const $navigateTo = (...a) => { const vm = (__cached_vm || (void __ensure(), __cached_vm)); const rt = __ensure(); try { if (!(g && g.Frame)) { const ns = (__ns_core_bridge && (__ns_core_bridge.__esModule && __ns_core_bridge.default ? __ns_core_bridge.default : (__ns_core_bridge.default || __ns_core_bridge))) || __ns_core_bridge || {}; if (ns) { if (!g.Frame && ns.Frame) g.Frame = ns.Frame; if (!g.Page && ns.Page) g.Page = ns.Page; if (!g.Application && (ns.Application||ns.app||ns.application)) g.Application = (ns.Application||ns.app||ns.application); } } } catch {} try { const hmrRealm = (g && g.__NS_HMR_REALM__) || 'unknown'; const hasTop = !!(g && g.Frame && g.Frame.topmost && g.Frame.topmost()); const top = hasTop ? g.Frame.topmost() : null; const ctor = top && top.constructor && top.constructor.name; } catch {} if (g && typeof g.__nsNavigateUsingApp === 'function') { try { return g.__nsNavigateUsingApp(...a); } catch (e) {
|
|
3929
|
+
`export const $navigateTo = (...a) => { const vm = (__cached_vm || (void __ensure(), __cached_vm)); const rt = __ensure(); try { if (!(g && g.Frame)) { const ns = (__ns_core_bridge && (__ns_core_bridge.__esModule && __ns_core_bridge.default ? __ns_core_bridge.default : (__ns_core_bridge.default || __ns_core_bridge))) || __ns_core_bridge || {}; if (ns) { if (!g.Frame && ns.Frame) g.Frame = ns.Frame; if (!g.Page && ns.Page) g.Page = ns.Page; if (!g.Application && (ns.Application||ns.app||ns.application)) g.Application = (ns.Application||ns.app||ns.application); } } } catch {} try { const hmrRealm = (g && g.__NS_HMR_REALM__) || 'unknown'; const hasTop = !!(g && g.Frame && g.Frame.topmost && g.Frame.topmost()); const top = hasTop ? g.Frame.topmost() : null; const ctor = top && top.constructor && top.constructor.name; } catch {} if (g && typeof g.__nsNavigateUsingApp === 'function') { try { return g.__nsNavigateUsingApp(...a); } catch (e) { console.error('[ns-rt] $navigateTo app navigator error', e); throw e; } } console.error('[ns-rt] $navigateTo unavailable: app navigator missing'); throw new Error('$navigateTo unavailable: app navigator missing'); } ;\n` +
|
|
3972
3930
|
`export const $navigateBack = (...a) => { const vm = (__cached_vm || (void __ensure(), __cached_vm)); const rt = __ensure(); const impl = (vm && (vm.$navigateBack || (vm.default && vm.default.$navigateBack))) || (rt && (rt.$navigateBack || (rt.runtimeHelpers && rt.runtimeHelpers.navigateBack))); let res; try { const via = (impl && (impl === (vm && vm.$navigateBack) || impl === (vm && vm.default && vm.default.$navigateBack))) ? 'vm' : (impl ? 'rt' : 'none'); } catch {} try { if (typeof impl === 'function') res = impl(...a); } catch {} try { const top = (g && g.Frame && g.Frame.topmost && g.Frame.topmost()); if (!res && top && top.canGoBack && top.canGoBack()) { res = top.goBack(); } } catch {} try { const hook = g && (g.__NS_HMR_ON_NAVIGATE_BACK || g.__NS_HMR_ON_BACK || g.__nsAttemptBackRemount); if (typeof hook === 'function') hook(); } catch {} return res; }\n` +
|
|
3973
3931
|
`export const $showModal = (...a) => { const vm = (__cached_vm || (void __ensure(), __cached_vm)); const rt = __ensure(); const impl = (vm && (vm.$showModal || (vm.default && vm.default.$showModal))) || (rt && (rt.$showModal || (rt.runtimeHelpers && rt.runtimeHelpers.showModal))); try { if (typeof impl === 'function') return impl(...a); } catch (e) { } return undefined; }\n` +
|
|
3974
3932
|
`export default {\n` +
|
|
@@ -4212,7 +4170,7 @@ export const piniaSymbol = p.piniaSymbol;
|
|
|
4212
4170
|
` }`,
|
|
4213
4171
|
` if (!__nsFirst[__nsKey]) __nsFirst[__nsKey] = __nsUrl;`,
|
|
4214
4172
|
` globalThis.__NS_CORE_EVAL_COUNT__ = (globalThis.__NS_CORE_EVAL_COUNT__ || 0) + 1;`,
|
|
4215
|
-
`} } catch (e) {
|
|
4173
|
+
`} } catch (e) { console.warn('[ns-core] instrumentation failed:', (e && e.message) || e); }`,
|
|
4216
4174
|
].join('\n');
|
|
4217
4175
|
// CJS/ESM interop shape — REGISTRATION side.
|
|
4218
4176
|
//
|
|
@@ -4237,7 +4195,7 @@ export const piniaSymbol = p.piniaSymbol;
|
|
|
4237
4195
|
` const __nsSelfRaw = (typeof __ns_core_self_ns__ !== 'undefined') ? __ns_core_self_ns__ : { default: undefined };`,
|
|
4238
4196
|
` const __nsSelf = __nsShapeFn(__nsSelfRaw);`,
|
|
4239
4197
|
...registrationKeys.map((k) => ` __nsReg[${k}] = __nsSelf;`),
|
|
4240
|
-
`} } catch (e) {
|
|
4198
|
+
`} } catch (e) { console.warn('[ns-core] self-register failed:', (e && e.message) || e); }`,
|
|
4241
4199
|
].join('\n');
|
|
4242
4200
|
// Bind `import * as __ns_core_self_ns__` to the module's
|
|
4243
4201
|
// own export namespace so the footer can stash it into
|
|
@@ -4285,10 +4243,7 @@ export const piniaSymbol = p.piniaSymbol;
|
|
|
4285
4243
|
res.end(moduleCode);
|
|
4286
4244
|
}
|
|
4287
4245
|
catch (e) {
|
|
4288
|
-
|
|
4289
|
-
console.warn('[ns-core-bridge] serve failed:', e?.message);
|
|
4290
|
-
}
|
|
4291
|
-
catch { }
|
|
4246
|
+
console.warn('[ns-core-bridge] serve failed:', e?.message);
|
|
4292
4247
|
next();
|
|
4293
4248
|
}
|
|
4294
4249
|
});
|
|
@@ -4298,14 +4253,11 @@ export const piniaSymbol = p.piniaSymbol;
|
|
|
4298
4253
|
const urlObj = new URL(req.url || '', 'http://localhost');
|
|
4299
4254
|
if (!(urlObj.pathname === '/ns/entry-rt'))
|
|
4300
4255
|
return next();
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
console.log('[hmr-http] GET /ns/entry-rt from', ra + (rp ? ':' + rp : ''));
|
|
4306
|
-
}
|
|
4256
|
+
if (verbose) {
|
|
4257
|
+
const ra = req.socket?.remoteAddress;
|
|
4258
|
+
const rp = req.socket?.remotePort;
|
|
4259
|
+
console.log('[hmr-http] GET /ns/entry-rt from', ra + (rp ? ':' + rp : ''));
|
|
4307
4260
|
}
|
|
4308
|
-
catch { }
|
|
4309
4261
|
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
4310
4262
|
res.setHeader('Content-Type', 'application/javascript; charset=utf-8');
|
|
4311
4263
|
res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0');
|
|
@@ -4550,10 +4502,7 @@ export const piniaSymbol = p.piniaSymbol;
|
|
|
4550
4502
|
}
|
|
4551
4503
|
if (!transformed?.code) {
|
|
4552
4504
|
if (verbose) {
|
|
4553
|
-
|
|
4554
|
-
console.warn(`[sfc][serve] transform miss for`, fullSpec);
|
|
4555
|
-
}
|
|
4556
|
-
catch { }
|
|
4505
|
+
console.warn(`[sfc][serve] transform miss for`, fullSpec);
|
|
4557
4506
|
}
|
|
4558
4507
|
// Emit an erroring module to surface the failure at import site with helpful hints
|
|
4559
4508
|
try {
|
|
@@ -4669,10 +4618,7 @@ export const piniaSymbol = p.piniaSymbol;
|
|
|
4669
4618
|
}
|
|
4670
4619
|
catch (eTplSelf) {
|
|
4671
4620
|
if (verbose) {
|
|
4672
|
-
|
|
4673
|
-
console.warn('[sfc][template][self-compile][fail]', fullSpec, eTplSelf?.message);
|
|
4674
|
-
}
|
|
4675
|
-
catch { }
|
|
4621
|
+
console.warn('[sfc][template][self-compile][fail]', fullSpec, eTplSelf?.message);
|
|
4676
4622
|
}
|
|
4677
4623
|
code = transformed.code || 'export {}\n';
|
|
4678
4624
|
code = processTemplateVariantMinimal(code);
|
|
@@ -4839,10 +4785,7 @@ export const piniaSymbol = p.piniaSymbol;
|
|
|
4839
4785
|
}
|
|
4840
4786
|
catch (eTsVar) {
|
|
4841
4787
|
if (verbose) {
|
|
4842
|
-
|
|
4843
|
-
console.warn('[sfc][variant:script][babel-ts][fail]', fullSpec, eTsVar?.message);
|
|
4844
|
-
}
|
|
4845
|
-
catch { }
|
|
4788
|
+
console.warn('[sfc][variant:script][babel-ts][fail]', fullSpec, eTsVar?.message);
|
|
4846
4789
|
}
|
|
4847
4790
|
}
|
|
4848
4791
|
}
|
|
@@ -4906,10 +4849,7 @@ export const piniaSymbol = p.piniaSymbol;
|
|
|
4906
4849
|
const kind = isVariant ? `variant:${variantType || 'unknown'}` : 'full';
|
|
4907
4850
|
const sig = `// [sfc] kind=${kind} path=${importerPath} len=${code.length} default=${hasDefault} wrapped=${false}\n`;
|
|
4908
4851
|
if (verbose) {
|
|
4909
|
-
|
|
4910
|
-
console.log(`[sfc][serve] ${fullSpec} kind=${kind} default=${hasDefault} bytes=${code.length}`);
|
|
4911
|
-
}
|
|
4912
|
-
catch { }
|
|
4852
|
+
console.log(`[sfc][serve] ${fullSpec} kind=${kind} default=${hasDefault} bytes=${code.length}`);
|
|
4913
4853
|
}
|
|
4914
4854
|
// Ensure script variants always provide a default export if they declare a component
|
|
4915
4855
|
if (!hasDefault) {
|
|
@@ -4978,16 +4918,10 @@ export const piniaSymbol = p.piniaSymbol;
|
|
|
4978
4918
|
// 6) Object property forms (rare in template output) render: (...) => {}
|
|
4979
4919
|
const hasRender = /export\s+function\s+render\s*\(/.test(templateCode) || /(?:^|\n)\s*function\s+render\s*\(/.test(templateCode) || /export\s+(?:const|let|var)\s+render\s*=/.test(templateCode) || /(?:^|\n)\s*(?:const|let|var)\s+render\s*=/.test(templateCode) || /\brender\s*[:=]\s*/.test(templateCode) || /export\s*\{\s*render\s*(?:as\s*render)?\s*\}/.test(templateCode);
|
|
4980
4920
|
if (hasRender && verbose) {
|
|
4981
|
-
|
|
4982
|
-
console.log('[sfc-meta] detected render for', base);
|
|
4983
|
-
}
|
|
4984
|
-
catch { }
|
|
4921
|
+
console.log('[sfc-meta] detected render for', base);
|
|
4985
4922
|
}
|
|
4986
4923
|
else if (!hasRender && verbose) {
|
|
4987
|
-
|
|
4988
|
-
console.warn('[sfc-meta] render NOT detected for', base);
|
|
4989
|
-
}
|
|
4990
|
-
catch { }
|
|
4924
|
+
console.warn('[sfc-meta] render NOT detected for', base);
|
|
4991
4925
|
}
|
|
4992
4926
|
const hash = createHash('md5').update(base).digest('hex').slice(0, 8);
|
|
4993
4927
|
const payload = {
|
|
@@ -5121,10 +5055,7 @@ export const piniaSymbol = p.piniaSymbol;
|
|
|
5121
5055
|
}
|
|
5122
5056
|
catch (eScript) {
|
|
5123
5057
|
if (verbose) {
|
|
5124
|
-
|
|
5125
|
-
console.warn('[sfc-asm][compileScript] failed', base, eScript?.message);
|
|
5126
|
-
}
|
|
5127
|
-
catch { }
|
|
5058
|
+
console.warn('[sfc-asm][compileScript] failed', base, eScript?.message);
|
|
5128
5059
|
}
|
|
5129
5060
|
// Retry without inlineTemplate
|
|
5130
5061
|
try {
|
|
@@ -5140,10 +5071,7 @@ export const piniaSymbol = p.piniaSymbol;
|
|
|
5140
5071
|
}
|
|
5141
5072
|
catch (eNoInline) {
|
|
5142
5073
|
if (verbose) {
|
|
5143
|
-
|
|
5144
|
-
console.warn('[sfc-asm][compileScript][no-inline-fallback] failed', base, eNoInline?.message);
|
|
5145
|
-
}
|
|
5146
|
-
catch { }
|
|
5074
|
+
console.warn('[sfc-asm][compileScript][no-inline-fallback] failed', base, eNoInline?.message);
|
|
5147
5075
|
}
|
|
5148
5076
|
}
|
|
5149
5077
|
}
|
|
@@ -5174,10 +5102,7 @@ export const piniaSymbol = p.piniaSymbol;
|
|
|
5174
5102
|
}
|
|
5175
5103
|
catch (eNoInline) {
|
|
5176
5104
|
if (verbose) {
|
|
5177
|
-
|
|
5178
|
-
console.warn('[sfc-asm][compileScript][no-inline-fallback] failed', base, eNoInline?.message);
|
|
5179
|
-
}
|
|
5180
|
-
catch { }
|
|
5105
|
+
console.warn('[sfc-asm][compileScript][no-inline-fallback] failed', base, eNoInline?.message);
|
|
5181
5106
|
}
|
|
5182
5107
|
}
|
|
5183
5108
|
}
|
|
@@ -5200,20 +5125,14 @@ export const piniaSymbol = p.piniaSymbol;
|
|
|
5200
5125
|
});
|
|
5201
5126
|
compiledTplCode = (ct && (ct.code || '')) || '';
|
|
5202
5127
|
if (ct?.errors?.length && verbose) {
|
|
5203
|
-
|
|
5204
|
-
console.warn('[sfc-asm][compileTemplate][errors]', base, ct.errors);
|
|
5205
|
-
}
|
|
5206
|
-
catch { }
|
|
5128
|
+
console.warn('[sfc-asm][compileTemplate][errors]', base, ct.errors);
|
|
5207
5129
|
}
|
|
5208
5130
|
}
|
|
5209
5131
|
}
|
|
5210
5132
|
catch (eTpl) {
|
|
5211
5133
|
templateErr = eTpl;
|
|
5212
5134
|
if (verbose) {
|
|
5213
|
-
|
|
5214
|
-
console.warn('[sfc-asm][compileTemplate] failed', base, eTpl?.message);
|
|
5215
|
-
}
|
|
5216
|
-
catch { }
|
|
5135
|
+
console.warn('[sfc-asm][compileTemplate] failed', base, eTpl?.message);
|
|
5217
5136
|
}
|
|
5218
5137
|
// Fallback: use the variant-transformed template code if available
|
|
5219
5138
|
try {
|
|
@@ -5276,10 +5195,7 @@ export const piniaSymbol = p.piniaSymbol;
|
|
|
5276
5195
|
}
|
|
5277
5196
|
catch (eExtract) {
|
|
5278
5197
|
if (verbose) {
|
|
5279
|
-
|
|
5280
|
-
console.warn('[sfc-asm][extractTemplateRender] failed', base, eExtract?.message);
|
|
5281
|
-
}
|
|
5282
|
-
catch { }
|
|
5198
|
+
console.warn('[sfc-asm][extractTemplateRender] failed', base, eExtract?.message);
|
|
5283
5199
|
}
|
|
5284
5200
|
}
|
|
5285
5201
|
}
|
|
@@ -5357,10 +5273,7 @@ export const piniaSymbol = p.piniaSymbol;
|
|
|
5357
5273
|
}
|
|
5358
5274
|
catch (eTs) {
|
|
5359
5275
|
if (verbose) {
|
|
5360
|
-
|
|
5361
|
-
console.warn('[sfc-asm][babel-ts][fail]', base, eTs?.message);
|
|
5362
|
-
}
|
|
5363
|
-
catch { }
|
|
5276
|
+
console.warn('[sfc-asm][babel-ts][fail]', base, eTs?.message);
|
|
5364
5277
|
}
|
|
5365
5278
|
}
|
|
5366
5279
|
// Hoist imports + strip residual TS via AST
|
|
@@ -5370,18 +5283,12 @@ export const piniaSymbol = p.piniaSymbol;
|
|
|
5370
5283
|
importLines = astRes.imports;
|
|
5371
5284
|
scriptTransformed = astRes.body;
|
|
5372
5285
|
if (astRes.diagnostics.length && verbose) {
|
|
5373
|
-
|
|
5374
|
-
console.warn('[sfc-asm][ast]', base, astRes.diagnostics.join('; '));
|
|
5375
|
-
}
|
|
5376
|
-
catch { }
|
|
5286
|
+
console.warn('[sfc-asm][ast]', base, astRes.diagnostics.join('; '));
|
|
5377
5287
|
}
|
|
5378
5288
|
}
|
|
5379
5289
|
catch (eAst) {
|
|
5380
5290
|
if (verbose) {
|
|
5381
|
-
|
|
5382
|
-
console.warn('[sfc-asm][ast][fail]', base, eAst?.message);
|
|
5383
|
-
}
|
|
5384
|
-
catch { }
|
|
5291
|
+
console.warn('[sfc-asm][ast][fail]', base, eAst?.message);
|
|
5385
5292
|
}
|
|
5386
5293
|
}
|
|
5387
5294
|
// Ensure renderDecl ends with closing brace ONLY for function declaration forms
|
|
@@ -6179,6 +6086,7 @@ export const piniaSymbol = p.piniaSymbol;
|
|
|
6179
6086
|
flavor: ACTIVE_STRATEGY.flavor,
|
|
6180
6087
|
modules: ctx.modules,
|
|
6181
6088
|
getModuleById: (id) => server.moduleGraph.getModuleById(id),
|
|
6089
|
+
verbose,
|
|
6182
6090
|
});
|
|
6183
6091
|
for (const mod of graphTargets) {
|
|
6184
6092
|
if (!mod?.id)
|
|
@@ -6259,6 +6167,12 @@ export const piniaSymbol = p.piniaSymbol;
|
|
|
6259
6167
|
getModuleById: (id) => server.moduleGraph.getModuleById(id),
|
|
6260
6168
|
getModulesByFile: (targetFile) => server.moduleGraph.getModulesByFile?.(targetFile),
|
|
6261
6169
|
});
|
|
6170
|
+
if (verbose) {
|
|
6171
|
+
console.info(`[ns-hmr-diag][server] hot-update file=${file} isHtml=${isHtml} isTs=${isTs} ctxModules=${Array.from(ctx.modules || []).length} hotUpdateRoots=${angularHotUpdateRoots.length} (${angularHotUpdateRoots
|
|
6172
|
+
.map((m) => m?.id ?? '(none)')
|
|
6173
|
+
.slice(0, 8)
|
|
6174
|
+
.join(', ')}${angularHotUpdateRoots.length > 8 ? ', …' : ''})`);
|
|
6175
|
+
}
|
|
6262
6176
|
if (!(isHtml || isTs))
|
|
6263
6177
|
return;
|
|
6264
6178
|
updateMetrics.invalidated += angularHotUpdateRoots.length;
|
|
@@ -6343,6 +6257,9 @@ export const piniaSymbol = p.piniaSymbol;
|
|
|
6343
6257
|
// narrowing wins (saves re-transform work on the server).
|
|
6344
6258
|
// The eviction set always includes importers so V8 re-fetches
|
|
6345
6259
|
// and re-binds them.
|
|
6260
|
+
if (verbose) {
|
|
6261
|
+
console.info(`[ns-hmr-diag][server] angularNeedsTransitive=${angularNeedsTransitive} (file=${path.basename(file)})`);
|
|
6262
|
+
}
|
|
6346
6263
|
let transitiveImporters = [];
|
|
6347
6264
|
try {
|
|
6348
6265
|
transitiveImporters = collectAngularTransitiveImportersForInvalidation({
|
|
@@ -6350,6 +6267,9 @@ export const piniaSymbol = p.piniaSymbol;
|
|
|
6350
6267
|
isExcluded: (id) => id.includes('/node_modules/'),
|
|
6351
6268
|
maxDepth: 16,
|
|
6352
6269
|
});
|
|
6270
|
+
if (verbose) {
|
|
6271
|
+
console.info(`[ns-hmr-diag][server] transitiveImporters count=${transitiveImporters.length} firstN=`, transitiveImporters.slice(0, 16).map((m) => m?.id ?? '(none)'));
|
|
6272
|
+
}
|
|
6353
6273
|
if (angularNeedsTransitive) {
|
|
6354
6274
|
updateMetrics.invalidated += transitiveImporters.length;
|
|
6355
6275
|
for (const mod of transitiveImporters) {
|
|
@@ -6463,14 +6383,23 @@ export const piniaSymbol = p.piniaSymbol;
|
|
|
6463
6383
|
});
|
|
6464
6384
|
}
|
|
6465
6385
|
catch (error) {
|
|
6466
|
-
if (verbose)
|
|
6467
|
-
console.warn('[hmr-
|
|
6386
|
+
if (verbose) {
|
|
6387
|
+
console.warn('[ns-hmr-diag][server] eviction set computation failed', error);
|
|
6388
|
+
}
|
|
6468
6389
|
}
|
|
6469
6390
|
if (verbose) {
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6391
|
+
try {
|
|
6392
|
+
const tsRel = rel.replace(/\.(html|htm)$/i, '.ts');
|
|
6393
|
+
const jsRel = rel.replace(/\.(html|htm)$/i, '.js');
|
|
6394
|
+
const containsRelatedTs = evictPaths.some((u) => u.endsWith(tsRel));
|
|
6395
|
+
const containsRelatedJs = evictPaths.some((u) => u.endsWith(jsRel));
|
|
6396
|
+
const sample = evictPaths.slice(0, 32);
|
|
6397
|
+
console.info(`[ns-hmr-diag][server] evict-set count=${evictPaths.length} importerEntry=${bootstrapEntryRel ?? '(none)'} containsRelatedTs=${containsRelatedTs} containsRelatedJs=${containsRelatedJs} firstN=`, sample);
|
|
6398
|
+
if (evictPaths.length > sample.length) {
|
|
6399
|
+
console.info(`[ns-hmr-diag][server] evict-set hidden=${evictPaths.length - sample.length} (showed first ${sample.length})`);
|
|
6400
|
+
}
|
|
6401
|
+
}
|
|
6402
|
+
catch { }
|
|
6474
6403
|
}
|
|
6475
6404
|
const msg = {
|
|
6476
6405
|
type: 'ns:angular-update',
|
|
@@ -6713,7 +6642,7 @@ if (typeof __VUE_HMR_RUNTIME__ === 'undefined') {
|
|
|
6713
6642
|
if (typeof spec === 'string' && /^(?:https?:)\/\//.test(spec)) {
|
|
6714
6643
|
const err = new Error('[ns-hmr][require-guard] require of URL: ' + spec + ' via ' + label);
|
|
6715
6644
|
const stack = err.stack || '';
|
|
6716
|
-
|
|
6645
|
+
console.error(err.message + '\n' + stack);
|
|
6717
6646
|
try { g.__NS_REQUIRE_GUARD_LAST__ = { spec, stack, label, ts: Date.now() }; } catch {}
|
|
6718
6647
|
}
|
|
6719
6648
|
} catch {}
|