Skip to content

Commit a68289f

Browse files
committed
bundled
Signed-off-by: duart38 <duartsnel@icloud.com>
1 parent 920907e commit a68289f

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Thread.bundle.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ class Thread {
99
blobURL = "";
1010
stopped = false;
1111
constructor(operation, type, imports){
12-
imports?.forEach((v)=>{
13-
if (v.endsWith(".ts'") || v.endsWith('.ts"')) {
14-
throw new Error("Threaded imports do no support typescript files");
15-
}
16-
});
1712
this.imports = imports || [];
1813
this.blob = this.populateFile(operation);
1914
this.worker = this.makeWorker(type);
@@ -41,7 +36,7 @@ class Thread {
4136
]);
4237
}
4338
async copyDep(str) {
44-
const importPathRegex = /('|"|`)(.+\.js)(\1)/ig;
39+
const importPathRegex = /('|"|`)(.+(\.js|\.ts))(\1)/ig;
4540
const importInsRegex = /(import( |))({.+}|.+)(from( |))/ig;
4641
const matchedPath = importPathRegex.exec(str) || "";
4742
let file = false;
@@ -58,7 +53,13 @@ class Thread {
5853
const x = await import(fqfn);
5954
return Object.keys(x).map((v)=>x[v].toString());
6055
} else {
61-
const x1 = await import(matchedPath[0].replaceAll(/'|"/g, ""));
56+
const filePath = matchedPath[0].replaceAll(/'|"/g, "");
57+
if (filePath.endsWith(".ts")) {
58+
return [
59+
str
60+
];
61+
}
62+
const x1 = await import(filePath);
6263
return Object.keys(x1).map((v)=>x1[v].toString());
6364
}
6465
}

0 commit comments

Comments
 (0)