@barefootjs/jsx 0.9.1 → 0.9.3
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-value-emitter.d.ts +1 -1
- package/dist/adapters/attr-value-emitter.d.ts.map +1 -1
- package/dist/adapters/interface.d.ts +1 -1
- package/dist/adapters/interface.d.ts.map +1 -1
- package/dist/adapters/ir-node-emitter.d.ts +1 -1
- package/dist/adapters/ir-node-emitter.d.ts.map +1 -1
- package/dist/adapters/jsx-adapter.d.ts +2 -2
- package/dist/adapters/jsx-adapter.d.ts.map +1 -1
- package/dist/adapters/parsed-expr-emitter.d.ts +1 -1
- package/dist/adapters/parsed-expr-emitter.d.ts.map +1 -1
- package/dist/adapters/template-imports.d.ts +1 -1
- package/dist/adapters/template-imports.d.ts.map +1 -1
- package/dist/adapters/test-adapter.d.ts +3 -3
- package/dist/adapters/test-adapter.d.ts.map +1 -1
- package/dist/analyzer-context.d.ts +2 -2
- package/dist/analyzer-context.d.ts.map +1 -1
- package/dist/analyzer.d.ts +2 -2
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/augment-inherited-props.d.ts +1 -1
- package/dist/augment-inherited-props.d.ts.map +1 -1
- package/dist/compiler.d.ts +3 -3
- package/dist/compiler.d.ts.map +1 -1
- package/dist/css-layer-prefixer.d.ts +1 -1
- package/dist/css-layer-prefixer.d.ts.map +1 -1
- package/dist/debug.d.ts +3 -3
- package/dist/debug.d.ts.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/expression-parser.d.ts +12 -0
- package/dist/expression-parser.d.ts.map +1 -1
- package/dist/free-refs.d.ts +1 -1
- package/dist/free-refs.d.ts.map +1 -1
- package/dist/index.d.ts +42 -42
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -0
- package/dist/ir-to-client-js/build-references.d.ts +2 -2
- package/dist/ir-to-client-js/build-references.d.ts.map +1 -1
- package/dist/ir-to-client-js/child-components.d.ts +2 -2
- package/dist/ir-to-client-js/child-components.d.ts.map +1 -1
- package/dist/ir-to-client-js/collect-elements.d.ts +4 -4
- package/dist/ir-to-client-js/collect-elements.d.ts.map +1 -1
- package/dist/ir-to-client-js/compute-inlinability.d.ts +4 -4
- package/dist/ir-to-client-js/compute-inlinability.d.ts.map +1 -1
- package/dist/ir-to-client-js/compute-prop-usage.d.ts +2 -2
- package/dist/ir-to-client-js/compute-prop-usage.d.ts.map +1 -1
- package/dist/ir-to-client-js/compute-scope.d.ts +2 -2
- package/dist/ir-to-client-js/compute-scope.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/branch-loop.d.ts +3 -3
- package/dist/ir-to-client-js/control-flow/plan/branch-loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/build-branch-loop.d.ts +2 -2
- package/dist/ir-to-client-js/control-flow/plan/build-branch-loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/build-component-loop.d.ts +2 -2
- package/dist/ir-to-client-js/control-flow/plan/build-component-loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/build-composite-loop.d.ts +2 -2
- package/dist/ir-to-client-js/control-flow/plan/build-composite-loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/build-event-delegation.d.ts +2 -2
- package/dist/ir-to-client-js/control-flow/plan/build-event-delegation.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/build-inner-loop.d.ts +3 -3
- package/dist/ir-to-client-js/control-flow/plan/build-inner-loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/build-insert.d.ts +2 -2
- package/dist/ir-to-client-js/control-flow/plan/build-insert.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/build-loop-child-arm.d.ts +3 -3
- package/dist/ir-to-client-js/control-flow/plan/build-loop-child-arm.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/build-loop.d.ts +2 -2
- package/dist/ir-to-client-js/control-flow/plan/build-loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/build-reactive-effects.d.ts +3 -3
- package/dist/ir-to-client-js/control-flow/plan/build-reactive-effects.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/event-delegation.d.ts +1 -1
- package/dist/ir-to-client-js/control-flow/plan/event-delegation.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/inner-loop.d.ts +3 -3
- package/dist/ir-to-client-js/control-flow/plan/inner-loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/insert.d.ts +3 -3
- package/dist/ir-to-client-js/control-flow/plan/insert.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/loop-child-arm.d.ts +4 -4
- package/dist/ir-to-client-js/control-flow/plan/loop-child-arm.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/loop.d.ts +4 -4
- package/dist/ir-to-client-js/control-flow/plan/loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/reactive-effects.d.ts +2 -2
- package/dist/ir-to-client-js/control-flow/plan/reactive-effects.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/plan/types.d.ts +7 -7
- package/dist/ir-to-client-js/control-flow/plan/types.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/shared.d.ts +5 -5
- package/dist/ir-to-client-js/control-flow/shared.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/branch-loop.d.ts +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/branch-loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/component-loop.d.ts +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/component-loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/composite-loop.d.ts +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/composite-loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/event-delegation.d.ts +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/inner-loop.d.ts +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/inner-loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/insert.d.ts +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/insert.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/loop-child-arm.d.ts +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/loop-child-arm.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/loop.d.ts +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/loop.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/reactive-effects.d.ts +1 -1
- package/dist/ir-to-client-js/control-flow/stringify/reactive-effects.d.ts.map +1 -1
- package/dist/ir-to-client-js/control-flow.d.ts +1 -1
- package/dist/ir-to-client-js/control-flow.d.ts.map +1 -1
- package/dist/ir-to-client-js/csr-substitute.d.ts +1 -1
- package/dist/ir-to-client-js/csr-substitute.d.ts.map +1 -1
- package/dist/ir-to-client-js/declaration-sort.d.ts +1 -1
- package/dist/ir-to-client-js/declaration-sort.d.ts.map +1 -1
- package/dist/ir-to-client-js/element-refs.d.ts +1 -1
- package/dist/ir-to-client-js/element-refs.d.ts.map +1 -1
- package/dist/ir-to-client-js/emit-module-level.d.ts +1 -1
- package/dist/ir-to-client-js/emit-module-level.d.ts.map +1 -1
- package/dist/ir-to-client-js/emit-reactive.d.ts +2 -2
- package/dist/ir-to-client-js/emit-reactive.d.ts.map +1 -1
- package/dist/ir-to-client-js/emit-registration.d.ts +2 -2
- package/dist/ir-to-client-js/emit-registration.d.ts.map +1 -1
- package/dist/ir-to-client-js/generate-init.d.ts +2 -2
- package/dist/ir-to-client-js/generate-init.d.ts.map +1 -1
- package/dist/ir-to-client-js/html-template.d.ts +4 -4
- package/dist/ir-to-client-js/html-template.d.ts.map +1 -1
- package/dist/ir-to-client-js/imports.d.ts +1 -1
- package/dist/ir-to-client-js/imports.d.ts.map +1 -1
- package/dist/ir-to-client-js/index.d.ts +3 -3
- package/dist/ir-to-client-js/index.d.ts.map +1 -1
- package/dist/ir-to-client-js/init-declarations.d.ts +2 -2
- package/dist/ir-to-client-js/init-declarations.d.ts.map +1 -1
- package/dist/ir-to-client-js/phases/conditional-slot-ids.d.ts +1 -1
- package/dist/ir-to-client-js/phases/conditional-slot-ids.d.ts.map +1 -1
- package/dist/ir-to-client-js/phases/effects-and-on-mounts.d.ts +1 -1
- package/dist/ir-to-client-js/phases/effects-and-on-mounts.d.ts.map +1 -1
- package/dist/ir-to-client-js/phases/event-handlers.d.ts +1 -1
- package/dist/ir-to-client-js/phases/event-handlers.d.ts.map +1 -1
- package/dist/ir-to-client-js/phases/init-statements.d.ts +1 -1
- package/dist/ir-to-client-js/phases/init-statements.d.ts.map +1 -1
- package/dist/ir-to-client-js/phases/props-event-handlers.d.ts +1 -1
- package/dist/ir-to-client-js/phases/props-event-handlers.d.ts.map +1 -1
- package/dist/ir-to-client-js/phases/props-extraction.d.ts +2 -2
- package/dist/ir-to-client-js/phases/props-extraction.d.ts.map +1 -1
- package/dist/ir-to-client-js/phases/provider-and-child-inits.d.ts +1 -1
- package/dist/ir-to-client-js/phases/provider-and-child-inits.d.ts.map +1 -1
- package/dist/ir-to-client-js/phases/ref-callbacks.d.ts +1 -1
- package/dist/ir-to-client-js/phases/ref-callbacks.d.ts.map +1 -1
- package/dist/ir-to-client-js/phases/rest-attr-applications.d.ts +1 -1
- package/dist/ir-to-client-js/phases/rest-attr-applications.d.ts.map +1 -1
- package/dist/ir-to-client-js/phases/static-array-child-inits.d.ts +1 -1
- package/dist/ir-to-client-js/phases/static-array-child-inits.d.ts.map +1 -1
- package/dist/ir-to-client-js/phases.d.ts +3 -3
- package/dist/ir-to-client-js/phases.d.ts.map +1 -1
- package/dist/ir-to-client-js/plan/build-declaration-emit.d.ts +5 -5
- package/dist/ir-to-client-js/plan/build-declaration-emit.d.ts.map +1 -1
- package/dist/ir-to-client-js/plan/build-static-array-child-init.d.ts +2 -2
- package/dist/ir-to-client-js/plan/build-static-array-child-init.d.ts.map +1 -1
- package/dist/ir-to-client-js/plan/static-array-child-init.d.ts +1 -1
- package/dist/ir-to-client-js/plan/static-array-child-init.d.ts.map +1 -1
- package/dist/ir-to-client-js/prop-handling.d.ts +2 -2
- package/dist/ir-to-client-js/prop-handling.d.ts.map +1 -1
- package/dist/ir-to-client-js/reactivity.d.ts +2 -2
- package/dist/ir-to-client-js/reactivity.d.ts.map +1 -1
- package/dist/ir-to-client-js/source-map.d.ts +2 -2
- package/dist/ir-to-client-js/source-map.d.ts.map +1 -1
- package/dist/ir-to-client-js/stringify/declaration-emit.d.ts +1 -1
- package/dist/ir-to-client-js/stringify/declaration-emit.d.ts.map +1 -1
- package/dist/ir-to-client-js/stringify/static-array-child-init.d.ts +1 -1
- package/dist/ir-to-client-js/stringify/static-array-child-init.d.ts.map +1 -1
- package/dist/ir-to-client-js/types.d.ts +7 -7
- package/dist/ir-to-client-js/types.d.ts.map +1 -1
- package/dist/ir-to-client-js/utils.d.ts +2 -2
- package/dist/ir-to-client-js/utils.d.ts.map +1 -1
- package/dist/ir-to-client-js/walk-prop-accesses.d.ts +1 -1
- package/dist/ir-to-client-js/walk-prop-accesses.d.ts.map +1 -1
- package/dist/ir-to-client-js/walker.d.ts +1 -1
- package/dist/ir-to-client-js/walker.d.ts.map +1 -1
- package/dist/jsx-to-ir.d.ts +2 -2
- package/dist/jsx-to-ir.d.ts.map +1 -1
- package/dist/module-exports.d.ts +1 -1
- package/dist/module-exports.d.ts.map +1 -1
- package/dist/preprocess-inline-jsx-callbacks.d.ts +1 -1
- package/dist/preprocess-inline-jsx-callbacks.d.ts.map +1 -1
- package/dist/relocate.d.ts +3 -3
- package/dist/relocate.d.ts.map +1 -1
- package/dist/ssr-defaults.d.ts +1 -1
- package/dist/ssr-defaults.d.ts.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/expression-parser.test.ts +30 -1
- package/src/adapters/attr-value-emitter.ts +1 -1
- package/src/adapters/interface.ts +1 -1
- package/src/adapters/ir-node-emitter.ts +1 -1
- package/src/adapters/jsx-adapter.ts +3 -3
- package/src/adapters/parsed-expr-emitter.ts +1 -1
- package/src/adapters/template-imports.ts +1 -1
- package/src/adapters/test-adapter.ts +5 -5
- package/src/analyzer-context.ts +2 -2
- package/src/analyzer.ts +8 -8
- package/src/augment-inherited-props.ts +2 -2
- package/src/compiler.ts +12 -12
- package/src/css-layer-prefixer.ts +1 -1
- package/src/debug.ts +7 -7
- package/src/errors.ts +2 -2
- package/src/expression-parser.ts +27 -0
- package/src/free-refs.ts +4 -4
- package/src/index.ts +42 -42
- package/src/ir-to-client-js/build-references.ts +6 -6
- package/src/ir-to-client-js/child-components.ts +2 -2
- package/src/ir-to-client-js/collect-elements.ts +14 -14
- package/src/ir-to-client-js/compute-inlinability.ts +10 -10
- package/src/ir-to-client-js/compute-prop-usage.ts +3 -3
- package/src/ir-to-client-js/compute-scope.ts +3 -3
- package/src/ir-to-client-js/control-flow/plan/branch-loop.ts +3 -3
- package/src/ir-to-client-js/control-flow/plan/build-branch-loop.ts +7 -7
- package/src/ir-to-client-js/control-flow/plan/build-component-loop.ts +6 -6
- package/src/ir-to-client-js/control-flow/plan/build-composite-loop.ts +7 -7
- package/src/ir-to-client-js/control-flow/plan/build-event-delegation.ts +3 -3
- package/src/ir-to-client-js/control-flow/plan/build-inner-loop.ts +8 -8
- package/src/ir-to-client-js/control-flow/plan/build-insert.ts +4 -4
- package/src/ir-to-client-js/control-flow/plan/build-loop-child-arm.ts +7 -7
- package/src/ir-to-client-js/control-flow/plan/build-loop.ts +7 -7
- package/src/ir-to-client-js/control-flow/plan/build-reactive-effects.ts +8 -8
- package/src/ir-to-client-js/control-flow/plan/event-delegation.ts +1 -1
- package/src/ir-to-client-js/control-flow/plan/inner-loop.ts +3 -3
- package/src/ir-to-client-js/control-flow/plan/insert.ts +3 -3
- package/src/ir-to-client-js/control-flow/plan/loop-child-arm.ts +4 -4
- package/src/ir-to-client-js/control-flow/plan/loop.ts +4 -4
- package/src/ir-to-client-js/control-flow/plan/reactive-effects.ts +2 -2
- package/src/ir-to-client-js/control-flow/plan/types.ts +7 -7
- package/src/ir-to-client-js/control-flow/shared.ts +8 -8
- package/src/ir-to-client-js/control-flow/stringify/branch-loop.ts +6 -6
- package/src/ir-to-client-js/control-flow/stringify/component-loop.ts +3 -3
- package/src/ir-to-client-js/control-flow/stringify/composite-loop.ts +6 -6
- package/src/ir-to-client-js/control-flow/stringify/event-delegation.ts +2 -2
- package/src/ir-to-client-js/control-flow/stringify/event-listener.ts +1 -1
- package/src/ir-to-client-js/control-flow/stringify/inner-loop.ts +6 -6
- package/src/ir-to-client-js/control-flow/stringify/insert.ts +6 -6
- package/src/ir-to-client-js/control-flow/stringify/loop-child-arm.ts +6 -6
- package/src/ir-to-client-js/control-flow/stringify/loop.ts +7 -7
- package/src/ir-to-client-js/control-flow/stringify/reactive-effects.ts +5 -5
- package/src/ir-to-client-js/control-flow/stringify/template-parse.ts +1 -1
- package/src/ir-to-client-js/control-flow.ts +7 -7
- package/src/ir-to-client-js/csr-substitute.ts +3 -3
- package/src/ir-to-client-js/declaration-sort.ts +2 -2
- package/src/ir-to-client-js/element-refs.ts +3 -3
- package/src/ir-to-client-js/emit-module-level.ts +2 -2
- package/src/ir-to-client-js/emit-reactive.ts +5 -5
- package/src/ir-to-client-js/emit-registration.ts +6 -6
- package/src/ir-to-client-js/generate-init.ts +14 -14
- package/src/ir-to-client-js/html-template.ts +11 -11
- package/src/ir-to-client-js/imports.ts +1 -1
- package/src/ir-to-client-js/index.ts +15 -15
- package/src/ir-to-client-js/init-declarations.ts +8 -8
- package/src/ir-to-client-js/phases/conditional-slot-ids.ts +1 -1
- package/src/ir-to-client-js/phases/effects-and-on-mounts.ts +1 -1
- package/src/ir-to-client-js/phases/event-handlers.ts +2 -2
- package/src/ir-to-client-js/phases/init-statements.ts +1 -1
- package/src/ir-to-client-js/phases/props-event-handlers.ts +2 -2
- package/src/ir-to-client-js/phases/props-extraction.ts +4 -4
- package/src/ir-to-client-js/phases/provider-and-child-inits.ts +3 -3
- package/src/ir-to-client-js/phases/ref-callbacks.ts +2 -2
- package/src/ir-to-client-js/phases/rest-attr-applications.ts +2 -2
- package/src/ir-to-client-js/phases/static-array-child-inits.ts +3 -3
- package/src/ir-to-client-js/phases.ts +18 -18
- package/src/ir-to-client-js/plan/build-declaration-emit.ts +6 -6
- package/src/ir-to-client-js/plan/build-static-array-child-init.ts +7 -7
- package/src/ir-to-client-js/plan/static-array-child-init.ts +1 -1
- package/src/ir-to-client-js/prop-handling.ts +2 -2
- package/src/ir-to-client-js/reactivity.ts +5 -5
- package/src/ir-to-client-js/rewrite-props-object.ts +1 -1
- package/src/ir-to-client-js/source-map.ts +4 -4
- package/src/ir-to-client-js/stringify/declaration-emit.ts +1 -1
- package/src/ir-to-client-js/stringify/static-array-child-init.ts +2 -2
- package/src/ir-to-client-js/types.ts +6 -6
- package/src/ir-to-client-js/utils.ts +4 -4
- package/src/ir-to-client-js/walk-prop-accesses.ts +2 -2
- package/src/ir-to-client-js/walker.ts +1 -1
- package/src/jsx-runtime/index.d.ts +1 -1
- package/src/jsx-to-ir.ts +9 -9
- package/src/module-exports.ts +1 -1
- package/src/preprocess-inline-jsx-callbacks.ts +2 -2
- package/src/prop-rewrite.ts +2 -2
- package/src/reactivity-checker.ts +1 -1
- package/src/relocate.ts +5 -5
- package/src/shared-program.ts +1 -1
- package/src/ssr-defaults.ts +1 -1
- package/src/types.ts +1 -1
|
@@ -9,10 +9,10 @@ import type {
|
|
|
9
9
|
ComponentIR,
|
|
10
10
|
IRNode,
|
|
11
11
|
ImportSpecifier,
|
|
12
|
-
} from '../types'
|
|
12
|
+
} from '../types.ts'
|
|
13
13
|
import { BF_SCOPE, BF_SLOT, BF_COND } from '@barefootjs/shared'
|
|
14
|
-
import { BaseAdapter } from './interface'
|
|
15
|
-
import { formatParamWithType, findReachableNames } from '../module-exports'
|
|
14
|
+
import { BaseAdapter } from './interface.ts'
|
|
15
|
+
import { formatParamWithType, findReachableNames } from '../module-exports.ts'
|
|
16
16
|
|
|
17
17
|
export interface JsxAdapterConfig {
|
|
18
18
|
/** Use typed versions (typedInitialValue, etc.) for type-safe .tsx output */
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
* be added in one place.
|
|
34
34
|
*/
|
|
35
35
|
|
|
36
|
-
import type { ParsedExpr, SortComparator, ReduceOp, FlatDepth, FlatMapOp, TemplatePart } from '../expression-parser'
|
|
36
|
+
import type { ParsedExpr, SortComparator, ReduceOp, FlatDepth, FlatMapOp, TemplatePart } from '../expression-parser.ts'
|
|
37
37
|
|
|
38
38
|
export type HigherOrderMethod = 'filter' | 'every' | 'some' | 'find' | 'findIndex' | 'findLast' | 'findLastIndex'
|
|
39
39
|
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* Adapters are responsible for calling this themselves before emitting any
|
|
17
17
|
* import block. The compiler hands them `metadata.imports` unchanged.
|
|
18
18
|
*/
|
|
19
|
-
import type { ImportInfo, ImportSpecifier } from '../types'
|
|
19
|
+
import type { ImportInfo, ImportSpecifier } from '../types.ts'
|
|
20
20
|
|
|
21
21
|
const CLIENT_PACKAGE_SOURCES = new Set([
|
|
22
22
|
'@barefootjs/client',
|
|
@@ -16,10 +16,10 @@ import type {
|
|
|
16
16
|
IRComponent,
|
|
17
17
|
IRFragment,
|
|
18
18
|
ParamInfo,
|
|
19
|
-
} from '../types'
|
|
20
|
-
import type { AdapterOutput, TemplateSections } from './interface'
|
|
21
|
-
import { type JsxAdapterConfig, JsxAdapter } from './jsx-adapter'
|
|
22
|
-
import { rewriteImportsForTemplate } from './template-imports'
|
|
19
|
+
} from '../types.ts'
|
|
20
|
+
import type { AdapterOutput, TemplateSections } from './interface.ts'
|
|
21
|
+
import { type JsxAdapterConfig, JsxAdapter } from './jsx-adapter.ts'
|
|
22
|
+
import { rewriteImportsForTemplate } from './template-imports.ts'
|
|
23
23
|
|
|
24
24
|
export class TestAdapter extends JsxAdapter {
|
|
25
25
|
name = 'test'
|
|
@@ -314,7 +314,7 @@ export class TestAdapter extends JsxAdapter {
|
|
|
314
314
|
private flattenTemplate(value: { kind: string }): string {
|
|
315
315
|
// Simple stringifier for `template`-kind values; tests only need a
|
|
316
316
|
// recognisable JSX shape, not byte-exact reproduction.
|
|
317
|
-
const v = value as { kind: 'template'; parts: import('../types').IRTemplatePart[] }
|
|
317
|
+
const v = value as { kind: 'template'; parts: import('../types.ts').IRTemplatePart[] }
|
|
318
318
|
return '`' + v.parts.map(p => {
|
|
319
319
|
if (p.type === 'string') return p.value
|
|
320
320
|
if (p.type === 'ternary') return `\${${p.condition} ? '${p.whenTrue}' : '${p.whenFalse}'}`
|
package/src/analyzer-context.ts
CHANGED
|
@@ -22,8 +22,8 @@ import type {
|
|
|
22
22
|
ParamInfo,
|
|
23
23
|
PropertyInfo,
|
|
24
24
|
ReactiveFactoryInfo,
|
|
25
|
-
} from './types'
|
|
26
|
-
import { type ExcludeRange, collectAllTypeRanges, reconstructWithoutTypes } from './strip-types'
|
|
25
|
+
} from './types.ts'
|
|
26
|
+
import { type ExcludeRange, collectAllTypeRanges, reconstructWithoutTypes } from './strip-types.ts'
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Deferred info for BF043 (props destructuring warning).
|
package/src/analyzer.ts
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import ts from 'typescript'
|
|
10
|
-
import type { ImportSpecifier, TypeInfo, ParamInfo, ReactiveFactoryInfo } from './types'
|
|
11
|
-
import { rewriteBarePropRefs } from './prop-rewrite'
|
|
12
|
-
import { incrementCounter } from './instrumentation'
|
|
10
|
+
import type { ImportSpecifier, TypeInfo, ParamInfo, ReactiveFactoryInfo } from './types.ts'
|
|
11
|
+
import { rewriteBarePropRefs } from './prop-rewrite.ts'
|
|
12
|
+
import { incrementCounter } from './instrumentation.ts'
|
|
13
13
|
import {
|
|
14
14
|
type AnalyzerContext,
|
|
15
15
|
type ConditionalReturn,
|
|
@@ -19,10 +19,10 @@ import {
|
|
|
19
19
|
membersToProperties,
|
|
20
20
|
isComponentFunction,
|
|
21
21
|
isArrowComponentFunction,
|
|
22
|
-
} from './analyzer-context'
|
|
23
|
-
import { createError, createWarning, ErrorCodes } from './errors'
|
|
24
|
-
import path from 'path'
|
|
25
|
-
import fs from 'fs'
|
|
22
|
+
} from './analyzer-context.ts'
|
|
23
|
+
import { createError, createWarning, ErrorCodes } from './errors.ts'
|
|
24
|
+
import path from 'node:path'
|
|
25
|
+
import fs from 'node:fs'
|
|
26
26
|
|
|
27
27
|
// =============================================================================
|
|
28
28
|
// TypeScript Program Creation
|
|
@@ -3849,4 +3849,4 @@ export function validateReactiveFactoryCalls(ctx: AnalyzerContext): void {
|
|
|
3849
3849
|
// Export
|
|
3850
3850
|
// =============================================================================
|
|
3851
3851
|
|
|
3852
|
-
export { type AnalyzerContext } from './analyzer-context'
|
|
3852
|
+
export { type AnalyzerContext } from './analyzer-context.ts'
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
import ts from 'typescript'
|
|
14
14
|
|
|
15
|
-
import type { ComponentIR, IRMetadata, IRNode, IRElement, TypeInfo } from './types'
|
|
16
|
-
import { isBooleanAttr } from './html-constants'
|
|
15
|
+
import type { ComponentIR, IRMetadata, IRNode, IRElement, TypeInfo } from './types.ts'
|
|
16
|
+
import { isBooleanAttr } from './html-constants.ts'
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* A `const x = useContext(SomeContext)` consumer in a component body. SSR
|
package/src/compiler.ts
CHANGED
|
@@ -10,18 +10,18 @@ import type {
|
|
|
10
10
|
CompileOptions,
|
|
11
11
|
CompileResult,
|
|
12
12
|
FileOutput,
|
|
13
|
-
} from './types'
|
|
14
|
-
import type { TemplateAdapter } from './adapters/interface'
|
|
15
|
-
import { analyzeComponent, listComponentFunctions, createProgramForFile, needsTypeBasedDetection } from './analyzer'
|
|
16
|
-
import { jsxToIR } from './jsx-to-ir'
|
|
17
|
-
import { generateClientJs, generateClientJsWithSourceMap, analyzeClientNeeds } from './ir-to-client-js'
|
|
18
|
-
import { emitModuleLevelDeclarations } from './ir-to-client-js/emit-module-level'
|
|
19
|
-
import { RUNTIME_MODULE, detectUsedImports as detectUsedImportsFromCode } from './ir-to-client-js/imports'
|
|
20
|
-
import { setActiveComponentScope, computeFileScope } from './ir-to-client-js/component-scope'
|
|
21
|
-
import { generateModuleExports, collectInlineExportedNames } from './module-exports'
|
|
22
|
-
import { applyCssLayerPrefix } from './css-layer-prefixer'
|
|
23
|
-
import { preprocessInlineJsxCallbacks } from './preprocess-inline-jsx-callbacks'
|
|
24
|
-
import { extractSsrDefaults } from './ssr-defaults'
|
|
13
|
+
} from './types.ts'
|
|
14
|
+
import type { TemplateAdapter } from './adapters/interface.ts'
|
|
15
|
+
import { analyzeComponent, listComponentFunctions, createProgramForFile, needsTypeBasedDetection } from './analyzer.ts'
|
|
16
|
+
import { jsxToIR } from './jsx-to-ir.ts'
|
|
17
|
+
import { generateClientJs, generateClientJsWithSourceMap, analyzeClientNeeds } from './ir-to-client-js/index.ts'
|
|
18
|
+
import { emitModuleLevelDeclarations } from './ir-to-client-js/emit-module-level.ts'
|
|
19
|
+
import { RUNTIME_MODULE, detectUsedImports as detectUsedImportsFromCode } from './ir-to-client-js/imports.ts'
|
|
20
|
+
import { setActiveComponentScope, computeFileScope } from './ir-to-client-js/component-scope.ts'
|
|
21
|
+
import { generateModuleExports, collectInlineExportedNames } from './module-exports.ts'
|
|
22
|
+
import { applyCssLayerPrefix } from './css-layer-prefixer.ts'
|
|
23
|
+
import { preprocessInlineJsxCallbacks } from './preprocess-inline-jsx-callbacks.ts'
|
|
24
|
+
import { extractSsrDefaults } from './ssr-defaults.ts'
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* Extended compile options with required adapter
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* for CSS cascade ordering. Un-layered user classes always beat layered component classes.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type { ComponentIR, IRNode, IRTemplatePart } from './types'
|
|
8
|
+
import type { ComponentIR, IRNode, IRTemplatePart } from './types.ts'
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Prefix a single CSS class token with a layer variant.
|
package/src/debug.ts
CHANGED
|
@@ -20,13 +20,13 @@ import type {
|
|
|
20
20
|
MemoInfo,
|
|
21
21
|
EffectInfo,
|
|
22
22
|
SourceLocation,
|
|
23
|
-
} from './types'
|
|
24
|
-
import { analyzeComponent, listComponentFunctions } from './analyzer'
|
|
25
|
-
import { jsxToIR } from './jsx-to-ir'
|
|
26
|
-
import { buildMetadata } from './compiler'
|
|
27
|
-
import { analyzeClientNeeds } from './ir-to-client-js'
|
|
28
|
-
import type { WrapReason } from './ir-to-client-js/reactivity'
|
|
29
|
-
import { decideWrapFromAstFlags } from './ir-to-client-js/reactivity'
|
|
23
|
+
} from './types.ts'
|
|
24
|
+
import { analyzeComponent, listComponentFunctions } from './analyzer.ts'
|
|
25
|
+
import { jsxToIR } from './jsx-to-ir.ts'
|
|
26
|
+
import { buildMetadata } from './compiler.ts'
|
|
27
|
+
import { analyzeClientNeeds } from './ir-to-client-js/index.ts'
|
|
28
|
+
import type { WrapReason } from './ir-to-client-js/reactivity.ts'
|
|
29
|
+
import { decideWrapFromAstFlags } from './ir-to-client-js/reactivity.ts'
|
|
30
30
|
|
|
31
31
|
// =============================================================================
|
|
32
32
|
// Types
|
package/src/errors.ts
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* BarefootJS Compiler - Error Definitions
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import path from 'path'
|
|
5
|
+
import path from 'node:path'
|
|
6
6
|
import type {
|
|
7
7
|
CompilerError,
|
|
8
8
|
ErrorSeverity,
|
|
9
9
|
ErrorSuggestion,
|
|
10
10
|
SourceLocation,
|
|
11
|
-
} from './types'
|
|
11
|
+
} from './types.ts'
|
|
12
12
|
|
|
13
13
|
// =============================================================================
|
|
14
14
|
// Error Codes
|
package/src/expression-parser.ts
CHANGED
|
@@ -449,6 +449,33 @@ const LOWERED_ARRAY_METHODS = new Set([
|
|
|
449
449
|
// Expression Parser
|
|
450
450
|
// =============================================================================
|
|
451
451
|
|
|
452
|
+
/**
|
|
453
|
+
* Extract the single-expression body of an arrow-function source
|
|
454
|
+
* (`() => EXPR` → `EXPR`), using the TypeScript parser rather than a regex so
|
|
455
|
+
* any parameter shape (destructure / defaults / parens) or nested arrow is
|
|
456
|
+
* handled robustly.
|
|
457
|
+
*
|
|
458
|
+
* Returns `null` for a block-bodied arrow (`() => { … }`) or a source that
|
|
459
|
+
* isn't a bare arrow function — callers (e.g. the SSR memo-seeding path) treat
|
|
460
|
+
* those as "not a single lowerable expression". This is the AST-backed
|
|
461
|
+
* replacement for ad-hoc `^\(...\)\s*=>` stripping.
|
|
462
|
+
*/
|
|
463
|
+
export function extractArrowBodyExpression(source: string): string | null {
|
|
464
|
+
const sf = ts.createSourceFile(
|
|
465
|
+
'__arrow__.ts',
|
|
466
|
+
source,
|
|
467
|
+
ts.ScriptTarget.Latest,
|
|
468
|
+
/* setParentNodes */ true,
|
|
469
|
+
)
|
|
470
|
+
const stmt = sf.statements[0]
|
|
471
|
+
if (!stmt || !ts.isExpressionStatement(stmt) || sf.statements.length !== 1) return null
|
|
472
|
+
let expr: ts.Expression = stmt.expression
|
|
473
|
+
while (ts.isParenthesizedExpression(expr)) expr = expr.expression
|
|
474
|
+
if (!ts.isArrowFunction(expr)) return null
|
|
475
|
+
if (ts.isBlock(expr.body)) return null
|
|
476
|
+
return expr.body.getText(sf).trim()
|
|
477
|
+
}
|
|
478
|
+
|
|
452
479
|
/**
|
|
453
480
|
* Parse a JavaScript expression string into a ParsedExpr tree.
|
|
454
481
|
*/
|
package/src/free-refs.ts
CHANGED
|
@@ -22,9 +22,9 @@ import type {
|
|
|
22
22
|
ParamInfo,
|
|
23
23
|
ConstantInfo,
|
|
24
24
|
FunctionInfo,
|
|
25
|
-
} from './types'
|
|
26
|
-
import { isReactiveType } from './reactivity-checker'
|
|
27
|
-
import { incrementCounter } from './instrumentation'
|
|
25
|
+
} from './types.ts'
|
|
26
|
+
import { isReactiveType } from './reactivity-checker.ts'
|
|
27
|
+
import { incrementCounter } from './instrumentation.ts'
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Subset of `AnalyzerContext` / `TransformContext` that this resolver reads.
|
|
@@ -251,7 +251,7 @@ function collectReactiveBrandRefs(
|
|
|
251
251
|
* recorded `value`.
|
|
252
252
|
*/
|
|
253
253
|
function resolveConstantInitializerRefs(
|
|
254
|
-
c: import('./types').ConstantInfo,
|
|
254
|
+
c: import('./types.ts').ConstantInfo,
|
|
255
255
|
env: BindingEnvironment,
|
|
256
256
|
visited: Set<string>
|
|
257
257
|
): FreeReference[] {
|
package/src/index.ts
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
// Main compiler API
|
|
8
|
-
export { compileJSX, buildMetadata } from './compiler'
|
|
9
|
-
export type { CompileResult, CompileOptions, CompileOptionsWithAdapter, FileOutput } from './compiler'
|
|
8
|
+
export { compileJSX, buildMetadata } from './compiler.ts'
|
|
9
|
+
export type { CompileResult, CompileOptions, CompileOptionsWithAdapter, FileOutput } from './compiler.ts'
|
|
10
10
|
|
|
11
11
|
// SSR template-variable defaults (manifest seeds for stash-based adapters)
|
|
12
|
-
export { extractSsrDefaults } from './ssr-defaults'
|
|
13
|
-
export type { SsrDefault } from './ssr-defaults'
|
|
12
|
+
export { extractSsrDefaults } from './ssr-defaults.ts'
|
|
13
|
+
export type { SsrDefault } from './ssr-defaults.ts'
|
|
14
14
|
|
|
15
15
|
// Pure IR types
|
|
16
16
|
export type {
|
|
@@ -45,20 +45,20 @@ export type {
|
|
|
45
45
|
TypeDefinition,
|
|
46
46
|
SourceLocation,
|
|
47
47
|
CompilerError,
|
|
48
|
-
} from './types'
|
|
48
|
+
} from './types.ts'
|
|
49
49
|
|
|
50
50
|
// Analyzer
|
|
51
|
-
export { analyzeComponent, listComponentFunctions, listComponentFunctions as listExportedComponents, createProgramForFile, needsTypeBasedDetection, REACTIVE_PRIMITIVES, BROWSER_ONLY_CLIENT_APIS, type AnalyzerContext } from './analyzer'
|
|
52
|
-
export { createProgramForCorpus, type SharedProgramOptions } from './shared-program'
|
|
51
|
+
export { analyzeComponent, listComponentFunctions, listComponentFunctions as listExportedComponents, createProgramForFile, needsTypeBasedDetection, REACTIVE_PRIMITIVES, BROWSER_ONLY_CLIENT_APIS, type AnalyzerContext } from './analyzer.ts'
|
|
52
|
+
export { createProgramForCorpus, type SharedProgramOptions } from './shared-program.ts'
|
|
53
53
|
|
|
54
54
|
// JSX to IR transformer
|
|
55
|
-
export { jsxToIR } from './jsx-to-ir'
|
|
55
|
+
export { jsxToIR } from './jsx-to-ir.ts'
|
|
56
56
|
|
|
57
57
|
// Module exports generation (compiler layer)
|
|
58
|
-
export { generateModuleExports, extractFunctionParams, formatParamWithType, findReachableNames } from './module-exports'
|
|
58
|
+
export { generateModuleExports, extractFunctionParams, formatParamWithType, findReachableNames } from './module-exports.ts'
|
|
59
59
|
|
|
60
60
|
// Adapters
|
|
61
|
-
export { BaseAdapter } from './adapters/interface'
|
|
61
|
+
export { BaseAdapter } from './adapters/interface.ts'
|
|
62
62
|
export type {
|
|
63
63
|
TemplateAdapter,
|
|
64
64
|
AdapterOutput,
|
|
@@ -67,31 +67,31 @@ export type {
|
|
|
67
67
|
TemplatePrimitiveEmit,
|
|
68
68
|
TemplatePrimitiveRegistry,
|
|
69
69
|
TemplateCallAcceptor,
|
|
70
|
-
} from './adapters/interface'
|
|
71
|
-
export { JsxAdapter } from './adapters/jsx-adapter'
|
|
72
|
-
export type { JsxAdapterConfig } from './adapters/jsx-adapter'
|
|
73
|
-
export { rewriteImportsForTemplate } from './adapters/template-imports'
|
|
74
|
-
export { emitParsedExpr } from './adapters/parsed-expr-emitter'
|
|
75
|
-
export type { ParsedExprEmitter, HigherOrderMethod, ArrayMethod, SortMethod, LiteralType } from './adapters/parsed-expr-emitter'
|
|
76
|
-
export { emitIRNode } from './adapters/ir-node-emitter'
|
|
77
|
-
export type { IRNodeEmitter, EmitIRNode } from './adapters/ir-node-emitter'
|
|
78
|
-
export { emitAttrValue } from './adapters/attr-value-emitter'
|
|
79
|
-
export type { AttrValueEmitter } from './adapters/attr-value-emitter'
|
|
70
|
+
} from './adapters/interface.ts'
|
|
71
|
+
export { JsxAdapter } from './adapters/jsx-adapter.ts'
|
|
72
|
+
export type { JsxAdapterConfig } from './adapters/jsx-adapter.ts'
|
|
73
|
+
export { rewriteImportsForTemplate } from './adapters/template-imports.ts'
|
|
74
|
+
export { emitParsedExpr } from './adapters/parsed-expr-emitter.ts'
|
|
75
|
+
export type { ParsedExprEmitter, HigherOrderMethod, ArrayMethod, SortMethod, LiteralType } from './adapters/parsed-expr-emitter.ts'
|
|
76
|
+
export { emitIRNode } from './adapters/ir-node-emitter.ts'
|
|
77
|
+
export type { IRNodeEmitter, EmitIRNode } from './adapters/ir-node-emitter.ts'
|
|
78
|
+
export { emitAttrValue } from './adapters/attr-value-emitter.ts'
|
|
79
|
+
export type { AttrValueEmitter } from './adapters/attr-value-emitter.ts'
|
|
80
80
|
|
|
81
81
|
// Client JS Generator
|
|
82
|
-
export { generateClientJs, generateClientJsWithSourceMap, analyzeClientNeeds } from './ir-to-client-js'
|
|
83
|
-
export type { ClientJsResult } from './ir-to-client-js'
|
|
82
|
+
export { generateClientJs, generateClientJsWithSourceMap, analyzeClientNeeds } from './ir-to-client-js/index.ts'
|
|
83
|
+
export type { ClientJsResult } from './ir-to-client-js/index.ts'
|
|
84
84
|
|
|
85
85
|
// Source Map
|
|
86
|
-
export { SourceMapGenerator, buildSourceMapFromIR } from './ir-to-client-js/source-map'
|
|
87
|
-
export type { SourceMapV3 } from './ir-to-client-js/source-map'
|
|
86
|
+
export { SourceMapGenerator, buildSourceMapFromIR } from './ir-to-client-js/source-map.ts'
|
|
87
|
+
export type { SourceMapV3 } from './ir-to-client-js/source-map.ts'
|
|
88
88
|
|
|
89
89
|
// Client JS Combiner (for build scripts)
|
|
90
|
-
export { combineParentChildClientJs } from './combine-client-js'
|
|
90
|
+
export { combineParentChildClientJs } from './combine-client-js.ts'
|
|
91
91
|
|
|
92
92
|
// Externals manifest + importmap snippet renderer (shared by adapters and CLI)
|
|
93
|
-
export { renderImportMapHtml } from './import-map'
|
|
94
|
-
export type { ExternalsManifest, ImportMapManifest } from './import-map'
|
|
93
|
+
export { renderImportMapHtml } from './import-map.ts'
|
|
94
|
+
export type { ExternalsManifest, ImportMapManifest } from './import-map.ts'
|
|
95
95
|
|
|
96
96
|
// Build options (shared by adapters and CLI)
|
|
97
97
|
export interface OutputLayout {
|
|
@@ -226,10 +226,10 @@ export interface BuildOptions {
|
|
|
226
226
|
}
|
|
227
227
|
|
|
228
228
|
// AttrValue constructors
|
|
229
|
-
export { AttrValueOf } from './types'
|
|
229
|
+
export { AttrValueOf } from './types.ts'
|
|
230
230
|
|
|
231
231
|
// CSS Layer Prefixer
|
|
232
|
-
export { applyCssLayerPrefix } from './css-layer-prefixer'
|
|
232
|
+
export { applyCssLayerPrefix } from './css-layer-prefixer.ts'
|
|
233
233
|
|
|
234
234
|
// Compiler instrumentation (bench + perf debugging)
|
|
235
235
|
export {
|
|
@@ -238,16 +238,16 @@ export {
|
|
|
238
238
|
resetCompilerCounters,
|
|
239
239
|
getCompilerCounters,
|
|
240
240
|
type CompilerCounters,
|
|
241
|
-
} from './instrumentation'
|
|
241
|
+
} from './instrumentation.ts'
|
|
242
242
|
|
|
243
243
|
// Errors
|
|
244
|
-
export { ErrorCodes, createError, formatError, generateCodeFrame } from './errors'
|
|
244
|
+
export { ErrorCodes, createError, formatError, generateCodeFrame } from './errors.ts'
|
|
245
245
|
|
|
246
246
|
// Expression Parser
|
|
247
|
-
export { parseExpression, isSupported, exprToString, stringifyParsedExpr, identifierPath, parseBlockBody, containsHigherOrder } from './expression-parser'
|
|
248
|
-
export type { ParsedExpr, ParsedStatement, SortComparator, SortKey, ReduceOp, FlatDepth, FlatMapOp, FlatMapLeaf, SupportLevel, SupportResult, TemplatePart } from './expression-parser'
|
|
249
|
-
export { buildLoopChainExpr } from './loop-chain'
|
|
250
|
-
export type { LoopChainInputs } from './loop-chain'
|
|
247
|
+
export { parseExpression, isSupported, exprToString, stringifyParsedExpr, identifierPath, parseBlockBody, containsHigherOrder, extractArrowBodyExpression } from './expression-parser.ts'
|
|
248
|
+
export type { ParsedExpr, ParsedStatement, SortComparator, SortKey, ReduceOp, FlatDepth, FlatMapOp, FlatMapLeaf, SupportLevel, SupportResult, TemplatePart } from './expression-parser.ts'
|
|
249
|
+
export { buildLoopChainExpr } from './loop-chain.ts'
|
|
250
|
+
export type { LoopChainInputs } from './loop-chain.ts'
|
|
251
251
|
|
|
252
252
|
// Debug analysis
|
|
253
253
|
export {
|
|
@@ -273,16 +273,16 @@ export {
|
|
|
273
273
|
resolveSetters,
|
|
274
274
|
buildLocalFunctionSetterMap,
|
|
275
275
|
makeIdCallRegex,
|
|
276
|
-
} from './debug'
|
|
277
|
-
export type { ComponentGraph, ComponentAnalysis, SignalNode, MemoNode, EffectNode, DomBinding, UpdatePath, SignalTrace, EventBinding, SetterRef, FnSetterResolution, EventSummary, LoopInfo, LoopChildBinding, LoopSummary, WhyUpdateResult, WhyUpdateDep, WhyUpdateSource, FallbackExplanation, ComponentSummary } from './debug'
|
|
278
|
-
export type { WrapReason } from './ir-to-client-js/reactivity'
|
|
276
|
+
} from './debug.ts'
|
|
277
|
+
export type { ComponentGraph, ComponentAnalysis, SignalNode, MemoNode, EffectNode, DomBinding, UpdatePath, SignalTrace, EventBinding, SetterRef, FnSetterResolution, EventSummary, LoopInfo, LoopChildBinding, LoopSummary, WhyUpdateResult, WhyUpdateDep, WhyUpdateSource, FallbackExplanation, ComponentSummary } from './debug.ts'
|
|
278
|
+
export type { WrapReason } from './ir-to-client-js/reactivity.ts'
|
|
279
279
|
|
|
280
280
|
// HTML constants
|
|
281
|
-
export { BOOLEAN_ATTRS, isBooleanAttr } from './html-constants'
|
|
281
|
+
export { BOOLEAN_ATTRS, isBooleanAttr } from './html-constants.ts'
|
|
282
282
|
|
|
283
283
|
// Shared props-object-pattern helpers for the Go / Mojo template adapters
|
|
284
|
-
export { augmentInheritedPropAccesses, parseRecordIndexAccess, evalStringArrayJoin, collectContextConsumers } from './augment-inherited-props'
|
|
285
|
-
export type { RecordIndexAccess, RecordIndexEntry, ContextConsumer } from './augment-inherited-props'
|
|
284
|
+
export { augmentInheritedPropAccesses, parseRecordIndexAccess, evalStringArrayJoin, collectContextConsumers } from './augment-inherited-props.ts'
|
|
285
|
+
export type { RecordIndexAccess, RecordIndexEntry, ContextConsumer } from './augment-inherited-props.ts'
|
|
286
286
|
|
|
287
287
|
// HTML element attribute types
|
|
288
288
|
export type {
|
|
@@ -319,4 +319,4 @@ export type {
|
|
|
319
319
|
ImgHTMLAttributes,
|
|
320
320
|
LabelHTMLAttributes,
|
|
321
321
|
OptionHTMLAttributes,
|
|
322
|
-
} from './html-types'
|
|
322
|
+
} from './html-types.ts'
|
|
@@ -34,12 +34,12 @@ import type {
|
|
|
34
34
|
ReferenceEdge,
|
|
35
35
|
ReferenceSource,
|
|
36
36
|
ReferencesGraph,
|
|
37
|
-
} from '../types'
|
|
38
|
-
import type { IRVisitor as WalkerVisitor } from './walker'
|
|
39
|
-
import { attrValueToString } from './utils'
|
|
40
|
-
import type { ClientJsContext } from './types'
|
|
41
|
-
import { extractIdentifiers, extractTemplateIdentifiers } from './identifiers'
|
|
42
|
-
import { walkIR } from './walker'
|
|
37
|
+
} from '../types.ts'
|
|
38
|
+
import type { IRVisitor as WalkerVisitor } from './walker.ts'
|
|
39
|
+
import { attrValueToString } from './utils.ts'
|
|
40
|
+
import type { ClientJsContext } from './types.ts'
|
|
41
|
+
import { extractIdentifiers, extractTemplateIdentifiers } from './identifiers.ts'
|
|
42
|
+
import { walkIR } from './walker.ts'
|
|
43
43
|
|
|
44
44
|
// All non-declaration edge origins share a single null source — no
|
|
45
45
|
// query on the graph distinguishes them on read today. Stage E
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* skipped — they are declared in the same file and already resolve.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import type { IRNode } from '../types'
|
|
12
|
-
import type { ClientJsContext, ConditionalElement } from './types'
|
|
11
|
+
import type { IRNode } from '../types.ts'
|
|
12
|
+
import type { ClientJsContext, ConditionalElement } from './types.ts'
|
|
13
13
|
|
|
14
14
|
/** Emit child-component import marker lines for every component name
|
|
15
15
|
* reachable from the current component's IR (minus siblings). */
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* IR tree traversal → collect elements into ClientJsContext.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { type IRNode, type IRElement, type IRComponent, type IRLoop, type IRProp, pickAttrMetaFromIR } from '../types'
|
|
6
|
-
import type { ClientJsContext, ConditionalBranchChildComponent, ConditionalBranchReactiveAttr, BranchLoop, ConditionalBranchTextEffect, ConditionalElement, LoopChildBindings, LoopChildBranchSummary, LoopChildConditional, LoopOffset, NestedLoop } from './types'
|
|
7
|
-
import { attrValueToString, freeIdsFromRefs, quotePropName, PROPS_PARAM } from './utils'
|
|
8
|
-
import { classifyReactivity, decideWrapForAttr, decideWrapForChildProp, decideWrapFromAstFlags, collectEventHandlersFromIR, collectConditionalBranchEvents, collectConditionalBranchRefs, collectConditionalBranchChildComponents, collectLoopChildEventsWithNesting, collectLoopChildReactiveAttrs, collectLoopChildReactiveTexts, collectLoopChildRefs, emptyLoopChildBindings } from './reactivity'
|
|
9
|
-
import { irToHtmlTemplate, irToPlaceholderTemplate, irChildrenToJsExpr } from './html-template'
|
|
10
|
-
import { expandDynamicPropValue, expandConstantForReactivity } from './prop-handling'
|
|
11
|
-
import { walkIR, stopAt } from './walker'
|
|
12
|
-
import { buildLoopChainExpr } from '../loop-chain'
|
|
5
|
+
import { type IRNode, type IRElement, type IRComponent, type IRLoop, type IRProp, pickAttrMetaFromIR } from '../types.ts'
|
|
6
|
+
import type { ClientJsContext, ConditionalBranchChildComponent, ConditionalBranchReactiveAttr, BranchLoop, ConditionalBranchTextEffect, ConditionalElement, LoopChildBindings, LoopChildBranchSummary, LoopChildConditional, LoopOffset, NestedLoop } from './types.ts'
|
|
7
|
+
import { attrValueToString, freeIdsFromRefs, quotePropName, PROPS_PARAM } from './utils.ts'
|
|
8
|
+
import { classifyReactivity, decideWrapForAttr, decideWrapForChildProp, decideWrapFromAstFlags, collectEventHandlersFromIR, collectConditionalBranchEvents, collectConditionalBranchRefs, collectConditionalBranchChildComponents, collectLoopChildEventsWithNesting, collectLoopChildReactiveAttrs, collectLoopChildReactiveTexts, collectLoopChildRefs, emptyLoopChildBindings } from './reactivity.ts'
|
|
9
|
+
import { irToHtmlTemplate, irToPlaceholderTemplate, irChildrenToJsExpr } from './html-template.ts'
|
|
10
|
+
import { expandDynamicPropValue, expandConstantForReactivity } from './prop-handling.ts'
|
|
11
|
+
import { walkIR, stopAt } from './walker.ts'
|
|
12
|
+
import { buildLoopChainExpr } from '../loop-chain.ts'
|
|
13
13
|
|
|
14
14
|
/** Expressions that render nothing (0 DOM nodes) — `&&` / `?:` empty branches. */
|
|
15
15
|
const EMPTY_RENDER_EXPRS = new Set(['null', 'undefined', 'false', "''", '""', '``'])
|
|
@@ -340,12 +340,12 @@ export function collectInnerLoops(
|
|
|
340
340
|
// Per-item bindings for branch-mode callers (child components,
|
|
341
341
|
// events, nested conditionals) — matches the pre-Phase 2
|
|
342
342
|
// `collectBranchInnerLoops` behaviour.
|
|
343
|
-
let childComponents: import('../types').IRLoopChildComponent[] | undefined
|
|
343
|
+
let childComponents: import('../types.ts').IRLoopChildComponent[] | undefined
|
|
344
344
|
if (collectBindings) {
|
|
345
345
|
// skipConditionals=true: components inside conditional branches
|
|
346
346
|
// are collected separately via `childConditionals[i].whenTrue.childComponents`
|
|
347
347
|
// (below). Including them here would double-init event handlers.
|
|
348
|
-
const rawComps: Array<{ name: string; slotId: string | null; props: import('../types').IRProp[]; children: IRNode[] }> = []
|
|
348
|
+
const rawComps: Array<{ name: string; slotId: string | null; props: import('../types.ts').IRProp[]; children: IRNode[] }> = []
|
|
349
349
|
for (const child of n.children) {
|
|
350
350
|
rawComps.push(...collectConditionalBranchChildComponents(child, true))
|
|
351
351
|
}
|
|
@@ -1145,7 +1145,7 @@ function summarizeBranch(
|
|
|
1145
1145
|
node: IRNode,
|
|
1146
1146
|
ctx: ClientJsContext,
|
|
1147
1147
|
siblingOffsets: Map<IRLoop, IRNode[]>,
|
|
1148
|
-
): import('./types').BranchSummary {
|
|
1148
|
+
): import('./types.ts').BranchSummary {
|
|
1149
1149
|
return {
|
|
1150
1150
|
events: collectConditionalBranchEvents(node),
|
|
1151
1151
|
refs: collectConditionalBranchRefs(node),
|
|
@@ -1214,7 +1214,7 @@ export function collectLoopChildBindings(
|
|
|
1214
1214
|
ctx: ClientJsContext,
|
|
1215
1215
|
siblingOffsets: Map<IRLoop, IRNode[]>,
|
|
1216
1216
|
loopParam: string,
|
|
1217
|
-
loopParamBindings: readonly import('../types').LoopParamBinding[] | undefined,
|
|
1217
|
+
loopParamBindings: readonly import('../types.ts').LoopParamBinding[] | undefined,
|
|
1218
1218
|
): LoopChildBindings {
|
|
1219
1219
|
const bindings = emptyLoopChildBindings()
|
|
1220
1220
|
for (const child of children) {
|
|
@@ -1232,7 +1232,7 @@ export function collectLoopChildConditionals(
|
|
|
1232
1232
|
ctx: ClientJsContext,
|
|
1233
1233
|
siblingOffsets: Map<IRLoop, IRNode[]>,
|
|
1234
1234
|
loopParam?: string,
|
|
1235
|
-
loopParamBindings?: readonly import('../types').LoopParamBinding[],
|
|
1235
|
+
loopParamBindings?: readonly import('../types.ts').LoopParamBinding[],
|
|
1236
1236
|
): LoopChildConditional[] {
|
|
1237
1237
|
const conditionals: LoopChildConditional[] = []
|
|
1238
1238
|
|
|
@@ -1307,7 +1307,7 @@ function summarizeLoopChildBranch(
|
|
|
1307
1307
|
ctx: ClientJsContext,
|
|
1308
1308
|
siblingOffsets: Map<IRLoop, IRNode[]>,
|
|
1309
1309
|
loopParam?: string,
|
|
1310
|
-
loopParamBindings?: readonly import('../types').LoopParamBinding[],
|
|
1310
|
+
loopParamBindings?: readonly import('../types.ts').LoopParamBinding[],
|
|
1311
1311
|
): LoopChildBranchSummary {
|
|
1312
1312
|
const inner = collectInnerLoops([node], siblingOffsets, loopParam, ctx, branchInnerLoopOptions)
|
|
1313
1313
|
return {
|
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
* Stage E.4 of issue #1021.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import type { ConstantInfo, IRNode, ReferencesGraph } from '../types'
|
|
27
|
-
import type { ClientJsContext } from './types'
|
|
28
|
-
import { graphFunctionReferences } from './build-references'
|
|
29
|
-
import { extractIdentifiers, extractTemplateIdentifiers } from './identifiers'
|
|
30
|
-
import { isInlinableInTemplate, buildRelocateEnvFromIR } from '../relocate'
|
|
31
|
-
import type { RelocateEnv, RelocateDecision } from '../relocate'
|
|
32
|
-
import { createError, ErrorCodes } from '../errors'
|
|
33
|
-
import { attrValueToString } from './utils'
|
|
34
|
-
import { walkIR, type IRVisitor } from './walker'
|
|
35
|
-
import { buildSignalMemoEnv, csrSubstitute, type CsrEnv, type CsrSubstitution } from './csr-substitute'
|
|
26
|
+
import type { ConstantInfo, IRNode, ReferencesGraph } from '../types.ts'
|
|
27
|
+
import type { ClientJsContext } from './types.ts'
|
|
28
|
+
import { graphFunctionReferences } from './build-references.ts'
|
|
29
|
+
import { extractIdentifiers, extractTemplateIdentifiers } from './identifiers.ts'
|
|
30
|
+
import { isInlinableInTemplate, buildRelocateEnvFromIR } from '../relocate.ts'
|
|
31
|
+
import type { RelocateEnv, RelocateDecision } from '../relocate.ts'
|
|
32
|
+
import { createError, ErrorCodes } from '../errors.ts'
|
|
33
|
+
import { attrValueToString } from './utils.ts'
|
|
34
|
+
import { walkIR, type IRVisitor } from './walker.ts'
|
|
35
|
+
import { buildSignalMemoEnv, csrSubstitute, type CsrEnv, type CsrSubstitution } from './csr-substitute.ts'
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Build a `RelocateEnv` from a live `ClientJsContext`. The IR-keyed env
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* case.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import type { ConstantInfo, PropUsage } from '../types'
|
|
16
|
-
import type { ClientJsContext } from './types'
|
|
17
|
-
import { collectPropAccesses, type PropAccessKindMap } from './walk-prop-accesses'
|
|
15
|
+
import type { ConstantInfo, PropUsage } from '../types.ts'
|
|
16
|
+
import type { ClientJsContext } from './types.ts'
|
|
17
|
+
import { collectPropAccesses, type PropAccessKindMap } from './walk-prop-accesses.ts'
|
|
18
18
|
|
|
19
19
|
export function computePropUsage(
|
|
20
20
|
ctx: ClientJsContext,
|
|
@@ -14,13 +14,13 @@ import type {
|
|
|
14
14
|
DeclarationScope,
|
|
15
15
|
FunctionInfo,
|
|
16
16
|
ReferencesGraph,
|
|
17
|
-
} from '../types'
|
|
18
|
-
import type { ClientJsContext } from './types'
|
|
17
|
+
} from '../types.ts'
|
|
18
|
+
import type { ClientJsContext } from './types.ts'
|
|
19
19
|
import {
|
|
20
20
|
graphAssignedIdentifiers,
|
|
21
21
|
graphFunctionReferences,
|
|
22
22
|
graphUsedIdentifiers,
|
|
23
|
-
} from './build-references'
|
|
23
|
+
} from './build-references.ts'
|
|
24
24
|
|
|
25
25
|
export interface DeclarationScopes {
|
|
26
26
|
constantScope: Map<string, DeclarationScope>
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
* pair.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import type { CompositeLoopPlan, LoopChildRefBinding } from './loop'
|
|
19
|
-
import type { EventDelegationPlan } from './event-delegation'
|
|
20
|
-
import type { ReactiveEffectsPlan } from './reactive-effects'
|
|
18
|
+
import type { CompositeLoopPlan, LoopChildRefBinding } from './loop.ts'
|
|
19
|
+
import type { EventDelegationPlan } from './event-delegation.ts'
|
|
20
|
+
import type { ReactiveEffectsPlan } from './reactive-effects.ts'
|
|
21
21
|
|
|
22
22
|
export interface BranchPlainLoopPlan {
|
|
23
23
|
kind: 'plain'
|
|
@@ -10,17 +10,17 @@
|
|
|
10
10
|
* event-delegation plan.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import type { BranchLoop } from '../../types'
|
|
14
|
-
import { buildChainedArrayExpr, varSlotId, wrapLoopParamAsAccessor } from '../../utils'
|
|
15
|
-
import { buildBranchCompositePlan } from './build-composite-loop'
|
|
16
|
-
import { buildBranchLoopDelegationPlan } from './build-event-delegation'
|
|
17
|
-
import { buildReactiveEffectsPlan } from './build-reactive-effects'
|
|
18
|
-
import { destructureLoopParam, loopKeyFn, buildChildRefBindings } from '../shared'
|
|
13
|
+
import type { BranchLoop } from '../../types.ts'
|
|
14
|
+
import { buildChainedArrayExpr, varSlotId, wrapLoopParamAsAccessor } from '../../utils.ts'
|
|
15
|
+
import { buildBranchCompositePlan } from './build-composite-loop.ts'
|
|
16
|
+
import { buildBranchLoopDelegationPlan } from './build-event-delegation.ts'
|
|
17
|
+
import { buildReactiveEffectsPlan } from './build-reactive-effects.ts'
|
|
18
|
+
import { destructureLoopParam, loopKeyFn, buildChildRefBindings } from '../shared.ts'
|
|
19
19
|
import type {
|
|
20
20
|
BranchCompositeLoopPlan,
|
|
21
21
|
BranchLoopPlan,
|
|
22
22
|
BranchPlainLoopPlan,
|
|
23
|
-
} from './branch-loop'
|
|
23
|
+
} from './branch-loop.ts'
|
|
24
24
|
|
|
25
25
|
export function buildBranchLoopPlan(loop: BranchLoop): BranchLoopPlan {
|
|
26
26
|
const containerSlotId = loop.containerSlotId
|