Back to Tsx

Gate reference

notes/node/gate-reference.md

4.23.14.1 KB
Original Source

Gate reference

Smaller Node gates that tsx forwards or mirrors, but that do not need a full mechanism story.

GateSection
importAttributesImport attributes
importMetaPathPropertiesimport.meta path properties
wasmModulesWASM modules
modulePackageMainResolutionlegacyMainResolve assertion fix
cliTestFlag--test flag
testRunnerGlobTest runner glob

Import attributes (importAttributes)

  • What: import … with { type: 'json' } (import attributes), succeeding the earlier assert { … } assertions syntax. The load path aliases legacy assertions into attributes at v20.10.0 load.js#L116-L124, and validation checks the type attribute in assert.js#L57-L80.
  • Verified: v18.19.0, v20.10.0, v21.0.0.
  • tsx: src/esm/hook/load.ts picks the importAttributes vs legacy importAssertions context property accordingly.

import.meta path properties (importMetaPathProperties)

WASM modules (wasmModules)

legacyMainResolve assertion fix (modulePackageMainResolution)

  • What: an assertion in package main resolution (legacyMainResolve) threw on certain inputs; fixed for the 18.x line. The resolver entry is v18.20.4 resolve.js#L176, called from package resolution at resolve.js#L903. v18.20.5 keeps the same public shape (resolve.js#L176, resolve.js#L903) but fixes the internal assertion; newer lines never had the broken assertion.
  • PR: nodejs/node#55708
  • Verified: v18.20.5 only; 19+ treated as supported because they never carried the bug.
  • tsx: modulePackageMainResolution gate.

--test flag (cliTestFlag)

  • What: built-in test runner CLI flag.
  • Reference: v18.1.0 CLI docs.
  • Verified: v18.1.0.
  • tsx: forwards --test only where supported.

Test runner glob (testRunnerGlob)

  • What: built-in test runner accepts glob patterns for test selection.
  • Reference: v21.0.0 release.
  • Verified: v21.0.0.
  • tsx: forwards glob-style test args only where supported.