Skip to content

move the build from swc to tsdown #20

Description

@mrhyde

tvt is the only repo still building with swc plus a separate tsc declaration pass and a tsfix postbuild. Everything else in #19 now matches ts-lib-starter.

The blocker is decorators. device.ts uses stage-3 decorators (@auth on five methods and a getter, @measure on one) and oxc only implements the legacy decorator transform, so tsdown emits the decorator syntax straight through: build/device.js comes out with @auth get version() in it and node fails to parse the file. Setting experimentalDecorators does make oxc transform them, but the legacy calling convention is (target, key, descriptor), which is not how auth and measure are written, and the type checker rejects it too. tsdown 0.22.14 / rolldown 1.2.1 were the current releases when this was checked.

Two ways out:

  1. Wait for oxc to ship the stage-3 decorator transform, then delete .swcrc, @swc/cli, @swc/core, rimraf and @2bad/tsfix (which npm now reports as deprecated) and add tsdown.config.ts matching the template.
  2. Drop the decorators and wrap the methods explicitly. Removes the dependency on any transform at the cost of a real change to device.ts.

Worth doing either way, since tsdown also brings publint and attw into the build, which tvt currently has no equivalent of.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions