@poe-platform/safe-js 0.1.724 → 0.1.726
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 +15 -0
- package/dist/safe-js/chunks/{chunk-ZHJPXLUJ.js → chunk-4VWGTW5F.js} +69 -11
- package/dist/safe-js/chunks/{chunk-ZHJPXLUJ.js.map → chunk-4VWGTW5F.js.map} +2 -2
- package/dist/safe-js/chunks/{chunk-TMRO2MK6.js → chunk-EYIWCEOM.js} +4 -4
- package/dist/safe-js/chunks/{chunk-BYX6GUCC.js → chunk-JVWED75K.js} +2 -2
- package/dist/safe-js/chunks/{chunk-5M2P3GUC.js → chunk-LAULA6ZA.js} +37 -10
- package/dist/safe-js/chunks/chunk-LAULA6ZA.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-GYT2ECWI.js → chunk-MFPMOTC3.js} +2 -2
- package/dist/safe-js/chunks/{chunk-WYY65M7Z.js → chunk-MLXEO7D4.js} +3 -3
- package/dist/safe-js/chunks/{chunk-2DISWAVU.js → chunk-QPG4Q7NQ.js} +3 -3
- package/dist/safe-js/chunks/{chunk-KOO6YGQG.js → chunk-T2HKPVB3.js} +77 -29
- package/dist/safe-js/chunks/chunk-T2HKPVB3.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-6OE64YMG.js → chunk-TVAZK5TQ.js} +2 -2
- package/dist/safe-js/chunks/{chunk-CSRNI5HI.js → chunk-UBLJ5GBD.js} +3 -3
- package/dist/safe-js/chunks/{chunk-GM32LIKF.js → chunk-ZB7G7QNP.js} +4 -4
- package/dist/safe-js/chunks/{chunk-E5VQVLWF.js → chunk-ZI6RZ6ZM.js} +2 -2
- package/dist/safe-js/chunks/{chunk-HG5QP5UC.js → chunk-ZUWFLRFV.js} +2 -2
- package/dist/safe-js/chunks/{cli-runtime-PHNOLXPN.js → cli-runtime-BUNU5UJA.js} +13 -13
- package/dist/safe-js/chunks/{dump-HAU2HFBZ.js → dump-NJBLBIHN.js} +4 -4
- package/dist/safe-js/chunks/{fs-6PHK3Q3V.js → fs-KSDQMVL3.js} +4 -4
- package/dist/safe-js/chunks/harness-4TVG72ZC.js +10 -0
- package/dist/safe-js/chunks/mcp-ABD5LZLV.js +11 -0
- package/dist/safe-js/chunks/migration-file-S6N7VAXE.js +12 -0
- package/dist/safe-js/chunks/restore-R2BQQ743.js +13 -0
- package/dist/safe-js/chunks/run-4W5TVAD4.js +17 -0
- package/dist/safe-js/chunks/runtime-modules-XRIAOBSC.js +10 -0
- package/dist/safe-js/cli.js +2 -2
- package/dist/safe-js/core.js +7 -7
- package/dist/safe-js/extensions.d.ts +2 -0
- package/dist/safe-js/index.js +13 -13
- package/dist/safe-js/interp/host-bridge.d.ts +1 -1
- package/dist/safe-js/parse/tokenizer.d.ts +1 -1
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-5M2P3GUC.js.map +0 -7
- package/dist/safe-js/chunks/chunk-KOO6YGQG.js.map +0 -7
- package/dist/safe-js/chunks/harness-E3FVGKIR.js +0 -10
- package/dist/safe-js/chunks/mcp-HGLB4YOP.js +0 -11
- package/dist/safe-js/chunks/migration-file-4GNB4HDL.js +0 -12
- package/dist/safe-js/chunks/restore-ZFU4NJOM.js +0 -13
- package/dist/safe-js/chunks/run-AAOCYT5M.js +0 -17
- package/dist/safe-js/chunks/runtime-modules-OPLHKWMC.js +0 -10
- /package/dist/safe-js/chunks/{chunk-TMRO2MK6.js.map → chunk-EYIWCEOM.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-BYX6GUCC.js.map → chunk-JVWED75K.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-GYT2ECWI.js.map → chunk-MFPMOTC3.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-WYY65M7Z.js.map → chunk-MLXEO7D4.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-2DISWAVU.js.map → chunk-QPG4Q7NQ.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-6OE64YMG.js.map → chunk-TVAZK5TQ.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-CSRNI5HI.js.map → chunk-UBLJ5GBD.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-GM32LIKF.js.map → chunk-ZB7G7QNP.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-E5VQVLWF.js.map → chunk-ZI6RZ6ZM.js.map} +0 -0
- /package/dist/safe-js/chunks/{chunk-HG5QP5UC.js.map → chunk-ZUWFLRFV.js.map} +0 -0
- /package/dist/safe-js/chunks/{cli-runtime-PHNOLXPN.js.map → cli-runtime-BUNU5UJA.js.map} +0 -0
- /package/dist/safe-js/chunks/{dump-HAU2HFBZ.js.map → dump-NJBLBIHN.js.map} +0 -0
- /package/dist/safe-js/chunks/{fs-6PHK3Q3V.js.map → fs-KSDQMVL3.js.map} +0 -0
- /package/dist/safe-js/chunks/{harness-E3FVGKIR.js.map → harness-4TVG72ZC.js.map} +0 -0
- /package/dist/safe-js/chunks/{mcp-HGLB4YOP.js.map → mcp-ABD5LZLV.js.map} +0 -0
- /package/dist/safe-js/chunks/{migration-file-4GNB4HDL.js.map → migration-file-S6N7VAXE.js.map} +0 -0
- /package/dist/safe-js/chunks/{restore-ZFU4NJOM.js.map → restore-R2BQQ743.js.map} +0 -0
- /package/dist/safe-js/chunks/{run-AAOCYT5M.js.map → run-4W5TVAD4.js.map} +0 -0
- /package/dist/safe-js/chunks/{runtime-modules-OPLHKWMC.js.map → runtime-modules-XRIAOBSC.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
deepCopyToSandbox
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4VWGTW5F.js";
|
|
4
4
|
|
|
5
5
|
// packages/safe-js/src/modules/harness.ts
|
|
6
6
|
function makeHarnessModule(frontmatter, meta) {
|
|
@@ -52,4 +52,4 @@ ${prompt}`;
|
|
|
52
52
|
export {
|
|
53
53
|
makeHarnessModule
|
|
54
54
|
};
|
|
55
|
-
//# sourceMappingURL=chunk-
|
|
55
|
+
//# sourceMappingURL=chunk-MFPMOTC3.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SnapshotNotReadyError,
|
|
3
3
|
serializeSafeJSSnapshot
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4VWGTW5F.js";
|
|
5
5
|
import {
|
|
6
6
|
SandboxError
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-T2HKPVB3.js";
|
|
8
8
|
|
|
9
9
|
// packages/safe-js/src/snapshot/dump.ts
|
|
10
10
|
var RUN_DUMP_CONTROLLER = /* @__PURE__ */ Symbol("SafeJS.run-dump-controller");
|
|
@@ -195,4 +195,4 @@ export {
|
|
|
195
195
|
dumpCurrent,
|
|
196
196
|
serializeRunSnapshot
|
|
197
197
|
};
|
|
198
|
-
//# sourceMappingURL=chunk-
|
|
198
|
+
//# sourceMappingURL=chunk-MLXEO7D4.js.map
|
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
HostCallJournal,
|
|
3
3
|
decodeReplayData,
|
|
4
4
|
validateSnapshotData
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-4VWGTW5F.js";
|
|
6
6
|
import {
|
|
7
7
|
CompileScope,
|
|
8
8
|
SandboxError,
|
|
9
9
|
functionSources,
|
|
10
10
|
parse,
|
|
11
11
|
parseModule
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-T2HKPVB3.js";
|
|
13
13
|
|
|
14
14
|
// packages/safe-js/src/parse/hash.ts
|
|
15
15
|
var FNV_OFFSET_BASIS = 2166136261;
|
|
@@ -219,4 +219,4 @@ export {
|
|
|
219
219
|
validateMigrationReconciliation,
|
|
220
220
|
validateSnapshotMigration
|
|
221
221
|
};
|
|
222
|
-
//# sourceMappingURL=chunk-
|
|
222
|
+
//# sourceMappingURL=chunk-QPG4Q7NQ.js.map
|
|
@@ -2009,8 +2009,30 @@ var stride = 3;
|
|
|
2009
2009
|
var legacyEscape = 256;
|
|
2010
2010
|
var tokenCacheSize = 256;
|
|
2011
2011
|
var CompactTokens = class {
|
|
2012
|
-
constructor(sourcePositions) {
|
|
2012
|
+
constructor(sourcePositions, lazyPositions = false) {
|
|
2013
2013
|
this.sourcePositions = sourcePositions;
|
|
2014
|
+
if (!lazyPositions) return;
|
|
2015
|
+
class ParserToken {
|
|
2016
|
+
constructor(type, value, start, end) {
|
|
2017
|
+
this.type = type;
|
|
2018
|
+
this.value = value;
|
|
2019
|
+
this.#start = start;
|
|
2020
|
+
this.#end = end;
|
|
2021
|
+
}
|
|
2022
|
+
type;
|
|
2023
|
+
value;
|
|
2024
|
+
#start;
|
|
2025
|
+
#end;
|
|
2026
|
+
get start() {
|
|
2027
|
+
if (typeof this.#start === "number") this.#start = sourcePositions.position(this.#start);
|
|
2028
|
+
return this.#start;
|
|
2029
|
+
}
|
|
2030
|
+
get end() {
|
|
2031
|
+
if (typeof this.#end === "number") this.#end = sourcePositions.position(this.#end);
|
|
2032
|
+
return this.#end;
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
this.parserToken = (type, value, start, end) => new ParserToken(type, value, start, end);
|
|
2014
2036
|
}
|
|
2015
2037
|
sourcePositions;
|
|
2016
2038
|
rows = new Uint32Array(1024 * stride);
|
|
@@ -2018,6 +2040,7 @@ var CompactTokens = class {
|
|
|
2018
2040
|
templates = /* @__PURE__ */ new Map();
|
|
2019
2041
|
tokens = /* @__PURE__ */ new Map();
|
|
2020
2042
|
last;
|
|
2043
|
+
parserToken;
|
|
2021
2044
|
// Only indexing, iteration, length, push and at are used by the lexer/parser.
|
|
2022
2045
|
// Historical tokens are materialized on demand in a bounded cache.
|
|
2023
2046
|
indexed = new Proxy([], {
|
|
@@ -2065,7 +2088,12 @@ var CompactTokens = class {
|
|
|
2065
2088
|
if (cached !== void 0) return cached;
|
|
2066
2089
|
const base = index * stride;
|
|
2067
2090
|
const bits = this.rows[base + 2];
|
|
2068
|
-
const token =
|
|
2091
|
+
const token = this.parserToken?.(
|
|
2092
|
+
types[bits & 255],
|
|
2093
|
+
this.values[index],
|
|
2094
|
+
this.rows[base],
|
|
2095
|
+
this.rows[base + 1]
|
|
2096
|
+
) ?? {
|
|
2069
2097
|
type: types[bits & 255],
|
|
2070
2098
|
value: this.values[index],
|
|
2071
2099
|
start: this.sourcePositions.position(this.rows[base]),
|
|
@@ -2194,8 +2222,8 @@ function tokenize(source, options = {}) {
|
|
|
2194
2222
|
const lexer = new Lexer(source, options);
|
|
2195
2223
|
return lexer.tokenize();
|
|
2196
2224
|
}
|
|
2197
|
-
function tokenizeCompact(source, options, positions) {
|
|
2198
|
-
const tokens = new CompactTokens(positions);
|
|
2225
|
+
function tokenizeCompact(source, options, positions, lazyPositions = false) {
|
|
2226
|
+
const tokens = new CompactTokens(positions, lazyPositions);
|
|
2199
2227
|
new Lexer(source, { ...options, sharedPositions: true }, tokens.indexed).tokenize();
|
|
2200
2228
|
return tokens.finish();
|
|
2201
2229
|
}
|
|
@@ -4233,7 +4261,7 @@ function parseSourceModule(source, filename = "<input>", owner, options = {}) {
|
|
|
4233
4261
|
throw new SandboxError({ budget: "stringLength", current: source.length, limit });
|
|
4234
4262
|
owner?.budget.visitNode(source.length);
|
|
4235
4263
|
const tokenOptions = { allowRegexLiterals: true, statementList: true, compilation, sharedPositions: options.sharedPositions };
|
|
4236
|
-
const tokens = options.compactAst ? tokenizeCompact(source, tokenOptions, new CompactSourcePositions(source)) : tokenize(source, tokenOptions);
|
|
4264
|
+
const tokens = options.compactAst ? tokenizeCompact(source, tokenOptions, new CompactSourcePositions(source), true) : tokenize(source, tokenOptions);
|
|
4237
4265
|
parser = new Parser(
|
|
4238
4266
|
tokens,
|
|
4239
4267
|
source,
|
|
@@ -4323,7 +4351,7 @@ function parseEvalScript(source, context = {}, owner, filename = "<eval>", optio
|
|
|
4323
4351
|
allowHtmlComments: true,
|
|
4324
4352
|
compilation
|
|
4325
4353
|
};
|
|
4326
|
-
const tokens = options.compactAst ? tokenizeCompact(source, tokenOptions, new CompactSourcePositions(source)) : tokenize(source, tokenOptions);
|
|
4354
|
+
const tokens = options.compactAst ? tokenizeCompact(source, tokenOptions, new CompactSourcePositions(source), true) : tokenize(source, tokenOptions);
|
|
4327
4355
|
const parser = new Parser(tokens, source, compilation, "normal", {
|
|
4328
4356
|
grammar,
|
|
4329
4357
|
newTarget: context.newTarget === true,
|
|
@@ -5012,30 +5040,50 @@ var Parser = class {
|
|
|
5012
5040
|
return { type: "BlockStatement", body: [statement], span: statement.span };
|
|
5013
5041
|
}
|
|
5014
5042
|
parseIfStatement() {
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
throw new Error(
|
|
5018
|
-
`If statement nesting limit exceeded at line ${token.start.line}, column ${token.start.column}.`
|
|
5019
|
-
);
|
|
5020
|
-
}
|
|
5021
|
-
this.ifStatementDepth += 1;
|
|
5043
|
+
const pending = [];
|
|
5044
|
+
let entered = 0;
|
|
5022
5045
|
try {
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5046
|
+
for (; ; ) {
|
|
5047
|
+
if (this.ifStatementDepth >= MAX_IF_STATEMENT_DEPTH) {
|
|
5048
|
+
const token2 = this.currentToken();
|
|
5049
|
+
throw new Error(
|
|
5050
|
+
`If statement nesting limit exceeded at line ${token2.start.line}, column ${token2.start.column}.`
|
|
5051
|
+
);
|
|
5052
|
+
}
|
|
5053
|
+
this.ifStatementDepth++;
|
|
5054
|
+
entered++;
|
|
5055
|
+
const token = this.expectKeyword("if");
|
|
5056
|
+
this.expectPunctuator("(");
|
|
5057
|
+
const test = this.parseExpression({ allowSequence: true }).node;
|
|
5058
|
+
this.expectPunctuator(")");
|
|
5059
|
+
const consequent = this.parseIfClause();
|
|
5060
|
+
const hasElse = this.consumeKeyword("else") !== void 0;
|
|
5061
|
+
if (hasElse && this.currentToken().type === "keyword" && this.currentToken().value === "if") {
|
|
5062
|
+
pending.push({ token, test, consequent });
|
|
5063
|
+
continue;
|
|
5064
|
+
}
|
|
5065
|
+
const alternate = hasElse ? this.parseIfClause() : void 0;
|
|
5066
|
+
let result = {
|
|
5067
|
+
type: "IfStatement",
|
|
5068
|
+
test,
|
|
5069
|
+
consequent,
|
|
5070
|
+
alternate,
|
|
5071
|
+
span: createSpan2(token.start, alternate?.span.end ?? consequent.span.end)
|
|
5072
|
+
};
|
|
5073
|
+
while (pending.length > 0) {
|
|
5074
|
+
const parent = pending.pop();
|
|
5075
|
+
result = {
|
|
5076
|
+
type: "IfStatement",
|
|
5077
|
+
test: parent.test,
|
|
5078
|
+
consequent: parent.consequent,
|
|
5079
|
+
alternate: result,
|
|
5080
|
+
span: createSpan2(parent.token.start, result.span.end)
|
|
5081
|
+
};
|
|
5082
|
+
}
|
|
5083
|
+
return result;
|
|
5084
|
+
}
|
|
5037
5085
|
} finally {
|
|
5038
|
-
this.ifStatementDepth -=
|
|
5086
|
+
this.ifStatementDepth -= entered;
|
|
5039
5087
|
}
|
|
5040
5088
|
}
|
|
5041
5089
|
parseSwitchStatement() {
|
|
@@ -8661,4 +8709,4 @@ export {
|
|
|
8661
8709
|
Float16Array2 as Float16Array,
|
|
8662
8710
|
numericTypedArrayConstructors
|
|
8663
8711
|
};
|
|
8664
|
-
//# sourceMappingURL=chunk-
|
|
8712
|
+
//# sourceMappingURL=chunk-T2HKPVB3.js.map
|