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,174 @@
|
|
|
1
|
+
import { a4 as ProcessConfig, s as IssueCollector, L as LogLevel, W as Plugin, $ as PluginName, Y as PluginConfig, p as ImageProcessorPlugin, Z as PluginContext, m as ImageMetadata, n as ImageProcessOptions, o as ImageProcessResult, f as DatabasePlugin, e as DatabaseBuildInput, g as DatabaseResult, I as ImageEmbeddingPlugin, ab as SimilarityPlugin, a8 as ProcessedPost, ac as SimilarityResult, af as TextEmbeddingPlugin, O as MermaidRendererPlugin, N as MermaidRenderOptions, P as MermaidResult } from '../config-DFr-htlO.cjs';
|
|
2
|
+
export { Q as MermaidStrategy, X as PluginByName } from '../config-DFr-htlO.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Plugin Manager
|
|
6
|
+
*
|
|
7
|
+
* Manages plugin lifecycle with dependency resolution using topological sort.
|
|
8
|
+
* Ensures plugins are initialized in the correct order based on dependencies.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
interface PluginManagerConfig {
|
|
12
|
+
readonly config: ProcessConfig;
|
|
13
|
+
readonly outputDir: string;
|
|
14
|
+
readonly issues: IssueCollector;
|
|
15
|
+
readonly log?: (message: string, level?: LogLevel) => void;
|
|
16
|
+
}
|
|
17
|
+
declare class PluginManager {
|
|
18
|
+
private readonly plugins;
|
|
19
|
+
private readonly config;
|
|
20
|
+
private readonly outputDir;
|
|
21
|
+
private readonly issues;
|
|
22
|
+
private readonly log;
|
|
23
|
+
private initialized;
|
|
24
|
+
constructor(config: PluginManagerConfig);
|
|
25
|
+
/**
|
|
26
|
+
* Initialize all plugins in dependency order
|
|
27
|
+
*/
|
|
28
|
+
initialize(): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Initialize a single plugin
|
|
31
|
+
*/
|
|
32
|
+
private initializePlugin;
|
|
33
|
+
/**
|
|
34
|
+
* Create plugin context
|
|
35
|
+
*/
|
|
36
|
+
private createContext;
|
|
37
|
+
/**
|
|
38
|
+
* Get a plugin by name
|
|
39
|
+
*/
|
|
40
|
+
getPlugin<T extends Plugin>(name: string): T | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Get a typed plugin by its config key
|
|
43
|
+
*/
|
|
44
|
+
getPluginByKey<K extends PluginName>(key: K): NonNullable<PluginConfig[K]> | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Check if a plugin is available
|
|
47
|
+
*/
|
|
48
|
+
hasPlugin(name: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Get all initialized plugin names
|
|
51
|
+
*/
|
|
52
|
+
getPluginNames(): readonly string[];
|
|
53
|
+
/**
|
|
54
|
+
* Dispose all plugins
|
|
55
|
+
*/
|
|
56
|
+
dispose(): Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Sort plugins in dependency order using Kahn's algorithm
|
|
60
|
+
* Ensures plugins are initialized after their dependencies
|
|
61
|
+
*/
|
|
62
|
+
declare const topologicalSort: (plugins: readonly Plugin[]) => readonly Plugin[];
|
|
63
|
+
/**
|
|
64
|
+
* Create and initialize a plugin manager
|
|
65
|
+
*/
|
|
66
|
+
declare const createPluginManager: (config: PluginManagerConfig) => Promise<PluginManager>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Default No-Op Plugins
|
|
70
|
+
*
|
|
71
|
+
* Minimal implementations that allow the processor to work without
|
|
72
|
+
* external dependencies. These are used as fallbacks when plugins
|
|
73
|
+
* aren't configured.
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Minimal image processor that only copies files without optimization.
|
|
78
|
+
* Used when Sharp or similar libraries aren't available.
|
|
79
|
+
*/
|
|
80
|
+
declare class CopyOnlyImageProcessor implements ImageProcessorPlugin {
|
|
81
|
+
readonly name: "imageProcessor";
|
|
82
|
+
private ready;
|
|
83
|
+
private context;
|
|
84
|
+
initialize(context: PluginContext): Promise<void>;
|
|
85
|
+
isReady(): boolean;
|
|
86
|
+
canProcess(filePath: string): boolean;
|
|
87
|
+
getMetadata(filePath: string): Promise<ImageMetadata>;
|
|
88
|
+
process(inputPath: string, outputPath: string, _options: ImageProcessOptions): Promise<ImageProcessResult>;
|
|
89
|
+
copy(inputPath: string, outputPath: string): Promise<void>;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Mermaid renderer that passes through code as-is.
|
|
93
|
+
* Leaves rendering to the client-side.
|
|
94
|
+
*/
|
|
95
|
+
declare class PassthroughMermaidRenderer implements MermaidRendererPlugin {
|
|
96
|
+
readonly name: "mermaidRenderer";
|
|
97
|
+
private ready;
|
|
98
|
+
initialize(context: PluginContext): Promise<void>;
|
|
99
|
+
isReady(): boolean;
|
|
100
|
+
isAvailable(): Promise<boolean>;
|
|
101
|
+
render(code: string, _options: MermaidRenderOptions): Promise<MermaidResult>;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Text embedder that returns empty embeddings.
|
|
105
|
+
* Used when embedding functionality isn't needed or available.
|
|
106
|
+
*/
|
|
107
|
+
declare class NoOpTextEmbedder implements TextEmbeddingPlugin {
|
|
108
|
+
readonly name: "textEmbedder";
|
|
109
|
+
readonly model = "none";
|
|
110
|
+
readonly dimensions = 0;
|
|
111
|
+
private ready;
|
|
112
|
+
initialize(context: PluginContext): Promise<void>;
|
|
113
|
+
isReady(): boolean;
|
|
114
|
+
embed(_text: string): Promise<readonly number[]>;
|
|
115
|
+
batchEmbed(texts: readonly string[]): Promise<readonly (readonly number[])[]>;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Image embedder that returns empty embeddings.
|
|
119
|
+
* Used when image embedding functionality isn't needed or available.
|
|
120
|
+
*/
|
|
121
|
+
declare class NoOpImageEmbedder implements ImageEmbeddingPlugin {
|
|
122
|
+
readonly name: "imageEmbedder";
|
|
123
|
+
readonly model = "none";
|
|
124
|
+
readonly dimensions = 0;
|
|
125
|
+
private ready;
|
|
126
|
+
initialize(context: PluginContext): Promise<void>;
|
|
127
|
+
isReady(): boolean;
|
|
128
|
+
embedFile(_filePath: string): Promise<readonly number[]>;
|
|
129
|
+
embedBuffer(_buffer: Buffer, _mimeType: string): Promise<readonly number[]>;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Similarity plugin that returns empty results.
|
|
133
|
+
* Used when similarity computation isn't needed.
|
|
134
|
+
*/
|
|
135
|
+
declare class NoOpSimilarity implements SimilarityPlugin {
|
|
136
|
+
readonly name: "similarity";
|
|
137
|
+
readonly requires: readonly ["textEmbedder"];
|
|
138
|
+
private ready;
|
|
139
|
+
initialize(context: PluginContext): Promise<void>;
|
|
140
|
+
isReady(): boolean;
|
|
141
|
+
computeSimilarity(_a: readonly number[], _b: readonly number[]): number;
|
|
142
|
+
generateSimilarityMap(posts: readonly ProcessedPost[]): Promise<SimilarityResult>;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Database plugin that doesn't create a database.
|
|
146
|
+
* Used when database generation isn't needed.
|
|
147
|
+
*/
|
|
148
|
+
declare class NoOpDatabase implements DatabasePlugin {
|
|
149
|
+
readonly name: "database";
|
|
150
|
+
private ready;
|
|
151
|
+
initialize(context: PluginContext): Promise<void>;
|
|
152
|
+
isReady(): boolean;
|
|
153
|
+
build(_input: DatabaseBuildInput): Promise<DatabaseResult>;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Create a set of default no-op plugins
|
|
157
|
+
*/
|
|
158
|
+
declare const createDefaultPlugins: () => {
|
|
159
|
+
imageProcessor: ImageProcessorPlugin;
|
|
160
|
+
mermaidRenderer: MermaidRendererPlugin;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Create all no-op plugins (for testing)
|
|
164
|
+
*/
|
|
165
|
+
declare const createAllNoOpPlugins: () => {
|
|
166
|
+
imageProcessor: ImageProcessorPlugin;
|
|
167
|
+
mermaidRenderer: MermaidRendererPlugin;
|
|
168
|
+
textEmbedder: TextEmbeddingPlugin;
|
|
169
|
+
imageEmbedder: ImageEmbeddingPlugin;
|
|
170
|
+
similarity: SimilarityPlugin;
|
|
171
|
+
database: DatabasePlugin;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export { CopyOnlyImageProcessor, DatabaseBuildInput, DatabasePlugin, DatabaseResult, ImageEmbeddingPlugin, ImageMetadata, ImageProcessOptions, ImageProcessResult, ImageProcessorPlugin, LogLevel, MermaidRenderOptions, MermaidRendererPlugin, MermaidResult, NoOpDatabase, NoOpImageEmbedder, NoOpSimilarity, NoOpTextEmbedder, PassthroughMermaidRenderer, Plugin, PluginConfig, PluginContext, PluginManager, type PluginManagerConfig, PluginName, SimilarityPlugin, SimilarityResult, TextEmbeddingPlugin, createAllNoOpPlugins, createDefaultPlugins, createPluginManager, topologicalSort };
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { a4 as ProcessConfig, s as IssueCollector, L as LogLevel, W as Plugin, $ as PluginName, Y as PluginConfig, p as ImageProcessorPlugin, Z as PluginContext, m as ImageMetadata, n as ImageProcessOptions, o as ImageProcessResult, f as DatabasePlugin, e as DatabaseBuildInput, g as DatabaseResult, I as ImageEmbeddingPlugin, ab as SimilarityPlugin, a8 as ProcessedPost, ac as SimilarityResult, af as TextEmbeddingPlugin, O as MermaidRendererPlugin, N as MermaidRenderOptions, P as MermaidResult } from '../config-DFr-htlO.js';
|
|
2
|
+
export { Q as MermaidStrategy, X as PluginByName } from '../config-DFr-htlO.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Plugin Manager
|
|
6
|
+
*
|
|
7
|
+
* Manages plugin lifecycle with dependency resolution using topological sort.
|
|
8
|
+
* Ensures plugins are initialized in the correct order based on dependencies.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
interface PluginManagerConfig {
|
|
12
|
+
readonly config: ProcessConfig;
|
|
13
|
+
readonly outputDir: string;
|
|
14
|
+
readonly issues: IssueCollector;
|
|
15
|
+
readonly log?: (message: string, level?: LogLevel) => void;
|
|
16
|
+
}
|
|
17
|
+
declare class PluginManager {
|
|
18
|
+
private readonly plugins;
|
|
19
|
+
private readonly config;
|
|
20
|
+
private readonly outputDir;
|
|
21
|
+
private readonly issues;
|
|
22
|
+
private readonly log;
|
|
23
|
+
private initialized;
|
|
24
|
+
constructor(config: PluginManagerConfig);
|
|
25
|
+
/**
|
|
26
|
+
* Initialize all plugins in dependency order
|
|
27
|
+
*/
|
|
28
|
+
initialize(): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Initialize a single plugin
|
|
31
|
+
*/
|
|
32
|
+
private initializePlugin;
|
|
33
|
+
/**
|
|
34
|
+
* Create plugin context
|
|
35
|
+
*/
|
|
36
|
+
private createContext;
|
|
37
|
+
/**
|
|
38
|
+
* Get a plugin by name
|
|
39
|
+
*/
|
|
40
|
+
getPlugin<T extends Plugin>(name: string): T | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Get a typed plugin by its config key
|
|
43
|
+
*/
|
|
44
|
+
getPluginByKey<K extends PluginName>(key: K): NonNullable<PluginConfig[K]> | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Check if a plugin is available
|
|
47
|
+
*/
|
|
48
|
+
hasPlugin(name: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Get all initialized plugin names
|
|
51
|
+
*/
|
|
52
|
+
getPluginNames(): readonly string[];
|
|
53
|
+
/**
|
|
54
|
+
* Dispose all plugins
|
|
55
|
+
*/
|
|
56
|
+
dispose(): Promise<void>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Sort plugins in dependency order using Kahn's algorithm
|
|
60
|
+
* Ensures plugins are initialized after their dependencies
|
|
61
|
+
*/
|
|
62
|
+
declare const topologicalSort: (plugins: readonly Plugin[]) => readonly Plugin[];
|
|
63
|
+
/**
|
|
64
|
+
* Create and initialize a plugin manager
|
|
65
|
+
*/
|
|
66
|
+
declare const createPluginManager: (config: PluginManagerConfig) => Promise<PluginManager>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Default No-Op Plugins
|
|
70
|
+
*
|
|
71
|
+
* Minimal implementations that allow the processor to work without
|
|
72
|
+
* external dependencies. These are used as fallbacks when plugins
|
|
73
|
+
* aren't configured.
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Minimal image processor that only copies files without optimization.
|
|
78
|
+
* Used when Sharp or similar libraries aren't available.
|
|
79
|
+
*/
|
|
80
|
+
declare class CopyOnlyImageProcessor implements ImageProcessorPlugin {
|
|
81
|
+
readonly name: "imageProcessor";
|
|
82
|
+
private ready;
|
|
83
|
+
private context;
|
|
84
|
+
initialize(context: PluginContext): Promise<void>;
|
|
85
|
+
isReady(): boolean;
|
|
86
|
+
canProcess(filePath: string): boolean;
|
|
87
|
+
getMetadata(filePath: string): Promise<ImageMetadata>;
|
|
88
|
+
process(inputPath: string, outputPath: string, _options: ImageProcessOptions): Promise<ImageProcessResult>;
|
|
89
|
+
copy(inputPath: string, outputPath: string): Promise<void>;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Mermaid renderer that passes through code as-is.
|
|
93
|
+
* Leaves rendering to the client-side.
|
|
94
|
+
*/
|
|
95
|
+
declare class PassthroughMermaidRenderer implements MermaidRendererPlugin {
|
|
96
|
+
readonly name: "mermaidRenderer";
|
|
97
|
+
private ready;
|
|
98
|
+
initialize(context: PluginContext): Promise<void>;
|
|
99
|
+
isReady(): boolean;
|
|
100
|
+
isAvailable(): Promise<boolean>;
|
|
101
|
+
render(code: string, _options: MermaidRenderOptions): Promise<MermaidResult>;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Text embedder that returns empty embeddings.
|
|
105
|
+
* Used when embedding functionality isn't needed or available.
|
|
106
|
+
*/
|
|
107
|
+
declare class NoOpTextEmbedder implements TextEmbeddingPlugin {
|
|
108
|
+
readonly name: "textEmbedder";
|
|
109
|
+
readonly model = "none";
|
|
110
|
+
readonly dimensions = 0;
|
|
111
|
+
private ready;
|
|
112
|
+
initialize(context: PluginContext): Promise<void>;
|
|
113
|
+
isReady(): boolean;
|
|
114
|
+
embed(_text: string): Promise<readonly number[]>;
|
|
115
|
+
batchEmbed(texts: readonly string[]): Promise<readonly (readonly number[])[]>;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Image embedder that returns empty embeddings.
|
|
119
|
+
* Used when image embedding functionality isn't needed or available.
|
|
120
|
+
*/
|
|
121
|
+
declare class NoOpImageEmbedder implements ImageEmbeddingPlugin {
|
|
122
|
+
readonly name: "imageEmbedder";
|
|
123
|
+
readonly model = "none";
|
|
124
|
+
readonly dimensions = 0;
|
|
125
|
+
private ready;
|
|
126
|
+
initialize(context: PluginContext): Promise<void>;
|
|
127
|
+
isReady(): boolean;
|
|
128
|
+
embedFile(_filePath: string): Promise<readonly number[]>;
|
|
129
|
+
embedBuffer(_buffer: Buffer, _mimeType: string): Promise<readonly number[]>;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Similarity plugin that returns empty results.
|
|
133
|
+
* Used when similarity computation isn't needed.
|
|
134
|
+
*/
|
|
135
|
+
declare class NoOpSimilarity implements SimilarityPlugin {
|
|
136
|
+
readonly name: "similarity";
|
|
137
|
+
readonly requires: readonly ["textEmbedder"];
|
|
138
|
+
private ready;
|
|
139
|
+
initialize(context: PluginContext): Promise<void>;
|
|
140
|
+
isReady(): boolean;
|
|
141
|
+
computeSimilarity(_a: readonly number[], _b: readonly number[]): number;
|
|
142
|
+
generateSimilarityMap(posts: readonly ProcessedPost[]): Promise<SimilarityResult>;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Database plugin that doesn't create a database.
|
|
146
|
+
* Used when database generation isn't needed.
|
|
147
|
+
*/
|
|
148
|
+
declare class NoOpDatabase implements DatabasePlugin {
|
|
149
|
+
readonly name: "database";
|
|
150
|
+
private ready;
|
|
151
|
+
initialize(context: PluginContext): Promise<void>;
|
|
152
|
+
isReady(): boolean;
|
|
153
|
+
build(_input: DatabaseBuildInput): Promise<DatabaseResult>;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Create a set of default no-op plugins
|
|
157
|
+
*/
|
|
158
|
+
declare const createDefaultPlugins: () => {
|
|
159
|
+
imageProcessor: ImageProcessorPlugin;
|
|
160
|
+
mermaidRenderer: MermaidRendererPlugin;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Create all no-op plugins (for testing)
|
|
164
|
+
*/
|
|
165
|
+
declare const createAllNoOpPlugins: () => {
|
|
166
|
+
imageProcessor: ImageProcessorPlugin;
|
|
167
|
+
mermaidRenderer: MermaidRendererPlugin;
|
|
168
|
+
textEmbedder: TextEmbeddingPlugin;
|
|
169
|
+
imageEmbedder: ImageEmbeddingPlugin;
|
|
170
|
+
similarity: SimilarityPlugin;
|
|
171
|
+
database: DatabasePlugin;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export { CopyOnlyImageProcessor, DatabaseBuildInput, DatabasePlugin, DatabaseResult, ImageEmbeddingPlugin, ImageMetadata, ImageProcessOptions, ImageProcessResult, ImageProcessorPlugin, LogLevel, MermaidRenderOptions, MermaidRendererPlugin, MermaidResult, NoOpDatabase, NoOpImageEmbedder, NoOpSimilarity, NoOpTextEmbedder, PassthroughMermaidRenderer, Plugin, PluginConfig, PluginContext, PluginManager, type PluginManagerConfig, PluginName, SimilarityPlugin, SimilarityResult, TextEmbeddingPlugin, createAllNoOpPlugins, createDefaultPlugins, createPluginManager, topologicalSort };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { CopyOnlyImageProcessor, NoOpDatabase, NoOpImageEmbedder, NoOpSimilarity, NoOpTextEmbedder, PassthroughMermaidRenderer, PluginManager, createAllNoOpPlugins, createDefaultPlugins, createPluginManager, topologicalSort } from '../chunk-ZRUBI3GH.js';
|
|
2
|
+
import '../chunk-3RG5ZIWI.js';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk24MKFHML_cjs = require('../chunk-24MKFHML.cjs');
|
|
4
|
+
require('../chunk-OBGZSXTJ.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, "DEFAULT_IMAGE_SIZES", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return chunk24MKFHML_cjs.DEFAULT_IMAGE_SIZES; }
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "OUTPUT_FILES", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return chunk24MKFHML_cjs.OUTPUT_FILES; }
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "buildEmbeddingCacheFromManifest", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return chunk24MKFHML_cjs.buildEmbeddingCacheFromManifest; }
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "buildMediaCacheFromManifest", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return chunk24MKFHML_cjs.buildMediaCacheFromManifest; }
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "createEmptyCacheStats", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return chunk24MKFHML_cjs.createEmptyCacheStats; }
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, "getMediaOutputDir", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () { return chunk24MKFHML_cjs.getMediaOutputDir; }
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports, "getOutputDir", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () { return chunk24MKFHML_cjs.getOutputDir; }
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "isBrokenLinkIssue", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () { return chunk24MKFHML_cjs.isBrokenLinkIssue; }
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(exports, "isEmbeddingErrorIssue", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function () { return chunk24MKFHML_cjs.isEmbeddingErrorIssue; }
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(exports, "isMediaProcessingIssue", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () { return chunk24MKFHML_cjs.isMediaProcessingIssue; }
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "isMermaidErrorIssue", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () { return chunk24MKFHML_cjs.isMermaidErrorIssue; }
|
|
51
|
+
});
|
|
52
|
+
Object.defineProperty(exports, "isMissingMediaIssue", {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function () { return chunk24MKFHML_cjs.isMissingMediaIssue; }
|
|
55
|
+
});
|
|
56
|
+
Object.defineProperty(exports, "isPluginErrorIssue", {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function () { return chunk24MKFHML_cjs.isPluginErrorIssue; }
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "isSlugConflictIssue", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () { return chunk24MKFHML_cjs.isSlugConflictIssue; }
|
|
63
|
+
});
|
|
64
|
+
Object.defineProperty(exports, "withDefaults", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
get: function () { return chunk24MKFHML_cjs.withDefaults; }
|
|
67
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { a8 as ProcessedPost } from '../config-DFr-htlO.cjs';
|
|
2
|
+
export { B as BrokenLinkIssue, C as CacheContext, a as CacheStats, b as CachedMediaMetadata, c as CachedMediaSizeVariant, d as ContentConfig, D as DEFAULT_IMAGE_SIZES, h as DebugConfig, i as DirectoryConfig, E as EmbeddingErrorIssue, j as EmbeddingMap, G as GraphData, k as GraphEdge, l as GraphNode, q as ImageSizeConfig, r as IssueCategory, u as IssueFilterOptions, v as IssueModule, w as IssueReport, x as IssueSeverity, y as IssueSummary, M as MediaConfig, z as MediaMetadata, A as MediaPathMap, F as MediaProcessingIssue, H as MediaSizeVariant, J as MermaidConfig, K as MermaidErrorIssue, R as MissingMediaIssue, S as OUTPUT_FILES, T as OutputFiles, U as PathHashMap, V as PipelineConfig, _ as PluginErrorIssue, a0 as PostCover, a1 as PostCoverError, a2 as PostCoverSize, a3 as PostMetadata, a4 as ProcessConfig, a5 as ProcessConfigWithDefaults, a6 as ProcessResult, a7 as ProcessedMedia, a9 as ProcessingIssue, aa as RelationshipType, ad as SlugConflictIssue, ae as SlugHashMap, ag as TocItem, ah as buildEmbeddingCacheFromManifest, ai as buildMediaCacheFromManifest, ak as createEmptyCacheStats, an as getMediaOutputDir, ao as getOutputDir, ap as isBrokenLinkIssue, aq as isEmbeddingErrorIssue, ar as isMediaProcessingIssue, as as isMermaidErrorIssue, at as isMissingMediaIssue, au as isPluginErrorIssue, av as isSlugConflictIssue, aw as withDefaults } from '../config-DFr-htlO.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Link resolution types for wiki-link and markdown link processing.
|
|
6
|
+
* Ported from @repo-md/repo-processor obsidian types.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
interface PageOnly {
|
|
10
|
+
type: 'page';
|
|
11
|
+
page: string;
|
|
12
|
+
alias?: string;
|
|
13
|
+
}
|
|
14
|
+
interface PageAndHeader {
|
|
15
|
+
type: 'page-header';
|
|
16
|
+
page: string;
|
|
17
|
+
header: string;
|
|
18
|
+
alias?: string;
|
|
19
|
+
}
|
|
20
|
+
interface PageAndBlock {
|
|
21
|
+
type: 'page-block';
|
|
22
|
+
page: string;
|
|
23
|
+
block: string;
|
|
24
|
+
alias?: string;
|
|
25
|
+
}
|
|
26
|
+
interface HeaderOnly {
|
|
27
|
+
type: 'header';
|
|
28
|
+
header: string;
|
|
29
|
+
alias?: string;
|
|
30
|
+
}
|
|
31
|
+
interface BlockOnly {
|
|
32
|
+
type: 'block';
|
|
33
|
+
block: string;
|
|
34
|
+
alias?: string;
|
|
35
|
+
}
|
|
36
|
+
type ObsidianLink = PageOnly | PageAndHeader | PageAndBlock | HeaderOnly | BlockOnly;
|
|
37
|
+
interface FileMap {
|
|
38
|
+
byPath: Map<string, ProcessedPost>;
|
|
39
|
+
bySlug: Map<string, ProcessedPost>;
|
|
40
|
+
byFileName: Map<string, ProcessedPost[]>;
|
|
41
|
+
byAlias: Map<string, ProcessedPost[]>;
|
|
42
|
+
}
|
|
43
|
+
interface LinkResolverOptions {
|
|
44
|
+
urlPrefix: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { type BlockOnly, type FileMap, type HeaderOnly, type LinkResolverOptions, type ObsidianLink, type PageAndBlock, type PageAndHeader, type PageOnly, ProcessedPost };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { a8 as ProcessedPost } from '../config-DFr-htlO.js';
|
|
2
|
+
export { B as BrokenLinkIssue, C as CacheContext, a as CacheStats, b as CachedMediaMetadata, c as CachedMediaSizeVariant, d as ContentConfig, D as DEFAULT_IMAGE_SIZES, h as DebugConfig, i as DirectoryConfig, E as EmbeddingErrorIssue, j as EmbeddingMap, G as GraphData, k as GraphEdge, l as GraphNode, q as ImageSizeConfig, r as IssueCategory, u as IssueFilterOptions, v as IssueModule, w as IssueReport, x as IssueSeverity, y as IssueSummary, M as MediaConfig, z as MediaMetadata, A as MediaPathMap, F as MediaProcessingIssue, H as MediaSizeVariant, J as MermaidConfig, K as MermaidErrorIssue, R as MissingMediaIssue, S as OUTPUT_FILES, T as OutputFiles, U as PathHashMap, V as PipelineConfig, _ as PluginErrorIssue, a0 as PostCover, a1 as PostCoverError, a2 as PostCoverSize, a3 as PostMetadata, a4 as ProcessConfig, a5 as ProcessConfigWithDefaults, a6 as ProcessResult, a7 as ProcessedMedia, a9 as ProcessingIssue, aa as RelationshipType, ad as SlugConflictIssue, ae as SlugHashMap, ag as TocItem, ah as buildEmbeddingCacheFromManifest, ai as buildMediaCacheFromManifest, ak as createEmptyCacheStats, an as getMediaOutputDir, ao as getOutputDir, ap as isBrokenLinkIssue, aq as isEmbeddingErrorIssue, ar as isMediaProcessingIssue, as as isMermaidErrorIssue, at as isMissingMediaIssue, au as isPluginErrorIssue, av as isSlugConflictIssue, aw as withDefaults } from '../config-DFr-htlO.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Link resolution types for wiki-link and markdown link processing.
|
|
6
|
+
* Ported from @repo-md/repo-processor obsidian types.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
interface PageOnly {
|
|
10
|
+
type: 'page';
|
|
11
|
+
page: string;
|
|
12
|
+
alias?: string;
|
|
13
|
+
}
|
|
14
|
+
interface PageAndHeader {
|
|
15
|
+
type: 'page-header';
|
|
16
|
+
page: string;
|
|
17
|
+
header: string;
|
|
18
|
+
alias?: string;
|
|
19
|
+
}
|
|
20
|
+
interface PageAndBlock {
|
|
21
|
+
type: 'page-block';
|
|
22
|
+
page: string;
|
|
23
|
+
block: string;
|
|
24
|
+
alias?: string;
|
|
25
|
+
}
|
|
26
|
+
interface HeaderOnly {
|
|
27
|
+
type: 'header';
|
|
28
|
+
header: string;
|
|
29
|
+
alias?: string;
|
|
30
|
+
}
|
|
31
|
+
interface BlockOnly {
|
|
32
|
+
type: 'block';
|
|
33
|
+
block: string;
|
|
34
|
+
alias?: string;
|
|
35
|
+
}
|
|
36
|
+
type ObsidianLink = PageOnly | PageAndHeader | PageAndBlock | HeaderOnly | BlockOnly;
|
|
37
|
+
interface FileMap {
|
|
38
|
+
byPath: Map<string, ProcessedPost>;
|
|
39
|
+
bySlug: Map<string, ProcessedPost>;
|
|
40
|
+
byFileName: Map<string, ProcessedPost[]>;
|
|
41
|
+
byAlias: Map<string, ProcessedPost[]>;
|
|
42
|
+
}
|
|
43
|
+
interface LinkResolverOptions {
|
|
44
|
+
urlPrefix: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { type BlockOnly, type FileMap, type HeaderOnly, type LinkResolverOptions, type ObsidianLink, type PageAndBlock, type PageAndHeader, type PageOnly, ProcessedPost };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { DEFAULT_IMAGE_SIZES, OUTPUT_FILES, buildEmbeddingCacheFromManifest, buildMediaCacheFromManifest, createEmptyCacheStats, getMediaOutputDir, getOutputDir, isBrokenLinkIssue, isEmbeddingErrorIssue, isMediaProcessingIssue, isMermaidErrorIssue, isMissingMediaIssue, isPluginErrorIssue, isSlugConflictIssue, withDefaults } from '../chunk-XP5J4LFJ.js';
|
|
2
|
+
import '../chunk-3RG5ZIWI.js';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('../chunk-OBGZSXTJ.cjs');
|
|
4
|
+
|
|
5
|
+
// src/server/index.ts
|
|
6
|
+
function createHandler(options) {
|
|
7
|
+
const { domain, basePath, fetch: fetchFn = globalThis.fetch } = options;
|
|
8
|
+
let baseUrl = domain.trim();
|
|
9
|
+
if (baseUrl.endsWith("/")) baseUrl = baseUrl.slice(0, -1);
|
|
10
|
+
if (!baseUrl.startsWith("http://") && !baseUrl.startsWith("https://")) {
|
|
11
|
+
baseUrl = `https://${baseUrl}`;
|
|
12
|
+
}
|
|
13
|
+
const prefix = basePath ? basePath.replace(/\/$/, "") : "";
|
|
14
|
+
return async (request) => {
|
|
15
|
+
const url = new URL(request.url);
|
|
16
|
+
let path = url.pathname;
|
|
17
|
+
if (prefix && path.startsWith(prefix)) {
|
|
18
|
+
path = path.slice(prefix.length) || "/";
|
|
19
|
+
}
|
|
20
|
+
const targetUrl = `${baseUrl}${path}${url.search}`;
|
|
21
|
+
const response = await fetchFn(targetUrl, {
|
|
22
|
+
method: request.method,
|
|
23
|
+
headers: {
|
|
24
|
+
Accept: request.headers.get("Accept") ?? "*/*",
|
|
25
|
+
"User-Agent": "folderblog-sdk/0.0.1"
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return new Response(response.body, {
|
|
29
|
+
status: response.status,
|
|
30
|
+
statusText: response.statusText,
|
|
31
|
+
headers: response.headers
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
exports.createHandler = createHandler;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* folderblog/server - Server-side middleware for embedding folder.blog content
|
|
3
|
+
*
|
|
4
|
+
* Provides a Web Standard Request/Response handler that works with
|
|
5
|
+
* any framework (Hono, Express via adapter, Next.js, etc.)
|
|
6
|
+
*
|
|
7
|
+
* @example Hono
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { Hono } from 'hono';
|
|
10
|
+
* import { createHandler } from 'folderblog/server';
|
|
11
|
+
*
|
|
12
|
+
* const app = new Hono();
|
|
13
|
+
* const handler = createHandler({ domain: 'yourname.folder.blog' });
|
|
14
|
+
*
|
|
15
|
+
* app.get('/blog/*', (c) => handler(c.req.raw));
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @example Node.js
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { createHandler } from 'folderblog/server';
|
|
21
|
+
*
|
|
22
|
+
* const handler = createHandler({ domain: 'yourname.folder.blog' });
|
|
23
|
+
* // Use with any Request/Response compatible server
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @packageDocumentation
|
|
27
|
+
*/
|
|
28
|
+
interface FolderBlogHandlerOptions {
|
|
29
|
+
/** The folder.blog domain to proxy (e.g. 'yourname.folder.blog') */
|
|
30
|
+
domain: string;
|
|
31
|
+
/** Base path prefix to strip from incoming requests (e.g. '/blog') */
|
|
32
|
+
basePath?: string;
|
|
33
|
+
/** Custom fetch implementation */
|
|
34
|
+
fetch?: typeof fetch;
|
|
35
|
+
}
|
|
36
|
+
type FolderBlogHandler = (request: Request) => Promise<Response>;
|
|
37
|
+
/**
|
|
38
|
+
* Create a Web Standard handler that proxies requests to a folder.blog site.
|
|
39
|
+
*
|
|
40
|
+
* Maps incoming request paths to the blog's API and returns the response.
|
|
41
|
+
* Strips the basePath prefix if provided.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const handler = createHandler({
|
|
46
|
+
* domain: 'yourname.folder.blog',
|
|
47
|
+
* basePath: '/blog',
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* // GET /blog/api/posts → proxied to yourname.folder.blog/api/posts
|
|
51
|
+
* const response = await handler(request);
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
declare function createHandler(options: FolderBlogHandlerOptions): FolderBlogHandler;
|
|
55
|
+
|
|
56
|
+
export { type FolderBlogHandler, type FolderBlogHandlerOptions, createHandler };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* folderblog/server - Server-side middleware for embedding folder.blog content
|
|
3
|
+
*
|
|
4
|
+
* Provides a Web Standard Request/Response handler that works with
|
|
5
|
+
* any framework (Hono, Express via adapter, Next.js, etc.)
|
|
6
|
+
*
|
|
7
|
+
* @example Hono
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { Hono } from 'hono';
|
|
10
|
+
* import { createHandler } from 'folderblog/server';
|
|
11
|
+
*
|
|
12
|
+
* const app = new Hono();
|
|
13
|
+
* const handler = createHandler({ domain: 'yourname.folder.blog' });
|
|
14
|
+
*
|
|
15
|
+
* app.get('/blog/*', (c) => handler(c.req.raw));
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @example Node.js
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { createHandler } from 'folderblog/server';
|
|
21
|
+
*
|
|
22
|
+
* const handler = createHandler({ domain: 'yourname.folder.blog' });
|
|
23
|
+
* // Use with any Request/Response compatible server
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @packageDocumentation
|
|
27
|
+
*/
|
|
28
|
+
interface FolderBlogHandlerOptions {
|
|
29
|
+
/** The folder.blog domain to proxy (e.g. 'yourname.folder.blog') */
|
|
30
|
+
domain: string;
|
|
31
|
+
/** Base path prefix to strip from incoming requests (e.g. '/blog') */
|
|
32
|
+
basePath?: string;
|
|
33
|
+
/** Custom fetch implementation */
|
|
34
|
+
fetch?: typeof fetch;
|
|
35
|
+
}
|
|
36
|
+
type FolderBlogHandler = (request: Request) => Promise<Response>;
|
|
37
|
+
/**
|
|
38
|
+
* Create a Web Standard handler that proxies requests to a folder.blog site.
|
|
39
|
+
*
|
|
40
|
+
* Maps incoming request paths to the blog's API and returns the response.
|
|
41
|
+
* Strips the basePath prefix if provided.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const handler = createHandler({
|
|
46
|
+
* domain: 'yourname.folder.blog',
|
|
47
|
+
* basePath: '/blog',
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* // GET /blog/api/posts → proxied to yourname.folder.blog/api/posts
|
|
51
|
+
* const response = await handler(request);
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
declare function createHandler(options: FolderBlogHandlerOptions): FolderBlogHandler;
|
|
55
|
+
|
|
56
|
+
export { type FolderBlogHandler, type FolderBlogHandlerOptions, createHandler };
|