@lexho111/plainblog 0.6.2 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Blog.js +2 -2
- package/blog_test_empty.db +0 -0
- package/blog_test_load.db +0 -0
- package/debug-loader.js +26 -0
- package/model/DataModel.js +1 -1
- package/model/DatabaseModel.js +1 -1
- package/model/FileAdapter.js +1 -1
- package/model/FileModel.js +2 -2
- package/model/datastructures/BinarySearchTree.js +1 -1
- package/model/datastructures/BinarySearchTreeHashMap.js +1 -1
- package/package.json +3 -3
- package/public/styles.min.css +2 -2
package/Blog.js
CHANGED
|
@@ -6,16 +6,16 @@ import process from "node:process";
|
|
|
6
6
|
import path from "path";
|
|
7
7
|
import { fileURLToPath } from "url";
|
|
8
8
|
import pkg from "./package.json" with { type: "json" };
|
|
9
|
-
import { debuglog as createDebug } from "node:util";
|
|
10
9
|
import Article from "./Article.js";
|
|
11
10
|
import DatabaseModel from "./model/DatabaseModel.js";
|
|
12
11
|
import { fetchData, postData } from "./model/APIModel.js";
|
|
13
|
-
import { formatHTML, header, formatMarkdown, validate } from "./Formatter.js";
|
|
12
|
+
import { formatHTML, header, formatMarkdown, validate } from "./Formatter.js";
|
|
14
13
|
import { compileStyles, mergeStyles } from "./build-styles.js";
|
|
15
14
|
import { compileScripts } from "./build-scripts.js";
|
|
16
15
|
import FileAdapter from "./model/FileAdapter.js";
|
|
17
16
|
import DataModel from "./model/DataModel.js";
|
|
18
17
|
import { BinarySearchTreeHashMap } from "./model/datastructures/BinarySearchTreeHashMap.js";
|
|
18
|
+
import createDebug from "./debug-loader.js";
|
|
19
19
|
|
|
20
20
|
// Initialize the debugger with a specific namespace
|
|
21
21
|
const debug = createDebug("plainblog:Blog");
|
package/blog_test_empty.db
CHANGED
|
Binary file
|
package/blog_test_load.db
CHANGED
|
Binary file
|
package/debug-loader.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { debuglog } from "node:util";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
|
|
4
|
+
const require = createRequire(import.meta.url);
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Tries to load the 'debug' package synchronously, falling back to node:util.debuglog if not found.
|
|
8
|
+
* @param {string} namespace - The debug namespace (e.g., 'app:module').
|
|
9
|
+
* @returns {Function} - The debug function.
|
|
10
|
+
*/
|
|
11
|
+
export default function createDebug(namespace) {
|
|
12
|
+
try {
|
|
13
|
+
// Attempt to load the external package synchronously
|
|
14
|
+
const debugFactory = require("debug");
|
|
15
|
+
return debugFactory(namespace);
|
|
16
|
+
} catch (err) {
|
|
17
|
+
if (
|
|
18
|
+
err.code === "ERR_MODULE_NOT_FOUND" ||
|
|
19
|
+
err.code === "MODULE_NOT_FOUND"
|
|
20
|
+
) {
|
|
21
|
+
// Fallback to built-in node:util
|
|
22
|
+
return debuglog(namespace);
|
|
23
|
+
}
|
|
24
|
+
throw err; // Re-throw if it's a different error
|
|
25
|
+
}
|
|
26
|
+
}
|
package/model/DataModel.js
CHANGED
package/model/DatabaseModel.js
CHANGED
package/model/FileAdapter.js
CHANGED
package/model/FileModel.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { promises as promise } from "fs";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { appendFileSync, readFileSync } from "node:fs";
|
|
3
|
+
import createDebug from "../debug-loader.js";
|
|
4
4
|
import Article from "../Article.js";
|
|
5
5
|
|
|
6
6
|
const debug = createDebug("plainblog:FileModel");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lexho111/plainblog",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "A tool for creating and serving a minimalist, single-page blog.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"@types/node": "^25.0.3",
|
|
27
27
|
"autoprefixer": "^10.4.23",
|
|
28
28
|
"cssnano": "^7.1.2",
|
|
29
|
+
"debug": "^4.4.3",
|
|
29
30
|
"eslint": "^9.39.2",
|
|
30
31
|
"eslint-plugin-jest": "^28.6.0",
|
|
31
32
|
"globals": "^17.0.0",
|
|
@@ -38,6 +39,5 @@
|
|
|
38
39
|
"typescript": "^5.9.3",
|
|
39
40
|
"uglify-js": "^3.19.3",
|
|
40
41
|
"w3c-css-validator": "^1.4.1"
|
|
41
|
-
}
|
|
42
|
-
"dependencies": {}
|
|
42
|
+
}
|
|
43
43
|
}
|
package/public/styles.min.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
body{font-family:Arial
|
|
2
|
-
/* source-hash:
|
|
1
|
+
body{font-family:Arial;font-size:1.2em;margin:0}nav{margin-top:10px}.box,h1,nav{margin-left:10px}.grid{border:0 solid #000;display:grid;gap:.25rem;grid-template-columns:1fr}.grid article{border:0 solid #ccc;border-radius:4px;min-width:0;overflow-wrap:break-word;padding:.25rem}.grid article h2{color:#353535;margin-bottom:5px}.grid article .datetime{color:#757575;margin:0}.grid article p{margin-bottom:0;margin-top:10px}article a,article a:visited,h1{color:#696969}nav a{color:#3b40c1;font-size:20px;text-decoration:underline}nav a:visited{color:#3b40c1;text-decoration-color:#3b40c1}#wrapper{max-width:500px;width:100%}.hide-image{display:none}@media screen and (max-width:1000px){*{font-size:4vw}#wrapper{box-sizing:border-box;max-width:100%;padding:0 10px;width:100%}}h2{margin-top:0}.buttons,h2{border:0 solid #000}.buttons{height:25px;margin-bottom:0;width:100%}.button{border:1px solid #000;cursor:pointer;float:left;height:19px;padding:2px;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100px}.button:focus{outline:2px solid orange}.edit{background-color:blue}.delete{background-color:red}
|
|
2
|
+
/* source-hash: 7a6ecb305ffe4d3fcc2e1cd1647043ccfc7088eda42b61e0d6f9471a334cd0f6 */
|