@typecad/cuttlefish 1.0.0-alpha.3 → 1.0.0-alpha.7
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/README.md +4 -4
- package/dist/api/shared/display-adapter.d.ts +2 -1
- package/dist/api/shared/display-adapter.js +8 -1
- package/dist/api/shared/display-adapters/sdl.js +9 -2
- package/dist/api/shared/display-profile.d.ts +20 -3
- package/dist/api/shared/display-profile.js +21 -6
- package/dist/api/shared/framework-manifest-registry.d.ts +9 -0
- package/dist/api/shared/framework-manifest-registry.js +25 -0
- package/dist/api/shared/framework-manifest.d.ts +462 -0
- package/dist/api/shared/framework-manifest.js +149 -0
- package/dist/api/shared/glcdfont.d.ts +12 -0
- package/dist/api/shared/glcdfont.js +124 -0
- package/dist/api/shared/graphics-strategy.d.ts +28 -0
- package/dist/api/shared/hal-op-ir.d.ts +427 -1
- package/dist/api/shared/hal-op-ir.js +95 -1
- package/dist/api/shared/index.d.ts +11 -1
- package/dist/api/shared/index.js +14 -0
- package/dist/api/shared/native-display-op-resolver.d.ts +10 -0
- package/dist/api/shared/native-display-op-resolver.js +64 -0
- package/dist/api/shared/platform-strategy.d.ts +9 -0
- package/dist/api/shared/promise-runtime.js +78 -0
- package/dist/api/shared/types.d.ts +8 -0
- package/dist/api/shared/validate-framework-manifest.d.ts +28 -0
- package/dist/api/shared/validate-framework-manifest.js +417 -0
- package/dist/cli-utils.d.ts +1 -0
- package/dist/cli-utils.js +3 -1
- package/dist/cli.js +175 -4
- package/dist/config-loader.js +20 -1
- package/dist/config-schema.d.ts +36 -36
- package/dist/create/board-spec.d.ts +4 -4
- package/dist/create/index.d.ts +1 -1
- package/dist/create/index.js +1 -1
- package/dist/create/init-scaffold.d.ts +3 -0
- package/dist/create/init-scaffold.js +74 -2
- package/dist/create/init-templates.d.ts +4 -0
- package/dist/create/init-templates.js +217 -17
- package/dist/create/init-wizard.js +20 -1
- package/dist/emit/cpp-emitter.js +4 -3
- package/dist/emit/emitters/emitter-context.d.ts +5 -0
- package/dist/emit/emitters/function-emitter-impl.js +69 -59
- package/dist/emit/emitters/output-finalizer.d.ts +6 -0
- package/dist/emit/emitters/output-finalizer.js +21 -11
- package/dist/emit/emitters/setup.js +155 -0
- package/dist/emit/emitters/top-level-prep.js +2 -0
- package/dist/emit/emitters/ui-emitter.js +23 -8
- package/dist/emit/expression-renderer.js +10 -1
- package/dist/emit/snprintf-helpers.js +8 -0
- package/dist/emit/statement-renderer.js +13 -0
- package/dist/emit/utils/async-state-machine.js +185 -116
- package/dist/emit/utils/hal-op-cpp-type.d.ts +6 -0
- package/dist/emit/utils/hal-op-cpp-type.js +40 -0
- package/dist/ir/adc-range-validation.js +26 -25
- package/dist/ir/build-ir.js +5 -1
- package/dist/ir/expression-to-ir.js +57 -6
- package/dist/ir/feature-registry.js +7 -25
- package/dist/ir/hal/hal-emitter.d.ts +5 -2
- package/dist/ir/hal/hal-emitter.js +40 -12
- package/dist/ir/hal/hal-parser.d.ts +6 -0
- package/dist/ir/hal/hal-parser.js +74 -0
- package/dist/ir/hal/hal-plugins.js +571 -0
- package/dist/ir/identifier-collector.js +18 -0
- package/dist/ir/interrupt-analysis.js +8 -3
- package/dist/ir/memory-budget-validation.js +1 -0
- package/dist/ir/network-validation.d.ts +4 -0
- package/dist/ir/network-validation.js +184 -0
- package/dist/ir/ownership-analysis.js +33 -1
- package/dist/ir/peripheral-ownership.js +5 -0
- package/dist/ir/peripheral-validation.d.ts +1 -1
- package/dist/ir/peripheral-validation.js +6 -3
- package/dist/ir/pin-alias-conflict.d.ts +1 -1
- package/dist/ir/pin-alias-conflict.js +2 -1
- package/dist/ir/pin-capability-validation.js +34 -32
- package/dist/ir/pin-mode-validation.js +5 -0
- package/dist/ir/pin-safety.d.ts +1 -1
- package/dist/ir/pin-safety.js +2 -1
- package/dist/ir/program-analysis.d.ts +39 -0
- package/dist/ir/program-analysis.js +192 -0
- package/dist/ir/pulldown-validation.d.ts +1 -1
- package/dist/ir/pulldown-validation.js +2 -1
- package/dist/ir/pwm-timer-sharing.d.ts +1 -1
- package/dist/ir/pwm-timer-sharing.js +2 -1
- package/dist/ir/resource-analysis.js +2 -0
- package/dist/ir/timer0-pwm-timing-conflict.d.ts +1 -1
- package/dist/ir/timer0-pwm-timing-conflict.js +2 -1
- package/dist/ir/timing-validation.d.ts +6 -1
- package/dist/ir/timing-validation.js +51 -12
- package/dist/ir/transformers/expressions.js +58 -0
- package/dist/ir/transformers/hal-emit-helpers.js +1 -1
- package/dist/ir/transformers/variables.js +86 -19
- package/dist/ir/try-catch-validation.js +2 -0
- package/dist/ir/type-resolution.js +2 -2
- package/dist/ir/unit-suspicion-validation.js +9 -7
- package/dist/ir/validation-orchestrator.js +9 -7
- package/dist/libdef/c-to-decl.d.ts +27 -0
- package/dist/libdef/c-to-decl.js +397 -0
- package/dist/libdef/component-decls.d.ts +2 -0
- package/dist/libdef/component-decls.js +6 -0
- package/dist/libdef/component-discovery.d.ts +43 -0
- package/dist/libdef/component-discovery.js +83 -0
- package/dist/libdef/cpp-to-decl.d.ts +9 -0
- package/dist/libdef/cpp-to-decl.js +72 -0
- package/dist/libdef/idf-discovery.d.ts +7 -0
- package/dist/libdef/idf-discovery.js +59 -0
- package/dist/libdef/registry.js +5 -2
- package/dist/licenses.d.ts +185 -0
- package/dist/licenses.js +963 -0
- package/dist/lint-cache.d.ts +59 -0
- package/dist/lint-cache.js +257 -0
- package/dist/orchestrator/graph-builder.js +6 -2
- package/dist/stores/display-profile-store.d.ts +1 -0
- package/dist/stores/display-profile-store.js +1 -0
- package/dist/testing.d.ts +4 -2
- package/dist/testing.js +4 -2
- package/dist/transpile.d.ts +3 -0
- package/dist/transpile.js +78 -32
- package/dist/types.d.ts +5 -1
- package/dist/ui-hook.d.ts +17 -1
- package/dist/utils/cli.js +71 -1
- package/dist/utils/fs.d.ts +13 -0
- package/dist/utils/fs.js +50 -0
- package/package.json +9 -4
- package/dist/ir/heap-array-validation.d.ts +0 -24
- package/dist/ir/heap-array-validation.js +0 -29
package/README.md
CHANGED
|
@@ -12,15 +12,15 @@ C++, and can chain compile, upload, and serial-monitor steps.
|
|
|
12
12
|
From a project root containing `cuttlefish.config.ts`:
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
npx cuttlefish build
|
|
16
|
-
npx cuttlefish build --compile --upload --port COM4
|
|
17
|
-
npx cuttlefish build --compile --upload --monitor --port COM4 --baud 115200
|
|
15
|
+
npx @typecad/cuttlefish build
|
|
16
|
+
npx @typecad/cuttlefish build --compile --upload --port COM4
|
|
17
|
+
npx @typecad/cuttlefish build --compile --upload --monitor --port COM4 --baud 115200
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
Scaffold a starter project with the built-in wizard:
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
npx cuttlefish create --board arduino:avr:uno --framework arduino
|
|
23
|
+
npx @typecad/cuttlefish create --board arduino:avr:uno --framework arduino
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
## Commands
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ResolvedDisplay } from "./display-profile.js";
|
|
2
|
+
import type { PlatformStrategy } from "./platform-strategy.js";
|
|
2
3
|
export interface DisplayAdapterCode {
|
|
3
4
|
/** C++ #include lines (e.g. "#include <Adafruit_ILI9341.h>"). */
|
|
4
5
|
includes: string;
|
|
@@ -9,4 +10,4 @@ export interface DisplayAdapterCode {
|
|
|
9
10
|
}
|
|
10
11
|
export type DisplayAdapterGenerator = (display: ResolvedDisplay) => DisplayAdapterCode;
|
|
11
12
|
export declare function registerDisplayAdapter(driver: string, gen: DisplayAdapterGenerator): void;
|
|
12
|
-
export declare function generateDisplayAdapter(display: ResolvedDisplay): DisplayAdapterCode;
|
|
13
|
+
export declare function generateDisplayAdapter(display: ResolvedDisplay, strategy?: Pick<PlatformStrategy, "providesDisplayAdapter" | "resolveDisplayAdapter">): DisplayAdapterCode;
|
|
@@ -14,7 +14,14 @@ const adapters = new Map();
|
|
|
14
14
|
export function registerDisplayAdapter(driver, gen) {
|
|
15
15
|
adapters.set(driver, gen);
|
|
16
16
|
}
|
|
17
|
-
export function generateDisplayAdapter(display) {
|
|
17
|
+
export function generateDisplayAdapter(display, strategy) {
|
|
18
|
+
// Strategy-owned adapters (AVR, ESP32) take precedence. Falls through to
|
|
19
|
+
// the built-in Adafruit registry for Arduino.
|
|
20
|
+
if (strategy?.providesDisplayAdapter?.() && strategy.resolveDisplayAdapter) {
|
|
21
|
+
const code = strategy.resolveDisplayAdapter(display);
|
|
22
|
+
if (code)
|
|
23
|
+
return code;
|
|
24
|
+
}
|
|
18
25
|
const driver = display.driver;
|
|
19
26
|
const gen = adapters.get(driver);
|
|
20
27
|
if (!gen) {
|
|
@@ -366,8 +366,15 @@ function glcdfontBytes() {
|
|
|
366
366
|
}
|
|
367
367
|
return lines;
|
|
368
368
|
}
|
|
369
|
-
//
|
|
370
|
-
//
|
|
369
|
+
// Adafruit GFX 5x7 glcdfont — the 'classic' fixed-space bitmap font shipped
|
|
370
|
+
// with Adafruit_GFX since 1.0. BSD-3-Clause as part of the Adafruit_GFX
|
|
371
|
+
// library (the file carries no per-file license statement; an earlier
|
|
372
|
+
// revision of this comment claimed "public domain" but that could not be
|
|
373
|
+
// verified). See packages/cuttlefish/src/api/shared/glcdfont.ts for the
|
|
374
|
+
// canonical attribution header; this array is the same bytes, retained
|
|
375
|
+
// here to keep the SDL preview self-contained.
|
|
376
|
+
// Source: Adafruit_GFX library glcdfont.c
|
|
377
|
+
// Upstream: https://github.com/adafruit/Adafruit-GFX-Library/blob/master/glcdfont.c
|
|
371
378
|
const GLCDFONT_BYTES = [
|
|
372
379
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x5b, 0x4f, 0x5b, 0x3e, 0x3e, 0x6b, 0x4f, 0x6b, 0x3e, 0x1c,
|
|
373
380
|
0x3e, 0x7c, 0x3e, 0x1c, 0x18, 0x3c, 0x7e, 0x3c, 0x18, 0x1c, 0x57, 0x7d, 0x57, 0x1c, 0x1c, 0x5e,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DisplayCapabilities } from "./display-capabilities.js";
|
|
2
|
-
export type TouchLibrary = "XPT2046_Touchscreen" | "Adafruit_TouchScreen" | "Adafruit_STMPE610" | "FT6336U" | "sdl";
|
|
2
|
+
export type TouchLibrary = "XPT2046_Touchscreen" | "Adafruit_TouchScreen" | "Adafruit_STMPE610" | "FT6336U" | "GT911" | "CST816S" | "sdl";
|
|
3
3
|
export interface TouchProfile {
|
|
4
4
|
/**
|
|
5
5
|
* Either a built-in library name OR a path to a custom TypeScript adapter
|
|
@@ -108,6 +108,10 @@ export interface ResolvedDisplay extends DisplayProfile {
|
|
|
108
108
|
/** Arduino FQBN (e.g. "esp32:esp32:esp32s3:PSRAM=opi"), used to derive PSRAM
|
|
109
109
|
* availability for the scroll-canvas-memory budget. Optional. */
|
|
110
110
|
_buildTarget?: string;
|
|
111
|
+
/** Explicit PSRAM flag from frameworkData.psram (IDF path). When true, the
|
|
112
|
+
* scroll-canvas-memory diagnostic uses the PSRAM budget instead of the
|
|
113
|
+
* SRAM default. Falls back to buildTargetHasPsram(_buildTarget) when unset. */
|
|
114
|
+
_psram?: boolean;
|
|
111
115
|
}
|
|
112
116
|
export interface DisplayConfig {
|
|
113
117
|
profile?: string;
|
|
@@ -243,6 +247,7 @@ export declare function resolveScrollConfig(display: {
|
|
|
243
247
|
scroll?: ScrollConfig;
|
|
244
248
|
}, ctx?: {
|
|
245
249
|
buildTarget?: string;
|
|
250
|
+
psram?: boolean;
|
|
246
251
|
}): ResolvedScrollConfig;
|
|
247
252
|
export declare function resolveDisplayProfile(config: DisplayConfig, registry: Map<string, DisplayProfile>): {
|
|
248
253
|
profile: DisplayProfile;
|
|
@@ -261,5 +266,17 @@ export interface TouchAdapterCodegen {
|
|
|
261
266
|
/** C++ static inline shim functions: touch_init, touch_isTouched, touch_readRaw. */
|
|
262
267
|
functions: string;
|
|
263
268
|
}
|
|
264
|
-
/** Generate C++ code for a built-in touch library adapter.
|
|
265
|
-
|
|
269
|
+
/** Generate C++ code for a built-in touch library adapter.
|
|
270
|
+
*
|
|
271
|
+
* Strategy-owned touch adapters (ESP32 native) take precedence: when the
|
|
272
|
+
* strategy's `providesTouchAdapter()` returns true and `resolveTouchAdapter`
|
|
273
|
+
* returns non-null, that codegen wins. Otherwise falls through to the
|
|
274
|
+
* built-in library switch below (the Arduino path, unchanged).
|
|
275
|
+
*
|
|
276
|
+
* Passing `undefined` for the strategy (or a strategy that doesn't provide
|
|
277
|
+
* touch adapters) keeps the historical behavior — the Arduino library switch.
|
|
278
|
+
*/
|
|
279
|
+
export declare function generateTouchAdapter(touch: TouchProfile, strategy?: {
|
|
280
|
+
providesTouchAdapter?(): boolean;
|
|
281
|
+
resolveTouchAdapter?(touch: TouchProfile): TouchAdapterCodegen | undefined;
|
|
282
|
+
}): TouchAdapterCodegen;
|
|
@@ -72,10 +72,11 @@ export function resolveScrollConfig(display, ctx) {
|
|
|
72
72
|
? "capacitive"
|
|
73
73
|
: "none";
|
|
74
74
|
// PSRAM-aware canvas budget: an explicit override always wins; otherwise use
|
|
75
|
-
// the PSRAM budget when the
|
|
76
|
-
//
|
|
77
|
-
//
|
|
78
|
-
|
|
75
|
+
// the PSRAM budget when the target opts into PSRAM — either via an explicit
|
|
76
|
+
// frameworkData.psram flag (IDF path) or an Arduino FQBN PSRAM= option — so
|
|
77
|
+
// the scroll-canvas-memory diagnostic doesn't emit stale warnings for canvases
|
|
78
|
+
// the runtime allocates in external RAM without issue. Else the SRAM default.
|
|
79
|
+
const psramBudget = ctx?.psram === true || buildTargetHasPsram(ctx?.buildTarget);
|
|
79
80
|
const budgetDefault = psramBudget
|
|
80
81
|
? PSRAM_SCROLL_CANVAS_BUDGET_BYTES
|
|
81
82
|
: DEFAULT_SCROLL_CANVAS_BUDGET_BYTES;
|
|
@@ -176,8 +177,22 @@ export function resolveDisplayProfile(config, registry) {
|
|
|
176
177
|
reset: config.reset ?? -1,
|
|
177
178
|
};
|
|
178
179
|
}
|
|
179
|
-
/** Generate C++ code for a built-in touch library adapter.
|
|
180
|
-
|
|
180
|
+
/** Generate C++ code for a built-in touch library adapter.
|
|
181
|
+
*
|
|
182
|
+
* Strategy-owned touch adapters (ESP32 native) take precedence: when the
|
|
183
|
+
* strategy's `providesTouchAdapter()` returns true and `resolveTouchAdapter`
|
|
184
|
+
* returns non-null, that codegen wins. Otherwise falls through to the
|
|
185
|
+
* built-in library switch below (the Arduino path, unchanged).
|
|
186
|
+
*
|
|
187
|
+
* Passing `undefined` for the strategy (or a strategy that doesn't provide
|
|
188
|
+
* touch adapters) keeps the historical behavior — the Arduino library switch.
|
|
189
|
+
*/
|
|
190
|
+
export function generateTouchAdapter(touch, strategy) {
|
|
191
|
+
if (strategy?.providesTouchAdapter?.() && strategy.resolveTouchAdapter) {
|
|
192
|
+
const code = strategy.resolveTouchAdapter(touch);
|
|
193
|
+
if (code)
|
|
194
|
+
return code;
|
|
195
|
+
}
|
|
181
196
|
const cs = touch.cs ?? 0;
|
|
182
197
|
const irq = touch.irq;
|
|
183
198
|
if (touch.library === "XPT2046_Touchscreen") {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FrameworkManifest } from './framework-manifest.js';
|
|
2
|
+
export declare const KNOWN_FRAMEWORK_PACKAGES: readonly ["@typecad/framework-arduino", "@typecad/framework-avr", "@typecad/framework-esp32"];
|
|
3
|
+
export type KnownFrameworkPackage = typeof KNOWN_FRAMEWORK_PACKAGES[number];
|
|
4
|
+
/**
|
|
5
|
+
* Loads a framework's manifest via its `./framework.manifest` subpath export.
|
|
6
|
+
* Throws if the package does not export that subpath or the export has no
|
|
7
|
+
* default value.
|
|
8
|
+
*/
|
|
9
|
+
export declare function loadFrameworkManifest(packageName: string): Promise<FrameworkManifest>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Framework manifest discovery
|
|
3
|
+
//
|
|
4
|
+
// KNOWN_FRAMEWORK_PACKAGES is the authoritative list of framework packages.
|
|
5
|
+
// Add a new framework here when it ships. loadFrameworkManifest uses the
|
|
6
|
+
// "./framework.manifest" subpath export each framework declares in its
|
|
7
|
+
// package.json.
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
export const KNOWN_FRAMEWORK_PACKAGES = [
|
|
10
|
+
'@typecad/framework-arduino',
|
|
11
|
+
'@typecad/framework-avr',
|
|
12
|
+
'@typecad/framework-esp32',
|
|
13
|
+
];
|
|
14
|
+
/**
|
|
15
|
+
* Loads a framework's manifest via its `./framework.manifest` subpath export.
|
|
16
|
+
* Throws if the package does not export that subpath or the export has no
|
|
17
|
+
* default value.
|
|
18
|
+
*/
|
|
19
|
+
export async function loadFrameworkManifest(packageName) {
|
|
20
|
+
const mod = await import(/* @vite-ignore */ `${packageName}/framework.manifest`);
|
|
21
|
+
if (!mod.default) {
|
|
22
|
+
throw new Error(`Package ${packageName} does not export a default manifest from "./framework.manifest".`);
|
|
23
|
+
}
|
|
24
|
+
return mod.default;
|
|
25
|
+
}
|
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
declare const HAL_CATEGORIES: readonly ["gpio", "pwm", "adc", "dac", "interrupts", "tone", "timing", "power", "i2c", "spi", "uart", "pulse", "shift", "board", "wdt", "wifi", "http", "display"];
|
|
3
|
+
export type HalCategory = typeof HAL_CATEGORIES[number];
|
|
4
|
+
export declare const FrameworkManifestSchema: z.ZodObject<{
|
|
5
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
6
|
+
frameworkId: z.ZodString;
|
|
7
|
+
packageName: z.ZodString;
|
|
8
|
+
canonical: z.ZodDefault<z.ZodBoolean>;
|
|
9
|
+
displayName: z.ZodString;
|
|
10
|
+
description: z.ZodString;
|
|
11
|
+
basedOn: z.ZodOptional<z.ZodString>;
|
|
12
|
+
implementationMode: z.ZodEnum<["from-scratch", "extends-canonical", "extends-other"]>;
|
|
13
|
+
inheritsStrategyId: z.ZodOptional<z.ZodString>;
|
|
14
|
+
entrypoint: z.ZodObject<{
|
|
15
|
+
entrypointFunctionName: z.ZodString;
|
|
16
|
+
requiresLoopFunction: z.ZodBoolean;
|
|
17
|
+
sourceExtension: z.ZodEnum<["ino", "cc", "cpp", "h"]>;
|
|
18
|
+
overrideBaseName: z.ZodOptional<z.ZodString>;
|
|
19
|
+
outputSubdirectory: z.ZodOptional<z.ZodString>;
|
|
20
|
+
generateHeaderFile: z.ZodBoolean;
|
|
21
|
+
customBridgeShim: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
sourceExtension: "cpp" | "ino" | "cc" | "h";
|
|
24
|
+
entrypointFunctionName: string;
|
|
25
|
+
requiresLoopFunction: boolean;
|
|
26
|
+
generateHeaderFile: boolean;
|
|
27
|
+
overrideBaseName?: string | undefined;
|
|
28
|
+
outputSubdirectory?: string | undefined;
|
|
29
|
+
customBridgeShim?: string | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
sourceExtension: "cpp" | "ino" | "cc" | "h";
|
|
32
|
+
entrypointFunctionName: string;
|
|
33
|
+
requiresLoopFunction: boolean;
|
|
34
|
+
generateHeaderFile: boolean;
|
|
35
|
+
overrideBaseName?: string | undefined;
|
|
36
|
+
outputSubdirectory?: string | undefined;
|
|
37
|
+
customBridgeShim?: string | undefined;
|
|
38
|
+
}>;
|
|
39
|
+
profile: z.ZodObject<{
|
|
40
|
+
targets: z.ZodArray<z.ZodString, "many">;
|
|
41
|
+
forcedIncludes: z.ZodArray<z.ZodString, "many">;
|
|
42
|
+
symbolAliases: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
forcedIncludes: string[];
|
|
45
|
+
symbolAliases: Record<string, string>;
|
|
46
|
+
targets: string[];
|
|
47
|
+
}, {
|
|
48
|
+
forcedIncludes: string[];
|
|
49
|
+
symbolAliases: Record<string, string>;
|
|
50
|
+
targets: string[];
|
|
51
|
+
}>;
|
|
52
|
+
hal: z.ZodObject<{
|
|
53
|
+
[x: string]: z.ZodObject<{
|
|
54
|
+
supported: z.ZodBoolean;
|
|
55
|
+
unsupportedReason: z.ZodOptional<z.ZodString>;
|
|
56
|
+
ops: z.ZodRecord<z.ZodString, z.ZodEnum<["supported", "stub", "unsupported", "probe-inconclusive", "polyfill"]>>;
|
|
57
|
+
partialCoverage: z.ZodDefault<z.ZodBoolean>;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
supported: boolean;
|
|
60
|
+
ops: Record<string, "stub" | "polyfill" | "supported" | "unsupported" | "probe-inconclusive">;
|
|
61
|
+
partialCoverage: boolean;
|
|
62
|
+
unsupportedReason?: string | undefined;
|
|
63
|
+
}, {
|
|
64
|
+
supported: boolean;
|
|
65
|
+
ops: Record<string, "stub" | "polyfill" | "supported" | "unsupported" | "probe-inconclusive">;
|
|
66
|
+
unsupportedReason?: string | undefined;
|
|
67
|
+
partialCoverage?: boolean | undefined;
|
|
68
|
+
}>;
|
|
69
|
+
} & {
|
|
70
|
+
raw: z.ZodDefault<z.ZodObject<{
|
|
71
|
+
supported: z.ZodBoolean;
|
|
72
|
+
}, "strip", z.ZodTypeAny, {
|
|
73
|
+
supported: boolean;
|
|
74
|
+
}, {
|
|
75
|
+
supported: boolean;
|
|
76
|
+
}>>;
|
|
77
|
+
}, "strip", z.ZodTypeAny, {
|
|
78
|
+
[x: string]: {
|
|
79
|
+
supported: boolean;
|
|
80
|
+
ops: Record<string, "stub" | "polyfill" | "supported" | "unsupported" | "probe-inconclusive">;
|
|
81
|
+
partialCoverage: boolean;
|
|
82
|
+
unsupportedReason?: string | undefined;
|
|
83
|
+
};
|
|
84
|
+
raw?: unknown;
|
|
85
|
+
}, {
|
|
86
|
+
[x: string]: {
|
|
87
|
+
supported: boolean;
|
|
88
|
+
ops: Record<string, "stub" | "polyfill" | "supported" | "unsupported" | "probe-inconclusive">;
|
|
89
|
+
unsupportedReason?: string | undefined;
|
|
90
|
+
partialCoverage?: boolean | undefined;
|
|
91
|
+
};
|
|
92
|
+
raw?: unknown;
|
|
93
|
+
}>;
|
|
94
|
+
polyfills: z.ZodObject<{
|
|
95
|
+
emitted: z.ZodArray<z.ZodObject<{
|
|
96
|
+
id: z.ZodString;
|
|
97
|
+
domain: z.ZodString;
|
|
98
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
99
|
+
}, "strip", z.ZodTypeAny, {
|
|
100
|
+
id: string;
|
|
101
|
+
domain: string;
|
|
102
|
+
notes?: string | undefined;
|
|
103
|
+
}, {
|
|
104
|
+
id: string;
|
|
105
|
+
domain: string;
|
|
106
|
+
notes?: string | undefined;
|
|
107
|
+
}>, "many">;
|
|
108
|
+
suppressed: z.ZodArray<z.ZodObject<{
|
|
109
|
+
id: z.ZodString;
|
|
110
|
+
reason: z.ZodString;
|
|
111
|
+
}, "strip", z.ZodTypeAny, {
|
|
112
|
+
id: string;
|
|
113
|
+
reason: string;
|
|
114
|
+
}, {
|
|
115
|
+
id: string;
|
|
116
|
+
reason: string;
|
|
117
|
+
}>, "many">;
|
|
118
|
+
}, "strip", z.ZodTypeAny, {
|
|
119
|
+
emitted: {
|
|
120
|
+
id: string;
|
|
121
|
+
domain: string;
|
|
122
|
+
notes?: string | undefined;
|
|
123
|
+
}[];
|
|
124
|
+
suppressed: {
|
|
125
|
+
id: string;
|
|
126
|
+
reason: string;
|
|
127
|
+
}[];
|
|
128
|
+
}, {
|
|
129
|
+
emitted: {
|
|
130
|
+
id: string;
|
|
131
|
+
domain: string;
|
|
132
|
+
notes?: string | undefined;
|
|
133
|
+
}[];
|
|
134
|
+
suppressed: {
|
|
135
|
+
id: string;
|
|
136
|
+
reason: string;
|
|
137
|
+
}[];
|
|
138
|
+
}>;
|
|
139
|
+
toolchain: z.ZodObject<{
|
|
140
|
+
backend: z.ZodString;
|
|
141
|
+
operations: z.ZodObject<{
|
|
142
|
+
prepare: z.ZodBoolean;
|
|
143
|
+
compile: z.ZodBoolean;
|
|
144
|
+
upload: z.ZodBoolean;
|
|
145
|
+
monitor: z.ZodBoolean;
|
|
146
|
+
}, "strip", z.ZodTypeAny, {
|
|
147
|
+
prepare: boolean;
|
|
148
|
+
compile: boolean;
|
|
149
|
+
upload: boolean;
|
|
150
|
+
monitor: boolean;
|
|
151
|
+
}, {
|
|
152
|
+
prepare: boolean;
|
|
153
|
+
compile: boolean;
|
|
154
|
+
upload: boolean;
|
|
155
|
+
monitor: boolean;
|
|
156
|
+
}>;
|
|
157
|
+
reexportedFrom: z.ZodOptional<z.ZodString>;
|
|
158
|
+
}, "strip", z.ZodTypeAny, {
|
|
159
|
+
backend: string;
|
|
160
|
+
operations: {
|
|
161
|
+
prepare: boolean;
|
|
162
|
+
compile: boolean;
|
|
163
|
+
upload: boolean;
|
|
164
|
+
monitor: boolean;
|
|
165
|
+
};
|
|
166
|
+
reexportedFrom?: string | undefined;
|
|
167
|
+
}, {
|
|
168
|
+
backend: string;
|
|
169
|
+
operations: {
|
|
170
|
+
prepare: boolean;
|
|
171
|
+
compile: boolean;
|
|
172
|
+
upload: boolean;
|
|
173
|
+
monitor: boolean;
|
|
174
|
+
};
|
|
175
|
+
reexportedFrom?: string | undefined;
|
|
176
|
+
}>;
|
|
177
|
+
libraryResolution: z.ZodOptional<z.ZodObject<{
|
|
178
|
+
isFrameworkLibraryImport: z.ZodBoolean;
|
|
179
|
+
getFrameworkLibraryHeaderName: z.ZodBoolean;
|
|
180
|
+
buildClassNameMap: z.ZodBoolean;
|
|
181
|
+
tryGenerateLibDecl: z.ZodBoolean;
|
|
182
|
+
reexportedFrom: z.ZodOptional<z.ZodString>;
|
|
183
|
+
}, "strip", z.ZodTypeAny, {
|
|
184
|
+
isFrameworkLibraryImport: boolean;
|
|
185
|
+
getFrameworkLibraryHeaderName: boolean;
|
|
186
|
+
buildClassNameMap: boolean;
|
|
187
|
+
tryGenerateLibDecl: boolean;
|
|
188
|
+
reexportedFrom?: string | undefined;
|
|
189
|
+
}, {
|
|
190
|
+
isFrameworkLibraryImport: boolean;
|
|
191
|
+
getFrameworkLibraryHeaderName: boolean;
|
|
192
|
+
buildClassNameMap: boolean;
|
|
193
|
+
tryGenerateLibDecl: boolean;
|
|
194
|
+
reexportedFrom?: string | undefined;
|
|
195
|
+
}>>;
|
|
196
|
+
typeEmission: z.ZodObject<{
|
|
197
|
+
normalizeCppType: z.ZodBoolean;
|
|
198
|
+
mathHeader: z.ZodEnum<["none", "<math.h>", "<Arduino.h>"]>;
|
|
199
|
+
needsStdString: z.ZodBoolean;
|
|
200
|
+
needsStdVector: z.ZodBoolean;
|
|
201
|
+
needsIostream: z.ZodBoolean;
|
|
202
|
+
needsStdFunction: z.ZodBoolean;
|
|
203
|
+
stdlibSupport: z.ZodObject<{
|
|
204
|
+
hasVector: z.ZodBoolean;
|
|
205
|
+
hasString: z.ZodBoolean;
|
|
206
|
+
hasIostream: z.ZodBoolean;
|
|
207
|
+
hasExceptions: z.ZodBoolean;
|
|
208
|
+
hasRTTI: z.ZodBoolean;
|
|
209
|
+
recommendedArrayImpl: z.ZodEnum<["std_vector", "static_array"]>;
|
|
210
|
+
recommendedStringImpl: z.ZodEnum<["std_string", "static_string"]>;
|
|
211
|
+
}, "strip", z.ZodTypeAny, {
|
|
212
|
+
hasVector: boolean;
|
|
213
|
+
hasString: boolean;
|
|
214
|
+
hasIostream: boolean;
|
|
215
|
+
hasExceptions: boolean;
|
|
216
|
+
hasRTTI: boolean;
|
|
217
|
+
recommendedArrayImpl: "std_vector" | "static_array";
|
|
218
|
+
recommendedStringImpl: "std_string" | "static_string";
|
|
219
|
+
}, {
|
|
220
|
+
hasVector: boolean;
|
|
221
|
+
hasString: boolean;
|
|
222
|
+
hasIostream: boolean;
|
|
223
|
+
hasExceptions: boolean;
|
|
224
|
+
hasRTTI: boolean;
|
|
225
|
+
recommendedArrayImpl: "std_vector" | "static_array";
|
|
226
|
+
recommendedStringImpl: "std_string" | "static_string";
|
|
227
|
+
}>;
|
|
228
|
+
}, "strip", z.ZodTypeAny, {
|
|
229
|
+
needsIostream: boolean;
|
|
230
|
+
needsStdString: boolean;
|
|
231
|
+
needsStdVector: boolean;
|
|
232
|
+
needsStdFunction: boolean;
|
|
233
|
+
mathHeader: "none" | "<math.h>" | "<Arduino.h>";
|
|
234
|
+
normalizeCppType: boolean;
|
|
235
|
+
stdlibSupport: {
|
|
236
|
+
hasVector: boolean;
|
|
237
|
+
hasString: boolean;
|
|
238
|
+
hasIostream: boolean;
|
|
239
|
+
hasExceptions: boolean;
|
|
240
|
+
hasRTTI: boolean;
|
|
241
|
+
recommendedArrayImpl: "std_vector" | "static_array";
|
|
242
|
+
recommendedStringImpl: "std_string" | "static_string";
|
|
243
|
+
};
|
|
244
|
+
}, {
|
|
245
|
+
needsIostream: boolean;
|
|
246
|
+
needsStdString: boolean;
|
|
247
|
+
needsStdVector: boolean;
|
|
248
|
+
needsStdFunction: boolean;
|
|
249
|
+
mathHeader: "none" | "<math.h>" | "<Arduino.h>";
|
|
250
|
+
normalizeCppType: boolean;
|
|
251
|
+
stdlibSupport: {
|
|
252
|
+
hasVector: boolean;
|
|
253
|
+
hasString: boolean;
|
|
254
|
+
hasIostream: boolean;
|
|
255
|
+
hasExceptions: boolean;
|
|
256
|
+
hasRTTI: boolean;
|
|
257
|
+
recommendedArrayImpl: "std_vector" | "static_array";
|
|
258
|
+
recommendedStringImpl: "std_string" | "static_string";
|
|
259
|
+
};
|
|
260
|
+
}>;
|
|
261
|
+
ambientTypes: z.ZodArray<z.ZodString, "many">;
|
|
262
|
+
conformance: z.ZodObject<{
|
|
263
|
+
hardwareTestGroups: z.ZodArray<z.ZodString, "many">;
|
|
264
|
+
halResolutionTests: z.ZodArray<z.ZodString, "many">;
|
|
265
|
+
}, "strip", z.ZodTypeAny, {
|
|
266
|
+
hardwareTestGroups: string[];
|
|
267
|
+
halResolutionTests: string[];
|
|
268
|
+
}, {
|
|
269
|
+
hardwareTestGroups: string[];
|
|
270
|
+
halResolutionTests: string[];
|
|
271
|
+
}>;
|
|
272
|
+
}, "strip", z.ZodTypeAny, {
|
|
273
|
+
schemaVersion: 1;
|
|
274
|
+
frameworkId: string;
|
|
275
|
+
packageName: string;
|
|
276
|
+
canonical: boolean;
|
|
277
|
+
displayName: string;
|
|
278
|
+
description: string;
|
|
279
|
+
implementationMode: "from-scratch" | "extends-canonical" | "extends-other";
|
|
280
|
+
entrypoint: {
|
|
281
|
+
sourceExtension: "cpp" | "ino" | "cc" | "h";
|
|
282
|
+
entrypointFunctionName: string;
|
|
283
|
+
requiresLoopFunction: boolean;
|
|
284
|
+
generateHeaderFile: boolean;
|
|
285
|
+
overrideBaseName?: string | undefined;
|
|
286
|
+
outputSubdirectory?: string | undefined;
|
|
287
|
+
customBridgeShim?: string | undefined;
|
|
288
|
+
};
|
|
289
|
+
profile: {
|
|
290
|
+
forcedIncludes: string[];
|
|
291
|
+
symbolAliases: Record<string, string>;
|
|
292
|
+
targets: string[];
|
|
293
|
+
};
|
|
294
|
+
hal: {
|
|
295
|
+
[x: string]: {
|
|
296
|
+
supported: boolean;
|
|
297
|
+
ops: Record<string, "stub" | "polyfill" | "supported" | "unsupported" | "probe-inconclusive">;
|
|
298
|
+
partialCoverage: boolean;
|
|
299
|
+
unsupportedReason?: string | undefined;
|
|
300
|
+
};
|
|
301
|
+
raw?: unknown;
|
|
302
|
+
};
|
|
303
|
+
polyfills: {
|
|
304
|
+
emitted: {
|
|
305
|
+
id: string;
|
|
306
|
+
domain: string;
|
|
307
|
+
notes?: string | undefined;
|
|
308
|
+
}[];
|
|
309
|
+
suppressed: {
|
|
310
|
+
id: string;
|
|
311
|
+
reason: string;
|
|
312
|
+
}[];
|
|
313
|
+
};
|
|
314
|
+
toolchain: {
|
|
315
|
+
backend: string;
|
|
316
|
+
operations: {
|
|
317
|
+
prepare: boolean;
|
|
318
|
+
compile: boolean;
|
|
319
|
+
upload: boolean;
|
|
320
|
+
monitor: boolean;
|
|
321
|
+
};
|
|
322
|
+
reexportedFrom?: string | undefined;
|
|
323
|
+
};
|
|
324
|
+
typeEmission: {
|
|
325
|
+
needsIostream: boolean;
|
|
326
|
+
needsStdString: boolean;
|
|
327
|
+
needsStdVector: boolean;
|
|
328
|
+
needsStdFunction: boolean;
|
|
329
|
+
mathHeader: "none" | "<math.h>" | "<Arduino.h>";
|
|
330
|
+
normalizeCppType: boolean;
|
|
331
|
+
stdlibSupport: {
|
|
332
|
+
hasVector: boolean;
|
|
333
|
+
hasString: boolean;
|
|
334
|
+
hasIostream: boolean;
|
|
335
|
+
hasExceptions: boolean;
|
|
336
|
+
hasRTTI: boolean;
|
|
337
|
+
recommendedArrayImpl: "std_vector" | "static_array";
|
|
338
|
+
recommendedStringImpl: "std_string" | "static_string";
|
|
339
|
+
};
|
|
340
|
+
};
|
|
341
|
+
ambientTypes: string[];
|
|
342
|
+
conformance: {
|
|
343
|
+
hardwareTestGroups: string[];
|
|
344
|
+
halResolutionTests: string[];
|
|
345
|
+
};
|
|
346
|
+
basedOn?: string | undefined;
|
|
347
|
+
inheritsStrategyId?: string | undefined;
|
|
348
|
+
libraryResolution?: {
|
|
349
|
+
isFrameworkLibraryImport: boolean;
|
|
350
|
+
getFrameworkLibraryHeaderName: boolean;
|
|
351
|
+
buildClassNameMap: boolean;
|
|
352
|
+
tryGenerateLibDecl: boolean;
|
|
353
|
+
reexportedFrom?: string | undefined;
|
|
354
|
+
} | undefined;
|
|
355
|
+
}, {
|
|
356
|
+
schemaVersion: 1;
|
|
357
|
+
frameworkId: string;
|
|
358
|
+
packageName: string;
|
|
359
|
+
displayName: string;
|
|
360
|
+
description: string;
|
|
361
|
+
implementationMode: "from-scratch" | "extends-canonical" | "extends-other";
|
|
362
|
+
entrypoint: {
|
|
363
|
+
sourceExtension: "cpp" | "ino" | "cc" | "h";
|
|
364
|
+
entrypointFunctionName: string;
|
|
365
|
+
requiresLoopFunction: boolean;
|
|
366
|
+
generateHeaderFile: boolean;
|
|
367
|
+
overrideBaseName?: string | undefined;
|
|
368
|
+
outputSubdirectory?: string | undefined;
|
|
369
|
+
customBridgeShim?: string | undefined;
|
|
370
|
+
};
|
|
371
|
+
profile: {
|
|
372
|
+
forcedIncludes: string[];
|
|
373
|
+
symbolAliases: Record<string, string>;
|
|
374
|
+
targets: string[];
|
|
375
|
+
};
|
|
376
|
+
hal: {
|
|
377
|
+
[x: string]: {
|
|
378
|
+
supported: boolean;
|
|
379
|
+
ops: Record<string, "stub" | "polyfill" | "supported" | "unsupported" | "probe-inconclusive">;
|
|
380
|
+
unsupportedReason?: string | undefined;
|
|
381
|
+
partialCoverage?: boolean | undefined;
|
|
382
|
+
};
|
|
383
|
+
raw?: unknown;
|
|
384
|
+
};
|
|
385
|
+
polyfills: {
|
|
386
|
+
emitted: {
|
|
387
|
+
id: string;
|
|
388
|
+
domain: string;
|
|
389
|
+
notes?: string | undefined;
|
|
390
|
+
}[];
|
|
391
|
+
suppressed: {
|
|
392
|
+
id: string;
|
|
393
|
+
reason: string;
|
|
394
|
+
}[];
|
|
395
|
+
};
|
|
396
|
+
toolchain: {
|
|
397
|
+
backend: string;
|
|
398
|
+
operations: {
|
|
399
|
+
prepare: boolean;
|
|
400
|
+
compile: boolean;
|
|
401
|
+
upload: boolean;
|
|
402
|
+
monitor: boolean;
|
|
403
|
+
};
|
|
404
|
+
reexportedFrom?: string | undefined;
|
|
405
|
+
};
|
|
406
|
+
typeEmission: {
|
|
407
|
+
needsIostream: boolean;
|
|
408
|
+
needsStdString: boolean;
|
|
409
|
+
needsStdVector: boolean;
|
|
410
|
+
needsStdFunction: boolean;
|
|
411
|
+
mathHeader: "none" | "<math.h>" | "<Arduino.h>";
|
|
412
|
+
normalizeCppType: boolean;
|
|
413
|
+
stdlibSupport: {
|
|
414
|
+
hasVector: boolean;
|
|
415
|
+
hasString: boolean;
|
|
416
|
+
hasIostream: boolean;
|
|
417
|
+
hasExceptions: boolean;
|
|
418
|
+
hasRTTI: boolean;
|
|
419
|
+
recommendedArrayImpl: "std_vector" | "static_array";
|
|
420
|
+
recommendedStringImpl: "std_string" | "static_string";
|
|
421
|
+
};
|
|
422
|
+
};
|
|
423
|
+
ambientTypes: string[];
|
|
424
|
+
conformance: {
|
|
425
|
+
hardwareTestGroups: string[];
|
|
426
|
+
halResolutionTests: string[];
|
|
427
|
+
};
|
|
428
|
+
canonical?: boolean | undefined;
|
|
429
|
+
basedOn?: string | undefined;
|
|
430
|
+
inheritsStrategyId?: string | undefined;
|
|
431
|
+
libraryResolution?: {
|
|
432
|
+
isFrameworkLibraryImport: boolean;
|
|
433
|
+
getFrameworkLibraryHeaderName: boolean;
|
|
434
|
+
buildClassNameMap: boolean;
|
|
435
|
+
tryGenerateLibDecl: boolean;
|
|
436
|
+
reexportedFrom?: string | undefined;
|
|
437
|
+
} | undefined;
|
|
438
|
+
}>;
|
|
439
|
+
export type FrameworkManifest = z.infer<typeof FrameworkManifestSchema>;
|
|
440
|
+
/**
|
|
441
|
+
* Authoritative map of HAL op kinds that are lowered via the polyfill system
|
|
442
|
+
* rather than via `resolveHALOperation`. Keyed by op kind; value is the
|
|
443
|
+
* polyfill id that backs it.
|
|
444
|
+
*
|
|
445
|
+
* The manifest validator uses this to verify `polyfill`-declared ops: if a
|
|
446
|
+
* manifest declares `timing.set_interval: 'polyfill'`, the framework's
|
|
447
|
+
* `polyfills.emitted` list must include the polyfill id named here.
|
|
448
|
+
*
|
|
449
|
+
* Keep in sync with the transpiler's lowering routes — when a new op kind
|
|
450
|
+
* starts being routed via a polyfill instead of the HAL resolver, add it
|
|
451
|
+
* here. The set is intentionally small and stable: polyfill-routed ops are
|
|
452
|
+
* the exception, not the rule.
|
|
453
|
+
*/
|
|
454
|
+
export declare const POLYFILL_BACKED_OPS: Readonly<Record<string, string>>;
|
|
455
|
+
/**
|
|
456
|
+
* Validates and returns a FrameworkManifest. Frameworks call this from their
|
|
457
|
+
* `framework.manifest.ts` to get both static type-checking (the parameter type
|
|
458
|
+
* is the inferred FrameworkManifest) and runtime validation (zod parse).
|
|
459
|
+
* Bad manifests throw at module-load time.
|
|
460
|
+
*/
|
|
461
|
+
export declare function defineFrameworkManifest(input: unknown): FrameworkManifest;
|
|
462
|
+
export { HAL_CATEGORIES };
|