@specverse/engine-registry 4.0.3 → 4.0.4
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/package.json +1 -1
- package/dist/cache/cache-manager.d.ts +0 -132
- package/dist/cache/cache-manager.d.ts.map +0 -1
- package/dist/cache/cache-manager.js +0 -218
- package/dist/cache/cache-manager.js.map +0 -1
- package/dist/client/registry-client.d.ts +0 -129
- package/dist/client/registry-client.d.ts.map +0 -1
- package/dist/client/registry-client.js +0 -317
- package/dist/client/registry-client.js.map +0 -1
- package/dist/formatters/error-formatter.d.ts +0 -100
- package/dist/formatters/error-formatter.d.ts.map +0 -1
- package/dist/formatters/error-formatter.js +0 -290
- package/dist/formatters/error-formatter.js.map +0 -1
- package/dist/formatters/index.d.ts +0 -8
- package/dist/formatters/index.d.ts.map +0 -1
- package/dist/formatters/index.js +0 -7
- package/dist/formatters/index.js.map +0 -1
- package/dist/index.d.ts +0 -19
- package/dist/index.js +0 -22
- package/dist/index.js.map +0 -1
- package/dist/offline/offline-handler.d.ts +0 -150
- package/dist/offline/offline-handler.d.ts.map +0 -1
- package/dist/offline/offline-handler.js +0 -290
- package/dist/offline/offline-handler.js.map +0 -1
- package/dist/types/index.d.ts +0 -13
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -11
- package/dist/types/index.js.map +0 -1
- package/dist/types/registry.d.ts +0 -220
- package/dist/types/registry.d.ts.map +0 -1
- package/dist/types/registry.js +0 -55
- package/dist/types/registry.js.map +0 -1
- package/dist/types/validation.d.ts +0 -197
- package/dist/types/validation.d.ts.map +0 -1
- package/dist/types/validation.js +0 -140
- package/dist/types/validation.js.map +0 -1
- package/dist/utils/manifest-adapter.d.ts +0 -42
- package/dist/utils/manifest-adapter.js +0 -182
- package/dist/utils/manifest-adapter.js.map +0 -1
- package/dist/validators/index.d.ts +0 -12
- package/dist/validators/index.d.ts.map +0 -1
- package/dist/validators/index.js +0 -9
- package/dist/validators/index.js.map +0 -1
- package/dist/validators/installation-validator.d.ts +0 -75
- package/dist/validators/installation-validator.d.ts.map +0 -1
- package/dist/validators/installation-validator.js +0 -142
- package/dist/validators/installation-validator.js.map +0 -1
- package/dist/validators/manifest-validator.d.ts +0 -82
- package/dist/validators/manifest-validator.d.ts.map +0 -1
- package/dist/validators/manifest-validator.js +0 -213
- package/dist/validators/manifest-validator.js.map +0 -1
- package/dist/validators/validator.d.ts +0 -113
- package/dist/validators/validator.d.ts.map +0 -1
- package/dist/validators/validator.js +0 -165
- package/dist/validators/validator.js.map +0 -1
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Registry HTTP Client
|
|
3
|
-
*
|
|
4
|
-
* Fetches instance factory metadata from the SpecVerse Registry API.
|
|
5
|
-
* Uses Node.js 18+ built-in fetch with retry logic and timeout handling.
|
|
6
|
-
*
|
|
7
|
-
* @module registry/client/registry-client
|
|
8
|
-
* @version 2.0.0
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Default configuration
|
|
12
|
-
*/
|
|
13
|
-
const DEFAULT_CONFIG = {
|
|
14
|
-
endpoint: process.env.SPECVERSE_REGISTRY_URL || 'https://specverse-lang-registry-api.vercel.app',
|
|
15
|
-
timeout: 10000,
|
|
16
|
-
retries: 3,
|
|
17
|
-
userAgent: 'SpecVerse CLI'
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Registry HTTP Client
|
|
21
|
-
*
|
|
22
|
-
* Handles communication with the SpecVerse Registry API to fetch
|
|
23
|
-
* instance factory metadata.
|
|
24
|
-
*/
|
|
25
|
-
export class RegistryClient {
|
|
26
|
-
config;
|
|
27
|
-
constructor(config) {
|
|
28
|
-
this.config = { ...DEFAULT_CONFIG, ...config };
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Fetch all instance factory metadata
|
|
32
|
-
*
|
|
33
|
-
* @param options - Query options for filtering
|
|
34
|
-
* @returns Registry response with factory metadata
|
|
35
|
-
*/
|
|
36
|
-
async fetchFactories(options = {}) {
|
|
37
|
-
const params = new URLSearchParams({ type: 'factory' });
|
|
38
|
-
if (options.capability) {
|
|
39
|
-
params.append('capability', options.capability);
|
|
40
|
-
}
|
|
41
|
-
if (options.framework) {
|
|
42
|
-
params.append('framework', options.framework);
|
|
43
|
-
}
|
|
44
|
-
if (options.tags && options.tags.length > 0) {
|
|
45
|
-
params.append('tags', options.tags.join(','));
|
|
46
|
-
}
|
|
47
|
-
if (options.deprecated !== undefined) {
|
|
48
|
-
params.append('deprecated', String(options.deprecated));
|
|
49
|
-
}
|
|
50
|
-
if (options.page !== undefined) {
|
|
51
|
-
params.append('page', String(options.page));
|
|
52
|
-
}
|
|
53
|
-
if (options.pageSize !== undefined) {
|
|
54
|
-
params.append('pageSize', String(options.pageSize));
|
|
55
|
-
}
|
|
56
|
-
const url = `${this.config.endpoint}/api/libraries?${params}`;
|
|
57
|
-
try {
|
|
58
|
-
const response = await this.fetchWithRetry(url);
|
|
59
|
-
if (!response.ok) {
|
|
60
|
-
throw new Error(`Registry returned ${response.status}: ${response.statusText}`);
|
|
61
|
-
}
|
|
62
|
-
const data = await response.json();
|
|
63
|
-
return this.transformResponse(data);
|
|
64
|
-
}
|
|
65
|
-
catch (error) {
|
|
66
|
-
throw new RegistryFetchError('Failed to fetch registry metadata', error);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Get specific factory metadata by name
|
|
71
|
-
*
|
|
72
|
-
* @param name - Factory name (e.g., "PrismaPostgres")
|
|
73
|
-
* @returns Factory metadata or null if not found
|
|
74
|
-
*/
|
|
75
|
-
async getFactory(name) {
|
|
76
|
-
const url = `${this.config.endpoint}/api/factories/${encodeURIComponent(name)}`;
|
|
77
|
-
try {
|
|
78
|
-
const response = await this.fetchWithRetry(url);
|
|
79
|
-
if (response.status === 404) {
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
if (!response.ok) {
|
|
83
|
-
throw new Error(`Registry returned ${response.status}: ${response.statusText}`);
|
|
84
|
-
}
|
|
85
|
-
const data = await response.json();
|
|
86
|
-
return this.transformFactory(data.factory || data);
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
if (error instanceof RegistryFetchError) {
|
|
90
|
-
throw error;
|
|
91
|
-
}
|
|
92
|
-
throw new RegistryFetchError(`Failed to fetch factory "${name}"`, error);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Search factories with fuzzy matching
|
|
97
|
-
*
|
|
98
|
-
* @param query - Search query string
|
|
99
|
-
* @param options - Search options
|
|
100
|
-
* @returns Search results with scores
|
|
101
|
-
*/
|
|
102
|
-
async search(query, options = {}) {
|
|
103
|
-
const params = new URLSearchParams({ q: query, type: 'factory' });
|
|
104
|
-
if (options.capability) {
|
|
105
|
-
params.append('capability', options.capability);
|
|
106
|
-
}
|
|
107
|
-
if (options.framework) {
|
|
108
|
-
params.append('framework', options.framework);
|
|
109
|
-
}
|
|
110
|
-
if (options.tags && options.tags.length > 0) {
|
|
111
|
-
params.append('tags', options.tags.join(','));
|
|
112
|
-
}
|
|
113
|
-
const url = `${this.config.endpoint}/api/search?${params}`;
|
|
114
|
-
try {
|
|
115
|
-
const response = await this.fetchWithRetry(url);
|
|
116
|
-
if (!response.ok) {
|
|
117
|
-
throw new Error(`Registry returned ${response.status}: ${response.statusText}`);
|
|
118
|
-
}
|
|
119
|
-
const data = await response.json();
|
|
120
|
-
return {
|
|
121
|
-
query,
|
|
122
|
-
results: data.results || [],
|
|
123
|
-
suggestions: data.suggestions || []
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
catch (error) {
|
|
127
|
-
throw new RegistryFetchError(`Failed to search for "${query}"`, error);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Get all capabilities with factory counts
|
|
132
|
-
*
|
|
133
|
-
* @returns Capabilities response
|
|
134
|
-
*/
|
|
135
|
-
async getCapabilities() {
|
|
136
|
-
const url = `${this.config.endpoint}/api/capabilities`;
|
|
137
|
-
try {
|
|
138
|
-
const response = await this.fetchWithRetry(url);
|
|
139
|
-
if (!response.ok) {
|
|
140
|
-
throw new Error(`Registry returned ${response.status}: ${response.statusText}`);
|
|
141
|
-
}
|
|
142
|
-
const data = await response.json();
|
|
143
|
-
return data;
|
|
144
|
-
}
|
|
145
|
-
catch (error) {
|
|
146
|
-
throw new RegistryFetchError('Failed to fetch capabilities', error);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Check if registry is accessible
|
|
151
|
-
*
|
|
152
|
-
* @returns True if registry is reachable
|
|
153
|
-
*/
|
|
154
|
-
async checkHealth() {
|
|
155
|
-
const url = `${this.config.endpoint}/health`;
|
|
156
|
-
try {
|
|
157
|
-
const response = await this.fetchWithRetry(url, 1); // Only one attempt
|
|
158
|
-
return response.ok;
|
|
159
|
-
}
|
|
160
|
-
catch {
|
|
161
|
-
return false;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Fetch with automatic retry and exponential backoff
|
|
166
|
-
*
|
|
167
|
-
* @param url - URL to fetch
|
|
168
|
-
* @param attempt - Current attempt number
|
|
169
|
-
* @returns Response object
|
|
170
|
-
*/
|
|
171
|
-
async fetchWithRetry(url, attempt = 1) {
|
|
172
|
-
try {
|
|
173
|
-
const controller = new AbortController();
|
|
174
|
-
const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
|
|
175
|
-
const response = await fetch(url, {
|
|
176
|
-
signal: controller.signal,
|
|
177
|
-
headers: {
|
|
178
|
-
'User-Agent': this.config.userAgent || 'SpecVerse CLI',
|
|
179
|
-
'Accept': 'application/json'
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
clearTimeout(timeoutId);
|
|
183
|
-
return response;
|
|
184
|
-
}
|
|
185
|
-
catch (error) {
|
|
186
|
-
// Check if we should retry
|
|
187
|
-
if (attempt < this.config.retries) {
|
|
188
|
-
// Exponential backoff: 1s, 2s, 3s, etc.
|
|
189
|
-
await this.delay(1000 * attempt);
|
|
190
|
-
return this.fetchWithRetry(url, attempt + 1);
|
|
191
|
-
}
|
|
192
|
-
// Max retries reached, throw error
|
|
193
|
-
throw error;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Delay helper for retry backoff
|
|
198
|
-
*
|
|
199
|
-
* @param ms - Milliseconds to delay
|
|
200
|
-
*/
|
|
201
|
-
delay(ms) {
|
|
202
|
-
return new Promise(resolve => setTimeout(resolve, ms));
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Transform registry API response to internal format
|
|
206
|
-
*
|
|
207
|
-
* Handles differences between registry API format and internal types.
|
|
208
|
-
*
|
|
209
|
-
* @param data - Raw API response
|
|
210
|
-
* @returns Transformed registry response
|
|
211
|
-
*/
|
|
212
|
-
transformResponse(data) {
|
|
213
|
-
return {
|
|
214
|
-
results: (data.results || []).map((lib) => this.transformFactory(lib)),
|
|
215
|
-
total: data.total || 0,
|
|
216
|
-
page: data.page || 1,
|
|
217
|
-
pageSize: data.pageSize || data.results?.length || 0
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Transform single factory from API format to internal format
|
|
222
|
-
*
|
|
223
|
-
* @param lib - Raw library/factory data from API
|
|
224
|
-
* @returns Transformed factory metadata
|
|
225
|
-
*/
|
|
226
|
-
transformFactory(lib) {
|
|
227
|
-
const factoryMeta = lib.factoryMeta || {};
|
|
228
|
-
return {
|
|
229
|
-
name: lib.name,
|
|
230
|
-
displayName: lib.displayName || lib.name,
|
|
231
|
-
category: lib.category || 'unknown',
|
|
232
|
-
capabilities: factoryMeta.capabilities || [],
|
|
233
|
-
framework: factoryMeta.framework || null,
|
|
234
|
-
deprecated: lib.deprecated || false,
|
|
235
|
-
deprecationReason: factoryMeta.deprecationReason,
|
|
236
|
-
replacedBy: factoryMeta.replacedBy,
|
|
237
|
-
alternatives: factoryMeta.alternatives || [],
|
|
238
|
-
source: {
|
|
239
|
-
type: factoryMeta.sourceType || 'npm',
|
|
240
|
-
package: factoryMeta.sourcePackage,
|
|
241
|
-
version: factoryMeta.sourceVersion,
|
|
242
|
-
entrypoint: factoryMeta.sourceEntrypoint || 'factory.yaml',
|
|
243
|
-
url: factoryMeta.sourceUrl,
|
|
244
|
-
checksum: factoryMeta.sourceChecksum
|
|
245
|
-
},
|
|
246
|
-
tags: (lib.tags || []).map((t) => (typeof t === 'string' ? t : t.name)),
|
|
247
|
-
description: lib.description || '',
|
|
248
|
-
license: lib.license,
|
|
249
|
-
repository: lib.repository,
|
|
250
|
-
stats: {
|
|
251
|
-
downloads: lib.downloadCount || 0,
|
|
252
|
-
stars: lib.starCount || 0
|
|
253
|
-
},
|
|
254
|
-
createdAt: lib.createdAt || new Date().toISOString(),
|
|
255
|
-
updatedAt: lib.updatedAt || new Date().toISOString()
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Get the configured endpoint URL
|
|
260
|
-
*/
|
|
261
|
-
getEndpoint() {
|
|
262
|
-
return this.config.endpoint;
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* Update client configuration
|
|
266
|
-
*
|
|
267
|
-
* @param config - Partial config to merge
|
|
268
|
-
*/
|
|
269
|
-
updateConfig(config) {
|
|
270
|
-
this.config = { ...this.config, ...config };
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Registry fetch error
|
|
275
|
-
*
|
|
276
|
-
* Thrown when registry API requests fail.
|
|
277
|
-
*/
|
|
278
|
-
export class RegistryFetchError extends Error {
|
|
279
|
-
cause;
|
|
280
|
-
constructor(message, cause) {
|
|
281
|
-
super(message);
|
|
282
|
-
this.cause = cause;
|
|
283
|
-
this.name = 'RegistryFetchError';
|
|
284
|
-
// Preserve stack trace
|
|
285
|
-
if (Error.captureStackTrace) {
|
|
286
|
-
Error.captureStackTrace(this, RegistryFetchError);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Check if error is due to network issues
|
|
291
|
-
*/
|
|
292
|
-
isNetworkError() {
|
|
293
|
-
return (this.cause?.name === 'AbortError' ||
|
|
294
|
-
this.cause?.name === 'TypeError' ||
|
|
295
|
-
this.cause?.code === 'ECONNREFUSED' ||
|
|
296
|
-
this.cause?.code === 'ENOTFOUND');
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Check if error is due to timeout
|
|
300
|
-
*/
|
|
301
|
-
isTimeout() {
|
|
302
|
-
return this.cause?.name === 'AbortError';
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Get user-friendly error message
|
|
306
|
-
*/
|
|
307
|
-
getUserMessage() {
|
|
308
|
-
if (this.isTimeout()) {
|
|
309
|
-
return 'Request timed out. The registry may be slow or unreachable.';
|
|
310
|
-
}
|
|
311
|
-
if (this.isNetworkError()) {
|
|
312
|
-
return 'Network error. Check your internet connection and try again.';
|
|
313
|
-
}
|
|
314
|
-
return this.message;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
//# sourceMappingURL=registry-client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"registry-client.js","sourceRoot":"","sources":["../../src/client/registry-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA6BH;;GAEG;AACH,MAAM,cAAc,GAAyB;IAC3C,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,sBAAsB,IAAI,gDAAgD;IAChG,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,CAAC;IACV,SAAS,EAAE,eAAe;CAC3B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,OAAO,cAAc;IACjB,MAAM,CAAuB;IAErC,YAAY,MAAsC;QAChD,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,cAAc,EAAE,GAAG,MAAM,EAAE,CAAC;IACjD,CAAC;IAED;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;IACH,cAAc;QACZ,IAAI,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;YACrB,OAAO,6DAA6D,CAAC;QACvE,CAAC;QAED,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;YAC1B,OAAO,8DAA8D,CAAC;QACxE,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Error Formatter
|
|
3
|
-
*
|
|
4
|
-
* Formats validation issues for beautiful console output.
|
|
5
|
-
* Provides colored, contextualized error messages with suggestions.
|
|
6
|
-
*
|
|
7
|
-
* @module registry/formatters/error-formatter
|
|
8
|
-
* @version 2.0.0
|
|
9
|
-
*/
|
|
10
|
-
import type { ValidationIssue, ValidationResult } from '../types/index.js';
|
|
11
|
-
import type { ValidationReport } from '../validators/validator.js';
|
|
12
|
-
/**
|
|
13
|
-
* Error formatter options
|
|
14
|
-
*/
|
|
15
|
-
export interface ErrorFormatterOptions {
|
|
16
|
-
/** Use colors in output (default: true) */
|
|
17
|
-
colors?: boolean;
|
|
18
|
-
/** Show suggestions (default: true) */
|
|
19
|
-
showSuggestions?: boolean;
|
|
20
|
-
/** Show fix commands (default: true) */
|
|
21
|
-
showFix?: boolean;
|
|
22
|
-
/** Show "learn more" URLs (default: true) */
|
|
23
|
-
showLearnMore?: boolean;
|
|
24
|
-
/** Compact mode - less verbose (default: false) */
|
|
25
|
-
compact?: boolean;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Error Formatter
|
|
29
|
-
*
|
|
30
|
-
* Formats validation issues for console output.
|
|
31
|
-
*/
|
|
32
|
-
export declare class ErrorFormatter {
|
|
33
|
-
private options;
|
|
34
|
-
constructor(options?: ErrorFormatterOptions);
|
|
35
|
-
/**
|
|
36
|
-
* Format a complete validation report
|
|
37
|
-
*
|
|
38
|
-
* @param report - Validation report to format
|
|
39
|
-
* @returns Formatted string ready for console output
|
|
40
|
-
*/
|
|
41
|
-
formatReport(report: ValidationReport): string;
|
|
42
|
-
/**
|
|
43
|
-
* Format validation result
|
|
44
|
-
*
|
|
45
|
-
* @param result - Validation result to format
|
|
46
|
-
* @returns Formatted string
|
|
47
|
-
*/
|
|
48
|
-
formatResult(result: ValidationResult): string;
|
|
49
|
-
/**
|
|
50
|
-
* Format a single validation issue
|
|
51
|
-
*
|
|
52
|
-
* @param issue - Issue to format
|
|
53
|
-
* @returns Formatted string
|
|
54
|
-
*/
|
|
55
|
-
formatIssue(issue: ValidationIssue): string;
|
|
56
|
-
/**
|
|
57
|
-
* Format header
|
|
58
|
-
*
|
|
59
|
-
* @param report - Validation report
|
|
60
|
-
* @returns Formatted header
|
|
61
|
-
*/
|
|
62
|
-
private formatHeader;
|
|
63
|
-
/**
|
|
64
|
-
* Format summary
|
|
65
|
-
*
|
|
66
|
-
* @param report - Validation report
|
|
67
|
-
* @returns Formatted summary
|
|
68
|
-
*/
|
|
69
|
-
private formatSummary;
|
|
70
|
-
/**
|
|
71
|
-
* Format footer
|
|
72
|
-
*
|
|
73
|
-
* @param report - Validation report
|
|
74
|
-
* @returns Formatted footer
|
|
75
|
-
*/
|
|
76
|
-
private formatFooter;
|
|
77
|
-
/**
|
|
78
|
-
* Get icon for severity
|
|
79
|
-
*
|
|
80
|
-
* @param severity - Issue severity
|
|
81
|
-
* @returns Icon character
|
|
82
|
-
*/
|
|
83
|
-
private getIcon;
|
|
84
|
-
/**
|
|
85
|
-
* Get color for severity
|
|
86
|
-
*
|
|
87
|
-
* @param severity - Issue severity
|
|
88
|
-
* @returns ANSI color code
|
|
89
|
-
*/
|
|
90
|
-
private getSeverityColor;
|
|
91
|
-
/**
|
|
92
|
-
* Apply color to text
|
|
93
|
-
*
|
|
94
|
-
* @param colorCode - ANSI color code
|
|
95
|
-
* @param text - Text to color
|
|
96
|
-
* @returns Colored text (or plain text if colors disabled)
|
|
97
|
-
*/
|
|
98
|
-
private color;
|
|
99
|
-
}
|
|
100
|
-
//# sourceMappingURL=error-formatter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"error-formatter.d.ts","sourceRoot":"","sources":["../../src/formatters/error-formatter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAuBnE;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,2CAA2C;IAC3C,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,uCAAuC;IACvC,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B,wCAAwC;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,6CAA6C;IAC7C,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,mDAAmD;IACnD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAAkC;gBAErC,OAAO,GAAE,qBAA0B;IAU/C;;;;;OAKG;IACH,YAAY,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM;IA+C9C;;;;;OAKG;IACH,YAAY,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM;IAoC9C;;;;;OAKG;IACH,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM;IAiD3C;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAYpB;;;;;OAKG;IACH,OAAO,CAAC,aAAa;IA0CrB;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAiBpB;;;;;OAKG;IACH,OAAO,CAAC,OAAO;IAaf;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAaxB;;;;;;OAMG;IACH,OAAO,CAAC,KAAK;CAOd"}
|