wasm-idle 1.3.0 → 1.4.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.
- package/README.md +183 -147
- package/dist/container/clang-runtime.js +32 -8
- package/dist/container/runtime-adapter.d.ts +2 -0
- package/dist/container/runtime-adapter.js +37 -8
- package/dist/playground/assetBridge.js +10 -8
- package/dist/playground/assets.d.ts +4 -0
- package/dist/playground/assets.js +9 -4
- package/dist/playground/c3.js +1 -1
- package/dist/playground/compiledLldb.d.ts +2 -0
- package/dist/playground/compiledLldb.js +37 -2
- package/dist/playground/d.d.ts +1 -0
- package/dist/playground/d.js +18 -8
- package/dist/playground/index.d.ts +1 -1
- package/dist/playground/index.js +7 -0
- package/dist/playground/{java-debug-HUZVAK4F.js → java-debug-64JGCLTC.js} +1 -1
- package/dist/playground/java-debug-notices.txt +26 -1
- package/dist/playground/java.js +3 -2
- package/dist/playground/javaDebugBridge.js +42 -7
- package/dist/playground/javaDebugSource.js +4 -4
- package/dist/playground/javaMain.d.ts +3 -0
- package/dist/playground/javaMain.js +2 -0
- package/dist/playground/javaRuntimeErrors.d.ts +2 -1
- package/dist/playground/javaRuntimeErrors.js +9 -2
- package/dist/playground/javaSource.d.ts +1 -1
- package/dist/playground/javaSource.js +7 -2
- package/dist/playground/lldbSession.d.ts +1 -0
- package/dist/playground/lldbSession.js +15 -2
- package/dist/playground/objectivec.js +2 -1
- package/dist/playground/options.d.ts +1 -1
- package/dist/playground/pythonCompileOptions.d.ts +7 -4
- package/dist/playground/pythonCompileOptions.js +2 -2
- package/dist/playground/scala.d.ts +34 -0
- package/dist/playground/scala.js +397 -0
- package/dist/playground/scalaAssets.d.ts +16 -0
- package/dist/playground/scalaAssets.js +51 -0
- package/dist/playground/scalaDiagnostics.d.ts +3 -0
- package/dist/playground/scalaDiagnostics.js +29 -0
- package/dist/playground/staticWorkerRuntime.d.ts +2 -0
- package/dist/playground/staticWorkerRuntime.js +85 -11
- package/dist/playground/tinygo.js +21 -8
- package/dist/playground/tinygoExecutableGraph.js +1 -1
- package/dist/playground/v.d.ts +1 -0
- package/dist/playground/v.js +17 -7
- package/dist/playground/wasmC3Version.d.ts +8 -8
- package/dist/playground/wasmC3Version.js +8 -8
- package/dist/playground/wasmDotnetVersion.d.ts +1 -1
- package/dist/playground/wasmDotnetVersion.js +1 -1
- package/dist/playground/wasmGoVersion.d.ts +1 -1
- package/dist/playground/wasmGoVersion.js +1 -1
- package/dist/playground/wasmLispVersion.d.ts +5 -0
- package/dist/playground/wasmLispVersion.js +5 -0
- package/dist/playground/wasmOcamlVersion.d.ts +4 -4
- package/dist/playground/wasmOcamlVersion.js +3 -3
- package/dist/playground/wasmTinyGoVersion.d.ts +57 -57
- package/dist/playground/wasmTinyGoVersion.js +57 -57
- package/dist/playground/wasmZigVersion.d.ts +7 -7
- package/dist/playground/wasmZigVersion.js +7 -7
- package/dist/playground/worker/java.js +18 -4
- package/dist/playground/worker/javaDebugEvaluator.js +2 -2
- package/dist/playground/worker/javaDebugRuntime.js +8 -1
- package/dist/playground/worker/javaStreaming.js +4 -2
- package/dist/playground/worker/ocaml.js +11 -10
- package/dist/playground/worker/python.js +21 -164
- package/dist/playground/worker/pythonCompile.js +5 -0
- package/dist/playground/worker/pythonDebug.d.ts +20 -0
- package/dist/playground/worker/pythonDebug.js +205 -0
- package/dist/playground/worker/scala/UPSTREAM-LICENSE.txt +201 -0
- package/dist/playground/worker/scala/UPSTREAM-NOTICE.txt +108 -0
- package/dist/playground/worker/scala/asset-bootstrap.d.ts +6 -0
- package/dist/playground/worker/scala/asset-bootstrap.js +58 -0
- package/dist/playground/worker/scala/asset-receipts.d.ts +7 -0
- package/dist/playground/worker/scala/asset-receipts.js +58 -0
- package/dist/playground/worker/scala/compiler.worker.d.ts +1 -0
- package/dist/playground/worker/scala/compiler.worker.js +204 -0
- package/dist/playground/worker/scala/execution.worker.d.ts +1 -0
- package/dist/playground/worker/scala/execution.worker.js +89 -0
- package/dist/playground/worker/scala/memory-fs.d.ts +29 -0
- package/dist/playground/worker/scala/memory-fs.js +333 -0
- package/dist/playground/worker/scala/runner.d.ts +1 -0
- package/dist/playground/worker/scala/runner.js +36 -0
- package/dist/playground/worker/zig.d.ts +2 -1
- package/dist/playground/worker/zig.js +212 -86
- package/dist/playground/worker/zigDebug.d.ts +39 -0
- package/dist/playground/worker/zigDebug.js +156 -0
- package/dist/playground/zig.d.ts +27 -4
- package/dist/playground/zig.js +266 -23
- package/dist/playground/zigDebugValues.d.ts +20 -0
- package/dist/playground/zigDebugValues.js +248 -0
- package/package.json +17 -10
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export const WASM_ZIG_ASSET_VERSION = '
|
|
1
|
+
export const WASM_ZIG_ASSET_VERSION = 'f13d47d5f39086f8';
|
|
2
2
|
export const WASM_ZIG_ASSET_RECEIPTS = Object.freeze({
|
|
3
3
|
'zig_small.wasm': Object.freeze({
|
|
4
|
-
bytes:
|
|
5
|
-
sha256: '
|
|
4
|
+
bytes: 4934128,
|
|
5
|
+
sha256: '82a101fd16c4cee7925ffc8fa51ccd713b23f32b13591531de383444e1060fd9'
|
|
6
6
|
}),
|
|
7
7
|
'std.tar.gz': Object.freeze({
|
|
8
|
-
bytes:
|
|
9
|
-
sha256: '
|
|
10
|
-
uncompressedBytes:
|
|
11
|
-
uncompressedSha256: '
|
|
8
|
+
bytes: 30362437,
|
|
9
|
+
sha256: 'a4f8b9403dfb0e0a826444f2a4a7eeb6b86403c79c650b93e34be95104bcb88c',
|
|
10
|
+
uncompressedBytes: 217466880,
|
|
11
|
+
uncompressedSha256: '63a671ed94b5b3f41cca3f7cde7ab237c9b2e72aae682bbfadf09799fa803397'
|
|
12
12
|
})
|
|
13
13
|
});
|
|
@@ -3,6 +3,7 @@ import { createJavaOutput } from './javaOutput';
|
|
|
3
3
|
import { createJavaStdinBridge, prepareJavaRuntimeStdinInjection } from '../javaRuntimeStdin';
|
|
4
4
|
import { resolveJavaSourceIdentity } from '../javaSource';
|
|
5
5
|
import { prepareJavaExceptionBridge } from '../javaRuntimeErrors';
|
|
6
|
+
import { selectJavaMainInvocation } from '../javaMain';
|
|
6
7
|
import { waitForBufferedStdin } from '../stdinBuffer';
|
|
7
8
|
import { createJavaDebugBridge } from '../javaDebugBridge';
|
|
8
9
|
import { readDebugCommand } from '../debugMailbox';
|
|
@@ -92,7 +93,12 @@ self.addEventListener('message', async (event) => {
|
|
|
92
93
|
})(),
|
|
93
94
|
loadWorkerRuntimeAsset('compile-classlib-teavm.bin').then(({ bytes }) => toInt8Array(bytes)),
|
|
94
95
|
loadWorkerRuntimeAsset('runtime-classlib-teavm.bin').then(({ bytes }) => toInt8Array(bytes)),
|
|
95
|
-
loadWorkerRuntimeAsset('compiler.wasm-deobfuscator.wasm').then(({ bytes }) =>
|
|
96
|
+
loadWorkerRuntimeAsset('compiler.wasm-deobfuscator.wasm').then(async ({ bytes }) => {
|
|
97
|
+
const module = await WebAssembly.compile(bytes, { builtins: ['js-string'] });
|
|
98
|
+
// Validate before acknowledging load. Only the adapted loader accepts a
|
|
99
|
+
// compiled deobfuscator; ordinary/custom loaders require Wasm bytes.
|
|
100
|
+
return streamCompiler ? module : Uint8Array.from(bytes);
|
|
101
|
+
})
|
|
96
102
|
]);
|
|
97
103
|
// Publish only a fully initialized compiler; a failed first attempt
|
|
98
104
|
// must retry instead of acknowledging a partially initialized runtime.
|
|
@@ -127,7 +133,7 @@ self.addEventListener('message', async (event) => {
|
|
|
127
133
|
output = createJavaOutput((text) => self.postMessage({ output: text }));
|
|
128
134
|
const explicitStdin = hasExplicitStdin === true;
|
|
129
135
|
const stdinInjection = prepareJavaRuntimeStdinInjection(code);
|
|
130
|
-
const sourceIdentity = resolveJavaSourceIdentity(code);
|
|
136
|
+
const sourceIdentity = resolveJavaSourceIdentity(code, activePath);
|
|
131
137
|
const sourcePath = typeof activePath === 'string' && activePath ? activePath : sourceIdentity.sourcePath;
|
|
132
138
|
const sourceFileName = sourcePath.split('/').pop() || sourcePath;
|
|
133
139
|
if (!Array.isArray(workspaceFiles) ||
|
|
@@ -189,7 +195,6 @@ self.addEventListener('message', async (event) => {
|
|
|
189
195
|
compiledModule = null;
|
|
190
196
|
compiledDiagnostics = [];
|
|
191
197
|
compiledDebugFiles = [];
|
|
192
|
-
const mainClass = sourceIdentity.mainClass;
|
|
193
198
|
currentSourcePaths = new Set([sourcePath, ...sourceFiles.map((file) => file.path)].flatMap((path) => [
|
|
194
199
|
path,
|
|
195
200
|
path.split('/').pop() || path
|
|
@@ -298,14 +303,23 @@ self.addEventListener('message', async (event) => {
|
|
|
298
303
|
? 'Main method not found'
|
|
299
304
|
: 'Multiple main methods found');
|
|
300
305
|
}
|
|
306
|
+
const mainClass = mainClasses[0].replaceAll('/', '.');
|
|
301
307
|
// Compile the launcher against the original class files so user diagnostics and
|
|
302
308
|
// main-method validation stay independent, and original source lines are unchanged.
|
|
303
309
|
const classFiles = Array.from(compiler.listOutputFiles());
|
|
310
|
+
let invocation;
|
|
311
|
+
try {
|
|
312
|
+
invocation = selectJavaMainInvocation(new Uint8Array(compiler.getOutputFile(`${mainClass.replaceAll('.', '/')}.class`)));
|
|
313
|
+
}
|
|
314
|
+
catch (error) {
|
|
315
|
+
disposeDiagnosticRegistration();
|
|
316
|
+
throw error;
|
|
317
|
+
}
|
|
304
318
|
const exceptionBridge = prepareJavaExceptionBridge(mainClass, [
|
|
305
319
|
code,
|
|
306
320
|
...sourceFiles.map((file) => file.content),
|
|
307
321
|
stdinInjection.helperSource || ''
|
|
308
|
-
], classFiles);
|
|
322
|
+
], classFiles, invocation);
|
|
309
323
|
for (const path of classFiles) {
|
|
310
324
|
if (path.endsWith('.class'))
|
|
311
325
|
compiler.addClassFile(path, compiler.getOutputFile(path));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// Third-party license texts: java-debug-notices.txt beside the
|
|
2
|
-
import{a as m,b as y}from"../java-debug-
|
|
1
|
+
// Third-party license texts: java-debug-notices.txt beside the Java helpers.
|
|
2
|
+
import{a as m,b as y}from"../java-debug-64JGCLTC.js";var N=new Set(["boolean","byte","short","char","int","long","float","double"]),j=new Set(["length","isEmpty","isBlank","charAt","codePointAt","codePointBefore","codePointCount","compareTo","compareToIgnoreCase","equals","equalsIgnoreCase","contains","startsWith","endsWith","indexOf","lastIndexOf","substring","subSequence","trim","strip","stripLeading","stripTrailing","concat","hashCode","toString","regionMatches"]),x=new Set(["substring","subSequence","trim","strip","stripLeading","stripTrailing","concat","toString","valueOf","toHexString","toOctalString","toBinaryString","toUnsignedString"]),T={Math:new Set(["abs","min","max","round","ceil","floor","sqrt","cbrt","pow","sin","cos","tan","asin","acos","atan","atan2","exp","expm1","log","log10","log1p","hypot","signum","copySign","scalb","ulp","nextUp","nextDown","nextAfter","toRadians","toDegrees","addExact","subtractExact","multiplyExact","toIntExact","floorDiv","floorMod","IEEEremainder"]),String:new Set(["valueOf"]),Integer:new Set(["parseInt","parseUnsignedInt","toString","toHexString","toOctalString","toBinaryString","toUnsignedString","compare","compareUnsigned","sum","min","max","bitCount","signum","numberOfLeadingZeros","numberOfTrailingZeros","reverse","reverseBytes","rotateLeft","rotateRight","highestOneBit","lowestOneBit","toUnsignedLong"]),Long:new Set(["parseLong","parseUnsignedLong","toString","toHexString","toOctalString","toBinaryString","toUnsignedString","compare","compareUnsigned","sum","min","max","bitCount","signum","numberOfLeadingZeros","numberOfTrailingZeros","reverse","reverseBytes","rotateLeft","rotateRight","highestOneBit","lowestOneBit"]),Double:new Set(["parseDouble","toString","isNaN","isInfinite","isFinite","compare","sum","min","max"]),Float:new Set(["parseFloat","toString","isNaN","isInfinite","isFinite","compare","sum","min","max"]),Boolean:new Set(["parseBoolean","toString","logicalAnd","logicalOr","logicalXor"]),Character:new Set(["isDigit","isLetter","isLetterOrDigit","isWhitespace","isUpperCase","isLowerCase","toUpperCase","toLowerCase","toTitleCase","getNumericValue","digit","toString"])},A={Math:new Set(["PI","E"]),Integer:new Set(["MIN_VALUE","MAX_VALUE","SIZE","BYTES"]),Long:new Set(["MIN_VALUE","MAX_VALUE","SIZE","BYTES"]),Short:new Set(["MIN_VALUE","MAX_VALUE","SIZE","BYTES"]),Byte:new Set(["MIN_VALUE","MAX_VALUE","SIZE","BYTES"]),Character:new Set(["MIN_VALUE","MAX_VALUE","SIZE","BYTES"]),Double:new Set(["MIN_VALUE","MIN_NORMAL","MAX_VALUE","NaN","POSITIVE_INFINITY","NEGATIVE_INFINITY"]),Float:new Set(["MIN_VALUE","MIN_NORMAL","MAX_VALUE","NaN","POSITIVE_INFINITY","NEGATIVE_INFINITY"])},b=m((t,i)=>(t.children[i]??[]).flatMap(s=>"children"in s?[s]:[]),"nodes"),L=m((t,i)=>(t.children[i]??[]).filter(s=>!("children"in s)),"tokens");function E(t){return Object.entries(t.children).flatMap(([i,s])=>s.flatMap(f=>"children"in f?E(f):i==="Identifier"?[f]:[])).sort((i,s)=>i.startOffset-s.startOffset)}m(E,"identifiers");function M(t,i){let s=new Set;if(/\\u+[0-9a-fA-F]{4}/.test(t))throw new Error("Java evaluation does not support Unicode preprocessing escapes.");let{cst:f,tokens:o}=y(t,"expression"),S=new Set(["PlusPlus","MinusMinus","New","This","Super","Arrow","DoubleColon","LSquare","LCurly","Class","Instanceof","At"]);if(o.some(a=>S.has(a.tokenType.name)))throw new Error("Java evaluation supports read-only scalar/String expressions; mutation, objects, arrays and closures are unsupported.");let d=new Map,h=m(a=>{if(d.has(a))return d.get(a);if(a.children.AssignmentOperator)throw new Error("Java evaluation does not allow assignment or mutation.");if(a.name==="conditionalExpression"&&a.children.QuestionMark)throw new Error("Java snapshot evaluation does not support conditional expressions because compile-time constant narrowing is unavailable.");if(a.name==="typeArguments")throw new Error("Java evaluation does not support generic or user-type expressions.");let e=Object.values(a.children).flat().flatMap(p=>"children"in p?[p]:[]).map(h),n=e.includes("string")?"string":e.includes("null")?"null":"scalar";if(a.name==="literal")n=a.children.StringLiteral||a.children.TextBlock?"string":a.children.Null?"null":"scalar";else if(a.name==="referenceTypeCastExpression"){if(E(b(a,"referenceType")[0]).map(v=>v.image).join(".")!=="java.lang.String")throw new Error("Java evaluation supports only primitive and fully qualified java.lang.String casts.");n="string"}else if(a.name==="primitiveCastExpression")n="scalar";else if(a.name==="primary"){let p=b(a,"primaryPrefix")[0],v=b(p,"fqnOrRefType")[0],g=b(a,"primarySuffix"),I=0;if(v){let r=E(v).map(c=>c.image),l=!!g[0]?.children.methodInvocationSuffix,u=i.get(r[0]);if(u){if(u.unavailable!==void 0)throw new Error(`Java evaluation cannot use ${u.name}: ${u.unavailable}`);if(!N.has(u.type)&&u.type!=="String"&&u.type!=="java.lang.String")throw new Error(`Java evaluation cannot use ${u.name} (${u.type}); inspect this target reference in Variables.`);if(s.add(u.name),n=N.has(u.type)?"scalar":"string",r.length!==1||l){if(r.length!==2||!l||n!=="string"||!j.has(r[1]))throw new Error("Java evaluation cannot call target methods or access target fields.");n=x.has(r[1])?"string":"scalar",I=1}}else{let c=r.slice(2);if(r[0]!=="java"||r[1]!=="lang"||c.length!==2||(l?!Object.hasOwn(T,c[0])||!T[c[0]].has(c[1]):!Object.hasOwn(A,c[0])||!A[c[0]].has(c[1])))throw new Error(`Java evaluation cannot resolve ${r.join(".")}; use scalar/String locals or fully qualified java.lang library calls/constants.`);n=l&&x.has(c[1])?"string":"scalar",I=l?1:0}}for(let r=I;r<g.length;r+=2){let l=L(g[r],"Identifier")[0]?.image;if(n!=="string"||!l||!j.has(l)||!g[r+1]?.children.methodInvocationSuffix)throw new Error("Java evaluation supports only approved String methods on expression results.");n=x.has(l)?"string":"scalar"}}else if(a.name==="binaryExpression"){let p=b(a,"unaryExpression").map(h),v=L(a,"BinaryOperator");for(let[g,I]of v.entries()){let r=[g,g+1].some(l=>p[l]==="null"&&v[l-1]?.image!=="+"&&v[l]?.image!=="+");if(["==","!="].includes(I.image)&&(p[g]==="string"||p[g+1]==="string")&&!r)throw new Error("Java snapshot evaluation cannot compare String reference identity; use equals() for String contents.")}v.some(g=>["==","!=","<",">","<=",">=","&&","||"].includes(g.image))&&(n="scalar")}return d.set(a,n),n},"visit");return h(f),s}m(M,"validateExpression");function $(t){if(typeof t.expression!="string"||!t.expression.trim()||new TextEncoder().encode(t.expression).length>4096)throw new Error("Java expressions must contain 1\u20134096 UTF-8 bytes.");if(!Array.isArray(t.bindings)||t.bindings.length>1024)throw new Error("Java evaluation supports at most 1024 local bindings.");let i=new Map;for(let e of t.bindings){if(!e||typeof e.name!="string"||typeof e.type!="string"||e.value!==null&&typeof e.value!="string"||e.unavailable!==void 0&&typeof e.unavailable!="string")throw new Error("Invalid Java evaluation binding.");let n=y(e.name,"expression");if(n.tokens.length!==1||E(n.cst)[0]?.image!==e.name||i.has(e.name)||/\\/.test(e.name))throw new Error(`Invalid or duplicate Java local name: ${e.name}`);i.set(e.name,{...e})}let s=M(t.expression,i),f=0,o="WasmIdleEval";for(;t.expression.includes(o)||[...i.keys()].some(e=>e.includes(o));)o=`WasmIdleEval_${++f}`;let S=`${o}_args`,d=[],h=[],a={byte:"java.lang.Byte.parseByte(value)",short:"java.lang.Short.parseShort(value)",int:"java.lang.Integer.parseInt(value)",long:"java.lang.Long.parseLong(value)",float:'value.equals("NaN") ? java.lang.Float.NaN : value.equals("Infinity") ? java.lang.Float.POSITIVE_INFINITY : value.equals("-Infinity") ? java.lang.Float.NEGATIVE_INFINITY : value.equals("-0.0") ? java.lang.Float.intBitsToFloat(java.lang.Integer.MIN_VALUE) : java.lang.Float.parseFloat(value)',double:'value.equals("NaN") ? java.lang.Double.NaN : value.equals("Infinity") ? java.lang.Double.POSITIVE_INFINITY : value.equals("-Infinity") ? java.lang.Double.NEGATIVE_INFINITY : value.equals("-0.0") ? java.lang.Double.longBitsToDouble(java.lang.Long.MIN_VALUE) : java.lang.Double.parseDouble(value)',boolean:"java.lang.Boolean.parseBoolean(value)",char:"(char) java.lang.Integer.parseInt(value)"},w=0;for(let e of i.values()){if(!s.has(e.name))continue;if(w+=new TextEncoder().encode(e.value??"").length,w>65536)throw new Error("Java evaluation binding values exceed 65536 UTF-8 bytes.");let n=d.length;if(N.has(e.type)){if(e.value===null||e.type==="char"&&(!/^\d{1,5}$/.test(e.value)||Number(e.value)>65535)||e.type==="boolean"&&!["true","false"].includes(e.value))throw new Error(`Invalid ${e.type} value for Java local ${e.name}.`);d.push(e.value),h.push(`final ${e.type} ${e.name} = ${o}_${e.type}(${S}[${n}]);`)}else(e.type==="String"||e.type==="java.lang.String")&&(d.push(e.value===null?"1":"0",e.value??""),h.push(`final java.lang.String ${e.name} = ${S}[${n}].equals("1") ? null : ${S}[${n+1}];`))}return{args:d,code:`public final class ${o} {
|
|
3
3
|
${Object.entries(a).map(([e,n])=>` private static ${e} ${o}_${e}(java.lang.String value) { return ${n}; }`).join(`
|
|
4
4
|
`)}
|
|
5
5
|
${String.raw` private static java.lang.String ${o}_quote(java.lang.String value) {
|
|
@@ -29,7 +29,11 @@ export function createJavaDebugRuntime(files, options, emit, read, respond = ()
|
|
|
29
29
|
item.variablesReference < 0 ||
|
|
30
30
|
item.variablesReference > 4096 ||
|
|
31
31
|
(item.indexedVariables !== undefined &&
|
|
32
|
-
(!Number.isSafeInteger(item.indexedVariables) || item.indexedVariables < 0))
|
|
32
|
+
(!Number.isSafeInteger(item.indexedVariables) || item.indexedVariables < 0)) ||
|
|
33
|
+
(item.namedVariables !== undefined &&
|
|
34
|
+
(!Number.isSafeInteger(item.namedVariables) ||
|
|
35
|
+
item.namedVariables < 0 ||
|
|
36
|
+
item.namedVariables > 257)))
|
|
33
37
|
throw new Error('Invalid Java variable descriptor');
|
|
34
38
|
const reference = item.variablesReference
|
|
35
39
|
? referenceBase() + item.variablesReference
|
|
@@ -43,6 +47,9 @@ export function createJavaDebugRuntime(files, options, emit, read, respond = ()
|
|
|
43
47
|
variablesReference: reference,
|
|
44
48
|
...(item.indexedVariables !== undefined
|
|
45
49
|
? { indexedVariables: item.indexedVariables }
|
|
50
|
+
: {}),
|
|
51
|
+
...(item.namedVariables !== undefined
|
|
52
|
+
? { namedVariables: item.namedVariables }
|
|
46
53
|
: {})
|
|
47
54
|
};
|
|
48
55
|
});
|
|
@@ -92,8 +92,10 @@ export async function loadStreamingJavaCompiler(baseUrl, maxAssetBytes) {
|
|
|
92
92
|
}
|
|
93
93
|
/** Transform only the known verified loader, preserving TeaVM imports and exports. */
|
|
94
94
|
export function acceptCompiledTeaVmModule(source) {
|
|
95
|
-
|
|
95
|
+
// The complete byte-compilation branch belongs to the receipt-pinned 0.17.0-dev-3 loader.
|
|
96
|
+
// Its minified identifier alone is not a compatibility contract.
|
|
97
|
+
const anchor = 'async function C(e,t){if(typeof e!=="string"){return await WebAssembly.compile(e,{builtins:["js-string"]})}';
|
|
96
98
|
if (source.split(anchor).length !== 2)
|
|
97
99
|
throw new Error('Unsupported TeaVM loader for compiled-module input');
|
|
98
|
-
return source.replace(anchor, '
|
|
100
|
+
return source.replace(anchor, anchor.replace('{if(', '{if(e instanceof WebAssembly.Module)return e;if('));
|
|
99
101
|
}
|
|
@@ -33,10 +33,8 @@ const outerAssetIdentity = (url, receipt) => JSON.stringify([url, receipt.bytes,
|
|
|
33
33
|
function appendTrailingNewline(text) {
|
|
34
34
|
return text.endsWith('\n') ? text : `${text}\n`;
|
|
35
35
|
}
|
|
36
|
-
function normalizeAssetLoader(programSource
|
|
37
|
-
|
|
38
|
-
? programSource.replace('($=>async a=>{', `globalThis.${runtimePromiseKey}=($=>async a=>{`)
|
|
39
|
-
: programSource;
|
|
36
|
+
function normalizeAssetLoader(programSource) {
|
|
37
|
+
const normalizedSource = programSource;
|
|
40
38
|
const assetLoaderPattern = /function ([A-Za-z$_][\w$]*)\(([A-Za-z$_][\w$]*)\)\{const ([A-Za-z$_][\w$]*)=([A-Za-z$_][\w$]*)\?new URL\(\2,\4\):\2;return fetch\(\3\)\}/;
|
|
41
39
|
const matchedLoader = normalizedSource.match(assetLoaderPattern);
|
|
42
40
|
if (!matchedLoader) {
|
|
@@ -255,7 +253,6 @@ async function executeCompileResult(result, log = false, stdin) {
|
|
|
255
253
|
const programArtifact = getJsArtifact(result);
|
|
256
254
|
const assetFiles = result.artifacts.filter((artifact) => artifact.kind === 'wasm' || artifact.kind === 'asset');
|
|
257
255
|
const assetResolverKey = '__wasm_of_js_of_ocaml_resolve_asset';
|
|
258
|
-
const runtimePromiseKey = '__wasm_of_js_of_ocaml_runtime_promise';
|
|
259
256
|
const stdinHookKey = '__wasmIdleOcamlReadStdin';
|
|
260
257
|
const sourceDir = programArtifact.path.replace(/\/[^/]+$/, '');
|
|
261
258
|
const createdObjectUrls = [];
|
|
@@ -424,7 +421,7 @@ async function executeCompileResult(result, log = false, stdin) {
|
|
|
424
421
|
runtimeGlobal['module'] = { exports: {} };
|
|
425
422
|
runtimeGlobal['exports'] = runtimeGlobal['module'].exports;
|
|
426
423
|
try {
|
|
427
|
-
let normalizedSource = normalizeAssetLoader(programArtifact.data
|
|
424
|
+
let normalizedSource = normalizeAssetLoader(programArtifact.data);
|
|
428
425
|
const stdinReadReplacement = 'read($1,$2,$3,$4){var e=globalThis.__wasmIdleOcamlReadStdin?globalThis.__wasmIdleOcamlReadStdin($3):null;if(e==null)return 0;var h=e.length,f=new Uint8Array(h),i=0;for(;i<h;i++)f[i]=e.charCodeAt(i);var g=f.length<$3?f.length:$3;$1.set(f.subarray(0,g),$2);return g}';
|
|
429
426
|
const patchedSource = normalizedSource.replace(/read\(([A-Za-z$_][\w$]*),([A-Za-z$_][\w$]*),([A-Za-z$_][\w$]*),([A-Za-z$_][\w$]*)\)\{cz\(\4,mc,aha,ow\)\}/, stdinReadReplacement);
|
|
430
427
|
normalizedSource =
|
|
@@ -433,12 +430,17 @@ async function executeCompileResult(result, log = false, stdin) {
|
|
|
433
430
|
: normalizedSource.replace(/read\(([A-Za-z$_][\w$]*),([A-Za-z$_][\w$]*),([A-Za-z$_][\w$]*),([A-Za-z$_][\w$]*)\)\{[^{}]+\}(?=seek\([A-Za-z$_][\w$]*,[A-Za-z$_][\w$]*,[A-Za-z$_][\w$]*\)\{[^{}]+\}pos\(\)\{return-1\}close\(\)\{this\.log=undefined\}check_stream_semantics\([A-Za-z$_][\w$]*\)\{\})/, stdinReadReplacement);
|
|
434
431
|
normalizedSource = normalizedSource
|
|
435
432
|
.replace(/\bfs\.readSync\(/g, 'globalThis.fs.readSync(')
|
|
436
|
-
.replace(/read:\(([^)]*)\)=>[A-Za-z$_][\w$]*\.readSync\(/g, 'read:($1)=>globalThis.fs.readSync(')
|
|
433
|
+
.replace(/read:\(([^)]*)\)=>[A-Za-z$_][\w$]*\.readSync\(/g, 'read:($1)=>globalThis.fs.readSync(')
|
|
434
|
+
.replace(
|
|
435
|
+
// wasm_of_ocaml 6.5 checks its registered virtual files before
|
|
436
|
+
// falling back to Node's five-argument readSync. Preserve that path.
|
|
437
|
+
/\breturn [A-Za-z$_][\w$]*\.readSync\(([A-Za-z$_][\w$]*),([A-Za-z$_][\w$]*),([A-Za-z$_][\w$]*),([A-Za-z$_][\w$]*),([A-Za-z$_][\w$]*)\)\}/g, 'return globalThis.fs.readSync($1,$2,$3,$4,$5)}');
|
|
437
438
|
if (log && normalizedSource === programArtifact.data) {
|
|
438
439
|
console.warn('[wasm-idle:ocaml-worker] stdin runtime patch did not match generated JS');
|
|
439
440
|
}
|
|
440
|
-
|
|
441
|
-
|
|
441
|
+
// The generated script's completion value is its async Wasm initializer.
|
|
442
|
+
// Evaluate in a fresh function scope without depending on minified names.
|
|
443
|
+
const runtimePromise = new Function('return eval(arguments[0])')(`${normalizedSource}\n//# sourceURL=${programArtifact.path}`);
|
|
442
444
|
if (runtimePromise instanceof Promise) {
|
|
443
445
|
await runtimePromise;
|
|
444
446
|
}
|
|
@@ -451,7 +453,6 @@ async function executeCompileResult(result, log = false, stdin) {
|
|
|
451
453
|
if (originalInstantiateStreaming) {
|
|
452
454
|
WebAssembly.instantiateStreaming = originalInstantiateStreaming;
|
|
453
455
|
}
|
|
454
|
-
delete globalThis[runtimePromiseKey];
|
|
455
456
|
delete globalThis[assetResolverKey];
|
|
456
457
|
if (!hadProcess) {
|
|
457
458
|
delete runtimeGlobal['process'];
|
|
@@ -7,7 +7,7 @@ import { createPythonExecutionHelpers } from './pythonExecution';
|
|
|
7
7
|
import { compilePythonBytecode } from './pythonCompile';
|
|
8
8
|
import { createPythonWorkspaceImports } from './pythonWorkspaceImports';
|
|
9
9
|
import { createPythonWorkspaceFiles } from './pythonWorkspaceFiles';
|
|
10
|
-
import {
|
|
10
|
+
import { createPythonDebugHelpers } from './pythonDebug';
|
|
11
11
|
import { createPythonStdio, PYTHON_FLUSH_HOOK_FACTORY } from './pythonStdio';
|
|
12
12
|
import { fetchRuntimeAssetBytes } from './runtimeAssetFetch';
|
|
13
13
|
import { configureWorkerRuntimeAssetAllowlist, configureWorkerRuntimeAssets, handleWorkerAssetMessage, loadWorkerRuntimeAsset } from './assets';
|
|
@@ -29,6 +29,7 @@ let installedApecodeVersion;
|
|
|
29
29
|
let executionHelpers;
|
|
30
30
|
let invalidateWorkspaceImports;
|
|
31
31
|
let syncWorkspaceFiles;
|
|
32
|
+
let debugHelpers;
|
|
32
33
|
let debugPauseSequence = 0;
|
|
33
34
|
let installPythonFlushHooks;
|
|
34
35
|
const PYTHON_EXTENSIONS = {
|
|
@@ -664,6 +665,8 @@ self.onmessage = async (event) => {
|
|
|
664
665
|
}
|
|
665
666
|
}
|
|
666
667
|
};
|
|
668
|
+
let debugTrace;
|
|
669
|
+
const debugTraceName = `__wasm_idle_python_debug_trace_${ts}`;
|
|
667
670
|
const debugPauseName = `__wasm_idle_python_debug_pause_${ts}`;
|
|
668
671
|
const debugWaitName = `__wasm_idle_python_debug_wait_${ts}`;
|
|
669
672
|
const debugReadWatchName = `__wasm_idle_python_debug_watch_read_${ts}`;
|
|
@@ -763,7 +766,6 @@ self.onmessage = async (event) => {
|
|
|
763
766
|
(isHy ? '__wasm_idle_user__.hy' : '__wasm_idle_user__.py');
|
|
764
767
|
const debugFilename = normalizeWorkspacePath(debugPath || '') || executionFilename;
|
|
765
768
|
const executionFilenameLiteral = JSON.stringify(executionFilename);
|
|
766
|
-
const debugFilenameLiteral = JSON.stringify(debugFilename);
|
|
767
769
|
const normalizedBreakpoints = JSON.stringify([...(Array.isArray(breakpoints) ? breakpoints : [])]
|
|
768
770
|
.map((value) => Number(value))
|
|
769
771
|
.filter((value) => Number.isInteger(value) && value > 0));
|
|
@@ -781,6 +783,18 @@ self.onmessage = async (event) => {
|
|
|
781
783
|
await getExecutionHelpers().run(code, executionFilename, self[executionReadyName]);
|
|
782
784
|
}
|
|
783
785
|
else {
|
|
786
|
+
if (debug) {
|
|
787
|
+
debugHelpers ??= createPythonDebugHelpers(pyodide, imageHook);
|
|
788
|
+
debugTrace = debugHelpers.createTrace(debugFilename, normalizedBreakpoints, !!pauseOnEntry, {
|
|
789
|
+
state: self[debugBreakpointStateName],
|
|
790
|
+
readBreakpoints: self[debugReadBreakpointsName],
|
|
791
|
+
pause: self[debugPauseName],
|
|
792
|
+
wait: self[debugWaitName],
|
|
793
|
+
readWatch: self[debugReadWatchName],
|
|
794
|
+
writeWatch: self[debugWriteWatchName]
|
|
795
|
+
});
|
|
796
|
+
self[debugTraceName] = debugTrace;
|
|
797
|
+
}
|
|
784
798
|
await pyodide.runPythonAsync(`import ast
|
|
785
799
|
import builtins
|
|
786
800
|
import inspect
|
|
@@ -789,162 +803,9 @@ import os
|
|
|
789
803
|
import sys
|
|
790
804
|
import types
|
|
791
805
|
from js import ${executionReadyName} as __wasm_idle_execution_ready
|
|
792
|
-
${debug ? `from js import ${
|
|
793
|
-
${debug ? `from js import ${debugReadWatchName}, ${debugWriteWatchName}` : ''}
|
|
794
|
-
${debug ? `from js import ${debugReadBreakpointsName}` : ''}
|
|
795
|
-
${debug ? `from js import ${debugBreakpointStateName} as __wasm_idle_debug_breakpoint_state` : ''}
|
|
796
|
-
|
|
797
|
-
${imageHook}
|
|
798
|
-
|
|
799
|
-
${debug
|
|
800
|
-
? `
|
|
801
|
-
import os as __wasm_idle_debug_os
|
|
802
|
-
|
|
803
|
-
# Direct compilation uses relative paths; imported modules use absolute paths.
|
|
804
|
-
# Capture both identities before user code can change the working directory.
|
|
805
|
-
__wasm_idle_debug_source_filenames = {
|
|
806
|
-
${debugFilenameLiteral},
|
|
807
|
-
__wasm_idle_debug_os.path.abspath(${debugFilenameLiteral}),
|
|
808
|
-
}
|
|
809
|
-
__wasm_idle_debug_breakpoints = set(${normalizedBreakpoints})
|
|
810
|
-
__wasm_idle_debug_breakpoint_version = -1
|
|
811
|
-
__wasm_idle_debug_pause_on_entry = ${pauseOnEntry ? 'True' : 'False'}
|
|
812
|
-
__wasm_idle_debug_step_mode = None
|
|
813
|
-
__wasm_idle_debug_next_depth = None
|
|
814
|
-
__wasm_idle_debug_step_out_depth = None
|
|
815
|
-
|
|
816
|
-
def __wasm_idle_debug_refresh_breakpoints():
|
|
817
|
-
global __wasm_idle_debug_breakpoints
|
|
818
|
-
global __wasm_idle_debug_breakpoint_version
|
|
819
|
-
if __wasm_idle_debug_breakpoint_state.version == __wasm_idle_debug_breakpoint_version:
|
|
820
|
-
return
|
|
821
|
-
payload = ${debugReadBreakpointsName}(__wasm_idle_debug_breakpoint_version)
|
|
822
|
-
# JavaScript null crosses Pyodide as JsNull rather than Python None.
|
|
823
|
-
if not isinstance(payload, str):
|
|
824
|
-
return
|
|
825
|
-
snapshot = json.loads(payload)
|
|
826
|
-
version = int(snapshot.get("version", -1))
|
|
827
|
-
if version == __wasm_idle_debug_breakpoint_version:
|
|
828
|
-
return
|
|
829
|
-
__wasm_idle_debug_breakpoint_version = version
|
|
830
|
-
__wasm_idle_debug_breakpoints = set(int(line) for line in snapshot.get("lines", []) if int(line) > 0)
|
|
831
|
-
|
|
832
|
-
def __wasm_idle_debug_depth(frame):
|
|
833
|
-
depth = 0
|
|
834
|
-
current = frame
|
|
835
|
-
while current is not None:
|
|
836
|
-
if current.f_code.co_filename in __wasm_idle_debug_source_filenames:
|
|
837
|
-
depth += 1
|
|
838
|
-
current = current.f_back
|
|
839
|
-
return depth
|
|
840
|
-
|
|
841
|
-
${PYTHON_DEBUG_PREVIEW}
|
|
842
|
-
|
|
843
|
-
def __wasm_idle_debug_locals(frame, start=0, count=50):
|
|
844
|
-
locals_preview = []
|
|
845
|
-
index = 0
|
|
846
|
-
for name, value in frame.f_locals.items():
|
|
847
|
-
if name == "__builtins__" or name.startswith("__wasm_idle_") or name.startswith("."):
|
|
848
|
-
continue
|
|
849
|
-
if index >= start:
|
|
850
|
-
preview = __wasm_idle_debug_preview(value)
|
|
851
|
-
if len(preview) > 200:
|
|
852
|
-
preview = preview[:197] + "..."
|
|
853
|
-
suffix = "… [" + str(index) + "]"
|
|
854
|
-
display_name = name if len(name) <= 256 else name[:256-len(suffix)] + suffix
|
|
855
|
-
locals_preview.append({"name": display_name, "value": preview})
|
|
856
|
-
if len(locals_preview) >= count:
|
|
857
|
-
break
|
|
858
|
-
index += 1
|
|
859
|
-
return locals_preview
|
|
860
|
-
|
|
861
|
-
def __wasm_idle_debug_stack(frame):
|
|
862
|
-
stack = []
|
|
863
|
-
current = frame
|
|
864
|
-
while current is not None:
|
|
865
|
-
if current.f_code.co_filename in __wasm_idle_debug_source_filenames:
|
|
866
|
-
stack.append({"functionName": current.f_code.co_name, "line": current.f_lineno})
|
|
867
|
-
current = current.f_back
|
|
868
|
-
return stack
|
|
869
|
-
|
|
870
|
-
def __wasm_idle_debug_trace(frame, event, arg):
|
|
871
|
-
global __wasm_idle_debug_pause_on_entry
|
|
872
|
-
global __wasm_idle_debug_step_mode
|
|
873
|
-
global __wasm_idle_debug_next_depth
|
|
874
|
-
global __wasm_idle_debug_step_out_depth
|
|
806
|
+
${debug ? `from js import ${debugTraceName} as __wasm_idle_debug_trace` : ''}
|
|
875
807
|
|
|
876
|
-
|
|
877
|
-
return None
|
|
878
|
-
if event != "line":
|
|
879
|
-
return __wasm_idle_debug_trace
|
|
880
|
-
|
|
881
|
-
__wasm_idle_debug_refresh_breakpoints()
|
|
882
|
-
# Returning from a trace callback executes this event; a later event on the same
|
|
883
|
-
# line is another loop iteration, not a replay of the previous stop.
|
|
884
|
-
needs_depth = __wasm_idle_debug_step_mode in ("next", "out")
|
|
885
|
-
depth = __wasm_idle_debug_depth(frame) if needs_depth else None
|
|
886
|
-
line = frame.f_lineno
|
|
887
|
-
|
|
888
|
-
reason = None
|
|
889
|
-
if __wasm_idle_debug_pause_on_entry:
|
|
890
|
-
reason = "entry"
|
|
891
|
-
elif line in __wasm_idle_debug_breakpoints:
|
|
892
|
-
reason = "breakpoint"
|
|
893
|
-
elif __wasm_idle_debug_step_mode == "step":
|
|
894
|
-
reason = "step"
|
|
895
|
-
elif __wasm_idle_debug_step_mode == "next" and __wasm_idle_debug_next_depth is not None and depth <= __wasm_idle_debug_next_depth:
|
|
896
|
-
reason = "nextLine"
|
|
897
|
-
elif __wasm_idle_debug_step_mode == "out" and __wasm_idle_debug_step_out_depth is not None and depth <= __wasm_idle_debug_step_out_depth:
|
|
898
|
-
reason = "stepOut"
|
|
899
|
-
|
|
900
|
-
if reason is None:
|
|
901
|
-
return __wasm_idle_debug_trace
|
|
902
|
-
|
|
903
|
-
if depth is None:
|
|
904
|
-
depth = __wasm_idle_debug_depth(frame)
|
|
905
|
-
__wasm_idle_debug_pause_on_entry = False
|
|
906
|
-
__wasm_idle_debug_step_mode = None
|
|
907
|
-
__wasm_idle_debug_next_depth = None
|
|
908
|
-
__wasm_idle_debug_step_out_depth = None
|
|
909
|
-
|
|
910
|
-
sys.stdout.flush()
|
|
911
|
-
sys.stderr.flush()
|
|
912
|
-
pause_reference = ${debugPauseName}(line, reason, json.dumps(__wasm_idle_debug_locals(frame)), json.dumps(__wasm_idle_debug_stack(frame)))
|
|
913
|
-
while True:
|
|
914
|
-
command = ${debugWaitName}()
|
|
915
|
-
if command < 0:
|
|
916
|
-
raise KeyboardInterrupt()
|
|
917
|
-
if command == 6:
|
|
918
|
-
try:
|
|
919
|
-
request = json.loads(${debugReadWatchName}())
|
|
920
|
-
start = max(0, int(request.get("start", 0)))
|
|
921
|
-
count = max(1, min(50, int(request.get("count", 50))))
|
|
922
|
-
page = __wasm_idle_debug_locals(frame, start, count) if request.get("reference") == pause_reference else []
|
|
923
|
-
${debugWriteWatchName}(json.dumps(page))
|
|
924
|
-
except Exception:
|
|
925
|
-
${debugWriteWatchName}("[]")
|
|
926
|
-
continue
|
|
927
|
-
if command != 5:
|
|
928
|
-
break
|
|
929
|
-
try:
|
|
930
|
-
expression = ${debugReadWatchName}()
|
|
931
|
-
result = __wasm_idle_debug_preview(eval(expression, frame.f_globals, frame.f_locals))
|
|
932
|
-
except Exception as error:
|
|
933
|
-
result = "?" if error.__class__.__name__ == "NameError" else "error"
|
|
934
|
-
${debugWriteWatchName}(result)
|
|
935
|
-
if command == 2:
|
|
936
|
-
__wasm_idle_debug_step_mode = "step"
|
|
937
|
-
elif command == 3:
|
|
938
|
-
__wasm_idle_debug_step_mode = "next"
|
|
939
|
-
__wasm_idle_debug_next_depth = depth
|
|
940
|
-
elif command == 4:
|
|
941
|
-
__wasm_idle_debug_step_mode = "out"
|
|
942
|
-
__wasm_idle_debug_step_out_depth = max(0, depth - 1)
|
|
943
|
-
return __wasm_idle_debug_trace
|
|
944
|
-
|
|
945
|
-
sys.settrace(__wasm_idle_debug_trace)
|
|
946
|
-
`
|
|
947
|
-
: ''}
|
|
808
|
+
${debug ? 'sys.settrace(__wasm_idle_debug_trace)' : imageHook}
|
|
948
809
|
|
|
949
810
|
${isHy
|
|
950
811
|
? `
|
|
@@ -1009,13 +870,7 @@ finally:
|
|
|
1009
870
|
__wasm_idle_globals.pop(${JSON.stringify(executionReadyName)}, None)
|
|
1010
871
|
del __wasm_idle_execution_ready
|
|
1011
872
|
sys.settrace(None)
|
|
1012
|
-
${debug
|
|
1013
|
-
? `
|
|
1014
|
-
__wasm_idle_debug_step_mode = None
|
|
1015
|
-
__wasm_idle_debug_next_depth = None
|
|
1016
|
-
__wasm_idle_debug_step_out_depth = None
|
|
1017
|
-
`
|
|
1018
|
-
: ''}
|
|
873
|
+
${debug ? 'del __wasm_idle_debug_trace' : ''}
|
|
1019
874
|
`}
|
|
1020
875
|
`);
|
|
1021
876
|
}
|
|
@@ -1042,6 +897,8 @@ finally:
|
|
|
1042
897
|
delete self[debugWriteWatchName];
|
|
1043
898
|
delete self[debugReadBreakpointsName];
|
|
1044
899
|
delete self[debugBreakpointStateName];
|
|
900
|
+
delete self[debugTraceName];
|
|
901
|
+
debugTrace?.destroy();
|
|
1045
902
|
}
|
|
1046
903
|
}
|
|
1047
904
|
};
|
|
@@ -40,6 +40,7 @@ def compile_bytecode(source, filename, optimization, byte_limit, invalidation_mo
|
|
|
40
40
|
"checked-hash": py_compile.PycInvalidationMode.CHECKED_HASH,
|
|
41
41
|
"unchecked-hash": py_compile.PycInvalidationMode.UNCHECKED_HASH,
|
|
42
42
|
"timestamp": py_compile.PycInvalidationMode.TIMESTAMP,
|
|
43
|
+
"normalized": py_compile.PycInvalidationMode.CHECKED_HASH,
|
|
43
44
|
}[invalidation_mode]
|
|
44
45
|
|
|
45
46
|
with tempfile.TemporaryDirectory(prefix="wasm-idle-pyc-") as directory:
|
|
@@ -62,6 +63,10 @@ def compile_bytecode(source, filename, optimization, byte_limit, invalidation_mo
|
|
|
62
63
|
return {"byteLimitExceeded": size}
|
|
63
64
|
with open(output_path, "rb") as output_file:
|
|
64
65
|
data = output_file.read()
|
|
66
|
+
if invalidation_mode == "normalized":
|
|
67
|
+
# Preserve the runtime magic and complete code object, but remove the
|
|
68
|
+
# source hash, flags, timestamp and source size for source-free artifacts.
|
|
69
|
+
data = data[:4] + bytes(12) + data[16:]
|
|
65
70
|
return {
|
|
66
71
|
"data": data,
|
|
67
72
|
"pythonVersion": platform.python_version(),
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { PyodideInterface } from 'pyodide';
|
|
2
|
+
/** Fixed code is reusable; every run still gets its own breakpoint and stepping state. */
|
|
3
|
+
export declare const PYTHON_DEBUG_TRACE: string;
|
|
4
|
+
export declare const PYTHON_DEBUG_FACTORY: string;
|
|
5
|
+
interface PythonDebugBridge {
|
|
6
|
+
state: {
|
|
7
|
+
readonly version: number;
|
|
8
|
+
};
|
|
9
|
+
readBreakpoints(knownVersion: number): string | null;
|
|
10
|
+
pause(line: number, reason: string, locals: string, stack: string): number;
|
|
11
|
+
wait(): number;
|
|
12
|
+
readWatch(): string;
|
|
13
|
+
writeWatch(value: string): void;
|
|
14
|
+
}
|
|
15
|
+
/** The worker retains only fixed code; callers destroy each run's returned trace proxy. */
|
|
16
|
+
export declare function createPythonDebugHelpers(runtime: PyodideInterface, imageHook: string): {
|
|
17
|
+
createTrace(filename: string, breakpoints: string, pauseOnEntry: boolean, bridge: PythonDebugBridge): any;
|
|
18
|
+
dispose(): void;
|
|
19
|
+
};
|
|
20
|
+
export {};
|