Skip to content

Commit d3dcac5

Browse files
committed
Revert "Merge pull request #166 from seriousme/remove-node-url"
This reverts commit 8804ce7, reversing changes made to 4310628.
1 parent e4f417a commit d3dcac5

7 files changed

+16
-14
lines changed

CHANGELOG.md

-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
## [Unreleased]
44
### Changed
5-
6-
## [v2.2.4] 12-11-2024
7-
### Changed
8-
- fix: removed dependency on "node:url" to aid in bundling
95
- updated dependencies
106
- @biomejs/biome ^1.8.3 → ^1.9.4
117

index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { readFileSync } from "node:fs";
22
import { readFile } from "node:fs/promises";
3+
import { URL, fileURLToPath } from "node:url";
34
import Ajv04 from "ajv-draft-04";
45
import addFormats from "ajv-formats";
56
import Ajv2020 from "ajv/dist/2020.js";
@@ -13,8 +14,8 @@ const ajvVersions = {
1314
};
1415
const inlinedRefs = "x-inlined-refs";
1516

16-
function localFile(file) {
17-
return new URL(file, import.meta.url).pathname;
17+
function localFile(fileName) {
18+
return fileURLToPath(new URL(fileName, import.meta.url));
1819
}
1920

2021
function importJSON(file) {

test/check-versions.js

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { createHash } from "node:crypto";
33
import { readFileSync } from "node:fs";
44
import { readdir } from "node:fs/promises";
55
import { test } from "node:test";
6+
import { URL } from "node:url";
67
import { Validator } from "../index.js";
78
import { Snapshot } from "./snapshot.js";
89

test/test-bundle-cli.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import { strict as assert } from "node:assert/strict";
22
import { execSync } from "node:child_process";
33
import { readFileSync, unlinkSync } from "node:fs";
44
import { test } from "node:test";
5+
import { URL, fileURLToPath } from "node:url";
56
import { load } from "js-yaml";
67

7-
function localFile(file) {
8-
return new URL(file, import.meta.url).pathname;
8+
function localFile(fileName) {
9+
return fileURLToPath(new URL(fileName, import.meta.url));
910
}
1011

1112
function importJSON(file) {

test/test-validate-cli.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { strict as assert } from "node:assert/strict";
22
import { execSync } from "node:child_process";
33
import { test } from "node:test";
4+
import { URL, fileURLToPath } from "node:url";
45

5-
function localFile(file) {
6-
return new URL(file, import.meta.url).pathname;
6+
function localFile(fileName) {
7+
return fileURLToPath(new URL(fileName, import.meta.url));
78
}
89

910
const cli = localFile("../bin/validate-api-cli.js");

test/test-validation-refs.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { strict as assert } from "node:assert/strict";
22
import { test } from "node:test";
3+
import { URL, fileURLToPath } from "node:url";
34
import { Validator } from "../index.js";
45

5-
function localFile(file) {
6-
return new URL(file, import.meta.url).pathname;
6+
function localFile(fileName) {
7+
return fileURLToPath(new URL(fileName, import.meta.url));
78
}
89

910
const invalidRefsSpec = localFile("./validation/invalid-refs.yaml");

test/test-validation.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ import { strict as assert } from "node:assert/strict";
22
import { readFileSync } from "node:fs";
33
import { readFile } from "node:fs/promises";
44
import { test } from "node:test";
5+
import { URL, fileURLToPath } from "node:url";
56
import { Validator } from "../index.js";
67

7-
function localFile(file) {
8-
return new URL(file, import.meta.url).pathname;
8+
function localFile(fileName) {
9+
return fileURLToPath(new URL(fileName, import.meta.url));
910
}
1011

1112
function importJSON(file) {

0 commit comments

Comments
 (0)