@kudzujs/core 0.16.40 → 0.16.43
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.16.x`: the compiler API and supported TSX surface may change.
|
|
16
16
|
|
|
17
|
-
**Current release: [0.16.
|
|
17
|
+
**Current release: [0.16.43](https://github.com/kudzujs/kudzu/releases/tag/v0.16.43).** This forward release carries 0.16.42's source-graph and opt-in AI-check improvements through a publication workflow that retains required Chrome in exact-commit CI. No reliable AI-token saving is established; the AI-cost/1.0 gates remain blocked.
|
|
18
18
|
|
|
19
19
|
- [Documentation](https://kudzujs.cloud/docs)
|
|
20
20
|
- [Installation guide](https://kudzujs.cloud/docs#install)
|
|
@@ -40,7 +40,7 @@ For optional AI authoring guidance and local developer tools, use
|
|
|
40
40
|
`npm create kudzu@latest my-app -- --ai`. The generated `AGENTS.md` describes
|
|
41
41
|
`npm run ai -- docs` for installed documentation and `npm run ai -- check` for
|
|
42
42
|
typecheck/build execution with bounded output and full retained logs. These tools
|
|
43
|
-
stay outside default browser output. AI-
|
|
43
|
+
stay outside default browser output. No reliable AI-cost saving has been established.
|
|
44
44
|
See the [generator guide](https://github.com/kudzujs/kudzu/tree/main/packages/create-kudzu#optional-ai-authoring-guidance).
|
|
45
45
|
|
|
46
46
|
To add Kudzu to an existing project:
|
|
@@ -73,7 +73,7 @@ export function normalizeEffectPrivateRefs(sourceFile, factory, context) {
|
|
|
73
73
|
if (frameAssignments.length && !topLevelConst) throw sourceNodeError(node, sourceFile, "Animation frame refs must be one top-level component const")
|
|
74
74
|
if (attachedToJsx && mutations.length) throw sourceNodeError(mutations[0], sourceFile, "JSX object refs may not assign to ref.current")
|
|
75
75
|
const renderWrite = mutations.find(access => nearestFunction(access) === owner)
|
|
76
|
-
if (renderWrite) throw sourceNodeError(renderWrite, sourceFile, "Mutable refs cannot be assigned during render; use component state for values retained across effect replacements, or an effect-private ref with cleanup for invocation-local values")
|
|
76
|
+
if (renderWrite) throw sourceNodeError(renderWrite, sourceFile, "Mutable refs cannot be assigned during render; use component state for values retained across effect replacements, or an effect-private ref with cleanup for invocation-local values; for one effect, use an effect-local variable and return resource cleanup")
|
|
77
77
|
if (!topLevelConst || invalidReference || !accesses.length) return
|
|
78
78
|
const effectCalls = owner.body.statements.flatMap(statement => hasUseEffectImport && ts.isExpressionStatement(statement) && ts.isCallExpression(statement.expression) && ts.isIdentifier(statement.expression.expression) && statement.expression.expression.text === "useEffect" && !isShadowedIdentifier(statement.expression.expression, sourceFile) ? [statement.expression] : [])
|
|
79
79
|
const effects = effectCalls.filter(effect => {
|
|
@@ -118,7 +118,7 @@ export function normalizeEffectPrivateRefs(sourceFile, factory, context) {
|
|
|
118
118
|
if (callback && (ts.isArrowFunction(callback) || ts.isFunctionExpression(callback)) && ts.isBlock(callback.body)) {
|
|
119
119
|
const cleanups = effectReturns(callback).cleanups
|
|
120
120
|
const cleanupWrites = cleanups.length === 1 && accesses.some(access => isNodeWithin(access, cleanups[0]) && ts.isBinaryExpression(access.parent) && unwrapExpression(access.parent.left) === access && access.parent.operatorToken.kind >= ts.SyntaxKind.FirstAssignment && access.parent.operatorToken.kind <= ts.SyntaxKind.LastAssignment)
|
|
121
|
-
if (!cleanupWrites) throw sourceNodeError(node, sourceFile, "Effect-private refs require one cleanup that directly resets or invalidates ref.current")
|
|
121
|
+
if (!cleanupWrites) throw sourceNodeError(node, sourceFile, "Effect-private refs require one cleanup that directly resets or invalidates ref.current; for one effect, use an effect-local variable and return resource cleanup")
|
|
122
122
|
registerPrivateRef(node, callback)
|
|
123
123
|
}
|
|
124
124
|
return
|
|
@@ -18,12 +18,12 @@ export function createSourceGraph(root) {
|
|
|
18
18
|
|
|
19
19
|
const ordinaryRuntimeDependencies = (file, sourceFile, sourceFiles, isStaticImport) => {
|
|
20
20
|
const dependencies = []
|
|
21
|
-
|
|
21
|
+
let bindingIndex
|
|
22
22
|
const rejectDynamicImports = node => {
|
|
23
23
|
if (ts.isCallExpression(node) && node.expression.kind === ts.SyntaxKind.ImportKeyword) {
|
|
24
24
|
const argument = node.arguments[0]
|
|
25
25
|
const specifier = node.arguments.length === 1 && ts.isStringLiteralLike(argument) ? JSON.stringify(argument.text) : argument?.getText(sourceFile) ?? "<missing>"
|
|
26
|
-
if (ownedLazyPackageImport(node, bindingIndex)) return
|
|
26
|
+
if (ownedLazyPackageImport(node, bindingIndex ??= createBindingIndex(sourceFile))) return
|
|
27
27
|
throw sourceNodeError(node, sourceFile, `Dynamic import ${specifier} is not supported in ordinary source modules`, {
|
|
28
28
|
code: "source.dynamic-import.unsupported",
|
|
29
29
|
stage: "graph",
|