Skip to content

Commit 3fe2220

Browse files
committed
improve load times and another attempt to fix the buton builder
1 parent d00ab6f commit 3fe2220

File tree

9 files changed

+25
-23
lines changed

9 files changed

+25
-23
lines changed

automation/build/esbuild.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ const build = await esbuild.build({
4343
plugins: [
4444
esbuildSvelte({
4545
compilerOptions: { css: 'injected', dev: false },
46-
preprocess: sveltePreprocess(),
4746
filterWarnings: warning => {
4847
// we don't want warnings from node modules that we can do nothing about
4948
return !warning.filename?.includes('node_modules');

automation/build/esbuild.dev.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ const context = await esbuild.context({
5454
}),
5555
esbuildSvelte({
5656
compilerOptions: { css: 'injected', dev: true },
57-
preprocess: sveltePreprocess(),
5857
filterWarnings: warning => {
5958
// we don't want warnings from node modules that we can do nothing about
6059
return !(

automation/build/esbuild.publish.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ esbuild
5555
plugins: [
5656
esbuildSvelte({
5757
compilerOptions: { css: 'injected' },
58-
preprocess: sveltePreprocess(),
5958
filterWarnings: warning => {
6059
// we don't want warnings from node modules that we can do nothing about
6160
return !warning.filename?.includes('node_modules');

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ const context = await esbuild
5656
plugins: [
5757
esbuildSvelte({
5858
compilerOptions: { css: 'injected' },
59-
preprocess: sveltePreprocess(),
6059
filterWarnings: warning => {
6160
// we don't want warnings from node modules that we can do nothing about
6261
return !warning.filename?.includes('node_modules');

bun.lockb

704 Bytes
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"itertools-ts": "^1.27.1",
6262
"mathjs": "^13.2.0",
6363
"moment": "^2.30.1",
64-
"svelte": "5.1.1",
64+
"svelte": "5.1.4",
6565
"zod": "^3.23.8",
6666
"zod-validation-error": "^3.4.0"
6767
},

packages/core/src/fields/button/ButtonActionRunner.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,15 @@ export class ButtonActionRunner {
9292
*/
9393
createDefaultAction(type: ButtonActionType): ButtonAction {
9494
if (type === ButtonActionType.COMMAND) {
95-
return { type: ButtonActionType.COMMAND, command: '' } satisfies CommandButtonAction;
95+
return { type: ButtonActionType.COMMAND, command: '' } satisfies Required<CommandButtonAction>;
9696
} else if (type === ButtonActionType.OPEN) {
97-
return { type: ButtonActionType.OPEN, link: '' } satisfies OpenButtonAction;
97+
return { type: ButtonActionType.OPEN, link: '', newTab: true } satisfies Required<OpenButtonAction>;
9898
} else if (type === ButtonActionType.JS) {
99-
return { type: ButtonActionType.JS, file: '', args: {} } satisfies JSButtonAction;
99+
return { type: ButtonActionType.JS, file: '', args: {} } satisfies Required<JSButtonAction>;
100100
} else if (type === ButtonActionType.INPUT) {
101-
return { type: ButtonActionType.INPUT, str: '' } satisfies InputButtonAction;
101+
return { type: ButtonActionType.INPUT, str: '' } satisfies Required<InputButtonAction>;
102102
} else if (type === ButtonActionType.SLEEP) {
103-
return { type: ButtonActionType.SLEEP, ms: 0 } satisfies SleepButtonAction;
103+
return { type: ButtonActionType.SLEEP, ms: 0 } satisfies Required<SleepButtonAction>;
104104
} else if (type === ButtonActionType.TEMPLATER_CREATE_NOTE) {
105105
return {
106106
type: ButtonActionType.TEMPLATER_CREATE_NOTE,
@@ -109,51 +109,55 @@ export class ButtonActionRunner {
109109
fileName: '',
110110
openNote: true,
111111
openIfAlreadyExists: false,
112-
} satisfies TemplaterCreateNoteButtonAction;
112+
} satisfies Required<TemplaterCreateNoteButtonAction>;
113113
} else if (type === ButtonActionType.UPDATE_METADATA) {
114114
return {
115115
type: ButtonActionType.UPDATE_METADATA,
116116
bindTarget: '',
117117
evaluate: false,
118118
value: '',
119-
} satisfies UpdateMetadataButtonAction;
119+
} satisfies Required<UpdateMetadataButtonAction>;
120120
} else if (type === ButtonActionType.CREATE_NOTE) {
121121
return {
122122
type: ButtonActionType.CREATE_NOTE,
123123
folderPath: '/',
124124
fileName: 'Untitled',
125125
openNote: true,
126126
openIfAlreadyExists: false,
127-
} satisfies CreateNoteButtonAction;
127+
} satisfies Required<CreateNoteButtonAction>;
128128
} else if (type === ButtonActionType.REPLACE_IN_NOTE) {
129129
return {
130130
type: ButtonActionType.REPLACE_IN_NOTE,
131131
fromLine: 0,
132132
toLine: 0,
133133
replacement: 'Replacement text',
134-
} satisfies ReplaceInNoteButtonAction;
134+
templater: false,
135+
} satisfies Required<ReplaceInNoteButtonAction>;
135136
} else if (type === ButtonActionType.REPLACE_SELF) {
136137
return {
137138
type: ButtonActionType.REPLACE_SELF,
138139
replacement: 'Replacement text',
139-
} satisfies ReplaceSelfButtonAction;
140+
templater: false,
141+
} satisfies Required<ReplaceSelfButtonAction>;
140142
} else if (type === ButtonActionType.REGEXP_REPLACE_IN_NOTE) {
141143
return {
142144
type: ButtonActionType.REGEXP_REPLACE_IN_NOTE,
143145
regexp: '([A-Z])\\w+',
144146
replacement: 'Replacement text',
145-
} satisfies RegexpReplaceInNoteButtonAction;
147+
regexpFlags: 'g',
148+
} satisfies Required<RegexpReplaceInNoteButtonAction>;
146149
} else if (type === ButtonActionType.INSERT_INTO_NOTE) {
147150
return {
148151
type: ButtonActionType.INSERT_INTO_NOTE,
149152
line: 0,
150153
value: 'Some text',
151-
} satisfies InsertIntoNoteButtonAction;
154+
templater: false,
155+
} satisfies Required<InsertIntoNoteButtonAction>;
152156
} else if (type === ButtonActionType.INLINE_JS) {
153157
return {
154158
type: ButtonActionType.INLINE_JS,
155159
code: 'console.log("Hello world")',
156-
} satisfies InlineJsButtonAction;
160+
} satisfies Required<InlineJsButtonAction>;
157161
}
158162

159163
expectType<never>(type);

packages/obsidian/src/main.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { MarkdownPostProcessorContext, WorkspaceLeaf } from 'obsidian';
2-
import { loadPrism, Plugin, stringifyYaml } from 'obsidian';
2+
import { Plugin, stringifyYaml } from 'obsidian';
33
import { RenderChildType } from 'packages/core/src/config/APIConfigs';
44
import { EMBED_MAX_DEPTH } from 'packages/core/src/config/FieldConfigs';
55
import type { IPlugin } from 'packages/core/src/IPlugin';
@@ -53,7 +53,8 @@ export default class MetaBindPlugin extends Plugin implements IPlugin {
5353
dependencyManager: DependencyManager;
5454

5555
async onload(): Promise<void> {
56-
console.log(`meta-bind | Main >> load`);
56+
console.log(`meta-bind | Main >> loading`);
57+
console.time('meta-bind | Main >> load-time');
5758

5859
this.build = this.determineBuild();
5960

@@ -112,8 +113,10 @@ export default class MetaBindPlugin extends Plugin implements IPlugin {
112113
);
113114
}
114115

116+
console.timeEnd('meta-bind | Main >> load-time');
117+
// TODO: not sure if this is still needed, but it adds 100+ms to the load time, so I disabled it for now
115118
// we need to wait for prism to load first, otherwise prism will cause problems by highlighting things that it shouldn't
116-
await loadPrism();
119+
// await loadPrism();
117120
}
118121

119122
onunload(): void {
@@ -339,7 +342,7 @@ export default class MetaBindPlugin extends Plugin implements IPlugin {
339342
}
340343

341344
async loadSettings(): Promise<void> {
342-
console.log(`meta-bind | Main >> settings load`);
345+
console.log(`meta-bind | Main >> loading settings`);
343346

344347
const loadedSettings = ((await this.loadData()) ?? {}) as MetaBindPluginSettings;
345348

tests/__preload__/svelteLoader.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ plugin(
66
// @ts-ignore
77
esbuildSvelte({
88
compilerOptions: { css: 'injected', dev: true, generate: 'client', runes: true },
9-
preprocess: sveltePreprocess(),
109
filterWarnings: warning => {
1110
// we don't want warnings from node modules that we can do nothing about
1211
return !warning.filename?.includes('node_modules');

0 commit comments

Comments
 (0)