@solcreek/cli 0.3.3 → 0.3.4

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.
@@ -35,4 +35,10 @@ export declare const deployCommand: import("citty").CommandDef<{
35
35
  default: false;
36
36
  };
37
37
  }>;
38
+ /**
39
+ * Patch bare Node.js module imports (e.g. `from "fs"`) to use the `node:` prefix
40
+ * (e.g. `from "node:fs"`). Workerd requires the `node:` prefix for all built-in modules.
41
+ * @internal — exported for testing
42
+ */
43
+ export declare function patchBareNodeImports(code: string): string;
38
44
  //# sourceMappingURL=deploy.d.ts.map
@@ -637,7 +637,14 @@ async function deployAuthenticated(cwd, resolved, token, skipBuild, jsonMode = f
637
637
  continue;
638
638
  if (f.endsWith(".map"))
639
639
  continue;
640
- collected[f] = readFileSync(fp);
640
+ let content = readFileSync(fp);
641
+ // Patch bare Node.js module imports → node: prefix (workerd requires it)
642
+ // Note: nodejs_compat_v2 handles most modules, but bare specifiers
643
+ // (without node: prefix) still need patching.
644
+ if (f.endsWith(".js") || f.endsWith(".mjs")) {
645
+ content = Buffer.from(patchBareNodeImports(content.toString("utf-8")));
646
+ }
647
+ collected[f] = content;
641
648
  }
642
649
  }
643
650
  const fileCount = Object.keys(collected).length;
@@ -817,4 +824,25 @@ async function deployAuthenticated(cwd, resolved, token, skipBuild, jsonMode = f
817
824
  throw err;
818
825
  }
819
826
  }
827
+ // --- Helpers ---
828
+ /** Node.js built-in modules that may appear as bare imports in bundled workers. */
829
+ const NODE_BUILTINS = new Set([
830
+ "assert", "async_hooks", "buffer", "child_process", "cluster", "console",
831
+ "constants", "crypto", "dgram", "diagnostics_channel", "dns", "domain",
832
+ "events", "fs", "http", "http2", "https", "inspector", "module", "net",
833
+ "os", "path", "perf_hooks", "process", "punycode", "querystring",
834
+ "readline", "repl", "stream", "string_decoder", "sys", "timers",
835
+ "tls", "trace_events", "tty", "url", "util", "v8", "vm", "wasi",
836
+ "worker_threads", "zlib",
837
+ ]);
838
+ /**
839
+ * Patch bare Node.js module imports (e.g. `from "fs"`) to use the `node:` prefix
840
+ * (e.g. `from "node:fs"`). Workerd requires the `node:` prefix for all built-in modules.
841
+ * @internal — exported for testing
842
+ */
843
+ export function patchBareNodeImports(code) {
844
+ return code
845
+ .replace(/from\s+["']([a-z_]+)["']/g, (match, mod) => NODE_BUILTINS.has(mod) ? match.replace(`"${mod}"`, `"node:${mod}"`).replace(`'${mod}'`, `'node:${mod}'`) : match)
846
+ .replace(/require\(["']([a-z_]+)["']\)/g, (match, mod) => NODE_BUILTINS.has(mod) ? match.replace(`"${mod}"`, `"node:${mod}"`).replace(`'${mod}'`, `'node:${mod}'`) : match);
847
+ }
820
848
  //# sourceMappingURL=deploy.js.map
@@ -333,6 +333,11 @@ export default nextConfig;
333
333
  * auto-selects the adapter path for >= 16.2.
334
334
  */
335
335
  export function buildNextjsForWorkers(cwd, isMonorepo, projectName = "app") {
336
+ // Clean up stale adapter output to prevent deploy from using it
337
+ const staleAdapterOutput = join(cwd, ".creek/adapter-output");
338
+ if (existsSync(staleAdapterOutput)) {
339
+ rmSync(staleAdapterOutput, { recursive: true, force: true });
340
+ }
336
341
  // Step 1: Ensure opennext is available
337
342
  const opennextBin = ensureOpenNext(cwd);
338
343
  // Step 2: Ensure wrangler config
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solcreek/cli",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "CLI for the Creek deployment platform",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",