@bake-native/core 0.1.0-rc.0 → 0.1.0-rc.2
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/THIRD_PARTY_NOTICES.txt +1 -1
- package/close-watcher.js +137 -0
- package/compat.json +3 -3
- package/dist/bake.mjs +9 -9
- package/dist/{build-CMsvCcZ0.mjs → build-CTvDcJg_.mjs} +1 -1
- package/dist/{build-CkLSZw06.mjs → build-CoK3bspu.mjs} +5 -3
- package/dist/compiler.mjs +1 -1
- package/dist/{dev-Cskd8Hl4.mjs → dev-CyIzIurx.mjs} +9 -5
- package/dist/{native-views-BuzB9x5H.mjs → native-views-COg9tj_5.mjs} +271 -60
- package/dist/octane/package.json +1 -1
- package/dist/{package-KkUSMoji.mjs → package-CYWHh6C1.mjs} +42 -38
- package/dist/react/package.json +1 -1
- package/dist/{run-D2aPm54a.mjs → run-C44lJhc4.mjs} +1 -1
- package/dist/screens/package.json +1 -1
- package/host-runtime.js +14 -1
- package/native-globals.d.ts +10 -0
- package/native-support.json +26 -9
- package/package.json +6 -5
- package/runtime-provides.json +2 -1
- package/swift-ui/modifiers.js +14 -2
|
@@ -95,22 +95,102 @@ var elements = {
|
|
|
95
95
|
"spellCheck",
|
|
96
96
|
"suppressNativeChangeWarning"
|
|
97
97
|
],
|
|
98
|
-
"values": {
|
|
99
|
-
"
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
98
|
+
"values": {
|
|
99
|
+
"type": [
|
|
100
|
+
"text",
|
|
101
|
+
"password",
|
|
102
|
+
"email",
|
|
103
|
+
"search",
|
|
104
|
+
"tel",
|
|
105
|
+
"url",
|
|
106
|
+
"number",
|
|
107
|
+
"checkbox",
|
|
108
|
+
"radio",
|
|
109
|
+
"range",
|
|
110
|
+
"date",
|
|
111
|
+
"time",
|
|
112
|
+
"datetime-local",
|
|
113
|
+
"color"
|
|
114
|
+
],
|
|
115
|
+
"inputmode": [
|
|
116
|
+
"none",
|
|
117
|
+
"text",
|
|
118
|
+
"decimal",
|
|
119
|
+
"numeric",
|
|
120
|
+
"tel",
|
|
121
|
+
"search",
|
|
122
|
+
"email",
|
|
123
|
+
"url"
|
|
124
|
+
],
|
|
125
|
+
"inputMode": [
|
|
126
|
+
"none",
|
|
127
|
+
"text",
|
|
128
|
+
"decimal",
|
|
129
|
+
"numeric",
|
|
130
|
+
"tel",
|
|
131
|
+
"search",
|
|
132
|
+
"email",
|
|
133
|
+
"url"
|
|
134
|
+
],
|
|
135
|
+
"enterkeyhint": [
|
|
136
|
+
"enter",
|
|
137
|
+
"done",
|
|
138
|
+
"go",
|
|
139
|
+
"next",
|
|
140
|
+
"previous",
|
|
141
|
+
"search",
|
|
142
|
+
"send"
|
|
143
|
+
],
|
|
144
|
+
"enterKeyHint": [
|
|
145
|
+
"enter",
|
|
146
|
+
"done",
|
|
147
|
+
"go",
|
|
148
|
+
"next",
|
|
149
|
+
"previous",
|
|
150
|
+
"search",
|
|
151
|
+
"send"
|
|
152
|
+
],
|
|
153
|
+
"autocapitalize": [
|
|
154
|
+
"none",
|
|
155
|
+
"off",
|
|
156
|
+
"sentences",
|
|
157
|
+
"on",
|
|
158
|
+
"words",
|
|
159
|
+
"characters"
|
|
160
|
+
],
|
|
161
|
+
"autoCapitalize": [
|
|
162
|
+
"none",
|
|
163
|
+
"off",
|
|
164
|
+
"sentences",
|
|
165
|
+
"on",
|
|
166
|
+
"words",
|
|
167
|
+
"characters"
|
|
168
|
+
],
|
|
169
|
+
"autocorrect": [
|
|
170
|
+
"",
|
|
171
|
+
"on",
|
|
172
|
+
"off",
|
|
173
|
+
"true",
|
|
174
|
+
"false"
|
|
175
|
+
],
|
|
176
|
+
"autoCorrect": [
|
|
177
|
+
"",
|
|
178
|
+
"on",
|
|
179
|
+
"off",
|
|
180
|
+
"true",
|
|
181
|
+
"false"
|
|
182
|
+
],
|
|
183
|
+
"spellcheck": [
|
|
184
|
+
"",
|
|
185
|
+
"true",
|
|
186
|
+
"false"
|
|
187
|
+
],
|
|
188
|
+
"spellCheck": [
|
|
189
|
+
"",
|
|
190
|
+
"true",
|
|
191
|
+
"false"
|
|
192
|
+
]
|
|
193
|
+
}
|
|
114
194
|
},
|
|
115
195
|
"kbd": {},
|
|
116
196
|
"label": { "attributes": ["for", "htmlFor"] },
|
|
@@ -148,29 +228,111 @@ var elements = {
|
|
|
148
228
|
"span": {},
|
|
149
229
|
"strong": {},
|
|
150
230
|
"summary": {},
|
|
151
|
-
"textarea": {
|
|
152
|
-
"
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
231
|
+
"textarea": {
|
|
232
|
+
"attributes": [
|
|
233
|
+
"value",
|
|
234
|
+
"defaultValue",
|
|
235
|
+
"disabled",
|
|
236
|
+
"placeholder",
|
|
237
|
+
"name",
|
|
238
|
+
"rows",
|
|
239
|
+
"maxlength",
|
|
240
|
+
"maxLength",
|
|
241
|
+
"inputmode",
|
|
242
|
+
"inputMode",
|
|
243
|
+
"enterkeyhint",
|
|
244
|
+
"enterKeyHint",
|
|
245
|
+
"autocomplete",
|
|
246
|
+
"autoComplete",
|
|
247
|
+
"autocorrect",
|
|
248
|
+
"autoCorrect",
|
|
249
|
+
"autocapitalize",
|
|
250
|
+
"autoCapitalize",
|
|
251
|
+
"spellcheck",
|
|
252
|
+
"spellCheck",
|
|
253
|
+
"suppressNativeChangeWarning"
|
|
254
|
+
],
|
|
255
|
+
"values": {
|
|
256
|
+
"inputmode": [
|
|
257
|
+
"none",
|
|
258
|
+
"text",
|
|
259
|
+
"decimal",
|
|
260
|
+
"numeric",
|
|
261
|
+
"tel",
|
|
262
|
+
"search",
|
|
263
|
+
"email",
|
|
264
|
+
"url"
|
|
265
|
+
],
|
|
266
|
+
"inputMode": [
|
|
267
|
+
"none",
|
|
268
|
+
"text",
|
|
269
|
+
"decimal",
|
|
270
|
+
"numeric",
|
|
271
|
+
"tel",
|
|
272
|
+
"search",
|
|
273
|
+
"email",
|
|
274
|
+
"url"
|
|
275
|
+
],
|
|
276
|
+
"enterkeyhint": [
|
|
277
|
+
"enter",
|
|
278
|
+
"done",
|
|
279
|
+
"go",
|
|
280
|
+
"next",
|
|
281
|
+
"previous",
|
|
282
|
+
"search",
|
|
283
|
+
"send"
|
|
284
|
+
],
|
|
285
|
+
"enterKeyHint": [
|
|
286
|
+
"enter",
|
|
287
|
+
"done",
|
|
288
|
+
"go",
|
|
289
|
+
"next",
|
|
290
|
+
"previous",
|
|
291
|
+
"search",
|
|
292
|
+
"send"
|
|
293
|
+
],
|
|
294
|
+
"autocapitalize": [
|
|
295
|
+
"none",
|
|
296
|
+
"off",
|
|
297
|
+
"sentences",
|
|
298
|
+
"on",
|
|
299
|
+
"words",
|
|
300
|
+
"characters"
|
|
301
|
+
],
|
|
302
|
+
"autoCapitalize": [
|
|
303
|
+
"none",
|
|
304
|
+
"off",
|
|
305
|
+
"sentences",
|
|
306
|
+
"on",
|
|
307
|
+
"words",
|
|
308
|
+
"characters"
|
|
309
|
+
],
|
|
310
|
+
"autocorrect": [
|
|
311
|
+
"",
|
|
312
|
+
"on",
|
|
313
|
+
"off",
|
|
314
|
+
"true",
|
|
315
|
+
"false"
|
|
316
|
+
],
|
|
317
|
+
"autoCorrect": [
|
|
318
|
+
"",
|
|
319
|
+
"on",
|
|
320
|
+
"off",
|
|
321
|
+
"true",
|
|
322
|
+
"false"
|
|
323
|
+
],
|
|
324
|
+
"spellcheck": [
|
|
325
|
+
"",
|
|
326
|
+
"true",
|
|
327
|
+
"false"
|
|
328
|
+
],
|
|
329
|
+
"spellCheck": [
|
|
330
|
+
"",
|
|
331
|
+
"true",
|
|
332
|
+
"false"
|
|
333
|
+
]
|
|
334
|
+
}
|
|
335
|
+
},
|
|
174
336
|
"time": {},
|
|
175
337
|
"u": {},
|
|
176
338
|
"ul": {},
|
|
@@ -299,6 +461,9 @@ var elements = {
|
|
|
299
461
|
"glasseffectcontainer",
|
|
300
462
|
"text",
|
|
301
463
|
"label",
|
|
464
|
+
"contentunavailableview",
|
|
465
|
+
"labeledcontent",
|
|
466
|
+
"link",
|
|
302
467
|
"image",
|
|
303
468
|
"progressview",
|
|
304
469
|
"button",
|
|
@@ -311,6 +476,8 @@ var elements = {
|
|
|
311
476
|
"form",
|
|
312
477
|
"list",
|
|
313
478
|
"section",
|
|
479
|
+
"swipeactions",
|
|
480
|
+
"swipeactiongroup",
|
|
314
481
|
"navigationstack",
|
|
315
482
|
"toolbaritem",
|
|
316
483
|
"bakeview",
|
|
@@ -758,6 +925,8 @@ var attributes = {
|
|
|
758
925
|
"main",
|
|
759
926
|
"menu",
|
|
760
927
|
"menuitem",
|
|
928
|
+
"menuitemcheckbox",
|
|
929
|
+
"menuitemradio",
|
|
761
930
|
"meter",
|
|
762
931
|
"navigation",
|
|
763
932
|
"none",
|
|
@@ -802,15 +971,35 @@ var attributes = {
|
|
|
802
971
|
"undefined"
|
|
803
972
|
]
|
|
804
973
|
},
|
|
805
|
-
"valueTargets": {
|
|
806
|
-
"
|
|
807
|
-
"
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
974
|
+
"valueTargets": {
|
|
975
|
+
"enterkeyhint": { "previous": {
|
|
976
|
+
"targets": [
|
|
977
|
+
"android",
|
|
978
|
+
"mac",
|
|
979
|
+
"windows"
|
|
980
|
+
],
|
|
981
|
+
"why": "UIKit has no Previous return key",
|
|
982
|
+
"instead": "choose another enterkeyhint for iOS"
|
|
983
|
+
} },
|
|
984
|
+
"enterKeyHint": { "previous": {
|
|
985
|
+
"targets": [
|
|
986
|
+
"android",
|
|
987
|
+
"mac",
|
|
988
|
+
"windows"
|
|
989
|
+
],
|
|
990
|
+
"why": "UIKit has no Previous return key",
|
|
991
|
+
"instead": "choose another enterKeyHint for iOS"
|
|
992
|
+
} },
|
|
993
|
+
"dir": { "rtl": {
|
|
994
|
+
"targets": [
|
|
995
|
+
"ios",
|
|
996
|
+
"mac",
|
|
997
|
+
"android"
|
|
998
|
+
],
|
|
999
|
+
"why": "the text backend of this target shapes paragraphs left to right (the same as `direction: rtl`, css-direction)",
|
|
1000
|
+
"instead": "leave the default (ltr) on this target"
|
|
1001
|
+
} }
|
|
1002
|
+
},
|
|
814
1003
|
"unsupported": {
|
|
815
1004
|
"controls": {
|
|
816
1005
|
"why": "native targets draw no media controls yet: each platform player has its own (AVKit, Media Foundation, Android) and none matches Chromium's, so the same markup would look different on every target",
|
|
@@ -981,6 +1170,11 @@ var events = {
|
|
|
981
1170
|
"event": "click",
|
|
982
1171
|
"note": "alias of onClick"
|
|
983
1172
|
},
|
|
1173
|
+
"onBeforeInput": {
|
|
1174
|
+
"event": "beforeinput",
|
|
1175
|
+
"capture": true,
|
|
1176
|
+
"targets": ["ios", "android"]
|
|
1177
|
+
},
|
|
984
1178
|
"onInput": {
|
|
985
1179
|
"event": "input",
|
|
986
1180
|
"elements": [
|
|
@@ -1314,8 +1508,8 @@ var events = {
|
|
|
1314
1508
|
"instead": "nothing yet"
|
|
1315
1509
|
},
|
|
1316
1510
|
"onBefore": {
|
|
1317
|
-
"why": "
|
|
1318
|
-
"instead": "
|
|
1511
|
+
"why": "beforetoggle is not delivered",
|
|
1512
|
+
"instead": "onToggle"
|
|
1319
1513
|
},
|
|
1320
1514
|
"onGot": {
|
|
1321
1515
|
"why": "pointer capture is not implemented",
|
|
@@ -3417,6 +3611,13 @@ function defaultRuntimeRange(version) {
|
|
|
3417
3611
|
const [major, minor, patch] = parseVersion$1(version);
|
|
3418
3612
|
return major === 0 ? `>=0.${minor}.${patch} <0.${minor + 1}.0` : `>=${major}.${minor}.${patch} <${major + 1}.0.0`;
|
|
3419
3613
|
}
|
|
3614
|
+
function frameworkBundleVersions(version) {
|
|
3615
|
+
const short = version.split(/[-+]/, 1)[0];
|
|
3616
|
+
return {
|
|
3617
|
+
CFBundleShortVersionString: short,
|
|
3618
|
+
CFBundleVersion: short.replace(/^0(?=\.)/, "1")
|
|
3619
|
+
};
|
|
3620
|
+
}
|
|
3420
3621
|
function parseVersion$1(v) {
|
|
3421
3622
|
const m = /^(\d+)\.(\d+)\.(\d+)/.exec(String(v ?? "").trim());
|
|
3422
3623
|
if (!m) throw new Error(`"${v}" is not a version (x.y.z)`);
|
|
@@ -4515,14 +4716,16 @@ function compareVersions(a, b) {
|
|
|
4515
4716
|
}
|
|
4516
4717
|
/** Does `version` satisfy `range`? Ranges: `*`, `x.y.z`, `>=x.y.z`, `^x.y.z` (same major; 0.y: same minor), joined by spaces (all must hold). */
|
|
4517
4718
|
function satisfies(version, range) {
|
|
4719
|
+
const prerelease = /^(\d+\.\d+\.\d+)-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*$/.exec(String(version));
|
|
4720
|
+
const base = prerelease?.[1] ?? version;
|
|
4518
4721
|
return String(range ?? "*").trim().split(/\s+/).every((part) => {
|
|
4519
4722
|
if (part === "*" || part === "") return true;
|
|
4520
4723
|
const m = /^(>=|\^|=)?(\d+\.\d+\.\d+)$/.exec(part);
|
|
4521
4724
|
if (!m) throw new Error(`unsupported version range "${part}" (use *, x.y.z, >=x.y.z or ^x.y.z)`);
|
|
4522
|
-
const c = compareVersions(
|
|
4725
|
+
const c = compareVersions(base, m[2]) || (prerelease ? -1 : 0);
|
|
4523
4726
|
if (m[1] === ">=") return c >= 0;
|
|
4524
4727
|
if (m[1] === "^") {
|
|
4525
|
-
const [vm, vn] = parseVersion(
|
|
4728
|
+
const [vm, vn] = parseVersion(base);
|
|
4526
4729
|
const [rm, rn] = parseVersion(m[2]);
|
|
4527
4730
|
return c >= 0 && vm === rm && (rm !== 0 || vn === rn);
|
|
4528
4731
|
}
|
|
@@ -7118,7 +7321,9 @@ function swift(v, source) {
|
|
|
7118
7321
|
L.push(`//`);
|
|
7119
7322
|
L.push(`// Threads: the class is @MainActor (makeView, the setters, propsUpdated and the command bodies run`);
|
|
7120
7323
|
L.push(`// on main); the emit and call methods are nonisolated (any thread).`);
|
|
7324
|
+
if (!v.commands.length) L.push("#if canImport(BakeNativeNativeViews)");
|
|
7121
7325
|
L.push(`import BakeNativeNativeViews`);
|
|
7326
|
+
if (!v.commands.length) L.push("#endif");
|
|
7122
7327
|
L.push(swiftBakeNativeImports(["BakeNativeKit", "BakeNativeAppKit"]).trimEnd());
|
|
7123
7328
|
L.push("");
|
|
7124
7329
|
L.push(doc("", v.doc) + `open class ${v.name}ViewSpec<V: AnyObject>: BakeNativeNativeView<V> {`);
|
|
@@ -7179,6 +7384,7 @@ function swift(v, source) {
|
|
|
7179
7384
|
L.push(` setState(view, next)`);
|
|
7180
7385
|
L.push(` propsUpdated(view)`);
|
|
7181
7386
|
L.push(` }`);
|
|
7387
|
+
if (!v.commands.length) return [...L, "}"].join("\n") + "\n";
|
|
7182
7388
|
L.push("");
|
|
7183
7389
|
L.push(` // MARK: generated (JSI host functions -> commands; ${v.name}ViewJSI.h calls these through C++ interop)`);
|
|
7184
7390
|
for (const c of v.commands) {
|
|
@@ -7760,8 +7966,8 @@ const APP_VIEW_TARGETS = {
|
|
|
7760
7966
|
};
|
|
7761
7967
|
/**
|
|
7762
7968
|
* Every view an app can use: @bake-native/core's (native-support.json `views`) and the app's own
|
|
7763
|
-
* (`<root>/native/views/<Name>.
|
|
7764
|
-
*
|
|
7969
|
+
* (`<root>/native/views/<Name>.native.ts`, implementations in `native/views/<kebab-name>/<family>`
|
|
7970
|
+
* unless overridden by package.json `bakenative.views.<Name>.<family>`).
|
|
7765
7971
|
* Returns [{ name, tag, signature, file, id, targets, why, instead, build, source }] sorted by name.
|
|
7766
7972
|
* `support`: the parsed native-support.json; `packageRoot`: @bake-native/core's directory.
|
|
7767
7973
|
*/
|
|
@@ -7803,8 +8009,13 @@ function viewCatalog(root, { support, packageRoot, readFile, listDir, exists })
|
|
|
7803
8009
|
for (const f of listDir(dir).filter(isViewSpecFile).sort()) {
|
|
7804
8010
|
const v = readViewSpec(readFile(`${dir}/${f}`), `native/views/${f}`);
|
|
7805
8011
|
const impl = impls[v.name] ?? {};
|
|
7806
|
-
const
|
|
7807
|
-
const
|
|
8012
|
+
const build = {};
|
|
8013
|
+
for (const fam of Object.keys(APP_VIEW_TARGETS)) {
|
|
8014
|
+
const path = `native/views/${kebab(v.name)}/${fam}`;
|
|
8015
|
+
if (typeof impl[fam] === "string") build[fam] = { path: impl[fam] };
|
|
8016
|
+
else if (exists(`${root}/${path}`)) build[fam] = { path };
|
|
8017
|
+
}
|
|
8018
|
+
const targets = ["web", ...Object.keys(build).flatMap((fam) => APP_VIEW_TARGETS[fam])];
|
|
7808
8019
|
add({
|
|
7809
8020
|
name: v.name,
|
|
7810
8021
|
tag: v.tag,
|
|
@@ -7813,9 +8024,9 @@ function viewCatalog(root, { support, packageRoot, readFile, listDir, exists })
|
|
|
7813
8024
|
file: `native/views/${f}`,
|
|
7814
8025
|
id: `view-${kebab(v.name)}`,
|
|
7815
8026
|
targets,
|
|
7816
|
-
why:
|
|
7817
|
-
instead: `implement the ${v.name} spec
|
|
7818
|
-
build
|
|
8027
|
+
why: "the app has no implementation for this target",
|
|
8028
|
+
instead: `implement the ${v.name} spec in native/views/${kebab(v.name)}/<family> or set bakenative.views.${v.name} in package.json, or branch on import.meta.env.BAKE_TARGET`,
|
|
8029
|
+
build,
|
|
7819
8030
|
source: "app"
|
|
7820
8031
|
});
|
|
7821
8032
|
}
|
|
@@ -7846,4 +8057,4 @@ function viewIssues(used, catalog, target) {
|
|
|
7846
8057
|
function viewRequires(used, catalog) {
|
|
7847
8058
|
return Object.fromEntries(used.map((n) => [n, catalog.find((v) => v.name === n).signature]));
|
|
7848
8059
|
}
|
|
7849
|
-
export { RUNTIME_PROVIDES as $, moduleDir as A,
|
|
8060
|
+
export { RUNTIME_PROVIDES as $, moduleDir as A, rootPropParams as At, DEPS_RULE as B, usesViewRef as Bt, MODULES_DIR as C, importLine as Ct, compareVersions as D, originalPosition as Dt, buildRegistry as E, markupIssues as Et, registryLocation as F, usesCustomProperties as Ft, packageDepIssues as G, readPackageJson as Gt, mergeNativeDeps as H, usesWebCrypto as Ht, satisfies as I, usesDialogs as It, unpinnedPackages as J, readNativeDeps as K, checkElement as Kt, sha256 as L, usesElementApi as Lt, openRegistry as M, swiftUiIssues as Mt, parseRequest as N, swiftUiTargetMessage as Nt, filesFor as O, patternNames as Ot, readLock as P, uiIssues as Pt, FIRST_PARTY_MODULES as Q, verifyModules as R, usesPageElements as Rt, LOCK_FILE as S, hostEmitIssues as St, appModules as T, liveReferences as Tt, nativeDepComponents as U, usesWebFetch as Ut, NativeDepsError as V, usesVisibility as Vt, nativeDepLibraries as W, packageRoot as Wt, merge3 as X, diffStat as Y, unifiedDiff as Z, specsSchema as _, decodeMappings as _t, viewDeclarations as a, memberSignatures as at, webSpec as b, globalIssues as bt, viewRequires as c, SUPPORT as ct, calledSpecs as d, allowed as dt, bundleRequires as et, generateSpecs as f, checkImageSourceSyntax as ft, snake$1 as g, deadBranches as gt, rustSpec as h, constNumber as ht, viewClientParts as i, frameworkBundleVersions as it, normalize as j, styleCss as jt, lockEntry as k, refineLine as kt, appModuleFiles as l, SYSTEM_MODULES as lt, parseModuleSpec as m, componentDeclarations as mt, usedViews as n, cssProperties as nt, viewFiles as o, releaseCheck as ot, kotlinSpec as p, checkSafeAreaEdgesSyntax as pt, unitPath as q, viewCatalog as r, defaultRuntimeRange as rt, viewIssues as s, satisfies$1 as st, readViewSpec as t, checkUses as tt, appModuleSpecs as u, VIEW_ELEMENTS as ut, swiftBakeNativeImports as v, dialogWarnings as vt, OFFICIAL as w, lineStartsOf as wt, ALL_TARGETS as x, headerIconIssues as xt, swiftSpec as y, freeReferences as yt, writeLock as z, usesPopover as zt };
|
package/dist/octane/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as RUNTIME_PROVIDES, H as mergeNativeDeps, K as readNativeDeps, P as readLock,
|
|
1
|
+
import { $ as RUNTIME_PROVIDES, Gt as readPackageJson, H as mergeNativeDeps, K as readNativeDeps, P as readLock, W as nativeDepLibraries, Wt as packageRoot$1, _ as specsSchema, at as memberSignatures, d as calledSpecs, g as snake, h as rustSpec, it as frameworkBundleVersions, l as appModuleFiles, lt as SYSTEM_MODULES, o as viewFiles, p as kotlinSpec, q as unitPath, rt as defaultRuntimeRange, st as satisfies, t as readViewSpec, u as appModuleSpecs, v as swiftBakeNativeImports, y as swiftSpec } from "./native-views-COg9tj_5.mjs";
|
|
2
2
|
import { chmodSync, closeSync, copyFileSync, cpSync, existsSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, symlinkSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
@@ -865,7 +865,7 @@ const header = (c, target, units) => `${c} Generated by \`bake native link\` fro
|
|
|
865
865
|
* `prebuilt` (ios, mac): `bakenative` is the prebuilt runtime an npm install brings
|
|
866
866
|
* (src/apple-runtime.ts), a Swift package with the host products only (BakeNativeKit, BakeNativeAppKit).
|
|
867
867
|
* A bundle that needs more of the BakeNative package (a first-party module the app has no copy of,
|
|
868
|
-
* a
|
|
868
|
+
* a built-in view or a view with commands) is refused with what to do.
|
|
869
869
|
* `out`: the directory the files go to; the native dependencies' local paths (binary targets,
|
|
870
870
|
* jniLibs, source folders, path crates) are written relative to it.
|
|
871
871
|
* @param {string} target @param {string[]} names @param {{ bakenative?: string, prebuilt?: boolean, views?: { name: string, unit: any, signature?: string }[], minSdk?: number, app?: { name: string, module: string, locked?: boolean, files: { path: string, text: string }[], deps?: any }[], appModules?: { required: string[], optional: string[] }, specs?: Map<string, any>, out?: string }} [opts]
|
|
@@ -880,7 +880,8 @@ function registrationFiles(target, names, { bakenative, prebuilt = false, views
|
|
|
880
880
|
if (family === "apple" && prebuilt) {
|
|
881
881
|
const problems = [];
|
|
882
882
|
if (units.length) problems.push(`the bundle uses ${list(units)} without a copy in the app: add ${units.length === 1 ? "it" : "them"} with \`bake add ${units.map((u) => u.name.toLowerCase()).join(" ")}\``);
|
|
883
|
-
|
|
883
|
+
const sourceViews = v.filter(({ unit }) => !unit.app || unit.spec.commands.length);
|
|
884
|
+
if (sourceViews.length) problems.push(`the bundle renders the native view${sourceViews.length === 1 ? "" : "s"} ${sourceViews.map((x) => x.name).join(", ")}, which needs the source checkout`);
|
|
884
885
|
if (problems.length) throw new Error(`the prebuilt Apple runtime has the ${target} host only (${target === "ios" ? "BakeNativeKit" : "BakeNativeAppKit"}): ${problems.join("; ")}. Or build against an BakeNative source checkout: bake native link --target ${target} --bakenative <checkout>`);
|
|
885
886
|
}
|
|
886
887
|
const called = calledSpecs(specs, appModules);
|
|
@@ -896,7 +897,7 @@ function registrationFiles(target, names, { bakenative, prebuilt = false, views
|
|
|
896
897
|
if (!out) throw new Error(`registration for ${target}: native dependencies with local paths need the output directory (out)`);
|
|
897
898
|
return unitPath(out, abs);
|
|
898
899
|
};
|
|
899
|
-
if (family === "apple") return [...appleFiles(target, units, bakenative, v, mods, auto, deps, where), ...ownFiles];
|
|
900
|
+
if (family === "apple") return [...appleFiles(target, units, bakenative, v, mods, auto, deps, where, prebuilt), ...ownFiles];
|
|
900
901
|
if (family === "android") return [...androidFiles(target, units, v, minSdk, mods, auto, deps, where), ...ownFiles];
|
|
901
902
|
return [...windowsFiles(target, units, bakenative, v, mods, auto, contracts, deps, where), ...ownFiles];
|
|
902
903
|
}
|
|
@@ -930,8 +931,8 @@ const TEST = /(Tests?\.swift|Test\.kt|_test\.rs)$/;
|
|
|
930
931
|
/**
|
|
931
932
|
* The build unit of a view the app declares itself (`native/views/<Name>.native.ts`, its
|
|
932
933
|
* implementation at package.json "bakenative".views.<Name>.<family>), for `target`: on Apple the
|
|
933
|
-
* generated registration compiles
|
|
934
|
-
*
|
|
934
|
+
* generated registration compiles the generated base, the app's implementation, and the JSI
|
|
935
|
+
* glue if the view has commands. Android copies commandless Kotlin views and their
|
|
935
936
|
* contracts into its registration module. Windows registers built-in views only.
|
|
936
937
|
*/
|
|
937
938
|
function appViewUnit(root, entry, target) {
|
|
@@ -1033,14 +1034,16 @@ function appleTargetDeps(d) {
|
|
|
1033
1034
|
settings: d.apple.frameworks.length ? `, linkerSettings: [${d.apple.frameworks.map((f) => `.linkedFramework(${q(f)})`).join(", ")}]` : ""
|
|
1034
1035
|
};
|
|
1035
1036
|
}
|
|
1036
|
-
function appleFiles(target, units, bakenative, views, mods, auto
|
|
1037
|
+
function appleFiles(target, units, bakenative, views, mods, auto, deps, where, prebuilt) {
|
|
1037
1038
|
const host = target === "ios" ? "BakeNativeKit" : "BakeNativeAppKit";
|
|
1038
1039
|
const own = views.filter((v) => v.unit.app);
|
|
1040
|
+
const viewRuntime = prebuilt ? host : "BakeNativeNativeViews";
|
|
1041
|
+
const hasCommands = own.some(({ unit }) => unit.spec.commands.length);
|
|
1039
1042
|
const products = [
|
|
1040
1043
|
host,
|
|
1041
1044
|
...units.map((u) => u.unit.product),
|
|
1042
1045
|
...views.filter((v) => !v.unit.app).map((v) => v.unit.product),
|
|
1043
|
-
...own.length ? [
|
|
1046
|
+
...own.length && !prebuilt ? [viewRuntime] : []
|
|
1044
1047
|
];
|
|
1045
1048
|
const all = deps?.all.apple ?? {
|
|
1046
1049
|
packages: [],
|
|
@@ -1053,7 +1056,7 @@ function appleFiles(target, units, bakenative, views, mods, auto = [], deps = nu
|
|
|
1053
1056
|
${header("//", target, units)}// The app target depends on the product BakeNativeAppModules and registers BakeNativeBundleModules.entries
|
|
1054
1057
|
// in its app-layer module registry. A module the bundles do not use is not linked.
|
|
1055
1058
|
import PackageDescription
|
|
1056
|
-
${
|
|
1059
|
+
${hasCommands ? `import Foundation\n\nlet bakeNativePath = ${JSON.stringify(bakenative)}\n${appViewIncludes}` : ""}
|
|
1057
1060
|
let package = Package(
|
|
1058
1061
|
name: "BakeNativeAppModules",
|
|
1059
1062
|
platforms: [.macOS("14.0"), .iOS("16.0")],
|
|
@@ -1062,8 +1065,8 @@ let package = Package(
|
|
|
1062
1065
|
targets: [
|
|
1063
1066
|
.target(name: "BakeNativeAppModules", dependencies: [
|
|
1064
1067
|
${products.map((p) => ` .product(name: "${p}", package: "BakeNative"),`).join("\n")}${own.map((v) => `\n "${v.unit.product}",`).join("")}${mine.entries.map((e) => `\n ${e},`).join("")}
|
|
1065
|
-
]${mine.settings}),${own.map((v) => appViewTargets(v.unit)).join("")}${binaries}
|
|
1066
|
-
]${
|
|
1068
|
+
]${mine.settings}),${own.map((v) => appViewTargets(v.unit, viewRuntime)).join("")}${binaries}
|
|
1069
|
+
]${hasCommands ? ",\n cxxLanguageStandard: .cxx17" : ""}
|
|
1067
1070
|
)
|
|
1068
1071
|
`;
|
|
1069
1072
|
const swift = `${header("//", target, units)}${swiftBakeNativeImports([host])}
|
|
@@ -1105,18 +1108,18 @@ let bakeNativeDir = URL(fileURLWithPath: bakeNativePath, relativeTo: URL(fileURL
|
|
|
1105
1108
|
let viewHeaders: [String] = ["native/hermes/artifacts/include", "native/hermes/BakeNativeJSI/include", "native/rust/apple/Sources/CBakeNativeRust/include"]
|
|
1106
1109
|
.flatMap { ["-I", bakeNativeDir + "/" + $0] }
|
|
1107
1110
|
`;
|
|
1108
|
-
/**
|
|
1109
|
-
|
|
1110
|
-
* implementation `BakeNativeAppView<Name>`. */
|
|
1111
|
-
function appViewTargets(u) {
|
|
1111
|
+
/** The generated Swift base and the app implementation, plus C++ interop for commands. */
|
|
1112
|
+
function appViewTargets(u, runtime) {
|
|
1112
1113
|
const n = u.spec.name;
|
|
1113
1114
|
const at = `Sources/AppViews/${n}`;
|
|
1114
1115
|
const d = appleTargetDeps(u.deps);
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
.target(name: "${
|
|
1118
|
-
swiftSettings: [.interoperabilityMode(.Cxx), .unsafeFlags(["-Xfrontend", "-disable-cxx-interop-requirement-at-import"])]
|
|
1119
|
-
|
|
1116
|
+
const host = `.product(name: "${runtime}", package: "BakeNative")`;
|
|
1117
|
+
const commands = u.spec.commands.length > 0;
|
|
1118
|
+
const jsi = commands ? `\n .target(name: "${n}ViewJSI", path: "${at}/JSI", cxxSettings: [.unsafeFlags(viewHeaders)]),` : "";
|
|
1119
|
+
const interop = commands ? `,\n swiftSettings: [.interoperabilityMode(.Cxx), .unsafeFlags(["-Xfrontend", "-disable-cxx-interop-requirement-at-import"])]` : "";
|
|
1120
|
+
return `${jsi}
|
|
1121
|
+
.target(name: "${u.specModule}", dependencies: [${host}${commands ? `, "${n}ViewJSI"` : ""}], path: "${at}/Spec"${interop}),
|
|
1122
|
+
.target(name: "${u.product}", dependencies: [${host}, "${u.specModule}"${d.entries.map((e) => `, ${e}`).join("")}], path: "${at}/View"${d.settings}),`;
|
|
1120
1123
|
}
|
|
1121
1124
|
/** An app view's files in the package: the generated Apple glue and the implementation. */
|
|
1122
1125
|
function appViewSources(u) {
|
|
@@ -1125,26 +1128,28 @@ function appViewSources(u) {
|
|
|
1125
1128
|
const gen = viewFiles(u.spec);
|
|
1126
1129
|
const pick = (p) => gen.find((f) => f.path === p)?.text ?? "";
|
|
1127
1130
|
return [
|
|
1128
|
-
{
|
|
1129
|
-
path: `Sources/AppViews/${n}ViewJSI.h`,
|
|
1130
|
-
text: pick(`${n}ViewJSI.h`)
|
|
1131
|
-
},
|
|
1132
|
-
{
|
|
1133
|
-
path: `${at}/JSI/${n}ViewJSIApple.cpp`,
|
|
1134
|
-
text: pick(`apple/${n}ViewJSI/${n}ViewJSIApple.cpp`)
|
|
1135
|
-
},
|
|
1136
|
-
{
|
|
1137
|
-
path: `${at}/JSI/include/${n}ViewJSIApple.h`,
|
|
1138
|
-
text: pick(`apple/${n}ViewJSI/include/${n}ViewJSIApple.h`)
|
|
1139
|
-
},
|
|
1140
1131
|
{
|
|
1141
1132
|
path: `${at}/Spec/${n}ViewSpec.swift`,
|
|
1142
1133
|
text: pick(`apple/${n}ViewSpec/${n}ViewSpec.swift`)
|
|
1143
1134
|
},
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1135
|
+
...u.spec.commands.length ? [
|
|
1136
|
+
{
|
|
1137
|
+
path: `Sources/AppViews/${n}ViewJSI.h`,
|
|
1138
|
+
text: pick(`${n}ViewJSI.h`)
|
|
1139
|
+
},
|
|
1140
|
+
{
|
|
1141
|
+
path: `${at}/JSI/${n}ViewJSIApple.cpp`,
|
|
1142
|
+
text: pick(`apple/${n}ViewJSI/${n}ViewJSIApple.cpp`)
|
|
1143
|
+
},
|
|
1144
|
+
{
|
|
1145
|
+
path: `${at}/JSI/include/${n}ViewJSIApple.h`,
|
|
1146
|
+
text: pick(`apple/${n}ViewJSI/include/${n}ViewJSIApple.h`)
|
|
1147
|
+
},
|
|
1148
|
+
{
|
|
1149
|
+
path: `${at}/Spec/${n}ViewInterop.swift`,
|
|
1150
|
+
text: pick(`apple/${n}ViewSpec/${n}ViewInterop.swift`)
|
|
1151
|
+
}
|
|
1152
|
+
] : [],
|
|
1148
1153
|
...u.files.map((f) => ({
|
|
1149
1154
|
path: `${at}/View/${f.path}`,
|
|
1150
1155
|
text: f.text.replace(/\r\n/g, "\n")
|
|
@@ -1749,8 +1754,7 @@ async function buildFramework({ module, slice, swift, cxx = [], includes = [], f
|
|
|
1749
1754
|
CFBundleInfoDictionaryVersion: "6.0",
|
|
1750
1755
|
CFBundleName: module,
|
|
1751
1756
|
CFBundlePackageType: "FMWK",
|
|
1752
|
-
|
|
1753
|
-
CFBundleVersion: version,
|
|
1757
|
+
...frameworkBundleVersions(version),
|
|
1754
1758
|
CFBundleSupportedPlatforms: [s.platform],
|
|
1755
1759
|
...s.os === "mac" ? { LSMinimumSystemVersion: MACOS_MIN } : { MinimumOSVersion: IOS_MIN }
|
|
1756
1760
|
};
|
package/dist/react/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as bundledFonts } from "./config-B1W8gfZY.mjs";
|
|
2
2
|
import { $ as createInputTrace, A as longestMatch, B as hiddenCommandAliasesKey, C as flag, Ct as lineBreak, Dt as value, Et as text, F as optional, G as collectExplicitSourceValuesAsync, H as collectRootOptionNames, I as withDefault, J as attemptParseSync, K as createDependencyRuntimeContext, L as getJoinedFileSuggestion, O as string, Ot as cacheTerminalTheme, P as multiple, Q as getDocPageForConsumedPrefix, R as completeOrExtractPhase2Seed, S as constant, St as formatMessage, Tt as optionName, U as projectCommandUsage, V as collectActiveOptionNames, W as collectExplicitSourceValues, X as createParserContext, Y as createEffectfulCompletionSession, Z as getDocPage, _t as validateMetaNameCollisions, at as minimumUsageWidth, b as argument, bt as injectAnnotations, ct as spaceAfterLabel, dt as formatUsageTerm, et as dispatchByMode, ft as isSuggestionHidden, gt as validateLabel, ht as validateContextIds, it as hasAutomaticWidth, j as object, k as group$2, kt as renderTerminalTerm, lt as cloneUsage, mt as validateCommandNames, nt as isDocEntryHidden, ot as withAutomaticWidth, pt as normalizeUsage, q as attemptParseAsync, rt as renderErrorMessage, st as measureText, tt as formatDocPage, ut as formatUsage, vt as validateOptionNames, w as option, wt as message, x as command, xt as commandLine, yt as validateProgramName$1, z as allowDuplicateLeadingCommandNamesKey } from "./client-Cm7o6dQd.mjs";
|
|
3
|
-
import { Q as appEntries, i as ANDROID_RUNTIME, l as parseRange, o as formatRange, u as rangeAccepts } from "./package-
|
|
3
|
+
import { Q as appEntries, i as ANDROID_RUNTIME, l as parseRange, o as formatRange, u as rangeAccepts } from "./package-CYWHh6C1.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import fs, { existsSync, mkdirSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync, writeSync } from "node:fs";
|
|
6
6
|
import path, { basename, dirname, extname, isAbsolute, join, parse as parse$1, relative, resolve, sep } from "node:path";
|