@mirascript/mirascript 0.1.15 → 0.1.17

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 (229) hide show
  1. package/dist/chunk-JG3D67GF.js +1625 -0
  2. package/dist/chunk-JG3D67GF.js.map +6 -0
  3. package/dist/chunk-RIT53WVY.js +1 -0
  4. package/dist/chunk-RLWIIOH5.js +12 -0
  5. package/dist/chunk-RLWIIOH5.js.map +6 -0
  6. package/dist/{chunk-NT235HY3.js → chunk-W2I5XPIE.js} +1490 -608
  7. package/dist/chunk-W2I5XPIE.js.map +6 -0
  8. package/dist/cli/index.js +11 -67
  9. package/dist/cli/index.js.map +2 -2
  10. package/dist/compiler/compile-fast.d.ts +1 -1
  11. package/dist/compiler/compile-fast.d.ts.map +1 -1
  12. package/dist/compiler/create-script.d.ts +10 -1
  13. package/dist/compiler/create-script.d.ts.map +1 -1
  14. package/dist/compiler/diagnostic.d.ts +1 -1
  15. package/dist/compiler/diagnostic.d.ts.map +1 -1
  16. package/dist/compiler/emit/constants.d.ts +3 -0
  17. package/dist/compiler/emit/constants.d.ts.map +1 -0
  18. package/dist/compiler/emit/consts.d.ts +6 -0
  19. package/dist/compiler/emit/consts.d.ts.map +1 -0
  20. package/dist/compiler/emit/globals.d.ts +17 -0
  21. package/dist/compiler/emit/globals.d.ts.map +1 -0
  22. package/dist/compiler/emit/index.d.ts +58 -0
  23. package/dist/compiler/emit/index.d.ts.map +1 -0
  24. package/dist/compiler/emit/sourcemap.d.ts +6 -0
  25. package/dist/compiler/emit/sourcemap.d.ts.map +1 -0
  26. package/dist/compiler/index.d.ts +3 -2
  27. package/dist/compiler/index.d.ts.map +1 -1
  28. package/dist/compiler/worker.js +1 -1
  29. package/dist/helpers/constants.d.ts +10 -0
  30. package/dist/helpers/constants.d.ts.map +1 -1
  31. package/dist/helpers/convert/index.d.ts +5 -0
  32. package/dist/helpers/convert/index.d.ts.map +1 -0
  33. package/dist/helpers/convert/to-boolean.d.ts +4 -0
  34. package/dist/helpers/convert/to-boolean.d.ts.map +1 -0
  35. package/dist/helpers/convert/to-format.d.ts +4 -0
  36. package/dist/helpers/convert/to-format.d.ts.map +1 -0
  37. package/dist/helpers/convert/to-number.d.ts +4 -0
  38. package/dist/helpers/convert/to-number.d.ts.map +1 -0
  39. package/dist/helpers/convert/to-string.d.ts +6 -0
  40. package/dist/helpers/convert/to-string.d.ts.map +1 -0
  41. package/dist/{vm → helpers}/error.d.ts +1 -1
  42. package/dist/helpers/error.d.ts.map +1 -0
  43. package/dist/helpers/serialize.d.ts +13 -4
  44. package/dist/helpers/serialize.d.ts.map +1 -1
  45. package/dist/helpers/types.d.ts +54 -0
  46. package/dist/helpers/types.d.ts.map +1 -0
  47. package/dist/index.js +11 -17
  48. package/dist/subtle.d.ts +4 -3
  49. package/dist/subtle.d.ts.map +1 -1
  50. package/dist/subtle.js +20 -16
  51. package/dist/vm/checkpoint.d.ts +9 -0
  52. package/dist/vm/checkpoint.d.ts.map +1 -0
  53. package/dist/vm/helpers.d.ts +4 -10
  54. package/dist/vm/helpers.d.ts.map +1 -1
  55. package/dist/vm/index.d.ts +3 -3
  56. package/dist/vm/index.d.ts.map +1 -1
  57. package/dist/vm/lib/global/bit.d.ts +7 -7
  58. package/dist/vm/lib/global/bit.d.ts.map +1 -1
  59. package/dist/vm/lib/global/debug.d.ts +2 -2
  60. package/dist/vm/lib/global/debug.d.ts.map +1 -1
  61. package/dist/vm/lib/global/index.d.ts +0 -1
  62. package/dist/vm/lib/global/index.d.ts.map +1 -1
  63. package/dist/vm/lib/global/json.d.ts +2 -2
  64. package/dist/vm/lib/global/json.d.ts.map +1 -1
  65. package/dist/vm/lib/global/math-additional.d.ts +1 -1
  66. package/dist/vm/lib/global/math-additional.d.ts.map +1 -1
  67. package/dist/vm/lib/global/math-arr.d.ts +5 -5
  68. package/dist/vm/lib/global/math-arr.d.ts.map +1 -1
  69. package/dist/vm/lib/global/math-unary.d.ts +26 -26
  70. package/dist/vm/lib/global/math-unary.d.ts.map +1 -1
  71. package/dist/vm/lib/global/math.d.ts +3 -3
  72. package/dist/vm/lib/global/math.d.ts.map +1 -1
  73. package/dist/vm/lib/global/sequence/all-any.d.ts +2 -2
  74. package/dist/vm/lib/global/sequence/all-any.d.ts.map +1 -1
  75. package/dist/vm/lib/global/sequence/entries.d.ts +5 -5
  76. package/dist/vm/lib/global/sequence/entries.d.ts.map +1 -1
  77. package/dist/vm/lib/global/sequence/find.d.ts +3 -3
  78. package/dist/vm/lib/global/sequence/find.d.ts.map +1 -1
  79. package/dist/vm/lib/global/sequence/flatten.d.ts +1 -1
  80. package/dist/vm/lib/global/sequence/flatten.d.ts.map +1 -1
  81. package/dist/vm/lib/global/sequence/len.d.ts +1 -1
  82. package/dist/vm/lib/global/sequence/len.d.ts.map +1 -1
  83. package/dist/vm/lib/global/sequence/map-filter.d.ts +3 -3
  84. package/dist/vm/lib/global/sequence/map-filter.d.ts.map +1 -1
  85. package/dist/vm/lib/global/sequence/repeat.d.ts +1 -1
  86. package/dist/vm/lib/global/sequence/repeat.d.ts.map +1 -1
  87. package/dist/vm/lib/global/sequence/reverse.d.ts +1 -1
  88. package/dist/vm/lib/global/sequence/reverse.d.ts.map +1 -1
  89. package/dist/vm/lib/global/sequence/sort.d.ts +2 -2
  90. package/dist/vm/lib/global/sequence/sort.d.ts.map +1 -1
  91. package/dist/vm/lib/global/sequence/with.d.ts +2 -2
  92. package/dist/vm/lib/global/sequence/with.d.ts.map +1 -1
  93. package/dist/vm/lib/global/sequence/zip.d.ts +1 -1
  94. package/dist/vm/lib/global/sequence/zip.d.ts.map +1 -1
  95. package/dist/vm/lib/global/string.d.ts +10 -10
  96. package/dist/vm/lib/global/string.d.ts.map +1 -1
  97. package/dist/vm/lib/global/time.d.ts +3 -13
  98. package/dist/vm/lib/global/time.d.ts.map +1 -1
  99. package/dist/vm/lib/global/to-primitive.d.ts +4 -4
  100. package/dist/vm/lib/global/to-primitive.d.ts.map +1 -1
  101. package/dist/vm/lib/helpers.d.ts +53 -0
  102. package/dist/vm/lib/helpers.d.ts.map +1 -0
  103. package/dist/vm/lib/index.d.ts +4 -0
  104. package/dist/vm/lib/index.d.ts.map +1 -0
  105. package/dist/vm/lib/{_loader.d.ts → loader.d.ts} +5 -5
  106. package/dist/vm/lib/loader.d.ts.map +1 -0
  107. package/dist/vm/lib/mod/index.d.ts +2 -0
  108. package/dist/vm/lib/mod/index.d.ts.map +1 -0
  109. package/dist/vm/lib/mod/matrix.d.ts +15 -0
  110. package/dist/vm/lib/mod/matrix.d.ts.map +1 -0
  111. package/dist/vm/operations.d.ts +2 -4
  112. package/dist/vm/operations.d.ts.map +1 -1
  113. package/dist/vm/types/boundary.d.ts +1 -1
  114. package/dist/vm/types/boundary.d.ts.map +1 -1
  115. package/dist/vm/types/context.d.ts +4 -17
  116. package/dist/vm/types/context.d.ts.map +1 -1
  117. package/dist/vm/types/extern.d.ts +1 -3
  118. package/dist/vm/types/extern.d.ts.map +1 -1
  119. package/dist/vm/types/function.d.ts +1 -6
  120. package/dist/vm/types/function.d.ts.map +1 -1
  121. package/dist/vm/types/index.d.ts +31 -17
  122. package/dist/vm/types/index.d.ts.map +1 -1
  123. package/dist/vm/types/module.d.ts +2 -4
  124. package/dist/vm/types/module.d.ts.map +1 -1
  125. package/dist/vm/types/wrapper.d.ts +0 -2
  126. package/dist/vm/types/wrapper.d.ts.map +1 -1
  127. package/package.json +7 -3
  128. package/src/cli/index.ts +1 -1
  129. package/src/compiler/compile-fast.ts +1 -2
  130. package/src/compiler/create-script.ts +12 -2
  131. package/src/compiler/diagnostic.ts +17 -8
  132. package/src/compiler/emit/constants.ts +2 -0
  133. package/src/compiler/emit/consts.ts +47 -0
  134. package/src/compiler/emit/globals.ts +39 -0
  135. package/src/compiler/{emit.ts → emit/index.ts} +16 -200
  136. package/src/compiler/emit/sourcemap.ts +168 -0
  137. package/src/compiler/index.ts +9 -9
  138. package/src/compiler/worker.ts +1 -1
  139. package/src/helpers/constants.ts +12 -0
  140. package/src/helpers/convert/index.ts +4 -0
  141. package/src/helpers/convert/to-boolean.ts +12 -0
  142. package/src/helpers/convert/to-format.ts +37 -0
  143. package/src/helpers/convert/to-number.ts +35 -0
  144. package/src/helpers/convert/to-string.ts +55 -0
  145. package/src/{vm → helpers}/error.ts +1 -1
  146. package/src/helpers/serialize.ts +72 -24
  147. package/src/helpers/types.ts +267 -0
  148. package/src/subtle.ts +4 -2
  149. package/src/vm/checkpoint.ts +42 -0
  150. package/src/vm/helpers.ts +9 -53
  151. package/src/vm/index.ts +3 -3
  152. package/src/vm/lib/global/bit.ts +8 -9
  153. package/src/vm/lib/global/debug.ts +5 -4
  154. package/src/vm/lib/global/index.ts +0 -1
  155. package/src/vm/lib/global/json.ts +2 -2
  156. package/src/vm/lib/global/math-additional.ts +2 -4
  157. package/src/vm/lib/global/math-arr.ts +1 -1
  158. package/src/vm/lib/global/math-unary.ts +2 -4
  159. package/src/vm/lib/global/math.ts +3 -4
  160. package/src/vm/lib/global/sequence/all-any.ts +11 -6
  161. package/src/vm/lib/global/sequence/entries.ts +1 -1
  162. package/src/vm/lib/global/sequence/find.ts +4 -3
  163. package/src/vm/lib/global/sequence/flatten.ts +2 -3
  164. package/src/vm/lib/global/sequence/len.ts +1 -1
  165. package/src/vm/lib/global/sequence/map-filter.ts +4 -3
  166. package/src/vm/lib/global/sequence/repeat.ts +2 -4
  167. package/src/vm/lib/global/sequence/reverse.ts +1 -1
  168. package/src/vm/lib/global/sequence/sort.ts +6 -5
  169. package/src/vm/lib/global/sequence/with.ts +21 -20
  170. package/src/vm/lib/global/sequence/zip.ts +3 -3
  171. package/src/vm/lib/global/string.ts +16 -27
  172. package/src/vm/lib/global/time.ts +59 -30
  173. package/src/vm/lib/global/to-primitive.ts +27 -18
  174. package/src/vm/lib/{_helpers.ts → helpers.ts} +132 -44
  175. package/src/vm/lib/index.ts +16 -0
  176. package/src/vm/lib/{_loader.ts → loader.ts} +3 -11
  177. package/src/vm/lib/mod/index.ts +1 -0
  178. package/src/vm/lib/{global/mod → mod}/matrix.ts +9 -7
  179. package/src/vm/operations.ts +41 -137
  180. package/src/vm/types/boundary.ts +10 -13
  181. package/src/vm/types/context.ts +31 -50
  182. package/src/vm/types/extern.ts +8 -15
  183. package/src/vm/types/function.ts +4 -19
  184. package/src/vm/types/index.ts +47 -25
  185. package/src/vm/types/module.ts +3 -7
  186. package/src/vm/types/wrapper.ts +1 -5
  187. package/dist/chunk-35JGBXRE.js +0 -1
  188. package/dist/chunk-JVFUK7AN.js +0 -2324
  189. package/dist/chunk-JVFUK7AN.js.map +0 -6
  190. package/dist/chunk-NT235HY3.js.map +0 -6
  191. package/dist/compiler/emit.d.ts +0 -5
  192. package/dist/compiler/emit.d.ts.map +0 -1
  193. package/dist/vm/error.d.ts.map +0 -1
  194. package/dist/vm/lib/_helpers.d.ts +0 -35
  195. package/dist/vm/lib/_helpers.d.ts.map +0 -1
  196. package/dist/vm/lib/_loader.d.ts.map +0 -1
  197. package/dist/vm/lib/global/mod/index.d.ts +0 -3
  198. package/dist/vm/lib/global/mod/index.d.ts.map +0 -1
  199. package/dist/vm/lib/global/mod/matrix.d.ts +0 -15
  200. package/dist/vm/lib/global/mod/matrix.d.ts.map +0 -1
  201. package/dist/vm/types/any.d.ts +0 -10
  202. package/dist/vm/types/any.d.ts.map +0 -1
  203. package/dist/vm/types/array.d.ts +0 -12
  204. package/dist/vm/types/array.d.ts.map +0 -1
  205. package/dist/vm/types/callable.d.ts +0 -5
  206. package/dist/vm/types/callable.d.ts.map +0 -1
  207. package/dist/vm/types/const.d.ts +0 -15
  208. package/dist/vm/types/const.d.ts.map +0 -1
  209. package/dist/vm/types/immutable.d.ts +0 -15
  210. package/dist/vm/types/immutable.d.ts.map +0 -1
  211. package/dist/vm/types/primitive.d.ts +0 -7
  212. package/dist/vm/types/primitive.d.ts.map +0 -1
  213. package/dist/vm/types/record.d.ts +0 -20
  214. package/dist/vm/types/record.d.ts.map +0 -1
  215. package/dist/vm/types/script.d.ts +0 -14
  216. package/dist/vm/types/script.d.ts.map +0 -1
  217. package/dist/vm/types/value.d.ts +0 -14
  218. package/dist/vm/types/value.d.ts.map +0 -1
  219. package/src/vm/lib/global/mod/index.ts +0 -4
  220. package/src/vm/types/any.ts +0 -33
  221. package/src/vm/types/array.ts +0 -19
  222. package/src/vm/types/callable.ts +0 -10
  223. package/src/vm/types/const.ts +0 -109
  224. package/src/vm/types/immutable.ts +0 -22
  225. package/src/vm/types/primitive.ts +0 -14
  226. package/src/vm/types/record.ts +0 -53
  227. package/src/vm/types/script.ts +0 -18
  228. package/src/vm/types/value.ts +0 -22
  229. /package/dist/{chunk-35JGBXRE.js.map → chunk-RIT53WVY.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/vm/types/module.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,oBAAoB;AACpB,qBAAa,QAAQ,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;IAErG,WAAW;IACX,QAAQ,CAAC,IAAI,EAAE,MAAM;;IADrB,WAAW;IACF,IAAI,EAAE,MAAM;IACrB,WAAW;IACX,KAAK,EAAE,CAAC;IAIZ,kBAAkB;IACT,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAGlC,kBAAkB;IACT,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK;IAIhC,kBAAkB;IACT,IAAI,IAAI,MAAM,EAAE;IAGzB,kBAAkB;IACT,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IAGpC,kBAAkB;IAClB,IAAa,IAAI,IAAI,QAAQ,CAE5B;IACD,kBAAkB;IAClB,IAAa,QAAQ,IAAI,MAAM,CAE9B;CACJ;AAID,2BAA2B;AAC3B,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAAC,CAAC,CAAC,CAElG"}
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/vm/types/module.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,oBAAoB;AACpB,qBAAa,QAAQ,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;IAE7G,WAAW;IACX,QAAQ,CAAC,IAAI,EAAE,MAAM;;IADrB,WAAW;IACF,IAAI,EAAE,MAAM;IACrB,WAAW;IACX,KAAK,EAAE,CAAC;IAIZ,kBAAkB;IACT,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAGlC,kBAAkB;IACT,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK;IAIhC,kBAAkB;IACT,IAAI,IAAI,MAAM,EAAE;IAGzB,kBAAkB;IACT,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IAGpC,kBAAkB;IAClB,IAAa,IAAI,IAAI,QAAQ,CAE5B;IACD,kBAAkB;IAClB,IAAa,QAAQ,IAAI,MAAM,CAE9B;CACJ"}
@@ -22,6 +22,4 @@ export declare abstract class VmWrapper<T extends object> {
22
22
  /** 转为字符串 */
23
23
  toString(useBraces: boolean): string;
24
24
  }
25
- /** 检查值是否为 MiraScript 包装器 */
26
- export declare function isVmWrapper<T extends object>(value: unknown): value is VmWrapper<T>;
27
25
  //# sourceMappingURL=wrapper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../../../src/vm/types/wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAElD;;GAEG;AACH,8BAAsB,SAAS,CAAC,CAAC,SAAS,MAAM;IAChC,QAAQ,CAAC,KAAK,EAAE,CAAC;gBAAR,KAAK,EAAE,CAAC;IAC7B,cAAc;IACd,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAClC,cAAc;IACd,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK;IAChC,WAAW;IACX,QAAQ,CAAC,IAAI,IAAI,MAAM,EAAE;IACzB,aAAa;IACb,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IACpC,WAAW;IACX,QAAQ,KAAK,IAAI,IAAI,QAAQ,CAAC;IAC9B,WAAW;IACX,QAAQ,KAAK,QAAQ,IAAI,MAAM,CAAC;IAChC,iCAAiC;IACjC,MAAM,IAAI,SAAS;IAGnB,YAAY;IACZ,QAAQ,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM;CAKvC;AAID,4BAA4B;AAC5B,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAAC,CAAC,CAAC,CAEnF"}
1
+ {"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../../../src/vm/types/wrapper.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAElD;;GAEG;AACH,8BAAsB,SAAS,CAAC,CAAC,SAAS,MAAM;IAChC,QAAQ,CAAC,KAAK,EAAE,CAAC;gBAAR,KAAK,EAAE,CAAC;IAC7B,cAAc;IACd,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAClC,cAAc;IACd,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,KAAK;IAChC,WAAW;IACX,QAAQ,CAAC,IAAI,IAAI,MAAM,EAAE;IACzB,aAAa;IACb,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IACpC,WAAW;IACX,QAAQ,KAAK,IAAI,IAAI,QAAQ,CAAC;IAC9B,WAAW;IACX,QAAQ,KAAK,QAAQ,IAAI,MAAM,CAAC;IAChC,iCAAiC;IACjC,MAAM,IAAI,SAAS;IAGnB,YAAY;IACZ,QAAQ,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM;CAKvC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirascript/mirascript",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "author": "CloudPSS",
5
5
  "license": "MIT",
6
6
  "description": "An expression based scripting language.",
@@ -20,9 +20,11 @@
20
20
  "./cli": {
21
21
  "@mirascript/dev": "./src/cli/index.ts",
22
22
  "default": "./dist/cli/index.js"
23
- }
23
+ },
24
+ "./package.json": "./package.json"
24
25
  },
