@scriptc/cli-darwin-arm64 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) 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 +25 -15
  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_dyn_invoke.o +0 -0
  18. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_error.o +0 -0
  19. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_events.o +0 -0
  20. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_exception.o +0 -0
  21. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_fetch.o +0 -0
  22. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_file_handle.o +0 -0
  23. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_grapheme.o +0 -0
  24. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_http.o +0 -0
  25. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_http2.o +0 -0
  26. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_json.o +0 -0
  27. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_lib.o +0 -0
  28. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_map.o +0 -0
  29. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_net.o +0 -0
  30. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_node_builtin.o +0 -0
  31. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_object.o +0 -0
  32. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_regex.o +0 -0
  33. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_stream.o +0 -0
  34. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_string.o +0 -0
  35. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_symbol.o +0 -0
  36. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/default/scr_url.o +0 -0
  37. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_array.o +0 -0
  38. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_assert.o +0 -0
  39. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_async.o +0 -0
  40. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_async_dyn.o +0 -0
  41. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_bigint.o +0 -0
  42. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_bytes.o +0 -0
  43. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_bytes_io.o +0 -0
  44. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_child.o +0 -0
  45. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_console.o +0 -0
  46. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_console_native.o +0 -0
  47. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_dyn_invoke.o +0 -0
  48. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_error.o +0 -0
  49. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_events.o +0 -0
  50. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_exception.o +0 -0
  51. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_file_handle.o +0 -0
  52. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_grapheme.o +0 -0
  53. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_http.o +0 -0
  54. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_http2.o +0 -0
  55. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_island.o +0 -0
  56. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_json.o +0 -0
  57. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_lib.o +0 -0
  58. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_map.o +0 -0
  59. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_net.o +0 -0
  60. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_node_builtin.o +0 -0
  61. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_object.o +0 -0
  62. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_regex.o +0 -0
  63. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_stream.o +0 -0
  64. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_string.o +0 -0
  65. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_symbol.o +0 -0
  66. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic/scr_url.o +0 -0
  67. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/dynamic-text-decoder-legacy/scr_bytes.o +0 -0
  68. package/dist/lib/runtime-darwin-arm64/artifacts/dev/runtime/text-decoder-legacy/scr_bytes.o +0 -0
  69. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_array.o +0 -0
  70. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_assert.o +0 -0
  71. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_bigint.o +0 -0
  72. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_bytes.o +0 -0
  73. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_bytes_io.o +0 -0
  74. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_console_native.o +0 -0
  75. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_dyn_invoke.o +0 -0
  76. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_error.o +0 -0
  77. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_exception.o +0 -0
  78. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_grapheme.o +0 -0
  79. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_json.o +0 -0
  80. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_lib.o +0 -0
  81. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_map.o +0 -0
  82. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_node_builtin.o +0 -0
  83. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_object.o +0 -0
  84. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_regex.o +0 -0
  85. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_string.o +0 -0
  86. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_symbol.o +0 -0
  87. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/default/scr_url.o +0 -0
  88. package/dist/lib/runtime-darwin-arm64/artifacts/library-dev/runtime/text-decoder-legacy/scr_bytes.o +0 -0
  89. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_array.o +0 -0
  90. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_assert.o +0 -0
  91. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_bigint.o +0 -0
  92. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_bytes.o +0 -0
  93. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_bytes_io.o +0 -0
  94. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_console_native.o +0 -0
  95. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_dyn_invoke.o +0 -0
  96. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_error.o +0 -0
  97. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_exception.o +0 -0
  98. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_grapheme.o +0 -0
  99. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_json.o +0 -0
  100. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_lib.o +0 -0
  101. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_map.o +0 -0
  102. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_node_builtin.o +0 -0
  103. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_object.o +0 -0
  104. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_regex.o +0 -0
  105. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_string.o +0 -0
  106. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_symbol.o +0 -0
  107. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/default/scr_url.o +0 -0
  108. package/dist/lib/runtime-darwin-arm64/artifacts/library-release/runtime/text-decoder-legacy/scr_bytes.o +0 -0
  109. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_array.o +0 -0
  110. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_assert.o +0 -0
  111. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_bigint.o +0 -0
  112. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_bytes.o +0 -0
  113. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_bytes_io.o +0 -0
  114. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_console_native.o +0 -0
  115. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_dyn_invoke.o +0 -0
  116. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_error.o +0 -0
  117. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_exception.o +0 -0
  118. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_grapheme.o +0 -0
  119. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_json.o +0 -0
  120. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_lib.o +0 -0
  121. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_map.o +0 -0
  122. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_node_builtin.o +0 -0
  123. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_object.o +0 -0
  124. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_regex.o +0 -0
  125. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_string.o +0 -0
  126. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_symbol.o +0 -0
  127. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/default/scr_url.o +0 -0
  128. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-dev/runtime/text-decoder-legacy/scr_bytes.o +0 -0
  129. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_array.o +0 -0
  130. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_assert.o +0 -0
  131. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_bigint.o +0 -0
  132. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_bytes.o +0 -0
  133. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_bytes_io.o +0 -0
  134. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_console_native.o +0 -0
  135. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_dyn_invoke.o +0 -0
  136. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_error.o +0 -0
  137. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_exception.o +0 -0
  138. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_grapheme.o +0 -0
  139. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_json.o +0 -0
  140. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_lib.o +0 -0
  141. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_map.o +0 -0
  142. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_node_builtin.o +0 -0
  143. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_object.o +0 -0
  144. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_regex.o +0 -0
  145. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_string.o +0 -0
  146. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_symbol.o +0 -0
  147. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/default/scr_url.o +0 -0
  148. package/dist/lib/runtime-darwin-arm64/artifacts/library-thread-release/runtime/text-decoder-legacy/scr_bytes.o +0 -0
  149. package/dist/lib/runtime-darwin-arm64/artifacts/licenses/v8-number-radix.txt +61 -0
  150. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_array.o +0 -0
  151. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_assert.o +0 -0
  152. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_async.o +0 -0
  153. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_async_dyn.o +0 -0
  154. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_bigint.o +0 -0
  155. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_bytes.o +0 -0
  156. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_bytes_io.o +0 -0
  157. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_child.o +0 -0
  158. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_console.o +0 -0
  159. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_console_native.o +0 -0
  160. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_dyn_invoke.o +0 -0
  161. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_error.o +0 -0
  162. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_events.o +0 -0
  163. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_exception.o +0 -0
  164. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_fetch.o +0 -0
  165. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_file_handle.o +0 -0
  166. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_grapheme.o +0 -0
  167. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_http.o +0 -0
  168. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_http2.o +0 -0
  169. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_json.o +0 -0
  170. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_lib.o +0 -0
  171. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_map.o +0 -0
  172. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_net.o +0 -0
  173. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_node_builtin.o +0 -0
  174. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_object.o +0 -0
  175. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_regex.o +0 -0
  176. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_stream.o +0 -0
  177. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_string.o +0 -0
  178. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_symbol.o +0 -0
  179. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/default/scr_url.o +0 -0
  180. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_array.o +0 -0
  181. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_assert.o +0 -0
  182. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_async.o +0 -0
  183. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_async_dyn.o +0 -0
  184. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_bigint.o +0 -0
  185. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_bytes.o +0 -0
  186. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_bytes_io.o +0 -0
  187. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_child.o +0 -0
  188. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_console.o +0 -0
  189. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_console_native.o +0 -0
  190. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_dyn_invoke.o +0 -0
  191. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_error.o +0 -0
  192. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_events.o +0 -0
  193. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_exception.o +0 -0
  194. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_file_handle.o +0 -0
  195. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_grapheme.o +0 -0
  196. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_http.o +0 -0
  197. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_http2.o +0 -0
  198. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_island.o +0 -0
  199. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_json.o +0 -0
  200. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_lib.o +0 -0
  201. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_map.o +0 -0
  202. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_net.o +0 -0
  203. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_node_builtin.o +0 -0
  204. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_object.o +0 -0
  205. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_regex.o +0 -0
  206. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_stream.o +0 -0
  207. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_string.o +0 -0
  208. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_symbol.o +0 -0
  209. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic/scr_url.o +0 -0
  210. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/dynamic-text-decoder-legacy/scr_bytes.o +0 -0
  211. package/dist/lib/runtime-darwin-arm64/artifacts/release/runtime/text-decoder-legacy/scr_bytes.o +0 -0
  212. package/dist/lib/runtime-darwin-arm64/package.json +1 -1
  213. package/dist/lib/runtime-darwin-arm64/runtime-pack.json +529 -525
  214. package/dist/lib/runtime-sources/package.json +1 -1
  215. package/dist/lib/runtime-sources/src/scr_array.c +16 -0
  216. package/dist/lib/runtime-sources/src/scr_assert.c +1 -0
  217. package/dist/lib/runtime-sources/src/scr_async.c +26 -1
  218. package/dist/lib/runtime-sources/src/scr_async_dyn.c +90 -16
  219. package/dist/lib/runtime-sources/src/scr_bigint.c +8 -0
  220. package/dist/lib/runtime-sources/src/scr_bytes.c +205 -41
  221. package/dist/lib/runtime-sources/src/scr_bytes_io.c +581 -12
  222. package/dist/lib/runtime-sources/src/scr_child.c +544 -17
  223. package/dist/lib/runtime-sources/src/scr_console.c +1 -1
  224. package/dist/lib/runtime-sources/src/scr_dyn_invoke.c +164 -31
  225. package/dist/lib/runtime-sources/src/scr_error.c +52 -5
  226. package/dist/lib/runtime-sources/src/scr_exception.c +21 -5
  227. package/dist/lib/runtime-sources/src/scr_fetch.c +266 -2
  228. package/dist/lib/runtime-sources/src/scr_http.c +3 -0
  229. package/dist/lib/runtime-sources/src/scr_island.c +38 -13
  230. package/dist/lib/runtime-sources/src/scr_json.c +1149 -91
  231. package/dist/lib/runtime-sources/src/scr_map.c +47 -0
  232. package/dist/lib/runtime-sources/src/scr_node_builtin.c +10 -0
  233. package/dist/lib/runtime-sources/src/scr_object.c +11 -0
  234. package/dist/lib/runtime-sources/src/scr_regex.c +108 -69
  235. package/dist/lib/runtime-sources/src/scr_runtime.h +190 -33
  236. package/dist/lib/runtime-sources/src/scr_stream.c +197 -0
  237. package/dist/lib/runtime-sources/src/scr_string.c +16 -1
  238. package/dist/lib/runtime-sources/src/scr_symbol.c +5 -0
  239. package/dist/lib/runtime-sources/src/scr_text_decoder_labels.h +225 -0
  240. package/dist/lib/runtime-sources/src/scr_url.c +172 -3
  241. package/dist/lib/runtime-sources/vendor/v8-number-radix/LICENSE +61 -0
  242. package/package.json +1 -1
