Skip to content

Commit 605fb46

Browse files
authored
fix: switch to rollup for all instrumentations (#155)
1 parent 4e0a830 commit 605fb46

File tree

29 files changed

+432
-128
lines changed

29 files changed

+432
-128
lines changed

.eslintrc.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"root": true,
3-
"ignorePatterns": ["**/*"],
43
"plugins": ["@nx"],
54
"overrides": [
65
{

package-lock.json

Lines changed: 59 additions & 59 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
"@nx/eslint-plugin": "^17.2.8",
1515
"@nx/js": "^17.2.8",
1616
"@nx/linter": "^17.2.8",
17+
"@rollup/plugin-json": "^6.1.0",
18+
"@rollup/plugin-typescript": "^11.1.6",
1719
"@typescript-eslint/eslint-plugin": "^6.18.1",
1820
"@typescript-eslint/parser": "^6.18.1",
1921
"cz-conventional-changelog": "^3.3.0",
@@ -25,6 +27,8 @@
2527
"lerna": "^8.1.2",
2628
"nx": "^17.2.8",
2729
"prettier": "^3.0.3",
30+
"rollup": "^4.13.0",
31+
"rollup-plugin-dts": "^6.1.0",
2832
"typescript": "^5.2.2"
2933
},
3034
"workspaces": [

packages/instrumentation-azure/package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
"name": "@traceloop/instrumentation-azure",
33
"version": "0.5.23",
44
"description": "Azure OpenAI Instrumentaion",
5-
"main": "dist/src/index.js",
6-
"types": "dist/src/index.d.ts",
5+
"main": "dist/index.js",
6+
"module": "dist/index.mjs",
7+
"types": "dist/index.d.ts",
78
"repository": "traceloop/openllmetry-js",
89
"scripts": {
9-
"build": "tsc --build tsconfig.json",
10+
"build": "rollup -c",
1011
"lint": "eslint . --ext .ts",
1112
"lint:fix": "eslint . --ext .ts --fix",
1213
"test": "ts-mocha -p tsconfig.json 'test/**/*.test.ts'"
@@ -24,9 +25,9 @@
2425
"node": ">=14"
2526
},
2627
"files": [
27-
"dist/src/**/*.js",
28-
"dist/src/**/*.js.map",
29-
"dist/src/**/*.d.ts",
28+
"dist/**/*.js",
29+
"dist/**/*.js.map",
30+
"dist/**/*.d.ts",
3031
"doc",
3132
"LICENSE",
3233
"README.md",
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
const dts = require("rollup-plugin-dts");
2+
const typescript = require("@rollup/plugin-typescript");
3+
const json = require("@rollup/plugin-json");
4+
5+
// eslint-disable-next-line @typescript-eslint/no-var-requires
6+
const name = require("./package.json").main.replace(/\.js$/, "");
7+
8+
const bundle = (config) => ({
9+
...config,
10+
input: "src/index.ts",
11+
external: (id) => !/^[./]/.test(id),
12+
});
13+
14+
exports.default = [
15+
bundle({
16+
plugins: [typescript.default(), json.default()],
17+
output: [
18+
{
19+
file: `${name}.js`,
20+
format: "cjs",
21+
sourcemap: true,
22+
},
23+
{
24+
file: `${name}.mjs`,
25+
format: "es",
26+
sourcemap: true,
27+
},
28+
],
29+
}),
30+
bundle({
31+
plugins: [dts.default()],
32+
output: {
33+
file: `${name}.d.ts`,
34+
format: "es",
35+
},
36+
}),
37+
];

packages/instrumentation-azure/src/instrumentation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import type {
4141
import { version } from "../package.json";
4242

4343
export class AzureOpenAIInstrumentation extends InstrumentationBase<any> {
44-
protected override _config!: AzureOpenAIInstrumentationConfig;
44+
protected declare _config: AzureOpenAIInstrumentationConfig;
4545

4646
constructor(config: AzureOpenAIInstrumentationConfig = {}) {
4747
super("@traceloop/instrumentation-azure", version, config);

packages/instrumentation-bedrock/package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
"name": "@traceloop/instrumentation-bedrock",
33
"version": "0.5.23",
44
"description": "Amazon Bedrock Instrumentation",
5-
"main": "dist/src/index.js",
6-
"types": "dist/src/index.d.ts",
5+
"main": "dist/index.js",
6+
"module": "dist/index.mjs",
7+
"types": "dist/index.d.ts",
78
"repository": "traceloop/openllmetry-js",
89
"scripts": {
9-
"build": "tsc --build tsconfig.json",
10+
"build": "rollup -c",
1011
"lint": "eslint . --ext .ts",
1112
"lint:fix": "eslint . --ext .ts --fix",
1213
"test": "ts-mocha -p tsconfig.json 'tests/**/*.test.ts' --timeout 20000"
@@ -24,9 +25,9 @@
2425
"node": ">=14"
2526
},
2627
"files": [
27-
"dist/src/**/*.js",
28-
"dist/src/**/*.js.map",
29-
"dist/src/**/*.d.ts",
28+
"dist/**/*.js",
29+
"dist/**/*.js.map",
30+
"dist/**/*.d.ts",
3031
"doc",
3132
"LICENSE",
3233
"README.md",

0 commit comments

Comments
 (0)