@prisma/composer 0.28.0 → 0.29.0

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 (45) hide show
  1. package/dist/{app-config-3CswwwoZ-DFjnySqN.d.mts → app-config-BcftSukw-DQ7AzYh_.d.mts} +5 -3
  2. package/dist/{app-config-3CswwwoZ-DFjnySqN.d.mts.map → app-config-BcftSukw-DQ7AzYh_.d.mts.map} +1 -1
  3. package/dist/config-DSyEHcQB.d.mts +1 -0
  4. package/dist/config.d.mts +2 -2
  5. package/dist/control.d.mts +5 -5
  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-DSyEHcQB.d.mts +1 -0
  10. package/dist/deploy.d.mts +2 -2
  11. package/dist/{deployment-summary-CU-eVvJM-B8prOwIp.d.mts → deployment-summary-CU-eVvJM-dIXYs31n.d.mts} +3 -3
  12. package/dist/{deployment-summary-CU-eVvJM-B8prOwIp.d.mts.map → deployment-summary-CU-eVvJM-dIXYs31n.d.mts.map} +1 -1
  13. package/dist/{dev-D5mgw4vL-ChhDjyGs.mjs → dev-B512jpX2-DsJoYKHE.mjs} +4 -4
  14. package/dist/{dev-D5mgw4vL-ChhDjyGs.mjs.map → dev-B512jpX2-DsJoYKHE.mjs.map} +1 -1
  15. package/dist/{execute-deploy-destroy-1Nn5Pz26-Bgbc4ZpD.mjs → execute-deploy-destroy-Bdzq1chG-D7xwo2CH.mjs} +24 -22
  16. package/dist/execute-deploy-destroy-Bdzq1chG-D7xwo2CH.mjs.map +1 -0
  17. package/dist/{execute-dev-BnKUgJhb-DOden3PU.mjs → execute-dev-6Peq7g1_-B1-kpm4n.mjs} +25 -31
  18. package/dist/execute-dev-6Peq7g1_-B1-kpm4n.mjs.map +1 -0
  19. package/dist/{execute-log-COAVD35o-DSphbVHe.mjs → execute-log-D377Dx_F-DWV0k_qs.mjs} +4 -4
  20. package/dist/{execute-log-COAVD35o-DSphbVHe.mjs.map → execute-log-D377Dx_F-DWV0k_qs.mjs.map} +1 -1
  21. package/dist/{local-target-B4xoiDAV.mjs → local-target-BUZG9uLx.mjs} +7 -2
  22. package/dist/local-target-BUZG9uLx.mjs.map +1 -0
  23. package/dist/local-target.d.mts +4 -2
  24. package/dist/local-target.d.mts.map +1 -1
  25. package/dist/local-target.mjs +2 -2
  26. package/dist/nextjs-control.d.mts +3 -3
  27. package/dist/node-control.d.mts +3 -3
  28. package/dist/node-control.mjs +47 -28
  29. package/dist/node-control.mjs.map +1 -1
  30. package/dist/node.d.mts +14 -1
  31. package/dist/node.d.mts.map +1 -1
  32. package/dist/node.mjs +2 -1
  33. package/dist/node.mjs.map +1 -1
  34. package/dist/report.d.mts +3 -3
  35. package/dist/run-alchemy-CTw3BXKq-CN1gfeNJ.mjs +218 -0
  36. package/dist/run-alchemy-CTw3BXKq-CN1gfeNJ.mjs.map +1 -0
  37. package/package.json +12 -15
  38. package/skills/prisma-composer-core-concepts/SKILL.md +47 -32
  39. package/dist/config-0y3sE6iC.d.mts +0 -1
  40. package/dist/deploy-0y3sE6iC.d.mts +0 -1
  41. package/dist/execute-deploy-destroy-1Nn5Pz26-Bgbc4ZpD.mjs.map +0 -1
  42. package/dist/execute-dev-BnKUgJhb-DOden3PU.mjs.map +0 -1
  43. package/dist/local-target-B4xoiDAV.mjs.map +0 -1
  44. package/dist/run-alchemy-BEvB2sYQ-Cy2fhbcu.mjs +0 -99
  45. package/dist/run-alchemy-BEvB2sYQ-Cy2fhbcu.mjs.map +0 -1
