@tsrx/core 0.1.18 → 0.1.20

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/types/index.d.ts CHANGED
@@ -102,11 +102,15 @@ interface BaseNodeMetaData {
102
102
  }
103
103
 
104
104
  interface FunctionMetaData extends BaseNodeMetaData {
105
+ native_tsrx?: boolean;
105
106
  native_tsrx_function?: boolean;
107
+ hook_split?: boolean;
106
108
  is_method?: boolean;
107
109
  tracked?: boolean;
108
110
  has_lazy_descendants?: boolean;
109
111
  synthetic_children?: boolean;
112
+ generated_helpers?: any[];
113
+ generated_statics?: any[];
110
114
  }
111
115
 
112
116
  // Strip parent, loc, and range from TSESTree nodes to match @sveltejs/acorn-typescript output
@@ -163,6 +167,13 @@ declare module 'estree' {
163
167
  };
164
168
  }
165
169
 
170
+ interface BlockStatement {
171
+ metadata: BaseNodeMetaData & {
172
+ hook_split_block?: boolean;
173
+ native_return_block?: boolean;
174
+ };
175
+ }
176
+
166
177
  type Accessibility = 'public' | 'protected' | 'private'; // missing in acorn-typescript types
167
178
  interface MethodDefinition {
168
179
  typeParameters?: TSTypeParameterDeclaration;
@@ -225,8 +236,7 @@ declare module 'estree' {
225
236
 
226
237
  // Include TypeScript node types and TSRX-specific nodes in NodeMap
227
238
  interface NodeMap {
228
- Tsx: Tsx;
229
- Tsrx: Tsrx;
239
+ TsrxFragment: TsrxFragment;
230
240
  TsxCompat: TsxCompat;
231
241
  TSRXExpression: TSRXExpression;
232
242
  Element: Element;
@@ -238,6 +248,7 @@ declare module 'estree' {
238
248
  }
239
249
 
240
250
  interface ExpressionMap {
251
+ TsrxFragment: TsrxFragment;
241
252
  Text: TextNode;
242
253
  JSXEmptyExpression: ESTreeJSX.JSXEmptyExpression;
243
254
  ParenthesizedExpression: ParenthesizedExpression;
@@ -333,18 +344,8 @@ declare module 'estree' {
333
344
  trailingComments?: AST.Comment[] | undefined;
334
345
  }
335
346
 
336
- interface Tsx extends AST.BaseNode {
337
- type: 'Tsx';
338
- attributes: Array<any>;
339
- children: ESTreeJSX.JSXElement['children'];
340
- selfClosing?: boolean;
341
- unclosed?: boolean;
342
- openingElement: ESTreeJSX.JSXOpeningElement;
343
- closingElement: ESTreeJSX.JSXClosingElement;
344
- }
345
-
346
- interface Tsrx extends AST.BaseNode {
347
- type: 'Tsrx';
347
+ interface TsrxFragment extends AST.BaseExpression {
348
+ type: 'TsrxFragment';
348
349
  attributes: Array<any>;
349
350
  children: AST.Node[];
350
351
  selfClosing?: boolean;
@@ -449,7 +450,7 @@ declare module 'estree' {
449
450
 
450
451
  export type TSRXStatement = AST.Statement | TSESTree.Statement;
451
452
 
452
- export type NodeWithChildren = AST.Element | AST.Tsx | AST.Tsrx | AST.TsxCompat;
453
+ export type NodeWithChildren = AST.Element | AST.TsrxFragment | AST.TsxCompat;
453
454
 
454
455
  export namespace CSS {
455
456
  export interface BaseNode extends AST.NodeWithMaybeComments {
@@ -649,6 +650,12 @@ declare module 'estree-jsx' {
649
650
  };
650
651
  }
651
652
 
653
+ interface JSXOpeningElement {
654
+ metadata: BaseNodeMetaData & {
655
+ native_tsrx_pretransformed?: boolean;
656
+ };
657
+ }
658
+
652
659
  interface JSXExpressionContainer {
653
660
  text?: boolean;
654
661
  style?: boolean;
@@ -1204,8 +1211,7 @@ export interface Binding {
1204
1211
  | AST.ClassDeclaration
1205
1212
  | AST.ImportDeclaration
1206
1213
  | AST.TSModuleDeclaration
1207
- | AST.Tsx
1208
- | AST.Tsrx;
1214
+ | AST.TsrxFragment;
1209
1215
  /** Whether this binding has been reassigned */
1210
1216
  reassigned: boolean;
1211
1217
  /** Whether this binding has been mutated (property access) */
@@ -1305,8 +1311,7 @@ export interface ScopeInterface {
1305
1311
  | AST.ClassDeclaration
1306
1312
  | AST.ImportDeclaration
1307
1313
  | AST.TSModuleDeclaration
1308
- | AST.Tsx
1309
- | AST.Tsrx,
1314
+ | AST.TsrxFragment,
1310
1315
  ): Binding;
1311
1316
  /** Get binding by name */
1312
1317
  get(name: string): Binding | null;
@@ -42,6 +42,7 @@ export interface JsxTransformContext {
42
42
  needs_for_of_iterable: boolean;
43
43
  needs_iteration_value_type: boolean;
44
44
  stylesheets: AST.CSS.StyleSheet[];
45
+ type_only_style_anchors: AST.Statement[];
45
46
  module_scoped_hook_components: boolean;
46
47
  helper_state: {
47
48
  base_name: string;
@@ -154,13 +155,6 @@ export interface JsxPlatformHooks {
154
155
  * state behaves like normal component state.
155
156
  */
156
157
  wrapHelperComponent?: (helperFn: any, helperId: any, ctx: any, sourceNode: any) => any;
157
- /**
158
- * Wrap an uppercase JavaScript function that returns native TSRX as a target
159
- * component. Vue uses this to turn `function App() { return <></>; }` into a
160
- * `defineVaporComponent(function App() { ... })` binding while lowercase
161
- * TSRX-returning callbacks stay plain functions.
162
- */
163
- wrapNativeFunctionComponent?: (fn: any, ctx: any, path: any[]) => any;
164
158
  /**
165
159
  * Emit hook-isolation helper components as unique module-scope declarations
166
160
  * instead of lazily creating and caching them from the parent component body.
package/types/parse.d.ts CHANGED
@@ -1172,7 +1172,7 @@ export namespace Parse {
1172
1172
  */
1173
1173
  parseTopLevel(node: AST.Program): AST.Program;
1174
1174
 
1175
- parseElement(): AST.Element | AST.Tsx | AST.Tsrx | AST.TsxCompat;
1175
+ parseElement(): AST.Element | AST.TsrxFragment | AST.TsxCompat;
1176
1176
 
1177
1177
  parseDoubleQuotedTextChild(): AST.TextNode;
1178
1178