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.
- package/README.md +26 -5
- package/dist/index.js +96 -7
- package/dist/index.js.map +4 -4
- package/dist/metafile.json +1 -1
- package/node_modules/esprima/LICENSE.BSD +21 -0
- package/node_modules/esprima/README.md +46 -0
- package/node_modules/esprima/bin/esparse.js +139 -0
- package/node_modules/esprima/bin/esvalidate.js +236 -0
- package/node_modules/esprima/dist/esprima.js +6709 -0
- package/node_modules/esprima/package.json +112 -0
- package/node_modules/extend-shallow/LICENSE +21 -0
- package/node_modules/extend-shallow/README.md +61 -0
- package/node_modules/extend-shallow/index.js +33 -0
- package/node_modules/extend-shallow/package.json +56 -0
- package/node_modules/gray-matter/LICENSE +21 -0
- package/node_modules/gray-matter/README.md +565 -0
- package/node_modules/gray-matter/gray-matter.d.ts +114 -0
- package/node_modules/gray-matter/index.js +228 -0
- package/node_modules/gray-matter/lib/defaults.js +18 -0
- package/node_modules/gray-matter/lib/engine.js +30 -0
- package/node_modules/gray-matter/lib/engines.js +54 -0
- package/node_modules/gray-matter/lib/excerpt.js +32 -0
- package/node_modules/gray-matter/lib/parse.js +13 -0
- package/node_modules/gray-matter/lib/stringify.js +56 -0
- package/node_modules/gray-matter/lib/to-file.js +43 -0
- package/node_modules/gray-matter/lib/utils.js +66 -0
- package/node_modules/gray-matter/node_modules/argparse/LICENSE +21 -0
- package/node_modules/gray-matter/node_modules/argparse/README.md +257 -0
- package/node_modules/gray-matter/node_modules/argparse/index.js +3 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/action/append/constant.js +47 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/action/append.js +53 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/action/count.js +40 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/action/help.js +47 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/action/store/constant.js +43 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/action/store/false.js +27 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/action/store/true.js +26 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/action/store.js +50 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/action/subparsers.js +149 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/action/version.js +47 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/action.js +146 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/action_container.js +482 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/argparse.js +14 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/argument/error.js +50 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/argument/exclusive.js +54 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/argument/group.js +75 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/argument_parser.js +1161 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/const.js +21 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/help/added_formatters.js +87 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/help/formatter.js +795 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/namespace.js +76 -0
- package/node_modules/gray-matter/node_modules/argparse/lib/utils.js +57 -0
- package/node_modules/gray-matter/node_modules/argparse/package.json +34 -0
- package/node_modules/gray-matter/node_modules/js-yaml/LICENSE +21 -0
- package/node_modules/gray-matter/node_modules/js-yaml/README.md +302 -0
- package/node_modules/gray-matter/node_modules/js-yaml/bin/js-yaml.js +132 -0
- package/node_modules/gray-matter/node_modules/js-yaml/dist/js-yaml.js +4011 -0
- package/node_modules/gray-matter/node_modules/js-yaml/dist/js-yaml.min.js +1 -0
- package/node_modules/gray-matter/node_modules/js-yaml/index.js +7 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/common.js +59 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/dumper.js +850 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/exception.js +43 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/loader.js +1666 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/mark.js +76 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/core.js +18 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/default_full.js +25 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js +28 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js +17 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/json.js +25 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema.js +108 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/binary.js +138 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/bool.js +35 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/float.js +116 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/int.js +173 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/function.js +93 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js +60 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js +28 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/map.js +8 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/merge.js +12 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/null.js +34 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/omap.js +44 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/pairs.js +53 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/seq.js +8 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/set.js +29 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/str.js +8 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/timestamp.js +88 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type.js +61 -0
- package/node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml.js +39 -0
- package/node_modules/gray-matter/node_modules/js-yaml/package.json +52 -0
- package/node_modules/gray-matter/package.json +127 -0
- package/node_modules/is-extendable/LICENSE +21 -0
- package/node_modules/is-extendable/README.md +72 -0
- package/node_modules/is-extendable/index.js +13 -0
- package/node_modules/is-extendable/package.json +51 -0
- package/node_modules/kind-of/LICENSE +21 -0
- package/node_modules/kind-of/README.md +367 -0
- package/node_modules/kind-of/index.js +129 -0
- package/node_modules/kind-of/package.json +88 -0
- package/node_modules/section-matter/LICENSE +21 -0
- package/node_modules/section-matter/README.md +236 -0
- package/node_modules/section-matter/index.js +136 -0
- package/node_modules/section-matter/package.json +55 -0
- package/node_modules/sprintf-js/.npmignore +1 -0
- package/node_modules/sprintf-js/LICENSE +24 -0
- package/node_modules/sprintf-js/README.md +88 -0
- package/node_modules/sprintf-js/bower.json +14 -0
- package/node_modules/sprintf-js/demo/angular.html +20 -0
- package/node_modules/sprintf-js/dist/angular-sprintf.min.js +4 -0
- package/node_modules/sprintf-js/dist/angular-sprintf.min.js.map +1 -0
- package/node_modules/sprintf-js/dist/angular-sprintf.min.map +1 -0
- package/node_modules/sprintf-js/dist/sprintf.min.js +4 -0
- package/node_modules/sprintf-js/dist/sprintf.min.js.map +1 -0
- package/node_modules/sprintf-js/dist/sprintf.min.map +1 -0
- package/node_modules/sprintf-js/gruntfile.js +36 -0
- package/node_modules/sprintf-js/package.json +22 -0
- package/node_modules/sprintf-js/src/angular-sprintf.js +18 -0
- package/node_modules/sprintf-js/src/sprintf.js +208 -0
- package/node_modules/sprintf-js/test/test.js +82 -0
- package/node_modules/strip-bom-string/LICENSE +21 -0
- package/node_modules/strip-bom-string/README.md +66 -0
- package/node_modules/strip-bom-string/index.js +15 -0
- package/node_modules/strip-bom-string/package.json +60 -0
- package/package.json +6 -3
- package/packages/safe-js/dist/chunks/{chunk-EL23VF23.js → chunk-JP474LP7.js} +2 -2
- package/packages/safe-js/dist/chunks/{chunk-DALBPQDZ.js → chunk-RIQRHKCB.js} +82 -4
- package/packages/safe-js/dist/chunks/{chunk-DALBPQDZ.js.map → chunk-RIQRHKCB.js.map} +4 -4
- package/packages/safe-js/dist/cli.js +2 -2
- package/packages/safe-js/dist/core.js +1 -1
- package/packages/safe-js/dist/index.js +2 -2
- package/packages/safe-js/dist/interp/globals/object-array.js +2 -7
- package/packages/safe-js/dist/interp/interpreter.js +1 -0
- package/packages/safe-js/dist/interp/string-coercion.d.ts +3 -0
- package/packages/safe-js/dist/interp/string-coercion.js +89 -0
- package/packages/safe-js/dist/interp/values.d.ts +1 -0
- /package/packages/safe-js/dist/chunks/{chunk-EL23VF23.js.map → chunk-JP474LP7.js.map} +0 -0
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
resolveFsConfig,
|
|
23
23
|
splitFrontmatter,
|
|
24
24
|
withBrokenPipeGuard
|
|
25
|
-
} from "./chunks/chunk-
|
|
25
|
+
} from "./chunks/chunk-JP474LP7.js";
|
|
26
26
|
import {
|
|
27
27
|
Budget,
|
|
28
28
|
SandboxError,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
replaceErrorStack,
|
|
35
35
|
restore,
|
|
36
36
|
run
|
|
37
|
-
} from "./chunks/chunk-
|
|
37
|
+
} from "./chunks/chunk-RIQRHKCB.js";
|
|
38
38
|
import "./chunks/chunk-ZRX5HT5L.js";
|
|
39
39
|
import "./chunks/chunk-WVN5MMDR.js";
|
|
40
40
|
import "./chunks/chunk-4YIDX44G.js";
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
runWithSpawnUsageAccumulator,
|
|
30
30
|
splitFrontmatter,
|
|
31
31
|
supportsSpawnMode
|
|
32
|
-
} from "./chunks/chunk-
|
|
32
|
+
} from "./chunks/chunk-JP474LP7.js";
|
|
33
33
|
import {
|
|
34
34
|
Budget,
|
|
35
35
|
FileSnapshotBackend,
|
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
registerPendingHostCallPolicy,
|
|
52
52
|
restore,
|
|
53
53
|
run
|
|
54
|
-
} from "./chunks/chunk-
|
|
54
|
+
} from "./chunks/chunk-RIQRHKCB.js";
|
|
55
55
|
import "./chunks/chunk-ZRX5HT5L.js";
|
|
56
56
|
import "./chunks/chunk-WVN5MMDR.js";
|
|
57
57
|
import "./chunks/chunk-4YIDX44G.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { sandboxErrorTypes } from "../../error/shape.js";
|
|
2
1
|
import { isFloat32Array } from "../float32.js";
|
|
3
2
|
import { setFloat32Member } from "./float32array.js";
|
|
4
3
|
import { getSandboxIterator } from "../iteration.js";
|
|
4
|
+
import { sandboxString } from "../string-coercion.js";
|
|
5
5
|
import { allocateProducedSandboxValue, createSandboxClosure, deepCopyToSandbox, isSandboxClosure, isSandboxMap, isSandboxPromise, isSandboxRegex, isSandboxSet } from "../values.js";
|
|
6
6
|
export function createObjectArrayGlobals(options) {
|
|
7
7
|
return {
|
|
@@ -91,12 +91,7 @@ export function createObjectArrayGlobals(options) {
|
|
|
91
91
|
}),
|
|
92
92
|
String: createSandboxClosure({
|
|
93
93
|
sandbox: true,
|
|
94
|
-
call: (
|
|
95
|
-
value !== null &&
|
|
96
|
-
sandboxErrorTypes.has(value) &&
|
|
97
|
-
!Object.hasOwn(value, "toString")
|
|
98
|
-
? Error.prototype.toString.call(value)
|
|
99
|
-
: String(value)),
|
|
94
|
+
call: (args, context) => sandboxString(args.length === 0 ? "" : args[0], options.budget, context),
|
|
100
95
|
name: "String",
|
|
101
96
|
properties: {
|
|
102
97
|
raw: createSandboxClosure({
|
|
@@ -2333,6 +2333,7 @@ async function invokeSandboxClosure(callee, args, context, stack, span, thisValu
|
|
|
2333
2333
|
{
|
|
2334
2334
|
stack,
|
|
2335
2335
|
thisValue,
|
|
2336
|
+
invokeClosure: (closure, argumentsList, receiver) => invokeSandboxClosure(closure, argumentsList, context, stack, span, receiver),
|
|
2336
2337
|
...(span === undefined ? {} : { span })
|
|
2337
2338
|
}
|
|
2338
2339
|
]);
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { sandboxErrorTypes } from "../error/shape.js";
|
|
2
|
+
import { float32Storage, isFloat32Array } from "./float32.js";
|
|
3
|
+
import { isSandboxClosure, isSandboxPromise } from "./values.js";
|
|
4
|
+
export function sandboxString(value, budget, context, joining = new Set()) {
|
|
5
|
+
if (value === null || typeof value !== "object") {
|
|
6
|
+
if (typeof value === "function")
|
|
7
|
+
throw new TypeError("Expected a sandbox value.");
|
|
8
|
+
return budget.allocateString(String(value));
|
|
9
|
+
}
|
|
10
|
+
return stringifyObject(value, budget, context, joining);
|
|
11
|
+
}
|
|
12
|
+
async function stringifyObject(value, budget, context, joining) {
|
|
13
|
+
const leaveCall = budget.enterCall();
|
|
14
|
+
try {
|
|
15
|
+
budget.visitNode();
|
|
16
|
+
for (const name of ["toString", "valueOf"]) {
|
|
17
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, name);
|
|
18
|
+
let result;
|
|
19
|
+
if (descriptor === undefined) {
|
|
20
|
+
if (name === "valueOf")
|
|
21
|
+
continue;
|
|
22
|
+
result = await defaultToString(value, budget, context, joining);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
const hook = ownDataValue(value, name);
|
|
26
|
+
if (!isSandboxClosure(hook))
|
|
27
|
+
continue;
|
|
28
|
+
if (context?.invokeClosure === undefined) {
|
|
29
|
+
throw new TypeError("String hooks require a sandbox call context.");
|
|
30
|
+
}
|
|
31
|
+
result = await context.invokeClosure(hook, [], value);
|
|
32
|
+
}
|
|
33
|
+
if (result === null || typeof result !== "object") {
|
|
34
|
+
return sandboxString(result, budget, context, joining);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
throw new TypeError("Cannot convert object to primitive value");
|
|
38
|
+
}
|
|
39
|
+
finally {
|
|
40
|
+
leaveCall();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function defaultToString(value, budget, context, joining) {
|
|
44
|
+
if (Array.isArray(value) || isFloat32Array(value)) {
|
|
45
|
+
if (Object.hasOwn(value, "join")) {
|
|
46
|
+
const join = ownDataValue(value, "join");
|
|
47
|
+
if (!isSandboxClosure(join))
|
|
48
|
+
return isFloat32Array(value) ? "[object Float32Array]" : "[object Array]";
|
|
49
|
+
if (context?.invokeClosure === undefined) {
|
|
50
|
+
throw new TypeError("String hooks require a sandbox call context.");
|
|
51
|
+
}
|
|
52
|
+
return context.invokeClosure(join, [], value);
|
|
53
|
+
}
|
|
54
|
+
if (joining.has(value))
|
|
55
|
+
return "";
|
|
56
|
+
joining.add(value);
|
|
57
|
+
try {
|
|
58
|
+
const length = isFloat32Array(value) ? float32Storage(value).length : value.length;
|
|
59
|
+
let text = "";
|
|
60
|
+
for (let index = 0; index < length; index++) {
|
|
61
|
+
budget.visitNode();
|
|
62
|
+
const element = ownDataValue(value, String(index));
|
|
63
|
+
const part = element === null || element === undefined
|
|
64
|
+
? ""
|
|
65
|
+
: await sandboxString(element, budget, context, joining);
|
|
66
|
+
text = budget.allocateString(text + (index === 0 ? "" : ",") + part);
|
|
67
|
+
}
|
|
68
|
+
return text;
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
joining.delete(value);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (sandboxErrorTypes.has(value)) {
|
|
75
|
+
const nameValue = ownDataValue(value, "name");
|
|
76
|
+
const name = nameValue === undefined ? "Error" : await sandboxString(nameValue, budget, context, joining);
|
|
77
|
+
const messageValue = ownDataValue(value, "message");
|
|
78
|
+
const message = messageValue === undefined ? "" : await sandboxString(messageValue, budget, context, joining);
|
|
79
|
+
return name === "" ? message : message === "" ? name : `${name}: ${message}`;
|
|
80
|
+
}
|
|
81
|
+
return isSandboxPromise(value) ? "[object Promise]" : "[object Object]";
|
|
82
|
+
}
|
|
83
|
+
function ownDataValue(value, name) {
|
|
84
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, name);
|
|
85
|
+
if (descriptor !== undefined && !Object.hasOwn(descriptor, "value")) {
|
|
86
|
+
throw new TypeError("String conversion requires sandbox data properties.");
|
|
87
|
+
}
|
|
88
|
+
return descriptor?.value;
|
|
89
|
+
}
|
|
@@ -49,6 +49,7 @@ export type SandboxCallContext = {
|
|
|
49
49
|
};
|
|
50
50
|
readonly stack: readonly string[];
|
|
51
51
|
readonly thisValue: SandboxValue;
|
|
52
|
+
readonly invokeClosure?: (closure: SandboxClosure, args: readonly SandboxValue[], thisValue: SandboxValue) => Promise<SandboxValue>;
|
|
52
53
|
};
|
|
53
54
|
export type SandboxClosure = {
|
|
54
55
|
readonly async?: true;
|
|
File without changes
|