@downdraft/cli 0.4.0 → 0.4.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@downdraft/cli",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/knackstedt/downdraft.git",
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "@aws-sdk/client-s3": "^3.700.0",
15
- "@downdraft/engine": "^0.4.0",
15
+ "@downdraft/engine": "^0.4.2",
16
16
  "eta": "^3.5.0",
17
17
  "jimp": "^1.6.1",
18
18
  "resedit": "3.1.0"
@@ -937,9 +937,9 @@ if (formats.includes("rpm")) {
937
937
  }
938
938
  const stage = mkdtempSync(join(tmpdir(), "dd-rpm-"));
939
939
  const topdir = join(stage, "rpmbuild");
940
- for (const d of ["BUILD", "RPMS", "SOURCES", "SPECS"]) {
940
+ ["BUILD", "RPMS", "SOURCES", "SPECS"].forEach((d) => {
941
941
  mkdirSync(join(topdir, d), { recursive: true });
942
- }
942
+ });
943
943
 
944
944
  // rpm versions can't contain "-" — "~" is rpm's "sorts before" marker,
945
945
  // so 1.2.3-beta.1 → 1.2.3~beta.1 still orders below the final release.
@@ -98,6 +98,11 @@ if (targetArg && !TARGETS[targetArg]) {
98
98
  process.exit(1);
99
99
  }
100
100
  const target = targetArg ? TARGETS[targetArg] : { plat: hostKey, bun: undefined, exe: process.platform === "win32" };
101
+ // Compiled-binary module FS mount differs by platform: POSIX targets report
102
+ // /$bunfs/root, Windows reports B:\~BUN\root — POSIX /$bunfs specifiers get
103
+ // drive-letter-normalized (Z:\$bunfs under wine, C:\$bunfs on real Windows)
104
+ // and miss the embedded FS entirely.
105
+ const isWin = target.plat.startsWith("win32");
101
106
  let outfile = outfileArg;
102
107
  if (target.exe && !outfile.endsWith(".exe")) outfile += ".exe";
103
108
 
@@ -141,7 +146,12 @@ function resolveSpec(spec, importer) {
141
146
 
142
147
  /** repo-rel path of a module file as embedded in the binary (.js suffix). */
143
148
  function bunfsPath(absPath) {
144
- return `/$bunfs/root/${relative(repoRoot, absPath).replace(/\\/g, "/").replace(/\.[jt]sx?$/, ".js")}`;
149
+ const rel = relative(repoRoot, absPath).replace(/\\/g, "/").replace(/\.[jt]sx?$/, ".js");
150
+ // Emitted inside a quoted literal for dynamic import() — Windows needs the
151
+ // B:\~BUN drive path (with escaped separators); /$bunfs doesn't resolve.
152
+ return isWin
153
+ ? `B:\\\\~BUN\\\\root\\\\${rel.replace(/\//g, "\\\\")}`
154
+ : `/$bunfs/root/${rel}`;
145
155
  }
146
156
 
147
157
  // Worker files referenced via `new Worker(new URL("...", import.meta.url))`
@@ -330,9 +340,12 @@ const makePlugin = (collectWorkers) => ({
330
340
  out = out.replace(WORKER_RE, (m, spec) => {
331
341
  const rel = relative(repoRoot, resolve(modDir, spec))
332
342
  .replace(/\\/g, "/").replace(/\.[jt]sx?$/, ".js");
333
- return m.replace(`"${spec}"`, `"/$bunfs/root/${rel}"`)
334
- .replace(`'${spec}'`, `"/$bunfs/root/${rel}"`)
335
- .replace(`\`${spec}\``, `"/$bunfs/root/${rel}"`);
343
+ // Lands inside new URL(...) — Windows wants a file: URL into the
344
+ // B:\~BUN embedded root; the /$bunfs POSIX form misses it.
345
+ const baked = isWin ? `file:///B:/~BUN/root/${rel}` : `/$bunfs/root/${rel}`;
346
+ return m.replace(`"${spec}"`, `"${baked}"`)
347
+ .replace(`'${spec}'`, `"${baked}"`)
348
+ .replace(`\`${spec}\``, `\`${baked}\``);
336
349
  });
337
350
  // 2. Asset URL refs need no rewrite — import.meta.url already points
338
351
  // at the staged dd-assets dir, so new URL("./x.png", import.meta.url)