@geastack/core 0.1.43 → 0.1.45
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/gea_app_entry.cpp
CHANGED
|
@@ -29,8 +29,17 @@ namespace gea::framework::app::generated {
|
|
|
29
29
|
void drainMicrotasks();
|
|
30
30
|
} // namespace gea::framework::app::generated
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
// Optional hooks a generated program defines weakly. A COFF linker cannot pair
|
|
33
|
+
// a weak reference with a weak definition (each names its own default), so a
|
|
34
|
+
// target that links a default for every such hook (lld-link /alternatename)
|
|
35
|
+
// sets GEA_LINKED_HOOK_DEFAULTS and the references become ordinary ones.
|
|
36
|
+
#if defined(GEA_LINKED_HOOK_DEFAULTS) && GEA_LINKED_HOOK_DEFAULTS
|
|
37
|
+
#define GEA_PROGRAM_HOOK
|
|
38
|
+
#else
|
|
39
|
+
#define GEA_PROGRAM_HOOK __attribute__((weak))
|
|
40
|
+
#endif
|
|
41
|
+
extern "C" void gea_cycle_collection_defer_begin() GEA_PROGRAM_HOOK;
|
|
42
|
+
extern "C" void gea_cycle_collection_defer_end() GEA_PROGRAM_HOOK;
|
|
34
43
|
extern "C" bool gea_embedded_assets_prepare() __attribute__((weak));
|
|
35
44
|
|
|
36
45
|
namespace gea::framework::app {
|
package/index.d.ts
CHANGED
|
@@ -1693,7 +1693,7 @@ export interface MagnetometerController {
|
|
|
1693
1693
|
close(): void
|
|
1694
1694
|
/** Number of board-defined sensors, whether open or closed. */
|
|
1695
1695
|
count(): number
|
|
1696
|
-
/**
|
|
1696
|
+
/** Board-defined sensor index, 0 to count() - 1. */
|
|
1697
1697
|
read(index: number): MagnetometerReading
|
|
1698
1698
|
}
|
|
1699
1699
|
export declare const Magnetometer: MagnetometerController
|
package/package.json
CHANGED
|
@@ -110,6 +110,12 @@ function readAllOptions(name) {
|
|
|
110
110
|
return values.filter(Boolean)
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
// The app's own Vite config: any of the names Vite itself looks for.
|
|
114
|
+
function appViteConfig(dir) {
|
|
115
|
+
const names = ['vite.config.ts', 'vite.config.mts', 'vite.config.mjs', 'vite.config.js']
|
|
116
|
+
return names.map((name) => path.join(dir, name)).find((file) => fs.existsSync(file)) ?? path.join(dir, names[0])
|
|
117
|
+
}
|
|
118
|
+
|
|
113
119
|
function fail(message) {
|
|
114
120
|
process.stderr.write(`${message}\n`)
|
|
115
121
|
process.exit(1)
|
|
@@ -491,9 +497,9 @@ function resolveAppleNativeAliasModules(appDir) {
|
|
|
491
497
|
// another target replaces with its own implementation.
|
|
492
498
|
// Each replacement names the app's STAGED copy when there is one: the compat
|
|
493
499
|
// build compiles the staged tree, so an alias into the app directory itself
|
|
494
|
-
// pulled a second copy of every module the replacement imports (
|
|
495
|
-
//
|
|
496
|
-
//
|
|
500
|
+
// pulled a second copy of every module the replacement imports (a game's
|
|
501
|
+
// board-specific index brought its own copy of a shared types module, and the
|
|
502
|
+
// two copies of one record type refused to convert).
|
|
497
503
|
function resolveAppModuleAliases(appDir, stagedAppDir = appDir) {
|
|
498
504
|
let manifest = {}
|
|
499
505
|
try {
|
|
@@ -580,7 +586,7 @@ function writeCompatViteConfig({ configPath, compatSrcDir, appDir, stagedAppDir,
|
|
|
580
586
|
// disambiguate, and — with all types erased — geatsc is forced to lower the
|
|
581
587
|
// whole reactive runtime dynamically (gea_cpp_value, ill-formed auto-vectors,
|
|
582
588
|
// proxy derefs). From source, everything is typed and lowers natively, exactly
|
|
583
|
-
// like
|
|
589
|
+
// like the third-party libraries an app imports. The env var still wins when explicitly set;
|
|
584
590
|
// otherwise follow ordinary package resolution, including hoisted installs.
|
|
585
591
|
const compilerRuntimeEntry = process.env.GEA_COMPILER_RUNTIME_SOURCE || resolveCompilerRuntimeEntry([appDir, coreRoot])
|
|
586
592
|
const compilerRuntimeAlias = compilerRuntimeEntry && fs.existsSync(compilerRuntimeEntry)
|
|
@@ -4479,7 +4485,7 @@ const moduleGraphOutDir = moduleGraphOutOption
|
|
|
4479
4485
|
: ''
|
|
4480
4486
|
let viteConfig = geaEmbeddedCompat
|
|
4481
4487
|
? path.join(outDir, 'gea-embedded-compat.vite.config.mjs')
|
|
4482
|
-
: path.resolve(readOption('--vite-config') ??
|
|
4488
|
+
: path.resolve(readOption('--vite-config') ?? appViteConfig(appDir))
|
|
4483
4489
|
const appleNativePluginSpecifier = path.resolve(readOption('--geatsc-apple-native-plugin') ?? tryResolve('@geastack/geatsc-plugin-apple-native'))
|
|
4484
4490
|
|
|
4485
4491
|
if (!geaEmbeddedCompat && !fs.existsSync(viteConfig)) fail(`missing Vite config: ${viteConfig}`)
|
|
@@ -4675,6 +4681,15 @@ const geatscArgs = [
|
|
|
4675
4681
|
`gea.native-signature-host-root=${process.env.GEA_HOST_DIR || path.resolve(coreRoot, '..', 'host')}`,
|
|
4676
4682
|
]
|
|
4677
4683
|
if (!moduleGraphCompile) geatscArgs.push('--target', 'cpp')
|
|
4684
|
+
// --project <tsconfig.json>: the TypeScript project the program means. Without
|
|
4685
|
+
// it the compiler reads modules under the project nearest its input, which for
|
|
4686
|
+
// an app whose sources live outside its package can be another package's
|
|
4687
|
+
// (resolving a type-only import to a different copy of a library).
|
|
4688
|
+
const projectOption = readOption('--project')
|
|
4689
|
+
if (projectOption) {
|
|
4690
|
+
if (!fs.existsSync(projectOption)) fail(`--project names a missing TypeScript project: ${projectOption}`)
|
|
4691
|
+
geatscArgs.push('--project', path.resolve(projectOption))
|
|
4692
|
+
}
|
|
4678
4693
|
if (moduleGraphCompile) {
|
|
4679
4694
|
geatscArgs.push('--entry', stagedEntryFile ?? path.join(appDir, entry), '--module-graph-stage', 'hybrid')
|
|
4680
4695
|
}
|
|
@@ -4711,9 +4726,20 @@ if (hasFlag('--gea-ir-backend') || hasFlag('--gea-replace-renderers')) {
|
|
|
4711
4726
|
// measurement scripts are always run with this
|
|
4712
4727
|
// limit; the build has to state the same one, not depend on the caller's
|
|
4713
4728
|
// NODE_OPTIONS.
|
|
4729
|
+
// GEA_GEATSC_MAX_OLD_SPACE_SIZE (MiB) lowers or raises that limit for a
|
|
4730
|
+
// machine with less memory to spare; a heap the analysis outgrows then fails
|
|
4731
|
+
// the build instead of exhausting the machine.
|
|
4714
4732
|
// Native interface call graphs can exceed V8's default ~1 MiB stack during
|
|
4715
4733
|
// closure analysis; keep the compiler stack below the host's 8 MiB limit.
|
|
4716
|
-
|
|
4734
|
+
const geatscHeapMiB = (() => {
|
|
4735
|
+
const stated = process.env.GEA_GEATSC_MAX_OLD_SPACE_SIZE
|
|
4736
|
+
if (stated === undefined || stated === '') return 32768
|
|
4737
|
+
const value = Number(stated)
|
|
4738
|
+
if (!Number.isInteger(value) || value < 512) fail(`GEA_GEATSC_MAX_OLD_SPACE_SIZE must be a whole number of MiB (at least 512): ${stated}`)
|
|
4739
|
+
return value
|
|
4740
|
+
})()
|
|
4741
|
+
const geatscNodeArgs = ['--stack_size=8192', `--max-old-space-size=${geatscHeapMiB}`]
|
|
4742
|
+
run('node', [...geatscNodeArgs, ...geatscArgs])
|
|
4717
4743
|
|
|
4718
4744
|
if (nativeModules.size) {
|
|
4719
4745
|
const nativeSources = []
|
|
@@ -4736,7 +4762,7 @@ if (nativeModules.size) {
|
|
|
4736
4762
|
]
|
|
4737
4763
|
if (cppBoard) moduleArgs.push('--cpp-board', cppBoard)
|
|
4738
4764
|
if (cxxStandard) moduleArgs.push('--cxx-standard', cxxStandard)
|
|
4739
|
-
run('node', [
|
|
4765
|
+
run('node', [...geatscNodeArgs, ...moduleArgs])
|
|
4740
4766
|
const list = fs.readFileSync(path.join(moduleOut, 'geatsc-sources.txt'), 'utf8').split(/\r?\n/).filter(Boolean)
|
|
4741
4767
|
nativeSources.push(...list.filter((source) => path.basename(source) !== 'gea_runtime_builtins.cpp'))
|
|
4742
4768
|
}
|
|
@@ -91,7 +91,10 @@ export function geaThreeModuleAliases(options = {}) {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
export function geaModuleGraphPlugins(options = {}) {
|
|
94
|
-
|
|
94
|
+
// A build driver (build-gea-vite-geatsc.mjs) states where it reads the graph
|
|
95
|
+
// through GEA_VITE_MODULE_GRAPH_OUT; that wins over the location an app's own
|
|
96
|
+
// Vite config names for its standalone runs.
|
|
97
|
+
const outDir = process.env.GEA_VITE_MODULE_GRAPH_OUT || options.outDir || ''
|
|
95
98
|
if (!outDir) return []
|
|
96
99
|
|
|
97
100
|
const state = {
|