From f7ad4a38c5ecb160a559c03ffa81f432c9aeb59f Mon Sep 17 00:00:00 2001 From: Florian Schwalm Date: Wed, 20 Dec 2023 11:58:27 +0100 Subject: [PATCH 1/5] fix: Update parseJson() for v8 11.7.72 and newer Fixes #2355 Root cause: https://chromium-review.googlesource.com/c/v8/v8/+/4652014 --- lib/runtime/parseJson.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/runtime/parseJson.ts b/lib/runtime/parseJson.ts index 92579afeb..c26b2793b 100644 --- a/lib/runtime/parseJson.ts +++ b/lib/runtime/parseJson.ts @@ -1,4 +1,4 @@ -const rxParseJson = /position\s(\d+)$/ +const rxParseJson = /position\s(\d+)(?: \(line \d+ column \d+\))?$/ export function parseJson(s: string, pos: number): unknown { let endPos: number | undefined From 3f8b64410dbc3e8a507b64afee2c8132209ab727 Mon Sep 17 00:00:00 2001 From: Jason Ian Green Date: Fri, 16 Feb 2024 17:35:48 +0000 Subject: [PATCH 2/5] fix: #2330 fixed by removing node 14 (#2379) --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 45fdb2a07..8ab3775ff 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: - node-version: [14.x, 16.x, 18.x, 19.x] + node-version: [16.x, 18.x, 20.x] steps: - uses: actions/checkout@v2 @@ -23,7 +23,7 @@ jobs: - run: npm install - run: git submodule update --init - name: update website - if: ${{ github.event_name == 'push' && matrix.node-version == '14.x' }} + if: ${{ github.event_name == 'push' && matrix.node-version == '16.x' }} run: ./scripts/publish-site env: GH_TOKEN_PUBLIC: ${{ secrets.GH_TOKEN_PUBLIC }} From e6d38cc40197aa0f711a6ff70563eccc8bbaef69 Mon Sep 17 00:00:00 2001 From: Jason Ian Green Date: Sun, 18 Feb 2024 11:26:31 +0000 Subject: [PATCH 3/5] chore: add node 21.x (#2380) --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8ab3775ff..415889c83 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: - node-version: [16.x, 18.x, 20.x] + node-version: [16.x, 18.x, 20.x, 21.x] steps: - uses: actions/checkout@v2 From 0ca87765912aa12cb54f30d393eda31ad1dfd606 Mon Sep 17 00:00:00 2001 From: Jason Ian Green Date: Fri, 23 Feb 2024 16:28:24 +0000 Subject: [PATCH 4/5] chore: update dependencies (#2382) * chore: update dependencies * chore: add some major updates --- package.json | 74 ++++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/package.json b/package.json index 61ae2b999..8ddabaa04 100644 --- a/package.json +++ b/package.json @@ -58,53 +58,53 @@ "homepage": "https://ajv.js.org", "runkitExampleFilename": ".runkit_example.js", "dependencies": { - "fast-deep-equal": "^3.1.1", + "fast-deep-equal": "^3.1.3", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2", - "uri-js": "^4.2.2" + "uri-js": "^4.4.1" }, "devDependencies": { "@ajv-validator/config": "^0.3.0", - "@rollup/plugin-commonjs": "^24.0.0", - "@rollup/plugin-json": "^6.0.0", - "@rollup/plugin-node-resolve": "^15.0.1", - "@rollup/plugin-typescript": "^10.0.1", - "@types/chai": "^4.2.12", - "@types/mocha": "^10.0.0", - "@types/node": "^18.11.9", - "@types/require-from-string": "^1.2.0", - "@typescript-eslint/eslint-plugin": "^3.8.0", - "@typescript-eslint/parser": "^3.8.0", + "@rollup/plugin-commonjs": "^25.0.7", + "@rollup/plugin-json": "^6.1.0", + "@rollup/plugin-node-resolve": "^15.2.3", + "@rollup/plugin-typescript": "^11.1.6", + "@types/chai": "^4.3.11", + "@types/mocha": "^10.0.6", + "@types/node": "^20.11.19", + "@types/require-from-string": "^1.2.3", + "@typescript-eslint/eslint-plugin": "^3.10.1", + "@typescript-eslint/parser": "^3.10.1", "ajv-formats": "^3.0.0-rc.0", "browserify": "^17.0.0", - "chai": "^4.0.1", - "cross-env": "^7.0.2", - "dayjs": "^1.10.4", + "chai": "^4.4.1", + "cross-env": "^7.0.3", + "dayjs": "^1.11.10", "dayjs-plugin-utc": "^0.1.2", - "eslint": "^7.8.1", - "eslint-config-prettier": "^7.0.0", - "fast-uri": "^2.1.0", - "glob": "^8.0.2", - "husky": "^8.0.2", - "if-node-version": "^1.0.0", - "jimp": "^0.16.1", - "js-beautify": "^1.7.3", + "eslint": "^7.32.0", + "eslint-config-prettier": "^7.2.0", + "fast-uri": "^2.3.0", + "glob": "^10.3.10", + "husky": "^9.0.11", + "if-node-version": "^1.1.1", + "jimp": "^0.22.10", + "js-beautify": "^1.15.1", "json-schema-test": "^2.0.0", - "karma": "^6.0.0", - "karma-chrome-launcher": "^3.0.0", - "karma-mocha": "^2.0.0", - "lint-staged": "^13.0.3", - "mocha": "^10.0.0", - "module-from-string": "^3.1.3", - "node-fetch": "^3.0.0", - "nyc": "^15.0.0", - "prettier": "^2.3.1", - "re2": "^1.16.0", - "rollup": "^2.44.0", + "karma": "^6.4.2", + "karma-chrome-launcher": "^3.2.0", + "karma-mocha": "^2.0.1", + "lint-staged": "^15.2.2", + "mocha": "^10.3.0", + "module-from-string": "^3.3.0", + "node-fetch": "^3.3.2", + "nyc": "^15.1.0", + "prettier": "^2.8.8", + "re2": "^1.20.9", + "rollup": "^2.79.1", "rollup-plugin-terser": "^7.0.2", - "ts-node": "^10.0.0", - "tsify": "^5.0.2", - "typescript": "^4.8.0" + "ts-node": "^10.9.2", + "tsify": "^5.0.4", + "typescript": "^4.9.5" }, "collective": { "type": "opencollective", From 95218d3327d2eb12a4dc5d0c8c74e840b1be7015 Mon Sep 17 00:00:00 2001 From: Jason Ian Green Date: Fri, 23 Feb 2024 16:28:48 +0000 Subject: [PATCH 5/5] fix: minor linting issues (#2383) --- lib/compile/resolve.ts | 8 ++++---- lib/runtime/parseJson.ts | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/compile/resolve.ts b/lib/compile/resolve.ts index 4360eab06..be283866c 100644 --- a/lib/compile/resolve.ts +++ b/lib/compile/resolve.ts @@ -102,16 +102,16 @@ export function getSchemaRefs(this: Ajv, schema: AnySchema, baseId: string): Loc traverse(schema, {allKeys: true}, (sch, jsonPtr, _, parentJsonPtr) => { if (parentJsonPtr === undefined) return const fullPath = pathPrefix + jsonPtr - let baseId = baseIds[parentJsonPtr] - if (typeof sch[schemaId] == "string") baseId = addRef.call(this, sch[schemaId]) + let innerBaseId = baseIds[parentJsonPtr] + if (typeof sch[schemaId] == "string") innerBaseId = addRef.call(this, sch[schemaId]) addAnchor.call(this, sch.$anchor) addAnchor.call(this, sch.$dynamicAnchor) - baseIds[jsonPtr] = baseId + baseIds[jsonPtr] = innerBaseId function addRef(this: Ajv, ref: string): string { // eslint-disable-next-line @typescript-eslint/unbound-method const _resolve = this.opts.uriResolver.resolve - ref = normalizeId(baseId ? _resolve(baseId, ref) : ref) + ref = normalizeId(innerBaseId ? _resolve(innerBaseId, ref) : ref) if (schemaRefs.has(ref)) throw ambiguos(ref) schemaRefs.add(ref) let schOrRef = this.refs[ref] diff --git a/lib/runtime/parseJson.ts b/lib/runtime/parseJson.ts index c26b2793b..472e5e507 100644 --- a/lib/runtime/parseJson.ts +++ b/lib/runtime/parseJson.ts @@ -129,6 +129,7 @@ export function parseJsonString(s: string, pos: number): string | undefined { while (count--) { code <<= 4 c = s[pos] + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition if (c === undefined) { errorMessage("unexpected end") return undefined