ventojs 0.10.2 → 0.12.0

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 (390) hide show
  1. package/README.md +35 -93
  2. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/assert/assert.js +1 -1
  3. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/assert/assertion_error.js +1 -1
  4. package/esm/deps/deno.land/std@0.219.1/html/entities.d.ts +39 -0
  5. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/html/entities.js +14 -15
  6. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/html/mod.d.ts +1 -1
  7. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/html/mod.js +2 -2
  8. package/esm/deps/deno.land/std@0.219.1/path/_common/assert_path.d.ts +1 -0
  9. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/assert_path.js +1 -1
  10. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/basename.js +1 -1
  11. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/common.js +9 -9
  12. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/constants.js +1 -1
  13. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/dirname.js +1 -1
  14. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/format.js +1 -1
  15. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/from_file_url.js +1 -1
  16. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/glob_to_reg_exp.js +4 -2
  17. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/normalize.js +1 -1
  18. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/normalize_string.js +1 -1
  19. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/relative.js +1 -1
  20. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/strip_trailing_separators.js +1 -1
  21. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/to_file_url.js +1 -1
  22. package/esm/deps/deno.land/std@0.219.1/path/_interface.js +3 -0
  23. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_os.js +1 -1
  24. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/basename.js +1 -1
  25. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/common.js +3 -3
  26. package/esm/deps/deno.land/std@0.219.1/path/constants.d.ts +3 -0
  27. package/esm/deps/deno.land/std@0.219.1/path/constants.js +6 -0
  28. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/dirname.js +1 -1
  29. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/extname.js +1 -1
  30. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/format.d.ts +1 -1
  31. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/format.js +1 -1
  32. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/from_file_url.js +1 -1
  33. package/{script/deps/deno.land/std@0.210.0 → esm/deps/deno.land/std@0.219.1}/path/glob_to_regexp.d.ts +2 -1
  34. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/glob_to_regexp.js +1 -1
  35. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/is_absolute.js +1 -1
  36. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/is_glob.js +1 -1
  37. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/join.js +1 -1
  38. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/join_globs.d.ts +1 -0
  39. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/join_globs.js +1 -1
  40. package/esm/deps/deno.land/std@0.219.1/path/mod.d.ts +56 -0
  41. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/mod.js +3 -8
  42. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/normalize.js +1 -1
  43. package/{script/deps/deno.land/std@0.210.0 → esm/deps/deno.land/std@0.219.1}/path/normalize_glob.d.ts +1 -0
  44. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/normalize_glob.js +1 -1
  45. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/parse.js +1 -1
  46. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/_util.js +1 -1
  47. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/basename.js +1 -1
  48. package/esm/deps/deno.land/{std@0.210.0/path/windows → std@0.219.1/path/posix}/common.js +3 -3
  49. package/esm/deps/deno.land/std@0.219.1/path/posix/constants.d.ts +3 -0
  50. package/esm/deps/deno.land/std@0.219.1/path/posix/constants.js +5 -0
  51. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/dirname.js +1 -1
  52. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/extname.js +1 -1
  53. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/format.js +1 -1
  54. package/{script/deps/deno.land/std@0.210.0 → esm/deps/deno.land/std@0.219.1}/path/posix/from_file_url.d.ts +1 -1
  55. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/from_file_url.js +2 -2
  56. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/glob_to_regexp.d.ts +1 -1
  57. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/glob_to_regexp.js +1 -1
  58. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/is_absolute.js +1 -1
  59. package/esm/deps/deno.land/{std@0.210.0/path/windows → std@0.219.1/path/posix}/is_glob.js +1 -1
  60. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/join.js +1 -1
  61. package/esm/deps/deno.land/{std@0.210.0/path/windows → std@0.219.1/path/posix}/join_globs.d.ts +2 -1
  62. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/join_globs.js +3 -3
  63. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/mod.d.ts +1 -3
  64. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/mod.js +2 -4
  65. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/normalize.js +1 -1
  66. package/{script/deps/deno.land/std@0.210.0 → esm/deps/deno.land/std@0.219.1}/path/posix/normalize_glob.d.ts +2 -1
  67. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/normalize_glob.js +3 -3
  68. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/parse.d.ts +1 -1
  69. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/parse.js +1 -1
  70. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/relative.js +1 -1
  71. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/resolve.js +1 -1
  72. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/to_file_url.d.ts +1 -1
  73. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/to_file_url.js +2 -2
  74. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/to_namespaced_path.js +1 -1
  75. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/relative.js +1 -1
  76. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/resolve.js +1 -1
  77. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/to_file_url.js +1 -1
  78. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/to_namespaced_path.js +1 -1
  79. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/_util.js +1 -1
  80. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/basename.js +1 -1
  81. package/esm/deps/deno.land/{std@0.210.0/path/posix → std@0.219.1/path/windows}/common.js +3 -3
  82. package/esm/deps/deno.land/std@0.219.1/path/windows/constants.d.ts +3 -0
  83. package/esm/deps/deno.land/std@0.219.1/path/windows/constants.js +5 -0
  84. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/dirname.js +1 -1
  85. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/extname.js +1 -1
  86. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/format.js +1 -1
  87. package/{script/deps/deno.land/std@0.210.0 → esm/deps/deno.land/std@0.219.1}/path/windows/from_file_url.d.ts +1 -1
  88. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/from_file_url.js +2 -2
  89. package/{script/deps/deno.land/std@0.210.0/path/posix → esm/deps/deno.land/std@0.219.1/path/windows}/glob_to_regexp.d.ts +1 -1
  90. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/glob_to_regexp.js +1 -1
  91. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/is_absolute.js +1 -1
  92. package/esm/deps/deno.land/{std@0.210.0/path/posix → std@0.219.1/path/windows}/is_glob.js +1 -1
  93. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/join.js +1 -1
  94. package/esm/deps/deno.land/{std@0.210.0/path/posix → std@0.219.1/path/windows}/join_globs.d.ts +2 -1
  95. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/join_globs.js +3 -3
  96. package/{script/deps/deno.land/std@0.210.0/path/posix → esm/deps/deno.land/std@0.219.1/path/windows}/mod.d.ts +1 -3
  97. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/mod.js +2 -4
  98. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/normalize.js +1 -1
  99. package/{script/deps/deno.land/std@0.210.0 → esm/deps/deno.land/std@0.219.1}/path/windows/normalize_glob.d.ts +2 -1
  100. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/normalize_glob.js +3 -3
  101. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/parse.d.ts +1 -1
  102. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/parse.js +1 -1
  103. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/relative.js +1 -1
  104. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/resolve.js +1 -1
  105. package/{script/deps/deno.land/std@0.210.0 → esm/deps/deno.land/std@0.219.1}/path/windows/to_file_url.d.ts +1 -1
  106. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/to_file_url.js +2 -2
  107. package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/to_namespaced_path.js +1 -1
  108. package/esm/deps/deno.land/x/astring@v1.8.6/src/astring.d.ts +109 -0
  109. package/esm/deps/deno.land/x/astring@v1.8.6/src/astring.js +1159 -0
  110. package/esm/deps.d.ts +6 -2
  111. package/esm/deps.js +5 -2
  112. package/esm/mod.d.ts +1 -0
  113. package/esm/mod.js +2 -0
  114. package/esm/plugins/auto_trim.d.ts +8 -0
  115. package/esm/plugins/auto_trim.js +36 -0
  116. package/esm/plugins/escape.js +2 -1
  117. package/esm/plugins/trim.d.ts +4 -0
  118. package/esm/plugins/trim.js +28 -0
  119. package/esm/plugins/unescape.js +2 -1
  120. package/esm/src/environment.d.ts +3 -0
  121. package/esm/src/environment.js +28 -7
  122. package/esm/src/tokenizer.js +6 -29
  123. package/esm/src/transformer.d.ts +1 -0
  124. package/esm/src/transformer.js +180 -0
  125. package/package.json +21 -8
  126. package/esm/deps/deno.land/std@0.210.0/html/entities.d.ts +0 -38
  127. package/esm/deps/deno.land/std@0.210.0/path/_common/assert_path.d.ts +0 -1
  128. package/esm/deps/deno.land/std@0.210.0/path/_interface.js +0 -3
  129. package/esm/deps/deno.land/std@0.210.0/path/common.d.ts +0 -13
  130. package/esm/deps/deno.land/std@0.210.0/path/glob_to_regexp.d.ts +0 -61
  131. package/esm/deps/deno.land/std@0.210.0/path/mod.d.ts +0 -28
  132. package/esm/deps/deno.land/std@0.210.0/path/normalize_glob.d.ts +0 -3
  133. package/esm/deps/deno.land/std@0.210.0/path/posix/from_file_url.d.ts +0 -12
  134. package/esm/deps/deno.land/std@0.210.0/path/posix/normalize_glob.d.ts +0 -3
  135. package/esm/deps/deno.land/std@0.210.0/path/posix/separator.d.ts +0 -2
  136. package/esm/deps/deno.land/std@0.210.0/path/posix/separator.js +0 -4
  137. package/esm/deps/deno.land/std@0.210.0/path/separator.d.ts +0 -2
  138. package/esm/deps/deno.land/std@0.210.0/path/separator.js +0 -5
  139. package/esm/deps/deno.land/std@0.210.0/path/windows/from_file_url.d.ts +0 -14
  140. package/esm/deps/deno.land/std@0.210.0/path/windows/glob_to_regexp.d.ts +0 -57
  141. package/esm/deps/deno.land/std@0.210.0/path/windows/mod.d.ts +0 -40
  142. package/esm/deps/deno.land/std@0.210.0/path/windows/normalize_glob.d.ts +0 -3
  143. package/esm/deps/deno.land/std@0.210.0/path/windows/separator.d.ts +0 -2
  144. package/esm/deps/deno.land/std@0.210.0/path/windows/separator.js +0 -4
  145. package/esm/deps/deno.land/std@0.210.0/path/windows/to_file_url.d.ts +0 -14
  146. package/script/_dnt.shims.d.ts +0 -5
  147. package/script/_dnt.shims.js +0 -65
  148. package/script/deps/deno.land/std@0.210.0/assert/assert.d.ts +0 -12
  149. package/script/deps/deno.land/std@0.210.0/assert/assert.js +0 -22
  150. package/script/deps/deno.land/std@0.210.0/assert/assertion_error.d.ts +0 -14
  151. package/script/deps/deno.land/std@0.210.0/assert/assertion_error.js +0 -22
  152. package/script/deps/deno.land/std@0.210.0/html/entities.d.ts +0 -38
  153. package/script/deps/deno.land/std@0.210.0/html/entities.js +0 -81
  154. package/script/deps/deno.land/std@0.210.0/html/mod.d.ts +0 -6
  155. package/script/deps/deno.land/std@0.210.0/html/mod.js +0 -24
  156. package/script/deps/deno.land/std@0.210.0/path/_common/assert_path.d.ts +0 -1
  157. package/script/deps/deno.land/std@0.210.0/path/_common/assert_path.js +0 -11
  158. package/script/deps/deno.land/std@0.210.0/path/_common/basename.d.ts +0 -3
  159. package/script/deps/deno.land/std@0.210.0/path/_common/basename.js +0 -46
  160. package/script/deps/deno.land/std@0.210.0/path/_common/common.d.ts +0 -1
  161. package/script/deps/deno.land/std@0.210.0/path/_common/common.js +0 -27
  162. package/script/deps/deno.land/std@0.210.0/path/_common/constants.d.ts +0 -39
  163. package/script/deps/deno.land/std@0.210.0/path/_common/constants.js +0 -49
  164. package/script/deps/deno.land/std@0.210.0/path/_common/dirname.d.ts +0 -1
  165. package/script/deps/deno.land/std@0.210.0/path/_common/dirname.js +0 -12
  166. package/script/deps/deno.land/std@0.210.0/path/_common/format.d.ts +0 -3
  167. package/script/deps/deno.land/std@0.210.0/path/_common/format.js +0 -24
  168. package/script/deps/deno.land/std@0.210.0/path/_common/from_file_url.d.ts +0 -2
  169. package/script/deps/deno.land/std@0.210.0/path/_common/from_file_url.js +0 -13
  170. package/script/deps/deno.land/std@0.210.0/path/_common/glob_to_reg_exp.d.ts +0 -28
  171. package/script/deps/deno.land/std@0.210.0/path/_common/glob_to_reg_exp.js +0 -239
  172. package/script/deps/deno.land/std@0.210.0/path/_common/normalize.d.ts +0 -1
  173. package/script/deps/deno.land/std@0.210.0/path/_common/normalize.js +0 -12
  174. package/script/deps/deno.land/std@0.210.0/path/_common/normalize_string.d.ts +0 -1
  175. package/script/deps/deno.land/std@0.210.0/path/_common/normalize_string.js +0 -81
  176. package/script/deps/deno.land/std@0.210.0/path/_common/relative.d.ts +0 -1
  177. package/script/deps/deno.land/std@0.210.0/path/_common/relative.js +0 -13
  178. package/script/deps/deno.land/std@0.210.0/path/_common/strip_trailing_separators.d.ts +0 -1
  179. package/script/deps/deno.land/std@0.210.0/path/_common/strip_trailing_separators.js +0 -23
  180. package/script/deps/deno.land/std@0.210.0/path/_common/to_file_url.d.ts +0 -1
  181. package/script/deps/deno.land/std@0.210.0/path/_common/to_file_url.js +0 -19
  182. package/script/deps/deno.land/std@0.210.0/path/_interface.d.ts +0 -26
  183. package/script/deps/deno.land/std@0.210.0/path/_interface.js +0 -4
  184. package/script/deps/deno.land/std@0.210.0/path/_os.d.ts +0 -3
  185. package/script/deps/deno.land/std@0.210.0/path/_os.js +0 -44
  186. package/script/deps/deno.land/std@0.210.0/path/basename.d.ts +0 -8
  187. package/script/deps/deno.land/std@0.210.0/path/basename.js +0 -21
  188. package/script/deps/deno.land/std@0.210.0/path/common.d.ts +0 -13
  189. package/script/deps/deno.land/std@0.210.0/path/common.js +0 -23
  190. package/script/deps/deno.land/std@0.210.0/path/dirname.d.ts +0 -5
  191. package/script/deps/deno.land/std@0.210.0/path/dirname.js +0 -16
  192. package/script/deps/deno.land/std@0.210.0/path/extname.d.ts +0 -6
  193. package/script/deps/deno.land/std@0.210.0/path/extname.js +0 -17
  194. package/script/deps/deno.land/std@0.210.0/path/format.d.ts +0 -6
  195. package/script/deps/deno.land/std@0.210.0/path/format.js +0 -16
  196. package/script/deps/deno.land/std@0.210.0/path/from_file_url.d.ts +0 -18
  197. package/script/deps/deno.land/std@0.210.0/path/from_file_url.js +0 -28
  198. package/script/deps/deno.land/std@0.210.0/path/glob_to_regexp.js +0 -69
  199. package/script/deps/deno.land/std@0.210.0/path/is_absolute.d.ts +0 -5
  200. package/script/deps/deno.land/std@0.210.0/path/is_absolute.js +0 -16
  201. package/script/deps/deno.land/std@0.210.0/path/is_glob.d.ts +0 -2
  202. package/script/deps/deno.land/std@0.210.0/path/is_glob.js +0 -32
  203. package/script/deps/deno.land/std@0.210.0/path/join.d.ts +0 -5
  204. package/script/deps/deno.land/std@0.210.0/path/join.js +0 -16
  205. package/script/deps/deno.land/std@0.210.0/path/join_globs.d.ts +0 -3
  206. package/script/deps/deno.land/std@0.210.0/path/join_globs.js +0 -15
  207. package/script/deps/deno.land/std@0.210.0/path/mod.d.ts +0 -28
  208. package/script/deps/deno.land/std@0.210.0/path/mod.js +0 -94
  209. package/script/deps/deno.land/std@0.210.0/path/normalize.d.ts +0 -7
  210. package/script/deps/deno.land/std@0.210.0/path/normalize.js +0 -18
  211. package/script/deps/deno.land/std@0.210.0/path/normalize_glob.js +0 -15
  212. package/script/deps/deno.land/std@0.210.0/path/parse.d.ts +0 -6
  213. package/script/deps/deno.land/std@0.210.0/path/parse.js +0 -16
  214. package/script/deps/deno.land/std@0.210.0/path/posix/_util.d.ts +0 -1
  215. package/script/deps/deno.land/std@0.210.0/path/posix/_util.js +0 -12
  216. package/script/deps/deno.land/std@0.210.0/path/posix/basename.d.ts +0 -8
  217. package/script/deps/deno.land/std@0.210.0/path/posix/basename.js +0 -22
  218. package/script/deps/deno.land/std@0.210.0/path/posix/common.js +0 -23
  219. package/script/deps/deno.land/std@0.210.0/path/posix/dirname.d.ts +0 -5
  220. package/script/deps/deno.land/std@0.210.0/path/posix/dirname.js +0 -40
  221. package/script/deps/deno.land/std@0.210.0/path/posix/extname.d.ts +0 -6
  222. package/script/deps/deno.land/std@0.210.0/path/posix/extname.js +0 -63
  223. package/script/deps/deno.land/std@0.210.0/path/posix/format.d.ts +0 -6
  224. package/script/deps/deno.land/std@0.210.0/path/posix/format.js +0 -15
  225. package/script/deps/deno.land/std@0.210.0/path/posix/from_file_url.js +0 -21
  226. package/script/deps/deno.land/std@0.210.0/path/posix/glob_to_regexp.js +0 -73
  227. package/script/deps/deno.land/std@0.210.0/path/posix/is_absolute.d.ts +0 -5
  228. package/script/deps/deno.land/std@0.210.0/path/posix/is_absolute.js +0 -16
  229. package/script/deps/deno.land/std@0.210.0/path/posix/is_glob.d.ts +0 -1
  230. package/script/deps/deno.land/std@0.210.0/path/posix/is_glob.js +0 -7
  231. package/script/deps/deno.land/std@0.210.0/path/posix/join.d.ts +0 -5
  232. package/script/deps/deno.land/std@0.210.0/path/posix/join.js +0 -30
  233. package/script/deps/deno.land/std@0.210.0/path/posix/join_globs.d.ts +0 -3
  234. package/script/deps/deno.land/std@0.210.0/path/posix/join_globs.js +0 -30
  235. package/script/deps/deno.land/std@0.210.0/path/posix/mod.js +0 -61
  236. package/script/deps/deno.land/std@0.210.0/path/posix/normalize.d.ts +0 -7
  237. package/script/deps/deno.land/std@0.210.0/path/posix/normalize.js +0 -29
  238. package/script/deps/deno.land/std@0.210.0/path/posix/normalize_glob.js +0 -20
  239. package/script/deps/deno.land/std@0.210.0/path/posix/parse.d.ts +0 -6
  240. package/script/deps/deno.land/std@0.210.0/path/posix/parse.js +0 -102
  241. package/script/deps/deno.land/std@0.210.0/path/posix/relative.d.ts +0 -7
  242. package/script/deps/deno.land/std@0.210.0/path/posix/relative.js +0 -98
  243. package/script/deps/deno.land/std@0.210.0/path/posix/resolve.d.ts +0 -5
  244. package/script/deps/deno.land/std@0.210.0/path/posix/resolve.js +0 -75
  245. package/script/deps/deno.land/std@0.210.0/path/posix/separator.d.ts +0 -2
  246. package/script/deps/deno.land/std@0.210.0/path/posix/separator.js +0 -7
  247. package/script/deps/deno.land/std@0.210.0/path/posix/to_file_url.d.ts +0 -12
  248. package/script/deps/deno.land/std@0.210.0/path/posix/to_file_url.js +0 -26
  249. package/script/deps/deno.land/std@0.210.0/path/posix/to_namespaced_path.d.ts +0 -5
  250. package/script/deps/deno.land/std@0.210.0/path/posix/to_namespaced_path.js +0 -14
  251. package/script/deps/deno.land/std@0.210.0/path/relative.d.ts +0 -12
  252. package/script/deps/deno.land/std@0.210.0/path/relative.js +0 -23
  253. package/script/deps/deno.land/std@0.210.0/path/resolve.d.ts +0 -5
  254. package/script/deps/deno.land/std@0.210.0/path/resolve.js +0 -18
  255. package/script/deps/deno.land/std@0.210.0/path/separator.d.ts +0 -2
  256. package/script/deps/deno.land/std@0.210.0/path/separator.js +0 -8
  257. package/script/deps/deno.land/std@0.210.0/path/to_file_url.d.ts +0 -18
  258. package/script/deps/deno.land/std@0.210.0/path/to_file_url.js +0 -28
  259. package/script/deps/deno.land/std@0.210.0/path/to_namespaced_path.d.ts +0 -5
  260. package/script/deps/deno.land/std@0.210.0/path/to_namespaced_path.js +0 -18
  261. package/script/deps/deno.land/std@0.210.0/path/windows/_util.d.ts +0 -3
  262. package/script/deps/deno.land/std@0.210.0/path/windows/_util.js +0 -21
  263. package/script/deps/deno.land/std@0.210.0/path/windows/basename.d.ts +0 -8
  264. package/script/deps/deno.land/std@0.210.0/path/windows/basename.js +0 -34
  265. package/script/deps/deno.land/std@0.210.0/path/windows/common.d.ts +0 -13
  266. package/script/deps/deno.land/std@0.210.0/path/windows/common.js +0 -23
  267. package/script/deps/deno.land/std@0.210.0/path/windows/dirname.d.ts +0 -5
  268. package/script/deps/deno.land/std@0.210.0/path/windows/dirname.js +0 -102
  269. package/script/deps/deno.land/std@0.210.0/path/windows/extname.d.ts +0 -6
  270. package/script/deps/deno.land/std@0.210.0/path/windows/extname.js +0 -72
  271. package/script/deps/deno.land/std@0.210.0/path/windows/format.d.ts +0 -6
  272. package/script/deps/deno.land/std@0.210.0/path/windows/format.js +0 -15
  273. package/script/deps/deno.land/std@0.210.0/path/windows/from_file_url.js +0 -30
  274. package/script/deps/deno.land/std@0.210.0/path/windows/glob_to_regexp.d.ts +0 -57
  275. package/script/deps/deno.land/std@0.210.0/path/windows/glob_to_regexp.js +0 -73
  276. package/script/deps/deno.land/std@0.210.0/path/windows/is_absolute.d.ts +0 -5
  277. package/script/deps/deno.land/std@0.210.0/path/windows/is_absolute.js +0 -31
  278. package/script/deps/deno.land/std@0.210.0/path/windows/is_glob.d.ts +0 -1
  279. package/script/deps/deno.land/std@0.210.0/path/windows/is_glob.js +0 -7
  280. package/script/deps/deno.land/std@0.210.0/path/windows/join.d.ts +0 -5
  281. package/script/deps/deno.land/std@0.210.0/path/windows/join.js +0 -76
  282. package/script/deps/deno.land/std@0.210.0/path/windows/join_globs.d.ts +0 -3
  283. package/script/deps/deno.land/std@0.210.0/path/windows/join_globs.js +0 -30
  284. package/script/deps/deno.land/std@0.210.0/path/windows/mod.d.ts +0 -40
  285. package/script/deps/deno.land/std@0.210.0/path/windows/mod.js +0 -61
  286. package/script/deps/deno.land/std@0.210.0/path/windows/normalize.d.ts +0 -7
  287. package/script/deps/deno.land/std@0.210.0/path/windows/normalize.js +0 -134
  288. package/script/deps/deno.land/std@0.210.0/path/windows/normalize_glob.js +0 -20
  289. package/script/deps/deno.land/std@0.210.0/path/windows/parse.d.ts +0 -6
  290. package/script/deps/deno.land/std@0.210.0/path/windows/parse.js +0 -163
  291. package/script/deps/deno.land/std@0.210.0/path/windows/relative.d.ts +0 -12
  292. package/script/deps/deno.land/std@0.210.0/path/windows/relative.js +0 -125
  293. package/script/deps/deno.land/std@0.210.0/path/windows/resolve.d.ts +0 -5
  294. package/script/deps/deno.land/std@0.210.0/path/windows/resolve.js +0 -170
  295. package/script/deps/deno.land/std@0.210.0/path/windows/separator.d.ts +0 -2
  296. package/script/deps/deno.land/std@0.210.0/path/windows/separator.js +0 -7
  297. package/script/deps/deno.land/std@0.210.0/path/windows/to_file_url.js +0 -35
  298. package/script/deps/deno.land/std@0.210.0/path/windows/to_namespaced_path.d.ts +0 -5
  299. package/script/deps/deno.land/std@0.210.0/path/windows/to_namespaced_path.js +0 -42
  300. package/script/deps.d.ts +0 -2
  301. package/script/deps.js +0 -28
  302. package/script/mod.d.ts +0 -9
  303. package/script/mod.js +0 -69
  304. package/script/package.json +0 -3
  305. package/script/plugins/echo.d.ts +0 -2
  306. package/script/plugins/echo.js +0 -16
  307. package/script/plugins/escape.d.ts +0 -2
  308. package/script/plugins/escape.js +0 -9
  309. package/script/plugins/export.d.ts +0 -2
  310. package/script/plugins/export.js +0 -50
  311. package/script/plugins/for.d.ts +0 -2
  312. package/script/plugins/for.js +0 -77
  313. package/script/plugins/function.d.ts +0 -2
  314. package/script/plugins/function.js +0 -40
  315. package/script/plugins/if.d.ts +0 -2
  316. package/script/plugins/if.js +0 -35
  317. package/script/plugins/import.d.ts +0 -2
  318. package/script/plugins/import.js +0 -20
  319. package/script/plugins/include.d.ts +0 -2
  320. package/script/plugins/include.js +0 -26
  321. package/script/plugins/js.d.ts +0 -2
  322. package/script/plugins/js.js +0 -14
  323. package/script/plugins/layout.d.ts +0 -2
  324. package/script/plugins/layout.js +0 -37
  325. package/script/plugins/set.d.ts +0 -2
  326. package/script/plugins/set.js +0 -48
  327. package/script/plugins/unescape.d.ts +0 -2
  328. package/script/plugins/unescape.js +0 -9
  329. package/script/src/environment.d.ts +0 -51
  330. package/script/src/environment.js +0 -208
  331. package/script/src/loader.d.ts +0 -14
  332. package/script/src/loader.js +0 -46
  333. package/script/src/tokenizer.d.ts +0 -13
  334. package/script/src/tokenizer.js +0 -249
  335. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/assert/assert.d.ts +0 -0
  336. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/assert/assertion_error.d.ts +0 -0
  337. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/basename.d.ts +0 -0
  338. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/common.d.ts +0 -0
  339. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/constants.d.ts +0 -0
  340. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/dirname.d.ts +0 -0
  341. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/format.d.ts +0 -0
  342. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/from_file_url.d.ts +0 -0
  343. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/glob_to_reg_exp.d.ts +0 -0
  344. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/normalize.d.ts +0 -0
  345. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/normalize_string.d.ts +0 -0
  346. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/relative.d.ts +0 -0
  347. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/strip_trailing_separators.d.ts +0 -0
  348. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_common/to_file_url.d.ts +0 -0
  349. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_interface.d.ts +0 -0
  350. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/_os.d.ts +0 -0
  351. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/basename.d.ts +0 -0
  352. /package/esm/deps/deno.land/{std@0.210.0/path/posix → std@0.219.1/path}/common.d.ts +0 -0
  353. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/dirname.d.ts +0 -0
  354. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/extname.d.ts +0 -0
  355. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/from_file_url.d.ts +0 -0
  356. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/is_absolute.d.ts +0 -0
  357. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/is_glob.d.ts +0 -0
  358. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/join.d.ts +0 -0
  359. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/normalize.d.ts +0 -0
  360. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/parse.d.ts +0 -0
  361. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/_util.d.ts +0 -0
  362. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/basename.d.ts +0 -0
  363. /package/esm/deps/deno.land/{std@0.210.0/path/windows → std@0.219.1/path/posix}/common.d.ts +0 -0
  364. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/dirname.d.ts +0 -0
  365. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/extname.d.ts +0 -0
  366. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/format.d.ts +0 -0
  367. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/is_absolute.d.ts +0 -0
  368. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/is_glob.d.ts +0 -0
  369. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/join.d.ts +0 -0
  370. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/normalize.d.ts +0 -0
  371. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/relative.d.ts +0 -0
  372. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/resolve.d.ts +0 -0
  373. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/posix/to_namespaced_path.d.ts +0 -0
  374. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/relative.d.ts +0 -0
  375. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/resolve.d.ts +0 -0
  376. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/to_file_url.d.ts +0 -0
  377. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/to_namespaced_path.d.ts +0 -0
  378. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/_util.d.ts +0 -0
  379. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/basename.d.ts +0 -0
  380. /package/{script/deps/deno.land/std@0.210.0/path/posix → esm/deps/deno.land/std@0.219.1/path/windows}/common.d.ts +0 -0
  381. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/dirname.d.ts +0 -0
  382. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/extname.d.ts +0 -0
  383. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/format.d.ts +0 -0
  384. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/is_absolute.d.ts +0 -0
  385. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/is_glob.d.ts +0 -0
  386. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/join.d.ts +0 -0
  387. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/normalize.d.ts +0 -0
  388. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/relative.d.ts +0 -0
  389. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/resolve.d.ts +0 -0
  390. /package/esm/deps/deno.land/{std@0.210.0 → std@0.219.1}/path/windows/to_namespaced_path.d.ts +0 -0
