step-node-agent 3.25.4 → 3.26.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 (289) hide show
  1. package/AgentConf.yaml +13 -0
  2. package/api/controllers/controller.js +4 -0
  3. package/api/routes/routes.js +1 -0
  4. package/node_modules/aws4/aws4.js +1 -1
  5. package/node_modules/aws4/package.json +2 -2
  6. package/node_modules/body-parser/HISTORY.md +7 -0
  7. package/node_modules/body-parser/README.md +11 -0
  8. package/node_modules/body-parser/lib/types/urlencoded.js +30 -7
  9. package/node_modules/body-parser/package.json +2 -2
  10. package/node_modules/encodeurl/README.md +19 -38
  11. package/node_modules/encodeurl/index.js +1 -1
  12. package/node_modules/encodeurl/package.json +7 -7
  13. package/node_modules/express/History.md +27 -0
  14. package/node_modules/express/Readme.md +100 -6
  15. package/node_modules/express/lib/response.js +11 -10
  16. package/node_modules/express/package.json +11 -11
  17. package/node_modules/finalhandler/HISTORY.md +15 -0
  18. package/node_modules/finalhandler/README.md +2 -2
  19. package/node_modules/finalhandler/index.js +7 -2
  20. package/node_modules/finalhandler/package.json +8 -7
  21. package/node_modules/get-fqdn/LICENSE +21 -0
  22. package/node_modules/get-fqdn/README.md +83 -0
  23. package/node_modules/get-fqdn/index.js +17 -0
  24. package/node_modules/get-fqdn/package.json +73 -0
  25. package/node_modules/is-core-module/CHANGELOG.md +10 -0
  26. package/node_modules/is-core-module/core.json +2 -2
  27. package/node_modules/is-core-module/package.json +4 -4
  28. package/node_modules/is-core-module/test/index.js +17 -1
  29. package/node_modules/merge-descriptors/README.md +4 -3
  30. package/node_modules/merge-descriptors/index.js +3 -3
  31. package/node_modules/merge-descriptors/package.json +14 -7
  32. package/node_modules/path-to-regexp/index.js +57 -40
  33. package/node_modules/path-to-regexp/package.json +2 -2
  34. package/node_modules/qs/.editorconfig +3 -0
  35. package/node_modules/qs/.eslintrc +2 -2
  36. package/node_modules/qs/CHANGELOG.md +59 -5
  37. package/node_modules/qs/README.md +133 -49
  38. package/node_modules/qs/dist/qs.js +56 -2020
  39. package/node_modules/qs/lib/parse.js +46 -13
  40. package/node_modules/qs/lib/stringify.js +53 -28
  41. package/node_modules/qs/lib/utils.js +47 -34
  42. package/node_modules/qs/package.json +26 -12
  43. package/node_modules/qs/test/empty-keys-cases.js +267 -0
  44. package/node_modules/qs/test/parse.js +347 -32
  45. package/node_modules/qs/test/stringify.js +436 -47
  46. package/node_modules/send/HISTORY.md +5 -0
  47. package/node_modules/send/index.js +1 -2
  48. package/node_modules/send/node_modules/encodeurl/LICENSE +22 -0
  49. package/node_modules/send/node_modules/encodeurl/README.md +128 -0
  50. package/node_modules/send/node_modules/encodeurl/index.js +60 -0
  51. package/node_modules/send/node_modules/encodeurl/package.json +40 -0
  52. package/node_modules/send/package.json +1 -1
  53. package/node_modules/serve-static/HISTORY.md +16 -0
  54. package/node_modules/serve-static/index.js +1 -2
  55. package/node_modules/serve-static/package.json +3 -3
  56. package/node_modules/yaml/LICENSE +13 -0
  57. package/node_modules/yaml/README.md +155 -0
  58. package/node_modules/yaml/bin.mjs +11 -0
  59. package/node_modules/yaml/browser/dist/compose/compose-collection.js +88 -0
  60. package/node_modules/yaml/browser/dist/compose/compose-doc.js +42 -0
  61. package/node_modules/yaml/browser/dist/compose/compose-node.js +92 -0
  62. package/node_modules/yaml/browser/dist/compose/compose-scalar.js +80 -0
  63. package/node_modules/yaml/browser/dist/compose/composer.js +217 -0
  64. package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +113 -0
  65. package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +198 -0
  66. package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +47 -0
  67. package/node_modules/yaml/browser/dist/compose/resolve-end.js +37 -0
  68. package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +203 -0
  69. package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +223 -0
  70. package/node_modules/yaml/browser/dist/compose/resolve-props.js +148 -0
  71. package/node_modules/yaml/browser/dist/compose/util-contains-newline.js +34 -0
  72. package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +27 -0
  73. package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +15 -0
  74. package/node_modules/yaml/browser/dist/compose/util-map-includes.js +17 -0
  75. package/node_modules/yaml/browser/dist/doc/Document.js +334 -0
  76. package/node_modules/yaml/browser/dist/doc/anchors.js +72 -0
  77. package/node_modules/yaml/browser/dist/doc/applyReviver.js +55 -0
  78. package/node_modules/yaml/browser/dist/doc/createNode.js +89 -0
  79. package/node_modules/yaml/browser/dist/doc/directives.js +176 -0
  80. package/node_modules/yaml/browser/dist/errors.js +57 -0
  81. package/node_modules/yaml/browser/dist/index.js +17 -0
  82. package/node_modules/yaml/browser/dist/log.js +14 -0
  83. package/node_modules/yaml/browser/dist/nodes/Alias.js +101 -0
  84. package/node_modules/yaml/browser/dist/nodes/Collection.js +147 -0
  85. package/node_modules/yaml/browser/dist/nodes/Node.js +38 -0
  86. package/node_modules/yaml/browser/dist/nodes/Pair.js +36 -0
  87. package/node_modules/yaml/browser/dist/nodes/Scalar.js +24 -0
  88. package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +144 -0
  89. package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +113 -0
  90. package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +104 -0
  91. package/node_modules/yaml/browser/dist/nodes/identity.js +36 -0
  92. package/node_modules/yaml/browser/dist/nodes/toJS.js +37 -0
  93. package/node_modules/yaml/browser/dist/parse/cst-scalar.js +214 -0
  94. package/node_modules/yaml/browser/dist/parse/cst-stringify.js +61 -0
  95. package/node_modules/yaml/browser/dist/parse/cst-visit.js +97 -0
  96. package/node_modules/yaml/browser/dist/parse/cst.js +98 -0
  97. package/node_modules/yaml/browser/dist/parse/lexer.js +717 -0
  98. package/node_modules/yaml/browser/dist/parse/line-counter.js +39 -0
  99. package/node_modules/yaml/browser/dist/parse/parser.js +954 -0
  100. package/node_modules/yaml/browser/dist/public-api.js +99 -0
  101. package/node_modules/yaml/browser/dist/schema/Schema.js +38 -0
  102. package/node_modules/yaml/browser/dist/schema/common/map.js +17 -0
  103. package/node_modules/yaml/browser/dist/schema/common/null.js +15 -0
  104. package/node_modules/yaml/browser/dist/schema/common/seq.js +17 -0
  105. package/node_modules/yaml/browser/dist/schema/common/string.js +14 -0
  106. package/node_modules/yaml/browser/dist/schema/core/bool.js +19 -0
  107. package/node_modules/yaml/browser/dist/schema/core/float.js +43 -0
  108. package/node_modules/yaml/browser/dist/schema/core/int.js +38 -0
  109. package/node_modules/yaml/browser/dist/schema/core/schema.js +23 -0
  110. package/node_modules/yaml/browser/dist/schema/json/schema.js +62 -0
  111. package/node_modules/yaml/browser/dist/schema/tags.js +83 -0
  112. package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +66 -0
  113. package/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +26 -0
  114. package/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +46 -0
  115. package/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +71 -0
  116. package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +74 -0
  117. package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +78 -0
  118. package/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +37 -0
  119. package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +93 -0
  120. package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +101 -0
  121. package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +146 -0
  122. package/node_modules/yaml/browser/dist/stringify/stringify.js +124 -0
  123. package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +143 -0
  124. package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +20 -0
  125. package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +85 -0
  126. package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +24 -0
  127. package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +150 -0
  128. package/node_modules/yaml/browser/dist/stringify/stringifyString.js +328 -0
  129. package/node_modules/yaml/browser/dist/util.js +11 -0
  130. package/node_modules/yaml/browser/dist/visit.js +233 -0
  131. package/node_modules/yaml/browser/index.js +5 -0
  132. package/node_modules/yaml/browser/package.json +3 -0
  133. package/node_modules/yaml/dist/cli.d.ts +8 -0
  134. package/node_modules/yaml/dist/cli.mjs +199 -0
  135. package/node_modules/yaml/dist/compose/compose-collection.d.ts +11 -0
  136. package/node_modules/yaml/dist/compose/compose-collection.js +90 -0
  137. package/node_modules/yaml/dist/compose/compose-doc.d.ts +7 -0
  138. package/node_modules/yaml/dist/compose/compose-doc.js +44 -0
  139. package/node_modules/yaml/dist/compose/compose-node.d.ts +28 -0
  140. package/node_modules/yaml/dist/compose/compose-node.js +95 -0
  141. package/node_modules/yaml/dist/compose/compose-scalar.d.ts +5 -0
  142. package/node_modules/yaml/dist/compose/compose-scalar.js +82 -0
  143. package/node_modules/yaml/dist/compose/composer.d.ts +62 -0
  144. package/node_modules/yaml/dist/compose/composer.js +221 -0
  145. package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +6 -0
  146. package/node_modules/yaml/dist/compose/resolve-block-map.js +115 -0
  147. package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +11 -0
  148. package/node_modules/yaml/dist/compose/resolve-block-scalar.js +200 -0
  149. package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +6 -0
  150. package/node_modules/yaml/dist/compose/resolve-block-seq.js +49 -0
  151. package/node_modules/yaml/dist/compose/resolve-end.d.ts +6 -0
  152. package/node_modules/yaml/dist/compose/resolve-end.js +39 -0
  153. package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +7 -0
  154. package/node_modules/yaml/dist/compose/resolve-flow-collection.js +205 -0
  155. package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +10 -0
  156. package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +225 -0
  157. package/node_modules/yaml/dist/compose/resolve-props.d.ts +23 -0
  158. package/node_modules/yaml/dist/compose/resolve-props.js +150 -0
  159. package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +2 -0
  160. package/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
  161. package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +2 -0
  162. package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +29 -0
  163. package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +3 -0
  164. package/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
  165. package/node_modules/yaml/dist/compose/util-map-includes.d.ts +4 -0
  166. package/node_modules/yaml/dist/compose/util-map-includes.js +19 -0
  167. package/node_modules/yaml/dist/doc/Document.d.ts +141 -0
  168. package/node_modules/yaml/dist/doc/Document.js +336 -0
  169. package/node_modules/yaml/dist/doc/anchors.d.ts +24 -0
  170. package/node_modules/yaml/dist/doc/anchors.js +77 -0
  171. package/node_modules/yaml/dist/doc/applyReviver.d.ts +9 -0
  172. package/node_modules/yaml/dist/doc/applyReviver.js +57 -0
  173. package/node_modules/yaml/dist/doc/createNode.d.ts +17 -0
  174. package/node_modules/yaml/dist/doc/createNode.js +91 -0
  175. package/node_modules/yaml/dist/doc/directives.d.ts +49 -0
  176. package/node_modules/yaml/dist/doc/directives.js +178 -0
  177. package/node_modules/yaml/dist/errors.d.ts +21 -0
  178. package/node_modules/yaml/dist/errors.js +62 -0
  179. package/node_modules/yaml/dist/index.d.ts +22 -0
  180. package/node_modules/yaml/dist/index.js +50 -0
  181. package/node_modules/yaml/dist/log.d.ts +3 -0
  182. package/node_modules/yaml/dist/log.js +17 -0
  183. package/node_modules/yaml/dist/nodes/Alias.d.ts +28 -0
  184. package/node_modules/yaml/dist/nodes/Alias.js +103 -0
  185. package/node_modules/yaml/dist/nodes/Collection.d.ts +73 -0
  186. package/node_modules/yaml/dist/nodes/Collection.js +151 -0
  187. package/node_modules/yaml/dist/nodes/Node.d.ts +47 -0
  188. package/node_modules/yaml/dist/nodes/Node.js +40 -0
  189. package/node_modules/yaml/dist/nodes/Pair.d.ts +21 -0
  190. package/node_modules/yaml/dist/nodes/Pair.js +39 -0
  191. package/node_modules/yaml/dist/nodes/Scalar.d.ts +42 -0
  192. package/node_modules/yaml/dist/nodes/Scalar.js +27 -0
  193. package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +53 -0
  194. package/node_modules/yaml/dist/nodes/YAMLMap.js +147 -0
  195. package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +60 -0
  196. package/node_modules/yaml/dist/nodes/YAMLSeq.js +115 -0
  197. package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +4 -0
  198. package/node_modules/yaml/dist/nodes/addPairToJSMap.js +106 -0
  199. package/node_modules/yaml/dist/nodes/identity.d.ts +23 -0
  200. package/node_modules/yaml/dist/nodes/identity.js +53 -0
  201. package/node_modules/yaml/dist/nodes/toJS.d.ts +27 -0
  202. package/node_modules/yaml/dist/nodes/toJS.js +39 -0
  203. package/node_modules/yaml/dist/options.d.ts +338 -0
  204. package/node_modules/yaml/dist/parse/cst-scalar.d.ts +64 -0
  205. package/node_modules/yaml/dist/parse/cst-scalar.js +218 -0
  206. package/node_modules/yaml/dist/parse/cst-stringify.d.ts +8 -0
  207. package/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
  208. package/node_modules/yaml/dist/parse/cst-visit.d.ts +39 -0
  209. package/node_modules/yaml/dist/parse/cst-visit.js +99 -0
  210. package/node_modules/yaml/dist/parse/cst.d.ts +108 -0
  211. package/node_modules/yaml/dist/parse/cst.js +112 -0
  212. package/node_modules/yaml/dist/parse/lexer.d.ts +87 -0
  213. package/node_modules/yaml/dist/parse/lexer.js +719 -0
  214. package/node_modules/yaml/dist/parse/line-counter.d.ts +22 -0
  215. package/node_modules/yaml/dist/parse/line-counter.js +41 -0
  216. package/node_modules/yaml/dist/parse/parser.d.ts +84 -0
  217. package/node_modules/yaml/dist/parse/parser.js +958 -0
  218. package/node_modules/yaml/dist/public-api.d.ts +43 -0
  219. package/node_modules/yaml/dist/public-api.js +104 -0
  220. package/node_modules/yaml/dist/schema/Schema.d.ts +18 -0
  221. package/node_modules/yaml/dist/schema/Schema.js +40 -0
  222. package/node_modules/yaml/dist/schema/common/map.d.ts +2 -0
  223. package/node_modules/yaml/dist/schema/common/map.js +19 -0
  224. package/node_modules/yaml/dist/schema/common/null.d.ts +4 -0
  225. package/node_modules/yaml/dist/schema/common/null.js +17 -0
  226. package/node_modules/yaml/dist/schema/common/seq.d.ts +2 -0
  227. package/node_modules/yaml/dist/schema/common/seq.js +19 -0
  228. package/node_modules/yaml/dist/schema/common/string.d.ts +2 -0
  229. package/node_modules/yaml/dist/schema/common/string.js +16 -0
  230. package/node_modules/yaml/dist/schema/core/bool.d.ts +4 -0
  231. package/node_modules/yaml/dist/schema/core/bool.js +21 -0
  232. package/node_modules/yaml/dist/schema/core/float.d.ts +4 -0
  233. package/node_modules/yaml/dist/schema/core/float.js +47 -0
  234. package/node_modules/yaml/dist/schema/core/int.d.ts +4 -0
  235. package/node_modules/yaml/dist/schema/core/int.js +42 -0
  236. package/node_modules/yaml/dist/schema/core/schema.d.ts +1 -0
  237. package/node_modules/yaml/dist/schema/core/schema.js +25 -0
  238. package/node_modules/yaml/dist/schema/json/schema.d.ts +2 -0
  239. package/node_modules/yaml/dist/schema/json/schema.js +64 -0
  240. package/node_modules/yaml/dist/schema/json-schema.d.ts +69 -0
  241. package/node_modules/yaml/dist/schema/tags.d.ts +40 -0
  242. package/node_modules/yaml/dist/schema/tags.js +86 -0
  243. package/node_modules/yaml/dist/schema/types.d.ts +90 -0
  244. package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +2 -0
  245. package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +68 -0
  246. package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +7 -0
  247. package/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
  248. package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +4 -0
  249. package/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
  250. package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +5 -0
  251. package/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
  252. package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +28 -0
  253. package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +77 -0
  254. package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +10 -0
  255. package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +82 -0
  256. package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -0
  257. package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +39 -0
  258. package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +28 -0
  259. package/node_modules/yaml/dist/schema/yaml-1.1/set.js +96 -0
  260. package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +6 -0
  261. package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
  262. package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +34 -0
  263. package/node_modules/yaml/dist/stringify/foldFlowLines.js +151 -0
  264. package/node_modules/yaml/dist/stringify/stringify.d.ts +21 -0
  265. package/node_modules/yaml/dist/stringify/stringify.js +127 -0
  266. package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +17 -0
  267. package/node_modules/yaml/dist/stringify/stringifyCollection.js +145 -0
  268. package/node_modules/yaml/dist/stringify/stringifyComment.d.ts +10 -0
  269. package/node_modules/yaml/dist/stringify/stringifyComment.js +24 -0
  270. package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +4 -0
  271. package/node_modules/yaml/dist/stringify/stringifyDocument.js +87 -0
  272. package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +2 -0
  273. package/node_modules/yaml/dist/stringify/stringifyNumber.js +26 -0
  274. package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +3 -0
  275. package/node_modules/yaml/dist/stringify/stringifyPair.js +152 -0
  276. package/node_modules/yaml/dist/stringify/stringifyString.d.ts +9 -0
  277. package/node_modules/yaml/dist/stringify/stringifyString.js +330 -0
  278. package/node_modules/yaml/dist/test-events.d.ts +4 -0
  279. package/node_modules/yaml/dist/test-events.js +134 -0
  280. package/node_modules/yaml/dist/util.d.ts +12 -0
  281. package/node_modules/yaml/dist/util.js +28 -0
  282. package/node_modules/yaml/dist/visit.d.ts +102 -0
  283. package/node_modules/yaml/dist/visit.js +236 -0
  284. package/node_modules/yaml/package.json +96 -0
  285. package/node_modules/yaml/util.js +2 -0
  286. package/package.json +7 -3
  287. package/server.js +50 -23
  288. package/node_modules/path-to-regexp/History.md +0 -36
  289. /package/node_modules/{encodeurl → send/node_modules/encodeurl}/HISTORY.md +0 -0
