@microsoft/webui 0.0.18 → 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/README.md +81 -18
- package/bin/webui +0 -0
- package/dist/index.d.ts +28 -35
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +55 -79
- package/dist/index.js.map +1 -1
- package/dist/projection/adapters/esbuild.d.ts +14 -0
- package/dist/projection/adapters/esbuild.d.ts.map +1 -0
- package/dist/projection/adapters/esbuild.js +426 -0
- package/dist/projection/adapters/esbuild.js.map +1 -0
- package/dist/projection/compiler.d.ts +12 -0
- package/dist/projection/compiler.d.ts.map +1 -0
- package/dist/projection/compiler.js +1166 -0
- package/dist/projection/compiler.js.map +1 -0
- package/dist/projection/diagnostics.d.ts +153 -0
- package/dist/projection/diagnostics.d.ts.map +1 -0
- package/dist/projection/diagnostics.js +210 -0
- package/dist/projection/diagnostics.js.map +1 -0
- package/dist/projection/fixtures/conformance.d.ts +40 -0
- package/dist/projection/fixtures/conformance.d.ts.map +1 -0
- package/dist/projection/fixtures/conformance.js +602 -0
- package/dist/projection/fixtures/conformance.js.map +1 -0
- package/dist/projection/graph.d.ts +144 -0
- package/dist/projection/graph.d.ts.map +1 -0
- package/dist/projection/graph.js +4 -0
- package/dist/projection/graph.js.map +1 -0
- package/dist/projection/index.d.ts +37 -0
- package/dist/projection/index.d.ts.map +1 -0
- package/dist/projection/index.js +17 -0
- package/dist/projection/index.js.map +1 -0
- package/dist/projection/loader.d.ts +10 -0
- package/dist/projection/loader.d.ts.map +1 -0
- package/dist/projection/loader.js +45 -0
- package/dist/projection/loader.js.map +1 -0
- package/dist/projection/manifest.d.ts +97 -0
- package/dist/projection/manifest.d.ts.map +1 -0
- package/dist/projection/manifest.js +340 -0
- package/dist/projection/manifest.js.map +1 -0
- package/package.json +31 -9
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalized module graph and adapter SPI for the bundler-neutral
|
|
3
|
+
* state projection compiler.
|
|
4
|
+
*
|
|
5
|
+
* The adapter SPI isolates bundler-specific semantics. The projection compiler
|
|
6
|
+
* (`compiler.ts`) consumes only these interfaces, never bundler-specific APIs.
|
|
7
|
+
*
|
|
8
|
+
* See DESIGN.md §"Bundler-Neutral State Projection Compiler" for the
|
|
9
|
+
* authoritative specification.
|
|
10
|
+
*/
|
|
11
|
+
/** Physical/virtual classification used for hashing and path validation. */
|
|
12
|
+
export type ModuleKind = "file" | "virtual";
|
|
13
|
+
/** One authored module specifier paired with the bundler-resolved target. */
|
|
14
|
+
export interface ResolvedImport {
|
|
15
|
+
/** Specifier exactly as authored in the importing source file. */
|
|
16
|
+
readonly specifier: string;
|
|
17
|
+
/**
|
|
18
|
+
* Canonical target module ID. Undefined only when `external` is true.
|
|
19
|
+
*
|
|
20
|
+
* The compiler never reconstructs this value from `specifier`.
|
|
21
|
+
*/
|
|
22
|
+
readonly resolvedId: string | undefined;
|
|
23
|
+
/** Whether the bundler left this dependency external. */
|
|
24
|
+
readonly external: boolean;
|
|
25
|
+
/** Static imports/re-exports participate in symbol resolution. */
|
|
26
|
+
readonly kind: "static" | "dynamic";
|
|
27
|
+
/**
|
|
28
|
+
* Owning package when the adapter can prove it.
|
|
29
|
+
*
|
|
30
|
+
* This lets aliases that resolve to `@microsoft/webui-framework` retain the
|
|
31
|
+
* same semantic identity without coupling the compiler to node_modules path
|
|
32
|
+
* layouts.
|
|
33
|
+
*/
|
|
34
|
+
readonly packageName?: string;
|
|
35
|
+
}
|
|
36
|
+
/** A single resolved module in the build graph. */
|
|
37
|
+
export interface ModuleNode {
|
|
38
|
+
/**
|
|
39
|
+
* Canonical absolute path on disk (always forward-slash, no query/hash).
|
|
40
|
+
*
|
|
41
|
+
* Virtual modules (no physical file) have an `id` beginning with `\0`
|
|
42
|
+
* (null byte). Their `source` may be provided but their physical `inputs`
|
|
43
|
+
* hash is `"virtual"`.
|
|
44
|
+
*/
|
|
45
|
+
readonly id: string;
|
|
46
|
+
/** Whether `id` identifies a physical file or a bundler-owned virtual module. */
|
|
47
|
+
readonly kind: ModuleKind;
|
|
48
|
+
/** Owning package identity, when proven by the adapter. */
|
|
49
|
+
readonly packageName?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Raw UTF-8 source text.
|
|
52
|
+
*
|
|
53
|
+
* Required for file modules. Virtual modules may omit source when they carry
|
|
54
|
+
* no analyzable WebUI code.
|
|
55
|
+
*/
|
|
56
|
+
readonly source: string | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Authored specifiers paired with their exact bundler-resolved targets.
|
|
59
|
+
*
|
|
60
|
+
* Keeping both values is essential: aliases, extension substitution,
|
|
61
|
+
* package exports, virtual namespaces, and plugin resolution cannot be
|
|
62
|
+
* reconstructed from source text.
|
|
63
|
+
*/
|
|
64
|
+
readonly imports: ReadonlyArray<ResolvedImport>;
|
|
65
|
+
}
|
|
66
|
+
/** The resolved input module graph as seen by the bundler. */
|
|
67
|
+
export interface ModuleGraph {
|
|
68
|
+
/**
|
|
69
|
+
* All modules reachable from the entry set, keyed by canonical ID.
|
|
70
|
+
*
|
|
71
|
+
* The compiler walks this map following `imports` edges. Modules absent from
|
|
72
|
+
* this map are not part of this build.
|
|
73
|
+
*/
|
|
74
|
+
readonly modules: ReadonlyMap<string, ModuleNode>;
|
|
75
|
+
/** Canonical entry module IDs; a subset of `modules.keys()`. */
|
|
76
|
+
readonly entries: ReadonlyArray<string>;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Maps each emitted output path to the input module IDs that contribute to it.
|
|
80
|
+
*
|
|
81
|
+
* This is the authoritative source for whether a component class was
|
|
82
|
+
* tree-shaken from the final bundle. A class whose defining module does not
|
|
83
|
+
* appear in any output's contributing set is excluded from the manifest.
|
|
84
|
+
*/
|
|
85
|
+
export interface OutputMembership {
|
|
86
|
+
/**
|
|
87
|
+
* Key: canonical absolute output ID, or a virtual ID beginning with `\0`.
|
|
88
|
+
*
|
|
89
|
+
* Value: set of canonical input module IDs (`ModuleNode.id`) whose code
|
|
90
|
+
* appears in this output after bundling and tree shaking.
|
|
91
|
+
*/
|
|
92
|
+
readonly outputs: ReadonlyMap<string, ReadonlySet<string>>;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Context passed from the bundler adapter to the projection compiler.
|
|
96
|
+
*
|
|
97
|
+
* The adapter constructs this from bundler-native structures and passes it
|
|
98
|
+
* to `compileProjection()`. The compiler never calls bundler APIs directly.
|
|
99
|
+
*/
|
|
100
|
+
export interface AdapterContext {
|
|
101
|
+
/** Resolved input module graph. */
|
|
102
|
+
readonly graph: ModuleGraph;
|
|
103
|
+
/** Final output→input membership from the bundler's tree shaking. */
|
|
104
|
+
readonly membership: OutputMembership;
|
|
105
|
+
/**
|
|
106
|
+
* Canonical absolute build root containing every physical input, output,
|
|
107
|
+
* and the manifest itself.
|
|
108
|
+
*
|
|
109
|
+
* Manifest file keys are relative to this root. The serialized manifest
|
|
110
|
+
* stores the root relative to its own directory (normally `".."` for a
|
|
111
|
+
* manifest under `dist/`).
|
|
112
|
+
*/
|
|
113
|
+
readonly rootDir: string;
|
|
114
|
+
/**
|
|
115
|
+
* Absolute disk path where the manifest will be written.
|
|
116
|
+
*
|
|
117
|
+
* Used by the compiler to compute canonical relative paths for all
|
|
118
|
+
* `outputs`, `inputs`, and `ComponentEntry.module` fields.
|
|
119
|
+
*/
|
|
120
|
+
readonly manifestPath: string;
|
|
121
|
+
/**
|
|
122
|
+
* Bundler adapter name, e.g. `"esbuild"`.
|
|
123
|
+
*
|
|
124
|
+
* Written to `manifest.adapter.name`.
|
|
125
|
+
*/
|
|
126
|
+
readonly bundlerName: string;
|
|
127
|
+
/**
|
|
128
|
+
* Bundler version string, e.g. `"0.28.1"`.
|
|
129
|
+
*
|
|
130
|
+
* Written to `manifest.adapter.bundler` as `"<bundlerName>@<bundlerVersion>"`.
|
|
131
|
+
*/
|
|
132
|
+
readonly bundlerVersion: string;
|
|
133
|
+
/**
|
|
134
|
+
* Exact bytes for emitted physical output files, keyed by the same absolute
|
|
135
|
+
* output ID used in `membership.outputs`.
|
|
136
|
+
*
|
|
137
|
+
* The compiler never reads files from disk. When an adapter can supply the
|
|
138
|
+
* Adapters must provide every physical output. Omitting one is a hard
|
|
139
|
+
* adapter-contract diagnostic; a disk output can never be marked virtual to
|
|
140
|
+
* bypass stale validation.
|
|
141
|
+
*/
|
|
142
|
+
readonly outputContents: ReadonlyMap<string, string | Uint8Array>;
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/projection/graph.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AAEH,4EAA4E;AAC5E,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,CAAC;AAE5C,6EAA6E;AAC7E,MAAM,WAAW,cAAc;IAC7B,kEAAkE;IAClE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAExC,yDAAyD;IACzD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAE3B,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;IAEpC;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,mDAAmD;AACnD,MAAM,WAAW,UAAU;IACzB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,iFAAiF;IACjF,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAE1B,2DAA2D;IAC3D,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAE9B;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAEpC;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;CACjD;AAED,8DAA8D;AAC9D,MAAM,WAAW,WAAW;IAC1B;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAElD,gEAAgE;IAChE,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACzC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;CAC5D;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,mCAAmC;IACnC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAE5B,qEAAqE;IACrE,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IAEtC;;;;;;;OAOG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAE9B;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B;;;;OAIG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAEhC;;;;;;;;OAQG;IACH,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC,CAAC;CACnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.js","sourceRoot":"","sources":["../../src/projection/graph.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@microsoft/webui/projection.js` — build-only state projection compiler subpath.
|
|
3
|
+
*
|
|
4
|
+
* This subpath is intentionally separate from the root `@microsoft/webui`
|
|
5
|
+
* entry so that render/build consumers do not load compiler or adapter code.
|
|
6
|
+
*
|
|
7
|
+
* Peer dependencies required by this subpath:
|
|
8
|
+
* - `typescript` ^6.0.3 (for TypeScript AST analysis)
|
|
9
|
+
* - `esbuild` ^0.28.1 (for the esbuild adapter only; other adapters have
|
|
10
|
+
* their own optional peer requirements)
|
|
11
|
+
*
|
|
12
|
+
* Both peers are optional in `package.json` so users of the root build/render
|
|
13
|
+
* API do not receive peer-missing warnings. Importing this subpath without the
|
|
14
|
+
* required peer produces `PROJ-P001` or `PROJ-P002`.
|
|
15
|
+
*
|
|
16
|
+
* See DESIGN.md §"Bundler-Neutral State Projection Compiler" for the
|
|
17
|
+
* authoritative specification.
|
|
18
|
+
*/
|
|
19
|
+
export type { ModuleKind, ResolvedImport, ModuleNode, ModuleGraph, OutputMembership, AdapterContext, } from "./graph.js";
|
|
20
|
+
export type { ProjectionManifest, ProducerInfo, AdapterInfo, ComponentEntry, } from "./manifest.js";
|
|
21
|
+
export { MANIFEST_SCHEMA, validateManifestSchema } from "./manifest.js";
|
|
22
|
+
export type { ProjectionCode, DiagnosticSeverity, ProjectionDiagnostic, } from "./diagnostics.js";
|
|
23
|
+
export { PROJECTION_CODES, CODE_SEVERITY, ProjectionError, } from "./diagnostics.js";
|
|
24
|
+
export type { ConformanceCase, ConformanceReport, ConformanceFailure, AdapterFactory, ConformanceSuiteOptions, } from "./fixtures/conformance.js";
|
|
25
|
+
export { runConformanceSuite, ALL_CASES } from "./fixtures/conformance.js";
|
|
26
|
+
export { VIRTUAL_HASH, hashContent, computeBuildId, serializeManifestCanonical, } from "./manifest.js";
|
|
27
|
+
/**
|
|
28
|
+
* Compile an exact state-projection manifest from an adapter-resolved graph.
|
|
29
|
+
*
|
|
30
|
+
* The implementation is loaded lazily so importing the subpath without the
|
|
31
|
+
* optional TypeScript peer produces a structured `PROJ-P001` diagnostic
|
|
32
|
+
* instead of Node's generic module-resolution error.
|
|
33
|
+
*/
|
|
34
|
+
export { compileProjection } from "./loader.js";
|
|
35
|
+
export type { EsbuildProjectionOptions } from "./adapters/esbuild.js";
|
|
36
|
+
export { esbuildProjection } from "./adapters/esbuild.js";
|
|
37
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/projection/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;GAiBG;AAGH,YAAY,EACV,UAAU,EACV,cAAc,EACd,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,cAAc,GACf,MAAM,YAAY,CAAC;AAGpB,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,cAAc,GACf,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAGxE,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAG1B,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,uBAAuB,GACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAG3E,OAAO,EACL,YAAY,EACZ,WAAW,EACX,cAAc,EACd,0BAA0B,GAC3B,MAAM,eAAe,CAAC;AAEvB;;;;;;GAMG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,YAAY,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
export { MANIFEST_SCHEMA, validateManifestSchema } from "./manifest.js";
|
|
4
|
+
export { PROJECTION_CODES, CODE_SEVERITY, ProjectionError, } from "./diagnostics.js";
|
|
5
|
+
export { runConformanceSuite, ALL_CASES } from "./fixtures/conformance.js";
|
|
6
|
+
// Manifest serialization/hash/build-ID utilities
|
|
7
|
+
export { VIRTUAL_HASH, hashContent, computeBuildId, serializeManifestCanonical, } from "./manifest.js";
|
|
8
|
+
/**
|
|
9
|
+
* Compile an exact state-projection manifest from an adapter-resolved graph.
|
|
10
|
+
*
|
|
11
|
+
* The implementation is loaded lazily so importing the subpath without the
|
|
12
|
+
* optional TypeScript peer produces a structured `PROJ-P001` diagnostic
|
|
13
|
+
* instead of Node's generic module-resolution error.
|
|
14
|
+
*/
|
|
15
|
+
export { compileProjection } from "./loader.js";
|
|
16
|
+
export { esbuildProjection } from "./adapters/esbuild.js";
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/projection/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAsClC,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAQxE,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAU1B,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAE3E,iDAAiD;AACjD,OAAO,EACL,YAAY,EACZ,WAAW,EACX,cAAc,EACd,0BAA0B,GAC3B,MAAM,eAAe,CAAC;AAEvB;;;;;;GAMG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAIhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AdapterContext } from "./graph.js";
|
|
2
|
+
import type { ProjectionManifest } from "./manifest.js";
|
|
3
|
+
/**
|
|
4
|
+
* Lazily load the TypeScript-backed compiler so a missing optional peer is
|
|
5
|
+
* surfaced as a stable projection diagnostic.
|
|
6
|
+
*/
|
|
7
|
+
export declare function compileProjection(context: AdapterContext): Promise<ProjectionManifest>;
|
|
8
|
+
/** Start compiler/TypeScript loading without waiting for semantic analysis. */
|
|
9
|
+
export declare function preloadProjectionCompiler(): Promise<void>;
|
|
10
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/projection/loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAMxD;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,kBAAkB,CAAC,CAG7B;AAED,+EAA+E;AAC/E,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAE/D"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { ProjectionError, createDiagnostic } from "./diagnostics.js";
|
|
4
|
+
let compilerModule;
|
|
5
|
+
/**
|
|
6
|
+
* Lazily load the TypeScript-backed compiler so a missing optional peer is
|
|
7
|
+
* surfaced as a stable projection diagnostic.
|
|
8
|
+
*/
|
|
9
|
+
export async function compileProjection(context) {
|
|
10
|
+
const compiler = await loadCompiler();
|
|
11
|
+
return compiler.compileProjection(context);
|
|
12
|
+
}
|
|
13
|
+
/** Start compiler/TypeScript loading without waiting for semantic analysis. */
|
|
14
|
+
export async function preloadProjectionCompiler() {
|
|
15
|
+
await loadCompiler();
|
|
16
|
+
}
|
|
17
|
+
function loadCompiler() {
|
|
18
|
+
compilerModule ??= importCompiler();
|
|
19
|
+
return compilerModule;
|
|
20
|
+
}
|
|
21
|
+
async function importCompiler() {
|
|
22
|
+
try {
|
|
23
|
+
return await import("./compiler.js");
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
if (isMissingTypeScriptPeer(error)) {
|
|
27
|
+
throw new ProjectionError([
|
|
28
|
+
createDiagnostic("PROJ-P001", {
|
|
29
|
+
help: "Install a compatible application-owned TypeScript peer (^6.0.3) before using @microsoft/webui/projection.js.",
|
|
30
|
+
}),
|
|
31
|
+
]);
|
|
32
|
+
}
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function isMissingTypeScriptPeer(error) {
|
|
37
|
+
if (!(error instanceof Error))
|
|
38
|
+
return false;
|
|
39
|
+
const code = error.code;
|
|
40
|
+
return (code === "ERR_MODULE_NOT_FOUND" &&
|
|
41
|
+
(error.message.includes("'typescript'") ||
|
|
42
|
+
error.message.includes('"typescript"') ||
|
|
43
|
+
error.message.includes("typescript/package.json")));
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/projection/loader.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAGrE,IAAI,cAAmD,CAAC;AAExD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,OAAuB;IAEvB,MAAM,QAAQ,GAAG,MAAM,YAAY,EAAE,CAAC;IACtC,OAAO,QAAQ,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;AAC7C,CAAC;AAED,+EAA+E;AAC/E,MAAM,CAAC,KAAK,UAAU,yBAAyB;IAC7C,MAAM,YAAY,EAAE,CAAC;AACvB,CAAC;AAED,SAAS,YAAY;IACnB,cAAc,KAAK,cAAc,EAAE,CAAC;IACpC,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,KAAK,UAAU,cAAc;IAC3B,IAAI,CAAC;QACH,OAAO,MAAM,MAAM,CAAC,eAAe,CAAC,CAAC;IACvC,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,IAAI,uBAAuB,CAAC,KAAK,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,eAAe,CAAC;gBACxB,gBAAgB,CAAC,WAAW,EAAE;oBAC5B,IAAI,EAAE,8GAA8G;iBACrH,CAAC;aACH,CAAC,CAAC;QACL,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,uBAAuB,CAAC,KAAc;IAC7C,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAC5C,MAAM,IAAI,GAAI,KAAoC,CAAC,IAAI,CAAC;IACxD,OAAO,CACL,IAAI,KAAK,sBAAsB;QAC/B,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC;YACrC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC;YACtC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAC,CACrD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/** The only valid schema string for this version. */
|
|
2
|
+
export declare const MANIFEST_SCHEMA: "webui.state-projection/v1";
|
|
3
|
+
export type ManifestSchema = typeof MANIFEST_SCHEMA;
|
|
4
|
+
/** Sentinel hash value for virtual modules/outputs with no physical bytes. */
|
|
5
|
+
export declare const VIRTUAL_HASH: "virtual";
|
|
6
|
+
/** Bytes accepted by the SHA-256 helpers. */
|
|
7
|
+
export type HashContent = string | Uint8Array;
|
|
8
|
+
/** Computes `"sha256:<64 lowercase hex>"` over exact UTF-8/byte content. */
|
|
9
|
+
export declare function hashContent(content: HashContent): string;
|
|
10
|
+
/** Cross-language lexical ordering: raw UTF-8 bytes, ascending. */
|
|
11
|
+
export declare function compareUtf8(left: string, right: string): number;
|
|
12
|
+
/**
|
|
13
|
+
* Computes the deterministic manifest `buildId`.
|
|
14
|
+
*
|
|
15
|
+
* Each canonical record is encoded as a record label followed by
|
|
16
|
+
* `<utf8-byte-length>:<value>` fields and one LF. Length-prefixing avoids
|
|
17
|
+
* delimiter ambiguity for paths and Unicode identifiers.
|
|
18
|
+
*/
|
|
19
|
+
export declare function computeBuildId(params: {
|
|
20
|
+
readonly producerName: string;
|
|
21
|
+
readonly producerVersion: string;
|
|
22
|
+
readonly adapterName: string;
|
|
23
|
+
readonly adapterBundler: string;
|
|
24
|
+
readonly root: string;
|
|
25
|
+
readonly analysisHash: string;
|
|
26
|
+
readonly sortedInputs: ReadonlyArray<readonly [string, string]>;
|
|
27
|
+
readonly sortedOutputs: ReadonlyArray<readonly [string, string]>;
|
|
28
|
+
readonly sortedComponents: ReadonlyArray<readonly [
|
|
29
|
+
tag: string,
|
|
30
|
+
module: string,
|
|
31
|
+
sortedOutputs: ReadonlyArray<string>,
|
|
32
|
+
sortedHydrationKeys: ReadonlyArray<string>,
|
|
33
|
+
sortedNavigationKeys: ReadonlyArray<string>
|
|
34
|
+
]>;
|
|
35
|
+
}): string;
|
|
36
|
+
/** Serializes a manifest to its canonical compact JSON form. */
|
|
37
|
+
export declare function serializeManifestCanonical(manifest: ProjectionManifest): string;
|
|
38
|
+
/** Root manifest type. */
|
|
39
|
+
export interface ProjectionManifest {
|
|
40
|
+
readonly schema: ManifestSchema;
|
|
41
|
+
readonly producer: ProducerInfo;
|
|
42
|
+
readonly adapter: AdapterInfo;
|
|
43
|
+
/**
|
|
44
|
+
* Build root relative to the manifest directory.
|
|
45
|
+
*
|
|
46
|
+
* `"."` or one/more parent segments (`".."`, `"../.."`). Every physical
|
|
47
|
+
* input/output/module path is relative to this root and contains no `..`.
|
|
48
|
+
*/
|
|
49
|
+
readonly root: string;
|
|
50
|
+
/** SHA-256 of normalized entries, graph edges, and output membership. */
|
|
51
|
+
readonly analysisHash: string;
|
|
52
|
+
/** Deterministic identifier covering the complete serialized proof. */
|
|
53
|
+
readonly buildId: string;
|
|
54
|
+
/** Root-relative output path to content hash. */
|
|
55
|
+
readonly outputs: Readonly<Record<string, string>>;
|
|
56
|
+
/** Root-relative/virtual input ID to content hash. */
|
|
57
|
+
readonly inputs: Readonly<Record<string, string>>;
|
|
58
|
+
/** Exact component surfaces keyed by custom-element tag. */
|
|
59
|
+
readonly components: Readonly<Record<string, ComponentEntry>>;
|
|
60
|
+
}
|
|
61
|
+
/** Identity of the tool that produced the manifest. */
|
|
62
|
+
export interface ProducerInfo {
|
|
63
|
+
readonly name: "@microsoft/webui/projection.js";
|
|
64
|
+
readonly version: string;
|
|
65
|
+
}
|
|
66
|
+
/** Identity of the bundler adapter. */
|
|
67
|
+
export interface AdapterInfo {
|
|
68
|
+
readonly name: string;
|
|
69
|
+
readonly bundler: string;
|
|
70
|
+
}
|
|
71
|
+
/** One shipped WebUI component's exact client state surface. */
|
|
72
|
+
export interface ComponentEntry {
|
|
73
|
+
/** Root-relative physical module path. */
|
|
74
|
+
readonly module: string;
|
|
75
|
+
/** Sorted root-relative/virtual outputs containing the defining module. */
|
|
76
|
+
readonly outputs: ReadonlyArray<string>;
|
|
77
|
+
/**
|
|
78
|
+
* Sorted exact `@observable + @attr` property names consumed during initial
|
|
79
|
+
* SSR bootstrap. Existing host attributes take precedence; state fills
|
|
80
|
+
* attribute-backed values that were not materialized on the SSR host.
|
|
81
|
+
*/
|
|
82
|
+
readonly hydrationKeys: ReadonlyArray<string>;
|
|
83
|
+
/**
|
|
84
|
+
* Sorted exact property names consumed by client-created/navigation state:
|
|
85
|
+
* `@observable` plus `@attr`. Attribute decorators still use the JavaScript
|
|
86
|
+
* property name because `setState()` addresses properties, not reflected
|
|
87
|
+
* HTML attribute names.
|
|
88
|
+
*/
|
|
89
|
+
readonly navigationKeys: ReadonlyArray<string>;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Validates a parsed manifest's structural and canonical invariants.
|
|
93
|
+
*
|
|
94
|
+
* Stale file validation is intentionally performed by the consuming host.
|
|
95
|
+
*/
|
|
96
|
+
export declare function validateManifestSchema(value: unknown): string[];
|
|
97
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/projection/manifest.ts"],"names":[],"mappings":"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"}
|