@skathi-native/cli 0.1.0-beta.4 → 0.3.0

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 (63) hide show
  1. package/aot/host-globals.json +1 -1
  2. package/aot/pin.ts +1 -1
  3. package/aot/toolchain.lock.json +5 -5
  4. package/aot/transform.ts +9 -1
  5. package/aot-inputs.ts +21 -2
  6. package/build.ts +284 -64
  7. package/check/builtins.json +11 -11
  8. package/check/bundle.ts +265 -0
  9. package/check/codes.ts +46 -0
  10. package/check/css-catalog.json +451 -0
  11. package/check/css.ts +512 -0
  12. package/check/finding.ts +63 -1
  13. package/check/graph.ts +14 -1
  14. package/check/index.ts +30 -49
  15. package/check/program.ts +26 -6
  16. package/cli/aot-build.ts +2 -6
  17. package/cli/build-app.ts +19 -0
  18. package/cli/create.ts +70 -12
  19. package/cli/dev.ts +11 -6
  20. package/cli/effects.ts +39 -18
  21. package/cli/gallery.ts +106 -0
  22. package/cli/sk.ts +5 -2
  23. package/devtools/commands.ts +26 -1
  24. package/devtools/ctl.ts +4 -3
  25. package/effects/compile.ts +160 -31
  26. package/effects/sk.slang +359 -30
  27. package/gallery.json +1 -0
  28. package/package.json +9 -5
  29. package/prod.ts +78 -10
  30. package/svelte.ts +76 -0
  31. package/templates/icon.png +0 -0
  32. package/templates/showcase/assets/textures/golden.png +0 -0
  33. package/templates/showcase/assets/textures/hammered.png +0 -0
  34. package/templates/showcase/assets/textures/noir.png +0 -0
  35. package/templates/showcase/assets/textures/reeded.png +0 -0
  36. package/templates/showcase/assets/textures/teal-orange.png +0 -0
  37. package/templates/showcase/shaders/dissolve.slang +40 -0
  38. package/templates/showcase/shaders/fireflies.slang +58 -0
  39. package/templates/showcase/shaders/glass.slang +31 -0
  40. package/templates/showcase/shaders/grade.slang +34 -0
  41. package/templates/showcase/shaders/halftone.slang +42 -0
  42. package/templates/showcase/shaders/lens.slang +51 -0
  43. package/templates/showcase/shaders/nebula.slang +57 -0
  44. package/templates/showcase/shaders/orbit.slang +52 -0
  45. package/templates/showcase/shaders/pond.slang +76 -0
  46. package/templates/showcase/shaders/ripples.slang +71 -0
  47. package/templates/showcase/shaders/shatter.slang +116 -0
  48. package/templates/showcase/shaders/snow.slang +57 -0
  49. package/templates/showcase/shaders/spotlight.slang +52 -0
  50. package/templates/showcase/src/App.vue +11 -16
  51. package/templates/showcase/src/components/FullWindow.vue +77 -0
  52. package/templates/showcase/src/components/Page.vue +2 -0
  53. package/templates/showcase/src/fullwindow.ts +36 -0
  54. package/templates/showcase/src/icons.ts +2 -0
  55. package/templates/showcase/src/pages/GraphicsPage.vue +122 -0
  56. package/templates/showcase/src/pages/MotionPage.vue +71 -1
  57. package/templates/showcase/src/pages/ShadersPage.vue +443 -0
  58. package/templates/showcase/src/router.ts +32 -1
  59. package/templates/svelte/.vscode/settings.json +3 -0
  60. package/templates/svelte/assets/hello.txt +1 -0
  61. package/templates/svelte/src/App.svelte +142 -0
  62. package/templates/svelte/src/main.ts +4 -0
  63. package/vitecompat.ts +2 -0
@@ -1,5 +1,5 @@
1
1
  {
2
- "table": "4750b3540882158b35c1f7cc946edc1acb18561345bc70f9151fb913e59268b8",
2
+ "table": "a9db25bde548594d86b2439e8dfd11335a87004ee374a31e2d1a557c40543886",
3
3
  "names": [
4
4
  "$vm",
5
5
  "AbortController",
package/aot/pin.ts CHANGED
@@ -45,7 +45,7 @@ export function pinnedCompilerInfo(pin: ToolchainPin): CompilerInfo {
45
45
  frontend: pin.frontend.revision,
46
46
  engine: pin.engine.revision,
47
47
  tableId: pin.table.id,
48
- compileOptions: `x86_64;references=narrow;image=pic;threads=1;admit=FilesRunByHost;default-options@${pin.engine.revision}`,
48
+ compileOptions: `x86_64;references=narrow;image=pic;threads=1;default-options@${pin.engine.revision}`,
49
49
  };
50
50
  }
51
51
 
@@ -3,15 +3,15 @@
3
3
  "version": 1,
4
4
  "target": "x86_64-windows",
5
5
  "frontend": {
6
- "revision": "7ca0042d3ba23ed60fd9cd8af1a1ce6ec3f8d074",
6
+ "revision": "237bba51e98a8b3d5b62d2d6c33853c2e83820a7",
7
7
  "sourceRepository": "https://github.com/oven-sh/bun.git"
8
8
  },
9
9
  "engine": {
10
- "revision": "4d45755fed4aeef19e95beb90d3d0c884a2812bd",
11
- "archiveSha256": "fd79937b7f8becd5c0961646cd7f8af4409122e9cf710ffd766dc0c89df1f619"
10
+ "revision": "3bc94211496460feda299ef85eef710eb67fafb3",
11
+ "archiveSha256": "837f06ecd569791d4497ea7e8703f636fac5a1869ca5ee7c5f49b4c4eaa40e3d"
12
12
  },
13
13
  "table": {
14
- "id": "4750b3540882158b35c1f7cc946edc1acb18561345bc70f9151fb913e59268b8",
15
- "dumpSha256": "afac4f15bc41518c037d80965fed1c53edd36b96837602cab40660b3a0f5beb2"
14
+ "id": "a9db25bde548594d86b2439e8dfd11335a87004ee374a31e2d1a557c40543886",
15
+ "dumpSha256": "b379cd1e35c090880b6b4ae4fdbdab9b1566a06c829e3e9d6824ac7aaa11cdc7"
16
16
  }
17
17
  }
