folderblog 0.0.1 → 0.0.2
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/README.md +109 -48
- package/dist/chunk-24MKFHML.cjs +143 -0
- package/dist/chunk-3RG5ZIWI.js +8 -0
- package/dist/chunk-4ZJGUMHS.cjs +78 -0
- package/dist/chunk-HMQIQUPB.cjs +387 -0
- package/dist/chunk-IXP35S24.js +1715 -0
- package/dist/chunk-OBGZSXTJ.cjs +10 -0
- package/dist/chunk-PARGDJNY.js +76 -0
- package/dist/chunk-QA4KPPTA.cjs +1787 -0
- package/dist/chunk-XP5J4LFJ.js +127 -0
- package/dist/chunk-ZRUBI3GH.js +370 -0
- package/dist/cli/bin.cjs +25 -0
- package/dist/cli/bin.d.cts +1 -0
- package/dist/cli/bin.d.ts +1 -0
- package/dist/cli/bin.js +23 -0
- package/dist/cli/index.cjs +22 -0
- package/dist/cli/index.d.cts +39 -0
- package/dist/cli/index.d.ts +39 -0
- package/dist/cli/index.js +15 -0
- package/dist/config-DFr-htlO.d.cts +887 -0
- package/dist/config-DFr-htlO.d.ts +887 -0
- package/dist/index.cjs +488 -1
- package/dist/index.d.cts +76 -8
- package/dist/index.d.ts +76 -8
- package/dist/index.js +153 -1
- package/dist/processor/index.cjs +337 -0
- package/dist/processor/index.d.cts +491 -0
- package/dist/processor/index.d.ts +491 -0
- package/dist/processor/index.js +4 -0
- package/dist/processor/plugins.cjs +51 -0
- package/dist/processor/plugins.d.cts +174 -0
- package/dist/processor/plugins.d.ts +174 -0
- package/dist/processor/plugins.js +2 -0
- package/dist/processor/types.cjs +67 -0
- package/dist/processor/types.d.cts +47 -0
- package/dist/processor/types.d.ts +47 -0
- package/dist/processor/types.js +2 -0
- package/dist/server/index.cjs +36 -0
- package/dist/server/index.d.cts +56 -0
- package/dist/server/index.d.ts +56 -0
- package/dist/server/index.js +34 -0
- package/package.json +63 -11
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
4
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
5
|
+
}) : x)(function(x) {
|
|
6
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
7
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
exports.__require = __require;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { processFolder } from './chunk-IXP35S24.js';
|
|
2
|
+
import { resolve } from 'path';
|
|
3
|
+
import { pathToFileURL } from 'url';
|
|
4
|
+
import { existsSync } from 'fs';
|
|
5
|
+
import { execFileSync } from 'child_process';
|
|
6
|
+
|
|
7
|
+
async function loadConfig(configPath) {
|
|
8
|
+
const abs = resolve(configPath);
|
|
9
|
+
try {
|
|
10
|
+
const mod = await import(pathToFileURL(abs).href);
|
|
11
|
+
return mod.default ?? mod;
|
|
12
|
+
} catch {
|
|
13
|
+
}
|
|
14
|
+
if (abs.endsWith(".ts")) {
|
|
15
|
+
try {
|
|
16
|
+
const script = `import{pathToFileURL}from"url";const m=await import(pathToFileURL(${JSON.stringify(abs)}).href);process.stdout.write(JSON.stringify(m.default??m))`;
|
|
17
|
+
const json = execFileSync(
|
|
18
|
+
process.execPath,
|
|
19
|
+
["--experimental-strip-types", "--input-type=module", "-e", script],
|
|
20
|
+
{ encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
21
|
+
);
|
|
22
|
+
return JSON.parse(json);
|
|
23
|
+
} catch {
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
function resolveConfigPath(explicit) {
|
|
29
|
+
if (explicit) return explicit;
|
|
30
|
+
for (const ext of [".js", ".mjs", ".ts"]) {
|
|
31
|
+
const candidate = `./folderblog.config${ext}`;
|
|
32
|
+
if (existsSync(resolve(candidate))) return candidate;
|
|
33
|
+
}
|
|
34
|
+
return "./folderblog.config.js";
|
|
35
|
+
}
|
|
36
|
+
async function build(options = {}) {
|
|
37
|
+
const configPath = resolveConfigPath(options.config);
|
|
38
|
+
let config = await loadConfig(configPath);
|
|
39
|
+
if (!config) {
|
|
40
|
+
config = {
|
|
41
|
+
dir: {
|
|
42
|
+
input: options.input ?? "./src",
|
|
43
|
+
output: options.output ?? "./dist"
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
} else {
|
|
47
|
+
if (options.input || options.output) {
|
|
48
|
+
config = {
|
|
49
|
+
...config,
|
|
50
|
+
dir: {
|
|
51
|
+
...config.dir,
|
|
52
|
+
...options.input ? { input: options.input } : {},
|
|
53
|
+
...options.output ? { output: options.output } : {}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
console.log(`Processing: ${resolve(config.dir.input)}`);
|
|
59
|
+
const result = await processFolder(config);
|
|
60
|
+
const errorCount = result.issues.summary?.errorCount ?? 0;
|
|
61
|
+
const warningCount = result.issues.summary?.warningCount ?? 0;
|
|
62
|
+
console.log(`
|
|
63
|
+
Done.`);
|
|
64
|
+
console.log(` Posts: ${result.posts.length}`);
|
|
65
|
+
console.log(` Media: ${result.media.length}`);
|
|
66
|
+
console.log(` Output: ${resolve(result.outputDir)}`);
|
|
67
|
+
if (errorCount > 0 || warningCount > 0) {
|
|
68
|
+
console.log(` Errors: ${errorCount}`);
|
|
69
|
+
console.log(` Warnings: ${warningCount}`);
|
|
70
|
+
}
|
|
71
|
+
if (errorCount > 0) {
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { build };
|