Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
},
"dependencies": {
"@ai-sdk/provider": "^1.1.3",
"@apm-js-collab/code-transformer": "^0.9.0",
"@apm-js-collab/code-transformer": "^0.11.0",
"@next/env": "^14.2.3",
"@vercel/functions": "^1.0.2",
"ajv": "^8.17.1",
Expand All @@ -209,7 +209,7 @@
"cli-progress": "^3.12.0",
"cli-table3": "^0.6.5",
"cors": "^2.8.5",
"dc-browser": "^1.0.3",
"dc-browser": "^1.0.4",
"dotenv": "^16.4.5",
"esbuild": "^0.27.0",
"eventsource-parser": "^1.1.2",
Expand Down
2 changes: 1 addition & 1 deletion js/src/auto-instrumentations/bundler/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export const unplugin = createUnplugin<BundlerPluginOptions>((options = {}) => {
}

// Try to get a transformer for this file
// Normalize the module path for Windows compatibility (WASM transformer expects forward slashes)
// Normalize the module path for Windows compatibility (transformer expects forward slashes)
const normalizedModulePath = moduleDetails.path.replace(/\\/g, "/");
const transformer = instrumentationMatcher.getTransformer(
moduleName,
Expand Down
2 changes: 1 addition & 1 deletion js/src/auto-instrumentations/bundler/webpack-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function codeTransformerLoader(
return callback(null, code, inputSourceMap);
}

// Normalize the module path for Windows compatibility (WASM transformer expects forward slashes)
// Normalize the module path for Windows compatibility (transformer expects forward slashes)
const normalizedModulePath = moduleDetails.path.replace(/\\/g, "/");

const matcher = getMatcher(options);
Expand Down
2 changes: 1 addition & 1 deletion js/src/auto-instrumentations/loader/cjs-patch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class ModulePatch {

const version = getPackageVersion(resolvedModule.basedir);

// Normalize module path for WASM transformer (expects forward slashes)
// Normalize module path for transformer (expects forward slashes)
const normalizedModulePath = resolvedModule.path.replace(/\\/g, "/");

const transformer = self.instrumentator.getTransformer(
Expand Down
10 changes: 8 additions & 2 deletions js/src/auto-instrumentations/loader/esm-hook.mts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export async function resolve(
if (resolvedModule && packages?.has(resolvedModule.name)) {
const version = getPackageVersion(resolvedModule.basedir);

// Normalize module path for WASM transformer (expects forward slashes)
// Normalize module path for transformer (expects forward slashes)
const normalizedModulePath = resolvedModule.path.replace(/\\/g, "/");

const transformer = instrumentator.getTransformer(
Expand Down Expand Up @@ -81,9 +81,15 @@ export async function load(url: string, context: any, nextLoad: Function) {
if (code) {
const transformer = transformers.get(url);
try {
const moduleType =
result.format === "module"
? "esm"
: result.format === "commonjs"
? "cjs"
: "unknown";
const transformedCode = transformer.transform(
code.toString("utf8"),
"unknown",
moduleType,
);
result.source = transformedCode?.code;
result.shortCircuit = true;
Expand Down
5 changes: 0 additions & 5 deletions js/tests/auto-instrumentations/transformation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ describe("Orchestrion Transformation Tests", () => {
// Verify orchestrion transformed the code
expect(output).toContain("tracingChannel");
expect(output).toContain("orchestrion:openai:chat.completions.create");
expect(output).toContain("tracePromise");
});

it("should bundle dc-browser module when browser: true", async () => {
Expand Down Expand Up @@ -149,7 +148,6 @@ describe("Orchestrion Transformation Tests", () => {
// Verify orchestrion transformed the code
expect(output).toContain("tracingChannel");
expect(output).toContain("orchestrion:openai:chat.completions.create");
expect(output).toContain("tracePromise");
});

it("should bundle dc-browser module when browser: true", async () => {
Expand Down Expand Up @@ -244,7 +242,6 @@ describe("Orchestrion Transformation Tests", () => {
expect(errors).toHaveLength(0);
expect(output).toContain("tracingChannel");
expect(output).toContain("orchestrion:openai:chat.completions.create");
expect(output).toContain("tracePromise");
});

it("should bundle dc-browser module when browser: true", async () => {
Expand Down Expand Up @@ -334,7 +331,6 @@ describe("Orchestrion Transformation Tests", () => {
expect(errors).toHaveLength(0);
expect(output).toContain("tracingChannel");
expect(output).toContain("orchestrion:openai:chat.completions.create");
expect(output).toContain("tracePromise");
});

it("should bundle dc-browser polyfill when browser: true (turbopack loader-only mode)", async () => {
Expand Down Expand Up @@ -418,7 +414,6 @@ describe("Orchestrion Transformation Tests", () => {
// Verify orchestrion transformed the code
expect(output).toContain("tracingChannel");
expect(output).toContain("orchestrion:openai:chat.completions.create");
expect(output).toContain("tracePromise");
});

it("should bundle dc-browser module when browser: true", async () => {
Expand Down
Loading
Loading