Skip to content

Commit

Permalink
fix: removed dependency on "node:url" to aid in bundling
Browse files Browse the repository at this point in the history
  • Loading branch information
seriousme committed Nov 12, 2024
1 parent 0a4a0d8 commit 0e34604
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]
### Changed

## [v2.2.4] 12-11-2024
### Changed
- fix: removed dependency on "node:url" to aid in bundling
- updated dependencies
- @biomejs/biome ^1.8.3 → ^1.9.4

Expand Down
5 changes: 2 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { readFileSync } from "node:fs";
import { readFile } from "node:fs/promises";
import { URL, fileURLToPath } from "node:url";
import Ajv04 from "ajv-draft-04";
import addFormats from "ajv-formats";
import Ajv2020 from "ajv/dist/2020.js";
Expand All @@ -14,8 +13,8 @@ const ajvVersions = {
};
const inlinedRefs = "x-inlined-refs";

function localFile(fileName) {
return fileURLToPath(new URL(fileName, import.meta.url));
function localFile(file) {
return new URL(file, import.meta.url).pathname;
}

function importJSON(file) {
Expand Down
1 change: 0 additions & 1 deletion test/check-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { createHash } from "node:crypto";
import { readFileSync } from "node:fs";
import { readdir } from "node:fs/promises";
import { test } from "node:test";
import { URL } from "node:url";
import { Validator } from "../index.js";
import { Snapshot } from "./snapshot.js";

Expand Down
5 changes: 2 additions & 3 deletions test/test-bundle-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import { strict as assert } from "node:assert/strict";
import { execSync } from "node:child_process";
import { readFileSync, unlinkSync } from "node:fs";
import { test } from "node:test";
import { URL, fileURLToPath } from "node:url";
import { load } from "js-yaml";

function localFile(fileName) {
return fileURLToPath(new URL(fileName, import.meta.url));
function localFile(file) {
return new URL(file, import.meta.url).pathname;
}

function importJSON(file) {
Expand Down
5 changes: 2 additions & 3 deletions test/test-validate-cli.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { strict as assert } from "node:assert/strict";
import { execSync } from "node:child_process";
import { test } from "node:test";
import { URL, fileURLToPath } from "node:url";

function localFile(fileName) {
return fileURLToPath(new URL(fileName, import.meta.url));
function localFile(file) {
return new URL(file, import.meta.url).pathname;
}

const cli = localFile("../bin/validate-api-cli.js");
Expand Down
5 changes: 2 additions & 3 deletions test/test-validation-refs.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { strict as assert } from "node:assert/strict";
import { test } from "node:test";
import { URL, fileURLToPath } from "node:url";
import { Validator } from "../index.js";

function localFile(fileName) {
return fileURLToPath(new URL(fileName, import.meta.url));
function localFile(file) {
return new URL(file, import.meta.url).pathname;
}

const invalidRefsSpec = localFile("./validation/invalid-refs.yaml");
Expand Down
5 changes: 2 additions & 3 deletions test/test-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import { strict as assert } from "node:assert/strict";
import { readFileSync } from "node:fs";
import { readFile } from "node:fs/promises";
import { test } from "node:test";
import { URL, fileURLToPath } from "node:url";
import { Validator } from "../index.js";

function localFile(fileName) {
return fileURLToPath(new URL(fileName, import.meta.url));
function localFile(file) {
return new URL(file, import.meta.url).pathname;
}

function importJSON(file) {
Expand Down

0 comments on commit 0e34604

Please sign in to comment.