Skip to content

Commit f40a5c9

Browse files
committed
update deps; fix wrong error name
1 parent 478195f commit f40a5c9

File tree

10 files changed

+47
-26
lines changed

10 files changed

+47
-26
lines changed

bun.lockb

-15 KB
Binary file not shown.

exampleVault/folder/entry.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const importFromFolder1 = await engine.importJs('folder/importFromFolder1.js');
2+
3+
console.log('importFromFolder1:', importFromFolder1);
4+
5+
importFromFolder1.test();
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { greet } from "./importFromFolder2.js";
2+
3+
export function test() {
4+
greet();
5+
console.log('Hello from folder/importFromFolder1.js');
6+
console.log(import.meta);
7+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function greet() {
2+
console.log('Hello from folder/importFromFolder2.js');
3+
}

jsEngine/engine/ExecutionStatsModal.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { mount, unmount } from 'svelte';
1111
*/
1212
export class ExecutionStatsModal extends Modal {
1313
private readonly plugin: JsEnginePlugin;
14-
private component: MountedComponent<ExecutionStatsComponent> | undefined;
14+
private component: MountedComponent<typeof ExecutionStatsComponent> | undefined;
1515
private execution: JsExecution | undefined;
1616

1717
constructor(app: App, plugin: JsEnginePlugin) {

jsEngine/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default class JsEnginePlugin extends Plugin {
2727
this.api = new API(this.app, this, InstanceId.create(InstanceType.PLUGIN));
2828
}
2929

30-
// eslint-disable-next-line @typescript-eslint/no-misused-promises
30+
3131
async onload(): Promise<void> {
3232
await this.loadSettings();
3333

jsEngine/messages/MessageDisplay.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class MessageDisplay extends Modal {
1010
* Reference the JS Engine plugin.
1111
*/
1212
private readonly plugin: JsEnginePlugin;
13-
private component: MountedComponent<MessageDisplayComponent> | undefined;
13+
private component: MountedComponent<typeof MessageDisplayComponent> | undefined;
1414

1515
constructor(app: App, plugin: JsEnginePlugin) {
1616
super(app);

jsEngine/utils/Errors.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ export enum ErrorLevel {
55
}
66

77
export enum ErrorType {
8-
INTERNAL = 'MB_INTERNAL',
8+
INTERNAL = 'JSE_INTERNAL',
9+
VALIDATION = 'JSE_VALIDATION',
910

1011
OTHER = 'OTHER',
1112
}
@@ -63,3 +64,9 @@ export class JSEngineInternalError extends JSEngineError {
6364
return ErrorType.INTERNAL;
6465
}
6566
}
67+
68+
export class JSEngineValidationError extends JSEngineError {
69+
public getErrorType(): ErrorType {
70+
return ErrorType.VALIDATION;
71+
}
72+
}

jsEngine/utils/Validators.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import type {
1515
import type { EngineExecutionParams } from 'jsEngine/engine/Engine';
1616
import type { Block, JsExecutionContext, JsExecutionGlobalsConstructionOptions } from 'jsEngine/engine/JsExecution';
1717
import { MessageType } from 'jsEngine/messages/MessageManager';
18-
import { ErrorLevel, JSEngineInternalError } from 'jsEngine/utils/Errors';
18+
import { ErrorLevel, JSEngineValidationError } from 'jsEngine/utils/Errors';
1919
import { ButtonStyleType } from 'jsEngine/utils/Util';
2020
import type { CachedMetadata } from 'obsidian';
2121
import { Component, TFile } from 'obsidian';
@@ -31,7 +31,7 @@ export function validateAPIArgs<T>(validator: z.ZodType<T>, args: T): void {
3131
const result = validator.safeParse(args);
3232

3333
if (!result.success) {
34-
throw new JSEngineInternalError({
34+
throw new JSEngineValidationError({
3535
errorLevel: ErrorLevel.CRITICAL,
3636
effect: 'Failed to run function due to invalid arguments. Check that the arguments that you are passing to the function match the type definition of the function.',
3737
cause: result.error,

package.json

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,36 +23,35 @@
2323
"author": "Moritz Jung",
2424
"license": "GPL-3.0",
2525
"devDependencies": {
26-
"@codemirror/autocomplete": "^6.18.0",
26+
"@codemirror/autocomplete": "^6.18.2",
2727
"@codemirror/lang-javascript": "^6.2.2",
28-
"@codemirror/language": "^6.10.2",
29-
"@codemirror/lint": "^6.8.1",
28+
"@codemirror/language": "^6.10.3",
29+
"@codemirror/lint": "^6.8.2",
3030
"@codemirror/state": "^6.4.1",
31-
"@codemirror/view": "^6.33.0",
32-
"@eslint/js": "^9.9.1",
33-
"@happy-dom/global-registrator": "^15.0.0",
31+
"@codemirror/view": "^6.34.1",
32+
"@eslint/js": "^9.14.0",
33+
"@happy-dom/global-registrator": "^15.8.0",
3434
"@tsconfig/svelte": "^5.0.4",
35-
"@types/bun": "^1.1.8",
35+
"@types/bun": "^1.1.13",
3636
"builtin-modules": "^4.0.0",
37-
"esbuild": "^0.23.1",
37+
"esbuild": "^0.24.0",
3838
"esbuild-plugin-copy-watch": "^2.3.1",
39-
"esbuild-svelte": "^0.8.1",
40-
"eslint": "^9.9.1",
41-
"eslint-plugin-import": "^2.29.1",
39+
"esbuild-svelte": "^0.8.2",
40+
"eslint": "^9.14.0",
41+
"eslint-plugin-import": "^2.31.0",
4242
"eslint-plugin-no-relative-import-paths": "^1.5.5",
4343
"eslint-plugin-only-warn": "^1.1.0",
4444
"obsidian": "latest",
45-
"obsidian-dataview": "0.5.56",
4645
"prettier": "^3.3.3",
47-
"prettier-plugin-svelte": "^3.2.6",
46+
"prettier-plugin-svelte": "^3.2.7",
4847
"string-argv": "^0.3.2",
49-
"svelte": "^5.0.0-next.238",
50-
"svelte-check": "^3.8.6",
51-
"svelte-preprocess": "^6.0.2",
52-
"tslib": "^2.7.0",
53-
"typedoc": "^0.26.6",
54-
"typescript": "^5.5.4",
55-
"typescript-eslint": "^8.2.0"
48+
"svelte": "^5.1.9",
49+
"svelte-check": "^4.0.5",
50+
"svelte-preprocess": "^6.0.3",
51+
"tslib": "^2.8.1",
52+
"typedoc": "^0.26.11",
53+
"typescript": "^5.6.3",
54+
"typescript-eslint": "^8.12.2"
5655
},
5756
"dependencies": {
5857
"@codemirror/legacy-modes": "^6.4.1",

0 commit comments

Comments
 (0)