@geastack/geatsc-plugin-gea 0.1.6
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/LICENSE +202 -0
- package/README.md +37 -0
- package/dist/analyze.d.ts +4 -0
- package/dist/analyze.js +195 -0
- package/dist/cpp-canvas-colors.d.ts +4 -0
- package/dist/cpp-canvas-colors.js +226 -0
- package/dist/cpp-field-access.d.ts +49 -0
- package/dist/cpp-field-access.js +144 -0
- package/dist/cpp-ir-dom-style.d.ts +1 -0
- package/dist/cpp-ir-dom-style.js +49 -0
- package/dist/cpp-ir.d.ts +30 -0
- package/dist/cpp-ir.js +2426 -0
- package/dist/cpp-keyed-component-diagnostics.d.ts +8 -0
- package/dist/cpp-keyed-component-diagnostics.js +74 -0
- package/dist/cpp-keyed-list-diagnostics.d.ts +17 -0
- package/dist/cpp-keyed-list-diagnostics.js +84 -0
- package/dist/cpp-mounted-lowering.d.ts +81 -0
- package/dist/cpp-mounted-lowering.js +2235 -0
- package/dist/cpp-mounted.d.ts +25 -0
- package/dist/cpp-mounted.js +1376 -0
- package/dist/cpp-reactive-component-diagnostics.d.ts +2 -0
- package/dist/cpp-reactive-component-diagnostics.js +76 -0
- package/dist/cpp-reactive-component.d.ts +14 -0
- package/dist/cpp-reactive-component.js +349 -0
- package/dist/cpp-replacements.d.ts +14 -0
- package/dist/cpp-replacements.js +787 -0
- package/dist/cpp-source-replacements.d.ts +11 -0
- package/dist/cpp-source-replacements.js +257 -0
- package/dist/cpp-store-hub.d.ts +7 -0
- package/dist/cpp-store-hub.js +160 -0
- package/dist/cpp-store-method-body-parser.d.ts +2 -0
- package/dist/cpp-store-method-body-parser.js +392 -0
- package/dist/cpp-store-method-context.d.ts +48 -0
- package/dist/cpp-store-method-context.js +114 -0
- package/dist/cpp-store-method-expressions.d.ts +12 -0
- package/dist/cpp-store-method-expressions.js +1263 -0
- package/dist/cpp-store-method-replacements.d.ts +5 -0
- package/dist/cpp-store-method-replacements.js +1521 -0
- package/dist/cpp-store-method-targets.d.ts +19 -0
- package/dist/cpp-store-method-targets.js +296 -0
- package/dist/cpp-store-typed-arrays.d.ts +2 -0
- package/dist/cpp-store-typed-arrays.js +655 -0
- package/dist/cpp-stores.d.ts +73 -0
- package/dist/cpp-stores.js +1739 -0
- package/dist/cpp-template-renderer.d.ts +23 -0
- package/dist/cpp-template-renderer.js +3530 -0
- package/dist/css-style-declaration-shims.d.ts +3 -0
- package/dist/css-style-declaration-shims.js +47 -0
- package/dist/host-declarations.d.ts +11 -0
- package/dist/host-declarations.js +320 -0
- package/dist/host-shims.d.ts +3 -0
- package/dist/host-shims.js +3217 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1239 -0
- package/dist/load-ir.d.ts +7 -0
- package/dist/load-ir.js +40 -0
- package/dist/types.d.ts +604 -0
- package/dist/types.js +1 -0
- package/dist/utils.d.ts +26 -0
- package/dist/utils.js +723 -0
- package/dist/validate.d.ts +3 -0
- package/dist/validate.js +226 -0
- package/package.json +57 -0
package/dist/load-ir.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { isRecord } from './utils.js';
|
|
4
|
+
export function loadIr(options, entry) {
|
|
5
|
+
const rawPath = options['gea.ir'] ?? options.ir;
|
|
6
|
+
if (!rawPath)
|
|
7
|
+
return { ir: null, path: null, error: null };
|
|
8
|
+
const resolved = path.resolve(path.dirname(entry), rawPath);
|
|
9
|
+
try {
|
|
10
|
+
const parsed = JSON.parse(fs.readFileSync(resolved, 'utf8'));
|
|
11
|
+
const validationError = validateIrSkeleton(parsed, resolved);
|
|
12
|
+
if (validationError)
|
|
13
|
+
return { ir: null, path: resolved, error: validationError };
|
|
14
|
+
return { ir: parsed, path: resolved, error: null };
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
return {
|
|
18
|
+
ir: null,
|
|
19
|
+
path: resolved,
|
|
20
|
+
error: `failed to read gea IR at ${resolved}: ${error instanceof Error ? error.message : String(error)}`,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function validateIrSkeleton(value, file) {
|
|
25
|
+
if (!isRecord(value))
|
|
26
|
+
return `invalid gea IR at ${file}: expected object`;
|
|
27
|
+
if (value.schema !== 'gea-ir')
|
|
28
|
+
return `invalid gea IR at ${file}: expected schema "gea-ir"`;
|
|
29
|
+
if (value.version !== 1)
|
|
30
|
+
return `unsupported gea IR version at ${file}: expected version 1`;
|
|
31
|
+
if (!Array.isArray(value.modules))
|
|
32
|
+
return `invalid gea IR at ${file}: modules must be an array`;
|
|
33
|
+
if (!Array.isArray(value.components))
|
|
34
|
+
return `invalid gea IR at ${file}: components must be an array`;
|
|
35
|
+
if (!Array.isArray(value.stores))
|
|
36
|
+
return `invalid gea IR at ${file}: stores must be an array`;
|
|
37
|
+
if (!Array.isArray(value.hostCapabilities))
|
|
38
|
+
return `invalid gea IR at ${file}: hostCapabilities must be an array`;
|
|
39
|
+
return null;
|
|
40
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,604 @@
|
|
|
1
|
+
export interface PluginOptionMap {
|
|
2
|
+
[key: string]: string;
|
|
3
|
+
}
|
|
4
|
+
export interface EmitModule {
|
|
5
|
+
sourceFile: {
|
|
6
|
+
fileName: string;
|
|
7
|
+
};
|
|
8
|
+
relativePath: string;
|
|
9
|
+
}
|
|
10
|
+
export interface PluginCppContext {
|
|
11
|
+
options: PluginOptionMap;
|
|
12
|
+
modules: EmitModule[];
|
|
13
|
+
}
|
|
14
|
+
export interface HostShimDefinitions {
|
|
15
|
+
nativeTypes?: Record<string, string>;
|
|
16
|
+
/**
|
|
17
|
+
* `new <AmbientConstructor>(...)` construct spellings, for a declared
|
|
18
|
+
* ambient constructor interface whose instance type already has a
|
|
19
|
+
* `nativeTypes` carrier (`Audio: AudioConstructor` -> `HTMLAudioElement` ->
|
|
20
|
+
* `gea::host::HTMLAudioElement`). Keyed by the CONSTRUCTOR interface's own
|
|
21
|
+
* declared name (`AudioConstructor`, not `Audio` or `HTMLAudioElement`) --
|
|
22
|
+
* the same name a `declare var Audio: AudioConstructor` binds as its own
|
|
23
|
+
* host protocol, one level up from the instance type `nativeTypes` already
|
|
24
|
+
* carries. The template uses the `{arg0}`, `{arg1}`, ... convention shared
|
|
25
|
+
* with `nativeMemberMethods` (never `embeddedHostClasses`' `{args}`, which
|
|
26
|
+
* is a different, v1-only mechanism): a compiler that reads this table
|
|
27
|
+
* derives each row's arity by counting the highest `{argN}` slot the
|
|
28
|
+
* template names, so a zero-argument constructor (`MediaStream`) states a
|
|
29
|
+
* template with no `{arg}` slot at all rather than a separate arity field.
|
|
30
|
+
*/
|
|
31
|
+
nativeConstructors?: Record<string, string>;
|
|
32
|
+
hostGlobalObjects?: Record<string, string>;
|
|
33
|
+
/**
|
|
34
|
+
* The C++ TYPE of each `hostGlobalObjects` value, keyed by the same global
|
|
35
|
+
* name -- `window` -> `gea::host::WindowFacade` for the
|
|
36
|
+
* `inline constexpr WindowFacade window{}` that `hostGlobalObjects.window`
|
|
37
|
+
* names.
|
|
38
|
+
*
|
|
39
|
+
* `hostGlobalObjects` states the expression a path RESOLVES to; this states
|
|
40
|
+
* what that expression IS. A compiler that only has the former can emit
|
|
41
|
+
* `gea::host::window.innerWidth()` but cannot say what carries `window`
|
|
42
|
+
* itself, so it falls back to expanding the ambient `Window & typeof
|
|
43
|
+
* globalThis` declaration into a struct of its own -- a 26-field flattening
|
|
44
|
+
* of lib.dom naming protocol tags no host declares, which is dead weight at
|
|
45
|
+
* best and uncompilable at worst.
|
|
46
|
+
*
|
|
47
|
+
* Every row is the type of the object the sibling row names, read off the
|
|
48
|
+
* host's own header, never a spelling invented by a compiler:
|
|
49
|
+
* `packages/host/include/host/window.h`, `.../navigator.h`, `.../storage.h`.
|
|
50
|
+
*/
|
|
51
|
+
hostGlobalObjectTypes?: Record<string, string>;
|
|
52
|
+
hostNamespaces?: Record<string, string>;
|
|
53
|
+
hostNamespaceIdentities?: Record<string, DeclaredFrameworkFunctionCoordinate>;
|
|
54
|
+
hostNamespaceMethods?: Record<string, Record<string, string>>;
|
|
55
|
+
nativeNamespaceMethods?: Record<string, Record<string, NativeNamespaceMethodBinding>>;
|
|
56
|
+
hostNamespaceProperties?: Record<string, Record<string, string>>;
|
|
57
|
+
hostNamespacePropertyAccessors?: Record<string, string[]>;
|
|
58
|
+
hostNamespacePropertySetters?: Record<string, Record<string, string>>;
|
|
59
|
+
documentMethods?: Record<string, string>;
|
|
60
|
+
nativeDocumentMethods?: Record<string, NativeNamespaceMethodBinding>;
|
|
61
|
+
/**
|
|
62
|
+
* Intrinsic JSX tags whose SINGLE-TEXT-RUN form is a text node rather than a
|
|
63
|
+
* view container.
|
|
64
|
+
*
|
|
65
|
+
* `<span>front</span>` on this host is one node -- `Document::createText()`
|
|
66
|
+
* carrying the span's own class and style -- not a view with a text child.
|
|
67
|
+
* The rule is v1's, and this list is the half of it that is a gea fact:
|
|
68
|
+
* `isTextNodeTag` in `cpp-template-renderer.ts`, read by
|
|
69
|
+
* `canUseTextNodeForElement` in the same file. The other half -- no element
|
|
70
|
+
* children, exactly one text run -- is a DOM fact about the element's
|
|
71
|
+
* contents and is stated by the compiler, not here.
|
|
72
|
+
*
|
|
73
|
+
* A tag absent from this list stays a container, which is the fail-closed
|
|
74
|
+
* answer: a wrongly flattened element is a silently wrong tree, while a
|
|
75
|
+
* container is merely one level deeper than v1's.
|
|
76
|
+
*/
|
|
77
|
+
elementTextLeafTags?: string[];
|
|
78
|
+
domElementMethods?: Record<string, string>;
|
|
79
|
+
domTokenListMethods?: Record<string, string>;
|
|
80
|
+
domElementPropertyGetters?: Record<string, string>;
|
|
81
|
+
domElementPropertySetters?: Record<string, string>;
|
|
82
|
+
nativeMemberMethods?: Record<string, NativeMemberBinding[]>;
|
|
83
|
+
nativeMemberPropertyGetters?: Record<string, NativeMemberBinding[]>;
|
|
84
|
+
nativeMemberPropertySetters?: Record<string, NativeMemberBinding[]>;
|
|
85
|
+
canvasContextMethods?: Record<string, string>;
|
|
86
|
+
canvasContextNoThrowMethods?: string[];
|
|
87
|
+
canvasContextPropertySetters?: Record<string, string>;
|
|
88
|
+
embeddedHostConstants?: Record<string, {
|
|
89
|
+
emit: string;
|
|
90
|
+
type: string;
|
|
91
|
+
}>;
|
|
92
|
+
embeddedHostFunctions?: Record<string, string>;
|
|
93
|
+
embeddedHostNoThrowFunctions?: string[];
|
|
94
|
+
hostNamespaceNoThrowMethods?: Record<string, string[]>;
|
|
95
|
+
embeddedHostFunctionReturnTypes?: Record<string, string>;
|
|
96
|
+
embeddedHostClasses?: Record<string, EmbeddedHostClassBinding>;
|
|
97
|
+
hostExternDeclarations?: Record<string, string[]>;
|
|
98
|
+
/** Versioned framework-specific semantic protocols. Generic builtins never belong here. */
|
|
99
|
+
frameworkProtocols?: readonly FrameworkProtocol[];
|
|
100
|
+
/**
|
|
101
|
+
* Plugin-declared, UNVERIFIED closed-world interface-dispatch facts:
|
|
102
|
+
* `interfaceName` (a local structural interface with no `implements` link
|
|
103
|
+
* to any class) has EXACTLY the listed classes as its only runtime
|
|
104
|
+
* implementers in gea. The compiler does not re-derive or verify this.
|
|
105
|
+
*/
|
|
106
|
+
declaredClosedWorldInterfaceDispatch?: DeclaredClosedWorldInterfaceDispatch[];
|
|
107
|
+
nullishPropertyFallbackProtocols?: NullishPropertyFallbackProtocol[];
|
|
108
|
+
classFactoryHooks?: ClassFactoryHook[];
|
|
109
|
+
lowerSymbolsAsNamedMembers?: boolean;
|
|
110
|
+
}
|
|
111
|
+
export interface EmbeddedHostClassBinding {
|
|
112
|
+
factory?: string;
|
|
113
|
+
wrapper: string;
|
|
114
|
+
allowConcrete?: boolean;
|
|
115
|
+
construct?: string;
|
|
116
|
+
}
|
|
117
|
+
export interface NativeMemberBinding {
|
|
118
|
+
extern?: string;
|
|
119
|
+
receiverTypes?: string[];
|
|
120
|
+
emit?: string;
|
|
121
|
+
returnType?: string;
|
|
122
|
+
noThrow?: boolean;
|
|
123
|
+
argumentRoles?: readonly HostRuntimeCallableArgumentRole[];
|
|
124
|
+
dynamicRecordSchemas?: readonly HostRuntimeDynamicRecordSchema[];
|
|
125
|
+
}
|
|
126
|
+
export interface NativeNamespaceMethodBinding {
|
|
127
|
+
emit: string;
|
|
128
|
+
returnType?: string;
|
|
129
|
+
noThrow?: boolean;
|
|
130
|
+
argumentRoles?: readonly HostRuntimeCallableArgumentRole[];
|
|
131
|
+
dynamicRecordSchemas?: readonly HostRuntimeDynamicRecordSchema[];
|
|
132
|
+
}
|
|
133
|
+
export type HostRuntimeValueRole = "checker-carrier" | "dynamic-value";
|
|
134
|
+
export interface HostRuntimeDynamicRecordFieldRole {
|
|
135
|
+
readonly key: string;
|
|
136
|
+
readonly value: "checker-carrier";
|
|
137
|
+
}
|
|
138
|
+
export interface HostRuntimeDynamicRecordParameterRole {
|
|
139
|
+
readonly kind: "dynamic-record";
|
|
140
|
+
readonly protocolId: string;
|
|
141
|
+
}
|
|
142
|
+
export interface HostRuntimeDynamicRecordSchema {
|
|
143
|
+
readonly protocolId: string;
|
|
144
|
+
readonly fields: readonly HostRuntimeDynamicRecordFieldRole[];
|
|
145
|
+
}
|
|
146
|
+
export type HostRuntimeCallbackParameterRole = HostRuntimeValueRole | HostRuntimeDynamicRecordParameterRole;
|
|
147
|
+
export interface HostRuntimeCallbackArgumentRole {
|
|
148
|
+
readonly kind: "callback";
|
|
149
|
+
readonly parameters: readonly HostRuntimeCallbackParameterRole[];
|
|
150
|
+
readonly result: HostRuntimeValueRole | "void";
|
|
151
|
+
readonly lifetime: "call" | "retained";
|
|
152
|
+
}
|
|
153
|
+
export type HostRuntimeCallableArgumentRole = HostRuntimeValueRole | HostRuntimeCallbackArgumentRole;
|
|
154
|
+
export interface TrackedProxyProtocolRoles {
|
|
155
|
+
readonly helperFunctions: Readonly<{
|
|
156
|
+
plain: string;
|
|
157
|
+
hidden: string;
|
|
158
|
+
raw: string;
|
|
159
|
+
queue: string;
|
|
160
|
+
wrap: string;
|
|
161
|
+
readTracker: string;
|
|
162
|
+
}>;
|
|
163
|
+
readonly queueOperations: Readonly<{
|
|
164
|
+
hasQueuedConsumers: string;
|
|
165
|
+
flush: string;
|
|
166
|
+
fireBucket: string;
|
|
167
|
+
observe: string;
|
|
168
|
+
observeDirect: string;
|
|
169
|
+
}>;
|
|
170
|
+
readonly stateGlobals: Readonly<{
|
|
171
|
+
activeTracker: string;
|
|
172
|
+
privateState: string;
|
|
173
|
+
}>;
|
|
174
|
+
readonly stateSlots: Readonly<{
|
|
175
|
+
pending: string;
|
|
176
|
+
scheduled: string;
|
|
177
|
+
observers: string;
|
|
178
|
+
rootObservers: string;
|
|
179
|
+
derived: string;
|
|
180
|
+
proxy: string;
|
|
181
|
+
direct: string;
|
|
182
|
+
}>;
|
|
183
|
+
readonly changeEnvelope: Readonly<{
|
|
184
|
+
property: string;
|
|
185
|
+
pathParts: string;
|
|
186
|
+
type: string;
|
|
187
|
+
target: string;
|
|
188
|
+
updateValue: string;
|
|
189
|
+
}>;
|
|
190
|
+
readonly stringKeyTraps: Readonly<{
|
|
191
|
+
arrayPush: string;
|
|
192
|
+
nestedCacheSentinel: string;
|
|
193
|
+
}>;
|
|
194
|
+
}
|
|
195
|
+
export interface TrackedProxyProtocolPayload {
|
|
196
|
+
recordLayoutContractId: string;
|
|
197
|
+
baseClassNames: string[];
|
|
198
|
+
roles: TrackedProxyProtocolRoles;
|
|
199
|
+
proxyFactoryFunction?: DeclaredFrameworkFunctionCoordinate;
|
|
200
|
+
readTrackerFunction?: DeclaredFrameworkFunctionCoordinate;
|
|
201
|
+
observeFunction?: DeclaredFrameworkFunctionCoordinate;
|
|
202
|
+
observeDirectFunction?: DeclaredFrameworkFunctionCoordinate;
|
|
203
|
+
dirtyPropsSymbol?: DeclaredFrameworkFunctionCoordinate;
|
|
204
|
+
dirtySymbol?: DeclaredFrameworkFunctionCoordinate;
|
|
205
|
+
rawSymbol?: DeclaredFrameworkFunctionCoordinate;
|
|
206
|
+
/** Exact exported JS fallback whose embedded implementation is the configured native predicate. */
|
|
207
|
+
plainValueFunction?: DeclaredFrameworkFunctionCoordinate;
|
|
208
|
+
/** Versioned semantic domain shared by the JS fallback and embedded helper. */
|
|
209
|
+
plainValueSemantics?: "tracked-proxy-plain-value-v1";
|
|
210
|
+
/** C++ helper accepting the protocol value carrier and returning native bool. */
|
|
211
|
+
plainValueHelper?: string;
|
|
212
|
+
readTrackerIfActiveHelper?: string;
|
|
213
|
+
fieldSetHelper?: string;
|
|
214
|
+
typedFieldSetHelper?: string;
|
|
215
|
+
vectorItemPropertySetHelper?: string;
|
|
216
|
+
arrayItemChangeFactory?: string;
|
|
217
|
+
methodBatchGuard?: string;
|
|
218
|
+
}
|
|
219
|
+
export interface TrackedProxyFrameworkProtocol {
|
|
220
|
+
readonly kind: "tracked-proxy-v1";
|
|
221
|
+
readonly semanticCategory: "framework-protocol";
|
|
222
|
+
readonly id: string;
|
|
223
|
+
readonly version: 1;
|
|
224
|
+
readonly payload: TrackedProxyProtocolPayload;
|
|
225
|
+
}
|
|
226
|
+
export interface RuntimeRecordLayoutFrameworkProtocol {
|
|
227
|
+
readonly kind: "runtime-record-layout-v1";
|
|
228
|
+
readonly semanticCategory: "framework-protocol";
|
|
229
|
+
readonly id: string;
|
|
230
|
+
readonly version: 1;
|
|
231
|
+
readonly payload: RuntimeRecordProtocolPayload;
|
|
232
|
+
}
|
|
233
|
+
export interface HostNativeCallableSidecarFrameworkProtocol {
|
|
234
|
+
readonly kind: "host-native-callable-sidecar-v1";
|
|
235
|
+
readonly semanticCategory: "framework-protocol";
|
|
236
|
+
readonly id: string;
|
|
237
|
+
readonly version: 1;
|
|
238
|
+
readonly payload: {
|
|
239
|
+
readonly callable: DeclaredFrameworkFunctionCoordinate;
|
|
240
|
+
readonly operations: {
|
|
241
|
+
readonly disposerContainedCallbacks?: Readonly<{
|
|
242
|
+
readonly parameterIndices: readonly number[];
|
|
243
|
+
}>;
|
|
244
|
+
readonly retainedCleanupLifecycle?: Readonly<{
|
|
245
|
+
readonly disposerParameterIndex: number;
|
|
246
|
+
readonly registrationTarget: Readonly<{
|
|
247
|
+
readonly owner: DeclaredFrameworkFunctionCoordinate;
|
|
248
|
+
readonly instanceMethod: string;
|
|
249
|
+
}>;
|
|
250
|
+
readonly cleanupParameterIndex: number;
|
|
251
|
+
}>;
|
|
252
|
+
readonly callableExpandoProperties?: readonly Readonly<{
|
|
253
|
+
readonly key: string;
|
|
254
|
+
readonly receiverTypes: readonly string[];
|
|
255
|
+
readonly receiverRole: "host-native-handle";
|
|
256
|
+
readonly valueRole: "callable";
|
|
257
|
+
readonly parameterTransports?: readonly ("checker-carrier" | HostRuntimeDynamicRecordParameterRole)[];
|
|
258
|
+
}>[];
|
|
259
|
+
readonly dataExpandoProperties?: readonly Readonly<{
|
|
260
|
+
readonly key: string;
|
|
261
|
+
readonly receiverTypes: readonly string[];
|
|
262
|
+
readonly receiverRole: "host-native-handle";
|
|
263
|
+
readonly valueRole: "dynamic";
|
|
264
|
+
}>[];
|
|
265
|
+
readonly structuralDynamicParameters?: readonly Readonly<{
|
|
266
|
+
readonly parameterIndex: number;
|
|
267
|
+
readonly structuralType: "object";
|
|
268
|
+
readonly transport: "declared-dynamic";
|
|
269
|
+
}>[];
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
export type FrameworkProtocol = TrackedProxyFrameworkProtocol | RuntimeRecordLayoutFrameworkProtocol | HostNativeCallableSidecarFrameworkProtocol;
|
|
274
|
+
export interface DeclaredFrameworkFunctionCoordinate {
|
|
275
|
+
moduleSpecifier: string;
|
|
276
|
+
exportName: string;
|
|
277
|
+
}
|
|
278
|
+
export interface DeclaredClosedWorldInterfaceDispatch {
|
|
279
|
+
interfaceName: string;
|
|
280
|
+
implementingClasses: DeclaredFrameworkFunctionCoordinate[];
|
|
281
|
+
}
|
|
282
|
+
export interface RuntimeRecordProtocolPayload {
|
|
283
|
+
keyedEntry?: RuntimeKeyedEntryRecordProtocol;
|
|
284
|
+
change?: RuntimeChangeRecordProtocol;
|
|
285
|
+
arrayItemChange?: RuntimeArrayItemChangeRecordProtocol;
|
|
286
|
+
listChange?: RuntimeListChangeRecordProtocol;
|
|
287
|
+
}
|
|
288
|
+
export interface RuntimeKeyedEntryRecordProtocol {
|
|
289
|
+
fields: {
|
|
290
|
+
key: string;
|
|
291
|
+
item: string;
|
|
292
|
+
element: string;
|
|
293
|
+
disposer: string;
|
|
294
|
+
observer: string;
|
|
295
|
+
};
|
|
296
|
+
factory: string;
|
|
297
|
+
}
|
|
298
|
+
export interface RuntimeChangeRecordProtocol {
|
|
299
|
+
previousValueField: string;
|
|
300
|
+
newValueField: string;
|
|
301
|
+
factory: string;
|
|
302
|
+
}
|
|
303
|
+
export interface RuntimeArrayItemChangeRecordProtocol {
|
|
304
|
+
markerField: string;
|
|
305
|
+
markerValue?: boolean;
|
|
306
|
+
indexField: string;
|
|
307
|
+
previousValueField: string;
|
|
308
|
+
newValueField: string;
|
|
309
|
+
itemDirtyField?: string;
|
|
310
|
+
factory: string;
|
|
311
|
+
runtimeKind?: string;
|
|
312
|
+
}
|
|
313
|
+
export interface RuntimeListChangeRecordProtocol {
|
|
314
|
+
typeField: string;
|
|
315
|
+
startField: string;
|
|
316
|
+
countField: string;
|
|
317
|
+
appendType: string;
|
|
318
|
+
removeType: string;
|
|
319
|
+
reorderType: string;
|
|
320
|
+
updateType: string;
|
|
321
|
+
factory: string;
|
|
322
|
+
}
|
|
323
|
+
export interface NullishPropertyFallbackProtocol {
|
|
324
|
+
propertyName: string;
|
|
325
|
+
helper: string;
|
|
326
|
+
}
|
|
327
|
+
export interface ClassFactoryHook {
|
|
328
|
+
baseClassName: string;
|
|
329
|
+
returnedValueStatements?: string[];
|
|
330
|
+
defaultValueStatements?: string[];
|
|
331
|
+
}
|
|
332
|
+
export interface HostBindingAnalysisPatch {
|
|
333
|
+
bindings?: string[];
|
|
334
|
+
features?: string[];
|
|
335
|
+
}
|
|
336
|
+
export interface PluginDiagnostic {
|
|
337
|
+
kind: "unsupported";
|
|
338
|
+
code: string;
|
|
339
|
+
message: string;
|
|
340
|
+
file?: string;
|
|
341
|
+
line?: number;
|
|
342
|
+
column?: number;
|
|
343
|
+
severity?: "error" | "warning";
|
|
344
|
+
}
|
|
345
|
+
export interface GeatscPlugin {
|
|
346
|
+
name: string;
|
|
347
|
+
configure?(context: {
|
|
348
|
+
entry: string;
|
|
349
|
+
options: PluginOptionMap;
|
|
350
|
+
}): {
|
|
351
|
+
allowAny?: boolean;
|
|
352
|
+
hostShims?: HostShimDefinitions;
|
|
353
|
+
};
|
|
354
|
+
validate?(): PluginDiagnostic[];
|
|
355
|
+
analyzeHostBindings?(context: {
|
|
356
|
+
entry: string;
|
|
357
|
+
options: PluginOptionMap;
|
|
358
|
+
}): HostBindingAnalysisPatch;
|
|
359
|
+
createCppBackend?(): {
|
|
360
|
+
transformModules?(modules: EmitModule[], context: PluginCppContext): EmitModule[];
|
|
361
|
+
transformGeneratedSources?(sources: Array<{
|
|
362
|
+
fileName: string;
|
|
363
|
+
source: string;
|
|
364
|
+
}>, context: PluginCppContext): Array<{
|
|
365
|
+
fileName: string;
|
|
366
|
+
source: string;
|
|
367
|
+
}>;
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
export interface GeaIrBundleV1 {
|
|
371
|
+
schema: "gea-ir";
|
|
372
|
+
version: 1;
|
|
373
|
+
entry: string;
|
|
374
|
+
modules: GeaIrModule[];
|
|
375
|
+
components: GeaIrComponent[];
|
|
376
|
+
stores: GeaIrStore[];
|
|
377
|
+
hostCapabilities: string[];
|
|
378
|
+
}
|
|
379
|
+
export interface GeaIrModule {
|
|
380
|
+
id: string;
|
|
381
|
+
file: string;
|
|
382
|
+
components: string[];
|
|
383
|
+
stores: string[];
|
|
384
|
+
}
|
|
385
|
+
export interface GeaIrComponent {
|
|
386
|
+
id: string;
|
|
387
|
+
module: string;
|
|
388
|
+
exportName: string;
|
|
389
|
+
runtimeBase: GeaIrRuntimeBase;
|
|
390
|
+
template: GeaIrTemplate;
|
|
391
|
+
sourceSpan?: GeaIrSourceSpan;
|
|
392
|
+
reactiveState?: GeaIrComponentReactiveState;
|
|
393
|
+
}
|
|
394
|
+
export interface GeaIrComponentReactiveState {
|
|
395
|
+
fields: GeaIrStoreField[];
|
|
396
|
+
methods?: GeaIrStoreMethod[];
|
|
397
|
+
getters?: GeaIrStoreGetter[];
|
|
398
|
+
constants?: GeaIrConstant[];
|
|
399
|
+
}
|
|
400
|
+
export type GeaIrRuntimeBase = "static" | "static-element" | "compiled" | "tiny-reactive" | "lean-reactive" | "reactive";
|
|
401
|
+
export interface GeaIrTemplate {
|
|
402
|
+
html: string;
|
|
403
|
+
slots: GeaIrSlot[];
|
|
404
|
+
}
|
|
405
|
+
export interface GeaIrSlot {
|
|
406
|
+
index: number;
|
|
407
|
+
kind: string;
|
|
408
|
+
walk: number[];
|
|
409
|
+
walkKinds?: Array<{
|
|
410
|
+
elem: number;
|
|
411
|
+
} | {
|
|
412
|
+
child: number;
|
|
413
|
+
}>;
|
|
414
|
+
expr?: string;
|
|
415
|
+
exprPath?: string[];
|
|
416
|
+
exprObjectFields?: GeaIrExpressionObjectField[];
|
|
417
|
+
payload?: unknown;
|
|
418
|
+
directText?: boolean;
|
|
419
|
+
}
|
|
420
|
+
export interface GeaIrExpressionObjectField {
|
|
421
|
+
name: string;
|
|
422
|
+
expr: string;
|
|
423
|
+
exprPath?: string[];
|
|
424
|
+
}
|
|
425
|
+
export interface GeaIrKeyedListPayload {
|
|
426
|
+
mapCallback?: unknown;
|
|
427
|
+
itemParam?: string;
|
|
428
|
+
indexParam?: string;
|
|
429
|
+
rowTemplate?: GeaIrTemplate;
|
|
430
|
+
[key: string]: unknown;
|
|
431
|
+
}
|
|
432
|
+
export interface GeaIrStore {
|
|
433
|
+
id: string;
|
|
434
|
+
module: string;
|
|
435
|
+
className: string;
|
|
436
|
+
runtimeBase: "compiled" | "lean";
|
|
437
|
+
fields: GeaIrStoreField[];
|
|
438
|
+
methods?: GeaIrStoreMethod[];
|
|
439
|
+
getters?: GeaIrStoreGetter[];
|
|
440
|
+
constants?: GeaIrConstant[];
|
|
441
|
+
sourceSpan?: GeaIrSourceSpan;
|
|
442
|
+
selfStore?: boolean;
|
|
443
|
+
}
|
|
444
|
+
export interface GeaIrStoreGetter {
|
|
445
|
+
name: string;
|
|
446
|
+
returnsArray: boolean;
|
|
447
|
+
elementTypeName?: string;
|
|
448
|
+
shape?: GeaIrStoreValueShape;
|
|
449
|
+
deps: string[];
|
|
450
|
+
body: string;
|
|
451
|
+
ops?: GeaIrStoreStmt[];
|
|
452
|
+
sourceSpan?: GeaIrSourceSpan;
|
|
453
|
+
}
|
|
454
|
+
export interface GeaIrStoreField {
|
|
455
|
+
name: string;
|
|
456
|
+
initializer?: string;
|
|
457
|
+
shape?: GeaIrStoreValueShape;
|
|
458
|
+
typedStorage?: GeaIrStoreFieldTypedStorage;
|
|
459
|
+
}
|
|
460
|
+
export interface GeaIrStoreFieldTypedStorage {
|
|
461
|
+
itemType: string;
|
|
462
|
+
readerName: string;
|
|
463
|
+
useInterfaceStruct?: boolean;
|
|
464
|
+
elementTypeName?: string;
|
|
465
|
+
}
|
|
466
|
+
export type GeaIrStoreValueShape = {
|
|
467
|
+
kind: "array";
|
|
468
|
+
element?: GeaIrStoreValueShape;
|
|
469
|
+
elementTypeName?: string;
|
|
470
|
+
} | {
|
|
471
|
+
kind: "object";
|
|
472
|
+
fields: GeaIrStoreField[];
|
|
473
|
+
} | {
|
|
474
|
+
kind: "literal";
|
|
475
|
+
valueType: "string" | "number" | "boolean" | "null";
|
|
476
|
+
};
|
|
477
|
+
export interface GeaIrStoreMethod {
|
|
478
|
+
name: string;
|
|
479
|
+
params: GeaIrStoreMethodParam[];
|
|
480
|
+
body: string;
|
|
481
|
+
ops?: GeaIrStoreStmt[];
|
|
482
|
+
sourceSpan?: GeaIrSourceSpan;
|
|
483
|
+
}
|
|
484
|
+
export interface GeaIrStoreMethodParam {
|
|
485
|
+
name: string;
|
|
486
|
+
valueType?: "string" | "number" | "boolean";
|
|
487
|
+
}
|
|
488
|
+
export type GeaIrConstantPrimitiveType = "string" | "number" | "boolean" | "null";
|
|
489
|
+
export interface GeaIrConstantObjectField {
|
|
490
|
+
name: string;
|
|
491
|
+
value: string;
|
|
492
|
+
valueType: GeaIrConstantPrimitiveType;
|
|
493
|
+
}
|
|
494
|
+
export interface GeaIrConstantObjectArrayItem {
|
|
495
|
+
fields: GeaIrConstantObjectField[];
|
|
496
|
+
}
|
|
497
|
+
export interface GeaIrConstant {
|
|
498
|
+
name: string;
|
|
499
|
+
value: string;
|
|
500
|
+
valueType: GeaIrConstantPrimitiveType | "object-array";
|
|
501
|
+
items?: GeaIrConstantObjectArrayItem[];
|
|
502
|
+
}
|
|
503
|
+
export type GeaIrStoreStmt = {
|
|
504
|
+
kind: "var";
|
|
505
|
+
name: string;
|
|
506
|
+
mutable?: boolean;
|
|
507
|
+
init?: GeaIrStoreExpr;
|
|
508
|
+
localType?: GeaIrStoreLocalType;
|
|
509
|
+
} | {
|
|
510
|
+
kind: "assign";
|
|
511
|
+
target: GeaIrStoreExpr;
|
|
512
|
+
value: GeaIrStoreExpr;
|
|
513
|
+
} | {
|
|
514
|
+
kind: "expr";
|
|
515
|
+
expr: GeaIrStoreExpr;
|
|
516
|
+
} | {
|
|
517
|
+
kind: "if";
|
|
518
|
+
test: GeaIrStoreExpr;
|
|
519
|
+
consequent: GeaIrStoreStmt[];
|
|
520
|
+
alternate?: GeaIrStoreStmt[];
|
|
521
|
+
} | {
|
|
522
|
+
kind: "for";
|
|
523
|
+
init?: GeaIrStoreStmt;
|
|
524
|
+
test?: GeaIrStoreExpr;
|
|
525
|
+
update?: GeaIrStoreExpr;
|
|
526
|
+
body: GeaIrStoreStmt[];
|
|
527
|
+
} | {
|
|
528
|
+
kind: "return";
|
|
529
|
+
value?: GeaIrStoreExpr;
|
|
530
|
+
};
|
|
531
|
+
export type GeaIrStoreLocalType = {
|
|
532
|
+
kind: "array";
|
|
533
|
+
elementTypeName: string;
|
|
534
|
+
} | {
|
|
535
|
+
kind: "array";
|
|
536
|
+
elementPrimitive: "number" | "string" | "boolean";
|
|
537
|
+
};
|
|
538
|
+
export type GeaIrStoreExpr = {
|
|
539
|
+
kind: "identifier";
|
|
540
|
+
name: string;
|
|
541
|
+
} | {
|
|
542
|
+
kind: "this";
|
|
543
|
+
} | {
|
|
544
|
+
kind: "number";
|
|
545
|
+
value: number;
|
|
546
|
+
} | {
|
|
547
|
+
kind: "string";
|
|
548
|
+
value: string;
|
|
549
|
+
} | {
|
|
550
|
+
kind: "boolean";
|
|
551
|
+
value: boolean;
|
|
552
|
+
} | {
|
|
553
|
+
kind: "null";
|
|
554
|
+
} | {
|
|
555
|
+
kind: "member";
|
|
556
|
+
object: GeaIrStoreExpr;
|
|
557
|
+
property: string;
|
|
558
|
+
computed?: false;
|
|
559
|
+
} | {
|
|
560
|
+
kind: "index";
|
|
561
|
+
object: GeaIrStoreExpr;
|
|
562
|
+
index: GeaIrStoreExpr;
|
|
563
|
+
} | {
|
|
564
|
+
kind: "call";
|
|
565
|
+
callee: GeaIrStoreExpr;
|
|
566
|
+
args: GeaIrStoreExpr[];
|
|
567
|
+
} | {
|
|
568
|
+
kind: "object";
|
|
569
|
+
fields: Array<{
|
|
570
|
+
name: string;
|
|
571
|
+
value: GeaIrStoreExpr;
|
|
572
|
+
}>;
|
|
573
|
+
} | {
|
|
574
|
+
kind: "array";
|
|
575
|
+
elements: GeaIrStoreExpr[];
|
|
576
|
+
} | {
|
|
577
|
+
kind: "unary";
|
|
578
|
+
op: string;
|
|
579
|
+
arg: GeaIrStoreExpr;
|
|
580
|
+
} | {
|
|
581
|
+
kind: "binary";
|
|
582
|
+
op: string;
|
|
583
|
+
left: GeaIrStoreExpr;
|
|
584
|
+
right: GeaIrStoreExpr;
|
|
585
|
+
} | {
|
|
586
|
+
kind: "logical";
|
|
587
|
+
op: string;
|
|
588
|
+
left: GeaIrStoreExpr;
|
|
589
|
+
right: GeaIrStoreExpr;
|
|
590
|
+
} | {
|
|
591
|
+
kind: "conditional";
|
|
592
|
+
test: GeaIrStoreExpr;
|
|
593
|
+
consequent: GeaIrStoreExpr;
|
|
594
|
+
alternate: GeaIrStoreExpr;
|
|
595
|
+
} | {
|
|
596
|
+
kind: "update";
|
|
597
|
+
op: string;
|
|
598
|
+
arg: GeaIrStoreExpr;
|
|
599
|
+
prefix: boolean;
|
|
600
|
+
};
|
|
601
|
+
export interface GeaIrSourceSpan {
|
|
602
|
+
start?: number;
|
|
603
|
+
end?: number;
|
|
604
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { PluginOptionMap } from './types.js';
|
|
2
|
+
export declare function boolOption(options: PluginOptionMap, name: string): boolean;
|
|
3
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
4
|
+
export declare function cppString(value: string): string;
|
|
5
|
+
export declare function cssPropertyName(value: string): string;
|
|
6
|
+
export declare function styleDeclarationEnumForPropertyName(propertyName: string): string | null;
|
|
7
|
+
export declare function isPxLengthStylePropertyName(propertyName: string): boolean;
|
|
8
|
+
export declare function stylePercentPropertyEnumForPropertyName(propertyName: string): string | null;
|
|
9
|
+
export declare function styleRawNumberPropertyEnumsForPropertyName(propertyName: string): string[] | null;
|
|
10
|
+
export interface StylePropertyValue {
|
|
11
|
+
property: string;
|
|
12
|
+
value: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function styleKeywordPropertyValuesForPropertyName(propertyName: string, rawValue: string): StylePropertyValue[] | null;
|
|
15
|
+
export declare function styleKeywordPropertiesForPropertyName(propertyName: string): string[] | null;
|
|
16
|
+
export interface OpaqueCssColor {
|
|
17
|
+
r: number;
|
|
18
|
+
g: number;
|
|
19
|
+
b: number;
|
|
20
|
+
}
|
|
21
|
+
export type OpaqueColorStyleTarget = 'background' | 'color' | 'active-background' | 'border-color' | 'border-top-color' | 'border-right-color' | 'border-bottom-color' | 'border-left-color';
|
|
22
|
+
export declare function opaqueCssHexColor(rawValue: string): OpaqueCssColor | null;
|
|
23
|
+
export declare function styleOpaqueColorTargetForPropertyName(propertyName: string): OpaqueColorStyleTarget | null;
|
|
24
|
+
export declare function nativeStyleColorExpression(color: OpaqueCssColor): string;
|
|
25
|
+
export declare function isRuntimeNumericConstantIdentifier(name: string): boolean;
|
|
26
|
+
export declare function sanitizeCppIdentifier(value: string): string;
|