diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 45fdb2a07..415889c83 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, 21.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 }} 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 92579afeb..472e5e507 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 @@ -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 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",