@hewel/zgui-build 0.1.2 → 0.1.4
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 +42 -3
- package/package.json +1 -1
- package/sdk/Cargo.lock +304 -5
- package/sdk/bun.lock +42 -7
- package/sdk/package.json +4 -3
- package/src/build.ts +64 -633
- package/src/css.ts +558 -25
- package/src/dev.ts +6 -4
- package/src/host.ts +253 -75
- package/src/index.ts +8 -2
- package/src/manifest-policy.ts +699 -0
- package/src/package-app.ts +43 -27
- package/src/preview-check.ts +14 -5
- package/src/preview.ts +16 -16
- package/src/public-api.d.ts +30 -0
- package/src/sdk-packages.ts +73 -14
- package/src/sync-ui-resources.ts +50 -0
- package/src/typecheck.ts +6 -2
- package/src/validate.ts +12 -4
- package/src/watch.ts +50 -3
- package/src/native-process.ts +0 -178
package/src/package-app.ts
CHANGED
|
@@ -2,8 +2,7 @@ import type { PackageApplicationOptions, PackagedApplication } from "./index.ts"
|
|
|
2
2
|
import { existsSync } from "node:fs";
|
|
3
3
|
import { chmod, copyFile, cp, mkdir, realpath, rm, writeFile } from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
5
|
-
import {
|
|
6
|
-
import { EXPECTED_HOST_API_VERSION, resolveNativeHost } from "./host.ts";
|
|
5
|
+
import { buildWithResolvedHost } from "./build.ts";
|
|
7
6
|
import { packagedSdkRoot, workspaceRoot } from "./sdk.ts";
|
|
8
7
|
|
|
9
8
|
const DISTRIBUTED_LICENSE_FILES = ["LICENSE", "NOTICE", "THIRD_PARTY_NOTICES.md"] as const;
|
|
@@ -24,12 +23,22 @@ function sanitizeDesktopField(value: string): string {
|
|
|
24
23
|
return value.replace(/[\r\n]+/g, " ").trim();
|
|
25
24
|
}
|
|
26
25
|
|
|
27
|
-
function buildLauncherScript(
|
|
26
|
+
function buildLauncherScript({ pureShell = false }: { pureShell?: boolean }): string {
|
|
28
27
|
const extraFlags = pureShell ? " --pure-shell" : "";
|
|
29
28
|
return `#!/usr/bin/env sh
|
|
30
29
|
set -eu
|
|
31
30
|
DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
32
|
-
|
|
31
|
+
# Preserve the launcher diagnostics. A leading -- forces literal app arguments.
|
|
32
|
+
case "\${1-}:$#" in
|
|
33
|
+
--help:1|-h:1|--version:1|-V:1)
|
|
34
|
+
exec "$DIR/bin/zgui-host" "$@" ;;
|
|
35
|
+
--version:2|-V:2)
|
|
36
|
+
if [ "$2" = --json ]; then exec "$DIR/bin/zgui-host" "$@"; fi ;;
|
|
37
|
+
--exit-after-ms:2)
|
|
38
|
+
exec "$DIR/bin/zgui-host" --bundle "$DIR/bundle"${extraFlags} "$@" ;;
|
|
39
|
+
--:*) shift ;;
|
|
40
|
+
esac
|
|
41
|
+
exec "$DIR/bin/zgui-host" --bundle "$DIR/bundle"${extraFlags} -- "$@"
|
|
33
42
|
`;
|
|
34
43
|
}
|
|
35
44
|
|
|
@@ -42,11 +51,19 @@ function buildDesktopEntry({
|
|
|
42
51
|
id: string;
|
|
43
52
|
execPath: string;
|
|
44
53
|
}): string {
|
|
54
|
+
// Desktop Entry escaping precedes Exec's quoted-argument escaping.
|
|
55
|
+
const executable = execPath
|
|
56
|
+
.replaceAll("%", "%%")
|
|
57
|
+
.replace(/["`$\\]/g, "\\$&")
|
|
58
|
+
.replaceAll("\\", "\\\\")
|
|
59
|
+
.replaceAll("\n", "\\n")
|
|
60
|
+
.replaceAll("\r", "\\r")
|
|
61
|
+
.replaceAll("\t", "\\t");
|
|
45
62
|
return `[Desktop Entry]
|
|
46
63
|
Type=Application
|
|
47
64
|
Version=1.0
|
|
48
65
|
Name=${sanitizeDesktopField(name)}
|
|
49
|
-
Exec
|
|
66
|
+
Exec="${executable}" -- %F
|
|
50
67
|
Terminal=false
|
|
51
68
|
Categories=Utility;
|
|
52
69
|
StartupWMClass=${sanitizeDesktopField(id)}
|
|
@@ -65,6 +82,7 @@ export async function packageApplication(
|
|
|
65
82
|
hostSearchFrom,
|
|
66
83
|
extraCapabilities,
|
|
67
84
|
capabilitiesFile,
|
|
85
|
+
cssModuleInclude,
|
|
68
86
|
desktopEntry = false,
|
|
69
87
|
pureShell = false,
|
|
70
88
|
signal,
|
|
@@ -73,17 +91,20 @@ export async function packageApplication(
|
|
|
73
91
|
signal?.throwIfAborted();
|
|
74
92
|
const resolvedAppDir = path.resolve(appDirectory);
|
|
75
93
|
const outputDir = path.resolve(out);
|
|
76
|
-
const {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
94
|
+
const { application, resolveHost } = await buildWithResolvedHost(
|
|
95
|
+
app,
|
|
96
|
+
{
|
|
97
|
+
root,
|
|
98
|
+
appDirectory: resolvedAppDir,
|
|
99
|
+
bytecode,
|
|
100
|
+
hostSearchFrom,
|
|
101
|
+
extraCapabilities,
|
|
102
|
+
capabilitiesFile,
|
|
103
|
+
cssModuleInclude,
|
|
104
|
+
},
|
|
105
|
+
{ hostRoot, hostExecutable, signal },
|
|
106
|
+
);
|
|
107
|
+
const { dist, manifest } = application;
|
|
87
108
|
signal?.throwIfAborted();
|
|
88
109
|
|
|
89
110
|
if (pureShell && !manifest.capabilities?.shellSurfaces && !manifest.capabilities?.sessionLock) {
|
|
@@ -92,14 +113,9 @@ export async function packageApplication(
|
|
|
92
113
|
);
|
|
93
114
|
}
|
|
94
115
|
|
|
95
|
-
const host = await
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
root,
|
|
99
|
-
cwd: resolvedAppDir,
|
|
100
|
-
searchFrom: hostSearchFrom,
|
|
101
|
-
signal,
|
|
102
|
-
});
|
|
116
|
+
const host = await resolveHost();
|
|
117
|
+
const abi = host.abi;
|
|
118
|
+
if (!abi) throw new Error("Resolved zgui-host did not report ABI metadata");
|
|
103
119
|
signal?.throwIfAborted();
|
|
104
120
|
|
|
105
121
|
const bundleSource = await realpath(dist);
|
|
@@ -123,7 +139,7 @@ export async function packageApplication(
|
|
|
123
139
|
await copyFile(source, path.join(licensesDir, filename));
|
|
124
140
|
licensePaths.push(`licenses/${filename}`);
|
|
125
141
|
}
|
|
126
|
-
await writeFile(launcherPath, buildLauncherScript(
|
|
142
|
+
await writeFile(launcherPath, buildLauncherScript({ pureShell }), "utf8");
|
|
127
143
|
await chmod(launcherPath, 0o755);
|
|
128
144
|
|
|
129
145
|
if (desktopEntry) {
|
|
@@ -144,8 +160,8 @@ export async function packageApplication(
|
|
|
144
160
|
app,
|
|
145
161
|
id: manifest.id,
|
|
146
162
|
buildId: manifest.buildId,
|
|
147
|
-
hostApiVersion:
|
|
148
|
-
hostVersion:
|
|
163
|
+
hostApiVersion: abi.hostApiVersion,
|
|
164
|
+
hostVersion: abi.version,
|
|
149
165
|
hostSource: host.source,
|
|
150
166
|
executable: "bin/zgui-host",
|
|
151
167
|
bundle: "bundle",
|
package/src/preview-check.ts
CHANGED
|
@@ -2,8 +2,10 @@ import { mkdir, rename, writeFile } from "node:fs/promises";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
|
|
5
|
+
import { resolveNativeHost } from "./host.ts";
|
|
6
|
+
import type { ResolvedNativeHost } from "./index.ts";
|
|
7
|
+
|
|
5
8
|
const workspaceRoot = fileURLToPath(new URL("../../../", import.meta.url));
|
|
6
|
-
const nativeHost = path.join(workspaceRoot, "target/debug/zgui-host");
|
|
7
9
|
const maxSummaryBytes = 8 * 1024;
|
|
8
10
|
const exitCodes = new Set([0, 2, 3, 4, 5, 6, 7, 8, 9, 130]);
|
|
9
11
|
const usage =
|
|
@@ -81,6 +83,7 @@ function options(args: string[]) {
|
|
|
81
83
|
}
|
|
82
84
|
|
|
83
85
|
function execute(
|
|
86
|
+
host: ResolvedNativeHost,
|
|
84
87
|
command: "run" | "compare",
|
|
85
88
|
args: string[],
|
|
86
89
|
): {
|
|
@@ -91,8 +94,8 @@ function execute(
|
|
|
91
94
|
// Native stderr remains available live, including graphics setup diagnostics.
|
|
92
95
|
let child: Bun.SyncSubprocess<"pipe", "inherit">;
|
|
93
96
|
try {
|
|
94
|
-
child = Bun.spawnSync([
|
|
95
|
-
cwd:
|
|
97
|
+
child = Bun.spawnSync([host.executable, "preview", command, ...args], {
|
|
98
|
+
cwd: host.runRoot,
|
|
96
99
|
stdin: "ignore",
|
|
97
100
|
stdout: "pipe",
|
|
98
101
|
stderr: "inherit",
|
|
@@ -188,7 +191,13 @@ try {
|
|
|
188
191
|
}
|
|
189
192
|
root = selected.out;
|
|
190
193
|
result.stage = "run";
|
|
191
|
-
|
|
194
|
+
let host: ResolvedNativeHost;
|
|
195
|
+
try {
|
|
196
|
+
host = await resolveNativeHost({ root: workspaceRoot, allowCargoBuild: false });
|
|
197
|
+
} catch (error) {
|
|
198
|
+
throw failure("E_WORKER_CRASH", 9, `Cannot resolve native preview host: ${message(error)}`);
|
|
199
|
+
}
|
|
200
|
+
const run = execute(host, "run", [
|
|
192
201
|
"--bundle",
|
|
193
202
|
path.join(workspaceRoot, "apps/examples/counter/dist"),
|
|
194
203
|
"--profile",
|
|
@@ -211,7 +220,7 @@ try {
|
|
|
211
220
|
await writeFile(path.join(root, "run.stdout.json"), run.stdout, { flag: "wx" });
|
|
212
221
|
if (run.result.exitCode === 0) {
|
|
213
222
|
result.stage = "compare";
|
|
214
|
-
const comparison = execute("compare", [
|
|
223
|
+
const comparison = execute(host, "compare", [
|
|
215
224
|
"--baseline",
|
|
216
225
|
selected.baseline,
|
|
217
226
|
"--actual",
|
package/src/preview.ts
CHANGED
|
@@ -2,16 +2,16 @@ import type { PreviewApplicationOptions } from "./index.ts";
|
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import path from "node:path";
|
|
5
|
-
import {
|
|
5
|
+
import { buildWithResolvedHost } from "./build.ts";
|
|
6
6
|
import { devApplication } from "./dev.ts";
|
|
7
|
-
import {
|
|
8
|
-
import { runNativeHost } from "./native-process.ts";
|
|
7
|
+
import { runNativeHost } from "./host.ts";
|
|
9
8
|
import { packagedSdkRoot, workspaceRoot } from "./sdk.ts";
|
|
10
9
|
|
|
11
10
|
export async function previewApplication(
|
|
12
11
|
app: string,
|
|
13
12
|
{
|
|
14
13
|
root = workspaceRoot,
|
|
14
|
+
appDirectory = path.join(root, "apps/examples", app),
|
|
15
15
|
hostRoot,
|
|
16
16
|
hostExecutable,
|
|
17
17
|
watch = false,
|
|
@@ -24,6 +24,7 @@ export async function previewApplication(
|
|
|
24
24
|
),
|
|
25
25
|
signal,
|
|
26
26
|
onOutput,
|
|
27
|
+
bytecode = false,
|
|
27
28
|
...buildOptions
|
|
28
29
|
}: PreviewApplicationOptions = {},
|
|
29
30
|
): Promise<number> {
|
|
@@ -45,25 +46,24 @@ export async function previewApplication(
|
|
|
45
46
|
return devApplication(app, {
|
|
46
47
|
...buildOptions,
|
|
47
48
|
root,
|
|
49
|
+
appDirectory,
|
|
48
50
|
...(explicitHostRoot === undefined ? {} : { hostRoot: explicitHostRoot }),
|
|
49
51
|
hostExecutable,
|
|
50
52
|
mode: "preview",
|
|
51
53
|
hostArgs: args,
|
|
52
54
|
signal,
|
|
53
55
|
});
|
|
54
|
-
const {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
root,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return runNativeHost(resolvedHost.executable, ["preview", "run", "--bundle", dist, ...args], {
|
|
66
|
-
root: runRoot,
|
|
56
|
+
const {
|
|
57
|
+
application: { dist },
|
|
58
|
+
resolveHost,
|
|
59
|
+
} = await buildWithResolvedHost(
|
|
60
|
+
app,
|
|
61
|
+
{ ...buildOptions, root, appDirectory, bytecode },
|
|
62
|
+
{ hostRoot: explicitHostRoot, hostExecutable, signal },
|
|
63
|
+
);
|
|
64
|
+
const host = await resolveHost();
|
|
65
|
+
return runNativeHost(host.executable, ["preview", "run", "--bundle", dist, ...args], {
|
|
66
|
+
root: host.runRoot,
|
|
67
67
|
signal,
|
|
68
68
|
});
|
|
69
69
|
}
|
package/src/public-api.d.ts
CHANGED
|
@@ -13,6 +13,20 @@ export type FileDirectoryGrant = {
|
|
|
13
13
|
|
|
14
14
|
export type FilesCapabilities = {
|
|
15
15
|
directories?: FileDirectoryGrant[];
|
|
16
|
+
/** Defaults to true for legacy gesture-authorized bookmarks. */
|
|
17
|
+
allowBookmarks?: boolean;
|
|
18
|
+
/** Prevent the persistence or restoration of readwrite workspace grants. */
|
|
19
|
+
readOnlyGrants?: boolean;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type SystemFilesCapabilities = {
|
|
23
|
+
read?: boolean;
|
|
24
|
+
write?: boolean;
|
|
25
|
+
trash?: boolean;
|
|
26
|
+
volumes?: boolean;
|
|
27
|
+
thumbnails?: boolean;
|
|
28
|
+
openExternal?: boolean;
|
|
29
|
+
directories?: FileDirectoryGrant[];
|
|
16
30
|
};
|
|
17
31
|
|
|
18
32
|
export type NetworkOriginRule = {
|
|
@@ -36,9 +50,12 @@ export type Capabilities = {
|
|
|
36
50
|
namedSockets?: string[];
|
|
37
51
|
commands?: string[];
|
|
38
52
|
controlChannel?: boolean;
|
|
53
|
+
/** Base package launch policy; overlays cannot enable this. */
|
|
54
|
+
singleInstance?: boolean;
|
|
39
55
|
clipboard?: ClipboardCapabilities;
|
|
40
56
|
sqlite?: SqliteCapabilities;
|
|
41
57
|
files?: FilesCapabilities;
|
|
58
|
+
systemFiles?: SystemFilesCapabilities;
|
|
42
59
|
network?: NetworkCapabilities;
|
|
43
60
|
};
|
|
44
61
|
|
|
@@ -120,6 +137,14 @@ export interface BuildApplicationOptions {
|
|
|
120
137
|
hostSearchFrom?: readonly string[] | undefined;
|
|
121
138
|
extraCapabilities?: Capabilities;
|
|
122
139
|
capabilitiesFile?: string;
|
|
140
|
+
cssModuleInclude?: readonly string[] | undefined;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export interface SyncCssModuleTypesOptions {
|
|
144
|
+
project?: string | undefined;
|
|
145
|
+
appDirectory?: string | undefined;
|
|
146
|
+
include?: readonly string[] | undefined;
|
|
147
|
+
cwd?: string | undefined;
|
|
123
148
|
}
|
|
124
149
|
|
|
125
150
|
export interface ApplicationWatcher {
|
|
@@ -143,6 +168,8 @@ export type DevMode = "desktop" | "preview";
|
|
|
143
168
|
export interface DevApplicationOptions extends Omit<BuildApplicationOptions, "development"> {
|
|
144
169
|
strictTypecheck?: boolean | undefined;
|
|
145
170
|
hostArgs?: string[];
|
|
171
|
+
/** Working directory for the native process, independent of bundle and Cargo paths. */
|
|
172
|
+
hostCwd?: string;
|
|
146
173
|
hostRoot?: string;
|
|
147
174
|
hostExecutable?: string;
|
|
148
175
|
mode?: DevMode;
|
|
@@ -201,6 +228,8 @@ export interface ResolveNativeHostOptions {
|
|
|
201
228
|
export interface ResolvedNativeHost {
|
|
202
229
|
executable: string;
|
|
203
230
|
source: NativeHostSource;
|
|
231
|
+
/** Absolute working directory selected for native host commands. */
|
|
232
|
+
runRoot: string;
|
|
204
233
|
packageName?: string | undefined;
|
|
205
234
|
cargoRoot?: string | undefined;
|
|
206
235
|
abi?: NativeHostAbi | undefined;
|
|
@@ -230,6 +259,7 @@ export declare const buildApplication: (
|
|
|
230
259
|
app: string,
|
|
231
260
|
options?: BuildApplicationOptions,
|
|
232
261
|
) => Promise<PublishedApplication>;
|
|
262
|
+
export declare const syncCssModuleTypes: (options?: SyncCssModuleTypesOptions) => Promise<string[]>;
|
|
233
263
|
export declare const watchApplication: (
|
|
234
264
|
app: string,
|
|
235
265
|
options?: WatchApplicationOptions,
|
package/src/sdk-packages.ts
CHANGED
|
@@ -44,6 +44,13 @@ const SDK_PACKAGE_SPECS: Readonly<Record<SdkPackageName, SdkPackageSpec>> = {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
const ALL_SDK_PACKAGES: readonly SdkPackageName[] = ["ui", "services"];
|
|
47
|
+
const OXLINT_OUTPUT_FILES = [
|
|
48
|
+
"oxlint/plugin.js",
|
|
49
|
+
"oxlint/solid.js",
|
|
50
|
+
"oxlint/ast.js",
|
|
51
|
+
"oxlint/scope.js",
|
|
52
|
+
"oxlint/style-analysis.js",
|
|
53
|
+
] as const;
|
|
47
54
|
|
|
48
55
|
const compilerCli = path.join(
|
|
49
56
|
path.dirname(createRequire(import.meta.url).resolve("tsrs/package.json")),
|
|
@@ -83,30 +90,41 @@ async function listFilesRecursive(dir: string, prefix = ""): Promise<string[]> {
|
|
|
83
90
|
|
|
84
91
|
async function newestInputMtimeMs(pkgDir: string): Promise<number> {
|
|
85
92
|
let newest = 0;
|
|
86
|
-
for (const cfg of ["tsconfig.json", "tsconfig.build.json"]) {
|
|
93
|
+
for (const cfg of ["tsconfig.json", "tsconfig.build.json", "tsconfig.oxlint.json"]) {
|
|
87
94
|
const full = path.join(pkgDir, cfg);
|
|
88
95
|
if (existsSync(full)) {
|
|
89
96
|
const info = await stat(full);
|
|
90
97
|
if (info.mtimeMs > newest) newest = info.mtimeMs;
|
|
91
98
|
}
|
|
92
99
|
}
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
100
|
+
for (const inputDir of [path.join(pkgDir, "src"), path.join(pkgDir, "oxlint/src")]) {
|
|
101
|
+
for (const rel of await listFilesRecursive(inputDir)) {
|
|
102
|
+
const info = await stat(path.join(inputDir, rel));
|
|
103
|
+
if (info.mtimeMs > newest) newest = info.mtimeMs;
|
|
104
|
+
}
|
|
97
105
|
}
|
|
98
106
|
return newest;
|
|
99
107
|
}
|
|
100
108
|
|
|
101
109
|
async function isPackageDistFresh(pkgDir: string, spec: SdkPackageSpec): Promise<boolean> {
|
|
102
110
|
const distDir = path.join(pkgDir, "dist");
|
|
103
|
-
const
|
|
111
|
+
const hasOxlintBuild = existsSync(path.join(pkgDir, "tsconfig.oxlint.json"));
|
|
112
|
+
const required = [
|
|
113
|
+
"index.js",
|
|
114
|
+
"index.d.ts",
|
|
115
|
+
...spec.handwrittenDts,
|
|
116
|
+
...(hasOxlintBuild ? OXLINT_OUTPUT_FILES : []),
|
|
117
|
+
];
|
|
104
118
|
let stampMtime = Number.POSITIVE_INFINITY;
|
|
105
119
|
for (const rel of required) {
|
|
106
120
|
const full = path.join(distDir, rel);
|
|
107
121
|
try {
|
|
108
122
|
const info = await stat(full);
|
|
109
|
-
if (
|
|
123
|
+
if (
|
|
124
|
+
rel === "index.js" ||
|
|
125
|
+
rel === "index.d.ts" ||
|
|
126
|
+
(hasOxlintBuild && (OXLINT_OUTPUT_FILES as readonly string[]).includes(rel))
|
|
127
|
+
) {
|
|
110
128
|
stampMtime = Math.min(stampMtime, info.mtimeMs);
|
|
111
129
|
}
|
|
112
130
|
} catch {
|
|
@@ -183,7 +201,7 @@ async function syncDirectoryInPlace(stagingDir: string, distDir: string): Promis
|
|
|
183
201
|
await removeEmptyDirs(distDir);
|
|
184
202
|
|
|
185
203
|
const now = new Date();
|
|
186
|
-
for (const sentinel of ["index.js", "index.d.ts"]) {
|
|
204
|
+
for (const sentinel of ["index.js", "index.d.ts", ...OXLINT_OUTPUT_FILES]) {
|
|
187
205
|
const target = path.join(distDir, sentinel);
|
|
188
206
|
if (existsSync(target)) {
|
|
189
207
|
await utimes(target, now, now).catch(() => {});
|
|
@@ -266,7 +284,10 @@ async function compileSinglePackage(
|
|
|
266
284
|
if (!existsSync(tsconfigPath)) {
|
|
267
285
|
throw new Error(`Missing SDK build tsconfig: ${tsconfigPath}`);
|
|
268
286
|
}
|
|
269
|
-
const stagingDir = path.join(
|
|
287
|
+
const stagingDir = path.join(
|
|
288
|
+
os.tmpdir(),
|
|
289
|
+
`zgui-dist-staging-${spec.name}-${process.pid}-${randomUUID()}`,
|
|
290
|
+
);
|
|
270
291
|
try {
|
|
271
292
|
const child = Bun.spawn(
|
|
272
293
|
[
|
|
@@ -305,6 +326,39 @@ async function compileSinglePackage(
|
|
|
305
326
|
await copyFile(srcPath, destPath);
|
|
306
327
|
}
|
|
307
328
|
|
|
329
|
+
const oxlintTsconfigPath = path.join(pkgDir, "tsconfig.oxlint.json");
|
|
330
|
+
if (existsSync(oxlintTsconfigPath)) {
|
|
331
|
+
const oxlintChild = Bun.spawn(
|
|
332
|
+
[
|
|
333
|
+
process.execPath,
|
|
334
|
+
compilerCli,
|
|
335
|
+
"--project",
|
|
336
|
+
oxlintTsconfigPath,
|
|
337
|
+
"--outDir",
|
|
338
|
+
path.join(stagingDir, "oxlint"),
|
|
339
|
+
"--pretty",
|
|
340
|
+
"false",
|
|
341
|
+
],
|
|
342
|
+
{
|
|
343
|
+
cwd: pkgDir,
|
|
344
|
+
stdin: "ignore",
|
|
345
|
+
stdout: "pipe",
|
|
346
|
+
stderr: "pipe",
|
|
347
|
+
},
|
|
348
|
+
);
|
|
349
|
+
const [oxCode, oxStdout, oxStderr] = await Promise.all([
|
|
350
|
+
oxlintChild.exited,
|
|
351
|
+
new Response(oxlintChild.stdout).text(),
|
|
352
|
+
new Response(oxlintChild.stderr).text(),
|
|
353
|
+
]);
|
|
354
|
+
if (oxCode !== 0 || oxlintChild.signalCode) {
|
|
355
|
+
const detail = `${oxStdout}${oxStderr}`.trim();
|
|
356
|
+
throw new Error(
|
|
357
|
+
`SDK oxlint build failed for ${spec.dir} (exit ${oxlintChild.signalCode ?? oxCode})${detail ? `:\n${detail}` : ""}`,
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
308
362
|
let verifiedSheets = 0;
|
|
309
363
|
if (spec.verifyGeneratedStyles) {
|
|
310
364
|
verifiedSheets = await verifyGeneratedStyleSheets(stagingDir);
|
|
@@ -340,17 +394,22 @@ export async function buildSdkPackages({
|
|
|
340
394
|
|
|
341
395
|
export async function ensureSdkPackagesBuilt(
|
|
342
396
|
root: string = workspaceRoot,
|
|
343
|
-
{
|
|
397
|
+
{
|
|
398
|
+
silent = true,
|
|
399
|
+
packages = ALL_SDK_PACKAGES,
|
|
400
|
+
}: { silent?: boolean; packages?: readonly SdkPackageName[] } = {},
|
|
344
401
|
): Promise<void> {
|
|
345
402
|
const resolvedRoot = path.resolve(root);
|
|
346
403
|
if (!hasCheckoutSdkSources(resolvedRoot)) return;
|
|
347
404
|
|
|
348
|
-
const
|
|
405
|
+
const targetPackages = [...new Set(packages)];
|
|
406
|
+
const cacheKey = `${resolvedRoot}:${[...targetPackages].sort().join(",")}`;
|
|
407
|
+
const existing = inFlight.get(cacheKey);
|
|
349
408
|
if (existing) return existing;
|
|
350
409
|
|
|
351
410
|
const run = (async () => {
|
|
352
411
|
const stale: SdkPackageName[] = [];
|
|
353
|
-
for (const name of
|
|
412
|
+
for (const name of targetPackages) {
|
|
354
413
|
const spec = SDK_PACKAGE_SPECS[name];
|
|
355
414
|
if (!(await isPackageDistFresh(path.join(resolvedRoot, spec.dir), spec))) {
|
|
356
415
|
stale.push(name);
|
|
@@ -367,10 +426,10 @@ export async function ensureSdkPackagesBuilt(
|
|
|
367
426
|
});
|
|
368
427
|
})();
|
|
369
428
|
|
|
370
|
-
inFlight.set(
|
|
429
|
+
inFlight.set(cacheKey, run);
|
|
371
430
|
try {
|
|
372
431
|
await run;
|
|
373
432
|
} finally {
|
|
374
|
-
if (inFlight.get(
|
|
433
|
+
if (inFlight.get(cacheKey) === run) inFlight.delete(cacheKey);
|
|
375
434
|
}
|
|
376
435
|
}
|
package/src/sync-ui-resources.ts
CHANGED
|
@@ -96,6 +96,56 @@ export function adaptUpstreamCss(name: string, className: string, css: string):
|
|
|
96
96
|
);
|
|
97
97
|
case "CollapsibleStyle":
|
|
98
98
|
return `${css}\n.zui-collapsible__content[data-collapsed] { visibility: hidden; }`;
|
|
99
|
+
case "TableStyle":
|
|
100
|
+
return css
|
|
101
|
+
.replace(
|
|
102
|
+
`.${className}[data-sticky-header="true"] .zui-table__head`,
|
|
103
|
+
'.zui-table__head[data-sticky="true"]',
|
|
104
|
+
)
|
|
105
|
+
.replace(
|
|
106
|
+
`.${className} .zui-table__row[data-selected="true"] .zui-table__cell`,
|
|
107
|
+
'.zui-table__cell[data-selected="true"]',
|
|
108
|
+
)
|
|
109
|
+
.replace(
|
|
110
|
+
".zui-table__row:hover .zui-table__cell",
|
|
111
|
+
".zui-table__row:hover > .zui-table__cell",
|
|
112
|
+
)
|
|
113
|
+
.replace(
|
|
114
|
+
".zui-table__footer .zui-table__cell",
|
|
115
|
+
".zui-table__footer > .zui-table__row > .zui-table__cell",
|
|
116
|
+
)
|
|
117
|
+
.replaceAll(
|
|
118
|
+
/(\.zui-table__(?:body|footer)) (\.zui-table__row:(?:first|last)-child)/g,
|
|
119
|
+
"$1 > $2",
|
|
120
|
+
)
|
|
121
|
+
.replaceAll(
|
|
122
|
+
/(\.zui-table__row:(?:first|last)-child) \.zui-table__cell/g,
|
|
123
|
+
"$1 > .zui-table__cell",
|
|
124
|
+
);
|
|
125
|
+
case "DataTableStyle":
|
|
126
|
+
return `${css
|
|
127
|
+
.replace(
|
|
128
|
+
"border: 1px solid var(--zui-color-border);\n border-radius: var(--zui-radius-md);\n max-height:",
|
|
129
|
+
"border: none;\n --zgui-scrollbar-mode: overlay;\n max-height:",
|
|
130
|
+
)
|
|
131
|
+
.replace(
|
|
132
|
+
'.zui-data-table__grid[data-virtualized="true"] .zui-table__body .zui-table__cell',
|
|
133
|
+
'.zui-data-table__layout-row[data-fixed="true"] > .zui-table__row > .zui-table__cell',
|
|
134
|
+
)}
|
|
135
|
+
.zui-data-table__layout-row { flex-shrink: 0; }
|
|
136
|
+
.zui-data-table__frame {
|
|
137
|
+
width: 100%;
|
|
138
|
+
min-width: 0;
|
|
139
|
+
overflow-x: auto;
|
|
140
|
+
overflow-y: hidden;
|
|
141
|
+
border: 1px solid var(--zui-color-border);
|
|
142
|
+
border-radius: var(--zui-radius-md);
|
|
143
|
+
}`;
|
|
144
|
+
case "DatePickerStyle":
|
|
145
|
+
return css.replace(
|
|
146
|
+
".zui-date-picker__surface {\n width: auto;",
|
|
147
|
+
".zui-popover.zui-date-picker__surface {\n width: max-content;",
|
|
148
|
+
);
|
|
99
149
|
default:
|
|
100
150
|
return css;
|
|
101
151
|
}
|
package/src/typecheck.ts
CHANGED
|
@@ -98,6 +98,10 @@ async function discoverPackageConfigs(root: string): Promise<string[]> {
|
|
|
98
98
|
break;
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
+
const oxlintConfigPath = path.join(pkgDir, "tsconfig.oxlint.json");
|
|
102
|
+
if (await fileExists(oxlintConfigPath)) {
|
|
103
|
+
configs.push(oxlintConfigPath);
|
|
104
|
+
}
|
|
101
105
|
}
|
|
102
106
|
return configs;
|
|
103
107
|
}
|
|
@@ -122,7 +126,7 @@ async function discoverAppConfigs(root: string, appFilter?: string): Promise<str
|
|
|
122
126
|
const config = path.join(appDir, "tsconfig.json");
|
|
123
127
|
if (!(await fileExists(config))) continue;
|
|
124
128
|
// Run outside ENOENT guard so CSS Module type generation failures surface instead of silently skipping.
|
|
125
|
-
await syncCssModuleTypes(appDir,
|
|
129
|
+
await syncCssModuleTypes({ appDirectory: appDir, project: config });
|
|
126
130
|
configs.push(config);
|
|
127
131
|
}
|
|
128
132
|
}
|
|
@@ -130,7 +134,7 @@ async function discoverAppConfigs(root: string, appFilter?: string): Promise<str
|
|
|
130
134
|
const directDir = path.resolve(root, appFilter);
|
|
131
135
|
const directConfig = path.join(directDir, "tsconfig.json");
|
|
132
136
|
if (await fileExists(directConfig)) {
|
|
133
|
-
await syncCssModuleTypes(directDir,
|
|
137
|
+
await syncCssModuleTypes({ appDirectory: directDir, project: directConfig });
|
|
134
138
|
configs.push(directConfig);
|
|
135
139
|
} else {
|
|
136
140
|
throw new Error(`No app tsconfig.json found for --app ${appFilter}`);
|
package/src/validate.ts
CHANGED
|
@@ -53,6 +53,10 @@ const globals = new Set([
|
|
|
53
53
|
"ArrayBuffer",
|
|
54
54
|
"SharedArrayBuffer",
|
|
55
55
|
"DataView",
|
|
56
|
+
"URL",
|
|
57
|
+
"URLSearchParams",
|
|
58
|
+
"TextEncoder",
|
|
59
|
+
"TextDecoder",
|
|
56
60
|
"Atomics",
|
|
57
61
|
"JSON",
|
|
58
62
|
"Promise",
|
|
@@ -1048,14 +1052,18 @@ export function validateGraph(
|
|
|
1048
1052
|
const signals = graph.modules.filter(input =>
|
|
1049
1053
|
/\/@solidjs\/signals\/dist\/(?:(?:prod|observe)\/index|dev)\.js$/.test(input),
|
|
1050
1054
|
);
|
|
1051
|
-
if (runtimes.length
|
|
1055
|
+
if (runtimes.length > 1 || signals.length > 1) {
|
|
1056
|
+
const details = [
|
|
1057
|
+
...(runtimes.length > 1 ? [`solid-js: ${runtimes.join(", ")}`] : []),
|
|
1058
|
+
...(signals.length > 1 ? [`@solidjs/signals: ${signals.join(", ")}`] : []),
|
|
1059
|
+
];
|
|
1052
1060
|
throw new Error(
|
|
1053
|
-
`Expected
|
|
1061
|
+
`Expected single Solid runtime instances, found solid=${runtimes.length}, signals=${signals.length} (${details.join("; ")})`,
|
|
1054
1062
|
);
|
|
1055
1063
|
}
|
|
1056
|
-
if (runtimes.length
|
|
1064
|
+
if (runtimes.length !== 1 && signals.length !== 1) {
|
|
1057
1065
|
throw new Error(
|
|
1058
|
-
`Expected
|
|
1066
|
+
`Expected one reactive Solid runtime, found solid=${runtimes.length}, signals=${signals.length}`,
|
|
1059
1067
|
);
|
|
1060
1068
|
}
|
|
1061
1069
|
for (const input of graph.modules) {
|