Skip to content

Commit 5d877de

Browse files
committedJun 6, 2024
fix: avoid node: protocol for node 14 compatibility
resolves #243
1 parent 341faed commit 5d877de

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed
 

‎eslint.config.mjs

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export default unjs({
55
"test/fixtures/error-*"
66
],
77
rules: {
8-
"unicorn/no-null": 0
8+
"unicorn/no-null": 0,
9+
"unicorn/prefer-node-protocol": 0
910
},
1011
});

‎src/jiti.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "node:fs";
2-
import { Module, builtinModules } from "node:module";
3-
import { performance } from "node:perf_hooks";
4-
import { platform } from "node:os";
5-
import vm from "node:vm";
6-
import { fileURLToPath, pathToFileURL } from "node:url";
1+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
2+
import { Module, builtinModules } from "module";
3+
import { performance } from "perf_hooks";
4+
import { platform } from "os";
5+
import vm from "vm";
6+
import { fileURLToPath, pathToFileURL } from "url";
77
import { dirname, join, basename, extname } from "pathe";
88
import { destr } from "destr";
99
import escapeStringRegexp from "escape-string-regexp";

‎src/plugins/babel-plugin-transform-import-meta.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { pathToFileURL } from "node:url";
1+
import { pathToFileURL } from "url";
22
import { smart } from "@babel/template";
33
import type { NodePath, PluginObj } from "@babel/core";
44
import type { Statement, MemberExpression } from "@babel/types";

‎src/utils.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { lstatSync, accessSync, constants, readFileSync } from "node:fs";
2-
import { createHash } from "node:crypto";
3-
import { tmpdir } from "node:os";
1+
import { lstatSync, accessSync, constants, readFileSync } from "fs";
2+
import { createHash } from "crypto";
3+
import { tmpdir } from "os";
44
import { join } from "pathe";
55
import type { PackageJson } from "pkg-types";
66

0 commit comments

Comments
 (0)
Please sign in to comment.