@barefootjs/jsx 0.39.6 → 0.39.8
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/dist/adapters/attr-plan.d.ts +8 -1
- package/dist/adapters/attr-plan.d.ts.map +1 -1
- package/dist/adapters/callback-method.d.ts +44 -0
- package/dist/adapters/callback-method.d.ts.map +1 -1
- package/dist/adapters/component-props.d.ts +80 -13
- package/dist/adapters/component-props.d.ts.map +1 -1
- package/dist/adapters/computed-const.d.ts +52 -0
- package/dist/adapters/computed-const.d.ts.map +1 -0
- package/dist/adapters/dangerous-inner-html.d.ts +10 -0
- package/dist/adapters/dangerous-inner-html.d.ts.map +1 -1
- package/dist/adapters/dsl-template-adapter.d.ts +151 -0
- package/dist/adapters/dsl-template-adapter.d.ts.map +1 -0
- package/dist/adapters/element-shell.d.ts +44 -0
- package/dist/adapters/element-shell.d.ts.map +1 -0
- package/dist/adapters/interface.d.ts +2 -0
- package/dist/adapters/interface.d.ts.map +1 -1
- package/dist/adapters/jsx-adapter.d.ts +4 -0
- package/dist/adapters/jsx-adapter.d.ts.map +1 -1
- package/dist/adapters/literal-value.d.ts +2 -2
- package/dist/adapters/literal-value.d.ts.map +1 -1
- package/dist/adapters/parsed-expr-emitter.d.ts +27 -0
- package/dist/adapters/parsed-expr-emitter.d.ts.map +1 -1
- package/dist/adapters/style-object.d.ts +33 -0
- package/dist/adapters/style-object.d.ts.map +1 -0
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/augment-inherited-props.d.ts +7 -0
- package/dist/augment-inherited-props.d.ts.map +1 -1
- package/dist/children-nullish.d.ts +22 -0
- package/dist/children-nullish.d.ts.map +1 -0
- package/dist/errors.d.ts +1 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/expression-parser.d.ts +9 -19
- package/dist/expression-parser.d.ts.map +1 -1
- package/dist/fold-render-reassignments.d.ts +43 -0
- package/dist/fold-render-reassignments.d.ts.map +1 -0
- package/dist/free-refs.d.ts +15 -0
- package/dist/free-refs.d.ts.map +1 -1
- package/dist/index.d.ts +21 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24620 -23233
- package/dist/ir-to-client-js/compute-inlinability.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/event-collision.d.ts +2 -1
- package/dist/ir-to-client-js/control-flow/plan/event-collision.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/insert.d.ts +2 -2
- package/dist/ir-to-client-js/control-flow/plan/insert.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/event-delegation.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/event-listener.d.ts +10 -9
- package/dist/ir-to-client-js/control-flow/stringify/event-listener.d.ts.map +1 -1
- package/dist/ir-to-client-js/csr-substitute.d.ts +0 -13
- package/dist/ir-to-client-js/csr-substitute.d.ts.map +1 -1
- package/dist/ir-to-client-js/emit-reactive.d.ts +1 -1
- package/dist/ir-to-client-js/emit-reactive.d.ts.map +1 -1
- package/dist/ir-to-client-js/emit-registration.d.ts +10 -8
- package/dist/ir-to-client-js/emit-registration.d.ts.map +1 -1
- package/dist/ir-to-client-js/generate-init.d.ts.map +1 -1
- package/dist/ir-to-client-js/html-template.d.ts +9 -19
- package/dist/ir-to-client-js/html-template.d.ts.map +1 -1
- package/dist/ir-to-client-js/identifiers.d.ts +6 -8
- package/dist/ir-to-client-js/identifiers.d.ts.map +1 -1
- package/dist/ir-to-client-js/imports.d.ts +23 -2
- package/dist/ir-to-client-js/imports.d.ts.map +1 -1
- package/dist/ir-to-client-js/index.d.ts.map +1 -1
- package/dist/ir-to-client-js/phases/props-extraction.d.ts +3 -2
- package/dist/ir-to-client-js/phases/props-extraction.d.ts.map +1 -1
- package/dist/ir-to-client-js/plan/declaration-emit.d.ts +5 -0
- package/dist/ir-to-client-js/plan/declaration-emit.d.ts.map +1 -1
- package/dist/ir-to-client-js/prop-handling.d.ts +11 -12
- package/dist/ir-to-client-js/prop-handling.d.ts.map +1 -1
- package/dist/ir-to-client-js/prune-unused-prop-extractions.d.ts +1 -1
- package/dist/ir-to-client-js/prune-unused-prop-extractions.d.ts.map +1 -1
- package/dist/ir-to-client-js/reactivity.d.ts.map +1 -1
- package/dist/ir-to-client-js/rewrite-destructured-props.d.ts +1 -1
- package/dist/ir-to-client-js/rewrite-destructured-props.d.ts.map +1 -1
- package/dist/ir-to-client-js/safe-html.d.ts +20 -2
- package/dist/ir-to-client-js/safe-html.d.ts.map +1 -1
- package/dist/ir-to-client-js/types.d.ts +3 -3
- package/dist/ir-to-client-js/types.d.ts.map +1 -1
- package/dist/ir-to-client-js/utils.d.ts +15 -11
- package/dist/ir-to-client-js/utils.d.ts.map +1 -1
- package/dist/jsx-to-ir.d.ts.map +1 -1
- package/dist/nullable-signal-attr.d.ts +43 -12
- package/dist/nullable-signal-attr.d.ts.map +1 -1
- package/dist/prop-rewrite.d.ts +18 -0
- package/dist/prop-rewrite.d.ts.map +1 -1
- package/dist/props-binding.d.ts +43 -6
- package/dist/props-binding.d.ts.map +1 -1
- package/dist/relocate.d.ts +16 -0
- package/dist/relocate.d.ts.map +1 -1
- package/dist/scanner/js-scanner.d.ts.map +1 -1
- package/dist/scanner/js-scanner.js +30 -2
- package/dist/signal-prop-name-collision.d.ts +6 -5
- package/dist/signal-prop-name-collision.d.ts.map +1 -1
- package/dist/ssr-defaults.d.ts +28 -0
- package/dist/ssr-defaults.d.ts.map +1 -1
- package/dist/ssr-seed-plan.d.ts +37 -18
- package/dist/ssr-seed-plan.d.ts.map +1 -1
- package/dist/types.d.ts +162 -20
- package/dist/types.d.ts.map +1 -1
- package/dist/value-references.d.ts +21 -0
- package/dist/value-references.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/__snapshots__/doc-examples.test.ts.snap +18 -18
- package/src/__tests__/adapter-output.test.ts +5 -3
- package/src/__tests__/analyzer.test.ts +33 -0
- package/src/__tests__/arithmetic-lowering.test.ts +44 -0
- package/src/__tests__/block-memo-type.test.ts +51 -0
- package/src/__tests__/callback-method.test.ts +75 -0
- package/src/__tests__/children-read.test.ts +226 -0
- package/src/__tests__/client-only-date-lowering.test.ts +2 -2
- package/src/__tests__/client-template-escape-soundness.test.ts +31 -1
- package/src/__tests__/component-props.test.ts +68 -1
- package/src/__tests__/computed-const.test.ts +101 -0
- package/src/__tests__/constant-inlining-tree.test.ts +136 -0
- package/src/__tests__/destructure-default-reads-earlier-param.test.ts +138 -0
- package/src/__tests__/dsl-template-adapter.test.ts +173 -0
- package/src/__tests__/element-shell.test.ts +78 -0
- package/src/__tests__/event-handler-verbatim.test.ts +73 -0
- package/src/__tests__/expression-parser.test.ts +1 -44
- package/src/__tests__/fold-render-reassignments.test.ts +96 -0
- package/src/__tests__/inlinable-local-method-call.test.ts +81 -0
- package/src/__tests__/memo-body-expr.test.ts +120 -0
- package/src/__tests__/nullable-signal-attr.test.ts +67 -3
- package/src/__tests__/prop-handling.test.ts +35 -16
- package/src/__tests__/props-alias-const.test.ts +65 -0
- package/src/__tests__/reference-graph-identifiers.test.ts +161 -0
- package/src/__tests__/runtime-import-detection.test.ts +134 -0
- package/src/__tests__/signal-prop-name-collision.test.ts +30 -0
- package/src/__tests__/signal-prop-seed.test.ts +90 -0
- package/src/__tests__/ssr-defaults.test.ts +19 -1
- package/src/__tests__/ssr-seed-plan.test.ts +173 -1
- package/src/__tests__/static-template-reachability.test.ts +137 -0
- package/src/__tests__/style-object-plan.test.ts +54 -0
- package/src/__tests__/zero-param-helper-inline.test.ts +57 -0
- package/src/adapters/attr-plan.ts +29 -1
- package/src/adapters/callback-method.ts +85 -0
- package/src/adapters/component-props.ts +130 -12
- package/src/adapters/computed-const.ts +185 -0
- package/src/adapters/dangerous-inner-html.ts +33 -0
- package/src/adapters/dsl-template-adapter.ts +248 -0
- package/src/adapters/element-shell.ts +160 -0
- package/src/adapters/interface.ts +8 -0
- package/src/adapters/jsx-adapter.ts +12 -6
- package/src/adapters/literal-value.ts +2 -2
- package/src/adapters/parsed-expr-emitter.ts +34 -0
- package/src/adapters/style-object.ts +61 -0
- package/src/analyzer.ts +382 -94
- package/src/augment-inherited-props.ts +12 -0
- package/src/children-nullish.ts +33 -0
- package/src/debug.ts +2 -2
- package/src/errors.ts +12 -0
- package/src/expression-parser.ts +56 -53
- package/src/fold-render-reassignments.ts +314 -0
- package/src/free-refs.ts +77 -17
- package/src/index.ts +27 -10
- package/src/ir-to-client-js/compute-inlinability.ts +122 -19
- package/src/ir-to-client-js/control-flow/plan/event-collision.ts +2 -1
- package/src/ir-to-client-js/control-flow/plan/insert.ts +2 -2
- package/src/ir-to-client-js/control-flow/stringify/event-delegation.ts +3 -2
- package/src/ir-to-client-js/control-flow/stringify/event-listener.ts +13 -12
- package/src/ir-to-client-js/csr-substitute.ts +25 -37
- package/src/ir-to-client-js/emit-reactive.ts +2 -2
- package/src/ir-to-client-js/emit-registration.ts +31 -59
- package/src/ir-to-client-js/generate-init.ts +17 -1
- package/src/ir-to-client-js/html-template.ts +56 -120
- package/src/ir-to-client-js/identifiers.ts +75 -24
- package/src/ir-to-client-js/imports.ts +56 -19
- package/src/ir-to-client-js/index.ts +5 -3
- package/src/ir-to-client-js/init-declarations.ts +1 -1
- package/src/ir-to-client-js/phases/event-handlers.ts +2 -2
- package/src/ir-to-client-js/phases/props-extraction.ts +16 -15
- package/src/ir-to-client-js/plan/build-declaration-emit.ts +26 -52
- package/src/ir-to-client-js/plan/declaration-emit.ts +5 -0
- package/src/ir-to-client-js/prop-handling.ts +13 -54
- package/src/ir-to-client-js/prune-unused-prop-extractions.ts +7 -4
- package/src/ir-to-client-js/reactivity.ts +2 -2
- package/src/ir-to-client-js/rewrite-destructured-props.ts +27 -9
- package/src/ir-to-client-js/safe-html.ts +29 -35
- package/src/ir-to-client-js/stringify/declaration-emit.ts +1 -1
- package/src/ir-to-client-js/types.ts +3 -2
- package/src/ir-to-client-js/utils.ts +13 -26
- package/src/jsx-to-ir.ts +318 -130
- package/src/nullable-signal-attr.ts +156 -37
- package/src/prop-rewrite.ts +41 -0
- package/src/props-binding.ts +117 -7
- package/src/relocate.ts +40 -8
- package/src/scanner/__tests__/js-scanner.test.ts +37 -0
- package/src/scanner/js-scanner.ts +64 -4
- package/src/signal-prop-name-collision.ts +50 -24
- package/src/ssr-defaults.ts +47 -20
- package/src/ssr-seed-plan.ts +121 -29
- package/src/types.ts +165 -21
- package/src/value-references.ts +132 -0
|
@@ -62,9 +62,14 @@ export function* iterateJsTokens(
|
|
|
62
62
|
// closes an object literal nested inside.
|
|
63
63
|
const templateStack: { braceDepth: number }[] = []
|
|
64
64
|
|
|
65
|
-
//
|
|
66
|
-
// regex
|
|
65
|
+
// Whether a `/` after the previous *significant* (non-trivia) token
|
|
66
|
+
// starts a regex literal (`regexAfter`), and that token's kind.
|
|
67
67
|
let prevSignificant: ts.SyntaxKind | undefined
|
|
68
|
+
let regexMayStart = true
|
|
69
|
+
// One entry per open `(`: whether it opens a `for (…)` / `for await (…)`
|
|
70
|
+
// header, where `of` can be the for-of separator.
|
|
71
|
+
const parens: boolean[] = []
|
|
72
|
+
let beforePrev: ts.SyntaxKind | undefined
|
|
68
73
|
|
|
69
74
|
while (true) {
|
|
70
75
|
let kind = scanner.scan()
|
|
@@ -74,7 +79,7 @@ export function* iterateJsTokens(
|
|
|
74
79
|
// significant token cannot end an expression.
|
|
75
80
|
if (
|
|
76
81
|
(kind === ts.SyntaxKind.SlashToken || kind === ts.SyntaxKind.SlashEqualsToken)
|
|
77
|
-
&&
|
|
82
|
+
&& regexMayStart
|
|
78
83
|
) {
|
|
79
84
|
kind = scanner.reScanSlashToken()
|
|
80
85
|
}
|
|
@@ -106,10 +111,65 @@ export function* iterateJsTokens(
|
|
|
106
111
|
|
|
107
112
|
yield { kind, pos: scanner.getTokenStart(), end: scanner.getTokenEnd() }
|
|
108
113
|
|
|
109
|
-
if (!isTriviaKind(kind))
|
|
114
|
+
if (!isTriviaKind(kind)) {
|
|
115
|
+
trackForHeaderParens(parens, kind, prevSignificant, beforePrev)
|
|
116
|
+
regexMayStart = regexAfter(kind, prevSignificant, parens[parens.length - 1] === true)
|
|
117
|
+
beforePrev = prevSignificant
|
|
118
|
+
prevSignificant = kind
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Push / pop `parens` for an open / close paren: each entry says whether that
|
|
125
|
+
* `(` opens a `for (…)` or `for await (…)` header.
|
|
126
|
+
*/
|
|
127
|
+
function trackForHeaderParens(
|
|
128
|
+
parens: boolean[],
|
|
129
|
+
kind: ts.SyntaxKind,
|
|
130
|
+
prev: ts.SyntaxKind | undefined,
|
|
131
|
+
beforePrev: ts.SyntaxKind | undefined,
|
|
132
|
+
): void {
|
|
133
|
+
if (kind === ts.SyntaxKind.OpenParenToken) {
|
|
134
|
+
parens.push(prev === ts.SyntaxKind.ForKeyword
|
|
135
|
+
|| (prev === ts.SyntaxKind.AwaitKeyword && beforePrev === ts.SyntaxKind.ForKeyword))
|
|
136
|
+
} else if (kind === ts.SyntaxKind.CloseParenToken) {
|
|
137
|
+
parens.pop()
|
|
110
138
|
}
|
|
111
139
|
}
|
|
112
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Whether a `/` right after a `kind` token (itself preceded by `before`)
|
|
143
|
+
* starts a regex literal. A keyword used as a name ends an expression like
|
|
144
|
+
* an identifier does, so `/` after it is division: a member name
|
|
145
|
+
* (`obj.default / 2`) and a contextual keyword, which is a legal binding
|
|
146
|
+
* name (`type / 2`). `await` keeps its operator reading (`await /re/`), and
|
|
147
|
+
* so does `of` as the separator of a `for (…)` header (`inForHeader`).
|
|
148
|
+
*/
|
|
149
|
+
function regexAfter(kind: ts.SyntaxKind, before: ts.SyntaxKind | undefined, inForHeader: boolean): boolean {
|
|
150
|
+
if (kind >= ts.SyntaxKind.FirstKeyword && kind <= ts.SyntaxKind.LastKeyword) {
|
|
151
|
+
if (before === ts.SyntaxKind.DotToken || before === ts.SyntaxKind.QuestionDotToken) return false
|
|
152
|
+
// `of` right after a binding, directly inside a `for (…)` header, is the
|
|
153
|
+
// for-of separator, which an expression follows:
|
|
154
|
+
// `for (const hit of /re/.exec(s))`. Elsewhere (`let of = x⏎of /= 2`)
|
|
155
|
+
// it is a name.
|
|
156
|
+
if (kind === ts.SyntaxKind.OfKeyword && inForHeader && endsBinding(before)) return true
|
|
157
|
+
if (kind > ts.SyntaxKind.LastFutureReservedWord && kind !== ts.SyntaxKind.AwaitKeyword) return false
|
|
158
|
+
}
|
|
159
|
+
return canRegexStartHere(kind)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Whether a `before` token can end a `for…of` binding: a name (`x`, or a
|
|
164
|
+
* contextual keyword used as one, `type`), `[a, b]` or `{ a }`.
|
|
165
|
+
*/
|
|
166
|
+
function endsBinding(before: ts.SyntaxKind | undefined): boolean {
|
|
167
|
+
return before === ts.SyntaxKind.Identifier
|
|
168
|
+
|| before === ts.SyntaxKind.CloseBracketToken
|
|
169
|
+
|| before === ts.SyntaxKind.CloseBraceToken
|
|
170
|
+
|| (before !== undefined && before > ts.SyntaxKind.LastFutureReservedWord && before <= ts.SyntaxKind.LastKeyword)
|
|
171
|
+
}
|
|
172
|
+
|
|
113
173
|
export function isTriviaKind(kind: ts.SyntaxKind): boolean {
|
|
114
174
|
return (
|
|
115
175
|
kind === ts.SyntaxKind.WhitespaceTrivia
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import ts from 'typescript'
|
|
2
2
|
import path from 'node:path'
|
|
3
3
|
import type { AnalyzerContext } from './analyzer-context.ts'
|
|
4
|
-
import type {
|
|
4
|
+
import type { SourceLocation } from './types.ts'
|
|
5
|
+
import { localConstValuesByName, referencesOwnProp } from './ssr-defaults.ts'
|
|
5
6
|
|
|
6
7
|
// TypeScript exposes these resolution-cache readers on Program at runtime
|
|
7
8
|
// (its own incremental rebuild uses them), but omits them from the public
|
|
@@ -65,21 +66,47 @@ export function programWithSeparatedSource(program: ts.Program, filePath: string
|
|
|
65
66
|
} })
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
/** A component-scope signal getter or memo whose binding is renamed. */
|
|
70
|
+
interface SeparatedBinding {
|
|
71
|
+
name: string
|
|
72
|
+
loc: SourceLocation
|
|
73
|
+
prefix: 'bfSignal' | 'bfMemo'
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Signal getters and memos that share a name with a prop of a bare-props
|
|
78
|
+
* component (`props.label` beside `const [label] = createSignal(...)` or
|
|
79
|
+
* `const label = createMemo(...)`). The comparison ignores case because a
|
|
80
|
+
* backend may fold it (Go exports both `label` and `Label` as the field
|
|
81
|
+
* `Label`).
|
|
82
|
+
*
|
|
83
|
+
* A binding whose own initializer derives from that same prop
|
|
84
|
+
* (`createSignal(props.label ?? 'x')`) is left alone: the template-stash
|
|
85
|
+
* backends keep it on the prop's variable, seeded from the raw prop, and
|
|
86
|
+
* `extractSsrDefaults` decides that case with the same `referencesOwnProp`
|
|
87
|
+
* test. A raw `props.label` read beside such a binding then sees the
|
|
88
|
+
* derived value (limitation `signal-from-same-named-prop-raw-read`).
|
|
89
|
+
*/
|
|
90
|
+
function collidingBindings(ctx: AnalyzerContext, propsObjectName: string): SeparatedBinding[] {
|
|
91
|
+
const propNames = new Set(ctx.propsParams.map(p => p.name.toLowerCase()))
|
|
92
|
+
const localConsts = localConstValuesByName(ctx)
|
|
93
|
+
const collides = (name: string, derivation: string): boolean =>
|
|
94
|
+
propNames.has(name.toLowerCase()) && !referencesOwnProp(derivation, propsObjectName, name, localConsts)
|
|
95
|
+
const signals: SeparatedBinding[] = ctx.signals
|
|
96
|
+
.filter(s => !s.isModule && !s.getterElided && !s.envReader && collides(s.getter, s.initialValue))
|
|
97
|
+
.map(s => ({ name: s.getter, loc: s.loc, prefix: 'bfSignal' }))
|
|
98
|
+
const memos: SeparatedBinding[] = ctx.memos
|
|
99
|
+
.filter(m => !m.isModule && collides(m.name, m.computation))
|
|
100
|
+
.map(m => ({ name: m.name, loc: m.loc, prefix: 'bfMemo' }))
|
|
101
|
+
return [...signals, ...memos]
|
|
76
102
|
}
|
|
77
103
|
|
|
78
104
|
/**
|
|
79
|
-
* A
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
105
|
+
* A prop and a signal getter or memo of the same name are different JS
|
|
106
|
+
* bindings (`props.label` and `label()`), but scalar template backends
|
|
107
|
+
* flatten both to one variable. Give the local binding a hygienic name
|
|
108
|
+
* before building IR, so every backend (including the client emitter)
|
|
109
|
+
* receives one consistent binding identity.
|
|
83
110
|
*
|
|
84
111
|
* Source edits are AST/symbol-based and preserve untouched source bytes.
|
|
85
112
|
* Property keys, strings, and shadowing callback bindings never rename;
|
|
@@ -88,15 +115,12 @@ function isLiteralTree(expr: ParsedExpr): boolean {
|
|
|
88
115
|
* fallback binds the already-parsed SourceFile without parsing or loading
|
|
89
116
|
* dependencies: only lexical symbol identity is needed, not types.
|
|
90
117
|
*/
|
|
91
|
-
export function
|
|
118
|
+
export function separateSignalPropBindings(
|
|
92
119
|
ctx: AnalyzerContext,
|
|
93
120
|
isNonReference: (id: ts.Identifier) => boolean,
|
|
94
121
|
): string | null {
|
|
95
122
|
if (!ctx.propsObjectName || !ctx.componentNode) return null
|
|
96
|
-
const
|
|
97
|
-
const candidates = ctx.signals.filter(s =>
|
|
98
|
-
!s.isModule && !s.getterElided && propNames.has(s.getter) && s.parsed && isLiteralTree(s.parsed),
|
|
99
|
-
)
|
|
123
|
+
const candidates = collidingBindings(ctx, ctx.propsObjectName)
|
|
100
124
|
if (candidates.length === 0) return null
|
|
101
125
|
|
|
102
126
|
const sf = ctx.sourceFile
|
|
@@ -111,23 +135,25 @@ export function separateLiteralSignalPropBindings(
|
|
|
111
135
|
ts.forEachChild(node, collectNames)
|
|
112
136
|
}
|
|
113
137
|
collectNames(sf)
|
|
138
|
+
// A prop typed by an imported interface has no identifier in this file.
|
|
139
|
+
for (const p of ctx.propsParams) occupied.add(p.name.toLowerCase())
|
|
114
140
|
|
|
115
141
|
const renames = new Map<ts.Symbol, string>()
|
|
116
|
-
const declarations = new Map(candidates.map(
|
|
117
|
-
sf.getPositionOfLineAndCharacter(
|
|
142
|
+
const declarations = new Map(candidates.map(b => [
|
|
143
|
+
sf.getPositionOfLineAndCharacter(b.loc.start.line - 1, b.loc.start.column), b,
|
|
118
144
|
]))
|
|
119
145
|
function collectBindings(node: ts.Node): void {
|
|
120
146
|
if (ts.isVariableDeclaration(node)) {
|
|
121
|
-
const
|
|
122
|
-
if (
|
|
147
|
+
const binding = declarations.get(node.getStart(sf))
|
|
148
|
+
if (binding) {
|
|
123
149
|
const names = ts.isIdentifier(node.name) ? [node.name]
|
|
124
150
|
: ts.isArrayBindingPattern(node.name)
|
|
125
151
|
? node.name.elements.flatMap(e => ts.isBindingElement(e) && ts.isIdentifier(e.name) ? [e.name] : [])
|
|
126
152
|
: []
|
|
127
|
-
const id = names.find(n => n.text ===
|
|
153
|
+
const id = names.find(n => n.text === binding.name)
|
|
128
154
|
const symbol = id && checker.getSymbolAtLocation(id)
|
|
129
155
|
if (symbol) {
|
|
130
|
-
const base =
|
|
156
|
+
const base = `${binding.prefix}_${binding.name}`
|
|
131
157
|
let name = base
|
|
132
158
|
let suffix = 0
|
|
133
159
|
while (occupied.has(name.toLowerCase())) name = `${base}_${++suffix}`
|
package/src/ssr-defaults.ts
CHANGED
|
@@ -33,6 +33,7 @@ import ts from 'typescript'
|
|
|
33
33
|
import { extractFreeIdentifiersFromNode } from './analyzer.ts'
|
|
34
34
|
import { resolveGetterAliases, collectAliasableGetterNames } from './ir-to-client-js/csr-substitute.ts'
|
|
35
35
|
import { resolveBodyDestructuredPropAliases } from './props-binding.ts'
|
|
36
|
+
import { computeSsrSeedPlan } from './ssr-seed-plan.ts'
|
|
36
37
|
import type { IRMetadata } from './types.ts'
|
|
37
38
|
import { isElidedFactoryGetter } from './types.ts'
|
|
38
39
|
|
|
@@ -162,6 +163,44 @@ interface EvalContext {
|
|
|
162
163
|
propsLike: ReadonlySet<string>
|
|
163
164
|
}
|
|
164
165
|
|
|
166
|
+
/**
|
|
167
|
+
* One entry per prop for {@link extractSsrDefaults} (see its comment on the
|
|
168
|
+
* two parameter forms): a static destructure default seeds its evaluated
|
|
169
|
+
* value, any other prop seeds `null`.
|
|
170
|
+
*/
|
|
171
|
+
function addPropSsrDefaults(
|
|
172
|
+
metadata: IRMetadata,
|
|
173
|
+
propsLike: ReadonlySet<string>,
|
|
174
|
+
out: Record<string, SsrDefault>,
|
|
175
|
+
): void {
|
|
176
|
+
// A prop whose default reads an earlier prop (`{ off = false, on = !off }`,
|
|
177
|
+
// #3531) and that the seed plan re-binds in-template: its value depends on
|
|
178
|
+
// what the caller passed, so no static value is right, and a non-null seed
|
|
179
|
+
// would read as caller-supplied to the template's own `on ?? !off`.
|
|
180
|
+
const plan = metadata.ssrSeedPlan ?? computeSsrSeedPlan(metadata)
|
|
181
|
+
const templateDefaulted = new Set(
|
|
182
|
+
plan.steps.filter(s => s.kind === 'derived' && s.origin === 'prop').map(s => s.name),
|
|
183
|
+
)
|
|
184
|
+
for (const p of metadata.propsParams) {
|
|
185
|
+
if (p.isRest) continue
|
|
186
|
+
// `propName` is the CALLER-facing key (`$props->{propName}` in the Perl
|
|
187
|
+
// consumer above) — for a renaming destructure (`{ n: count }`) that's
|
|
188
|
+
// `n`, not the local binding `count` the template variable is keyed by.
|
|
189
|
+
// `sourceName ?? name` is an identity for every un-aliased prop.
|
|
190
|
+
const callerPropName = p.sourceName ?? p.name
|
|
191
|
+
if (p.defaultValue !== undefined && !templateDefaulted.has(p.name)) {
|
|
192
|
+
const value = tryStaticEval(p.defaultValue, { bindings: {}, propsLike })
|
|
193
|
+
out[p.name] = { propName: callerPropName, value: resultToJsonable(value) }
|
|
194
|
+
} else {
|
|
195
|
+
// No destructure default — the template reads the prop as-is;
|
|
196
|
+
// Perl's `//` operator decides what `undef` becomes. The entry
|
|
197
|
+
// still matters so the template variable exists and consumers
|
|
198
|
+
// can supply the propName even with no static fallback.
|
|
199
|
+
out[p.name] = { propName: callerPropName, value: null }
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
165
204
|
/**
|
|
166
205
|
* Extract a JSON-encodable defaults map for the SSR stash.
|
|
167
206
|
*
|
|
@@ -194,24 +233,7 @@ export function extractSsrDefaults(metadata: IRMetadata): Record<string, SsrDefa
|
|
|
194
233
|
// evaluated value; one with none seeds `null` (→ undef; the
|
|
195
234
|
// template-side `// …` recompute supplies the real default, and a
|
|
196
235
|
// caller-passed prop wins via `propName`).
|
|
197
|
-
|
|
198
|
-
if (p.isRest) continue
|
|
199
|
-
// `propName` is the CALLER-facing key (`$props->{propName}` in the Perl
|
|
200
|
-
// consumer above) — for a renaming destructure (`{ n: count }`) that's
|
|
201
|
-
// `n`, not the local binding `count` the template variable is keyed by.
|
|
202
|
-
// `sourceName ?? name` is an identity for every un-aliased prop.
|
|
203
|
-
const callerPropName = p.sourceName ?? p.name
|
|
204
|
-
if (p.defaultValue !== undefined) {
|
|
205
|
-
const value = tryStaticEval(p.defaultValue, { bindings: {}, propsLike })
|
|
206
|
-
out[p.name] = { propName: callerPropName, value: resultToJsonable(value) }
|
|
207
|
-
} else {
|
|
208
|
-
// No destructure default — the template reads the prop as-is;
|
|
209
|
-
// Perl's `//` operator decides what `undef` becomes. The entry
|
|
210
|
-
// still matters so the template variable exists and consumers
|
|
211
|
-
// can supply the propName even with no static fallback.
|
|
212
|
-
out[p.name] = { propName: callerPropName, value: null }
|
|
213
|
-
}
|
|
214
|
-
}
|
|
236
|
+
addPropSsrDefaults(metadata, propsLike, out)
|
|
215
237
|
// Rest-props bag (`...props`) — tracked separately from `propsParams`
|
|
216
238
|
// by the analyzer. Default to an empty plain hash so adapters can
|
|
217
239
|
// forward it through `spreadAttrs` without a nullability check.
|
|
@@ -444,7 +466,7 @@ export function extractSsrDefaults(metadata: IRMetadata): Record<string, SsrDefa
|
|
|
444
466
|
* (a module const referencing `props` isn't legal JS — `props` is a
|
|
445
467
|
* function parameter), so it can never contribute a prop reference here.
|
|
446
468
|
*/
|
|
447
|
-
function localConstValuesByName(metadata: IRMetadata): ReadonlyMap<string, string> {
|
|
469
|
+
export function localConstValuesByName(metadata: Pick<IRMetadata, 'localConstants'>): ReadonlyMap<string, string> {
|
|
448
470
|
const out = new Map<string, string>()
|
|
449
471
|
for (const c of metadata.localConstants ?? []) {
|
|
450
472
|
if (c.isModule || c.value === undefined) continue
|
|
@@ -462,8 +484,13 @@ function localConstValuesByName(metadata: IRMetadata): ReadonlyMap<string, strin
|
|
|
462
484
|
* (never a bespoke walker — see the CLAUDE.md rule this file already
|
|
463
485
|
* follows for `props.X` collection) and just checks membership of the one
|
|
464
486
|
* name we care about.
|
|
487
|
+
*
|
|
488
|
+
* Also the analyzer's test for which same-named signal/memo keeps sharing
|
|
489
|
+
* the prop's template variable (`separateSignalPropBindings`): a binding
|
|
490
|
+
* this answers `false` for is renamed before IR is built, so the two
|
|
491
|
+
* callers cannot disagree about which collisions stay collapsed.
|
|
465
492
|
*/
|
|
466
|
-
function referencesOwnProp(
|
|
493
|
+
export function referencesOwnProp(
|
|
467
494
|
expr: string | undefined,
|
|
468
495
|
propsObjectName: string,
|
|
469
496
|
name: string,
|
package/src/ssr-seed-plan.ts
CHANGED
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
* template adapters' seed paths; this module computes it once, on the IR, so
|
|
9
9
|
* every adapter consumes the same plan and only supplies its own syntax.
|
|
10
10
|
*
|
|
11
|
-
* Ordering / acyclicity guarantee: `steps` lists the
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* Ordering / acyclicity guarantee: `steps` lists the props whose destructure
|
|
12
|
+
* default reads an earlier prop first, in parameter order, then the
|
|
13
|
+
* component's signals, then its memos, each group in declaration order
|
|
14
|
+
* (matching `IRMetadata.signals` / `IRMetadata.memos`), then canonical getter
|
|
15
|
+
* aliases.
|
|
14
16
|
* A binding's name only enters
|
|
15
17
|
* the scope set AFTER its own step is decided, so a `derived` step's `frees`
|
|
16
18
|
* can only name `baseScope` entries or EARLIER steps — self- and
|
|
@@ -22,11 +24,11 @@
|
|
|
22
24
|
* literal value — `collectModuleStringConsts` is the shared source of that
|
|
23
25
|
* set — so a reference to one is never a template-variable read.
|
|
24
26
|
*
|
|
25
|
-
* A `derived` step
|
|
26
|
-
* `createSignal('b')`)
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
27
|
+
* A `derived` step whose `frees` name only module pure-string consts (or
|
|
28
|
+
* nothing, e.g. `createSignal('b')`) is a constant expression, marked
|
|
29
|
+
* `constant`: the plan still classifies it as derived because the expression
|
|
30
|
+
* is fully analyzable, and adapters keep their static ssr-defaults seed for
|
|
31
|
+
* it instead of computing it in-template. Likewise the plan makes no backend-specific choices —
|
|
30
32
|
* no target-variable checks, no self-shadowing rules, no per-backend shape
|
|
31
33
|
* catalogs — those stay in the adapters.
|
|
32
34
|
*/
|
|
@@ -35,19 +37,20 @@ import { collectModuleStringConsts } from './augment-inherited-props.ts'
|
|
|
35
37
|
import { collectAliasableGetterNames, resolveGetterAliases } from './ir-to-client-js/csr-substitute.ts'
|
|
36
38
|
import { envSignalReaderFor, type EnvSignalReader } from './adapters/env-signal.ts'
|
|
37
39
|
import {
|
|
38
|
-
extractArrowBodyExpression,
|
|
39
40
|
freeIdentifiers,
|
|
40
41
|
inlineBinding,
|
|
41
42
|
isSupportedValue,
|
|
42
43
|
parseExpression,
|
|
44
|
+
stringifyParsedExpr,
|
|
43
45
|
type ParsedExpr,
|
|
44
46
|
} from './expression-parser.ts'
|
|
45
|
-
import type { IRMetadata } from './types.ts'
|
|
47
|
+
import type { IRMetadata, ParamInfo } from './types.ts'
|
|
46
48
|
import { isElidedFactoryGetter } from './types.ts'
|
|
47
49
|
|
|
48
50
|
/**
|
|
49
|
-
* One binding in dependency order (signals, memos,
|
|
50
|
-
* matching `IRMetadata` order and the adapters'
|
|
51
|
+
* One binding in dependency order (dependent prop defaults, signals, memos,
|
|
52
|
+
* then getter aliases — matching `IRMetadata` order and the adapters'
|
|
53
|
+
* iteration).
|
|
51
54
|
*
|
|
52
55
|
* - `env-reader`: an env signal whose `envReader` key resolves in the shared
|
|
53
56
|
* registry (`envSignalReaderFor`). The runtime provides the per-request
|
|
@@ -56,7 +59,12 @@ import { isElidedFactoryGetter } from './types.ts'
|
|
|
56
59
|
* registry falls through to the normal derived/opaque rules instead.
|
|
57
60
|
* - `derived`: the binding's value expression is a supported shape whose free
|
|
58
61
|
* identifiers are all in scope at this point (baseScope + earlier steps) —
|
|
59
|
-
* an adapter may seed it in-template by lowering `parsed`/`expr`.
|
|
62
|
+
* an adapter may seed it in-template by lowering `parsed`/`expr`. An
|
|
63
|
+
* `origin: 'prop'` step re-binds a prop whose destructure default reads an
|
|
64
|
+
* earlier prop (`{ off = false, on = off }` → `on ?? off`, #3531): the
|
|
65
|
+
* static ssr-defaults seed cannot hold a value that depends on what the
|
|
66
|
+
* caller passed, so the template applies the default itself, reading the
|
|
67
|
+
* earlier prop's template variable.
|
|
60
68
|
* - `opaque`: not seedable this way (empty init, unsupported shape,
|
|
61
69
|
* unanalyzable free set, out-of-scope reference, or a block-bodied memo).
|
|
62
70
|
* The name still enters scope for later steps; adapters keep their static
|
|
@@ -64,8 +72,21 @@ import { isElidedFactoryGetter } from './types.ts'
|
|
|
64
72
|
*/
|
|
65
73
|
export type SsrSeedStep =
|
|
66
74
|
| { kind: 'env-reader'; name: string; reader: EnvSignalReader }
|
|
67
|
-
| {
|
|
68
|
-
|
|
75
|
+
| {
|
|
76
|
+
kind: 'derived'
|
|
77
|
+
name: string
|
|
78
|
+
origin: 'signal' | 'memo' | 'prop'
|
|
79
|
+
expr: string
|
|
80
|
+
parsed: ParsedExpr
|
|
81
|
+
frees: string[]
|
|
82
|
+
/**
|
|
83
|
+
* Every free identifier is a module pure-string const, which every
|
|
84
|
+
* adapter inlines, so the lowered expression reads no template
|
|
85
|
+
* variable (#3542).
|
|
86
|
+
*/
|
|
87
|
+
constant: boolean
|
|
88
|
+
}
|
|
89
|
+
| { kind: 'opaque'; name: string; origin: 'signal' | 'memo' | 'prop' }
|
|
69
90
|
|
|
70
91
|
export interface SsrSeedPlan {
|
|
71
92
|
/**
|
|
@@ -92,18 +113,21 @@ export interface SsrSeedPlan {
|
|
|
92
113
|
*/
|
|
93
114
|
function classify(
|
|
94
115
|
name: string,
|
|
95
|
-
origin: 'signal' | 'memo',
|
|
116
|
+
origin: 'signal' | 'memo' | 'prop',
|
|
96
117
|
expr: string,
|
|
97
118
|
parsed: ParsedExpr,
|
|
98
119
|
available: ReadonlySet<string>,
|
|
120
|
+
inlined: ReadonlySet<string>,
|
|
99
121
|
): SsrSeedStep {
|
|
100
|
-
|
|
122
|
+
const opaque: SsrSeedStep = { kind: 'opaque', name, origin }
|
|
123
|
+
if (!isSupportedValue(parsed).supported) return opaque
|
|
101
124
|
const frees = freeIdentifiers(parsed)
|
|
102
|
-
if (frees === null) return
|
|
125
|
+
if (frees === null) return opaque
|
|
103
126
|
for (const free of frees) {
|
|
104
|
-
if (!available.has(free)) return
|
|
127
|
+
if (!available.has(free)) return opaque
|
|
105
128
|
}
|
|
106
|
-
|
|
129
|
+
const constant = [...frees].every(free => inlined.has(free))
|
|
130
|
+
return { kind: 'derived', name, origin, expr, parsed, frees: [...frees], constant }
|
|
107
131
|
}
|
|
108
132
|
|
|
109
133
|
/**
|
|
@@ -174,21 +198,88 @@ function resolveThroughLocalConsts(
|
|
|
174
198
|
|
|
175
199
|
/**
|
|
176
200
|
* Compute the component's SSR seed plan from its metadata. See the module
|
|
177
|
-
* doc for the contract.
|
|
178
|
-
* (`
|
|
179
|
-
* `
|
|
201
|
+
* doc for the contract. A memo step reads the expression its callback
|
|
202
|
+
* returns (`MemoInfo.bodyExpr`): an arrow expression body, or a block or
|
|
203
|
+
* `function` body that is a single `return`. A multi-statement body seeds
|
|
204
|
+
* from the analyzer's fold of its statements (`MemoInfo.parsed`, #2040,
|
|
205
|
+
* #3523), and is `opaque` when the fold failed.
|
|
206
|
+
*/
|
|
207
|
+
/**
|
|
208
|
+
* The expression a memo seeds from: the returned expression, as the analyzer
|
|
209
|
+
* read it from the callback node (#3510). A body that must be called as a
|
|
210
|
+
* whole seeds from the analyzer's fold of its statements into one expression
|
|
211
|
+
* when there is one (#3523); `''` (opaque) otherwise.
|
|
212
|
+
*/
|
|
213
|
+
function memoSeedExpr(memo: IRMetadata['memos'][number]): string {
|
|
214
|
+
if (!memo.bodyExprIsCall) return memo.bodyExpr?.trim() ?? ''
|
|
215
|
+
return memo.parsed ? stringifyParsedExpr(memo.parsed) : ''
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* A `derived` step per prop whose destructure default reads an earlier prop of
|
|
220
|
+
* the same pattern (`ParamInfo.defaultParts`, #3531): `on ?? <default>`, where
|
|
221
|
+
* the default's identifiers are the earlier props' template variables. Every
|
|
222
|
+
* prop is already in `available` (baseScope), and the steps run in dependency
|
|
223
|
+
* order ({@link inDefaultReadOrder}), so a chain (`{ a = 1, b = a, c = b }`)
|
|
224
|
+
* reads `b` after its own step re-bound it. A default the plan cannot lower
|
|
225
|
+
* (or a function default) adds no step and keeps the static ssr-defaults
|
|
226
|
+
* seed. A callback inside the default (`a.filter((x) => …)`) does not make
|
|
227
|
+
* it a function default.
|
|
228
|
+
*/
|
|
229
|
+
function dependentPropDefaultSteps(
|
|
230
|
+
metadata: IRMetadata,
|
|
231
|
+
available: ReadonlySet<string>,
|
|
232
|
+
inlined: ReadonlySet<string>,
|
|
233
|
+
): SsrSeedStep[] {
|
|
234
|
+
const steps: SsrSeedStep[] = []
|
|
235
|
+
for (const p of inDefaultReadOrder(metadata.propsParams)) {
|
|
236
|
+
if (p.isRest || !p.defaultParts || !p.parsed || p.parsed.kind === 'arrow') continue
|
|
237
|
+
const parsed: ParsedExpr = { kind: 'logical', op: '??', left: { kind: 'identifier', name: p.name }, right: p.parsed }
|
|
238
|
+
const step = classify(p.name, 'prop', stringifyParsedExpr(parsed), parsed, available, inlined)
|
|
239
|
+
if (step.kind === 'derived') steps.push(step)
|
|
240
|
+
}
|
|
241
|
+
return steps
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* `params` with every prop placed after the props its destructure default
|
|
246
|
+
* reads (`ParamInfo.defaultParts`). `propsParams` follows the props TYPE's
|
|
247
|
+
* member order for a body destructure (`const { a = 'x', b = a } = props`
|
|
248
|
+
* over `{ b?: string; a?: string }`), which need not be the pattern's order,
|
|
249
|
+
* so the order comes from the reads themselves. The reads only ever name an
|
|
250
|
+
* EARLIER binding of the same pattern, so they form no cycle; otherwise the
|
|
251
|
+
* input order is kept. Every backend applying these defaults one prop at a
|
|
252
|
+
* time (the in-template re-binds here, Go's constructor) uses this order.
|
|
180
253
|
*/
|
|
254
|
+
export function inDefaultReadOrder(params: readonly ParamInfo[]): ParamInfo[] {
|
|
255
|
+
const byName = new Map(params.filter(p => !p.isRest).map(p => [p.name, p]))
|
|
256
|
+
const ordered: ParamInfo[] = []
|
|
257
|
+
const placed = new Set<ParamInfo>()
|
|
258
|
+
const place = (p: ParamInfo): void => {
|
|
259
|
+
if (placed.has(p)) return
|
|
260
|
+
placed.add(p)
|
|
261
|
+
for (const part of p.defaultParts ?? []) {
|
|
262
|
+
const read = part.kind === 'param' ? byName.get(part.param.name) : undefined
|
|
263
|
+
if (read) place(read)
|
|
264
|
+
}
|
|
265
|
+
ordered.push(p)
|
|
266
|
+
}
|
|
267
|
+
for (const p of params) place(p)
|
|
268
|
+
return ordered
|
|
269
|
+
}
|
|
270
|
+
|
|
181
271
|
export function computeSsrSeedPlan(metadata: IRMetadata): SsrSeedPlan {
|
|
182
272
|
const baseScope: string[] = metadata.propsParams.map(p => p.name)
|
|
183
273
|
if (metadata.propsObjectName) baseScope.push(metadata.propsObjectName)
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
274
|
+
const inlined = new Set(collectModuleStringConsts(metadata.localConstants).keys())
|
|
275
|
+
baseScope.push(...inlined)
|
|
187
276
|
|
|
188
277
|
const available = new Set<string>(baseScope)
|
|
189
278
|
const localConsts = localConstExprsByName(metadata)
|
|
190
279
|
const steps: SsrSeedStep[] = []
|
|
191
280
|
|
|
281
|
+
steps.push(...dependentPropDefaultSteps(metadata, available, inlined))
|
|
282
|
+
|
|
192
283
|
for (const signal of metadata.signals) {
|
|
193
284
|
if (signal.envReader) {
|
|
194
285
|
const reader = envSignalReaderFor(signal.envReader)
|
|
@@ -230,14 +321,14 @@ export function computeSsrSeedPlan(metadata: IRMetadata): SsrSeedPlan {
|
|
|
230
321
|
// undefined) equally safe.
|
|
231
322
|
resolveThroughLocalConsts(signal.parsed ?? parseExpression(`(${expr})`), localConsts),
|
|
232
323
|
available,
|
|
324
|
+
inlined,
|
|
233
325
|
),
|
|
234
326
|
)
|
|
235
327
|
available.add(signal.getter)
|
|
236
328
|
}
|
|
237
329
|
|
|
238
330
|
for (const memo of metadata.memos) {
|
|
239
|
-
const
|
|
240
|
-
const expr = body?.trim() ?? ''
|
|
331
|
+
const expr = memoSeedExpr(memo)
|
|
241
332
|
steps.push(
|
|
242
333
|
expr === ''
|
|
243
334
|
? { kind: 'opaque', name: memo.name, origin: 'memo' }
|
|
@@ -247,6 +338,7 @@ export function computeSsrSeedPlan(metadata: IRMetadata): SsrSeedPlan {
|
|
|
247
338
|
expr,
|
|
248
339
|
resolveThroughLocalConsts(memo.parsed ?? parseExpression(expr), localConsts),
|
|
249
340
|
available,
|
|
341
|
+
inlined,
|
|
250
342
|
),
|
|
251
343
|
)
|
|
252
344
|
available.add(memo.name)
|
|
@@ -259,7 +351,7 @@ export function computeSsrSeedPlan(metadata: IRMetadata): SsrSeedPlan {
|
|
|
259
351
|
for (const [alias, origin] of resolveGetterAliases(metadata.localConstants ?? [], name => getters.has(name))) {
|
|
260
352
|
if (metadata.propsParams.some(p => p.name === alias)) continue
|
|
261
353
|
const parsed: ParsedExpr = { kind: 'call', callee: { kind: 'identifier', name: origin }, args: [] }
|
|
262
|
-
steps.push(classify(alias, 'memo', `${origin}()`, parsed, available))
|
|
354
|
+
steps.push(classify(alias, 'memo', `${origin}()`, parsed, available, inlined))
|
|
263
355
|
available.add(alias)
|
|
264
356
|
}
|
|
265
357
|
return { baseScope, steps }
|