Skip to content

Commit

Permalink
chore: update import paths to use .js file extensions (#89)
Browse files Browse the repository at this point in the history
Co-authored-by: Bryan Huhta <[email protected]>
  • Loading branch information
zckrs and bryanhuhta authored Sep 11, 2024
1 parent ebd01d8 commit 02486d2
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 41 deletions.
10 changes: 5 additions & 5 deletions src/express/middleware.ts
Original file line number Diff line number Diff line change
@@ -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');

Expand Down
20 changes: 10 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/profilers/continuous-profiler.ts
Original file line number Diff line number Diff line change
@@ -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');

Expand Down
4 changes: 2 additions & 2 deletions src/profilers/heap-profiler.ts
Original file line number Diff line number Diff line change
@@ -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');
Expand Down
2 changes: 1 addition & 1 deletion src/profilers/profiler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ProfileExport } from '../profile-exporter';
import { ProfileExport } from '../profile-exporter.js';

export interface Profiler<TStartArgs> {
getLabels(): Record<string, number | string>;
Expand Down
10 changes: 5 additions & 5 deletions src/profilers/pyroscope-profiler.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/profilers/wall-profiler.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/pyroscope-api-exporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
2 changes: 1 addition & 1 deletion src/sourcemapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/check-pyroscope-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
PyroscopeConfig,
PyroscopeHeapConfig,
PyroscopeWallConfig,
} from '../pyroscope-config';
} from '../pyroscope-config.js';

export function checkPyroscopeConfig(
config: unknown
Expand Down
2 changes: 1 addition & 1 deletion src/utils/get-env.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Environment } from '../environment';
import { Environment } from '../environment.js';

export function getEnv(): Environment {
return {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/process-config.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/pyroscope-profiler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PyroscopeProfiler } from '../profilers/pyroscope-profiler';
import { PyroscopeProfiler } from '../profilers/pyroscope-profiler.js';

let pyroscopeProfiler: PyroscopeProfiler | undefined;

Expand Down
4 changes: 2 additions & 2 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/middleware.test.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down
2 changes: 1 addition & 1 deletion test/profiler.test.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down

0 comments on commit 02486d2

Please sign in to comment.