@schemashift/core 0.8.0 → 0.9.0
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 +102 -0
- package/dist/index.cjs +1268 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +270 -1
- package/dist/index.d.ts +270 -1
- package/dist/index.js +1259 -65
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -282,6 +282,108 @@ if (info.detected) {
|
|
|
282
282
|
|
|
283
283
|
Supports: Zod 3.23+, Valibot 1.0+, ArkType 2.0+, @effect/schema, TypeBox 0.34+.
|
|
284
284
|
|
|
285
|
+
### BehavioralWarningAnalyzer
|
|
286
|
+
|
|
287
|
+
Detects behavioral differences between schema libraries during migration.
|
|
288
|
+
|
|
289
|
+
```typescript
|
|
290
|
+
import { BehavioralWarningAnalyzer } from '@schemashift/core';
|
|
291
|
+
|
|
292
|
+
const analyzer = new BehavioralWarningAnalyzer();
|
|
293
|
+
const result = analyzer.analyze(sourceFiles, 'yup', 'zod');
|
|
294
|
+
// result.warnings: grouped by category (coercion, validation-order, error-format)
|
|
295
|
+
for (const w of result.warnings) {
|
|
296
|
+
console.log(`[${w.category}] ${w.message}`);
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
**Tier:** FREE (all tiers)
|
|
301
|
+
|
|
302
|
+
### BundleEstimator
|
|
303
|
+
|
|
304
|
+
Estimates bundle size impact of switching schema libraries.
|
|
305
|
+
|
|
306
|
+
```typescript
|
|
307
|
+
import { BundleEstimator } from '@schemashift/core';
|
|
308
|
+
|
|
309
|
+
const estimator = new BundleEstimator();
|
|
310
|
+
const estimate = estimator.estimate(sourceFiles, 'zod', 'valibot');
|
|
311
|
+
console.log(`From: ${estimate.from.minifiedGzipKB}kB → To: ${estimate.to.minifiedGzipKB}kB`);
|
|
312
|
+
console.log(`Delta: ${estimate.estimatedDelta.toFixed(1)}kB (${estimate.deltaPercent.toFixed(0)}%)`);
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
**Tier:** INDIVIDUAL+
|
|
316
|
+
|
|
317
|
+
### PerformanceAnalyzer
|
|
318
|
+
|
|
319
|
+
Identifies potential performance impacts of migration.
|
|
320
|
+
|
|
321
|
+
```typescript
|
|
322
|
+
import { PerformanceAnalyzer } from '@schemashift/core';
|
|
323
|
+
|
|
324
|
+
const analyzer = new PerformanceAnalyzer();
|
|
325
|
+
const result = analyzer.analyze(sourceFiles, 'zod-v3', 'v4');
|
|
326
|
+
for (const w of result.warnings) {
|
|
327
|
+
console.log(`[${w.severity}] ${w.message}: ${w.detail}`);
|
|
328
|
+
}
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
**Tier:** INDIVIDUAL+
|
|
332
|
+
|
|
333
|
+
### TypeDedupDetector
|
|
334
|
+
|
|
335
|
+
Finds structurally similar schema definitions across files.
|
|
336
|
+
|
|
337
|
+
```typescript
|
|
338
|
+
import { TypeDedupDetector } from '@schemashift/core';
|
|
339
|
+
|
|
340
|
+
const detector = new TypeDedupDetector();
|
|
341
|
+
const result = detector.detect(sourceFiles);
|
|
342
|
+
for (const candidate of result.candidates) {
|
|
343
|
+
console.log(`Duplicate: ${candidate.schemas.map(s => s.name).join(', ')} (${candidate.confidence}% confidence)`);
|
|
344
|
+
}
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
**Tier:** INDIVIDUAL+
|
|
348
|
+
|
|
349
|
+
### TestScaffolder
|
|
350
|
+
|
|
351
|
+
Generates validation test stubs for migrated schemas.
|
|
352
|
+
|
|
353
|
+
```typescript
|
|
354
|
+
import { TestScaffolder } from '@schemashift/core';
|
|
355
|
+
|
|
356
|
+
const scaffolder = new TestScaffolder();
|
|
357
|
+
const result = scaffolder.scaffold(sourceFiles, 'yup', 'zod');
|
|
358
|
+
console.log(`Generated ${result.tests.length} test files for ${result.totalSchemas} schemas`);
|
|
359
|
+
for (const test of result.tests) {
|
|
360
|
+
console.log(` ${test.filePath} (${test.schemaCount} schemas)`);
|
|
361
|
+
}
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
**Tier:** PRO+
|
|
365
|
+
|
|
366
|
+
### MigrationAuditLog
|
|
367
|
+
|
|
368
|
+
Records detailed migration history for compliance and auditing.
|
|
369
|
+
|
|
370
|
+
```typescript
|
|
371
|
+
import { MigrationAuditLog } from '@schemashift/core';
|
|
372
|
+
|
|
373
|
+
const auditLog = new MigrationAuditLog('./project');
|
|
374
|
+
const entry = auditLog.createEntry({
|
|
375
|
+
file: 'src/schema.ts',
|
|
376
|
+
from: 'yup',
|
|
377
|
+
to: 'zod',
|
|
378
|
+
success: true,
|
|
379
|
+
warningsCount: 2,
|
|
380
|
+
});
|
|
381
|
+
auditLog.append(entry);
|
|
382
|
+
// Writes to .schemashift/audit-log.json
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
**Tier:** TEAM
|
|
386
|
+
|
|
285
387
|
### detectSchemaLibrary
|
|
286
388
|
|
|
287
389
|
Detects which schema library a module import refers to.
|