@prisma/composer-cli 0.25.0-dev.3 → 0.25.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.
- package/dist/bin.mjs +55 -108
- package/dist/bin.mjs.map +1 -1
- package/dist/{execute-deploy-destroy-Bdi-RiN5-T3tv5DHr.mjs → execute-deploy-destroy-CF6DR7sA-DGs5poBA.mjs} +23 -19
- package/dist/execute-deploy-destroy-CF6DR7sA-DGs5poBA.mjs.map +1 -0
- package/dist/{execute-deploy-destroy-Bdi-RiN5-BBrZ9a8c.mjs → execute-deploy-destroy-CF6DR7sA-jdelm-y5.mjs} +22 -18
- package/dist/execute-deploy-destroy-CF6DR7sA-jdelm-y5.mjs.map +1 -0
- package/dist/{execute-dev-BLCK5wF7-B-fG_E31.mjs → execute-dev-DAIUT0es-CVW9TfgX.mjs} +179 -130
- package/dist/execute-dev-DAIUT0es-CVW9TfgX.mjs.map +1 -0
- package/dist/{execute-dev-BLCK5wF7-CuzMSK7T.mjs → execute-dev-DAIUT0es-DTdnJdOi.mjs} +100 -131
- package/dist/{execute-dev-BLCK5wF7-B-fG_E31.mjs.map → execute-dev-DAIUT0es-DTdnJdOi.mjs.map} +1 -1
- package/dist/{execute-log-B_zCJ17b-C4a0uxJj.mjs → execute-log-PLs9-Qn3-BUBx5KmY.mjs} +7 -10
- package/dist/execute-log-PLs9-Qn3-BUBx5KmY.mjs.map +1 -0
- package/dist/{execute-log-B_zCJ17b-BrLUt7vo.mjs → execute-log-PLs9-Qn3-D8DRuvDr.mjs} +6 -9
- package/dist/execute-log-PLs9-Qn3-D8DRuvDr.mjs.map +1 -0
- package/dist/{family-DEJvITUc-DHsvEGPB.d.mts → family-DB2Uf88c-DWEm0USb.d.mts} +71 -14
- package/dist/{family-DEJvITUc-DHsvEGPB.d.mts.map → family-DB2Uf88c-DWEm0USb.d.mts.map} +1 -1
- package/dist/family.d.mts +3 -13
- package/dist/family.d.mts.map +1 -1
- package/dist/family.mjs +55 -108
- package/dist/family.mjs.map +1 -1
- package/dist/generate-dev-stack-CPpjJdTG-W0N0YgsI.mjs +87 -0
- package/dist/generate-dev-stack-CPpjJdTG-W0N0YgsI.mjs.map +1 -0
- package/dist/{local-target-hoEGqgVA.mjs → local-target-B9cBl_6r.mjs} +3 -3
- package/dist/local-target-B9cBl_6r.mjs.map +1 -0
- package/dist/{local-target-BOGjATc2.mjs → local-target-P4-n1Ovh.mjs} +3 -3
- package/dist/local-target-P4-n1Ovh.mjs.map +1 -0
- package/dist/{pipeline-C7gNjMzJ-CMqZQxqM.mjs → pipeline-DAYhea3J-BEnHHWp8.mjs} +36 -261
- package/dist/{pipeline-C7gNjMzJ-CMqZQxqM.mjs.map → pipeline-DAYhea3J-BEnHHWp8.mjs.map} +1 -1
- package/dist/{pipeline-C7gNjMzJ-CixaMvnR.mjs → pipeline-DAYhea3J-uuBciVDS.mjs} +36 -262
- package/dist/{pipeline-C7gNjMzJ-CixaMvnR.mjs.map → pipeline-DAYhea3J-uuBciVDS.mjs.map} +1 -1
- package/dist/result-D9vIrN7i.mjs +432 -0
- package/dist/result-D9vIrN7i.mjs.map +1 -0
- package/dist/{result-B874OKwb.mjs → result-SF9LFOuR.mjs} +207 -129
- package/dist/result-SF9LFOuR.mjs.map +1 -0
- package/dist/{run-alchemy-pANK8XNX-BH1wC0r6.mjs → run-alchemy-pANK8XNX-CqXC1tbs.mjs} +2 -2
- package/dist/{run-alchemy-pANK8XNX-BH1wC0r6.mjs.map → run-alchemy-pANK8XNX-CqXC1tbs.mjs.map} +1 -1
- package/dist/{run-alchemy-pANK8XNX-XcCQncKN.mjs → run-alchemy-pANK8XNX-T_pHNDBo.mjs} +2 -2
- package/dist/{run-alchemy-pANK8XNX-XcCQncKN.mjs.map → run-alchemy-pANK8XNX-T_pHNDBo.mjs.map} +1 -1
- package/dist/shared-BAIiDgXa-DYP7EOSk.mjs +33 -0
- package/dist/shared-BAIiDgXa-DYP7EOSk.mjs.map +1 -0
- package/dist/testing.d.mts +16 -2
- package/dist/testing.d.mts.map +1 -1
- package/dist/testing.mjs +3 -2
- package/dist/testing.mjs.map +1 -1
- package/package.json +4 -5
- package/src/exports/testing.ts +3 -1
- package/dist/execute-deploy-destroy-Bdi-RiN5-BBrZ9a8c.mjs.map +0 -1
- package/dist/execute-deploy-destroy-Bdi-RiN5-T3tv5DHr.mjs.map +0 -1
- package/dist/execute-dev-BLCK5wF7-CuzMSK7T.mjs.map +0 -1
- package/dist/execute-log-B_zCJ17b-BrLUt7vo.mjs.map +0 -1
- package/dist/execute-log-B_zCJ17b-C4a0uxJj.mjs.map +0 -1
- package/dist/local-target-BOGjATc2.mjs.map +0 -1
- package/dist/local-target-hoEGqgVA.mjs.map +0 -1
- package/dist/result-B874OKwb.mjs.map +0 -1
- package/dist/result-sR7PBi61.mjs +0 -229
- package/dist/result-sR7PBi61.mjs.map +0 -1
- package/dist/shared-BTnATsqm-BH4axbJg.mjs +0 -158
- package/dist/shared-BTnATsqm-BH4axbJg.mjs.map +0 -1
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { a as InternalError, i as
|
|
2
|
-
import { t as effectResolutionDiagnostic } from "./shared-BTnATsqm-BH4axbJg.mjs";
|
|
1
|
+
import { a as configFileMissing, d as CliStructuredError, f as InternalError, i as checkComposerConfig, p as blindCast } from "./result-SF9LFOuR.mjs";
|
|
3
2
|
import * as mod from "node:module";
|
|
4
3
|
import * as fs from "node:fs";
|
|
5
4
|
import { existsSync } from "node:fs";
|
|
6
5
|
import * as path from "node:path";
|
|
7
6
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
8
|
-
import * as c12 from "c12";
|
|
9
7
|
//#region ../../0-framework/1-core/core/dist/graph-BfKAg2Ap.mjs
|
|
10
8
|
/** The reserved name of a resource's single anonymous output port. Rejected as a user-declared port name (node.ts). */
|
|
11
9
|
const RESOURCE_OUT_PORT = "$out";
|
|
@@ -828,7 +826,7 @@ var AssembleError = class extends CliStructuredError {
|
|
|
828
826
|
function buildDescriptorAssemble(config, node, address, cwd) {
|
|
829
827
|
const { extension, type } = node.build;
|
|
830
828
|
const extensionDescriptor = config.extensions.find((candidate) => candidate.id === extension);
|
|
831
|
-
if (extensionDescriptor === void 0) throw new AssembleError("ASSEMBLE.EXTENSION_MISSING", `No extension "${extension}" is configured (needed by service "${node.name}"'s build).`, { fix: "Add it to prisma
|
|
829
|
+
if (extensionDescriptor === void 0) throw new AssembleError("ASSEMBLE.EXTENSION_MISSING", `No extension "${extension}" is configured (needed by service "${node.name}"'s build).`, { fix: "Add it to `extensions` in the `composer` section of prisma.config.ts." });
|
|
832
830
|
const nodeDescriptor = extensionDescriptor.nodes[type];
|
|
833
831
|
if (nodeDescriptor === void 0) throw new AssembleError("ASSEMBLE.DESCRIPTOR_MISSING", `Extension "${extension}" has no descriptor for build type "${type}".`, { why: `Known types: ${Object.keys(extensionDescriptor.nodes).join(", ")}.` });
|
|
834
832
|
if (nodeDescriptor.kind !== "build") throw new AssembleError("ASSEMBLE.DESCRIPTOR_KIND_MISMATCH", `Extension "${extension}"'s descriptor for type "${type}" is a "${nodeDescriptor.kind}" descriptor.`, { why: "Assembling a service build needs a \"build\" descriptor." });
|
|
@@ -855,242 +853,11 @@ async function assembleServices(graph, config, cwd, run) {
|
|
|
855
853
|
return { bundles };
|
|
856
854
|
}
|
|
857
855
|
//#endregion
|
|
858
|
-
//#region ../../0-framework/3-tooling/cli/dist/pipeline-
|
|
859
|
-
/**
|
|
860
|
-
* Pipeline step: find and load `prisma-composer.config.ts` (ADR-0017) — the ONE
|
|
861
|
-
* file that imports control-plane code. Discovery is the standard walk-up
|
|
862
|
-
* from the deploy entry's directory (mirrors prisma/orm's config-loader);
|
|
863
|
-
* loading is c12 with that explicit path (rc/global/package.json lookups
|
|
864
|
-
* disabled), so the config file's own static imports resolve from the app
|
|
865
|
-
* root by whatever package manager runs — no specifier construction, no
|
|
866
|
-
* anchoring.
|
|
867
|
-
*
|
|
868
|
-
* Two shapes of the same machinery:
|
|
869
|
-
*
|
|
870
|
-
* loadAppConfigDiagnostics — returns the evaluated value together with
|
|
871
|
-
* EVERY problem found, and never throws. This is the shape the engine
|
|
872
|
-
* command family consumes: the engine renders diagnostics itself and
|
|
873
|
-
* decides per command whether a broken section is fatal, so a loader that
|
|
874
|
-
* threw on the first bad field would both hide the rest and bypass that
|
|
875
|
-
* rendering.
|
|
876
|
-
*
|
|
877
|
-
* loadAppConfig — the same load, throwing its first diagnostic. The
|
|
878
|
-
* clipanion CLI still runs on it; it goes when clipanion does.
|
|
879
|
-
*/
|
|
880
|
-
/**
|
|
881
|
-
* Accepted config file names, in precedence order: when several sit in one
|
|
882
|
-
* directory the first one found wins. The JavaScript spellings exist so a
|
|
883
|
-
* project whose own TypeScript build would otherwise compile the config file
|
|
884
|
-
* (no `include`, a `rootDir`, `module: commonjs`) can keep it out of that
|
|
885
|
-
* build's sight.
|
|
886
|
-
*/
|
|
887
|
-
const CONFIG_FILENAMES = [
|
|
888
|
-
"prisma-composer.config.ts",
|
|
889
|
-
"prisma-composer.config.mts",
|
|
890
|
-
"prisma-composer.config.mjs",
|
|
891
|
-
"prisma-composer.config.js"
|
|
892
|
-
];
|
|
893
|
-
/** The canonical spelling, used in messages and docs. */
|
|
894
|
-
const CONFIG_FILENAME = CONFIG_FILENAMES[0];
|
|
895
|
-
/** The accepted spellings as one glob-like string for messages. */
|
|
896
|
-
const CONFIG_FILENAME_PATTERN = "prisma-composer.config.{ts,mts,mjs,js}";
|
|
897
|
-
/** Walks UP from the entry file's directory looking for one of CONFIG_FILENAMES; undefined when the walk hits the filesystem root. */
|
|
898
|
-
function findConfigPathForEntry(entryPath) {
|
|
899
|
-
let current = path.dirname(path.resolve(entryPath));
|
|
900
|
-
while (true) {
|
|
901
|
-
for (const filename of CONFIG_FILENAMES) {
|
|
902
|
-
const candidate = path.join(current, filename);
|
|
903
|
-
if (fs.existsSync(candidate)) return candidate;
|
|
904
|
-
}
|
|
905
|
-
const parent = path.dirname(current);
|
|
906
|
-
if (parent === current) return void 0;
|
|
907
|
-
current = parent;
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
function missingConfigError(entryPath) {
|
|
911
|
-
const searchedFrom = path.dirname(path.resolve(entryPath));
|
|
912
|
-
return new CliStructuredError("CONFIG.FILE_MISSING", `No ${CONFIG_FILENAME_PATTERN} found walking up from "${searchedFrom}".`, {
|
|
913
|
-
why: "The deploy needs the app's config file.",
|
|
914
|
-
fix: "Create one next to (or above) the entry, default-exporting defineConfig({ extensions: [...], state: ... }) from '@prisma/composer/config'.",
|
|
915
|
-
where: { path: searchedFrom }
|
|
916
|
-
});
|
|
917
|
-
}
|
|
918
|
-
function fieldError(configPath, field, requirement) {
|
|
919
|
-
return new CliStructuredError("CONFIG.FIELD_INVALID", `${path.basename(configPath)}: \`${field}\` ${requirement}.`, {
|
|
920
|
-
fix: "See defineConfig() in '@prisma/composer/config'.",
|
|
921
|
-
meta: { field }
|
|
922
|
-
});
|
|
923
|
-
}
|
|
924
|
-
function isRecord(value) {
|
|
925
|
-
return typeof value === "object" && value !== null;
|
|
926
|
-
}
|
|
927
|
-
/**
|
|
928
|
-
* Field-by-field validation of the loaded default export — deliberately no
|
|
929
|
-
* schema library: each check is a structured error naming the offending field.
|
|
930
|
-
*
|
|
931
|
-
* Collects rather than throws, so one bad config reports every bad field
|
|
932
|
-
* instead of only the first. The `extensions` and `state` checks are
|
|
933
|
-
* independent, and within `extensions` each entry is judged on its own; a
|
|
934
|
-
* field whose own shape check already failed is not probed further, because
|
|
935
|
-
* anything derived from it would be noise rather than a second finding.
|
|
936
|
-
*/
|
|
937
|
-
function configShapeDiagnostics(loaded, configPath) {
|
|
938
|
-
if (!isRecord(loaded) || Object.keys(loaded).length === 0) return [new CliStructuredError("CONFIG.EXPORT_INVALID", `"${configPath}" exported no config.`, {
|
|
939
|
-
fix: "It must default-export defineConfig({ extensions: [...], state: ... }) from '@prisma/composer/config'.",
|
|
940
|
-
where: { path: configPath }
|
|
941
|
-
})];
|
|
942
|
-
const diagnostics = [];
|
|
943
|
-
const extensions = loaded["extensions"];
|
|
944
|
-
if (!Array.isArray(extensions)) diagnostics.push(fieldError(configPath, "extensions", "must be an array"));
|
|
945
|
-
else {
|
|
946
|
-
const seen = /* @__PURE__ */ new Set();
|
|
947
|
-
for (const [index, entry] of extensions.entries()) {
|
|
948
|
-
if (!isRecord(entry)) {
|
|
949
|
-
diagnostics.push(fieldError(configPath, `extensions[${index}]`, "must be an extension descriptor object"));
|
|
950
|
-
continue;
|
|
951
|
-
}
|
|
952
|
-
const id = entry["id"];
|
|
953
|
-
if (typeof id !== "string" || id.length === 0) diagnostics.push(fieldError(configPath, `extensions[${index}].id`, "must be a non-empty string (the extension package name)"));
|
|
954
|
-
else if (seen.has(id)) diagnostics.push(new CliStructuredError("CONFIG.EXTENSION_DUPLICATE", `${path.basename(configPath)}: extension "${id}" is listed more than once in \`extensions\`.`));
|
|
955
|
-
else seen.add(id);
|
|
956
|
-
if (!isRecord(entry["nodes"])) diagnostics.push(fieldError(configPath, `extensions[${index}].nodes`, "must be an object (the node-ID → control registry)"));
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
const state = loaded["state"];
|
|
960
|
-
if (!isRecord(state) || typeof state["extension"] !== "string" || typeof state["create"] !== "function") diagnostics.push(fieldError(configPath, "state", "must be a state descriptor (e.g. prismaState())"));
|
|
961
|
-
return diagnostics;
|
|
962
|
-
}
|
|
963
|
-
/** The throwing form of configShapeDiagnostics: raises the first finding, returns the same object typed. Used by the clipanion pipeline. */
|
|
964
|
-
function validateConfigShape(loaded, configPath) {
|
|
965
|
-
const [first] = configShapeDiagnostics(loaded, configPath);
|
|
966
|
-
if (first !== void 0) throw first;
|
|
967
|
-
return blindCast(loaded);
|
|
968
|
-
}
|
|
969
|
-
/**
|
|
970
|
-
* Evaluates `configPath` with c12 (explicit file; rc / global-rc /
|
|
971
|
-
* package.json lookups disabled). `verifySamePath` runs the same-file check
|
|
972
|
-
* against the discovered path — see loadAppConfigDiagnostics for when it does
|
|
973
|
-
* not apply.
|
|
974
|
-
*/
|
|
975
|
-
async function evaluateConfig(configPath, verifySamePath) {
|
|
976
|
-
let result;
|
|
977
|
-
try {
|
|
978
|
-
result = await c12.loadConfig({
|
|
979
|
-
name: "prisma-composer",
|
|
980
|
-
configFile: configPath,
|
|
981
|
-
cwd: path.dirname(configPath),
|
|
982
|
-
rcFile: false,
|
|
983
|
-
globalRc: false,
|
|
984
|
-
packageJson: false
|
|
985
|
-
});
|
|
986
|
-
} catch (error) {
|
|
987
|
-
return {
|
|
988
|
-
value: void 0,
|
|
989
|
-
diagnostics: [new CliStructuredError("CONFIG.EVALUATION_FAILED", `Evaluating "${configPath}" failed: ${error instanceof Error ? error.message : String(error)}`, {
|
|
990
|
-
where: { path: configPath },
|
|
991
|
-
cause: error
|
|
992
|
-
})]
|
|
993
|
-
};
|
|
994
|
-
}
|
|
995
|
-
const loadedFile = result.configFile;
|
|
996
|
-
if (verifySamePath && (typeof loadedFile !== "string" || fs.realpathSync(loadedFile) !== fs.realpathSync(configPath))) return {
|
|
997
|
-
value: result.config,
|
|
998
|
-
diagnostics: [new CliStructuredError("CONFIG.PATH_MISMATCH", `Config loading resolved "${String(loadedFile)}" instead of the discovered "${configPath}".`, {
|
|
999
|
-
why: "Refusing to deploy against a different file.",
|
|
1000
|
-
where: { path: configPath }
|
|
1001
|
-
})]
|
|
1002
|
-
};
|
|
1003
|
-
return {
|
|
1004
|
-
value: result.config,
|
|
1005
|
-
diagnostics: configShapeDiagnostics(result.config, configPath)
|
|
1006
|
-
};
|
|
1007
|
-
}
|
|
1008
|
-
/**
|
|
1009
|
-
* The front of every config load, shared by the throwing and the
|
|
1010
|
-
* diagnostics-list shapes: verify the installed tree can evaluate a config at
|
|
1011
|
-
* all, then settle which file to load — the section's path, or the
|
|
1012
|
-
* entry-anchored walk.
|
|
1013
|
-
*
|
|
1014
|
-
* The effect-resolution check comes first because evaluating a config imports
|
|
1015
|
-
* alchemy's provider tree: in a tree where alchemy resolves an `effect` we did
|
|
1016
|
-
* not pin, nothing downstream can load, so the dependency conflict is the
|
|
1017
|
-
* finding with the fix in it and every later failure is its symptom.
|
|
1018
|
-
*/
|
|
1019
|
-
function configSource(request) {
|
|
1020
|
-
const resolvedEntry = path.resolve(request.entryPath);
|
|
1021
|
-
const effectConflict = effectResolutionDiagnostic(request.cwd ?? path.dirname(resolvedEntry));
|
|
1022
|
-
if (effectConflict !== void 0) return {
|
|
1023
|
-
ok: false,
|
|
1024
|
-
path: void 0,
|
|
1025
|
-
diagnostic: effectConflict
|
|
1026
|
-
};
|
|
1027
|
-
if (request.configPath === void 0) {
|
|
1028
|
-
const discovered = findConfigPathForEntry(resolvedEntry);
|
|
1029
|
-
return discovered === void 0 ? {
|
|
1030
|
-
ok: false,
|
|
1031
|
-
path: void 0,
|
|
1032
|
-
diagnostic: missingConfigError(resolvedEntry)
|
|
1033
|
-
} : {
|
|
1034
|
-
ok: true,
|
|
1035
|
-
path: discovered,
|
|
1036
|
-
explicit: false
|
|
1037
|
-
};
|
|
1038
|
-
}
|
|
1039
|
-
const configPath = request.configPath;
|
|
1040
|
-
if (!path.isAbsolute(configPath)) return {
|
|
1041
|
-
ok: false,
|
|
1042
|
-
path: configPath,
|
|
1043
|
-
diagnostic: new CliStructuredError("CONFIG.PATH_NOT_ABSOLUTE", `The \`composer\` config section's configPath must arrive absolute, and "${configPath}" is relative.`, {
|
|
1044
|
-
why: "The section validator resolves a relative configPath against the config file that declared it; a relative value here means that resolution was skipped.",
|
|
1045
|
-
fix: "Run the configPath through the composer section validator, or resolve it against its declaring file before constructing the load request.",
|
|
1046
|
-
where: { path: configPath }
|
|
1047
|
-
})
|
|
1048
|
-
};
|
|
1049
|
-
if (!fs.existsSync(configPath)) return {
|
|
1050
|
-
ok: false,
|
|
1051
|
-
path: configPath,
|
|
1052
|
-
diagnostic: new CliStructuredError("CONFIG.FILE_MISSING", `The \`composer\` config section points at "${configPath}", which does not exist.`, {
|
|
1053
|
-
why: "An explicit configPath is used as given — there is no walk to fall back on.",
|
|
1054
|
-
fix: "Correct `configPath` in the `composer` section of prisma.config.ts, or remove it to search upward from the entry.",
|
|
1055
|
-
where: { path: configPath }
|
|
1056
|
-
})
|
|
1057
|
-
};
|
|
1058
|
-
return {
|
|
1059
|
-
ok: true,
|
|
1060
|
-
path: configPath,
|
|
1061
|
-
explicit: true
|
|
1062
|
-
};
|
|
1063
|
-
}
|
|
1064
|
-
/**
|
|
1065
|
-
* The throwing form of that front, for the pipeline: the file the load will
|
|
1066
|
-
* use, or the finding raised. `explicit` says the section named the file,
|
|
1067
|
-
* which is what retires the same-file check for that case.
|
|
1068
|
-
*/
|
|
1069
|
-
function resolveConfigFile(request) {
|
|
1070
|
-
const source = configSource(request);
|
|
1071
|
-
if (!source.ok) throw source.diagnostic;
|
|
1072
|
-
return {
|
|
1073
|
-
path: source.path,
|
|
1074
|
-
explicit: source.explicit
|
|
1075
|
-
};
|
|
1076
|
-
}
|
|
1077
|
-
/**
|
|
1078
|
-
* Loads + validates the config at `configPath`, throwing its first diagnostic.
|
|
1079
|
-
* The clipanion CLI's pipeline runs on this; it goes when clipanion does.
|
|
1080
|
-
*/
|
|
1081
|
-
async function loadAppConfig(configPath, verifySamePath = true) {
|
|
1082
|
-
const { value, diagnostics } = await evaluateConfig(configPath, verifySamePath);
|
|
1083
|
-
const [first] = diagnostics;
|
|
1084
|
-
if (first !== void 0) throw first;
|
|
1085
|
-
return {
|
|
1086
|
-
path: configPath,
|
|
1087
|
-
config: validateConfigShape(value, configPath)
|
|
1088
|
-
};
|
|
1089
|
-
}
|
|
856
|
+
//#region ../../0-framework/3-tooling/cli/dist/pipeline-DAYhea3J.mjs
|
|
1090
857
|
function lookup(extensions, extension, type, expectedKind, what) {
|
|
1091
858
|
const ext = extensions.get(extension);
|
|
1092
859
|
if (ext === void 0) throw new CliStructuredError("CONFIG.EXTENSION_MISSING", `No extension "${extension}" is configured (needed by ${what}).`, {
|
|
1093
|
-
fix:
|
|
860
|
+
fix: "Add it to `extensions` in the `composer` section of prisma.config.ts (import its /control entry and list its descriptor).",
|
|
1094
861
|
meta: {
|
|
1095
862
|
extension,
|
|
1096
863
|
type
|
|
@@ -1125,7 +892,7 @@ function validateRegistryCoverage(graph, config) {
|
|
|
1125
892
|
}
|
|
1126
893
|
/**
|
|
1127
894
|
* The shared prefix of `deploy`/`destroy`/`dev` (deploy-cli.md § The
|
|
1128
|
-
* pipeline; local-dev spec § 6):
|
|
895
|
+
* pipeline; local-dev spec § 6): entry load, Load,
|
|
1129
896
|
* registry coverage validation, name resolution, assemble. Deploy and dev
|
|
1130
897
|
* diverge after this — deploy resolves containers/preflight/stack file
|
|
1131
898
|
* against the hosted providers, dev against the local ones — so everything
|
|
@@ -1133,50 +900,58 @@ function validateRegistryCoverage(graph, config) {
|
|
|
1133
900
|
* `run()` (main.ts) and `runDev()` (dev/run-dev.ts), so the two pipelines
|
|
1134
901
|
* cannot drift.
|
|
1135
902
|
*/
|
|
903
|
+
function configError(findings, file) {
|
|
904
|
+
const [first] = findings;
|
|
905
|
+
return new CliStructuredError(first.code, first.summary, {
|
|
906
|
+
...first.why === void 0 ? {} : { why: first.why },
|
|
907
|
+
fix: first.fix,
|
|
908
|
+
where: { path: first.where ?? file },
|
|
909
|
+
meta: {
|
|
910
|
+
...first.field === void 0 ? {} : { field: first.field },
|
|
911
|
+
findings
|
|
912
|
+
}
|
|
913
|
+
});
|
|
914
|
+
}
|
|
1136
915
|
/**
|
|
1137
|
-
*
|
|
1138
|
-
*
|
|
1139
|
-
* unless the caller substituted a config, which replaces the evaluation and
|
|
1140
|
-
* nothing before it.
|
|
916
|
+
* Refuses a caller's config with the same findings, in the same order, as the CLI's section validator.
|
|
917
|
+
* The error is the first finding and carries all of them in `meta.findings`. Returns the config with `file` resolved against `cwd`.
|
|
1141
918
|
*/
|
|
1142
|
-
|
|
1143
|
-
const
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
});
|
|
919
|
+
function checkConfigSource(source, cwd) {
|
|
920
|
+
const file = path.resolve(cwd, source.file);
|
|
921
|
+
if (!fs.existsSync(file)) throw configError([configFileMissing(file)], file);
|
|
922
|
+
const checked = checkComposerConfig(source.value, file);
|
|
923
|
+
if (!checked.ok) throw configError(checked.findings, file);
|
|
1148
924
|
return {
|
|
1149
|
-
|
|
1150
|
-
|
|
925
|
+
value: checked.value,
|
|
926
|
+
file
|
|
1151
927
|
};
|
|
1152
928
|
}
|
|
1153
929
|
/**
|
|
1154
|
-
* The pipeline's front —
|
|
930
|
+
* The pipeline's front — entry load and name resolution —
|
|
1155
931
|
* WITHOUT Load, coverage, or assemble. `log` needs only who the app is (its
|
|
1156
932
|
* config and resolved name) to reach the already-running local instance; it
|
|
1157
933
|
* neither builds nor provisions, so it must not require the user's built
|
|
1158
934
|
* output the way the full pipeline does.
|
|
1159
935
|
*/
|
|
1160
|
-
async function resolveAppIdentity(entry, overrideName, cwd,
|
|
1161
|
-
const {
|
|
936
|
+
async function resolveAppIdentity(entry, overrideName, cwd, config) {
|
|
937
|
+
const { value } = checkConfigSource(config, cwd);
|
|
1162
938
|
const entryModule = await loadEntry(entry, cwd);
|
|
1163
939
|
const name = overrideName ?? entryModule.root.name;
|
|
1164
940
|
if (name.length === 0) throw new CliStructuredError("COMPOSE.NAME_MISSING", "The root node has no name.", { fix: "Name it at authoring, or pass --name." });
|
|
1165
941
|
return {
|
|
1166
|
-
|
|
1167
|
-
config,
|
|
942
|
+
config: value,
|
|
1168
943
|
name
|
|
1169
944
|
};
|
|
1170
945
|
}
|
|
1171
946
|
/**
|
|
1172
|
-
* Runs
|
|
1173
|
-
* resolution, and assemble — steps 1–6 of `run()`. `onAssembleError`, when
|
|
947
|
+
* Runs entry load, Load, registry coverage, name resolution, and assemble — steps 1–5 of `run()`. `onAssembleError`, when
|
|
1174
948
|
* given, lets a caller decorate an assemble failure with command-specific
|
|
1175
949
|
* guidance (destroy's "build first" hint) without this shared step knowing
|
|
1176
950
|
* about any one command.
|
|
1177
951
|
*/
|
|
1178
|
-
async function runPipeline(entry, overrideName, cwd, deps = {}, onAssembleError) {
|
|
1179
|
-
const
|
|
952
|
+
async function runPipeline(entry, overrideName, cwd, source, deps = {}, onAssembleError) {
|
|
953
|
+
const configSource = checkConfigSource(source, cwd);
|
|
954
|
+
const config = configSource.value;
|
|
1180
955
|
const entryModule = await loadEntry(entry, cwd);
|
|
1181
956
|
const graph = Load(entryModule.root);
|
|
1182
957
|
if (graph.root.node.kind !== "module") throw new CliStructuredError("COMPOSE.ROOT_NOT_MODULE", "The deploy root must be a module.", { fix: "Wrap your service, e.g. export default module('name', ({ provision }) => { provision(service); })." });
|
|
@@ -1191,8 +966,7 @@ async function runPipeline(entry, overrideName, cwd, deps = {}, onAssembleError)
|
|
|
1191
966
|
throw error;
|
|
1192
967
|
}
|
|
1193
968
|
return {
|
|
1194
|
-
|
|
1195
|
-
config,
|
|
969
|
+
configSource,
|
|
1196
970
|
entryModule,
|
|
1197
971
|
graph,
|
|
1198
972
|
name,
|
|
@@ -1202,4 +976,4 @@ async function runPipeline(entry, overrideName, cwd, deps = {}, onAssembleError)
|
|
|
1202
976
|
//#endregion
|
|
1203
977
|
export { runPipeline as n, resolveAppIdentity as t };
|
|
1204
978
|
|
|
1205
|
-
//# sourceMappingURL=pipeline-
|
|
979
|
+
//# sourceMappingURL=pipeline-DAYhea3J-uuBciVDS.mjs.map
|