@pulse-compute/wasm-compiler 1.0.0-beta.6 → 1.0.0-beta.7

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 CHANGED
@@ -8,9 +8,9 @@
8
8
  > **Stability:** Internal compiler interface; no application-author compatibility guarantee.<br>
9
9
  > **npm:** [`@pulse-compute/wasm-compiler`](https://www.npmjs.com/package/@pulse-compute/wasm-compiler)<br>
10
10
  > **Canonical replacement:** `@pulse-compute/cli`<br>
11
- > **Canonical documentation:** [Package guide](https://pulsecompute.io/v1.0.0-beta.6/packages/implementation-packages/)
11
+ > **Canonical documentation:** [Package guide](https://pulsecompute.io/v1.0.0-beta.7/packages/implementation-packages/)
12
12
  >
13
- > This release-status block is generated from the synchronized `Pulse 1.0.0-beta.6` package policy.
13
+ > This release-status block is generated from the synchronized `Pulse 1.0.0-beta.7` package policy.
14
14
  <!-- pulse-package-status:end -->
15
15
 
16
16
  Whole-project compiler implementation used by the `pulse` workflow. Application projects should use `@pulse-compute/cli`, not import this package directly.
@@ -63,4 +63,4 @@ The package exports its root implementation plus focused compiler, CLI, extracto
63
63
 
64
64
  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.
65
65
 
66
- See the installed [implementation package guide](https://pulsecompute.io/v1.0.0-beta.6/packages/implementation-packages/) and [compilation concepts](https://pulsecompute.io/v1.0.0-beta.6/concepts/compilation-and-lowering/).
66
+ See the installed [implementation package guide](https://pulsecompute.io/v1.0.0-beta.7/packages/implementation-packages/) and [compilation concepts](https://pulsecompute.io/v1.0.0-beta.7/concepts/compilation-and-lowering/).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pulse-compute/wasm-compiler",
3
- "version": "1.0.0-beta.6",
3
+ "version": "1.0.0-beta.7",
4
4
  "license": "Apache-2.0",
5
5
  "description": "PulseWasm compiler package inside the Pulse monorepo.",
6
6
  "type": "commonjs",
@@ -9,13 +9,13 @@
9
9
  "pulsewasm": "./bin/pulsewasm-extract.js"
10
10
  },
11
11
  "dependencies": {
12
- "@pulse-compute/wasm-build-support": "1.0.0-beta.6",
13
- "@pulse-compute/wasm-contracts": "1.0.0-beta.6",
14
- "@pulse-compute/wasm-guest-link": "1.0.0-beta.6",
15
- "@pulse-compute/wasm-host-runtime": "1.0.0-beta.6",
16
- "@pulse-compute/wasm-library-kit": "1.0.0-beta.6",
17
- "@pulse-compute/wasm-runtime-core-as": "1.0.0-beta.6",
18
- "@pulse-compute/wasm-schema-json": "1.0.0-beta.6",
12
+ "@pulse-compute/wasm-build-support": "1.0.0-beta.7",
13
+ "@pulse-compute/wasm-contracts": "1.0.0-beta.7",
14
+ "@pulse-compute/wasm-guest-link": "1.0.0-beta.7",
15
+ "@pulse-compute/wasm-host-runtime": "1.0.0-beta.7",
16
+ "@pulse-compute/wasm-library-kit": "1.0.0-beta.7",
17
+ "@pulse-compute/wasm-runtime-core-as": "1.0.0-beta.7",
18
+ "@pulse-compute/wasm-schema-json": "1.0.0-beta.7",
19
19
  "assemblyscript": "0.28.18",
20
20
  "json-as": "1.5.0",
21
21
  "typescript": "5.9.3"
@@ -56,7 +56,7 @@
56
56
  "url": "git+https://github.com/pulse-compute/pulse.git",
57
57
  "directory": "wasm/packages/compiler"
58
58
  },
59
- "homepage": "https://pulsecompute.io/v1.0.0-beta.6/packages/implementation-packages/",
59
+ "homepage": "https://pulsecompute.io/v1.0.0-beta.7/packages/implementation-packages/",
60
60
  "bugs": {
61
61
  "url": "https://github.com/pulse-compute/pulse/issues"
62
62
  },
@@ -24,6 +24,7 @@ const eventContract = require('@pulse-compute/wasm-contracts/events');
24
24
  const { resolveAsc } = require('@pulse-compute/wasm-build-support/assemblyscript-compile');
25
25
  const { memoryAbi } = require('@pulse-compute/wasm-guest-link');
26
26
  const {
27
+ prepareReportCapture,
27
28
  appendAssemblyScriptOptimizationArgs,
28
29
  resolveNativeOptimization
29
30
  } = require('@pulse-compute/wasm-build-support/native-optimization');
@@ -220,6 +221,8 @@ function realizeCanonicalNativePlan(plan, options = {}, providerRequirements) {
220
221
  '--path', jsonAs.dependencyRoot
221
222
  );
222
223
  }
224
+ const readReportCapture = options.reportCapture === false ? () => null : prepareReportCapture(args, stagingDir, generated.manifest,
225
+ require(path.join(asc.packageRoot, 'package.json')).version, 'canonical-native.as/');
223
226
  const startedAt = Date.now();
224
227
  const result = spawnSync(asc.executable, args, {
225
228
  cwd: stagingDir,
@@ -242,13 +245,15 @@ function realizeCanonicalNativePlan(plan, options = {}, providerRequirements) {
242
245
  durationMs
243
246
  });
244
247
  }
248
+ const wasm = fs.readFileSync(wasmFile);
245
249
  return Object.freeze({
246
250
  plan,
247
251
  validation,
248
252
  realizationArtifacts,
249
253
  guestUnits,
250
254
  generated,
251
- wasm: fs.readFileSync(wasmFile),
255
+ reportAttribution: readReportCapture(wasm),
256
+ wasm,
252
257
  wat: emitWat ? fs.readFileSync(watFile, 'utf8') : '',
253
258
  textEmitted: emitWat,
254
259
  assemblyScriptVersion: require(path.join(asc.packageRoot, 'package.json')).version,
@@ -305,6 +310,7 @@ function verifyCanonicalNativeRealization(realization) {
305
310
  compilerVersion: runtimeContract.CANONICAL_NATIVE_COMPILER_VERSION,
306
311
  plan: realization.plan,
307
312
  validation: realization.validation,
313
+ reportAttribution: realization.reportAttribution && realization.reportAttribution.artifactSha256 === sha256(realization.wasm) ? realization.reportAttribution : null,
308
314
  generated: realization.generated,
309
315
  source: realization.generated.source,
310
316
  sourceHash: realization.generated.sourceHash,
@@ -1043,6 +1043,7 @@ function compileCanonicalProjectLegacy(entryFile, options = {}) {
1043
1043
  try {
1044
1044
  managedHandlers = compileManagedHandlerDescriptors({
1045
1045
  graphBuild,
1046
+ target: options.target,
1046
1047
  descriptors: packageOperationRecognition.managedHandlers,
1047
1048
  packageOperationRecognition
1048
1049
  });
@@ -815,7 +815,7 @@ function effectPlanForHandler(options) {
815
815
  });
816
816
  }
817
817
 
818
- function compileHandler(resolved, graphBuild, allResolved, diagnostics, packageRecognition) {
818
+ function compileHandler(resolved, graphBuild, allResolved, diagnostics, packageRecognition, options = {}) {
819
819
  const descriptor = resolved.descriptor;
820
820
  const sourceFile = resolved.sourceModule.sourceFile;
821
821
  const original = resolved.functionNode;
@@ -868,10 +868,18 @@ function compileHandler(resolved, graphBuild, allResolved, diagnostics, packageR
868
868
  frontend: 'canonical-source',
869
869
  role: MANAGED_HANDLER_ROLE,
870
870
  strict: true,
871
- requireEffectAwait: false,
871
+ requireEffectAwait: options.target === 'javascript',
872
+ target: options.target,
872
873
  packageEffectForCall
873
874
  });
874
875
  diagnostics.push(...normalizer.diagnostics);
876
+ // JavaScript executes the original source graph. Native expression admission
877
+ // is independent, and cannot prevent inspection of that explicit target.
878
+ const nativeDiagnostics = options.target === 'javascript' ? [] : diagnostics;
879
+ if (options.target === 'javascript') nativeDiagnostics.push(...normalizeManagedHandler(original, {
880
+ sourceFile, ctxName, frontend: 'canonical-source', role: MANAGED_HANDLER_ROLE,
881
+ strict: true, requireEffectAwait: false, packageEffectForCall
882
+ }).diagnostics);
875
883
  const handler = normalizer.functionNode;
876
884
 
877
885
  const schemaReferences = Object.freeze([
@@ -896,6 +904,7 @@ function compileHandler(resolved, graphBuild, allResolved, diagnostics, packageR
896
904
  })
897
905
  };
898
906
  const rawOperationIr = buildPlainHandlerIr(frontend, {
907
+ target: options.target,
899
908
  packageEffects: packageInputs.effects,
900
909
  packageIntrinsics: packageInputs.intrinsics,
901
910
  packageResultAdapters: packageInputs.resultAdapters,
@@ -916,7 +925,7 @@ function compileHandler(resolved, graphBuild, allResolved, diagnostics, packageR
916
925
  const compileExpression = createExpressionCompiler({
917
926
  sourceFile,
918
927
  descriptor,
919
- diagnostics,
928
+ diagnostics: nativeDiagnostics,
920
929
  ctxName,
921
930
  inputName,
922
931
  handlerTargets,
@@ -938,7 +947,7 @@ function compileHandler(resolved, graphBuild, allResolved, diagnostics, packageR
938
947
  ]);
939
948
 
940
949
  function fail(node, code, message, detail = {}) {
941
- diagnostics.push(diagnostic({ descriptor, sourceFile, node, code, message, detail }));
950
+ nativeDiagnostics.push(diagnostic({ descriptor, sourceFile, node, code, message, detail }));
942
951
  }
943
952
 
944
953
  function registerEffectRuntimeInputs(site, candidate, scope) {
@@ -1377,6 +1386,9 @@ function compileHandler(resolved, graphBuild, allResolved, diagnostics, packageR
1377
1386
  packageEffects: packageInputs.effects,
1378
1387
  packageLowering: packageInputs.lowering
1379
1388
  });
1389
+ if (options.target === 'javascript') diagnostics.push(...nativeDiagnostics.filter(entry => [
1390
+ 'PULSE_MANAGED_HANDLER_RECURSION_UNSUPPORTED', 'PULSE_MANAGED_HANDLER_DIRECT_CALL_UNSUPPORTED'
1391
+ ].includes(entry.code)));
1380
1392
  const semantic = {
1381
1393
  version: managedHandlerIrVersion,
1382
1394
  kind: 'managed-handler',
@@ -1408,7 +1420,8 @@ function compileHandler(resolved, graphBuild, allResolved, diagnostics, packageR
1408
1420
  inspected: true,
1409
1421
  packageTargetPromotion: false,
1410
1422
  javascript: Object.freeze({ eligible: true, blockers: Object.freeze([]) }),
1411
- native: Object.freeze({ eligible: true, blockers: Object.freeze([]) })
1423
+ native: Object.freeze({ eligible: options.target !== 'javascript' || nativeDiagnostics.length === 0,
1424
+ blockers: Object.freeze(options.target === 'javascript' ? sortedUnique(nativeDiagnostics.map(entry => entry.code)) : []) })
1412
1425
  })
1413
1426
  };
1414
1427
  const record = deepFreeze({ ...semantic, handlerHash: sha256Hex(stableStringify(semantic)) });
@@ -1465,7 +1478,7 @@ function compileManagedHandlerDescriptors(inputs = {}) {
1465
1478
  const resolved = resolveDescriptors(inputs.graphBuild, descriptors, diagnostics);
1466
1479
  const handlers = [];
1467
1480
  for (const entry of resolved) {
1468
- const handler = compileHandler(entry, inputs.graphBuild, resolved, diagnostics, packageRecognition);
1481
+ const handler = compileHandler(entry, inputs.graphBuild, resolved, diagnostics, packageRecognition, { target: inputs.target });
1469
1482
  if (handler) handlers.push(handler);
1470
1483
  }
1471
1484
  if (diagnostics.length > 0) {