@@ -1,51 +0,0 @@
1
- import { Token } from "./tokenizer.js";
2
- import type { Loader } from "./loader.js";
3
- export interface TemplateResult {
4
- content: string;
5
- [key: string]: unknown;
6
- }
7
- export interface Template {
8
- (data?: Record<string, unknown>): Promise<TemplateResult>;
9
- source: string;
10
- code: string;
11
- file?: string;
12
- }
13
- export interface TemplateSync {
14
- (data?: Record<string, unknown>): TemplateResult;
15
- source: string;
16
- code: string;
17
- file?: string;
18
- }
19
- export type Tag = (env: Environment, code: string, output: string, tokens: Token[]) => string | undefined;
20
- export type FilterThis = {
21
- data: Record<string, unknown>;
22
- env: Environment;
23
- };
24
- export type Filter = (this: FilterThis, ...args: any[]) => any;
25
- export type Plugin = (env: Environment) => void;
26
- export interface Options {
27
- loader: Loader;
28
- dataVarname: string;
29
- autoescape: boolean;
30
- useWith: boolean;
31
- }
32
- export declare class Environment {
33
- cache: Map<string, Template>;
34
- options: Options;
35
- tags: Tag[];
36
- filters: Record<string, Filter>;
37
- utils: Record<string, unknown>;
38
- constructor(options: Options);
39
- use(plugin: Plugin): void;
40
- run(file: string, data: Record<string, unknown>, from?: string): Promise<TemplateResult>;
41
- runString(source: string, data?: Record<string, unknown>, file?: string): Promise<TemplateResult>;
42
- runStringSync(source: string, data?: Record<string, unknown>): TemplateResult;
43
- compile(source: string, path?: string, defaults?: Record<string, unknown>, sync?: false): Template;
44
- compile(source: string, path?: string, defaults?: Record<string, unknown>, sync?: true): TemplateSync;
45
- load(file: string, from?: string): Promise<Template>;
46
- compileTokens(tokens: Token[], outputVar?: string, stopAt?: string[]): string[];
47
- compileFilters(tokens: Token[], output: string, autoescape?: boolean): string;
48
- createError(path: string, source: string, position: number, cause: Error): Error;
49
- }
50
- /** Returns the number and code of the errored line */
51
- export declare function errorLine(source: string, pos: number): [number, number, string];
@@ -1,208 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.errorLine = exports.Environment = void 0;
30
- const dntShim = __importStar(require("../_dnt.shims.js"));
31
- const tokenizer_js_1 = __importDefault(require("./tokenizer.js"));
32
- class Environment {
33
- cache = new Map();
34
- options;
35
- tags = [];
36
- filters = {};
37
- utils = {};
38
- constructor(options) {
39
- this.options = options;
40
- }
41
- use(plugin) {
42
- plugin(this);
43
- }
44
- async run(file, data, from) {
45
- const template = await this.load(file, from);
46
- return await template(data);
47
- }
48
- async runString(source, data, file) {
49
- if (file) {
50
- const cached = this.cache.get(file);
51
- if (cached) {
52
- return await cached(data);
53
- }
54
- const template = this.compile(source, file);
55
- this.cache.set(file, template);
56
- return await template(data);
57
- }
58
- const template = this.compile(source, file);
59
- return await template(data);
60
- }
61
- runStringSync(source, data) {
62
- const template = this.compile(source, "", {}, true);
63
- return template(data);
64
- }
65
- compile(source, path, defaults, sync = false) {
66
- const { tokens, position, error } = (0, tokenizer_js_1.default)(source);
67
- if (error) {
68
- throw this.createError(path || "unknown", source, position, error);
69
- }
70
- const code = this.compileTokens(tokens).join("\n");
71
- const { dataVarname, useWith } = this.options;
72
- const constructor = new Function("__file", "__env", "__defaults", `return${sync ? "" : " async"} function (${dataVarname}) {
73
- let __pos = 0;
74
- try {
75
- ${dataVarname} = Object.assign({}, __defaults, ${dataVarname});
76
- const __exports = { content: "" };
77
- ${useWith ? `with (${dataVarname}) {${code}}` : code}
78
- return __exports;
79
- } catch (cause) {
80
- const template = __env.cache.get(__file);
81
- throw __env.createError(__file, template?.source || "", __pos, cause);
82
- }
83
- }
84
- `);
85
- const template = constructor(path, this, defaults);
86
- template.file = path;
87
- template.code = code;
88
- template.source = source;
89
- return template;
90
- }
91
- async load(file, from) {
92
- const path = from ? this.options.loader.resolve(from, file) : file;
93
- if (!this.cache.has(path)) {
94
- const { source, data } = await this.options.loader.load(path);
95
- const template = this.compile(source, path, data);
96
- this.cache.set(path, template);
97
- }
98
- return this.cache.get(path);
99
- }
100
- compileTokens(tokens, outputVar = "__exports.content", stopAt) {
101
- const compiled = [];
102
- tokens: while (tokens.length > 0) {
103
- if (stopAt && tokens[0][0] === "tag" && stopAt.includes(tokens[0][1])) {
104
- break;
105
- }
106
- const [type, code, pos] = tokens.shift();
107
- if (type === "comment") {
108
- continue;
109
- }
110
- if (type === "string") {
111
- compiled.push(`${outputVar} += ${JSON.stringify(code)};`);
112
- continue;
113
- }
114
- if (type === "tag") {
115
- compiled.push(`__pos = ${pos};`);
116
- for (const tag of this.tags) {
117
- const compiledTag = tag(this, code, outputVar, tokens);
118
- if (typeof compiledTag === "string") {
119
- compiled.push(compiledTag);
120
- continue tokens;
121
- }
122
- }
123
- // Unknown tag, just print it
124
- const expression = this.compileFilters(tokens, code, this.options.autoescape);
125
- compiled.push(`${outputVar} += (${expression}) ?? "";`);
126
- continue;
127
- }
128
- throw new Error(`Unknown token type "${type}"`);
129
- }
130
- return compiled;
131
- }
132
- compileFilters(tokens, output, autoescape = false) {
133
- let unescaped = false;
134
- while (tokens.length > 0 && tokens[0][0] === "filter") {
135
- const [, code] = tokens.shift();
136
- const match = code.match(/^(await\s+)?([\w.]+)(?:\((.*)\))?$/);
137
- if (!match) {
138
- throw new Error(`Invalid filter: ${code}`);
139
- }
140
- const [_, isAsync, name, args] = match;
141
- if (!this.filters[name]) {
142
- if (name === "safe") {
143
- unescaped = true;
144
- }
145
- else if (isGlobal(name)) {
146
- // If a global function
147
- output = `${isAsync ? "await " : ""}${name}(${output}${args ? `, ${args}` : ""})`;
148
- }
149
- else {
150
- // It's a prototype's method (e.g. `String.toUpperCase()`)
151
- output = `${isAsync ? "await " : ""}(${output})?.${name}?.(${args ? args : ""})`;
152
- }
153
- }
154
- else {
155
- // It's a filter (e.g. filters.upper())
156
- const { dataVarname } = this.options;
157
- output = `${(isAsync || checkAsync(this.filters[name])) ? "await " : ""}__env.filters.${name}.call({data:${dataVarname},env:__env}, ${output}${args ? `, ${args}` : ""})`;
158
- }
159
- }
160
- // Escape by default
161
- if (autoescape && !unescaped) {
162
- output = `__env.filters.escape(${output})`;
163
- }
164
- return output;
165
- }
166
- createError(path, source, position, cause) {
167
- if (!source) {
168
- return cause;
169
- }
170
- const [line, column, code] = errorLine(source, position);
171
- return new Error(`Error in the template ${path}:${line}:${column}\n\n${code.trim()}\n\n> ${cause.message}\n`, { cause });
172
- }
173
- }
174
- exports.Environment = Environment;
175
- function isGlobal(name) {
176
- // @ts-ignore TS doesn't know about globalThis
177
- if (dntShim.dntGlobalThis[name]) {
178
- return true;
179
- }
180
- if (name.includes(".")) {
181
- const [obj, prop] = name.split(".");
182
- // @ts-ignore TS doesn't know about globalThis
183
- return typeof dntShim.dntGlobalThis[obj]?.[prop] === "function";
184
- }
185
- }
186
- /** Returns the number and code of the errored line */
187
- function errorLine(source, pos) {
188
- let line = 1;
189
- let column = 1;
190
- for (let index = 0; index < pos; index++) {
191
- if (source[index] === "\n" ||
192
- (source[index] === "\r" && source[index + 1] === "\n")) {
193
- line++;
194
- column = 1;
195
- if (source[index] === "\r") {
196
- index++;
197
- }
198
- }
199
- else {
200
- column++;
201
- }
202
- }
203
- return [line, column, source.split("\n")[line - 1]];
204
- }
205
- exports.errorLine = errorLine;
206
- function checkAsync(fn) {
207
- return fn.constructor?.name === "AsyncFunction";
208
- }
@@ -1,14 +0,0 @@
1
- export interface TemplateSource {
2
- source: string;
3
- data?: Record<string, unknown>;
4
- }
5
- export interface Loader {
6
- load(file: string): TemplateSource | Promise<TemplateSource>;
7
- resolve(from: string, file: string): string;
8
- }
9
- export declare class FileLoader implements Loader {
10
- #private;
11
- constructor(root: string);
12
- load(file: string): Promise<TemplateSource>;
13
- resolve(from: string, file: string): string;
14
- }
@@ -1,46 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.FileLoader = void 0;
27
- const dntShim = __importStar(require("../_dnt.shims.js"));
28
- const deps_js_1 = require("../deps.js");
29
- class FileLoader {
30
- #root;
31
- constructor(root) {
32
- this.#root = root;
33
- }
34
- async load(file) {
35
- return {
36
- source: await dntShim.Deno.readTextFile(file),
37
- };
38
- }
39
- resolve(from, file) {
40
- if (file.startsWith(".")) {
41
- return deps_js_1.path.join(deps_js_1.path.dirname(from), file);
42
- }
43
- return deps_js_1.path.join(this.#root, file);
44
- }
45
- }
46
- exports.FileLoader = FileLoader;
@@ -1,13 +0,0 @@
1
- export type TokenType = "string" | "tag" | "filter" | "comment";
2
- export type Token = [TokenType, string, number?];
3
- export interface TokenizeResult {
4
- tokens: Token[];
5
- position: number;
6
- error: Error | undefined;
7
- }
8
- export default function tokenize(source: string): TokenizeResult;
9
- /**
10
- * Parse a tag and return the indexes of the start and end brackets, and the filters between.
11
- * For example: {{ tag |> filter1 |> filter2 }} => [2, 9, 20, 31]
12
- */
13
- export declare function parseTag(source: string): number[];
@@ -1,249 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseTag = void 0;
4
- function tokenize(source) {
5
- const tokens = [];
6
- let type = "string";
7
- let trimNext = false;
8
- let position = 0;
9
- try {
10
- while (source.length > 0) {
11
- if (type === "string") {
12
- const index = source.indexOf("{{");
13
- const code = index === -1 ? source : source.slice(0, index);
14
- if (trimNext) {
15
- tokens.push([type, code.trimStart(), position]);
16
- trimNext = false;
17
- }
18
- else {
19
- tokens.push([type, code, position]);
20
- }
21
- if (index === -1) {
22
- break;
23
- }
24
- position += index;
25
- source = source.slice(index);
26
- type = source.startsWith("{{#") ? "comment" : "tag";
27
- continue;
28
- }
29
- if (type === "comment") {
30
- source = source.slice(3);
31
- const index = source.indexOf("#}}");
32
- const comment = index === -1 ? source : source.slice(0, index);
33
- tokens.push([type, comment, position]);
34
- if (index === -1) {
35
- break;
36
- }
37
- position += index + 3;
38
- source = source.slice(index + 3);
39
- type = "string";
40
- continue;
41
- }
42
- if (type === "tag") {
43
- const indexes = parseTag(source);
44
- const lastIndex = indexes.length - 1;
45
- let tag;
46
- indexes.reduce((prev, curr, index) => {
47
- let code = source.slice(prev, curr - 2);
48
- // Tag
49
- if (index === 1) {
50
- // Left trim
51
- if (code.startsWith("-")) {
52
- code = code.slice(1);
53
- const lastToken = tokens[tokens.length - 1];
54
- lastToken[1] = lastToken[1].trimEnd();
55
- }
56
- // Right trim
57
- if (code.endsWith("-") && index === lastIndex) {
58
- code = code.slice(0, -1);
59
- trimNext = true;
60
- }
61
- tag = [type, code.trim(), position];
62
- tokens.push(tag);
63
- return curr;
64
- }
65
- // Right trim
66
- if (index === lastIndex && code.endsWith("-")) {
67
- code = code.slice(0, -1);
68
- trimNext = true;
69
- }
70
- // Filters
71
- tokens.push(["filter", code.trim()]);
72
- return curr;
73
- });
74
- position += indexes[lastIndex];
75
- source = source.slice(indexes[lastIndex]);
76
- type = "string";
77
- // Search the closing echo tag {{ /echo }}
78
- if (tag?.[1] === "echo") {
79
- const end = source.match(/{{\s*\/echo\s*}}/);
80
- if (!end) {
81
- throw new Error("Unclosed echo tag");
82
- }
83
- const rawCode = source.slice(0, end.index);
84
- tag[1] = `echo ${JSON.stringify(rawCode)}`;
85
- const length = Number(end.index) + end[0].length;
86
- source = source.slice(length);
87
- position += length;
88
- }
89
- continue;
90
- }
91
- }
92
- }
93
- catch (error) {
94
- return { tokens, position, error };
95
- }
96
- return { tokens, position, error: undefined };
97
- }
98
- exports.default = tokenize;
99
- /**
100
- * Parse a tag and return the indexes of the start and end brackets, and the filters between.
101
- * For example: {{ tag |> filter1 |> filter2 }} => [2, 9, 20, 31]
102
- */
103
- function parseTag(source) {
104
- const length = source.length;
105
- const statuses = [];
106
- const indexes = [2];
107
- let index = 0;
108
- while (index < length) {
109
- const char = source.charAt(index++);
110
- switch (char) {
111
- // Detect start brackets
112
- case "{": {
113
- const status = statuses[0];
114
- if (status === "literal" && source.charAt(index - 2) === "$") {
115
- statuses.unshift("bracket");
116
- }
117
- else if (status !== "comment" && status !== "single-quote" &&
118
- status !== "double-quote" && status !== "literal" &&
119
- status !== "regex" && status !== "line-comment") {
120
- statuses.unshift("bracket");
121
- }
122
- break;
123
- }
124
- // Detect end brackets
125
- case "}": {
126
- const status = statuses[0];
127
- if (status === "bracket") {
128
- statuses.shift();
129
- if (statuses.length === 0) {
130
- indexes.push(index);
131
- return indexes;
132
- }
133
- }
134
- break;
135
- }
136
- // Detect double quotes
137
- case '"': {
138
- const status = statuses[0];
139
- if (status === "double-quote") {
140
- statuses.shift();
141
- }
142
- else if (status !== "comment" &&
143
- status !== "single-quote" &&
144
- status !== "literal" &&
145
- status !== "regex" &&
146
- status !== "line-comment") {
147
- statuses.unshift("double-quote");
148
- }
149
- break;
150
- }
151
- // Detect single quotes
152
- case "'": {
153
- const status = statuses[0];
154
- if (status === "single-quote") {
155
- statuses.shift();
156
- }
157
- else if (status !== "comment" &&
158
- status !== "double-quote" &&
159
- status !== "literal" &&
160
- status !== "regex" &&
161
- status !== "line-comment") {
162
- statuses.unshift("single-quote");
163
- }
164
- break;
165
- }
166
- // Detect literals
167
- case "`": {
168
- const status = statuses[0];
169
- if (status === "literal") {
170
- statuses.shift();
171
- }
172
- else if (status !== "comment" &&
173
- status !== "double-quote" &&
174
- status !== "single-quote" &&
175
- status !== "regex" &&
176
- status !== "line-comment") {
177
- statuses.unshift("literal");
178
- }
179
- break;
180
- }
181
- // Detect comments and regex
182
- case "/": {
183
- const status = statuses[0];
184
- if (status === "single-quote" || status === "double-quote" ||
185
- status === "literal" || status === "line-comment") {
186
- break;
187
- }
188
- // We are in a comment: close or ignore
189
- if (status === "comment") {
190
- if (source.charAt(index - 2) === "*") {
191
- statuses.shift();
192
- }
193
- break;
194
- }
195
- // We are in a regex: close or ignore
196
- if (status === "regex") {
197
- if (source.charAt(index - 2) !== "\\") {
198
- statuses.shift();
199
- }
200
- break;
201
- }
202
- // Start a new comment
203
- if (source.charAt(index) === "*") {
204
- statuses.unshift("comment");
205
- break;
206
- }
207
- // Start a new line comment
208
- if (source.charAt(index - 2) === "/") {
209
- statuses.unshift("line-comment");
210
- break;
211
- }
212
- // Start a new regex
213
- const prev = prevChar(source, index - 1);
214
- if (prev === "(" || prev === "=" || prev === ":" || prev === ",") {
215
- statuses.unshift("regex");
216
- }
217
- break;
218
- }
219
- // Detect end of line comments
220
- case "\n": {
221
- const status = statuses[0];
222
- if (status === "line-comment") {
223
- statuses.shift();
224
- }
225
- break;
226
- }
227
- // Detect filters
228
- case "|": {
229
- const status = statuses[0];
230
- if (status === "bracket" && source.charAt(index) === ">") {
231
- indexes.push(index + 1);
232
- }
233
- break;
234
- }
235
- }
236
- }
237
- throw new Error("Unclosed tag");
238
- }
239
- exports.parseTag = parseTag;
240
- // Get the previous character in a string ignoring spaces, line breaks and tabs
241
- function prevChar(source, index) {
242
- while (index > 0) {
243
- const char = source.charAt(--index);
244
- if (char !== " " && char !== "\n" && char !== "\r" && char !== "\t") {
245
- return char;
246
- }
247
- }
248
- return "";
249
- }