@prisma/composer 0.34.0-dev.3 → 0.34.0-dev.5

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.
Files changed (48) hide show
  1. package/dist/{app-config-Ccs7qh1a-BVxXuHdr.d.mts → app-config-B_gQYj3K-DpMi9a4K.d.mts} +57 -4
  2. package/dist/app-config-B_gQYj3K-DpMi9a4K.d.mts.map +1 -0
  3. package/dist/config-Bq3JlQ9_.d.mts +1 -0
  4. package/dist/config.d.mts +2 -2
  5. package/dist/control.d.mts +36 -10
  6. package/dist/control.d.mts.map +1 -1
  7. package/dist/control.mjs +3 -3
  8. package/dist/control.mjs.map +1 -1
  9. package/dist/deploy-Bq3JlQ9_.d.mts +1 -0
  10. package/dist/deploy.d.mts +3 -3
  11. package/dist/deploy.mjs +26 -0
  12. package/dist/deploy.mjs.map +1 -1
  13. package/dist/{deployment-summary-p88NV5m5-BA2NLOON.d.mts → deployment-summary-p88NV5m5-DTkPLzTp.d.mts} +3 -3
  14. package/dist/{deployment-summary-p88NV5m5-BA2NLOON.d.mts.map → deployment-summary-p88NV5m5-DTkPLzTp.d.mts.map} +1 -1
  15. package/dist/{dev-current-B0JudXoV-Dj9EupUm.mjs → dev-current-hGle--BH-gZ2U0WYl.mjs} +5 -5
  16. package/dist/{dev-current-B0JudXoV-Dj9EupUm.mjs.map → dev-current-hGle--BH-gZ2U0WYl.mjs.map} +1 -1
  17. package/dist/{execute-deploy-destroy-VO5-9fgH-C3kSZOoS.mjs → execute-deploy-destroy-iO4yn-3Q-CPw2352V.mjs} +4 -4
  18. package/dist/{execute-deploy-destroy-VO5-9fgH-C3kSZOoS.mjs.map → execute-deploy-destroy-iO4yn-3Q-CPw2352V.mjs.map} +1 -1
  19. package/dist/{execute-dev-erzNYQj1-CNYgdhXi.mjs → execute-dev-DQMSVQn9-nKRiI0Ln.mjs} +163 -34
  20. package/dist/execute-dev-DQMSVQn9-nKRiI0Ln.mjs.map +1 -0
  21. package/dist/{execute-dev-current-CDytav3w-MxPUs1Yw.mjs → execute-dev-current-C8e554e4--48P-XaH.mjs} +8 -6
  22. package/dist/execute-dev-current-C8e554e4--48P-XaH.mjs.map +1 -0
  23. package/dist/{execute-log-P2-0y3Sw-DeH_9UnN.mjs → execute-log-jrZPOJr2-CR-B3w2g.mjs} +4 -4
  24. package/dist/{execute-log-P2-0y3Sw-DeH_9UnN.mjs.map → execute-log-jrZPOJr2-CR-B3w2g.mjs.map} +1 -1
  25. package/dist/local-target.d.mts +1 -1
  26. package/dist/nextjs-control.d.mts +10 -4
  27. package/dist/nextjs-control.d.mts.map +1 -1
  28. package/dist/nextjs-control.mjs +50 -2
  29. package/dist/nextjs-control.mjs.map +1 -1
  30. package/dist/node-control.d.mts +10 -4
  31. package/dist/node-control.d.mts.map +1 -1
  32. package/dist/node-control.mjs +20 -3
  33. package/dist/node-control.mjs.map +1 -1
  34. package/dist/node.d.mts +9 -0
  35. package/dist/node.d.mts.map +1 -1
  36. package/dist/node.mjs +12 -8
  37. package/dist/node.mjs.map +1 -1
  38. package/dist/{pipeline-DXygNR-O-Dj2hnGI1.mjs → pipeline-C06OEvKd-QZk5LyTs.mjs} +93 -15
  39. package/dist/pipeline-C06OEvKd-QZk5LyTs.mjs.map +1 -0
  40. package/dist/report.d.mts +3 -3
  41. package/package.json +11 -11
  42. package/skills/prisma-composer-core-concepts/SKILL.md +52 -14
  43. package/dist/app-config-Ccs7qh1a-BVxXuHdr.d.mts.map +0 -1
  44. package/dist/config-BTfpzVyP.d.mts +0 -1
  45. package/dist/deploy-BTfpzVyP.d.mts +0 -1
  46. package/dist/execute-dev-current-CDytav3w-MxPUs1Yw.mjs.map +0 -1
  47. package/dist/execute-dev-erzNYQj1-CNYgdhXi.mjs.map +0 -1
  48. package/dist/pipeline-DXygNR-O-Dj2hnGI1.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"nextjs-control.mjs","names":["path","fs"],"sources":["../../../0-framework/2-authoring/nextjs/dist/control.mjs"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { assertBundleSymlinksStayInside, copyTreeVerbatim, createBundleLink, isWithin, repairWindowsDirectorySymlinks } from \"@internal/bundle-paths\";\nimport { build } from \"esbuild\";\n//#region src/control/build.ts\n/**\n* The extension's control entry (ADR-0017): `nextjsBuild()` returns the build\n* descriptor `prisma.config.ts` lists. Deploy-only (ADR-0005): the user\n* runs `next build` (`output: \"standalone\"`); `assemble` then performs the\n* *documented* Next standalone deploy — it ships the standalone tree and copies\n* in the client assets Next deliberately omits (`.next/static`, `public/`) — and\n* adds the framework's boot wrapper. This is the canonical `cp` step from the\n* Next docs, run at deploy so no app needs a build-script for it.\n*\n* It does not guess: the app's location inside the standalone tree (deep, when\n* `outputFileTracingRoot` is the monorepo root) is *read from Next's own build\n* manifest* (`.next/required-server-files.json`'s `relativeAppDir`), never walked\n* for or computed from a hardcoded depth. It does not launder: node_modules is\n* shipped exactly as `next build` produced it. The packager preserves a link\n* only after resolving its target inside the assembled bundle, and rejects\n* escaping links. When Next records an in-root package link but omits its target\n* from standalone (seen with pnpm's virtual store), assembly stages that exact\n* target from `outputFileTracingRoot` so the artifact remains self-contained.\n*\n* Artifact layout: `<workDir>/main.mjs` (our wrapper) + `<workDir>/bundle/`\n* (the standalone tree, with static/public copied in). The packager adds\n* `bootstrap.js` + the manifest at the root; bootstrap imports main.mjs, whose\n* run() dynamically imports `./bundle/<relativeAppDir>/server.js`.\n*\n* Paths are file-relative (ADR-0004): `appDir` resolves against\n* `dirname(build.module)`.\n*/\n/** Narrows the shared BuildAdapter to this extension's own descriptor — the value-level mirror of the registry routing on (extension, type). */\nfunction isNextjsBuild(descriptor) {\n\treturn descriptor.type === \"nextjs\" && \"appDir\" in descriptor && typeof descriptor.appDir === \"string\";\n}\nfunction readServerFilesManifest(appDir) {\n\tconst manifestPath = path.join(appDir, \".next\", \"required-server-files.json\");\n\tif (!fs.existsSync(manifestPath)) throw new Error(`no ${path.join(\".next\", \"required-server-files.json\")} under ${appDir} — run \\`next build\\` with output: \"standalone\" first.`);\n\tconst manifest = JSON.parse(fs.readFileSync(manifestPath, \"utf8\"));\n\tconst relativeAppDir = manifest?.relativeAppDir;\n\tconst tracingRoot = manifest?.config?.outputFileTracingRoot;\n\treturn {\n\t\tpath: manifestPath,\n\t\trelativeAppDir: typeof relativeAppDir === \"string\" ? relativeAppDir : void 0,\n\t\ttracingRoot: typeof tracingRoot === \"string\" ? path.resolve(appDir, tracingRoot) : void 0\n\t};\n}\n/**\n* The app's own subpath within `.next/standalone`, as an OS-relative path. Next\n* mirrors the app's location under `outputFileTracingRoot` (deep, when that's the\n* monorepo root); rather than walk the tree for `server.js`, we read where Next\n* put it from `.next/required-server-files.json` — `relativeAppDir` is exactly\n* that subpath. Older Next lacks the field; fall back to computing it from the\n* same manifest's `config.outputFileTracingRoot`.\n*/\nfunction appRelFrom(manifest, appDir) {\n\tconst posixRel = manifest.relativeAppDir ?? (manifest.tracingRoot === void 0 ? void 0 : path.relative(manifest.tracingRoot, appDir).split(path.sep).join(\"/\"));\n\tif (posixRel === void 0) throw new Error(`${manifest.path} records neither relativeAppDir nor config.outputFileTracingRoot — cannot locate the standalone server`);\n\tconst rel = posixRel.split(\"/\").join(path.sep);\n\tif (path.isAbsolute(rel) || !isWithin(appDir, path.join(appDir, rel))) throw new Error(`${manifest.path} records an app location that escapes its tracing root (${posixRel}) — refusing to stage outside the bundle`);\n\treturn rel;\n}\nasync function lstatIfPresent(candidate) {\n\ttry {\n\t\treturn await fs.promises.lstat(candidate);\n\t} catch (error) {\n\t\tif (error instanceof Error && Reflect.get(error, \"code\") === \"ENOENT\") return void 0;\n\t\tthrow error;\n\t}\n}\n/** Do not write through an existing link while repairing a missing target. */\nasync function hasSymlinkAncestor(root, candidate) {\n\tconst relative = path.relative(root, path.dirname(candidate));\n\tlet cursor = root;\n\tfor (const segment of relative.split(path.sep).filter(Boolean)) {\n\t\tcursor = path.join(cursor, segment);\n\t\tconst stat = await lstatIfPresent(cursor);\n\t\tif (stat === void 0) return false;\n\t\tif (stat.isSymbolicLink()) return true;\n\t}\n\treturn false;\n}\nasync function collectSymlinks(root) {\n\tconst links = [];\n\tasync function visit(directory) {\n\t\tfor (const entry of await fs.promises.readdir(directory, { withFileTypes: true })) {\n\t\t\tconst entryPath = path.join(directory, entry.name);\n\t\t\tif (entry.isSymbolicLink()) links.push(entryPath);\n\t\t\telse if (entry.isDirectory()) await visit(entryPath);\n\t\t}\n\t}\n\tawait visit(root);\n\treturn links;\n}\n/** In-bundle link targets that the standalone tree does not contain — the\n* repairs staging has to make. */\nasync function missingLinkTargets(bundleDir) {\n\tconst missing = [];\n\tfor (const linkPath of await collectSymlinks(bundleDir)) {\n\t\tconst rawTarget = await fs.promises.readlink(linkPath);\n\t\tconst target = path.resolve(path.dirname(linkPath), rawTarget);\n\t\tif (!isWithin(bundleDir, target) || await lstatIfPresent(target) !== void 0) continue;\n\t\tif (await hasSymlinkAncestor(bundleDir, target)) continue;\n\t\tmissing.push(target);\n\t}\n\treturn missing;\n}\n/**\n* Absolute junctions (pnpm on Windows) often point from `.next/standalone`\n* straight into the app's `node_modules/.pnpm/...` under the tracing root —\n* outside the standalone copy root. After `copyTreeVerbatim` those links still\n* escape the assembled bundle; stage the real target under the bundle at the\n* same tracing-root-relative path and repoint the link.\n*/\nasync function stageEscapingTracingRootLinks(bundleDir, tracedRootReal) {\n\tconst nodeModulesRoot = path.join(tracedRootReal, \"node_modules\");\n\tconst stagedSources = /* @__PURE__ */ new Set();\n\tfor (const linkPath of await collectSymlinks(bundleDir)) {\n\t\tconst rawTarget = await fs.promises.readlink(linkPath);\n\t\tlet resolved = path.resolve(path.dirname(linkPath), rawTarget);\n\t\tif (await lstatIfPresent(resolved) === void 0) continue;\n\t\ttry {\n\t\t\tresolved = await fs.promises.realpath(resolved);\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tif (isWithin(bundleDir, resolved)) continue;\n\t\tif (!isWithin(nodeModulesRoot, resolved) && resolved !== nodeModulesRoot) continue;\n\t\tconst stagedAt = path.join(bundleDir, path.relative(tracedRootReal, resolved));\n\t\tif (await lstatIfPresent(stagedAt) === void 0) {\n\t\t\tawait fs.promises.mkdir(path.dirname(stagedAt), { recursive: true });\n\t\t\tif ((await fs.promises.stat(resolved)).isDirectory()) await copyTreeVerbatim(resolved, stagedAt);\n\t\t\telse await fs.promises.copyFile(resolved, stagedAt);\n\t\t\tstagedSources.add(resolved);\n\t\t}\n\t\tconst type = (await fs.promises.stat(stagedAt)).isDirectory() ? \"dir\" : \"file\";\n\t\tawait fs.promises.unlink(linkPath);\n\t\tawait createBundleLink(linkPath, path.relative(path.dirname(linkPath), stagedAt), type, {\n\t\t\tresolvedTarget: stagedAt,\n\t\t\tcopySource: stagedAt,\n\t\t\tcopyWithinRoot: bundleDir\n\t\t});\n\t}\n\treturn [...stagedSources];\n}\n/**\n* pnpm can leave a traced hoist link in standalone while omitting the virtual-\n* store directory it targets. The same target still exists at the corresponding\n* path under outputFileTracingRoot. Stage only that exact, real in-root target;\n* unsafe or genuinely unavailable links remain for the packager to reject.\n*/\nasync function stageMissingStandaloneLinkTargets(bundleDir, manifest) {\n\tconst tracingRoot = manifest.tracingRoot;\n\tif (tracingRoot === void 0) {\n\t\tif ((await missingLinkTargets(bundleDir)).length === 0) return [];\n\t\tthrow new Error(`${manifest.path} records no config.outputFileTracingRoot, but the standalone tree contains symlinks whose targets Next omitted — the source root those targets must be staged from is unknown. Rebuild with a Next version that records config.outputFileTracingRoot, or set outputFileTracingRoot in next.config.`);\n\t}\n\tif (await lstatIfPresent(tracingRoot) === void 0) return [];\n\tconst tracedRootReal = await fs.promises.realpath(tracingRoot);\n\tconst stagedSources = /* @__PURE__ */ new Set();\n\tlet staged = true;\n\twhile (staged) {\n\t\tstaged = false;\n\t\tfor (const target of await missingLinkTargets(bundleDir)) {\n\t\t\tconst standaloneRelative = path.relative(bundleDir, target);\n\t\t\tconst source = path.resolve(tracingRoot, standaloneRelative);\n\t\t\tif (await lstatIfPresent(source) === void 0) continue;\n\t\t\tif (!isWithin(tracedRootReal, await fs.promises.realpath(source))) continue;\n\t\t\tawait fs.promises.mkdir(path.dirname(target), { recursive: true });\n\t\t\tawait copyTreeVerbatim(source, target);\n\t\t\tstagedSources.add(source);\n\t\t\tstaged = true;\n\t\t}\n\t}\n\tfor (const source of await stageEscapingTracingRootLinks(bundleDir, tracedRootReal)) stagedSources.add(source);\n\treturn [...stagedSources];\n}\n/** The built standalone server.js for a nextjs build — `appDir`'s standalone root plus the app subpath Next recorded. Single-sourced so `assemble()` (deploy) and the integration-test seam can't drift. */\nfunction standaloneServerPath(build) {\n\tconst appDir = path.resolve(path.dirname(fileURLToPath(build.module)), build.appDir);\n\tconst manifest = readServerFilesManifest(appDir);\n\treturn path.join(appDir, \".next\", \"standalone\", appRelFrom(manifest, appDir), \"server.js\");\n}\nasync function assemble(input) {\n\tif (!isNextjsBuild(input.build)) throw new Error(`@prisma/composer/nextjs/control: expected a \"nextjs\" build adapter (with appDir), got \"${input.build.type}\".`);\n\tconst buildDescriptor = input.build;\n\tconst appDir = path.resolve(path.dirname(fileURLToPath(buildDescriptor.module)), buildDescriptor.appDir);\n\tconst standaloneRoot = path.join(appDir, \".next\", \"standalone\");\n\tif (!fs.existsSync(standaloneRoot)) throw new Error(`no ${path.join(\".next\", \"standalone\")} under ${appDir} — run \\`next build\\` with output: \"standalone\" first.`);\n\tconst manifest = readServerFilesManifest(appDir);\n\tconst appRel = appRelFrom(manifest, appDir);\n\tconst workDir = path.join(input.cwd, \".prisma-composer\", \"artifacts\", input.address);\n\tawait fs.promises.rm(workDir, {\n\t\trecursive: true,\n\t\tforce: true\n\t});\n\tawait fs.promises.mkdir(workDir, { recursive: true });\n\tconst bundleDir = path.join(workDir, \"bundle\");\n\tawait copyTreeVerbatim(standaloneRoot, bundleDir);\n\tconst stagedLinkTargets = await stageMissingStandaloneLinkTargets(bundleDir, manifest);\n\tawait repairWindowsDirectorySymlinks(bundleDir);\n\tconst appOut = path.join(bundleDir, appRel);\n\tconst staticSrc = path.join(appDir, \".next\", \"static\");\n\tif (fs.existsSync(staticSrc)) await copyTreeVerbatim(staticSrc, path.join(appOut, \".next\", \"static\"));\n\tconst publicSrc = path.join(appDir, \"public\");\n\tif (fs.existsSync(publicSrc)) await copyTreeVerbatim(publicSrc, path.join(appOut, \"public\"));\n\tawait assertBundleSymlinksStayInside(bundleDir);\n\tawait build({\n\t\tentryPoints: { main: fileURLToPath(buildDescriptor.module) },\n\t\toutdir: workDir,\n\t\tbundle: true,\n\t\tformat: \"esm\",\n\t\tplatform: \"node\",\n\t\texternal: [\"bun\", \"bun:*\"],\n\t\toutExtension: { \".js\": \".mjs\" }\n\t});\n\tif (!fs.existsSync(path.join(workDir, \"main.mjs\"))) throw new Error(`esbuild produced no main.mjs in ${workDir}`);\n\treturn {\n\t\tdir: workDir,\n\t\tentry: path.posix.join(\"bundle\", appRel.split(path.sep).join(\"/\"), \"server.js\"),\n\t\twatch: [standaloneRoot, ...stagedLinkTargets]\n\t};\n}\n/** The nextjs build extension descriptor — the `composer` section of `prisma.config.ts` lists it under `extensions`. */\nconst nextjsBuild = () => ({\n\tid: \"@prisma/composer/nextjs\",\n\tnodes: { nextjs: {\n\t\tkind: \"build\",\n\t\tassemble\n\t} }\n});\n//#endregion\nexport { assemble, nextjsBuild, standaloneServerPath };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,SAAS,cAAc,YAAY;CAClC,OAAO,WAAW,SAAS,YAAY,YAAY,cAAc,OAAO,WAAW,WAAW;AAC/F;AACA,SAAS,wBAAwB,QAAQ;CACxC,MAAM,eAAeA,OAAK,KAAK,QAAQ,SAAS,4BAA4B;CAC5E,IAAI,CAACC,KAAG,WAAW,YAAY,GAAG,MAAM,IAAI,MAAM,MAAMD,OAAK,KAAK,SAAS,4BAA4B,EAAE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;AAEA,MAAM,qBAAqB;CAC1B,IAAI;CACJ,OAAO,EAAE,QAAQ;EAChB,MAAM;EACN;CACD,EAAE;AACH"}
