@adobe/jsonschema2md 7.1.1 → 7.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [7.1.2](https://github.com/adobe/jsonschema2md/compare/v7.1.1...v7.1.2) (2022-10-06)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **schemaproxy.js:** reuse previously proxied subschemas to fix max call stack size exceeded error ([1388449](https://github.com/adobe/jsonschema2md/commit/13884491df4c9ecc694f3881e40c1861f7acfdf8)), closes [/github.com/adobe/jsonschema2md/issues/252#issuecomment-806067867](https://github.com//github.com/adobe/jsonschema2md/issues/252/issues/issuecomment-806067867) [#252](https://github.com/adobe/jsonschema2md/issues/252)
7
+
1
8
  ## [7.1.1](https://github.com/adobe/jsonschema2md/compare/v7.1.0...v7.1.1) (2022-05-19)
2
9
 
3
10
 
@@ -34,7 +34,7 @@ function loadExamples(file, num = 1) {
34
34
  }
35
35
 
36
36
  const handler = ({
37
- root = '', fullpath = null, filename = '.', schemas, parent = null, slugger,
37
+ root = '', fullpath = null, filename = '.', schemas, subschemas, parent = null, slugger,
38
38
  }) => {
39
39
  const meta = {};
40
40
 
@@ -162,14 +162,23 @@ const handler = ({
162
162
  }
163
163
 
164
164
  // console.log('making new proxy from', target, prop, 'receiver', receiver[symbols.id]);
165
- const subschema = new Proxy(retval, handler({
166
- root: `${root}/${prop}`,
167
- parent: receiver,
168
- fullpath,
169
- filename,
170
- schemas,
171
- slugger,
172
- }));
165
+ let subschema;
166
+ if (subschemas.has(retval)) {
167
+ subschema = subschemas.get(retval);
168
+ }
169
+ else {
170
+ subschema = new Proxy(retval, handler({
171
+ root: `${root}/${prop}`,
172
+ parent: receiver,
173
+ fullpath,
174
+ filename,
175
+ schemas,
176
+ subschemas,
177
+ slugger,
178
+ }));
179
+
180
+ subschemas.set(retval, subschema);
181
+ }
173
182
 
174
183
  if (subschema[keyword`$id`]) {
175
184
  // stow away the schema for lookup
@@ -190,6 +199,8 @@ export default function loader() {
190
199
  files: {},
191
200
  };
192
201
 
202
+ const subschemas = new Map();
203
+
193
204
  const slugger = new GhSlugger();
194
205
 
195
206
  return (/** @type {string} */ name, /** @type {any} */ schema) => {
@@ -197,7 +208,7 @@ export default function loader() {
197
208
  const filename = path.basename(name);
198
209
  const fullpath = name === filename ? undefined : name;
199
210
  const proxied = new Proxy(schema, handler({
200
- filename, fullpath, schemas, slugger,
211
+ filename, fullpath, schemas, subschemas, slugger,
201
212
  }));
202
213
  schemas.loaded.push(proxied);
203
214
  if (proxied[keyword`$id`]) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@adobe/jsonschema2md",
3
3
  "description": "Validate and document complex JSON Schemas the easy way.",
4
- "version": "7.1.1",
4
+ "version": "7.1.2",
5
5
  "main": "lib/index.js",
6
6
  "typings": "types",
7
7
  "bin": {
@@ -16,7 +16,7 @@
16
16
  "start": "node cli.js",
17
17
  "examples": "node cli.js -d examples/schemas/ -o examples/docs/ -x examples/generated-schemas/",
18
18
  "test": " c8 --reporter=text --reporter=lcov --check-coverage --branches 80 --statements 95 --lines 95 mocha && node lib/locales/update.js",
19
- "test-ci": "c8 --reporter=text --reporter=lcov --check-coverage --branches 80 --statements 95 --lines 95 mocha --reporter xunit --reporter-options output=./junit/test-results.xml; codecov",
19
+ "test-ci": "c8 --reporter=text --reporter=lcov --check-coverage --branches 80 --statements 95 --lines 95 mocha --reporter xunit --reporter-options output=./junit/test-results.xml",
20
20
  "emit-types": "npx -p typescript tsc",
21
21
  "prepare": "husky install"
22
22
  },
@@ -37,33 +37,32 @@
37
37
  "remark-parse": "10.0.1",
38
38
  "remark-stringify": "10.0.2",
39
39
  "unified": "10.1.2",
40
- "unist-util-inspect": "7.0.0",
41
- "yargs": "17.5.0"
40
+ "unist-util-inspect": "7.0.1",
41
+ "yargs": "17.6.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@adobe/eslint-config-helix": "1.3.2",
45
45
  "@semantic-release/changelog": "6.0.1",
46
46
  "@semantic-release/git": "10.0.1",
47
- "@semantic-release/github": "8.0.4",
47
+ "@semantic-release/github": "8.0.6",
48
48
  "@types/fs-extra": "9.0.13",
49
49
  "@types/github-slugger": "1.3.0",
50
50
  "@types/js-yaml": "4.0.5",
51
- "@types/node": "16.11.35",
52
- "@types/yargs": "17.0.10",
53
- "c8": "7.11.2",
54
- "codecov": "3.8.3",
55
- "commitizen": "4.2.4",
51
+ "@types/node": "16.11.63",
52
+ "@types/yargs": "17.0.13",
53
+ "c8": "7.12.0",
54
+ "commitizen": "4.2.5",
56
55
  "cz-conventional-changelog": "3.3.0",
57
- "eslint": "8.15.0",
56
+ "eslint": "8.24.0",
58
57
  "eslint-plugin-header": "3.1.1",
59
58
  "eslint-plugin-import": "2.26.0",
60
59
  "husky": "8.0.1",
61
60
  "i18n-tag-schema": "2.5.0",
62
61
  "json-logic-js": "axa-ch/cyclic-schemas-test",
63
- "lint-staged": "12.4.1",
62
+ "lint-staged": "13.0.3",
64
63
  "mocha": "10.0.0",
65
- "semantic-release": "19.0.2",
66
- "typescript": "4.6.4",
64
+ "semantic-release": "19.0.5",
65
+ "typescript": "4.8.4",
67
66
  "unist-util-select": "4.0.1"
68
67
  },
69
68
  "engines": {