@forgeax/engine-pack 0.1.23 → 0.1.24
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/README.md +12 -6
- package/dist/__tests__/material-cook-receipt-layer-plan.unit.test.d.ts +2 -0
- package/dist/__tests__/material-cook-receipt-layer-plan.unit.test.d.ts.map +1 -0
- package/dist/__tests__/pack-authoring-gateway.unit.test.d.ts +2 -0
- package/dist/__tests__/pack-authoring-gateway.unit.test.d.ts.map +1 -0
- package/dist/__tests__/pack-authoring.unit.test.d.ts +2 -0
- package/dist/__tests__/pack-authoring.unit.test.d.ts.map +1 -0
- package/dist/__tests__/pack-scanner.unit.test.d.ts +2 -0
- package/dist/__tests__/pack-scanner.unit.test.d.ts.map +1 -0
- package/dist/build.d.ts +3 -3
- package/dist/build.d.ts.map +1 -1
- package/dist/build.mjs +331 -290
- package/dist/build.mjs.map +1 -1
- package/dist/cli-asset.mjs +33 -35
- package/dist/cli-asset.mjs.map +1 -1
- package/dist/evidence/material-cook.d.ts +11 -0
- package/dist/evidence/material-cook.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +69 -26
- package/dist/index.mjs.map +1 -1
- package/dist/material-cook.d.ts +1 -1
- package/dist/material-cook.d.ts.map +1 -1
- package/dist/material-cook.mjs +50 -3
- package/dist/material-cook.mjs.map +1 -1
- package/dist/{parameterized-pack-node.d.ts → pack-authoring-node.d.ts} +7 -7
- package/dist/pack-authoring-node.d.ts.map +1 -0
- package/dist/{parameterized-pack-node.mjs → pack-authoring-node.mjs} +59 -63
- package/dist/pack-authoring-node.mjs.map +1 -0
- package/dist/{parameterized-pack.d.ts → pack-authoring.d.ts} +28 -31
- package/dist/pack-authoring.d.ts.map +1 -0
- package/dist/pack-authoring.mjs +1137 -0
- package/dist/pack-authoring.mjs.map +1 -0
- package/dist/runtime.mjs +1 -1
- package/dist/runtime.mjs.map +1 -1
- package/dist/scanner.d.ts +8 -8
- package/dist/scanner.d.ts.map +1 -1
- package/dist/scanner.mjs +29 -31
- package/dist/scanner.mjs.map +1 -1
- package/dist/schema.mjs +1 -1
- package/dist/schema.mjs.map +1 -1
- package/dist/scriptable-pack-node.d.ts +4 -4
- package/dist/scriptable-pack-node.d.ts.map +1 -1
- package/dist/scriptable-pack-node.mjs +18 -20
- package/dist/scriptable-pack-node.mjs.map +1 -1
- package/dist/scriptable-pack.d.ts +3 -2
- package/dist/scriptable-pack.d.ts.map +1 -1
- package/dist/scriptable-pack.mjs +19 -23
- package/dist/scriptable-pack.mjs.map +1 -1
- package/package.json +2 -7
- package/schema/pack.schema.json +1 -1
- package/src/__tests__/material-cook-receipt-layer-plan.unit.test.ts +16 -0
- package/src/__tests__/material-cook-schema.unit.test.ts +62 -0
- package/src/__tests__/{parameterized-pack-authoring-gateway.unit.test.ts → pack-authoring-gateway.unit.test.ts} +9 -9
- package/src/__tests__/{parameterized-pack.unit.test.ts → pack-authoring.unit.test.ts} +10 -10
- package/src/__tests__/{parameterized-pack-scanner.unit.test.ts → pack-scanner.unit.test.ts} +6 -6
- package/src/__tests__/scanner-inventory.contract.test.ts +2 -4
- package/src/__tests__/scanner-inventory.test.ts +7 -6
- package/src/__tests__/scriptable-pack-cli.integration.test.ts +1 -1
- package/src/build.ts +8 -8
- package/src/catalog-builder.ts +3 -3
- package/src/cli-asset.ts +5 -5
- package/src/evidence/material-cook.ts +79 -3
- package/src/evidence/source-inventory.ts +3 -3
- package/src/index.ts +4 -1
- package/src/material-cook.ts +1 -0
- package/src/{parameterized-pack-node.ts → pack-authoring-node.ts} +71 -73
- package/src/{parameterized-pack.ts → pack-authoring.ts} +59 -74
- package/src/scanner.ts +26 -28
- package/src/schema/material-cook.schema.json +4 -1
- package/src/scriptable-pack-node.ts +25 -25
- package/src/scriptable-pack.ts +3 -2
- package/dist/__tests__/parameterized-pack-authoring-gateway.unit.test.d.ts +0 -2
- package/dist/__tests__/parameterized-pack-authoring-gateway.unit.test.d.ts.map +0 -1
- package/dist/__tests__/parameterized-pack-scanner.unit.test.d.ts +0 -2
- package/dist/__tests__/parameterized-pack-scanner.unit.test.d.ts.map +0 -1
- package/dist/__tests__/parameterized-pack.unit.test.d.ts +0 -2
- package/dist/__tests__/parameterized-pack.unit.test.d.ts.map +0 -1
- package/dist/parameterized-pack-node.d.ts.map +0 -1
- package/dist/parameterized-pack-node.mjs.map +0 -1
- package/dist/parameterized-pack.d.ts.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Result } from '@forgeax/engine-types';
|
|
2
2
|
import { type ProducerSemanticIdentityInput } from './evidence/source-inventory.js';
|
|
3
|
-
import { type
|
|
3
|
+
import { type AnyScriptablePackDefinition, type PackAuthoringError } from './pack-authoring.js';
|
|
4
4
|
import type { ScriptablePackSourceClosureEntry } from './scriptable-pack.js';
|
|
5
5
|
export interface ScriptablePackModuleExecutor {
|
|
6
6
|
load(sourcePath: string): Promise<unknown>;
|
|
@@ -27,12 +27,12 @@ export declare function readOptionalBuildCache<T>(cache: OptionalBuildCache<T>):
|
|
|
27
27
|
/** Capture one immutable ScriptablePack module closure for inventory and production. */
|
|
28
28
|
export declare function inventoryScriptablePackSource(sourcePath: string, initialSourceText?: string): Promise<readonly ScriptablePackSourceClosureEntry[]>;
|
|
29
29
|
export declare function createScriptablePackModuleExecutorPool(options?: ScriptablePackModuleExecutorPoolOptions): ScriptablePackModuleExecutorPool;
|
|
30
|
-
export interface
|
|
30
|
+
export interface LoadScriptablePackOptions {
|
|
31
31
|
readonly timeoutMs?: number;
|
|
32
32
|
readonly buildTimeoutMs?: number;
|
|
33
33
|
readonly executor?: ScriptablePackModuleExecutor;
|
|
34
34
|
readonly metadataOnly?: boolean;
|
|
35
35
|
}
|
|
36
|
-
/** Load
|
|
37
|
-
export declare function
|
|
36
|
+
/** Load a ScriptablePack source contract in an isolated module executor. */
|
|
37
|
+
export declare function loadScriptablePack(sourcePath: string, options?: LoadScriptablePackOptions): Promise<Result<Readonly<AnyScriptablePackDefinition>, PackAuthoringError>>;
|
|
38
38
|
//# sourceMappingURL=scriptable-pack-node.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scriptable-pack-node.d.ts","sourceRoot":"","sources":["../src/scriptable-pack-node.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAa,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG/D,OAAO,EACL,KAAK,6BAA6B,EAEnC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,KAAK,
|
|
1
|
+
{"version":3,"file":"scriptable-pack-node.d.ts","sourceRoot":"","sources":["../src/scriptable-pack-node.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAa,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAG/D,OAAO,EACL,KAAK,6BAA6B,EAEnC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,KAAK,2BAA2B,EAChC,KAAK,kBAAkB,EAIxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAe,gCAAgC,EAAE,MAAM,sBAAsB,CAAC;AAe1F,MAAM,WAAW,4BAA4B;IAC3C,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,OAAO,CAAC,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5E;AAWD,MAAM,WAAW,gCAAgC;IAC/C,OAAO,IAAI,OAAO,CAAC,4BAA4B,CAAC,CAAC;IACjD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,MAAM,WAAW,uCAAuC;IACtD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;CACrC;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,6BAA6B,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
|
"bool",
|
|
137
137
|
"u32",
|
|
@@ -612,7 +612,7 @@ function validatePackDefinition(value, sourcePath) {
|
|
|
612
612
|
})
|
|
613
613
|
);
|
|
614
614
|
}
|
|
615
|
-
var
|
|
615
|
+
var PACK_AUTHORING_OPERATION_IDS = [
|
|
616
616
|
"asset.list",
|
|
617
617
|
"asset.inspect",
|
|
618
618
|
"asset.resolve",
|
|
@@ -624,14 +624,12 @@ var PARAMETERIZED_PACK_OPERATION_IDS = [
|
|
|
624
624
|
"asset-source.rebuild",
|
|
625
625
|
"asset-source.cold-cook"
|
|
626
626
|
];
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
})
|
|
634
|
-
);
|
|
627
|
+
PACK_AUTHORING_OPERATION_IDS.map((id) => ({
|
|
628
|
+
id,
|
|
629
|
+
domain: id.startsWith("asset-source.") ? "session" : "asset",
|
|
630
|
+
readOnly: id.startsWith("asset."),
|
|
631
|
+
requiresRevision: !id.startsWith("asset.") && id !== "asset-source.create"
|
|
632
|
+
}));
|
|
635
633
|
|
|
636
634
|
// src/evidence/source-inventory.ts
|
|
637
635
|
function stableValue(value) {
|
|
@@ -771,7 +769,7 @@ function hydrateFailure(value) {
|
|
|
771
769
|
return value;
|
|
772
770
|
}
|
|
773
771
|
var WorkerScriptablePackExecutor = class {
|
|
774
|
-
|
|
772
|
+
supportsPackParameters = true;
|
|
775
773
|
worker;
|
|
776
774
|
compileRoot;
|
|
777
775
|
nextBuildId = 0;
|
|
@@ -897,7 +895,7 @@ var ReusableWorkerScriptablePackExecutor = class {
|
|
|
897
895
|
}
|
|
898
896
|
maxTasksPerWorker;
|
|
899
897
|
release;
|
|
900
|
-
|
|
898
|
+
supportsPackParameters = true;
|
|
901
899
|
worker;
|
|
902
900
|
compileRootReady = mkdtemp(resolve(tmpdir(), "forgeax-scriptable-pack-pool-"));
|
|
903
901
|
compileRoot;
|
|
@@ -1114,7 +1112,7 @@ var DefaultScriptablePackModuleExecutorPool = class {
|
|
|
1114
1112
|
function createScriptablePackModuleExecutorPool(options = {}) {
|
|
1115
1113
|
return new DefaultScriptablePackModuleExecutorPool(options);
|
|
1116
1114
|
}
|
|
1117
|
-
function
|
|
1115
|
+
function scriptablePackLoadFailure(sourcePath, reason, phase, diagnostic, timeoutMs) {
|
|
1118
1116
|
return {
|
|
1119
1117
|
code: "pack-parameter-invalid",
|
|
1120
1118
|
expected: "a trusted Pack v2 authoring module with a valid default export",
|
|
@@ -1128,14 +1126,14 @@ function parameterizedLoadFailure(sourcePath, reason, phase, diagnostic, timeout
|
|
|
1128
1126
|
}
|
|
1129
1127
|
};
|
|
1130
1128
|
}
|
|
1131
|
-
async function
|
|
1129
|
+
async function loadScriptablePack(sourcePath, options = {}) {
|
|
1132
1130
|
const timeoutMs = options.timeoutMs ?? 15e3;
|
|
1133
1131
|
const buildTimeoutMs = options.buildTimeoutMs ?? 5e3;
|
|
1134
1132
|
const executor = options.executor ?? new WorkerScriptablePackExecutor();
|
|
1135
1133
|
let disposeReason;
|
|
1136
1134
|
let timeout;
|
|
1137
1135
|
try {
|
|
1138
|
-
const timeoutSignal = /* @__PURE__ */ Symbol("
|
|
1136
|
+
const timeoutSignal = /* @__PURE__ */ Symbol("scriptable-pack-module-timeout");
|
|
1139
1137
|
const loaded = await Promise.race([
|
|
1140
1138
|
executor.load(sourcePath),
|
|
1141
1139
|
new Promise((resolve3) => {
|
|
@@ -1145,7 +1143,7 @@ async function loadParameterizedScriptablePack(sourcePath, options = {}) {
|
|
|
1145
1143
|
if (loaded === timeoutSignal) {
|
|
1146
1144
|
disposeReason = "timeout";
|
|
1147
1145
|
return err(
|
|
1148
|
-
|
|
1146
|
+
scriptablePackLoadFailure(
|
|
1149
1147
|
sourcePath,
|
|
1150
1148
|
"timeout",
|
|
1151
1149
|
"module-load",
|
|
@@ -1172,7 +1170,7 @@ async function loadParameterizedScriptablePack(sourcePath, options = {}) {
|
|
|
1172
1170
|
let buildTimedOut = false;
|
|
1173
1171
|
let buildTimeout;
|
|
1174
1172
|
const timeoutResult = err(
|
|
1175
|
-
|
|
1173
|
+
scriptablePackLoadFailure(
|
|
1176
1174
|
sourcePath,
|
|
1177
1175
|
"timeout",
|
|
1178
1176
|
"build",
|
|
@@ -1181,7 +1179,7 @@ async function loadParameterizedScriptablePack(sourcePath, options = {}) {
|
|
|
1181
1179
|
)
|
|
1182
1180
|
);
|
|
1183
1181
|
try {
|
|
1184
|
-
const invocation = "
|
|
1182
|
+
const invocation = "supportsPackParameters" in executor && executor.supportsPackParameters === true ? build(context.readByGuid, {
|
|
1185
1183
|
packageId: [...context.packageId],
|
|
1186
1184
|
..."values" in context && context.values !== void 0 ? { values: context.values } : {}
|
|
1187
1185
|
}) : definition.build(context);
|
|
@@ -1211,7 +1209,7 @@ async function loadParameterizedScriptablePack(sourcePath, options = {}) {
|
|
|
1211
1209
|
} catch (error) {
|
|
1212
1210
|
disposeReason = "failure";
|
|
1213
1211
|
return err(
|
|
1214
|
-
|
|
1212
|
+
scriptablePackLoadFailure(
|
|
1215
1213
|
sourcePath,
|
|
1216
1214
|
"module-load",
|
|
1217
1215
|
"module-load",
|
|
@@ -1224,6 +1222,6 @@ async function loadParameterizedScriptablePack(sourcePath, options = {}) {
|
|
|
1224
1222
|
}
|
|
1225
1223
|
}
|
|
1226
1224
|
|
|
1227
|
-
export { createScriptablePackModuleExecutorPool, inventoryScriptablePackSource,
|
|
1225
|
+
export { createScriptablePackModuleExecutorPool, inventoryScriptablePackSource, loadScriptablePack, readOptionalBuildCache, scriptablePackDdcKey };
|
|
1228
1226
|
//# sourceMappingURL=scriptable-pack-node.mjs.map
|
|
1229
1227
|
//# sourceMappingURL=scriptable-pack-node.mjs.map
|