Skip to content

Commit 8cb0874

Browse files
committed
disable logs in prod builds #384
1 parent fa61f67 commit 8cb0874

30 files changed

+50
-56
lines changed

automation/build/esbuild.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ const build = await esbuild.build({
3737
minify: true,
3838
metafile: true,
3939
define: {
40-
MB_GLOBAL_CONFIG_DEV_BUILD: 'false',
40+
MB_DEV_BUILD: 'false',
41+
MB_DEBUG: 'false',
4142
},
4243
plugins: [
4344
esbuildSvelte({

automation/build/esbuild.dev.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ const context = await esbuild.context({
3636
outdir: `exampleVault/.obsidian/plugins/${manifest.id}/`,
3737
outbase: 'packages/obsidian/src',
3838
define: {
39-
MB_GLOBAL_CONFIG_DEV_BUILD: 'true',
39+
MB_DEV_BUILD: 'false',
40+
MB_DEBUG: 'true',
4041
},
4142
plugins: [
4243
copy({

automation/build/esbuild.publish.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ esbuild
4949
minify: true,
5050
outfile: './Publish.js',
5151
define: {
52-
MB_GLOBAL_CONFIG_DEV_BUILD: 'false',
52+
MB_DEV_BUILD: 'false',
53+
MB_DEBUG: 'false',
5354
},
5455
plugins: [
5556
esbuildSvelte({

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ const context = await esbuild
4949
minify: true,
5050
outfile: './Publish.js',
5151
define: {
52-
MB_GLOBAL_CONFIG_DEV_BUILD: 'false',
52+
MB_DEV_BUILD: 'false',
53+
MB_DEBUG: 'true',
5354
},
5455
legalComments: 'none',
5556
plugins: [

packages/core/src/MountableManager.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,27 @@ export class MountableManager {
1010
unloadFile(filePath: string): void {
1111
for (const mountable of this.activeMountables.values()) {
1212
if (mountable.getFilePath() === filePath) {
13-
console.debug(`meta-bind | MountableManager >> unregistered Mountable ${mountable.getUuid()}`);
13+
MB_DEBUG &&
14+
console.debug(`meta-bind | MountableManager >> unregistered Mountable ${mountable.getUuid()}`);
1415
mountable.unmount();
1516
}
1617
}
1718
}
1819

1920
unload(): void {
2021
for (const mountable of this.activeMountables.values()) {
21-
console.debug(`meta-bind | MountableManager >> unregistered Mountable ${mountable.getUuid()}`);
22+
MB_DEBUG && console.debug(`meta-bind | MountableManager >> unregistered Mountable ${mountable.getUuid()}`);
2223
mountable.unmount();
2324
}
2425
}
2526

2627
registerMountable(mountable: FieldMountable): void {
27-
console.debug(`meta-bind | MountableManager >> registered Mountable ${mountable.getUuid()}`);
28+
MB_DEBUG && console.debug(`meta-bind | MountableManager >> registered Mountable ${mountable.getUuid()}`);
2829
this.activeMountables.set(mountable.getUuid(), mountable);
2930
}
3031

3132
unregisterMountable(mountable: FieldMountable): void {
32-
console.debug(`meta-bind | MountableManager >> unregistered Mountable ${mountable.getUuid()}`);
33+
MB_DEBUG && console.debug(`meta-bind | MountableManager >> unregistered Mountable ${mountable.getUuid()}`);
3334
this.activeMountables.delete(mountable.getUuid());
3435
}
3536
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class ButtonGroupMountable extends FieldMountable {
3535
}
3636

3737
protected onMount(targetEl: HTMLElement): void {
38-
console.debug('meta-bind | ButtonGroupMountable >> mount', this.declaration);
38+
MB_DEBUG && console.debug('meta-bind | ButtonGroupMountable >> mount', this.declaration);
3939
super.onMount(targetEl);
4040

4141
DomHelpers.removeAllClasses(targetEl);
@@ -71,7 +71,7 @@ export class ButtonGroupMountable extends FieldMountable {
7171
}
7272

7373
protected onUnmount(targetEl: HTMLElement): void {
74-
console.debug('meta-bind | ButtonGroupMountable >> destroy', this.declaration);
74+
MB_DEBUG && console.debug('meta-bind | ButtonGroupMountable >> destroy', this.declaration);
7575
super.onUnmount(targetEl);
7676

7777
this.buttonField?.unmount();

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class ButtonMountable extends FieldMountable {
3434
}
3535

3636
protected onMount(targetEl: HTMLElement): void {
37-
console.debug('meta-bind | ButtonMountable >> mount', this.declaration.declarationString);
37+
MB_DEBUG && console.debug('meta-bind | ButtonMountable >> mount', this.declaration.declarationString);
3838
super.onMount(targetEl);
3939

4040
DomHelpers.removeAllClasses(targetEl);
@@ -72,7 +72,7 @@ export class ButtonMountable extends FieldMountable {
7272
}
7373

7474
protected onUnmount(targetEl: HTMLElement): void {
75-
console.debug('meta-bind | ButtonMountable >> destroy', this.declaration.declarationString);
75+
MB_DEBUG && console.debug('meta-bind | ButtonMountable >> destroy', this.declaration.declarationString);
7676
super.onUnmount(targetEl);
7777

7878
this.buttonField?.unmount();

packages/core/src/fields/embed/EmbedMountable.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ export class EmbedMountable extends FieldMountable {
9191
}
9292

9393
protected onMount(targetEl: HTMLElement): void {
94-
console.debug('meta-bind | EmbedMountable >> mount', this.content);
94+
MB_DEBUG && console.debug('meta-bind | EmbedMountable >> mount', this.content);
9595
super.onMount(targetEl);
9696

9797
void this.renderContent(targetEl);
9898
}
9999

100100
protected onUnmount(targetEl: HTMLElement): void {
101-
console.debug('meta-bind | EmbedMountable >> unmount', this.content);
101+
MB_DEBUG && console.debug('meta-bind | EmbedMountable >> unmount', this.content);
102102
super.onUnmount(targetEl);
103103

104104
this.markdownUnloadCallback?.();

packages/core/src/fields/excluded/ExcludedMountable.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class ExcludedMountable extends FieldMountable {
88
}
99

1010
protected onMount(targetEl: HTMLElement): void {
11-
console.debug('meta-bind | ExcludedMountable >> mount');
11+
MB_DEBUG && console.debug('meta-bind | ExcludedMountable >> mount');
1212
super.onMount(targetEl);
1313

1414
DomHelpers.empty(targetEl);
@@ -20,7 +20,7 @@ export class ExcludedMountable extends FieldMountable {
2020
}
2121

2222
protected onUnmount(targetEl: HTMLElement): void {
23-
console.debug('meta-bind | ExcludedMountable >> unmount');
23+
MB_DEBUG && console.debug('meta-bind | ExcludedMountable >> unmount');
2424
super.onUnmount(targetEl);
2525

2626
DomHelpers.empty(targetEl);

packages/core/src/fields/inputFields/AbstractInputField.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ export abstract class AbstractInputField<
155155
if (bindTarget) {
156156
this.svelteWrapper.registerListener({
157157
callback: value => {
158-
// console.log('input field component change', value);
159158
this.notifySubscription(this.mapValue(value));
160159
},
161160
});

0 commit comments

Comments
 (0)