@kudzujs/core 0.17.10 → 0.17.12
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.12](https://github.com/kudzujs/kudzu/releases/tag/v0.17.12).** Native `SharedWorker` construction and feature detection in owned browser effects no longer cause build-time capture errors. Existing effect cleanup owns ports and listeners; no coordinator runtime is added. Generator `create-kudzu@0.1.173` targets core `^0.17.12`. 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)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ts from "typescript"
|
|
2
2
|
|
|
3
3
|
export const knownGlobalNames = new Set([
|
|
4
|
-
"Array", "ArrayBuffer", "BigInt", "Blob", "Boolean", "Date", "Error", "Event", "FileReader", "FormData", "HTMLElement", "Infinity", "IntersectionObserver", "Intl", "JSON", "Map", "Math", "NaN", "Number", "Object", "Promise", "Proxy", "RangeError", "ReferenceError", "Reflect", "RegExp", "Set", "String", "Symbol", "TypeError", "URL", "URLSearchParams", "WeakMap", "WeakSet", "WebSocket", "Worker", "alert", "atob", "btoa", "cancelAnimationFrame", "clearInterval", "clearTimeout", "console", "crypto", "document", "fetch", "globalThis", "history", "isFinite", "isNaN", "localStorage", "location", "navigator", "parseFloat", "parseInt", "performance", "queueMicrotask", "requestAnimationFrame", "setInterval", "setTimeout", "structuredClone", "undefined", "window"
|
|
4
|
+
"Array", "ArrayBuffer", "BigInt", "Blob", "Boolean", "Date", "Error", "Event", "FileReader", "FormData", "HTMLElement", "Infinity", "IntersectionObserver", "Intl", "JSON", "Map", "Math", "NaN", "Number", "Object", "Promise", "Proxy", "RangeError", "ReferenceError", "Reflect", "RegExp", "Set", "SharedWorker", "String", "Symbol", "TypeError", "URL", "URLSearchParams", "WeakMap", "WeakSet", "WebSocket", "Worker", "alert", "atob", "btoa", "cancelAnimationFrame", "clearInterval", "clearTimeout", "console", "crypto", "document", "fetch", "globalThis", "history", "isFinite", "isNaN", "localStorage", "location", "navigator", "parseFloat", "parseInt", "performance", "queueMicrotask", "requestAnimationFrame", "setInterval", "setTimeout", "structuredClone", "undefined", "window"
|
|
5
5
|
])
|
|
6
6
|
|
|
7
7
|
export function createBindingIndex(sourceFile) {
|
|
@@ -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
|
}
|