@octane-xplat/build 0.0.1 → 0.20.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.
- package/LICENSE +21 -0
- package/README.md +4 -2
- package/dist/add-worker.js +66 -0
- package/dist/build-worker.js +276 -0
- package/dist/compatibility-check.js +153 -0
- package/dist/compatibility-data/compatibility.js +106 -0
- package/dist/compatibility-data/compatibility.json +305 -0
- package/dist/compatibility.js +229 -0
- package/dist/css-layers.js +63 -0
- package/dist/css-platform.js +230 -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/doctor-checks.js +317 -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 +37 -0
- package/dist/linux/config.js +43 -0
- package/dist/linux/host/bridge-selftest.linux.js +255 -0
- package/dist/linux/host/gjs-host.js +1412 -0
- package/dist/linux/package.js +176 -0
- package/dist/linux-gtk/vite.d.ts +23 -0
- package/dist/linux-gtk/vite.js +194 -0
- package/dist/macos/config.js +141 -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 +287 -0
- package/dist/macos/runtime-package.js +30 -0
- package/dist/macos/tab-item.js +62 -0
- package/dist/macos/vite.d.ts +21 -0
- package/dist/macos/vite.js +111 -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 +161 -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 +38 -0
- package/dist/tsconfig-envs.js +287 -0
- package/dist/tsrx-leaf.js +57 -0
- package/dist/typecheck-globals/macos.d.ts +21 -0
- package/dist/typecheck-globals/native.d.ts +26 -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.d.ts +85 -0
- package/dist/vite.js +628 -0
- package/dist/workshop-worker.js +181 -0
- package/package.json +71 -9
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { lstatSync, realpathSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { basename, dirname, join, sep } from "node:path";
|
|
4
|
+
import { pathToFileURL } from "node:url";
|
|
5
|
+
import { Console } from "node:console";
|
|
6
|
+
import { Writable } from "node:stream";
|
|
7
|
+
// ../cli/src/workshop-worker.ts
|
|
8
|
+
function workshopEntry(project) {
|
|
9
|
+
const require = createRequire(join(project, "package.json"));
|
|
10
|
+
for (let at = project;; at = dirname(at)) {
|
|
11
|
+
const candidate = join(at, "node_modules/@octane-xplat/workshop");
|
|
12
|
+
let found = false;
|
|
13
|
+
try {
|
|
14
|
+
lstatSync(candidate);
|
|
15
|
+
found = true;
|
|
16
|
+
} catch (error) {
|
|
17
|
+
if (error.code !== "ENOENT") throw error;
|
|
18
|
+
}
|
|
19
|
+
if (found) {
|
|
20
|
+
const root = realpathSync(candidate);
|
|
21
|
+
const entry = realpathSync(require.resolve("@octane-xplat/workshop/node"));
|
|
22
|
+
if (!entry.startsWith(root + sep) || !statSync(entry).isFile()) throw new Error("Reinstall @octane-xplat/workshop: its Node entry must remain inside the selected package");
|
|
23
|
+
return entry;
|
|
24
|
+
}
|
|
25
|
+
if (dirname(at) === at) break;
|
|
26
|
+
}
|
|
27
|
+
throw new Error("Install @octane-xplat/workshop in the selected project: bun add -D @octane-xplat/workshop");
|
|
28
|
+
}
|
|
29
|
+
async function workshopInspection(request) {
|
|
30
|
+
if (typeof request.json !== "boolean" || !["workshop-list", "workshop-doctor"].includes(request.operation)) throw new Error("Invalid workshop inspection request");
|
|
31
|
+
if (request.operation === "workshop-list" && (typeof request.target !== "string" || request.target.length > 128)) throw new Error("Expected workshop target string");
|
|
32
|
+
const project = realpathSync(process.cwd());
|
|
33
|
+
const api = await import(pathToFileURL(workshopEntry(project)).href);
|
|
34
|
+
const previous = globalThis.console;
|
|
35
|
+
const chunks = [];
|
|
36
|
+
let size = 0;
|
|
37
|
+
const output = new Writable({ write(chunk, _encoding, callback) {
|
|
38
|
+
size += chunk.length;
|
|
39
|
+
if (size <= 8388608) chunks.push(Buffer.from(chunk));
|
|
40
|
+
callback();
|
|
41
|
+
} });
|
|
42
|
+
globalThis.console = new Console({
|
|
43
|
+
stdout: output,
|
|
44
|
+
stderr: process.stderr
|
|
45
|
+
});
|
|
46
|
+
try {
|
|
47
|
+
const result = request.operation === "workshop-list" ? await api.workshopList({
|
|
48
|
+
cwd: project,
|
|
49
|
+
target: request.target,
|
|
50
|
+
json: request.json
|
|
51
|
+
}) : await api.workshopDoctor({
|
|
52
|
+
cwd: project,
|
|
53
|
+
json: request.json
|
|
54
|
+
});
|
|
55
|
+
if (size > 8388608) throw new Error("Workshop inspection output exceeds 8 MiB");
|
|
56
|
+
const resultJSON = request.operation === "workshop-list" ? {
|
|
57
|
+
target: request.target,
|
|
58
|
+
...result
|
|
59
|
+
} : result;
|
|
60
|
+
if (request.json) {
|
|
61
|
+
const text = Buffer.concat(chunks).toString("utf8");
|
|
62
|
+
const printed = JSON.stringify(resultJSON, null, 2) + "\n";
|
|
63
|
+
process.stderr.write(text.endsWith(printed) ? text.slice(0, -printed.length) : text);
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
version: 1,
|
|
67
|
+
project,
|
|
68
|
+
operation: request.operation,
|
|
69
|
+
exitCode: 0,
|
|
70
|
+
stdout: request.json ? "" : Buffer.concat(chunks).toString("utf8"),
|
|
71
|
+
result: resultJSON
|
|
72
|
+
};
|
|
73
|
+
} catch (error) {
|
|
74
|
+
if (request.json || error?.name !== "WorkshopUsageError") process.stderr.write(Buffer.concat(chunks).toString("utf8"));
|
|
75
|
+
if (error?.name !== "WorkshopUsageError") throw error;
|
|
76
|
+
if (size > 8388608) throw new Error("Workshop inspection output exceeds 8 MiB");
|
|
77
|
+
return {
|
|
78
|
+
version: 1,
|
|
79
|
+
project,
|
|
80
|
+
operation: request.operation,
|
|
81
|
+
exitCode: 1,
|
|
82
|
+
stdout: request.json ? "" : Buffer.concat(chunks).toString("utf8"),
|
|
83
|
+
error: error.message,
|
|
84
|
+
result: null
|
|
85
|
+
};
|
|
86
|
+
} finally {
|
|
87
|
+
globalThis.console = previous;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
async function workshopInitPlan(request) {
|
|
91
|
+
if (typeof request.scripts !== "boolean") throw new Error("Expected scripts boolean");
|
|
92
|
+
const project = realpathSync(process.cwd());
|
|
93
|
+
const api = await import(pathToFileURL(workshopEntry(project)).href);
|
|
94
|
+
if (typeof api.planWorkshopInit !== "function") throw new Error("Update @octane-xplat/workshop in the selected project to provide initialization plan v1");
|
|
95
|
+
return api.planWorkshopInit({
|
|
96
|
+
cwd: project,
|
|
97
|
+
scripts: request.scripts
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
async function workshopService(request, requestFile, resultFile) {
|
|
101
|
+
const project = realpathSync(process.cwd());
|
|
102
|
+
if (![
|
|
103
|
+
"web",
|
|
104
|
+
"macos",
|
|
105
|
+
"linux",
|
|
106
|
+
"ios",
|
|
107
|
+
"android",
|
|
108
|
+
"windows"
|
|
109
|
+
].includes(request.target)) throw new Error("Unsupported workshop target");
|
|
110
|
+
for (const key of ["story", "device"]) if (request[key] !== void 0 && (typeof request[key] !== "string" || request[key].length > 8192)) throw new Error(`Invalid workshop ${key}`);
|
|
111
|
+
if (request.port !== void 0 && (!Number.isInteger(request.port) || request.port < 0 || request.port > 65535)) throw new Error("Workshop port must be an integer from 0 to 65535");
|
|
112
|
+
const directory = realpathSync(dirname(requestFile));
|
|
113
|
+
if (dirname(request.serviceStateFile) !== directory || basename(request.serviceStateFile) !== "service.json" || request.resourceRoot !== join(directory, "resources")) throw new Error("Invalid native-owned service paths");
|
|
114
|
+
if (request.profileRoot !== "" && (!request.profileRoot.startsWith(project + sep) || !basename(request.profileRoot).startsWith(".xplat-go-profile-") || !lstatSync(request.profileRoot).isDirectory())) throw new Error("Invalid native-owned compiler profile");
|
|
115
|
+
globalThis.console = new Console({
|
|
116
|
+
stdout: process.stdout,
|
|
117
|
+
stderr: process.stderr
|
|
118
|
+
});
|
|
119
|
+
const api = await import(pathToFileURL(workshopEntry(project)).href);
|
|
120
|
+
if (api.WORKSHOP_DEV_LIFECYCLE_VERSION !== 1) throw new Error("Update @octane-xplat/workshop in the selected project to provide development lifecycle v1");
|
|
121
|
+
const data = {
|
|
122
|
+
version: 1,
|
|
123
|
+
project,
|
|
124
|
+
operation: "workshop-dev",
|
|
125
|
+
target: request.target,
|
|
126
|
+
state: "accepted"
|
|
127
|
+
};
|
|
128
|
+
writeFileSync(resultFile, JSON.stringify({
|
|
129
|
+
protocol: request.protocol,
|
|
130
|
+
version: request.version,
|
|
131
|
+
id: request.id,
|
|
132
|
+
ok: true,
|
|
133
|
+
data,
|
|
134
|
+
warnings: []
|
|
135
|
+
}));
|
|
136
|
+
await api.workshopDev({
|
|
137
|
+
cwd: project,
|
|
138
|
+
target: request.target,
|
|
139
|
+
story: request.story,
|
|
140
|
+
port: request.port,
|
|
141
|
+
device: request.device,
|
|
142
|
+
resourceRoot: request.resourceRoot,
|
|
143
|
+
profileRoot: request.profileRoot || void 0,
|
|
144
|
+
onStarted: ({ kind, pid, url }) => {
|
|
145
|
+
const value = JSON.stringify({
|
|
146
|
+
protocol: "octane-project-service",
|
|
147
|
+
version: 1,
|
|
148
|
+
id: request.id,
|
|
149
|
+
project,
|
|
150
|
+
operation: "workshop-dev",
|
|
151
|
+
target: request.target,
|
|
152
|
+
kind,
|
|
153
|
+
pid,
|
|
154
|
+
url
|
|
155
|
+
});
|
|
156
|
+
if (Buffer.byteLength(value) > 65536) throw new Error("Service startup evidence exceeds 64 KiB");
|
|
157
|
+
writeFileSync(request.serviceStateFile + ".next", value, { mode: 384 });
|
|
158
|
+
renameSync(request.serviceStateFile + ".next", request.serviceStateFile);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
return data;
|
|
162
|
+
}
|
|
163
|
+
/** Selected-project finite static build. No development service is started. */
|
|
164
|
+
async function workshopBuildOperation(request) {
|
|
165
|
+
if (request.target !== "web" || typeof request.outDir !== "string" || typeof request.base !== "string") throw new Error("Invalid Workshop build request");
|
|
166
|
+
const project = realpathSync(process.cwd());
|
|
167
|
+
const api = await import(pathToFileURL(workshopEntry(project)).href);
|
|
168
|
+
if (typeof api.workshopBuild !== "function") throw new Error("Update @octane-xplat/workshop to build static previews");
|
|
169
|
+
return {
|
|
170
|
+
version: 1,
|
|
171
|
+
project,
|
|
172
|
+
operation: "workshop-build",
|
|
173
|
+
...await api.workshopBuild({
|
|
174
|
+
cwd: project,
|
|
175
|
+
target: "web",
|
|
176
|
+
outDir: request.outDir,
|
|
177
|
+
base: request.base
|
|
178
|
+
})
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
export { workshopBuildOperation, workshopInitPlan, workshopInspection, workshopService };
|
package/package.json
CHANGED
|
@@ -1,11 +1,73 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
"name": "@octane-xplat/build",
|
|
3
|
+
"version": "0.20.0",
|
|
4
|
+
"description": "Project-installed Vite presets and build plugins for Octane Xplat",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/octane-xplat/octane-xplat",
|
|
9
|
+
"directory": "packages/build"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"files": ["dist", "LICENSE", "README.md"],
|
|
13
|
+
"exports": {
|
|
14
|
+
"./worker": "./dist/build-worker.js",
|
|
15
|
+
"./vite": {
|
|
16
|
+
"types": "./dist/vite.d.ts",
|
|
17
|
+
"default": "./dist/vite.js"
|
|
18
|
+
},
|
|
19
|
+
"./macos/vite": {
|
|
20
|
+
"types": "./dist/macos/vite.d.ts",
|
|
21
|
+
"default": "./dist/macos/vite.js"
|
|
22
|
+
},
|
|
23
|
+
"./linux-gtk/vite": {
|
|
24
|
+
"types": "./dist/linux-gtk/vite.d.ts",
|
|
25
|
+
"default": "./dist/linux-gtk/vite.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=22.22.2"
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "vite build --config vite.package.config.ts",
|
|
36
|
+
"prepack": "bun run build",
|
|
37
|
+
"typecheck": "tsc --runExternalCode -p tsconfig.json",
|
|
38
|
+
"test:packed": "node ../../tools/cli-go/build-tools-consumer.mjs"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"jsonc-parser": "3.3.1",
|
|
42
|
+
"yaml": "2.9.1",
|
|
43
|
+
"ignore": "7.0.14",
|
|
44
|
+
"marked": "18.1.2",
|
|
45
|
+
"@babel/core": "8.0.9",
|
|
46
|
+
"@babel/plugin-transform-unicode-property-regex": "8.0.1",
|
|
47
|
+
"@babel/plugin-transform-unicode-sets-regex": "8.0.1",
|
|
48
|
+
"@octane-xplat/lib": "0.20.0",
|
|
49
|
+
"@tsrx/core": "0.5.5",
|
|
50
|
+
"postcss": "8.5.32",
|
|
51
|
+
"postcss-load-config": "6.0.1"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"vite": "^8.3.0",
|
|
55
|
+
"create-octane-xplat": "*",
|
|
56
|
+
"wawoff2": "2.0.1"
|
|
57
|
+
},
|
|
58
|
+
"peerDependenciesMeta": {
|
|
59
|
+
"create-octane-xplat": {
|
|
60
|
+
"optional": true
|
|
61
|
+
},
|
|
62
|
+
"wawoff2": {
|
|
63
|
+
"optional": true
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"create-octane-xplat": "0.20.0",
|
|
68
|
+
"@octane-xplat/cli": "0.20.0",
|
|
69
|
+
"@types/node": "26.6.6",
|
|
70
|
+
"typescript": "7.1.0-beta",
|
|
71
|
+
"vite": "8.3.6"
|
|
72
|
+
}
|
|
11
73
|
}
|