Skip to content

Commit 991e97c

Browse files
committed
initial commit
0 parents  commit 991e97c

22 files changed

Lines changed: 4917 additions & 0 deletions

.config/rollup.config.mjs

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import typescript from "@rollup/plugin-typescript";
2+
import { nodeResolve } from "@rollup/plugin-node-resolve";
3+
import commonjs from "@rollup/plugin-commonjs";
4+
import terser from "@rollup/plugin-terser";
5+
import dts from "rollup-plugin-dts";
6+
7+
const isProd = ( process.env.BUILD === "production" );
8+
9+
const banner =
10+
`/*
11+
* THIS IS A GENERATED/BUNDLED FILE BY ROLLUP
12+
* If you want to view the source, visit the plugins github repository
13+
*/
14+
`;
15+
16+
export default [
17+
{
18+
input: "src/lib/index.ts",
19+
output: {
20+
file: "index.js",
21+
format: "es",
22+
sourcemap: "inline",
23+
sourcemapExcludeSources: isProd,
24+
banner,
25+
},
26+
external: [ "obsidian" ],
27+
plugins: [
28+
typescript({
29+
tsconfig: ".config/tsconfig.build.json",
30+
declaration: false,
31+
declarationMap: false,
32+
outDir: undefined // remove conflicting output dir/file
33+
}),
34+
nodeResolve({browser: true}),
35+
commonjs(),
36+
// Remove all remaining comments
37+
isProd && terser({
38+
compress: false, // no code obfuscation (compression)
39+
mangle: false, // no code obfuscation (mangling)
40+
format: {
41+
comments: false, // remove comments
42+
beautify: true // sorgt für ordentlich formatierten, mehrzeiligen Code
43+
}
44+
})
45+
]
46+
},
47+
{
48+
input: "src/lib/index.ts",
49+
output: {
50+
file: "index.d.ts",
51+
format: "es"
52+
},
53+
plugins: [dts()],
54+
external: ["obsidian"]
55+
}
56+
];

.config/tsconfig.build.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "..",
5+
"declaration": true,
6+
"declarationMap": true,
7+
"emitDeclarationOnly": true,
8+
"stripInternal": true,
9+
"rootDir": "../src/lib",
10+
"types": [
11+
"node",
12+
"obsidian"
13+
]
14+
},
15+
"include": [ "../src/lib/index.ts"],
16+
"exclude": [ "../src/test/**" ]
17+
}

.config/tsconfig.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": "../",
4+
"inlineSourceMap": true,
5+
"inlineSources": true,
6+
"module": "ESNext",
7+
"target": "ES2022",
8+
"isolatedModules": true,
9+
"strict": true,
10+
"moduleResolution": "node",
11+
"resolveJsonModule": true,
12+
"allowSyntheticDefaultImports": true,
13+
"rootDir": "../src",
14+
"types": [
15+
"node",
16+
"obsidian",
17+
"vitest/globals"
18+
],
19+
"lib": [
20+
"DOM",
21+
"ES2022"
22+
]
23+
},
24+
"include": [
25+
"../src/lib/**/*.ts",
26+
"../src/test/**/*.ts"
27+
]
28+
}

.config/vitest.config.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import path from "path";
2+
import { defineConfig } from "vitest/config";
3+
4+
const projectRoot = path.resolve(__dirname, "..");
5+
6+
export default defineConfig({
7+
test: {
8+
environment: "jsdom",
9+
globals: true,
10+
11+
// Projektroot eine Ebene über .config
12+
root: projectRoot,
13+
14+
sequence: {
15+
shuffle: false, // keine Zufallsreihenfolge
16+
concurrent: false, // Tests NICHT parallel, sondern nacheinander
17+
},
18+
19+
// nur Tests innerhalb von src/test/
20+
include: ["src/test/00.00.sequence.of.test.ts"],
21+
coverage: {
22+
provider: "v8",
23+
reporter: ["text", "lcov"], // optional, wie du willst
24+
exclude: [
25+
"**/test/**", // alles im test-Ordner
26+
"**/*.test.ts", // einzelne Testdateien
27+
"**/*.spec.ts"
28+
]
29+
}
30+
},
31+
resolve: {
32+
alias: {
33+
obsidian: path.resolve(projectRoot, "src/test/__mocks__/obsidian.ts")
34+
},
35+
},
36+
});

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# vscode
2+
# .vscode
3+
4+
# Intellij
5+
*.iml
6+
.idea
7+
8+
# npm
9+
node_modules
10+
11+
# Don't include the compiled main.js file in the repo.
12+
# They should be uploaded to GitHub releases instead.
13+
main.js
14+
15+
# Exclude sourcemaps
16+
*.map
17+
18+
# Exclude macOS Finder (System Explorer) View States
19+
.DS_Store
20+
21+
# Exclude coverage. Unittests not yet ready.
22+
coverage
23+
24+
# Built files
25+
index.js
26+
index.d.ts
27+
index.d.ts.map
28+
log.d.ts
29+
log.d.ts.map

CHANGELOG.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[BOTTOM](#100---2026-01-01) [LICENSE](LICENSE) [ROADMAP](ROADMAP.md) [README](README.md)
2+
3+
# Changelog
4+
5+
All notable changes to this project will be documented in this file.
6+
7+
## [Unreleased]
8+
9+
### Added
10+
11+
- No additions yet
12+
13+
### Changed
14+
15+
- No changes yet
16+
17+
### Fixed
18+
19+
- No fixes yet
20+
21+
## [1.0.0] - 2026-01-01
22+
23+
- Initial version
24+
25+
### Features
26+
27+
- Centralized Log class for Obsidian plugins
28+
- Configurable log levels (none, error, warn, info, log, debug)
29+
- Automatic plugin name prefix for all console output
30+
- Unified handling of console logging and Obsidian Notice messages
31+
- Consistent mapping between notice levels and log levels
32+
- Error-aware logging with automatic error formatting
33+
- Typed public API with exported log-related types
34+
- Zero runtime dependencies, fully bundle-friendly
35+
- Designed for Rollup-based integration into Obsidian plugins
36+
- Comprehensive unit test coverage for all public behavior
37+
38+
[TOP](#changelog) [LICENSE](LICENSE) [ROADMAP](ROADMAP.md) [README](README.md)

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Dirk Brenckmann, db-developer
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)