Skip to content

Commit 8b5c243

Browse files
committed
add source URLs to executions and add funding
1 parent 6c8252d commit 8b5c243

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: ["mProjectsCode"]

exampleVault/Test.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,4 +194,10 @@ const el = container.createEl("button", {text: "Click me"})
194194
el.addEventListener("click", () => {
195195
new obsidian.Notice("Hello")
196196
});
197+
```
198+
199+
# Test Error
200+
201+
```js-engine
202+
le
197203
```

jsEngine/api/InstanceId.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ export class InstanceId {
1717
this.id = id;
1818
}
1919

20+
toString(): string {
21+
return `plugin:js-engine:${this.name}:${this.id}`;
22+
}
23+
2024
static create(name: string): InstanceId {
2125
return new InstanceId(name, self.crypto.randomUUID());
2226
}

jsEngine/engine/JsExecution.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ export class JsExecution {
127127
const startTime = performance.now();
128128

129129
try {
130-
this.func = AsyncFunction(...Object.keys(this.globals), this.code) as JsFunc;
130+
// this.func = AsyncFunction(...Object.keys(this.globals), this.code) as JsFunc;
131+
this.func = window.eval(`(async function anonymous(${Object.keys(this.globals).join(', ')}) {\n\n${this.code}\n\n})\n //# sourceURL=${encodeURIComponent(this.apiInstance.instanceId.toString())}`) as JsFunc;
131132
} catch (e) {
132133
if (e instanceof Error) {
133134
this.functionBuildError = e;

0 commit comments

Comments
 (0)