1
+ {"version":3,"file":"nextjs-control.mjs","names":["path","fs"],"sources":["../../../0-framework/2-authoring/nextjs/dist/control.mjs"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { assertBundleSymlinksStayInside, copyTreeVerbatim, createBundleLink, isWithin, repairWindowsDirectorySymlinks } from \"@internal/bundle-paths\";\nimport { build } from \"esbuild\";\n//#region src/control/build.ts\n/**\n* The extension's control entry (ADR-0017): `nextjsBuild()` returns the build\n* descriptor `prisma.config.ts` lists. Deploy-only (ADR-0005): the user\n* runs `next build` (`output: \"standalone\"`); `assemble` then performs the\n* *documented* Next standalone deploy — it ships the standalone tree and copies\n* in the client assets Next deliberately omits (`.next/static`, `public/`) — and\n* adds the framework's boot wrapper. This is the canonical `cp` step from the\n* Next docs, run at deploy so no app needs a build-script for it.\n*\n* It does not guess: the app's location inside the standalone tree (deep, when\n* `outputFileTracingRoot` is the monorepo root) is *read from Next's own build\n* manifest* (`.next/required-server-files.json`'s `relativeAppDir`), never walked\n* for or computed from a hardcoded depth. It does not launder: node_modules is\n* shipped exactly as `next build` produced it. The packager preserves a link\n* only after resolving its target inside the assembled bundle, and rejects\n* escaping links. When Next records an in-root package link but omits its target\n* from standalone (seen with pnpm's virtual store), assembly stages that exact\n* target from `outputFileTracingRoot` so the artifact remains self-contained.\n*\n* Artifact layout: `<workDir>/main.mjs` (our wrapper) + `<workDir>/bundle/`\n* (the standalone tree, with static/public copied in). The packager adds\n* `bootstrap.js` + the manifest at the root; bootstrap imports main.mjs, whose\n* run() dynamically imports `./bundle/<relativeAppDir>/server.js`.\n*\n* Paths are file-relative (ADR-0004): `appDir` resolves against\n* `dirname(build.module)`.\n*/\n/** Narrows the shared BuildAdapter to this extension's own descriptor — the value-level mirror of the registry routing on (extension, type). */\nfunction isNextjsBuild(descriptor) {\n\treturn descriptor.type === \"nextjs\" && \"appDir\" in descriptor && typeof descriptor.appDir === \"string\";\n}\nfunction readServerFilesManifest(appDir) {\n\tconst manifestPath = path.join(appDir, \".next\", \"required-server-files.json\");\n\tif (!fs.existsSync(manifestPath)) throw new Error(`no ${path.join(\".next\", \"required-server-files.json\")} under ${appDir} — run \\`next build\\` with output: \"standalone\" first.`);\n\tconst manifest = JSON.parse(fs.readFileSync(manifestPath, \"utf8\"));\n\tconst relativeAppDir = manifest?.relativeAppDir;\n\tconst tracingRoot = manifest?.config?.outputFileTracingRoot;\n\treturn {\n\t\tpath: manifestPath,\n\t\trelativeAppDir: typeof relativeAppDir === \"string\" ? relativeAppDir : void 0,\n\t\ttracingRoot: typeof tracingRoot === \"string\" ? path.resolve(appDir, tracingRoot) : void 0\n\t};\n}\n/**\n* The app's own subpath within `.next/standalone`, as an OS-relative path. Next\n* mirrors the app's location under `outputFileTracingRoot` (deep, when that's the\n* monorepo root); rather than walk the tree for `server.js`, we read where Next\n* put it from `.next/required-server-files.json` — `relativeAppDir` is exactly\n* that subpath. Older Next lacks the field; fall back to computing it from the\n* same manifest's `config.outputFileTracingRoot`.\n*/\nfunction appRelFrom(manifest, appDir) {\n\tconst posixRel = manifest.relativeAppDir ?? (manifest.tracingRoot === void 0 ? void 0 : path.relative(manifest.tracingRoot, appDir).split(path.sep).join(\"/\"));\n\tif (posixRel === void 0) throw new Error(`${manifest.path} records neither relativeAppDir nor config.outputFileTracingRoot — cannot locate the standalone server`);\n\tconst rel = posixRel.split(\"/\").join(path.sep);\n\tif (path.isAbsolute(rel) || !isWithin(appDir, path.join(appDir, rel))) throw new Error(`${manifest.path} records an app location that escapes its tracing root (${posixRel}) — refusing to stage outside the bundle`);\n\treturn rel;\n}\nasync function lstatIfPresent(candidate) {\n\ttry {\n\t\treturn await fs.promises.lstat(candidate);\n\t} catch (error) {\n\t\tif (error instanceof Error && Reflect.get(error, \"code\") === \"ENOENT\") return void 0;\n\t\tthrow error;\n\t}\n}\n/** Do not write through an existing link while repairing a missing target. */\nasync function hasSymlinkAncestor(root, candidate) {\n\tconst relative = path.relative(root, path.dirname(candidate));\n\tlet cursor = root;\n\tfor (const segment of relative.split(path.sep).filter(Boolean)) {\n\t\tcursor = path.join(cursor, segment);\n\t\tconst stat = await lstatIfPresent(cursor);\n\t\tif (stat === void 0) return false;\n\t\tif (stat.isSymbolicLink()) return true;\n\t}\n\treturn false;\n}\nasync function collectSymlinks(root) {\n\tconst links = [];\n\tasync function visit(directory) {\n\t\tfor (const entry of await fs.promises.readdir(directory, { withFileTypes: true })) {\n\t\t\tconst entryPath = path.join(directory, entry.name);\n\t\t\tif (entry.isSymbolicLink()) links.push(entryPath);\n\t\t\telse if (entry.isDirectory()) await visit(entryPath);\n\t\t}\n\t}\n\tawait visit(root);\n\treturn links;\n}\n/** In-bundle link targets that the standalone tree does not contain — the\n* repairs staging has to make. */\nasync function missingLinkTargets(bundleDir) {\n\tconst missing = [];\n\tfor (const linkPath of await collectSymlinks(bundleDir)) {\n\t\tconst rawTarget = await fs.promises.readlink(linkPath);\n\t\tconst target = path.resolve(path.dirname(linkPath), rawTarget);\n\t\tif (!isWithin(bundleDir, target) || await lstatIfPresent(target) !== void 0) continue;\n\t\tif (await hasSymlinkAncestor(bundleDir, target)) continue;\n\t\tmissing.push(target);\n\t}\n\treturn missing;\n}\n/**\n* Absolute junctions (pnpm on Windows) often point from `.next/standalone`\n* straight into the app's `node_modules/.pnpm/...` under the tracing root —\n* outside the standalone copy root. After `copyTreeVerbatim` those links still\n* escape the assembled bundle; stage the real target under the bundle at the\n* same tracing-root-relative path and repoint the link.\n*/\nasync function stageEscapingTracingRootLinks(bundleDir, tracedRootReal) {\n\tconst nodeModulesRoot = path.join(tracedRootReal, \"node_modules\");\n\tconst stagedSources = /* @__PURE__ */ new Set();\n\tfor (const linkPath of await collectSymlinks(bundleDir)) {\n\t\tconst rawTarget = await fs.promises.readlink(linkPath);\n\t\tlet resolved = path.resolve(path.dirname(linkPath), rawTarget);\n\t\tif (await lstatIfPresent(resolved) === void 0) continue;\n\t\ttry {\n\t\t\tresolved = await fs.promises.realpath(resolved);\n\t\t} catch {\n\t\t\tcontinue;\n\t\t}\n\t\tif (isWithin(bundleDir, resolved)) continue;\n\t\tif (!isWithin(nodeModulesRoot, resolved) && resolved !== nodeModulesRoot) continue;\n\t\tconst stagedAt = path.join(bundleDir, path.relative(tracedRootReal, resolved));\n\t\tif (await lstatIfPresent(stagedAt) === void 0) {\n\t\t\tawait fs.promises.mkdir(path.dirname(stagedAt), { recursive: true });\n\t\t\tif ((await fs.promises.stat(resolved)).isDirectory()) await copyTreeVerbatim(resolved, stagedAt);\n\t\t\telse await fs.promises.copyFile(resolved, stagedAt);\n\t\t\tstagedSources.add(resolved);\n\t\t}\n\t\tconst type = (await fs.promises.stat(stagedAt)).isDirectory() ? \"dir\" : \"file\";\n\t\tawait fs.promises.unlink(linkPath);\n\t\tawait createBundleLink(linkPath, path.relative(path.dirname(linkPath), stagedAt), type, {\n\t\t\tresolvedTarget: stagedAt,\n\t\t\tcopySource: stagedAt,\n\t\t\tcopyWithinRoot: bundleDir\n\t\t});\n\t}\n\treturn [...stagedSources];\n}\n/**\n* pnpm can leave a traced hoist link in standalone while omitting the virtual-\n* store directory it targets. The same target still exists at the corresponding\n* path under outputFileTracingRoot. Stage only that exact, real in-root target;\n* unsafe or genuinely unavailable links remain for the packager to reject.\n*/\nasync function stageMissingStandaloneLinkTargets(bundleDir, manifest) {\n\tconst tracingRoot = manifest.tracingRoot;\n\tif (tracingRoot === void 0) {\n\t\tif ((await missingLinkTargets(bundleDir)).length === 0) return [];\n\t\tthrow new Error(`${manifest.path} records no config.outputFileTracingRoot, but the standalone tree contains symlinks whose targets Next omitted — the source root those targets must be staged from is unknown. Rebuild with a Next version that records config.outputFileTracingRoot, or set outputFileTracingRoot in next.config.`);\n\t}\n\tif (await lstatIfPresent(tracingRoot) === void 0) return [];\n\tconst tracedRootReal = await fs.promises.realpath(tracingRoot);\n\tconst stagedSources = /* @__PURE__ */ new Set();\n\tlet staged = true;\n\twhile (staged) {\n\t\tstaged = false;\n\t\tfor (const target of await missingLinkTargets(bundleDir)) {\n\t\t\tconst standaloneRelative = path.relative(bundleDir, target);\n\t\t\tconst source = path.resolve(tracingRoot, standaloneRelative);\n\t\t\tif (await lstatIfPresent(source) === void 0) continue;\n\t\t\tif (!isWithin(tracedRootReal, await fs.promises.realpath(source))) continue;\n\t\t\tawait fs.promises.mkdir(path.dirname(target), { recursive: true });\n\t\t\tawait copyTreeVerbatim(source, target);\n\t\t\tstagedSources.add(source);\n\t\t\tstaged = true;\n\t\t}\n\t}\n\tfor (const source of await stageEscapingTracingRootLinks(bundleDir, tracedRootReal)) stagedSources.add(source);\n\treturn [...stagedSources];\n}\n/** The built standalone server.js for a nextjs build — `appDir`'s standalone root plus the app subpath Next recorded. Single-sourced so `assemble()` (deploy) and the integration-test seam can't drift. */\nfunction standaloneServerPath(build) {\n\tconst appDir = path.resolve(path.dirname(fileURLToPath(build.module)), build.appDir);\n\tconst manifest = readServerFilesManifest(appDir);\n\treturn path.join(appDir, \".next\", \"standalone\", appRelFrom(manifest, appDir), \"server.js\");\n}\nasync function assemble(input) {\n\tif (!isNextjsBuild(input.build)) throw new Error(`@prisma/composer/nextjs/control: expected a \"nextjs\" build adapter (with appDir), got \"${input.build.type}\".`);\n\tconst buildDescriptor = input.build;\n\tconst appDir = path.resolve(path.dirname(fileURLToPath(buildDescriptor.module)), buildDescriptor.appDir);\n\tconst standaloneRoot = path.join(appDir, \".next\", \"standalone\");\n\tif (!fs.existsSync(standaloneRoot)) throw new Error(`no ${path.join(\".next\", \"standalone\")} under ${appDir} — run \\`next build\\` with output: \"standalone\" first.`);\n\tconst manifest = readServerFilesManifest(appDir);\n\tconst appRel = appRelFrom(manifest, appDir);\n\tconst workDir = path.join(input.cwd, \".prisma-composer\", \"artifacts\", input.address);\n\tawait fs.promises.rm(workDir, {\n\t\trecursive: true,\n\t\tforce: true\n\t});\n\tawait fs.promises.mkdir(workDir, { recursive: true });\n\tconst bundleDir = path.join(workDir, \"bundle\");\n\tawait copyTreeVerbatim(standaloneRoot, bundleDir);\n\tconst stagedLinkTargets = await stageMissingStandaloneLinkTargets(bundleDir, manifest);\n\tawait repairWindowsDirectorySymlinks(bundleDir);\n\tconst appOut = path.join(bundleDir, appRel);\n\tconst staticSrc = path.join(appDir, \".next\", \"static\");\n\tif (fs.existsSync(staticSrc)) await copyTreeVerbatim(staticSrc, path.join(appOut, \".next\", \"static\"));\n\tconst publicSrc = path.join(appDir, \"public\");\n\tif (fs.existsSync(publicSrc)) await copyTreeVerbatim(publicSrc, path.join(appOut, \"public\"));\n\tawait assertBundleSymlinksStayInside(bundleDir);\n\tawait build({\n\t\tentryPoints: { main: fileURLToPath(buildDescriptor.module) },\n\t\toutdir: workDir,\n\t\tbundle: true,\n\t\tformat: \"esm\",\n\t\tplatform: \"node\",\n\t\texternal: [\"bun\", \"bun:*\"],\n\t\toutExtension: { \".js\": \".mjs\" }\n\t});\n\tif (!fs.existsSync(path.join(workDir, \"main.mjs\"))) throw new Error(`esbuild produced no main.mjs in ${workDir}`);\n\treturn {\n\t\tdir: workDir,\n\t\tentry: path.posix.join(\"bundle\", appRel.split(path.sep).join(\"/\"), \"server.js\"),\n\t\twatch: [standaloneRoot, ...stagedLinkTargets]\n\t};\n}\n/**\n* The `next` CLI the app at `appDir` depends on: the file its own `next`\n* package names in `bin.next`, resolved from `appDir` the way Node resolves\n* the app's imports. Never the `next` on the developer's `PATH`.\n*\n* `createRequire` rather than `import.meta.resolve(…, parent)`: Node ignores\n* the parent argument unless started with `--experimental-import-meta-resolve`,\n* which would resolve from this package's install instead of the app's.\n*/\nfunction nextBinFrom(appDir) {\n\tconst missing = /* @__PURE__ */ new Error(`cannot find the \\`next\\` package from ${appDir} — install it there to run this service's dev server`);\n\tlet packageJsonPath;\n\ttry {\n\t\tpackageJsonPath = createRequire(path.join(appDir, \"package.json\")).resolve(\"next/package.json\");\n\t} catch (cause) {\n\t\tthrow new Error(missing.message, { cause });\n\t}\n\tconst manifest = JSON.parse(fs.readFileSync(packageJsonPath, \"utf8\"));\n\tconst bin = typeof manifest === \"object\" && manifest !== null && \"bin\" in manifest ? manifest.bin : void 0;\n\tconst nextBin = typeof bin === \"object\" && bin !== null && \"next\" in bin && typeof bin.next === \"string\" ? bin.next : void 0;\n\tif (nextBin === void 0) throw new Error(`the \\`next\\` package at ${path.dirname(packageJsonPath)} declares no \\`next\\` bin`);\n\treturn path.resolve(path.dirname(packageJsonPath), nextBin);\n}\n/**\n* The documented dev step (ADR-0056): `next dev` in `appDir`, with the\n* service's port and host as flags because `next dev` does not read `HOST`.\n* Resolves the binary and returns data; spawns nothing.\n*/\nasync function serve(input) {\n\tconst buildDescriptor = input.build;\n\tif (!isNextjsBuild(buildDescriptor)) throw new Error(`@prisma/composer/nextjs/control: expected a \"nextjs\" build adapter (with appDir), got \"${input.build.type}\".`);\n\tconst appDir = path.resolve(path.dirname(fileURLToPath(buildDescriptor.module)), buildDescriptor.appDir);\n\tconst nextBin = nextBinFrom(appDir);\n\treturn {\n\t\tcwd: appDir,\n\t\targv: ({ port, host }) => [\n\t\t\tnextBin,\n\t\t\t\"dev\",\n\t\t\t\"-p\",\n\t\t\tString(port),\n\t\t\t\"-H\",\n\t\t\thost\n\t\t],\n\t\tdisplay: \"next dev\"\n\t};\n}\n/** The nextjs build extension descriptor — the `composer` section of `prisma.config.ts` lists it under `extensions`. */\nconst nextjsBuild = () => ({\n\tid: \"@prisma/composer/nextjs\",\n\tnodes: { nextjs: {\n\t\tkind: \"build\",\n\t\tassemble,\n\t\tserve\n\t} }\n});\n//#endregion\nexport { assemble, nextjsBuild, serve, standaloneServerPath };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,SAAS,cAAc,YAAY;CAClC,OAAO,WAAW,SAAS,YAA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;GACA;GACA,OAAO,IAAI;GACX;GACA;EACD;EACA,SAAS;CACV;AACD;;AAEA,MAAM,qBAAqB;CAC1B,IAAI;CACJ,OAAO,EAAE,QAAQ;EAChB,MAAM;EACN;EACA;CACD,EAAE;AACH"}
@@ -1,11 +1,17 @@
1
- import { a as Bundle, i as AssembleInput, p as ExtensionDescriptor } from "./app-config-Ccs7qh1a-BVxXuHdr.mjs";
2
- import "./config-BTfpzVyP.mjs";
3
- import "./deploy-BTfpzVyP.mjs";
1
+ import { W as ServeInput, a as Bundle, i as AssembleInput, m as ExtensionDescriptor, p as DevServer } from "./app-config-B_gQYj3K-DpMi9a4K.mjs";
2
+ import "./config-Bq3JlQ9_.mjs";
3
+ import "./deploy-Bq3JlQ9_.mjs";
4
4
  //#region ../../0-framework/2-authoring/node/dist/control.d.mts
5
5
  //#region src/control/build.d.ts
6
6
  declare function assemble(input: AssembleInput): Promise<Bundle>;
7
+ /**
8
+ * The author's `dev` command, run in the authoring module's directory
9
+ * (ADR-0004, ADR-0056), or `undefined` when they wrote none. Nothing is
10
+ * appended to it: the command reads `PORT` and `HOST` from its environment.
11
+ */
12
+ declare function serve(input: ServeInput): Promise<DevServer | undefined>;
7
13
  /** The node build extension descriptor — the `composer` section of `prisma.config.ts` lists it under `extensions`. */
8
14
  declare const nodeBuild: () => ExtensionDescriptor;
9
15
  //#endregion
10
- export { type AssembleInput, type Bundle, assemble, nodeBuild };
16
+ export { type AssembleInput, type Bundle, assemble, nodeBuild, serve };
11
17
  //# sourceMappingURL=node-control.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node-control.d.mts","names":[],"sources":["../../../0-framework/2-authoring/node/dist/control.d.mts"],"mappings":";;;;;iBAGiB,SAAS,OAAO,gBAAkB,QAAQ;;cAE7C,iBAAiB"}
1
+ {"version":3,"file":"node-control.d.mts","names":[],"sources":["../../../0-framework/2-authoring/node/dist/control.d.mts"],"mappings":";;;;;iBAGiB,SAAS,OAAO,gBAAkB,QAAQ;;;;;;iBAM1C,MAAM,OAAO,aAAa,QAAQ;;cAErC,iBAAiB"}
@@ -21689,7 +21689,7 @@ var import_out = require_out();
21689
21689
  */
21690
21690
  /** Narrows the shared BuildAdapter to this extension's own descriptor — the value-level mirror of the registry routing on (extension, type). `dir` is optional: absent is the single-file form. */
21691
21691
  function isNodeBuild(descriptor) {
21692
- return descriptor.type === "node" && (!("dir" in descriptor) || typeof descriptor.dir === "string") && (!("dependencies" in descriptor) || descriptor.dependencies === "bundled" || descriptor.dependencies === "external");
21692
+ return descriptor.type === "node" && (!("dir" in descriptor) || typeof descriptor.dir === "string") && (!("dependencies" in descriptor) || descriptor.dependencies === "bundled" || descriptor.dependencies === "external") && (!("dev" in descriptor) || descriptor.dev === void 0 || Array.isArray(descriptor.dev) && descriptor.dev.every((arg) => typeof arg === "string"));
21693
21693
  }
21694
21694
  const allowedDependencies = [
21695
21695
  void 0,
@@ -21951,15 +21951,32 @@ async function assemble(input) {
21951
21951
  watch: [runnable.source]
21952
21952
  };
21953
21953
  }
21954
+ /**
21955
+ * The author's `dev` command, run in the authoring module's directory
21956
+ * (ADR-0004, ADR-0056), or `undefined` when they wrote none. Nothing is
21957
+ * appended to it: the command reads `PORT` and `HOST` from its environment.
21958
+ */
21959
+ async function serve(input) {
21960
+ if (!isNodeBuild(input.build)) throw new Error(`@prisma/composer/node/control: expected a "node" build adapter, got "${input.build.type}".`);
21961
+ const dev = input.build.dev;
21962
+ if (dev === void 0) return void 0;
21963
+ if (dev.length === 0) throw new Error("node(): `dev` must name a command");
21964
+ return {
21965
+ cwd: path$1.dirname(fileURLToPath(input.build.module)),
21966
+ argv: () => dev,
21967
+ display: dev.join(" ")
21968
+ };
21969
+ }
21954
21970
  /** The node build extension descriptor — the `composer` section of `prisma.config.ts` lists it under `extensions`. */
21955
21971
  const nodeBuild = () => ({
21956
21972
  id: "@prisma/composer/node",
21957
21973
  nodes: { node: {
21958
21974
  kind: "build",
21959
- assemble
21975
+ assemble,
21976
+ serve
21960
21977
  } }
21961
21978
  });
21962
21979
  //#endregion
21963
- export { assemble, nodeBuild };
21980
+ export { assemble, nodeBuild, serve };
21964
21981
 
21965
21982
  //# sourceMappingURL=node-control.mjs.map