diff --git a/src/express/middleware.ts b/src/express/middleware.ts index f528d96..8f2bbe3 100644 --- a/src/express/middleware.ts +++ b/src/express/middleware.ts @@ -1,12 +1,12 @@ import debug from 'debug'; import { NextFunction, Request, Response, RequestHandler } from 'express'; import { Profile } from 'pprof-format'; -import { Profiler } from '../profilers/profiler'; -import { PyroscopeProfiler } from '../profilers/pyroscope-profiler'; -import { WallProfilerStartArgs } from '../profilers/wall-profiler'; -import { getProfiler } from '../utils/pyroscope-profiler'; +import { Profiler } from '../profilers/profiler.js'; +import { PyroscopeProfiler } from '../profilers/pyroscope-profiler.js'; +import { WallProfilerStartArgs } from '../profilers/wall-profiler.js'; +import { getProfiler } from '../utils/pyroscope-profiler.js'; import { encode } from '@datadog/pprof'; -import { HeapProfilerStartArgs } from '../profilers/heap-profiler'; +import { HeapProfilerStartArgs } from '../profilers/heap-profiler.js'; const log = debug('pyroscope'); diff --git a/src/index.ts b/src/index.ts index e7a073c..243d74a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,19 +1,19 @@ -import 'regenerator-runtime/runtime'; +import 'regenerator-runtime/runtime.js'; -import expressMiddleware from './express/middleware'; -import { PyroscopeProfiler } from './profilers/pyroscope-profiler'; +import expressMiddleware from './express/middleware.js'; +import { PyroscopeProfiler } from './profilers/pyroscope-profiler.js'; import { PyroscopeConfig, PyroscopeHeapConfig, PyroscopeWallConfig, -} from './pyroscope-config'; -import { checkPyroscopeConfig } from './utils/check-pyroscope-config'; -import { getProfiler, setProfiler } from './utils/pyroscope-profiler'; -import { processConfig } from './utils/process-config'; -import { getEnv } from './utils/get-env'; +} from './pyroscope-config.js'; +import { checkPyroscopeConfig } from './utils/check-pyroscope-config.js'; +import { getProfiler, setProfiler } from './utils/pyroscope-profiler.js'; +import { processConfig } from './utils/process-config.js'; +import { getEnv } from './utils/get-env.js'; import { setLogger as datadogSetLogger } from '@datadog/pprof'; -import { setLogger as ourSetLogger, Logger } from './logger'; -import { SourceMapper } from './sourcemapper'; +import { setLogger as ourSetLogger, Logger } from './logger.js'; +import { SourceMapper } from './sourcemapper.js'; export function init(config: PyroscopeConfig = {}): void { checkPyroscopeConfig(config); diff --git a/src/profilers/continuous-profiler.ts b/src/profilers/continuous-profiler.ts index ffa4b75..aed47fa 100644 --- a/src/profilers/continuous-profiler.ts +++ b/src/profilers/continuous-profiler.ts @@ -1,6 +1,6 @@ import debug from 'debug'; -import { ProfileExport, ProfileExporter } from '../profile-exporter'; -import { Profiler } from './profiler'; +import { ProfileExport, ProfileExporter } from '../profile-exporter.js'; +import { Profiler } from './profiler.js'; const log = debug('pyroscope::profiler'); diff --git a/src/profilers/heap-profiler.ts b/src/profilers/heap-profiler.ts index 8db66d2..03ef1fa 100644 --- a/src/profilers/heap-profiler.ts +++ b/src/profilers/heap-profiler.ts @@ -1,8 +1,8 @@ import { heap, SourceMapper } from '@datadog/pprof'; import { Profile } from 'pprof-format'; -import { ProfileExport } from '../profile-exporter'; -import { Profiler } from './profiler'; +import { ProfileExport } from '../profile-exporter.js'; +import { Profiler } from './profiler.js'; import debug from 'debug'; const log = debug('pyroscope::profiler::heap'); diff --git a/src/profilers/profiler.ts b/src/profilers/profiler.ts index a4fbefd..4c57e2f 100644 --- a/src/profilers/profiler.ts +++ b/src/profilers/profiler.ts @@ -1,4 +1,4 @@ -import { ProfileExport } from '../profile-exporter'; +import { ProfileExport } from '../profile-exporter.js'; export interface Profiler { getLabels(): Record; diff --git a/src/profilers/pyroscope-profiler.ts b/src/profilers/pyroscope-profiler.ts index 3520d8b..fa952b0 100644 --- a/src/profilers/pyroscope-profiler.ts +++ b/src/profilers/pyroscope-profiler.ts @@ -1,8 +1,8 @@ -import { PyroscopeApiExporter } from '../pyroscope-api-exporter'; -import { ContinuousProfiler } from './continuous-profiler'; -import { WallProfiler, WallProfilerStartArgs } from './wall-profiler'; -import { HeapProfiler, HeapProfilerStartArgs } from './heap-profiler'; -import { PyroscopeConfig } from '../pyroscope-config'; +import { PyroscopeApiExporter } from '../pyroscope-api-exporter.js'; +import { ContinuousProfiler } from './continuous-profiler.js'; +import { WallProfiler, WallProfilerStartArgs } from './wall-profiler.js'; +import { HeapProfiler, HeapProfilerStartArgs } from './heap-profiler.js'; +import { PyroscopeConfig } from '../pyroscope-config.js'; const MICROS_PER_SECOND = 1e6; const MS_PER_SECOND = 1e3; diff --git a/src/profilers/wall-profiler.ts b/src/profilers/wall-profiler.ts index 445739d..fe09695 100644 --- a/src/profilers/wall-profiler.ts +++ b/src/profilers/wall-profiler.ts @@ -1,8 +1,8 @@ import { time, SourceMapper, LabelSet, TimeProfileNode } from '@datadog/pprof'; import { Profile } from 'pprof-format'; -import { ProfileExport } from '../profile-exporter'; -import { Profiler } from './profiler'; +import { ProfileExport } from '../profile-exporter.js'; +import { Profiler } from './profiler.js'; import debug from 'debug'; const MICROS_PER_SECOND = 1e6; diff --git a/src/pyroscope-api-exporter.ts b/src/pyroscope-api-exporter.ts index cb0b90e..c9efd3a 100644 --- a/src/pyroscope-api-exporter.ts +++ b/src/pyroscope-api-exporter.ts @@ -4,11 +4,11 @@ import { encode } from '@datadog/pprof'; import axios, { AxiosBasicCredentials, AxiosError } from 'axios'; import FormData, { Headers } from 'form-data'; import { Profile } from 'pprof-format'; -import { ProfileExport, ProfileExporter } from './profile-exporter'; -import { dateToUnixTimestamp } from './utils/date-to-unix-timestamp'; -import { processProfile } from './utils/process-profile'; +import { ProfileExport, ProfileExporter } from './profile-exporter.js'; +import { dateToUnixTimestamp } from './utils/date-to-unix-timestamp.js'; +import { processProfile } from './utils/process-profile.js'; import debug from 'debug'; -import { PyroscopeConfig } from './pyroscope-config'; +import { PyroscopeConfig } from './pyroscope-config.js'; const log = debug('pyroscope'); diff --git a/src/sourcemapper.ts b/src/sourcemapper.ts index 3356eb2..c6296b8 100644 --- a/src/sourcemapper.ts +++ b/src/sourcemapper.ts @@ -23,7 +23,7 @@ import * as fs from 'fs'; import * as path from 'path'; import * as sourceMap from 'source-map'; -import { logger } from './logger'; +import { logger } from './logger.js'; import pLimit from 'p-limit'; const readFile = fs.promises.readFile; diff --git a/src/utils/check-pyroscope-config.ts b/src/utils/check-pyroscope-config.ts index dc4fe7a..7945f5c 100644 --- a/src/utils/check-pyroscope-config.ts +++ b/src/utils/check-pyroscope-config.ts @@ -2,7 +2,7 @@ import { PyroscopeConfig, PyroscopeHeapConfig, PyroscopeWallConfig, -} from '../pyroscope-config'; +} from '../pyroscope-config.js'; export function checkPyroscopeConfig( config: unknown diff --git a/src/utils/get-env.ts b/src/utils/get-env.ts index 8326a0c..7764932 100644 --- a/src/utils/get-env.ts +++ b/src/utils/get-env.ts @@ -1,4 +1,4 @@ -import { Environment } from '../environment'; +import { Environment } from '../environment.js'; export function getEnv(): Environment { return { diff --git a/src/utils/process-config.ts b/src/utils/process-config.ts index 476d89f..4fff26f 100644 --- a/src/utils/process-config.ts +++ b/src/utils/process-config.ts @@ -1,5 +1,5 @@ -import { Environment } from '../environment'; -import { PyroscopeConfig } from '../pyroscope-config'; +import { Environment } from '../environment.js'; +import { PyroscopeConfig } from '../pyroscope-config.js'; export function processConfig( config: PyroscopeConfig, diff --git a/src/utils/pyroscope-profiler.ts b/src/utils/pyroscope-profiler.ts index 2c5471f..82bc19d 100644 --- a/src/utils/pyroscope-profiler.ts +++ b/src/utils/pyroscope-profiler.ts @@ -1,4 +1,4 @@ -import { PyroscopeProfiler } from '../profilers/pyroscope-profiler'; +import { PyroscopeProfiler } from '../profilers/pyroscope-profiler.js'; let pyroscopeProfiler: PyroscopeProfiler | undefined; diff --git a/test/index.test.ts b/test/index.test.ts index 23e08ed..c3bed60 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -2,8 +2,8 @@ import { describe, it, expect } from 'vitest'; import fs from 'node:fs'; import { Profile } from 'pprof-format'; -import Pyroscope from '../src'; -import { processProfile } from '../src/utils/process-profile'; +import Pyroscope from '../src/index.ts'; +import { processProfile } from '../src/utils/process-profile.ts'; describe('typescript env', () => { it('has correct imports', () => { diff --git a/test/middleware.test.ts b/test/middleware.test.ts index b1043f5..98efe04 100644 --- a/test/middleware.test.ts +++ b/test/middleware.test.ts @@ -1,6 +1,6 @@ import { describe, it, expect } from 'vitest'; -import Pyroscope from '../src'; +import Pyroscope from '../src/index.js'; import request from 'supertest'; import express from 'express'; diff --git a/test/profiler.test.ts b/test/profiler.test.ts index 113ea46..0327de5 100644 --- a/test/profiler.test.ts +++ b/test/profiler.test.ts @@ -1,6 +1,6 @@ import { describe, it, expect } from 'vitest'; -import Pyroscope from '../src'; +import Pyroscope from '../src/index.js'; import express from 'express'; import busboy from 'busboy'; import { Profile } from 'pprof-format';