From b8425d6ea086c69da388918fcf5df4af5750b86f Mon Sep 17 00:00:00 2001 From: Jason Green Date: Mon, 3 Jun 2024 22:45:31 +0100 Subject: [PATCH] feat: swap uri-js for fork toad-uri-js --- docs/options.md | 2 +- lib/compile/index.ts | 2 +- lib/compile/resolve.ts | 2 +- lib/runtime/uri.ts | 2 +- lib/types/index.ts | 2 +- package.json | 2 +- spec/resolve.spec.ts | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/options.md b/docs/options.md index 6f74b02b3..909cb033d 100644 --- a/docs/options.md +++ b/docs/options.md @@ -344,7 +344,7 @@ Include human-readable messages in errors. `true` by default. `false` can be pas ### uriResolver -By default `uriResolver` is undefined and relies on the embedded uriResolver [uri-js](https://github.com/garycourt/uri-js). Pass an object that satisfies the interface [UriResolver](https://github.com/ajv-validator/ajv/blob/master/lib/types/index.ts) to be used in replacement. One alternative is [fast-uri](https://github.com/fastify/fast-uri). +By default `uriResolver` is undefined and relies on the embedded uriResolver [toad-uri-js](https://github.com/kibertoad/toad-uri-js). Pass an object that satisfies the interface [UriResolver](https://github.com/ajv-validator/ajv/blob/master/lib/types/index.ts) to be used in replacement. One alternative is [fast-uri](https://github.com/fastify/fast-uri). ### code diff --git a/lib/compile/index.ts b/lib/compile/index.ts index 3dac2699b..1f1f8c844 100644 --- a/lib/compile/index.ts +++ b/lib/compile/index.ts @@ -14,7 +14,7 @@ import N from "./names" import {LocalRefs, getFullPath, _getFullPath, inlineRef, normalizeId, resolveUrl} from "./resolve" import {schemaHasRulesButRef, unescapeFragment} from "./util" import {validateFunctionCode} from "./validate" -import * as URI from "uri-js" +import * as URI from "toad-uri-js" import {JSONType} from "./rules" export type SchemaRefs = { diff --git a/lib/compile/resolve.ts b/lib/compile/resolve.ts index be283866c..cd22f3fdf 100644 --- a/lib/compile/resolve.ts +++ b/lib/compile/resolve.ts @@ -1,6 +1,6 @@ import type {AnySchema, AnySchemaObject, UriResolver} from "../types" import type Ajv from "../ajv" -import type {URIComponents} from "uri-js" +import type {URIComponents} from "toad-uri-js" import {eachItem} from "./util" import * as equal from "fast-deep-equal" import * as traverse from "json-schema-traverse" diff --git a/lib/runtime/uri.ts b/lib/runtime/uri.ts index 7dd35f9d1..2bf8aaa1f 100644 --- a/lib/runtime/uri.ts +++ b/lib/runtime/uri.ts @@ -1,4 +1,4 @@ -import * as uri from "uri-js" +import * as uri from "toad-uri-js" type URI = typeof uri & {code: string} ;(uri as URI).code = 'require("ajv/dist/runtime/uri").default' diff --git a/lib/types/index.ts b/lib/types/index.ts index b5ef53eeb..5bdd4ed66 100644 --- a/lib/types/index.ts +++ b/lib/types/index.ts @@ -1,4 +1,4 @@ -import * as URI from "uri-js" +import * as URI from "toad-uri-js" import type {CodeGen, Code, Name, ScopeValueSets, ValueScopeName} from "../compile/codegen" import type {SchemaEnv, SchemaCxt, SchemaObjCxt} from "../compile" import type {JSONType} from "../compile/rules" diff --git a/package.json b/package.json index ca56231a8..1655f9e27 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "fast-deep-equal": "^3.1.3", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2", - "uri-js": "^4.4.1" + "toad-uri-js": "^5.0.1" }, "devDependencies": { "@ajv-validator/config": "^0.5.0", diff --git a/spec/resolve.spec.ts b/spec/resolve.spec.ts index 2fe5b1041..65cbdee5d 100644 --- a/spec/resolve.spec.ts +++ b/spec/resolve.spec.ts @@ -14,7 +14,7 @@ uriResolvers.forEach((resolver) => { if (resolver !== undefined) { describeTitle = "fast-uri resolver" } else { - describeTitle = "uri-js resolver" + describeTitle = "toad-uri-js resolver" } describe(describeTitle, () => { describe("resolve", () => {