@emulsify/cli 1.4.2 → 1.6.0
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/README.md +5 -1
- package/dist/handlers/componentInstall.js +8 -4
- package/dist/handlers/init.js +1 -1
- package/dist/handlers/systemInstall.js +3 -2
- package/dist/index.js +1 -0
- package/dist/node_modules/.package-lock.json +19 -28
- package/dist/node_modules/@types/node/README.md +3 -3
- package/dist/node_modules/@types/node/async_hooks.d.ts +1 -1
- package/dist/node_modules/@types/node/buffer.d.ts +64 -0
- package/dist/node_modules/@types/node/crypto.d.ts +28 -4
- package/dist/node_modules/@types/node/globals.d.ts +141 -8
- package/dist/node_modules/@types/node/http.d.ts +3 -1
- package/dist/node_modules/@types/node/http2.d.ts +4 -3
- package/dist/node_modules/@types/node/index.d.ts +0 -1
- package/dist/node_modules/@types/node/inspector.d.ts +1 -1
- package/dist/node_modules/@types/node/net.d.ts +15 -3
- package/dist/node_modules/@types/node/package.json +3 -8
- package/dist/node_modules/@types/node/process.d.ts +1 -1
- package/dist/node_modules/@types/node/stream.d.ts +8 -8
- package/dist/node_modules/@types/node/timers.d.ts +3 -3
- package/dist/node_modules/@types/node/tls.d.ts +2 -1
- package/dist/node_modules/@types/node/url.d.ts +31 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/README.md +2 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/code.d.ts +1 -0
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/code.js +9 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/code.js.map +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/index.js +8 -9
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/index.js.map +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/parse.js +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/parse.js.map +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/serialize.js +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/serialize.js.map +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/ref_error.d.ts +2 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/ref_error.js +3 -3
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/ref_error.js.map +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/resolve.d.ts +5 -5
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/resolve.js +13 -11
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/resolve.js.map +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/index.js +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/index.js.map +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/core.d.ts +4 -2
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/core.js +20 -17
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/core.js.map +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/uri.d.ts +6 -0
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/uri.js +6 -0
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/runtime/uri.js.map +1 -0
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/standalone/index.js +8 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/standalone/index.js.map +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/types/index.d.ts +6 -0
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/types/jtd-schema.d.ts +2 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/ref.js +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/index.js +10 -3
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/ref.js +3 -2
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/ref.js.map +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/enum.js +4 -3
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/enum.js.map +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/compile/codegen/code.ts +8 -0
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/compile/index.ts +8 -8
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/compile/jtd/parse.ts +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/compile/jtd/serialize.ts +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/compile/ref_error.ts +4 -3
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/compile/resolve.ts +15 -12
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/compile/validate/index.ts +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/core.ts +9 -2
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/runtime/uri.ts +6 -0
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/standalone/index.ts +9 -2
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/types/index.ts +7 -0
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/types/json-schema.ts +1 -4
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/types/jtd-schema.ts +4 -5
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/core/ref.ts +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/discriminator/index.ts +11 -3
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/ref.ts +3 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/enum.ts +5 -3
- package/dist/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/limitProperties.ts +1 -1
- package/dist/node_modules/ajv-formats/node_modules/ajv/package.json +5 -3
- package/dist/node_modules/debug/README.md +3 -0
- package/dist/node_modules/debug/package.json +1 -1
- package/dist/node_modules/debug/src/common.js +1 -1
- package/dist/node_modules/fs-extra/README.md +3 -5
- package/dist/node_modules/fs-extra/lib/{copy-sync → copy}/copy-sync.js +11 -8
- package/dist/node_modules/fs-extra/lib/copy/copy.js +12 -9
- package/dist/node_modules/fs-extra/lib/copy/index.js +2 -1
- package/dist/node_modules/fs-extra/lib/empty/index.js +10 -19
- package/dist/node_modules/fs-extra/lib/ensure/index.js +15 -15
- package/dist/node_modules/fs-extra/lib/ensure/link.js +10 -7
- package/dist/node_modules/fs-extra/lib/ensure/symlink.js +34 -15
- package/dist/node_modules/fs-extra/lib/fs/index.js +8 -10
- package/dist/node_modules/fs-extra/lib/index.js +1 -12
- package/dist/node_modules/fs-extra/lib/json/output-json-sync.js +1 -1
- package/dist/node_modules/fs-extra/lib/json/output-json.js +1 -1
- package/dist/node_modules/fs-extra/lib/mkdirs/make-dir.js +16 -130
- package/dist/node_modules/fs-extra/lib/mkdirs/utils.js +21 -0
- package/dist/node_modules/fs-extra/lib/move/index.js +2 -1
- package/dist/node_modules/fs-extra/lib/{move-sync → move}/move-sync.js +12 -5
- package/dist/node_modules/fs-extra/lib/move/move.js +14 -4
- package/dist/node_modules/fs-extra/lib/{output → output-file}/index.js +0 -0
- package/dist/node_modules/fs-extra/lib/remove/index.js +15 -2
- package/dist/node_modules/fs-extra/lib/util/stat.js +60 -45
- package/dist/node_modules/fs-extra/package.json +7 -10
- package/dist/node_modules/graceful-fs/LICENSE +1 -1
- package/dist/node_modules/graceful-fs/graceful-fs.js +23 -4
- package/dist/node_modules/graceful-fs/package.json +1 -1
- package/dist/node_modules/graceful-fs/polyfills.js +39 -30
- package/dist/node_modules/ramda/dist/ramda.js +4 -4
- package/dist/node_modules/ramda/dist/ramda.min.js +1 -1
- package/dist/node_modules/ramda/es/trim.js +1 -1
- package/dist/node_modules/ramda/package.json +1 -1
- package/dist/node_modules/ramda/src/trim.js +1 -1
- package/dist/package.json +4 -4
- package/dist/schemas/variant.json +28 -5
- package/dist/util/cache/cloneIntoCache.js +1 -7
- package/dist/util/getAvailableStarters.js +1 -1
- package/dist/util/platform/getInitSuccessMessageForPlatform.js +4 -3
- package/dist/util/project/buildComponentDependencyList.js +20 -0
- package/package.json +5 -5
- package/dist/node_modules/at-least-node/LICENSE +0 -6
- package/dist/node_modules/at-least-node/README.md +0 -25
- package/dist/node_modules/at-least-node/index.js +0 -5
- package/dist/node_modules/at-least-node/package.json +0 -32
- package/dist/node_modules/fs-extra/CHANGELOG.md +0 -902
- package/dist/node_modules/fs-extra/lib/copy-sync/index.js +0 -5
- package/dist/node_modules/fs-extra/lib/move-sync/index.js +0 -5
|
@@ -17,7 +17,8 @@ const def = {
|
|
|
17
17
|
if (!$data && schema.length === 0)
|
|
18
18
|
throw new Error("enum must have non-empty array");
|
|
19
19
|
const useLoop = schema.length >= it.opts.loopEnum;
|
|
20
|
-
|
|
20
|
+
let eql;
|
|
21
|
+
const getEql = () => (eql !== null && eql !== void 0 ? eql : (eql = (0, util_1.useFunc)(gen, equal_1.default)));
|
|
21
22
|
let valid;
|
|
22
23
|
if (useLoop || $data) {
|
|
23
24
|
valid = gen.let("valid");
|
|
@@ -33,12 +34,12 @@ const def = {
|
|
|
33
34
|
cxt.pass(valid);
|
|
34
35
|
function loopEnum() {
|
|
35
36
|
gen.assign(valid, false);
|
|
36
|
-
gen.forOf("v", schemaCode, (v) => gen.if((0, codegen_1._) `${
|
|
37
|
+
gen.forOf("v", schemaCode, (v) => gen.if((0, codegen_1._) `${getEql()}(${data}, ${v})`, () => gen.assign(valid, true).break()));
|
|
37
38
|
}
|
|
38
39
|
function equalCode(vSchema, i) {
|
|
39
40
|
const sch = schema[i];
|
|
40
41
|
return typeof sch === "object" && sch !== null
|
|
41
|
-
? (0, codegen_1._) `${
|
|
42
|
+
? (0, codegen_1._) `${getEql()}(${data}, ${vSchema}[${i}])`
|
|
42
43
|
: (0, codegen_1._) `${data} === ${sch}`;
|
|
43
44
|
}
|
|
44
45
|
},
|
package/dist/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/enum.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/enum.ts"],"names":[],"mappings":";;AAEA,mDAAuD;AACvD,6CAA0C;AAC1C,+CAAuC;AAIvC,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,4CAA4C;IACrD,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,mBAAmB,UAAU,GAAG;CAC5D,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,OAAO;IACnB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACtD,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;QACpF,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAA;QACjD,MAAM,GAAG,GAAG,IAAA,cAAO,EAAC,GAAG,EAAE,eAAK,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/enum.ts"],"names":[],"mappings":";;AAEA,mDAAuD;AACvD,6CAA0C;AAC1C,+CAAuC;AAIvC,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,4CAA4C;IACrD,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,mBAAmB,UAAU,GAAG;CAC5D,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,OAAO;IACnB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACtD,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;QACpF,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAA;QACjD,IAAI,GAAqB,CAAA;QACzB,MAAM,MAAM,GAAG,GAAS,EAAE,CAAC,CAAC,GAAG,aAAH,GAAG,cAAH,GAAG,IAAH,GAAG,GAAK,IAAA,cAAO,EAAC,GAAG,EAAE,eAAK,CAAC,EAAC,CAAA;QAExD,IAAI,KAAW,CAAA;QACf,IAAI,OAAO,IAAI,KAAK,EAAE;YACpB,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;YACxB,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;SAChC;aAAM;YACL,wBAAwB;YACxB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;YACvE,MAAM,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;YAChD,KAAK,GAAG,IAAA,YAAE,EAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAW,EAAE,CAAS,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;SAC7E;QACD,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAEf,SAAS,QAAQ;YACf,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;YACxB,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,UAAkB,EAAE,CAAC,CAAC,EAAE,EAAE,CACvC,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,MAAM,EAAE,IAAI,IAAI,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,CAC7E,CAAA;QACH,CAAC;QAED,SAAS,SAAS,CAAC,OAAa,EAAE,CAAS;YACzC,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;YACrB,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;gBAC5C,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,MAAM,EAAE,IAAI,IAAI,KAAK,OAAO,IAAI,CAAC,IAAI;gBAC3C,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,QAAQ,GAAG,EAAE,CAAA;QAC3B,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"}
|
|
@@ -4,7 +4,7 @@ const codegen_1 = require("../../compile/codegen");
|
|
|
4
4
|
const error = {
|
|
5
5
|
message({ keyword, schemaCode }) {
|
|
6
6
|
const comp = keyword === "maxProperties" ? "more" : "fewer";
|
|
7
|
-
return (0, codegen_1.str) `must NOT have ${comp} than ${schemaCode}
|
|
7
|
+
return (0, codegen_1.str) `must NOT have ${comp} than ${schemaCode} properties`;
|
|
8
8
|
},
|
|
9
9
|
params: ({ schemaCode }) => (0, codegen_1._) `{limit: ${schemaCode}}`,
|
|
10
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"limitProperties.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/limitProperties.ts"],"names":[],"mappings":";;AAEA,mDAAuD;AAEvD,MAAM,KAAK,GAA2B;IACpC,OAAO,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC;QAC3B,MAAM,IAAI,GAAG,OAAO,KAAK,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAA;QAC3D,OAAO,IAAA,aAAG,EAAA,iBAAiB,IAAI,SAAS,UAAU,
|
|
1
|
+
{"version":3,"file":"limitProperties.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/limitProperties.ts"],"names":[],"mappings":";;AAEA,mDAAuD;AAEvD,MAAM,KAAK,GAA2B;IACpC,OAAO,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC;QAC3B,MAAM,IAAI,GAAG,OAAO,KAAK,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAA;QAC3D,OAAO,IAAA,aAAG,EAAA,iBAAiB,IAAI,SAAS,UAAU,aAAa,CAAA;IACjE,CAAC;IACD,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,UAAU,GAAG;CACpD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC;IAC3C,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAC,GAAG,GAAG,CAAA;QACvC,MAAM,EAAE,GAAG,OAAO,KAAK,eAAe,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAA;QACpE,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,eAAe,IAAI,YAAY,EAAE,IAAI,UAAU,EAAE,CAAC,CAAA;IACnE,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"}
|
|
@@ -155,6 +155,14 @@ export function getProperty(key: Code | string | number): Code {
|
|
|
155
155
|
return typeof key == "string" && IDENTIFIER.test(key) ? new _Code(`.${key}`) : _`[${key}]`
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
//Does best effort to format the name properly
|
|
159
|
+
export function getEsmExportName(key: Code | string | number): Code {
|
|
160
|
+
if (typeof key == "string" && IDENTIFIER.test(key)) {
|
|
161
|
+
return new _Code(`${key}`)
|
|
162
|
+
}
|
|
163
|
+
throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`)
|
|
164
|
+
}
|
|
165
|
+
|
|
158
166
|
export function regexpCode(rx: RegExp): Code {
|
|
159
167
|
return new _Code(rx.toString())
|
|
160
168
|
}
|
|
@@ -112,7 +112,7 @@ export function compileSchema(this: Ajv, sch: SchemaEnv): SchemaEnv {
|
|
|
112
112
|
// TODO refactor - remove compilations
|
|
113
113
|
const _sch = getCompilingSchema.call(this, sch)
|
|
114
114
|
if (_sch) return _sch
|
|
115
|
-
const rootId = getFullPath(sch.root.baseId) // TODO if getFullPath removed 1 tests fails
|
|
115
|
+
const rootId = getFullPath(this.opts.uriResolver, sch.root.baseId) // TODO if getFullPath removed 1 tests fails
|
|
116
116
|
const {es5, lines} = this.opts.code
|
|
117
117
|
const {ownProperties} = this.opts
|
|
118
118
|
const gen = new CodeGen(this.scope, {es5, lines, ownProperties})
|
|
@@ -208,7 +208,7 @@ export function resolveRef(
|
|
|
208
208
|
baseId: string,
|
|
209
209
|
ref: string
|
|
210
210
|
): AnySchema | SchemaEnv | undefined {
|
|
211
|
-
ref = resolveUrl(baseId, ref)
|
|
211
|
+
ref = resolveUrl(this.opts.uriResolver, baseId, ref)
|
|
212
212
|
const schOrFunc = root.refs[ref]
|
|
213
213
|
if (schOrFunc) return schOrFunc
|
|
214
214
|
|
|
@@ -257,9 +257,9 @@ export function resolveSchema(
|
|
|
257
257
|
root: SchemaEnv, // root object with properties schema, refs TODO below SchemaEnv is assigned to it
|
|
258
258
|
ref: string // reference to resolve
|
|
259
259
|
): SchemaEnv | undefined {
|
|
260
|
-
const p =
|
|
261
|
-
const refPath = _getFullPath(p)
|
|
262
|
-
let baseId = getFullPath(root.baseId)
|
|
260
|
+
const p = this.opts.uriResolver.parse(ref)
|
|
261
|
+
const refPath = _getFullPath(this.opts.uriResolver, p)
|
|
262
|
+
let baseId = getFullPath(this.opts.uriResolver, root.baseId, undefined)
|
|
263
263
|
// TODO `Object.keys(root.schema).length > 0` should not be needed - but removing breaks 2 tests
|
|
264
264
|
if (Object.keys(root.schema).length > 0 && refPath === baseId) {
|
|
265
265
|
return getJsonPointer.call(this, p, root)
|
|
@@ -279,7 +279,7 @@ export function resolveSchema(
|
|
|
279
279
|
const {schema} = schOrRef
|
|
280
280
|
const {schemaId} = this.opts
|
|
281
281
|
const schId = schema[schemaId]
|
|
282
|
-
if (schId) baseId = resolveUrl(baseId, schId)
|
|
282
|
+
if (schId) baseId = resolveUrl(this.opts.uriResolver, baseId, schId)
|
|
283
283
|
return new SchemaEnv({schema, schemaId, root, baseId})
|
|
284
284
|
}
|
|
285
285
|
return getJsonPointer.call(this, p, schOrRef)
|
|
@@ -307,12 +307,12 @@ function getJsonPointer(
|
|
|
307
307
|
// TODO PREVENT_SCOPE_CHANGE could be defined in keyword def?
|
|
308
308
|
const schId = typeof schema === "object" && schema[this.opts.schemaId]
|
|
309
309
|
if (!PREVENT_SCOPE_CHANGE.has(part) && schId) {
|
|
310
|
-
baseId = resolveUrl(baseId, schId)
|
|
310
|
+
baseId = resolveUrl(this.opts.uriResolver, baseId, schId)
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
313
|
let env: SchemaEnv | undefined
|
|
314
314
|
if (typeof schema != "boolean" && schema.$ref && !schemaHasRulesButRef(schema, this.RULES)) {
|
|
315
|
-
const $ref = resolveUrl(baseId, schema.$ref)
|
|
315
|
+
const $ref = resolveUrl(this.opts.uriResolver, baseId, schema.$ref)
|
|
316
316
|
env = resolveSchema.call(this, root, $ref)
|
|
317
317
|
}
|
|
318
318
|
// even though resolution failed we need to return SchemaEnv to throw exception
|
|
@@ -342,7 +342,7 @@ function parseRef(cxt: ParseCxt): void {
|
|
|
342
342
|
const {gen, self, definitions, schema, schemaEnv} = cxt
|
|
343
343
|
const {ref} = schema
|
|
344
344
|
const refSchema = definitions[ref]
|
|
345
|
-
if (!refSchema) throw new MissingRefError("", ref, `No definition ${ref}`)
|
|
345
|
+
if (!refSchema) throw new MissingRefError(self.opts.uriResolver, "", ref, `No definition ${ref}`)
|
|
346
346
|
if (!hasRef(refSchema)) return parseCode({...cxt, schema: refSchema})
|
|
347
347
|
const {root} = schemaEnv
|
|
348
348
|
const sch = compileParser.call(self, new SchemaEnv({schema: refSchema, root}), definitions)
|
|
@@ -234,7 +234,7 @@ function serializeRef(cxt: SerializeCxt): void {
|
|
|
234
234
|
const {gen, self, data, definitions, schema, schemaEnv} = cxt
|
|
235
235
|
const {ref} = schema
|
|
236
236
|
const refSchema = definitions[ref]
|
|
237
|
-
if (!refSchema) throw new MissingRefError("", ref, `No definition ${ref}`)
|
|
237
|
+
if (!refSchema) throw new MissingRefError(self.opts.uriResolver, "", ref, `No definition ${ref}`)
|
|
238
238
|
if (!hasRef(refSchema)) return serializeCode({...cxt, schema: refSchema})
|
|
239
239
|
const {root} = schemaEnv
|
|
240
240
|
const sch = compileSerializer.call(self, new SchemaEnv({schema: refSchema, root}), definitions)
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {resolveUrl, normalizeId, getFullPath} from "./resolve"
|
|
2
|
+
import type {UriResolver} from "../types"
|
|
2
3
|
|
|
3
4
|
export default class MissingRefError extends Error {
|
|
4
5
|
readonly missingRef: string
|
|
5
6
|
readonly missingSchema: string
|
|
6
7
|
|
|
7
|
-
constructor(baseId: string, ref: string, msg?: string) {
|
|
8
|
+
constructor(resolver: UriResolver, baseId: string, ref: string, msg?: string) {
|
|
8
9
|
super(msg || `can't resolve reference ${ref} from id ${baseId}`)
|
|
9
|
-
this.missingRef = resolveUrl(baseId, ref)
|
|
10
|
-
this.missingSchema = normalizeId(getFullPath(this.missingRef))
|
|
10
|
+
this.missingRef = resolveUrl(resolver, baseId, ref)
|
|
11
|
+
this.missingSchema = normalizeId(getFullPath(resolver, this.missingRef))
|
|
11
12
|
}
|
|
12
13
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {AnySchema, AnySchemaObject} from "../types"
|
|
1
|
+
import type {AnySchema, AnySchemaObject, UriResolver} from "../types"
|
|
2
2
|
import type Ajv from "../ajv"
|
|
3
|
+
import type {URIComponents} from "uri-js"
|
|
3
4
|
import {eachItem} from "./util"
|
|
4
5
|
import * as equal from "fast-deep-equal"
|
|
5
6
|
import * as traverse from "json-schema-traverse"
|
|
6
|
-
import * as URI from "uri-js"
|
|
7
7
|
|
|
8
8
|
// the hash of local references inside the schema (created by getSchemaRefs), used for inline resolution
|
|
9
9
|
export type LocalRefs = {[Ref in string]?: AnySchemaObject}
|
|
@@ -67,14 +67,15 @@ function countKeys(schema: AnySchemaObject): number {
|
|
|
67
67
|
return count
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
export function getFullPath(id = "", normalize?: boolean): string {
|
|
70
|
+
export function getFullPath(resolver: UriResolver, id = "", normalize?: boolean): string {
|
|
71
71
|
if (normalize !== false) id = normalizeId(id)
|
|
72
|
-
const p =
|
|
73
|
-
return _getFullPath(p)
|
|
72
|
+
const p = resolver.parse(id)
|
|
73
|
+
return _getFullPath(resolver, p)
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
export function _getFullPath(p:
|
|
77
|
-
|
|
76
|
+
export function _getFullPath(resolver: UriResolver, p: URIComponents): string {
|
|
77
|
+
const serialized = resolver.serialize(p)
|
|
78
|
+
return serialized.split("#")[0] + "#"
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
const TRAILING_SLASH_HASH = /#\/?$/
|
|
@@ -82,19 +83,19 @@ export function normalizeId(id: string | undefined): string {
|
|
|
82
83
|
return id ? id.replace(TRAILING_SLASH_HASH, "") : ""
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
export function resolveUrl(baseId: string, id: string): string {
|
|
86
|
+
export function resolveUrl(resolver: UriResolver, baseId: string, id: string): string {
|
|
86
87
|
id = normalizeId(id)
|
|
87
|
-
return
|
|
88
|
+
return resolver.resolve(baseId, id)
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
const ANCHOR = /^[a-z_][-a-z0-9._]*$/i
|
|
91
92
|
|
|
92
93
|
export function getSchemaRefs(this: Ajv, schema: AnySchema, baseId: string): LocalRefs {
|
|
93
94
|
if (typeof schema == "boolean") return {}
|
|
94
|
-
const {schemaId} = this.opts
|
|
95
|
+
const {schemaId, uriResolver} = this.opts
|
|
95
96
|
const schId = normalizeId(schema[schemaId] || baseId)
|
|
96
97
|
const baseIds: {[JsonPtr in string]?: string} = {"": schId}
|
|
97
|
-
const pathPrefix = getFullPath(schId, false)
|
|
98
|
+
const pathPrefix = getFullPath(uriResolver, schId, false)
|
|
98
99
|
const localRefs: LocalRefs = {}
|
|
99
100
|
const schemaRefs: Set<string> = new Set()
|
|
100
101
|
|
|
@@ -108,7 +109,9 @@ export function getSchemaRefs(this: Ajv, schema: AnySchema, baseId: string): Loc
|
|
|
108
109
|
baseIds[jsonPtr] = baseId
|
|
109
110
|
|
|
110
111
|
function addRef(this: Ajv, ref: string): string {
|
|
111
|
-
|
|
112
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
113
|
+
const _resolve = this.opts.uriResolver.resolve
|
|
114
|
+
ref = normalizeId(baseId ? _resolve(baseId, ref) : ref)
|
|
112
115
|
if (schemaRefs.has(ref)) throw ambiguos(ref)
|
|
113
116
|
schemaRefs.add(ref)
|
|
114
117
|
let schOrRef = this.refs[ref]
|
|
@@ -177,7 +177,7 @@ function checkNoDefault(it: SchemaObjCxt): void {
|
|
|
177
177
|
|
|
178
178
|
function updateContext(it: SchemaObjCxt): void {
|
|
179
179
|
const schId = it.schema[it.opts.schemaId]
|
|
180
|
-
if (schId) it.baseId = resolveUrl(it.baseId, schId)
|
|
180
|
+
if (schId) it.baseId = resolveUrl(it.opts.uriResolver, it.baseId, schId)
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
function checkAsyncSchema(it: SchemaObjCxt): void {
|
|
@@ -49,6 +49,7 @@ import type {
|
|
|
49
49
|
Format,
|
|
50
50
|
AddedFormat,
|
|
51
51
|
RegExpEngine,
|
|
52
|
+
UriResolver,
|
|
52
53
|
} from "./types"
|
|
53
54
|
import type {JSONSchemaType} from "./types/json-schema"
|
|
54
55
|
import type {JTDSchemaType, SomeJTDSchemaType, JTDDataType} from "./types/jtd-schema"
|
|
@@ -60,9 +61,10 @@ import {Code, ValueScope} from "./compile/codegen"
|
|
|
60
61
|
import {normalizeId, getSchemaRefs} from "./compile/resolve"
|
|
61
62
|
import {getJSONTypes} from "./compile/validate/dataType"
|
|
62
63
|
import {eachItem} from "./compile/util"
|
|
63
|
-
|
|
64
64
|
import * as $dataRefSchema from "./refs/data.json"
|
|
65
65
|
|
|
66
|
+
import DefaultUriResolver from "./runtime/uri"
|
|
67
|
+
|
|
66
68
|
const defaultRegExp: RegExpEngine = (str, flags) => new RegExp(str, flags)
|
|
67
69
|
defaultRegExp.code = "new RegExp"
|
|
68
70
|
|
|
@@ -136,10 +138,12 @@ export interface CurrentOptions {
|
|
|
136
138
|
int32range?: boolean // JTD only
|
|
137
139
|
messages?: boolean
|
|
138
140
|
code?: CodeOptions // NEW
|
|
141
|
+
uriResolver?: UriResolver
|
|
139
142
|
}
|
|
140
143
|
|
|
141
144
|
export interface CodeOptions {
|
|
142
145
|
es5?: boolean
|
|
146
|
+
esm?: boolean
|
|
143
147
|
lines?: boolean
|
|
144
148
|
optimize?: boolean | number
|
|
145
149
|
formats?: Code // code to require (or construct) map of available formats - for standalone code
|
|
@@ -225,7 +229,8 @@ type RequiredInstanceOptions = {
|
|
|
225
229
|
| "validateSchema"
|
|
226
230
|
| "validateFormats"
|
|
227
231
|
| "int32range"
|
|
228
|
-
| "unicodeRegExp"
|
|
232
|
+
| "unicodeRegExp"
|
|
233
|
+
| "uriResolver"]: NonNullable<Options[K]>
|
|
229
234
|
} & {code: InstanceCodeOptions}
|
|
230
235
|
|
|
231
236
|
export type InstanceOptions = Options & RequiredInstanceOptions
|
|
@@ -238,6 +243,7 @@ function requiredOptions(o: Options): RequiredInstanceOptions {
|
|
|
238
243
|
const _optz = o.code?.optimize
|
|
239
244
|
const optimize = _optz === true || _optz === undefined ? 1 : _optz || 0
|
|
240
245
|
const regExp = o.code?.regExp ?? defaultRegExp
|
|
246
|
+
const uriResolver = o.uriResolver ?? DefaultUriResolver
|
|
241
247
|
return {
|
|
242
248
|
strictSchema: o.strictSchema ?? s ?? true,
|
|
243
249
|
strictNumbers: o.strictNumbers ?? s ?? true,
|
|
@@ -256,6 +262,7 @@ function requiredOptions(o: Options): RequiredInstanceOptions {
|
|
|
256
262
|
validateFormats: o.validateFormats ?? true,
|
|
257
263
|
unicodeRegExp: o.unicodeRegExp ?? true,
|
|
258
264
|
int32range: o.int32range ?? true,
|
|
265
|
+
uriResolver: uriResolver,
|
|
259
266
|
}
|
|
260
267
|
}
|
|
261
268
|
|
|
@@ -2,7 +2,7 @@ import type AjvCore from "../core"
|
|
|
2
2
|
import type {AnyValidateFunction, SourceCode} from "../types"
|
|
3
3
|
import type {SchemaEnv} from "../compile"
|
|
4
4
|
import {UsedScopeValues, UsedValueState, ValueScopeName, varKinds} from "../compile/codegen/scope"
|
|
5
|
-
import {_, nil, _Code, Code, getProperty} from "../compile/codegen/code"
|
|
5
|
+
import {_, nil, _Code, Code, getProperty, getEsmExportName} from "../compile/codegen/code"
|
|
6
6
|
|
|
7
7
|
function standaloneCode(
|
|
8
8
|
ajv: AjvCore,
|
|
@@ -30,6 +30,10 @@ function standaloneCode(
|
|
|
30
30
|
const usedValues: UsedScopeValues = {}
|
|
31
31
|
const n = source?.validateName
|
|
32
32
|
const vCode = validateCode(usedValues, source)
|
|
33
|
+
if (ajv.opts.code.esm) {
|
|
34
|
+
// Always do named export as `validate` rather than the variable `n` which is `validateXX` for known export value
|
|
35
|
+
return `"use strict";${_n}export const validate = ${n};${_n}export default ${n};${_n}${vCode}`
|
|
36
|
+
}
|
|
33
37
|
return `"use strict";${_n}module.exports = ${n};${_n}module.exports.default = ${n};${_n}${vCode}`
|
|
34
38
|
}
|
|
35
39
|
|
|
@@ -43,7 +47,10 @@ function standaloneCode(
|
|
|
43
47
|
const v = getValidateFunc(schemas[name] as T)
|
|
44
48
|
if (v) {
|
|
45
49
|
const vCode = validateCode(usedValues, v.source)
|
|
46
|
-
|
|
50
|
+
const exportSyntax = ajv.opts.code.esm
|
|
51
|
+
? _`export const ${getEsmExportName(name)}`
|
|
52
|
+
: _`exports${getProperty(name)}`
|
|
53
|
+
code = _`${code}${_n}${exportSyntax} = ${v.source?.validateName};${_n}${vCode}`
|
|
47
54
|
}
|
|
48
55
|
}
|
|
49
56
|
return `${code}`
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as URI from "uri-js"
|
|
1
2
|
import type {CodeGen, Code, Name, ScopeValueSets, ValueScopeName} from "../compile/codegen"
|
|
2
3
|
import type {SchemaEnv, SchemaCxt, SchemaObjCxt} from "../compile"
|
|
3
4
|
import type {JSONType} from "../compile/rules"
|
|
@@ -231,3 +232,9 @@ export interface RegExpEngine {
|
|
|
231
232
|
export interface RegExpLike {
|
|
232
233
|
test: (s: string) => boolean
|
|
233
234
|
}
|
|
235
|
+
|
|
236
|
+
export interface UriResolver {
|
|
237
|
+
parse(uri: string): URI.URIComponents
|
|
238
|
+
resolve(base: string, path: string): string
|
|
239
|
+
serialize(component: URI.URIComponents): string
|
|
240
|
+
}
|
|
@@ -113,10 +113,7 @@ type UncheckedJSONSchemaType<T, IsPartial extends boolean> = (
|
|
|
113
113
|
dependentSchemas?: {[K in keyof T]?: UncheckedPartialSchema<T>}
|
|
114
114
|
minProperties?: number
|
|
115
115
|
maxProperties?: number
|
|
116
|
-
} & (// "required" type does not guarantee that all required properties
|
|
117
|
-
// are listed it only asserts that optional cannot be listed.
|
|
118
|
-
// "required" is not necessary if it's a non-partial type with no required keys
|
|
119
|
-
IsPartial extends true
|
|
116
|
+
} & (IsPartial extends true // "required" is not necessary if it's a non-partial type with no required keys // are listed it only asserts that optional cannot be listed. // "required" type does not guarantee that all required properties
|
|
120
117
|
? {required: Readonly<(keyof T)[]>}
|
|
121
118
|
: [UncheckedRequiredMembers<T>] extends [never]
|
|
122
119
|
? {required?: Readonly<UncheckedRequiredMembers<T>[]>}
|
|
@@ -117,9 +117,8 @@ export type JTDSchemaType<T, D extends Record<string, unknown> = Record<string,
|
|
|
117
117
|
: never))
|
|
118
118
|
// empty - empty schemas also treat nullable differently in that it's now fully ignored
|
|
119
119
|
| (unknown extends T ? {nullable?: boolean} : never)
|
|
120
|
-
// all other types
|
|
121
|
-
| ((
|
|
122
|
-
true extends NullTypeEquality<T, number>
|
|
120
|
+
// all other types // numbers - only accepts the type number
|
|
121
|
+
| ((true extends NullTypeEquality<T, number>
|
|
123
122
|
? {type: NumberType}
|
|
124
123
|
: // booleans - accepts the type boolean
|
|
125
124
|
true extends NullTypeEquality<T, boolean>
|
|
@@ -198,8 +197,8 @@ export type JTDSchemaType<T, D extends Record<string, unknown> = Record<string,
|
|
|
198
197
|
}
|
|
199
198
|
|
|
200
199
|
type JTDDataDef<S, D extends Record<string, unknown>> =
|
|
201
|
-
|
|
|
202
|
-
|
|
200
|
+
| // ref
|
|
201
|
+
(S extends {ref: string}
|
|
203
202
|
? D extends {[K in S["ref"]]: infer V}
|
|
204
203
|
? JTDDataDef<V, D>
|
|
205
204
|
: never
|
|
@@ -16,7 +16,7 @@ const def: CodeKeywordDefinition = {
|
|
|
16
16
|
const {root} = env
|
|
17
17
|
if (($ref === "#" || $ref === "#/") && baseId === root.baseId) return callRootRef()
|
|
18
18
|
const schOrEnv = resolveRef.call(self, root, baseId, $ref)
|
|
19
|
-
if (schOrEnv === undefined) throw new MissingRefError(baseId, $ref)
|
|
19
|
+
if (schOrEnv === undefined) throw new MissingRefError(it.opts.uriResolver, baseId, $ref)
|
|
20
20
|
if (schOrEnv instanceof SchemaEnv) return callValidate(schOrEnv)
|
|
21
21
|
return inlineRefSchema(schOrEnv)
|
|
22
22
|
|
package/dist/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/discriminator/index.ts
CHANGED
|
@@ -2,6 +2,8 @@ import type {CodeKeywordDefinition, AnySchemaObject, KeywordErrorDefinition} fro
|
|
|
2
2
|
import type {KeywordCxt} from "../../compile/validate"
|
|
3
3
|
import {_, getProperty, Name} from "../../compile/codegen"
|
|
4
4
|
import {DiscrError, DiscrErrorObj} from "../discriminator/types"
|
|
5
|
+
import {resolveRef, SchemaEnv} from "../../compile"
|
|
6
|
+
import {schemaHasRulesButRef} from "../../compile/util"
|
|
5
7
|
|
|
6
8
|
export type DiscriminatorError = DiscrErrorObj<DiscrError.Tag> | DiscrErrorObj<DiscrError.Mapping>
|
|
7
9
|
|
|
@@ -62,10 +64,16 @@ const def: CodeKeywordDefinition = {
|
|
|
62
64
|
const topRequired = hasRequired(parentSchema)
|
|
63
65
|
let tagRequired = true
|
|
64
66
|
for (let i = 0; i < oneOf.length; i++) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
let sch = oneOf[i]
|
|
68
|
+
if (sch?.$ref && !schemaHasRulesButRef(sch, it.self.RULES)) {
|
|
69
|
+
sch = resolveRef.call(it.self, it.schemaEnv.root, it.baseId, sch?.$ref)
|
|
70
|
+
if (sch instanceof SchemaEnv) sch = sch.schema
|
|
71
|
+
}
|
|
72
|
+
const propSch = sch?.properties?.[tagName]
|
|
67
73
|
if (typeof propSch != "object") {
|
|
68
|
-
throw new Error(
|
|
74
|
+
throw new Error(
|
|
75
|
+
`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`
|
|
76
|
+
)
|
|
69
77
|
}
|
|
70
78
|
tagRequired = tagRequired && (topRequired || hasRequired(sch))
|
|
71
79
|
addMappings(propSch, i)
|
|
@@ -28,7 +28,9 @@ const def: CodeKeywordDefinition = {
|
|
|
28
28
|
|
|
29
29
|
function validateJtdRef(): void {
|
|
30
30
|
const refSchema = (root.schema as AnySchemaObject).definitions?.[ref]
|
|
31
|
-
if (!refSchema)
|
|
31
|
+
if (!refSchema) {
|
|
32
|
+
throw new MissingRefError(it.opts.uriResolver, "", ref, `No definition ${ref}`)
|
|
33
|
+
}
|
|
32
34
|
if (hasRef(refSchema) || !it.opts.inlineRefs) callValidate(refSchema)
|
|
33
35
|
else inlineRefSchema(refSchema)
|
|
34
36
|
}
|
|
@@ -20,7 +20,9 @@ const def: CodeKeywordDefinition = {
|
|
|
20
20
|
const {gen, data, $data, schema, schemaCode, it} = cxt
|
|
21
21
|
if (!$data && schema.length === 0) throw new Error("enum must have non-empty array")
|
|
22
22
|
const useLoop = schema.length >= it.opts.loopEnum
|
|
23
|
-
|
|
23
|
+
let eql: Name | undefined
|
|
24
|
+
const getEql = (): Name => (eql ??= useFunc(gen, equal))
|
|
25
|
+
|
|
24
26
|
let valid: Code
|
|
25
27
|
if (useLoop || $data) {
|
|
26
28
|
valid = gen.let("valid")
|
|
@@ -36,14 +38,14 @@ const def: CodeKeywordDefinition = {
|
|
|
36
38
|
function loopEnum(): void {
|
|
37
39
|
gen.assign(valid, false)
|
|
38
40
|
gen.forOf("v", schemaCode as Code, (v) =>
|
|
39
|
-
gen.if(_`${
|
|
41
|
+
gen.if(_`${getEql()}(${data}, ${v})`, () => gen.assign(valid, true).break())
|
|
40
42
|
)
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
function equalCode(vSchema: Name, i: number): Code {
|
|
44
46
|
const sch = schema[i]
|
|
45
47
|
return typeof sch === "object" && sch !== null
|
|
46
|
-
? _`${
|
|
48
|
+
? _`${getEql()}(${data}, ${vSchema}[${i}])`
|
|
47
49
|
: _`${data} === ${sch}`
|
|
48
50
|
}
|
|
49
51
|
},
|
|
@@ -5,7 +5,7 @@ import {_, str, operators} from "../../compile/codegen"
|
|
|
5
5
|
const error: KeywordErrorDefinition = {
|
|
6
6
|
message({keyword, schemaCode}) {
|
|
7
7
|
const comp = keyword === "maxProperties" ? "more" : "fewer"
|
|
8
|
-
return str`must NOT have ${comp} than ${schemaCode}
|
|
8
|
+
return str`must NOT have ${comp} than ${schemaCode} properties`
|
|
9
9
|
},
|
|
10
10
|
params: ({schemaCode}) => _`{limit: ${schemaCode}}`,
|
|
11
11
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ajv",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.11.0",
|
|
4
4
|
"description": "Another JSON Schema Validator",
|
|
5
5
|
"main": "dist/ajv.js",
|
|
6
6
|
"types": "dist/ajv.d.ts",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@rollup/plugin-typescript": "^8.2.1",
|
|
72
72
|
"@types/chai": "^4.2.12",
|
|
73
73
|
"@types/mocha": "^9.0.0",
|
|
74
|
-
"@types/node": "^
|
|
74
|
+
"@types/node": "^17.0.0",
|
|
75
75
|
"@types/require-from-string": "^1.2.0",
|
|
76
76
|
"@typescript-eslint/eslint-plugin": "^3.8.0",
|
|
77
77
|
"@typescript-eslint/parser": "^3.8.0",
|
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
"dayjs-plugin-utc": "^0.1.2",
|
|
84
84
|
"eslint": "^7.8.1",
|
|
85
85
|
"eslint-config-prettier": "^7.0.0",
|
|
86
|
+
"fast-uri": "^1.0.0",
|
|
86
87
|
"glob": "^7.0.0",
|
|
87
88
|
"husky": "^7.0.1",
|
|
88
89
|
"if-node-version": "^1.0.0",
|
|
@@ -92,8 +93,9 @@
|
|
|
92
93
|
"karma": "^6.0.0",
|
|
93
94
|
"karma-chrome-launcher": "^3.0.0",
|
|
94
95
|
"karma-mocha": "^2.0.0",
|
|
95
|
-
"lint-staged": "^
|
|
96
|
+
"lint-staged": "^12.1.1",
|
|
96
97
|
"mocha": "^9.0.2",
|
|
98
|
+
"module-from-string": "^3.1.3",
|
|
97
99
|
"node-fetch": "^3.0.0",
|
|
98
100
|
"nyc": "^15.0.0",
|
|
99
101
|
"prettier": "^2.3.1",
|
|
@@ -241,6 +241,9 @@ setInterval(function(){
|
|
|
241
241
|
}, 1200);
|
|
242
242
|
```
|
|
243
243
|
|
|
244
|
+
In Chromium-based web browsers (e.g. Brave, Chrome, and Electron), the JavaScript console will—by default—only show messages logged by `debug` if the "Verbose" log level is _enabled_.
|
|
245
|
+
|
|
246
|
+
<img width="647" src="https://user-images.githubusercontent.com/7143133/152083257-29034707-c42c-4959-8add-3cee850e6fcf.png">
|
|
244
247
|
|
|
245
248
|
## Output streams
|
|
246
249
|
|
|
@@ -179,7 +179,7 @@ function setup(env) {
|
|
|
179
179
|
namespaces = split[i].replace(/\*/g, '.*?');
|
|
180
180
|
|
|
181
181
|
if (namespaces[0] === '-') {
|
|
182
|
-
createDebug.skips.push(new RegExp('^' + namespaces.
|
|
182
|
+
createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
|
|
183
183
|
} else {
|
|
184
184
|
createDebug.names.push(new RegExp('^' + namespaces + '$'));
|
|
185
185
|
}
|
|
@@ -4,11 +4,9 @@ Node.js: fs-extra
|
|
|
4
4
|
`fs-extra` adds file system methods that aren't included in the native `fs` module and adds promise support to the `fs` methods. It also uses [`graceful-fs`](https://github.com/isaacs/node-graceful-fs) to prevent `EMFILE` errors. It should be a drop in replacement for `fs`.
|
|
5
5
|
|
|
6
6
|
[](https://www.npmjs.org/package/fs-extra)
|
|
7
|
-
[](https://ci.appveyor.com/project/jprichardson/node-fs-extra/branch/master)
|
|
7
|
+
[](https://github.com/jprichardson/node-fs-extra/blob/master/LICENSE)
|
|
8
|
+
[](https://github.com/jprichardson/node-fs-extra/actions/workflows/ci.yml?query=branch%3Amaster)
|
|
10
9
|
[](https://www.npmjs.org/package/fs-extra)
|
|
11
|
-
[](https://coveralls.io/github/jprichardson/node-fs-extra)
|
|
12
10
|
[](https://standardjs.com)
|
|
13
11
|
|
|
14
12
|
Why?
|
|
@@ -189,7 +187,7 @@ you're gonna have to get over it :) If `standard` is good enough for `npm`, it's
|
|
|
189
187
|
What's needed?
|
|
190
188
|
- First, take a look at existing issues. Those are probably going to be where the priority lies.
|
|
191
189
|
- More tests for edge cases. Specifically on different platforms. There can never be enough tests.
|
|
192
|
-
- Improve test coverage.
|
|
190
|
+
- Improve test coverage.
|
|
193
191
|
|
|
194
192
|
Note: If you make any big changes, **you should definitely file an issue for discussion first.**
|
|
195
193
|
|
|
@@ -17,11 +17,14 @@ function copySync (src, dest, opts) {
|
|
|
17
17
|
|
|
18
18
|
// Warn about using preserveTimestamps on 32-bit node
|
|
19
19
|
if (opts.preserveTimestamps && process.arch === 'ia32') {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
process.emitWarning(
|
|
21
|
+
'Using the preserveTimestamps option in 32-bit node is not recommended;\n\n' +
|
|
22
|
+
'\tsee https://github.com/jprichardson/node-fs-extra/issues/269',
|
|
23
|
+
'Warning', 'fs-extra-WARN0002'
|
|
24
|
+
)
|
|
22
25
|
}
|
|
23
26
|
|
|
24
|
-
const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy')
|
|
27
|
+
const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy', opts)
|
|
25
28
|
stat.checkParentPathsSync(src, srcStat, dest, 'copy')
|
|
26
29
|
return handleFilterAndCopy(destStat, src, dest, opts)
|
|
27
30
|
}
|
|
@@ -30,7 +33,7 @@ function handleFilterAndCopy (destStat, src, dest, opts) {
|
|
|
30
33
|
if (opts.filter && !opts.filter(src, dest)) return
|
|
31
34
|
const destParent = path.dirname(dest)
|
|
32
35
|
if (!fs.existsSync(destParent)) mkdirsSync(destParent)
|
|
33
|
-
return
|
|
36
|
+
return getStats(destStat, src, dest, opts)
|
|
34
37
|
}
|
|
35
38
|
|
|
36
39
|
function startCopy (destStat, src, dest, opts) {
|
|
@@ -47,6 +50,9 @@ function getStats (destStat, src, dest, opts) {
|
|
|
47
50
|
srcStat.isCharacterDevice() ||
|
|
48
51
|
srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts)
|
|
49
52
|
else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts)
|
|
53
|
+
else if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`)
|
|
54
|
+
else if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`)
|
|
55
|
+
throw new Error(`Unknown file: ${src}`)
|
|
50
56
|
}
|
|
51
57
|
|
|
52
58
|
function onFile (srcStat, destStat, src, dest, opts) {
|
|
@@ -99,9 +105,6 @@ function setDestTimestamps (src, dest) {
|
|
|
99
105
|
|
|
100
106
|
function onDir (srcStat, destStat, src, dest, opts) {
|
|
101
107
|
if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts)
|
|
102
|
-
if (destStat && !destStat.isDirectory()) {
|
|
103
|
-
throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)
|
|
104
|
-
}
|
|
105
108
|
return copyDir(src, dest, opts)
|
|
106
109
|
}
|
|
107
110
|
|
|
@@ -118,7 +121,7 @@ function copyDir (src, dest, opts) {
|
|
|
118
121
|
function copyDirItem (item, src, dest, opts) {
|
|
119
122
|
const srcItem = path.join(src, item)
|
|
120
123
|
const destItem = path.join(dest, item)
|
|
121
|
-
const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy')
|
|
124
|
+
const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy', opts)
|
|
122
125
|
return startCopy(destStat, srcItem, destItem, opts)
|
|
123
126
|
}
|
|
124
127
|
|