@async/framework 0.11.16 → 0.11.17

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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.17 - 2026-06-19
4
+
5
+ - Added the stream backpatch protocol to `createBoundaryReceiver(...)` with
6
+ strict `attrs` validation for built numeric triples and no-build named
7
+ tuples.
8
+ - Added pending-slot replacement and reveal coordination for `as-ready`,
9
+ `forwards`, `backwards`, and `together` stream groups, including collapsed
10
+ and hidden tail visibility handling.
11
+ - Added the `AsyncStream` browser helper for no-build JSON stream patches,
12
+ template replacement, configured `data-async-*` attributes, and direct-child
13
+ reveal metadata synthesis.
14
+ - Added stream backpatch scenario-size coverage and updated browser scenario
15
+ budgets for the expanded public stream surface.
16
+ - Bundle size from bundled TypeScript source: `browser.ts` raw 221,403 B (221.4 KB / 0.221 MB), gzip 42,093 B (42.1 KB / 0.042 MB), br 34,797 B (34.8 KB / 0.035 MB) -> `browser.min.js` raw 95,027 B (95.0 KB / 0.095 MB), gzip 28,145 B (28.1 KB / 0.028 MB), br 24,793 B (24.8 KB / 0.025 MB); delta raw -126,376 B (-126.4 KB / -0.126 MB), gzip -13,948 B (-13.9 KB / -0.014 MB), br -10,004 B (-10.0 KB / -0.010 MB).
17
+
3
18
  ## 0.11.16 - 2026-06-19
4
19
 
5
20
  - Added runtime slice entrypoints for `@async/framework/runtime`,
