* fix: add TypeScript decorator support to SWC transform
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
* fix: conditionally enable decorators based on tsconfig compilerOptions
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
* fix: use json5 for parsing tsconfig in decorator options
Replace manual regex-based JSONC parsing with json5 library for more
robust handling of comments and trailing commas in tsconfig.json files.
* bump
* apply fix
* DCO Remediation Commit for JJ Kasper <jj@jjsweb.site>
I, JJ Kasper <jj@jjsweb.site>, hereby add my Signed-off-by to this commit: aa1dc36
I, JJ Kasper <jj@jjsweb.site>, hereby add my Signed-off-by to this commit: e25f174
Signed-off-by: JJ Kasper <jj@jjsweb.site>
* DCO Remediation Commit for Rishabh <rishabh.pugalia@gmail.com>
I, Rishabh <rishabh.pugalia@gmail.com>, hereby add my Signed-off-by to this commit: e2f9304
I, Rishabh <rishabh.pugalia@gmail.com>, hereby add my Signed-off-by to this commit: 3faee5d
I, Rishabh <rishabh.pugalia@gmail.com>, hereby add my Signed-off-by to this commit: 9dbbda6
Signed-off-by: Rishabh <rishabh.pugalia@gmail.com>
---------
Signed-off-by: JJ Kasper <jj@jjsweb.site>
Signed-off-by: Rishabh <rishabh.pugalia@gmail.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
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:
decorators: trueto parser options for TypeScript and ECMAScriptlegacyDecorator: truefor TypeScript's experimentalDecoratorsdecoratorMetadata: truefor emitDecoratorMetadata support