@prisma/composer 0.2.0-dev.9 → 0.3.0-dev.1
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/dist/{app-config-BPb3LCdH-CH7b8Khi.d.mts → app-config-Dw3r7sUa-D3dr8rg2.d.mts} +87 -3
- package/dist/app-config-Dw3r7sUa-D3dr8rg2.d.mts.map +1 -0
- package/dist/app-config-joXc-BKm-CdcXqNMD.mjs +22 -0
- package/dist/app-config-joXc-BKm-CdcXqNMD.mjs.map +1 -0
- package/dist/bin.mjs +2344 -182
- package/dist/bin.mjs.map +1 -1
- package/dist/config-121C4hAb.d.mts +1 -0
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +2 -9
- package/dist/deploy-121C4hAb.d.mts +1 -0
- package/dist/deploy-H3PKi0ZR-Chgm12Bn.mjs +313 -0
- package/dist/deploy-H3PKi0ZR-Chgm12Bn.mjs.map +1 -0
- package/dist/deploy.d.mts +2 -2
- package/dist/deploy.mjs +1 -311
- package/dist/local-target.d.mts +29 -0
- package/dist/local-target.d.mts.map +1 -0
- package/dist/local-target.mjs +47 -0
- package/dist/local-target.mjs.map +1 -0
- package/dist/nextjs-control.d.mts +3 -3
- package/dist/nextjs-control.mjs +2 -1
- package/dist/nextjs-control.mjs.map +1 -1
- package/dist/node-control.d.mts +3 -3
- package/dist/node-control.mjs +44 -25
- package/dist/node-control.mjs.map +1 -1
- package/dist/report.d.mts +2 -2
- package/package.json +11 -10
- package/src/exports/local-target.ts +1 -0
- package/dist/app-config-BPb3LCdH-CH7b8Khi.d.mts.map +0 -1
- package/dist/config-Cqu_-Hna.d.mts +0 -1
- package/dist/config.mjs.map +0 -1
- package/dist/deploy-Cqu_-Hna.d.mts +0 -1
- package/dist/deploy.mjs.map +0 -1
package/dist/deploy.mjs
CHANGED
|
@@ -1,312 +1,2 @@
|
|
|
1
|
-
import { s as
|
|
2
|
-
import { r as deserializeContainers } from "./container-transport-DKmKg5JQ-DKWs0ubK.mjs";
|
|
3
|
-
import * as Alchemy from "alchemy";
|
|
4
|
-
import * as Effect from "effect/Effect";
|
|
5
|
-
import * as Layer from "effect/Layer";
|
|
6
|
-
//#region ../../0-framework/1-core/core/dist/deploy.mjs
|
|
7
|
-
var LowerError = class extends Error {
|
|
8
|
-
constructor(message) {
|
|
9
|
-
super(message);
|
|
10
|
-
this.name = "LowerError";
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Resolves one SERVICE-OWN param to its config value. The full resolution
|
|
15
|
-
* order across both value channels:
|
|
16
|
-
*
|
|
17
|
-
* 1. A param claiming BOTH a provision-time binding and a `provision` need
|
|
18
|
-
* (ADR-0031) is a loud error — two sources for one value.
|
|
19
|
-
* 2. A provision-time binding (a schema-validated literal, or an opaque
|
|
20
|
-
* `ParamSource` the target resolves at boot per ADR-0019) beats the
|
|
21
|
-
* declared `default`.
|
|
22
|
-
* 3. A framework-minted `provision` need is resolved per dependency EDGE
|
|
23
|
-
* against the consumer extension's registry — that path fills CONNECTION
|
|
24
|
-
* params in `buildConfig`'s inputs loop, never this function. A
|
|
25
|
-
* service-own param has no edge to mint against, so an unbound need here
|
|
26
|
-
* falls through like any unbound param.
|
|
27
|
-
* 4. The `default`, else absent (only legal when `optional`), else a loud
|
|
28
|
-
* error naming the param, the service, and the fix.
|
|
29
|
-
*/
|
|
30
|
-
function resolveParam(node, serviceId, name, param, bound) {
|
|
31
|
-
if (bound !== void 0) {
|
|
32
|
-
if (param.provision !== void 0) throw new LowerError(`Param "${name}" of "${serviceId}" (service "${node.name}") has two sources claiming one value: a provision-time binding (${isParamSource(bound) ? "a param source" : "a literal value"}) AND a framework provision need ("${String(param.provision.brand)}") on its declaration — remove the binding or drop the \`provision\` facet.`);
|
|
33
|
-
if (isParamSource(bound)) return bound;
|
|
34
|
-
const result = param.schema["~standard"].validate(bound);
|
|
35
|
-
if (result instanceof Promise) throw new LowerError(`Param "${name}" of "${serviceId}" (service "${node.name}") uses an async Standard Schema — a provision-time literal value requires a synchronous validator.`);
|
|
36
|
-
if (result.issues !== void 0) {
|
|
37
|
-
const messages = result.issues.map((issue) => issue.message).join("; ");
|
|
38
|
-
throw new LowerError(`Param "${name}" of "${serviceId}" (service "${node.name}") received an invalid provision-time value: ${messages}`);
|
|
39
|
-
}
|
|
40
|
-
return result.value;
|
|
41
|
-
}
|
|
42
|
-
if (param.default !== void 0) return param.default;
|
|
43
|
-
if (param.optional === true) return void 0;
|
|
44
|
-
throw new LowerError(`Param "${name}" of "${serviceId}" (service "${node.name}") has no default, is not optional, and was not bound at provision — bind it with a literal value or a param source (e.g. envParam('NAME')) on its provision() call, or give it a default.`);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Assembles a service's typed Config. Connection params come from the
|
|
48
|
-
* dependency edge's lowered outputs — or, for a param carrying a `provision`
|
|
49
|
-
* need (ADR-0031), from `provisioned` (keyed by edge id): the framework mints
|
|
50
|
-
* it, the producer hands nothing over. The service's own params resolve via
|
|
51
|
-
* `resolveParam` (provision-time binding, then default, then loud
|
|
52
|
-
* unbound-required failure).
|
|
53
|
-
*
|
|
54
|
-
* This is also where the connection contract is enforced: a producer that fails to
|
|
55
|
-
* supply a required param its consumer's connection declares fails the deploy
|
|
56
|
-
* here, naming the edge, rather than reaching the consumer as `undefined`.
|
|
57
|
-
*/
|
|
58
|
-
function buildConfig(node, id, graph, lowered, provisioned) {
|
|
59
|
-
const inputs = {};
|
|
60
|
-
for (const [inputName, inputNode] of Object.entries(node.inputs)) {
|
|
61
|
-
const edge = graph.edges.find((e) => e.to === id && e.input === inputName && e.kind === "dependency");
|
|
62
|
-
const producedOutputs = edge !== void 0 ? lowered.get(edge.from) ?? {} : {};
|
|
63
|
-
const values = {};
|
|
64
|
-
for (const [name, param] of Object.entries(inputNode.connection.params)) {
|
|
65
|
-
if (param.provision !== void 0) {
|
|
66
|
-
values[name] = provisioned.get(`${id}.${inputName}`);
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
const value = producedOutputs[name];
|
|
70
|
-
if (value === void 0 && param.optional !== true && edge !== void 0) throw new LowerError(`Connection input "${id}.${inputName}" declares param "${name}", but its producer "${edge.from}" did not supply it — the producer's outputs carry [${Object.keys(producedOutputs).join(", ") || "nothing"}]. Add "${name}" to the outputs the producer returns from its lowering, or declare the param optional on the connection.`);
|
|
71
|
-
values[name] = value;
|
|
72
|
-
}
|
|
73
|
-
inputs[inputName] = values;
|
|
74
|
-
}
|
|
75
|
-
const boundParams = new Map(graph.params.filter((binding) => binding.serviceAddress === id).map((b) => [b.slot, b.binding]));
|
|
76
|
-
const service = {};
|
|
77
|
-
for (const [name, param] of Object.entries(node.params)) {
|
|
78
|
-
const value = resolveParam(node, id, name, param, boundParams.get(name));
|
|
79
|
-
if (value !== void 0) service[name] = value;
|
|
80
|
-
}
|
|
81
|
-
return {
|
|
82
|
-
service,
|
|
83
|
-
inputs
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Joins resolved report entries back to their graph nodes — the last step of a
|
|
88
|
-
* deploy report, run inside the Action with apply's resolved values.
|
|
89
|
-
*
|
|
90
|
-
* The entries cross Alchemy's action-input boundary, so they carry addresses
|
|
91
|
-
* and plain entities only; the graph is held by closure on this side. That
|
|
92
|
-
* split is why this join exists at all, and it is what keeps functions and
|
|
93
|
-
* Standard Schemas (which a node carries, and which the plan's input hash
|
|
94
|
-
* would have to serialize) out of the input.
|
|
95
|
-
*
|
|
96
|
-
* Skips an address the graph no longer holds: entries are data, the graph is
|
|
97
|
-
* truth.
|
|
98
|
-
*/
|
|
99
|
-
function joinDeployment(graph, entries) {
|
|
100
|
-
const nodes = [];
|
|
101
|
-
for (const entry of entries) {
|
|
102
|
-
const node = graph.nodes.find((n) => n.id === entry.address)?.node;
|
|
103
|
-
if (node === void 0 || node.kind !== "service" && node.kind !== "resource") continue;
|
|
104
|
-
nodes.push({
|
|
105
|
-
address: entry.address,
|
|
106
|
-
node,
|
|
107
|
-
entities: entry.entities
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
return nodes;
|
|
111
|
-
}
|
|
112
|
-
function missingBundleError(id) {
|
|
113
|
-
return new LowerError(`No bundle provided for service "${id}" (opts.bundles["${id}"] is required).`);
|
|
114
|
-
}
|
|
115
|
-
function duplicateExtensionError(id) {
|
|
116
|
-
return new LowerError(`Extension "${id}" is listed more than once in \`extensions\` — each extension id must be unique.`);
|
|
117
|
-
}
|
|
118
|
-
/** Registries as extension id → descriptor. Fails on a duplicate id — the CLI validates config, but lowering() is the programmatic escape hatch that doesn't. */
|
|
119
|
-
function extensionsById(config) {
|
|
120
|
-
const map = /* @__PURE__ */ new Map();
|
|
121
|
-
for (const extension of config.extensions) {
|
|
122
|
-
if (map.has(extension.id)) return Effect.fail(duplicateExtensionError(extension.id));
|
|
123
|
-
map.set(extension.id, extension);
|
|
124
|
-
}
|
|
125
|
-
return Effect.succeed(map);
|
|
126
|
-
}
|
|
127
|
-
function unknownExtensionError(extension, id) {
|
|
128
|
-
return new LowerError(`No extension "${extension}" is configured (needed by node "${id}") — add it to prisma-composer.config.ts's \`extensions\` (import its /control entry and list its descriptor).`);
|
|
129
|
-
}
|
|
130
|
-
function unknownNodeTypeError(extension, type) {
|
|
131
|
-
return new LowerError(`Extension "${extension.id}" has no descriptor for node type "${type}" (known: ${Object.keys(extension.nodes).join(", ")}).`);
|
|
132
|
-
}
|
|
133
|
-
/** A provisioned param's need brand isn't registered by the consumer's extension (ADR-0031). */
|
|
134
|
-
function unknownProvisionerError(extension, brand, edgeId) {
|
|
135
|
-
const known = extension.provisions !== void 0 && extension.provisions.size > 0 ? Array.from(extension.provisions.keys(), String).join(", ") : "(none registered)";
|
|
136
|
-
return new LowerError(`Extension "${extension.id}" has no provisioner for need "${String(brand)}" (needed by edge "${edgeId}") (known: ${known}).`);
|
|
137
|
-
}
|
|
138
|
-
/** A provisioned edge whose consumer and provider nodes belong to different extensions (ADR-0031). */
|
|
139
|
-
function crossExtensionProvisionError(edgeId) {
|
|
140
|
-
return new LowerError(`Provisioned edge "${edgeId}" spans two extensions — cross-extension provisioned edges aren't supported yet.`);
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* More than one provisioned param on one connection (ADR-0031). One edge mints
|
|
144
|
-
* ONE value, keyed by edge id, so a second need on the same connection would
|
|
145
|
-
* silently receive the first's value under the first's brand.
|
|
146
|
-
*/
|
|
147
|
-
function multipleProvisionedParamsError(edgeId, names) {
|
|
148
|
-
return new LowerError(`Connection input "${edgeId}" declares more than one provisioned param (${names.join(", ")}) — only one provisioned param per connection is supported.`);
|
|
149
|
-
}
|
|
150
|
-
function wrongKindError(extension, type, expected, got) {
|
|
151
|
-
return new LowerError(`Extension "${extension}"'s descriptor for node type "${type}" is a "${got}" descriptor — this node needs a "${expected}" descriptor.`);
|
|
152
|
-
}
|
|
153
|
-
/** Looks up one node's descriptor: extension by `node.extension`, then descriptor by `node.type`, then the kind check. */
|
|
154
|
-
function descriptorFor(extensions, node, id) {
|
|
155
|
-
const extension = extensions.get(node.extension);
|
|
156
|
-
if (extension === void 0) return Effect.fail(unknownExtensionError(node.extension, id));
|
|
157
|
-
const descriptor = extension.nodes[node.type];
|
|
158
|
-
if (descriptor === void 0) return Effect.fail(unknownNodeTypeError(extension, node.type));
|
|
159
|
-
if (descriptor.kind !== node.kind) return Effect.fail(wrongKindError(node.extension, node.type, node.kind, descriptor.kind));
|
|
160
|
-
return Effect.succeed(descriptor);
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* The state-layer precedence a deploy resolves to: an explicit opts.state
|
|
164
|
-
* always wins; failing that, the config's own (required) state descriptor,
|
|
165
|
-
* created with its owning extension's resolved container (`undefined` when
|
|
166
|
-
* that extension declared none). A pure function so the precedence is
|
|
167
|
-
* testable without booting Alchemy.
|
|
168
|
-
*/
|
|
169
|
-
function resolveStateLayer(opts, config, containers) {
|
|
170
|
-
return opts.state ?? config.state.create(containers.get(config.state.extension));
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* All configured extensions' providers merged, config array order — an
|
|
174
|
-
* extension without `providers` is skipped; no used-extensions-only
|
|
175
|
-
* filtering (ADR-0017's pinned providers rule).
|
|
176
|
-
*/
|
|
177
|
-
function mergedProviders(config) {
|
|
178
|
-
const [first, ...rest] = config.extensions.flatMap((extension) => extension.providers !== void 0 ? [extension.providers()] : []);
|
|
179
|
-
return first === void 0 ? Layer.empty : Layer.mergeAll(first, ...rest);
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Composable form for mixed stacks: hand-wired Alchemy resources alongside Prisma App nodes in one stack effect.
|
|
183
|
-
* Fails with LowerError or whatever an extension's lowering raises — the error type is open.
|
|
184
|
-
*/
|
|
185
|
-
function lowering(root, config, opts) {
|
|
186
|
-
return Effect.gen(function* () {
|
|
187
|
-
const graph = Load(root, { id: opts.name });
|
|
188
|
-
const extensions = yield* extensionsById(config);
|
|
189
|
-
const containers = deserializeContainers(config.extensions, process.env);
|
|
190
|
-
const lowered = /* @__PURE__ */ new Map();
|
|
191
|
-
const entries = [];
|
|
192
|
-
const provisioned = /* @__PURE__ */ new Map();
|
|
193
|
-
const applications = /* @__PURE__ */ new Map();
|
|
194
|
-
for (const descriptor of config.extensions) {
|
|
195
|
-
if (descriptor.application === void 0) continue;
|
|
196
|
-
const appCtx = {
|
|
197
|
-
id: graph.root.id,
|
|
198
|
-
address: "",
|
|
199
|
-
node: graph.root.node,
|
|
200
|
-
graph,
|
|
201
|
-
opts,
|
|
202
|
-
application: void 0,
|
|
203
|
-
container: containers.get(descriptor.id),
|
|
204
|
-
lowered,
|
|
205
|
-
provisioned
|
|
206
|
-
};
|
|
207
|
-
applications.set(descriptor.id, yield* descriptor.application.provision(appCtx));
|
|
208
|
-
}
|
|
209
|
-
for (const edge of graph.edges) {
|
|
210
|
-
if (edge.kind !== "dependency") continue;
|
|
211
|
-
const consumer = graph.nodes.find((n) => n.id === edge.to)?.node;
|
|
212
|
-
if (consumer === void 0 || consumer.kind !== "service") continue;
|
|
213
|
-
const slot = consumer.inputs[edge.input];
|
|
214
|
-
if (slot === void 0) continue;
|
|
215
|
-
const provisionedParams = Object.entries(slot.connection.params).filter(([, param]) => param.provision !== void 0);
|
|
216
|
-
if (provisionedParams.length === 0) continue;
|
|
217
|
-
const edgeId = `${edge.to}.${edge.input}`;
|
|
218
|
-
if (provisionedParams.length > 1) return yield* Effect.fail(multipleProvisionedParamsError(edgeId, provisionedParams.map(([name]) => name)));
|
|
219
|
-
const need = provisionedParams[0]?.[1].provision;
|
|
220
|
-
if (need === void 0) continue;
|
|
221
|
-
const provider = graph.nodes.find((n) => n.id === edge.from)?.node;
|
|
222
|
-
if (provider === void 0 || provider.kind !== "service" && provider.kind !== "resource") continue;
|
|
223
|
-
if (consumer.extension !== provider.extension) return yield* Effect.fail(crossExtensionProvisionError(edgeId));
|
|
224
|
-
const extension = extensions.get(consumer.extension);
|
|
225
|
-
if (extension === void 0) return yield* Effect.fail(unknownExtensionError(consumer.extension, edge.to));
|
|
226
|
-
const provisioner = extension.provisions?.get(need.brand);
|
|
227
|
-
if (provisioner === void 0) return yield* Effect.fail(unknownProvisionerError(extension, need.brand, edgeId));
|
|
228
|
-
const ref = yield* provisioner.provision({
|
|
229
|
-
edgeId,
|
|
230
|
-
consumerAddress: edge.to,
|
|
231
|
-
providerAddress: edge.from,
|
|
232
|
-
input: edge.input,
|
|
233
|
-
need
|
|
234
|
-
});
|
|
235
|
-
provisioned.set(edgeId, ref);
|
|
236
|
-
}
|
|
237
|
-
for (const { id, node } of graph.nodes) {
|
|
238
|
-
if (node.kind === "module") continue;
|
|
239
|
-
if (node.kind === "dependency") continue;
|
|
240
|
-
const ctx = {
|
|
241
|
-
id,
|
|
242
|
-
address: id,
|
|
243
|
-
node,
|
|
244
|
-
graph,
|
|
245
|
-
opts,
|
|
246
|
-
application: applications.get(node.extension),
|
|
247
|
-
container: containers.get(node.extension),
|
|
248
|
-
lowered,
|
|
249
|
-
provisioned
|
|
250
|
-
};
|
|
251
|
-
const descriptor = yield* descriptorFor(extensions, node, id);
|
|
252
|
-
if (descriptor.kind === "resource") {
|
|
253
|
-
const result = yield* descriptor(ctx);
|
|
254
|
-
lowered.set(id, result.outputs);
|
|
255
|
-
entries.push({
|
|
256
|
-
address: id,
|
|
257
|
-
entities: result.entities
|
|
258
|
-
});
|
|
259
|
-
continue;
|
|
260
|
-
}
|
|
261
|
-
if (descriptor.kind !== "service") return yield* Effect.fail(wrongKindError(node.extension, node.type, node.kind, descriptor.kind));
|
|
262
|
-
const service = node;
|
|
263
|
-
const provisionedNode = yield* descriptor.provision(ctx);
|
|
264
|
-
const typedConfig = buildConfig(service, id, graph, lowered, provisioned);
|
|
265
|
-
const serialized = yield* descriptor.serialize(ctx, provisionedNode, typedConfig);
|
|
266
|
-
const bundle = opts.bundles[id];
|
|
267
|
-
if (bundle === void 0) return yield* Effect.fail(missingBundleError(id));
|
|
268
|
-
const artifact = yield* descriptor.package(ctx, {
|
|
269
|
-
assembled: {
|
|
270
|
-
dir: bundle.dir,
|
|
271
|
-
entry: bundle.entry
|
|
272
|
-
},
|
|
273
|
-
address: id
|
|
274
|
-
});
|
|
275
|
-
const result = yield* descriptor.deploy(ctx, provisionedNode, artifact, serialized);
|
|
276
|
-
lowered.set(id, result.outputs);
|
|
277
|
-
entries.push({
|
|
278
|
-
address: id,
|
|
279
|
-
entities: result.entities
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
if (opts.report !== void 0) {
|
|
283
|
-
const report = opts.report;
|
|
284
|
-
yield* Alchemy.Action("composer-deployment-report", (input) => Effect.sync(() => {
|
|
285
|
-
report({
|
|
286
|
-
app: opts.name,
|
|
287
|
-
nodes: joinDeployment(graph, input.entries)
|
|
288
|
-
});
|
|
289
|
-
}))({
|
|
290
|
-
nonce: Date.now(),
|
|
291
|
-
entries
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* The whole-stack wrapper: Load → route each node through the config's
|
|
298
|
-
* extension registries → an Alchemy Stack (the default export the alchemy
|
|
299
|
-
* CLI consumes).
|
|
300
|
-
*/
|
|
301
|
-
function lower(root, config, opts) {
|
|
302
|
-
const stackEffect = Effect.orDie(lowering(root, config, opts));
|
|
303
|
-
const containers = deserializeContainers(config.extensions, process.env);
|
|
304
|
-
return Alchemy.Stack(opts.name, {
|
|
305
|
-
providers: mergedProviders(config),
|
|
306
|
-
state: resolveStateLayer(opts, config, containers)
|
|
307
|
-
}, stackEffect);
|
|
308
|
-
}
|
|
309
|
-
//#endregion
|
|
1
|
+
import { a as lowering, i as lower, n as buildConfig, o as mergedProviders, r as joinDeployment, s as resolveStateLayer, t as LowerError } from "./deploy-H3PKi0ZR-Chgm12Bn.mjs";
|
|
310
2
|
export { LowerError, buildConfig, joinDeployment, lower, lowering, mergedProviders, resolveStateLayer };
|
|
311
|
-
|
|
312
|
-
//# sourceMappingURL=deploy.mjs.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { O as PrismaAppConfig, _ as LocalTargetProvidersInput, c as DEV_DIR, g as LocalTargetEmulatorsInput, h as LocalTargetDescriptor, m as LocalTargetAttachment, p as LocalTargetAttachInput, s as ContainerInstance } from "./app-config-Dw3r7sUa-D3dr8rg2.mjs";
|
|
2
|
+
import * as Layer from "effect/Layer";
|
|
3
|
+
//#region ../../0-framework/1-core/core/dist/local-target.d.mts
|
|
4
|
+
//#region src/control/local-target.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Resolves every non-build-only configured extension's lazy `localTarget`
|
|
7
|
+
* thunk, once (ADR-0041's lazy local-target reference — operator directive:
|
|
8
|
+
* the production control entry carries only the thunk, never the
|
|
9
|
+
* descriptor, so resolving it is this module's job, not something a deploy
|
|
10
|
+
* path ever does). A build-only extension (`isBuildOnlyExtension`) owns no
|
|
11
|
+
* resources or services and is skipped entirely — never even checked for a
|
|
12
|
+
* `localTarget` thunk. Every other configured extension must be
|
|
13
|
+
* local-target-capable, or the dev command cannot bring the app up at all,
|
|
14
|
+
* so a missing thunk throws naming the extension. The generated dev stack
|
|
15
|
+
* module calls this once and threads the resolved map through every
|
|
16
|
+
* subsequent hook, including `localTargetProviders`.
|
|
17
|
+
*/
|
|
18
|
+
declare function resolveLocalTargets(config: PrismaAppConfig): Promise<ReadonlyMap<string, LocalTargetDescriptor>>;
|
|
19
|
+
/**
|
|
20
|
+
* All configured extensions' local-target providers merged, config array
|
|
21
|
+
* order (ADR-0041), from the ALREADY-RESOLVED descriptor map
|
|
22
|
+
* (`resolveLocalTargets`'s product — this function itself never touches a
|
|
23
|
+
* `localTarget` thunk). The generated dev stack module is this
|
|
24
|
+
* aggregator's one caller, passing the result as `LowerOptions.providers`.
|
|
25
|
+
*/
|
|
26
|
+
declare function localTargetProviders(resolved: ReadonlyMap<string, LocalTargetDescriptor>, containers: ReadonlyMap<string, ContainerInstance>, devDir: string): Layer.Layer<never>;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { DEV_DIR, type LocalTargetAttachInput, type LocalTargetAttachment, type LocalTargetDescriptor, type LocalTargetEmulatorsInput, type LocalTargetProvidersInput, localTargetProviders, resolveLocalTargets };
|
|
29
|
+
//# sourceMappingURL=local-target.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-target.d.mts","names":[],"sources":["../../../0-framework/1-core/core/dist/local-target.d.mts"],"mappings":";;;;;;;;;;;;;;;;;iBAgBiB,oBAAoB,QAAQ,kBAAkB,QAAQ,oBAAoB;;;;;;;;iBAQ1E,qBAAqB,UAAU,oBAAoB,wBAAwB,YAAY,oBAAoB,oBAAoB,iBAAiB,MAAM"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { r as isBuildOnlyExtension, t as DEV_DIR } from "./app-config-joXc-BKm-CdcXqNMD.mjs";
|
|
2
|
+
import { t as LowerError } from "./deploy-H3PKi0ZR-Chgm12Bn.mjs";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
//#region ../../0-framework/1-core/core/dist/local-target.mjs
|
|
5
|
+
/** The local-target stack's own provider aggregation (ADR-0041; naming, operator 2026-07-23 — the seam is `localTarget`, "dev" names the user-facing feature only) — the local-target counterpart of `deploy.ts`'s `mergedProviders`, kept in its own module so `lower()` learns nothing about it (deploy.ts's REVISED — operator review of #162). */
|
|
6
|
+
function noLocalTargetSupportError(id) {
|
|
7
|
+
return new LowerError(`extension "${id}" has no dev support — it declares no \`localTarget\` descriptor (ADR-0041).`);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Resolves every non-build-only configured extension's lazy `localTarget`
|
|
11
|
+
* thunk, once (ADR-0041's lazy local-target reference — operator directive:
|
|
12
|
+
* the production control entry carries only the thunk, never the
|
|
13
|
+
* descriptor, so resolving it is this module's job, not something a deploy
|
|
14
|
+
* path ever does). A build-only extension (`isBuildOnlyExtension`) owns no
|
|
15
|
+
* resources or services and is skipped entirely — never even checked for a
|
|
16
|
+
* `localTarget` thunk. Every other configured extension must be
|
|
17
|
+
* local-target-capable, or the dev command cannot bring the app up at all,
|
|
18
|
+
* so a missing thunk throws naming the extension. The generated dev stack
|
|
19
|
+
* module calls this once and threads the resolved map through every
|
|
20
|
+
* subsequent hook, including `localTargetProviders`.
|
|
21
|
+
*/
|
|
22
|
+
async function resolveLocalTargets(config) {
|
|
23
|
+
const entries = await Promise.all(config.extensions.flatMap((extension) => {
|
|
24
|
+
if (isBuildOnlyExtension(extension)) return [];
|
|
25
|
+
if (extension.localTarget === void 0) throw noLocalTargetSupportError(extension.id);
|
|
26
|
+
return [extension.localTarget().then((descriptor) => [extension.id, descriptor])];
|
|
27
|
+
}));
|
|
28
|
+
return new Map(entries);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* All configured extensions' local-target providers merged, config array
|
|
32
|
+
* order (ADR-0041), from the ALREADY-RESOLVED descriptor map
|
|
33
|
+
* (`resolveLocalTargets`'s product — this function itself never touches a
|
|
34
|
+
* `localTarget` thunk). The generated dev stack module is this
|
|
35
|
+
* aggregator's one caller, passing the result as `LowerOptions.providers`.
|
|
36
|
+
*/
|
|
37
|
+
function localTargetProviders(resolved, containers, devDir) {
|
|
38
|
+
const [first, ...rest] = [...resolved.entries()].map(([id, descriptor]) => descriptor.providers({
|
|
39
|
+
container: containers.get(id),
|
|
40
|
+
devDir
|
|
41
|
+
}));
|
|
42
|
+
return first === void 0 ? Layer.empty : Layer.mergeAll(first, ...rest);
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { DEV_DIR, localTargetProviders, resolveLocalTargets };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=local-target.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-target.mjs","names":[],"sources":["../../../0-framework/1-core/core/dist/local-target.mjs"],"sourcesContent":["import { t as LowerError } from \"./deploy-H3PKi0ZR.mjs\";\nimport { r as isBuildOnlyExtension, t as DEV_DIR } from \"./app-config-joXc-BKm.mjs\";\nimport * as Layer from \"effect/Layer\";\n//#region src/control/local-target.ts\n/** The local-target stack's own provider aggregation (ADR-0041; naming, operator 2026-07-23 — the seam is `localTarget`, \"dev\" names the user-facing feature only) — the local-target counterpart of `deploy.ts`'s `mergedProviders`, kept in its own module so `lower()` learns nothing about it (deploy.ts's REVISED — operator review of #162). */\nfunction noLocalTargetSupportError(id) {\n\treturn new LowerError(`extension \"${id}\" has no dev support — it declares no \\`localTarget\\` descriptor (ADR-0041).`);\n}\n/**\n* Resolves every non-build-only configured extension's lazy `localTarget`\n* thunk, once (ADR-0041's lazy local-target reference — operator directive:\n* the production control entry carries only the thunk, never the\n* descriptor, so resolving it is this module's job, not something a deploy\n* path ever does). A build-only extension (`isBuildOnlyExtension`) owns no\n* resources or services and is skipped entirely — never even checked for a\n* `localTarget` thunk. Every other configured extension must be\n* local-target-capable, or the dev command cannot bring the app up at all,\n* so a missing thunk throws naming the extension. The generated dev stack\n* module calls this once and threads the resolved map through every\n* subsequent hook, including `localTargetProviders`.\n*/\nasync function resolveLocalTargets(config) {\n\tconst entries = await Promise.all(config.extensions.flatMap((extension) => {\n\t\tif (isBuildOnlyExtension(extension)) return [];\n\t\tif (extension.localTarget === void 0) throw noLocalTargetSupportError(extension.id);\n\t\treturn [extension.localTarget().then((descriptor) => [extension.id, descriptor])];\n\t}));\n\treturn new Map(entries);\n}\n/**\n* All configured extensions' local-target providers merged, config array\n* order (ADR-0041), from the ALREADY-RESOLVED descriptor map\n* (`resolveLocalTargets`'s product — this function itself never touches a\n* `localTarget` thunk). The generated dev stack module is this\n* aggregator's one caller, passing the result as `LowerOptions.providers`.\n*/\nfunction localTargetProviders(resolved, containers, devDir) {\n\tconst [first, ...rest] = [...resolved.entries()].map(([id, descriptor]) => descriptor.providers({\n\t\tcontainer: containers.get(id),\n\t\tdevDir\n\t}));\n\treturn first === void 0 ? Layer.empty : Layer.mergeAll(first, ...rest);\n}\n//#endregion\nexport { DEV_DIR, localTargetProviders, resolveLocalTargets };\n\n//# sourceMappingURL=local-target.mjs.map"],"mappings":";;;;;AAKA,SAAS,0BAA0B,IAAI;CACtC,OAAO,IAAI,WAAW,cAAc,GAAG,6EAA6E;AACrH;;;;;;;;;;;;;;AAcA,eAAe,oBAAoB,QAAQ;CAC1C,MAAM,UAAU,MAAM,QAAQ,IAAI,OAAO,WAAW,SAAS,cAAc;EAC1E,IAAI,qBAAqB,SAAS,GAAG,OAAO,CAAC;EAC7C,IAAI,UAAU,gBAAgB,KAAK,GAAG,MAAM,0BAA0B,UAAU,EAAE;EAClF,OAAO,CAAC,UAAU,YAAY,CAAC,CAAC,MAAM,eAAe,CAAC,UAAU,IAAI,UAAU,CAAC,CAAC;CACjF,CAAC,CAAC;CACF,OAAO,IAAI,IAAI,OAAO;AACvB;;;;;;;;AAQA,SAAS,qBAAqB,UAAU,YAAY,QAAQ;CAC3D,MAAM,CAAC,OAAO,GAAG,QAAQ,CAAC,GAAG,SAAS,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,gBAAgB,WAAW,UAAU;EAC/F,WAAW,WAAW,IAAI,EAAE;EAC5B;CACD,CAAC,CAAC;CACF,OAAO,UAAU,KAAK,IAAI,MAAM,QAAQ,MAAM,SAAS,OAAO,GAAG,IAAI;AACtE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as Bundle,
|
|
2
|
-
import "./config-
|
|
3
|
-
import "./deploy-
|
|
1
|
+
import { a as Bundle, f as ExtensionDescriptor, i as AssembleInput } from "./app-config-Dw3r7sUa-D3dr8rg2.mjs";
|
|
2
|
+
import "./config-121C4hAb.mjs";
|
|
3
|
+
import "./deploy-121C4hAb.mjs";
|
|
4
4
|
import { t as NextjsBuildAdapter } from "./nextjs-DLyeRR7M-DwnBjryZ.mjs";
|
|
5
5
|
//#region ../../0-framework/2-authoring/nextjs/dist/control.d.mts
|
|
6
6
|
//#region src/control/build.d.ts
|
package/dist/nextjs-control.mjs
CHANGED
|
@@ -88,7 +88,8 @@ async function assemble(input) {
|
|
|
88
88
|
if (!fs.existsSync(path.join(workDir, "main.mjs"))) throw new Error(`esbuild produced no main.mjs in ${workDir}`);
|
|
89
89
|
return {
|
|
90
90
|
dir: workDir,
|
|
91
|
-
entry: path.posix.join("bundle", appRel.split(path.sep).join("/"), "server.js")
|
|
91
|
+
entry: path.posix.join("bundle", appRel.split(path.sep).join("/"), "server.js"),
|
|
92
|
+
watch: [standaloneRoot]
|
|
92
93
|
};
|
|
93
94
|
}
|
|
94
95
|
/** The nextjs build extension descriptor — `prisma-composer.config.ts` lists it under `extensions`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nextjs-control.mjs","names":[],"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 { 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-composer.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, so a symlinked (non-hoisted)\n* node_modules is the packager's hard error — the same misconfiguration crashes\n* the standalone server at boot, so it must be a flat install (npm, or pnpm/bun\n* with a hoisted node-linker).\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}\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 nextAppRel(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\tconst posixRel = typeof relativeAppDir === \"string\" ? relativeAppDir : typeof tracingRoot === \"string\" ? path.relative(tracingRoot, appDir).split(path.sep).join(\"/\") : void 0;\n\tif (posixRel === void 0) throw new Error(`${manifestPath} records neither relativeAppDir nor config.outputFileTracingRoot — cannot locate the standalone server`);\n\treturn posixRel.split(\"/\").join(path.sep);\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\treturn path.join(appDir, \".next\", \"standalone\", nextAppRel(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 appRel = nextAppRel(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 fs.promises.cp(standaloneRoot, bundleDir, { recursive: true });\n\tconst appOut = path.join(bundleDir, appRel);\n\tconst staticSrc = path.join(appDir, \".next\", \"static\");\n\tif (fs.existsSync(staticSrc)) await fs.promises.cp(staticSrc, path.join(appOut, \".next\", \"static\"), { recursive: true });\n\tconst publicSrc = path.join(appDir, \"public\");\n\tif (fs.existsSync(publicSrc)) await fs.promises.cp(publicSrc, path.join(appOut, \"public\"), { recursive: true });\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};\n}\n/** The nextjs build extension descriptor — `prisma-composer.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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,SAAS,cAAc,YAAY;CAClC,OAAO,WAAW,SAAS,YAAY,YAAY,cAAc,OAAO,WAAW,WAAW;AAC/F;;;;;;;;;AASA,SAAS,WAAW,QAAQ;CAC3B,MAAM,eAAe,KAAK,KAAK,QAAQ,SAAS,4BAA4B;CAC5E,IAAI,CAAC,GAAG,WAAW,YAAY,GAAG,MAAM,IAAI,MAAM,MAAM,KAAK,KAAK,SAAS,4BAA4B,EAAE,SAAS,OAAO,uDAAuD;CAChL,MAAM,WAAW,KAAK,MAAM,GAAG,aAAa,cAAc,MAAM,CAAC;CACjE,MAAM,iBAAiB,UAAU;CACjC,MAAM,cAAc,UAAU,QAAQ;CACtC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AAM,SAAS,KAAK,KAAK,WAAW,MAAM;CAC1C,MAAM,YAAY,KAAK,KAAK,QAAQ,SAAS,QAAQ;CACrD,IAAI,GAAG,WAAW,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,KAAK,KAAK,QAAQ,SAAS,QAAQ,GAAG,EAAE,WAAW,KAAK,CAAC;CACvH,MAAM,YAAY,KAAK,KAAK,QAAQ,QAAQ;CAC5C,IAAI,GAAG,WAAW,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,KAAK,KAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAK,CAAC;CAC9G,MAAM,MAAM;EACX,aAAa,EAAE,MAAM,cAAc,gBAAgB,MAAM,EAAE;EAC3D,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,UAAU;EACV,UAAU,CAAC,OAAO,OAAO;EACzB,cAAc,EAAE,OAAO,OAAO;CAC/B,CAAC;CACD,IAAI,CAAC,GAAG,WAAW,KAAK,KAAK,SAAS,UAAU,CAAC,GAAG,MAAM,IAAI,MAAM,mCAAmC,SAAS;CAChH,OAAO;EACN,KAAK;EACL,OAAO,KAAK,MAAM,KAAK,UAAU,OAAO,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,GAAG,WAAW;
|
|
1
|
+
{"version":3,"file":"nextjs-control.mjs","names":[],"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 { 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-composer.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, so a symlinked (non-hoisted)\n* node_modules is the packager's hard error — the same misconfiguration crashes\n* the standalone server at boot, so it must be a flat install (npm, or pnpm/bun\n* with a hoisted node-linker).\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}\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 nextAppRel(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\tconst posixRel = typeof relativeAppDir === \"string\" ? relativeAppDir : typeof tracingRoot === \"string\" ? path.relative(tracingRoot, appDir).split(path.sep).join(\"/\") : void 0;\n\tif (posixRel === void 0) throw new Error(`${manifestPath} records neither relativeAppDir nor config.outputFileTracingRoot — cannot locate the standalone server`);\n\treturn posixRel.split(\"/\").join(path.sep);\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\treturn path.join(appDir, \".next\", \"standalone\", nextAppRel(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 appRel = nextAppRel(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 fs.promises.cp(standaloneRoot, bundleDir, { recursive: true });\n\tconst appOut = path.join(bundleDir, appRel);\n\tconst staticSrc = path.join(appDir, \".next\", \"static\");\n\tif (fs.existsSync(staticSrc)) await fs.promises.cp(staticSrc, path.join(appOut, \".next\", \"static\"), { recursive: true });\n\tconst publicSrc = path.join(appDir, \"public\");\n\tif (fs.existsSync(publicSrc)) await fs.promises.cp(publicSrc, path.join(appOut, \"public\"), { recursive: true });\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]\n\t};\n}\n/** The nextjs build extension descriptor — `prisma-composer.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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA,SAAS,cAAc,YAAY;CAClC,OAAO,WAAW,SAAS,YAAY,YAAY,cAAc,OAAO,WAAW,WAAW;AAC/F;;;;;;;;;AASA,SAAS,WAAW,QAAQ;CAC3B,MAAM,eAAe,KAAK,KAAK,QAAQ,SAAS,4BAA4B;CAC5E,IAAI,CAAC,GAAG,WAAW,YAAY,GAAG,MAAM,IAAI,MAAM,MAAM,KAAK,KAAK,SAAS,4BAA4B,EAAE,SAAS,OAAO,uDAAuD;CAChL,MAAM,WAAW,KAAK,MAAM,GAAG,aAAa,cAAc,MAAM,CAAC;CACjE,MAAM,iBAAiB,UAAU;CACjC,MAAM,cAAc,UAAU,QAAQ;CACtC,MAAM,WAAW,OAAO,mBAAmB,WAAW,iBAAiB,OAAO,gBAAgB,WAAW,KAAK,SAAS,aAAa,MAAM,CAAC,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,IAAI,KAAK;CAC7K,IAAI,aAAa,KAAK,GAAG,MAAM,IAAI,MAAM,GAAG,aAAa,uG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ACvH,MAAM,YAAY,KAAK,KAAK,QAAQ,QAAQ;CAC5C,IAAI,GAAG,WAAW,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,KAAK,KAAK,QAAQ,QAAQ,GAAG,EAAE,WAAW,KAAK,CAAC;CAC9G,MAAM,MAAM;EACX,aAAa,EAAE,MAAM,cAAc,gBAAgB,MAAM,EAAE;EAC3D,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,UAAU;EACV,UAAU,CAAC,OAAO,OAAO;EACzB,cAAc,EAAE,OAAO,OAAO;CAC/B,CAAC;CACD,IAAI,CAAC,GAAG,WAAW,KAAK,KAAK,SAAS,UAAU,CAAC,GAAG,MAAM,IAAI,MAAM,mCAAmC,SAAS;CAChH,OAAO;EACN,KAAK;EACL,OAAO,KAAK,MAAM,KAAK,UAAU,OAAO,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,GAAG,WAAW;EAC9E,OAAO,CAAC,cAAc;CACvB;AACD;;AAEA,MAAM,qBAAqB;CAC1B,IAAI;CACJ,OAAO,EAAE,QAAQ;EAChB,MAAM;EACN;CACD,EAAE;AACH"}
|
package/dist/node-control.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as Bundle,
|
|
2
|
-
import "./config-
|
|
3
|
-
import "./deploy-
|
|
1
|
+
import { a as Bundle, f as ExtensionDescriptor, i as AssembleInput } from "./app-config-Dw3r7sUa-D3dr8rg2.mjs";
|
|
2
|
+
import "./config-121C4hAb.mjs";
|
|
3
|
+
import "./deploy-121C4hAb.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>;
|
package/dist/node-control.mjs
CHANGED
|
@@ -46,26 +46,10 @@ function resolveFile(entrySpec, moduleDir) {
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
* followed — only `dir` is ever copied.
|
|
54
|
-
*/
|
|
55
|
-
async function resolveDir(dirSpec, entrySpec, moduleDir) {
|
|
56
|
-
const dirPath = path.resolve(moduleDir, dirSpec);
|
|
57
|
-
if (!fs.existsSync(dirPath)) throw new Error(`no built directory at ${dirPath} — run your build first (the build adapter's dir, "${dirSpec}", resolves against dirname(module)).`);
|
|
58
|
-
if (!fs.statSync(dirPath).isDirectory()) throw new Error(`the build adapter's dir ("${dirPath}") is not a directory — drop dir to deploy a single built file, naming it as entry.`);
|
|
59
|
-
const entryPath = path.resolve(dirPath, entrySpec);
|
|
60
|
-
if (!entryPath.startsWith(dirPath + path.sep)) throw new Error(`the build adapter's entry ("${entrySpec}") resolves to ${entryPath}, which is not inside dir ("${dirPath}") — in the directory form entry names a file inside dir, and only dir is copied.`);
|
|
61
|
-
if (!fs.existsSync(entryPath) || !fs.statSync(entryPath).isFile()) throw new Error(`no built entry at ${entryPath} — run your build first (the build adapter's entry, "${entrySpec}", resolves inside dir, "${dirPath}").`);
|
|
62
|
-
await assertNoSymlinks(dirPath);
|
|
63
|
-
return {
|
|
64
|
-
source: dirPath,
|
|
65
|
-
sourceField: "dir",
|
|
66
|
-
entry: path.relative(dirPath, entryPath).split(path.sep).join("/"),
|
|
67
|
-
copyInto: (bundleDir) => fs.promises.cp(dirPath, bundleDir, { recursive: true })
|
|
68
|
-
};
|
|
49
|
+
/** The shared "dir contains symlinks" error, reused by both the root-is-a-symlink case and the nested-symlink walk below — one message shape, never two to drift apart. */
|
|
50
|
+
function symlinksFoundError(dirPath, found) {
|
|
51
|
+
const listed = found.slice(0, 5).join(", ");
|
|
52
|
+
return /* @__PURE__ */ new Error(`the build adapter's dir ("${dirPath}") contains symlinks, which the platform's packager rejects: ${listed}${found.length > 5 ? `, and ${found.length - 5} more` : ""}. The tree is copied verbatim, so make your build emit real files in dir (for example, a hoisted node_modules, or dereference the links into dir with cp -RL).`);
|
|
69
53
|
}
|
|
70
54
|
/**
|
|
71
55
|
* Compute's packager rejects symlinks, so a tree containing one cannot deploy.
|
|
@@ -73,7 +57,10 @@ async function resolveDir(dirSpec, entrySpec, moduleDir) {
|
|
|
73
57
|
* the artifact must be what the author's build produced (ADR-0005), and
|
|
74
58
|
* following a link that points outside `dir` would pull in files the author
|
|
75
59
|
* never named. The walk reads dirents (lstat semantics), so a symlinked
|
|
76
|
-
* directory is reported and never descended into.
|
|
60
|
+
* directory is reported and never descended into. Checks only `dirPath`'s
|
|
61
|
+
* children — the caller (`resolveDir`) checks `dirPath` itself before this
|
|
62
|
+
* runs, since that check also decides "not a directory" vs "is a symlink"
|
|
63
|
+
* and must happen before any dereferencing stat.
|
|
77
64
|
*/
|
|
78
65
|
async function assertNoSymlinks(dirPath) {
|
|
79
66
|
const found = [];
|
|
@@ -85,9 +72,40 @@ async function assertNoSymlinks(dirPath) {
|
|
|
85
72
|
}
|
|
86
73
|
};
|
|
87
74
|
await walk(dirPath);
|
|
88
|
-
if (found.length
|
|
89
|
-
|
|
90
|
-
|
|
75
|
+
if (found.length > 0) throw symlinksFoundError(dirPath, found);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The directory form: `dir` is the built tree, resolved against dirname(module)
|
|
79
|
+
* (ADR-0004) and copied whole; `entry` resolves inside `dir` and names the file
|
|
80
|
+
* that boots. An `entry` that resolves outside `dir` is rejected rather than
|
|
81
|
+
* followed — only `dir` is ever copied.
|
|
82
|
+
*
|
|
83
|
+
* `dir` itself can be a symlink — not just something inside it. `lstat` it
|
|
84
|
+
* before anything else so that case hard-errors identically whether the link
|
|
85
|
+
* points at a real directory (which a dereferencing `stat` would otherwise
|
|
86
|
+
* accept as "is a directory") or at a file: neither is ever silently
|
|
87
|
+
* dereferenced and copied (ADR-0005).
|
|
88
|
+
*/
|
|
89
|
+
async function resolveDir(dirSpec, entrySpec, moduleDir) {
|
|
90
|
+
const dirPath = path.resolve(moduleDir, dirSpec);
|
|
91
|
+
let dirLstat;
|
|
92
|
+
try {
|
|
93
|
+
dirLstat = await fs.promises.lstat(dirPath);
|
|
94
|
+
} catch {
|
|
95
|
+
throw new Error(`no built directory at ${dirPath} — run your build first (the build adapter's dir, "${dirSpec}", resolves against dirname(module)).`);
|
|
96
|
+
}
|
|
97
|
+
if (dirLstat.isSymbolicLink()) throw symlinksFoundError(dirPath, [dirPath]);
|
|
98
|
+
if (!dirLstat.isDirectory()) throw new Error(`the build adapter's dir ("${dirPath}") is not a directory — drop dir to deploy a single built file, naming it as entry.`);
|
|
99
|
+
const entryPath = path.resolve(dirPath, entrySpec);
|
|
100
|
+
if (!entryPath.startsWith(dirPath + path.sep)) throw new Error(`the build adapter's entry ("${entrySpec}") resolves to ${entryPath}, which is not inside dir ("${dirPath}") — in the directory form entry names a file inside dir, and only dir is copied.`);
|
|
101
|
+
if (!fs.existsSync(entryPath) || !fs.statSync(entryPath).isFile()) throw new Error(`no built entry at ${entryPath} — run your build first (the build adapter's entry, "${entrySpec}", resolves inside dir, "${dirPath}").`);
|
|
102
|
+
await assertNoSymlinks(dirPath);
|
|
103
|
+
return {
|
|
104
|
+
source: dirPath,
|
|
105
|
+
sourceField: "dir",
|
|
106
|
+
entry: path.relative(dirPath, entryPath).split(path.sep).join("/"),
|
|
107
|
+
copyInto: (bundleDir) => fs.promises.cp(dirPath, bundleDir, { recursive: true })
|
|
108
|
+
};
|
|
91
109
|
}
|
|
92
110
|
/**
|
|
93
111
|
* The working dir is cleared on every assemble, so it must not overlap the copy
|
|
@@ -125,7 +143,8 @@ async function assemble(input) {
|
|
|
125
143
|
await runnable.copyInto(path.join(workDir, "bundle"));
|
|
126
144
|
return {
|
|
127
145
|
dir: workDir,
|
|
128
|
-
entry: path.posix.join("bundle", runnable.entry)
|
|
146
|
+
entry: path.posix.join("bundle", runnable.entry),
|
|
147
|
+
watch: [runnable.source]
|
|
129
148
|
};
|
|
130
149
|
}
|
|
131
150
|
/** The node build extension descriptor — `prisma-composer.config.ts` lists it under `extensions`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-control.mjs","names":[],"sources":["../../../0-framework/2-authoring/node/dist/control.mjs"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { build } from \"esbuild\";\n//#region src/control/build.ts\n/**\n* The extension's control entry (ADR-0017): `nodeBuild()` returns the build\n* descriptor `prisma-composer.config.ts` lists. Deploy-only (ADR-0005): the user\n* builds their own runnable; `assemble` copies what they built under `bundle/`\n* and adds the framework's boot wrapper — it never bundles or transforms the\n* app's code.\n*\n* Two forms, chosen by the descriptor: without `dir`, `entry` is a single\n* self-contained file and only that file is copied. With `dir`, the whole\n* directory is copied verbatim and `entry` names the file inside it that boots.\n* Neither form discovers anything — no tree-walking for an entry, no filename\n* heuristics; the author states the paths and we copy exactly those.\n*\n* The wrapper is a SEPARATE esbuild build of the service module (declarations\n* only, whose node carries run()/load()), emitted as `main.mjs` at the\n* working-dir root — a dictated name (object entry `{ main }`), not a\n* discovered one. run() and the app entry must be independent module instances\n* that hand off through process.env, so the wrapper is its own self-contained\n* build; `@prisma/*` is inlined, `bun` is a Compute built-in.\n*\n* Artifact layout: `<cwd>/.prisma-composer/artifacts/<address>/` (deploy-owned,\n* ADR-0005) holds `main.mjs` at the root and the app's built runnable under\n* `bundle/`.\n*/\n/** 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. */\nfunction isNodeBuild(descriptor) {\n\treturn descriptor.type === \"node\" && (!(\"dir\" in descriptor) || typeof descriptor.dir === \"string\");\n}\n/** The single-file form: `entry` is the whole built runnable, resolved against dirname(module) (ADR-0004). */\nfunction resolveFile(entrySpec, moduleDir) {\n\tconst entryPath = path.resolve(moduleDir, entrySpec);\n\tif (!fs.existsSync(entryPath)) throw new Error(`no built entry at ${entryPath} — run your build first (the build adapter's entry, \"${entrySpec}\", resolves against dirname(module)).`);\n\tconst entryFile = path.basename(entryPath);\n\treturn {\n\t\tsource: entryPath,\n\t\tsourceField: \"entry\",\n\t\tentry: entryFile,\n\t\tcopyInto: async (bundleDir) => {\n\t\t\tawait fs.promises.mkdir(bundleDir, { recursive: true });\n\t\t\tawait fs.promises.copyFile(entryPath, path.join(bundleDir, entryFile));\n\t\t}\n\t};\n}\n/**\n* The directory form: `dir` is the built tree, resolved against dirname(module)\n* (ADR-0004) and copied whole; `entry` resolves inside `dir` and names the file\n* that boots. An `entry` that resolves outside `dir` is rejected rather than\n* followed — only `dir` is ever copied.\n*/\nasync function resolveDir(dirSpec, entrySpec, moduleDir) {\n\tconst dirPath = path.resolve(moduleDir, dirSpec);\n\tif (!fs.existsSync(dirPath)) throw new Error(`no built directory at ${dirPath} — run your build first (the build adapter's dir, \"${dirSpec}\", resolves against dirname(module)).`);\n\tif (!fs.statSync(dirPath).isDirectory()) throw new Error(`the build adapter's dir (\"${dirPath}\") is not a directory — drop dir to deploy a single built file, naming it as entry.`);\n\tconst entryPath = path.resolve(dirPath, entrySpec);\n\tif (!entryPath.startsWith(dirPath + path.sep)) throw new Error(`the build adapter's entry (\"${entrySpec}\") resolves to ${entryPath}, which is not inside dir (\"${dirPath}\") — in the directory form entry names a file inside dir, and only dir is copied.`);\n\tif (!fs.existsSync(entryPath) || !fs.statSync(entryPath).isFile()) throw new Error(`no built entry at ${entryPath} — run your build first (the build adapter's entry, \"${entrySpec}\", resolves inside dir, \"${dirPath}\").`);\n\tawait assertNoSymlinks(dirPath);\n\treturn {\n\t\tsource: dirPath,\n\t\tsourceField: \"dir\",\n\t\tentry: path.relative(dirPath, entryPath).split(path.sep).join(\"/\"),\n\t\tcopyInto: (bundleDir) => fs.promises.cp(dirPath, bundleDir, { recursive: true })\n\t};\n}\n/**\n* Compute's packager rejects symlinks, so a tree containing one cannot deploy.\n* We fail here, naming the links, rather than dereferencing them on the copy:\n* the artifact must be what the author's build produced (ADR-0005), and\n* following a link that points outside `dir` would pull in files the author\n* never named. The walk reads dirents (lstat semantics), so a symlinked\n* directory is reported and never descended into.\n*/\nasync function assertNoSymlinks(dirPath) {\n\tconst found = [];\n\tconst walk = async (current) => {\n\t\tfor (const entry of await fs.promises.readdir(current, { withFileTypes: true })) {\n\t\t\tconst full = path.join(current, entry.name);\n\t\t\tif (entry.isSymbolicLink()) found.push(full);\n\t\t\telse if (entry.isDirectory()) await walk(full);\n\t\t}\n\t};\n\tawait walk(dirPath);\n\tif (found.length === 0) return;\n\tconst listed = found.slice(0, 5).join(\", \");\n\tthrow new Error(`the build adapter's dir (\"${dirPath}\") contains symlinks, which the platform's packager rejects: ${listed}${found.length > 5 ? `, and ${found.length - 5} more` : \"\"}. The tree is copied verbatim, so make your build emit real files in dir (for example, a hoisted node_modules, or dereference the links into dir with cp -RL).`);\n}\n/**\n* The working dir is cleared on every assemble, so it must not overlap the copy\n* source: inside it, the rm would delete the source before the copy; the other\n* way round, the copy would recurse into its own output.\n*/\nfunction assertOutsideWorkDir(runnable, workDir) {\n\tconst { source, sourceField } = runnable;\n\tif (source === workDir || source.startsWith(workDir + path.sep)) throw new Error(`the build adapter's ${sourceField} (\"${source}\") resolves inside the deploy working dir (\"${workDir}\"), which is cleared on every assemble — point ${sourceField} at your build output elsewhere.`);\n\tif (workDir.startsWith(source + path.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.`);\n}\nasync function assemble(input) {\n\tif (!isNodeBuild(input.build)) throw new Error(`@prisma/composer/node/control: expected a \"node\" build adapter, got \"${input.build.type}\".`);\n\tconst buildDescriptor = input.build;\n\tconst serviceModule = fileURLToPath(buildDescriptor.module);\n\tconst moduleDir = path.dirname(serviceModule);\n\tconst runnable = buildDescriptor.dir === void 0 ? resolveFile(buildDescriptor.entry, moduleDir) : await resolveDir(buildDescriptor.dir, buildDescriptor.entry, moduleDir);\n\tconst workDir = path.join(input.cwd, \".prisma-composer\", \"artifacts\", input.address);\n\tassertOutsideWorkDir(runnable, workDir);\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\tawait build({\n\t\tentryPoints: { main: serviceModule },\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\tawait runnable.copyInto(path.join(workDir, \"bundle\"));\n\treturn {\n\t\tdir: workDir,\n\t\tentry: path.posix.join(\"bundle\", runnable.entry)\n\t};\n}\n/** The node build extension descriptor — `prisma-composer.config.ts` lists it under `extensions`. */\nconst nodeBuild = () => ({\n\tid: \"@prisma/composer/node\",\n\tnodes: { node: {\n\t\tkind: \"build\",\n\t\tassemble\n\t} }\n});\n//#endregion\nexport { assemble, nodeBuild };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAS,YAAY,YAAY;CAChC,OAAO,WAAW,SAAS,WAAW,EAAE,SAAS,eAAe,OAAO,WAAW,QAAQ;AAC3F;;AAEA,SAAS,YAAY,WAAW,WAAW;CAC1C,MAAM,YAAY,KAAK,QAAQ,WAAW,SAAS;CACnD,IAAI,CAAC,GAAG,WAAW,SAAS,GAAG,MAAM,IAAI,MAAM,qBAAqB,UAAU,uDAAuD,UAAU,sCAAsC;CACrL,MAAM,YAAY,KAAK,SAAS,SAAS;CACzC,OAAO;EACN,QAAQ;EACR,aAAa;EACb,OAAO;EACP,UAAU,OAAO,cAAc;GAC9B,MAAM,GAAG,SAAS,MAAM,WAAW,EAAE,WAAW,KAAK,CAAC;GACtD,MAAM,GAAG,SAAS,SAAS,WAAW,KAAK,KAAK,WAAW,SAAS,CAAC;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ACR,UAAU;EACV,UAAU,CAAC,OAAO,OAAO;EACzB,cAAc,EAAE,OAAO,OAAO;CAC/B,CAAC;CACD,IAAI,CAAC,GAAG,WAAW,KAAK,KAAK,SAAS,UAAU,CAAC,GAAG,MAAM,IAAI,MAAM,mCAAmC,SAAS;CAChH,MAAM,SAAS,SAAS,KAAK,KAAK,SAAS,QAAQ,CAAC;CACpD,OAAO;EACN,KAAK;EACL,OAAO,KAAK,MAAM,KAAK,UAAU,SAAS,KAAK;CAChD;AACD;;AAEA,MAAM,mBAAmB;CACxB,IAAI;CACJ,OAAO,EAAE,MAAM;EACd,MAAM;EACN;CACD,EAAE;AACH"}
|
|
1
|
+
{"version":3,"file":"node-control.mjs","names":[],"sources":["../../../0-framework/2-authoring/node/dist/control.mjs"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { build } from \"esbuild\";\n//#region src/control/build.ts\n/**\n* The extension's control entry (ADR-0017): `nodeBuild()` returns the build\n* descriptor `prisma-composer.config.ts` lists. Deploy-only (ADR-0005): the user\n* builds their own runnable; `assemble` copies what they built under `bundle/`\n* and adds the framework's boot wrapper — it never bundles or transforms the\n* app's code.\n*\n* Two forms, chosen by the descriptor: without `dir`, `entry` is a single\n* self-contained file and only that file is copied. With `dir`, the whole\n* directory is copied verbatim and `entry` names the file inside it that boots.\n* Neither form discovers anything — no tree-walking for an entry, no filename\n* heuristics; the author states the paths and we copy exactly those.\n*\n* The wrapper is a SEPARATE esbuild build of the service module (declarations\n* only, whose node carries run()/load()), emitted as `main.mjs` at the\n* working-dir root — a dictated name (object entry `{ main }`), not a\n* discovered one. run() and the app entry must be independent module instances\n* that hand off through process.env, so the wrapper is its own self-contained\n* build; `@prisma/*` is inlined, `bun` is a Compute built-in.\n*\n* Artifact layout: `<cwd>/.prisma-composer/artifacts/<address>/` (deploy-owned,\n* ADR-0005) holds `main.mjs` at the root and the app's built runnable under\n* `bundle/`.\n*/\n/** 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. */\nfunction isNodeBuild(descriptor) {\n\treturn descriptor.type === \"node\" && (!(\"dir\" in descriptor) || typeof descriptor.dir === \"string\");\n}\n/** The single-file form: `entry` is the whole built runnable, resolved against dirname(module) (ADR-0004). */\nfunction resolveFile(entrySpec, moduleDir) {\n\tconst entryPath = path.resolve(moduleDir, entrySpec);\n\tif (!fs.existsSync(entryPath)) throw new Error(`no built entry at ${entryPath} — run your build first (the build adapter's entry, \"${entrySpec}\", resolves against dirname(module)).`);\n\tconst entryFile = path.basename(entryPath);\n\treturn {\n\t\tsource: entryPath,\n\t\tsourceField: \"entry\",\n\t\tentry: entryFile,\n\t\tcopyInto: async (bundleDir) => {\n\t\t\tawait fs.promises.mkdir(bundleDir, { recursive: true });\n\t\t\tawait fs.promises.copyFile(entryPath, path.join(bundleDir, entryFile));\n\t\t}\n\t};\n}\n/** The shared \"dir contains symlinks\" error, reused by both the root-is-a-symlink case and the nested-symlink walk below — one message shape, never two to drift apart. */\nfunction symlinksFoundError(dirPath, found) {\n\tconst listed = found.slice(0, 5).join(\", \");\n\treturn /* @__PURE__ */ new Error(`the build adapter's dir (\"${dirPath}\") contains symlinks, which the platform's packager rejects: ${listed}${found.length > 5 ? `, and ${found.length - 5} more` : \"\"}. The tree is copied verbatim, so make your build emit real files in dir (for example, a hoisted node_modules, or dereference the links into dir with cp -RL).`);\n}\n/**\n* Compute's packager rejects symlinks, so a tree containing one cannot deploy.\n* We fail here, naming the links, rather than dereferencing them on the copy:\n* the artifact must be what the author's build produced (ADR-0005), and\n* following a link that points outside `dir` would pull in files the author\n* never named. The walk reads dirents (lstat semantics), so a symlinked\n* directory is reported and never descended into. Checks only `dirPath`'s\n* children — the caller (`resolveDir`) checks `dirPath` itself before this\n* runs, since that check also decides \"not a directory\" vs \"is a symlink\"\n* and must happen before any dereferencing stat.\n*/\nasync function assertNoSymlinks(dirPath) {\n\tconst found = [];\n\tconst walk = async (current) => {\n\t\tfor (const entry of await fs.promises.readdir(current, { withFileTypes: true })) {\n\t\t\tconst full = path.join(current, entry.name);\n\t\t\tif (entry.isSymbolicLink()) found.push(full);\n\t\t\telse if (entry.isDirectory()) await walk(full);\n\t\t}\n\t};\n\tawait walk(dirPath);\n\tif (found.length > 0) throw symlinksFoundError(dirPath, found);\n}\n/**\n* The directory form: `dir` is the built tree, resolved against dirname(module)\n* (ADR-0004) and copied whole; `entry` resolves inside `dir` and names the file\n* that boots. An `entry` that resolves outside `dir` is rejected rather than\n* followed — only `dir` is ever copied.\n*\n* `dir` itself can be a symlink — not just something inside it. `lstat` it\n* before anything else so that case hard-errors identically whether the link\n* points at a real directory (which a dereferencing `stat` would otherwise\n* accept as \"is a directory\") or at a file: neither is ever silently\n* dereferenced and copied (ADR-0005).\n*/\nasync function resolveDir(dirSpec, entrySpec, moduleDir) {\n\tconst dirPath = path.resolve(moduleDir, dirSpec);\n\tlet dirLstat;\n\ttry {\n\t\tdirLstat = await fs.promises.lstat(dirPath);\n\t} catch {\n\t\tthrow new Error(`no built directory at ${dirPath} — run your build first (the build adapter's dir, \"${dirSpec}\", resolves against dirname(module)).`);\n\t}\n\tif (dirLstat.isSymbolicLink()) throw symlinksFoundError(dirPath, [dirPath]);\n\tif (!dirLstat.isDirectory()) throw new Error(`the build adapter's dir (\"${dirPath}\") is not a directory — drop dir to deploy a single built file, naming it as entry.`);\n\tconst entryPath = path.resolve(dirPath, entrySpec);\n\tif (!entryPath.startsWith(dirPath + path.sep)) throw new Error(`the build adapter's entry (\"${entrySpec}\") resolves to ${entryPath}, which is not inside dir (\"${dirPath}\") — in the directory form entry names a file inside dir, and only dir is copied.`);\n\tif (!fs.existsSync(entryPath) || !fs.statSync(entryPath).isFile()) throw new Error(`no built entry at ${entryPath} — run your build first (the build adapter's entry, \"${entrySpec}\", resolves inside dir, \"${dirPath}\").`);\n\tawait assertNoSymlinks(dirPath);\n\treturn {\n\t\tsource: dirPath,\n\t\tsourceField: \"dir\",\n\t\tentry: path.relative(dirPath, entryPath).split(path.sep).join(\"/\"),\n\t\tcopyInto: (bundleDir) => fs.promises.cp(dirPath, bundleDir, { recursive: true })\n\t};\n}\n/**\n* The working dir is cleared on every assemble, so it must not overlap the copy\n* source: inside it, the rm would delete the source before the copy; the other\n* way round, the copy would recurse into its own output.\n*/\nfunction assertOutsideWorkDir(runnable, workDir) {\n\tconst { source, sourceField } = runnable;\n\tif (source === workDir || source.startsWith(workDir + path.sep)) throw new Error(`the build adapter's ${sourceField} (\"${source}\") resolves inside the deploy working dir (\"${workDir}\"), which is cleared on every assemble — point ${sourceField} at your build output elsewhere.`);\n\tif (workDir.startsWith(source + path.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.`);\n}\nasync function assemble(input) {\n\tif (!isNodeBuild(input.build)) throw new Error(`@prisma/composer/node/control: expected a \"node\" build adapter, got \"${input.build.type}\".`);\n\tconst buildDescriptor = input.build;\n\tconst serviceModule = fileURLToPath(buildDescriptor.module);\n\tconst moduleDir = path.dirname(serviceModule);\n\tconst runnable = buildDescriptor.dir === void 0 ? resolveFile(buildDescriptor.entry, moduleDir) : await resolveDir(buildDescriptor.dir, buildDescriptor.entry, moduleDir);\n\tconst workDir = path.join(input.cwd, \".prisma-composer\", \"artifacts\", input.address);\n\tassertOutsideWorkDir(runnable, workDir);\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\tawait build({\n\t\tentryPoints: { main: serviceModule },\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\tawait runnable.copyInto(path.join(workDir, \"bundle\"));\n\treturn {\n\t\tdir: workDir,\n\t\tentry: path.posix.join(\"bundle\", runnable.entry),\n\t\twatch: [runnable.source]\n\t};\n}\n/** The node build extension descriptor — `prisma-composer.config.ts` lists it under `extensions`. */\nconst nodeBuild = () => ({\n\tid: \"@prisma/composer/node\",\n\tnodes: { node: {\n\t\tkind: \"build\",\n\t\tassemble\n\t} }\n});\n//#endregion\nexport { assemble, nodeBuild };\n\n//# sourceMappingURL=control.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAS,YAAY,YAAY;CAChC,OAAO,WAAW,SAAS,WAAW,EAAE,SAAS,eAAe,OAAO,WAAW,QAAQ;AAC3F;;AAEA,SAAS,YAAY,WAAW,WAAW;CAC1C,MAAM,YAAY,KAAK,QAAQ,WAAW,SAAS;CACnD,IAAI,CAAC,GAAG,WAAW,SAAS,GAAG,MAAM,IAAI,MAAM,qBAAqB,UAAU,uDAAuD,UAAU,sCAAsC;CACrL,MAAM,YAAY,KAAK,SAAS,SAAS;CACzC,OAAO;EACN,QAAQ;EACR,aAAa;EACb,OAAO;EACP,UAAU,OAAO,cAAc;GAC9B,MAAM,GAAG,SAAS,MAAM,WAAW,EAAE,WAAW,KAAK,CAAC;GACtD,MAAM,GAAG,SAAS,SAAS,WAAW,KAAK,KAAK,WAAW,SAAS,CAAC;EACtE;CACD;AACD;;AAEA,SAAS,mBAAmB,SAAS,OAAO;CAC3C,MAAM,SAAS,MAAM,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI;CAC1C,uBAAuB,IAAI,MAAM,6BAA6B,QAAQ,+DAA+D,SAAS,MAAM,SAAS,IAAI,SAAS,MAAM,SAAS,EAAE,SAAS,GAAG,+JAA+J;AACvW;;;;;;;;;;;;AAYA,eAAe,iBAAiB,SAAS;CACxC,MAAM,QAAQ,CAAC;CACf,MAAM,OAAO,OAAO,YAAY;EAC/B,KAAK,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