@bake-native/core 0.0.0 → 0.1.0-rc.1

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 (144) hide show
  1. package/LICENSE +21 -0
  2. package/THIRD_PARTY_NOTICES.txt +548 -0
  3. package/bake-prelude.js +189 -0
  4. package/batch-contract.json +21 -0
  5. package/batch-wire.js +674 -0
  6. package/close-watcher.js +137 -0
  7. package/compat.json +64 -0
  8. package/controls.css +108 -0
  9. package/determinism.js +175 -0
  10. package/devtools.d.ts +13 -0
  11. package/devtools.js +73 -0
  12. package/dialogs.js +59 -0
  13. package/direct-style.js +105 -0
  14. package/direct-table.js +261 -0
  15. package/dist/bake.mjs +2211 -0
  16. package/dist/build-BrSFpaK1.mjs +1 -0
  17. package/dist/build-tools-Dxyl6XAf.mjs +80 -0
  18. package/dist/build-vAPG2xQv.mjs +5516 -0
  19. package/dist/client-Cm7o6dQd.mjs +17544 -0
  20. package/dist/compiler.mjs +4 -0
  21. package/dist/config-B1W8gfZY.mjs +12 -0
  22. package/dist/dev-xZblYmDc.mjs +990 -0
  23. package/dist/direct-report-Bdda-k_Y.mjs +153 -0
  24. package/dist/direct-report-Du44nNWl.mjs +1 -0
  25. package/dist/index.d.mts +176 -0
  26. package/dist/index.mjs +1 -0
  27. package/dist/intl-ROnAp2qO.mjs +75 -0
  28. package/dist/jiti-stub-CKcaShwE.mjs +5 -0
  29. package/dist/native-views-BQ8TtbQj.mjs +8046 -0
  30. package/dist/octane/package.json +5 -0
  31. package/dist/package-D2aYD6A4.mjs +2789 -0
  32. package/dist/react/package.json +13 -0
  33. package/dist/rolldown-runtime-D3KUYPsf.mjs +12 -0
  34. package/dist/run-BtyJGAQB.mjs +6632 -0
  35. package/dist/scope-8W2aIuQ9.mjs +262 -0
  36. package/dist/screens/BakeNativeScreen.native.ts +9 -0
  37. package/dist/screens/package.json +5 -0
  38. package/dom-exception.js +31 -0
  39. package/element-api.js +158 -0
  40. package/first-screen.js +30 -0
  41. package/fonts/Geist-Italic-Variable.ttf +0 -0
  42. package/fonts/Geist-Variable.ttf +0 -0
  43. package/fonts/GeistMono-Italic-Variable.ttf +0 -0
  44. package/fonts/GeistMono-Variable.ttf +0 -0
  45. package/fonts/OFL.txt +93 -0
  46. package/fonts/README.md +27 -0
  47. package/fonts/geist-italic.css +8 -0
  48. package/fonts/geist-mono-italic.css +8 -0
  49. package/fonts/geist-mono.css +8 -0
  50. package/fonts/geist.css +8 -0
  51. package/header-icons.json +53 -0
  52. package/host-runtime.js +521 -0
  53. package/image-props.js +17 -0
  54. package/index.d.ts +8 -0
  55. package/index.js +7 -0
  56. package/licenses/Apache-2.0.txt +73 -0
  57. package/locale-entry.d.ts +1 -0
  58. package/locale-entry.js +1 -0
  59. package/locale.d.ts +28 -0
  60. package/locale.js +124 -0
  61. package/markup-support.js +87 -0
  62. package/media-element.js +115 -0
  63. package/native-args-entry.js +2 -0
  64. package/native-args.d.ts +7 -0
  65. package/native-args.js +155 -0
  66. package/native-entry.js +1 -0
  67. package/native-globals.d.ts +166 -0
  68. package/native-scenarios.d.ts +17 -0
  69. package/native-scenarios.js +46 -0
  70. package/native-support.json +366 -0
  71. package/native.d.ts +52 -0
  72. package/native.js +237 -0
  73. package/package.json +143 -4
  74. package/page-elements.js +123 -0
  75. package/runtime-provides.json +412 -0
  76. package/safe-area.d.ts +1 -0
  77. package/safe-area.js +44 -0
  78. package/swift-ui/modifiers.js +176 -0
  79. package/tab-icons.js +62 -0
  80. package/templates/create/tabs/AGENTS.md +22 -0
  81. package/templates/create/tabs/README.md +43 -0
  82. package/templates/create/tabs/_gitignore +13 -0
  83. package/templates/create/tabs/android/app/build.gradle.kts +79 -0
  84. package/templates/create/tabs/android/app/src/main/AndroidManifest.xml +39 -0
  85. package/templates/create/tabs/android/app/src/main/kotlin/MainActivity.kt +35 -0
  86. package/templates/create/tabs/android/app/src/main/res/values/themes.xml +8 -0
  87. package/templates/create/tabs/android/build.gradle.kts +5 -0
  88. package/templates/create/tabs/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  89. package/templates/create/tabs/android/gradle/wrapper/gradle-wrapper.properties +9 -0
  90. package/templates/create/tabs/android/gradle.properties +3 -0
  91. package/templates/create/tabs/android/gradlew +248 -0
  92. package/templates/create/tabs/android/settings.gradle.kts +47 -0
  93. package/templates/create/tabs/bake.config.ts +10 -0
  94. package/templates/create/tabs/ios/App/App.swift +30 -0
  95. package/templates/create/tabs/ios/build.sh +23 -0
  96. package/templates/create/tabs/ios/project.yml +57 -0
  97. package/templates/create/tabs/macos/Package.swift +24 -0
  98. package/templates/create/tabs/macos/Sources/__SWIFT_NAME__/App.swift +146 -0
  99. package/templates/create/tabs/macos/build.sh +4 -0
  100. package/templates/create/tabs/package.json +23 -0
  101. package/templates/create/tabs/pnpm-workspace.yaml +6 -0
  102. package/templates/create/tabs/src/App.tsrx +92 -0
  103. package/templates/create/tabs/src/App.tsx +67 -0
  104. package/templates/create/tabs/src/styles.css +32 -0
  105. package/templates/create/tabs/tsconfig.json +5 -0
  106. package/templates/create/tabs/windows/Cargo.toml +29 -0
  107. package/templates/create/tabs/windows/build.rs +9 -0
  108. package/templates/create/tabs/windows/src/main.rs +52 -0
  109. package/templates/create/tabs/windows/src/shell.rs +316 -0
  110. package/templates/module/__NAME__.kt +20 -0
  111. package/templates/module/__NAME__.native.ts +24 -0
  112. package/templates/module/__NAME__.swift +25 -0
  113. package/templates/module/__NAME__.web.ts +13 -0
  114. package/templates/module/__NAME__Test.kt +26 -0
  115. package/templates/module/__NAME__Tests.swift +25 -0
  116. package/templates/module/__SNAKE__.rs +43 -0
  117. package/text.d.ts +20 -0
  118. package/text.js +100 -0
  119. package/transform-entry.js +1 -0
  120. package/transform.d.ts +15 -0
  121. package/transform.js +98 -0
  122. package/tsconfig.native.json +16 -0
  123. package/ui/scope.js +103 -0
  124. package/ui/swift.js +106 -0
  125. package/ui/ui.css +272 -0
  126. package/view-ref-writer.js +268 -0
  127. package/view-ref.d.ts +26 -0
  128. package/view-ref.js +85 -0
  129. package/views/Video.native.ts +68 -0
  130. package/views/generated/VideoViewAndroid.h +68 -0
  131. package/views/generated/VideoViewJSI.h +94 -0
  132. package/views/generated/VideoViewSpec.kt +113 -0
  133. package/views/generated/apple/VideoViewJSI/VideoViewJSIApple.cpp +40 -0
  134. package/views/generated/apple/VideoViewJSI/include/VideoViewJSIApple.h +28 -0
  135. package/views/generated/apple/VideoViewSpec/VideoViewInterop.swift +39 -0
  136. package/views/generated/apple/VideoViewSpec/VideoViewSpec.swift +186 -0
  137. package/views/generated/video_view_spec.rs +189 -0
  138. package/views.d.ts +24 -0
  139. package/views.js +45 -0
  140. package/virtual-window.js +35 -0
  141. package/visibility.js +75 -0
  142. package/web-crypto.js +84 -0
  143. package/web-fetch.js +1071 -0
  144. package/README.md +0 -3