25
26
  "imports": {
27
+ "#package.json": "./package.json",
26
28
  "#compiler/worker": {
27
29
  "@mirascript/dev": "./src/compiler/worker.ts",
28
30
  "default": "./dist/compiler/worker.js"
@@ -34,13 +36,14 @@
34
36
  "commander": "^14.0.2",
35
37
  "source-map-js": "^1.2.1",
36
38
  "supports-color": "^10.2.2",
37
- "@mirascript/bindings": "~0.1.15"
39
+ "@mirascript/bindings": "~0.1.17"
38
40
  },
39
41
  "devDependencies": {
40
42
  "@types/node": "^24.10.1",
41
43
  "@types/sinon": "^21.0.0",
42
44
  "ava": "^6.4.1",
43
45
  "c8": "^10.1.3",
46
+ "madge": "^8.0.0",
44
47
  "sinon": "^21.0.0",
45
48
  "type-fest": "^5.2.0"
46
49
  },
@@ -49,6 +52,7 @@
49
52
  "build:ts": "pnpm clean && tsc",
50
53
  "build": "pnpm build:ts --emitDeclarationOnly && node ./esbuild.config.js",
51
54
  "mirascript": "node --enable-source-maps ./dist/cli/index.js",
55
+ "deps": "madge --circular --warning ./src",
52
56
  "clean": "rimraf dist",
53
57
  "test": "c8 ava"
54
58
  }
