folderblog 0.0.1 → 0.0.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/README.md +109 -48
- package/dist/chunk-2TZSVPNP.cjs +148 -0
- package/dist/chunk-3RG5ZIWI.js +8 -0
- package/dist/chunk-6TFXNIO6.cjs +495 -0
- package/dist/chunk-B43UAOPC.js +475 -0
- package/dist/chunk-D26H5722.js +132 -0
- package/dist/chunk-E7PYGJA7.cjs +39 -0
- package/dist/chunk-J3Y3HEBF.cjs +1858 -0
- package/dist/chunk-K76XLEC7.js +76 -0
- package/dist/chunk-LPPBVXJ7.js +1786 -0
- package/dist/chunk-OBGZSXTJ.cjs +10 -0
- package/dist/chunk-Q6EXKX6K.js +17 -0
- package/dist/chunk-Q6EYTOTM.cjs +78 -0
- package/dist/chunk-UCXXH2MP.cjs +20 -0
- package/dist/chunk-XQD3UUL5.js +34 -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-ADPY6IQS.d.cts +473 -0
- package/dist/config-Dctsdeo6.d.ts +473 -0
- package/dist/index.cjs +458 -1
- package/dist/index.d.cts +78 -9
- package/dist/index.d.ts +78 -9
- package/dist/index.js +100 -1
- package/dist/local/index.cjs +785 -0
- package/dist/local/index.d.cts +268 -0
- package/dist/local/index.d.ts +268 -0
- package/dist/local/index.js +772 -0
- package/dist/output-0P0br3Jc.d.cts +452 -0
- package/dist/output-0P0br3Jc.d.ts +452 -0
- package/dist/plugins/embed-cloudflare-ai.cjs +166 -0
- package/dist/plugins/embed-cloudflare-ai.d.cts +73 -0
- package/dist/plugins/embed-cloudflare-ai.d.ts +73 -0
- package/dist/plugins/embed-cloudflare-ai.js +156 -0
- package/dist/plugins/embed-transformers.cjs +121 -0
- package/dist/plugins/embed-transformers.d.cts +55 -0
- package/dist/plugins/embed-transformers.d.ts +55 -0
- package/dist/plugins/embed-transformers.js +113 -0
- package/dist/plugins/similarity.cjs +19 -0
- package/dist/plugins/similarity.d.cts +41 -0
- package/dist/plugins/similarity.d.ts +41 -0
- package/dist/plugins/similarity.js +2 -0
- package/dist/processor/index.cjs +349 -0
- package/dist/processor/index.d.cts +495 -0
- package/dist/processor/index.d.ts +495 -0
- package/dist/processor/index.js +4 -0
- package/dist/processor/plugins.cjs +63 -0
- package/dist/processor/plugins.d.cts +176 -0
- package/dist/processor/plugins.d.ts +176 -0
- package/dist/processor/plugins.js +2 -0
- package/dist/processor/types.cjs +67 -0
- package/dist/processor/types.d.cts +48 -0
- package/dist/processor/types.d.ts +48 -0
- package/dist/processor/types.js +2 -0
- package/dist/seo/index.cjs +289 -0
- package/dist/seo/index.d.cts +95 -0
- package/dist/seo/index.d.ts +95 -0
- package/dist/seo/index.js +274 -0
- package/dist/server/index.cjs +33 -0
- package/dist/server/index.d.cts +56 -0
- package/dist/server/index.d.ts +56 -0
- package/dist/server/index.js +31 -0
- package/package.json +98 -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,17 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from 'fs';
|
|
2
|
+
|
|
3
|
+
// src/utils.ts
|
|
4
|
+
function loadJsonFile(path, fallback) {
|
|
5
|
+
if (!existsSync(path)) return fallback;
|
|
6
|
+
return JSON.parse(readFileSync(path, "utf-8"));
|
|
7
|
+
}
|
|
8
|
+
function normalizeBaseUrl(domain) {
|
|
9
|
+
let url = domain.trim();
|
|
10
|
+
if (url.endsWith("/")) url = url.slice(0, -1);
|
|
11
|
+
if (!url.startsWith("http://") && !url.startsWith("https://")) {
|
|
12
|
+
url = `https://${url}`;
|
|
13
|
+
}
|
|
14
|
+
return url;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { loadJsonFile, normalizeBaseUrl };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkJ3Y3HEBF_cjs = require('./chunk-J3Y3HEBF.cjs');
|
|
4
|
+
var path = require('path');
|
|
5
|
+
var url = require('url');
|
|
6
|
+
var fs = require('fs');
|
|
7
|
+
var child_process = require('child_process');
|
|
8
|
+
|
|
9
|
+
async function loadConfig(configPath) {
|
|
10
|
+
const abs = path.resolve(configPath);
|
|
11
|
+
try {
|
|
12
|
+
const mod = await import(url.pathToFileURL(abs).href);
|
|
13
|
+
return mod.default ?? mod;
|
|
14
|
+
} catch {
|
|
15
|
+
}
|
|
16
|
+
if (abs.endsWith(".ts")) {
|
|
17
|
+
try {
|
|
18
|
+
const script = `import{pathToFileURL}from"url";const m=await import(pathToFileURL(${JSON.stringify(abs)}).href);process.stdout.write(JSON.stringify(m.default??m))`;
|
|
19
|
+
const json = child_process.execFileSync(
|
|
20
|
+
process.execPath,
|
|
21
|
+
["--experimental-strip-types", "--input-type=module", "-e", script],
|
|
22
|
+
{ encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
|
|
23
|
+
);
|
|
24
|
+
return JSON.parse(json);
|
|
25
|
+
} catch {
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
function resolveConfigPath(explicit) {
|
|
31
|
+
if (explicit) return explicit;
|
|
32
|
+
for (const ext of [".js", ".mjs", ".ts"]) {
|
|
33
|
+
const candidate = `./folderblog.config${ext}`;
|
|
34
|
+
if (fs.existsSync(path.resolve(candidate))) return candidate;
|
|
35
|
+
}
|
|
36
|
+
return "./folderblog.config.js";
|
|
37
|
+
}
|
|
38
|
+
async function build(options = {}) {
|
|
39
|
+
const configPath = resolveConfigPath(options.config);
|
|
40
|
+
let config = await loadConfig(configPath);
|
|
41
|
+
if (!config) {
|
|
42
|
+
config = {
|
|
43
|
+
dir: {
|
|
44
|
+
input: options.input ?? "./src",
|
|
45
|
+
output: options.output ?? "./dist"
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
} else {
|
|
49
|
+
if (options.input || options.output) {
|
|
50
|
+
config = {
|
|
51
|
+
...config,
|
|
52
|
+
dir: {
|
|
53
|
+
...config.dir,
|
|
54
|
+
...options.input ? { input: options.input } : {},
|
|
55
|
+
...options.output ? { output: options.output } : {}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
console.log(`Processing: ${path.resolve(config.dir.input)}`);
|
|
61
|
+
const result = await chunkJ3Y3HEBF_cjs.processFolder(config);
|
|
62
|
+
const errorCount = result.issues.summary?.errorCount ?? 0;
|
|
63
|
+
const warningCount = result.issues.summary?.warningCount ?? 0;
|
|
64
|
+
console.log(`
|
|
65
|
+
Done.`);
|
|
66
|
+
console.log(` Posts: ${result.posts.length}`);
|
|
67
|
+
console.log(` Media: ${result.media.length}`);
|
|
68
|
+
console.log(` Output: ${path.resolve(result.outputDir)}`);
|
|
69
|
+
if (errorCount > 0 || warningCount > 0) {
|
|
70
|
+
console.log(` Errors: ${errorCount}`);
|
|
71
|
+
console.log(` Warnings: ${warningCount}`);
|
|
72
|
+
}
|
|
73
|
+
if (errorCount > 0) {
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
exports.build = build;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var fs = require('fs');
|
|
4
|
+
|
|
5
|
+
// src/utils.ts
|
|
6
|
+
function loadJsonFile(path, fallback) {
|
|
7
|
+
if (!fs.existsSync(path)) return fallback;
|
|
8
|
+
return JSON.parse(fs.readFileSync(path, "utf-8"));
|
|
9
|
+
}
|
|
10
|
+
function normalizeBaseUrl(domain) {
|
|
11
|
+
let url = domain.trim();
|
|
12
|
+
if (url.endsWith("/")) url = url.slice(0, -1);
|
|
13
|
+
if (!url.startsWith("http://") && !url.startsWith("https://")) {
|
|
14
|
+
url = `https://${url}`;
|
|
15
|
+
}
|
|
16
|
+
return url;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
exports.loadJsonFile = loadJsonFile;
|
|
20
|
+
exports.normalizeBaseUrl = normalizeBaseUrl;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/errors.ts
|
|
2
|
+
var FolderBlogError = class extends Error {
|
|
3
|
+
/** HTTP status code if applicable */
|
|
4
|
+
status;
|
|
5
|
+
/** The URL that was requested */
|
|
6
|
+
url;
|
|
7
|
+
constructor(message, options) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = "FolderBlogError";
|
|
10
|
+
this.status = options?.status;
|
|
11
|
+
this.url = options?.url;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
var NotFoundError = class extends FolderBlogError {
|
|
15
|
+
constructor(resource, identifier, url) {
|
|
16
|
+
super(`${resource} not found: ${identifier}`, { status: 404, url });
|
|
17
|
+
this.name = "NotFoundError";
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
var ApiError = class extends FolderBlogError {
|
|
21
|
+
constructor(message, status, url) {
|
|
22
|
+
super(message, { status, url });
|
|
23
|
+
this.name = "ApiError";
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
var NetworkError = class extends FolderBlogError {
|
|
27
|
+
constructor(message, cause) {
|
|
28
|
+
super(message);
|
|
29
|
+
this.name = "NetworkError";
|
|
30
|
+
if (cause) this.cause = cause;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { ApiError, FolderBlogError, NetworkError, NotFoundError };
|
package/dist/cli/bin.cjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var chunkQ6EYTOTM_cjs = require('../chunk-Q6EYTOTM.cjs');
|
|
5
|
+
require('../chunk-J3Y3HEBF.cjs');
|
|
6
|
+
require('../chunk-2TZSVPNP.cjs');
|
|
7
|
+
require('../chunk-6TFXNIO6.cjs');
|
|
8
|
+
require('../chunk-OBGZSXTJ.cjs');
|
|
9
|
+
var commander = require('commander');
|
|
10
|
+
|
|
11
|
+
var program = new commander.Command();
|
|
12
|
+
program.name("folderblog").description("Folderblog CLI \u2014 process markdown content").version("0.0.1");
|
|
13
|
+
program.command("build").description("Process markdown files into JSON output").option("-i, --input <dir>", "Input directory").option("-o, --output <dir>", "Output directory").option("-c, --config <path>", "Config file path (auto-detects folderblog.config.{js,mjs,ts})").action(async (opts) => {
|
|
14
|
+
try {
|
|
15
|
+
await chunkQ6EYTOTM_cjs.build({
|
|
16
|
+
input: opts.input,
|
|
17
|
+
output: opts.output,
|
|
18
|
+
config: opts.config
|
|
19
|
+
});
|
|
20
|
+
} catch (err) {
|
|
21
|
+
console.error("Build failed:", err instanceof Error ? err.message : err);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
program.parse();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/cli/bin.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { build } from '../chunk-K76XLEC7.js';
|
|
3
|
+
import '../chunk-LPPBVXJ7.js';
|
|
4
|
+
import '../chunk-D26H5722.js';
|
|
5
|
+
import '../chunk-B43UAOPC.js';
|
|
6
|
+
import '../chunk-3RG5ZIWI.js';
|
|
7
|
+
import { Command } from 'commander';
|
|
8
|
+
|
|
9
|
+
var program = new Command();
|
|
10
|
+
program.name("folderblog").description("Folderblog CLI \u2014 process markdown content").version("0.0.1");
|
|
11
|
+
program.command("build").description("Process markdown files into JSON output").option("-i, --input <dir>", "Input directory").option("-o, --output <dir>", "Output directory").option("-c, --config <path>", "Config file path (auto-detects folderblog.config.{js,mjs,ts})").action(async (opts) => {
|
|
12
|
+
try {
|
|
13
|
+
await build({
|
|
14
|
+
input: opts.input,
|
|
15
|
+
output: opts.output,
|
|
16
|
+
config: opts.config
|
|
17
|
+
});
|
|
18
|
+
} catch (err) {
|
|
19
|
+
console.error("Build failed:", err instanceof Error ? err.message : err);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
program.parse();
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkQ6EYTOTM_cjs = require('../chunk-Q6EYTOTM.cjs');
|
|
4
|
+
require('../chunk-J3Y3HEBF.cjs');
|
|
5
|
+
require('../chunk-2TZSVPNP.cjs');
|
|
6
|
+
require('../chunk-6TFXNIO6.cjs');
|
|
7
|
+
require('../chunk-OBGZSXTJ.cjs');
|
|
8
|
+
|
|
9
|
+
// src/cli/index.ts
|
|
10
|
+
async function init(_options = {}) {
|
|
11
|
+
throw new Error("folderblog CLI is not yet implemented. Coming soon.");
|
|
12
|
+
}
|
|
13
|
+
async function importWp(_options) {
|
|
14
|
+
throw new Error("folderblog import-wp is not yet implemented. Coming soon.");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
Object.defineProperty(exports, "build", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return chunkQ6EYTOTM_cjs.build; }
|
|
20
|
+
});
|
|
21
|
+
exports.importWp = importWp;
|
|
22
|
+
exports.init = init;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
interface BuildOptions {
|
|
2
|
+
input?: string;
|
|
3
|
+
output?: string;
|
|
4
|
+
config?: string;
|
|
5
|
+
}
|
|
6
|
+
declare function build(options?: BuildOptions): Promise<void>;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* folderblog CLI
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```bash
|
|
13
|
+
* npx folderblog init
|
|
14
|
+
* npx folderblog init --template blog
|
|
15
|
+
* npx folderblog init --app nextjs
|
|
16
|
+
* npx folderblog import-wp
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @packageDocumentation
|
|
20
|
+
*/
|
|
21
|
+
interface InitOptions {
|
|
22
|
+
/** Template to clone: 'blog' | 'portfolio' | 'docs' */
|
|
23
|
+
template?: string;
|
|
24
|
+
/** App starter to clone: 'nextjs' | 'astro' | 'remix' */
|
|
25
|
+
app?: string;
|
|
26
|
+
/** Target directory (defaults to current directory) */
|
|
27
|
+
dir?: string;
|
|
28
|
+
}
|
|
29
|
+
interface ImportWpOptions {
|
|
30
|
+
/** WordPress XML export file path */
|
|
31
|
+
file: string;
|
|
32
|
+
/** Output directory for markdown files */
|
|
33
|
+
outDir?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare function init(_options?: InitOptions): Promise<void>;
|
|
37
|
+
declare function importWp(_options: ImportWpOptions): Promise<void>;
|
|
38
|
+
|
|
39
|
+
export { type BuildOptions, type ImportWpOptions, type InitOptions, build, importWp, init };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
interface BuildOptions {
|
|
2
|
+
input?: string;
|
|
3
|
+
output?: string;
|
|
4
|
+
config?: string;
|
|
5
|
+
}
|
|
6
|
+
declare function build(options?: BuildOptions): Promise<void>;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* folderblog CLI
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```bash
|
|
13
|
+
* npx folderblog init
|
|
14
|
+
* npx folderblog init --template blog
|
|
15
|
+
* npx folderblog init --app nextjs
|
|
16
|
+
* npx folderblog import-wp
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @packageDocumentation
|
|
20
|
+
*/
|
|
21
|
+
interface InitOptions {
|
|
22
|
+
/** Template to clone: 'blog' | 'portfolio' | 'docs' */
|
|
23
|
+
template?: string;
|
|
24
|
+
/** App starter to clone: 'nextjs' | 'astro' | 'remix' */
|
|
25
|
+
app?: string;
|
|
26
|
+
/** Target directory (defaults to current directory) */
|
|
27
|
+
dir?: string;
|
|
28
|
+
}
|
|
29
|
+
interface ImportWpOptions {
|
|
30
|
+
/** WordPress XML export file path */
|
|
31
|
+
file: string;
|
|
32
|
+
/** Output directory for markdown files */
|
|
33
|
+
outDir?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare function init(_options?: InitOptions): Promise<void>;
|
|
37
|
+
declare function importWp(_options: ImportWpOptions): Promise<void>;
|
|
38
|
+
|
|
39
|
+
export { type BuildOptions, type ImportWpOptions, type InitOptions, build, importWp, init };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { build } from '../chunk-K76XLEC7.js';
|
|
2
|
+
import '../chunk-LPPBVXJ7.js';
|
|
3
|
+
import '../chunk-D26H5722.js';
|
|
4
|
+
import '../chunk-B43UAOPC.js';
|
|
5
|
+
import '../chunk-3RG5ZIWI.js';
|
|
6
|
+
|
|
7
|
+
// src/cli/index.ts
|
|
8
|
+
async function init(_options = {}) {
|
|
9
|
+
throw new Error("folderblog CLI is not yet implemented. Coming soon.");
|
|
10
|
+
}
|
|
11
|
+
async function importWp(_options) {
|
|
12
|
+
throw new Error("folderblog import-wp is not yet implemented. Coming soon.");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { importWp, init };
|