@pulse-compute/wasm-compiler 1.0.0-beta.7 → 1.0.0-beta.9
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 +3 -3
- package/package.json +9 -9
- package/src/canonical-native-compiler.js +20 -4
- package/src/canonical-native-plan.js +1 -0
- package/src/canonical-project-compiler.js +8 -1
- package/src/javascript-application-plan.js +1 -0
- package/src/project/npm-source-resolution.js +91 -0
- package/src/project/package-reachability.js +2 -1
- package/src/project/reachable-graph-builder.js +131 -19
- package/src/report-handler-topology.js +104 -0
- package/src/report-reference-provenance.js +123 -0
- package/src/report-response-payloads.js +62 -0
- package/src/report-route-behavior.js +15 -0
- package/src/report-router-control.js +42 -0
- package/src/report-source-inputs.js +55 -0
- package/src/spine/binding-ownership.js +13 -0
- package/src/spine/canonical-router.js +1 -0
- package/src/spine/handler-surface-authority.js +71 -0
- package/src/spine/package-operation-seam.js +21 -7
- package/src/spine/router-handler-frontend.js +6 -13
- package/src/spine/terminal-package-native.js +4 -2
|
@@ -7,6 +7,7 @@ const {
|
|
|
7
7
|
staticString,
|
|
8
8
|
recognizeManagedHandlerWrapper,
|
|
9
9
|
recognizeHandlerSurface,
|
|
10
|
+
capabilityForHandlerSurface,
|
|
10
11
|
sourceModelForRouterRecognition
|
|
11
12
|
} = require('./handler-surface-authority.js');
|
|
12
13
|
const { normalizeManagedHandler } = require('./async-surface-normalizer.js');
|
|
@@ -130,17 +131,9 @@ function analysisForSurfaceFacts(surfaceFacts) {
|
|
|
130
131
|
const capabilities = new Set();
|
|
131
132
|
let fetchCount = 0;
|
|
132
133
|
for (const fact of facts) {
|
|
133
|
-
|
|
134
|
-
if (
|
|
135
|
-
if (fact.surfaceId.startsWith('ctx.
|
|
136
|
-
else if (fact.surfaceId.startsWith('ctx.config.')) capabilities.add('config.get');
|
|
137
|
-
else if (fact.surfaceId.startsWith('ctx.secret.')) capabilities.add('secret.get');
|
|
138
|
-
else if (fact.surfaceId.startsWith('ctx.kv.')) capabilities.add(fact.surfaceId.slice('ctx.'.length));
|
|
139
|
-
else if (fact.surfaceId.startsWith('ctx.state.')) capabilities.add(fact.surfaceId.slice('ctx.'.length));
|
|
140
|
-
else if (fact.surfaceId === 'ctx.emit') capabilities.add('event.emit');
|
|
141
|
-
else if (fact.surfaceId.startsWith('ctx.log.')) capabilities.add('logging');
|
|
142
|
-
else if (['ctx.json', 'ctx.text', 'ctx.response'].includes(fact.surfaceId)) capabilities.add(`response.${fact.surfaceId.slice('ctx.'.length)}`);
|
|
143
|
-
else if (fact.surfaceId === 'ctx.param') capabilities.add('route.param');
|
|
134
|
+
const capability = capabilityForHandlerSurface(fact);
|
|
135
|
+
if (capability) capabilities.add(capability);
|
|
136
|
+
if (fact.surfaceId.startsWith('ctx.fetch.')) fetchCount += 1;
|
|
144
137
|
}
|
|
145
138
|
return Object.freeze({
|
|
146
139
|
capabilities: Object.freeze([...capabilities].sort()),
|
|
@@ -283,7 +276,7 @@ function normalizeRouterHandler(topology, descriptor, recognition, classificatio
|
|
|
283
276
|
|| node.arguments.length !== helper.functionNode.parameters.length || !['route', 'middleware'].includes(role)) {
|
|
284
277
|
diagnostics.push(diagnostic(sourceFile, original, 'PULSE_NATIVE_PURE_HELPER_CALL_UNSUPPORTED',
|
|
285
278
|
'Pure helpers require a static unshadowed synchronous pure call in an HTTP handler.'));
|
|
286
|
-
}
|
|
279
|
+
} else sourceModelForRouterRecognition(recognition)?.retainValidatedCall(entry, helper, original, sourceFile);
|
|
287
280
|
return ts.factory.updateCallExpression(node, ts.factory.createIdentifier(helper.name), undefined,
|
|
288
281
|
node.arguments.map(arg => ts.visitNode(arg, visit)));
|
|
289
282
|
}
|
|
@@ -292,7 +285,7 @@ function normalizeRouterHandler(topology, descriptor, recognition, classificatio
|
|
|
292
285
|
|| !ts.isIdentifier(node.arguments[0]) || node.arguments[0].text !== ctxName
|
|
293
286
|
|| !['route', 'middleware'].includes(role)) {
|
|
294
287
|
diagnostics.push(diagnostic(sourceFile, original, 'PULSE_NATIVE_HELPER_CALL_UNSUPPORTED', 'A source helper requires an unshadowed, directly awaited local binding and the current request context in an HTTP handler.'));
|
|
295
|
-
}
|
|
288
|
+
} else sourceModelForRouterRecognition(recognition)?.retainValidatedCall(entry, helper, original, sourceFile);
|
|
296
289
|
return ts.factory.updateCallExpression(node, ts.factory.createIdentifier(helper.name), undefined, node.arguments.slice(1));
|
|
297
290
|
}
|
|
298
291
|
if (errorName && ts.isShorthandPropertyAssignment(node) && node.name.text === errorName) {
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
const { findLowerableManifestRecord } = require('@pulse-compute/wasm-library-kit/compiler/package-lowering');
|
|
4
4
|
const { loadLowerableCompilerBuilder } = require('@pulse-compute/wasm-library-kit/compiler/handler-library-contracts');
|
|
5
5
|
const { compileManagedHandlerNativeBundle } = require('./handler-ir-managed.js');
|
|
6
|
+
const { isTrustedLowerer } = require('@pulse-compute/wasm-contracts/library/manifest');
|
|
7
|
+
const path = require('node:path');
|
|
6
8
|
const applications = new WeakMap();
|
|
7
9
|
|
|
8
10
|
function attachTerminalPackageNative(compiled, inputs) {
|
|
@@ -14,8 +16,8 @@ function terminalPackageNativeForCompiled(compiled) {
|
|
|
14
16
|
if (!inputs) return null;
|
|
15
17
|
const { application, recognition, managedHandlers, schemaBundle, cwd, workspaceRoot } = inputs;
|
|
16
18
|
const selected = recognition.packages.find(entry => entry.contractId === application.contractId);
|
|
17
|
-
if (!selected || selected.builder.trust
|
|
18
|
-
const { record } = findLowerableManifestRecord({ cwd, workspaceRoot, contractId: selected.contractId, npmPackage: selected.package });
|
|
19
|
+
if (!selected || !isTrustedLowerer(selected.builder.trust)) throw new TypeError('Native application requires its selected trusted lowerer.');
|
|
20
|
+
const { record } = findLowerableManifestRecord({ cwd, workspaceRoot, packageDirs: recognition.dependencies.map(file => path.dirname(file)), contractId: selected.contractId, npmPackage: selected.package });
|
|
19
21
|
const exportName = record?.manifest?.compiler?.nativeApplicationExport;
|
|
20
22
|
if (!exportName) return null;
|
|
21
23
|
const loaded = loadLowerableCompilerBuilder(record);
|