@heroiclands/package-build 8.0.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +173 -0
- package/bin/content-build.mjs +44 -118
- package/bin/package-build.mjs +27 -69
- package/bin/report.mjs +1 -2
- package/bundle.mjs +2 -10
- package/config.mjs +31 -106
- package/container.mjs +13 -57
- package/content-config.mjs +45 -164
- package/coverage.mjs +14 -55
- package/deploy.mjs +4 -13
- package/e2e.mjs +16 -55
- package/engine/address-diff.mjs +1 -4
- package/engine/base-compiler.mjs +10 -28
- package/engine/code-fences.mjs +4 -13
- package/engine/compendiums.mjs +13 -37
- package/engine/content-address.mjs +2 -6
- package/engine/content-links.mjs +13 -44
- package/engine/content-lint.mjs +4 -15
- package/engine/content-slug.mjs +2 -6
- package/engine/content-tables.mjs +26 -79
- package/engine/diagnostics.mjs +4 -15
- package/engine/field-reference.mjs +6 -20
- package/engine/field-spec.mjs +1 -3
- package/engine/foreign-catalog.mjs +7 -22
- package/engine/foreign-manifests.mjs +1 -4
- package/engine/frontmatter-lint.mjs +6 -18
- package/engine/frontmatter.mjs +3 -8
- package/engine/generate.mjs +4 -16
- package/engine/helpers.mjs +13 -52
- package/engine/homepage.mjs +4 -15
- package/engine/ids.mjs +3 -12
- package/engine/item-registry.mjs +2 -6
- package/engine/journals.mjs +4 -14
- package/engine/kb-manifest.mjs +5 -17
- package/engine/macros.mjs +2 -10
- package/engine/manifest-emit.mjs +6 -17
- package/engine/map-notes.mjs +19 -69
- package/engine/note-package.mjs +1 -4
- package/engine/pack-config.mjs +17 -38
- package/engine/pack-router.mjs +1 -2
- package/engine/prose-config.mjs +20 -4
- package/engine/prose-lint.mjs +6 -14
- package/engine/region-events.mjs +1 -3
- package/engine/scene-levels.mjs +8 -22
- package/engine/scenes.mjs +13 -47
- package/engine/schema-check.mjs +1 -4
- package/engine/schema-extract.mjs +70 -45
- package/engine/site-build.mjs +12 -37
- package/engine/site-index.mjs +3 -15
- package/engine/web-wikilinks.mjs +4 -13
- package/engine/wikilinks.mjs +115 -167
- package/index.mjs +1 -5
- package/lang.mjs +1 -3
- package/manifest.mjs +10 -37
- package/markdownlint-config.mjs +1 -5
- package/package.json +1 -1
- package/sohl/actors.mjs +10 -40
- package/sohl/being-info.mjs +3 -6
- package/sohl/index.mjs +1 -6
- package/sohl/item-builders.mjs +1 -3
- package/sohl/item-fields.mjs +16 -34
- package/sohl/items.mjs +1 -3
- package/sohl/kb-passes.mjs +29 -39
- package/sohl/skill-base.mjs +7 -23
- package/stage.mjs +3 -13
- package/templates.mjs +4 -15
- package/types/bundle.d.mts +1 -1
- package/types/container.d.mts +2 -2
- package/types/coverage.d.mts +1 -1
- package/types/e2e.d.mts +4 -4
- package/types/engine/generate.d.mts +1 -1
- package/types/engine/helpers.d.mts +1 -1
- package/types/engine/schema-extract.d.mts +1 -1
- package/types/engine/site-index.d.mts +1 -1
- package/types/manifest.d.mts +1 -1
package/bin/package-build.mjs
CHANGED
|
@@ -96,13 +96,7 @@ import { packRelease } from "../release.mjs";
|
|
|
96
96
|
import { writeManifest } from "../manifest.mjs";
|
|
97
97
|
import { deployStage } from "../deploy.mjs";
|
|
98
98
|
import { CONTAINER_ACTIONS, containerAction } from "../container.mjs";
|
|
99
|
-
import {
|
|
100
|
-
E2E_MODES,
|
|
101
|
-
e2eFast,
|
|
102
|
-
e2eRun,
|
|
103
|
-
e2eSweep,
|
|
104
|
-
seedTestWorld,
|
|
105
|
-
} from "../e2e.mjs";
|
|
99
|
+
import { E2E_MODES, e2eFast, e2eRun, e2eSweep, seedTestWorld } from "../e2e.mjs";
|
|
106
100
|
import { reportFindings } from "./report.mjs";
|
|
107
101
|
|
|
108
102
|
/**
|
|
@@ -124,9 +118,7 @@ const ADVISORY_PREVIEW = 20;
|
|
|
124
118
|
* @returns {string} The `version` field of this package's manifest.
|
|
125
119
|
*/
|
|
126
120
|
function ownVersion() {
|
|
127
|
-
return JSON.parse(
|
|
128
|
-
fs.readFileSync(new URL("../package.json", import.meta.url), "utf8"),
|
|
129
|
-
).version;
|
|
121
|
+
return JSON.parse(fs.readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
|
|
130
122
|
}
|
|
131
123
|
|
|
132
124
|
/**
|
|
@@ -141,9 +133,7 @@ function die(err) {
|
|
|
141
133
|
// exactly the position a parser reads the path from — prefixing it would
|
|
142
134
|
// yield a filename no editor can open (#95).
|
|
143
135
|
console.error(
|
|
144
|
-
/** @type {{located?: boolean}} */ (err)?.located ? message :
|
|
145
|
-
`package-build: ${message}`
|
|
146
|
-
),
|
|
136
|
+
/** @type {{located?: boolean}} */ (err)?.located ? message : `package-build: ${message}`,
|
|
147
137
|
);
|
|
148
138
|
process.exit(1);
|
|
149
139
|
}
|
|
@@ -195,9 +185,7 @@ async function loadEnvironment(config) {
|
|
|
195
185
|
* @returns {object} The parsed manifest.
|
|
196
186
|
*/
|
|
197
187
|
function readPackageJson(config) {
|
|
198
|
-
return JSON.parse(
|
|
199
|
-
fs.readFileSync(path.join(config.rootDir, "package.json"), "utf8"),
|
|
200
|
-
);
|
|
188
|
+
return JSON.parse(fs.readFileSync(path.join(config.rootDir, "package.json"), "utf8"));
|
|
201
189
|
}
|
|
202
190
|
|
|
203
191
|
/**
|
|
@@ -270,17 +258,13 @@ function assetsCommand() {
|
|
|
270
258
|
handler: handler(async () => {
|
|
271
259
|
const config = loadPackageBuildConfig();
|
|
272
260
|
if (!config.assets.length) {
|
|
273
|
-
console.log(
|
|
274
|
-
"package-build: no `packageBuild.assets` declared; nothing to stage.",
|
|
275
|
-
);
|
|
261
|
+
console.log("package-build: no `packageBuild.assets` declared; nothing to stage.");
|
|
276
262
|
return;
|
|
277
263
|
}
|
|
278
264
|
|
|
279
265
|
let transform;
|
|
280
266
|
if (config.assetTransform) {
|
|
281
|
-
const module = await import(
|
|
282
|
-
`file://${config.assetTransform}`
|
|
283
|
-
).catch((err) =>
|
|
267
|
+
const module = await import(`file://${config.assetTransform}`).catch((err) =>
|
|
284
268
|
die(
|
|
285
269
|
`cannot load \`packageBuild.assetTransform\` ` +
|
|
286
270
|
`(${config.assetTransform}): ${err.message}`,
|
|
@@ -307,9 +291,7 @@ function assetsCommand() {
|
|
|
307
291
|
cwd: config.rootDir,
|
|
308
292
|
transform,
|
|
309
293
|
});
|
|
310
|
-
console.log(
|
|
311
|
-
`✅ Static assets staged (${count} entries, ${files} files).`,
|
|
312
|
-
);
|
|
294
|
+
console.log(`✅ Static assets staged (${count} entries, ${files} files).`);
|
|
313
295
|
}),
|
|
314
296
|
};
|
|
315
297
|
}
|
|
@@ -368,8 +350,7 @@ function schemaCommand() {
|
|
|
368
350
|
const config = loadPackageBuildConfig();
|
|
369
351
|
if (!config.schema.length) {
|
|
370
352
|
console.log(
|
|
371
|
-
"package-build: no `packageBuild.schema` declared; " +
|
|
372
|
-
"nothing to publish.",
|
|
353
|
+
"package-build: no `packageBuild.schema` declared; " + "nothing to publish.",
|
|
373
354
|
);
|
|
374
355
|
return;
|
|
375
356
|
}
|
|
@@ -385,15 +366,11 @@ function schemaCommand() {
|
|
|
385
366
|
const out = path.join(config.rootDir, SCHEMA_ARTIFACT_FILE);
|
|
386
367
|
const text = await formatGenerated(JSON.stringify(artifact), out);
|
|
387
368
|
const counts = Object.entries(artifact.documents)
|
|
388
|
-
.map(
|
|
389
|
-
([kind, subtypes]) =>
|
|
390
|
-
`${Object.keys(subtypes).length} ${kind}`,
|
|
391
|
-
)
|
|
369
|
+
.map(([kind, subtypes]) => `${Object.keys(subtypes).length} ${kind}`)
|
|
392
370
|
.join(", ");
|
|
393
371
|
|
|
394
372
|
if (argv.check) {
|
|
395
|
-
const current =
|
|
396
|
-
fs.existsSync(out) ? fs.readFileSync(out, "utf8") : null;
|
|
373
|
+
const current = fs.existsSync(out) ? fs.readFileSync(out, "utf8") : null;
|
|
397
374
|
if (current !== text) {
|
|
398
375
|
die(
|
|
399
376
|
`${SCHEMA_ARTIFACT_FILE} does not match what this ` +
|
|
@@ -401,10 +378,7 @@ function schemaCommand() {
|
|
|
401
378
|
`it with \`package-build schema\`.`,
|
|
402
379
|
);
|
|
403
380
|
}
|
|
404
|
-
console.log(
|
|
405
|
-
`✅ ${SCHEMA_ARTIFACT_FILE} is up to date ` +
|
|
406
|
-
`(${counts} subtypes).`,
|
|
407
|
-
);
|
|
381
|
+
console.log(`✅ ${SCHEMA_ARTIFACT_FILE} is up to date ` + `(${counts} subtypes).`);
|
|
408
382
|
return;
|
|
409
383
|
}
|
|
410
384
|
|
|
@@ -441,9 +415,7 @@ function manifestCommand() {
|
|
|
441
415
|
|
|
442
416
|
let flags;
|
|
443
417
|
if (config.manifestFlags) {
|
|
444
|
-
const module = await import(
|
|
445
|
-
`file://${config.manifestFlags}`
|
|
446
|
-
).catch((err) =>
|
|
418
|
+
const module = await import(`file://${config.manifestFlags}`).catch((err) =>
|
|
447
419
|
die(
|
|
448
420
|
`cannot load \`packageBuild.manifestFlags\` ` +
|
|
449
421
|
`(${config.manifestFlags}): ${err.message}`,
|
|
@@ -512,8 +484,7 @@ function langCheck(config) {
|
|
|
512
484
|
const files = readMatching(config.langSources, config.rootDir);
|
|
513
485
|
if (!files.length) {
|
|
514
486
|
die(
|
|
515
|
-
`no localization files matched \`${config.langSources}\` under ` +
|
|
516
|
-
`${config.rootDir}.`,
|
|
487
|
+
`no localization files matched \`${config.langSources}\` under ` + `${config.rootDir}.`,
|
|
517
488
|
);
|
|
518
489
|
}
|
|
519
490
|
|
|
@@ -528,10 +499,7 @@ function langCheck(config) {
|
|
|
528
499
|
if (config.langHelp) console.error(`\n${config.langHelp}`);
|
|
529
500
|
process.exit(1);
|
|
530
501
|
}
|
|
531
|
-
console.log(
|
|
532
|
-
`package-build: ${files.length} localization file(s) are ` +
|
|
533
|
-
`expandObject-safe.`,
|
|
534
|
-
);
|
|
502
|
+
console.log(`package-build: ${files.length} localization file(s) are ` + `expandObject-safe.`);
|
|
535
503
|
}
|
|
536
504
|
|
|
537
505
|
/**
|
|
@@ -578,10 +546,7 @@ async function langCoverage(config, args) {
|
|
|
578
546
|
// Capped by default: the advisory half of a large package is pages
|
|
579
547
|
// long, and pages of warnings on every build is how a guard stops being
|
|
580
548
|
// read at all. The count is always stated, so nothing is hidden.
|
|
581
|
-
const shown =
|
|
582
|
-
args.unused ? unreferenced : (
|
|
583
|
-
unreferenced.slice(0, ADVISORY_PREVIEW)
|
|
584
|
-
);
|
|
549
|
+
const shown = args.unused ? unreferenced : unreferenced.slice(0, ADVISORY_PREVIEW);
|
|
585
550
|
reportFindings(shown, {});
|
|
586
551
|
if (shown.length < unreferenced.length) {
|
|
587
552
|
console.error(
|
|
@@ -637,21 +602,18 @@ async function langCoverage(config, args) {
|
|
|
637
602
|
);
|
|
638
603
|
}
|
|
639
604
|
const sets = [
|
|
640
|
-
...scripts.map((file) =>
|
|
641
|
-
collectScriptReferences(file.text, { file: file.path, roots }),
|
|
642
|
-
),
|
|
605
|
+
...scripts.map((file) => collectScriptReferences(file.text, { file: file.path, roots })),
|
|
643
606
|
...templates.map((file) =>
|
|
644
607
|
collectTemplateReferences(file.text, { file: file.path, roots }),
|
|
645
608
|
),
|
|
646
609
|
];
|
|
647
610
|
|
|
648
611
|
if (config.langReferences) {
|
|
649
|
-
const module = await import(`file://${config.langReferences}`).catch(
|
|
650
|
-
(
|
|
651
|
-
|
|
652
|
-
`
|
|
653
|
-
|
|
654
|
-
),
|
|
612
|
+
const module = await import(`file://${config.langReferences}`).catch((err) =>
|
|
613
|
+
die(
|
|
614
|
+
`cannot load \`packageBuild.lang.references\` ` +
|
|
615
|
+
`(${config.langReferences}): ${err.message}`,
|
|
616
|
+
),
|
|
655
617
|
);
|
|
656
618
|
if (typeof module.references !== "function") {
|
|
657
619
|
die(
|
|
@@ -707,10 +669,9 @@ function langHardcoded(config) {
|
|
|
707
669
|
let literals = 0;
|
|
708
670
|
let broken = 0;
|
|
709
671
|
for (const file of templates) {
|
|
710
|
-
literals += reportFindings(
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
);
|
|
672
|
+
literals += reportFindings(findHardcodedText(file.text, { allow: config.langAllow }), {
|
|
673
|
+
file: file.path,
|
|
674
|
+
});
|
|
714
675
|
broken += reportFindings(findTemplateSyntaxErrors(file.text), {
|
|
715
676
|
file: file.path,
|
|
716
677
|
});
|
|
@@ -737,8 +698,7 @@ function langHardcoded(config) {
|
|
|
737
698
|
}
|
|
738
699
|
|
|
739
700
|
console.log(
|
|
740
|
-
`package-build: ${templates.length} template(s) fully localized and ` +
|
|
741
|
-
`compiling.`,
|
|
701
|
+
`package-build: ${templates.length} template(s) fully localized and ` + `compiling.`,
|
|
742
702
|
);
|
|
743
703
|
}
|
|
744
704
|
|
|
@@ -768,8 +728,7 @@ function langCommand() {
|
|
|
768
728
|
.option("unused", {
|
|
769
729
|
type: "boolean",
|
|
770
730
|
default: false,
|
|
771
|
-
describe:
|
|
772
|
-
"coverage: list every unreferenced key, not a preview",
|
|
731
|
+
describe: "coverage: list every unreferenced key, not a preview",
|
|
773
732
|
}),
|
|
774
733
|
handler: handler(async (args) => {
|
|
775
734
|
const config = loadPackageBuildConfig();
|
|
@@ -803,8 +762,7 @@ function bundleCommand() {
|
|
|
803
762
|
builder: (y) =>
|
|
804
763
|
y.positional("action", {
|
|
805
764
|
choices: ["check"],
|
|
806
|
-
describe:
|
|
807
|
-
"check: verify the manifest and the staged bundle agree",
|
|
765
|
+
describe: "check: verify the manifest and the staged bundle agree",
|
|
808
766
|
}),
|
|
809
767
|
handler: handler(() => {
|
|
810
768
|
const config = loadPackageBuildConfig();
|
package/bin/report.mjs
CHANGED
|
@@ -79,8 +79,7 @@ import { emitDiagnostic } from "../engine/diagnostics.mjs";
|
|
|
79
79
|
export function toDiagnostics(findings, { file }) {
|
|
80
80
|
return findings.map((finding) => {
|
|
81
81
|
const hasLine = finding.line !== undefined && finding.line !== null;
|
|
82
|
-
const hasColumn =
|
|
83
|
-
finding.column !== undefined && finding.column !== null;
|
|
82
|
+
const hasColumn = finding.column !== undefined && finding.column !== null;
|
|
84
83
|
return {
|
|
85
84
|
file: finding.file ?? file,
|
|
86
85
|
...(hasLine ? { line: finding.line } : {}),
|
package/bundle.mjs
CHANGED
|
@@ -72,10 +72,7 @@ export function declaredGlobals(node) {
|
|
|
72
72
|
break;
|
|
73
73
|
case "ObjectPattern":
|
|
74
74
|
for (const p of pattern.properties)
|
|
75
|
-
namesIn(
|
|
76
|
-
p.type === "RestElement" ? p.argument : p.value,
|
|
77
|
-
out,
|
|
78
|
-
);
|
|
75
|
+
namesIn(p.type === "RestElement" ? p.argument : p.value, out);
|
|
79
76
|
break;
|
|
80
77
|
case "ArrayPattern":
|
|
81
78
|
for (const e of pattern.elements) namesIn(e, out);
|
|
@@ -157,12 +154,7 @@ export function globalDeclarations(source) {
|
|
|
157
154
|
* declaredAs: "esmodules"|"scripts"|"both"|"neither"}} The findings, empty
|
|
158
155
|
* when the two agree, and how the entry was declared.
|
|
159
156
|
*/
|
|
160
|
-
export function checkBundleLoading({
|
|
161
|
-
manifest,
|
|
162
|
-
source,
|
|
163
|
-
entry,
|
|
164
|
-
manifestName = "the manifest",
|
|
165
|
-
}) {
|
|
157
|
+
export function checkBundleLoading({ manifest, source, entry, manifestName = "the manifest" }) {
|
|
166
158
|
const declaredAs = entryDeclaration(manifest, entry);
|
|
167
159
|
|
|
168
160
|
if (declaredAs === "both") {
|
package/config.mjs
CHANGED
|
@@ -59,11 +59,7 @@
|
|
|
59
59
|
*/
|
|
60
60
|
|
|
61
61
|
import path from "node:path";
|
|
62
|
-
import {
|
|
63
|
-
loadPackConfig,
|
|
64
|
-
locateConfigError,
|
|
65
|
-
packConfigPath,
|
|
66
|
-
} from "./engine/pack-config.mjs";
|
|
62
|
+
import { loadPackConfig, locateConfigError, packConfigPath } from "./engine/pack-config.mjs";
|
|
67
63
|
|
|
68
64
|
/** Keys the reserved section may declare. */
|
|
69
65
|
const SECTION_KEYS = [
|
|
@@ -161,10 +157,9 @@ const ARTIFACT_OF_KIND = Object.freeze({
|
|
|
161
157
|
* @returns {never}
|
|
162
158
|
*/
|
|
163
159
|
function fail(where, problem) {
|
|
164
|
-
throw Object.assign(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
);
|
|
160
|
+
throw Object.assign(new TypeError(`package-build config: \`${where}\` ${problem}.`), {
|
|
161
|
+
field: where,
|
|
162
|
+
});
|
|
168
163
|
}
|
|
169
164
|
|
|
170
165
|
/**
|
|
@@ -315,10 +310,7 @@ function normalizeGlobs(value, fallback, where) {
|
|
|
315
310
|
const list = Array.isArray(value) ? value : [value];
|
|
316
311
|
return Object.freeze(
|
|
317
312
|
list.map((glob, index) =>
|
|
318
|
-
requireNonEmptyString(
|
|
319
|
-
glob,
|
|
320
|
-
Array.isArray(value) ? `${where}[${index}]` : where,
|
|
321
|
-
),
|
|
313
|
+
requireNonEmptyString(glob, Array.isArray(value) ? `${where}[${index}]` : where),
|
|
322
314
|
),
|
|
323
315
|
);
|
|
324
316
|
}
|
|
@@ -443,9 +435,7 @@ function normalizeE2ESuite(value) {
|
|
|
443
435
|
fail(where, "must be a non-empty list naming a program to run");
|
|
444
436
|
}
|
|
445
437
|
return Object.freeze(
|
|
446
|
-
value_.map((part, i) =>
|
|
447
|
-
requireNonEmptyString(part, `${where}[${i}]`),
|
|
448
|
-
),
|
|
438
|
+
value_.map((part, i) => requireNonEmptyString(part, `${where}[${i}]`)),
|
|
449
439
|
);
|
|
450
440
|
};
|
|
451
441
|
|
|
@@ -589,9 +579,7 @@ function normalizeExceptions(value, field, where) {
|
|
|
589
579
|
* @throws {TypeError} When the reserved section declares something malformed.
|
|
590
580
|
*/
|
|
591
581
|
export function resolvePackageBuildConfig(shared) {
|
|
592
|
-
const section = /** @type {Record<string, unknown>} */ (
|
|
593
|
-
shared.packageBuild ?? {}
|
|
594
|
-
);
|
|
582
|
+
const section = /** @type {Record<string, unknown>} */ (shared.packageBuild ?? {});
|
|
595
583
|
rejectUnknownKeys(section, SECTION_KEYS, "packageBuild.");
|
|
596
584
|
|
|
597
585
|
if (section.assets !== undefined && !Array.isArray(section.assets)) {
|
|
@@ -661,31 +649,22 @@ export function resolvePackageBuildConfig(shared) {
|
|
|
661
649
|
);
|
|
662
650
|
const containerInput = /** @type {Record<string, unknown>} */ (container);
|
|
663
651
|
const containerName =
|
|
664
|
-
containerInput.name === undefined ?
|
|
665
|
-
null
|
|
666
|
-
: requireContainerName(containerInput.name);
|
|
652
|
+
containerInput.name === undefined ? null : requireContainerName(containerInput.name);
|
|
667
653
|
const declaredStages = containerInput.stages ?? {};
|
|
668
654
|
if (!isMapping(declaredStages)) {
|
|
669
655
|
fail("packageBuild.container.stages", "must be a mapping");
|
|
670
656
|
}
|
|
671
657
|
const containerStages = Object.freeze(
|
|
672
658
|
Object.fromEntries(
|
|
673
|
-
Object.entries(
|
|
674
|
-
|
|
675
|
-
)
|
|
676
|
-
name,
|
|
677
|
-
normalizeContainerStage(entry, name),
|
|
678
|
-
]),
|
|
659
|
+
Object.entries(/** @type {Record<string, unknown>} */ (declaredStages)).map(
|
|
660
|
+
([name, entry]) => [name, normalizeContainerStage(entry, name)],
|
|
661
|
+
),
|
|
679
662
|
),
|
|
680
663
|
);
|
|
681
664
|
|
|
682
665
|
const e2e = section.e2e ?? {};
|
|
683
666
|
if (!isMapping(e2e)) fail("packageBuild.e2e", "must be a mapping");
|
|
684
|
-
rejectUnknownKeys(
|
|
685
|
-
/** @type {Record<string, unknown>} */ (e2e),
|
|
686
|
-
E2E_KEYS,
|
|
687
|
-
"packageBuild.e2e.",
|
|
688
|
-
);
|
|
667
|
+
rejectUnknownKeys(/** @type {Record<string, unknown>} */ (e2e), E2E_KEYS, "packageBuild.e2e.");
|
|
689
668
|
const e2eInput = /** @type {Record<string, unknown>} */ (e2e);
|
|
690
669
|
const declaredBuild = e2eInput.build ?? {};
|
|
691
670
|
if (!isMapping(declaredBuild)) {
|
|
@@ -695,12 +674,9 @@ export function resolvePackageBuildConfig(shared) {
|
|
|
695
674
|
// bundler has to run before the passes that copy into the stage it empties.
|
|
696
675
|
const e2eBuild = Object.freeze(
|
|
697
676
|
Object.fromEntries(
|
|
698
|
-
Object.entries(
|
|
699
|
-
|
|
700
|
-
)
|
|
701
|
-
name,
|
|
702
|
-
normalizeE2EBuildTarget(entry, name),
|
|
703
|
-
]),
|
|
677
|
+
Object.entries(/** @type {Record<string, unknown>} */ (declaredBuild)).map(
|
|
678
|
+
([name, entry]) => [name, normalizeE2EBuildTarget(entry, name)],
|
|
679
|
+
),
|
|
704
680
|
),
|
|
705
681
|
);
|
|
706
682
|
|
|
@@ -713,23 +689,15 @@ export function resolvePackageBuildConfig(shared) {
|
|
|
713
689
|
stageDir:
|
|
714
690
|
section.stageDir === undefined ?
|
|
715
691
|
"build/stage"
|
|
716
|
-
: requireNonEmptyString(
|
|
717
|
-
section.stageDir,
|
|
718
|
-
"packageBuild.stageDir",
|
|
719
|
-
),
|
|
692
|
+
: requireNonEmptyString(section.stageDir, "packageBuild.stageDir"),
|
|
720
693
|
packageKind: shared.packageKind,
|
|
721
694
|
packageId: shared.foundryPackage,
|
|
722
695
|
// Derived from the kind, which already decides it. Stating it was one
|
|
723
696
|
// more literal every consumer's release script carried.
|
|
724
697
|
artifact:
|
|
725
698
|
releaseInput.artifact === undefined ?
|
|
726
|
-
ARTIFACT_OF_KIND[
|
|
727
|
-
|
|
728
|
-
]
|
|
729
|
-
: requireNonEmptyString(
|
|
730
|
-
releaseInput.artifact,
|
|
731
|
-
"packageBuild.release.artifact",
|
|
732
|
-
),
|
|
699
|
+
ARTIFACT_OF_KIND[/** @type {"systems"|"modules"} */ (shared.packageKind)]
|
|
700
|
+
: requireNonEmptyString(releaseInput.artifact, "packageBuild.release.artifact"),
|
|
733
701
|
assets: Object.freeze(assets),
|
|
734
702
|
schema: normalizeSchema(section.schema),
|
|
735
703
|
assetTransform:
|
|
@@ -737,10 +705,7 @@ export function resolvePackageBuildConfig(shared) {
|
|
|
737
705
|
null
|
|
738
706
|
: path.resolve(
|
|
739
707
|
shared.rootDir,
|
|
740
|
-
requireNonEmptyString(
|
|
741
|
-
section.assetTransform,
|
|
742
|
-
"packageBuild.assetTransform",
|
|
743
|
-
),
|
|
708
|
+
requireNonEmptyString(section.assetTransform, "packageBuild.assetTransform"),
|
|
744
709
|
),
|
|
745
710
|
manifest: normalizeManifest(section.manifest),
|
|
746
711
|
manifestFlags:
|
|
@@ -748,19 +713,13 @@ export function resolvePackageBuildConfig(shared) {
|
|
|
748
713
|
null
|
|
749
714
|
: path.resolve(
|
|
750
715
|
shared.rootDir,
|
|
751
|
-
requireNonEmptyString(
|
|
752
|
-
section.manifestFlags,
|
|
753
|
-
"packageBuild.manifestFlags",
|
|
754
|
-
),
|
|
716
|
+
requireNonEmptyString(section.manifestFlags, "packageBuild.manifestFlags"),
|
|
755
717
|
),
|
|
756
718
|
cleanExtra: Object.freeze(cleanExtra),
|
|
757
719
|
langSources:
|
|
758
720
|
langInput.sources === undefined ?
|
|
759
721
|
"lang/*.json"
|
|
760
|
-
: requireNonEmptyString(
|
|
761
|
-
langInput.sources,
|
|
762
|
-
"packageBuild.lang.sources",
|
|
763
|
-
),
|
|
722
|
+
: requireNonEmptyString(langInput.sources, "packageBuild.lang.sources"),
|
|
764
723
|
langHelp:
|
|
765
724
|
langInput.help === undefined ?
|
|
766
725
|
null
|
|
@@ -771,10 +730,7 @@ export function resolvePackageBuildConfig(shared) {
|
|
|
771
730
|
langPrimary:
|
|
772
731
|
langInput.primary === undefined ?
|
|
773
732
|
"lang/en.json"
|
|
774
|
-
: requireNonEmptyString(
|
|
775
|
-
langInput.primary,
|
|
776
|
-
"packageBuild.lang.primary",
|
|
777
|
-
),
|
|
733
|
+
: requireNonEmptyString(langInput.primary, "packageBuild.lang.primary"),
|
|
778
734
|
langScripts: normalizeGlobs(
|
|
779
735
|
langInput.scripts,
|
|
780
736
|
["src/**/*.{ts,mjs}"],
|
|
@@ -791,38 +747,24 @@ export function resolvePackageBuildConfig(shared) {
|
|
|
791
747
|
langKeyRoots:
|
|
792
748
|
langInput.keyRoots === undefined ?
|
|
793
749
|
null
|
|
794
|
-
: normalizeGlobs(
|
|
795
|
-
langInput.keyRoots,
|
|
796
|
-
[],
|
|
797
|
-
"packageBuild.lang.keyRoots",
|
|
798
|
-
),
|
|
750
|
+
: normalizeGlobs(langInput.keyRoots, [], "packageBuild.lang.keyRoots"),
|
|
799
751
|
langReferences:
|
|
800
752
|
langInput.references === undefined ?
|
|
801
753
|
null
|
|
802
754
|
: path.resolve(
|
|
803
755
|
shared.rootDir,
|
|
804
|
-
requireNonEmptyString(
|
|
805
|
-
langInput.references,
|
|
806
|
-
"packageBuild.lang.references",
|
|
807
|
-
),
|
|
756
|
+
requireNonEmptyString(langInput.references, "packageBuild.lang.references"),
|
|
808
757
|
),
|
|
809
758
|
langRetained: normalizeExceptions(
|
|
810
759
|
langInput.retained,
|
|
811
760
|
"prefix",
|
|
812
761
|
"packageBuild.lang.retained",
|
|
813
762
|
),
|
|
814
|
-
langAllow: normalizeExceptions(
|
|
815
|
-
langInput.allow,
|
|
816
|
-
"literal",
|
|
817
|
-
"packageBuild.lang.allow",
|
|
818
|
-
),
|
|
763
|
+
langAllow: normalizeExceptions(langInput.allow, "literal", "packageBuild.lang.allow"),
|
|
819
764
|
envPrefix:
|
|
820
765
|
deployInput.envPrefix === undefined ?
|
|
821
766
|
"SOHL"
|
|
822
|
-
: requireNonEmptyString(
|
|
823
|
-
deployInput.envPrefix,
|
|
824
|
-
"packageBuild.deploy.envPrefix",
|
|
825
|
-
),
|
|
767
|
+
: requireNonEmptyString(deployInput.envPrefix, "packageBuild.deploy.envPrefix"),
|
|
826
768
|
// The file Foundry loads, as the manifest spells it. Named after the
|
|
827
769
|
// package by convention, and the id is already derived from
|
|
828
770
|
// package.json `name` — so a repository states this only when its
|
|
@@ -835,10 +777,7 @@ export function resolvePackageBuildConfig(shared) {
|
|
|
835
777
|
bundleEntry:
|
|
836
778
|
bundleInput.entry === undefined ?
|
|
837
779
|
`${shared.foundryPackage}.mjs`
|
|
838
|
-
: requireNonEmptyString(
|
|
839
|
-
bundleInput.entry,
|
|
840
|
-
"packageBuild.bundle.entry",
|
|
841
|
-
),
|
|
780
|
+
: requireNonEmptyString(bundleInput.entry, "packageBuild.bundle.entry"),
|
|
842
781
|
// Read from the top level, where the package already claims it. The
|
|
843
782
|
// end-to-end pin derives from this, so the claim and the evidence for
|
|
844
783
|
// it are the same number and cannot drift apart.
|
|
@@ -851,10 +790,7 @@ export function resolvePackageBuildConfig(shared) {
|
|
|
851
790
|
containerImage:
|
|
852
791
|
containerInput.image === undefined ?
|
|
853
792
|
null
|
|
854
|
-
: requireNonEmptyString(
|
|
855
|
-
containerInput.image,
|
|
856
|
-
"packageBuild.container.image",
|
|
857
|
-
),
|
|
793
|
+
: requireNonEmptyString(containerInput.image, "packageBuild.container.image"),
|
|
858
794
|
containerName,
|
|
859
795
|
containerStages,
|
|
860
796
|
e2eStage:
|
|
@@ -863,20 +799,9 @@ export function resolvePackageBuildConfig(shared) {
|
|
|
863
799
|
: requireNonEmptyString(e2eInput.stage, "packageBuild.e2e.stage"),
|
|
864
800
|
e2eSuite: normalizeE2ESuite(e2eInput.suite),
|
|
865
801
|
e2eBuild,
|
|
866
|
-
e2eWorld: normalizeStringMap(
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
E2E_WORLD_KEYS,
|
|
870
|
-
),
|
|
871
|
-
e2eGm: normalizeStringMap(
|
|
872
|
-
e2eInput.gm,
|
|
873
|
-
"packageBuild.e2e.gm",
|
|
874
|
-
E2E_GM_KEYS,
|
|
875
|
-
),
|
|
876
|
-
e2eDocuments: normalizeStringMap(
|
|
877
|
-
e2eInput.documents,
|
|
878
|
-
"packageBuild.e2e.documents",
|
|
879
|
-
),
|
|
802
|
+
e2eWorld: normalizeStringMap(e2eInput.world, "packageBuild.e2e.world", E2E_WORLD_KEYS),
|
|
803
|
+
e2eGm: normalizeStringMap(e2eInput.gm, "packageBuild.e2e.gm", E2E_GM_KEYS),
|
|
804
|
+
e2eDocuments: normalizeStringMap(e2eInput.documents, "packageBuild.e2e.documents"),
|
|
880
805
|
});
|
|
881
806
|
}
|
|
882
807
|
|