poe-code 13.0.0 → 13.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/README.md +26 -5
  2. package/dist/index.js +96 -7
  3. package/dist/index.js.map +4 -4
  4. package/dist/metafile.json +1 -1
  5. package/node_modules/esprima/LICENSE.BSD +21 -0
  6. package/node_modules/esprima/README.md +46 -0
  7. package/node_modules/esprima/bin/esparse.js +139 -0
  8. package/node_modules/esprima/bin/esvalidate.js +236 -0
  9. package/node_modules/esprima/dist/esprima.js +6709 -0
  10. package/node_modules/esprima/package.json +112 -0
  11. package/node_modules/extend-shallow/LICENSE +21 -0
  12. package/node_modules/extend-shallow/README.md +61 -0
  13. package/node_modules/extend-shallow/index.js +33 -0
  14. package/node_modules/extend-shallow/package.json +56 -0
  15. package/node_modules/gray-matter/LICENSE +21 -0
  16. package/node_modules/gray-matter/README.md +565 -0
  17. package/node_modules/gray-matter/gray-matter.d.ts +114 -0
  18. package/node_modules/gray-matter/index.js +228 -0
  19. package/node_modules/gray-matter/lib/defaults.js +18 -0
  20. package/node_modules/gray-matter/lib/engine.js +30 -0
  21. package/node_modules/gray-matter/lib/engines.js +54 -0
  22. package/node_modules/gray-matter/lib/excerpt.js +32 -0
  23. package/node_modules/gray-matter/lib/parse.js +13 -0
  24. package/node_modules/gray-matter/lib/stringify.js +56 -0
  25. package/node_modules/gray-matter/lib/to-file.js +43 -0
  26. package/node_modules/gray-matter/lib/utils.js +66 -0
  27. package/node_modules/gray-matter/node_modules/argparse/LICENSE +21 -0
  28. package/node_modules/gray-matter/node_modules/argparse/README.md +257 -0
  29. package/node_modules/gray-matter/node_modules/argparse/index.js +3 -0
  30. package/node_modules/gray-matter/node_modules/argparse/lib/action/append/constant.js +47 -0
  31. package/node_modules/gray-matter/node_modules/argparse/lib/action/append.js +53 -0
  32. package/node_modules/gray-matter/node_modules/argparse/lib/action/count.js +40 -0
  33. package/node_modules/gray-matter/node_modules/argparse/lib/action/help.js +47 -0
  34. package/node_modules/gray-matter/node_modules/argparse/lib/action/store/constant.js +43 -0
  35. package/node_modules/gray-matter/node_modules/argparse/lib/action/store/false.js +27 -0
  36. package/node_modules/gray-matter/node_modules/argparse/lib/action/store/true.js +26 -0
  37. package/node_modules/gray-matter/node_modules/argparse/lib/action/store.js +50 -0
  38. package/node_modules/gray-matter/node_modules/argparse/lib/action/subparsers.js +149 -0
  39. package/node_modules/gray-matter/node_modules/argparse/lib/action/version.js +47 -0
  40. package/node_modules/gray-matter/node_modules/argparse/lib/action.js +146 -0
  41. package/node_modules/gray-matter/node_modules/argparse/lib/action_container.js +482 -0
  42. package/node_modules/gray-matter/node_modules/argparse/lib/argparse.js +14 -0
  43. package/node_modules/gray-matter/node_modules/argparse/lib/argument/error.js +50 -0
  44. package/node_modules/gray-matter/node_modules/argparse/lib/argument/exclusive.js +54 -0
  45. package/node_modules/gray-matter/node_modules/argparse/lib/argument/group.js +75 -0
  46. package/node_modules/gray-matter/node_modules/argparse/lib/argument_parser.js +1161 -0
  47. package/node_modules/gray-matter/node_modules/argparse/lib/const.js +21 -0
  48. package/node_modules/gray-matter/node_modules/argparse/lib/help/added_formatters.js +87 -0
  49. package/node_modules/gray-matter/node_modules/argparse/lib/help/formatter.js +795 -0
  50. package/node_modules/gray-matter/node_modules/argparse/lib/namespace.js +76 -0
  51. package/node_modules/gray-matter/node_modules/argparse/lib/utils.js +57 -0
  52. package/node_modules/gray-matter/node_modules/argparse/package.json +34 -0
  53. package/node_modules/gray-matter/node_modules/js-yaml/LICENSE +21 -0
  54. package/node_modules/gray-matter/node_modules/js-yaml/README.md +302 -0
  55. package/node_modules/gray-matter/node_modules/js-yaml/bin/js-yaml.js +132 -0
  56. package/node_modules/gray-matter/node_modules/js-yaml/dist/js-yaml.js +4011 -0
  57. package/node_modules/gray-matter/node_modules/js-yaml/dist/js-yaml.min.js +1 -0
  58. package/node_modules/gray-matter/node_modules/js-yaml/index.js +7 -0
  59. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/common.js +59 -0
  60. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/dumper.js +850 -0
  61. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/exception.js +43 -0
  62. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/loader.js +1666 -0
  63. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/mark.js +76 -0
  64. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/core.js +18 -0
  65. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/default_full.js +25 -0
  66. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js +28 -0
  67. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js +17 -0
  68. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/json.js +25 -0
  69. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema.js +108 -0
  70. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/binary.js +138 -0
  71. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/bool.js +35 -0
  72. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/float.js +116 -0
  73. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/int.js +173 -0
  74. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/function.js +93 -0
  75. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js +60 -0
  76. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js +28 -0
  77. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/map.js +8 -0
  78. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/merge.js +12 -0
  79. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/null.js +34 -0
  80. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/omap.js +44 -0
  81. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/pairs.js +53 -0
  82. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/seq.js +8 -0
  83. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/set.js +29 -0
  84. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/str.js +8 -0
  85. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/timestamp.js +88 -0
  86. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type.js +61 -0
  87. package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml.js +39 -0
  88. package/node_modules/gray-matter/node_modules/js-yaml/package.json +52 -0
  89. package/node_modules/gray-matter/package.json +127 -0
  90. package/node_modules/is-extendable/LICENSE +21 -0
  91. package/node_modules/is-extendable/README.md +72 -0
  92. package/node_modules/is-extendable/index.js +13 -0
  93. package/node_modules/is-extendable/package.json +51 -0
  94. package/node_modules/kind-of/LICENSE +21 -0
  95. package/node_modules/kind-of/README.md +367 -0
  96. package/node_modules/kind-of/index.js +129 -0
  97. package/node_modules/kind-of/package.json +88 -0
  98. package/node_modules/section-matter/LICENSE +21 -0
  99. package/node_modules/section-matter/README.md +236 -0
  100. package/node_modules/section-matter/index.js +136 -0
  101. package/node_modules/section-matter/package.json +55 -0
  102. package/node_modules/sprintf-js/.npmignore +1 -0
  103. package/node_modules/sprintf-js/LICENSE +24 -0
  104. package/node_modules/sprintf-js/README.md +88 -0
  105. package/node_modules/sprintf-js/bower.json +14 -0
  106. package/node_modules/sprintf-js/demo/angular.html +20 -0
  107. package/node_modules/sprintf-js/dist/angular-sprintf.min.js +4 -0
  108. package/node_modules/sprintf-js/dist/angular-sprintf.min.js.map +1 -0
  109. package/node_modules/sprintf-js/dist/angular-sprintf.min.map +1 -0
  110. package/node_modules/sprintf-js/dist/sprintf.min.js +4 -0
  111. package/node_modules/sprintf-js/dist/sprintf.min.js.map +1 -0
  112. package/node_modules/sprintf-js/dist/sprintf.min.map +1 -0
  113. package/node_modules/sprintf-js/gruntfile.js +36 -0
  114. package/node_modules/sprintf-js/package.json +22 -0
  115. package/node_modules/sprintf-js/src/angular-sprintf.js +18 -0
  116. package/node_modules/sprintf-js/src/sprintf.js +208 -0
  117. package/node_modules/sprintf-js/test/test.js +82 -0
  118. package/node_modules/strip-bom-string/LICENSE +21 -0
  119. package/node_modules/strip-bom-string/README.md +66 -0
  120. package/node_modules/strip-bom-string/index.js +15 -0
  121. package/node_modules/strip-bom-string/package.json +60 -0
  122. package/package.json +6 -3
  123. package/packages/safe-js/dist/chunks/{chunk-EL23VF23.js → chunk-JP474LP7.js} +2 -2
  124. package/packages/safe-js/dist/chunks/{chunk-DALBPQDZ.js → chunk-RIQRHKCB.js} +82 -4
  125. package/packages/safe-js/dist/chunks/{chunk-DALBPQDZ.js.map → chunk-RIQRHKCB.js.map} +4 -4
  126. package/packages/safe-js/dist/cli.js +2 -2
  127. package/packages/safe-js/dist/core.js +1 -1
  128. package/packages/safe-js/dist/index.js +2 -2
  129. package/packages/safe-js/dist/interp/globals/object-array.js +2 -7
  130. package/packages/safe-js/dist/interp/interpreter.js +1 -0
  131. package/packages/safe-js/dist/interp/string-coercion.d.ts +3 -0
  132. package/packages/safe-js/dist/interp/string-coercion.js +89 -0
  133. package/packages/safe-js/dist/interp/values.d.ts +1 -0
  134. /package/packages/safe-js/dist/chunks/{chunk-EL23VF23.js.map → chunk-JP474LP7.js.map} +0 -0
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "sprintf-js",
3
+ "version": "1.0.3",
4
+ "description": "JavaScript sprintf implementation",
5
+ "author": "Alexandru Marasteanu <hello@alexei.ro> (http://alexei.ro/)",
6
+ "main": "src/sprintf.js",
7
+ "scripts": {
8
+ "test": "mocha test/test.js"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/alexei/sprintf.js.git"
13
+ },
14
+ "license": "BSD-3-Clause",
15
+ "readmeFilename": "README.md",
16
+ "devDependencies": {
17
+ "mocha": "*",
18
+ "grunt": "*",
19
+ "grunt-contrib-watch": "*",
20
+ "grunt-contrib-uglify": "*"
21
+ }
22
+ }
@@ -0,0 +1,18 @@
1
+ angular.
2
+ module("sprintf", []).
3
+ filter("sprintf", function() {
4
+ return function() {
5
+ return sprintf.apply(null, arguments)
6
+ }
7
+ }).
8
+ filter("fmt", ["$filter", function($filter) {
9
+ return $filter("sprintf")
10
+ }]).
11
+ filter("vsprintf", function() {
12
+ return function(format, argv) {
13
+ return vsprintf(format, argv)
14
+ }
15
+ }).
16
+ filter("vfmt", ["$filter", function($filter) {
17
+ return $filter("vsprintf")
18
+ }])
@@ -0,0 +1,208 @@
1
+ (function(window) {
2
+ var re = {
3
+ not_string: /[^s]/,
4
+ number: /[diefg]/,
5
+ json: /[j]/,
6
+ not_json: /[^j]/,
7
+ text: /^[^\x25]+/,
8
+ modulo: /^\x25{2}/,
9
+ placeholder: /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,
10
+ key: /^([a-z_][a-z_\d]*)/i,
11
+ key_access: /^\.([a-z_][a-z_\d]*)/i,
12
+ index_access: /^\[(\d+)\]/,
13
+ sign: /^[\+\-]/
14
+ }
15
+
16
+ function sprintf() {
17
+ var key = arguments[0], cache = sprintf.cache
18
+ if (!(cache[key] && cache.hasOwnProperty(key))) {
19
+ cache[key] = sprintf.parse(key)
20
+ }
21
+ return sprintf.format.call(null, cache[key], arguments)
22
+ }
23
+
24
+ sprintf.format = function(parse_tree, argv) {
25
+ var cursor = 1, tree_length = parse_tree.length, node_type = "", arg, output = [], i, k, match, pad, pad_character, pad_length, is_positive = true, sign = ""
26
+ for (i = 0; i < tree_length; i++) {
27
+ node_type = get_type(parse_tree[i])
28
+ if (node_type === "string") {
29
+ output[output.length] = parse_tree[i]
30
+ }
31
+ else if (node_type === "array") {
32
+ match = parse_tree[i] // convenience purposes only
33
+ if (match[2]) { // keyword argument
34
+ arg = argv[cursor]
35
+ for (k = 0; k < match[2].length; k++) {
36
+ if (!arg.hasOwnProperty(match[2][k])) {
37
+ throw new Error(sprintf("[sprintf] property '%s' does not exist", match[2][k]))
38
+ }
39
+ arg = arg[match[2][k]]
40
+ }
41
+ }
42
+ else if (match[1]) { // positional argument (explicit)
43
+ arg = argv[match[1]]
44
+ }
45
+ else { // positional argument (implicit)
46
+ arg = argv[cursor++]
47
+ }
48
+
49
+ if (get_type(arg) == "function") {
50
+ arg = arg()
51
+ }
52
+
53
+ if (re.not_string.test(match[8]) && re.not_json.test(match[8]) && (get_type(arg) != "number" && isNaN(arg))) {
54
+ throw new TypeError(sprintf("[sprintf] expecting number but found %s", get_type(arg)))
55
+ }
56
+
57
+ if (re.number.test(match[8])) {
58
+ is_positive = arg >= 0
59
+ }
60
+
61
+ switch (match[8]) {
62
+ case "b":
63
+ arg = arg.toString(2)
64
+ break
65
+ case "c":
66
+ arg = String.fromCharCode(arg)
67
+ break
68
+ case "d":
69
+ case "i":
70
+ arg = parseInt(arg, 10)
71
+ break
72
+ case "j":
73
+ arg = JSON.stringify(arg, null, match[6] ? parseInt(match[6]) : 0)
74
+ break
75
+ case "e":
76
+ arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential()
77
+ break
78
+ case "f":
79
+ arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg)
80
+ break
81
+ case "g":
82
+ arg = match[7] ? parseFloat(arg).toPrecision(match[7]) : parseFloat(arg)
83
+ break
84
+ case "o":
85
+ arg = arg.toString(8)
86
+ break
87
+ case "s":
88
+ arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg)
89
+ break
90
+ case "u":
91
+ arg = arg >>> 0
92
+ break
93
+ case "x":
94
+ arg = arg.toString(16)
95
+ break
96
+ case "X":
97
+ arg = arg.toString(16).toUpperCase()
98
+ break
99
+ }
100
+ if (re.json.test(match[8])) {
101
+ output[output.length] = arg
102
+ }
103
+ else {
104
+ if (re.number.test(match[8]) && (!is_positive || match[3])) {
105
+ sign = is_positive ? "+" : "-"
106
+ arg = arg.toString().replace(re.sign, "")
107
+ }
108
+ else {
109
+ sign = ""
110
+ }
111
+ pad_character = match[4] ? match[4] === "0" ? "0" : match[4].charAt(1) : " "
112
+ pad_length = match[6] - (sign + arg).length
113
+ pad = match[6] ? (pad_length > 0 ? str_repeat(pad_character, pad_length) : "") : ""
114
+ output[output.length] = match[5] ? sign + arg + pad : (pad_character === "0" ? sign + pad + arg : pad + sign + arg)
115
+ }
116
+ }
117
+ }
118
+ return output.join("")
119
+ }
120
+
121
+ sprintf.cache = {}
122
+
123
+ sprintf.parse = function(fmt) {
124
+ var _fmt = fmt, match = [], parse_tree = [], arg_names = 0
125
+ while (_fmt) {
126
+ if ((match = re.text.exec(_fmt)) !== null) {
127
+ parse_tree[parse_tree.length] = match[0]
128
+ }
129
+ else if ((match = re.modulo.exec(_fmt)) !== null) {
130
+ parse_tree[parse_tree.length] = "%"
131
+ }
132
+ else if ((match = re.placeholder.exec(_fmt)) !== null) {
133
+ if (match[2]) {
134
+ arg_names |= 1
135
+ var field_list = [], replacement_field = match[2], field_match = []
136
+ if ((field_match = re.key.exec(replacement_field)) !== null) {
137
+ field_list[field_list.length] = field_match[1]
138
+ while ((replacement_field = replacement_field.substring(field_match[0].length)) !== "") {
139
+ if ((field_match = re.key_access.exec(replacement_field)) !== null) {
140
+ field_list[field_list.length] = field_match[1]
141
+ }
142
+ else if ((field_match = re.index_access.exec(replacement_field)) !== null) {
143
+ field_list[field_list.length] = field_match[1]
144
+ }
145
+ else {
146
+ throw new SyntaxError("[sprintf] failed to parse named argument key")
147
+ }
148
+ }
149
+ }
150
+ else {
151
+ throw new SyntaxError("[sprintf] failed to parse named argument key")
152
+ }
153
+ match[2] = field_list
154
+ }
155
+ else {
156
+ arg_names |= 2
157
+ }
158
+ if (arg_names === 3) {
159
+ throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported")
160
+ }
161
+ parse_tree[parse_tree.length] = match
162
+ }
163
+ else {
164
+ throw new SyntaxError("[sprintf] unexpected placeholder")
165
+ }
166
+ _fmt = _fmt.substring(match[0].length)
167
+ }
168
+ return parse_tree
169
+ }
170
+
171
+ var vsprintf = function(fmt, argv, _argv) {
172
+ _argv = (argv || []).slice(0)
173
+ _argv.splice(0, 0, fmt)
174
+ return sprintf.apply(null, _argv)
175
+ }
176
+
177
+ /**
178
+ * helpers
179
+ */
180
+ function get_type(variable) {
181
+ return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase()
182
+ }
183
+
184
+ function str_repeat(input, multiplier) {
185
+ return Array(multiplier + 1).join(input)
186
+ }
187
+
188
+ /**
189
+ * export to either browser or node.js
190
+ */
191
+ if (typeof exports !== "undefined") {
192
+ exports.sprintf = sprintf
193
+ exports.vsprintf = vsprintf
194
+ }
195
+ else {
196
+ window.sprintf = sprintf
197
+ window.vsprintf = vsprintf
198
+
199
+ if (typeof define === "function" && define.amd) {
200
+ define(function() {
201
+ return {
202
+ sprintf: sprintf,
203
+ vsprintf: vsprintf
204
+ }
205
+ })
206
+ }
207
+ }
208
+ })(typeof window === "undefined" ? this : window);
@@ -0,0 +1,82 @@
1
+ var assert = require("assert"),
2
+ sprintfjs = require("../src/sprintf.js"),
3
+ sprintf = sprintfjs.sprintf,
4
+ vsprintf = sprintfjs.vsprintf
5
+
6
+ describe("sprintfjs", function() {
7
+ var pi = 3.141592653589793
8
+
9
+ it("should return formated strings for simple placeholders", function() {
10
+ assert.equal("%", sprintf("%%"))
11
+ assert.equal("10", sprintf("%b", 2))
12
+ assert.equal("A", sprintf("%c", 65))
13
+ assert.equal("2", sprintf("%d", 2))
14
+ assert.equal("2", sprintf("%i", 2))
15
+ assert.equal("2", sprintf("%d", "2"))
16
+ assert.equal("2", sprintf("%i", "2"))
17
+ assert.equal('{"foo":"bar"}', sprintf("%j", {foo: "bar"}))
18
+ assert.equal('["foo","bar"]', sprintf("%j", ["foo", "bar"]))
19
+ assert.equal("2e+0", sprintf("%e", 2))
20
+ assert.equal("2", sprintf("%u", 2))
21
+ assert.equal("4294967294", sprintf("%u", -2))
22
+ assert.equal("2.2", sprintf("%f", 2.2))
23
+ assert.equal("3.141592653589793", sprintf("%g", pi))
24
+ assert.equal("10", sprintf("%o", 8))
25
+ assert.equal("%s", sprintf("%s", "%s"))
26
+ assert.equal("ff", sprintf("%x", 255))
27
+ assert.equal("FF", sprintf("%X", 255))
28
+ assert.equal("Polly wants a cracker", sprintf("%2$s %3$s a %1$s", "cracker", "Polly", "wants"))
29
+ assert.equal("Hello world!", sprintf("Hello %(who)s!", {"who": "world"}))
30
+ })
31
+
32
+ it("should return formated strings for complex placeholders", function() {
33
+ // sign
34
+ assert.equal("2", sprintf("%d", 2))
35
+ assert.equal("-2", sprintf("%d", -2))
36
+ assert.equal("+2", sprintf("%+d", 2))
37
+ assert.equal("-2", sprintf("%+d", -2))
38
+ assert.equal("2", sprintf("%i", 2))
39
+ assert.equal("-2", sprintf("%i", -2))
40
+ assert.equal("+2", sprintf("%+i", 2))
41
+ assert.equal("-2", sprintf("%+i", -2))
42
+ assert.equal("2.2", sprintf("%f", 2.2))
43
+ assert.equal("-2.2", sprintf("%f", -2.2))
44
+ assert.equal("+2.2", sprintf("%+f", 2.2))
45
+ assert.equal("-2.2", sprintf("%+f", -2.2))
46
+ assert.equal("-2.3", sprintf("%+.1f", -2.34))
47
+ assert.equal("-0.0", sprintf("%+.1f", -0.01))
48
+ assert.equal("3.14159", sprintf("%.6g", pi))
49
+ assert.equal("3.14", sprintf("%.3g", pi))
50
+ assert.equal("3", sprintf("%.1g", pi))
51
+ assert.equal("-000000123", sprintf("%+010d", -123))
52
+ assert.equal("______-123", sprintf("%+'_10d", -123))
53
+ assert.equal("-234.34 123.2", sprintf("%f %f", -234.34, 123.2))
54
+
55
+ // padding
56
+ assert.equal("-0002", sprintf("%05d", -2))
57
+ assert.equal("-0002", sprintf("%05i", -2))
58
+ assert.equal(" <", sprintf("%5s", "<"))
59
+ assert.equal("0000<", sprintf("%05s", "<"))
60
+ assert.equal("____<", sprintf("%'_5s", "<"))
61
+ assert.equal("> ", sprintf("%-5s", ">"))
62
+ assert.equal(">0000", sprintf("%0-5s", ">"))
63
+ assert.equal(">____", sprintf("%'_-5s", ">"))
64
+ assert.equal("xxxxxx", sprintf("%5s", "xxxxxx"))
65
+ assert.equal("1234", sprintf("%02u", 1234))
66
+ assert.equal(" -10.235", sprintf("%8.3f", -10.23456))
67
+ assert.equal("-12.34 xxx", sprintf("%f %s", -12.34, "xxx"))
68
+ assert.equal('{\n "foo": "bar"\n}', sprintf("%2j", {foo: "bar"}))
69
+ assert.equal('[\n "foo",\n "bar"\n]', sprintf("%2j", ["foo", "bar"]))
70
+
71
+ // precision
72
+ assert.equal("2.3", sprintf("%.1f", 2.345))
73
+ assert.equal("xxxxx", sprintf("%5.5s", "xxxxxx"))
74
+ assert.equal(" x", sprintf("%5.1s", "xxxxxx"))
75
+
76
+ })
77
+
78
+ it("should return formated strings for callbacks", function() {
79
+ assert.equal("foobar", sprintf("%s", function() { return "foobar" }))
80
+ assert.equal(Date.now(), sprintf("%s", Date.now)) // should pass...
81
+ })
82
+ })
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015, 2017, Jon Schlinkert
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,66 @@
1
+ # strip-bom-string [![NPM version](https://img.shields.io/npm/v/strip-bom-string.svg?style=flat)](https://www.npmjs.com/package/strip-bom-string) [![NPM monthly downloads](https://img.shields.io/npm/dm/strip-bom-string.svg?style=flat)](https://npmjs.org/package/strip-bom-string) [![NPM total downloads](https://img.shields.io/npm/dt/strip-bom-string.svg?style=flat)](https://npmjs.org/package/strip-bom-string) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/strip-bom-string.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/strip-bom-string)
2
+
3
+ > Strip a byte order mark (BOM) from a string.
4
+
5
+ ## Install
6
+
7
+ Install with [npm](https://www.npmjs.com/):
8
+
9
+ ```sh
10
+ $ npm install --save strip-bom-string
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```js
16
+ var strip = require('strip-bom-string');
17
+ strip('\ufefffoo');
18
+ //=> 'foo'
19
+ ```
20
+
21
+ ## About
22
+
23
+ ### Related projects
24
+
25
+ * [cr](https://www.npmjs.com/package/cr): Strip windows carriage returns, or convert carriage returns to newlines. | [homepage](https://github.com/jonschlinkert/cr "Strip windows carriage returns, or convert carriage returns to newlines.")
26
+ * [has-bom](https://www.npmjs.com/package/has-bom): Returns true if a buffer or string has a byte order mark (BOM) | [homepage](https://github.com/jonschlinkert/has-bom "Returns true if a buffer or string has a byte order mark (BOM)")
27
+ * [read-file](https://www.npmjs.com/package/read-file): Thin wrapper around fs.readFile and fs.readFileSync that also strips byte order marks when `utf8` encoding… [more](https://github.com/jonschlinkert/read-file) | [homepage](https://github.com/jonschlinkert/read-file "Thin wrapper around fs.readFile and fs.readFileSync that also strips byte order marks when `utf8` encoding is chosen. Also optionally replaces windows newlines with unix newlines.")
28
+ * [strip-bom-buffer](https://www.npmjs.com/package/strip-bom-buffer): Strip a byte order mark (BOM) from a buffer. | [homepage](https://github.com/jonschlinkert/strip-bom-buffer "Strip a byte order mark (BOM) from a buffer.")
29
+
30
+ ### Contributing
31
+
32
+ Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
33
+
34
+ ### Building docs
35
+
36
+ _(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
37
+
38
+ To generate the readme, run the following command:
39
+
40
+ ```sh
41
+ $ npm install -g verbose/verb#dev verb-generate-readme && verb
42
+ ```
43
+
44
+ ### Running tests
45
+
46
+ Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
47
+
48
+ ```sh
49
+ $ npm install && npm test
50
+ ```
51
+
52
+ ### Author
53
+
54
+ **Jon Schlinkert**
55
+
56
+ * [github/jonschlinkert](https://github.com/jonschlinkert)
57
+ * [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
58
+
59
+ ### License
60
+
61
+ Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
62
+ Released under the [MIT License](LICENSE).
63
+
64
+ ***
65
+
66
+ _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.3, on March 29, 2017._
@@ -0,0 +1,15 @@
1
+ /*!
2
+ * strip-bom-string <https://github.com/jonschlinkert/strip-bom-string>
3
+ *
4
+ * Copyright (c) 2015, 2017, Jon Schlinkert.
5
+ * Released under the MIT License.
6
+ */
7
+
8
+ 'use strict';
9
+
10
+ module.exports = function(str) {
11
+ if (typeof str === 'string' && str.charAt(0) === '\ufeff') {
12
+ return str.slice(1);
13
+ }
14
+ return str;
15
+ };
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "strip-bom-string",
3
+ "description": "Strip a byte order mark (BOM) from a string.",
4
+ "version": "1.0.0",
5
+ "homepage": "https://github.com/jonschlinkert/strip-bom-string",
6
+ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
7
+ "repository": "jonschlinkert/strip-bom-string",
8
+ "bugs": {
9
+ "url": "https://github.com/jonschlinkert/strip-bom-string/issues"
10
+ },
11
+ "license": "MIT",
12
+ "files": [
13
+ "index.js"
14
+ ],
15
+ "main": "index.js",
16
+ "engines": {
17
+ "node": ">=0.10.0"
18
+ },
19
+ "scripts": {
20
+ "test": "mocha"
21
+ },
22
+ "devDependencies": {
23
+ "gulp-format-md": "^0.1.11",
24
+ "mocha": "^3.2.0"
25
+ },
26
+ "keywords": [
27
+ "bom",
28
+ "byte",
29
+ "byte-order-mark",
30
+ "file",
31
+ "fs",
32
+ "mark",
33
+ "nl",
34
+ "normalize",
35
+ "order",
36
+ "string",
37
+ "strip"
38
+ ],
39
+ "verb": {
40
+ "related": {
41
+ "list": [
42
+ "cr",
43
+ "has-bom",
44
+ "read-file",
45
+ "strip-bom-buffer"
46
+ ]
47
+ },
48
+ "toc": false,
49
+ "layout": "default",
50
+ "tasks": [
51
+ "readme"
52
+ ],
53
+ "plugins": [
54
+ "gulp-format-md"
55
+ ],
56
+ "lint": {
57
+ "reflinks": true
58
+ }
59
+ }
60
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-code",
3
- "version": "13.0.0",
3
+ "version": "13.0.2",
4
4
  "description": "CLI tool to configure Poe API for developer workflows.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -279,7 +279,7 @@
279
279
  "openai": "^6.34.0",
280
280
  "parse-duration": "^2.1.5",
281
281
  "semver": "^7.7.4",
282
- "shell-quote": "^1.8.4",
282
+ "shell-quote": "^1.9.0",
283
283
  "simple-git": "^3.36.0",
284
284
  "smol-toml": "^1.6.0",
285
285
  "tiktoken": "^1.0.22",
@@ -404,5 +404,8 @@
404
404
  },
405
405
  "default": null
406
406
  }
407
- }
407
+ },
408
+ "bundleDependencies": [
409
+ "gray-matter"
410
+ ]
408
411
  }
@@ -27,7 +27,7 @@ import {
27
27
  validateMigrationSemantics,
28
28
  validateSnapshotData,
29
29
  validateSnapshotMigration
30
- } from "./chunk-DALBPQDZ.js";
30
+ } from "./chunk-RIQRHKCB.js";
31
31
  import {
32
32
  createFileSystem,
33
33
  createNodeFileSystemAdapterRegistry,
@@ -8183,4 +8183,4 @@ export {
8183
8183
  parseMcpConfig,
8184
8184
  makeMcpModule
8185
8185
  };
8186
- //# sourceMappingURL=chunk-EL23VF23.js.map
8186
+ //# sourceMappingURL=chunk-JP474LP7.js.map
@@ -24158,6 +24158,85 @@ function assertStructuredCloneable(value, seen) {
24158
24158
  }
24159
24159
  }
24160
24160
 
24161
+ // packages/safe-js/src/interp/string-coercion.ts
24162
+ function sandboxString(value, budget, context, joining = /* @__PURE__ */ new Set()) {
24163
+ if (value === null || typeof value !== "object") {
24164
+ if (typeof value === "function") throw new TypeError("Expected a sandbox value.");
24165
+ return budget.allocateString(String(value));
24166
+ }
24167
+ return stringifyObject2(value, budget, context, joining);
24168
+ }
24169
+ async function stringifyObject2(value, budget, context, joining) {
24170
+ const leaveCall = budget.enterCall();
24171
+ try {
24172
+ budget.visitNode();
24173
+ for (const name of ["toString", "valueOf"]) {
24174
+ const descriptor = Object.getOwnPropertyDescriptor(value, name);
24175
+ let result;
24176
+ if (descriptor === void 0) {
24177
+ if (name === "valueOf") continue;
24178
+ result = await defaultToString(value, budget, context, joining);
24179
+ } else {
24180
+ const hook = ownDataValue(value, name);
24181
+ if (!isSandboxClosure(hook)) continue;
24182
+ if (context?.invokeClosure === void 0) {
24183
+ throw new TypeError("String hooks require a sandbox call context.");
24184
+ }
24185
+ result = await context.invokeClosure(hook, [], value);
24186
+ }
24187
+ if (result === null || typeof result !== "object") {
24188
+ return sandboxString(result, budget, context, joining);
24189
+ }
24190
+ }
24191
+ throw new TypeError("Cannot convert object to primitive value");
24192
+ } finally {
24193
+ leaveCall();
24194
+ }
24195
+ }
24196
+ async function defaultToString(value, budget, context, joining) {
24197
+ if (Array.isArray(value) || isFloat32Array(value)) {
24198
+ if (Object.hasOwn(value, "join")) {
24199
+ const join = ownDataValue(value, "join");
24200
+ if (!isSandboxClosure(join))
24201
+ return isFloat32Array(value) ? "[object Float32Array]" : "[object Array]";
24202
+ if (context?.invokeClosure === void 0) {
24203
+ throw new TypeError("String hooks require a sandbox call context.");
24204
+ }
24205
+ return context.invokeClosure(join, [], value);
24206
+ }
24207
+ if (joining.has(value)) return "";
24208
+ joining.add(value);
24209
+ try {
24210
+ const length = isFloat32Array(value) ? float32Storage(value).length : value.length;
24211
+ let text = "";
24212
+ for (let index = 0; index < length; index++) {
24213
+ budget.visitNode();
24214
+ const element = ownDataValue(value, String(index));
24215
+ const part = element === null || element === void 0 ? "" : await sandboxString(element, budget, context, joining);
24216
+ text = budget.allocateString(text + (index === 0 ? "" : ",") + part);
24217
+ }
24218
+ return text;
24219
+ } finally {
24220
+ joining.delete(value);
24221
+ }
24222
+ }
24223
+ if (sandboxErrorTypes.has(value)) {
24224
+ const nameValue = ownDataValue(value, "name");
24225
+ const name = nameValue === void 0 ? "Error" : await sandboxString(nameValue, budget, context, joining);
24226
+ const messageValue = ownDataValue(value, "message");
24227
+ const message = messageValue === void 0 ? "" : await sandboxString(messageValue, budget, context, joining);
24228
+ return name === "" ? message : message === "" ? name : `${name}: ${message}`;
24229
+ }
24230
+ return isSandboxPromise(value) ? "[object Promise]" : "[object Object]";
24231
+ }
24232
+ function ownDataValue(value, name) {
24233
+ const descriptor = Object.getOwnPropertyDescriptor(value, name);
24234
+ if (descriptor !== void 0 && !Object.hasOwn(descriptor, "value")) {
24235
+ throw new TypeError("String conversion requires sandbox data properties.");
24236
+ }
24237
+ return descriptor?.value;
24238
+ }
24239
+
24161
24240
  // packages/safe-js/src/interp/globals/object-array.ts
24162
24241
  function createObjectArrayGlobals(options) {
24163
24242
  return {
@@ -24253,9 +24332,7 @@ function createObjectArrayGlobals(options) {
24253
24332
  }),
24254
24333
  String: createSandboxClosure({
24255
24334
  sandbox: true,
24256
- call: ([value]) => options.budget.allocateString(
24257
- typeof value === "object" && value !== null && sandboxErrorTypes.has(value) && !Object.hasOwn(value, "toString") ? Error.prototype.toString.call(value) : String(value)
24258
- ),
24335
+ call: (args, context) => sandboxString(args.length === 0 ? "" : args[0], options.budget, context),
24259
24336
  name: "String",
24260
24337
  properties: {
24261
24338
  raw: createSandboxClosure({
@@ -28712,6 +28789,7 @@ async function invokeSandboxClosure(callee, args, context, stack, span, thisValu
28712
28789
  {
28713
28790
  stack,
28714
28791
  thisValue,
28792
+ invokeClosure: (closure, argumentsList, receiver) => invokeSandboxClosure(closure, argumentsList, context, stack, span, receiver),
28715
28793
  ...span === void 0 ? {} : { span }
28716
28794
  }
28717
28795
  ]);
@@ -29763,4 +29841,4 @@ export {
29763
29841
  FileSnapshotBackend,
29764
29842
  run
29765
29843
  };
29766
- //# sourceMappingURL=chunk-DALBPQDZ.js.map
29844
+ //# sourceMappingURL=chunk-RIQRHKCB.js.map