@octane-xplat/patches 0.9.0 → 0.10.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/package.json +1 -1
- package/patches/@lexical__link@0.51.0.patch +29 -0
- package/patches/@nativescript-community__octane@0.2.4.patch +25 -0
- package/patches/@nativescript__core@9.1.3-next.2.patch +1196 -0
- package/patches/@nativescript__vite@8.0.17.patch +135 -1
- package/patches/octane@0.6.3.patch +418 -26
|
@@ -172,8 +172,127 @@ index 4a6575cb00a6aeecbbb7ac5ccac3268cb10d7f54..dc70055007e26117b76fbb9d2f4f17fa
|
|
|
172
172
|
}
|
|
173
173
|
// Vite 8 oxc runtime helpers (decorators etc.) — emitted as
|
|
174
174
|
// `/@id/__x00__@oxc-project+runtime@<ver>/helpers/<name>.js`. These are
|
|
175
|
+
diff --git a/hmr/server/websocket-module-specifiers.js b/hmr/server/websocket-module-specifiers.js
|
|
176
|
+
index 74f50a77f48f3873aebf375a29d06b16c29440a3..cc196fb6b92d48179bf8e124ba2a2aa9b13796f9 100644
|
|
177
|
+
--- a/hmr/server/websocket-module-specifiers.js
|
|
178
|
+
+++ b/hmr/server/websocket-module-specifiers.js
|
|
179
|
+
@@ -1,4 +1,4 @@
|
|
180
|
+
-import { existsSync, readdirSync, readFileSync, realpathSync } from 'fs';
|
|
181
|
+
+import { existsSync, readdirSync, readFileSync, realpathSync, statSync } from 'fs';
|
|
182
|
+
import * as path from 'path';
|
|
183
|
+
import * as PAT from './constants.js';
|
|
184
|
+
import { getVendorManifest, resolveVendorSpecifier } from '../shared/vendor/registry.js';
|
|
185
|
+
@@ -328,6 +328,60 @@ export function resolveVendorFromCandidate(specifier) {
|
|
186
|
+
}
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
+const depFallbackDirsCache = new Map();
|
|
190
|
+
+/**
|
|
191
|
+
+ * `node_modules` dirs reachable through the app's dependency specs rather than
|
|
192
|
+
+ * its workspace layout — consulted when neither the project root nor the
|
|
193
|
+
+ * workspace root can anchor a served `/node_modules/` tail:
|
|
194
|
+
+ * - `link:`/`file:`/`portal:` deps keep their own `node_modules` at the real
|
|
195
|
+
+ * target; a linked package's transitive deps never reach the app's store.
|
|
196
|
+
+ * - pnpm's isolated virtual store keeps every non-hoisted package under
|
|
197
|
+
+ * `node_modules/.pnpm/<name>@<ver>/node_modules/`.
|
|
198
|
+
+ * Importer info is gone from the URL — first hit wins, same as the workspace
|
|
199
|
+
+ * scan above. Cached per project root; the set only changes on install.
|
|
200
|
+
+ */
|
|
201
|
+
+function listDepFallbackDirs(projectRoot) {
|
|
202
|
+
+ const cached = depFallbackDirsCache.get(projectRoot);
|
|
203
|
+
+ if (cached) {
|
|
204
|
+
+ return cached;
|
|
205
|
+
+ }
|
|
206
|
+
+ const dirs = [];
|
|
207
|
+
+ const pushIfPresent = (dir) => {
|
|
208
|
+
+ if (existsSync(dir))
|
|
209
|
+
+ dirs.push(dir);
|
|
210
|
+
+ };
|
|
211
|
+
+ const pnpmStore = path.join(projectRoot, 'node_modules', '.pnpm');
|
|
212
|
+
+ try {
|
|
213
|
+
+ for (const entry of readdirSync(pnpmStore, { withFileTypes: true })) {
|
|
214
|
+
+ if (entry.isDirectory() && !entry.name.startsWith('.')) {
|
|
215
|
+
+ pushIfPresent(path.join(pnpmStore, entry.name, 'node_modules'));
|
|
216
|
+
+ }
|
|
217
|
+
+ }
|
|
218
|
+
+ }
|
|
219
|
+
+ catch {
|
|
220
|
+
+ }
|
|
221
|
+
+ try {
|
|
222
|
+
+ const pkg = JSON.parse(readFileSync(path.join(projectRoot, 'package.json'), 'utf8'));
|
|
223
|
+
+ for (const section of ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies']) {
|
|
224
|
+
+ for (const spec of Object.values(pkg[section] ?? {})) {
|
|
225
|
+
+ const target = /^(?:link|file|portal):(.+)$/.exec(String(spec))?.[1];
|
|
226
|
+
+ if (!target)
|
|
227
|
+
+ continue;
|
|
228
|
+
+ try {
|
|
229
|
+
+ const depDir = realpathSync(path.resolve(projectRoot, target));
|
|
230
|
+
+ if (statSync(depDir).isDirectory())
|
|
231
|
+
+ pushIfPresent(path.join(depDir, 'node_modules'));
|
|
232
|
+
+ }
|
|
233
|
+
+ catch {
|
|
234
|
+
+ }
|
|
235
|
+
+ }
|
|
236
|
+
+ }
|
|
237
|
+
+ }
|
|
238
|
+
+ catch {
|
|
239
|
+
+ }
|
|
240
|
+
+ depFallbackDirsCache.set(projectRoot, dirs);
|
|
241
|
+
+ return dirs;
|
|
242
|
+
+}
|
|
243
|
+
const workspaceNodeModulesDirsCache = new Map();
|
|
244
|
+
/**
|
|
245
|
+
* `node_modules` dirs that can hold a package the served URL no longer
|
|
246
|
+
@@ -428,6 +482,16 @@ export function resolveCandidateFilePath(candidate, projectRoot, workspaceRoot)
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
+ // Deps reachable only through the app's dependency specs — linked-package
|
|
251
|
+
+ // node_modules, pnpm's virtual store — still resolve to real files.
|
|
252
|
+
+ if (cleaned.includes('/node_modules/')) {
|
|
253
|
+
+ const tail = cleaned.slice(cleaned.lastIndexOf('/node_modules/') + '/node_modules/'.length);
|
|
254
|
+
+ for (const nmDir of listDepFallbackDirs(projectRoot)) {
|
|
255
|
+
+ const absPath = path.resolve(nmDir, tail);
|
|
256
|
+
+ if (absPath.startsWith(nmDir + path.sep) && existsSync(absPath))
|
|
257
|
+
+ return absPath;
|
|
258
|
+
+ }
|
|
259
|
+
+ }
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
@@ -557,22 +621,17 @@ export function filterExistingNodeModulesTransformCandidates(spec, candidates, p
|
|
264
|
+
// through to the existing project/workspace logic.
|
|
265
|
+
}
|
|
266
|
+
if (mapped === null) {
|
|
267
|
+
- if (!hasDistinctWorkspaceRoot) {
|
|
268
|
+
+ const relFromProject = path.relative(resolvedProjectRoot, resolved);
|
|
269
|
+
+ const insideProjectRoot = relFromProject !== '' && !relFromProject.startsWith('..') && !path.isAbsolute(relFromProject);
|
|
270
|
+
+ if (insideProjectRoot) {
|
|
271
|
+
mapped = candidate;
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
- const relFromProject = path.relative(resolvedProjectRoot, resolved);
|
|
275
|
+
- const insideProjectRoot = relFromProject !== '' && !relFromProject.startsWith('..') && !path.isAbsolute(relFromProject);
|
|
276
|
+
- if (insideProjectRoot) {
|
|
277
|
+
- mapped = candidate;
|
|
278
|
+
- }
|
|
279
|
+
- else {
|
|
280
|
+
- // Hoisted `node_modules/<pkg>/...` file lives above projectRoot.
|
|
281
|
+
- // Rewrite the URL to its fs-anchored form so Vite reads it directly
|
|
282
|
+
- // instead of bouncing through bare-specifier resolution that the
|
|
283
|
+
- // hoisted package's `exports` field may refuse.
|
|
284
|
+
- mapped = `/@fs${resolved.replace(/\\/g, '/')}${querySuffix}`;
|
|
285
|
+
- }
|
|
286
|
+
+ // File resolves outside the project root — hoisted workspace
|
|
287
|
+
+ // node_modules, pnpm's `.pnpm` store, or a link:/file:/portal:
|
|
288
|
+
+ // dep's own node_modules. Serve the fs-anchored URL so Vite
|
|
289
|
+
+ // reads it directly; the root-relative URL would miss.
|
|
290
|
+
+ mapped = `/@fs${resolved.replace(/\\/g, '/')}${querySuffix}`;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
if (seen.has(mapped))
|
|
175
294
|
diff --git a/hmr/server/websocket-ns-m-request.js b/hmr/server/websocket-ns-m-request.js
|
|
176
|
-
index a11fbd5d24579cdf572a91f70cb06561bfa43cd0..
|
|
295
|
+
index a11fbd5d24579cdf572a91f70cb06561bfa43cd0..c887334efce2c2f6cf85c7508276109467ff3737 100644
|
|
177
296
|
--- a/hmr/server/websocket-ns-m-request.js
|
|
178
297
|
+++ b/hmr/server/websocket-ns-m-request.js
|
|
179
298
|
@@ -27,10 +27,15 @@ const MODULE_CANDIDATE_EXTS = ['ts', 'js', 'tsx', 'jsx', 'mjs', 'mts', 'cts', 'v
|
|
@@ -194,6 +313,21 @@ index a11fbd5d24579cdf572a91f70cb06561bfa43cd0..75906db5f3c2cb552b947388a21d2991
|
|
|
194
313
|
}
|
|
195
314
|
candidates.push(...MODULE_CANDIDATE_EXTS.map((ext) => `${base}.${ext}`));
|
|
196
315
|
}
|
|
316
|
+
@@ -149,8 +154,12 @@ export function resolveFsAnchoredSpec(spec, serverRoot, workspaceRoot) {
|
|
317
|
+
for (const root of roots) {
|
|
318
|
+
const rootPosix = root.replace(/\\/g, '/').replace(/\/$/, '');
|
|
319
|
+
const fsId = `/@fs${rootPosix}${spec.startsWith('/') ? '' : '/'}${spec}`;
|
|
320
|
+
- if (resolveCandidateFilePath(fsId, serverRoot, workspaceRoot)) {
|
|
321
|
+
- return fsId;
|
|
322
|
+
+ // The fs id is a guess composed under a root — serve the path the
|
|
323
|
+
+ // resolver actually found (it may live in a dep's own node_modules,
|
|
324
|
+
+ // outside both roots).
|
|
325
|
+
+ const resolved = resolveCandidateFilePath(fsId, serverRoot, workspaceRoot);
|
|
326
|
+
+ if (resolved) {
|
|
327
|
+
+ return `/@fs${resolved.replace(/\\/g, '/')}`;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
return null;
|
|
197
331
|
diff --git a/hmr/server/websocket-served-module-helpers.js b/hmr/server/websocket-served-module-helpers.js
|
|
198
332
|
index b9e3ab67eb4ae7c9b12bc4b02b9aa3660d712644..f857f4a5a5956af229e447ed04bf1a52a90c6399 100644
|
|
199
333
|
--- a/hmr/server/websocket-served-module-helpers.js
|