@pyreon/compiler 0.15.0 → 0.16.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 +17 -0
- package/lib/analysis/index.js.html +1 -1
- package/lib/index.js +966 -21
- package/lib/types/index.d.ts +97 -2
- package/package.json +15 -5
- package/src/index.ts +17 -0
- package/src/island-audit.ts +675 -0
- package/src/jsx.ts +22 -32
- package/src/load-native.ts +155 -0
- package/src/pyreon-intercept.ts +127 -1
- package/src/ssg-audit.ts +513 -0
- package/src/tests/detector-tag-consistency.test.ts +28 -15
- package/src/tests/island-audit.test.ts +524 -0
- package/src/tests/load-native.test.ts +53 -0
- package/src/tests/pyreon-intercept.test.ts +141 -0
- package/src/tests/ssg-audit.test.ts +402 -0
package/lib/types/index.d.ts
CHANGED
|
@@ -206,6 +206,14 @@ declare function diagnoseError(error: string): ErrorDiagnosis | null;
|
|
|
206
206
|
* - `as-unknown-as-vnodechild` — defensive `as unknown as VNodeChild`
|
|
207
207
|
* cast on JSX returns is unnecessary (`JSX.Element`
|
|
208
208
|
* is already assignable to `VNodeChild`).
|
|
209
|
+
* - `island-never-with-registry-entry` — an `island()` declared with
|
|
210
|
+
* `hydrate: 'never'` is also registered in the same
|
|
211
|
+
* file's `hydrateIslands({ ... })` call. The whole
|
|
212
|
+
* point of `'never'` is shipping zero client JS;
|
|
213
|
+
* registering pulls the component module into the
|
|
214
|
+
* client bundle graph (the runtime short-circuits
|
|
215
|
+
* and never calls the loader, but the bundler still
|
|
216
|
+
* includes the import). Drop the registry entry.
|
|
209
217
|
*
|
|
210
218
|
* Two-mode surface mirrors `react-intercept.ts`:
|
|
211
219
|
* - `detectPyreonPatterns(code)` — diagnostics only
|
|
@@ -226,7 +234,7 @@ declare function diagnoseError(error: string): ErrorDiagnosis | null;
|
|
|
226
234
|
* 2. CLI `pyreon doctor`
|
|
227
235
|
* 3. MCP server `validate` tool
|
|
228
236
|
*/
|
|
229
|
-
type PyreonDiagnosticCode = 'for-missing-by' | 'for-with-key' | 'props-destructured' | 'process-dev-gate' | 'empty-theme' | 'raw-add-event-listener' | 'raw-remove-event-listener' | 'date-math-random-id' | 'on-click-undefined' | 'signal-write-as-call' | 'static-return-null-conditional' | 'as-unknown-as-vnodechild';
|
|
237
|
+
type PyreonDiagnosticCode = 'for-missing-by' | 'for-with-key' | 'props-destructured' | 'process-dev-gate' | 'empty-theme' | 'raw-add-event-listener' | 'raw-remove-event-listener' | 'date-math-random-id' | 'on-click-undefined' | 'signal-write-as-call' | 'static-return-null-conditional' | 'as-unknown-as-vnodechild' | 'island-never-with-registry-entry';
|
|
230
238
|
interface PyreonDiagnostic {
|
|
231
239
|
/** Machine-readable code for filtering + programmatic handling */
|
|
232
240
|
code: PyreonDiagnosticCode;
|
|
@@ -292,5 +300,92 @@ declare function formatTestAudit(result: TestAuditResult, {
|
|
|
292
300
|
limit
|
|
293
301
|
}?: AuditFormatOptions): string;
|
|
294
302
|
//#endregion
|
|
295
|
-
|
|
303
|
+
//#region src/island-audit.d.ts
|
|
304
|
+
type IslandFindingCode = 'never-with-registry-entry' | 'duplicate-name' | 'registry-mismatch' | 'nested-island' | 'dead-island';
|
|
305
|
+
interface IslandLocation {
|
|
306
|
+
/** Absolute path */
|
|
307
|
+
path: string;
|
|
308
|
+
/** Path relative to the repo root for readable reporting */
|
|
309
|
+
relPath: string;
|
|
310
|
+
/** 1-based line number */
|
|
311
|
+
line: number;
|
|
312
|
+
/** 1-based column number */
|
|
313
|
+
column: number;
|
|
314
|
+
}
|
|
315
|
+
interface IslandFinding {
|
|
316
|
+
code: IslandFindingCode;
|
|
317
|
+
/** One-paragraph human-readable explanation, including the fix path. */
|
|
318
|
+
message: string;
|
|
319
|
+
/** Where the finding surfaces. */
|
|
320
|
+
location: IslandLocation;
|
|
321
|
+
/**
|
|
322
|
+
* Companion locations for cross-file findings (`duplicate-name` lists
|
|
323
|
+
* the OTHER occurrence; `nested-island` lists the inner island's
|
|
324
|
+
* declaration; `never-with-registry-entry` lists the matching island
|
|
325
|
+
* declaration).
|
|
326
|
+
*/
|
|
327
|
+
related?: IslandLocation[] | undefined;
|
|
328
|
+
}
|
|
329
|
+
interface IslandAuditResult {
|
|
330
|
+
root: string | null;
|
|
331
|
+
findings: IslandFinding[];
|
|
332
|
+
summary: {
|
|
333
|
+
filesScanned: number;
|
|
334
|
+
islandsDeclared: number;
|
|
335
|
+
registryEntries: number;
|
|
336
|
+
findingsByCode: Record<IslandFindingCode, number>;
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
declare function auditIslands(rootDir: string): IslandAuditResult;
|
|
340
|
+
interface IslandAuditFormatOptions {
|
|
341
|
+
/** When true, emit JSON instead of markdown-ish text. */
|
|
342
|
+
json?: boolean | undefined;
|
|
343
|
+
}
|
|
344
|
+
declare function formatIslandAudit(result: IslandAuditResult, options?: IslandAuditFormatOptions): string;
|
|
345
|
+
//#endregion
|
|
346
|
+
//#region src/ssg-audit.d.ts
|
|
347
|
+
type SsgFindingCode = '404-outside-layout-dir' | 'dynamic-route-missing-get-static-paths' | 'non-literal-revalidate-export';
|
|
348
|
+
interface SsgLocation {
|
|
349
|
+
/** Absolute path */
|
|
350
|
+
path: string;
|
|
351
|
+
/** Path relative to the repo root for readable reporting */
|
|
352
|
+
relPath: string;
|
|
353
|
+
/** 1-based line number */
|
|
354
|
+
line: number;
|
|
355
|
+
/** 1-based column number */
|
|
356
|
+
column: number;
|
|
357
|
+
}
|
|
358
|
+
interface SsgFinding {
|
|
359
|
+
code: SsgFindingCode;
|
|
360
|
+
/** One-paragraph human-readable explanation, including the fix path. */
|
|
361
|
+
message: string;
|
|
362
|
+
/** Where the finding surfaces. */
|
|
363
|
+
location: SsgLocation;
|
|
364
|
+
/**
|
|
365
|
+
* Companion locations for cross-file findings. Not currently emitted
|
|
366
|
+
* by any detector but kept in the contract so future codes have the
|
|
367
|
+
* shape available without an API change.
|
|
368
|
+
*/
|
|
369
|
+
related?: SsgLocation[] | undefined;
|
|
370
|
+
}
|
|
371
|
+
interface SsgAuditResult {
|
|
372
|
+
root: string | null;
|
|
373
|
+
findings: SsgFinding[];
|
|
374
|
+
summary: {
|
|
375
|
+
filesScanned: number;
|
|
376
|
+
routesScanned: number;
|
|
377
|
+
dynamicRoutes: number;
|
|
378
|
+
revalidateExports: number;
|
|
379
|
+
findingsByCode: Record<SsgFindingCode, number>;
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
declare function auditSsg(rootDir: string): SsgAuditResult;
|
|
383
|
+
interface SsgAuditFormatOptions {
|
|
384
|
+
/** Filter findings to a minimum severity. Currently all SSG findings
|
|
385
|
+
* are 'warning'-level; reserved for future severity tiers. */
|
|
386
|
+
minSeverity?: 'warning' | 'error' | undefined;
|
|
387
|
+
}
|
|
388
|
+
declare function formatSsgAudit(result: SsgAuditResult, _options?: SsgAuditFormatOptions): string;
|
|
389
|
+
//#endregion
|
|
390
|
+
export { type AuditFormatOptions, type AuditRisk, type CompilerWarning, type ComponentInfo, type ErrorDiagnosis, type IslandAuditFormatOptions, type IslandAuditResult, type IslandFinding, type IslandFindingCode, type IslandInfo, type IslandLocation, type MigrationChange, type MigrationResult, type ProjectContext, type PyreonDiagnostic, type PyreonDiagnosticCode, type ReactDiagnostic, type ReactDiagnosticCode, type RouteInfo, type SsgAuditFormatOptions, type SsgAuditResult, type SsgFinding, type SsgFindingCode, type SsgLocation, type TestAuditEntry, type TestAuditResult, type TransformResult, auditIslands, auditSsg, auditTestEnvironment, detectPyreonPatterns, detectReactPatterns, diagnoseError, formatIslandAudit, formatSsgAudit, formatTestAudit, generateContext, hasPyreonPatterns, hasReactPatterns, migrateReactCode, transformJSX, transformJSX_JS };
|
|
296
391
|
//# sourceMappingURL=index2.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pyreon/compiler",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "Template and JSX compiler for Pyreon",
|
|
5
5
|
"homepage": "https://github.com/pyreon/pyreon/tree/main/packages/compiler#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
|
38
38
|
"build": "vl_rolldown_build",
|
|
39
|
+
"build:native": "bun scripts/build-native.ts",
|
|
39
40
|
"dev": "vl_rolldown_build-watch",
|
|
40
41
|
"test": "vitest run",
|
|
41
42
|
"typecheck": "tsc --noEmit",
|
|
@@ -45,11 +46,20 @@
|
|
|
45
46
|
"dependencies": {
|
|
46
47
|
"oxc-parser": "^0.129.0"
|
|
47
48
|
},
|
|
49
|
+
"optionalDependencies": {
|
|
50
|
+
"@pyreon/compiler-darwin-arm64": "workspace:^",
|
|
51
|
+
"@pyreon/compiler-darwin-x64": "workspace:^",
|
|
52
|
+
"@pyreon/compiler-linux-arm64-gnu": "workspace:^",
|
|
53
|
+
"@pyreon/compiler-linux-arm64-musl": "workspace:^",
|
|
54
|
+
"@pyreon/compiler-linux-x64-gnu": "workspace:^",
|
|
55
|
+
"@pyreon/compiler-linux-x64-musl": "workspace:^",
|
|
56
|
+
"@pyreon/compiler-win32-x64-msvc": "workspace:^"
|
|
57
|
+
},
|
|
48
58
|
"devDependencies": {
|
|
49
|
-
"@pyreon/core": "^0.
|
|
50
|
-
"@pyreon/reactivity": "^0.
|
|
51
|
-
"@pyreon/runtime-dom": "^0.
|
|
52
|
-
"@pyreon/test-utils": "^0.13.
|
|
59
|
+
"@pyreon/core": "^0.16.0",
|
|
60
|
+
"@pyreon/reactivity": "^0.16.0",
|
|
61
|
+
"@pyreon/runtime-dom": "^0.16.0",
|
|
62
|
+
"@pyreon/test-utils": "^0.13.3",
|
|
53
63
|
"happy-dom": "^20.8.3"
|
|
54
64
|
},
|
|
55
65
|
"peerDependencies": {
|
package/src/index.ts
CHANGED
|
@@ -26,3 +26,20 @@ export type {
|
|
|
26
26
|
TestAuditResult,
|
|
27
27
|
} from './test-audit'
|
|
28
28
|
export { auditTestEnvironment, formatTestAudit } from './test-audit'
|
|
29
|
+
export type {
|
|
30
|
+
IslandAuditFormatOptions,
|
|
31
|
+
IslandAuditResult,
|
|
32
|
+
IslandFinding,
|
|
33
|
+
IslandFindingCode,
|
|
34
|
+
IslandLocation,
|
|
35
|
+
} from './island-audit'
|
|
36
|
+
export { auditIslands, formatIslandAudit } from './island-audit'
|
|
37
|
+
// M3.4 — `pyreon doctor --check-ssg` audit.
|
|
38
|
+
export type {
|
|
39
|
+
SsgAuditFormatOptions,
|
|
40
|
+
SsgAuditResult,
|
|
41
|
+
SsgFinding,
|
|
42
|
+
SsgFindingCode,
|
|
43
|
+
SsgLocation,
|
|
44
|
+
} from './ssg-audit'
|
|
45
|
+
export { auditSsg, formatSsgAudit } from './ssg-audit'
|