@pulse-compute/wasm-compiler 0.0.0 → 1.0.0-beta.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/README.md +52 -1
- package/bin/provider-proof-composition.js +34 -0
- package/bin/pulsewasm-extract.js +20 -0
- package/package.json +60 -5
- package/src/artifacts-dir.js +13 -0
- package/src/ast-json.js +52 -0
- package/src/build-manifest.js +354 -0
- package/src/canonical-api-compiler.js +245 -0
- package/src/canonical-native-compiler.js +411 -0
- package/src/canonical-native-plan.js +1477 -0
- package/src/canonical-project-compiler.js +1218 -0
- package/src/canonical-router-compiler.js +25 -0
- package/src/cli-intents.js +1235 -0
- package/src/cli.js +1927 -0
- package/src/codegen/assemblyscript-compile.js +3 -0
- package/src/codegen/assemblyscript-core.js +3 -0
- package/src/codegen/assemblyscript-shape.js +3 -0
- package/src/codegen/assemblyscript-wasm-smoke.js +3 -0
- package/src/codegen/backend-capabilities.js +3 -0
- package/src/codegen/channel-broadcaster.js +3 -0
- package/src/codegen/compiled-handlers.js +3 -0
- package/src/codegen/compiled-wasm-runtime.js +3 -0
- package/src/codegen/config-references.js +248 -0
- package/src/codegen/dispatch-ts.js +145 -0
- package/src/codegen/effect-composition.js +331 -0
- package/src/codegen/effect-runtime.js +418 -0
- package/src/codegen/execution-harness-ts.js +467 -0
- package/src/codegen/handler-bindings-ts.js +298 -0
- package/src/codegen/handler-library-contracts.js +3 -0
- package/src/codegen/host-capabilities.js +3 -0
- package/src/codegen/host-runtime-kernel.js +3 -0
- package/src/codegen/integrated-compiled-app.js +3 -0
- package/src/codegen/json-body.js +3 -0
- package/src/codegen/library-sidecars.js +3 -0
- package/src/codegen/local-harness-ts.js +453 -0
- package/src/codegen/pulse-wrapper.js +217 -0
- package/src/codegen/request-result-headers.js +3 -0
- package/src/codegen/schema-json-compile.js +3 -0
- package/src/codegen/schema-json-sidecar-v2.js +3 -0
- package/src/codegen/schema-json-sidecar.js +3 -0
- package/src/codegen/streaming-passthrough.js +3 -0
- package/src/codegen/wasm-host-abi.js +3 -0
- package/src/codegen/wasm-host-bridge.js +3 -0
- package/src/compiled-wasm-host-runtime-kv.js +3 -0
- package/src/config-resolver.js +813 -0
- package/src/crypto-requirement-planner.js +89 -0
- package/src/definitions/config-schema.js +14 -0
- package/src/definitions/handler-roles.js +14 -0
- package/src/definitions/path-grammar.js +14 -0
- package/src/definitions/router-api.js +14 -0
- package/src/diagnostics/codes.js +14 -0
- package/src/diagnostics/reporter.js +14 -0
- package/src/diagnostics.js +14 -0
- package/src/dispatch-table.js +400 -0
- package/src/events/event-emit.js +265 -0
- package/src/events/event-topology.js +127 -0
- package/src/execution-plan.js +463 -0
- package/src/extractor.js +2816 -0
- package/src/handler-eval.js +1154 -0
- package/src/handler-table.js +326 -0
- package/src/index.js +19 -0
- package/src/javascript-application-plan.js +181 -0
- package/src/kv-provider.js +3 -0
- package/src/path-table.js +60 -0
- package/src/path.js +14 -0
- package/src/patterns/config-define.js +30 -0
- package/src/patterns/dependency-call.js +18 -0
- package/src/patterns/env-lookup.js +13 -0
- package/src/patterns/handler-reference.js +29 -0
- package/src/patterns/path-literal.js +35 -0
- package/src/patterns/result.js +15 -0
- package/src/patterns/router-chain-call.js +50 -0
- package/src/patterns/router-construction.js +19 -0
- package/src/project/package-reachability.js +782 -0
- package/src/project/reachable-graph-builder.js +992 -0
- package/src/project/reachable-graph-contract.js +54 -0
- package/src/project/reachable-graph-implementation.js +36 -0
- package/src/project/router-module-linker.js +710 -0
- package/src/project-config-compiler.js +222 -0
- package/src/project-target-support.js +500 -0
- package/src/provider-toolchain.js +299 -0
- package/src/spine/async-surface-normalizer.js +312 -0
- package/src/spine/canonical-handler-ir.js +335 -0
- package/src/spine/canonical-native-module.js +87 -0
- package/src/spine/canonical-native-plan.js +89 -0
- package/src/spine/canonical-project.js +76 -0
- package/src/spine/canonical-router.js +155 -0
- package/src/spine/canonical-source.js +165 -0
- package/src/spine/diagnostic-authority.js +290 -0
- package/src/spine/equivalence.js +262 -0
- package/src/spine/guest-unit-stage.js +87 -0
- package/src/spine/handler-ir-emitter.js +454 -0
- package/src/spine/handler-ir-managed.js +1597 -0
- package/src/spine/handler-ir.js +797 -0
- package/src/spine/handler-surface-authority.js +585 -0
- package/src/spine/package-operation-seam.js +1015 -0
- package/src/spine/pipeline.js +202 -0
- package/src/spine/plain-handler-frontend.js +537 -0
- package/src/spine/provider-requirement-authority.js +208 -0
- package/src/spine/router-control-contract.js +17 -0
- package/src/spine/router-handler-frontend.js +513 -0
- package/src/spine/router-handler-ir.js +372 -0
- package/src/spine/router-topology-frontend.js +635 -0
- package/src/stable-id.js +14 -0
package/README.md
CHANGED
|
@@ -1,3 +1,54 @@
|
|
|
1
1
|
# @pulse-compute/wasm-compiler
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<!-- pulse-package-status:start -->
|
|
4
|
+
> **Support tier:** Implementation/transitive surface<br>
|
|
5
|
+
> **Audience:** Pulse compiler and release maintainers.<br>
|
|
6
|
+
> **Install directly:** No for application projects; use the pulse CLI.<br>
|
|
7
|
+
> **Supported entry points:** `None for application authors.`<br>
|
|
8
|
+
> **Stability:** Internal compiler interface; no application-author compatibility guarantee.<br>
|
|
9
|
+
> **Canonical replacement:** `@pulse-compute/cli`<br>
|
|
10
|
+
> **Canonical documentation:** [Package guide](https://pulsecompute.io/v1.0.0-beta.1/packages/implementation-packages/)
|
|
11
|
+
>
|
|
12
|
+
> This release-status block is generated from the synchronized `Pulse 1.0.0-beta.1` package policy.
|
|
13
|
+
<!-- pulse-package-status:end -->
|
|
14
|
+
|
|
15
|
+
Whole-project compiler implementation used by the `pulse` workflow. Application projects should use `@pulse-compute/cli`, not import this package directly.
|
|
16
|
+
|
|
17
|
+
## Responsibilities
|
|
18
|
+
|
|
19
|
+
- resolve and validate compiler inputs;
|
|
20
|
+
- compile canonical handler source into values, effects, continuations, and capability metadata;
|
|
21
|
+
- compile explicitly declared JSON schemas through the schema package;
|
|
22
|
+
- discover trusted package-owned manifests and invoke their owning builders;
|
|
23
|
+
- merge package effects with canonical operations;
|
|
24
|
+
- emit versioned canonical plans and build artifacts;
|
|
25
|
+
- expose implementation diagnostics to the product workflow.
|
|
26
|
+
|
|
27
|
+
## Boundaries
|
|
28
|
+
|
|
29
|
+
The compiler orchestrates contracts but does not own:
|
|
30
|
+
|
|
31
|
+
- product command parsing or project UX;
|
|
32
|
+
- provider execution;
|
|
33
|
+
- provider SDK behavior;
|
|
34
|
+
- package-specific AST rules for GRIP or assets;
|
|
35
|
+
- schema payload semantics;
|
|
36
|
+
- application runtime authority.
|
|
37
|
+
|
|
38
|
+
Package-specific lowering belongs to the package owning the facade. Provider realization belongs to provider packages. Shared protocol vocabulary belongs to `@pulse-compute/wasm-contracts`.
|
|
39
|
+
|
|
40
|
+
## Internal compiler spine
|
|
41
|
+
|
|
42
|
+
The compiler connects root extraction, surface recognition, normalization, classification, validation, canonical IR, native lowering, provider realization, and artifact verification through a fixed package-internal pipeline. The pipeline is not exported and is not a plugin framework. Compiler refactors must preserve checked-in metadata, diagnostics, native-plan, and generated-Wasm evidence unless an explicit contract migration authorizes a difference.
|
|
43
|
+
|
|
44
|
+
The canonical-source and Router frontends now share package-internal handler-surface recognition and compatibility diagnostic authorities. The shared surface authority consumes the contracts package vocabulary, retains frontend-specific syntax compatibility, records facts without changing compiler outputs, and does not enable async or widen source support by itself. Canonical IR generation remains behind legacy compatibility envelopes until the dedicated frontend migration phases.
|
|
45
|
+
|
|
46
|
+
## Exported implementation modules
|
|
47
|
+
|
|
48
|
+
The package exports its root implementation plus focused compiler, CLI, extractor, config resolver, diagnostics, build-manifest, canonical API compiler, and canonical project compiler modules. These are synchronized internal interfaces without an application-author compatibility guarantee.
|
|
49
|
+
|
|
50
|
+
## Validation
|
|
51
|
+
|
|
52
|
+
Compiler changes should be covered by focused static/lowering tests, canonical project inspection, provider-plan parity, packed-package discovery where relevant, and the release documentation gates.
|
|
53
|
+
|
|
54
|
+
See the installed [implementation package guide](https://pulsecompute.io/v1.0.0-beta.1/packages/implementation-packages/) and [compilation concepts](https://pulsecompute.io/v1.0.0-beta.1/concepts/compilation-and-lowering/).
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const node = require('@pulse-compute/provider-node/compiler');
|
|
4
|
+
const fastly = require('@pulse-compute/provider-fastly/compiler');
|
|
5
|
+
const {
|
|
6
|
+
buildNodeLiveOriginRouteHandlerEffectProof
|
|
7
|
+
} = require('@pulse-compute/provider-node/compiler/route-handler-live-origin-proof');
|
|
8
|
+
const {
|
|
9
|
+
buildNodeCompiledRouteHandlerEffectBridge
|
|
10
|
+
} = require('@pulse-compute/provider-node/compiler/route-handler-compiled-wasm-bridge');
|
|
11
|
+
const {
|
|
12
|
+
buildNodeBackendJsonRequestBodyProof
|
|
13
|
+
} = require('@pulse-compute/provider-node/compiler/backend-json-request-body-proof');
|
|
14
|
+
|
|
15
|
+
module.exports = Object.freeze({
|
|
16
|
+
buildNodeAdapter: node.buildNodeAdapter,
|
|
17
|
+
buildNodeAssetsProviderProof: node.buildNodeAssetsProviderProof,
|
|
18
|
+
buildNodeCompiledWasmAssetsLifecycleProof: node.buildNodeCompiledWasmAssetsLifecycleProof,
|
|
19
|
+
buildNodeRouteHandlerEffectProof: node.buildNodeRouteHandlerEffectProof,
|
|
20
|
+
buildNodeRequestJsonBodyProof: node.buildNodeRequestJsonBodyProof,
|
|
21
|
+
buildNodeSchemaDecodeResultProof: node.buildNodeSchemaDecodeResultProof,
|
|
22
|
+
buildNodeSchemaResponseCodecProof: node.buildNodeSchemaResponseCodecProof,
|
|
23
|
+
buildNodeLiveOriginRouteHandlerEffectProof,
|
|
24
|
+
buildNodeCompiledRouteHandlerEffectBridge,
|
|
25
|
+
buildNodeBackendJsonRequestBodyProof,
|
|
26
|
+
buildFastlyReadiness: fastly.buildFastlyReadiness,
|
|
27
|
+
buildFastlyHostcallBinding: fastly.buildFastlyHostcallBinding,
|
|
28
|
+
buildFastlyStreamHeaderAdapter: fastly.buildFastlyStreamHeaderAdapter,
|
|
29
|
+
buildFastlyCommandEntry: fastly.buildFastlyCommandEntry,
|
|
30
|
+
buildFastlyAssetsProviderProof: fastly.buildFastlyAssetsProviderProof,
|
|
31
|
+
buildFastlyAssetsPackageOutParityProof: fastly.buildFastlyAssetsPackageOutParityProof,
|
|
32
|
+
buildFastlyRouteHandlerEffectProof: fastly.buildFastlyRouteHandlerEffectProof,
|
|
33
|
+
buildFastlyLifecycleParityProof: fastly.buildFastlyLifecycleParityProof
|
|
34
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const { runCli } = require('../src/cli.js');
|
|
5
|
+
const { getDefaultArtifactsDir } = require('@pulse-compute/wasm-build-support/artifacts-dir');
|
|
6
|
+
const providerProofs = require('./provider-proof-composition.js');
|
|
7
|
+
|
|
8
|
+
runCli(process.argv.slice(2), {
|
|
9
|
+
cwd: process.cwd(),
|
|
10
|
+
stdout: process.stdout,
|
|
11
|
+
stderr: process.stderr,
|
|
12
|
+
defaultOutDir: getDefaultArtifactsDir(process.cwd()),
|
|
13
|
+
providerProofs,
|
|
14
|
+
exitOnComplete: true
|
|
15
|
+
}).then(() => {
|
|
16
|
+
process.exit(process.exitCode || 0);
|
|
17
|
+
}).catch((error) => {
|
|
18
|
+
process.stderr.write(`${error && error.stack ? error.stack : String(error)}\n`);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
});
|
package/package.json
CHANGED
|
@@ -1,15 +1,70 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pulse-compute/wasm-compiler",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Inert namespace bootstrap for Pulse.",
|
|
3
|
+
"version": "1.0.0-beta.1",
|
|
5
4
|
"license": "Apache-2.0",
|
|
5
|
+
"description": "PulseWasm compiler package inside the Pulse monorepo.",
|
|
6
|
+
"type": "commonjs",
|
|
7
|
+
"bin": {
|
|
8
|
+
"pulsewasm-extract": "./bin/pulsewasm-extract.js",
|
|
9
|
+
"pulsewasm": "./bin/pulsewasm-extract.js"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@pulse-compute/provider-fastly": "1.0.0-beta.1",
|
|
13
|
+
"@pulse-compute/provider-node": "1.0.0-beta.1",
|
|
14
|
+
"@pulse-compute/wasm-build-support": "1.0.0-beta.1",
|
|
15
|
+
"@pulse-compute/wasm-contracts": "1.0.0-beta.1",
|
|
16
|
+
"@pulse-compute/wasm-guest-link": "1.0.0-beta.1",
|
|
17
|
+
"@pulse-compute/wasm-host-runtime": "1.0.0-beta.1",
|
|
18
|
+
"@pulse-compute/wasm-library-kit": "1.0.0-beta.1",
|
|
19
|
+
"@pulse-compute/wasm-runtime-core-as": "1.0.0-beta.1",
|
|
20
|
+
"@pulse-compute/wasm-schema-json": "1.0.0-beta.1",
|
|
21
|
+
"assemblyscript": "0.28.18",
|
|
22
|
+
"json-as": "1.5.0",
|
|
23
|
+
"typescript": "5.9.3"
|
|
24
|
+
},
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": "^22.14.0 || ^24.0.0"
|
|
27
|
+
},
|
|
28
|
+
"main": "./src/index.js",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": "./src/index.js",
|
|
31
|
+
"./cli": "./src/cli.js",
|
|
32
|
+
"./extractor": "./src/extractor.js",
|
|
33
|
+
"./config-resolver": "./src/config-resolver.js",
|
|
34
|
+
"./diagnostics": "./src/diagnostics.js",
|
|
35
|
+
"./build-manifest": "./src/build-manifest.js",
|
|
36
|
+
"./canonical-api-compiler": "./src/canonical-api-compiler.js",
|
|
37
|
+
"./canonical-native-plan": "./src/canonical-native-plan.js",
|
|
38
|
+
"./canonical-native-compiler": "./src/canonical-native-compiler.js",
|
|
39
|
+
"./canonical-project-compiler": "./src/canonical-project-compiler.js",
|
|
40
|
+
"./project-config-compiler": "./src/project-config-compiler.js",
|
|
41
|
+
"./crypto-requirement-planner": "./src/crypto-requirement-planner.js",
|
|
42
|
+
"./javascript-application-plan": "./src/javascript-application-plan.js",
|
|
43
|
+
"./provider-toolchain": "./src/provider-toolchain.js",
|
|
44
|
+
"./project-target-support": "./src/project-target-support.js"
|
|
45
|
+
},
|
|
6
46
|
"files": [
|
|
47
|
+
"bin",
|
|
48
|
+
"src",
|
|
7
49
|
"README.md",
|
|
8
50
|
"LICENSE",
|
|
9
51
|
"NOTICE"
|
|
10
52
|
],
|
|
11
53
|
"publishConfig": {
|
|
12
|
-
"access": "public"
|
|
13
|
-
|
|
54
|
+
"access": "public"
|
|
55
|
+
},
|
|
56
|
+
"repository": {
|
|
57
|
+
"type": "git",
|
|
58
|
+
"url": "git+https://github.com/pulse-compute/pulse.git",
|
|
59
|
+
"directory": "wasm/packages/compiler"
|
|
60
|
+
},
|
|
61
|
+
"homepage": "https://pulsecompute.io/v1.0.0-beta.1/packages/implementation-packages/",
|
|
62
|
+
"bugs": {
|
|
63
|
+
"url": "https://github.com/pulse-compute/pulse/issues"
|
|
64
|
+
},
|
|
65
|
+
"scripts": {
|
|
66
|
+
"build": "node ./bin/pulsewasm-extract.js build --config ./examples/pulse.config.js --profile edge --env ASSET_ENDPOINT=https://assets.example.test --env ASSET_BUCKET=pulse-assets --env USERS_API_BASE_URL=https://users.example.test --out ../../artifacts --emit-ast",
|
|
67
|
+
"extract": "node ./bin/pulsewasm-extract.js build ./examples/example.js --root app --out ../../artifacts --emit-ast",
|
|
68
|
+
"test": "node ../../scripts/run-wasm-tests.cjs --profile native --no-report"
|
|
14
69
|
}
|
|
15
|
-
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('node:path');
|
|
4
|
+
const support = require('@pulse-compute/wasm-build-support/artifacts-dir');
|
|
5
|
+
|
|
6
|
+
function getCompilerPackageRoot() {
|
|
7
|
+
return path.resolve(__dirname, '..');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
module.exports = {
|
|
11
|
+
...support,
|
|
12
|
+
getCompilerPackageRoot
|
|
13
|
+
};
|
package/src/ast-json.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { sourceLoc } = require('./diagnostics.js');
|
|
4
|
+
|
|
5
|
+
const TEXT_KINDS = new Set([
|
|
6
|
+
'Identifier',
|
|
7
|
+
'StringLiteral',
|
|
8
|
+
'NoSubstitutionTemplateLiteral',
|
|
9
|
+
'NumericLiteral',
|
|
10
|
+
'PropertyAccessExpression',
|
|
11
|
+
'CallExpression',
|
|
12
|
+
'NewExpression',
|
|
13
|
+
'VariableDeclaration',
|
|
14
|
+
'FunctionDeclaration',
|
|
15
|
+
'ArrowFunction',
|
|
16
|
+
'FunctionExpression'
|
|
17
|
+
]);
|
|
18
|
+
|
|
19
|
+
function compactText(text, maxLength) {
|
|
20
|
+
const value = text.replace(/\s+/g, ' ').trim();
|
|
21
|
+
return value.length > maxLength ? `${value.slice(0, maxLength)}…` : value;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function astToJson(ts, sourceFile, options = {}) {
|
|
25
|
+
const maxTextLength = options.maxTextLength ?? 180;
|
|
26
|
+
const maxDepth = options.maxDepth ?? 80;
|
|
27
|
+
|
|
28
|
+
function visit(node, depth) {
|
|
29
|
+
const kind = ts.SyntaxKind[node.kind] || String(node.kind);
|
|
30
|
+
const out = {
|
|
31
|
+
kind,
|
|
32
|
+
loc: sourceLoc(sourceFile, node)
|
|
33
|
+
};
|
|
34
|
+
if (TEXT_KINDS.has(kind)) {
|
|
35
|
+
out.text = compactText(node.getText(sourceFile), maxTextLength);
|
|
36
|
+
}
|
|
37
|
+
if (depth >= maxDepth) {
|
|
38
|
+
out.truncated = true;
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
const children = [];
|
|
42
|
+
ts.forEachChild(node, (child) => {
|
|
43
|
+
children.push(visit(child, depth + 1));
|
|
44
|
+
});
|
|
45
|
+
if (children.length > 0) out.children = children;
|
|
46
|
+
return out;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return visit(sourceFile, 0);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
module.exports = { astToJson };
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const crypto = require('node:crypto');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
const { PACKAGE_VERSION, countDiagnostics, normalizeArtifact, stableFileName } = require('./diagnostics.js');
|
|
6
|
+
const { getDefaultArtifactsDir } = require('@pulse-compute/wasm-build-support/artifacts-dir');
|
|
7
|
+
|
|
8
|
+
const ARTIFACT_ORDER = [
|
|
9
|
+
'resolved-config.json',
|
|
10
|
+
'cli-doctor.json',
|
|
11
|
+
'symbol-index.json',
|
|
12
|
+
'handler-table.json',
|
|
13
|
+
'handler-eval.json',
|
|
14
|
+
'path-table.json',
|
|
15
|
+
'dispatch-table.json',
|
|
16
|
+
'execution-plan.json',
|
|
17
|
+
'handler-bindings.json',
|
|
18
|
+
'execution-harness.json',
|
|
19
|
+
'local-harness.json',
|
|
20
|
+
'assemblyscript-shape.json',
|
|
21
|
+
'assemblyscript-core.json',
|
|
22
|
+
'assemblyscript-handlers.json',
|
|
23
|
+
'assemblyscript-compile.json',
|
|
24
|
+
'assemblyscript-wasm-smoke.json',
|
|
25
|
+
'wasm-host-abi.json',
|
|
26
|
+
'wasm-host-bridge.json',
|
|
27
|
+
'request-result-headers.json',
|
|
28
|
+
'channel-broadcaster.json',
|
|
29
|
+
'json-body.json',
|
|
30
|
+
'backend-capabilities.json',
|
|
31
|
+
'deployment-posture.json',
|
|
32
|
+
'host-runtime-kernel.json',
|
|
33
|
+
'node-adapter.json',
|
|
34
|
+
'handler-library-contracts.json',
|
|
35
|
+
'handler-execution-modes.json',
|
|
36
|
+
'library-contract-schema.json',
|
|
37
|
+
'library-capabilities.json',
|
|
38
|
+
'library-compatibility-report.json',
|
|
39
|
+
'assets-lowering-plan.json',
|
|
40
|
+
'assets-compiled-wasm-sidecar-plan.json',
|
|
41
|
+
'assets-sidecar-compile-link-proof.json',
|
|
42
|
+
'assets-package-owned-lowering-proof.json',
|
|
43
|
+
'assets-package-out-discovery-proof.json',
|
|
44
|
+
'grip-lowering-plan.json',
|
|
45
|
+
'second-package-owned-lowering-proof.json',
|
|
46
|
+
'grip-package-owned-lowering-proof.json',
|
|
47
|
+
'guest-unit-plan.json',
|
|
48
|
+
'guest-link-report.json',
|
|
49
|
+
'final-wasm-audit.json',
|
|
50
|
+
'node-assets-provider-proof.json',
|
|
51
|
+
'node-compiled-wasm-assets-lifecycle-proof.json',
|
|
52
|
+
'fastly-assets-provider-proof.json',
|
|
53
|
+
'fastly-assets-package-out-parity-proof.json',
|
|
54
|
+
'route-handler-effect-plan.json',
|
|
55
|
+
'node-route-handler-effect-proof.json',
|
|
56
|
+
'node-live-origin-route-handler-effect-proof.json',
|
|
57
|
+
'node-compiled-route-handler-effect-bridge.json',
|
|
58
|
+
'fastly-route-handler-effect-proof.json',
|
|
59
|
+
'fastly-lifecycle-parity-proof.json',
|
|
60
|
+
'route-handler-context-lowering-plan.json',
|
|
61
|
+
'handler-io-lifecycle-plan.json',
|
|
62
|
+
'request-json-body-plan.json',
|
|
63
|
+
'node-request-json-body-proof.json',
|
|
64
|
+
'schema-decode-result-plan.json',
|
|
65
|
+
'node-schema-decode-result-proof.json',
|
|
66
|
+
'schema-response-codec-plan.json',
|
|
67
|
+
'backend-json-request-body-plan.json',
|
|
68
|
+
'node-backend-json-request-body-proof.json',
|
|
69
|
+
'node-schema-response-codec-proof.json',
|
|
70
|
+
'reference-lifecycle-stabilization-proof.json',
|
|
71
|
+
'reference-node-lifecycle-golden.json',
|
|
72
|
+
'beta-lifecycle-golden.json',
|
|
73
|
+
'lifecycle-authoring-alignment.json',
|
|
74
|
+
'lifecycle-readiness-aggregate.json',
|
|
75
|
+
'doctor-readiness-aggregator.json',
|
|
76
|
+
'host-capabilities.json',
|
|
77
|
+
'host-capability-contract.json',
|
|
78
|
+
'wasi-provider-map.json',
|
|
79
|
+
'capability-provider-report.json',
|
|
80
|
+
'effect-runtime.json',
|
|
81
|
+
'effect-runtime-contract.json',
|
|
82
|
+
'effect-kind-registry.json',
|
|
83
|
+
'effect-resume-protocol.json',
|
|
84
|
+
'effect-timeout-policy.json',
|
|
85
|
+
'effect-composition.json',
|
|
86
|
+
'effect-plan-contract.json',
|
|
87
|
+
'effect-continuation-contract.json',
|
|
88
|
+
'timeout-scope-policy.json',
|
|
89
|
+
'compiled-handler-plan.json',
|
|
90
|
+
'handler-lowering-report.json',
|
|
91
|
+
'compiled-handler-hardening.json',
|
|
92
|
+
'compiled-handler-smoke.json',
|
|
93
|
+
'wrapper-integration.json',
|
|
94
|
+
'pulse-build-output.json',
|
|
95
|
+
'pulse-dev-runtime.json',
|
|
96
|
+
'schema-json-generic-parser.json',
|
|
97
|
+
'schema-json-generic-parser-plan.json',
|
|
98
|
+
'schema-json-generic-parser-abi.json',
|
|
99
|
+
'schema-json-generic-parser-smoke.json',
|
|
100
|
+
'schema-json-sidecar.json',
|
|
101
|
+
'schema-json-plan.json',
|
|
102
|
+
'schema-json-parser-report.json',
|
|
103
|
+
'schema-json-registry.json',
|
|
104
|
+
'schema-json-sidecar-abi.json',
|
|
105
|
+
'schema-json-body-policy.json',
|
|
106
|
+
'schema-json-smoke.json',
|
|
107
|
+
'generated/as/schema-json/generic/as-json-parser.as.ts',
|
|
108
|
+
'generated/as-smoke/schema-json-generic-parser-smoke-runner.as.ts',
|
|
109
|
+
'generated/schema-json-generic-parser/pulsewasm-schema-json-generic-parser.wasm',
|
|
110
|
+
'generated/schema-json-generic-parser/pulsewasm-schema-json-generic-parser.wat',
|
|
111
|
+
'generated/host/schema-json-generic-parser.md',
|
|
112
|
+
'generated/host/handler-library-contracts.md',
|
|
113
|
+
'generated/host/host-capabilities.md',
|
|
114
|
+
'generated/host/effect-runtime.md',
|
|
115
|
+
'generated/host/effect-composition.md',
|
|
116
|
+
'generated/as/user-handlers.as.ts',
|
|
117
|
+
'generated/as-smoke/compiled-handler-smoke-runner.as.ts',
|
|
118
|
+
'generated/compiled-handlers/pulsewasm-compiled-handlers.wasm',
|
|
119
|
+
'generated/compiled-handlers/pulsewasm-compiled-handlers.wat',
|
|
120
|
+
'generated/as-smoke/pulsewasm-smoke.wasm',
|
|
121
|
+
'generated/as-smoke/pulsewasm-smoke.wat',
|
|
122
|
+
'generated/wasm-smoke/pulsewasm-local-smoke.wasm',
|
|
123
|
+
'generated/wasm-smoke/pulsewasm-local-smoke.wat',
|
|
124
|
+
'generated/as-smoke/smoke-runner.as.ts',
|
|
125
|
+
'generated/host/wasm-host-abi.md',
|
|
126
|
+
'generated/host/request-result-headers.md',
|
|
127
|
+
'generated/host/channel-broadcaster.md',
|
|
128
|
+
'generated/host/json-body.md',
|
|
129
|
+
'generated/host/backend-capabilities.md',
|
|
130
|
+
'generated/host/pulse-wrapper-integration.md',
|
|
131
|
+
'generated/pulse/pulse-wrapper.cjs',
|
|
132
|
+
'generated/host/host-runtime-kernel.cjs',
|
|
133
|
+
'generated/node/node-adapter.cjs',
|
|
134
|
+
'generated/host-bridge/host-bridge-runner.as.ts',
|
|
135
|
+
'generated/wasm-bridge/pulsewasm-host-bridge.wasm',
|
|
136
|
+
'generated/wasm-bridge/pulsewasm-host-bridge.wat',
|
|
137
|
+
'generated/manifest.json',
|
|
138
|
+
'generated/types.ts',
|
|
139
|
+
'generated/route-table.ts',
|
|
140
|
+
'generated/dispatch.ts',
|
|
141
|
+
'generated/handler-slots.ts',
|
|
142
|
+
'generated/execution-plan.ts',
|
|
143
|
+
'generated/execution-harness.ts',
|
|
144
|
+
'generated/local-harness.ts',
|
|
145
|
+
'generated/as/manifest.json',
|
|
146
|
+
'generated/as/types.as.ts',
|
|
147
|
+
'generated/as/route-table.as.ts',
|
|
148
|
+
'generated/as/dispatch-shape.as.ts',
|
|
149
|
+
'generated/as/runtime-path.as.ts',
|
|
150
|
+
'generated/as/handler-slots.as.ts',
|
|
151
|
+
'generated/as/runtime-core.as.ts',
|
|
152
|
+
'generated/as/index.as.ts',
|
|
153
|
+
'generated/index.ts',
|
|
154
|
+
'route-plan.json',
|
|
155
|
+
'route-id-map.json',
|
|
156
|
+
'router-ir.json',
|
|
157
|
+
'router-tree.json',
|
|
158
|
+
'diagnostics.json',
|
|
159
|
+
'ast.json',
|
|
160
|
+
'build-manifest.json'
|
|
161
|
+
];
|
|
162
|
+
|
|
163
|
+
function sha256(text) {
|
|
164
|
+
const hash = crypto.createHash('sha256');
|
|
165
|
+
if (Buffer.isBuffer(text)) hash.update(text);
|
|
166
|
+
else hash.update(String(text), 'utf8');
|
|
167
|
+
return hash.digest('hex');
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function artifactVersion(value) {
|
|
171
|
+
return value && typeof value === 'object' && typeof value.version === 'string' ? value.version : undefined;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function artifactSortKey(fileName) {
|
|
175
|
+
const index = ARTIFACT_ORDER.indexOf(fileName);
|
|
176
|
+
return index === -1 ? ARTIFACT_ORDER.length + fileName.charCodeAt(0) : index;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function sortArtifacts(artifacts) {
|
|
180
|
+
return artifacts.slice().sort((a, b) => {
|
|
181
|
+
const ak = artifactSortKey(a.file);
|
|
182
|
+
const bk = artifactSortKey(b.file);
|
|
183
|
+
if (ak !== bk) return ak - bk;
|
|
184
|
+
return a.file.localeCompare(b.file);
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function makeArtifactRecord(fileName, value, jsonText) {
|
|
189
|
+
return {
|
|
190
|
+
file: fileName,
|
|
191
|
+
version: artifactVersion(value),
|
|
192
|
+
bytes: Buffer.isBuffer(jsonText) ? jsonText.length : Buffer.byteLength(String(jsonText), 'utf8'),
|
|
193
|
+
sha256: sha256(jsonText)
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function summarizeResult(result) {
|
|
198
|
+
if (!result) return undefined;
|
|
199
|
+
const routePlan = result.routePlan || {};
|
|
200
|
+
const handlerTable = result.handlerTable || {};
|
|
201
|
+
const handlerEval = result.handlerEval || {};
|
|
202
|
+
const dispatchTable = result.dispatchTable || {};
|
|
203
|
+
const dispatchTs = result.dispatchTs || {};
|
|
204
|
+
return {
|
|
205
|
+
routes: Array.isArray(routePlan.routes) ? routePlan.routes.length : 0,
|
|
206
|
+
handlers: Array.isArray(handlerTable.handlers) ? handlerTable.handlers.length : 0,
|
|
207
|
+
handlerEvalStatus: handlerEval.summary,
|
|
208
|
+
dispatch: dispatchTable.summary,
|
|
209
|
+
executionPlan: result.executionPlan?.summary,
|
|
210
|
+
handlerBindings: result.handlerBindings?.artifact?.summary,
|
|
211
|
+
executionHarness: result.executionHarness?.artifact?.summary,
|
|
212
|
+
localHarness: result.localHarness?.artifact?.summary,
|
|
213
|
+
assemblyScriptShape: result.assemblyScriptShape?.artifact?.summary,
|
|
214
|
+
assemblyScriptCore: result.assemblyScriptCore?.artifact?.summary,
|
|
215
|
+
assemblyScriptCompile: result.assemblyScriptCompile?.artifact?.summary,
|
|
216
|
+
assemblyScriptWasmSmoke: result.assemblyScriptWasmSmoke?.artifact?.summary,
|
|
217
|
+
wasmHostAbi: result.wasmHostAbi?.artifact?.summary,
|
|
218
|
+
wasmHostBridge: result.wasmHostBridge?.artifact?.summary,
|
|
219
|
+
requestResultHeaders: result.requestResultHeaders?.artifact?.summary,
|
|
220
|
+
channelBroadcaster: result.channelBroadcaster?.artifact?.summary,
|
|
221
|
+
jsonBody: result.jsonBody?.artifact?.summary,
|
|
222
|
+
backendCapabilities: result.backendCapabilities?.artifact?.summary,
|
|
223
|
+
deploymentPosture: result.deploymentPosture?.artifact?.summary,
|
|
224
|
+
hostRuntimeKernel: result.hostRuntimeKernel?.artifact?.summary,
|
|
225
|
+
nodeAdapter: result.nodeAdapter?.artifact?.summary,
|
|
226
|
+
handlerLibraryContracts: result.handlerLibraryContracts?.artifact?.summary,
|
|
227
|
+
doctorReadinessAggregator: result.doctorReadinessAggregator?.artifact?.summary,
|
|
228
|
+
lifecycleReadinessAggregate: result.lifecycleReadinessAggregate?.artifact?.summary,
|
|
229
|
+
assetsLoweringPlan: result.assetsLoweringPlan?.artifact?.summary,
|
|
230
|
+
nodeAssetsProviderProof: result.nodeAssetsProviderProof?.artifact?.summary,
|
|
231
|
+
fastlyAssetsProviderProof: result.fastlyAssetsProviderProof?.artifact?.summary,
|
|
232
|
+
fastlyAssetsPackageOutParityProof: result.fastlyAssetsPackageOutParityProof?.artifact?.summary,
|
|
233
|
+
routeHandlerEffectPlan: result.routeHandlerEffectPlan?.artifact?.summary,
|
|
234
|
+
nodeRouteHandlerEffectProof: result.nodeRouteHandlerEffectProof?.artifact?.summary,
|
|
235
|
+
nodeLiveOriginRouteHandlerEffectProof: result.nodeLiveOriginRouteHandlerEffectProof?.artifact?.summary,
|
|
236
|
+
nodeCompiledRouteHandlerEffectBridge: result.nodeCompiledRouteHandlerEffectBridge?.artifact?.summary,
|
|
237
|
+
fastlyRouteHandlerEffectProof: result.fastlyRouteHandlerEffectProof?.artifact?.summary,
|
|
238
|
+
fastlyLifecycleParityProof: result.fastlyLifecycleParityProof?.artifact?.summary,
|
|
239
|
+
routeHandlerContextLoweringPlan: result.routeHandlerContextLoweringPlan?.artifact?.summary,
|
|
240
|
+
handlerIoLifecyclePlan: result.handlerIoLifecyclePlan?.artifact?.summary,
|
|
241
|
+
requestJsonBodyPlan: result.requestJsonBodyPlan?.artifact?.summary,
|
|
242
|
+
schemaDecodeResultPlan: result.schemaDecodeResultPlan?.artifact?.summary,
|
|
243
|
+
schemaResponseCodecPlan: result.schemaResponseCodecPlan?.artifact?.summary,
|
|
244
|
+
backendJsonRequestBodyPlan: result.backendJsonRequestBodyPlan?.artifact?.summary,
|
|
245
|
+
nodeBackendJsonRequestBodyProof: result.nodeBackendJsonRequestBodyProof?.artifact?.summary,
|
|
246
|
+
nodeRequestJsonBodyProof: result.nodeRequestJsonBodyProof?.artifact?.summary,
|
|
247
|
+
nodeSchemaDecodeResultProof: result.nodeSchemaDecodeResultProof?.artifact?.summary,
|
|
248
|
+
nodeSchemaResponseCodecProof: result.nodeSchemaResponseCodecProof?.artifact?.summary,
|
|
249
|
+
hostCapabilities: result.hostCapabilities?.artifact?.summary,
|
|
250
|
+
effectRuntime: result.effectRuntime?.artifact?.summary,
|
|
251
|
+
effectComposition: result.effectComposition?.artifact?.summary,
|
|
252
|
+
compiledHandlers: result.compiledHandlers?.artifact?.summary,
|
|
253
|
+
schemaJsonCompile: result.schemaJsonCompile?.artifact?.summary,
|
|
254
|
+
schemaJsonGenericParser: result.schemaJsonGenericParser?.artifact?.summary,
|
|
255
|
+
schemaJsonSidecar: result.schemaJsonSidecar?.artifact?.summary,
|
|
256
|
+
dispatchTs: dispatchTs.manifest ? dispatchTs.manifest.summary : undefined
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function createBuildManifest(options = {}) {
|
|
261
|
+
const cwd = options.cwd || process.cwd();
|
|
262
|
+
const outDir = options.outDir || getDefaultArtifactsDir(cwd);
|
|
263
|
+
const args = options.args || {};
|
|
264
|
+
const result = options.result;
|
|
265
|
+
const resolvedConfig = options.resolvedConfig;
|
|
266
|
+
const diagnostics = options.diagnostics || result?.diagnostics;
|
|
267
|
+
const status = options.status || diagnostics?.status || 'ok';
|
|
268
|
+
const artifactRecords = sortArtifacts(options.artifactRecords || []);
|
|
269
|
+
|
|
270
|
+
const entry = options.entry || args.entry || result?.summary?.entry || resolvedConfig?.entry;
|
|
271
|
+
const rootRouter = options.rootRouter || args.root || result?.summary?.rootRouter || resolvedConfig?.rootRouter;
|
|
272
|
+
const selectedProfile = resolvedConfig?.selectedProfile || args.profile;
|
|
273
|
+
const configSource = resolvedConfig?.artifact?.source || args.config;
|
|
274
|
+
|
|
275
|
+
return normalizeArtifact({
|
|
276
|
+
version: 'pulsewasm.build-manifest.v1',
|
|
277
|
+
generatedBy: PACKAGE_VERSION,
|
|
278
|
+
status,
|
|
279
|
+
command: args.command || 'build',
|
|
280
|
+
strict: args.strict !== false,
|
|
281
|
+
cwd: '.',
|
|
282
|
+
outDir: stableFileName(outDir, cwd),
|
|
283
|
+
config: configSource ? stableFileName(path.resolve(cwd, configSource), cwd) : undefined,
|
|
284
|
+
profile: selectedProfile,
|
|
285
|
+
entry: entry ? stableFileName(path.resolve(cwd, entry), cwd) : undefined,
|
|
286
|
+
rootRouter,
|
|
287
|
+
target: resolvedConfig?.target,
|
|
288
|
+
artifactCount: artifactRecords.length,
|
|
289
|
+
artifacts: artifactRecords,
|
|
290
|
+
artifactMap: artifactRecords.reduce((acc, artifact) => {
|
|
291
|
+
const key = artifact.file.replace(/\.json$/, '').replace(/-([a-z])/g, (_, ch) => ch.toUpperCase());
|
|
292
|
+
acc[key] = artifact.file;
|
|
293
|
+
return acc;
|
|
294
|
+
}, {}),
|
|
295
|
+
passes: diagnostics?.passes || result?.diagnostics?.passes || [],
|
|
296
|
+
diagnostics: diagnostics ? {
|
|
297
|
+
status: diagnostics.status,
|
|
298
|
+
counts: diagnostics.counts || countDiagnostics(diagnostics.diagnostics || [])
|
|
299
|
+
} : undefined,
|
|
300
|
+
summary: {
|
|
301
|
+
configOnly: Boolean(args.configOnly),
|
|
302
|
+
includeAst: Boolean(args.includeAst),
|
|
303
|
+
emitDispatchTs: Boolean(args.emitDispatchTs),
|
|
304
|
+
emitHandlerBindings: Boolean(args.emitHandlerBindings),
|
|
305
|
+
emitExecutionHarness: Boolean(args.emitExecutionHarness),
|
|
306
|
+
emitAssemblyScriptShape: Boolean(args.emitAssemblyScriptShape),
|
|
307
|
+
emitAssemblyScriptCore: Boolean(args.emitAssemblyScriptCore),
|
|
308
|
+
emitAssemblyScriptCompile: Boolean(args.emitAssemblyScriptCompile),
|
|
309
|
+
emitWasmSmoke: Boolean(args.emitWasmSmoke),
|
|
310
|
+
emitLocalHarness: Boolean(args.emitLocalHarness),
|
|
311
|
+
emitWasmHostAbi: Boolean(args.emitWasmHostAbi),
|
|
312
|
+
emitWasmHostBridge: Boolean(args.emitWasmHostBridge),
|
|
313
|
+
emitRequestResultHeaders: Boolean(args.emitRequestResultHeaders),
|
|
314
|
+
emitChannelBroadcaster: Boolean(args.emitChannelBroadcaster),
|
|
315
|
+
emitJsonBody: Boolean(args.emitJsonBody),
|
|
316
|
+
emitBackendCapabilities: Boolean(args.emitBackendCapabilities),
|
|
317
|
+
emitHostRuntimeKernel: Boolean(args.emitHostRuntimeKernel),
|
|
318
|
+
emitNodeAdapter: Boolean(args.emitNodeAdapter),
|
|
319
|
+
emitHandlerLibraryContracts: Boolean(args.emitHandlerLibraryContracts),
|
|
320
|
+
emitAssetsLoweringPlan: Boolean(args.emitAssetsLoweringPlan),
|
|
321
|
+
emitNodeAssetsProviderProof: Boolean(args.emitNodeAssetsProviderProof),
|
|
322
|
+
emitFastlyAssetsProviderProof: Boolean(args.emitFastlyAssetsProviderProof),
|
|
323
|
+
emitFastlyAssetsPackageOutParityProof: Boolean(args.emitFastlyAssetsPackageOutParityProof),
|
|
324
|
+
emitRouteHandlerEffectPlan: Boolean(args.emitRouteHandlerEffectPlan),
|
|
325
|
+
emitNodeRouteHandlerEffectProof: Boolean(args.emitNodeRouteHandlerEffectProof),
|
|
326
|
+
emitNodeLiveOriginRouteHandlerEffectProof: Boolean(args.emitNodeLiveOriginRouteHandlerEffectProof),
|
|
327
|
+
emitNodeCompiledRouteHandlerEffectBridge: Boolean(args.emitNodeCompiledRouteHandlerEffectBridge),
|
|
328
|
+
emitFastlyRouteHandlerEffectProof: Boolean(args.emitFastlyRouteHandlerEffectProof),
|
|
329
|
+
emitFastlyLifecycleParityProof: Boolean(args.emitFastlyLifecycleParityProof),
|
|
330
|
+
emitRouteHandlerContextLoweringPlan: Boolean(args.emitRouteHandlerContextLoweringPlan),
|
|
331
|
+
emitHandlerIoLifecyclePlan: Boolean(args.emitHandlerIoLifecyclePlan),
|
|
332
|
+
emitRequestJsonBodyPlan: Boolean(args.emitRequestJsonBodyPlan),
|
|
333
|
+
emitNodeRequestJsonBodyProof: Boolean(args.emitNodeRequestJsonBodyProof),
|
|
334
|
+
emitHostCapabilities: Boolean(args.emitHostCapabilities),
|
|
335
|
+
emitEffectRuntime: Boolean(args.emitEffectRuntime),
|
|
336
|
+
emitEffectComposition: Boolean(args.emitEffectComposition),
|
|
337
|
+
emitCompiledHandlers: Boolean(args.emitCompiledHandlers),
|
|
338
|
+
emitSchemaJsonCompile: Boolean(args.emitSchemaJsonCompile),
|
|
339
|
+
emitSchemaJsonGenericParser: Boolean(args.emitSchemaJsonGenericParser),
|
|
340
|
+
emitSchemaJsonSidecar: Boolean(args.emitSchemaJsonSidecar),
|
|
341
|
+
emitLibrarySidecars: Boolean(args.emitLibrarySidecars),
|
|
342
|
+
emitAssemblyScriptPathMatcher: Boolean(args.emitAssemblyScriptCore),
|
|
343
|
+
selectedProfile,
|
|
344
|
+
extraction: summarizeResult(result)
|
|
345
|
+
}
|
|
346
|
+
}, cwd);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
module.exports = {
|
|
350
|
+
createBuildManifest,
|
|
351
|
+
makeArtifactRecord,
|
|
352
|
+
sha256,
|
|
353
|
+
sortArtifacts
|
|
354
|
+
};
|