Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.jsii.lib.program.js.map Maven / Gradle / Ivy
{"version":3,"file":"lib/program.js","mappings":";;;QACA,MAAMA,KAAK,oBAAQ;QACnB,MAAMC,OAAO,oBAAQ;QAGrB,MAAMC,SAASF,GAAGG,SAAS,WAAW;QAEtC,MAAMC,aAAaJ,GAAGK,aAAa,eAAe;QAGlD,MAAMC,oBAAoBN,GAAGG,WAC1BI,QAAQC,QAAQC,MAAM,kBACtBF,QAAQC,QAAQC,MAAM;QAEzB,MAAMJ,aAAa,CAACJ,MAAMS,KAAKC;YAC7B;gBACE,OAAOX,GAAGI,YAAYH,MAAMS,KAAKC;AACnC,cAAE,OAAOC;gBACP,IAAIA,GAAGC,SAAS,UACd,MAAMD;AACV;AAAA;QAIF,MAAME,YAAY,CAACb,MAAMS,KAAKC;YAC5B;gBACE,OAAOX,GAAGc,UAAUb,MAAMS,KAAKC;AACjC,cAAE,OAAOC;gBACP,IAAIA,GAAGC,SAAS,UACd,MAAMD;AACV;AAAA;QAIF,MAAMG,eACJT,oBAAoB,CAACL,MAAMS,KAAKC,KAAKK,OAAOJ;YAI1C,KAAKA,MAAMA,GAAGC,SAAS,UACrBG,GAAGJ,UAEHZ,GAAGiB,MAAMhB,MAAMS,KAAKC,KAAKK;AAAE,YAE7B,CAACE,GAAGC,IAAIC,KAAKJ,OAAOA;QAGxB,MAAMK,mBACJf,oBAAoB,CAACL,MAAMS,KAAKC;YAC9B;gBACE,OAAON,WAAWJ,MAAMS,KAAKC;AAC/B,cAAE,OAAOC;gBACP,IAAIA,GAAGC,SAAS,UACd,MAAMD;gBACRE,UAAUb,MAAMS,KAAKC;AACvB;AAAA,YAEA,CAACV,MAAMS,KAAKC,QAAQN,WAAWJ,MAAMS,KAAKC;QAG9C,MAAMW,cAAcf,QAAQC;QAC5B,IAAIe,UAAU,CAACtB,MAAMuB,SA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wC;;;;;;;;;;;;;;;;;;;;;;;;;AC/OF,IAAIyB,2BAA2B,CAAC;;AAGhC,SAASC,oBAAoBC;IAE5B,IAAIC,eAAeH,yBAAyBE;IAC5C,IAAIC,iBAAiB/uE,WAAW;QAC/B,OAAO+uE,aAAazlF;AACrB;IAEA,IAAID,SAASulF,yBAAyBE,YAAY;QAGjDxlF,SAAS,CAAC;;IAIX0lF,oBAAoBF,UAAUtkF,KAAKnB,OAAOC,SAASD,QAAQA,OAAOC,SAASulF;IAG3E,OAAOxlF,OAAOC;AACf;;;;;;;;;;;;ICtBA;IACA;IACA;IACA;IAEA,MAAMd,OAAOymF,YAAYzmF;IACzB,MAAM1B,UAAUmoF,YAAYnoF;IAE5B,MAAM2oD,YAAY5oD,QAAQ+a,IAAIstE;IAC9B,MAAMxtE,UAAU7a,QAAQ+a,IAAIutE;IAC5B,MAAMvgC,gBAAgB/nD,QAAQ+a,IAAIwtE;IAClC,MAAMjyC,uBAAuBt2C,QAAQ+a,IAAIytE;IAMzC,MAAMz/B,QAAQ,IAAI,aAAAS,UAAU;QAK1BG,UAAU,KAAA3pD,QAAQgmB,OAAe/Y,QAAE,6BAAI;QACvC48C,QAAQ;QACRC,SAAS;;IAGX,MAAMlC,QAAQ,IAAI,SAAAkB,YAAYC;IAC9B,MAAMvH,OAAO,IAAI,OAAAmG,WAAWC,OAAO;QACjC/sC;QACA+tC;QACAb;QACAzR;;IAGFkL,KAAKr4B,KAAK,QAAQnpB,QAAQgoD,KAAKxR,KAAKx2C;IAGpC4nD,MAAMr6C,MAAM;QAAEk7E,OAAO,GAAG9mF,QAAQ1B;;IAChC2nD,MAAM/sC,QAAQA;IAEd2mC,KAAK5a","sources":["webpack://@jsii/runtime/../../../node_modules/chownr/chownr.js","webpack://@jsii/runtime/../../../node_modules/fast-deep-equal/index.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/copy/copy-sync.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/copy/copy.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/copy/index.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/empty/index.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/ensure/file.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/ensure/index.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/ensure/link.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/ensure/symlink-paths.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/ensure/symlink-type.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/ensure/symlink.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/fs/index.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/index.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/json/index.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/json/jsonfile.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/json/output-json-sync.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/json/output-json.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/mkdirs/index.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/mkdirs/make-dir.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/mkdirs/utils.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/move/index.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/move/move-sync.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/move/move.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/output-file/index.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/path-exists/index.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/remove/index.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/remove/rimraf.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/util/stat.js","webpack://@jsii/runtime/../../../node_modules/fs-extra/lib/util/utimes.js","webpack://@jsii/runtime/../../../node_modules/fs-minipass/index.js","webpack://@jsii/runtime/../../../node_modules/graceful-fs/clone.js","webpack://@jsii/runtime/../../../node_modules/graceful-fs/graceful-fs.js","webpack://@jsii/runtime/../../../node_modules/graceful-fs/legacy-streams.js","webpack://@jsii/runtime/../../../node_modules/graceful-fs/polyfills.js","webpack://@jsii/runtime/../../../node_modules/jsonfile/index.js","webpack://@jsii/runtime/../../../node_modules/jsonfile/utils.js","webpack://@jsii/runtime/../../../node_modules/lockfile/lockfile.js","webpack://@jsii/runtime/../../../node_modules/minipass/index.js","webpack://@jsii/runtime/../../../node_modules/minizlib/constants.js","webpack://@jsii/runtime/../../../node_modules/minizlib/index.js","webpack://@jsii/runtime/../../../node_modules/mkdirp/index.js","webpack://@jsii/runtime/../../../node_modules/mkdirp/lib/find-made.js","webpack://@jsii/runtime/../../../node_modules/mkdirp/lib/mkdirp-manual.js","webpack://@jsii/runtime/../../../node_modules/mkdirp/lib/mkdirp-native.js","webpack://@jsii/runtime/../../../node_modules/mkdirp/lib/opts-arg.js","webpack://@jsii/runtime/../../../node_modules/mkdirp/lib/path-arg.js","webpack://@jsii/runtime/../../../node_modules/mkdirp/lib/use-native.js","webpack://@jsii/runtime/../../../node_modules/signal-exit/index.js","webpack://@jsii/runtime/../../../node_modules/signal-exit/signals.js","webpack://@jsii/runtime/../../../node_modules/tar/index.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/create.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/extract.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/get-write-flag.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/header.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/high-level-opt.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/large-numbers.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/list.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/mkdir.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/mode-fix.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/normalize-unicode.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/normalize-windows-path.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/pack.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/parse.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/path-reservations.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/pax.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/read-entry.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/replace.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/strip-absolute-path.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/strip-trailing-slashes.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/types.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/unpack.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/update.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/warn-mixin.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/winchars.js","webpack://@jsii/runtime/../../../node_modules/tar/lib/write-entry.js","webpack://@jsii/runtime/../../../node_modules/tar/node_modules/minipass/index.js","webpack://@jsii/runtime/../../../node_modules/universalify/index.js","webpack://@jsii/runtime/../../../node_modules/yallist/iterator.js","webpack://@jsii/runtime/../../../node_modules/yallist/yallist.js","webpack://@jsii/runtime/../kernel/src/api.ts","webpack://@jsii/runtime/../kernel/src/disk-cache/digest-file.ts","webpack://@jsii/runtime/../kernel/src/disk-cache/disk-cache.ts","webpack://@jsii/runtime/../kernel/src/disk-cache/index.ts","webpack://@jsii/runtime/../kernel/src/index.ts","webpack://@jsii/runtime/../kernel/src/kernel.ts","webpack://@jsii/runtime/../kernel/src/link.ts","webpack://@jsii/runtime/../kernel/src/objects.ts","webpack://@jsii/runtime/../kernel/src/on-exit.ts","webpack://@jsii/runtime/../kernel/src/serialization.ts","webpack://@jsii/runtime/../kernel/src/tar-cache/default-cache-root.ts","webpack://@jsii/runtime/../kernel/src/tar-cache/index.ts","webpack://@jsii/runtime/./lib/host.ts","webpack://@jsii/runtime/./lib/in-out.ts","webpack://@jsii/runtime/./lib/sync-stdio.ts","webpack://@jsii/runtime/../spec/src/assembly-utils.ts","webpack://@jsii/runtime/../spec/src/assembly.ts","webpack://@jsii/runtime/../spec/src/index.ts","webpack://@jsii/runtime/../spec/src/name-tree.ts","webpack://@jsii/runtime/../spec/src/redirect.ts","webpack://@jsii/runtime/../spec/src/validate-assembly.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/ajv.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/compile/codegen/code.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/compile/codegen/index.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/compile/codegen/scope.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/compile/errors.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/compile/index.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/compile/names.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/compile/ref_error.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/compile/resolve.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/compile/rules.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/compile/util.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/compile/validate/applicability.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/compile/validate/boolSchema.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/compile/validate/dataType.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/compile/validate/defaults.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/compile/validate/index.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/compile/validate/keyword.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/compile/validate/subschema.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/core.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/runtime/equal.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/runtime/ucs2length.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/runtime/uri.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/runtime/validation_error.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/applicator/additionalItems.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/applicator/allOf.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/applicator/anyOf.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/applicator/contains.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/applicator/dependencies.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/applicator/if.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/applicator/index.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/applicator/items.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/applicator/items2020.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/applicator/not.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/applicator/oneOf.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/applicator/patternProperties.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/applicator/prefixItems.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/applicator/properties.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/applicator/propertyNames.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/applicator/thenElse.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/code.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/core/id.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/core/index.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/core/ref.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/discriminator/index.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/discriminator/types.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/draft7.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/format/format.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/format/index.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/metadata.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/validation/const.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/validation/enum.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/validation/index.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/validation/limitItems.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/validation/limitLength.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/validation/limitNumber.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/validation/limitProperties.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/validation/multipleOf.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/validation/pattern.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/validation/required.ts","webpack://@jsii/runtime/../spec/node_modules/ajv/lib/vocabularies/validation/uniqueItems.ts","webpack://@jsii/runtime/../spec/node_modules/json-schema-traverse/index.js","webpack://@jsii/runtime/external node-commonjs \"assert\"","webpack://@jsii/runtime/external node-commonjs \"buffer\"","webpack://@jsii/runtime/external node-commonjs \"child_process\"","webpack://@jsii/runtime/external node-commonjs \"constants\"","webpack://@jsii/runtime/external node-commonjs \"crypto\"","webpack://@jsii/runtime/external node-commonjs \"events\"","webpack://@jsii/runtime/external node-commonjs \"fs\"","webpack://@jsii/runtime/external node-commonjs \"module\"","webpack://@jsii/runtime/external node-commonjs \"os\"","webpack://@jsii/runtime/external node-commonjs \"path\"","webpack://@jsii/runtime/external node-commonjs \"process\"","webpack://@jsii/runtime/external node-commonjs \"stream\"","webpack://@jsii/runtime/external node-commonjs \"string_decoder\"","webpack://@jsii/runtime/external node-commonjs \"util\"","webpack://@jsii/runtime/external node-commonjs \"zlib\"","webpack://@jsii/runtime/../../../node_modules/fast-uri/index.js","webpack://@jsii/runtime/../../../node_modules/fast-uri/lib/schemes.js","webpack://@jsii/runtime/../../../node_modules/fast-uri/lib/scopedChars.js","webpack://@jsii/runtime/../../../node_modules/fast-uri/lib/utils.js","webpack://@jsii/runtime/webpack/bootstrap","webpack://@jsii/runtime/./lib/program.ts"],"sourcesContent":["'use strict'\nconst fs = require('fs')\nconst path = require('path')\n\n/* istanbul ignore next */\nconst LCHOWN = fs.lchown ? 'lchown' : 'chown'\n/* istanbul ignore next */\nconst LCHOWNSYNC = fs.lchownSync ? 'lchownSync' : 'chownSync'\n\n/* istanbul ignore next */\nconst needEISDIRHandled = fs.lchown &&\n !process.version.match(/v1[1-9]+\\./) &&\n !process.version.match(/v10\\.[6-9]/)\n\nconst lchownSync = (path, uid, gid) => {\n try {\n return fs[LCHOWNSYNC](path, uid, gid)\n } catch (er) {\n if (er.code !== 'ENOENT')\n throw er\n }\n}\n\n/* istanbul ignore next */\nconst chownSync = (path, uid, gid) => {\n try {\n return fs.chownSync(path, uid, gid)\n } catch (er) {\n if (er.code !== 'ENOENT')\n throw er\n }\n}\n\n/* istanbul ignore next */\nconst handleEISDIR =\n needEISDIRHandled ? (path, uid, gid, cb) => er => {\n // Node prior to v10 had a very questionable implementation of\n // fs.lchown, which would always try to call fs.open on a directory\n // Fall back to fs.chown in those cases.\n if (!er || er.code !== 'EISDIR')\n cb(er)\n else\n fs.chown(path, uid, gid, cb)\n }\n : (_, __, ___, cb) => cb\n\n/* istanbul ignore next */\nconst handleEISDirSync =\n needEISDIRHandled ? (path, uid, gid) => {\n try {\n return lchownSync(path, uid, gid)\n } catch (er) {\n if (er.code !== 'EISDIR')\n throw er\n chownSync(path, uid, gid)\n }\n }\n : (path, uid, gid) => lchownSync(path, uid, gid)\n\n// fs.readdir could only accept an options object as of node v6\nconst nodeVersion = process.version\nlet readdir = (path, options, cb) => fs.readdir(path, options, cb)\nlet readdirSync = (path, options) => fs.readdirSync(path, options)\n/* istanbul ignore next */\nif (/^v4\\./.test(nodeVersion))\n readdir = (path, options, cb) => fs.readdir(path, cb)\n\nconst chown = (cpath, uid, gid, cb) => {\n fs[LCHOWN](cpath, uid, gid, handleEISDIR(cpath, uid, gid, er => {\n // Skip ENOENT error\n cb(er && er.code !== 'ENOENT' ? er : null)\n }))\n}\n\nconst chownrKid = (p, child, uid, gid, cb) => {\n if (typeof child === 'string')\n return fs.lstat(path.resolve(p, child), (er, stats) => {\n // Skip ENOENT error\n if (er)\n return cb(er.code !== 'ENOENT' ? er : null)\n stats.name = child\n chownrKid(p, stats, uid, gid, cb)\n })\n\n if (child.isDirectory()) {\n chownr(path.resolve(p, child.name), uid, gid, er => {\n if (er)\n return cb(er)\n const cpath = path.resolve(p, child.name)\n chown(cpath, uid, gid, cb)\n })\n } else {\n const cpath = path.resolve(p, child.name)\n chown(cpath, uid, gid, cb)\n }\n}\n\n\nconst chownr = (p, uid, gid, cb) => {\n readdir(p, { withFileTypes: true }, (er, children) => {\n // any error other than ENOTDIR or ENOTSUP means it's not readable,\n // or doesn't exist. give up.\n if (er) {\n if (er.code === 'ENOENT')\n return cb()\n else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP')\n return cb(er)\n }\n if (er || !children.length)\n return chown(p, uid, gid, cb)\n\n let len = children.length\n let errState = null\n const then = er => {\n if (errState)\n return\n if (er)\n return cb(errState = er)\n if (-- len === 0)\n return chown(p, uid, gid, cb)\n }\n\n children.forEach(child => chownrKid(p, child, uid, gid, then))\n })\n}\n\nconst chownrKidSync = (p, child, uid, gid) => {\n if (typeof child === 'string') {\n try {\n const stats = fs.lstatSync(path.resolve(p, child))\n stats.name = child\n child = stats\n } catch (er) {\n if (er.code === 'ENOENT')\n return\n else\n throw er\n }\n }\n\n if (child.isDirectory())\n chownrSync(path.resolve(p, child.name), uid, gid)\n\n handleEISDirSync(path.resolve(p, child.name), uid, gid)\n}\n\nconst chownrSync = (p, uid, gid) => {\n let children\n try {\n children = readdirSync(p, { withFileTypes: true })\n } catch (er) {\n if (er.code === 'ENOENT')\n return\n else if (er.code === 'ENOTDIR' || er.code === 'ENOTSUP')\n return handleEISDirSync(p, uid, gid)\n else\n throw er\n }\n\n if (children && children.length)\n children.forEach(child => chownrKidSync(p, child, uid, gid))\n\n return handleEISDirSync(p, uid, gid)\n}\n\nmodule.exports = chownr\nchownr.sync = chownrSync\n","'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n","'use strict'\n\nconst fs = require('graceful-fs')\nconst path = require('path')\nconst mkdirsSync = require('../mkdirs').mkdirsSync\nconst utimesMillisSync = require('../util/utimes').utimesMillisSync\nconst stat = require('../util/stat')\n\nfunction copySync (src, dest, opts) {\n if (typeof opts === 'function') {\n opts = { filter: opts }\n }\n\n opts = opts || {}\n opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now\n opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber\n\n // Warn about using preserveTimestamps on 32-bit node\n if (opts.preserveTimestamps && process.arch === 'ia32') {\n process.emitWarning(\n 'Using the preserveTimestamps option in 32-bit node is not recommended;\\n\\n' +\n '\\tsee https://github.com/jprichardson/node-fs-extra/issues/269',\n 'Warning', 'fs-extra-WARN0002'\n )\n }\n\n const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy', opts)\n stat.checkParentPathsSync(src, srcStat, dest, 'copy')\n return handleFilterAndCopy(destStat, src, dest, opts)\n}\n\nfunction handleFilterAndCopy (destStat, src, dest, opts) {\n if (opts.filter && !opts.filter(src, dest)) return\n const destParent = path.dirname(dest)\n if (!fs.existsSync(destParent)) mkdirsSync(destParent)\n return getStats(destStat, src, dest, opts)\n}\n\nfunction startCopy (destStat, src, dest, opts) {\n if (opts.filter && !opts.filter(src, dest)) return\n return getStats(destStat, src, dest, opts)\n}\n\nfunction getStats (destStat, src, dest, opts) {\n const statSync = opts.dereference ? fs.statSync : fs.lstatSync\n const srcStat = statSync(src)\n\n if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts)\n else if (srcStat.isFile() ||\n srcStat.isCharacterDevice() ||\n srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts)\n else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts)\n else if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`)\n else if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`)\n throw new Error(`Unknown file: ${src}`)\n}\n\nfunction onFile (srcStat, destStat, src, dest, opts) {\n if (!destStat) return copyFile(srcStat, src, dest, opts)\n return mayCopyFile(srcStat, src, dest, opts)\n}\n\nfunction mayCopyFile (srcStat, src, dest, opts) {\n if (opts.overwrite) {\n fs.unlinkSync(dest)\n return copyFile(srcStat, src, dest, opts)\n } else if (opts.errorOnExist) {\n throw new Error(`'${dest}' already exists`)\n }\n}\n\nfunction copyFile (srcStat, src, dest, opts) {\n fs.copyFileSync(src, dest)\n if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest)\n return setDestMode(dest, srcStat.mode)\n}\n\nfunction handleTimestamps (srcMode, src, dest) {\n // Make sure the file is writable before setting the timestamp\n // otherwise open fails with EPERM when invoked with 'r+'\n // (through utimes call)\n if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode)\n return setDestTimestamps(src, dest)\n}\n\nfunction fileIsNotWritable (srcMode) {\n return (srcMode & 0o200) === 0\n}\n\nfunction makeFileWritable (dest, srcMode) {\n return setDestMode(dest, srcMode | 0o200)\n}\n\nfunction setDestMode (dest, srcMode) {\n return fs.chmodSync(dest, srcMode)\n}\n\nfunction setDestTimestamps (src, dest) {\n // The initial srcStat.atime cannot be trusted\n // because it is modified by the read(2) system call\n // (See https://nodejs.org/api/fs.html#fs_stat_time_values)\n const updatedSrcStat = fs.statSync(src)\n return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime)\n}\n\nfunction onDir (srcStat, destStat, src, dest, opts) {\n if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts)\n return copyDir(src, dest, opts)\n}\n\nfunction mkDirAndCopy (srcMode, src, dest, opts) {\n fs.mkdirSync(dest)\n copyDir(src, dest, opts)\n return setDestMode(dest, srcMode)\n}\n\nfunction copyDir (src, dest, opts) {\n fs.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts))\n}\n\nfunction copyDirItem (item, src, dest, opts) {\n const srcItem = path.join(src, item)\n const destItem = path.join(dest, item)\n const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy', opts)\n return startCopy(destStat, srcItem, destItem, opts)\n}\n\nfunction onLink (destStat, src, dest, opts) {\n let resolvedSrc = fs.readlinkSync(src)\n if (opts.dereference) {\n resolvedSrc = path.resolve(process.cwd(), resolvedSrc)\n }\n\n if (!destStat) {\n return fs.symlinkSync(resolvedSrc, dest)\n } else {\n let resolvedDest\n try {\n resolvedDest = fs.readlinkSync(dest)\n } catch (err) {\n // dest exists and is a regular file or directory,\n // Windows may throw UNKNOWN error. If dest already exists,\n // fs throws error anyway, so no need to guard against it here.\n if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlinkSync(resolvedSrc, dest)\n throw err\n }\n if (opts.dereference) {\n resolvedDest = path.resolve(process.cwd(), resolvedDest)\n }\n if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {\n throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)\n }\n\n // prevent copy if src is a subdir of dest since unlinking\n // dest in this case would result in removing src contents\n // and therefore a broken symlink would be created.\n if (fs.statSync(dest).isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) {\n throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)\n }\n return copyLink(resolvedSrc, dest)\n }\n}\n\nfunction copyLink (resolvedSrc, dest) {\n fs.unlinkSync(dest)\n return fs.symlinkSync(resolvedSrc, dest)\n}\n\nmodule.exports = copySync\n","'use strict'\n\nconst fs = require('graceful-fs')\nconst path = require('path')\nconst mkdirs = require('../mkdirs').mkdirs\nconst pathExists = require('../path-exists').pathExists\nconst utimesMillis = require('../util/utimes').utimesMillis\nconst stat = require('../util/stat')\n\nfunction copy (src, dest, opts, cb) {\n if (typeof opts === 'function' && !cb) {\n cb = opts\n opts = {}\n } else if (typeof opts === 'function') {\n opts = { filter: opts }\n }\n\n cb = cb || function () {}\n opts = opts || {}\n\n opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now\n opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber\n\n // Warn about using preserveTimestamps on 32-bit node\n if (opts.preserveTimestamps && process.arch === 'ia32') {\n process.emitWarning(\n 'Using the preserveTimestamps option in 32-bit node is not recommended;\\n\\n' +\n '\\tsee https://github.com/jprichardson/node-fs-extra/issues/269',\n 'Warning', 'fs-extra-WARN0001'\n )\n }\n\n stat.checkPaths(src, dest, 'copy', opts, (err, stats) => {\n if (err) return cb(err)\n const { srcStat, destStat } = stats\n stat.checkParentPaths(src, srcStat, dest, 'copy', err => {\n if (err) return cb(err)\n if (opts.filter) return handleFilter(checkParentDir, destStat, src, dest, opts, cb)\n return checkParentDir(destStat, src, dest, opts, cb)\n })\n })\n}\n\nfunction checkParentDir (destStat, src, dest, opts, cb) {\n const destParent = path.dirname(dest)\n pathExists(destParent, (err, dirExists) => {\n if (err) return cb(err)\n if (dirExists) return getStats(destStat, src, dest, opts, cb)\n mkdirs(destParent, err => {\n if (err) return cb(err)\n return getStats(destStat, src, dest, opts, cb)\n })\n })\n}\n\nfunction handleFilter (onInclude, destStat, src, dest, opts, cb) {\n Promise.resolve(opts.filter(src, dest)).then(include => {\n if (include) return onInclude(destStat, src, dest, opts, cb)\n return cb()\n }, error => cb(error))\n}\n\nfunction startCopy (destStat, src, dest, opts, cb) {\n if (opts.filter) return handleFilter(getStats, destStat, src, dest, opts, cb)\n return getStats(destStat, src, dest, opts, cb)\n}\n\nfunction getStats (destStat, src, dest, opts, cb) {\n const stat = opts.dereference ? fs.stat : fs.lstat\n stat(src, (err, srcStat) => {\n if (err) return cb(err)\n\n if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts, cb)\n else if (srcStat.isFile() ||\n srcStat.isCharacterDevice() ||\n srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts, cb)\n else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts, cb)\n else if (srcStat.isSocket()) return cb(new Error(`Cannot copy a socket file: ${src}`))\n else if (srcStat.isFIFO()) return cb(new Error(`Cannot copy a FIFO pipe: ${src}`))\n return cb(new Error(`Unknown file: ${src}`))\n })\n}\n\nfunction onFile (srcStat, destStat, src, dest, opts, cb) {\n if (!destStat) return copyFile(srcStat, src, dest, opts, cb)\n return mayCopyFile(srcStat, src, dest, opts, cb)\n}\n\nfunction mayCopyFile (srcStat, src, dest, opts, cb) {\n if (opts.overwrite) {\n fs.unlink(dest, err => {\n if (err) return cb(err)\n return copyFile(srcStat, src, dest, opts, cb)\n })\n } else if (opts.errorOnExist) {\n return cb(new Error(`'${dest}' already exists`))\n } else return cb()\n}\n\nfunction copyFile (srcStat, src, dest, opts, cb) {\n fs.copyFile(src, dest, err => {\n if (err) return cb(err)\n if (opts.preserveTimestamps) return handleTimestampsAndMode(srcStat.mode, src, dest, cb)\n return setDestMode(dest, srcStat.mode, cb)\n })\n}\n\nfunction handleTimestampsAndMode (srcMode, src, dest, cb) {\n // Make sure the file is writable before setting the timestamp\n // otherwise open fails with EPERM when invoked with 'r+'\n // (through utimes call)\n if (fileIsNotWritable(srcMode)) {\n return makeFileWritable(dest, srcMode, err => {\n if (err) return cb(err)\n return setDestTimestampsAndMode(srcMode, src, dest, cb)\n })\n }\n return setDestTimestampsAndMode(srcMode, src, dest, cb)\n}\n\nfunction fileIsNotWritable (srcMode) {\n return (srcMode & 0o200) === 0\n}\n\nfunction makeFileWritable (dest, srcMode, cb) {\n return setDestMode(dest, srcMode | 0o200, cb)\n}\n\nfunction setDestTimestampsAndMode (srcMode, src, dest, cb) {\n setDestTimestamps(src, dest, err => {\n if (err) return cb(err)\n return setDestMode(dest, srcMode, cb)\n })\n}\n\nfunction setDestMode (dest, srcMode, cb) {\n return fs.chmod(dest, srcMode, cb)\n}\n\nfunction setDestTimestamps (src, dest, cb) {\n // The initial srcStat.atime cannot be trusted\n // because it is modified by the read(2) system call\n // (See https://nodejs.org/api/fs.html#fs_stat_time_values)\n fs.stat(src, (err, updatedSrcStat) => {\n if (err) return cb(err)\n return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb)\n })\n}\n\nfunction onDir (srcStat, destStat, src, dest, opts, cb) {\n if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts, cb)\n return copyDir(src, dest, opts, cb)\n}\n\nfunction mkDirAndCopy (srcMode, src, dest, opts, cb) {\n fs.mkdir(dest, err => {\n if (err) return cb(err)\n copyDir(src, dest, opts, err => {\n if (err) return cb(err)\n return setDestMode(dest, srcMode, cb)\n })\n })\n}\n\nfunction copyDir (src, dest, opts, cb) {\n fs.readdir(src, (err, items) => {\n if (err) return cb(err)\n return copyDirItems(items, src, dest, opts, cb)\n })\n}\n\nfunction copyDirItems (items, src, dest, opts, cb) {\n const item = items.pop()\n if (!item) return cb()\n return copyDirItem(items, item, src, dest, opts, cb)\n}\n\nfunction copyDirItem (items, item, src, dest, opts, cb) {\n const srcItem = path.join(src, item)\n const destItem = path.join(dest, item)\n stat.checkPaths(srcItem, destItem, 'copy', opts, (err, stats) => {\n if (err) return cb(err)\n const { destStat } = stats\n startCopy(destStat, srcItem, destItem, opts, err => {\n if (err) return cb(err)\n return copyDirItems(items, src, dest, opts, cb)\n })\n })\n}\n\nfunction onLink (destStat, src, dest, opts, cb) {\n fs.readlink(src, (err, resolvedSrc) => {\n if (err) return cb(err)\n if (opts.dereference) {\n resolvedSrc = path.resolve(process.cwd(), resolvedSrc)\n }\n\n if (!destStat) {\n return fs.symlink(resolvedSrc, dest, cb)\n } else {\n fs.readlink(dest, (err, resolvedDest) => {\n if (err) {\n // dest exists and is a regular file or directory,\n // Windows may throw UNKNOWN error. If dest already exists,\n // fs throws error anyway, so no need to guard against it here.\n if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlink(resolvedSrc, dest, cb)\n return cb(err)\n }\n if (opts.dereference) {\n resolvedDest = path.resolve(process.cwd(), resolvedDest)\n }\n if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {\n return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`))\n }\n\n // do not copy if src is a subdir of dest since unlinking\n // dest in this case would result in removing src contents\n // and therefore a broken symlink would be created.\n if (destStat.isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) {\n return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`))\n }\n return copyLink(resolvedSrc, dest, cb)\n })\n }\n })\n}\n\nfunction copyLink (resolvedSrc, dest, cb) {\n fs.unlink(dest, err => {\n if (err) return cb(err)\n return fs.symlink(resolvedSrc, dest, cb)\n })\n}\n\nmodule.exports = copy\n","'use strict'\n\nconst u = require('universalify').fromCallback\nmodule.exports = {\n copy: u(require('./copy')),\n copySync: require('./copy-sync')\n}\n","'use strict'\n\nconst u = require('universalify').fromPromise\nconst fs = require('../fs')\nconst path = require('path')\nconst mkdir = require('../mkdirs')\nconst remove = require('../remove')\n\nconst emptyDir = u(async function emptyDir (dir) {\n let items\n try {\n items = await fs.readdir(dir)\n } catch {\n return mkdir.mkdirs(dir)\n }\n\n return Promise.all(items.map(item => remove.remove(path.join(dir, item))))\n})\n\nfunction emptyDirSync (dir) {\n let items\n try {\n items = fs.readdirSync(dir)\n } catch {\n return mkdir.mkdirsSync(dir)\n }\n\n items.forEach(item => {\n item = path.join(dir, item)\n remove.removeSync(item)\n })\n}\n\nmodule.exports = {\n emptyDirSync,\n emptydirSync: emptyDirSync,\n emptyDir,\n emptydir: emptyDir\n}\n","'use strict'\n\nconst u = require('universalify').fromCallback\nconst path = require('path')\nconst fs = require('graceful-fs')\nconst mkdir = require('../mkdirs')\n\nfunction createFile (file, callback) {\n function makeFile () {\n fs.writeFile(file, '', err => {\n if (err) return callback(err)\n callback()\n })\n }\n\n fs.stat(file, (err, stats) => { // eslint-disable-line handle-callback-err\n if (!err && stats.isFile()) return callback()\n const dir = path.dirname(file)\n fs.stat(dir, (err, stats) => {\n if (err) {\n // if the directory doesn't exist, make it\n if (err.code === 'ENOENT') {\n return mkdir.mkdirs(dir, err => {\n if (err) return callback(err)\n makeFile()\n })\n }\n return callback(err)\n }\n\n if (stats.isDirectory()) makeFile()\n else {\n // parent is not a directory\n // This is just to cause an internal ENOTDIR error to be thrown\n fs.readdir(dir, err => {\n if (err) return callback(err)\n })\n }\n })\n })\n}\n\nfunction createFileSync (file) {\n let stats\n try {\n stats = fs.statSync(file)\n } catch {}\n if (stats && stats.isFile()) return\n\n const dir = path.dirname(file)\n try {\n if (!fs.statSync(dir).isDirectory()) {\n // parent is not a directory\n // This is just to cause an internal ENOTDIR error to be thrown\n fs.readdirSync(dir)\n }\n } catch (err) {\n // If the stat call above failed because the directory doesn't exist, create it\n if (err && err.code === 'ENOENT') mkdir.mkdirsSync(dir)\n else throw err\n }\n\n fs.writeFileSync(file, '')\n}\n\nmodule.exports = {\n createFile: u(createFile),\n createFileSync\n}\n","'use strict'\n\nconst { createFile, createFileSync } = require('./file')\nconst { createLink, createLinkSync } = require('./link')\nconst { createSymlink, createSymlinkSync } = require('./symlink')\n\nmodule.exports = {\n // file\n createFile,\n createFileSync,\n ensureFile: createFile,\n ensureFileSync: createFileSync,\n // link\n createLink,\n createLinkSync,\n ensureLink: createLink,\n ensureLinkSync: createLinkSync,\n // symlink\n createSymlink,\n createSymlinkSync,\n ensureSymlink: createSymlink,\n ensureSymlinkSync: createSymlinkSync\n}\n","'use strict'\n\nconst u = require('universalify').fromCallback\nconst path = require('path')\nconst fs = require('graceful-fs')\nconst mkdir = require('../mkdirs')\nconst pathExists = require('../path-exists').pathExists\nconst { areIdentical } = require('../util/stat')\n\nfunction createLink (srcpath, dstpath, callback) {\n function makeLink (srcpath, dstpath) {\n fs.link(srcpath, dstpath, err => {\n if (err) return callback(err)\n callback(null)\n })\n }\n\n fs.lstat(dstpath, (_, dstStat) => {\n fs.lstat(srcpath, (err, srcStat) => {\n if (err) {\n err.message = err.message.replace('lstat', 'ensureLink')\n return callback(err)\n }\n if (dstStat && areIdentical(srcStat, dstStat)) return callback(null)\n\n const dir = path.dirname(dstpath)\n pathExists(dir, (err, dirExists) => {\n if (err) return callback(err)\n if (dirExists) return makeLink(srcpath, dstpath)\n mkdir.mkdirs(dir, err => {\n if (err) return callback(err)\n makeLink(srcpath, dstpath)\n })\n })\n })\n })\n}\n\nfunction createLinkSync (srcpath, dstpath) {\n let dstStat\n try {\n dstStat = fs.lstatSync(dstpath)\n } catch {}\n\n try {\n const srcStat = fs.lstatSync(srcpath)\n if (dstStat && areIdentical(srcStat, dstStat)) return\n } catch (err) {\n err.message = err.message.replace('lstat', 'ensureLink')\n throw err\n }\n\n const dir = path.dirname(dstpath)\n const dirExists = fs.existsSync(dir)\n if (dirExists) return fs.linkSync(srcpath, dstpath)\n mkdir.mkdirsSync(dir)\n\n return fs.linkSync(srcpath, dstpath)\n}\n\nmodule.exports = {\n createLink: u(createLink),\n createLinkSync\n}\n","'use strict'\n\nconst path = require('path')\nconst fs = require('graceful-fs')\nconst pathExists = require('../path-exists').pathExists\n\n/**\n * Function that returns two types of paths, one relative to symlink, and one\n * relative to the current working directory. Checks if path is absolute or\n * relative. If the path is relative, this function checks if the path is\n * relative to symlink or relative to current working directory. This is an\n * initiative to find a smarter `srcpath` to supply when building symlinks.\n * This allows you to determine which path to use out of one of three possible\n * types of source paths. The first is an absolute path. This is detected by\n * `path.isAbsolute()`. When an absolute path is provided, it is checked to\n * see if it exists. If it does it's used, if not an error is returned\n * (callback)/ thrown (sync). The other two options for `srcpath` are a\n * relative url. By default Node's `fs.symlink` works by creating a symlink\n * using `dstpath` and expects the `srcpath` to be relative to the newly\n * created symlink. If you provide a `srcpath` that does not exist on the file\n * system it results in a broken symlink. To minimize this, the function\n * checks to see if the 'relative to symlink' source file exists, and if it\n * does it will use it. If it does not, it checks if there's a file that\n * exists that is relative to the current working directory, if does its used.\n * This preserves the expectations of the original fs.symlink spec and adds\n * the ability to pass in `relative to current working direcotry` paths.\n */\n\nfunction symlinkPaths (srcpath, dstpath, callback) {\n if (path.isAbsolute(srcpath)) {\n return fs.lstat(srcpath, (err) => {\n if (err) {\n err.message = err.message.replace('lstat', 'ensureSymlink')\n return callback(err)\n }\n return callback(null, {\n toCwd: srcpath,\n toDst: srcpath\n })\n })\n } else {\n const dstdir = path.dirname(dstpath)\n const relativeToDst = path.join(dstdir, srcpath)\n return pathExists(relativeToDst, (err, exists) => {\n if (err) return callback(err)\n if (exists) {\n return callback(null, {\n toCwd: relativeToDst,\n toDst: srcpath\n })\n } else {\n return fs.lstat(srcpath, (err) => {\n if (err) {\n err.message = err.message.replace('lstat', 'ensureSymlink')\n return callback(err)\n }\n return callback(null, {\n toCwd: srcpath,\n toDst: path.relative(dstdir, srcpath)\n })\n })\n }\n })\n }\n}\n\nfunction symlinkPathsSync (srcpath, dstpath) {\n let exists\n if (path.isAbsolute(srcpath)) {\n exists = fs.existsSync(srcpath)\n if (!exists) throw new Error('absolute srcpath does not exist')\n return {\n toCwd: srcpath,\n toDst: srcpath\n }\n } else {\n const dstdir = path.dirname(dstpath)\n const relativeToDst = path.join(dstdir, srcpath)\n exists = fs.existsSync(relativeToDst)\n if (exists) {\n return {\n toCwd: relativeToDst,\n toDst: srcpath\n }\n } else {\n exists = fs.existsSync(srcpath)\n if (!exists) throw new Error('relative srcpath does not exist')\n return {\n toCwd: srcpath,\n toDst: path.relative(dstdir, srcpath)\n }\n }\n }\n}\n\nmodule.exports = {\n symlinkPaths,\n symlinkPathsSync\n}\n","'use strict'\n\nconst fs = require('graceful-fs')\n\nfunction symlinkType (srcpath, type, callback) {\n callback = (typeof type === 'function') ? type : callback\n type = (typeof type === 'function') ? false : type\n if (type) return callback(null, type)\n fs.lstat(srcpath, (err, stats) => {\n if (err) return callback(null, 'file')\n type = (stats && stats.isDirectory()) ? 'dir' : 'file'\n callback(null, type)\n })\n}\n\nfunction symlinkTypeSync (srcpath, type) {\n let stats\n\n if (type) return type\n try {\n stats = fs.lstatSync(srcpath)\n } catch {\n return 'file'\n }\n return (stats && stats.isDirectory()) ? 'dir' : 'file'\n}\n\nmodule.exports = {\n symlinkType,\n symlinkTypeSync\n}\n","'use strict'\n\nconst u = require('universalify').fromCallback\nconst path = require('path')\nconst fs = require('../fs')\nconst _mkdirs = require('../mkdirs')\nconst mkdirs = _mkdirs.mkdirs\nconst mkdirsSync = _mkdirs.mkdirsSync\n\nconst _symlinkPaths = require('./symlink-paths')\nconst symlinkPaths = _symlinkPaths.symlinkPaths\nconst symlinkPathsSync = _symlinkPaths.symlinkPathsSync\n\nconst _symlinkType = require('./symlink-type')\nconst symlinkType = _symlinkType.symlinkType\nconst symlinkTypeSync = _symlinkType.symlinkTypeSync\n\nconst pathExists = require('../path-exists').pathExists\n\nconst { areIdentical } = require('../util/stat')\n\nfunction createSymlink (srcpath, dstpath, type, callback) {\n callback = (typeof type === 'function') ? type : callback\n type = (typeof type === 'function') ? false : type\n\n fs.lstat(dstpath, (err, stats) => {\n if (!err && stats.isSymbolicLink()) {\n Promise.all([\n fs.stat(srcpath),\n fs.stat(dstpath)\n ]).then(([srcStat, dstStat]) => {\n if (areIdentical(srcStat, dstStat)) return callback(null)\n _createSymlink(srcpath, dstpath, type, callback)\n })\n } else _createSymlink(srcpath, dstpath, type, callback)\n })\n}\n\nfunction _createSymlink (srcpath, dstpath, type, callback) {\n symlinkPaths(srcpath, dstpath, (err, relative) => {\n if (err) return callback(err)\n srcpath = relative.toDst\n symlinkType(relative.toCwd, type, (err, type) => {\n if (err) return callback(err)\n const dir = path.dirname(dstpath)\n pathExists(dir, (err, dirExists) => {\n if (err) return callback(err)\n if (dirExists) return fs.symlink(srcpath, dstpath, type, callback)\n mkdirs(dir, err => {\n if (err) return callback(err)\n fs.symlink(srcpath, dstpath, type, callback)\n })\n })\n })\n })\n}\n\nfunction createSymlinkSync (srcpath, dstpath, type) {\n let stats\n try {\n stats = fs.lstatSync(dstpath)\n } catch {}\n if (stats && stats.isSymbolicLink()) {\n const srcStat = fs.statSync(srcpath)\n const dstStat = fs.statSync(dstpath)\n if (areIdentical(srcStat, dstStat)) return\n }\n\n const relative = symlinkPathsSync(srcpath, dstpath)\n srcpath = relative.toDst\n type = symlinkTypeSync(relative.toCwd, type)\n const dir = path.dirname(dstpath)\n const exists = fs.existsSync(dir)\n if (exists) return fs.symlinkSync(srcpath, dstpath, type)\n mkdirsSync(dir)\n return fs.symlinkSync(srcpath, dstpath, type)\n}\n\nmodule.exports = {\n createSymlink: u(createSymlink),\n createSymlinkSync\n}\n","'use strict'\n// This is adapted from https://github.com/normalize/mz\n// Copyright (c) 2014-2016 Jonathan Ong [email protected] and Contributors\nconst u = require('universalify').fromCallback\nconst fs = require('graceful-fs')\n\nconst api = [\n 'access',\n 'appendFile',\n 'chmod',\n 'chown',\n 'close',\n 'copyFile',\n 'fchmod',\n 'fchown',\n 'fdatasync',\n 'fstat',\n 'fsync',\n 'ftruncate',\n 'futimes',\n 'lchmod',\n 'lchown',\n 'link',\n 'lstat',\n 'mkdir',\n 'mkdtemp',\n 'open',\n 'opendir',\n 'readdir',\n 'readFile',\n 'readlink',\n 'realpath',\n 'rename',\n 'rm',\n 'rmdir',\n 'stat',\n 'symlink',\n 'truncate',\n 'unlink',\n 'utimes',\n 'writeFile'\n].filter(key => {\n // Some commands are not available on some systems. Ex:\n // fs.opendir was added in Node.js v12.12.0\n // fs.rm was added in Node.js v14.14.0\n // fs.lchown is not available on at least some Linux\n return typeof fs[key] === 'function'\n})\n\n// Export cloned fs:\nObject.assign(exports, fs)\n\n// Universalify async methods:\napi.forEach(method => {\n exports[method] = u(fs[method])\n})\n\n// We differ from mz/fs in that we still ship the old, broken, fs.exists()\n// since we are a drop-in replacement for the native module\nexports.exists = function (filename, callback) {\n if (typeof callback === 'function') {\n return fs.exists(filename, callback)\n }\n return new Promise(resolve => {\n return fs.exists(filename, resolve)\n })\n}\n\n// fs.read(), fs.write(), & fs.writev() need special treatment due to multiple callback args\n\nexports.read = function (fd, buffer, offset, length, position, callback) {\n if (typeof callback === 'function') {\n return fs.read(fd, buffer, offset, length, position, callback)\n }\n return new Promise((resolve, reject) => {\n fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => {\n if (err) return reject(err)\n resolve({ bytesRead, buffer })\n })\n })\n}\n\n// Function signature can be\n// fs.write(fd, buffer[, offset[, length[, position]]], callback)\n// OR\n// fs.write(fd, string[, position[, encoding]], callback)\n// We need to handle both cases, so we use ...args\nexports.write = function (fd, buffer, ...args) {\n if (typeof args[args.length - 1] === 'function') {\n return fs.write(fd, buffer, ...args)\n }\n\n return new Promise((resolve, reject) => {\n fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => {\n if (err) return reject(err)\n resolve({ bytesWritten, buffer })\n })\n })\n}\n\n// fs.writev only available in Node v12.9.0+\nif (typeof fs.writev === 'function') {\n // Function signature is\n // s.writev(fd, buffers[, position], callback)\n // We need to handle the optional arg, so we use ...args\n exports.writev = function (fd, buffers, ...args) {\n if (typeof args[args.length - 1] === 'function') {\n return fs.writev(fd, buffers, ...args)\n }\n\n return new Promise((resolve, reject) => {\n fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers) => {\n if (err) return reject(err)\n resolve({ bytesWritten, buffers })\n })\n })\n }\n}\n\n// fs.realpath.native sometimes not available if fs is monkey-patched\nif (typeof fs.realpath.native === 'function') {\n exports.realpath.native = u(fs.realpath.native)\n} else {\n process.emitWarning(\n 'fs.realpath.native is not a function. Is fs being monkey-patched?',\n 'Warning', 'fs-extra-WARN0003'\n )\n}\n","'use strict'\n\nmodule.exports = {\n // Export promiseified graceful-fs:\n ...require('./fs'),\n // Export extra methods:\n ...require('./copy'),\n ...require('./empty'),\n ...require('./ensure'),\n ...require('./json'),\n ...require('./mkdirs'),\n ...require('./move'),\n ...require('./output-file'),\n ...require('./path-exists'),\n ...require('./remove')\n}\n","'use strict'\n\nconst u = require('universalify').fromPromise\nconst jsonFile = require('./jsonfile')\n\njsonFile.outputJson = u(require('./output-json'))\njsonFile.outputJsonSync = require('./output-json-sync')\n// aliases\njsonFile.outputJSON = jsonFile.outputJson\njsonFile.outputJSONSync = jsonFile.outputJsonSync\njsonFile.writeJSON = jsonFile.writeJson\njsonFile.writeJSONSync = jsonFile.writeJsonSync\njsonFile.readJSON = jsonFile.readJson\njsonFile.readJSONSync = jsonFile.readJsonSync\n\nmodule.exports = jsonFile\n","'use strict'\n\nconst jsonFile = require('jsonfile')\n\nmodule.exports = {\n // jsonfile exports\n readJson: jsonFile.readFile,\n readJsonSync: jsonFile.readFileSync,\n writeJson: jsonFile.writeFile,\n writeJsonSync: jsonFile.writeFileSync\n}\n","'use strict'\n\nconst { stringify } = require('jsonfile/utils')\nconst { outputFileSync } = require('../output-file')\n\nfunction outputJsonSync (file, data, options) {\n const str = stringify(data, options)\n\n outputFileSync(file, str, options)\n}\n\nmodule.exports = outputJsonSync\n","'use strict'\n\nconst { stringify } = require('jsonfile/utils')\nconst { outputFile } = require('../output-file')\n\nasync function outputJson (file, data, options = {}) {\n const str = stringify(data, options)\n\n await outputFile(file, str, options)\n}\n\nmodule.exports = outputJson\n","'use strict'\nconst u = require('universalify').fromPromise\nconst { makeDir: _makeDir, makeDirSync } = require('./make-dir')\nconst makeDir = u(_makeDir)\n\nmodule.exports = {\n mkdirs: makeDir,\n mkdirsSync: makeDirSync,\n // alias\n mkdirp: makeDir,\n mkdirpSync: makeDirSync,\n ensureDir: makeDir,\n ensureDirSync: makeDirSync\n}\n","'use strict'\nconst fs = require('../fs')\nconst { checkPath } = require('./utils')\n\nconst getMode = options => {\n const defaults = { mode: 0o777 }\n if (typeof options === 'number') return options\n return ({ ...defaults, ...options }).mode\n}\n\nmodule.exports.makeDir = async (dir, options) => {\n checkPath(dir)\n\n return fs.mkdir(dir, {\n mode: getMode(options),\n recursive: true\n })\n}\n\nmodule.exports.makeDirSync = (dir, options) => {\n checkPath(dir)\n\n return fs.mkdirSync(dir, {\n mode: getMode(options),\n recursive: true\n })\n}\n","// Adapted from https://github.com/sindresorhus/make-dir\n// Copyright (c) Sindre Sorhus (sindresorhus.com)\n// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n'use strict'\nconst path = require('path')\n\n// https://github.com/nodejs/node/issues/8987\n// https://github.com/libuv/libuv/pull/1088\nmodule.exports.checkPath = function checkPath (pth) {\n if (process.platform === 'win32') {\n const pathHasInvalidWinCharacters = /[<>:\"|?*]/.test(pth.replace(path.parse(pth).root, ''))\n\n if (pathHasInvalidWinCharacters) {\n const error = new Error(`Path contains invalid characters: ${pth}`)\n error.code = 'EINVAL'\n throw error\n }\n }\n}\n","'use strict'\n\nconst u = require('universalify').fromCallback\nmodule.exports = {\n move: u(require('./move')),\n moveSync: require('./move-sync')\n}\n","'use strict'\n\nconst fs = require('graceful-fs')\nconst path = require('path')\nconst copySync = require('../copy').copySync\nconst removeSync = require('../remove').removeSync\nconst mkdirpSync = require('../mkdirs').mkdirpSync\nconst stat = require('../util/stat')\n\nfunction moveSync (src, dest, opts) {\n opts = opts || {}\n const overwrite = opts.overwrite || opts.clobber || false\n\n const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, 'move', opts)\n stat.checkParentPathsSync(src, srcStat, dest, 'move')\n if (!isParentRoot(dest)) mkdirpSync(path.dirname(dest))\n return doRename(src, dest, overwrite, isChangingCase)\n}\n\nfunction isParentRoot (dest) {\n const parent = path.dirname(dest)\n const parsedPath = path.parse(parent)\n return parsedPath.root === parent\n}\n\nfunction doRename (src, dest, overwrite, isChangingCase) {\n if (isChangingCase) return rename(src, dest, overwrite)\n if (overwrite) {\n removeSync(dest)\n return rename(src, dest, overwrite)\n }\n if (fs.existsSync(dest)) throw new Error('dest already exists.')\n return rename(src, dest, overwrite)\n}\n\nfunction rename (src, dest, overwrite) {\n try {\n fs.renameSync(src, dest)\n } catch (err) {\n if (err.code !== 'EXDEV') throw err\n return moveAcrossDevice(src, dest, overwrite)\n }\n}\n\nfunction moveAcrossDevice (src, dest, overwrite) {\n const opts = {\n overwrite,\n errorOnExist: true\n }\n copySync(src, dest, opts)\n return removeSync(src)\n}\n\nmodule.exports = moveSync\n","'use strict'\n\nconst fs = require('graceful-fs')\nconst path = require('path')\nconst copy = require('../copy').copy\nconst remove = require('../remove').remove\nconst mkdirp = require('../mkdirs').mkdirp\nconst pathExists = require('../path-exists').pathExists\nconst stat = require('../util/stat')\n\nfunction move (src, dest, opts, cb) {\n if (typeof opts === 'function') {\n cb = opts\n opts = {}\n }\n\n opts = opts || {}\n\n const overwrite = opts.overwrite || opts.clobber || false\n\n stat.checkPaths(src, dest, 'move', opts, (err, stats) => {\n if (err) return cb(err)\n const { srcStat, isChangingCase = false } = stats\n stat.checkParentPaths(src, srcStat, dest, 'move', err => {\n if (err) return cb(err)\n if (isParentRoot(dest)) return doRename(src, dest, overwrite, isChangingCase, cb)\n mkdirp(path.dirname(dest), err => {\n if (err) return cb(err)\n return doRename(src, dest, overwrite, isChangingCase, cb)\n })\n })\n })\n}\n\nfunction isParentRoot (dest) {\n const parent = path.dirname(dest)\n const parsedPath = path.parse(parent)\n return parsedPath.root === parent\n}\n\nfunction doRename (src, dest, overwrite, isChangingCase, cb) {\n if (isChangingCase) return rename(src, dest, overwrite, cb)\n if (overwrite) {\n return remove(dest, err => {\n if (err) return cb(err)\n return rename(src, dest, overwrite, cb)\n })\n }\n pathExists(dest, (err, destExists) => {\n if (err) return cb(err)\n if (destExists) return cb(new Error('dest already exists.'))\n return rename(src, dest, overwrite, cb)\n })\n}\n\nfunction rename (src, dest, overwrite, cb) {\n fs.rename(src, dest, err => {\n if (!err) return cb()\n if (err.code !== 'EXDEV') return cb(err)\n return moveAcrossDevice(src, dest, overwrite, cb)\n })\n}\n\nfunction moveAcrossDevice (src, dest, overwrite, cb) {\n const opts = {\n overwrite,\n errorOnExist: true\n }\n copy(src, dest, opts, err => {\n if (err) return cb(err)\n return remove(src, cb)\n })\n}\n\nmodule.exports = move\n","'use strict'\n\nconst u = require('universalify').fromCallback\nconst fs = require('graceful-fs')\nconst path = require('path')\nconst mkdir = require('../mkdirs')\nconst pathExists = require('../path-exists').pathExists\n\nfunction outputFile (file, data, encoding, callback) {\n if (typeof encoding === 'function') {\n callback = encoding\n encoding = 'utf8'\n }\n\n const dir = path.dirname(file)\n pathExists(dir, (err, itDoes) => {\n if (err) return callback(err)\n if (itDoes) return fs.writeFile(file, data, encoding, callback)\n\n mkdir.mkdirs(dir, err => {\n if (err) return callback(err)\n\n fs.writeFile(file, data, encoding, callback)\n })\n })\n}\n\nfunction outputFileSync (file, ...args) {\n const dir = path.dirname(file)\n if (fs.existsSync(dir)) {\n return fs.writeFileSync(file, ...args)\n }\n mkdir.mkdirsSync(dir)\n fs.writeFileSync(file, ...args)\n}\n\nmodule.exports = {\n outputFile: u(outputFile),\n outputFileSync\n}\n","'use strict'\nconst u = require('universalify').fromPromise\nconst fs = require('../fs')\n\nfunction pathExists (path) {\n return fs.access(path).then(() => true).catch(() => false)\n}\n\nmodule.exports = {\n pathExists: u(pathExists),\n pathExistsSync: fs.existsSync\n}\n","'use strict'\n\nconst fs = require('graceful-fs')\nconst u = require('universalify').fromCallback\nconst rimraf = require('./rimraf')\n\nfunction remove (path, callback) {\n // Node 14.14.0+\n if (fs.rm) return fs.rm(path, { recursive: true, force: true }, callback)\n rimraf(path, callback)\n}\n\nfunction removeSync (path) {\n // Node 14.14.0+\n if (fs.rmSync) return fs.rmSync(path, { recursive: true, force: true })\n rimraf.sync(path)\n}\n\nmodule.exports = {\n remove: u(remove),\n removeSync\n}\n","'use strict'\n\nconst fs = require('graceful-fs')\nconst path = require('path')\nconst assert = require('assert')\n\nconst isWindows = (process.platform === 'win32')\n\nfunction defaults (options) {\n const methods = [\n 'unlink',\n 'chmod',\n 'stat',\n 'lstat',\n 'rmdir',\n 'readdir'\n ]\n methods.forEach(m => {\n options[m] = options[m] || fs[m]\n m = m + 'Sync'\n options[m] = options[m] || fs[m]\n })\n\n options.maxBusyTries = options.maxBusyTries || 3\n}\n\nfunction rimraf (p, options, cb) {\n let busyTries = 0\n\n if (typeof options === 'function') {\n cb = options\n options = {}\n }\n\n assert(p, 'rimraf: missing path')\n assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string')\n assert.strictEqual(typeof cb, 'function', 'rimraf: callback function required')\n assert(options, 'rimraf: invalid options argument provided')\n assert.strictEqual(typeof options, 'object', 'rimraf: options should be object')\n\n defaults(options)\n\n rimraf_(p, options, function CB (er) {\n if (er) {\n if ((er.code === 'EBUSY' || er.code === 'ENOTEMPTY' || er.code === 'EPERM') &&\n busyTries < options.maxBusyTries) {\n busyTries++\n const time = busyTries * 100\n // try again, with the same exact callback as this one.\n return setTimeout(() => rimraf_(p, options, CB), time)\n }\n\n // already gone\n if (er.code === 'ENOENT') er = null\n }\n\n cb(er)\n })\n}\n\n// Two possible strategies.\n// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR\n// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR\n//\n// Both result in an extra syscall when you guess wrong. However, there\n// are likely far more normal files in the world than directories. This\n// is based on the assumption that a the average number of files per\n// directory is >= 1.\n//\n// If anyone ever complains about this, then I guess the strategy could\n// be made configurable somehow. But until then, YAGNI.\nfunction rimraf_ (p, options, cb) {\n assert(p)\n assert(options)\n assert(typeof cb === 'function')\n\n // sunos lets the root user unlink directories, which is... weird.\n // so we have to lstat here and make sure it's not a dir.\n options.lstat(p, (er, st) => {\n if (er && er.code === 'ENOENT') {\n return cb(null)\n }\n\n // Windows can EPERM on stat. Life is suffering.\n if (er && er.code === 'EPERM' && isWindows) {\n return fixWinEPERM(p, options, er, cb)\n }\n\n if (st && st.isDirectory()) {\n return rmdir(p, options, er, cb)\n }\n\n options.unlink(p, er => {\n if (er) {\n if (er.code === 'ENOENT') {\n return cb(null)\n }\n if (er.code === 'EPERM') {\n return (isWindows)\n ? fixWinEPERM(p, options, er, cb)\n : rmdir(p, options, er, cb)\n }\n if (er.code === 'EISDIR') {\n return rmdir(p, options, er, cb)\n }\n }\n return cb(er)\n })\n })\n}\n\nfunction fixWinEPERM (p, options, er, cb) {\n assert(p)\n assert(options)\n assert(typeof cb === 'function')\n\n options.chmod(p, 0o666, er2 => {\n if (er2) {\n cb(er2.code === 'ENOENT' ? null : er)\n } else {\n options.stat(p, (er3, stats) => {\n if (er3) {\n cb(er3.code === 'ENOENT' ? null : er)\n } else if (stats.isDirectory()) {\n rmdir(p, options, er, cb)\n } else {\n options.unlink(p, cb)\n }\n })\n }\n })\n}\n\nfunction fixWinEPERMSync (p, options, er) {\n let stats\n\n assert(p)\n assert(options)\n\n try {\n options.chmodSync(p, 0o666)\n } catch (er2) {\n if (er2.code === 'ENOENT') {\n return\n } else {\n throw er\n }\n }\n\n try {\n stats = options.statSync(p)\n } catch (er3) {\n if (er3.code === 'ENOENT') {\n return\n } else {\n throw er\n }\n }\n\n if (stats.isDirectory()) {\n rmdirSync(p, options, er)\n } else {\n options.unlinkSync(p)\n }\n}\n\nfunction rmdir (p, options, originalEr, cb) {\n assert(p)\n assert(options)\n assert(typeof cb === 'function')\n\n // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS)\n // if we guessed wrong, and it's not a directory, then\n // raise the original error.\n options.rmdir(p, er => {\n if (er && (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM')) {\n rmkids(p, options, cb)\n } else if (er && er.code === 'ENOTDIR') {\n cb(originalEr)\n } else {\n cb(er)\n }\n })\n}\n\nfunction rmkids (p, options, cb) {\n assert(p)\n assert(options)\n assert(typeof cb === 'function')\n\n options.readdir(p, (er, files) => {\n if (er) return cb(er)\n\n let n = files.length\n let errState\n\n if (n === 0) return options.rmdir(p, cb)\n\n files.forEach(f => {\n rimraf(path.join(p, f), options, er => {\n if (errState) {\n return\n }\n if (er) return cb(errState = er)\n if (--n === 0) {\n options.rmdir(p, cb)\n }\n })\n })\n })\n}\n\n// this looks simpler, and is strictly *faster*, but will\n// tie up the JavaScript thread and fail on excessively\n// deep directory trees.\nfunction rimrafSync (p, options) {\n let st\n\n options = options || {}\n defaults(options)\n\n assert(p, 'rimraf: missing path')\n assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string')\n assert(options, 'rimraf: missing options')\n assert.strictEqual(typeof options, 'object', 'rimraf: options should be object')\n\n try {\n st = options.lstatSync(p)\n } catch (er) {\n if (er.code === 'ENOENT') {\n return\n }\n\n // Windows can EPERM on stat. Life is suffering.\n if (er.code === 'EPERM' && isWindows) {\n fixWinEPERMSync(p, options, er)\n }\n }\n\n try {\n // sunos lets the root user unlink directories, which is... weird.\n if (st && st.isDirectory()) {\n rmdirSync(p, options, null)\n } else {\n options.unlinkSync(p)\n }\n } catch (er) {\n if (er.code === 'ENOENT') {\n return\n } else if (er.code === 'EPERM') {\n return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er)\n } else if (er.code !== 'EISDIR') {\n throw er\n }\n rmdirSync(p, options, er)\n }\n}\n\nfunction rmdirSync (p, options, originalEr) {\n assert(p)\n assert(options)\n\n try {\n options.rmdirSync(p)\n } catch (er) {\n if (er.code === 'ENOTDIR') {\n throw originalEr\n } else if (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM') {\n rmkidsSync(p, options)\n } else if (er.code !== 'ENOENT') {\n throw er\n }\n }\n}\n\nfunction rmkidsSync (p, options) {\n assert(p)\n assert(options)\n options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options))\n\n if (isWindows) {\n // We only end up here once we got ENOTEMPTY at least once, and\n // at this point, we are guaranteed to have removed all the kids.\n // So, we know that it won't be ENOENT or ENOTDIR or anything else.\n // try really hard to delete stuff on windows, because it has a\n // PROFOUNDLY annoying habit of not closing handles promptly when\n // files are deleted, resulting in spurious ENOTEMPTY errors.\n const startTime = Date.now()\n do {\n try {\n const ret = options.rmdirSync(p, options)\n return ret\n } catch {}\n } while (Date.now() - startTime < 500) // give up after 500ms\n } else {\n const ret = options.rmdirSync(p, options)\n return ret\n }\n}\n\nmodule.exports = rimraf\nrimraf.sync = rimrafSync\n","'use strict'\n\nconst fs = require('../fs')\nconst path = require('path')\nconst util = require('util')\n\nfunction getStats (src, dest, opts) {\n const statFunc = opts.dereference\n ? (file) => fs.stat(file, { bigint: true })\n : (file) => fs.lstat(file, { bigint: true })\n return Promise.all([\n statFunc(src),\n statFunc(dest).catch(err => {\n if (err.code === 'ENOENT') return null\n throw err\n })\n ]).then(([srcStat, destStat]) => ({ srcStat, destStat }))\n}\n\nfunction getStatsSync (src, dest, opts) {\n let destStat\n const statFunc = opts.dereference\n ? (file) => fs.statSync(file, { bigint: true })\n : (file) => fs.lstatSync(file, { bigint: true })\n const srcStat = statFunc(src)\n try {\n destStat = statFunc(dest)\n } catch (err) {\n if (err.code === 'ENOENT') return { srcStat, destStat: null }\n throw err\n }\n return { srcStat, destStat }\n}\n\nfunction checkPaths (src, dest, funcName, opts, cb) {\n util.callbackify(getStats)(src, dest, opts, (err, stats) => {\n if (err) return cb(err)\n const { srcStat, destStat } = stats\n\n if (destStat) {\n if (areIdentical(srcStat, destStat)) {\n const srcBaseName = path.basename(src)\n const destBaseName = path.basename(dest)\n if (funcName === 'move' &&\n srcBaseName !== destBaseName &&\n srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {\n return cb(null, { srcStat, destStat, isChangingCase: true })\n }\n return cb(new Error('Source and destination must not be the same.'))\n }\n if (srcStat.isDirectory() && !destStat.isDirectory()) {\n return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`))\n }\n if (!srcStat.isDirectory() && destStat.isDirectory()) {\n return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`))\n }\n }\n\n if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {\n return cb(new Error(errMsg(src, dest, funcName)))\n }\n return cb(null, { srcStat, destStat })\n })\n}\n\nfunction checkPathsSync (src, dest, funcName, opts) {\n const { srcStat, destStat } = getStatsSync(src, dest, opts)\n\n if (destStat) {\n if (areIdentical(srcStat, destStat)) {\n const srcBaseName = path.basename(src)\n const destBaseName = path.basename(dest)\n if (funcName === 'move' &&\n srcBaseName !== destBaseName &&\n srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {\n return { srcStat, destStat, isChangingCase: true }\n }\n throw new Error('Source and destination must not be the same.')\n }\n if (srcStat.isDirectory() && !destStat.isDirectory()) {\n throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)\n }\n if (!srcStat.isDirectory() && destStat.isDirectory()) {\n throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)\n }\n }\n\n if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {\n throw new Error(errMsg(src, dest, funcName))\n }\n return { srcStat, destStat }\n}\n\n// recursively check if dest parent is a subdirectory of src.\n// It works for all file types including symlinks since it\n// checks the src and dest inodes. It starts from the deepest\n// parent and stops once it reaches the src parent or the root path.\nfunction checkParentPaths (src, srcStat, dest, funcName, cb) {\n const srcParent = path.resolve(path.dirname(src))\n const destParent = path.resolve(path.dirname(dest))\n if (destParent === srcParent || destParent === path.parse(destParent).root) return cb()\n fs.stat(destParent, { bigint: true }, (err, destStat) => {\n if (err) {\n if (err.code === 'ENOENT') return cb()\n return cb(err)\n }\n if (areIdentical(srcStat, destStat)) {\n return cb(new Error(errMsg(src, dest, funcName)))\n }\n return checkParentPaths(src, srcStat, destParent, funcName, cb)\n })\n}\n\nfunction checkParentPathsSync (src, srcStat, dest, funcName) {\n const srcParent = path.resolve(path.dirname(src))\n const destParent = path.resolve(path.dirname(dest))\n if (destParent === srcParent || destParent === path.parse(destParent).root) return\n let destStat\n try {\n destStat = fs.statSync(destParent, { bigint: true })\n } catch (err) {\n if (err.code === 'ENOENT') return\n throw err\n }\n if (areIdentical(srcStat, destStat)) {\n throw new Error(errMsg(src, dest, funcName))\n }\n return checkParentPathsSync(src, srcStat, destParent, funcName)\n}\n\nfunction areIdentical (srcStat, destStat) {\n return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev\n}\n\n// return true if dest is a subdir of src, otherwise false.\n// It only checks the path strings.\nfunction isSrcSubdir (src, dest) {\n const srcArr = path.resolve(src).split(path.sep).filter(i => i)\n const destArr = path.resolve(dest).split(path.sep).filter(i => i)\n return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true)\n}\n\nfunction errMsg (src, dest, funcName) {\n return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`\n}\n\nmodule.exports = {\n checkPaths,\n checkPathsSync,\n checkParentPaths,\n checkParentPathsSync,\n isSrcSubdir,\n areIdentical\n}\n","'use strict'\n\nconst fs = require('graceful-fs')\n\nfunction utimesMillis (path, atime, mtime, callback) {\n // if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback)\n fs.open(path, 'r+', (err, fd) => {\n if (err) return callback(err)\n fs.futimes(fd, atime, mtime, futimesErr => {\n fs.close(fd, closeErr => {\n if (callback) callback(futimesErr || closeErr)\n })\n })\n })\n}\n\nfunction utimesMillisSync (path, atime, mtime) {\n const fd = fs.openSync(path, 'r+')\n fs.futimesSync(fd, atime, mtime)\n return fs.closeSync(fd)\n}\n\nmodule.exports = {\n utimesMillis,\n utimesMillisSync\n}\n","'use strict'\nconst MiniPass = require('minipass')\nconst EE = require('events').EventEmitter\nconst fs = require('fs')\n\nlet writev = fs.writev\n/* istanbul ignore next */\nif (!writev) {\n // This entire block can be removed if support for earlier than Node.js\n // 12.9.0 is not needed.\n const binding = process.binding('fs')\n const FSReqWrap = binding.FSReqWrap || binding.FSReqCallback\n\n writev = (fd, iovec, pos, cb) => {\n const done = (er, bw) => cb(er, bw, iovec)\n const req = new FSReqWrap()\n req.oncomplete = done\n binding.writeBuffers(fd, iovec, pos, req)\n }\n}\n\nconst _autoClose = Symbol('_autoClose')\nconst _close = Symbol('_close')\nconst _ended = Symbol('_ended')\nconst _fd = Symbol('_fd')\nconst _finished = Symbol('_finished')\nconst _flags = Symbol('_flags')\nconst _flush = Symbol('_flush')\nconst _handleChunk = Symbol('_handleChunk')\nconst _makeBuf = Symbol('_makeBuf')\nconst _mode = Symbol('_mode')\nconst _needDrain = Symbol('_needDrain')\nconst _onerror = Symbol('_onerror')\nconst _onopen = Symbol('_onopen')\nconst _onread = Symbol('_onread')\nconst _onwrite = Symbol('_onwrite')\nconst _open = Symbol('_open')\nconst _path = Symbol('_path')\nconst _pos = Symbol('_pos')\nconst _queue = Symbol('_queue')\nconst _read = Symbol('_read')\nconst _readSize = Symbol('_readSize')\nconst _reading = Symbol('_reading')\nconst _remain = Symbol('_remain')\nconst _size = Symbol('_size')\nconst _write = Symbol('_write')\nconst _writing = Symbol('_writing')\nconst _defaultFlag = Symbol('_defaultFlag')\nconst _errored = Symbol('_errored')\n\nclass ReadStream extends MiniPass {\n constructor (path, opt) {\n opt = opt || {}\n super(opt)\n\n this.readable = true\n this.writable = false\n\n if (typeof path !== 'string')\n throw new TypeError('path must be a string')\n\n this[_errored] = false\n this[_fd] = typeof opt.fd === 'number' ? opt.fd : null\n this[_path] = path\n this[_readSize] = opt.readSize || 16*1024*1024\n this[_reading] = false\n this[_size] = typeof opt.size === 'number' ? opt.size : Infinity\n this[_remain] = this[_size]\n this[_autoClose] = typeof opt.autoClose === 'boolean' ?\n opt.autoClose : true\n\n if (typeof this[_fd] === 'number')\n this[_read]()\n else\n this[_open]()\n }\n\n get fd () { return this[_fd] }\n get path () { return this[_path] }\n\n write () {\n throw new TypeError('this is a readable stream')\n }\n\n end () {\n throw new TypeError('this is a readable stream')\n }\n\n [_open] () {\n fs.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd))\n }\n\n [_onopen] (er, fd) {\n if (er)\n this[_onerror](er)\n else {\n this[_fd] = fd\n this.emit('open', fd)\n this[_read]()\n }\n }\n\n [_makeBuf] () {\n return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain]))\n }\n\n [_read] () {\n if (!this[_reading]) {\n this[_reading] = true\n const buf = this[_makeBuf]()\n /* istanbul ignore if */\n if (buf.length === 0)\n return process.nextTick(() => this[_onread](null, 0, buf))\n fs.read(this[_fd], buf, 0, buf.length, null, (er, br, buf) =>\n this[_onread](er, br, buf))\n }\n }\n\n [_onread] (er, br, buf) {\n this[_reading] = false\n if (er)\n this[_onerror](er)\n else if (this[_handleChunk](br, buf))\n this[_read]()\n }\n\n [_close] () {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = null\n fs.close(fd, er => er ? this.emit('error', er) : this.emit('close'))\n }\n }\n\n [_onerror] (er) {\n this[_reading] = true\n this[_close]()\n this.emit('error', er)\n }\n\n [_handleChunk] (br, buf) {\n let ret = false\n // no effect if infinite\n this[_remain] -= br\n if (br > 0)\n ret = super.write(br < buf.length ? buf.slice(0, br) : buf)\n\n if (br === 0 || this[_remain] <= 0) {\n ret = false\n this[_close]()\n super.end()\n }\n\n return ret\n }\n\n emit (ev, data) {\n switch (ev) {\n case 'prefinish':\n case 'finish':\n break\n\n case 'drain':\n if (typeof this[_fd] === 'number')\n this[_read]()\n break\n\n case 'error':\n if (this[_errored])\n return\n this[_errored] = true\n return super.emit(ev, data)\n\n default:\n return super.emit(ev, data)\n }\n }\n}\n\nclass ReadStreamSync extends ReadStream {\n [_open] () {\n let threw = true\n try {\n this[_onopen](null, fs.openSync(this[_path], 'r'))\n threw = false\n } finally {\n if (threw)\n this[_close]()\n }\n }\n\n [_read] () {\n let threw = true\n try {\n if (!this[_reading]) {\n this[_reading] = true\n do {\n const buf = this[_makeBuf]()\n /* istanbul ignore next */\n const br = buf.length === 0 ? 0\n : fs.readSync(this[_fd], buf, 0, buf.length, null)\n if (!this[_handleChunk](br, buf))\n break\n } while (true)\n this[_reading] = false\n }\n threw = false\n } finally {\n if (threw)\n this[_close]()\n }\n }\n\n [_close] () {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = null\n fs.closeSync(fd)\n this.emit('close')\n }\n }\n}\n\nclass WriteStream extends EE {\n constructor (path, opt) {\n opt = opt || {}\n super(opt)\n this.readable = false\n this.writable = true\n this[_errored] = false\n this[_writing] = false\n this[_ended] = false\n this[_needDrain] = false\n this[_queue] = []\n this[_path] = path\n this[_fd] = typeof opt.fd === 'number' ? opt.fd : null\n this[_mode] = opt.mode === undefined ? 0o666 : opt.mode\n this[_pos] = typeof opt.start === 'number' ? opt.start : null\n this[_autoClose] = typeof opt.autoClose === 'boolean' ?\n opt.autoClose : true\n\n // truncating makes no sense when writing into the middle\n const defaultFlag = this[_pos] !== null ? 'r+' : 'w'\n this[_defaultFlag] = opt.flags === undefined\n this[_flags] = this[_defaultFlag] ? defaultFlag : opt.flags\n\n if (this[_fd] === null)\n this[_open]()\n }\n\n emit (ev, data) {\n if (ev === 'error') {\n if (this[_errored])\n return\n this[_errored] = true\n }\n return super.emit(ev, data)\n }\n\n\n get fd () { return this[_fd] }\n get path () { return this[_path] }\n\n [_onerror] (er) {\n this[_close]()\n this[_writing] = true\n this.emit('error', er)\n }\n\n [_open] () {\n fs.open(this[_path], this[_flags], this[_mode],\n (er, fd) => this[_onopen](er, fd))\n }\n\n [_onopen] (er, fd) {\n if (this[_defaultFlag] &&\n this[_flags] === 'r+' &&\n er && er.code === 'ENOENT') {\n this[_flags] = 'w'\n this[_open]()\n } else if (er)\n this[_onerror](er)\n else {\n this[_fd] = fd\n this.emit('open', fd)\n this[_flush]()\n }\n }\n\n end (buf, enc) {\n if (buf)\n this.write(buf, enc)\n\n this[_ended] = true\n\n // synthetic after-write logic, where drain/finish live\n if (!this[_writing] && !this[_queue].length &&\n typeof this[_fd] === 'number')\n this[_onwrite](null, 0)\n return this\n }\n\n write (buf, enc) {\n if (typeof buf === 'string')\n buf = Buffer.from(buf, enc)\n\n if (this[_ended]) {\n this.emit('error', new Error('write() after end()'))\n return false\n }\n\n if (this[_fd] === null || this[_writing] || this[_queue].length) {\n this[_queue].push(buf)\n this[_needDrain] = true\n return false\n }\n\n this[_writing] = true\n this[_write](buf)\n return true\n }\n\n [_write] (buf) {\n fs.write(this[_fd], buf, 0, buf.length, this[_pos], (er, bw) =>\n this[_onwrite](er, bw))\n }\n\n [_onwrite] (er, bw) {\n if (er)\n this[_onerror](er)\n else {\n if (this[_pos] !== null)\n this[_pos] += bw\n if (this[_queue].length)\n this[_flush]()\n else {\n this[_writing] = false\n\n if (this[_ended] && !this[_finished]) {\n this[_finished] = true\n this[_close]()\n this.emit('finish')\n } else if (this[_needDrain]) {\n this[_needDrain] = false\n this.emit('drain')\n }\n }\n }\n }\n\n [_flush] () {\n if (this[_queue].length === 0) {\n if (this[_ended])\n this[_onwrite](null, 0)\n } else if (this[_queue].length === 1)\n this[_write](this[_queue].pop())\n else {\n const iovec = this[_queue]\n this[_queue] = []\n writev(this[_fd], iovec, this[_pos],\n (er, bw) => this[_onwrite](er, bw))\n }\n }\n\n [_close] () {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = null\n fs.close(fd, er => er ? this.emit('error', er) : this.emit('close'))\n }\n }\n}\n\nclass WriteStreamSync extends WriteStream {\n [_open] () {\n let fd\n // only wrap in a try{} block if we know we'll retry, to avoid\n // the rethrow obscuring the error's source frame in most cases.\n if (this[_defaultFlag] && this[_flags] === 'r+') {\n try {\n fd = fs.openSync(this[_path], this[_flags], this[_mode])\n } catch (er) {\n if (er.code === 'ENOENT') {\n this[_flags] = 'w'\n return this[_open]()\n } else\n throw er\n }\n } else\n fd = fs.openSync(this[_path], this[_flags], this[_mode])\n\n this[_onopen](null, fd)\n }\n\n [_close] () {\n if (this[_autoClose] && typeof this[_fd] === 'number') {\n const fd = this[_fd]\n this[_fd] = null\n fs.closeSync(fd)\n this.emit('close')\n }\n }\n\n [_write] (buf) {\n // throw the original, but try to close if it fails\n let threw = true\n try {\n this[_onwrite](null,\n fs.writeSync(this[_fd], buf, 0, buf.length, this[_pos]))\n threw = false\n } finally {\n if (threw)\n try { this[_close]() } catch (_) {}\n }\n }\n}\n\nexports.ReadStream = ReadStream\nexports.ReadStreamSync = ReadStreamSync\n\nexports.WriteStream = WriteStream\nexports.WriteStreamSync = WriteStreamSync\n","'use strict'\n\nmodule.exports = clone\n\nvar getPrototypeOf = Object.getPrototypeOf || function (obj) {\n return obj.__proto__\n}\n\nfunction clone (obj) {\n if (obj === null || typeof obj !== 'object')\n return obj\n\n if (obj instanceof Object)\n var copy = { __proto__: getPrototypeOf(obj) }\n else\n var copy = Object.create(null)\n\n Object.getOwnPropertyNames(obj).forEach(function (key) {\n Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key))\n })\n\n return copy\n}\n","var fs = require('fs')\nvar polyfills = require('./polyfills.js')\nvar legacy = require('./legacy-streams.js')\nvar clone = require('./clone.js')\n\nvar util = require('util')\n\n/* istanbul ignore next - node 0.x polyfill */\nvar gracefulQueue\nvar previousSymbol\n\n/* istanbul ignore else - node 0.x polyfill */\nif (typeof Symbol === 'function' && typeof Symbol.for === 'function') {\n gracefulQueue = Symbol.for('graceful-fs.queue')\n // This is used in testing by future versions\n previousSymbol = Symbol.for('graceful-fs.previous')\n} else {\n gracefulQueue = '___graceful-fs.queue'\n previousSymbol = '___graceful-fs.previous'\n}\n\nfunction noop () {}\n\nfunction publishQueue(context, queue) {\n Object.defineProperty(context, gracefulQueue, {\n get: function() {\n return queue\n }\n })\n}\n\nvar debug = noop\nif (util.debuglog)\n debug = util.debuglog('gfs4')\nelse if (/\\bgfs4\\b/i.test(process.env.NODE_DEBUG || ''))\n debug = function() {\n var m = util.format.apply(util, arguments)\n m = 'GFS4: ' + m.split(/\\n/).join('\\nGFS4: ')\n console.error(m)\n }\n\n// Once time initialization\nif (!fs[gracefulQueue]) {\n // This queue can be shared by multiple loaded instances\n var queue = global[gracefulQueue] || []\n publishQueue(fs, queue)\n\n // Patch fs.close/closeSync to shared queue version, because we need\n // to retry() whenever a close happens *anywhere* in the program.\n // This is essential when multiple graceful-fs instances are\n // in play at the same time.\n fs.close = (function (fs$close) {\n function close (fd, cb) {\n return fs$close.call(fs, fd, function (err) {\n // This function uses the graceful-fs shared queue\n if (!err) {\n resetQueue()\n }\n\n if (typeof cb === 'function')\n cb.apply(this, arguments)\n })\n }\n\n Object.defineProperty(close, previousSymbol, {\n value: fs$close\n })\n return close\n })(fs.close)\n\n fs.closeSync = (function (fs$closeSync) {\n function closeSync (fd) {\n // This function uses the graceful-fs shared queue\n fs$closeSync.apply(fs, arguments)\n resetQueue()\n }\n\n Object.defineProperty(closeSync, previousSymbol, {\n value: fs$closeSync\n })\n return closeSync\n })(fs.closeSync)\n\n if (/\\bgfs4\\b/i.test(process.env.NODE_DEBUG || '')) {\n process.on('exit', function() {\n debug(fs[gracefulQueue])\n require('assert').equal(fs[gracefulQueue].length, 0)\n })\n }\n}\n\nif (!global[gracefulQueue]) {\n publishQueue(global, fs[gracefulQueue]);\n}\n\nmodule.exports = patch(clone(fs))\nif (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) {\n module.exports = patch(fs)\n fs.__patched = true;\n}\n\nfunction patch (fs) {\n // Everything that references the open() function needs to be in here\n polyfills(fs)\n fs.gracefulify = patch\n\n fs.createReadStream = createReadStream\n fs.createWriteStream = createWriteStream\n var fs$readFile = fs.readFile\n fs.readFile = readFile\n function readFile (path, options, cb) {\n if (typeof options === 'function')\n cb = options, options = null\n\n return go$readFile(path, options, cb)\n\n function go$readFile (path, options, cb, startTime) {\n return fs$readFile(path, options, function (err) {\n if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))\n enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()])\n else {\n if (typeof cb === 'function')\n cb.apply(this, arguments)\n }\n })\n }\n }\n\n var fs$writeFile = fs.writeFile\n fs.writeFile = writeFile\n function writeFile (path, data, options, cb) {\n if (typeof options === 'function')\n cb = options, options = null\n\n return go$writeFile(path, data, options, cb)\n\n function go$writeFile (path, data, options, cb, startTime) {\n return fs$writeFile(path, data, options, function (err) {\n if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))\n enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()])\n else {\n if (typeof cb === 'function')\n cb.apply(this, arguments)\n }\n })\n }\n }\n\n var fs$appendFile = fs.appendFile\n if (fs$appendFile)\n fs.appendFile = appendFile\n function appendFile (path, data, options, cb) {\n if (typeof options === 'function')\n cb = options, options = null\n\n return go$appendFile(path, data, options, cb)\n\n function go$appendFile (path, data, options, cb, startTime) {\n return fs$appendFile(path, data, options, function (err) {\n if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))\n enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()])\n else {\n if (typeof cb === 'function')\n cb.apply(this, arguments)\n }\n })\n }\n }\n\n var fs$copyFile = fs.copyFile\n if (fs$copyFile)\n fs.copyFile = copyFile\n function copyFile (src, dest, flags, cb) {\n if (typeof flags === 'function') {\n cb = flags\n flags = 0\n }\n return go$copyFile(src, dest, flags, cb)\n\n function go$copyFile (src, dest, flags, cb, startTime) {\n return fs$copyFile(src, dest, flags, function (err) {\n if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))\n enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()])\n else {\n if (typeof cb === 'function')\n cb.apply(this, arguments)\n }\n })\n }\n }\n\n var fs$readdir = fs.readdir\n fs.readdir = readdir\n var noReaddirOptionVersions = /^v[0-5]\\./\n function readdir (path, options, cb) {\n if (typeof options === 'function')\n cb = options, options = null\n\n var go$readdir = noReaddirOptionVersions.test(process.version)\n ? function go$readdir (path, options, cb, startTime) {\n return fs$readdir(path, fs$readdirCallback(\n path, options, cb, startTime\n ))\n }\n : function go$readdir (path, options, cb, startTime) {\n return fs$readdir(path, options, fs$readdirCallback(\n path, options, cb, startTime\n ))\n }\n\n return go$readdir(path, options, cb)\n\n function fs$readdirCallback (path, options, cb, startTime) {\n return function (err, files) {\n if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))\n enqueue([\n go$readdir,\n [path, options, cb],\n err,\n startTime || Date.now(),\n Date.now()\n ])\n else {\n if (files && files.sort)\n files.sort()\n\n if (typeof cb === 'function')\n cb.call(this, err, files)\n }\n }\n }\n }\n\n if (process.version.substr(0, 4) === 'v0.8') {\n var legStreams = legacy(fs)\n ReadStream = legStreams.ReadStream\n WriteStream = legStreams.WriteStream\n }\n\n var fs$ReadStream = fs.ReadStream\n if (fs$ReadStream) {\n ReadStream.prototype = Object.create(fs$ReadStream.prototype)\n ReadStream.prototype.open = ReadStream$open\n }\n\n var fs$WriteStream = fs.WriteStream\n if (fs$WriteStream) {\n WriteStream.prototype = Object.create(fs$WriteStream.prototype)\n WriteStream.prototype.open = WriteStream$open\n }\n\n Object.defineProperty(fs, 'ReadStream', {\n get: function () {\n return ReadStream\n },\n set: function (val) {\n ReadStream = val\n },\n enumerable: true,\n configurable: true\n })\n Object.defineProperty(fs, 'WriteStream', {\n get: function () {\n return WriteStream\n },\n set: function (val) {\n WriteStream = val\n },\n enumerable: true,\n configurable: true\n })\n\n // legacy names\n var FileReadStream = ReadStream\n Object.defineProperty(fs, 'FileReadStream', {\n get: function () {\n return FileReadStream\n },\n set: function (val) {\n FileReadStream = val\n },\n enumerable: true,\n configurable: true\n })\n var FileWriteStream = WriteStream\n Object.defineProperty(fs, 'FileWriteStream', {\n get: function () {\n return FileWriteStream\n },\n set: function (val) {\n FileWriteStream = val\n },\n enumerable: true,\n configurable: true\n })\n\n function ReadStream (path, options) {\n if (this instanceof ReadStream)\n return fs$ReadStream.apply(this, arguments), this\n else\n return ReadStream.apply(Object.create(ReadStream.prototype), arguments)\n }\n\n function ReadStream$open () {\n var that = this\n open(that.path, that.flags, that.mode, function (err, fd) {\n if (err) {\n if (that.autoClose)\n that.destroy()\n\n that.emit('error', err)\n } else {\n that.fd = fd\n that.emit('open', fd)\n that.read()\n }\n })\n }\n\n function WriteStream (path, options) {\n if (this instanceof WriteStream)\n return fs$WriteStream.apply(this, arguments), this\n else\n return WriteStream.apply(Object.create(WriteStream.prototype), arguments)\n }\n\n function WriteStream$open () {\n var that = this\n open(that.path, that.flags, that.mode, function (err, fd) {\n if (err) {\n that.destroy()\n that.emit('error', err)\n } else {\n that.fd = fd\n that.emit('open', fd)\n }\n })\n }\n\n function createReadStream (path, options) {\n return new fs.ReadStream(path, options)\n }\n\n function createWriteStream (path, options) {\n return new fs.WriteStream(path, options)\n }\n\n var fs$open = fs.open\n fs.open = open\n function open (path, flags, mode, cb) {\n if (typeof mode === 'function')\n cb = mode, mode = null\n\n return go$open(path, flags, mode, cb)\n\n function go$open (path, flags, mode, cb, startTime) {\n return fs$open(path, flags, mode, function (err, fd) {\n if (err && (err.code === 'EMFILE' || err.code === 'ENFILE'))\n enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()])\n else {\n if (typeof cb === 'function')\n cb.apply(this, arguments)\n }\n })\n }\n }\n\n return fs\n}\n\nfunction enqueue (elem) {\n debug('ENQUEUE', elem[0].name, elem[1])\n fs[gracefulQueue].push(elem)\n retry()\n}\n\n// keep track of the timeout between retry() calls\nvar retryTimer\n\n// reset the startTime and lastTime to now\n// this resets the start of the 60 second overall timeout as well as the\n// delay between attempts so that we'll retry these jobs sooner\nfunction resetQueue () {\n var now = Date.now()\n for (var i = 0; i < fs[gracefulQueue].length; ++i) {\n // entries that are only a length of 2 are from an older version, don't\n // bother modifying those since they'll be retried anyway.\n if (fs[gracefulQueue][i].length > 2) {\n fs[gracefulQueue][i][3] = now // startTime\n fs[gracefulQueue][i][4] = now // lastTime\n }\n }\n // call retry to make sure we're actively processing the queue\n retry()\n}\n\nfunction retry () {\n // clear the timer and remove it to help prevent unintended concurrency\n clearTimeout(retryTimer)\n retryTimer = undefined\n\n if (fs[gracefulQueue].length === 0)\n return\n\n var elem = fs[gracefulQueue].shift()\n var fn = elem[0]\n var args = elem[1]\n // these items may be unset if they were added by an older graceful-fs\n var err = elem[2]\n var startTime = elem[3]\n var lastTime = elem[4]\n\n // if we don't have a startTime we have no way of knowing if we've waited\n // long enough, so go ahead and retry this item now\n if (startTime === undefined) {\n debug('RETRY', fn.name, args)\n fn.apply(null, args)\n } else if (Date.now() - startTime >= 60000) {\n // it's been more than 60 seconds total, bail now\n debug('TIMEOUT', fn.name, args)\n var cb = args.pop()\n if (typeof cb === 'function')\n cb.call(null, err)\n } else {\n // the amount of time between the last attempt and right now\n var sinceAttempt = Date.now() - lastTime\n // the amount of time between when we first tried, and when we last tried\n // rounded up to at least 1\n var sinceStart = Math.max(lastTime - startTime, 1)\n // backoff. wait longer than the total time we've been retrying, but only\n // up to a maximum of 100ms\n var desiredDelay = Math.min(sinceStart * 1.2, 100)\n // it's been long enough since the last retry, do it again\n if (sinceAttempt >= desiredDelay) {\n debug('RETRY', fn.name, args)\n fn.apply(null, args.concat([startTime]))\n } else {\n // if we can't do this job yet, push it to the end of the queue\n // and let the next iteration check again\n fs[gracefulQueue].push(elem)\n }\n }\n\n // schedule our next run if one isn't already scheduled\n if (retryTimer === undefined) {\n retryTimer = setTimeout(retry, 0)\n }\n}\n","var Stream = require('stream').Stream\n\nmodule.exports = legacy\n\nfunction legacy (fs) {\n return {\n ReadStream: ReadStream,\n WriteStream: WriteStream\n }\n\n function ReadStream (path, options) {\n if (!(this instanceof ReadStream)) return new ReadStream(path, options);\n\n Stream.call(this);\n\n var self = this;\n\n this.path = path;\n this.fd = null;\n this.readable = true;\n this.paused = false;\n\n this.flags = 'r';\n this.mode = 438; /*=0666*/\n this.bufferSize = 64 * 1024;\n\n options = options || {};\n\n // Mixin options into this\n var keys = Object.keys(options);\n for (var index = 0, length = keys.length; index < length; index++) {\n var key = keys[index];\n this[key] = options[key];\n }\n\n if (this.encoding) this.setEncoding(this.encoding);\n\n if (this.start !== undefined) {\n if ('number' !== typeof this.start) {\n throw TypeError('start must be a Number');\n }\n if (this.end === undefined) {\n this.end = Infinity;\n } else if ('number' !== typeof this.end) {\n throw TypeError('end must be a Number');\n }\n\n if (this.start > this.end) {\n throw new Error('start must be <= end');\n }\n\n this.pos = this.start;\n }\n\n if (this.fd !== null) {\n process.nextTick(function() {\n self._read();\n });\n return;\n }\n\n fs.open(this.path, this.flags, this.mode, function (err, fd) {\n if (err) {\n self.emit('error', err);\n self.readable = false;\n return;\n }\n\n self.fd = fd;\n self.emit('open', fd);\n self._read();\n })\n }\n\n function WriteStream (path, options) {\n if (!(this instanceof WriteStream)) return new WriteStream(path, options);\n\n Stream.call(this);\n\n this.path = path;\n this.fd = null;\n this.writable = true;\n\n this.flags = 'w';\n this.encoding = 'binary';\n this.mode = 438; /*=0666*/\n this.bytesWritten = 0;\n\n options = options || {};\n\n // Mixin options into this\n var keys = Object.keys(options);\n for (var index = 0, length = keys.length; index < length; index++) {\n var key = keys[index];\n this[key] = options[key];\n }\n\n if (this.start !== undefined) {\n if ('number' !== typeof this.start) {\n throw TypeError('start must be a Number');\n }\n if (this.start < 0) {\n throw new Error('start must be >= zero');\n }\n\n this.pos = this.start;\n }\n\n this.busy = false;\n this._queue = [];\n\n if (this.fd === null) {\n this._open = fs.open;\n this._queue.push([this._open, this.path, this.flags, this.mode, undefined]);\n this.flush();\n }\n }\n}\n","var constants = require('constants')\n\nvar origCwd = process.cwd\nvar cwd = null\n\nvar platform = process.env.GRACEFUL_FS_PLATFORM || process.platform\n\nprocess.cwd = function() {\n if (!cwd)\n cwd = origCwd.call(process)\n return cwd\n}\ntry {\n process.cwd()\n} catch (er) {}\n\n// This check is needed until node.js 12 is required\nif (typeof process.chdir === 'function') {\n var chdir = process.chdir\n process.chdir = function (d) {\n cwd = null\n chdir.call(process, d)\n }\n if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir)\n}\n\nmodule.exports = patch\n\nfunction patch (fs) {\n // (re-)implement some things that are known busted or missing.\n\n // lchmod, broken prior to 0.6.2\n // back-port the fix here.\n if (constants.hasOwnProperty('O_SYMLINK') &&\n process.version.match(/^v0\\.6\\.[0-2]|^v0\\.5\\./)) {\n patchLchmod(fs)\n }\n\n // lutimes implementation, or no-op\n if (!fs.lutimes) {\n patchLutimes(fs)\n }\n\n // https://github.com/isaacs/node-graceful-fs/issues/4\n // Chown should not fail on einval or eperm if non-root.\n // It should not fail on enosys ever, as this just indicates\n // that a fs doesn't support the intended operation.\n\n fs.chown = chownFix(fs.chown)\n fs.fchown = chownFix(fs.fchown)\n fs.lchown = chownFix(fs.lchown)\n\n fs.chmod = chmodFix(fs.chmod)\n fs.fchmod = chmodFix(fs.fchmod)\n fs.lchmod = chmodFix(fs.lchmod)\n\n fs.chownSync = chownFixSync(fs.chownSync)\n fs.fchownSync = chownFixSync(fs.fchownSync)\n fs.lchownSync = chownFixSync(fs.lchownSync)\n\n fs.chmodSync = chmodFixSync(fs.chmodSync)\n fs.fchmodSync = chmodFixSync(fs.fchmodSync)\n fs.lchmodSync = chmodFixSync(fs.lchmodSync)\n\n fs.stat = statFix(fs.stat)\n fs.fstat = statFix(fs.fstat)\n fs.lstat = statFix(fs.lstat)\n\n fs.statSync = statFixSync(fs.statSync)\n fs.fstatSync = statFixSync(fs.fstatSync)\n fs.lstatSync = statFixSync(fs.lstatSync)\n\n // if lchmod/lchown do not exist, then make them no-ops\n if (fs.chmod && !fs.lchmod) {\n fs.lchmod = function (path, mode, cb) {\n if (cb) process.nextTick(cb)\n }\n fs.lchmodSync = function () {}\n }\n if (fs.chown && !fs.lchown) {\n fs.lchown = function (path, uid, gid, cb) {\n if (cb) process.nextTick(cb)\n }\n fs.lchownSync = function () {}\n }\n\n // on Windows, A/V software can lock the directory, causing this\n // to fail with an EACCES or EPERM if the directory contains newly\n // created files. Try again on failure, for up to 60 seconds.\n\n // Set the timeout this long because some Windows Anti-Virus, such as Parity\n // bit9, may lock files for up to a minute, causing npm package install\n // failures. Also, take care to yield the scheduler. Windows scheduling gives\n // CPU to a busy looping process, which can cause the program causing the lock\n // contention to be starved of CPU by node, so the contention doesn't resolve.\n if (platform === \"win32\") {\n fs.rename = typeof fs.rename !== 'function' ? fs.rename\n : (function (fs$rename) {\n function rename (from, to, cb) {\n var start = Date.now()\n var backoff = 0;\n fs$rename(from, to, function CB (er) {\n if (er\n && (er.code === \"EACCES\" || er.code === \"EPERM\" || er.code === \"EBUSY\")\n && Date.now() - start < 60000) {\n setTimeout(function() {\n fs.stat(to, function (stater, st) {\n if (stater && stater.code === \"ENOENT\")\n fs$rename(from, to, CB);\n else\n cb(er)\n })\n }, backoff)\n if (backoff < 100)\n backoff += 10;\n return;\n }\n if (cb) cb(er)\n })\n }\n if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename)\n return rename\n })(fs.rename)\n }\n\n // if read() returns EAGAIN, then just try it again.\n fs.read = typeof fs.read !== 'function' ? fs.read\n : (function (fs$read) {\n function read (fd, buffer, offset, length, position, callback_) {\n var callback\n if (callback_ && typeof callback_ === 'function') {\n var eagCounter = 0\n callback = function (er, _, __) {\n if (er && er.code === 'EAGAIN' && eagCounter < 10) {\n eagCounter ++\n return fs$read.call(fs, fd, buffer, offset, length, position, callback)\n }\n callback_.apply(this, arguments)\n }\n }\n return fs$read.call(fs, fd, buffer, offset, length, position, callback)\n }\n\n // This ensures `util.promisify` works as it does for native `fs.read`.\n if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read)\n return read\n })(fs.read)\n\n fs.readSync = typeof fs.readSync !== 'function' ? fs.readSync\n : (function (fs$readSync) { return function (fd, buffer, offset, length, position) {\n var eagCounter = 0\n while (true) {\n try {\n return fs$readSync.call(fs, fd, buffer, offset, length, position)\n } catch (er) {\n if (er.code === 'EAGAIN' && eagCounter < 10) {\n eagCounter ++\n continue\n }\n throw er\n }\n }\n }})(fs.readSync)\n\n function patchLchmod (fs) {\n fs.lchmod = function (path, mode, callback) {\n fs.open( path\n , constants.O_WRONLY | constants.O_SYMLINK\n , mode\n , function (err, fd) {\n if (err) {\n if (callback) callback(err)\n return\n }\n // prefer to return the chmod error, if one occurs,\n // but still try to close, and report closing errors if they occur.\n fs.fchmod(fd, mode, function (err) {\n fs.close(fd, function(err2) {\n if (callback) callback(err || err2)\n })\n })\n })\n }\n\n fs.lchmodSync = function (path, mode) {\n var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode)\n\n // prefer to return the chmod error, if one occurs,\n // but still try to close, and report closing errors if they occur.\n var threw = true\n var ret\n try {\n ret = fs.fchmodSync(fd, mode)\n threw = false\n } finally {\n if (threw) {\n try {\n fs.closeSync(fd)\n } catch (er) {}\n } else {\n fs.closeSync(fd)\n }\n }\n return ret\n }\n }\n\n function patchLutimes (fs) {\n if (constants.hasOwnProperty(\"O_SYMLINK\") && fs.futimes) {\n fs.lutimes = function (path, at, mt, cb) {\n fs.open(path, constants.O_SYMLINK, function (er, fd) {\n if (er) {\n if (cb) cb(er)\n return\n }\n fs.futimes(fd, at, mt, function (er) {\n fs.close(fd, function (er2) {\n if (cb) cb(er || er2)\n })\n })\n })\n }\n\n fs.lutimesSync = function (path, at, mt) {\n var fd = fs.openSync(path, constants.O_SYMLINK)\n var ret\n var threw = true\n try {\n ret = fs.futimesSync(fd, at, mt)\n threw = false\n } finally {\n if (threw) {\n try {\n fs.closeSync(fd)\n } catch (er) {}\n } else {\n fs.closeSync(fd)\n }\n }\n return ret\n }\n\n } else if (fs.futimes) {\n fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) }\n fs.lutimesSync = function () {}\n }\n }\n\n function chmodFix (orig) {\n if (!orig) return orig\n return function (target, mode, cb) {\n return orig.call(fs, target, mode, function (er) {\n if (chownErOk(er)) er = null\n if (cb) cb.apply(this, arguments)\n })\n }\n }\n\n function chmodFixSync (orig) {\n if (!orig) return orig\n return function (target, mode) {\n try {\n return orig.call(fs, target, mode)\n } catch (er) {\n if (!chownErOk(er)) throw er\n }\n }\n }\n\n\n function chownFix (orig) {\n if (!orig) return orig\n return function (target, uid, gid, cb) {\n return orig.call(fs, target, uid, gid, function (er) {\n if (chownErOk(er)) er = null\n if (cb) cb.apply(this, arguments)\n })\n }\n }\n\n function chownFixSync (orig) {\n if (!orig) return orig\n return function (target, uid, gid) {\n try {\n return orig.call(fs, target, uid, gid)\n } catch (er) {\n if (!chownErOk(er)) throw er\n }\n }\n }\n\n function statFix (orig) {\n if (!orig) return orig\n // Older versions of Node erroneously returned signed integers for\n // uid + gid.\n return function (target, options, cb) {\n if (typeof options === 'function') {\n cb = options\n options = null\n }\n function callback (er, stats) {\n if (stats) {\n if (stats.uid < 0) stats.uid += 0x100000000\n if (stats.gid < 0) stats.gid += 0x100000000\n }\n if (cb) cb.apply(this, arguments)\n }\n return options ? orig.call(fs, target, options, callback)\n : orig.call(fs, target, callback)\n }\n }\n\n function statFixSync (orig) {\n if (!orig) return orig\n // Older versions of Node erroneously returned signed integers for\n // uid + gid.\n return function (target, options) {\n var stats = options ? orig.call(fs, target, options)\n : orig.call(fs, target)\n if (stats) {\n if (stats.uid < 0) stats.uid += 0x100000000\n if (stats.gid < 0) stats.gid += 0x100000000\n }\n return stats;\n }\n }\n\n // ENOSYS means that the fs doesn't support the op. Just ignore\n // that, because it doesn't matter.\n //\n // if there's no getuid, or if getuid() is something other\n // than 0, and the error is EINVAL or EPERM, then just ignore\n // it.\n //\n // This specific case is a silent failure in cp, install, tar,\n // and most other unix tools that manage permissions.\n //\n // When running as root, or if other types of errors are\n // encountered, then it's strict.\n function chownErOk (er) {\n if (!er)\n return true\n\n if (er.code === \"ENOSYS\")\n return true\n\n var nonroot = !process.getuid || process.getuid() !== 0\n if (nonroot) {\n if (er.code === \"EINVAL\" || er.code === \"EPERM\")\n return true\n }\n\n return false\n }\n}\n","let _fs\ntry {\n _fs = require('graceful-fs')\n} catch (_) {\n _fs = require('fs')\n}\nconst universalify = require('universalify')\nconst { stringify, stripBom } = require('./utils')\n\nasync function _readFile (file, options = {}) {\n if (typeof options === 'string') {\n options = { encoding: options }\n }\n\n const fs = options.fs || _fs\n\n const shouldThrow = 'throws' in options ? options.throws : true\n\n let data = await universalify.fromCallback(fs.readFile)(file, options)\n\n data = stripBom(data)\n\n let obj\n try {\n obj = JSON.parse(data, options ? options.reviver : null)\n } catch (err) {\n if (shouldThrow) {\n err.message = `${file}: ${err.message}`\n throw err\n } else {\n return null\n }\n }\n\n return obj\n}\n\nconst readFile = universalify.fromPromise(_readFile)\n\nfunction readFileSync (file, options = {}) {\n if (typeof options === 'string') {\n options = { encoding: options }\n }\n\n const fs = options.fs || _fs\n\n const shouldThrow = 'throws' in options ? options.throws : true\n\n try {\n let content = fs.readFileSync(file, options)\n content = stripBom(content)\n return JSON.parse(content, options.reviver)\n } catch (err) {\n if (shouldThrow) {\n err.message = `${file}: ${err.message}`\n throw err\n } else {\n return null\n }\n }\n}\n\nasync function _writeFile (file, obj, options = {}) {\n const fs = options.fs || _fs\n\n const str = stringify(obj, options)\n\n await universalify.fromCallback(fs.writeFile)(file, str, options)\n}\n\nconst writeFile = universalify.fromPromise(_writeFile)\n\nfunction writeFileSync (file, obj, options = {}) {\n const fs = options.fs || _fs\n\n const str = stringify(obj, options)\n // not sure if fs.writeFileSync returns anything, but just in case\n return fs.writeFileSync(file, str, options)\n}\n\nconst jsonfile = {\n readFile,\n readFileSync,\n writeFile,\n writeFileSync\n}\n\nmodule.exports = jsonfile\n","function stringify (obj, { EOL = '\\n', finalEOL = true, replacer = null, spaces } = {}) {\n const EOF = finalEOL ? EOL : ''\n const str = JSON.stringify(obj, replacer, spaces)\n\n return str.replace(/\\n/g, EOL) + EOF\n}\n\nfunction stripBom (content) {\n // we do this because JSON.parse would convert it to a utf8 string if encoding wasn't specified\n if (Buffer.isBuffer(content)) content = content.toString('utf8')\n return content.replace(/^\\uFEFF/, '')\n}\n\nmodule.exports = { stringify, stripBom }\n","var fs = require('fs')\n\nvar wx = 'wx'\nif (process.version.match(/^v0\\.[0-6]/)) {\n var c = require('constants')\n wx = c.O_TRUNC | c.O_CREAT | c.O_WRONLY | c.O_EXCL\n}\n\nvar os = require('os')\nexports.filetime = 'ctime'\nif (os.platform() == \"win32\") {\n exports.filetime = 'mtime'\n}\n\nvar debug\nvar util = require('util')\nif (util.debuglog)\n debug = util.debuglog('LOCKFILE')\nelse if (/\\blockfile\\b/i.test(process.env.NODE_DEBUG))\n debug = function() {\n var msg = util.format.apply(util, arguments)\n console.error('LOCKFILE %d %s', process.pid, msg)\n }\nelse\n debug = function() {}\n\nvar locks = {}\n\nfunction hasOwnProperty (obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop)\n}\n\nvar onExit = require('signal-exit')\nonExit(function () {\n debug('exit listener')\n // cleanup\n Object.keys(locks).forEach(exports.unlockSync)\n})\n\n// XXX https://github.com/joyent/node/issues/3555\n// Remove when node 0.8 is deprecated.\nif (/^v0\\.[0-8]\\./.test(process.version)) {\n debug('uncaughtException, version = %s', process.version)\n process.on('uncaughtException', function H (er) {\n debug('uncaughtException')\n var l = process.listeners('uncaughtException').filter(function (h) {\n return h !== H\n })\n if (!l.length) {\n // cleanup\n try { Object.keys(locks).forEach(exports.unlockSync) } catch (e) {}\n process.removeListener('uncaughtException', H)\n throw er\n }\n })\n}\n\nexports.unlock = function (path, cb) {\n debug('unlock', path)\n // best-effort. unlocking an already-unlocked lock is a noop\n delete locks[path]\n fs.unlink(path, function (unlinkEr) { cb && cb() })\n}\n\nexports.unlockSync = function (path) {\n debug('unlockSync', path)\n // best-effort. unlocking an already-unlocked lock is a noop\n try { fs.unlinkSync(path) } catch (er) {}\n delete locks[path]\n}\n\n\n// if the file can be opened in readonly mode, then it's there.\n// if the error is something other than ENOENT, then it's not.\nexports.check = function (path, opts, cb) {\n if (typeof opts === 'function') cb = opts, opts = {}\n debug('check', path, opts)\n fs.open(path, 'r', function (er, fd) {\n if (er) {\n if (er.code !== 'ENOENT') return cb(er)\n return cb(null, false)\n }\n\n if (!opts.stale) {\n return fs.close(fd, function (er) {\n return cb(er, true)\n })\n }\n\n fs.fstat(fd, function (er, st) {\n if (er) return fs.close(fd, function (er2) {\n return cb(er)\n })\n\n fs.close(fd, function (er) {\n var age = Date.now() - st[exports.filetime].getTime()\n return cb(er, age <= opts.stale)\n })\n })\n })\n}\n\nexports.checkSync = function (path, opts) {\n opts = opts || {}\n debug('checkSync', path, opts)\n if (opts.wait) {\n throw new Error('opts.wait not supported sync for obvious reasons')\n }\n\n try {\n var fd = fs.openSync(path, 'r')\n } catch (er) {\n if (er.code !== 'ENOENT') throw er\n return false\n }\n\n if (!opts.stale) {\n try { fs.closeSync(fd) } catch (er) {}\n return true\n }\n\n // file exists. however, might be stale\n if (opts.stale) {\n try {\n var st = fs.fstatSync(fd)\n } finally {\n fs.closeSync(fd)\n }\n var age = Date.now() - st[exports.filetime].getTime()\n return (age <= opts.stale)\n }\n}\n\n\n\nvar req = 1\nexports.lock = function (path, opts, cb) {\n if (typeof opts === 'function') cb = opts, opts = {}\n opts.req = opts.req || req++\n debug('lock', path, opts)\n opts.start = opts.start || Date.now()\n\n if (typeof opts.retries === 'number' && opts.retries > 0) {\n debug('has retries', opts.retries)\n var retries = opts.retries\n opts.retries = 0\n cb = (function (orig) { return function cb (er, fd) {\n debug('retry-mutated callback')\n retries -= 1\n if (!er || retries < 0) return orig(er, fd)\n\n debug('lock retry', path, opts)\n\n if (opts.retryWait) setTimeout(retry, opts.retryWait)\n else retry()\n\n function retry () {\n opts.start = Date.now()\n debug('retrying', opts.start)\n exports.lock(path, opts, cb)\n }\n }})(cb)\n }\n\n // try to engage the lock.\n // if this succeeds, then we're in business.\n fs.open(path, wx, function (er, fd) {\n if (!er) {\n debug('locked', path, fd)\n locks[path] = fd\n return fs.close(fd, function () {\n return cb()\n })\n }\n\n debug('failed to acquire lock', er)\n\n // something other than \"currently locked\"\n // maybe eperm or something.\n if (er.code !== 'EEXIST') {\n debug('not EEXIST error', er)\n return cb(er)\n }\n\n // someone's got this one. see if it's valid.\n if (!opts.stale) return notStale(er, path, opts, cb)\n\n return maybeStale(er, path, opts, false, cb)\n })\n debug('lock return')\n}\n\n\n// Staleness checking algorithm\n// 1. acquire $lock, fail\n// 2. stat $lock, find that it is stale\n// 3. acquire $lock.STALE\n// 4. stat $lock, assert that it is still stale\n// 5. unlink $lock\n// 6. link $lock.STALE $lock\n// 7. unlink $lock.STALE\n// On any failure, clean up whatever we've done, and raise the error.\nfunction maybeStale (originalEr, path, opts, hasStaleLock, cb) {\n fs.stat(path, function (statEr, st) {\n if (statEr) {\n if (statEr.code === 'ENOENT') {\n // expired already!\n opts.stale = false\n debug('lock stale enoent retry', path, opts)\n exports.lock(path, opts, cb)\n return\n }\n return cb(statEr)\n }\n\n var age = Date.now() - st[exports.filetime].getTime()\n if (age <= opts.stale) return notStale(originalEr, path, opts, cb)\n\n debug('lock stale', path, opts)\n if (hasStaleLock) {\n exports.unlock(path, function (er) {\n if (er) return cb(er)\n debug('lock stale retry', path, opts)\n fs.link(path + '.STALE', path, function (er) {\n fs.unlink(path + '.STALE', function () {\n // best effort. if the unlink fails, oh well.\n cb(er)\n })\n })\n })\n } else {\n debug('acquire .STALE file lock', opts)\n exports.lock(path + '.STALE', opts, function (er) {\n if (er) return cb(er)\n maybeStale(originalEr, path, opts, true, cb)\n })\n }\n })\n}\n\nfunction notStale (er, path, opts, cb) {\n debug('notStale', path, opts)\n\n // if we can't wait, then just call it a failure\n if (typeof opts.wait !== 'number' || opts.wait <= 0) {\n debug('notStale, wait is not a number')\n return cb(er)\n }\n\n // poll for some ms for the lock to clear\n var now = Date.now()\n var start = opts.start || now\n var end = start + opts.wait\n\n if (end <= now)\n return cb(er)\n\n debug('now=%d, wait until %d (delta=%d)', start, end, end-start)\n var wait = Math.min(end - start, opts.pollPeriod || 100)\n var timer = setTimeout(poll, wait)\n\n function poll () {\n debug('notStale, polling', path, opts)\n exports.lock(path, opts, cb)\n }\n}\n\nexports.lockSync = function (path, opts) {\n opts = opts || {}\n opts.req = opts.req || req++\n debug('lockSync', path, opts)\n if (opts.wait || opts.retryWait) {\n throw new Error('opts.wait not supported sync for obvious reasons')\n }\n\n try {\n var fd = fs.openSync(path, wx)\n locks[path] = fd\n try { fs.closeSync(fd) } catch (er) {}\n debug('locked sync!', path, fd)\n return\n } catch (er) {\n if (er.code !== 'EEXIST') return retryThrow(path, opts, er)\n\n if (opts.stale) {\n var st = fs.statSync(path)\n var ct = st[exports.filetime].getTime()\n if (!(ct % 1000) && (opts.stale % 1000)) {\n // probably don't have subsecond resolution.\n // round up the staleness indicator.\n // Yes, this will be wrong 1/1000 times on platforms\n // with subsecond stat precision, but that's acceptable\n // in exchange for not mistakenly removing locks on\n // most other systems.\n opts.stale = 1000 * Math.ceil(opts.stale / 1000)\n }\n var age = Date.now() - ct\n if (age > opts.stale) {\n debug('lockSync stale', path, opts, age)\n exports.unlockSync(path)\n return exports.lockSync(path, opts)\n }\n }\n\n // failed to lock!\n debug('failed to lock', path, opts, er)\n return retryThrow(path, opts, er)\n }\n}\n\nfunction retryThrow (path, opts, er) {\n if (typeof opts.retries === 'number' && opts.retries > 0) {\n var newRT = opts.retries - 1\n debug('retryThrow', path, opts, newRT)\n opts.retries = newRT\n return exports.lockSync(path, opts)\n }\n throw er\n}\n\n","'use strict'\nconst proc = typeof process === 'object' && process ? process : {\n stdout: null,\n stderr: null,\n}\nconst EE = require('events')\nconst Stream = require('stream')\nconst SD = require('string_decoder').StringDecoder\n\nconst EOF = Symbol('EOF')\nconst MAYBE_EMIT_END = Symbol('maybeEmitEnd')\nconst EMITTED_END = Symbol('emittedEnd')\nconst EMITTING_END = Symbol('emittingEnd')\nconst EMITTED_ERROR = Symbol('emittedError')\nconst CLOSED = Symbol('closed')\nconst READ = Symbol('read')\nconst FLUSH = Symbol('flush')\nconst FLUSHCHUNK = Symbol('flushChunk')\nconst ENCODING = Symbol('encoding')\nconst DECODER = Symbol('decoder')\nconst FLOWING = Symbol('flowing')\nconst PAUSED = Symbol('paused')\nconst RESUME = Symbol('resume')\nconst BUFFERLENGTH = Symbol('bufferLength')\nconst BUFFERPUSH = Symbol('bufferPush')\nconst BUFFERSHIFT = Symbol('bufferShift')\nconst OBJECTMODE = Symbol('objectMode')\nconst DESTROYED = Symbol('destroyed')\nconst EMITDATA = Symbol('emitData')\nconst EMITEND = Symbol('emitEnd')\nconst EMITEND2 = Symbol('emitEnd2')\nconst ASYNC = Symbol('async')\n\nconst defer = fn => Promise.resolve().then(fn)\n\n// TODO remove when Node v8 support drops\nconst doIter = global._MP_NO_ITERATOR_SYMBOLS_ !== '1'\nconst ASYNCITERATOR = doIter && Symbol.asyncIterator\n || Symbol('asyncIterator not implemented')\nconst ITERATOR = doIter && Symbol.iterator\n || Symbol('iterator not implemented')\n\n// events that mean 'the stream is over'\n// these are treated specially, and re-emitted\n// if they are listened for after emitting.\nconst isEndish = ev =>\n ev === 'end' ||\n ev === 'finish' ||\n ev === 'prefinish'\n\nconst isArrayBuffer = b => b instanceof ArrayBuffer ||\n typeof b === 'object' &&\n b.constructor &&\n b.constructor.name === 'ArrayBuffer' &&\n b.byteLength >= 0\n\nconst isArrayBufferView = b => !Buffer.isBuffer(b) && ArrayBuffer.isView(b)\n\nclass Pipe {\n constructor (src, dest, opts) {\n this.src = src\n this.dest = dest\n this.opts = opts\n this.ondrain = () => src[RESUME]()\n dest.on('drain', this.ondrain)\n }\n unpipe () {\n this.dest.removeListener('drain', this.ondrain)\n }\n // istanbul ignore next - only here for the prototype\n proxyErrors () {}\n end () {\n this.unpipe()\n if (this.opts.end)\n this.dest.end()\n }\n}\n\nclass PipeProxyErrors extends Pipe {\n unpipe () {\n this.src.removeListener('error', this.proxyErrors)\n super.unpipe()\n }\n constructor (src, dest, opts) {\n super(src, dest, opts)\n this.proxyErrors = er => dest.emit('error', er)\n src.on('error', this.proxyErrors)\n }\n}\n\nmodule.exports = class Minipass extends Stream {\n constructor (options) {\n super()\n this[FLOWING] = false\n // whether we're explicitly paused\n this[PAUSED] = false\n this.pipes = []\n this.buffer = []\n this[OBJECTMODE] = options && options.objectMode || false\n if (this[OBJECTMODE])\n this[ENCODING] = null\n else\n this[ENCODING] = options && options.encoding || null\n if (this[ENCODING] === 'buffer')\n this[ENCODING] = null\n this[ASYNC] = options && !!options.async || false\n this[DECODER] = this[ENCODING] ? new SD(this[ENCODING]) : null\n this[EOF] = false\n this[EMITTED_END] = false\n this[EMITTING_END] = false\n this[CLOSED] = false\n this[EMITTED_ERROR] = null\n this.writable = true\n this.readable = true\n this[BUFFERLENGTH] = 0\n this[DESTROYED] = false\n }\n\n get bufferLength () { return this[BUFFERLENGTH] }\n\n get encoding () { return this[ENCODING] }\n set encoding (enc) {\n if (this[OBJECTMODE])\n throw new Error('cannot set encoding in objectMode')\n\n if (this[ENCODING] && enc !== this[ENCODING] &&\n (this[DECODER] && this[DECODER].lastNeed || this[BUFFERLENGTH]))\n throw new Error('cannot change encoding')\n\n if (this[ENCODING] !== enc) {\n this[DECODER] = enc ? new SD(enc) : null\n if (this.buffer.length)\n this.buffer = this.buffer.map(chunk => this[DECODER].write(chunk))\n }\n\n this[ENCODING] = enc\n }\n\n setEncoding (enc) {\n this.encoding = enc\n }\n\n get objectMode () { return this[OBJECTMODE] }\n set objectMode (om) { this[OBJECTMODE] = this[OBJECTMODE] || !!om }\n\n get ['async'] () { return this[ASYNC] }\n set ['async'] (a) { this[ASYNC] = this[ASYNC] || !!a }\n\n write (chunk, encoding, cb) {\n if (this[EOF])\n throw new Error('write after end')\n\n if (this[DESTROYED]) {\n this.emit('error', Object.assign(\n new Error('Cannot call write after a stream was destroyed'),\n { code: 'ERR_STREAM_DESTROYED' }\n ))\n return true\n }\n\n if (typeof encoding === 'function')\n cb = encoding, encoding = 'utf8'\n\n if (!encoding)\n encoding = 'utf8'\n\n const fn = this[ASYNC] ? defer : f => f()\n\n // convert array buffers and typed array views into buffers\n // at some point in the future, we may want to do the opposite!\n // leave strings and buffers as-is\n // anything else switches us into object mode\n if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {\n if (isArrayBufferView(chunk))\n chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength)\n else if (isArrayBuffer(chunk))\n chunk = Buffer.from(chunk)\n else if (typeof chunk !== 'string')\n // use the setter so we throw if we have encoding set\n this.objectMode = true\n }\n\n // handle object mode up front, since it's simpler\n // this yields better performance, fewer checks later.\n if (this[OBJECTMODE]) {\n /* istanbul ignore if - maybe impossible? */\n if (this.flowing && this[BUFFERLENGTH] !== 0)\n this[FLUSH](true)\n\n if (this.flowing)\n this.emit('data', chunk)\n else\n this[BUFFERPUSH](chunk)\n\n if (this[BUFFERLENGTH] !== 0)\n this.emit('readable')\n\n if (cb)\n fn(cb)\n\n return this.flowing\n }\n\n // at this point the chunk is a buffer or string\n // don't buffer it up or send it to the decoder\n if (!chunk.length) {\n if (this[BUFFERLENGTH] !== 0)\n this.emit('readable')\n if (cb)\n fn(cb)\n return this.flowing\n }\n\n // fast-path writing strings of same encoding to a stream with\n // an empty buffer, skipping the buffer/decoder dance\n if (typeof chunk === 'string' &&\n // unless it is a string already ready for us to use\n !(encoding === this[ENCODING] && !this[DECODER].lastNeed)) {\n chunk = Buffer.from(chunk, encoding)\n }\n\n if (Buffer.isBuffer(chunk) && this[ENCODING])\n chunk = this[DECODER].write(chunk)\n\n // Note: flushing CAN potentially switch us into not-flowing mode\n if (this.flowing && this[BUFFERLENGTH] !== 0)\n this[FLUSH](true)\n\n if (this.flowing)\n this.emit('data', chunk)\n else\n this[BUFFERPUSH](chunk)\n\n if (this[BUFFERLENGTH] !== 0)\n this.emit('readable')\n\n if (cb)\n fn(cb)\n\n return this.flowing\n }\n\n read (n) {\n if (this[DESTROYED])\n return null\n\n if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH]) {\n this[MAYBE_EMIT_END]()\n return null\n }\n\n if (this[OBJECTMODE])\n n = null\n\n if (this.buffer.length > 1 && !this[OBJECTMODE]) {\n if (this.encoding)\n this.buffer = [this.buffer.join('')]\n else\n this.buffer = [Buffer.concat(this.buffer, this[BUFFERLENGTH])]\n }\n\n const ret = this[READ](n || null, this.buffer[0])\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [READ] (n, chunk) {\n if (n === chunk.length || n === null)\n this[BUFFERSHIFT]()\n else {\n this.buffer[0] = chunk.slice(n)\n chunk = chunk.slice(0, n)\n this[BUFFERLENGTH] -= n\n }\n\n this.emit('data', chunk)\n\n if (!this.buffer.length && !this[EOF])\n this.emit('drain')\n\n return chunk\n }\n\n end (chunk, encoding, cb) {\n if (typeof chunk === 'function')\n cb = chunk, chunk = null\n if (typeof encoding === 'function')\n cb = encoding, encoding = 'utf8'\n if (chunk)\n this.write(chunk, encoding)\n if (cb)\n this.once('end', cb)\n this[EOF] = true\n this.writable = false\n\n // if we haven't written anything, then go ahead and emit,\n // even if we're not reading.\n // we'll re-emit if a new 'end' listener is added anyway.\n // This makes MP more suitable to write-only use cases.\n if (this.flowing || !this[PAUSED])\n this[MAYBE_EMIT_END]()\n return this\n }\n\n // don't let the internal resume be overwritten\n [RESUME] () {\n if (this[DESTROYED])\n return\n\n this[PAUSED] = false\n this[FLOWING] = true\n this.emit('resume')\n if (this.buffer.length)\n this[FLUSH]()\n else if (this[EOF])\n this[MAYBE_EMIT_END]()\n else\n this.emit('drain')\n }\n\n resume () {\n return this[RESUME]()\n }\n\n pause () {\n this[FLOWING] = false\n this[PAUSED] = true\n }\n\n get destroyed () {\n return this[DESTROYED]\n }\n\n get flowing () {\n return this[FLOWING]\n }\n\n get paused () {\n return this[PAUSED]\n }\n\n [BUFFERPUSH] (chunk) {\n if (this[OBJECTMODE])\n this[BUFFERLENGTH] += 1\n else\n this[BUFFERLENGTH] += chunk.length\n this.buffer.push(chunk)\n }\n\n [BUFFERSHIFT] () {\n if (this.buffer.length) {\n if (this[OBJECTMODE])\n this[BUFFERLENGTH] -= 1\n else\n this[BUFFERLENGTH] -= this.buffer[0].length\n }\n return this.buffer.shift()\n }\n\n [FLUSH] (noDrain) {\n do {} while (this[FLUSHCHUNK](this[BUFFERSHIFT]()))\n\n if (!noDrain && !this.buffer.length && !this[EOF])\n this.emit('drain')\n }\n\n [FLUSHCHUNK] (chunk) {\n return chunk ? (this.emit('data', chunk), this.flowing) : false\n }\n\n pipe (dest, opts) {\n if (this[DESTROYED])\n return\n\n const ended = this[EMITTED_END]\n opts = opts || {}\n if (dest === proc.stdout || dest === proc.stderr)\n opts.end = false\n else\n opts.end = opts.end !== false\n opts.proxyErrors = !!opts.proxyErrors\n\n // piping an ended stream ends immediately\n if (ended) {\n if (opts.end)\n dest.end()\n } else {\n this.pipes.push(!opts.proxyErrors ? new Pipe(this, dest, opts)\n : new PipeProxyErrors(this, dest, opts))\n if (this[ASYNC])\n defer(() => this[RESUME]())\n else\n this[RESUME]()\n }\n\n return dest\n }\n\n unpipe (dest) {\n const p = this.pipes.find(p => p.dest === dest)\n if (p) {\n this.pipes.splice(this.pipes.indexOf(p), 1)\n p.unpipe()\n }\n }\n\n addListener (ev, fn) {\n return this.on(ev, fn)\n }\n\n on (ev, fn) {\n const ret = super.on(ev, fn)\n if (ev === 'data' && !this.pipes.length && !this.flowing)\n this[RESUME]()\n else if (ev === 'readable' && this[BUFFERLENGTH] !== 0)\n super.emit('readable')\n else if (isEndish(ev) && this[EMITTED_END]) {\n super.emit(ev)\n this.removeAllListeners(ev)\n } else if (ev === 'error' && this[EMITTED_ERROR]) {\n if (this[ASYNC])\n defer(() => fn.call(this, this[EMITTED_ERROR]))\n else\n fn.call(this, this[EMITTED_ERROR])\n }\n return ret\n }\n\n get emittedEnd () {\n return this[EMITTED_END]\n }\n\n [MAYBE_EMIT_END] () {\n if (!this[EMITTING_END] &&\n !this[EMITTED_END] &&\n !this[DESTROYED] &&\n this.buffer.length === 0 &&\n this[EOF]) {\n this[EMITTING_END] = true\n this.emit('end')\n this.emit('prefinish')\n this.emit('finish')\n if (this[CLOSED])\n this.emit('close')\n this[EMITTING_END] = false\n }\n }\n\n emit (ev, data, ...extra) {\n // error and close are only events allowed after calling destroy()\n if (ev !== 'error' && ev !== 'close' && ev !== DESTROYED && this[DESTROYED])\n return\n else if (ev === 'data') {\n return !data ? false\n : this[ASYNC] ? defer(() => this[EMITDATA](data))\n : this[EMITDATA](data)\n } else if (ev === 'end') {\n return this[EMITEND]()\n } else if (ev === 'close') {\n this[CLOSED] = true\n // don't emit close before 'end' and 'finish'\n if (!this[EMITTED_END] && !this[DESTROYED])\n return\n const ret = super.emit('close')\n this.removeAllListeners('close')\n return ret\n } else if (ev === 'error') {\n this[EMITTED_ERROR] = data\n const ret = super.emit('error', data)\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'resume') {\n const ret = super.emit('resume')\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'finish' || ev === 'prefinish') {\n const ret = super.emit(ev)\n this.removeAllListeners(ev)\n return ret\n }\n\n // Some other unknown event\n const ret = super.emit(ev, data, ...extra)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITDATA] (data) {\n for (const p of this.pipes) {\n if (p.dest.write(data) === false)\n this.pause()\n }\n const ret = super.emit('data', data)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITEND] () {\n if (this[EMITTED_END])\n return\n\n this[EMITTED_END] = true\n this.readable = false\n if (this[ASYNC])\n defer(() => this[EMITEND2]())\n else\n this[EMITEND2]()\n }\n\n [EMITEND2] () {\n if (this[DECODER]) {\n const data = this[DECODER].end()\n if (data) {\n for (const p of this.pipes) {\n p.dest.write(data)\n }\n super.emit('data', data)\n }\n }\n\n for (const p of this.pipes) {\n p.end()\n }\n const ret = super.emit('end')\n this.removeAllListeners('end')\n return ret\n }\n\n // const all = await stream.collect()\n collect () {\n const buf = []\n if (!this[OBJECTMODE])\n buf.dataLength = 0\n // set the promise first, in case an error is raised\n // by triggering the flow here.\n const p = this.promise()\n this.on('data', c => {\n buf.push(c)\n if (!this[OBJECTMODE])\n buf.dataLength += c.length\n })\n return p.then(() => buf)\n }\n\n // const data = await stream.concat()\n concat () {\n return this[OBJECTMODE]\n ? Promise.reject(new Error('cannot concat in objectMode'))\n : this.collect().then(buf =>\n this[OBJECTMODE]\n ? Promise.reject(new Error('cannot concat in objectMode'))\n : this[ENCODING] ? buf.join('') : Buffer.concat(buf, buf.dataLength))\n }\n\n // stream.promise().then(() => done, er => emitted error)\n promise () {\n return new Promise((resolve, reject) => {\n this.on(DESTROYED, () => reject(new Error('stream destroyed')))\n this.on('error', er => reject(er))\n this.on('end', () => resolve())\n })\n }\n\n // for await (let chunk of stream)\n [ASYNCITERATOR] () {\n const next = () => {\n const res = this.read()\n if (res !== null)\n return Promise.resolve({ done: false, value: res })\n\n if (this[EOF])\n return Promise.resolve({ done: true })\n\n let resolve = null\n let reject = null\n const onerr = er => {\n this.removeListener('data', ondata)\n this.removeListener('end', onend)\n reject(er)\n }\n const ondata = value => {\n this.removeListener('error', onerr)\n this.removeListener('end', onend)\n this.pause()\n resolve({ value: value, done: !!this[EOF] })\n }\n const onend = () => {\n this.removeListener('error', onerr)\n this.removeListener('data', ondata)\n resolve({ done: true })\n }\n const ondestroy = () => onerr(new Error('stream destroyed'))\n return new Promise((res, rej) => {\n reject = rej\n resolve = res\n this.once(DESTROYED, ondestroy)\n this.once('error', onerr)\n this.once('end', onend)\n this.once('data', ondata)\n })\n }\n\n return { next }\n }\n\n // for (let chunk of stream)\n [ITERATOR] () {\n const next = () => {\n const value = this.read()\n const done = value === null\n return { value, done }\n }\n return { next }\n }\n\n destroy (er) {\n if (this[DESTROYED]) {\n if (er)\n this.emit('error', er)\n else\n this.emit(DESTROYED)\n return this\n }\n\n this[DESTROYED] = true\n\n // throw away all buffered data, it's never coming out\n this.buffer.length = 0\n this[BUFFERLENGTH] = 0\n\n if (typeof this.close === 'function' && !this[CLOSED])\n this.close()\n\n if (er)\n this.emit('error', er)\n else // if no error to emit, still reject pending promises\n this.emit(DESTROYED)\n\n return this\n }\n\n static isStream (s) {\n return !!s && (s instanceof Minipass || s instanceof Stream ||\n s instanceof EE && (\n typeof s.pipe === 'function' || // readable\n (typeof s.write === 'function' && typeof s.end === 'function') // writable\n ))\n }\n}\n","// Update with any zlib constants that are added or changed in the future.\n// Node v6 didn't export this, so we just hard code the version and rely\n// on all the other hard-coded values from zlib v4736. When node v6\n// support drops, we can just export the realZlibConstants object.\nconst realZlibConstants = require('zlib').constants ||\n /* istanbul ignore next */ { ZLIB_VERNUM: 4736 }\n\nmodule.exports = Object.freeze(Object.assign(Object.create(null), {\n Z_NO_FLUSH: 0,\n Z_PARTIAL_FLUSH: 1,\n Z_SYNC_FLUSH: 2,\n Z_FULL_FLUSH: 3,\n Z_FINISH: 4,\n Z_BLOCK: 5,\n Z_OK: 0,\n Z_STREAM_END: 1,\n Z_NEED_DICT: 2,\n Z_ERRNO: -1,\n Z_STREAM_ERROR: -2,\n Z_DATA_ERROR: -3,\n Z_MEM_ERROR: -4,\n Z_BUF_ERROR: -5,\n Z_VERSION_ERROR: -6,\n Z_NO_COMPRESSION: 0,\n Z_BEST_SPEED: 1,\n Z_BEST_COMPRESSION: 9,\n Z_DEFAULT_COMPRESSION: -1,\n Z_FILTERED: 1,\n Z_HUFFMAN_ONLY: 2,\n Z_RLE: 3,\n Z_FIXED: 4,\n Z_DEFAULT_STRATEGY: 0,\n DEFLATE: 1,\n INFLATE: 2,\n GZIP: 3,\n GUNZIP: 4,\n DEFLATERAW: 5,\n INFLATERAW: 6,\n UNZIP: 7,\n BROTLI_DECODE: 8,\n BROTLI_ENCODE: 9,\n Z_MIN_WINDOWBITS: 8,\n Z_MAX_WINDOWBITS: 15,\n Z_DEFAULT_WINDOWBITS: 15,\n Z_MIN_CHUNK: 64,\n Z_MAX_CHUNK: Infinity,\n Z_DEFAULT_CHUNK: 16384,\n Z_MIN_MEMLEVEL: 1,\n Z_MAX_MEMLEVEL: 9,\n Z_DEFAULT_MEMLEVEL: 8,\n Z_MIN_LEVEL: -1,\n Z_MAX_LEVEL: 9,\n Z_DEFAULT_LEVEL: -1,\n BROTLI_OPERATION_PROCESS: 0,\n BROTLI_OPERATION_FLUSH: 1,\n BROTLI_OPERATION_FINISH: 2,\n BROTLI_OPERATION_EMIT_METADATA: 3,\n BROTLI_MODE_GENERIC: 0,\n BROTLI_MODE_TEXT: 1,\n BROTLI_MODE_FONT: 2,\n BROTLI_DEFAULT_MODE: 0,\n BROTLI_MIN_QUALITY: 0,\n BROTLI_MAX_QUALITY: 11,\n BROTLI_DEFAULT_QUALITY: 11,\n BROTLI_MIN_WINDOW_BITS: 10,\n BROTLI_MAX_WINDOW_BITS: 24,\n BROTLI_LARGE_MAX_WINDOW_BITS: 30,\n BROTLI_DEFAULT_WINDOW: 22,\n BROTLI_MIN_INPUT_BLOCK_BITS: 16,\n BROTLI_MAX_INPUT_BLOCK_BITS: 24,\n BROTLI_PARAM_MODE: 0,\n BROTLI_PARAM_QUALITY: 1,\n BROTLI_PARAM_LGWIN: 2,\n BROTLI_PARAM_LGBLOCK: 3,\n BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: 4,\n BROTLI_PARAM_SIZE_HINT: 5,\n BROTLI_PARAM_LARGE_WINDOW: 6,\n BROTLI_PARAM_NPOSTFIX: 7,\n BROTLI_PARAM_NDIRECT: 8,\n BROTLI_DECODER_RESULT_ERROR: 0,\n BROTLI_DECODER_RESULT_SUCCESS: 1,\n BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: 2,\n BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: 3,\n BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: 0,\n BROTLI_DECODER_PARAM_LARGE_WINDOW: 1,\n BROTLI_DECODER_NO_ERROR: 0,\n BROTLI_DECODER_SUCCESS: 1,\n BROTLI_DECODER_NEEDS_MORE_INPUT: 2,\n BROTLI_DECODER_NEEDS_MORE_OUTPUT: 3,\n BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: -1,\n BROTLI_DECODER_ERROR_FORMAT_RESERVED: -2,\n BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: -3,\n BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: -4,\n BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: -5,\n BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: -6,\n BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: -7,\n BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: -8,\n BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: -9,\n BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: -10,\n BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: -11,\n BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: -12,\n BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: -13,\n BROTLI_DECODER_ERROR_FORMAT_PADDING_1: -14,\n BROTLI_DECODER_ERROR_FORMAT_PADDING_2: -15,\n BROTLI_DECODER_ERROR_FORMAT_DISTANCE: -16,\n BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: -19,\n BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: -20,\n BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: -21,\n BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: -22,\n BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: -25,\n BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: -26,\n BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: -27,\n BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: -30,\n BROTLI_DECODER_ERROR_UNREACHABLE: -31,\n}, realZlibConstants))\n","'use strict'\n\nconst assert = require('assert')\nconst Buffer = require('buffer').Buffer\nconst realZlib = require('zlib')\n\nconst constants = exports.constants = require('./constants.js')\nconst Minipass = require('minipass')\n\nconst OriginalBufferConcat = Buffer.concat\n\nconst _superWrite = Symbol('_superWrite')\nclass ZlibError extends Error {\n constructor (err) {\n super('zlib: ' + err.message)\n this.code = err.code\n this.errno = err.errno\n /* istanbul ignore if */\n if (!this.code)\n this.code = 'ZLIB_ERROR'\n\n this.message = 'zlib: ' + err.message\n Error.captureStackTrace(this, this.constructor)\n }\n\n get name () {\n return 'ZlibError'\n }\n}\n\n// the Zlib class they all inherit from\n// This thing manages the queue of requests, and returns\n// true or false if there is anything in the queue when\n// you call the .write() method.\nconst _opts = Symbol('opts')\nconst _flushFlag = Symbol('flushFlag')\nconst _finishFlushFlag = Symbol('finishFlushFlag')\nconst _fullFlushFlag = Symbol('fullFlushFlag')\nconst _handle = Symbol('handle')\nconst _onError = Symbol('onError')\nconst _sawError = Symbol('sawError')\nconst _level = Symbol('level')\nconst _strategy = Symbol('strategy')\nconst _ended = Symbol('ended')\nconst _defaultFullFlush = Symbol('_defaultFullFlush')\n\nclass ZlibBase extends Minipass {\n constructor (opts, mode) {\n if (!opts || typeof opts !== 'object')\n throw new TypeError('invalid options for ZlibBase constructor')\n\n super(opts)\n this[_sawError] = false\n this[_ended] = false\n this[_opts] = opts\n\n this[_flushFlag] = opts.flush\n this[_finishFlushFlag] = opts.finishFlush\n // this will throw if any options are invalid for the class selected\n try {\n this[_handle] = new realZlib[mode](opts)\n } catch (er) {\n // make sure that all errors get decorated properly\n throw new ZlibError(er)\n }\n\n this[_onError] = (err) => {\n // no sense raising multiple errors, since we abort on the first one.\n if (this[_sawError])\n return\n\n this[_sawError] = true\n\n // there is no way to cleanly recover.\n // continuing only obscures problems.\n this.close()\n this.emit('error', err)\n }\n\n this[_handle].on('error', er => this[_onError](new ZlibError(er)))\n this.once('end', () => this.close)\n }\n\n close () {\n if (this[_handle]) {\n this[_handle].close()\n this[_handle] = null\n this.emit('close')\n }\n }\n\n reset () {\n if (!this[_sawError]) {\n assert(this[_handle], 'zlib binding closed')\n return this[_handle].reset()\n }\n }\n\n flush (flushFlag) {\n if (this.ended)\n return\n\n if (typeof flushFlag !== 'number')\n flushFlag = this[_fullFlushFlag]\n this.write(Object.assign(Buffer.alloc(0), { [_flushFlag]: flushFlag }))\n }\n\n end (chunk, encoding, cb) {\n if (chunk)\n this.write(chunk, encoding)\n this.flush(this[_finishFlushFlag])\n this[_ended] = true\n return super.end(null, null, cb)\n }\n\n get ended () {\n return this[_ended]\n }\n\n write (chunk, encoding, cb) {\n // process the chunk using the sync process\n // then super.write() all the outputted chunks\n if (typeof encoding === 'function')\n cb = encoding, encoding = 'utf8'\n\n if (typeof chunk === 'string')\n chunk = Buffer.from(chunk, encoding)\n\n if (this[_sawError])\n return\n assert(this[_handle], 'zlib binding closed')\n\n // _processChunk tries to .close() the native handle after it's done, so we\n // intercept that by temporarily making it a no-op.\n const nativeHandle = this[_handle]._handle\n const originalNativeClose = nativeHandle.close\n nativeHandle.close = () => {}\n const originalClose = this[_handle].close\n this[_handle].close = () => {}\n // It also calls `Buffer.concat()` at the end, which may be convenient\n // for some, but which we are not interested in as it slows us down.\n Buffer.concat = (args) => args\n let result\n try {\n const flushFlag = typeof chunk[_flushFlag] === 'number'\n ? chunk[_flushFlag] : this[_flushFlag]\n result = this[_handle]._processChunk(chunk, flushFlag)\n // if we don't throw, reset it back how it was\n Buffer.concat = OriginalBufferConcat\n } catch (err) {\n // or if we do, put Buffer.concat() back before we emit error\n // Error events call into user code, which may call Buffer.concat()\n Buffer.concat = OriginalBufferConcat\n this[_onError](new ZlibError(err))\n } finally {\n if (this[_handle]) {\n // Core zlib resets `_handle` to null after attempting to close the\n // native handle. Our no-op handler prevented actual closure, but we\n // need to restore the `._handle` property.\n this[_handle]._handle = nativeHandle\n nativeHandle.close = originalNativeClose\n this[_handle].close = originalClose\n // `_processChunk()` adds an 'error' listener. If we don't remove it\n // after each call, these handlers start piling up.\n this[_handle].removeAllListeners('error')\n // make sure OUR error listener is still attached tho\n }\n }\n\n if (this[_handle])\n this[_handle].on('error', er => this[_onError](new ZlibError(er)))\n\n let writeReturn\n if (result) {\n if (Array.isArray(result) && result.length > 0) {\n // The first buffer is always `handle._outBuffer`, which would be\n // re-used for later invocations; so, we always have to copy that one.\n writeReturn = this[_superWrite](Buffer.from(result[0]))\n for (let i = 1; i < result.length; i++) {\n writeReturn = this[_superWrite](result[i])\n }\n } else {\n writeReturn = this[_superWrite](Buffer.from(result))\n }\n }\n\n if (cb)\n cb()\n return writeReturn\n }\n\n [_superWrite] (data) {\n return super.write(data)\n }\n}\n\nclass Zlib extends ZlibBase {\n constructor (opts, mode) {\n opts = opts || {}\n\n opts.flush = opts.flush || constants.Z_NO_FLUSH\n opts.finishFlush = opts.finishFlush || constants.Z_FINISH\n super(opts, mode)\n\n this[_fullFlushFlag] = constants.Z_FULL_FLUSH\n this[_level] = opts.level\n this[_strategy] = opts.strategy\n }\n\n params (level, strategy) {\n if (this[_sawError])\n return\n\n if (!this[_handle])\n throw new Error('cannot switch params when binding is closed')\n\n // no way to test this without also not supporting params at all\n /* istanbul ignore if */\n if (!this[_handle].params)\n throw new Error('not supported in this implementation')\n\n if (this[_level] !== level || this[_strategy] !== strategy) {\n this.flush(constants.Z_SYNC_FLUSH)\n assert(this[_handle], 'zlib binding closed')\n // .params() calls .flush(), but the latter is always async in the\n // core zlib. We override .flush() temporarily to intercept that and\n // flush synchronously.\n const origFlush = this[_handle].flush\n this[_handle].flush = (flushFlag, cb) => {\n this.flush(flushFlag)\n cb()\n }\n try {\n this[_handle].params(level, strategy)\n } finally {\n this[_handle].flush = origFlush\n }\n /* istanbul ignore else */\n if (this[_handle]) {\n this[_level] = level\n this[_strategy] = strategy\n }\n }\n }\n}\n\n// minimal 2-byte header\nclass Deflate extends Zlib {\n constructor (opts) {\n super(opts, 'Deflate')\n }\n}\n\nclass Inflate extends Zlib {\n constructor (opts) {\n super(opts, 'Inflate')\n }\n}\n\n// gzip - bigger header, same deflate compression\nconst _portable = Symbol('_portable')\nclass Gzip extends Zlib {\n constructor (opts) {\n super(opts, 'Gzip')\n this[_portable] = opts && !!opts.portable\n }\n\n [_superWrite] (data) {\n if (!this[_portable])\n return super[_superWrite](data)\n\n // we'll always get the header emitted in one first chunk\n // overwrite the OS indicator byte with 0xFF\n this[_portable] = false\n data[9] = 255\n return super[_superWrite](data)\n }\n}\n\nclass Gunzip extends Zlib {\n constructor (opts) {\n super(opts, 'Gunzip')\n }\n}\n\n// raw - no header\nclass DeflateRaw extends Zlib {\n constructor (opts) {\n super(opts, 'DeflateRaw')\n }\n}\n\nclass InflateRaw extends Zlib {\n constructor (opts) {\n super(opts, 'InflateRaw')\n }\n}\n\n// auto-detect header.\nclass Unzip extends Zlib {\n constructor (opts) {\n super(opts, 'Unzip')\n }\n}\n\nclass Brotli extends ZlibBase {\n constructor (opts, mode) {\n opts = opts || {}\n\n opts.flush = opts.flush || constants.BROTLI_OPERATION_PROCESS\n opts.finishFlush = opts.finishFlush || constants.BROTLI_OPERATION_FINISH\n\n super(opts, mode)\n\n this[_fullFlushFlag] = constants.BROTLI_OPERATION_FLUSH\n }\n}\n\nclass BrotliCompress extends Brotli {\n constructor (opts) {\n super(opts, 'BrotliCompress')\n }\n}\n\nclass BrotliDecompress extends Brotli {\n constructor (opts) {\n super(opts, 'BrotliDecompress')\n }\n}\n\nexports.Deflate = Deflate\nexports.Inflate = Inflate\nexports.Gzip = Gzip\nexports.Gunzip = Gunzip\nexports.DeflateRaw = DeflateRaw\nexports.InflateRaw = InflateRaw\nexports.Unzip = Unzip\n/* istanbul ignore else */\nif (typeof realZlib.BrotliCompress === 'function') {\n exports.BrotliCompress = BrotliCompress\n exports.BrotliDecompress = BrotliDecompress\n} else {\n exports.BrotliCompress = exports.BrotliDecompress = class {\n constructor () {\n throw new Error('Brotli is not supported in this version of Node.js')\n }\n }\n}\n","const optsArg = require('./lib/opts-arg.js')\nconst pathArg = require('./lib/path-arg.js')\n\nconst {mkdirpNative, mkdirpNativeSync} = require('./lib/mkdirp-native.js')\nconst {mkdirpManual, mkdirpManualSync} = require('./lib/mkdirp-manual.js')\nconst {useNative, useNativeSync} = require('./lib/use-native.js')\n\n\nconst mkdirp = (path, opts) => {\n path = pathArg(path)\n opts = optsArg(opts)\n return useNative(opts)\n ? mkdirpNative(path, opts)\n : mkdirpManual(path, opts)\n}\n\nconst mkdirpSync = (path, opts) => {\n path = pathArg(path)\n opts = optsArg(opts)\n return useNativeSync(opts)\n ? mkdirpNativeSync(path, opts)\n : mkdirpManualSync(path, opts)\n}\n\nmkdirp.sync = mkdirpSync\nmkdirp.native = (path, opts) => mkdirpNative(pathArg(path), optsArg(opts))\nmkdirp.manual = (path, opts) => mkdirpManual(pathArg(path), optsArg(opts))\nmkdirp.nativeSync = (path, opts) => mkdirpNativeSync(pathArg(path), optsArg(opts))\nmkdirp.manualSync = (path, opts) => mkdirpManualSync(pathArg(path), optsArg(opts))\n\nmodule.exports = mkdirp\n","const {dirname} = require('path')\n\nconst findMade = (opts, parent, path = undefined) => {\n // we never want the 'made' return value to be a root directory\n if (path === parent)\n return Promise.resolve()\n\n return opts.statAsync(parent).then(\n st => st.isDirectory() ? path : undefined, // will fail later\n er => er.code === 'ENOENT'\n ? findMade(opts, dirname(parent), parent)\n : undefined\n )\n}\n\nconst findMadeSync = (opts, parent, path = undefined) => {\n if (path === parent)\n return undefined\n\n try {\n return opts.statSync(parent).isDirectory() ? path : undefined\n } catch (er) {\n return er.code === 'ENOENT'\n ? findMadeSync(opts, dirname(parent), parent)\n : undefined\n }\n}\n\nmodule.exports = {findMade, findMadeSync}\n","const {dirname} = require('path')\n\nconst mkdirpManual = (path, opts, made) => {\n opts.recursive = false\n const parent = dirname(path)\n if (parent === path) {\n return opts.mkdirAsync(path, opts).catch(er => {\n // swallowed by recursive implementation on posix systems\n // any other error is a failure\n if (er.code !== 'EISDIR')\n throw er\n })\n }\n\n return opts.mkdirAsync(path, opts).then(() => made || path, er => {\n if (er.code === 'ENOENT')\n return mkdirpManual(parent, opts)\n .then(made => mkdirpManual(path, opts, made))\n if (er.code !== 'EEXIST' && er.code !== 'EROFS')\n throw er\n return opts.statAsync(path).then(st => {\n if (st.isDirectory())\n return made\n else\n throw er\n }, () => { throw er })\n })\n}\n\nconst mkdirpManualSync = (path, opts, made) => {\n const parent = dirname(path)\n opts.recursive = false\n\n if (parent === path) {\n try {\n return opts.mkdirSync(path, opts)\n } catch (er) {\n // swallowed by recursive implementation on posix systems\n // any other error is a failure\n if (er.code !== 'EISDIR')\n throw er\n else\n return\n }\n }\n\n try {\n opts.mkdirSync(path, opts)\n return made || path\n } catch (er) {\n if (er.code === 'ENOENT')\n return mkdirpManualSync(path, opts, mkdirpManualSync(parent, opts, made))\n if (er.code !== 'EEXIST' && er.code !== 'EROFS')\n throw er\n try {\n if (!opts.statSync(path).isDirectory())\n throw er\n } catch (_) {\n throw er\n }\n }\n}\n\nmodule.exports = {mkdirpManual, mkdirpManualSync}\n","const {dirname} = require('path')\nconst {findMade, findMadeSync} = require('./find-made.js')\nconst {mkdirpManual, mkdirpManualSync} = require('./mkdirp-manual.js')\n\nconst mkdirpNative = (path, opts) => {\n opts.recursive = true\n const parent = dirname(path)\n if (parent === path)\n return opts.mkdirAsync(path, opts)\n\n return findMade(opts, path).then(made =>\n opts.mkdirAsync(path, opts).then(() => made)\n .catch(er => {\n if (er.code === 'ENOENT')\n return mkdirpManual(path, opts)\n else\n throw er\n }))\n}\n\nconst mkdirpNativeSync = (path, opts) => {\n opts.recursive = true\n const parent = dirname(path)\n if (parent === path)\n return opts.mkdirSync(path, opts)\n\n const made = findMadeSync(opts, path)\n try {\n opts.mkdirSync(path, opts)\n return made\n } catch (er) {\n if (er.code === 'ENOENT')\n return mkdirpManualSync(path, opts)\n else\n throw er\n }\n}\n\nmodule.exports = {mkdirpNative, mkdirpNativeSync}\n","const { promisify } = require('util')\nconst fs = require('fs')\nconst optsArg = opts => {\n if (!opts)\n opts = { mode: 0o777, fs }\n else if (typeof opts === 'object')\n opts = { mode: 0o777, fs, ...opts }\n else if (typeof opts === 'number')\n opts = { mode: opts, fs }\n else if (typeof opts === 'string')\n opts = { mode: parseInt(opts, 8), fs }\n else\n throw new TypeError('invalid options argument')\n\n opts.mkdir = opts.mkdir || opts.fs.mkdir || fs.mkdir\n opts.mkdirAsync = promisify(opts.mkdir)\n opts.stat = opts.stat || opts.fs.stat || fs.stat\n opts.statAsync = promisify(opts.stat)\n opts.statSync = opts.statSync || opts.fs.statSync || fs.statSync\n opts.mkdirSync = opts.mkdirSync || opts.fs.mkdirSync || fs.mkdirSync\n return opts\n}\nmodule.exports = optsArg\n","const platform = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform\nconst { resolve, parse } = require('path')\nconst pathArg = path => {\n if (/\\0/.test(path)) {\n // simulate same failure that node raises\n throw Object.assign(\n new TypeError('path must be a string without null bytes'),\n {\n path,\n code: 'ERR_INVALID_ARG_VALUE',\n }\n )\n }\n\n path = resolve(path)\n if (platform === 'win32') {\n const badWinChars = /[*|\"<>?:]/\n const {root} = parse(path)\n if (badWinChars.test(path.substr(root.length))) {\n throw Object.assign(new Error('Illegal characters in path.'), {\n path,\n code: 'EINVAL',\n })\n }\n }\n\n return path\n}\nmodule.exports = pathArg\n","const fs = require('fs')\n\nconst version = process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version\nconst versArr = version.replace(/^v/, '').split('.')\nconst hasNative = +versArr[0] > 10 || +versArr[0] === 10 && +versArr[1] >= 12\n\nconst useNative = !hasNative ? () => false : opts => opts.mkdir === fs.mkdir\nconst useNativeSync = !hasNative ? () => false : opts => opts.mkdirSync === fs.mkdirSync\n\nmodule.exports = {useNative, useNativeSync}\n","// Note: since nyc uses this module to output coverage, any lines\n// that are in the direct sync flow of nyc's outputCoverage are\n// ignored, since we can never get coverage for them.\n// grab a reference to node's real process object right away\nvar process = global.process\n\nconst processOk = function (process) {\n return process &&\n typeof process === 'object' &&\n typeof process.removeListener === 'function' &&\n typeof process.emit === 'function' &&\n typeof process.reallyExit === 'function' &&\n typeof process.listeners === 'function' &&\n typeof process.kill === 'function' &&\n typeof process.pid === 'number' &&\n typeof process.on === 'function'\n}\n\n// some kind of non-node environment, just no-op\n/* istanbul ignore if */\nif (!processOk(process)) {\n module.exports = function () {\n return function () {}\n }\n} else {\n var assert = require('assert')\n var signals = require('./signals.js')\n var isWin = /^win/i.test(process.platform)\n\n var EE = require('events')\n /* istanbul ignore if */\n if (typeof EE !== 'function') {\n EE = EE.EventEmitter\n }\n\n var emitter\n if (process.__signal_exit_emitter__) {\n emitter = process.__signal_exit_emitter__\n } else {\n emitter = process.__signal_exit_emitter__ = new EE()\n emitter.count = 0\n emitter.emitted = {}\n }\n\n // Because this emitter is a global, we have to check to see if a\n // previous version of this library failed to enable infinite listeners.\n // I know what you're about to say. But literally everything about\n // signal-exit is a compromise with evil. Get used to it.\n if (!emitter.infinite) {\n emitter.setMaxListeners(Infinity)\n emitter.infinite = true\n }\n\n module.exports = function (cb, opts) {\n /* istanbul ignore if */\n if (!processOk(global.process)) {\n return function () {}\n }\n assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler')\n\n if (loaded === false) {\n load()\n }\n\n var ev = 'exit'\n if (opts && opts.alwaysLast) {\n ev = 'afterexit'\n }\n\n var remove = function () {\n emitter.removeListener(ev, cb)\n if (emitter.listeners('exit').length === 0 &&\n emitter.listeners('afterexit').length === 0) {\n unload()\n }\n }\n emitter.on(ev, cb)\n\n return remove\n }\n\n var unload = function unload () {\n if (!loaded || !processOk(global.process)) {\n return\n }\n loaded = false\n\n signals.forEach(function (sig) {\n try {\n process.removeListener(sig, sigListeners[sig])\n } catch (er) {}\n })\n process.emit = originalProcessEmit\n process.reallyExit = originalProcessReallyExit\n emitter.count -= 1\n }\n module.exports.unload = unload\n\n var emit = function emit (event, code, signal) {\n /* istanbul ignore if */\n if (emitter.emitted[event]) {\n return\n }\n emitter.emitted[event] = true\n emitter.emit(event, code, signal)\n }\n\n // { : , ... }\n var sigListeners = {}\n signals.forEach(function (sig) {\n sigListeners[sig] = function listener () {\n /* istanbul ignore if */\n if (!processOk(global.process)) {\n return\n }\n // If there are no other listeners, an exit is coming!\n // Simplest way: remove us and then re-send the signal.\n // We know that this will kill the process, so we can\n // safely emit now.\n var listeners = process.listeners(sig)\n if (listeners.length === emitter.count) {\n unload()\n emit('exit', null, sig)\n /* istanbul ignore next */\n emit('afterexit', null, sig)\n /* istanbul ignore next */\n if (isWin && sig === 'SIGHUP') {\n // \"SIGHUP\" throws an `ENOSYS` error on Windows,\n // so use a supported signal instead\n sig = 'SIGINT'\n }\n /* istanbul ignore next */\n process.kill(process.pid, sig)\n }\n }\n })\n\n module.exports.signals = function () {\n return signals\n }\n\n var loaded = false\n\n var load = function load () {\n if (loaded || !processOk(global.process)) {\n return\n }\n loaded = true\n\n // This is the number of onSignalExit's that are in play.\n // It's important so that we can count the correct number of\n // listeners on signals, and don't wait for the other one to\n // handle it instead of us.\n emitter.count += 1\n\n signals = signals.filter(function (sig) {\n try {\n process.on(sig, sigListeners[sig])\n return true\n } catch (er) {\n return false\n }\n })\n\n process.emit = processEmit\n process.reallyExit = processReallyExit\n }\n module.exports.load = load\n\n var originalProcessReallyExit = process.reallyExit\n var processReallyExit = function processReallyExit (code) {\n /* istanbul ignore if */\n if (!processOk(global.process)) {\n return\n }\n process.exitCode = code || /* istanbul ignore next */ 0\n emit('exit', process.exitCode, null)\n /* istanbul ignore next */\n emit('afterexit', process.exitCode, null)\n /* istanbul ignore next */\n originalProcessReallyExit.call(process, process.exitCode)\n }\n\n var originalProcessEmit = process.emit\n var processEmit = function processEmit (ev, arg) {\n if (ev === 'exit' && processOk(global.process)) {\n /* istanbul ignore else */\n if (arg !== undefined) {\n process.exitCode = arg\n }\n var ret = originalProcessEmit.apply(this, arguments)\n /* istanbul ignore next */\n emit('exit', process.exitCode, null)\n /* istanbul ignore next */\n emit('afterexit', process.exitCode, null)\n /* istanbul ignore next */\n return ret\n } else {\n return originalProcessEmit.apply(this, arguments)\n }\n }\n}\n","// This is not the set of all possible signals.\n//\n// It IS, however, the set of all signals that trigger\n// an exit on either Linux or BSD systems. Linux is a\n// superset of the signal names supported on BSD, and\n// the unknown signals just fail to register, so we can\n// catch that easily enough.\n//\n// Don't bother with SIGKILL. It's uncatchable, which\n// means that we can't fire any callbacks anyway.\n//\n// If a user does happen to register a handler on a non-\n// fatal signal like SIGWINCH or something, and then\n// exit, it'll end up firing `process.emit('exit')`, so\n// the handler will be fired anyway.\n//\n// SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised\n// artificially, inherently leave the process in a\n// state from which it is not safe to try and enter JS\n// listeners.\nmodule.exports = [\n 'SIGABRT',\n 'SIGALRM',\n 'SIGHUP',\n 'SIGINT',\n 'SIGTERM'\n]\n\nif (process.platform !== 'win32') {\n module.exports.push(\n 'SIGVTALRM',\n 'SIGXCPU',\n 'SIGXFSZ',\n 'SIGUSR2',\n 'SIGTRAP',\n 'SIGSYS',\n 'SIGQUIT',\n 'SIGIOT'\n // should detect profiler and enable/disable accordingly.\n // see #21\n // 'SIGPROF'\n )\n}\n\nif (process.platform === 'linux') {\n module.exports.push(\n 'SIGIO',\n 'SIGPOLL',\n 'SIGPWR',\n 'SIGSTKFLT',\n 'SIGUNUSED'\n )\n}\n","'use strict'\n\n// high-level commands\nexports.c = exports.create = require('./lib/create.js')\nexports.r = exports.replace = require('./lib/replace.js')\nexports.t = exports.list = require('./lib/list.js')\nexports.u = exports.update = require('./lib/update.js')\nexports.x = exports.extract = require('./lib/extract.js')\n\n// classes\nexports.Pack = require('./lib/pack.js')\nexports.Unpack = require('./lib/unpack.js')\nexports.Parse = require('./lib/parse.js')\nexports.ReadEntry = require('./lib/read-entry.js')\nexports.WriteEntry = require('./lib/write-entry.js')\nexports.Header = require('./lib/header.js')\nexports.Pax = require('./lib/pax.js')\nexports.types = require('./lib/types.js')\n","'use strict'\n\n// tar -c\nconst hlo = require('./high-level-opt.js')\n\nconst Pack = require('./pack.js')\nconst fsm = require('fs-minipass')\nconst t = require('./list.js')\nconst path = require('path')\n\nmodule.exports = (opt_, files, cb) => {\n if (typeof files === 'function') {\n cb = files\n }\n\n if (Array.isArray(opt_)) {\n files = opt_, opt_ = {}\n }\n\n if (!files || !Array.isArray(files) || !files.length) {\n throw new TypeError('no files or directories specified')\n }\n\n files = Array.from(files)\n\n const opt = hlo(opt_)\n\n if (opt.sync && typeof cb === 'function') {\n throw new TypeError('callback not supported for sync tar functions')\n }\n\n if (!opt.file && typeof cb === 'function') {\n throw new TypeError('callback only supported with file option')\n }\n\n return opt.file && opt.sync ? createFileSync(opt, files)\n : opt.file ? createFile(opt, files, cb)\n : opt.sync ? createSync(opt, files)\n : create(opt, files)\n}\n\nconst createFileSync = (opt, files) => {\n const p = new Pack.Sync(opt)\n const stream = new fsm.WriteStreamSync(opt.file, {\n mode: opt.mode || 0o666,\n })\n p.pipe(stream)\n addFilesSync(p, files)\n}\n\nconst createFile = (opt, files, cb) => {\n const p = new Pack(opt)\n const stream = new fsm.WriteStream(opt.file, {\n mode: opt.mode || 0o666,\n })\n p.pipe(stream)\n\n const promise = new Promise((res, rej) => {\n stream.on('error', rej)\n stream.on('close', res)\n p.on('error', rej)\n })\n\n addFilesAsync(p, files)\n\n return cb ? promise.then(cb, cb) : promise\n}\n\nconst addFilesSync = (p, files) => {\n files.forEach(file => {\n if (file.charAt(0) === '@') {\n t({\n file: path.resolve(p.cwd, file.slice(1)),\n sync: true,\n noResume: true,\n onentry: entry => p.add(entry),\n })\n } else {\n p.add(file)\n }\n })\n p.end()\n}\n\nconst addFilesAsync = (p, files) => {\n while (files.length) {\n const file = files.shift()\n if (file.charAt(0) === '@') {\n return t({\n file: path.resolve(p.cwd, file.slice(1)),\n noResume: true,\n onentry: entry => p.add(entry),\n }).then(_ => addFilesAsync(p, files))\n } else {\n p.add(file)\n }\n }\n p.end()\n}\n\nconst createSync = (opt, files) => {\n const p = new Pack.Sync(opt)\n addFilesSync(p, files)\n return p\n}\n\nconst create = (opt, files) => {\n const p = new Pack(opt)\n addFilesAsync(p, files)\n return p\n}\n","'use strict'\n\n// tar -x\nconst hlo = require('./high-level-opt.js')\nconst Unpack = require('./unpack.js')\nconst fs = require('fs')\nconst fsm = require('fs-minipass')\nconst path = require('path')\nconst stripSlash = require('./strip-trailing-slashes.js')\n\nmodule.exports = (opt_, files, cb) => {\n if (typeof opt_ === 'function') {\n cb = opt_, files = null, opt_ = {}\n } else if (Array.isArray(opt_)) {\n files = opt_, opt_ = {}\n }\n\n if (typeof files === 'function') {\n cb = files, files = null\n }\n\n if (!files) {\n files = []\n } else {\n files = Array.from(files)\n }\n\n const opt = hlo(opt_)\n\n if (opt.sync && typeof cb === 'function') {\n throw new TypeError('callback not supported for sync tar functions')\n }\n\n if (!opt.file && typeof cb === 'function') {\n throw new TypeError('callback only supported with file option')\n }\n\n if (files.length) {\n filesFilter(opt, files)\n }\n\n return opt.file && opt.sync ? extractFileSync(opt)\n : opt.file ? extractFile(opt, cb)\n : opt.sync ? extractSync(opt)\n : extract(opt)\n}\n\n// construct a filter that limits the file entries listed\n// include child entries if a dir is included\nconst filesFilter = (opt, files) => {\n const map = new Map(files.map(f => [stripSlash(f), true]))\n const filter = opt.filter\n\n const mapHas = (file, r) => {\n const root = r || path.parse(file).root || '.'\n const ret = file === root ? false\n : map.has(file) ? map.get(file)\n : mapHas(path.dirname(file), root)\n\n map.set(file, ret)\n return ret\n }\n\n opt.filter = filter\n ? (file, entry) => filter(file, entry) && mapHas(stripSlash(file))\n : file => mapHas(stripSlash(file))\n}\n\nconst extractFileSync = opt => {\n const u = new Unpack.Sync(opt)\n\n const file = opt.file\n const stat = fs.statSync(file)\n // This trades a zero-byte read() syscall for a stat\n // However, it will usually result in less memory allocation\n const readSize = opt.maxReadSize || 16 * 1024 * 1024\n const stream = new fsm.ReadStreamSync(file, {\n readSize: readSize,\n size: stat.size,\n })\n stream.pipe(u)\n}\n\nconst extractFile = (opt, cb) => {\n const u = new Unpack(opt)\n const readSize = opt.maxReadSize || 16 * 1024 * 1024\n\n const file = opt.file\n const p = new Promise((resolve, reject) => {\n u.on('error', reject)\n u.on('close', resolve)\n\n // This trades a zero-byte read() syscall for a stat\n // However, it will usually result in less memory allocation\n fs.stat(file, (er, stat) => {\n if (er) {\n reject(er)\n } else {\n const stream = new fsm.ReadStream(file, {\n readSize: readSize,\n size: stat.size,\n })\n stream.on('error', reject)\n stream.pipe(u)\n }\n })\n })\n return cb ? p.then(cb, cb) : p\n}\n\nconst extractSync = opt => new Unpack.Sync(opt)\n\nconst extract = opt => new Unpack(opt)\n","// Get the appropriate flag to use for creating files\n// We use fmap on Windows platforms for files less than\n// 512kb. This is a fairly low limit, but avoids making\n// things slower in some cases. Since most of what this\n// library is used for is extracting tarballs of many\n// relatively small files in npm packages and the like,\n// it can be a big boost on Windows platforms.\n// Only supported in Node v12.9.0 and above.\nconst platform = process.env.__FAKE_PLATFORM__ || process.platform\nconst isWindows = platform === 'win32'\nconst fs = global.__FAKE_TESTING_FS__ || require('fs')\n\n/* istanbul ignore next */\nconst { O_CREAT, O_TRUNC, O_WRONLY, UV_FS_O_FILEMAP = 0 } = fs.constants\n\nconst fMapEnabled = isWindows && !!UV_FS_O_FILEMAP\nconst fMapLimit = 512 * 1024\nconst fMapFlag = UV_FS_O_FILEMAP | O_TRUNC | O_CREAT | O_WRONLY\nmodule.exports = !fMapEnabled ? () => 'w'\n : size => size < fMapLimit ? fMapFlag : 'w'\n","'use strict'\n// parse a 512-byte header block to a data object, or vice-versa\n// encode returns `true` if a pax extended header is needed, because\n// the data could not be faithfully encoded in a simple header.\n// (Also, check header.needPax to see if it needs a pax header.)\n\nconst types = require('./types.js')\nconst pathModule = require('path').posix\nconst large = require('./large-numbers.js')\n\nconst SLURP = Symbol('slurp')\nconst TYPE = Symbol('type')\n\nclass Header {\n constructor (data, off, ex, gex) {\n this.cksumValid = false\n this.needPax = false\n this.nullBlock = false\n\n this.block = null\n this.path = null\n this.mode = null\n this.uid = null\n this.gid = null\n this.size = null\n this.mtime = null\n this.cksum = null\n this[TYPE] = '0'\n this.linkpath = null\n this.uname = null\n this.gname = null\n this.devmaj = 0\n this.devmin = 0\n this.atime = null\n this.ctime = null\n\n if (Buffer.isBuffer(data)) {\n this.decode(data, off || 0, ex, gex)\n } else if (data) {\n this.set(data)\n }\n }\n\n decode (buf, off, ex, gex) {\n if (!off) {\n off = 0\n }\n\n if (!buf || !(buf.length >= off + 512)) {\n throw new Error('need 512 bytes for header')\n }\n\n this.path = decString(buf, off, 100)\n this.mode = decNumber(buf, off + 100, 8)\n this.uid = decNumber(buf, off + 108, 8)\n this.gid = decNumber(buf, off + 116, 8)\n this.size = decNumber(buf, off + 124, 12)\n this.mtime = decDate(buf, off + 136, 12)\n this.cksum = decNumber(buf, off + 148, 12)\n\n // if we have extended or global extended headers, apply them now\n // See https://github.com/npm/node-tar/pull/187\n this[SLURP](ex)\n this[SLURP](gex, true)\n\n // old tar versions marked dirs as a file with a trailing /\n this[TYPE] = decString(buf, off + 156, 1)\n if (this[TYPE] === '') {\n this[TYPE] = '0'\n }\n if (this[TYPE] === '0' && this.path.slice(-1) === '/') {\n this[TYPE] = '5'\n }\n\n // tar implementations sometimes incorrectly put the stat(dir).size\n // as the size in the tarball, even though Directory entries are\n // not able to have any body at all. In the very rare chance that\n // it actually DOES have a body, we weren't going to do anything with\n // it anyway, and it'll just be a warning about an invalid header.\n if (this[TYPE] === '5') {\n this.size = 0\n }\n\n this.linkpath = decString(buf, off + 157, 100)\n if (buf.slice(off + 257, off + 265).toString() === 'ustar\\u000000') {\n this.uname = decString(buf, off + 265, 32)\n this.gname = decString(buf, off + 297, 32)\n this.devmaj = decNumber(buf, off + 329, 8)\n this.devmin = decNumber(buf, off + 337, 8)\n if (buf[off + 475] !== 0) {\n // definitely a prefix, definitely >130 chars.\n const prefix = decString(buf, off + 345, 155)\n this.path = prefix + '/' + this.path\n } else {\n const prefix = decString(buf, off + 345, 130)\n if (prefix) {\n this.path = prefix + '/' + this.path\n }\n this.atime = decDate(buf, off + 476, 12)\n this.ctime = decDate(buf, off + 488, 12)\n }\n }\n\n let sum = 8 * 0x20\n for (let i = off; i < off + 148; i++) {\n sum += buf[i]\n }\n\n for (let i = off + 156; i < off + 512; i++) {\n sum += buf[i]\n }\n\n this.cksumValid = sum === this.cksum\n if (this.cksum === null && sum === 8 * 0x20) {\n this.nullBlock = true\n }\n }\n\n [SLURP] (ex, global) {\n for (const k in ex) {\n // we slurp in everything except for the path attribute in\n // a global extended header, because that's weird.\n if (ex[k] !== null && ex[k] !== undefined &&\n !(global && k === 'path')) {\n this[k] = ex[k]\n }\n }\n }\n\n encode (buf, off) {\n if (!buf) {\n buf = this.block = Buffer.alloc(512)\n off = 0\n }\n\n if (!off) {\n off = 0\n }\n\n if (!(buf.length >= off + 512)) {\n throw new Error('need 512 bytes for header')\n }\n\n const prefixSize = this.ctime || this.atime ? 130 : 155\n const split = splitPrefix(this.path || '', prefixSize)\n const path = split[0]\n const prefix = split[1]\n this.needPax = split[2]\n\n this.needPax = encString(buf, off, 100, path) || this.needPax\n this.needPax = encNumber(buf, off + 100, 8, this.mode) || this.needPax\n this.needPax = encNumber(buf, off + 108, 8, this.uid) || this.needPax\n this.needPax = encNumber(buf, off + 116, 8, this.gid) || this.needPax\n this.needPax = encNumber(buf, off + 124, 12, this.size) || this.needPax\n this.needPax = encDate(buf, off + 136, 12, this.mtime) || this.needPax\n buf[off + 156] = this[TYPE].charCodeAt(0)\n this.needPax = encString(buf, off + 157, 100, this.linkpath) || this.needPax\n buf.write('ustar\\u000000', off + 257, 8)\n this.needPax = encString(buf, off + 265, 32, this.uname) || this.needPax\n this.needPax = encString(buf, off + 297, 32, this.gname) || this.needPax\n this.needPax = encNumber(buf, off + 329, 8, this.devmaj) || this.needPax\n this.needPax = encNumber(buf, off + 337, 8, this.devmin) || this.needPax\n this.needPax = encString(buf, off + 345, prefixSize, prefix) || this.needPax\n if (buf[off + 475] !== 0) {\n this.needPax = encString(buf, off + 345, 155, prefix) || this.needPax\n } else {\n this.needPax = encString(buf, off + 345, 130, prefix) || this.needPax\n this.needPax = encDate(buf, off + 476, 12, this.atime) || this.needPax\n this.needPax = encDate(buf, off + 488, 12, this.ctime) || this.needPax\n }\n\n let sum = 8 * 0x20\n for (let i = off; i < off + 148; i++) {\n sum += buf[i]\n }\n\n for (let i = off + 156; i < off + 512; i++) {\n sum += buf[i]\n }\n\n this.cksum = sum\n encNumber(buf, off + 148, 8, this.cksum)\n this.cksumValid = true\n\n return this.needPax\n }\n\n set (data) {\n for (const i in data) {\n if (data[i] !== null && data[i] !== undefined) {\n this[i] = data[i]\n }\n }\n }\n\n get type () {\n return types.name.get(this[TYPE]) || this[TYPE]\n }\n\n get typeKey () {\n return this[TYPE]\n }\n\n set type (type) {\n if (types.code.has(type)) {\n this[TYPE] = types.code.get(type)\n } else {\n this[TYPE] = type\n }\n }\n}\n\nconst splitPrefix = (p, prefixSize) => {\n const pathSize = 100\n let pp = p\n let prefix = ''\n let ret\n const root = pathModule.parse(p).root || '.'\n\n if (Buffer.byteLength(pp) < pathSize) {\n ret = [pp, prefix, false]\n } else {\n // first set prefix to the dir, and path to the base\n prefix = pathModule.dirname(pp)\n pp = pathModule.basename(pp)\n\n do {\n if (Buffer.byteLength(pp) <= pathSize &&\n Buffer.byteLength(prefix) <= prefixSize) {\n // both fit!\n ret = [pp, prefix, false]\n } else if (Buffer.byteLength(pp) > pathSize &&\n Buffer.byteLength(prefix) <= prefixSize) {\n // prefix fits in prefix, but path doesn't fit in path\n ret = [pp.slice(0, pathSize - 1), prefix, true]\n } else {\n // make path take a bit from prefix\n pp = pathModule.join(pathModule.basename(prefix), pp)\n prefix = pathModule.dirname(prefix)\n }\n } while (prefix !== root && !ret)\n\n // at this point, found no resolution, just truncate\n if (!ret) {\n ret = [p.slice(0, pathSize - 1), '', true]\n }\n }\n return ret\n}\n\nconst decString = (buf, off, size) =>\n buf.slice(off, off + size).toString('utf8').replace(/\\0.*/, '')\n\nconst decDate = (buf, off, size) =>\n numToDate(decNumber(buf, off, size))\n\nconst numToDate = num => num === null ? null : new Date(num * 1000)\n\nconst decNumber = (buf, off, size) =>\n buf[off] & 0x80 ? large.parse(buf.slice(off, off + size))\n : decSmallNumber(buf, off, size)\n\nconst nanNull = value => isNaN(value) ? null : value\n\nconst decSmallNumber = (buf, off, size) =>\n nanNull(parseInt(\n buf.slice(off, off + size)\n .toString('utf8').replace(/\\0.*$/, '').trim(), 8))\n\n// the maximum encodable as a null-terminated octal, by field size\nconst MAXNUM = {\n 12: 0o77777777777,\n 8: 0o7777777,\n}\n\nconst encNumber = (buf, off, size, number) =>\n number === null ? false :\n number > MAXNUM[size] || number < 0\n ? (large.encode(number, buf.slice(off, off + size)), true)\n : (encSmallNumber(buf, off, size, number), false)\n\nconst encSmallNumber = (buf, off, size, number) =>\n buf.write(octalString(number, size), off, size, 'ascii')\n\nconst octalString = (number, size) =>\n padOctal(Math.floor(number).toString(8), size)\n\nconst padOctal = (string, size) =>\n (string.length === size - 1 ? string\n : new Array(size - string.length - 1).join('0') + string + ' ') + '\\0'\n\nconst encDate = (buf, off, size, date) =>\n date === null ? false :\n encNumber(buf, off, size, date.getTime() / 1000)\n\n// enough to fill the longest string we've got\nconst NULLS = new Array(156).join('\\0')\n// pad with nulls, return true if it's longer or non-ascii\nconst encString = (buf, off, size, string) =>\n string === null ? false :\n (buf.write(string + NULLS, off, size, 'utf8'),\n string.length !== Buffer.byteLength(string) || string.length > size)\n\nmodule.exports = Header\n","'use strict'\n\n// turn tar(1) style args like `C` into the more verbose things like `cwd`\n\nconst argmap = new Map([\n ['C', 'cwd'],\n ['f', 'file'],\n ['z', 'gzip'],\n ['P', 'preservePaths'],\n ['U', 'unlink'],\n ['strip-components', 'strip'],\n ['stripComponents', 'strip'],\n ['keep-newer', 'newer'],\n ['keepNewer', 'newer'],\n ['keep-newer-files', 'newer'],\n ['keepNewerFiles', 'newer'],\n ['k', 'keep'],\n ['keep-existing', 'keep'],\n ['keepExisting', 'keep'],\n ['m', 'noMtime'],\n ['no-mtime', 'noMtime'],\n ['p', 'preserveOwner'],\n ['L', 'follow'],\n ['h', 'follow'],\n])\n\nmodule.exports = opt => opt ? Object.keys(opt).map(k => [\n argmap.has(k) ? argmap.get(k) : k, opt[k],\n]).reduce((set, kv) => (set[kv[0]] = kv[1], set), Object.create(null)) : {}\n","'use strict'\n// Tar can encode large and negative numbers using a leading byte of\n// 0xff for negative, and 0x80 for positive.\n\nconst encode = (num, buf) => {\n if (!Number.isSafeInteger(num)) {\n // The number is so large that javascript cannot represent it with integer\n // precision.\n throw Error('cannot encode number outside of javascript safe integer range')\n } else if (num < 0) {\n encodeNegative(num, buf)\n } else {\n encodePositive(num, buf)\n }\n return buf\n}\n\nconst encodePositive = (num, buf) => {\n buf[0] = 0x80\n\n for (var i = buf.length; i > 1; i--) {\n buf[i - 1] = num & 0xff\n num = Math.floor(num / 0x100)\n }\n}\n\nconst encodeNegative = (num, buf) => {\n buf[0] = 0xff\n var flipped = false\n num = num * -1\n for (var i = buf.length; i > 1; i--) {\n var byte = num & 0xff\n num = Math.floor(num / 0x100)\n if (flipped) {\n buf[i - 1] = onesComp(byte)\n } else if (byte === 0) {\n buf[i - 1] = 0\n } else {\n flipped = true\n buf[i - 1] = twosComp(byte)\n }\n }\n}\n\nconst parse = (buf) => {\n const pre = buf[0]\n const value = pre === 0x80 ? pos(buf.slice(1, buf.length))\n : pre === 0xff ? twos(buf)\n : null\n if (value === null) {\n throw Error('invalid base256 encoding')\n }\n\n if (!Number.isSafeInteger(value)) {\n // The number is so large that javascript cannot represent it with integer\n // precision.\n throw Error('parsed number outside of javascript safe integer range')\n }\n\n return value\n}\n\nconst twos = (buf) => {\n var len = buf.length\n var sum = 0\n var flipped = false\n for (var i = len - 1; i > -1; i--) {\n var byte = buf[i]\n var f\n if (flipped) {\n f = onesComp(byte)\n } else if (byte === 0) {\n f = byte\n } else {\n flipped = true\n f = twosComp(byte)\n }\n if (f !== 0) {\n sum -= f * Math.pow(256, len - i - 1)\n }\n }\n return sum\n}\n\nconst pos = (buf) => {\n var len = buf.length\n var sum = 0\n for (var i = len - 1; i > -1; i--) {\n var byte = buf[i]\n if (byte !== 0) {\n sum += byte * Math.pow(256, len - i - 1)\n }\n }\n return sum\n}\n\nconst onesComp = byte => (0xff ^ byte) & 0xff\n\nconst twosComp = byte => ((0xff ^ byte) + 1) & 0xff\n\nmodule.exports = {\n encode,\n parse,\n}\n","'use strict'\n\n// XXX: This shares a lot in common with extract.js\n// maybe some DRY opportunity here?\n\n// tar -t\nconst hlo = require('./high-level-opt.js')\nconst Parser = require('./parse.js')\nconst fs = require('fs')\nconst fsm = require('fs-minipass')\nconst path = require('path')\nconst stripSlash = require('./strip-trailing-slashes.js')\n\nmodule.exports = (opt_, files, cb) => {\n if (typeof opt_ === 'function') {\n cb = opt_, files = null, opt_ = {}\n } else if (Array.isArray(opt_)) {\n files = opt_, opt_ = {}\n }\n\n if (typeof files === 'function') {\n cb = files, files = null\n }\n\n if (!files) {\n files = []\n } else {\n files = Array.from(files)\n }\n\n const opt = hlo(opt_)\n\n if (opt.sync && typeof cb === 'function') {\n throw new TypeError('callback not supported for sync tar functions')\n }\n\n if (!opt.file && typeof cb === 'function') {\n throw new TypeError('callback only supported with file option')\n }\n\n if (files.length) {\n filesFilter(opt, files)\n }\n\n if (!opt.noResume) {\n onentryFunction(opt)\n }\n\n return opt.file && opt.sync ? listFileSync(opt)\n : opt.file ? listFile(opt, cb)\n : list(opt)\n}\n\nconst onentryFunction = opt => {\n const onentry = opt.onentry\n opt.onentry = onentry ? e => {\n onentry(e)\n e.resume()\n } : e => e.resume()\n}\n\n// construct a filter that limits the file entries listed\n// include child entries if a dir is included\nconst filesFilter = (opt, files) => {\n const map = new Map(files.map(f => [stripSlash(f), true]))\n const filter = opt.filter\n\n const mapHas = (file, r) => {\n const root = r || path.parse(file).root || '.'\n const ret = file === root ? false\n : map.has(file) ? map.get(file)\n : mapHas(path.dirname(file), root)\n\n map.set(file, ret)\n return ret\n }\n\n opt.filter = filter\n ? (file, entry) => filter(file, entry) && mapHas(stripSlash(file))\n : file => mapHas(stripSlash(file))\n}\n\nconst listFileSync = opt => {\n const p = list(opt)\n const file = opt.file\n let threw = true\n let fd\n try {\n const stat = fs.statSync(file)\n const readSize = opt.maxReadSize || 16 * 1024 * 1024\n if (stat.size < readSize) {\n p.end(fs.readFileSync(file))\n } else {\n let pos = 0\n const buf = Buffer.allocUnsafe(readSize)\n fd = fs.openSync(file, 'r')\n while (pos < stat.size) {\n const bytesRead = fs.readSync(fd, buf, 0, readSize, pos)\n pos += bytesRead\n p.write(buf.slice(0, bytesRead))\n }\n p.end()\n }\n threw = false\n } finally {\n if (threw && fd) {\n try {\n fs.closeSync(fd)\n } catch (er) {}\n }\n }\n}\n\nconst listFile = (opt, cb) => {\n const parse = new Parser(opt)\n const readSize = opt.maxReadSize || 16 * 1024 * 1024\n\n const file = opt.file\n const p = new Promise((resolve, reject) => {\n parse.on('error', reject)\n parse.on('end', resolve)\n\n fs.stat(file, (er, stat) => {\n if (er) {\n reject(er)\n } else {\n const stream = new fsm.ReadStream(file, {\n readSize: readSize,\n size: stat.size,\n })\n stream.on('error', reject)\n stream.pipe(parse)\n }\n })\n })\n return cb ? p.then(cb, cb) : p\n}\n\nconst list = opt => new Parser(opt)\n","'use strict'\n// wrapper around mkdirp for tar's needs.\n\n// TODO: This should probably be a class, not functionally\n// passing around state in a gazillion args.\n\nconst mkdirp = require('mkdirp')\nconst fs = require('fs')\nconst path = require('path')\nconst chownr = require('chownr')\nconst normPath = require('./normalize-windows-path.js')\n\nclass SymlinkError extends Error {\n constructor (symlink, path) {\n super('Cannot extract through symbolic link')\n this.path = path\n this.symlink = symlink\n }\n\n get name () {\n return 'SylinkError'\n }\n}\n\nclass CwdError extends Error {\n constructor (path, code) {\n super(code + ': Cannot cd into \\'' + path + '\\'')\n this.path = path\n this.code = code\n }\n\n get name () {\n return 'CwdError'\n }\n}\n\nconst cGet = (cache, key) => cache.get(normPath(key))\nconst cSet = (cache, key, val) => cache.set(normPath(key), val)\n\nconst checkCwd = (dir, cb) => {\n fs.stat(dir, (er, st) => {\n if (er || !st.isDirectory()) {\n er = new CwdError(dir, er && er.code || 'ENOTDIR')\n }\n cb(er)\n })\n}\n\nmodule.exports = (dir, opt, cb) => {\n dir = normPath(dir)\n\n // if there's any overlap between mask and mode,\n // then we'll need an explicit chmod\n const umask = opt.umask\n const mode = opt.mode | 0o0700\n const needChmod = (mode & umask) !== 0\n\n const uid = opt.uid\n const gid = opt.gid\n const doChown = typeof uid === 'number' &&\n typeof gid === 'number' &&\n (uid !== opt.processUid || gid !== opt.processGid)\n\n const preserve = opt.preserve\n const unlink = opt.unlink\n const cache = opt.cache\n const cwd = normPath(opt.cwd)\n\n const done = (er, created) => {\n if (er) {\n cb(er)\n } else {\n cSet(cache, dir, true)\n if (created && doChown) {\n chownr(created, uid, gid, er => done(er))\n } else if (needChmod) {\n fs.chmod(dir, mode, cb)\n } else {\n cb()\n }\n }\n }\n\n if (cache && cGet(cache, dir) === true) {\n return done()\n }\n\n if (dir === cwd) {\n return checkCwd(dir, done)\n }\n\n if (preserve) {\n return mkdirp(dir, { mode }).then(made => done(null, made), done)\n }\n\n const sub = normPath(path.relative(cwd, dir))\n const parts = sub.split('/')\n mkdir_(cwd, parts, mode, cache, unlink, cwd, null, done)\n}\n\nconst mkdir_ = (base, parts, mode, cache, unlink, cwd, created, cb) => {\n if (!parts.length) {\n return cb(null, created)\n }\n const p = parts.shift()\n const part = normPath(path.resolve(base + '/' + p))\n if (cGet(cache, part)) {\n return mkdir_(part, parts, mode, cache, unlink, cwd, created, cb)\n }\n fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb))\n}\n\nconst onmkdir = (part, parts, mode, cache, unlink, cwd, created, cb) => er => {\n if (er) {\n fs.lstat(part, (statEr, st) => {\n if (statEr) {\n statEr.path = statEr.path && normPath(statEr.path)\n cb(statEr)\n } else if (st.isDirectory()) {\n mkdir_(part, parts, mode, cache, unlink, cwd, created, cb)\n } else if (unlink) {\n fs.unlink(part, er => {\n if (er) {\n return cb(er)\n }\n fs.mkdir(part, mode, onmkdir(part, parts, mode, cache, unlink, cwd, created, cb))\n })\n } else if (st.isSymbolicLink()) {\n return cb(new SymlinkError(part, part + '/' + parts.join('/')))\n } else {\n cb(er)\n }\n })\n } else {\n created = created || part\n mkdir_(part, parts, mode, cache, unlink, cwd, created, cb)\n }\n}\n\nconst checkCwdSync = dir => {\n let ok = false\n let code = 'ENOTDIR'\n try {\n ok = fs.statSync(dir).isDirectory()\n } catch (er) {\n code = er.code\n } finally {\n if (!ok) {\n throw new CwdError(dir, code)\n }\n }\n}\n\nmodule.exports.sync = (dir, opt) => {\n dir = normPath(dir)\n // if there's any overlap between mask and mode,\n // then we'll need an explicit chmod\n const umask = opt.umask\n const mode = opt.mode | 0o0700\n const needChmod = (mode & umask) !== 0\n\n const uid = opt.uid\n const gid = opt.gid\n const doChown = typeof uid === 'number' &&\n typeof gid === 'number' &&\n (uid !== opt.processUid || gid !== opt.processGid)\n\n const preserve = opt.preserve\n const unlink = opt.unlink\n const cache = opt.cache\n const cwd = normPath(opt.cwd)\n\n const done = (created) => {\n cSet(cache, dir, true)\n if (created && doChown) {\n chownr.sync(created, uid, gid)\n }\n if (needChmod) {\n fs.chmodSync(dir, mode)\n }\n }\n\n if (cache && cGet(cache, dir) === true) {\n return done()\n }\n\n if (dir === cwd) {\n checkCwdSync(cwd)\n return done()\n }\n\n if (preserve) {\n return done(mkdirp.sync(dir, mode))\n }\n\n const sub = normPath(path.relative(cwd, dir))\n const parts = sub.split('/')\n let created = null\n for (let p = parts.shift(), part = cwd;\n p && (part += '/' + p);\n p = parts.shift()) {\n part = normPath(path.resolve(part))\n if (cGet(cache, part)) {\n continue\n }\n\n try {\n fs.mkdirSync(part, mode)\n created = created || part\n cSet(cache, part, true)\n } catch (er) {\n const st = fs.lstatSync(part)\n if (st.isDirectory()) {\n cSet(cache, part, true)\n continue\n } else if (unlink) {\n fs.unlinkSync(part)\n fs.mkdirSync(part, mode)\n created = created || part\n cSet(cache, part, true)\n continue\n } else if (st.isSymbolicLink()) {\n return new SymlinkError(part, part + '/' + parts.join('/'))\n }\n }\n }\n\n return done(created)\n}\n","'use strict'\nmodule.exports = (mode, isDir, portable) => {\n mode &= 0o7777\n\n // in portable mode, use the minimum reasonable umask\n // if this system creates files with 0o664 by default\n // (as some linux distros do), then we'll write the\n // archive with 0o644 instead. Also, don't ever create\n // a file that is not readable/writable by the owner.\n if (portable) {\n mode = (mode | 0o600) & ~0o22\n }\n\n // if dirs are readable, then they should be listable\n if (isDir) {\n if (mode & 0o400) {\n mode |= 0o100\n }\n if (mode & 0o40) {\n mode |= 0o10\n }\n if (mode & 0o4) {\n mode |= 0o1\n }\n }\n return mode\n}\n","// warning: extremely hot code path.\n// This has been meticulously optimized for use\n// within npm install on large package trees.\n// Do not edit without careful benchmarking.\nconst normalizeCache = Object.create(null)\nconst { hasOwnProperty } = Object.prototype\nmodule.exports = s => {\n if (!hasOwnProperty.call(normalizeCache, s)) {\n normalizeCache[s] = s.normalize('NFD')\n }\n return normalizeCache[s]\n}\n","// on windows, either \\ or / are valid directory separators.\n// on unix, \\ is a valid character in filenames.\n// so, on windows, and only on windows, we replace all \\ chars with /,\n// so that we can use / as our one and only directory separator char.\n\nconst platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform\nmodule.exports = platform !== 'win32' ? p => p\n : p => p && p.replace(/\\\\/g, '/')\n","'use strict'\n\n// A readable tar stream creator\n// Technically, this is a transform stream that you write paths into,\n// and tar format comes out of.\n// The `add()` method is like `write()` but returns this,\n// and end() return `this` as well, so you can\n// do `new Pack(opt).add('files').add('dir').end().pipe(output)\n// You could also do something like:\n// streamOfPaths().pipe(new Pack()).pipe(new fs.WriteStream('out.tar'))\n\nclass PackJob {\n constructor (path, absolute) {\n this.path = path || './'\n this.absolute = absolute\n this.entry = null\n this.stat = null\n this.readdir = null\n this.pending = false\n this.ignore = false\n this.piped = false\n }\n}\n\nconst { Minipass } = require('minipass')\nconst zlib = require('minizlib')\nconst ReadEntry = require('./read-entry.js')\nconst WriteEntry = require('./write-entry.js')\nconst WriteEntrySync = WriteEntry.Sync\nconst WriteEntryTar = WriteEntry.Tar\nconst Yallist = require('yallist')\nconst EOF = Buffer.alloc(1024)\nconst ONSTAT = Symbol('onStat')\nconst ENDED = Symbol('ended')\nconst QUEUE = Symbol('queue')\nconst CURRENT = Symbol('current')\nconst PROCESS = Symbol('process')\nconst PROCESSING = Symbol('processing')\nconst PROCESSJOB = Symbol('processJob')\nconst JOBS = Symbol('jobs')\nconst JOBDONE = Symbol('jobDone')\nconst ADDFSENTRY = Symbol('addFSEntry')\nconst ADDTARENTRY = Symbol('addTarEntry')\nconst STAT = Symbol('stat')\nconst READDIR = Symbol('readdir')\nconst ONREADDIR = Symbol('onreaddir')\nconst PIPE = Symbol('pipe')\nconst ENTRY = Symbol('entry')\nconst ENTRYOPT = Symbol('entryOpt')\nconst WRITEENTRYCLASS = Symbol('writeEntryClass')\nconst WRITE = Symbol('write')\nconst ONDRAIN = Symbol('ondrain')\n\nconst fs = require('fs')\nconst path = require('path')\nconst warner = require('./warn-mixin.js')\nconst normPath = require('./normalize-windows-path.js')\n\nconst Pack = warner(class Pack extends Minipass {\n constructor (opt) {\n super(opt)\n opt = opt || Object.create(null)\n this.opt = opt\n this.file = opt.file || ''\n this.cwd = opt.cwd || process.cwd()\n this.maxReadSize = opt.maxReadSize\n this.preservePaths = !!opt.preservePaths\n this.strict = !!opt.strict\n this.noPax = !!opt.noPax\n this.prefix = normPath(opt.prefix || '')\n this.linkCache = opt.linkCache || new Map()\n this.statCache = opt.statCache || new Map()\n this.readdirCache = opt.readdirCache || new Map()\n\n this[WRITEENTRYCLASS] = WriteEntry\n if (typeof opt.onwarn === 'function') {\n this.on('warn', opt.onwarn)\n }\n\n this.portable = !!opt.portable\n this.zip = null\n\n if (opt.gzip || opt.brotli) {\n if (opt.gzip && opt.brotli) {\n throw new TypeError('gzip and brotli are mutually exclusive')\n }\n if (opt.gzip) {\n if (typeof opt.gzip !== 'object') {\n opt.gzip = {}\n }\n if (this.portable) {\n opt.gzip.portable = true\n }\n this.zip = new zlib.Gzip(opt.gzip)\n }\n if (opt.brotli) {\n if (typeof opt.brotli !== 'object') {\n opt.brotli = {}\n }\n this.zip = new zlib.BrotliCompress(opt.brotli)\n }\n this.zip.on('data', chunk => super.write(chunk))\n this.zip.on('end', _ => super.end())\n this.zip.on('drain', _ => this[ONDRAIN]())\n this.on('resume', _ => this.zip.resume())\n } else {\n this.on('drain', this[ONDRAIN])\n }\n\n this.noDirRecurse = !!opt.noDirRecurse\n this.follow = !!opt.follow\n this.noMtime = !!opt.noMtime\n this.mtime = opt.mtime || null\n\n this.filter = typeof opt.filter === 'function' ? opt.filter : _ => true\n\n this[QUEUE] = new Yallist()\n this[JOBS] = 0\n this.jobs = +opt.jobs || 4\n this[PROCESSING] = false\n this[ENDED] = false\n }\n\n [WRITE] (chunk) {\n return super.write(chunk)\n }\n\n add (path) {\n this.write(path)\n return this\n }\n\n end (path) {\n if (path) {\n this.write(path)\n }\n this[ENDED] = true\n this[PROCESS]()\n return this\n }\n\n write (path) {\n if (this[ENDED]) {\n throw new Error('write after end')\n }\n\n if (path instanceof ReadEntry) {\n this[ADDTARENTRY](path)\n } else {\n this[ADDFSENTRY](path)\n }\n return this.flowing\n }\n\n [ADDTARENTRY] (p) {\n const absolute = normPath(path.resolve(this.cwd, p.path))\n // in this case, we don't have to wait for the stat\n if (!this.filter(p.path, p)) {\n p.resume()\n } else {\n const job = new PackJob(p.path, absolute, false)\n job.entry = new WriteEntryTar(p, this[ENTRYOPT](job))\n job.entry.on('end', _ => this[JOBDONE](job))\n this[JOBS] += 1\n this[QUEUE].push(job)\n }\n\n this[PROCESS]()\n }\n\n [ADDFSENTRY] (p) {\n const absolute = normPath(path.resolve(this.cwd, p))\n this[QUEUE].push(new PackJob(p, absolute))\n this[PROCESS]()\n }\n\n [STAT] (job) {\n job.pending = true\n this[JOBS] += 1\n const stat = this.follow ? 'stat' : 'lstat'\n fs[stat](job.absolute, (er, stat) => {\n job.pending = false\n this[JOBS] -= 1\n if (er) {\n this.emit('error', er)\n } else {\n this[ONSTAT](job, stat)\n }\n })\n }\n\n [ONSTAT] (job, stat) {\n this.statCache.set(job.absolute, stat)\n job.stat = stat\n\n // now we have the stat, we can filter it.\n if (!this.filter(job.path, stat)) {\n job.ignore = true\n }\n\n this[PROCESS]()\n }\n\n [READDIR] (job) {\n job.pending = true\n this[JOBS] += 1\n fs.readdir(job.absolute, (er, entries) => {\n job.pending = false\n this[JOBS] -= 1\n if (er) {\n return this.emit('error', er)\n }\n this[ONREADDIR](job, entries)\n })\n }\n\n [ONREADDIR] (job, entries) {\n this.readdirCache.set(job.absolute, entries)\n job.readdir = entries\n this[PROCESS]()\n }\n\n [PROCESS] () {\n if (this[PROCESSING]) {\n return\n }\n\n this[PROCESSING] = true\n for (let w = this[QUEUE].head;\n w !== null && this[JOBS] < this.jobs;\n w = w.next) {\n this[PROCESSJOB](w.value)\n if (w.value.ignore) {\n const p = w.next\n this[QUEUE].removeNode(w)\n w.next = p\n }\n }\n\n this[PROCESSING] = false\n\n if (this[ENDED] && !this[QUEUE].length && this[JOBS] === 0) {\n if (this.zip) {\n this.zip.end(EOF)\n } else {\n super.write(EOF)\n super.end()\n }\n }\n }\n\n get [CURRENT] () {\n return this[QUEUE] && this[QUEUE].head && this[QUEUE].head.value\n }\n\n [JOBDONE] (job) {\n this[QUEUE].shift()\n this[JOBS] -= 1\n this[PROCESS]()\n }\n\n [PROCESSJOB] (job) {\n if (job.pending) {\n return\n }\n\n if (job.entry) {\n if (job === this[CURRENT] && !job.piped) {\n this[PIPE](job)\n }\n return\n }\n\n if (!job.stat) {\n if (this.statCache.has(job.absolute)) {\n this[ONSTAT](job, this.statCache.get(job.absolute))\n } else {\n this[STAT](job)\n }\n }\n if (!job.stat) {\n return\n }\n\n // filtered out!\n if (job.ignore) {\n return\n }\n\n if (!this.noDirRecurse && job.stat.isDirectory() && !job.readdir) {\n if (this.readdirCache.has(job.absolute)) {\n this[ONREADDIR](job, this.readdirCache.get(job.absolute))\n } else {\n this[READDIR](job)\n }\n if (!job.readdir) {\n return\n }\n }\n\n // we know it doesn't have an entry, because that got checked above\n job.entry = this[ENTRY](job)\n if (!job.entry) {\n job.ignore = true\n return\n }\n\n if (job === this[CURRENT] && !job.piped) {\n this[PIPE](job)\n }\n }\n\n [ENTRYOPT] (job) {\n return {\n onwarn: (code, msg, data) => this.warn(code, msg, data),\n noPax: this.noPax,\n cwd: this.cwd,\n absolute: job.absolute,\n preservePaths: this.preservePaths,\n maxReadSize: this.maxReadSize,\n strict: this.strict,\n portable: this.portable,\n linkCache: this.linkCache,\n statCache: this.statCache,\n noMtime: this.noMtime,\n mtime: this.mtime,\n prefix: this.prefix,\n }\n }\n\n [ENTRY] (job) {\n this[JOBS] += 1\n try {\n return new this[WRITEENTRYCLASS](job.path, this[ENTRYOPT](job))\n .on('end', () => this[JOBDONE](job))\n .on('error', er => this.emit('error', er))\n } catch (er) {\n this.emit('error', er)\n }\n }\n\n [ONDRAIN] () {\n if (this[CURRENT] && this[CURRENT].entry) {\n this[CURRENT].entry.resume()\n }\n }\n\n // like .pipe() but using super, because our write() is special\n [PIPE] (job) {\n job.piped = true\n\n if (job.readdir) {\n job.readdir.forEach(entry => {\n const p = job.path\n const base = p === './' ? '' : p.replace(/\\/*$/, '/')\n this[ADDFSENTRY](base + entry)\n })\n }\n\n const source = job.entry\n const zip = this.zip\n\n if (zip) {\n source.on('data', chunk => {\n if (!zip.write(chunk)) {\n source.pause()\n }\n })\n } else {\n source.on('data', chunk => {\n if (!super.write(chunk)) {\n source.pause()\n }\n })\n }\n }\n\n pause () {\n if (this.zip) {\n this.zip.pause()\n }\n return super.pause()\n }\n})\n\nclass PackSync extends Pack {\n constructor (opt) {\n super(opt)\n this[WRITEENTRYCLASS] = WriteEntrySync\n }\n\n // pause/resume are no-ops in sync streams.\n pause () {}\n resume () {}\n\n [STAT] (job) {\n const stat = this.follow ? 'statSync' : 'lstatSync'\n this[ONSTAT](job, fs[stat](job.absolute))\n }\n\n [READDIR] (job, stat) {\n this[ONREADDIR](job, fs.readdirSync(job.absolute))\n }\n\n // gotta get it all in this tick\n [PIPE] (job) {\n const source = job.entry\n const zip = this.zip\n\n if (job.readdir) {\n job.readdir.forEach(entry => {\n const p = job.path\n const base = p === './' ? '' : p.replace(/\\/*$/, '/')\n this[ADDFSENTRY](base + entry)\n })\n }\n\n if (zip) {\n source.on('data', chunk => {\n zip.write(chunk)\n })\n } else {\n source.on('data', chunk => {\n super[WRITE](chunk)\n })\n }\n }\n}\n\nPack.Sync = PackSync\n\nmodule.exports = Pack\n","'use strict'\n\n// this[BUFFER] is the remainder of a chunk if we're waiting for\n// the full 512 bytes of a header to come in. We will Buffer.concat()\n// it to the next write(), which is a mem copy, but a small one.\n//\n// this[QUEUE] is a Yallist of entries that haven't been emitted\n// yet this can only get filled up if the user keeps write()ing after\n// a write() returns false, or does a write() with more than one entry\n//\n// We don't buffer chunks, we always parse them and either create an\n// entry, or push it into the active entry. The ReadEntry class knows\n// to throw data away if .ignore=true\n//\n// Shift entry off the buffer when it emits 'end', and emit 'entry' for\n// the next one in the list.\n//\n// At any time, we're pushing body chunks into the entry at WRITEENTRY,\n// and waiting for 'end' on the entry at READENTRY\n//\n// ignored entries get .resume() called on them straight away\n\nconst warner = require('./warn-mixin.js')\nconst Header = require('./header.js')\nconst EE = require('events')\nconst Yallist = require('yallist')\nconst maxMetaEntrySize = 1024 * 1024\nconst Entry = require('./read-entry.js')\nconst Pax = require('./pax.js')\nconst zlib = require('minizlib')\nconst { nextTick } = require('process')\n\nconst gzipHeader = Buffer.from([0x1f, 0x8b])\nconst STATE = Symbol('state')\nconst WRITEENTRY = Symbol('writeEntry')\nconst READENTRY = Symbol('readEntry')\nconst NEXTENTRY = Symbol('nextEntry')\nconst PROCESSENTRY = Symbol('processEntry')\nconst EX = Symbol('extendedHeader')\nconst GEX = Symbol('globalExtendedHeader')\nconst META = Symbol('meta')\nconst EMITMETA = Symbol('emitMeta')\nconst BUFFER = Symbol('buffer')\nconst QUEUE = Symbol('queue')\nconst ENDED = Symbol('ended')\nconst EMITTEDEND = Symbol('emittedEnd')\nconst EMIT = Symbol('emit')\nconst UNZIP = Symbol('unzip')\nconst CONSUMECHUNK = Symbol('consumeChunk')\nconst CONSUMECHUNKSUB = Symbol('consumeChunkSub')\nconst CONSUMEBODY = Symbol('consumeBody')\nconst CONSUMEMETA = Symbol('consumeMeta')\nconst CONSUMEHEADER = Symbol('consumeHeader')\nconst CONSUMING = Symbol('consuming')\nconst BUFFERCONCAT = Symbol('bufferConcat')\nconst MAYBEEND = Symbol('maybeEnd')\nconst WRITING = Symbol('writing')\nconst ABORTED = Symbol('aborted')\nconst DONE = Symbol('onDone')\nconst SAW_VALID_ENTRY = Symbol('sawValidEntry')\nconst SAW_NULL_BLOCK = Symbol('sawNullBlock')\nconst SAW_EOF = Symbol('sawEOF')\nconst CLOSESTREAM = Symbol('closeStream')\n\nconst noop = _ => true\n\nmodule.exports = warner(class Parser extends EE {\n constructor (opt) {\n opt = opt || {}\n super(opt)\n\n this.file = opt.file || ''\n\n // set to boolean false when an entry starts. 1024 bytes of \\0\n // is technically a valid tarball, albeit a boring one.\n this[SAW_VALID_ENTRY] = null\n\n // these BADARCHIVE errors can't be detected early. listen on DONE.\n this.on(DONE, _ => {\n if (this[STATE] === 'begin' || this[SAW_VALID_ENTRY] === false) {\n // either less than 1 block of data, or all entries were invalid.\n // Either way, probably not even a tarball.\n this.warn('TAR_BAD_ARCHIVE', 'Unrecognized archive format')\n }\n })\n\n if (opt.ondone) {\n this.on(DONE, opt.ondone)\n } else {\n this.on(DONE, _ => {\n this.emit('prefinish')\n this.emit('finish')\n this.emit('end')\n })\n }\n\n this.strict = !!opt.strict\n this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize\n this.filter = typeof opt.filter === 'function' ? opt.filter : noop\n // Unlike gzip, brotli doesn't have any magic bytes to identify it\n // Users need to explicitly tell us they're extracting a brotli file\n // Or we infer from the file extension\n const isTBR = (opt.file && (\n opt.file.endsWith('.tar.br') || opt.file.endsWith('.tbr')))\n // if it's a tbr file it MIGHT be brotli, but we don't know until\n // we look at it and verify it's not a valid tar file.\n this.brotli = !opt.gzip && opt.brotli !== undefined ? opt.brotli\n : isTBR ? undefined\n : false\n\n // have to set this so that streams are ok piping into it\n this.writable = true\n this.readable = false\n\n this[QUEUE] = new Yallist()\n this[BUFFER] = null\n this[READENTRY] = null\n this[WRITEENTRY] = null\n this[STATE] = 'begin'\n this[META] = ''\n this[EX] = null\n this[GEX] = null\n this[ENDED] = false\n this[UNZIP] = null\n this[ABORTED] = false\n this[SAW_NULL_BLOCK] = false\n this[SAW_EOF] = false\n\n this.on('end', () => this[CLOSESTREAM]())\n\n if (typeof opt.onwarn === 'function') {\n this.on('warn', opt.onwarn)\n }\n if (typeof opt.onentry === 'function') {\n this.on('entry', opt.onentry)\n }\n }\n\n [CONSUMEHEADER] (chunk, position) {\n if (this[SAW_VALID_ENTRY] === null) {\n this[SAW_VALID_ENTRY] = false\n }\n let header\n try {\n header = new Header(chunk, position, this[EX], this[GEX])\n } catch (er) {\n return this.warn('TAR_ENTRY_INVALID', er)\n }\n\n if (header.nullBlock) {\n if (this[SAW_NULL_BLOCK]) {\n this[SAW_EOF] = true\n // ending an archive with no entries. pointless, but legal.\n if (this[STATE] === 'begin') {\n this[STATE] = 'header'\n }\n this[EMIT]('eof')\n } else {\n this[SAW_NULL_BLOCK] = true\n this[EMIT]('nullBlock')\n }\n } else {\n this[SAW_NULL_BLOCK] = false\n if (!header.cksumValid) {\n this.warn('TAR_ENTRY_INVALID', 'checksum failure', { header })\n } else if (!header.path) {\n this.warn('TAR_ENTRY_INVALID', 'path is required', { header })\n } else {\n const type = header.type\n if (/^(Symbolic)?Link$/.test(type) && !header.linkpath) {\n this.warn('TAR_ENTRY_INVALID', 'linkpath required', { header })\n } else if (!/^(Symbolic)?Link$/.test(type) && header.linkpath) {\n this.warn('TAR_ENTRY_INVALID', 'linkpath forbidden', { header })\n } else {\n const entry = this[WRITEENTRY] = new Entry(header, this[EX], this[GEX])\n\n // we do this for meta & ignored entries as well, because they\n // are still valid tar, or else we wouldn't know to ignore them\n if (!this[SAW_VALID_ENTRY]) {\n if (entry.remain) {\n // this might be the one!\n const onend = () => {\n if (!entry.invalid) {\n this[SAW_VALID_ENTRY] = true\n }\n }\n entry.on('end', onend)\n } else {\n this[SAW_VALID_ENTRY] = true\n }\n }\n\n if (entry.meta) {\n if (entry.size > this.maxMetaEntrySize) {\n entry.ignore = true\n this[EMIT]('ignoredEntry', entry)\n this[STATE] = 'ignore'\n entry.resume()\n } else if (entry.size > 0) {\n this[META] = ''\n entry.on('data', c => this[META] += c)\n this[STATE] = 'meta'\n }\n } else {\n this[EX] = null\n entry.ignore = entry.ignore || !this.filter(entry.path, entry)\n\n if (entry.ignore) {\n // probably valid, just not something we care about\n this[EMIT]('ignoredEntry', entry)\n this[STATE] = entry.remain ? 'ignore' : 'header'\n entry.resume()\n } else {\n if (entry.remain) {\n this[STATE] = 'body'\n } else {\n this[STATE] = 'header'\n entry.end()\n }\n\n if (!this[READENTRY]) {\n this[QUEUE].push(entry)\n this[NEXTENTRY]()\n } else {\n this[QUEUE].push(entry)\n }\n }\n }\n }\n }\n }\n }\n\n [CLOSESTREAM] () {\n nextTick(() => this.emit('close'))\n }\n\n [PROCESSENTRY] (entry) {\n let go = true\n\n if (!entry) {\n this[READENTRY] = null\n go = false\n } else if (Array.isArray(entry)) {\n this.emit.apply(this, entry)\n } else {\n this[READENTRY] = entry\n this.emit('entry', entry)\n if (!entry.emittedEnd) {\n entry.on('end', _ => this[NEXTENTRY]())\n go = false\n }\n }\n\n return go\n }\n\n [NEXTENTRY] () {\n do {} while (this[PROCESSENTRY](this[QUEUE].shift()))\n\n if (!this[QUEUE].length) {\n // At this point, there's nothing in the queue, but we may have an\n // entry which is being consumed (readEntry).\n // If we don't, then we definitely can handle more data.\n // If we do, and either it's flowing, or it has never had any data\n // written to it, then it needs more.\n // The only other possibility is that it has returned false from a\n // write() call, so we wait for the next drain to continue.\n const re = this[READENTRY]\n const drainNow = !re || re.flowing || re.size === re.remain\n if (drainNow) {\n if (!this[WRITING]) {\n this.emit('drain')\n }\n } else {\n re.once('drain', _ => this.emit('drain'))\n }\n }\n }\n\n [CONSUMEBODY] (chunk, position) {\n // write up to but no more than writeEntry.blockRemain\n const entry = this[WRITEENTRY]\n const br = entry.blockRemain\n const c = (br >= chunk.length && position === 0) ? chunk\n : chunk.slice(position, position + br)\n\n entry.write(c)\n\n if (!entry.blockRemain) {\n this[STATE] = 'header'\n this[WRITEENTRY] = null\n entry.end()\n }\n\n return c.length\n }\n\n [CONSUMEMETA] (chunk, position) {\n const entry = this[WRITEENTRY]\n const ret = this[CONSUMEBODY](chunk, position)\n\n // if we finished, then the entry is reset\n if (!this[WRITEENTRY]) {\n this[EMITMETA](entry)\n }\n\n return ret\n }\n\n [EMIT] (ev, data, extra) {\n if (!this[QUEUE].length && !this[READENTRY]) {\n this.emit(ev, data, extra)\n } else {\n this[QUEUE].push([ev, data, extra])\n }\n }\n\n [EMITMETA] (entry) {\n this[EMIT]('meta', this[META])\n switch (entry.type) {\n case 'ExtendedHeader':\n case 'OldExtendedHeader':\n this[EX] = Pax.parse(this[META], this[EX], false)\n break\n\n case 'GlobalExtendedHeader':\n this[GEX] = Pax.parse(this[META], this[GEX], true)\n break\n\n case 'NextFileHasLongPath':\n case 'OldGnuLongPath':\n this[EX] = this[EX] || Object.create(null)\n this[EX].path = this[META].replace(/\\0.*/, '')\n break\n\n case 'NextFileHasLongLinkpath':\n this[EX] = this[EX] || Object.create(null)\n this[EX].linkpath = this[META].replace(/\\0.*/, '')\n break\n\n /* istanbul ignore next */\n default: throw new Error('unknown meta: ' + entry.type)\n }\n }\n\n abort (error) {\n this[ABORTED] = true\n this.emit('abort', error)\n // always throws, even in non-strict mode\n this.warn('TAR_ABORT', error, { recoverable: false })\n }\n\n write (chunk) {\n if (this[ABORTED]) {\n return\n }\n\n // first write, might be gzipped\n const needSniff = this[UNZIP] === null ||\n this.brotli === undefined && this[UNZIP] === false\n if (needSniff && chunk) {\n if (this[BUFFER]) {\n chunk = Buffer.concat([this[BUFFER], chunk])\n this[BUFFER] = null\n }\n if (chunk.length < gzipHeader.length) {\n this[BUFFER] = chunk\n return true\n }\n\n // look for gzip header\n for (let i = 0; this[UNZIP] === null && i < gzipHeader.length; i++) {\n if (chunk[i] !== gzipHeader[i]) {\n this[UNZIP] = false\n }\n }\n\n const maybeBrotli = this.brotli === undefined\n if (this[UNZIP] === false && maybeBrotli) {\n // read the first header to see if it's a valid tar file. If so,\n // we can safely assume that it's not actually brotli, despite the\n // .tbr or .tar.br file extension.\n // if we ended before getting a full chunk, yes, def brotli\n if (chunk.length < 512) {\n if (this[ENDED]) {\n this.brotli = true\n } else {\n this[BUFFER] = chunk\n return true\n }\n } else {\n // if it's tar, it's pretty reliably not brotli, chances of\n // that happening are astronomical.\n try {\n new Header(chunk.slice(0, 512))\n this.brotli = false\n } catch (_) {\n this.brotli = true\n }\n }\n }\n\n if (this[UNZIP] === null || (this[UNZIP] === false && this.brotli)) {\n const ended = this[ENDED]\n this[ENDED] = false\n this[UNZIP] = this[UNZIP] === null\n ? new zlib.Unzip()\n : new zlib.BrotliDecompress()\n this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk))\n this[UNZIP].on('error', er => this.abort(er))\n this[UNZIP].on('end', _ => {\n this[ENDED] = true\n this[CONSUMECHUNK]()\n })\n this[WRITING] = true\n const ret = this[UNZIP][ended ? 'end' : 'write'](chunk)\n this[WRITING] = false\n return ret\n }\n }\n\n this[WRITING] = true\n if (this[UNZIP]) {\n this[UNZIP].write(chunk)\n } else {\n this[CONSUMECHUNK](chunk)\n }\n this[WRITING] = false\n\n // return false if there's a queue, or if the current entry isn't flowing\n const ret =\n this[QUEUE].length ? false :\n this[READENTRY] ? this[READENTRY].flowing :\n true\n\n // if we have no queue, then that means a clogged READENTRY\n if (!ret && !this[QUEUE].length) {\n this[READENTRY].once('drain', _ => this.emit('drain'))\n }\n\n return ret\n }\n\n [BUFFERCONCAT] (c) {\n if (c && !this[ABORTED]) {\n this[BUFFER] = this[BUFFER] ? Buffer.concat([this[BUFFER], c]) : c\n }\n }\n\n [MAYBEEND] () {\n if (this[ENDED] &&\n !this[EMITTEDEND] &&\n !this[ABORTED] &&\n !this[CONSUMING]) {\n this[EMITTEDEND] = true\n const entry = this[WRITEENTRY]\n if (entry && entry.blockRemain) {\n // truncated, likely a damaged file\n const have = this[BUFFER] ? this[BUFFER].length : 0\n this.warn('TAR_BAD_ARCHIVE', `Truncated input (needed ${\n entry.blockRemain} more bytes, only ${have} available)`, { entry })\n if (this[BUFFER]) {\n entry.write(this[BUFFER])\n }\n entry.end()\n }\n this[EMIT](DONE)\n }\n }\n\n [CONSUMECHUNK] (chunk) {\n if (this[CONSUMING]) {\n this[BUFFERCONCAT](chunk)\n } else if (!chunk && !this[BUFFER]) {\n this[MAYBEEND]()\n } else {\n this[CONSUMING] = true\n if (this[BUFFER]) {\n this[BUFFERCONCAT](chunk)\n const c = this[BUFFER]\n this[BUFFER] = null\n this[CONSUMECHUNKSUB](c)\n } else {\n this[CONSUMECHUNKSUB](chunk)\n }\n\n while (this[BUFFER] &&\n this[BUFFER].length >= 512 &&\n !this[ABORTED] &&\n !this[SAW_EOF]) {\n const c = this[BUFFER]\n this[BUFFER] = null\n this[CONSUMECHUNKSUB](c)\n }\n this[CONSUMING] = false\n }\n\n if (!this[BUFFER] || this[ENDED]) {\n this[MAYBEEND]()\n }\n }\n\n [CONSUMECHUNKSUB] (chunk) {\n // we know that we are in CONSUMING mode, so anything written goes into\n // the buffer. Advance the position and put any remainder in the buffer.\n let position = 0\n const length = chunk.length\n while (position + 512 <= length && !this[ABORTED] && !this[SAW_EOF]) {\n switch (this[STATE]) {\n case 'begin':\n case 'header':\n this[CONSUMEHEADER](chunk, position)\n position += 512\n break\n\n case 'ignore':\n case 'body':\n position += this[CONSUMEBODY](chunk, position)\n break\n\n case 'meta':\n position += this[CONSUMEMETA](chunk, position)\n break\n\n /* istanbul ignore next */\n default:\n throw new Error('invalid state: ' + this[STATE])\n }\n }\n\n if (position < length) {\n if (this[BUFFER]) {\n this[BUFFER] = Buffer.concat([chunk.slice(position), this[BUFFER]])\n } else {\n this[BUFFER] = chunk.slice(position)\n }\n }\n }\n\n end (chunk) {\n if (!this[ABORTED]) {\n if (this[UNZIP]) {\n this[UNZIP].end(chunk)\n } else {\n this[ENDED] = true\n if (this.brotli === undefined) chunk = chunk || Buffer.alloc(0)\n this.write(chunk)\n }\n }\n }\n})\n","// A path exclusive reservation system\n// reserve([list, of, paths], fn)\n// When the fn is first in line for all its paths, it\n// is called with a cb that clears the reservation.\n//\n// Used by async unpack to avoid clobbering paths in use,\n// while still allowing maximal safe parallelization.\n\nconst assert = require('assert')\nconst normalize = require('./normalize-unicode.js')\nconst stripSlashes = require('./strip-trailing-slashes.js')\nconst { join } = require('path')\n\nconst platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform\nconst isWindows = platform === 'win32'\n\nmodule.exports = () => {\n // path => [function or Set]\n // A Set object means a directory reservation\n // A fn is a direct reservation on that path\n const queues = new Map()\n\n // fn => {paths:[path,...], dirs:[path, ...]}\n const reservations = new Map()\n\n // return a set of parent dirs for a given path\n // '/a/b/c/d' -> ['/', '/a', '/a/b', '/a/b/c', '/a/b/c/d']\n const getDirs = path => {\n const dirs = path.split('/').slice(0, -1).reduce((set, path) => {\n if (set.length) {\n path = join(set[set.length - 1], path)\n }\n set.push(path || '/')\n return set\n }, [])\n return dirs\n }\n\n // functions currently running\n const running = new Set()\n\n // return the queues for each path the function cares about\n // fn => {paths, dirs}\n const getQueues = fn => {\n const res = reservations.get(fn)\n /* istanbul ignore if - unpossible */\n if (!res) {\n throw new Error('function does not have any path reservations')\n }\n return {\n paths: res.paths.map(path => queues.get(path)),\n dirs: [...res.dirs].map(path => queues.get(path)),\n }\n }\n\n // check if fn is first in line for all its paths, and is\n // included in the first set for all its dir queues\n const check = fn => {\n const { paths, dirs } = getQueues(fn)\n return paths.every(q => q[0] === fn) &&\n dirs.every(q => q[0] instanceof Set && q[0].has(fn))\n }\n\n // run the function if it's first in line and not already running\n const run = fn => {\n if (running.has(fn) || !check(fn)) {\n return false\n }\n running.add(fn)\n fn(() => clear(fn))\n return true\n }\n\n const clear = fn => {\n if (!running.has(fn)) {\n return false\n }\n\n const { paths, dirs } = reservations.get(fn)\n const next = new Set()\n\n paths.forEach(path => {\n const q = queues.get(path)\n assert.equal(q[0], fn)\n if (q.length === 1) {\n queues.delete(path)\n } else {\n q.shift()\n if (typeof q[0] === 'function') {\n next.add(q[0])\n } else {\n q[0].forEach(fn => next.add(fn))\n }\n }\n })\n\n dirs.forEach(dir => {\n const q = queues.get(dir)\n assert(q[0] instanceof Set)\n if (q[0].size === 1 && q.length === 1) {\n queues.delete(dir)\n } else if (q[0].size === 1) {\n q.shift()\n\n // must be a function or else the Set would've been reused\n next.add(q[0])\n } else {\n q[0].delete(fn)\n }\n })\n running.delete(fn)\n\n next.forEach(fn => run(fn))\n return true\n }\n\n const reserve = (paths, fn) => {\n // collide on matches across case and unicode normalization\n // On windows, thanks to the magic of 8.3 shortnames, it is fundamentally\n // impossible to determine whether two paths refer to the same thing on\n // disk, without asking the kernel for a shortname.\n // So, we just pretend that every path matches every other path here,\n // effectively removing all parallelization on windows.\n paths = isWindows ? ['win32 parallelization disabled'] : paths.map(p => {\n // don't need normPath, because we skip this entirely for windows\n return stripSlashes(join(normalize(p))).toLowerCase()\n })\n\n const dirs = new Set(\n paths.map(path => getDirs(path)).reduce((a, b) => a.concat(b))\n )\n reservations.set(fn, { dirs, paths })\n paths.forEach(path => {\n const q = queues.get(path)\n if (!q) {\n queues.set(path, [fn])\n } else {\n q.push(fn)\n }\n })\n dirs.forEach(dir => {\n const q = queues.get(dir)\n if (!q) {\n queues.set(dir, [new Set([fn])])\n } else if (q[q.length - 1] instanceof Set) {\n q[q.length - 1].add(fn)\n } else {\n q.push(new Set([fn]))\n }\n })\n\n return run(fn)\n }\n\n return { check, reserve }\n}\n","'use strict'\nconst Header = require('./header.js')\nconst path = require('path')\n\nclass Pax {\n constructor (obj, global) {\n this.atime = obj.atime || null\n this.charset = obj.charset || null\n this.comment = obj.comment || null\n this.ctime = obj.ctime || null\n this.gid = obj.gid || null\n this.gname = obj.gname || null\n this.linkpath = obj.linkpath || null\n this.mtime = obj.mtime || null\n this.path = obj.path || null\n this.size = obj.size || null\n this.uid = obj.uid || null\n this.uname = obj.uname || null\n this.dev = obj.dev || null\n this.ino = obj.ino || null\n this.nlink = obj.nlink || null\n this.global = global || false\n }\n\n encode () {\n const body = this.encodeBody()\n if (body === '') {\n return null\n }\n\n const bodyLen = Buffer.byteLength(body)\n // round up to 512 bytes\n // add 512 for header\n const bufLen = 512 * Math.ceil(1 + bodyLen / 512)\n const buf = Buffer.allocUnsafe(bufLen)\n\n // 0-fill the header section, it might not hit every field\n for (let i = 0; i < 512; i++) {\n buf[i] = 0\n }\n\n new Header({\n // XXX split the path\n // then the path should be PaxHeader + basename, but less than 99,\n // prepend with the dirname\n path: ('PaxHeader/' + path.basename(this.path)).slice(0, 99),\n mode: this.mode || 0o644,\n uid: this.uid || null,\n gid: this.gid || null,\n size: bodyLen,\n mtime: this.mtime || null,\n type: this.global ? 'GlobalExtendedHeader' : 'ExtendedHeader',\n linkpath: '',\n uname: this.uname || '',\n gname: this.gname || '',\n devmaj: 0,\n devmin: 0,\n atime: this.atime || null,\n ctime: this.ctime || null,\n }).encode(buf)\n\n buf.write(body, 512, bodyLen, 'utf8')\n\n // null pad after the body\n for (let i = bodyLen + 512; i < buf.length; i++) {\n buf[i] = 0\n }\n\n return buf\n }\n\n encodeBody () {\n return (\n this.encodeField('path') +\n this.encodeField('ctime') +\n this.encodeField('atime') +\n this.encodeField('dev') +\n this.encodeField('ino') +\n this.encodeField('nlink') +\n this.encodeField('charset') +\n this.encodeField('comment') +\n this.encodeField('gid') +\n this.encodeField('gname') +\n this.encodeField('linkpath') +\n this.encodeField('mtime') +\n this.encodeField('size') +\n this.encodeField('uid') +\n this.encodeField('uname')\n )\n }\n\n encodeField (field) {\n if (this[field] === null || this[field] === undefined) {\n return ''\n }\n const v = this[field] instanceof Date ? this[field].getTime() / 1000\n : this[field]\n const s = ' ' +\n (field === 'dev' || field === 'ino' || field === 'nlink'\n ? 'SCHILY.' : '') +\n field + '=' + v + '\\n'\n const byteLen = Buffer.byteLength(s)\n // the digits includes the length of the digits in ascii base-10\n // so if it's 9 characters, then adding 1 for the 9 makes it 10\n // which makes it 11 chars.\n let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1\n if (byteLen + digits >= Math.pow(10, digits)) {\n digits += 1\n }\n const len = digits + byteLen\n return len + s\n }\n}\n\nPax.parse = (string, ex, g) => new Pax(merge(parseKV(string), ex), g)\n\nconst merge = (a, b) =>\n b ? Object.keys(a).reduce((s, k) => (s[k] = a[k], s), b) : a\n\nconst parseKV = string =>\n string\n .replace(/\\n$/, '')\n .split('\\n')\n .reduce(parseKVLine, Object.create(null))\n\nconst parseKVLine = (set, line) => {\n const n = parseInt(line, 10)\n\n // XXX Values with \\n in them will fail this.\n // Refactor to not be a naive line-by-line parse.\n if (n !== Buffer.byteLength(line) + 1) {\n return set\n }\n\n line = line.slice((n + ' ').length)\n const kv = line.split('=')\n const k = kv.shift().replace(/^SCHILY\\.(dev|ino|nlink)/, '$1')\n if (!k) {\n return set\n }\n\n const v = kv.join('=')\n set[k] = /^([A-Z]+\\.)?([mac]|birth|creation)time$/.test(k)\n ? new Date(v * 1000)\n : /^[0-9]+$/.test(v) ? +v\n : v\n return set\n}\n\nmodule.exports = Pax\n","'use strict'\nconst { Minipass } = require('minipass')\nconst normPath = require('./normalize-windows-path.js')\n\nconst SLURP = Symbol('slurp')\nmodule.exports = class ReadEntry extends Minipass {\n constructor (header, ex, gex) {\n super()\n // read entries always start life paused. this is to avoid the\n // situation where Minipass's auto-ending empty streams results\n // in an entry ending before we're ready for it.\n this.pause()\n this.extended = ex\n this.globalExtended = gex\n this.header = header\n this.startBlockSize = 512 * Math.ceil(header.size / 512)\n this.blockRemain = this.startBlockSize\n this.remain = header.size\n this.type = header.type\n this.meta = false\n this.ignore = false\n switch (this.type) {\n case 'File':\n case 'OldFile':\n case 'Link':\n case 'SymbolicLink':\n case 'CharacterDevice':\n case 'BlockDevice':\n case 'Directory':\n case 'FIFO':\n case 'ContiguousFile':\n case 'GNUDumpDir':\n break\n\n case 'NextFileHasLongLinkpath':\n case 'NextFileHasLongPath':\n case 'OldGnuLongPath':\n case 'GlobalExtendedHeader':\n case 'ExtendedHeader':\n case 'OldExtendedHeader':\n this.meta = true\n break\n\n // NOTE: gnutar and bsdtar treat unrecognized types as 'File'\n // it may be worth doing the same, but with a warning.\n default:\n this.ignore = true\n }\n\n this.path = normPath(header.path)\n this.mode = header.mode\n if (this.mode) {\n this.mode = this.mode & 0o7777\n }\n this.uid = header.uid\n this.gid = header.gid\n this.uname = header.uname\n this.gname = header.gname\n this.size = header.size\n this.mtime = header.mtime\n this.atime = header.atime\n this.ctime = header.ctime\n this.linkpath = normPath(header.linkpath)\n this.uname = header.uname\n this.gname = header.gname\n\n if (ex) {\n this[SLURP](ex)\n }\n if (gex) {\n this[SLURP](gex, true)\n }\n }\n\n write (data) {\n const writeLen = data.length\n if (writeLen > this.blockRemain) {\n throw new Error('writing more to entry than is appropriate')\n }\n\n const r = this.remain\n const br = this.blockRemain\n this.remain = Math.max(0, r - writeLen)\n this.blockRemain = Math.max(0, br - writeLen)\n if (this.ignore) {\n return true\n }\n\n if (r >= writeLen) {\n return super.write(data)\n }\n\n // r < writeLen\n return super.write(data.slice(0, r))\n }\n\n [SLURP] (ex, global) {\n for (const k in ex) {\n // we slurp in everything except for the path attribute in\n // a global extended header, because that's weird.\n if (ex[k] !== null && ex[k] !== undefined &&\n !(global && k === 'path')) {\n this[k] = k === 'path' || k === 'linkpath' ? normPath(ex[k]) : ex[k]\n }\n }\n }\n}\n","'use strict'\n\n// tar -r\nconst hlo = require('./high-level-opt.js')\nconst Pack = require('./pack.js')\nconst fs = require('fs')\nconst fsm = require('fs-minipass')\nconst t = require('./list.js')\nconst path = require('path')\n\n// starting at the head of the file, read a Header\n// If the checksum is invalid, that's our position to start writing\n// If it is, jump forward by the specified size (round up to 512)\n// and try again.\n// Write the new Pack stream starting there.\n\nconst Header = require('./header.js')\n\nmodule.exports = (opt_, files, cb) => {\n const opt = hlo(opt_)\n\n if (!opt.file) {\n throw new TypeError('file is required')\n }\n\n if (opt.gzip || opt.brotli || opt.file.endsWith('.br') || opt.file.endsWith('.tbr')) {\n throw new TypeError('cannot append to compressed archives')\n }\n\n if (!files || !Array.isArray(files) || !files.length) {\n throw new TypeError('no files or directories specified')\n }\n\n files = Array.from(files)\n\n return opt.sync ? replaceSync(opt, files)\n : replace(opt, files, cb)\n}\n\nconst replaceSync = (opt, files) => {\n const p = new Pack.Sync(opt)\n\n let threw = true\n let fd\n let position\n\n try {\n try {\n fd = fs.openSync(opt.file, 'r+')\n } catch (er) {\n if (er.code === 'ENOENT') {\n fd = fs.openSync(opt.file, 'w+')\n } else {\n throw er\n }\n }\n\n const st = fs.fstatSync(fd)\n const headBuf = Buffer.alloc(512)\n\n POSITION: for (position = 0; position < st.size; position += 512) {\n for (let bufPos = 0, bytes = 0; bufPos < 512; bufPos += bytes) {\n bytes = fs.readSync(\n fd, headBuf, bufPos, headBuf.length - bufPos, position + bufPos\n )\n\n if (position === 0 && headBuf[0] === 0x1f && headBuf[1] === 0x8b) {\n throw new Error('cannot append to compressed archives')\n }\n\n if (!bytes) {\n break POSITION\n }\n }\n\n const h = new Header(headBuf)\n if (!h.cksumValid) {\n break\n }\n const entryBlockSize = 512 * Math.ceil(h.size / 512)\n if (position + entryBlockSize + 512 > st.size) {\n break\n }\n // the 512 for the header we just parsed will be added as well\n // also jump ahead all the blocks for the body\n position += entryBlockSize\n if (opt.mtimeCache) {\n opt.mtimeCache.set(h.path, h.mtime)\n }\n }\n threw = false\n\n streamSync(opt, p, position, fd, files)\n } finally {\n if (threw) {\n try {\n fs.closeSync(fd)\n } catch (er) {}\n }\n }\n}\n\nconst streamSync = (opt, p, position, fd, files) => {\n const stream = new fsm.WriteStreamSync(opt.file, {\n fd: fd,\n start: position,\n })\n p.pipe(stream)\n addFilesSync(p, files)\n}\n\nconst replace = (opt, files, cb) => {\n files = Array.from(files)\n const p = new Pack(opt)\n\n const getPos = (fd, size, cb_) => {\n const cb = (er, pos) => {\n if (er) {\n fs.close(fd, _ => cb_(er))\n } else {\n cb_(null, pos)\n }\n }\n\n let position = 0\n if (size === 0) {\n return cb(null, 0)\n }\n\n let bufPos = 0\n const headBuf = Buffer.alloc(512)\n const onread = (er, bytes) => {\n if (er) {\n return cb(er)\n }\n bufPos += bytes\n if (bufPos < 512 && bytes) {\n return fs.read(\n fd, headBuf, bufPos, headBuf.length - bufPos,\n position + bufPos, onread\n )\n }\n\n if (position === 0 && headBuf[0] === 0x1f && headBuf[1] === 0x8b) {\n return cb(new Error('cannot append to compressed archives'))\n }\n\n // truncated header\n if (bufPos < 512) {\n return cb(null, position)\n }\n\n const h = new Header(headBuf)\n if (!h.cksumValid) {\n return cb(null, position)\n }\n\n const entryBlockSize = 512 * Math.ceil(h.size / 512)\n if (position + entryBlockSize + 512 > size) {\n return cb(null, position)\n }\n\n position += entryBlockSize + 512\n if (position >= size) {\n return cb(null, position)\n }\n\n if (opt.mtimeCache) {\n opt.mtimeCache.set(h.path, h.mtime)\n }\n bufPos = 0\n fs.read(fd, headBuf, 0, 512, position, onread)\n }\n fs.read(fd, headBuf, 0, 512, position, onread)\n }\n\n const promise = new Promise((resolve, reject) => {\n p.on('error', reject)\n let flag = 'r+'\n const onopen = (er, fd) => {\n if (er && er.code === 'ENOENT' && flag === 'r+') {\n flag = 'w+'\n return fs.open(opt.file, flag, onopen)\n }\n\n if (er) {\n return reject(er)\n }\n\n fs.fstat(fd, (er, st) => {\n if (er) {\n return fs.close(fd, () => reject(er))\n }\n\n getPos(fd, st.size, (er, position) => {\n if (er) {\n return reject(er)\n }\n const stream = new fsm.WriteStream(opt.file, {\n fd: fd,\n start: position,\n })\n p.pipe(stream)\n stream.on('error', reject)\n stream.on('close', resolve)\n addFilesAsync(p, files)\n })\n })\n }\n fs.open(opt.file, flag, onopen)\n })\n\n return cb ? promise.then(cb, cb) : promise\n}\n\nconst addFilesSync = (p, files) => {\n files.forEach(file => {\n if (file.charAt(0) === '@') {\n t({\n file: path.resolve(p.cwd, file.slice(1)),\n sync: true,\n noResume: true,\n onentry: entry => p.add(entry),\n })\n } else {\n p.add(file)\n }\n })\n p.end()\n}\n\nconst addFilesAsync = (p, files) => {\n while (files.length) {\n const file = files.shift()\n if (file.charAt(0) === '@') {\n return t({\n file: path.resolve(p.cwd, file.slice(1)),\n noResume: true,\n onentry: entry => p.add(entry),\n }).then(_ => addFilesAsync(p, files))\n } else {\n p.add(file)\n }\n }\n p.end()\n}\n","// unix absolute paths are also absolute on win32, so we use this for both\nconst { isAbsolute, parse } = require('path').win32\n\n// returns [root, stripped]\n// Note that windows will think that //x/y/z/a has a \"root\" of //x/y, and in\n// those cases, we want to sanitize it to x/y/z/a, not z/a, so we strip /\n// explicitly if it's the first character.\n// drive-specific relative paths on Windows get their root stripped off even\n// though they are not absolute, so `c:../foo` becomes ['c:', '../foo']\nmodule.exports = path => {\n let r = ''\n\n let parsed = parse(path)\n while (isAbsolute(path) || parsed.root) {\n // windows will think that //x/y/z has a \"root\" of //x/y/\n // but strip the //?/C:/ off of //?/C:/path\n const root = path.charAt(0) === '/' && path.slice(0, 4) !== '//?/' ? '/'\n : parsed.root\n path = path.slice(root.length)\n r += root\n parsed = parse(path)\n }\n return [r, path]\n}\n","// warning: extremely hot code path.\n// This has been meticulously optimized for use\n// within npm install on large package trees.\n// Do not edit without careful benchmarking.\nmodule.exports = str => {\n let i = str.length - 1\n let slashesStart = -1\n while (i > -1 && str.charAt(i) === '/') {\n slashesStart = i\n i--\n }\n return slashesStart === -1 ? str : str.slice(0, slashesStart)\n}\n","'use strict'\n// map types from key to human-friendly name\nexports.name = new Map([\n ['0', 'File'],\n // same as File\n ['', 'OldFile'],\n ['1', 'Link'],\n ['2', 'SymbolicLink'],\n // Devices and FIFOs aren't fully supported\n // they are parsed, but skipped when unpacking\n ['3', 'CharacterDevice'],\n ['4', 'BlockDevice'],\n ['5', 'Directory'],\n ['6', 'FIFO'],\n // same as File\n ['7', 'ContiguousFile'],\n // pax headers\n ['g', 'GlobalExtendedHeader'],\n ['x', 'ExtendedHeader'],\n // vendor-specific stuff\n // skip\n ['A', 'SolarisACL'],\n // like 5, but with data, which should be skipped\n ['D', 'GNUDumpDir'],\n // metadata only, skip\n ['I', 'Inode'],\n // data = link path of next file\n ['K', 'NextFileHasLongLinkpath'],\n // data = path of next file\n ['L', 'NextFileHasLongPath'],\n // skip\n ['M', 'ContinuationFile'],\n // like L\n ['N', 'OldGnuLongPath'],\n // skip\n ['S', 'SparseFile'],\n // skip\n ['V', 'TapeVolumeHeader'],\n // like x\n ['X', 'OldExtendedHeader'],\n])\n\n// map the other direction\nexports.code = new Map(Array.from(exports.name).map(kv => [kv[1], kv[0]]))\n","'use strict'\n\n// the PEND/UNPEND stuff tracks whether we're ready to emit end/close yet.\n// but the path reservations are required to avoid race conditions where\n// parallelized unpack ops may mess with one another, due to dependencies\n// (like a Link depending on its target) or destructive operations (like\n// clobbering an fs object to create one of a different type.)\n\nconst assert = require('assert')\nconst Parser = require('./parse.js')\nconst fs = require('fs')\nconst fsm = require('fs-minipass')\nconst path = require('path')\nconst mkdir = require('./mkdir.js')\nconst wc = require('./winchars.js')\nconst pathReservations = require('./path-reservations.js')\nconst stripAbsolutePath = require('./strip-absolute-path.js')\nconst normPath = require('./normalize-windows-path.js')\nconst stripSlash = require('./strip-trailing-slashes.js')\nconst normalize = require('./normalize-unicode.js')\n\nconst ONENTRY = Symbol('onEntry')\nconst CHECKFS = Symbol('checkFs')\nconst CHECKFS2 = Symbol('checkFs2')\nconst PRUNECACHE = Symbol('pruneCache')\nconst ISREUSABLE = Symbol('isReusable')\nconst MAKEFS = Symbol('makeFs')\nconst FILE = Symbol('file')\nconst DIRECTORY = Symbol('directory')\nconst LINK = Symbol('link')\nconst SYMLINK = Symbol('symlink')\nconst HARDLINK = Symbol('hardlink')\nconst UNSUPPORTED = Symbol('unsupported')\nconst CHECKPATH = Symbol('checkPath')\nconst MKDIR = Symbol('mkdir')\nconst ONERROR = Symbol('onError')\nconst PENDING = Symbol('pending')\nconst PEND = Symbol('pend')\nconst UNPEND = Symbol('unpend')\nconst ENDED = Symbol('ended')\nconst MAYBECLOSE = Symbol('maybeClose')\nconst SKIP = Symbol('skip')\nconst DOCHOWN = Symbol('doChown')\nconst UID = Symbol('uid')\nconst GID = Symbol('gid')\nconst CHECKED_CWD = Symbol('checkedCwd')\nconst crypto = require('crypto')\nconst getFlag = require('./get-write-flag.js')\nconst platform = process.env.TESTING_TAR_FAKE_PLATFORM || process.platform\nconst isWindows = platform === 'win32'\nconst DEFAULT_MAX_DEPTH = 1024\n\n// Unlinks on Windows are not atomic.\n//\n// This means that if you have a file entry, followed by another\n// file entry with an identical name, and you cannot re-use the file\n// (because it's a hardlink, or because unlink:true is set, or it's\n// Windows, which does not have useful nlink values), then the unlink\n// will be committed to the disk AFTER the new file has been written\n// over the old one, deleting the new file.\n//\n// To work around this, on Windows systems, we rename the file and then\n// delete the renamed file. It's a sloppy kludge, but frankly, I do not\n// know of a better way to do this, given windows' non-atomic unlink\n// semantics.\n//\n// See: https://github.com/npm/node-tar/issues/183\n/* istanbul ignore next */\nconst unlinkFile = (path, cb) => {\n if (!isWindows) {\n return fs.unlink(path, cb)\n }\n\n const name = path + '.DELETE.' + crypto.randomBytes(16).toString('hex')\n fs.rename(path, name, er => {\n if (er) {\n return cb(er)\n }\n fs.unlink(name, cb)\n })\n}\n\n/* istanbul ignore next */\nconst unlinkFileSync = path => {\n if (!isWindows) {\n return fs.unlinkSync(path)\n }\n\n const name = path + '.DELETE.' + crypto.randomBytes(16).toString('hex')\n fs.renameSync(path, name)\n fs.unlinkSync(name)\n}\n\n// this.gid, entry.gid, this.processUid\nconst uint32 = (a, b, c) =>\n a === a >>> 0 ? a\n : b === b >>> 0 ? b\n : c\n\n// clear the cache if it's a case-insensitive unicode-squashing match.\n// we can't know if the current file system is case-sensitive or supports\n// unicode fully, so we check for similarity on the maximally compatible\n// representation. Err on the side of pruning, since all it's doing is\n// preventing lstats, and it's not the end of the world if we get a false\n// positive.\n// Note that on windows, we always drop the entire cache whenever a\n// symbolic link is encountered, because 8.3 filenames are impossible\n// to reason about, and collisions are hazards rather than just failures.\nconst cacheKeyNormalize = path => stripSlash(normPath(normalize(path)))\n .toLowerCase()\n\nconst pruneCache = (cache, abs) => {\n abs = cacheKeyNormalize(abs)\n for (const path of cache.keys()) {\n const pnorm = cacheKeyNormalize(path)\n if (pnorm === abs || pnorm.indexOf(abs + '/') === 0) {\n cache.delete(path)\n }\n }\n}\n\nconst dropCache = cache => {\n for (const key of cache.keys()) {\n cache.delete(key)\n }\n}\n\nclass Unpack extends Parser {\n constructor (opt) {\n if (!opt) {\n opt = {}\n }\n\n opt.ondone = _ => {\n this[ENDED] = true\n this[MAYBECLOSE]()\n }\n\n super(opt)\n\n this[CHECKED_CWD] = false\n\n this.reservations = pathReservations()\n\n this.transform = typeof opt.transform === 'function' ? opt.transform : null\n\n this.writable = true\n this.readable = false\n\n this[PENDING] = 0\n this[ENDED] = false\n\n this.dirCache = opt.dirCache || new Map()\n\n if (typeof opt.uid === 'number' || typeof opt.gid === 'number') {\n // need both or neither\n if (typeof opt.uid !== 'number' || typeof opt.gid !== 'number') {\n throw new TypeError('cannot set owner without number uid and gid')\n }\n if (opt.preserveOwner) {\n throw new TypeError(\n 'cannot preserve owner in archive and also set owner explicitly')\n }\n this.uid = opt.uid\n this.gid = opt.gid\n this.setOwner = true\n } else {\n this.uid = null\n this.gid = null\n this.setOwner = false\n }\n\n // default true for root\n if (opt.preserveOwner === undefined && typeof opt.uid !== 'number') {\n this.preserveOwner = process.getuid && process.getuid() === 0\n } else {\n this.preserveOwner = !!opt.preserveOwner\n }\n\n this.processUid = (this.preserveOwner || this.setOwner) && process.getuid ?\n process.getuid() : null\n this.processGid = (this.preserveOwner || this.setOwner) && process.getgid ?\n process.getgid() : null\n\n // prevent excessively deep nesting of subfolders\n // set to `Infinity` to remove this restriction\n this.maxDepth = typeof opt.maxDepth === 'number'\n ? opt.maxDepth\n : DEFAULT_MAX_DEPTH\n\n // mostly just for testing, but useful in some cases.\n // Forcibly trigger a chown on every entry, no matter what\n this.forceChown = opt.forceChown === true\n\n // turn >| in filenames into 0xf000-higher encoded forms\n this.win32 = !!opt.win32 || isWindows\n\n // do not unpack over files that are newer than what's in the archive\n this.newer = !!opt.newer\n\n // do not unpack over ANY files\n this.keep = !!opt.keep\n\n // do not set mtime/atime of extracted entries\n this.noMtime = !!opt.noMtime\n\n // allow .., absolute path entries, and unpacking through symlinks\n // without this, warn and skip .., relativize absolutes, and error\n // on symlinks in extraction path\n this.preservePaths = !!opt.preservePaths\n\n // unlink files and links before writing. This breaks existing hard\n // links, and removes symlink directories rather than erroring\n this.unlink = !!opt.unlink\n\n this.cwd = normPath(path.resolve(opt.cwd || process.cwd()))\n this.strip = +opt.strip || 0\n // if we're not chmodding, then we don't need the process umask\n this.processUmask = opt.noChmod ? 0 : process.umask()\n this.umask = typeof opt.umask === 'number' ? opt.umask : this.processUmask\n\n // default mode for dirs created as parents\n this.dmode = opt.dmode || (0o0777 & (~this.umask))\n this.fmode = opt.fmode || (0o0666 & (~this.umask))\n\n this.on('entry', entry => this[ONENTRY](entry))\n }\n\n // a bad or damaged archive is a warning for Parser, but an error\n // when extracting. Mark those errors as unrecoverable, because\n // the Unpack contract cannot be met.\n warn (code, msg, data = {}) {\n if (code === 'TAR_BAD_ARCHIVE' || code === 'TAR_ABORT') {\n data.recoverable = false\n }\n return super.warn(code, msg, data)\n }\n\n [MAYBECLOSE] () {\n if (this[ENDED] && this[PENDING] === 0) {\n this.emit('prefinish')\n this.emit('finish')\n this.emit('end')\n }\n }\n\n [CHECKPATH] (entry) {\n const p = normPath(entry.path)\n const parts = p.split('/')\n\n if (this.strip) {\n if (parts.length < this.strip) {\n return false\n }\n if (entry.type === 'Link') {\n const linkparts = normPath(entry.linkpath).split('/')\n if (linkparts.length >= this.strip) {\n entry.linkpath = linkparts.slice(this.strip).join('/')\n } else {\n return false\n }\n }\n parts.splice(0, this.strip)\n entry.path = parts.join('/')\n }\n\n if (isFinite(this.maxDepth) && parts.length > this.maxDepth) {\n this.warn('TAR_ENTRY_ERROR', 'path excessively deep', {\n entry,\n path: p,\n depth: parts.length,\n maxDepth: this.maxDepth,\n })\n return false\n }\n\n if (!this.preservePaths) {\n if (parts.includes('..') || isWindows && /^[a-z]:\\.\\.$/i.test(parts[0])) {\n this.warn('TAR_ENTRY_ERROR', `path contains '..'`, {\n entry,\n path: p,\n })\n return false\n }\n\n // strip off the root\n const [root, stripped] = stripAbsolutePath(p)\n if (root) {\n entry.path = stripped\n this.warn('TAR_ENTRY_INFO', `stripping ${root} from absolute path`, {\n entry,\n path: p,\n })\n }\n }\n\n if (path.isAbsolute(entry.path)) {\n entry.absolute = normPath(path.resolve(entry.path))\n } else {\n entry.absolute = normPath(path.resolve(this.cwd, entry.path))\n }\n\n // if we somehow ended up with a path that escapes the cwd, and we are\n // not in preservePaths mode, then something is fishy! This should have\n // been prevented above, so ignore this for coverage.\n /* istanbul ignore if - defense in depth */\n if (!this.preservePaths &&\n entry.absolute.indexOf(this.cwd + '/') !== 0 &&\n entry.absolute !== this.cwd) {\n this.warn('TAR_ENTRY_ERROR', 'path escaped extraction target', {\n entry,\n path: normPath(entry.path),\n resolvedPath: entry.absolute,\n cwd: this.cwd,\n })\n return false\n }\n\n // an archive can set properties on the extraction directory, but it\n // may not replace the cwd with a different kind of thing entirely.\n if (entry.absolute === this.cwd &&\n entry.type !== 'Directory' &&\n entry.type !== 'GNUDumpDir') {\n return false\n }\n\n // only encode : chars that aren't drive letter indicators\n if (this.win32) {\n const { root: aRoot } = path.win32.parse(entry.absolute)\n entry.absolute = aRoot + wc.encode(entry.absolute.slice(aRoot.length))\n const { root: pRoot } = path.win32.parse(entry.path)\n entry.path = pRoot + wc.encode(entry.path.slice(pRoot.length))\n }\n\n return true\n }\n\n [ONENTRY] (entry) {\n if (!this[CHECKPATH](entry)) {\n return entry.resume()\n }\n\n assert.equal(typeof entry.absolute, 'string')\n\n switch (entry.type) {\n case 'Directory':\n case 'GNUDumpDir':\n if (entry.mode) {\n entry.mode = entry.mode | 0o700\n }\n\n // eslint-disable-next-line no-fallthrough\n case 'File':\n case 'OldFile':\n case 'ContiguousFile':\n case 'Link':\n case 'SymbolicLink':\n return this[CHECKFS](entry)\n\n case 'CharacterDevice':\n case 'BlockDevice':\n case 'FIFO':\n default:\n return this[UNSUPPORTED](entry)\n }\n }\n\n [ONERROR] (er, entry) {\n // Cwd has to exist, or else nothing works. That's serious.\n // Other errors are warnings, which raise the error in strict\n // mode, but otherwise continue on.\n if (er.name === 'CwdError') {\n this.emit('error', er)\n } else {\n this.warn('TAR_ENTRY_ERROR', er, { entry })\n this[UNPEND]()\n entry.resume()\n }\n }\n\n [MKDIR] (dir, mode, cb) {\n mkdir(normPath(dir), {\n uid: this.uid,\n gid: this.gid,\n processUid: this.processUid,\n processGid: this.processGid,\n umask: this.processUmask,\n preserve: this.preservePaths,\n unlink: this.unlink,\n cache: this.dirCache,\n cwd: this.cwd,\n mode: mode,\n noChmod: this.noChmod,\n }, cb)\n }\n\n [DOCHOWN] (entry) {\n // in preserve owner mode, chown if the entry doesn't match process\n // in set owner mode, chown if setting doesn't match process\n return this.forceChown ||\n this.preserveOwner &&\n (typeof entry.uid === 'number' && entry.uid !== this.processUid ||\n typeof entry.gid === 'number' && entry.gid !== this.processGid)\n ||\n (typeof this.uid === 'number' && this.uid !== this.processUid ||\n typeof this.gid === 'number' && this.gid !== this.processGid)\n }\n\n [UID] (entry) {\n return uint32(this.uid, entry.uid, this.processUid)\n }\n\n [GID] (entry) {\n return uint32(this.gid, entry.gid, this.processGid)\n }\n\n [FILE] (entry, fullyDone) {\n const mode = entry.mode & 0o7777 || this.fmode\n const stream = new fsm.WriteStream(entry.absolute, {\n flags: getFlag(entry.size),\n mode: mode,\n autoClose: false,\n })\n stream.on('error', er => {\n if (stream.fd) {\n fs.close(stream.fd, () => {})\n }\n\n // flush all the data out so that we aren't left hanging\n // if the error wasn't actually fatal. otherwise the parse\n // is blocked, and we never proceed.\n stream.write = () => true\n this[ONERROR](er, entry)\n fullyDone()\n })\n\n let actions = 1\n const done = er => {\n if (er) {\n /* istanbul ignore else - we should always have a fd by now */\n if (stream.fd) {\n fs.close(stream.fd, () => {})\n }\n\n this[ONERROR](er, entry)\n fullyDone()\n return\n }\n\n if (--actions === 0) {\n fs.close(stream.fd, er => {\n if (er) {\n this[ONERROR](er, entry)\n } else {\n this[UNPEND]()\n }\n fullyDone()\n })\n }\n }\n\n stream.on('finish', _ => {\n // if futimes fails, try utimes\n // if utimes fails, fail with the original error\n // same for fchown/chown\n const abs = entry.absolute\n const fd = stream.fd\n\n if (entry.mtime && !this.noMtime) {\n actions++\n const atime = entry.atime || new Date()\n const mtime = entry.mtime\n fs.futimes(fd, atime, mtime, er =>\n er ? fs.utimes(abs, atime, mtime, er2 => done(er2 && er))\n : done())\n }\n\n if (this[DOCHOWN](entry)) {\n actions++\n const uid = this[UID](entry)\n const gid = this[GID](entry)\n fs.fchown(fd, uid, gid, er =>\n er ? fs.chown(abs, uid, gid, er2 => done(er2 && er))\n : done())\n }\n\n done()\n })\n\n const tx = this.transform ? this.transform(entry) || entry : entry\n if (tx !== entry) {\n tx.on('error', er => {\n this[ONERROR](er, entry)\n fullyDone()\n })\n entry.pipe(tx)\n }\n tx.pipe(stream)\n }\n\n [DIRECTORY] (entry, fullyDone) {\n const mode = entry.mode & 0o7777 || this.dmode\n this[MKDIR](entry.absolute, mode, er => {\n if (er) {\n this[ONERROR](er, entry)\n fullyDone()\n return\n }\n\n let actions = 1\n const done = _ => {\n if (--actions === 0) {\n fullyDone()\n this[UNPEND]()\n entry.resume()\n }\n }\n\n if (entry.mtime && !this.noMtime) {\n actions++\n fs.utimes(entry.absolute, entry.atime || new Date(), entry.mtime, done)\n }\n\n if (this[DOCHOWN](entry)) {\n actions++\n fs.chown(entry.absolute, this[UID](entry), this[GID](entry), done)\n }\n\n done()\n })\n }\n\n [UNSUPPORTED] (entry) {\n entry.unsupported = true\n this.warn('TAR_ENTRY_UNSUPPORTED',\n `unsupported entry type: ${entry.type}`, { entry })\n entry.resume()\n }\n\n [SYMLINK] (entry, done) {\n this[LINK](entry, entry.linkpath, 'symlink', done)\n }\n\n [HARDLINK] (entry, done) {\n const linkpath = normPath(path.resolve(this.cwd, entry.linkpath))\n this[LINK](entry, linkpath, 'link', done)\n }\n\n [PEND] () {\n this[PENDING]++\n }\n\n [UNPEND] () {\n this[PENDING]--\n this[MAYBECLOSE]()\n }\n\n [SKIP] (entry) {\n this[UNPEND]()\n entry.resume()\n }\n\n // Check if we can reuse an existing filesystem entry safely and\n // overwrite it, rather than unlinking and recreating\n // Windows doesn't report a useful nlink, so we just never reuse entries\n [ISREUSABLE] (entry, st) {\n return entry.type === 'File' &&\n !this.unlink &&\n st.isFile() &&\n st.nlink <= 1 &&\n !isWindows\n }\n\n // check if a thing is there, and if so, try to clobber it\n [CHECKFS] (entry) {\n this[PEND]()\n const paths = [entry.path]\n if (entry.linkpath) {\n paths.push(entry.linkpath)\n }\n this.reservations.reserve(paths, done => this[CHECKFS2](entry, done))\n }\n\n [PRUNECACHE] (entry) {\n // if we are not creating a directory, and the path is in the dirCache,\n // then that means we are about to delete the directory we created\n // previously, and it is no longer going to be a directory, and neither\n // is any of its children.\n // If a symbolic link is encountered, all bets are off. There is no\n // reasonable way to sanitize the cache in such a way we will be able to\n // avoid having filesystem collisions. If this happens with a non-symlink\n // entry, it'll just fail to unpack, but a symlink to a directory, using an\n // 8.3 shortname or certain unicode attacks, can evade detection and lead\n // to arbitrary writes to anywhere on the system.\n if (entry.type === 'SymbolicLink') {\n dropCache(this.dirCache)\n } else if (entry.type !== 'Directory') {\n pruneCache(this.dirCache, entry.absolute)\n }\n }\n\n [CHECKFS2] (entry, fullyDone) {\n this[PRUNECACHE](entry)\n\n const done = er => {\n this[PRUNECACHE](entry)\n fullyDone(er)\n }\n\n const checkCwd = () => {\n this[MKDIR](this.cwd, this.dmode, er => {\n if (er) {\n this[ONERROR](er, entry)\n done()\n return\n }\n this[CHECKED_CWD] = true\n start()\n })\n }\n\n const start = () => {\n if (entry.absolute !== this.cwd) {\n const parent = normPath(path.dirname(entry.absolute))\n if (parent !== this.cwd) {\n return this[MKDIR](parent, this.dmode, er => {\n if (er) {\n this[ONERROR](er, entry)\n done()\n return\n }\n afterMakeParent()\n })\n }\n }\n afterMakeParent()\n }\n\n const afterMakeParent = () => {\n fs.lstat(entry.absolute, (lstatEr, st) => {\n if (st && (this.keep || this.newer && st.mtime > entry.mtime)) {\n this[SKIP](entry)\n done()\n return\n }\n if (lstatEr || this[ISREUSABLE](entry, st)) {\n return this[MAKEFS](null, entry, done)\n }\n\n if (st.isDirectory()) {\n if (entry.type === 'Directory') {\n const needChmod = !this.noChmod &&\n entry.mode &&\n (st.mode & 0o7777) !== entry.mode\n const afterChmod = er => this[MAKEFS](er, entry, done)\n if (!needChmod) {\n return afterChmod()\n }\n return fs.chmod(entry.absolute, entry.mode, afterChmod)\n }\n // Not a dir entry, have to remove it.\n // NB: the only way to end up with an entry that is the cwd\n // itself, in such a way that == does not detect, is a\n // tricky windows absolute path with UNC or 8.3 parts (and\n // preservePaths:true, or else it will have been stripped).\n // In that case, the user has opted out of path protections\n // explicitly, so if they blow away the cwd, c'est la vie.\n if (entry.absolute !== this.cwd) {\n return fs.rmdir(entry.absolute, er =>\n this[MAKEFS](er, entry, done))\n }\n }\n\n // not a dir, and not reusable\n // don't remove if the cwd, we want that error\n if (entry.absolute === this.cwd) {\n return this[MAKEFS](null, entry, done)\n }\n\n unlinkFile(entry.absolute, er =>\n this[MAKEFS](er, entry, done))\n })\n }\n\n if (this[CHECKED_CWD]) {\n start()\n } else {\n checkCwd()\n }\n }\n\n [MAKEFS] (er, entry, done) {\n if (er) {\n this[ONERROR](er, entry)\n done()\n return\n }\n\n switch (entry.type) {\n case 'File':\n case 'OldFile':\n case 'ContiguousFile':\n return this[FILE](entry, done)\n\n case 'Link':\n return this[HARDLINK](entry, done)\n\n case 'SymbolicLink':\n return this[SYMLINK](entry, done)\n\n case 'Directory':\n case 'GNUDumpDir':\n return this[DIRECTORY](entry, done)\n }\n }\n\n [LINK] (entry, linkpath, link, done) {\n // XXX: get the type ('symlink' or 'junction') for windows\n fs[link](linkpath, entry.absolute, er => {\n if (er) {\n this[ONERROR](er, entry)\n } else {\n this[UNPEND]()\n entry.resume()\n }\n done()\n })\n }\n}\n\nconst callSync = fn => {\n try {\n return [null, fn()]\n } catch (er) {\n return [er, null]\n }\n}\nclass UnpackSync extends Unpack {\n [MAKEFS] (er, entry) {\n return super[MAKEFS](er, entry, () => {})\n }\n\n [CHECKFS] (entry) {\n this[PRUNECACHE](entry)\n\n if (!this[CHECKED_CWD]) {\n const er = this[MKDIR](this.cwd, this.dmode)\n if (er) {\n return this[ONERROR](er, entry)\n }\n this[CHECKED_CWD] = true\n }\n\n // don't bother to make the parent if the current entry is the cwd,\n // we've already checked it.\n if (entry.absolute !== this.cwd) {\n const parent = normPath(path.dirname(entry.absolute))\n if (parent !== this.cwd) {\n const mkParent = this[MKDIR](parent, this.dmode)\n if (mkParent) {\n return this[ONERROR](mkParent, entry)\n }\n }\n }\n\n const [lstatEr, st] = callSync(() => fs.lstatSync(entry.absolute))\n if (st && (this.keep || this.newer && st.mtime > entry.mtime)) {\n return this[SKIP](entry)\n }\n\n if (lstatEr || this[ISREUSABLE](entry, st)) {\n return this[MAKEFS](null, entry)\n }\n\n if (st.isDirectory()) {\n if (entry.type === 'Directory') {\n const needChmod = !this.noChmod &&\n entry.mode &&\n (st.mode & 0o7777) !== entry.mode\n const [er] = needChmod ? callSync(() => {\n fs.chmodSync(entry.absolute, entry.mode)\n }) : []\n return this[MAKEFS](er, entry)\n }\n // not a dir entry, have to remove it\n const [er] = callSync(() => fs.rmdirSync(entry.absolute))\n this[MAKEFS](er, entry)\n }\n\n // not a dir, and not reusable.\n // don't remove if it's the cwd, since we want that error.\n const [er] = entry.absolute === this.cwd ? []\n : callSync(() => unlinkFileSync(entry.absolute))\n this[MAKEFS](er, entry)\n }\n\n [FILE] (entry, done) {\n const mode = entry.mode & 0o7777 || this.fmode\n\n const oner = er => {\n let closeError\n try {\n fs.closeSync(fd)\n } catch (e) {\n closeError = e\n }\n if (er || closeError) {\n this[ONERROR](er || closeError, entry)\n }\n done()\n }\n\n let fd\n try {\n fd = fs.openSync(entry.absolute, getFlag(entry.size), mode)\n } catch (er) {\n return oner(er)\n }\n const tx = this.transform ? this.transform(entry) || entry : entry\n if (tx !== entry) {\n tx.on('error', er => this[ONERROR](er, entry))\n entry.pipe(tx)\n }\n\n tx.on('data', chunk => {\n try {\n fs.writeSync(fd, chunk, 0, chunk.length)\n } catch (er) {\n oner(er)\n }\n })\n\n tx.on('end', _ => {\n let er = null\n // try both, falling futimes back to utimes\n // if either fails, handle the first error\n if (entry.mtime && !this.noMtime) {\n const atime = entry.atime || new Date()\n const mtime = entry.mtime\n try {\n fs.futimesSync(fd, atime, mtime)\n } catch (futimeser) {\n try {\n fs.utimesSync(entry.absolute, atime, mtime)\n } catch (utimeser) {\n er = futimeser\n }\n }\n }\n\n if (this[DOCHOWN](entry)) {\n const uid = this[UID](entry)\n const gid = this[GID](entry)\n\n try {\n fs.fchownSync(fd, uid, gid)\n } catch (fchowner) {\n try {\n fs.chownSync(entry.absolute, uid, gid)\n } catch (chowner) {\n er = er || fchowner\n }\n }\n }\n\n oner(er)\n })\n }\n\n [DIRECTORY] (entry, done) {\n const mode = entry.mode & 0o7777 || this.dmode\n const er = this[MKDIR](entry.absolute, mode)\n if (er) {\n this[ONERROR](er, entry)\n done()\n return\n }\n if (entry.mtime && !this.noMtime) {\n try {\n fs.utimesSync(entry.absolute, entry.atime || new Date(), entry.mtime)\n } catch (er) {}\n }\n if (this[DOCHOWN](entry)) {\n try {\n fs.chownSync(entry.absolute, this[UID](entry), this[GID](entry))\n } catch (er) {}\n }\n done()\n entry.resume()\n }\n\n [MKDIR] (dir, mode) {\n try {\n return mkdir.sync(normPath(dir), {\n uid: this.uid,\n gid: this.gid,\n processUid: this.processUid,\n processGid: this.processGid,\n umask: this.processUmask,\n preserve: this.preservePaths,\n unlink: this.unlink,\n cache: this.dirCache,\n cwd: this.cwd,\n mode: mode,\n })\n } catch (er) {\n return er\n }\n }\n\n [LINK] (entry, linkpath, link, done) {\n try {\n fs[link + 'Sync'](linkpath, entry.absolute)\n done()\n entry.resume()\n } catch (er) {\n return this[ONERROR](er, entry)\n }\n }\n}\n\nUnpack.Sync = UnpackSync\nmodule.exports = Unpack\n","'use strict'\n\n// tar -u\n\nconst hlo = require('./high-level-opt.js')\nconst r = require('./replace.js')\n// just call tar.r with the filter and mtimeCache\n\nmodule.exports = (opt_, files, cb) => {\n const opt = hlo(opt_)\n\n if (!opt.file) {\n throw new TypeError('file is required')\n }\n\n if (opt.gzip || opt.brotli || opt.file.endsWith('.br') || opt.file.endsWith('.tbr')) {\n throw new TypeError('cannot append to compressed archives')\n }\n\n if (!files || !Array.isArray(files) || !files.length) {\n throw new TypeError('no files or directories specified')\n }\n\n files = Array.from(files)\n\n mtimeFilter(opt)\n return r(opt, files, cb)\n}\n\nconst mtimeFilter = opt => {\n const filter = opt.filter\n\n if (!opt.mtimeCache) {\n opt.mtimeCache = new Map()\n }\n\n opt.filter = filter ? (path, stat) =>\n filter(path, stat) && !(opt.mtimeCache.get(path) > stat.mtime)\n : (path, stat) => !(opt.mtimeCache.get(path) > stat.mtime)\n}\n","'use strict'\nmodule.exports = Base => class extends Base {\n warn (code, message, data = {}) {\n if (this.file) {\n data.file = this.file\n }\n if (this.cwd) {\n data.cwd = this.cwd\n }\n data.code = message instanceof Error && message.code || code\n data.tarCode = code\n if (!this.strict && data.recoverable !== false) {\n if (message instanceof Error) {\n data = Object.assign(message, data)\n message = message.message\n }\n this.emit('warn', data.tarCode, message, data)\n } else if (message instanceof Error) {\n this.emit('error', Object.assign(message, data))\n } else {\n this.emit('error', Object.assign(new Error(`${code}: ${message}`), data))\n }\n }\n}\n","'use strict'\n\n// When writing files on Windows, translate the characters to their\n// 0xf000 higher-encoded versions.\n\nconst raw = [\n '|',\n '<',\n '>',\n '?',\n ':',\n]\n\nconst win = raw.map(char =>\n String.fromCharCode(0xf000 + char.charCodeAt(0)))\n\nconst toWin = new Map(raw.map((char, i) => [char, win[i]]))\nconst toRaw = new Map(win.map((char, i) => [char, raw[i]]))\n\nmodule.exports = {\n encode: s => raw.reduce((s, c) => s.split(c).join(toWin.get(c)), s),\n decode: s => win.reduce((s, c) => s.split(c).join(toRaw.get(c)), s),\n}\n","'use strict'\nconst { Minipass } = require('minipass')\nconst Pax = require('./pax.js')\nconst Header = require('./header.js')\nconst fs = require('fs')\nconst path = require('path')\nconst normPath = require('./normalize-windows-path.js')\nconst stripSlash = require('./strip-trailing-slashes.js')\n\nconst prefixPath = (path, prefix) => {\n if (!prefix) {\n return normPath(path)\n }\n path = normPath(path).replace(/^\\.(\\/|$)/, '')\n return stripSlash(prefix) + '/' + path\n}\n\nconst maxReadSize = 16 * 1024 * 1024\nconst PROCESS = Symbol('process')\nconst FILE = Symbol('file')\nconst DIRECTORY = Symbol('directory')\nconst SYMLINK = Symbol('symlink')\nconst HARDLINK = Symbol('hardlink')\nconst HEADER = Symbol('header')\nconst READ = Symbol('read')\nconst LSTAT = Symbol('lstat')\nconst ONLSTAT = Symbol('onlstat')\nconst ONREAD = Symbol('onread')\nconst ONREADLINK = Symbol('onreadlink')\nconst OPENFILE = Symbol('openfile')\nconst ONOPENFILE = Symbol('onopenfile')\nconst CLOSE = Symbol('close')\nconst MODE = Symbol('mode')\nconst AWAITDRAIN = Symbol('awaitDrain')\nconst ONDRAIN = Symbol('ondrain')\nconst PREFIX = Symbol('prefix')\nconst HAD_ERROR = Symbol('hadError')\nconst warner = require('./warn-mixin.js')\nconst winchars = require('./winchars.js')\nconst stripAbsolutePath = require('./strip-absolute-path.js')\n\nconst modeFix = require('./mode-fix.js')\n\nconst WriteEntry = warner(class WriteEntry extends Minipass {\n constructor (p, opt) {\n opt = opt || {}\n super(opt)\n if (typeof p !== 'string') {\n throw new TypeError('path is required')\n }\n this.path = normPath(p)\n // suppress atime, ctime, uid, gid, uname, gname\n this.portable = !!opt.portable\n // until node has builtin pwnam functions, this'll have to do\n this.myuid = process.getuid && process.getuid() || 0\n this.myuser = process.env.USER || ''\n this.maxReadSize = opt.maxReadSize || maxReadSize\n this.linkCache = opt.linkCache || new Map()\n this.statCache = opt.statCache || new Map()\n this.preservePaths = !!opt.preservePaths\n this.cwd = normPath(opt.cwd || process.cwd())\n this.strict = !!opt.strict\n this.noPax = !!opt.noPax\n this.noMtime = !!opt.noMtime\n this.mtime = opt.mtime || null\n this.prefix = opt.prefix ? normPath(opt.prefix) : null\n\n this.fd = null\n this.blockLen = null\n this.blockRemain = null\n this.buf = null\n this.offset = null\n this.length = null\n this.pos = null\n this.remain = null\n\n if (typeof opt.onwarn === 'function') {\n this.on('warn', opt.onwarn)\n }\n\n let pathWarn = false\n if (!this.preservePaths) {\n const [root, stripped] = stripAbsolutePath(this.path)\n if (root) {\n this.path = stripped\n pathWarn = root\n }\n }\n\n this.win32 = !!opt.win32 || process.platform === 'win32'\n if (this.win32) {\n // force the \\ to / normalization, since we might not *actually*\n // be on windows, but want \\ to be considered a path separator.\n this.path = winchars.decode(this.path.replace(/\\\\/g, '/'))\n p = p.replace(/\\\\/g, '/')\n }\n\n this.absolute = normPath(opt.absolute || path.resolve(this.cwd, p))\n\n if (this.path === '') {\n this.path = './'\n }\n\n if (pathWarn) {\n this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, {\n entry: this,\n path: pathWarn + this.path,\n })\n }\n\n if (this.statCache.has(this.absolute)) {\n this[ONLSTAT](this.statCache.get(this.absolute))\n } else {\n this[LSTAT]()\n }\n }\n\n emit (ev, ...data) {\n if (ev === 'error') {\n this[HAD_ERROR] = true\n }\n return super.emit(ev, ...data)\n }\n\n [LSTAT] () {\n fs.lstat(this.absolute, (er, stat) => {\n if (er) {\n return this.emit('error', er)\n }\n this[ONLSTAT](stat)\n })\n }\n\n [ONLSTAT] (stat) {\n this.statCache.set(this.absolute, stat)\n this.stat = stat\n if (!stat.isFile()) {\n stat.size = 0\n }\n this.type = getType(stat)\n this.emit('stat', stat)\n this[PROCESS]()\n }\n\n [PROCESS] () {\n switch (this.type) {\n case 'File': return this[FILE]()\n case 'Directory': return this[DIRECTORY]()\n case 'SymbolicLink': return this[SYMLINK]()\n // unsupported types are ignored.\n default: return this.end()\n }\n }\n\n [MODE] (mode) {\n return modeFix(mode, this.type === 'Directory', this.portable)\n }\n\n [PREFIX] (path) {\n return prefixPath(path, this.prefix)\n }\n\n [HEADER] () {\n if (this.type === 'Directory' && this.portable) {\n this.noMtime = true\n }\n\n this.header = new Header({\n path: this[PREFIX](this.path),\n // only apply the prefix to hard links.\n linkpath: this.type === 'Link' ? this[PREFIX](this.linkpath)\n : this.linkpath,\n // only the permissions and setuid/setgid/sticky bitflags\n // not the higher-order bits that specify file type\n mode: this[MODE](this.stat.mode),\n uid: this.portable ? null : this.stat.uid,\n gid: this.portable ? null : this.stat.gid,\n size: this.stat.size,\n mtime: this.noMtime ? null : this.mtime || this.stat.mtime,\n type: this.type,\n uname: this.portable ? null :\n this.stat.uid === this.myuid ? this.myuser : '',\n atime: this.portable ? null : this.stat.atime,\n ctime: this.portable ? null : this.stat.ctime,\n })\n\n if (this.header.encode() && !this.noPax) {\n super.write(new Pax({\n atime: this.portable ? null : this.header.atime,\n ctime: this.portable ? null : this.header.ctime,\n gid: this.portable ? null : this.header.gid,\n mtime: this.noMtime ? null : this.mtime || this.header.mtime,\n path: this[PREFIX](this.path),\n linkpath: this.type === 'Link' ? this[PREFIX](this.linkpath)\n : this.linkpath,\n size: this.header.size,\n uid: this.portable ? null : this.header.uid,\n uname: this.portable ? null : this.header.uname,\n dev: this.portable ? null : this.stat.dev,\n ino: this.portable ? null : this.stat.ino,\n nlink: this.portable ? null : this.stat.nlink,\n }).encode())\n }\n super.write(this.header.block)\n }\n\n [DIRECTORY] () {\n if (this.path.slice(-1) !== '/') {\n this.path += '/'\n }\n this.stat.size = 0\n this[HEADER]()\n this.end()\n }\n\n [SYMLINK] () {\n fs.readlink(this.absolute, (er, linkpath) => {\n if (er) {\n return this.emit('error', er)\n }\n this[ONREADLINK](linkpath)\n })\n }\n\n [ONREADLINK] (linkpath) {\n this.linkpath = normPath(linkpath)\n this[HEADER]()\n this.end()\n }\n\n [HARDLINK] (linkpath) {\n this.type = 'Link'\n this.linkpath = normPath(path.relative(this.cwd, linkpath))\n this.stat.size = 0\n this[HEADER]()\n this.end()\n }\n\n [FILE] () {\n if (this.stat.nlink > 1) {\n const linkKey = this.stat.dev + ':' + this.stat.ino\n if (this.linkCache.has(linkKey)) {\n const linkpath = this.linkCache.get(linkKey)\n if (linkpath.indexOf(this.cwd) === 0) {\n return this[HARDLINK](linkpath)\n }\n }\n this.linkCache.set(linkKey, this.absolute)\n }\n\n this[HEADER]()\n if (this.stat.size === 0) {\n return this.end()\n }\n\n this[OPENFILE]()\n }\n\n [OPENFILE] () {\n fs.open(this.absolute, 'r', (er, fd) => {\n if (er) {\n return this.emit('error', er)\n }\n this[ONOPENFILE](fd)\n })\n }\n\n [ONOPENFILE] (fd) {\n this.fd = fd\n if (this[HAD_ERROR]) {\n return this[CLOSE]()\n }\n\n this.blockLen = 512 * Math.ceil(this.stat.size / 512)\n this.blockRemain = this.blockLen\n const bufLen = Math.min(this.blockLen, this.maxReadSize)\n this.buf = Buffer.allocUnsafe(bufLen)\n this.offset = 0\n this.pos = 0\n this.remain = this.stat.size\n this.length = this.buf.length\n this[READ]()\n }\n\n [READ] () {\n const { fd, buf, offset, length, pos } = this\n fs.read(fd, buf, offset, length, pos, (er, bytesRead) => {\n if (er) {\n // ignoring the error from close(2) is a bad practice, but at\n // this point we already have an error, don't need another one\n return this[CLOSE](() => this.emit('error', er))\n }\n this[ONREAD](bytesRead)\n })\n }\n\n [CLOSE] (cb) {\n fs.close(this.fd, cb)\n }\n\n [ONREAD] (bytesRead) {\n if (bytesRead <= 0 && this.remain > 0) {\n const er = new Error('encountered unexpected EOF')\n er.path = this.absolute\n er.syscall = 'read'\n er.code = 'EOF'\n return this[CLOSE](() => this.emit('error', er))\n }\n\n if (bytesRead > this.remain) {\n const er = new Error('did not encounter expected EOF')\n er.path = this.absolute\n er.syscall = 'read'\n er.code = 'EOF'\n return this[CLOSE](() => this.emit('error', er))\n }\n\n // null out the rest of the buffer, if we could fit the block padding\n // at the end of this loop, we've incremented bytesRead and this.remain\n // to be incremented up to the blockRemain level, as if we had expected\n // to get a null-padded file, and read it until the end. then we will\n // decrement both remain and blockRemain by bytesRead, and know that we\n // reached the expected EOF, without any null buffer to append.\n if (bytesRead === this.remain) {\n for (let i = bytesRead; i < this.length && bytesRead < this.blockRemain; i++) {\n this.buf[i + this.offset] = 0\n bytesRead++\n this.remain++\n }\n }\n\n const writeBuf = this.offset === 0 && bytesRead === this.buf.length ?\n this.buf : this.buf.slice(this.offset, this.offset + bytesRead)\n\n const flushed = this.write(writeBuf)\n if (!flushed) {\n this[AWAITDRAIN](() => this[ONDRAIN]())\n } else {\n this[ONDRAIN]()\n }\n }\n\n [AWAITDRAIN] (cb) {\n this.once('drain', cb)\n }\n\n write (writeBuf) {\n if (this.blockRemain < writeBuf.length) {\n const er = new Error('writing more data than expected')\n er.path = this.absolute\n return this.emit('error', er)\n }\n this.remain -= writeBuf.length\n this.blockRemain -= writeBuf.length\n this.pos += writeBuf.length\n this.offset += writeBuf.length\n return super.write(writeBuf)\n }\n\n [ONDRAIN] () {\n if (!this.remain) {\n if (this.blockRemain) {\n super.write(Buffer.alloc(this.blockRemain))\n }\n return this[CLOSE](er => er ? this.emit('error', er) : this.end())\n }\n\n if (this.offset >= this.length) {\n // if we only have a smaller bit left to read, alloc a smaller buffer\n // otherwise, keep it the same length it was before.\n this.buf = Buffer.allocUnsafe(Math.min(this.blockRemain, this.buf.length))\n this.offset = 0\n }\n this.length = this.buf.length - this.offset\n this[READ]()\n }\n})\n\nclass WriteEntrySync extends WriteEntry {\n [LSTAT] () {\n this[ONLSTAT](fs.lstatSync(this.absolute))\n }\n\n [SYMLINK] () {\n this[ONREADLINK](fs.readlinkSync(this.absolute))\n }\n\n [OPENFILE] () {\n this[ONOPENFILE](fs.openSync(this.absolute, 'r'))\n }\n\n [READ] () {\n let threw = true\n try {\n const { fd, buf, offset, length, pos } = this\n const bytesRead = fs.readSync(fd, buf, offset, length, pos)\n this[ONREAD](bytesRead)\n threw = false\n } finally {\n // ignoring the error from close(2) is a bad practice, but at\n // this point we already have an error, don't need another one\n if (threw) {\n try {\n this[CLOSE](() => {})\n } catch (er) {}\n }\n }\n }\n\n [AWAITDRAIN] (cb) {\n cb()\n }\n\n [CLOSE] (cb) {\n fs.closeSync(this.fd)\n cb()\n }\n}\n\nconst WriteEntryTar = warner(class WriteEntryTar extends Minipass {\n constructor (readEntry, opt) {\n opt = opt || {}\n super(opt)\n this.preservePaths = !!opt.preservePaths\n this.portable = !!opt.portable\n this.strict = !!opt.strict\n this.noPax = !!opt.noPax\n this.noMtime = !!opt.noMtime\n\n this.readEntry = readEntry\n this.type = readEntry.type\n if (this.type === 'Directory' && this.portable) {\n this.noMtime = true\n }\n\n this.prefix = opt.prefix || null\n\n this.path = normPath(readEntry.path)\n this.mode = this[MODE](readEntry.mode)\n this.uid = this.portable ? null : readEntry.uid\n this.gid = this.portable ? null : readEntry.gid\n this.uname = this.portable ? null : readEntry.uname\n this.gname = this.portable ? null : readEntry.gname\n this.size = readEntry.size\n this.mtime = this.noMtime ? null : opt.mtime || readEntry.mtime\n this.atime = this.portable ? null : readEntry.atime\n this.ctime = this.portable ? null : readEntry.ctime\n this.linkpath = normPath(readEntry.linkpath)\n\n if (typeof opt.onwarn === 'function') {\n this.on('warn', opt.onwarn)\n }\n\n let pathWarn = false\n if (!this.preservePaths) {\n const [root, stripped] = stripAbsolutePath(this.path)\n if (root) {\n this.path = stripped\n pathWarn = root\n }\n }\n\n this.remain = readEntry.size\n this.blockRemain = readEntry.startBlockSize\n\n this.header = new Header({\n path: this[PREFIX](this.path),\n linkpath: this.type === 'Link' ? this[PREFIX](this.linkpath)\n : this.linkpath,\n // only the permissions and setuid/setgid/sticky bitflags\n // not the higher-order bits that specify file type\n mode: this.mode,\n uid: this.portable ? null : this.uid,\n gid: this.portable ? null : this.gid,\n size: this.size,\n mtime: this.noMtime ? null : this.mtime,\n type: this.type,\n uname: this.portable ? null : this.uname,\n atime: this.portable ? null : this.atime,\n ctime: this.portable ? null : this.ctime,\n })\n\n if (pathWarn) {\n this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, {\n entry: this,\n path: pathWarn + this.path,\n })\n }\n\n if (this.header.encode() && !this.noPax) {\n super.write(new Pax({\n atime: this.portable ? null : this.atime,\n ctime: this.portable ? null : this.ctime,\n gid: this.portable ? null : this.gid,\n mtime: this.noMtime ? null : this.mtime,\n path: this[PREFIX](this.path),\n linkpath: this.type === 'Link' ? this[PREFIX](this.linkpath)\n : this.linkpath,\n size: this.size,\n uid: this.portable ? null : this.uid,\n uname: this.portable ? null : this.uname,\n dev: this.portable ? null : this.readEntry.dev,\n ino: this.portable ? null : this.readEntry.ino,\n nlink: this.portable ? null : this.readEntry.nlink,\n }).encode())\n }\n\n super.write(this.header.block)\n readEntry.pipe(this)\n }\n\n [PREFIX] (path) {\n return prefixPath(path, this.prefix)\n }\n\n [MODE] (mode) {\n return modeFix(mode, this.type === 'Directory', this.portable)\n }\n\n write (data) {\n const writeLen = data.length\n if (writeLen > this.blockRemain) {\n throw new Error('writing more to entry than is appropriate')\n }\n this.blockRemain -= writeLen\n return super.write(data)\n }\n\n end () {\n if (this.blockRemain) {\n super.write(Buffer.alloc(this.blockRemain))\n }\n return super.end()\n }\n})\n\nWriteEntry.Sync = WriteEntrySync\nWriteEntry.Tar = WriteEntryTar\n\nconst getType = stat =>\n stat.isFile() ? 'File'\n : stat.isDirectory() ? 'Directory'\n : stat.isSymbolicLink() ? 'SymbolicLink'\n : 'Unsupported'\n\nmodule.exports = WriteEntry\n","'use strict'\nconst proc =\n typeof process === 'object' && process\n ? process\n : {\n stdout: null,\n stderr: null,\n }\nconst EE = require('events')\nconst Stream = require('stream')\nconst stringdecoder = require('string_decoder')\nconst SD = stringdecoder.StringDecoder\n\nconst EOF = Symbol('EOF')\nconst MAYBE_EMIT_END = Symbol('maybeEmitEnd')\nconst EMITTED_END = Symbol('emittedEnd')\nconst EMITTING_END = Symbol('emittingEnd')\nconst EMITTED_ERROR = Symbol('emittedError')\nconst CLOSED = Symbol('closed')\nconst READ = Symbol('read')\nconst FLUSH = Symbol('flush')\nconst FLUSHCHUNK = Symbol('flushChunk')\nconst ENCODING = Symbol('encoding')\nconst DECODER = Symbol('decoder')\nconst FLOWING = Symbol('flowing')\nconst PAUSED = Symbol('paused')\nconst RESUME = Symbol('resume')\nconst BUFFER = Symbol('buffer')\nconst PIPES = Symbol('pipes')\nconst BUFFERLENGTH = Symbol('bufferLength')\nconst BUFFERPUSH = Symbol('bufferPush')\nconst BUFFERSHIFT = Symbol('bufferShift')\nconst OBJECTMODE = Symbol('objectMode')\n// internal event when stream is destroyed\nconst DESTROYED = Symbol('destroyed')\n// internal event when stream has an error\nconst ERROR = Symbol('error')\nconst EMITDATA = Symbol('emitData')\nconst EMITEND = Symbol('emitEnd')\nconst EMITEND2 = Symbol('emitEnd2')\nconst ASYNC = Symbol('async')\nconst ABORT = Symbol('abort')\nconst ABORTED = Symbol('aborted')\nconst SIGNAL = Symbol('signal')\n\nconst defer = fn => Promise.resolve().then(fn)\n\n// TODO remove when Node v8 support drops\nconst doIter = global._MP_NO_ITERATOR_SYMBOLS_ !== '1'\nconst ASYNCITERATOR =\n (doIter && Symbol.asyncIterator) || Symbol('asyncIterator not implemented')\nconst ITERATOR =\n (doIter && Symbol.iterator) || Symbol('iterator not implemented')\n\n// events that mean 'the stream is over'\n// these are treated specially, and re-emitted\n// if they are listened for after emitting.\nconst isEndish = ev => ev === 'end' || ev === 'finish' || ev === 'prefinish'\n\nconst isArrayBuffer = b =>\n b instanceof ArrayBuffer ||\n (typeof b === 'object' &&\n b.constructor &&\n b.constructor.name === 'ArrayBuffer' &&\n b.byteLength >= 0)\n\nconst isArrayBufferView = b => !Buffer.isBuffer(b) && ArrayBuffer.isView(b)\n\nclass Pipe {\n constructor(src, dest, opts) {\n this.src = src\n this.dest = dest\n this.opts = opts\n this.ondrain = () => src[RESUME]()\n dest.on('drain', this.ondrain)\n }\n unpipe() {\n this.dest.removeListener('drain', this.ondrain)\n }\n // istanbul ignore next - only here for the prototype\n proxyErrors() {}\n end() {\n this.unpipe()\n if (this.opts.end) this.dest.end()\n }\n}\n\nclass PipeProxyErrors extends Pipe {\n unpipe() {\n this.src.removeListener('error', this.proxyErrors)\n super.unpipe()\n }\n constructor(src, dest, opts) {\n super(src, dest, opts)\n this.proxyErrors = er => dest.emit('error', er)\n src.on('error', this.proxyErrors)\n }\n}\n\nclass Minipass extends Stream {\n constructor(options) {\n super()\n this[FLOWING] = false\n // whether we're explicitly paused\n this[PAUSED] = false\n this[PIPES] = []\n this[BUFFER] = []\n this[OBJECTMODE] = (options && options.objectMode) || false\n if (this[OBJECTMODE]) this[ENCODING] = null\n else this[ENCODING] = (options && options.encoding) || null\n if (this[ENCODING] === 'buffer') this[ENCODING] = null\n this[ASYNC] = (options && !!options.async) || false\n this[DECODER] = this[ENCODING] ? new SD(this[ENCODING]) : null\n this[EOF] = false\n this[EMITTED_END] = false\n this[EMITTING_END] = false\n this[CLOSED] = false\n this[EMITTED_ERROR] = null\n this.writable = true\n this.readable = true\n this[BUFFERLENGTH] = 0\n this[DESTROYED] = false\n if (options && options.debugExposeBuffer === true) {\n Object.defineProperty(this, 'buffer', { get: () => this[BUFFER] })\n }\n if (options && options.debugExposePipes === true) {\n Object.defineProperty(this, 'pipes', { get: () => this[PIPES] })\n }\n this[SIGNAL] = options && options.signal\n this[ABORTED] = false\n if (this[SIGNAL]) {\n this[SIGNAL].addEventListener('abort', () => this[ABORT]())\n if (this[SIGNAL].aborted) {\n this[ABORT]()\n }\n }\n }\n\n get bufferLength() {\n return this[BUFFERLENGTH]\n }\n\n get encoding() {\n return this[ENCODING]\n }\n set encoding(enc) {\n if (this[OBJECTMODE]) throw new Error('cannot set encoding in objectMode')\n\n if (\n this[ENCODING] &&\n enc !== this[ENCODING] &&\n ((this[DECODER] && this[DECODER].lastNeed) || this[BUFFERLENGTH])\n )\n throw new Error('cannot change encoding')\n\n if (this[ENCODING] !== enc) {\n this[DECODER] = enc ? new SD(enc) : null\n if (this[BUFFER].length)\n this[BUFFER] = this[BUFFER].map(chunk => this[DECODER].write(chunk))\n }\n\n this[ENCODING] = enc\n }\n\n setEncoding(enc) {\n this.encoding = enc\n }\n\n get objectMode() {\n return this[OBJECTMODE]\n }\n set objectMode(om) {\n this[OBJECTMODE] = this[OBJECTMODE] || !!om\n }\n\n get ['async']() {\n return this[ASYNC]\n }\n set ['async'](a) {\n this[ASYNC] = this[ASYNC] || !!a\n }\n\n // drop everything and get out of the flow completely\n [ABORT]() {\n this[ABORTED] = true\n this.emit('abort', this[SIGNAL].reason)\n this.destroy(this[SIGNAL].reason)\n }\n\n get aborted() {\n return this[ABORTED]\n }\n set aborted(_) {}\n\n write(chunk, encoding, cb) {\n if (this[ABORTED]) return false\n if (this[EOF]) throw new Error('write after end')\n\n if (this[DESTROYED]) {\n this.emit(\n 'error',\n Object.assign(\n new Error('Cannot call write after a stream was destroyed'),\n { code: 'ERR_STREAM_DESTROYED' }\n )\n )\n return true\n }\n\n if (typeof encoding === 'function') (cb = encoding), (encoding = 'utf8')\n\n if (!encoding) encoding = 'utf8'\n\n const fn = this[ASYNC] ? defer : f => f()\n\n // convert array buffers and typed array views into buffers\n // at some point in the future, we may want to do the opposite!\n // leave strings and buffers as-is\n // anything else switches us into object mode\n if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {\n if (isArrayBufferView(chunk))\n chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength)\n else if (isArrayBuffer(chunk)) chunk = Buffer.from(chunk)\n else if (typeof chunk !== 'string')\n // use the setter so we throw if we have encoding set\n this.objectMode = true\n }\n\n // handle object mode up front, since it's simpler\n // this yields better performance, fewer checks later.\n if (this[OBJECTMODE]) {\n /* istanbul ignore if - maybe impossible? */\n if (this.flowing && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n\n if (this.flowing) this.emit('data', chunk)\n else this[BUFFERPUSH](chunk)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this.flowing\n }\n\n // at this point the chunk is a buffer or string\n // don't buffer it up or send it to the decoder\n if (!chunk.length) {\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n if (cb) fn(cb)\n return this.flowing\n }\n\n // fast-path writing strings of same encoding to a stream with\n // an empty buffer, skipping the buffer/decoder dance\n if (\n typeof chunk === 'string' &&\n // unless it is a string already ready for us to use\n !(encoding === this[ENCODING] && !this[DECODER].lastNeed)\n ) {\n chunk = Buffer.from(chunk, encoding)\n }\n\n if (Buffer.isBuffer(chunk) && this[ENCODING])\n chunk = this[DECODER].write(chunk)\n\n // Note: flushing CAN potentially switch us into not-flowing mode\n if (this.flowing && this[BUFFERLENGTH] !== 0) this[FLUSH](true)\n\n if (this.flowing) this.emit('data', chunk)\n else this[BUFFERPUSH](chunk)\n\n if (this[BUFFERLENGTH] !== 0) this.emit('readable')\n\n if (cb) fn(cb)\n\n return this.flowing\n }\n\n read(n) {\n if (this[DESTROYED]) return null\n\n if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH]) {\n this[MAYBE_EMIT_END]()\n return null\n }\n\n if (this[OBJECTMODE]) n = null\n\n if (this[BUFFER].length > 1 && !this[OBJECTMODE]) {\n if (this.encoding) this[BUFFER] = [this[BUFFER].join('')]\n else this[BUFFER] = [Buffer.concat(this[BUFFER], this[BUFFERLENGTH])]\n }\n\n const ret = this[READ](n || null, this[BUFFER][0])\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [READ](n, chunk) {\n if (n === chunk.length || n === null) this[BUFFERSHIFT]()\n else {\n this[BUFFER][0] = chunk.slice(n)\n chunk = chunk.slice(0, n)\n this[BUFFERLENGTH] -= n\n }\n\n this.emit('data', chunk)\n\n if (!this[BUFFER].length && !this[EOF]) this.emit('drain')\n\n return chunk\n }\n\n end(chunk, encoding, cb) {\n if (typeof chunk === 'function') (cb = chunk), (chunk = null)\n if (typeof encoding === 'function') (cb = encoding), (encoding = 'utf8')\n if (chunk) this.write(chunk, encoding)\n if (cb) this.once('end', cb)\n this[EOF] = true\n this.writable = false\n\n // if we haven't written anything, then go ahead and emit,\n // even if we're not reading.\n // we'll re-emit if a new 'end' listener is added anyway.\n // This makes MP more suitable to write-only use cases.\n if (this.flowing || !this[PAUSED]) this[MAYBE_EMIT_END]()\n return this\n }\n\n // don't let the internal resume be overwritten\n [RESUME]() {\n if (this[DESTROYED]) return\n\n this[PAUSED] = false\n this[FLOWING] = true\n this.emit('resume')\n if (this[BUFFER].length) this[FLUSH]()\n else if (this[EOF]) this[MAYBE_EMIT_END]()\n else this.emit('drain')\n }\n\n resume() {\n return this[RESUME]()\n }\n\n pause() {\n this[FLOWING] = false\n this[PAUSED] = true\n }\n\n get destroyed() {\n return this[DESTROYED]\n }\n\n get flowing() {\n return this[FLOWING]\n }\n\n get paused() {\n return this[PAUSED]\n }\n\n [BUFFERPUSH](chunk) {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] += 1\n else this[BUFFERLENGTH] += chunk.length\n this[BUFFER].push(chunk)\n }\n\n [BUFFERSHIFT]() {\n if (this[OBJECTMODE]) this[BUFFERLENGTH] -= 1\n else this[BUFFERLENGTH] -= this[BUFFER][0].length\n return this[BUFFER].shift()\n }\n\n [FLUSH](noDrain) {\n do {} while (this[FLUSHCHUNK](this[BUFFERSHIFT]()) && this[BUFFER].length)\n\n if (!noDrain && !this[BUFFER].length && !this[EOF]) this.emit('drain')\n }\n\n [FLUSHCHUNK](chunk) {\n this.emit('data', chunk)\n return this.flowing\n }\n\n pipe(dest, opts) {\n if (this[DESTROYED]) return\n\n const ended = this[EMITTED_END]\n opts = opts || {}\n if (dest === proc.stdout || dest === proc.stderr) opts.end = false\n else opts.end = opts.end !== false\n opts.proxyErrors = !!opts.proxyErrors\n\n // piping an ended stream ends immediately\n if (ended) {\n if (opts.end) dest.end()\n } else {\n this[PIPES].push(\n !opts.proxyErrors\n ? new Pipe(this, dest, opts)\n : new PipeProxyErrors(this, dest, opts)\n )\n if (this[ASYNC]) defer(() => this[RESUME]())\n else this[RESUME]()\n }\n\n return dest\n }\n\n unpipe(dest) {\n const p = this[PIPES].find(p => p.dest === dest)\n if (p) {\n this[PIPES].splice(this[PIPES].indexOf(p), 1)\n p.unpipe()\n }\n }\n\n addListener(ev, fn) {\n return this.on(ev, fn)\n }\n\n on(ev, fn) {\n const ret = super.on(ev, fn)\n if (ev === 'data' && !this[PIPES].length && !this.flowing) this[RESUME]()\n else if (ev === 'readable' && this[BUFFERLENGTH] !== 0)\n super.emit('readable')\n else if (isEndish(ev) && this[EMITTED_END]) {\n super.emit(ev)\n this.removeAllListeners(ev)\n } else if (ev === 'error' && this[EMITTED_ERROR]) {\n if (this[ASYNC]) defer(() => fn.call(this, this[EMITTED_ERROR]))\n else fn.call(this, this[EMITTED_ERROR])\n }\n return ret\n }\n\n get emittedEnd() {\n return this[EMITTED_END]\n }\n\n [MAYBE_EMIT_END]() {\n if (\n !this[EMITTING_END] &&\n !this[EMITTED_END] &&\n !this[DESTROYED] &&\n this[BUFFER].length === 0 &&\n this[EOF]\n ) {\n this[EMITTING_END] = true\n this.emit('end')\n this.emit('prefinish')\n this.emit('finish')\n if (this[CLOSED]) this.emit('close')\n this[EMITTING_END] = false\n }\n }\n\n emit(ev, data, ...extra) {\n // error and close are only events allowed after calling destroy()\n if (ev !== 'error' && ev !== 'close' && ev !== DESTROYED && this[DESTROYED])\n return\n else if (ev === 'data') {\n return !this[OBJECTMODE] && !data\n ? false\n : this[ASYNC]\n ? defer(() => this[EMITDATA](data))\n : this[EMITDATA](data)\n } else if (ev === 'end') {\n return this[EMITEND]()\n } else if (ev === 'close') {\n this[CLOSED] = true\n // don't emit close before 'end' and 'finish'\n if (!this[EMITTED_END] && !this[DESTROYED]) return\n const ret = super.emit('close')\n this.removeAllListeners('close')\n return ret\n } else if (ev === 'error') {\n this[EMITTED_ERROR] = data\n super.emit(ERROR, data)\n const ret =\n !this[SIGNAL] || this.listeners('error').length\n ? super.emit('error', data)\n : false\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'resume') {\n const ret = super.emit('resume')\n this[MAYBE_EMIT_END]()\n return ret\n } else if (ev === 'finish' || ev === 'prefinish') {\n const ret = super.emit(ev)\n this.removeAllListeners(ev)\n return ret\n }\n\n // Some other unknown event\n const ret = super.emit(ev, data, ...extra)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITDATA](data) {\n for (const p of this[PIPES]) {\n if (p.dest.write(data) === false) this.pause()\n }\n const ret = super.emit('data', data)\n this[MAYBE_EMIT_END]()\n return ret\n }\n\n [EMITEND]() {\n if (this[EMITTED_END]) return\n\n this[EMITTED_END] = true\n this.readable = false\n if (this[ASYNC]) defer(() => this[EMITEND2]())\n else this[EMITEND2]()\n }\n\n [EMITEND2]() {\n if (this[DECODER]) {\n const data = this[DECODER].end()\n if (data) {\n for (const p of this[PIPES]) {\n p.dest.write(data)\n }\n super.emit('data', data)\n }\n }\n\n for (const p of this[PIPES]) {\n p.end()\n }\n const ret = super.emit('end')\n this.removeAllListeners('end')\n return ret\n }\n\n // const all = await stream.collect()\n collect() {\n const buf = []\n if (!this[OBJECTMODE]) buf.dataLength = 0\n // set the promise first, in case an error is raised\n // by triggering the flow here.\n const p = this.promise()\n this.on('data', c => {\n buf.push(c)\n if (!this[OBJECTMODE]) buf.dataLength += c.length\n })\n return p.then(() => buf)\n }\n\n // const data = await stream.concat()\n concat() {\n return this[OBJECTMODE]\n ? Promise.reject(new Error('cannot concat in objectMode'))\n : this.collect().then(buf =>\n this[OBJECTMODE]\n ? Promise.reject(new Error('cannot concat in objectMode'))\n : this[ENCODING]\n ? buf.join('')\n : Buffer.concat(buf, buf.dataLength)\n )\n }\n\n // stream.promise().then(() => done, er => emitted error)\n promise() {\n return new Promise((resolve, reject) => {\n this.on(DESTROYED, () => reject(new Error('stream destroyed')))\n this.on('error', er => reject(er))\n this.on('end', () => resolve())\n })\n }\n\n // for await (let chunk of stream)\n [ASYNCITERATOR]() {\n let stopped = false\n const stop = () => {\n this.pause()\n stopped = true\n return Promise.resolve({ done: true })\n }\n const next = () => {\n if (stopped) return stop()\n const res = this.read()\n if (res !== null) return Promise.resolve({ done: false, value: res })\n\n if (this[EOF]) return stop()\n\n let resolve = null\n let reject = null\n const onerr = er => {\n this.removeListener('data', ondata)\n this.removeListener('end', onend)\n this.removeListener(DESTROYED, ondestroy)\n stop()\n reject(er)\n }\n const ondata = value => {\n this.removeListener('error', onerr)\n this.removeListener('end', onend)\n this.removeListener(DESTROYED, ondestroy)\n this.pause()\n resolve({ value: value, done: !!this[EOF] })\n }\n const onend = () => {\n this.removeListener('error', onerr)\n this.removeListener('data', ondata)\n this.removeListener(DESTROYED, ondestroy)\n stop()\n resolve({ done: true })\n }\n const ondestroy = () => onerr(new Error('stream destroyed'))\n return new Promise((res, rej) => {\n reject = rej\n resolve = res\n this.once(DESTROYED, ondestroy)\n this.once('error', onerr)\n this.once('end', onend)\n this.once('data', ondata)\n })\n }\n\n return {\n next,\n throw: stop,\n return: stop,\n [ASYNCITERATOR]() {\n return this\n },\n }\n }\n\n // for (let chunk of stream)\n [ITERATOR]() {\n let stopped = false\n const stop = () => {\n this.pause()\n this.removeListener(ERROR, stop)\n this.removeListener(DESTROYED, stop)\n this.removeListener('end', stop)\n stopped = true\n return { done: true }\n }\n\n const next = () => {\n if (stopped) return stop()\n const value = this.read()\n return value === null ? stop() : { value }\n }\n this.once('end', stop)\n this.once(ERROR, stop)\n this.once(DESTROYED, stop)\n\n return {\n next,\n throw: stop,\n return: stop,\n [ITERATOR]() {\n return this\n },\n }\n }\n\n destroy(er) {\n if (this[DESTROYED]) {\n if (er) this.emit('error', er)\n else this.emit(DESTROYED)\n return this\n }\n\n this[DESTROYED] = true\n\n // throw away all buffered data, it's never coming out\n this[BUFFER].length = 0\n this[BUFFERLENGTH] = 0\n\n if (typeof this.close === 'function' && !this[CLOSED]) this.close()\n\n if (er) this.emit('error', er)\n // if no error to emit, still reject pending promises\n else this.emit(DESTROYED)\n\n return this\n }\n\n static isStream(s) {\n return (\n !!s &&\n (s instanceof Minipass ||\n s instanceof Stream ||\n (s instanceof EE &&\n // readable\n (typeof s.pipe === 'function' ||\n // writable\n (typeof s.write === 'function' && typeof s.end === 'function'))))\n )\n }\n}\n\nexports.Minipass = Minipass\n","'use strict'\n\nexports.fromCallback = function (fn) {\n return Object.defineProperty(function (...args) {\n if (typeof args[args.length - 1] === 'function') fn.apply(this, args)\n else {\n return new Promise((resolve, reject) => {\n args.push((err, res) => (err != null) ? reject(err) : resolve(res))\n fn.apply(this, args)\n })\n }\n }, 'name', { value: fn.name })\n}\n\nexports.fromPromise = function (fn) {\n return Object.defineProperty(function (...args) {\n const cb = args[args.length - 1]\n if (typeof cb !== 'function') return fn.apply(this, args)\n else {\n args.pop()\n fn.apply(this, args).then(r => cb(null, r), cb)\n }\n }, 'name', { value: fn.name })\n}\n","'use strict'\nmodule.exports = function (Yallist) {\n Yallist.prototype[Symbol.iterator] = function* () {\n for (let walker = this.head; walker; walker = walker.next) {\n yield walker.value\n }\n }\n}\n","'use strict'\nmodule.exports = Yallist\n\nYallist.Node = Node\nYallist.create = Yallist\n\nfunction Yallist (list) {\n var self = this\n if (!(self instanceof Yallist)) {\n self = new Yallist()\n }\n\n self.tail = null\n self.head = null\n self.length = 0\n\n if (list && typeof list.forEach === 'function') {\n list.forEach(function (item) {\n self.push(item)\n })\n } else if (arguments.length > 0) {\n for (var i = 0, l = arguments.length; i < l; i++) {\n self.push(arguments[i])\n }\n }\n\n return self\n}\n\nYallist.prototype.removeNode = function (node) {\n if (node.list !== this) {\n throw new Error('removing node which does not belong to this list')\n }\n\n var next = node.next\n var prev = node.prev\n\n if (next) {\n next.prev = prev\n }\n\n if (prev) {\n prev.next = next\n }\n\n if (node === this.head) {\n this.head = next\n }\n if (node === this.tail) {\n this.tail = prev\n }\n\n node.list.length--\n node.next = null\n node.prev = null\n node.list = null\n\n return next\n}\n\nYallist.prototype.unshiftNode = function (node) {\n if (node === this.head) {\n return\n }\n\n if (node.list) {\n node.list.removeNode(node)\n }\n\n var head = this.head\n node.list = this\n node.next = head\n if (head) {\n head.prev = node\n }\n\n this.head = node\n if (!this.tail) {\n this.tail = node\n }\n this.length++\n}\n\nYallist.prototype.pushNode = function (node) {\n if (node === this.tail) {\n return\n }\n\n if (node.list) {\n node.list.removeNode(node)\n }\n\n var tail = this.tail\n node.list = this\n node.prev = tail\n if (tail) {\n tail.next = node\n }\n\n this.tail = node\n if (!this.head) {\n this.head = node\n }\n this.length++\n}\n\nYallist.prototype.push = function () {\n for (var i = 0, l = arguments.length; i < l; i++) {\n push(this, arguments[i])\n }\n return this.length\n}\n\nYallist.prototype.unshift = function () {\n for (var i = 0, l = arguments.length; i < l; i++) {\n unshift(this, arguments[i])\n }\n return this.length\n}\n\nYallist.prototype.pop = function () {\n if (!this.tail) {\n return undefined\n }\n\n var res = this.tail.value\n this.tail = this.tail.prev\n if (this.tail) {\n this.tail.next = null\n } else {\n this.head = null\n }\n this.length--\n return res\n}\n\nYallist.prototype.shift = function () {\n if (!this.head) {\n return undefined\n }\n\n var res = this.head.value\n this.head = this.head.next\n if (this.head) {\n this.head.prev = null\n } else {\n this.tail = null\n }\n this.length--\n return res\n}\n\nYallist.prototype.forEach = function (fn, thisp) {\n thisp = thisp || this\n for (var walker = this.head, i = 0; walker !== null; i++) {\n fn.call(thisp, walker.value, i, this)\n walker = walker.next\n }\n}\n\nYallist.prototype.forEachReverse = function (fn, thisp) {\n thisp = thisp || this\n for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {\n fn.call(thisp, walker.value, i, this)\n walker = walker.prev\n }\n}\n\nYallist.prototype.get = function (n) {\n for (var i = 0, walker = this.head; walker !== null && i < n; i++) {\n // abort out of the list early if we hit a cycle\n walker = walker.next\n }\n if (i === n && walker !== null) {\n return walker.value\n }\n}\n\nYallist.prototype.getReverse = function (n) {\n for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {\n // abort out of the list early if we hit a cycle\n walker = walker.prev\n }\n if (i === n && walker !== null) {\n return walker.value\n }\n}\n\nYallist.prototype.map = function (fn, thisp) {\n thisp = thisp || this\n var res = new Yallist()\n for (var walker = this.head; walker !== null;) {\n res.push(fn.call(thisp, walker.value, this))\n walker = walker.next\n }\n return res\n}\n\nYallist.prototype.mapReverse = function (fn, thisp) {\n thisp = thisp || this\n var res = new Yallist()\n for (var walker = this.tail; walker !== null;) {\n res.push(fn.call(thisp, walker.value, this))\n walker = walker.prev\n }\n return res\n}\n\nYallist.prototype.reduce = function (fn, initial) {\n var acc\n var walker = this.head\n if (arguments.length > 1) {\n acc = initial\n } else if (this.head) {\n walker = this.head.next\n acc = this.head.value\n } else {\n throw new TypeError('Reduce of empty list with no initial value')\n }\n\n for (var i = 0; walker !== null; i++) {\n acc = fn(acc, walker.value, i)\n walker = walker.next\n }\n\n return acc\n}\n\nYallist.prototype.reduceReverse = function (fn, initial) {\n var acc\n var walker = this.tail\n if (arguments.length > 1) {\n acc = initial\n } else if (this.tail) {\n walker = this.tail.prev\n acc = this.tail.value\n } else {\n throw new TypeError('Reduce of empty list with no initial value')\n }\n\n for (var i = this.length - 1; walker !== null; i--) {\n acc = fn(acc, walker.value, i)\n walker = walker.prev\n }\n\n return acc\n}\n\nYallist.prototype.toArray = function () {\n var arr = new Array(this.length)\n for (var i = 0, walker = this.head; walker !== null; i++) {\n arr[i] = walker.value\n walker = walker.next\n }\n return arr\n}\n\nYallist.prototype.toArrayReverse = function () {\n var arr = new Array(this.length)\n for (var i = 0, walker = this.tail; walker !== null; i++) {\n arr[i] = walker.value\n walker = walker.prev\n }\n return arr\n}\n\nYallist.prototype.slice = function (from, to) {\n to = to || this.length\n if (to < 0) {\n to += this.length\n }\n from = from || 0\n if (from < 0) {\n from += this.length\n }\n var ret = new Yallist()\n if (to < from || to < 0) {\n return ret\n }\n if (from < 0) {\n from = 0\n }\n if (to > this.length) {\n to = this.length\n }\n for (var i = 0, walker = this.head; walker !== null && i < from; i++) {\n walker = walker.next\n }\n for (; walker !== null && i < to; i++, walker = walker.next) {\n ret.push(walker.value)\n }\n return ret\n}\n\nYallist.prototype.sliceReverse = function (from, to) {\n to = to || this.length\n if (to < 0) {\n to += this.length\n }\n from = from || 0\n if (from < 0) {\n from += this.length\n }\n var ret = new Yallist()\n if (to < from || to < 0) {\n return ret\n }\n if (from < 0) {\n from = 0\n }\n if (to > this.length) {\n to = this.length\n }\n for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {\n walker = walker.prev\n }\n for (; walker !== null && i > from; i--, walker = walker.prev) {\n ret.push(walker.value)\n }\n return ret\n}\n\nYallist.prototype.splice = function (start, deleteCount, ...nodes) {\n if (start > this.length) {\n start = this.length - 1\n }\n if (start < 0) {\n start = this.length + start;\n }\n\n for (var i = 0, walker = this.head; walker !== null && i < start; i++) {\n walker = walker.next\n }\n\n var ret = []\n for (var i = 0; walker && i < deleteCount; i++) {\n ret.push(walker.value)\n walker = this.removeNode(walker)\n }\n if (walker === null) {\n walker = this.tail\n }\n\n if (walker !== this.head && walker !== this.tail) {\n walker = walker.prev\n }\n\n for (var i = 0; i < nodes.length; i++) {\n walker = insert(this, walker, nodes[i])\n }\n return ret;\n}\n\nYallist.prototype.reverse = function () {\n var head = this.head\n var tail = this.tail\n for (var walker = head; walker !== null; walker = walker.prev) {\n var p = walker.prev\n walker.prev = walker.next\n walker.next = p\n }\n this.head = tail\n this.tail = head\n return this\n}\n\nfunction insert (self, node, value) {\n var inserted = node === self.head ?\n new Node(value, null, node, self) :\n new Node(value, node, node.next, self)\n\n if (inserted.next === null) {\n self.tail = inserted\n }\n if (inserted.prev === null) {\n self.head = inserted\n }\n\n self.length++\n\n return inserted\n}\n\nfunction push (self, item) {\n self.tail = new Node(item, self.tail, null, self)\n if (!self.head) {\n self.head = self.tail\n }\n self.length++\n}\n\nfunction unshift (self, item) {\n self.head = new Node(item, null, self.head, self)\n if (!self.tail) {\n self.tail = self.head\n }\n self.length++\n}\n\nfunction Node (value, prev, next, list) {\n if (!(this instanceof Node)) {\n return new Node(value, prev, next, list)\n }\n\n this.list = list\n this.value = value\n\n if (prev) {\n prev.next = this\n this.prev = prev\n } else {\n this.prev = null\n }\n\n if (next) {\n next.prev = this\n this.next = next\n } else {\n this.next = null\n }\n}\n\ntry {\n // add if support for Symbol.iterator is present\n require('./iterator.js')(Yallist)\n} catch (er) {}\n","import { JsiiErrorType } from './kernel';\n\nexport const TOKEN_REF = '$jsii.byref';\nexport const TOKEN_INTERFACES = '$jsii.interfaces';\nexport const TOKEN_DATE = '$jsii.date';\nexport const TOKEN_ENUM = '$jsii.enum';\nexport const TOKEN_MAP = '$jsii.map';\nexport const TOKEN_STRUCT = '$jsii.struct';\n\nexport interface ObjRef {\n readonly [TOKEN_REF]: string;\n [TOKEN_INTERFACES]?: readonly string[];\n}\n\nexport function isObjRef(value: any): value is ObjRef {\n return typeof value === 'object' && value !== null && TOKEN_REF in value;\n}\n\nexport interface WireDate {\n readonly [TOKEN_DATE]: string;\n}\n\nexport function isWireDate(value: any): value is WireDate {\n return typeof value === 'object' && value !== null && TOKEN_DATE in value;\n}\n\nexport interface WireEnum {\n readonly [TOKEN_ENUM]: string;\n}\n\nexport function isWireEnum(value: any): value is WireEnum {\n return typeof value === 'object' && value !== null && TOKEN_ENUM in value;\n}\n\nexport interface WireMap {\n readonly [TOKEN_MAP]: { readonly [key: string]: any };\n}\n\nexport function isWireMap(value: any): value is WireMap {\n return typeof value === 'object' && value !== null && TOKEN_MAP in value;\n}\n\nexport interface WireStruct {\n readonly [TOKEN_STRUCT]: {\n readonly fqn: string;\n readonly data: { [key: string]: any };\n };\n}\n\nexport function isWireStruct(value: any): value is WireStruct {\n return typeof value === 'object' && value !== null && TOKEN_STRUCT in value;\n}\n\nexport type Override = MethodOverride | PropertyOverride;\n\nexport interface MethodOverride {\n readonly method: string;\n readonly cookie?: string;\n}\n\nexport function isMethodOverride(value: Override): value is MethodOverride {\n return (value as any).method != null; // Python passes \"null\"\n}\n\nexport interface PropertyOverride {\n readonly property: string;\n readonly cookie?: string;\n}\n\nexport function isPropertyOverride(value: Override): value is PropertyOverride {\n return (value as any).property != null; // Python passes \"null\"\n}\n\nexport interface Callback {\n readonly cbid: string;\n readonly cookie: string | undefined;\n readonly invoke?: InvokeRequest;\n readonly get?: GetRequest;\n readonly set?: SetRequest;\n}\n\nexport interface HelloResponse {\n readonly hello: string;\n}\n\nexport interface LoadRequest {\n /** The name of the assembly */\n readonly name: string;\n\n /** Assembly version */\n readonly version: string;\n\n /** The tarball of the package */\n readonly tarball: string;\n}\n\nexport interface LoadResponse {\n readonly assembly: string;\n readonly types: number;\n}\n\nexport interface GetScriptCommandRequest {\n readonly assembly: string;\n readonly script: string;\n readonly args?: string[];\n}\n\nexport interface GetScriptCommandResponse {\n command: string;\n args: string[];\n env: Record;\n}\n\nexport interface InvokeScriptRequest {\n readonly assembly: string;\n readonly script: string;\n readonly args?: string[];\n}\n\nexport interface InvokeScriptResponse {\n readonly status: number | null;\n readonly stdout: string;\n readonly stderr: string;\n readonly signal: string | null;\n}\n\nexport interface CreateRequest {\n /**\n * The FQN of the class of which an instance is requested (or \"Object\")\n */\n readonly fqn: string;\n\n /**\n * The FQNs of interfaces the instance implements, if any. Declaring\n * interfaces that the class denoted by `fqn` implements is not necessary.\n * This means that members of interfaces found in this property should\n * declare members that are found in the `overrides` property.\n */\n readonly interfaces?: string[];\n\n /**\n * Arguments to pass to the constructor of `fqn`. (\"Object\" accepts none)\n */\n readonly args?: any[];\n\n /**\n * Declarations of method overrides that should trigger callbacks\n */\n readonly overrides?: Override[];\n}\n\nexport type CreateResponse = ObjRef;\n\nexport interface DelRequest {\n readonly objref: ObjRef;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface DelResponse {}\n\nexport interface GetRequest {\n readonly objref: ObjRef;\n readonly property: string;\n}\n\nexport interface StaticGetRequest {\n readonly fqn: string;\n readonly property: string;\n}\n\nexport interface GetResponse {\n readonly value: any;\n}\n\nexport interface StaticSetRequest {\n readonly fqn: string;\n readonly property: string;\n readonly value: any;\n}\n\nexport interface SetRequest {\n readonly objref: ObjRef;\n readonly property: string;\n readonly value: any;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface SetResponse {}\n\nexport interface StaticInvokeRequest {\n readonly fqn: string;\n readonly method: string;\n readonly args?: any[];\n}\n\nexport interface InvokeRequest {\n readonly objref: ObjRef;\n readonly method: string;\n readonly args?: any[];\n}\n\nexport interface InvokeResponse {\n readonly result: any;\n}\n\nexport interface BeginRequest {\n readonly objref: ObjRef;\n readonly method: string;\n readonly args?: any[];\n}\n\nexport interface BeginResponse {\n readonly promiseid: string;\n}\n\nexport interface EndRequest {\n readonly promiseid: string;\n}\n\nexport interface EndResponse {\n readonly result: any;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface CallbacksRequest {}\n\nexport interface CallbacksResponse {\n readonly callbacks: Callback[];\n}\n\nexport interface CompleteRequest {\n readonly cbid: string;\n readonly err?: string;\n readonly name?: string;\n readonly result?: any;\n}\n\nexport interface CompleteResponse {\n readonly cbid: string;\n}\n\nexport interface NamingRequest {\n readonly assembly: string;\n}\n\nexport interface NamingResponse {\n readonly naming: {\n readonly [language: string]: { readonly [key: string]: any } | undefined;\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface StatsRequest {}\n\nexport interface StatsResponse {\n readonly objectCount: number;\n}\n\nexport type KernelRequest =\n | LoadRequest\n | CreateRequest\n | DelRequest\n | GetRequest\n | SetRequest\n | InvokeRequest\n | BeginRequest\n | EndRequest\n | CallbacksRequest\n | CompleteRequest\n | NamingRequest\n | StatsRequest;\n\nexport type KernelResponse =\n | HelloResponse\n | LoadResponse\n | CreateResponse\n | DelResponse\n | GetResponse\n | SetResponse\n | InvokeResponse\n | BeginResponse\n | EndResponse\n | CallbacksResponse\n | CompleteResponse\n | NamingResponse\n | StatsResponse;\n\nexport interface OkayResponse {\n readonly ok: any;\n}\n\nexport interface ErrorResponse {\n readonly error: string;\n readonly stack?: string;\n readonly name?: JsiiErrorType;\n}\n","import { createHash } from 'crypto';\nimport { openSync, readSync, closeSync } from 'fs';\n\nconst ALGORITHM = 'sha256';\n\nexport function digestFile(\n path: string,\n ...comments: readonly string[]\n): Buffer {\n const hash = createHash(ALGORITHM);\n\n const buffer = Buffer.alloc(16_384);\n const fd = openSync(path, 'r');\n try {\n let bytesRead = 0;\n while ((bytesRead = readSync(fd, buffer)) > 0) {\n hash.update(buffer.slice(0, bytesRead));\n }\n for (const comment of comments) {\n hash.update('\\0');\n hash.update(comment);\n }\n return hash.digest();\n } finally {\n closeSync(fd);\n }\n}\n","import {\n existsSync,\n mkdirSync,\n readdirSync,\n readFileSync,\n realpathSync,\n rmdirSync,\n rmSync,\n statSync,\n utimesSync,\n writeFileSync,\n} from 'fs';\nimport { lockSync, Options, unlockSync } from 'lockfile';\nimport { dirname, join } from 'path';\n\nimport { digestFile } from './digest-file';\n\nconst MARKER_FILE_NAME = '.jsii-runtime-package-cache';\n\nconst ONE_DAY_IN_MS = 86_400_000;\nconst PRUNE_AFTER_MILLISECONDS = process.env.JSII_RUNTIME_PACKAGE_CACHE_TTL\n ? parseInt(process.env.JSII_RUNTIME_PACKAGE_CACHE_TTL, 10) * ONE_DAY_IN_MS\n : 30 * ONE_DAY_IN_MS;\n\nexport class DiskCache {\n static readonly #CACHE = new Map();\n\n public static inDirectory(path: string): DiskCache {\n const didCreate = mkdirSync(path, { recursive: true }) != null;\n if (didCreate && process.platform === 'darwin') {\n // Mark the directories for no iCloud sync, no Spotlight indexing, no TimeMachine backup\n // @see https://michaelbach.de/2019/03/19/MacOS-nosync-noindex-nobackup.html\n writeFileSync(join(path, '.nobackup'), '');\n writeFileSync(join(path, '.noindex'), '');\n writeFileSync(join(path, '.nosync'), '');\n }\n\n path = realpathSync(path);\n if (!this.#CACHE.has(path)) {\n this.#CACHE.set(path, new DiskCache(path));\n }\n return this.#CACHE.get(path)!;\n }\n\n readonly #root: string;\n\n private constructor(root: string) {\n this.#root = root;\n process.once('beforeExit', () => this.pruneExpiredEntries());\n }\n\n public entry(...key: readonly string[]): Entry {\n if (key.length === 0) {\n throw new Error(`Cache entry key must contain at least 1 element!`);\n }\n\n return new Entry(\n join(\n this.#root,\n ...key.flatMap((s) =>\n s\n .replace(/[^@a-z0-9_.\\\\/-]+/g, '_')\n .split(/[\\\\/]+/)\n .map((ss) => {\n if (ss === '..') {\n throw new Error(\n `A cache entry key cannot contain a '..' path segment! (${s})`,\n );\n }\n return ss;\n }),\n ),\n ),\n );\n }\n\n public entryFor(path: string, ...comments: readonly string[]): Entry {\n const rawDigest = digestFile(path, ...comments);\n return this.entry(...comments, rawDigest.toString('hex'));\n }\n\n public pruneExpiredEntries() {\n const cutOff = new Date(Date.now() - PRUNE_AFTER_MILLISECONDS);\n for (const entry of this.#entries()) {\n if (entry.atime < cutOff) {\n entry.lock((lockedEntry) => {\n // Check again in case it's been accessed which we waited for the lock...\n if (entry.atime > cutOff) {\n return;\n }\n lockedEntry.delete();\n });\n }\n }\n\n for (const dir of directoriesUnder(this.#root, true)) {\n if (process.platform === 'darwin') {\n try {\n rmSync(join(dir, '.DS_Store'), { force: true });\n } catch {\n // Ignore errors...\n }\n }\n if (readdirSync(dir).length === 0) {\n try {\n rmdirSync(dir);\n } catch {\n // Ignore errors, directory may no longer be empty...\n }\n }\n }\n }\n\n *#entries(): Generator {\n yield* inDirectory(this.#root);\n\n function* inDirectory(dir: string): Generator {\n if (existsSync(join(dir, MARKER_FILE_NAME))) {\n return yield new Entry(dir);\n }\n for (const file of directoriesUnder(dir)) {\n yield* inDirectory(file);\n }\n }\n }\n}\n\nexport class Entry {\n public constructor(public readonly path: string) {}\n\n public get atime(): Date {\n try {\n const stat = statSync(this.#markerFile);\n return stat.atime;\n } catch (err: any) {\n if (err.code !== 'ENOENT') {\n throw err;\n }\n return new Date(0);\n }\n }\n\n public get pathExists() {\n return existsSync(this.path);\n }\n\n get #lockFile(): string {\n return `${this.path}.lock`;\n }\n\n get #markerFile(): string {\n return join(this.path, MARKER_FILE_NAME);\n }\n\n /**\n * Whether the directory has been completely written\n *\n * The presence of the marker file is a signal that we can skip trying to lock the directory.\n */\n public get isComplete(): boolean {\n return existsSync(this.#markerFile);\n }\n\n /**\n * Retrieve an entry from the cache\n *\n * If the entry doesn't exist yet, use 'cb' to produce the file contents.\n */\n public retrieve(cb: (path: string) => void): {\n path: string;\n cache: 'hit' | 'miss';\n } {\n // If the marker file already exists, update its timestamp and immediately return.\n // We don't even try to lock.\n if (this.isComplete) {\n this.#touchMarkerFile();\n return { path: this.path, cache: 'hit' };\n }\n\n let cache: 'hit' | 'miss' = 'miss';\n this.lock((lock) => {\n // While we all fought to acquire the lock, someone else might have completed already.\n if (this.isComplete) {\n cache = 'hit';\n return;\n }\n\n // !!!IMPORTANT!!!\n // Extract directly into the final target directory, as certain antivirus\n // software configurations on Windows will make a `renameSync` operation\n // fail with EPERM until the files have been fully analyzed.\n mkdirSync(this.path, { recursive: true });\n try {\n cb(this.path);\n } catch (error) {\n rmSync(this.path, { force: true, recursive: true });\n throw error;\n }\n lock.markComplete();\n });\n return { path: this.path, cache };\n }\n\n public lock(cb: (entry: LockedEntry) => T): T {\n mkdirSync(dirname(this.path), { recursive: true });\n lockSyncWithWait(this.#lockFile, {\n retries: 12,\n // Extracting the largest tarball takes ~5s\n stale: 10_000,\n });\n let disposed = false;\n try {\n return cb({\n delete: () => {\n if (disposed) {\n throw new Error(\n `Cannot delete ${this.path} once the lock block was returned!`,\n );\n }\n rmSync(this.path, { force: true, recursive: true });\n },\n write: (name, content) => {\n if (disposed) {\n throw new Error(\n `Cannot write ${join(\n this.path,\n name,\n )} once the lock block was returned!`,\n );\n }\n\n mkdirSync(dirname(join(this.path, name)), { recursive: true });\n writeFileSync(join(this.path, name), content);\n },\n markComplete: () => {\n if (disposed) {\n throw new Error(\n `Cannot touch ${this.path} once the lock block was returned!`,\n );\n }\n this.#touchMarkerFile();\n },\n });\n } finally {\n disposed = true;\n unlockSync(this.#lockFile);\n }\n }\n\n /**\n * Update the timestamp on the marker file\n */\n #touchMarkerFile() {\n if (this.pathExists) {\n try {\n const now = new Date();\n utimesSync(this.#markerFile, now, now);\n } catch (e: any) {\n if (e.code !== 'ENOENT') {\n throw e;\n }\n writeFileSync(this.#markerFile, '');\n }\n }\n }\n\n public read(file: string): Buffer | undefined {\n try {\n return readFileSync(join(this.path, file));\n } catch (error: any) {\n if (error.code === 'ENOENT') {\n return undefined;\n }\n throw error;\n }\n }\n}\n\nexport interface LockedEntry {\n delete(): void;\n write(name: string, data: Buffer): void;\n\n /**\n * Mark the entry has having been completed\n *\n * The modification time of this file is used for cleanup.\n */\n markComplete(): void;\n}\n\nfunction* directoriesUnder(\n root: string,\n recursive = false,\n ignoreErrors = true,\n): Generator {\n for (const file of readdirSync(root)) {\n const path = join(root, file);\n try {\n const stat = statSync(path);\n if (stat.isDirectory()) {\n if (recursive) {\n yield* directoriesUnder(path, recursive, ignoreErrors);\n }\n yield path;\n }\n } catch (error) {\n if (!ignoreErrors) {\n throw error;\n }\n }\n }\n}\n\n/**\n * We must use 'lockSync', but that doesn't support waiting (because waiting is only supported for async APIs)\n * so we have to build our own looping locker with waits\n */\nfunction lockSyncWithWait(path: string, options: Options) {\n let retries = options.retries ?? 0;\n let sleep = 100;\n\n // eslint-disable-next-line no-constant-condition\n while (true) {\n try {\n lockSync(path, {\n retries: 0,\n stale: options.stale,\n });\n return;\n } catch (e: any) {\n if (retries === 0) {\n throw e;\n }\n retries--;\n\n if (e.code === 'EEXIST') {\n // Most common case, needs longest sleep. Randomize the herd.\n sleepSync(Math.floor(Math.random() * sleep));\n sleep *= 1.5;\n } else {\n sleepSync(5);\n }\n }\n }\n}\n\n/**\n * Abuse Atomics.wait() to come up with a sync sleep\n *\n * We must use a sync sleep because all of jsii is sync.\n */\nfunction sleepSync(ms: number) {\n Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);\n}\n","export * from './disk-cache';\n","export * from './kernel';\n\nimport * as api from './api';\nexport { api };\n","import * as spec from '@jsii/spec';\nimport * as cp from 'child_process';\nimport * as fs from 'fs-extra';\nimport { createRequire } from 'module';\nimport * as os from 'os';\nimport * as path from 'path';\n\nimport * as api from './api';\nimport { TOKEN_REF } from './api';\nimport { jsiiTypeFqn, ObjectTable, tagJsiiConstructor } from './objects';\nimport * as onExit from './on-exit';\nimport * as wire from './serialization';\nimport * as tar from './tar-cache';\n\nexport const enum JsiiErrorType {\n JSII_FAULT = '@jsii/kernel.Fault',\n RUNTIME_ERROR = '@jsii/kernel.RuntimeError',\n}\n\nexport interface JsiiError extends Error {\n readonly name: JsiiErrorType;\n}\n\nexport class JsiiFault extends Error implements JsiiError {\n public readonly name = JsiiErrorType.JSII_FAULT;\n public constructor(message: string) {\n super(message);\n }\n}\n\nexport class RuntimeError extends Error implements JsiiError {\n public readonly name = JsiiErrorType.RUNTIME_ERROR;\n public constructor(message: string) {\n super(message);\n }\n}\nexport class Kernel {\n /**\n * Set to true for verbose debugging.\n */\n public traceEnabled = false;\n /**\n * Set to true for timing data to be emitted.\n */\n public debugTimingEnabled = false;\n /**\n * Set to true to validate assemblies upon loading (slow).\n */\n public validateAssemblies = false;\n\n readonly #assemblies = new Map();\n readonly #objects = new ObjectTable(this.#typeInfoForFqn.bind(this));\n readonly #cbs = new Map();\n readonly #waiting = new Map();\n readonly #promises = new Map();\n\n readonly #serializerHost: wire.SerializerHost;\n\n #nextid = 20000; // incrementing counter for objid, cbid, promiseid\n #syncInProgress?: string; // forbids async calls (begin) while processing sync calls (get/set/invoke)\n #installDir?: string;\n /** The internal require function, used instead of the global \"require\" so that webpack does not transform it... */\n #require?: typeof require;\n\n /**\n * Creates a jsii kernel object.\n *\n * @param callbackHandler This handler is invoked when a synchronous callback is called.\n * It's responsibility is to execute the callback and return it's\n * result (or throw an error).\n */\n public constructor(public callbackHandler: (callback: api.Callback) => any) {\n this.#serializerHost = {\n objects: this.#objects,\n debug: this.#debug.bind(this),\n isVisibleType: this.#isVisibleType.bind(this),\n findSymbol: this.#findSymbol.bind(this),\n lookupType: this.#typeInfoForFqn.bind(this),\n };\n }\n\n public load(req: api.LoadRequest): api.LoadResponse {\n return this.#debugTime(\n () => this.#load(req),\n `load(${JSON.stringify(req, null, 2)})`,\n );\n }\n\n #load(req: api.LoadRequest): api.LoadResponse {\n this.#debug('load', req);\n\n if ('assembly' in req) {\n throw new JsiiFault(\n '`assembly` field is deprecated for \"load\", use `name`, `version` and `tarball` instead',\n );\n }\n\n const pkgname = req.name;\n const pkgver = req.version;\n\n // check if we already have such a module\n const packageDir = this.#getPackageDir(pkgname);\n if (fs.pathExistsSync(packageDir)) {\n // module exists, verify version\n const epkg = fs.readJsonSync(path.join(packageDir, 'package.json'));\n if (epkg.version !== pkgver) {\n throw new JsiiFault(\n `Multiple versions ${pkgver} and ${epkg.version} of the ` +\n `package '${pkgname}' cannot be loaded together since this is unsupported by ` +\n 'some runtime environments',\n );\n }\n\n // same version, no-op\n this.#debug('look up already-loaded assembly', pkgname);\n const assm = this.#assemblies.get(pkgname)!;\n\n return {\n assembly: assm.metadata.name,\n types: Object.keys(assm.metadata.types ?? {}).length,\n };\n }\n\n // Force umask to have npm-install-like permissions\n const originalUmask = process.umask(0o022);\n try {\n // untar the archive to its final location\n const { cache } = this.#debugTime(\n () =>\n tar.extract(\n req.tarball,\n packageDir,\n {\n strict: true,\n strip: 1, // Removes the 'package/' path element from entries\n unlink: true,\n },\n req.name,\n req.version,\n ),\n `tar.extract(${req.tarball}) => ${packageDir}`,\n );\n\n if (cache != null) {\n this.#debug(\n `Package cache enabled, extraction resulted in a cache ${cache}`,\n );\n }\n } finally {\n // Reset umask to the initial value\n process.umask(originalUmask);\n }\n\n // read .jsii metadata from the root of the package\n let assmSpec: spec.Assembly;\n try {\n assmSpec = this.#debugTime(\n () => spec.loadAssemblyFromPath(packageDir, this.validateAssemblies),\n `loadAssemblyFromPath(${packageDir})`,\n );\n } catch (e: any) {\n throw new JsiiFault(\n `Error for package tarball ${req.tarball}: ${e.message}`,\n );\n }\n\n // We do a `require.resolve` call, as otherwise, requiring with a directory will cause any `exports` from\n // `package.json` to be ignored, preventing injection of a \"lazy index\" entry point.\n const entryPoint = this.#require!.resolve(assmSpec.name, {\n paths: [this.#installDir!],\n });\n // load the module and capture its closure\n const closure = this.#debugTime(\n () => this.#require!(entryPoint),\n `require(${entryPoint})`,\n );\n const assm = new Assembly(assmSpec, closure);\n this.#debugTime(\n () => this.#addAssembly(assm),\n `registerAssembly({ name: ${assm.metadata.name}, types: ${\n Object.keys(assm.metadata.types ?? {}).length\n } })`,\n );\n\n return {\n assembly: assmSpec.name,\n types: Object.keys(assmSpec.types ?? {}).length,\n };\n }\n\n public getBinScriptCommand(\n req: api.GetScriptCommandRequest,\n ): api.GetScriptCommandResponse {\n return this.#getBinScriptCommand(req);\n }\n\n public invokeBinScript(\n req: api.InvokeScriptRequest,\n ): api.InvokeScriptResponse {\n const { command, args, env } = this.#getBinScriptCommand(req);\n\n const result = cp.spawnSync(command, args, {\n encoding: 'utf-8',\n env,\n shell: true,\n });\n\n return {\n stdout: result.stdout,\n stderr: result.stderr,\n status: result.status,\n signal: result.signal,\n };\n }\n\n public create(req: api.CreateRequest): api.CreateResponse {\n return this.#create(req);\n }\n\n public del(req: api.DelRequest): api.DelResponse {\n const { objref } = req;\n\n this.#debug('del', objref);\n this.#objects.deleteObject(objref);\n\n return {};\n }\n\n public sget(req: api.StaticGetRequest): api.GetResponse {\n const { fqn, property } = req;\n const symbol = `${fqn}.${property}`;\n this.#debug('sget', symbol);\n const ti = this.#typeInfoForProperty(property, fqn);\n\n if (!ti.static) {\n throw new JsiiFault(`property ${symbol} is not static`);\n }\n\n const prototype = this.#findSymbol(fqn);\n\n const value = this.#ensureSync(\n `property ${property}`,\n () => prototype[property],\n );\n\n this.#debug('value:', value);\n const ret = this.#fromSandbox(value, ti, `of static property ${symbol}`);\n this.#debug('ret', ret);\n return { value: ret };\n }\n\n public sset(req: api.StaticSetRequest): api.SetResponse {\n const { fqn, property, value } = req;\n const symbol = `${fqn}.${property}`;\n this.#debug('sset', symbol);\n const ti = this.#typeInfoForProperty(property, fqn);\n\n if (!ti.static) {\n throw new JsiiFault(`property ${symbol} is not static`);\n }\n\n if (ti.immutable) {\n throw new JsiiFault(`static property ${symbol} is readonly`);\n }\n\n const prototype = this.#findSymbol(fqn);\n\n this.#ensureSync(\n `property ${property}`,\n () =>\n (prototype[property] = this.#toSandbox(\n value,\n ti,\n `assigned to static property ${symbol}`,\n )),\n );\n\n return {};\n }\n\n public get(req: api.GetRequest): api.GetResponse {\n const { objref, property } = req;\n this.#debug('get', objref, property);\n const { instance, fqn, interfaces } = this.#objects.findObject(objref);\n const ti = this.#typeInfoForProperty(property, fqn, interfaces);\n\n // if the property is overridden by the native code and \"get\" is called on the object, it\n // means that the native code is trying to access the \"super\" property. in order to enable\n // that, we actually keep a copy of the original property descriptor when we override,\n // so `findPropertyTarget` will return either the original property name (\"property\") or\n // the \"super\" property name (somehing like \"$jsii$super$$\").\n const propertyToGet = this.#findPropertyTarget(instance, property);\n\n // make the actual \"get\", and block any async calls that might be performed\n // by jsii overrides.\n const value = this.#ensureSync(\n `property '${objref[TOKEN_REF]}.${propertyToGet}'`,\n () => instance[propertyToGet],\n );\n this.#debug('value:', value);\n const ret = this.#fromSandbox(value, ti, `of property ${fqn}.${property}`);\n this.#debug('ret:', ret);\n return { value: ret };\n }\n\n public set(req: api.SetRequest): api.SetResponse {\n const { objref, property, value } = req;\n this.#debug('set', objref, property, value);\n const { instance, fqn, interfaces } = this.#objects.findObject(objref);\n\n const propInfo = this.#typeInfoForProperty(req.property, fqn, interfaces);\n\n if (propInfo.immutable) {\n throw new JsiiFault(\n `Cannot set value of immutable property ${req.property} to ${req.value}`,\n );\n }\n\n const propertyToSet = this.#findPropertyTarget(instance, property);\n\n this.#ensureSync(\n `property '${objref[TOKEN_REF]}.${propertyToSet}'`,\n () =>\n (instance[propertyToSet] = this.#toSandbox(\n value,\n propInfo,\n `assigned to property ${fqn}.${property}`,\n )),\n );\n\n return {};\n }\n\n public invoke(req: api.InvokeRequest): api.InvokeResponse {\n const { objref, method } = req;\n const args = req.args ?? [];\n\n this.#debug('invoke', objref, method, args);\n const { ti, obj, fn } = this.#findInvokeTarget(objref, method, args);\n\n // verify this is not an async method\n if (ti.async) {\n throw new JsiiFault(`${method} is an async method, use \"begin\" instead`);\n }\n\n const fqn = jsiiTypeFqn(obj, this.#isVisibleType.bind(this));\n const ret = this.#ensureSync(\n `method '${objref[TOKEN_REF]}.${method}'`,\n () => {\n return fn.apply(\n obj,\n this.#toSandboxValues(\n args,\n `method ${fqn ? `${fqn}#` : ''}${method}`,\n ti.parameters,\n ),\n );\n },\n );\n\n const result = this.#fromSandbox(\n ret,\n ti.returns ?? 'void',\n `returned by method ${fqn ? `${fqn}#` : ''}${method}`,\n );\n this.#debug('invoke result', result);\n\n return { result };\n }\n\n public sinvoke(req: api.StaticInvokeRequest): api.InvokeResponse {\n const { fqn, method } = req;\n const args = req.args ?? [];\n\n this.#debug('sinvoke', fqn, method, args);\n\n const ti = this.#typeInfoForMethod(method, fqn);\n\n if (!ti.static) {\n throw new JsiiFault(`${fqn}.${method} is not a static method`);\n }\n\n // verify this is not an async method\n if (ti.async) {\n throw new JsiiFault(`${method} is an async method, use \"begin\" instead`);\n }\n\n const prototype = this.#findSymbol(fqn);\n const fn = prototype[method] as (...params: any[]) => any;\n\n const ret = this.#ensureSync(`method '${fqn}.${method}'`, () => {\n return fn.apply(\n prototype,\n this.#toSandboxValues(\n args,\n `static method ${fqn}.${method}`,\n ti.parameters,\n ),\n );\n });\n\n this.#debug('method returned:', ret);\n return {\n result: this.#fromSandbox(\n ret,\n ti.returns ?? 'void',\n `returned by static method ${fqn}.${method}`,\n ),\n };\n }\n\n public begin(req: api.BeginRequest): api.BeginResponse {\n const { objref, method } = req;\n const args = req.args ?? [];\n\n this.#debug('begin', objref, method, args);\n\n if (this.#syncInProgress) {\n throw new JsiiFault(\n `Cannot invoke async method '${req.objref[TOKEN_REF]}.${req.method}' while sync ${this.#syncInProgress} is being processed`,\n );\n }\n\n const { ti, obj, fn } = this.#findInvokeTarget(objref, method, args);\n\n // verify this is indeed an async method\n if (!ti.async) {\n throw new JsiiFault(`Method ${method} is expected to be an async method`);\n }\n\n const fqn = jsiiTypeFqn(obj, this.#isVisibleType.bind(this));\n\n const promise = fn.apply(\n obj,\n this.#toSandboxValues(\n args,\n `async method ${fqn ? `${fqn}#` : ''}${method}`,\n ti.parameters,\n ),\n ) as Promise;\n\n // since we are planning to resolve this promise in a different scope\n // we need to handle rejections here [1]\n // [1]: https://stackoverflow.com/questions/40920179/should-i-refrain-from-handling-promise-rejection-asynchronously/40921505\n promise.catch((_) => undefined);\n\n const prid = this.#makeprid();\n this.#promises.set(prid, {\n promise,\n method: ti,\n });\n\n return { promiseid: prid };\n }\n\n public async end(req: api.EndRequest): Promise {\n const { promiseid } = req;\n\n this.#debug('end', promiseid);\n\n const storedPromise = this.#promises.get(promiseid);\n if (storedPromise == null) {\n throw new JsiiFault(`Cannot find promise with ID: ${promiseid}`);\n }\n const { promise, method } = storedPromise;\n\n let result;\n try {\n result = await promise;\n this.#debug('promise result:', result);\n } catch (e: any) {\n this.#debug('promise error:', e);\n if (e.name === JsiiErrorType.JSII_FAULT) {\n if (e instanceof JsiiFault) {\n throw e;\n }\n throw new JsiiFault(e.message);\n }\n\n // default to RuntimeError, since non-kernel errors may not\n // have their `name` field defined\n if (e instanceof RuntimeError) {\n throw e;\n }\n throw new RuntimeError(e);\n }\n\n return {\n result: this.#fromSandbox(\n result,\n method.returns ?? 'void',\n `returned by async method ${method.name}`,\n ),\n };\n }\n\n public callbacks(_req?: api.CallbacksRequest): api.CallbacksResponse {\n this.#debug('callbacks');\n const ret = Array.from(this.#cbs.entries()).map(([cbid, cb]) => {\n this.#waiting.set(cbid, cb); // move to waiting\n this.#cbs.delete(cbid); // remove from created\n const callback: api.Callback = {\n cbid,\n cookie: cb.override.cookie,\n invoke: {\n objref: cb.objref,\n method: cb.override.method,\n args: cb.args,\n },\n };\n return callback;\n });\n\n return { callbacks: ret };\n }\n\n public complete(req: api.CompleteRequest): api.CompleteResponse {\n const { cbid, err, result, name } = req;\n\n this.#debug('complete', cbid, err, result);\n\n const cb = this.#waiting.get(cbid);\n if (!cb) {\n throw new JsiiFault(`Callback ${cbid} not found`);\n }\n\n if (err) {\n this.#debug('completed with error:', err);\n cb.fail(\n name === JsiiErrorType.JSII_FAULT\n ? new JsiiFault(err)\n : new RuntimeError(err),\n );\n } else {\n const sandoxResult = this.#toSandbox(\n result,\n cb.expectedReturnType ?? 'void',\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n `returned by callback ${cb.toString()}`,\n );\n this.#debug('completed with result:', sandoxResult);\n cb.succeed(sandoxResult);\n }\n\n this.#waiting.delete(cbid);\n\n return { cbid };\n }\n\n /**\n * Returns the language-specific names for a jsii module.\n * @param assemblyName The name of the jsii module (i.e. jsii$jsii_calculator_lib$)\n */\n public naming(req: api.NamingRequest): api.NamingResponse {\n const assemblyName = req.assembly;\n\n this.#debug('naming', assemblyName);\n\n const assembly = this.#assemblyFor(assemblyName);\n const targets = assembly.metadata.targets;\n if (!targets) {\n throw new JsiiFault(\n `Unexpected - \"targets\" for ${assemblyName} is missing!`,\n );\n }\n\n return { naming: targets };\n }\n\n public stats(_req?: api.StatsRequest): api.StatsResponse {\n return {\n objectCount: this.#objects.count,\n };\n }\n\n #addAssembly(assm: Assembly) {\n this.#assemblies.set(assm.metadata.name, assm);\n\n // We can use jsii runtime type information from jsii 1.19.0 onwards... Note that a version of\n // 0.0.0 means we are assessing against a development tree, which is newer...\n const jsiiVersion = assm.metadata.jsiiVersion.split(' ', 1)[0];\n const [jsiiMajor, jsiiMinor, _jsiiPatch, ..._rest] = jsiiVersion\n .split('.')\n .map((str) => parseInt(str, 10));\n if (\n jsiiVersion === '0.0.0' ||\n jsiiMajor > 1 ||\n (jsiiMajor === 1 && jsiiMinor >= 19)\n ) {\n this.#debug('Using compiler-woven runtime type information!');\n return;\n }\n\n // add the __jsii__.fqn property on every constructor. this allows\n // traversing between the javascript and jsii worlds given any object.\n for (const fqn of Object.keys(assm.metadata.types ?? {})) {\n const typedef = assm.metadata.types![fqn];\n switch (typedef.kind) {\n case spec.TypeKind.Interface:\n continue; // interfaces don't really exist\n case spec.TypeKind.Class:\n case spec.TypeKind.Enum:\n const constructor = this.#findSymbol(fqn);\n tagJsiiConstructor(constructor, fqn);\n }\n }\n }\n\n // find the javascript constructor function for a jsii FQN.\n #findCtor(\n fqn: string,\n args: any[],\n ): { ctor: any; parameters?: spec.Parameter[] } {\n if (fqn === wire.EMPTY_OBJECT_FQN) {\n return { ctor: Object };\n }\n\n const typeinfo = this.#typeInfoForFqn(fqn);\n\n switch (typeinfo.kind) {\n case spec.TypeKind.Class:\n const classType = typeinfo as spec.ClassType;\n this.#validateMethodArguments(classType.initializer, args);\n return {\n ctor: this.#findSymbol(fqn),\n parameters: classType.initializer && classType.initializer.parameters,\n };\n\n case spec.TypeKind.Interface:\n throw new JsiiFault(\n `Cannot create an object with an FQN of an interface: ${fqn}`,\n );\n\n default:\n throw new JsiiFault(`Unexpected FQN kind: ${fqn}`);\n }\n }\n\n #getPackageDir(pkgname: string): string {\n if (!this.#installDir) {\n this.#installDir = fs.mkdtempSync(path.join(os.tmpdir(), 'jsii-kernel-'));\n this.#require = createRequire(this.#installDir);\n fs.mkdirpSync(path.join(this.#installDir, 'node_modules'));\n this.#debug('creating jsii-kernel modules workdir:', this.#installDir);\n\n onExit.removeSync(this.#installDir);\n }\n return path.join(this.#installDir, 'node_modules', pkgname);\n }\n\n #create(req: api.CreateRequest): api.CreateResponse {\n this.#debug('create', req);\n const { fqn, interfaces, overrides } = req;\n\n const requestArgs = req.args ?? [];\n\n const ctorResult = this.#findCtor(fqn, requestArgs);\n const ctor = ctorResult.ctor;\n const obj = new ctor(\n ...this.#toSandboxValues(\n requestArgs,\n `new ${fqn}`,\n ctorResult.parameters,\n ),\n );\n const objref = this.#objects.registerObject(obj, fqn, req.interfaces ?? []);\n\n // overrides: for each one of the override method names, installs a\n // method on the newly created object which represents the remote \"reverse proxy\".\n\n if (overrides) {\n this.#debug('overrides', overrides);\n\n const overrideTypeErrorMessage =\n 'Override can either be \"method\" or \"property\"';\n const methods = new Set();\n const properties = new Set();\n\n for (const override of overrides) {\n if (api.isMethodOverride(override)) {\n if (api.isPropertyOverride(override)) {\n throw new JsiiFault(overrideTypeErrorMessage);\n }\n if (methods.has(override.method)) {\n throw new JsiiFault(\n `Duplicate override for method '${override.method}'`,\n );\n }\n methods.add(override.method);\n\n this.#applyMethodOverride(obj, objref, fqn, interfaces, override);\n } else if (api.isPropertyOverride(override)) {\n if (api.isMethodOverride(override)) {\n throw new JsiiFault(overrideTypeErrorMessage);\n }\n if (properties.has(override.property)) {\n throw new JsiiFault(\n `Duplicate override for property '${override.property}'`,\n );\n }\n properties.add(override.property);\n\n this.#applyPropertyOverride(obj, objref, fqn, interfaces, override);\n } else {\n throw new JsiiFault(overrideTypeErrorMessage);\n }\n }\n }\n\n return objref;\n }\n\n #getSuperPropertyName(name: string) {\n return `$jsii$super$${name}$`;\n }\n\n #applyPropertyOverride(\n obj: any,\n objref: api.ObjRef,\n typeFqn: string,\n interfaces: string[] | undefined,\n override: api.PropertyOverride,\n ) {\n // error if we can find a method with this name\n if (this.#tryTypeInfoForMethod(override.property, typeFqn, interfaces)) {\n throw new JsiiFault(\n `Trying to override method '${override.property}' as a property`,\n );\n }\n\n let propInfo = this.#tryTypeInfoForProperty(\n override.property,\n typeFqn,\n interfaces,\n );\n // if this is a private property (i.e. doesn't have `propInfo` the object has a key)\n if (!propInfo && override.property in obj) {\n this.#debug(`Skipping override of private property ${override.property}`);\n return;\n }\n\n if (!propInfo) {\n // We've overriding a property on an object we have NO type information on (probably\n // because it's an anonymous object).\n // Pretend it's 'prop: any';\n //\n // FIXME: We could do better type checking during the conversion if JSII clients\n // would tell us the intended interface type.\n propInfo = {\n name: override.property,\n type: spec.CANONICAL_ANY,\n };\n }\n\n this.#defineOverridenProperty(obj, objref, override, propInfo);\n }\n\n #defineOverridenProperty(\n obj: any,\n objref: api.ObjRef,\n override: api.PropertyOverride,\n propInfo: spec.Property,\n ) {\n const propertyName = override.property;\n\n this.#debug('apply override', propertyName);\n\n // save the old property under $jsii$super$$ so that property overrides\n // can still access it via `super.`.\n const prev = getPropertyDescriptor(obj, propertyName) ?? {\n value: obj[propertyName],\n writable: true,\n enumerable: true,\n configurable: true,\n };\n\n const prevEnumerable = prev.enumerable;\n prev.enumerable = false;\n Object.defineProperty(obj, this.#getSuperPropertyName(propertyName), prev);\n\n // we add callbacks for both 'get' and 'set', even if the property\n // is readonly. this is fine because if you try to set() a readonly\n // property, it will fail.\n Object.defineProperty(obj, propertyName, {\n enumerable: prevEnumerable,\n configurable: prev.configurable,\n get: () => {\n this.#debug('virtual get', objref, propertyName, {\n cookie: override.cookie,\n });\n const result = this.callbackHandler({\n cookie: override.cookie,\n cbid: this.#makecbid(),\n get: { objref, property: propertyName },\n });\n this.#debug('callback returned', result);\n return this.#toSandbox(\n result,\n propInfo,\n `returned by callback property ${propertyName}`,\n );\n },\n set: (value: any) => {\n this.#debug('virtual set', objref, propertyName, {\n cookie: override.cookie,\n });\n this.callbackHandler({\n cookie: override.cookie,\n cbid: this.#makecbid(),\n set: {\n objref,\n property: propertyName,\n value: this.#fromSandbox(\n value,\n propInfo,\n `assigned to callback property ${propertyName}`,\n ),\n },\n });\n },\n });\n\n function getPropertyDescriptor(\n obj: any,\n propertyName: string,\n ): PropertyDescriptor | undefined {\n const direct = Object.getOwnPropertyDescriptor(obj, propertyName);\n if (direct != null) {\n return direct;\n }\n const proto = Object.getPrototypeOf(obj);\n if (proto == null && proto !== Object.prototype) {\n // We reached Object or the prototype chain root, all hope is lost!\n return undefined;\n }\n return getPropertyDescriptor(proto, propertyName);\n }\n }\n\n #applyMethodOverride(\n obj: any,\n objref: api.ObjRef,\n typeFqn: string,\n interfaces: string[] | undefined,\n override: api.MethodOverride,\n ) {\n // error if we can find a property with this name\n if (this.#tryTypeInfoForProperty(override.method, typeFqn, interfaces)) {\n throw new JsiiFault(\n `Trying to override property '${override.method}' as a method`,\n );\n }\n\n let methodInfo = this.#tryTypeInfoForMethod(\n override.method,\n typeFqn,\n interfaces,\n );\n\n // If this is a private method (doesn't have methodInfo, key resolves on the object), we\n // are going to skip the override.\n if (!methodInfo && obj[override.method]) {\n this.#debug(`Skipping override of private method ${override.method}`);\n return;\n }\n\n if (!methodInfo) {\n // We've overriding a method on an object we have NO type information on (probably\n // because it's an anonymous object).\n // Pretend it's an (...args: any[]) => any\n methodInfo = {\n name: override.method,\n returns: { type: spec.CANONICAL_ANY },\n parameters: [\n {\n name: 'args',\n type: spec.CANONICAL_ANY,\n variadic: true,\n },\n ],\n variadic: true,\n };\n }\n\n this.#defineOverridenMethod(obj, objref, override, methodInfo);\n }\n\n #defineOverridenMethod(\n obj: any,\n objref: api.ObjRef,\n override: api.MethodOverride,\n methodInfo: spec.Method,\n ) {\n const methodName = override.method;\n const fqn = jsiiTypeFqn(obj, this.#isVisibleType.bind(this));\n const methodContext = `${methodInfo.async ? 'async ' : ''}method${\n fqn ? `${fqn}#` : methodName\n }`;\n\n if (methodInfo.async) {\n // async method override\n Object.defineProperty(obj, methodName, {\n enumerable: false,\n configurable: false,\n writable: false,\n value: (...methodArgs: any[]) => {\n this.#debug('invoke async method override', override);\n const args = this.#toSandboxValues(\n methodArgs,\n methodContext,\n methodInfo.parameters,\n );\n return new Promise((succeed, fail) => {\n const cbid = this.#makecbid();\n this.#debug('adding callback to queue', cbid);\n this.#cbs.set(cbid, {\n objref,\n override,\n args,\n expectedReturnType: methodInfo.returns ?? 'void',\n succeed,\n fail,\n });\n });\n },\n });\n } else {\n // sync method override (method info is not required)\n Object.defineProperty(obj, methodName, {\n enumerable: false,\n configurable: false,\n writable: false,\n value: (...methodArgs: any[]) => {\n this.#debug(\n 'invoke sync method override',\n override,\n 'args',\n methodArgs,\n );\n // We should be validating the actual arguments according to the\n // declared parameters here, but let's just assume the JSII runtime on the\n // other end has done its work.\n const result = this.callbackHandler({\n cookie: override.cookie,\n cbid: this.#makecbid(),\n invoke: {\n objref,\n method: methodName,\n args: this.#fromSandboxValues(\n methodArgs,\n methodContext,\n methodInfo.parameters,\n ),\n },\n });\n this.#debug('Result', result);\n return this.#toSandbox(\n result,\n methodInfo.returns ?? 'void',\n `returned by callback method ${methodName}`,\n );\n },\n });\n }\n }\n\n #findInvokeTarget(objref: api.ObjRef, methodName: string, args: any[]) {\n const { instance, fqn, interfaces } = this.#objects.findObject(objref);\n const ti = this.#typeInfoForMethod(methodName, fqn, interfaces);\n this.#validateMethodArguments(ti, args);\n\n // always first look up the method in the prototype. this practically bypasses\n // any methods overridden by derived classes (which are by definition native\n // methods). this serves to allow native call to invoke \"super.method()\" when\n // overriding the method.\n // if we didn't find the method on the prototype, it could be a literal object\n // that implements an interface, so we look if we have the method on the object\n // itself. if we do, we invoke it.\n let fn = instance.constructor.prototype[methodName];\n if (!fn) {\n fn = instance[methodName];\n if (!fn) {\n throw new JsiiFault(`Cannot find ${methodName} on object`);\n }\n }\n return { ti, obj: instance, fn };\n }\n\n #validateMethodArguments(method: spec.Callable | undefined, args: any[]) {\n const params: spec.Parameter[] = method?.parameters ?? [];\n\n // error if args > params\n if (args.length > params.length && !(method && method.variadic)) {\n throw new JsiiFault(\n `Too many arguments (method accepts ${params.length} parameters, got ${args.length} arguments)`,\n );\n }\n\n for (let i = 0; i < params.length; ++i) {\n const param = params[i];\n const arg = args[i];\n\n if (param.variadic) {\n if (params.length <= i) {\n return;\n } // No vararg was provided\n for (let j = i; j < params.length; j++) {\n if (!param.optional && params[j] === undefined) {\n throw new JsiiFault(\n `Unexpected 'undefined' value at index ${\n j - i\n } of variadic argument '${\n param.name\n }' of type '${spec.describeTypeReference(param.type)}'`,\n );\n }\n }\n } else if (!param.optional && arg === undefined) {\n throw new JsiiFault(\n `Not enough arguments. Missing argument for the required parameter '${\n param.name\n }' of type '${spec.describeTypeReference(param.type)}'`,\n );\n }\n }\n }\n\n #assemblyFor(assemblyName: string) {\n const assembly = this.#assemblies.get(assemblyName);\n if (!assembly) {\n throw new JsiiFault(`Could not find assembly: ${assemblyName}`);\n }\n return assembly;\n }\n\n #findSymbol(fqn: string) {\n const [assemblyName, ...parts] = fqn.split('.');\n const assembly = this.#assemblyFor(assemblyName);\n\n let curr = assembly.closure;\n while (parts.length > 0) {\n const name = parts.shift();\n if (!name) {\n break;\n }\n\n curr = curr[name];\n }\n if (!curr) {\n throw new JsiiFault(`Could not find symbol ${fqn}`);\n }\n return curr;\n }\n\n #typeInfoForFqn(fqn: spec.FQN): spec.Type {\n const components = fqn.split('.');\n const moduleName = components[0];\n\n const assembly = this.#assemblies.get(moduleName);\n if (!assembly) {\n throw new JsiiFault(`Module '${moduleName}' not found`);\n }\n\n const types = assembly.metadata.types ?? {};\n const fqnInfo = types[fqn];\n if (!fqnInfo) {\n throw new JsiiFault(`Type '${fqn}' not found`);\n }\n\n return fqnInfo;\n }\n\n /**\n * Determines whether the provided FQN corresponds to a valid, exported type\n * from any currently loaded assembly.\n *\n * @param fqn the tested FQN.\n *\n * @returns `true` IIF the FQN corresponds to a know exported type.\n */\n #isVisibleType(fqn: spec.FQN): boolean {\n try {\n /* ignored */ this.#typeInfoForFqn(fqn);\n return true;\n } catch (e) {\n if (e instanceof JsiiFault) {\n return false;\n }\n throw e;\n }\n }\n\n #typeInfoForMethod(\n methodName: string,\n fqn: string,\n interfaces?: string[],\n ): spec.Method {\n const ti = this.#tryTypeInfoForMethod(methodName, fqn, interfaces);\n if (!ti) {\n const addendum =\n interfaces && interfaces.length > 0\n ? ` or interface(s) ${interfaces.join(', ')}`\n : '';\n throw new JsiiFault(\n `Class ${fqn}${addendum} doesn't have a method '${methodName}'`,\n );\n }\n return ti;\n }\n\n #tryTypeInfoForMethod(\n methodName: string,\n classFqn: string,\n interfaces: string[] = [],\n ): spec.Method | undefined {\n for (const fqn of [classFqn, ...interfaces]) {\n if (fqn === wire.EMPTY_OBJECT_FQN) {\n continue;\n }\n const typeinfo = this.#typeInfoForFqn(fqn);\n\n const methods =\n (typeinfo as spec.ClassType | spec.InterfaceType).methods ?? [];\n\n for (const m of methods) {\n if (m.name === methodName) {\n return m;\n }\n }\n\n // recursion to parent type (if exists)\n const bases = [\n (typeinfo as spec.ClassType).base,\n ...((typeinfo as spec.InterfaceType).interfaces ?? []),\n ];\n for (const base of bases) {\n if (!base) {\n continue;\n }\n\n const found = this.#tryTypeInfoForMethod(methodName, base);\n if (found) {\n return found;\n }\n }\n }\n\n return undefined;\n }\n\n #tryTypeInfoForProperty(\n property: string,\n classFqn: string,\n interfaces: string[] = [],\n ): spec.Property | undefined {\n for (const fqn of [classFqn, ...interfaces]) {\n if (fqn === wire.EMPTY_OBJECT_FQN) {\n continue;\n }\n const typeInfo = this.#typeInfoForFqn(fqn);\n\n let properties;\n let bases;\n\n if (spec.isClassType(typeInfo)) {\n const classTypeInfo = typeInfo as spec.ClassType;\n properties = classTypeInfo.properties;\n bases = classTypeInfo.base ? [classTypeInfo.base] : [];\n } else if (spec.isInterfaceType(typeInfo)) {\n const interfaceTypeInfo = typeInfo as spec.InterfaceType;\n properties = interfaceTypeInfo.properties;\n bases = interfaceTypeInfo.interfaces ?? [];\n } else {\n throw new JsiiFault(\n `Type of kind ${typeInfo.kind} does not have properties`,\n );\n }\n\n for (const p of properties ?? []) {\n if (p.name === property) {\n return p;\n }\n }\n\n // recurse to parent type (if exists)\n for (const baseFqn of bases) {\n const ret = this.#tryTypeInfoForProperty(property, baseFqn);\n if (ret) {\n return ret;\n }\n }\n }\n\n return undefined;\n }\n\n #typeInfoForProperty(\n property: string,\n fqn: string,\n interfaces?: string[],\n ): spec.Property {\n const typeInfo = this.#tryTypeInfoForProperty(property, fqn, interfaces);\n if (!typeInfo) {\n const addendum =\n interfaces && interfaces.length > 0\n ? ` or interface(s) ${interfaces.join(', ')}`\n : '';\n throw new JsiiFault(\n `Type ${fqn}${addendum} doesn't have a property '${property}'`,\n );\n }\n return typeInfo;\n }\n #toSandbox(\n v: any,\n expectedType: wire.OptionalValueOrVoid,\n context: string,\n ): any {\n return wire.process(\n this.#serializerHost,\n 'deserialize',\n v,\n expectedType,\n context,\n );\n }\n\n #fromSandbox(\n v: any,\n targetType: wire.OptionalValueOrVoid,\n context: string,\n ): any {\n return wire.process(\n this.#serializerHost,\n 'serialize',\n v,\n targetType,\n context,\n );\n }\n\n #toSandboxValues(\n xs: readonly unknown[],\n methodContext: string,\n parameters: readonly spec.Parameter[] | undefined,\n ) {\n return this.#boxUnboxParameters(\n xs,\n methodContext,\n parameters,\n this.#toSandbox.bind(this),\n );\n }\n\n #fromSandboxValues(\n xs: readonly unknown[],\n methodContext: string,\n parameters: readonly spec.Parameter[] | undefined,\n ) {\n return this.#boxUnboxParameters(\n xs,\n methodContext,\n parameters,\n this.#fromSandbox.bind(this),\n );\n }\n\n #boxUnboxParameters(\n xs: readonly unknown[],\n methodContext: string,\n parameters: readonly spec.Parameter[] = [],\n boxUnbox: (x: any, t: wire.OptionalValueOrVoid, context: string) => any,\n ) {\n const parametersCopy = [...parameters];\n const variadic =\n parametersCopy.length > 0 &&\n !!parametersCopy[parametersCopy.length - 1].variadic;\n // Repeat the last (variadic) type to match the number of actual arguments\n while (variadic && parametersCopy.length < xs.length) {\n parametersCopy.push(parametersCopy[parametersCopy.length - 1]);\n }\n if (xs.length > parametersCopy.length) {\n throw new JsiiFault(\n `Argument list (${JSON.stringify(\n xs,\n )}) not same size as expected argument list (length ${\n parametersCopy.length\n })`,\n );\n }\n return xs.map((x, i) =>\n boxUnbox(\n x,\n parametersCopy[i],\n `passed to parameter ${parametersCopy[i].name} of ${methodContext}`,\n ),\n );\n }\n\n #debug(...args: any[]) {\n if (this.traceEnabled) {\n console.error('[@jsii/kernel]', ...args);\n }\n }\n\n #debugTime(cb: () => T, label: string): T {\n const fullLabel = `[@jsii/kernel:timing] ${label}`;\n if (this.debugTimingEnabled) {\n console.time(fullLabel);\n }\n try {\n return cb();\n } finally {\n if (this.debugTimingEnabled) {\n console.timeEnd(fullLabel);\n }\n }\n }\n\n /**\n * Ensures that `fn` is called and defends against beginning to invoke\n * async methods until fn finishes (successfully or not).\n */\n #ensureSync(desc: string, fn: () => T): T {\n this.#syncInProgress = desc;\n try {\n return fn();\n } catch (e: any) {\n if (e.name === JsiiErrorType.JSII_FAULT) {\n if (e instanceof JsiiFault) {\n throw e;\n }\n throw new JsiiFault(e);\n }\n // This error can be thrown by the kernel directly, or it can be\n // thrown from user code. If the error comes from the kernel, then its name field will be populated;\n // if the error comes from user code, the name field will not be populated.\n if (e instanceof RuntimeError) {\n throw e;\n }\n throw new RuntimeError(e);\n } finally {\n this.#syncInProgress = undefined;\n }\n }\n\n #findPropertyTarget(obj: any, property: string) {\n const superProp = this.#getSuperPropertyName(property);\n if (superProp in obj) {\n return superProp;\n }\n return property;\n }\n\n /**\n * Shared (non-public implementation) to as not to break API recording.\n */\n #getBinScriptCommand(\n req: api.GetScriptCommandRequest,\n ): api.GetScriptCommandResponse {\n const packageDir = this.#getPackageDir(req.assembly);\n if (fs.pathExistsSync(packageDir)) {\n // module exists, verify version\n const epkg = fs.readJsonSync(path.join(packageDir, 'package.json'));\n\n const scriptPath = epkg.bin?.[req.script];\n\n if (!epkg.bin) {\n throw new JsiiFault(`Script with name ${req.script} was not defined.`);\n }\n\n // Make sure the current NODE_OPTIONS are honored if we shell out to node\n const nodeOptions = [...process.execArgv];\n\n return {\n command: path.join(packageDir, scriptPath),\n args: req.args ?? [],\n env: {\n ...process.env,\n NODE_OPTIONS: nodeOptions.join(' '),\n // Make sure \"this\" node is ahead of $PATH just in case\n PATH: `${path.dirname(process.execPath)}:${process.env.PATH}`,\n },\n };\n }\n throw new JsiiFault(`Package with name ${req.assembly} was not loaded.`);\n }\n\n //\n // type information\n //\n\n #makecbid() {\n return `jsii::callback::${this.#nextid++}`;\n }\n\n #makeprid() {\n return `jsii::promise::${this.#nextid++}`;\n }\n}\n\ninterface Callback {\n objref: api.ObjRef;\n override: api.MethodOverride;\n args: any[];\n expectedReturnType: wire.OptionalValueOrVoid;\n\n // completion callbacks\n succeed: (...args: any[]) => any;\n fail: (...args: any[]) => any;\n}\n\ninterface AsyncInvocation {\n method: spec.Method;\n promise: Promise;\n}\n\nclass Assembly {\n public constructor(\n public readonly metadata: spec.Assembly,\n public readonly closure: any,\n ) {}\n}\n","import {\n copyFileSync,\n linkSync,\n mkdirSync,\n readdirSync,\n statSync,\n symlinkSync,\n} from 'fs';\nimport * as os from 'os';\nimport { dirname, join } from 'path';\n\n/**\n * If `node` is started with `--preserve-symlinks`, the module loaded will\n * preserve symbolic links instead of resolving them, making it possible to\n * symbolically link packages in place instead of fully copying them.\n */\nconst PRESERVE_SYMLINKS = process.execArgv.includes('--preserve-symlinks');\n\n/**\n * Link existing to destination directory\n *\n * - If Node has been started with a module resolution strategy that does not\n * resolve symlinks (so peerDependencies can be found), use symlinking.\n * Symlinking may fail on Windows for non-Admin users.\n * - If not symlinking the entire directory, crawl the directory tree and\n * hardlink all files (if possible), copying them if not.\n *\n * @param existingRoot is the original file or directory to link.\n * @param destinationRoot is the new file or directory to create.\n */\nexport function link(existingRoot: string, destinationRoot: string): void {\n mkdirSync(dirname(destinationRoot), { recursive: true });\n\n if (PRESERVE_SYMLINKS) {\n try {\n symlinkSync(existingRoot, destinationRoot);\n return;\n } catch (e: any) {\n // On Windows, non-Admin users aren't allowed to create symlinks. In that case, fall back to the copying workflow.\n const winNoSymlink = e.code === 'EPERM' && os.platform() === 'win32';\n\n if (!winNoSymlink) {\n throw e;\n }\n }\n }\n // Fall back to the slow method\n recurse(existingRoot, destinationRoot);\n\n function recurse(existing: string, destination: string): void {\n const stat = statSync(existing);\n if (!stat.isDirectory()) {\n try {\n linkSync(existing, destination);\n } catch {\n copyFileSync(existing, destination);\n }\n return;\n }\n\n mkdirSync(destination, { recursive: true });\n for (const file of readdirSync(existing)) {\n recurse(join(existing, file), join(destination, file));\n }\n }\n}\n","import * as spec from '@jsii/spec';\nimport * as assert from 'assert';\n\nimport * as api from './api';\nimport { JsiiFault } from './kernel';\nimport { EMPTY_OBJECT_FQN } from './serialization';\n\n/**\n * Symbol under which we store the { type -> objid } map on object instances\n */\nconst OBJID_SYMBOL = Symbol.for('$__jsii__objid__$');\n\n/**\n * Symbol under which we store the interfaces implemented by instances\n */\nconst IFACES_SYMBOL = Symbol.for('$__jsii__interfaces__$');\n\n/**\n * Symbol under which jsii runtime type information is stored.\n */\nconst JSII_RTTI_SYMBOL = Symbol.for('jsii.rtti');\n\n/**\n * Cache for resolved associations between constructors and FQNs.\n */\nconst RESOLVED_TYPE_FQN = new WeakMap();\n\n/**\n * Get the JSII fqn for an object (if available)\n *\n * This will return something if the object was constructed from a JSII-enabled\n * class/constructor, or if a literal object was annotated with type\n * information.\n *\n * @param obj the object for which a jsii FQN is requested.\n * @param isVisibleType a function that determines if a type is visible.\n */\nexport function jsiiTypeFqn(\n obj: any,\n isVisibleType: (fqn: spec.FQN) => boolean,\n): spec.FQN | undefined {\n const ctor = obj.constructor;\n\n // We've already resolved for this type, return the cached value.\n if (RESOLVED_TYPE_FQN.has(ctor)) {\n return RESOLVED_TYPE_FQN.get(ctor)!;\n }\n\n let curr = ctor;\n while (curr[JSII_RTTI_SYMBOL]?.fqn) {\n if (isVisibleType(curr[JSII_RTTI_SYMBOL].fqn)) {\n const fqn = curr[JSII_RTTI_SYMBOL].fqn;\n\n tagJsiiConstructor(curr, fqn);\n tagJsiiConstructor(ctor, fqn);\n\n return fqn;\n }\n\n // Walk up the prototype chain...\n curr = Object.getPrototypeOf(curr);\n }\n\n return undefined;\n}\n\n/**\n * If this object was previously serialized under a given reference, return the same reference\n *\n * This is to retain object identity across invocations.\n */\nexport function objectReference(obj: unknown): api.ObjRef | undefined {\n // If this object as already returned\n if ((obj as any)[OBJID_SYMBOL]) {\n return {\n [api.TOKEN_REF]: (obj as ManagedObject)[OBJID_SYMBOL],\n [api.TOKEN_INTERFACES]: (obj as ManagedObject)[IFACES_SYMBOL],\n };\n }\n\n return undefined;\n}\n\ntype ManagedObject = {\n [OBJID_SYMBOL]: string;\n [IFACES_SYMBOL]?: string[];\n};\n\nfunction tagObject(obj: unknown, objid: string, interfaces?: string[]) {\n const privateField: Omit = {\n // Make sure the field does not show in `JSON.stringify` outputs, and is not\n // copied by splat expressions (`{...obj}`), as this would be problematic.\n // See https://github.com/aws/aws-cdk/issues/17876 for an example of the\n // consequences this could have.\n enumerable: false,\n // Probably not necessary, but allow the property to be re-configured (it\n // would be good to make this `false` in the future, but might cause weird\n // bugs, so not doing it now...)\n configurable: true,\n writable: true,\n };\n\n // Log a warning in case we are re-tagging this value, so we can hopefully\n // discover about the bugs we'd have if we did not make it configurable nor\n // writable.\n if (Object.prototype.hasOwnProperty.call(obj, OBJID_SYMBOL)) {\n console.error(\n `[jsii/kernel] WARNING: object ${JSON.stringify(\n obj as any,\n )} was already tagged as ${(obj as any)[OBJID_SYMBOL]}!`,\n );\n }\n\n Object.defineProperty(obj, OBJID_SYMBOL, { ...privateField, value: objid });\n Object.defineProperty(obj, IFACES_SYMBOL, {\n ...privateField,\n value: interfaces,\n });\n}\n\n/**\n * Set the JSII FQN for classes produced by a given constructor\n */\nexport function tagJsiiConstructor(constructor: any, fqn: spec.FQN) {\n const existing = RESOLVED_TYPE_FQN.get(constructor);\n\n if (existing != null) {\n return assert.strictEqual(\n existing,\n fqn,\n `Unable to register ${constructor.name} as ${fqn}: it is already registerd with FQN ${existing}`,\n );\n }\n\n // Mark this constructor as exported from a jsii module, so we know we\n // should be considering it's FQN as a valid exported type.\n RESOLVED_TYPE_FQN.set(constructor, fqn);\n}\n\n/**\n * Table of JSII objects\n *\n * There can be multiple references to the same object, each under a different requested\n * type.\n */\nexport class ObjectTable {\n readonly #resolveType: (fqn: spec.FQN) => spec.Type;\n readonly #objects = new Map();\n #nextid = 10000;\n\n public constructor(resolveType: (fqn: spec.FQN) => spec.Type) {\n this.#resolveType = resolveType;\n }\n\n /**\n * Register the given object with the given type\n *\n * Return the existing registration if available.\n */\n public registerObject(\n obj: unknown,\n fqn: spec.FQN,\n interfaces?: spec.FQN[],\n ): api.ObjRef {\n if (fqn === undefined) {\n throw new JsiiFault('FQN cannot be undefined');\n }\n\n const existingRef = objectReference(obj);\n if (existingRef) {\n if (interfaces) {\n const allIfaces = new Set(interfaces);\n for (const iface of existingRef[api.TOKEN_INTERFACES] ?? []) {\n allIfaces.add(iface);\n }\n // Note - obj[INTERFACES_SYMBOL] should already have been declared as a\n // private property by a previous call to tagObject at this stage.\n if (!Object.prototype.hasOwnProperty.call(obj, IFACES_SYMBOL)) {\n console.error(\n `[jsii/kernel] WARNING: referenced object ${\n existingRef[api.TOKEN_REF]\n } does not have the ${String(IFACES_SYMBOL)} property!`,\n );\n }\n\n this.#objects.get(existingRef[api.TOKEN_REF])!.interfaces =\n (obj as any)[IFACES_SYMBOL] =\n existingRef[api.TOKEN_INTERFACES] =\n interfaces =\n this.#removeRedundant(Array.from(allIfaces), fqn);\n }\n return existingRef;\n }\n\n interfaces = this.#removeRedundant(interfaces, fqn);\n\n const objid = this.#makeId(fqn);\n this.#objects.set(objid, { instance: obj, fqn, interfaces });\n tagObject(obj, objid, interfaces);\n\n return { [api.TOKEN_REF]: objid, [api.TOKEN_INTERFACES]: interfaces };\n }\n\n /**\n * Find the object and registered type for the given ObjRef\n */\n public findObject(objref: api.ObjRef): RegisteredObject {\n if (typeof objref !== 'object' || !(api.TOKEN_REF in objref)) {\n throw new JsiiFault(\n `Malformed object reference: ${JSON.stringify(objref)}`,\n );\n }\n\n const objid = objref[api.TOKEN_REF];\n const obj = this.#objects.get(objid);\n if (!obj) {\n throw new JsiiFault(`Object ${objid} not found`);\n }\n\n // If there are \"additional\" interfaces declared on the objref, merge them\n // into the returned object. This is used to support client-side forced\n // down-casting (a.k.a: unsafe casting). We do NOT register the extra\n // interfaces here so that if the client provided an interface that is\n // actually not implemented, we aren't \"poisoning\" our state with that\n // incorrect information.\n const additionalInterfaces = objref[api.TOKEN_INTERFACES];\n if (additionalInterfaces != null && additionalInterfaces.length > 0) {\n return {\n ...obj,\n interfaces: [\n ...(obj.interfaces ?? []),\n // We append at the end so \"registered\" interface information has\n // precedence over client-declared ones.\n ...additionalInterfaces,\n ],\n };\n }\n\n return obj;\n }\n\n /**\n * Delete the registration with the given objref\n */\n public deleteObject({ [api.TOKEN_REF]: objid }: api.ObjRef) {\n if (!this.#objects.delete(objid)) {\n throw new JsiiFault(`Object ${objid} not found`);\n }\n }\n\n public get count(): number {\n return this.#objects.size;\n }\n\n #makeId(fqn: spec.FQN) {\n return `${fqn}@${this.#nextid++}`;\n }\n\n #removeRedundant(\n interfaces: spec.FQN[] | undefined,\n fqn: spec.FQN,\n ): spec.FQN[] | undefined {\n if (!interfaces || interfaces.length === 0) {\n return undefined;\n }\n\n const result = new Set(interfaces);\n const builtIn = new InterfaceCollection(this.#resolveType);\n\n if (fqn !== EMPTY_OBJECT_FQN) {\n builtIn.addFromClass(fqn);\n }\n interfaces.forEach(builtIn.addFromInterface.bind(builtIn));\n\n for (const iface of builtIn) {\n result.delete(iface);\n }\n\n return result.size > 0 ? Array.from(result).sort() : undefined;\n }\n}\n\nexport interface RegisteredObject {\n instance: any;\n fqn: spec.FQN;\n interfaces?: spec.FQN[];\n}\n\nclass InterfaceCollection implements Iterable {\n readonly #resolveType: (fqn: spec.FQN) => spec.Type;\n readonly #interfaces = new Set();\n\n public constructor(resolveType: (fqn: spec.FQN) => spec.Type) {\n this.#resolveType = resolveType;\n }\n\n public addFromClass(fqn: spec.FQN): void {\n const ti = this.#resolveType(fqn);\n if (!spec.isClassType(ti)) {\n throw new JsiiFault(\n `Expected a class, but received ${spec.describeTypeReference(ti)}`,\n );\n }\n if (ti.base) {\n this.addFromClass(ti.base);\n }\n if (ti.interfaces) {\n for (const iface of ti.interfaces) {\n if (this.#interfaces.has(iface)) {\n continue;\n }\n this.#interfaces.add(iface);\n this.addFromInterface(iface);\n }\n }\n }\n\n public addFromInterface(fqn: spec.FQN): void {\n const ti = this.#resolveType(fqn);\n if (!spec.isInterfaceType(ti)) {\n throw new JsiiFault(\n `Expected an interface, but received ${spec.describeTypeReference(ti)}`,\n );\n }\n if (!ti.interfaces) {\n return;\n }\n for (const iface of ti.interfaces) {\n if (this.#interfaces.has(iface)) {\n continue;\n }\n this.#interfaces.add(iface);\n this.addFromInterface(iface);\n }\n }\n\n public [Symbol.iterator]() {\n return this.#interfaces[Symbol.iterator]();\n }\n}\n","import * as fs from 'fs-extra';\nimport * as process from 'process';\n\nconst removeSyncPaths = new Array();\n\nexport function removeSync(path: string): void {\n registerIfNeeded();\n removeSyncPaths.push(path);\n}\n\nlet registered = false;\n\n/**\n * Registers the exist handler if it has not been registered already. This is done exactly ocne per\n * process, so that processes with multiple kernels don't end up creating too many exit handlers, as\n * this reduces the chances they will correctly run.\n */\nfunction registerIfNeeded() {\n if (registered) {\n return;\n }\n process.once('exit', onExitHandler);\n registered = true;\n\n function onExitHandler() {\n if (removeSyncPaths.length > 0) {\n for (const path of removeSyncPaths) {\n fs.removeSync(path);\n }\n }\n }\n}\n","/**\n * Handling of types in JSII\n *\n * Types will be serialized according to the following table:\n *\n * ┬───────────────────────────────────────────────────────────────────────────────────────────────┐\n * │ JAVASCRIPT TYPE │\n * ┼────────────────┬───────────┬────────────┬───────────────┬───────────────────┬─────────────────┤\n * │ undefined/null │ date │ scalar (*) │ array │ JSII-class object │ literal object │\n * ├──────────┼────────────┼────────────────┼───────────┼────────────┼───────────────┼───────────────────┼─────────────────┤\n * │ DECLARED │ void │ undefined │ undefined │ undefined │ undefined │ undefined │ undefined │\n * │ TYPE │ date │ undefined(†) │ { date } │ - │ - │ - │ - │\n * │ │ scalar (*) │ undefined(†) │ - │ value │ - │ - │ - │\n * │ │ json │ undefined │ string │ value │ array/R(json) │ - │ byvalue/R(json) │\n * │ │ enum │ undefined(†) │ - │ { enum } │ - │ - │ - │\n * │ │ array of T │ undefined(†) │ - │ - │ array/R(T) │ - │ - │\n * │ │ map of T │ undefined(†) │ - │ - │ - │ - │ byvalue/R(T) │\n * │ │ interface │ undefined(†) │ - │ - │ - │ { ref } │ { ref: proxy } │\n * │ │ struct │ undefined(†) │ - │ - │ - │ - │ byvalue/R(T[k]) │\n * │ │ class │ undefined(†) │ - │ - │ - │ { ref } │ { ref: proxy } │\n * │ │ any │ undefined │ { date } │ value │ array/R(any) │ { ref } │ byvalue/R(any) │\n * └──────────┴────────────┴────────────────┴───────────┴────────────┴───────────────┴───────────────────┴─────────────────┘\n *\n * - (*) scalar means 'string | number | boolean'\n * - (†) throw if not nullable\n * - /R(t) recurse with declared type t\n */\n\nimport * as spec from '@jsii/spec';\nimport * as assert from 'assert';\nimport { inspect } from 'util';\n\nimport {\n isObjRef,\n isWireDate,\n isWireEnum,\n isWireMap,\n isWireStruct,\n ObjRef,\n TOKEN_DATE,\n TOKEN_ENUM,\n TOKEN_MAP,\n TOKEN_REF,\n TOKEN_STRUCT,\n WireDate,\n WireEnum,\n} from './api';\nimport { jsiiTypeFqn, objectReference, ObjectTable } from './objects';\n\nimport { api } from '.';\n\n/**\n * A specific singleton type to be explicit about a Void type\n *\n * In the spec, 'void' is represented as 'undefined'(*), but allowing the\n * value 'undefined' in function calls has lead to consumers failing to pass\n * type information that they had, just because they didn't \"have to\" (the\n * parameter was optional).\n *\n * (*) As in, declaration of a method looks like { returns?: TypeReference }\n * and the absence of a type means it returns 'void'.\n */\nexport type Void = 'void';\nconst VOID: Void = 'void';\n\n/**\n * A type instance, or Void\n */\nexport type OptionalValueOrVoid = spec.OptionalValue | Void;\n\n/**\n * A special FQN that can be used to create empty javascript objects.\n */\nexport const EMPTY_OBJECT_FQN = 'Object';\n\nexport const SYMBOL_WIRE_TYPE = Symbol.for('$jsii$wireType$');\n\n/**\n * The type kind, that controls how it will be serialized according to the above table\n */\nexport const enum SerializationClass {\n Void = 'Void',\n Date = 'Date',\n Scalar = 'Scalar',\n Json = 'Json',\n Enum = 'Enum',\n Array = 'Array',\n Map = 'Map',\n Struct = 'Struct',\n ReferenceType = 'RefType',\n Any = 'Any',\n}\n\ntype FindSymbol = (fqn: spec.FQN) => any;\ntype IsVisibleType = (fqn: spec.FQN) => boolean;\ntype LookupType = (fqn: spec.FQN) => spec.Type;\n\nexport interface SerializerHost {\n readonly objects: ObjectTable;\n debug(...args: any[]): void;\n isVisibleType: IsVisibleType;\n lookupType: LookupType;\n findSymbol: FindSymbol;\n}\n\ninterface Serializer {\n serialize(\n value: unknown,\n type: OptionalValueOrVoid,\n host: SerializerHost,\n ): any;\n deserialize(\n value: unknown,\n type: OptionalValueOrVoid,\n host: SerializerHost,\n options?: { allowNullishMapValue?: boolean },\n ): any;\n}\n\nexport const SERIALIZERS: { [k: string]: Serializer } = {\n // ----------------------------------------------------------------------\n [SerializationClass.Void]: {\n serialize(value, _type, host) {\n if (value != null) {\n host.debug('Expected void, got', value);\n }\n return undefined;\n },\n\n deserialize(value, _type, host) {\n if (value != null) {\n host.debug('Expected void, got', value);\n }\n return undefined;\n },\n },\n\n // ----------------------------------------------------------------------\n [SerializationClass.Date]: {\n serialize(value, optionalValue, host): WireDate | undefined {\n if (nullAndOk(value, optionalValue, host)) {\n return undefined;\n }\n assert(optionalValue !== VOID, 'Encountered unexpected void type!');\n\n if (!isDate(value)) {\n throw new SerializationError(\n `Value is not an instance of Date`,\n value,\n host,\n );\n }\n return serializeDate(value);\n },\n\n deserialize(value, optionalValue, host) {\n if (nullAndOk(value, optionalValue, host)) {\n return undefined;\n }\n\n if (!isWireDate(value)) {\n throw new SerializationError(\n `Value does not have the \"${TOKEN_DATE}\" key`,\n value,\n host,\n );\n }\n return deserializeDate(value);\n },\n },\n\n // ----------------------------------------------------------------------\n [SerializationClass.Scalar]: {\n serialize(value, optionalValue, host) {\n if (nullAndOk(value, optionalValue, host)) {\n return undefined;\n }\n assert(optionalValue !== VOID, 'Encountered unexpected void type!');\n\n const primitiveType = optionalValue.type as spec.PrimitiveTypeReference;\n\n if (!isScalar(value)) {\n throw new SerializationError(\n `Value is not a ${spec.describeTypeReference(optionalValue.type)}`,\n value,\n host,\n );\n }\n if (typeof value !== primitiveType.primitive) {\n throw new SerializationError(\n `Value is not a ${spec.describeTypeReference(optionalValue.type)}`,\n value,\n host,\n );\n }\n return value;\n },\n\n deserialize(value, optionalValue, host) {\n if (nullAndOk(value, optionalValue, host)) {\n return undefined;\n }\n assert(optionalValue !== VOID, 'Encountered unexpected void type!');\n\n const primitiveType = optionalValue.type as spec.PrimitiveTypeReference;\n\n if (!isScalar(value)) {\n throw new SerializationError(\n `Value is not a ${spec.describeTypeReference(optionalValue.type)}`,\n value,\n host,\n );\n }\n if (typeof value !== primitiveType.primitive) {\n throw new SerializationError(\n `Value is not a ${spec.describeTypeReference(optionalValue.type)}`,\n value,\n host,\n );\n }\n\n return value;\n },\n },\n\n // ----------------------------------------------------------------------\n [SerializationClass.Json]: {\n serialize(value, optionalValue, host) {\n // /!\\ Top-level \"null\" will turn to undefined, but any null nested in the value is valid JSON, so it'll stay!\n if (nullAndOk(value, optionalValue, host)) {\n return undefined;\n }\n\n // Just whatever. Dates will automatically serialize themselves to strings.\n return value;\n },\n deserialize(value, optionalValue, host) {\n // /!\\ Top-level \"null\" will turn to undefined, but any null nested in the value is valid JSON, so it'll stay!\n if (nullAndOk(value, optionalValue, host)) {\n return undefined;\n }\n\n // A mapping object can arrive though here. This would be the case if anything that is valid into a Map\n // is passed into a JSON transfer point. Indeed, those are also valid JSON! For example, Python \"dicts\" will be\n // serialized (by the Python runtime) as a $jsii.map (the mapping object). We need to de-serialize that as a\n // Map in order to obtain the correct output behavior here!\n if (isWireMap(value)) {\n return SERIALIZERS[SerializationClass.Map].deserialize(\n value,\n {\n type: {\n collection: {\n kind: spec.CollectionKind.Map,\n elementtype: { primitive: spec.PrimitiveType.Json },\n },\n },\n },\n host,\n { allowNullishMapValue: true },\n );\n }\n\n if (typeof value !== 'object') {\n return value;\n }\n\n if (Array.isArray(value)) {\n return value.map(mapJsonValue);\n }\n\n return mapValues(value, mapJsonValue, host);\n\n function mapJsonValue(toMap: any, key: string | number) {\n if (toMap == null) {\n return toMap;\n }\n return process(\n host,\n 'deserialize',\n toMap,\n { type: { primitive: spec.PrimitiveType.Json } },\n typeof key === 'string' ? `key ${inspect(key)}` : `index ${key}`,\n );\n }\n },\n },\n\n // ----------------------------------------------------------------------\n [SerializationClass.Enum]: {\n serialize(value, optionalValue, host): WireEnum | undefined {\n if (nullAndOk(value, optionalValue, host)) {\n return undefined;\n }\n assert(optionalValue !== VOID, 'Encountered unexpected void type!');\n\n if (typeof value !== 'string' && typeof value !== 'number') {\n throw new SerializationError(\n `Value is not a string or number`,\n value,\n host,\n );\n }\n\n host.debug('Serializing enum');\n\n const enumType = optionalValue.type as spec.NamedTypeReference;\n const enumMap = host.findSymbol(enumType.fqn);\n const enumEntry = Object.entries(enumMap).find(([, v]) => v === value);\n if (!enumEntry) {\n throw new SerializationError(\n `Value is not present in enum ${spec.describeTypeReference(\n enumType,\n )}`,\n value,\n host,\n );\n }\n return { [TOKEN_ENUM]: `${enumType.fqn}/${enumEntry[0]}` };\n },\n deserialize(value, optionalValue, host) {\n if (nullAndOk(value, optionalValue, host)) {\n return undefined;\n }\n\n if (!isWireEnum(value)) {\n throw new SerializationError(\n `Value does not have the \"${TOKEN_ENUM}\" key`,\n value,\n host,\n );\n }\n\n return deserializeEnum(value, host);\n },\n },\n\n // ----------------------------------------------------------------------\n [SerializationClass.Array]: {\n serialize(value, optionalValue, host) {\n if (nullAndOk(value, optionalValue, host)) {\n return undefined;\n }\n assert(optionalValue !== VOID, 'Encountered unexpected void type!');\n\n if (!Array.isArray(value)) {\n throw new SerializationError(`Value is not an array`, value, host);\n }\n\n const arrayType = optionalValue.type as spec.CollectionTypeReference;\n\n return value.map((x, idx) =>\n process(\n host,\n 'serialize',\n x,\n { type: arrayType.collection.elementtype },\n `index ${inspect(idx)}`,\n ),\n );\n },\n deserialize(value, optionalValue, host) {\n if (nullAndOk(value, optionalValue, host)) {\n return undefined;\n }\n assert(optionalValue !== VOID, 'Encountered unexpected void type!');\n\n if (!Array.isArray(value)) {\n throw new SerializationError(`Value is not an array`, value, host);\n }\n\n const arrayType = optionalValue.type as spec.CollectionTypeReference;\n\n return value.map((x, idx) =>\n process(\n host,\n 'deserialize',\n x,\n { type: arrayType.collection.elementtype },\n `index ${inspect(idx)}`,\n ),\n );\n },\n },\n\n // ----------------------------------------------------------------------\n [SerializationClass.Map]: {\n serialize(value, optionalValue, host) {\n if (nullAndOk(value, optionalValue, host)) {\n return undefined;\n }\n assert(optionalValue !== VOID, 'Encountered unexpected void type!');\n\n const mapType = optionalValue.type as spec.CollectionTypeReference;\n return {\n [TOKEN_MAP]: mapValues(\n value,\n (v, key) =>\n process(\n host,\n 'serialize',\n v,\n { type: mapType.collection.elementtype },\n `key ${inspect(key)}`,\n ),\n host,\n ),\n };\n },\n deserialize(\n value,\n optionalValue,\n host,\n { allowNullishMapValue = false } = {},\n ) {\n if (nullAndOk(value, optionalValue, host)) {\n return undefined;\n }\n assert(optionalValue !== VOID, 'Encountered unexpected void type!');\n\n const mapType = optionalValue.type as spec.CollectionTypeReference;\n if (!isWireMap(value)) {\n // Compatibility mode with older versions that didn't wrap in [TOKEN_MAP]\n return mapValues(\n value,\n (v, key) =>\n process(\n host,\n 'deserialize',\n v,\n {\n optional: allowNullishMapValue,\n type: mapType.collection.elementtype,\n },\n `key ${inspect(key)}`,\n ),\n host,\n );\n }\n const result = mapValues(\n value[TOKEN_MAP],\n (v, key) =>\n process(\n host,\n 'deserialize',\n v,\n {\n optional: allowNullishMapValue,\n type: mapType.collection.elementtype,\n },\n `key ${inspect(key)}`,\n ),\n host,\n );\n Object.defineProperty(result, SYMBOL_WIRE_TYPE, {\n configurable: false,\n enumerable: false,\n value: TOKEN_MAP,\n writable: false,\n });\n return result;\n },\n },\n\n // ----------------------------------------------------------------------\n [SerializationClass.Struct]: {\n serialize(value, optionalValue, host) {\n if (nullAndOk(value, optionalValue, host)) {\n return undefined;\n }\n assert(optionalValue !== VOID, 'Encountered unexpected void type!');\n\n if (typeof value !== 'object' || value == null || value instanceof Date) {\n throw new SerializationError(`Value is not an object`, value, host);\n }\n\n if (Array.isArray(value)) {\n throw new SerializationError(`Value is an array`, value, host);\n }\n\n /*\n This is what we'd like to do, but we can't because at least the Java client\n does not understand by-value serialized interface types, so we'll have to\n serialize by-reference. Additionally, serializing known properties would\n cause problems when the return type of a method is a UNION of structs.\n See: https://github.com/aws/jsii/issues/400\n\n const props = propertiesOf(namedType);\n\n return mapValues(value, (v, key) => {\n if (!props[key]) { return undefined; } // Don't map if unknown property\n return host.recurse(v, props[key].type);\n });\n */\n\n host.debug('Returning value type by reference');\n return host.objects.registerObject(value, EMPTY_OBJECT_FQN, [\n (optionalValue.type as spec.NamedTypeReference).fqn,\n ]);\n },\n deserialize(value, optionalValue, host) {\n if (typeof value === 'object' && Object.keys(value ?? {}).length === 0) {\n // Treat empty structs as `undefined` (see https://github.com/aws/jsii/issues/411)\n value = undefined;\n }\n if (nullAndOk(value, optionalValue, host)) {\n return undefined;\n }\n assert(optionalValue !== VOID, 'Encountered unexpected void type!');\n\n if (typeof value !== 'object' || value == null) {\n throw new SerializationError(`Value is not an object`, value, host);\n }\n\n const namedType = host.lookupType(\n (optionalValue.type as spec.NamedTypeReference).fqn,\n );\n const props = propertiesOf(namedType, host.lookupType);\n\n if (Array.isArray(value)) {\n throw new SerializationError(\n 'Value is an array (varargs may have been incorrectly supplied)',\n value,\n host,\n );\n }\n\n // Similarly to serialization, we might be getting a reference type where we're\n // expecting a value type. Accept this for now (but also validate that object\n // for presence of the right properties).\n if (isObjRef(value)) {\n host.debug(\n 'Expected value type but got reference type, accepting for now (awslabs/jsii#400)',\n );\n\n // Return same INSTANCE (shouldn't matter but we don't know for sure that it doesn't)\n return validateRequiredProps(\n host.objects.findObject(value).instance,\n namedType.fqn,\n props,\n host,\n );\n }\n\n if (api.isWireStruct(value)) {\n const { fqn, data } = value[api.TOKEN_STRUCT];\n if (!isAssignable(fqn, namedType, host.lookupType)) {\n throw new SerializationError(\n `Wired struct has type '${fqn}', which does not match expected type`,\n value,\n host,\n );\n }\n value = data;\n }\n\n // Python, for example, allows using plain mapping objects instead of Structs (dyanmic typing, YOLO!)\n if (api.isWireMap(value)) {\n value = value[api.TOKEN_MAP];\n }\n\n value = validateRequiredProps(value as any, namedType.fqn, props, host);\n\n // Return a dict COPY, we have by-value semantics anyway.\n return mapValues(\n value,\n (v, key) => {\n if (!props[key]) {\n return undefined;\n } // Don't map if unknown property\n return process(\n host,\n 'deserialize',\n v,\n props[key],\n `key ${inspect(key)}`,\n );\n },\n host,\n );\n },\n },\n\n // ----------------------------------------------------------------------\n [SerializationClass.ReferenceType]: {\n serialize(value, optionalValue, host): ObjRef | undefined {\n if (nullAndOk(value, optionalValue, host)) {\n return undefined;\n }\n assert(optionalValue !== VOID, 'Encountered unexpected void type!');\n\n if (typeof value !== 'object' || value == null || Array.isArray(value)) {\n throw new SerializationError(`Value is not an object`, value, host);\n }\n\n if (value instanceof Date) {\n throw new SerializationError(`Value is a Date`, value, host);\n }\n\n const expectedType = host.lookupType(\n (optionalValue.type as spec.NamedTypeReference).fqn,\n );\n const interfaces = spec.isInterfaceType(expectedType)\n ? [expectedType.fqn]\n : undefined;\n const jsiiType =\n jsiiTypeFqn(value, host.isVisibleType) ??\n (spec.isClassType(expectedType) ? expectedType.fqn : EMPTY_OBJECT_FQN);\n\n return host.objects.registerObject(value, jsiiType, interfaces);\n },\n deserialize(value, optionalValue, host) {\n if (nullAndOk(value, optionalValue, host)) {\n return undefined;\n }\n assert(optionalValue !== VOID, 'Encountered unexpected void type!');\n\n // The only way to pass a by-ref object is to have created it\n // previously inside JSII kernel, so it must have an objref already.\n\n if (!isObjRef(value)) {\n throw new SerializationError(\n `Value does not have the \"${TOKEN_REF}\" key`,\n value,\n host,\n );\n }\n\n const { instance, fqn } = host.objects.findObject(value);\n\n const namedTypeRef = optionalValue.type as spec.NamedTypeReference;\n if (namedTypeRef.fqn !== EMPTY_OBJECT_FQN) {\n const namedType = host.lookupType(namedTypeRef.fqn);\n\n // Check that the object we got is of the right type\n // We only do this for classes, not interfaces, since Java might pass us objects that\n // privately implement some interface and we can't prove they don't.\n // https://github.com/aws/jsii/issues/399\n const declaredType = optionalValue.type as spec.NamedTypeReference;\n if (\n spec.isClassType(namedType) &&\n !isAssignable(fqn, declaredType, host.lookupType)\n ) {\n throw new SerializationError(\n `Object of type '${fqn}' is not convertible to ${spec.describeTypeReference(\n declaredType,\n )}`,\n value,\n host,\n );\n }\n }\n\n return instance;\n },\n },\n\n // ----------------------------------------------------------------------\n [SerializationClass.Any]: {\n serialize(value, _type, host) {\n if (value == null) {\n return undefined;\n }\n\n if (isDate(value)) {\n return serializeDate(value);\n }\n if (isScalar(value)) {\n return value;\n }\n if (Array.isArray(value)) {\n return value.map((e, idx) =>\n process(\n host,\n 'serialize',\n e,\n { type: spec.CANONICAL_ANY },\n `index ${inspect(idx)}`,\n ),\n );\n }\n\n // Note: no case for \"ENUM\" here, without type declaration we can't tell the difference\n // between an enum member and a scalar.\n\n if (typeof value === 'function') {\n throw new SerializationError(\n 'Functions cannot be passed across language boundaries',\n value,\n host,\n );\n }\n\n if (typeof value !== 'object' || value == null) {\n throw new SerializationError(\n `A jsii kernel assumption was violated: value is not an object`,\n value,\n host,\n );\n }\n\n if (\n SYMBOL_WIRE_TYPE in value &&\n (value as any)[SYMBOL_WIRE_TYPE] === TOKEN_MAP\n ) {\n return SERIALIZERS[SerializationClass.Map].serialize(\n value,\n {\n type: {\n collection: {\n kind: spec.CollectionKind.Map,\n elementtype: spec.CANONICAL_ANY,\n },\n },\n },\n host,\n );\n }\n\n // To make sure people aren't going to try and return Map<> or Set<> out, test for\n // those and throw a descriptive error message. We can't detect these cases any other\n // way, and the by-value serialized object will be quite useless.\n if (value instanceof Set || value instanceof Map) {\n throw new SerializationError(\n 'Set and Map instances cannot be sent across the language boundary',\n value,\n host,\n );\n }\n\n // Use a previous reference to maintain object identity. NOTE: this may cause us to return\n // a different type than requested! This is just how it is right now.\n // https://github.com/aws/jsii/issues/399\n const prevRef = objectReference(value);\n if (prevRef) {\n return prevRef;\n }\n\n // If this is or should be a reference type, pass or make the reference\n // (Like regular reftype serialization, but without the type derivation to an interface)\n const jsiiType =\n jsiiTypeFqn(value, host.isVisibleType) ??\n (isByReferenceOnly(value) ? EMPTY_OBJECT_FQN : undefined);\n if (jsiiType) {\n return host.objects.registerObject(value, jsiiType);\n }\n\n // At this point we have an object that is not of an exported type. Either an object\n // literal, or an instance of a fully private class (cannot distinguish those cases).\n\n // We will serialize by-value, but recurse for serialization so that if\n // the object contains reference objects, they will be serialized appropriately.\n // (Basically, serialize anything else as a map of 'any').\n return mapValues(\n value,\n (v, key) =>\n process(\n host,\n 'serialize',\n v,\n { type: spec.CANONICAL_ANY },\n `key ${inspect(key)}`,\n ),\n host,\n );\n },\n\n deserialize(value, _type, host) {\n if (value == null) {\n return undefined;\n }\n\n if (isWireDate(value)) {\n host.debug('ANY is a Date');\n return deserializeDate(value);\n }\n if (isScalar(value)) {\n host.debug('ANY is a Scalar');\n return value;\n }\n if (Array.isArray(value)) {\n host.debug('ANY is an Array');\n return value.map((e, idx) =>\n process(\n host,\n 'deserialize',\n e,\n { type: spec.CANONICAL_ANY },\n `index ${inspect(idx)}`,\n ),\n );\n }\n\n if (isWireEnum(value)) {\n host.debug('ANY is an Enum');\n return deserializeEnum(value, host);\n }\n if (isWireMap(value)) {\n host.debug('ANY is a Map');\n const mapOfAny: spec.CollectionTypeReference = {\n collection: {\n kind: spec.CollectionKind.Map,\n elementtype: spec.CANONICAL_ANY,\n },\n };\n return SERIALIZERS[SerializationClass.Map].deserialize(\n value,\n { type: mapOfAny },\n host,\n );\n }\n if (isObjRef(value)) {\n host.debug('ANY is a Ref');\n return host.objects.findObject(value).instance;\n }\n\n // if the value has a struct token, it was serialized by a typed jsii\n // struct, but since the deserialization target is ANY, all we can do is\n // strip the data from $jsii.struct and continue to deserialize as ANY.\n if (isWireStruct(value)) {\n const { fqn, data } = value[TOKEN_STRUCT];\n host.debug(`ANY is a struct of type ${fqn}`);\n return SERIALIZERS[SerializationClass.Struct].deserialize(\n data,\n { type: { fqn } },\n host,\n );\n }\n\n // At this point again, deserialize by-value.\n host.debug('ANY is a Map');\n return mapValues(\n value,\n (v, key) =>\n process(\n host,\n 'deserialize',\n v,\n { type: spec.CANONICAL_ANY },\n `key ${inspect(key)}`,\n ),\n host,\n );\n },\n },\n};\n\nfunction serializeDate(value: Date): WireDate {\n return { [TOKEN_DATE]: value.toISOString() };\n}\n\nfunction deserializeDate(value: WireDate): Date {\n return new Date(value[TOKEN_DATE]);\n}\n\nfunction deserializeEnum(value: WireEnum, host: SerializerHost) {\n const enumLocator = value[TOKEN_ENUM];\n const sep = enumLocator.lastIndexOf('/');\n if (sep === -1) {\n throw new SerializationError(\n `Invalid enum token value ${inspect(enumLocator)}`,\n value,\n host,\n );\n }\n\n const typeName = enumLocator.slice(0, sep);\n const valueName = enumLocator.slice(sep + 1);\n\n const enumValue = host.findSymbol(typeName)[valueName];\n if (enumValue === undefined) {\n throw new SerializationError(\n `No such enum member: ${inspect(valueName)}`,\n value,\n host,\n );\n }\n return enumValue;\n}\n\nexport interface TypeSerialization {\n serializationClass: SerializationClass;\n typeRef: OptionalValueOrVoid;\n}\n\n/**\n * From a type reference, return the possible serialization types\n *\n * There can be multiple, because the type can be a type union.\n */\nexport function serializationType(\n typeRef: OptionalValueOrVoid,\n lookup: LookupType,\n): TypeSerialization[] {\n assert(\n typeRef != null,\n `Kernel error: expected type information, got ${inspect(typeRef)}`,\n );\n\n if (typeRef === 'void') {\n return [{ serializationClass: SerializationClass.Void, typeRef }];\n }\n if (spec.isPrimitiveTypeReference(typeRef.type)) {\n switch (typeRef.type.primitive) {\n case spec.PrimitiveType.Any:\n return [{ serializationClass: SerializationClass.Any, typeRef }];\n case spec.PrimitiveType.Date:\n return [{ serializationClass: SerializationClass.Date, typeRef }];\n case spec.PrimitiveType.Json:\n return [{ serializationClass: SerializationClass.Json, typeRef }];\n case spec.PrimitiveType.Boolean:\n case spec.PrimitiveType.Number:\n case spec.PrimitiveType.String:\n return [{ serializationClass: SerializationClass.Scalar, typeRef }];\n }\n\n assert(false, `Unknown primitive type: ${inspect(typeRef.type)}`);\n }\n if (spec.isCollectionTypeReference(typeRef.type)) {\n return [\n {\n serializationClass:\n typeRef.type.collection.kind === spec.CollectionKind.Array\n ? SerializationClass.Array\n : SerializationClass.Map,\n typeRef,\n },\n ];\n }\n if (spec.isUnionTypeReference(typeRef.type)) {\n const compoundTypes = flatMap(typeRef.type.union.types, (t) =>\n serializationType({ type: t }, lookup),\n );\n // Propagate the top-level 'optional' field to each individual subtype\n for (const t of compoundTypes) {\n if (t.typeRef !== 'void') {\n t.typeRef.optional = typeRef.optional;\n }\n }\n return compoundTypes.sort((l, r) =>\n compareSerializationClasses(l.serializationClass, r.serializationClass),\n );\n }\n\n // The next part of the conversion is lookup-dependent\n const type = lookup(typeRef.type.fqn);\n\n if (spec.isEnumType(type)) {\n return [{ serializationClass: SerializationClass.Enum, typeRef }];\n }\n\n if (spec.isInterfaceType(type) && type.datatype) {\n return [{ serializationClass: SerializationClass.Struct, typeRef }];\n }\n\n return [{ serializationClass: SerializationClass.ReferenceType, typeRef }];\n}\n\nfunction nullAndOk(\n x: unknown,\n type: OptionalValueOrVoid,\n host: SerializerHost,\n): boolean {\n if (x != null) {\n return false;\n }\n\n if (type !== 'void' && !type.optional) {\n throw new SerializationError(\n `A value is required (type is non-optional)`,\n x,\n host,\n );\n }\n\n return true;\n}\n\nfunction isDate(x: unknown): x is Date {\n return (\n typeof x === 'object' &&\n Object.prototype.toString.call(x) === '[object Date]'\n );\n}\n\nfunction isScalar(x: unknown): x is string | number | boolean {\n return (\n typeof x === 'string' || typeof x === 'number' || typeof x === 'boolean'\n );\n}\n\nfunction flatMap(xs: T[], fn: (x: T) => U[]): U[] {\n const ret = new Array();\n for (const x of xs) {\n ret.push(...fn(x));\n }\n return ret;\n}\n\n/**\n * Map an object's values, skipping 'undefined' values'\n */\nfunction mapValues(\n value: unknown,\n fn: (value: any, field: string) => any,\n host: SerializerHost,\n): { [key: string]: any } {\n if (typeof value !== 'object' || value == null) {\n throw new SerializationError(`Value is not an object`, value, host);\n }\n\n if (Array.isArray(value)) {\n throw new SerializationError(`Value is an array`, value, host);\n }\n\n const out: { [key: string]: any } = {};\n for (const [k, v] of Object.entries(value)) {\n const wireValue = fn(v, k);\n if (wireValue === undefined) {\n continue;\n }\n out[k] = wireValue;\n }\n return out;\n}\n\nfunction propertiesOf(\n t: spec.Type,\n lookup: LookupType,\n): { [name: string]: spec.Property } {\n if (!spec.isClassOrInterfaceType(t)) {\n return {};\n }\n\n let ret: { [name: string]: spec.Property } = {};\n\n if (t.interfaces) {\n for (const iface of t.interfaces) {\n ret = { ...ret, ...propertiesOf(lookup(iface), lookup) };\n }\n }\n if (spec.isClassType(t) && t.base) {\n ret = { ...ret, ...propertiesOf(lookup(t.base), lookup) };\n }\n\n for (const prop of t.properties ?? []) {\n ret[prop.name] = prop;\n }\n\n return ret;\n}\n\n/**\n * Tests whether a given type (by it's FQN) can be assigned to a named type reference.\n *\n * @param actualTypeFqn the FQN of the type that is being tested.\n * @param requiredType the required reference type.\n *\n * @returns true if ``requiredType`` is a super-type (base class or implemented interface) of the type designated by\n * ``actualTypeFqn``.\n */\nfunction isAssignable(\n actualTypeFqn: string,\n requiredType: spec.NamedTypeReference,\n lookup: LookupType,\n): boolean {\n // The empty object is assignable to everything\n if (actualTypeFqn === EMPTY_OBJECT_FQN) {\n return true;\n }\n\n if (requiredType.fqn === actualTypeFqn) {\n return true;\n }\n const actualType = lookup(actualTypeFqn);\n if (spec.isClassType(actualType)) {\n if (\n actualType.base &&\n isAssignable(actualType.base, requiredType, lookup)\n ) {\n return true;\n }\n }\n if (spec.isClassOrInterfaceType(actualType) && actualType.interfaces) {\n return (\n actualType.interfaces.find((iface) =>\n isAssignable(iface, requiredType, lookup),\n ) != null\n );\n }\n return false;\n}\n\nfunction validateRequiredProps(\n actualProps: { [key: string]: any },\n typeName: string,\n specProps: { [key: string]: spec.Property },\n host: SerializerHost,\n) {\n // Check for required properties\n const missingRequiredProps = Object.keys(specProps)\n .filter((name) => !specProps[name].optional)\n .filter((name) => !(name in actualProps));\n\n if (missingRequiredProps.length > 0) {\n throw new SerializationError(\n `Missing required properties for ${typeName}: ${missingRequiredProps\n .map((p) => inspect(p))\n .join(', ')}`,\n actualProps,\n host,\n );\n }\n\n return actualProps;\n}\n\nfunction compareSerializationClasses(\n l: SerializationClass,\n r: SerializationClass,\n): number {\n const order = [\n SerializationClass.Void,\n SerializationClass.Date,\n SerializationClass.Scalar,\n SerializationClass.Json,\n SerializationClass.Enum,\n SerializationClass.Array,\n SerializationClass.Map,\n SerializationClass.Struct,\n SerializationClass.ReferenceType,\n SerializationClass.Any,\n ];\n return order.indexOf(l) - order.indexOf(r);\n}\n\n/**\n * Determines whether `obj` must be passed by-reference or if by-value is acceptable. For example,\n * objects with methods, or dynamic getters (or setters) should be passed by-reference as a matter\n * of security. The behavior in non-JS runtimes could otherwise differ from that in pure JS (if\n * getters are not stable, etc...).\n *\n * @param obj the object to be tested.\n *\n * @returns true if `obj` must be passed by-reference.\n */\nfunction isByReferenceOnly(obj: any): boolean {\n if (Array.isArray(obj)) {\n return false;\n }\n\n let curr = obj;\n // Crawl up the prototype chain to look for dynamic properties or methods.\n do {\n for (const prop of Object.getOwnPropertyNames(curr)) {\n const descr = Object.getOwnPropertyDescriptor(curr, prop);\n if (\n descr?.get != null ||\n descr?.set != null ||\n typeof descr?.value === 'function'\n ) {\n // Property has a dynamic getter, setter or is a constructor/method, so by-ref required!\n return true;\n }\n }\n // End when the parent proto is `Object`, which has no parent proto itself.\n } while (Object.getPrototypeOf((curr = Object.getPrototypeOf(curr))) != null);\n\n return false;\n}\n\nexport function process(\n host: SerializerHost,\n serde: keyof Serializer,\n value: unknown,\n type: OptionalValueOrVoid,\n context: string,\n) {\n const wireTypes = serializationType(type, host.lookupType);\n host.debug(serde, value, ...wireTypes);\n\n const errors = new Array();\n for (const { serializationClass, typeRef } of wireTypes) {\n try {\n return SERIALIZERS[serializationClass][serde](value, typeRef, host);\n } catch (error: any) {\n error.context = `as ${\n typeRef === VOID ? VOID : spec.describeTypeReference(typeRef.type)\n }`;\n errors.push(error);\n }\n }\n\n const typeDescr =\n type === VOID ? type : spec.describeTypeReference(type.type);\n const optionalTypeDescr =\n type !== VOID && type.optional ? `${typeDescr} | undefined` : typeDescr;\n throw new SerializationError(\n `${titleize(context)}: Unable to ${serde} value as ${optionalTypeDescr}`,\n value,\n host,\n errors,\n { renderValue: true },\n );\n\n function titleize(text: string): string {\n text = text.trim();\n if (text === '') {\n return text;\n }\n const [first, ...rest] = text;\n return [first.toUpperCase(), ...rest].join('');\n }\n}\n\nexport class SerializationError extends Error {\n public readonly name: string = '@jsii/kernel.SerializationError';\n\n public constructor(\n message: string,\n public readonly value: unknown,\n { isVisibleType }: { readonly isVisibleType: (fqn: string) => boolean },\n public readonly causes: readonly any[] = [],\n { renderValue = false }: { renderValue?: boolean } = {},\n ) {\n super(\n [\n message,\n ...(renderValue\n ? [\n `${\n causes.length > 0 ? '\\u{251C}' : '\\u{2570}'\n }\\u{2500}\\u{2500} \\u{1F6D1} Failing value is ${describeTypeOf(\n value,\n isVisibleType,\n )}`,\n ...(value == null\n ? []\n : inspect(value, false, 0)\n .split('\\n')\n .map(\n (l) =>\n `${causes.length > 0 ? '\\u{2502}' : ' '} ${l}`,\n )),\n ]\n : []),\n ...(causes.length > 0\n ? [\n '\\u{2570}\\u{2500}\\u{2500} \\u{1F50D} Failure reason(s):',\n ...causes.map(\n (cause, idx) =>\n ` ${\n idx < causes.length - 1 ? '\\u{251C}' : '\\u{2570}'\n }\\u{2500}${\n causes.length > 1\n ? ` [${cause.context ?? inspect(idx)}]`\n : ''\n } ${cause.message.split('\\n').join('\\n ')}`,\n ),\n ]\n : []),\n ].join('\\n'),\n );\n }\n}\n\nfunction describeTypeOf(\n value: unknown,\n isVisibleType: (fqn: string) => boolean,\n) {\n const type = typeof value;\n switch (type) {\n case 'object':\n if (value == null) {\n return JSON.stringify(value);\n }\n\n if (Array.isArray(value)) {\n return 'an array';\n }\n\n const fqn = jsiiTypeFqn(value as object, isVisibleType);\n if (fqn != null && fqn !== EMPTY_OBJECT_FQN) {\n return `an instance of ${fqn}`;\n }\n\n const ctorName = (value as object).constructor.name;\n if (ctorName != null && ctorName !== Object.name) {\n return `an instance of ${ctorName}`;\n }\n\n return `an object`;\n\n case 'undefined':\n return type;\n\n case 'boolean':\n case 'function':\n case 'number':\n case 'string':\n default:\n return `a ${type}`;\n }\n}\n","import { tmpdir } from 'os';\nimport { join } from 'path';\n\nexport function defaultCacheRoot(): string {\n switch (process.platform) {\n case 'darwin':\n if (process.env.HOME)\n return join(\n process.env.HOME,\n 'Library',\n 'Caches',\n 'com.amazonaws.jsii',\n 'package-cache',\n );\n break;\n case 'linux':\n if (process.env.HOME)\n return join(process.env.HOME, '.cache', 'aws', 'jsii', 'package-cache');\n break;\n case 'win32':\n if (process.env.LOCALAPPDATA)\n return join(process.env.LOCALAPPDATA, 'AWS', 'jsii', 'package-cache');\n break;\n default:\n // Fall back on putting in tmpdir()\n }\n return join(tmpdir(), 'aws-jsii-package-cache');\n}\n","import { mkdirSync, rmSync } from 'fs';\nimport * as tar from 'tar';\n\nimport { DiskCache } from '../disk-cache';\nimport { link } from '../link';\nimport { defaultCacheRoot } from './default-cache-root';\n\nexport type ExtractOptions = Omit<\n tar.ExtractOptions & tar.FileOptions,\n 'file' | 'cwd'\n>;\n\nexport interface ExtractResult {\n /**\n * When `'hit'`, the data was already present in cache and was returned from\n * cache.\n *\n * When `'miss'`, the data was extracted into the cache and returned from\n * cache.\n *\n * When `undefined`, the cache is not enabled.\n */\n readonly cache?: 'hit' | 'miss';\n}\n\nlet packageCacheEnabled =\n (process.env.JSII_RUNTIME_PACKAGE_CACHE?.toLocaleLowerCase() ?? 'enabled') ===\n 'enabled';\n\n/**\n * Extracts the content of a tarball, possibly caching it on disk.\n *\n * @param file is the path to the tarball to be extracted.\n * @param options are options to pass to `tar.extract`\n * @param comments are included in the cache key, when caching is enabled.\n *\n * @returns the result of the extraction.\n */\nexport function extract(\n file: string,\n outDir: string,\n options: ExtractOptions,\n ...comments: readonly string[]\n): ExtractResult {\n try {\n return (packageCacheEnabled ? extractViaCache : extractToOutDir)(\n file,\n outDir,\n options,\n ...comments,\n );\n } catch (err) {\n rmSync(outDir, { force: true, recursive: true });\n throw err;\n }\n}\n\n/**\n * Extract the tarball into a cached directory, symlink that directory into the target location\n */\nfunction extractViaCache(\n file: string,\n outDir: string,\n options: ExtractOptions = {},\n ...comments: readonly string[]\n): { cache: 'hit' | 'miss' } {\n const cacheRoot =\n process.env.JSII_RUNTIME_PACKAGE_CACHE_ROOT ?? defaultCacheRoot();\n const dirCache = DiskCache.inDirectory(cacheRoot);\n\n const entry = dirCache.entryFor(file, ...comments);\n const { path, cache } = entry.retrieve((path) => {\n untarInto({\n ...options,\n cwd: path,\n file,\n });\n });\n\n link(path, outDir);\n\n return { cache };\n}\n\n/**\n * Extract directory into the target location\n */\nfunction extractToOutDir(\n file: string,\n cwd: string,\n options: ExtractOptions = {},\n): { cache?: undefined } {\n // The output directory must already exist...\n mkdirSync(cwd, { recursive: true });\n\n // !!!IMPORTANT!!!\n // Extract directly into the final target directory, as certain antivirus\n // software configurations on Windows will make a `renameSync` operation\n // fail with EPERM until the files have been fully analyzed.\n untarInto({ ...options, cwd, file });\n return {};\n}\n\nfunction untarInto(\n options: tar.ExtractOptions & tar.FileOptions & { cwd: string },\n) {\n try {\n tar.extract({ ...options, sync: true });\n } catch (error) {\n rmSync(options.cwd, { force: true, recursive: true });\n throw error;\n }\n}\n\n/** @internal */\nexport function getPackageCacheEnabled(): boolean {\n return packageCacheEnabled;\n}\n\n/** @internal */\nexport function setPackageCacheEnabled(value: boolean) {\n packageCacheEnabled = value;\n}\n","import {\n api,\n Kernel,\n JsiiFault,\n JsiiError,\n RuntimeError,\n JsiiErrorType,\n} from '@jsii/kernel';\nimport { EventEmitter } from 'events';\n\nimport { Input, IInputOutput } from './in-out';\n\nexport class KernelHost {\n private readonly kernel = new Kernel(this.callbackHandler.bind(this));\n private readonly eventEmitter = new EventEmitter();\n\n public constructor(\n private readonly inout: IInputOutput,\n private readonly opts: {\n debug?: boolean;\n debugTiming?: boolean;\n noStack?: boolean;\n validateAssemblies?: boolean;\n } = {},\n ) {\n this.kernel.traceEnabled = opts.debug ?? false;\n this.kernel.debugTimingEnabled = opts.debugTiming ?? false;\n this.kernel.validateAssemblies = opts.validateAssemblies ?? false;\n }\n\n public run() {\n const req = this.inout.read();\n if (!req || 'exit' in req) {\n this.eventEmitter.emit('exit', req?.exit ?? 0);\n return; // done\n }\n\n this.processRequest(req, () => {\n // Schedule the call to run on the next event loop iteration to\n // avoid recursion.\n setImmediate(() => this.run());\n });\n }\n\n public once(event: 'exit', listener: (code: number) => void) {\n this.eventEmitter.once(event, listener);\n }\n\n private callbackHandler(\n callback: api.Callback,\n ): api.CompleteRequest['result'] {\n // write a \"callback\" response, which is a special response that tells\n // the client that there's synchronous callback it needs to invoke and\n // bring back the result via a \"complete\" request.\n this.inout.write({ callback });\n\n return completeCallback.call(this);\n\n function completeCallback(this: KernelHost): api.CompleteRequest['result'] {\n const req = this.inout.read();\n if (!req || 'exit' in req) {\n throw new JsiiFault('Interrupted before callback returned');\n }\n\n // if this is a completion for the current callback, then we can\n // finally stop this nonsense and return the result.\n const completeReq = req as { complete: api.CompleteRequest };\n if (\n 'complete' in completeReq &&\n completeReq.complete.cbid === callback.cbid\n ) {\n if (completeReq.complete.err) {\n if (completeReq.complete.name === JsiiErrorType.JSII_FAULT) {\n throw new JsiiFault(completeReq.complete.err);\n }\n throw new RuntimeError(completeReq.complete.err);\n }\n\n return completeReq.complete.result;\n }\n\n // otherwise, process the request normally, but continue to wait for\n // our callback to be completed. sync=true to enforce that `completeCallback`\n // will be called synchronously and return value will be chained back so we can\n // return it to the callback handler.\n return this.processRequest(\n req,\n completeCallback.bind(this),\n /* sync */ true,\n );\n }\n }\n\n /**\n * Processes the input request `req` and writes the output response to\n * stdout. This method invokes `next` when the request was fully processed.\n * This either happens synchronously or asynchronously depending on the api\n * (e.g. the \"end\" api will wait for an async promise to be fulfilled before\n * it writes the response)\n *\n * @param req The input request\n * @param next A callback to invoke to continue\n * @param sync If this is 'true', \"next\" must be called synchronously. This means\n * that we won't process any async activity (begin/complete). The kernel\n * doesn't allow any async operations during a sync callback, so this shouldn't\n * happen, so we assert in this case to find bugs.\n */\n private processRequest(\n req: Input,\n next: () => T,\n sync = false,\n ): T | undefined {\n if ('callback' in req) {\n throw new JsiiFault(\n 'Unexpected `callback` result. This request should have been processed by a callback handler',\n );\n }\n\n if (!('api' in req)) {\n throw new JsiiFault('Malformed request, \"api\" field is required');\n }\n\n const apiReq = req;\n const fn = this.findApi(apiReq.api);\n\n try {\n const ret = fn.call(this.kernel, req);\n\n // special case for 'begin' and 'complete' which are on an async\n // promise path. in order to allow the kernel to actually fulfill\n // the promise, and continue any async flows (which may potentially\n // start other promises), we respond only within a setImmediate\n // block, which is scheduled in the same micro-tasks queue as\n // promises. see the kernel test 'async overrides: two overrides'\n // for an example for this use case.\n if (apiReq.api === 'begin' || apiReq.api === 'complete') {\n checkIfAsyncIsAllowed();\n\n this.debug('processing pending promises before responding');\n\n setImmediate(() => {\n this.writeOkay(ret);\n next();\n });\n\n return undefined;\n }\n\n // if this is an async method, return immediately and\n // call next only when the promise is fulfilled.\n if (this.isPromise(ret)) {\n checkIfAsyncIsAllowed();\n\n this.debug('waiting for promise to be fulfilled');\n\n const promise = ret;\n promise\n .then((val) => {\n this.debug('promise succeeded:', val);\n this.writeOkay(val);\n next();\n })\n .catch((e) => {\n this.debug('promise failed:', e);\n this.writeError(e);\n next();\n });\n\n return undefined;\n }\n\n this.writeOkay(ret);\n } catch (e: any) {\n this.writeError(e);\n }\n\n // indicate this request was processed (synchronously).\n return next();\n\n function checkIfAsyncIsAllowed() {\n if (sync) {\n throw new JsiiFault(\n 'Cannot handle async operations while waiting for a sync callback to return',\n );\n }\n }\n }\n\n /**\n * Writes an \"ok\" result to stdout.\n */\n private writeOkay(result: any) {\n const res = { ok: result };\n this.inout.write(res);\n }\n\n /**\n * Writes an \"error\" result to stdout.\n */\n private writeError(error: JsiiError) {\n const res = {\n error: error.message,\n name: error.name,\n stack: this.opts.noStack ? undefined : error.stack,\n };\n this.inout.write(res);\n }\n\n /**\n * Returns true if the value is a promise.\n */\n private isPromise(v: any): v is Promise {\n return typeof v?.then === 'function';\n }\n\n /**\n * Given a kernel api name, returns the function to invoke.\n */\n private findApi(apiName: string): (this: Kernel, arg: Input) => any {\n const fn = (this.kernel as any)[apiName];\n if (typeof fn !== 'function') {\n throw new Error(`Invalid kernel api call: ${apiName}`);\n }\n return fn;\n }\n\n private debug(...args: any[]) {\n if (!this.opts.debug) {\n return;\n }\n\n console.error(...args);\n }\n}\n","import { api } from '@jsii/kernel';\n\nimport { SyncStdio } from './sync-stdio';\n\nexport type Output =\n | { hello: string }\n | { ok: api.KernelResponse }\n | { callback: api.Callback }\n | { pending: true }\n | { error: string; stack?: string };\n\nexport type Input =\n | ({ api: string } & api.KernelRequest)\n | { complete: api.CompleteRequest };\n\nexport type Exit = { exit: number };\n\n/**\n * An IO provider for jsii API exchanges.\n */\nexport interface IInputOutput {\n /**\n * Writes a message to the jsii API host.\n * @param message the message to be sent.\n */\n write(message: Output): void;\n\n /**\n * Wait for a message from the jsii API host, then return it.\n *\n * @returns the received message, or `undefined` if the API host has no more\n * requests to send.\n */\n read(): Input | Exit | undefined;\n}\n\nexport class InputOutput implements IInputOutput {\n public debug = false;\n\n public constructor(private readonly stdio: SyncStdio) {}\n\n public write(obj: Output) {\n const output = JSON.stringify(obj);\n this.stdio.writeLine(output);\n\n if (this.debug) {\n this.stdio.writeErrorLine(`< ${output}`);\n }\n }\n\n public read(): Input | undefined {\n let reqLine = this.stdio.readLine();\n if (!reqLine) {\n return undefined;\n }\n\n // skip recorded responses\n if (reqLine.startsWith('< ')) {\n return this.read();\n }\n\n // stip \"> \" from recorded requests\n if (reqLine.startsWith('> ')) {\n reqLine = reqLine.slice(2);\n }\n\n const input = JSON.parse(reqLine);\n\n if (this.debug) {\n this.stdio.writeErrorLine(`> ${JSON.stringify(input)}`);\n }\n\n return input;\n }\n}\n","import * as fs from 'fs';\n\nconst INPUT_BUFFER_SIZE = 1_048_576; // 1MiB (aka: 1024 * 1024), not related to max line length\n\nexport class SyncStdio {\n private bufferedData = Buffer.alloc(0);\n\n private readonly stderr: number;\n private readonly stdin: number;\n private readonly stdout: number;\n\n // A buffer that will be used for all reading operations.\n private readonly readBuffer = Buffer.alloc(INPUT_BUFFER_SIZE);\n\n public constructor({ errorFD, readFD, writeFD }: SyncStdioOptions) {\n this.stderr = errorFD;\n this.stdin = readFD;\n this.stdout = writeFD;\n }\n\n public writeErrorLine(line: string) {\n this.writeBuffer(Buffer.from(`${line}\\n`), this.stderr);\n }\n\n public writeLine(line: string) {\n this.writeBuffer(Buffer.from(`${line}\\n`), this.stdout);\n }\n\n public readLine(): string | undefined {\n while (!this.bufferedData.includes('\\n', 0, 'utf-8')) {\n const read = fs.readSync(\n this.stdin,\n this.readBuffer,\n 0,\n this.readBuffer.length,\n null,\n );\n\n if (read === 0) {\n return undefined;\n }\n\n const newData = this.readBuffer.slice(0, read);\n this.bufferedData = Buffer.concat([this.bufferedData, newData]);\n }\n\n const newLinePos = this.bufferedData.indexOf('\\n', 0, 'utf-8');\n const next = this.bufferedData.slice(0, newLinePos).toString('utf-8');\n this.bufferedData = this.bufferedData.slice(newLinePos + 1);\n\n return next;\n }\n\n private writeBuffer(buffer: Buffer, fd: number) {\n let offset = 0;\n while (offset < buffer.length) {\n try {\n offset += fs.writeSync(fd, buffer, offset);\n } catch (e: any) {\n // We might get EAGAIN if the file descriptor was not opened for\n // blocking (O_SYNC) writes. In such cases, we'll keep trying until it\n // succeeds. This shouldn't take long as the process on the other side\n // is expected to actively wait for data on those pipes.\n if (e.code !== 'EAGAIN') {\n throw e;\n }\n }\n }\n }\n}\n\nexport interface SyncStdioOptions {\n /**\n * The file descriptor from which data is to be read. This MUST be opened for\n * blocking (O_SYNC) reading.\n */\n readonly readFD: number;\n\n /**\n * The file descriptor to which data is to be written. This SHOULD be opened\n * for blocking (O_SYNC) writing.\n */\n readonly writeFD: number;\n\n /**\n * The file descriptor to which errors data is to be written. This SHOULD be\n * opened for blocking (O_SYNC) writing.\n */\n readonly errorFD: number;\n}\n","import * as fs from 'fs';\nimport * as path from 'path';\nimport * as zlib from 'zlib';\n\nimport {\n Assembly,\n SPEC_FILE_NAME,\n SPEC_FILE_NAME_COMPRESSED,\n} from './assembly';\nimport {\n AssemblyRedirect,\n isAssemblyRedirect,\n validateAssemblyRedirect,\n} from './redirect';\nimport { validateAssembly } from './validate-assembly';\n\n/**\n * Returns true if the SPEC_FILE_NAME_COMPRESSED file exists in the directory.\n */\nexport function compressedAssemblyExists(directory: string): boolean {\n return fs.existsSync(path.join(directory, SPEC_FILE_NAME_COMPRESSED));\n}\n\n/**\n * Finds the path to the SPEC_FILE_NAME file, which will either\n * be the assembly or hold instructions to find the assembly.\n *\n * @param directory path to a directory with an assembly file\n * @returns path to the SPEC_FILE_NAME file\n */\nexport function findAssemblyFile(directory: string) {\n const dotJsiiFile = path.join(directory, SPEC_FILE_NAME);\n\n if (!fs.existsSync(dotJsiiFile)) {\n throw new Error(\n `Expected to find ${SPEC_FILE_NAME} file in ${directory}, but no such file found`,\n );\n }\n\n return dotJsiiFile;\n}\n\n/**\n * Replaces the file where the original assembly file *should* be found with a new assembly file.\n * Detects whether or not there is a compressed assembly, and if there is, compresses the new assembly also.\n * Replaces the fingerprint with '**********' rather than recalculating it, since we have modified the assembly.\n */\nexport function replaceAssembly(assembly: Assembly, directory: string) {\n writeAssembly(directory, _fingerprint(assembly), {\n compress: compressedAssemblyExists(directory),\n });\n}\n\n/**\n * Replaces the old fingerprint with '***********'.\n *\n * We could recalculate the fingerprint here so that it looks like the assembly was not modified. However,\n * 1) we are not actually validating the fingerprint in any way, and\n * 2) it feels disingenuous to have a mechanism against tampering and then tamper with it.\n *\n * So, instead of keeping the old (wrong) fingerprint or spending extra time calculating a new fingerprint,\n * we replace with '**********' that demonstrates the fingerprint has changed.\n */\nfunction _fingerprint(assembly: Assembly): Assembly {\n assembly.fingerprint = '*'.repeat(10);\n return assembly;\n}\n\n/**\n * Writes the assembly file either as .jsii or .jsii.gz if zipped\n *\n * @param directory the directory path to place the assembly file\n * @param assembly the contents of the assembly\n * @param compress whether or not to zip the assembly (.jsii.gz)\n * @returns whether or not the assembly was zipped\n */\nexport function writeAssembly(\n directory: string,\n assembly: Assembly,\n { compress = false }: { compress?: boolean } = {},\n) {\n if (compress) {\n // write .jsii file with instructions on opening the compressed file\n fs.writeFileSync(\n path.join(directory, SPEC_FILE_NAME),\n JSON.stringify({\n schema: 'jsii/file-redirect',\n compression: 'gzip',\n filename: SPEC_FILE_NAME_COMPRESSED,\n }),\n 'utf-8',\n );\n\n // write actual assembly contents in .jsii.gz\n fs.writeFileSync(\n path.join(directory, SPEC_FILE_NAME_COMPRESSED),\n zlib.gzipSync(JSON.stringify(assembly)),\n );\n } else {\n fs.writeFileSync(\n path.join(directory, SPEC_FILE_NAME),\n JSON.stringify(assembly, null, 2),\n 'utf-8',\n );\n }\n\n return compress;\n}\n\nconst failNoReadfileProvided = (filename: string) => {\n throw new Error(\n `Unable to load assembly support file ${JSON.stringify(\n filename,\n )}: no readFile callback provided!`,\n );\n};\n\n/**\n * Parses the assembly buffer and, if instructed to, redirects to the\n * compressed assembly buffer.\n *\n * @param assemblyBuffer buffer containing SPEC_FILE_NAME contents\n * @param readFile a callback to use for reading additional support files\n * @param validate whether or not to validate the assembly\n */\nexport function loadAssemblyFromBuffer(\n assemblyBuffer: Buffer,\n readFile: (filename: string) => Buffer = failNoReadfileProvided,\n validate = true,\n): Assembly {\n let contents = JSON.parse(assemblyBuffer.toString('utf-8'));\n\n // check if the file holds instructions to the actual assembly file\n while (isAssemblyRedirect(contents)) {\n contents = followRedirect(contents, readFile);\n }\n\n return validate ? validateAssembly(contents) : contents;\n}\n\n/**\n * Loads the assembly file and, if present, follows instructions\n * found in the file to unzip compressed assemblies.\n *\n * @param directory the directory of the assembly file\n * @param validate whether to validate the contents of the file\n * @returns the assembly file as an Assembly object\n */\nexport function loadAssemblyFromPath(\n directory: string,\n validate = true,\n): Assembly {\n const assemblyFile = findAssemblyFile(directory);\n return loadAssemblyFromFile(assemblyFile, validate);\n}\n\n/**\n * Loads the assembly file and, if present, follows instructions\n * found in the file to unzip compressed assemblies.\n *\n * @param pathToFile the path to the SPEC_FILE_NAME file\n * @param validate whether to validate the contents of the file\n * @returns the assembly file as an Assembly object\n */\nexport function loadAssemblyFromFile(\n pathToFile: string,\n validate = true,\n): Assembly {\n const data = fs.readFileSync(pathToFile);\n try {\n return loadAssemblyFromBuffer(\n data,\n (filename) => fs.readFileSync(path.resolve(pathToFile, '..', filename)),\n validate,\n );\n } catch (e: any) {\n throw new Error(`Error loading assembly from file ${pathToFile}:\\n${e}`);\n }\n}\n\nfunction followRedirect(\n assemblyRedirect: AssemblyRedirect,\n readFile: (filename: string) => Buffer,\n) {\n // Validating the schema, this is cheap (the schema is small).\n validateAssemblyRedirect(assemblyRedirect);\n\n let data = readFile(assemblyRedirect.filename);\n switch (assemblyRedirect.compression) {\n case 'gzip':\n data = zlib.gunzipSync(data);\n break;\n case undefined:\n break;\n default:\n throw new Error(\n `Unsupported compression algorithm: ${JSON.stringify(\n assemblyRedirect.compression,\n )}`,\n );\n }\n const json = data.toString('utf-8');\n return JSON.parse(json);\n}\n","/**\n * Expected file name for jsii assembly or instructions to compressed assembly.\n */\nexport const SPEC_FILE_NAME = '.jsii';\n\n/**\n * Expected file name for compressed assemblies.\n */\nexport const SPEC_FILE_NAME_COMPRESSED = `${SPEC_FILE_NAME}.gz`;\n\n/**\n * A JSII assembly specification.\n */\nexport interface Assembly\n extends AssemblyConfiguration,\n Documentable,\n ReadMeContainer {\n /**\n * The version of the spec schema\n */\n schema: SchemaVersion.LATEST;\n\n /**\n * The name of the assembly\n *\n * @minLength 1\n */\n name: string;\n\n /**\n * Description of the assembly, maps to \"description\" from package.json\n * This is required since some package managers (like Maven) require it.\n */\n description: string;\n\n /**\n * The url to the project homepage. Maps to \"homepage\" from package.json.\n */\n homepage: string;\n\n /**\n * The module repository, maps to \"repository\" from package.json\n * This is required since some package managers (like Maven) require it.\n */\n repository: {\n /**\n * The type of the repository (``git``, ``svn``, ...)\n */\n type: string;\n\n /**\n * The URL of the repository.\n */\n url: string;\n\n /**\n * If the package is not in the root directory (for example, when part\n * of a monorepo), you should specify the directory in which it lives.\n *\n * @default the root of the repository\n */\n directory?: string;\n };\n\n /**\n * The main author of this package.\n */\n author: Person;\n\n /**\n * Additional contributors to this package.\n *\n * @default none\n */\n contributors?: Person[];\n\n /**\n * A fingerprint that can be used to determine if the specification has\n * changed.\n *\n * @minLength 1\n */\n fingerprint: string;\n\n /**\n * The version of the assembly\n * @minLength 1\n */\n version: string;\n\n /**\n * The version of the jsii compiler that was used to produce this Assembly.\n * @minLength 1\n */\n jsiiVersion: string;\n\n /**\n * The SPDX name of the license this assembly is distributed on.\n */\n license: string;\n\n /**\n * Arbitrary key-value pairs of metadata, which the maintainer chose to\n * document with the assembly. These entries do not carry normative\n * semantics and their interpretation is up to the assembly maintainer.\n *\n * @default none\n */\n metadata?: { [key: string]: any };\n\n /**\n * Keywords that help discover or identify this packages with respects to it's\n * intended usage, audience, etc... Where possible, this will be rendered in\n * the corresponding metadata section of idiomatic package manifests, for\n * example NuGet package tags.\n */\n keywords?: string[];\n\n /**\n * Direct dependencies on other assemblies (with semver), the key is the JSII\n * assembly name, and the value is a SemVer expression.\n *\n * @default none\n */\n dependencies?: { [assembly: string]: string };\n\n /**\n * Target configuration for all the assemblies that are direct or transitive\n * dependencies of this assembly. This is needed to generate correct native\n * type names for any transitively inherited member, in certain languages.\n *\n * @default none\n */\n dependencyClosure?: { [assembly: string]: DependencyConfiguration };\n\n /**\n * List if bundled dependencies (these are not expected to be jsii\n * assemblies).\n *\n * @default none\n */\n bundled?: { [module: string]: string };\n\n /**\n * All types in the assembly, keyed by their fully-qualified-name\n *\n * @default none\n */\n types?: { [fqn: string]: Type };\n\n /**\n * List of bin-scripts\n *\n * @default none\n */\n bin?: { readonly [script: string]: string };\n}\n\n/**\n * Shareable configuration of a jsii Assembly.\n */\nexport interface AssemblyConfiguration extends Targetable {\n /**\n * Submodules declared in this assembly.\n *\n * @default none\n */\n submodules?: { [fqn: string]: Submodule };\n}\n\nexport interface DependencyConfiguration extends Targetable {\n submodules?: { [fqn: string]: Targetable };\n}\n\n/**\n * A targetable module-like thing\n *\n * Has targets and a readme. Used for Assemblies and Submodules.\n */\nexport interface Targetable {\n /**\n * A map of target name to configuration, which is used when generating\n * packages for various languages.\n *\n * @default none\n */\n targets?: AssemblyTargets;\n}\n\n/**\n * Elements that can contain a `readme` property.\n */\nexport interface ReadMeContainer {\n /**\n * The readme document for this module (if any).\n *\n * @default none\n */\n readme?: ReadMe;\n}\n\n/**\n * README information\n */\nexport interface ReadMe {\n markdown: string;\n}\n\n/**\n * A submodule\n *\n * The difference between a top-level module (the assembly) and a submodule is\n * that the submodule is annotated with its location in the repository.\n */\nexport type Submodule = ReadMeContainer &\n SourceLocatable &\n Targetable &\n TypeScriptLocatable;\n\n/**\n * Versions of the JSII Assembly Specification.\n */\nexport enum SchemaVersion {\n LATEST = 'jsii/0.10.0',\n}\n\n/**\n * Fully Qualified Name\n */\nexport type FQN = string;\n\n/**\n * Metadata about people or organizations associated with the project that\n * resulted in the Assembly. Some of this metadata is required in order to\n * publish to certain package repositories (for example, Maven Central), but is\n * not normalized, and the meaning of fields (role, for example), is up to each\n * project maintainer.\n */\nexport interface Person {\n /**\n * The name of the person\n */\n name: string;\n\n /**\n * A list of roles this person has in the project, for example `maintainer`,\n * `contributor`, `owner`, ...\n */\n roles: string[];\n\n /**\n * The email of the person\n *\n * @default none\n */\n email?: string;\n\n /**\n * The URL for the person\n *\n * @default none\n */\n url?: string;\n\n /**\n * If true, this person is, in fact, an organization\n *\n * @default false\n */\n organization?: boolean;\n}\n\n/**\n * Configurable targets for an asembly.\n */\nexport interface AssemblyTargets {\n /**\n * Information about a particular language's targets\n */\n [language: string]: { [key: string]: any } | undefined;\n}\n\n/**\n * Where in the module source the definition for this API item was found\n */\nexport interface SourceLocation {\n /**\n * Relative filename\n */\n filename: string;\n\n /**\n * 1-based line number in the indicated file\n */\n line: number;\n}\n\n/**\n * Key value pairs of documentation nodes.\n * Based on TSDoc.\n */\nexport interface Docs {\n /**\n * Summary documentation for an API item.\n *\n * The first part of the documentation before hitting a `@remarks` tags, or\n * the first line of the doc comment block if there is no `@remarks` tag.\n *\n * @default none\n */\n summary?: string;\n\n /**\n * Detailed information about an API item.\n *\n * Either the explicitly tagged `@remarks` section, otherwise everything\n * past the first paragraph if there is no `@remarks` tag.\n *\n * @default none\n */\n remarks?: string;\n\n /**\n * If present, this block indicates that an API item is no longer supported\n * and may be removed in a future release. The `@deprecated` tag must be\n * followed by a sentence describing the recommended alternative.\n * Deprecation recursively applies to members of a container. For example,\n * if a class is deprecated, then so are all of its members.\n *\n * @default none\n */\n deprecated?: string;\n\n /**\n * The `@returns` block for this doc comment, or undefined if there is not\n * one.\n *\n * @default none\n */\n returns?: string;\n\n /**\n * Whether the API item is beta/experimental quality\n */\n stability?: Stability;\n\n /**\n * Example showing the usage of this API item\n *\n * Starts off in running text mode, may switch to code using fenced code\n * blocks.\n *\n * @default none\n */\n example?: string;\n\n /**\n * A `@see` link with more information\n *\n * @default none\n */\n see?: string;\n\n /**\n * Whether this class or interface was intended to be subclassed/implemented\n * by library users.\n *\n * Classes intended for subclassing, and interfaces intended to be\n * implemented by consumers, are held to stricter standards of API\n * compatibility.\n *\n * @default false\n */\n subclassable?: boolean;\n\n /**\n * Description of the default\n *\n * @default none\n */\n default?: string;\n\n /**\n * Custom tags that are not any of the default ones\n *\n * @default none\n */\n custom?: { [tag: string]: string };\n}\n\n/**\n * API Stability levels. These are modeled after the `node` stability index.\n *\n * @see https://nodejs.org/api/documentation.html#documentation_stability_index.\n */\nexport enum Stability {\n /**\n * The API may emit warnings. Backward compatibility is not guaranteed.\n *\n * More information about the deprecation can usually be found in the\n * `deprecated` field.\n */\n Deprecated = 'deprecated',\n\n /**\n * This API is still under active development and subject to non-backward\n * compatible changes or removal in any future version. Use of the API is\n * not recommended in production environments. Experimental APIs are not\n * subject to the Semantic Versioning model.\n */\n Experimental = 'experimental',\n\n /**\n * This API is subject to the Semantic Versioning model and may not change\n * in breaking ways in a subsequent minor or patch version.\n */\n Stable = 'stable',\n\n /**\n * This API is an representation of an API managed elsewhere and follows\n * the other API's versioning model.\n */\n External = 'external',\n}\n\n/**\n * Indicates that an entity is documentable.\n */\nexport interface Documentable {\n /**\n * Documentation for this entity.\n *\n * @default none\n */\n docs?: Docs;\n}\n\n/**\n * Indicates that an entity has a source location\n */\nexport interface SourceLocatable {\n /**\n * Where in the module this definition was found\n *\n * Why is this not `locationInAssembly`? Because the assembly is the JSII\n * file combining compiled code and its manifest, whereas this is referring\n * to the location of the source in the module the assembly was built from.\n *\n * @default none\n */\n locationInModule?: SourceLocation;\n}\n\n/**\n * Indicates that a jsii entity's origin can be traced to TypeScript code\n *\n * This is interface is not the same as `SourceLocatable`. SourceLocatable\n * identifies lines in source files in a source repository (in a `.ts` file,\n * with respect to a git root).\n *\n * On the other hand, `TypeScriptLocatable` identifies a symbol name inside a\n * potentially distributed TypeScript file (in either a `.d.ts` or `.ts`\n * file, with respect to the package root).\n */\nexport interface TypeScriptLocatable {\n /**\n * Unique string representation of the corresponding Typescript symbol\n *\n * Used to map from TypeScript code back into the assembly.\n */\n symbolId?: string;\n}\n\n/**\n * Kinds of collections.\n */\nexport enum CollectionKind {\n /**\n * An array, or a list of some element type.\n */\n Array = 'array',\n /**\n * A map of a string to some element type.\n */\n Map = 'map',\n}\n\n/**\n * Kinds of primitive types.\n */\nexport enum PrimitiveType {\n /**\n * A JSON date (represented as it's ISO-8601 string form).\n */\n Date = 'date',\n\n /**\n * A plain string.\n */\n String = 'string',\n\n /**\n * A number (integer or float).\n */\n Number = 'number',\n\n /**\n * A boolean value.\n */\n Boolean = 'boolean',\n\n /**\n * A JSON object\n */\n Json = 'json',\n\n /**\n * Value with \"any\" or \"unknown\" type (aka Object). Values typed `any` may\n * be `null` or `undefined`.\n */\n Any = 'any',\n}\n\n/**\n * A value that can possibly be optional.\n */\nexport interface OptionalValue {\n /**\n * Determines whether the value is, indeed, optional.\n *\n * @default false\n */\n optional?: boolean;\n\n /**\n * The declared type of the value, when it's present.\n */\n type: TypeReference;\n}\n\n/**\n * A reference to a type (primitive, collection or fqn).\n */\nexport type TypeReference =\n | NamedTypeReference\n | PrimitiveTypeReference\n | CollectionTypeReference\n | UnionTypeReference;\n\n/**\n * The standard representation of the `any` type (includes optionality marker).\n */\nexport const CANONICAL_ANY: Readonly = {\n primitive: PrimitiveType.Any,\n};\n\n/**\n * Reference to a named type, defined by this assembly or one of its\n * dependencies.\n */\nexport interface NamedTypeReference {\n /**\n * The fully-qualified-name of the type (can be located in the\n * ``spec.types[fqn]``` of the assembly that defines the type).\n */\n fqn: FQN;\n}\nexport function isNamedTypeReference(\n ref: TypeReference | undefined,\n): ref is NamedTypeReference {\n return !!(ref as NamedTypeReference)?.fqn;\n}\n\n/**\n * Reference to a primitive type.\n */\nexport interface PrimitiveTypeReference {\n /**\n * If this is a reference to a primitive type, this will include the\n * primitive type kind.\n */\n primitive: PrimitiveType;\n}\nexport function isPrimitiveTypeReference(\n ref: TypeReference | undefined,\n): ref is PrimitiveTypeReference {\n return !!(ref as PrimitiveTypeReference)?.primitive;\n}\n\n/**\n * Reference to a collection type.\n */\nexport interface CollectionTypeReference {\n collection: {\n /**\n * The kind of collection.\n */\n kind: CollectionKind;\n\n /**\n * The type of an element (map keys are always strings).\n */\n elementtype: TypeReference;\n };\n}\nexport function isCollectionTypeReference(\n ref: TypeReference | undefined,\n): ref is CollectionTypeReference {\n return !!(ref as CollectionTypeReference)?.collection;\n}\n\n/**\n * Reference to a union type.\n */\nexport interface UnionTypeReference {\n /**\n * Indicates that this is a union type, which means it can be one of a set\n * of types.\n */\n union: {\n /**\n * All the possible types (including the primary type).\n *\n * @minItems 2\n */\n types: TypeReference[];\n };\n}\nexport function isUnionTypeReference(\n ref: TypeReference | undefined,\n): ref is UnionTypeReference {\n return !!(ref as UnionTypeReference)?.union;\n}\n\n/**\n * Methods and properties can be overridden from parent classes or implemented\n * from interfaces.\n */\nexport interface Overridable {\n /**\n * The FQN of the parent type (class or interface) that this entity\n * overrides or implements. If undefined, then this entity is the first in\n * it's hierarchy to declare this entity.\n *\n * @default this member is not overriding anything\n */\n overrides?: FQN;\n}\n\n/**\n * A class property.\n */\nexport interface Property\n extends Documentable,\n OptionalValue,\n Overridable,\n SourceLocatable {\n /**\n * The name of the property.\n *\n * @minLength 1\n */\n name: string;\n\n /**\n * Indicates if this property only has a getter (immutable).\n *\n * @default false\n */\n immutable?: boolean;\n\n /**\n * Indicates if this property is protected (otherwise it is public)\n *\n * @default false\n */\n protected?: boolean;\n\n /**\n * Indicates if this property is abstract\n *\n * @default false\n */\n abstract?: boolean;\n\n /**\n * Indicates if this is a static property.\n *\n * @default false\n */\n static?: boolean;\n\n /**\n * A hint that indicates that this static, immutable property is initialized\n * during startup. This allows emitting \"const\" idioms in different target\n * languages. Implies `static` and `immutable`.\n *\n * @default false\n */\n const?: boolean;\n}\n\n/**\n * Represents a method parameter.\n */\nexport interface Parameter extends Documentable, OptionalValue {\n /**\n * The name of the parameter.\n *\n * @minLength 1\n */\n name: string;\n\n /**\n * Whether this is the last parameter of a variadic method. In such cases,\n * the `#type` attribute is the type of each individual item of the variadic\n * arguments list (as opposed to some array type, as for example TypeScript\n * would model it).\n *\n * @default false\n */\n variadic?: boolean;\n}\n\n/**\n * An Initializer or a Method.\n */\nexport interface Callable extends Documentable, Overridable, SourceLocatable {\n /**\n * The parameters of the Initializer or Method.\n *\n * @default none\n */\n parameters?: Parameter[];\n\n /**\n * Indicates if this Initializer or Method is protected (otherwise it is\n * public, since private members are not modeled).\n *\n * @default false\n */\n protected?: boolean;\n\n /**\n * Indicates whether this Initializer or Method is variadic or not. When\n * ``true``, the last element of ``#parameters`` will also be flagged\n * ``#variadic``.\n *\n * @default false\n */\n variadic?: boolean;\n}\n\n/**\n * An initializer.\n */\nexport type Initializer = Callable;\n\n/**\n * A method with a name (i.e: not an initializer).\n */\nexport interface Method extends Callable {\n /**\n * The name of the method. Undefined if this method is a initializer.\n */\n name: string;\n\n /**\n * The return type of the method (`undefined` if `void`)\n *\n * @default void\n */\n returns?: OptionalValue;\n\n /**\n * Is this method an abstract method (this means the class will also be an abstract class)\n *\n * @default false\n */\n abstract?: boolean;\n\n /**\n * Indicates if this is an asynchronous method (it will return a promise).\n *\n * @default false\n */\n async?: boolean;\n\n /**\n * Indicates if this is a static method.\n *\n * @default false\n */\n static?: boolean;\n}\n/**\n * Determines whether a Callable is a Method or not.\n *\n * @param callable the callable to be checked.\n */\nexport function isMethod(callable: Callable): callable is Method {\n return !!(callable as Method).name;\n}\n\n/**\n * Represents a type definition (not a type reference).\n */\nexport type Type = TypeBase & (ClassType | EnumType | InterfaceType);\n\n/**\n * Common attributes of a type definition.\n */\nexport interface TypeBase\n extends Documentable,\n SourceLocatable,\n TypeScriptLocatable {\n /**\n * The fully qualified name of the type (``..``)\n *\n * @minLength 3\n */\n fqn: FQN;\n\n /**\n * The name of the assembly the type belongs to.\n *\n * @minLength 1\n */\n assembly: string;\n\n /**\n * The namespace of the type (`foo.bar.baz`).\n *\n * When undefined, the type is located at the root of the assembly (its\n * `fqn` would be like `.`).\n *\n * For types inside other types or inside submodules, the `` corresponds to\n * the namespace-qualified name of the container (can contain multiple segments like:\n * `..`).\n *\n * In all cases:\n *\n * = [.].\n *\n * @default none\n */\n namespace?: string;\n\n /**\n * The simple name of the type (MyClass).\n *\n * @minLength 1\n */\n name: string;\n\n /**\n * The kind of the type.\n */\n kind: TypeKind;\n}\n\n/**\n * Kinds of types.\n */\nexport enum TypeKind {\n Class = 'class',\n Enum = 'enum',\n Interface = 'interface',\n}\n\n/**\n * Represents classes.\n */\nexport interface ClassType extends TypeBase {\n kind: TypeKind.Class;\n\n /**\n * The FQN of the base class of this class, if it has one.\n *\n * @default no base class\n */\n base?: FQN;\n\n /**\n * Initializer (constructor) method.\n *\n * @default no initializer\n */\n initializer?: Initializer;\n\n /**\n * List of properties.\n *\n * @default none\n */\n properties?: Property[];\n\n /**\n * List of methods.\n *\n * @default none\n */\n methods?: Method[];\n\n /**\n * Indicates if this class is an abstract class.\n *\n * @default false\n */\n abstract?: boolean;\n\n /**\n * The FQNs of the interfaces this class implements, if any.\n *\n * @default none\n * @uniqueItems true\n */\n interfaces?: FQN[];\n}\n\nexport function isClassType(type: Type | undefined): type is ClassType {\n return type?.kind === TypeKind.Class;\n}\n\nexport interface InterfaceType extends TypeBase {\n kind: TypeKind.Interface;\n\n /**\n * The FQNs of the interfaces this interface extends, if any.\n *\n * @default none\n * @uniqueItems true\n */\n interfaces?: FQN[];\n\n /**\n * List of methods.\n *\n * @default none\n */\n methods?: Method[];\n\n /**\n * List of properties.\n *\n * @default none\n */\n properties?: Property[];\n\n /**\n * True if this interface only contains properties. Different backends might\n * have idiomatic ways to allow defining concrete instances such interfaces.\n * For example, in Java, the generator will produce a PoJo and a builder\n * which will allow users to create a concrete object with data which\n * adheres to this interface.\n *\n * @default false\n */\n datatype?: boolean;\n}\n\nexport function isInterfaceType(type: Type | undefined): type is InterfaceType {\n return type?.kind === TypeKind.Interface;\n}\n\n/**\n * Represents a member of an enum.\n */\nexport interface EnumMember extends Documentable {\n /**\n * The name/symbol of the member.\n */\n name: string;\n}\n\n/**\n * Represents an enum type.\n */\nexport interface EnumType extends TypeBase {\n kind: TypeKind.Enum;\n\n /**\n * Members of the enum.\n */\n members: EnumMember[];\n}\n\nexport function isEnumType(type: Type | undefined): type is EnumType {\n return type?.kind === TypeKind.Enum;\n}\n\n/**\n * Return whether this type is a class or interface type\n */\nexport function isClassOrInterfaceType(\n type: Type | undefined,\n): type is InterfaceType | ClassType {\n return isClassType(type) || isInterfaceType(type);\n}\n\n/**\n * Return a string representation of the given type reference.\n */\nexport function describeTypeReference(type?: TypeReference): string {\n if (type === undefined) {\n return 'void';\n }\n\n if (isNamedTypeReference(type)) {\n return type.fqn;\n }\n\n if (isPrimitiveTypeReference(type)) {\n return type.primitive;\n }\n\n if (isCollectionTypeReference(type)) {\n return `${type.collection.kind}<${describeTypeReference(\n type.collection.elementtype,\n )}>`;\n }\n\n if (isUnionTypeReference(type)) {\n const unionType = type.union.types.map(describeTypeReference).join(' | ');\n return unionType;\n }\n\n throw new Error('Unrecognized type reference');\n}\n\n/**\n * Determines whether an entity is deprecated.\n *\n * @param entity the entity to be checked.\n *\n * @returns true if the entity is marked as deprecated.\n */\nexport function isDeprecated(entity: Documentable): boolean {\n return entity?.docs?.stability === Stability.Deprecated;\n}\n","export * from './assembly';\nexport * from './assembly-utils';\nexport * from './configuration';\nexport * from './name-tree';\nexport * from './redirect';\nexport * from './validate-assembly';\n","import * as spec from './assembly';\n\n/**\n * A tree of all names in a module. A node represent a type (terminal)\n * and may represent another node in the namespace (at the same time).\n * Therefore, a key of '_' represents a terminal and references the fqn\n * of the type.\n *\n * For example, say we have the following types:\n * - aws.ec2.Host\n * - aws.ec2.Instance\n * - aws.ec2.Instance.Subtype\n *\n * the the name tree will look like this:\n *\n * module: {\n * children: {\n * aws: {\n * children {\n * ec2: {\n * children: {\n * Host: {\n * fqn: 'aws.ec2.Host',\n * children: {}\n * },\n * Instance: {\n * fqn: 'aws.ec2.Host',\n * children: {\n * Subtype: {\n * fqn: 'aws.ec2.Host.Subtype',\n * children: {}\n * }\n * }\n * }\n * }\n * }\n * }\n * }\n * }\n * }\n */\nexport class NameTree {\n public static of(assm: spec.Assembly): NameTree {\n const nameTree = new NameTree();\n for (const type of Object.values(assm.types ?? {})) {\n nameTree.register(type.fqn);\n }\n return nameTree;\n }\n\n private _children: { [name: string]: NameTree } = {};\n private _fqn?: string;\n\n /* NameTree.of(assembly) should be used. */\n private constructor() {}\n\n /** The children of this node, by name. */\n public get children(): { readonly [name: string]: NameTree } {\n return this._children;\n }\n\n /** The fully qualified name of the type at this node, if there is one. */\n public get fqn(): string | undefined {\n return this._fqn;\n }\n\n /**\n * Adds a type to this ``NameTree``.\n *\n * @param type the type to be added.\n * @param path the path at which to add the node under this tree.\n */\n private register(fqn: string, path: string[] = fqn.split('.')): this {\n if (path.length === 0) {\n this._fqn = fqn;\n } else {\n const [head, ...rest] = path;\n if (!this._children[head]) {\n this._children[head] = new NameTree();\n }\n this._children[head].register(fqn, rest);\n }\n return this;\n }\n}\n","import Ajv from 'ajv';\n\n// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires\nexport const assemblyRedirectSchema = require('../schema/assembly-redirect.schema.json');\n\nconst SCHEMA = 'jsii/file-redirect';\n\nexport interface AssemblyRedirect {\n readonly schema: typeof SCHEMA;\n\n /**\n * The compression applied to the target file, if any.\n */\n readonly compression?: 'gzip';\n\n /**\n * The name of the file the assembly is redirected to.\n */\n readonly filename: string;\n}\n\n/**\n * Checks whether the provided value is an assembly redirect. This only checks\n * for presence of the correct value in the `schema` attribute. For full\n * validation, `validateAssemblyRedirect` should be used instead.\n *\n * @param obj the value to be tested.\n *\n * @returns `true` if the value is indeed an AssemblyRedirect.\n */\nexport function isAssemblyRedirect(obj: unknown): obj is AssemblyRedirect {\n if (typeof obj !== 'object' || obj == null) {\n return false;\n }\n return (obj as any).schema === SCHEMA;\n}\n\n/**\n * Validates the provided value as an assembly redirect.\n *\n * @param obj the value to be tested.\n *\n * @returns the validated value.\n */\nexport function validateAssemblyRedirect(obj: unknown): AssemblyRedirect {\n const ajv = new Ajv({\n allErrors: true,\n });\n const validate = ajv.compile(assemblyRedirectSchema);\n validate(obj);\n\n if (validate.errors) {\n throw new Error(\n `Invalid assembly redirect:\\n * ${ajv.errorsText(validate.errors, {\n separator: '\\n * ',\n dataVar: 'redirect',\n })}`,\n );\n }\n\n return obj as AssemblyRedirect;\n}\n","import Ajv from 'ajv';\n\nimport { Assembly } from './assembly';\n\n// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires\nexport const schema = require('../schema/jsii-spec.schema.json');\n\nexport function validateAssembly(obj: any): Assembly {\n const ajv = new Ajv({\n allErrors: true,\n });\n const validate = ajv.compile(schema);\n validate(obj);\n\n if (validate.errors) {\n let descr = '';\n if (typeof obj.name === 'string' && obj.name !== '') {\n descr =\n typeof obj.version === 'string'\n ? ` ${obj.name}@${obj.version}`\n : ` ${obj.name}`;\n }\n throw new Error(\n `Invalid assembly${descr}:\\n * ${ajv.errorsText(validate.errors, {\n separator: '\\n * ',\n dataVar: 'assembly',\n })}`,\n );\n }\n return obj;\n}\n","import type {AnySchemaObject} from \"./types\"\nimport AjvCore from \"./core\"\nimport draft7Vocabularies from \"./vocabularies/draft7\"\nimport discriminator from \"./vocabularies/discriminator\"\nimport * as draft7MetaSchema from \"./refs/json-schema-draft-07.json\"\n\nconst META_SUPPORT_DATA = [\"/properties\"]\n\nconst META_SCHEMA_ID = \"http://json-schema.org/draft-07/schema\"\n\nexport class Ajv extends AjvCore {\n _addVocabularies(): void {\n super._addVocabularies()\n draft7Vocabularies.forEach((v) => this.addVocabulary(v))\n if (this.opts.discriminator) this.addKeyword(discriminator)\n }\n\n _addDefaultMetaSchema(): void {\n super._addDefaultMetaSchema()\n if (!this.opts.meta) return\n const metaSchema = this.opts.$data\n ? this.$dataMetaSchema(draft7MetaSchema, META_SUPPORT_DATA)\n : draft7MetaSchema\n this.addMetaSchema(metaSchema, META_SCHEMA_ID, false)\n this.refs[\"http://json-schema.org/schema\"] = META_SCHEMA_ID\n }\n\n defaultMeta(): string | AnySchemaObject | undefined {\n return (this.opts.defaultMeta =\n super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined))\n }\n}\n\nmodule.exports = exports = Ajv\nmodule.exports.Ajv = Ajv\nObject.defineProperty(exports, \"__esModule\", {value: true})\n\nexport default Ajv\n\nexport {\n Format,\n FormatDefinition,\n AsyncFormatDefinition,\n KeywordDefinition,\n KeywordErrorDefinition,\n CodeKeywordDefinition,\n MacroKeywordDefinition,\n FuncKeywordDefinition,\n Vocabulary,\n Schema,\n SchemaObject,\n AnySchemaObject,\n AsyncSchema,\n AnySchema,\n ValidateFunction,\n AsyncValidateFunction,\n SchemaValidateFunction,\n ErrorObject,\n ErrorNoParams,\n} from \"./types\"\n\nexport {Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions} from \"./core\"\nexport {SchemaCxt, SchemaObjCxt} from \"./compile\"\nexport {KeywordCxt} from \"./compile/validate\"\nexport {DefinedError} from \"./vocabularies/errors\"\nexport {JSONType} from \"./compile/rules\"\nexport {JSONSchemaType} from \"./types/json-schema\"\nexport {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from \"./compile/codegen\"\nexport {default as ValidationError} from \"./runtime/validation_error\"\nexport {default as MissingRefError} from \"./compile/ref_error\"\n","// eslint-disable-next-line @typescript-eslint/no-extraneous-class\nexport abstract class _CodeOrName {\n abstract readonly str: string\n abstract readonly names: UsedNames\n abstract toString(): string\n abstract emptyStr(): boolean\n}\n\nexport const IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i\n\nexport class Name extends _CodeOrName {\n readonly str: string\n constructor(s: string) {\n super()\n if (!IDENTIFIER.test(s)) throw new Error(\"CodeGen: name must be a valid identifier\")\n this.str = s\n }\n\n toString(): string {\n return this.str\n }\n\n emptyStr(): boolean {\n return false\n }\n\n get names(): UsedNames {\n return {[this.str]: 1}\n }\n}\n\nexport class _Code extends _CodeOrName {\n readonly _items: readonly CodeItem[]\n private _str?: string\n private _names?: UsedNames\n\n constructor(code: string | readonly CodeItem[]) {\n super()\n this._items = typeof code === \"string\" ? [code] : code\n }\n\n toString(): string {\n return this.str\n }\n\n emptyStr(): boolean {\n if (this._items.length > 1) return false\n const item = this._items[0]\n return item === \"\" || item === '\"\"'\n }\n\n get str(): string {\n return (this._str ??= this._items.reduce((s: string, c: CodeItem) => `${s}${c}`, \"\"))\n }\n\n get names(): UsedNames {\n return (this._names ??= this._items.reduce((names: UsedNames, c) => {\n if (c instanceof Name) names[c.str] = (names[c.str] || 0) + 1\n return names\n }, {}))\n }\n}\n\nexport type CodeItem = Name | string | number | boolean | null\n\nexport type UsedNames = Record\n\nexport type Code = _Code | Name\n\nexport type SafeExpr = Code | number | boolean | null\n\nexport const nil = new _Code(\"\")\n\ntype CodeArg = SafeExpr | string | undefined\n\nexport function _(strs: TemplateStringsArray, ...args: CodeArg[]): _Code {\n const code: CodeItem[] = [strs[0]]\n let i = 0\n while (i < args.length) {\n addCodeArg(code, args[i])\n code.push(strs[++i])\n }\n return new _Code(code)\n}\n\nconst plus = new _Code(\"+\")\n\nexport function str(strs: TemplateStringsArray, ...args: (CodeArg | string[])[]): _Code {\n const expr: CodeItem[] = [safeStringify(strs[0])]\n let i = 0\n while (i < args.length) {\n expr.push(plus)\n addCodeArg(expr, args[i])\n expr.push(plus, safeStringify(strs[++i]))\n }\n optimize(expr)\n return new _Code(expr)\n}\n\nexport function addCodeArg(code: CodeItem[], arg: CodeArg | string[]): void {\n if (arg instanceof _Code) code.push(...arg._items)\n else if (arg instanceof Name) code.push(arg)\n else code.push(interpolate(arg))\n}\n\nfunction optimize(expr: CodeItem[]): void {\n let i = 1\n while (i < expr.length - 1) {\n if (expr[i] === plus) {\n const res = mergeExprItems(expr[i - 1], expr[i + 1])\n if (res !== undefined) {\n expr.splice(i - 1, 3, res)\n continue\n }\n expr[i++] = \"+\"\n }\n i++\n }\n}\n\nfunction mergeExprItems(a: CodeItem, b: CodeItem): CodeItem | undefined {\n if (b === '\"\"') return a\n if (a === '\"\"') return b\n if (typeof a == \"string\") {\n if (b instanceof Name || a[a.length - 1] !== '\"') return\n if (typeof b != \"string\") return `${a.slice(0, -1)}${b}\"`\n if (b[0] === '\"') return a.slice(0, -1) + b.slice(1)\n return\n }\n if (typeof b == \"string\" && b[0] === '\"' && !(a instanceof Name)) return `\"${a}${b.slice(1)}`\n return\n}\n\nexport function strConcat(c1: Code, c2: Code): Code {\n return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str`${c1}${c2}`\n}\n\n// TODO do not allow arrays here\nfunction interpolate(x?: string | string[] | number | boolean | null): SafeExpr | string {\n return typeof x == \"number\" || typeof x == \"boolean\" || x === null\n ? x\n : safeStringify(Array.isArray(x) ? x.join(\",\") : x)\n}\n\nexport function stringify(x: unknown): Code {\n return new _Code(safeStringify(x))\n}\n\nexport function safeStringify(x: unknown): string {\n return JSON.stringify(x)\n .replace(/\\u2028/g, \"\\\\u2028\")\n .replace(/\\u2029/g, \"\\\\u2029\")\n}\n\nexport function getProperty(key: Code | string | number): Code {\n return typeof key == \"string\" && IDENTIFIER.test(key) ? new _Code(`.${key}`) : _`[${key}]`\n}\n\n//Does best effort to format the name properly\nexport function getEsmExportName(key: Code | string | number): Code {\n if (typeof key == \"string\" && IDENTIFIER.test(key)) {\n return new _Code(`${key}`)\n }\n throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`)\n}\n\nexport function regexpCode(rx: RegExp): Code {\n return new _Code(rx.toString())\n}\n","import type {ScopeValueSets, NameValue, ValueScope, ValueScopeName} from \"./scope\"\nimport {_, nil, _Code, Code, Name, UsedNames, CodeItem, addCodeArg, _CodeOrName} from \"./code\"\nimport {Scope, varKinds} from \"./scope\"\n\nexport {_, str, strConcat, nil, getProperty, stringify, regexpCode, Name, Code} from \"./code\"\nexport {Scope, ScopeStore, ValueScope, ValueScopeName, ScopeValueSets, varKinds} from \"./scope\"\n\n// type for expressions that can be safely inserted in code without quotes\nexport type SafeExpr = Code | number | boolean | null\n\n// type that is either Code of function that adds code to CodeGen instance using its methods\nexport type Block = Code | (() => void)\n\nexport const operators = {\n GT: new _Code(\">\"),\n GTE: new _Code(\">=\"),\n LT: new _Code(\"<\"),\n LTE: new _Code(\"<=\"),\n EQ: new _Code(\"===\"),\n NEQ: new _Code(\"!==\"),\n NOT: new _Code(\"!\"),\n OR: new _Code(\"||\"),\n AND: new _Code(\"&&\"),\n ADD: new _Code(\"+\"),\n}\n\nabstract class Node {\n abstract readonly names: UsedNames\n\n optimizeNodes(): this | ChildNode | ChildNode[] | undefined {\n return this\n }\n\n optimizeNames(_names: UsedNames, _constants: Constants): this | undefined {\n return this\n }\n\n // get count(): number {\n // return 1\n // }\n}\n\nclass Def extends Node {\n constructor(\n private readonly varKind: Name,\n private readonly name: Name,\n private rhs?: SafeExpr\n ) {\n super()\n }\n\n render({es5, _n}: CGOptions): string {\n const varKind = es5 ? varKinds.var : this.varKind\n const rhs = this.rhs === undefined ? \"\" : ` = ${this.rhs}`\n return `${varKind} ${this.name}${rhs};` + _n\n }\n\n optimizeNames(names: UsedNames, constants: Constants): this | undefined {\n if (!names[this.name.str]) return\n if (this.rhs) this.rhs = optimizeExpr(this.rhs, names, constants)\n return this\n }\n\n get names(): UsedNames {\n return this.rhs instanceof _CodeOrName ? this.rhs.names : {}\n }\n}\n\nclass Assign extends Node {\n constructor(\n readonly lhs: Code,\n public rhs: SafeExpr,\n private readonly sideEffects?: boolean\n ) {\n super()\n }\n\n render({_n}: CGOptions): string {\n return `${this.lhs} = ${this.rhs};` + _n\n }\n\n optimizeNames(names: UsedNames, constants: Constants): this | undefined {\n if (this.lhs instanceof Name && !names[this.lhs.str] && !this.sideEffects) return\n this.rhs = optimizeExpr(this.rhs, names, constants)\n return this\n }\n\n get names(): UsedNames {\n const names = this.lhs instanceof Name ? {} : {...this.lhs.names}\n return addExprNames(names, this.rhs)\n }\n}\n\nclass AssignOp extends Assign {\n constructor(\n lhs: Code,\n private readonly op: Code,\n rhs: SafeExpr,\n sideEffects?: boolean\n ) {\n super(lhs, rhs, sideEffects)\n }\n\n render({_n}: CGOptions): string {\n return `${this.lhs} ${this.op}= ${this.rhs};` + _n\n }\n}\n\nclass Label extends Node {\n readonly names: UsedNames = {}\n constructor(readonly label: Name) {\n super()\n }\n\n render({_n}: CGOptions): string {\n return `${this.label}:` + _n\n }\n}\n\nclass Break extends Node {\n readonly names: UsedNames = {}\n constructor(readonly label?: Code) {\n super()\n }\n\n render({_n}: CGOptions): string {\n const label = this.label ? ` ${this.label}` : \"\"\n return `break${label};` + _n\n }\n}\n\nclass Throw extends Node {\n constructor(readonly error: Code) {\n super()\n }\n\n render({_n}: CGOptions): string {\n return `throw ${this.error};` + _n\n }\n\n get names(): UsedNames {\n return this.error.names\n }\n}\n\nclass AnyCode extends Node {\n constructor(private code: SafeExpr) {\n super()\n }\n\n render({_n}: CGOptions): string {\n return `${this.code};` + _n\n }\n\n optimizeNodes(): this | undefined {\n return `${this.code}` ? this : undefined\n }\n\n optimizeNames(names: UsedNames, constants: Constants): this {\n this.code = optimizeExpr(this.code, names, constants)\n return this\n }\n\n get names(): UsedNames {\n return this.code instanceof _CodeOrName ? this.code.names : {}\n }\n}\n\nabstract class ParentNode extends Node {\n constructor(readonly nodes: ChildNode[] = []) {\n super()\n }\n\n render(opts: CGOptions): string {\n return this.nodes.reduce((code, n) => code + n.render(opts), \"\")\n }\n\n optimizeNodes(): this | ChildNode | ChildNode[] | undefined {\n const {nodes} = this\n let i = nodes.length\n while (i--) {\n const n = nodes[i].optimizeNodes()\n if (Array.isArray(n)) nodes.splice(i, 1, ...n)\n else if (n) nodes[i] = n\n else nodes.splice(i, 1)\n }\n return nodes.length > 0 ? this : undefined\n }\n\n optimizeNames(names: UsedNames, constants: Constants): this | undefined {\n const {nodes} = this\n let i = nodes.length\n while (i--) {\n // iterating backwards improves 1-pass optimization\n const n = nodes[i]\n if (n.optimizeNames(names, constants)) continue\n subtractNames(names, n.names)\n nodes.splice(i, 1)\n }\n return nodes.length > 0 ? this : undefined\n }\n\n get names(): UsedNames {\n return this.nodes.reduce((names: UsedNames, n) => addNames(names, n.names), {})\n }\n\n // get count(): number {\n // return this.nodes.reduce((c, n) => c + n.count, 1)\n // }\n}\n\nabstract class BlockNode extends ParentNode {\n render(opts: CGOptions): string {\n return \"{\" + opts._n + super.render(opts) + \"}\" + opts._n\n }\n}\n\nclass Root extends ParentNode {}\n\nclass Else extends BlockNode {\n static readonly kind = \"else\"\n}\n\nclass If extends BlockNode {\n static readonly kind = \"if\"\n else?: If | Else\n constructor(\n private condition: Code | boolean,\n nodes?: ChildNode[]\n ) {\n super(nodes)\n }\n\n render(opts: CGOptions): string {\n let code = `if(${this.condition})` + super.render(opts)\n if (this.else) code += \"else \" + this.else.render(opts)\n return code\n }\n\n optimizeNodes(): If | ChildNode[] | undefined {\n super.optimizeNodes()\n const cond = this.condition\n if (cond === true) return this.nodes // else is ignored here\n let e = this.else\n if (e) {\n const ns = e.optimizeNodes()\n e = this.else = Array.isArray(ns) ? new Else(ns) : (ns as Else | undefined)\n }\n if (e) {\n if (cond === false) return e instanceof If ? e : e.nodes\n if (this.nodes.length) return this\n return new If(not(cond), e instanceof If ? [e] : e.nodes)\n }\n if (cond === false || !this.nodes.length) return undefined\n return this\n }\n\n optimizeNames(names: UsedNames, constants: Constants): this | undefined {\n this.else = this.else?.optimizeNames(names, constants)\n if (!(super.optimizeNames(names, constants) || this.else)) return\n this.condition = optimizeExpr(this.condition, names, constants)\n return this\n }\n\n get names(): UsedNames {\n const names = super.names\n addExprNames(names, this.condition)\n if (this.else) addNames(names, this.else.names)\n return names\n }\n\n // get count(): number {\n // return super.count + (this.else?.count || 0)\n // }\n}\n\nabstract class For extends BlockNode {\n static readonly kind = \"for\"\n}\n\nclass ForLoop extends For {\n constructor(private iteration: Code) {\n super()\n }\n\n render(opts: CGOptions): string {\n return `for(${this.iteration})` + super.render(opts)\n }\n\n optimizeNames(names: UsedNames, constants: Constants): this | undefined {\n if (!super.optimizeNames(names, constants)) return\n this.iteration = optimizeExpr(this.iteration, names, constants)\n return this\n }\n\n get names(): UsedNames {\n return addNames(super.names, this.iteration.names)\n }\n}\n\nclass ForRange extends For {\n constructor(\n private readonly varKind: Name,\n private readonly name: Name,\n private readonly from: SafeExpr,\n private readonly to: SafeExpr\n ) {\n super()\n }\n\n render(opts: CGOptions): string {\n const varKind = opts.es5 ? varKinds.var : this.varKind\n const {name, from, to} = this\n return `for(${varKind} ${name}=${from}; ${name}<${to}; ${name}++)` + super.render(opts)\n }\n\n get names(): UsedNames {\n const names = addExprNames(super.names, this.from)\n return addExprNames(names, this.to)\n }\n}\n\nclass ForIter extends For {\n constructor(\n private readonly loop: \"of\" | \"in\",\n private readonly varKind: Name,\n private readonly name: Name,\n private iterable: Code\n ) {\n super()\n }\n\n render(opts: CGOptions): string {\n return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts)\n }\n\n optimizeNames(names: UsedNames, constants: Constants): this | undefined {\n if (!super.optimizeNames(names, constants)) return\n this.iterable = optimizeExpr(this.iterable, names, constants)\n return this\n }\n\n get names(): UsedNames {\n return addNames(super.names, this.iterable.names)\n }\n}\n\nclass Func extends BlockNode {\n static readonly kind = \"func\"\n constructor(\n public name: Name,\n public args: Code,\n public async?: boolean\n ) {\n super()\n }\n\n render(opts: CGOptions): string {\n const _async = this.async ? \"async \" : \"\"\n return `${_async}function ${this.name}(${this.args})` + super.render(opts)\n }\n}\n\nclass Return extends ParentNode {\n static readonly kind = \"return\"\n\n render(opts: CGOptions): string {\n return \"return \" + super.render(opts)\n }\n}\n\nclass Try extends BlockNode {\n catch?: Catch\n finally?: Finally\n\n render(opts: CGOptions): string {\n let code = \"try\" + super.render(opts)\n if (this.catch) code += this.catch.render(opts)\n if (this.finally) code += this.finally.render(opts)\n return code\n }\n\n optimizeNodes(): this {\n super.optimizeNodes()\n this.catch?.optimizeNodes() as Catch | undefined\n this.finally?.optimizeNodes() as Finally | undefined\n return this\n }\n\n optimizeNames(names: UsedNames, constants: Constants): this {\n super.optimizeNames(names, constants)\n this.catch?.optimizeNames(names, constants)\n this.finally?.optimizeNames(names, constants)\n return this\n }\n\n get names(): UsedNames {\n const names = super.names\n if (this.catch) addNames(names, this.catch.names)\n if (this.finally) addNames(names, this.finally.names)\n return names\n }\n\n // get count(): number {\n // return super.count + (this.catch?.count || 0) + (this.finally?.count || 0)\n // }\n}\n\nclass Catch extends BlockNode {\n static readonly kind = \"catch\"\n constructor(readonly error: Name) {\n super()\n }\n\n render(opts: CGOptions): string {\n return `catch(${this.error})` + super.render(opts)\n }\n}\n\nclass Finally extends BlockNode {\n static readonly kind = \"finally\"\n render(opts: CGOptions): string {\n return \"finally\" + super.render(opts)\n }\n}\n\ntype StartBlockNode = If | For | Func | Return | Try\n\ntype LeafNode = Def | Assign | Label | Break | Throw | AnyCode\n\ntype ChildNode = StartBlockNode | LeafNode\n\ntype EndBlockNodeType =\n | typeof If\n | typeof Else\n | typeof For\n | typeof Func\n | typeof Return\n | typeof Catch\n | typeof Finally\n\ntype Constants = Record\n\nexport interface CodeGenOptions {\n es5?: boolean\n lines?: boolean\n ownProperties?: boolean\n}\n\ninterface CGOptions extends CodeGenOptions {\n _n: \"\\n\" | \"\"\n}\n\nexport class CodeGen {\n readonly _scope: Scope\n readonly _extScope: ValueScope\n readonly _values: ScopeValueSets = {}\n private readonly _nodes: ParentNode[]\n private readonly _blockStarts: number[] = []\n private readonly _constants: Constants = {}\n private readonly opts: CGOptions\n\n constructor(extScope: ValueScope, opts: CodeGenOptions = {}) {\n this.opts = {...opts, _n: opts.lines ? \"\\n\" : \"\"}\n this._extScope = extScope\n this._scope = new Scope({parent: extScope})\n this._nodes = [new Root()]\n }\n\n toString(): string {\n return this._root.render(this.opts)\n }\n\n // returns unique name in the internal scope\n name(prefix: string): Name {\n return this._scope.name(prefix)\n }\n\n // reserves unique name in the external scope\n scopeName(prefix: string): ValueScopeName {\n return this._extScope.name(prefix)\n }\n\n // reserves unique name in the external scope and assigns value to it\n scopeValue(prefixOrName: ValueScopeName | string, value: NameValue): Name {\n const name = this._extScope.value(prefixOrName, value)\n const vs = this._values[name.prefix] || (this._values[name.prefix] = new Set())\n vs.add(name)\n return name\n }\n\n getScopeValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined {\n return this._extScope.getValue(prefix, keyOrRef)\n }\n\n // return code that assigns values in the external scope to the names that are used internally\n // (same names that were returned by gen.scopeName or gen.scopeValue)\n scopeRefs(scopeName: Name): Code {\n return this._extScope.scopeRefs(scopeName, this._values)\n }\n\n scopeCode(): Code {\n return this._extScope.scopeCode(this._values)\n }\n\n private _def(\n varKind: Name,\n nameOrPrefix: Name | string,\n rhs?: SafeExpr,\n constant?: boolean\n ): Name {\n const name = this._scope.toName(nameOrPrefix)\n if (rhs !== undefined && constant) this._constants[name.str] = rhs\n this._leafNode(new Def(varKind, name, rhs))\n return name\n }\n\n // `const` declaration (`var` in es5 mode)\n const(nameOrPrefix: Name | string, rhs: SafeExpr, _constant?: boolean): Name {\n return this._def(varKinds.const, nameOrPrefix, rhs, _constant)\n }\n\n // `let` declaration with optional assignment (`var` in es5 mode)\n let(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name {\n return this._def(varKinds.let, nameOrPrefix, rhs, _constant)\n }\n\n // `var` declaration with optional assignment\n var(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name {\n return this._def(varKinds.var, nameOrPrefix, rhs, _constant)\n }\n\n // assignment code\n assign(lhs: Code, rhs: SafeExpr, sideEffects?: boolean): CodeGen {\n return this._leafNode(new Assign(lhs, rhs, sideEffects))\n }\n\n // `+=` code\n add(lhs: Code, rhs: SafeExpr): CodeGen {\n return this._leafNode(new AssignOp(lhs, operators.ADD, rhs))\n }\n\n // appends passed SafeExpr to code or executes Block\n code(c: Block | SafeExpr): CodeGen {\n if (typeof c == \"function\") c()\n else if (c !== nil) this._leafNode(new AnyCode(c))\n return this\n }\n\n // returns code for object literal for the passed argument list of key-value pairs\n object(...keyValues: [Name | string, SafeExpr | string][]): _Code {\n const code: CodeItem[] = [\"{\"]\n for (const [key, value] of keyValues) {\n if (code.length > 1) code.push(\",\")\n code.push(key)\n if (key !== value || this.opts.es5) {\n code.push(\":\")\n addCodeArg(code, value)\n }\n }\n code.push(\"}\")\n return new _Code(code)\n }\n\n // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)\n if(condition: Code | boolean, thenBody?: Block, elseBody?: Block): CodeGen {\n this._blockNode(new If(condition))\n\n if (thenBody && elseBody) {\n this.code(thenBody).else().code(elseBody).endIf()\n } else if (thenBody) {\n this.code(thenBody).endIf()\n } else if (elseBody) {\n throw new Error('CodeGen: \"else\" body without \"then\" body')\n }\n return this\n }\n\n // `else if` clause - invalid without `if` or after `else` clauses\n elseIf(condition: Code | boolean): CodeGen {\n return this._elseNode(new If(condition))\n }\n\n // `else` clause - only valid after `if` or `else if` clauses\n else(): CodeGen {\n return this._elseNode(new Else())\n }\n\n // end `if` statement (needed if gen.if was used only with condition)\n endIf(): CodeGen {\n return this._endBlockNode(If, Else)\n }\n\n private _for(node: For, forBody?: Block): CodeGen {\n this._blockNode(node)\n if (forBody) this.code(forBody).endFor()\n return this\n }\n\n // a generic `for` clause (or statement if `forBody` is passed)\n for(iteration: Code, forBody?: Block): CodeGen {\n return this._for(new ForLoop(iteration), forBody)\n }\n\n // `for` statement for a range of values\n forRange(\n nameOrPrefix: Name | string,\n from: SafeExpr,\n to: SafeExpr,\n forBody: (index: Name) => void,\n varKind: Code = this.opts.es5 ? varKinds.var : varKinds.let\n ): CodeGen {\n const name = this._scope.toName(nameOrPrefix)\n return this._for(new ForRange(varKind, name, from, to), () => forBody(name))\n }\n\n // `for-of` statement (in es5 mode replace with a normal for loop)\n forOf(\n nameOrPrefix: Name | string,\n iterable: Code,\n forBody: (item: Name) => void,\n varKind: Code = varKinds.const\n ): CodeGen {\n const name = this._scope.toName(nameOrPrefix)\n if (this.opts.es5) {\n const arr = iterable instanceof Name ? iterable : this.var(\"_arr\", iterable)\n return this.forRange(\"_i\", 0, _`${arr}.length`, (i) => {\n this.var(name, _`${arr}[${i}]`)\n forBody(name)\n })\n }\n return this._for(new ForIter(\"of\", varKind, name, iterable), () => forBody(name))\n }\n\n // `for-in` statement.\n // With option `ownProperties` replaced with a `for-of` loop for object keys\n forIn(\n nameOrPrefix: Name | string,\n obj: Code,\n forBody: (item: Name) => void,\n varKind: Code = this.opts.es5 ? varKinds.var : varKinds.const\n ): CodeGen {\n if (this.opts.ownProperties) {\n return this.forOf(nameOrPrefix, _`Object.keys(${obj})`, forBody)\n }\n const name = this._scope.toName(nameOrPrefix)\n return this._for(new ForIter(\"in\", varKind, name, obj), () => forBody(name))\n }\n\n // end `for` loop\n endFor(): CodeGen {\n return this._endBlockNode(For)\n }\n\n // `label` statement\n label(label: Name): CodeGen {\n return this._leafNode(new Label(label))\n }\n\n // `break` statement\n break(label?: Code): CodeGen {\n return this._leafNode(new Break(label))\n }\n\n // `return` statement\n return(value: Block | SafeExpr): CodeGen {\n const node = new Return()\n this._blockNode(node)\n this.code(value)\n if (node.nodes.length !== 1) throw new Error('CodeGen: \"return\" should have one node')\n return this._endBlockNode(Return)\n }\n\n // `try` statement\n try(tryBody: Block, catchCode?: (e: Name) => void, finallyCode?: Block): CodeGen {\n if (!catchCode && !finallyCode) throw new Error('CodeGen: \"try\" without \"catch\" and \"finally\"')\n const node = new Try()\n this._blockNode(node)\n this.code(tryBody)\n if (catchCode) {\n const error = this.name(\"e\")\n this._currNode = node.catch = new Catch(error)\n catchCode(error)\n }\n if (finallyCode) {\n this._currNode = node.finally = new Finally()\n this.code(finallyCode)\n }\n return this._endBlockNode(Catch, Finally)\n }\n\n // `throw` statement\n throw(error: Code): CodeGen {\n return this._leafNode(new Throw(error))\n }\n\n // start self-balancing block\n block(body?: Block, nodeCount?: number): CodeGen {\n this._blockStarts.push(this._nodes.length)\n if (body) this.code(body).endBlock(nodeCount)\n return this\n }\n\n // end the current self-balancing block\n endBlock(nodeCount?: number): CodeGen {\n const len = this._blockStarts.pop()\n if (len === undefined) throw new Error(\"CodeGen: not in self-balancing block\")\n const toClose = this._nodes.length - len\n if (toClose < 0 || (nodeCount !== undefined && toClose !== nodeCount)) {\n throw new Error(`CodeGen: wrong number of nodes: ${toClose} vs ${nodeCount} expected`)\n }\n this._nodes.length = len\n return this\n }\n\n // `function` heading (or definition if funcBody is passed)\n func(name: Name, args: Code = nil, async?: boolean, funcBody?: Block): CodeGen {\n this._blockNode(new Func(name, args, async))\n if (funcBody) this.code(funcBody).endFunc()\n return this\n }\n\n // end function definition\n endFunc(): CodeGen {\n return this._endBlockNode(Func)\n }\n\n optimize(n = 1): void {\n while (n-- > 0) {\n this._root.optimizeNodes()\n this._root.optimizeNames(this._root.names, this._constants)\n }\n }\n\n private _leafNode(node: LeafNode): CodeGen {\n this._currNode.nodes.push(node)\n return this\n }\n\n private _blockNode(node: StartBlockNode): void {\n this._currNode.nodes.push(node)\n this._nodes.push(node)\n }\n\n private _endBlockNode(N1: EndBlockNodeType, N2?: EndBlockNodeType): CodeGen {\n const n = this._currNode\n if (n instanceof N1 || (N2 && n instanceof N2)) {\n this._nodes.pop()\n return this\n }\n throw new Error(`CodeGen: not in block \"${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}\"`)\n }\n\n private _elseNode(node: If | Else): CodeGen {\n const n = this._currNode\n if (!(n instanceof If)) {\n throw new Error('CodeGen: \"else\" without \"if\"')\n }\n this._currNode = n.else = node\n return this\n }\n\n private get _root(): Root {\n return this._nodes[0] as Root\n }\n\n private get _currNode(): ParentNode {\n const ns = this._nodes\n return ns[ns.length - 1]\n }\n\n private set _currNode(node: ParentNode) {\n const ns = this._nodes\n ns[ns.length - 1] = node\n }\n\n // get nodeCount(): number {\n // return this._root.count\n // }\n}\n\nfunction addNames(names: UsedNames, from: UsedNames): UsedNames {\n for (const n in from) names[n] = (names[n] || 0) + (from[n] || 0)\n return names\n}\n\nfunction addExprNames(names: UsedNames, from: SafeExpr): UsedNames {\n return from instanceof _CodeOrName ? addNames(names, from.names) : names\n}\n\nfunction optimizeExpr(expr: T, names: UsedNames, constants: Constants): T\nfunction optimizeExpr(expr: SafeExpr, names: UsedNames, constants: Constants): SafeExpr {\n if (expr instanceof Name) return replaceName(expr)\n if (!canOptimize(expr)) return expr\n return new _Code(\n expr._items.reduce((items: CodeItem[], c: SafeExpr | string) => {\n if (c instanceof Name) c = replaceName(c)\n if (c instanceof _Code) items.push(...c._items)\n else items.push(c)\n return items\n }, [])\n )\n\n function replaceName(n: Name): SafeExpr {\n const c = constants[n.str]\n if (c === undefined || names[n.str] !== 1) return n\n delete names[n.str]\n return c\n }\n\n function canOptimize(e: SafeExpr): e is _Code {\n return (\n e instanceof _Code &&\n e._items.some(\n (c) => c instanceof Name && names[c.str] === 1 && constants[c.str] !== undefined\n )\n )\n }\n}\n\nfunction subtractNames(names: UsedNames, from: UsedNames): void {\n for (const n in from) names[n] = (names[n] || 0) - (from[n] || 0)\n}\n\nexport function not(x: T): T\nexport function not(x: Code | SafeExpr): Code | SafeExpr {\n return typeof x == \"boolean\" || typeof x == \"number\" || x === null ? !x : _`!${par(x)}`\n}\n\nconst andCode = mappend(operators.AND)\n\n// boolean AND (&&) expression with the passed arguments\nexport function and(...args: Code[]): Code {\n return args.reduce(andCode)\n}\n\nconst orCode = mappend(operators.OR)\n\n// boolean OR (||) expression with the passed arguments\nexport function or(...args: Code[]): Code {\n return args.reduce(orCode)\n}\n\ntype MAppend = (x: Code, y: Code) => Code\n\nfunction mappend(op: Code): MAppend {\n return (x, y) => (x === nil ? y : y === nil ? x : _`${par(x)} ${op} ${par(y)}`)\n}\n\nfunction par(x: Code): Code {\n return x instanceof Name ? x : _`(${x})`\n}\n","import {_, nil, Code, Name} from \"./code\"\n\ninterface NameGroup {\n prefix: string\n index: number\n}\n\nexport interface NameValue {\n ref: ValueReference // this is the reference to any value that can be referred to from generated code via `globals` var in the closure\n key?: unknown // any key to identify a global to avoid duplicates, if not passed ref is used\n code?: Code // this is the code creating the value needed for standalone code wit_out closure - can be a primitive value, function or import (`require`)\n}\n\nexport type ValueReference = unknown // possibly make CodeGen parameterized type on this type\n\nclass ValueError extends Error {\n readonly value?: NameValue\n constructor(name: ValueScopeName) {\n super(`CodeGen: \"code\" for ${name} not defined`)\n this.value = name.value\n }\n}\n\ninterface ScopeOptions {\n prefixes?: Set\n parent?: Scope\n}\n\ninterface ValueScopeOptions extends ScopeOptions {\n scope: ScopeStore\n es5?: boolean\n lines?: boolean\n}\n\nexport type ScopeStore = Record\n\ntype ScopeValues = {\n [Prefix in string]?: Map\n}\n\nexport type ScopeValueSets = {\n [Prefix in string]?: Set\n}\n\nexport enum UsedValueState {\n Started,\n Completed,\n}\n\nexport type UsedScopeValues = {\n [Prefix in string]?: Map\n}\n\nexport const varKinds = {\n const: new Name(\"const\"),\n let: new Name(\"let\"),\n var: new Name(\"var\"),\n}\n\nexport class Scope {\n protected readonly _names: {[Prefix in string]?: NameGroup} = {}\n protected readonly _prefixes?: Set\n protected readonly _parent?: Scope\n\n constructor({prefixes, parent}: ScopeOptions = {}) {\n this._prefixes = prefixes\n this._parent = parent\n }\n\n toName(nameOrPrefix: Name | string): Name {\n return nameOrPrefix instanceof Name ? nameOrPrefix : this.name(nameOrPrefix)\n }\n\n name(prefix: string): Name {\n return new Name(this._newName(prefix))\n }\n\n protected _newName(prefix: string): string {\n const ng = this._names[prefix] || this._nameGroup(prefix)\n return `${prefix}${ng.index++}`\n }\n\n private _nameGroup(prefix: string): NameGroup {\n if (this._parent?._prefixes?.has(prefix) || (this._prefixes && !this._prefixes.has(prefix))) {\n throw new Error(`CodeGen: prefix \"${prefix}\" is not allowed in this scope`)\n }\n return (this._names[prefix] = {prefix, index: 0})\n }\n}\n\ninterface ScopePath {\n property: string\n itemIndex: number\n}\n\nexport class ValueScopeName extends Name {\n readonly prefix: string\n value?: NameValue\n scopePath?: Code\n\n constructor(prefix: string, nameStr: string) {\n super(nameStr)\n this.prefix = prefix\n }\n\n setValue(value: NameValue, {property, itemIndex}: ScopePath): void {\n this.value = value\n this.scopePath = _`.${new Name(property)}[${itemIndex}]`\n }\n}\n\ninterface VSOptions extends ValueScopeOptions {\n _n: Code\n}\n\nconst line = _`\\n`\n\nexport class ValueScope extends Scope {\n protected readonly _values: ScopeValues = {}\n protected readonly _scope: ScopeStore\n readonly opts: VSOptions\n\n constructor(opts: ValueScopeOptions) {\n super(opts)\n this._scope = opts.scope\n this.opts = {...opts, _n: opts.lines ? line : nil}\n }\n\n get(): ScopeStore {\n return this._scope\n }\n\n name(prefix: string): ValueScopeName {\n return new ValueScopeName(prefix, this._newName(prefix))\n }\n\n value(nameOrPrefix: ValueScopeName | string, value: NameValue): ValueScopeName {\n if (value.ref === undefined) throw new Error(\"CodeGen: ref must be passed in value\")\n const name = this.toName(nameOrPrefix) as ValueScopeName\n const {prefix} = name\n const valueKey = value.key ?? value.ref\n let vs = this._values[prefix]\n if (vs) {\n const _name = vs.get(valueKey)\n if (_name) return _name\n } else {\n vs = this._values[prefix] = new Map()\n }\n vs.set(valueKey, name)\n\n const s = this._scope[prefix] || (this._scope[prefix] = [])\n const itemIndex = s.length\n s[itemIndex] = value.ref\n name.setValue(value, {property: prefix, itemIndex})\n return name\n }\n\n getValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined {\n const vs = this._values[prefix]\n if (!vs) return\n return vs.get(keyOrRef)\n }\n\n scopeRefs(scopeName: Name, values: ScopeValues | ScopeValueSets = this._values): Code {\n return this._reduceValues(values, (name: ValueScopeName) => {\n if (name.scopePath === undefined) throw new Error(`CodeGen: name \"${name}\" has no value`)\n return _`${scopeName}${name.scopePath}`\n })\n }\n\n scopeCode(\n values: ScopeValues | ScopeValueSets = this._values,\n usedValues?: UsedScopeValues,\n getCode?: (n: ValueScopeName) => Code | undefined\n ): Code {\n return this._reduceValues(\n values,\n (name: ValueScopeName) => {\n if (name.value === undefined) throw new Error(`CodeGen: name \"${name}\" has no value`)\n return name.value.code\n },\n usedValues,\n getCode\n )\n }\n\n private _reduceValues(\n values: ScopeValues | ScopeValueSets,\n valueCode: (n: ValueScopeName) => Code | undefined,\n usedValues: UsedScopeValues = {},\n getCode?: (n: ValueScopeName) => Code | undefined\n ): Code {\n let code: Code = nil\n for (const prefix in values) {\n const vs = values[prefix]\n if (!vs) continue\n const nameSet = (usedValues[prefix] = usedValues[prefix] || new Map())\n vs.forEach((name: ValueScopeName) => {\n if (nameSet.has(name)) return\n nameSet.set(name, UsedValueState.Started)\n let c = valueCode(name)\n if (c) {\n const def = this.opts.es5 ? varKinds.var : varKinds.const\n code = _`${code}${def} ${name} = ${c};${this.opts._n}`\n } else if ((c = getCode?.(name))) {\n code = _`${code}${c}${this.opts._n}`\n } else {\n throw new ValueError(name)\n }\n nameSet.set(name, UsedValueState.Completed)\n })\n }\n return code\n }\n}\n","import type {KeywordErrorCxt, KeywordErrorDefinition} from \"../types\"\nimport type {SchemaCxt} from \"./index\"\nimport {CodeGen, _, str, strConcat, Code, Name} from \"./codegen\"\nimport {SafeExpr} from \"./codegen/code\"\nimport {getErrorPath, Type} from \"./util\"\nimport N from \"./names\"\n\nexport const keywordError: KeywordErrorDefinition = {\n message: ({keyword}) => str`must pass \"${keyword}\" keyword validation`,\n}\n\nexport const keyword$DataError: KeywordErrorDefinition = {\n message: ({keyword, schemaType}) =>\n schemaType\n ? str`\"${keyword}\" keyword must be ${schemaType} ($data)`\n : str`\"${keyword}\" keyword is invalid ($data)`,\n}\n\nexport interface ErrorPaths {\n instancePath?: Code\n schemaPath?: string\n parentSchema?: boolean\n}\n\nexport function reportError(\n cxt: KeywordErrorCxt,\n error: KeywordErrorDefinition = keywordError,\n errorPaths?: ErrorPaths,\n overrideAllErrors?: boolean\n): void {\n const {it} = cxt\n const {gen, compositeRule, allErrors} = it\n const errObj = errorObjectCode(cxt, error, errorPaths)\n if (overrideAllErrors ?? (compositeRule || allErrors)) {\n addError(gen, errObj)\n } else {\n returnErrors(it, _`[${errObj}]`)\n }\n}\n\nexport function reportExtraError(\n cxt: KeywordErrorCxt,\n error: KeywordErrorDefinition = keywordError,\n errorPaths?: ErrorPaths\n): void {\n const {it} = cxt\n const {gen, compositeRule, allErrors} = it\n const errObj = errorObjectCode(cxt, error, errorPaths)\n addError(gen, errObj)\n if (!(compositeRule || allErrors)) {\n returnErrors(it, N.vErrors)\n }\n}\n\nexport function resetErrorsCount(gen: CodeGen, errsCount: Name): void {\n gen.assign(N.errors, errsCount)\n gen.if(_`${N.vErrors} !== null`, () =>\n gen.if(\n errsCount,\n () => gen.assign(_`${N.vErrors}.length`, errsCount),\n () => gen.assign(N.vErrors, null)\n )\n )\n}\n\nexport function extendErrors({\n gen,\n keyword,\n schemaValue,\n data,\n errsCount,\n it,\n}: KeywordErrorCxt): void {\n /* istanbul ignore if */\n if (errsCount === undefined) throw new Error(\"ajv implementation error\")\n const err = gen.name(\"err\")\n gen.forRange(\"i\", errsCount, N.errors, (i) => {\n gen.const(err, _`${N.vErrors}[${i}]`)\n gen.if(_`${err}.instancePath === undefined`, () =>\n gen.assign(_`${err}.instancePath`, strConcat(N.instancePath, it.errorPath))\n )\n gen.assign(_`${err}.schemaPath`, str`${it.errSchemaPath}/${keyword}`)\n if (it.opts.verbose) {\n gen.assign(_`${err}.schema`, schemaValue)\n gen.assign(_`${err}.data`, data)\n }\n })\n}\n\nfunction addError(gen: CodeGen, errObj: Code): void {\n const err = gen.const(\"err\", errObj)\n gen.if(\n _`${N.vErrors} === null`,\n () => gen.assign(N.vErrors, _`[${err}]`),\n _`${N.vErrors}.push(${err})`\n )\n gen.code(_`${N.errors}++`)\n}\n\nfunction returnErrors(it: SchemaCxt, errs: Code): void {\n const {gen, validateName, schemaEnv} = it\n if (schemaEnv.$async) {\n gen.throw(_`new ${it.ValidationError as Name}(${errs})`)\n } else {\n gen.assign(_`${validateName}.errors`, errs)\n gen.return(false)\n }\n}\n\nconst E = {\n keyword: new Name(\"keyword\"),\n schemaPath: new Name(\"schemaPath\"), // also used in JTD errors\n params: new Name(\"params\"),\n propertyName: new Name(\"propertyName\"),\n message: new Name(\"message\"),\n schema: new Name(\"schema\"),\n parentSchema: new Name(\"parentSchema\"),\n}\n\nfunction errorObjectCode(\n cxt: KeywordErrorCxt,\n error: KeywordErrorDefinition,\n errorPaths?: ErrorPaths\n): Code {\n const {createErrors} = cxt.it\n if (createErrors === false) return _`{}`\n return errorObject(cxt, error, errorPaths)\n}\n\nfunction errorObject(\n cxt: KeywordErrorCxt,\n error: KeywordErrorDefinition,\n errorPaths: ErrorPaths = {}\n): Code {\n const {gen, it} = cxt\n const keyValues: [Name, SafeExpr | string][] = [\n errorInstancePath(it, errorPaths),\n errorSchemaPath(cxt, errorPaths),\n ]\n extraErrorProps(cxt, error, keyValues)\n return gen.object(...keyValues)\n}\n\nfunction errorInstancePath({errorPath}: SchemaCxt, {instancePath}: ErrorPaths): [Name, Code] {\n const instPath = instancePath\n ? str`${errorPath}${getErrorPath(instancePath, Type.Str)}`\n : errorPath\n return [N.instancePath, strConcat(N.instancePath, instPath)]\n}\n\nfunction errorSchemaPath(\n {keyword, it: {errSchemaPath}}: KeywordErrorCxt,\n {schemaPath, parentSchema}: ErrorPaths\n): [Name, string | Code] {\n let schPath = parentSchema ? errSchemaPath : str`${errSchemaPath}/${keyword}`\n if (schemaPath) {\n schPath = str`${schPath}${getErrorPath(schemaPath, Type.Str)}`\n }\n return [E.schemaPath, schPath]\n}\n\nfunction extraErrorProps(\n cxt: KeywordErrorCxt,\n {params, message}: KeywordErrorDefinition,\n keyValues: [Name, SafeExpr | string][]\n): void {\n const {keyword, data, schemaValue, it} = cxt\n const {opts, propertyName, topSchemaRef, schemaPath} = it\n keyValues.push(\n [E.keyword, keyword],\n [E.params, typeof params == \"function\" ? params(cxt) : params || _`{}`]\n )\n if (opts.messages) {\n keyValues.push([E.message, typeof message == \"function\" ? message(cxt) : message])\n }\n if (opts.verbose) {\n keyValues.push(\n [E.schema, schemaValue],\n [E.parentSchema, _`${topSchemaRef}${schemaPath}`],\n [N.data, data]\n )\n }\n if (propertyName) keyValues.push([E.propertyName, propertyName])\n}\n","import type {\n AnySchema,\n AnySchemaObject,\n AnyValidateFunction,\n AsyncValidateFunction,\n EvaluatedProperties,\n EvaluatedItems,\n} from \"../types\"\nimport type Ajv from \"../core\"\nimport type {InstanceOptions} from \"../core\"\nimport {CodeGen, _, nil, stringify, Name, Code, ValueScopeName} from \"./codegen\"\nimport ValidationError from \"../runtime/validation_error\"\nimport N from \"./names\"\nimport {LocalRefs, getFullPath, _getFullPath, inlineRef, normalizeId, resolveUrl} from \"./resolve\"\nimport {schemaHasRulesButRef, unescapeFragment} from \"./util\"\nimport {validateFunctionCode} from \"./validate\"\nimport {URIComponent} from \"fast-uri\"\nimport {JSONType} from \"./rules\"\n\nexport type SchemaRefs = {\n [Ref in string]?: SchemaEnv | AnySchema\n}\n\nexport interface SchemaCxt {\n readonly gen: CodeGen\n readonly allErrors?: boolean // validation mode - whether to collect all errors or break on error\n readonly data: Name // Name with reference to the current part of data instance\n readonly parentData: Name // should be used in keywords modifying data\n readonly parentDataProperty: Code | number // should be used in keywords modifying data\n readonly dataNames: Name[]\n readonly dataPathArr: (Code | number)[]\n readonly dataLevel: number // the level of the currently validated data,\n // it can be used to access both the property names and the data on all levels from the top.\n dataTypes: JSONType[] // data types applied to the current part of data instance\n definedProperties: Set // set of properties to keep track of for required checks\n readonly topSchemaRef: Code\n readonly validateName: Name\n evaluated?: Name\n readonly ValidationError?: Name\n readonly schema: AnySchema // current schema object - equal to parentSchema passed via KeywordCxt\n readonly schemaEnv: SchemaEnv\n readonly rootId: string\n baseId: string // the current schema base URI that should be used as the base for resolving URIs in references (\\$ref)\n readonly schemaPath: Code // the run-time expression that evaluates to the property name of the current schema\n readonly errSchemaPath: string // this is actual string, should not be changed to Code\n readonly errorPath: Code\n readonly propertyName?: Name\n readonly compositeRule?: boolean // true indicates that the current schema is inside the compound keyword,\n // where failing some rule doesn't mean validation failure (`anyOf`, `oneOf`, `not`, `if`).\n // This flag is used to determine whether you can return validation result immediately after any error in case the option `allErrors` is not `true.\n // You only need to use it if you have many steps in your keywords and potentially can define multiple errors.\n props?: EvaluatedProperties | Name // properties evaluated by this schema - used by parent schema or assigned to validation function\n items?: EvaluatedItems | Name // last item evaluated by this schema - used by parent schema or assigned to validation function\n jtdDiscriminator?: string\n jtdMetadata?: boolean\n readonly createErrors?: boolean\n readonly opts: InstanceOptions // Ajv instance option.\n readonly self: Ajv // current Ajv instance\n}\n\nexport interface SchemaObjCxt extends SchemaCxt {\n readonly schema: AnySchemaObject\n}\ninterface SchemaEnvArgs {\n readonly schema: AnySchema\n readonly schemaId?: \"$id\" | \"id\"\n readonly root?: SchemaEnv\n readonly baseId?: string\n readonly schemaPath?: string\n readonly localRefs?: LocalRefs\n readonly meta?: boolean\n}\n\nexport class SchemaEnv implements SchemaEnvArgs {\n readonly schema: AnySchema\n readonly schemaId?: \"$id\" | \"id\"\n readonly root: SchemaEnv\n baseId: string // TODO possibly, it should be readonly\n schemaPath?: string\n localRefs?: LocalRefs\n readonly meta?: boolean\n readonly $async?: boolean // true if the current schema is asynchronous.\n readonly refs: SchemaRefs = {}\n readonly dynamicAnchors: {[Ref in string]?: true} = {}\n validate?: AnyValidateFunction\n validateName?: ValueScopeName\n serialize?: (data: unknown) => string\n serializeName?: ValueScopeName\n parse?: (data: string) => unknown\n parseName?: ValueScopeName\n\n constructor(env: SchemaEnvArgs) {\n let schema: AnySchemaObject | undefined\n if (typeof env.schema == \"object\") schema = env.schema\n this.schema = env.schema\n this.schemaId = env.schemaId\n this.root = env.root || this\n this.baseId = env.baseId ?? normalizeId(schema?.[env.schemaId || \"$id\"])\n this.schemaPath = env.schemaPath\n this.localRefs = env.localRefs\n this.meta = env.meta\n this.$async = schema?.$async\n this.refs = {}\n }\n}\n\n// let codeSize = 0\n// let nodeCount = 0\n\n// Compiles schema in SchemaEnv\nexport function compileSchema(this: Ajv, sch: SchemaEnv): SchemaEnv {\n // TODO refactor - remove compilations\n const _sch = getCompilingSchema.call(this, sch)\n if (_sch) return _sch\n const rootId = getFullPath(this.opts.uriResolver, sch.root.baseId) // TODO if getFullPath removed 1 tests fails\n const {es5, lines} = this.opts.code\n const {ownProperties} = this.opts\n const gen = new CodeGen(this.scope, {es5, lines, ownProperties})\n let _ValidationError\n if (sch.$async) {\n _ValidationError = gen.scopeValue(\"Error\", {\n ref: ValidationError,\n code: _`require(\"ajv/dist/runtime/validation_error\").default`,\n })\n }\n\n const validateName = gen.scopeName(\"validate\")\n sch.validateName = validateName\n\n const schemaCxt: SchemaCxt = {\n gen,\n allErrors: this.opts.allErrors,\n data: N.data,\n parentData: N.parentData,\n parentDataProperty: N.parentDataProperty,\n dataNames: [N.data],\n dataPathArr: [nil], // TODO can its length be used as dataLevel if nil is removed?\n dataLevel: 0,\n dataTypes: [],\n definedProperties: new Set(),\n topSchemaRef: gen.scopeValue(\n \"schema\",\n this.opts.code.source === true\n ? {ref: sch.schema, code: stringify(sch.schema)}\n : {ref: sch.schema}\n ),\n validateName,\n ValidationError: _ValidationError,\n schema: sch.schema,\n schemaEnv: sch,\n rootId,\n baseId: sch.baseId || rootId,\n schemaPath: nil,\n errSchemaPath: sch.schemaPath || (this.opts.jtd ? \"\" : \"#\"),\n errorPath: _`\"\"`,\n opts: this.opts,\n self: this,\n }\n\n let sourceCode: string | undefined\n try {\n this._compilations.add(sch)\n validateFunctionCode(schemaCxt)\n gen.optimize(this.opts.code.optimize)\n // gen.optimize(1)\n const validateCode = gen.toString()\n sourceCode = `${gen.scopeRefs(N.scope)}return ${validateCode}`\n // console.log((codeSize += sourceCode.length), (nodeCount += gen.nodeCount))\n if (this.opts.code.process) sourceCode = this.opts.code.process(sourceCode, sch)\n // console.log(\"\\n\\n\\n *** \\n\", sourceCode)\n const makeValidate = new Function(`${N.self}`, `${N.scope}`, sourceCode)\n const validate: AnyValidateFunction = makeValidate(this, this.scope.get())\n this.scope.value(validateName, {ref: validate})\n\n validate.errors = null\n validate.schema = sch.schema\n validate.schemaEnv = sch\n if (sch.$async) (validate as AsyncValidateFunction).$async = true\n if (this.opts.code.source === true) {\n validate.source = {validateName, validateCode, scopeValues: gen._values}\n }\n if (this.opts.unevaluated) {\n const {props, items} = schemaCxt\n validate.evaluated = {\n props: props instanceof Name ? undefined : props,\n items: items instanceof Name ? undefined : items,\n dynamicProps: props instanceof Name,\n dynamicItems: items instanceof Name,\n }\n if (validate.source) validate.source.evaluated = stringify(validate.evaluated)\n }\n sch.validate = validate\n return sch\n } catch (e) {\n delete sch.validate\n delete sch.validateName\n if (sourceCode) this.logger.error(\"Error compiling schema, function code:\", sourceCode)\n // console.log(\"\\n\\n\\n *** \\n\", sourceCode, this.opts)\n throw e\n } finally {\n this._compilations.delete(sch)\n }\n}\n\nexport function resolveRef(\n this: Ajv,\n root: SchemaEnv,\n baseId: string,\n ref: string\n): AnySchema | SchemaEnv | undefined {\n ref = resolveUrl(this.opts.uriResolver, baseId, ref)\n const schOrFunc = root.refs[ref]\n if (schOrFunc) return schOrFunc\n\n let _sch = resolve.call(this, root, ref)\n if (_sch === undefined) {\n const schema = root.localRefs?.[ref] // TODO maybe localRefs should hold SchemaEnv\n const {schemaId} = this.opts\n if (schema) _sch = new SchemaEnv({schema, schemaId, root, baseId})\n }\n\n if (_sch === undefined) return\n return (root.refs[ref] = inlineOrCompile.call(this, _sch))\n}\n\nfunction inlineOrCompile(this: Ajv, sch: SchemaEnv): AnySchema | SchemaEnv {\n if (inlineRef(sch.schema, this.opts.inlineRefs)) return sch.schema\n return sch.validate ? sch : compileSchema.call(this, sch)\n}\n\n// Index of schema compilation in the currently compiled list\nexport function getCompilingSchema(this: Ajv, schEnv: SchemaEnv): SchemaEnv | void {\n for (const sch of this._compilations) {\n if (sameSchemaEnv(sch, schEnv)) return sch\n }\n}\n\nfunction sameSchemaEnv(s1: SchemaEnv, s2: SchemaEnv): boolean {\n return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId\n}\n\n// resolve and compile the references ($ref)\n// TODO returns AnySchemaObject (if the schema can be inlined) or validation function\nfunction resolve(\n this: Ajv,\n root: SchemaEnv, // information about the root schema for the current schema\n ref: string // reference to resolve\n): SchemaEnv | undefined {\n let sch\n while (typeof (sch = this.refs[ref]) == \"string\") ref = sch\n return sch || this.schemas[ref] || resolveSchema.call(this, root, ref)\n}\n\n// Resolve schema, its root and baseId\nexport function resolveSchema(\n this: Ajv,\n root: SchemaEnv, // root object with properties schema, refs TODO below SchemaEnv is assigned to it\n ref: string // reference to resolve\n): SchemaEnv | undefined {\n const p = this.opts.uriResolver.parse(ref)\n const refPath = _getFullPath(this.opts.uriResolver, p)\n let baseId = getFullPath(this.opts.uriResolver, root.baseId, undefined)\n // TODO `Object.keys(root.schema).length > 0` should not be needed - but removing breaks 2 tests\n if (Object.keys(root.schema).length > 0 && refPath === baseId) {\n return getJsonPointer.call(this, p, root)\n }\n\n const id = normalizeId(refPath)\n const schOrRef = this.refs[id] || this.schemas[id]\n if (typeof schOrRef == \"string\") {\n const sch = resolveSchema.call(this, root, schOrRef)\n if (typeof sch?.schema !== \"object\") return\n return getJsonPointer.call(this, p, sch)\n }\n\n if (typeof schOrRef?.schema !== \"object\") return\n if (!schOrRef.validate) compileSchema.call(this, schOrRef)\n if (id === normalizeId(ref)) {\n const {schema} = schOrRef\n const {schemaId} = this.opts\n const schId = schema[schemaId]\n if (schId) baseId = resolveUrl(this.opts.uriResolver, baseId, schId)\n return new SchemaEnv({schema, schemaId, root, baseId})\n }\n return getJsonPointer.call(this, p, schOrRef)\n}\n\nconst PREVENT_SCOPE_CHANGE = new Set([\n \"properties\",\n \"patternProperties\",\n \"enum\",\n \"dependencies\",\n \"definitions\",\n])\n\nfunction getJsonPointer(\n this: Ajv,\n parsedRef: URIComponent,\n {baseId, schema, root}: SchemaEnv\n): SchemaEnv | undefined {\n if (parsedRef.fragment?.[0] !== \"/\") return\n for (const part of parsedRef.fragment.slice(1).split(\"/\")) {\n if (typeof schema === \"boolean\") return\n const partSchema = schema[unescapeFragment(part)]\n if (partSchema === undefined) return\n schema = partSchema\n // TODO PREVENT_SCOPE_CHANGE could be defined in keyword def?\n const schId = typeof schema === \"object\" && schema[this.opts.schemaId]\n if (!PREVENT_SCOPE_CHANGE.has(part) && schId) {\n baseId = resolveUrl(this.opts.uriResolver, baseId, schId)\n }\n }\n let env: SchemaEnv | undefined\n if (typeof schema != \"boolean\" && schema.$ref && !schemaHasRulesButRef(schema, this.RULES)) {\n const $ref = resolveUrl(this.opts.uriResolver, baseId, schema.$ref)\n env = resolveSchema.call(this, root, $ref)\n }\n // even though resolution failed we need to return SchemaEnv to throw exception\n // so that compileAsync loads missing schema.\n const {schemaId} = this.opts\n env = env || new SchemaEnv({schema, schemaId, root, baseId})\n if (env.schema !== env.root.schema) return env\n return undefined\n}\n","import {Name} from \"./codegen\"\n\nconst names = {\n // validation function arguments\n data: new Name(\"data\"), // data passed to validation function\n // args passed from referencing schema\n valCxt: new Name(\"valCxt\"), // validation/data context - should not be used directly, it is destructured to the names below\n instancePath: new Name(\"instancePath\"),\n parentData: new Name(\"parentData\"),\n parentDataProperty: new Name(\"parentDataProperty\"),\n rootData: new Name(\"rootData\"), // root data - same as the data passed to the first/top validation function\n dynamicAnchors: new Name(\"dynamicAnchors\"), // used to support recursiveRef and dynamicRef\n // function scoped variables\n vErrors: new Name(\"vErrors\"), // null or array of validation errors\n errors: new Name(\"errors\"), // counter of validation errors\n this: new Name(\"this\"),\n // \"globals\"\n self: new Name(\"self\"),\n scope: new Name(\"scope\"),\n // JTD serialize/parse name for JSON string and position\n json: new Name(\"json\"),\n jsonPos: new Name(\"jsonPos\"),\n jsonLen: new Name(\"jsonLen\"),\n jsonPart: new Name(\"jsonPart\"),\n}\n\nexport default names\n","import {resolveUrl, normalizeId, getFullPath} from \"./resolve\"\nimport type {UriResolver} from \"../types\"\n\nexport default class MissingRefError extends Error {\n readonly missingRef: string\n readonly missingSchema: string\n\n constructor(resolver: UriResolver, baseId: string, ref: string, msg?: string) {\n super(msg || `can't resolve reference ${ref} from id ${baseId}`)\n this.missingRef = resolveUrl(resolver, baseId, ref)\n this.missingSchema = normalizeId(getFullPath(resolver, this.missingRef))\n }\n}\n","import type {AnySchema, AnySchemaObject, UriResolver} from \"../types\"\nimport type Ajv from \"../ajv\"\nimport type {URIComponent} from \"fast-uri\"\nimport {eachItem} from \"./util\"\nimport * as equal from \"fast-deep-equal\"\nimport * as traverse from \"json-schema-traverse\"\n\n// the hash of local references inside the schema (created by getSchemaRefs), used for inline resolution\nexport type LocalRefs = {[Ref in string]?: AnySchemaObject}\n\n// TODO refactor to use keyword definitions\nconst SIMPLE_INLINED = new Set([\n \"type\",\n \"format\",\n \"pattern\",\n \"maxLength\",\n \"minLength\",\n \"maxProperties\",\n \"minProperties\",\n \"maxItems\",\n \"minItems\",\n \"maximum\",\n \"minimum\",\n \"uniqueItems\",\n \"multipleOf\",\n \"required\",\n \"enum\",\n \"const\",\n])\n\nexport function inlineRef(schema: AnySchema, limit: boolean | number = true): boolean {\n if (typeof schema == \"boolean\") return true\n if (limit === true) return !hasRef(schema)\n if (!limit) return false\n return countKeys(schema) <= limit\n}\n\nconst REF_KEYWORDS = new Set([\n \"$ref\",\n \"$recursiveRef\",\n \"$recursiveAnchor\",\n \"$dynamicRef\",\n \"$dynamicAnchor\",\n])\n\nfunction hasRef(schema: AnySchemaObject): boolean {\n for (const key in schema) {\n if (REF_KEYWORDS.has(key)) return true\n const sch = schema[key]\n if (Array.isArray(sch) && sch.some(hasRef)) return true\n if (typeof sch == \"object\" && hasRef(sch)) return true\n }\n return false\n}\n\nfunction countKeys(schema: AnySchemaObject): number {\n let count = 0\n for (const key in schema) {\n if (key === \"$ref\") return Infinity\n count++\n if (SIMPLE_INLINED.has(key)) continue\n if (typeof schema[key] == \"object\") {\n eachItem(schema[key], (sch) => (count += countKeys(sch)))\n }\n if (count === Infinity) return Infinity\n }\n return count\n}\n\nexport function getFullPath(resolver: UriResolver, id = \"\", normalize?: boolean): string {\n if (normalize !== false) id = normalizeId(id)\n const p = resolver.parse(id)\n return _getFullPath(resolver, p)\n}\n\nexport function _getFullPath(resolver: UriResolver, p: URIComponent): string {\n const serialized = resolver.serialize(p)\n return serialized.split(\"#\")[0] + \"#\"\n}\n\nconst TRAILING_SLASH_HASH = /#\\/?$/\nexport function normalizeId(id: string | undefined): string {\n return id ? id.replace(TRAILING_SLASH_HASH, \"\") : \"\"\n}\n\nexport function resolveUrl(resolver: UriResolver, baseId: string, id: string): string {\n id = normalizeId(id)\n return resolver.resolve(baseId, id)\n}\n\nconst ANCHOR = /^[a-z_][-a-z0-9._]*$/i\n\nexport function getSchemaRefs(this: Ajv, schema: AnySchema, baseId: string): LocalRefs {\n if (typeof schema == \"boolean\") return {}\n const {schemaId, uriResolver} = this.opts\n const schId = normalizeId(schema[schemaId] || baseId)\n const baseIds: {[JsonPtr in string]?: string} = {\"\": schId}\n const pathPrefix = getFullPath(uriResolver, schId, false)\n const localRefs: LocalRefs = {}\n const schemaRefs: Set = new Set()\n\n traverse(schema, {allKeys: true}, (sch, jsonPtr, _, parentJsonPtr) => {\n if (parentJsonPtr === undefined) return\n const fullPath = pathPrefix + jsonPtr\n let innerBaseId = baseIds[parentJsonPtr]\n if (typeof sch[schemaId] == \"string\") innerBaseId = addRef.call(this, sch[schemaId])\n addAnchor.call(this, sch.$anchor)\n addAnchor.call(this, sch.$dynamicAnchor)\n baseIds[jsonPtr] = innerBaseId\n\n function addRef(this: Ajv, ref: string): string {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const _resolve = this.opts.uriResolver.resolve\n ref = normalizeId(innerBaseId ? _resolve(innerBaseId, ref) : ref)\n if (schemaRefs.has(ref)) throw ambiguos(ref)\n schemaRefs.add(ref)\n let schOrRef = this.refs[ref]\n if (typeof schOrRef == \"string\") schOrRef = this.refs[schOrRef]\n if (typeof schOrRef == \"object\") {\n checkAmbiguosRef(sch, schOrRef.schema, ref)\n } else if (ref !== normalizeId(fullPath)) {\n if (ref[0] === \"#\") {\n checkAmbiguosRef(sch, localRefs[ref], ref)\n localRefs[ref] = sch\n } else {\n this.refs[ref] = fullPath\n }\n }\n return ref\n }\n\n function addAnchor(this: Ajv, anchor: unknown): void {\n if (typeof anchor == \"string\") {\n if (!ANCHOR.test(anchor)) throw new Error(`invalid anchor \"${anchor}\"`)\n addRef.call(this, `#${anchor}`)\n }\n }\n })\n\n return localRefs\n\n function checkAmbiguosRef(sch1: AnySchema, sch2: AnySchema | undefined, ref: string): void {\n if (sch2 !== undefined && !equal(sch1, sch2)) throw ambiguos(ref)\n }\n\n function ambiguos(ref: string): Error {\n return new Error(`reference \"${ref}\" resolves to more than one schema`)\n }\n}\n","import type {AddedKeywordDefinition} from \"../types\"\n\nconst _jsonTypes = [\"string\", \"number\", \"integer\", \"boolean\", \"null\", \"object\", \"array\"] as const\n\nexport type JSONType = (typeof _jsonTypes)[number]\n\nconst jsonTypes: Set = new Set(_jsonTypes)\n\nexport function isJSONType(x: unknown): x is JSONType {\n return typeof x == \"string\" && jsonTypes.has(x)\n}\n\ntype ValidationTypes = {\n [K in JSONType]: boolean | RuleGroup | undefined\n}\n\nexport interface ValidationRules {\n rules: RuleGroup[]\n post: RuleGroup\n all: {[Key in string]?: boolean | Rule} // rules that have to be validated\n keywords: {[Key in string]?: boolean} // all known keywords (superset of \"all\")\n types: ValidationTypes\n}\n\nexport interface RuleGroup {\n type?: JSONType\n rules: Rule[]\n}\n\n// This interface wraps KeywordDefinition because definition can have multiple keywords\nexport interface Rule {\n keyword: string\n definition: AddedKeywordDefinition\n}\n\nexport function getRules(): ValidationRules {\n const groups: Record<\"number\" | \"string\" | \"array\" | \"object\", RuleGroup> = {\n number: {type: \"number\", rules: []},\n string: {type: \"string\", rules: []},\n array: {type: \"array\", rules: []},\n object: {type: \"object\", rules: []},\n }\n return {\n types: {...groups, integer: true, boolean: true, null: true},\n rules: [{rules: []}, groups.number, groups.string, groups.array, groups.object],\n post: {rules: []},\n all: {},\n keywords: {},\n }\n}\n","import type {AnySchema, EvaluatedProperties, EvaluatedItems} from \"../types\"\nimport type {SchemaCxt, SchemaObjCxt} from \".\"\nimport {_, getProperty, Code, Name, CodeGen} from \"./codegen\"\nimport {_Code} from \"./codegen/code\"\nimport type {Rule, ValidationRules} from \"./rules\"\n\n// TODO refactor to use Set\nexport function toHash(arr: T[]): {[K in T]?: true} {\n const hash: {[K in T]?: true} = {}\n for (const item of arr) hash[item] = true\n return hash\n}\n\nexport function alwaysValidSchema(it: SchemaCxt, schema: AnySchema): boolean | void {\n if (typeof schema == \"boolean\") return schema\n if (Object.keys(schema).length === 0) return true\n checkUnknownRules(it, schema)\n return !schemaHasRules(schema, it.self.RULES.all)\n}\n\nexport function checkUnknownRules(it: SchemaCxt, schema: AnySchema = it.schema): void {\n const {opts, self} = it\n if (!opts.strictSchema) return\n if (typeof schema === \"boolean\") return\n const rules = self.RULES.keywords\n for (const key in schema) {\n if (!rules[key]) checkStrictMode(it, `unknown keyword: \"${key}\"`)\n }\n}\n\nexport function schemaHasRules(\n schema: AnySchema,\n rules: {[Key in string]?: boolean | Rule}\n): boolean {\n if (typeof schema == \"boolean\") return !schema\n for (const key in schema) if (rules[key]) return true\n return false\n}\n\nexport function schemaHasRulesButRef(schema: AnySchema, RULES: ValidationRules): boolean {\n if (typeof schema == \"boolean\") return !schema\n for (const key in schema) if (key !== \"$ref\" && RULES.all[key]) return true\n return false\n}\n\nexport function schemaRefOrVal(\n {topSchemaRef, schemaPath}: SchemaObjCxt,\n schema: unknown,\n keyword: string,\n $data?: string | false\n): Code | number | boolean {\n if (!$data) {\n if (typeof schema == \"number\" || typeof schema == \"boolean\") return schema\n if (typeof schema == \"string\") return _`${schema}`\n }\n return _`${topSchemaRef}${schemaPath}${getProperty(keyword)}`\n}\n\nexport function unescapeFragment(str: string): string {\n return unescapeJsonPointer(decodeURIComponent(str))\n}\n\nexport function escapeFragment(str: string | number): string {\n return encodeURIComponent(escapeJsonPointer(str))\n}\n\nexport function escapeJsonPointer(str: string | number): string {\n if (typeof str == \"number\") return `${str}`\n return str.replace(/~/g, \"~0\").replace(/\\//g, \"~1\")\n}\n\nexport function unescapeJsonPointer(str: string): string {\n return str.replace(/~1/g, \"/\").replace(/~0/g, \"~\")\n}\n\nexport function eachItem(xs: T | T[], f: (x: T) => void): void {\n if (Array.isArray(xs)) {\n for (const x of xs) f(x)\n } else {\n f(xs)\n }\n}\n\ntype SomeEvaluated = EvaluatedProperties | EvaluatedItems\n\ntype MergeEvaluatedFunc = (\n gen: CodeGen,\n from: Name | T,\n to: Name | Exclude | undefined,\n toName?: typeof Name\n) => Name | T\n\ninterface MakeMergeFuncArgs {\n mergeNames: (gen: CodeGen, from: Name, to: Name) => void\n mergeToName: (gen: CodeGen, from: T, to: Name) => void\n mergeValues: (from: T, to: Exclude) => T\n resultToName: (gen: CodeGen, res?: T) => Name\n}\n\nfunction makeMergeEvaluated({\n mergeNames,\n mergeToName,\n mergeValues,\n resultToName,\n}: MakeMergeFuncArgs): MergeEvaluatedFunc {\n return (gen, from, to, toName) => {\n const res =\n to === undefined\n ? from\n : to instanceof Name\n ? (from instanceof Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to)\n : from instanceof Name\n ? (mergeToName(gen, to, from), from)\n : mergeValues(from, to)\n return toName === Name && !(res instanceof Name) ? resultToName(gen, res) : res\n }\n}\n\ninterface MergeEvaluated {\n props: MergeEvaluatedFunc\n items: MergeEvaluatedFunc\n}\n\nexport const mergeEvaluated: MergeEvaluated = {\n props: makeMergeEvaluated({\n mergeNames: (gen, from, to) =>\n gen.if(_`${to} !== true && ${from} !== undefined`, () => {\n gen.if(\n _`${from} === true`,\n () => gen.assign(to, true),\n () => gen.assign(to, _`${to} || {}`).code(_`Object.assign(${to}, ${from})`)\n )\n }),\n mergeToName: (gen, from, to) =>\n gen.if(_`${to} !== true`, () => {\n if (from === true) {\n gen.assign(to, true)\n } else {\n gen.assign(to, _`${to} || {}`)\n setEvaluated(gen, to, from)\n }\n }),\n mergeValues: (from, to) => (from === true ? true : {...from, ...to}),\n resultToName: evaluatedPropsToName,\n }),\n items: makeMergeEvaluated({\n mergeNames: (gen, from, to) =>\n gen.if(_`${to} !== true && ${from} !== undefined`, () =>\n gen.assign(to, _`${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`)\n ),\n mergeToName: (gen, from, to) =>\n gen.if(_`${to} !== true`, () =>\n gen.assign(to, from === true ? true : _`${to} > ${from} ? ${to} : ${from}`)\n ),\n mergeValues: (from, to) => (from === true ? true : Math.max(from, to)),\n resultToName: (gen, items) => gen.var(\"items\", items),\n }),\n}\n\nexport function evaluatedPropsToName(gen: CodeGen, ps?: EvaluatedProperties): Name {\n if (ps === true) return gen.var(\"props\", true)\n const props = gen.var(\"props\", _`{}`)\n if (ps !== undefined) setEvaluated(gen, props, ps)\n return props\n}\n\nexport function setEvaluated(gen: CodeGen, props: Name, ps: {[K in string]?: true}): void {\n Object.keys(ps).forEach((p) => gen.assign(_`${props}${getProperty(p)}`, true))\n}\n\nconst snippets: {[S in string]?: _Code} = {}\n\nexport function useFunc(gen: CodeGen, f: {code: string}): Name {\n return gen.scopeValue(\"func\", {\n ref: f,\n code: snippets[f.code] || (snippets[f.code] = new _Code(f.code)),\n })\n}\n\nexport enum Type {\n Num,\n Str,\n}\n\nexport function getErrorPath(\n dataProp: Name | string | number,\n dataPropType?: Type,\n jsPropertySyntax?: boolean\n): Code | string {\n // let path\n if (dataProp instanceof Name) {\n const isNumber = dataPropType === Type.Num\n return jsPropertySyntax\n ? isNumber\n ? _`\"[\" + ${dataProp} + \"]\"`\n : _`\"['\" + ${dataProp} + \"']\"`\n : isNumber\n ? _`\"/\" + ${dataProp}`\n : _`\"/\" + ${dataProp}.replace(/~/g, \"~0\").replace(/\\\\//g, \"~1\")` // TODO maybe use global escapePointer\n }\n return jsPropertySyntax ? getProperty(dataProp).toString() : \"/\" + escapeJsonPointer(dataProp)\n}\n\nexport function checkStrictMode(\n it: SchemaCxt,\n msg: string,\n mode: boolean | \"log\" = it.opts.strictSchema\n): void {\n if (!mode) return\n msg = `strict mode: ${msg}`\n if (mode === true) throw new Error(msg)\n it.self.logger.warn(msg)\n}\n","import type {AnySchemaObject} from \"../../types\"\nimport type {SchemaObjCxt} from \"..\"\nimport type {JSONType, RuleGroup, Rule} from \"../rules\"\n\nexport function schemaHasRulesForType(\n {schema, self}: SchemaObjCxt,\n type: JSONType\n): boolean | undefined {\n const group = self.RULES.types[type]\n return group && group !== true && shouldUseGroup(schema, group)\n}\n\nexport function shouldUseGroup(schema: AnySchemaObject, group: RuleGroup): boolean {\n return group.rules.some((rule) => shouldUseRule(schema, rule))\n}\n\nexport function shouldUseRule(schema: AnySchemaObject, rule: Rule): boolean | undefined {\n return (\n schema[rule.keyword] !== undefined ||\n rule.definition.implements?.some((kwd) => schema[kwd] !== undefined)\n )\n}\n","import type {KeywordErrorDefinition, KeywordErrorCxt} from \"../../types\"\nimport type {SchemaCxt} from \"..\"\nimport {reportError} from \"../errors\"\nimport {_, Name} from \"../codegen\"\nimport N from \"../names\"\n\nconst boolError: KeywordErrorDefinition = {\n message: \"boolean schema is false\",\n}\n\nexport function topBoolOrEmptySchema(it: SchemaCxt): void {\n const {gen, schema, validateName} = it\n if (schema === false) {\n falseSchemaError(it, false)\n } else if (typeof schema == \"object\" && schema.$async === true) {\n gen.return(N.data)\n } else {\n gen.assign(_`${validateName}.errors`, null)\n gen.return(true)\n }\n}\n\nexport function boolOrEmptySchema(it: SchemaCxt, valid: Name): void {\n const {gen, schema} = it\n if (schema === false) {\n gen.var(valid, false) // TODO var\n falseSchemaError(it)\n } else {\n gen.var(valid, true) // TODO var\n }\n}\n\nfunction falseSchemaError(it: SchemaCxt, overrideAllErrors?: boolean): void {\n const {gen, data} = it\n // TODO maybe some other interface should be used for non-keyword validation errors...\n const cxt: KeywordErrorCxt = {\n gen,\n keyword: \"false schema\",\n data,\n schema: false,\n schemaCode: false,\n schemaValue: false,\n params: {},\n it,\n }\n reportError(cxt, boolError, undefined, overrideAllErrors)\n}\n","import type {\n KeywordErrorDefinition,\n KeywordErrorCxt,\n ErrorObject,\n AnySchemaObject,\n} from \"../../types\"\nimport type {SchemaObjCxt} from \"..\"\nimport {isJSONType, JSONType} from \"../rules\"\nimport {schemaHasRulesForType} from \"./applicability\"\nimport {reportError} from \"../errors\"\nimport {_, nil, and, not, operators, Code, Name} from \"../codegen\"\nimport {toHash, schemaRefOrVal} from \"../util\"\n\nexport enum DataType {\n Correct,\n Wrong,\n}\n\nexport function getSchemaTypes(schema: AnySchemaObject): JSONType[] {\n const types = getJSONTypes(schema.type)\n const hasNull = types.includes(\"null\")\n if (hasNull) {\n if (schema.nullable === false) throw new Error(\"type: null contradicts nullable: false\")\n } else {\n if (!types.length && schema.nullable !== undefined) {\n throw new Error('\"nullable\" cannot be used without \"type\"')\n }\n if (schema.nullable === true) types.push(\"null\")\n }\n return types\n}\n\n// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\nexport function getJSONTypes(ts: unknown | unknown[]): JSONType[] {\n const types: unknown[] = Array.isArray(ts) ? ts : ts ? [ts] : []\n if (types.every(isJSONType)) return types\n throw new Error(\"type must be JSONType or JSONType[]: \" + types.join(\",\"))\n}\n\nexport function coerceAndCheckDataType(it: SchemaObjCxt, types: JSONType[]): boolean {\n const {gen, data, opts} = it\n const coerceTo = coerceToTypes(types, opts.coerceTypes)\n const checkTypes =\n types.length > 0 &&\n !(coerceTo.length === 0 && types.length === 1 && schemaHasRulesForType(it, types[0]))\n if (checkTypes) {\n const wrongType = checkDataTypes(types, data, opts.strictNumbers, DataType.Wrong)\n gen.if(wrongType, () => {\n if (coerceTo.length) coerceData(it, types, coerceTo)\n else reportTypeError(it)\n })\n }\n return checkTypes\n}\n\nconst COERCIBLE: Set = new Set([\"string\", \"number\", \"integer\", \"boolean\", \"null\"])\nfunction coerceToTypes(types: JSONType[], coerceTypes?: boolean | \"array\"): JSONType[] {\n return coerceTypes\n ? types.filter((t) => COERCIBLE.has(t) || (coerceTypes === \"array\" && t === \"array\"))\n : []\n}\n\nfunction coerceData(it: SchemaObjCxt, types: JSONType[], coerceTo: JSONType[]): void {\n const {gen, data, opts} = it\n const dataType = gen.let(\"dataType\", _`typeof ${data}`)\n const coerced = gen.let(\"coerced\", _`undefined`)\n if (opts.coerceTypes === \"array\") {\n gen.if(_`${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () =>\n gen\n .assign(data, _`${data}[0]`)\n .assign(dataType, _`typeof ${data}`)\n .if(checkDataTypes(types, data, opts.strictNumbers), () => gen.assign(coerced, data))\n )\n }\n gen.if(_`${coerced} !== undefined`)\n for (const t of coerceTo) {\n if (COERCIBLE.has(t) || (t === \"array\" && opts.coerceTypes === \"array\")) {\n coerceSpecificType(t)\n }\n }\n gen.else()\n reportTypeError(it)\n gen.endIf()\n\n gen.if(_`${coerced} !== undefined`, () => {\n gen.assign(data, coerced)\n assignParentData(it, coerced)\n })\n\n function coerceSpecificType(t: string): void {\n switch (t) {\n case \"string\":\n gen\n .elseIf(_`${dataType} == \"number\" || ${dataType} == \"boolean\"`)\n .assign(coerced, _`\"\" + ${data}`)\n .elseIf(_`${data} === null`)\n .assign(coerced, _`\"\"`)\n return\n case \"number\":\n gen\n .elseIf(\n _`${dataType} == \"boolean\" || ${data} === null\n || (${dataType} == \"string\" && ${data} && ${data} == +${data})`\n )\n .assign(coerced, _`+${data}`)\n return\n case \"integer\":\n gen\n .elseIf(\n _`${dataType} === \"boolean\" || ${data} === null\n || (${dataType} === \"string\" && ${data} && ${data} == +${data} && !(${data} % 1))`\n )\n .assign(coerced, _`+${data}`)\n return\n case \"boolean\":\n gen\n .elseIf(_`${data} === \"false\" || ${data} === 0 || ${data} === null`)\n .assign(coerced, false)\n .elseIf(_`${data} === \"true\" || ${data} === 1`)\n .assign(coerced, true)\n return\n case \"null\":\n gen.elseIf(_`${data} === \"\" || ${data} === 0 || ${data} === false`)\n gen.assign(coerced, null)\n return\n\n case \"array\":\n gen\n .elseIf(\n _`${dataType} === \"string\" || ${dataType} === \"number\"\n || ${dataType} === \"boolean\" || ${data} === null`\n )\n .assign(coerced, _`[${data}]`)\n }\n }\n}\n\nfunction assignParentData({gen, parentData, parentDataProperty}: SchemaObjCxt, expr: Name): void {\n // TODO use gen.property\n gen.if(_`${parentData} !== undefined`, () =>\n gen.assign(_`${parentData}[${parentDataProperty}]`, expr)\n )\n}\n\nexport function checkDataType(\n dataType: JSONType,\n data: Name,\n strictNums?: boolean | \"log\",\n correct = DataType.Correct\n): Code {\n const EQ = correct === DataType.Correct ? operators.EQ : operators.NEQ\n let cond: Code\n switch (dataType) {\n case \"null\":\n return _`${data} ${EQ} null`\n case \"array\":\n cond = _`Array.isArray(${data})`\n break\n case \"object\":\n cond = _`${data} && typeof ${data} == \"object\" && !Array.isArray(${data})`\n break\n case \"integer\":\n cond = numCond(_`!(${data} % 1) && !isNaN(${data})`)\n break\n case \"number\":\n cond = numCond()\n break\n default:\n return _`typeof ${data} ${EQ} ${dataType}`\n }\n return correct === DataType.Correct ? cond : not(cond)\n\n function numCond(_cond: Code = nil): Code {\n return and(_`typeof ${data} == \"number\"`, _cond, strictNums ? _`isFinite(${data})` : nil)\n }\n}\n\nexport function checkDataTypes(\n dataTypes: JSONType[],\n data: Name,\n strictNums?: boolean | \"log\",\n correct?: DataType\n): Code {\n if (dataTypes.length === 1) {\n return checkDataType(dataTypes[0], data, strictNums, correct)\n }\n let cond: Code\n const types = toHash(dataTypes)\n if (types.array && types.object) {\n const notObj = _`typeof ${data} != \"object\"`\n cond = types.null ? notObj : _`!${data} || ${notObj}`\n delete types.null\n delete types.array\n delete types.object\n } else {\n cond = nil\n }\n if (types.number) delete types.integer\n for (const t in types) cond = and(cond, checkDataType(t as JSONType, data, strictNums, correct))\n return cond\n}\n\nexport type TypeError = ErrorObject<\"type\", {type: string}>\n\nconst typeError: KeywordErrorDefinition = {\n message: ({schema}) => `must be ${schema}`,\n params: ({schema, schemaValue}) =>\n typeof schema == \"string\" ? _`{type: ${schema}}` : _`{type: ${schemaValue}}`,\n}\n\nexport function reportTypeError(it: SchemaObjCxt): void {\n const cxt = getTypeErrorContext(it)\n reportError(cxt, typeError)\n}\n\nfunction getTypeErrorContext(it: SchemaObjCxt): KeywordErrorCxt {\n const {gen, data, schema} = it\n const schemaCode = schemaRefOrVal(it, schema, \"type\")\n return {\n gen,\n keyword: \"type\",\n data,\n schema: schema.type,\n schemaCode,\n schemaValue: schemaCode,\n parentSchema: schema,\n params: {},\n it,\n }\n}\n","import type {SchemaObjCxt} from \"..\"\nimport {_, getProperty, stringify} from \"../codegen\"\nimport {checkStrictMode} from \"../util\"\n\nexport function assignDefaults(it: SchemaObjCxt, ty?: string): void {\n const {properties, items} = it.schema\n if (ty === \"object\" && properties) {\n for (const key in properties) {\n assignDefault(it, key, properties[key].default)\n }\n } else if (ty === \"array\" && Array.isArray(items)) {\n items.forEach((sch, i: number) => assignDefault(it, i, sch.default))\n }\n}\n\nfunction assignDefault(it: SchemaObjCxt, prop: string | number, defaultValue: unknown): void {\n const {gen, compositeRule, data, opts} = it\n if (defaultValue === undefined) return\n const childData = _`${data}${getProperty(prop)}`\n if (compositeRule) {\n checkStrictMode(it, `default is ignored for: ${childData}`)\n return\n }\n\n let condition = _`${childData} === undefined`\n if (opts.useDefaults === \"empty\") {\n condition = _`${condition} || ${childData} === null || ${childData} === \"\"`\n }\n // `${childData} === undefined` +\n // (opts.useDefaults === \"empty\" ? ` || ${childData} === null || ${childData} === \"\"` : \"\")\n gen.if(condition, _`${childData} = ${stringify(defaultValue)}`)\n}\n","import type {\n AddedKeywordDefinition,\n AnySchema,\n AnySchemaObject,\n KeywordErrorCxt,\n KeywordCxtParams,\n} from \"../../types\"\nimport type {SchemaCxt, SchemaObjCxt} from \"..\"\nimport type {InstanceOptions} from \"../../core\"\nimport {boolOrEmptySchema, topBoolOrEmptySchema} from \"./boolSchema\"\nimport {coerceAndCheckDataType, getSchemaTypes} from \"./dataType\"\nimport {shouldUseGroup, shouldUseRule} from \"./applicability\"\nimport {checkDataType, checkDataTypes, reportTypeError, DataType} from \"./dataType\"\nimport {assignDefaults} from \"./defaults\"\nimport {funcKeywordCode, macroKeywordCode, validateKeywordUsage, validSchemaType} from \"./keyword\"\nimport {getSubschema, extendSubschemaData, SubschemaArgs, extendSubschemaMode} from \"./subschema\"\nimport {_, nil, str, or, not, getProperty, Block, Code, Name, CodeGen} from \"../codegen\"\nimport N from \"../names\"\nimport {resolveUrl} from \"../resolve\"\nimport {\n schemaRefOrVal,\n schemaHasRulesButRef,\n checkUnknownRules,\n checkStrictMode,\n unescapeJsonPointer,\n mergeEvaluated,\n} from \"../util\"\nimport type {JSONType, Rule, RuleGroup} from \"../rules\"\nimport {\n ErrorPaths,\n reportError,\n reportExtraError,\n resetErrorsCount,\n keyword$DataError,\n} from \"../errors\"\n\n// schema compilation - generates validation function, subschemaCode (below) is used for subschemas\nexport function validateFunctionCode(it: SchemaCxt): void {\n if (isSchemaObj(it)) {\n checkKeywords(it)\n if (schemaCxtHasRules(it)) {\n topSchemaObjCode(it)\n return\n }\n }\n validateFunction(it, () => topBoolOrEmptySchema(it))\n}\n\nfunction validateFunction(\n {gen, validateName, schema, schemaEnv, opts}: SchemaCxt,\n body: Block\n): void {\n if (opts.code.es5) {\n gen.func(validateName, _`${N.data}, ${N.valCxt}`, schemaEnv.$async, () => {\n gen.code(_`\"use strict\"; ${funcSourceUrl(schema, opts)}`)\n destructureValCxtES5(gen, opts)\n gen.code(body)\n })\n } else {\n gen.func(validateName, _`${N.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () =>\n gen.code(funcSourceUrl(schema, opts)).code(body)\n )\n }\n}\n\nfunction destructureValCxt(opts: InstanceOptions): Code {\n return _`{${N.instancePath}=\"\", ${N.parentData}, ${N.parentDataProperty}, ${N.rootData}=${\n N.data\n }${opts.dynamicRef ? _`, ${N.dynamicAnchors}={}` : nil}}={}`\n}\n\nfunction destructureValCxtES5(gen: CodeGen, opts: InstanceOptions): void {\n gen.if(\n N.valCxt,\n () => {\n gen.var(N.instancePath, _`${N.valCxt}.${N.instancePath}`)\n gen.var(N.parentData, _`${N.valCxt}.${N.parentData}`)\n gen.var(N.parentDataProperty, _`${N.valCxt}.${N.parentDataProperty}`)\n gen.var(N.rootData, _`${N.valCxt}.${N.rootData}`)\n if (opts.dynamicRef) gen.var(N.dynamicAnchors, _`${N.valCxt}.${N.dynamicAnchors}`)\n },\n () => {\n gen.var(N.instancePath, _`\"\"`)\n gen.var(N.parentData, _`undefined`)\n gen.var(N.parentDataProperty, _`undefined`)\n gen.var(N.rootData, N.data)\n if (opts.dynamicRef) gen.var(N.dynamicAnchors, _`{}`)\n }\n )\n}\n\nfunction topSchemaObjCode(it: SchemaObjCxt): void {\n const {schema, opts, gen} = it\n validateFunction(it, () => {\n if (opts.$comment && schema.$comment) commentKeyword(it)\n checkNoDefault(it)\n gen.let(N.vErrors, null)\n gen.let(N.errors, 0)\n if (opts.unevaluated) resetEvaluated(it)\n typeAndKeywords(it)\n returnResults(it)\n })\n return\n}\n\nfunction resetEvaluated(it: SchemaObjCxt): void {\n // TODO maybe some hook to execute it in the end to check whether props/items are Name, as in assignEvaluated\n const {gen, validateName} = it\n it.evaluated = gen.const(\"evaluated\", _`${validateName}.evaluated`)\n gen.if(_`${it.evaluated}.dynamicProps`, () => gen.assign(_`${it.evaluated}.props`, _`undefined`))\n gen.if(_`${it.evaluated}.dynamicItems`, () => gen.assign(_`${it.evaluated}.items`, _`undefined`))\n}\n\nfunction funcSourceUrl(schema: AnySchema, opts: InstanceOptions): Code {\n const schId = typeof schema == \"object\" && schema[opts.schemaId]\n return schId && (opts.code.source || opts.code.process) ? _`/*# sourceURL=${schId} */` : nil\n}\n\n// schema compilation - this function is used recursively to generate code for sub-schemas\nfunction subschemaCode(it: SchemaCxt, valid: Name): void {\n if (isSchemaObj(it)) {\n checkKeywords(it)\n if (schemaCxtHasRules(it)) {\n subSchemaObjCode(it, valid)\n return\n }\n }\n boolOrEmptySchema(it, valid)\n}\n\nfunction schemaCxtHasRules({schema, self}: SchemaCxt): boolean {\n if (typeof schema == \"boolean\") return !schema\n for (const key in schema) if (self.RULES.all[key]) return true\n return false\n}\n\nfunction isSchemaObj(it: SchemaCxt): it is SchemaObjCxt {\n return typeof it.schema != \"boolean\"\n}\n\nfunction subSchemaObjCode(it: SchemaObjCxt, valid: Name): void {\n const {schema, gen, opts} = it\n if (opts.$comment && schema.$comment) commentKeyword(it)\n updateContext(it)\n checkAsyncSchema(it)\n const errsCount = gen.const(\"_errs\", N.errors)\n typeAndKeywords(it, errsCount)\n // TODO var\n gen.var(valid, _`${errsCount} === ${N.errors}`)\n}\n\nfunction checkKeywords(it: SchemaObjCxt): void {\n checkUnknownRules(it)\n checkRefsAndKeywords(it)\n}\n\nfunction typeAndKeywords(it: SchemaObjCxt, errsCount?: Name): void {\n if (it.opts.jtd) return schemaKeywords(it, [], false, errsCount)\n const types = getSchemaTypes(it.schema)\n const checkedTypes = coerceAndCheckDataType(it, types)\n schemaKeywords(it, types, !checkedTypes, errsCount)\n}\n\nfunction checkRefsAndKeywords(it: SchemaObjCxt): void {\n const {schema, errSchemaPath, opts, self} = it\n if (schema.$ref && opts.ignoreKeywordsWithRef && schemaHasRulesButRef(schema, self.RULES)) {\n self.logger.warn(`$ref: keywords ignored in schema at path \"${errSchemaPath}\"`)\n }\n}\n\nfunction checkNoDefault(it: SchemaObjCxt): void {\n const {schema, opts} = it\n if (schema.default !== undefined && opts.useDefaults && opts.strictSchema) {\n checkStrictMode(it, \"default is ignored in the schema root\")\n }\n}\n\nfunction updateContext(it: SchemaObjCxt): void {\n const schId = it.schema[it.opts.schemaId]\n if (schId) it.baseId = resolveUrl(it.opts.uriResolver, it.baseId, schId)\n}\n\nfunction checkAsyncSchema(it: SchemaObjCxt): void {\n if (it.schema.$async && !it.schemaEnv.$async) throw new Error(\"async schema in sync schema\")\n}\n\nfunction commentKeyword({gen, schemaEnv, schema, errSchemaPath, opts}: SchemaObjCxt): void {\n const msg = schema.$comment\n if (opts.$comment === true) {\n gen.code(_`${N.self}.logger.log(${msg})`)\n } else if (typeof opts.$comment == \"function\") {\n const schemaPath = str`${errSchemaPath}/$comment`\n const rootName = gen.scopeValue(\"root\", {ref: schemaEnv.root})\n gen.code(_`${N.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`)\n }\n}\n\nfunction returnResults(it: SchemaCxt): void {\n const {gen, schemaEnv, validateName, ValidationError, opts} = it\n if (schemaEnv.$async) {\n // TODO assign unevaluated\n gen.if(\n _`${N.errors} === 0`,\n () => gen.return(N.data),\n () => gen.throw(_`new ${ValidationError as Name}(${N.vErrors})`)\n )\n } else {\n gen.assign(_`${validateName}.errors`, N.vErrors)\n if (opts.unevaluated) assignEvaluated(it)\n gen.return(_`${N.errors} === 0`)\n }\n}\n\nfunction assignEvaluated({gen, evaluated, props, items}: SchemaCxt): void {\n if (props instanceof Name) gen.assign(_`${evaluated}.props`, props)\n if (items instanceof Name) gen.assign(_`${evaluated}.items`, items)\n}\n\nfunction schemaKeywords(\n it: SchemaObjCxt,\n types: JSONType[],\n typeErrors: boolean,\n errsCount?: Name\n): void {\n const {gen, schema, data, allErrors, opts, self} = it\n const {RULES} = self\n if (schema.$ref && (opts.ignoreKeywordsWithRef || !schemaHasRulesButRef(schema, RULES))) {\n gen.block(() => keywordCode(it, \"$ref\", (RULES.all.$ref as Rule).definition)) // TODO typecast\n return\n }\n if (!opts.jtd) checkStrictTypes(it, types)\n gen.block(() => {\n for (const group of RULES.rules) groupKeywords(group)\n groupKeywords(RULES.post)\n })\n\n function groupKeywords(group: RuleGroup): void {\n if (!shouldUseGroup(schema, group)) return\n if (group.type) {\n gen.if(checkDataType(group.type, data, opts.strictNumbers))\n iterateKeywords(it, group)\n if (types.length === 1 && types[0] === group.type && typeErrors) {\n gen.else()\n reportTypeError(it)\n }\n gen.endIf()\n } else {\n iterateKeywords(it, group)\n }\n // TODO make it \"ok\" call?\n if (!allErrors) gen.if(_`${N.errors} === ${errsCount || 0}`)\n }\n}\n\nfunction iterateKeywords(it: SchemaObjCxt, group: RuleGroup): void {\n const {\n gen,\n schema,\n opts: {useDefaults},\n } = it\n if (useDefaults) assignDefaults(it, group.type)\n gen.block(() => {\n for (const rule of group.rules) {\n if (shouldUseRule(schema, rule)) {\n keywordCode(it, rule.keyword, rule.definition, group.type)\n }\n }\n })\n}\n\nfunction checkStrictTypes(it: SchemaObjCxt, types: JSONType[]): void {\n if (it.schemaEnv.meta || !it.opts.strictTypes) return\n checkContextTypes(it, types)\n if (!it.opts.allowUnionTypes) checkMultipleTypes(it, types)\n checkKeywordTypes(it, it.dataTypes)\n}\n\nfunction checkContextTypes(it: SchemaObjCxt, types: JSONType[]): void {\n if (!types.length) return\n if (!it.dataTypes.length) {\n it.dataTypes = types\n return\n }\n types.forEach((t) => {\n if (!includesType(it.dataTypes, t)) {\n strictTypesError(it, `type \"${t}\" not allowed by context \"${it.dataTypes.join(\",\")}\"`)\n }\n })\n narrowSchemaTypes(it, types)\n}\n\nfunction checkMultipleTypes(it: SchemaObjCxt, ts: JSONType[]): void {\n if (ts.length > 1 && !(ts.length === 2 && ts.includes(\"null\"))) {\n strictTypesError(it, \"use allowUnionTypes to allow union type keyword\")\n }\n}\n\nfunction checkKeywordTypes(it: SchemaObjCxt, ts: JSONType[]): void {\n const rules = it.self.RULES.all\n for (const keyword in rules) {\n const rule = rules[keyword]\n if (typeof rule == \"object\" && shouldUseRule(it.schema, rule)) {\n const {type} = rule.definition\n if (type.length && !type.some((t) => hasApplicableType(ts, t))) {\n strictTypesError(it, `missing type \"${type.join(\",\")}\" for keyword \"${keyword}\"`)\n }\n }\n }\n}\n\nfunction hasApplicableType(schTs: JSONType[], kwdT: JSONType): boolean {\n return schTs.includes(kwdT) || (kwdT === \"number\" && schTs.includes(\"integer\"))\n}\n\nfunction includesType(ts: JSONType[], t: JSONType): boolean {\n return ts.includes(t) || (t === \"integer\" && ts.includes(\"number\"))\n}\n\nfunction narrowSchemaTypes(it: SchemaObjCxt, withTypes: JSONType[]): void {\n const ts: JSONType[] = []\n for (const t of it.dataTypes) {\n if (includesType(withTypes, t)) ts.push(t)\n else if (withTypes.includes(\"integer\") && t === \"number\") ts.push(\"integer\")\n }\n it.dataTypes = ts\n}\n\nfunction strictTypesError(it: SchemaObjCxt, msg: string): void {\n const schemaPath = it.schemaEnv.baseId + it.errSchemaPath\n msg += ` at \"${schemaPath}\" (strictTypes)`\n checkStrictMode(it, msg, it.opts.strictTypes)\n}\n\nexport class KeywordCxt implements KeywordErrorCxt {\n readonly gen: CodeGen\n readonly allErrors?: boolean\n readonly keyword: string\n readonly data: Name // Name referencing the current level of the data instance\n readonly $data?: string | false\n schema: any // keyword value in the schema\n readonly schemaValue: Code | number | boolean // Code reference to keyword schema value or primitive value\n readonly schemaCode: Code | number | boolean // Code reference to resolved schema value (different if schema is $data)\n readonly schemaType: JSONType[] // allowed type(s) of keyword value in the schema\n readonly parentSchema: AnySchemaObject\n readonly errsCount?: Name // Name reference to the number of validation errors collected before this keyword,\n // requires option trackErrors in keyword definition\n params: KeywordCxtParams // object to pass parameters to error messages from keyword code\n readonly it: SchemaObjCxt // schema compilation context (schema is guaranteed to be an object, not boolean)\n readonly def: AddedKeywordDefinition\n\n constructor(it: SchemaObjCxt, def: AddedKeywordDefinition, keyword: string) {\n validateKeywordUsage(it, def, keyword)\n this.gen = it.gen\n this.allErrors = it.allErrors\n this.keyword = keyword\n this.data = it.data\n this.schema = it.schema[keyword]\n this.$data = def.$data && it.opts.$data && this.schema && this.schema.$data\n this.schemaValue = schemaRefOrVal(it, this.schema, keyword, this.$data)\n this.schemaType = def.schemaType\n this.parentSchema = it.schema\n this.params = {}\n this.it = it\n this.def = def\n\n if (this.$data) {\n this.schemaCode = it.gen.const(\"vSchema\", getData(this.$data, it))\n } else {\n this.schemaCode = this.schemaValue\n if (!validSchemaType(this.schema, def.schemaType, def.allowUndefined)) {\n throw new Error(`${keyword} value must be ${JSON.stringify(def.schemaType)}`)\n }\n }\n\n if (\"code\" in def ? def.trackErrors : def.errors !== false) {\n this.errsCount = it.gen.const(\"_errs\", N.errors)\n }\n }\n\n result(condition: Code, successAction?: () => void, failAction?: () => void): void {\n this.failResult(not(condition), successAction, failAction)\n }\n\n failResult(condition: Code, successAction?: () => void, failAction?: () => void): void {\n this.gen.if(condition)\n if (failAction) failAction()\n else this.error()\n if (successAction) {\n this.gen.else()\n successAction()\n if (this.allErrors) this.gen.endIf()\n } else {\n if (this.allErrors) this.gen.endIf()\n else this.gen.else()\n }\n }\n\n pass(condition: Code, failAction?: () => void): void {\n this.failResult(not(condition), undefined, failAction)\n }\n\n fail(condition?: Code): void {\n if (condition === undefined) {\n this.error()\n if (!this.allErrors) this.gen.if(false) // this branch will be removed by gen.optimize\n return\n }\n this.gen.if(condition)\n this.error()\n if (this.allErrors) this.gen.endIf()\n else this.gen.else()\n }\n\n fail$data(condition: Code): void {\n if (!this.$data) return this.fail(condition)\n const {schemaCode} = this\n this.fail(_`${schemaCode} !== undefined && (${or(this.invalid$data(), condition)})`)\n }\n\n error(append?: boolean, errorParams?: KeywordCxtParams, errorPaths?: ErrorPaths): void {\n if (errorParams) {\n this.setParams(errorParams)\n this._error(append, errorPaths)\n this.setParams({})\n return\n }\n this._error(append, errorPaths)\n }\n\n private _error(append?: boolean, errorPaths?: ErrorPaths): void {\n ;(append ? reportExtraError : reportError)(this, this.def.error, errorPaths)\n }\n\n $dataError(): void {\n reportError(this, this.def.$dataError || keyword$DataError)\n }\n\n reset(): void {\n if (this.errsCount === undefined) throw new Error('add \"trackErrors\" to keyword definition')\n resetErrorsCount(this.gen, this.errsCount)\n }\n\n ok(cond: Code | boolean): void {\n if (!this.allErrors) this.gen.if(cond)\n }\n\n setParams(obj: KeywordCxtParams, assign?: true): void {\n if (assign) Object.assign(this.params, obj)\n else this.params = obj\n }\n\n block$data(valid: Name, codeBlock: () => void, $dataValid: Code = nil): void {\n this.gen.block(() => {\n this.check$data(valid, $dataValid)\n codeBlock()\n })\n }\n\n check$data(valid: Name = nil, $dataValid: Code = nil): void {\n if (!this.$data) return\n const {gen, schemaCode, schemaType, def} = this\n gen.if(or(_`${schemaCode} === undefined`, $dataValid))\n if (valid !== nil) gen.assign(valid, true)\n if (schemaType.length || def.validateSchema) {\n gen.elseIf(this.invalid$data())\n this.$dataError()\n if (valid !== nil) gen.assign(valid, false)\n }\n gen.else()\n }\n\n invalid$data(): Code {\n const {gen, schemaCode, schemaType, def, it} = this\n return or(wrong$DataType(), invalid$DataSchema())\n\n function wrong$DataType(): Code {\n if (schemaType.length) {\n /* istanbul ignore if */\n if (!(schemaCode instanceof Name)) throw new Error(\"ajv implementation error\")\n const st = Array.isArray(schemaType) ? schemaType : [schemaType]\n return _`${checkDataTypes(st, schemaCode, it.opts.strictNumbers, DataType.Wrong)}`\n }\n return nil\n }\n\n function invalid$DataSchema(): Code {\n if (def.validateSchema) {\n const validateSchemaRef = gen.scopeValue(\"validate$data\", {ref: def.validateSchema}) // TODO value.code for standalone\n return _`!${validateSchemaRef}(${schemaCode})`\n }\n return nil\n }\n }\n\n subschema(appl: SubschemaArgs, valid: Name): SchemaCxt {\n const subschema = getSubschema(this.it, appl)\n extendSubschemaData(subschema, this.it, appl)\n extendSubschemaMode(subschema, appl)\n const nextContext = {...this.it, ...subschema, items: undefined, props: undefined}\n subschemaCode(nextContext, valid)\n return nextContext\n }\n\n mergeEvaluated(schemaCxt: SchemaCxt, toName?: typeof Name): void {\n const {it, gen} = this\n if (!it.opts.unevaluated) return\n if (it.props !== true && schemaCxt.props !== undefined) {\n it.props = mergeEvaluated.props(gen, schemaCxt.props, it.props, toName)\n }\n if (it.items !== true && schemaCxt.items !== undefined) {\n it.items = mergeEvaluated.items(gen, schemaCxt.items, it.items, toName)\n }\n }\n\n mergeValidEvaluated(schemaCxt: SchemaCxt, valid: Name): boolean | void {\n const {it, gen} = this\n if (it.opts.unevaluated && (it.props !== true || it.items !== true)) {\n gen.if(valid, () => this.mergeEvaluated(schemaCxt, Name))\n return true\n }\n }\n}\n\nfunction keywordCode(\n it: SchemaObjCxt,\n keyword: string,\n def: AddedKeywordDefinition,\n ruleType?: JSONType\n): void {\n const cxt = new KeywordCxt(it, def, keyword)\n if (\"code\" in def) {\n def.code(cxt, ruleType)\n } else if (cxt.$data && def.validate) {\n funcKeywordCode(cxt, def)\n } else if (\"macro\" in def) {\n macroKeywordCode(cxt, def)\n } else if (def.compile || def.validate) {\n funcKeywordCode(cxt, def)\n }\n}\n\nconst JSON_POINTER = /^\\/(?:[^~]|~0|~1)*$/\nconst RELATIVE_JSON_POINTER = /^([0-9]+)(#|\\/(?:[^~]|~0|~1)*)?$/\nexport function getData(\n $data: string,\n {dataLevel, dataNames, dataPathArr}: SchemaCxt\n): Code | number {\n let jsonPointer\n let data: Code\n if ($data === \"\") return N.rootData\n if ($data[0] === \"/\") {\n if (!JSON_POINTER.test($data)) throw new Error(`Invalid JSON-pointer: ${$data}`)\n jsonPointer = $data\n data = N.rootData\n } else {\n const matches = RELATIVE_JSON_POINTER.exec($data)\n if (!matches) throw new Error(`Invalid JSON-pointer: ${$data}`)\n const up: number = +matches[1]\n jsonPointer = matches[2]\n if (jsonPointer === \"#\") {\n if (up >= dataLevel) throw new Error(errorMsg(\"property/index\", up))\n return dataPathArr[dataLevel - up]\n }\n if (up > dataLevel) throw new Error(errorMsg(\"data\", up))\n data = dataNames[dataLevel - up]\n if (!jsonPointer) return data\n }\n\n let expr = data\n const segments = jsonPointer.split(\"/\")\n for (const segment of segments) {\n if (segment) {\n data = _`${data}${getProperty(unescapeJsonPointer(segment))}`\n expr = _`${expr} && ${data}`\n }\n }\n return expr\n\n function errorMsg(pointerType: string, up: number): string {\n return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`\n }\n}\n","import type {KeywordCxt} from \".\"\nimport type {\n AnySchema,\n SchemaValidateFunction,\n AnyValidateFunction,\n AddedKeywordDefinition,\n MacroKeywordDefinition,\n FuncKeywordDefinition,\n} from \"../../types\"\nimport type {SchemaObjCxt} from \"..\"\nimport {_, nil, not, stringify, Code, Name, CodeGen} from \"../codegen\"\nimport N from \"../names\"\nimport type {JSONType} from \"../rules\"\nimport {callValidateCode} from \"../../vocabularies/code\"\nimport {extendErrors} from \"../errors\"\n\ntype KeywordCompilationResult = AnySchema | SchemaValidateFunction | AnyValidateFunction\n\nexport function macroKeywordCode(cxt: KeywordCxt, def: MacroKeywordDefinition): void {\n const {gen, keyword, schema, parentSchema, it} = cxt\n const macroSchema = def.macro.call(it.self, schema, parentSchema, it)\n const schemaRef = useKeyword(gen, keyword, macroSchema)\n if (it.opts.validateSchema !== false) it.self.validateSchema(macroSchema, true)\n\n const valid = gen.name(\"valid\")\n cxt.subschema(\n {\n schema: macroSchema,\n schemaPath: nil,\n errSchemaPath: `${it.errSchemaPath}/${keyword}`,\n topSchemaRef: schemaRef,\n compositeRule: true,\n },\n valid\n )\n cxt.pass(valid, () => cxt.error(true))\n}\n\nexport function funcKeywordCode(cxt: KeywordCxt, def: FuncKeywordDefinition): void {\n const {gen, keyword, schema, parentSchema, $data, it} = cxt\n checkAsyncKeyword(it, def)\n const validate =\n !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate\n const validateRef = useKeyword(gen, keyword, validate)\n const valid = gen.let(\"valid\")\n cxt.block$data(valid, validateKeyword)\n cxt.ok(def.valid ?? valid)\n\n function validateKeyword(): void {\n if (def.errors === false) {\n assignValid()\n if (def.modifying) modifyData(cxt)\n reportErrs(() => cxt.error())\n } else {\n const ruleErrs = def.async ? validateAsync() : validateSync()\n if (def.modifying) modifyData(cxt)\n reportErrs(() => addErrs(cxt, ruleErrs))\n }\n }\n\n function validateAsync(): Name {\n const ruleErrs = gen.let(\"ruleErrs\", null)\n gen.try(\n () => assignValid(_`await `),\n (e) =>\n gen.assign(valid, false).if(\n _`${e} instanceof ${it.ValidationError as Name}`,\n () => gen.assign(ruleErrs, _`${e}.errors`),\n () => gen.throw(e)\n )\n )\n return ruleErrs\n }\n\n function validateSync(): Code {\n const validateErrs = _`${validateRef}.errors`\n gen.assign(validateErrs, null)\n assignValid(nil)\n return validateErrs\n }\n\n function assignValid(_await: Code = def.async ? _`await ` : nil): void {\n const passCxt = it.opts.passContext ? N.this : N.self\n const passSchema = !((\"compile\" in def && !$data) || def.schema === false)\n gen.assign(\n valid,\n _`${_await}${callValidateCode(cxt, validateRef, passCxt, passSchema)}`,\n def.modifying\n )\n }\n\n function reportErrs(errors: () => void): void {\n gen.if(not(def.valid ?? valid), errors)\n }\n}\n\nfunction modifyData(cxt: KeywordCxt): void {\n const {gen, data, it} = cxt\n gen.if(it.parentData, () => gen.assign(data, _`${it.parentData}[${it.parentDataProperty}]`))\n}\n\nfunction addErrs(cxt: KeywordCxt, errs: Code): void {\n const {gen} = cxt\n gen.if(\n _`Array.isArray(${errs})`,\n () => {\n gen\n .assign(N.vErrors, _`${N.vErrors} === null ? ${errs} : ${N.vErrors}.concat(${errs})`)\n .assign(N.errors, _`${N.vErrors}.length`)\n extendErrors(cxt)\n },\n () => cxt.error()\n )\n}\n\nfunction checkAsyncKeyword({schemaEnv}: SchemaObjCxt, def: FuncKeywordDefinition): void {\n if (def.async && !schemaEnv.$async) throw new Error(\"async keyword in sync schema\")\n}\n\nfunction useKeyword(gen: CodeGen, keyword: string, result?: KeywordCompilationResult): Name {\n if (result === undefined) throw new Error(`keyword \"${keyword}\" failed to compile`)\n return gen.scopeValue(\n \"keyword\",\n typeof result == \"function\" ? {ref: result} : {ref: result, code: stringify(result)}\n )\n}\n\nexport function validSchemaType(\n schema: unknown,\n schemaType: JSONType[],\n allowUndefined = false\n): boolean {\n // TODO add tests\n return (\n !schemaType.length ||\n schemaType.some((st) =>\n st === \"array\"\n ? Array.isArray(schema)\n : st === \"object\"\n ? schema && typeof schema == \"object\" && !Array.isArray(schema)\n : typeof schema == st || (allowUndefined && typeof schema == \"undefined\")\n )\n )\n}\n\nexport function validateKeywordUsage(\n {schema, opts, self, errSchemaPath}: SchemaObjCxt,\n def: AddedKeywordDefinition,\n keyword: string\n): void {\n /* istanbul ignore if */\n if (Array.isArray(def.keyword) ? !def.keyword.includes(keyword) : def.keyword !== keyword) {\n throw new Error(\"ajv implementation error\")\n }\n\n const deps = def.dependencies\n if (deps?.some((kwd) => !Object.prototype.hasOwnProperty.call(schema, kwd))) {\n throw new Error(`parent schema must have dependencies of ${keyword}: ${deps.join(\",\")}`)\n }\n\n if (def.validateSchema) {\n const valid = def.validateSchema(schema[keyword])\n if (!valid) {\n const msg =\n `keyword \"${keyword}\" value is invalid at path \"${errSchemaPath}\": ` +\n self.errorsText(def.validateSchema.errors)\n if (opts.validateSchema === \"log\") self.logger.error(msg)\n else throw new Error(msg)\n }\n }\n}\n","import type {AnySchema} from \"../../types\"\nimport type {SchemaObjCxt} from \"..\"\nimport {_, str, getProperty, Code, Name} from \"../codegen\"\nimport {escapeFragment, getErrorPath, Type} from \"../util\"\nimport type {JSONType} from \"../rules\"\n\nexport interface SubschemaContext {\n // TODO use Optional? align with SchemCxt property types\n schema: AnySchema\n schemaPath: Code\n errSchemaPath: string\n topSchemaRef?: Code\n errorPath?: Code\n dataLevel?: number\n dataTypes?: JSONType[]\n data?: Name\n parentData?: Name\n parentDataProperty?: Code | number\n dataNames?: Name[]\n dataPathArr?: (Code | number)[]\n propertyName?: Name\n jtdDiscriminator?: string\n jtdMetadata?: boolean\n compositeRule?: true\n createErrors?: boolean\n allErrors?: boolean\n}\n\nexport type SubschemaArgs = Partial<{\n keyword: string\n schemaProp: string | number\n schema: AnySchema\n schemaPath: Code\n errSchemaPath: string\n topSchemaRef: Code\n data: Name | Code\n dataProp: Code | string | number\n dataTypes: JSONType[]\n definedProperties: Set\n propertyName: Name\n dataPropType: Type\n jtdDiscriminator: string\n jtdMetadata: boolean\n compositeRule: true\n createErrors: boolean\n allErrors: boolean\n}>\n\nexport function getSubschema(\n it: SchemaObjCxt,\n {keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef}: SubschemaArgs\n): SubschemaContext {\n if (keyword !== undefined && schema !== undefined) {\n throw new Error('both \"keyword\" and \"schema\" passed, only one allowed')\n }\n\n if (keyword !== undefined) {\n const sch = it.schema[keyword]\n return schemaProp === undefined\n ? {\n schema: sch,\n schemaPath: _`${it.schemaPath}${getProperty(keyword)}`,\n errSchemaPath: `${it.errSchemaPath}/${keyword}`,\n }\n : {\n schema: sch[schemaProp],\n schemaPath: _`${it.schemaPath}${getProperty(keyword)}${getProperty(schemaProp)}`,\n errSchemaPath: `${it.errSchemaPath}/${keyword}/${escapeFragment(schemaProp)}`,\n }\n }\n\n if (schema !== undefined) {\n if (schemaPath === undefined || errSchemaPath === undefined || topSchemaRef === undefined) {\n throw new Error('\"schemaPath\", \"errSchemaPath\" and \"topSchemaRef\" are required with \"schema\"')\n }\n return {\n schema,\n schemaPath,\n topSchemaRef,\n errSchemaPath,\n }\n }\n\n throw new Error('either \"keyword\" or \"schema\" must be passed')\n}\n\nexport function extendSubschemaData(\n subschema: SubschemaContext,\n it: SchemaObjCxt,\n {dataProp, dataPropType: dpType, data, dataTypes, propertyName}: SubschemaArgs\n): void {\n if (data !== undefined && dataProp !== undefined) {\n throw new Error('both \"data\" and \"dataProp\" passed, only one allowed')\n }\n\n const {gen} = it\n\n if (dataProp !== undefined) {\n const {errorPath, dataPathArr, opts} = it\n const nextData = gen.let(\"data\", _`${it.data}${getProperty(dataProp)}`, true)\n dataContextProps(nextData)\n subschema.errorPath = str`${errorPath}${getErrorPath(dataProp, dpType, opts.jsPropertySyntax)}`\n subschema.parentDataProperty = _`${dataProp}`\n subschema.dataPathArr = [...dataPathArr, subschema.parentDataProperty]\n }\n\n if (data !== undefined) {\n const nextData = data instanceof Name ? data : gen.let(\"data\", data, true) // replaceable if used once?\n dataContextProps(nextData)\n if (propertyName !== undefined) subschema.propertyName = propertyName\n // TODO something is possibly wrong here with not changing parentDataProperty and not appending dataPathArr\n }\n\n if (dataTypes) subschema.dataTypes = dataTypes\n\n function dataContextProps(_nextData: Name): void {\n subschema.data = _nextData\n subschema.dataLevel = it.dataLevel + 1\n subschema.dataTypes = []\n it.definedProperties = new Set()\n subschema.parentData = it.data\n subschema.dataNames = [...it.dataNames, _nextData]\n }\n}\n\nexport function extendSubschemaMode(\n subschema: SubschemaContext,\n {jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors}: SubschemaArgs\n): void {\n if (compositeRule !== undefined) subschema.compositeRule = compositeRule\n if (createErrors !== undefined) subschema.createErrors = createErrors\n if (allErrors !== undefined) subschema.allErrors = allErrors\n subschema.jtdDiscriminator = jtdDiscriminator // not inherited\n subschema.jtdMetadata = jtdMetadata // not inherited\n}\n","export {\n Format,\n FormatDefinition,\n AsyncFormatDefinition,\n KeywordDefinition,\n KeywordErrorDefinition,\n CodeKeywordDefinition,\n MacroKeywordDefinition,\n FuncKeywordDefinition,\n Vocabulary,\n Schema,\n SchemaObject,\n AnySchemaObject,\n AsyncSchema,\n AnySchema,\n ValidateFunction,\n AsyncValidateFunction,\n AnyValidateFunction,\n ErrorObject,\n ErrorNoParams,\n} from \"./types\"\n\nexport {SchemaCxt, SchemaObjCxt} from \"./compile\"\nexport interface Plugin {\n (ajv: Ajv, options?: Opts): Ajv\n [prop: string]: any\n}\n\nexport {KeywordCxt} from \"./compile/validate\"\nexport {DefinedError} from \"./vocabularies/errors\"\nexport {JSONType} from \"./compile/rules\"\nexport {JSONSchemaType} from \"./types/json-schema\"\nexport {JTDSchemaType, SomeJTDSchemaType, JTDDataType} from \"./types/jtd-schema\"\nexport {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from \"./compile/codegen\"\n\nimport type {\n Schema,\n AnySchema,\n AnySchemaObject,\n SchemaObject,\n AsyncSchema,\n Vocabulary,\n KeywordDefinition,\n AddedKeywordDefinition,\n AnyValidateFunction,\n ValidateFunction,\n AsyncValidateFunction,\n ErrorObject,\n Format,\n AddedFormat,\n RegExpEngine,\n UriResolver,\n} from \"./types\"\nimport type {JSONSchemaType} from \"./types/json-schema\"\nimport type {JTDSchemaType, SomeJTDSchemaType, JTDDataType} from \"./types/jtd-schema\"\nimport ValidationError from \"./runtime/validation_error\"\nimport MissingRefError from \"./compile/ref_error\"\nimport {getRules, ValidationRules, Rule, RuleGroup, JSONType} from \"./compile/rules\"\nimport {SchemaEnv, compileSchema, resolveSchema} from \"./compile\"\nimport {Code, ValueScope} from \"./compile/codegen\"\nimport {normalizeId, getSchemaRefs} from \"./compile/resolve\"\nimport {getJSONTypes} from \"./compile/validate/dataType\"\nimport {eachItem} from \"./compile/util\"\nimport * as $dataRefSchema from \"./refs/data.json\"\n\nimport DefaultUriResolver from \"./runtime/uri\"\n\nconst defaultRegExp: RegExpEngine = (str, flags) => new RegExp(str, flags)\ndefaultRegExp.code = \"new RegExp\"\n\nconst META_IGNORE_OPTIONS: (keyof Options)[] = [\"removeAdditional\", \"useDefaults\", \"coerceTypes\"]\nconst EXT_SCOPE_NAMES = new Set([\n \"validate\",\n \"serialize\",\n \"parse\",\n \"wrapper\",\n \"root\",\n \"schema\",\n \"keyword\",\n \"pattern\",\n \"formats\",\n \"validate$data\",\n \"func\",\n \"obj\",\n \"Error\",\n])\n\nexport type Options = CurrentOptions & DeprecatedOptions\n\nexport interface CurrentOptions {\n // strict mode options (NEW)\n strict?: boolean | \"log\"\n strictSchema?: boolean | \"log\"\n strictNumbers?: boolean | \"log\"\n strictTypes?: boolean | \"log\"\n strictTuples?: boolean | \"log\"\n strictRequired?: boolean | \"log\"\n allowMatchingProperties?: boolean // disables a strict mode restriction\n allowUnionTypes?: boolean\n validateFormats?: boolean\n // validation and reporting options:\n $data?: boolean\n allErrors?: boolean\n verbose?: boolean\n discriminator?: boolean\n unicodeRegExp?: boolean\n timestamp?: \"string\" | \"date\" // JTD only\n parseDate?: boolean // JTD only\n allowDate?: boolean // JTD only\n $comment?:\n | true\n | ((comment: string, schemaPath?: string, rootSchema?: AnySchemaObject) => unknown)\n formats?: {[Name in string]?: Format}\n keywords?: Vocabulary\n schemas?: AnySchema[] | {[Key in string]?: AnySchema}\n logger?: Logger | false\n loadSchema?: (uri: string) => Promise\n // options to modify validated data:\n removeAdditional?: boolean | \"all\" | \"failing\"\n useDefaults?: boolean | \"empty\"\n coerceTypes?: boolean | \"array\"\n // advanced options:\n next?: boolean // NEW\n unevaluated?: boolean // NEW\n dynamicRef?: boolean // NEW\n schemaId?: \"id\" | \"$id\"\n jtd?: boolean // NEW\n meta?: SchemaObject | boolean\n defaultMeta?: string | AnySchemaObject\n validateSchema?: boolean | \"log\"\n addUsedSchema?: boolean\n inlineRefs?: boolean | number\n passContext?: boolean\n loopRequired?: number\n loopEnum?: number // NEW\n ownProperties?: boolean\n multipleOfPrecision?: number\n int32range?: boolean // JTD only\n messages?: boolean\n code?: CodeOptions // NEW\n uriResolver?: UriResolver\n}\n\nexport interface CodeOptions {\n es5?: boolean\n esm?: boolean\n lines?: boolean\n optimize?: boolean | number\n formats?: Code // code to require (or construct) map of available formats - for standalone code\n source?: boolean\n process?: (code: string, schema?: SchemaEnv) => string\n regExp?: RegExpEngine\n}\n\ninterface InstanceCodeOptions extends CodeOptions {\n regExp: RegExpEngine\n optimize: number\n}\n\ninterface DeprecatedOptions {\n /** @deprecated */\n ignoreKeywordsWithRef?: boolean\n /** @deprecated */\n jsPropertySyntax?: boolean // added instead of jsonPointers\n /** @deprecated */\n unicode?: boolean\n}\n\ninterface RemovedOptions {\n format?: boolean\n errorDataPath?: \"object\" | \"property\"\n nullable?: boolean // \"nullable\" keyword is supported by default\n jsonPointers?: boolean\n extendRefs?: true | \"ignore\" | \"fail\"\n missingRefs?: true | \"ignore\" | \"fail\"\n processCode?: (code: string, schema?: SchemaEnv) => string\n sourceCode?: boolean\n strictDefaults?: boolean\n strictKeywords?: boolean\n uniqueItems?: boolean\n unknownFormats?: true | string[] | \"ignore\"\n cache?: any\n serialize?: (schema: AnySchema) => unknown\n ajvErrors?: boolean\n}\n\ntype OptionsInfo = {\n [K in keyof T]-?: string | undefined\n}\n\nconst removedOptions: OptionsInfo = {\n errorDataPath: \"\",\n format: \"`validateFormats: false` can be used instead.\",\n nullable: '\"nullable\" keyword is supported by default.',\n jsonPointers: \"Deprecated jsPropertySyntax can be used instead.\",\n extendRefs: \"Deprecated ignoreKeywordsWithRef can be used instead.\",\n missingRefs: \"Pass empty schema with $id that should be ignored to ajv.addSchema.\",\n processCode: \"Use option `code: {process: (code, schemaEnv: object) => string}`\",\n sourceCode: \"Use option `code: {source: true}`\",\n strictDefaults: \"It is default now, see option `strict`.\",\n strictKeywords: \"It is default now, see option `strict`.\",\n uniqueItems: '\"uniqueItems\" keyword is always validated.',\n unknownFormats: \"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).\",\n cache: \"Map is used as cache, schema object as key.\",\n serialize: \"Map is used as cache, schema object as key.\",\n ajvErrors: \"It is default now.\",\n}\n\nconst deprecatedOptions: OptionsInfo = {\n ignoreKeywordsWithRef: \"\",\n jsPropertySyntax: \"\",\n unicode: '\"minLength\"/\"maxLength\" account for unicode characters by default.',\n}\n\ntype RequiredInstanceOptions = {\n [K in\n | \"strictSchema\"\n | \"strictNumbers\"\n | \"strictTypes\"\n | \"strictTuples\"\n | \"strictRequired\"\n | \"inlineRefs\"\n | \"loopRequired\"\n | \"loopEnum\"\n | \"meta\"\n | \"messages\"\n | \"schemaId\"\n | \"addUsedSchema\"\n | \"validateSchema\"\n | \"validateFormats\"\n | \"int32range\"\n | \"unicodeRegExp\"\n | \"uriResolver\"]: NonNullable\n} & {code: InstanceCodeOptions}\n\nexport type InstanceOptions = Options & RequiredInstanceOptions\n\nconst MAX_EXPRESSION = 200\n\n// eslint-disable-next-line complexity\nfunction requiredOptions(o: Options): RequiredInstanceOptions {\n const s = o.strict\n const _optz = o.code?.optimize\n const optimize = _optz === true || _optz === undefined ? 1 : _optz || 0\n const regExp = o.code?.regExp ?? defaultRegExp\n const uriResolver = o.uriResolver ?? DefaultUriResolver\n return {\n strictSchema: o.strictSchema ?? s ?? true,\n strictNumbers: o.strictNumbers ?? s ?? true,\n strictTypes: o.strictTypes ?? s ?? \"log\",\n strictTuples: o.strictTuples ?? s ?? \"log\",\n strictRequired: o.strictRequired ?? s ?? false,\n code: o.code ? {...o.code, optimize, regExp} : {optimize, regExp},\n loopRequired: o.loopRequired ?? MAX_EXPRESSION,\n loopEnum: o.loopEnum ?? MAX_EXPRESSION,\n meta: o.meta ?? true,\n messages: o.messages ?? true,\n inlineRefs: o.inlineRefs ?? true,\n schemaId: o.schemaId ?? \"$id\",\n addUsedSchema: o.addUsedSchema ?? true,\n validateSchema: o.validateSchema ?? true,\n validateFormats: o.validateFormats ?? true,\n unicodeRegExp: o.unicodeRegExp ?? true,\n int32range: o.int32range ?? true,\n uriResolver: uriResolver,\n }\n}\n\nexport interface Logger {\n log(...args: unknown[]): unknown\n warn(...args: unknown[]): unknown\n error(...args: unknown[]): unknown\n}\n\nexport default class Ajv {\n opts: InstanceOptions\n errors?: ErrorObject[] | null // errors from the last validation\n logger: Logger\n // shared external scope values for compiled functions\n readonly scope: ValueScope\n readonly schemas: {[Key in string]?: SchemaEnv} = {}\n readonly refs: {[Ref in string]?: SchemaEnv | string} = {}\n readonly formats: {[Name in string]?: AddedFormat} = {}\n readonly RULES: ValidationRules\n readonly _compilations: Set = new Set()\n private readonly _loading: {[Ref in string]?: Promise} = {}\n private readonly _cache: Map = new Map()\n private readonly _metaOpts: InstanceOptions\n\n static ValidationError = ValidationError\n static MissingRefError = MissingRefError\n\n constructor(opts: Options = {}) {\n opts = this.opts = {...opts, ...requiredOptions(opts)}\n const {es5, lines} = this.opts.code\n\n this.scope = new ValueScope({scope: {}, prefixes: EXT_SCOPE_NAMES, es5, lines})\n this.logger = getLogger(opts.logger)\n const formatOpt = opts.validateFormats\n opts.validateFormats = false\n\n this.RULES = getRules()\n checkOptions.call(this, removedOptions, opts, \"NOT SUPPORTED\")\n checkOptions.call(this, deprecatedOptions, opts, \"DEPRECATED\", \"warn\")\n this._metaOpts = getMetaSchemaOptions.call(this)\n\n if (opts.formats) addInitialFormats.call(this)\n this._addVocabularies()\n this._addDefaultMetaSchema()\n if (opts.keywords) addInitialKeywords.call(this, opts.keywords)\n if (typeof opts.meta == \"object\") this.addMetaSchema(opts.meta)\n addInitialSchemas.call(this)\n opts.validateFormats = formatOpt\n }\n\n _addVocabularies(): void {\n this.addKeyword(\"$async\")\n }\n\n _addDefaultMetaSchema(): void {\n const {$data, meta, schemaId} = this.opts\n let _dataRefSchema: SchemaObject = $dataRefSchema\n if (schemaId === \"id\") {\n _dataRefSchema = {...$dataRefSchema}\n _dataRefSchema.id = _dataRefSchema.$id\n delete _dataRefSchema.$id\n }\n if (meta && $data) this.addMetaSchema(_dataRefSchema, _dataRefSchema[schemaId], false)\n }\n\n defaultMeta(): string | AnySchemaObject | undefined {\n const {meta, schemaId} = this.opts\n return (this.opts.defaultMeta = typeof meta == \"object\" ? meta[schemaId] || meta : undefined)\n }\n\n // Validate data using schema\n // AnySchema will be compiled and cached using schema itself as a key for Map\n validate(schema: Schema | string, data: unknown): boolean\n validate(schemaKeyRef: AnySchema | string, data: unknown): boolean | Promise\n validate(schema: Schema | JSONSchemaType | string, data: unknown): data is T\n // Separated for type inference to work\n // eslint-disable-next-line @typescript-eslint/unified-signatures\n validate(schema: JTDSchemaType, data: unknown): data is T\n // This overload is only intended for typescript inference, the first\n // argument prevents manual type annotation from matching this overload\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n validate(\n schema: T,\n data: unknown\n ): data is JTDDataType\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n validate(schema: AsyncSchema, data: unknown | T): Promise\n validate(schemaKeyRef: AnySchema | string, data: unknown): data is T | Promise\n validate(\n schemaKeyRef: AnySchema | string, // key, ref or schema object\n // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents\n data: unknown | T // to be validated\n ): boolean | Promise {\n let v: AnyValidateFunction | undefined\n if (typeof schemaKeyRef == \"string\") {\n v = this.getSchema(schemaKeyRef)\n if (!v) throw new Error(`no schema with key or ref \"${schemaKeyRef}\"`)\n } else {\n v = this.compile(schemaKeyRef)\n }\n\n const valid = v(data)\n if (!(\"$async\" in v)) this.errors = v.errors\n return valid\n }\n\n // Create validation function for passed schema\n // _meta: true if schema is a meta-schema. Used internally to compile meta schemas of user-defined keywords.\n compile(schema: Schema | JSONSchemaType, _meta?: boolean): ValidateFunction\n // Separated for type inference to work\n // eslint-disable-next-line @typescript-eslint/unified-signatures\n compile(schema: JTDSchemaType, _meta?: boolean): ValidateFunction\n // This overload is only intended for typescript inference, the first\n // argument prevents manual type annotation from matching this overload\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n compile(\n schema: T,\n _meta?: boolean\n ): ValidateFunction>\n compile(schema: AsyncSchema, _meta?: boolean): AsyncValidateFunction\n compile(schema: AnySchema, _meta?: boolean): AnyValidateFunction\n compile(schema: AnySchema, _meta?: boolean): AnyValidateFunction {\n const sch = this._addSchema(schema, _meta)\n return (sch.validate || this._compileSchemaEnv(sch)) as AnyValidateFunction\n }\n\n // Creates validating function for passed schema with asynchronous loading of missing schemas.\n // `loadSchema` option should be a function that accepts schema uri and returns promise that resolves with the schema.\n // TODO allow passing schema URI\n // meta - optional true to compile meta-schema\n compileAsync(\n schema: SchemaObject | JSONSchemaType,\n _meta?: boolean\n ): Promise>\n // Separated for type inference to work\n // eslint-disable-next-line @typescript-eslint/unified-signatures\n compileAsync(schema: JTDSchemaType, _meta?: boolean): Promise>\n compileAsync(schema: AsyncSchema, meta?: boolean): Promise>\n // eslint-disable-next-line @typescript-eslint/unified-signatures\n compileAsync(\n schema: AnySchemaObject,\n meta?: boolean\n ): Promise>\n compileAsync(\n schema: AnySchemaObject,\n meta?: boolean\n ): Promise> {\n if (typeof this.opts.loadSchema != \"function\") {\n throw new Error(\"options.loadSchema should be a function\")\n }\n const {loadSchema} = this.opts\n return runCompileAsync.call(this, schema, meta)\n\n async function runCompileAsync(\n this: Ajv,\n _schema: AnySchemaObject,\n _meta?: boolean\n ): Promise {\n await loadMetaSchema.call(this, _schema.$schema)\n const sch = this._addSchema(_schema, _meta)\n return sch.validate || _compileAsync.call(this, sch)\n }\n\n async function loadMetaSchema(this: Ajv, $ref?: string): Promise {\n if ($ref && !this.getSchema($ref)) {\n await runCompileAsync.call(this, {$ref}, true)\n }\n }\n\n async function _compileAsync(this: Ajv, sch: SchemaEnv): Promise {\n try {\n return this._compileSchemaEnv(sch)\n } catch (e) {\n if (!(e instanceof MissingRefError)) throw e\n checkLoaded.call(this, e)\n await loadMissingSchema.call(this, e.missingSchema)\n return _compileAsync.call(this, sch)\n }\n }\n\n function checkLoaded(this: Ajv, {missingSchema: ref, missingRef}: MissingRefError): void {\n if (this.refs[ref]) {\n throw new Error(`AnySchema ${ref} is loaded but ${missingRef} cannot be resolved`)\n }\n }\n\n async function loadMissingSchema(this: Ajv, ref: string): Promise {\n const _schema = await _loadSchema.call(this, ref)\n if (!this.refs[ref]) await loadMetaSchema.call(this, _schema.$schema)\n if (!this.refs[ref]) this.addSchema(_schema, ref, meta)\n }\n\n async function _loadSchema(this: Ajv, ref: string): Promise {\n const p = this._loading[ref]\n if (p) return p\n try {\n return await (this._loading[ref] = loadSchema(ref))\n } finally {\n delete this._loading[ref]\n }\n }\n }\n\n // Adds schema to the instance\n addSchema(\n schema: AnySchema | AnySchema[], // If array is passed, `key` will be ignored\n key?: string, // Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.\n _meta?: boolean, // true if schema is a meta-schema. Used internally, addMetaSchema should be used instead.\n _validateSchema = this.opts.validateSchema // false to skip schema validation. Used internally, option validateSchema should be used instead.\n ): Ajv {\n if (Array.isArray(schema)) {\n for (const sch of schema) this.addSchema(sch, undefined, _meta, _validateSchema)\n return this\n }\n let id: string | undefined\n if (typeof schema === \"object\") {\n const {schemaId} = this.opts\n id = schema[schemaId]\n if (id !== undefined && typeof id != \"string\") {\n throw new Error(`schema ${schemaId} must be string`)\n }\n }\n key = normalizeId(key || id)\n this._checkUnique(key)\n this.schemas[key] = this._addSchema(schema, _meta, key, _validateSchema, true)\n return this\n }\n\n // Add schema that will be used to validate other schemas\n // options in META_IGNORE_OPTIONS are alway set to false\n addMetaSchema(\n schema: AnySchemaObject,\n key?: string, // schema key\n _validateSchema = this.opts.validateSchema // false to skip schema validation, can be used to override validateSchema option for meta-schema\n ): Ajv {\n this.addSchema(schema, key, true, _validateSchema)\n return this\n }\n\n // Validate schema against its meta-schema\n validateSchema(schema: AnySchema, throwOrLogError?: boolean): boolean | Promise {\n if (typeof schema == \"boolean\") return true\n let $schema: string | AnySchemaObject | undefined\n $schema = schema.$schema\n if ($schema !== undefined && typeof $schema != \"string\") {\n throw new Error(\"$schema must be a string\")\n }\n $schema = $schema || this.opts.defaultMeta || this.defaultMeta()\n if (!$schema) {\n this.logger.warn(\"meta-schema not available\")\n this.errors = null\n return true\n }\n const valid = this.validate($schema, schema)\n if (!valid && throwOrLogError) {\n const message = \"schema is invalid: \" + this.errorsText()\n if (this.opts.validateSchema === \"log\") this.logger.error(message)\n else throw new Error(message)\n }\n return valid\n }\n\n // Get compiled schema by `key` or `ref`.\n // (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id)\n getSchema(keyRef: string): AnyValidateFunction | undefined {\n let sch\n while (typeof (sch = getSchEnv.call(this, keyRef)) == \"string\") keyRef = sch\n if (sch === undefined) {\n const {schemaId} = this.opts\n const root = new SchemaEnv({schema: {}, schemaId})\n sch = resolveSchema.call(this, root, keyRef)\n if (!sch) return\n this.refs[keyRef] = sch\n }\n return (sch.validate || this._compileSchemaEnv(sch)) as AnyValidateFunction | undefined\n }\n\n // Remove cached schema(s).\n // If no parameter is passed all schemas but meta-schemas are removed.\n // If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.\n // Even if schema is referenced by other schemas it still can be removed as other schemas have local references.\n removeSchema(schemaKeyRef?: AnySchema | string | RegExp): Ajv {\n if (schemaKeyRef instanceof RegExp) {\n this._removeAllSchemas(this.schemas, schemaKeyRef)\n this._removeAllSchemas(this.refs, schemaKeyRef)\n return this\n }\n switch (typeof schemaKeyRef) {\n case \"undefined\":\n this._removeAllSchemas(this.schemas)\n this._removeAllSchemas(this.refs)\n this._cache.clear()\n return this\n case \"string\": {\n const sch = getSchEnv.call(this, schemaKeyRef)\n if (typeof sch == \"object\") this._cache.delete(sch.schema)\n delete this.schemas[schemaKeyRef]\n delete this.refs[schemaKeyRef]\n return this\n }\n case \"object\": {\n const cacheKey = schemaKeyRef\n this._cache.delete(cacheKey)\n let id = schemaKeyRef[this.opts.schemaId]\n if (id) {\n id = normalizeId(id)\n delete this.schemas[id]\n delete this.refs[id]\n }\n return this\n }\n default:\n throw new Error(\"ajv.removeSchema: invalid parameter\")\n }\n }\n\n // add \"vocabulary\" - a collection of keywords\n addVocabulary(definitions: Vocabulary): Ajv {\n for (const def of definitions) this.addKeyword(def)\n return this\n }\n\n addKeyword(\n kwdOrDef: string | KeywordDefinition,\n def?: KeywordDefinition // deprecated\n ): Ajv {\n let keyword: string | string[]\n if (typeof kwdOrDef == \"string\") {\n keyword = kwdOrDef\n if (typeof def == \"object\") {\n this.logger.warn(\"these parameters are deprecated, see docs for addKeyword\")\n def.keyword = keyword\n }\n } else if (typeof kwdOrDef == \"object\" && def === undefined) {\n def = kwdOrDef\n keyword = def.keyword\n if (Array.isArray(keyword) && !keyword.length) {\n throw new Error(\"addKeywords: keyword must be string or non-empty array\")\n }\n } else {\n throw new Error(\"invalid addKeywords parameters\")\n }\n\n checkKeyword.call(this, keyword, def)\n if (!def) {\n eachItem(keyword, (kwd) => addRule.call(this, kwd))\n return this\n }\n keywordMetaschema.call(this, def)\n const definition: AddedKeywordDefinition = {\n ...def,\n type: getJSONTypes(def.type),\n schemaType: getJSONTypes(def.schemaType),\n }\n eachItem(\n keyword,\n definition.type.length === 0\n ? (k) => addRule.call(this, k, definition)\n : (k) => definition.type.forEach((t) => addRule.call(this, k, definition, t))\n )\n return this\n }\n\n getKeyword(keyword: string): AddedKeywordDefinition | boolean {\n const rule = this.RULES.all[keyword]\n return typeof rule == \"object\" ? rule.definition : !!rule\n }\n\n // Remove keyword\n removeKeyword(keyword: string): Ajv {\n // TODO return type should be Ajv\n const {RULES} = this\n delete RULES.keywords[keyword]\n delete RULES.all[keyword]\n for (const group of RULES.rules) {\n const i = group.rules.findIndex((rule) => rule.keyword === keyword)\n if (i >= 0) group.rules.splice(i, 1)\n }\n return this\n }\n\n // Add format\n addFormat(name: string, format: Format): Ajv {\n if (typeof format == \"string\") format = new RegExp(format)\n this.formats[name] = format\n return this\n }\n\n errorsText(\n errors: ErrorObject[] | null | undefined = this.errors, // optional array of validation errors\n {separator = \", \", dataVar = \"data\"}: ErrorsTextOptions = {} // optional options with properties `separator` and `dataVar`\n ): string {\n if (!errors || errors.length === 0) return \"No errors\"\n return errors\n .map((e) => `${dataVar}${e.instancePath} ${e.message}`)\n .reduce((text, msg) => text + separator + msg)\n }\n\n $dataMetaSchema(metaSchema: AnySchemaObject, keywordsJsonPointers: string[]): AnySchemaObject {\n const rules = this.RULES.all\n metaSchema = JSON.parse(JSON.stringify(metaSchema))\n for (const jsonPointer of keywordsJsonPointers) {\n const segments = jsonPointer.split(\"/\").slice(1) // first segment is an empty string\n let keywords = metaSchema\n for (const seg of segments) keywords = keywords[seg] as AnySchemaObject\n\n for (const key in rules) {\n const rule = rules[key]\n if (typeof rule != \"object\") continue\n const {$data} = rule.definition\n const schema = keywords[key] as AnySchemaObject | undefined\n if ($data && schema) keywords[key] = schemaOrData(schema)\n }\n }\n\n return metaSchema\n }\n\n private _removeAllSchemas(schemas: {[Ref in string]?: SchemaEnv | string}, regex?: RegExp): void {\n for (const keyRef in schemas) {\n const sch = schemas[keyRef]\n if (!regex || regex.test(keyRef)) {\n if (typeof sch == \"string\") {\n delete schemas[keyRef]\n } else if (sch && !sch.meta) {\n this._cache.delete(sch.schema)\n delete schemas[keyRef]\n }\n }\n }\n }\n\n _addSchema(\n schema: AnySchema,\n meta?: boolean,\n baseId?: string,\n validateSchema = this.opts.validateSchema,\n addSchema = this.opts.addUsedSchema\n ): SchemaEnv {\n let id: string | undefined\n const {schemaId} = this.opts\n if (typeof schema == \"object\") {\n id = schema[schemaId]\n } else {\n if (this.opts.jtd) throw new Error(\"schema must be object\")\n else if (typeof schema != \"boolean\") throw new Error(\"schema must be object or boolean\")\n }\n let sch = this._cache.get(schema)\n if (sch !== undefined) return sch\n\n baseId = normalizeId(id || baseId)\n const localRefs = getSchemaRefs.call(this, schema, baseId)\n sch = new SchemaEnv({schema, schemaId, meta, baseId, localRefs})\n this._cache.set(sch.schema, sch)\n if (addSchema && !baseId.startsWith(\"#\")) {\n // TODO atm it is allowed to overwrite schemas without id (instead of not adding them)\n if (baseId) this._checkUnique(baseId)\n this.refs[baseId] = sch\n }\n if (validateSchema) this.validateSchema(schema, true)\n return sch\n }\n\n private _checkUnique(id: string): void {\n if (this.schemas[id] || this.refs[id]) {\n throw new Error(`schema with key or id \"${id}\" already exists`)\n }\n }\n\n private _compileSchemaEnv(sch: SchemaEnv): AnyValidateFunction {\n if (sch.meta) this._compileMetaSchema(sch)\n else compileSchema.call(this, sch)\n\n /* istanbul ignore if */\n if (!sch.validate) throw new Error(\"ajv implementation error\")\n return sch.validate\n }\n\n private _compileMetaSchema(sch: SchemaEnv): void {\n const currentOpts = this.opts\n this.opts = this._metaOpts\n try {\n compileSchema.call(this, sch)\n } finally {\n this.opts = currentOpts\n }\n }\n}\n\nexport interface ErrorsTextOptions {\n separator?: string\n dataVar?: string\n}\n\nfunction checkOptions(\n this: Ajv,\n checkOpts: OptionsInfo,\n options: Options & RemovedOptions,\n msg: string,\n log: \"warn\" | \"error\" = \"error\"\n): void {\n for (const key in checkOpts) {\n const opt = key as keyof typeof checkOpts\n if (opt in options) this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`)\n }\n}\n\nfunction getSchEnv(this: Ajv, keyRef: string): SchemaEnv | string | undefined {\n keyRef = normalizeId(keyRef) // TODO tests fail without this line\n return this.schemas[keyRef] || this.refs[keyRef]\n}\n\nfunction addInitialSchemas(this: Ajv): void {\n const optsSchemas = this.opts.schemas\n if (!optsSchemas) return\n if (Array.isArray(optsSchemas)) this.addSchema(optsSchemas)\n else for (const key in optsSchemas) this.addSchema(optsSchemas[key] as AnySchema, key)\n}\n\nfunction addInitialFormats(this: Ajv): void {\n for (const name in this.opts.formats) {\n const format = this.opts.formats[name]\n if (format) this.addFormat(name, format)\n }\n}\n\nfunction addInitialKeywords(\n this: Ajv,\n defs: Vocabulary | {[K in string]?: KeywordDefinition}\n): void {\n if (Array.isArray(defs)) {\n this.addVocabulary(defs)\n return\n }\n this.logger.warn(\"keywords option as map is deprecated, pass array\")\n for (const keyword in defs) {\n const def = defs[keyword] as KeywordDefinition\n if (!def.keyword) def.keyword = keyword\n this.addKeyword(def)\n }\n}\n\nfunction getMetaSchemaOptions(this: Ajv): InstanceOptions {\n const metaOpts = {...this.opts}\n for (const opt of META_IGNORE_OPTIONS) delete metaOpts[opt]\n return metaOpts\n}\n\nconst noLogs = {log() {}, warn() {}, error() {}}\n\nfunction getLogger(logger?: Partial | false): Logger {\n if (logger === false) return noLogs\n if (logger === undefined) return console\n if (logger.log && logger.warn && logger.error) return logger as Logger\n throw new Error(\"logger must implement log, warn and error methods\")\n}\n\nconst KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i\n\nfunction checkKeyword(this: Ajv, keyword: string | string[], def?: KeywordDefinition): void {\n const {RULES} = this\n eachItem(keyword, (kwd) => {\n if (RULES.keywords[kwd]) throw new Error(`Keyword ${kwd} is already defined`)\n if (!KEYWORD_NAME.test(kwd)) throw new Error(`Keyword ${kwd} has invalid name`)\n })\n if (!def) return\n if (def.$data && !(\"code\" in def || \"validate\" in def)) {\n throw new Error('$data keyword must have \"code\" or \"validate\" function')\n }\n}\n\nfunction addRule(\n this: Ajv,\n keyword: string,\n definition?: AddedKeywordDefinition,\n dataType?: JSONType\n): void {\n const post = definition?.post\n if (dataType && post) throw new Error('keyword with \"post\" flag cannot have \"type\"')\n const {RULES} = this\n let ruleGroup = post ? RULES.post : RULES.rules.find(({type: t}) => t === dataType)\n if (!ruleGroup) {\n ruleGroup = {type: dataType, rules: []}\n RULES.rules.push(ruleGroup)\n }\n RULES.keywords[keyword] = true\n if (!definition) return\n\n const rule: Rule = {\n keyword,\n definition: {\n ...definition,\n type: getJSONTypes(definition.type),\n schemaType: getJSONTypes(definition.schemaType),\n },\n }\n if (definition.before) addBeforeRule.call(this, ruleGroup, rule, definition.before)\n else ruleGroup.rules.push(rule)\n RULES.all[keyword] = rule\n definition.implements?.forEach((kwd) => this.addKeyword(kwd))\n}\n\nfunction addBeforeRule(this: Ajv, ruleGroup: RuleGroup, rule: Rule, before: string): void {\n const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before)\n if (i >= 0) {\n ruleGroup.rules.splice(i, 0, rule)\n } else {\n ruleGroup.rules.push(rule)\n this.logger.warn(`rule ${before} is not defined`)\n }\n}\n\nfunction keywordMetaschema(this: Ajv, def: KeywordDefinition): void {\n let {metaSchema} = def\n if (metaSchema === undefined) return\n if (def.$data && this.opts.$data) metaSchema = schemaOrData(metaSchema)\n def.validateSchema = this.compile(metaSchema, true)\n}\n\nconst $dataRef = {\n $ref: \"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#\",\n}\n\nfunction schemaOrData(schema: AnySchema): AnySchemaObject {\n return {anyOf: [schema, $dataRef]}\n}\n","// https://github.com/ajv-validator/ajv/issues/889\nimport * as equal from \"fast-deep-equal\"\n\ntype Equal = typeof equal & {code: string}\n;(equal as Equal).code = 'require(\"ajv/dist/runtime/equal\").default'\n\nexport default equal as Equal\n","// https://mathiasbynens.be/notes/javascript-encoding\n// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode\nexport default function ucs2length(str: string): number {\n const len = str.length\n let length = 0\n let pos = 0\n let value: number\n while (pos < len) {\n length++\n value = str.charCodeAt(pos++)\n if (value >= 0xd800 && value <= 0xdbff && pos < len) {\n // high surrogate, and there is a next character\n value = str.charCodeAt(pos)\n if ((value & 0xfc00) === 0xdc00) pos++ // low surrogate\n }\n }\n return length\n}\n\nucs2length.code = 'require(\"ajv/dist/runtime/ucs2length\").default'\n","import * as uri from \"fast-uri\"\n\ntype URI = typeof uri & {code: string}\n;(uri as URI).code = 'require(\"ajv/dist/runtime/uri\").default'\n\nexport default uri as URI\n","import type {ErrorObject} from \"../types\"\n\nexport default class ValidationError extends Error {\n readonly errors: Partial[]\n readonly ajv: true\n readonly validation: true\n\n constructor(errors: Partial[]) {\n super(\"validation failed\")\n this.errors = errors\n this.ajv = this.validation = true\n }\n}\n","import type {\n CodeKeywordDefinition,\n ErrorObject,\n KeywordErrorDefinition,\n AnySchema,\n} from \"../../types\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport {_, str, not, Name} from \"../../compile/codegen\"\nimport {alwaysValidSchema, checkStrictMode, Type} from \"../../compile/util\"\n\nexport type AdditionalItemsError = ErrorObject<\"additionalItems\", {limit: number}, AnySchema>\n\nconst error: KeywordErrorDefinition = {\n message: ({params: {len}}) => str`must NOT have more than ${len} items`,\n params: ({params: {len}}) => _`{limit: ${len}}`,\n}\n\nconst def: CodeKeywordDefinition = {\n keyword: \"additionalItems\" as const,\n type: \"array\",\n schemaType: [\"boolean\", \"object\"],\n before: \"uniqueItems\",\n error,\n code(cxt: KeywordCxt) {\n const {parentSchema, it} = cxt\n const {items} = parentSchema\n if (!Array.isArray(items)) {\n checkStrictMode(it, '\"additionalItems\" is ignored when \"items\" is not an array of schemas')\n return\n }\n validateAdditionalItems(cxt, items)\n },\n}\n\nexport function validateAdditionalItems(cxt: KeywordCxt, items: AnySchema[]): void {\n const {gen, schema, data, keyword, it} = cxt\n it.items = true\n const len = gen.const(\"len\", _`${data}.length`)\n if (schema === false) {\n cxt.setParams({len: items.length})\n cxt.pass(_`${len} <= ${items.length}`)\n } else if (typeof schema == \"object\" && !alwaysValidSchema(it, schema)) {\n const valid = gen.var(\"valid\", _`${len} <= ${items.length}`) // TODO var\n gen.if(not(valid), () => validateItems(valid))\n cxt.ok(valid)\n }\n\n function validateItems(valid: Name): void {\n gen.forRange(\"i\", items.length, len, (i) => {\n cxt.subschema({keyword, dataProp: i, dataPropType: Type.Num}, valid)\n if (!it.allErrors) gen.if(not(valid), () => gen.break())\n })\n }\n}\n\nexport default def\n","import type {\n CodeKeywordDefinition,\n AddedKeywordDefinition,\n ErrorObject,\n KeywordErrorDefinition,\n AnySchema,\n} from \"../../types\"\nimport {allSchemaProperties, usePattern, isOwnProperty} from \"../code\"\nimport {_, nil, or, not, Code, Name} from \"../../compile/codegen\"\nimport N from \"../../compile/names\"\nimport type {SubschemaArgs} from \"../../compile/validate/subschema\"\nimport {alwaysValidSchema, schemaRefOrVal, Type} from \"../../compile/util\"\n\nexport type AdditionalPropertiesError = ErrorObject<\n \"additionalProperties\",\n {additionalProperty: string},\n AnySchema\n>\n\nconst error: KeywordErrorDefinition = {\n message: \"must NOT have additional properties\",\n params: ({params}) => _`{additionalProperty: ${params.additionalProperty}}`,\n}\n\nconst def: CodeKeywordDefinition & AddedKeywordDefinition = {\n keyword: \"additionalProperties\",\n type: [\"object\"],\n schemaType: [\"boolean\", \"object\"],\n allowUndefined: true,\n trackErrors: true,\n error,\n code(cxt) {\n const {gen, schema, parentSchema, data, errsCount, it} = cxt\n /* istanbul ignore if */\n if (!errsCount) throw new Error(\"ajv implementation error\")\n const {allErrors, opts} = it\n it.props = true\n if (opts.removeAdditional !== \"all\" && alwaysValidSchema(it, schema)) return\n const props = allSchemaProperties(parentSchema.properties)\n const patProps = allSchemaProperties(parentSchema.patternProperties)\n checkAdditionalProperties()\n cxt.ok(_`${errsCount} === ${N.errors}`)\n\n function checkAdditionalProperties(): void {\n gen.forIn(\"key\", data, (key: Name) => {\n if (!props.length && !patProps.length) additionalPropertyCode(key)\n else gen.if(isAdditional(key), () => additionalPropertyCode(key))\n })\n }\n\n function isAdditional(key: Name): Code {\n let definedProp: Code\n if (props.length > 8) {\n // TODO maybe an option instead of hard-coded 8?\n const propsSchema = schemaRefOrVal(it, parentSchema.properties, \"properties\")\n definedProp = isOwnProperty(gen, propsSchema as Code, key)\n } else if (props.length) {\n definedProp = or(...props.map((p) => _`${key} === ${p}`))\n } else {\n definedProp = nil\n }\n if (patProps.length) {\n definedProp = or(definedProp, ...patProps.map((p) => _`${usePattern(cxt, p)}.test(${key})`))\n }\n return not(definedProp)\n }\n\n function deleteAdditional(key: Name): void {\n gen.code(_`delete ${data}[${key}]`)\n }\n\n function additionalPropertyCode(key: Name): void {\n if (opts.removeAdditional === \"all\" || (opts.removeAdditional && schema === false)) {\n deleteAdditional(key)\n return\n }\n\n if (schema === false) {\n cxt.setParams({additionalProperty: key})\n cxt.error()\n if (!allErrors) gen.break()\n return\n }\n\n if (typeof schema == \"object\" && !alwaysValidSchema(it, schema)) {\n const valid = gen.name(\"valid\")\n if (opts.removeAdditional === \"failing\") {\n applyAdditionalSchema(key, valid, false)\n gen.if(not(valid), () => {\n cxt.reset()\n deleteAdditional(key)\n })\n } else {\n applyAdditionalSchema(key, valid)\n if (!allErrors) gen.if(not(valid), () => gen.break())\n }\n }\n }\n\n function applyAdditionalSchema(key: Name, valid: Name, errors?: false): void {\n const subschema: SubschemaArgs = {\n keyword: \"additionalProperties\",\n dataProp: key,\n dataPropType: Type.Str,\n }\n if (errors === false) {\n Object.assign(subschema, {\n compositeRule: true,\n createErrors: false,\n allErrors: false,\n })\n }\n cxt.subschema(subschema, valid)\n }\n },\n}\n\nexport default def\n","import type {CodeKeywordDefinition, AnySchema} from \"../../types\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport {alwaysValidSchema} from \"../../compile/util\"\n\nconst def: CodeKeywordDefinition = {\n keyword: \"allOf\",\n schemaType: \"array\",\n code(cxt: KeywordCxt) {\n const {gen, schema, it} = cxt\n /* istanbul ignore if */\n if (!Array.isArray(schema)) throw new Error(\"ajv implementation error\")\n const valid = gen.name(\"valid\")\n schema.forEach((sch: AnySchema, i: number) => {\n if (alwaysValidSchema(it, sch)) return\n const schCxt = cxt.subschema({keyword: \"allOf\", schemaProp: i}, valid)\n cxt.ok(valid)\n cxt.mergeEvaluated(schCxt)\n })\n },\n}\n\nexport default def\n","import type {CodeKeywordDefinition, ErrorNoParams, AnySchema} from \"../../types\"\nimport {validateUnion} from \"../code\"\n\nexport type AnyOfError = ErrorNoParams<\"anyOf\", AnySchema[]>\n\nconst def: CodeKeywordDefinition = {\n keyword: \"anyOf\",\n schemaType: \"array\",\n trackErrors: true,\n code: validateUnion,\n error: {message: \"must match a schema in anyOf\"},\n}\n\nexport default def\n","import type {\n CodeKeywordDefinition,\n KeywordErrorDefinition,\n ErrorObject,\n AnySchema,\n} from \"../../types\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport {_, str, Name} from \"../../compile/codegen\"\nimport {alwaysValidSchema, checkStrictMode, Type} from \"../../compile/util\"\n\nexport type ContainsError = ErrorObject<\n \"contains\",\n {minContains: number; maxContains?: number},\n AnySchema\n>\n\nconst error: KeywordErrorDefinition = {\n message: ({params: {min, max}}) =>\n max === undefined\n ? str`must contain at least ${min} valid item(s)`\n : str`must contain at least ${min} and no more than ${max} valid item(s)`,\n params: ({params: {min, max}}) =>\n max === undefined ? _`{minContains: ${min}}` : _`{minContains: ${min}, maxContains: ${max}}`,\n}\n\nconst def: CodeKeywordDefinition = {\n keyword: \"contains\",\n type: \"array\",\n schemaType: [\"object\", \"boolean\"],\n before: \"uniqueItems\",\n trackErrors: true,\n error,\n code(cxt: KeywordCxt) {\n const {gen, schema, parentSchema, data, it} = cxt\n let min: number\n let max: number | undefined\n const {minContains, maxContains} = parentSchema\n if (it.opts.next) {\n min = minContains === undefined ? 1 : minContains\n max = maxContains\n } else {\n min = 1\n }\n const len = gen.const(\"len\", _`${data}.length`)\n cxt.setParams({min, max})\n if (max === undefined && min === 0) {\n checkStrictMode(it, `\"minContains\" == 0 without \"maxContains\": \"contains\" keyword ignored`)\n return\n }\n if (max !== undefined && min > max) {\n checkStrictMode(it, `\"minContains\" > \"maxContains\" is always invalid`)\n cxt.fail()\n return\n }\n if (alwaysValidSchema(it, schema)) {\n let cond = _`${len} >= ${min}`\n if (max !== undefined) cond = _`${cond} && ${len} <= ${max}`\n cxt.pass(cond)\n return\n }\n\n it.items = true\n const valid = gen.name(\"valid\")\n if (max === undefined && min === 1) {\n validateItems(valid, () => gen.if(valid, () => gen.break()))\n } else if (min === 0) {\n gen.let(valid, true)\n if (max !== undefined) gen.if(_`${data}.length > 0`, validateItemsWithCount)\n } else {\n gen.let(valid, false)\n validateItemsWithCount()\n }\n cxt.result(valid, () => cxt.reset())\n\n function validateItemsWithCount(): void {\n const schValid = gen.name(\"_valid\")\n const count = gen.let(\"count\", 0)\n validateItems(schValid, () => gen.if(schValid, () => checkLimits(count)))\n }\n\n function validateItems(_valid: Name, block: () => void): void {\n gen.forRange(\"i\", 0, len, (i) => {\n cxt.subschema(\n {\n keyword: \"contains\",\n dataProp: i,\n dataPropType: Type.Num,\n compositeRule: true,\n },\n _valid\n )\n block()\n })\n }\n\n function checkLimits(count: Name): void {\n gen.code(_`${count}++`)\n if (max === undefined) {\n gen.if(_`${count} >= ${min}`, () => gen.assign(valid, true).break())\n } else {\n gen.if(_`${count} > ${max}`, () => gen.assign(valid, false).break())\n if (min === 1) gen.assign(valid, true)\n else gen.if(_`${count} >= ${min}`, () => gen.assign(valid, true))\n }\n }\n },\n}\n\nexport default def\n","import type {\n CodeKeywordDefinition,\n ErrorObject,\n KeywordErrorDefinition,\n SchemaMap,\n AnySchema,\n} from \"../../types\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport {_, str} from \"../../compile/codegen\"\nimport {alwaysValidSchema} from \"../../compile/util\"\nimport {checkReportMissingProp, checkMissingProp, reportMissingProp, propertyInData} from \"../code\"\n\nexport type PropertyDependencies = {[K in string]?: string[]}\n\nexport interface DependenciesErrorParams {\n property: string\n missingProperty: string\n depsCount: number\n deps: string // TODO change to string[]\n}\n\ntype SchemaDependencies = SchemaMap\n\nexport type DependenciesError = ErrorObject<\n \"dependencies\",\n DependenciesErrorParams,\n {[K in string]?: string[] | AnySchema}\n>\n\nexport const error: KeywordErrorDefinition = {\n message: ({params: {property, depsCount, deps}}) => {\n const property_ies = depsCount === 1 ? \"property\" : \"properties\"\n return str`must have ${property_ies} ${deps} when property ${property} is present`\n },\n params: ({params: {property, depsCount, deps, missingProperty}}) =>\n _`{property: ${property},\n missingProperty: ${missingProperty},\n depsCount: ${depsCount},\n deps: ${deps}}`, // TODO change to reference\n}\n\nconst def: CodeKeywordDefinition = {\n keyword: \"dependencies\",\n type: \"object\",\n schemaType: \"object\",\n error,\n code(cxt: KeywordCxt) {\n const [propDeps, schDeps] = splitDependencies(cxt)\n validatePropertyDeps(cxt, propDeps)\n validateSchemaDeps(cxt, schDeps)\n },\n}\n\nfunction splitDependencies({schema}: KeywordCxt): [PropertyDependencies, SchemaDependencies] {\n const propertyDeps: PropertyDependencies = {}\n const schemaDeps: SchemaDependencies = {}\n for (const key in schema) {\n if (key === \"__proto__\") continue\n const deps = Array.isArray(schema[key]) ? propertyDeps : schemaDeps\n deps[key] = schema[key]\n }\n return [propertyDeps, schemaDeps]\n}\n\nexport function validatePropertyDeps(\n cxt: KeywordCxt,\n propertyDeps: {[K in string]?: string[]} = cxt.schema\n): void {\n const {gen, data, it} = cxt\n if (Object.keys(propertyDeps).length === 0) return\n const missing = gen.let(\"missing\")\n for (const prop in propertyDeps) {\n const deps = propertyDeps[prop] as string[]\n if (deps.length === 0) continue\n const hasProperty = propertyInData(gen, data, prop, it.opts.ownProperties)\n cxt.setParams({\n property: prop,\n depsCount: deps.length,\n deps: deps.join(\", \"),\n })\n if (it.allErrors) {\n gen.if(hasProperty, () => {\n for (const depProp of deps) {\n checkReportMissingProp(cxt, depProp)\n }\n })\n } else {\n gen.if(_`${hasProperty} && (${checkMissingProp(cxt, deps, missing)})`)\n reportMissingProp(cxt, missing)\n gen.else()\n }\n }\n}\n\nexport function validateSchemaDeps(cxt: KeywordCxt, schemaDeps: SchemaMap = cxt.schema): void {\n const {gen, data, keyword, it} = cxt\n const valid = gen.name(\"valid\")\n for (const prop in schemaDeps) {\n if (alwaysValidSchema(it, schemaDeps[prop] as AnySchema)) continue\n gen.if(\n propertyInData(gen, data, prop, it.opts.ownProperties),\n () => {\n const schCxt = cxt.subschema({keyword, schemaProp: prop}, valid)\n cxt.mergeValidEvaluated(schCxt, valid)\n },\n () => gen.var(valid, true) // TODO var\n )\n cxt.ok(valid)\n }\n}\n\nexport default def\n","import type {\n CodeKeywordDefinition,\n ErrorObject,\n KeywordErrorDefinition,\n AnySchema,\n} from \"../../types\"\nimport type {SchemaObjCxt} from \"../../compile\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport {_, str, not, Name} from \"../../compile/codegen\"\nimport {alwaysValidSchema, checkStrictMode} from \"../../compile/util\"\n\nexport type IfKeywordError = ErrorObject<\"if\", {failingKeyword: string}, AnySchema>\n\nconst error: KeywordErrorDefinition = {\n message: ({params}) => str`must match \"${params.ifClause}\" schema`,\n params: ({params}) => _`{failingKeyword: ${params.ifClause}}`,\n}\n\nconst def: CodeKeywordDefinition = {\n keyword: \"if\",\n schemaType: [\"object\", \"boolean\"],\n trackErrors: true,\n error,\n code(cxt: KeywordCxt) {\n const {gen, parentSchema, it} = cxt\n if (parentSchema.then === undefined && parentSchema.else === undefined) {\n checkStrictMode(it, '\"if\" without \"then\" and \"else\" is ignored')\n }\n const hasThen = hasSchema(it, \"then\")\n const hasElse = hasSchema(it, \"else\")\n if (!hasThen && !hasElse) return\n\n const valid = gen.let(\"valid\", true)\n const schValid = gen.name(\"_valid\")\n validateIf()\n cxt.reset()\n\n if (hasThen && hasElse) {\n const ifClause = gen.let(\"ifClause\")\n cxt.setParams({ifClause})\n gen.if(schValid, validateClause(\"then\", ifClause), validateClause(\"else\", ifClause))\n } else if (hasThen) {\n gen.if(schValid, validateClause(\"then\"))\n } else {\n gen.if(not(schValid), validateClause(\"else\"))\n }\n\n cxt.pass(valid, () => cxt.error(true))\n\n function validateIf(): void {\n const schCxt = cxt.subschema(\n {\n keyword: \"if\",\n compositeRule: true,\n createErrors: false,\n allErrors: false,\n },\n schValid\n )\n cxt.mergeEvaluated(schCxt)\n }\n\n function validateClause(keyword: string, ifClause?: Name): () => void {\n return () => {\n const schCxt = cxt.subschema({keyword}, schValid)\n gen.assign(valid, schValid)\n cxt.mergeValidEvaluated(schCxt, valid)\n if (ifClause) gen.assign(ifClause, _`${keyword}`)\n else cxt.setParams({ifClause: keyword})\n }\n }\n },\n}\n\nfunction hasSchema(it: SchemaObjCxt, keyword: string): boolean {\n const schema = it.schema[keyword]\n return schema !== undefined && !alwaysValidSchema(it, schema)\n}\n\nexport default def\n","import type {ErrorNoParams, Vocabulary} from \"../../types\"\nimport additionalItems, {AdditionalItemsError} from \"./additionalItems\"\nimport prefixItems from \"./prefixItems\"\nimport items from \"./items\"\nimport items2020, {ItemsError} from \"./items2020\"\nimport contains, {ContainsError} from \"./contains\"\nimport dependencies, {DependenciesError} from \"./dependencies\"\nimport propertyNames, {PropertyNamesError} from \"./propertyNames\"\nimport additionalProperties, {AdditionalPropertiesError} from \"./additionalProperties\"\nimport properties from \"./properties\"\nimport patternProperties from \"./patternProperties\"\nimport notKeyword, {NotKeywordError} from \"./not\"\nimport anyOf, {AnyOfError} from \"./anyOf\"\nimport oneOf, {OneOfError} from \"./oneOf\"\nimport allOf from \"./allOf\"\nimport ifKeyword, {IfKeywordError} from \"./if\"\nimport thenElse from \"./thenElse\"\n\nexport default function getApplicator(draft2020 = false): Vocabulary {\n const applicator = [\n // any\n notKeyword,\n anyOf,\n oneOf,\n allOf,\n ifKeyword,\n thenElse,\n // object\n propertyNames,\n additionalProperties,\n dependencies,\n properties,\n patternProperties,\n ]\n // array\n if (draft2020) applicator.push(prefixItems, items2020)\n else applicator.push(additionalItems, items)\n applicator.push(contains)\n return applicator\n}\n\nexport type ApplicatorKeywordError =\n | ErrorNoParams<\"false schema\">\n | AdditionalItemsError\n | ItemsError\n | ContainsError\n | AdditionalPropertiesError\n | DependenciesError\n | IfKeywordError\n | AnyOfError\n | OneOfError\n | NotKeywordError\n | PropertyNamesError\n","import type {CodeKeywordDefinition, AnySchema, AnySchemaObject} from \"../../types\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport {_} from \"../../compile/codegen\"\nimport {alwaysValidSchema, mergeEvaluated, checkStrictMode} from \"../../compile/util\"\nimport {validateArray} from \"../code\"\n\nconst def: CodeKeywordDefinition = {\n keyword: \"items\",\n type: \"array\",\n schemaType: [\"object\", \"array\", \"boolean\"],\n before: \"uniqueItems\",\n code(cxt: KeywordCxt) {\n const {schema, it} = cxt\n if (Array.isArray(schema)) return validateTuple(cxt, \"additionalItems\", schema)\n it.items = true\n if (alwaysValidSchema(it, schema)) return\n cxt.ok(validateArray(cxt))\n },\n}\n\nexport function validateTuple(\n cxt: KeywordCxt,\n extraItems: string,\n schArr: AnySchema[] = cxt.schema\n): void {\n const {gen, parentSchema, data, keyword, it} = cxt\n checkStrictTuple(parentSchema)\n if (it.opts.unevaluated && schArr.length && it.items !== true) {\n it.items = mergeEvaluated.items(gen, schArr.length, it.items)\n }\n const valid = gen.name(\"valid\")\n const len = gen.const(\"len\", _`${data}.length`)\n schArr.forEach((sch: AnySchema, i: number) => {\n if (alwaysValidSchema(it, sch)) return\n gen.if(_`${len} > ${i}`, () =>\n cxt.subschema(\n {\n keyword,\n schemaProp: i,\n dataProp: i,\n },\n valid\n )\n )\n cxt.ok(valid)\n })\n\n function checkStrictTuple(sch: AnySchemaObject): void {\n const {opts, errSchemaPath} = it\n const l = schArr.length\n const fullTuple = l === sch.minItems && (l === sch.maxItems || sch[extraItems] === false)\n if (opts.strictTuples && !fullTuple) {\n const msg = `\"${keyword}\" is ${l}-tuple, but minItems or maxItems/${extraItems} are not specified or different at path \"${errSchemaPath}\"`\n checkStrictMode(it, msg, opts.strictTuples)\n }\n }\n}\n\nexport default def\n","import type {\n CodeKeywordDefinition,\n KeywordErrorDefinition,\n ErrorObject,\n AnySchema,\n} from \"../../types\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport {_, str} from \"../../compile/codegen\"\nimport {alwaysValidSchema} from \"../../compile/util\"\nimport {validateArray} from \"../code\"\nimport {validateAdditionalItems} from \"./additionalItems\"\n\nexport type ItemsError = ErrorObject<\"items\", {limit: number}, AnySchema>\n\nconst error: KeywordErrorDefinition = {\n message: ({params: {len}}) => str`must NOT have more than ${len} items`,\n params: ({params: {len}}) => _`{limit: ${len}}`,\n}\n\nconst def: CodeKeywordDefinition = {\n keyword: \"items\",\n type: \"array\",\n schemaType: [\"object\", \"boolean\"],\n before: \"uniqueItems\",\n error,\n code(cxt: KeywordCxt) {\n const {schema, parentSchema, it} = cxt\n const {prefixItems} = parentSchema\n it.items = true\n if (alwaysValidSchema(it, schema)) return\n if (prefixItems) validateAdditionalItems(cxt, prefixItems)\n else cxt.ok(validateArray(cxt))\n },\n}\n\nexport default def\n","import type {CodeKeywordDefinition, ErrorNoParams, AnySchema} from \"../../types\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport {alwaysValidSchema} from \"../../compile/util\"\n\nexport type NotKeywordError = ErrorNoParams<\"not\", AnySchema>\n\nconst def: CodeKeywordDefinition = {\n keyword: \"not\",\n schemaType: [\"object\", \"boolean\"],\n trackErrors: true,\n code(cxt: KeywordCxt) {\n const {gen, schema, it} = cxt\n if (alwaysValidSchema(it, schema)) {\n cxt.fail()\n return\n }\n\n const valid = gen.name(\"valid\")\n cxt.subschema(\n {\n keyword: \"not\",\n compositeRule: true,\n createErrors: false,\n allErrors: false,\n },\n valid\n )\n\n cxt.failResult(\n valid,\n () => cxt.reset(),\n () => cxt.error()\n )\n },\n error: {message: \"must NOT be valid\"},\n}\n\nexport default def\n","import type {\n CodeKeywordDefinition,\n ErrorObject,\n KeywordErrorDefinition,\n AnySchema,\n} from \"../../types\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport {_, Name} from \"../../compile/codegen\"\nimport {alwaysValidSchema} from \"../../compile/util\"\nimport {SchemaCxt} from \"../../compile\"\n\nexport type OneOfError = ErrorObject<\n \"oneOf\",\n {passingSchemas: [number, number] | null},\n AnySchema[]\n>\n\nconst error: KeywordErrorDefinition = {\n message: \"must match exactly one schema in oneOf\",\n params: ({params}) => _`{passingSchemas: ${params.passing}}`,\n}\n\nconst def: CodeKeywordDefinition = {\n keyword: \"oneOf\",\n schemaType: \"array\",\n trackErrors: true,\n error,\n code(cxt: KeywordCxt) {\n const {gen, schema, parentSchema, it} = cxt\n /* istanbul ignore if */\n if (!Array.isArray(schema)) throw new Error(\"ajv implementation error\")\n if (it.opts.discriminator && parentSchema.discriminator) return\n const schArr: AnySchema[] = schema\n const valid = gen.let(\"valid\", false)\n const passing = gen.let(\"passing\", null)\n const schValid = gen.name(\"_valid\")\n cxt.setParams({passing})\n // TODO possibly fail straight away (with warning or exception) if there are two empty always valid schemas\n\n gen.block(validateOneOf)\n\n cxt.result(\n valid,\n () => cxt.reset(),\n () => cxt.error(true)\n )\n\n function validateOneOf(): void {\n schArr.forEach((sch: AnySchema, i: number) => {\n let schCxt: SchemaCxt | undefined\n if (alwaysValidSchema(it, sch)) {\n gen.var(schValid, true)\n } else {\n schCxt = cxt.subschema(\n {\n keyword: \"oneOf\",\n schemaProp: i,\n compositeRule: true,\n },\n schValid\n )\n }\n\n if (i > 0) {\n gen\n .if(_`${schValid} && ${valid}`)\n .assign(valid, false)\n .assign(passing, _`[${passing}, ${i}]`)\n .else()\n }\n\n gen.if(schValid, () => {\n gen.assign(valid, true)\n gen.assign(passing, i)\n if (schCxt) cxt.mergeEvaluated(schCxt, Name)\n })\n })\n }\n },\n}\n\nexport default def\n","import type {CodeKeywordDefinition} from \"../../types\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport {allSchemaProperties, usePattern} from \"../code\"\nimport {_, not, Name} from \"../../compile/codegen\"\nimport {alwaysValidSchema, checkStrictMode} from \"../../compile/util\"\nimport {evaluatedPropsToName, Type} from \"../../compile/util\"\nimport {AnySchema} from \"../../types\"\n\nconst def: CodeKeywordDefinition = {\n keyword: \"patternProperties\",\n type: \"object\",\n schemaType: \"object\",\n code(cxt: KeywordCxt) {\n const {gen, schema, data, parentSchema, it} = cxt\n const {opts} = it\n const patterns = allSchemaProperties(schema)\n const alwaysValidPatterns = patterns.filter((p) =>\n alwaysValidSchema(it, schema[p] as AnySchema)\n )\n\n if (\n patterns.length === 0 ||\n (alwaysValidPatterns.length === patterns.length &&\n (!it.opts.unevaluated || it.props === true))\n ) {\n return\n }\n\n const checkProperties =\n opts.strictSchema && !opts.allowMatchingProperties && parentSchema.properties\n const valid = gen.name(\"valid\")\n if (it.props !== true && !(it.props instanceof Name)) {\n it.props = evaluatedPropsToName(gen, it.props)\n }\n const {props} = it\n validatePatternProperties()\n\n function validatePatternProperties(): void {\n for (const pat of patterns) {\n if (checkProperties) checkMatchingProperties(pat)\n if (it.allErrors) {\n validateProperties(pat)\n } else {\n gen.var(valid, true) // TODO var\n validateProperties(pat)\n gen.if(valid)\n }\n }\n }\n\n function checkMatchingProperties(pat: string): void {\n for (const prop in checkProperties) {\n if (new RegExp(pat).test(prop)) {\n checkStrictMode(\n it,\n `property ${prop} matches pattern ${pat} (use allowMatchingProperties)`\n )\n }\n }\n }\n\n function validateProperties(pat: string): void {\n gen.forIn(\"key\", data, (key) => {\n gen.if(_`${usePattern(cxt, pat)}.test(${key})`, () => {\n const alwaysValid = alwaysValidPatterns.includes(pat)\n if (!alwaysValid) {\n cxt.subschema(\n {\n keyword: \"patternProperties\",\n schemaProp: pat,\n dataProp: key,\n dataPropType: Type.Str,\n },\n valid\n )\n }\n\n if (it.opts.unevaluated && props !== true) {\n gen.assign(_`${props}[${key}]`, true)\n } else if (!alwaysValid && !it.allErrors) {\n // can short-circuit if `unevaluatedProperties` is not supported (opts.next === false)\n // or if all properties were evaluated (props === true)\n gen.if(not(valid), () => gen.break())\n }\n })\n })\n }\n },\n}\n\nexport default def\n","import type {CodeKeywordDefinition} from \"../../types\"\nimport {validateTuple} from \"./items\"\n\nconst def: CodeKeywordDefinition = {\n keyword: \"prefixItems\",\n type: \"array\",\n schemaType: [\"array\"],\n before: \"uniqueItems\",\n code: (cxt) => validateTuple(cxt, \"items\"),\n}\n\nexport default def\n","import type {CodeKeywordDefinition} from \"../../types\"\nimport {KeywordCxt} from \"../../compile/validate\"\nimport {propertyInData, allSchemaProperties} from \"../code\"\nimport {alwaysValidSchema, toHash, mergeEvaluated} from \"../../compile/util\"\nimport apDef from \"./additionalProperties\"\n\nconst def: CodeKeywordDefinition = {\n keyword: \"properties\",\n type: \"object\",\n schemaType: \"object\",\n code(cxt: KeywordCxt) {\n const {gen, schema, parentSchema, data, it} = cxt\n if (it.opts.removeAdditional === \"all\" && parentSchema.additionalProperties === undefined) {\n apDef.code(new KeywordCxt(it, apDef, \"additionalProperties\"))\n }\n const allProps = allSchemaProperties(schema)\n for (const prop of allProps) {\n it.definedProperties.add(prop)\n }\n if (it.opts.unevaluated && allProps.length && it.props !== true) {\n it.props = mergeEvaluated.props(gen, toHash(allProps), it.props)\n }\n const properties = allProps.filter((p) => !alwaysValidSchema(it, schema[p]))\n if (properties.length === 0) return\n const valid = gen.name(\"valid\")\n\n for (const prop of properties) {\n if (hasDefault(prop)) {\n applyPropertySchema(prop)\n } else {\n gen.if(propertyInData(gen, data, prop, it.opts.ownProperties))\n applyPropertySchema(prop)\n if (!it.allErrors) gen.else().var(valid, true)\n gen.endIf()\n }\n cxt.it.definedProperties.add(prop)\n cxt.ok(valid)\n }\n\n function hasDefault(prop: string): boolean | undefined {\n return it.opts.useDefaults && !it.compositeRule && schema[prop].default !== undefined\n }\n\n function applyPropertySchema(prop: string): void {\n cxt.subschema(\n {\n keyword: \"properties\",\n schemaProp: prop,\n dataProp: prop,\n },\n valid\n )\n }\n },\n}\n\nexport default def\n","import type {\n CodeKeywordDefinition,\n ErrorObject,\n KeywordErrorDefinition,\n AnySchema,\n} from \"../../types\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport {_, not} from \"../../compile/codegen\"\nimport {alwaysValidSchema} from \"../../compile/util\"\n\nexport type PropertyNamesError = ErrorObject<\"propertyNames\", {propertyName: string}, AnySchema>\n\nconst error: KeywordErrorDefinition = {\n message: \"property name must be valid\",\n params: ({params}) => _`{propertyName: ${params.propertyName}}`,\n}\n\nconst def: CodeKeywordDefinition = {\n keyword: \"propertyNames\",\n type: \"object\",\n schemaType: [\"object\", \"boolean\"],\n error,\n code(cxt: KeywordCxt) {\n const {gen, schema, data, it} = cxt\n if (alwaysValidSchema(it, schema)) return\n const valid = gen.name(\"valid\")\n\n gen.forIn(\"key\", data, (key) => {\n cxt.setParams({propertyName: key})\n cxt.subschema(\n {\n keyword: \"propertyNames\",\n data: key,\n dataTypes: [\"string\"],\n propertyName: key,\n compositeRule: true,\n },\n valid\n )\n gen.if(not(valid), () => {\n cxt.error(true)\n if (!it.allErrors) gen.break()\n })\n })\n\n cxt.ok(valid)\n },\n}\n\nexport default def\n","import type {CodeKeywordDefinition} from \"../../types\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport {checkStrictMode} from \"../../compile/util\"\n\nconst def: CodeKeywordDefinition = {\n keyword: [\"then\", \"else\"],\n schemaType: [\"object\", \"boolean\"],\n code({keyword, parentSchema, it}: KeywordCxt) {\n if (parentSchema.if === undefined) checkStrictMode(it, `\"${keyword}\" without \"if\" is ignored`)\n },\n}\n\nexport default def\n","import type {AnySchema, SchemaMap} from \"../types\"\nimport type {SchemaCxt} from \"../compile\"\nimport type {KeywordCxt} from \"../compile/validate\"\nimport {CodeGen, _, and, or, not, nil, strConcat, getProperty, Code, Name} from \"../compile/codegen\"\nimport {alwaysValidSchema, Type} from \"../compile/util\"\nimport N from \"../compile/names\"\nimport {useFunc} from \"../compile/util\"\nexport function checkReportMissingProp(cxt: KeywordCxt, prop: string): void {\n const {gen, data, it} = cxt\n gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => {\n cxt.setParams({missingProperty: _`${prop}`}, true)\n cxt.error()\n })\n}\n\nexport function checkMissingProp(\n {gen, data, it: {opts}}: KeywordCxt,\n properties: string[],\n missing: Name\n): Code {\n return or(\n ...properties.map((prop) =>\n and(noPropertyInData(gen, data, prop, opts.ownProperties), _`${missing} = ${prop}`)\n )\n )\n}\n\nexport function reportMissingProp(cxt: KeywordCxt, missing: Name): void {\n cxt.setParams({missingProperty: missing}, true)\n cxt.error()\n}\n\nexport function hasPropFunc(gen: CodeGen): Name {\n return gen.scopeValue(\"func\", {\n // eslint-disable-next-line @typescript-eslint/unbound-method\n ref: Object.prototype.hasOwnProperty,\n code: _`Object.prototype.hasOwnProperty`,\n })\n}\n\nexport function isOwnProperty(gen: CodeGen, data: Name, property: Name | string): Code {\n return _`${hasPropFunc(gen)}.call(${data}, ${property})`\n}\n\nexport function propertyInData(\n gen: CodeGen,\n data: Name,\n property: Name | string,\n ownProperties?: boolean\n): Code {\n const cond = _`${data}${getProperty(property)} !== undefined`\n return ownProperties ? _`${cond} && ${isOwnProperty(gen, data, property)}` : cond\n}\n\nexport function noPropertyInData(\n gen: CodeGen,\n data: Name,\n property: Name | string,\n ownProperties?: boolean\n): Code {\n const cond = _`${data}${getProperty(property)} === undefined`\n return ownProperties ? or(cond, not(isOwnProperty(gen, data, property))) : cond\n}\n\nexport function allSchemaProperties(schemaMap?: SchemaMap): string[] {\n return schemaMap ? Object.keys(schemaMap).filter((p) => p !== \"__proto__\") : []\n}\n\nexport function schemaProperties(it: SchemaCxt, schemaMap: SchemaMap): string[] {\n return allSchemaProperties(schemaMap).filter(\n (p) => !alwaysValidSchema(it, schemaMap[p] as AnySchema)\n )\n}\n\nexport function callValidateCode(\n {schemaCode, data, it: {gen, topSchemaRef, schemaPath, errorPath}, it}: KeywordCxt,\n func: Code,\n context: Code,\n passSchema?: boolean\n): Code {\n const dataAndSchema = passSchema ? _`${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data\n const valCxt: [Name, Code | number][] = [\n [N.instancePath, strConcat(N.instancePath, errorPath)],\n [N.parentData, it.parentData],\n [N.parentDataProperty, it.parentDataProperty],\n [N.rootData, N.rootData],\n ]\n if (it.opts.dynamicRef) valCxt.push([N.dynamicAnchors, N.dynamicAnchors])\n const args = _`${dataAndSchema}, ${gen.object(...valCxt)}`\n return context !== nil ? _`${func}.call(${context}, ${args})` : _`${func}(${args})`\n}\n\nconst newRegExp = _`new RegExp`\n\nexport function usePattern({gen, it: {opts}}: KeywordCxt, pattern: string): Name {\n const u = opts.unicodeRegExp ? \"u\" : \"\"\n const {regExp} = opts.code\n const rx = regExp(pattern, u)\n\n return gen.scopeValue(\"pattern\", {\n key: rx.toString(),\n ref: rx,\n code: _`${regExp.code === \"new RegExp\" ? newRegExp : useFunc(gen, regExp)}(${pattern}, ${u})`,\n })\n}\n\nexport function validateArray(cxt: KeywordCxt): Name {\n const {gen, data, keyword, it} = cxt\n const valid = gen.name(\"valid\")\n if (it.allErrors) {\n const validArr = gen.let(\"valid\", true)\n validateItems(() => gen.assign(validArr, false))\n return validArr\n }\n gen.var(valid, true)\n validateItems(() => gen.break())\n return valid\n\n function validateItems(notValid: () => void): void {\n const len = gen.const(\"len\", _`${data}.length`)\n gen.forRange(\"i\", 0, len, (i) => {\n cxt.subschema(\n {\n keyword,\n dataProp: i,\n dataPropType: Type.Num,\n },\n valid\n )\n gen.if(not(valid), notValid)\n })\n }\n}\n\nexport function validateUnion(cxt: KeywordCxt): void {\n const {gen, schema, keyword, it} = cxt\n /* istanbul ignore if */\n if (!Array.isArray(schema)) throw new Error(\"ajv implementation error\")\n const alwaysValid = schema.some((sch: AnySchema) => alwaysValidSchema(it, sch))\n if (alwaysValid && !it.opts.unevaluated) return\n\n const valid = gen.let(\"valid\", false)\n const schValid = gen.name(\"_valid\")\n\n gen.block(() =>\n schema.forEach((_sch: AnySchema, i: number) => {\n const schCxt = cxt.subschema(\n {\n keyword,\n schemaProp: i,\n compositeRule: true,\n },\n schValid\n )\n gen.assign(valid, _`${valid} || ${schValid}`)\n const merged = cxt.mergeValidEvaluated(schCxt, schValid)\n // can short-circuit if `unevaluatedProperties/Items` not supported (opts.unevaluated !== true)\n // or if all properties and items were evaluated (it.props === true && it.items === true)\n if (!merged) gen.if(not(valid))\n })\n )\n\n cxt.result(\n valid,\n () => cxt.reset(),\n () => cxt.error(true)\n )\n}\n","import type {CodeKeywordDefinition} from \"../../types\"\n\nconst def: CodeKeywordDefinition = {\n keyword: \"id\",\n code() {\n throw new Error('NOT SUPPORTED: keyword \"id\", use \"$id\" for schema ID')\n },\n}\n\nexport default def\n","import type {Vocabulary} from \"../../types\"\nimport idKeyword from \"./id\"\nimport refKeyword from \"./ref\"\n\nconst core: Vocabulary = [\n \"$schema\",\n \"$id\",\n \"$defs\",\n \"$vocabulary\",\n {keyword: \"$comment\"},\n \"definitions\",\n idKeyword,\n refKeyword,\n]\n\nexport default core\n","import type {CodeKeywordDefinition, AnySchema} from \"../../types\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport MissingRefError from \"../../compile/ref_error\"\nimport {callValidateCode} from \"../code\"\nimport {_, nil, stringify, Code, Name} from \"../../compile/codegen\"\nimport N from \"../../compile/names\"\nimport {SchemaEnv, resolveRef} from \"../../compile\"\nimport {mergeEvaluated} from \"../../compile/util\"\n\nconst def: CodeKeywordDefinition = {\n keyword: \"$ref\",\n schemaType: \"string\",\n code(cxt: KeywordCxt): void {\n const {gen, schema: $ref, it} = cxt\n const {baseId, schemaEnv: env, validateName, opts, self} = it\n const {root} = env\n if (($ref === \"#\" || $ref === \"#/\") && baseId === root.baseId) return callRootRef()\n const schOrEnv = resolveRef.call(self, root, baseId, $ref)\n if (schOrEnv === undefined) throw new MissingRefError(it.opts.uriResolver, baseId, $ref)\n if (schOrEnv instanceof SchemaEnv) return callValidate(schOrEnv)\n return inlineRefSchema(schOrEnv)\n\n function callRootRef(): void {\n if (env === root) return callRef(cxt, validateName, env, env.$async)\n const rootName = gen.scopeValue(\"root\", {ref: root})\n return callRef(cxt, _`${rootName}.validate`, root, root.$async)\n }\n\n function callValidate(sch: SchemaEnv): void {\n const v = getValidate(cxt, sch)\n callRef(cxt, v, sch, sch.$async)\n }\n\n function inlineRefSchema(sch: AnySchema): void {\n const schName = gen.scopeValue(\n \"schema\",\n opts.code.source === true ? {ref: sch, code: stringify(sch)} : {ref: sch}\n )\n const valid = gen.name(\"valid\")\n const schCxt = cxt.subschema(\n {\n schema: sch,\n dataTypes: [],\n schemaPath: nil,\n topSchemaRef: schName,\n errSchemaPath: $ref,\n },\n valid\n )\n cxt.mergeEvaluated(schCxt)\n cxt.ok(valid)\n }\n },\n}\n\nexport function getValidate(cxt: KeywordCxt, sch: SchemaEnv): Code {\n const {gen} = cxt\n return sch.validate\n ? gen.scopeValue(\"validate\", {ref: sch.validate})\n : _`${gen.scopeValue(\"wrapper\", {ref: sch})}.validate`\n}\n\nexport function callRef(cxt: KeywordCxt, v: Code, sch?: SchemaEnv, $async?: boolean): void {\n const {gen, it} = cxt\n const {allErrors, schemaEnv: env, opts} = it\n const passCxt = opts.passContext ? N.this : nil\n if ($async) callAsyncRef()\n else callSyncRef()\n\n function callAsyncRef(): void {\n if (!env.$async) throw new Error(\"async schema referenced by sync schema\")\n const valid = gen.let(\"valid\")\n gen.try(\n () => {\n gen.code(_`await ${callValidateCode(cxt, v, passCxt)}`)\n addEvaluatedFrom(v) // TODO will not work with async, it has to be returned with the result\n if (!allErrors) gen.assign(valid, true)\n },\n (e) => {\n gen.if(_`!(${e} instanceof ${it.ValidationError as Name})`, () => gen.throw(e))\n addErrorsFrom(e)\n if (!allErrors) gen.assign(valid, false)\n }\n )\n cxt.ok(valid)\n }\n\n function callSyncRef(): void {\n cxt.result(\n callValidateCode(cxt, v, passCxt),\n () => addEvaluatedFrom(v),\n () => addErrorsFrom(v)\n )\n }\n\n function addErrorsFrom(source: Code): void {\n const errs = _`${source}.errors`\n gen.assign(N.vErrors, _`${N.vErrors} === null ? ${errs} : ${N.vErrors}.concat(${errs})`) // TODO tagged\n gen.assign(N.errors, _`${N.vErrors}.length`)\n }\n\n function addEvaluatedFrom(source: Code): void {\n if (!it.opts.unevaluated) return\n const schEvaluated = sch?.validate?.evaluated\n // TODO refactor\n if (it.props !== true) {\n if (schEvaluated && !schEvaluated.dynamicProps) {\n if (schEvaluated.props !== undefined) {\n it.props = mergeEvaluated.props(gen, schEvaluated.props, it.props)\n }\n } else {\n const props = gen.var(\"props\", _`${source}.evaluated.props`)\n it.props = mergeEvaluated.props(gen, props, it.props, Name)\n }\n }\n if (it.items !== true) {\n if (schEvaluated && !schEvaluated.dynamicItems) {\n if (schEvaluated.items !== undefined) {\n it.items = mergeEvaluated.items(gen, schEvaluated.items, it.items)\n }\n } else {\n const items = gen.var(\"items\", _`${source}.evaluated.items`)\n it.items = mergeEvaluated.items(gen, items, it.items, Name)\n }\n }\n }\n}\n\nexport default def\n","import type {CodeKeywordDefinition, AnySchemaObject, KeywordErrorDefinition} from \"../../types\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport {_, getProperty, Name} from \"../../compile/codegen\"\nimport {DiscrError, DiscrErrorObj} from \"../discriminator/types\"\nimport {resolveRef, SchemaEnv} from \"../../compile\"\nimport MissingRefError from \"../../compile/ref_error\"\nimport {schemaHasRulesButRef} from \"../../compile/util\"\n\nexport type DiscriminatorError = DiscrErrorObj | DiscrErrorObj\n\nconst error: KeywordErrorDefinition = {\n message: ({params: {discrError, tagName}}) =>\n discrError === DiscrError.Tag\n ? `tag \"${tagName}\" must be string`\n : `value of tag \"${tagName}\" must be in oneOf`,\n params: ({params: {discrError, tag, tagName}}) =>\n _`{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`,\n}\n\nconst def: CodeKeywordDefinition = {\n keyword: \"discriminator\",\n type: \"object\",\n schemaType: \"object\",\n error,\n code(cxt: KeywordCxt) {\n const {gen, data, schema, parentSchema, it} = cxt\n const {oneOf} = parentSchema\n if (!it.opts.discriminator) {\n throw new Error(\"discriminator: requires discriminator option\")\n }\n const tagName = schema.propertyName\n if (typeof tagName != \"string\") throw new Error(\"discriminator: requires propertyName\")\n if (schema.mapping) throw new Error(\"discriminator: mapping is not supported\")\n if (!oneOf) throw new Error(\"discriminator: requires oneOf keyword\")\n const valid = gen.let(\"valid\", false)\n const tag = gen.const(\"tag\", _`${data}${getProperty(tagName)}`)\n gen.if(\n _`typeof ${tag} == \"string\"`,\n () => validateMapping(),\n () => cxt.error(false, {discrError: DiscrError.Tag, tag, tagName})\n )\n cxt.ok(valid)\n\n function validateMapping(): void {\n const mapping = getMapping()\n gen.if(false)\n for (const tagValue in mapping) {\n gen.elseIf(_`${tag} === ${tagValue}`)\n gen.assign(valid, applyTagSchema(mapping[tagValue]))\n }\n gen.else()\n cxt.error(false, {discrError: DiscrError.Mapping, tag, tagName})\n gen.endIf()\n }\n\n function applyTagSchema(schemaProp?: number): Name {\n const _valid = gen.name(\"valid\")\n const schCxt = cxt.subschema({keyword: \"oneOf\", schemaProp}, _valid)\n cxt.mergeEvaluated(schCxt, Name)\n return _valid\n }\n\n function getMapping(): {[T in string]?: number} {\n const oneOfMapping: {[T in string]?: number} = {}\n const topRequired = hasRequired(parentSchema)\n let tagRequired = true\n for (let i = 0; i < oneOf.length; i++) {\n let sch = oneOf[i]\n if (sch?.$ref && !schemaHasRulesButRef(sch, it.self.RULES)) {\n const ref = sch.$ref\n sch = resolveRef.call(it.self, it.schemaEnv.root, it.baseId, ref)\n if (sch instanceof SchemaEnv) sch = sch.schema\n if (sch === undefined) throw new MissingRefError(it.opts.uriResolver, it.baseId, ref)\n }\n const propSch = sch?.properties?.[tagName]\n if (typeof propSch != \"object\") {\n throw new Error(\n `discriminator: oneOf subschemas (or referenced schemas) must have \"properties/${tagName}\"`\n )\n }\n tagRequired = tagRequired && (topRequired || hasRequired(sch))\n addMappings(propSch, i)\n }\n if (!tagRequired) throw new Error(`discriminator: \"${tagName}\" must be required`)\n return oneOfMapping\n\n function hasRequired({required}: AnySchemaObject): boolean {\n return Array.isArray(required) && required.includes(tagName)\n }\n\n function addMappings(sch: AnySchemaObject, i: number): void {\n if (sch.const) {\n addMapping(sch.const, i)\n } else if (sch.enum) {\n for (const tagValue of sch.enum) {\n addMapping(tagValue, i)\n }\n } else {\n throw new Error(`discriminator: \"properties/${tagName}\" must have \"const\" or \"enum\"`)\n }\n }\n\n function addMapping(tagValue: unknown, i: number): void {\n if (typeof tagValue != \"string\" || tagValue in oneOfMapping) {\n throw new Error(`discriminator: \"${tagName}\" values must be unique strings`)\n }\n oneOfMapping[tagValue] = i\n }\n }\n },\n}\n\nexport default def\n","import type {ErrorObject} from \"../../types\"\n\nexport enum DiscrError {\n Tag = \"tag\",\n Mapping = \"mapping\",\n}\n\nexport type DiscrErrorObj = ErrorObject<\n \"discriminator\",\n {error: E; tag: string; tagValue: unknown},\n string\n>\n","import type {Vocabulary} from \"../types\"\nimport coreVocabulary from \"./core\"\nimport validationVocabulary from \"./validation\"\nimport getApplicatorVocabulary from \"./applicator\"\nimport formatVocabulary from \"./format\"\nimport {metadataVocabulary, contentVocabulary} from \"./metadata\"\n\nconst draft7Vocabularies: Vocabulary[] = [\n coreVocabulary,\n validationVocabulary,\n getApplicatorVocabulary(),\n formatVocabulary,\n metadataVocabulary,\n contentVocabulary,\n]\n\nexport default draft7Vocabularies\n","import type {\n AddedFormat,\n FormatValidator,\n AsyncFormatValidator,\n CodeKeywordDefinition,\n KeywordErrorDefinition,\n ErrorObject,\n} from \"../../types\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport {_, str, nil, or, Code, getProperty, regexpCode} from \"../../compile/codegen\"\n\ntype FormatValidate =\n | FormatValidator\n | FormatValidator\n | AsyncFormatValidator\n | AsyncFormatValidator\n | RegExp\n | string\n | true\n\nexport type FormatError = ErrorObject<\"format\", {format: string}, string | {$data: string}>\n\nconst error: KeywordErrorDefinition = {\n message: ({schemaCode}) => str`must match format \"${schemaCode}\"`,\n params: ({schemaCode}) => _`{format: ${schemaCode}}`,\n}\n\nconst def: CodeKeywordDefinition = {\n keyword: \"format\",\n type: [\"number\", \"string\"],\n schemaType: \"string\",\n $data: true,\n error,\n code(cxt: KeywordCxt, ruleType?: string) {\n const {gen, data, $data, schema, schemaCode, it} = cxt\n const {opts, errSchemaPath, schemaEnv, self} = it\n if (!opts.validateFormats) return\n\n if ($data) validate$DataFormat()\n else validateFormat()\n\n function validate$DataFormat(): void {\n const fmts = gen.scopeValue(\"formats\", {\n ref: self.formats,\n code: opts.code.formats,\n })\n const fDef = gen.const(\"fDef\", _`${fmts}[${schemaCode}]`)\n const fType = gen.let(\"fType\")\n const format = gen.let(\"format\")\n // TODO simplify\n gen.if(\n _`typeof ${fDef} == \"object\" && !(${fDef} instanceof RegExp)`,\n () => gen.assign(fType, _`${fDef}.type || \"string\"`).assign(format, _`${fDef}.validate`),\n () => gen.assign(fType, _`\"string\"`).assign(format, fDef)\n )\n cxt.fail$data(or(unknownFmt(), invalidFmt()))\n\n function unknownFmt(): Code {\n if (opts.strictSchema === false) return nil\n return _`${schemaCode} && !${format}`\n }\n\n function invalidFmt(): Code {\n const callFormat = schemaEnv.$async\n ? _`(${fDef}.async ? await ${format}(${data}) : ${format}(${data}))`\n : _`${format}(${data})`\n const validData = _`(typeof ${format} == \"function\" ? ${callFormat} : ${format}.test(${data}))`\n return _`${format} && ${format} !== true && ${fType} === ${ruleType} && !${validData}`\n }\n }\n\n function validateFormat(): void {\n const formatDef: AddedFormat | undefined = self.formats[schema]\n if (!formatDef) {\n unknownFormat()\n return\n }\n if (formatDef === true) return\n const [fmtType, format, fmtRef] = getFormat(formatDef)\n if (fmtType === ruleType) cxt.pass(validCondition())\n\n function unknownFormat(): void {\n if (opts.strictSchema === false) {\n self.logger.warn(unknownMsg())\n return\n }\n throw new Error(unknownMsg())\n\n function unknownMsg(): string {\n return `unknown format \"${schema as string}\" ignored in schema at path \"${errSchemaPath}\"`\n }\n }\n\n function getFormat(fmtDef: AddedFormat): [string, FormatValidate, Code] {\n const code =\n fmtDef instanceof RegExp\n ? regexpCode(fmtDef)\n : opts.code.formats\n ? _`${opts.code.formats}${getProperty(schema)}`\n : undefined\n const fmt = gen.scopeValue(\"formats\", {key: schema, ref: fmtDef, code})\n if (typeof fmtDef == \"object\" && !(fmtDef instanceof RegExp)) {\n return [fmtDef.type || \"string\", fmtDef.validate, _`${fmt}.validate`]\n }\n\n return [\"string\", fmtDef, fmt]\n }\n\n function validCondition(): Code {\n if (typeof formatDef == \"object\" && !(formatDef instanceof RegExp) && formatDef.async) {\n if (!schemaEnv.$async) throw new Error(\"async format in sync schema\")\n return _`await ${fmtRef}(${data})`\n }\n return typeof format == \"function\" ? _`${fmtRef}(${data})` : _`${fmtRef}.test(${data})`\n }\n }\n },\n}\n\nexport default def\n","import type {Vocabulary} from \"../../types\"\nimport formatKeyword from \"./format\"\n\nconst format: Vocabulary = [formatKeyword]\n\nexport default format\n","import type {Vocabulary} from \"../types\"\n\nexport const metadataVocabulary: Vocabulary = [\n \"title\",\n \"description\",\n \"default\",\n \"deprecated\",\n \"readOnly\",\n \"writeOnly\",\n \"examples\",\n]\n\nexport const contentVocabulary: Vocabulary = [\n \"contentMediaType\",\n \"contentEncoding\",\n \"contentSchema\",\n]\n","import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from \"../../types\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport {_} from \"../../compile/codegen\"\nimport {useFunc} from \"../../compile/util\"\nimport equal from \"../../runtime/equal\"\n\nexport type ConstError = ErrorObject<\"const\", {allowedValue: any}>\n\nconst error: KeywordErrorDefinition = {\n message: \"must be equal to constant\",\n params: ({schemaCode}) => _`{allowedValue: ${schemaCode}}`,\n}\n\nconst def: CodeKeywordDefinition = {\n keyword: \"const\",\n $data: true,\n error,\n code(cxt: KeywordCxt) {\n const {gen, data, $data, schemaCode, schema} = cxt\n if ($data || (schema && typeof schema == \"object\")) {\n cxt.fail$data(_`!${useFunc(gen, equal)}(${data}, ${schemaCode})`)\n } else {\n cxt.fail(_`${schema} !== ${data}`)\n }\n },\n}\n\nexport default def\n","import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from \"../../types\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport {_, or, Name, Code} from \"../../compile/codegen\"\nimport {useFunc} from \"../../compile/util\"\nimport equal from \"../../runtime/equal\"\n\nexport type EnumError = ErrorObject<\"enum\", {allowedValues: any[]}, any[] | {$data: string}>\n\nconst error: KeywordErrorDefinition = {\n message: \"must be equal to one of the allowed values\",\n params: ({schemaCode}) => _`{allowedValues: ${schemaCode}}`,\n}\n\nconst def: CodeKeywordDefinition = {\n keyword: \"enum\",\n schemaType: \"array\",\n $data: true,\n error,\n code(cxt: KeywordCxt) {\n const {gen, data, $data, schema, schemaCode, it} = cxt\n if (!$data && schema.length === 0) throw new Error(\"enum must have non-empty array\")\n const useLoop = schema.length >= it.opts.loopEnum\n let eql: Name | undefined\n const getEql = (): Name => (eql ??= useFunc(gen, equal))\n\n let valid: Code\n if (useLoop || $data) {\n valid = gen.let(\"valid\")\n cxt.block$data(valid, loopEnum)\n } else {\n /* istanbul ignore if */\n if (!Array.isArray(schema)) throw new Error(\"ajv implementation error\")\n const vSchema = gen.const(\"vSchema\", schemaCode)\n valid = or(...schema.map((_x: unknown, i: number) => equalCode(vSchema, i)))\n }\n cxt.pass(valid)\n\n function loopEnum(): void {\n gen.assign(valid, false)\n gen.forOf(\"v\", schemaCode as Code, (v) =>\n gen.if(_`${getEql()}(${data}, ${v})`, () => gen.assign(valid, true).break())\n )\n }\n\n function equalCode(vSchema: Name, i: number): Code {\n const sch = schema[i]\n return typeof sch === \"object\" && sch !== null\n ? _`${getEql()}(${data}, ${vSchema}[${i}])`\n : _`${data} === ${sch}`\n }\n },\n}\n\nexport default def\n","import type {ErrorObject, Vocabulary} from \"../../types\"\nimport limitNumber, {LimitNumberError} from \"./limitNumber\"\nimport multipleOf, {MultipleOfError} from \"./multipleOf\"\nimport limitLength from \"./limitLength\"\nimport pattern, {PatternError} from \"./pattern\"\nimport limitProperties from \"./limitProperties\"\nimport required, {RequiredError} from \"./required\"\nimport limitItems from \"./limitItems\"\nimport uniqueItems, {UniqueItemsError} from \"./uniqueItems\"\nimport constKeyword, {ConstError} from \"./const\"\nimport enumKeyword, {EnumError} from \"./enum\"\n\nconst validation: Vocabulary = [\n // number\n limitNumber,\n multipleOf,\n // string\n limitLength,\n pattern,\n // object\n limitProperties,\n required,\n // array\n limitItems,\n uniqueItems,\n // any\n {keyword: \"type\", schemaType: [\"string\", \"array\"]},\n {keyword: \"nullable\", schemaType: \"boolean\"},\n constKeyword,\n enumKeyword,\n]\n\nexport default validation\n\ntype LimitError = ErrorObject<\n \"maxItems\" | \"minItems\" | \"minProperties\" | \"maxProperties\" | \"minLength\" | \"maxLength\",\n {limit: number},\n number | {$data: string}\n>\n\nexport type ValidationKeywordError =\n | LimitError\n | LimitNumberError\n | MultipleOfError\n | PatternError\n | RequiredError\n | UniqueItemsError\n | ConstError\n | EnumError\n","import type {CodeKeywordDefinition, KeywordErrorDefinition} from \"../../types\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport {_, str, operators} from \"../../compile/codegen\"\n\nconst error: KeywordErrorDefinition = {\n message({keyword, schemaCode}) {\n const comp = keyword === \"maxItems\" ? \"more\" : \"fewer\"\n return str`must NOT have ${comp} than ${schemaCode} items`\n },\n params: ({schemaCode}) => _`{limit: ${schemaCode}}`,\n}\n\nconst def: CodeKeywordDefinition = {\n keyword: [\"maxItems\", \"minItems\"],\n type: \"array\",\n schemaType: \"number\",\n $data: true,\n error,\n code(cxt: KeywordCxt) {\n const {keyword, data, schemaCode} = cxt\n const op = keyword === \"maxItems\" ? operators.GT : operators.LT\n cxt.fail$data(_`${data}.length ${op} ${schemaCode}`)\n },\n}\n\nexport default def\n","import type {CodeKeywordDefinition, KeywordErrorDefinition} from \"../../types\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport {_, str, operators} from \"../../compile/codegen\"\nimport {useFunc} from \"../../compile/util\"\nimport ucs2length from \"../../runtime/ucs2length\"\n\nconst error: KeywordErrorDefinition = {\n message({keyword, schemaCode}) {\n const comp = keyword === \"maxLength\" ? \"more\" : \"fewer\"\n return str`must NOT have ${comp} than ${schemaCode} characters`\n },\n params: ({schemaCode}) => _`{limit: ${schemaCode}}`,\n}\n\nconst def: CodeKeywordDefinition = {\n keyword: [\"maxLength\", \"minLength\"],\n type: \"string\",\n schemaType: \"number\",\n $data: true,\n error,\n code(cxt: KeywordCxt) {\n const {keyword, data, schemaCode, it} = cxt\n const op = keyword === \"maxLength\" ? operators.GT : operators.LT\n const len =\n it.opts.unicode === false ? _`${data}.length` : _`${useFunc(cxt.gen, ucs2length)}(${data})`\n cxt.fail$data(_`${len} ${op} ${schemaCode}`)\n },\n}\n\nexport default def\n","import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from \"../../types\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport {_, str, operators, Code} from \"../../compile/codegen\"\n\nconst ops = operators\n\ntype Kwd = \"maximum\" | \"minimum\" | \"exclusiveMaximum\" | \"exclusiveMinimum\"\n\ntype Comparison = \"<=\" | \">=\" | \"<\" | \">\"\n\nconst KWDs: {[K in Kwd]: {okStr: Comparison; ok: Code; fail: Code}} = {\n maximum: {okStr: \"<=\", ok: ops.LTE, fail: ops.GT},\n minimum: {okStr: \">=\", ok: ops.GTE, fail: ops.LT},\n exclusiveMaximum: {okStr: \"<\", ok: ops.LT, fail: ops.GTE},\n exclusiveMinimum: {okStr: \">\", ok: ops.GT, fail: ops.LTE},\n}\n\nexport type LimitNumberError = ErrorObject<\n Kwd,\n {limit: number; comparison: Comparison},\n number | {$data: string}\n>\n\nconst error: KeywordErrorDefinition = {\n message: ({keyword, schemaCode}) => str`must be ${KWDs[keyword as Kwd].okStr} ${schemaCode}`,\n params: ({keyword, schemaCode}) =>\n _`{comparison: ${KWDs[keyword as Kwd].okStr}, limit: ${schemaCode}}`,\n}\n\nconst def: CodeKeywordDefinition = {\n keyword: Object.keys(KWDs),\n type: \"number\",\n schemaType: \"number\",\n $data: true,\n error,\n code(cxt: KeywordCxt) {\n const {keyword, data, schemaCode} = cxt\n cxt.fail$data(_`${data} ${KWDs[keyword as Kwd].fail} ${schemaCode} || isNaN(${data})`)\n },\n}\n\nexport default def\n","import type {CodeKeywordDefinition, KeywordErrorDefinition} from \"../../types\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport {_, str, operators} from \"../../compile/codegen\"\n\nconst error: KeywordErrorDefinition = {\n message({keyword, schemaCode}) {\n const comp = keyword === \"maxProperties\" ? \"more\" : \"fewer\"\n return str`must NOT have ${comp} than ${schemaCode} properties`\n },\n params: ({schemaCode}) => _`{limit: ${schemaCode}}`,\n}\n\nconst def: CodeKeywordDefinition = {\n keyword: [\"maxProperties\", \"minProperties\"],\n type: \"object\",\n schemaType: \"number\",\n $data: true,\n error,\n code(cxt: KeywordCxt) {\n const {keyword, data, schemaCode} = cxt\n const op = keyword === \"maxProperties\" ? operators.GT : operators.LT\n cxt.fail$data(_`Object.keys(${data}).length ${op} ${schemaCode}`)\n },\n}\n\nexport default def\n","import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from \"../../types\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport {_, str} from \"../../compile/codegen\"\n\nexport type MultipleOfError = ErrorObject<\n \"multipleOf\",\n {multipleOf: number},\n number | {$data: string}\n>\n\nconst error: KeywordErrorDefinition = {\n message: ({schemaCode}) => str`must be multiple of ${schemaCode}`,\n params: ({schemaCode}) => _`{multipleOf: ${schemaCode}}`,\n}\n\nconst def: CodeKeywordDefinition = {\n keyword: \"multipleOf\",\n type: \"number\",\n schemaType: \"number\",\n $data: true,\n error,\n code(cxt: KeywordCxt) {\n const {gen, data, schemaCode, it} = cxt\n // const bdt = bad$DataType(schemaCode, def.schemaType, $data)\n const prec = it.opts.multipleOfPrecision\n const res = gen.let(\"res\")\n const invalid = prec\n ? _`Math.abs(Math.round(${res}) - ${res}) > 1e-${prec}`\n : _`${res} !== parseInt(${res})`\n cxt.fail$data(_`(${schemaCode} === 0 || (${res} = ${data}/${schemaCode}, ${invalid}))`)\n },\n}\n\nexport default def\n","import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from \"../../types\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport {usePattern} from \"../code\"\nimport {_, str} from \"../../compile/codegen\"\n\nexport type PatternError = ErrorObject<\"pattern\", {pattern: string}, string | {$data: string}>\n\nconst error: KeywordErrorDefinition = {\n message: ({schemaCode}) => str`must match pattern \"${schemaCode}\"`,\n params: ({schemaCode}) => _`{pattern: ${schemaCode}}`,\n}\n\nconst def: CodeKeywordDefinition = {\n keyword: \"pattern\",\n type: \"string\",\n schemaType: \"string\",\n $data: true,\n error,\n code(cxt: KeywordCxt) {\n const {data, $data, schema, schemaCode, it} = cxt\n // TODO regexp should be wrapped in try/catchs\n const u = it.opts.unicodeRegExp ? \"u\" : \"\"\n const regExp = $data ? _`(new RegExp(${schemaCode}, ${u}))` : usePattern(cxt, schema)\n cxt.fail$data(_`!${regExp}.test(${data})`)\n },\n}\n\nexport default def\n","import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from \"../../types\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport {\n checkReportMissingProp,\n checkMissingProp,\n reportMissingProp,\n propertyInData,\n noPropertyInData,\n} from \"../code\"\nimport {_, str, nil, not, Name, Code} from \"../../compile/codegen\"\nimport {checkStrictMode} from \"../../compile/util\"\n\nexport type RequiredError = ErrorObject<\n \"required\",\n {missingProperty: string},\n string[] | {$data: string}\n>\n\nconst error: KeywordErrorDefinition = {\n message: ({params: {missingProperty}}) => str`must have required property '${missingProperty}'`,\n params: ({params: {missingProperty}}) => _`{missingProperty: ${missingProperty}}`,\n}\n\nconst def: CodeKeywordDefinition = {\n keyword: \"required\",\n type: \"object\",\n schemaType: \"array\",\n $data: true,\n error,\n code(cxt: KeywordCxt) {\n const {gen, schema, schemaCode, data, $data, it} = cxt\n const {opts} = it\n if (!$data && schema.length === 0) return\n const useLoop = schema.length >= opts.loopRequired\n if (it.allErrors) allErrorsMode()\n else exitOnErrorMode()\n\n if (opts.strictRequired) {\n const props = cxt.parentSchema.properties\n const {definedProperties} = cxt.it\n for (const requiredKey of schema) {\n if (props?.[requiredKey] === undefined && !definedProperties.has(requiredKey)) {\n const schemaPath = it.schemaEnv.baseId + it.errSchemaPath\n const msg = `required property \"${requiredKey}\" is not defined at \"${schemaPath}\" (strictRequired)`\n checkStrictMode(it, msg, it.opts.strictRequired)\n }\n }\n }\n\n function allErrorsMode(): void {\n if (useLoop || $data) {\n cxt.block$data(nil, loopAllRequired)\n } else {\n for (const prop of schema) {\n checkReportMissingProp(cxt, prop)\n }\n }\n }\n\n function exitOnErrorMode(): void {\n const missing = gen.let(\"missing\")\n if (useLoop || $data) {\n const valid = gen.let(\"valid\", true)\n cxt.block$data(valid, () => loopUntilMissing(missing, valid))\n cxt.ok(valid)\n } else {\n gen.if(checkMissingProp(cxt, schema, missing))\n reportMissingProp(cxt, missing)\n gen.else()\n }\n }\n\n function loopAllRequired(): void {\n gen.forOf(\"prop\", schemaCode as Code, (prop) => {\n cxt.setParams({missingProperty: prop})\n gen.if(noPropertyInData(gen, data, prop, opts.ownProperties), () => cxt.error())\n })\n }\n\n function loopUntilMissing(missing: Name, valid: Name): void {\n cxt.setParams({missingProperty: missing})\n gen.forOf(\n missing,\n schemaCode as Code,\n () => {\n gen.assign(valid, propertyInData(gen, data, missing, opts.ownProperties))\n gen.if(not(valid), () => {\n cxt.error()\n gen.break()\n })\n },\n nil\n )\n }\n },\n}\n\nexport default def\n","import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from \"../../types\"\nimport type {KeywordCxt} from \"../../compile/validate\"\nimport {checkDataTypes, getSchemaTypes, DataType} from \"../../compile/validate/dataType\"\nimport {_, str, Name} from \"../../compile/codegen\"\nimport {useFunc} from \"../../compile/util\"\nimport equal from \"../../runtime/equal\"\n\nexport type UniqueItemsError = ErrorObject<\n \"uniqueItems\",\n {i: number; j: number},\n boolean | {$data: string}\n>\n\nconst error: KeywordErrorDefinition = {\n message: ({params: {i, j}}) =>\n str`must NOT have duplicate items (items ## ${j} and ${i} are identical)`,\n params: ({params: {i, j}}) => _`{i: ${i}, j: ${j}}`,\n}\n\nconst def: CodeKeywordDefinition = {\n keyword: \"uniqueItems\",\n type: \"array\",\n schemaType: \"boolean\",\n $data: true,\n error,\n code(cxt: KeywordCxt) {\n const {gen, data, $data, schema, parentSchema, schemaCode, it} = cxt\n if (!$data && !schema) return\n const valid = gen.let(\"valid\")\n const itemTypes = parentSchema.items ? getSchemaTypes(parentSchema.items) : []\n cxt.block$data(valid, validateUniqueItems, _`${schemaCode} === false`)\n cxt.ok(valid)\n\n function validateUniqueItems(): void {\n const i = gen.let(\"i\", _`${data}.length`)\n const j = gen.let(\"j\")\n cxt.setParams({i, j})\n gen.assign(valid, true)\n gen.if(_`${i} > 1`, () => (canOptimize() ? loopN : loopN2)(i, j))\n }\n\n function canOptimize(): boolean {\n return itemTypes.length > 0 && !itemTypes.some((t) => t === \"object\" || t === \"array\")\n }\n\n function loopN(i: Name, j: Name): void {\n const item = gen.name(\"item\")\n const wrongType = checkDataTypes(itemTypes, item, it.opts.strictNumbers, DataType.Wrong)\n const indices = gen.const(\"indices\", _`{}`)\n gen.for(_`;${i}--;`, () => {\n gen.let(item, _`${data}[${i}]`)\n gen.if(wrongType, _`continue`)\n if (itemTypes.length > 1) gen.if(_`typeof ${item} == \"string\"`, _`${item} += \"_\"`)\n gen\n .if(_`typeof ${indices}[${item}] == \"number\"`, () => {\n gen.assign(j, _`${indices}[${item}]`)\n cxt.error()\n gen.assign(valid, false).break()\n })\n .code(_`${indices}[${item}] = ${i}`)\n })\n }\n\n function loopN2(i: Name, j: Name): void {\n const eql = useFunc(gen, equal)\n const outer = gen.name(\"outer\")\n gen.label(outer).for(_`;${i}--;`, () =>\n gen.for(_`${j} = ${i}; ${j}--;`, () =>\n gen.if(_`${eql}(${data}[${i}], ${data}[${j}])`, () => {\n cxt.error()\n gen.assign(valid, false).break(outer)\n })\n )\n )\n }\n },\n}\n\nexport default def\n","'use strict';\n\nvar traverse = module.exports = function (schema, opts, cb) {\n // Legacy support for v0.3.1 and earlier.\n if (typeof opts == 'function') {\n cb = opts;\n opts = {};\n }\n\n cb = opts.cb || cb;\n var pre = (typeof cb == 'function') ? cb : cb.pre || function() {};\n var post = cb.post || function() {};\n\n _traverse(opts, pre, post, schema, '', schema);\n};\n\n\ntraverse.keywords = {\n additionalItems: true,\n items: true,\n contains: true,\n additionalProperties: true,\n propertyNames: true,\n not: true,\n if: true,\n then: true,\n else: true\n};\n\ntraverse.arrayKeywords = {\n items: true,\n allOf: true,\n anyOf: true,\n oneOf: true\n};\n\ntraverse.propsKeywords = {\n $defs: true,\n definitions: true,\n properties: true,\n patternProperties: true,\n dependencies: true\n};\n\ntraverse.skipKeywords = {\n default: true,\n enum: true,\n const: true,\n required: true,\n maximum: true,\n minimum: true,\n exclusiveMaximum: true,\n exclusiveMinimum: true,\n multipleOf: true,\n maxLength: true,\n minLength: true,\n pattern: true,\n format: true,\n maxItems: true,\n minItems: true,\n uniqueItems: true,\n maxProperties: true,\n minProperties: true\n};\n\n\nfunction _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {\n if (schema && typeof schema == 'object' && !Array.isArray(schema)) {\n pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);\n for (var key in schema) {\n var sch = schema[key];\n if (Array.isArray(sch)) {\n if (key in traverse.arrayKeywords) {\n for (var i=0; i /[^!\"$&'()*+,\\-.;=_`a-z{}~]/u.test(String.fromCharCode(k)))\n\nfunction nonSimpleDomain (value) {\n let code = 0\n for (let i = 0, len = value.length; i < len; ++i) {\n code = value.charCodeAt(i)\n if (code > 126 || hexLookUp[code]) {\n return true\n }\n }\n return false\n}\n\nconst URI_PARSE = /^(?:([^#/:?]+):)?(?:\\/\\/((?:([^#/?@]*)@)?(\\[[^#/?\\]]+\\]|[^#/:?]*)(?::(\\d*))?))?([^#?]*)(?:\\?([^#]*))?(?:#((?:.|[\\n\\r])*))?/u\n\nfunction parse (uri, opts) {\n const options = Object.assign({}, opts)\n const parsed = {\n scheme: undefined,\n userinfo: undefined,\n host: '',\n port: undefined,\n path: '',\n query: undefined,\n fragment: undefined\n }\n const gotEncoding = uri.indexOf('%') !== -1\n let isIP = false\n if (options.reference === 'suffix') uri = (options.scheme ? options.scheme + ':' : '') + '//' + uri\n\n const matches = uri.match(URI_PARSE)\n\n if (matches) {\n // store each component\n parsed.scheme = matches[1]\n parsed.userinfo = matches[3]\n parsed.host = matches[4]\n parsed.port = parseInt(matches[5], 10)\n parsed.path = matches[6] || ''\n parsed.query = matches[7]\n parsed.fragment = matches[8]\n\n // fix port number\n if (isNaN(parsed.port)) {\n parsed.port = matches[5]\n }\n if (parsed.host) {\n const ipv4result = normalizeIPv4(parsed.host)\n if (ipv4result.isIPV4 === false) {\n const ipv6result = normalizeIPv6(ipv4result.host, { isIPV4: false })\n parsed.host = ipv6result.host.toLowerCase()\n isIP = ipv6result.isIPV6\n } else {\n parsed.host = ipv4result.host\n isIP = true\n }\n }\n if (parsed.scheme === undefined && parsed.userinfo === undefined && parsed.host === undefined && parsed.port === undefined && !parsed.path && parsed.query === undefined) {\n parsed.reference = 'same-document'\n } else if (parsed.scheme === undefined) {\n parsed.reference = 'relative'\n } else if (parsed.fragment === undefined) {\n parsed.reference = 'absolute'\n } else {\n parsed.reference = 'uri'\n }\n\n // check for reference errors\n if (options.reference && options.reference !== 'suffix' && options.reference !== parsed.reference) {\n parsed.error = parsed.error || 'URI is not a ' + options.reference + ' reference.'\n }\n\n // find scheme handler\n const schemeHandler = SCHEMES[(options.scheme || parsed.scheme || '').toLowerCase()]\n\n // check if scheme can't handle IRIs\n if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {\n // if host component is a domain name\n if (parsed.host && (options.domainHost || (schemeHandler && schemeHandler.domainHost)) && isIP === false && nonSimpleDomain(parsed.host)) {\n // convert Unicode IDN -> ASCII IDN\n try {\n parsed.host = URL.domainToASCII(parsed.host.toLowerCase())\n } catch (e) {\n parsed.error = parsed.error || \"Host's domain name can not be converted to ASCII: \" + e\n }\n }\n // convert IRI -> URI\n }\n\n if (!schemeHandler || (schemeHandler && !schemeHandler.skipNormalize)) {\n if (gotEncoding && parsed.scheme !== undefined) {\n parsed.scheme = unescape(parsed.scheme)\n }\n if (gotEncoding && parsed.userinfo !== undefined) {\n parsed.userinfo = unescape(parsed.userinfo)\n }\n if (gotEncoding && parsed.host !== undefined) {\n parsed.host = unescape(parsed.host)\n }\n if (parsed.path !== undefined && parsed.path.length) {\n parsed.path = escape(unescape(parsed.path))\n }\n if (parsed.fragment !== undefined && parsed.fragment.length) {\n parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment))\n }\n }\n\n // perform scheme specific parsing\n if (schemeHandler && schemeHandler.parse) {\n schemeHandler.parse(parsed, options)\n }\n } else {\n parsed.error = parsed.error || 'URI can not be parsed.'\n }\n return parsed\n}\n\nconst fastUri = {\n SCHEMES,\n normalize,\n resolve,\n resolveComponents,\n equal,\n serialize,\n parse\n}\n\nmodule.exports = fastUri\nmodule.exports.default = fastUri\nmodule.exports.fastUri = fastUri\n","'use strict'\n\nconst UUID_REG = /^[\\da-f]{8}\\b-[\\da-f]{4}\\b-[\\da-f]{4}\\b-[\\da-f]{4}\\b-[\\da-f]{12}$/iu\nconst URN_REG = /([\\da-z][\\d\\-a-z]{0,31}):((?:[\\w!$'()*+,\\-.:;=@]|%[\\da-f]{2})+)/iu\n\nfunction isSecure (wsComponents) {\n return typeof wsComponents.secure === 'boolean' ? wsComponents.secure : String(wsComponents.scheme).toLowerCase() === 'wss'\n}\n\nfunction httpParse (components) {\n if (!components.host) {\n components.error = components.error || 'HTTP URIs must have a host.'\n }\n\n return components\n}\n\nfunction httpSerialize (components) {\n const secure = String(components.scheme).toLowerCase() === 'https'\n\n // normalize the default port\n if (components.port === (secure ? 443 : 80) || components.port === '') {\n components.port = undefined\n }\n\n // normalize the empty path\n if (!components.path) {\n components.path = '/'\n }\n\n // NOTE: We do not parse query strings for HTTP URIs\n // as WWW Form Url Encoded query strings are part of the HTML4+ spec,\n // and not the HTTP spec.\n\n return components\n}\n\nfunction wsParse (wsComponents) {\n// indicate if the secure flag is set\n wsComponents.secure = isSecure(wsComponents)\n\n // construct resouce name\n wsComponents.resourceName = (wsComponents.path || '/') + (wsComponents.query ? '?' + wsComponents.query : '')\n wsComponents.path = undefined\n wsComponents.query = undefined\n\n return wsComponents\n}\n\nfunction wsSerialize (wsComponents) {\n// normalize the default port\n if (wsComponents.port === (isSecure(wsComponents) ? 443 : 80) || wsComponents.port === '') {\n wsComponents.port = undefined\n }\n\n // ensure scheme matches secure flag\n if (typeof wsComponents.secure === 'boolean') {\n wsComponents.scheme = (wsComponents.secure ? 'wss' : 'ws')\n wsComponents.secure = undefined\n }\n\n // reconstruct path from resource name\n if (wsComponents.resourceName) {\n const [path, query] = wsComponents.resourceName.split('?')\n wsComponents.path = (path && path !== '/' ? path : undefined)\n wsComponents.query = query\n wsComponents.resourceName = undefined\n }\n\n // forbid fragment component\n wsComponents.fragment = undefined\n\n return wsComponents\n}\n\nfunction urnParse (urnComponents, options) {\n if (!urnComponents.path) {\n urnComponents.error = 'URN can not be parsed'\n return urnComponents\n }\n const matches = urnComponents.path.match(URN_REG)\n if (matches) {\n const scheme = options.scheme || urnComponents.scheme || 'urn'\n urnComponents.nid = matches[1].toLowerCase()\n urnComponents.nss = matches[2]\n const urnScheme = `${scheme}:${options.nid || urnComponents.nid}`\n const schemeHandler = SCHEMES[urnScheme]\n urnComponents.path = undefined\n\n if (schemeHandler) {\n urnComponents = schemeHandler.parse(urnComponents, options)\n }\n } else {\n urnComponents.error = urnComponents.error || 'URN can not be parsed.'\n }\n\n return urnComponents\n}\n\nfunction urnSerialize (urnComponents, options) {\n const scheme = options.scheme || urnComponents.scheme || 'urn'\n const nid = urnComponents.nid.toLowerCase()\n const urnScheme = `${scheme}:${options.nid || nid}`\n const schemeHandler = SCHEMES[urnScheme]\n\n if (schemeHandler) {\n urnComponents = schemeHandler.serialize(urnComponents, options)\n }\n\n const uriComponents = urnComponents\n const nss = urnComponents.nss\n uriComponents.path = `${nid || options.nid}:${nss}`\n\n options.skipEscape = true\n return uriComponents\n}\n\nfunction urnuuidParse (urnComponents, options) {\n const uuidComponents = urnComponents\n uuidComponents.uuid = uuidComponents.nss\n uuidComponents.nss = undefined\n\n if (!options.tolerant && (!uuidComponents.uuid || !UUID_REG.test(uuidComponents.uuid))) {\n uuidComponents.error = uuidComponents.error || 'UUID is not valid.'\n }\n\n return uuidComponents\n}\n\nfunction urnuuidSerialize (uuidComponents) {\n const urnComponents = uuidComponents\n // normalize UUID\n urnComponents.nss = (uuidComponents.uuid || '').toLowerCase()\n return urnComponents\n}\n\nconst http = {\n scheme: 'http',\n domainHost: true,\n parse: httpParse,\n serialize: httpSerialize\n}\n\nconst https = {\n scheme: 'https',\n domainHost: http.domainHost,\n parse: httpParse,\n serialize: httpSerialize\n}\n\nconst ws = {\n scheme: 'ws',\n domainHost: true,\n parse: wsParse,\n serialize: wsSerialize\n}\n\nconst wss = {\n scheme: 'wss',\n domainHost: ws.domainHost,\n parse: ws.parse,\n serialize: ws.serialize\n}\n\nconst urn = {\n scheme: 'urn',\n parse: urnParse,\n serialize: urnSerialize,\n skipNormalize: true\n}\n\nconst urnuuid = {\n scheme: 'urn:uuid',\n parse: urnuuidParse,\n serialize: urnuuidSerialize,\n skipNormalize: true\n}\n\nconst SCHEMES = {\n http,\n https,\n ws,\n wss,\n urn,\n 'urn:uuid': urnuuid\n}\n\nmodule.exports = SCHEMES\n","'use strict'\n\nconst HEX = {\n 0: 0,\n 1: 1,\n 2: 2,\n 3: 3,\n 4: 4,\n 5: 5,\n 6: 6,\n 7: 7,\n 8: 8,\n 9: 9,\n a: 10,\n A: 10,\n b: 11,\n B: 11,\n c: 12,\n C: 12,\n d: 13,\n D: 13,\n e: 14,\n E: 14,\n f: 15,\n F: 15\n}\n\nmodule.exports = {\n HEX\n}\n","'use strict'\n\nconst { HEX } = require('./scopedChars')\n\nfunction normalizeIPv4 (host) {\n if (findToken(host, '.') < 3) { return { host, isIPV4: false } }\n const matches = host.match(/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/u) || []\n const [address] = matches\n if (address) {\n return { host: stripLeadingZeros(address, '.'), isIPV4: true }\n } else {\n return { host, isIPV4: false }\n }\n}\n\n/**\n * @param {string[]} input\n * @param {boolean} [keepZero=false]\n * @returns {string|undefined}\n */\nfunction stringArrayToHexStripped (input, keepZero = false) {\n let acc = ''\n let strip = true\n for (const c of input) {\n if (HEX[c] === undefined) return undefined\n if (c !== '0' && strip === true) strip = false\n if (!strip) acc += c\n }\n if (keepZero && acc.length === 0) acc = '0'\n return acc\n}\n\nfunction getIPV6 (input) {\n let tokenCount = 0\n const output = { error: false, address: '', zone: '' }\n const address = []\n const buffer = []\n let isZone = false\n let endipv6Encountered = false\n let endIpv6 = false\n\n function consume () {\n if (buffer.length) {\n if (isZone === false) {\n const hex = stringArrayToHexStripped(buffer)\n if (hex !== undefined) {\n address.push(hex)\n } else {\n output.error = true\n return false\n }\n }\n buffer.length = 0\n }\n return true\n }\n\n for (let i = 0; i < input.length; i++) {\n const cursor = input[i]\n if (cursor === '[' || cursor === ']') { continue }\n if (cursor === ':') {\n if (endipv6Encountered === true) {\n endIpv6 = true\n }\n if (!consume()) { break }\n tokenCount++\n address.push(':')\n if (tokenCount > 7) {\n // not valid\n output.error = true\n break\n }\n if (i - 1 >= 0 && input[i - 1] === ':') {\n endipv6Encountered = true\n }\n continue\n } else if (cursor === '%') {\n if (!consume()) { break }\n // switch to zone detection\n isZone = true\n } else {\n buffer.push(cursor)\n continue\n }\n }\n if (buffer.length) {\n if (isZone) {\n output.zone = buffer.join('')\n } else if (endIpv6) {\n address.push(buffer.join(''))\n } else {\n address.push(stringArrayToHexStripped(buffer))\n }\n }\n output.address = address.join('')\n return output\n}\n\nfunction normalizeIPv6 (host, opts = {}) {\n if (findToken(host, ':') < 2) { return { host, isIPV6: false } }\n const ipv6 = getIPV6(host)\n\n if (!ipv6.error) {\n let newHost = ipv6.address\n let escapedHost = ipv6.address\n if (ipv6.zone) {\n newHost += '%' + ipv6.zone\n escapedHost += '%25' + ipv6.zone\n }\n return { host: newHost, escapedHost, isIPV6: true }\n } else {\n return { host, isIPV6: false }\n }\n}\n\nfunction stripLeadingZeros (str, token) {\n let out = ''\n let skip = true\n const l = str.length\n for (let i = 0; i < l; i++) {\n const c = str[i]\n if (c === '0' && skip) {\n if ((i + 1 <= l && str[i + 1] === token) || i + 1 === l) {\n out += c\n skip = false\n }\n } else {\n if (c === token) {\n skip = true\n } else {\n skip = false\n }\n out += c\n }\n }\n return out\n}\n\nfunction findToken (str, token) {\n let ind = 0\n for (let i = 0; i < str.length; i++) {\n if (str[i] === token) ind++\n }\n return ind\n}\n\nconst RDS1 = /^\\.\\.?\\//u\nconst RDS2 = /^\\/\\.(?:\\/|$)/u\nconst RDS3 = /^\\/\\.\\.(?:\\/|$)/u\nconst RDS5 = /^\\/?(?:.|\\n)*?(?=\\/|$)/u\n\nfunction removeDotSegments (input) {\n const output = []\n\n while (input.length) {\n if (input.match(RDS1)) {\n input = input.replace(RDS1, '')\n } else if (input.match(RDS2)) {\n input = input.replace(RDS2, '/')\n } else if (input.match(RDS3)) {\n input = input.replace(RDS3, '/')\n output.pop()\n } else if (input === '.' || input === '..') {\n input = ''\n } else {\n const im = input.match(RDS5)\n if (im) {\n const s = im[0]\n input = input.slice(s.length)\n output.push(s)\n } else {\n throw new Error('Unexpected dot segment condition')\n }\n }\n }\n return output.join('')\n}\n\nfunction normalizeComponentEncoding (components, esc) {\n const func = esc !== true ? escape : unescape\n if (components.scheme !== undefined) {\n components.scheme = func(components.scheme)\n }\n if (components.userinfo !== undefined) {\n components.userinfo = func(components.userinfo)\n }\n if (components.host !== undefined) {\n components.host = func(components.host)\n }\n if (components.path !== undefined) {\n components.path = func(components.path)\n }\n if (components.query !== undefined) {\n components.query = func(components.query)\n }\n if (components.fragment !== undefined) {\n components.fragment = func(components.fragment)\n }\n return components\n}\n\nfunction recomposeAuthority (components, options) {\n const uriTokens = []\n\n if (components.userinfo !== undefined) {\n uriTokens.push(components.userinfo)\n uriTokens.push('@')\n }\n\n if (components.host !== undefined) {\n let host = unescape(components.host)\n const ipV4res = normalizeIPv4(host)\n\n if (ipV4res.isIPV4) {\n host = ipV4res.host\n } else {\n const ipV6res = normalizeIPv6(ipV4res.host, { isIPV4: false })\n if (ipV6res.isIPV6 === true) {\n host = `[${ipV6res.escapedHost}]`\n } else {\n host = components.host\n }\n }\n uriTokens.push(host)\n }\n\n if (typeof components.port === 'number' || typeof components.port === 'string') {\n uriTokens.push(':')\n uriTokens.push(String(components.port))\n }\n\n return uriTokens.length ? uriTokens.join('') : undefined\n};\n\nmodule.exports = {\n recomposeAuthority,\n normalizeComponentEncoding,\n removeDotSegments,\n normalizeIPv4,\n normalizeIPv6,\n stringArrayToHexStripped\n}\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","import * as packageInfo from '../package.json';\nimport { KernelHost } from './host';\nimport { InputOutput } from './in-out';\nimport { SyncStdio } from './sync-stdio';\n\nconst name = packageInfo.name;\nconst version = packageInfo.version;\n\nconst noStack = !!process.env.JSII_NOSTACK;\nconst debug = !!process.env.JSII_DEBUG;\nconst debugTiming = !!process.env.JSII_DEBUG_TIMING;\nconst validateAssemblies = !!process.env.JSII_VALIDATE_ASSEMBLIES;\n\n// This assumes FD#3 is opened for reading and writing. This is normally\n// performed by`bin/jsii-runtime.js`, and we will not be verifying this once\n// again...Meaning that failure to have set this up correctly results in\n// undefined behavior(likely a crash).\nconst stdio = new SyncStdio({\n // \"process.stderr.fd\" is not in @types/node definitions because it can be\n // absent in certain circumstances (for example, in `worker_threads` workers).\n // We'll fall-back to `2` - its expected value - in this case; but this is not\n // supposed to be happening here (we don't use `worker_threads`).\n errorFD: (process.stderr as any).fd ?? 2,\n readFD: 3,\n writeFD: 3,\n});\n\nconst inout = new InputOutput(stdio);\nconst host = new KernelHost(inout, {\n debug,\n noStack,\n debugTiming,\n validateAssemblies,\n});\n\nhost.once('exit', process.exit.bind(process));\n\n// say hello\ninout.write({ hello: `${name}@${version}` });\ninout.debug = debug; // we don't want \"hello\" emitted\n\nhost.run();\n"],"names":["fs","path","LCHOWN","lchown","LCHOWNSYNC","lchownSync","needEISDIRHandled","process","version","match","uid","gid","er","code","chownSync","handleEISDIR","cb","chown","_","__","___","handleEISDirSync","nodeVersion","readdir","options","readdirSync","test","cpath","chownrKid","p","child","lstat","resolve","stats","name","isDirectory","chownr","withFileTypes","children","length","len","errState","then","forEach","chownrKidSync","lstatSync","chownrSync","module","exports","sync","equal","a","b","constructor","i","keys","Array","isArray","RegExp","source","flags","valueOf","Object","prototype","toString","hasOwnProperty","call","key","mkdirsSync","utimesMillisSync","stat","copySync","src","dest","opts","filter","clobber","overwrite","preserveTimestamps","arch","emitWarning","checkPathsSync","checkParentPathsSync","srcStat","handleFilterAndCopy","destStat","destParent","dirname","existsSync","getStats","startCopy","statSync","dereference","onDir","isFile","isCharacterDevice","isBlockDevice","onFile","isSymbolicLink","onLink","isSocket","Error","isFIFO","copyFile","mayCopyFile","unlinkSync","errorOnExist","copyFileSync","handleTimestamps","mode","setDestMode","srcMode","fileIsNotWritable","makeFileWritable","setDestTimestamps","chmodSync","updatedSrcStat","atime","mtime","mkDirAndCopy","copyDir","mkdirSync","item","copyDirItem","srcItem","join","destItem","resolvedSrc","readlinkSync","cwd","symlinkSync","resolvedDest","err","isSrcSubdir","copyLink","mkdirs","pathExists","utimesMillis","copy","checkPaths","checkParentPaths","handleFilter","checkParentDir","dirExists","onInclude","Promise","include","error","unlink","handleTimestampsAndMode","setDestTimestampsAndMode","chmod","mkdir","items","copyDirItems","pop","readlink","symlink","u","remove","emptyDir","async","dir","all","map","emptyDirSync","removeSync","emptydirSync","emptydir","createFile","file","callback","makeFile","writeFile","createFileSync","writeFileSync","ensureFile","ensureFileSync","createLink","createLinkSync","ensureLink","ensureLinkSync","createSymlink","createSymlinkSync","ensureSymlink","ensureSymlinkSync","srcpath","dstpath","makeLink","link","dstStat","message","replace","areIdentical","linkSync","symlinkPaths","isAbsolute","toCwd","toDst","dstdir","relativeToDst","exists","relative","symlinkPathsSync","symlinkType","type","symlinkTypeSync","_mkdirs","_symlinkPaths","_symlinkType","_createSymlink","api","assign","method","filename","read","fd","buffer","offset","position","reject","bytesRead","write","args","bytesWritten","writev","buffers","realpath","native","jsonFile","outputJson","outputJsonSync","outputJSON","outputJSONSync","writeJSON","writeJson","writeJSONSync","writeJsonSync","readJSON","readJson","readJSONSync","readJsonSync","readFile","readFileSync","data","str","stringify","outputFileSync","outputFile","makeDir","_makeDir","makeDirSync","mkdirp","mkdirpSync","ensureDir","ensureDirSync","getMode","defaults","checkPath","recursive","pth","platform","pathHasInvalidWinCharacters","parse","root","move","moveSync","isParentRoot","doRename","isChangingCase","parent","parsedPath","rename","renameSync","moveAcrossDevice","destExists","encoding","itDoes","access","catch","pathExistsSync","rimraf","rm","force","rmSync","assert","isWindows","methods","m","maxBusyTries","busyTries","strictEqual","rimraf_","CB","time","setTimeout","st","fixWinEPERM","rmdir","er2","er3","fixWinEPERMSync","rmdirSync","originalEr","rmkids","files","n","f","rimrafSync","rmkidsSync","startTime","Date","now","ret","util","statFunc","bigint","getStatsSync","funcName","callbackify","srcBaseName","basename","destBaseName","toLowerCase","errMsg","srcParent","ino","dev","srcArr","split","sep","destArr","reduce","acc","cur","open","futimes","futimesErr","close","closeErr","openSync","futimesSync","closeSync","MiniPass","EE","binding","FSReqWrap","FSReqCallback","iovec","pos","done","bw","req","oncomplete","writeBuffers","_autoClose","Symbol","_close","_ended","_fd","_finished","_flags","_flush","_handleChunk","_makeBuf","_mode","_needDrain","_onerror","_onopen","_onread","_onwrite","_open","_path","_pos","_queue","_read","_readSize","_reading","_remain","_size","_write","_writing","_defaultFlag","_errored","ReadStream","opt","super","this","readable","writable","TypeError","readSize","size","Infinity","autoClose","end","emit","Buffer","allocUnsafe","Math","min","buf","nextTick","br","slice","ev","ReadStreamSync","threw","readSync","WriteStream","undefined","start","defaultFlag","enc","from","push","WriteStreamSync","writeSync","clone","getPrototypeOf","obj","__proto__","create","getOwnPropertyNames","defineProperty","getOwnPropertyDescriptor","polyfills","legacy","gracefulQueue","previousSymbol","for","noop","publishQueue","context","queue","get","debug","debuglog","env","NODE_DEBUG","format","apply","arguments","console","global","fs$close","resetQueue","value","fs$closeSync","on","patch","TEST_GRACEFUL_FS_GLOBAL_PATCH","__patched","gracefulify","createReadStream","createWriteStream","fs$readFile","go$readFile","enqueue","fs$writeFile","go$writeFile","fs$appendFile","appendFile","go$appendFile","fs$copyFile","go$copyFile","fs$readdir","noReaddirOptionVersions","go$readdir","fs$readdirCallback","sort","substr","legStreams","fs$ReadStream","ReadStream$open","fs$WriteStream","WriteStream$open","set","val","enumerable","configurable","FileReadStream","FileWriteStream","that","destroy","fs$open","go$open","elem","retry","retryTimer","clearTimeout","shift","fn","lastTime","sinceAttempt","sinceStart","max","desiredDelay","concat","Stream","self","paused","bufferSize","index","setEncoding","busy","flush","constants","origCwd","GRACEFUL_FS_PLATFORM","chdir","d","setPrototypeOf","patchLchmod","lutimes","patchLutimes","chownFix","fchown","chmodFix","fchmod","lchmod","chownFixSync","fchownSync","chmodFixSync","fchmodSync","lchmodSync","statFix","fstat","statFixSync","fstatSync","fs$rename","to","backoff","stater","fs$read","callback_","eagCounter","fs$readSync","O_WRONLY","O_SYMLINK","err2","at","mt","lutimesSync","_a","_b","_c","orig","target","chownErOk","nonroot","getuid","_fs","universalify","_readFile","shouldThrow","throws","fromCallback","stripBom","JSON","reviver","fromPromise","content","_writeFile","jsonfile","EOF","finalEOL","EOL","replacer","spaces","isBuffer","wx","c","O_TRUNC","O_CREAT","O_EXCL","os","filetime","msg","pid","locks","prop","onExit","unlockSync","H","l","listeners","h","e","removeListener","unlock","unlinkEr","check","stale","age","getTime","checkSync","wait","lock","retries","retryWait","notStale","maybeStale","hasStaleLock","statEr","pollPeriod","timer","poll","lockSync","retryThrow","ct","ceil","newRT","proc","stdout","stderr","SD","MAYBE_EMIT_END","EMITTED_END","EMITTING_END","EMITTED_ERROR","CLOSED","READ","FLUSH","FLUSHCHUNK","ENCODING","DECODER","FLOWING","PAUSED","RESUME","BUFFERLENGTH","BUFFERPUSH","BUFFERSHIFT","OBJECTMODE","DESTROYED","EMITDATA","EMITEND","EMITEND2","ASYNC","defer","doIter","_MP_NO_ITERATOR_SYMBOLS_","ASYNCITERATOR","asyncIterator","ITERATOR","iterator","isEndish","isArrayBuffer","ArrayBuffer","byteLength","isArrayBufferView","isView","Pipe","ondrain","unpipe","proxyErrors","PipeProxyErrors","Minipass","pipes","objectMode","bufferLength","lastNeed","chunk","om","byteOffset","flowing","once","resume","pause","destroyed","noDrain","pipe","ended","find","splice","indexOf","addListener","removeAllListeners","emittedEnd","extra","collect","dataLength","promise","next","res","onerr","ondata","onend","ondestroy","rej","isStream","s","realZlibConstants","ZLIB_VERNUM","freeze","Z_NO_FLUSH","Z_PARTIAL_FLUSH","Z_SYNC_FLUSH","Z_FULL_FLUSH","Z_FINISH","Z_BLOCK","Z_OK","Z_STREAM_END","Z_NEED_DICT","Z_ERRNO","Z_STREAM_ERROR","Z_DATA_ERROR","Z_MEM_ERROR","Z_BUF_ERROR","Z_VERSION_ERROR","Z_NO_COMPRESSION","Z_BEST_SPEED","Z_BEST_COMPRESSION","Z_DEFAULT_COMPRESSION","Z_FILTERED","Z_HUFFMAN_ONLY","Z_RLE","Z_FIXED","Z_DEFAULT_STRATEGY","DEFLATE","INFLATE","GZIP","GUNZIP","DEFLATERAW","INFLATERAW","UNZIP","BROTLI_DECODE","BROTLI_ENCODE","Z_MIN_WINDOWBITS","Z_MAX_WINDOWBITS","Z_DEFAULT_WINDOWBITS","Z_MIN_CHUNK","Z_MAX_CHUNK","Z_DEFAULT_CHUNK","Z_MIN_MEMLEVEL","Z_MAX_MEMLEVEL","Z_DEFAULT_MEMLEVEL","Z_MIN_LEVEL","Z_MAX_LEVEL","Z_DEFAULT_LEVEL","BROTLI_OPERATION_PROCESS","BROTLI_OPERATION_FLUSH","BROTLI_OPERATION_FINISH","BROTLI_OPERATION_EMIT_METADATA","BROTLI_MODE_GENERIC","BROTLI_MODE_TEXT","BROTLI_MODE_FONT","BROTLI_DEFAULT_MODE","BROTLI_MIN_QUALITY","BROTLI_MAX_QUALITY","BROTLI_DEFAULT_QUALITY","BROTLI_MIN_WINDOW_BITS","BROTLI_MAX_WINDOW_BITS","BROTLI_LARGE_MAX_WINDOW_BITS","BROTLI_DEFAULT_WINDOW","BROTLI_MIN_INPUT_BLOCK_BITS","BROTLI_MAX_INPUT_BLOCK_BITS","BROTLI_PARAM_MODE","BROTLI_PARAM_QUALITY","BROTLI_PARAM_LGWIN","BROTLI_PARAM_LGBLOCK","BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING","BROTLI_PARAM_SIZE_HINT","BROTLI_PARAM_LARGE_WINDOW","BROTLI_PARAM_NPOSTFIX","BROTLI_PARAM_NDIRECT","BROTLI_DECODER_RESULT_ERROR","BROTLI_DECODER_RESULT_SUCCESS","BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT","BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT","BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION","BROTLI_DECODER_PARAM_LARGE_WINDOW","BROTLI_DECODER_NO_ERROR","BROTLI_DECODER_SUCCESS","BROTLI_DECODER_NEEDS_MORE_INPUT","BROTLI_DECODER_NEEDS_MORE_OUTPUT","BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE","BROTLI_DECODER_ERROR_FORMAT_RESERVED","BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE","BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET","BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME","BROTLI_DECODER_ERROR_FORMAT_CL_SPACE","BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE","BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT","BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1","BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2","BROTLI_DECODER_ERROR_FORMAT_TRANSFORM","BROTLI_DECODER_ERROR_FORMAT_DICTIONARY","BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS","BROTLI_DECODER_ERROR_FORMAT_PADDING_1","BROTLI_DECODER_ERROR_FORMAT_PADDING_2","BROTLI_DECODER_ERROR_FORMAT_DISTANCE","BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET","BROTLI_DECODER_ERROR_INVALID_ARGUMENTS","BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES","BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS","BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP","BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1","BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2","BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES","BROTLI_DECODER_ERROR_UNREACHABLE","realZlib","OriginalBufferConcat","_superWrite","ZlibError","errno","captureStackTrace","_opts","_flushFlag","_finishFlushFlag","_fullFlushFlag","_handle","_onError","_sawError","_level","_strategy","_defaultFullFlush","ZlibBase","finishFlush","reset","flushFlag","alloc","nativeHandle","originalNativeClose","originalClose","result","_processChunk","writeReturn","Zlib","level","strategy","params","origFlush","Deflate","Inflate","_portable","Gzip","portable","Gunzip","DeflateRaw","InflateRaw","Unzip","Brotli","BrotliCompress","BrotliDecompress","optsArg","pathArg","useNative","mkdirpNative","mkdirpManual","useNativeSync","mkdirpNativeSync","mkdirpManualSync","manual","nativeSync","manualSync","findMade","statAsync","findMadeSync","made","mkdirAsync","parseInt","promisify","__TESTING_MKDIRP_PLATFORM__","badWinChars","__TESTING_MKDIRP_NODE_VERSION__","versArr","hasNative","processOk","reallyExit","kill","signals","isWin","EventEmitter","emitter","__signal_exit_emitter__","count","emitted","infinite","setMaxListeners","loaded","load","alwaysLast","unload","sig","sigListeners","originalProcessEmit","originalProcessReallyExit","event","signal","listener","processEmit","processReallyExit","exitCode","arg","r","t","list","update","x","extract","Pack","Unpack","Parse","ReadEntry","WriteEntry","Header","Pax","types","hlo","fsm","opt_","createSync","Sync","stream","addFilesSync","addFilesAsync","charAt","noResume","onentry","entry","add","stripSlash","filesFilter","extractFileSync","extractFile","extractSync","Map","mapHas","has","maxReadSize","__FAKE_PLATFORM__","__FAKE_TESTING_FS__","fMapEnabled","UV_FS_O_FILEMAP","fMapLimit","fMapFlag","pathModule","large","SLURP","TYPE","off","ex","gex","cksumValid","needPax","nullBlock","block","cksum","linkpath","uname","gname","devmaj","devmin","ctime","decode","decString","decNumber","decDate","prefix","sum","k","encode","prefixSize","splitPrefix","encString","encNumber","encDate","charCodeAt","typeKey","pathSize","pp","numToDate","num","decSmallNumber","nanNull","isNaN","trim","MAXNUM","number","encSmallNumber","octalString","padOctal","floor","string","date","NULLS","argmap","kv","Number","isSafeInteger","encodeNegative","encodePositive","flipped","byte","onesComp","twosComp","pre","twos","pow","Parser","onentryFunction","listFileSync","listFile","normPath","SymlinkError","CwdError","cGet","cache","cSet","checkCwd","umask","needChmod","doChown","processUid","processGid","preserve","created","sub","parts","mkdir_","base","part","onmkdir","checkCwdSync","ok","isDir","normalizeCache","normalize","TESTING_TAR_FAKE_PLATFORM","PackJob","absolute","pending","ignore","piped","zlib","WriteEntrySync","WriteEntryTar","Tar","Yallist","ONSTAT","ENDED","QUEUE","CURRENT","PROCESS","PROCESSING","PROCESSJOB","JOBS","JOBDONE","ADDFSENTRY","ADDTARENTRY","STAT","READDIR","ONREADDIR","PIPE","ENTRY","ENTRYOPT","WRITEENTRYCLASS","WRITE","ONDRAIN","warner","preservePaths","strict","noPax","linkCache","statCache","readdirCache","onwarn","zip","gzip","brotli","noDirRecurse","follow","noMtime","jobs","job","entries","w","head","removeNode","warn","PackSync","maxMetaEntrySize","Entry","gzipHeader","STATE","WRITEENTRY","READENTRY","NEXTENTRY","PROCESSENTRY","EX","GEX","META","EMITMETA","BUFFER","EMITTEDEND","EMIT","CONSUMECHUNK","CONSUMECHUNKSUB","CONSUMEBODY","CONSUMEMETA","CONSUMEHEADER","CONSUMING","BUFFERCONCAT","MAYBEEND","WRITING","ABORTED","DONE","SAW_VALID_ENTRY","SAW_NULL_BLOCK","SAW_EOF","CLOSESTREAM","ondone","isTBR","endsWith","header","remain","invalid","meta","go","re","drainNow","blockRemain","abort","recoverable","needSniff","maybeBrotli","have","stripSlashes","queues","reservations","getDirs","dirs","running","Set","getQueues","paths","every","q","run","clear","delete","reserve","charset","comment","nlink","body","encodeBody","bodyLen","bufLen","encodeField","field","v","byteLen","digits","log","g","merge","parseKV","parseKVLine","line","extended","globalExtended","startBlockSize","writeLen","replaceSync","headBuf","POSITION","bufPos","bytes","entryBlockSize","mtimeCache","streamSync","getPos","cb_","onread","flag","onopen","parsed","slashesStart","wc","pathReservations","stripAbsolutePath","ONENTRY","CHECKFS","CHECKFS2","PRUNECACHE","ISREUSABLE","MAKEFS","FILE","DIRECTORY","LINK","SYMLINK","HARDLINK","UNSUPPORTED","CHECKPATH","MKDIR","ONERROR","PENDING","PEND","UNPEND","MAYBECLOSE","SKIP","DOCHOWN","UID","GID","CHECKED_CWD","crypto","getFlag","DEFAULT_MAX_DEPTH","unlinkFile","randomBytes","unlinkFileSync","uint32","cacheKeyNormalize","pruneCache","abs","pnorm","dropCache","transform","dirCache","preserveOwner","setOwner","getgid","maxDepth","forceChown","win32","newer","keep","strip","processUmask","noChmod","dmode","fmode","linkparts","isFinite","depth","includes","stripped","resolvedPath","aRoot","pRoot","fullyDone","actions","utimes","tx","unsupported","afterMakeParent","lstatEr","afterChmod","callSync","UnpackSync","mkParent","oner","closeError","futimeser","utimesSync","utimeser","fchowner","chowner","mtimeFilter","Base","tarCode","raw","win","char","String","fromCharCode","toWin","toRaw","prefixPath","HEADER","LSTAT","ONLSTAT","ONREAD","ONREADLINK","OPENFILE","ONOPENFILE","CLOSE","MODE","AWAITDRAIN","PREFIX","HAD_ERROR","winchars","modeFix","myuid","myuser","USER","blockLen","pathWarn","getType","linkKey","syscall","writeBuf","flushed","readEntry","stringdecoder","StringDecoder","PIPES","ERROR","ABORT","SIGNAL","debugExposeBuffer","debugExposePipes","addEventListener","aborted","reason","stopped","stop","throw","return","walker","Node","tail","node","prev","unshiftNode","pushNode","unshift","thisp","forEachReverse","getReverse","mapReverse","initial","reduceReverse","toArray","arr","toArrayReverse","sliceReverse","deleteCount","nodes","insert","reverse","inserted","TOKEN_REF","TOKEN_INTERFACES","TOKEN_DATE","TOKEN_ENUM","TOKEN_MAP","TOKEN_STRUCT","isObjRef","isWireDate","isWireEnum","isWireMap","isWireStruct","isMethodOverride","isPropertyOverride","property","ALGORITHM","digestFile","comments","hash","createHash","digest","MARKER_FILE_NAME","ONE_DAY_IN_MS","PRUNE_AFTER_MILLISECONDS","JSII_RUNTIME_PACKAGE_CACHE_TTL","DiskCache","pruneExpiredEntries","inDirectory","didCreate","realpathSync","flatMap","ss","entryFor","rawDigest","cutOff","lockedEntry","directoriesUnder","isComplete","retrieve","markComplete","lockSyncWithWait","disposed","ignoreErrors","sleep","sleepSync","random","ms","Atomics","Int32Array","SharedArrayBuffer","JsiiFault","RuntimeError","Kernel","callbackHandler","traceEnabled","debugTimingEnabled","validateAssemblies","ObjectTable","bind","objects","isVisibleType","findSymbol","lookupType","getBinScriptCommand","invokeBinScript","cp","spawnSync","command","shell","status","del","objref","deleteObject","sget","symbol","fqn","ti","static","sset","immutable","findObject","interfaces","propertyToGet","instance","propInfo","propertyToSet","invoke","jsiiTypeFqn","parameters","returns","sinvoke","begin","prid","promiseid","storedPromise","callbacks","_req","cbid","cookie","override","complete","fail","sandoxResult","expectedReturnType","succeed","naming","assemblyName","assembly","targets","metadata","objectCount","pkgname","pkgver","packageDir","epkg","assm","originalUmask","tar","tarball","assmSpec","spec","loadAssemblyFromPath","entryPoint","closure","Assembly","jsiiVersion","jsiiMajor","jsiiMinor","_jsiiPatch","_rest","typedef","kind","TypeKind","Interface","Class","Enum","tagJsiiConstructor","wire","EMPTY_OBJECT_FQN","ctor","typeinfo","classType","initializer","mkdtempSync","tmpdir","createRequire","requestArgs","ctorResult","registerObject","overrides","overrideTypeErrorMessage","properties","typeFqn","CANONICAL_ANY","propertyName","getPropertyDescriptor","prevEnumerable","direct","proto","methodInfo","variadic","methodName","methodContext","methodArgs","param","j","optional","describeTypeReference","curr","components","moduleName","fqnInfo","addendum","classFqn","bases","found","typeInfo","isClassType","classTypeInfo","isInterfaceType","interfaceTypeInfo","baseFqn","expectedType","targetType","xs","boxUnbox","parametersCopy","label","fullLabel","timeEnd","desc","superProp","scriptPath","bin","script","nodeOptions","execArgv","NODE_OPTIONS","PATH","execPath","PRESERVE_SYMLINKS","existingRoot","destinationRoot","winNoSymlink","recurse","existing","destination","OBJID_SYMBOL","IFACES_SYMBOL","JSII_RTTI_SYMBOL","RESOLVED_TYPE_FQN","WeakMap","objectReference","tagObject","objid","privateField","resolveType","existingRef","allIfaces","iface","additionalInterfaces","builtIn","InterfaceCollection","addFromClass","addFromInterface","removeSyncPaths","registerIfNeeded","registered","onExitHandler","VOID","SYMBOL_WIRE_TYPE","SERIALIZERS","serialize","_type","host","deserialize","optionalValue","nullAndOk","isDate","SerializationError","serializeDate","deserializeDate","primitiveType","isScalar","primitive","collection","CollectionKind","elementtype","PrimitiveType","Json","allowNullishMapValue","mapJsonValue","mapValues","toMap","inspect","enumType","enumMap","enumEntry","deserializeEnum","arrayType","idx","mapType","namedType","props","propertiesOf","validateRequiredProps","isAssignable","jsiiType","namedTypeRef","declaredType","prevRef","isByReferenceOnly","mapOfAny","toISOString","enumLocator","lastIndexOf","typeName","valueName","enumValue","serializationType","typeRef","lookup","serializationClass","isPrimitiveTypeReference","Any","Boolean","isCollectionTypeReference","isUnionTypeReference","compoundTypes","union","compareSerializationClasses","isEnumType","datatype","out","wireValue","isClassOrInterfaceType","actualTypeFqn","requiredType","actualType","actualProps","specProps","missingRequiredProps","order","descr","serde","wireTypes","errors","typeDescr","optionalTypeDescr","titleize","renderValue","text","first","rest","toUpperCase","causes","describeTypeOf","cause","ctorName","defaultCacheRoot","HOME","LOCALAPPDATA","packageCacheEnabled","JSII_RUNTIME_PACKAGE_CACHE","toLocaleLowerCase","outDir","extractViaCache","extractToOutDir","cacheRoot","JSII_RUNTIME_PACKAGE_CACHE_ROOT","untarInto","getPackageCacheEnabled","setPackageCacheEnabled","KernelHost","inout","kernel","eventEmitter","debugTiming","exit","processRequest","setImmediate","completeCallback","completeReq","apiReq","findApi","checkIfAsyncIsAllowed","writeOkay","isPromise","writeError","stack","noStack","apiName","InputOutput","stdio","output","writeLine","writeErrorLine","reqLine","readLine","startsWith","input","INPUT_BUFFER_SIZE","SyncStdio","bufferedData","readBuffer","errorFD","stdin","readFD","writeFD","writeBuffer","newData","newLinePos","compressedAssemblyExists","directory","SPEC_FILE_NAME_COMPRESSED","findAssemblyFile","dotJsiiFile","SPEC_FILE_NAME","replaceAssembly","writeAssembly","_fingerprint","compress","fingerprint","repeat","schema","compression","gzipSync","failNoReadfileProvided","loadAssemblyFromBuffer","assemblyBuffer","validate","contents","isAssemblyRedirect","followRedirect","validateAssembly","assemblyFile","loadAssemblyFromFile","pathToFile","assemblyRedirect","validateAssemblyRedirect","gunzipSync","json","SchemaVersion","Stability","isNamedTypeReference","ref","isMethod","callable","unionType","isDeprecated","entity","docs","stability","Deprecated","NameTree","_children","of","nameTree","values","register","_fqn","assemblyRedirectSchema","SCHEMA","ajv","allErrors","compile","errorsText","separator","dataVar","META_SUPPORT_DATA","META_SCHEMA_ID","Ajv","_addVocabularies","addVocabulary","discriminator","addKeyword","_addDefaultMetaSchema","metaSchema","$data","$dataMetaSchema","draft7MetaSchema","addMetaSchema","refs","defaultMeta","getSchema","KeywordCxt","nil","Name","CodeGen","default","_CodeOrName","IDENTIFIER","emptyStr","names","_Code","_items","_str","_names","strs","addCodeArg","plus","expr","safeStringify","optimize","interpolate","mergeExprItems","strConcat","c1","c2","getProperty","getEsmExportName","regexpCode","rx","Scope","ValueScope","ValueScopeName","varKinds","operators","GT","GTE","LT","LTE","EQ","NEQ","NOT","OR","AND","ADD","optimizeNodes","optimizeNames","_constants","Def","varKind","rhs","render","es5","var","_n","optimizeExpr","Assign","lhs","sideEffects","addExprNames","AssignOp","op","Label","Break","Throw","AnyCode","ParentNode","subtractNames","addNames","BlockNode","Root","Else","If","condition","else","cond","ns","not","For","ForLoop","iteration","ForRange","ForIter","loop","iterable","Func","_async","Return","Try","finally","Catch","Finally","extScope","_values","_blockStarts","lines","_extScope","_scope","_nodes","_root","scopeName","scopeValue","prefixOrName","vs","getScopeValue","keyOrRef","getValue","scopeRefs","scopeCode","_def","nameOrPrefix","constant","toName","_leafNode","_constant","const","let","object","keyValues","thenBody","elseBody","_blockNode","endIf","elseIf","_elseNode","_endBlockNode","_for","forBody","endFor","forRange","forOf","forIn","ownProperties","tryBody","catchCode","finallyCode","_currNode","nodeCount","endBlock","toClose","func","funcBody","endFunc","N1","N2","replaceName","canOptimize","some","par","andCode","mappend","and","orCode","or","y","ValueError","UsedValueState","_prefixes","prefixes","_parent","_newName","ng","_nameGroup","nameStr","setValue","scopePath","itemIndex","scope","valueKey","_name","_reduceValues","usedValues","getCode","valueCode","nameSet","Started","def","Completed","keywordError","keyword","keyword$DataError","schemaType","reportError","cxt","errorPaths","overrideAllErrors","it","errObj","errorObjectCode","compositeRule","addError","gen","returnErrors","reportExtraError","vErrors","resetErrorsCount","errsCount","if","extendErrors","instancePath","errorPath","errSchemaPath","verbose","schemaValue","errs","schemaEnv","$async","ValidationError","validateName","E","schemaPath","parentSchema","createErrors","errorObject","errorInstancePath","errorSchemaPath","extraErrorProps","instPath","getErrorPath","Type","Str","schPath","messages","topSchemaRef","SchemaEnv","dynamicAnchors","schemaId","baseId","normalizeId","localRefs","compileSchema","sch","_sch","getCompilingSchema","rootId","getFullPath","uriResolver","_ValidationError","schemaCxt","parentData","parentDataProperty","dataNames","dataPathArr","dataLevel","dataTypes","definedProperties","jtd","sourceCode","_compilations","validateFunctionCode","validateCode","makeValidate","Function","scopeValues","unevaluated","evaluated","dynamicProps","dynamicItems","logger","resolveRef","resolveUrl","schOrFunc","inlineOrCompile","inlineRef","inlineRefs","schEnv","sameSchemaEnv","s1","s2","schemas","resolveSchema","refPath","_getFullPath","getJsonPointer","id","schOrRef","schId","PREVENT_SCOPE_CHANGE","parsedRef","fragment","partSchema","unescapeFragment","$ref","schemaHasRulesButRef","RULES","valCxt","rootData","jsonPos","jsonLen","jsonPart","MissingRefError","resolver","missingRef","missingSchema","SIMPLE_INLINED","limit","hasRef","countKeys","REF_KEYWORDS","eachItem","serialized","TRAILING_SLASH_HASH","ANCHOR","getSchemaRefs","baseIds","pathPrefix","schemaRefs","traverse","allKeys","jsonPtr","parentJsonPtr","fullPath","innerBaseId","addRef","addAnchor","$anchor","$dynamicAnchor","_resolve","ambiguos","checkAmbiguosRef","anchor","sch1","sch2","_jsonTypes","jsonTypes","isJSONType","getRules","groups","rules","array","integer","boolean","null","post","keywords","toHash","alwaysValidSchema","checkUnknownRules","schemaHasRules","strictSchema","checkStrictMode","schemaRefOrVal","unescapeJsonPointer","decodeURIComponent","escapeFragment","encodeURIComponent","escapeJsonPointer","makeMergeEvaluated","mergeNames","mergeToName","mergeValues","resultToName","mergeEvaluated","setEvaluated","evaluatedPropsToName","ps","snippets","useFunc","dataProp","dataPropType","jsPropertySyntax","isNumber","Num","schemaHasRulesForType","group","shouldUseGroup","rule","shouldUseRule","definition","implements","kwd","boolError","topBoolOrEmptySchema","falseSchemaError","boolOrEmptySchema","valid","schemaCode","DataType","getSchemaTypes","getJSONTypes","hasNull","nullable","ts","coerceAndCheckDataType","coerceTo","coerceToTypes","coerceTypes","checkTypes","wrongType","checkDataTypes","strictNumbers","Wrong","coerceData","reportTypeError","COERCIBLE","dataType","coerced","coerceSpecificType","assignParentData","checkDataType","strictNums","correct","Correct","numCond","_cond","notObj","typeError","getTypeErrorContext","assignDefaults","ty","assignDefault","defaultValue","childData","useDefaults","isSchemaObj","checkKeywords","schemaCxtHasRules","topSchemaObjCode","validateFunction","funcSourceUrl","destructureValCxtES5","destructureValCxt","dynamicRef","$comment","commentKeyword","checkNoDefault","resetEvaluated","typeAndKeywords","returnResults","subschemaCode","subSchemaObjCode","updateContext","checkAsyncSchema","checkRefsAndKeywords","schemaKeywords","checkedTypes","ignoreKeywordsWithRef","rootName","assignEvaluated","typeErrors","keywordCode","checkStrictTypes","groupKeywords","iterateKeywords","strictTypes","checkContextTypes","allowUnionTypes","checkMultipleTypes","checkKeywordTypes","includesType","strictTypesError","narrowSchemaTypes","hasApplicableType","schTs","kwdT","withTypes","validateKeywordUsage","getData","validSchemaType","allowUndefined","trackErrors","successAction","failAction","failResult","pass","fail$data","invalid$data","append","errorParams","setParams","_error","$dataError","block$data","codeBlock","$dataValid","check$data","validateSchema","wrong$DataType","invalid$DataSchema","validateSchemaRef","subschema","appl","getSubschema","extendSubschemaData","extendSubschemaMode","nextContext","mergeValidEvaluated","ruleType","funcKeywordCode","macroKeywordCode","JSON_POINTER","RELATIVE_JSON_POINTER","jsonPointer","matches","exec","up","errorMsg","segments","segment","pointerType","macroSchema","macro","schemaRef","useKeyword","checkAsyncKeyword","validateRef","validateKeyword","assignValid","modifying","modifyData","reportErrs","ruleErrs","validateAsync","validateSync","addErrs","try","validateErrs","_await","passCxt","passContext","passSchema","callValidateCode","deps","dependencies","schemaProp","dpType","nextData","dataContextProps","_nextData","jtdDiscriminator","jtdMetadata","defaultRegExp","META_IGNORE_OPTIONS","EXT_SCOPE_NAMES","removedOptions","errorDataPath","jsonPointers","extendRefs","missingRefs","processCode","strictDefaults","strictKeywords","uniqueItems","unknownFormats","ajvErrors","deprecatedOptions","unicode","MAX_EXPRESSION","requiredOptions","o","_optz","regExp","strictTuples","strictRequired","loopRequired","loopEnum","addUsedSchema","validateFormats","unicodeRegExp","int32range","formats","_loading","_cache","getLogger","formatOpt","checkOptions","_metaOpts","getMetaSchemaOptions","addInitialFormats","addInitialKeywords","addInitialSchemas","_dataRefSchema","$dataRefSchema","$id","schemaKeyRef","_meta","_addSchema","_compileSchemaEnv","compileAsync","loadSchema","runCompileAsync","_schema","loadMetaSchema","$schema","_compileAsync","checkLoaded","loadMissingSchema","_loadSchema","addSchema","_validateSchema","_checkUnique","throwOrLogError","keyRef","getSchEnv","removeSchema","_removeAllSchemas","cacheKey","definitions","kwdOrDef","checkKeyword","addRule","keywordMetaschema","getKeyword","removeKeyword","findIndex","addFormat","keywordsJsonPointers","seg","schemaOrData","regex","_compileMetaSchema","currentOpts","checkOpts","optsSchemas","defs","metaOpts","noLogs","KEYWORD_NAME","ruleGroup","before","addBeforeRule","_rule","$dataRef","anyOf","ucs2length","uri","validation","validateAdditionalItems","validateItems","break","additionalProperty","removeAdditional","allSchemaProperties","patProps","patternProperties","checkAdditionalProperties","additionalPropertyCode","isAdditional","definedProp","propsSchema","isOwnProperty","usePattern","deleteAdditional","applyAdditionalSchema","schCxt","validateUnion","minContains","maxContains","validateItemsWithCount","schValid","checkLimits","_valid","depsCount","property_ies","missingProperty","propDeps","schDeps","splitDependencies","validatePropertyDeps","validateSchemaDeps","propertyDeps","schemaDeps","missing","hasProperty","propertyInData","depProp","checkReportMissingProp","checkMissingProp","reportMissingProp","ifClause","hasThen","hasSchema","hasElse","validateIf","validateClause","getApplicator","draft2020","applicator","validateTuple","validateArray","extraItems","schArr","checkStrictTuple","fullTuple","minItems","maxItems","prefixItems","passing","validateOneOf","patterns","alwaysValidPatterns","checkProperties","allowMatchingProperties","validatePatternProperties","pat","checkMatchingProperties","validateProperties","alwaysValid","additionalProperties","allProps","hasDefault","applyPropertySchema","noPropertyInData","hasPropFunc","schemaMap","schemaProperties","dataAndSchema","newRegExp","pattern","validArr","notValid","merged","core","callRootRef","schOrEnv","callValidate","inlineRefSchema","callRef","getValidate","schName","callAsyncRef","callSyncRef","addEvaluatedFrom","addErrorsFrom","schEvaluated","discrError","tagName","DiscrError","Tag","tag","mapping","oneOf","validateMapping","getMapping","tagValue","applyTagSchema","Mapping","oneOfMapping","topRequired","hasRequired","tagRequired","propSch","addMappings","required","addMapping","enum","draft7Vocabularies","metadataVocabulary","contentVocabulary","validate$DataFormat","validateFormat","fmts","fDef","fType","unknownFmt","invalidFmt","callFormat","validData","formatDef","unknownFormat","fmtType","fmtRef","getFormat","validCondition","unknownMsg","fmtDef","fmt","useLoop","eql","getEql","vSchema","_x","equalCode","comp","ops","KWDs","maximum","okStr","minimum","exclusiveMaximum","exclusiveMinimum","prec","multipleOfPrecision","allErrorsMode","exitOnErrorMode","requiredKey","loopAllRequired","loopUntilMissing","itemTypes","validateUniqueItems","loopN","loopN2","indices","outer","_traverse","additionalItems","contains","propertyNames","arrayKeywords","allOf","propsKeywords","$defs","skipKeywords","multipleOf","maxLength","minLength","maxProperties","minProperties","rootSchema","parentKeyword","keyIndex","escapeJsonPtr","require","SCHEMES","baseURI","relativeURI","schemelessOptions","scheme","resolved","resolveComponents","skipEscape","skipNormalization","tolerant","userinfo","port","removeDotSegments","query","uriA","uriB","unescape","normalizeComponentEncoding","cmpts","nid","nss","uuid","reference","resourceName","secure","uriTokens","schemeHandler","escape","authority","recomposeAuthority","absolutePath","hexLookUp","nonSimpleDomain","URI_PARSE","gotEncoding","isIP","ipv4result","normalizeIPv4","isIPV4","ipv6result","normalizeIPv6","isIPV6","unicodeSupport","domainHost","URL","domainToASCII","skipNormalize","encodeURI","fastUri","UUID_REG","URN_REG","isSecure","wsComponents","httpParse","httpSerialize","wsParse","wsSerialize","urnParse","urnComponents","urnScheme","urnSerialize","uriComponents","urnuuidParse","uuidComponents","urnuuidSerialize","http","https","ws","wss","urn","urnuuid","HEX","A","B","C","D","F","findToken","address","stripLeadingZeros","stringArrayToHexStripped","keepZero","getIPV6","tokenCount","zone","isZone","endipv6Encountered","endIpv6","consume","hex","cursor","ipv6","newHost","escapedHost","token","skip","ind","RDS1","RDS2","RDS3","RDS5","im","esc","ipV4res","ipV6res","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","packageInfo","JSII_NOSTACK","JSII_DEBUG","JSII_DEBUG_TIMING","JSII_VALIDATE_ASSEMBLIES","hello"],"sourceRoot":""}