@nativescript/vite 8.0.0-alpha.29 → 8.0.0-alpha.30
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/hmr/server/angular-root-component.d.ts +79 -0
- package/hmr/server/angular-root-component.js +149 -0
- package/hmr/server/angular-root-component.js.map +1 -0
- package/hmr/server/hmr-module-graph.d.ts +37 -0
- package/hmr/server/hmr-module-graph.js +214 -0
- package/hmr/server/hmr-module-graph.js.map +1 -0
- package/hmr/server/index.js +1 -0
- package/hmr/server/index.js.map +1 -1
- package/hmr/server/ns-rt-route.d.ts +5 -0
- package/hmr/server/ns-rt-route.js +35 -0
- package/hmr/server/ns-rt-route.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/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/server-origin.d.ts +12 -0
- package/hmr/server/server-origin.js +66 -0
- package/hmr/server/server-origin.js.map +1 -0
- package/hmr/server/websocket-core-bridge.js +0 -11
- package/hmr/server/websocket-core-bridge.js.map +1 -1
- package/hmr/server/websocket-device-transform.d.ts +21 -0
- package/hmr/server/websocket-device-transform.js +1570 -0
- package/hmr/server/websocket-device-transform.js.map +1 -0
- package/hmr/server/websocket-hot-update.d.ts +51 -0
- package/hmr/server/websocket-hot-update.js +1160 -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 +44 -0
- package/hmr/server/websocket-import-map-route.js.map +1 -0
- package/hmr/server/websocket-ns-core.d.ts +21 -0
- package/hmr/server/websocket-ns-core.js +305 -0
- package/hmr/server/websocket-ns-core.js.map +1 -0
- package/hmr/server/websocket-ns-entry.d.ts +22 -0
- package/hmr/server/websocket-ns-entry.js +150 -0
- package/hmr/server/websocket-ns-entry.js.map +1 -0
- package/hmr/server/websocket-ns-m.d.ts +34 -0
- package/hmr/server/websocket-ns-m.js +853 -0
- package/hmr/server/websocket-ns-m.js.map +1 -0
- package/hmr/server/websocket-served-module-helpers.d.ts +1 -1
- package/hmr/server/websocket-served-module-helpers.js +1 -1
- package/hmr/server/websocket-served-module-helpers.js.map +1 -1
- package/hmr/server/websocket-sfc.d.ts +24 -0
- package/hmr/server/websocket-sfc.js +1223 -0
- package/hmr/server/websocket-sfc.js.map +1 -0
- package/hmr/server/websocket-txn.js +2 -8
- package/hmr/server/websocket-txn.js.map +1 -1
- package/hmr/server/websocket-vendor-unifier.js +2 -8
- package/hmr/server/websocket-vendor-unifier.js.map +1 -1
- package/hmr/server/websocket.d.ts +1 -44
- package/hmr/server/websocket.js +588 -6691
- package/hmr/server/websocket.js.map +1 -1
- package/hmr/shared/runtime/root-placeholder-view.d.ts +19 -0
- package/hmr/shared/runtime/root-placeholder-view.js +310 -0
- package/hmr/shared/runtime/root-placeholder-view.js.map +1 -0
- package/hmr/shared/runtime/root-placeholder.js +1 -309
- package/hmr/shared/runtime/root-placeholder.js.map +1 -1
- package/hmr/shared/vendor/manifest-collect.d.ts +32 -0
- package/hmr/shared/vendor/manifest-collect.js +512 -0
- package/hmr/shared/vendor/manifest-collect.js.map +1 -0
- package/hmr/shared/vendor/manifest.d.ts +1 -35
- package/hmr/shared/vendor/manifest.js +3 -914
- package/hmr/shared/vendor/manifest.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 +16 -0
- package/hmr/shared/vendor/vendor-esbuild-plugins.js +203 -0
- package/hmr/shared/vendor/vendor-esbuild-plugins.js.map +1 -0
- package/package.json +1 -1
- package/hmr/server/websocket-vue-sfc.d.ts +0 -26
- package/hmr/server/websocket-vue-sfc.js +0 -1053
- package/hmr/server/websocket-vue-sfc.js.map +0 -1
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { existsSync, readFileSync } from 'fs';
|
|
3
|
+
import * as path from 'path';
|
|
4
|
+
import babelCore from '@babel/core';
|
|
5
|
+
import { getPackageJson, getProjectFilePath } from '../../helpers/project.js';
|
|
6
|
+
import { REQUIRE_GUARD_SNIPPET } from './require-guard.js';
|
|
7
|
+
import { setDeviceModuleHeaders } from './route-helpers.js';
|
|
8
|
+
// Lazily loaded only for the source-tree fallback below (transform
|
|
9
|
+
// entry-runtime.ts on the fly when the built .js isn't present).
|
|
10
|
+
const pluginTransformTypescript = (() => {
|
|
11
|
+
const requireFromHere = createRequire(import.meta.url);
|
|
12
|
+
const loaded = requireFromHere('@babel/plugin-transform-typescript');
|
|
13
|
+
return loaded?.default || loaded;
|
|
14
|
+
})();
|
|
15
|
+
/**
|
|
16
|
+
* Registers the device bootstrap endpoints:
|
|
17
|
+
* - `GET /ns/entry-rt[?v=<ver>]` — serves the compiled entry runtime module
|
|
18
|
+
* (built `entry-runtime.js`, or a transformed `entry-runtime.ts` fallback), and
|
|
19
|
+
* - `GET /ns/entry[/<ver>]` — a script-safe wrapper that fetches the entry
|
|
20
|
+
* runtime and starts the app with `{ origin, main, ver }`.
|
|
21
|
+
*/
|
|
22
|
+
export function registerNsEntryRoutes(server, options) {
|
|
23
|
+
const verbose = options.verbose;
|
|
24
|
+
const APP_ROOT_DIR = options.appRootDir;
|
|
25
|
+
const DEFAULT_MAIN_ENTRY = options.defaultMainEntry;
|
|
26
|
+
const DEFAULT_MAIN_ENTRY_VIRTUAL = options.defaultMainEntryVirtual;
|
|
27
|
+
const getGraphVersion = options.getGraphVersion;
|
|
28
|
+
const getServerOrigin = options.getServerOrigin;
|
|
29
|
+
// 2.6a) Serve compiled entry runtime module: GET /ns/entry-rt[?v=<ver>]
|
|
30
|
+
server.middlewares.use(async (req, res, next) => {
|
|
31
|
+
try {
|
|
32
|
+
const urlObj = new URL(req.url || '', 'http://localhost');
|
|
33
|
+
if (!(urlObj.pathname === '/ns/entry-rt'))
|
|
34
|
+
return next();
|
|
35
|
+
if (verbose) {
|
|
36
|
+
const ra = req.socket?.remoteAddress;
|
|
37
|
+
const rp = req.socket?.remotePort;
|
|
38
|
+
console.log('[hmr-http] GET /ns/entry-rt from', ra + (rp ? ':' + rp : ''));
|
|
39
|
+
}
|
|
40
|
+
setDeviceModuleHeaders(res);
|
|
41
|
+
let content = '';
|
|
42
|
+
try {
|
|
43
|
+
const _req = createRequire(import.meta.url);
|
|
44
|
+
const entryRtPath = _req.resolve('@nativescript/vite/hmr/entry-runtime.js');
|
|
45
|
+
content = readFileSync(entryRtPath, 'utf-8');
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
// .js not found (source tree without build) — transform .ts on the fly
|
|
49
|
+
try {
|
|
50
|
+
const tsPath = path.resolve(path.dirname(new URL(import.meta.url).pathname), '..', 'entry-runtime.ts');
|
|
51
|
+
if (existsSync(tsPath)) {
|
|
52
|
+
const tsSource = readFileSync(tsPath, 'utf-8');
|
|
53
|
+
const result = babelCore.transformSync(tsSource, {
|
|
54
|
+
filename: tsPath,
|
|
55
|
+
plugins: [[pluginTransformTypescript, { isTSX: false, allowDeclareFields: true }]],
|
|
56
|
+
sourceType: 'module',
|
|
57
|
+
});
|
|
58
|
+
if (result?.code) {
|
|
59
|
+
content = result.code;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (e2) {
|
|
64
|
+
if (verbose)
|
|
65
|
+
console.warn('[hmr-http] entry-runtime.ts transform failed', e2);
|
|
66
|
+
}
|
|
67
|
+
if (!content) {
|
|
68
|
+
content = 'export default async function start(){ console.error("[/ns/entry-rt] not found"); }\n';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (verbose)
|
|
72
|
+
console.log('[hmr-http] /ns/entry-rt serving', content.length, 'bytes');
|
|
73
|
+
res.statusCode = 200;
|
|
74
|
+
res.end(content);
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
console.warn('[hmr-http] /ns/entry-rt error', e);
|
|
78
|
+
next();
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
// 2.6b) HTTP-only app entry endpoint: GET /ns/entry[/<ver>]
|
|
82
|
+
// Thin wrapper that imports the compiled entry runtime and starts it with parameters.
|
|
83
|
+
server.middlewares.use(async (req, res, next) => {
|
|
84
|
+
try {
|
|
85
|
+
const urlObj = new URL(req.url || '', 'http://localhost');
|
|
86
|
+
if (!(urlObj.pathname === '/ns/entry' || /^\/ns\/entry\/[\d]+$/.test(urlObj.pathname)))
|
|
87
|
+
return next();
|
|
88
|
+
try {
|
|
89
|
+
if (verbose) {
|
|
90
|
+
const ra = req.socket?.remoteAddress;
|
|
91
|
+
const rp = req.socket?.remotePort;
|
|
92
|
+
console.log('[hmr-http] GET /ns/entry from', ra + (rp ? ':' + rp : ''));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
catch { }
|
|
96
|
+
const verSeg = urlObj.pathname.replace(/^\/ns\/entry\/?/, '');
|
|
97
|
+
// Resolve app main entry to an absolute path-like key used by /ns/m
|
|
98
|
+
res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0');
|
|
99
|
+
res.setHeader('Pragma', 'no-cache');
|
|
100
|
+
res.setHeader('Expires', '0');
|
|
101
|
+
const ver = /^[0-9]+$/.test(verSeg) ? verSeg : String(getGraphVersion() || 0);
|
|
102
|
+
const origin = getServerOrigin(server) || `${urlObj.protocol}//${urlObj.host}`;
|
|
103
|
+
// Resolve app main entry to an absolute path-like key used by /ns/m
|
|
104
|
+
let mainEntry = '/';
|
|
105
|
+
try {
|
|
106
|
+
const pkg = getPackageJson();
|
|
107
|
+
const main = pkg?.main || DEFAULT_MAIN_ENTRY;
|
|
108
|
+
const abs = getProjectFilePath(main).replace(/\\/g, '/');
|
|
109
|
+
// Normalize to '/app/...'
|
|
110
|
+
const marker = `/${APP_ROOT_DIR}/`;
|
|
111
|
+
const idx = abs.indexOf(marker);
|
|
112
|
+
mainEntry = idx >= 0 ? abs.substring(idx) : DEFAULT_MAIN_ENTRY_VIRTUAL;
|
|
113
|
+
}
|
|
114
|
+
catch { }
|
|
115
|
+
// Build a tiny wrapper that imports the compiled entry runtime from the dev server
|
|
116
|
+
let code = REQUIRE_GUARD_SNIPPET +
|
|
117
|
+
`// [ns-entry][v${ver}] wrapper (script-safe) bytes will follow\n` +
|
|
118
|
+
`(async function(){\n` +
|
|
119
|
+
` let origin = ${JSON.stringify(origin)}; const main = ${JSON.stringify(mainEntry)}; const __ns_graph_ver = ${JSON.stringify(ver)};\n` +
|
|
120
|
+
` try { const __b = (globalThis && globalThis.__NS_ENTRY_BASE__) ? String(globalThis.__NS_ENTRY_BASE__) : ''; if (__b) { try { const __o = new URL(__b).origin; if (__o) origin = __o; } catch {} } } catch {}\n` +
|
|
121
|
+
` const __VERBOSE__ = (typeof __NS_ENV_VERBOSE__ !== 'undefined' && __NS_ENV_VERBOSE__) || (globalThis && globalThis.process && globalThis.process.env && globalThis.process.env.verbose) || (globalThis && globalThis.__NS_ENV_VERBOSE__) || ${JSON.stringify(!!verbose)};\n` +
|
|
122
|
+
` if (__VERBOSE__) console.info('[ns-entry][wrapper] start', { origin, main, ver: __ns_graph_ver });\n` +
|
|
123
|
+
` async function __ns_import_entry_rt(u){\n` +
|
|
124
|
+
` // Prefer fetch+eval script transformation to avoid module import limitations on device\n` +
|
|
125
|
+
` try { const r = await fetch(u); const t = await r.text(); if (__VERBOSE__) console.info('[ns-entry][wrapper] entry-rt fetched bytes', (t&&t.length)||0);\n` +
|
|
126
|
+
` // Transform 'export default function' or 'export default async function' into global assignment\n` +
|
|
127
|
+
` let s = t.replace(/export\\s+default\\s+async\\s+function\\s+([A-Za-z0-9_$]+)?/,'globalThis.__NS_START_ENTRY__=async function $1')\n` +
|
|
128
|
+
` .replace(/export\\s+default\\s+function\\s+([A-Za-z0-9_$]+)?/,'globalThis.__NS_START_ENTRY__=function $1');\n` +
|
|
129
|
+
` // Fallback: if function-form replacements didn't run, handle expression default export too\n` +
|
|
130
|
+
` if (String(s).indexOf('__NS_START_ENTRY__') === -1) { s = 'globalThis.__NS_START_ENTRY__=' + s.replace(/export\\s+default\\s*/,''); }\n` +
|
|
131
|
+
` try { (0,eval)(s); } catch (ee) { console.error('[ns-entry][wrapper] eval entry-rt failed', ee && (ee.message||ee)); throw ee; }\n` +
|
|
132
|
+
` const fn = globalThis.__NS_START_ENTRY__; if (!fn) { throw new Error('entry-rt missing __NS_START_ENTRY__'); }\n` +
|
|
133
|
+
` return { default: fn };\n` +
|
|
134
|
+
` } catch(e) { console.error('[ns-entry][wrapper] entry-rt fetch/eval failed', e && (e.message||e)); throw e; }\n` +
|
|
135
|
+
` }\n` +
|
|
136
|
+
` const __entryRtUrl = '/ns/entry-rt?v=' + String(__ns_graph_ver);\n` +
|
|
137
|
+
` let __mod; try { __mod = await __ns_import_entry_rt(__entryRtUrl); if (__VERBOSE__) console.info('[ns-entry][wrapper] entry-rt ready'); } catch (e) { console.error('[ns-entry][wrapper] failed to prepare entry-rt', e && (e.message||e)); throw e; }\n` +
|
|
138
|
+
` const startEntry = (__mod && (__mod.default || __mod));\n` +
|
|
139
|
+
` try { await startEntry({ origin, main, ver: __ns_graph_ver, verbose: !!__VERBOSE__ }); if (__VERBOSE__) console.info('[ns-entry][wrapper] startEntry() resolved'); } catch (e) { console.error('[ns-entry][wrapper] startEntry() failed', e && (e.message||e)); throw e; }\n` +
|
|
140
|
+
`})();\n`;
|
|
141
|
+
code = code + `\n//# sourceURL=${origin}/ns/entry`;
|
|
142
|
+
res.statusCode = 200;
|
|
143
|
+
res.end(code);
|
|
144
|
+
}
|
|
145
|
+
catch (e) {
|
|
146
|
+
next();
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=websocket-ns-ent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AC;YACZ,IAAI,EAAE,CAAC;QACR,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { TransformResult, ViteDevServer } from 'vite';
|
|
2
|
+
import type { FrameworkServerStrategy } from './framework-strategy.js';
|
|
3
|
+
type SharedTransformRequestFn = (url: string, timeoutMs?: number) => Promise<TransformResult | null>;
|
|
4
|
+
type UpsertGraphModuleFn = (rawId: string, code: string, deps: string[], options?: {
|
|
5
|
+
bumpVersion?: boolean;
|
|
6
|
+
emitDeltaOnInsert?: boolean;
|
|
7
|
+
broadcastDelta?: boolean;
|
|
8
|
+
}) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Plugin-closure dependencies the `/ns/m` device module server needs. The pure
|
|
11
|
+
* transform/codegen functions are imported directly from
|
|
12
|
+
* `websocket-device-transform.ts`; only genuine plugin state (graph version,
|
|
13
|
+
* strategy, shared transform runner, graph upsert) is injected here.
|
|
14
|
+
*/
|
|
15
|
+
export interface RegisterNsModuleServerRouteOptions {
|
|
16
|
+
verbose: boolean;
|
|
17
|
+
appVirtualWithSlash: string;
|
|
18
|
+
sfcFileMap: Map<string, string>;
|
|
19
|
+
depFileMap: Map<string, string>;
|
|
20
|
+
getGraphVersion(): number;
|
|
21
|
+
getStrategy(): FrameworkServerStrategy;
|
|
22
|
+
getServerOrigin(server: ViteDevServer): string;
|
|
23
|
+
sharedTransformRequest: SharedTransformRequestFn;
|
|
24
|
+
ensureInitialGraphPopulationStarted(server: ViteDevServer): void;
|
|
25
|
+
upsertGraphModule: UpsertGraphModuleFn;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Registers the `/ns/m/*` device module server: the HTTP endpoint every
|
|
29
|
+
* NativeScript device uses to fetch app/source modules (and AnalogJS Angular
|
|
30
|
+
* `/@ng/component` live-reload requests) as device-ready ESM. This is the
|
|
31
|
+
* single hottest route in the HMR server.
|
|
32
|
+
*/
|
|
33
|
+
export declare function registerNsModuleServerRoute(server: ViteDevServer, options: RegisterNsModuleServerRouteOptions): void;
|
|
34
|
+
export {};
|