@kudzujs/core 0.17.10 → 0.17.11
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
CHANGED
|
@@ -14,7 +14,7 @@ Kudzu compiles ordinary React-shaped TypeScript and TSX into complete static HTM
|
|
|
14
14
|
|
|
15
15
|
> Experimental `0.17.x`: the compiler API and supported TSX surface may change.
|
|
16
16
|
|
|
17
|
-
**Current release: [0.17.
|
|
17
|
+
**Current release: [0.17.11](https://github.com/kudzujs/kudzu/releases/tag/v0.17.11).** Supported Context-returning hooks now allow identifier aliases for state, setters and actions. Repeated consumers retain shared Provider state, and hidden setter names avoid consumer collisions. No browser runtime is added; private-timer aliases remain unsupported. Generator `create-kudzu@0.1.172` targets core `^0.17.11`. Regression and artifact evidence is recorded in `PERFORMANCE.md`; no speed or whole-application migration claim is made.
|
|
18
18
|
|
|
19
19
|
- [Documentation](https://kudzujs.cloud/docs)
|
|
20
20
|
- [Installation guide](https://kudzujs.cloud/docs#install)
|
|
@@ -715,7 +715,7 @@ function createKudzuTransformer({ semantic, handlerUrl, file, sourceFiles, sourc
|
|
|
715
715
|
const names = new Set()
|
|
716
716
|
const localNames = new Map()
|
|
717
717
|
for (const element of node.name.elements) {
|
|
718
|
-
if (element.dotDotDotToken || element.initializer || !ts.isIdentifier(element.name) || element.propertyName && (!ts.isIdentifier(element.propertyName) || hook.
|
|
718
|
+
if (element.dotDotDotToken || element.initializer || !ts.isIdentifier(element.name) || element.propertyName && (!ts.isIdentifier(element.propertyName) || hook.privateStates.size)) throw sourceNodeError(element, sourceFile, "Relative custom hook results require identifier fields and local names without defaults or rest; private-timer result aliases remain unsupported")
|
|
719
719
|
const name = (element.propertyName ?? element.name).text
|
|
720
720
|
if (!hook.fields.has(name)) throw sourceNodeError(element, sourceFile, `Relative custom hook does not directly return ${JSON.stringify(name)}`)
|
|
721
721
|
if (names.has(name)) throw sourceNodeError(element, sourceFile, `Relative custom hook result ${JSON.stringify(name)} must be destructured only once`)
|
|
@@ -740,8 +740,8 @@ function createKudzuTransformer({ semantic, handlerUrl, file, sourceFiles, sourc
|
|
|
740
740
|
if (!names.has(state) && !requiredContextStates.has(state)) continue
|
|
741
741
|
const privateFields = customHookPrivateFields.get(node) ?? []
|
|
742
742
|
const localName = field => {
|
|
743
|
-
if (names.has(field)) return field
|
|
744
|
-
const occupied = name => owner.parameters.some(parameter => bindingNames(parameter.name).includes(name)) || owner.body.statements.some(statement => statement !== node.parent.parent && statementDeclaresName(statement, name))
|
|
743
|
+
if (names.has(field)) return localNames.get(field)
|
|
744
|
+
const occupied = name => [...localNames.values()].includes(name) || setters.has(name) || [...setters.values()].includes(name) || owner.parameters.some(parameter => bindingNames(parameter.name).includes(name)) || owner.body.statements.some(statement => statement !== node.parent.parent && statementDeclaresName(statement, name))
|
|
745
745
|
if (!occupied(field)) return field
|
|
746
746
|
let index = 0
|
|
747
747
|
let local
|
|
@@ -798,12 +798,12 @@ function createKudzuTransformer({ semantic, handlerUrl, file, sourceFiles, sourc
|
|
|
798
798
|
const anchor = [...hook.states.values()].find(state => referenced.has(state))
|
|
799
799
|
const sharedState = contextSharedStates.get(anchor)
|
|
800
800
|
if (!sharedState) {
|
|
801
|
-
reducers.set(name, { sourceKind: "Context", directImplementation: callback, states })
|
|
801
|
+
reducers.set(localNames.get(name), { sourceKind: "Context", directImplementation: callback, states })
|
|
802
802
|
reducersByFunction.set(owner, reducers)
|
|
803
803
|
continue
|
|
804
804
|
}
|
|
805
805
|
const action = registerSharedAction(moduleIR, { state: sharedState.slot, name })
|
|
806
|
-
reducers.set(name, { state: contextSubstitutions.get(anchor)?.text ?? anchor, sourceKind: "Context", sharedAction: { ...action, directImplementation: callback, states } })
|
|
806
|
+
reducers.set(localNames.get(name), { state: contextSubstitutions.get(anchor)?.text ?? anchor, sourceKind: "Context", sharedAction: { ...action, directImplementation: callback, states } })
|
|
807
807
|
reducersByFunction.set(owner, reducers)
|
|
808
808
|
}
|
|
809
809
|
}
|