@scriptc/cli-darwin-arm64 0.2.0 → 0.2.2

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 (260) hide show
  1. package/dist/THIRD_PARTY_NOTICES +1 -1
  2. package/dist/bin/scriptc +0 -0
  3. package/dist/bin/scriptc.json +1 -1
  4. package/dist/lib/declarations/scriptc-node-fallback.d.ts +84 -19
  5. package/dist/lib/llvm/bin/scriptc-llvm-codegen +0 -0
  6. package/dist/lib/llvm/package.json +1 -1
  7. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_array.o +0 -0
  8. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_assert.o +0 -0
  9. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_async.o +0 -0
  10. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_async_dyn.o +0 -0
  11. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_bigint.o +0 -0
  12. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_bytes.o +0 -0
  13. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_bytes_io.o +0 -0
  14. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_child.o +0 -0
  15. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_console.o +0 -0
  16. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_console_native.o +0 -0
  17. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_crypto_async.o +0 -0
  18. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_dyn_invoke.o +0 -0
  19. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_error.o +0 -0
  20. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_events.o +0 -0
  21. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_exception.o +0 -0
  22. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_fetch.o +0 -0
  23. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_file_handle.o +0 -0
  24. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_grapheme.o +0 -0
  25. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_http.o +0 -0
  26. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_http2.o +0 -0
  27. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_json.o +0 -0
  28. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_lib.o +0 -0
  29. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_map.o +0 -0
  30. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_net.o +0 -0
  31. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_node_builtin.o +0 -0
  32. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_object.o +0 -0
  33. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_qs.o +0 -0
  34. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_regex.o +0 -0
  35. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_stream.o +0 -0
  36. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_string.o +0 -0
  37. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_symbol.o +0 -0
  38. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_url.o +0 -0
  39. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_array.o +0 -0
  40. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_assert.o +0 -0
  41. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_async.o +0 -0
  42. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_async_dyn.o +0 -0
  43. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_bigint.o +0 -0
  44. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_bytes.o +0 -0
  45. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_bytes_io.o +0 -0
  46. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_child.o +0 -0
  47. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_console.o +0 -0
  48. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_console_native.o +0 -0
  49. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_crypto_async.o +0 -0
  50. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_dyn_invoke.o +0 -0
  51. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_error.o +0 -0
  52. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_events.o +0 -0
  53. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_exception.o +0 -0
  54. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_file_handle.o +0 -0
  55. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_grapheme.o +0 -0
  56. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_http.o +0 -0
  57. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_http2.o +0 -0
  58. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_island.o +0 -0
  59. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_json.o +0 -0
  60. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_lib.o +0 -0
  61. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_map.o +0 -0
  62. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_net.o +0 -0
  63. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_node_builtin.o +0 -0
  64. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_object.o +0 -0
  65. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_qs.o +0 -0
  66. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_regex.o +0 -0
  67. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_stream.o +0 -0
  68. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_string.o +0 -0
  69. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_symbol.o +0 -0
  70. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_url.o +0 -0
  71. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_web.o +0 -0
  72. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic-text-decoder-legacy/scr_bytes.o +0 -0
  73. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/text-decoder-legacy/scr_bytes.o +0 -0
  74. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_array.o +0 -0
  75. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_assert.o +0 -0
  76. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_bigint.o +0 -0
  77. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_bytes.o +0 -0
  78. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_bytes_io.o +0 -0
  79. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_console_native.o +0 -0
  80. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_dyn_invoke.o +0 -0
  81. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_error.o +0 -0
  82. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_exception.o +0 -0
  83. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_grapheme.o +0 -0
  84. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_json.o +0 -0
  85. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_lib.o +0 -0
  86. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_map.o +0 -0
  87. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_node_builtin.o +0 -0
  88. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_object.o +0 -0
  89. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_regex.o +0 -0
  90. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_string.o +0 -0
  91. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_symbol.o +0 -0
  92. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_url.o +0 -0
  93. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/text-decoder-legacy/scr_bytes.o +0 -0
  94. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_array.o +0 -0
  95. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_assert.o +0 -0
  96. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_bigint.o +0 -0
  97. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_bytes.o +0 -0
  98. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_bytes_io.o +0 -0
  99. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_console_native.o +0 -0
  100. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_dyn_invoke.o +0 -0
  101. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_error.o +0 -0
  102. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_exception.o +0 -0
  103. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_grapheme.o +0 -0
  104. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_json.o +0 -0
  105. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_lib.o +0 -0
  106. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_map.o +0 -0
  107. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_node_builtin.o +0 -0
  108. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_object.o +0 -0
  109. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_regex.o +0 -0
  110. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_string.o +0 -0
  111. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_symbol.o +0 -0
  112. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_url.o +0 -0
  113. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/text-decoder-legacy/scr_bytes.o +0 -0
  114. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_array.o +0 -0
  115. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_assert.o +0 -0
  116. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_bigint.o +0 -0
  117. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_bytes.o +0 -0
  118. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_bytes_io.o +0 -0
  119. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_console_native.o +0 -0
  120. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_dyn_invoke.o +0 -0
  121. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_error.o +0 -0
  122. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_exception.o +0 -0
  123. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_grapheme.o +0 -0
  124. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_json.o +0 -0
  125. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_lib.o +0 -0
  126. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_map.o +0 -0
  127. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_node_builtin.o +0 -0
  128. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_object.o +0 -0
  129. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_regex.o +0 -0
  130. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_string.o +0 -0
  131. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_symbol.o +0 -0
  132. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_url.o +0 -0
  133. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/text-decoder-legacy/scr_bytes.o +0 -0
  134. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_array.o +0 -0
  135. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_assert.o +0 -0
  136. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_bigint.o +0 -0
  137. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_bytes.o +0 -0
  138. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_bytes_io.o +0 -0
  139. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_console_native.o +0 -0
  140. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_dyn_invoke.o +0 -0
  141. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_error.o +0 -0
  142. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_exception.o +0 -0
  143. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_grapheme.o +0 -0
  144. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_json.o +0 -0
  145. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_lib.o +0 -0
  146. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_map.o +0 -0
  147. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_node_builtin.o +0 -0
  148. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_object.o +0 -0
  149. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_regex.o +0 -0
  150. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_string.o +0 -0
  151. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_symbol.o +0 -0
  152. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_url.o +0 -0
  153. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/text-decoder-legacy/scr_bytes.o +0 -0
  154. package/dist/lib/runtime-darwin-arm64/artifacts/licenses/v8-number-radix.txt +61 -0
  155. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_array.o +0 -0
  156. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_assert.o +0 -0
  157. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_async.o +0 -0
  158. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_async_dyn.o +0 -0
  159. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_bigint.o +0 -0
  160. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_bytes.o +0 -0
  161. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_bytes_io.o +0 -0
  162. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_child.o +0 -0
  163. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_console.o +0 -0
  164. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_console_native.o +0 -0
  165. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_crypto_async.o +0 -0
  166. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_dyn_invoke.o +0 -0
  167. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_error.o +0 -0
  168. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_events.o +0 -0
  169. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_exception.o +0 -0
  170. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_fetch.o +0 -0
  171. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_file_handle.o +0 -0
  172. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_grapheme.o +0 -0
  173. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_http.o +0 -0
  174. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_http2.o +0 -0
  175. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_json.o +0 -0
  176. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_lib.o +0 -0
  177. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_map.o +0 -0
  178. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_net.o +0 -0
  179. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_node_builtin.o +0 -0
  180. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_object.o +0 -0
  181. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_qs.o +0 -0
  182. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_regex.o +0 -0
  183. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_stream.o +0 -0
  184. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_string.o +0 -0
  185. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_symbol.o +0 -0
  186. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_url.o +0 -0
  187. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_array.o +0 -0
  188. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_assert.o +0 -0
  189. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_async.o +0 -0
  190. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_async_dyn.o +0 -0
  191. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_bigint.o +0 -0
  192. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_bytes.o +0 -0
  193. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_bytes_io.o +0 -0
  194. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_child.o +0 -0
  195. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_console.o +0 -0
  196. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_console_native.o +0 -0
  197. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_crypto_async.o +0 -0
  198. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_dyn_invoke.o +0 -0
  199. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_error.o +0 -0
  200. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_events.o +0 -0
  201. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_exception.o +0 -0
  202. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_file_handle.o +0 -0
  203. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_grapheme.o +0 -0
  204. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_http.o +0 -0
  205. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_http2.o +0 -0
  206. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_island.o +0 -0
  207. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_json.o +0 -0
  208. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_lib.o +0 -0
  209. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_map.o +0 -0
  210. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_net.o +0 -0
  211. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_node_builtin.o +0 -0
  212. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_object.o +0 -0
  213. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_qs.o +0 -0
  214. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_regex.o +0 -0
  215. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_stream.o +0 -0
  216. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_string.o +0 -0
  217. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_symbol.o +0 -0
  218. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_url.o +0 -0
  219. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_web.o +0 -0
  220. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic-text-decoder-legacy/scr_bytes.o +0 -0
  221. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/text-decoder-legacy/scr_bytes.o +0 -0
  222. package/dist/lib/runtime-darwin-arm64/package.json +1 -1
  223. package/dist/lib/runtime-darwin-arm64/runtime-pack.json +549 -545
  224. package/dist/lib/runtime-sources/package.json +1 -1
  225. package/dist/lib/runtime-sources/src/scr_abort.c +5 -0
  226. package/dist/lib/runtime-sources/src/scr_array.c +16 -0
  227. package/dist/lib/runtime-sources/src/scr_assert.c +1 -0
  228. package/dist/lib/runtime-sources/src/scr_async.c +38 -5
  229. package/dist/lib/runtime-sources/src/scr_async_dyn.c +208 -40
  230. package/dist/lib/runtime-sources/src/scr_bigint.c +8 -0
  231. package/dist/lib/runtime-sources/src/scr_bytes.c +431 -41
  232. package/dist/lib/runtime-sources/src/scr_bytes_io.c +628 -12
  233. package/dist/lib/runtime-sources/src/scr_child.c +544 -17
  234. package/dist/lib/runtime-sources/src/scr_console.c +1 -1
  235. package/dist/lib/runtime-sources/src/scr_crypto_async.c +22 -2
  236. package/dist/lib/runtime-sources/src/scr_dyn_invoke.c +344 -73
  237. package/dist/lib/runtime-sources/src/scr_error.c +52 -5
  238. package/dist/lib/runtime-sources/src/scr_exception.c +21 -5
  239. package/dist/lib/runtime-sources/src/scr_fetch.c +311 -3
  240. package/dist/lib/runtime-sources/src/scr_file_handle.c +31 -0
  241. package/dist/lib/runtime-sources/src/scr_http.c +3 -0
  242. package/dist/lib/runtime-sources/src/scr_island.c +1226 -405
  243. package/dist/lib/runtime-sources/src/scr_island_manifest.h +11 -9
  244. package/dist/lib/runtime-sources/src/scr_json.c +1594 -139
  245. package/dist/lib/runtime-sources/src/scr_json.test.ts +1 -0
  246. package/dist/lib/runtime-sources/src/scr_lib.c +816 -34
  247. package/dist/lib/runtime-sources/src/scr_map.c +47 -0
  248. package/dist/lib/runtime-sources/src/scr_node_builtin.c +10 -0
  249. package/dist/lib/runtime-sources/src/scr_object.c +11 -0
  250. package/dist/lib/runtime-sources/src/scr_qs.c +10 -0
  251. package/dist/lib/runtime-sources/src/scr_regex.c +148 -72
  252. package/dist/lib/runtime-sources/src/scr_runtime.h +257 -41
  253. package/dist/lib/runtime-sources/src/scr_stream.c +197 -0
  254. package/dist/lib/runtime-sources/src/scr_string.c +16 -1
  255. package/dist/lib/runtime-sources/src/scr_symbol.c +5 -0
  256. package/dist/lib/runtime-sources/src/scr_text_decoder_labels.h +225 -0
  257. package/dist/lib/runtime-sources/src/scr_url.c +206 -10
  258. package/dist/lib/runtime-sources/src/scr_web.c +129 -26
  259. package/dist/lib/runtime-sources/vendor/v8-number-radix/LICENSE +61 -0
  260. package/package.json +1 -1