package/src/cli/index.ts CHANGED
@@ -4,7 +4,7 @@ import { readFile, stat } from 'node:fs/promises';
4
4
  import { pathToFileURL } from 'node:url';
5
5
  import { InvalidArgumentError, program } from '@commander-js/extra-typings';
6
6
  import { execute } from './execute.js';
7
- import pkg from '../../package.json' with { type: 'json' };
7
+ import pkg from '#package.json' with { type: 'json' };
8
8
  import { compileSync } from '../compiler/index.js';
9
9
  import { configCheckpoint, type VmValue } from '../vm/index.js';
10
10
 
@@ -1,6 +1,5 @@
1
- import { wrapScript } from './create-script.js';
1
+ import { wrapScript, type VmScript } from './create-script.js';
2
2
  import type { TranspileOptions } from './types.js';
3
- import type { VmScript } from '../vm/types/index.js';
4
3
  import { GlobalFallback } from '../vm/helpers.js';
5
4
  import { isFinite } from '../helpers/utils.js';
6
5
 
@@ -1,9 +1,18 @@
1
+ import { kVmScript, VM_SCRIPT_NAME } from '../helpers/constants.js';
1
2
  import { defineProperty } from '../helpers/utils.js';
2
3
  import { keys, values } from '../vm/env.js';
