@scriptc/compiler 0.0.25 → 0.0.26

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.
Files changed (66) hide show
  1. package/ambient/scriptc-node-fallback.d.ts +15 -7
  2. package/dist/backend/cc.d.ts +3 -0
  3. package/dist/backend/cc.js +37 -4
  4. package/dist/backend/cc.js.map +1 -1
  5. package/dist/backend/emission/emit-exprs.js +81 -10
  6. package/dist/backend/emission/emit-exprs.js.map +1 -1
  7. package/dist/backend/emission/emitter.d.ts +14 -1
  8. package/dist/backend/emission/emitter.js +117 -11
  9. package/dist/backend/emission/emitter.js.map +1 -1
  10. package/dist/backend/emission/may-throw.js +11 -1
  11. package/dist/backend/emission/may-throw.js.map +1 -1
  12. package/dist/backend/ffi-callbacks.d.ts +11 -0
  13. package/dist/backend/ffi-callbacks.js +33 -0
  14. package/dist/backend/ffi-callbacks.js.map +1 -0
  15. package/dist/backend/llvm/classes.js +21 -21
  16. package/dist/backend/llvm/classes.js.map +1 -1
  17. package/dist/backend/llvm/dyn.d.ts +7 -4
  18. package/dist/backend/llvm/dyn.js +145 -141
  19. package/dist/backend/llvm/dyn.js.map +1 -1
  20. package/dist/backend/llvm/emitter.d.ts +7 -1
  21. package/dist/backend/llvm/emitter.js +950 -300
  22. package/dist/backend/llvm/emitter.js.map +1 -1
  23. package/dist/backend/llvm/shapes.d.ts +4 -0
  24. package/dist/backend/llvm/shapes.js +26 -24
  25. package/dist/backend/llvm/shapes.js.map +1 -1
  26. package/dist/backend/llvm/unsupported.js +1 -1
  27. package/dist/backend/llvm/unsupported.js.map +1 -1
  28. package/dist/backend/llvm/walkers.d.ts +2 -0
  29. package/dist/backend/llvm/walkers.js +50 -46
  30. package/dist/backend/llvm/walkers.js.map +1 -1
  31. package/dist/coverage/surface-manifest.js +1 -1
  32. package/dist/coverage/surface-manifest.js.map +1 -1
  33. package/dist/diagnostics/diagnostic.d.ts +1 -1
  34. package/dist/diagnostics/diagnostic.js +3 -2
  35. package/dist/diagnostics/diagnostic.js.map +1 -1
  36. package/dist/ffi/profile.d.ts +20 -2
  37. package/dist/ffi/profile.js +130 -6
  38. package/dist/ffi/profile.js.map +1 -1
  39. package/dist/frontend/lowering/lower-calls.js +58 -22
  40. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  41. package/dist/frontend/lowering/lower-exprs.js +17 -7
  42. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  43. package/dist/frontend/lowering/lower-server.d.ts +5 -0
  44. package/dist/frontend/lowering/lower-server.js +129 -37
  45. package/dist/frontend/lowering/lower-server.js.map +1 -1
  46. package/dist/frontend/lowering/lower-stmts.js +8 -1
  47. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  48. package/dist/frontend/lowering/surfaces.d.ts +3 -2
  49. package/dist/frontend/lowering/surfaces.js +4 -3
  50. package/dist/frontend/lowering/surfaces.js.map +1 -1
  51. package/dist/frontend/npm.d.ts +16 -0
  52. package/dist/frontend/npm.js +257 -0
  53. package/dist/frontend/npm.js.map +1 -1
  54. package/dist/index.d.ts +7 -4
  55. package/dist/index.js +152 -5
  56. package/dist/index.js.map +1 -1
  57. package/dist/ir/nodes.d.ts +48 -13
  58. package/dist/ir/nodes.js +49 -7
  59. package/dist/ir/nodes.js.map +1 -1
  60. package/dist/ir/validate.js +10 -22
  61. package/dist/ir/validate.js.map +1 -1
  62. package/dist/wasi-paths.d.ts +5 -0
  63. package/dist/wasi-paths.js +22 -0
  64. package/dist/wasi-paths.js.map +1 -0
  65. package/package.json +2 -2
  66. package/surface-manifest.json +2 -2