package/browser.d.ts CHANGED
@@ -513,10 +513,30 @@ export interface LoaderInstance {
513
513
  export type AsyncLoaderOptions = LoaderOptions;
514
514
  export type AsyncLoaderInstance = LoaderInstance;
515
515
 
516
+ export type AttributePatchValue = string | number | boolean | null | undefined;
517
+ export type BuiltAttributePatchTriples = readonly AttributePatchValue[];
518
+ export type NoBuildAttributePatchTuple = readonly [targetName: string, attrName: string, value: AttributePatchValue];
519
+ export type NoBuildAttributePatchTuples = readonly NoBuildAttributePatchTuple[];
520
+ export interface StreamReplacement {
521
+ target: string;
522
+ html?: TemplateLike;
523
+ template?: string;
524
+ mode?: "pending" | "boundary";
525
+ }
526
+ export interface StreamRevealMetadata {
527
+ group: string;
528
+ index: number;
529
+ count: number;
530
+ order?: "as-ready" | "forwards" | "backwards" | "together";
531
+ tail?: "collapsed" | "hidden";
532
+ }
516
533
  export interface BoundaryPatch {
517
534
  boundary: string;
518
535
  seq: number;
519
536
  html?: TemplateLike;
537
+ replace?: StreamReplacement | readonly StreamReplacement[];
538
+ attrs?: BuiltAttributePatchTriples | NoBuildAttributePatchTuples;
539
+ reveal?: StreamRevealMetadata;
520
540
  signals?: Record<string, unknown>;
521
541
  cache?: { browser?: Record<string, unknown> };
522
542
  redirect?: string;
@@ -526,17 +546,24 @@ export interface BoundaryPatch {
526
546
  meta?: Record<string, unknown>;
527
547
  }
528
548
 
549
+ export interface BoundaryPatchCounts {
550
+ applied: number;
551
+ ignored?: number;
552
+ }
553
+
529
554
  export type BoundaryApplyResult =
530
- | { status: "applied"; boundary: string; seq: number }
555
+ | { status: "applied"; boundary: string; seq: number; attrs?: BoundaryPatchCounts; replace?: BoundaryPatchCounts }
556
+ | { status: "buffered"; boundary: string; seq: number; reveal: Required<Pick<StreamRevealMetadata, "group" | "index" | "count">> & Pick<StreamRevealMetadata, "order" | "tail"> }
531
557
  | { status: "ignored-stale"; boundary: string; seq: number; lastSeq: number }
532
558
  | { status: "ignored-destroyed"; boundary: string; seq: number; parentScope?: string }
533
- | { status: "redirected"; boundary: string; seq: number; redirect: string }
559
+ | { status: "redirected"; boundary: string; seq: number; redirect: string; attrs?: BoundaryPatchCounts; replace?: BoundaryPatchCounts }
534
560
  | { status: "errored"; boundary: string; seq: number; error: Error };
535
561
 
536
562
  export interface BoundaryReceiverInspection {
537
563
  destroyed: boolean;
538
564
  boundaries: Record<string, { lastSeq: number; applied: number; ignored: number; errored?: number; lastStatus?: BoundaryApplyResult["status"] }>;
539
- recent: Array<{ boundary: string; seq: number; status: BoundaryApplyResult["status"]; lastSeq?: number; parentScope?: string; redirect?: string }>;
565
+ reveal: Record<string, { count: number; order: string; tail?: string; pending: number[]; committed: number[] }>;
566
+ recent: Array<{ boundary: string; seq: number; status: BoundaryApplyResult["status"]; lastSeq?: number; parentScope?: string; redirect?: string; attrs?: BoundaryPatchCounts; replace?: BoundaryPatchCounts; reveal?: StreamRevealMetadata }>;
540
567
  }
541
568
 
542
569
  export interface BoundaryReceiverOptions {
@@ -545,6 +572,7 @@ export interface BoundaryReceiverOptions {
545
572
  cache?: CacheRegistry;
546
573
  scheduler?: Scheduler;
547
574
  router?: Router;
575
+ attributes?: AttributeConfig;
548
576
  onApply?(result: BoundaryApplyResult, patch: BoundaryPatch): void;
549
577
  onIgnore?(result: BoundaryApplyResult, patch: BoundaryPatch): void;
550
578
  onError?(error: Error, result: BoundaryApplyResult, patch: BoundaryPatch): void;
@@ -560,6 +588,18 @@ export interface BoundaryReceiver {
560
588
  destroy(): void;
561
589
  }
562
590
 
591
+ export interface AsyncStreamApplyOptions extends Partial<BoundaryReceiverOptions> {
592
+ receiver?: BoundaryReceiver;
593
+ runtime?: AppRuntime;
594
+ root?: Document | Element | DocumentFragment;
595
+ }
596
+
597
+ export interface AsyncStreamNamespace {
598
+ applyScript(script: Element, options?: AsyncStreamApplyOptions): Promise<BoundaryApplyResult>;
599
+ applyCurrentScript(script?: Element, options?: AsyncStreamApplyOptions): Promise<BoundaryApplyResult>;
600
+ applyCurrentScript(options?: AsyncStreamApplyOptions): Promise<BoundaryApplyResult>;
601
+ }
602
+
563
603
  export interface RegistryStore {
564
604
  target: RuntimeTarget;
565
605
  register(type: RegistryType, id: string, value: unknown): string;
@@ -696,6 +736,7 @@ export interface AsyncNamespace extends AppHub {
696
736
  inspectRoots: AppHub["inspectRoots"];
697
737
  attributeName: typeof attributeName;
698
738
  defineAttributeConfig: typeof defineAttributeConfig;
739
+ AsyncStream: AsyncStreamNamespace;
699
740
  createBoundaryReceiver: typeof createBoundaryReceiver;
700
741
  createCacheRegistry: typeof createCacheRegistry;
701
742
  defineCache: typeof defineCache;
@@ -736,6 +777,7 @@ export declare function defineApp(initial?: AppDefinition): AppHub;
736
777
  export declare function readSnapshot(root?: Document | Element, options?: { attributes?: AttributeConfig }): RegistryRuntimeSnapshot;
737
778
  export declare function attributeName(attributes: AttributeConfig | undefined, type: keyof NormalizedAttributeConfig, name: string): string;
738
779
  export declare function defineAttributeConfig(config?: AttributeConfig): NormalizedAttributeConfig;
780
+ export declare const AsyncStream: AsyncStreamNamespace;
739
781
  export declare function createBoundaryReceiver(options: BoundaryReceiverOptions): BoundaryReceiver;
740
782
  export declare function createCacheRegistry(initialMap?: Record<string, CacheDefinition | CacheDefinitionOptions>, options?: { now?: () => number; registry?: RegistryStore; type?: "cache.browser" | "cache.server" }): CacheRegistry;
741
783
  export declare function defineCache(options?: CacheDefinitionOptions): CacheDefinition;