@heroiclands/package-build 8.1.0 → 10.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 +748 -0
- package/CONTENT.md +273 -13
- package/bin/content-build.mjs +479 -123
- 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 +300 -188
- package/coverage.mjs +14 -55
- package/deploy.mjs +4 -13
- package/docs/content-format.md +1418 -0
- package/e2e.mjs +16 -55
- package/engine/address-charset.mjs +62 -0
- package/engine/address-diff.mjs +1 -4
- package/engine/alias-index.mjs +153 -0
- package/engine/base-compiler.mjs +203 -31
- package/engine/code-fences.mjs +4 -13
- package/engine/compendiums.mjs +13 -37
- package/engine/content-address.mjs +6 -10
- package/engine/content-format-check.mjs +570 -0
- package/engine/content-format.mjs +253 -0
- package/engine/content-links.mjs +144 -99
- package/engine/content-lint.mjs +12 -16
- package/engine/content-slug.mjs +2 -6
- package/engine/content-tables.mjs +26 -79
- package/engine/diagnostics.mjs +37 -15
- package/engine/document-subtypes.mjs +440 -0
- package/engine/field-reference.mjs +6 -20
- package/engine/field-spec.mjs +49 -45
- package/engine/foreign-catalog.mjs +7 -22
- package/engine/foreign-manifests.mjs +1 -4
- package/engine/frontmatter-lint.mjs +347 -43
- package/engine/frontmatter.mjs +3 -8
- package/engine/generate.mjs +36 -20
- package/engine/helpers.mjs +54 -81
- package/engine/homepage.mjs +4 -15
- package/engine/ids.mjs +21 -12
- package/engine/index.mjs +15 -0
- package/engine/item-registry.mjs +72 -9
- package/engine/journals.mjs +4 -14
- package/engine/kb-manifest.mjs +41 -24
- package/engine/macros.mjs +2 -10
- package/engine/manifest-emit.mjs +6 -17
- package/engine/map-notes.mjs +53 -87
- package/engine/note-claims.mjs +383 -0
- package/engine/note-package.mjs +1 -4
- package/engine/note-vocabulary.mjs +678 -0
- package/engine/pack-config.mjs +56 -60
- package/engine/pack-router.mjs +18 -8
- package/engine/prose-config.mjs +20 -4
- package/engine/prose-lint.mjs +61 -17
- package/engine/region-events.mjs +1 -3
- package/engine/retired-fields.mjs +117 -3
- package/engine/scene-levels.mjs +8 -22
- package/engine/scenes.mjs +31 -47
- package/engine/schema-check.mjs +348 -7
- package/engine/schema-extract.mjs +11 -39
- package/engine/site-build.mjs +13 -38
- package/engine/site-index.mjs +40 -35
- package/engine/system-block.mjs +513 -0
- package/engine/web-wikilinks.mjs +115 -92
- package/engine/wikilink-syntax.mjs +30 -0
- package/engine/wikilinks.mjs +147 -183
- package/index.mjs +1 -5
- package/lang.mjs +1 -3
- package/manifest.mjs +10 -37
- package/markdownlint-config.mjs +1 -5
- package/package.json +6 -2
- package/sohl/actors.mjs +251 -68
- package/sohl/being-info.mjs +3 -6
- package/sohl/document-subtypes.mjs +82 -0
- package/sohl/index.mjs +4 -6
- package/sohl/item-builders.mjs +1 -3
- package/sohl/item-fields.mjs +16 -34
- package/sohl/items.mjs +111 -17
- package/sohl/kb-passes.mjs +29 -39
- package/sohl/note-schemas.mjs +11 -7
- 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/content-config.d.mts +48 -4
- package/types/coverage.d.mts +1 -1
- package/types/e2e.d.mts +4 -4
- package/types/engine/address-charset.d.mts +45 -0
- package/types/engine/alias-index.d.mts +122 -0
- package/types/engine/base-compiler.d.mts +132 -4
- package/types/engine/content-address.d.mts +2 -2
- package/types/engine/content-format-check.d.mts +163 -0
- package/types/engine/content-format.d.mts +101 -0
- package/types/engine/content-links.d.mts +16 -1
- package/types/engine/content-lint.d.mts +6 -0
- package/types/engine/diagnostics.d.mts +29 -0
- package/types/engine/document-subtypes.d.mts +233 -0
- package/types/engine/field-spec.d.mts +76 -23
- package/types/engine/frontmatter-lint.d.mts +47 -2
- package/types/engine/generate.d.mts +15 -2
- package/types/engine/helpers.d.mts +22 -14
- package/types/engine/ids.d.mts +10 -0
- package/types/engine/index.d.mts +5 -0
- package/types/engine/item-registry.d.mts +21 -2
- package/types/engine/kb-manifest.d.mts +35 -8
- package/types/engine/map-notes.d.mts +21 -11
- package/types/engine/note-claims.d.mts +113 -0
- package/types/engine/note-vocabulary.d.mts +251 -0
- package/types/engine/pack-config.d.mts +4 -3
- package/types/engine/pack-router.d.mts +4 -4
- package/types/engine/prose-lint.d.mts +6 -2
- package/types/engine/retired-fields.d.mts +73 -2
- package/types/engine/schema-check.d.mts +182 -0
- package/types/engine/schema-extract.d.mts +1 -1
- package/types/engine/site-index.d.mts +1 -1
- package/types/engine/system-block.d.mts +281 -0
- package/types/engine/web-wikilinks.d.mts +23 -12
- package/types/engine/wikilink-syntax.d.mts +29 -0
- package/types/manifest.d.mts +1 -1
- package/types/sohl/actors.d.mts +62 -6
- package/types/sohl/document-subtypes.d.mts +14 -0
- package/types/sohl/index.d.mts +1 -0
- package/types/sohl/items.d.mts +21 -0
package/container.mjs
CHANGED
|
@@ -155,10 +155,7 @@ export function containerName(packageId, stage, base = null) {
|
|
|
155
155
|
* @returns {number} The host port.
|
|
156
156
|
* @throws {Error} When the stage has no port from any source.
|
|
157
157
|
*/
|
|
158
|
-
export function resolveStagePort(
|
|
159
|
-
stage,
|
|
160
|
-
{ env = process.env, stages = {} } = {},
|
|
161
|
-
) {
|
|
158
|
+
export function resolveStagePort(stage, { env = process.env, stages = {} } = {}) {
|
|
162
159
|
const fromEnv = env[`FOUNDRYVTT_${stage.toUpperCase()}_PORT`]?.trim();
|
|
163
160
|
const port =
|
|
164
161
|
fromEnv ? Number(fromEnv)
|
|
@@ -205,12 +202,7 @@ const EXACT_BUILD = /^\d+\.\d+$/;
|
|
|
205
202
|
*/
|
|
206
203
|
export function resolveFoundryVersion(
|
|
207
204
|
stage,
|
|
208
|
-
{
|
|
209
|
-
env = process.env,
|
|
210
|
-
stages = {},
|
|
211
|
-
compatibilityMinimum = null,
|
|
212
|
-
e2eStage = "test",
|
|
213
|
-
} = {},
|
|
205
|
+
{ env = process.env, stages = {}, compatibilityMinimum = null, e2eStage = "test" } = {},
|
|
214
206
|
) {
|
|
215
207
|
const fromEnv = env[`FOUNDRYVTT_${stage.toUpperCase()}_VERSION`]?.trim();
|
|
216
208
|
if (fromEnv) return fromEnv;
|
|
@@ -267,9 +259,7 @@ export function resolveWorld(stage, { env = process.env, stages = {} } = {}) {
|
|
|
267
259
|
const fromEnv = env[`FOUNDRYVTT_${stage.toUpperCase()}_WORLD`];
|
|
268
260
|
if (fromEnv !== undefined) return fromEnv.trim();
|
|
269
261
|
const declared = stages[stage]?.world;
|
|
270
|
-
return declared === undefined || declared === null ?
|
|
271
|
-
null
|
|
272
|
-
: String(declared);
|
|
262
|
+
return declared === undefined || declared === null ? null : String(declared);
|
|
273
263
|
}
|
|
274
264
|
|
|
275
265
|
/**
|
|
@@ -387,12 +377,7 @@ export function dockerRunArgs({
|
|
|
387
377
|
`${dataRoot}:/data`,
|
|
388
378
|
];
|
|
389
379
|
if (cacheDir) {
|
|
390
|
-
args.push(
|
|
391
|
-
"--volume",
|
|
392
|
-
`${cacheDir}:${CACHE_MOUNT}`,
|
|
393
|
-
"-e",
|
|
394
|
-
`CONTAINER_CACHE=${CACHE_MOUNT}`,
|
|
395
|
-
);
|
|
380
|
+
args.push("--volume", `${cacheDir}:${CACHE_MOUNT}`, "-e", `CONTAINER_CACHE=${CACHE_MOUNT}`);
|
|
396
381
|
}
|
|
397
382
|
for (const [key, value] of passthroughEnv(env)) {
|
|
398
383
|
args.push("-e", `${key}=${value}`);
|
|
@@ -414,10 +399,7 @@ export function dockerRunArgs({
|
|
|
414
399
|
export function runDocker(args) {
|
|
415
400
|
const result = spawnSync("docker", args, { stdio: "inherit" });
|
|
416
401
|
if (result.error) {
|
|
417
|
-
if (
|
|
418
|
-
/** @type {NodeJS.ErrnoException} */ (result.error).code ===
|
|
419
|
-
"ENOENT"
|
|
420
|
-
) {
|
|
402
|
+
if (/** @type {NodeJS.ErrnoException} */ (result.error).code === "ENOENT") {
|
|
421
403
|
throw new Error(
|
|
422
404
|
"docker was not found on PATH. Install Docker and make sure " +
|
|
423
405
|
"the `docker` CLI is available.",
|
|
@@ -464,13 +446,7 @@ export function containerExists(name, runningOnly = false) {
|
|
|
464
446
|
* @returns {string[]} The container names.
|
|
465
447
|
*/
|
|
466
448
|
export function runningFoundryContainers(except = "") {
|
|
467
|
-
return captureDocker([
|
|
468
|
-
"ps",
|
|
469
|
-
"--filter",
|
|
470
|
-
"name=-foundry-",
|
|
471
|
-
"--format",
|
|
472
|
-
"{{.Names}}",
|
|
473
|
-
])
|
|
449
|
+
return captureDocker(["ps", "--filter", "name=-foundry-", "--format", "{{.Names}}"])
|
|
474
450
|
.split("\n")
|
|
475
451
|
.filter((name) => name && name !== except);
|
|
476
452
|
}
|
|
@@ -559,26 +535,18 @@ export function resolveContainer({ stage, config, env = process.env }) {
|
|
|
559
535
|
* @param {(message: string) => void} [opts.log] - Progress reporting.
|
|
560
536
|
* @returns {number} The exit status.
|
|
561
537
|
*/
|
|
562
|
-
export function startContainer(
|
|
563
|
-
container,
|
|
564
|
-
{ dataRoot, env = process.env, log = () => {} },
|
|
565
|
-
) {
|
|
538
|
+
export function startContainer(container, { dataRoot, env = process.env, log = () => {} }) {
|
|
566
539
|
if (containerExists(container.name)) {
|
|
567
540
|
// Nothing is running against this data root — we are about to start it
|
|
568
541
|
// — so any lock present was left by a previous crash.
|
|
569
|
-
if (!containerExists(container.name, true))
|
|
570
|
-
|
|
571
|
-
log(
|
|
572
|
-
`Starting existing container '${container.name}' → ${container.url}`,
|
|
573
|
-
);
|
|
542
|
+
if (!containerExists(container.name, true)) clearStaleLock(dataRoot, log);
|
|
543
|
+
log(`Starting existing container '${container.name}' → ${container.url}`);
|
|
574
544
|
return runDocker(["start", container.name]);
|
|
575
545
|
}
|
|
576
546
|
|
|
577
547
|
clearStaleLock(dataRoot, log);
|
|
578
548
|
if (container.cacheDir && !fs.existsSync(container.cacheDir)) {
|
|
579
|
-
throw new Error(
|
|
580
|
-
`FOUNDRYVTT_CACHE directory does not exist: ${container.cacheDir}.`,
|
|
581
|
-
);
|
|
549
|
+
throw new Error(`FOUNDRYVTT_CACHE directory does not exist: ${container.cacheDir}.`);
|
|
582
550
|
}
|
|
583
551
|
log(
|
|
584
552
|
`Creating container '${container.name}' from ${container.image}\n` +
|
|
@@ -634,13 +602,7 @@ export function removeContainer(name, log = () => {}) {
|
|
|
634
602
|
* @returns {number} The exit status.
|
|
635
603
|
* @throws {Error} On an unknown action, or a stage with no usable data root.
|
|
636
604
|
*/
|
|
637
|
-
export function containerAction({
|
|
638
|
-
action,
|
|
639
|
-
stage,
|
|
640
|
-
config,
|
|
641
|
-
env = process.env,
|
|
642
|
-
log = () => {},
|
|
643
|
-
}) {
|
|
605
|
+
export function containerAction({ action, stage, config, env = process.env, log = () => {} }) {
|
|
644
606
|
if (!CONTAINER_ACTIONS.includes(action)) {
|
|
645
607
|
throw new Error(
|
|
646
608
|
`Invalid container action '${action}'. Valid actions are: ` +
|
|
@@ -677,12 +639,7 @@ export function containerAction({
|
|
|
677
639
|
removeContainer(container.name, log);
|
|
678
640
|
return 0;
|
|
679
641
|
case "status":
|
|
680
|
-
return runDocker([
|
|
681
|
-
"ps",
|
|
682
|
-
"-a",
|
|
683
|
-
"--filter",
|
|
684
|
-
`name=^${container.name}$`,
|
|
685
|
-
]);
|
|
642
|
+
return runDocker(["ps", "-a", "--filter", `name=^${container.name}$`]);
|
|
686
643
|
case "logs":
|
|
687
644
|
return runDocker(["logs", "-f", container.name]);
|
|
688
645
|
default:
|
|
@@ -702,8 +659,7 @@ function requireDataRoot(stage, env) {
|
|
|
702
659
|
const dataRoot = resolveDataRoot(stage, { env });
|
|
703
660
|
if (!fs.existsSync(dataRoot)) {
|
|
704
661
|
throw new Error(
|
|
705
|
-
`Data directory does not exist: ${dataRoot} (from ` +
|
|
706
|
-
`${dataEnvVar(stage)}).`,
|
|
662
|
+
`Data directory does not exist: ${dataRoot} (from ` + `${dataEnvVar(stage)}).`,
|
|
707
663
|
);
|
|
708
664
|
}
|
|
709
665
|
return dataRoot;
|