@geastack/geatsc-plugin-gea 0.1.21 → 0.1.22
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/dist/analyze-node-aux.js
CHANGED
|
@@ -47,7 +47,7 @@ export function addNodeAuxFeatures(file, text, features, isNumeric) {
|
|
|
47
47
|
const source = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, /\.[jt]sx$/i.test(file) ? ts.ScriptKind.TSX : ts.ScriptKind.TS);
|
|
48
48
|
const unknown = () => addUnknownNodeAux(features);
|
|
49
49
|
const token = (name) => {
|
|
50
|
-
if (/^(?:addEventListener|removeEventListener|setEventListener|dispatchEvent|on[A-Z].*|on(?:click|pointer.*|touch.*|input|keydown|scroll)|click|touchstart|touchmove|touchend|pointerdown|pointermove|pointerup|input|keydown|scroll)$/.test(name))
|
|
50
|
+
if (/^(?:addEventListener|removeEventListener|setEventListener|dispatchEvent|on[A-Z].*|on(?:click|pointer.*|touch.*|input|keydown|keyup|scroll)|click|touchstart|touchmove|touchend|pointerdown|pointermove|pointerup|input|keydown|keyup|scroll)$/.test(name))
|
|
51
51
|
features.add('node-listeners');
|
|
52
52
|
if (/^(?:id|dataset|attributes|getElementById|querySelector|querySelectorAll|ensureAppRoot|setAttribute|getAttribute|removeAttribute|hasAttribute|toggleAttribute|setPressId|setPressValue|pressId|pressValue|data-press-id|data-press-value)$/.test(name))
|
|
53
53
|
features.add('node-attributes');
|
package/dist/analyze.js
CHANGED
|
@@ -201,11 +201,81 @@ function addBindingsForEmbeddedHostNames(text, bindings) {
|
|
|
201
201
|
if (documentHostRegex.test(text))
|
|
202
202
|
bindings.add('dom');
|
|
203
203
|
}
|
|
204
|
+
function applicationDir(entry) {
|
|
205
|
+
let dir = path.dirname(path.resolve(entry));
|
|
206
|
+
for (;;) {
|
|
207
|
+
if (fs.existsSync(path.join(dir, 'package.json')))
|
|
208
|
+
return dir;
|
|
209
|
+
const parent = path.dirname(dir);
|
|
210
|
+
if (parent === dir)
|
|
211
|
+
return null;
|
|
212
|
+
dir = parent;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
function buildSourceAliases(entry) {
|
|
216
|
+
const appDir = applicationDir(entry);
|
|
217
|
+
if (!appDir)
|
|
218
|
+
return [];
|
|
219
|
+
const aliases = [];
|
|
220
|
+
let geaThreejs = false;
|
|
221
|
+
try {
|
|
222
|
+
const manifest = JSON.parse(fs.readFileSync(path.join(appDir, 'package.json'), 'utf8'));
|
|
223
|
+
geaThreejs = manifest.gea?.geaThreejs === true;
|
|
224
|
+
const raw = manifest.gea?.moduleAliases;
|
|
225
|
+
if (raw && typeof raw === 'object' && !Array.isArray(raw)) {
|
|
226
|
+
for (const [specifier, target] of Object.entries(raw)) {
|
|
227
|
+
if (typeof target !== 'string' || !target)
|
|
228
|
+
continue;
|
|
229
|
+
const replacement = path.resolve(appDir, target);
|
|
230
|
+
aliases.push({ find: specifier, replacement: () => replacement });
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
catch {
|
|
235
|
+
// An unreadable manifest names no aliases; the build reports it.
|
|
236
|
+
}
|
|
237
|
+
// The three.js redirect is opt-in, exactly as in the build.
|
|
238
|
+
if (!geaThreejs)
|
|
239
|
+
return aliases;
|
|
240
|
+
const appRequire = createRequire(path.join(appDir, 'package.json'));
|
|
241
|
+
let geaThreeSrcDir = '';
|
|
242
|
+
try {
|
|
243
|
+
geaThreeSrcDir = path.join(path.dirname(fs.realpathSync(appRequire.resolve('@geastack/gea-threejs/package.json'))), 'src');
|
|
244
|
+
}
|
|
245
|
+
catch {
|
|
246
|
+
return aliases;
|
|
247
|
+
}
|
|
248
|
+
aliases.push({ find: /^three$/, replacement: () => path.join(geaThreeSrcDir, 'Three.ts') });
|
|
249
|
+
aliases.push({ find: /^three\/src\/(.+)\.js$/, replacement: (m) => path.join(geaThreeSrcDir, `${m[1]}.ts`) });
|
|
250
|
+
try {
|
|
251
|
+
appRequire.resolve('troika-three-text');
|
|
252
|
+
const troika = fs.realpathSync(appRequire.resolve('@geastack/native-webgl-angle/troika-three-text'));
|
|
253
|
+
aliases.push({ find: /^troika-three-text$/, replacement: () => troika });
|
|
254
|
+
}
|
|
255
|
+
catch {
|
|
256
|
+
// No troika, or no native text module: the build fails on the latter itself.
|
|
257
|
+
}
|
|
258
|
+
return aliases;
|
|
259
|
+
}
|
|
260
|
+
function aliasedModule(aliases, specifier) {
|
|
261
|
+
for (const alias of aliases) {
|
|
262
|
+
if (typeof alias.find === 'string') {
|
|
263
|
+
if (specifier === alias.find)
|
|
264
|
+
return alias.replacement([specifier]);
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
const match = specifier.match(alias.find);
|
|
268
|
+
if (match)
|
|
269
|
+
return alias.replacement(match);
|
|
270
|
+
}
|
|
271
|
+
return null;
|
|
272
|
+
}
|
|
204
273
|
function discoverSourceFiles(entry) {
|
|
205
274
|
const visited = new Set();
|
|
206
275
|
const files = [];
|
|
207
276
|
let unknown = false;
|
|
208
277
|
let runtimeUnknown = false;
|
|
278
|
+
const aliases = buildSourceAliases(entry);
|
|
209
279
|
function visit(file) {
|
|
210
280
|
const resolved = path.resolve(file);
|
|
211
281
|
// An entry that is a directory (a configure run without app metadata)
|
|
@@ -241,7 +311,8 @@ function discoverSourceFiles(entry) {
|
|
|
241
311
|
// external code may supply styles/components we cannot inspect here.
|
|
242
312
|
if (/^(?:gea-embedded|@geastack\/(?:core|engine)|@geajs\/core)(?:\/|$)/.test(specifier))
|
|
243
313
|
continue;
|
|
244
|
-
const
|
|
314
|
+
const aliased = aliasedModule(aliases, specifier);
|
|
315
|
+
const dependency = aliased ?? (specifier.startsWith('.') ? resolveRelativeModule(resolved, specifier) : resolvePackageModule(resolved, specifier));
|
|
245
316
|
if (dependency)
|
|
246
317
|
visit(dependency);
|
|
247
318
|
else
|
|
@@ -1212,7 +1212,7 @@ function lowerRootEvent(varName, slot, storeFields = [], storeMethods = [], fiel
|
|
|
1212
1212
|
// `document` (no body delegation, no containsNode/currentTarget bookkeeping)
|
|
1213
1213
|
// and the runtime dispatches them off-tree.
|
|
1214
1214
|
const isDocumentLevel = eventType === 'rotary' ||
|
|
1215
|
-
(eventType === 'keydown' && rootTag !== undefined && rootTag.toLowerCase() !== 'input');
|
|
1215
|
+
((eventType === 'keydown' || eventType === 'keyup') && rootTag !== undefined && rootTag.toLowerCase() !== 'input');
|
|
1216
1216
|
if (isDocumentLevel) {
|
|
1217
1217
|
const docCaptures = [
|
|
1218
1218
|
...(hoisted.handler.some((line) => new RegExp(`\\b${varName}\\b`).test(line)) ? [varName] : []),
|
|
@@ -965,6 +965,7 @@ function lowerHostFacadeCall(context, path, args) {
|
|
|
965
965
|
'Camera.draw': { target: 'gea::host::Camera.draw', hints: ['number', 'number', 'number', 'number'] },
|
|
966
966
|
'Camera.capture': { target: 'gea::host::Camera.capture', optionsRecord: true },
|
|
967
967
|
'Camera.captureMirrored': { target: 'gea::host::Camera.captureMirrored' },
|
|
968
|
+
'Camera.captureFrame': { target: 'gea::host::Camera.captureFrame' },
|
|
968
969
|
'Camera.setFlash': { target: 'gea::host::Camera.setFlash', hints: ['string'] },
|
|
969
970
|
'Camera.setZoom': { target: 'gea::host::Camera.setZoom', hints: ['number'] },
|
|
970
971
|
'Camera.setMirror': { target: 'gea::host::Camera.setMirror', hints: ['boolean'] },
|
|
@@ -35,6 +35,7 @@ const geaBase64Declarations = [...geaHostDeclarations, '#include "gea/base64-run
|
|
|
35
35
|
export const geaVirtualListRowHeightEmit = 'static_cast<double>(gea::embedded::ui::VirtualListRenderer::rowHeight(({receiver}).id()))';
|
|
36
36
|
export const geaHostHeaderDeclarationToken = '__gea_cpp_api_header';
|
|
37
37
|
const geaImageHostMethods = [
|
|
38
|
+
'removeFile',
|
|
38
39
|
'loadBytes',
|
|
39
40
|
'loadBytesOpaque',
|
|
40
41
|
'draw',
|
|
@@ -62,10 +63,10 @@ const geaGeolocationHostMethods = [
|
|
|
62
63
|
const geaInputHostMethods = ['consumeBackButton'];
|
|
63
64
|
const geaGpioHostMethods = ['configureOutput', 'configureInput', 'write', 'read'];
|
|
64
65
|
const geaLedHostMethods = ['set', 'off', 'attach', 'setPixel', 'show', 'detach'];
|
|
65
|
-
const geaClockHostMethods = ['epochMs'];
|
|
66
|
+
const geaClockHostMethods = ['epochMs', 'setEpochMs'];
|
|
66
67
|
const geaProfilerHostMethods = ['nowUs', 'nowCycles'];
|
|
67
68
|
const geaStorageHostMethods = ['getItem', 'setItem', 'removeItem', 'clear', 'key'];
|
|
68
|
-
const geaBatteryHostMethods = ['level'];
|
|
69
|
+
const geaBatteryHostMethods = ['level', 'charging'];
|
|
69
70
|
const geaNotifyHostMethods = ['text', 'seq'];
|
|
70
71
|
const geaDeviceControlHostMethods = ['exec'];
|
|
71
72
|
const geaNativeBenchHostMethods = [
|
|
@@ -164,7 +165,8 @@ const rawGeaHostExternDeclarations = Object.fromEntries([
|
|
|
164
165
|
['gea::host::fetchRelease', geaHostDeclarations],
|
|
165
166
|
['gea::host::websocket::create_handle', geaHostDeclarations],
|
|
166
167
|
['gea::host::WebSocket', geaHostDeclarations],
|
|
167
|
-
['gea::host::http::
|
|
168
|
+
['gea::host::http::create_typed_server', [...geaHostDeclarations, '#include "gea/http-native-runtime.h"']],
|
|
169
|
+
['gea::host::Haptics.vibrate', geaHostDeclarations],
|
|
168
170
|
['gea::host::HttpServer', geaHostDeclarations],
|
|
169
171
|
['gea::host::media::get_user_media_audio', geaHostDeclarations],
|
|
170
172
|
...geaGeolocationHostMethods.map((method) => [`gea::host::navigator.geolocation.${method}`, geaHostDeclarations]),
|
|
@@ -188,6 +190,7 @@ const rawGeaHostExternDeclarations = Object.fromEntries([
|
|
|
188
190
|
['gea::host::sharedAudioContext()', geaHostDeclarations],
|
|
189
191
|
['gea::host::sharedAudioContext().createOscillator', geaHostDeclarations],
|
|
190
192
|
['gea::host::sharedAudioContext().createBufferSource', geaHostDeclarations],
|
|
193
|
+
['gea::host::sharedAudioContext().createBuffer', geaHostDeclarations],
|
|
191
194
|
['gea::host::sharedAudioContext().decodeAudioData', geaHostDeclarations],
|
|
192
195
|
['gea::host::sharedAudioContext().currentTime', geaHostDeclarations],
|
|
193
196
|
['gea::host::sharedAudioContext().destination', geaHostDeclarations],
|
|
@@ -325,6 +328,7 @@ const rawGeaHostExternDeclarations = Object.fromEntries([
|
|
|
325
328
|
['gea::host::Camera.draw', geaHostDeclarations],
|
|
326
329
|
['gea::host::Camera.capture', geaHostDeclarations],
|
|
327
330
|
['gea::host::Camera.captureMirrored', geaHostDeclarations],
|
|
331
|
+
['gea::host::Camera.captureFrame', geaHostDeclarations],
|
|
328
332
|
['gea::host::Camera.setFlash', geaHostDeclarations],
|
|
329
333
|
['gea::host::Camera.setZoom', geaHostDeclarations],
|
|
330
334
|
['gea::host::Camera.setMirror', geaHostDeclarations]
|
package/dist/host-shims.js
CHANGED
|
@@ -36,6 +36,8 @@ const EVENT_RECEIVER_TYPES = [
|
|
|
36
36
|
// `EventTarget.addEventListener(type, listener)` declare.
|
|
37
37
|
"Event",
|
|
38
38
|
"PointerEvent",
|
|
39
|
+
"PressEvent",
|
|
40
|
+
"PressEventArgument",
|
|
39
41
|
"TouchEvent",
|
|
40
42
|
"RotaryEvent",
|
|
41
43
|
// `InputEvent` and `KeyEvent` (index.d.ts) are the same one runtime struct:
|
|
@@ -66,6 +68,7 @@ const RTC_PEER_CONNECTION_RECEIVER_TYPES = [
|
|
|
66
68
|
const EVENT_TARGET_RECEIVER_TYPES = [
|
|
67
69
|
"gea::framework::events::EventTarget",
|
|
68
70
|
"InputEventTarget",
|
|
71
|
+
"PressEventTarget",
|
|
69
72
|
];
|
|
70
73
|
// Receiver type names for a concrete `gea::host::GeaEmbeddedImage` value: the
|
|
71
74
|
// qualified storage type, the unqualified TS interface name, and the `LoadedImage`
|
|
@@ -315,6 +318,8 @@ export function createGeaHostShims() {
|
|
|
315
318
|
// never reached it either. A wrapper `<div>`'s drag handlers received
|
|
316
319
|
// nothing, silently, and the app just did not respond.
|
|
317
320
|
PointerEvent: "gea::framework::events::PointerEvent",
|
|
321
|
+
PressEvent: "gea::framework::events::PointerEvent",
|
|
322
|
+
PressEventArgument: "gea::framework::events::PointerEvent",
|
|
318
323
|
TouchEvent: "gea::framework::events::PointerEvent",
|
|
319
324
|
RotaryEvent: "gea::framework::events::PointerEvent",
|
|
320
325
|
// The base interface, for `onScroll={e => ...}` and any listener typed by
|
|
@@ -344,6 +349,7 @@ export function createGeaHostShims() {
|
|
|
344
349
|
// attribute). v1 emitted exactly this:
|
|
345
350
|
// `event.currentTarget.getAttribute("value")`.
|
|
346
351
|
InputEventTarget: "gea::framework::events::EventTarget",
|
|
352
|
+
PressEventTarget: "gea::framework::events::EventTarget",
|
|
347
353
|
// gea-embedded's own element interfaces (index.d.ts) — without these a
|
|
348
354
|
// `Component<GeaCanvasElement>`'s `this.el` lowers to a record-alias struct
|
|
349
355
|
// of std::functions whose boxed form has no `__gea_node_id`, so
|
|
@@ -528,6 +534,7 @@ export function createGeaHostShims() {
|
|
|
528
534
|
WiFi: "gea::host::navigator.wifi",
|
|
529
535
|
wifi: "gea::host::navigator.wifi",
|
|
530
536
|
http: "gea::host::http",
|
|
537
|
+
__gea_http: "gea::host::http",
|
|
531
538
|
Accelerometer: "Accelerometer",
|
|
532
539
|
__gea_Accelerometer: "gea::host::Accelerometer",
|
|
533
540
|
Camera: "gea::host::Camera",
|
|
@@ -540,6 +547,7 @@ export function createGeaHostShims() {
|
|
|
540
547
|
Gpio: "gea::host::Gpio",
|
|
541
548
|
Led: "gea::host::Led",
|
|
542
549
|
Clock: "gea::host::Clock",
|
|
550
|
+
Haptics: "gea::host::Haptics",
|
|
543
551
|
Profiler: "gea::host::Profiler",
|
|
544
552
|
Battery: "gea::host::Battery",
|
|
545
553
|
Notify: "gea::host::Notify",
|
|
@@ -555,6 +563,7 @@ export function createGeaHostShims() {
|
|
|
555
563
|
__gea_Gpio: "gea::host::Gpio",
|
|
556
564
|
__gea_Led: "gea::host::Led",
|
|
557
565
|
__gea_Clock: "gea::host::Clock",
|
|
566
|
+
__gea_Haptics: "gea::host::Haptics",
|
|
558
567
|
__gea_Profiler: "gea::host::Profiler",
|
|
559
568
|
__gea_Battery: "gea::host::Battery",
|
|
560
569
|
__gea_Notify: "gea::host::Notify",
|
|
@@ -726,6 +735,7 @@ export function createGeaHostShims() {
|
|
|
726
735
|
loadFileOpaque: "gea::host::image.loadFileOpaque",
|
|
727
736
|
loadAssetPath: "gea::host::image.loadAssetPath",
|
|
728
737
|
writeFile: "gea::host::image.writeFile",
|
|
738
|
+
removeFile: "gea::host::image.removeFile",
|
|
729
739
|
readFile: "gea::host::image.readFile",
|
|
730
740
|
readMapArchive: "gea::host::image.readMapArchive",
|
|
731
741
|
readFileRange: "gea::host::image.readFileRange",
|
|
@@ -975,6 +985,11 @@ export function createGeaHostShims() {
|
|
|
975
985
|
getIP: "gea::host::navigator.wifi.ip",
|
|
976
986
|
mac: "gea::host::navigator.wifi.mac",
|
|
977
987
|
configure: "gea::host::navigator.wifi.configure",
|
|
988
|
+
startAccessPoint: "gea::host::navigator.wifi.startAccessPoint",
|
|
989
|
+
stopAccessPoint: "gea::host::navigator.wifi.stopAccessPoint",
|
|
990
|
+
accessPointMac: "gea::host::navigator.wifi.accessPointMac",
|
|
991
|
+
startCaptivePortal: "gea::host::navigator.wifi.startCaptivePortal",
|
|
992
|
+
stopCaptivePortal: "gea::host::navigator.wifi.stopCaptivePortal",
|
|
978
993
|
waitForConnection: "gea::host::navigator.wifi.waitForConnection",
|
|
979
994
|
startScan: "gea::host::navigator.wifi.startScan",
|
|
980
995
|
scanning: "gea::host::navigator.wifi.scanning",
|
|
@@ -996,6 +1011,11 @@ export function createGeaHostShims() {
|
|
|
996
1011
|
getIP: "gea::host::navigator.wifi.ip",
|
|
997
1012
|
mac: "gea::host::navigator.wifi.mac",
|
|
998
1013
|
configure: "gea::host::navigator.wifi.configure",
|
|
1014
|
+
startAccessPoint: "gea::host::navigator.wifi.startAccessPoint",
|
|
1015
|
+
stopAccessPoint: "gea::host::navigator.wifi.stopAccessPoint",
|
|
1016
|
+
accessPointMac: "gea::host::navigator.wifi.accessPointMac",
|
|
1017
|
+
startCaptivePortal: "gea::host::navigator.wifi.startCaptivePortal",
|
|
1018
|
+
stopCaptivePortal: "gea::host::navigator.wifi.stopCaptivePortal",
|
|
999
1019
|
waitForConnection: "gea::host::navigator.wifi.waitForConnection",
|
|
1000
1020
|
startScan: "gea::host::navigator.wifi.startScan",
|
|
1001
1021
|
scanning: "gea::host::navigator.wifi.scanning",
|
|
@@ -1017,6 +1037,11 @@ export function createGeaHostShims() {
|
|
|
1017
1037
|
getIP: "gea::host::navigator.wifi.ip",
|
|
1018
1038
|
mac: "gea::host::navigator.wifi.mac",
|
|
1019
1039
|
configure: "gea::host::navigator.wifi.configure",
|
|
1040
|
+
startAccessPoint: "gea::host::navigator.wifi.startAccessPoint",
|
|
1041
|
+
stopAccessPoint: "gea::host::navigator.wifi.stopAccessPoint",
|
|
1042
|
+
accessPointMac: "gea::host::navigator.wifi.accessPointMac",
|
|
1043
|
+
startCaptivePortal: "gea::host::navigator.wifi.startCaptivePortal",
|
|
1044
|
+
stopCaptivePortal: "gea::host::navigator.wifi.stopCaptivePortal",
|
|
1020
1045
|
waitForConnection: "gea::host::navigator.wifi.waitForConnection",
|
|
1021
1046
|
startScan: "gea::host::navigator.wifi.startScan",
|
|
1022
1047
|
scanning: "gea::host::navigator.wifi.scanning",
|
|
@@ -1051,6 +1076,7 @@ export function createGeaHostShims() {
|
|
|
1051
1076
|
// forms remain on the __gea_Camera table for the runtime shim's own use.
|
|
1052
1077
|
capture: "gea::host::Camera.capturePhoto",
|
|
1053
1078
|
capturePhoto: "gea::host::Camera.capturePhoto",
|
|
1079
|
+
captureFrame: "gea::host::Camera.captureFrame",
|
|
1054
1080
|
captureMirrored: "gea::host::Camera.captureMirrored",
|
|
1055
1081
|
startRecording: "gea::host::Camera.startRecording",
|
|
1056
1082
|
stopRecording: "gea::host::Camera.stopRecordingClip",
|
|
@@ -1075,6 +1101,7 @@ export function createGeaHostShims() {
|
|
|
1075
1101
|
isOpen: "gea::host::Camera.isOpen",
|
|
1076
1102
|
draw: "gea::host::Camera.draw",
|
|
1077
1103
|
capture: "gea::host::Camera.capture",
|
|
1104
|
+
captureFrame: "gea::host::Camera.captureFrame",
|
|
1078
1105
|
captureMirrored: "gea::host::Camera.captureMirrored",
|
|
1079
1106
|
startRecording: "gea::host::Camera.startRecording",
|
|
1080
1107
|
stopRecording: "gea::host::Camera.stopRecording",
|
|
@@ -1092,11 +1119,13 @@ export function createGeaHostShims() {
|
|
|
1092
1119
|
__gea_audioContext: {
|
|
1093
1120
|
createOscillator: "gea::host::sharedAudioContext().createOscillator",
|
|
1094
1121
|
createBufferSource: "gea::host::sharedAudioContext().createBufferSource",
|
|
1122
|
+
createBuffer: "gea::host::sharedAudioContext().createBuffer",
|
|
1095
1123
|
decodeAudioData: "gea::host::sharedAudioContext().decodeAudioData",
|
|
1096
1124
|
},
|
|
1097
1125
|
audioContext: {
|
|
1098
1126
|
createOscillator: "gea::host::sharedAudioContext().createOscillator",
|
|
1099
1127
|
createBufferSource: "gea::host::sharedAudioContext().createBufferSource",
|
|
1128
|
+
createBuffer: "gea::host::sharedAudioContext().createBuffer",
|
|
1100
1129
|
decodeAudioData: "gea::host::sharedAudioContext().decodeAudioData",
|
|
1101
1130
|
},
|
|
1102
1131
|
__gea_Audio: {
|
|
@@ -1291,9 +1320,11 @@ export function createGeaHostShims() {
|
|
|
1291
1320
|
detach: "gea::host::Led.detach",
|
|
1292
1321
|
},
|
|
1293
1322
|
Clock: {
|
|
1323
|
+
setEpochMs: "gea::host::Clock.setEpochMs",
|
|
1294
1324
|
epochMs: "gea::host::Clock.epochMs",
|
|
1295
1325
|
},
|
|
1296
1326
|
__gea_Clock: {
|
|
1327
|
+
setEpochMs: "gea::host::Clock.setEpochMs",
|
|
1297
1328
|
epochMs: "gea::host::Clock.epochMs",
|
|
1298
1329
|
},
|
|
1299
1330
|
Profiler: {
|
|
@@ -1311,10 +1342,18 @@ export function createGeaHostShims() {
|
|
|
1311
1342
|
clear: "gea::host::Storage.clear",
|
|
1312
1343
|
key: "gea::host::Storage.key",
|
|
1313
1344
|
},
|
|
1345
|
+
Haptics: {
|
|
1346
|
+
vibrate: "gea::host::Haptics.vibrate",
|
|
1347
|
+
},
|
|
1314
1348
|
Battery: {
|
|
1349
|
+
charging: "gea::host::Battery.charging",
|
|
1315
1350
|
level: "gea::host::Battery.level",
|
|
1316
1351
|
},
|
|
1352
|
+
__gea_Haptics: {
|
|
1353
|
+
vibrate: "gea::host::Haptics.vibrate",
|
|
1354
|
+
},
|
|
1317
1355
|
__gea_Battery: {
|
|
1356
|
+
charging: "gea::host::Battery.charging",
|
|
1318
1357
|
level: "gea::host::Battery.level",
|
|
1319
1358
|
},
|
|
1320
1359
|
Notify: {
|
|
@@ -1348,8 +1387,8 @@ export function createGeaHostShims() {
|
|
|
1348
1387
|
__gea_Led: ["set", "off", "attach", "setPixel", "show", "detach"],
|
|
1349
1388
|
Clock: ["epochMs"],
|
|
1350
1389
|
__gea_Clock: ["epochMs"],
|
|
1351
|
-
Profiler: ["nowUs"],
|
|
1352
|
-
__gea_Profiler: ["nowUs"],
|
|
1390
|
+
Profiler: ["nowUs", "nowCycles"],
|
|
1391
|
+
__gea_Profiler: ["nowUs", "nowCycles"],
|
|
1353
1392
|
Battery: ["level"],
|
|
1354
1393
|
__gea_Battery: ["level"],
|
|
1355
1394
|
Notify: ["seq"],
|
|
@@ -1640,6 +1679,20 @@ export function createGeaHostShims() {
|
|
|
1640
1679
|
receiverTypes: EVENT_RECEIVER_TYPES,
|
|
1641
1680
|
},
|
|
1642
1681
|
],
|
|
1682
|
+
pressId: [
|
|
1683
|
+
{
|
|
1684
|
+
emit: "static_cast<double>(({receiver}).pressId)",
|
|
1685
|
+
returnType: "double",
|
|
1686
|
+
receiverTypes: EVENT_RECEIVER_TYPES,
|
|
1687
|
+
},
|
|
1688
|
+
],
|
|
1689
|
+
pressValue: [
|
|
1690
|
+
{
|
|
1691
|
+
emit: "static_cast<double>(({receiver}).pressValue)",
|
|
1692
|
+
returnType: "double",
|
|
1693
|
+
receiverTypes: EVENT_RECEIVER_TYPES,
|
|
1694
|
+
},
|
|
1695
|
+
],
|
|
1643
1696
|
// `KeyEvent.keyCode` / `.which` (index.d.ts). One engine field backs both,
|
|
1644
1697
|
// exactly as the DOM's own two spellings alias one value; `keydown` is
|
|
1645
1698
|
// filled by `Tree::dispatchDocumentKey` and by the macOS key bridge.
|
|
@@ -1974,14 +2027,20 @@ export function createGeaHostShims() {
|
|
|
1974
2027
|
{
|
|
1975
2028
|
emit: "({receiver}).kind()",
|
|
1976
2029
|
returnType: "std::string",
|
|
1977
|
-
receiverTypes: [
|
|
2030
|
+
receiverTypes: [
|
|
2031
|
+
"gea::host::MediaStreamTrack",
|
|
2032
|
+
"MediaStreamTrack",
|
|
2033
|
+
],
|
|
1978
2034
|
},
|
|
1979
2035
|
],
|
|
1980
2036
|
readyState: [
|
|
1981
2037
|
{
|
|
1982
2038
|
emit: "({receiver}).readyState()",
|
|
1983
2039
|
returnType: "std::string",
|
|
1984
|
-
receiverTypes: [
|
|
2040
|
+
receiverTypes: [
|
|
2041
|
+
"gea::host::MediaStreamTrack",
|
|
2042
|
+
"MediaStreamTrack",
|
|
2043
|
+
],
|
|
1985
2044
|
},
|
|
1986
2045
|
],
|
|
1987
2046
|
// `pc.connectionState` -- a TS PROPERTY (`readonly connectionState:
|
|
@@ -2009,7 +2068,10 @@ export function createGeaHostShims() {
|
|
|
2009
2068
|
{
|
|
2010
2069
|
emit: "({receiver}).enabled()",
|
|
2011
2070
|
returnType: "bool",
|
|
2012
|
-
receiverTypes: [
|
|
2071
|
+
receiverTypes: [
|
|
2072
|
+
"gea::host::MediaStreamTrack",
|
|
2073
|
+
"MediaStreamTrack",
|
|
2074
|
+
],
|
|
2013
2075
|
},
|
|
2014
2076
|
],
|
|
2015
2077
|
state: [
|
|
@@ -2114,6 +2176,27 @@ export function createGeaHostShims() {
|
|
|
2114
2176
|
receiverTypes: NODE_HANDLE_RECEIVER_TYPES,
|
|
2115
2177
|
},
|
|
2116
2178
|
],
|
|
2179
|
+
length: [
|
|
2180
|
+
{
|
|
2181
|
+
emit: "({receiver}).getLength()",
|
|
2182
|
+
returnType: "double",
|
|
2183
|
+
receiverTypes: ["gea::host::AudioBuffer", "AudioBuffer"],
|
|
2184
|
+
},
|
|
2185
|
+
],
|
|
2186
|
+
duration: [
|
|
2187
|
+
{
|
|
2188
|
+
emit: "({receiver}).getDuration()",
|
|
2189
|
+
returnType: "double",
|
|
2190
|
+
receiverTypes: ["gea::host::AudioBuffer", "AudioBuffer"],
|
|
2191
|
+
},
|
|
2192
|
+
],
|
|
2193
|
+
numberOfChannels: [
|
|
2194
|
+
{
|
|
2195
|
+
emit: "({receiver}).getNumberOfChannels()",
|
|
2196
|
+
returnType: "double",
|
|
2197
|
+
receiverTypes: ["gea::host::AudioBuffer", "AudioBuffer"],
|
|
2198
|
+
},
|
|
2199
|
+
],
|
|
2117
2200
|
buffer: [
|
|
2118
2201
|
{
|
|
2119
2202
|
emit: "static_cast<gea::host::AudioBuffer>(({receiver}).buffer)",
|
|
@@ -2243,7 +2326,10 @@ export function createGeaHostShims() {
|
|
|
2243
2326
|
enabled: [
|
|
2244
2327
|
{
|
|
2245
2328
|
emit: "({receiver}).setEnabled({value})",
|
|
2246
|
-
receiverTypes: [
|
|
2329
|
+
receiverTypes: [
|
|
2330
|
+
"gea::host::MediaStreamTrack",
|
|
2331
|
+
"MediaStreamTrack",
|
|
2332
|
+
],
|
|
2247
2333
|
},
|
|
2248
2334
|
],
|
|
2249
2335
|
buffer: [
|
|
@@ -2430,6 +2516,9 @@ export function createGeaHostShims() {
|
|
|
2430
2516
|
},
|
|
2431
2517
|
],
|
|
2432
2518
|
hostExternDeclarations: geaHostExternDeclarations,
|
|
2519
|
+
nativeFunctionSignatureSources: {
|
|
2520
|
+
requestAnimationFrame: { packageName: "@geastack/host", header: "include/host/timers.h" },
|
|
2521
|
+
},
|
|
2433
2522
|
embeddedHostFunctions: {
|
|
2434
2523
|
// These are declared by core/index.d.ts rather than the standard lib;
|
|
2435
2524
|
// btoa also has the host's existing ArrayBuffer/Uint8Array overloads.
|
|
@@ -2542,14 +2631,34 @@ export function createGeaHostShims() {
|
|
|
2542
2631
|
noThrow: true,
|
|
2543
2632
|
},
|
|
2544
2633
|
},
|
|
2634
|
+
Haptics: {
|
|
2635
|
+
vibrate: {
|
|
2636
|
+
emit: "gea::host::Haptics.vibrate({args})",
|
|
2637
|
+
returnType: "bool",
|
|
2638
|
+
},
|
|
2639
|
+
},
|
|
2545
2640
|
Battery: {
|
|
2641
|
+
charging: {
|
|
2642
|
+
emit: "gea::host::Battery.charging({args})",
|
|
2643
|
+
returnType: "bool",
|
|
2644
|
+
},
|
|
2546
2645
|
level: {
|
|
2547
2646
|
emit: "gea::host::Battery.level({args})",
|
|
2548
2647
|
returnType: "double",
|
|
2549
2648
|
noThrow: true,
|
|
2550
2649
|
},
|
|
2551
2650
|
},
|
|
2651
|
+
__gea_Haptics: {
|
|
2652
|
+
vibrate: {
|
|
2653
|
+
emit: "gea::host::Haptics.vibrate({args})",
|
|
2654
|
+
returnType: "bool",
|
|
2655
|
+
},
|
|
2656
|
+
},
|
|
2552
2657
|
__gea_Battery: {
|
|
2658
|
+
charging: {
|
|
2659
|
+
emit: "gea::host::Battery.charging({args})",
|
|
2660
|
+
returnType: "bool",
|
|
2661
|
+
},
|
|
2553
2662
|
level: {
|
|
2554
2663
|
emit: "gea::host::Battery.level({args})",
|
|
2555
2664
|
returnType: "double",
|
|
@@ -2562,6 +2671,11 @@ export function createGeaHostShims() {
|
|
|
2562
2671
|
returnType: "double",
|
|
2563
2672
|
noThrow: true,
|
|
2564
2673
|
},
|
|
2674
|
+
nowCycles: {
|
|
2675
|
+
emit: "gea::host::Profiler.nowCycles({args})",
|
|
2676
|
+
returnType: "double",
|
|
2677
|
+
noThrow: true,
|
|
2678
|
+
},
|
|
2565
2679
|
},
|
|
2566
2680
|
__gea_Profiler: {
|
|
2567
2681
|
nowUs: {
|
|
@@ -2569,12 +2683,21 @@ export function createGeaHostShims() {
|
|
|
2569
2683
|
returnType: "double",
|
|
2570
2684
|
noThrow: true,
|
|
2571
2685
|
},
|
|
2686
|
+
nowCycles: {
|
|
2687
|
+
emit: "gea::host::Profiler.nowCycles({args})",
|
|
2688
|
+
returnType: "double",
|
|
2689
|
+
noThrow: true,
|
|
2690
|
+
},
|
|
2572
2691
|
},
|
|
2573
2692
|
__gea_audioContext: {
|
|
2574
2693
|
createOscillator: {
|
|
2575
2694
|
emit: "gea::host::sharedAudioContext().createOscillator({args})",
|
|
2576
2695
|
returnType: "gea::host::OscillatorNode",
|
|
2577
2696
|
},
|
|
2697
|
+
createBuffer: {
|
|
2698
|
+
emit: "gea::host::sharedAudioContext().createBuffer({args})",
|
|
2699
|
+
returnType: "gea::host::AudioBuffer",
|
|
2700
|
+
},
|
|
2578
2701
|
createBufferSource: {
|
|
2579
2702
|
emit: "gea::host::sharedAudioContext().createBufferSource({args})",
|
|
2580
2703
|
returnType: "gea::host::AudioBufferSourceNode",
|
|
@@ -2589,6 +2712,10 @@ export function createGeaHostShims() {
|
|
|
2589
2712
|
emit: "gea::host::sharedAudioContext().createOscillator({args})",
|
|
2590
2713
|
returnType: "gea::host::OscillatorNode",
|
|
2591
2714
|
},
|
|
2715
|
+
createBuffer: {
|
|
2716
|
+
emit: "gea::host::sharedAudioContext().createBuffer({args})",
|
|
2717
|
+
returnType: "gea::host::AudioBuffer",
|
|
2718
|
+
},
|
|
2592
2719
|
createBufferSource: {
|
|
2593
2720
|
emit: "gea::host::sharedAudioContext().createBufferSource({args})",
|
|
2594
2721
|
returnType: "gea::host::AudioBufferSourceNode",
|
|
@@ -2643,14 +2770,26 @@ export function createGeaHostShims() {
|
|
|
2643
2770
|
},
|
|
2644
2771
|
},
|
|
2645
2772
|
// `http.createServer(handler)` yields the native HttpServer handle. The
|
|
2646
|
-
// handler
|
|
2647
|
-
//
|
|
2773
|
+
// handler is adapted directly from its typed callable; registering the
|
|
2774
|
+
// return type keeps `const server = ...` a
|
|
2648
2775
|
// concrete `gea::host::HttpServer` instead of a gea_cpp_value record.
|
|
2649
2776
|
http: {
|
|
2650
2777
|
// create_server returns the numeric handle; wrap it in the HttpServer
|
|
2651
2778
|
// handle type (its ctors are explicit) so the binding stores native.
|
|
2652
2779
|
createServer: {
|
|
2653
|
-
emit: "gea::host::HttpServer(gea::host::http::
|
|
2780
|
+
emit: "gea::host::HttpServer(gea::host::http::create_typed_server({args}))",
|
|
2781
|
+
returnType: "gea::host::HttpServer",
|
|
2782
|
+
},
|
|
2783
|
+
close: {
|
|
2784
|
+
emit: "gea::host::http::close_server({args})",
|
|
2785
|
+
returnType: "void",
|
|
2786
|
+
},
|
|
2787
|
+
},
|
|
2788
|
+
__gea_http: {
|
|
2789
|
+
// create_server returns the numeric handle; wrap it in the HttpServer
|
|
2790
|
+
// handle type (its ctors are explicit) so the binding stores native.
|
|
2791
|
+
createServer: {
|
|
2792
|
+
emit: "gea::host::HttpServer(gea::host::http::create_typed_server({args}))",
|
|
2654
2793
|
returnType: "gea::host::HttpServer",
|
|
2655
2794
|
},
|
|
2656
2795
|
close: {
|
|
@@ -2882,6 +3021,11 @@ export function createGeaHostShims() {
|
|
|
2882
3021
|
// `Tree::getAttribute`) -- so wrapping it in `std::string` is total, not
|
|
2883
3022
|
// a guess, and the declared TypeScript return is an ordinary `string`.
|
|
2884
3023
|
getAttribute: [
|
|
3024
|
+
{
|
|
3025
|
+
receiverTypes: EVENT_TARGET_RECEIVER_TYPES,
|
|
3026
|
+
emit: "std::string(({receiver}).getAttribute(std::string({arg0}).c_str()))",
|
|
3027
|
+
returnType: "std::string",
|
|
3028
|
+
},
|
|
2885
3029
|
{
|
|
2886
3030
|
receiverTypes: NODE_HANDLE_RECEIVER_TYPES,
|
|
2887
3031
|
emit: "std::string(({receiver}).getAttribute({arg0}))",
|
|
@@ -3064,7 +3208,10 @@ export function createGeaHostShims() {
|
|
|
3064
3208
|
// This is distinct from the NODE_HANDLE_RECEIVER_TYPES row below,
|
|
3065
3209
|
// which reconstructs the wrapper from a generic DOM node id and is
|
|
3066
3210
|
// untouched.
|
|
3067
|
-
receiverTypes: [
|
|
3211
|
+
receiverTypes: [
|
|
3212
|
+
"gea::host::HTMLAudioElement",
|
|
3213
|
+
"HTMLAudioElement",
|
|
3214
|
+
],
|
|
3068
3215
|
emit: "gea::runtime::hostaudio::play({receiver})",
|
|
3069
3216
|
returnType: "gea::Promise<void>",
|
|
3070
3217
|
},
|
|
@@ -3083,7 +3230,10 @@ export function createGeaHostShims() {
|
|
|
3083
3230
|
{
|
|
3084
3231
|
// See `play` above: a statically HTMLAudioElement-typed receiver
|
|
3085
3232
|
// calls directly, no reconstruction from a node id.
|
|
3086
|
-
receiverTypes: [
|
|
3233
|
+
receiverTypes: [
|
|
3234
|
+
"gea::host::HTMLAudioElement",
|
|
3235
|
+
"HTMLAudioElement",
|
|
3236
|
+
],
|
|
3087
3237
|
emit: "({receiver}).pause()",
|
|
3088
3238
|
returnType: "void",
|
|
3089
3239
|
},
|
|
@@ -3140,6 +3290,34 @@ export function createGeaHostShims() {
|
|
|
3140
3290
|
returnType: "gea::host::OscillatorNode",
|
|
3141
3291
|
},
|
|
3142
3292
|
],
|
|
3293
|
+
getChannelData: [
|
|
3294
|
+
{
|
|
3295
|
+
receiverTypes: ["gea::host::AudioBuffer", "AudioBuffer"],
|
|
3296
|
+
emit: "({receiver}).getChannelData({args})",
|
|
3297
|
+
returnType: "gea::Ref<gea::TypedArray<float>>",
|
|
3298
|
+
},
|
|
3299
|
+
],
|
|
3300
|
+
copyToChannel: [
|
|
3301
|
+
{
|
|
3302
|
+
receiverTypes: ["gea::host::AudioBuffer", "AudioBuffer"],
|
|
3303
|
+
emit: "({receiver}).copyToChannel({args})",
|
|
3304
|
+
returnType: "void",
|
|
3305
|
+
},
|
|
3306
|
+
],
|
|
3307
|
+
copyFromChannel: [
|
|
3308
|
+
{
|
|
3309
|
+
receiverTypes: ["gea::host::AudioBuffer", "AudioBuffer"],
|
|
3310
|
+
emit: "({receiver}).copyFromChannel({args})",
|
|
3311
|
+
returnType: "void",
|
|
3312
|
+
},
|
|
3313
|
+
],
|
|
3314
|
+
createBuffer: [
|
|
3315
|
+
{
|
|
3316
|
+
receiverTypes: ["gea::host::AudioContext", "AudioContext"],
|
|
3317
|
+
emit: "({receiver}).createBuffer({args})",
|
|
3318
|
+
returnType: "gea::host::AudioBuffer",
|
|
3319
|
+
},
|
|
3320
|
+
],
|
|
3143
3321
|
createBufferSource: [
|
|
3144
3322
|
{
|
|
3145
3323
|
receiverTypes: ["gea::host::AudioContext", "AudioContext"],
|
|
@@ -3201,7 +3379,10 @@ export function createGeaHostShims() {
|
|
|
3201
3379
|
// receivers: the rows are keyed by receiver carrier, which is what lets
|
|
3202
3380
|
// the audio nodes below share the spelling without sharing a type.
|
|
3203
3381
|
{
|
|
3204
|
-
receiverTypes: [
|
|
3382
|
+
receiverTypes: [
|
|
3383
|
+
"gea::host::MediaStreamTrack",
|
|
3384
|
+
"MediaStreamTrack",
|
|
3385
|
+
],
|
|
3205
3386
|
emit: "({receiver}).stop()",
|
|
3206
3387
|
returnType: "void",
|
|
3207
3388
|
},
|
package/dist/types.d.ts
CHANGED
|
@@ -98,6 +98,11 @@ export interface HostShimDefinitions {
|
|
|
98
98
|
type: string;
|
|
99
99
|
}>;
|
|
100
100
|
embeddedHostFunctions?: Record<string, string>;
|
|
101
|
+
/** Headers inspected for native signatures; no duplicated scalar/callback type metadata. */
|
|
102
|
+
nativeFunctionSignatureSources?: Record<string, {
|
|
103
|
+
packageName: string;
|
|
104
|
+
header: string;
|
|
105
|
+
}>;
|
|
101
106
|
embeddedHostNoThrowFunctions?: string[];
|
|
102
107
|
hostNamespaceNoThrowMethods?: Record<string, string[]>;
|
|
103
108
|
embeddedHostFunctionReturnTypes?: Record<string, string>;
|