@typecad/cuttlefish 1.0.0-alpha.7 → 1.0.0-alpha.9
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/api/config.d.ts +32 -0
- package/dist/api/index.d.ts +1 -1
- package/dist/api/schema/types.d.ts +15 -0
- package/dist/api/shared/async-runtime-static.d.ts +12 -1
- package/dist/api/shared/async-runtime-static.js +69 -24
- package/dist/api/shared/async-symbol-detector.d.ts +11 -0
- package/dist/api/shared/async-symbol-detector.js +140 -0
- package/dist/api/shared/async-types.d.ts +24 -0
- package/dist/api/shared/coop-scheduler.d.ts +60 -0
- package/dist/api/shared/coop-scheduler.js +149 -0
- package/dist/api/shared/display-adapter.d.ts +2 -2
- package/dist/api/shared/display-adapter.js +9 -119
- package/dist/api/shared/display-adapters/sdl.js +29 -29
- package/dist/api/shared/display-profile.d.ts +38 -33
- package/dist/api/shared/display-profile.js +22 -170
- package/dist/api/shared/framework-manifest-registry.d.ts +1 -1
- package/dist/api/shared/framework-manifest-registry.js +8 -6
- package/dist/api/shared/framework-manifest.d.ts +147 -28
- package/dist/api/shared/framework-manifest.js +35 -2
- package/dist/api/shared/graphics-strategy.d.ts +15 -6
- package/dist/api/shared/hal-op-ir.d.ts +340 -3
- package/dist/api/shared/hal-op-ir.js +34 -0
- package/dist/api/shared/index.d.ts +9 -1
- package/dist/api/shared/index.js +11 -1
- package/dist/api/shared/ir-core.d.ts +4 -0
- package/dist/api/shared/ir-declarations.d.ts +6 -0
- package/dist/api/shared/platform-strategy.d.ts +104 -2
- package/dist/api/shared/polyfill-helper-registry.js +18 -1
- package/dist/api/shared/promise-runtime.d.ts +1 -1
- package/dist/api/shared/promise-runtime.js +17 -13
- package/dist/api/shared/toolchain-types.d.ts +17 -0
- package/dist/api/shared/validate-framework-manifest.js +77 -0
- package/dist/api/shared/worker-runtime-polyfill.d.ts +22 -0
- package/dist/api/shared/worker-runtime-polyfill.js +34 -0
- package/dist/api/shared/worker-runtime.d.ts +69 -0
- package/dist/api/shared/worker-runtime.js +163 -0
- package/dist/cli.js +125 -121
- package/dist/config-loader.d.ts +7 -2
- package/dist/config-loader.js +20 -19
- package/dist/config-schema.d.ts +107 -65
- package/dist/config-schema.js +14 -0
- package/dist/contract/board-generator.d.ts +17 -0
- package/dist/contract/board-generator.js +57 -0
- package/dist/contract/contract-parser.d.ts +217 -0
- package/dist/contract/contract-parser.js +224 -0
- package/dist/contract/index.d.ts +22 -0
- package/dist/contract/index.js +68 -0
- package/dist/create/board-codegen.js +4 -4
- package/dist/create/board-generators.js +4 -5
- package/dist/create/board-spec.d.ts +74 -77
- package/dist/create/board-spec.js +0 -1
- package/dist/create/init-scaffold.d.ts +7 -3
- package/dist/create/init-scaffold.js +0 -62
- package/dist/create/init-templates.js +62 -16
- package/dist/create/init-wizard.js +32 -27
- package/dist/debug/preprocessor.js +178 -39
- package/dist/debug/types.d.ts +23 -0
- package/dist/diagnostics/mermaid-builder.d.ts +1 -1
- package/dist/diagnostics/mermaid-builder.js +34 -24
- package/dist/emit/compliance/arxml-writer.d.ts +11 -0
- package/dist/emit/compliance/arxml-writer.js +34 -0
- package/dist/emit/compliance/compliance-context.d.ts +57 -0
- package/dist/emit/compliance/compliance-context.js +113 -0
- package/dist/emit/compliance/deviation-ledger.d.ts +27 -0
- package/dist/emit/compliance/deviation-ledger.js +47 -0
- package/dist/emit/compliance/deviation-writer.d.ts +30 -0
- package/dist/emit/compliance/deviation-writer.js +37 -0
- package/dist/emit/compliance/index.d.ts +7 -0
- package/dist/emit/compliance/index.js +6 -0
- package/dist/emit/compliance/rule-engine.d.ts +13 -0
- package/dist/emit/compliance/rule-engine.js +101 -0
- package/dist/emit/compliance/rules.d.ts +16 -0
- package/dist/emit/compliance/rules.js +191 -0
- package/dist/emit/compliance/types.d.ts +59 -0
- package/dist/emit/compliance/types.js +8 -0
- package/dist/emit/emitters/class-emitter.js +6 -1
- package/dist/emit/emitters/emitter-context.d.ts +23 -1
- package/dist/emit/emitters/function-emitter-impl.js +96 -6
- package/dist/emit/emitters/line-appender.js +19 -0
- package/dist/emit/emitters/line-marker.d.ts +38 -0
- package/dist/emit/emitters/line-marker.js +39 -0
- package/dist/emit/emitters/output-finalizer.js +80 -1
- package/dist/emit/emitters/setup.d.ts +17 -0
- package/dist/emit/emitters/setup.js +217 -36
- package/dist/emit/emitters/top-level-prep.js +6 -0
- package/dist/emit/emitters/type-decl-emitter.js +28 -3
- package/dist/emit/emitters/ui-emitter.js +17 -8
- package/dist/emit/expression-renderer.d.ts +1 -1
- package/dist/emit/expression-renderer.js +81 -5
- package/dist/emit/route-hal-op.js +18 -5
- package/dist/emit/snprintf-helpers.js +7 -4
- package/dist/emit/statement-renderer.d.ts +10 -0
- package/dist/emit/statement-renderer.js +21 -5
- package/dist/emit/utils/async-state-machine.js +39 -12
- package/dist/framework-package.js +2 -0
- package/dist/framework-registry.d.ts +17 -0
- package/dist/install/framework-catalog.d.ts +53 -0
- package/dist/install/framework-catalog.js +107 -0
- package/dist/install/handle-install.d.ts +35 -0
- package/dist/install/handle-install.js +177 -0
- package/dist/install/index.d.ts +4 -0
- package/dist/install/index.js +3 -0
- package/dist/ir/adc-range-validation.js +14 -1
- package/dist/ir/build-ir-state.d.ts +1 -0
- package/dist/ir/build-ir-state.js +14 -0
- package/dist/ir/build-ir.js +4 -4
- package/dist/ir/call-graph.js +16 -0
- package/dist/ir/expression-to-ir.js +150 -0
- package/dist/ir/function-builder.js +22 -0
- package/dist/ir/hal/hal-emitter.js +10 -6
- package/dist/ir/hal/hal-parser.js +16 -9
- package/dist/ir/hal/hal-plugins.js +164 -3
- package/dist/ir/identifier-collector.js +21 -4
- package/dist/ir/interrupt-analysis.d.ts +5 -1
- package/dist/ir/interrupt-analysis.js +8 -16
- package/dist/ir/ownership-analysis.js +6 -0
- package/dist/ir/pin-capability-validation.js +37 -0
- package/dist/ir/pin-mode-validation.d.ts +2 -2
- package/dist/ir/pin-mode-validation.js +49 -18
- package/dist/ir/program-analysis.d.ts +42 -0
- package/dist/ir/program-analysis.js +243 -6
- package/dist/ir/render-expr.js +11 -0
- package/dist/ir/timing-validation.js +11 -2
- package/dist/ir/transformers/call-statement.js +105 -0
- package/dist/ir/transformers/expressions.js +4 -0
- package/dist/ir/transformers/hal-call-resolver.js +21 -0
- package/dist/ir/transformers/namespace-methods.js +17 -12
- package/dist/ir/transformers/ui-reactive.js +2 -2
- package/dist/ir/transformers/variables.js +51 -0
- package/dist/ir/type-resolution.js +18 -0
- package/dist/ir/ui-element-auto-wire.js +7 -5
- package/dist/ir/utils/map-statements.d.ts +4 -0
- package/dist/ir/utils/map-statements.js +79 -0
- package/dist/ir/validation-orchestrator.js +6 -1
- package/dist/ir/worker-analysis.d.ts +10 -0
- package/dist/ir/worker-analysis.js +261 -0
- package/dist/orchestrator/graph-builder.js +8 -7
- package/dist/platform/coop-scheduler-runtime.d.ts +19 -0
- package/dist/platform/coop-scheduler-runtime.js +41 -0
- package/dist/platform/generic-strategy.d.ts +15 -3
- package/dist/platform/generic-strategy.js +49 -4
- package/dist/safety/safety-bridge.d.ts +11 -0
- package/dist/safety/safety-bridge.js +48 -0
- package/dist/safety/sidecar-bridge.d.ts +5 -0
- package/dist/safety/sidecar-bridge.js +22 -0
- package/dist/safety-hook.d.ts +79 -0
- package/dist/safety-hook.js +35 -0
- package/dist/stores/display-profile-store.d.ts +0 -1
- package/dist/stores/display-profile-store.js +0 -1
- package/dist/testing.d.ts +4 -0
- package/dist/testing.js +5 -0
- package/dist/transpile.js +124 -35
- package/dist/types.d.ts +22 -2
- package/dist/ui-hook.d.ts +0 -2
- package/dist/utils/cli.d.ts +2 -2
- package/dist/utils/cli.js +68 -3
- package/package.json +20 -5
- package/dist/api/shared/display-adapters/eink-mono.d.ts +0 -2
- package/dist/api/shared/display-adapters/eink-mono.js +0 -53
- package/dist/api/shared/display-adapters/ssd1309.d.ts +0 -2
- package/dist/api/shared/display-adapters/ssd1309.js +0 -136
- package/dist/api/shared/display-adapters/st7796.d.ts +0 -2
- package/dist/api/shared/display-adapters/st7796.js +0 -132
- package/dist/libdef/idf-discovery.d.ts +0 -7
- package/dist/libdef/idf-discovery.js +0 -59
- package/dist/licenses.d.ts +0 -185
- package/dist/licenses.js +0 -963
package/dist/licenses.d.ts
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
export type CopyleftRisk = "permissive" | "weak-copyleft" | "strong-copyleft" | "unknown";
|
|
2
|
-
export type LicenseSource = "library.properties" | "license-file" | "source-header" | "none";
|
|
3
|
-
export interface LibraryLicenseEntry {
|
|
4
|
-
name: string;
|
|
5
|
-
version: string | undefined;
|
|
6
|
-
/** install_dir as reported by arduino-cli lib list. */
|
|
7
|
-
path: string;
|
|
8
|
-
/** Normalized SPDX ID (e.g. "BSD-3-Clause"); undefined if not determined. */
|
|
9
|
-
spdx: string | undefined;
|
|
10
|
-
risk: CopyleftRisk;
|
|
11
|
-
source: LicenseSource;
|
|
12
|
-
}
|
|
13
|
-
export type ScanOutcome = {
|
|
14
|
-
ok: true;
|
|
15
|
-
libraries: LibraryLicenseEntry[];
|
|
16
|
-
} | {
|
|
17
|
-
ok: false;
|
|
18
|
-
reason: "arduino-cli-not-found" | "arduino-cli-unresponsive" | "no-libraries";
|
|
19
|
-
message: string;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Headers the project needs. `source` is "ino" when read from the generated
|
|
23
|
-
* .ino (authoritative) or "config" when derived from cuttlefish.config.ts
|
|
24
|
-
* (partial: display/touch only).
|
|
25
|
-
*/
|
|
26
|
-
export type ProjectHeaders = {
|
|
27
|
-
ok: true;
|
|
28
|
-
headers: string[];
|
|
29
|
-
source: "ino" | "config";
|
|
30
|
-
inoPath?: string;
|
|
31
|
-
} | {
|
|
32
|
-
ok: false;
|
|
33
|
-
reason: "no-config" | "no-entry" | "unreadable-ino";
|
|
34
|
-
message: string;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Minimal view of ResolvedCuttlefishConfig that resolveProjectHeaders needs.
|
|
38
|
-
* Kept structural so we don't import the full config type (avoids a cycle).
|
|
39
|
-
*/
|
|
40
|
-
interface ProjectConfig {
|
|
41
|
-
configPath: string;
|
|
42
|
-
entry?: string;
|
|
43
|
-
outputOutDir?: string;
|
|
44
|
-
/** FQBN, e.g. 'arduino:avr:uno'. Used to resolve the board core for core-bundled libs. */
|
|
45
|
-
buildTarget?: string;
|
|
46
|
-
display?: {
|
|
47
|
-
profile?: string;
|
|
48
|
-
driver?: string;
|
|
49
|
-
touch?: {
|
|
50
|
-
library?: string;
|
|
51
|
-
};
|
|
52
|
-
} | null;
|
|
53
|
-
}
|
|
54
|
-
/** Classify a header as a compiler-toolchain C-library header. */
|
|
55
|
-
export declare function isToolchainHeader(header: string): boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Result of resolving the project's board core directory.
|
|
58
|
-
*/
|
|
59
|
-
export type ProjectCore = {
|
|
60
|
-
ok: true;
|
|
61
|
-
coreDir: string;
|
|
62
|
-
} | {
|
|
63
|
-
ok: false;
|
|
64
|
-
reason: "no-fqbn" | "no-core";
|
|
65
|
-
message: string;
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Resolve the project's board-core directory from its FQBN, via
|
|
69
|
-
* `arduino-cli config dump` (for the packages data dir) and the on-disk
|
|
70
|
-
* `<data>/packages/<packager>/hardware/<arch>/<version>/` layout. Returns the
|
|
71
|
-
* highest-versioned core dir. Never throws.
|
|
72
|
-
*
|
|
73
|
-
* `runConfigDump` is an injected seam (returns the `config dump` stdout, or ""
|
|
74
|
-
* on failure) so the function is unit-testable without spawning.
|
|
75
|
-
*/
|
|
76
|
-
export declare function resolveProjectCore(fqbn: string | undefined, runConfigDump: () => string, readdir: (d: string) => string[]): ProjectCore;
|
|
77
|
-
/**
|
|
78
|
-
* Resolve the project's library headers. Prefers the generated .ino
|
|
79
|
-
* (authoritative); falls back to display/touch headers derived from config
|
|
80
|
-
* (partial picture, no transpile required).
|
|
81
|
-
*/
|
|
82
|
-
export declare function resolveProjectHeaders(config: ProjectConfig | undefined, readFile: (p: string) => string | undefined): ProjectHeaders;
|
|
83
|
-
/**
|
|
84
|
-
* One project header, joined to its owning library or flagged not-installed.
|
|
85
|
-
*/
|
|
86
|
-
export type ProjectLibrary = {
|
|
87
|
-
kind: "resolved";
|
|
88
|
-
lib: LibraryLicenseEntry;
|
|
89
|
-
} | {
|
|
90
|
-
kind: "core";
|
|
91
|
-
header: string;
|
|
92
|
-
} | {
|
|
93
|
-
kind: "not-installed";
|
|
94
|
-
header: string;
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* Build a header-basename -> bundled-library map from a board core's bundled
|
|
98
|
-
* libraries. Scans `<coreDir>/libraries/<Lib>/src/` for .h files (e.g. Wire.h,
|
|
99
|
-
* SPI.h). Each header maps to a synthetic RawArduinoLibrary so the existing
|
|
100
|
-
* resolveLibraryLicense can read its license from the bundled lib's header
|
|
101
|
-
* notice or library.properties.
|
|
102
|
-
*/
|
|
103
|
-
export declare function buildCoreHeaderIndex(coreDir: string, readdir: (d: string) => string[]): Map<string, RawArduinoLibrary>;
|
|
104
|
-
/**
|
|
105
|
-
* Join each project header to its owning library or classify it. Pipeline:
|
|
106
|
-
* 1. user library (arduino-cli lib list) -> resolved (license)
|
|
107
|
-
* 2. core library (project's own core) -> resolved (license, e.g. LGPL-2.1)
|
|
108
|
-
* 3. toolchain header (avr/*, util/*) -> core (gray, no license)
|
|
109
|
-
* 4. else -> not-installed
|
|
110
|
-
*
|
|
111
|
-
* `coreDir` is optional; when absent, step 2 is skipped.
|
|
112
|
-
*/
|
|
113
|
-
export declare function joinHeadersToLibraries(headers: string[], libs: RawArduinoLibrary[], readdir: (d: string) => string[], readFile: (p: string) => string | undefined, coreDir?: string): ProjectLibrary[];
|
|
114
|
-
/**
|
|
115
|
-
* Resolve a raw license input (either the short `library.properties` `license=`
|
|
116
|
-
* value, the full text of a LICENSE file, or a source-file header comment) to a
|
|
117
|
-
* canonical SPDX ID.
|
|
118
|
-
*
|
|
119
|
-
* Matching priority:
|
|
120
|
-
* 1. SPDX-License-Identifier: <id> marker (authoritative when present)
|
|
121
|
-
* 2. exact alias match (suits the short properties value)
|
|
122
|
-
* 3. substring markers match, ALL markers required (suits full LICENSE text)
|
|
123
|
-
* 4. shortMarkers match, ANY one sufficient (suits sparse header comments
|
|
124
|
-
* like Adafruit's "BSD license, all text here must be included")
|
|
125
|
-
*
|
|
126
|
-
* Returns the SPDX ID string, or undefined if nothing matched.
|
|
127
|
-
*/
|
|
128
|
-
export declare function identifySpdx(input: string): string | undefined;
|
|
129
|
-
/**
|
|
130
|
-
* Classify the copyleft risk of a known SPDX ID. Returns "unknown" for
|
|
131
|
-
* unrecognized ids.
|
|
132
|
-
*/
|
|
133
|
-
export declare function classifyRisk(spdx: string): CopyleftRisk;
|
|
134
|
-
/** Raw library entry as it appears in `arduino-cli lib list --format json`. */
|
|
135
|
-
export interface RawArduinoLibrary {
|
|
136
|
-
name: string;
|
|
137
|
-
version?: string;
|
|
138
|
-
install_dir?: string;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Options for `scanLicenses`. Production calls omit this object entirely; tests
|
|
142
|
-
* inject `fakeLibList` and `fakeReadFile` to avoid spawning and disk I/O.
|
|
143
|
-
*/
|
|
144
|
-
export interface ScanOptions {
|
|
145
|
-
/** Override the `arduino-cli lib list` call. Return null to simulate spawn failure. */
|
|
146
|
-
fakeLibList?: () => RawArduinoLibrary[] | null;
|
|
147
|
-
/** Override disk reads of library.properties and LICENSE files. */
|
|
148
|
-
fakeReadFile?: (p: string) => string | undefined;
|
|
149
|
-
/** Override directory listings. */
|
|
150
|
-
fakeReaddir?: (d: string) => string[];
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Normalize either JSON shape (wrapped or bare array) to a flat library list.
|
|
154
|
-
* Exported for direct unit testing of the dual-shape parsing.
|
|
155
|
-
*/
|
|
156
|
-
export declare function coerceLibList(parsed: unknown): RawArduinoLibrary[];
|
|
157
|
-
/**
|
|
158
|
-
* Module-level runner override used by presenter tests so `scanLicenses()`
|
|
159
|
-
* (with no args) does not spawn. Mirrors __setArduinoCliRunnerForTest.
|
|
160
|
-
*/
|
|
161
|
-
export interface LicensesRunner {
|
|
162
|
-
listLibraries: () => RawArduinoLibrary[] | null;
|
|
163
|
-
readFile: (p: string) => string | undefined;
|
|
164
|
-
readdir: (d: string) => string[];
|
|
165
|
-
}
|
|
166
|
-
/** @internal Test-only override of the default runner. */
|
|
167
|
-
export declare function __setLicensesRunnerForTest(runner: LicensesRunner | undefined): void;
|
|
168
|
-
/**
|
|
169
|
-
* Scan installed Arduino libraries and resolve each one's license. Never throws.
|
|
170
|
-
*/
|
|
171
|
-
export declare function scanLicenses(options?: ScanOptions): ScanOutcome;
|
|
172
|
-
/** @internal Test-only override of the project config (normally loaded via loadCuttlefishConfig). */
|
|
173
|
-
export declare function __setProjectConfigForTest(config: ProjectConfig | undefined): void;
|
|
174
|
-
/** @internal Test-only override of `arduino-cli config dump` stdout. */
|
|
175
|
-
export declare function __setConfigDumpForTest(fn: (() => string) | undefined): void;
|
|
176
|
-
/**
|
|
177
|
-
* `cuttlefish licenses` presenter. `all === false` (default, project scope)
|
|
178
|
-
* resolves this project's libraries from the generated .ino (or config
|
|
179
|
-
* fallback), joins each to an installed library, and reports only those.
|
|
180
|
-
* `all === true` reports every installed library (the original behavior).
|
|
181
|
-
* Warns on unknown licenses; flags NOT INSTALLED headers in project scope; sets
|
|
182
|
-
* process.exitCode under --strict. Never calls process.exit().
|
|
183
|
-
*/
|
|
184
|
-
export declare function runLicensesPresenter(strict: boolean, all: boolean): void;
|
|
185
|
-
export {};
|