typenative 0.5.0 → 0.6.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 (149) hide show
  1. package/.github/workflows/ci.yml +2 -2
  2. package/.github/workflows/npm-publish-github-packages.yml +2 -2
  3. package/CHANGELOG.md +339 -0
  4. package/CONTRIBUTION.md +2 -1
  5. package/README.md +16 -7
  6. package/bin/cli.js +1 -0
  7. package/bin/index.js +62 -3
  8. package/bin/main.js +1 -0
  9. package/bin/node/core.js +46 -0
  10. package/bin/node/events.js +154 -15
  11. package/bin/node/http.js +1265 -127
  12. package/bin/node/process.js +13 -0
  13. package/bin/node/punycode.js +2 -2
  14. package/bin/node/stream.js +56 -7
  15. package/bin/node/stream_web.js +2 -2
  16. package/bin/node/timers.js +4 -2
  17. package/bin/node/url.js +28 -3
  18. package/bin/parse-node.js +2 -2
  19. package/bin/regex_vm.js +2105 -0
  20. package/bin/transpiler.js +17970 -4419
  21. package/bin/typecheck-node.js +2 -1
  22. package/bin/version.js +1 -1
  23. package/conformance.md +57 -15
  24. package/examples/README.md +50 -28
  25. package/examples/angular-templates/README.md +141 -0
  26. package/examples/angular-templates/bench.mjs +173 -0
  27. package/examples/angular-templates/dom-type-globals.d.ts +21 -0
  28. package/examples/angular-templates/dom-type-stubs.ts +21 -0
  29. package/examples/angular-templates/main.ts +135 -0
  30. package/examples/angular-templates/parity.mjs +157 -0
  31. package/examples/angular-templates/run-node.mjs +69 -0
  32. package/examples/angular-templates/vendor/angular/compiler/LICENSE +21 -0
  33. package/examples/desktop-notes/README.md +11 -13
  34. package/examples/dupe-finder/README.md +7 -5
  35. package/examples/fibonacci/README.md +7 -7
  36. package/examples/hello-world/README.md +6 -6
  37. package/examples/json-server/README.md +22 -18
  38. package/examples/mandelbrot-png/README.md +11 -13
  39. package/examples/marked-cli/README.md +60 -44
  40. package/examples/marked-cli/main.ts +122 -4
  41. package/examples/openai-chat/README.md +148 -0
  42. package/examples/openai-chat/bench.mjs +175 -0
  43. package/examples/openai-chat/main.ts +488 -0
  44. package/examples/react-compiler/README.md +185 -0
  45. package/examples/react-compiler/bench.mjs +181 -0
  46. package/examples/react-compiler/main.ts +324 -0
  47. package/examples/react-compiler/parity.mjs +362 -0
  48. package/examples/react-compiler/run-node.mjs +90 -0
  49. package/examples/react-compiler/vendor/babel/LICENSE +22 -0
  50. package/examples/react-compiler/vendor/babel/helper-globals/data/builtin-lower.json +15 -0
  51. package/examples/react-compiler/vendor/babel/helper-globals/data/builtin-upper.json +51 -0
  52. package/examples/react-compiler/vendor/charcodes/package.json +25 -0
  53. package/examples/react-compiler/vendor/invariant/LICENSE +21 -0
  54. package/examples/react-compiler/vendor/invariant/invariant.cjs +51 -0
  55. package/examples/react-compiler/vendor/invariant/invariant.d.cts +11 -0
  56. package/examples/react-compiler/vendor/invariant/types/LICENSE +21 -0
  57. package/examples/react-compiler/vendor/jridgewell/gen-mapping/LICENSE +19 -0
  58. package/examples/react-compiler/vendor/jridgewell/resolve-uri/LICENSE +19 -0
  59. package/examples/react-compiler/vendor/jridgewell/sourcemap-codec/LICENSE +19 -0
  60. package/examples/react-compiler/vendor/jridgewell/trace-mapping/LICENSE +19 -0
  61. package/examples/react-compiler/vendor/js-tokens/LICENSE +21 -0
  62. package/examples/react-compiler/vendor/js-tokens/index.cjs +23 -0
  63. package/examples/react-compiler/vendor/js-tokens/index.d.cts +13 -0
  64. package/examples/react-compiler/vendor/jsesc/LICENSE-MIT.txt +20 -0
  65. package/examples/react-compiler/vendor/jsesc/jsesc.cjs +337 -0
  66. package/examples/react-compiler/vendor/jsesc/jsesc.d.cts +384 -0
  67. package/examples/react-compiler/vendor/jsesc/types/LICENSE +21 -0
  68. package/examples/react-compiler/vendor/picocolors/LICENSE +15 -0
  69. package/examples/react-compiler/vendor/picocolors/picocolors.cjs +75 -0
  70. package/examples/react-compiler/vendor/picocolors/picocolors.d.cts +5 -0
  71. package/examples/react-compiler/vendor/picocolors/types.d.ts +51 -0
  72. package/examples/react-compiler/vendor/react-compiler/LICENSE +21 -0
  73. package/examples/react-compiler/vendor/stubs/babel-core.ts +31 -0
  74. package/examples/react-compiler/vendor/stubs/debug.ts +18 -0
  75. package/examples/react-compiler/vendor/stubs/js-tokens.d.ts +13 -0
  76. package/examples/react-compiler/vendor/stubs/pretty-format.ts +18 -0
  77. package/examples/react-compiler/vendor/zod/LICENSE +21 -0
  78. package/examples/react-compiler/vendor/zod-validation-error/LICENSE +9 -0
  79. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/NonEmptyArray.ts +5 -0
  80. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/joinPath.ts +49 -0
  81. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/joinValues.ts +48 -0
  82. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/stringify.ts +50 -0
  83. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/titleCase.ts +6 -0
  84. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/MessageBuilder.ts +126 -0
  85. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/ValidationError.ts +39 -0
  86. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/custom.ts +12 -0
  87. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/errorMap.ts +78 -0
  88. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/index.ts +2 -0
  89. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidElement.ts +12 -0
  90. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidKey.ts +12 -0
  91. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidStringFormat.ts +131 -0
  92. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidType.ts +54 -0
  93. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidUnion.ts +12 -0
  94. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidValue.ts +40 -0
  95. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/notMultipleOf.ts +12 -0
  96. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/tooBig.ts +76 -0
  97. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/tooSmall.ts +76 -0
  98. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/types.ts +27 -0
  99. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/unrecognizedKeys.ts +27 -0
  100. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/fromError.ts +13 -0
  101. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/fromZodError.ts +61 -0
  102. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/fromZodIssue.ts +38 -0
  103. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/index.ts +20 -0
  104. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/isValidationError.ts +5 -0
  105. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/isValidationErrorLike.ts +8 -0
  106. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/isZodErrorLike.ts +11 -0
  107. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/toValidationError.ts +20 -0
  108. package/examples/react-compiler/vendor.mjs +688 -0
  109. package/examples/todo-cli/README.md +9 -9
  110. package/examples/yaml-cli/README.md +50 -34
  111. package/examples/yaml-cli/main.ts +236 -14
  112. package/package.json +8 -5
  113. package/performance/README.md +196 -0
  114. package/performance/any-dynamic.ts +21 -0
  115. package/performance/any-record-view.ts +20 -0
  116. package/performance/arr-hof.ts +21 -0
  117. package/performance/arr-push-index.ts +15 -0
  118. package/performance/arr-sort.ts +21 -0
  119. package/performance/async-await.ts +24 -0
  120. package/performance/class-dispatch.ts +52 -0
  121. package/performance/events-emit.ts +27 -0
  122. package/performance/exc-throw-rare.ts +25 -0
  123. package/performance/exc-try-catch.ts +26 -0
  124. package/performance/fn-closures.ts +29 -0
  125. package/performance/fn-recursion-tree.ts +31 -0
  126. package/performance/gen-for-of.ts +46 -0
  127. package/performance/json-roundtrip.ts +27 -0
  128. package/performance/map-delete.ts +24 -0
  129. package/performance/map-string-keys.ts +22 -0
  130. package/performance/num-arith-loop.ts +14 -0
  131. package/performance/num-bitwise.ts +21 -0
  132. package/performance/num-mod-int.ts +16 -0
  133. package/performance/num-to-string.ts +16 -0
  134. package/performance/obj-alloc.ts +32 -0
  135. package/performance/regex-exec.ts +29 -0
  136. package/performance/regex-site.ts +28 -0
  137. package/performance/set-ops.ts +20 -0
  138. package/performance/str-char-scan.ts +35 -0
  139. package/performance/str-concat-plus.ts +18 -0
  140. package/performance/str-concat.ts +24 -0
  141. package/performance/str-short-scan.ts +26 -0
  142. package/performance/str-split-join.ts +23 -0
  143. package/performance/str-template.ts +16 -0
  144. package/performance/union-switch.ts +57 -0
  145. package/tsparser/check.go +2 -1
  146. package/tsparser/main.go +1 -0
  147. package/types/typenative-npm.d.ts +3 -2
  148. package/types/typenative.d.ts +42 -12
  149. package/ROUND2-HANDOFF.md +0 -200
