@nubjs/nub-linux-x64 0.0.5 → 0.0.8

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 (375) hide show
  1. package/bin/nub +0 -0
  2. package/package.json +1 -1
  3. package/runtime/addons/nub-native.node +0 -0
  4. package/runtime/cache-evict.mjs +69 -0
  5. package/runtime/node_modules/@js-temporal/polyfill/CHANGELOG.md +453 -0
  6. package/runtime/node_modules/@js-temporal/polyfill/LICENSE +13 -0
  7. package/runtime/node_modules/@js-temporal/polyfill/README.md +90 -0
  8. package/runtime/node_modules/@js-temporal/polyfill/dist/index.cjs +2 -0
  9. package/runtime/node_modules/@js-temporal/polyfill/dist/index.cjs.map +1 -0
  10. package/runtime/node_modules/@js-temporal/polyfill/dist/index.esm.js +2 -0
  11. package/runtime/node_modules/@js-temporal/polyfill/dist/index.esm.js.map +1 -0
  12. package/runtime/node_modules/@js-temporal/polyfill/dist/index.umd.js +2 -0
  13. package/runtime/node_modules/@js-temporal/polyfill/dist/index.umd.js.map +1 -0
  14. package/runtime/node_modules/@js-temporal/polyfill/index.d.cts +1215 -0
  15. package/runtime/node_modules/@js-temporal/polyfill/index.d.ts +1215 -0
  16. package/runtime/node_modules/@js-temporal/polyfill/lib/assert.ts +8 -0
  17. package/runtime/node_modules/@js-temporal/polyfill/lib/bigintmath.ts +39 -0
  18. package/runtime/node_modules/@js-temporal/polyfill/lib/calendar.ts +2424 -0
  19. package/runtime/node_modules/@js-temporal/polyfill/lib/debug.ts +7 -0
  20. package/runtime/node_modules/@js-temporal/polyfill/lib/duration.ts +438 -0
  21. package/runtime/node_modules/@js-temporal/polyfill/lib/durationformat.d.ts +93 -0
  22. package/runtime/node_modules/@js-temporal/polyfill/lib/ecmascript.ts +4973 -0
  23. package/runtime/node_modules/@js-temporal/polyfill/lib/index.ts +34 -0
  24. package/runtime/node_modules/@js-temporal/polyfill/lib/init.ts +43 -0
  25. package/runtime/node_modules/@js-temporal/polyfill/lib/instant.ts +138 -0
  26. package/runtime/node_modules/@js-temporal/polyfill/lib/internaltypes.d.ts +242 -0
  27. package/runtime/node_modules/@js-temporal/polyfill/lib/intl.ts +758 -0
  28. package/runtime/node_modules/@js-temporal/polyfill/lib/intrinsicclass.ts +162 -0
  29. package/runtime/node_modules/@js-temporal/polyfill/lib/legacydate.ts +17 -0
  30. package/runtime/node_modules/@js-temporal/polyfill/lib/math.ts +96 -0
  31. package/runtime/node_modules/@js-temporal/polyfill/lib/now.ts +48 -0
  32. package/runtime/node_modules/@js-temporal/polyfill/lib/plaindate.ts +212 -0
  33. package/runtime/node_modules/@js-temporal/polyfill/lib/plaindatetime.ts +274 -0
  34. package/runtime/node_modules/@js-temporal/polyfill/lib/plainmonthday.ts +110 -0
  35. package/runtime/node_modules/@js-temporal/polyfill/lib/plaintime.ts +154 -0
  36. package/runtime/node_modules/@js-temporal/polyfill/lib/plainyearmonth.ts +157 -0
  37. package/runtime/node_modules/@js-temporal/polyfill/lib/regex.ts +59 -0
  38. package/runtime/node_modules/@js-temporal/polyfill/lib/slots.ts +341 -0
  39. package/runtime/node_modules/@js-temporal/polyfill/lib/temporal.ts +10 -0
  40. package/runtime/node_modules/@js-temporal/polyfill/lib/timeduration.ts +149 -0
  41. package/runtime/node_modules/@js-temporal/polyfill/lib/zoneddatetime.ts +492 -0
  42. package/runtime/node_modules/@js-temporal/polyfill/package.json +143 -0
  43. package/runtime/node_modules/@oxc-parser/binding-linux-x64-gnu/README.md +3 -0
  44. package/runtime/node_modules/@oxc-parser/binding-linux-x64-gnu/package.json +42 -0
  45. package/runtime/node_modules/@oxc-parser/binding-linux-x64-gnu/parser.linux-x64-gnu.node +0 -0
  46. package/runtime/node_modules/@oxc-project/runtime/CHANGELOG.md +88 -0
  47. package/runtime/node_modules/@oxc-project/runtime/LICENSE +22 -0
  48. package/runtime/node_modules/@oxc-project/runtime/README.md +5 -0
  49. package/runtime/node_modules/@oxc-project/runtime/package.json +1066 -0
  50. package/runtime/node_modules/@oxc-project/runtime/src/helpers/AwaitValue.js +4 -0
  51. package/runtime/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js +4 -0
  52. package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecoratedDescriptor.js +9 -0
  53. package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecs.js +236 -0
  54. package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecs2203.js +184 -0
  55. package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecs2203R.js +191 -0
  56. package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecs2301.js +222 -0
  57. package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecs2305.js +133 -0
  58. package/runtime/node_modules/@oxc-project/runtime/src/helpers/applyDecs2311.js +124 -0
  59. package/runtime/node_modules/@oxc-project/runtime/src/helpers/arrayLikeToArray.js +6 -0
  60. package/runtime/node_modules/@oxc-project/runtime/src/helpers/arrayWithHoles.js +4 -0
  61. package/runtime/node_modules/@oxc-project/runtime/src/helpers/arrayWithoutHoles.js +5 -0
  62. package/runtime/node_modules/@oxc-project/runtime/src/helpers/assertClassBrand.js +5 -0
  63. package/runtime/node_modules/@oxc-project/runtime/src/helpers/assertThisInitialized.js +5 -0
  64. package/runtime/node_modules/@oxc-project/runtime/src/helpers/asyncGeneratorDelegate.js +24 -0
  65. package/runtime/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js +45 -0
  66. package/runtime/node_modules/@oxc-project/runtime/src/helpers/asyncToGenerator.js +26 -0
  67. package/runtime/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js +5 -0
  68. package/runtime/node_modules/@oxc-project/runtime/src/helpers/callSuper.js +7 -0
  69. package/runtime/node_modules/@oxc-project/runtime/src/helpers/checkInRHS.js +6 -0
  70. package/runtime/node_modules/@oxc-project/runtime/src/helpers/checkPrivateRedeclaration.js +4 -0
  71. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classApplyDescriptorDestructureSet.js +10 -0
  72. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classApplyDescriptorGet.js +4 -0
  73. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classApplyDescriptorSet.js +7 -0
  74. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classCallCheck.js +4 -0
  75. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classCheckPrivateStaticAccess.js +5 -0
  76. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classCheckPrivateStaticFieldDescriptor.js +4 -0
  77. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classExtractFieldDescriptor.js +5 -0
  78. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classNameTDZError.js +4 -0
  79. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldDestructureSet.js +7 -0
  80. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldGet.js +7 -0
  81. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldGet2.js +5 -0
  82. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldInitSpec.js +5 -0
  83. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldLooseBase.js +5 -0
  84. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldLooseKey.js +5 -0
  85. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldSet.js +7 -0
  86. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateFieldSet2.js +5 -0
  87. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateGetter.js +5 -0
  88. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateMethodGet.js +5 -0
  89. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateMethodInitSpec.js +5 -0
  90. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateMethodSet.js +4 -0
  91. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classPrivateSetter.js +5 -0
  92. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classStaticPrivateFieldDestructureSet.js +7 -0
  93. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classStaticPrivateFieldSpecGet.js +7 -0
  94. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classStaticPrivateFieldSpecSet.js +7 -0
  95. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classStaticPrivateMethodGet.js +5 -0
  96. package/runtime/node_modules/@oxc-project/runtime/src/helpers/classStaticPrivateMethodSet.js +4 -0
  97. package/runtime/node_modules/@oxc-project/runtime/src/helpers/construct.js +10 -0
  98. package/runtime/node_modules/@oxc-project/runtime/src/helpers/createClass.js +13 -0
  99. package/runtime/node_modules/@oxc-project/runtime/src/helpers/createForOfIteratorHelper.js +50 -0
  100. package/runtime/node_modules/@oxc-project/runtime/src/helpers/createForOfIteratorHelperLoose.js +19 -0
  101. package/runtime/node_modules/@oxc-project/runtime/src/helpers/createSuper.js +16 -0
  102. package/runtime/node_modules/@oxc-project/runtime/src/helpers/decorate.js +23 -0
  103. package/runtime/node_modules/@oxc-project/runtime/src/helpers/decorateMetadata.js +9 -0
  104. package/runtime/node_modules/@oxc-project/runtime/src/helpers/decorateParam.js +11 -0
  105. package/runtime/node_modules/@oxc-project/runtime/src/helpers/defaults.js +9 -0
  106. package/runtime/node_modules/@oxc-project/runtime/src/helpers/defineAccessor.js +8 -0
  107. package/runtime/node_modules/@oxc-project/runtime/src/helpers/defineEnumerableProperties.js +12 -0
  108. package/runtime/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js +10 -0
  109. package/runtime/node_modules/@oxc-project/runtime/src/helpers/dispose.js +28 -0
  110. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/AwaitValue.js +4 -0
  111. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/OverloadYield.js +4 -0
  112. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecoratedDescriptor.js +9 -0
  113. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecs.js +236 -0
  114. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecs2203.js +184 -0
  115. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecs2203R.js +191 -0
  116. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecs2301.js +222 -0
  117. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecs2305.js +133 -0
  118. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/applyDecs2311.js +124 -0
  119. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/arrayLikeToArray.js +6 -0
  120. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/arrayWithHoles.js +4 -0
  121. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/arrayWithoutHoles.js +5 -0
  122. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/assertClassBrand.js +5 -0
  123. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/assertThisInitialized.js +5 -0
  124. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/asyncGeneratorDelegate.js +24 -0
  125. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/asyncIterator.js +45 -0
  126. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/asyncToGenerator.js +26 -0
  127. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/awaitAsyncGenerator.js +5 -0
  128. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/callSuper.js +7 -0
  129. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/checkInRHS.js +6 -0
  130. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/checkPrivateRedeclaration.js +4 -0
  131. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classApplyDescriptorDestructureSet.js +10 -0
  132. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classApplyDescriptorGet.js +4 -0
  133. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classApplyDescriptorSet.js +7 -0
  134. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classCallCheck.js +4 -0
  135. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classCheckPrivateStaticAccess.js +5 -0
  136. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classCheckPrivateStaticFieldDescriptor.js +4 -0
  137. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classExtractFieldDescriptor.js +5 -0
  138. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classNameTDZError.js +4 -0
  139. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldDestructureSet.js +7 -0
  140. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldGet.js +7 -0
  141. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldGet2.js +5 -0
  142. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldInitSpec.js +5 -0
  143. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldLooseBase.js +5 -0
  144. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldLooseKey.js +5 -0
  145. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldSet.js +7 -0
  146. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateFieldSet2.js +5 -0
  147. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateGetter.js +5 -0
  148. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateMethodGet.js +5 -0
  149. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateMethodInitSpec.js +5 -0
  150. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateMethodSet.js +4 -0
  151. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classPrivateSetter.js +5 -0
  152. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classStaticPrivateFieldDestructureSet.js +7 -0
  153. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classStaticPrivateFieldSpecGet.js +7 -0
  154. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classStaticPrivateFieldSpecSet.js +7 -0
  155. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classStaticPrivateMethodGet.js +5 -0
  156. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/classStaticPrivateMethodSet.js +4 -0
  157. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/construct.js +10 -0
  158. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/createClass.js +13 -0
  159. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/createForOfIteratorHelper.js +50 -0
  160. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/createForOfIteratorHelperLoose.js +19 -0
  161. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/createSuper.js +16 -0
  162. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/decorate.js +21 -0
  163. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/decorateMetadata.js +7 -0
  164. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/decorateParam.js +9 -0
  165. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/defaults.js +9 -0
  166. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/defineAccessor.js +8 -0
  167. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/defineEnumerableProperties.js +12 -0
  168. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/defineProperty.js +10 -0
  169. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/dispose.js +28 -0
  170. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/extends.js +10 -0
  171. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/get.js +11 -0
  172. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/getPrototypeOf.js +6 -0
  173. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/identity.js +4 -0
  174. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/importDeferProxy.js +27 -0
  175. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/inherits.js +14 -0
  176. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/inheritsLoose.js +5 -0
  177. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/initializerDefineProperty.js +9 -0
  178. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/initializerWarningHelper.js +4 -0
  179. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/instanceof.js +4 -0
  180. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/interopRequireDefault.js +6 -0
  181. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/interopRequireWildcard.js +27 -0
  182. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/isNativeFunction.js +8 -0
  183. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/isNativeReflectConstruct.js +9 -0
  184. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/iterableToArray.js +4 -0
  185. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/iterableToArrayLimit.js +28 -0
  186. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/jsx.js +22 -0
  187. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/maybeArrayLike.js +9 -0
  188. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/newArrowCheck.js +4 -0
  189. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/nonIterableRest.js +4 -0
  190. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/nonIterableSpread.js +4 -0
  191. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/nullishReceiverError.js +4 -0
  192. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/objectDestructuringEmpty.js +4 -0
  193. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/objectSpread.js +14 -0
  194. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/objectSpread2.js +23 -0
  195. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/objectWithoutProperties.js +13 -0
  196. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/objectWithoutPropertiesLoose.js +10 -0
  197. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/package.json +3 -0
  198. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/possibleConstructorReturn.js +8 -0
  199. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/readOnlyError.js +4 -0
  200. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/regeneratorRuntime.js +304 -0
  201. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/set.js +22 -0
  202. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/setFunctionName.js +12 -0
  203. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/setPrototypeOf.js +6 -0
  204. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/skipFirstGeneratorNext.js +7 -0
  205. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/slicedToArray.js +8 -0
  206. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/superPropBase.js +6 -0
  207. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/superPropGet.js +9 -0
  208. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/superPropSet.js +6 -0
  209. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/taggedTemplateLiteral.js +8 -0
  210. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/taggedTemplateLiteralLoose.js +4 -0
  211. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/tdz.js +4 -0
  212. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/temporalRef.js +6 -0
  213. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/temporalUndefined.js +2 -0
  214. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/toArray.js +8 -0
  215. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/toConsumableArray.js +8 -0
  216. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/toPrimitive.js +12 -0
  217. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/toPropertyKey.js +7 -0
  218. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/toSetter.js +10 -0
  219. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/typeof.js +10 -0
  220. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/unsupportedIterableToArray.js +9 -0
  221. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/using.js +12 -0
  222. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/usingCtx.js +59 -0
  223. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/wrapAsyncGenerator.js +69 -0
  224. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/wrapNativeSuper.js +27 -0
  225. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/wrapRegExp.js +51 -0
  226. package/runtime/node_modules/@oxc-project/runtime/src/helpers/esm/writeOnlyError.js +4 -0
  227. package/runtime/node_modules/@oxc-project/runtime/src/helpers/extends.js +10 -0
  228. package/runtime/node_modules/@oxc-project/runtime/src/helpers/get.js +11 -0
  229. package/runtime/node_modules/@oxc-project/runtime/src/helpers/getPrototypeOf.js +6 -0
  230. package/runtime/node_modules/@oxc-project/runtime/src/helpers/identity.js +4 -0
  231. package/runtime/node_modules/@oxc-project/runtime/src/helpers/importDeferProxy.js +27 -0
  232. package/runtime/node_modules/@oxc-project/runtime/src/helpers/inherits.js +14 -0
  233. package/runtime/node_modules/@oxc-project/runtime/src/helpers/inheritsLoose.js +5 -0
  234. package/runtime/node_modules/@oxc-project/runtime/src/helpers/initializerDefineProperty.js +9 -0
  235. package/runtime/node_modules/@oxc-project/runtime/src/helpers/initializerWarningHelper.js +4 -0
  236. package/runtime/node_modules/@oxc-project/runtime/src/helpers/instanceof.js +4 -0
  237. package/runtime/node_modules/@oxc-project/runtime/src/helpers/interopRequireDefault.js +6 -0
  238. package/runtime/node_modules/@oxc-project/runtime/src/helpers/interopRequireWildcard.js +27 -0
  239. package/runtime/node_modules/@oxc-project/runtime/src/helpers/isNativeFunction.js +8 -0
  240. package/runtime/node_modules/@oxc-project/runtime/src/helpers/isNativeReflectConstruct.js +9 -0
  241. package/runtime/node_modules/@oxc-project/runtime/src/helpers/iterableToArray.js +4 -0
  242. package/runtime/node_modules/@oxc-project/runtime/src/helpers/iterableToArrayLimit.js +28 -0
  243. package/runtime/node_modules/@oxc-project/runtime/src/helpers/jsx.js +22 -0
  244. package/runtime/node_modules/@oxc-project/runtime/src/helpers/maybeArrayLike.js +9 -0
  245. package/runtime/node_modules/@oxc-project/runtime/src/helpers/newArrowCheck.js +4 -0
  246. package/runtime/node_modules/@oxc-project/runtime/src/helpers/nonIterableRest.js +4 -0
  247. package/runtime/node_modules/@oxc-project/runtime/src/helpers/nonIterableSpread.js +4 -0
  248. package/runtime/node_modules/@oxc-project/runtime/src/helpers/nullishReceiverError.js +4 -0
  249. package/runtime/node_modules/@oxc-project/runtime/src/helpers/objectDestructuringEmpty.js +4 -0
  250. package/runtime/node_modules/@oxc-project/runtime/src/helpers/objectSpread.js +14 -0
  251. package/runtime/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js +23 -0
  252. package/runtime/node_modules/@oxc-project/runtime/src/helpers/objectWithoutProperties.js +13 -0
  253. package/runtime/node_modules/@oxc-project/runtime/src/helpers/objectWithoutPropertiesLoose.js +10 -0
  254. package/runtime/node_modules/@oxc-project/runtime/src/helpers/possibleConstructorReturn.js +8 -0
  255. package/runtime/node_modules/@oxc-project/runtime/src/helpers/readOnlyError.js +4 -0
  256. package/runtime/node_modules/@oxc-project/runtime/src/helpers/regeneratorRuntime.js +304 -0
  257. package/runtime/node_modules/@oxc-project/runtime/src/helpers/set.js +22 -0
  258. package/runtime/node_modules/@oxc-project/runtime/src/helpers/setFunctionName.js +12 -0
  259. package/runtime/node_modules/@oxc-project/runtime/src/helpers/setPrototypeOf.js +6 -0
  260. package/runtime/node_modules/@oxc-project/runtime/src/helpers/skipFirstGeneratorNext.js +7 -0
  261. package/runtime/node_modules/@oxc-project/runtime/src/helpers/slicedToArray.js +8 -0
  262. package/runtime/node_modules/@oxc-project/runtime/src/helpers/superPropBase.js +6 -0
  263. package/runtime/node_modules/@oxc-project/runtime/src/helpers/superPropGet.js +9 -0
  264. package/runtime/node_modules/@oxc-project/runtime/src/helpers/superPropSet.js +6 -0
  265. package/runtime/node_modules/@oxc-project/runtime/src/helpers/taggedTemplateLiteral.js +8 -0
  266. package/runtime/node_modules/@oxc-project/runtime/src/helpers/taggedTemplateLiteralLoose.js +4 -0
  267. package/runtime/node_modules/@oxc-project/runtime/src/helpers/tdz.js +4 -0
  268. package/runtime/node_modules/@oxc-project/runtime/src/helpers/temporalRef.js +6 -0
  269. package/runtime/node_modules/@oxc-project/runtime/src/helpers/temporalUndefined.js +2 -0
  270. package/runtime/node_modules/@oxc-project/runtime/src/helpers/toArray.js +8 -0
  271. package/runtime/node_modules/@oxc-project/runtime/src/helpers/toConsumableArray.js +8 -0
  272. package/runtime/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js +12 -0
  273. package/runtime/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js +7 -0
  274. package/runtime/node_modules/@oxc-project/runtime/src/helpers/toSetter.js +10 -0
  275. package/runtime/node_modules/@oxc-project/runtime/src/helpers/typeof.js +10 -0
  276. package/runtime/node_modules/@oxc-project/runtime/src/helpers/unsupportedIterableToArray.js +9 -0
  277. package/runtime/node_modules/@oxc-project/runtime/src/helpers/using.js +12 -0
  278. package/runtime/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js +59 -0
  279. package/runtime/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js +69 -0
  280. package/runtime/node_modules/@oxc-project/runtime/src/helpers/wrapNativeSuper.js +27 -0
  281. package/runtime/node_modules/@oxc-project/runtime/src/helpers/wrapRegExp.js +51 -0
  282. package/runtime/node_modules/@oxc-project/runtime/src/helpers/writeOnlyError.js +4 -0
  283. package/runtime/node_modules/@oxc-project/types/LICENSE +22 -0
  284. package/runtime/node_modules/@oxc-project/types/README.md +3 -0
  285. package/runtime/node_modules/@oxc-project/types/package.json +26 -0
  286. package/runtime/node_modules/@oxc-project/types/types.d.ts +1912 -0
  287. package/runtime/node_modules/@petamoriken/float16/LICENSE +21 -0
  288. package/runtime/node_modules/@petamoriken/float16/README.md +413 -0
  289. package/runtime/node_modules/@petamoriken/float16/browser/float16.js +1340 -0
  290. package/runtime/node_modules/@petamoriken/float16/browser/float16.mjs +1325 -0
  291. package/runtime/node_modules/@petamoriken/float16/index.d.ts +546 -0
  292. package/runtime/node_modules/@petamoriken/float16/index.v5.6.d.ts +546 -0
  293. package/runtime/node_modules/@petamoriken/float16/index.v5.7.d.ts +555 -0
  294. package/runtime/node_modules/@petamoriken/float16/inspect/node.cjs +25 -0
  295. package/runtime/node_modules/@petamoriken/float16/inspect/node.mjs +23 -0
  296. package/runtime/node_modules/@petamoriken/float16/lib/DataView.cjs +16 -0
  297. package/runtime/node_modules/@petamoriken/float16/lib/Float16Array.cjs +690 -0
  298. package/runtime/node_modules/@petamoriken/float16/lib/_util/arrayIterator.cjs +52 -0
  299. package/runtime/node_modules/@petamoriken/float16/lib/_util/brand.cjs +27 -0
  300. package/runtime/node_modules/@petamoriken/float16/lib/_util/converter.cjs +111 -0
  301. package/runtime/node_modules/@petamoriken/float16/lib/_util/is.cjs +78 -0
  302. package/runtime/node_modules/@petamoriken/float16/lib/_util/messages.cjs +18 -0
  303. package/runtime/node_modules/@petamoriken/float16/lib/_util/primordials.cjs +150 -0
  304. package/runtime/node_modules/@petamoriken/float16/lib/_util/spec.cjs +84 -0
  305. package/runtime/node_modules/@petamoriken/float16/lib/f16round.cjs +10 -0
  306. package/runtime/node_modules/@petamoriken/float16/lib/index.cjs +16 -0
  307. package/runtime/node_modules/@petamoriken/float16/lib/isTypedArray.cjs +11 -0
  308. package/runtime/node_modules/@petamoriken/float16/package.json +115 -0
  309. package/runtime/node_modules/@petamoriken/float16/src/DataView.mjs +35 -0
  310. package/runtime/node_modules/@petamoriken/float16/src/Float16Array.mjs +1194 -0
  311. package/runtime/node_modules/@petamoriken/float16/src/_util/arrayIterator.mjs +86 -0
  312. package/runtime/node_modules/@petamoriken/float16/src/_util/brand.mjs +31 -0
  313. package/runtime/node_modules/@petamoriken/float16/src/_util/converter.mjs +173 -0
  314. package/runtime/node_modules/@petamoriken/float16/src/_util/is.mjs +151 -0
  315. package/runtime/node_modules/@petamoriken/float16/src/_util/messages.mjs +22 -0
  316. package/runtime/node_modules/@petamoriken/float16/src/_util/primordials.mjs +254 -0
  317. package/runtime/node_modules/@petamoriken/float16/src/_util/spec.mjs +137 -0
  318. package/runtime/node_modules/@petamoriken/float16/src/f16round.mjs +10 -0
  319. package/runtime/node_modules/@petamoriken/float16/src/index.mjs +7 -0
  320. package/runtime/node_modules/@petamoriken/float16/src/isTypedArray.mjs +10 -0
  321. package/runtime/node_modules/jsbi/LICENSE +176 -0
  322. package/runtime/node_modules/jsbi/README.md +173 -0
  323. package/runtime/node_modules/jsbi/dist/jsbi-cjs.js +2 -0
  324. package/runtime/node_modules/jsbi/dist/jsbi-cjs.js.map +1 -0
  325. package/runtime/node_modules/jsbi/dist/jsbi-umd.js +2 -0
  326. package/runtime/node_modules/jsbi/dist/jsbi-umd.js.map +1 -0
  327. package/runtime/node_modules/jsbi/dist/jsbi.mjs +2 -0
  328. package/runtime/node_modules/jsbi/dist/jsbi.mjs.map +1 -0
  329. package/runtime/node_modules/jsbi/jsbi.d.ts +43 -0
  330. package/runtime/node_modules/jsbi/package.json +35 -0
  331. package/runtime/node_modules/oxc-parser/LICENSE +22 -0
  332. package/runtime/node_modules/oxc-parser/README.md +167 -0
  333. package/runtime/node_modules/oxc-parser/package.json +153 -0
  334. package/runtime/node_modules/oxc-parser/src-js/bindings.js +601 -0
  335. package/runtime/node_modules/oxc-parser/src-js/generated/constants.js +105 -0
  336. package/runtime/node_modules/oxc-parser/src-js/generated/deserialize/js.js +5862 -0
  337. package/runtime/node_modules/oxc-parser/src-js/generated/deserialize/js_range.js +6403 -0
  338. package/runtime/node_modules/oxc-parser/src-js/generated/deserialize/ts.js +6154 -0
  339. package/runtime/node_modules/oxc-parser/src-js/generated/deserialize/ts_range.js +6723 -0
  340. package/runtime/node_modules/oxc-parser/src-js/generated/lazy/constructors.js +13875 -0
  341. package/runtime/node_modules/oxc-parser/src-js/generated/lazy/type_ids.js +191 -0
  342. package/runtime/node_modules/oxc-parser/src-js/generated/lazy/walk.js +5810 -0
  343. package/runtime/node_modules/oxc-parser/src-js/generated/visit/keys.js +220 -0
  344. package/runtime/node_modules/oxc-parser/src-js/generated/visit/type_ids.js +177 -0
  345. package/runtime/node_modules/oxc-parser/src-js/generated/visit/visitor.d.ts +387 -0
  346. package/runtime/node_modules/oxc-parser/src-js/generated/visit/walk.js +2455 -0
  347. package/runtime/node_modules/oxc-parser/src-js/index.d.ts +312 -0
  348. package/runtime/node_modules/oxc-parser/src-js/index.js +108 -0
  349. package/runtime/node_modules/oxc-parser/src-js/raw-transfer/common.js +301 -0
  350. package/runtime/node_modules/oxc-parser/src-js/raw-transfer/eager.js +255 -0
  351. package/runtime/node_modules/oxc-parser/src-js/raw-transfer/lazy-common.js +11 -0
  352. package/runtime/node_modules/oxc-parser/src-js/raw-transfer/lazy.js +162 -0
  353. package/runtime/node_modules/oxc-parser/src-js/raw-transfer/node-array.js +365 -0
  354. package/runtime/node_modules/oxc-parser/src-js/raw-transfer/supported.js +52 -0
  355. package/runtime/node_modules/oxc-parser/src-js/raw-transfer/visitor.js +127 -0
  356. package/runtime/node_modules/oxc-parser/src-js/visit/index.js +41 -0
  357. package/runtime/node_modules/oxc-parser/src-js/visit/visitor.js +405 -0
  358. package/runtime/node_modules/oxc-parser/src-js/wasm.js +13 -0
  359. package/runtime/node_modules/oxc-parser/src-js/webcontainer-fallback.cjs +21 -0
  360. package/runtime/node_modules/oxc-parser/src-js/wrap.js +57 -0
  361. package/runtime/node_modules/urlpattern-polyfill/LICENSE +19 -0
  362. package/runtime/node_modules/urlpattern-polyfill/README.md +242 -0
  363. package/runtime/node_modules/urlpattern-polyfill/dist/index.d.ts +9 -0
  364. package/runtime/node_modules/urlpattern-polyfill/dist/types.d.ts +49 -0
  365. package/runtime/node_modules/urlpattern-polyfill/dist/urlpattern.cjs +1 -0
  366. package/runtime/node_modules/urlpattern-polyfill/dist/urlpattern.js +1 -0
  367. package/runtime/node_modules/urlpattern-polyfill/index.cjs +7 -0
  368. package/runtime/node_modules/urlpattern-polyfill/index.js +7 -0
  369. package/runtime/node_modules/urlpattern-polyfill/package.json +149 -0
  370. package/runtime/polyfills.mjs +73 -97
  371. package/runtime/preload-async-hooks.mjs +50 -0
  372. package/runtime/preload.mjs +274 -320
  373. package/runtime/transform-core.mjs +762 -0
  374. package/runtime/version.mjs +12 -0
  375. package/runtime/worker-polyfill.mjs +147 -9