@@ -256,6 +256,7 @@ static void scr_map_trace(void *o, ScrTraceVisit visit, void *ctx) {
256
256
  * an identity-key map may trace keys, values, or both independently. */
257
257
  static void scr_map_gcfree(void *o) {
258
258
  ScrMap *m = (ScrMap *)o;
259
+ scr_weak_dispose(m);
259
260
  for (size_t e = 0; e < m->nentries; e++) {
260
261
  if (!m->entries[e].live) continue;
261
262
  if (!m->key_trace) scr_map_release_key(m, m->entries[e].key);
@@ -314,6 +315,7 @@ ScrMap *scr_map_retain(ScrMap *m) {
314
315
  void scr_map_release(ScrMap *m) {
315
316
  if (!m || m->rc == SIZE_MAX) return; /* NULL: an uninitialized `let` local */
316
317
  if (--m->rc == 0) {
318
+ scr_weak_dispose(m);
317
319
  if (m->key_trace || m->val_trace) scr_cyc_on_dead(m);
318
320
  for (size_t e = 0; e < m->nentries; e++) {
319
321
  if (!m->entries[e].live) continue;
@@ -602,6 +604,51 @@ bool scr_map_iter_val_bool(const ScrMap *m, double i) {
602
604
  return scr_map_iter_at(m, i)->val != 0;
603
605
  }
604
606
 
607
+ void scr_map_dyn_attach(ScrMap *map, const ScrMapDynOps *ops) {
608
+ map->dyn_ops = ops;
609
+ }
610
+
611
+ ScrDyn *scr_map_dyn_key(const ScrMap *map, double index) {
612
+ uint64_t slot = scr_map_iter_at(map, index)->key;
613
+ return map->dyn_ops ? map->dyn_ops->key_box(slot) : scr_dyn_retain(scr_map_slot_to_ptr(slot));
614
+ }
615
+
616
+ ScrDyn *scr_map_dyn_value(const ScrMap *map, double index) {
617
+ uint64_t slot = scr_map_iter_at(map, index)->val;
618
+ return map->dyn_ops ? map->dyn_ops->val_box(slot) : scr_dyn_retain(scr_map_slot_to_ptr(slot));
619
+ }
620
+
621
+ static size_t scr_map_dyn_find(ScrMap *map, const ScrDyn *key) {
622
+ if (map->dyn_ops && !map->dyn_ops->key_matches(key)) return SCR_MAP_EMPTY;
623
+ uint64_t slot = map->dyn_ops ? map->dyn_ops->key_unbox(key) : scr_map_slot_from_ptr(scr_dyn_retain((ScrDyn *)key));
624
+ if (scr_exc_pending()) return SCR_MAP_EMPTY;
625
+ if (map->key_kind == SCR_MAP_KEY_F64) slot = scr_map_f64_bits(scr_map_slot_to_f64(slot));
626
+ size_t entry = scr_map_find(map, scr_map_hash_key(map, slot), slot);
627
+ scr_map_release_key(map, slot);
628
+ return entry;
629
+ }
630
+
631
+ ScrDyn *scr_map_dyn_get(ScrMap *map, const ScrDyn *key) {
632
+ size_t entry = scr_map_dyn_find(map, key);
633
+ if (scr_exc_pending()) return NULL;
634
+ return entry == SCR_MAP_EMPTY ? scr_dyn_retain(scr_dyn_undefined()) : scr_map_dyn_value(map, (double)entry);
635
+ }
636
+
637
+ bool scr_map_dyn_has(ScrMap *map, const ScrDyn *key, bool remove) {
638
+ size_t entry = scr_map_dyn_find(map, key);
639
+ return remove ? scr_map_delete_found(map, entry) : entry != SCR_MAP_EMPTY;
640
+ }
641
+
642
+ void scr_map_dyn_set(ScrMap *map, const ScrDyn *key, const ScrDyn *value, bool set) {
643
+ uint64_t key_slot = map->dyn_ops ? map->dyn_ops->key_unbox(key) : scr_map_slot_from_ptr(scr_dyn_retain((ScrDyn *)key));
644
+ if (scr_exc_pending()) return;
645
+ uint64_t value_slot = set ? 0 : map->dyn_ops ? map->dyn_ops->val_unbox(value) : scr_map_slot_from_ptr(scr_dyn_retain((ScrDyn *)value));
646
+ if (scr_exc_pending()) { scr_map_release_key(map, key_slot); return; }
647
+ if (map->key_kind == SCR_MAP_KEY_F64) key_slot = scr_map_f64_bits(scr_map_slot_to_f64(key_slot));
648
+ scr_map_set(map, scr_map_hash_key(map, key_slot), key_slot, value_slot);
649
+ scr_map_release_key(map, key_slot);
650
+ }
651
+
605
652
  void *scr_map_iter_val_ref(const ScrMap *m, double i) {
606
653
  return m->val_retain(scr_map_slot_to_ptr(scr_map_iter_at(m, i)->val)); /* +1 */
607
654
  }
@@ -10,6 +10,9 @@ static SCR_TL ScrDyn *scr_global_known;
10
10
  static SCR_TL ScrDyn *scr_global_own;
11
11
  static SCR_TL bool scr_global_cleanup_registered;
12
12
  static SCR_TL ScrDyn *(*scr_global_console_get)(void);
13
+ static SCR_TL ScrDyn *(*scr_global_fetch_get)(void);
14
+
15
+ void scr_global_fetch_install(ScrDyn *(*get)(void)) { scr_global_fetch_get = get; }
13
16
 
14
17
  static SCR_TL ScrDyn *scr_hrtime_value;
15
18
  static void scr_hrtime_cleanup(void) {
@@ -28,6 +31,12 @@ static ScrDyn *scr_hrtime_bigint_call(ScrClosure *closure, ScrDyn *const *args,
28
31
 
29
32
  static ScrDyn *scr_hrtime_call(ScrClosure *closure, ScrDyn *const *args, size_t argc) {
30
33
  (void)closure;
34
+ if (argc && args[0]->kind == SCR_DYN_TYPED_REF) {
35
+ ScrDyn *view = scr_dyn_typed_ref_materialize(args[0]);
36
+ ScrDyn *result = view && !scr_exc_pending() ? scr_hrtime_call(closure, &view, 1) : NULL;
37
+ scr_dyn_release(view);
38
+ return result;
39
+ }
31
40
  uint64_t time = scr_hrtime_ns();
32
41
  double seconds = (double)(time / UINT64_C(1000000000));
33
42
  double nanos = (double)(time % UINT64_C(1000000000));
@@ -111,6 +120,7 @@ static ScrDyn *scr_global_get(void *handle, const char *key, size_t length) {
111
120
  return scr_dyn_new_handle(&scr_global_known, SCR_DYNH_GLOBAL);
112
121
  if (length == 7 && memcmp(key, "console", length) == 0 && scr_global_console_get)
113
122
  return scr_global_console_get();
123
+ if (length == 5 && memcmp(key, "fetch", length) == 0 && scr_global_fetch_get) return scr_global_fetch_get();
114
124
  if (length == 9 && memcmp(key, "undefined", length) == 0) return scr_dyn_undefined();
115
125
  if (length == 3 && memcmp(key, "NaN", length) == 0) return scr_dyn_new_num(NAN);
116
126
  if (length == 8 && memcmp(key, "Infinity", length) == 0) return scr_dyn_new_num(INFINITY);
@@ -6,6 +6,7 @@ void scr_classobj_trace_v(void *object, ScrTraceVisit visit, void *ctx) {
6
6
  ScrClassObj *c = object;
7
7
  for (size_t i = 0; i < c->ncaps; i++) visit(c->caps[i], ctx);
8
8
  visit(c->prototype_data, ctx);
9
+ visit(c->static_data, ctx);
9
10
  }
10
11
 
11
12
  static void scr_classobj_gcfree(void *object) {
@@ -26,6 +27,7 @@ ScrClassObj *scr_classobj_new(const ScrClassObj *template, size_t ncaps) {
26
27
  c->ncaps = ncaps;
27
28
  c->length = template->length;
28
29
  c->prototype_data = NULL;
30
+ c->static_data = NULL;
29
31
  scr_obj_alloc_note();
30
32
  return c;
31
33
  }
@@ -36,6 +38,7 @@ void scr_classobj_release(ScrClassObj *c) {
36
38
  scr_cyc_on_dead(c);
37
39
  for (size_t i = 0; i < c->ncaps; i++) scr_box_release(c->caps[i]);
38
40
  scr_box_release(c->prototype_data);
41
+ scr_box_release(c->static_data);
39
42
  scr_classobj_gcfree(c);
40
43
  } else {
41
44
  scr_cyc_on_release(c);
@@ -45,6 +48,14 @@ void scr_classobj_release(ScrClassObj *c) {
45
48
  void *scr_classobj_retain_v(void *c) {
46
49
  return scr_classobj_retain((ScrClassObj *)c);
47
50
  }
51
+
52
+ void scr_classobj_clear_properties(ScrClassObj *c) {
53
+ ScrBox *prototype = c->prototype_data, *statics = c->static_data;
54
+ c->prototype_data = NULL;
55
+ c->static_data = NULL;
56
+ scr_box_release(prototype);
57
+ scr_box_release(statics);
58
+ }
48
59
  void scr_classobj_release_v(void *c) { scr_classobj_release((ScrClassObj *)c); }
49
60
 
50
61
  ScrStr *scr_classobj_name(ScrClassObj *c) {
@@ -460,6 +460,12 @@ static void qs_stringify_value(QsBuf *b, const ScrDyn *v) {
460
460
 
461
461
  ScrStr *scr_qs_stringify(const ScrDyn *obj, const ScrStr *sep,
462
462
  const ScrStr *eq) {
463
+ if (obj && obj->kind == SCR_DYN_TYPED_REF) {
464
+ ScrDyn *view = scr_dyn_typed_ref_materialize(obj);
465
+ ScrStr *result = view && !scr_exc_pending() ? scr_qs_stringify(view, sep, eq) : NULL;
466
+ scr_dyn_release(view);
467
+ return result;
468
+ }
463
469
  const char *sep_b = (sep && sep->len) ? sep->data : "&";
464
470
  size_t sep_len = (sep && sep->len) ? sep->len : 1;
465
471
  const char *eq_b = (eq && eq->len) ? eq->data : "=";
@@ -475,6 +481,9 @@ ScrStr *scr_qs_stringify(const ScrDyn *obj, const ScrStr *sep,
475
481
  const ScrStr *k = kd->v.str;
476
482
  const ScrDyn *v = scr_dyn_obj_get(obj, k->data, k->len);
477
483
  if (!v) continue; /* unreachable: keys came from the object */
484
+ ScrDyn *view = v->kind == SCR_DYN_TYPED_REF ? scr_dyn_typed_ref_materialize(v) : NULL;
485
+ if (view) v = view;
486
+ if (scr_exc_pending()) { scr_dyn_release(view); scr_dyn_release(keys); free(fields.data); return NULL; }
478
487
  ScrStr *ks = scr_str_encode_uri_component((ScrStr *)k);
479
488
  if (v->kind == SCR_DYN_ARR) {
480
489
  for (size_t j = 0; j < v->v.arr.len; j++) {
@@ -490,6 +499,7 @@ ScrStr *scr_qs_stringify(const ScrDyn *obj, const ScrStr *sep,
490
499
  qs_stringify_value(&fields, v);
491
500
  }
492
501
  scr_str_release(ks);
502
+ scr_dyn_release(view);
493
503
  }
494
504
  scr_dyn_release(keys);
495
505
  return qb_take(&fields);
@@ -7,10 +7,10 @@
7
7
  * the always-compiled runtime source list (see native-toolchain.ts), so regex-free
8
8
  * programs keep a byte-identical link line.
9
9
  *
10
- * - Every ScrRegex today is an immortal interned literal (the compiler
11
- * emits one static per distinct (pattern, flags) pair, like string
12
- * literals). The pattern is compiled to bytecode LAZILY on first use and
13
- * cached on the struct; a pattern lre_compile rejects aborts with a clear
10
+ * - Each literal evaluation creates a refcounted regex with fresh state.
11
+ * Instances share an immortal template per (pattern, flags) pair. The
12
+ * template compiles and caches bytecode LAZILY on first use; a pattern
13
+ * lre_compile rejects aborts with a clear
14
14
  * message (Node throws SyntaxError at parse time — documented divergence;
15
15
  * rare, since tsc's parser has already syntax-checked the literal).
16
16
  * - Subjects are matched as UTF-16: lre_exec runs over a per-call
@@ -23,14 +23,14 @@
23
23
  * temporary registers past the capture slots), unmatched groups leave
24
24
  * NULL pointers, and zero-length matches advance by one code unit — or by
25
25
  * a whole surrogate pair under /u (AdvanceStringIndex).
26
- * - Statefulness fence: /g regexes carry mutable lastIndex in JS. This
27
- * slice supports /g (and /y) only where the iteration is internal —
28
- * replace/replaceAll/split; test() on a g/y-flagged regex aborts with a
29
- * clear message (the frontend already rejects the cases it can see).
26
+ * - Global and sticky exec/test use numeric lastIndex and update or reset
27
+ * it after matching. String matching/replacement follows its own state
28
+ * rules; matchAll, search, and split preserve the original regex state.
30
29
  */
31
30
  #include "scr_runtime.h"
32
31
 
33
32
  #include <stdio.h>
33
+ #include <math.h>
34
34
  #include <stdlib.h>
35
35
  #include <string.h>
36
36
 
@@ -176,6 +176,7 @@ static char *scr_pattern_cesu8(const ScrStr *src, size_t *plen) {
176
176
  /* The compiled bytecode, compiling (and caching) on first use. */
177
177
  static uint8_t *scr_regex_bc(ScrRegex *re) {
178
178
  if (re->bc) return re->bc;
179
+ if (re->literal) return re->bc = scr_regex_bc(re->literal);
179
180
  int flags = scr_lre_flags(re->flags);
180
181
  const char *pat = re->source->data;
181
182
  size_t pat_len = re->source->len;
@@ -204,15 +205,15 @@ static uint8_t *scr_regex_bc(ScrRegex *re) {
204
205
  }
205
206
 
206
207
  /* ── RC entry points ──────────────────────────────────────────────────
207
- * Dead paths today (every regex value is an immortal interned literal);
208
- * correct anyway so dynamic construction can arrive without surprises. */
208
+ * Literal instances borrow bytecode from their immortal templates;
209
+ * constructed regexes own their compiled bytecode. */
209
210
 
210
211
  void scr_regex_release(ScrRegex *re) {
211
212
  if (!re || re->rc == SIZE_MAX) return;
212
213
  if (--re->rc == 0) {
213
214
  scr_str_release(re->source);
214
215
  scr_str_release(re->flags);
215
- if (re->bc) lre_realloc(lre_opaque(), re->bc, 0);
216
+ if (re->bc && !re->literal) lre_realloc(lre_opaque(), re->bc, 0);
216
217
  free(re);
217
218
  }
218
219
  }
@@ -220,6 +221,18 @@ void scr_regex_release(ScrRegex *re) {
220
221
  void *scr_regex_retain_v(void *re) { return scr_regex_retain(re); }
221
222
  void scr_regex_release_v(void *re) { scr_regex_release(re); }
222
223
 
224
+ ScrRegex *scr_regex_literal(ScrRegex *literal) {
225
+ ScrRegex *re = calloc(1, sizeof *re);
226
+ if (!re) scr_regex_oom();
227
+ re->rc = 1;
228
+ re->source = scr_str_retain(literal->source);
229
+ re->flags = scr_str_retain(literal->flags);
230
+ re->literal = literal;
231
+ return re;
232
+ }
233
+
234
+ double scr_regex_last_index(ScrRegex *re) { return re->last_index; }
235
+
223
236
  ScrStr *scr_regex_source(ScrRegex *re) { return scr_str_retain(re->source); }
224
237
  ScrStr *scr_regex_flags(ScrRegex *re) { return scr_str_retain(re->flags); }
225
238
  ScrStr *scr_regex_to_string(ScrRegex *re) {
@@ -403,56 +416,53 @@ static int scr_advance(const uint16_t *u, int len, int i, bool unicode) {
403
416
 
404
417
  /* ── test ─────────────────────────────────────────────────────────────── */
405
418
 
419
+ void scr_regex_reset_last_index(ScrRegex *re, double index) {
420
+ re->last_index = index;
421
+ }
422
+
406
423
  bool scr_regex_test(ScrRegex *re, ScrStr *s) {
407
- uint8_t *bc = scr_regex_bc(re);
408
- if (lre_get_flags(bc) & (LRE_FLAG_GLOBAL | LRE_FLAG_STICKY)) {
409
- /* JS test() on a g/y regex reads AND writes lastIndex — stateful
410
- * iteration this slice does not model (the frontend rejects the sites
411
- * it can see; values that flow through variables land here). */
412
- fflush(stdout);
413
- scr_trap("scriptc: test() on a regex with the 'g' or 'y' flag is not "
414
- "supported (stateful lastIndex); drop the flag, or use "
415
- "replace/replaceAll/split\n");
416
- }
417
- int len;
418
- uint16_t *u = scr_to_utf16(s, &len);
419
- uint8_t **capture = scr_capture_alloc(bc);
420
- int rc = scr_exec(capture, bc, u, 0, len);
421
- free(capture);
422
- free(u);
423
- return rc == 1;
424
+ ScrArr *result = scr_regex_exec(s, re);
425
+ bool matched = result != NULL;
426
+ scr_arr_release(result);
427
+ return matched;
428
+ }
429
+
430
+ static int scr_regex_start(ScrRegex *re, int len) {
431
+ double index = re->last_index;
432
+ if (isnan(index) || index <= 0) return 0;
433
+ if (index > len) return -1;
434
+ return (int)floor(index);
424
435
  }
425
436
 
426
437
  /* ── match ────────────────────────────────────────────────────────────── */
427
438
 
428
- /* s.match(re) for non-g/y regexes: Node's exec-shaped result reduced to
429
- * the honest slice — a fresh string[] of [whole match, ...captures], or
430
- * NULL for no match (the compiler wraps the `string[] | null` union). A
431
- * NONPARTICIPATING capture holds "" where Node's slot is undefined
432
- * (truthiness tests agree; SEMANTICS.md documents the divergence). g/y
433
- * regexes abort like test() — a g-flagged match returns EVERY match, a
434
- * different shape the frontend fences on literals. */
435
- ScrArr *scr_regex_match(ScrStr *s, ScrRegex *re) {
439
+ /* re.exec(s): a fresh string[] of [whole match, ...captures], or NULL
440
+ * for no match (the compiler wraps the `string[] | null` union). Global
441
+ * and sticky regexes start at lastIndex, set it to the match end, and
442
+ * reset it on failure. Nonparticipating captures are present undefined
443
+ * elements, distinct from participating empty captures and array holes. */
444
+ ScrArr *scr_regex_exec(ScrStr *s, ScrRegex *re) {
436
445
  uint8_t *bc = scr_regex_bc(re);
437
- if (lre_get_flags(bc) & (LRE_FLAG_GLOBAL | LRE_FLAG_STICKY)) {
438
- fflush(stdout);
439
- scr_trap("scriptc: match() on a regex with the 'g' or 'y' flag is not "
440
- "supported (an every-match array is a different shape); drop the "
441
- "flag, or use replace/replaceAll/split\n");
442
- }
446
+ bool stateful = (lre_get_flags(bc) & (LRE_FLAG_GLOBAL | LRE_FLAG_STICKY)) != 0;
443
447
  int len;
444
448
  uint16_t *u = scr_to_utf16(s, &len);
445
449
  uint8_t **capture = scr_capture_alloc(bc);
446
- int rc = scr_exec(capture, bc, u, 0, len);
450
+ int pos = stateful ? scr_regex_start(re, len) : 0;
451
+ int rc = pos < 0 ? 0 : scr_exec(capture, bc, u, pos, len);
452
+ if (stateful) re->last_index = rc == 1
453
+ ? (double)((capture[1] - (const uint8_t *)u) >> 1) : 0;
447
454
  ScrArr *out = NULL;
448
455
  if (rc == 1) {
449
456
  const uint8_t *ubase = (const uint8_t *)u;
450
457
  int count = lre_get_capture_count(bc);
451
458
  out = scr_arr_new(SCR_ELEM_STR, (size_t)count);
459
+ out->metadata = scr_dyn_new_obj();
460
+ scr_dyn_obj_set(out->metadata, "index", 5, scr_dyn_new_num((double)((capture[0] - ubase) >> 1)));
461
+ scr_dyn_obj_set(out->metadata, "input", 5, scr_dyn_new_str(s));
452
462
  for (int k = 0; k < count; k++) {
453
463
  const uint8_t *cs = capture[2 * k], *ce = capture[2 * k + 1];
454
464
  if (cs == NULL || ce == NULL) {
455
- scr_arr_push_ref(out, scr_str_new("", 0));
465
+ scr_arr_set_undefined(out, (double)out->len);
456
466
  } else {
457
467
  scr_arr_push_ref(
458
468
  out, scr_str_from_utf16(u, (int)((cs - ubase) >> 1), (int)((ce - ubase) >> 1)));
@@ -464,12 +474,42 @@ ScrArr *scr_regex_match(ScrStr *s, ScrRegex *re) {
464
474
  return out; /* +1, or NULL (no match) */
465
475
  }
466
476
 
477
+ /* Global Symbol.match always starts at zero and drains whole matches,
478
+ * ignoring capture groups. Its terminating failed exec resets lastIndex
479
+ * to zero, so no state escapes this internal iteration. Sticky globals
480
+ * stop at the first gap; empty matches advance by a Unicode code point
481
+ * under /u and by one UTF-16 unit otherwise. */
482
+ ScrArr *scr_regex_match(ScrStr *s, ScrRegex *re) {
483
+ uint8_t *bc = scr_regex_bc(re);
484
+ int flags = lre_get_flags(bc);
485
+ if (!(flags & LRE_FLAG_GLOBAL)) return scr_regex_exec(s, re);
486
+ re->last_index = 0;
487
+ bool unicode = (flags & (LRE_FLAG_UNICODE | LRE_FLAG_UNICODE_SETS)) != 0;
488
+ int len;
489
+ uint16_t *u = scr_to_utf16(s, &len);
490
+ uint8_t **capture = scr_capture_alloc(bc);
491
+ const uint8_t *ubase = (const uint8_t *)u;
492
+ ScrArr *out = NULL;
493
+ int pos = scr_regex_start(re, len);
494
+ if (pos < 0) pos = len + 1;
495
+ while (pos <= len && scr_exec(capture, bc, u, pos, len) == 1) {
496
+ int start = (int)((capture[0] - ubase) >> 1);
497
+ int end = (int)((capture[1] - ubase) >> 1);
498
+ if (!out) out = scr_arr_new(SCR_ELEM_STR, 4);
499
+ scr_arr_push_ref(out, scr_str_from_utf16(u, start, end));
500
+ pos = start == end ? scr_advance(u, len, end, unicode) : end;
501
+ }
502
+ free(capture);
503
+ free(u);
504
+ return out;
505
+ }
506
+
467
507
  /* ── search ───────────────────────────────────────────────────────────── */
468
508
 
469
509
  /* s.search(re): the first match's UTF-16 index, or -1 — Symbol.search's
470
510
  * fresh exec from position 0. lastIndex is neither read nor written in JS
471
- * (the spec saves and restores it), so no flag fence applies here, unlike
472
- * test/match: /g is irrelevant and /y anchors at 0 (libregexp's sticky
511
+ * (the spec saves and restores it): /g is irrelevant and /y anchors at 0
512
+ * (libregexp's sticky
473
513
  * bytecode omits the implicit forward scan) — exactly Node. */
474
514
  double scr_regex_search(ScrStr *s, ScrRegex *re) {
475
515
  uint8_t *bc = scr_regex_bc(re);
@@ -485,7 +525,7 @@ double scr_regex_search(ScrStr *s, ScrRegex *re) {
485
525
  }
486
526
 
487
527
  /* matchAll(re): every match as its honest slice string[] (whole match +
488
- * captures, nonparticipating = "" — match()'s rule) drained EAGERLY into
528
+ * captures, nonparticipating = undefined — match()'s rule) drained EAGERLY into
489
529
  * a fresh string[][]. The lazy iterator is unobservable across the
490
530
  * lowered surface: strings are immutable and the spec clones the regex at
491
531
  * the call, so nothing can perturb the drain. Non-global regexes throw
@@ -509,7 +549,8 @@ static ScrArr *scr_regex_match_all_core(ScrStr *s, ScrRegex *re, ScrArr *indices
509
549
  uint8_t **capture = scr_capture_alloc(bc);
510
550
  const uint8_t *ubase = (const uint8_t *)u;
511
551
  ScrArr *out = scr_arr_new(SCR_ELEM_ARR, 4);
512
- int pos = 0;
552
+ int pos = scr_regex_start(re, len);
553
+ if (pos < 0) pos = len + 1;
513
554
  while (pos <= len) {
514
555
  if (scr_exec(capture, bc, u, pos, len) != 1) break;
515
556
  int start = (int)((capture[0] - ubase) >> 1);
@@ -518,7 +559,7 @@ static ScrArr *scr_regex_match_all_core(ScrStr *s, ScrRegex *re, ScrArr *indices
518
559
  for (int k = 0; k < capture_count; k++) {
519
560
  const uint8_t *cs = capture[2 * k], *ce = capture[2 * k + 1];
520
561
  if (cs == NULL || ce == NULL) {
521
- scr_arr_push_ref(row, scr_str_new("", 0));
562
+ scr_arr_set_undefined(row, (double)row->len);
522
563
  } else {
523
564
  scr_arr_push_ref(
524
565
  row, scr_str_from_utf16(u, (int)((cs - ubase) >> 1), (int)((ce - ubase) >> 1)));
@@ -643,6 +684,7 @@ static ScrStr *scr_replace_impl(ScrStr *s, ScrRegex *re, ScrStr *rep) {
643
684
  uint8_t *bc = scr_regex_bc(re);
644
685
  int re_flags = lre_get_flags(bc);
645
686
  bool global = (re_flags & LRE_FLAG_GLOBAL) != 0;
687
+ bool sticky = (re_flags & LRE_FLAG_STICKY) != 0;
646
688
  bool unicode = (re_flags & (LRE_FLAG_UNICODE | LRE_FLAG_UNICODE_SETS)) != 0;
647
689
  int capture_count = lre_get_capture_count(bc);
648
690
  const char *groupnames = lre_get_groupnames(bc);
@@ -652,11 +694,15 @@ static ScrStr *scr_replace_impl(ScrStr *s, ScrRegex *re, ScrStr *rep) {
652
694
  const uint8_t *ubase = (const uint8_t *)u;
653
695
  ScrJsonBuf b;
654
696
  scr_jb_init(&b);
655
- int next = 0, pos = 0;
697
+ if (global) re->last_index = 0;
698
+ int next = 0, pos = sticky ? scr_regex_start(re, len) : 0;
699
+ if (pos < 0) pos = len + 1;
700
+ if (sticky && !global) re->last_index = 0;
656
701
  while (pos <= len) {
657
702
  if (scr_exec(capture, bc, u, pos, len) != 1) break;
658
703
  int start = (int)((capture[0] - ubase) >> 1);
659
704
  int end = (int)((capture[1] - ubase) >> 1);
705
+ if (sticky && !global) re->last_index = end;
660
706
  scr_jb_put_utf16(&b, u, next, start);
661
707
  scr_put_substitution(&b, u, len, start, end, capture, capture_count, groupnames, rep);
662
708
  next = end;
@@ -877,27 +923,48 @@ static ScrStr *scr_str_case_conv(const ScrStr *s, int to_lower) {
877
923
  ScrStr *scr_str_to_lower(const ScrStr *s) { return scr_str_case_conv(s, 1); }
878
924
  ScrStr *scr_str_to_upper(const ScrStr *s) { return scr_str_case_conv(s, 0); }
879
925
 
926
+ static void *scr_normalize_realloc(void *opaque, void *ptr, size_t size) {
927
+ (void)opaque;
928
+ if (!size) { free(ptr); return NULL; }
929
+ return realloc(ptr, size);
930
+ }
931
+
932
+ ScrStr *scr_str_normalize(const ScrStr *s, const ScrStr *form) {
933
+ UnicodeNormalizationEnum mode;
934
+ if (form->len == 3 && !memcmp(form->data, "NFC", 3)) mode = UNICODE_NFC;
935
+ else if (form->len == 3 && !memcmp(form->data, "NFD", 3)) mode = UNICODE_NFD;
936
+ else if (form->len == 4 && !memcmp(form->data, "NFKC", 4)) mode = UNICODE_NFKC;
937
+ else if (form->len == 4 && !memcmp(form->data, "NFKD", 4)) mode = UNICODE_NFKD;
938
+ else {
939
+ static const char message[] = "The normalization form should be one of NFC, NFD, NFKC, NFKD.";
940
+ scr_throw_error(SCR_ERR_RANGE, scr_str_new(message, sizeof message - 1));
941
+ return NULL;
942
+ }
943
+ if (s->len > INT32_MAX / sizeof(uint32_t)) scr_regex_oom();
944
+ uint32_t *input = malloc((s->len + 1) * sizeof(uint32_t));
945
+ if (!input) scr_regex_oom();
946
+ int length = 0;
947
+ for (size_t offset = 0; offset < s->len;) {
948
+ size_t step;
949
+ input[length++] = scr_case_decode(s->data + offset, &step);
950
+ offset += step;
951
+ }
952
+ uint32_t *output = NULL;
953
+ int count = unicode_normalize(&output, input, length, mode, NULL, scr_normalize_realloc);
954
+ free(input);
955
+ if (count < 0) scr_regex_oom();
956
+ ScrJsonBuf buffer;
957
+ scr_jb_init(&buffer);
958
+ for (int i = 0; i < count; i++) scr_case_put_cp(&buffer, output[i]);
959
+ free(output);
960
+ return scr_jb_finish(&buffer);
961
+ }
962
+
880
963
  /* ── assert.match / assert.doesNotMatch ──────────────────────────────────
881
- * Lives here (not scr_assert.c) because it needs the matcher, and every
882
- * call site carries a regex value — the regex link switch is already on,
883
- * so assert-only binaries never pull libregexp. A fresh exec from index 0:
884
- * Node's exec on a fresh regex literal; lastIndex statefulness is not
885
- * modeled anywhere in this runtime, so g/y-flagged regexes test like
886
- * their flag-free twins here instead of aborting (assert.match(s, /x/g)
887
- * works in Node — matching that beats scr_regex_test's fence;
888
- * SEMANTICS.md 107 covers reused stateful regexes). */
889
- /* A fresh exec from index 0 (assert.match's stance: g/y-flagged regexes
890
- * test like their flag-free twins here — SEMANTICS.md 107 covers reused
891
- * stateful regexes). */
964
+ * Lives here because it needs the matcher. Assertion matching follows
965
+ * RegExp.test, including global and sticky lastIndex transitions. */
892
966
  static bool scr_assert_regex_hits(ScrRegex *re, ScrStr *s) {
893
- uint8_t *bc = scr_regex_bc(re);
894
- int len;
895
- uint16_t *u = scr_to_utf16(s, &len);
896
- uint8_t **capture = scr_capture_alloc(bc);
897
- bool matched = scr_exec(capture, bc, u, 0, len) == 1;
898
- free(capture);
899
- free(u);
900
- return matched;
967
+ return scr_regex_test(re, s);
901
968
  }
902
969
 
903
970
  /* The regex's own inspection — /source/ + FLAGS IN GETTER ORDER
@@ -1209,6 +1276,7 @@ static ScrDyn *scr_native_regex_get(void *ptr, const char *key, size_t len) {
1209
1276
  ScrRegex *re = ptr;
1210
1277
  if (len == 6 && memcmp(key, "source", 6) == 0) return scr_native_regex_string(scr_regex_source(re));
1211
1278
  if (len == 5 && memcmp(key, "flags", 5) == 0) return scr_native_regex_string(scr_regex_flags(re));
1279
+ if (len == 9 && memcmp(key, "lastIndex", 9) == 0) return scr_dyn_new_num(re->last_index);
1212
1280
  static const struct { const char *name; char flag; } flags[] = {
1213
1281
  {"global", 'g'}, {"ignoreCase", 'i'}, {"multiline", 'm'}, {"dotAll", 's'},
1214
1282
  {"unicode", 'u'}, {"sticky", 'y'}, {"hasIndices", 'd'}, {"unicodeSets", 'v'},
@@ -1217,10 +1285,10 @@ static ScrDyn *scr_native_regex_get(void *ptr, const char *key, size_t len) {
1217
1285
  if (strlen(flags[i].name) == len && memcmp(key, flags[i].name, len) == 0)
1218
1286
  return scr_dyn_new_bool(memchr(re->flags->data, flags[i].flag, re->flags->len) != NULL);
1219
1287
  }
1220
- static const char *const methods[] = {"test", "exec", "toString", "compile", "lastIndex"};
1288
+ static const char *const methods[] = {"test", "exec", "toString", "compile"};
1221
1289
  for (size_t i = 0; i < sizeof methods / sizeof methods[0]; i++) {
1222
1290
  if (strlen(methods[i]) == len && memcmp(key, methods[i], len) == 0) {
1223
- static const char message[] = "Native RegExp method values and lastIndex have no lowering";
1291
+ static const char message[] = "Native RegExp method values have no lowering";
1224
1292
  scr_throw_error_msg_code(SCR_ERR_ERROR, message, sizeof message - 1, "SC2020");
1225
1293
  break;
1226
1294
  }
@@ -1229,7 +1297,15 @@ static ScrDyn *scr_native_regex_get(void *ptr, const char *key, size_t len) {
1229
1297
  }
1230
1298
 
1231
1299
  static bool scr_native_regex_set(void *ptr, const char *key, size_t len, const ScrDyn *value) {
1232
- (void)ptr; (void)key; (void)len; (void)value;
1300
+ if (len == 9 && memcmp(key, "lastIndex", 9) == 0) {
1301
+ if (value->kind != SCR_DYN_NUM) {
1302
+ static const char message[] = "Non-numeric RegExp.lastIndex values have no native lowering";
1303
+ scr_throw_error_msg_code(SCR_ERR_ERROR, message, sizeof message - 1, "SC2020");
1304
+ return true;
1305
+ }
1306
+ ((ScrRegex *)ptr)->last_index = value->v.num;
1307
+ return true;
1308
+ }
1233
1309
  return false;
1234
1310
  }
1235
1311