@pithyjs/core 0.1.0-beta.0 → 0.1.0-beta.10
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 +37 -6
- package/dist/a11y/focus-trap.d.ts.map +1 -1
- package/dist/a11y/focus-trap.js +2 -0
- package/dist/a11y/focus-trap.js.map +1 -1
- package/dist/a11y/index.d.ts +4 -4
- package/dist/a11y/index.js +4 -4
- package/dist/a11y/index.js.map +1 -1
- package/dist/a11y/keyboard-utils.js.map +1 -1
- package/dist/a11y/roving-tabindex.js.map +1 -1
- package/dist/a11y/skip-link.js.map +1 -1
- package/dist/compile/bindSwitchCases.d.ts +8 -3
- package/dist/compile/bindSwitchCases.d.ts.map +1 -1
- package/dist/compile/bindSwitchCases.js +113 -177
- package/dist/compile/bindSwitchCases.js.map +1 -1
- package/dist/compile/binds/bindBoundAttributes.d.ts +1 -0
- package/dist/compile/binds/bindBoundAttributes.d.ts.map +1 -1
- package/dist/compile/binds/bindBoundAttributes.js +24 -2
- package/dist/compile/binds/bindBoundAttributes.js.map +1 -1
- package/dist/compile/binds/bindClassDirectives.d.ts +3 -0
- package/dist/compile/binds/bindClassDirectives.d.ts.map +1 -1
- package/dist/compile/binds/bindClassDirectives.js +59 -21
- package/dist/compile/binds/bindClassDirectives.js.map +1 -1
- package/dist/compile/binds/bindComponentsTags.d.ts +2 -0
- package/dist/compile/binds/bindComponentsTags.d.ts.map +1 -1
- package/dist/compile/binds/bindComponentsTags.js +171 -74
- package/dist/compile/binds/bindComponentsTags.js.map +1 -1
- package/dist/compile/binds/bindConditionals.d.ts +2 -2
- package/dist/compile/binds/bindConditionals.d.ts.map +1 -1
- package/dist/compile/binds/bindConditionals.js +22 -5
- package/dist/compile/binds/bindConditionals.js.map +1 -1
- package/dist/compile/binds/bindDefaultTwoWay.d.ts.map +1 -1
- package/dist/compile/binds/bindDefaultTwoWay.js +2 -1
- package/dist/compile/binds/bindDefaultTwoWay.js.map +1 -1
- package/dist/compile/binds/bindDeferDirectives.d.ts.map +1 -1
- package/dist/compile/binds/bindDeferDirectives.js +45 -15
- package/dist/compile/binds/bindDeferDirectives.js.map +1 -1
- package/dist/compile/binds/bindErrorBoundary.d.ts +13 -2
- package/dist/compile/binds/bindErrorBoundary.d.ts.map +1 -1
- package/dist/compile/binds/bindErrorBoundary.js +25 -10
- package/dist/compile/binds/bindErrorBoundary.js.map +1 -1
- package/dist/compile/binds/bindEventHandlers.js +2 -2
- package/dist/compile/binds/bindEventHandlers.js.map +1 -1
- package/dist/compile/binds/bindRefDirectives.js.map +1 -1
- package/dist/compile/binds/bindStyleDirectives.d.ts +17 -0
- package/dist/compile/binds/bindStyleDirectives.d.ts.map +1 -0
- package/dist/compile/binds/bindStyleDirectives.js +47 -0
- package/dist/compile/binds/bindStyleDirectives.js.map +1 -0
- package/dist/compile/binds/bindTextInterpolations.d.ts +2 -1
- package/dist/compile/binds/bindTextInterpolations.d.ts.map +1 -1
- package/dist/compile/binds/bindTextInterpolations.js +55 -17
- package/dist/compile/binds/bindTextInterpolations.js.map +1 -1
- package/dist/compile/binds/directiveRegistry.js.map +1 -1
- package/dist/compile/binds/forwardedAttrs.d.ts +22 -0
- package/dist/compile/binds/forwardedAttrs.d.ts.map +1 -0
- package/dist/compile/binds/forwardedAttrs.js +66 -0
- package/dist/compile/binds/forwardedAttrs.js.map +1 -0
- package/dist/compile/binds/propNames.d.ts +14 -0
- package/dist/compile/binds/propNames.d.ts.map +1 -0
- package/dist/compile/binds/propNames.js +116 -0
- package/dist/compile/binds/propNames.js.map +1 -0
- package/dist/compile/compileExpression.js.map +1 -1
- package/dist/compile/compileNodes.d.ts.map +1 -1
- package/dist/compile/compileNodes.js +6 -3
- package/dist/compile/compileNodes.js.map +1 -1
- package/dist/compile/compileTemplate.d.ts +3 -4
- package/dist/compile/compileTemplate.d.ts.map +1 -1
- package/dist/compile/compileTemplate.js +28 -31
- package/dist/compile/compileTemplate.js.map +1 -1
- package/dist/compile/componentResult.d.ts +100 -0
- package/dist/compile/componentResult.d.ts.map +1 -0
- package/dist/compile/componentResult.js +138 -0
- package/dist/compile/componentResult.js.map +1 -0
- package/dist/compile/contentProjection.d.ts +1 -1
- package/dist/compile/contentProjection.d.ts.map +1 -1
- package/dist/compile/contentProjection.js +32 -15
- package/dist/compile/contentProjection.js.map +1 -1
- package/dist/compile/forLoops/bindForLoops.d.ts +2 -2
- package/dist/compile/forLoops/bindForLoops.d.ts.map +1 -1
- package/dist/compile/forLoops/bindForLoops.js +9 -22
- package/dist/compile/forLoops/bindForLoops.js.map +1 -1
- package/dist/compile/forLoops/createLoopManager.d.ts +6 -3
- package/dist/compile/forLoops/createLoopManager.d.ts.map +1 -1
- package/dist/compile/forLoops/createLoopManager.js +144 -114
- package/dist/compile/forLoops/createLoopManager.js.map +1 -1
- package/dist/compile/forLoops/index.d.ts +5 -5
- package/dist/compile/forLoops/index.js +5 -5
- package/dist/compile/forLoops/index.js.map +1 -1
- package/dist/compile/forLoops/loopHelpers.d.ts +6 -0
- package/dist/compile/forLoops/loopHelpers.d.ts.map +1 -1
- package/dist/compile/forLoops/loopHelpers.js +17 -0
- package/dist/compile/forLoops/loopHelpers.js.map +1 -1
- package/dist/compile/forLoops/loopSignals.js +2 -2
- package/dist/compile/forLoops/loopSignals.js.map +1 -1
- package/dist/compile/forLoops/loopTraversal.js +2 -2
- package/dist/compile/forLoops/loopTraversal.js.map +1 -1
- package/dist/compile/handleConditionalChain.d.ts +2 -2
- package/dist/compile/handleConditionalChain.d.ts.map +1 -1
- package/dist/compile/handleConditionalChain.js +21 -83
- package/dist/compile/handleConditionalChain.js.map +1 -1
- package/dist/compile/index.d.ts +17 -14
- package/dist/compile/index.d.ts.map +1 -1
- package/dist/compile/index.js +28 -12
- package/dist/compile/index.js.map +1 -1
- package/dist/compile/injectScopedStyle.js.map +1 -1
- package/dist/compile/nodeExpando.d.ts +6 -0
- package/dist/compile/nodeExpando.d.ts.map +1 -1
- package/dist/compile/nodeExpando.js.map +1 -1
- package/dist/compile/parseHtml.d.ts.map +1 -1
- package/dist/compile/parseHtml.js +2 -2
- package/dist/compile/parseHtml.js.map +1 -1
- package/dist/compile/pithyTreeToDom.js +1 -1
- package/dist/compile/pithyTreeToDom.js.map +1 -1
- package/dist/compile/renderBranch.d.ts +13 -0
- package/dist/compile/renderBranch.d.ts.map +1 -0
- package/dist/compile/renderBranch.js +65 -0
- package/dist/compile/renderBranch.js.map +1 -0
- package/dist/compile/renderChildren.d.ts +17 -0
- package/dist/compile/renderChildren.d.ts.map +1 -1
- package/dist/compile/renderChildren.js +22 -3
- package/dist/compile/renderChildren.js.map +1 -1
- package/dist/compile/ssrCrashes.d.ts +116 -0
- package/dist/compile/ssrCrashes.d.ts.map +1 -0
- package/dist/compile/ssrCrashes.js +173 -0
- package/dist/compile/ssrCrashes.js.map +1 -0
- package/dist/compile/ssrMode.js +1 -1
- package/dist/compile/ssrMode.js.map +1 -1
- package/dist/compile/textValue.js.map +1 -1
- package/dist/compile/trimBlankEdges.d.ts +2 -0
- package/dist/compile/trimBlankEdges.d.ts.map +1 -0
- package/dist/compile/trimBlankEdges.js +15 -0
- package/dist/compile/trimBlankEdges.js.map +1 -0
- package/dist/config/index.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/interfaces/index.d.ts +2 -2
- package/dist/interfaces/index.js +2 -2
- package/dist/interfaces/index.js.map +1 -1
- package/dist/interfaces/ref-signal.interface.js.map +1 -1
- package/dist/interfaces/ref.interface.js.map +1 -1
- package/dist/runtime/applyBindings.d.ts +5 -5
- package/dist/runtime/applyBindings.d.ts.map +1 -1
- package/dist/runtime/applyBindings.js +97 -21
- package/dist/runtime/applyBindings.js.map +1 -1
- package/dist/runtime/bindings/applyComponent.d.ts +2 -2
- package/dist/runtime/bindings/applyComponent.d.ts.map +1 -1
- package/dist/runtime/bindings/applyComponent.js +137 -39
- package/dist/runtime/bindings/applyComponent.js.map +1 -1
- package/dist/runtime/bindings/applyDefer.d.ts +1 -1
- package/dist/runtime/bindings/applyDefer.d.ts.map +1 -1
- package/dist/runtime/bindings/applyDefer.js +46 -18
- package/dist/runtime/bindings/applyDefer.js.map +1 -1
- package/dist/runtime/bindings/applySimple.d.ts +2 -1
- package/dist/runtime/bindings/applySimple.d.ts.map +1 -1
- package/dist/runtime/bindings/applySimple.js +70 -14
- package/dist/runtime/bindings/applySimple.js.map +1 -1
- package/dist/runtime/bindings/applyStructural.d.ts +1 -1
- package/dist/runtime/bindings/applyStructural.d.ts.map +1 -1
- package/dist/runtime/bindings/applyStructural.js +58 -68
- package/dist/runtime/bindings/applyStructural.js.map +1 -1
- package/dist/runtime/bindings/helpers.d.ts +1 -1
- package/dist/runtime/bindings/helpers.js +1 -1
- package/dist/runtime/bindings/helpers.js.map +1 -1
- package/dist/runtime/bindings/index.d.ts +6 -6
- package/dist/runtime/bindings/index.d.ts.map +1 -1
- package/dist/runtime/bindings/index.js +5 -5
- package/dist/runtime/bindings/index.js.map +1 -1
- package/dist/runtime/bindings/types.d.ts +12 -1
- package/dist/runtime/bindings/types.d.ts.map +1 -1
- package/dist/runtime/bindings/types.js.map +1 -1
- package/dist/runtime/bootstrap.d.ts +1 -1
- package/dist/runtime/bootstrap.js +1 -1
- package/dist/runtime/bootstrap.js.map +1 -1
- package/dist/runtime/createContextProxy.js.map +1 -1
- package/dist/runtime/deferHelpers.d.ts +1 -1
- package/dist/runtime/deferHelpers.js.map +1 -1
- package/dist/runtime/html.d.ts.map +1 -1
- package/dist/runtime/html.js +6 -5
- package/dist/runtime/html.js.map +1 -1
- package/dist/runtime/index.d.ts +6 -5
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +7 -5
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/lazy.js +1 -1
- package/dist/runtime/lazy.js.map +1 -1
- package/dist/runtime/module-cache.js.map +1 -1
- package/dist/runtime/onDestroy.d.ts +7 -0
- package/dist/runtime/onDestroy.d.ts.map +1 -1
- package/dist/runtime/onDestroy.js +16 -1
- package/dist/runtime/onDestroy.js.map +1 -1
- package/dist/runtime/parseIdentifiersFromTemplate.js +1 -1
- package/dist/runtime/parseIdentifiersFromTemplate.js.map +1 -1
- package/dist/runtime/resource/createAction.d.ts +44 -0
- package/dist/runtime/resource/createAction.d.ts.map +1 -0
- package/dist/runtime/resource/createAction.js +102 -0
- package/dist/runtime/resource/createAction.js.map +1 -0
- package/dist/runtime/resource/createResource.d.ts +56 -0
- package/dist/runtime/resource/createResource.d.ts.map +1 -0
- package/dist/runtime/resource/createResource.js +102 -0
- package/dist/runtime/resource/createResource.js.map +1 -0
- package/dist/runtime/resource/engine.d.ts +136 -0
- package/dist/runtime/resource/engine.d.ts.map +1 -0
- package/dist/runtime/resource/engine.js +363 -0
- package/dist/runtime/resource/engine.js.map +1 -0
- package/dist/runtime/resource/index.d.ts +19 -0
- package/dist/runtime/resource/index.d.ts.map +1 -0
- package/dist/runtime/resource/index.js +18 -0
- package/dist/runtime/resource/index.js.map +1 -0
- package/dist/runtime/resource/types.d.ts +240 -0
- package/dist/runtime/resource/types.d.ts.map +1 -0
- package/dist/runtime/resource/types.js +9 -0
- package/dist/runtime/resource/types.js.map +1 -0
- package/dist/types/globals.d.ts +10 -1
- package/dist/types/globals.d.ts.map +1 -1
- package/dist/types/globals.js.map +1 -1
- package/dist/types/index.d.ts +15 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utilities/index.d.ts +2 -2
- package/dist/utilities/index.js +2 -2
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/ref-signal.utility.d.ts +1 -1
- package/dist/utilities/ref-signal.utility.js.map +1 -1
- package/dist/utilities/ref.untility.d.ts +1 -1
- package/dist/utilities/ref.untility.js.map +1 -1
- package/package.json +14 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderChildren.d.ts","sourceRoot":"","sources":["../../src/compile/renderChildren.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderChildren.d.ts","sourceRoot":"","sources":["../../src/compile/renderChildren.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAgB,KAAK,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D;;;;;;;;;;;;;;GAcG;AACH,wKAAwK;AACxK,wBAAgB,cAAc,IAAI;IAChC,EAAE,EAAE,gBAAgB,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CA4BA;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,yKAAyK;AACzK,wBAAgB,eAAe,IAAI;IACjC,EAAE,EAAE,gBAAgB,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CASA;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,qBAAqB,GAAG,SAAS,CAAC;IAC3C,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,gBAAgB,CAAC;CAC9B;AAED;;;;;GAKG;AACH,+IAA+I;AAC/I,wBAAgB,gBAAgB,IAAI,YAAY,CAW/C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { compileNodes } from './compileNodes';
|
|
2
|
-
import { pithyGlobals } from '../types/globals';
|
|
1
|
+
import { compileNodes } from './compileNodes.js';
|
|
2
|
+
import { pithyGlobals } from '../types/globals.js';
|
|
3
3
|
/**
|
|
4
4
|
* If the registry renderer has set `globalThis.__pithyProjectedChildren` (a
|
|
5
5
|
* `DocumentFragment` of already-rendered slot children), returns and clears it —
|
|
@@ -17,7 +17,7 @@ import { pithyGlobals } from '../types/globals';
|
|
|
17
17
|
*/
|
|
18
18
|
/** @codexApi {"parent":"pithy.runtime.compile-nodes","name":"renderChildren","stability":"stable","signature":"() => { el: DocumentFragment; destroy: () => void }"} */
|
|
19
19
|
export function renderChildren() {
|
|
20
|
-
const globalScope =
|
|
20
|
+
const globalScope = pithyGlobals();
|
|
21
21
|
const injected = globalScope.__pithyProjectedChildren;
|
|
22
22
|
if (injected) {
|
|
23
23
|
globalScope.__pithyProjectedChildren = undefined;
|
|
@@ -73,4 +73,23 @@ export function captureChildren() {
|
|
|
73
73
|
g.__pithyComponentContext = prevCtx?.__parentComponentContext ?? undefined;
|
|
74
74
|
return result;
|
|
75
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Reads the children addressed to the component being rendered, without
|
|
78
|
+
* consuming them. `factory` and `astNodes` are mutually exclusive: an AOT child
|
|
79
|
+
* factory wins, because a JIT parent's AST can reach an AOT component's context
|
|
80
|
+
* through `mergeContexts`, never the reverse.
|
|
81
|
+
*/
|
|
82
|
+
/** @codexApi {"parent":"pithy.runtime.compile-nodes","name":"readChildPayload","stability":"experimental","signature":"() => ChildPayload"} */
|
|
83
|
+
export function readChildPayload() {
|
|
84
|
+
const g = pithyGlobals();
|
|
85
|
+
const context = g.__pithyComponentContext;
|
|
86
|
+
const factory = context?.__childFactory;
|
|
87
|
+
const ast = context?.__childAstNodes;
|
|
88
|
+
return {
|
|
89
|
+
context,
|
|
90
|
+
factory,
|
|
91
|
+
astNodes: !factory && ast && ast.length > 0 ? ast : undefined,
|
|
92
|
+
projected: g.__pithyProjectedChildren,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
76
95
|
//# sourceMappingURL=renderChildren.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderChildren.js","sourceRoot":"","sources":["../../src/compile/renderChildren.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"renderChildren.js","sourceRoot":"","sources":["../../src/compile/renderChildren.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,YAAY,EAA8B,MAAM,kBAAkB,CAAC;AAG5E;;;;;;;;;;;;;;GAcG;AACH,wKAAwK;AACxK,MAAM,UAAU,cAAc;IAI5B,MAAM,WAAW,GAAG,YAAY,EAAE,CAAC;IACnC,MAAM,QAAQ,GAAG,WAAW,CAAC,wBAAwB,CAAC;IACtD,IAAI,QAAQ,EAAE,CAAC;QACb,WAAW,CAAC,wBAAwB,GAAG,SAAS,CAAC;QACjD,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,CAAC;IAC7C,CAAC;IAED,MAAM,YAAY,GAAG,YAAY,EAAE,CAAC,uBAAuB,CAAC;IAE5D,8EAA8E;IAC9E,gFAAgF;IAChF,qEAAqE;IACrE,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC,yBAAyB,CAAC;IAC3D,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,YAAY,IAAI,CAAC,SAAS,EAAE,CAAC;QACxD,OAAO,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAC;IAC3E,CAAC;IAED,MAAM,aAAa,GAAgB,YAAY,EAAE,eAAe,IAAI,EAAE,CAAC;IAEvE,uFAAuF;IACvF,MAAM,SAAS,GAA4B,YAAY;QACrD,CAAC,CAAC,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAClE;QACH,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO,YAAY,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;AAChD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,yKAAyK;AACzK,MAAM,UAAU,eAAe;IAI7B,MAAM,CAAC,GAAG,YAAY,EAAE,CAAC;IACzB,MAAM,OAAO,GAAG,CAAC,CAAC,uBAAuB,CAAC;IAC1C,MAAM,MAAM,GAAG,cAAc,EAAE,CAAC;IAChC,sDAAsD;IACtD,qEAAqE;IACrE,iEAAiE;IACjE,CAAC,CAAC,uBAAuB,GAAG,OAAO,EAAE,wBAAwB,IAAI,SAAS,CAAC;IAC3E,OAAO,MAAM,CAAC;AAChB,CAAC;AASD;;;;;GAKG;AACH,+IAA+I;AAC/I,MAAM,UAAU,gBAAgB;IAC9B,MAAM,CAAC,GAAG,YAAY,EAAE,CAAC;IACzB,MAAM,OAAO,GAAG,CAAC,CAAC,uBAAuB,CAAC;IAC1C,MAAM,OAAO,GAAG,OAAO,EAAE,cAAc,CAAC;IACxC,MAAM,GAAG,GAAG,OAAO,EAAE,eAAe,CAAC;IACrC,OAAO;QACL,OAAO;QACP,OAAO;QACP,QAAQ,EAAE,CAAC,OAAO,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS;QAC7D,SAAS,EAAE,CAAC,CAAC,wBAAwB;KACtC,CAAC;AACJ,CAAC","sourcesContent":["import { compileNodes } from './compileNodes';\nimport type { PithyNode } from '@pithyjs/compiler';\nimport { pithyGlobals, type PithyComponentContext } from '../types/globals';\nimport type { ChildFactory } from '../runtime/bindings/types';\n\n/**\n * If the registry renderer has set `globalThis.__pithyProjectedChildren` (a\n * `DocumentFragment` of already-rendered slot children), returns and clears it —\n * single-consume, so the first caller wins. This delivers construction-time\n * children on the registry path. The registry path has no AST fallback, so a\n * second `renderChildren()`/`captureChildren()` call returns an empty fragment.\n *\n * Otherwise compiles child AST nodes from the current component context through\n * the full pipeline (structural + non-structural directives). This enables\n * nested components inside projected content — unlike `<slot>`, which inserts\n * DOM after `bindComponentTags` has already run.\n *\n * Use inside component functions (Stack, Grid, etc.) that need to compile\n * their children without named slots or fallback content.\n */\n/** @codexApi {\"parent\":\"pithy.runtime.compile-nodes\",\"name\":\"renderChildren\",\"stability\":\"stable\",\"signature\":\"() => { el: DocumentFragment; destroy: () => void }\"} */\nexport function renderChildren(): {\n el: DocumentFragment;\n destroy: () => void;\n} {\n const globalScope = pithyGlobals();\n const injected = globalScope.__pithyProjectedChildren;\n if (injected) {\n globalScope.__pithyProjectedChildren = undefined;\n return { el: injected, destroy: () => {} };\n }\n\n const componentCtx = pithyGlobals().__pithyComponentContext;\n\n // A parent composing atoms by direct call after captureChildren() cleared its\n // context is still mid-render (`rendering` truthy) — not the misuse this guards\n // against, so a consumed context alone must not trigger the warning.\n const rendering = pithyGlobals().__pithyRenderingComponent;\n if (import.meta.env?.DEV && !componentCtx && !rendering) {\n console.warn('[renderChildren] Called outside component render context');\n }\n\n const childAstNodes: PithyNode[] = componentCtx?.__childAstNodes ?? [];\n\n // Strip internal __ properties, keep parent scope (includes components, signals, etc.)\n const parentCtx: Record<string, unknown> = componentCtx\n ? Object.fromEntries(\n Object.entries(componentCtx).filter(([k]) => !k.startsWith('__'))\n )\n : {};\n\n return compileNodes(childAstNodes, parentCtx);\n}\n\n/**\n * Captures projected children and clears the component context so\n * inner component calls (e.g. `Heading()`, `Text()`) don't consume\n * the outer component's children.\n *\n * After capture, the current component's context on `globalThis` is\n * reset to the value of `__parentComponentContext` if present, or\n * otherwise to `undefined`. In the current core implementation,\n * `__parentComponentContext` is not set by the runtime, so this\n * effectively clears the active component context to prevent child\n * leakage into inner component calls.\n *\n * **Important invariant:** This function must be called exactly once per\n * component, before any inner component function calls. It consumes the\n * current context's children — a second call would return an empty fragment.\n * After this call, the caller must not rely on reading its own context\n * properties from `globalThis.__pithyComponentContext`.\n *\n * For 3+ levels of nesting (e.g., section A → section B → atoms), each\n * level should call `captureChildren()` independently. Any multi-level\n * parent restoration depends on `__parentComponentContext` being managed\n * by external tooling; the core library only performs a best-effort reset\n * from that property when present.\n */\n/** @codexApi {\"parent\":\"pithy.runtime.compile-nodes\",\"name\":\"captureChildren\",\"stability\":\"stable\",\"signature\":\"() => { el: DocumentFragment; destroy: () => void }\"} */\nexport function captureChildren(): {\n el: DocumentFragment;\n destroy: () => void;\n} {\n const g = pithyGlobals();\n const prevCtx = g.__pithyComponentContext;\n const result = renderChildren();\n // Clear context so inner component calls start fresh.\n // If there was a parent context, it will be restored by the parent's\n // own render cycle — we only need to prevent child leakage here.\n g.__pithyComponentContext = prevCtx?.__parentComponentContext ?? undefined;\n return result;\n}\n\nexport interface ChildPayload {\n context: PithyComponentContext | undefined;\n factory?: ChildFactory;\n astNodes?: PithyNode[];\n projected?: DocumentFragment;\n}\n\n/**\n * Reads the children addressed to the component being rendered, without\n * consuming them. `factory` and `astNodes` are mutually exclusive: an AOT child\n * factory wins, because a JIT parent's AST can reach an AOT component's context\n * through `mergeContexts`, never the reverse.\n */\n/** @codexApi {\"parent\":\"pithy.runtime.compile-nodes\",\"name\":\"readChildPayload\",\"stability\":\"experimental\",\"signature\":\"() => ChildPayload\"} */\nexport function readChildPayload(): ChildPayload {\n const g = pithyGlobals();\n const context = g.__pithyComponentContext;\n const factory = context?.__childFactory;\n const ast = context?.__childAstNodes;\n return {\n context,\n factory,\n astNodes: !factory && ast && ast.length > 0 ? ast : undefined,\n projected: g.__pithyProjectedChildren,\n };\n}\n"]}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/** @codex
|
|
2
|
+
{
|
|
3
|
+
"id": "pithy.runtime.ssr-crashes",
|
|
4
|
+
"title": "SSR Unhandled Component Crash Collector",
|
|
5
|
+
"category": "runtime",
|
|
6
|
+
"risk": "high"
|
|
7
|
+
}
|
|
8
|
+
*/
|
|
9
|
+
import { type BoundaryInfo } from './binds/bindErrorBoundary.js';
|
|
10
|
+
/**
|
|
11
|
+
* A component render crash recorded during a static/server render.
|
|
12
|
+
*/
|
|
13
|
+
export interface SSRRenderCrash {
|
|
14
|
+
/** The custom-element placeholder the crashed component was to replace. */
|
|
15
|
+
el: Element;
|
|
16
|
+
/** Authored tag name, for the failure message. */
|
|
17
|
+
tag: string;
|
|
18
|
+
/** The error the component threw. */
|
|
19
|
+
error: Error;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Forget any crash previously recorded for `el`.
|
|
23
|
+
*
|
|
24
|
+
* Called only at points where the record is provably no longer the outcome, and
|
|
25
|
+
* NEVER before invoking a component. Retracting eagerly at the top of an attempt
|
|
26
|
+
* hides a failed retry: a component that throws detached and then returns
|
|
27
|
+
* something unusable would have its only record erased, shipping a page with a
|
|
28
|
+
* missing subtree and a green build. The three call sites are:
|
|
29
|
+
*
|
|
30
|
+
* 1. A boundary ACCEPTING the error (`setBoundaryError()` returning `true`).
|
|
31
|
+
* A boundary merely being in scope is not enough — an already-active one
|
|
32
|
+
* with no free ancestor rejects the error, and that is as unhandled as
|
|
33
|
+
* having no boundary at all.
|
|
34
|
+
* 2. A component returning a usable node that then successfully reaches the
|
|
35
|
+
* document, i.e. after `replaceWith` has not thrown.
|
|
36
|
+
* 3. An element that has left the tree being bound (`scope.contains(el)` in
|
|
37
|
+
* `bindComponentTags`, `fragment.contains(el)` in `applyBindings`). It can
|
|
38
|
+
* no longer contribute to the output, so any record for it is stale.
|
|
39
|
+
*
|
|
40
|
+
* Retraction matters because the JIT `@if` path really does attempt the same tag
|
|
41
|
+
* twice, measured by counting component invocations:
|
|
42
|
+
*
|
|
43
|
+
* 1. `bindStructuralDirectives` runs first and `handleConditionalChain` binds
|
|
44
|
+
* the chosen branch while it is still DETACHED, so `el.closest('[data-error]')`
|
|
45
|
+
* finds nothing and the crash is recorded.
|
|
46
|
+
* 2. The branch is inserted, and `bindTemplateDirectives` then reaches the
|
|
47
|
+
* still-raw tag on the assembled tree, where the boundary is visible and
|
|
48
|
+
* accepts — retracting via case 1 above.
|
|
49
|
+
*
|
|
50
|
+
* Case 3 exists because accepting is synchronous: it immediately hides the
|
|
51
|
+
* boundary's content, so a SECOND crashing component in that branch is detached
|
|
52
|
+
* before it can be retried, and its detached-pass record would otherwise stand
|
|
53
|
+
* and fail a route whose fallback rendered correctly.
|
|
54
|
+
*
|
|
55
|
+
* Every one of these is mutation-tested; removing any of them turns a correct
|
|
56
|
+
* render into a failed route, or a broken one into a silent success.
|
|
57
|
+
*
|
|
58
|
+
* AOT invokes `applyComponent` once per `pid` and never retries, which is why
|
|
59
|
+
* the equivalent AOT boundary case behaves differently — see BUG-023.
|
|
60
|
+
*/
|
|
61
|
+
/** @codexApi {"parent":"pithy.runtime.ssr-crashes","name":"clearSSRRenderCrash","stability":"internal","signature":"(el: Element) => void"} */
|
|
62
|
+
export declare function clearSSRRenderCrash(el: Element): void;
|
|
63
|
+
/**
|
|
64
|
+
* Drop every recorded crash. Called by the SSR renderer before a render starts
|
|
65
|
+
* and again in its `finally`, so one route's crash can never fail the next.
|
|
66
|
+
*/
|
|
67
|
+
/** @codexApi {"parent":"pithy.runtime.ssr-crashes","name":"resetSSRRenderCrashes","stability":"stable","signature":"() => void"} */
|
|
68
|
+
export declare function resetSSRRenderCrashes(): void;
|
|
69
|
+
/**
|
|
70
|
+
* Return the crashes still recorded once the render has finished, and empty
|
|
71
|
+
* the collector.
|
|
72
|
+
*
|
|
73
|
+
* Every surviving record is a failure. A record is only ever retracted by
|
|
74
|
+
* `clearSSRRenderCrash`, i.e. by a genuine re-attempt at the same element that
|
|
75
|
+
* then went better — never by inspecting the finished tree.
|
|
76
|
+
*
|
|
77
|
+
* An earlier draft re-resolved each record's boundary here, dropping any crash
|
|
78
|
+
* whose element had ended up inside an `@error-boundary`. That is unsound,
|
|
79
|
+
* because a boundary *existing* above an element is not the same as that
|
|
80
|
+
* boundary having *handled* the crash:
|
|
81
|
+
*
|
|
82
|
+
* - JIT never needed it. It does record a crash from the detached first
|
|
83
|
+
* attempt, but the retry after insertion is caught by the boundary and
|
|
84
|
+
* retracts that record itself (see `clearSSRRenderCrash`). By collect time
|
|
85
|
+
* there is nothing left to re-resolve.
|
|
86
|
+
* - AOT was actively broken by it. A branch factory binds its subtree while
|
|
87
|
+
* detached, so `applyComponent`'s `el.closest('[data-error]')` finds
|
|
88
|
+
* nothing and the boundary never receives the error — but the nodes are
|
|
89
|
+
* then inserted *under* that boundary, so re-resolution saw one and
|
|
90
|
+
* dropped the record. The boundary signal stayed null, its fallback never
|
|
91
|
+
* activated, the raw component tag shipped, and the build went green: the
|
|
92
|
+
* exact BUG-018 symptom, reintroduced by its own fix.
|
|
93
|
+
*
|
|
94
|
+
* That AOT boundary gap is real but predates this collector and is tracked
|
|
95
|
+
* separately as BUG-023. Until it is fixed, such a crash fails its route, which
|
|
96
|
+
* is the safe direction: a loud failure rather than silently truncated HTML.
|
|
97
|
+
*/
|
|
98
|
+
/** @codexApi {"parent":"pithy.runtime.ssr-crashes","name":"collectUnhandledSSRRenderCrashes","stability":"stable","signature":"() => SSRRenderCrash[]"} */
|
|
99
|
+
export declare function collectUnhandledSSRRenderCrashes(): SSRRenderCrash[];
|
|
100
|
+
/**
|
|
101
|
+
* Hand a component failure to its `@error-boundary`, or record it if none takes
|
|
102
|
+
* it. Returns whether a boundary accepted ownership.
|
|
103
|
+
*
|
|
104
|
+
* The single funnel for every way a component can fail to produce content: a
|
|
105
|
+
* thrown error, an unusable return value, and a rendered node that never reached
|
|
106
|
+
* the document. They were handled in five separate places and drifted — the
|
|
107
|
+
* throw paths consulted the boundary while the malformed paths recorded
|
|
108
|
+
* directly, so a component under `@error-boundary` that returned garbage left
|
|
109
|
+
* the boundary signal null, rendered no fallback, and failed the route, even
|
|
110
|
+
* though the code called it "the same content loss as a crash".
|
|
111
|
+
*
|
|
112
|
+
* Callers still do their own logging, since the wording differs per failure.
|
|
113
|
+
*/
|
|
114
|
+
/** @codexApi {"parent":"pithy.runtime.ssr-crashes","name":"reportComponentFailure","stability":"internal","signature":"(el: Element, tag: string, error: Error, boundary: BoundaryInfo | null) => boolean"} */
|
|
115
|
+
export declare function reportComponentFailure(el: Element, tag: string, error: Error, boundary: BoundaryInfo | null): boolean;
|
|
116
|
+
//# sourceMappingURL=ssrCrashes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssrCrashes.d.ts","sourceRoot":"","sources":["../../src/compile/ssrCrashes.ts"],"names":[],"mappings":"AAAA;;;;;;;EAOE;AAIF,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,2EAA2E;IAC3E,EAAE,EAAE,OAAO,CAAC;IACZ,kDAAkD;IAClD,GAAG,EAAE,MAAM,CAAC;IACZ,qCAAqC;IACrC,KAAK,EAAE,KAAK,CAAC;CACd;AAwBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,+IAA+I;AAC/I,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAErD;AA4BD;;;GAGG;AACH,oIAAoI;AACpI,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,2JAA2J;AAC3J,wBAAgB,gCAAgC,IAAI,cAAc,EAAE,CAKnE;AAED;;;;;;;;;;;;;GAaG;AACH,+MAA+M;AAC/M,wBAAgB,sBAAsB,CACpC,EAAE,EAAE,OAAO,EACX,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,YAAY,GAAG,IAAI,GAC5B,OAAO,CAWT"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
/** @codex
|
|
2
|
+
{
|
|
3
|
+
"id": "pithy.runtime.ssr-crashes",
|
|
4
|
+
"title": "SSR Unhandled Component Crash Collector",
|
|
5
|
+
"category": "runtime",
|
|
6
|
+
"risk": "high"
|
|
7
|
+
}
|
|
8
|
+
*/
|
|
9
|
+
import { pithyGlobals } from '../types/globals.js';
|
|
10
|
+
import { isSSRMode } from './ssrMode.js';
|
|
11
|
+
import { setBoundaryError } from './binds/bindErrorBoundary.js';
|
|
12
|
+
/**
|
|
13
|
+
* Crashes recorded during the current server render, keyed by the placeholder
|
|
14
|
+
* element so a later binding pass over the same element can retract its own
|
|
15
|
+
* earlier record (see `clearSSRRenderCrash`).
|
|
16
|
+
*
|
|
17
|
+
* Held on `globalThis`, not in this module. `@pithyjs/ssr` depends on
|
|
18
|
+
* `@pithyjs/core` as a regular dependency, so an app and the SSR package can
|
|
19
|
+
* resolve two physical copies: `html()` would record into the app's copy while
|
|
20
|
+
* `renderToString()` collected and reset the SSR package's, reintroducing
|
|
21
|
+
* BUG-018 *and* leaking the app copy's DOM records for the life of the process.
|
|
22
|
+
* The same reasoning already puts `__PITHY_SSR__` and `__getComponentContext`
|
|
23
|
+
* on this bridge.
|
|
24
|
+
*
|
|
25
|
+
* A `Map` (not a `WeakMap`) because the collector must be enumerable at flush
|
|
26
|
+
* time. `resetSSRRenderCrashes()` is what keeps it from retaining DOM across
|
|
27
|
+
* renders — the SSR renderer calls it in a `finally`.
|
|
28
|
+
*/
|
|
29
|
+
function crashRegistry() {
|
|
30
|
+
const g = pithyGlobals();
|
|
31
|
+
return (g.__pithySSRCrashes ?? (g.__pithySSRCrashes = new Map()));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Forget any crash previously recorded for `el`.
|
|
35
|
+
*
|
|
36
|
+
* Called only at points where the record is provably no longer the outcome, and
|
|
37
|
+
* NEVER before invoking a component. Retracting eagerly at the top of an attempt
|
|
38
|
+
* hides a failed retry: a component that throws detached and then returns
|
|
39
|
+
* something unusable would have its only record erased, shipping a page with a
|
|
40
|
+
* missing subtree and a green build. The three call sites are:
|
|
41
|
+
*
|
|
42
|
+
* 1. A boundary ACCEPTING the error (`setBoundaryError()` returning `true`).
|
|
43
|
+
* A boundary merely being in scope is not enough — an already-active one
|
|
44
|
+
* with no free ancestor rejects the error, and that is as unhandled as
|
|
45
|
+
* having no boundary at all.
|
|
46
|
+
* 2. A component returning a usable node that then successfully reaches the
|
|
47
|
+
* document, i.e. after `replaceWith` has not thrown.
|
|
48
|
+
* 3. An element that has left the tree being bound (`scope.contains(el)` in
|
|
49
|
+
* `bindComponentTags`, `fragment.contains(el)` in `applyBindings`). It can
|
|
50
|
+
* no longer contribute to the output, so any record for it is stale.
|
|
51
|
+
*
|
|
52
|
+
* Retraction matters because the JIT `@if` path really does attempt the same tag
|
|
53
|
+
* twice, measured by counting component invocations:
|
|
54
|
+
*
|
|
55
|
+
* 1. `bindStructuralDirectives` runs first and `handleConditionalChain` binds
|
|
56
|
+
* the chosen branch while it is still DETACHED, so `el.closest('[data-error]')`
|
|
57
|
+
* finds nothing and the crash is recorded.
|
|
58
|
+
* 2. The branch is inserted, and `bindTemplateDirectives` then reaches the
|
|
59
|
+
* still-raw tag on the assembled tree, where the boundary is visible and
|
|
60
|
+
* accepts — retracting via case 1 above.
|
|
61
|
+
*
|
|
62
|
+
* Case 3 exists because accepting is synchronous: it immediately hides the
|
|
63
|
+
* boundary's content, so a SECOND crashing component in that branch is detached
|
|
64
|
+
* before it can be retried, and its detached-pass record would otherwise stand
|
|
65
|
+
* and fail a route whose fallback rendered correctly.
|
|
66
|
+
*
|
|
67
|
+
* Every one of these is mutation-tested; removing any of them turns a correct
|
|
68
|
+
* render into a failed route, or a broken one into a silent success.
|
|
69
|
+
*
|
|
70
|
+
* AOT invokes `applyComponent` once per `pid` and never retries, which is why
|
|
71
|
+
* the equivalent AOT boundary case behaves differently — see BUG-023.
|
|
72
|
+
*/
|
|
73
|
+
/** @codexApi {"parent":"pithy.runtime.ssr-crashes","name":"clearSSRRenderCrash","stability":"internal","signature":"(el: Element) => void"} */
|
|
74
|
+
export function clearSSRRenderCrash(el) {
|
|
75
|
+
crashRegistry().delete(el);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Record a component failure that no error boundary took ownership of.
|
|
79
|
+
*
|
|
80
|
+
* The precondition is **not** "no boundary was in scope". It is that no boundary
|
|
81
|
+
* ACCEPTED the error, which is a strictly weaker thing: `setBoundaryError()`
|
|
82
|
+
* rejects an error when the nearest boundary is already showing one and no
|
|
83
|
+
* ancestor is free, and both binders call this on that path with a boundary
|
|
84
|
+
* very much present. Getting the two confused is what this whole module exists
|
|
85
|
+
* to prevent.
|
|
86
|
+
*
|
|
87
|
+
* Nor is "crash" limited to a thrown error. The binders also record a component
|
|
88
|
+
* that returned an unusable result, and one whose rendered node failed to reach
|
|
89
|
+
* the document — both leave the raw tag exactly where a throw would, which is
|
|
90
|
+
* the same content loss from the page's point of view.
|
|
91
|
+
*
|
|
92
|
+
* Callers must have established `isSSRMode()` themselves; this does not
|
|
93
|
+
* re-check.
|
|
94
|
+
*/
|
|
95
|
+
function recordSSRRenderCrash(el, tag, error) {
|
|
96
|
+
crashRegistry().set(el, {
|
|
97
|
+
el,
|
|
98
|
+
tag,
|
|
99
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Drop every recorded crash. Called by the SSR renderer before a render starts
|
|
104
|
+
* and again in its `finally`, so one route's crash can never fail the next.
|
|
105
|
+
*/
|
|
106
|
+
/** @codexApi {"parent":"pithy.runtime.ssr-crashes","name":"resetSSRRenderCrashes","stability":"stable","signature":"() => void"} */
|
|
107
|
+
export function resetSSRRenderCrashes() {
|
|
108
|
+
crashRegistry().clear();
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Return the crashes still recorded once the render has finished, and empty
|
|
112
|
+
* the collector.
|
|
113
|
+
*
|
|
114
|
+
* Every surviving record is a failure. A record is only ever retracted by
|
|
115
|
+
* `clearSSRRenderCrash`, i.e. by a genuine re-attempt at the same element that
|
|
116
|
+
* then went better — never by inspecting the finished tree.
|
|
117
|
+
*
|
|
118
|
+
* An earlier draft re-resolved each record's boundary here, dropping any crash
|
|
119
|
+
* whose element had ended up inside an `@error-boundary`. That is unsound,
|
|
120
|
+
* because a boundary *existing* above an element is not the same as that
|
|
121
|
+
* boundary having *handled* the crash:
|
|
122
|
+
*
|
|
123
|
+
* - JIT never needed it. It does record a crash from the detached first
|
|
124
|
+
* attempt, but the retry after insertion is caught by the boundary and
|
|
125
|
+
* retracts that record itself (see `clearSSRRenderCrash`). By collect time
|
|
126
|
+
* there is nothing left to re-resolve.
|
|
127
|
+
* - AOT was actively broken by it. A branch factory binds its subtree while
|
|
128
|
+
* detached, so `applyComponent`'s `el.closest('[data-error]')` finds
|
|
129
|
+
* nothing and the boundary never receives the error — but the nodes are
|
|
130
|
+
* then inserted *under* that boundary, so re-resolution saw one and
|
|
131
|
+
* dropped the record. The boundary signal stayed null, its fallback never
|
|
132
|
+
* activated, the raw component tag shipped, and the build went green: the
|
|
133
|
+
* exact BUG-018 symptom, reintroduced by its own fix.
|
|
134
|
+
*
|
|
135
|
+
* That AOT boundary gap is real but predates this collector and is tracked
|
|
136
|
+
* separately as BUG-023. Until it is fixed, such a crash fails its route, which
|
|
137
|
+
* is the safe direction: a loud failure rather than silently truncated HTML.
|
|
138
|
+
*/
|
|
139
|
+
/** @codexApi {"parent":"pithy.runtime.ssr-crashes","name":"collectUnhandledSSRRenderCrashes","stability":"stable","signature":"() => SSRRenderCrash[]"} */
|
|
140
|
+
export function collectUnhandledSSRRenderCrashes() {
|
|
141
|
+
const registry = crashRegistry();
|
|
142
|
+
const unhandled = [...registry.values()];
|
|
143
|
+
registry.clear();
|
|
144
|
+
return unhandled;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Hand a component failure to its `@error-boundary`, or record it if none takes
|
|
148
|
+
* it. Returns whether a boundary accepted ownership.
|
|
149
|
+
*
|
|
150
|
+
* The single funnel for every way a component can fail to produce content: a
|
|
151
|
+
* thrown error, an unusable return value, and a rendered node that never reached
|
|
152
|
+
* the document. They were handled in five separate places and drifted — the
|
|
153
|
+
* throw paths consulted the boundary while the malformed paths recorded
|
|
154
|
+
* directly, so a component under `@error-boundary` that returned garbage left
|
|
155
|
+
* the boundary signal null, rendered no fallback, and failed the route, even
|
|
156
|
+
* though the code called it "the same content loss as a crash".
|
|
157
|
+
*
|
|
158
|
+
* Callers still do their own logging, since the wording differs per failure.
|
|
159
|
+
*/
|
|
160
|
+
/** @codexApi {"parent":"pithy.runtime.ssr-crashes","name":"reportComponentFailure","stability":"internal","signature":"(el: Element, tag: string, error: Error, boundary: BoundaryInfo | null) => boolean"} */
|
|
161
|
+
export function reportComponentFailure(el, tag, error, boundary) {
|
|
162
|
+
// A boundary in scope is not a boundary that accepted: an already-active one
|
|
163
|
+
// with no free ancestor rejects, and that is as unhandled as having none.
|
|
164
|
+
const accepted = boundary ? setBoundaryError(boundary, error) : false;
|
|
165
|
+
if (isSSRMode()) {
|
|
166
|
+
if (accepted)
|
|
167
|
+
clearSSRRenderCrash(el);
|
|
168
|
+
else
|
|
169
|
+
recordSSRRenderCrash(el, tag, error);
|
|
170
|
+
}
|
|
171
|
+
return accepted;
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=ssrCrashes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssrCrashes.js","sourceRoot":"","sources":["../../src/compile/ssrCrashes.ts"],"names":[],"mappings":"AAAA;;;;;;;EAOE;AAEF,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAqB,MAAM,2BAA2B,CAAC;AAchF;;;;;;;;;;;;;;;;GAgBG;AACH,SAAS,aAAa;IACpB,MAAM,CAAC,GAAG,YAAY,EAAE,CAAC;IACzB,OAAO,CAAC,CAAC,CAAC,iBAAiB,KAAnB,CAAC,CAAC,iBAAiB,GAAK,IAAI,GAAG,EAAE,EAAiC,CAAC;AAC7E,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,+IAA+I;AAC/I,MAAM,UAAU,mBAAmB,CAAC,EAAW;IAC7C,aAAa,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAC7B,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAS,oBAAoB,CAAC,EAAW,EAAE,GAAW,EAAE,KAAc;IACpE,aAAa,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE;QACtB,EAAE;QACF,GAAG;QACH,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;KACjE,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,oIAAoI;AACpI,MAAM,UAAU,qBAAqB;IACnC,aAAa,EAAE,CAAC,KAAK,EAAE,CAAC;AAC1B,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,2JAA2J;AAC3J,MAAM,UAAU,gCAAgC;IAC9C,MAAM,QAAQ,GAAG,aAAa,EAAE,CAAC;IACjC,MAAM,SAAS,GAAG,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IACzC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACjB,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,+MAA+M;AAC/M,MAAM,UAAU,sBAAsB,CACpC,EAAW,EACX,GAAW,EACX,KAAY,EACZ,QAA6B;IAE7B,6EAA6E;IAC7E,0EAA0E;IAC1E,MAAM,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAEtE,IAAI,SAAS,EAAE,EAAE,CAAC;QAChB,IAAI,QAAQ;YAAE,mBAAmB,CAAC,EAAE,CAAC,CAAC;;YACjC,oBAAoB,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["/** @codex\n{\n \"id\": \"pithy.runtime.ssr-crashes\",\n \"title\": \"SSR Unhandled Component Crash Collector\",\n \"category\": \"runtime\",\n \"risk\": \"high\"\n}\n*/\n\nimport { pithyGlobals } from '../types/globals';\nimport { isSSRMode } from './ssrMode';\nimport { setBoundaryError, type BoundaryInfo } from './binds/bindErrorBoundary';\n\n/**\n * A component render crash recorded during a static/server render.\n */\nexport interface SSRRenderCrash {\n /** The custom-element placeholder the crashed component was to replace. */\n el: Element;\n /** Authored tag name, for the failure message. */\n tag: string;\n /** The error the component threw. */\n error: Error;\n}\n\n/**\n * Crashes recorded during the current server render, keyed by the placeholder\n * element so a later binding pass over the same element can retract its own\n * earlier record (see `clearSSRRenderCrash`).\n *\n * Held on `globalThis`, not in this module. `@pithyjs/ssr` depends on\n * `@pithyjs/core` as a regular dependency, so an app and the SSR package can\n * resolve two physical copies: `html()` would record into the app's copy while\n * `renderToString()` collected and reset the SSR package's, reintroducing\n * BUG-018 *and* leaking the app copy's DOM records for the life of the process.\n * The same reasoning already puts `__PITHY_SSR__` and `__getComponentContext`\n * on this bridge.\n *\n * A `Map` (not a `WeakMap`) because the collector must be enumerable at flush\n * time. `resetSSRRenderCrashes()` is what keeps it from retaining DOM across\n * renders — the SSR renderer calls it in a `finally`.\n */\nfunction crashRegistry(): Map<Element, SSRRenderCrash> {\n const g = pithyGlobals();\n return (g.__pithySSRCrashes ??= new Map()) as Map<Element, SSRRenderCrash>;\n}\n\n/**\n * Forget any crash previously recorded for `el`.\n *\n * Called only at points where the record is provably no longer the outcome, and\n * NEVER before invoking a component. Retracting eagerly at the top of an attempt\n * hides a failed retry: a component that throws detached and then returns\n * something unusable would have its only record erased, shipping a page with a\n * missing subtree and a green build. The three call sites are:\n *\n * 1. A boundary ACCEPTING the error (`setBoundaryError()` returning `true`).\n * A boundary merely being in scope is not enough — an already-active one\n * with no free ancestor rejects the error, and that is as unhandled as\n * having no boundary at all.\n * 2. A component returning a usable node that then successfully reaches the\n * document, i.e. after `replaceWith` has not thrown.\n * 3. An element that has left the tree being bound (`scope.contains(el)` in\n * `bindComponentTags`, `fragment.contains(el)` in `applyBindings`). It can\n * no longer contribute to the output, so any record for it is stale.\n *\n * Retraction matters because the JIT `@if` path really does attempt the same tag\n * twice, measured by counting component invocations:\n *\n * 1. `bindStructuralDirectives` runs first and `handleConditionalChain` binds\n * the chosen branch while it is still DETACHED, so `el.closest('[data-error]')`\n * finds nothing and the crash is recorded.\n * 2. The branch is inserted, and `bindTemplateDirectives` then reaches the\n * still-raw tag on the assembled tree, where the boundary is visible and\n * accepts — retracting via case 1 above.\n *\n * Case 3 exists because accepting is synchronous: it immediately hides the\n * boundary's content, so a SECOND crashing component in that branch is detached\n * before it can be retried, and its detached-pass record would otherwise stand\n * and fail a route whose fallback rendered correctly.\n *\n * Every one of these is mutation-tested; removing any of them turns a correct\n * render into a failed route, or a broken one into a silent success.\n *\n * AOT invokes `applyComponent` once per `pid` and never retries, which is why\n * the equivalent AOT boundary case behaves differently — see BUG-023.\n */\n/** @codexApi {\"parent\":\"pithy.runtime.ssr-crashes\",\"name\":\"clearSSRRenderCrash\",\"stability\":\"internal\",\"signature\":\"(el: Element) => void\"} */\nexport function clearSSRRenderCrash(el: Element): void {\n crashRegistry().delete(el);\n}\n\n/**\n * Record a component failure that no error boundary took ownership of.\n *\n * The precondition is **not** \"no boundary was in scope\". It is that no boundary\n * ACCEPTED the error, which is a strictly weaker thing: `setBoundaryError()`\n * rejects an error when the nearest boundary is already showing one and no\n * ancestor is free, and both binders call this on that path with a boundary\n * very much present. Getting the two confused is what this whole module exists\n * to prevent.\n *\n * Nor is \"crash\" limited to a thrown error. The binders also record a component\n * that returned an unusable result, and one whose rendered node failed to reach\n * the document — both leave the raw tag exactly where a throw would, which is\n * the same content loss from the page's point of view.\n *\n * Callers must have established `isSSRMode()` themselves; this does not\n * re-check.\n */\nfunction recordSSRRenderCrash(el: Element, tag: string, error: unknown): void {\n crashRegistry().set(el, {\n el,\n tag,\n error: error instanceof Error ? error : new Error(String(error)),\n });\n}\n\n/**\n * Drop every recorded crash. Called by the SSR renderer before a render starts\n * and again in its `finally`, so one route's crash can never fail the next.\n */\n/** @codexApi {\"parent\":\"pithy.runtime.ssr-crashes\",\"name\":\"resetSSRRenderCrashes\",\"stability\":\"stable\",\"signature\":\"() => void\"} */\nexport function resetSSRRenderCrashes(): void {\n crashRegistry().clear();\n}\n\n/**\n * Return the crashes still recorded once the render has finished, and empty\n * the collector.\n *\n * Every surviving record is a failure. A record is only ever retracted by\n * `clearSSRRenderCrash`, i.e. by a genuine re-attempt at the same element that\n * then went better — never by inspecting the finished tree.\n *\n * An earlier draft re-resolved each record's boundary here, dropping any crash\n * whose element had ended up inside an `@error-boundary`. That is unsound,\n * because a boundary *existing* above an element is not the same as that\n * boundary having *handled* the crash:\n *\n * - JIT never needed it. It does record a crash from the detached first\n * attempt, but the retry after insertion is caught by the boundary and\n * retracts that record itself (see `clearSSRRenderCrash`). By collect time\n * there is nothing left to re-resolve.\n * - AOT was actively broken by it. A branch factory binds its subtree while\n * detached, so `applyComponent`'s `el.closest('[data-error]')` finds\n * nothing and the boundary never receives the error — but the nodes are\n * then inserted *under* that boundary, so re-resolution saw one and\n * dropped the record. The boundary signal stayed null, its fallback never\n * activated, the raw component tag shipped, and the build went green: the\n * exact BUG-018 symptom, reintroduced by its own fix.\n *\n * That AOT boundary gap is real but predates this collector and is tracked\n * separately as BUG-023. Until it is fixed, such a crash fails its route, which\n * is the safe direction: a loud failure rather than silently truncated HTML.\n */\n/** @codexApi {\"parent\":\"pithy.runtime.ssr-crashes\",\"name\":\"collectUnhandledSSRRenderCrashes\",\"stability\":\"stable\",\"signature\":\"() => SSRRenderCrash[]\"} */\nexport function collectUnhandledSSRRenderCrashes(): SSRRenderCrash[] {\n const registry = crashRegistry();\n const unhandled = [...registry.values()];\n registry.clear();\n return unhandled;\n}\n\n/**\n * Hand a component failure to its `@error-boundary`, or record it if none takes\n * it. Returns whether a boundary accepted ownership.\n *\n * The single funnel for every way a component can fail to produce content: a\n * thrown error, an unusable return value, and a rendered node that never reached\n * the document. They were handled in five separate places and drifted — the\n * throw paths consulted the boundary while the malformed paths recorded\n * directly, so a component under `@error-boundary` that returned garbage left\n * the boundary signal null, rendered no fallback, and failed the route, even\n * though the code called it \"the same content loss as a crash\".\n *\n * Callers still do their own logging, since the wording differs per failure.\n */\n/** @codexApi {\"parent\":\"pithy.runtime.ssr-crashes\",\"name\":\"reportComponentFailure\",\"stability\":\"internal\",\"signature\":\"(el: Element, tag: string, error: Error, boundary: BoundaryInfo | null) => boolean\"} */\nexport function reportComponentFailure(\n el: Element,\n tag: string,\n error: Error,\n boundary: BoundaryInfo | null\n): boolean {\n // A boundary in scope is not a boundary that accepted: an already-active one\n // with no free ancestor rejects, and that is as unhandled as having none.\n const accepted = boundary ? setBoundaryError(boundary, error) : false;\n\n if (isSSRMode()) {\n if (accepted) clearSSRRenderCrash(el);\n else recordSSRRenderCrash(el, tag, error);\n }\n\n return accepted;\n}\n"]}
|
package/dist/compile/ssrMode.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssrMode.js","sourceRoot":"","sources":["../../src/compile/ssrMode.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD;;;;;;GAMG;AACH,wHAAwH;AACxH,MAAM,UAAU,SAAS;IACvB,OAAO,CAAC,CAAC,YAAY,EAAE,CAAC,aAAa,CAAC;AACxC,CAAC"}
|
|
1
|
+
{"version":3,"file":"ssrMode.js","sourceRoot":"","sources":["../../src/compile/ssrMode.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD;;;;;;GAMG;AACH,wHAAwH;AACxH,MAAM,UAAU,SAAS;IACvB,OAAO,CAAC,CAAC,YAAY,EAAE,CAAC,aAAa,CAAC;AACxC,CAAC","sourcesContent":["/** @codex\n{\n \"id\": \"pithy.runtime.ssr-mode\",\n \"title\": \"SSR Mode Detection\",\n \"category\": \"runtime\"\n}\n*/\n\nimport { pithyGlobals } from '../types/globals';\n\n/**\n * Checks if the current execution is in SSR (Server-Side Rendering) mode.\n *\n * The SSR package sets `globalThis.__PITHY_SSR__` when the environment is active.\n * Core binding functions check this flag to skip reactive effects and evaluate\n * directives synchronously during SSR.\n */\n/** @codexApi {\"parent\":\"pithy.runtime.ssr-mode\",\"name\":\"isSSRMode\",\"stability\":\"stable\",\"signature\":\"() => boolean\"} */\nexport function isSSRMode(): boolean {\n return !!pithyGlobals().__PITHY_SSR__;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textValue.js","sourceRoot":"","sources":["../../src/compile/textValue.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,2IAA2I;AAC3I,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC"}
|
|
1
|
+
{"version":3,"file":"textValue.js","sourceRoot":"","sources":["../../src/compile/textValue.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,2IAA2I;AAC3I,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC","sourcesContent":["/** @codex\n{\n \"id\": \"pithy.runtime.dom-safety\",\n \"title\": \"DOM Text Safety\",\n \"category\": \"runtime\"\n}\n*/\n\n/**\n * Coerce an interpolated value to display text for a DOM **text node**\n * (`.nodeValue` / `.textContent`).\n *\n * Text nodes are inherently XSS-safe: the browser stores the string as literal\n * character data and never parses it as markup. So `{{ expr }}` interpolations\n * must NOT be HTML-escaped — escaping turns `>` into `>`, which then renders\n * as the *visible* text `>` (e.g. a TS signature `() => Promise<void>` shows\n * as `() => Promise<void>`). Assigning the raw string is both correct\n * and safe: `textNode.nodeValue = '<img onerror=…>'` creates a text node, not\n * an element.\n *\n * Internal helper — not part of the public package API (intentionally absent\n * from the barrel / package exports).\n *\n * @param input - Any value being interpolated into a text node\n * @returns The value as a plain string (no HTML escaping)\n */\n/** @codexApi {\"parent\":\"pithy.runtime.dom-safety\",\"name\":\"toTextValue\",\"stability\":\"internal\",\"signature\":\"(input: unknown) => string\"} */\nexport function toTextValue(input: unknown): string {\n return String(input);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trimBlankEdges.d.ts","sourceRoot":"","sources":["../../src/compile/trimBlankEdges.ts"],"names":[],"mappings":"AAEA,wBAAgB,cAAc,CAAC,CAAC,EAC9B,KAAK,EAAE,CAAC,EAAE,EACV,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,IAAI,GACjC,CAAC,EAAE,CAUL"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const ASCII_WHITESPACE = /^[ \t\n\f\r]*$/;
|
|
2
|
+
export function trimBlankEdges(nodes, textOf) {
|
|
3
|
+
const blank = (node) => {
|
|
4
|
+
const text = textOf(node);
|
|
5
|
+
return text !== null && ASCII_WHITESPACE.test(text);
|
|
6
|
+
};
|
|
7
|
+
let start = 0;
|
|
8
|
+
let end = nodes.length;
|
|
9
|
+
while (start < end && blank(nodes[start]))
|
|
10
|
+
start++;
|
|
11
|
+
while (end > start && blank(nodes[end - 1]))
|
|
12
|
+
end--;
|
|
13
|
+
return nodes.slice(start, end);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=trimBlankEdges.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trimBlankEdges.js","sourceRoot":"","sources":["../../src/compile/trimBlankEdges.ts"],"names":[],"mappings":"AAAA,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAE1C,MAAM,UAAU,cAAc,CAC5B,KAAU,EACV,MAAkC;IAElC,MAAM,KAAK,GAAG,CAAC,IAAO,EAAE,EAAE;QACxB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QAC1B,OAAO,IAAI,KAAK,IAAI,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC,CAAC;IACF,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC;IACvB,OAAO,KAAK,GAAG,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAAE,KAAK,EAAE,CAAC;IACnD,OAAO,GAAG,GAAG,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QAAE,GAAG,EAAE,CAAC;IACnD,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACjC,CAAC","sourcesContent":["const ASCII_WHITESPACE = /^[ \\t\\n\\f\\r]*$/;\n\nexport function trimBlankEdges<T>(\n nodes: T[],\n textOf: (node: T) => string | null\n): T[] {\n const blank = (node: T) => {\n const text = textOf(node);\n return text !== null && ASCII_WHITESPACE.test(text);\n };\n let start = 0;\n let end = nodes.length;\n while (start < end && blank(nodes[start])) start++;\n while (end > start && blank(nodes[end - 1])) end--;\n return nodes.slice(start, end);\n}\n"]}
|
package/dist/config/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAkCF,uHAAuH;AACvH,MAAM,CAAC,MAAM,aAAa,GAAgB;IACxC,sBAAsB,EAAE,IAAI;IAC5B,cAAc,EAAE,yBAAyB;IACzC,iBAAiB,EAAE,GAAG;IACtB,eAAe,EAAE,KAAK,EAAE,uDAAuD;IAC/E,qBAAqB,EAAE,WAAW,EAAE,+EAA+E;CACpH,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAkCF,uHAAuH;AACvH,MAAM,CAAC,MAAM,aAAa,GAAgB;IACxC,sBAAsB,EAAE,IAAI;IAC5B,cAAc,EAAE,yBAAyB;IACzC,iBAAiB,EAAE,GAAG;IACtB,eAAe,EAAE,KAAK,EAAE,uDAAuD;IAC/E,qBAAqB,EAAE,WAAW,EAAE,+EAA+E;CACpH,CAAC","sourcesContent":["/** @codex\n{\n \"id\": \"pithy.config.system\",\n \"title\": \"Framework Configuration System\", \n \"category\": \"runtime\"\n}\n*/\n\nexport interface PithyConfig {\n /**\n * Enable visual highlighting of DOM updates in development mode.\n * NOTE: Only works with span-wrapped interpolations (textInterpolationMode: 'span' or 'auto').\n * Text nodes cannot be styled, so no visual feedback in 'text-node' mode.\n * @default true\n */\n devHighlightDomUpdates?: boolean;\n\n /** Color for update highlights @default 'rgba(11, 205, 118, 0.8)' */\n highlightColor?: string;\n\n /** Duration of highlight animation in seconds @default 0.3 */\n highlightDuration?: number;\n\n /**\n * Automatically wrap signal expressions in <span> for visual feedback.\n * Only applies when textInterpolationMode is 'auto'.\n * @default false\n */\n autoWrapSignals?: boolean;\n\n /**\n * How to render text interpolations:\n * - 'text-node': Maximum performance, bare text nodes (no visual feedback)\n * - 'span': Wrapped in spans, visual feedback enabled (extra DOM nodes)\n * - 'auto': Smart mode - respects autoWrapSignals setting\n * @default 'text-node'\n */\n textInterpolationMode?: 'text-node' | 'span' | 'auto';\n}\n\n/** @codexApi {\"parent\":\"pithy.config.system\",\"name\":\"defaultConfig\",\"stability\":\"stable\",\"signature\":\"PithyConfig\"} */\nexport const defaultConfig: PithyConfig = {\n devHighlightDomUpdates: true,\n highlightColor: 'rgba(11, 205, 118, 0.8)',\n highlightDuration: 0.3,\n autoWrapSignals: false, // Keep false for maximum performance (text nodes only)\n textInterpolationMode: 'text-node', // Use text nodes with comment anchors (Solid.js approach) for best performance\n};\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './types';
|
|
2
|
-
export * from './compile';
|
|
3
|
-
export * from './runtime';
|
|
4
|
-
export * from './utilities';
|
|
5
|
-
export * from './interfaces';
|
|
6
|
-
export * from './a11y';
|
|
1
|
+
export * from './types/index.js';
|
|
2
|
+
export * from './compile/index.js';
|
|
3
|
+
export * from './runtime/index.js';
|
|
4
|
+
export * from './utilities/index.js';
|
|
5
|
+
export * from './interfaces/index.js';
|
|
6
|
+
export * from './a11y/index.js';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './types';
|
|
2
|
-
export * from './compile';
|
|
3
|
-
export * from './runtime';
|
|
4
|
-
export * from './utilities';
|
|
5
|
-
export * from './interfaces';
|
|
6
|
-
export * from './a11y';
|
|
1
|
+
export * from './types/index.js';
|
|
2
|
+
export * from './compile/index.js';
|
|
3
|
+
export * from './runtime/index.js';
|
|
4
|
+
export * from './utilities/index.js';
|
|
5
|
+
export * from './interfaces/index.js';
|
|
6
|
+
export * from './a11y/index.js';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC","sourcesContent":["export * from './types';\nexport * from './compile';\nexport * from './runtime';\nexport * from './utilities';\nexport * from './interfaces';\nexport * from './a11y';\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './ref.interface';
|
|
2
|
-
export * from './ref-signal.interface';
|
|
1
|
+
export * from './ref.interface.js';
|
|
2
|
+
export * from './ref-signal.interface.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/interfaces/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './ref.interface';
|
|
2
|
-
export * from './ref-signal.interface';
|
|
1
|
+
export * from './ref.interface.js';
|
|
2
|
+
export * from './ref-signal.interface.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC","sourcesContent":["export * from './ref.interface';\nexport * from './ref-signal.interface';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ref-signal.interface.js","sourceRoot":"","sources":["../../src/interfaces/ref-signal.interface.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"ref-signal.interface.js","sourceRoot":"","sources":["../../src/interfaces/ref-signal.interface.ts"],"names":[],"mappings":"","sourcesContent":["export interface RefSignal<T extends HTMLElement = HTMLElement> {\n (): T | null;\n set: (el: T | null) => void;\n current: T | null;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ref.interface.js","sourceRoot":"","sources":["../../src/interfaces/ref.interface.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"ref.interface.js","sourceRoot":"","sources":["../../src/interfaces/ref.interface.ts"],"names":[],"mappings":"","sourcesContent":["export interface Ref<T> {\n readonly current: T | null;\n set: (el: T | null) => void;\n}\n"]}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
"category": "runtime"
|
|
6
6
|
}
|
|
7
7
|
*/
|
|
8
|
-
import { type Desc, type EventDesc, type InterpDesc, type ClassDesc, type StyleDesc, type BoundDesc, type RefDesc, type BindDesc, type CompDesc, type DeferDesc, type ErrorDesc, type ProjDesc, type IfDesc, type ForDesc, type SwitchDesc } from './bindings';
|
|
9
|
-
export type { Desc, EventDesc, InterpDesc, ClassDesc, StyleDesc, BoundDesc, RefDesc, BindDesc, CompDesc, DeferDesc, ErrorDesc, ProjDesc, IfDesc, ForDesc, SwitchDesc, };
|
|
8
|
+
import { type Desc, type EventDesc, type InterpDesc, type ClassDesc, type ClassesDesc, type StyleDesc, type BoundDesc, type RefDesc, type BindDesc, type CompDesc, type DeferDesc, type ErrorDesc, type ProjDesc, type IfDesc, type ForDesc, type SwitchDesc } from './bindings/index.js';
|
|
9
|
+
export type { Desc, EventDesc, InterpDesc, ClassDesc, ClassesDesc, StyleDesc, BoundDesc, RefDesc, BindDesc, CompDesc, DeferDesc, ErrorDesc, ProjDesc, IfDesc, ForDesc, SwitchDesc, };
|
|
10
10
|
/**
|
|
11
11
|
* Applies pre-extracted binding descriptors to an AOT-generated DOM fragment.
|
|
12
12
|
*
|
|
@@ -18,7 +18,7 @@ export type { Desc, EventDesc, InterpDesc, ClassDesc, StyleDesc, BoundDesc, RefD
|
|
|
18
18
|
* **Binding order** mirrors (but is not identical to) bindTemplateDirectives:
|
|
19
19
|
* 1. Structural: switch → if → for
|
|
20
20
|
* 2. Non-structural: ref → error → projection → component → bind →
|
|
21
|
-
* interpolation → event → class → style → bound attr → defer
|
|
21
|
+
* interpolation → event → class → classes → style → bound attr → defer
|
|
22
22
|
*
|
|
23
23
|
* Differences from JIT bindTemplateDirectives:
|
|
24
24
|
* - AOT has an explicit `style` phase (JIT folds inline styles into bound attrs)
|
|
@@ -28,8 +28,8 @@ export type { Desc, EventDesc, InterpDesc, ClassDesc, StyleDesc, BoundDesc, RefD
|
|
|
28
28
|
* @param bindings - Array of binding descriptors from codegen
|
|
29
29
|
* @param context - Reactive context object with signals, methods, components
|
|
30
30
|
*/
|
|
31
|
-
/** @codexApi {"parent":"pithy.runtime.apply-bindings","name":"__applyBindings","stability":"experimental","signature":"(fragment: DocumentFragment, bindings: Desc[], context: Record<string, unknown
|
|
32
|
-
export declare function __applyBindings(fragment: DocumentFragment, bindings: Desc[], context: Record<string, unknown
|
|
31
|
+
/** @codexApi {"parent":"pithy.runtime.apply-bindings","name":"__applyBindings","stability":"experimental","signature":"(fragment: DocumentFragment, bindings: Desc[], context: Record<string, unknown>, ownsDestroyCallbacks?: boolean) => { el: DocumentFragment; destroy: () => void }"} */
|
|
32
|
+
export declare function __applyBindings(fragment: DocumentFragment, bindings: Desc[], context: Record<string, unknown>, ownsDestroyCallbacks?: boolean): {
|
|
33
33
|
el: DocumentFragment;
|
|
34
34
|
destroy: () => void;
|
|
35
35
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyBindings.d.ts","sourceRoot":"","sources":["../../src/runtime/applyBindings.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;
|
|
1
|
+
{"version":3,"file":"applyBindings.d.ts","sourceRoot":"","sources":["../../src/runtime/applyBindings.ts"],"names":[],"mappings":"AAAA;;;;;;EAME;AAKF,OAAO,EAoBL,KAAK,IAAI,EACT,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,OAAO,EACZ,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,MAAM,EACX,KAAK,OAAO,EACZ,KAAK,UAAU,EAChB,MAAM,YAAY,CAAC;AAGpB,YAAY,EACV,IAAI,EACJ,SAAS,EACT,UAAU,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,SAAS,EACT,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,SAAS,EACT,QAAQ,EACR,MAAM,EACN,OAAO,EACP,UAAU,GACX,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,8RAA8R;AAC9R,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,gBAAgB,EAC1B,QAAQ,EAAE,IAAI,EAAE,EAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,oBAAoB,UAAO,GAC1B;IAAE,EAAE,EAAE,gBAAgB,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CAyL/C"}
|