@@ -0,0 +1,301 @@
1
+ import os from "node:os";
2
+ import {
3
+ BLOCK_SIZE,
4
+ BLOCK_ALIGN,
5
+ BUFFER_SIZE,
6
+ ACTIVE_SIZE,
7
+ IS_TS_FLAG_POS,
8
+ } from "../generated/constants.js";
9
+ import {
10
+ getBufferOffset,
11
+ parseRaw as parseRawBinding,
12
+ parseRawSync as parseRawSyncBinding,
13
+ } from "../bindings.js";
14
+ import { rawTransferSupported } from "./supported.js";
15
+
16
+ // Throw an error if running on a platform which raw transfer doesn't support.
17
+ //
18
+ // Note: This module is lazy-loaded only when user calls `parseSync` or `parseAsync` with
19
+ // `experimentalRawTransfer` or `experimentalLazy` options, or calls `experimentalGetLazyVisitor`.
20
+ if (!rawTransferSupported()) {
21
+ throw new Error(
22
+ "`experimentalRawTransfer` and `experimentalLazy` options are not supported " +
23
+ "on 32-bit or big-endian systems, versions of NodeJS prior to v22.0.0, " +
24
+ "versions of Deno prior to v2.0.0, or other runtimes",
25
+ );
26
+ }
27
+
28
+ /**
29
+ * Parse JS/TS source synchronously on current thread using raw transfer.
30
+ *
31
+ * Convert the buffer returned by Rust to a JS object with provided `convert` function.
32
+ *
33
+ * This function contains logic shared by both `parseSyncRaw` and `parseSyncLazy`.
34
+ *
35
+ * @param {string} filename - Filename
36
+ * @param {string} sourceText - Source text of file
37
+ * @param {Object} options - Parsing options
38
+ * @param {function} convert - Function to convert the buffer returned from Rust into a JS object
39
+ * @returns {Object} - The return value of `convert`
40
+ */
41
+ export function parseSyncRawImpl(filename, sourceText, options, convert) {
42
+ const { buffer, sourceStartPos, sourceByteLen } = prepareRaw(sourceText);
43
+ parseRawSyncBinding(filename, buffer.block, sourceStartPos, sourceByteLen, options);
44
+ return convert(buffer, sourceText, sourceStartPos, sourceByteLen, options);
45
+ }
46
+
47
+ // User should not schedule more async tasks than there are available CPUs, as it hurts performance,
48
+ // but it's a common mistake in async JS code to do exactly that.
49
+ //
50
+ // That anti-pattern looks like this when applied to Oxc:
51
+ //
52
+ // ```js
53
+ // const asts = await Promise.all(
54
+ // files.map(
55
+ // async (filename) => {
56
+ // const sourceText = await fs.readFile(filename, 'utf8');
57
+ // const ast = await oxc.parseAsync(filename, sourceText);
58
+ // return ast;
59
+ // }
60
+ // )
61
+ // );
62
+ // ```
63
+ //
64
+ // In most cases, that'd just result in a bit of degraded performance, and higher memory use because
65
+ // of loading sources into memory prematurely.
66
+ //
67
+ // However, raw transfer uses a 6 GiB buffer for each parsing operation.
68
+ // Most of the memory pages in those buffers are never touched, so this does not consume a huge amount
69
+ // of physical memory, but it does still consume virtual memory.
70
+ //
71
+ // If we allowed creating a large number of 6 GiB buffers simultaneously, it would quickly consume
72
+ // virtual memory space and risk memory exhaustion. The code above would exhaust all of bottom half
73
+ // (heap) of 48-bit virtual memory space if `files.length >= 21_845`. This is not a number which
74
+ // is unrealistic in real world code.
75
+ //
76
+ // To guard against this possibility, we implement a simple queue.
77
+ // No more than `os.availableParallelism()` files can be parsed simultaneously, and any further calls to
78
+ // `parseAsyncRaw` will be put in a queue, to execute once other tasks complete.
79
+ //
80
+ // Fallback to `os.cpus().length` on versions of NodeJS prior to v18.14.0, which do not support
81
+ // `os.availableParallelism`.
82
+ let availableCores = os.availableParallelism ? os.availableParallelism() : os.cpus().length;
83
+ const queue = [];
84
+
85
+ /**
86
+ * Parse JS/TS source asynchronously using raw transfer.
87
+ *
88
+ * Convert the buffer returned by Rust to a JS object with provided `convert` function.
89
+ *
90
+ * Queues up parsing operations if more calls than number of CPU cores (see above).
91
+ *
92
+ * This function contains logic shared by both `parseAsyncRaw` and `parseAsyncLazy`.
93
+ *
94
+ * @param {string} filename - Filename
95
+ * @param {string} sourceText - Source text of file
96
+ * @param {Object} options - Parsing options
97
+ * @param {function} convert - Function to convert the buffer returned from Rust into a JS object
98
+ * @returns {Object} - The return value of `convert`
99
+ */
100
+ export async function parseAsyncRawImpl(filename, sourceText, options, convert) {
101
+ // Wait for a free CPU core if all CPUs are currently busy.
102
+ //
103
+ // Note: `availableCores` is NOT decremented if have to wait in the queue first,
104
+ // and NOT incremented when parsing completes and it runs next task in the queue.
105
+ //
106
+ // This is to avoid a race condition if `parseAsyncRaw` is called during the microtick in between
107
+ // `resolve` being called below, and the promise resolving here. In that case the new task could
108
+ // start running, and then the promise resolves, and the queued task also starts running.
109
+ // We'd then have `availableParallelism() + 1` tasks running simultaneously. Potentially, this could
110
+ // happen repeatedly, with the number of tasks running simultaneously ever-increasing.
111
+ if (availableCores === 0) {
112
+ // All CPU cores are busy. Put this task in queue and wait for capacity to become available.
113
+ await new Promise((resolve, _) => {
114
+ queue.push(resolve);
115
+ });
116
+ } else {
117
+ // A CPU core is available. Mark core as busy, and run parsing now.
118
+ availableCores--;
119
+ }
120
+
121
+ // Parse
122
+ const { buffer, sourceStartPos, sourceByteLen } = prepareRaw(sourceText);
123
+ await parseRawBinding(filename, buffer.block, sourceStartPos, sourceByteLen, options);
124
+ const data = convert(buffer, sourceText, sourceStartPos, sourceByteLen, options);
125
+
126
+ // Free the CPU core
127
+ if (queue.length > 0) {
128
+ // Some further tasks waiting in queue. Run the next one.
129
+ // Do not increment `availableCores` (see above).
130
+ const resolve = queue.shift();
131
+ resolve();
132
+ } else {
133
+ // No tasks waiting in queue. This CPU is now free.
134
+ availableCores++;
135
+ }
136
+
137
+ return data;
138
+ }
139
+
140
+ const ARRAY_BUFFER_SIZE = BLOCK_SIZE + BLOCK_ALIGN;
141
+ const ONE_GIB = 1 << 30;
142
+
143
+ // We keep a cache of buffers for raw transfer, so we can reuse them as much as possible.
144
+ //
145
+ // When processing multiple files, it's ideal if can reuse an existing buffer, as it's more likely to
146
+ // be warm in CPU cache, it avoids allocations, and it saves work for the garbage collector.
147
+ //
148
+ // However, we also don't want to keep a load of large buffers around indefinitely using up memory,
149
+ // if they're not going to be used again.
150
+ //
151
+ // We have no knowledge of what pattern over time user may process files in (could be lots in quick
152
+ // succession, or more occasionally in a long-running process). So we try to use flexible caching
153
+ // strategy which is adaptable to many usage patterns.
154
+ //
155
+ // We use a 2-tier cache.
156
+ // Tier 1 uses strong references, tier 2 uses weak references.
157
+ //
158
+ // When parsing is complete and the buffer is no longer in use, push it to `buffers` (tier 1 cache).
159
+ // Set a timer to clear the cache when no activity for 10 seconds.
160
+ //
161
+ // When the timer expires, move all the buffers from tier 1 cache into `oldBuffers` (tier 2).
162
+ // They are stored there as `WeakRef`s, so the garbage collector is free to reclaim them.
163
+ //
164
+ // On the next call to `parseSync` or `parseAsync`, promote any buffers in tier 2 cache which were not
165
+ // already garbage collected back into tier 1 cache. This is on assumption that parsing one file
166
+ // indicates parsing as a whole is an ongoing process, and there will likely be further calls to
167
+ // `parseSync` / `parseAsync` in future.
168
+ //
169
+ // The weak tier 2 cache is because V8 does not necessarily free memory as soon as it's able to be
170
+ // freed. We don't want to block it from freeing memory, but if it's not done that yet, there's no
171
+ // point creating a new buffer, when one already exists.
172
+ const CLEAR_BUFFERS_TIMEOUT = 10_000; // 10 seconds
173
+ const buffers = [],
174
+ oldBuffers = [];
175
+ let clearBuffersTimeout = null;
176
+
177
+ const textEncoder = new TextEncoder();
178
+
179
+ /**
180
+ * Get a buffer (from cache if possible), and copy source text into it.
181
+ *
182
+ * @param {string} sourceText - Source text of file
183
+ * @returns {Object} - Object of form `{ buffer, sourceStartPos, sourceByteLen }`.
184
+ * - `buffer`: `Uint8Array` containing the AST in raw form.
185
+ * - `sourceStartPos`: Position of first byte of source text in buffer
186
+ * - `sourceByteLen`: Length of source text in UTF-8 bytes
187
+ * (which may not be equal to `sourceText.length` if source contains non-ASCII characters).
188
+ */
189
+ export function prepareRaw(sourceText) {
190
+ // Cancel timeout for clearing buffers
191
+ if (clearBuffersTimeout !== null) {
192
+ clearTimeout(clearBuffersTimeout);
193
+ clearBuffersTimeout = null;
194
+ }
195
+
196
+ // Revive any discarded buffers which have not yet been garbage collected
197
+ if (oldBuffers.length > 0) {
198
+ const revivedBuffers = [];
199
+ for (let oldBuffer of oldBuffers) {
200
+ oldBuffer = oldBuffer.deref();
201
+ if (oldBuffer !== undefined) revivedBuffers.push(oldBuffer);
202
+ }
203
+ oldBuffers.length = 0;
204
+ if (revivedBuffers.length > 0) buffers.unshift(...revivedBuffers);
205
+ }
206
+
207
+ // Reuse existing buffer, or create a new one
208
+ const buffer = buffers.length > 0 ? buffers.pop() : createBuffer();
209
+
210
+ // Write source into end of buffer.
211
+ // Maximum size of a string encoded in UTF-8 is 3 x the length of the string in UTF-16 characters
212
+ // (a source which consists entirely of 3-byte UTF-8 characters).
213
+ // We can't predict how many bytes will be needed exactly in advance of encoding, so we reserve
214
+ // the maximum theoretically possible number of bytes required.
215
+ // `TextEncoder` cannot write into a `Uint8Array` larger than 1 GiB, so size is capped at 1 GiB.
216
+ const maxSourceByteLen = sourceText.length * 3;
217
+ if (maxSourceByteLen > ONE_GIB) throw new Error("Source text is too long");
218
+ const sourceStartPos = ACTIVE_SIZE - maxSourceByteLen;
219
+
220
+ const sourceBuffer = new Uint8Array(
221
+ buffer.buffer,
222
+ buffer.byteOffset + sourceStartPos,
223
+ maxSourceByteLen,
224
+ );
225
+ const { read, written: sourceByteLen } = textEncoder.encodeInto(sourceText, sourceBuffer);
226
+ if (read !== sourceText.length) throw new Error("Failed to write source text into buffer");
227
+
228
+ return { buffer, sourceStartPos, sourceByteLen };
229
+ }
230
+
231
+ /**
232
+ * Get if AST should be parsed as JS or TS.
233
+ * Rust side sets a `bool` in this position in buffer which is `true` if TS.
234
+ *
235
+ * @param {Uint8Array} buffer - Buffer containing AST in raw form
236
+ * @returns {boolean} - `true` if AST is JS, `false` if TS
237
+ */
238
+ export function isJsAst(buffer) {
239
+ return buffer[IS_TS_FLAG_POS] === 0;
240
+ }
241
+
242
+ /**
243
+ * Return buffer to cache, to be reused.
244
+ * Set a timer to clear buffers.
245
+ *
246
+ * @param {Uint8Array} buffer - Buffer
247
+ * @returns {undefined}
248
+ */
249
+ export function returnBufferToCache(buffer) {
250
+ buffers.push(buffer);
251
+
252
+ if (clearBuffersTimeout !== null) clearTimeout(clearBuffersTimeout);
253
+ clearBuffersTimeout = setTimeout(clearBuffersCache, CLEAR_BUFFERS_TIMEOUT);
254
+ clearBuffersTimeout.unref();
255
+ }
256
+
257
+ /**
258
+ * Downgrade buffers in tier 1 cache (`buffers`) to tier 2 (`oldBuffers`)
259
+ * so they can be garbage collected.
260
+ *
261
+ * @returns {undefined}
262
+ */
263
+ function clearBuffersCache() {
264
+ clearBuffersTimeout = null;
265
+
266
+ for (const buffer of buffers) {
267
+ oldBuffers.push(new WeakRef(buffer));
268
+ }
269
+ buffers.length = 0;
270
+ }
271
+
272
+ /**
273
+ * Create a `Uint8Array` which is 2 GiB in size, with its start aligned on 4 GiB.
274
+ *
275
+ * Achieve this by creating a 6 GiB `ArrayBuffer`, getting the offset within it that's aligned to 4 GiB,
276
+ * chopping off that number of bytes from the start, and shortening to 2 GiB.
277
+ *
278
+ * It's always possible to obtain a 2 GiB slice aligned on 4 GiB within a 6 GiB buffer,
279
+ * no matter how the 6 GiB buffer is aligned.
280
+ *
281
+ * `buffer` itself, and `int32` and `float64` views of `buffer`, are `BUFFER_SIZE` bytes,
282
+ * which excludes `FixedSizeAllocatorMetadata` and `ChunkFooter`.
283
+ * This ensures this critical data cannot be accidentally overwritten on JS side.
284
+ * `block` is `BLOCK_SIZE` bytes, which includes `FixedSizeAllocatorMetadata` and `ChunkFooter`.
285
+ * `block` is what we pass to Rust, which needs to write `ChunkFooter`.
286
+ *
287
+ * Note: On systems with virtual memory, this only consumes 6 GiB of *virtual* memory.
288
+ * It does not consume physical memory until data is actually written to the `Uint8Array`.
289
+ * Physical memory consumed corresponds to the quantity of data actually written.
290
+ *
291
+ * @returns {Uint8Array} - Buffer
292
+ */
293
+ function createBuffer() {
294
+ const arrayBuffer = new ArrayBuffer(ARRAY_BUFFER_SIZE);
295
+ const offset = getBufferOffset(new Uint8Array(arrayBuffer));
296
+ const buffer = new Uint8Array(arrayBuffer, offset, BUFFER_SIZE);
297
+ buffer.int32 = new Int32Array(arrayBuffer, offset, BUFFER_SIZE / 4);
298
+ buffer.float64 = new Float64Array(arrayBuffer, offset, BUFFER_SIZE / 8);
299
+ buffer.block = new Uint8Array(arrayBuffer, offset, BLOCK_SIZE);
300
+ return buffer;
301
+ }
@@ -0,0 +1,255 @@
1
+ import { createRequire } from "node:module";
2
+ import { TOKENS_OFFSET_POS_32, TOKENS_LEN_POS_32 } from "../generated/constants.js";
3
+ import { isJsAst, parseAsyncRawImpl, parseSyncRawImpl, returnBufferToCache } from "./common.js";
4
+
5
+ const require = createRequire(import.meta.url);
6
+
7
+ /**
8
+ * Parse JS/TS source synchronously on current thread, using raw transfer to speed up deserialization.
9
+ *
10
+ * @param {string} filename - Filename
11
+ * @param {string} sourceText - Source text of file
12
+ * @param {Object} options - Parsing options
13
+ * @returns {Object} - Object with property getters for `program`, `module`, `comments`, and `errors`
14
+ */
15
+ export function parseSyncRaw(filename, sourceText, options) {
16
+ return parseSyncRawImpl(filename, sourceText, options, deserialize);
17
+ }
18
+
19
+ /**
20
+ * Parse JS/TS source asynchronously, using raw transfer to speed up deserialization.
21
+ *
22
+ * Note that not all of the workload can happen on a separate thread.
23
+ * Parsing on Rust side does happen in a separate thread, but deserialization of the AST to JS objects
24
+ * has to happen on current thread. This synchronous deserialization work typically outweighs
25
+ * the asynchronous parsing by a factor of around 3.
26
+ *
27
+ * i.e. the majority of the workload cannot be parallelized by using this method.
28
+ *
29
+ * Generally `parseSyncRaw` is preferable to use as it does not have the overhead of spawning a thread.
30
+ * If you need to parallelize parsing multiple files, it is recommended to use worker threads.
31
+ *
32
+ * @param {string} filename - Filename
33
+ * @param {string} sourceText - Source text of file
34
+ * @param {Object} options - Parsing options
35
+ * @returns {Object} - Object with property getters for `program`, `module`, `comments`, and `errors`
36
+ */
37
+ export function parse(filename, sourceText, options) {
38
+ return parseAsyncRawImpl(filename, sourceText, options, deserialize);
39
+ }
40
+
41
+ // Deserializers are large files, so lazy-loaded.
42
+ // `deserialize` functions are stored in this array once loaded.
43
+ // Index into these arrays is `isJs * 1 + range * 2 + experimentalParent * 4`.
44
+ const deserializers = [null, null, null, null, null, null, null, null];
45
+ const deserializerNames = [
46
+ "ts",
47
+ "js",
48
+ "ts_range",
49
+ "js_range",
50
+ "ts_parent",
51
+ "js_parent",
52
+ "ts_range_parent",
53
+ "js_range_parent",
54
+ ];
55
+
56
+ /**
57
+ * Deserialize whole AST from buffer.
58
+ *
59
+ * @param {Uint8Array} buffer - Buffer containing AST in raw form
60
+ * @param {string} sourceText - Source for the file
61
+ * @param {number} sourceStartPos - Position of first byte of source text in buffer
62
+ * @param {number} sourceByteLen - Length of source text in UTF-8 bytes
63
+ * @param {Object} options - Parsing options
64
+ * @returns {Object} - Object with property getters for `program`, `module`, `comments`, and `errors`
65
+ */
66
+ function deserialize(buffer, sourceText, sourceStartPos, sourceByteLen, options) {
67
+ const isJs = isJsAst(buffer),
68
+ range = !!options.range,
69
+ parent = !!options.experimentalParent;
70
+
71
+ // Lazy load deserializer, and deserialize buffer to JS objects
72
+ const deserializerIndex = +isJs | (+range << 1) | (+parent << 2);
73
+ let deserializeThis = deserializers[deserializerIndex];
74
+ if (deserializeThis === null) {
75
+ deserializeThis = deserializers[deserializerIndex] = require(
76
+ `../generated/deserialize/${deserializerNames[deserializerIndex]}.js`,
77
+ ).deserialize;
78
+ }
79
+
80
+ const data = deserializeThis(buffer, sourceText, sourceStartPos, sourceByteLen);
81
+
82
+ // Add a line comment for hashbang if JS.
83
+ // Do not add comment if TS, to match `@typescript-eslint/parser`.
84
+ // See https://github.com/oxc-project/oxc/blob/ea784f5f082e4c53c98afde9bf983afd0b95e44e/napi/parser/src/lib.rs#L106-L130
85
+ if (isJs) {
86
+ const { hashbang } = data.program;
87
+ if (hashbang !== null) {
88
+ data.comments.unshift(
89
+ range
90
+ ? {
91
+ type: "Line",
92
+ value: hashbang.value,
93
+ start: hashbang.start,
94
+ end: hashbang.end,
95
+ range: hashbang.range,
96
+ }
97
+ : { type: "Line", value: hashbang.value, start: hashbang.start, end: hashbang.end },
98
+ );
99
+ }
100
+ }
101
+
102
+ // Deserialize tokens
103
+ const tokens = options.experimentalTokens ? deserializeTokens(buffer, sourceText, isJs) : null;
104
+
105
+ // Return buffer to cache, to be reused
106
+ returnBufferToCache(buffer);
107
+
108
+ // We cannot lazily deserialize in the getters, because the buffer might be re-used to parse
109
+ // another file before the getter is called
110
+ if (tokens !== null) {
111
+ return {
112
+ get program() {
113
+ return data.program;
114
+ },
115
+ get module() {
116
+ return data.module;
117
+ },
118
+ get comments() {
119
+ return data.comments;
120
+ },
121
+ get tokens() {
122
+ return tokens;
123
+ },
124
+ get errors() {
125
+ return data.errors;
126
+ },
127
+ };
128
+ }
129
+
130
+ return {
131
+ get program() {
132
+ return data.program;
133
+ },
134
+ get module() {
135
+ return data.module;
136
+ },
137
+ get comments() {
138
+ return data.comments;
139
+ },
140
+ get errors() {
141
+ return data.errors;
142
+ },
143
+ };
144
+ }
145
+
146
+ // `ESTreeKind` discriminants (set by Rust side)
147
+ const PRIVATE_IDENTIFIER_KIND = 2;
148
+ const REGEXP_KIND = 8;
149
+
150
+ // Indexed by `ESTreeKind` discriminant (matches `ESTreeKind` enum in `estree_kind.rs`)
151
+ const TOKEN_TYPES = [
152
+ "Identifier",
153
+ "Keyword",
154
+ "PrivateIdentifier",
155
+ "Punctuator",
156
+ "Numeric",
157
+ "String",
158
+ "Boolean",
159
+ "Null",
160
+ "RegularExpression",
161
+ "Template",
162
+ "JSXText",
163
+ "JSXIdentifier",
164
+ ];
165
+
166
+ // Mask for active bits in `ESTreeKind` discriminants
167
+ const TOKEN_KIND_MASK = 15;
168
+
169
+ // Details of Rust `Token` type
170
+ const TOKEN_SIZE = 16;
171
+
172
+ /**
173
+ * Deserialize tokens from buffer.
174
+ * @param {Uint8Array} buffer - Buffer containing AST in raw form
175
+ * @param {string} sourceText - Source for the file
176
+ * @param {boolean} isJs - `true` if parsing in JS mode
177
+ * @returns {Object[]} - Array of token objects
178
+ */
179
+ function deserializeTokens(buffer, sourceText, isJs) {
180
+ const { int32 } = buffer;
181
+
182
+ let pos = int32[TOKENS_OFFSET_POS_32];
183
+ const len = int32[TOKENS_LEN_POS_32];
184
+ const endPos = pos + len * TOKEN_SIZE;
185
+
186
+ const tokens = [];
187
+ while (pos < endPos) {
188
+ tokens.push(deserializeToken(pos, int32, sourceText, isJs));
189
+ pos += TOKEN_SIZE;
190
+ }
191
+ return tokens;
192
+ }
193
+
194
+ /**
195
+ * Deserialize a token from buffer at position `pos`.
196
+ * @param {number} pos - Position in buffer containing Rust `Token` type
197
+ * @param {Int32Array} int32 - Buffer containing AST in raw form as an `Int32Array`
198
+ * @param {string} sourceText - Source for the file
199
+ * @param {boolean} isJs - `true` if parsing in JS mode
200
+ * @returns {Object} - Token object
201
+ */
202
+ function deserializeToken(pos, int32, sourceText, isJs) {
203
+ const pos32 = pos >> 2,
204
+ start = int32[pos32],
205
+ end = int32[pos32 + 1],
206
+ kindAndFlags = int32[pos32 + 2];
207
+
208
+ let value = sourceText.slice(start, end);
209
+
210
+ // `Kind` is byte at index 8 in `Token`.
211
+ // `Kind` has 12 variants numbered from 0 to 11.
212
+ // We have to mask the bottom byte (`& 0xFF`), so may as well mask off bits which can't be set in `Kind` at same time.
213
+ // This may allow V8 to generate more efficient code for `TOKEN_TYPES[kind]`.
214
+ const kind = kindAndFlags & TOKEN_KIND_MASK;
215
+
216
+ if (kind === REGEXP_KIND) {
217
+ const patternEnd = value.lastIndexOf("/");
218
+ return {
219
+ type: "RegularExpression",
220
+ value,
221
+ regex: {
222
+ pattern: value.slice(1, patternEnd),
223
+ flags: value.slice(patternEnd + 1),
224
+ },
225
+ start,
226
+ end,
227
+ };
228
+ }
229
+
230
+ // Strip leading `#` from private identifiers
231
+ if (kind === PRIVATE_IDENTIFIER_KIND) value = value.slice(1);
232
+
233
+ // Unescape identifiers, keywords, and private identifiers in JS mode.
234
+ // `is_escaped` flag is in byte 10 of `Token`, and is a `bool`.
235
+ if (isJs && kind <= PRIVATE_IDENTIFIER_KIND && (kindAndFlags & 0x10000) !== 0) {
236
+ value = unescapeIdentifier(value);
237
+ }
238
+
239
+ return { type: TOKEN_TYPES[kind], value, start, end };
240
+ }
241
+
242
+ /**
243
+ * Unescape an identifier.
244
+ *
245
+ * We do this on JS side, because escaped identifiers are so extremely rare that this function
246
+ * is never called in practice anyway.
247
+ *
248
+ * @param {string} name - Identifier name to unescape
249
+ * @returns {string} - Unescaped identifier name
250
+ */
251
+ function unescapeIdentifier(name) {
252
+ return name.replace(/\\u(?:\{([0-9a-fA-F]+)\}|([0-9a-fA-F]{4}))/g, (_, hex1, hex2) =>
253
+ String.fromCodePoint(parseInt(hex1 ?? hex2, 16)),
254
+ );
255
+ }
@@ -0,0 +1,11 @@
1
+ // Unique token which is not exposed publicly.
2
+ // Used to prevent user calling class constructors.
3
+ export const TOKEN = {};
4
+
5
+ /**
6
+ * Throw error when restricted class constructor is called by user code.
7
+ * @throws {Error}
8
+ */
9
+ export function constructorError() {
10
+ throw new Error("Constructor is for internal use only");
11
+ }