mirror of
https://github.com/luxfi/wallet.git
synced 2026-10-30 15:13:19 +00:00
The first pass left three classes of config that BOTH tsc 5.9 and tsc 7
reject. Each was proven against both compilers before changing:
TS5090 A `paths` target must be relative once `baseUrl` is gone. The
first pass skipped the "./" prefix wherever baseUrl pointed at
the config's own directory, reasoning it was semantically
equivalent. It is not — without baseUrl a non-relative target
is rejected outright, by 5.9 as well as 7.
TS5110 `moduleResolution: node16` requires `module: node16`. The first
pass mapped commonjs projects to node16 resolution alone, which
BROKE those configs for the current toolchain. Both are now set.
TS5102 `downlevelIteration` is also removed in TS7; it was missing from
the dead-flag list.
Verified: repos that tsc 7 previously refused (base-studio, js-sdk, kv-js)
now report zero config errors on tsc 7 AND tsc 5.9.
Co-Authored-By: Hanzo Dev <[email protected]>
Maestro Performance Scripts
This directory contains TypeScript scripts for tracking performance metrics in Maestro E2E tests. The scripts are compiled to GraalJS-compatible JavaScript for execution within Maestro's runtime environment.
Architecture
Source Files (src/)
- actions/ - Individual action scripts executed by Maestro YAML flows
init-tracking.ts- Initialize performance tracking sessionstart-flow.ts- Mark the beginning of a test flowend-flow.ts- Mark the end of a test flowstart-sub-flow.ts- Mark the beginning of a sub-flowend-sub-flow.ts- Mark the end of a sub-flowtrack-action.ts- Track individual UI actions
- utils/ - Shared utility functions
bufferMetric.ts- Buffer metrics for batch uploademitMetric.ts- Emit metrics to consolegetTimestamp.ts- Timestamp utilitiesmetricCreators.ts- Factory functions for creating metricsvalidateEnv.ts- Environment variable validation
- types.ts - TypeScript type definitions
- globals.d.ts - Global type declarations for Maestro environment
Compiled Files (dist/)
Generated JavaScript files optimized for GraalJS ES2020 runtime.
Build System
GraalJS Compilation
The build system compiles TypeScript to GraalJS-compatible JavaScript:
- Target: ES2020 (fully supported by GraalJS)
- Module System: None (GraalJS uses global scope)
- Optimizations:
- Removes all module imports/exports
- Inlines utility functions
- Wraps in IIFE for isolation
- Removes TypeScript-specific constructs
Build Commands
# Install dependencies
npm install
# Build for GraalJS
npm run build
# Watch mode for development
npm run build:watch
# Clean build directory
npm run clean
# Full rebuild
npm run rebuild
# Type checking only
npm run typecheck
GraalJS Compatibility
Supported Features
- ES2020 syntax (async/await, optional chaining, etc.)
- JSON operations
- Date and Math objects
- Console logging
- Global variables
Limitations
- No ES modules (import/export)
- No Node.js APIs
- No npm packages
- Limited to Maestro-provided globals
Maestro Integration
Global Variables
Maestro provides these globals at runtime:
output- Persistent state between script runsFLOW_NAME,SUB_FLOW_NAME,ACTION,TARGET,PHASE- Environment variables
Usage in YAML
- runScript:
file: .maestro/scripts/performance/dist/actions/init-tracking.js
- runScript:
file: .maestro/scripts/performance/dist/actions/start-flow.js
env:
FLOW_NAME: swap
- tapOn: "Swap Button"
- runScript:
file: .maestro/scripts/performance/dist/actions/track-action.js
env:
ACTION: tap
TARGET: "Swap Button"
PHASE: end
- runScript:
file: .maestro/scripts/performance/dist/actions/end-flow.js
env:
FLOW_NAME: swap
Metrics Format
Metrics follow this structure:
interface Metric {
timestamp: number
platform: string
testRunId: string
// Additional fields based on metric type
}
Development Workflow
- Edit TypeScript files in
src/ - Run build to compile to GraalJS
- Test locally with Maestro
- Commit both source and dist files
Troubleshooting
Compilation Errors
- Ensure no ES module syntax in source files
- Check for Node.js-specific APIs
- Verify TypeScript version compatibility
Runtime Errors
- Check Maestro console output
- Verify global variables are defined
- Ensure scripts are in correct order
Performance Issues
- Minimize JSON operations
- Avoid large string concatenations
- Keep metrics buffer reasonable size