typenative 0.3.0 → 0.3.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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.3.1] - 2026-10-18
11
+
12
+ ### Fixed
13
+
14
+ - `node:tls` on macOS: an untrusted certificate chain reports Node's codes
15
+ (`DEPTH_ZERO_SELF_SIGNED_CERT`, `SELF_SIGNED_CERT_IN_CHAIN`,
16
+ `UNABLE_TO_GET_ISSUER_CERT_LOCALLY`) like on other platforms; the platform verifier returns
17
+ a plain error, not `UnknownAuthorityError`
18
+ - `go build` runs with `-trimpath`, so vendored packages (the ~5 MB sqlite driver) are cached
19
+ once instead of recompiled for every project directory, and builds are reproducible
20
+ - `conformance-parallel.mjs` builds one sqlite probe first so a cold cache doesn't time out
21
+ every sqlite probe at once on small runners; the `node:sqlite` `location()` probe compares
22
+ canonical paths (symlinks, Windows 8.3 short names)
23
+
10
24
  ## [0.3.0] - 2026-10-18
11
25
 
12
26
  Errors now point at your TypeScript. Programs are type-checked before they're transpiled, code
package/bin/index.js CHANGED
@@ -233,6 +233,9 @@ export function run(opts) {
233
233
  'build',
234
234
  '-C',
235
235
  'dist',
236
+ // Path-independent cache keys: the vendored packages (sqlite is ~5 MB
237
+ // of Go) compile once, not again for every project directory
238
+ '-trimpath',
236
239
  '-o',
237
240
  exeName,
238
241
  ...goFiles.map((f) => f.slice('dist/'.length))
package/bin/node/tls.js CHANGED
@@ -167,7 +167,9 @@ func tnVerifyPeer(certs []*x509.Certificate, roots *x509.CertPool, host string)
167
167
  return TnNodeError("Error", "CERT_NOT_YET_VALID", "certificate is not yet valid")
168
168
  }
169
169
  return TnNodeError("Error", "CERT_HAS_EXPIRED", "certificate has expired")
170
- case errors.As(err, &unknown):
170
+ // macOS's platform verifier (nil roots) reports an untrusted chain as a
171
+ // plain error, not UnknownAuthorityError
172
+ case errors.As(err, &unknown) || roots == nil:
171
173
  if len(certs) == 1 && bytes.Equal(leaf.RawIssuer, leaf.RawSubject) {
172
174
  return TnNodeError("Error", "DEPTH_ZERO_SELF_SIGNED_CERT", "self-signed certificate")
173
175
  }
package/bin/transpiler.js CHANGED
@@ -8422,7 +8422,7 @@ function platformHelper(id) {
8422
8422
  return id;
8423
8423
  const base = id.slice(0, id.length - 3);
8424
8424
  const specific = `${base}@${targetGoos}`;
8425
- return goHelpers[specific] !== undefined || nodeRegistry.goHelpers[specific] !== undefined ? specific : `${base}@other`;
8425
+ return specific in goHelpers || specific in nodeRegistry.goHelpers ? specific : `${base}@other`;
8426
8426
  }
8427
8427
  function useHelper(id) {
8428
8428
  if (usedHelpers.has(id))
@@ -8529,7 +8529,7 @@ const helperPackages = {
8529
8529
  namedGroups: ['regexp'],
8530
8530
  moduleUrl: ['os'],
8531
8531
  asyncWait: [],
8532
- timerWait: ['sync', 'sync/atomic', 'time'],
8532
+ timerWait: ['sort', 'sync', 'sync/atomic', 'time'],
8533
8533
  clock: ['time'],
8534
8534
  eventLoop: ['sync', 'sync/atomic', 'time'],
8535
8535
  uri: ['strings', 'fmt', 'net/url'],
@@ -10775,7 +10775,46 @@ type TnTimeout struct {
10775
10775
  fn func()
10776
10776
  refd bool
10777
10777
  active bool
10778
- gen int
10778
+ due time.Time
10779
+ seq int
10780
+ }
10781
+
10782
+ // Armed timers, owned by the baton holder. An expired timer's goroutine only
10783
+ // wakes the loop, which then runs every due timer in deadline order: timer
10784
+ // goroutines that expire together (a starved loop, a coarse OS clock) may post
10785
+ // in any order, but Node fires timers in deadline order.
10786
+ var __tnPendingTimers = map[*TnTimeout]struct{}{}
10787
+ var __tnTimerSeq int
10788
+
10789
+ func tnRunDueTimers() {
10790
+ now := time.Now()
10791
+ var due []*TnTimeout
10792
+ for t := range __tnPendingTimers {
10793
+ if !t.active {
10794
+ delete(__tnPendingTimers, t)
10795
+ } else if !t.due.After(now) {
10796
+ due = append(due, t)
10797
+ }
10798
+ }
10799
+ sort.Slice(due, func(i, j int) bool {
10800
+ if !due[i].due.Equal(due[j].due) {
10801
+ return due[i].due.Before(due[j].due)
10802
+ }
10803
+ return due[i].seq < due[j].seq
10804
+ })
10805
+ for _, t := range due {
10806
+ // An earlier callback may have cleared or refreshed it
10807
+ if !t.active || t.due.After(now) {
10808
+ continue
10809
+ }
10810
+ delete(__tnPendingTimers, t)
10811
+ t.active = false
10812
+ if t.refd {
10813
+ t.refd = false
10814
+ __tnTimers.Done()
10815
+ }
10816
+ t.fn()
10817
+ }
10779
10818
  }
10780
10819
 
10781
10820
  // node:test mock timers: when set (and the API is mocked) it takes over a timer;
@@ -10804,21 +10843,12 @@ func tnSetTimeout(kind string, ms float64, fn func()) *TnTimeout {
10804
10843
  }
10805
10844
 
10806
10845
  func (t *TnTimeout) arm() {
10807
- t.gen++
10808
- gen := t.gen
10809
- t.timer = time.AfterFunc(time.Duration(t.ms*float64(time.Millisecond)), func() {
10810
- TnLoopPost(func() {
10811
- if !t.active || gen != t.gen {
10812
- return
10813
- }
10814
- t.active = false
10815
- if t.refd {
10816
- t.refd = false
10817
- __tnTimers.Done()
10818
- }
10819
- t.fn()
10820
- })
10821
- })
10846
+ __tnTimerSeq++
10847
+ t.seq = __tnTimerSeq
10848
+ d := time.Duration(t.ms * float64(time.Millisecond))
10849
+ t.due = time.Now().Add(d)
10850
+ __tnPendingTimers[t] = struct{}{}
10851
+ t.timer = time.AfterFunc(d, func() { TnLoopPost(tnRunDueTimers) })
10822
10852
  }
10823
10853
 
10824
10854
  func (t *TnTimeout) ref() *TnTimeout {
@@ -10958,6 +10988,7 @@ func (t *TnInterval) close() *TnInterval {
10958
10988
  func TnClearTimeout(t *TnTimeout) {
10959
10989
  if t != nil && t.active {
10960
10990
  t.active = false
10991
+ delete(__tnPendingTimers, t)
10961
10992
  if t.timer != nil {
10962
10993
  t.timer.Stop()
10963
10994
  }
package/bin/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by scripts/gen-version.mjs — do not edit.
2
- export const VERSION = '0.3.0';
2
+ export const VERSION = '0.3.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typenative",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Build native applications using Typescript.",
5
5
  "type": "module",
6
6
  "bin": {