@geastack/geatsc-plugin-gea 0.1.25 → 0.1.27
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-nodes.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const nodeAnalysisVersion = "node-analysis-v1";
|
|
2
2
|
export declare const nodeFeatures: readonly ["node-images", "node-inputs"];
|
|
3
3
|
export declare const videoNodeAnalysisVersion = "node-video-analysis-v1";
|
|
4
|
+
export declare const svgNodeAnalysisVersion = "node-svg-analysis-v1";
|
|
4
5
|
export declare function addUnknownNodeFeatures(features: Set<string>): void;
|
|
5
6
|
export declare function addNodeFeatures(file: string, text: string, features: Set<string>): void;
|
package/dist/analyze-nodes.js
CHANGED
|
@@ -4,10 +4,22 @@ export const nodeFeatures = ['node-images', 'node-inputs'];
|
|
|
4
4
|
// Separate marker: an analyzer without it never reports node-videos, and its
|
|
5
5
|
// absence must not let a newer CLI drop the video host from the firmware.
|
|
6
6
|
export const videoNodeAnalysisVersion = 'node-video-analysis-v1';
|
|
7
|
+
// Same contract for inline SVG: only an analyzer carrying this marker may
|
|
8
|
+
// prove that no <svg> exists and let the CLI compile the SVG element out.
|
|
9
|
+
export const svgNodeAnalysisVersion = 'node-svg-analysis-v1';
|
|
10
|
+
const nodeFreeCoreExports = new RegExp('^(?:' + [
|
|
11
|
+
'Component', 'ReactiveComponent', 'Store', 'mount', 'Display', 'rgb', 'rgba',
|
|
12
|
+
'touch', 'Input', 'Accelerometer', 'Magnetometer', 'Geolocation', 'geolocation', 'Clock', 'Battery', 'Memory', 'Profiler',
|
|
13
|
+
'WiFi', 'wifi', 'BLE', 'bluetooth', 'BLEServer', 'registerBleServer', 'initBleServers', 'EspNow', 'Uart', 'Gpio', 'Digital', 'Buttons', 'Led', 'Haptics', 'Notify', 'DeviceControl',
|
|
14
|
+
'Audio', 'audioContext', 'flushAudioWorkletOutput',
|
|
15
|
+
'writeCacheFile', 'readCacheFile', 'removeCacheFile', 'listCacheFiles', 'readFileRange', 'readMapArchive',
|
|
16
|
+
'http', 'fetchBytes', 'fetchText', 'fetchAsync', 'fetchReady', 'fetchResult', 'fetchRelease',
|
|
17
|
+
].join('|') + ')$');
|
|
7
18
|
export function addUnknownNodeFeatures(features) {
|
|
8
19
|
for (const feature of nodeFeatures)
|
|
9
20
|
features.add(feature);
|
|
10
21
|
features.add('node-videos');
|
|
22
|
+
features.add('node-svg');
|
|
11
23
|
}
|
|
12
24
|
// Native node payloads are selected from the whole discovered source graph.
|
|
13
25
|
// CSS rendering features remain independent: a background image does not make
|
|
@@ -24,6 +36,10 @@ export function addNodeFeatures(file, text, features) {
|
|
|
24
36
|
features.add('node-inputs');
|
|
25
37
|
if (/^video$/i.test(value) || /^(?:VideoElement|HTMLVideoElement|createVideo)$/.test(value))
|
|
26
38
|
features.add('node-videos');
|
|
39
|
+
// Shapes draw only inside an <svg> root, so the root tag is the proof.
|
|
40
|
+
// (`path`, `rect`, `line` are everyday identifiers and would prove nothing.)
|
|
41
|
+
if (/^svg$/i.test(value) || /^SVG[A-Z]\w*Element$/.test(value))
|
|
42
|
+
features.add('node-svg');
|
|
27
43
|
};
|
|
28
44
|
const visit = (node) => {
|
|
29
45
|
if (ts.isIdentifier(node)) {
|
|
@@ -45,14 +61,16 @@ export function addNodeFeatures(file, text, features) {
|
|
|
45
61
|
}
|
|
46
62
|
if (ts.isJsxOpeningElement(node) || ts.isJsxSelfClosingElement(node))
|
|
47
63
|
name(node.tagName.getText(source).split(':').at(-1));
|
|
48
|
-
// Display controls the panel/canvas
|
|
49
|
-
//
|
|
64
|
+
// Display controls the panel/canvas, and the device services (sensors,
|
|
65
|
+
// radios, storage, audio, clock) have no DOM surface: importing them cannot
|
|
66
|
+
// create image, input or video nodes. Calls that actually create nodes are
|
|
67
|
+
// still scanned.
|
|
50
68
|
if (ts.isImportDeclaration(node) && ts.isStringLiteral(node.moduleSpecifier) &&
|
|
51
69
|
/^(?:gea-embedded|@geastack\/(?:core|engine)|@geajs\/core)(?:\/|$)/.test(node.moduleSpecifier.text) &&
|
|
52
70
|
node.importClause && !node.importClause.isTypeOnly) {
|
|
53
71
|
const bindings = node.importClause.namedBindings;
|
|
54
72
|
if (node.importClause.name || !bindings || !ts.isNamedImports(bindings) ||
|
|
55
|
-
bindings.elements.some(item => !item.isTypeOnly &&
|
|
73
|
+
bindings.elements.some(item => !item.isTypeOnly && !nodeFreeCoreExports.test((item.propertyName ?? item.name).text)))
|
|
56
74
|
unknown();
|
|
57
75
|
}
|
|
58
76
|
// Mutation/markup helpers can create descendants whose tags are not present
|
package/dist/analyze.js
CHANGED
|
@@ -7,7 +7,7 @@ import { analyzeClassCapacity } from './analyze-classes.js';
|
|
|
7
7
|
import ts from 'typescript';
|
|
8
8
|
import path from 'node:path';
|
|
9
9
|
import { createRequire } from 'node:module';
|
|
10
|
-
import { nodeAnalysisVersion, videoNodeAnalysisVersion, addNodeFeatures, addUnknownNodeFeatures } from './analyze-nodes.js';
|
|
10
|
+
import { nodeAnalysisVersion, videoNodeAnalysisVersion, svgNodeAnalysisVersion, addNodeFeatures, addUnknownNodeFeatures } from './analyze-nodes.js';
|
|
11
11
|
import { cssRangeObserver } from './analyze-css-ranges.js';
|
|
12
12
|
import { cssAnalysisVersion, cssUsageObserver, addUnknownCssFeatures } from './analyze-css.js';
|
|
13
13
|
import { addRendererFeatures, addUnknownRendererFeatures, rendererAnalysisVersion, rendererOcclusionAnalysisVersion, rendererVariableAnalysis } from './analyze-renderer.js';
|
|
@@ -32,7 +32,7 @@ export function capabilitiesToAnalyzePatch(capabilities) {
|
|
|
32
32
|
// connection with "No server verification option set".
|
|
33
33
|
export function analyzeSourceHostBindings(entry) {
|
|
34
34
|
const bindings = new Set();
|
|
35
|
-
const features = new Set([rendererAnalysisVersion, rendererOcclusionAnalysisVersion, cssAnalysisVersion, nodeAnalysisVersion, videoNodeAnalysisVersion, nodeAuxVersion]);
|
|
35
|
+
const features = new Set([rendererAnalysisVersion, rendererOcclusionAnalysisVersion, cssAnalysisVersion, nodeAnalysisVersion, videoNodeAnalysisVersion, svgNodeAnalysisVersion, nodeAuxVersion]);
|
|
36
36
|
const discovery = discoverSourceFiles(entry);
|
|
37
37
|
const classSources = new Map();
|
|
38
38
|
let classUnknown = discovery.unknown;
|
|
@@ -948,6 +948,17 @@ function lowerHostFacadeCall(context, path, args) {
|
|
|
948
948
|
// BatteryController — charge percentage from the platform PMU.
|
|
949
949
|
'Battery.level': { target: 'gea::host::Battery.level' },
|
|
950
950
|
'__gea_Battery.level': { target: 'gea::host::Battery.level' },
|
|
951
|
+
// ButtonsController — the board's named physical buttons.
|
|
952
|
+
'Buttons.count': { target: 'gea::host::Buttons.count' },
|
|
953
|
+
'__gea_Buttons.count': { target: 'gea::host::Buttons.count' },
|
|
954
|
+
'Buttons.code': { target: 'gea::host::Buttons.code', hints: ['number'] },
|
|
955
|
+
'__gea_Buttons.code': { target: 'gea::host::Buttons.code', hints: ['number'] },
|
|
956
|
+
'Buttons.key': { target: 'gea::host::Buttons.key', hints: ['number'] },
|
|
957
|
+
'__gea_Buttons.key': { target: 'gea::host::Buttons.key', hints: ['number'] },
|
|
958
|
+
'Buttons.pin': { target: 'gea::host::Buttons.pin', hints: ['number'] },
|
|
959
|
+
'__gea_Buttons.pin': { target: 'gea::host::Buttons.pin', hints: ['number'] },
|
|
960
|
+
'Buttons.pressed': { target: 'gea::host::Buttons.pressed', hints: ['string'] },
|
|
961
|
+
'__gea_Buttons.pressed': { target: 'gea::host::Buttons.pressed', hints: ['string'] },
|
|
951
962
|
// NotifyController — transient host->app notification channel.
|
|
952
963
|
'Notify.text': { target: 'gea::host::Notify.text' },
|
|
953
964
|
'__gea_Notify.text': { target: 'gea::host::Notify.text' },
|
|
@@ -61,7 +61,8 @@ const geaGeolocationHostMethods = [
|
|
|
61
61
|
'clearWatch',
|
|
62
62
|
];
|
|
63
63
|
const geaInputHostMethods = ['consumeBackButton'];
|
|
64
|
-
const geaGpioHostMethods = ['configureOutput', 'configureInput', 'write', 'read'];
|
|
64
|
+
const geaGpioHostMethods = ['configureOutput', 'configureInput', 'write', 'read', 'open', 'get', 'set', 'close'];
|
|
65
|
+
const geaButtonsHostMethods = ['count', 'code', 'key', 'pin', 'pressed'];
|
|
65
66
|
const geaMagnetometerHostMethods = ['open', 'close', 'count', 'read'];
|
|
66
67
|
const geaEspNowHostMethods = ['open', 'isOpen', 'canSend', 'setMaxTxPower', 'getMaxTxPower', 'close', 'addPeer', 'send', 'receive'];
|
|
67
68
|
const geaUartHostMethods = ['open', 'isOpen', 'close', 'read', 'write', 'available', 'writable'];
|
|
@@ -147,6 +148,7 @@ const rawGeaHostExternDeclarations = Object.fromEntries([
|
|
|
147
148
|
...geaMemoryHostMethods.map((method) => [`gea::host::Memory.${method}`, geaHostDeclarations]),
|
|
148
149
|
...geaInputHostMethods.map((method) => [`gea::host::Input.${method}`, geaHostDeclarations]),
|
|
149
150
|
...geaGpioHostMethods.map((method) => [`gea::host::Gpio.${method}`, geaHostDeclarations]),
|
|
151
|
+
...geaButtonsHostMethods.map((method) => [`gea::host::Buttons.${method}`, geaHostDeclarations]),
|
|
150
152
|
...geaMagnetometerHostMethods.map((method) => [`gea::host::Magnetometer.${method}`, geaHostDeclarations]),
|
|
151
153
|
...geaEspNowHostMethods.map((method) => [`gea::host::EspNow.${method}`, geaHostDeclarations]),
|
|
152
154
|
...geaUartHostMethods.map((method) => [`gea::host::Uart.${method}`, geaHostDeclarations]),
|
package/dist/host-shims.js
CHANGED
|
@@ -553,7 +553,8 @@ export function createGeaHostShims() {
|
|
|
553
553
|
Memory: "gea::host::Memory",
|
|
554
554
|
memory: "gea::host::Memory",
|
|
555
555
|
Input: "gea::host::Input",
|
|
556
|
-
Gpio
|
|
556
|
+
// `Gpio` itself is a TS class (core runtime/gpio.ts) over `__gea_Gpio`.
|
|
557
|
+
Buttons: "gea::host::Buttons",
|
|
557
558
|
Led: "gea::host::Led",
|
|
558
559
|
Clock: "gea::host::Clock",
|
|
559
560
|
Haptics: "gea::host::Haptics",
|
|
@@ -570,6 +571,7 @@ export function createGeaHostShims() {
|
|
|
570
571
|
__gea_Memory: "gea::host::Memory",
|
|
571
572
|
__gea_Input: "gea::host::Input",
|
|
572
573
|
__gea_Gpio: "gea::host::Gpio",
|
|
574
|
+
__gea_Buttons: "gea::host::Buttons",
|
|
573
575
|
__gea_EspNow: "gea::host::EspNow",
|
|
574
576
|
__gea_Magnetometer: "gea::host::Magnetometer",
|
|
575
577
|
__gea_Uart: "gea::host::Uart",
|
|
@@ -1307,17 +1309,30 @@ export function createGeaHostShims() {
|
|
|
1307
1309
|
__gea_Input: {
|
|
1308
1310
|
consumeBackButton: "gea::host::Input.consumeBackButton",
|
|
1309
1311
|
},
|
|
1310
|
-
Gpio
|
|
1311
|
-
configureOutput: "gea::host::Gpio.configureOutput",
|
|
1312
|
-
configureInput: "gea::host::Gpio.configureInput",
|
|
1313
|
-
write: "gea::host::Gpio.write",
|
|
1314
|
-
read: "gea::host::Gpio.read",
|
|
1315
|
-
},
|
|
1312
|
+
// The one backend under the `Gpio` and ECMA-419 `Digital` classes.
|
|
1316
1313
|
__gea_Gpio: {
|
|
1317
1314
|
configureOutput: "gea::host::Gpio.configureOutput",
|
|
1318
1315
|
configureInput: "gea::host::Gpio.configureInput",
|
|
1319
1316
|
write: "gea::host::Gpio.write",
|
|
1320
1317
|
read: "gea::host::Gpio.read",
|
|
1318
|
+
open: "gea::host::Gpio.open",
|
|
1319
|
+
get: "gea::host::Gpio.get",
|
|
1320
|
+
set: "gea::host::Gpio.set",
|
|
1321
|
+
close: "gea::host::Gpio.close",
|
|
1322
|
+
},
|
|
1323
|
+
Buttons: {
|
|
1324
|
+
count: "gea::host::Buttons.count",
|
|
1325
|
+
code: "gea::host::Buttons.code",
|
|
1326
|
+
key: "gea::host::Buttons.key",
|
|
1327
|
+
pin: "gea::host::Buttons.pin",
|
|
1328
|
+
pressed: "gea::host::Buttons.pressed",
|
|
1329
|
+
},
|
|
1330
|
+
__gea_Buttons: {
|
|
1331
|
+
count: "gea::host::Buttons.count",
|
|
1332
|
+
code: "gea::host::Buttons.code",
|
|
1333
|
+
key: "gea::host::Buttons.key",
|
|
1334
|
+
pin: "gea::host::Buttons.pin",
|
|
1335
|
+
pressed: "gea::host::Buttons.pressed",
|
|
1321
1336
|
},
|
|
1322
1337
|
__gea_Magnetometer: {
|
|
1323
1338
|
open: "gea::host::Magnetometer.open",
|
|
@@ -1423,8 +1438,10 @@ export function createGeaHostShims() {
|
|
|
1423
1438
|
__gea_Memory: MEMORY_NO_THROW_METHODS,
|
|
1424
1439
|
Input: ["consumeBackButton"],
|
|
1425
1440
|
__gea_Input: ["consumeBackButton"],
|
|
1426
|
-
|
|
1427
|
-
__gea_Gpio: ["configureOutput", "configureInput", "write", "read"],
|
|
1441
|
+
// open() stores its callback; it runs later, from Application::frame.
|
|
1442
|
+
__gea_Gpio: ["configureOutput", "configureInput", "write", "read", "open", "get", "set", "close"],
|
|
1443
|
+
Buttons: ["count", "code", "key", "pin", "pressed"],
|
|
1444
|
+
__gea_Buttons: ["count", "code", "key", "pin", "pressed"],
|
|
1428
1445
|
__gea_EspNow: ["open", "isOpen", "canSend", "setMaxTxPower", "getMaxTxPower", "close"],
|
|
1429
1446
|
__gea_Magnetometer: ["open", "close", "count"],
|
|
1430
1447
|
__gea_Uart: ["open", "isOpen", "close", "available", "writable"],
|