-
Notifications
You must be signed in to change notification settings - Fork 158
fix: add TypeScript decorator support to SWC transform #769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Enable decorator parsing in SWC configuration to support codebases using TypeScript decorators (TypeORM, NestJS, class-validator, custom decorators). Without this fix, projects importing files with decorators fail with: "Unexpected token `@`. Expected identifier..." syntax errors. Changes: - Add `decorators: true` to parser options for TypeScript and ECMAScript - Add `legacyDecorator: true` for TypeScript's experimentalDecorators - Add `decoratorMetadata: true` for emitDecoratorMetadata support
Read experimentalDecorators and emitDecoratorMetadata from tsconfig.json to match Next.js behavior. Decorators are now only enabled when explicitly configured in the project's tsconfig. - Add getDecoratorOptionsForDirectory() to read tsconfig settings - Update applySwcTransform and Next.js loader to use tsconfig options - Handle JSONC format (comments, trailing commas) in tsconfig parsing
Replace manual regex-based JSONC parsing with json5 library for more robust handling of comments and trailing commas in tsconfig.json files.
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🧪 E2E Test Results❌ Some tests failed Summary
❌ Failed Tests🌍 Community Worlds (16 failed)mongodb (1 failed):
starter (14 failed):
turso (1 failed):
Details by Category✅ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
❌ 🌍 Community Worlds
|
📊 Benchmark Results
workflow with no steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) workflow with 1 step💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Nitro | Next.js (Turbopack) workflow with 10 sequential steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Express | Nitro Promise.all with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Nitro | Express Promise.all with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Express | Next.js (Turbopack) | Nitro Promise.race with 10 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Express | Nitro Promise.race with 25 concurrent steps💻 Local Development
▲ Production (Vercel)
🔍 Observability: Nitro | Express | Next.js (Turbopack) Stream Benchmarks (includes TTFB metrics)workflow with stream💻 Local Development
▲ Production (Vercel)
🔍 Observability: Next.js (Turbopack) | Express | Nitro SummaryFastest Framework by WorldWinner determined by most benchmark wins
Fastest World by FrameworkWinner determined by most benchmark wins
Column Definitions
Worlds:
|
| // Cache decorator options - tsconfig doesn't change during a build | ||
| let cachedDecoratorOptions: Awaited< | ||
| ReturnType<typeof getDecoratorOptionsForDirectory> | ||
| > | null = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I, JJ Kasper <[email protected]>, hereby add my Signed-off-by to this commit: aa1dc36 I, JJ Kasper <[email protected]>, hereby add my Signed-off-by to this commit: e25f174 Signed-off-by: JJ Kasper <[email protected]>
1e67595 to
3ab8956
Compare
validates #757