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,127 @@
|
|
|
1
|
+
// ../processor/src/types/config.ts
|
|
2
|
+
var DEFAULT_IMAGE_SIZES = [
|
|
3
|
+
{ width: 320, height: null, suffix: "xs" },
|
|
4
|
+
{ width: 640, height: null, suffix: "sm" },
|
|
5
|
+
{ width: 1024, height: null, suffix: "md" },
|
|
6
|
+
{ width: 1920, height: null, suffix: "lg" },
|
|
7
|
+
{ width: 3840, height: null, suffix: "xl" }
|
|
8
|
+
];
|
|
9
|
+
var withDefaults = (config) => ({
|
|
10
|
+
dir: config.dir,
|
|
11
|
+
plugins: config.plugins ?? {},
|
|
12
|
+
media: {
|
|
13
|
+
optimize: true,
|
|
14
|
+
sizes: DEFAULT_IMAGE_SIZES,
|
|
15
|
+
format: "webp",
|
|
16
|
+
quality: 80,
|
|
17
|
+
useHash: true,
|
|
18
|
+
useSharding: false,
|
|
19
|
+
pathPrefix: "/_media",
|
|
20
|
+
...config.media
|
|
21
|
+
},
|
|
22
|
+
content: {
|
|
23
|
+
notePathPrefix: "/content",
|
|
24
|
+
processAllFiles: false,
|
|
25
|
+
ignoreFiles: ["CONTRIBUTING.md", "README.md", "readme.md", "LICENSE.md"],
|
|
26
|
+
exportPosts: false,
|
|
27
|
+
trackRelationships: false,
|
|
28
|
+
includeSlugTracking: false,
|
|
29
|
+
slugConflictStrategy: "number",
|
|
30
|
+
slugScope: "global",
|
|
31
|
+
...config.content
|
|
32
|
+
},
|
|
33
|
+
mermaid: {
|
|
34
|
+
enabled: true,
|
|
35
|
+
strategy: "inline-svg",
|
|
36
|
+
dark: false,
|
|
37
|
+
...config.mermaid
|
|
38
|
+
},
|
|
39
|
+
pipeline: {
|
|
40
|
+
gfm: true,
|
|
41
|
+
allowRawHtml: true,
|
|
42
|
+
syntaxHighlighting: true,
|
|
43
|
+
parseFormulas: false,
|
|
44
|
+
removeDeadLinks: false,
|
|
45
|
+
...config.pipeline
|
|
46
|
+
},
|
|
47
|
+
debug: {
|
|
48
|
+
level: 0,
|
|
49
|
+
timing: false,
|
|
50
|
+
...config.debug
|
|
51
|
+
},
|
|
52
|
+
cache: config.cache
|
|
53
|
+
});
|
|
54
|
+
var getOutputDir = (config) => config.dir.output ?? `${config.dir.input}/dist`;
|
|
55
|
+
var getMediaOutputDir = (config) => {
|
|
56
|
+
const outputDir = getOutputDir(config);
|
|
57
|
+
const mediaSubdir = config.dir.mediaOutput ?? "_media";
|
|
58
|
+
return `${outputDir}/${mediaSubdir}`;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// ../processor/src/types/output.ts
|
|
62
|
+
var OUTPUT_FILES = {
|
|
63
|
+
POSTS: "posts.json",
|
|
64
|
+
POSTS_SLUG_MAP: "posts-slug-map.json",
|
|
65
|
+
POSTS_PATH_MAP: "posts-path-map.json",
|
|
66
|
+
MEDIAS: "media.json",
|
|
67
|
+
MEDIA_PATH_MAP: "media-path-map.json",
|
|
68
|
+
GRAPH: "graph.json",
|
|
69
|
+
TEXT_EMBEDDINGS: "posts-embedding-hash-map.json",
|
|
70
|
+
IMAGE_EMBEDDINGS: "media-embedding-hash-map.json",
|
|
71
|
+
SIMILARITY: "similarity.json",
|
|
72
|
+
DATABASE: "repo.db",
|
|
73
|
+
ISSUES: "processor-issues.json"
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// ../processor/src/types/issues.ts
|
|
77
|
+
var isBrokenLinkIssue = (issue) => issue.category === "broken-link";
|
|
78
|
+
var isMissingMediaIssue = (issue) => issue.category === "missing-media";
|
|
79
|
+
var isMediaProcessingIssue = (issue) => issue.category === "media-processing";
|
|
80
|
+
var isSlugConflictIssue = (issue) => issue.category === "slug-conflict";
|
|
81
|
+
var isMermaidErrorIssue = (issue) => issue.category === "mermaid-error";
|
|
82
|
+
var isEmbeddingErrorIssue = (issue) => issue.category === "embedding-error";
|
|
83
|
+
var isPluginErrorIssue = (issue) => issue.category === "plugin-error";
|
|
84
|
+
|
|
85
|
+
// ../processor/src/types/cache.ts
|
|
86
|
+
var createEmptyCacheStats = () => ({
|
|
87
|
+
mediaCacheHits: 0,
|
|
88
|
+
mediaCacheMisses: 0,
|
|
89
|
+
textEmbeddingCacheHits: 0,
|
|
90
|
+
textEmbeddingCacheMisses: 0,
|
|
91
|
+
imageEmbeddingCacheHits: 0,
|
|
92
|
+
imageEmbeddingCacheMisses: 0
|
|
93
|
+
});
|
|
94
|
+
function buildMediaCacheFromManifest(medias) {
|
|
95
|
+
const cache = /* @__PURE__ */ new Map();
|
|
96
|
+
for (const media of medias) {
|
|
97
|
+
const hash = media.metadata?.hash;
|
|
98
|
+
if (!hash || !media.metadata?.width || !media.metadata?.height) continue;
|
|
99
|
+
cache.set(hash, {
|
|
100
|
+
width: media.metadata.width,
|
|
101
|
+
height: media.metadata.height,
|
|
102
|
+
format: media.metadata.format ?? "webp",
|
|
103
|
+
size: media.metadata.size ?? 0,
|
|
104
|
+
originalSize: media.metadata.originalSize,
|
|
105
|
+
outputPath: media.outputPath,
|
|
106
|
+
sizes: (media.sizes ?? []).map((s) => ({
|
|
107
|
+
suffix: s.suffix,
|
|
108
|
+
outputPath: s.outputPath,
|
|
109
|
+
width: s.width,
|
|
110
|
+
height: s.height,
|
|
111
|
+
size: s.size
|
|
112
|
+
}))
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return cache;
|
|
116
|
+
}
|
|
117
|
+
function buildEmbeddingCacheFromManifest(embeddingMap) {
|
|
118
|
+
const cache = /* @__PURE__ */ new Map();
|
|
119
|
+
for (const [hash, embedding] of Object.entries(embeddingMap)) {
|
|
120
|
+
if (Array.isArray(embedding) && embedding.length > 0) {
|
|
121
|
+
cache.set(hash, embedding);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return cache;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export { DEFAULT_IMAGE_SIZES, OUTPUT_FILES, buildEmbeddingCacheFromManifest, buildMediaCacheFromManifest, createEmptyCacheStats, getMediaOutputDir, getOutputDir, isBrokenLinkIssue, isEmbeddingErrorIssue, isMediaProcessingIssue, isMermaidErrorIssue, isMissingMediaIssue, isPluginErrorIssue, isSlugConflictIssue, withDefaults };
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
// ../processor/src/plugins/manager.ts
|
|
5
|
+
var PluginManager = class {
|
|
6
|
+
plugins = /* @__PURE__ */ new Map();
|
|
7
|
+
config;
|
|
8
|
+
outputDir;
|
|
9
|
+
issues;
|
|
10
|
+
log;
|
|
11
|
+
initialized = false;
|
|
12
|
+
constructor(config) {
|
|
13
|
+
this.config = config.config;
|
|
14
|
+
this.outputDir = config.outputDir;
|
|
15
|
+
this.issues = config.issues;
|
|
16
|
+
this.log = config.log ?? defaultLogger;
|
|
17
|
+
}
|
|
18
|
+
// --------------------------------------------------------------------------
|
|
19
|
+
// Initialization
|
|
20
|
+
// --------------------------------------------------------------------------
|
|
21
|
+
/**
|
|
22
|
+
* Initialize all plugins in dependency order
|
|
23
|
+
*/
|
|
24
|
+
async initialize() {
|
|
25
|
+
if (this.initialized) {
|
|
26
|
+
this.log("Plugin manager already initialized", "warn");
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const pluginConfigs = this.config.plugins ?? {};
|
|
30
|
+
const allPlugins = Object.values(pluginConfigs).filter(
|
|
31
|
+
(p) => p != null
|
|
32
|
+
);
|
|
33
|
+
if (allPlugins.length === 0) {
|
|
34
|
+
this.log("No plugins configured", "debug");
|
|
35
|
+
this.initialized = true;
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
this.log(`Initializing ${allPlugins.length} plugin(s)...`, "info");
|
|
39
|
+
const sorted = topologicalSort(allPlugins);
|
|
40
|
+
const context = this.createContext();
|
|
41
|
+
for (const plugin of sorted) {
|
|
42
|
+
await this.initializePlugin(plugin, context);
|
|
43
|
+
}
|
|
44
|
+
this.initialized = true;
|
|
45
|
+
this.log(`All plugins initialized successfully`, "info");
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Initialize a single plugin
|
|
49
|
+
*/
|
|
50
|
+
async initializePlugin(plugin, context) {
|
|
51
|
+
const { name, requires } = plugin;
|
|
52
|
+
this.log(`Initializing plugin: ${name}`, "debug");
|
|
53
|
+
for (const dep of requires ?? []) {
|
|
54
|
+
if (!this.plugins.has(dep)) {
|
|
55
|
+
const error = `Plugin "${name}" requires "${dep}" which is not configured`;
|
|
56
|
+
this.issues.addPluginError({
|
|
57
|
+
pluginName: name,
|
|
58
|
+
operation: "initialize",
|
|
59
|
+
errorMessage: error
|
|
60
|
+
});
|
|
61
|
+
throw new Error(error);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
await plugin.initialize(context);
|
|
66
|
+
this.plugins.set(name, plugin);
|
|
67
|
+
this.log(`Plugin "${name}" initialized`, "debug");
|
|
68
|
+
} catch (error) {
|
|
69
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
70
|
+
this.issues.addPluginError({
|
|
71
|
+
pluginName: name,
|
|
72
|
+
operation: "initialize",
|
|
73
|
+
errorMessage
|
|
74
|
+
});
|
|
75
|
+
throw new Error(`Failed to initialize plugin "${name}": ${errorMessage}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Create plugin context
|
|
80
|
+
*/
|
|
81
|
+
createContext() {
|
|
82
|
+
return {
|
|
83
|
+
outputDir: this.outputDir,
|
|
84
|
+
issues: this.issues,
|
|
85
|
+
log: this.log,
|
|
86
|
+
config: this.config,
|
|
87
|
+
getPlugin: (name) => this.getPlugin(name)
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
// --------------------------------------------------------------------------
|
|
91
|
+
// Plugin Access
|
|
92
|
+
// --------------------------------------------------------------------------
|
|
93
|
+
/**
|
|
94
|
+
* Get a plugin by name
|
|
95
|
+
*/
|
|
96
|
+
getPlugin(name) {
|
|
97
|
+
return this.plugins.get(name);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Get a typed plugin by its config key
|
|
101
|
+
*/
|
|
102
|
+
getPluginByKey(key) {
|
|
103
|
+
return this.plugins.get(key);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Check if a plugin is available
|
|
107
|
+
*/
|
|
108
|
+
hasPlugin(name) {
|
|
109
|
+
return this.plugins.has(name);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Get all initialized plugin names
|
|
113
|
+
*/
|
|
114
|
+
getPluginNames() {
|
|
115
|
+
return [...this.plugins.keys()];
|
|
116
|
+
}
|
|
117
|
+
// --------------------------------------------------------------------------
|
|
118
|
+
// Cleanup
|
|
119
|
+
// --------------------------------------------------------------------------
|
|
120
|
+
/**
|
|
121
|
+
* Dispose all plugins
|
|
122
|
+
*/
|
|
123
|
+
async dispose() {
|
|
124
|
+
const plugins = [...this.plugins.values()].reverse();
|
|
125
|
+
for (const plugin of plugins) {
|
|
126
|
+
if (plugin.dispose) {
|
|
127
|
+
try {
|
|
128
|
+
await plugin.dispose();
|
|
129
|
+
this.log(`Plugin "${plugin.name}" disposed`, "debug");
|
|
130
|
+
} catch (error) {
|
|
131
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
132
|
+
this.issues.addPluginError({
|
|
133
|
+
pluginName: plugin.name,
|
|
134
|
+
operation: "dispose",
|
|
135
|
+
errorMessage
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
this.plugins.clear();
|
|
141
|
+
this.initialized = false;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
var topologicalSort = (plugins) => {
|
|
145
|
+
const pluginMap = /* @__PURE__ */ new Map();
|
|
146
|
+
const adjacency = /* @__PURE__ */ new Map();
|
|
147
|
+
const inDegree = /* @__PURE__ */ new Map();
|
|
148
|
+
for (const plugin of plugins) {
|
|
149
|
+
pluginMap.set(plugin.name, plugin);
|
|
150
|
+
adjacency.set(plugin.name, []);
|
|
151
|
+
inDegree.set(plugin.name, 0);
|
|
152
|
+
}
|
|
153
|
+
for (const plugin of plugins) {
|
|
154
|
+
for (const dep of plugin.requires ?? []) {
|
|
155
|
+
if (adjacency.has(dep)) {
|
|
156
|
+
adjacency.get(dep).push(plugin.name);
|
|
157
|
+
inDegree.set(plugin.name, (inDegree.get(plugin.name) ?? 0) + 1);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
const queue = [];
|
|
162
|
+
const result = [];
|
|
163
|
+
for (const [name, degree] of inDegree) {
|
|
164
|
+
if (degree === 0) {
|
|
165
|
+
queue.push(name);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
while (queue.length > 0) {
|
|
169
|
+
const name = queue.shift();
|
|
170
|
+
const plugin = pluginMap.get(name);
|
|
171
|
+
if (plugin) {
|
|
172
|
+
result.push(plugin);
|
|
173
|
+
}
|
|
174
|
+
for (const neighbor of adjacency.get(name) ?? []) {
|
|
175
|
+
const newDegree = (inDegree.get(neighbor) ?? 0) - 1;
|
|
176
|
+
inDegree.set(neighbor, newDegree);
|
|
177
|
+
if (newDegree === 0) {
|
|
178
|
+
queue.push(neighbor);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (result.length !== plugins.length) {
|
|
183
|
+
const unresolved = plugins.filter((p) => !result.includes(p)).map((p) => p.name);
|
|
184
|
+
throw new Error(
|
|
185
|
+
`Circular plugin dependency detected involving: ${unresolved.join(", ")}`
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
return result;
|
|
189
|
+
};
|
|
190
|
+
var defaultLogger = (message, level = "info") => {
|
|
191
|
+
const prefix = `[processor-core]`;
|
|
192
|
+
switch (level) {
|
|
193
|
+
case "error":
|
|
194
|
+
console.error(`${prefix} ERROR: ${message}`);
|
|
195
|
+
break;
|
|
196
|
+
case "warn":
|
|
197
|
+
console.warn(`${prefix} WARN: ${message}`);
|
|
198
|
+
break;
|
|
199
|
+
case "debug":
|
|
200
|
+
if (process.env.NODE_ENV === "development" || process.env.DEBUG) {
|
|
201
|
+
console.log(`${prefix} DEBUG: ${message}`);
|
|
202
|
+
}
|
|
203
|
+
break;
|
|
204
|
+
default:
|
|
205
|
+
console.log(`${prefix} ${message}`);
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
var createPluginManager = async (config) => {
|
|
209
|
+
const manager = new PluginManager(config);
|
|
210
|
+
await manager.initialize();
|
|
211
|
+
return manager;
|
|
212
|
+
};
|
|
213
|
+
var CopyOnlyImageProcessor = class {
|
|
214
|
+
name = "imageProcessor";
|
|
215
|
+
ready = false;
|
|
216
|
+
context = null;
|
|
217
|
+
async initialize(context) {
|
|
218
|
+
this.context = context;
|
|
219
|
+
this.ready = true;
|
|
220
|
+
context.log("CopyOnlyImageProcessor initialized (no optimization)", "debug");
|
|
221
|
+
}
|
|
222
|
+
isReady() {
|
|
223
|
+
return this.ready;
|
|
224
|
+
}
|
|
225
|
+
canProcess(filePath) {
|
|
226
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
227
|
+
return [".jpg", ".jpeg", ".png", ".gif", ".webp", ".avif", ".svg"].includes(ext);
|
|
228
|
+
}
|
|
229
|
+
async getMetadata(filePath) {
|
|
230
|
+
const ext = path.extname(filePath).toLowerCase().slice(1);
|
|
231
|
+
return {
|
|
232
|
+
width: 0,
|
|
233
|
+
height: 0,
|
|
234
|
+
format: ext || "unknown"
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
async process(inputPath, outputPath, _options) {
|
|
238
|
+
await this.copy(inputPath, outputPath);
|
|
239
|
+
const stats = await fs.stat(outputPath);
|
|
240
|
+
const ext = path.extname(inputPath).toLowerCase().slice(1);
|
|
241
|
+
return {
|
|
242
|
+
outputPath,
|
|
243
|
+
width: 0,
|
|
244
|
+
height: 0,
|
|
245
|
+
format: ext || "unknown",
|
|
246
|
+
size: stats.size
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
async copy(inputPath, outputPath) {
|
|
250
|
+
await fs.mkdir(path.dirname(outputPath), { recursive: true });
|
|
251
|
+
await fs.copyFile(inputPath, outputPath);
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
var PassthroughMermaidRenderer = class {
|
|
255
|
+
name = "mermaidRenderer";
|
|
256
|
+
ready = false;
|
|
257
|
+
async initialize(context) {
|
|
258
|
+
this.ready = true;
|
|
259
|
+
context.log("PassthroughMermaidRenderer initialized (client-side rendering)", "debug");
|
|
260
|
+
}
|
|
261
|
+
isReady() {
|
|
262
|
+
return this.ready;
|
|
263
|
+
}
|
|
264
|
+
async isAvailable() {
|
|
265
|
+
return true;
|
|
266
|
+
}
|
|
267
|
+
async render(code, _options) {
|
|
268
|
+
return {
|
|
269
|
+
output: code,
|
|
270
|
+
strategy: "pre-mermaid"
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
var NoOpTextEmbedder = class {
|
|
275
|
+
name = "textEmbedder";
|
|
276
|
+
model = "none";
|
|
277
|
+
dimensions = 0;
|
|
278
|
+
ready = false;
|
|
279
|
+
async initialize(context) {
|
|
280
|
+
this.ready = true;
|
|
281
|
+
context.log("NoOpTextEmbedder initialized (embeddings disabled)", "debug");
|
|
282
|
+
}
|
|
283
|
+
isReady() {
|
|
284
|
+
return this.ready;
|
|
285
|
+
}
|
|
286
|
+
async embed(_text) {
|
|
287
|
+
return [];
|
|
288
|
+
}
|
|
289
|
+
async batchEmbed(texts) {
|
|
290
|
+
return texts.map(() => []);
|
|
291
|
+
}
|
|
292
|
+
};
|
|
293
|
+
var NoOpImageEmbedder = class {
|
|
294
|
+
name = "imageEmbedder";
|
|
295
|
+
model = "none";
|
|
296
|
+
dimensions = 0;
|
|
297
|
+
ready = false;
|
|
298
|
+
async initialize(context) {
|
|
299
|
+
this.ready = true;
|
|
300
|
+
context.log("NoOpImageEmbedder initialized (image embeddings disabled)", "debug");
|
|
301
|
+
}
|
|
302
|
+
isReady() {
|
|
303
|
+
return this.ready;
|
|
304
|
+
}
|
|
305
|
+
async embedFile(_filePath) {
|
|
306
|
+
return [];
|
|
307
|
+
}
|
|
308
|
+
async embedBuffer(_buffer, _mimeType) {
|
|
309
|
+
return [];
|
|
310
|
+
}
|
|
311
|
+
};
|
|
312
|
+
var NoOpSimilarity = class {
|
|
313
|
+
name = "similarity";
|
|
314
|
+
requires = ["textEmbedder"];
|
|
315
|
+
ready = false;
|
|
316
|
+
async initialize(context) {
|
|
317
|
+
this.ready = true;
|
|
318
|
+
context.log("NoOpSimilarity initialized (similarity disabled)", "debug");
|
|
319
|
+
}
|
|
320
|
+
isReady() {
|
|
321
|
+
return this.ready;
|
|
322
|
+
}
|
|
323
|
+
computeSimilarity(_a, _b) {
|
|
324
|
+
return 0;
|
|
325
|
+
}
|
|
326
|
+
async generateSimilarityMap(posts) {
|
|
327
|
+
return {
|
|
328
|
+
pairwiseScores: /* @__PURE__ */ new Map(),
|
|
329
|
+
similarPosts: /* @__PURE__ */ new Map(),
|
|
330
|
+
metadata: {
|
|
331
|
+
computedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
332
|
+
postCount: posts.length,
|
|
333
|
+
pairCount: 0
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
};
|
|
338
|
+
var NoOpDatabase = class {
|
|
339
|
+
name = "database";
|
|
340
|
+
ready = false;
|
|
341
|
+
async initialize(context) {
|
|
342
|
+
this.ready = true;
|
|
343
|
+
context.log("NoOpDatabase initialized (database generation disabled)", "debug");
|
|
344
|
+
}
|
|
345
|
+
isReady() {
|
|
346
|
+
return this.ready;
|
|
347
|
+
}
|
|
348
|
+
async build(_input) {
|
|
349
|
+
return {
|
|
350
|
+
databasePath: "",
|
|
351
|
+
tables: [],
|
|
352
|
+
rowCounts: {},
|
|
353
|
+
hasVectorSearch: false
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
var createDefaultPlugins = () => ({
|
|
358
|
+
imageProcessor: new CopyOnlyImageProcessor(),
|
|
359
|
+
mermaidRenderer: new PassthroughMermaidRenderer()
|
|
360
|
+
});
|
|
361
|
+
var createAllNoOpPlugins = () => ({
|
|
362
|
+
imageProcessor: new CopyOnlyImageProcessor(),
|
|
363
|
+
mermaidRenderer: new PassthroughMermaidRenderer(),
|
|
364
|
+
textEmbedder: new NoOpTextEmbedder(),
|
|
365
|
+
imageEmbedder: new NoOpImageEmbedder(),
|
|
366
|
+
similarity: new NoOpSimilarity(),
|
|
367
|
+
database: new NoOpDatabase()
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
export { CopyOnlyImageProcessor, NoOpDatabase, NoOpImageEmbedder, NoOpSimilarity, NoOpTextEmbedder, PassthroughMermaidRenderer, PluginManager, createAllNoOpPlugins, createDefaultPlugins, createPluginManager, topologicalSort };
|
package/dist/cli/bin.cjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var chunk4ZJGUMHS_cjs = require('../chunk-4ZJGUMHS.cjs');
|
|
5
|
+
require('../chunk-QA4KPPTA.cjs');
|
|
6
|
+
require('../chunk-HMQIQUPB.cjs');
|
|
7
|
+
require('../chunk-24MKFHML.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 chunk4ZJGUMHS_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-PARGDJNY.js';
|
|
3
|
+
import '../chunk-IXP35S24.js';
|
|
4
|
+
import '../chunk-ZRUBI3GH.js';
|
|
5
|
+
import '../chunk-XP5J4LFJ.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 chunk4ZJGUMHS_cjs = require('../chunk-4ZJGUMHS.cjs');
|
|
4
|
+
require('../chunk-QA4KPPTA.cjs');
|
|
5
|
+
require('../chunk-HMQIQUPB.cjs');
|
|
6
|
+
require('../chunk-24MKFHML.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 chunk4ZJGUMHS_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-PARGDJNY.js';
|
|
2
|
+
import '../chunk-IXP35S24.js';
|
|
3
|
+
import '../chunk-ZRUBI3GH.js';
|
|
4
|
+
import '../chunk-XP5J4LFJ.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 };
|