@nuasite/cms-marker 0.0.65 → 0.0.67
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/types/build-processor.d.ts +2 -1
- package/dist/types/build-processor.d.ts.map +1 -1
- package/dist/types/component-registry.d.ts.map +1 -1
- package/dist/types/config.d.ts +19 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/dev-middleware.d.ts +10 -2
- package/dist/types/dev-middleware.d.ts.map +1 -1
- package/dist/types/error-collector.d.ts +56 -0
- package/dist/types/error-collector.d.ts.map +1 -0
- package/dist/types/html-processor.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/manifest-writer.d.ts.map +1 -1
- package/dist/types/source-finder.d.ts +18 -3
- package/dist/types/source-finder.d.ts.map +1 -1
- package/dist/types/tailwind-colors.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/types.d.ts +2 -4
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/vite-plugin.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/build-processor.ts +73 -19
- package/src/component-registry.ts +2 -0
- package/src/config.ts +29 -0
- package/src/dev-middleware.ts +12 -4
- package/src/error-collector.ts +106 -0
- package/src/html-processor.ts +55 -37
- package/src/index.ts +20 -4
- package/src/manifest-writer.ts +12 -2
- package/src/source-finder.ts +1003 -295
- package/src/tailwind-colors.ts +249 -48
- package/src/types.ts +2 -4
- package/src/vite-plugin.ts +4 -12
- package/dist/types/astro-transform.d.ts +0 -21
- package/dist/types/astro-transform.d.ts.map +0 -1
- package/src/astro-transform.ts +0 -205
package/dist/types/types.d.ts
CHANGED
|
@@ -87,6 +87,8 @@ export interface ColorClasses {
|
|
|
87
87
|
hoverBg?: string;
|
|
88
88
|
/** Hover text color class (e.g., 'hover:text-gray-100') */
|
|
89
89
|
hoverText?: string;
|
|
90
|
+
/** Hover border color class (e.g., 'hover:border-blue-700') */
|
|
91
|
+
hoverBorder?: string;
|
|
90
92
|
/** All color-related classes as found in the element */
|
|
91
93
|
allColorClasses?: string[];
|
|
92
94
|
}
|
|
@@ -139,10 +141,6 @@ export interface ManifestEntry {
|
|
|
139
141
|
collectionSlug?: string;
|
|
140
142
|
/** Path to the markdown content file (e.g., 'src/content/blog/my-post.md') */
|
|
141
143
|
contentPath?: string;
|
|
142
|
-
/** Image source URL (for image entries) - deprecated, use imageMetadata */
|
|
143
|
-
imageSrc?: string;
|
|
144
|
-
/** Image alt text (for image entries) - deprecated, use imageMetadata */
|
|
145
|
-
imageAlt?: string;
|
|
146
144
|
/** Stable ID derived from content + context hash, survives rebuilds */
|
|
147
145
|
stableId?: string;
|
|
148
146
|
/** SHA256 hash of sourceSnippet at generation time for conflict detection */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAChC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,wEAAwE;IACxE,UAAU,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,aAAa;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,OAAO,CAAA;IACjB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,mBAAmB;IAC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eAAe,CAAC,CAAA;IAC7C,0DAA0D;IAC1D,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,+DAA+D;IAC/D,mBAAmB,CAAC,EAAE,mBAAmB,CAAA;CACzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin.d.ts","sourceRoot":"","sources":["../../src/vite-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"vite-plugin.d.ts","sourceRoot":"","sources":["../../src/vite-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAClC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAEpE,MAAM,WAAW,iBAAiB;IACjC,cAAc,EAAE,cAAc,CAAA;IAC9B,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAA;IACzD,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC,CAAA;IAClC,SAAS,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IAC5B,OAAO,EAAE,KAAK,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAA;CAC7C;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,EAAE,CA6BrE"}
|
package/package.json
CHANGED
|
@@ -14,12 +14,13 @@
|
|
|
14
14
|
"directory": "packages/cms-marker"
|
|
15
15
|
},
|
|
16
16
|
"license": "Apache-2.0",
|
|
17
|
-
"version": "0.0.
|
|
17
|
+
"version": "0.0.67",
|
|
18
18
|
"module": "src/index.ts",
|
|
19
19
|
"types": "src/index.ts",
|
|
20
20
|
"type": "module",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@astrojs/compiler": "^2.13.0",
|
|
23
|
+
"@babel/parser": "^7.24.0",
|
|
23
24
|
"astro": "^5.16.6",
|
|
24
25
|
"node-html-parser": "^6.1.13"
|
|
25
26
|
},
|
package/src/build-processor.ts
CHANGED
|
@@ -4,7 +4,15 @@ import path from 'node:path'
|
|
|
4
4
|
import { fileURLToPath } from 'node:url'
|
|
5
5
|
import { processHtml } from './html-processor'
|
|
6
6
|
import type { ManifestWriter } from './manifest-writer'
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
clearSourceFinderCache,
|
|
9
|
+
findCollectionSource,
|
|
10
|
+
findImageSourceLocation,
|
|
11
|
+
findMarkdownSourceLocation,
|
|
12
|
+
findSourceLocation,
|
|
13
|
+
initializeSearchIndex,
|
|
14
|
+
parseMarkdownContent,
|
|
15
|
+
} from './source-finder'
|
|
8
16
|
import type { CmsMarkerOptions, CollectionEntry } from './types'
|
|
9
17
|
|
|
10
18
|
// Concurrency limit for parallel processing
|
|
@@ -110,22 +118,23 @@ async function processFile(
|
|
|
110
118
|
}
|
|
111
119
|
}
|
|
112
120
|
|
|
113
|
-
|
|
121
|
+
// Process entries in parallel for better performance
|
|
122
|
+
const entryLookups = Object.values(result.entries).map(async (entry) => {
|
|
114
123
|
// Skip entries that already have source info from component detection
|
|
115
124
|
if (entry.sourcePath && !entry.sourcePath.endsWith('.html')) {
|
|
116
|
-
|
|
125
|
+
return
|
|
117
126
|
}
|
|
118
127
|
|
|
119
128
|
// Handle image entries specially - search by image src
|
|
120
|
-
if (entry.sourceType === 'image' && entry.
|
|
121
|
-
const imageSource = await findImageSourceLocation(entry.
|
|
129
|
+
if (entry.sourceType === 'image' && entry.imageMetadata?.src) {
|
|
130
|
+
const imageSource = await findImageSourceLocation(entry.imageMetadata.src)
|
|
122
131
|
if (imageSource) {
|
|
123
132
|
entry.sourcePath = imageSource.file
|
|
124
133
|
entry.sourceLine = imageSource.line
|
|
125
134
|
entry.sourceSnippet = imageSource.snippet
|
|
126
135
|
entry.sourceType = 'image'
|
|
127
136
|
}
|
|
128
|
-
|
|
137
|
+
return
|
|
129
138
|
}
|
|
130
139
|
|
|
131
140
|
// Try to find source in collection markdown frontmatter first
|
|
@@ -139,7 +148,7 @@ async function processFile(
|
|
|
139
148
|
entry.variableName = mdSource.variableName
|
|
140
149
|
entry.collectionName = mdSource.collectionName
|
|
141
150
|
entry.collectionSlug = mdSource.collectionSlug
|
|
142
|
-
|
|
151
|
+
return
|
|
143
152
|
}
|
|
144
153
|
}
|
|
145
154
|
|
|
@@ -152,7 +161,9 @@ async function processFile(
|
|
|
152
161
|
entry.sourceType = sourceLocation.type
|
|
153
162
|
entry.variableName = sourceLocation.variableName
|
|
154
163
|
}
|
|
155
|
-
}
|
|
164
|
+
})
|
|
165
|
+
|
|
166
|
+
await Promise.all(entryLookups)
|
|
156
167
|
|
|
157
168
|
// Add to manifest writer (handles per-page manifest writes)
|
|
158
169
|
manifestWriter.addPage(pagePath, result.entries, result.components, collectionEntry)
|
|
@@ -163,8 +174,15 @@ async function processFile(
|
|
|
163
174
|
return Object.keys(result.entries).length
|
|
164
175
|
}
|
|
165
176
|
|
|
177
|
+
/** Result of batch processing with error aggregation */
|
|
178
|
+
interface BatchProcessingResult {
|
|
179
|
+
totalEntries: number
|
|
180
|
+
errors: Array<{ file: string; error: Error }>
|
|
181
|
+
}
|
|
182
|
+
|
|
166
183
|
/**
|
|
167
|
-
* Process HTML files in parallel with concurrency limit
|
|
184
|
+
* Process HTML files in parallel with concurrency limit and error aggregation.
|
|
185
|
+
* Unlike Promise.all, this continues processing even if some files fail.
|
|
168
186
|
*/
|
|
169
187
|
async function processFilesInBatches(
|
|
170
188
|
files: string[],
|
|
@@ -172,23 +190,37 @@ async function processFilesInBatches(
|
|
|
172
190
|
config: Required<CmsMarkerOptions>,
|
|
173
191
|
manifestWriter: ManifestWriter,
|
|
174
192
|
idCounter: { value: number },
|
|
175
|
-
): Promise<
|
|
193
|
+
): Promise<BatchProcessingResult> {
|
|
176
194
|
let totalEntries = 0
|
|
195
|
+
const errors: Array<{ file: string; error: Error }> = []
|
|
177
196
|
|
|
178
197
|
// Process files in batches of MAX_CONCURRENT
|
|
179
198
|
for (let i = 0; i < files.length; i += MAX_CONCURRENT) {
|
|
180
199
|
const batch = files.slice(i, i + MAX_CONCURRENT)
|
|
181
|
-
const results = await Promise.
|
|
182
|
-
batch.map(file =>
|
|
200
|
+
const results = await Promise.allSettled(
|
|
201
|
+
batch.map(file =>
|
|
202
|
+
processFile(file, outDir, config, manifestWriter, idCounter)
|
|
203
|
+
.then(count => ({ file, count }))
|
|
204
|
+
.catch(err => Promise.reject({ file, error: err }))
|
|
205
|
+
),
|
|
183
206
|
)
|
|
184
|
-
|
|
207
|
+
|
|
208
|
+
for (const result of results) {
|
|
209
|
+
if (result.status === 'fulfilled') {
|
|
210
|
+
totalEntries += result.value.count
|
|
211
|
+
} else {
|
|
212
|
+
const { file, error } = result.reason as { file: string; error: Error }
|
|
213
|
+
errors.push({ file, error })
|
|
214
|
+
}
|
|
215
|
+
}
|
|
185
216
|
}
|
|
186
217
|
|
|
187
|
-
return totalEntries
|
|
218
|
+
return { totalEntries, errors }
|
|
188
219
|
}
|
|
189
220
|
|
|
190
221
|
/**
|
|
191
|
-
* Process build output - processes all HTML files in parallel
|
|
222
|
+
* Process build output - processes all HTML files in parallel.
|
|
223
|
+
* Uses error aggregation to continue processing even if some files fail.
|
|
192
224
|
*/
|
|
193
225
|
export async function processBuildOutput(
|
|
194
226
|
dir: URL,
|
|
@@ -200,6 +232,9 @@ export async function processBuildOutput(
|
|
|
200
232
|
const outDir = fileURLToPath(dir)
|
|
201
233
|
manifestWriter.setOutDir(outDir)
|
|
202
234
|
|
|
235
|
+
// Clear caches from previous builds and initialize search index
|
|
236
|
+
clearSourceFinderCache()
|
|
237
|
+
|
|
203
238
|
const htmlFiles = await findHtmlFiles(outDir)
|
|
204
239
|
|
|
205
240
|
if (htmlFiles.length === 0) {
|
|
@@ -209,17 +244,36 @@ export async function processBuildOutput(
|
|
|
209
244
|
|
|
210
245
|
const startTime = Date.now()
|
|
211
246
|
|
|
212
|
-
//
|
|
213
|
-
await
|
|
247
|
+
// Pre-build search index for fast source lookups (single pass through all source files)
|
|
248
|
+
await initializeSearchIndex()
|
|
249
|
+
|
|
250
|
+
// Process all files in parallel batches with error aggregation
|
|
251
|
+
const { totalEntries, errors } = await processFilesInBatches(htmlFiles, outDir, config, manifestWriter, idCounter)
|
|
252
|
+
|
|
253
|
+
// Report any errors that occurred during processing
|
|
254
|
+
if (errors.length > 0) {
|
|
255
|
+
const errorLog = logger?.error?.bind(logger) ?? console.error.bind(console)
|
|
256
|
+
errorLog(`[astro-cms-marker] ${errors.length} file(s) failed to process:`)
|
|
257
|
+
for (const { file, error } of errors) {
|
|
258
|
+
const relPath = path.relative(outDir, file)
|
|
259
|
+
errorLog(` - ${relPath}: ${error.message}`)
|
|
260
|
+
}
|
|
261
|
+
}
|
|
214
262
|
|
|
215
263
|
// Finalize manifest (writes global manifest and waits for all per-page writes)
|
|
216
264
|
const stats = await manifestWriter.finalize()
|
|
217
265
|
|
|
218
266
|
const duration = Date.now() - startTime
|
|
219
|
-
const
|
|
267
|
+
const successCount = htmlFiles.length - errors.length
|
|
268
|
+
const msg =
|
|
269
|
+
`Processed ${successCount}/${htmlFiles.length} pages with ${stats.totalEntries} entries and ${stats.totalComponents} components in ${duration}ms`
|
|
220
270
|
|
|
221
271
|
if (logger) {
|
|
222
|
-
|
|
272
|
+
if (errors.length > 0) {
|
|
273
|
+
logger.warn(msg)
|
|
274
|
+
} else {
|
|
275
|
+
logger.info(msg)
|
|
276
|
+
}
|
|
223
277
|
} else {
|
|
224
278
|
console.log(`[astro-cms-marker] ${msg}`)
|
|
225
279
|
}
|
package/src/config.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global configuration for cms-marker.
|
|
3
|
+
* This allows overriding the project root for testing.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
let projectRootOverride: string | null = null
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Get the current project root directory.
|
|
10
|
+
* Returns the override if set, otherwise process.cwd().
|
|
11
|
+
*/
|
|
12
|
+
export function getProjectRoot(): string {
|
|
13
|
+
return projectRootOverride ?? process.cwd()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Set the project root directory override.
|
|
18
|
+
* Call this to use a specific directory instead of process.cwd().
|
|
19
|
+
*/
|
|
20
|
+
export function setProjectRoot(root: string): void {
|
|
21
|
+
projectRootOverride = root
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Reset the project root to use process.cwd() again.
|
|
26
|
+
*/
|
|
27
|
+
export function resetProjectRoot(): void {
|
|
28
|
+
projectRootOverride = null
|
|
29
|
+
}
|
package/src/dev-middleware.ts
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from 'node:http'
|
|
2
2
|
import { processHtml } from './html-processor'
|
|
3
3
|
import type { ManifestWriter } from './manifest-writer'
|
|
4
4
|
import { findCollectionSource, findImageSourceLocation, parseMarkdownContent } from './source-finder'
|
|
5
5
|
import type { CmsMarkerOptions, CollectionEntry, ComponentDefinition } from './types'
|
|
6
6
|
|
|
7
|
+
/** Minimal ViteDevServer interface to avoid version conflicts between Astro's bundled Vite and root Vite */
|
|
8
|
+
interface ViteDevServerLike {
|
|
9
|
+
middlewares: {
|
|
10
|
+
use: (middleware: (req: IncomingMessage, res: ServerResponse, next: () => void) => void) => void
|
|
11
|
+
}
|
|
12
|
+
transformIndexHtml: (url: string, html: string) => Promise<string>
|
|
13
|
+
}
|
|
14
|
+
|
|
7
15
|
/**
|
|
8
16
|
* Get the normalized page path from a URL
|
|
9
17
|
* For example: /about/ -> /about
|
|
@@ -21,7 +29,7 @@ function normalizePagePath(url: string): string {
|
|
|
21
29
|
}
|
|
22
30
|
|
|
23
31
|
export function createDevMiddleware(
|
|
24
|
-
server:
|
|
32
|
+
server: ViteDevServerLike,
|
|
25
33
|
config: Required<CmsMarkerOptions>,
|
|
26
34
|
manifestWriter: ManifestWriter,
|
|
27
35
|
componentDefinitions: Record<string, ComponentDefinition>,
|
|
@@ -217,8 +225,8 @@ async function processHtmlForDev(
|
|
|
217
225
|
// However, images may not have source info if their ancestors don't have it
|
|
218
226
|
// In that case, fall back to searching for the image src
|
|
219
227
|
for (const entry of Object.values(result.entries)) {
|
|
220
|
-
if (entry.sourceType === 'image' && entry.
|
|
221
|
-
const imageSource = await findImageSourceLocation(entry.
|
|
228
|
+
if (entry.sourceType === 'image' && entry.imageMetadata?.src && !entry.sourcePath) {
|
|
229
|
+
const imageSource = await findImageSourceLocation(entry.imageMetadata.src)
|
|
222
230
|
if (imageSource) {
|
|
223
231
|
entry.sourcePath = imageSource.file
|
|
224
232
|
entry.sourceLine = imageSource.line
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collects errors during processing for aggregated reporting.
|
|
3
|
+
* This allows the build to continue while tracking what failed.
|
|
4
|
+
*/
|
|
5
|
+
export class ErrorCollector {
|
|
6
|
+
private errors: Array<{ context: string; error: Error }> = []
|
|
7
|
+
private warnings: Array<{ context: string; message: string }> = []
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Record an error with context about where it occurred.
|
|
11
|
+
*/
|
|
12
|
+
addError(context: string, error: Error): void {
|
|
13
|
+
this.errors.push({ context, error })
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Record a warning (non-fatal issue).
|
|
18
|
+
*/
|
|
19
|
+
addWarning(context: string, message: string): void {
|
|
20
|
+
this.warnings.push({ context, message })
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Check if any errors were recorded.
|
|
25
|
+
*/
|
|
26
|
+
hasErrors(): boolean {
|
|
27
|
+
return this.errors.length > 0
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Check if any warnings were recorded.
|
|
32
|
+
*/
|
|
33
|
+
hasWarnings(): boolean {
|
|
34
|
+
return this.warnings.length > 0
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Get all recorded errors.
|
|
39
|
+
*/
|
|
40
|
+
getErrors(): ReadonlyArray<{ context: string; error: Error }> {
|
|
41
|
+
return this.errors
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Get all recorded warnings.
|
|
46
|
+
*/
|
|
47
|
+
getWarnings(): ReadonlyArray<{ context: string; message: string }> {
|
|
48
|
+
return this.warnings
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Get a summary of all errors and warnings.
|
|
53
|
+
*/
|
|
54
|
+
getSummary(): string {
|
|
55
|
+
const lines: string[] = []
|
|
56
|
+
|
|
57
|
+
if (this.errors.length > 0) {
|
|
58
|
+
lines.push(`${this.errors.length} error(s):`)
|
|
59
|
+
for (const { context, error } of this.errors) {
|
|
60
|
+
lines.push(` - ${context}: ${error.message}`)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (this.warnings.length > 0) {
|
|
65
|
+
lines.push(`${this.warnings.length} warning(s):`)
|
|
66
|
+
for (const { context, message } of this.warnings) {
|
|
67
|
+
lines.push(` - ${context}: ${message}`)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return lines.join('\n')
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Clear all recorded errors and warnings.
|
|
76
|
+
*/
|
|
77
|
+
clear(): void {
|
|
78
|
+
this.errors = []
|
|
79
|
+
this.warnings = []
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Singleton error collector for the build process */
|
|
84
|
+
let globalErrorCollector: ErrorCollector | null = null
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Get the global error collector instance.
|
|
88
|
+
* Creates one if it doesn't exist.
|
|
89
|
+
*/
|
|
90
|
+
export function getErrorCollector(): ErrorCollector {
|
|
91
|
+
if (!globalErrorCollector) {
|
|
92
|
+
globalErrorCollector = new ErrorCollector()
|
|
93
|
+
}
|
|
94
|
+
return globalErrorCollector
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Reset the global error collector (call at start of each build).
|
|
99
|
+
*/
|
|
100
|
+
export function resetErrorCollector(): void {
|
|
101
|
+
if (globalErrorCollector) {
|
|
102
|
+
globalErrorCollector.clear()
|
|
103
|
+
} else {
|
|
104
|
+
globalErrorCollector = new ErrorCollector()
|
|
105
|
+
}
|
|
106
|
+
}
|