@seriousgaming/sdk-tools 1.6.1 → 1.8.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/dist/agent/guidance.md +1 -0
- package/dist/{cli-2NU2LPEE.js → cli-27M4PX7O.js} +17 -17
- package/dist/{cli-2BH7FX27.js → cli-2FXZZLCL.js} +1 -1
- package/dist/{cli-5ACDPCXI.js → cli-2KDV2DYC.js} +3 -3
- package/dist/{cli-OXAUOWCN.js → cli-2QM63J3I.js} +1 -1
- package/dist/{cli-HW53ICZC.js → cli-32NRB2IT.js} +15 -15
- package/dist/{cli-45OCBG53.js → cli-3HBYH4VF.js} +11 -11
- package/dist/{cli-4VFZHLDG.js → cli-3HPAKEJJ.js} +2 -2
- package/dist/{cli-R2MUZQE2.js → cli-3HZGJRQW.js} +11 -11
- package/dist/{cli-PGCIHPU7.js → cli-3OCKRPXI.js} +18 -18
- package/dist/{cli-64AB62PM.js → cli-3OVXQJEW.js} +2 -2
- package/dist/{cli-4UWFQNGF.js → cli-3VV2JLHX.js} +1 -1
- package/dist/{cli-XSLNH5PR.js → cli-42ZUP4X3.js} +141 -5
- package/dist/{cli-ZJFQ7EEA.js → cli-4B5OBHSY.js} +19 -19
- package/dist/{cli-7A6MKCUJ.js → cli-4EMNCU63.js} +27 -19
- package/dist/cli-5CG6BMCY.js +36 -0
- package/dist/{cli-XZCJIKIV.js → cli-5FRKWNVP.js} +19 -19
- package/dist/{cli-Y3DDNMPX.js → cli-5P66N5G6.js} +17 -17
- package/dist/{cli-6VNKQ3OX.js → cli-5SYPXJCB.js} +28 -16
- package/dist/{cli-G6CANSPL.js → cli-66AHBZRZ.js} +15 -15
- package/dist/{cli-BJMS3VX3.js → cli-6AGWTGTO.js} +106 -28
- package/dist/{cli-TTMBBEJC.js → cli-6BAZE75K.js} +18 -18
- package/dist/{cli-GFNDW2DL.js → cli-6FVHRL3H.js} +19 -19
- package/dist/{cli-QVASWX2A.js → cli-6GDPO5VU.js} +2 -2
- package/dist/{cli-7XLHO2FE.js → cli-6NBER36P.js} +1 -1
- package/dist/{cli-FQRVFGN6.js → cli-726NJARI.js} +0 -0
- package/dist/{cli-CD5CIJZI.js → cli-72DRYVTT.js} +13 -13
- package/dist/{cli-MMN4BPO4.js → cli-7CW2BBJG.js} +1 -1
- package/dist/{cli-XAT25PRU.js → cli-7GJGFILU.js} +15 -15
- package/dist/{cli-HFX3YPUL.js → cli-7NCVUM5U.js} +3 -3
- package/dist/cli-7S4G4EKK.js +110 -0
- package/dist/{cli-J4DKUUTK.js → cli-7V6GUIIS.js} +2 -2
- package/dist/{cli-N6H6T2E2.js → cli-AEAFLZGY.js} +12 -0
- package/dist/{cli-C47GJATR.js → cli-AGYCXRPR.js} +3 -3
- package/dist/{cli-XSVGKI3R.js → cli-BC4KKNLA.js} +1 -1
- package/dist/cli-BQ3FHENQ.js +16 -0
- package/dist/{cli-KGM6RRQW.js → cli-BXCCODYD.js} +20 -20
- package/dist/cli-C2XDL4LD.js +30 -0
- package/dist/{cli-MJUYJIEP.js → cli-C45A5VX6.js} +3 -3
- package/dist/{cli-DOXRQ3S5.js → cli-C7YZNPWX.js} +11 -11
- package/dist/{cli-HOE3WLFH.js → cli-CAX4CQTC.js} +13 -13
- package/dist/{cli-YOTGR3NB.js → cli-CVOLMK3Z.js} +1 -1
- package/dist/{cli-ILFDANBR.js → cli-D3CZRXVJ.js} +63 -17
- package/dist/{cli-4YB3ROVR.js → cli-DMKRP33X.js} +1 -1
- package/dist/{cli-Y3O5F4JN.js → cli-DPFN2LIZ.js} +15 -15
- package/dist/{cli-6UTPHWRQ.js → cli-DT756M3Z.js} +20 -20
- package/dist/{cli-TIDQ4WUE.js → cli-DXHPYN4N.js} +1 -1
- package/dist/{cli-6K3VQQUS.js → cli-E665NKUQ.js} +5 -5
- package/dist/{cli-O5ABH2WK.js → cli-EK7CGMGS.js} +17 -17
- package/dist/{cli-6QB2VFPY.js → cli-ESU3J563.js} +15 -15
- package/dist/{cli-VPRRICZA.js → cli-F47ELAXM.js} +47 -47
- package/dist/{cli-RLEGRWFM.js → cli-FH4WBZHA.js} +14 -14
- package/dist/{cli-3D3ZXWOV.js → cli-FHKRO6OU.js} +19 -19
- package/dist/{cli-JZCLIT3O.js → cli-FSEDPZR5.js} +19 -19
- package/dist/{cli-XOTNXEJA.js → cli-FV45UZQP.js} +19 -19
- package/dist/{cli-AV2FYC5G.js → cli-G7FX7ZIU.js} +12 -12
- package/dist/{cli-IP4RXGHM.js → cli-GFONBOJT.js} +129 -38
- package/dist/{cli-C5QOJJWX.js → cli-GHIMH6JU.js} +1 -1
- package/dist/{cli-IDVUHGKG.js → cli-HC7L5DXV.js} +15 -15
- package/dist/{cli-WU43JT4T.js → cli-HJPNNORV.js} +2 -2
- package/dist/{cli-QY5NZAR7.js → cli-HMEZHQBC.js} +17 -17
- package/dist/{cli-JZOZOEZM.js → cli-HQUVSAHY.js} +18 -18
- package/dist/{cli-MYJGMA6U.js → cli-IC5FOT2J.js} +1 -1
- package/dist/{cli-VL2P354N.js → cli-IVZ7AHUJ.js} +3 -3
- package/dist/{cli-B6YHEKIJ.js → cli-J2OTL6JH.js} +5 -5
- package/dist/{cli-Z56ZIVA6.js → cli-JA6UFTSX.js} +17 -17
- package/dist/{cli-MJV47HKI.js → cli-JOXCAGM7.js} +19 -19
- package/dist/{cli-ZBN5KAIB.js → cli-JQ6I5GGE.js} +3 -3
- package/dist/{cli-TDSQSCX4.js → cli-K6M6YB67.js} +1 -1
- package/dist/{cli-C6ZLPK2U.js → cli-KFVA7DT3.js} +3 -3
- package/dist/{cli-KOGRWFN7.js → cli-KH6FKM5A.js} +15 -15
- package/dist/{cli-5IAW3LIF.js → cli-KMT235FV.js} +2 -2
- package/dist/{cli-ZDUADFBY.js → cli-KU4PG7ZA.js} +15 -15
- package/dist/{cli-N45DREM4.js → cli-L4DEEAMK.js} +17 -17
- package/dist/{cli-MU5LB43S.js → cli-ME3JKMJL.js} +19 -19
- package/dist/{cli-C3CMJSNL.js → cli-MJ65PIYI.js} +15 -15
- package/dist/cli-MM2ROZWO.js +36 -0
- package/dist/{cli-RZITKPJX.js → cli-MN7X4UG2.js} +1 -1
- package/dist/{cli-4SIWLHQO.js → cli-MPU4FLA7.js} +4 -4
- package/dist/{cli-HCRTYQQS.js → cli-MPWTXNF6.js} +2 -2
- package/dist/{cli-EVI36HEM.js → cli-N5K2KHPR.js} +15 -15
- package/dist/{cli-RSW6EBBD.js → cli-NGOQWOQE.js} +15 -15
- package/dist/{cli-ZTWOE3ZT.js → cli-NU4SCD5D.js} +1 -1
- package/dist/{cli-BYCHKSSH.js → cli-O3IMNLN2.js} +282 -96
- package/dist/{cli-KGT5L7VZ.js → cli-OUFXSQOW.js} +7265 -4467
- package/dist/{cli-DFBTZEBX.js → cli-PEY6XZDE.js} +16 -16
- package/dist/{cli-QUSCIUOM.js → cli-PLW3TWJ7.js} +19 -19
- package/dist/{cli-JVI24FI6.js → cli-PO2ALWHP.js} +13 -13
- package/dist/{cli-3BRC32CP.js → cli-PPEB3ENS.js} +18 -18
- package/dist/{cli-ZDOTXEKL.js → cli-PZ7G544B.js} +3 -3
- package/dist/{cli-L7VYSXQK.js → cli-Q5BKFFDL.js} +4 -4
- package/dist/{cli-3ZKWV3PN.js → cli-QAI6T5FL.js} +15 -15
- package/dist/{cli-KSGB2ZLK.js → cli-QAVLRCQ5.js} +3 -3
- package/dist/{cli-VDBW23SS.js → cli-QDIH2G2P.js} +15 -15
- package/dist/cli-SN7D7HTX.js +36 -0
- package/dist/{cli-IEMKI7J7.js → cli-SOQJHK4Q.js} +6 -6
- package/dist/{cli-4PXNOJQX.js → cli-SPKPDXWD.js} +15 -15
- package/dist/{cli-MOPSZ3CS.js → cli-SWUAXVIJ.js} +15 -15
- package/dist/cli-TJNLXQJ5.js +36 -0
- package/dist/{cli-BUQI5UU4.js → cli-U2EWI6H5.js} +11 -11
- package/dist/{cli-TT36JCU5.js → cli-UADUC4JD.js} +2 -2
- package/dist/{cli-FWFRKQNE.js → cli-UR63LFVK.js} +2 -2
- package/dist/{cli-J4UBELKF.js → cli-UTHPCZYL.js} +2 -2
- package/dist/{cli-Q6ZBZYK2.js → cli-UYV3BDPA.js} +3 -3
- package/dist/{cli-LQOHATY2.js → cli-UZCQL6YP.js} +3 -3
- package/dist/{cli-HKORECAG.js → cli-V5K3CCYZ.js} +2 -2
- package/dist/cli-V7L3HEL4.js +36 -0
- package/dist/{cli-HSIHDN6K.js → cli-VBSF3R3L.js} +16 -16
- package/dist/{cli-NROTDF5Y.js → cli-VQ4OJ4KE.js} +18 -18
- package/dist/{cli-IUS2YCD3.js → cli-VTLFQHDO.js} +1 -1
- package/dist/{cli-JJSWBW4H.js → cli-W7XCTGQ7.js} +15 -15
- package/dist/{cli-UZZFNXRX.js → cli-W7Y7X3FX.js} +19 -19
- package/dist/cli-WWNTBK37.js +1973 -0
- package/dist/cli-XPJGW375.js +36 -0
- package/dist/{cli-SRHBXZCN.js → cli-Y33ULHYO.js} +1 -1
- package/dist/{cli-TTKICM5P.js → cli-YLYB4ITF.js} +13 -13
- package/dist/{cli-72XDEFU3.js → cli-ZFY6TGU7.js} +4 -4
- package/dist/{cli-6SGCYEEC.js → cli-ZSKP2IRP.js} +53 -38
- package/dist/cli.js +53 -51
- package/dist/client.js +17699 -16630
- package/dist/core/game-settings.d.ts +5 -3
- package/dist/core/save-scenario.d.ts +1 -0
- package/dist/core/session-roster.d.ts +10 -0
- package/dist/core/session-start-gate.d.ts +25 -0
- package/dist/core/session.d.ts +4 -0
- package/dist/dev/console/assets/index-CVNjiRUh.js +208 -0
- package/dist/dev/console/index.html +1 -1
- package/dist/dev/routes.d.ts +5 -2
- package/dist/dev/shell.d.ts +9 -1
- package/dist/dev/view/batch.d.ts +11 -1
- package/dist/dev/view/route.d.ts +18 -1
- package/dist/dev/view/view.d.ts +9 -0
- package/dist/docs/api/deck.md +1 -1
- package/dist/docs/api/index.md +2 -2
- package/dist/docs/api/sdk-commands.md +4 -0
- package/dist/docs/api/sdk-e2e.md +12 -6
- package/dist/docs/api/sdk-projection.md +1 -0
- package/dist/docs/api/sdk-tools-client.md +7 -1
- package/dist/docs/api/sdk-tools-playwright.md +1 -8
- package/dist/docs/api/sdk-ui-testing.md +1 -0
- package/dist/docs/api/sdk-ui.md +67 -63
- package/dist/docs/api/sdk.md +12 -1
- package/dist/docs/changelog.md +26 -0
- package/dist/docs/cli-and-dev-server.md +4 -0
- package/dist/docs/cli-error-codes.md +7 -1
- package/dist/docs/cli-reference.md +20 -2
- package/dist/docs/concepts/index.md +1 -0
- package/dist/docs/guides/engine.md +5 -0
- package/dist/docs/guides/file-handling.md +4 -1
- package/dist/docs/guides/llm-integration.md +3 -2
- package/dist/docs/guides/multi-team-games.md +2 -0
- package/dist/docs/guides/patterns.md +5 -0
- package/dist/docs/guides/presentation.md +11 -10
- package/dist/docs/guides/session-hooks.md +16 -0
- package/dist/docs/guides/session.md +1 -1
- package/dist/docs/guides/settings.md +6 -2
- package/dist/docs/guides/setup.md +23 -2
- package/dist/docs/guides/speech-generation.md +1 -0
- package/dist/docs/guides/testing.md +2 -0
- package/dist/docs/guides/tick-controller.md +2 -0
- package/dist/docs/guides/type-safety.md +2 -1
- package/dist/docs/guides/ui-files-and-llms.md +3 -1
- package/dist/docs/guides/upgrading.md +16 -0
- package/dist/docs/guides/validators.md +27 -4
- package/dist/docs/guides/waiting-room.md +2 -0
- package/dist/docs/page-index.md +12 -10
- package/dist/docs/recipes/call-endpoint-from-ui.md +1 -0
- package/dist/docs/recipes/create-scenario-editor.md +2 -1
- package/dist/docs/recipes/create-setup.md +2 -1
- package/dist/docs/recipes/declare-api-uses.md +1 -0
- package/dist/docs/recipes/describe-setup-with-endpoint.md +69 -0
- package/dist/docs/recipes/index.md +3 -1
- package/dist/docs/recipes/share-logic-between-engine-and-ui.md +2 -2
- package/dist/docs/recipes/test-user-interface.md +1 -1
- package/dist/docs/recipes/validate-scenarios.md +9 -3
- package/dist/docs/recipes/write-setup-notes.md +58 -0
- package/dist/docs/troubleshooting.md +2 -1
- package/dist/execution/executor.d.ts +12 -0
- package/dist/execution/scenario-gates.d.ts +40 -0
- package/dist/host/protocol.d.ts +10 -1
- package/dist/host.js +1083 -467
- package/dist/playwright.js +17760 -16691
- package/dist/runtime/manifest-version.d.ts +1 -1
- package/dist/runtime.js +4 -2
- package/dist/schema.json +10 -1
- package/dist/setup/setup-notes.d.ts +42 -0
- package/dist/templates/package/package.json.liquid +15 -15
- package/dist/templates/starter-game/package.json +13 -13
- package/dist/utils/error-codes.d.ts +13 -1
- package/dist/validation/package-validation.d.ts +1 -1
- package/package.json +22 -23
- package/dist/cli-2GZYGRVL.js +0 -36
- package/dist/cli-5SM367K7.js +0 -30
- package/dist/cli-DDJYUKQG.js +0 -36
- package/dist/cli-LK3V4RI5.js +0 -36
- package/dist/cli-N24OHSAN.js +0 -36
- package/dist/cli-OMWC75CC.js +0 -256
- package/dist/cli-RCIWBCXD.js +0 -36
- package/dist/cli-UMEBPAZQ.js +0 -16
- package/dist/cli-VQ6HVQW4.js +0 -4010
- package/dist/cli-WR3NOY74.js +0 -36
- package/dist/dev/console/assets/index-CuMOOH9m.js +0 -204
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
validateUIFiles,
|
|
13
13
|
validateUserInterface,
|
|
14
14
|
validateValidator
|
|
15
|
-
} from "./cli-
|
|
15
|
+
} from "./cli-6NBER36P.js";
|
|
16
16
|
import {
|
|
17
17
|
fileSettingDeclarationErrors,
|
|
18
18
|
isChapterEmpty,
|
|
@@ -21,19 +21,20 @@ import {
|
|
|
21
21
|
referenceLocale,
|
|
22
22
|
settingReferences,
|
|
23
23
|
strayFences
|
|
24
|
-
} from "./cli-
|
|
24
|
+
} from "./cli-WWNTBK37.js";
|
|
25
25
|
import {
|
|
26
|
-
SCENARIO_VALIDATION,
|
|
27
|
-
hasScenarioGate,
|
|
28
|
-
runScenarioGates,
|
|
29
26
|
validateTsTypes
|
|
30
|
-
} from "./cli-
|
|
27
|
+
} from "./cli-7S4G4EKK.js";
|
|
31
28
|
import {
|
|
32
29
|
LogicLoader,
|
|
30
|
+
SCENARIO_VALIDATION,
|
|
33
31
|
applySchemaDefaults,
|
|
34
32
|
deepMergeContext,
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
hasScenarioGate,
|
|
34
|
+
isBlocking,
|
|
35
|
+
resolveCapabilityScope,
|
|
36
|
+
runScenarioGates
|
|
37
|
+
} from "./cli-O3IMNLN2.js";
|
|
37
38
|
import {
|
|
38
39
|
describeAssetByReference
|
|
39
40
|
} from "./cli-QWQMPCL6.js";
|
|
@@ -41,6 +42,7 @@ import {
|
|
|
41
42
|
GAME_SETTINGS,
|
|
42
43
|
LOGIC_NODE_BUILTIN,
|
|
43
44
|
MANIFEST_FILE,
|
|
45
|
+
SETUP_NOTES_DIRECTORY,
|
|
44
46
|
Transpile,
|
|
45
47
|
bundleFileOf,
|
|
46
48
|
collectSettingsOverrideErrors,
|
|
@@ -51,19 +53,22 @@ import {
|
|
|
51
53
|
didYouMean,
|
|
52
54
|
getResourceMeta,
|
|
53
55
|
loadConfig,
|
|
56
|
+
notesSettingReferences,
|
|
54
57
|
openSettingsObjects,
|
|
55
58
|
parseSettingPath,
|
|
56
59
|
pointerOf,
|
|
57
60
|
refProblemMessage,
|
|
58
61
|
refProblems,
|
|
62
|
+
settingPathDeclared,
|
|
59
63
|
settingsSchemas,
|
|
64
|
+
setupNotesLocales,
|
|
60
65
|
teamsMaxOf,
|
|
61
66
|
unenforceableLockMessage,
|
|
62
67
|
unenforceableLocks
|
|
63
|
-
} from "./cli-
|
|
68
|
+
} from "./cli-OUFXSQOW.js";
|
|
64
69
|
|
|
65
70
|
// cli/validation/package-validation.ts
|
|
66
|
-
import { existsSync as existsSync2 } from "fs";
|
|
71
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
67
72
|
import { readFile } from "fs/promises";
|
|
68
73
|
import { dirname as dirname2, resolve as resolve2 } from "path";
|
|
69
74
|
|
|
@@ -1494,7 +1499,7 @@ var VALIDATION_DESCRIPTORS = [
|
|
|
1494
1499
|
type: "setup",
|
|
1495
1500
|
resources: (config) => slot(config.setup),
|
|
1496
1501
|
identify: named,
|
|
1497
|
-
checks: [uiFiles]
|
|
1502
|
+
checks: [uiFiles, (setup, context) => setupNotesChecks(setup, context)]
|
|
1498
1503
|
}),
|
|
1499
1504
|
descriptor({
|
|
1500
1505
|
type: "scenario_editor",
|
|
@@ -1586,11 +1591,14 @@ var VALIDATION_DESCRIPTORS = [
|
|
|
1586
1591
|
// `Scenario` gate judges the defaults too: a game that cannot run
|
|
1587
1592
|
// on them alone says so here, not when a session is created
|
|
1588
1593
|
// (§15.8).
|
|
1594
|
+
(game, context) => ungatedSettingsChecks(game.definition.identifier, context.config),
|
|
1589
1595
|
async (game, context) => {
|
|
1590
1596
|
if (!hasScenarioGate(context.config)) return { errors: [] };
|
|
1591
1597
|
const resource = { type: "game", identifier: game.definition.identifier };
|
|
1592
1598
|
const errors = [];
|
|
1593
1599
|
const errorFindings = [];
|
|
1600
|
+
const warnings = [];
|
|
1601
|
+
const findings = [];
|
|
1594
1602
|
if (!(context.config.requires ?? []).includes(SCENARIO_VALIDATION)) {
|
|
1595
1603
|
const message = `A validator exports \`Scenario\`, which needs the \`${SCENARIO_VALIDATION}\` feature, but \`requires\` does not list it`;
|
|
1596
1604
|
errors.push(message);
|
|
@@ -1618,8 +1626,10 @@ var VALIDATION_DESCRIPTORS = [
|
|
|
1618
1626
|
);
|
|
1619
1627
|
errors.push(...refused.errors);
|
|
1620
1628
|
errorFindings.push(...refused.errorFindings);
|
|
1629
|
+
warnings.push(...refused.warnings);
|
|
1630
|
+
findings.push(...refused.findings);
|
|
1621
1631
|
}
|
|
1622
|
-
return errorFindings.length > 0 ? { errors, errorFindings } : { errors };
|
|
1632
|
+
return errorFindings.length > 0 ? { errors, errorFindings, warnings, findings } : { errors, warnings, findings };
|
|
1623
1633
|
},
|
|
1624
1634
|
(_game, context) => {
|
|
1625
1635
|
const defaults = (context.config.scenarios ?? []).filter(
|
|
@@ -1779,14 +1789,68 @@ async function validateLoadedPackage(config, options) {
|
|
|
1779
1789
|
}
|
|
1780
1790
|
};
|
|
1781
1791
|
}
|
|
1782
|
-
function
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1792
|
+
function setupNotesChecks(setup, context) {
|
|
1793
|
+
const directory = resolve2(context.workingDir, setup.rootDirectory);
|
|
1794
|
+
const schemas = settingsSchemas(context.config);
|
|
1795
|
+
const identifiers = new Set(Object.keys(schemas));
|
|
1796
|
+
const configures = new Set(setup.definition.configures ?? []);
|
|
1797
|
+
const resource = { type: "setup", identifier: "setup" };
|
|
1798
|
+
const outcome = {
|
|
1799
|
+
errors: [],
|
|
1800
|
+
warnings: [],
|
|
1801
|
+
findings: []
|
|
1802
|
+
};
|
|
1803
|
+
for (const locale of setupNotesLocales(directory)) {
|
|
1804
|
+
const file = `setup/${SETUP_NOTES_DIRECTORY}/${locale}.md`;
|
|
1805
|
+
const markdown = readFileSync2(
|
|
1806
|
+
resolve2(directory, SETUP_NOTES_DIRECTORY, `${locale}.md`),
|
|
1807
|
+
"utf-8"
|
|
1787
1808
|
);
|
|
1788
|
-
|
|
1809
|
+
for (const { path, line } of notesSettingReferences(markdown, identifiers)) {
|
|
1810
|
+
if (!settingPathDeclared(schemas, path)) continue;
|
|
1811
|
+
const identifier = parseSettingPath(path)?.identifier ?? "";
|
|
1812
|
+
if (!configures.has(identifier)) {
|
|
1813
|
+
const message = `Setup notes ${file}, line ${line}, name \`${path}\`, but the setup UI does not configure "${identifier}", so a host refuses that change. Add "${identifier}" to its \`configures\`, or leave the setting out of the notes.`;
|
|
1814
|
+
outcome.warnings.push(message);
|
|
1815
|
+
outcome.findings.push({
|
|
1816
|
+
severity: "warning",
|
|
1817
|
+
code: "SETUP_NOTES_UNCONFIGURED",
|
|
1818
|
+
message,
|
|
1819
|
+
file,
|
|
1820
|
+
line,
|
|
1821
|
+
resource
|
|
1822
|
+
});
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
return outcome;
|
|
1827
|
+
}
|
|
1828
|
+
function ungatedSettingsChecks(gameIdentifier, config) {
|
|
1829
|
+
const resource = { type: "game", identifier: gameIdentifier };
|
|
1830
|
+
const warnings = [];
|
|
1831
|
+
const findings = [];
|
|
1832
|
+
const configures = config.setup?.definition.configures ?? [];
|
|
1833
|
+
if (hasScenarioGate(config) && configures.length > 0) {
|
|
1834
|
+
const gated = new Set(
|
|
1835
|
+
(config.validators ?? []).filter((v) => v.definition.gates?.includes("scenario")).flatMap((v) => v.definition.settings ?? [])
|
|
1836
|
+
);
|
|
1837
|
+
for (const identifier of configures) {
|
|
1838
|
+
if (identifier === GAME_SETTINGS || gated.has(identifier)) continue;
|
|
1839
|
+
const message = `The setup UI changes the "${identifier}" settings, but no \`Scenario\` gate declares them, so nothing checks a facilitator's changes to them before the session starts. Add "${identifier}" to the \`settings\` of the validator that exports \`Scenario\` if a change there can break play.`;
|
|
1840
|
+
warnings.push(message);
|
|
1841
|
+
findings.push({
|
|
1842
|
+
severity: "warning",
|
|
1843
|
+
code: "SETTINGS_UNGATED",
|
|
1844
|
+
message,
|
|
1845
|
+
file: bundleFileOf("setup", "setup"),
|
|
1846
|
+
pointer: pointerOf("definition", "configures", configures.indexOf(identifier)),
|
|
1847
|
+
resource
|
|
1848
|
+
});
|
|
1849
|
+
}
|
|
1789
1850
|
}
|
|
1851
|
+
return { errors: [], warnings, findings };
|
|
1852
|
+
}
|
|
1853
|
+
function record(result, outcome) {
|
|
1790
1854
|
const byMessage = new Map((outcome.findings ?? []).map((f) => [f.message, f]));
|
|
1791
1855
|
const add = (severity, message) => {
|
|
1792
1856
|
const finding = byMessage.get(message) ?? {
|
|
@@ -1795,9 +1859,16 @@ function record(result, outcome) {
|
|
|
1795
1859
|
};
|
|
1796
1860
|
result.diagnostics.push(located(severity, finding, result));
|
|
1797
1861
|
};
|
|
1798
|
-
|
|
1799
|
-
result.errors.push(
|
|
1800
|
-
|
|
1862
|
+
if (outcome.errorFindings) {
|
|
1863
|
+
result.errors.push(...outcome.errors);
|
|
1864
|
+
result.diagnostics.push(
|
|
1865
|
+
...outcome.errorFindings.map((finding) => located("error", finding, result))
|
|
1866
|
+
);
|
|
1867
|
+
} else {
|
|
1868
|
+
for (const message of outcome.errors) {
|
|
1869
|
+
result.errors.push(message);
|
|
1870
|
+
add("error", message);
|
|
1871
|
+
}
|
|
1801
1872
|
}
|
|
1802
1873
|
for (const message of outcome.warnings ?? []) {
|
|
1803
1874
|
result.warnings.push(message);
|
|
@@ -1816,20 +1887,27 @@ function located(severity, finding, resource) {
|
|
|
1816
1887
|
function scenarioRefusals(problems, subject, resource, file, pointerFor) {
|
|
1817
1888
|
const errors = [];
|
|
1818
1889
|
const errorFindings = [];
|
|
1890
|
+
const warnings = [];
|
|
1891
|
+
const findings = [];
|
|
1819
1892
|
for (const problem of problems) {
|
|
1820
1893
|
const setting = problem.path ? ` ${problem.path}:` : "";
|
|
1821
|
-
const message = `${subject} is refused by validator "${problem.validatorIdentifier}":${setting} ${problem.message}`;
|
|
1822
1894
|
const pointer = problem.path ? pointerFor(problem.path) : void 0;
|
|
1823
|
-
|
|
1824
|
-
errorFindings.push({
|
|
1825
|
-
code: "SCENARIO_REFUSED",
|
|
1826
|
-
message,
|
|
1895
|
+
const where = {
|
|
1827
1896
|
...file === void 0 ? {} : { file },
|
|
1828
1897
|
...pointer === void 0 ? {} : { pointer },
|
|
1829
1898
|
resource
|
|
1830
|
-
}
|
|
1899
|
+
};
|
|
1900
|
+
if (!isBlocking(problem)) {
|
|
1901
|
+
const message2 = `${subject} has a warning from validator "${problem.validatorIdentifier}":${setting} ${problem.message}`;
|
|
1902
|
+
warnings.push(message2);
|
|
1903
|
+
findings.push({ severity: "warning", code: "SCENARIO_WARNING", message: message2, ...where });
|
|
1904
|
+
continue;
|
|
1905
|
+
}
|
|
1906
|
+
const message = `${subject} is refused by validator "${problem.validatorIdentifier}":${setting} ${problem.message}`;
|
|
1907
|
+
errors.push(message);
|
|
1908
|
+
errorFindings.push({ code: "SCENARIO_REFUSED", message, ...where });
|
|
1831
1909
|
}
|
|
1832
|
-
return { errors, errorFindings };
|
|
1910
|
+
return { errors, errorFindings, warnings, findings };
|
|
1833
1911
|
}
|
|
1834
1912
|
|
|
1835
1913
|
export {
|
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
resolvePatchedDefinition
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-KMT235FV.js";
|
|
5
5
|
import "./cli-S5IVGDDD.js";
|
|
6
6
|
import {
|
|
7
7
|
getResourceIdentifierError,
|
|
8
8
|
readAuthoredBundle
|
|
9
|
-
} from "./cli-
|
|
9
|
+
} from "./cli-3HPAKEJJ.js";
|
|
10
10
|
import {
|
|
11
11
|
resolveInputSource
|
|
12
|
-
} from "./cli-
|
|
12
|
+
} from "./cli-3VV2JLHX.js";
|
|
13
13
|
import {
|
|
14
14
|
updateValidatorFiles
|
|
15
|
-
} from "./cli-
|
|
16
|
-
import "./cli-
|
|
15
|
+
} from "./cli-MPU4FLA7.js";
|
|
16
|
+
import "./cli-VTLFQHDO.js";
|
|
17
17
|
import "./cli-QUNIRH7A.js";
|
|
18
|
-
import "./cli-
|
|
18
|
+
import "./cli-UTHPCZYL.js";
|
|
19
19
|
import {
|
|
20
20
|
loadPackageContext
|
|
21
|
-
} from "./cli-
|
|
22
|
-
import "./cli-
|
|
21
|
+
} from "./cli-BC4KKNLA.js";
|
|
22
|
+
import "./cli-UADUC4JD.js";
|
|
23
23
|
import {
|
|
24
24
|
findBundleFile
|
|
25
|
-
} from "./cli-
|
|
25
|
+
} from "./cli-2QM63J3I.js";
|
|
26
26
|
import {
|
|
27
27
|
operationError,
|
|
28
28
|
printOperationResult,
|
|
29
29
|
regenerateTypes
|
|
30
|
-
} from "./cli-
|
|
30
|
+
} from "./cli-QAVLRCQ5.js";
|
|
31
31
|
import {
|
|
32
32
|
input
|
|
33
|
-
} from "./cli-
|
|
34
|
-
import "./cli-
|
|
35
|
-
import "./cli-
|
|
36
|
-
import "./cli-
|
|
37
|
-
import "./cli-
|
|
33
|
+
} from "./cli-NU4SCD5D.js";
|
|
34
|
+
import "./cli-UZCQL6YP.js";
|
|
35
|
+
import "./cli-SOQJHK4Q.js";
|
|
36
|
+
import "./cli-7S4G4EKK.js";
|
|
37
|
+
import "./cli-O3IMNLN2.js";
|
|
38
38
|
import "./cli-25RWY5BQ.js";
|
|
39
39
|
import "./cli-QWQMPCL6.js";
|
|
40
40
|
import {
|
|
41
41
|
validateSDKValidator
|
|
42
|
-
} from "./cli-
|
|
42
|
+
} from "./cli-OUFXSQOW.js";
|
|
43
43
|
import "./cli-F2D4GGUA.js";
|
|
44
44
|
import {
|
|
45
45
|
logger
|
|
46
|
-
} from "./cli-
|
|
46
|
+
} from "./cli-DMKRP33X.js";
|
|
47
47
|
import {
|
|
48
48
|
CliError
|
|
49
|
-
} from "./cli-
|
|
49
|
+
} from "./cli-AEAFLZGY.js";
|
|
50
50
|
|
|
51
51
|
// cli/commands/resources/validator/update.ts
|
|
52
52
|
import { readFileSync } from "fs";
|
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
assertEveryPropertyHasDefault
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-3OVXQJEW.js";
|
|
5
5
|
import {
|
|
6
6
|
promptForSchemaProperties
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-MN7X4UG2.js";
|
|
8
8
|
import {
|
|
9
9
|
readAuthoredBundle
|
|
10
|
-
} from "./cli-
|
|
10
|
+
} from "./cli-3HPAKEJJ.js";
|
|
11
11
|
import {
|
|
12
12
|
resolveInputSource
|
|
13
|
-
} from "./cli-
|
|
13
|
+
} from "./cli-3VV2JLHX.js";
|
|
14
14
|
import {
|
|
15
15
|
createSettingsFiles
|
|
16
|
-
} from "./cli-
|
|
17
|
-
import "./cli-
|
|
16
|
+
} from "./cli-MPU4FLA7.js";
|
|
17
|
+
import "./cli-VTLFQHDO.js";
|
|
18
18
|
import "./cli-QUNIRH7A.js";
|
|
19
|
-
import "./cli-
|
|
19
|
+
import "./cli-UTHPCZYL.js";
|
|
20
20
|
import {
|
|
21
21
|
loadPackageContext
|
|
22
|
-
} from "./cli-
|
|
23
|
-
import "./cli-
|
|
24
|
-
import "./cli-
|
|
22
|
+
} from "./cli-BC4KKNLA.js";
|
|
23
|
+
import "./cli-UADUC4JD.js";
|
|
24
|
+
import "./cli-2QM63J3I.js";
|
|
25
25
|
import {
|
|
26
26
|
BUILD_COMMAND,
|
|
27
27
|
generateTypes,
|
|
28
28
|
operationError,
|
|
29
29
|
printOperationResult
|
|
30
|
-
} from "./cli-
|
|
30
|
+
} from "./cli-QAVLRCQ5.js";
|
|
31
31
|
import {
|
|
32
32
|
input
|
|
33
|
-
} from "./cli-
|
|
34
|
-
import "./cli-
|
|
35
|
-
import "./cli-
|
|
36
|
-
import "./cli-
|
|
37
|
-
import "./cli-
|
|
33
|
+
} from "./cli-NU4SCD5D.js";
|
|
34
|
+
import "./cli-UZCQL6YP.js";
|
|
35
|
+
import "./cli-SOQJHK4Q.js";
|
|
36
|
+
import "./cli-7S4G4EKK.js";
|
|
37
|
+
import "./cli-O3IMNLN2.js";
|
|
38
38
|
import "./cli-25RWY5BQ.js";
|
|
39
39
|
import "./cli-QWQMPCL6.js";
|
|
40
40
|
import {
|
|
41
41
|
GAME_SETTINGS,
|
|
42
42
|
validateSDKSettings
|
|
43
|
-
} from "./cli-
|
|
43
|
+
} from "./cli-OUFXSQOW.js";
|
|
44
44
|
import "./cli-F2D4GGUA.js";
|
|
45
45
|
import {
|
|
46
46
|
logger
|
|
47
|
-
} from "./cli-
|
|
47
|
+
} from "./cli-DMKRP33X.js";
|
|
48
48
|
import {
|
|
49
49
|
CliError
|
|
50
|
-
} from "./cli-
|
|
50
|
+
} from "./cli-AEAFLZGY.js";
|
|
51
51
|
|
|
52
52
|
// cli/commands/resources/settings/new.ts
|
|
53
53
|
async function createSettings(definitionInput, options) {
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
} from "./cli-ILKCQNM6.js";
|
|
5
5
|
import {
|
|
6
6
|
logger
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-DMKRP33X.js";
|
|
8
8
|
import {
|
|
9
9
|
CliError,
|
|
10
10
|
reportResult
|
|
11
|
-
} from "./cli-
|
|
11
|
+
} from "./cli-AEAFLZGY.js";
|
|
12
12
|
|
|
13
13
|
// cli/commands/package-version.ts
|
|
14
14
|
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
Binary file
|
|
@@ -2,31 +2,31 @@
|
|
|
2
2
|
import {
|
|
3
3
|
deleteScenarioFiles,
|
|
4
4
|
findScenarioReferences
|
|
5
|
-
} from "./cli-
|
|
5
|
+
} from "./cli-UTHPCZYL.js";
|
|
6
6
|
import {
|
|
7
7
|
loadPackageContext
|
|
8
|
-
} from "./cli-
|
|
9
|
-
import "./cli-
|
|
10
|
-
import "./cli-
|
|
8
|
+
} from "./cli-BC4KKNLA.js";
|
|
9
|
+
import "./cli-UADUC4JD.js";
|
|
10
|
+
import "./cli-2QM63J3I.js";
|
|
11
11
|
import {
|
|
12
12
|
operationError,
|
|
13
13
|
recordOperationResult
|
|
14
|
-
} from "./cli-
|
|
14
|
+
} from "./cli-QAVLRCQ5.js";
|
|
15
15
|
import {
|
|
16
16
|
confirmAction
|
|
17
|
-
} from "./cli-
|
|
18
|
-
import "./cli-
|
|
19
|
-
import "./cli-
|
|
20
|
-
import "./cli-
|
|
21
|
-
import "./cli-
|
|
17
|
+
} from "./cli-NU4SCD5D.js";
|
|
18
|
+
import "./cli-UZCQL6YP.js";
|
|
19
|
+
import "./cli-SOQJHK4Q.js";
|
|
20
|
+
import "./cli-7S4G4EKK.js";
|
|
21
|
+
import "./cli-O3IMNLN2.js";
|
|
22
22
|
import "./cli-25RWY5BQ.js";
|
|
23
23
|
import "./cli-QWQMPCL6.js";
|
|
24
|
-
import "./cli-
|
|
24
|
+
import "./cli-OUFXSQOW.js";
|
|
25
25
|
import "./cli-F2D4GGUA.js";
|
|
26
26
|
import {
|
|
27
27
|
logger
|
|
28
|
-
} from "./cli-
|
|
29
|
-
import "./cli-
|
|
28
|
+
} from "./cli-DMKRP33X.js";
|
|
29
|
+
import "./cli-AEAFLZGY.js";
|
|
30
30
|
|
|
31
31
|
// cli/commands/resources/scenario/delete.ts
|
|
32
32
|
async function deleteScenario(identifier, options) {
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
readAuthoredBundle
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-3HPAKEJJ.js";
|
|
5
5
|
import {
|
|
6
6
|
resolveInputSource
|
|
7
|
-
} from "./cli-
|
|
7
|
+
} from "./cli-3VV2JLHX.js";
|
|
8
8
|
import {
|
|
9
9
|
createScenarioFiles
|
|
10
|
-
} from "./cli-
|
|
10
|
+
} from "./cli-UTHPCZYL.js";
|
|
11
11
|
import {
|
|
12
12
|
loadPackageContext
|
|
13
|
-
} from "./cli-
|
|
14
|
-
import "./cli-
|
|
15
|
-
import "./cli-
|
|
13
|
+
} from "./cli-BC4KKNLA.js";
|
|
14
|
+
import "./cli-UADUC4JD.js";
|
|
15
|
+
import "./cli-2QM63J3I.js";
|
|
16
16
|
import {
|
|
17
17
|
operationError,
|
|
18
18
|
printOperationResult
|
|
19
|
-
} from "./cli-
|
|
19
|
+
} from "./cli-QAVLRCQ5.js";
|
|
20
20
|
import {
|
|
21
21
|
input
|
|
22
|
-
} from "./cli-
|
|
23
|
-
import "./cli-
|
|
24
|
-
import "./cli-
|
|
25
|
-
import "./cli-
|
|
26
|
-
import "./cli-
|
|
22
|
+
} from "./cli-NU4SCD5D.js";
|
|
23
|
+
import "./cli-UZCQL6YP.js";
|
|
24
|
+
import "./cli-SOQJHK4Q.js";
|
|
25
|
+
import "./cli-7S4G4EKK.js";
|
|
26
|
+
import "./cli-O3IMNLN2.js";
|
|
27
27
|
import "./cli-25RWY5BQ.js";
|
|
28
28
|
import "./cli-QWQMPCL6.js";
|
|
29
29
|
import {
|
|
30
30
|
validateSDKScenario
|
|
31
|
-
} from "./cli-
|
|
31
|
+
} from "./cli-OUFXSQOW.js";
|
|
32
32
|
import "./cli-F2D4GGUA.js";
|
|
33
33
|
import {
|
|
34
34
|
logger
|
|
35
|
-
} from "./cli-
|
|
36
|
-
import "./cli-
|
|
35
|
+
} from "./cli-DMKRP33X.js";
|
|
36
|
+
import "./cli-AEAFLZGY.js";
|
|
37
37
|
|
|
38
38
|
// cli/commands/resources/scenario/new.ts
|
|
39
39
|
async function createScenario(definitionInput, options) {
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
beginOperationCapture,
|
|
4
4
|
endOperationCapture
|
|
5
|
-
} from "./cli-
|
|
5
|
+
} from "./cli-QAVLRCQ5.js";
|
|
6
6
|
import {
|
|
7
7
|
setPromptUsage
|
|
8
|
-
} from "./cli-
|
|
8
|
+
} from "./cli-NU4SCD5D.js";
|
|
9
9
|
import {
|
|
10
10
|
reportResult
|
|
11
|
-
} from "./cli-
|
|
11
|
+
} from "./cli-AEAFLZGY.js";
|
|
12
12
|
|
|
13
13
|
// cli/commands/resources/shared/resource-command.ts
|
|
14
14
|
import { isAbsolute, relative, resolve, sep } from "path";
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
getPluralResourceMeta
|
|
4
|
+
} from "./cli-OUFXSQOW.js";
|
|
5
|
+
|
|
6
|
+
// cli/generation/ts-type.ts
|
|
7
|
+
import { existsSync, readFileSync, statSync } from "fs";
|
|
8
|
+
import { dirname, isAbsolute, join, relative, resolve, sep } from "path";
|
|
9
|
+
var RELATIVE_IMPORT = /import\((['"])(\.{1,2}\/[^'"]+)\1\)/g;
|
|
10
|
+
var ABSOLUTE_IMPORT = /import\((['"])(\/[^'"]+|[A-Za-z]:[\\/][^'"]+)\1\)/g;
|
|
11
|
+
var NAMED_IMPORT = /import\((['"])([^'"]+)\1\)\.([A-Za-z_$][\w$]*)/g;
|
|
12
|
+
var MODULE_EXTENSIONS = [".ts", ".tsx", ".d.ts", "/index.ts", "/index.tsx"];
|
|
13
|
+
function capabilityDirectory(workingDir, identifier) {
|
|
14
|
+
return join(workingDir, getPluralResourceMeta("capability").pluralDir, identifier);
|
|
15
|
+
}
|
|
16
|
+
function mapTsTypes(schema, rewrite) {
|
|
17
|
+
if (Array.isArray(schema)) return schema.map((item) => mapTsTypes(item, rewrite));
|
|
18
|
+
if (schema === null || typeof schema !== "object") return schema;
|
|
19
|
+
return Object.fromEntries(
|
|
20
|
+
Object.entries(schema).map(([key, value]) => [
|
|
21
|
+
key,
|
|
22
|
+
key === "tsType" && typeof value === "string" ? rewrite(value) : mapTsTypes(value, rewrite)
|
|
23
|
+
])
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
function collectTsTypes(schema, into = []) {
|
|
27
|
+
if (Array.isArray(schema)) {
|
|
28
|
+
for (const item of schema) collectTsTypes(item, into);
|
|
29
|
+
} else if (schema !== null && typeof schema === "object") {
|
|
30
|
+
for (const [key, value] of Object.entries(schema)) {
|
|
31
|
+
if (key === "tsType" && typeof value === "string") into.push(value);
|
|
32
|
+
else collectTsTypes(value, into);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return into;
|
|
36
|
+
}
|
|
37
|
+
function absolutiseTsTypes(capabilities, workingDir) {
|
|
38
|
+
return capabilities.map((capability) => {
|
|
39
|
+
const schema = capability.definition.variablesSchema;
|
|
40
|
+
if (collectTsTypes(schema).length === 0) return capability;
|
|
41
|
+
const base = capabilityDirectory(workingDir, capability.definition.identifier);
|
|
42
|
+
return {
|
|
43
|
+
...capability,
|
|
44
|
+
definition: {
|
|
45
|
+
...capability.definition,
|
|
46
|
+
variablesSchema: mapTsTypes(
|
|
47
|
+
schema,
|
|
48
|
+
(tsType) => tsType.replace(
|
|
49
|
+
RELATIVE_IMPORT,
|
|
50
|
+
(_match, quote, path) => `import(${quote}${resolve(base, path)}${quote})`
|
|
51
|
+
)
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function relativiseTsTypes(schema, outputPath) {
|
|
58
|
+
const from = dirname(outputPath);
|
|
59
|
+
return mapTsTypes(
|
|
60
|
+
schema,
|
|
61
|
+
(tsType) => tsType.replace(ABSOLUTE_IMPORT, (_match, quote, path) => {
|
|
62
|
+
let rel = relative(from, path).split(sep).join("/");
|
|
63
|
+
if (!rel.startsWith(".")) rel = `./${rel}`;
|
|
64
|
+
return `import(${quote}${rel}${quote})`;
|
|
65
|
+
})
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
function validateTsTypes(capabilities, workingDir) {
|
|
69
|
+
const errors = [];
|
|
70
|
+
for (const capability of capabilities) {
|
|
71
|
+
const { identifier } = capability.definition;
|
|
72
|
+
const base = capabilityDirectory(workingDir, identifier);
|
|
73
|
+
for (const tsType of collectTsTypes(capability.definition.variablesSchema)) {
|
|
74
|
+
for (const match of tsType.matchAll(NAMED_IMPORT)) {
|
|
75
|
+
const [, , specifier, name] = match;
|
|
76
|
+
if (!specifier.startsWith(".") && !isAbsolute(specifier)) continue;
|
|
77
|
+
const target = resolve(base, specifier);
|
|
78
|
+
const file = [target, ...MODULE_EXTENSIONS.map((ext) => `${target}${ext}`)].find(
|
|
79
|
+
(candidate) => existsSync(candidate) && statSync(candidate).isFile()
|
|
80
|
+
);
|
|
81
|
+
if (!file) {
|
|
82
|
+
errors.push(
|
|
83
|
+
`Capability "${identifier}" has tsType "${tsType}", but "${specifier}" resolves to no module from ${relative(workingDir, base) || "."}. A tsType path is relative to the capability's own directory.`
|
|
84
|
+
);
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
if (!exportsName(readFileSync(file, "utf-8"), name)) {
|
|
88
|
+
errors.push(
|
|
89
|
+
`Capability "${identifier}" has tsType "${tsType}", but ${relative(workingDir, file)} does not export "${name}".`
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return errors;
|
|
96
|
+
}
|
|
97
|
+
function exportsName(source, name) {
|
|
98
|
+
const escaped = name.replace(/[$]/g, "\\$");
|
|
99
|
+
const declared = new RegExp(
|
|
100
|
+
`export\\s+(?:declare\\s+)?(?:interface|type|class|enum|const|let|var|function|abstract\\s+class)\\s+${escaped}\\b`
|
|
101
|
+
);
|
|
102
|
+
const listed = new RegExp(`export\\s+(?:type\\s+)?\\{[^}]*\\b${escaped}\\b[^}]*\\}`);
|
|
103
|
+
return declared.test(source) || listed.test(source) || /export\s+\*\s+from/.test(source);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export {
|
|
107
|
+
absolutiseTsTypes,
|
|
108
|
+
relativiseTsTypes,
|
|
109
|
+
validateTsTypes
|
|
110
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
logger
|
|
4
|
-
} from "./cli-
|
|
4
|
+
} from "./cli-DMKRP33X.js";
|
|
5
5
|
import {
|
|
6
6
|
CliError,
|
|
7
7
|
reportResult
|
|
8
|
-
} from "./cli-
|
|
8
|
+
} from "./cli-AEAFLZGY.js";
|
|
9
9
|
|
|
10
10
|
// cli/commands/package-bundle.ts
|
|
11
11
|
import { existsSync, readdirSync, readFileSync, statSync } from "fs";
|