Skip to content

Commit

Permalink
refactor: use node: specifier imports and full relative path imports (
Browse files Browse the repository at this point in the history
#524)

* refactor: replace NodeJS internal module imports with `node:` specifier imports

* refactor: use full relative import paths
  • Loading branch information
wolfy1339 authored Dec 1, 2023
1 parent 0313fe9 commit 83ac1f8
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 10 deletions.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
"functions": 100,
"lines": 100
}
},
"moduleNameMapper": {
"^(.+)\\.jsx?$": "$1"
}
},
"release": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
import esbuild from "esbuild";
import { copyFile, readFile, writeFile, rm } from "fs/promises";
import { copyFile, readFile, writeFile, rm } from "node:fs/promises";
import { glob } from "glob";

/**
Expand Down
2 changes: 1 addition & 1 deletion src/error.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ResponseHeaders } from "@octokit/types";
import type { GraphQlEndpointOptions, GraphQlQueryResponse } from "./types";
import type { GraphQlEndpointOptions, GraphQlQueryResponse } from "./types.js";

type ServerResponseData<T> = Required<GraphQlQueryResponse<T>>;

Expand Down
4 changes: 2 additions & 2 deletions src/graphql.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { request as Request } from "@octokit/request";
import type { ResponseHeaders } from "@octokit/types";
import { GraphqlResponseError } from "./error";
import { GraphqlResponseError } from "./error.js";
import type {
GraphQlEndpointOptions,
RequestParameters,
GraphQlQueryResponse,
GraphQlQueryResponseData,
} from "./types";
} from "./types.js";

const NON_VARIABLE_OPTIONS = [
"method",
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { request } from "@octokit/request";
import { getUserAgent } from "universal-user-agent";

import { VERSION } from "./version";
import { VERSION } from "./version.js";

import { withDefaults } from "./with-defaults";
import { withDefaults } from "./with-defaults.js";

export const graphql = withDefaults(request, {
headers: {
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {
EndpointInterface,
} from "@octokit/types";

import { graphql } from "./graphql";
import type { graphql } from "./graphql.js";

export type GraphQlEndpointOptions = EndpointOptions & {
variables?: { [key: string]: unknown };
Expand Down
4 changes: 2 additions & 2 deletions src/with-defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type {
graphql as ApiInterface,
Query,
RequestParameters,
} from "./types";
import { graphql } from "./graphql";
} from "./types.js";
import { graphql } from "./graphql.js";

export function withDefaults(
request: typeof Request,
Expand Down
3 changes: 2 additions & 1 deletion test/tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"compilerOptions": {
"emitDeclarationOnly": false,
"noEmit": true,
"verbatimModuleSyntax": false
"verbatimModuleSyntax": false,
"allowImportingTsExtensions": true
},
"include": ["src/**/*"]
}

0 comments on commit 83ac1f8

Please sign in to comment.