Skip to content

drop decorators and build with tsdown - #21

Merged
mrhyde merged 1 commit into
masterfrom
chore/drop-decorators
Aug 2, 2026
Merged

drop decorators and build with tsdown#21
mrhyde merged 1 commit into
masterfrom
chore/drop-decorators

Conversation

@mrhyde

@mrhyde mrhyde commented Aug 2, 2026

Copy link
Copy Markdown
Member

Closes #20.

The decorators were the only thing keeping tvt on swc. oxc does not transform stage-3 decorators, so device.js came out of tsdown with @auth get version() still in it and node refused to parse the file. Rather than wait for oxc, the two decorators are gone.

@auth guarded five members by throwing when userId is unset. That is now a #requireAuth() private method called as the first statement of version, getInfo, logout, triggerAlarm and saveSnapshot. Same error, same message, same ordering relative to the method body.

@measure had a single use, on login, so the timing is inlined there. One behaviour change worth noting: the decorator called performance.now() around the synchronous call and logged before the promise settled, so for an async method it was reporting time-to-promise, effectively nothing. It now measures the awaited login and logs on success only, which is what the tvt:perf line always claimed to report.

With the decorators gone the build moves to tsdown, matching the template: .swcrc, tsconfig.build.json and the prebuild/postbuild/build:swc/build:types script chain are deleted, along with @swc/cli, @swc/core, rimraf and @2bad/tsfix (npm reports the last one as deprecated). publint and attw now run as part of every build and both pass. pnpm-workspace.yaml switches the release age exclusion to the template's @2bad/* wildcard.

Verified: check, build and the 13 unit tests pass, the emitted device.js has no decorator syntax left and all five #requireAuth call sites survive the transform, and importing the built entry works. The class still cannot be instantiated without the native SDK and a device, so the guard has no unit test, same as before.

@codecov

codecov Bot commented Aug 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 3.93%. Comparing base (b7317c3) to head (e30671b).

Files with missing lines Patch % Lines
source/device.ts 0.00% 10 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           master     #21      +/-   ##
=========================================
+ Coverage    3.81%   3.93%   +0.11%     
=========================================
  Files          11       9       -2     
  Lines         236     229       -7     
  Branches       35      35              
=========================================
  Hits            9       9              
+ Misses        198     191       -7     
  Partials       29      29              
Flag Coverage Δ
unit 3.93% <0.00%> (+0.11%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mrhyde
mrhyde merged commit 3ac77d2 into master Aug 2, 2026
6 of 7 checks passed
@mrhyde
mrhyde deleted the chore/drop-decorators branch August 2, 2026 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

move the build from swc to tsdown

1 participant