Skip to content

Commit e1e946a

Browse files
committed
kind of working publish support
1 parent 404c6f6 commit e1e946a

32 files changed

+546
-493
lines changed

esbuild.config.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import process from 'process';
33
import builtins from 'builtin-modules';
44
import esbuildSvelte from 'esbuild-svelte';
55
import sveltePreprocess from 'svelte-preprocess';
6+
import conditionalBuild from 'esbuild-plugin-conditional-build';
67

78
const banner = `/*
89
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
@@ -58,6 +59,7 @@ esbuild
5859
compilerOptions: { css: true },
5960
preprocess: sveltePreprocess(),
6061
}),
62+
conditionalBuild([])
6163
],
6264
})
6365
.catch(() => process.exit(1));

esbuild.dev.config.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import builtins from 'builtin-modules';
44
import copy from 'esbuild-plugin-copy-watch';
55
import esbuildSvelte from 'esbuild-svelte';
66
import sveltePreprocess from 'svelte-preprocess';
7+
import conditionalBuild from 'esbuild-plugin-conditional-build';
78

89
const banner = `/*
910
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
@@ -69,6 +70,7 @@ esbuild
6970
compilerOptions: { css: true },
7071
preprocess: sveltePreprocess(),
7172
}),
73+
conditionalBuild([])
7274
],
7375
})
7476
.catch(() => process.exit(1));

esbuild.publish.config.mjs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import esbuild from 'esbuild';
22
import process from 'process';
33
import builtins from 'builtin-modules';
4-
import copy from 'esbuild-plugin-copy-watch';
54
import esbuildSvelte from 'esbuild-svelte';
65
import sveltePreprocess from 'svelte-preprocess';
76

@@ -18,7 +17,7 @@ esbuild
1817
banner: {
1918
js: banner,
2019
},
21-
entryPoints: ['src/Publish.ts'],
20+
entryPoints: ['src/publish/Publish.ts'],
2221
bundle: true,
2322
external: [
2423
'obsidian',
@@ -53,13 +52,12 @@ esbuild
5352
logLevel: 'info',
5453
sourcemap: prod ? false : 'inline',
5554
treeShaking: true,
56-
outdir: './',
57-
outbase: 'src',
55+
outfile: './Publish.js',
5856
plugins: [
5957
esbuildSvelte({
6058
compilerOptions: { css: true },
6159
preprocess: sveltePreprocess(),
62-
}),
60+
})
6361
],
6462
})
6563
.catch(() => process.exit(1));

package-lock.json

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"@codemirror/language": "https://github.com/lishid/cm-language",
4646
"@opd-libs/opd-metadata-lib": "0.0.4",
4747
"@opd-libs/opd-utils-lib": "0.0.2",
48+
"esbuild-plugin-conditional-build": "^1.0.2",
4849
"mathjs": "^11.8.0"
4950
}
5051
}

src/AbstractPlugin.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/IPlugin.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export interface IPlugin {
2+
getFilePathsByName: (name: string) => string[];
3+
}

src/Publish.ts

Lines changed: 0 additions & 69 deletions
This file was deleted.

src/api/API.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ import { JsViewFieldDeclaration, ViewFieldDeclaration, ViewFieldDeclarationParse
77
import { BindTargetParser } from '../parsers/BindTargetParser';
88
import { ViewFieldMDRC } from '../renderChildren/ViewFieldMDRC';
99
import { JsViewFieldMDRC } from '../renderChildren/JsViewFieldMDRC';
10-
import { AbstractPlugin } from '../AbstractPlugin';
1110
import { ErrorCollection } from '../utils/errors/ErrorCollection';
11+
import MetaBindPlugin from '../main';
1212

1313
export class API {
14-
public plugin: AbstractPlugin;
14+
public plugin: MetaBindPlugin;
1515
public inputFieldParser: InputFieldDeclarationParser;
1616
public viewFieldParser: ViewFieldDeclarationParser;
1717
public bindTargetParser: BindTargetParser;
1818

19-
constructor(plugin: AbstractPlugin) {
19+
constructor(plugin: MetaBindPlugin) {
2020
this.plugin = plugin;
2121

2222
this.inputFieldParser = new InputFieldDeclarationParser();

src/inputFields/DatePicker/DatePickerInputField.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ export class DatePickerInputField extends AbstractInputField {
6666
}
6767

6868
showDatePicker(): void {
69-
if (!(this.renderChild.plugin instanceof MetaBindPlugin)) {
70-
console.warn(new MetaBindArgumentError(ErrorLevel.WARNING, 'can not use input field', `input field only supported in the obsidian app`));
71-
return;
72-
}
7369
this.modal = new DatePickerModal(this.renderChild.plugin.app, this);
7470
this.modal.open();
7571
}

0 commit comments

Comments
 (0)