bingo-stratum 0.5.13 → 0.6.1
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/lib/creators/assertNoDuplicateBlocks.d.ts.map +1 -1
- package/lib/creators/assertNoDuplicateBlocks.js +1 -3
- package/lib/creators/assertNoDuplicateBlocks.js.map +1 -1
- package/lib/creators/createBlock.d.ts.map +1 -1
- package/lib/creators/createBlock.js +8 -3
- package/lib/creators/createBlock.js.map +1 -1
- package/lib/creators/createBlock.test.js +86 -0
- package/lib/creators/createBlock.test.js.map +1 -1
- package/lib/creators/createStratumTemplate.d.ts.map +1 -1
- package/lib/creators/createStratumTemplate.js +11 -7
- package/lib/creators/createStratumTemplate.js.map +1 -1
- package/lib/creators/createStratumTemplate.test.js +52 -4
- package/lib/creators/createStratumTemplate.test.js.map +1 -1
- package/lib/mergers/mergeAddons.d.ts.map +1 -1
- package/lib/mergers/mergeAddons.js +2 -1
- package/lib/mergers/mergeAddons.js.map +1 -1
- package/lib/mergers/mergeAddons.test.js +15 -1
- package/lib/mergers/mergeAddons.test.js.map +1 -1
- package/lib/mergers/mergeAddonsIfUpdated.d.ts +1 -1
- package/lib/mergers/mergeAddonsIfUpdated.d.ts.map +1 -1
- package/lib/mergers/mergeAddonsIfUpdated.js +15 -7
- package/lib/mergers/mergeAddonsIfUpdated.js.map +1 -1
- package/lib/mergers/mergeAddonsIfUpdated.test.js +17 -7
- package/lib/mergers/mergeAddonsIfUpdated.test.js.map +1 -1
- package/lib/mergers/mergeBlockCreations.d.ts +1 -1
- package/lib/producers/applyBlockRefinements.test.js +15 -0
- package/lib/producers/applyBlockRefinements.test.js.map +1 -1
- package/lib/producers/getUpdatedBlockAddons.d.ts +1 -1
- package/lib/producers/getUpdatedBlockAddons.d.ts.map +1 -1
- package/lib/producers/getUpdatedBlockAddons.js +5 -1
- package/lib/producers/getUpdatedBlockAddons.js.map +1 -1
- package/lib/producers/produceBlock.test.js +16 -1
- package/lib/producers/produceBlock.test.js.map +1 -1
- package/lib/producers/produceBlocks.d.ts.map +1 -1
- package/lib/producers/produceBlocks.js +3 -2
- package/lib/producers/produceBlocks.js.map +1 -1
- package/lib/producers/produceBlocks.test.js +94 -0
- package/lib/producers/produceBlocks.test.js.map +1 -1
- package/lib/producers/producePreset.test.js +1 -0
- package/lib/producers/producePreset.test.js.map +1 -1
- package/lib/runners/runBlock.test.js +1 -0
- package/lib/runners/runBlock.test.js.map +1 -1
- package/lib/types/blocks.d.ts +5 -5
- package/lib/types/blocks.d.ts.map +1 -1
- package/lib/types/creations.d.ts +1 -1
- package/lib/types/creations.d.ts.map +1 -1
- package/lib/types/refinements.d.ts +1 -1
- package/lib/types/refinements.d.ts.map +1 -1
- package/lib/types/templates.d.ts +11 -4
- package/lib/types/templates.d.ts.map +1 -1
- package/lib/utils/createBlockAddons.d.ts +5 -0
- package/lib/utils/createBlockAddons.d.ts.map +1 -0
- package/lib/utils/createBlockAddons.js +10 -0
- package/lib/utils/createBlockAddons.js.map +1 -0
- package/lib/utils/getName.d.ts +5 -0
- package/lib/utils/getName.d.ts.map +1 -0
- package/lib/utils/getName.js +4 -0
- package/lib/utils/getName.js.map +1 -0
- package/package.json +10 -11
- package/lib/creators/inferPreset.d.ts +0 -4
- package/lib/creators/inferPreset.d.ts.map +0 -1
- package/lib/creators/inferPreset.js +0 -73
- package/lib/creators/inferPreset.js.map +0 -1
- package/lib/creators/inferPreset.test.d.ts +0 -2
- package/lib/creators/inferPreset.test.d.ts.map +0 -1
- package/lib/creators/inferPreset.test.js +0 -95
- package/lib/creators/inferPreset.test.js.map +0 -1
- package/lib/predicates/isBlock.d.ts +0 -3
- package/lib/predicates/isBlock.d.ts.map +0 -1
- package/lib/predicates/isBlock.js +0 -7
- package/lib/predicates/isBlock.js.map +0 -1
- package/lib/producers/applyBlockModifications.d.ts +0 -4
- package/lib/producers/applyBlockModifications.d.ts.map +0 -1
- package/lib/producers/applyBlockModifications.js +0 -14
- package/lib/producers/applyBlockModifications.js.map +0 -1
- package/lib/producers/applyBlockModifications.test.d.ts +0 -2
- package/lib/producers/applyBlockModifications.test.d.ts.map +0 -1
- package/lib/producers/applyBlockModifications.test.js +0 -42
- package/lib/producers/applyBlockModifications.test.js.map +0 -1
- package/lib/types/customizations..d.ts +0 -9
- package/lib/types/customizations..d.ts.map +0 -1
- package/lib/types/customizations..js +0 -2
- package/lib/types/customizations..js.map +0 -1
- package/lib/types/customizations.d.ts +0 -22
- package/lib/types/customizations.d.ts.map +0 -1
- package/lib/types/customizations.js +0 -2
- package/lib/types/customizations.js.map +0 -1
- package/lib/types/settings.d.ts +0 -9
- package/lib/types/settings.d.ts.map +0 -1
- package/lib/types/settings.js +0 -2
- package/lib/types/settings.js.map +0 -1
- package/lib/utils/createBlockExclusionOption.d.ts +0 -2
- package/lib/utils/createBlockExclusionOption.d.ts.map +0 -1
- package/lib/utils/createBlockExclusionOption.js +0 -5
- package/lib/utils/createBlockExclusionOption.js.map +0 -1
- package/lib/utils.ts/createBlockExclusionOption.d.ts +0 -2
- package/lib/utils.ts/createBlockExclusionOption.d.ts.map +0 -1
- package/lib/utils.ts/createBlockExclusionOption.js +0 -5
- package/lib/utils.ts/createBlockExclusionOption.js.map +0 -1
- package/lib/utils.ts/getPresetByName.d.ts +0 -4
- package/lib/utils.ts/getPresetByName.d.ts.map +0 -1
- package/lib/utils.ts/getPresetByName.js +0 -7
- package/lib/utils.ts/getPresetByName.js.map +0 -1
- package/lib/utils.ts/slugifyName.d.ts +0 -2
- package/lib/utils.ts/slugifyName.d.ts.map +0 -1
- package/lib/utils.ts/slugifyName.js +0 -6
- package/lib/utils.ts/slugifyName.js.map +0 -1
- package/lib/utils.ts/slugifyPresetName.d.ts +0 -2
- package/lib/utils.ts/slugifyPresetName.d.ts.map +0 -1
- package/lib/utils.ts/slugifyPresetName.js +0 -6
- package/lib/utils.ts/slugifyPresetName.js.map +0 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function createBlockAddons(addons, block, name) {
|
|
2
|
+
const created = { addons, block };
|
|
3
|
+
if (name) {
|
|
4
|
+
Object.defineProperty(created, "toJSON", {
|
|
5
|
+
value: () => ({ addons, block: `[Block ${name}]` }),
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
return created;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=createBlockAddons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createBlockAddons.js","sourceRoot":"","sources":["../../src/utils/createBlockAddons.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,iBAAiB,CAChC,MAAc,EACd,KAAY,EACZ,IAAwB;IAExB,MAAM,OAAO,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAElC,IAAI,IAAI,EAAE,CAAC;QACV,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE;YACxC,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,IAAI,GAAG,EAAE,CAAC;SACnD,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getName.d.ts","sourceRoot":"","sources":["../../src/utils/getName.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,wBAAgB,OAAO,CAAC,KAAK,EAAE;IAAE,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,UAEnD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getName.js","sourceRoot":"","sources":["../../src/utils/getName.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,OAAO,CAAC,KAA4B;IACnD,OAAO,KAAK,CAAC,KAAK,EAAE,IAAI,IAAI,aAAa,CAAC;AAC3C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bingo-stratum",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Highly composable, customizable templating engine for Bingo. 🏭",
|
|
5
5
|
"homepage": "https://www.create.bingo/engines/stratum/packages/bingo-stratum",
|
|
6
6
|
"repository": {
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"all-properties-lazy": "^0.1.0",
|
|
23
23
|
"cached-factory": "^0.1.0",
|
|
24
|
-
"chalk": "^5.6.2",
|
|
25
24
|
"hash-object": "^5.0.1",
|
|
26
25
|
"octokit": "^5.0.5",
|
|
27
26
|
"slugify": "^1.6.6",
|
|
@@ -29,19 +28,19 @@
|
|
|
29
28
|
},
|
|
30
29
|
"devDependencies": {
|
|
31
30
|
"@types/node": "24.10.1",
|
|
32
|
-
"zod": "^
|
|
33
|
-
"bingo": "^0.
|
|
34
|
-
"bingo
|
|
35
|
-
"bingo-fs": "^0.5.
|
|
31
|
+
"zod": "^4.4.3",
|
|
32
|
+
"bingo-systems": "^0.6.0",
|
|
33
|
+
"bingo": "^0.11.2",
|
|
34
|
+
"bingo-fs": "^0.5.7"
|
|
36
35
|
},
|
|
37
36
|
"peerDependencies": {
|
|
38
|
-
"zod": "^
|
|
39
|
-
"bingo": "^0.
|
|
40
|
-
"bingo-fs": "^0.5.
|
|
41
|
-
"bingo-systems": "^0.
|
|
37
|
+
"zod": "^4.4.3",
|
|
38
|
+
"bingo": "^0.11.2",
|
|
39
|
+
"bingo-fs": "^0.5.7",
|
|
40
|
+
"bingo-systems": "^0.6.0"
|
|
42
41
|
},
|
|
43
42
|
"engines": {
|
|
44
|
-
"node": ">=18"
|
|
43
|
+
"node": ">=20.18.0"
|
|
45
44
|
},
|
|
46
45
|
"scripts": {
|
|
47
46
|
"build": "tsc"
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { AnyShape, InferredObject, TemplatePrepareContext } from "bingo";
|
|
2
|
-
import { Preset } from "../types/presets.js";
|
|
3
|
-
export declare function inferPreset<OptionsShape extends AnyShape, Refinements>(context: Pick<TemplatePrepareContext<Partial<InferredObject<OptionsShape>>, Refinements>, "files" | "options">, presets: Preset<OptionsShape>[]): string | undefined;
|
|
4
|
-
//# sourceMappingURL=inferPreset.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inferPreset.d.ts","sourceRoot":"","sources":["../../src/creators/inferPreset.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,QAAQ,EACR,cAAc,EAEd,sBAAsB,EACtB,MAAM,OAAO,CAAC;AASf,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG7C,wBAAgB,WAAW,CAAC,YAAY,SAAS,QAAQ,EAAE,WAAW,EACrE,OAAO,EAAE,IAAI,CACZ,sBAAsB,CAAC,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,EAAE,WAAW,CAAC,EAC1E,OAAO,GAAG,SAAS,CACnB,EACD,OAAO,EAAE,MAAM,CAAC,YAAY,CAAC,EAAE,sBAyC/B"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { mergeCreations, } from "bingo";
|
|
2
|
-
import { produceBlock, } from "../producers/produceBlock.js";
|
|
3
|
-
import { slugifyName } from "../utils/slugifyName.js";
|
|
4
|
-
export function inferPreset(context, presets) {
|
|
5
|
-
const blockSettings = {
|
|
6
|
-
...context,
|
|
7
|
-
// TODO: It would be better to run the base.prepare first to generate option defaults.
|
|
8
|
-
// ...
|
|
9
|
-
options: context.options,
|
|
10
|
-
};
|
|
11
|
-
let record;
|
|
12
|
-
for (const preset of presets) {
|
|
13
|
-
const allProduced = preset.blocks.map((block) => {
|
|
14
|
-
try {
|
|
15
|
-
return produceBlock(block, blockSettings);
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
return {};
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
const produced = allProduced.reduce(mergeCreations);
|
|
22
|
-
const counted = countMatchedFilePaths(context.files, produced.files);
|
|
23
|
-
const percentage = counted.matched / counted.created;
|
|
24
|
-
if (record) {
|
|
25
|
-
if (percentage > record.percentage) {
|
|
26
|
-
record = { percentage, preset };
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
record = { percentage, preset };
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return (
|
|
34
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
35
|
-
record.percentage >= 0.35
|
|
36
|
-
? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
37
|
-
slugifyName(record.preset.about.name)
|
|
38
|
-
: undefined);
|
|
39
|
-
}
|
|
40
|
-
function countMatchedFilePaths(created, produced) {
|
|
41
|
-
const found = {
|
|
42
|
-
created: 0,
|
|
43
|
-
matched: 0,
|
|
44
|
-
};
|
|
45
|
-
const queue = [
|
|
46
|
-
[created, produced],
|
|
47
|
-
];
|
|
48
|
-
while (queue.length) {
|
|
49
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
50
|
-
const [currentCreated, currentProduced] = queue.pop();
|
|
51
|
-
if (isCreatedFile(currentCreated)) {
|
|
52
|
-
found.created += 1;
|
|
53
|
-
if (isCreatedFile(currentProduced)) {
|
|
54
|
-
found.matched += 1;
|
|
55
|
-
}
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
if (isCreatedDirectory(currentCreated) &&
|
|
59
|
-
isCreatedDirectory(currentProduced)) {
|
|
60
|
-
for (const key of Object.keys(currentCreated)) {
|
|
61
|
-
queue.push([currentCreated[key], currentProduced[key]]);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return found;
|
|
66
|
-
}
|
|
67
|
-
function isCreatedDirectory(entry) {
|
|
68
|
-
return !!entry && typeof entry === "object" && !Array.isArray(entry);
|
|
69
|
-
}
|
|
70
|
-
function isCreatedFile(entry) {
|
|
71
|
-
return typeof entry === "string" || Array.isArray(entry);
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=inferPreset.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inferPreset.js","sourceRoot":"","sources":["../../src/creators/inferPreset.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,cAAc,GAEd,MAAM,OAAO,CAAC;AAIf,OAAO,EACN,YAAY,GAEZ,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,MAAM,UAAU,WAAW,CAC1B,OAGC,EACD,OAA+B;IAE/B,MAAM,aAAa,GAA6C;QAC/D,GAAG,OAAO;QAEV,sFAAsF;QACtF,MAAM;QACN,OAAO,EAAE,OAAO,CAAC,OAAkB;KACnC,CAAC;IAEF,IAAI,MAAwE,CAAC;IAE7E,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC9B,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YAC/C,IAAI,CAAC;gBACJ,OAAO,YAAY,CAAC,KAAkC,EAAE,aAAa,CAAC,CAAC;YACxE,CAAC;YAAC,MAAM,CAAC;gBACR,OAAO,EAAE,CAAC;YACX,CAAC;QACF,CAAC,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QACpD,MAAM,OAAO,GAAG,qBAAqB,CAAC,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;QACrE,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAErD,IAAI,MAAM,EAAE,CAAC;YACZ,IAAI,UAAU,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;gBACpC,MAAM,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;YACjC,CAAC;QACF,CAAC;aAAM,CAAC;YAC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I,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACtE,CAAC;AAED,SAAS,aAAa,CAAC,KAA+B;IACrD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inferPreset.test.d.ts","sourceRoot":"","sources":["../../src/creators/inferPreset.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { createBase } from "./createBase.js";
|
|
4
|
-
import { inferPreset } from "./inferPreset.js";
|
|
5
|
-
const base = createBase({
|
|
6
|
-
options: { name: z.string() },
|
|
7
|
-
});
|
|
8
|
-
const files = {
|
|
9
|
-
a: "...",
|
|
10
|
-
b: "...",
|
|
11
|
-
c: "...",
|
|
12
|
-
d: "...",
|
|
13
|
-
e: "...",
|
|
14
|
-
};
|
|
15
|
-
const presetErrors = base.createPreset({
|
|
16
|
-
about: { name: "Errors" },
|
|
17
|
-
blocks: [
|
|
18
|
-
base.createBlock({
|
|
19
|
-
produce() {
|
|
20
|
-
throw new Error("Oh no!");
|
|
21
|
-
},
|
|
22
|
-
}),
|
|
23
|
-
],
|
|
24
|
-
});
|
|
25
|
-
const presetLowPercentageA = base.createPreset({
|
|
26
|
-
about: { name: "Low Percentage A" },
|
|
27
|
-
blocks: [
|
|
28
|
-
base.createBlock({
|
|
29
|
-
produce() {
|
|
30
|
-
return {
|
|
31
|
-
files: {
|
|
32
|
-
a: "...",
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
},
|
|
36
|
-
}),
|
|
37
|
-
],
|
|
38
|
-
});
|
|
39
|
-
const presetLowPercentageB = base.createPreset({
|
|
40
|
-
about: { name: "Low Percentage B" },
|
|
41
|
-
blocks: [
|
|
42
|
-
base.createBlock({
|
|
43
|
-
produce() {
|
|
44
|
-
return {
|
|
45
|
-
files: {
|
|
46
|
-
b: "...",
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
},
|
|
50
|
-
}),
|
|
51
|
-
],
|
|
52
|
-
});
|
|
53
|
-
const presetHighPercentage = base.createPreset({
|
|
54
|
-
about: { name: "High Percentage" },
|
|
55
|
-
blocks: [
|
|
56
|
-
base.createBlock({
|
|
57
|
-
produce() {
|
|
58
|
-
return {
|
|
59
|
-
files: {
|
|
60
|
-
a: "...",
|
|
61
|
-
b: "...",
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
},
|
|
65
|
-
}),
|
|
66
|
-
],
|
|
67
|
-
});
|
|
68
|
-
const context = {
|
|
69
|
-
files,
|
|
70
|
-
options: {
|
|
71
|
-
name: "...",
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
describe("inferPreset", () => {
|
|
75
|
-
it("returns undefined without erroring when a block throws an error", () => {
|
|
76
|
-
const actual = inferPreset(context, [presetErrors]);
|
|
77
|
-
expect(actual).toBe(undefined);
|
|
78
|
-
});
|
|
79
|
-
it("returns undefined when no preset has a 35% match", () => {
|
|
80
|
-
const actual = inferPreset(context, [
|
|
81
|
-
presetLowPercentageA,
|
|
82
|
-
presetLowPercentageB,
|
|
83
|
-
]);
|
|
84
|
-
expect(actual).toBe(undefined);
|
|
85
|
-
});
|
|
86
|
-
it("returns the matching preset when a preset has a 35% match", () => {
|
|
87
|
-
const actual = inferPreset(context, [
|
|
88
|
-
presetLowPercentageA,
|
|
89
|
-
presetLowPercentageB,
|
|
90
|
-
presetHighPercentage,
|
|
91
|
-
]);
|
|
92
|
-
expect(actual).toBe("high-percentage");
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
//# sourceMappingURL=inferPreset.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inferPreset.test.js","sourceRoot":"","sources":["../../src/cre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J,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isBlock.d.ts","sourceRoot":"","sources":["../../src/predicates/isBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,CAOtD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isBlock.js","sourceRoot":"","sources":["../../src/predicates/isBlock.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,OAAO,CAAC,KAAc;IACrC,OAAO,CACN,CAAC,CAAC,KAAK;QACP,OAAO,KAAK,KAAK,QAAQ;QACzB,SAAS,IAAI,KAAK;QAClB,OAAO,KAAK,CAAC,OAAO,KAAK,UAAU,CACnC,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Block } from "../types/blocks.js";
|
|
2
|
-
import { BlockRefinements } from "../types/refinements.js";
|
|
3
|
-
export declare function applyBlockModifications<Options extends object>(initial: Block<object | undefined, Options>[], { add, exclude }?: BlockRefinements<Options>): Block<object | undefined, Options>[];
|
|
4
|
-
//# sourceMappingURL=applyBlockModifications.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"applyBlockModifications.d.ts","sourceRoot":"","sources":["../../src/producers/applyBlockModifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,wBAAgB,uBAAuB,CAAC,OAAO,SAAS,MAAM,EAC7D,OAAO,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,EAC7C,EAAE,GAAQ,EAAE,OAAY,EAAE,GAAE,gBAAgB,CAAC,OAAO,CAAM,wCAiB1D"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export function applyBlockModifications(initial, { add = [], exclude = [] } = {}) {
|
|
2
|
-
if (!add.length && !exclude.length) {
|
|
3
|
-
return initial;
|
|
4
|
-
}
|
|
5
|
-
const blocks = new Set(initial);
|
|
6
|
-
for (const added of add) {
|
|
7
|
-
blocks.add(added);
|
|
8
|
-
}
|
|
9
|
-
for (const excluded of exclude) {
|
|
10
|
-
blocks.delete(excluded);
|
|
11
|
-
}
|
|
12
|
-
return Array.from(blocks);
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=applyBlockModifications.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"applyBlockModifications.js","sourceRoot":"","sources":["../../src/producers/applyBlockModifications.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,uBAAuB,CACtC,OAA6C,EAC7C,EAAE,GAAG,GAAG,EAAE,EAAE,OAAO,GAAG,EAAE,KAAgC,EAAE;IAE1D,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QACpC,OAAO,OAAO,CAAC;IAChB,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;IAEhC,KAAK,MAAM,KAAK,IAAI,GAAG,EAAE,CAAC;QACzB,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;IAED,KAAK,MAAM,QAAQ,IAAI,OAAO,EAAE,CAAC;QAChC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"applyBlockModifications.test.d.ts","sourceRoot":"","sources":["../../src/producers/applyBlockModifications.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it, vi } from "vitest";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { createBase } from "../creators/createBase.js";
|
|
4
|
-
import { applyBlockModifications } from "./applyBlockModifications.js";
|
|
5
|
-
const base = createBase({
|
|
6
|
-
options: {
|
|
7
|
-
value: z.string(),
|
|
8
|
-
},
|
|
9
|
-
});
|
|
10
|
-
const blockA = base.createBlock({
|
|
11
|
-
about: { name: "A" },
|
|
12
|
-
produce: vi.fn(),
|
|
13
|
-
});
|
|
14
|
-
const blockB = base.createBlock({
|
|
15
|
-
about: { name: "B" },
|
|
16
|
-
produce: vi.fn(),
|
|
17
|
-
});
|
|
18
|
-
const blockC = base.createBlock({
|
|
19
|
-
about: { name: "C" },
|
|
20
|
-
produce: vi.fn(),
|
|
21
|
-
});
|
|
22
|
-
describe("applyBlockModifications", () => {
|
|
23
|
-
it("returns the initial blocks when no modifications are provided", () => {
|
|
24
|
-
const initial = [blockA, blockB];
|
|
25
|
-
const actual = applyBlockModifications(initial);
|
|
26
|
-
expect(actual).toBe(initial);
|
|
27
|
-
});
|
|
28
|
-
it("returns the initial blocks when modifications are empty", () => {
|
|
29
|
-
const initial = [blockA, blockB];
|
|
30
|
-
const actual = applyBlockModifications(initial, { add: [], exclude: [] });
|
|
31
|
-
expect(actual).toBe(initial);
|
|
32
|
-
});
|
|
33
|
-
it("applies modifications when they exist", () => {
|
|
34
|
-
const initial = [blockA, blockB];
|
|
35
|
-
const actual = applyBlockModifications(initial, {
|
|
36
|
-
add: [blockC],
|
|
37
|
-
exclude: [blockB],
|
|
38
|
-
});
|
|
39
|
-
expect(actual).toEqual([blockA, blockC]);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
//# sourceMappingURL=applyBlockModifications.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"applyBlockModifications.test.js","sourceRoot":"","sources":["../../src/producers/applyBlockModifications.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MA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uB,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;QAE1E,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAChD,MAAM,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAEjC,MAAM,MAAM,GAAG,uBAAuB,CAAC,OAAO,EAAE;YAC/C,GAAG,EAAE,CAAC,MAAM,CAAC;YACb,OAAO,EAAE,CAAC,MAAM,CAAC;SACjB,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Block } from "../types/blocks.js";
|
|
2
|
-
export interface BlockModifications<Options extends object = object> {
|
|
3
|
-
add?: Block<object | undefined, Options>[];
|
|
4
|
-
exclude?: Block<object | undefined, Options>[];
|
|
5
|
-
}
|
|
6
|
-
export interface StratumCustomizations<Options extends object = object> {
|
|
7
|
-
blocks?: BlockModifications<Options>;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=customizations..d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"customizations..d.ts","sourceRoot":"","sources":["../../src/types/customizations..ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,MAAM,WAAW,kBAAkB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IAClE,GAAG,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC;IAC3C,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC;CAC/C;AAED,MAAM,WAAW,qBAAqB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IACrE,MAAM,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;CACrC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"customizations..js","sourceRoot":"","sources":["../../src/types/customizations..ts"],"names":[],"mappings":""}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Block } from "./blocks.js";
|
|
2
|
-
/**
|
|
3
|
-
* Blocks to add and/or exclude from production.
|
|
4
|
-
* @template Options Options values as described by the template's options schema.
|
|
5
|
-
* @see {@link https://www.create.bingo/engines/stratum/details/configurations#blocks}
|
|
6
|
-
*/
|
|
7
|
-
export interface BlockRefinements<Options extends object = object> {
|
|
8
|
-
add?: Block<object | undefined, Options>[];
|
|
9
|
-
exclude?: Block<object | undefined, Options>[];
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Customizations that all Stratum templates may apply in a config file.
|
|
13
|
-
* @template Options Options values as described by the template's options schema.
|
|
14
|
-
* @see {@link https://www.create.bingo/engines/stratum/details/configurations#settings}
|
|
15
|
-
*/
|
|
16
|
-
export interface StratumRefinements<Options extends object = object> {
|
|
17
|
-
/**
|
|
18
|
-
* Blocks to add and/or exclude from production.
|
|
19
|
-
*/
|
|
20
|
-
blocks?: BlockRefinements<Options>;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=customizations.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"customizations.d.ts","sourceRoot":"","sources":["../../src/types/customizations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC;;;;GAIG;AACH,MAAM,WAAW,gBAAgB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IAChE,GAAG,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC;IAC3C,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC;CAC/C;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IAClE;;OAEG;IACH,MAAM,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;CACnC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"customizations.js","sourceRoot":"","sources":["../../src/types/customizations.ts"],"names":[],"mappings":""}
|
package/lib/types/settings.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Block } from "../types/blocks.js";
|
|
2
|
-
export interface BlockModifications<Options extends object = object> {
|
|
3
|
-
add?: Block<object | undefined, Options>[];
|
|
4
|
-
exclude?: Block<object | undefined, Options>[];
|
|
5
|
-
}
|
|
6
|
-
export interface StratumCustomizations<Options extends object = object> {
|
|
7
|
-
blocks?: BlockModifications<Options>;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/types/settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,MAAM,WAAW,kBAAkB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IAClE,GAAG,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC;IAC3C,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC;CAC/C;AAED,MAAM,WAAW,qBAAqB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IACrE,MAAM,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC;CACrC"}
|
package/lib/types/settings.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/types/settings.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createBlockExclusionOption.d.ts","sourceRoot":"","sources":["../../src/utils/createBlockExclusionOption.ts"],"names":[],"mappings":"AAEA,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,UAE3D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createBlockExclusionOption.js","sourceRoot":"","sources":["../../src/utils/createBlockExclusionOption.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,UAAU,0BAA0B,CAAC,SAAiB;IAC3D,OAAO,WAAW,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;AAC5C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createBlockExclusionOption.d.ts","sourceRoot":"","sources":["../../src/utils.ts/createBlockExclusionOption.ts"],"names":[],"mappings":"AAEA,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,UAE3D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createBlockExclusionOption.js","sourceRoot":"","sources":["../../src/utils.ts/createBlockExclusionOption.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,UAAU,0BAA0B,CAAC,SAAiB;IAC3D,OAAO,WAAW,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;AAC5C,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { AnyShape } from "bingo";
|
|
2
|
-
import { Preset } from "../types/presets.js";
|
|
3
|
-
export declare function getPresetByName<OptionsShape extends AnyShape>(presets: Preset<OptionsShape>[], requested: string): Preset<OptionsShape> | Error;
|
|
4
|
-
//# sourceMappingURL=getPresetByName.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPresetByName.d.ts","sourceRoot":"","sources":["../../src/utils.ts/getPresetByName.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG7C,wBAAgB,eAAe,CAAC,YAAY,SAAS,QAAQ,EAC5D,OAAO,EAAE,MAAM,CAAC,YAAY,CAAC,EAAE,EAC/B,SAAS,EAAE,MAAM,gCAcjB"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { slugifyName } from "./slugifyName.js";
|
|
2
|
-
export function getPresetByName(presets, requested) {
|
|
3
|
-
const presetsByName = new Map(Array.from(presets.map((preset) => [slugifyName(preset.about.name), preset])));
|
|
4
|
-
return (presetsByName.get(slugifyName(requested)) ??
|
|
5
|
-
new Error(`${requested} is not one of: ${Array.from(presetsByName.keys()).join(", ")}`));
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=getPresetByName.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPresetByName.js","sourceRoot":"","sources":["../../src/utils.ts/getPresetByName.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,UAAU,eAAe,CAC9B,OAA+B,EAC/B,SAAiB;IAEjB,MAAM,aAAa,GAAG,IAAI,GAAG,CAC5B,KAAK,CAAC,IAAI,CACT,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC,CACjE,CACD,CAAC;IAEF,OAAO,CACN,aAAa,CAAC,GAAG,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QACzC,IAAI,KAAK,CACR,GAAG,SAAS,mBAAmB,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC5E,CACD,CAAC;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slugifyName.d.ts","sourceRoot":"","sources":["../../src/utils.ts/slugifyName.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAEE,MAAM,CACnD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slugifyName.js","sourceRoot":"","sources":["../../src/utils.ts/slugifyName.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC3C,kEAAkE;IAClE,OAAO,OAAO,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAW,CAAC;AACrD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slugifyPresetName.d.ts","sourceRoot":"","sources":["../../src/utils.ts/slugifyPresetName.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAEE,MAAM,CACnD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slugifyPresetName.js","sourceRoot":"","sources":["../../src/utils.ts/slugifyPresetName.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC3C,kEAAkE;IAClE,OAAO,OAAO,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAW,CAAC;AACrD,CAAC"}
|