@sparkelf/dsh-plus 0.1.0-rc.36 → 0.1.0-rc.37

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/lib/bin.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { r as runApply } from "./apply-e0aMC4B4.js";
3
3
  import { createRequire } from "node:module";
4
4
  import { execFileSync, spawn, spawnSync } from "node:child_process";
5
- import { createWriteStream, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
5
+ import { createWriteStream, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
6
6
  import { dirname, join, posix, resolve, win32 } from "node:path";
7
7
  import { homedir } from "node:os";
8
8
  import semver from "semver";
@@ -364,8 +364,43 @@ function installProfilePackages(paths, consumerDirectory) {
364
364
  return;
365
365
  }
366
366
  runPnpm(paths.profileDirectory, ["install", "--no-frozen-lockfile"], "pnpm install in the plus profile");
367
+ alignReplacedPackageNames(profileModules);
367
368
  linkNestedBundles(paths, profileModules);
368
369
  }
370
+ /**
371
+ * Make each replaced package declare the name of the location it occupies.
372
+ *
373
+ * \`overrides\` installs our build at the official path, but the manifest inside still
374
+ * names our scope. The client module system resolves a loader entry's declared name and
375
+ * then requires the manifest it finds to declare that same name
376
+ * (\`client/modules\`: \`name === expectedPackageName\`); a mismatch makes the package own no
377
+ * browser module at all. The symptom is silent — the packages install, the server starts,
378
+ * and the panels those packages render simply never appear.
379
+ *
380
+ * The rewrite replaces the file rather than writing through it: pnpm hard-links a package
381
+ * manifest into its content-addressed store, so an in-place write would edit every
382
+ * profile sharing that store entry.
383
+ *
384
+ * @param profileModules - the profile's \`node_modules\` directory.
385
+ */
386
+ function alignReplacedPackageNames(profileModules) {
387
+ const scoped = join(profileModules, "@deepseek-ai");
388
+ if (!existsSync(scoped)) return;
389
+ for (const entry of readdirSync(scoped)) {
390
+ const manifestPath = join(scoped, entry, "package.json");
391
+ if (!existsSync(manifestPath)) continue;
392
+ const declared = JSON.parse(readFileSync(manifestPath, "utf8"));
393
+ const expected = "@deepseek-ai/" + entry;
394
+ if (declared.name === expected) continue;
395
+ const replaced = {
396
+ ...declared,
397
+ name: expected
398
+ };
399
+ const temporary = manifestPath + ".dsh-name";
400
+ writeFileSync(temporary, JSON.stringify(replaced, null, 2) + "\n");
401
+ renameSync(temporary, manifestPath);
402
+ }
403
+ }
369
404
  /** Run pnpm in one directory, inheriting its output. */
370
405
  function runPnpm(cwd, args, label) {
371
406
  const result = spawnSync(process.platform === "win32" ? "pnpm.cmd" : "pnpm", [...args], {
@@ -77,6 +77,23 @@ export declare function readDistributionProfile(distributionDirectory: string):
77
77
  * @param consumerDirectory - directory whose `node_modules` holds the installation.
78
78
  */
79
79
  export declare function installProfilePackages(paths: StandalonePaths, consumerDirectory: string): void;
80
+ /**
81
+ * Make each replaced package declare the name of the location it occupies.
82
+ *
83
+ * \`overrides\` installs our build at the official path, but the manifest inside still
84
+ * names our scope. The client module system resolves a loader entry's declared name and
85
+ * then requires the manifest it finds to declare that same name
86
+ * (\`client/modules\`: \`name === expectedPackageName\`); a mismatch makes the package own no
87
+ * browser module at all. The symptom is silent — the packages install, the server starts,
88
+ * and the panels those packages render simply never appear.
89
+ *
90
+ * The rewrite replaces the file rather than writing through it: pnpm hard-links a package
91
+ * manifest into its content-addressed store, so an in-place write would edit every
92
+ * profile sharing that store entry.
93
+ *
94
+ * @param profileModules - the profile's \`node_modules\` directory.
95
+ */
96
+ export declare function alignReplacedPackageNames(profileModules: string): void;
80
97
  /** Resolve every path a command needs, without creating anything. */
81
98
  export declare function resolvePaths(anchor: string, env?: NodeJS.ProcessEnv): StandalonePaths;
82
99
  /**
@@ -9,7 +9,7 @@
9
9
  * bundle's own list.
10
10
  */
11
11
  import { spawnSync } from 'node:child_process';
12
- import { existsSync, mkdirSync, readdirSync, readFileSync, symlinkSync, writeFileSync } from 'node:fs';
12
+ import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, symlinkSync, writeFileSync } from 'node:fs';
13
13
  import { createRequire } from 'node:module';
14
14
  import { homedir } from 'node:os';
15
15
  import { dirname, join, posix, resolve, win32 } from 'node:path';
@@ -160,8 +160,43 @@ export function installProfilePackages(paths, consumerDirectory) {
160
160
  return;
161
161
  }
162
162
  runPnpm(paths.profileDirectory, ['install', '--no-frozen-lockfile'], 'pnpm install in the plus profile');
163
+ alignReplacedPackageNames(profileModules);
163
164
  linkNestedBundles(paths, profileModules);
164
165
  }
166
+ /**
167
+ * Make each replaced package declare the name of the location it occupies.
168
+ *
169
+ * \`overrides\` installs our build at the official path, but the manifest inside still
170
+ * names our scope. The client module system resolves a loader entry's declared name and
171
+ * then requires the manifest it finds to declare that same name
172
+ * (\`client/modules\`: \`name === expectedPackageName\`); a mismatch makes the package own no
173
+ * browser module at all. The symptom is silent — the packages install, the server starts,
174
+ * and the panels those packages render simply never appear.
175
+ *
176
+ * The rewrite replaces the file rather than writing through it: pnpm hard-links a package
177
+ * manifest into its content-addressed store, so an in-place write would edit every
178
+ * profile sharing that store entry.
179
+ *
180
+ * @param profileModules - the profile's \`node_modules\` directory.
181
+ */
182
+ export function alignReplacedPackageNames(profileModules) {
183
+ const scoped = join(profileModules, '@deepseek-ai');
184
+ if (!existsSync(scoped))
185
+ return;
186
+ for (const entry of readdirSync(scoped)) {
187
+ const manifestPath = join(scoped, entry, 'package.json');
188
+ if (!existsSync(manifestPath))
189
+ continue;
190
+ const declared = JSON.parse(readFileSync(manifestPath, 'utf8'));
191
+ const expected = '@deepseek-ai/' + entry;
192
+ if (declared.name === expected)
193
+ continue;
194
+ const replaced = { ...declared, name: expected };
195
+ const temporary = manifestPath + '.dsh-name';
196
+ writeFileSync(temporary, JSON.stringify(replaced, null, 2) + '\n');
197
+ renameSync(temporary, manifestPath);
198
+ }
199
+ }
165
200
  /** Run pnpm in one directory, inheriting its output. */
166
201
  function runPnpm(cwd, args, label) {
167
202
  const command = process.platform === 'win32' ? 'pnpm.cmd' : 'pnpm';
package/package.json CHANGED
@@ -166,5 +166,5 @@
166
166
  },
167
167
  "type": "module",
168
168
  "types": "lib/types/index.d.ts",
169
- "version": "0.1.0-rc.36"
169
+ "version": "0.1.0-rc.37"
170
170
  }