@solid-stack/builder 2.0.1 → 2.0.2
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.js +89 -10
- package/dist/bin.js.map +1 -1
- package/dist/core/composition/compileServiceComposition.d.ts.map +1 -1
- package/dist/core/composition/composePaths.d.ts +2 -0
- package/dist/core/composition/composePaths.d.ts.map +1 -1
- package/dist/core/composition/validateOverrideCompose.d.ts +7 -3
- package/dist/core/composition/validateOverrideCompose.d.ts.map +1 -1
- package/dist/index.js +89 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compileServiceComposition.d.ts","sourceRoot":"","sources":["../../../src/core/composition/compileServiceComposition.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAqBxD,OAAO,KAAK,EAAmC,0BAA0B,EAAmD,MAAM,YAAY,CAAC;AAE/I,MAAM,WAAW,gCAAgC;IAAG,IAAI,CAAC,EAAC,OAAO,GAAC,SAAS,CAAC;IAAA,eAAe,CAAC,EAAC,OAAO,GAAC,SAAS,CAAC;IAAA,cAAc,CAAC,EAAC,MAAM,CAAC,MAAM,EAAC,MAAM,CAAC,GAAC,SAAS,CAAC;IAAA,eAAe,CAAC,EAAC,MAAM,GAAC,SAAS,CAAC;IAAA,QAAQ,CAAC,EAAC,OAAO,GAAC,SAAS,CAAC;IAAA,aAAa,CAAC,EAAC,GAAG,CAAC,MAAM,CAAC,GAAC,SAAS,CAAC;IAAA,oBAAoB,CAAC,EAAC,GAAG,CAAC,MAAM,CAAC,GAAC,SAAS,CAAC;IAAA,wBAAwB,CAAC,EAAC,OAAO,GAAC,SAAS,CAAC;IAAA,mBAAmB,CAAC,EAAC,MAAM,GAAC,SAAS,CAAC;IAAA,cAAc,CAAC,EAAC,MAAM,GAAC,SAAS,CAAC;IAAA,gBAAgB,CAAC,EAAC,M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+1,5 @@
|
|
|
1
1
|
import type { ComposeDocument } from "./types.js";
|
|
2
2
|
export declare function rebaseComposePaths(document: ComposeDocument, composeFilePath: string, outputProjectDir: string): ComposeDocument;
|
|
3
|
+
/** App overlays resolve paths from the service project and never invent a build context. */
|
|
4
|
+
export declare function rebaseAppOverridePaths(document: ComposeDocument, serviceProjectDir: string, outputProjectDir: string): ComposeDocument;
|
|
3
5
|
//# sourceMappingURL=composePaths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composePaths.d.ts","sourceRoot":"","sources":["../../../src/core/composition/composePaths.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAQlD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAC,eAAe,EAAC,eAAe,EAAC,MAAM,EAAC,gBAAgB,EAAC,MAAM,GAAE,eAAe,CAS1H"}
|
|
1
|
+
{"version":3,"file":"composePaths.d.ts","sourceRoot":"","sources":["../../../src/core/composition/composePaths.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAQlD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAC,eAAe,EAAC,eAAe,EAAC,MAAM,EAAC,gBAAgB,EAAC,MAAM,GAAE,eAAe,CAS1H;AAED,4FAA4F;AAC5F,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,EACzB,iBAAiB,EAAE,MAAM,EACzB,gBAAgB,EAAE,MAAM,GACvB,eAAe,CA8CjB"}
|
|
@@ -3,9 +3,13 @@ export interface PreparedAppOverride {
|
|
|
3
3
|
app: ComposeService;
|
|
4
4
|
resources: Pick<ComposeDocument, "volumes" | "networks" | "configs" | "secrets">;
|
|
5
5
|
}
|
|
6
|
-
export
|
|
6
|
+
export interface AppOverrideValidationContext {
|
|
7
7
|
file: string;
|
|
8
8
|
stage: string;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
/** Builder context in the final Compose coordinate system. */
|
|
10
|
+
expectedBuildContext: string;
|
|
11
|
+
/** Output directory against which both contexts are interpreted. */
|
|
12
|
+
buildContextBaseDir: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function validateAndPrepareAppOverride(document: ComposeDocument, context: AppOverrideValidationContext): PreparedAppOverride;
|
|
11
15
|
//# sourceMappingURL=validateOverrideCompose.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateOverrideCompose.d.ts","sourceRoot":"","sources":["../../../src/core/composition/validateOverrideCompose.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validateOverrideCompose.d.ts","sourceRoot":"","sources":["../../../src/core/composition/validateOverrideCompose.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAClE,MAAM,WAAW,mBAAmB;IAAE,GAAG,EAAC,cAAc,CAAC;IAAA,SAAS,EAAC,IAAI,CAAC,eAAe,EAAC,SAAS,GAAC,UAAU,GAAC,SAAS,GAAC,SAAS,CAAC,CAAC;CAAC;AACnI,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,oBAAoB,EAAE,MAAM,CAAC;IAC7B,oEAAoE;IACpE,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAUD,wBAAgB,6BAA6B,CAAC,QAAQ,EAAC,eAAe,EAAC,OAAO,EAAC,4BAA4B,GAAE,mBAAmB,CA+C/H"}
|
package/dist/index.js
CHANGED
|
@@ -658,6 +658,52 @@ function rebaseComposePaths(document, composeFilePath, outputProjectDir) {
|
|
|
658
658
|
for (const kind of ["configs", "secrets"]) for (const def of Object.values(doc[kind] ?? {})) if (def && typeof def === "object" && typeof def.file === "string") def.file = rebase(def.file, base, out);
|
|
659
659
|
return doc;
|
|
660
660
|
}
|
|
661
|
+
function rebaseAppOverridePaths(document, serviceProjectDir, outputProjectDir) {
|
|
662
|
+
const doc = structuredClone(document);
|
|
663
|
+
const base = path.resolve(serviceProjectDir);
|
|
664
|
+
const out = path.resolve(outputProjectDir);
|
|
665
|
+
for (const svc of Object.values(doc.services ?? {})) {
|
|
666
|
+
if (svc.build && typeof svc.build === "object" && !Array.isArray(svc.build)) {
|
|
667
|
+
const build = svc.build;
|
|
668
|
+
if (typeof build.context === "string") {
|
|
669
|
+
build.context = rebase(build.context, base, out);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
if (typeof svc.env_file === "string") {
|
|
673
|
+
svc.env_file = rebase(svc.env_file, base, out);
|
|
674
|
+
} else if (Array.isArray(svc.env_file)) {
|
|
675
|
+
svc.env_file = svc.env_file.map((entry) => {
|
|
676
|
+
if (typeof entry === "string") return rebase(entry, base, out);
|
|
677
|
+
if (entry && typeof entry === "object") {
|
|
678
|
+
const value = entry;
|
|
679
|
+
if (typeof value.path === "string") return { ...value, path: rebase(value.path, base, out) };
|
|
680
|
+
}
|
|
681
|
+
return entry;
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
if (Array.isArray(svc.volumes)) {
|
|
685
|
+
svc.volumes = svc.volumes.map((volume) => {
|
|
686
|
+
if (typeof volume === "string") return volumeShort(volume, base, out);
|
|
687
|
+
if (volume && typeof volume === "object") {
|
|
688
|
+
const value = volume;
|
|
689
|
+
if (value.type === "bind" && typeof value.source === "string") {
|
|
690
|
+
return { ...value, source: rebase(value.source, base, out) };
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
return volume;
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
for (const kind of ["configs", "secrets"]) {
|
|
698
|
+
for (const definition of Object.values(doc[kind] ?? {})) {
|
|
699
|
+
if (definition && typeof definition === "object") {
|
|
700
|
+
const value = definition;
|
|
701
|
+
if (typeof value.file === "string") value.file = rebase(value.file, base, out);
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
return doc;
|
|
706
|
+
}
|
|
661
707
|
|
|
662
708
|
// src/core/composition/composeEnvironment.ts
|
|
663
709
|
function normalizeComposeEnvironment(value, context) {
|
|
@@ -781,11 +827,15 @@ function validateDependencyCompose(dependencyKey, dependency, document, context)
|
|
|
781
827
|
if (!health || health.disable === true || !health.test || typeof health.test === "string" && !health.test.trim() || Array.isArray(health.test) && (!health.test.length || health.test[0] === "NONE" || health.test.every((v) => typeof v === "string" && !v.trim()))) fail(`services.${owner}.healthcheck`, `endpoint owner requires an enabled, non-empty healthcheck`);
|
|
782
828
|
}
|
|
783
829
|
}
|
|
784
|
-
|
|
785
|
-
|
|
830
|
+
function canonicalBuildContext(value, baseDir) {
|
|
831
|
+
return canonicalPath(path.resolve(baseDir, value));
|
|
832
|
+
}
|
|
833
|
+
function isSameBuildContext(actual, expected, baseDir) {
|
|
834
|
+
return canonicalBuildContext(actual, baseDir) === canonicalBuildContext(expected, baseDir);
|
|
835
|
+
}
|
|
786
836
|
function validateAndPrepareAppOverride(document, context) {
|
|
787
|
-
const fail = (
|
|
788
|
-
throw new ConfigError({ sourceFile: context.file, configPath:
|
|
837
|
+
const fail = (path20, reason, value) => {
|
|
838
|
+
throw new ConfigError({ sourceFile: context.file, configPath: path20, stage: context.stage, composition: "service", ...value === void 0 ? {} : { value }, reason });
|
|
789
839
|
};
|
|
790
840
|
const keys = Object.keys(document.services ?? {});
|
|
791
841
|
if (keys.length !== 1 || keys[0] !== "app") fail("services", "override must define exactly one service named app");
|
|
@@ -795,10 +845,24 @@ function validateAndPrepareAppOverride(document, context) {
|
|
|
795
845
|
const health = app.healthcheck;
|
|
796
846
|
for (const key of Object.keys(health)) if (!["interval", "timeout", "retries", "start_period", "start_interval"].includes(key)) fail(`services.app.healthcheck.${key}`, "override may set only healthcheck timing fields");
|
|
797
847
|
}
|
|
848
|
+
if (typeof app.build === "string") {
|
|
849
|
+
fail("services.app.build", "override cannot replace Builder-owned app build context; use object-form build.args for build arguments", app.build);
|
|
850
|
+
}
|
|
798
851
|
if (app.build && typeof app.build === "object") {
|
|
799
|
-
const
|
|
800
|
-
for (const
|
|
801
|
-
|
|
852
|
+
const build = app.build;
|
|
853
|
+
for (const key of ["target", "dockerfile"]) {
|
|
854
|
+
if (build[key] !== void 0) {
|
|
855
|
+
fail(`services.app.build.${key}`, "override cannot change Builder-owned build configuration");
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
if (build.context !== void 0) {
|
|
859
|
+
if (typeof build.context !== "string") {
|
|
860
|
+
fail("services.app.build.context", "override app build context must be a string", build.context);
|
|
861
|
+
}
|
|
862
|
+
if (!isSameBuildContext(build.context, context.expectedBuildContext, context.buildContextBaseDir)) {
|
|
863
|
+
fail("services.app.build.context", "override cannot change app build context", build.context);
|
|
864
|
+
}
|
|
865
|
+
}
|
|
802
866
|
}
|
|
803
867
|
const env = normalizeComposeEnvironment(app.environment, "services.app.environment");
|
|
804
868
|
for (const k of ["EXEC_MODE", "INFRA_MODE"]) if (k in env) fail(`services.app.environment.${k}`, "override cannot set Builder-owned environment");
|
|
@@ -1050,9 +1114,24 @@ function compileServiceComposition(stage, projectDir, options = {}) {
|
|
|
1050
1114
|
for (const [epName, ep] of Object.entries(depEndpoints[key])) dependency.endpoints[epName] = ep;
|
|
1051
1115
|
}
|
|
1052
1116
|
if (effective.overrideCompose) {
|
|
1053
|
-
const overridePath = resolveInsideProject(root, effective.overrideCompose, {
|
|
1054
|
-
|
|
1055
|
-
|
|
1117
|
+
const overridePath = resolveInsideProject(root, effective.overrideCompose, {
|
|
1118
|
+
sourceFile: buildPath,
|
|
1119
|
+
configPath: "override-compose",
|
|
1120
|
+
stage
|
|
1121
|
+
});
|
|
1122
|
+
const loadedOverride = loadComposeDocument(overridePath, {
|
|
1123
|
+
sourceFile: buildPath,
|
|
1124
|
+
configPath: "override-compose",
|
|
1125
|
+
stage,
|
|
1126
|
+
composition: "service"
|
|
1127
|
+
});
|
|
1128
|
+
const overrideDocument = rebaseAppOverridePaths(loadedOverride, root, outputDir);
|
|
1129
|
+
const prepared = validateAndPrepareAppOverride(overrideDocument, {
|
|
1130
|
+
file: overridePath,
|
|
1131
|
+
stage,
|
|
1132
|
+
expectedBuildContext: String(appBuild.context),
|
|
1133
|
+
buildContextBaseDir: outputDir
|
|
1134
|
+
});
|
|
1056
1135
|
for (const section of ["volumes", "networks", "configs", "secrets"]) if (prepared.resources[section]) mergeDocument(compose, { services: {}, [section]: prepared.resources[section] }, "app override");
|
|
1057
1136
|
const rawOverrideEnv = normalizeComposeEnvironment(prepared.app.environment, "override-compose.services.app.environment");
|
|
1058
1137
|
const overrideEnv = options.deferReferenceResolution ? rawOverrideEnv : resolveEnv(rawOverrideEnv, registry, "override-compose.services.app.environment");
|