@codemod.com/codemod-sandbox 0.1.3 → 0.1.4
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/dist/src/factory.d.ts +3 -3
- package/dist/src/factory.js +19 -40
- package/dist/src/node.js +1 -1
- package/dist/src/web.js +1 -1
- package/package.json +1 -1
- package/sandbox.wasm +0 -0
package/dist/src/factory.d.ts
CHANGED
|
@@ -3,8 +3,7 @@ export default function _default(): {
|
|
|
3
3
|
__wbg_set_wasm: (val: any) => void;
|
|
4
4
|
initializeTreeSitter: (locate_file?: Function | null) => Promise<void>;
|
|
5
5
|
setupParser: (lang_name: string, parser_path: string) => Promise<void>;
|
|
6
|
-
|
|
7
|
-
run_module: (invocation_id: string, method: string, name: string, modules: any, code: string, json: string) => Promise<string>;
|
|
6
|
+
run_module: (invocation_id: string, method: string, name: string, modules: any, code: string, json: string) => Promise<any>;
|
|
8
7
|
scanFind: (src: string, configs: any[]) => any;
|
|
9
8
|
scanFix: (src: string, configs: any[]) => string;
|
|
10
9
|
dumpASTNodes: (src: string) => any;
|
|
@@ -70,6 +69,7 @@ export default function _default(): {
|
|
|
70
69
|
__wbg_parse_211b75b6b50e2da5: (...args: any[]) => any;
|
|
71
70
|
__wbg_parse_def2e24ef1252aff: (...args: any[]) => any;
|
|
72
71
|
__wbg_previousSibling_0d5cdd5a811cedb2: (arg0: any) => any;
|
|
72
|
+
__wbg_push_737cfc8c1432c2c6: (arg0: any, arg1: any) => any;
|
|
73
73
|
__wbg_queueMicrotask_97d92b4fcc8a61c5: (arg0: any) => void;
|
|
74
74
|
__wbg_queueMicrotask_d3219def82552485: (arg0: any) => any;
|
|
75
75
|
__wbg_resolve_4851785c9c5f573d: (arg0: any) => Promise<any>;
|
|
@@ -100,7 +100,7 @@ export default function _default(): {
|
|
|
100
100
|
__wbindgen_bigint_get_as_i64: (arg0: any, arg1: any) => void;
|
|
101
101
|
__wbindgen_boolean_get: (arg0: any) => 0 | 1 | 2;
|
|
102
102
|
__wbindgen_cb_drop: (arg0: any) => boolean;
|
|
103
|
-
|
|
103
|
+
__wbindgen_closure_wrapper4820: (arg0: any, arg1: any, arg2: any) => {
|
|
104
104
|
(...args: any[]): any;
|
|
105
105
|
original: {
|
|
106
106
|
a: any;
|
package/dist/src/factory.js
CHANGED
|
@@ -229,37 +229,6 @@ export default function () {
|
|
|
229
229
|
const ret = wasm.setupParser(ptr0, len0, ptr1, len1);
|
|
230
230
|
return ret;
|
|
231
231
|
}
|
|
232
|
-
function takeFromExternrefTable0(idx) {
|
|
233
|
-
const value = wasm.__wbindgen_export_4.get(idx);
|
|
234
|
-
wasm.__externref_table_dealloc(idx);
|
|
235
|
-
return value;
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* @param {string} code
|
|
239
|
-
* @returns {string}
|
|
240
|
-
*/
|
|
241
|
-
function eval_code(code) {
|
|
242
|
-
let deferred3_0;
|
|
243
|
-
let deferred3_1;
|
|
244
|
-
try {
|
|
245
|
-
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
246
|
-
const len0 = WASM_VECTOR_LEN;
|
|
247
|
-
const ret = wasm.eval_code(ptr0, len0);
|
|
248
|
-
var ptr2 = ret[0];
|
|
249
|
-
var len2 = ret[1];
|
|
250
|
-
if (ret[3]) {
|
|
251
|
-
ptr2 = 0;
|
|
252
|
-
len2 = 0;
|
|
253
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
254
|
-
}
|
|
255
|
-
deferred3_0 = ptr2;
|
|
256
|
-
deferred3_1 = len2;
|
|
257
|
-
return getStringFromWasm0(ptr2, len2);
|
|
258
|
-
}
|
|
259
|
-
finally {
|
|
260
|
-
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
232
|
/**
|
|
264
233
|
* @param {string} invocation_id
|
|
265
234
|
* @param {string} method
|
|
@@ -267,7 +236,7 @@ export default function () {
|
|
|
267
236
|
* @param {any} modules
|
|
268
237
|
* @param {string} code
|
|
269
238
|
* @param {string} json
|
|
270
|
-
* @returns {Promise<
|
|
239
|
+
* @returns {Promise<any>}
|
|
271
240
|
*/
|
|
272
241
|
function run_module(invocation_id, method, name, modules, code, json) {
|
|
273
242
|
const ptr0 = passStringToWasm0(invocation_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -283,6 +252,11 @@ export default function () {
|
|
|
283
252
|
const ret = wasm.run_module(ptr0, len0, ptr1, len1, ptr2, len2, modules, ptr3, len3, ptr4, len4);
|
|
284
253
|
return ret;
|
|
285
254
|
}
|
|
255
|
+
function takeFromExternrefTable0(idx) {
|
|
256
|
+
const value = wasm.__wbindgen_export_4.get(idx);
|
|
257
|
+
wasm.__externref_table_dealloc(idx);
|
|
258
|
+
return value;
|
|
259
|
+
}
|
|
286
260
|
/**
|
|
287
261
|
* @param {string} src
|
|
288
262
|
* @param {any[]} configs
|
|
@@ -358,10 +332,10 @@ export default function () {
|
|
|
358
332
|
return takeFromExternrefTable0(ret[0]);
|
|
359
333
|
}
|
|
360
334
|
function __wbg_adapter_50(arg0, arg1, arg2) {
|
|
361
|
-
wasm.
|
|
335
|
+
wasm.closure1705_externref_shim(arg0, arg1, arg2);
|
|
362
336
|
}
|
|
363
|
-
function
|
|
364
|
-
wasm.
|
|
337
|
+
function __wbg_adapter_200(arg0, arg1, arg2, arg3) {
|
|
338
|
+
wasm.closure1727_externref_shim(arg0, arg1, arg2, arg3);
|
|
365
339
|
}
|
|
366
340
|
function __wbg_String_8f0eb39a4a4c2f66(arg0, arg1) {
|
|
367
341
|
const ret = String(arg1);
|
|
@@ -667,7 +641,7 @@ export default function () {
|
|
|
667
641
|
const a = state0.a;
|
|
668
642
|
state0.a = 0;
|
|
669
643
|
try {
|
|
670
|
-
return
|
|
644
|
+
return __wbg_adapter_200(a, state0.b, arg0, arg1);
|
|
671
645
|
}
|
|
672
646
|
finally {
|
|
673
647
|
state0.a = a;
|
|
@@ -754,6 +728,11 @@ export default function () {
|
|
|
754
728
|
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
755
729
|
}
|
|
756
730
|
;
|
|
731
|
+
function __wbg_push_737cfc8c1432c2c6(arg0, arg1) {
|
|
732
|
+
const ret = arg0.push(arg1);
|
|
733
|
+
return ret;
|
|
734
|
+
}
|
|
735
|
+
;
|
|
757
736
|
function __wbg_queueMicrotask_97d92b4fcc8a61c5(arg0) {
|
|
758
737
|
queueMicrotask(arg0);
|
|
759
738
|
}
|
|
@@ -912,8 +891,8 @@ export default function () {
|
|
|
912
891
|
return ret;
|
|
913
892
|
}
|
|
914
893
|
;
|
|
915
|
-
function
|
|
916
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
894
|
+
function __wbindgen_closure_wrapper4820(arg0, arg1, arg2) {
|
|
895
|
+
const ret = makeMutClosure(arg0, arg1, 1706, __wbg_adapter_50);
|
|
917
896
|
return ret;
|
|
918
897
|
}
|
|
919
898
|
;
|
|
@@ -1022,7 +1001,6 @@ export default function () {
|
|
|
1022
1001
|
__wbg_set_wasm,
|
|
1023
1002
|
initializeTreeSitter,
|
|
1024
1003
|
setupParser,
|
|
1025
|
-
eval_code,
|
|
1026
1004
|
run_module,
|
|
1027
1005
|
scanFind,
|
|
1028
1006
|
scanFix,
|
|
@@ -1089,6 +1067,7 @@ export default function () {
|
|
|
1089
1067
|
__wbg_parse_211b75b6b50e2da5,
|
|
1090
1068
|
__wbg_parse_def2e24ef1252aff,
|
|
1091
1069
|
__wbg_previousSibling_0d5cdd5a811cedb2,
|
|
1070
|
+
__wbg_push_737cfc8c1432c2c6,
|
|
1092
1071
|
__wbg_queueMicrotask_97d92b4fcc8a61c5,
|
|
1093
1072
|
__wbg_queueMicrotask_d3219def82552485,
|
|
1094
1073
|
__wbg_resolve_4851785c9c5f573d,
|
|
@@ -1119,7 +1098,7 @@ export default function () {
|
|
|
1119
1098
|
__wbindgen_bigint_get_as_i64,
|
|
1120
1099
|
__wbindgen_boolean_get,
|
|
1121
1100
|
__wbindgen_cb_drop,
|
|
1122
|
-
|
|
1101
|
+
__wbindgen_closure_wrapper4820,
|
|
1123
1102
|
__wbindgen_debug_string,
|
|
1124
1103
|
__wbindgen_error_new,
|
|
1125
1104
|
__wbindgen_in,
|
package/dist/src/node.js
CHANGED
|
@@ -80,6 +80,6 @@ class NodeSandbox {
|
|
|
80
80
|
this.clearLogs();
|
|
81
81
|
const instance = await this.getWasmInstance();
|
|
82
82
|
const executionResult = await instance.run_module(sessionId, operation, moduleName, moduleRegistry, moduleCode, JSON.stringify(moduleInputs));
|
|
83
|
-
return
|
|
83
|
+
return executionResult;
|
|
84
84
|
}
|
|
85
85
|
}
|
package/dist/src/web.js
CHANGED
|
@@ -56,7 +56,7 @@ class WebSandbox {
|
|
|
56
56
|
const inputData = JSON.stringify(moduleInputs);
|
|
57
57
|
console.debug(...formatDataSize(`Run module: "${moduleName}": input size`, inputData.length));
|
|
58
58
|
const executionResult = await sandboxInstance.run_module(sessionId, operation, moduleName, moduleRegistry, moduleCode, inputData);
|
|
59
|
-
return
|
|
59
|
+
return executionResult;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
function formatDataSize(prefix, sizeInBytes) {
|
package/package.json
CHANGED
package/sandbox.wasm
CHANGED
|
Binary file
|