diff --git a/.github/workflows/nodejs-ci.yml b/.github/workflows/nodejs-ci.yml index 7d789b1..adcae28 100644 --- a/.github/workflows/nodejs-ci.yml +++ b/.github/workflows/nodejs-ci.yml @@ -10,10 +10,12 @@ permissions: {} jobs: build: - runs-on: ubuntu-latest + runs-on: ${{matrix.os}} + strategy: matrix: node-version: [ 'lts/-1', 'lts/*', 'node'] + os: [ubuntu-latest, windows-latest] steps: - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} diff --git a/CHANGELOG.md b/CHANGELOG.md index ee9fd26..9dc9676 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,6 @@ ## [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 diff --git a/index.js b/index.js index c7968ca..00b07e8 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,6 @@ 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"; @@ -13,8 +14,8 @@ const ajvVersions = { }; const inlinedRefs = "x-inlined-refs"; -function localFile(file) { - return new URL(file, import.meta.url).pathname; +function localFile(fileName) { + return fileURLToPath(new URL(fileName, import.meta.url)); } function importJSON(file) { diff --git a/test/check-versions.js b/test/check-versions.js index 847827b..30a86a8 100644 --- a/test/check-versions.js +++ b/test/check-versions.js @@ -3,6 +3,7 @@ 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"; diff --git a/test/test-bundle-cli.js b/test/test-bundle-cli.js index b206641..4341e38 100644 --- a/test/test-bundle-cli.js +++ b/test/test-bundle-cli.js @@ -2,10 +2,11 @@ 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(file) { - return new URL(file, import.meta.url).pathname; +function localFile(fileName) { + return fileURLToPath(new URL(fileName, import.meta.url)); } function importJSON(file) { diff --git a/test/test-validate-cli.js b/test/test-validate-cli.js index 5389d87..ccc1570 100644 --- a/test/test-validate-cli.js +++ b/test/test-validate-cli.js @@ -1,9 +1,10 @@ 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(file) { - return new URL(file, import.meta.url).pathname; +function localFile(fileName) { + return fileURLToPath(new URL(fileName, import.meta.url)); } const cli = localFile("../bin/validate-api-cli.js"); diff --git a/test/test-validation-refs.js b/test/test-validation-refs.js index 18a208a..1f5daf9 100644 --- a/test/test-validation-refs.js +++ b/test/test-validation-refs.js @@ -1,9 +1,10 @@ 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(file) { - return new URL(file, import.meta.url).pathname; +function localFile(fileName) { + return fileURLToPath(new URL(fileName, import.meta.url)); } const invalidRefsSpec = localFile("./validation/invalid-refs.yaml"); diff --git a/test/test-validation.js b/test/test-validation.js index 53713fe..d20cb16 100644 --- a/test/test-validation.js +++ b/test/test-validation.js @@ -2,10 +2,11 @@ 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(file) { - return new URL(file, import.meta.url).pathname; +function localFile(fileName) { + return fileURLToPath(new URL(fileName, import.meta.url)); } function importJSON(file) {