@geastack/geatsc-plugin-gea 0.1.12 → 0.1.13
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-literals.js +0 -27
- package/dist/analyze-renderer.js +1 -6
- package/dist/analyze-runtime.d.ts +1 -0
- package/dist/analyze-runtime.js +136 -0
- package/dist/analyze.js +17 -8
- package/dist/cpp-ir.d.ts +2 -1
- package/dist/cpp-ir.js +6 -10
- package/dist/index.js +4 -3
- package/package.json +3 -4
package/dist/analyze-literals.js
CHANGED
|
@@ -294,33 +294,6 @@ export function sourceLiteralResolver(files, initiallyOpaque) {
|
|
|
294
294
|
if (!at || initiallyOpaque)
|
|
295
295
|
return false;
|
|
296
296
|
const parent = at.parent;
|
|
297
|
-
// A locally declared frame callback may also be named animate. Resolve
|
|
298
|
-
// its binding instead of confusing the name with Element.animate.
|
|
299
|
-
if (ts.isIdentifier(at)) {
|
|
300
|
-
let symbol = typeChecker().getSymbolAtLocation(at);
|
|
301
|
-
if (symbol && (symbol.flags & ts.SymbolFlags.Alias))
|
|
302
|
-
symbol = typeChecker().getAliasedSymbol(symbol);
|
|
303
|
-
const declarations = symbol?.declarations;
|
|
304
|
-
if (declarations?.length && declarations.every(declaration => sources.has(declaration.getSourceFile().fileName) && ts.isFunctionDeclaration(declaration) && !!declaration.body)) {
|
|
305
|
-
let reassigned = false;
|
|
306
|
-
const checkWrites = (child) => {
|
|
307
|
-
if (ts.isBinaryExpression(child) && child.operatorToken.kind >= ts.SyntaxKind.FirstAssignment &&
|
|
308
|
-
child.operatorToken.kind <= ts.SyntaxKind.LastAssignment) {
|
|
309
|
-
const checkTarget = (target) => {
|
|
310
|
-
if (ts.isIdentifier(target) && typeChecker().getSymbolAtLocation(target) === symbol)
|
|
311
|
-
reassigned = true;
|
|
312
|
-
ts.forEachChild(target, checkTarget);
|
|
313
|
-
};
|
|
314
|
-
checkTarget(child.left);
|
|
315
|
-
}
|
|
316
|
-
ts.forEachChild(child, checkWrites);
|
|
317
|
-
};
|
|
318
|
-
for (const source of sources.values())
|
|
319
|
-
checkWrites(source);
|
|
320
|
-
if (!reassigned)
|
|
321
|
-
return true;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
297
|
if (ts.isMethodDeclaration(parent) && parent.name === at && parent.body)
|
|
325
298
|
return true;
|
|
326
299
|
const access = ts.isPropertyAccessExpression(at) || ts.isElementAccessExpression(at) ? at
|
package/dist/analyze-renderer.js
CHANGED
|
@@ -426,12 +426,7 @@ export function addRendererFeatures(file, text, features, observer, variables) {
|
|
|
426
426
|
for (const arg of node.arguments.slice(1))
|
|
427
427
|
styleObject(arg);
|
|
428
428
|
}
|
|
429
|
-
|
|
430
|
-
// a primitive string even when its replacement callback is dynamic.
|
|
431
|
-
const literalStringReplace = name === 'replace' &&
|
|
432
|
-
(ts.isPropertyAccessExpression(node.expression) || ts.isElementAccessExpression(node.expression)) &&
|
|
433
|
-
literal(node.expression.expression) !== undefined;
|
|
434
|
-
if (name === 'insertRule' || name === 'replaceSync' || (name === 'replace' && !literalStringReplace)) {
|
|
429
|
+
if (name === 'insertRule' || name === 'replaceSync' || name === 'replace') {
|
|
435
430
|
if (node.arguments[0])
|
|
436
431
|
styleObject(node.arguments[0]);
|
|
437
432
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function inferCanvasOnly(sources: ReadonlyMap<string, string>, unknown: boolean): boolean;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
// This proof is intentionally narrower than "no JSX". The canvas frame/boot
|
|
3
|
+
// path omits document refresh and service callbacks, so every executable import
|
|
4
|
+
// and free global must be understood before that path may be selected.
|
|
5
|
+
const canvasDisplayMembers = new Set(['ctx', 'width', 'height', 'getDevicePixelRatio', 'getFrameIntervalMs', 'setFrameIntervalMs', 'getFrameRate', 'setFrameRate', 'setAA', 'setFlushConfig']);
|
|
6
|
+
const canvasHostExports = new Set(['Display', 'rgb']);
|
|
7
|
+
const pureGlobals = new Set([
|
|
8
|
+
'undefined', 'NaN', 'Infinity', 'Math', 'Number', 'String', 'Boolean', 'BigInt',
|
|
9
|
+
'Object', 'Array', 'ArrayBuffer', 'SharedArrayBuffer', 'DataView', 'Map', 'Set',
|
|
10
|
+
'WeakMap', 'WeakSet', 'Symbol', 'Date', 'RegExp', 'JSON', 'Promise',
|
|
11
|
+
'Int8Array', 'Uint8Array', 'Uint8ClampedArray', 'Int16Array', 'Uint16Array',
|
|
12
|
+
'Int32Array', 'Uint32Array', 'Float32Array', 'Float64Array', 'BigInt64Array', 'BigUint64Array',
|
|
13
|
+
'Error', 'TypeError', 'RangeError', 'ReferenceError', 'SyntaxError', 'URIError', 'EvalError',
|
|
14
|
+
'parseInt', 'parseFloat', 'isNaN', 'isFinite', 'decodeURI', 'decodeURIComponent',
|
|
15
|
+
'encodeURI', 'encodeURIComponent', 'console', 'performance',
|
|
16
|
+
'requestAnimationFrame', 'setTimeout', 'clearTimeout', 'setInterval', 'clearInterval',
|
|
17
|
+
]);
|
|
18
|
+
const hostModule = /^(?:gea-embedded|@geastack\/(?:core|engine)|@geajs\/core)(?:\/|$)/;
|
|
19
|
+
const canvasModule = /^(?:gea-embedded|@geastack\/core)$/;
|
|
20
|
+
export function inferCanvasOnly(sources, unknown) {
|
|
21
|
+
if (unknown || !sources.size)
|
|
22
|
+
return false;
|
|
23
|
+
const files = new Map();
|
|
24
|
+
for (const [file, text] of sources) {
|
|
25
|
+
if (!/\.[cm]?[jt]sx?$/.test(file))
|
|
26
|
+
return false;
|
|
27
|
+
const source = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, /\.[jt]sx$/.test(file) ? ts.ScriptKind.TSX : /\.[cm]?js$/.test(file) ? ts.ScriptKind.JS : ts.ScriptKind.TS);
|
|
28
|
+
if (source.parseDiagnostics?.length)
|
|
29
|
+
return false;
|
|
30
|
+
files.set(file, source);
|
|
31
|
+
}
|
|
32
|
+
// Binding local names avoids both a host-global blacklist (which misses new
|
|
33
|
+
// APIs) and false positives for ordinary app methods named fetch/document.
|
|
34
|
+
// No library or filesystem resolution: discovery already owns the graph.
|
|
35
|
+
const options = { noLib: true, noResolve: true, types: [], allowJs: true, target: ts.ScriptTarget.Latest };
|
|
36
|
+
const host = ts.createCompilerHost(options);
|
|
37
|
+
host.getSourceFile = file => files.get(file);
|
|
38
|
+
host.resolveModuleNames = names => names.map(() => undefined);
|
|
39
|
+
host.directoryExists = () => false;
|
|
40
|
+
host.getDirectories = () => [];
|
|
41
|
+
host.fileExists = file => files.has(file);
|
|
42
|
+
host.readFile = file => sources.get(file);
|
|
43
|
+
const checker = ts.createProgram([...files.keys()], options, host).getTypeChecker();
|
|
44
|
+
let safe = true;
|
|
45
|
+
let display = false;
|
|
46
|
+
const visit = (node) => {
|
|
47
|
+
if (ts.canHaveModifiers(node) && ts.getModifiers(node)?.some(m => m.kind === ts.SyntaxKind.DeclareKeyword))
|
|
48
|
+
return;
|
|
49
|
+
if (!safe || ts.isTypeNode(node) || ts.isInterfaceDeclaration(node) || ts.isTypeAliasDeclaration(node))
|
|
50
|
+
return;
|
|
51
|
+
if (ts.isJsxElement(node) || ts.isJsxSelfClosingElement(node) || ts.isJsxFragment(node)) {
|
|
52
|
+
safe = false;
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (ts.isImportDeclaration(node)) {
|
|
56
|
+
if (node.importClause?.isTypeOnly)
|
|
57
|
+
return;
|
|
58
|
+
const module = ts.isStringLiteral(node.moduleSpecifier) ? node.moduleSpecifier.text : '';
|
|
59
|
+
if (hostModule.test(module)) {
|
|
60
|
+
const clause = node.importClause;
|
|
61
|
+
const names = clause?.namedBindings;
|
|
62
|
+
if (!canvasModule.test(module) || !clause || clause.name || !names || !ts.isNamedImports(names)) {
|
|
63
|
+
safe = false;
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
for (const item of names.elements) {
|
|
67
|
+
if (item.isTypeOnly)
|
|
68
|
+
continue;
|
|
69
|
+
const name = (item.propertyName ?? item.name).text;
|
|
70
|
+
if (!canvasHostExports.has(name))
|
|
71
|
+
safe = false;
|
|
72
|
+
if (name === 'Display')
|
|
73
|
+
display = true;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (ts.isExportDeclaration(node)) {
|
|
79
|
+
if (!node.isTypeOnly && node.moduleSpecifier && ts.isStringLiteral(node.moduleSpecifier) && hostModule.test(node.moduleSpecifier.text))
|
|
80
|
+
safe = false;
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (ts.isImportEqualsDeclaration(node) ||
|
|
84
|
+
(ts.isCallExpression(node) && (node.expression.kind === ts.SyntaxKind.ImportKeyword ||
|
|
85
|
+
(ts.isIdentifier(node.expression) && ['require', 'eval', 'Function'].includes(node.expression.text))))) {
|
|
86
|
+
safe = false;
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (ts.isIdentifier(node) && isValueReference(node)) {
|
|
90
|
+
const symbol = ts.isShorthandPropertyAssignment(node.parent)
|
|
91
|
+
? checker.getShorthandAssignmentValueSymbol(node.parent) : checker.getSymbolAtLocation(node);
|
|
92
|
+
const importedDisplay = symbol?.declarations?.find(d => ts.isImportSpecifier(d) && (d.propertyName ?? d.name).text === 'Display' && ts.isStringLiteral(d.parent.parent.parent.moduleSpecifier) && canvasModule.test(d.parent.parent.parent.moduleSpecifier.text));
|
|
93
|
+
if (importedDisplay) {
|
|
94
|
+
const parent = node.parent;
|
|
95
|
+
if (!ts.isPropertyAccessExpression(parent) || parent.expression !== node || !canvasDisplayMembers.has(parent.name.text))
|
|
96
|
+
safe = false;
|
|
97
|
+
}
|
|
98
|
+
if (!symbol?.declarations?.length || symbol.declarations.some(isAmbient)) {
|
|
99
|
+
if (node.text === 'window') {
|
|
100
|
+
const parent = node.parent;
|
|
101
|
+
if (!ts.isPropertyAccessExpression(parent) || parent.expression !== node ||
|
|
102
|
+
!['innerWidth', 'innerHeight', 'devicePixelRatio'].includes(parent.name.text))
|
|
103
|
+
safe = false;
|
|
104
|
+
}
|
|
105
|
+
else if (!pureGlobals.has(node.text))
|
|
106
|
+
safe = false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
ts.forEachChild(node, visit);
|
|
110
|
+
};
|
|
111
|
+
for (const source of files.values())
|
|
112
|
+
visit(source);
|
|
113
|
+
return safe && display;
|
|
114
|
+
}
|
|
115
|
+
function isValueReference(node) {
|
|
116
|
+
const parent = node.parent;
|
|
117
|
+
if (ts.isPropertyAccessExpression(parent) && parent.name === node)
|
|
118
|
+
return false;
|
|
119
|
+
if (ts.isBindingElement(parent) && parent.propertyName === node)
|
|
120
|
+
return false;
|
|
121
|
+
if (ts.isLabeledStatement(parent) || ts.isBreakStatement(parent) || ts.isContinueStatement(parent))
|
|
122
|
+
return false;
|
|
123
|
+
// Declaration/property names are not reads; shorthand properties are.
|
|
124
|
+
if ('name' in parent && parent.name === node && !ts.isShorthandPropertyAssignment(parent))
|
|
125
|
+
return false;
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
function isAmbient(node) {
|
|
129
|
+
for (let current = node; current; current = current.parent) {
|
|
130
|
+
if (ts.isSourceFile(current) && current.isDeclarationFile)
|
|
131
|
+
return true;
|
|
132
|
+
if (ts.canHaveModifiers(current) && ts.getModifiers(current)?.some(m => m.kind === ts.SyntaxKind.DeclareKeyword))
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
return false;
|
|
136
|
+
}
|
package/dist/analyze.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { inferCanvasOnly } from './analyze-runtime.js';
|
|
1
2
|
import { nodeAuxVersion, addNodeAuxFeatures, addUnknownNodeAux, cssUsesNodeAttributes } from './analyze-node-aux.js';
|
|
2
3
|
import { sourceLiteralResolver } from './analyze-literals.js';
|
|
3
4
|
import fs from 'node:fs';
|
|
@@ -76,6 +77,9 @@ export function analyzeSourceHostBindings(entry) {
|
|
|
76
77
|
features.add(`node-class-capacity-v1-${classCapacity}`);
|
|
77
78
|
features.add(`node-class-storage-v1-${classCapacity}`);
|
|
78
79
|
}
|
|
80
|
+
features.add('runtime-analysis-v1');
|
|
81
|
+
if (inferCanvasOnly(literalSources, discovery.unknown || discovery.runtimeUnknown))
|
|
82
|
+
features.add('runtime-canvas-only');
|
|
79
83
|
variables.finish();
|
|
80
84
|
css.finish();
|
|
81
85
|
ranges.finish();
|
|
@@ -157,9 +161,6 @@ function addBindingsForGeaEmbeddedImports(text, bindings) {
|
|
|
157
161
|
const hostGlobalCalls = [
|
|
158
162
|
[/(?<![.\w$])fetch\s*\(/, 'fetch'],
|
|
159
163
|
[/(?<![.\w$])new\s+WebSocket\s*\(/, 'websocket'],
|
|
160
|
-
[/(?<![.\w$])new\s+(?:window\.|globalThis\.)?RTCPeerConnection\s*\(/, 'rtc'],
|
|
161
|
-
[/(?<![.\w$])navigator\s*\.\s*mediaDevices\s*\.\s*getUserMedia\s*\(/, 'audio'],
|
|
162
|
-
[/(?<![.\w$])new\s+(?:window\.|globalThis\.)?AudioContext\s*\(/, 'audio'],
|
|
163
164
|
];
|
|
164
165
|
// A file that declares its own `fetch` (a class method, or a wrapper such as
|
|
165
166
|
// image-demo's runtime.ts) calls that one; its network use, if any, shows up
|
|
@@ -196,6 +197,7 @@ function discoverSourceFiles(entry) {
|
|
|
196
197
|
const visited = new Set();
|
|
197
198
|
const files = [];
|
|
198
199
|
let unknown = false;
|
|
200
|
+
let runtimeUnknown = false;
|
|
199
201
|
function visit(file) {
|
|
200
202
|
const resolved = path.resolve(file);
|
|
201
203
|
// An entry that is a directory (a configure run without app metadata)
|
|
@@ -206,8 +208,13 @@ function discoverSourceFiles(entry) {
|
|
|
206
208
|
// Imported data is not executable source. Parsing a JPEG or JSON as TS
|
|
207
209
|
// manufactures syntax errors and falsely marks every renderer feature as
|
|
208
210
|
// reachable. Dynamic use of data as CSS is still observed at its call site.
|
|
209
|
-
if (/\.(?:json|png|jpe?g|gif|webp|bmp|ico|ttf|otf|woff2?|wav|mp3|ogg|mp4)$/i.test(resolved))
|
|
211
|
+
if (/\.(?:json|png|jpe?g|gif|webp|bmp|ico|ttf|otf|woff2?|wav|mp3|ogg|mp4)$/i.test(resolved)) {
|
|
212
|
+
// Asset imports can generate decoder/host calls outside this source
|
|
213
|
+
// graph. Plain JSON is data; other assets cannot certify a minimal boot.
|
|
214
|
+
if (!/\.json$/i.test(resolved))
|
|
215
|
+
runtimeUnknown = true;
|
|
210
216
|
return;
|
|
217
|
+
}
|
|
211
218
|
const text = fs.readFileSync(resolved, 'utf8');
|
|
212
219
|
for (const specifier of /\.css$/i.test(resolved) ? [] : moduleSpecifiers(resolved, text)) {
|
|
213
220
|
// Framework host imports do not inject renderer instructions. Other
|
|
@@ -235,7 +242,7 @@ function discoverSourceFiles(entry) {
|
|
|
235
242
|
visit(entry);
|
|
236
243
|
if (!files.length)
|
|
237
244
|
unknown = true;
|
|
238
|
-
return { files, unknown };
|
|
245
|
+
return { files, unknown, runtimeUnknown };
|
|
239
246
|
}
|
|
240
247
|
function moduleSpecifiers(file, text) {
|
|
241
248
|
const source = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true, /\.[jt]sx$/i.test(file) ? ts.ScriptKind.TSX : ts.ScriptKind.TS);
|
|
@@ -261,9 +268,11 @@ function moduleSpecifiers(file, text) {
|
|
|
261
268
|
return specifiers;
|
|
262
269
|
}
|
|
263
270
|
function resolvePackageModule(importer, specifier) {
|
|
264
|
-
//
|
|
265
|
-
//
|
|
266
|
-
//
|
|
271
|
+
// CSS package imports must be traversed just like relative stylesheets. For
|
|
272
|
+
// opaque JS packages keep the conservative feature set instead of assuming
|
|
273
|
+
// their exports cannot render anything.
|
|
274
|
+
if (!/\.css$/i.test(specifier))
|
|
275
|
+
return null;
|
|
267
276
|
try {
|
|
268
277
|
return createRequire(importer).resolve(specifier);
|
|
269
278
|
}
|
package/dist/cpp-ir.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { EmitModule, GeaIrBundleV1, GeaIrConstant } from "./types.js";
|
|
2
|
-
export declare function generateCppIrSource(ir: GeaIrBundleV1, irPath: string | null, modules: EmitModule[], microtasksNamespace?: string): string;
|
|
2
|
+
export declare function generateCppIrSource(ir: GeaIrBundleV1, irPath: string | null, modules: EmitModule[], microtasksNamespace?: string, directCanvas?: boolean): string;
|
|
3
3
|
export declare function irUsesCanvas(ir: GeaIrBundleV1, modules?: readonly EmitModule[]): boolean;
|
|
4
4
|
export declare function generateCppIrNamespaceSource(ir: GeaIrBundleV1, modules: readonly EmitModule[], options?: {
|
|
5
5
|
includeDomInterop?: boolean;
|
|
6
|
+
directCanvas?: boolean;
|
|
6
7
|
}): string;
|
|
7
8
|
export declare function generateCppIrMountedSource(ir: GeaIrBundleV1, knownGlobalAccessorTypes?: ReadonlyMap<string, string>): string;
|
|
8
9
|
export declare function generateCppIrAssetForwardDeclarations(ir: GeaIrBundleV1): string;
|
package/dist/cpp-ir.js
CHANGED
|
@@ -7,17 +7,17 @@ import { sanitizeCppIdentifier } from "./utils.js";
|
|
|
7
7
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
8
8
|
import { dirname, resolve } from "node:path";
|
|
9
9
|
import ts from "typescript";
|
|
10
|
-
export function generateCppIrSource(ir, irPath, modules, microtasksNamespace = "gea::framework::app::generated") {
|
|
10
|
+
export function generateCppIrSource(ir, irPath, modules, microtasksNamespace = "gea::framework::app::generated", directCanvas = false) {
|
|
11
11
|
const drainNamespace = cppNamespace(microtasksNamespace);
|
|
12
12
|
const usesCanvas = irUsesCanvas(ir, modules);
|
|
13
|
-
const emitBoxedCanvasContext = usesCanvas && !
|
|
13
|
+
const emitBoxedCanvasContext = usesCanvas && !directCanvas;
|
|
14
14
|
const lines = [
|
|
15
15
|
"// @geastack/geatsc-plugin-gea consumed gea IR",
|
|
16
16
|
`// ir=${irPath ?? "<inline>"}`,
|
|
17
17
|
`// modules=${ir.modules.length} components=${ir.components.length} stores=${ir.stores.length}`,
|
|
18
18
|
`// emitted-modules=${modules.length}`,
|
|
19
19
|
"",
|
|
20
|
-
...(
|
|
20
|
+
...(directCanvas
|
|
21
21
|
? ['#include "direct_canvas_runtime.h"']
|
|
22
22
|
: []),
|
|
23
23
|
'#include "gea/embedded.h"',
|
|
@@ -46,10 +46,6 @@ export function generateCppIrSource(ir, irPath, modules, microtasksNamespace = "
|
|
|
46
46
|
];
|
|
47
47
|
return lines.join("\n");
|
|
48
48
|
}
|
|
49
|
-
function directCanvasContextEnabled() {
|
|
50
|
-
const value = String(process.env.GEA_EMBEDDED_DIRECT_CANVAS_CONTEXT ?? "").toLowerCase();
|
|
51
|
-
return value === "1" || value === "true" || value === "yes";
|
|
52
|
-
}
|
|
53
49
|
export function irUsesCanvas(ir, modules) {
|
|
54
50
|
if (ir.hostCapabilities.includes("canvas"))
|
|
55
51
|
return true;
|
|
@@ -160,7 +156,7 @@ export function generateCppIrNamespaceSource(ir, modules, options = {}) {
|
|
|
160
156
|
...(needsTemplateRuntime ? nativeDisposerSource() : []),
|
|
161
157
|
"",
|
|
162
158
|
...(options.includeDomInterop
|
|
163
|
-
? canvasInteropSource(irUsesCanvas(ir, modules))
|
|
159
|
+
? canvasInteropSource(irUsesCanvas(ir, modules), options.directCanvas === true)
|
|
164
160
|
: []),
|
|
165
161
|
// Forward-declare the interface-reuse typed-item helpers before
|
|
166
162
|
// `storeRuntimeSource` so the template-dependent `set_typed_field(slot, …)`
|
|
@@ -1612,8 +1608,8 @@ export function directCanvasInteropSource(usesCanvas, options = {}) {
|
|
|
1612
1608
|
"",
|
|
1613
1609
|
];
|
|
1614
1610
|
}
|
|
1615
|
-
function canvasInteropSource(usesCanvas) {
|
|
1616
|
-
if (
|
|
1611
|
+
function canvasInteropSource(usesCanvas, directCanvas) {
|
|
1612
|
+
if (directCanvas)
|
|
1617
1613
|
return [
|
|
1618
1614
|
...domStyleInteropSource(),
|
|
1619
1615
|
...directCanvasInteropSource(usesCanvas),
|
package/dist/index.js
CHANGED
|
@@ -278,7 +278,8 @@ function transformModuleFirstGeneratedSource(source, ir, compilerRuntimeHeader,
|
|
|
278
278
|
if (nextSource.fileName.endsWith('.types.hpp'))
|
|
279
279
|
return nextSource;
|
|
280
280
|
let next = nextSource.source;
|
|
281
|
-
|
|
281
|
+
if (options['gea.store-relowering'] !== 'false')
|
|
282
|
+
next = replaceStoreMethodsFromIr(next, ir, collectIrConstants(ir), topLevelValueNames);
|
|
282
283
|
next = applyTypedArrayStorage(next, ir);
|
|
283
284
|
next = foldCanvasColorLiteralsInCpp(next, { pixelPanelEndian: pixelPanelEndian(options) });
|
|
284
285
|
const beforeRuntimeGlobals = next;
|
|
@@ -305,10 +306,10 @@ function generateModuleFirstGeaIrHeader(ir, irPath, context, options) {
|
|
|
305
306
|
'#include "../generated_support.hpp"',
|
|
306
307
|
usesReactiveRuntime ? '#include "gea/reactive_runtime.h"' : '',
|
|
307
308
|
generateCppIrAssetForwardDeclarations(ir),
|
|
308
|
-
generateCppIrSource(ir, irPath, context.modules, microtasksNamespace(options.pluginOptions)),
|
|
309
|
+
generateCppIrSource(ir, irPath, context.modules, microtasksNamespace(options.pluginOptions), true),
|
|
309
310
|
options.includeGeaDocumentRuntime ? generateHostDocumentNodeValueDeclaration() : '',
|
|
310
311
|
cppPreludeSource(options.pluginOptions),
|
|
311
|
-
generateCppIrNamespaceSource(ir, context.modules, { includeDomInterop: options.includeDomInterop }),
|
|
312
|
+
generateCppIrNamespaceSource(ir, context.modules, { includeDomInterop: options.includeDomInterop, directCanvas: true }),
|
|
312
313
|
].filter(Boolean).join('\n');
|
|
313
314
|
}
|
|
314
315
|
function insertModuleHeaderInclude(source, includeLine) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geastack/geatsc-plugin-gea",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"description": "Gea IR backend plugin for geatsc.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -53,7 +53,6 @@
|
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"typescript": ">=5.9.3",
|
|
56
|
-
"@geastack/compiler": ">=1.0.
|
|
57
|
-
}
|
|
58
|
-
"gitHead": "e375eddd8f725d7cc5de3fd46baca63e35936027"
|
|
56
|
+
"@geastack/compiler": ">=1.0.20"
|
|
57
|
+
}
|
|
59
58
|
}
|