Skip to content

Commit

Permalink
Use node: module prefix for wider runtime support
Browse files Browse the repository at this point in the history
  • Loading branch information
ezzatron committed Nov 5, 2024
1 parent 49808fa commit af08182
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 14 deletions.
13 changes: 13 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ module.exports = {
node: true,
},
rules: {
"import/no-nodejs-modules": [
"error",
{
allow: [
"node:buffer",
"node:console",
"node:os",
"node:path",
"node:stream",
"node:url",
],
},
],
"no-unused-vars": [
"error",
{
Expand Down
2 changes: 1 addition & 1 deletion src/declaration/binary.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Buffer } from "buffer";
import { Buffer } from "node:buffer";
import type {
Constraint,
DeclarationConstraintOptions,
Expand Down
2 changes: 1 addition & 1 deletion src/initialize.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EOL } from "os";
import { EOL } from "node:os";
import { state, variablesByName } from "./environment.js";
import {
render as renderSpecification,
Expand Down
2 changes: 1 addition & 1 deletion src/specification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { PhrasingContent, RootContent, TableRow } from "mdast";
import { fromMarkdown } from "mdast-util-from-markdown";
import { gfmToMarkdown } from "mdast-util-gfm";
import { toMarkdown } from "mdast-util-to-markdown";
import { basename, join } from "path";
import { basename, join } from "node:path";
import {
extrinsicConstraints,
type ExtrinsicConstraint,
Expand Down
2 changes: 1 addition & 1 deletion src/table.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EOL } from "os";
import { EOL } from "node:os";

const segmenter = new Intl.Segmenter();

Expand Down
4 changes: 2 additions & 2 deletions test/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Console } from "console";
import { Transform } from "stream";
import { Console } from "node:console";
import { Transform } from "node:stream";
import { vi } from "vitest";

export function noop() {
Expand Down
2 changes: 1 addition & 1 deletion test/suite/declaration/binary.spec-d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Buffer } from "buffer";
import { Buffer } from "node:buffer";
import { describe, expectTypeOf, it } from "vitest";
import { binary } from "../../../src/index.js";
import { initialize } from "../../../src/node.js";
Expand Down
2 changes: 1 addition & 1 deletion test/suite/declaration/binary.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Buffer } from "buffer";
import { Buffer } from "node:buffer";
import { beforeEach, describe, expect, it } from "vitest";
import { Declaration } from "../../../src/declaration.js";
import { Options } from "../../../src/declaration/binary.js";
Expand Down
4 changes: 2 additions & 2 deletions test/suite/specification-prettier.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { join } from "path";
import { fileURLToPath } from "url";
import { join } from "node:path";
import { fileURLToPath } from "node:url";
import {
afterAll,
beforeAll,
Expand Down
4 changes: 2 additions & 2 deletions test/suite/specification.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Temporal } from "@js-temporal/polyfill";
import { join } from "path";
import { fileURLToPath } from "url";
import { join } from "node:path";
import { fileURLToPath } from "node:url";
import { beforeEach, describe, expect, it, vi } from "vitest";
import {
bigInteger,
Expand Down
4 changes: 2 additions & 2 deletions test/suite/summary.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Temporal } from "@js-temporal/polyfill";
import { join } from "path";
import { fileURLToPath } from "url";
import { join } from "node:path";
import { fileURLToPath } from "node:url";
import { beforeEach, describe, expect, it, vi } from "vitest";
import {
bigInteger,
Expand Down

0 comments on commit af08182

Please sign in to comment.