@marko/runtime-tags 0.2.0 → 0.2.1

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.
@@ -1954,8 +1954,15 @@ function prepareChunk(chunk) {
1954
1954
  }
1955
1955
  function flushChunk(head) {
1956
1956
  const { html, scripts } = head;
1957
+ const { $global: $global2 } = head.boundary.state;
1958
+ const { __flush__ } = $global2;
1959
+ const result = scripts ? html + "<script" + (head.boundary.state.$global.cspNonce ? " nonce=" + escapeAttrValue(head.boundary.state.$global.cspNonce + "") : "") + ">" + scripts + "</script>" : html;
1957
1960
  head.html = head.scripts = "";
1958
- return html + (scripts ? "<script" + (head.boundary.state.$global.cspNonce ? " nonce=" + escapeAttrValue(head.boundary.state.$global.cspNonce + "") : "") + ">" + scripts + "</script>" : "");
1961
+ if (__flush__) {
1962
+ $global2.__flush__ = void 0;
1963
+ return __flush__($global2, result);
1964
+ }
1965
+ return result;
1959
1966
  }
1960
1967
  function concatEffects(a, b) {
1961
1968
  return a ? b ? a + "," + b : a : b;
@@ -1882,8 +1882,15 @@ function prepareChunk(chunk) {
1882
1882
  }
1883
1883
  function flushChunk(head) {
1884
1884
  const { html, scripts } = head;
1885
+ const { $global: $global2 } = head.boundary.state;
1886
+ const { __flush__ } = $global2;
1887
+ const result = scripts ? html + "<script" + (head.boundary.state.$global.cspNonce ? " nonce=" + escapeAttrValue(head.boundary.state.$global.cspNonce + "") : "") + ">" + scripts + "</script>" : html;
1885
1888
  head.html = head.scripts = "";
1886
- return html + (scripts ? "<script" + (head.boundary.state.$global.cspNonce ? " nonce=" + escapeAttrValue(head.boundary.state.$global.cspNonce + "") : "") + ">" + scripts + "</script>" : "");
1889
+ if (__flush__) {
1890
+ $global2.__flush__ = void 0;
1891
+ return __flush__($global2, result);
1892
+ }
1893
+ return result;
1887
1894
  }
1888
1895
  function concatEffects(a, b) {
1889
1896
  return a ? b ? a + "," + b : a : b;
@@ -1,4 +1,4 @@
1
- import type { Accessor } from "../common/types";
1
+ import type { $Global, Accessor } from "../common/types";
2
2
  import { Serializer } from "./serializer";
3
3
  export type PartialScope = Record<Accessor, unknown>;
4
4
  type ScopeInternals = PartialScope & {
@@ -36,7 +36,7 @@ export declare function markResumeCleanup(scopeId: number): string;
36
36
  export declare function writeScope(scopeId: number, partialScope: PartialScope): ScopeInternals;
37
37
  export declare function writeExistingScope(scope: ScopeInternals): ScopeInternals;
38
38
  export declare function ensureScopeWithId(scopeId: number): PartialScope;
39
- export declare function $global(): Record<string, unknown> & {
39
+ export declare function $global(): $Global & {
40
40
  renderId: string;
41
41
  runtimeId: string;
42
42
  };
@@ -44,7 +44,7 @@ export declare function fork<T>(promise: Promise<T> | T, renderBody: (value: T)
44
44
  export declare function tryPlaceholder(renderBody: () => void, renderPlaceholder: () => void): void;
45
45
  export declare function tryCatch(renderBody: () => void, renderCatch: (err: unknown) => void): void;
46
46
  export declare class State {
47
- $global: Record<string, unknown> & {
47
+ $global: $Global & {
48
48
  renderId: string;
49
49
  runtimeId: string;
50
50
  };
@@ -62,7 +62,7 @@ export declare class State {
62
62
  writeScopes: null | (Record<number, PartialScope> & {
63
63
  $?: unknown;
64
64
  });
65
- constructor($global: Record<string, unknown> & {
65
+ constructor($global: $Global & {
66
66
  renderId: string;
67
67
  runtimeId: string;
68
68
  });
package/dist/html.js CHANGED
@@ -1273,8 +1273,8 @@ function prepareChunk(chunk) {
1273
1273
  return hasWalk && (scripts = concatScripts(scripts, runtimePrefix + ".w()")), head.html = html, head.scripts = scripts, head;
1274
1274
  }
1275
1275
  function flushChunk(head) {
1276
- let { html, scripts } = head;
1277
- return head.html = head.scripts = "", html + (scripts ? "<script" + (head.boundary.state.$global.cspNonce ? " nonce=" + escapeAttrValue(head.boundary.state.$global.cspNonce + "") : "") + ">" + scripts + "</script>" : "");
1276
+ let { html, scripts } = head, { $global: $global2 } = head.boundary.state, { __flush__ } = $global2, result = scripts ? html + "<script" + (head.boundary.state.$global.cspNonce ? " nonce=" + escapeAttrValue(head.boundary.state.$global.cspNonce + "") : "") + ">" + scripts + "</script>" : html;
1277
+ return head.html = head.scripts = "", __flush__ ? ($global2.__flush__ = void 0, __flush__($global2, result)) : result;
1278
1278
  }
1279
1279
  function concatEffects(a, b) {
1280
1280
  return a ? b ? a + "," + b : a : b;
package/dist/html.mjs CHANGED
@@ -1204,8 +1204,8 @@ function prepareChunk(chunk) {
1204
1204
  return hasWalk && (scripts = concatScripts(scripts, runtimePrefix + ".w()")), head.html = html, head.scripts = scripts, head;
1205
1205
  }
1206
1206
  function flushChunk(head) {
1207
- let { html, scripts } = head;
1208
- return head.html = head.scripts = "", html + (scripts ? "<script" + (head.boundary.state.$global.cspNonce ? " nonce=" + escapeAttrValue(head.boundary.state.$global.cspNonce + "") : "") + ">" + scripts + "</script>" : "");
1207
+ let { html, scripts } = head, { $global: $global2 } = head.boundary.state, { __flush__ } = $global2, result = scripts ? html + "<script" + (head.boundary.state.$global.cspNonce ? " nonce=" + escapeAttrValue(head.boundary.state.$global.cspNonce + "") : "") + ">" + scripts + "</script>" : html;
1208
+ return head.html = head.scripts = "", __flush__ ? ($global2.__flush__ = void 0, __flush__($global2, result)) : result;
1209
1209
  }
1210
1210
  function concatEffects(a, b) {
1211
1211
  return a ? b ? a + "," + b : a : b;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/runtime-tags",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",