@@ -415,6 +415,19 @@ export function registerProcess(r) {
415
415
  return 'TnProcessArgv()';
416
416
  });
417
417
  value('execArgv', '[]string', () => '[]string{}');
418
+ // process itself as a value (let p = process || {}, picocolors'): an
419
+ // object of its common members, read dynamically
420
+ r.values['process'] = (_c) => {
421
+ use();
422
+ r.helper('osPlatform');
423
+ r.helper('dynamic');
424
+ r.pkg('os');
425
+ return 'func() *TnMap[string, interface{}] { __p := TnNewMap[string, interface{}](); __argv := []interface{}{}; for _, __a := range TnProcessArgv() { __argv = append(__argv, __a) }; __p.Set("argv", __argv); ' +
426
+ '__env := TnNewMap[string, interface{}](); __src := TnEnvMap(); for _, __k := range __src.Keys() { __env.Set(__k, __src.Get(__k)) }; __p.Set("env", __env); __p.Set("platform", TnOsPlatform()); ' +
427
+ '__out := TnNewMap[string, interface{}](); if TnIsTTY(os.Stdout) { __out.Set("isTTY", true) }; __p.Set("stdout", __out); ' +
428
+ '__p.Set("emitWarning", func(__w interface{}, __rest ...interface{}) { __t, _ := TnArg(__rest, 0).(string); TnProcessEmitWarning(__w, __t) }); return __p }()';
429
+ };
430
+ r.valueTypes['process'] = '*TnMap[string, interface{}]';
418
431
  value('argv0', 'string', () => {
419
432
  r.pkg('os');
420
433
  return 'os.Args[0]';
@@ -140,7 +140,7 @@ func TnPunycodeDecode(input string) string {
140
140
  return string(out)
141
141
  }
142
142
 
143
- func tnIsASCII(s string) bool {
143
+ func tnPunyIsASCII(s string) bool {
144
144
  for i := 0; i < len(s); i++ {
145
145
  if s[i] >= 0x80 {
146
146
  return false
@@ -161,7 +161,7 @@ func tnMapDomainLabels(domain string, fn func(string) string) string {
161
161
 
162
162
  func TnPunycodeToASCII(domain string) string {
163
163
  return tnMapDomainLabels(domain, func(label string) string {
164
- if tnIsASCII(label) {
164
+ if tnPunyIsASCII(label) {
165
165
  return label
166
166
  }
167
167
  return "xn--" + TnPunycodeEncode(label)
@@ -86,7 +86,7 @@ func tnStreamOption(options interface{}, key string) interface{} {
86
86
  }
87
87
 
88
88
  func tnNewStreamBase(options []interface{}) *TnStream {
89
- s := &TnStream{flowing: -1, decodeStrings: true, hooks: map[string]interface{}{}, asyncCtx: TnAsyncSnapshot()}
89
+ s := &TnStream{flowing: -1, decodeStrings: true, asyncCtx: TnAsyncSnapshot()}
90
90
  if len(options) > 0 && options[0] != nil {
91
91
  s.options = options[0]
92
92
  if b, ok := tnStreamOption(s.options, "objectMode").(bool); ok {
@@ -100,7 +100,7 @@ func tnNewStreamBase(options []interface{}) *TnStream {
100
100
  }
101
101
  for _, name := range []string{"read", "write", "transform", "flush", "final", "destroy"} {
102
102
  if fn := tnStreamOption(s.options, name); fn != nil && reflect.ValueOf(fn).Kind() == reflect.Func && !reflect.ValueOf(fn).IsNil() {
103
- s.hooks["_"+name] = fn
103
+ s.setHook("_"+name, fn)
104
104
  }
105
105
  }
106
106
  }
@@ -229,7 +229,24 @@ func (s *TnStream) flow() {
229
229
  for s.flowing == 1 && len(s.queue) > 0 {
230
230
  chunk := s.queue[0]
231
231
  s.queue = s.queue[1:]
232
- s.emit("data", chunk)
232
+ if s.state == nil {
233
+ if s.fn0 != nil && s.ev0 == "data" {
234
+ if f, ok := s.fn0.(func(interface{})); ok {
235
+ f(chunk)
236
+ } else {
237
+ TnInvoke(s.fn0, chunk)
238
+ }
239
+ }
240
+ if s.fn1 != nil && s.ev1 == "data" {
241
+ if f, ok := s.fn1.(func(interface{})); ok {
242
+ f(chunk)
243
+ } else {
244
+ TnInvoke(s.fn1, chunk)
245
+ }
246
+ }
247
+ } else {
248
+ s.emit("data", chunk)
249
+ }
233
250
  }
234
251
  if len(s.queue) == 0 && s.readEnded {
235
252
  s.emitEnd()
@@ -286,9 +303,31 @@ func (s *TnStream) emitEnd() {
286
303
  return
287
304
  }
288
305
  s.endEmitted = true
289
- s.emit("end")
306
+ if s.state == nil {
307
+ if s.fn0 != nil && s.ev0 == "end" {
308
+ if f, ok := s.fn0.(func()); ok {
309
+ f()
310
+ } else {
311
+ TnInvoke(s.fn0)
312
+ }
313
+ }
314
+ if s.fn1 != nil && s.ev1 == "end" {
315
+ if f, ok := s.fn1.(func()); ok {
316
+ f()
317
+ } else {
318
+ TnInvoke(s.fn1)
319
+ }
320
+ }
321
+ } else {
322
+ s.emit("end")
323
+ }
290
324
  if !s.writableSide || s.finished {
291
- s.emitClose()
325
+ if s.listenerCount("close") == 0 {
326
+ s.closed = true
327
+ s.releaseHandle()
328
+ } else {
329
+ s.emitClose()
330
+ }
292
331
  }
293
332
  }
294
333
 
@@ -592,6 +631,11 @@ func (s *TnStream) processWrites() {
592
631
  }
593
632
  s.post(s.processWrites)
594
633
  }
634
+ if s.sink == nil && s.tnSelf != nil {
635
+ if init, ok := s.tnSelf.(interface{ tnInitSink() }); ok {
636
+ init.tnInitSink()
637
+ }
638
+ }
595
639
  switch {
596
640
  case s.sink != nil:
597
641
  s.sink(req.chunk, func(err interface{}) { done(err) })
@@ -706,6 +750,11 @@ func (s *TnStream) finish() {
706
750
  TnInvoke(fn, complete)
707
751
  return
708
752
  }
753
+ if s.sinkFinal == nil && s.tnSelf != nil {
754
+ if init, ok := s.tnSelf.(interface{ tnInitSink() }); ok {
755
+ init.tnInitSink()
756
+ }
757
+ }
709
758
  if s.sinkFinal != nil {
710
759
  s.sinkFinal(func(err interface{}) { complete(err) })
711
760
  return
@@ -1065,7 +1114,7 @@ func TnStdin() *TnStream {
1065
1114
  }
1066
1115
  }()
1067
1116
  }
1068
- s.hooks["_stdinRef"] = func(flowing bool) {
1117
+ s.setHook("_stdinRef", func(flowing bool) {
1069
1118
  if flowing && !refHeld && !s.readEnded {
1070
1119
  refHeld = true
1071
1120
  TnLoopRef()
@@ -1073,7 +1122,7 @@ func TnStdin() *TnStream {
1073
1122
  refHeld = false
1074
1123
  TnLoopUnref()
1075
1124
  }
1076
- }
1125
+ })
1077
1126
  return s
1078
1127
  }`;
1079
1128
  const fileStreamHelper = `// fs.createReadStream / createWriteStream
@@ -1758,7 +1758,7 @@ func TnDuplexFromWeb(pair interface{}, options ...interface{}) *TnStream {
1758
1758
  r.on("data", func(chunk interface{}) { d.push(chunk) })
1759
1759
  r.TnEventEmitter.once("end", func() { d.push(nil) })
1760
1760
  r.TnEventEmitter.once("error", func(err interface{}) { d.destroy(err) })
1761
- d.hooks["_read"] = func(size float64) {}
1761
+ d.setHook("_read", func(size float64) {})
1762
1762
  return d
1763
1763
  }
1764
1764
 
@@ -1804,7 +1804,7 @@ func TnCompose(streams ...interface{}) *TnStream {
1804
1804
  }
1805
1805
  }
1806
1806
  if last.readableSide {
1807
- d.hooks["_read"] = func(size float64) {}
1807
+ d.setHook("_read", func(size float64) {})
1808
1808
  last.on("data", func(chunk interface{}) { d.push(chunk) })
1809
1809
  last.TnEventEmitter.once("end", func() { d.push(nil) })
1810
1810
  }
@@ -242,8 +242,10 @@ export function registerTimers(r) {
242
242
  r.results[`perf_hooks.performance.${name}`] = result;
243
243
  };
244
244
  perf('now', 'float64', (_c) => 'TnPerfNow()');
245
- perf('mark', '*TnPerformanceEntry', (c) => `TnPerfMark(${c.args.join(', ')})`);
246
- perf('measure', '*TnPerformanceEntry', (c) => `TnPerfMeasure(${c.args.join(', ')})`);
245
+ // (the name of an any value: its string)
246
+ const named = (c) => [c.types[0] === 'string' ? c.args[0] : `TnJSString(${c.args[0]})`, ...c.args.slice(1)].join(', ');
247
+ perf('mark', '*TnPerformanceEntry', (c) => `TnPerfMark(${named(c)})`);
248
+ perf('measure', '*TnPerformanceEntry', (c) => `TnPerfMeasure(${named(c)})`);
247
249
  perf('getEntries', '[]*TnPerformanceEntry', (_c) => 'TnPerfEntries("", "")');
248
250
  perf('getEntriesByName', '[]*TnPerformanceEntry', (c) => `TnPerfEntries(${c.args[0]}, ${c.args[1] ?? '""'})`);
249
251
  perf('getEntriesByType', '[]*TnPerformanceEntry', (c) => `TnPerfEntries("", ${c.args[0]})`);
package/bin/node/url.js CHANGED
@@ -44,7 +44,19 @@ func tnInvalidURL(input string) *TnError {
44
44
 
45
45
  // Percent-encodes the bytes of s that are in the set (C0 controls and non-ASCII always)
46
46
  func tnPercentEncode(s string, set string) string {
47
+ need := false
48
+ for i := 0; i < len(s); i++ {
49
+ c := s[i]
50
+ if c < 0x20 || c > 0x7E || strings.IndexByte(set, c) >= 0 {
51
+ need = true
52
+ break
53
+ }
54
+ }
55
+ if !need {
56
+ return s
57
+ }
47
58
  var sb strings.Builder
59
+ sb.Grow(len(s) + 8)
48
60
  for i := 0; i < len(s); i++ {
49
61
  c := s[i]
50
62
  if c < 0x20 || c > 0x7E || strings.IndexByte(set, c) >= 0 {
@@ -69,6 +81,9 @@ func (u *TnURL) special() bool {
69
81
 
70
82
  // RFC 3986 remove_dot_segments on a "/"-separated path
71
83
  func tnRemoveDotSegments(path string) string {
84
+ if strings.IndexByte(path, '.') < 0 && strings.IndexByte(path, '%') < 0 {
85
+ return path
86
+ }
72
87
  segments := strings.Split(path, "/")
73
88
  out := []string{}
74
89
  for i, seg := range segments {
@@ -113,7 +128,7 @@ func tnParseHost(host string, special bool) (string, bool) {
113
128
  host = decoded
114
129
  }
115
130
  host = strings.ToLower(host)
116
- if !tnIsASCII(host) {
131
+ if !tnPunyIsASCII(host) {
117
132
  host = TnPunycodeToASCII(host)
118
133
  }
119
134
  if strings.ContainsAny(host, " #%/:<>?@[\\\\]^|") {
@@ -228,7 +243,9 @@ func tnCopyURL(b *TnURL) *TnURL {
228
243
  }
229
244
 
230
245
  func tnParseURLString(input string, base *TnURL) (*TnURL, bool) {
231
- input = strings.TrimFunc(input, func(r rune) bool { return r <= 0x20 })
246
+ if len(input) > 0 && (input[0] <= 0x20 || input[len(input)-1] <= 0x20) {
247
+ input = strings.TrimFunc(input, func(r rune) bool { return r <= 0x20 })
248
+ }
232
249
  if strings.ContainsAny(input, "\\t\\n\\r") {
233
250
  input = tnURLStrip.Replace(input)
234
251
  }
@@ -347,6 +364,8 @@ func tnResolveRelative(input string, query string, hasQuery bool, fragment strin
347
364
  return u, true
348
365
  }
349
366
 
367
+ var tnURLBaseCache sync.Map
368
+
350
369
  func tnURLBase(base []interface{}) (*TnURL, bool, string) {
351
370
  if len(base) == 0 || base[0] == nil {
352
371
  return nil, true, ""
@@ -355,7 +374,13 @@ func tnURLBase(base []interface{}) (*TnURL, bool, string) {
355
374
  case *TnURL:
356
375
  return b, true, ""
357
376
  case string:
377
+ if cached, ok := tnURLBaseCache.Load(b); ok {
378
+ return cached.(*TnURL), true, b
379
+ }
358
380
  parsed, ok := tnParseURLString(b, nil)
381
+ if ok && len(b) <= 128 {
382
+ tnURLBaseCache.Store(b, parsed)
383
+ }
359
384
  return parsed, ok, b
360
385
  }
361
386
  s := fmt.Sprint(base[0])
@@ -827,7 +852,7 @@ func TnDomainToUnicode(domain string) string {
827
852
  }`;
828
853
  export function registerUrl(r) {
829
854
  defineModule(r, 'url');
830
- defineHelper(r, 'nodeUrl', ['encoding/hex', 'fmt', 'net/url', 'path/filepath', 'reflect', 'runtime', 'sort', 'strconv', 'strings', 'unicode/utf16', 'unsafe'], ['error', 'dynamic', 'punycode', 'pathToFileURL', 'nodeInvoke'], urlHelper);
855
+ defineHelper(r, 'nodeUrl', ['encoding/hex', 'fmt', 'net/url', 'path/filepath', 'reflect', 'runtime', 'sort', 'strconv', 'strings', 'sync', 'unicode/utf16', 'unsafe'], ['error', 'dynamic', 'punycode', 'pathToFileURL', 'nodeInvoke'], urlHelper);
831
856
  defineClass(r, 'url.URL', '*TnURL', 'class', 'toString=string; toJSON=string', '', 'href=string; protocol=string; username=string; password=string; host=string; hostname=string; port=string; pathname=string; search=string; hash=string; origin=string; searchParams=*TnURLSearchParams', 'href; protocol; username; password; host; hostname; port; pathname; search; hash');
832
857
  defineClass(r, 'url.URLSearchParams', '*TnURLSearchParams', 'class', 'append=; set=; delete=; get=*string; getAll=[]string; has=bool; sort=; toString=string; keys=[]string; values=[]string; entries=[][]string; forEach=', '', 'size=float64', '');
833
858
  r.iterators['*TnURLSearchParams'] = 'entries';
package/bin/parse-node.js CHANGED
@@ -133,8 +133,8 @@ function convertNode(node) {
133
133
  // Parse TypeScript source into the normalized JSON AST shape.
134
134
  export function parseAstJson(code, tsx) {
135
135
  const sourceFile = tsx
136
- ? ts.createSourceFile('main.tsx', code, ts.ScriptTarget.ES2020, true, ts.ScriptKind.TSX)
137
- : ts.createSourceFile('main.ts', code, ts.ScriptTarget.ES2020, true, ts.ScriptKind.TS);
136
+ ? ts.createSourceFile('main.tsx', code, ts.ScriptTarget.ES2025, true, ts.ScriptKind.TSX)
137
+ : ts.createSourceFile('main.ts', code, ts.ScriptTarget.ES2025, true, ts.ScriptKind.TS);
138
138
  currentSourceFile = sourceFile;
139
139
  return convertNode(sourceFile);
140
140
  }