@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,512 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs, { readFileSync } from 'fs';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
4
|
+
// Do not force-include @nativescript/core in the dev vendor bundle.
|
|
5
|
+
// Keeping core out of vendor avoids duplicate side-effect registrations (e.g.,
|
|
6
|
+
// com.tns.FragmentClass, com.tns.NativeScriptActivity) across bundle.mjs and vendor.
|
|
7
|
+
// Force runtime-sensitive packages onto the vendor path so they do not drift
|
|
8
|
+
// between startup bundle, HTTP-wrapped CommonJS, and base-require semantics
|
|
9
|
+
// during HMR sessions.
|
|
10
|
+
const ALWAYS_INCLUDE = new Set(['stacktrace-js']);
|
|
11
|
+
const ALWAYS_EXCLUDE = new Set([
|
|
12
|
+
'@nativescript/android',
|
|
13
|
+
'@nativescript/ios',
|
|
14
|
+
'@nativescript/types',
|
|
15
|
+
'@nativescript/webpack',
|
|
16
|
+
// Angular browser animations are not used in NativeScript; excluding reduces
|
|
17
|
+
// memory pressure and avoids bringing partial declarations into vendor.
|
|
18
|
+
'@angular/animations',
|
|
19
|
+
'@angular/platform-browser/animations',
|
|
20
|
+
// Not needed at runtime with linked partials; reduce vendor size/memory.
|
|
21
|
+
'@angular/platform-browser-dynamic',
|
|
22
|
+
// Native add-on helpers pulled by ws or others; exclude in NS dev vendor
|
|
23
|
+
'bufferutil',
|
|
24
|
+
'utf-8-validate',
|
|
25
|
+
'node-gyp-build',
|
|
26
|
+
'bufferutil',
|
|
27
|
+
'utf-8-validate',
|
|
28
|
+
'node-gyp-build',
|
|
29
|
+
// All @babel/* and babel-* packages are build-time tools, never runtime deps.
|
|
30
|
+
// They get pulled in as peer deps of packages like @nativescript-community/solid-js
|
|
31
|
+
// but should never be in the vendor bundle (they require 'fs', 'path', etc.).
|
|
32
|
+
'@babel/core',
|
|
33
|
+
'@babel/helper-plugin-utils',
|
|
34
|
+
'@babel/generator',
|
|
35
|
+
'@babel/helper-string-parser',
|
|
36
|
+
'@babel/helper-validator-identifier',
|
|
37
|
+
'@babel/parser',
|
|
38
|
+
'@babel/plugin-syntax-typescript',
|
|
39
|
+
'@babel/plugin-transform-typescript',
|
|
40
|
+
'@babel/preset-typescript',
|
|
41
|
+
'@babel/preset-env',
|
|
42
|
+
'@babel/types',
|
|
43
|
+
'babel-preset-solid',
|
|
44
|
+
'babel-plugin-jsx-dom-expressions',
|
|
45
|
+
// Heavy dependency not needed in vendor dev bundle; fetch via HTTP loader instead
|
|
46
|
+
'rxjs',
|
|
47
|
+
'nativescript',
|
|
48
|
+
'typescript',
|
|
49
|
+
'ts-node',
|
|
50
|
+
'vue-tsc',
|
|
51
|
+
'ws',
|
|
52
|
+
'@types/node',
|
|
53
|
+
'nativescript-theme-core',
|
|
54
|
+
// Build-time tools that get pulled in as transitive dependencies but should
|
|
55
|
+
// never be in the device vendor bundle (they require Node built-ins like fs,
|
|
56
|
+
// path, child_process, etc.). Now that we collect transitive runtime deps,
|
|
57
|
+
// these need explicit exclusion.
|
|
58
|
+
'esbuild',
|
|
59
|
+
'prettier',
|
|
60
|
+
'acorn',
|
|
61
|
+
'recast',
|
|
62
|
+
'source-map',
|
|
63
|
+
'source-map-js',
|
|
64
|
+
'tsx',
|
|
65
|
+
'diff',
|
|
66
|
+
'esprima',
|
|
67
|
+
// TanStack build-time router tooling (code generation, file-based routing)
|
|
68
|
+
'@tanstack/router-plugin',
|
|
69
|
+
'@tanstack/router-generator',
|
|
70
|
+
'@tanstack/router-utils',
|
|
71
|
+
'@tanstack/virtual-file-routes',
|
|
72
|
+
// File system / glob utilities — build-time only, require Node fs
|
|
73
|
+
'fdir',
|
|
74
|
+
'picomatch',
|
|
75
|
+
'tinyglobby',
|
|
76
|
+
// SSR-only library (bot detection) — not needed on device
|
|
77
|
+
'isbot',
|
|
78
|
+
// Type-only packages with no runtime JavaScript
|
|
79
|
+
'csstype',
|
|
80
|
+
// NativeScript CLI hook system — build-time only, requires Node os/path
|
|
81
|
+
'@nativescript/hook',
|
|
82
|
+
// Test runner uses webpack's require.context API which doesn't exist in Vite.
|
|
83
|
+
// Including it in the vendor bundle causes __require.context crashes at runtime.
|
|
84
|
+
'@nativescript/unit-test-runner',
|
|
85
|
+
'nativescript-unit-test-runner',
|
|
86
|
+
// CSS build tools — postcss, tailwindcss, and related tooling are exclusively
|
|
87
|
+
// build-time processors. They require Node APIs (process, fs, path) and must
|
|
88
|
+
// never run on device. esbuild bundles their transitive deps (picocolors,
|
|
89
|
+
// nanoid, etc.) which reference `process` and crash at runtime.
|
|
90
|
+
'tailwindcss',
|
|
91
|
+
'@nativescript/tailwind',
|
|
92
|
+
'postcss',
|
|
93
|
+
'autoprefixer',
|
|
94
|
+
'postcss-import',
|
|
95
|
+
'postcss-url',
|
|
96
|
+
'postcss-nested',
|
|
97
|
+
'picocolors',
|
|
98
|
+
'nanoid',
|
|
99
|
+
// Server-side SDKs that require Node networking APIs (net, tls, dns, crypto).
|
|
100
|
+
// These are backend tools, not device-side.
|
|
101
|
+
'mongodb',
|
|
102
|
+
]);
|
|
103
|
+
export function collectVendorModules(projectRoot, platform, flavor) {
|
|
104
|
+
const packageJsonPath = path.resolve(projectRoot, 'package.json');
|
|
105
|
+
const pkg = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
106
|
+
const projectRequire = createRequire(packageJsonPath);
|
|
107
|
+
const debug = process.env.VITE_DEBUG_LOGS === 'true' || process.env.VITE_DEBUG_LOGS === '1';
|
|
108
|
+
const vendor = new Set();
|
|
109
|
+
const visited = new Set();
|
|
110
|
+
const queue = [];
|
|
111
|
+
// Local-source deps (file: pointing to a directory, link:, workspace:) are
|
|
112
|
+
// app code, not pre-packaged libraries. esbuild's vendor pipeline has none
|
|
113
|
+
// of the user's tsconfig path aliases or other Vite plugin resolvers, so
|
|
114
|
+
// any aliased import inside their source will fail with "Could not
|
|
115
|
+
// resolve". We collect their names here so that peer-dep traversal can
|
|
116
|
+
// also skip them.
|
|
117
|
+
const localSourceNames = new Set();
|
|
118
|
+
const isPackageRootSpecifier = (name) => {
|
|
119
|
+
if (!name)
|
|
120
|
+
return false;
|
|
121
|
+
if (name.startsWith('@')) {
|
|
122
|
+
// Scoped: @scope/name is root; anything deeper is subpath
|
|
123
|
+
const parts = name.split('/');
|
|
124
|
+
return parts.length === 2;
|
|
125
|
+
}
|
|
126
|
+
// Unscoped: no slash means root; any slash means subpath
|
|
127
|
+
return !name.includes('/');
|
|
128
|
+
};
|
|
129
|
+
const isAngularFlavor = flavor === 'angular';
|
|
130
|
+
const isSolidFlavor = flavor === 'solid';
|
|
131
|
+
const addCandidate = (name) => {
|
|
132
|
+
if (!name || shouldSkipDependency(name)) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
// Avoid pulling Angular compiler/runtime into the dev vendor bundle when
|
|
136
|
+
// the current project flavor is not Angular (for example, solid). This
|
|
137
|
+
// prevents esbuild from trying to bundle @angular/compiler and its Babel
|
|
138
|
+
// toolchain, which requires Node built-ins like fs/path/url.
|
|
139
|
+
if (!isAngularFlavor && (name === '@angular/compiler' || name.startsWith('@angular/'))) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
// For the Solid flavor, keep `solid-js` itself OUT of the vendor bundle.
|
|
143
|
+
//
|
|
144
|
+
// Both `@solid-refresh` (served via HTTP) and Vite-aliased user code
|
|
145
|
+
// import `solid-js` through the dev server, while the vendor bundle
|
|
146
|
+
// pulls it in as a peerDependency of `@nativescript-community/solid-js`.
|
|
147
|
+
// Two copies → two `Owner` module-locals → the proxy memo created by
|
|
148
|
+
// `solid-refresh`'s `HMRComp` is registered on the HTTP copy's Owner
|
|
149
|
+
// (which is always null — hence the
|
|
150
|
+
// `computations created outside a createRoot or render` warning), while
|
|
151
|
+
// `render(App, doc)` runs against the vendor copy's Owner. Same chain
|
|
152
|
+
// breaks HMR propagation: `patchRegistry`'s `setComp` ticks the HTTP
|
|
153
|
+
// copy's signal but the live page tree subscribes through the vendor
|
|
154
|
+
// copy's reactive graph, so the new component body never reaches the
|
|
155
|
+
// screen.
|
|
156
|
+
//
|
|
157
|
+
// We pair this skip with the matching esbuild externalization
|
|
158
|
+
// (`nsSolidJsExternalPlugin`) and an import-map redirect in
|
|
159
|
+
// `import-map.ts` that points `solid-js` at the HTTP URL. All three
|
|
160
|
+
// converge on the same dev-server URL, V8 dedupes by URL, and the
|
|
161
|
+
// app sees a single `solid-js` realm.
|
|
162
|
+
if (isSolidFlavor && name === 'solid-js') {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
// Skip already-visited packages to avoid redundant queue processing
|
|
166
|
+
if (visited.has(name)) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
visited.add(name);
|
|
170
|
+
vendor.add(name);
|
|
171
|
+
const isRoot = isPackageRootSpecifier(name);
|
|
172
|
+
// Only traverse deps for package roots; subpaths should not attempt package.json resolution
|
|
173
|
+
if (isRoot) {
|
|
174
|
+
queue.push(name);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
const addDeps = (deps) => {
|
|
178
|
+
if (!deps) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
for (const [name, spec] of Object.entries(deps)) {
|
|
182
|
+
if (isUnvendorableLocalSource(name, spec, projectRequire, platform)) {
|
|
183
|
+
// Defer to the regular Vite/Rolldown pipeline (HTTP-served in
|
|
184
|
+
// dev, bundled in production) where the
|
|
185
|
+
// ns-tsconfig-paths-resolver and the rest of the plugin chain
|
|
186
|
+
// can handle aliased imports. Local .tgz file: refs ARE proper
|
|
187
|
+
// packaged libraries and DO stay in vendor; so do file:
|
|
188
|
+
// directory refs that point at packages with compiled JS
|
|
189
|
+
// entry points (a common NativeScript monorepo pattern that
|
|
190
|
+
// hoists installs and re-exposes them from the app's
|
|
191
|
+
// package.json via `file:../../node_modules/<name>`).
|
|
192
|
+
localSourceNames.add(name);
|
|
193
|
+
if (debug) {
|
|
194
|
+
console.log(`[vendor] skipping local source dependency ${name} (spec: ${String(spec)})`);
|
|
195
|
+
}
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
addCandidate(name);
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
addDeps(pkg.dependencies);
|
|
202
|
+
addDeps(pkg.optionalDependencies);
|
|
203
|
+
for (const name of ALWAYS_INCLUDE) {
|
|
204
|
+
// Some force-included packages are only present transitively in apps that
|
|
205
|
+
// actually use them. Skip missing packages quietly so unrelated projects do
|
|
206
|
+
// not fail vendor collection just because the policy list names them.
|
|
207
|
+
if (canResolveDependencyPackageJson(name, projectRequire)) {
|
|
208
|
+
addCandidate(name);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
// Ensure Android Activity proxy is present for SBG scanning in dev/HMR
|
|
212
|
+
// and non-HMR builds alike: explicitly include the side-effect module
|
|
213
|
+
// that registers `com.tns.NativeScriptActivity`.
|
|
214
|
+
if (platform === 'android') {
|
|
215
|
+
addCandidate('@nativescript/core/ui/frame/activity.android');
|
|
216
|
+
}
|
|
217
|
+
if (pkg.dependencies?.['nativescript-vue'] && pkg.devDependencies?.vue) {
|
|
218
|
+
addCandidate('vue');
|
|
219
|
+
}
|
|
220
|
+
// Angular framework packages are intentionally NOT added to vendor. They are
|
|
221
|
+
// served via HTTP only so every importer resolves to a single module realm.
|
|
222
|
+
// See shouldSkipDependency() for the full rationale. RxJS is also left out of
|
|
223
|
+
// vendor (large, and not required in the vendor bundle for dev HMR).
|
|
224
|
+
if (pkg.dependencies?.['react-nativescript']) {
|
|
225
|
+
if (pkg.dependencies?.react) {
|
|
226
|
+
addCandidate('react');
|
|
227
|
+
}
|
|
228
|
+
if (pkg.dependencies?.['react-dom']) {
|
|
229
|
+
addCandidate('react-dom');
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
// SolidJS / TanStack Router: when @nativescript/tanstack-router is a dependency,
|
|
233
|
+
// its runtime deps (@tanstack/solid-router, @tanstack/router-core, @tanstack/history)
|
|
234
|
+
// MUST be in the vendor bundle. These packages:
|
|
235
|
+
// 1. Use browser APIs (window.dispatchEvent) that don't exist in NativeScript — they
|
|
236
|
+
// must be bundled where the NativeScript wrapper intercepts those calls
|
|
237
|
+
// 2. Contain JSX source that needs Solid compilation (dist/source/*.jsx) — the HTTP
|
|
238
|
+
// fallback can't compile node_modules JSX since vite-plugin-solid skips it
|
|
239
|
+
// 3. Import solid-js internally — loading via HTTP creates a separate solid-js instance
|
|
240
|
+
// esbuild uses the 'import' condition (not 'solid'), resolving to pre-compiled
|
|
241
|
+
// dist/esm/*.js which avoids all three issues.
|
|
242
|
+
if (pkg.dependencies?.['@nativescript/tanstack-router']) {
|
|
243
|
+
addCandidate('@tanstack/solid-router');
|
|
244
|
+
addCandidate('@tanstack/router-core');
|
|
245
|
+
addCandidate('@tanstack/history');
|
|
246
|
+
}
|
|
247
|
+
parseEnvList(process.env.NS_VENDOR_INCLUDE).forEach(addCandidate);
|
|
248
|
+
const projectDeps = {
|
|
249
|
+
dependencies: new Set(Object.keys(pkg.dependencies ?? {})),
|
|
250
|
+
optional: new Set(Object.keys(pkg.optionalDependencies ?? {})),
|
|
251
|
+
dev: new Set(Object.keys(pkg.devDependencies ?? {})),
|
|
252
|
+
};
|
|
253
|
+
while (queue.length) {
|
|
254
|
+
const specifier = queue.shift();
|
|
255
|
+
const dependencyPkg = readDependencyPackageJson(specifier, projectRequire);
|
|
256
|
+
if (!dependencyPkg) {
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
const peerDependencies = Object.keys(dependencyPkg.peerDependencies ?? {});
|
|
260
|
+
for (const peer of peerDependencies) {
|
|
261
|
+
if (shouldSkipDependency(peer) || localSourceNames.has(peer)) {
|
|
262
|
+
continue;
|
|
263
|
+
}
|
|
264
|
+
if (projectDeps.dependencies.has(peer) || projectDeps.optional.has(peer) || projectDeps.dev.has(peer)) {
|
|
265
|
+
addCandidate(peer);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
// NOTE: We intentionally do NOT collect transitive runtime dependencies
|
|
269
|
+
// here. The import map + runtime specifier normalization handles non-vendor
|
|
270
|
+
// packages by routing them through HTTP to the Vite dev server. This avoids
|
|
271
|
+
// the fragility of trying to esbuild-bundle every transitive dep (which can
|
|
272
|
+
// fail due to Node built-ins, type-only packages, duplicate module instances,
|
|
273
|
+
// etc.). Only direct project dependencies go into the vendor bundle.
|
|
274
|
+
}
|
|
275
|
+
parseEnvList(process.env.NS_VENDOR_EXCLUDE).forEach((name) => {
|
|
276
|
+
vendor.delete(name);
|
|
277
|
+
});
|
|
278
|
+
return {
|
|
279
|
+
entries: Array.from(vendor).sort(),
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
function shouldSkipDependency(name) {
|
|
283
|
+
if (!name) {
|
|
284
|
+
return true;
|
|
285
|
+
}
|
|
286
|
+
if (ALWAYS_EXCLUDE.has(name)) {
|
|
287
|
+
return true;
|
|
288
|
+
}
|
|
289
|
+
// Angular framework packages must only be served via the HTTP path so every
|
|
290
|
+
// importer resolves to a single module realm. When these packages are present
|
|
291
|
+
// in the vendor bundle AND imported by app modules via HTTP subpath, every
|
|
292
|
+
// @Component/@Injectable gets defined twice (once per realm), producing NG0912
|
|
293
|
+
// selector collisions, cross-realm `instanceof` failures, and dual class
|
|
294
|
+
// identities throughout Angular's DI container. HTTP-only is the single-realm
|
|
295
|
+
// invariant for user-level framework code.
|
|
296
|
+
if (name === '@nativescript/angular' || name === 'nativescript-angular' || name.startsWith('@angular/')) {
|
|
297
|
+
return true;
|
|
298
|
+
}
|
|
299
|
+
// All Babel packages are build tools — never bundle into device runtime.
|
|
300
|
+
// They require Node built-ins (fs, path, url) that don't exist on device.
|
|
301
|
+
if (name.startsWith('@babel/') || name.startsWith('babel-')) {
|
|
302
|
+
return true;
|
|
303
|
+
}
|
|
304
|
+
// Dev tools and type-only packages — not needed on device
|
|
305
|
+
if (name.startsWith('@solid-devtools/')) {
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
if (name.startsWith('@types/')) {
|
|
309
|
+
return true;
|
|
310
|
+
}
|
|
311
|
+
// PostCSS ecosystem — all build-time CSS processing
|
|
312
|
+
if (name === 'postcss' || name.startsWith('postcss-')) {
|
|
313
|
+
return true;
|
|
314
|
+
}
|
|
315
|
+
// Tailwind ecosystem — build-time only CSS framework
|
|
316
|
+
if (name.includes('tailwind')) {
|
|
317
|
+
return true;
|
|
318
|
+
}
|
|
319
|
+
// Test runners and frameworks — never needed on device
|
|
320
|
+
if (name.includes('test-runner') || name.includes('unit-test')) {
|
|
321
|
+
return true;
|
|
322
|
+
}
|
|
323
|
+
// Linters and formatters — build-time tools
|
|
324
|
+
if (name.includes('eslint') || name.includes('stylelint')) {
|
|
325
|
+
return true;
|
|
326
|
+
}
|
|
327
|
+
if (name.startsWith('.')) {
|
|
328
|
+
return true;
|
|
329
|
+
}
|
|
330
|
+
if (name.startsWith('file:')) {
|
|
331
|
+
return true;
|
|
332
|
+
}
|
|
333
|
+
if (name.startsWith('workspace:')) {
|
|
334
|
+
return true;
|
|
335
|
+
}
|
|
336
|
+
if (name.startsWith('link:')) {
|
|
337
|
+
return true;
|
|
338
|
+
}
|
|
339
|
+
return false;
|
|
340
|
+
}
|
|
341
|
+
const COMPILED_JS_ENTRY_EXTENSIONS = ['.js', '.mjs', '.cjs'];
|
|
342
|
+
const COMPILED_JS_ENTRY_REGEX = /\.(?:c|m)?jsx?$/;
|
|
343
|
+
function compiledJsExtensionsForPlatform(platform) {
|
|
344
|
+
const exts = [...COMPILED_JS_ENTRY_EXTENSIONS];
|
|
345
|
+
switch (platform) {
|
|
346
|
+
case 'android':
|
|
347
|
+
exts.push('.android.js');
|
|
348
|
+
break;
|
|
349
|
+
case 'ios':
|
|
350
|
+
exts.push('.ios.js', '.visionos.js');
|
|
351
|
+
break;
|
|
352
|
+
case 'visionos':
|
|
353
|
+
exts.push('.visionos.js', '.ios.js');
|
|
354
|
+
break;
|
|
355
|
+
}
|
|
356
|
+
return exts;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Determine whether a `package.json` dependency must be excluded from the
|
|
360
|
+
* HMR vendor bundle because esbuild's standalone vendor pipeline can't
|
|
361
|
+
* resolve its source.
|
|
362
|
+
*
|
|
363
|
+
* The HMR vendor bundle is generated by a standalone esbuild build that
|
|
364
|
+
* has none of the Vite plugin chain (most notably
|
|
365
|
+
* `ns-tsconfig-paths-resolver`), so any aliased import inside the
|
|
366
|
+
* package's **source** files will fail with "Could not resolve" and abort
|
|
367
|
+
* the whole bundle.
|
|
368
|
+
*
|
|
369
|
+
* Skip:
|
|
370
|
+
* - `link:` and `workspace:` refs (always app-side source).
|
|
371
|
+
* - `file:` refs to a directory whose installed package only ships
|
|
372
|
+
* TypeScript/JSX source (no compiled `.js`/`.mjs`/`.cjs` entry).
|
|
373
|
+
*
|
|
374
|
+
* Keep (return false):
|
|
375
|
+
* - Regular semver / git / url specs (normal third-party libraries).
|
|
376
|
+
* - Local `.tgz` file refs (pre-packaged libraries extracted at install).
|
|
377
|
+
* - `file:` directory refs that resolve to a package with a compiled JS
|
|
378
|
+
* entry — a common NativeScript monorepo convention where the app's
|
|
379
|
+
* `package.json` redirects to `../../node_modules/<name>` to avoid
|
|
380
|
+
* duplicate installs while letting the NativeScript CLI discover
|
|
381
|
+
* plugins from the app directory.
|
|
382
|
+
*/
|
|
383
|
+
export function isUnvendorableLocalSource(name, spec, projectRequire, platform) {
|
|
384
|
+
if (typeof spec !== 'string')
|
|
385
|
+
return false;
|
|
386
|
+
if (spec.startsWith('link:') || spec.startsWith('workspace:'))
|
|
387
|
+
return true;
|
|
388
|
+
if (!spec.startsWith('file:'))
|
|
389
|
+
return false;
|
|
390
|
+
// Tarballs are already pre-packaged libraries — install extracts them
|
|
391
|
+
// into a normal node_modules entry.
|
|
392
|
+
if (/\.t(?:ar\.)?gz(?:[?#].*)?$/.test(spec))
|
|
393
|
+
return false;
|
|
394
|
+
// Directory file: refs need a deeper check: peek at the installed
|
|
395
|
+
// package.json and ask "does this ship compiled JS?". If yes, vendor
|
|
396
|
+
// it. If no (TS source only), defer to the regular Vite pipeline.
|
|
397
|
+
return !packageHasCompiledJsEntry(name, projectRequire, platform);
|
|
398
|
+
}
|
|
399
|
+
export function packageHasCompiledJsEntry(name, projectRequire, platform) {
|
|
400
|
+
let pkgJsonPath;
|
|
401
|
+
try {
|
|
402
|
+
pkgJsonPath = projectRequire.resolve(`${name}/package.json`);
|
|
403
|
+
}
|
|
404
|
+
catch {
|
|
405
|
+
return false;
|
|
406
|
+
}
|
|
407
|
+
let pkg;
|
|
408
|
+
try {
|
|
409
|
+
pkg = JSON.parse(readFileSync(pkgJsonPath, 'utf-8'));
|
|
410
|
+
}
|
|
411
|
+
catch {
|
|
412
|
+
return false;
|
|
413
|
+
}
|
|
414
|
+
const pkgDir = path.dirname(pkgJsonPath);
|
|
415
|
+
const candidates = [];
|
|
416
|
+
const pushCandidate = (value) => {
|
|
417
|
+
if (typeof value === 'string' && value)
|
|
418
|
+
candidates.push(value);
|
|
419
|
+
};
|
|
420
|
+
pushCandidate(pkg.module);
|
|
421
|
+
pushCandidate(pkg.main);
|
|
422
|
+
// Recursively flatten conditional `exports` maps to surface concrete
|
|
423
|
+
// file paths. We only need `string` leaves; anything else (function-
|
|
424
|
+
// based exports, etc.) doesn't apply to esbuild's resolution.
|
|
425
|
+
const visitExports = (node) => {
|
|
426
|
+
if (!node)
|
|
427
|
+
return;
|
|
428
|
+
if (typeof node === 'string') {
|
|
429
|
+
pushCandidate(node);
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
if (Array.isArray(node)) {
|
|
433
|
+
for (const item of node)
|
|
434
|
+
visitExports(item);
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
if (typeof node === 'object') {
|
|
438
|
+
for (const value of Object.values(node))
|
|
439
|
+
visitExports(value);
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
visitExports(pkg.exports);
|
|
443
|
+
if (candidates.length === 0) {
|
|
444
|
+
// node's default lookup falls back to `index.js`.
|
|
445
|
+
candidates.push('index');
|
|
446
|
+
}
|
|
447
|
+
const extensionsToTry = compiledJsExtensionsForPlatform(platform);
|
|
448
|
+
for (const cand of candidates) {
|
|
449
|
+
const abs = path.resolve(pkgDir, cand);
|
|
450
|
+
const ext = path.extname(cand);
|
|
451
|
+
if (COMPILED_JS_ENTRY_REGEX.test(cand)) {
|
|
452
|
+
// Explicit JS extension. If the file exists, vendor it. If not
|
|
453
|
+
// (a NativeScript plugin commonly declares `main: "index.js"`
|
|
454
|
+
// but ships only platform variants like `index.ios.js`), try
|
|
455
|
+
// the platform-specific variants which esbuild's
|
|
456
|
+
// `resolveExtensions` will pick up at bundle time.
|
|
457
|
+
if (fs.existsSync(abs))
|
|
458
|
+
return true;
|
|
459
|
+
const baseAbs = abs.slice(0, -ext.length);
|
|
460
|
+
for (const e of extensionsToTry) {
|
|
461
|
+
if (fs.existsSync(baseAbs + e))
|
|
462
|
+
return true;
|
|
463
|
+
}
|
|
464
|
+
continue;
|
|
465
|
+
}
|
|
466
|
+
if (!ext) {
|
|
467
|
+
// Extensionless main — try plain JS variants AND the
|
|
468
|
+
// platform-specific variants NativeScript plugins commonly use
|
|
469
|
+
// (`index.ios.js`, `index.android.js`, `index.visionos.js`).
|
|
470
|
+
for (const e of extensionsToTry) {
|
|
471
|
+
if (fs.existsSync(abs + e))
|
|
472
|
+
return true;
|
|
473
|
+
}
|
|
474
|
+
continue;
|
|
475
|
+
}
|
|
476
|
+
// A non-JS extension (typically `.ts`/`.tsx`) means the package
|
|
477
|
+
// only ships TS source — esbuild's vendor pipeline can't resolve
|
|
478
|
+
// any tsconfig-aliased imports inside it.
|
|
479
|
+
}
|
|
480
|
+
return false;
|
|
481
|
+
}
|
|
482
|
+
function canResolveDependencyPackageJson(specifier, projectRequire) {
|
|
483
|
+
try {
|
|
484
|
+
projectRequire.resolve(`${specifier}/package.json`);
|
|
485
|
+
return true;
|
|
486
|
+
}
|
|
487
|
+
catch {
|
|
488
|
+
return false;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
function readDependencyPackageJson(specifier, projectRequire) {
|
|
492
|
+
try {
|
|
493
|
+
const packageJsonPath = projectRequire.resolve(`${specifier}/package.json`);
|
|
494
|
+
return JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
|
|
495
|
+
}
|
|
496
|
+
catch (error) {
|
|
497
|
+
if (process.env.VITE_DEBUG_LOGS) {
|
|
498
|
+
console.warn(`[vendor] unable to resolve ${specifier} package.json`, error);
|
|
499
|
+
}
|
|
500
|
+
return null;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
function parseEnvList(value) {
|
|
504
|
+
if (!value) {
|
|
505
|
+
return [];
|
|
506
|
+
}
|
|
507
|
+
return value
|
|
508
|
+
.split(',')
|
|
509
|
+
.map((token) => token.trim())
|
|
510
|
+
.filter(Boolean);
|
|
511
|
+
}
|
|
512
|
+
//# sourceMappingURL=manifest-collect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-collect.js","sourceRoot":"","sources":["../../../../../../packages/vite/hmr/shared/vendor/manifest-collect.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAQ5C,oEAAoE;AACpE,+EAA+E;AAC/E,qFAAqF;AACrF,6EAA6E;AAC7E,4EAA4E;AAC5E,uBAAuB;AACvB,MAAM,cAAc,GAAG,IAAI,GAAG,CAAS,CAAC,eAAe,CAAC,CAAC,CAAC;AAC1D,MAAM,cAAc,GAAG,IAAI,GAAG,CAAS;IACtC,uBAAuB;IACvB,mBAAmB;IACnB,qBAAqB;IACrB,uBAAuB;IACvB,6EAA6E;IAC7E,wEAAwE;IACxE,qBAAqB;IACrB,sCAAsC;IACtC,yEAAyE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
interface VendorManifestModuleEntry {
|
|
4
3
|
id: string;
|
|
5
4
|
exports: Record<string, boolean>;
|
|
@@ -16,9 +15,6 @@ interface VendorBundleResult {
|
|
|
16
15
|
manifest: VendorManifest;
|
|
17
16
|
entries: string[];
|
|
18
17
|
}
|
|
19
|
-
interface CollectedVendorModules {
|
|
20
|
-
entries: string[];
|
|
21
|
-
}
|
|
22
18
|
interface VendorManifestPluginOptions {
|
|
23
19
|
projectRoot: string;
|
|
24
20
|
platform: string;
|
|
@@ -36,37 +32,7 @@ export declare const SERVER_MANIFEST_PATH = "/@nativescript/vendor-manifest.json
|
|
|
36
32
|
export declare const DEFAULT_VENDOR_FILENAME = "ns-vendor.mjs";
|
|
37
33
|
export declare const DEFAULT_MANIFEST_FILENAME = "ns-vendor-manifest.json";
|
|
38
34
|
export declare function vendorManifestPlugin(options: VendorManifestPluginOptions): Plugin;
|
|
39
|
-
declare function collectVendorModules(projectRoot: string, platform: string, flavor?: string): CollectedVendorModules;
|
|
40
|
-
/**
|
|
41
|
-
* Determine whether a `package.json` dependency must be excluded from the
|
|
42
|
-
* HMR vendor bundle because esbuild's standalone vendor pipeline can't
|
|
43
|
-
* resolve its source.
|
|
44
|
-
*
|
|
45
|
-
* The HMR vendor bundle is generated by a standalone esbuild build that
|
|
46
|
-
* has none of the Vite plugin chain (most notably
|
|
47
|
-
* `ns-tsconfig-paths-resolver`), so any aliased import inside the
|
|
48
|
-
* package's **source** files will fail with "Could not resolve" and abort
|
|
49
|
-
* the whole bundle.
|
|
50
|
-
*
|
|
51
|
-
* Skip:
|
|
52
|
-
* - `link:` and `workspace:` refs (always app-side source).
|
|
53
|
-
* - `file:` refs to a directory whose installed package only ships
|
|
54
|
-
* TypeScript/JSX source (no compiled `.js`/`.mjs`/`.cjs` entry).
|
|
55
|
-
*
|
|
56
|
-
* Keep (return false):
|
|
57
|
-
* - Regular semver / git / url specs (normal third-party libraries).
|
|
58
|
-
* - Local `.tgz` file refs (pre-packaged libraries extracted at install).
|
|
59
|
-
* - `file:` directory refs that resolve to a package with a compiled JS
|
|
60
|
-
* entry — a common NativeScript monorepo convention where the app's
|
|
61
|
-
* `package.json` redirects to `../../node_modules/<name>` to avoid
|
|
62
|
-
* duplicate installs while letting the NativeScript CLI discover
|
|
63
|
-
* plugins from the app directory.
|
|
64
|
-
*/
|
|
65
|
-
export declare function isUnvendorableLocalSource(name: string, spec: unknown, projectRequire: ReturnType<typeof createRequire>, platform?: string): boolean;
|
|
66
|
-
declare function packageHasCompiledJsEntry(name: string, projectRequire: ReturnType<typeof createRequire>, platform?: string): boolean;
|
|
67
|
-
export declare const __test_collectVendorModules: typeof collectVendorModules;
|
|
68
35
|
export declare const __test_createVendorBundleRuntimeModule: typeof createVendorBundleRuntimeModule;
|
|
69
|
-
export
|
|
70
|
-
export declare const __test_packageHasCompiledJsEntry: typeof packageHasCompiledJsEntry;
|
|
36
|
+
export { collectVendorModules as __test_collectVendorModules, isUnvendorableLocalSource as __test_isUnvendorableLocalSource, packageHasCompiledJsEntry as __test_packageHasCompiledJsEntry } from './manifest-collect.js';
|
|
71
37
|
declare function createVendorBundleRuntimeModule(result: VendorBundleResult): string;
|
|
72
38
|
export type { VendorManifest, VendorManifestModuleEntry, VendorBundleResult };
|