Skip to content

Conversation

@bartlomieju
Copy link
Member

An experiment where we use Deno and [ts-blank-space](https://github.com/bloomberg/ts-blank-space] to transpile ext/ crates, instead of using SWC.

This effectively makes Deno bootstrap itself and should help with compile times - we will no longer need to build SWC in build scripts to transpile sources.

This requires to rewrite some of the internal TS code to avoid limitations from https://github.com/bloomberg/ts-blank-space/blob/main/docs/unsupported_syntax.md, but has an added benefit that the extension code will map to proper places in the stack traces.

Copilot AI review requested due to automatic review settings November 9, 2025 10:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the telemetry module to support transpilation using ts-blank-space by converting TypeScript-specific syntax to JavaScript-compatible alternatives. The changes enable the code to be transpiled without unsupported TypeScript features.

  • Converts TypeScript enum declarations to const objects with type aliases using the as const pattern
  • Replaces private class members using underscore prefix convention with native JavaScript private fields (# syntax)
  • Adds a transpilation tool that validates the TypeScript code can be processed by ts-blank-space

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tools/transpile_ext.js New transpilation tool that validates telemetry.ts can be processed by ts-blank-space
ext/telemetry/telemetry.ts Converts 4 enums to const objects, refactors NonRecordingSpan and TraceStateClass to use private fields
Comments suppressed due to low confidence (1)

ext/telemetry/telemetry.ts:1529

    return context.setValue(SPAN_KEY, new NonRecordingSpan(spanContext));

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

1 participant