@@ -482,8 +482,7 @@ SendStream.prototype.redirect = function redirect (path) {
482
482
  }
483
483
 
484
484
  var loc = encodeUrl(collapseLeadingSlashes(this.path + '/'))
485
- var doc = createHtmlDocument('Redirecting', 'Redirecting to <a href="' + escapeHtml(loc) + '">' +
486
- escapeHtml(loc) + '</a>')
485
+ var doc = createHtmlDocument('Redirecting', 'Redirecting to ' + escapeHtml(loc))
487
486
 
488
487
  // redirect
489
488
  res.statusCode = 301
@@ -0,0 +1,22 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2016 Douglas Christopher Wilson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,128 @@
1
+ # encodeurl
2
+
3
+ [![NPM Version][npm-image]][npm-url]
4
+ [![NPM Downloads][downloads-image]][downloads-url]
5
+ [![Node.js Version][node-version-image]][node-version-url]
6
+ [![Build Status][travis-image]][travis-url]
7
+ [![Test Coverage][coveralls-image]][coveralls-url]
8
+
9
+ Encode a URL to a percent-encoded form, excluding already-encoded sequences
10
+
11
+ ## Installation
12
+
13
+ This is a [Node.js](https://nodejs.org/en/) module available through the
14
+ [npm registry](https://www.npmjs.com/). Installation is done using the
15
+ [`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
16
+
17
+ ```sh
18
+ $ npm install encodeurl
19
+ ```
20
+
21
+ ## API
22
+
23
+ ```js
24
+ var encodeUrl = require('encodeurl')
25
+ ```
26
+
27
+ ### encodeUrl(url)
28
+
29
+ Encode a URL to a percent-encoded form, excluding already-encoded sequences.
30
+
31
+ This function will take an already-encoded URL and encode all the non-URL
32
+ code points (as UTF-8 byte sequences). This function will not encode the
33
+ "%" character unless it is not part of a valid sequence (`%20` will be
34
+ left as-is, but `%foo` will be encoded as `%25foo`).
35
+
36
+ This encode is meant to be "safe" and does not throw errors. It will try as
37
+ hard as it can to properly encode the given URL, including replacing any raw,
38
+ unpaired surrogate pairs with the Unicode replacement character prior to
39
+ encoding.
40
+
41
+ This function is _similar_ to the intrinsic function `encodeURI`, except it
42
+ will not encode the `%` character if that is part of a valid sequence, will
43
+ not encode `[` and `]` (for IPv6 hostnames) and will replace raw, unpaired
44
+ surrogate pairs with the Unicode replacement character (instead of throwing).
45
+
46
+ ## Examples
47
+
48
+ ### Encode a URL containing user-controled data
49
+
50
+ ```js
51
+ var encodeUrl = require('encodeurl')
52
+ var escapeHtml = require('escape-html')
53
+
54
+ http.createServer(function onRequest (req, res) {
55
+ // get encoded form of inbound url
56
+ var url = encodeUrl(req.url)
57
+
58
+ // create html message
59
+ var body = '<p>Location ' + escapeHtml(url) + ' not found</p>'
60
+
61
+ // send a 404
62
+ res.statusCode = 404
63
+ res.setHeader('Content-Type', 'text/html; charset=UTF-8')
64
+ res.setHeader('Content-Length', String(Buffer.byteLength(body, 'utf-8')))
65
+ res.end(body, 'utf-8')
66
+ })
67
+ ```
68
+
69
+ ### Encode a URL for use in a header field
70
+
71
+ ```js
72
+ var encodeUrl = require('encodeurl')
73
+ var escapeHtml = require('escape-html')
74
+ var url = require('url')
75
+
76
+ http.createServer(function onRequest (req, res) {
77
+ // parse inbound url
78
+ var href = url.parse(req)
79
+
80
+ // set new host for redirect
81
+ href.host = 'localhost'
82
+ href.protocol = 'https:'
83
+ href.slashes = true
84
+
85
+ // create location header
86
+ var location = encodeUrl(url.format(href))
87
+
88
+ // create html message
89
+ var body = '<p>Redirecting to new site: ' + escapeHtml(location) + '</p>'
90
+
91
+ // send a 301
92
+ res.statusCode = 301
93
+ res.setHeader('Content-Type', 'text/html; charset=UTF-8')
94
+ res.setHeader('Content-Length', String(Buffer.byteLength(body, 'utf-8')))
95
+ res.setHeader('Location', location)
96
+ res.end(body, 'utf-8')
97
+ })
98
+ ```
99
+
100
+ ## Testing
101
+
102
+ ```sh
103
+ $ npm test
104
+ $ npm run lint
105
+ ```
106
+
107
+ ## References
108
+
109
+ - [RFC 3986: Uniform Resource Identifier (URI): Generic Syntax][rfc-3986]
110
+ - [WHATWG URL Living Standard][whatwg-url]
111
+
112
+ [rfc-3986]: https://tools.ietf.org/html/rfc3986
113
+ [whatwg-url]: https://url.spec.whatwg.org/
114
+
115
+ ## License
116
+
117
+ [MIT](LICENSE)
118
+
119
+ [npm-image]: https://img.shields.io/npm/v/encodeurl.svg
120
+ [npm-url]: https://npmjs.org/package/encodeurl
121
+ [node-version-image]: https://img.shields.io/node/v/encodeurl.svg
122
+ [node-version-url]: https://nodejs.org/en/download
123
+ [travis-image]: https://img.shields.io/travis/pillarjs/encodeurl.svg
124
+ [travis-url]: https://travis-ci.org/pillarjs/encodeurl
125
+ [coveralls-image]: https://img.shields.io/coveralls/pillarjs/encodeurl.svg
126
+ [coveralls-url]: https://coveralls.io/r/pillarjs/encodeurl?branch=master
127
+ [downloads-image]: https://img.shields.io/npm/dm/encodeurl.svg
128
+ [downloads-url]: https://npmjs.org/package/encodeurl
@@ -0,0 +1,60 @@
1
+ /*!
2
+ * encodeurl
3
+ * Copyright(c) 2016 Douglas Christopher Wilson
4
+ * MIT Licensed
5
+ */
6
+
7
+ 'use strict'
8
+
9
+ /**
10
+ * Module exports.
11
+ * @public
12
+ */
13
+
14
+ module.exports = encodeUrl
15
+
16
+ /**
17
+ * RegExp to match non-URL code points, *after* encoding (i.e. not including "%")
18
+ * and including invalid escape sequences.
19
+ * @private
20
+ */
21
+
22
+ var ENCODE_CHARS_REGEXP = /(?:[^\x21\x25\x26-\x3B\x3D\x3F-\x5B\x5D\x5F\x61-\x7A\x7E]|%(?:[^0-9A-Fa-f]|[0-9A-Fa-f][^0-9A-Fa-f]|$))+/g
23
+
24
+ /**
25
+ * RegExp to match unmatched surrogate pair.
26
+ * @private
27
+ */
28
+
29
+ var UNMATCHED_SURROGATE_PAIR_REGEXP = /(^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]|[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/g
30
+
31
+ /**
32
+ * String to replace unmatched surrogate pair with.
33
+ * @private
34
+ */
35
+
36
+ var UNMATCHED_SURROGATE_PAIR_REPLACE = '$1\uFFFD$2'
37
+
38
+ /**
39
+ * Encode a URL to a percent-encoded form, excluding already-encoded sequences.
40
+ *
41
+ * This function will take an already-encoded URL and encode all the non-URL
42
+ * code points. This function will not encode the "%" character unless it is
43
+ * not part of a valid sequence (`%20` will be left as-is, but `%foo` will
44
+ * be encoded as `%25foo`).
45
+ *
46
+ * This encode is meant to be "safe" and does not throw errors. It will try as
47
+ * hard as it can to properly encode the given URL, including replacing any raw,
48
+ * unpaired surrogate pairs with the Unicode replacement character prior to
49
+ * encoding.
50
+ *
51
+ * @param {string} url
52
+ * @return {string}
53
+ * @public
54
+ */
55
+
56
+ function encodeUrl (url) {
57
+ return String(url)
58
+ .replace(UNMATCHED_SURROGATE_PAIR_REGEXP, UNMATCHED_SURROGATE_PAIR_REPLACE)
59
+ .replace(ENCODE_CHARS_REGEXP, encodeURI)
60
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "encodeurl",
3
+ "description": "Encode a URL to a percent-encoded form, excluding already-encoded sequences",
4
+ "version": "1.0.2",
5
+ "contributors": [
6
+ "Douglas Christopher Wilson <doug@somethingdoug.com>"
7
+ ],
8
+ "license": "MIT",
9
+ "keywords": [
10
+ "encode",
11
+ "encodeurl",
12
+ "url"
13
+ ],
14
+ "repository": "pillarjs/encodeurl",
15
+ "devDependencies": {
16
+ "eslint": "3.19.0",
17
+ "eslint-config-standard": "10.2.1",
18
+ "eslint-plugin-import": "2.8.0",
19
+ "eslint-plugin-node": "5.2.1",
20
+ "eslint-plugin-promise": "3.6.0",
21
+ "eslint-plugin-standard": "3.0.1",
22
+ "istanbul": "0.4.5",
23
+ "mocha": "2.5.3"
24
+ },
25
+ "files": [
26
+ "LICENSE",
27
+ "HISTORY.md",
28
+ "README.md",
29
+ "index.js"
30
+ ],
31
+ "engines": {
32
+ "node": ">= 0.8"
33
+ },
34
+ "scripts": {
35
+ "lint": "eslint .",
36
+ "test": "mocha --reporter spec --bail --check-leaks test/",
37
+ "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
38
+ "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
39
+ }
40
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "send",
3
3
  "description": "Better streaming static file server with Range and conditional-GET support",
4
- "version": "0.18.0",
4
+ "version": "0.19.0",
5
5
  "author": "TJ Holowaychuk <tj@vision-media.ca>",
6
6
  "contributors": [
7
7
  "Douglas Christopher Wilson <doug@somethingdoug.com>",
@@ -1,3 +1,19 @@
1
+ 1.16.2 / 2024-09-11
2
+ ===================
3
+
4
+ * deps: encodeurl@~2.0.0
5
+
6
+ 1.16.1 / 2024-09-11
7
+ ===================
8
+
9
+ * deps: send@0.19.0
10
+
11
+ 1.16.0 / 2024-09-10
12
+ ===================
13
+
14
+ * Remove link renderization in html while redirecting
15
+
16
+
1
17
  1.15.0 / 2022-03-24
2
18
  ===================
3
19
 
@@ -195,8 +195,7 @@ function createRedirectDirectoryListener () {
195
195
 
196
196
  // reformat the URL
197
197
  var loc = encodeUrl(url.format(originalUrl))
198
- var doc = createHtmlDocument('Redirecting', 'Redirecting to <a href="' + escapeHtml(loc) + '">' +
199
- escapeHtml(loc) + '</a>')
198
+ var doc = createHtmlDocument('Redirecting', 'Redirecting to ' + escapeHtml(loc))
200
199
 
201
200
  // send redirect response
202
201
  res.statusCode = 301
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "serve-static",
3
3
  "description": "Serve static files",
4
- "version": "1.15.0",
4
+ "version": "1.16.2",
5
5
  "author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
6
6
  "license": "MIT",
7
7
  "repository": "expressjs/serve-static",
8
8
  "dependencies": {
9
- "encodeurl": "~1.0.2",
9
+ "encodeurl": "~2.0.0",
10
10
  "escape-html": "~1.0.3",
11
11
  "parseurl": "~1.3.3",
12
- "send": "0.18.0"
12
+ "send": "0.19.0"
13
13
  },
14
14
  "devDependencies": {
15
15
  "eslint": "7.32.0",
@@ -0,0 +1,13 @@
1
+ Copyright Eemeli Aro <eemeli@gmail.com>
2
+
3
+ Permission to use, copy, modify, and/or distribute this software for any purpose
4
+ with or without fee is hereby granted, provided that the above copyright notice
5
+ and this permission notice appear in all copies.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
9
+ FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
11
+ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
12
+ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
13
+ THIS SOFTWARE.
@@ -0,0 +1,155 @@
1
+ # YAML <a href="https://www.npmjs.com/package/yaml"><img align="right" src="https://badge.fury.io/js/yaml.svg" title="npm package" /></a>
2
+
3
+ `yaml` is a definitive library for [YAML](https://yaml.org/), the human friendly data serialization standard.
4
+ This library:
5
+
6
+ - Supports both YAML 1.1 and YAML 1.2 and all common data schemas,
7
+ - Passes all of the [yaml-test-suite](https://github.com/yaml/yaml-test-suite) tests,
8
+ - Can accept any string as input without throwing, parsing as much YAML out of it as it can, and
9
+ - Supports parsing, modifying, and writing YAML comments and blank lines.
10
+
11
+ The library is released under the ISC open source license, and the code is [available on GitHub](https://github.com/eemeli/yaml/).
12
+ It has no external dependencies and runs on Node.js as well as modern browsers.
13
+
14
+ For the purposes of versioning, any changes that break any of the documented endpoints or APIs will be considered semver-major breaking changes.
15
+ Undocumented library internals may change between minor versions, and previous APIs may be deprecated (but not removed).
16
+
17
+ The minimum supported TypeScript version of the included typings is 3.9;
18
+ for use in earlier versions you may need to set `skipLibCheck: true` in your config.
19
+ This requirement may be updated between minor versions of the library.
20
+
21
+ For more information, see the project's documentation site: [**eemeli.org/yaml**](https://eemeli.org/yaml/)
22
+
23
+ To install:
24
+
25
+ ```sh
26
+ npm install yaml
27
+ ```
28
+
29
+ **Note:** These docs are for `yaml@2`. For v1, see the [v1.10.0 tag](https://github.com/eemeli/yaml/tree/v1.10.0) for the source and [eemeli.org/yaml/v1](https://eemeli.org/yaml/v1/) for the documentation.
30
+
31
+ The development and maintenance of this library is [sponsored](https://github.com/sponsors/eemeli) by:
32
+
33
+ <a href="https://www.scipress.io/">
34
+ <img width=150 src="https://eemeli.org/yaml/images/scipress.svg" alt="Scipress" />
35
+ </a>
36
+
37
+ ## API Overview
38
+
39
+ The API provided by `yaml` has three layers, depending on how deep you need to go: [Parse & Stringify](https://eemeli.org/yaml/#parse-amp-stringify), [Documents](https://eemeli.org/yaml/#documents), and the underlying [Lexer/Parser/Composer](https://eemeli.org/yaml/#parsing-yaml).
40
+ The first has the simplest API and "just works", the second gets you all the bells and whistles supported by the library along with a decent [AST](https://eemeli.org/yaml/#content-nodes), and the third lets you get progressively closer to YAML source, if that's your thing.
41
+
42
+ A [command-line tool](https://eemeli.org/yaml/#command-line-tool) is also included.
43
+
44
+ ```js
45
+ import { parse, stringify } from 'yaml'
46
+ // or
47
+ import YAML from 'yaml'
48
+ // or
49
+ const YAML = require('yaml')
50
+ ```
51
+
52
+ ### Parse & Stringify
53
+
54
+ - [`parse(str, reviver?, options?): value`](https://eemeli.org/yaml/#yaml-parse)
55
+ - [`stringify(value, replacer?, options?): string`](https://eemeli.org/yaml/#yaml-stringify)
56
+
57
+ ### Documents
58
+
59
+ - [`Document`](https://eemeli.org/yaml/#documents)
60
+ - [`constructor(value, replacer?, options?)`](https://eemeli.org/yaml/#creating-documents)
61
+ - [`#anchors`](https://eemeli.org/yaml/#working-with-anchors)
62
+ - [`#contents`](https://eemeli.org/yaml/#content-nodes)
63
+ - [`#directives`](https://eemeli.org/yaml/#stream-directives)
64
+ - [`#errors`](https://eemeli.org/yaml/#errors)
65
+ - [`#warnings`](https://eemeli.org/yaml/#errors)
66
+ - [`isDocument(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types)
67
+ - [`parseAllDocuments(str, options?): Document[]`](https://eemeli.org/yaml/#parsing-documents)
68
+ - [`parseDocument(str, options?): Document`](https://eemeli.org/yaml/#parsing-documents)
69
+
70
+ ### Content Nodes
71
+
72
+ - [`isAlias(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types)
73
+ - [`isCollection(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types)
74
+ - [`isMap(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types)
75
+ - [`isNode(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types)
76
+ - [`isPair(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types)
77
+ - [`isScalar(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types)
78
+ - [`isSeq(foo): boolean`](https://eemeli.org/yaml/#identifying-node-types)
79
+ - [`new Scalar(value)`](https://eemeli.org/yaml/#scalar-values)
80
+ - [`new YAMLMap()`](https://eemeli.org/yaml/#collections)
81
+ - [`new YAMLSeq()`](https://eemeli.org/yaml/#collections)
82
+ - [`doc.createAlias(node, name?): Alias`](https://eemeli.org/yaml/#working-with-anchors)
83
+ - [`doc.createNode(value, options?): Node`](https://eemeli.org/yaml/#creating-nodes)
84
+ - [`doc.createPair(key, value): Pair`](https://eemeli.org/yaml/#creating-nodes)
85
+ - [`visit(node, visitor)`](https://eemeli.org/yaml/#finding-and-modifying-nodes)
86
+
87
+ ### Parsing YAML
88
+
89
+ - [`new Lexer().lex(src)`](https://eemeli.org/yaml/#lexer)
90
+ - [`new Parser(onNewLine?).parse(src)`](https://eemeli.org/yaml/#parser)
91
+ - [`new Composer(options?).compose(tokens)`](https://eemeli.org/yaml/#composer)
92
+
93
+ ## YAML.parse
94
+
95
+ ```yaml
96
+ # file.yml
97
+ YAML:
98
+ - A human-readable data serialization language
99
+ - https://en.wikipedia.org/wiki/YAML
100
+ yaml:
101
+ - A complete JavaScript implementation
102
+ - https://www.npmjs.com/package/yaml
103
+ ```
104
+
105
+ ```js
106
+ import fs from 'fs'
107
+ import YAML from 'yaml'
108
+
109
+ YAML.parse('3.14159')
110
+ // 3.14159
111
+
112
+ YAML.parse('[ true, false, maybe, null ]\n')
113
+ // [ true, false, 'maybe', null ]
114
+
115
+ const file = fs.readFileSync('./file.yml', 'utf8')
116
+ YAML.parse(file)
117
+ // { YAML:
118
+ // [ 'A human-readable data serialization language',
119
+ // 'https://en.wikipedia.org/wiki/YAML' ],
120
+ // yaml:
121
+ // [ 'A complete JavaScript implementation',
122
+ // 'https://www.npmjs.com/package/yaml' ] }
123
+ ```
124
+
125
+ ## YAML.stringify
126
+
127
+ ```js
128
+ import YAML from 'yaml'
129
+
130
+ YAML.stringify(3.14159)
131
+ // '3.14159\n'
132
+
133
+ YAML.stringify([true, false, 'maybe', null])
134
+ // `- true
135
+ // - false
136
+ // - maybe
137
+ // - null
138
+ // `
139
+
140
+ YAML.stringify({ number: 3, plain: 'string', block: 'two\nlines\n' })
141
+ // `number: 3
142
+ // plain: string
143
+ // block: |
144
+ // two
145
+ // lines
146
+ // `
147
+ ```
148
+
149
+ ---
150
+
151
+ Browser testing provided by:
152
+
153
+ <a href="https://www.browserstack.com/open-source">
154
+ <img width=200 src="https://eemeli.org/yaml/images/browserstack.svg" alt="BrowserStack" />
155
+ </a>
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { UserError, cli, help } from './dist/cli.mjs'
4
+
5
+ cli(process.stdin, error => {
6
+ if (error instanceof UserError) {
7
+ if (error.code === UserError.ARGS) console.error(`${help}\n`)
8
+ console.error(error.message)
9
+ process.exitCode = error.code
10
+ } else if (error) throw error
11
+ })
@@ -0,0 +1,88 @@
1
+ import { isNode } from '../nodes/identity.js';
2
+ import { Scalar } from '../nodes/Scalar.js';
3
+ import { YAMLMap } from '../nodes/YAMLMap.js';
4
+ import { YAMLSeq } from '../nodes/YAMLSeq.js';
5
+ import { resolveBlockMap } from './resolve-block-map.js';
6
+ import { resolveBlockSeq } from './resolve-block-seq.js';
7
+ import { resolveFlowCollection } from './resolve-flow-collection.js';
8
+
9
+ function resolveCollection(CN, ctx, token, onError, tagName, tag) {
10
+ const coll = token.type === 'block-map'
11
+ ? resolveBlockMap(CN, ctx, token, onError, tag)
12
+ : token.type === 'block-seq'
13
+ ? resolveBlockSeq(CN, ctx, token, onError, tag)
14
+ : resolveFlowCollection(CN, ctx, token, onError, tag);
15
+ const Coll = coll.constructor;
16
+ // If we got a tagName matching the class, or the tag name is '!',
17
+ // then use the tagName from the node class used to create it.
18
+ if (tagName === '!' || tagName === Coll.tagName) {
19
+ coll.tag = Coll.tagName;
20
+ return coll;
21
+ }
22
+ if (tagName)
23
+ coll.tag = tagName;
24
+ return coll;
25
+ }
26
+ function composeCollection(CN, ctx, token, props, onError) {
27
+ const tagToken = props.tag;
28
+ const tagName = !tagToken
29
+ ? null
30
+ : ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg));
31
+ if (token.type === 'block-seq') {
32
+ const { anchor, newlineAfterProp: nl } = props;
33
+ const lastProp = anchor && tagToken
34
+ ? anchor.offset > tagToken.offset
35
+ ? anchor
36
+ : tagToken
37
+ : (anchor ?? tagToken);
38
+ if (lastProp && (!nl || nl.offset < lastProp.offset)) {
39
+ const message = 'Missing newline after block sequence props';
40
+ onError(lastProp, 'MISSING_CHAR', message);
41
+ }
42
+ }
43
+ const expType = token.type === 'block-map'
44
+ ? 'map'
45
+ : token.type === 'block-seq'
46
+ ? 'seq'
47
+ : token.start.source === '{'
48
+ ? 'map'
49
+ : 'seq';
50
+ // shortcut: check if it's a generic YAMLMap or YAMLSeq
51
+ // before jumping into the custom tag logic.
52
+ if (!tagToken ||
53
+ !tagName ||
54
+ tagName === '!' ||
55
+ (tagName === YAMLMap.tagName && expType === 'map') ||
56
+ (tagName === YAMLSeq.tagName && expType === 'seq')) {
57
+ return resolveCollection(CN, ctx, token, onError, tagName);
58
+ }
59
+ let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);
60
+ if (!tag) {
61
+ const kt = ctx.schema.knownTags[tagName];
62
+ if (kt && kt.collection === expType) {
63
+ ctx.schema.tags.push(Object.assign({}, kt, { default: false }));
64
+ tag = kt;
65
+ }
66
+ else {
67
+ if (kt?.collection) {
68
+ onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection}`, true);
69
+ }
70
+ else {
71
+ onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);
72
+ }
73
+ return resolveCollection(CN, ctx, token, onError, tagName);
74
+ }
75
+ }
76
+ const coll = resolveCollection(CN, ctx, token, onError, tagName, tag);
77
+ const res = tag.resolve?.(coll, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg), ctx.options) ?? coll;
78
+ const node = isNode(res)
79
+ ? res
80
+ : new Scalar(res);
81
+ node.range = coll.range;
82
+ node.tag = tagName;
83
+ if (tag?.format)
84
+ node.format = tag.format;
85
+ return node;
86
+ }
87
+
88
+ export { composeCollection };
@@ -0,0 +1,42 @@
1
+ import { Document } from '../doc/Document.js';
2
+ import { composeNode, composeEmptyNode } from './compose-node.js';
3
+ import { resolveEnd } from './resolve-end.js';
4
+ import { resolveProps } from './resolve-props.js';
5
+
6
+ function composeDoc(options, directives, { offset, start, value, end }, onError) {
7
+ const opts = Object.assign({ _directives: directives }, options);
8
+ const doc = new Document(undefined, opts);
9
+ const ctx = {
10
+ atRoot: true,
11
+ directives: doc.directives,
12
+ options: doc.options,
13
+ schema: doc.schema
14
+ };
15
+ const props = resolveProps(start, {
16
+ indicator: 'doc-start',
17
+ next: value ?? end?.[0],
18
+ offset,
19
+ onError,
20
+ parentIndent: 0,
21
+ startOnNewline: true
22
+ });
23
+ if (props.found) {
24
+ doc.directives.docStart = true;
25
+ if (value &&
26
+ (value.type === 'block-map' || value.type === 'block-seq') &&
27
+ !props.hasNewline)
28
+ onError(props.end, 'MISSING_CHAR', 'Block collection cannot start on same line with directives-end marker');
29
+ }
30
+ // @ts-expect-error If Contents is set, let's trust the user
31
+ doc.contents = value
32
+ ? composeNode(ctx, value, props, onError)
33
+ : composeEmptyNode(ctx, props.end, start, null, props, onError);
34
+ const contentEnd = doc.contents.range[2];
35
+ const re = resolveEnd(end, contentEnd, false, onError);
36
+ if (re.comment)
37
+ doc.comment = re.comment;
38
+ doc.range = [offset, contentEnd, re.offset];
39
+ return doc;
40
+ }
41
+
42
+ export { composeDoc };