polen 0.10.0-next.13 → 0.10.0-next.14
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/build/api/vite/plugins/build.d.ts.map +1 -1
- package/build/api/vite/plugins/build.js +11 -3
- package/build/api/vite/plugins/build.js.map +1 -1
- package/build/api/vite/plugins/core.d.ts.map +1 -1
- package/build/api/vite/plugins/core.js +12 -10
- package/build/api/vite/plugins/core.js.map +1 -1
- package/build/api/vite/plugins/pages.d.ts.map +1 -1
- package/build/api/vite/plugins/pages.js +6 -7
- package/build/api/vite/plugins/pages.js.map +1 -1
- package/build/api/vite/plugins/serve.d.ts.map +1 -1
- package/build/api/vite/plugins/serve.js +47 -7
- package/build/api/vite/plugins/serve.js.map +1 -1
- package/build/lib/file-router/diagnostic-reporter.js +2 -2
- package/build/lib/file-router/diagnostic-reporter.js.map +1 -1
- package/build/lib/graphql-document/components/GraphQLDocument.d.ts.map +1 -1
- package/build/lib/graphql-document/components/GraphQLDocument.js +23 -11
- package/build/lib/graphql-document/components/GraphQLDocument.js.map +1 -1
- package/build/lib/graphql-document/positioning-simple.d.ts +0 -5
- package/build/lib/graphql-document/positioning-simple.d.ts.map +1 -1
- package/build/lib/graphql-document/positioning-simple.js +78 -90
- package/build/lib/graphql-document/positioning-simple.js.map +1 -1
- package/build/lib/kit-temp.d.ts +103 -0
- package/build/lib/kit-temp.d.ts.map +1 -1
- package/build/lib/kit-temp.js +236 -2
- package/build/lib/kit-temp.js.map +1 -1
- package/build/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.d.ts +1 -8
- package/build/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.d.ts.map +1 -1
- package/build/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.js +48 -53
- package/build/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.js.map +1 -1
- package/build/package-paths.js +3 -3
- package/build/package-paths.js.map +1 -1
- package/build/template/components/Link.d.ts +1 -1
- package/build/template/components/Link.d.ts.map +1 -1
- package/build/template/components/Link.js +14 -5
- package/build/template/components/Link.js.map +1 -1
- package/build/template/components/content/GraphQLDocumentWithSchema.d.ts.map +1 -1
- package/build/template/components/content/GraphQLDocumentWithSchema.js +0 -3
- package/build/template/components/content/GraphQLDocumentWithSchema.js.map +1 -1
- package/build/template/components/content/GraphQLDocumentWrapper.d.ts.map +1 -1
- package/build/template/components/content/GraphQLDocumentWrapper.js +8 -7
- package/build/template/components/content/GraphQLDocumentWrapper.js.map +1 -1
- package/build/template/components/sidebar/SidebarItem.js +2 -2
- package/build/template/entry.client.d.ts.map +1 -1
- package/build/template/entry.client.js +0 -3
- package/build/template/entry.client.js.map +1 -1
- package/build/template/hooks/useClientOnly.d.ts +9 -0
- package/build/template/hooks/useClientOnly.d.ts.map +1 -0
- package/build/template/hooks/useClientOnly.js +16 -0
- package/build/template/hooks/useClientOnly.js.map +1 -0
- package/build/template/routes/root.d.ts.map +1 -1
- package/build/template/routes/root.js +2 -150
- package/build/template/routes/root.js.map +1 -1
- package/build/template/server/app.d.ts +8 -1
- package/build/template/server/app.d.ts.map +1 -1
- package/build/template/server/app.js +21 -21
- package/build/template/server/app.js.map +1 -1
- package/build/template/server/create-page-html-response.d.ts +7 -0
- package/build/template/server/create-page-html-response.d.ts.map +1 -0
- package/build/template/server/{render-page.js → create-page-html-response.js} +11 -16
- package/build/template/server/create-page-html-response.js.map +1 -0
- package/build/template/server/main.js +2 -1
- package/build/template/server/main.js.map +1 -1
- package/build/template/server/middleware/page.d.ts +4 -0
- package/build/template/server/middleware/page.d.ts.map +1 -0
- package/build/template/server/middleware/page.js +15 -0
- package/build/template/server/middleware/page.js.map +1 -0
- package/build/template/server/middleware/unsupported-assets.d.ts +10 -0
- package/build/template/server/middleware/unsupported-assets.d.ts.map +1 -0
- package/build/template/server/middleware/unsupported-assets.js +21 -0
- package/build/template/server/middleware/unsupported-assets.js.map +1 -0
- package/build/template/server/ssg/generate.d.ts.map +1 -1
- package/build/template/server/ssg/generate.js +33 -34
- package/build/template/server/ssg/generate.js.map +1 -1
- package/build/template/styles/code-block.css +218 -0
- package/package.json +3 -2
- package/src/api/singletons/markdown/markdown.test.ts +1 -1
- package/src/api/vite/plugins/build.ts +97 -89
- package/src/api/vite/plugins/core.ts +15 -10
- package/src/api/vite/plugins/pages.ts +9 -7
- package/src/api/vite/plugins/serve.ts +62 -9
- package/src/lib/file-router/diagnostic-reporter.ts +2 -2
- package/src/lib/graphql-document/components/GraphQLDocument.tsx +23 -11
- package/src/lib/graphql-document/positioning-simple.test.ts +18 -22
- package/src/lib/graphql-document/positioning-simple.ts +97 -108
- package/src/lib/kit-temp.test.ts +15 -3
- package/src/lib/kit-temp.ts +304 -4
- package/src/lib/vite-plugin-reactive-data/vite-plugin-reactive-data.ts +52 -58
- package/src/package-paths.ts +3 -3
- package/src/template/components/Link.tsx +20 -12
- package/src/template/components/content/GraphQLDocumentWithSchema.tsx +0 -5
- package/src/template/components/content/GraphQLDocumentWrapper.tsx +14 -7
- package/src/template/components/sidebar/SidebarItem.tsx +2 -2
- package/src/template/entry.client.tsx +0 -3
- package/src/template/hooks/useClientOnly.ts +21 -0
- package/src/template/routes/root.tsx +0 -159
- package/src/template/server/app.ts +33 -23
- package/src/template/server/{render-page.tsx → create-page-html-response.ts} +19 -16
- package/src/template/server/main.ts +2 -1
- package/src/template/server/middleware/page.ts +19 -0
- package/src/template/server/middleware/unsupported-assets.ts +25 -0
- package/src/template/server/ssg/generate.ts +68 -72
- package/build/template/server/render-page.d.ts +0 -3
- package/build/template/server/render-page.d.ts.map +0 -1
- package/build/template/server/render-page.js.map +0 -1
@@ -20,21 +20,85 @@ export class SimplePositionCalculator {
|
|
20
20
|
* Prepare a code block for positioning by wrapping identifiers in spans
|
21
21
|
*/
|
22
22
|
prepareCodeBlock(containerElement, identifiers) {
|
23
|
-
//
|
24
|
-
const
|
25
|
-
|
26
|
-
|
27
|
-
|
23
|
+
// Get the full text content of the container
|
24
|
+
const fullText = containerElement.textContent || '';
|
25
|
+
const lines = fullText.split('\n');
|
26
|
+
// Build a map of line start positions in the full text
|
27
|
+
const lineStartPositions = [0];
|
28
|
+
for (let i = 0; i < lines.length - 1; i++) {
|
29
|
+
const lineLength = lines[i]?.length ?? 0;
|
30
|
+
lineStartPositions.push(lineStartPositions[i] + lineLength + 1); // +1 for newline
|
31
|
+
}
|
32
|
+
// Process identifiers by line
|
33
|
+
for (const identifier of identifiers) {
|
34
|
+
const lineIndex = identifier.position.line - 1;
|
35
|
+
if (lineIndex >= lines.length || lineIndex < 0)
|
36
|
+
continue;
|
37
|
+
const lineText = lines[lineIndex];
|
38
|
+
if (!lineText)
|
39
|
+
continue;
|
40
|
+
const columnIndex = identifier.position.column - 1;
|
41
|
+
// Check if the identifier exists at the expected position
|
42
|
+
if (lineText.substring(columnIndex).startsWith(identifier.name)) {
|
43
|
+
// Calculate the absolute position in the full text
|
44
|
+
const lineStartPosition = lineStartPositions[lineIndex] ?? 0;
|
45
|
+
const absolutePosition = lineStartPosition + columnIndex;
|
46
|
+
// Check if already wrapped at this specific position
|
47
|
+
const existingWrapped = containerElement.querySelectorAll(`[data-graphql-id]`);
|
48
|
+
let alreadyWrapped = false;
|
49
|
+
for (const wrapped of existingWrapped) {
|
50
|
+
if (wrapped.textContent === identifier.name) {
|
51
|
+
const startPos = parseInt(wrapped.getAttribute('data-graphql-start') || '0');
|
52
|
+
if (startPos === identifier.position.start) {
|
53
|
+
alreadyWrapped = true;
|
54
|
+
break;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
if (alreadyWrapped)
|
59
|
+
continue;
|
60
|
+
// Create wrapper span
|
61
|
+
const wrapper = document.createElement('span');
|
62
|
+
const id = `${identifier.position.start}-${identifier.name}-${identifier.kind}`;
|
63
|
+
wrapper.setAttribute('data-graphql-id', id);
|
64
|
+
wrapper.setAttribute('data-graphql-name', identifier.name);
|
65
|
+
wrapper.setAttribute('data-graphql-kind', identifier.kind);
|
66
|
+
wrapper.setAttribute('data-graphql-start', String(identifier.position.start));
|
67
|
+
wrapper.setAttribute('data-graphql-end', String(identifier.position.end));
|
68
|
+
wrapper.setAttribute('data-graphql-line', String(identifier.position.line));
|
69
|
+
wrapper.setAttribute('data-graphql-column', String(identifier.position.column));
|
70
|
+
wrapper.setAttribute('data-graphql-path', identifier.schemaPath.join(','));
|
71
|
+
// Find the position in the container and wrap the text
|
72
|
+
const walker = document.createTreeWalker(containerElement, NodeFilter.SHOW_TEXT, null);
|
73
|
+
let currentPos = 0;
|
74
|
+
let node;
|
75
|
+
while (node = walker.nextNode()) {
|
76
|
+
const textNode = node;
|
77
|
+
const text = textNode.textContent || '';
|
78
|
+
// Check if this text node contains our identifier
|
79
|
+
if (currentPos <= absolutePosition && absolutePosition < currentPos + text.length) {
|
80
|
+
const relativePos = absolutePosition - currentPos;
|
81
|
+
if (text.substring(relativePos).startsWith(identifier.name)) {
|
82
|
+
// Split the text node
|
83
|
+
const before = text.substring(0, relativePos);
|
84
|
+
const identifierText = identifier.name;
|
85
|
+
const after = text.substring(relativePos + identifierText.length);
|
86
|
+
const parent = textNode.parentNode;
|
87
|
+
if (before) {
|
88
|
+
parent.insertBefore(document.createTextNode(before), textNode);
|
89
|
+
}
|
90
|
+
wrapper.textContent = identifierText;
|
91
|
+
parent.insertBefore(wrapper, textNode);
|
92
|
+
if (after) {
|
93
|
+
parent.insertBefore(document.createTextNode(after), textNode);
|
94
|
+
}
|
95
|
+
parent.removeChild(textNode);
|
96
|
+
break;
|
97
|
+
}
|
98
|
+
}
|
99
|
+
currentPos += text.length;
|
100
|
+
}
|
28
101
|
}
|
29
|
-
// Then by column (right to left)
|
30
|
-
return b.position.column - a.position.column;
|
31
|
-
});
|
32
|
-
// Process all identifiers
|
33
|
-
let wrappedCount = 0;
|
34
|
-
for (const identifier of sortedIdentifiers) {
|
35
|
-
const wrapped = this.wrapIdentifier(containerElement, identifier);
|
36
|
-
if (wrapped)
|
37
|
-
wrappedCount++;
|
38
102
|
}
|
39
103
|
}
|
40
104
|
/**
|
@@ -76,82 +140,6 @@ export class SimplePositionCalculator {
|
|
76
140
|
}
|
77
141
|
return results;
|
78
142
|
}
|
79
|
-
/**
|
80
|
-
* Wrap an identifier in a span for positioning
|
81
|
-
* Returns true if the identifier was successfully wrapped
|
82
|
-
*/
|
83
|
-
wrapIdentifier(containerElement, identifier) {
|
84
|
-
const walker = document.createTreeWalker(containerElement, NodeFilter.SHOW_TEXT, null);
|
85
|
-
let currentLine = 1;
|
86
|
-
let currentColumn = 1;
|
87
|
-
let node;
|
88
|
-
while (node = walker.nextNode()) {
|
89
|
-
const textNode = node;
|
90
|
-
const text = textNode.textContent || '';
|
91
|
-
// Check if already wrapped
|
92
|
-
if (textNode.parentElement?.hasAttribute('data-graphql-id')) {
|
93
|
-
// Update position tracking and continue
|
94
|
-
for (const char of text) {
|
95
|
-
if (char === '\n') {
|
96
|
-
currentLine++;
|
97
|
-
currentColumn = 1;
|
98
|
-
}
|
99
|
-
else {
|
100
|
-
currentColumn++;
|
101
|
-
}
|
102
|
-
}
|
103
|
-
continue;
|
104
|
-
}
|
105
|
-
// Track position in the text
|
106
|
-
let textIndex = 0;
|
107
|
-
while (textIndex < text.length) {
|
108
|
-
// Check if we're at the identifier's position
|
109
|
-
if (currentLine === identifier.position.line
|
110
|
-
&& currentColumn === identifier.position.column) {
|
111
|
-
// Verify it's actually our identifier
|
112
|
-
const remainingText = text.substring(textIndex);
|
113
|
-
if (remainingText.startsWith(identifier.name)) {
|
114
|
-
// Create a unique ID for this identifier
|
115
|
-
const id = `${identifier.position.start}-${identifier.name}-${identifier.kind}`;
|
116
|
-
// Split the text node and wrap the identifier
|
117
|
-
const before = text.substring(0, textIndex);
|
118
|
-
const after = text.substring(textIndex + identifier.name.length);
|
119
|
-
const span = document.createElement('span');
|
120
|
-
span.setAttribute('data-graphql-id', id);
|
121
|
-
span.setAttribute('data-graphql-name', identifier.name);
|
122
|
-
span.setAttribute('data-graphql-kind', identifier.kind);
|
123
|
-
span.setAttribute('data-graphql-start', String(identifier.position.start));
|
124
|
-
span.setAttribute('data-graphql-end', String(identifier.position.end));
|
125
|
-
span.setAttribute('data-graphql-line', String(identifier.position.line));
|
126
|
-
span.setAttribute('data-graphql-column', String(identifier.position.column));
|
127
|
-
span.setAttribute('data-graphql-path', identifier.schemaPath.join(','));
|
128
|
-
span.textContent = identifier.name;
|
129
|
-
const parent = textNode.parentNode;
|
130
|
-
if (before) {
|
131
|
-
parent.insertBefore(document.createTextNode(before), textNode);
|
132
|
-
}
|
133
|
-
parent.insertBefore(span, textNode);
|
134
|
-
if (after) {
|
135
|
-
parent.insertBefore(document.createTextNode(after), textNode);
|
136
|
-
}
|
137
|
-
parent.removeChild(textNode);
|
138
|
-
return true;
|
139
|
-
}
|
140
|
-
}
|
141
|
-
// Update position tracking
|
142
|
-
const char = text[textIndex];
|
143
|
-
if (char === '\n') {
|
144
|
-
currentLine++;
|
145
|
-
currentColumn = 1;
|
146
|
-
}
|
147
|
-
else {
|
148
|
-
currentColumn++;
|
149
|
-
}
|
150
|
-
textIndex++;
|
151
|
-
}
|
152
|
-
}
|
153
|
-
return false; // Identifier not found
|
154
|
-
}
|
155
143
|
}
|
156
144
|
/**
|
157
145
|
* Create invisible overlay for a position
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"positioning-simple.js","sourceRoot":"","sources":["../../../src/lib/graphql-document/positioning-simple.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA4BH;;;;;;;;;;GAUG;AACH,MAAM,OAAO,wBAAwB;IACnC;;OAEG;IACH,gBAAgB,CACd,gBAAyB,EACzB,WAAyB;QAEzB,
|
1
|
+
{"version":3,"file":"positioning-simple.js","sourceRoot":"","sources":["../../../src/lib/graphql-document/positioning-simple.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA4BH;;;;;;;;;;GAUG;AACH,MAAM,OAAO,wBAAwB;IACnC;;OAEG;IACH,gBAAgB,CACd,gBAAyB,EACzB,WAAyB;QAEzB,6CAA6C;Q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AAC,MAAM,8BAA8B,GAAG,GAA6B,EAAE;IAC3E,OAAO,IAAI,wBAAwB,EAAE,CAAA;AACvC,CAAC,CAAA"}
|
package/build/lib/kit-temp.d.ts
CHANGED
@@ -71,5 +71,108 @@ export declare function tryCatchMany<item, result>(items: item[], operation: (it
|
|
71
71
|
*/
|
72
72
|
export type IsExact<T, U> = T extends U ? U extends T ? true : false : false;
|
73
73
|
export type ExtendsExact<$Input, $Constraint> = $Input extends $Constraint ? $Constraint extends $Input ? $Input : never : never;
|
74
|
+
/**
|
75
|
+
* Split an array into chunks of specified size
|
76
|
+
*
|
77
|
+
* @param array - The array to chunk
|
78
|
+
* @param size - The size of each chunk
|
79
|
+
* @returns Array of chunks
|
80
|
+
*
|
81
|
+
* @example
|
82
|
+
* ```ts
|
83
|
+
* chunk([1, 2, 3, 4, 5], 2) // [[1, 2], [3, 4], [5]]
|
84
|
+
* chunk(['a', 'b', 'c'], 3) // [['a', 'b', 'c']]
|
85
|
+
* ```
|
86
|
+
*/
|
87
|
+
export declare const chunk: <T>(array: readonly T[], size: number) => T[][];
|
88
|
+
export interface AsyncParallelOptions {
|
89
|
+
/**
|
90
|
+
* Maximum number of items to process concurrently
|
91
|
+
* @default 10
|
92
|
+
*/
|
93
|
+
concurrency?: number;
|
94
|
+
/**
|
95
|
+
* If true, stops processing on first error
|
96
|
+
* If false, continues processing all items even if some fail
|
97
|
+
* @default false
|
98
|
+
*/
|
99
|
+
failFast?: boolean;
|
100
|
+
/**
|
101
|
+
* Size of batches to process items in
|
102
|
+
* If not specified, all items are processed with the specified concurrency
|
103
|
+
*/
|
104
|
+
batchSize?: number;
|
105
|
+
}
|
106
|
+
export interface AsyncParallelResult<T, R> {
|
107
|
+
/** Successfully processed results */
|
108
|
+
results: R[];
|
109
|
+
/** Errors that occurred during processing */
|
110
|
+
errors: (Error & {
|
111
|
+
item: T;
|
112
|
+
})[];
|
113
|
+
/** Whether all items were processed successfully */
|
114
|
+
success: boolean;
|
115
|
+
}
|
116
|
+
/**
|
117
|
+
* Process items in parallel with configurable options
|
118
|
+
*
|
119
|
+
* @param items - Items to process
|
120
|
+
* @param operation - Async function to apply to each item (with optional index)
|
121
|
+
* @param options - Configuration options
|
122
|
+
* @returns Results and errors from processing
|
123
|
+
*
|
124
|
+
* @example
|
125
|
+
* ```ts
|
126
|
+
* const items = [1, 2, 3, 4, 5]
|
127
|
+
* const result = await asyncParallel(items, async (n, index) => n * 2, {
|
128
|
+
* concurrency: 2,
|
129
|
+
* batchSize: 3,
|
130
|
+
* failFast: false
|
131
|
+
* })
|
132
|
+
* // result.results: [2, 4, 6, 8, 10]
|
133
|
+
* // result.errors: []
|
134
|
+
* // result.success: true
|
135
|
+
* ```
|
136
|
+
*/
|
137
|
+
export declare const asyncParallel: <T, R>(items: readonly T[], operation: (item: T, index: number) => Promise<R>, options?: AsyncParallelOptions) => Promise<AsyncParallelResult<T, R>>;
|
138
|
+
/**
|
139
|
+
* Reduce an array asynchronously with context, processing each item in sequence
|
140
|
+
*
|
141
|
+
* @param items - Array of items to process
|
142
|
+
* @param reducer - Async function that takes accumulator, current item, and context
|
143
|
+
* @param initial - Initial value for the accumulator
|
144
|
+
* @param context - Context object passed to each reducer call
|
145
|
+
* @returns Final accumulated value
|
146
|
+
*
|
147
|
+
* @example
|
148
|
+
* ```ts
|
149
|
+
* const transformers = [transformer1, transformer2]
|
150
|
+
* const ctx = { request: req, response: res }
|
151
|
+
* const result = await asyncReduceWithContext(
|
152
|
+
* transformers,
|
153
|
+
* async (html, transformer) => transformer(html, ctx),
|
154
|
+
* initialHtml,
|
155
|
+
* ctx
|
156
|
+
* )
|
157
|
+
* ```
|
158
|
+
*/
|
159
|
+
export declare const asyncReduce: <T, R, C>(items: readonly T[], reducer: (accumulator: R, current: T, context: C, index: number) => Promise<R> | R, initial: R, context: C) => Promise<R>;
|
160
|
+
/**
|
161
|
+
* Curried version of asyncReduceWithContext for functions that transform a value with context
|
162
|
+
*
|
163
|
+
* @param transformers - Array of transformer functions that take value and context
|
164
|
+
* @returns A function that takes an initial value and context, and applies all transformers
|
165
|
+
*
|
166
|
+
* @example
|
167
|
+
* ```ts
|
168
|
+
* const transformers = [
|
169
|
+
* (html, ctx) => html.replace('{{url}}', ctx.req.url),
|
170
|
+
* async (html, ctx) => await ctx.minify(html),
|
171
|
+
* ]
|
172
|
+
* const applyTransforms = asyncReduceWithContextWith(transformers)
|
173
|
+
* const finalHtml = await applyTransforms(initialHtml, ctx)
|
174
|
+
* ```
|
175
|
+
*/
|
176
|
+
export declare const asyncReduceWith: <T, C>(transformers: readonly ((value: T, context: C) => Promise<T> | T)[], context: C) => (initial: T) => Promise<T>;
|
74
177
|
export {};
|
75
178
|
//# sourceMappingURL=kit-temp.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"kit-temp.d.ts","sourceRoot":"","sources":["../../src/lib/kit-temp.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"kit-temp.d.ts","sourceRoot":"","sources":["../../src/lib/kit-temp.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAErD,eAAO,MAAM,WAAW,GAAI,GAAG,GAAG,EAAE,EAAE,GAAG,GAAG,EAAE,YAM7C,CAAA;AAED,eAAO,MAAM,6BAA6B,GAAI,SAAS,MAAM,GAAG,SAAS,KAAG,MAG3E,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,SAAS,MAAM,GAAG,SAAS,EAAE,aAAa,MAAM,KAAG,MAIzF,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,gBAAgB,MAAM,KAAG,IAG3D,CAAA;AAED,eAAO,MAAM,0BAA0B,GAAI,gBAAgB,MAAM,GAAG,SAAS,EAAE,UAAU,MAAM,KAAG,IAKjG,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAU,OAAO,MAAM,EAAE,KAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAGvF,CAAA;AAED,eAAO,MAAM,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;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,EAAE,CAAC,EAClC,cAAc,SAAS,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EACnE,SAAS,CAAC,MAEI,SAAS,CAAC,KAAG,OAAO,CAAC,CAAC,CAQrC,CAAA"}
|
package/build/lib/kit-temp.js
CHANGED
@@ -12,7 +12,6 @@
|
|
12
12
|
//
|
13
13
|
//
|
14
14
|
import { Arr, Err, Fs, Http, Path, Undefined } from '@wollybeard/kit';
|
15
|
-
import { never } from '@wollybeard/kit/language';
|
16
15
|
export const arrayEquals = (a, b) => {
|
17
16
|
if (a.length !== b.length)
|
18
17
|
return false;
|
@@ -77,7 +76,7 @@ export const objPolicyFilter = (mode, obj, keys) => {
|
|
77
76
|
if (mode === 'allow') {
|
78
77
|
// For allow mode, only add specified keys
|
79
78
|
for (const key of keys) {
|
80
|
-
if (key
|
79
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
81
80
|
// @ts-expect-error
|
82
81
|
result[key] = obj[key];
|
83
82
|
}
|
@@ -159,4 +158,239 @@ export async function tryCatchMany(items, operation) {
|
|
159
158
|
})).then(Arr.partitionErrors);
|
160
159
|
return partitionedResults;
|
161
160
|
}
|
161
|
+
/**
|
162
|
+
* Split an array into chunks of specified size
|
163
|
+
*
|
164
|
+
* @param array - The array to chunk
|
165
|
+
* @param size - The size of each chunk
|
166
|
+
* @returns Array of chunks
|
167
|
+
*
|
168
|
+
* @example
|
169
|
+
* ```ts
|
170
|
+
* chunk([1, 2, 3, 4, 5], 2) // [[1, 2], [3, 4], [5]]
|
171
|
+
* chunk(['a', 'b', 'c'], 3) // [['a', 'b', 'c']]
|
172
|
+
* ```
|
173
|
+
*/
|
174
|
+
export const chunk = (array, size) => {
|
175
|
+
if (size <= 0)
|
176
|
+
throw new Error('Chunk size must be greater than 0');
|
177
|
+
if (array.length === 0)
|
178
|
+
return [];
|
179
|
+
const chunks = [];
|
180
|
+
for (let i = 0; i < array.length; i += size) {
|
181
|
+
chunks.push(array.slice(i, i + size));
|
182
|
+
}
|
183
|
+
return chunks;
|
184
|
+
};
|
185
|
+
/**
|
186
|
+
* Process items in parallel with configurable options
|
187
|
+
*
|
188
|
+
* @param items - Items to process
|
189
|
+
* @param operation - Async function to apply to each item (with optional index)
|
190
|
+
* @param options - Configuration options
|
191
|
+
* @returns Results and errors from processing
|
192
|
+
*
|
193
|
+
* @example
|
194
|
+
* ```ts
|
195
|
+
* const items = [1, 2, 3, 4, 5]
|
196
|
+
* const result = await asyncParallel(items, async (n, index) => n * 2, {
|
197
|
+
* concurrency: 2,
|
198
|
+
* batchSize: 3,
|
199
|
+
* failFast: false
|
200
|
+
* })
|
201
|
+
* // result.results: [2, 4, 6, 8, 10]
|
202
|
+
* // result.errors: []
|
203
|
+
* // result.success: true
|
204
|
+
* ```
|
205
|
+
*/
|
206
|
+
export const asyncParallel = async (items, operation, options = {}) => {
|
207
|
+
const { concurrency = 10, failFast = false, batchSize } = options;
|
208
|
+
if (items.length === 0) {
|
209
|
+
return { results: [], errors: [], success: true };
|
210
|
+
}
|
211
|
+
const allResults = [];
|
212
|
+
const allErrors = [];
|
213
|
+
// If batchSize is specified, process in batches
|
214
|
+
if (batchSize !== undefined) {
|
215
|
+
const batches = chunk(items, batchSize);
|
216
|
+
let globalIndex = 0;
|
217
|
+
for (const batch of batches) {
|
218
|
+
const batchResult = await processBatch(batch, operation, concurrency, failFast, globalIndex);
|
219
|
+
allResults.push(...batchResult.results);
|
220
|
+
allErrors.push(...batchResult.errors);
|
221
|
+
globalIndex += batch.length;
|
222
|
+
if (failFast && batchResult.errors.length > 0) {
|
223
|
+
break;
|
224
|
+
}
|
225
|
+
}
|
226
|
+
}
|
227
|
+
else {
|
228
|
+
// Process all items with specified concurrency
|
229
|
+
const result = await processBatch(items, operation, concurrency, failFast, 0);
|
230
|
+
allResults.push(...result.results);
|
231
|
+
allErrors.push(...result.errors);
|
232
|
+
}
|
233
|
+
return {
|
234
|
+
results: allResults,
|
235
|
+
errors: allErrors,
|
236
|
+
success: allErrors.length === 0,
|
237
|
+
};
|
238
|
+
};
|
239
|
+
/**
|
240
|
+
* Process a batch of items with limited concurrency
|
241
|
+
*/
|
242
|
+
const processBatch = async (items, operation, concurrency, failFast, startIndex = 0) => {
|
243
|
+
const results = [];
|
244
|
+
const errors = [];
|
245
|
+
// Process items in chunks based on concurrency limit
|
246
|
+
const chunks = chunk(items, concurrency);
|
247
|
+
let currentIndex = startIndex;
|
248
|
+
for (const chunkItems of chunks) {
|
249
|
+
const promises = chunkItems.map(async (item, chunkIndex) => {
|
250
|
+
const globalIndex = currentIndex + chunkIndex;
|
251
|
+
try {
|
252
|
+
const result = await operation(item, globalIndex);
|
253
|
+
return { success: true, result, item };
|
254
|
+
}
|
255
|
+
catch (error) {
|
256
|
+
const enhancedError = error instanceof Error ? error : new Error(String(error));
|
257
|
+
Object.assign(enhancedError, { item });
|
258
|
+
return { success: false, error: enhancedError, item };
|
259
|
+
}
|
260
|
+
});
|
261
|
+
currentIndex += chunkItems.length;
|
262
|
+
const chunkResults = await Promise.allSettled(promises);
|
263
|
+
for (const promiseResult of chunkResults) {
|
264
|
+
if (promiseResult.status === 'fulfilled') {
|
265
|
+
const { success, result, error, item } = promiseResult.value;
|
266
|
+
if (success) {
|
267
|
+
results.push(result);
|
268
|
+
}
|
269
|
+
else {
|
270
|
+
errors.push(error);
|
271
|
+
if (failFast) {
|
272
|
+
return { results, errors, success: false };
|
273
|
+
}
|
274
|
+
}
|
275
|
+
}
|
276
|
+
else {
|
277
|
+
// This shouldn't happen since we're catching errors above
|
278
|
+
// But handle it just in case
|
279
|
+
const error = new Error('Unexpected promise rejection');
|
280
|
+
errors.push(error);
|
281
|
+
if (failFast) {
|
282
|
+
return { results, errors, success: false };
|
283
|
+
}
|
284
|
+
}
|
285
|
+
}
|
286
|
+
}
|
287
|
+
return { results, errors, success: errors.length === 0 };
|
288
|
+
};
|
289
|
+
// /**
|
290
|
+
// * Reduce an array asynchronously, processing each item in sequence
|
291
|
+
// *
|
292
|
+
// * @param items - Array of items to process
|
293
|
+
// * @param reducer - Async function that takes accumulator and current item
|
294
|
+
// * @param initial - Initial value for the accumulator
|
295
|
+
// * @returns Final accumulated value
|
296
|
+
// *
|
297
|
+
// * @example
|
298
|
+
// * ```ts
|
299
|
+
// * const numbers = [1, 2, 3, 4]
|
300
|
+
// * const sum = await asyncReduce(numbers, async (acc, n) => acc + n, 0)
|
301
|
+
// * // sum: 10
|
302
|
+
// *
|
303
|
+
// * const transforms = [addHeader, addFooter, minify]
|
304
|
+
// * const html = await asyncReduce(transforms, async (html, transform) => transform(html), initialHtml)
|
305
|
+
// * ```
|
306
|
+
// */
|
307
|
+
// export const asyncReduce = async <T, R>(
|
308
|
+
// items: readonly T[],
|
309
|
+
// reducer: (accumulator: R, current: T, index: number) => Promise<R> | R,
|
310
|
+
// initial: R,
|
311
|
+
// ): Promise<R> => {
|
312
|
+
// let result = initial
|
313
|
+
// for (let i = 0; i < items.length; i++) {
|
314
|
+
// const item = items[i]!
|
315
|
+
// result = await reducer(result, item, i)
|
316
|
+
// }
|
317
|
+
// return result
|
318
|
+
// }
|
319
|
+
// /**
|
320
|
+
// * Curried version of asyncReduce for functions that transform a value
|
321
|
+
// *
|
322
|
+
// * @param transformers - Array of transformer functions
|
323
|
+
// * @returns A function that takes an initial value and applies all transformers
|
324
|
+
// *
|
325
|
+
// * @example
|
326
|
+
// * ```ts
|
327
|
+
// * const transformers = [addHeader, addFooter, minify]
|
328
|
+
// * const applyTransforms = asyncReduceWith(transformers)
|
329
|
+
// * const finalHtml = await applyTransforms(initialHtml)
|
330
|
+
// *
|
331
|
+
// * // For simple pipelines where each function transforms the same type
|
332
|
+
// * const htmlPipeline = asyncReduceWith([
|
333
|
+
// * (html) => html.replace('foo', 'bar'),
|
334
|
+
// * async (html) => await prettify(html),
|
335
|
+
// * (html) => html.trim()
|
336
|
+
// * ])
|
337
|
+
// * ```
|
338
|
+
// */
|
339
|
+
// export const asyncReduceWith = <T>(
|
340
|
+
// transformers: readonly ((value: T) => Promise<T> | T)[],
|
341
|
+
// ) => {
|
342
|
+
// return async (initial: T): Promise<T> => {
|
343
|
+
// return asyncReduce(transformers, (value, transform) => transform(value), initial)
|
344
|
+
// }
|
345
|
+
// }
|
346
|
+
/**
|
347
|
+
* Reduce an array asynchronously with context, processing each item in sequence
|
348
|
+
*
|
349
|
+
* @param items - Array of items to process
|
350
|
+
* @param reducer - Async function that takes accumulator, current item, and context
|
351
|
+
* @param initial - Initial value for the accumulator
|
352
|
+
* @param context - Context object passed to each reducer call
|
353
|
+
* @returns Final accumulated value
|
354
|
+
*
|
355
|
+
* @example
|
356
|
+
* ```ts
|
357
|
+
* const transformers = [transformer1, transformer2]
|
358
|
+
* const ctx = { request: req, response: res }
|
359
|
+
* const result = await asyncReduceWithContext(
|
360
|
+
* transformers,
|
361
|
+
* async (html, transformer) => transformer(html, ctx),
|
362
|
+
* initialHtml,
|
363
|
+
* ctx
|
364
|
+
* )
|
365
|
+
* ```
|
366
|
+
*/
|
367
|
+
export const asyncReduce = async (items, reducer, initial, context) => {
|
368
|
+
let result = initial;
|
369
|
+
for (let i = 0; i < items.length; i++) {
|
370
|
+
const item = items[i];
|
371
|
+
result = await reducer(result, item, context, i);
|
372
|
+
}
|
373
|
+
return result;
|
374
|
+
};
|
375
|
+
/**
|
376
|
+
* Curried version of asyncReduceWithContext for functions that transform a value with context
|
377
|
+
*
|
378
|
+
* @param transformers - Array of transformer functions that take value and context
|
379
|
+
* @returns A function that takes an initial value and context, and applies all transformers
|
380
|
+
*
|
381
|
+
* @example
|
382
|
+
* ```ts
|
383
|
+
* const transformers = [
|
384
|
+
* (html, ctx) => html.replace('{{url}}', ctx.req.url),
|
385
|
+
* async (html, ctx) => await ctx.minify(html),
|
386
|
+
* ]
|
387
|
+
* const applyTransforms = asyncReduceWithContextWith(transformers)
|
388
|
+
* const finalHtml = await applyTransforms(initialHtml, ctx)
|
389
|
+
* ```
|
390
|
+
*/
|
391
|
+
export const asyncReduceWith = (transformers, context) => {
|
392
|
+
return async (initial) => {
|
393
|
+
return asyncReduce(transformers, (value, transform, ctx) => transform(value, ctx), initial, context);
|
394
|
+
};
|
395
|
+
};
|
162
396
|
//# sourceMappingURL=kit-temp.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"kit-temp.js","sourceRoot":"","sources":["../../src/lib/kit-temp.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,EAAE;AACF,EAAE;AACF,EAAE;AACF,EAAE;AACF,2DAA2D;AAC3D,EAAE;AACF,mFAAmF;AACnF,EAAE;AACF,mEAAmE;AACnE,EAAE;AACF,EAAE;AACF,EAAE;AAEF,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,
|
1
|
+
{"version":3,"file":"kit-temp.js","sourceRoot":"","sources":["../../src/lib/kit-temp.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,EAAE;AACF,EAAE;AACF,EAAE;AACF,EAAE;AACF,2DAA2D;AAC3D,EAAE;AACF,mFAAmF;AACnF,EAAE;AACF,mEAAmE;AACnE,EAAE;AACF,EAAE;AACF,EAAE;AAEF,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAGrE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAQ,EAAE,CAAQ,EAAE,EAAE;IAChD,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;QAAE,OAAO,KAAK,CAAA;IACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAClC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK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