@@ -0,0 +1 @@
1
+ export { n as aotCommand, i as bakePrelude, a as buildCommand, o as buildTargets, c as checkCommand, l as packageCommand } from "./build-vAPG2xQv.mjs";
@@ -0,0 +1,80 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { createRequire, findPackageJSON } from "node:module";
3
+ import { dirname, join } from "node:path";
4
+ import { fileURLToPath, pathToFileURL } from "node:url";
5
+ // src/build-tools.ts
6
+ function selectRenderer(root, renderer) {
7
+ const react = existsSync(join(root, "src/App.tsx"));
8
+ const octane = existsSync(join(root, "src/App.tsrx"));
9
+ if (!renderer && react && octane) throw new Error("Both src/App.tsx and src/App.tsrx exist. Set renderer to \"react\" or \"octane\" in bake.config.ts.");
10
+ if (renderer && renderer !== "react" && renderer !== "octane") throw new Error("Set renderer to \"react\" or \"octane\" in bake.config.ts.");
11
+ if (!renderer && !react && !octane) throw new Error("Missing app entry. Export a screen from src/App.tsx for React or src/App.tsrx for Octane.");
12
+ const selected = renderer ?? (react ? "react" : "octane");
13
+ if (selected === "react" ? !react : !octane) throw new Error(`Missing src/App.${selected === "react" ? "tsx" : "tsrx"}. Export a screen as App or default for the ${selected} renderer.`);
14
+ return selected;
15
+ }
16
+ function resolveAppTool(root, renderer, specifier) {
17
+ const require = createRequire(pathToFileURL(join(root, "package.json")));
18
+ try {
19
+ return pathToFileURL(require.resolve(specifier)).href;
20
+ } catch (cause) {
21
+ throw new Error(specifier === "vite" ? `Cannot resolve vite from ${root}. bake build bundles with Vite: install vite in the app project (pnpm add -D vite).` : `Cannot resolve ${specifier} from ${root}. Install @bake-native/${renderer} and ${renderer} in the app project.`, { cause });
22
+ }
23
+ }
24
+ /**
25
+ * The app's PostCSS: the one its Vite runs (a dependency of Vite), else the app's own. Loaded only
26
+ * for a stylesheet `bake build` rewrites (css-lower.mjs), so postcss is no dependency of bake.
27
+ */
28
+ function appPostcss(root, vite) {
29
+ let loaded;
30
+ return () => {
31
+ if (loaded) return loaded;
32
+ for (const from of [vite, pathToFileURL(join(root, "package.json")).href]) try {
33
+ return loaded = createRequire(from)("postcss");
34
+ } catch {}
35
+ throw new Error(`Cannot resolve postcss from ${root} or its vite. bake build rewrites this app's stylesheet with PostCSS: install postcss in the app project (pnpm add -D postcss).`);
36
+ };
37
+ }
38
+ function loadReactCompiler(root) {
39
+ return import(resolveAppTool(root, "react", "@bake-native/react/compiler"));
40
+ }
41
+ /**
42
+ * Resolve from the app even when bake is linked from another checkout. `bake build` and
43
+ * `bake package` bundle with the app's Vite; vite is not a dependency or peer of @bake-native/octane, so
44
+ * it is loaded here, lazily, and only these commands need it.
45
+ */
46
+ async function loadBuildTools(root, renderer = "octane") {
47
+ const manifest = pathToFileURL(join(root, "package.json"));
48
+ const resolve = (specifier) => resolveAppTool(root, renderer, specifier);
49
+ const viteURL = resolve("vite");
50
+ const vite = await import(viteURL);
51
+ const postcss = appPostcss(root, viteURL);
52
+ if (renderer === "react") {
53
+ const contract = await loadReactCompiler(root);
54
+ resolve("@bake-native/react/renderer");
55
+ return {
56
+ build: vite.build,
57
+ parseAst: vite.parseAst,
58
+ postcss,
59
+ react: contract,
60
+ adapterStyles: [join(dirname(fileURLToPath(resolve("@bake-native/react/package.json"))), "primitives.css")],
61
+ version: JSON.parse(readFileSync(new URL(resolve("react/package.json")), "utf8")).version
62
+ };
63
+ }
64
+ const compilerURL = resolve("octane/compiler");
65
+ const pluginURL = resolve("octane/compiler/vite");
66
+ const compiler = await import(compilerURL);
67
+ const plugin = await import(pluginURL);
68
+ const octaneManifest = findPackageJSON("octane", manifest);
69
+ const version = JSON.parse(readFileSync(octaneManifest, "utf8")).version;
70
+ return {
71
+ build: vite.build,
72
+ parseAst: vite.parseAst,
73
+ postcss,
74
+ compile: compiler.compile,
75
+ octane: plugin.octane,
76
+ adapter: dirname(createRequire(manifest).resolve("@bake-native/octane/package.json")),
77
+ version
78
+ };
79
+ }
80
+ export { loadReactCompiler as n, selectRenderer as r, loadBuildTools as t };