Skip to content

Commit d13292e

Browse files
committed
first working version of the new parser
1 parent 7095c25 commit d13292e

File tree

11 files changed

+1988
-324
lines changed

11 files changed

+1988
-324
lines changed

esbuild.dev.config.mjs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,13 @@ 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';
87

98
const banner = `/*
109
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
1110
if you want to view the source, please visit the github repository of this plugin
1211
*/
1312
`;
1413

15-
const prod = process.argv[2] === 'production';
16-
1714
esbuild
1815
.build({
1916
banner: {
@@ -48,10 +45,10 @@ esbuild
4845
...builtins,
4946
],
5047
format: 'cjs',
51-
watch: !prod,
48+
watch: true,
5249
target: 'es2016',
5350
logLevel: 'info',
54-
sourcemap: prod ? false : 'inline',
51+
sourcemap: 'inline',
5552
treeShaking: true,
5653
outdir: 'exampleVault/.obsidian/plugins/obsidian-meta-bind-plugin/',
5754
outbase: 'src',
@@ -70,7 +67,6 @@ esbuild
7067
compilerOptions: { css: true },
7168
preprocess: sveltePreprocess(),
7269
}),
73-
conditionalBuild([]),
7470
],
7571
})
7672
.catch(() => process.exit(1));

exampleVault/Input Fields/Select and Multi Select.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ select: 2
33
multiSelect:
44
- option 1
55
- option 3
6-
select2: null
6+
select2: false
77
---
88

99
### Select

exampleVault/Test.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
frequency: "[[high]]"
33
toggle: false
4-
needs: Text
4+
needs: Meta Bind JS
55
date: Saturday, July 8th 2023
66
text: asdasddas
77
---

src/api/API.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,20 @@ import { ViewFieldMDRC } from '../renderChildren/ViewFieldMDRC';
99
import { JsViewFieldMDRC } from '../renderChildren/JsViewFieldMDRC';
1010
import { ErrorCollection } from '../utils/errors/ErrorCollection';
1111
import MetaBindPlugin from '../main';
12+
import { DeclarationParser, NewInputFieldDeclarationParser } from '../parsers/newInputFieldParser/InputFieldParser';
1213

1314
export class API {
1415
public plugin: MetaBindPlugin;
1516
public inputFieldParser: InputFieldDeclarationParser;
17+
public newInputFieldParser: NewInputFieldDeclarationParser;
1618
public viewFieldParser: ViewFieldDeclarationParser;
1719
public bindTargetParser: BindTargetParser;
1820

1921
constructor(plugin: MetaBindPlugin) {
2022
this.plugin = plugin;
2123

2224
this.inputFieldParser = new InputFieldDeclarationParser();
25+
this.newInputFieldParser = new NewInputFieldDeclarationParser(this.plugin);
2326
this.viewFieldParser = new ViewFieldDeclarationParser();
2427
this.bindTargetParser = new BindTargetParser(this.plugin);
2528
}
@@ -43,7 +46,7 @@ export class API {
4346
}
4447

4548
public createInputFieldFromString(fullDeclaration: string, renderType: RenderChildType, filePath: string, container: HTMLElement): InputFieldMDRC {
46-
const declaration: InputFieldDeclaration = this.inputFieldParser.parseString(fullDeclaration);
49+
const declaration: InputFieldDeclaration = this.newInputFieldParser.parseString(fullDeclaration, filePath);
4750
return new InputFieldMDRC(container, renderType, declaration, this.plugin, filePath, self.crypto.randomUUID());
4851
}
4952

0 commit comments

Comments
 (0)