From 3cff5c51ef25a568f98f41b04ddb5c97302b6488 Mon Sep 17 00:00:00 2001 From: erKam <88717125+erkamyaman@users.noreply.github.com> Date: Sun, 11 Oct 2026 06:16:42 +0300 Subject: [PATCH] fix(pipes): include the pipe lint in static reports pipe-lint is a pure source scan like get-pipes, but it was registered without snapshot: true, so pangular build never stored its result. In a static report the Pipes tab's Lint section always showed that the check could not run, and Refresh could not fix it. It is now baked in like the other source scans. --- packages/devtools/src/devframe.ts | 2 ++ .../src/rpc/__tests__/static-dump.test.ts | 29 +++++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/packages/devtools/src/devframe.ts b/packages/devtools/src/devframe.ts index b2124a4a..ed4387ad 100644 --- a/packages/devtools/src/devframe.ts +++ b/packages/devtools/src/devframe.ts @@ -458,6 +458,8 @@ const pangular = defineDevframe({ name: 'pipe-lint', type: 'query', jsonSerializable: true, + // A source scan like get-pipes, so a static report bakes it in too. + snapshot: true, handler: () => lintPipes(ctx.cwd), }); diff --git a/packages/devtools/src/rpc/__tests__/static-dump.test.ts b/packages/devtools/src/rpc/__tests__/static-dump.test.ts index 6e9b1ab0..b858983f 100644 --- a/packages/devtools/src/rpc/__tests__/static-dump.test.ts +++ b/packages/devtools/src/rpc/__tests__/static-dump.test.ts @@ -1,7 +1,7 @@ -import { writeFileSync } from 'node:fs'; +import { mkdirSync, writeFileSync } from 'node:fs'; import { join } from 'node:path'; import { createHostContext } from 'devframe/node'; -import { collectStaticRpcDump } from 'devframe/rpc/dump'; +import { collectStaticRpcDump, createClientFromDump, dumpFunctions } from 'devframe/rpc/dump'; import { describe, expect, it } from 'vitest'; import pangular from '../../devframe.ts'; import { fixtureDir } from './fixture-dir.ts'; @@ -28,8 +28,33 @@ describe('static report dump', () => { 'get-providers', 'get-pipes', 'get-ngrx-store', + 'pipe-lint', ].map((name) => `pangular:${name}`), ), ); }); + + it('answers the Pipes lint from the report', async () => { + const cwd = fixtureDir('pangular-dump-lint-'); + writeFileSync(join(cwd, 'package.json'), '{}'); + mkdirSync(join(cwd, 'src')); + writeFileSync( + join(cwd, 'src', 'debug.component.ts'), + `@Component({ selector: 'app-debug', template: '{{ user | json }}' })\nexport class Debug {}\n`, + ); + const host = { + mountStatic: () => {}, + resolveOrigin: () => 'http://localhost', + getStorageDir: () => '', + }; + const ctx = await createHostContext({ cwd, mode: 'build', host: host as never }); + await pangular.setup(ctx as never); + const pipes = ['pangular:get-pipes', 'pangular:pipe-lint'].map((name) => + ctx.rpc.definitions.get(name)!, + ); + const store = await dumpFunctions(pipes, ctx); + const client = createClientFromDump(store) as Record Promise>; + const findings = (await client['pangular:pipe-lint']()) as { rule: string }[]; + expect(findings.map((finding) => finding.rule)).toEqual(['json-pipe-in-template']); + }); });