@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/sohl/item-builders.mjs
CHANGED
|
@@ -108,7 +108,5 @@ function entryFor(type) {
|
|
|
108
108
|
* @type {Readonly<Record<string, Readonly<{system: (fm: object) => object, img: string, fields: readonly object[]}>>>}
|
|
109
109
|
*/
|
|
110
110
|
export const ITEM_BUILDERS = Object.freeze(
|
|
111
|
-
Object.fromEntries(
|
|
112
|
-
Object.keys(ITEM_FIELDS).map((type) => [type, entryFor(type)]),
|
|
113
|
-
),
|
|
111
|
+
Object.fromEntries(Object.keys(ITEM_FIELDS).map((type) => [type, entryFor(type)])),
|
|
114
112
|
);
|
package/sohl/item-fields.mjs
CHANGED
|
@@ -106,8 +106,7 @@ function noteContext(fm, type) {
|
|
|
106
106
|
/** Aptitude weights per skill selector, validated as whole numbers. */
|
|
107
107
|
const SKILL_APTITUDES = Object.freeze({
|
|
108
108
|
shape: "map of skill selector → whole number",
|
|
109
|
-
read: (_raw, { fm }) =>
|
|
110
|
-
resolveSkillAptitudes(fm, noteContext(fm, "mystery")),
|
|
109
|
+
read: (_raw, { fm }) => resolveSkillAptitudes(fm, noteContext(fm, "mystery")),
|
|
111
110
|
});
|
|
112
111
|
|
|
113
112
|
/** Standings toward other affiliations, validated against the closed list. */
|
|
@@ -127,14 +126,10 @@ const STRIKE_MODES = Object.freeze({
|
|
|
127
126
|
const seen = new Set();
|
|
128
127
|
for (const { shortcode } of raw) {
|
|
129
128
|
if (!shortcode) {
|
|
130
|
-
throw new Error(
|
|
131
|
-
"weapongear strikeModes array element requires a 'shortcode'",
|
|
132
|
-
);
|
|
129
|
+
throw new Error("weapongear strikeModes array element requires a 'shortcode'");
|
|
133
130
|
}
|
|
134
131
|
if (seen.has(shortcode)) {
|
|
135
|
-
throw new Error(
|
|
136
|
-
`weapongear has duplicate strike-mode shortcode "${shortcode}"`,
|
|
137
|
-
);
|
|
132
|
+
throw new Error(`weapongear has duplicate strike-mode shortcode "${shortcode}"`);
|
|
138
133
|
}
|
|
139
134
|
seen.add(shortcode);
|
|
140
135
|
}
|
|
@@ -218,8 +213,7 @@ const GEAR_COMMON = Object.freeze([
|
|
|
218
213
|
{
|
|
219
214
|
to: "sharedWithCohortIds",
|
|
220
215
|
value: () => [],
|
|
221
|
-
describe:
|
|
222
|
-
"Cohorts sharing the article. Possession state, never authored.",
|
|
216
|
+
describe: "Cohorts sharing the article. Possession state, never authored.",
|
|
223
217
|
},
|
|
224
218
|
{
|
|
225
219
|
to: "containerId",
|
|
@@ -250,8 +244,7 @@ export const ITEM_FIELDS = Object.freeze({
|
|
|
250
244
|
to: "subType",
|
|
251
245
|
...SUB_TYPE,
|
|
252
246
|
required: true,
|
|
253
|
-
describe:
|
|
254
|
-
"Which kind of affiliation this is — the society's character.",
|
|
247
|
+
describe: "Which kind of affiliation this is — the society's character.",
|
|
255
248
|
},
|
|
256
249
|
{
|
|
257
250
|
name: "society",
|
|
@@ -286,8 +279,7 @@ export const ITEM_FIELDS = Object.freeze({
|
|
|
286
279
|
to: "relation",
|
|
287
280
|
...RELATION,
|
|
288
281
|
default: {},
|
|
289
|
-
describe:
|
|
290
|
-
"How this society regards others: aligned, unaligned, rival or nemesis.",
|
|
282
|
+
describe: "How this society regards others: aligned, unaligned, rival or nemesis.",
|
|
291
283
|
},
|
|
292
284
|
]),
|
|
293
285
|
|
|
@@ -371,16 +363,14 @@ export const ITEM_FIELDS = Object.freeze({
|
|
|
371
363
|
to: "locations.flexible",
|
|
372
364
|
...BLANK_IS_DEFAULT,
|
|
373
365
|
default: [],
|
|
374
|
-
describe:
|
|
375
|
-
"Body locations the article covers flexibly, by location shortcode.",
|
|
366
|
+
describe: "Body locations the article covers flexibly, by location shortcode.",
|
|
376
367
|
},
|
|
377
368
|
{
|
|
378
369
|
name: "rigidloc",
|
|
379
370
|
to: "locations.rigid",
|
|
380
371
|
...BLANK_IS_DEFAULT,
|
|
381
372
|
default: [],
|
|
382
|
-
describe:
|
|
383
|
-
"Body locations the article covers rigidly, by location shortcode.",
|
|
373
|
+
describe: "Body locations the article covers rigidly, by location shortcode.",
|
|
384
374
|
},
|
|
385
375
|
{
|
|
386
376
|
name: "facing",
|
|
@@ -463,16 +453,14 @@ export const ITEM_FIELDS = Object.freeze({
|
|
|
463
453
|
to: "initDiceFormula",
|
|
464
454
|
...AS_AUTHORED,
|
|
465
455
|
default: "",
|
|
466
|
-
describe:
|
|
467
|
-
"Dice expression rolled to generate the score during character creation.",
|
|
456
|
+
describe: "Dice expression rolled to generate the score during character creation.",
|
|
468
457
|
},
|
|
469
458
|
{
|
|
470
459
|
name: "impairedByRoles",
|
|
471
460
|
to: "impairedByRoles",
|
|
472
461
|
...AS_AUTHORED,
|
|
473
462
|
default: [],
|
|
474
|
-
describe:
|
|
475
|
-
"Body-part roles whose impairment penalises tests against this attribute.",
|
|
463
|
+
describe: "Body-part roles whose impairment penalises tests against this attribute.",
|
|
476
464
|
},
|
|
477
465
|
]),
|
|
478
466
|
|
|
@@ -701,24 +689,21 @@ export const ITEM_FIELDS = Object.freeze({
|
|
|
701
689
|
ref: "skill",
|
|
702
690
|
...AS_AUTHORED,
|
|
703
691
|
default: "",
|
|
704
|
-
describe:
|
|
705
|
-
"Shortcode of the skill this one specialises, for a specialisation.",
|
|
692
|
+
describe: "Shortcode of the skill this one specialises, for a specialisation.",
|
|
706
693
|
},
|
|
707
694
|
{
|
|
708
695
|
name: "initSkillMult",
|
|
709
696
|
to: "initSkillMult",
|
|
710
697
|
...NUMBER,
|
|
711
698
|
default: 0,
|
|
712
|
-
describe:
|
|
713
|
-
"Multiplier applied to Skill Base when the skill opens on an actor.",
|
|
699
|
+
describe: "Multiplier applied to Skill Base when the skill opens on an actor.",
|
|
714
700
|
},
|
|
715
701
|
{
|
|
716
702
|
name: "impairedByRoles",
|
|
717
703
|
to: "impairedByRoles",
|
|
718
704
|
...AS_AUTHORED,
|
|
719
705
|
default: [],
|
|
720
|
-
describe:
|
|
721
|
-
"Body-part roles whose impairment penalises tests against this skill.",
|
|
706
|
+
describe: "Body-part roles whose impairment penalises tests against this skill.",
|
|
722
707
|
},
|
|
723
708
|
]),
|
|
724
709
|
|
|
@@ -742,8 +727,7 @@ export const ITEM_FIELDS = Object.freeze({
|
|
|
742
727
|
to: "levelBase",
|
|
743
728
|
...NULLABLE_COUNT,
|
|
744
729
|
default: null,
|
|
745
|
-
describe:
|
|
746
|
-
"Injury level. Unset on a descriptive condition, which has no level.",
|
|
730
|
+
describe: "Injury level. Unset on a descriptive condition, which has no level.",
|
|
747
731
|
},
|
|
748
732
|
{
|
|
749
733
|
name: "healingRateBase",
|
|
@@ -757,16 +741,14 @@ export const ITEM_FIELDS = Object.freeze({
|
|
|
757
741
|
to: "aspect",
|
|
758
742
|
...AS_AUTHORED,
|
|
759
743
|
default: null,
|
|
760
|
-
describe:
|
|
761
|
-
"How the injury was inflicted. Unset on a descriptive condition.",
|
|
744
|
+
describe: "How the injury was inflicted. Unset on a descriptive condition.",
|
|
762
745
|
},
|
|
763
746
|
{
|
|
764
747
|
name: "bodyLocationCode",
|
|
765
748
|
to: "bodyLocationCode",
|
|
766
749
|
...AS_AUTHORED,
|
|
767
750
|
default: null,
|
|
768
|
-
describe:
|
|
769
|
-
"Shortcode of the body location injured. Unset on a descriptive condition.",
|
|
751
|
+
describe: "Shortcode of the body location injured. Unset on a descriptive condition.",
|
|
770
752
|
},
|
|
771
753
|
]),
|
|
772
754
|
|
package/sohl/items.mjs
CHANGED
|
@@ -189,8 +189,6 @@ export class Items extends BasePackCompiler {
|
|
|
189
189
|
|
|
190
190
|
/** @inheritdoc */
|
|
191
191
|
reportDetail(stats) {
|
|
192
|
-
log.debug(
|
|
193
|
-
`Skipped ${stats.skippedOther} non-item file(s) (no recognized type)`,
|
|
194
|
-
);
|
|
192
|
+
log.debug(`Skipped ${stats.skippedOther} non-item file(s) (no recognized type)`);
|
|
195
193
|
}
|
|
196
194
|
}
|
package/sohl/kb-passes.mjs
CHANGED
|
@@ -90,8 +90,7 @@ function readSymbolMap(file, repoRoot) {
|
|
|
90
90
|
raw = fs.readFileSync(resolved, "utf8");
|
|
91
91
|
} catch (err) {
|
|
92
92
|
throw new Error(
|
|
93
|
-
`site.passOptions.symbolMap ${resolved} cannot be read: ` +
|
|
94
|
-
`${err.message}`,
|
|
93
|
+
`site.passOptions.symbolMap ${resolved} cannot be read: ` + `${err.message}`,
|
|
95
94
|
);
|
|
96
95
|
}
|
|
97
96
|
|
|
@@ -100,8 +99,7 @@ function readSymbolMap(file, repoRoot) {
|
|
|
100
99
|
parsed = JSON.parse(raw);
|
|
101
100
|
} catch (err) {
|
|
102
101
|
throw new Error(
|
|
103
|
-
`site.passOptions.symbolMap ${resolved} is not valid JSON: ` +
|
|
104
|
-
`${err.message}`,
|
|
102
|
+
`site.passOptions.symbolMap ${resolved} is not valid JSON: ` + `${err.message}`,
|
|
105
103
|
);
|
|
106
104
|
}
|
|
107
105
|
|
|
@@ -140,39 +138,34 @@ function readSymbolMap(file, repoRoot) {
|
|
|
140
138
|
* @returns {string} The body with every tag resolved.
|
|
141
139
|
*/
|
|
142
140
|
export function resolveApiLinks(body, symbols, apiBase) {
|
|
143
|
-
return body.replace(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
text = "";
|
|
159
|
-
}
|
|
141
|
+
return body.replace(/\{@link(code|plain)?\s+([^}]+)\}/g, (_m, kind, inner) => {
|
|
142
|
+
inner = inner.trim();
|
|
143
|
+
let target, text;
|
|
144
|
+
const pipe = inner.indexOf("|");
|
|
145
|
+
const space = inner.search(/\s/);
|
|
146
|
+
if (pipe !== -1) {
|
|
147
|
+
target = inner.slice(0, pipe).trim();
|
|
148
|
+
text = inner.slice(pipe + 1).trim();
|
|
149
|
+
} else if (space !== -1) {
|
|
150
|
+
target = inner.slice(0, space);
|
|
151
|
+
text = inner.slice(space + 1).trim();
|
|
152
|
+
} else {
|
|
153
|
+
target = inner;
|
|
154
|
+
text = "";
|
|
155
|
+
}
|
|
160
156
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
157
|
+
if (/^https?:\/\//.test(target)) {
|
|
158
|
+
return `[${text || target}](${target})`;
|
|
159
|
+
}
|
|
164
160
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
return kind === "plain" ? display : `\`${display}\``;
|
|
174
|
-
},
|
|
175
|
-
);
|
|
161
|
+
const url = symbols[target];
|
|
162
|
+
const display = text || target.split(".").pop();
|
|
163
|
+
if (url) {
|
|
164
|
+
const href = apiBase + url;
|
|
165
|
+
return kind === "code" ? `[\`${display}\`](${href})` : `[${display}](${href})`;
|
|
166
|
+
}
|
|
167
|
+
return kind === "plain" ? display : `\`${display}\``;
|
|
168
|
+
});
|
|
176
169
|
}
|
|
177
170
|
|
|
178
171
|
/**
|
|
@@ -218,10 +211,7 @@ export function rewriteRepoLinks(body, docRel, options) {
|
|
|
218
211
|
let out;
|
|
219
212
|
if (repoRel.startsWith(`${docsRel}/`) && repoRel.endsWith(".md")) {
|
|
220
213
|
const rel2 = repoRel.slice(docsRel.length + 1, -3).toLowerCase();
|
|
221
|
-
const devPath =
|
|
222
|
-
path.basename(rel2) === "readme" ?
|
|
223
|
-
path.posix.dirname(rel2)
|
|
224
|
-
: rel2;
|
|
214
|
+
const devPath = path.basename(rel2) === "readme" ? path.posix.dirname(rel2) : rel2;
|
|
225
215
|
out = `${route}${devPath === "." ? "" : `${devPath}/`}${anchor}`;
|
|
226
216
|
} else {
|
|
227
217
|
out = `${blob}${repoRel}${anchor}`;
|
package/sohl/skill-base.mjs
CHANGED
|
@@ -116,9 +116,7 @@ function evalNode(node, attrs) {
|
|
|
116
116
|
switch (node.type) {
|
|
117
117
|
case "Literal": {
|
|
118
118
|
if (typeof node.value !== "number") {
|
|
119
|
-
throw new Error(
|
|
120
|
-
`unsupported literal ${JSON.stringify(node.value)}`,
|
|
121
|
-
);
|
|
119
|
+
throw new Error(`unsupported literal ${JSON.stringify(node.value)}`);
|
|
122
120
|
}
|
|
123
121
|
return node.value;
|
|
124
122
|
}
|
|
@@ -126,9 +124,7 @@ function evalNode(node, attrs) {
|
|
|
126
124
|
// Only `attr.<code>` and `attr["<code>"]`. Any other object, and
|
|
127
125
|
// any computed key that is not a plain string, is out of scope.
|
|
128
126
|
if (node.object?.type !== "Identifier") {
|
|
129
|
-
throw new Error(
|
|
130
|
-
"only `attr.<code>` member reads are supported",
|
|
131
|
-
);
|
|
127
|
+
throw new Error("only `attr.<code>` member reads are supported");
|
|
132
128
|
}
|
|
133
129
|
if (node.object.name !== "attr") {
|
|
134
130
|
throw new Error(
|
|
@@ -136,13 +132,8 @@ function evalNode(node, attrs) {
|
|
|
136
132
|
);
|
|
137
133
|
}
|
|
138
134
|
if (node.computed) {
|
|
139
|
-
if (
|
|
140
|
-
|
|
141
|
-
typeof node.property.value !== "string"
|
|
142
|
-
) {
|
|
143
|
-
throw new Error(
|
|
144
|
-
"a computed `attr[...]` read needs a literal string shortcode",
|
|
145
|
-
);
|
|
135
|
+
if (node.property.type !== "Literal" || typeof node.property.value !== "string") {
|
|
136
|
+
throw new Error("a computed `attr[...]` read needs a literal string shortcode");
|
|
146
137
|
}
|
|
147
138
|
return readAttr(attrs, node.property.value);
|
|
148
139
|
}
|
|
@@ -150,15 +141,11 @@ function evalNode(node, attrs) {
|
|
|
150
141
|
}
|
|
151
142
|
case "CallExpression": {
|
|
152
143
|
if (node.callee?.type !== "Identifier") {
|
|
153
|
-
throw new Error(
|
|
154
|
-
"only direct calls to a named helper are supported",
|
|
155
|
-
);
|
|
144
|
+
throw new Error("only direct calls to a named helper are supported");
|
|
156
145
|
}
|
|
157
146
|
const helper = HELPERS[node.callee.name];
|
|
158
147
|
if (!helper) {
|
|
159
|
-
throw new Error(
|
|
160
|
-
`unknown helper "${node.callee.name}()" in a skill base formula`,
|
|
161
|
-
);
|
|
148
|
+
throw new Error(`unknown helper "${node.callee.name}()" in a skill base formula`);
|
|
162
149
|
}
|
|
163
150
|
return helper(...node.arguments.map((a) => evalNode(a, attrs)));
|
|
164
151
|
}
|
|
@@ -200,10 +187,7 @@ export function evaluateSkillBase(formula, attrs = {}) {
|
|
|
200
187
|
let node;
|
|
201
188
|
try {
|
|
202
189
|
const program = parse(source, { ecmaVersion: 2022 });
|
|
203
|
-
if (
|
|
204
|
-
program.body.length !== 1 ||
|
|
205
|
-
program.body[0].type !== "ExpressionStatement"
|
|
206
|
-
) {
|
|
190
|
+
if (program.body.length !== 1 || program.body[0].type !== "ExpressionStatement") {
|
|
207
191
|
return {
|
|
208
192
|
value: 0,
|
|
209
193
|
error: `skill base formula "${source}" is not a single expression`,
|
package/stage.mjs
CHANGED
|
@@ -46,12 +46,7 @@ import path from "node:path";
|
|
|
46
46
|
* beneath `site/` — but these four are common to all of them because they come
|
|
47
47
|
* from the shared toolchain rather than from any one package's layout.
|
|
48
48
|
*/
|
|
49
|
-
export const BUILD_ARTIFACT_DIRS = Object.freeze([
|
|
50
|
-
"build",
|
|
51
|
-
".vite",
|
|
52
|
-
".vitepress",
|
|
53
|
-
".rollup.cache",
|
|
54
|
-
]);
|
|
49
|
+
export const BUILD_ARTIFACT_DIRS = Object.freeze(["build", ".vite", ".vitepress", ".rollup.cache"]);
|
|
55
50
|
|
|
56
51
|
/**
|
|
57
52
|
* A source that does not exist, described for a human.
|
|
@@ -66,9 +61,7 @@ export const BUILD_ARTIFACT_DIRS = Object.freeze([
|
|
|
66
61
|
* @returns {string[]} Every source that is absent, in the order listed.
|
|
67
62
|
*/
|
|
68
63
|
export function missingSources(entries, cwd = process.cwd()) {
|
|
69
|
-
return entries
|
|
70
|
-
.map(([src]) => src)
|
|
71
|
-
.filter((src) => !fs.existsSync(path.resolve(cwd, src)));
|
|
64
|
+
return entries.map(([src]) => src).filter((src) => !fs.existsSync(path.resolve(cwd, src)));
|
|
72
65
|
}
|
|
73
66
|
|
|
74
67
|
/**
|
|
@@ -157,10 +150,7 @@ export function stageAssets(entries, { cwd = process.cwd(), transform } = {}) {
|
|
|
157
150
|
* `distclean` case.
|
|
158
151
|
* @returns {string[]} The directories removed, as listed.
|
|
159
152
|
*/
|
|
160
|
-
export function cleanBuildArtifacts(
|
|
161
|
-
root,
|
|
162
|
-
{ extra = [], includeNodeModules = false } = {},
|
|
163
|
-
) {
|
|
153
|
+
export function cleanBuildArtifacts(root, { extra = [], includeNodeModules = false } = {}) {
|
|
164
154
|
const dirs = [
|
|
165
155
|
...BUILD_ARTIFACT_DIRS,
|
|
166
156
|
...extra,
|
package/templates.mjs
CHANGED
|
@@ -107,10 +107,7 @@ function stripNonProse(source) {
|
|
|
107
107
|
* @returns {boolean} Whether it should have been localized.
|
|
108
108
|
*/
|
|
109
109
|
function isProse(text, allowed) {
|
|
110
|
-
return (
|
|
111
|
-
/[A-Za-z]{2}/.test(text.replace(/&[a-zA-Z]+;|&#\d+;/g, " ")) &&
|
|
112
|
-
!allowed.has(text)
|
|
113
|
-
);
|
|
110
|
+
return /[A-Za-z]{2}/.test(text.replace(/&[a-zA-Z]+;|&#\d+;/g, " ")) && !allowed.has(text);
|
|
114
111
|
}
|
|
115
112
|
|
|
116
113
|
/**
|
|
@@ -201,23 +198,15 @@ export function findTemplateSyntaxErrors(source) {
|
|
|
201
198
|
// answer, in the only place this error carries it.
|
|
202
199
|
const loc = err?.hash?.loc;
|
|
203
200
|
const stated = /Parse error on line (\d+)/.exec(String(err?.message));
|
|
204
|
-
const line =
|
|
205
|
-
loc?.first_line ??
|
|
206
|
-
err?.lineNumber ??
|
|
207
|
-
(stated ? Number(stated[1]) : undefined);
|
|
201
|
+
const line = loc?.first_line ?? err?.lineNumber ?? (stated ? Number(stated[1]) : undefined);
|
|
208
202
|
return [
|
|
209
203
|
{
|
|
210
204
|
...(typeof line === "number" ? { line } : {}),
|
|
211
|
-
...(
|
|
212
|
-
typeof line === "number" &&
|
|
213
|
-
typeof loc?.first_column === "number"
|
|
214
|
-
) ?
|
|
205
|
+
...(typeof line === "number" && typeof loc?.first_column === "number" ?
|
|
215
206
|
{ column: loc.first_column + 1 }
|
|
216
207
|
: {}),
|
|
217
208
|
severity: "error",
|
|
218
|
-
message: `template does not compile: ${
|
|
219
|
-
String(err).split("\n")[0]
|
|
220
|
-
}`,
|
|
209
|
+
message: `template does not compile: ${String(err).split("\n")[0]}`,
|
|
221
210
|
},
|
|
222
211
|
];
|
|
223
212
|
}
|
package/types/bundle.d.mts
CHANGED
|
@@ -45,7 +45,7 @@ export function globalDeclarations(source: string): Array<{
|
|
|
45
45
|
* declaredAs: "esmodules"|"scripts"|"both"|"neither"}} The findings, empty
|
|
46
46
|
* when the two agree, and how the entry was declared.
|
|
47
47
|
*/
|
|
48
|
-
export function checkBundleLoading({ manifest, source, entry, manifestName
|
|
48
|
+
export function checkBundleLoading({ manifest, source, entry, manifestName }: {
|
|
49
49
|
manifest: object;
|
|
50
50
|
source: string;
|
|
51
51
|
entry: string;
|
package/types/container.d.mts
CHANGED
|
@@ -82,7 +82,7 @@ export function resolveStagePort(stage: string, { env, stages }?: {
|
|
|
82
82
|
* @param {string} [opts.e2eStage] - Which stage the suite runs against.
|
|
83
83
|
* @returns {string|null} The exact build, or `null`.
|
|
84
84
|
*/
|
|
85
|
-
export function resolveFoundryVersion(stage: string, { env, stages, compatibilityMinimum, e2eStage
|
|
85
|
+
export function resolveFoundryVersion(stage: string, { env, stages, compatibilityMinimum, e2eStage }?: {
|
|
86
86
|
env?: NodeJS.ProcessEnv | undefined;
|
|
87
87
|
stages?: Record<string, ContainerStage> | undefined;
|
|
88
88
|
compatibilityMinimum?: string | null | undefined;
|
|
@@ -305,7 +305,7 @@ export function removeContainer(name: string, log?: (message: string) => void):
|
|
|
305
305
|
* @returns {number} The exit status.
|
|
306
306
|
* @throws {Error} On an unknown action, or a stage with no usable data root.
|
|
307
307
|
*/
|
|
308
|
-
export function containerAction({ action, stage, config, env, log
|
|
308
|
+
export function containerAction({ action, stage, config, env, log }: {
|
|
309
309
|
action: string;
|
|
310
310
|
stage: string;
|
|
311
311
|
config: object;
|
package/types/coverage.d.mts
CHANGED
|
@@ -77,7 +77,7 @@ export function mergeReferences(sets: Iterable<ReferenceSet>): ReferenceSet;
|
|
|
77
77
|
* questions: one says the package is broken, the other that it carries
|
|
78
78
|
* something nobody could see a use for.
|
|
79
79
|
*/
|
|
80
|
-
export function analyzeCoverage({ langSource, langFile, references, retained, roots
|
|
80
|
+
export function analyzeCoverage({ langSource, langFile, references, retained, roots }: {
|
|
81
81
|
langSource: string;
|
|
82
82
|
langFile: string;
|
|
83
83
|
references: ReferenceSet;
|
package/types/e2e.d.mts
CHANGED
|
@@ -156,7 +156,7 @@ export function parseFastArgs(argv: string[], build: Record<string, {
|
|
|
156
156
|
* @param {(message: string) => void} [opts.log] - Progress reporting.
|
|
157
157
|
* @returns {Promise<{worldDir: string, world: E2EWorld}>} Where it landed.
|
|
158
158
|
*/
|
|
159
|
-
export function seedTestWorld({ config, packageJson, env, log
|
|
159
|
+
export function seedTestWorld({ config, packageJson, env, log }: {
|
|
160
160
|
config: object;
|
|
161
161
|
packageJson: object;
|
|
162
162
|
env?: NodeJS.ProcessEnv | undefined;
|
|
@@ -181,7 +181,7 @@ export function seedTestWorld({ config, packageJson, env, log, }: {
|
|
|
181
181
|
* @returns {Promise<void>} Resolves once the world is active.
|
|
182
182
|
* @throws {Error} On a licence failure or a timeout.
|
|
183
183
|
*/
|
|
184
|
-
export function waitForWorld({ url, container, stage, timeoutMs, log
|
|
184
|
+
export function waitForWorld({ url, container, stage, timeoutMs, log }: {
|
|
185
185
|
url: string;
|
|
186
186
|
container: string;
|
|
187
187
|
stage: string;
|
|
@@ -204,7 +204,7 @@ export function waitForWorld({ url, container, stage, timeoutMs, log, }: {
|
|
|
204
204
|
* @param {(message: string) => void} [opts.log] - Progress reporting.
|
|
205
205
|
* @returns {number} The suite's exit status.
|
|
206
206
|
*/
|
|
207
|
-
export function runSuite({ command, args, cwd, env, log
|
|
207
|
+
export function runSuite({ command, args, cwd, env, log }: {
|
|
208
208
|
command: string[];
|
|
209
209
|
args?: string[] | undefined;
|
|
210
210
|
cwd: string;
|
|
@@ -265,7 +265,7 @@ export function e2eRun({ config, packageJson, mode, suiteArgs, env, log, }: {
|
|
|
265
265
|
* @param {(message: string) => void} [opts.log] - Progress reporting.
|
|
266
266
|
* @returns {Promise<number>} The suite's exit status.
|
|
267
267
|
*/
|
|
268
|
-
export function e2eFast({ config, argv, env, log
|
|
268
|
+
export function e2eFast({ config, argv, env, log }: {
|
|
269
269
|
config: object;
|
|
270
270
|
argv?: string[] | undefined;
|
|
271
271
|
env?: NodeJS.ProcessEnv | undefined;
|
|
@@ -98,7 +98,7 @@ export function emptyPassErrors(passes: Array<{
|
|
|
98
98
|
* @throws {Error} If the configured Foundry package id has drifted from the
|
|
99
99
|
* shipped manifest's `id` (see `package-manifest.mjs`).
|
|
100
100
|
*/
|
|
101
|
-
export function generatePacksJson({ only, config
|
|
101
|
+
export function generatePacksJson({ only, config }?: {
|
|
102
102
|
only?: string | undefined;
|
|
103
103
|
config?: object | undefined;
|
|
104
104
|
}): Promise<number>;
|
|
@@ -276,7 +276,7 @@ export function buildContentLinkIndex(contentBase: string, router?: object): {
|
|
|
276
276
|
* carries `file` and `position`, so a caller reports it in the same form
|
|
277
277
|
* rather than re-deriving one.
|
|
278
278
|
*/
|
|
279
|
-
export function convertNoteWikilinks(body: string, { type, id, pack, docPack, index, name, file, bodyLine, bodyColumn, lineMap
|
|
279
|
+
export function convertNoteWikilinks(body: string, { type, id, pack, docPack, index, name, file, bodyLine, bodyColumn, lineMap }: object): {
|
|
280
280
|
markdown: string;
|
|
281
281
|
unresolved: Array<object>;
|
|
282
282
|
};
|
|
@@ -52,7 +52,7 @@ export function fieldsForClass({ file, className, aliases, cache, rootDir }: {
|
|
|
52
52
|
* @param {string} opts.version - The package version.
|
|
53
53
|
* @returns {object} The artifact `schema-check.mjs` reads.
|
|
54
54
|
*/
|
|
55
|
-
export function buildSchemaArtifact({ rootDir, registries, packageId, version
|
|
55
|
+
export function buildSchemaArtifact({ rootDir, registries, packageId, version }: {
|
|
56
56
|
rootDir: string;
|
|
57
57
|
registries: object[];
|
|
58
58
|
packageId: string;
|
|
@@ -37,7 +37,7 @@ export function buildSiteIndex(entries: readonly SiteEntry[], { foreignIndex }?:
|
|
|
37
37
|
* unresolved cross-package link rather than fail.
|
|
38
38
|
* @returns {object} The resolver context.
|
|
39
39
|
*/
|
|
40
|
-
export function wikiContext(built: SiteIndex, { src, type, errors, foreignIndex, manifestsComplete
|
|
40
|
+
export function wikiContext(built: SiteIndex, { src, type, errors, foreignIndex, manifestsComplete }: {
|
|
41
41
|
src: string;
|
|
42
42
|
type?: string | null | undefined;
|
|
43
43
|
errors: object[];
|
package/types/manifest.d.mts
CHANGED
|
@@ -182,7 +182,7 @@ export function buildManifest({ config, packageJson, artifact, flags }: {
|
|
|
182
182
|
* @throws {Error} When a `packFolders` entry names a pack the package does not
|
|
183
183
|
* ship. Nothing is written in that case.
|
|
184
184
|
*/
|
|
185
|
-
export function writeManifest({ config, packageJson, artifact, outDir, flags, configFile
|
|
185
|
+
export function writeManifest({ config, packageJson, artifact, outDir, flags, configFile }: {
|
|
186
186
|
config: object;
|
|
187
187
|
packageJson: object;
|
|
188
188
|
artifact: string;
|