@conloca/content-api 0.1.14 → 0.1.16
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/dist/asset-manifest.d.ts +23 -0
- package/dist/asset-manifest.d.ts.map +1 -0
- package/dist/asset-manifest.js +73 -0
- package/dist/asset-operations.d.ts +159 -0
- package/dist/asset-operations.d.ts.map +1 -0
- package/dist/asset-operations.js +736 -0
- package/dist/asset-types.d.ts +56 -0
- package/dist/asset-types.d.ts.map +1 -0
- package/dist/asset-types.js +7 -0
- package/dist/base-content-index.d.ts +57 -0
- package/dist/base-content-index.d.ts.map +1 -0
- package/dist/base-content-index.js +179 -0
- package/dist/block-index.d.ts +9 -0
- package/dist/block-index.d.ts.map +1 -0
- package/dist/block-index.js +11 -0
- package/dist/blocks.d.ts +16 -0
- package/dist/blocks.d.ts.map +1 -0
- package/dist/blocks.js +103 -0
- package/dist/cf-access.d.ts +31 -0
- package/dist/cf-access.d.ts.map +1 -0
- package/dist/cf-access.js +66 -0
- package/dist/component-registry.d.ts +50 -0
- package/dist/component-registry.d.ts.map +1 -0
- package/dist/component-registry.js +120 -0
- package/dist/component-registry.types-C0ctF9nh.d.mts +71 -0
- package/dist/component-registry.types-C0ctF9nh.d.mts.map +1 -0
- package/dist/component-registry.types.d.ts +11 -0
- package/dist/component-registry.types.d.ts.map +1 -0
- package/dist/component-registry.types.js +1 -0
- package/dist/content-api.interface.d.ts +64 -0
- package/dist/content-api.interface.d.ts.map +1 -0
- package/dist/content-api.interface.js +1 -0
- package/dist/content-filters.d.ts +31 -0
- package/dist/content-filters.d.ts.map +1 -0
- package/dist/content-filters.js +246 -0
- package/dist/content-index-D092_vk1.mjs +629 -0
- package/dist/content-index-D092_vk1.mjs.map +1 -0
- package/dist/content-index-D6IVMmAB.d.mts +127 -0
- package/dist/content-index-D6IVMmAB.d.mts.map +1 -0
- package/dist/content-index.d.ts +126 -0
- package/dist/content-index.d.ts.map +1 -0
- package/dist/content-index.js +418 -0
- package/dist/content-operations-DIbsxG5A.d.mts +354 -0
- package/dist/content-operations-DIbsxG5A.d.mts.map +1 -0
- package/dist/content-operations.d.ts +93 -0
- package/dist/content-operations.d.ts.map +1 -0
- package/dist/content-operations.js +275 -0
- package/dist/content-reader.d.ts +10 -0
- package/dist/content-reader.d.ts.map +1 -0
- package/dist/content-reader.js +13 -0
- package/dist/content-utils-fWNHTrPy.mjs +280 -0
- package/dist/content-utils-fWNHTrPy.mjs.map +1 -0
- package/dist/content-utils.d.ts +132 -0
- package/dist/content-utils.d.ts.map +1 -0
- package/dist/content-utils.js +352 -0
- package/dist/content-watcher.d.ts +43 -0
- package/dist/content-watcher.d.ts.map +1 -0
- package/dist/content-watcher.js +83 -0
- package/dist/data-DquNIEnQ.mjs +62 -0
- package/dist/data-DquNIEnQ.mjs.map +1 -0
- package/dist/data-index.d.ts +8 -0
- package/dist/data-index.d.ts.map +1 -0
- package/dist/data-index.js +7 -0
- package/dist/data.d.ts +43 -0
- package/dist/data.d.ts.map +1 -0
- package/dist/data.js +103 -0
- package/dist/etag-utils.d.ts +77 -0
- package/dist/etag-utils.d.ts.map +1 -0
- package/dist/etag-utils.js +160 -0
- package/dist/filesystem-content-api-B1KIQJfk.mjs +2 -0
- package/dist/filesystem-content-api-C0HIhqZi.mjs +1620 -0
- package/dist/filesystem-content-api-C0HIhqZi.mjs.map +1 -0
- package/dist/filesystem-content-api-DCdNi-co.d.mts +134 -0
- package/dist/filesystem-content-api-DCdNi-co.d.mts.map +1 -0
- package/dist/filesystem-content-api.d.ts +135 -0
- package/dist/filesystem-content-api.d.ts.map +1 -0
- package/dist/filesystem-content-api.js +2181 -0
- package/dist/git-operations.d.ts +49 -0
- package/dist/git-operations.d.ts.map +1 -0
- package/dist/git-operations.js +252 -0
- package/dist/header-parser.d.ts +37 -0
- package/dist/header-parser.d.ts.map +1 -0
- package/dist/header-parser.js +286 -0
- package/dist/in-memory-content-api.d.ts +35 -0
- package/dist/in-memory-content-api.d.ts.map +1 -0
- package/dist/in-memory-content-api.js +591 -0
- package/dist/index-DxVTFK66.d.mts +105 -0
- package/dist/index-DxVTFK66.d.mts.map +1 -0
- package/dist/index.d.mts +6 -4
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.mjs +37 -5
- package/dist/index.mjs.map +1 -1
- package/dist/indexing.d.mts +152 -0
- package/dist/indexing.d.mts.map +1 -0
- package/dist/indexing.d.ts +5 -0
- package/dist/indexing.d.ts.map +1 -0
- package/dist/indexing.js +7 -0
- package/dist/indexing.mjs +255 -0
- package/dist/indexing.mjs.map +1 -0
- package/dist/json-whitespace-view.d.ts +32 -0
- package/dist/json-whitespace-view.d.ts.map +1 -0
- package/dist/json-whitespace-view.js +152 -0
- package/dist/middleware.d.ts +20 -0
- package/dist/middleware.d.ts.map +1 -0
- package/dist/middleware.js +1031 -0
- package/dist/node.d.mts +28 -126
- package/dist/node.d.mts.map +1 -1
- package/dist/node.d.ts +25 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +24 -0
- package/dist/node.mjs +199 -2890
- package/dist/node.mjs.map +1 -1
- package/dist/reader.d.mts +15 -0
- package/dist/reader.d.mts.map +1 -0
- package/dist/reader.d.ts +15 -0
- package/dist/reader.d.ts.map +1 -0
- package/dist/reader.js +13 -0
- package/dist/reader.mjs +22 -0
- package/dist/reader.mjs.map +1 -0
- package/dist/schemas/index.d.mts +2 -90
- package/dist/schemas/index.d.ts +102 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +87 -0
- package/dist/schemas/index.mjs +2 -70
- package/dist/schemas-CFRD0FIQ.mjs +84 -0
- package/dist/schemas-CFRD0FIQ.mjs.map +1 -0
- package/dist/{types-BUG0Cfkg.mjs → site-8oaj1Q60.mjs} +20 -222
- package/dist/site-8oaj1Q60.mjs.map +1 -0
- package/dist/site-index-B_254bCc.d.mts +136 -0
- package/dist/site-index-B_254bCc.d.mts.map +1 -0
- package/dist/site-index.d.ts +60 -0
- package/dist/site-index.d.ts.map +1 -0
- package/dist/site-index.js +287 -0
- package/dist/site.d.ts +21 -0
- package/dist/site.d.ts.map +1 -0
- package/dist/site.js +168 -0
- package/dist/types-DOdldbfD.mjs +34 -0
- package/dist/types-DOdldbfD.mjs.map +1 -0
- package/dist/types-DjfhS272.d.mts +456 -0
- package/dist/types-DjfhS272.d.mts.map +1 -0
- package/dist/types.d.ts +453 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +36 -0
- package/dist/url-safe-base64.d.ts +12 -0
- package/dist/url-safe-base64.d.ts.map +1 -0
- package/dist/url-safe-base64.js +40 -0
- package/dist/url-validation.d.ts +14 -0
- package/dist/url-validation.d.ts.map +1 -0
- package/dist/url-validation.js +81 -0
- package/dist/utils/atomic-write.d.ts +6 -0
- package/dist/utils/atomic-write.d.ts.map +1 -0
- package/dist/utils/atomic-write.js +20 -0
- package/dist/utils.d.ts +46 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +70 -0
- package/dist/vite-plugin.d.ts +12 -0
- package/dist/vite-plugin.d.ts.map +1 -0
- package/dist/vite-plugin.js +29 -0
- package/dist/vxjson-qHrgLGip.mjs +555 -0
- package/dist/vxjson-qHrgLGip.mjs.map +1 -0
- package/dist/vxjson-serialize-geF6qvpn.mjs +34 -0
- package/dist/vxjson-serialize-geF6qvpn.mjs.map +1 -0
- package/dist/vxjson-serialize.d.mts +17 -0
- package/dist/vxjson-serialize.d.mts.map +1 -0
- package/dist/vxjson-serialize.d.ts +14 -0
- package/dist/vxjson-serialize.d.ts.map +1 -0
- package/dist/vxjson-serialize.js +50 -0
- package/dist/vxjson-serialize.mjs +2 -0
- package/dist/vxjson.d.ts +112 -0
- package/dist/vxjson.d.ts.map +1 -0
- package/dist/vxjson.js +391 -0
- package/dist/xxhash.d.ts +10 -0
- package/dist/xxhash.d.ts.map +1 -0
- package/dist/xxhash.js +31 -0
- package/package.json +88 -17
- package/dist/content-operations-BZLfJWqT.d.mts +0 -916
- package/dist/content-operations-BZLfJWqT.d.mts.map +0 -1
- package/dist/schemas/index.d.mts.map +0 -1
- package/dist/schemas/index.mjs.map +0 -1
- package/dist/types-BUG0Cfkg.mjs.map +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zero-allocation JSON whitespace-skipping stream transform
|
|
3
|
+
* Skips whitespace outside of JSON strings, preserving whitespace inside strings
|
|
4
|
+
* Optimized to process multiple bytes at once when possible
|
|
5
|
+
*/
|
|
6
|
+
export declare class JsonWhitespaceSkippingView {
|
|
7
|
+
private downstream;
|
|
8
|
+
private inString;
|
|
9
|
+
private escaped;
|
|
10
|
+
private singleByte;
|
|
11
|
+
constructor(downstream: {
|
|
12
|
+
update(data: Uint8Array): void;
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* Process a single byte from JSON stream
|
|
16
|
+
* @param byte - The byte to process
|
|
17
|
+
*/
|
|
18
|
+
updateByte(byte: number): void;
|
|
19
|
+
/**
|
|
20
|
+
* Process a buffer range with simple batching
|
|
21
|
+
* Collects consecutive bytes that should be included
|
|
22
|
+
* @param buffer - The buffer to process
|
|
23
|
+
* @param start - Start position (inclusive)
|
|
24
|
+
* @param end - End position (exclusive)
|
|
25
|
+
*/
|
|
26
|
+
updateBuffer(buffer: Uint8Array, start?: number, end?: number): void;
|
|
27
|
+
/**
|
|
28
|
+
* Reset the parser state
|
|
29
|
+
*/
|
|
30
|
+
reset(): void;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=json-whitespace-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-whitespace-view.d.ts","sourceRoot":"","sources":["../src/json-whitespace-view.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,0BAA0B;IAKzB,OAAO,CAAC,UAAU;IAJ9B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,UAAU,CAAqB;IAEvC,YAAoB,UAAU,EAAE;QAAE,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAA;KAAE,EAAI;IAEtE;;;OAGG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAqC7B;IAED;;;;;;OAMG;IACH,YAAY,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,SAAI,EAAE,GAAG,SAAgB,GAAG,IAAI,CAmFrE;IAED;;OAEG;IACH,KAAK,IAAI,IAAI,CAGZ;CACF"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zero-allocation JSON whitespace-skipping stream transform
|
|
3
|
+
* Skips whitespace outside of JSON strings, preserving whitespace inside strings
|
|
4
|
+
* Optimized to process multiple bytes at once when possible
|
|
5
|
+
*/
|
|
6
|
+
export class JsonWhitespaceSkippingView {
|
|
7
|
+
downstream;
|
|
8
|
+
inString = false;
|
|
9
|
+
escaped = false;
|
|
10
|
+
singleByte = new Uint8Array(1); // Reused allocation for single bytes
|
|
11
|
+
constructor(downstream) {
|
|
12
|
+
this.downstream = downstream;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Process a single byte from JSON stream
|
|
16
|
+
* @param byte - The byte to process
|
|
17
|
+
*/
|
|
18
|
+
updateByte(byte) {
|
|
19
|
+
let shouldInclude = false;
|
|
20
|
+
if (this.inString) {
|
|
21
|
+
// Inside string: always include the byte
|
|
22
|
+
shouldInclude = true;
|
|
23
|
+
if (this.escaped) {
|
|
24
|
+
this.escaped = false;
|
|
25
|
+
}
|
|
26
|
+
else if (byte === 0x5c) {
|
|
27
|
+
// backslash
|
|
28
|
+
this.escaped = true;
|
|
29
|
+
}
|
|
30
|
+
else if (byte === 0x22) {
|
|
31
|
+
// quote
|
|
32
|
+
this.inString = false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
// Outside string: check for string start or skip whitespace
|
|
37
|
+
if (byte === 0x22) {
|
|
38
|
+
// 0x22 is the double quote character (")
|
|
39
|
+
// quote
|
|
40
|
+
this.inString = true;
|
|
41
|
+
shouldInclude = true;
|
|
42
|
+
}
|
|
43
|
+
// Check tab (0x09) first as it's the most common whitespace in our tab-indented VXJSON files
|
|
44
|
+
// Then space (0x20), newline (0x0a), carriage return (0x0d)
|
|
45
|
+
else if (byte !== 0x09 && byte !== 0x20 && byte !== 0x0a && byte !== 0x0d) {
|
|
46
|
+
// Not whitespace, include it
|
|
47
|
+
shouldInclude = true;
|
|
48
|
+
}
|
|
49
|
+
// Skip whitespace outside strings
|
|
50
|
+
}
|
|
51
|
+
if (shouldInclude) {
|
|
52
|
+
this.singleByte[0] = byte;
|
|
53
|
+
this.downstream.update(this.singleByte);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Process a buffer range with simple batching
|
|
58
|
+
* Collects consecutive bytes that should be included
|
|
59
|
+
* @param buffer - The buffer to process
|
|
60
|
+
* @param start - Start position (inclusive)
|
|
61
|
+
* @param end - End position (exclusive)
|
|
62
|
+
*/
|
|
63
|
+
updateBuffer(buffer, start = 0, end = buffer.length) {
|
|
64
|
+
let pos = start;
|
|
65
|
+
let runStart = start;
|
|
66
|
+
while (pos < end) {
|
|
67
|
+
const byte = buffer[pos];
|
|
68
|
+
let shouldInclude = false;
|
|
69
|
+
if (this.inString) {
|
|
70
|
+
// Inside string: always include
|
|
71
|
+
shouldInclude = true;
|
|
72
|
+
if (this.escaped) {
|
|
73
|
+
this.escaped = false;
|
|
74
|
+
}
|
|
75
|
+
else if (byte === 0x5c) {
|
|
76
|
+
// backslash
|
|
77
|
+
this.escaped = true;
|
|
78
|
+
}
|
|
79
|
+
else if (byte === 0x22) {
|
|
80
|
+
// quote - end of string
|
|
81
|
+
this.inString = false;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
// Regular character - use indexOf to skip to next quote
|
|
85
|
+
pos++;
|
|
86
|
+
let searchPos = pos;
|
|
87
|
+
while (searchPos < end) {
|
|
88
|
+
const quotePos = buffer.indexOf(0x22, searchPos);
|
|
89
|
+
if (quotePos === -1 || quotePos >= end) {
|
|
90
|
+
// No more quotes
|
|
91
|
+
pos = end;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
// Count consecutive backslashes before the quote
|
|
95
|
+
let backslashCount = 0;
|
|
96
|
+
let checkPos = quotePos - 1;
|
|
97
|
+
while (checkPos >= 0 && buffer[checkPos] === 0x5c) {
|
|
98
|
+
backslashCount++;
|
|
99
|
+
checkPos--;
|
|
100
|
+
}
|
|
101
|
+
if (backslashCount % 2 === 0) {
|
|
102
|
+
// Even backslashes (including 0) - quote is not escaped
|
|
103
|
+
pos = quotePos + 1;
|
|
104
|
+
this.inString = false;
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
// Odd backslashes - quote is escaped, continue searching
|
|
108
|
+
searchPos = quotePos + 1;
|
|
109
|
+
}
|
|
110
|
+
continue; // Skip the pos++ at the bottom
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
// Outside string
|
|
115
|
+
if (byte === 0x22) {
|
|
116
|
+
// quote - start of string
|
|
117
|
+
this.inString = true;
|
|
118
|
+
shouldInclude = true;
|
|
119
|
+
// Check tab (0x09) first as it's the most common whitespace in our tab-indented VXJSON files
|
|
120
|
+
// Then space (0x20), newline (0x0a), carriage return (0x0d)
|
|
121
|
+
}
|
|
122
|
+
else if (byte !== 0x09 && byte !== 0x20 && byte !== 0x0a && byte !== 0x0d) {
|
|
123
|
+
// Not whitespace
|
|
124
|
+
shouldInclude = true;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (shouldInclude) {
|
|
128
|
+
// Continue the run
|
|
129
|
+
pos++;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
// End of run - send what we have
|
|
133
|
+
if (pos > runStart) {
|
|
134
|
+
this.downstream.update(buffer.subarray(runStart, pos));
|
|
135
|
+
}
|
|
136
|
+
pos++;
|
|
137
|
+
runStart = pos;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
// Send any remaining bytes
|
|
141
|
+
if (pos > runStart) {
|
|
142
|
+
this.downstream.update(buffer.subarray(runStart, pos));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Reset the parser state
|
|
147
|
+
*/
|
|
148
|
+
reset() {
|
|
149
|
+
this.inString = false;
|
|
150
|
+
this.escaped = false;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Hono } from 'hono';
|
|
2
|
+
import { type AssetConfig } from './asset-operations';
|
|
3
|
+
import type { ContentAPI } from './content-api.interface';
|
|
4
|
+
/**
|
|
5
|
+
* Create REST API router using Hono
|
|
6
|
+
* Implements the ID-based API specification from implementation-plan.md
|
|
7
|
+
*/
|
|
8
|
+
export interface ContentAPIRouterOptions {
|
|
9
|
+
assetsPath?: string;
|
|
10
|
+
assetConfig?: Omit<AssetConfig, 'assetsPath'>;
|
|
11
|
+
/** Content root directory for asset usage tracking */
|
|
12
|
+
contentRoot?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function createContentAPIRouter(api: ContentAPI, options?: ContentAPIRouterOptions): Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
|
|
15
|
+
/**
|
|
16
|
+
* Create middleware for backwards compatibility with existing code
|
|
17
|
+
* This wraps the Hono app to work with Node.js IncomingMessage/ServerResponse
|
|
18
|
+
*/
|
|
19
|
+
export declare function createContentMiddleware(contentApi: ContentAPI, options?: ContentAPIRouterOptions): (req: any, res: any, next: () => void) => Promise<void>;
|
|
20
|
+
//# sourceMappingURL=middleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../src/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,KAAK,WAAW,EAAmB,MAAM,oBAAoB,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AA+B1D;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IAC9C,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,uBAAuB,8EAiqCxF;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,uBAAuB,SAI5E,GAAG,OAAO,GAAG,QAAQ,MAAM,IAAI,mBAkCnD"}
|