@sparkelf/dsh-plus 0.2.8-alpha.50 → 0.2.9-alpha.101
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.i18n.yaml +2 -2
- package/README.md +1 -1
- package/README.zh.md +1 -1
- package/cordis.patch.yml +29 -7
- package/lib/{apply-DmICvIGh.js → apply-CvePS57c.js} +213 -43
- package/lib/{apply-08huHfLG.js → apply-DycMqLJO.js} +240 -53
- package/lib/apply-c_7SZFSh.js +1193 -0
- package/lib/apply.js +2 -2
- package/lib/bin.js +20 -319
- package/lib/types/apply.d.ts +14 -1
- package/lib/types/apply.js +275 -53
- package/lib/types/capabilities.js +25 -36
- package/lib/types/manifest.d.ts +24 -0
- package/lib/types/manifest.js +51 -0
- package/lib/types/profile.d.ts +1 -0
- package/lib/types/profile.js +14 -3
- package/package.json +531 -577
- package/patches/approval-allow-policy.patch +3 -3
- package/patches/atomic-write-zombie-lock-holder.patch +1 -1
- package/patches/bootstrap-exempt-names.patch +6 -6
- package/patches/composer-popover-boundaries.patch +41 -283
- package/patches/image-offload-hoist-replay.patch +34 -31
- package/patches/input-trigger-source-label.patch +63 -0
- package/patches/legacy-code-preset.patch +5 -5
- package/patches/llm-pi-ai-transport-truncation.patch +4 -4
- package/patches/mobile-journal-generation.patch +2 -2
- package/patches/office-preview-stable-load.patch +1 -1
- package/patches/officecli-deliverables.patch +2 -2
- package/patches/ptc-mcp-schema-types.patch +3 -3
- package/patches/responses-reasoning-status.patch +197 -48
- package/patches/session-controller-image-downgrade-and-tool-visibility.patch +16 -14
- package/patches/session-export-chinese.patch +11 -11
- package/patches/session-format-legacy-restart.patch +1 -1
- package/patches/sidebar-right-tab-menu.patch +119 -0
- package/patches/state-dot-brand-blue.patch +2 -2
- package/patches/ui-settings-compact-phone.patch +2 -9
- package/patches/ui-sidebar-right-global-panel.patch +3 -3
- package/patches/workspace-hide-group-rooms.patch +38 -0
- package/patches/workspace-storage-restore.patch +21 -5
- package/patches/wsl-native-open.patch +8 -8
- package/lib/apply-e0aMC4B4.js +0 -601
- package/lib/types/standalone-capabilities.d.ts +0 -139
- package/lib/types/standalone-capabilities.js +0 -688
- package/lib/types/standalone-cli.d.ts +0 -17
- package/lib/types/standalone-cli.js +0 -913
- package/lib/types/standalone-profile.d.ts +0 -258
- package/lib/types/standalone-profile.js +0 -747
- package/lib/types/standalone-server.d.ts +0 -70
- package/lib/types/standalone-server.js +0 -158
- package/patches/browser-auth-mode.patch +0 -127
- package/patches/diagram-preview.patch +0 -562
- package/patches/dsh-resource-ref-chip.patch +0 -40
- package/patches/session-envelope-ignorable.patch +0 -63
- package/patches/session-log-trajectory-toolbar.patch +0 -352
- package/patches/ui-schedule-plaza-tab.patch +0 -217
- package/patches/web-runtime-compat.patch +0 -83
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { spawnSync } from "node:child_process";
|
|
3
3
|
import { chmodSync, copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
|
|
4
|
-
import {
|
|
5
|
-
import { tmpdir } from "node:os";
|
|
4
|
+
import { dirname, isAbsolute, relative, resolve } from "node:path";
|
|
6
5
|
import { satisfies, valid, validRange } from "semver";
|
|
6
|
+
import { tmpdir } from "node:os";
|
|
7
7
|
import { parseDocument } from "yaml";
|
|
8
8
|
//#region lib/types/patch-set.js
|
|
9
9
|
/**
|
|
@@ -125,7 +125,7 @@ function readPatchSet(distributionDirectory, manifest) {
|
|
|
125
125
|
}
|
|
126
126
|
//#endregion
|
|
127
127
|
//#region lib/types/apply.js
|
|
128
|
-
/** Materialize the Plus distribution's
|
|
128
|
+
/** Materialize the Plus distribution's independent patch packages without Desktop. */
|
|
129
129
|
const FORMAT_VERSION = 1;
|
|
130
130
|
function isSelectedNpmPatch(patch) {
|
|
131
131
|
return patch.target.kind === "npm";
|
|
@@ -159,20 +159,37 @@ function requireStringArray(value, label) {
|
|
|
159
159
|
if (new Set(strings).size !== strings.length) throw new Error(label + " must not contain duplicates");
|
|
160
160
|
return strings;
|
|
161
161
|
}
|
|
162
|
-
|
|
162
|
+
/**
|
|
163
|
+
* Resolve one installed package's manifest directory.
|
|
164
|
+
*
|
|
165
|
+
* `require.resolve(name + '/package.json')` respects the package's `exports`
|
|
166
|
+
* map, so a dependency that publishes only `"."` — `@sparkelf/dsh-quant`
|
|
167
|
+
* 0.91.0-sparkelf.13 among the `personal` edition's packages — fails to
|
|
168
|
+
* resolve even though the package is installed. Reading a manifest is not a
|
|
169
|
+
* public-export lookup, so resolve the package entry and walk up to the
|
|
170
|
+
* manifest that names it.
|
|
171
|
+
* @param distributionDirectory - directory whose resolution anchors the lookup.
|
|
172
|
+
* @param packageName - dependency name to locate.
|
|
173
|
+
* @returns path of the `package.json` that declares `packageName`.
|
|
174
|
+
*/
|
|
175
|
+
function resolvePackageManifest(distributionDirectory, packageName) {
|
|
163
176
|
const requireFromDistribution = createRequire(resolve(distributionDirectory, "package.json"));
|
|
164
|
-
let manifestPath;
|
|
165
177
|
try {
|
|
166
|
-
|
|
167
|
-
} catch {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
178
|
+
return requireFromDistribution.resolve(packageName + "/package.json");
|
|
179
|
+
} catch {}
|
|
180
|
+
let directory = dirname(requireFromDistribution.resolve(packageName));
|
|
181
|
+
for (;;) {
|
|
182
|
+
const candidate = resolve(directory, "package.json");
|
|
183
|
+
if (existsSync(candidate)) {
|
|
184
|
+
if (JSON.parse(readFileSync(candidate, "utf8")).name === packageName) return candidate;
|
|
173
185
|
}
|
|
174
|
-
|
|
186
|
+
const parent = dirname(directory);
|
|
187
|
+
if (parent === directory) throw new Error(packageName + " is installed but no package.json naming it was found");
|
|
188
|
+
directory = parent;
|
|
175
189
|
}
|
|
190
|
+
}
|
|
191
|
+
function resolveInstalledPackage(distributionDirectory, packageName) {
|
|
192
|
+
const manifestPath = resolvePackageManifest(distributionDirectory, packageName);
|
|
176
193
|
const manifest = readJsonObject(manifestPath, packageName + " manifest");
|
|
177
194
|
return {
|
|
178
195
|
name: packageName,
|
|
@@ -181,6 +198,44 @@ function resolveInstalledPackage(distributionDirectory, packageName) {
|
|
|
181
198
|
manifest
|
|
182
199
|
};
|
|
183
200
|
}
|
|
201
|
+
function resolvePatchFile(packageDirectory, declared) {
|
|
202
|
+
const absoluteFile = resolve(packageDirectory, declared);
|
|
203
|
+
const local = relative(packageDirectory, absoluteFile);
|
|
204
|
+
if (isAbsolute(local) || local === ".." || local.startsWith("../")) throw new Error("patch file must stay inside its patch package: " + declared);
|
|
205
|
+
if (!existsSync(absoluteFile)) throw new Error("patch file does not exist: " + absoluteFile);
|
|
206
|
+
return {
|
|
207
|
+
relativeFile: local.replaceAll("\\", "/"),
|
|
208
|
+
absoluteFile
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function parseVariant(value, index, patchPackage) {
|
|
212
|
+
const label = patchPackage.name + " dshPatch.variants[" + String(index) + "]";
|
|
213
|
+
const variant = requireObject(value, label);
|
|
214
|
+
const target = requireObject(variant.target, label + ".target");
|
|
215
|
+
const kind = requireString(target.kind, label + ".target.kind");
|
|
216
|
+
const common = {
|
|
217
|
+
id: requireString(variant.id, label + ".id"),
|
|
218
|
+
dsh: requireRange(variant.dsh, label + ".dsh"),
|
|
219
|
+
file: requireString(variant.file, label + ".file"),
|
|
220
|
+
patchPackage
|
|
221
|
+
};
|
|
222
|
+
if (kind === "npm") return {
|
|
223
|
+
...common,
|
|
224
|
+
target: {
|
|
225
|
+
kind,
|
|
226
|
+
name: requireString(target.name, label + ".target.name"),
|
|
227
|
+
range: requireRange(target.range, label + ".target.range")
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
if (kind === "dsh-source") return {
|
|
231
|
+
...common,
|
|
232
|
+
target: {
|
|
233
|
+
kind,
|
|
234
|
+
baseRevision: requireString(target.baseRevision, label + ".target.baseRevision")
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
throw new Error("unsupported patch target kind: " + kind);
|
|
238
|
+
}
|
|
184
239
|
function git(root, args, acceptFailure = false) {
|
|
185
240
|
const result = spawnSync("git", args, {
|
|
186
241
|
cwd: root,
|
|
@@ -249,6 +304,73 @@ function requireSourceBase(root, baseRevision) {
|
|
|
249
304
|
if (checkoutRevision !== baseRevision) throw new Error("DSH checkout must be exact official base " + baseRevision + ", found " + checkoutRevision);
|
|
250
305
|
return checkoutRevision;
|
|
251
306
|
}
|
|
307
|
+
/**
|
|
308
|
+
* Names of distribution dependencies that carry `dshPatch` variants.
|
|
309
|
+
*
|
|
310
|
+
* `patchPackageVariants()` resolves these names from the Plus install tree, so they must be
|
|
311
|
+
* packages this distribution actually depends on. The current manifest declares `dshPlus.patchSet`
|
|
312
|
+
* instead of a flat list: only entries whose target is an npm package name a `dshPatch` carrier
|
|
313
|
+
* (`dsh-source` entries name the source packages being patched, which are never Plus dependencies).
|
|
314
|
+
* An older tarball may still carry the flat `dshPlus.patchPackages` list, which wins when present.
|
|
315
|
+
*
|
|
316
|
+
* @param plus - Parsed `dshPlus` block of the distribution manifest.
|
|
317
|
+
* @returns Patch-carrier package names; empty when the distribution ships only source patches.
|
|
318
|
+
*/
|
|
319
|
+
function resolvePatchPackageNames(plus) {
|
|
320
|
+
const declared = plus.patchPackages;
|
|
321
|
+
if (declared !== void 0) {
|
|
322
|
+
const names = requireStringArray(declared, "dshPlus.patchPackages");
|
|
323
|
+
if (names.length > 0) return names;
|
|
324
|
+
}
|
|
325
|
+
const entries = requireObject(plus.patchSet, "dshPlus.patchSet").entries;
|
|
326
|
+
if (!Array.isArray(entries)) throw new Error("dshPlus.patchSet.entries must be an array");
|
|
327
|
+
const names = /* @__PURE__ */ new Set();
|
|
328
|
+
for (const [index, value] of entries.entries()) {
|
|
329
|
+
const target = requireObject(requireObject(value, "dshPlus.patchSet.entries[" + String(index) + "]").target, "dshPlus.patchSet.entries[" + String(index) + "].target");
|
|
330
|
+
if (target.kind !== "npm") continue;
|
|
331
|
+
names.add(requireString(target.name, "dshPlus.patchSet.entries[" + String(index) + "].target.name"));
|
|
332
|
+
}
|
|
333
|
+
return [...names].sort();
|
|
334
|
+
}
|
|
335
|
+
function patchPackageVariants(distributionDirectory, names) {
|
|
336
|
+
const variants = [];
|
|
337
|
+
for (const name of names) {
|
|
338
|
+
const patchPackage = resolveInstalledPackage(distributionDirectory, name);
|
|
339
|
+
const declaration = requireObject(patchPackage.manifest.dshPatch, name + " dshPatch");
|
|
340
|
+
if (declaration.formatVersion !== FORMAT_VERSION) throw new Error("unsupported dshPatch formatVersion in " + name + ": " + String(declaration.formatVersion));
|
|
341
|
+
if (!Array.isArray(declaration.variants) || declaration.variants.length === 0) throw new Error(name + " dshPatch.variants must be a non-empty array");
|
|
342
|
+
for (const [index, value] of declaration.variants.entries()) variants.push(parseVariant(value, index, patchPackage));
|
|
343
|
+
}
|
|
344
|
+
return variants;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Build patch variants from the distribution's `dshPlus.patchSet`.
|
|
348
|
+
*
|
|
349
|
+
* The patch files live inside the Plus package (`./patches/*.patch`), so every variant points at
|
|
350
|
+
* the distribution itself as its patch package: `resolvePatchFile()` then resolves the declared
|
|
351
|
+
* path inside the tarball, and `materializePatchFiles()` copies it into the profile's stable
|
|
352
|
+
* patch directory. Unlike the retired `dshPatch` carrier packages, the source packages named in
|
|
353
|
+
* `target.packages` are never resolved from the Plus tree -- they are the packages being patched.
|
|
354
|
+
*
|
|
355
|
+
* @param distribution - Installed Plus distribution package.
|
|
356
|
+
*/
|
|
357
|
+
function patchSetVariants(distribution) {
|
|
358
|
+
const patchSet = readPatchSet(distribution.directory, distribution.manifest);
|
|
359
|
+
return [...patchSet.entries, ...patchSet.thirdPartyPatches].map((entry) => ({
|
|
360
|
+
id: entry.id,
|
|
361
|
+
dsh: entry.dsh,
|
|
362
|
+
file: entry.file,
|
|
363
|
+
patchPackage: distribution,
|
|
364
|
+
target: entry.target.kind === "npm" ? {
|
|
365
|
+
kind: "npm",
|
|
366
|
+
name: entry.target.name,
|
|
367
|
+
range: entry.target.range
|
|
368
|
+
} : {
|
|
369
|
+
kind: "dsh-source",
|
|
370
|
+
baseRevision: entry.target.baseRevision
|
|
371
|
+
}
|
|
372
|
+
}));
|
|
373
|
+
}
|
|
252
374
|
function prepareSelection(distributionDirectory, profileDirectory, dshRoot) {
|
|
253
375
|
const distributionManifest = readJsonObject(resolve(distributionDirectory, "package.json"), "Plus distribution manifest");
|
|
254
376
|
const distributionName = requireString(distributionManifest.name, "Plus distribution name");
|
|
@@ -268,18 +390,29 @@ function prepareSelection(distributionDirectory, profileDirectory, dshRoot) {
|
|
|
268
390
|
if (typeof allowed !== "boolean") throw new Error("dshPlus.profile.allowBuilds." + name + " must be a boolean");
|
|
269
391
|
allowBuilds[name] = allowed;
|
|
270
392
|
}
|
|
271
|
-
const
|
|
393
|
+
const patchPackageNames = resolvePatchPackageNames(plus);
|
|
272
394
|
const dependencies = requireObject(distributionManifest.dependencies, "Plus distribution dependencies");
|
|
273
395
|
const dshVersion = requireVersion(readJsonObject(resolve(dshRoot, "package.json"), "DSH source manifest").version, "DSH source version");
|
|
274
396
|
if (!satisfies(dshVersion, dshRange, { includePrerelease: true })) throw new Error(distributionName + "@" + distributionVersion + " requires DSH " + dshRange + ", found " + dshVersion);
|
|
275
|
-
const checkoutRevision = requireSourceBase(dshRoot,
|
|
276
|
-
const
|
|
397
|
+
const checkoutRevision = requireSourceBase(dshRoot, baseRevision);
|
|
398
|
+
const variants = plus.patchPackages === void 0 ? patchSetVariants({
|
|
399
|
+
name: distributionName,
|
|
400
|
+
version: distributionVersion,
|
|
401
|
+
directory: distributionDirectory,
|
|
402
|
+
manifest: distributionManifest
|
|
403
|
+
}) : patchPackageVariants(distributionDirectory, patchPackageNames);
|
|
404
|
+
const groups = /* @__PURE__ */ new Map();
|
|
405
|
+
for (const variant of variants) {
|
|
406
|
+
const entries = groups.get(variant.id) ?? [];
|
|
407
|
+
entries.push(variant);
|
|
408
|
+
groups.set(variant.id, entries);
|
|
409
|
+
}
|
|
277
410
|
const sourceStates = /* @__PURE__ */ new Map();
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
if (
|
|
281
|
-
const
|
|
282
|
-
sourceStates.set(absoluteFile, sourcePatchState(dshRoot, absoluteFile));
|
|
411
|
+
const orderedGroups = [...groups].sort(([left], [right]) => left.localeCompare(right));
|
|
412
|
+
for (const [, variants] of orderedGroups) for (const variant of variants) {
|
|
413
|
+
if (variant.target.kind !== "dsh-source" || variant.target.baseRevision !== baseRevision || !satisfies(dshVersion, variant.dsh, { includePrerelease: true })) continue;
|
|
414
|
+
const file = resolvePatchFile(variant.patchPackage.directory, variant.file);
|
|
415
|
+
sourceStates.set(file.absoluteFile, sourcePatchState(dshRoot, file.absoluteFile));
|
|
283
416
|
}
|
|
284
417
|
preflightSourcePatches(dshRoot, [...sourceStates].flatMap(([file, state]) => state === "pending" ? [file] : []));
|
|
285
418
|
writeProfileRequirements(profileDirectory, profileDependencySpecs, allowBuilds);
|
|
@@ -290,42 +423,55 @@ function prepareSelection(distributionDirectory, profileDirectory, dshRoot) {
|
|
|
290
423
|
version: resolveInstalledPackage(profileDirectory, name).version
|
|
291
424
|
};
|
|
292
425
|
});
|
|
293
|
-
const runtimePackages = [...Object.keys(dependencies).sort().map((name) => {
|
|
426
|
+
const runtimePackages = [...Object.keys(dependencies).filter((name) => !patchPackageNames.includes(name)).sort().map((name) => {
|
|
294
427
|
return {
|
|
295
428
|
name,
|
|
296
429
|
version: resolveInstalledPackage(distributionDirectory, name).version
|
|
297
430
|
};
|
|
298
431
|
}), ...profileDependencies].sort((left, right) => left.name.localeCompare(right.name));
|
|
299
432
|
const selected = [];
|
|
300
|
-
for (const
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
scope: item.scope,
|
|
321
|
-
file: item.file,
|
|
322
|
-
absoluteFile,
|
|
323
|
-
target: {
|
|
324
|
-
kind: "npm",
|
|
325
|
-
name: item.target.name,
|
|
326
|
-
version: targetVersion
|
|
433
|
+
for (const [id, variants] of orderedGroups) {
|
|
434
|
+
const candidates = variants.flatMap((variant) => {
|
|
435
|
+
if (!satisfies(dshVersion, variant.dsh, { includePrerelease: true })) return [];
|
|
436
|
+
const file = resolvePatchFile(variant.patchPackage.directory, variant.file);
|
|
437
|
+
if (variant.target.kind === "dsh-source") {
|
|
438
|
+
if (variant.target.baseRevision !== baseRevision) return [];
|
|
439
|
+
return [{
|
|
440
|
+
id,
|
|
441
|
+
patchPackage: {
|
|
442
|
+
name: variant.patchPackage.name,
|
|
443
|
+
version: variant.patchPackage.version
|
|
444
|
+
},
|
|
445
|
+
file: file.relativeFile,
|
|
446
|
+
absoluteFile: file.absoluteFile,
|
|
447
|
+
target: {
|
|
448
|
+
kind: "dsh-source",
|
|
449
|
+
baseRevision
|
|
450
|
+
},
|
|
451
|
+
alreadyApplied: sourceStates.get(file.absoluteFile) === "applied"
|
|
452
|
+
}];
|
|
327
453
|
}
|
|
454
|
+
const targetVersion = resolveInstalledPackage(variant.target.name in profileDependencySpecs ? profileDirectory : distributionDirectory, variant.target.name).version;
|
|
455
|
+
if (!satisfies(targetVersion, variant.target.range, { includePrerelease: true })) return [];
|
|
456
|
+
return [{
|
|
457
|
+
id,
|
|
458
|
+
patchPackage: {
|
|
459
|
+
name: variant.patchPackage.name,
|
|
460
|
+
version: variant.patchPackage.version
|
|
461
|
+
},
|
|
462
|
+
file: file.relativeFile,
|
|
463
|
+
absoluteFile: file.absoluteFile,
|
|
464
|
+
target: {
|
|
465
|
+
kind: "npm",
|
|
466
|
+
name: variant.target.name,
|
|
467
|
+
version: targetVersion
|
|
468
|
+
}
|
|
469
|
+
}];
|
|
328
470
|
});
|
|
471
|
+
const [candidate] = candidates;
|
|
472
|
+
if (candidate === void 0) throw new Error("no compatible patch variant for " + id + " on DSH " + dshVersion);
|
|
473
|
+
if (candidates.length > 1) throw new Error("multiple compatible patch variants for " + id + " on DSH " + dshVersion);
|
|
474
|
+
selected.push(candidate);
|
|
329
475
|
}
|
|
330
476
|
const lockPatches = selected.map((patch) => {
|
|
331
477
|
if ("alreadyApplied" in patch) {
|
|
@@ -365,7 +511,7 @@ function materializePatchFiles(profileDirectory, patches) {
|
|
|
365
511
|
force: true
|
|
366
512
|
});
|
|
367
513
|
const stablePatches = patches.map((patch) => {
|
|
368
|
-
const destination = resolve(root, patch.
|
|
514
|
+
const destination = resolve(root, patch.patchPackage.name, patch.patchPackage.version, patch.file);
|
|
369
515
|
mkdirSync(dirname(destination), { recursive: true });
|
|
370
516
|
copyFileSync(patch.absoluteFile, destination);
|
|
371
517
|
return {
|
|
@@ -388,7 +534,7 @@ function materializePatchFiles(profileDirectory, patches) {
|
|
|
388
534
|
npmPatchFiles.set(key, first.absoluteFile);
|
|
389
535
|
continue;
|
|
390
536
|
}
|
|
391
|
-
const members = group.map((patch) => encodeURIComponent(patch.id)).join("+");
|
|
537
|
+
const members = group.map((patch) => encodeURIComponent(patch.id + "@" + patch.patchPackage.version)).join("+");
|
|
392
538
|
const destination = resolve(root, "combined", encodeURIComponent(key), members + ".patch");
|
|
393
539
|
mkdirSync(dirname(destination), { recursive: true });
|
|
394
540
|
writeFileSync(destination, group.map((patch) => {
|
|
@@ -427,6 +573,46 @@ function profilePatchConfiguration(profileDirectory, npmPatchFiles) {
|
|
|
427
573
|
changed
|
|
428
574
|
};
|
|
429
575
|
}
|
|
576
|
+
/**
|
|
577
|
+
* Profile-local pnpm hook that keeps the CDN-only xlsx dependency installable.
|
|
578
|
+
*
|
|
579
|
+
* `@deepseek-ai/dsh-client-ui-sidebar-documentpreview` declares `xlsx` as
|
|
580
|
+
* `https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz`. SheetJS stopped publishing to npm
|
|
581
|
+
* after 0.18.5, so no registry mirror carries 0.20.3, and the build network cannot reach that
|
|
582
|
+
* CDN (measured 2026-11-06: every request times out). The image vendors the tarball at
|
|
583
|
+
* /opt/dsh-vendor; this hook rewrites the spec wherever it appears so a cold profile install
|
|
584
|
+
* never requests the CDN.
|
|
585
|
+
*
|
|
586
|
+
* Written into the profile root rather than a template: the Plus bundle has no profile
|
|
587
|
+
* template directory, the profile manifest and pnpm-workspace.yaml are generated here.
|
|
588
|
+
*/
|
|
589
|
+
const PROFILE_PNPMFILE = `// Generated by @sparkelf/dsh-plus -- do not edit; rewritten on every apply.
|
|
590
|
+
const VENDORED_XLSX = '/opt/dsh-vendor/xlsx-0.20.3.tgz'
|
|
591
|
+
const CDN_XLSX = /^https?:\\/\\/cdn\\.sheetjs\\.com\\//
|
|
592
|
+
const FIELDS = ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies']
|
|
593
|
+
|
|
594
|
+
module.exports = {
|
|
595
|
+
hooks: {
|
|
596
|
+
readPackage(pkg) {
|
|
597
|
+
for (const field of FIELDS) {
|
|
598
|
+
const deps = pkg && pkg[field]
|
|
599
|
+
if (deps && typeof deps.xlsx === 'string' && CDN_XLSX.test(deps.xlsx)) {
|
|
600
|
+
deps.xlsx = 'file:' + VENDORED_XLSX
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
return pkg
|
|
604
|
+
},
|
|
605
|
+
},
|
|
606
|
+
}
|
|
607
|
+
`;
|
|
608
|
+
/** Write the profile pnpmfile when its content changed; returns whether it wrote. */
|
|
609
|
+
function writeProfilePnpmfile(profileDirectory) {
|
|
610
|
+
const path = resolve(profileDirectory, ".pnpmfile.cjs");
|
|
611
|
+
if ((existsSync(path) ? readFileSync(path, "utf8") : void 0) === PROFILE_PNPMFILE) return false;
|
|
612
|
+
writeFileSync(path, PROFILE_PNPMFILE);
|
|
613
|
+
console.log("profile pnpmfile: xlsx -> /opt/dsh-vendor/xlsx-0.20.3.tgz");
|
|
614
|
+
return true;
|
|
615
|
+
}
|
|
430
616
|
function writeProfileRequirements(profileDirectory, dependencySpecs, allowBuilds) {
|
|
431
617
|
const manifestPath = resolve(profileDirectory, "package.json");
|
|
432
618
|
const manifest = readJsonObject(manifestPath, "DSH profile manifest");
|
|
@@ -477,7 +663,8 @@ function writeProfileRequirements(profileDirectory, dependencySpecs, allowBuilds
|
|
|
477
663
|
writeFileSync(manifestPath, JSON.stringify(manifest, void 0, 2) + "\n");
|
|
478
664
|
}
|
|
479
665
|
if (workspaceChanged) writeFileSync(workspacePath, String(document));
|
|
480
|
-
|
|
666
|
+
const pnpmfileChanged = writeProfilePnpmfile(profileDirectory);
|
|
667
|
+
return manifestChanged || workspaceChanged || pnpmfileChanged;
|
|
481
668
|
}
|
|
482
669
|
function writeProfileComposition(profileDirectory, bundles, runtimePackages) {
|
|
483
670
|
const path = resolve(profileDirectory, "package.json");
|
|
@@ -662,4 +849,4 @@ function runApply(argv) {
|
|
|
662
849
|
process.stdout.write("[dsh-plus] applied " + String(selection.patches.length) + " patches; lock " + lock + "\n");
|
|
663
850
|
}
|
|
664
851
|
//#endregion
|
|
665
|
-
export { readPatchSet as i, parseOfficialWorkspacePackages as n,
|
|
852
|
+
export { readPatchSet as a, runApply as i, parseOfficialWorkspacePackages as n, resolvePatchPackageNames as r, materializeOfficialPackageScope as t };
|