@@ -21665,15 +21665,16 @@ var import_out = require_out();
21665
21665
  * app's code.
21666
21666
  *
21667
21667
  * Two forms, chosen by the descriptor: without `dir`, `entry` is a single
21668
- * self-contained file and only that file is copied. With `dir`, the whole
21669
- * directory is copied verbatim and `entry` names the file inside it that boots.
21670
- * The directory form also follows the declared entry's static runtime dependency
21671
- * graph and stages those files beside the output. The staging root is derived
21672
- * from the declared paths and the traced files themselves — never from the
21673
- * deploy cwd — so the bundle's layout is the same whichever directory the
21674
- * deploy is invoked from. This is deterministic dependency assembly (not app
21668
+ * file and only that file is copied. With `dir`, the whole directory is copied
21669
+ * verbatim and `entry` names the file inside it that boots. Either form with
21670
+ * `dependencies: 'external'` also follows the declared entry's static runtime
21671
+ * dependency graph and stages those files beside the output. The staging root
21672
+ * is derived from the declared paths and the traced files themselves — never
21673
+ * from the deploy cwd — so the bundle's layout is the same whichever directory
21674
+ * the deploy is invoked from. This is deterministic dependency assembly (not app
21675
21675
  * bundling), and is what makes framework outputs such as Astro's Node adapter
21676
- * self-contained.
21676
+ * self-contained. With the default, `dependencies: 'bundled'`, nothing is
21677
+ * traced: the author's build already inlined its packages.
21677
21678
  *
21678
21679
  * The wrapper is a SEPARATE esbuild build of the service module (declarations
21679
21680
  * only, whose node carries run()/load()), emitted as `main.mjs` at the
@@ -21688,8 +21689,13 @@ var import_out = require_out();
21688
21689
  */
21689
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. */
21690
21691
  function isNodeBuild(descriptor) {
21691
- return descriptor.type === "node" && (!("dir" in descriptor) || typeof descriptor.dir === "string");
21692
+ return descriptor.type === "node" && (!("dir" in descriptor) || typeof descriptor.dir === "string") && (!("dependencies" in descriptor) || descriptor.dependencies === "bundled" || descriptor.dependencies === "external");
21692
21693
  }
21694
+ const allowedDependencies = [
21695
+ void 0,
21696
+ "bundled",
21697
+ "external"
21698
+ ];
21693
21699
  /** The single-file form: `entry` is the whole built runnable, resolved against dirname(module) (ADR-0004). */
21694
21700
  function resolveFile(entrySpec, moduleDir) {
21695
21701
  const entryPath = path$1.resolve(moduleDir, entrySpec);
@@ -21776,13 +21782,13 @@ function stagedRuntimePath(source, stagingRoot, bundleDir) {
21776
21782
  const stagedSegments = nodeModules === -1 ? segments : segments.slice(nodeModules);
21777
21783
  return path$1.join(bundleDir, ...stagedSegments);
21778
21784
  }
21779
- async function copyTracedEntry(source, destination, stagingRoot, bundleDir, dirPath) {
21785
+ async function copyTracedEntry(source, destination, stagingRoot, bundleDir, copied) {
21780
21786
  const stat = await fs$1.promises.lstat(source);
21781
21787
  await fs$1.promises.mkdir(path$1.dirname(destination), { recursive: true });
21782
21788
  if (stat.isSymbolicLink()) {
21783
21789
  const realTarget = await fs$1.promises.realpath(source);
21784
21790
  if (!isWithin(stagingRoot, realTarget)) throw new Error(`the runtime dependency trace found a symlink outside its staging root: ${source} -> ${realTarget}`);
21785
- const stagedTarget = isWithin(dirPath, realTarget) ? path$1.join(bundleDir, path$1.relative(dirPath, realTarget)) : stagedRuntimePath(realTarget, stagingRoot, bundleDir);
21791
+ const stagedTarget = isWithin(copied.source, realTarget) ? path$1.join(copied.at, path$1.relative(copied.source, realTarget)) : stagedRuntimePath(realTarget, stagingRoot, bundleDir);
21786
21792
  await createBundleLink(destination, path$1.relative(path$1.dirname(destination), stagedTarget), (await fs$1.promises.stat(realTarget)).isDirectory() ? "dir" : "file", {
21787
21793
  resolvedTarget: stagedTarget,
21788
21794
  copySource: realTarget,
@@ -21809,19 +21815,20 @@ async function copyTracedEntry(source, destination, stagingRoot, bundleDir, dirP
21809
21815
  * would stage arbitrary reachable files. The path that widened it is named so
21810
21816
  * the author can see which dependency caused it.
21811
21817
  */
21812
- function stagingRootFor(moduleDir, dirPath, tracedPaths) {
21813
- let root = commonAncestor(moduleDir, dirPath);
21814
- if (isFilesystemRoot(root)) throw new Error(`the build adapter's dir ("${dirPath}") and the directory of its module ("${moduleDir}") share no common ancestor below the filesystem root, so runtime dependency staging has no root to work from.`);
21818
+ function stagingRootFor(moduleDir, outputPath, tracedPaths) {
21819
+ let root = commonAncestor(moduleDir, outputPath);
21820
+ if (isFilesystemRoot(root)) throw new Error(`the build output ("${outputPath}") and the directory of its module ("${moduleDir}") share no common ancestor below the filesystem root, so runtime dependency staging has no root to work from.`);
21815
21821
  for (const traced of tracedPaths) {
21816
21822
  const widened = commonAncestor(root, traced);
21817
- if (isFilesystemRoot(widened)) throw new Error(`the runtime dependency trace reached ${traced}, which shares no directory with the build output ("${dirPath}") below the filesystem root — staging from there would sweep in arbitrary files. Keep the traced dependency inside the project that holds the build output.`);
21823
+ if (isFilesystemRoot(widened)) throw new Error(`the runtime dependency trace reached ${traced}, which shares no directory with the build output ("${outputPath}") below the filesystem root — staging from there would sweep in arbitrary files. Keep the traced dependency inside the project that holds the build output.`);
21818
21824
  root = widened;
21819
21825
  }
21820
21826
  return root;
21821
21827
  }
21822
- /** Stages the explicit entry's runtime file graph beside the copied build dir.
21828
+ /** Stages the explicit entry's runtime file graph beside the copied build output.
21823
21829
  * `nodeFileTrace` follows import/require/package metadata; it does not rewrite
21824
- * the app. Files already supplied by `dir` remain the author's verbatim copy.
21830
+ * the app. Files already supplied by the build output (`dir`, or the single
21831
+ * entry file) remain the author's verbatim copy.
21825
21832
  *
21826
21833
  * The trace itself runs from the filesystem root so nothing it finds is dropped
21827
21834
  * for sitting outside a narrower base — a pnpm virtual store at the workspace
@@ -21834,11 +21841,15 @@ function stagingRootFor(moduleDir, dirPath, tracedPaths) {
21834
21841
  * trace never visits, while nft's `conditions` option replaces the default
21835
21842
  * set rather than extending it. */
21836
21843
  async function stageRuntimeDependencies(options) {
21837
- const [moduleDir, entryPath, dirPath] = await Promise.all([
21844
+ const [moduleDir, entryPath, outputPath] = await Promise.all([
21838
21845
  fs$1.promises.realpath(options.moduleDir),
21839
21846
  fs$1.promises.realpath(options.entryPath),
21840
- fs$1.promises.realpath(options.dirPath)
21847
+ fs$1.promises.realpath(options.outputPath)
21841
21848
  ]);
21849
+ const copied = {
21850
+ source: outputPath,
21851
+ at: options.outputAt
21852
+ };
21842
21853
  const base = path$1.parse(moduleDir).root;
21843
21854
  const [nodeTrace, bunTrace] = await Promise.all([(0, import_out.nodeFileTrace)([entryPath], {
21844
21855
  base,
@@ -21856,11 +21867,11 @@ async function stageRuntimeDependencies(options) {
21856
21867
  origin: await realPathOrSelf(source)
21857
21868
  };
21858
21869
  }));
21859
- const stagingRoot = stagingRootFor(moduleDir, dirPath, tracedEntries.flatMap(({ source, origin }) => [source, origin]));
21870
+ const stagingRoot = stagingRootFor(moduleDir, outputPath, tracedEntries.flatMap(({ source, origin }) => [source, origin]));
21860
21871
  const stagedFrom = /* @__PURE__ */ new Map();
21861
21872
  let bytesStaged = 0;
21862
21873
  for (const { source, origin } of tracedEntries) {
21863
- if (isWithin(dirPath, source)) continue;
21874
+ if (isWithin(outputPath, source)) continue;
21864
21875
  const destination = stagedRuntimePath(source, stagingRoot, options.bundleDir);
21865
21876
  const alreadyStaged = stagedFrom.get(destination);
21866
21877
  if (alreadyStaged !== void 0) {
@@ -21868,7 +21879,7 @@ async function stageRuntimeDependencies(options) {
21868
21879
  throw new Error(`two runtime dependencies stage to the same bundle path ("${path$1.relative(options.bundleDir, destination).split(path$1.sep).join("/")}"): ${alreadyStaged} and ${origin}. Staging keeps each file's path from its first node_modules segment, so two packages of the same name installed at different depths collapse onto one location — deduplicate them in your install so only one version is reachable.`);
21869
21880
  }
21870
21881
  if (await pathExists(destination)) continue;
21871
- bytesStaged += await copyTracedEntry(source, destination, stagingRoot, options.bundleDir, dirPath);
21882
+ bytesStaged += await copyTracedEntry(source, destination, stagingRoot, options.bundleDir, copied);
21872
21883
  stagedFrom.set(destination, origin);
21873
21884
  }
21874
21885
  return {
@@ -21888,8 +21899,10 @@ function assertOutsideWorkDir(runnable, workDir) {
21888
21899
  if (workDir.startsWith(source + path$1.sep)) throw new Error(`the deploy working dir ("${workDir}") sits inside the build adapter's ${sourceField} ("${source}"), so assembling would copy the artifact into itself — point ${sourceField} at your build output elsewhere.`);
21889
21900
  }
21890
21901
  async function assemble(input) {
21902
+ if ("dependencies" in input.build && !allowedDependencies.includes(input.build.dependencies)) throw new Error(`the node build adapter's dependencies must be 'bundled' or 'external', got "${String(input.build.dependencies)}"`);
21891
21903
  if (!isNodeBuild(input.build)) throw new Error(`@prisma/composer/node/control: expected a "node" build adapter, got "${input.build.type}".`);
21892
21904
  const buildDescriptor = input.build;
21905
+ const dependencies = buildDescriptor.dependencies ?? "bundled";
21893
21906
  const serviceModule = fileURLToPath(buildDescriptor.module);
21894
21907
  const moduleDir = path$1.dirname(serviceModule);
21895
21908
  const runnable = buildDescriptor.dir === void 0 ? resolveFile(buildDescriptor.entry, moduleDir) : await resolveDir(buildDescriptor.dir, buildDescriptor.entry, moduleDir);
@@ -21912,17 +21925,23 @@ async function assemble(input) {
21912
21925
  if (!fs$1.existsSync(path$1.join(workDir, "main.mjs"))) throw new Error(`esbuild produced no main.mjs in ${workDir}`);
21913
21926
  const bundleDir = path$1.join(workDir, "bundle");
21914
21927
  await runnable.copyInto(bundleDir);
21915
- if (buildDescriptor.dir === void 0) input.report?.({ form: "file" });
21928
+ const form = buildDescriptor.dir === void 0 ? "file" : "directory";
21929
+ if (dependencies === "bundled") input.report?.({
21930
+ form,
21931
+ dependencies
21932
+ });
21916
21933
  else {
21917
- const staged = await stageRuntimeDependencies({
21918
- entryPath: path$1.join(runnable.source, ...runnable.entry.split("/")),
21919
- dirPath: runnable.source,
21934
+ const counts = await stageRuntimeDependencies({
21935
+ entryPath: form === "file" ? runnable.source : path$1.join(runnable.source, ...runnable.entry.split("/")),
21936
+ outputPath: runnable.source,
21937
+ outputAt: form === "file" ? path$1.join(bundleDir, runnable.entry) : bundleDir,
21920
21938
  moduleDir,
21921
21939
  bundleDir
21922
21940
  });
21923
21941
  input.report?.({
21924
- form: "directory",
21925
- ...staged
21942
+ form,
21943
+ dependencies,
21944
+ ...counts
21926
21945
  });
21927
21946
  }
21928
21947
  await assertBundleSymlinksStayInside(bundleDir);