@@ -0,0 +1,5 @@
1
+ export type HostPathFlavor = "posix" | "win32";
2
+ /** Translate a host path into the namespace exposed by scriptc's WASI
3
+ * runner. The caller's working tree is guest `/`; the host temp directory
4
+ * is guest `/tmp`. Paths outside both capabilities have no guest spelling. */
5
+ export declare function wasiGuestPath(hostPath: string, cwd?: string, hostTmp?: string, flavor?: HostPathFlavor): string | null;
@@ -0,0 +1,22 @@
1
+ import { tmpdir } from "node:os";
2
+ import { posix, win32 } from "node:path";
3
+ /** Translate a host path into the namespace exposed by scriptc's WASI
4
+ * runner. The caller's working tree is guest `/`; the host temp directory
5
+ * is guest `/tmp`. Paths outside both capabilities have no guest spelling. */
6
+ export function wasiGuestPath(hostPath, cwd = process.cwd(), hostTmp = tmpdir(), flavor = process.platform === "win32" ? "win32" : "posix") {
7
+ const host = flavor === "win32" ? win32 : posix;
8
+ const absolute = host.resolve(hostPath);
9
+ const under = (hostRoot, guestRoot) => {
10
+ const relative = host.relative(host.resolve(hostRoot), absolute);
11
+ if (relative === "")
12
+ return guestRoot;
13
+ if (relative === ".." ||
14
+ relative.startsWith(`..${host.sep}`) ||
15
+ host.isAbsolute(relative)) {
16
+ return null;
17
+ }
18
+ return posix.join(guestRoot, relative.split(host.sep).join("/"));
19
+ };
20
+ return under(cwd, "/") ?? under(hostTmp, "/tmp");
21
+ }
22
+ //# sourceMappingURL=wasi-paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wasi-paths.js","sourceRoot":"","sources":["../src/wasi-paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAIzC;;8EAE8E;AAC9E,MAAM,UAAU,aAAa,CAC3B,QAAgB,EAChB,MAAc,OAAO,CAAC,GAAG,EAAE,EAC3B,UAAkB,MAAM,EAAE,EAC1B,SAAyB,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO;IAEzE,MAAM,IAAI,GAAG,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IAChD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAExC,MAAM,KAAK,GAAG,CAAC,QAAgB,EAAE,SAAiB,EAAiB,EAAE;QACnE,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC;QACjE,IAAI,QAAQ,KAAK,EAAE;YAAE,OAAO,SAAS,CAAC;QACtC,IACE,QAAQ,KAAK,IAAI;YACjB,QAAQ,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC,GAAG,EAAE,CAAC;YACpC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EACzB,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACnE,CAAC,CAAC;IAEF,OAAO,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACnD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scriptc/compiler",
3
- "version": "0.0.25",
3
+ "version": "0.0.26",
4
4
  "description": "The scriptc compiler — TypeScript/JavaScript frontend, typed IR, LLVM and C backends",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://scriptc.dev",
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  "typescript": "7.0.2",
32
32
  "typescript5": "npm:typescript@5.9.3",
33
- "@scriptc/runtime": "0.0.25"
33
+ "@scriptc/runtime": "0.0.26"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "node node_modules/typescript5/bin/tsc -p tsconfig.json"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "compilerVersion": "0.0.25",
3
+ "compilerVersion": "0.0.26",
4
4
  "coverage": [
5
5
  "Entries are projected mechanically from the compiler's own decision tables: the diagnostics registry, the unsupported-syntax dispatch tables, the stdlib and node-builtin lowering tables, and the supported-builtin-module list. Nothing is hand-maintained; the manifest regenerates byte-identically from the source tree at this version.",
6
6
  "Absence from this manifest means 'not projected', never 'unsupported'. Surfaces lowered through dedicated code paths rather than tables are not yet projected: console, JSON, Promise/async and the timer surface, the net/http/tls/https/dgram/dns/assert/test/stream/readline module member surfaces, template literals, the regex slice, global functions (parseInt, parseFloat, isNaN, isFinite), and the process surface outside its ambient slice.",
@@ -10,7 +10,7 @@
10
10
  "Entries with status 'dynamic-only' compile when the build embeds the dynamic engine (--dynamic); without the flag each use site is refused with the entry's code.",
11
11
  "The engine-free fetch projection targets Node 24.15.0 with bundled Undici 7.24.4. Each projected row names the differential evidence that guards it; changing the pinned Node or Undici version is an explicit profile update.",
12
12
  "The fetch profile also contains a runtime-reflected census of the selected fetch, abort, Headers, and readable-stream interfaces plus RequestInit/ResponseInit dictionary reads. Static, dynamic-only, and unsupported census rows are projected here; its explicitly out-of-scope metadata rows and adjacent-interface exclusions remain in the profile so absence is deliberate rather than ambiguous.",
13
- "Process-level diagnostic codes are not surface entries: SC0001-SC0004 are preflight gates, SC1110 is a comptime evaluation failure, SC3001 is the alternate-backend tier refusal, SC9001/SC9002 are internal errors.",
13
+ "Process-level diagnostic codes are not surface entries: SC0001-SC0004 are preflight gates, SC1110 is a comptime evaluation failure, SC3001/SC3002 are backend/target tier refusals, SC9001/SC9002 are internal errors.",
14
14
  "No scheduling metadata is published; entry ids are the stable diff keys across releases."
15
15
  ],
16
16
  "entries": [