@hewel/zgui-build 0.0.0-stage → 0.1.2

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 (45) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +95 -0
  3. package/README.md +86 -2
  4. package/THIRD_PARTY_NOTICES.md +37 -0
  5. package/package.json +64 -4
  6. package/sdk/Cargo.lock +6814 -0
  7. package/sdk/LICENSE +202 -0
  8. package/sdk/NOTICE +95 -0
  9. package/sdk/THIRD_PARTY_NOTICES.md +37 -0
  10. package/sdk/bun.lock +539 -0
  11. package/sdk/package.json +60 -0
  12. package/sdk/preview/fixtures/empty.json +6 -0
  13. package/sdk/preview/fonts/NotoSans-LICENSE.txt +94 -0
  14. package/sdk/preview/fonts/NotoSans-Regular.ttf +0 -0
  15. package/sdk/preview/fonts/NotoSansCJK-LICENSE.txt +92 -0
  16. package/sdk/preview/fonts/NotoSansCJKsc-Regular.otf +0 -0
  17. package/sdk/preview/fonts/PROVENANCE.md +25 -0
  18. package/sdk/preview/fonts/fonts.json +60 -0
  19. package/sdk/preview/profiles/default.json +32 -0
  20. package/sdk/preview/scenarios/counter-capture.json +9 -0
  21. package/sdk/smoke/solid-smoke.ts +53 -0
  22. package/sdk/smoke/tsconfig.smoke.json +21 -0
  23. package/src/application.ts +70 -0
  24. package/src/build.ts +1097 -0
  25. package/src/check-smoke.ts +8 -0
  26. package/src/compiler.ts +701 -0
  27. package/src/css.ts +337 -0
  28. package/src/dev.ts +164 -0
  29. package/src/host.ts +578 -0
  30. package/src/identity.ts +60 -0
  31. package/src/index.ts +27 -0
  32. package/src/internal.ts +20 -0
  33. package/src/native-process.ts +178 -0
  34. package/src/package-app.ts +178 -0
  35. package/src/preview-check.ts +267 -0
  36. package/src/preview.ts +69 -0
  37. package/src/public-api.d.ts +265 -0
  38. package/src/publication.ts +108 -0
  39. package/src/sdk-packages.ts +376 -0
  40. package/src/sdk.ts +11 -0
  41. package/src/smoke.ts +99 -0
  42. package/src/sync-ui-resources.ts +171 -0
  43. package/src/typecheck.ts +177 -0
  44. package/src/validate.ts +1085 -0
  45. package/src/watch.ts +531 -0
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "zgui-js",
3
+ "version": "0.1.2",
4
+ "license": "Apache-2.0",
5
+ "private": true,
6
+ "type": "module",
7
+ "packageManager": "bun@1.4.4",
8
+ "workspaces": [
9
+ "packages/build",
10
+ "packages/cli",
11
+ "packages/create-zgui-js",
12
+ "packages/host-linux-x64",
13
+ "packages/host-linux-arm64",
14
+ "packages/ui",
15
+ "packages/services",
16
+ "apps/devtools/*",
17
+ "apps/examples/*"
18
+ ],
19
+ "engines": {
20
+ "bun": ">=1.4.4"
21
+ },
22
+ "scripts": {
23
+ "prepare": "bun tools/build-packages.ts --quiet",
24
+ "build:packages": "bun tools/build-packages.ts",
25
+ "release:check": "bun tools/release.ts check",
26
+ "release:version": "bun tools/release.ts version",
27
+ "release:pack": "bun tools/release.ts pack",
28
+ "release:publish": "bun tools/release.ts publish",
29
+ "fmt": "bun --bun run oxfmt",
30
+ "fmt:check": "bun --bun run oxfmt --check",
31
+ "lint": "bun --bun run oxlint --deny-warnings",
32
+ "typecheck": "bun packages/build/src/typecheck.ts",
33
+ "typecheck:smoke": "bun --bun run tsrs --project packages/build/tsconfig.smoke.json",
34
+ "test:build": "bun test --parallel --timeout=30000 tests/build/*.test.mjs",
35
+ "test:rust": "bun tools/run-bounded.mjs --build cargo test -j 4 --workspace --offline --no-run && bun tools/run-bounded.mjs --test cargo test -j 4 --workspace --offline && bun tools/run-bounded.mjs --build cargo clippy -j 4 --workspace --all-targets --offline -- -D warnings",
36
+ "test:vendor": "bun tools/test-vendor.mjs",
37
+ "hooks:install": "git config core.hooksPath .githooks",
38
+ "build": "bun packages/cli/src/cli.ts build",
39
+ "dev": "bun packages/cli/src/cli.ts dev",
40
+ "preview": "bun packages/cli/src/cli.ts preview",
41
+ "package": "bun packages/cli/src/cli.ts package",
42
+ "doctor": "bun packages/cli/src/cli.ts doctor",
43
+ "inspect": "bun packages/cli/src/cli.ts inspect",
44
+ "preview:check": "bun packages/build/src/preview-check.ts",
45
+ "test:preview": "bun run build --app counter && cargo build -j 4 -p zgui-host --locked --offline && bun test --isolate --timeout=30000 tests/preview/*.test.mjs",
46
+ "test:preview:ci": "bun run build --app counter && cargo build -j 4 -p zgui-host --locked --offline && ZGUI_CI_SKIP_HARDWARE_BASELINE=1 bun test --isolate --timeout=30000 tests/preview/*.test.mjs",
47
+ "smoke": "bun packages/cli/src/cli.ts smoke && bun packages/build/src/check-smoke.ts",
48
+ "check": "bun run fmt:check && bun run lint && bun run typecheck && bun run test:build && bun run test:rust && bun run test:vendor"
49
+ },
50
+ "devDependencies": {
51
+ "@hewel/zgui": "workspace:*",
52
+ "@hewel/zgui-build": "workspace:*",
53
+ "@hewel/zgui-services": "workspace:*",
54
+ "oxfmt": "0.79.0",
55
+ "oxlint": "1.94.0",
56
+ "solid-js": "2.0.1",
57
+ "tsrs": "7.1.0-beta.tsrs2",
58
+ "typescript": "7.0.2"
59
+ }
60
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "id": "empty",
4
+ "services": {},
5
+ "events": []
6
+ }
@@ -0,0 +1,94 @@
1
+ Copyright 2018 The Noto Project Authors (github.com/googlei18n/noto-fonts)
2
+
3
+ This Font Software is licensed under the SIL Open Font License,
4
+ Version 1.1.
5
+
6
+ This license is copied below, and is also available with a FAQ at:
7
+ http://scripts.sil.org/OFL
8
+
9
+ -----------------------------------------------------------
10
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
11
+ -----------------------------------------------------------
12
+
13
+ PREAMBLE
14
+ The goals of the Open Font License (OFL) are to stimulate worldwide
15
+ development of collaborative font projects, to support the font
16
+ creation efforts of academic and linguistic communities, and to
17
+ provide a free and open framework in which fonts may be shared and
18
+ improved in partnership with others.
19
+
20
+ The OFL allows the licensed fonts to be used, studied, modified and
21
+ redistributed freely as long as they are not sold by themselves. The
22
+ fonts, including any derivative works, can be bundled, embedded,
23
+ redistributed and/or sold with any software provided that any reserved
24
+ names are not used by derivative works. The fonts and derivatives,
25
+ however, cannot be released under any other type of license. The
26
+ requirement for fonts to remain under this license does not apply to
27
+ any document created using the fonts or their derivatives.
28
+
29
+ DEFINITIONS
30
+ "Font Software" refers to the set of files released by the Copyright
31
+ Holder(s) under this license and clearly marked as such. This may
32
+ include source files, build scripts and documentation.
33
+
34
+ "Reserved Font Name" refers to any names specified as such after the
35
+ copyright statement(s).
36
+
37
+ "Original Version" refers to the collection of Font Software
38
+ components as distributed by the Copyright Holder(s).
39
+
40
+ "Modified Version" refers to any derivative made by adding to,
41
+ deleting, or substituting -- in part or in whole -- any of the
42
+ components of the Original Version, by changing formats or by porting
43
+ the Font Software to a new environment.
44
+
45
+ "Author" refers to any designer, engineer, programmer, technical
46
+ writer or other person who contributed to the Font Software.
47
+
48
+ PERMISSION & CONDITIONS
49
+ Permission is hereby granted, free of charge, to any person obtaining
50
+ a copy of the Font Software, to use, study, copy, merge, embed,
51
+ modify, redistribute, and sell modified and unmodified copies of the
52
+ Font Software, subject to the following conditions:
53
+
54
+ 1) Neither the Font Software nor any of its individual components, in
55
+ Original or Modified Versions, may be sold by itself.
56
+
57
+ 2) Original or Modified Versions of the Font Software may be bundled,
58
+ redistributed and/or sold with any software, provided that each copy
59
+ contains the above copyright notice and this license. These can be
60
+ included either as stand-alone text files, human-readable headers or
61
+ in the appropriate machine-readable metadata fields within text or
62
+ binary files as long as those fields can be easily viewed by the user.
63
+
64
+ 3) No Modified Version of the Font Software may use the Reserved Font
65
+ Name(s) unless explicit written permission is granted by the
66
+ corresponding Copyright Holder. This restriction only applies to the
67
+ primary font name as presented to the users.
68
+
69
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
70
+ Software shall not be used to promote, endorse or advertise any
71
+ Modified Version, except to acknowledge the contribution(s) of the
72
+ Copyright Holder(s) and the Author(s) or with their explicit written
73
+ permission.
74
+
75
+ 5) The Font Software, modified or unmodified, in part or in whole,
76
+ must be distributed entirely under this license, and must not be
77
+ distributed under any other license. The requirement for fonts to
78
+ remain under this license does not apply to any document created using
79
+ the Font Software.
80
+
81
+ TERMINATION
82
+ This license becomes null and void if any of the above conditions are
83
+ not met.
84
+
85
+ DISCLAIMER
86
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
87
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
88
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
89
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
90
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
91
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
92
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
93
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
94
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,92 @@
1
+ This Font Software is licensed under the SIL Open Font License,
2
+ Version 1.1.
3
+
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+ -----------------------------------------------------------
8
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
9
+ -----------------------------------------------------------
10
+
11
+ PREAMBLE
12
+ The goals of the Open Font License (OFL) are to stimulate worldwide
13
+ development of collaborative font projects, to support the font
14
+ creation efforts of academic and linguistic communities, and to
15
+ provide a free and open framework in which fonts may be shared and
16
+ improved in partnership with others.
17
+
18
+ The OFL allows the licensed fonts to be used, studied, modified and
19
+ redistributed freely as long as they are not sold by themselves. The
20
+ fonts, including any derivative works, can be bundled, embedded,
21
+ redistributed and/or sold with any software provided that any reserved
22
+ names are not used by derivative works. The fonts and derivatives,
23
+ however, cannot be released under any other type of license. The
24
+ requirement for fonts to remain under this license does not apply to
25
+ any document created using the fonts or their derivatives.
26
+
27
+ DEFINITIONS
28
+ "Font Software" refers to the set of files released by the Copyright
29
+ Holder(s) under this license and clearly marked as such. This may
30
+ include source files, build scripts and documentation.
31
+
32
+ "Reserved Font Name" refers to any names specified as such after the
33
+ copyright statement(s).
34
+
35
+ "Original Version" refers to the collection of Font Software
36
+ components as distributed by the Copyright Holder(s).
37
+
38
+ "Modified Version" refers to any derivative made by adding to,
39
+ deleting, or substituting -- in part or in whole -- any of the
40
+ components of the Original Version, by changing formats or by porting
41
+ the Font Software to a new environment.
42
+
43
+ "Author" refers to any designer, engineer, programmer, technical
44
+ writer or other person who contributed to the Font Software.
45
+
46
+ PERMISSION & CONDITIONS
47
+ Permission is hereby granted, free of charge, to any person obtaining
48
+ a copy of the Font Software, to use, study, copy, merge, embed,
49
+ modify, redistribute, and sell modified and unmodified copies of the
50
+ Font Software, subject to the following conditions:
51
+
52
+ 1) Neither the Font Software nor any of its individual components, in
53
+ Original or Modified Versions, may be sold by itself.
54
+
55
+ 2) Original or Modified Versions of the Font Software may be bundled,
56
+ redistributed and/or sold with any software, provided that each copy
57
+ contains the above copyright notice and this license. These can be
58
+ included either as stand-alone text files, human-readable headers or
59
+ in the appropriate machine-readable metadata fields within text or
60
+ binary files as long as those fields can be easily viewed by the user.
61
+
62
+ 3) No Modified Version of the Font Software may use the Reserved Font
63
+ Name(s) unless explicit written permission is granted by the
64
+ corresponding Copyright Holder. This restriction only applies to the
65
+ primary font name as presented to the users.
66
+
67
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
68
+ Software shall not be used to promote, endorse or advertise any
69
+ Modified Version, except to acknowledge the contribution(s) of the
70
+ Copyright Holder(s) and the Author(s) or with their explicit written
71
+ permission.
72
+
73
+ 5) The Font Software, modified or unmodified, in part or in whole,
74
+ must be distributed entirely under this license, and must not be
75
+ distributed under any other license. The requirement for fonts to
76
+ remain under this license does not apply to any document created using
77
+ the Font Software.
78
+
79
+ TERMINATION
80
+ This license becomes null and void if any of the above conditions are
81
+ not met.
82
+
83
+ DISCLAIMER
84
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
85
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
86
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
87
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
88
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
89
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
90
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
91
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
92
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,25 @@
1
+ # Preview fixture fonts
2
+
3
+ These are unmodified upstream font binaries, redistributed under the SIL Open Font License 1.1. The adjacent license files reproduce the licenses at the pinned source revisions. Copyright and license statements are also embedded in each font's `name` table.
4
+
5
+ | Local file | Upstream revision and source | Embedded version and copyright | SHA-256 |
6
+ | --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------ |
7
+ | `NotoSans-Regular.ttf` | [notofonts/noto-fonts, ffebf8c1ee449e544955a7e813c54f9b73848eac](https://github.com/notofonts/noto-fonts/blob/ffebf8c1ee449e544955a7e813c54f9b73848eac/hinted/ttf/NotoSans/NotoSans-Regular.ttf) | Version 2.008; Copyright 2015–2021 Google LLC. All Rights Reserved. | `b85c38ecea8a7cfb39c24e395a4007474fa5a4fc864f6ee33309eb4948d232d5` |
8
+ | `NotoSansCJKsc-Regular.otf` | [notofonts/noto-cjk, f8d157532fbfaeda587e826d4cd5b21a49186f7c](https://github.com/notofonts/noto-cjk/blob/f8d157532fbfaeda587e826d4cd5b21a49186f7c/Sans/OTF/SimplifiedChinese/NotoSansCJKsc-Regular.otf) | Version 2.004; © 2014–2021 Adobe (http://www.adobe.com/). | `2c76254f6fc379fddfce0a7e84fb5385bb135d3e399294f6eeb6680d0365b74b` |
9
+
10
+ Original license sources:
11
+
12
+ - [NotoSans-LICENSE.txt](https://github.com/notofonts/noto-fonts/blob/ffebf8c1ee449e544955a7e813c54f9b73848eac/LICENSE)
13
+ - [NotoSansCJK-LICENSE.txt](https://github.com/notofonts/noto-cjk/blob/f8d157532fbfaeda587e826d4cd5b21a49186f7c/Sans/LICENSE)
14
+
15
+ `fonts.json` registers these under the application aliases `Preview Latin` and `Preview CJK`, in that fallback order. It also registers the unmodified Latin binary as `Geist`, `Geist Mono`, `SFMono-Regular`, `Menlo`, `ui-sans-serif`, `system-ui`, and `ui-monospace`, the named SDK theme/UI fallbacks. Those explicit aliases make strict family validation compatible with shipped-only Preview fonts while resolving to the same Noto bytes that per-character fallback previously used; they do not claim that the binary is an upstream Geist/Apple/system font. Aliases do not modify the original fonts. The Latin font has `A` and `B`; the CJK font has both `中` (U+4E2D) and `二` (U+4E8C), used by the existing editing example. No emoji font is needed by that example. These fixtures intentionally do not enumerate system fonts. The Latin binary is acquired directly from its licensed upstream source rather than assuming the different zgui test-fixture binary has the same provenance.
16
+
17
+ ## Profile resource and evidence contract
18
+
19
+ Both `../profiles/default.json` (virtual time) and `../profiles/wall-static.json` (wall time) declare this same manifest. A manifest establishes an explicit independent resource root. Face and license paths are relative to its directory; traversal and canonical symlink escapes are rejected. Font content hashes are mandatory, and license text must be present, nonempty UTF-8. Registration failures never fall back to system fonts.
20
+
21
+ Profile and manifest JSON are each bounded to 64 KiB; individual fonts to 32 MiB, all fonts to 64 MiB, and each license to 64 KiB. Surface extents are rounded half up; physical dimensions must be 1–16384 per axis and at most 16777216 pixels total (64 MiB for RGBA8). Logical dimensions are 1–16384; scale is finite and in (0, 8]. Supported themes are `dark` and `light`; locale, time zone and direction are exactly `en-US`, `UTC`, and `ltr`. This declares the supported preview environment, not arbitrary system locale discovery or international formatter support.
22
+
23
+ All time inputs are integers. Epoch milliseconds are in 0–8640000000000000, start microseconds in 0–9007199254740991, and the configured virtual duration must not push either representation beyond its range. The schema documents individual watchdog, work, and output bounds. Physical-pixel and clock arithmetic constraints are checked by the loader before allocation.
24
+
25
+ The loader returns a reusable resolved profile object with CLI overrides applied, separately from verified font evidence. Its digest is the SHA-256 of compact UTF-8 JSON for `{ "profile": resolvedProfile, "fontEvidence": fontEvidence }`, with every object's keys recursively sorted, arrays retaining declared order, and no machine-specific absolute resource paths. Font evidence binds actual font hashes, license hashes, ordered fallback, physical/effective logical dimensions and timing determinism. The returned `font_family_css` is an escaped ordered CSS **value**; apply it through `:root { font-family: VALUE; }` after package styles before mounting. Wall mode is explicitly marked `timingDeterministic: false` and is not suitable for strict timing baselines. A virtual declaration alone is not proof that its consuming runner supports virtual time; the runner must reject unsupported capabilities.
@@ -0,0 +1,60 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "faces": [
4
+ {
5
+ "family": "Preview Latin",
6
+ "path": "NotoSans-Regular.ttf",
7
+ "sha256": "b85c38ecea8a7cfb39c24e395a4007474fa5a4fc864f6ee33309eb4948d232d5",
8
+ "licensePath": "NotoSans-LICENSE.txt"
9
+ },
10
+ {
11
+ "family": "Preview CJK",
12
+ "path": "NotoSansCJKsc-Regular.otf",
13
+ "sha256": "2c76254f6fc379fddfce0a7e84fb5385bb135d3e399294f6eeb6680d0365b74b",
14
+ "licensePath": "NotoSansCJK-LICENSE.txt"
15
+ },
16
+ {
17
+ "family": "Geist",
18
+ "path": "NotoSans-Regular.ttf",
19
+ "sha256": "b85c38ecea8a7cfb39c24e395a4007474fa5a4fc864f6ee33309eb4948d232d5",
20
+ "licensePath": "NotoSans-LICENSE.txt"
21
+ },
22
+ {
23
+ "family": "Geist Mono",
24
+ "path": "NotoSans-Regular.ttf",
25
+ "sha256": "b85c38ecea8a7cfb39c24e395a4007474fa5a4fc864f6ee33309eb4948d232d5",
26
+ "licensePath": "NotoSans-LICENSE.txt"
27
+ },
28
+ {
29
+ "family": "SFMono-Regular",
30
+ "path": "NotoSans-Regular.ttf",
31
+ "sha256": "b85c38ecea8a7cfb39c24e395a4007474fa5a4fc864f6ee33309eb4948d232d5",
32
+ "licensePath": "NotoSans-LICENSE.txt"
33
+ },
34
+ {
35
+ "family": "Menlo",
36
+ "path": "NotoSans-Regular.ttf",
37
+ "sha256": "b85c38ecea8a7cfb39c24e395a4007474fa5a4fc864f6ee33309eb4948d232d5",
38
+ "licensePath": "NotoSans-LICENSE.txt"
39
+ },
40
+ {
41
+ "family": "ui-sans-serif",
42
+ "path": "NotoSans-Regular.ttf",
43
+ "sha256": "b85c38ecea8a7cfb39c24e395a4007474fa5a4fc864f6ee33309eb4948d232d5",
44
+ "licensePath": "NotoSans-LICENSE.txt"
45
+ },
46
+ {
47
+ "family": "system-ui",
48
+ "path": "NotoSans-Regular.ttf",
49
+ "sha256": "b85c38ecea8a7cfb39c24e395a4007474fa5a4fc864f6ee33309eb4948d232d5",
50
+ "licensePath": "NotoSans-LICENSE.txt"
51
+ },
52
+ {
53
+ "family": "ui-monospace",
54
+ "path": "NotoSans-Regular.ttf",
55
+ "sha256": "b85c38ecea8a7cfb39c24e395a4007474fa5a4fc864f6ee33309eb4948d232d5",
56
+ "licensePath": "NotoSans-LICENSE.txt"
57
+ }
58
+ ],
59
+ "fallbackOrder": ["Preview Latin", "Preview CJK"]
60
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "id": "desktop-800x600-175",
4
+ "surface": {
5
+ "name": "main",
6
+ "width": 800,
7
+ "height": 600,
8
+ "scale": 1.75,
9
+ "refreshRateMilliHz": 60000,
10
+ "opaque": true,
11
+ "background": "#17191fff"
12
+ },
13
+ "theme": "dark",
14
+ "locale": "en-US",
15
+ "direction": "ltr",
16
+ "timeZone": "UTC",
17
+ "clock": { "mode": "virtual", "epochMs": 1794614400000, "startUs": 0 },
18
+ "random": { "seed": 12345 },
19
+ "fonts": { "mode": "shipped-only", "manifest": "../fonts/fonts.json" },
20
+ "assets": { "mode": "package-only", "readiness": "required-visible" },
21
+ "limits": {
22
+ "maxRunWallMs": 15000,
23
+ "maxStepWallMs": 3000,
24
+ "maxJsEntryWallMs": 25,
25
+ "maxJobsPerPump": 1000,
26
+ "maxPumpWallMs": 50,
27
+ "maxSettleTurns": 64,
28
+ "maxFramesPerStep": 120,
29
+ "maxVirtualDurationMs": 60000,
30
+ "maxOutputBytes": 33554432
31
+ }
32
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "id": "counter-capture",
4
+ "requiredCapabilities": ["pixels"],
5
+ "steps": [
6
+ { "id": "ready", "op": "settle" },
7
+ { "id": "before", "op": "capture", "captureId": "initial" }
8
+ ]
9
+ }
@@ -0,0 +1,53 @@
1
+ import { createEffect, createRoot, createSignal, flush, onCleanup, type Setter } from "solid-js";
2
+
3
+ export function runSmoke(): string {
4
+ const events: string[] = [];
5
+ let setCount!: Setter<number>;
6
+ let dispose!: () => void;
7
+
8
+ function expect(expected: string): void {
9
+ const actual = events.join(",");
10
+ if (actual !== expected) {
11
+ throw new Error(`Solid smoke: expected ${expected}; received ${actual}`);
12
+ }
13
+ }
14
+
15
+ createRoot(disposeRoot => {
16
+ dispose = disposeRoot;
17
+ const [count, updateCount] = createSignal(0);
18
+ setCount = updateCount;
19
+ onCleanup(() => events.push("root:cleanup"));
20
+ createEffect(
21
+ () => count(),
22
+ value => {
23
+ events.push(`effect:${value}`);
24
+ return () => events.push(`cleanup:${value}`);
25
+ },
26
+ );
27
+ });
28
+ flush();
29
+
30
+ try {
31
+ expect("effect:0");
32
+ setCount(1);
33
+ flush();
34
+ expect("effect:0,cleanup:0,effect:1");
35
+ setCount(1);
36
+ flush();
37
+ expect("effect:0,cleanup:0,effect:1");
38
+ setCount(2);
39
+ setCount(3);
40
+ flush();
41
+ expect("effect:0,cleanup:0,effect:1,cleanup:1,effect:3");
42
+ dispose();
43
+ flush();
44
+ expect("effect:0,cleanup:0,effect:1,cleanup:1,effect:3,cleanup:3,root:cleanup");
45
+ setCount(4);
46
+ flush();
47
+ expect("effect:0,cleanup:0,effect:1,cleanup:1,effect:3,cleanup:3,root:cleanup");
48
+ return "solid-smoke:ok";
49
+ } finally {
50
+ dispose();
51
+ flush();
52
+ }
53
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": [
5
+ "ES2022",
6
+ "DOM"
7
+ ],
8
+ "module": "ESNext",
9
+ "moduleResolution": "Bundler",
10
+ "customConditions": [
11
+ "browser",
12
+ "production"
13
+ ],
14
+ "strict": true,
15
+ "noEmit": true,
16
+ "types": []
17
+ },
18
+ "include": [
19
+ "./solid-smoke.ts"
20
+ ]
21
+ }
@@ -0,0 +1,70 @@
1
+ import type { ResolvedApplication } from "./index.ts";
2
+ import { access, realpath } from "node:fs/promises";
3
+ import path from "node:path";
4
+ import { workspaceRoot } from "./sdk.ts";
5
+
6
+ async function exists(filename: string): Promise<boolean> {
7
+ try {
8
+ await access(filename);
9
+ return true;
10
+ } catch (error) {
11
+ if ((error as NodeJS.ErrnoException).code === "ENOENT") return false;
12
+ throw error;
13
+ }
14
+ }
15
+
16
+ export async function resolveApplication(
17
+ selector?: string,
18
+ { cwd = process.cwd(), root = workspaceRoot } = {},
19
+ ): Promise<ResolvedApplication> {
20
+ let directory: string;
21
+ if (selector !== undefined) {
22
+ const local = path.resolve(cwd, selector);
23
+ // Explicit paths never fall back to a similarly named repository example.
24
+ const explicitPath =
25
+ path.isAbsolute(selector) ||
26
+ selector.includes("/") ||
27
+ selector.includes("\\") ||
28
+ selector === "." ||
29
+ selector === "..";
30
+ directory =
31
+ explicitPath || (await exists(local)) ? local : path.join(root, "apps/examples", selector);
32
+ } else {
33
+ directory = (await Bun.file(path.join(cwd, "src/main.tsx")).exists())
34
+ ? cwd
35
+ : path.resolve(cwd) === path.resolve(root)
36
+ ? path.join(root, "apps/examples/counter")
37
+ : cwd;
38
+ }
39
+ const appDirectory = await realpath(directory).catch((error: Error) => {
40
+ throw new Error(`Cannot open application directory ${directory}: ${error.message}`, {
41
+ cause: error,
42
+ });
43
+ });
44
+ for (const filename of ["src/main.tsx", "tsconfig.json"]) {
45
+ if (!(await Bun.file(path.join(appDirectory, filename)).exists()))
46
+ throw new Error(`Application ${appDirectory} requires ${filename}`);
47
+ }
48
+ let name = path.basename(appDirectory);
49
+ try {
50
+ const manifest = (await Bun.file(path.join(appDirectory, "package.json")).json()) as {
51
+ name?: unknown;
52
+ };
53
+ if (
54
+ path.dirname(appDirectory) !== path.join(root, "apps/examples") &&
55
+ typeof manifest.name === "string" &&
56
+ manifest.name
57
+ ) {
58
+ name = manifest.name.slice(manifest.name.lastIndexOf("/") + 1);
59
+ }
60
+ } catch (error) {
61
+ if ((error as NodeJS.ErrnoException).code !== "ENOENT") throw error;
62
+ }
63
+ // Derive a portable selector; package identity may override it through zgui.id.
64
+ let app = name
65
+ .toLowerCase()
66
+ .replace(/[^a-z0-9-]+/g, "-")
67
+ .replace(/^-+|-+$/g, "");
68
+ if (!/^[a-z]/.test(app)) app = `app-${app || "local"}`;
69
+ return { app, appDirectory, root };
70
+ }