@octane-xplat/build 0.0.0-nightly.g1b95ef7
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/LICENSE +21 -0
- package/README.md +5 -0
- package/dist/add-worker.js +66 -0
- package/dist/build-worker.js +287 -0
- package/dist/compatibility-check.js +155 -0
- package/dist/compatibility-data/compatibility.js +109 -0
- package/dist/compatibility-data/compatibility.json +298 -0
- package/dist/compatibility.js +240 -0
- package/dist/css-platform.js +236 -0
- package/dist/css-platform.types.d.ts +11 -0
- package/dist/dev-inspector.web.js +125 -0
- package/dist/dev-log-client.web.js +79 -0
- package/dist/dev-log-server.js +13 -0
- package/dist/devtools-worker.js +94 -0
- package/dist/doctor-checks.js +414 -0
- package/dist/doctor-tool.js +27 -0
- package/dist/env.js +3 -0
- package/dist/fmt-plan.js +149 -0
- package/dist/fonts-worker.js +31 -0
- package/dist/fonts.js +614 -0
- package/dist/inline-stylesheets.js +44 -0
- package/dist/linux/config.js +43 -0
- package/dist/linux/gtk-runtime.js +86 -0
- package/dist/linux/package.js +189 -0
- package/dist/linux-gtk/bindings.mjs +675 -0
- package/dist/linux-gtk/native-gi-projection.js +36 -0
- package/dist/linux-gtk/vite.d.ts +39 -0
- package/dist/linux-gtk/vite.js +281 -0
- package/dist/macos/config.js +136 -0
- package/dist/macos/core-ui.js +59 -0
- package/dist/macos/core-vite.js +122 -0
- package/dist/macos/doctor-checks.js +58 -0
- package/dist/macos/executables.js +39 -0
- package/dist/macos/jsc-host/runtime.js +134 -0
- package/dist/macos/native.js +286 -0
- package/dist/macos/runtime-package.js +30 -0
- package/dist/macos/tab-item.js +62 -0
- package/dist/macos/vite.d.ts +13 -0
- package/dist/macos/vite.js +22 -0
- package/dist/markdown.js +11 -0
- package/dist/mason-engine.js +20 -0
- package/dist/mcp/contracts/actions.js +133 -0
- package/dist/mcp/dev-bridge.js +363 -0
- package/dist/mcp/dev-socket.js +203 -0
- package/dist/mcp/dev-stack.js +134 -0
- package/dist/mcp/inspection/dom.web.js +46 -0
- package/dist/native-regex.js +123 -0
- package/dist/package-manager.js +106 -0
- package/dist/package-root.js +48 -0
- package/dist/patches.js +356 -0
- package/dist/route-config.js +53 -0
- package/dist/route-data.js +42 -0
- package/dist/route-generator.js +514 -0
- package/dist/route-path.js +29 -0
- package/dist/route-source.js +67 -0
- package/dist/targets.js +37 -0
- package/dist/tsconfig-envs.js +400 -0
- package/dist/tsconfig-pin.js +31 -0
- package/dist/tsrx-leaf.js +57 -0
- package/dist/typecheck-globals/macos.d.ts +21 -0
- package/dist/typecheck-globals/native.d.ts +42 -0
- package/dist/ui/src/markdown/markdown-ast.js +33 -0
- package/dist/ui/src/markdown/markdown-character-references.js +79 -0
- package/dist/ui/src/markdown/markdown-parse.js +1930 -0
- package/dist/ui/src/markdown/markdown-plugins.js +564 -0
- package/dist/ui/src/markdown/markdown-url.js +17 -0
- package/dist/updates-worker.js +34 -0
- package/dist/upgrade-worker.js +63 -0
- package/dist/vite-target.js +57 -0
- package/dist/vite.d.ts +125 -0
- package/dist/vite.js +797 -0
- package/dist/workshop-worker.js +181 -0
- package/package.json +74 -0
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import { packageManagerExec, packageManagerFor } from "./package-manager.js";
|
|
2
|
+
import { inspectCompatibility } from "./compatibility-check.js";
|
|
3
|
+
import { workspaceRoot } from "./compatibility.js";
|
|
4
|
+
import { runDoctorTool } from "./doctor-tool.js";
|
|
5
|
+
import { hasLinux, hasMacOS, hasNative, hasWindows, nsPlatforms } from "./targets.js";
|
|
6
|
+
import { inspectPatches, patchStateDetail } from "./patches.js";
|
|
7
|
+
import { inspectLinuxPackageConfig } from "./linux/config.js";
|
|
8
|
+
import { installedGtkRuntimeRoot } from "./linux/gtk-runtime.js";
|
|
9
|
+
import { installedPackageRoot } from "./package-root.js";
|
|
10
|
+
import { existsSync, readFileSync, readdirSync, realpathSync } from "node:fs";
|
|
11
|
+
import { dirname, join, parse, relative, resolve, sep } from "node:path";
|
|
12
|
+
// ../cli/src/doctor-checks.ts
|
|
13
|
+
var frameworkFallbacks = { "@octane-xplat/ui": [] };
|
|
14
|
+
var nativePlugin = (name) => (name.startsWith("@nativescript/") || name.startsWith("@nativescript-community/") || name.startsWith("nativescript-")) && !name.endsWith("/octane") && !name.endsWith("/core");
|
|
15
|
+
var readJson = (file) => {
|
|
16
|
+
try {
|
|
17
|
+
return JSON.parse(readFileSync(file, "utf8"));
|
|
18
|
+
} catch {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
var packageName = (specifier) => {
|
|
23
|
+
if (!specifier.startsWith("@") && !specifier.includes("/")) return specifier;
|
|
24
|
+
const parts = specifier.split("/");
|
|
25
|
+
return specifier.startsWith("@") ? parts.slice(0, 2).join("/") : parts[0];
|
|
26
|
+
};
|
|
27
|
+
var importSpecifiers = (source) => {
|
|
28
|
+
const specs = /* @__PURE__ */ new Set();
|
|
29
|
+
for (const pattern of [
|
|
30
|
+
/\bfrom\s*['"]([^'"]+)['"]/g,
|
|
31
|
+
/\bimport\s*['"]([^'"]+)['"]/g,
|
|
32
|
+
/\bimport\s*\(\s*['"]([^'"]+)['"]\s*\)/g
|
|
33
|
+
]) for (const match of source.matchAll(pattern)) specs.add(match[1]);
|
|
34
|
+
return specs;
|
|
35
|
+
};
|
|
36
|
+
/** Platform tags a native bundle can ship — mirrors the bundler's per-target
|
|
37
|
+
* allowlist (`boundaryAllowed` in vite.ts). A leaf tagged for a platform this
|
|
38
|
+
* app cannot build never joins its graphs, so its imports are not HMR scope. */
|
|
39
|
+
var nativeTagAllowlist = (cwd) => {
|
|
40
|
+
const perPlatform = {
|
|
41
|
+
ios: [
|
|
42
|
+
"ios",
|
|
43
|
+
"android",
|
|
44
|
+
"mobile"
|
|
45
|
+
],
|
|
46
|
+
android: [
|
|
47
|
+
"ios",
|
|
48
|
+
"android",
|
|
49
|
+
"mobile"
|
|
50
|
+
],
|
|
51
|
+
windows: ["windows"],
|
|
52
|
+
native: [
|
|
53
|
+
"ios",
|
|
54
|
+
"android",
|
|
55
|
+
"mobile",
|
|
56
|
+
"windows"
|
|
57
|
+
]
|
|
58
|
+
};
|
|
59
|
+
const platforms = nsPlatforms(cwd);
|
|
60
|
+
const tags = /* @__PURE__ */ new Set();
|
|
61
|
+
for (const platform of platforms.length ? platforms : ["native"]) for (const tag of perPlatform[platform] ?? []) tags.add(tag);
|
|
62
|
+
return tags;
|
|
63
|
+
};
|
|
64
|
+
var PLATFORM_TAG = /\.(web|mobile|ios|android|macos|windows|linux|gtk)\.[^./\\]+$/;
|
|
65
|
+
/** Platform-scoped subtrees inside a source root follow the file-suffix
|
|
66
|
+
* convention: `src/web`, `src/macos`, … hold leaves for that platform. */
|
|
67
|
+
var PLATFORM_DIRS = /* @__PURE__ */ new Set([
|
|
68
|
+
"web",
|
|
69
|
+
"macos",
|
|
70
|
+
"windows",
|
|
71
|
+
"linux",
|
|
72
|
+
"gtk"
|
|
73
|
+
]);
|
|
74
|
+
/** Trees that never ship app runtime code; their imports are not bundle edges. */
|
|
75
|
+
var NON_RUNTIME_DIRS = /* @__PURE__ */ new Set([
|
|
76
|
+
"node_modules",
|
|
77
|
+
"test",
|
|
78
|
+
"tests",
|
|
79
|
+
"e2e",
|
|
80
|
+
"fixtures",
|
|
81
|
+
"__tests__",
|
|
82
|
+
"dist",
|
|
83
|
+
"types",
|
|
84
|
+
"scripts",
|
|
85
|
+
"template",
|
|
86
|
+
"templates"
|
|
87
|
+
]);
|
|
88
|
+
/** Declarations and tests produce no runtime bundle edges. */
|
|
89
|
+
var NON_RUNTIME_FILE = /\.d\.ts$|[.-](?:test|spec)\.[^.]+$/;
|
|
90
|
+
var sourceFiles = (root, tags) => {
|
|
91
|
+
if (!existsSync(root)) return [];
|
|
92
|
+
const out = [];
|
|
93
|
+
const visit = (dir) => {
|
|
94
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
95
|
+
if (entry.name.startsWith(".") || NON_RUNTIME_DIRS.has(entry.name)) continue;
|
|
96
|
+
const file = join(dir, entry.name);
|
|
97
|
+
if (entry.isDirectory()) {
|
|
98
|
+
if (!PLATFORM_DIRS.has(entry.name) || !tags || tags.has(entry.name)) visit(file);
|
|
99
|
+
} else if (/\.(?:m?[jt]sx?|tsrx)$/.test(entry.name) && !NON_RUNTIME_FILE.test(entry.name)) {
|
|
100
|
+
const tag = PLATFORM_TAG.exec(entry.name)?.[1];
|
|
101
|
+
if (!tag || !tags || tags.has(tag)) out.push(file);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
visit(root);
|
|
106
|
+
return out;
|
|
107
|
+
};
|
|
108
|
+
/** Workspace-package runtime source lives under src/ when the package has one —
|
|
109
|
+
* config, test and generated trees beside it never reach an app bundle. */
|
|
110
|
+
var packageSourceFiles = (root, tags) => {
|
|
111
|
+
const src = join(root, "src");
|
|
112
|
+
return sourceFiles(existsSync(src) ? src : root, tags);
|
|
113
|
+
};
|
|
114
|
+
var workspacePackages = (cwd) => {
|
|
115
|
+
const found = /* @__PURE__ */ new Map();
|
|
116
|
+
let dir = resolve(cwd);
|
|
117
|
+
while (true) {
|
|
118
|
+
for (const group of [
|
|
119
|
+
"apps",
|
|
120
|
+
"packages",
|
|
121
|
+
"tools"
|
|
122
|
+
]) {
|
|
123
|
+
const parent = join(dir, group);
|
|
124
|
+
if (!existsSync(parent)) continue;
|
|
125
|
+
for (const name of readdirSync(parent)) {
|
|
126
|
+
const root = join(parent, name);
|
|
127
|
+
const manifest = readJson(join(root, "package.json"));
|
|
128
|
+
if (manifest?.name) found.set(manifest.name, root);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
const next = dirname(dir);
|
|
132
|
+
if (next === dir) break;
|
|
133
|
+
dir = next;
|
|
134
|
+
}
|
|
135
|
+
return found;
|
|
136
|
+
};
|
|
137
|
+
var packageRoot = (cwd, name, workspaces) => {
|
|
138
|
+
return installedPackageRoot(cwd, name) ?? workspaces.get(name);
|
|
139
|
+
};
|
|
140
|
+
var frameworkPlugins = (cwd, name, workspaces) => {
|
|
141
|
+
const root = packageRoot(cwd, name, workspaces);
|
|
142
|
+
const manifest = root && readJson(join(root, "package.json"));
|
|
143
|
+
const declared = Object.keys(manifest?.peerDependencies ?? {}).filter(nativePlugin);
|
|
144
|
+
return declared.length ? declared : frameworkFallbacks[name] ?? [];
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Find native plugins required by the framework packages reachable from an app
|
|
148
|
+
* source tree, then compare them with the app's own package.json. This is a
|
|
149
|
+
* warning because the web target does not need native plugin declarations and
|
|
150
|
+
* a package may intentionally keep an optional native capability unused.
|
|
151
|
+
*/
|
|
152
|
+
function findMissingPluginDeclarations(cwd) {
|
|
153
|
+
const manifest = readJson(join(cwd, "package.json")) ?? {};
|
|
154
|
+
const owned = /* @__PURE__ */ new Set([
|
|
155
|
+
...Object.keys(manifest.dependencies ?? {}),
|
|
156
|
+
...Object.keys(manifest.devDependencies ?? {}),
|
|
157
|
+
...Object.keys(manifest.optionalDependencies ?? {}),
|
|
158
|
+
...Object.keys(manifest.peerDependencies ?? {})
|
|
159
|
+
]);
|
|
160
|
+
const workspaces = workspacePackages(cwd);
|
|
161
|
+
const tags = nativeTagAllowlist(cwd);
|
|
162
|
+
const pending = sourceFiles(join(cwd, "src"), tags);
|
|
163
|
+
for (const dir of ["app", "src/app"]) pending.push(...sourceFiles(join(cwd, dir), tags));
|
|
164
|
+
const visited = /* @__PURE__ */ new Set();
|
|
165
|
+
const frameworks = /* @__PURE__ */ new Map();
|
|
166
|
+
const eligible = /* @__PURE__ */ new Map();
|
|
167
|
+
while (pending.length) {
|
|
168
|
+
const file = pending.pop();
|
|
169
|
+
if (visited.has(file)) continue;
|
|
170
|
+
visited.add(file);
|
|
171
|
+
let source;
|
|
172
|
+
try {
|
|
173
|
+
source = readFileSync(file, "utf8");
|
|
174
|
+
} catch {
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
for (const specifier of importSpecifiers(source)) {
|
|
178
|
+
const name = packageName(specifier);
|
|
179
|
+
if (frameworkFallbacks[name]) {
|
|
180
|
+
if (!frameworks.has(name)) frameworks.set(name, /* @__PURE__ */ new Set());
|
|
181
|
+
frameworks.get(name).add(relative(cwd, file) || parse(file).base);
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
const root = packageRoot(cwd, name, workspaces);
|
|
185
|
+
if (root && workspaces.has(name)) {
|
|
186
|
+
if (!eligible.has(name)) eligible.set(name, packageSourceFiles(root, tags));
|
|
187
|
+
pending.push(...eligible.get(name));
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
const missing = /* @__PURE__ */ new Map();
|
|
192
|
+
for (const [framework] of frameworks) for (const plugin of frameworkPlugins(cwd, framework, workspaces)) if (!owned.has(plugin)) {
|
|
193
|
+
if (!missing.has(plugin)) missing.set(plugin, /* @__PURE__ */ new Set());
|
|
194
|
+
missing.get(plugin).add(framework);
|
|
195
|
+
}
|
|
196
|
+
return [...missing.entries()].sort(([a], [b]) => a.localeCompare(b)).map(([plugin, frameworks]) => ({
|
|
197
|
+
plugin,
|
|
198
|
+
frameworks: [...frameworks].sort()
|
|
199
|
+
}));
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* @nativescript/vite scopes HMR to the app source dir plus the roots named in
|
|
203
|
+
* the app's tsconfig `paths` — a workspace package imported but absent from
|
|
204
|
+
* `paths` still builds and serves, but edits to it never reach `handleHotUpdate`
|
|
205
|
+
* and the save is dropped silently. Warn when that gap exists. Only files that
|
|
206
|
+
* can join the app's bundles count: tests, declarations, configs and leaves for
|
|
207
|
+
* platforms the app does not target are not HMR scope.
|
|
208
|
+
*/
|
|
209
|
+
function findHmrScopeGaps(cwd) {
|
|
210
|
+
if (!existsSync(join(cwd, "nativescript.config.ts"))) return [];
|
|
211
|
+
const tsconfig = readJson(join(cwd, "tsconfig.json"));
|
|
212
|
+
let paths = tsconfig?.compilerOptions?.paths;
|
|
213
|
+
if (!paths && typeof tsconfig?.extends === "string") paths = readJson(join(cwd, tsconfig.extends))?.compilerOptions?.paths ?? void 0;
|
|
214
|
+
if (!paths) return [];
|
|
215
|
+
const workspaces = workspacePackages(cwd);
|
|
216
|
+
if (workspaces.size === 0) return [];
|
|
217
|
+
const covered = new Set(Object.keys(paths).map((k) => k.replace(/\/?\*$/, "")));
|
|
218
|
+
const tags = nativeTagAllowlist(cwd);
|
|
219
|
+
const pending = [
|
|
220
|
+
...sourceFiles(join(cwd, "src"), tags),
|
|
221
|
+
...sourceFiles(join(cwd, "app"), tags),
|
|
222
|
+
...sourceFiles(join(cwd, "src/app"), tags)
|
|
223
|
+
];
|
|
224
|
+
const visited = /* @__PURE__ */ new Set();
|
|
225
|
+
const gaps = /* @__PURE__ */ new Set();
|
|
226
|
+
const eligible = /* @__PURE__ */ new Map();
|
|
227
|
+
while (pending.length) {
|
|
228
|
+
const file = pending.pop();
|
|
229
|
+
if (visited.has(file)) continue;
|
|
230
|
+
visited.add(file);
|
|
231
|
+
let source;
|
|
232
|
+
try {
|
|
233
|
+
source = readFileSync(file, "utf8");
|
|
234
|
+
} catch {
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
for (const specifier of importSpecifiers(source)) {
|
|
238
|
+
const name = packageName(specifier);
|
|
239
|
+
const root = workspaces.get(name);
|
|
240
|
+
if (!root) continue;
|
|
241
|
+
if (!eligible.has(name)) eligible.set(name, packageSourceFiles(root, tags));
|
|
242
|
+
const files = eligible.get(name);
|
|
243
|
+
if (!covered.has(name) && files.length) gaps.add(name);
|
|
244
|
+
pending.push(...files);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
return [...gaps].sort();
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* A native app dependency whose install realpaths outside the app root — a
|
|
251
|
+
* `link:`/`file:`/`portal:` checkout — resolves `@nativescript/core` from that
|
|
252
|
+
* checkout's own node_modules during typechecks, producing a second type
|
|
253
|
+
* identity (issue #66). The app's tsconfig must pin core to its own copy;
|
|
254
|
+
* names the first linked dependency found, or null.
|
|
255
|
+
*/
|
|
256
|
+
function findLinkedCoreTypeGap(cwd) {
|
|
257
|
+
if (!existsSync(join(cwd, "nativescript.config.ts"))) return null;
|
|
258
|
+
const tsconfig = readJson(join(cwd, "tsconfig.json"));
|
|
259
|
+
let paths = tsconfig?.compilerOptions?.paths;
|
|
260
|
+
if (!paths && typeof tsconfig?.extends === "string") paths = readJson(join(cwd, tsconfig.extends))?.compilerOptions?.paths ?? void 0;
|
|
261
|
+
if (paths?.["@nativescript/core"]) return null;
|
|
262
|
+
const manifest = readJson(join(cwd, "package.json")) ?? {};
|
|
263
|
+
const declared = /* @__PURE__ */ new Set([
|
|
264
|
+
...Object.keys(manifest.dependencies ?? {}),
|
|
265
|
+
...Object.keys(manifest.devDependencies ?? {}),
|
|
266
|
+
...Object.keys(manifest.optionalDependencies ?? {}),
|
|
267
|
+
...Object.keys(manifest.peerDependencies ?? {})
|
|
268
|
+
]);
|
|
269
|
+
const root = realpathSync(workspaceRoot(cwd));
|
|
270
|
+
for (const name of declared) {
|
|
271
|
+
const location = installedPackageRoot(cwd, name);
|
|
272
|
+
if (location && location !== root && !location.startsWith(root + sep)) return name;
|
|
273
|
+
}
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
276
|
+
/** Canonical diagnostic policy; presentation and process ownership belong to callers.
|
|
277
|
+
* This operation may run project-installed declaration tools. It never installs
|
|
278
|
+
* dependencies, launches an application, or claims that tool presence is a runtime pass.
|
|
279
|
+
*/
|
|
280
|
+
async function inspectDoctor({ onMessage, macosChecks } = {}) {
|
|
281
|
+
const messages = [];
|
|
282
|
+
const message = (level, text) => {
|
|
283
|
+
const value = {
|
|
284
|
+
level,
|
|
285
|
+
text
|
|
286
|
+
};
|
|
287
|
+
messages.push(value);
|
|
288
|
+
onMessage?.(value);
|
|
289
|
+
};
|
|
290
|
+
const cwd = process.cwd();
|
|
291
|
+
const rows = [];
|
|
292
|
+
const row = (name, ok, detail, hint) => rows.push({
|
|
293
|
+
name,
|
|
294
|
+
ok,
|
|
295
|
+
detail,
|
|
296
|
+
hint
|
|
297
|
+
});
|
|
298
|
+
const native = hasNative(cwd);
|
|
299
|
+
const macos = hasMacOS(cwd);
|
|
300
|
+
const manifest = readJson(join(cwd, "package.json")) ?? {};
|
|
301
|
+
let compatibilityFailed = false;
|
|
302
|
+
try {
|
|
303
|
+
const compatibilityRows = inspectCompatibility(cwd);
|
|
304
|
+
rows.push(...compatibilityRows);
|
|
305
|
+
compatibilityFailed = compatibilityRows.some((r) => !r.ok);
|
|
306
|
+
} catch (error) {
|
|
307
|
+
row("compatibility", false, error.message, "fix the package/workspace metadata and rerun xplat doctor");
|
|
308
|
+
compatibilityFailed = true;
|
|
309
|
+
}
|
|
310
|
+
let declarationPackCheckFailed = false;
|
|
311
|
+
let declarationPackCheckOutput = "";
|
|
312
|
+
if (existsSync(join(cwd, "tsrx-typegen.json"))) {
|
|
313
|
+
const declarations = runDoctorTool(packageManagerFor(cwd), packageManagerExec(cwd, ["tsrx-typegen", "--pack-check"]).args, cwd, 12e4);
|
|
314
|
+
row("tsrx package declarations", declarations.ok, declarations.out, "run bun run tsrx-typegen --pack-check and resolve the reported package issue");
|
|
315
|
+
declarationPackCheckFailed = !declarations.ok;
|
|
316
|
+
declarationPackCheckOutput = declarations.out;
|
|
317
|
+
}
|
|
318
|
+
row("node", runDoctorTool("node", ["--version"]).ok, runDoctorTool("node", ["--version"]).out);
|
|
319
|
+
const manager = packageManagerFor(cwd);
|
|
320
|
+
row(manager, runDoctorTool(manager, ["--version"]).ok, runDoctorTool(manager, ["--version"]).out);
|
|
321
|
+
if (native) {
|
|
322
|
+
row("ns CLI", runDoctorTool(packageManagerFor(cwd), packageManagerExec(cwd, ["ns", "--version"]).args, cwd).ok, runDoctorTool(packageManagerFor(cwd), packageManagerExec(cwd, ["ns", "--version"]).args, cwd).out, "add the nativescript devDep (the starter ships it)");
|
|
323
|
+
row("xcodebuild", runDoctorTool("xcodebuild", ["-version"]).ok, runDoctorTool("xcodebuild", ["-version"]).out, "iOS needs Xcode — App Store install + xcode-select");
|
|
324
|
+
row("xcodeproj gem", runDoctorTool("ruby", ["-e", "require \"xcodeproj\""]).ok, "", "gem install --user-install xcodeproj");
|
|
325
|
+
const sims = runDoctorTool("xcrun", [
|
|
326
|
+
"simctl",
|
|
327
|
+
"list",
|
|
328
|
+
"devices",
|
|
329
|
+
"booted"
|
|
330
|
+
]);
|
|
331
|
+
row("iOS simulator", sims.ok, sims.out || "none booted");
|
|
332
|
+
const adb = runDoctorTool("adb", ["devices"]);
|
|
333
|
+
const devices = adb.ok ? adb.out.split("\n").slice(1).filter((l) => l.includes(" device")).length : 0;
|
|
334
|
+
row("adb", adb.ok, `${devices} device(s)`, "Android SDK platform-tools on PATH");
|
|
335
|
+
row("ANDROID_HOME", !!process.env.ANDROID_HOME, process.env.ANDROID_HOME || "unset", "export ANDROID_HOME=$HOME/Library/Android/sdk");
|
|
336
|
+
row("JAVA_HOME", !!process.env.JAVA_HOME, process.env.JAVA_HOME || "unset", "JDK 17 (JDK 25 breaks the Android toolchain)");
|
|
337
|
+
}
|
|
338
|
+
if (macos) {
|
|
339
|
+
const platformRows = macosChecks ? await macosChecks() : await (await import("./macos/doctor-checks.js")).inspectMacOSDoctor(cwd, manifest);
|
|
340
|
+
rows.push(...platformRows);
|
|
341
|
+
}
|
|
342
|
+
if (hasLinux(cwd)) {
|
|
343
|
+
const config = inspectLinuxPackageConfig(cwd);
|
|
344
|
+
row("Linux packaging config", config.issues.length === 0, config.issues.join("; ") || config.applicationId, config.issues.join("; "));
|
|
345
|
+
const tar = runDoctorTool("tar", ["--version"]);
|
|
346
|
+
row("Linux archive tool", tar.ok, tar.out, "install tar");
|
|
347
|
+
const gtk = config.runtime === "gtk";
|
|
348
|
+
const gtkPayloads = gtk ? installedGtkRuntimeRoot(cwd) : null;
|
|
349
|
+
const installGtkPayloads = "install matching releases of @octane-xplat/cli and @octane-xplat/linux-gtk";
|
|
350
|
+
if (gtk) row("Linux GTK payloads", !!gtkPayloads, gtkPayloads ?? "missing NativeScript runtime", installGtkPayloads);
|
|
351
|
+
if (process.platform === "linux") {
|
|
352
|
+
if (gtk && gtkPayloads) {
|
|
353
|
+
const architecture = process.arch === "x64" ? "x86_64" : process.arch === "arm64" ? "aarch64" : null;
|
|
354
|
+
const runtime = architecture ? join(gtkPayloads, architecture) : null;
|
|
355
|
+
const result = runtime ? runDoctorTool("env", [
|
|
356
|
+
`ICU_DATA=${join(runtime, "icu")}`,
|
|
357
|
+
join(runtime, "ns-linux"),
|
|
358
|
+
"-e",
|
|
359
|
+
`const major = gtk_get_major_version(), minor = gtk_get_minor_version();
|
|
360
|
+
if (major !== 4 || minor < 14) throw Error('GTK 4.14+ required');
|
|
361
|
+
const mason = xplat_mason_engine_new();
|
|
362
|
+
if (!mason) throw Error('Mason could not allocate an engine');
|
|
363
|
+
xplat_mason_engine_free(mason);
|
|
364
|
+
console.log('NativeScript with GTK ' + major + '.' + minor);`
|
|
365
|
+
], cwd) : {
|
|
366
|
+
ok: false,
|
|
367
|
+
out: `unsupported architecture: ${process.arch}`
|
|
368
|
+
};
|
|
369
|
+
row("Linux runtime", result.ok, result.out, "install libgtk-4-1 (GTK 4.14+) and libjson-glib-1.0-0");
|
|
370
|
+
}
|
|
371
|
+
row("Linux graphical session", !!(process.env.DISPLAY || process.env.WAYLAND_DISPLAY), process.env.DISPLAY || process.env.WAYLAND_DISPLAY || "unset", "run in a desktop session or use xvfb-run for automated tests");
|
|
372
|
+
row("Linux session bus", !!process.env.DBUS_SESSION_BUS_ADDRESS, process.env.DBUS_SESSION_BUS_ADDRESS ? "configured" : "unset", "run in a desktop session or dbus-run-session");
|
|
373
|
+
} else message("info", "Linux archive can be built here. Verify the NativeScript/GTK4 runtime on Linux.");
|
|
374
|
+
}
|
|
375
|
+
for (const patch of inspectPatches(workspaceRoot(cwd))) {
|
|
376
|
+
if (patch.state === "not-declared" || patch.state === "not-applicable") continue;
|
|
377
|
+
row(`patch ${patch.specifier}`, patch.state === "applied", patchStateDetail(patch.state), patch.state === "not-installed" ? "run `bun install`" : "run `xplat patches apply`");
|
|
378
|
+
}
|
|
379
|
+
if (hasWindows(cwd)) {
|
|
380
|
+
const winHost = process.platform === "win32";
|
|
381
|
+
row("Windows host", winHost, process.platform, "the WinUI 3 target builds and runs only on Windows 10 1809+");
|
|
382
|
+
const windowsRuntimeVersion = manifest.devDependencies?.["@nativescript/windows"] ?? manifest.dependencies?.["@nativescript/windows"];
|
|
383
|
+
row("@nativescript/windows", typeof windowsRuntimeVersion === "string" && !/[\^~]/.test(windowsRuntimeVersion), windowsRuntimeVersion ?? "not declared", "pin an exact version — ranges match incompatible older prereleases");
|
|
384
|
+
if (winHost) {
|
|
385
|
+
const dotnet = runDoctorTool("dotnet", ["--version"]);
|
|
386
|
+
const dotnetMajor = parseInt(dotnet.out ?? "", 10);
|
|
387
|
+
row(".NET SDK", dotnet.ok && dotnetMajor >= 10, dotnet.out || "not found", "install the .NET 10 SDK — the WinUI 3 host builds with dotnet build");
|
|
388
|
+
const devMode = runDoctorTool("powershell", [
|
|
389
|
+
"-NoProfile",
|
|
390
|
+
"-Command",
|
|
391
|
+
"(Get-ItemProperty \"HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\AppModelUnlock\" -Name AllowDevelopmentWithoutDevLicense -ErrorAction SilentlyContinue).AllowDevelopmentWithoutDevLicense"
|
|
392
|
+
]);
|
|
393
|
+
row("Developer Mode", devMode.ok && devMode.out?.trim() === "1", devMode.ok ? `AllowDevelopmentWithoutDevLicense=${devMode.out?.trim() || "unset"}` : "unverified", "enable Settings → For developers → Developer Mode, or signed MSIX packaging");
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
const pluginWarnings = native ? findMissingPluginDeclarations(cwd) : [];
|
|
397
|
+
for (const { plugin, frameworks } of pluginWarnings) message("warn", `native plugin declaration — ${plugin} is required by ${frameworks.join(", ")}; add it to this app's package.json`);
|
|
398
|
+
const scopeGaps = native ? findHmrScopeGaps(cwd) : [];
|
|
399
|
+
for (const name of scopeGaps) message("warn", `HMR scope — ${name} is imported but missing from tsconfig paths; native hot updates silently skip its files`);
|
|
400
|
+
const linkedCoreGap = native ? findLinkedCoreTypeGap(cwd) : null;
|
|
401
|
+
if (linkedCoreGap) message("warn", `linked dependency — ${linkedCoreGap} resolves outside this app's install; pin "@nativescript/core" and "@nativescript/core/*" to "./node_modules/@nativescript/core…" in tsconfig paths or linked checkouts typecheck a second core copy`);
|
|
402
|
+
const bad = rows.filter((row) => !row.ok).length;
|
|
403
|
+
const summary = bad === 0 ? "All checks pass" : `${bad} check(s) need attention — see the missing items above`;
|
|
404
|
+
return {
|
|
405
|
+
rows,
|
|
406
|
+
messages,
|
|
407
|
+
pluginWarnings,
|
|
408
|
+
scopeGaps,
|
|
409
|
+
summary: pluginWarnings.length ? `${summary}; ${pluginWarnings.length} native plugin declaration warning(s)` : summary,
|
|
410
|
+
exitCode: compatibilityFailed || declarationPackCheckFailed || rows.some((row) => row.name.startsWith("Linux ") && !row.ok) ? 1 : 0,
|
|
411
|
+
diagnosticStderr: declarationPackCheckOutput
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
export { findHmrScopeGaps, findLinkedCoreTypeGap, findMissingPluginDeclarations, inspectDoctor };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
// ../cli/src/doctor-tool.ts
|
|
3
|
+
var runDoctorTool = (cmd, args, cwd = process.cwd(), timeout = 15e3) => {
|
|
4
|
+
try {
|
|
5
|
+
const shell = process.platform === "win32" && ["bun", "pnpm"].includes(cmd) && args.length === 1 && args[0] === "--version";
|
|
6
|
+
return {
|
|
7
|
+
ok: true,
|
|
8
|
+
out: execFileSync(shell ? `${cmd} --version` : cmd, shell ? [] : args, {
|
|
9
|
+
shell,
|
|
10
|
+
encoding: "utf8",
|
|
11
|
+
cwd,
|
|
12
|
+
timeout,
|
|
13
|
+
stdio: [
|
|
14
|
+
"ignore",
|
|
15
|
+
"pipe",
|
|
16
|
+
"pipe"
|
|
17
|
+
]
|
|
18
|
+
}).trim().split("\n")[0]
|
|
19
|
+
};
|
|
20
|
+
} catch (error) {
|
|
21
|
+
return {
|
|
22
|
+
ok: false,
|
|
23
|
+
out: [error.stdout, error.stderr].filter(Boolean).join("\n").trim()
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export { runDoctorTool };
|
package/dist/env.js
ADDED
package/dist/fmt-plan.js
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { lstatSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
2
|
+
import { join, relative, resolve } from "node:path";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
import ignore from "ignore";
|
|
5
|
+
// ../cli/src/fmt-plan.ts
|
|
6
|
+
function sourceDigest(bytes) {
|
|
7
|
+
return createHash("sha256").update(bytes).digest("hex");
|
|
8
|
+
}
|
|
9
|
+
async function planFormat(cwd, inputs, stdin, loadFormatter) {
|
|
10
|
+
const formatter = await loadFormatter();
|
|
11
|
+
const plan = {
|
|
12
|
+
version: 1,
|
|
13
|
+
kind: stdin ? "stdin" : "files",
|
|
14
|
+
diagnostics: [],
|
|
15
|
+
files: []
|
|
16
|
+
};
|
|
17
|
+
const format = async (path, source) => {
|
|
18
|
+
const result = await formatter.formatText({
|
|
19
|
+
path,
|
|
20
|
+
source
|
|
21
|
+
});
|
|
22
|
+
if (!result.ok) {
|
|
23
|
+
if (!result.diagnostics.length) throw new Error("Formatter failed without diagnostics");
|
|
24
|
+
for (const d of result.diagnostics) {
|
|
25
|
+
const at = d.line === void 0 ? "" : `:${d.line}:${d.column ?? 1}`;
|
|
26
|
+
plan.diagnostics.push(`${d.path}${at}: ${d.stage} ${d.code} — ${d.message}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return result;
|
|
30
|
+
};
|
|
31
|
+
if (stdin) {
|
|
32
|
+
const result = await format(stdin.path, stdin.source);
|
|
33
|
+
if (result.ok) {
|
|
34
|
+
plan.code = result.code;
|
|
35
|
+
plan.changed = result.changed;
|
|
36
|
+
}
|
|
37
|
+
} else for (const file of collectFiles(cwd, inputs, formatter)) {
|
|
38
|
+
const bytes = readFileSync(file);
|
|
39
|
+
const stat = statSync(file);
|
|
40
|
+
const result = await format(relative(cwd, file) || file, bytes.toString("utf8"));
|
|
41
|
+
if (result.ok) plan.files.push({
|
|
42
|
+
file,
|
|
43
|
+
sourceSha256: sourceDigest(bytes),
|
|
44
|
+
mode: stat.mode,
|
|
45
|
+
code: result.code,
|
|
46
|
+
changed: result.changed
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
if (plan.diagnostics.length) plan.files = [];
|
|
50
|
+
return plan;
|
|
51
|
+
}
|
|
52
|
+
var EXTENSIONS = /* @__PURE__ */ new Set([
|
|
53
|
+
"js",
|
|
54
|
+
"mjs",
|
|
55
|
+
"cjs",
|
|
56
|
+
"jsx",
|
|
57
|
+
"ts",
|
|
58
|
+
"mts",
|
|
59
|
+
"cts",
|
|
60
|
+
"tsx",
|
|
61
|
+
"tsrx"
|
|
62
|
+
]);
|
|
63
|
+
var IGNORED_DIRS = /* @__PURE__ */ new Set([
|
|
64
|
+
".git",
|
|
65
|
+
".next",
|
|
66
|
+
".nx",
|
|
67
|
+
".turbo",
|
|
68
|
+
"build",
|
|
69
|
+
"coverage",
|
|
70
|
+
"dist",
|
|
71
|
+
"graft",
|
|
72
|
+
"node_modules",
|
|
73
|
+
"out",
|
|
74
|
+
"prior-art",
|
|
75
|
+
"release",
|
|
76
|
+
"tmp"
|
|
77
|
+
]);
|
|
78
|
+
function collectFiles(cwd, inputs, formatter) {
|
|
79
|
+
const ignores = new Gitignores();
|
|
80
|
+
ignores.load(cwd);
|
|
81
|
+
const files = /* @__PURE__ */ new Set();
|
|
82
|
+
const walkInto = function* (dir) {
|
|
83
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
84
|
+
const abs = join(dir, entry.name);
|
|
85
|
+
if (entry.isSymbolicLink()) continue;
|
|
86
|
+
if (entry.isDirectory()) {
|
|
87
|
+
if (IGNORED_DIRS.has(entry.name)) continue;
|
|
88
|
+
if (hasGitBoundary(abs)) continue;
|
|
89
|
+
if (ignores.isIgnored(abs)) continue;
|
|
90
|
+
ignores.load(abs);
|
|
91
|
+
yield* walkInto(abs);
|
|
92
|
+
} else if (entry.isFile()) {
|
|
93
|
+
const ext = entry.name.split(".").pop() ?? "";
|
|
94
|
+
if (EXTENSIONS.has(ext) && !ignores.isIgnored(abs)) yield abs;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
if (inputs.length === 0) {
|
|
99
|
+
for (const file of walkInto(cwd)) if (!formatter.shouldIgnore(file)) files.add(file);
|
|
100
|
+
} else for (const input of inputs) {
|
|
101
|
+
const abs = resolve(cwd, input);
|
|
102
|
+
let stat;
|
|
103
|
+
try {
|
|
104
|
+
stat = lstatSync(abs);
|
|
105
|
+
} catch {
|
|
106
|
+
throw new Error(`no such file or directory: ${input}`);
|
|
107
|
+
}
|
|
108
|
+
if (stat.isSymbolicLink()) throw new Error(`not following symlink: ${input}`);
|
|
109
|
+
if (stat.isDirectory()) {
|
|
110
|
+
for (const file of walkInto(abs)) if (!formatter.shouldIgnore(file)) files.add(file);
|
|
111
|
+
} else {
|
|
112
|
+
const ext = abs.split(".").pop() ?? "";
|
|
113
|
+
if (!EXTENSIONS.has(ext)) throw new Error(`unsupported extension .${ext}: ${input}`);
|
|
114
|
+
if (!formatter.shouldIgnore(abs)) files.add(abs);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return [...files].sort();
|
|
118
|
+
}
|
|
119
|
+
function hasGitBoundary(dir) {
|
|
120
|
+
try {
|
|
121
|
+
return readdirSync(dir).some((name) => name === ".git");
|
|
122
|
+
} catch {
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
var Gitignores = class {
|
|
127
|
+
constructor() {
|
|
128
|
+
this.matchers = /* @__PURE__ */ new Map();
|
|
129
|
+
}
|
|
130
|
+
load(dir) {
|
|
131
|
+
if (this.matchers.has(dir)) return;
|
|
132
|
+
let matcher = null;
|
|
133
|
+
try {
|
|
134
|
+
matcher = ignore().add(readFileSync(join(dir, ".gitignore"), "utf8"));
|
|
135
|
+
} catch {
|
|
136
|
+
matcher = null;
|
|
137
|
+
}
|
|
138
|
+
this.matchers.set(dir, matcher);
|
|
139
|
+
}
|
|
140
|
+
isIgnored(abs) {
|
|
141
|
+
for (const [dir, matcher] of this.matchers) {
|
|
142
|
+
if (!matcher) continue;
|
|
143
|
+
const rel = relative(dir, abs);
|
|
144
|
+
if (rel && !rel.startsWith("..") && matcher.ignores(rel)) return true;
|
|
145
|
+
}
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
export { planFormat, sourceDigest };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { planFontInputs } from "./fonts.js";
|
|
2
|
+
import { realpathSync } from "node:fs";
|
|
3
|
+
import { dirname } from "node:path";
|
|
4
|
+
// ../cli/src/fonts-worker.ts
|
|
5
|
+
async function fontOperation(request, requestFile) {
|
|
6
|
+
if (!Array.isArray(request.inputs) || request.inputs.length < 1 || request.inputs.length > 128 || request.inputs.some((value) => typeof value !== "string" || value.length === 0 || value.length > 8192)) throw new Error("Provide 1–128 font files or Fontsource packages");
|
|
7
|
+
const options = request.options;
|
|
8
|
+
if (!options || typeof options !== "object" || typeof options.install !== "boolean") throw new Error("Invalid font options");
|
|
9
|
+
for (const key of [
|
|
10
|
+
"name",
|
|
11
|
+
"token",
|
|
12
|
+
"subset"
|
|
13
|
+
]) if (options[key] !== void 0 && (typeof options[key] !== "string" || options[key].length > 8192)) throw new Error(`Invalid font ${key}`);
|
|
14
|
+
if (options.weights !== void 0 && (!Array.isArray(options.weights) || options.weights.length > 128 || options.weights.some((value) => !Number.isFinite(value)))) throw new Error("Invalid font weights");
|
|
15
|
+
const temporary = realpathSync(dirname(requestFile));
|
|
16
|
+
process.env.TMPDIR = temporary;
|
|
17
|
+
process.env.TEMP = temporary;
|
|
18
|
+
process.env.TMP = temporary;
|
|
19
|
+
const project = realpathSync(process.cwd());
|
|
20
|
+
try {
|
|
21
|
+
return {
|
|
22
|
+
version: 1,
|
|
23
|
+
project,
|
|
24
|
+
plan: await planFontInputs(project, request.inputs, options)
|
|
25
|
+
};
|
|
26
|
+
} catch (error) {
|
|
27
|
+
if (error.code === "ERR_MODULE_NOT_FOUND" && error.message.includes("wawoff2")) throw new Error("Install wawoff2@2.0.1 in the selected project for WOFF2 conversion (bun add --dev wawoff2@2.0.1)");
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export { fontOperation };
|