package/aot/transform.ts CHANGED
@@ -64,6 +64,14 @@ export function opaqueGlobals(tableGlobals: readonly string[] = HOST_TABLE.names
64
64
  return [...new Set([...tableGlobals, ...BROWSER_GLOBALS])].sort();
65
65
  }
66
66
 
67
+ /** A builtin global stays read-only unless the image spells out an assignment to it; writes through
68
+ * `__sk_host` (the runtime wraps setTimeout and WebSocket) are not spelled out, so this dead branch is. */
69
+ function openHostGlobals(names: readonly string[]): string {
70
+ const host = new Set(HOST_TABLE.names);
71
+ const opened = names.filter((name) => host.has(name));
72
+ return `if (__SK_AOT_HOST__ === undefined) {\n${opened.map((name) => `globalThis.${name} = undefined;`).join("\n")}\n}\n`;
73
+ }
74
+
67
75
  export function opaqueHost(source: string, names: readonly string[] = opaqueGlobals()): string {
68
- return `// ${TRANSFORM}: stable host API references are opaque inputs.\n(function(__sk_host) {\nconst globalThis = __sk_host;\nconst {${names.join(",")}} = __sk_host;\n${source}\n})(__SK_AOT_HOST__);\n`;
76
+ return `// ${TRANSFORM}: stable host API references are opaque inputs.\n${openHostGlobals(names)}(function(__sk_host) {\nconst globalThis = __sk_host;\nconst {${names.join(",")}} = __sk_host;\n${source}\n})(__SK_AOT_HOST__);\n`;
69
77
  }
package/aot-inputs.ts CHANGED
@@ -6,7 +6,8 @@ import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
6
6
  import type ts from "typescript";
7
7
 
8
8
  type TypeScript = typeof ts;
9
- type InputKind = "source" | "vue" | "vue-module" | "vue-script" | "transformed-module" | "config";
9
+ type InputKind =
10
+ "source" | "vue" | "vue-module" | "vue-script" | "svelte" | "svelte-module" | "transformed-module" | "config";
10
11
  interface Input {
11
12
  path: string;
12
13
  kind: InputKind;
@@ -116,6 +117,21 @@ export class AotInputs {
116
117
  }
117
118
  }
118
119
 
120
+ /**
121
+ * A Svelte component, or a `.svelte.ts`/`.svelte.js` rune module, and the JS the compiler made of it. The
122
+ * compiler keeps no types, so a rune module's typed source stays the program's view of it.
123
+ */
124
+ svelte(path: string, original: string, compiled: string): void {
125
+ this.add(path, compiled, "svelte-module", "js");
126
+ if (/\.svelte$/i.test(path)) {
127
+ this.add(path, original, "svelte");
128
+ this.addVirtual(`${resolve(path)}.js`, compiled);
129
+ return;
130
+ }
131
+ this.add(path, original, "source");
132
+ this.modules.set(this.key(path), { path: resolve(path), text: original });
133
+ }
134
+
119
135
  private collectTypes(): { version: string; config: string | null; diagnostics: { code: number; message: string }[] } {
120
136
  const { typescript, appRoot, entry, aliases, declarations = [] } = this.options;
121
137
  const read = (path: string): string | undefined => {
@@ -178,6 +194,9 @@ export class AotInputs {
178
194
  (specifier.endsWith(".vue")
179
195
  ? typescript.resolveModuleName(`${specifier}.ts`, importer, options, host).resolvedModule
180
196
  : undefined) ??
197
+ (specifier.endsWith(".svelte")
198
+ ? typescript.resolveModuleName(`${specifier}.js`, importer, options, host).resolvedModule
199
+ : undefined) ??
181
200
  (alias ? typescript.resolveModuleName(specifier, alias, options, host).resolvedModule : undefined) ??
182
201
  (alias
183
202
  ? {
@@ -282,7 +301,7 @@ export class AotInputs {
282
301
  limitations: [
283
302
  "Source archive, not a native AOT image; no host ABI or builtin-effect descriptors are inferred from declarations.",
284
303
  "Original paths are app-root-relative or use a named source-root anchor; blob names are content hashes. An AOT frontend needs a resolver that maps these paths to blobs.",
285
- "Vue modules and TS/JS source rewrites are retained before Bun transpilation. Bun-generated asset/query/HTML modules, CSS installation and module linking still require a frontend adapter.",
304
+ "Vue and Svelte modules and TS/JS source rewrites are retained before Bun transpilation. Bun-generated asset/query/HTML modules, CSS installation and module linking still require a frontend adapter.",
286
305
  "TypeScript file-module resolution is recorded in addition to Bun's runtime graph; unresolvedImports also includes ambient module names that have no file mapping. A frontend adapter must handle them. This archive does not assert type-checking or AOT compatibility.",
287
306
  ],
288
307
  };