Comparing version 0.6.2 to 0.6.3
@@ -43,13 +43,21 @@ import { stat, readFile, writeFile } from 'node:fs/promises' | ||
const cache = {} | ||
const enc = new TextEncoder() | ||
for (let i = schemas.length; i--; ) { | ||
const schema = schemas[i] | ||
if (schema.$id) { | ||
cache[schema.$id] = schema | ||
cache[schema.$id] = enc.encode(JSON.stringify(schema)) | ||
} | ||
} | ||
globalThis.fetch = async () => { | ||
if (cache[arguments[0]]) return cache[arguments[0]] | ||
return _fetch(...arguments) | ||
globalThis.fetch = async (...args) => { | ||
if (cache[args[0].href]) { | ||
return Promise.resolve({ | ||
status: 200, | ||
body: true, | ||
arrayBuffer: async () => cache[args[0].href] | ||
}) | ||
} | ||
return _fetch(...args) | ||
} | ||
} |
@@ -30,3 +30,3 @@ import { stat, readFile, writeFile } from 'node:fs/promises' | ||
if (options?.testDataFiles) { | ||
const testDataFile = [] | ||
const testDataFiles = [] | ||
for (const testDataFilePath of options.testDataFiles) { | ||
@@ -33,0 +33,0 @@ const testDataFile = await readFile(testDataFilePath, { |
{ | ||
"name": "ajv-cmd", | ||
"version": "0.6.2", | ||
"version": "0.6.3", | ||
"description": "Deref, Validate, Transpile, and Test JSON-Schema (.json) files using ajv", | ||
@@ -5,0 +5,0 @@ "type": "module", |
150368
4305