@openelement/protocol 1.0.0-alpha.13 → 1.0.0-alpha.15
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 +5 -4
- package/package.json +6 -1
- package/src/client-assets.js +1 -0
- package/src/diagnostics.d.ts +93 -0
- package/src/diagnostics.js +110 -0
- package/src/errors.d.ts +58 -15
- package/src/errors.js +59 -16
- package/src/forbidden-sinks.js +1 -1
- package/src/framework.d.ts +51 -25
- package/src/index.d.ts +10 -8
- package/src/index.js +4 -2
- package/src/island.d.ts +14 -0
- package/src/manifest.d.ts +28 -0
- package/src/part-program.d.ts +13 -13
- package/src/part-program.js +92 -52
- package/src/policy.d.ts +2 -2
- package/src/policy.js +2 -2
- package/src/render.d.ts +2 -22
- package/src/ssg.d.ts +39 -25
- package/src/stream-frame-policy.d.ts +1 -1
- package/src/stream-frame-policy.js +1 -1
- package/src/style-sheet.d.ts +45 -1
- package/src/style-sheet.js +47 -1
package/src/framework.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/framework.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* framework.ts - Framework, build,
|
|
3
|
+
* framework.ts - Framework, build, layout, routing, and plugin
|
|
4
4
|
* metadata contracts.
|
|
5
5
|
*/
|
|
6
6
|
/** Branded type: a string that has been HTML-escaped (safe for text content) */
|
|
@@ -76,18 +76,18 @@ export interface LocalePath {
|
|
|
76
76
|
isDefaultLocalePath: boolean;
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
|
-
*
|
|
80
|
-
* `'default'` uses the built-in
|
|
79
|
+
* Layout declaration: `false` disables the layout entirely,
|
|
80
|
+
* `'default'` uses the built-in layout, and the object form names a tag with the
|
|
81
81
|
* module path that defines it (`import`, resolved like a
|
|
82
|
-
* {@link FrameworkOptions.middleware.use} entry) plus the compiled
|
|
82
|
+
* {@link FrameworkOptions.middleware.use} entry) plus the compiled layout
|
|
83
83
|
* properties the router injects per route.
|
|
84
84
|
*/
|
|
85
|
-
export type
|
|
85
|
+
export type LayoutConfig = false | 'default' | {
|
|
86
86
|
tagName: string;
|
|
87
87
|
import: string;
|
|
88
88
|
props?: Record<string, unknown>;
|
|
89
89
|
};
|
|
90
|
-
type LayoutsConfig = Record<string,
|
|
90
|
+
type LayoutsConfig = Record<string, LayoutConfig | undefined>;
|
|
91
91
|
/**
|
|
92
92
|
* One route admitted by the scanner: URL `path`, source `filePath`, the
|
|
93
93
|
* route `type`, the generated variable name (`varName`) the entry binds it to,
|
|
@@ -110,6 +110,17 @@ export interface RouteEntry {
|
|
|
110
110
|
* registration tag.
|
|
111
111
|
*/
|
|
112
112
|
definePage?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* The server function page fact (alpha15 server lane): the exported server
|
|
115
|
+
* function component the route's `export default definePage(Component)` was
|
|
116
|
+
* called over. Present only when the argument is a plain identifier
|
|
117
|
+
* resolving to a component THIS module declares — an inline arrow or an
|
|
118
|
+
* unexported local never records it (the R1 admission rule mirrored, so a
|
|
119
|
+
* shape whose JSX would escape to runtime is never admitted). The generated
|
|
120
|
+
* entry registers nothing for the route and renders it through the
|
|
121
|
+
* descriptor's compiled render function.
|
|
122
|
+
*/
|
|
123
|
+
functionPage?: string;
|
|
113
124
|
/** Source text captured during scanning when includeSource is enabled. */
|
|
114
125
|
source?: string;
|
|
115
126
|
/**
|
|
@@ -139,8 +150,8 @@ export interface RouteEntry {
|
|
|
139
150
|
*/
|
|
140
151
|
export type Middleware = (request: Request, next: () => Promise<Response>) => Promise<Response>;
|
|
141
152
|
/**
|
|
142
|
-
* The adapter-facing framework options: where routes
|
|
143
|
-
* live, which renderer serializes pages, the
|
|
153
|
+
* The adapter-facing framework options: where routes and islands
|
|
154
|
+
* live, which renderer serializes pages, the default layout and named-layout
|
|
144
155
|
* declarations, the document `<html>`/head injection channels, and the
|
|
145
156
|
* request-time middleware switches.
|
|
146
157
|
*
|
|
@@ -152,27 +163,42 @@ export interface FrameworkOptions {
|
|
|
152
163
|
/**
|
|
153
164
|
* Page renderer selection (Beta.2.2, #1339). EXPLICIT, never inferred:
|
|
154
165
|
* 'native' (default) renders pages through the compiled Part Program
|
|
155
|
-
* serializer (
|
|
166
|
+
* serializer (renderToString); 'lit' renders LitElement pages through
|
|
156
167
|
* @lit-labs/ssr and hydrates them with @lit-labs/ssr-client. Routing,
|
|
157
168
|
* loaders, actions, form enhancement and morphing are shared; only page
|
|
158
169
|
* rendering and the client claim layer fork. 'lit' currently requires
|
|
159
|
-
* `
|
|
170
|
+
* `layout: false` (no compiled layout); the build fails closed otherwise.
|
|
160
171
|
*/
|
|
161
172
|
renderer?: 'native' | 'lit';
|
|
162
173
|
/** Directory the route scanner walks, relative to the Vite root. Defaults to `app/routes`. */
|
|
163
174
|
routesDir?: string;
|
|
164
175
|
/** Directory island modules are discovered in. Defaults to `app/islands`. */
|
|
165
176
|
islandsDir?: string;
|
|
166
|
-
/**
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
177
|
+
/**
|
|
178
|
+
* How the build admits component packages whose modules the application
|
|
179
|
+
* imports.
|
|
180
|
+
*
|
|
181
|
+
* - omitted or `'auto'` (the default): the scan derives the admitted set at
|
|
182
|
+
* scan time — every package-owned element module the app's routes, pages,
|
|
183
|
+
* layouts, islands and components really reach (bundler-resolved) is
|
|
184
|
+
* attributed to its owner package (nearest `package.json`), and a package
|
|
185
|
+
* with a valid OpenElement manifest is admitted. An array value merges with
|
|
186
|
+
* the derivation; an explicit entry outranks a derived claim when two
|
|
187
|
+
* packages claim the same tag.
|
|
188
|
+
* - `'manual'`: derivation off — the pre-auto behavior. Nothing is admitted
|
|
189
|
+
* unless listed, and an imported-but-unlisted component package is
|
|
190
|
+
* reported with the explicit fix.
|
|
191
|
+
* - `string[]`: admitted explicitly, on top of the derivation (auto mode).
|
|
192
|
+
*
|
|
193
|
+
* A package whose modules the app imports but which carries no valid
|
|
194
|
+
* manifest is never admitted (there is nothing to admit) and is reported —
|
|
195
|
+
* the one true mistake class the report keeps under auto.
|
|
196
|
+
*/
|
|
197
|
+
packageIslands?: string[] | 'auto' | 'manual';
|
|
198
|
+
/** Layout declaration; `false` disables the layout, `'default'` uses the built-in one. */
|
|
199
|
+
layout?: LayoutConfig;
|
|
200
|
+
/** Named layout declarations keyed by layout name. */
|
|
173
201
|
layouts?: LayoutsConfig;
|
|
174
|
-
/** Build mode. 'ssg' (default) generates static HTML. */
|
|
175
|
-
mode?: 'ssg';
|
|
176
202
|
/** @dangerous injected as-is, only use with controlled content */
|
|
177
203
|
headExtras?: string;
|
|
178
204
|
/** Document `<html>` attributes: the `lang` the document declares and the default `<title>`. */
|
|
@@ -240,7 +266,7 @@ export interface FrameworkOptions {
|
|
|
240
266
|
};
|
|
241
267
|
/** Request-time middleware switches, composed outside the framework handler. */
|
|
242
268
|
middleware?: {
|
|
243
|
-
/**
|
|
269
|
+
/** Built-in CORS middleware. Default-ON; pass `false` to disable. */
|
|
244
270
|
cors?: boolean;
|
|
245
271
|
/**
|
|
246
272
|
* Static CORS allowlist data, serialized into the generated entry as JSON.
|
|
@@ -252,15 +278,15 @@ export interface FrameworkOptions {
|
|
|
252
278
|
* `(origin: string) => string | undefined`. The generated entry imports
|
|
253
279
|
* the module — the callback is never serialized — so it may close over
|
|
254
280
|
* module scope and import dependencies. Resolved with the same idiom as
|
|
255
|
-
* `
|
|
281
|
+
* `layout.import` (e.g. './app/cors-origin.ts'). Mutually exclusive
|
|
256
282
|
* with `corsOrigin`.
|
|
257
283
|
*/
|
|
258
284
|
corsOriginModule?: string;
|
|
259
|
-
/** Emit and honor a per-request id header. */
|
|
285
|
+
/** Emit and honor a per-request id header. Default-ON; pass `false` to disable. */
|
|
260
286
|
requestId?: boolean;
|
|
261
|
-
/** Log each request through the built-in logger. */
|
|
287
|
+
/** Log each request through the built-in logger. Default-ON; pass `false` to disable. */
|
|
262
288
|
logger?: boolean;
|
|
263
|
-
/** Attach the built-in security response headers. */
|
|
289
|
+
/** Attach the built-in security response headers. Default-ON; pass `false` to disable. */
|
|
264
290
|
securityHeaders?: boolean;
|
|
265
291
|
/** Content-Security-Policy emission: the policy string, nonce generation, and report-only mode. */
|
|
266
292
|
csp?: {
|
|
@@ -272,7 +298,7 @@ export interface FrameworkOptions {
|
|
|
272
298
|
* Fetch middleware chain (#858), composed around the
|
|
273
299
|
* framework handler in onion order (`use[0]` outermost), outside all
|
|
274
300
|
* built-in middleware above. Each entry is a MODULE PATH (same resolution
|
|
275
|
-
* idiom as `
|
|
301
|
+
* idiom as `layout.import`, e.g. './app/middleware/auth.ts') whose
|
|
276
302
|
* default export is a {@link Middleware}; the generated entry emits
|
|
277
303
|
* `import * as __mw_N from '<path>'` and composes `__mw_N.default` in
|
|
278
304
|
* configured order.
|
package/src/index.d.ts
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { OpenElementRouteKind, OpenElementRouteNode } from "./app-model.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { CompatibilityClassification, CompatibilityTier, ComponentLayer, FrameworkOptions, HYDRATION_STRATEGIES, HydrationStrategy, LayoutConfig, LocalePath, Middleware, OpenElementBlogOptions, OpenElementBuildContextLike, OpenElementHeaderNavLink, OpenElementI18nContextOptions, OpenElementNavSection, RouteEntry, SafeHtml, SpecialFileType, StrategySource, UnsafeHtml } from "./framework.js";
|
|
3
|
+
import { AuthoringErrorCode, ClaimErrorCode, CompilerErrorCode, ContextErrorCode, DEFAULT_RENDER_ERROR_CODE, ERROR_PREFIX, EachKeyErrorCode, ErrorCode, ErrorPhase, ErrorSeverity, ErrorTelemetryHook, FacadeErrorCode, KernelErrorCode, OpenElementError, OpenElementErrorOptions, ProgramErrorCode, RUNTIME_MESSAGES_ENABLED, RuntimeErrorCode, ServerErrorCode, StyleErrorCode, frameworkError, raiseFrameworkError } from "./errors.js";
|
|
4
|
+
import { HydrationHint, RenderError, SsrAdmissionDecision } from "./render.js";
|
|
4
5
|
import { VOID_TAGS } from "./void-tags.js";
|
|
5
|
-
import { COMPILED_MODULE_ABI_VERSION, CemPropertyMetadata, CompiledCemMetadata, CompiledElementMetadata, CompiledPropertyMetadata, ConditionOperator, DATA_OE_LIGHT, ItemEventBinding, PART_PROGRAM_VERSION, PartProgram,
|
|
6
|
-
import { ApiRouteDecl,
|
|
6
|
+
import { COMPILED_MODULE_ABI_VERSION, CemPropertyMetadata, CompiledCemMetadata, CompiledElementMetadata, CompiledPropertyMetadata, ConditionOperator, DATA_OE_LIGHT, ItemEventBinding, PART_PROGRAM_VERSION, PartProgram, PartProgramV2, ProgramAttrPart, ProgramBlockRecord, ProgramBoolPart, ProgramClassPart, ProgramCondition, ProgramDependencyRecord, ProgramEachPart, ProgramElementNode, ProgramEventAction, ProgramEventPart, ProgramHtmlPart, ProgramItemValueNode, ProgramLocation, ProgramLocationRecord, ProgramPart, ProgramPartAnchorNode, ProgramPosition, ProgramPropPart, ProgramRefPart, ProgramRoot, ProgramSourceKind, ProgramSourceMap, ProgramSourceRange, ProgramSourceRecord, ProgramStylePart, ProgramTextNode, ProgramTextPart, ProgramTreeNode, ProgramWhenPart, PropertyValueType, RootMode, STATIC_STYLES_MARKER, SerializableValue, conditionLiteralAllowed, isAttributeName, partAnchorEndMarker, partAnchorMarker, validatePartProgram } from "./part-program.js";
|
|
7
|
+
import { ApiRouteDecl, BuildArtifacts, BuildClientAsset, BuildI18nOptions, BuildIslandInput, BuildManifestArtifact, BuildOutputOptions, BuildPackageIslandOptions, BuildPageArtifact, BuildPlan, BuildRouteInput, ClientIslandEntry, CorsOriginConfig, CspConfig, DocumentConfig, EntryDescriptor, ImportDecl, IslandDecl, IslandDeliveryStrategy, IslandModuleIdentity, LayoutDecl, LayoutPlan, MiddlewareDecl, MiddlewareScopeDecl, PageRouteDecl, RendererDecl, ResolvedLayout, RouteInfoEntry, SpeculationRulesOptions, SsgBehaviorOptions, SsgPageOutput, SsgRenderEvidence, SsgRenderOptions, SsgRenderSummary, SsrAdmissionPlan, SsrBundle, StaticComponentDecl, StreamRouteManifest } from "./ssg.js";
|
|
7
8
|
import { ClientAssetManifest, ClientIslandAsset, EMPTY_CLIENT_ASSET_MANIFEST, serializeClientAssetsModule } from "./client-assets.js";
|
|
8
9
|
import { ACTION_FETCH_HEADER, Action, ActionContext, ActionResult, Loader, LoaderContext, PROBLEM_JSON_MEDIA_TYPE, ProblemDetails, ServerRouteContext, ServerRouteMetadata } from "./data.js";
|
|
9
|
-
import {
|
|
10
|
+
import { DIAGNOSTIC_REPORT_FORMAT, DiagnosticEnvelope, DiagnosticPhase, DiagnosticReport, DiagnosticReportFormat, DiagnosticReportParseError, DiagnosticSeverity, diagnosticReport, errorToEnvelope, parseDiagnosticReport, serializeDiagnosticReport } from "./diagnostics.js";
|
|
10
11
|
import { FORBIDDEN_ATTRIBUTE_NAMES, FORBIDDEN_PROPERTY_NAMES, ForbiddenSinkKind, RAW_TEXT_TAGS, camelToKebab, forbiddenSinkReason, isSafeAttributeName } from "./forbidden-sinks.js";
|
|
12
|
+
import { ModuleVocabularyDescriptor, StaticSidecarDescriptor } from "./module-descriptors.js";
|
|
11
13
|
import { ISLAND_ADMISSION } from "./island-admission.js";
|
|
12
14
|
import { IslandOptions, IslandTransformOptions, IslandTransformResult } from "./island.js";
|
|
13
|
-
import { CemCompatibilityReport, OpenElementAttribute, OpenElementCssPart, OpenElementDeclaration, OpenElementEvent, OpenElementExtensions, OpenElementPackageManifest, OpenElementSlot } from "./manifest.js";
|
|
15
|
+
import { CemCompatibilityReport, OpenElementAttribute, OpenElementCssPart, OpenElementDeclaration, OpenElementEvent, OpenElementExtensions, OpenElementPackageManifest, OpenElementSlot, OpenElementTailwindDeclaration } from "./manifest.js";
|
|
14
16
|
import { ROUTER_MODULE_VOCABULARY } from "./module-vocabulary.js";
|
|
15
17
|
import { IDLE_FALLBACK_TIMEOUT_MS, MAX_ACTION_BODY_BYTES, MAX_COMPOSITION_DEPTH, STREAM_MAX_FIELDS, STREAM_MAX_OWNERS, STREAM_MAX_PAYLOAD_LENGTH, STREAM_MAX_SEED_PROPERTIES, STREAM_TIMEOUT_MS } from "./policy.js";
|
|
16
18
|
import { ENTRY_REGISTRATION_OWNERS, SSR_REGISTRY_ORIGINAL_DEFINE, SSR_REGISTRY_STUB_MARKER } from "./registry-markers.js";
|
|
17
19
|
import { OpenElementRequestHandler, RuntimeAdapter, RuntimeAdapterOptions, RuntimeContext } from "./runtime.js";
|
|
18
20
|
import { ReadonlySignal, SIGNAL_BRAND, Signal, SignalEngine, SignalLike, Unsubscribe, WritableSignal } from "./signal.js";
|
|
19
21
|
import { STREAM_FRAME_FORBIDDEN_TAGS, STREAM_FRAME_UNSAFE_URL, STREAM_FRAME_URL_ATTRIBUTES, STREAM_FRAME_URL_CONTROL_MAX, unsafeStreamFrameAttribute } from "./stream-frame-policy.js";
|
|
20
|
-
import { StyleSheetLike, StyleSheetRule } from "./style-sheet.js";
|
|
21
|
-
export { ACTION_FETCH_HEADER, Action, ActionContext, ActionResult, ApiRouteDecl,
|
|
22
|
+
import { STYLE_SHEET_LIVE, STYLE_SHEET_READY, STYLE_SHEET_URL, StyleSheetLike, StyleSheetRule } from "./style-sheet.js";
|
|
23
|
+
export { ACTION_FETCH_HEADER, Action, ActionContext, ActionResult, ApiRouteDecl, AuthoringErrorCode, BuildArtifacts, BuildClientAsset, BuildI18nOptions, BuildIslandInput, BuildManifestArtifact, BuildOutputOptions, BuildPackageIslandOptions, BuildPageArtifact, BuildPlan, BuildRouteInput, COMPILED_MODULE_ABI_VERSION, CemCompatibilityReport, CemPropertyMetadata, ClaimErrorCode, ClientAssetManifest, ClientIslandAsset, ClientIslandEntry, CompatibilityClassification, CompatibilityTier, CompiledCemMetadata, CompiledElementMetadata, CompiledPropertyMetadata, CompilerErrorCode, ComponentLayer, ConditionOperator, ContextErrorCode, CorsOriginConfig, CspConfig, DATA_OE_LIGHT, DEFAULT_RENDER_ERROR_CODE, DIAGNOSTIC_REPORT_FORMAT, DiagnosticEnvelope, DiagnosticPhase, DiagnosticReport, DiagnosticReportFormat, DiagnosticReportParseError, DiagnosticSeverity, DocumentConfig, EMPTY_CLIENT_ASSET_MANIFEST, ENTRY_REGISTRATION_OWNERS, ERROR_PREFIX, EachKeyErrorCode, EntryDescriptor, ErrorCode, ErrorPhase, ErrorSeverity, ErrorTelemetryHook, FORBIDDEN_ATTRIBUTE_NAMES, FORBIDDEN_PROPERTY_NAMES, FacadeErrorCode, ForbiddenSinkKind, FrameworkOptions, HYDRATION_STRATEGIES, HydrationHint, HydrationStrategy, IDLE_FALLBACK_TIMEOUT_MS, ISLAND_ADMISSION, ImportDecl, IslandDecl, IslandDeliveryStrategy, IslandModuleIdentity, IslandOptions, IslandTransformOptions, IslandTransformResult, ItemEventBinding, KernelErrorCode, LayoutConfig, LayoutDecl, LayoutPlan, Loader, LoaderContext, LocalePath, MAX_ACTION_BODY_BYTES, MAX_COMPOSITION_DEPTH, Middleware, MiddlewareDecl, MiddlewareScopeDecl, ModuleVocabularyDescriptor, OpenElementAttribute, OpenElementBlogOptions, OpenElementBuildContextLike, OpenElementCssPart, OpenElementDeclaration, OpenElementError, OpenElementErrorOptions, OpenElementEvent, OpenElementExtensions, OpenElementHeaderNavLink, OpenElementI18nContextOptions, OpenElementNavSection, OpenElementPackageManifest, OpenElementRequestHandler, OpenElementRouteKind, OpenElementRouteNode, OpenElementSlot, OpenElementTailwindDeclaration, PART_PROGRAM_VERSION, PROBLEM_JSON_MEDIA_TYPE, PageRouteDecl, PartProgram, PartProgramV2, ProblemDetails, ProgramAttrPart, ProgramBlockRecord, ProgramBoolPart, ProgramClassPart, ProgramCondition, ProgramDependencyRecord, ProgramEachPart, ProgramElementNode, ProgramErrorCode, ProgramEventAction, ProgramEventPart, ProgramHtmlPart, ProgramItemValueNode, ProgramLocation, ProgramLocationRecord, ProgramPart, ProgramPartAnchorNode, ProgramPosition, ProgramPropPart, ProgramRefPart, ProgramRoot, ProgramSourceKind, ProgramSourceMap, ProgramSourceRange, ProgramSourceRecord, ProgramStylePart, ProgramTextNode, ProgramTextPart, ProgramTreeNode, ProgramWhenPart, PropertyValueType, RAW_TEXT_TAGS, ROUTER_MODULE_VOCABULARY, RUNTIME_MESSAGES_ENABLED, ReadonlySignal, RenderError, RendererDecl, ResolvedLayout, RootMode, RouteEntry, RouteInfoEntry, RuntimeAdapter, RuntimeAdapterOptions, RuntimeContext, RuntimeErrorCode, SIGNAL_BRAND, SSR_REGISTRY_ORIGINAL_DEFINE, SSR_REGISTRY_STUB_MARKER, STATIC_STYLES_MARKER, STREAM_FRAME_FORBIDDEN_TAGS, STREAM_FRAME_UNSAFE_URL, STREAM_FRAME_URL_ATTRIBUTES, STREAM_FRAME_URL_CONTROL_MAX, STREAM_MAX_FIELDS, STREAM_MAX_OWNERS, STREAM_MAX_PAYLOAD_LENGTH, STREAM_MAX_SEED_PROPERTIES, STREAM_TIMEOUT_MS, STYLE_SHEET_LIVE, STYLE_SHEET_READY, STYLE_SHEET_URL, SafeHtml, SerializableValue, ServerErrorCode, ServerRouteContext, ServerRouteMetadata, Signal, SignalEngine, SignalLike, SpecialFileType, SpeculationRulesOptions, SsgBehaviorOptions, SsgPageOutput, SsgRenderEvidence, SsgRenderOptions, SsgRenderSummary, SsrAdmissionDecision, SsrAdmissionPlan, SsrBundle, StaticComponentDecl, StaticSidecarDescriptor, StrategySource, StreamRouteManifest, StyleErrorCode, StyleSheetLike, StyleSheetRule, UnsafeHtml, Unsubscribe, VOID_TAGS, WritableSignal, camelToKebab, conditionLiteralAllowed, diagnosticReport, errorToEnvelope, forbiddenSinkReason, frameworkError, isAttributeName, isSafeAttributeName, parseDiagnosticReport, partAnchorEndMarker, partAnchorMarker, raiseFrameworkError, serializeClientAssetsModule, serializeDiagnosticReport, unsafeStreamFrameAttribute, validatePartProgram };
|
package/src/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import "./app-model.js";
|
|
2
2
|
import { EMPTY_CLIENT_ASSET_MANIFEST, serializeClientAssetsModule } from "./client-assets.js";
|
|
3
3
|
import { ACTION_FETCH_HEADER, PROBLEM_JSON_MEDIA_TYPE } from "./data.js";
|
|
4
|
+
import { DIAGNOSTIC_REPORT_FORMAT, DiagnosticReportParseError, diagnosticReport, errorToEnvelope, parseDiagnosticReport, serializeDiagnosticReport } from "./diagnostics.js";
|
|
4
5
|
import { AuthoringErrorCode, ClaimErrorCode, CompilerErrorCode, ContextErrorCode, DEFAULT_RENDER_ERROR_CODE, ERROR_PREFIX, EachKeyErrorCode, ErrorCode, FacadeErrorCode, KernelErrorCode, OpenElementError, ProgramErrorCode, RUNTIME_MESSAGES_ENABLED, RuntimeErrorCode, ServerErrorCode, StyleErrorCode, frameworkError, raiseFrameworkError } from "./errors.js";
|
|
5
6
|
import { FORBIDDEN_ATTRIBUTE_NAMES, FORBIDDEN_PROPERTY_NAMES, RAW_TEXT_TAGS, camelToKebab, forbiddenSinkReason, isSafeAttributeName } from "./forbidden-sinks.js";
|
|
6
7
|
import { HYDRATION_STRATEGIES } from "./framework.js";
|
|
7
8
|
import { ISLAND_ADMISSION } from "./island-admission.js";
|
|
8
9
|
import "./island.js";
|
|
9
10
|
import "./manifest.js";
|
|
11
|
+
import "./module-descriptors.js";
|
|
10
12
|
import { ROUTER_MODULE_VOCABULARY } from "./module-vocabulary.js";
|
|
11
13
|
import { VOID_TAGS } from "./void-tags.js";
|
|
12
14
|
import { COMPILED_MODULE_ABI_VERSION, DATA_OE_LIGHT, PART_PROGRAM_VERSION, STATIC_STYLES_MARKER, conditionLiteralAllowed, isAttributeName, partAnchorEndMarker, partAnchorMarker, validatePartProgram } from "./part-program.js";
|
|
@@ -17,5 +19,5 @@ import "./runtime.js";
|
|
|
17
19
|
import { SIGNAL_BRAND } from "./signal.js";
|
|
18
20
|
import "./ssg.js";
|
|
19
21
|
import { STREAM_FRAME_FORBIDDEN_TAGS, STREAM_FRAME_UNSAFE_URL, STREAM_FRAME_URL_ATTRIBUTES, STREAM_FRAME_URL_CONTROL_MAX, unsafeStreamFrameAttribute } from "./stream-frame-policy.js";
|
|
20
|
-
import "./style-sheet.js";
|
|
21
|
-
export { ACTION_FETCH_HEADER, AuthoringErrorCode, COMPILED_MODULE_ABI_VERSION, ClaimErrorCode, CompilerErrorCode, ContextErrorCode, DATA_OE_LIGHT, DEFAULT_RENDER_ERROR_CODE, EMPTY_CLIENT_ASSET_MANIFEST, ENTRY_REGISTRATION_OWNERS, ERROR_PREFIX, EachKeyErrorCode, ErrorCode, FORBIDDEN_ATTRIBUTE_NAMES, FORBIDDEN_PROPERTY_NAMES, FacadeErrorCode, HYDRATION_STRATEGIES, IDLE_FALLBACK_TIMEOUT_MS, ISLAND_ADMISSION, KernelErrorCode, MAX_ACTION_BODY_BYTES, MAX_COMPOSITION_DEPTH, OpenElementError, PART_PROGRAM_VERSION, PROBLEM_JSON_MEDIA_TYPE, ProgramErrorCode, RAW_TEXT_TAGS, ROUTER_MODULE_VOCABULARY, RUNTIME_MESSAGES_ENABLED, RuntimeErrorCode, SIGNAL_BRAND, SSR_REGISTRY_ORIGINAL_DEFINE, SSR_REGISTRY_STUB_MARKER, STATIC_STYLES_MARKER, STREAM_FRAME_FORBIDDEN_TAGS, STREAM_FRAME_UNSAFE_URL, STREAM_FRAME_URL_ATTRIBUTES, STREAM_FRAME_URL_CONTROL_MAX, STREAM_MAX_FIELDS, STREAM_MAX_OWNERS, STREAM_MAX_PAYLOAD_LENGTH, STREAM_MAX_SEED_PROPERTIES, STREAM_TIMEOUT_MS, ServerErrorCode, StyleErrorCode, VOID_TAGS, camelToKebab, conditionLiteralAllowed, forbiddenSinkReason, frameworkError, isAttributeName, isSafeAttributeName, partAnchorEndMarker, partAnchorMarker, raiseFrameworkError, serializeClientAssetsModule, unsafeStreamFrameAttribute, validatePartProgram };
|
|
22
|
+
import { STYLE_SHEET_LIVE, STYLE_SHEET_READY, STYLE_SHEET_URL } from "./style-sheet.js";
|
|
23
|
+
export { ACTION_FETCH_HEADER, AuthoringErrorCode, COMPILED_MODULE_ABI_VERSION, ClaimErrorCode, CompilerErrorCode, ContextErrorCode, DATA_OE_LIGHT, DEFAULT_RENDER_ERROR_CODE, DIAGNOSTIC_REPORT_FORMAT, DiagnosticReportParseError, EMPTY_CLIENT_ASSET_MANIFEST, ENTRY_REGISTRATION_OWNERS, ERROR_PREFIX, EachKeyErrorCode, ErrorCode, FORBIDDEN_ATTRIBUTE_NAMES, FORBIDDEN_PROPERTY_NAMES, FacadeErrorCode, HYDRATION_STRATEGIES, IDLE_FALLBACK_TIMEOUT_MS, ISLAND_ADMISSION, KernelErrorCode, MAX_ACTION_BODY_BYTES, MAX_COMPOSITION_DEPTH, OpenElementError, PART_PROGRAM_VERSION, PROBLEM_JSON_MEDIA_TYPE, ProgramErrorCode, RAW_TEXT_TAGS, ROUTER_MODULE_VOCABULARY, RUNTIME_MESSAGES_ENABLED, RuntimeErrorCode, SIGNAL_BRAND, SSR_REGISTRY_ORIGINAL_DEFINE, SSR_REGISTRY_STUB_MARKER, STATIC_STYLES_MARKER, STREAM_FRAME_FORBIDDEN_TAGS, STREAM_FRAME_UNSAFE_URL, STREAM_FRAME_URL_ATTRIBUTES, STREAM_FRAME_URL_CONTROL_MAX, STREAM_MAX_FIELDS, STREAM_MAX_OWNERS, STREAM_MAX_PAYLOAD_LENGTH, STREAM_MAX_SEED_PROPERTIES, STREAM_TIMEOUT_MS, STYLE_SHEET_LIVE, STYLE_SHEET_READY, STYLE_SHEET_URL, ServerErrorCode, StyleErrorCode, VOID_TAGS, camelToKebab, conditionLiteralAllowed, diagnosticReport, errorToEnvelope, forbiddenSinkReason, frameworkError, isAttributeName, isSafeAttributeName, parseDiagnosticReport, partAnchorEndMarker, partAnchorMarker, raiseFrameworkError, serializeClientAssetsModule, serializeDiagnosticReport, unsafeStreamFrameAttribute, validatePartProgram };
|
package/src/island.d.ts
CHANGED
|
@@ -35,6 +35,20 @@ export interface IslandTransformOptions {
|
|
|
35
35
|
islandsDir: string;
|
|
36
36
|
/** Absolute or relative file path of the source being processed */
|
|
37
37
|
filePath: string;
|
|
38
|
+
/**
|
|
39
|
+
* Layout-convention admission (alpha15 R batch 3): the resolved layout
|
|
40
|
+
* module the router convention owns (`app/layout.tsx`, tag `app-layout`,
|
|
41
|
+
* or a project-relative custom `layout: { import }` override). The gate
|
|
42
|
+
* admits this one path with its resolved tag even though it lives outside
|
|
43
|
+
* `islandsDir`. Absent when the project configures no layout module
|
|
44
|
+
* (`layout: false`, or the deletable convention file is gone).
|
|
45
|
+
*/
|
|
46
|
+
layout?: {
|
|
47
|
+
/** Project-relative layout module path (e.g. "app/layout.tsx") */
|
|
48
|
+
path: string;
|
|
49
|
+
/** Resolved layout tag (e.g. "app-layout") */
|
|
50
|
+
tagName: string;
|
|
51
|
+
};
|
|
38
52
|
}
|
|
39
53
|
/** The island transform output: rewritten source plus extracted facts. */
|
|
40
54
|
export interface IslandTransformResult {
|
package/src/manifest.d.ts
CHANGED
|
@@ -25,6 +25,33 @@ export interface OpenElementCssPart {
|
|
|
25
25
|
name: string;
|
|
26
26
|
description?: string;
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* A declaration's utility-compilation requirement and the package-owned style
|
|
30
|
+
* sources that requirement compiles (the declared-compilation contract; see
|
|
31
|
+
* the router's `style-plan` module for the resolution rules).
|
|
32
|
+
*
|
|
33
|
+
* `required` is the mandatory-compilation dependency: the component's
|
|
34
|
+
* presentation cannot be delivered without the compile, so an application that
|
|
35
|
+
* disables the entry (`tailwind: false`) fails the build with a coded
|
|
36
|
+
* diagnostic instead of shipping an unstyled component. Merely offering a theme
|
|
37
|
+
* source is NOT a requirement — leave `required` unset for a source a consumer
|
|
38
|
+
* may adopt on its own.
|
|
39
|
+
*
|
|
40
|
+
* `sources` are package-relative paths (e.g. `./theme.css`) resolved against
|
|
41
|
+
* THIS package, so a consumer never repeats the owner's declaration. They must
|
|
42
|
+
* exist in the installed package (i.e. ship in the tarball).
|
|
43
|
+
*
|
|
44
|
+
* `dialect` names the CLASS LANGUAGE this component's utility tokens are
|
|
45
|
+
* written in, not the engine that compiles them: the declaration stays
|
|
46
|
+
* provider-neutral, and a selected provider that does not implement the
|
|
47
|
+
* dialect fails the build before any compile. Omitted means `tailwind4` — the
|
|
48
|
+
* language every declaration written before this field existed uses.
|
|
49
|
+
*/
|
|
50
|
+
export interface OpenElementTailwindDeclaration {
|
|
51
|
+
required?: boolean;
|
|
52
|
+
sources?: string[];
|
|
53
|
+
dialect?: 'tailwind4';
|
|
54
|
+
}
|
|
28
55
|
/** The openElement-specific extension block of a package manifest declaration. */
|
|
29
56
|
export interface OpenElementExtensions {
|
|
30
57
|
ssr?: boolean;
|
|
@@ -35,6 +62,7 @@ export interface OpenElementExtensions {
|
|
|
35
62
|
status?: 'stable' | 'experimental';
|
|
36
63
|
module?: string;
|
|
37
64
|
export?: string;
|
|
65
|
+
tailwind?: OpenElementTailwindDeclaration;
|
|
38
66
|
}
|
|
39
67
|
/** One custom element declaration in a package manifest: tag, members and delivery metadata. */
|
|
40
68
|
export interface OpenElementDeclaration {
|
package/src/part-program.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VOID_TAGS } from "./void-tags.js";
|
|
2
2
|
//#region src/part-program.d.ts
|
|
3
|
-
/** The Part Program IR version this package defines (currently
|
|
4
|
-
export declare const PART_PROGRAM_VERSION:
|
|
3
|
+
/** The Part Program IR version this package defines (currently v2). */
|
|
4
|
+
export declare const PART_PROGRAM_VERSION: 2;
|
|
5
5
|
/**
|
|
6
6
|
* Version of the compiled-module ABI: the statics a generated module carries
|
|
7
7
|
* (`__partProgram`, `__compiledProperties`, `__elementMetadata`,
|
|
@@ -227,7 +227,7 @@ export interface ProgramCondition {
|
|
|
227
227
|
value: number | string | boolean;
|
|
228
228
|
}
|
|
229
229
|
/**
|
|
230
|
-
* Operator/literal compatibility for when-
|
|
230
|
+
* Operator/literal compatibility for when-Block tests (issue #1372). Both
|
|
231
231
|
* wire validators (this module and the server serializer's shared validator)
|
|
232
232
|
* close the space through this one predicate:
|
|
233
233
|
* - ordering operators require a finite numeric literal;
|
|
@@ -246,8 +246,8 @@ export interface ProgramWhenPart {
|
|
|
246
246
|
location: ProgramLocation;
|
|
247
247
|
}
|
|
248
248
|
/**
|
|
249
|
-
* An event binding scoped to each item of an `each`
|
|
250
|
-
* attaches this listener to every item root node created by the
|
|
249
|
+
* An event binding scoped to each item of an `each` block. The runtime
|
|
250
|
+
* attaches this listener to every item root node created by the block,
|
|
251
251
|
* making per-item handlers (onClick={this.select(row.id)}) expressible
|
|
252
252
|
* without fixed-path event parts.
|
|
253
253
|
*/
|
|
@@ -283,8 +283,8 @@ export interface ProgramEachPart {
|
|
|
283
283
|
}
|
|
284
284
|
/** The discriminated union of dynamic parts a program instantiates. */
|
|
285
285
|
export type ProgramPart = ProgramTextPart | ProgramPropPart | ProgramAttrPart | ProgramBoolPart | ProgramClassPart | ProgramStylePart | ProgramHtmlPart | ProgramRefPart | ProgramEventPart | ProgramWhenPart | ProgramEachPart;
|
|
286
|
-
/** One
|
|
287
|
-
export interface
|
|
286
|
+
/** One block the program tracks: the boundaries of a dynamic subtree. */
|
|
287
|
+
export interface ProgramBlockRecord {
|
|
288
288
|
id: string;
|
|
289
289
|
index: number;
|
|
290
290
|
kind: 'when' | 'each';
|
|
@@ -355,13 +355,13 @@ export interface CompiledElementMetadata {
|
|
|
355
355
|
cem: CompiledCemMetadata;
|
|
356
356
|
}
|
|
357
357
|
/** The one deterministic program consumed by all execution modes. */
|
|
358
|
-
export interface
|
|
358
|
+
export interface PartProgramV2 {
|
|
359
359
|
version: typeof PART_PROGRAM_VERSION;
|
|
360
360
|
tag: string;
|
|
361
361
|
root: ProgramRoot;
|
|
362
362
|
template: ProgramTreeNode[];
|
|
363
363
|
parts: ProgramPart[];
|
|
364
|
-
|
|
364
|
+
blocks: ProgramBlockRecord[];
|
|
365
365
|
dependencies: ProgramDependencyRecord[];
|
|
366
366
|
locations: ProgramLocationRecord[];
|
|
367
367
|
/**
|
|
@@ -373,15 +373,15 @@ export interface PartProgramV1 {
|
|
|
373
373
|
sourceMap: ProgramSourceMap;
|
|
374
374
|
metadata: CompiledElementMetadata;
|
|
375
375
|
}
|
|
376
|
-
/** The serializable Part Program
|
|
377
|
-
export type PartProgram =
|
|
376
|
+
/** The serializable Part Program v2: one compiled component as data. */
|
|
377
|
+
export type PartProgram = PartProgramV2;
|
|
378
378
|
/** Anchor marker payloads shared by seed runtime consumers. */
|
|
379
379
|
export declare function partAnchorMarker(index: number): string;
|
|
380
380
|
/** The comment marker closing a part anchor in serialized program markup. */
|
|
381
381
|
export declare function partAnchorEndMarker(index: number): string;
|
|
382
382
|
/**
|
|
383
383
|
* The one `<style>` element the server serializer emits as the first DSD
|
|
384
|
-
* template child when the class carries static styles (
|
|
384
|
+
* template child when the class carries static styles (renderToString
|
|
385
385
|
* parity — pages never upgrade, so their styles must ship in the payload).
|
|
386
386
|
* The claim path skips exactly this marked node; a marked node on a
|
|
387
387
|
* style-less class is claim drift and fails closed.
|
|
@@ -403,7 +403,7 @@ export declare const DATA_OE_LIGHT = "data-oe-light";
|
|
|
403
403
|
*/
|
|
404
404
|
export declare function isAttributeName(value: unknown): value is string;
|
|
405
405
|
/**
|
|
406
|
-
* Validate an unknown value as a Part Program
|
|
406
|
+
* Validate an unknown value as a Part Program v2. The validator is intentionally
|
|
407
407
|
* strict: unknown instruction kinds, missing ownership records and unsafe paths
|
|
408
408
|
* fail before a runtime can guess at their meaning.
|
|
409
409
|
*/
|