@tsrx/core 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/plugin.js +16 -1
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.0",
6
+ "version": "0.1.1",
7
7
  "type": "module",
8
8
  "repository": {
9
9
  "type": "git",
package/src/plugin.js CHANGED
@@ -1702,7 +1702,22 @@ export function TSRXPlugin(config) {
1702
1702
  chunkStart = this.pos;
1703
1703
 
1704
1704
  while (true) {
1705
- if (this.pos >= this.input.length) this.raise(this.start, 'Unterminated JSX contents');
1705
+ if (this.pos >= this.input.length) {
1706
+ const inside_open_template = this.#path.findLast(
1707
+ (n) =>
1708
+ n.type === 'Element' ||
1709
+ n.type === 'Tsrx' ||
1710
+ n.type === 'TsxCompat' ||
1711
+ n.type === 'Tsx',
1712
+ );
1713
+ if (!inside_open_template) {
1714
+ while (this.curContext() === tstc.tc_expr) {
1715
+ this.context.pop();
1716
+ }
1717
+ return this.finishToken(tt.eof);
1718
+ }
1719
+ this.raise(this.start, 'Unterminated JSX contents');
1720
+ }
1706
1721
  let ch = this.input.charCodeAt(this.pos);
1707
1722
 
1708
1723
  switch (ch) {