Skip to content

Commit c2faf57

Browse files
committed
update to svelte 5
1 parent 6d84d4e commit c2faf57

File tree

233 files changed

+1689
-1348
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

233 files changed

+1689
-1348
lines changed

.eslintrc.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const config = {
8989
],
9090
'@typescript-eslint/consistent-type-imports': [
9191
'error',
92-
{ prefer: 'type-imports', fixStyle: 'inline-type-imports' },
92+
{ prefer: 'type-imports', fixStyle: 'separate-type-imports' },
9393
],
9494

9595
'@typescript-eslint/no-confusing-void-expression': ['error', { ignoreArrowShorthand: true }],

automation/build/bun_test.ts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import builtins from 'builtin-modules';
2+
import esbuild from 'esbuild';
3+
import esbuildSvelte from 'esbuild-svelte';
4+
import sveltePreprocess from 'svelte-preprocess';
5+
import { getBuildBanner } from 'build/buildBanner';
6+
7+
// currently this segfaults for me, but i want to consider using bun for the build system in the future
8+
// https://github.com/oven-sh/bun/issues/12456
9+
10+
const banner = getBuildBanner('Release Build', version => version);
11+
12+
const build = await Bun.build({
13+
banner: {
14+
js: banner,
15+
},
16+
entryPoints: ['packages/obsidian/src/main.ts'],
17+
bundle: true,
18+
external: [
19+
'obsidian',
20+
'electron',
21+
'@codemirror/autocomplete',
22+
'@codemirror/collab',
23+
'@codemirror/commands',
24+
'@codemirror/language',
25+
'@codemirror/lint',
26+
'@codemirror/search',
27+
'@codemirror/state',
28+
'@codemirror/view',
29+
'@lezer/common',
30+
'@lezer/highlight',
31+
'@lezer/lr',
32+
...builtins,
33+
],
34+
format: 'esm',
35+
target: 'browser',
36+
logLevel: 'info',
37+
sourcemap: 'none',
38+
treeShaking: true,
39+
outfile: 'main.js',
40+
minify: true,
41+
metafile: true,
42+
define: {
43+
MB_GLOBAL_CONFIG_DEV_BUILD: 'false',
44+
},
45+
plugins: [
46+
// @ts-ignore
47+
esbuildSvelte({
48+
compilerOptions: { css: 'injected', dev: false },
49+
preprocess: sveltePreprocess(),
50+
filterWarnings: warning => {
51+
// we don't want warnings from node modules that we can do nothing about
52+
return !warning.filename?.includes('node_modules');
53+
},
54+
}),
55+
],
56+
});
57+
58+
// const file = Bun.file('meta.txt');
59+
// await Bun.write(file, JSON.stringify(build.metafile, null, '\t'));
60+
61+
// process.exit(0);

automation/build/esbuild.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import builtins from 'builtin-modules';
22
import esbuild from 'esbuild';
33
import esbuildSvelte from 'esbuild-svelte';
4-
import sveltePreprocess from 'svelte-preprocess';
4+
import { sveltePreprocess } from 'svelte-preprocess';
55
import { getBuildBanner } from 'build/buildBanner';
66

77
const banner = getBuildBanner('Release Build', version => version);
@@ -41,7 +41,7 @@ const build = await esbuild.build({
4141
},
4242
plugins: [
4343
esbuildSvelte({
44-
compilerOptions: { css: 'injected', dev: false, sveltePath: 'svelte' },
44+
compilerOptions: { css: 'injected', dev: false },
4545
preprocess: sveltePreprocess(),
4646
filterWarnings: warning => {
4747
// we don't want warnings from node modules that we can do nothing about

automation/build/esbuild.dev.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import esbuild from 'esbuild';
22
import copy from 'esbuild-plugin-copy-watch';
33
import esbuildSvelte from 'esbuild-svelte';
4-
import sveltePreprocess from 'svelte-preprocess';
4+
import { sveltePreprocess } from 'svelte-preprocess';
55
import manifest from '../../manifest.json' assert { type: 'json' };
66
import { getBuildBanner } from 'build/buildBanner';
77

@@ -52,7 +52,7 @@ const context = await esbuild.context({
5252
],
5353
}),
5454
esbuildSvelte({
55-
compilerOptions: { css: 'injected', dev: true, sveltePath: 'svelte' },
55+
compilerOptions: { css: 'injected', dev: true },
5656
preprocess: sveltePreprocess(),
5757
filterWarnings: warning => {
5858
// we don't want warnings from node modules that we can do nothing about

automation/build/esbuild.publish.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import builtins from 'builtin-modules';
22
import esbuild from 'esbuild';
33
import esbuildSvelte from 'esbuild-svelte';
44
import process from 'process';
5-
import sveltePreprocess from 'svelte-preprocess';
5+
import { sveltePreprocess } from 'svelte-preprocess';
66
import { getBuildBanner } from 'build/buildBanner';
77

88
const banner = getBuildBanner('Publish Release Build', version => `Publish Release Build (based on ${version})`);

automation/build/esbuild.publish.dev.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import builtins from 'builtin-modules';
22
import esbuild from 'esbuild';
33
import esbuildSvelte from 'esbuild-svelte';
44
import process from 'process';
5-
import sveltePreprocess from 'svelte-preprocess';
5+
import { sveltePreprocess } from 'svelte-preprocess';
66
import { getBuildBanner } from 'build/buildBanner';
77

88
const banner = getBuildBanner('Publish Dev Build', _ => `Publish Dev Build`);

bun.lockb

-10 KB
Binary file not shown.

bunfig.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[test]
2-
preload = ["./tests/__preload__/svelteLoader.ts", "./tests/__preload__/happydom.ts", "./tests/__preload__/obsidianMock.ts", "./tests/__preload__/customMatchers.ts"]
3-
root = "./tests"
2+
preload = ["./tests/__preload__/happydom.ts", "./tests/__preload__/svelteLoader.ts", "./tests/__preload__/obsidianMock.ts", "./tests/__preload__/customMatchers.ts"]
3+
root = "./tests"
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
health: 50
3+
max_health: 50
4+
damage: 5
5+
---
6+
7+
```meta-bind-button
8+
label: "Deal"
9+
style: destructive
10+
hidden: true
11+
id: "deal-damage"
12+
actions:
13+
- type: updateMetadata
14+
bindTarget: health
15+
evaluate: true
16+
value: x - getMetadata('damage')
17+
```
18+
19+
```meta-bind-button
20+
label: "Reset"
21+
style: primary
22+
hidden: true
23+
id: "reset-health"
24+
actions:
25+
- type: updateMetadata
26+
bindTarget: health
27+
evaluate: true
28+
value: getMetadata('max_health')
29+
```
30+
31+
Health: `VIEW[{health}][text]` `BUTTON[reset-health]`
32+
33+
Damage: `INPUT[number:damage]` `BUTTON[deal-damage]`

exampleVault/Input Fields/Date and Time.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
time: 13:05
3-
date2: 2024-01-22
3+
date2: 2024-01-22T00:00:00+01:00
44
date1: 2024-03-07
55
dateTime: 2024-03-13T15:07
66
---

0 commit comments

Comments
 (0)