@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,57 @@
1
+ // ../cli/src/vite-target.ts
2
+ function target(value, source) {
3
+ switch (value) {
4
+ case "web":
5
+ case "ios":
6
+ case "android":
7
+ case "visionos":
8
+ case "windows":
9
+ case "macos":
10
+ case "linux":
11
+ case "gtk":
12
+ case "native": return value;
13
+ default: throw new Error(`Unknown ${source} target: ${String(value)}`);
14
+ }
15
+ }
16
+ function nativeInvocationTarget() {
17
+ const source = process.env.NATIVESCRIPT_BUNDLER_ENV;
18
+ if (source) {
19
+ const env = JSON.parse(source);
20
+ if (!env || typeof env !== "object" || Array.isArray(env)) throw new Error("NATIVESCRIPT_BUNDLER_ENV must be an object");
21
+ if ("platform" in env && env.platform !== void 0) return target(env.platform, "NativeScript");
22
+ for (const platform of [
23
+ "android",
24
+ "windows",
25
+ "visionos",
26
+ "ios"
27
+ ]) if (Object.entries(env).some(([key, value]) => key === platform && value)) return platform;
28
+ }
29
+ const args = process.argv.slice(2);
30
+ for (const platform of [
31
+ "visionos",
32
+ "android",
33
+ "ios",
34
+ "windows"
35
+ ]) if (args.some((arg) => arg === `--${platform}` || arg === `--env.${platform}` || arg.startsWith(`--env.${platform}=`))) return platform;
36
+ const index = args.indexOf("--platform");
37
+ const value = args.find((arg) => arg.startsWith("--platform="))?.slice(11) ?? (index >= 0 ? args[index + 1] : void 0);
38
+ return value === void 0 ? void 0 : target(value, "--platform");
39
+ }
40
+ /** @internal An absent target lets explicit native presets retain their generic chain. */
41
+ function invocationTarget() {
42
+ const selected = process.env.XPLAT_TARGET;
43
+ const engine = nativeInvocationTarget();
44
+ if (!selected) return engine;
45
+ const platform = target(selected, "XPLAT_TARGET");
46
+ if (engine && engine !== platform) throw new Error(`Xplat target ${platform} conflicts with NativeScript target ${engine}`);
47
+ return platform;
48
+ }
49
+ /** Resolve the invocation's build target. Direct Vite invocation defaults to web.
50
+ * @example
51
+ * import { buildTarget } from '@octane-xplat/cli/vite'
52
+ * console.log(buildTarget())
53
+ */
54
+ function buildTarget() {
55
+ return invocationTarget() ?? "web";
56
+ }
57
+ export { buildTarget, invocationTarget };
package/dist/vite.d.ts ADDED
@@ -0,0 +1,125 @@
1
+ // Keep public declarations separate from PostCSS implementation imports: consumers
2
+ // can resolve a different compatible PostCSS patch through Vite.
3
+ import type { CssPlatform } from './css-platform.types.js'
4
+
5
+ export type { CssPlatform } from './css-platform.types.js'
6
+
7
+ import type { Plugin, UserConfig } from 'vite'
8
+
9
+ /** Read the command's selected target, or NativeScript's invocation target.
10
+ * Direct Vite invocation defaults to web. Conflicting engine targets fail.
11
+ * @example
12
+ * import { buildTarget } from '@octane-xplat/cli/vite'
13
+ * console.log(buildTarget())
14
+ */
15
+ export function buildTarget(): CssPlatform
16
+
17
+ /** Select platform CSS siblings and compile build-time `@platform` blocks.
18
+ * CSS suffixes replace the unsuffixed file; explicit platform filenames stay
19
+ * exact. Framework presets include this automatically. Custom configs default
20
+ * to the invocation's buildTarget(), or web for direct Vite. */
21
+ export function css(platform?: CssPlatform): Plugin
22
+
23
+ /** @internal Native CSS normalization used by the platform presets. */
24
+ export type NativeCssPlugin = Plugin
25
+
26
+ /** @internal Native CSS normalization used by the platform presets. */
27
+ export function pxToDip(options?: { masonSafeAreaEnvironment?: boolean }): NativeCssPlugin
28
+
29
+ /** The committed env manifest beside the nearest governing tsconfig.json
30
+ * while one of its generated env-program references dangles (fresh checkout,
31
+ * before `xplat typecheck` runs) — otherwise undefined. The tsrx plugin and
32
+ * platform presets pin the Vite transform to it; an explicit config
33
+ * `tsconfig` always wins. */
34
+ export function transformTsconfig(root: string): string | undefined
35
+
36
+ /** Select platform implementations for explicit TSRX paths in a custom
37
+ * compiler or test setup. Standard platform presets and boundary include it.
38
+ * Vite 8 dependency optimization defaults to each environment's resolved extension
39
+ * order. Explicit optimizeDeps.rolldownOptions.resolve.extensions take precedence. */
40
+ export function tsrx(
41
+ platform?:
42
+ | 'web'
43
+ | 'ios'
44
+ | 'android'
45
+ | 'macos'
46
+ | 'windows'
47
+ | 'linux'
48
+ | 'gtk'
49
+ | 'visionos'
50
+ | 'native',
51
+ ): Plugin
52
+
53
+ export const nativeExtensions: string[]
54
+
55
+ /** Selects platform implementations for unsuffixed explicit `.tsrx` imports.
56
+ * Declaration-only contracts require a target implementation.
57
+ * Includes tsrx and its platform-aware dependency optimization defaults.
58
+ * Defaults to the invocation's buildTarget(), or web for direct Vite.
59
+ * Fails `vite build` when a platform-suffixed module foreign to the target
60
+ * is reachable in the graph (e.g. a `.web` leaf pulled into a mobile
61
+ * bundle transitively — lint catches direct imports, this catches the
62
+ * transitive path). Warns once per module in dev. */
63
+ export function boundary(
64
+ platform?:
65
+ | 'web'
66
+ | 'ios'
67
+ | 'android'
68
+ | 'macos'
69
+ | 'windows'
70
+ | 'linux'
71
+ | 'gtk'
72
+ | 'visionos'
73
+ | 'native',
74
+ ): Plugin
75
+
76
+ /** `define` entries implementing the `process.env.NODE_ENV` npm convention —
77
+ * upstream octane deps read it bare and assume the consumer bundler
78
+ * statically rewrites the member expression. Only the literal
79
+ * `process.env.NODE_ENV` read is covered; `process.env.FOO` or whole-object
80
+ * `process` reads still fail on runtimes without a `process` global. */
81
+ export function nodeEnvDefine(mode: string): Record<string, string>
82
+
83
+ /** Development-action bridge (MCP). Dev-server middleware: the app announces
84
+ * its action registry and polls for invocations under /__xplat_dev__/; the
85
+ * MCP server discovers the endpoint through a same-uid session file under
86
+ * node_modules/.cache/xplat/dev-bridge/ and authenticates with the per-server
87
+ * token the plugin injects through a dev-only define. apply:'serve' — never
88
+ * part of a production build. Included automatically by native and the
89
+ * umbrella config helper; custom configs add it alongside boundary. */
90
+ export function devBridge(options?: { appRoot?: string }): Plugin
91
+
92
+ export interface XplatNativeOptions {
93
+ /** Extra optimizeDeps.exclude entries — app-shipped @nativescript plugins. */
94
+ deps?: string[]
95
+ /** Renderer rules override — defaults cover src/ + linked package source. */
96
+ rules?: unknown[]
97
+ /** App-specific config merged in last (plugins, server, …). */
98
+ extra?: UserConfig
99
+ }
100
+
101
+ /** Full native (iOS/Android) Vite config — the shared preset. Resolves the
102
+ * app's own vite/vite-octane/octane toolchain (async because it loads
103
+ * through the app's node_modules). */
104
+ export function native(
105
+ env: { mode: string } | string,
106
+ opts?: XplatNativeOptions,
107
+ ): Promise<UserConfig>
108
+
109
+ /** @deprecated Use {@link css}. */
110
+ export const xplatCss: typeof css
111
+
112
+ /** @deprecated Use {@link devBridge}. */
113
+ export const xplatDevBridge: typeof devBridge
114
+
115
+ /** @deprecated Use {@link tsrx}. */
116
+ export const xplatTsrx: typeof tsrx
117
+
118
+ /** @deprecated Use {@link boundary}. */
119
+ export const xplatBoundary: typeof boundary
120
+
121
+ /** @deprecated Use {@link native}. */
122
+ export const xplatNative: typeof native
123
+
124
+ /** @deprecated Use {@link nodeEnvDefine}. */
125
+ export const xplatNodeEnvDefine: typeof nodeEnvDefine