3
- import type { VmScript, VmScriptLike } from '../vm/types/script.js';
4
+ import type { VmValue, VmContext } from '../vm/types/index.js';
4
5
  import type { ScriptInput } from './types.js';
5
6
 
6
- const kVmScript = Symbol.for('mirascript.vm.script');
7
+ /** Mirascript 脚本 */
8
+ export type VmScriptLike = (global?: VmContext) => VmValue;
9
+
10
+ /** Mirascript 脚本 */
11
+ export type VmScript = VmScriptLike & {
12
+ readonly [kVmScript]: true;
13
+ /** 原始代码 */
14
+ readonly source: string;
15
+ };
7
16
 
8
17
  /** 生成 JS 函数 */
9
18
  export function wrapScript(source: ScriptInput, script: VmScriptLike): VmScript {
@@ -11,6 +20,7 @@ export function wrapScript(source: ScriptInput, script: VmScriptLike): VmScript
11
20
  if (kVmScript in script) {
12
21
  return script as VmScriptLike as VmScript;
13
22
  }
23
+ defineProperty(script, 'name', { value: VM_SCRIPT_NAME });
14
24
  defineProperty(script, kVmScript, { value: true });
15
25
  if (typeof source === 'string') {
16
26
  defineProperty(script, 'source', { value: source, configurable: true });
@@ -183,13 +183,22 @@ function formatRange(range: IRange): string {
183
183
  }
184
184
 
185
185
  /** 生成诊断消息的字符串 */
186
- export function formatDiagnostic(diagnostic: SourceDiagnostic): string {
187
- const range = formatRange(diagnostic.range);
188
- const codeName = DiagnosticCode[diagnostic.code] || `Unknown(${diagnostic.code})`;
189
- let message = getDiagnosticMessage(diagnostic.code);
190
- for (const ref of diagnostic.references) {
191
- const refRange = formatRange(ref.range);
192
- message += `\n (${refRange}): ${getDiagnosticMessage(ref.code)}`;
186
+ export function formatDiagnostics(
187
+ diagnostics: Iterable<SourceDiagnostic>,
188
+ source: ScriptInput,
189
+ fileName: string | undefined,
190
+ ): string[] {
191
+ const rangePrefix = fileName ? `${fileName}:` : '';
192
+ const messages: string[] = [];
193
+ for (const diagnostic of diagnostics) {
194
+ const range = formatRange(diagnostic.range);
195
+ const codeName = DiagnosticCode[diagnostic.code] || `Unknown(${diagnostic.code})`;
196
+ let message = getDiagnosticMessage(diagnostic.code);
197
+ for (const ref of diagnostic.references) {
198
+ const refRange = formatRange(ref.range);
199
+ message += `\n (${refRange}): ${getDiagnosticMessage(ref.code)}`;
200
+ }
201
+ messages.push(` ${codeName}(${rangePrefix}${range}): ${message}`);
193
202
  }
194
- return ` ${codeName}(${range}): ${message}`;
203
+ return messages;
195
204
  }
@@ -0,0 +1,2 @@
1
+ export const SCRIPT_PREFIX = `'use strict'; return ((global = GlobalFallback()) => { try { CpEnter();`;
2
+ export const GLOBAL_HINT = `/* globals */`;
@@ -0,0 +1,47 @@
1
+ import type { VmPrimitive } from '../../vm/index.js';
2
+
3
+ /** 将值转为 JS 字面量 */
4
+ export function toJsLiteral(value: VmPrimitive | undefined): string {
5
+ /* c8 ignore next 2 */
6
+ if (value === null) return 'null';
7
+ if (value === undefined) return 'undefined';
8
+ if (typeof value == 'string') {
9
+ return JSON.stringify(value);
10
+ }
11
+ // JSON 无法处理 NaN 等特殊数字
12
+ if (value === 0) {
13
+ if (1 / value === -Infinity) return '-0';
14
+ return '0';
15
+ }
16
+ return String(value satisfies number | boolean);
17
+ }
18
+
19
+ /** 解析常量 */
20
+ export function readConst(reader: DataView, offset: number): [value: VmPrimitive, consumed: number] {
21
+ const type = reader.getUint8(offset);
22
+ switch (type) {
23
+ /* c8 ignore next 2 */
24
+ case 0:
25
+ return [null, 1];
26
+ case 1:
27
+ return [true, 1];
28
+ case 2:
29
+ return [false, 1];
30
+ case 3: {
31
+ const ordinal = reader.getInt32(offset + 1, true);
32
+ return [ordinal, 5];
33
+ }
34
+ case 4: {
35
+ const num = reader.getFloat64(offset + 1, true);
36
+ return [num, 9];
37
+ }
38
+ case 5: {
39
+ const len = reader.getUint32(offset + 1, true);
40
+ const str = new TextDecoder().decode(new Uint8Array(reader.buffer, reader.byteOffset + offset + 5, len));
41
+ return [str, 5 + len];
42
+ }
43
+ /* c8 ignore next 2 */
44
+ default:
45
+ throw new Error(`Unknown constant type: ${type}`);
46
+ }
47
+ }
@@ -0,0 +1,39 @@
1
+ import { toString } from '../../helpers/convert/to-string.js';
2
+ import { toJsLiteral } from './consts.js';
3
+ import type { Emitter } from './index.js';
4
+
5
+ /** 全局变量描述符 */
6
+ export type GlobalDesc = {
7
+ /** 变量编译后的名称 */
8
+ v: string;
9
+ /** 变量名字的字面量,是一个 JS 字符串字面量 */
10
+ l: string;
11
+ /** 变量的表达式,用于获取全局变量 */
12
+ e: string;
13
+ /** 变量的名称 */
14
+ n: string;
15
+ };
16
+
17
+ /** 全局变量映射,key 为变量名在常量表中的索引 */
18
+ export type GlobalMap = Map<number, GlobalDesc>;
19
+
20
+ /** 获取全局变量映射 */
21
+ export function readGlobal(emitter: Emitter, constIdx: number): GlobalDesc {
22
+ const { globals } = emitter;
23
+ const cached = globals.get(constIdx);
24
+ if (cached) return cached;
25
+ const constName = emitter.constVals[constIdx]!;
26
+ let name, lit;
27
+ if (typeof constName == 'string') {
28
+ name = constName;
29
+ lit = emitter.constLits[constIdx]!;
30
+ } else {
31
+ name = toString(constName, undefined);
32
+ lit = toJsLiteral(name);
33
+ }
34
+ const val = `g${globals.size + 1}`;
35
+ const expr = `(${val} === undefined ? (${val} = global.get(${lit})) : ${val})`;
36
+ const desc: GlobalDesc = { v: val, l: lit, e: expr, n: name };
37
+ globals.set(constIdx, desc);
38
+ return desc;
39
+ }
@@ -1,9 +1,10 @@
1
1
  import { OpCode } from '@mirascript/bindings';
2
- import type { VmConst, VmPrimitive } from '../vm/index.js';
3
- import { $ToString } from '../vm/operations.js';
4
- import type { ScriptInput, TranspileOptions } from './types.js';
5
- import type { IRange } from './diagnostic.js';
6
- import { SourceMapGenerator } from 'source-map-js';
2
+ import type { VmPrimitive } from '../../vm/index.js';
3
+ import type { ScriptInput, TranspileOptions } from '../types.js';
4
+ import type { IRange } from '../diagnostic.js';
5
+ import { readGlobal, type GlobalMap } from './globals.js';
6
+ import { readConst, toJsLiteral } from './consts.js';
7
+ import { createSourceMap } from './sourcemap.js';
7
8
 
8
9
  /** 生成代码 */
9
10
  export function emit(
@@ -18,55 +19,6 @@ export function emit(
18
19
  return code;
19
20
  }
20
21
 
21
- /** 解析常量 */
22
- function readConst(reader: DataView, offset: number): [value: VmPrimitive, consumed: number] {
23
- const type = reader.getUint8(offset);
24
- switch (type) {
25
- /* c8 ignore next 2 */
26
- case 0:
27
- return [null, 1];
28
- case 1:
29
- return [true, 1];
30
- case 2:
31
- return [false, 1];
32
- case 3: {
33
- const ordinal = reader.getInt32(offset + 1, true);
34
- return [ordinal, 5];
35
- }
36
- case 4: {
37
- const num = reader.getFloat64(offset + 1, true);
38
- return [num, 9];
39
- }
40
- case 5: {
41
- const len = reader.getUint32(offset + 1, true);
42
- const str = new TextDecoder().decode(new Uint8Array(reader.buffer, reader.byteOffset + offset + 5, len));
43
- return [str, 5 + len];
44
- }
45
- /* c8 ignore next 2 */
46
- default:
47
- throw new Error(`Unknown constant type: ${type}`);
48
- }
49
- }
50
-
51
- /** 将值转为 JS */
52
- function toJavascript(value: VmConst | undefined): string {
53
- /* c8 ignore next 2 */
54
- if (value === null) return 'null';
55
- if (value === undefined) return 'undefined';
56
- if (typeof value == 'object' || typeof value == 'string') {
57
- return JSON.stringify(value);
58
- }
59
- // JSON 无法处理 NaN 等特殊数字
60
- if (value === 0) {
61
- if (1 / value === -Infinity) return '-0';
62
- return '0';
63
- }
64
- return String(value);
65
- }
66
-
67
- const ORIGIN = `mira://MiraScript/`;
68
- let sourceId = 1;
69
-
70
22
  /** 创建数组 */
71
23
  function createArray<T>(length: number, fn: (index: number) => T): T[] {
72
24
  // micro bench shows that this is faster than Array.from
@@ -80,7 +32,7 @@ function createArray<T>(length: number, fn: (index: number) => T): T[] {
80
32
  const SCRIPT_PREFIX = `'use strict'; return ((global = GlobalFallback()) => { try { CpEnter();`;
81
33
  const GLOBAL_HINT = `/* globals */`;
82
34
  /** 代码生成 */
83
- class Emitter {
35
+ export class Emitter {
84
36
  constructor(
85
37
  readonly source: ScriptInput,
86
38
  readonly chunk: Uint8Array,
@@ -106,7 +58,7 @@ class Emitter {
106
58
  for (let i = 0, index = 0; i < this.constSize; index++) {
107
59
  const [constant, size] = readConst(this.constReader, i);
108
60
  this.constVals.push(constant);
109
- this.constLits.push(toJavascript(constant));
61
+ this.constLits.push(toJsLiteral(constant));
110
62
  i += size;
111
63
  }
112
64
  }
@@ -125,24 +77,10 @@ class Emitter {
125
77
  return ' '.repeat(this.identCounter + len);
126
78
  }
127
79
 
128
- readonly globals = new Map<number, [val: string, lit: string, eager: boolean, expr: string, name: string]>();
80
+ readonly globals: GlobalMap = new Map();
129
81
  /** 读取全局变量 */
130
82
  private rg(constIdx: number, eager: boolean): string {
131
- const cached = this.globals.get(constIdx);
132
- if (cached != null) {
133
- if (eager && !cached[2]) {
134
- cached[2] = true;
135
- cached[3] = cached[0];
136
- }
137
- return cached[3];
138
- }
139
- const constName = this.constVals[constIdx]!;
140
- const name = $ToString(constName);
141
- const lit = typeof constName == 'string' ? this.constLits[constIdx]! : JSON.stringify(name);
142
- const val = `g${this.globals.size + 1}`;
143
- const expr = eager ? val : `(${val} === undefined ? (${val} = global.get(${lit})) : ${val})`;
144
- this.globals.set(constIdx, [val, lit, eager, expr, name]);
145
- return expr;
83
+ return readGlobal(this, constIdx).e;
146
84
  }
147
85
 
148
86
  readonly codeLines: string[] = [];
@@ -655,12 +593,12 @@ class Emitter {
655
593
  }
656
594
  case OpCode.If: {
657
595
  const cond = read();
658
- code = `if (${this.rv(cond)} !== false && $ToBoolean(${this.rv(cond)}) !== false) {`;
596
+ code = `if ($ToBoolean(${this.rv(cond)})) {`;
659
597
  break;
660
598
  }
661
599
  case OpCode.IfNot: {
662
600
  const cond = read();
663
- code = `if (${this.rv(cond)} !== true && $ToBoolean(${this.rv(cond)}) !== true) {`;
601
+ code = `if (!$ToBoolean(${this.rv(cond)})) {`;
664
602
  break;
665
603
  }
666
604
  case OpCode.IfInit: {
@@ -769,9 +707,8 @@ class Emitter {
769
707
  this.readCode();
770
708
  if (this.globals.size > 0) {
771
709
  let globalsInit = '';
772
- for (const [val, lit, eager] of this.globals.values()) {
773
- const expr = eager ? `${val} = global.get(${lit})` : val;
774
- globalsInit += globalsInit ? `, ${expr}` : `var ${GLOBAL_HINT} ${expr}`;
710
+ for (const { v } of this.globals.values()) {
711
+ globalsInit += globalsInit ? `, ${v}` : `var ${GLOBAL_HINT} ${v}`;
775
712
  }
776
713
  this.codeLines[0] += globalsInit + ';';
777
714
  }
@@ -780,128 +717,7 @@ class Emitter {
780
717
  /** 添加源映射 */
781
718
  addSourceMap(): void {
782
719
  if (!this.options.sourceMap) return;
783
- let fileName = (this.options.fileName ?? '').trim();
784
- const hasSchema = /^\w+:/.test(fileName);
785
- if (!hasSchema) {
786
- if (fileName.startsWith('/')) {
787
- fileName = fileName.replace(/^\/+\s*/, '');
788
- }
789
- if (!fileName) {
790
- fileName = `${sourceId++}.${this.options.input_mode === 'Template' ? 'miratpl' : 'mira'}`;
791
- }
792
- }
793
- const map = new SourceMapGenerator({
794
- file: fileName + '.js',
795
- });
796
- if (typeof this.source === 'string') {
797
- map.setSourceContent(fileName, this.source);
798
- }
799
- let hasStartMap = false;
800
- for (let i = 1; i < this.sourcemaps.length; i++) {
801
- const range = this.sourcemaps[i];
802
- if (!range) break;
803
- if (!hasStartMap && range.startLineNumber === 1 && range.startColumn === 1) {
804
- hasStartMap = true;
805
- }
806
- map.addMapping({
807
- generated: {
808
- // 前两行固定为:
809
- // (function anonymous($Add,$Aeq, ...
810
- // ) {
811
- line: i + 3,
812
- column: 0,
813
- },
814
- original: {
815
- line: range.startLineNumber,
816
- column: range.startColumn - 1,
817
- },
818
- source: fileName,
819
- });
820
- }
821
- if (!hasStartMap) {
822
- map.addMapping({
823
- generated: {
824
- line: 3,
825
- column: SCRIPT_PREFIX.length - 'CpEnter();'.length,
826
- },
827
- original: {
828
- line: 1,
829
- column: 0,
830
- },
831
- source: fileName,
832
- });
833
- }
834
- {
835
- const line0 = this.codeLines[0]!;
836
- const file = `${fileName} <globals>`;
837
- let globals = `global;\n`;
838
- map.addMapping({
839
- generated: {
840
- line: 3,
841
- column: line0.indexOf(`global = `),
842
- },
843
- original: {
844
- line: 1,
845
- column: 0,
846
- },
847
- source: file,
848
- name: 'global',
849
- });
850
- map.addMapping({
851
- generated: {
852
- line: 3,
853
- column: SCRIPT_PREFIX.length,
854
- },
855
- original: {
856
- line: 1,
857
- column: 7,
858
- },
859
- source: file,
860
- name: '',
861
- });
862
- let i = 1;
863
- let pos = line0.indexOf(GLOBAL_HINT, SCRIPT_PREFIX.length) + GLOBAL_HINT.length;
864
- for (const p of this.globals.values()) {
865
- i++;
866
- if (pos < 0) break;
867
- const val = p[0];
868
- pos = line0.indexOf(val, pos);
869
- if (pos < 0) break;
870
- const name = p[4];
871
- map.addMapping({
872
- generated: {
873
- line: 3,
874
- column: pos,
875
- },
876
- original: {
877
- line: i,
878
- column: 0,
879
- },
880
- source: file,
881
- name,
882
- });
883
- globals += `${name};\n`;
884
- }
885
- map.addMapping({
886
- generated: {
887
- line: 3,
888
- column: pos,
889
- },
890
- original: {
891
- line: i,
892
- column: 0,
893
- },
894
- source: file,
895
- name: '',
896
- });
897
- map.setSourceContent(file, globals);
898
- }
899
- const prefix = '//# ';
900
- const sourceURL = hasSchema ? fileName : `${ORIGIN}${fileName}`;
901
- this.codeLines.push(
902
- // Prevent source map from being recognized as of this file
903
- `${prefix}sourceURL=${sourceURL}.js`,
904
- `${prefix}sourceMappingURL=data:application/json,${encodeURIComponent(map.toString())}`,
905
- );
720
+ const mapLines = createSourceMap(this.source, this.sourcemaps, this.codeLines, this.globals, this.options);
721
+ this.codeLines.push(...mapLines);
906
722
  }
907
723
  }
@@ -0,0 +1,168 @@
1
+ import type { IRange } from '../diagnostic.js';
2
+ import type { ScriptInput, TranspileOptions } from '../types.js';
3
+ import { SourceMapGenerator } from 'source-map-js';
4
+ import { GLOBAL_HINT, SCRIPT_PREFIX } from './constants.js';
5
+ import type { GlobalMap } from './globals.js';
6
+
7
+ const ORIGIN = `mira://MiraScript/`;
8
+ const { SOURCE_URL, SOURCE_MAPPING_URL } = ((source, mapping, url) => {
9
+ // 避免被识别为当前文件的源映射
10
+ const prefix = '//# ';
11
+ return {
12
+ SOURCE_URL: prefix.concat(source, url),
13
+ SOURCE_MAPPING_URL: prefix.concat(source, mapping, url),
14
+ };
15
+ })(`source`, `Mapping`, `URL`);
16
+ // 前两行固定为:
17
+ // (function anonymous($Add,$Aeq, ...
18
+ // ) {
19
+ const SOURCE_OFFSET = 3;
20
+
21
+ /**
22
+ * Node.js Buffer 类型的简易声明,@mirascript/playground 调试环境下会直接加载此文件
23
+ */
24
+ declare class Buffer {
25
+ /** @inheritdoc */
26
+ static from(str: string, encoding: 'utf8'): Buffer;
27
+ /** @inheritdoc */
28
+ toString(encoding: 'base64'): string;
29
+ }
30
+
31
+ const toDataUrl: (json: string) => string =
32
+ typeof Buffer == 'function' && typeof Buffer.from == 'function'
33
+ ? (s) => `data:application/json;base64,${Buffer.from(s, 'utf8').toString('base64')}`
34
+ : (s) => `data:application/json;charset=utf-8,${encodeURIComponent(s)}`;
35
+
36
+ /** 添加全局变量的源映射 */
37
+ function addGlobalMappings(globalLine: string, fileName: string, map: SourceMapGenerator, globals: GlobalMap) {
38
+ let globalFile = `global;\n`;
39
+ map.addMapping({
40
+ generated: {
41
+ line: 3,
42
+ column: globalLine.indexOf(`global = `),
43
+ },
44
+ original: {
45
+ line: 1,
46
+ column: 0,
47
+ },
48
+ source: fileName,
49
+ name: 'global',
50
+ });
51
+ map.addMapping({
52
+ generated: {
53
+ line: 3,
54
+ column: SCRIPT_PREFIX.length,
55
+ },
56
+ original: {
57
+ line: 1,
58
+ column: 7,
59
+ },
60
+ source: fileName,
61
+ name: '',
62
+ });
63
+ let i = 1;
64
+ let pos = globalLine.indexOf(GLOBAL_HINT, SCRIPT_PREFIX.length) + GLOBAL_HINT.length;
65
+ for (const p of globals.values()) {
66
+ i++;
67
+ if (pos < 0) break;
68
+ const { v, n } = p;
69
+ pos = globalLine.indexOf(v, pos);
70
+ if (pos < 0) break;
71
+ map.addMapping({
72
+ generated: {
73
+ line: 3,
74
+ column: pos,
75
+ },
76
+ original: {
77
+ line: i,
78
+ column: 0,
79
+ },
80
+ source: fileName,
81
+ name: n,
82
+ });
83
+ globalFile += `${n};\n`;
84
+ }
85
+ map.addMapping({
86
+ generated: {
87
+ line: 3,
88
+ column: pos,
89
+ },
90
+ original: {
91
+ line: i,
92
+ column: 0,
93
+ },
94
+ source: fileName,
95
+ name: '',
96
+ });
97
+ map.setSourceContent(fileName, globalFile);
98
+ }
99
+
100
+ let sourceId = 1;
101
+ /** 创建源映射 */
102
+ export function createSourceMap(
103
+ source: ScriptInput | undefined,
104
+ sourcemaps: readonly IRange[],
105
+ codeLines: readonly string[],
106
+ globals: GlobalMap,
107
+ options: TranspileOptions,
108
+ ): [string, string] {
109
+ let fileName = (options.fileName ?? '').trim();
110
+ const hasSchema = /^\w+:/.test(fileName);
111
+ if (!hasSchema) {
112
+ if (fileName.startsWith('/')) {
113
+ fileName = fileName.replace(/^\/+\s*/, '');
114
+ }
115
+ if (!fileName) {
116
+ fileName = `${sourceId++}.${options.input_mode === 'Template' ? 'miratpl' : 'mira'}`;
117
+ }
118
+ }
119
+ const map = new SourceMapGenerator({
120
+ file: fileName + '.js',
121
+ });
122
+ if (typeof source === 'string') {
123
+ map.setSourceContent(fileName, source);
124
+ }
125
+ let hasStartMap = false;
126
+ for (let i = 1; i < sourcemaps.length; i++) {
127
+ const range = sourcemaps[i];
128
+ if (!range) break;
129
+ if (!hasStartMap && range.startLineNumber === 1 && range.startColumn === 1) {
130
+ hasStartMap = true;
131
+ }
132
+ map.addMapping({
133
+ generated: {
134
+ line: i + SOURCE_OFFSET,
135
+ column: 0,
136
+ },
137
+ original: {
138
+ line: range.startLineNumber,
139
+ column: range.startColumn - 1,
140
+ },
141
+ source: fileName,
142
+ });
143
+ }
144
+ if (!hasStartMap) {
145
+ map.addMapping({
146
+ generated: {
147
+ line: SOURCE_OFFSET,
148
+ column: SCRIPT_PREFIX.length - 'CpEnter();'.length,
149
+ },
150
+ original: {
151
+ line: 1,
152
+ column: 0,
153
+ },
154
+ source: fileName,
155
+ });
156
+ }
157
+ const globalLine = codeLines[0];
158
+ if (globalLine?.includes(GLOBAL_HINT)) {
159
+ addGlobalMappings(globalLine, `${fileName} <globals>`, map, globals);
160
+ }
161
+ const sourceURL = hasSchema ? fileName : `${ORIGIN}${fileName}`;
162
+ const dataUrl = toDataUrl(map.toString());
163
+ return [
164
+ // Prevent source map from being recognized as of this file
165
+ `${SOURCE_URL}=${sourceURL}.js`,
166
+ `${SOURCE_MAPPING_URL}=${dataUrl}`,
167
+ ];
168
+ }