@tsrx/core 0.1.53 → 0.1.55

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Core compiler infrastructure for TSRX syntax",
4
4
  "license": "MIT",
5
5
  "author": "Dominic Gannaway",
6
- "version": "0.1.53",
6
+ "version": "0.1.55",
7
7
  "type": "module",
8
8
  "repository": {
9
9
  "type": "git",
package/src/plugin.js CHANGED
@@ -2440,9 +2440,15 @@ export function TSRXPlugin(config) {
2440
2440
  }
2441
2441
  // Statement-bodied native template attributes can leave the attribute's
2442
2442
  // expression contexts above the still-open JSX tag context. Strip
2443
- // those so a following `/>` stays in JSX opening-tag mode.
2443
+ // those so a following `/>` stays in JSX opening-tag mode. Once the
2444
+ // stack has unwound below the enclosing expression's depth the same
2445
+ // tail shape means something else: the `}` closed an inner child
2446
+ // container (its own brace context already popped) and the tc_expr
2447
+ // belongs to a still-open element between the attribute brace and
2448
+ // this one — stripping would drop the attribute container's brace.
2444
2449
  if (
2445
2450
  this.type === tt.braceR &&
2451
+ ctx.length >= enclosing_context_depth &&
2446
2452
  top === tstc.tc_expr &&
2447
2453
  second === b_expr &&
2448
2454
  ctx[ci - 2] === tstc.tc_oTag
package/types/index.d.ts CHANGED
@@ -303,6 +303,8 @@ declare module 'estree' {
303
303
  typeParameters?: TSTypeParameterDeclaration;
304
304
  accessibility?: Accessibility;
305
305
  optional?: boolean;
306
+ abstract?: boolean;
307
+ override?: boolean;
306
308
  }
307
309
 
308
310
  interface PropertyDefinition {
@@ -310,18 +312,26 @@ declare module 'estree' {
310
312
  readonly?: boolean;
311
313
  optional?: boolean;
312
314
  definite?: boolean;
315
+ abstract?: boolean;
316
+ override?: boolean;
317
+ declare?: boolean;
318
+ accessor?: boolean;
313
319
  }
314
320
 
315
321
  interface ClassDeclaration {
316
322
  typeParameters?: AST.TSTypeParameterDeclaration;
317
323
  superTypeParameters?: AST.TSTypeParameterInstantiation;
318
324
  implements?: AST.TSClassImplements[];
325
+ abstract?: boolean;
326
+ declare?: boolean;
319
327
  }
320
328
 
321
329
  interface ClassExpression {
322
330
  typeParameters?: AST.TSTypeParameterDeclaration;
323
331
  superTypeParameters?: AST.TSTypeParameterInstantiation;
324
332
  implements?: AST.TSClassImplements[];
333
+ abstract?: boolean;
334
+ declare?: boolean;
325
335
  }
326
336
 
327
337
  interface Identifier extends AST.TrackedNode {
@@ -351,8 +361,16 @@ declare module 'estree' {
351
361
  tracked?: boolean;
352
362
  }
353
363
 
364
+ // A `@decorator` on a class, class member, or parameter. The parser emits
365
+ // these, but estree has no node type for them.
366
+ interface Decorator extends AST.BaseNode {
367
+ type: 'Decorator';
368
+ expression: AST.Expression;
369
+ }
370
+
354
371
  // Include TypeScript node types and TSRX-specific nodes in NodeMap
355
372
  interface NodeMap {
373
+ Decorator: Decorator;
356
374
  JSXSpreadChild: ESTreeJSX.JSXSpreadChild;
357
375
  TSRXImportDeclaration: TSRXImportDeclaration;
358
376
  TSRXJSXElement: TSRXJSXElement;
@@ -697,6 +715,19 @@ declare module 'estree' {
697
715
  declaration?: TSRXDeclaration | null | undefined;
698
716
  }
699
717
 
718
+ /**
719
+ * estree's `ExportDefaultDeclaration` predates the two TypeScript-only
720
+ * declaration forms the parser puts in this slot: `export default interface
721
+ * Foo {}` yields a `TSInterfaceDeclaration`, and the overload signature
722
+ * `export default function foo();` yields a `TSDeclareFunction`.
723
+ */
724
+ interface TSRXExportDefaultDeclaration extends Omit<AST.ExportDefaultDeclaration, 'declaration'> {
725
+ declaration:
726
+ | AST.ExportDefaultDeclaration['declaration']
727
+ | AST.TSDeclareFunction
728
+ | AST.TSInterfaceDeclaration;
729
+ }
730
+
700
731
  interface TSRXProgram extends Omit<Program, 'body'> {
701
732
  body: (Program['body'][number] | FunctionExpression)[];
702
733
  }