@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.
Files changed (73) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +5 -0
  3. package/dist/add-worker.js +66 -0
  4. package/dist/build-worker.js +287 -0
  5. package/dist/compatibility-check.js +155 -0
  6. package/dist/compatibility-data/compatibility.js +109 -0
  7. package/dist/compatibility-data/compatibility.json +298 -0
  8. package/dist/compatibility.js +240 -0
  9. package/dist/css-platform.js +236 -0
  10. package/dist/css-platform.types.d.ts +11 -0
  11. package/dist/dev-inspector.web.js +125 -0
  12. package/dist/dev-log-client.web.js +79 -0
  13. package/dist/dev-log-server.js +13 -0
  14. package/dist/devtools-worker.js +94 -0
  15. package/dist/doctor-checks.js +414 -0
  16. package/dist/doctor-tool.js +27 -0
  17. package/dist/env.js +3 -0
  18. package/dist/fmt-plan.js +149 -0
  19. package/dist/fonts-worker.js +31 -0
  20. package/dist/fonts.js +614 -0
  21. package/dist/inline-stylesheets.js +44 -0
  22. package/dist/linux/config.js +43 -0
  23. package/dist/linux/gtk-runtime.js +86 -0
  24. package/dist/linux/package.js +189 -0
  25. package/dist/linux-gtk/bindings.mjs +675 -0
  26. package/dist/linux-gtk/native-gi-projection.js +36 -0
  27. package/dist/linux-gtk/vite.d.ts +39 -0
  28. package/dist/linux-gtk/vite.js +281 -0
  29. package/dist/macos/config.js +136 -0
  30. package/dist/macos/core-ui.js +59 -0
  31. package/dist/macos/core-vite.js +122 -0
  32. package/dist/macos/doctor-checks.js +58 -0
  33. package/dist/macos/executables.js +39 -0
  34. package/dist/macos/jsc-host/runtime.js +134 -0
  35. package/dist/macos/native.js +286 -0
  36. package/dist/macos/runtime-package.js +30 -0
  37. package/dist/macos/tab-item.js +62 -0
  38. package/dist/macos/vite.d.ts +13 -0
  39. package/dist/macos/vite.js +22 -0
  40. package/dist/markdown.js +11 -0
  41. package/dist/mason-engine.js +20 -0
  42. package/dist/mcp/contracts/actions.js +133 -0
  43. package/dist/mcp/dev-bridge.js +363 -0
  44. package/dist/mcp/dev-socket.js +203 -0
  45. package/dist/mcp/dev-stack.js +134 -0
  46. package/dist/mcp/inspection/dom.web.js +46 -0
  47. package/dist/native-regex.js +123 -0
  48. package/dist/package-manager.js +106 -0
  49. package/dist/package-root.js +48 -0
  50. package/dist/patches.js +356 -0
  51. package/dist/route-config.js +53 -0
  52. package/dist/route-data.js +42 -0
  53. package/dist/route-generator.js +514 -0
  54. package/dist/route-path.js +29 -0
  55. package/dist/route-source.js +67 -0
  56. package/dist/targets.js +37 -0
  57. package/dist/tsconfig-envs.js +400 -0
  58. package/dist/tsconfig-pin.js +31 -0
  59. package/dist/tsrx-leaf.js +57 -0
  60. package/dist/typecheck-globals/macos.d.ts +21 -0
  61. package/dist/typecheck-globals/native.d.ts +42 -0
  62. package/dist/ui/src/markdown/markdown-ast.js +33 -0
  63. package/dist/ui/src/markdown/markdown-character-references.js +79 -0
  64. package/dist/ui/src/markdown/markdown-parse.js +1930 -0
  65. package/dist/ui/src/markdown/markdown-plugins.js +564 -0
  66. package/dist/ui/src/markdown/markdown-url.js +17 -0
  67. package/dist/updates-worker.js +34 -0
  68. package/dist/upgrade-worker.js +63 -0
  69. package/dist/vite-target.js +57 -0
  70. package/dist/vite.d.ts +125 -0
  71. package/dist/vite.js +797 -0
  72. package/dist/workshop-worker.js +181 -0
  73. package/package.json +74 -0
@@ -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 ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "@octane-xplat/build",
3
+ "version": "0.0.0-nightly.g1b95ef7",
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.mts"
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.0.0-nightly.g1b95ef7",
49
+ "@tsrx/core": "0.5.5",
50
+ "postcss": "8.5.32",
51
+ "postcss-load-config": "6.0.1",
52
+ "postcss-value-parser": "4.2.0"
53
+ },
54
+ "peerDependencies": {
55
+ "vite": "^8.3.0",
56
+ "create-octane-xplat": "*",
57
+ "wawoff2": "2.0.1"
58
+ },
59
+ "peerDependenciesMeta": {
60
+ "create-octane-xplat": {
61
+ "optional": true
62
+ },
63
+ "wawoff2": {
64
+ "optional": true
65
+ }
66
+ },
67
+ "devDependencies": {
68
+ "create-octane-xplat": "0.0.0-nightly.g1b95ef7",
69
+ "@octane-xplat/cli": "0.0.0-nightly.g1b95ef7",
70
+ "@types/node": "26.6.6",
71
+ "typescript": "7.1.0-dev.20261121.1",
72
+ "vite": "8.3.6"
73
+ }
74
+ }