Main and component entries use removed `assert { type: 'json' }` syntax, and `/zod` export is uncompiled TypeScript with syntax errors
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 58/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript, node.js, typescript
- 领域
- build-system, release
调研方向
Start by reproducing both failures with the two node --input-type=module commands against a fresh install. Read scripts/generate-schemas.js (which emits the old assert { type: 'json' } import, unlike index.json.js) and scripts/generate-zod-schemas.js (which interpolates unescaped quotes/newlines into the 19 schema.zod.ts files), then check the exports map in package.json for ./zod. Done means both documented entry points import cleanly, generated files use with { type: 'json' }, and /zod ships compiled .js/.d.ts.
由索引模型根据 Issue 内容生成。
描述
Importing @patternfly/patternfly-component-schemas (or @patternfly/patternfly-component-schemas/components/*) fails on Node.js 22 and later with SyntaxError: Unexpected identifier 'assert', and @patternfly/patternfly-component-schemas/zod fails in both Node.js and TypeScript/bundlers.
npm install @patternfly/[email protected]
node --input-type=module -e "import { Button } from '@patternfly/patternfly-component-schemas'; console.log(Button.componentName);"
node --input-type=module -e "import { ButtonSchema } from '@patternfly/patternfly-component-schemas/zod'; console.log(ButtonSchema);"
Actual output (main entry):
file:///.../node_modules/@patternfly/patternfly-component-schemas/components/KeyboardHandler/index.js:2
import schema from './schema.json' assert { type: 'json' };
^^^^^^
SyntaxError: Unexpected identifier 'assert'
Actual output (/zod entry):
Error [ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING]: Stripping types is currently unsupported for files under node_modules, for "file:///.../node_modules/@patternfly/patternfly-component-schemas/zod/index.ts"
Bundling or type-checking @patternfly/patternfly-component-schemas/zod with esbuild, tsx, or tsc also fails to parse 19 generated components/*/schema.zod.ts files (for example .default('['BUTTON', 'A']') in components/KeyboardHandler/schema.zod.ts:30, unescaped multiline strings in components/TreeViewListItemBase/schema.zod.ts:12 and components/PopperOptions/schema.zod.ts:21, and \' inside z.custom<...>() in components/WizardContextProps/schema.zod.ts:28).
Expected output:
Both documented entry points import cleanly (Button.componentName logs "Button" and ButtonSchema loads as a Zod schema), matching @patternfly/patternfly-component-schemas/json.
scripts/generate-schemas.js emits import schema from './schema.json' assert { type: 'json' }; in all 479 components/*/index.js files instead of with { type: 'json' } (which index.json.js already uses), while package.json points "./zod" at raw ./zod/index.ts without compiled .js/.d.ts output and scripts/generate-zod-schemas.js interpolates unescaped quotes and newlines into generated TypeScript source.
Versions: @patternfly/[email protected] (npm latest) and main (b8509c3), Node.js v26.13.0.
Found with a differential-testing tool; the report was drafted with AI assistance and reviewed and edited by me.
Credit: https://ucsbplse.github.io/
- 主要语言
- TypeScript
- 星标
- 1
- 派生
- 3
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
patternfly/patternfly-component-schemas 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 48/100
-
难度 3/5 1-2 天 新手友好度 55/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 5/5 一周以上 新手友好度 25/100
查看 patternfly/patternfly-component-schemas 的全部 Issue
相似的 Issue
-
[Provider] antigravity-acp catalog omits gemini-4-hydrogen and gemini-4-neon that agy acp offers未关闭catalog provider provider-compatibility
难度 2/5 1-3 小时 新手友好度 62/100
lidge-jun/opencodex#9037 · 1 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 62/100
slavakurilyak/awesome-ai-agents#1005 ·
-
kind/bug triage/unresolved
难度 2/5 1-3 小时 新手友好度 60/100
维护者通常 1 天内回复
-
effort:S P3 refactor
难度 2/5 1-3 小时 新手友好度 72/100
nightscout/nocturne#3735 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
wpilibsuite/systemcore-blocks-interface#641 ·
维护者通常 2 天内回复