@@ -7,6 +7,7 @@
7
7
  * encoding conversions (utf8 with WHATWG replacement, hex, base64) match
8
8
  * Node byte-for-byte — the differential corpus holds them to it. */
9
9
  #include "scr_runtime.h"
10
+ #include "scr_text_decoder_labels.h"
10
11
  #ifdef SCR_TEXT_DECODER_LEGACY
11
12
  #include "scr_text_decoder_data.h"
12
13
  #endif
@@ -16,6 +17,46 @@
16
17
  #include <stdlib.h>
17
18
  #include <string.h>
18
19
 
20
+ static bool scr_td_label_space(unsigned char c) {
21
+ return c == 9 || c == 10 || c == 12 || c == 13 || c == 32;
22
+ }
23
+
24
+ double scr_text_decoder_encoding(const ScrDyn *label) {
25
+ if (!label || label->kind == SCR_DYN_UNDEF) return -1;
26
+ ScrStr *text = scr_dyn_string_coerce_js(label);
27
+ if (!text) return -1;
28
+ size_t start = 0, end = text->len;
29
+ while (start < end && scr_td_label_space((unsigned char)text->data[start])) start++;
30
+ while (end > start && scr_td_label_space((unsigned char)text->data[end - 1])) end--;
31
+ for (size_t i = 0; i < sizeof scr_td_labels / sizeof scr_td_labels[0]; i++) {
32
+ const char *candidate = scr_td_labels[i].label;
33
+ if (strlen(candidate) != end - start) continue;
34
+ bool matches = true;
35
+ for (size_t j = start; j < end; j++) {
36
+ unsigned char c = (unsigned char)text->data[j];
37
+ if (c >= 'A' && c <= 'Z') c += 'a' - 'A';
38
+ if (c != (unsigned char)candidate[j - start]) { matches = false; break; }
39
+ }
40
+ if (matches) {
41
+ double result = scr_td_labels[i].encoding;
42
+ scr_str_release(text);
43
+ return result;
44
+ }
45
+ }
46
+ static const char prefix[] = "The \"";
47
+ static const char suffix[] = "\" encoding is not supported";
48
+ size_t length = sizeof prefix - 1 + text->len + sizeof suffix - 1;
49
+ char *message = malloc(length + 1);
50
+ if (!message) scr_trap("scriptc: out of memory\n");
51
+ memcpy(message, prefix, sizeof prefix - 1);
52
+ memcpy(message + sizeof prefix - 1, text->data, text->len);
53
+ memcpy(message + sizeof prefix - 1 + text->len, suffix, sizeof suffix);
54
+ scr_throw_error_msg_code(SCR_ERR_RANGE, message, length, "ERR_ENCODING_NOT_SUPPORTED");
55
+ free(message);
56
+ scr_str_release(text);
57
+ return -1;
58
+ }
59
+
19
60
  #ifdef SCR_RC_AUDIT
