|
1 | 1 | import codeTransformer from '@apm-js-collab/code-transformer-bundler-plugins/bun'; |
2 | 2 | import { instrumentedModuleNames, withoutInstrumentedExternals } from '../config'; |
3 | | -import { jscSafeConstructorTransform } from './jscSafeConstructor'; |
4 | 3 | import { ORCHESTRION_BUNDLER_MARKER_BANNER } from './moduleInjectedTransform'; |
5 | 4 | import type { PluginOptions } from './options'; |
6 | 5 | import { orchestrionTransformOptions } from './options'; |
@@ -41,26 +40,11 @@ export function sentryOrchestrionPlugin(options: PluginOptions = {}): UnknownPlu |
41 | 40 | // the transformer's own `injectDiagnostics` — Bun injects the marker banner via its native |
42 | 41 | // `banner` config below (which, unlike the upstream path, needs no `outdir`). |
43 | 42 | // |
44 | | - // Override the built-in `traceSync` operator with the JSC-safe variant: Bun runs on |
45 | | - // JavaScriptCore, which rejects the default constructor instrumentation for DERIVED classes (e.g. |
46 | | - // `class Hono extends HonoBase`) because it reads `this` in a `finally` that doesn't lexically |
47 | | - // enclose `super()`. The override relocates that capture; it is a no-op for everything else, and |
48 | | - // is wired here (not in the shared options) because JSC is the only engine that needs it. |
49 | | - // |
50 | | - // This is ideally fixed upstream in the code transformer (so the default output is JSC-safe |
51 | | - // everywhere). It also only works because Bun instrumentation is BUILD-time today: this transform |
52 | | - // runs in the bundler. If/when Bun runtime instrumentation lands (see the class doc above — it |
53 | | - // does not exist yet), that path would use the built-in `traceSync` and start crashing again, so |
54 | | - // the upstream fix becomes necessary. For now, build-only Bun means this is sufficient. |
55 | | - // |
56 | 43 | // Typed upstream as an esbuild `Plugin`, but Bun passes its own `PluginBuilder` (which has the |
57 | 44 | // `onLoad` the transform uses) to `setup`. Cast to the Bun-compatible shape so we can forward |
58 | 45 | // Bun's builder to its `setup`. |
59 | 46 | const transformer = codeTransformer( |
60 | | - orchestrionTransformOptions( |
61 | | - { ...options, customTransforms: { ...options.customTransforms, traceSync: jscSafeConstructorTransform } }, |
62 | | - { injectDiagnostics: false }, |
63 | | - ), |
| 47 | + orchestrionTransformOptions(options, { injectDiagnostics: false }), |
64 | 48 | ) as unknown as { |
65 | 49 | setup: (build: BunPluginBuilder) => void; |
66 | 50 | }; |
|
0 commit comments