tempo-sdk 0.0.16 → 0.0.19
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/assets/editor.d.ts +79 -0
- package/dist/assets/editor.js +571 -0
- package/dist/assets/editor.js.map +1 -0
- package/dist/assets/index.d.ts +83 -0
- package/dist/assets/index.js +26 -0
- package/dist/assets/index.js.map +1 -0
- package/dist/assets/parser.d.ts +78 -0
- package/dist/assets/parser.js +29 -0
- package/dist/assets/parser.js.map +1 -0
- package/dist/canvas/editor.d.ts +44 -9
- package/dist/canvas/editor.js +116 -416
- package/dist/canvas/editor.js.map +1 -1
- package/dist/canvas/index.d.ts +1 -0
- package/dist/canvas/index.js +237 -56
- package/dist/canvas/index.js.map +1 -1
- package/dist/canvas/parser.d.ts +25 -2
- package/dist/canvas/parser.js +3 -3
- package/dist/{chunk-77BNMPBS.js → chunk-CB5NJJJT.js} +31 -5
- package/dist/chunk-CB5NJJJT.js.map +1 -0
- package/dist/chunk-IWULHYPW.js +650 -0
- package/dist/chunk-IWULHYPW.js.map +1 -0
- package/dist/{chunk-ICP7LCPJ.js → chunk-P277UVZE.js} +279 -40
- package/dist/chunk-P277UVZE.js.map +1 -0
- package/dist/expo/plugin.cjs +30 -4
- package/dist/expo/plugin.cjs.map +1 -1
- package/dist/expo/plugin.js +1 -1
- package/dist/expo-babel-plugin.cjs +30 -4
- package/dist/expo-babel-plugin.cjs.map +1 -1
- package/dist/expo-babel-plugin.d.cts +1 -1
- package/dist/expo-babel-plugin.d.ts +1 -1
- package/dist/expo-babel-plugin.js +1 -1
- package/dist/index.js +26 -6
- package/dist/index.js.map +1 -1
- package/dist/nextjs-loader.cjs +29 -4
- package/dist/nextjs-loader.cjs.map +1 -1
- package/dist/types-B-dRoF2T.d.ts +102 -0
- package/package.json +16 -3
- package/dist/annotation-strategy-DCJHc--2.d.cts +0 -13
- package/dist/annotation-strategy-DCJHc--2.d.ts +0 -13
- package/dist/chunk-2LP5G6CD.js +0 -748
- package/dist/chunk-2LP5G6CD.js.map +0 -1
- package/dist/chunk-77BNMPBS.js.map +0 -1
- package/dist/chunk-B3PHU7XX.js +0 -571
- package/dist/chunk-B3PHU7XX.js.map +0 -1
- package/dist/chunk-EJBWZCEE.js +0 -434
- package/dist/chunk-EJBWZCEE.js.map +0 -1
- package/dist/chunk-F64WRL4H.js +0 -884
- package/dist/chunk-F64WRL4H.js.map +0 -1
- package/dist/chunk-G7M57ARC.js +0 -902
- package/dist/chunk-G7M57ARC.js.map +0 -1
- package/dist/chunk-GHPL4LGE.js +0 -205
- package/dist/chunk-GHPL4LGE.js.map +0 -1
- package/dist/chunk-ICP7LCPJ.js.map +0 -1
- package/dist/chunk-IG3JZVZI.js +0 -846
- package/dist/chunk-IG3JZVZI.js.map +0 -1
- package/dist/chunk-MBTLXFNP.js +0 -605
- package/dist/chunk-MBTLXFNP.js.map +0 -1
- package/dist/chunk-MD3HJ7L3.js +0 -457
- package/dist/chunk-MD3HJ7L3.js.map +0 -1
- package/dist/chunk-O3HYJ6BU.js +0 -433
- package/dist/chunk-O3HYJ6BU.js.map +0 -1
- package/dist/chunk-WGGLHHC5.js +0 -337
- package/dist/chunk-WGGLHHC5.js.map +0 -1
- package/dist/chunk-X3K7Z2BH.js +0 -900
- package/dist/chunk-X3K7Z2BH.js.map +0 -1
- package/dist/chunk-ZHORRCQG.js +0 -756
- package/dist/chunk-ZHORRCQG.js.map +0 -1
- package/dist/index.cjs +0 -1170
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -99
- package/dist/page-BokkL6FZ.d.ts +0 -35
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared data-model types for the asset system's static pipeline: the parser
|
|
3
|
+
* (`tempo-sdk/assets/parser`), the source editor (`tempo-sdk/assets/editor`),
|
|
4
|
+
* and downstream consumers (`@tempo-modules/asset-libraries` index + MCP
|
|
5
|
+
* tools). Everything here must stay JSON-serializable — parse results cross
|
|
6
|
+
* IPC and MCP boundaries verbatim.
|
|
7
|
+
*
|
|
8
|
+
* See specs/asset-libraries.md §3 for the full parsing contract.
|
|
9
|
+
*/
|
|
10
|
+
type AssetSourceSpan = {
|
|
11
|
+
start: number;
|
|
12
|
+
end: number;
|
|
13
|
+
};
|
|
14
|
+
/** Stable machine-readable identifiers for every parse/edit problem. */
|
|
15
|
+
type AssetParseErrorCode = "misimported_define_asset" | "non_identifier_component" | "unknown_binding" | "imported_binding" | "non_top_level_binding" | "config_not_object_literal" | "invalid_call_arguments" | "duplicate_declaration" | "non_top_level_call" | "unparseable_source" | "component_declaration_outside_canvas" | "duplicate_asset_declaration" | "missing_canvas_pointer" | "stale_canvas_pointer" | "canvas_pointer_unverified" | "redundant_canvas_declaration" | "non_literal_library" | "empty_library_name" | "duplicate_library" | "empty_variants" | "variants_on_canvas" | "unresolved_prop_value" | "not_exported";
|
|
16
|
+
type AssetParseError = {
|
|
17
|
+
code: AssetParseErrorCode;
|
|
18
|
+
message: string;
|
|
19
|
+
/** "structural": the declaration is excluded from the index — readers must
|
|
20
|
+
* fail closed. "degraded": the declaration is indexed; this is a warning
|
|
21
|
+
* carried on the entry. "info": advisory note carried on the entry —
|
|
22
|
+
* best-effort validation that could not run to a verdict; never a
|
|
23
|
+
* failure. Mirrors CanvasParseError's severity split. */
|
|
24
|
+
severity: "structural" | "degraded" | "info";
|
|
25
|
+
span?: AssetSourceSpan;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* A config value the parser could not resolve statically (identifier
|
|
29
|
+
* reference, call result, JSX, spread, …). The `$unresolved` shape is the
|
|
30
|
+
* wire format everywhere (index, IPC, MCP) — no translation layers.
|
|
31
|
+
* A user literally writing `{ $unresolved: true }` as a prop value is
|
|
32
|
+
* indistinguishable from this marker; that collision is accepted.
|
|
33
|
+
*/
|
|
34
|
+
type UnresolvedValue = {
|
|
35
|
+
$unresolved: true;
|
|
36
|
+
};
|
|
37
|
+
declare const UNRESOLVED_VALUE: UnresolvedValue;
|
|
38
|
+
declare function isUnresolvedValue(value: unknown): value is UnresolvedValue;
|
|
39
|
+
/** Statically-readable config value: JSON literals plus the UNRESOLVED marker. */
|
|
40
|
+
type StaticValue = string | number | boolean | null | UnresolvedValue | StaticValue[] | {
|
|
41
|
+
[key: string]: StaticValue;
|
|
42
|
+
};
|
|
43
|
+
type ParsedAssetVariant = {
|
|
44
|
+
name: string;
|
|
45
|
+
/** One dynamic value does not discard the variant — it parses to UNRESOLVED. */
|
|
46
|
+
props: Record<string, StaticValue>;
|
|
47
|
+
hasUnresolvedValues: boolean;
|
|
48
|
+
};
|
|
49
|
+
type AssetExportKind = "named" | "default" | "none";
|
|
50
|
+
/** Source spans that power the surgical editor (specs/asset-libraries.md §4). */
|
|
51
|
+
type AssetSpans = {
|
|
52
|
+
/** The whole `defineAsset(...)` expression statement, semicolon included. */
|
|
53
|
+
call: AssetSourceSpan;
|
|
54
|
+
/** The config ObjectExpression (second argument). */
|
|
55
|
+
config: AssetSourceSpan;
|
|
56
|
+
/** The `libraries` array expression, only when the value is an array
|
|
57
|
+
* literal. A `librariesProperty` without `libraries` means the property
|
|
58
|
+
* exists but its value is dynamic — the editor must refuse to touch it. */
|
|
59
|
+
libraries?: AssetSourceSpan;
|
|
60
|
+
/** The whole `libraries: <value>` property, whenever the key is present.
|
|
61
|
+
* Lets the editor remove the property outright when its array empties. */
|
|
62
|
+
librariesProperty?: AssetSourceSpan;
|
|
63
|
+
/** One span per statically-known `libraries` entry, in source order,
|
|
64
|
+
* index-aligned with ParsedAssetDeclaration.libraries. */
|
|
65
|
+
libraryItems: AssetSourceSpan[];
|
|
66
|
+
};
|
|
67
|
+
/** Reference-declaration target: defineAsset's first argument is an imported
|
|
68
|
+
* binding, and the asset's identity is the import itself. Purely syntactic —
|
|
69
|
+
* the parser records the import statement's module specifier plus the name
|
|
70
|
+
* imported from it ("default" for default imports); resolution to a
|
|
71
|
+
* workspace identity happens in @tempo-modules/asset-libraries. */
|
|
72
|
+
type ParsedAssetReference = {
|
|
73
|
+
importSpecifier: string;
|
|
74
|
+
importedName: string;
|
|
75
|
+
};
|
|
76
|
+
type ParsedAssetDeclaration = {
|
|
77
|
+
/** The identifier passed as defineAsset's first argument. */
|
|
78
|
+
bindingName: string;
|
|
79
|
+
exportKind: AssetExportKind;
|
|
80
|
+
/** Deduplicated, statically-known entries only. */
|
|
81
|
+
libraries: string[];
|
|
82
|
+
/** What this asset is and when to reach for it (and when not). */
|
|
83
|
+
usageInstructions?: string;
|
|
84
|
+
variants: ParsedAssetVariant[];
|
|
85
|
+
/** Present iff the declaration targets an imported binding. */
|
|
86
|
+
reference?: ParsedAssetReference;
|
|
87
|
+
spans: AssetSpans;
|
|
88
|
+
/** Degraded-severity notes scoped to this declaration. */
|
|
89
|
+
warnings: AssetParseError[];
|
|
90
|
+
};
|
|
91
|
+
type ParsedAssetFile = {
|
|
92
|
+
filePath: string;
|
|
93
|
+
/** Declarations whose identity parsed cleanly (may carry warnings). */
|
|
94
|
+
declarations: ParsedAssetDeclaration[];
|
|
95
|
+
/** Structural errors: file-level problems and rejected declarations. */
|
|
96
|
+
errors: AssetParseError[];
|
|
97
|
+
};
|
|
98
|
+
/** Typed failures shared by the editor operations (§4.1) and the MCP write
|
|
99
|
+
* tools that surface them (§7.3). */
|
|
100
|
+
type AssetEditFailureCode = "asset_not_found" | "config_not_editable" | "export_not_found" | "already_defined" | "not_definable";
|
|
101
|
+
|
|
102
|
+
export { type AssetEditFailureCode as A, type ParsedAssetReference as P, type StaticValue as S, UNRESOLVED_VALUE as U, type AssetSourceSpan as a, type AssetExportKind as b, type ParsedAssetFile as c, type AssetParseError as d, type AssetParseErrorCode as e, type AssetSpans as f, type ParsedAssetDeclaration as g, type ParsedAssetVariant as h, type UnresolvedValue as i, isUnresolvedValue as j };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tempo-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Tempo SDK — Vite, Next.js, and Expo plugins for JSX annotation and shared page/storyboard types",
|
|
6
6
|
"exports": {
|
|
@@ -20,6 +20,18 @@
|
|
|
20
20
|
"types": "./dist/canvas/editor.d.ts",
|
|
21
21
|
"import": "./dist/canvas/editor.js"
|
|
22
22
|
},
|
|
23
|
+
"./assets": {
|
|
24
|
+
"types": "./dist/assets/index.d.ts",
|
|
25
|
+
"import": "./dist/assets/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./assets/parser": {
|
|
28
|
+
"types": "./dist/assets/parser.d.ts",
|
|
29
|
+
"import": "./dist/assets/parser.js"
|
|
30
|
+
},
|
|
31
|
+
"./assets/editor": {
|
|
32
|
+
"types": "./dist/assets/editor.d.ts",
|
|
33
|
+
"import": "./dist/assets/editor.js"
|
|
34
|
+
},
|
|
23
35
|
"./nextjs": {
|
|
24
36
|
"types": "./dist/nextjs.d.ts",
|
|
25
37
|
"import": "./dist/nextjs.js",
|
|
@@ -82,8 +94,9 @@
|
|
|
82
94
|
"@modules/file-parser": "0.0.1"
|
|
83
95
|
},
|
|
84
96
|
"scripts": {
|
|
85
|
-
"
|
|
86
|
-
"build
|
|
97
|
+
"clean": "rm -rf dist",
|
|
98
|
+
"build": "pnpm run clean && tsup",
|
|
99
|
+
"build:if-missing": "test -f dist/index.js || pnpm run build",
|
|
87
100
|
"demo": "TEMPO=true pnpm --filter @tempo-modules/vite-annotate-plugin-demo dev",
|
|
88
101
|
"demo:nextjs": "TEMPO=true pnpm --filter @tempo-modules/tempo-sdk-nextjs-demo dev",
|
|
89
102
|
"test": "vitest run",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { JSXElement } from 'oxc-parser';
|
|
2
|
-
|
|
3
|
-
interface ElementInfo {
|
|
4
|
-
element: JSXElement;
|
|
5
|
-
/** e.g. "div", "Button", "Foo.Bar" */
|
|
6
|
-
tagName: string;
|
|
7
|
-
}
|
|
8
|
-
/** Supported prop value types. `undefined` values are skipped. */
|
|
9
|
-
type PropValue = string | number | boolean | null | undefined | ((...args: unknown[]) => unknown) | object;
|
|
10
|
-
|
|
11
|
-
type ComputeAnnotatedProps = (info: ElementInfo, filepath: string, modifiedtsMs: number) => Record<string, PropValue>;
|
|
12
|
-
|
|
13
|
-
export type { ComputeAnnotatedProps as C, ElementInfo as E, PropValue as P };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { JSXElement } from 'oxc-parser';
|
|
2
|
-
|
|
3
|
-
interface ElementInfo {
|
|
4
|
-
element: JSXElement;
|
|
5
|
-
/** e.g. "div", "Button", "Foo.Bar" */
|
|
6
|
-
tagName: string;
|
|
7
|
-
}
|
|
8
|
-
/** Supported prop value types. `undefined` values are skipped. */
|
|
9
|
-
type PropValue = string | number | boolean | null | undefined | ((...args: unknown[]) => unknown) | object;
|
|
10
|
-
|
|
11
|
-
type ComputeAnnotatedProps = (info: ElementInfo, filepath: string, modifiedtsMs: number) => Record<string, PropValue>;
|
|
12
|
-
|
|
13
|
-
export type { ComputeAnnotatedProps as C, ElementInfo as E, PropValue as P };
|