20
61
  static SCR_TL long scr_live_bytes = 0;
21
62
  long scr_bytes_live_count(void) { return scr_live_bytes; }
@@ -70,6 +111,7 @@ static ScrBytes *scr_bytes_alloc(ScrBytesElem elem, size_t len) {
70
111
  if (!b->data) scr_bytes_oom();
71
112
  b->backing = NULL;
72
113
  b->is_buffer = false;
114
+ b->is_data_view = false;
73
115
  b->external = false;
74
116
  #ifdef SCR_RC_AUDIT
75
117
  scr_live_bytes++;
@@ -129,6 +171,7 @@ ScrBytes *scr_bytes_raw_view(ScrBytes *bytes) {
129
171
 
130
172
  ScrBytes *scr_bytes_as_buffer(ScrBytes *bytes) {
131
173
  bytes->is_buffer = true;
174
+ bytes->is_data_view = false;
132
175
  return scr_bytes_retain(bytes);
133
176
  }
134
177
 
@@ -172,9 +215,8 @@ double scr_bytes_byte_len(const ScrBytes *b) {
172
215
  }
173
216
 
174
217
  /* ── element access ────────────────────────────────────────────────────
175
- * JS reads undefined and IGNORES writes out of bounds on typed arrays;
176
- * both are unrepresentable here, so any invalid index traps — the array
177
- * runtime's exact discipline (SEMANTICS.md). */
218
+ * Invalid writes are ignored. Typed numeric reads cannot represent
219
+ * undefined, so invalid reads trap; checked reads return undefined. */
178
220
 
179
221
  static size_t scr_bytes_check_index(const ScrBytes *b, double i) {
180
222
  if (!(i >= 0) || i != trunc(i) || i >= (double)b->len) {
@@ -241,7 +283,8 @@ double scr_bytes_get(const ScrBytes *b, double i) {
241
283
  }
242
284
 
243
285
  void scr_bytes_set(ScrBytes *b, double i, double v) {
244
- size_t idx = scr_bytes_check_index(b, i);
286
+ if (!(i >= 0) || i != trunc(i) || i >= (double)b->len) return;
287
+ size_t idx = (size_t)i;
245
288
  switch (b->elem) {
246
289
  case SCR_BYTES_U8: case SCR_BYTES_I8:
247
290
  b->data[idx] = (uint8_t)scr_bytes_to_u32(v);
@@ -341,6 +384,7 @@ ScrBytes *scr_bytes_subarray(ScrBytes *b, double start, double end) {
341
384
  v->data = b->data + s * scr_bytes_elem_size(b->elem);
342
385
  v->backing = scr_bytes_retain(owner);
343
386
  v->is_buffer = b->is_buffer;
387
+ v->is_data_view = false;
344
388
  v->external = false;
345
389
  #ifdef SCR_RC_AUDIT
346
390
  scr_live_bytes++;
@@ -554,6 +598,7 @@ ScrBytes *scr_dataview_new(ScrBytes *src, double byte_off, bool has_len, double
554
598
  v->data = owner->data + (size_t)off;
555
599
  v->backing = scr_bytes_retain(owner);
556
600
  v->is_buffer = false;
601
+ v->is_data_view = true;
557
602
  v->external = false;
558
603
  #ifdef SCR_RC_AUDIT
559
604
  scr_live_bytes++;
@@ -581,6 +626,7 @@ ScrBytes *scr_bytes_buffer_view(ScrBytes *src, ScrBytesElem elem,
581
626
  if (!view) return NULL;
582
627
  view->elem = elem;
583
628
  view->len /= width;
629
+ view->is_data_view = false;
584
630
  return view;
585
631
  }
586
632
 
@@ -699,7 +745,13 @@ static const char scr_hex_digits[] = "0123456789abcdef";
699
745
  /* WHATWG UTF-8 decode with U+FFFD replacement per maximal invalid subpart
700
746
  * — what Buffer.prototype.toString("utf8") does. Output re-encodes as
701
747
  * (now valid) UTF-8: worst case 3 bytes per input byte. */
702
- static ScrStr *scr_bytes_decode_utf8(const uint8_t *in, size_t n) {
748
+ static void scr_td_invalid(const char *encoding) {
749
+ char message[160];
750
+ int n = snprintf(message, sizeof message, "The encoded data was not valid for encoding %s", encoding);
751
+ scr_throw_error_msg_code(SCR_ERR_TYPE, message, (size_t)n, "ERR_ENCODING_INVALID_ENCODED_DATA");
752
+ }
753
+
754
+ static ScrStr *scr_bytes_decode_utf8_options(const uint8_t *in, size_t n, bool fatal) {
703
755
  if (in == NULL && n != 0) {
704
756
  scr_trap("scriptc: native callback passed a NULL span with nonzero length\n");
705
757
  }
@@ -713,6 +765,7 @@ static ScrStr *scr_bytes_decode_utf8(const uint8_t *in, size_t n) {
713
765
  for (size_t i = 0; i <= n; i++) {
714
766
  if (i == n) {
715
767
  if (needed > 0) { /* EOF inside a sequence: one replacement */
768
+ if (fatal) { free(out); scr_td_invalid("utf-8"); return NULL; }
716
769
  memcpy(out + o, "\xef\xbf\xbd", 3);
717
770
  o += 3;
718
771
  }
@@ -733,6 +786,7 @@ static ScrStr *scr_bytes_decode_utf8(const uint8_t *in, size_t n) {
733
786
  if (byte == 0xf4) upper = 0x8f;
734
787
  needed = 3; cp = byte & 0x7;
735
788
  } else {
789
+ if (fatal) { free(out); scr_td_invalid("utf-8"); return NULL; }
736
790
  memcpy(out + o, "\xef\xbf\xbd", 3);
737
791
  o += 3;
738
792
  }
@@ -740,6 +794,7 @@ static ScrStr *scr_bytes_decode_utf8(const uint8_t *in, size_t n) {
740
794
  }
741
795
  if (byte < lower || byte > upper) {
742
796
  /* Invalid continuation: replace the subpart, REPROCESS this byte. */
797
+ if (fatal) { free(out); scr_td_invalid("utf-8"); return NULL; }
743
798
  memcpy(out + o, "\xef\xbf\xbd", 3);
744
799
  o += 3;
745
800
  needed = 0; lower = 0x80; upper = 0xbf;
@@ -772,6 +827,10 @@ static ScrStr *scr_bytes_decode_utf8(const uint8_t *in, size_t n) {
772
827
  return s;
773
828
  }
774
829
 
830
+ static ScrStr *scr_bytes_decode_utf8(const uint8_t *in, size_t n) {
831
+ return scr_bytes_decode_utf8_options(in, n, false);
832
+ }
833
+
775
834
  ScrStr *scr_str_from_utf8_lossy(const uint8_t *bytes, size_t len) {
776
835
  return scr_bytes_decode_utf8(bytes, len);
777
836
  }
@@ -780,14 +839,47 @@ ScrStr *scr_str_from_utf8_lossy(const uint8_t *bytes, size_t len) {
780
839
  * subpart replacement decode as toString("utf8") above, with one
781
840
  * difference — a leading UTF-8 BOM is stripped (ignoreBOM defaults to
782
841
  * false in the spec; Buffer.toString keeps the BOM as U+FEFF). */
783
- ScrStr *scr_text_decode(const ScrBytes *b) {
842
+ ScrStr *scr_text_decode_options(const ScrBytes *b, bool fatal, bool ignore_bom) {
784
843
  const uint8_t *in = b->data;
785
844
  size_t n = b->len;
786
- if (n >= 3 && in[0] == 0xef && in[1] == 0xbb && in[2] == 0xbf) {
845
+ if (!ignore_bom && n >= 3 && in[0] == 0xef && in[1] == 0xbb && in[2] == 0xbf) {
787
846
  in += 3;
788
847
  n -= 3;
789
848
  }
790
- return scr_bytes_decode_utf8(in, n);
849
+ return scr_bytes_decode_utf8_options(in, n, fatal);
850
+ }
851
+
852
+ ScrBytes *scr_bytes_buffer_source(const ScrDyn *value) {
853
+ if (value->kind == SCR_DYN_TYPED_REF) {
854
+ ScrDyn *materialized = scr_dyn_typed_ref_materialize(value);
855
+ if (!materialized) return NULL;
856
+ ScrBytes *result = scr_bytes_buffer_source(materialized);
857
+ scr_dyn_release(materialized);
858
+ return result;
859
+ }
860
+ if (value->kind == SCR_DYN_UNDEF) return scr_bytes_new(SCR_BYTES_U8, 0);
861
+ if (value->kind == SCR_DYN_BYTES) {
862
+ ScrBytes *bytes = value->v.bytes;
863
+ return scr_bytes_buffer_view(bytes, SCR_BYTES_U8, scr_bytes_byte_offset(bytes), true, scr_bytes_byte_len(bytes));
864
+ }
865
+ if (scr_array_buffer_is(value)) {
866
+ return scr_array_buffer_view(SCR_BYTES_U8, value, scr_dyn_undefined(), scr_dyn_undefined());
867
+ }
868
+ static const char message[] = "The input argument must be an instance of SharedArrayBuffer, ArrayBuffer or ArrayBufferView.";
869
+ scr_throw_error_msg_code(SCR_ERR_TYPE, message, sizeof message - 1, "ERR_INVALID_ARG_TYPE");
870
+ return NULL;
871
+ }
872
+
873
+ ScrStr *scr_text_decode_buffer_source(const ScrDyn *value) {
874
+ ScrBytes *view = scr_bytes_buffer_source(value);
875
+ if (!view) return NULL;
876
+ ScrStr *out = scr_text_decode(view);
877
+ scr_bytes_release(view);
878
+ return out;
879
+ }
880
+
881
+ ScrStr *scr_text_decode(const ScrBytes *b) {
882
+ return scr_text_decode_options(b, false, false);
791
883
  }
792
884
 
793
885
  /* ── node:string_decoder, the utf8 StringDecoder ─────────────────────────
@@ -1067,11 +1159,12 @@ enum {
1067
1159
  typedef struct {
1068
1160
  char *data;
1069
1161
  size_t len;
1162
+ bool failed;
1070
1163
  } ScrTdOut;
1071
1164
 
1072
1165
  static ScrTdOut scr_td_out_new(size_t input_len) {
1073
1166
  if (input_len > (SIZE_MAX - 8) / 3) scr_bytes_oom();
1074
- ScrTdOut out = { malloc(input_len * 3 + 8), 0 };
1167
+ ScrTdOut out = { malloc(input_len * 3 + 8), 0, false };
1075
1168
  if (!out.data) scr_bytes_oom();
1076
1169
  return out;
1077
1170
  }
@@ -1081,39 +1174,42 @@ static void scr_td_put(ScrTdOut *out, uint32_t cp) {
1081
1174
  }
1082
1175
 
1083
1176
  static void scr_td_error(ScrTdOut *out) {
1177
+ out->failed = true;
1084
1178
  scr_td_put(out, 0xfffd);
1085
1179
  }
1086
1180
 
1087
- static ScrStr *scr_td_finish(ScrTdOut *out) {
1181
+ static ScrStr *scr_td_finish(ScrTdOut *out, bool fatal) {
1182
+ if (fatal && out->failed) { free(out->data); scr_td_invalid("legacy encoding"); return NULL; }
1088
1183
  ScrStr *str = scr_str_new(out->data, out->len);
1089
1184
  free(out->data);
1090
1185
  return str;
1091
1186
  }
1092
1187
 
1093
- static ScrStr *scr_td_single_byte(const ScrBytes *b, unsigned encoding) {
1188
+ static ScrStr *scr_td_single_byte(const ScrBytes *b, unsigned encoding, bool fatal) {
1094
1189
  ScrTdOut out = scr_td_out_new(b->len);
1095
1190
  for (size_t i = 0; i < b->len; i++) {
1096
1191
  uint8_t byte = b->data[i];
1097
- scr_td_put(&out, byte < 0x80 ? byte : scr_td_single[encoding][byte - 0x80]);
1192
+ uint32_t cp = byte < 0x80 ? byte : scr_td_single[encoding][byte - 0x80];
1193
+ if (cp == 0xfffd) scr_td_error(&out); else scr_td_put(&out, cp);
1098
1194
  }
1099
- return scr_td_finish(&out);
1195
+ return scr_td_finish(&out, fatal);
1100
1196
  }
1101
1197
 
1102
- static ScrStr *scr_td_x_user_defined(const ScrBytes *b) {
1198
+ static ScrStr *scr_td_x_user_defined(const ScrBytes *b, bool fatal) {
1103
1199
  ScrTdOut out = scr_td_out_new(b->len);
1104
1200
  for (size_t i = 0; i < b->len; i++) {
1105
1201
  uint8_t byte = b->data[i];
1106
1202
  scr_td_put(&out, byte < 0x80 ? byte : 0xf780 + byte - 0x80);
1107
1203
  }
1108
- return scr_td_finish(&out);
1204
+ return scr_td_finish(&out, fatal);
1109
1205
  }
1110
1206
 
1111
- static ScrStr *scr_td_utf16(const ScrBytes *b, bool be) {
1207
+ static ScrStr *scr_td_utf16(const ScrBytes *b, bool be, bool fatal, bool ignore_bom) {
1112
1208
  const uint8_t *in = b->data;
1113
1209
  size_t n = b->len;
1114
1210
  /* TextDecoder's BOM handling strips only the BOM matching the selected
1115
1211
  * endian decoder. The opposite BOM decodes to U+FFFE and remains. */
1116
- if (n >= 2 && ((!be && in[0] == 0xff && in[1] == 0xfe) ||
1212
+ if (!ignore_bom && n >= 2 && ((!be && in[0] == 0xff && in[1] == 0xfe) ||
1117
1213
  (be && in[0] == 0xfe && in[1] == 0xff))) {
1118
1214
  in += 2;
1119
1215
  n -= 2;
@@ -1146,7 +1242,7 @@ static ScrStr *scr_td_utf16(const ScrBytes *b, bool be) {
1146
1242
  else scr_td_put(&out, cu);
1147
1243
  }
1148
1244
  if (i < n) scr_td_error(&out); /* odd trailing byte */
1149
- return scr_td_finish(&out);
1245
+ return scr_td_finish(&out, fatal);
1150
1246
  }
1151
1247
 
1152
1248
  static uint32_t scr_td_gb_range(uint32_t pointer) {
@@ -1165,7 +1261,7 @@ static uint32_t scr_td_gb_range(uint32_t pointer) {
1165
1261
  /* A tiny prepend stack models the Encoding Standard's I/O queue restore.
1166
1262
  * The gb18030 decoder is the only legacy decoder which can restore three
1167
1263
  * bytes after discovering a malformed four-byte sequence. */
1168
- static ScrStr *scr_td_gb18030_decode(const ScrBytes *b) {
1264
+ static ScrStr *scr_td_gb18030_decode(const ScrBytes *b, bool fatal) {
1169
1265
  ScrTdOut out = scr_td_out_new(b->len);
1170
1266
  uint8_t first = 0, second = 0, third = 0;
1171
1267
  uint8_t replay[3];
@@ -1238,10 +1334,10 @@ static ScrStr *scr_td_gb18030_decode(const ScrBytes *b) {
1238
1334
  else scr_td_error(&out);
1239
1335
  }
1240
1336
  if (first || second || third) scr_td_error(&out);
1241
- return scr_td_finish(&out);
1337
+ return scr_td_finish(&out, fatal);
1242
1338
  }
1243
1339
 
1244
- static ScrStr *scr_td_big5_decode(const ScrBytes *b) {
1340
+ static ScrStr *scr_td_big5_decode(const ScrBytes *b, bool fatal) {
1245
1341
  ScrTdOut out = scr_td_out_new(b->len);
1246
1342
  uint8_t lead = 0;
1247
1343
  for (size_t i = 0; i < b->len; i++) {
@@ -1267,10 +1363,10 @@ static ScrStr *scr_td_big5_decode(const ScrBytes *b) {
1267
1363
  else scr_td_error(&out);
1268
1364
  }
1269
1365
  if (lead) scr_td_error(&out);
1270
- return scr_td_finish(&out);
1366
+ return scr_td_finish(&out, fatal);
1271
1367
  }
1272
1368
 
1273
- static ScrStr *scr_td_euc_jp_decode(const ScrBytes *b) {
1369
+ static ScrStr *scr_td_euc_jp_decode(const ScrBytes *b, bool fatal) {
1274
1370
  ScrTdOut out = scr_td_out_new(b->len);
1275
1371
  uint8_t lead = 0;
1276
1372
  bool jis0212 = false;
@@ -1330,10 +1426,10 @@ static ScrStr *scr_td_euc_jp_decode(const ScrBytes *b) {
1330
1426
  else scr_td_error(&out);
1331
1427
  }
1332
1428
  if (lead) scr_td_error(&out);
1333
- return scr_td_finish(&out);
1429
+ return scr_td_finish(&out, fatal);
1334
1430
  }
1335
1431
 
1336
- static ScrStr *scr_td_shift_jis_decode(const ScrBytes *b) {
1432
+ static ScrStr *scr_td_shift_jis_decode(const ScrBytes *b, bool fatal) {
1337
1433
  ScrTdOut out = scr_td_out_new(b->len);
1338
1434
  uint8_t lead = 0;
1339
1435
  for (size_t i = 0; i < b->len; i++) {
@@ -1367,10 +1463,10 @@ static ScrStr *scr_td_shift_jis_decode(const ScrBytes *b) {
1367
1463
  else scr_td_error(&out);
1368
1464
  }
1369
1465
  if (lead) scr_td_error(&out);
1370
- return scr_td_finish(&out);
1466
+ return scr_td_finish(&out, fatal);
1371
1467
  }
1372
1468
 
1373
- static ScrStr *scr_td_euc_kr_decode(const ScrBytes *b) {
1469
+ static ScrStr *scr_td_euc_kr_decode(const ScrBytes *b, bool fatal) {
1374
1470
  ScrTdOut out = scr_td_out_new(b->len);
1375
1471
  uint8_t lead = 0;
1376
1472
  for (size_t i = 0; i < b->len; i++) {
@@ -1393,7 +1489,7 @@ static ScrStr *scr_td_euc_kr_decode(const ScrBytes *b) {
1393
1489
  else scr_td_error(&out);
1394
1490
  }
1395
1491
  if (lead) scr_td_error(&out);
1396
- return scr_td_finish(&out);
1492
+ return scr_td_finish(&out, fatal);
1397
1493
  }
1398
1494
 
1399
1495
  enum ScrTdIsoState {
@@ -1406,7 +1502,7 @@ enum ScrTdIsoState {
1406
1502
  SCR_TD_ISO_ESCAPE,
1407
1503
  };
1408
1504
 
1409
- static ScrStr *scr_td_iso_2022_jp_decode(const ScrBytes *b) {
1505
+ static ScrStr *scr_td_iso_2022_jp_decode(const ScrBytes *b, bool fatal) {
1410
1506
  ScrTdOut out = scr_td_out_new(b->len);
1411
1507
  enum ScrTdIsoState state = SCR_TD_ISO_ASCII;
1412
1508
  enum ScrTdIsoState output_state = SCR_TD_ISO_ASCII;
@@ -1574,27 +1670,95 @@ static ScrStr *scr_td_iso_2022_jp_decode(const ScrBytes *b) {
1574
1670
  }
1575
1671
  }
1576
1672
  }
1577
- return scr_td_finish(&out);
1673
+ return scr_td_finish(&out, fatal);
1578
1674
  }
1579
1675
 
1580
- ScrStr *scr_text_decode_legacy(const ScrBytes *b, double encoding_value) {
1676
+ ScrStr *scr_text_decode_legacy_options(const ScrBytes *b, double encoding_value, bool fatal, bool ignore_bom) {
1581
1677
  unsigned encoding = (unsigned)encoding_value;
1582
- if (encoding < SCR_TD_SINGLE_COUNT) return scr_td_single_byte(b, encoding);
1678
+ if (encoding < SCR_TD_SINGLE_COUNT) return scr_td_single_byte(b, encoding, fatal);
1583
1679
  switch (encoding) {
1584
- case SCR_TD_X_USER_DEFINED: return scr_td_x_user_defined(b);
1585
- case SCR_TD_UTF16LE: return scr_td_utf16(b, false);
1586
- case SCR_TD_UTF16BE: return scr_td_utf16(b, true);
1587
- case SCR_TD_GB18030: return scr_td_gb18030_decode(b);
1588
- case SCR_TD_BIG5: return scr_td_big5_decode(b);
1589
- case SCR_TD_EUC_JP: return scr_td_euc_jp_decode(b);
1590
- case SCR_TD_ISO_2022_JP: return scr_td_iso_2022_jp_decode(b);
1591
- case SCR_TD_SHIFT_JIS: return scr_td_shift_jis_decode(b);
1592
- case SCR_TD_EUC_KR: return scr_td_euc_kr_decode(b);
1680
+ case SCR_TD_X_USER_DEFINED: return scr_td_x_user_defined(b, fatal);
1681
+ case SCR_TD_UTF16LE: return scr_td_utf16(b, false, fatal, ignore_bom);
1682
+ case SCR_TD_UTF16BE: return scr_td_utf16(b, true, fatal, ignore_bom);
1683
+ case SCR_TD_GB18030: return scr_td_gb18030_decode(b, fatal);
1684
+ case SCR_TD_BIG5: return scr_td_big5_decode(b, fatal);
1685
+ case SCR_TD_EUC_JP: return scr_td_euc_jp_decode(b, fatal);
1686
+ case SCR_TD_ISO_2022_JP: return scr_td_iso_2022_jp_decode(b, fatal);
1687
+ case SCR_TD_SHIFT_JIS: return scr_td_shift_jis_decode(b, fatal);
1688
+ case SCR_TD_EUC_KR: return scr_td_euc_kr_decode(b, fatal);
1593
1689
  default: return scr_str_new("", 0); /* compiler invariant */
1594
1690
  }
1595
1691
  }
1692
+ ScrStr *scr_text_decode_legacy(const ScrBytes *b, double encoding_value) {
1693
+ return scr_text_decode_legacy_options(b, encoding_value, false, false);
1694
+ }
1596
1695
  #endif /* SCR_TEXT_DECODER_LEGACY */
1597
1696
 
1697
+ /* Streaming decoders retain only an incomplete character and whether the
1698
+ * initial BOM has been handled. The state object belongs to the codec's
1699
+ * private record, so aliases and closure captures share the same decoder. */
1700
+ static size_t scr_td_utf8_tail(const uint8_t *bytes, size_t n) {
1701
+ size_t tail = scr_strdec_tail(bytes, n);
1702
+ if (!tail) return 0;
1703
+ uint8_t lead = bytes[n - tail];
1704
+ if (lead < 0xc2 || lead > 0xf4) return 0;
1705
+ if (tail > 1) {
1706
+ uint8_t second = bytes[n - tail + 1];
1707
+ if ((lead == 0xe0 && second < 0xa0) || (lead == 0xed && second > 0x9f) ||
1708
+ (lead == 0xf0 && second < 0x90) || (lead == 0xf4 && second > 0x8f)) return 0;
1709
+ }
1710
+ return tail;
1711
+ }
1712
+
1713
+ ScrStr *scr_text_decode_stream(ScrDyn *state, const ScrBytes *input,
1714
+ double encoding, bool fatal, bool ignore_bom, bool stream) {
1715
+ ScrDyn *saved = scr_dyn_obj_read(state, "pending", 7);
1716
+ size_t pending = saved->kind == SCR_DYN_BYTES ? saved->v.bytes->len : 0;
1717
+ if (input->len > SIZE_MAX - pending) scr_bytes_oom();
1718
+ ScrBytes *combined = scr_bytes_new(SCR_BYTES_U8, (double)(pending + input->len));
1719
+ if (pending) memcpy(combined->data, saved->v.bytes->data, pending);
1720
+ if (input->len) memcpy(combined->data + pending, input->data, input->len);
1721
+ scr_dyn_release(saved);
1722
+ ScrDyn *bom = scr_dyn_obj_read(state, "bom", 3);
1723
+ bool seen_bom = scr_dyn_truthy(bom);
1724
+ scr_dyn_release(bom);
1725
+ size_t hold = stream && encoding < 0 ? scr_td_utf8_tail(combined->data, combined->len) : 0;
1726
+ #ifdef SCR_TEXT_DECODER_LEGACY
1727
+ if (stream && ((unsigned)encoding == SCR_TD_UTF16LE || (unsigned)encoding == SCR_TD_UTF16BE)) {
1728
+ size_t complete = combined->len & ~(size_t)1;
1729
+ hold = combined->len - complete;
1730
+ if (complete >= 2) {
1731
+ const uint8_t *last = combined->data + complete - 2;
1732
+ uint16_t unit = (unsigned)encoding == SCR_TD_UTF16BE
1733
+ ? ((uint16_t)last[0] << 8) | last[1] : last[0] | ((uint16_t)last[1] << 8);
1734
+ if (unit >= 0xd800 && unit <= 0xdbff) hold += 2;
1735
+ }
1736
+ }
1737
+ if (stream && encoding >= SCR_TD_GB18030) {
1738
+ scr_bytes_release(combined);
1739
+ static const char message[] = "Streaming TextDecoder for this legacy encoding has no native lowering";
1740
+ scr_throw_error_msg_code(SCR_ERR_ERROR, message, sizeof message - 1, "SC2020");
1741
+ return NULL;
1742
+ }
1743
+ #endif
1744
+ size_t complete = combined->len - hold;
1745
+ ScrBytes *tail = scr_bytes_new(SCR_BYTES_U8, (double)hold);
1746
+ if (hold) memcpy(tail->data, combined->data + complete, hold);
1747
+ scr_dyn_obj_set(state, "pending", 7, scr_dyn_new_bytes(tail));
1748
+ scr_bytes_release(tail);
1749
+ scr_dyn_obj_set(state, "bom", 3, scr_dyn_new_bool(stream && (seen_bom || complete > 0)));
1750
+ combined->len = complete;
1751
+ ScrStr *result;
1752
+ if (encoding < 0) result = scr_text_decode_options(combined, fatal, ignore_bom || seen_bom);
1753
+ #ifdef SCR_TEXT_DECODER_LEGACY
1754
+ else result = scr_text_decode_legacy_options(combined, encoding, fatal, ignore_bom || seen_bom);
1755
+ #else
1756
+ else { result = NULL; scr_trap("legacy TextDecoder requires its runtime pack variant"); }
1757
+ #endif
1758
+ scr_bytes_release(combined);
1759
+ return result;
1760
+ }
1761
+
1598
1762
  /* Decode the next code point from an ScrStr's storage — ALWAYS valid
1599
1763
  * UTF-8 (the string runtime never stores ill-formed sequences), so no
1600
1764
  * validation re-runs here. */