nf3 0.3.4 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/README.md +9 -3
  2. package/dist/_chunks/libs/exsolve.mjs +1 -1
  3. package/dist/_chunks/libs/pathe.mjs +1 -1
  4. package/dist/_chunks/libs/pkg-types.d.mts +1 -0
  5. package/dist/_chunks/trace.mjs +2 -2
  6. package/dist/_chunks/types.d.mts +1 -1
  7. package/dist/db.d.mts +6 -1
  8. package/dist/db.mjs +7 -1
  9. package/dist/index.d.mts +0 -1
  10. package/dist/node_modules/@isaacs/brace-expansion/dist/commonjs/index.js +1 -1
  11. package/dist/node_modules/@isaacs/fs-minipass/dist/commonjs/index.js +1 -1
  12. package/dist/node_modules/@mapbox/node-pre-gyp/lib/clean.js +1 -1
  13. package/dist/node_modules/@mapbox/node-pre-gyp/lib/install.js +1 -1
  14. package/dist/node_modules/@mapbox/node-pre-gyp/lib/main.js +1 -1
  15. package/dist/node_modules/@mapbox/node-pre-gyp/lib/mock/http.js +2 -2
  16. package/dist/node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js +1 -1
  17. package/dist/node_modules/@mapbox/node-pre-gyp/lib/package.js +1 -1
  18. package/dist/node_modules/@mapbox/node-pre-gyp/lib/pre-binding.js +1 -1
  19. package/dist/node_modules/@mapbox/node-pre-gyp/lib/publish.js +1 -1
  20. package/dist/node_modules/@mapbox/node-pre-gyp/lib/reinstall.js +1 -1
  21. package/dist/node_modules/@mapbox/node-pre-gyp/lib/reveal.js +1 -1
  22. package/dist/node_modules/@mapbox/node-pre-gyp/lib/testpackage.js +1 -1
  23. package/dist/node_modules/@mapbox/node-pre-gyp/lib/unpublish.js +1 -1
  24. package/dist/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js +1 -1
  25. package/dist/node_modules/@mapbox/node-pre-gyp/lib/util/versioning.js +4 -4
  26. package/dist/node_modules/@rollup/pluginutils/dist/cjs/index.js +2 -2
  27. package/dist/node_modules/@vercel/nft/out/analyze.js +1 -1
  28. package/dist/node_modules/@vercel/nft/out/fs.js +1 -1
  29. package/dist/node_modules/@vercel/nft/out/node-file-trace.js +1 -1
  30. package/dist/node_modules/@vercel/nft/out/resolve-dependency.js +1 -1
  31. package/dist/node_modules/@vercel/nft/out/utils/ast-helpers.js +1 -1
  32. package/dist/node_modules/@vercel/nft/out/utils/get-package-base.js +1 -1
  33. package/dist/node_modules/@vercel/nft/out/utils/interop-require.js +1 -1
  34. package/dist/node_modules/@vercel/nft/out/utils/sharedlib-emit.js +1 -1
  35. package/dist/node_modules/@vercel/nft/package.json +1 -1
  36. package/dist/node_modules/acorn-import-attributes/lib/index.js +1 -1
  37. package/dist/node_modules/async-sema/lib/index.js +1 -1
  38. package/dist/node_modules/bindings/bindings.js +3 -3
  39. package/dist/node_modules/consola/dist/basic.cjs +1 -1
  40. package/dist/node_modules/consola/dist/core.cjs +4 -4
  41. package/dist/node_modules/detect-libc/lib/detect-libc.js +1 -1
  42. package/dist/node_modules/detect-libc/lib/filesystem.js +1 -1
  43. package/dist/node_modules/file-uri-to-path/index.js +1 -1
  44. package/dist/node_modules/glob/dist/commonjs/glob.js +1 -1
  45. package/dist/node_modules/glob/dist/commonjs/has-magic.js +1 -1
  46. package/dist/node_modules/glob/dist/commonjs/index.js +1 -1
  47. package/dist/node_modules/glob/dist/commonjs/walker.js +1 -1
  48. package/dist/node_modules/minimatch/dist/commonjs/index.js +3 -3
  49. package/dist/node_modules/minipass/dist/commonjs/index.js +1 -1
  50. package/dist/node_modules/node-gyp-build/node-gyp-build.js +3 -3
  51. package/dist/node_modules/nopt/lib/nopt.js +1 -1
  52. package/dist/node_modules/nopt/lib/type-defs.js +1 -1
  53. package/dist/node_modules/path-scurry/dist/commonjs/index.js +1 -1
  54. package/dist/node_modules/picomatch/index.js +1 -1
  55. package/dist/node_modules/picomatch/lib/picomatch.js +1 -1
  56. package/dist/node_modules/picomatch/lib/scan.js +1 -1
  57. package/dist/node_modules/resolve-from/index.js +1 -1
  58. package/dist/node_modules/semver/classes/comparator.js +1 -1
  59. package/dist/node_modules/semver/classes/range.js +1 -1
  60. package/dist/node_modules/semver/classes/semver.js +1 -1
  61. package/dist/node_modules/semver/functions/clean.js +1 -1
  62. package/dist/node_modules/semver/functions/cmp.js +1 -1
  63. package/dist/node_modules/semver/functions/coerce.js +1 -1
  64. package/dist/node_modules/semver/functions/compare-build.js +1 -1
  65. package/dist/node_modules/semver/functions/compare-loose.js +1 -1
  66. package/dist/node_modules/semver/functions/compare.js +1 -1
  67. package/dist/node_modules/semver/functions/diff.js +1 -1
  68. package/dist/node_modules/semver/functions/eq.js +1 -1
  69. package/dist/node_modules/semver/functions/gt.js +1 -1
  70. package/dist/node_modules/semver/functions/gte.js +1 -1
  71. package/dist/node_modules/semver/functions/inc.js +1 -1
  72. package/dist/node_modules/semver/functions/lt.js +1 -1
  73. package/dist/node_modules/semver/functions/lte.js +1 -1
  74. package/dist/node_modules/semver/functions/major.js +1 -1
  75. package/dist/node_modules/semver/functions/minor.js +1 -1
  76. package/dist/node_modules/semver/functions/neq.js +1 -1
  77. package/dist/node_modules/semver/functions/patch.js +1 -1
  78. package/dist/node_modules/semver/functions/prerelease.js +1 -1
  79. package/dist/node_modules/semver/functions/rcompare.js +1 -1
  80. package/dist/node_modules/semver/functions/rsort.js +1 -1
  81. package/dist/node_modules/semver/functions/satisfies.js +1 -1
  82. package/dist/node_modules/semver/functions/sort.js +1 -1
  83. package/dist/node_modules/semver/functions/valid.js +1 -1
  84. package/dist/node_modules/semver/internal/parse-options.js +1 -1
  85. package/dist/node_modules/semver/internal/re.js +1 -1
  86. package/dist/node_modules/semver/ranges/gtr.js +1 -1
  87. package/dist/node_modules/semver/ranges/intersects.js +1 -1
  88. package/dist/node_modules/semver/ranges/ltr.js +1 -1
  89. package/dist/node_modules/semver/ranges/max-satisfying.js +1 -1
  90. package/dist/node_modules/semver/ranges/min-satisfying.js +1 -1
  91. package/dist/node_modules/semver/ranges/min-version.js +1 -1
  92. package/dist/node_modules/semver/ranges/outside.js +1 -1
  93. package/dist/node_modules/semver/ranges/subset.js +1 -1
  94. package/dist/node_modules/semver/ranges/valid.js +1 -1
  95. package/dist/plugin.mjs +1 -1
  96. package/package.json +13 -12
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,`__esModule`,{value:!0});var path=require(`path`),estreeWalker=require(`estree-walker`),pm=require(`picomatch`);const addExtension=function(x,S=`.js`){let C=`${x}`;return path.extname(x)||(C+=S),C},extractors={ArrayPattern(i,x){for(let S of x.elements)S&&extractors[S.type](i,S)},AssignmentPattern(i,x){extractors[x.left.type](i,x.left)},Identifier(i,x){i.push(x.name)},MemberExpression(){},ObjectPattern(i,x){for(let S of x.properties)S.type===`RestElement`?extractors.RestElement(i,S):extractors[S.value.type](i,S.value)},RestElement(i,x){extractors[x.argument.type](i,x.argument)}},extractAssignedNames=function(i){let x=[];return extractors[i.type](x,i),x},blockDeclarations={const:!0,let:!0};class Scope{constructor(i={}){this.parent=i.parent,this.isBlockScope=!!i.block,this.declarations=Object.create(null),i.params&&i.params.forEach(i=>{extractAssignedNames(i).forEach(i=>{this.declarations[i]=!0})})}addDeclaration(i,x,S){!x&&this.isBlockScope?this.parent.addDeclaration(i,x,S):i.id&&extractAssignedNames(i.id).forEach(i=>{this.declarations[i]=!0})}contains(i){return this.declarations[i]||(this.parent?this.parent.contains(i):!1)}}const attachScopes=function(i,S=`scope`){let C=new Scope;return estreeWalker.walk(i,{enter(i,x){let w=i;if(/(?:Function|Class)Declaration/.test(w.type)&&C.addDeclaration(w,!1,!1),w.type===`VariableDeclaration`){let{kind:i}=w,x=blockDeclarations[i];w.declarations.forEach(i=>{C.addDeclaration(i,x,!0)})}let T;if(w.type.includes(`Function`)){let i=w;T=new Scope({parent:C,block:!1,params:i.params}),i.type===`FunctionExpression`&&i.id&&T.addDeclaration(i,!1,!1)}/For(?:In|Of)?Statement/.test(w.type)&&(T=new Scope({parent:C,block:!0})),w.type===`BlockStatement`&&!x.type.includes(`Function`)&&(T=new Scope({parent:C,block:!0})),w.type===`CatchClause`&&(T=new Scope({parent:C,params:w.param?[w.param]:[],block:!0})),T&&(Object.defineProperty(w,S,{value:T,configurable:!0}),C=T)},leave(i){i[S]&&(C=C.parent)}}),C};function isArray(i){return Array.isArray(i)}function ensureArray(i){return isArray(i)?i:i==null?[]:[i]}const normalizePathRegExp=RegExp(`\\${path.win32.sep}`,`g`),normalizePath=function(x){return x.replace(normalizePathRegExp,path.posix.sep)};function getMatcherString(x,S){if(S===!1||path.isAbsolute(x)||x.startsWith(`**`))return normalizePath(x);let C=normalizePath(path.resolve(S||``)).replace(/[-^$*+?.()|[\]{}]/g,`\\$&`);return path.posix.join(C,normalizePath(x))}const createFilter=function(i,x,C){let w=C&&C.resolve,T=i=>i instanceof RegExp?i:{test:x=>pm(getMatcherString(i,w),{dot:!0})(x)},E=ensureArray(i).map(T),D=ensureArray(x).map(T);return!E.length&&!D.length?i=>typeof i==`string`&&!i.includes(`\0`):function(i){if(typeof i!=`string`||i.includes(`\0`))return!1;let x=normalizePath(i);for(let i=0;i<D.length;++i){let S=D[i];if(S instanceof RegExp&&(S.lastIndex=0),S.test(x))return!1}for(let i=0;i<E.length;++i){let S=E[i];if(S instanceof RegExp&&(S.lastIndex=0),S.test(x))return!0}return!E.length}},reservedWords=`break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public`,builtins=`arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl`,forbiddenIdentifiers=new Set(`break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl`.split(` `));forbiddenIdentifiers.add(``);const makeLegalIdentifier=function(i){let x=i.replace(/-(\w)/g,(i,x)=>x.toUpperCase()).replace(/[^$_a-zA-Z0-9]/g,`_`);return(/\d/.test(x[0])||forbiddenIdentifiers.has(x))&&(x=`_${x}`),x||`_`};function stringify(i){return(JSON.stringify(i)||`undefined`).replace(/[\u2028\u2029]/g,i=>`\\u${`000${i.charCodeAt(0).toString(16)}`.slice(-4)}`)}function serializeArray(i,x,S){let C=`[`,w=x?`\n${S}${x}`:``;for(let T=0;T<i.length;T++){let E=i[T];C+=`${T>0?`,`:``}${w}${serialize(E,x,S+x)}`}return`${C}${x?`\n${S}`:``}]`}function serializeObject(i,x,S){let C=`{`,w=x?`\n${S}${x}`:``,T=Object.entries(i);for(let i=0;i<T.length;i++){let[E,D]=T[i],O=makeLegalIdentifier(E)===E?E:stringify(E);C+=`${i>0?`,`:``}${w}${O}:${x?` `:``}${serialize(D,x,S+x)}`}return`${C}${x?`\n${S}`:``}}`}function serialize(i,x,S){if(typeof i==`object`&&i)return Array.isArray(i)?serializeArray(i,x,S):i instanceof Date?`new Date(${i.getTime()})`:i instanceof RegExp?i.toString():serializeObject(i,x,S);if(typeof i==`number`){if(i===1/0)return`Infinity`;if(i===-1/0)return`-Infinity`;if(i===0)return 1/i==1/0?`0`:`-0`;if(i!==i)return`NaN`}if(typeof i==`symbol`){let x=Symbol.keyFor(i);if(x!==void 0)return`Symbol.for(${stringify(x)})`}return typeof i==`bigint`?`${i}n`:stringify(i)}const hasStringIsWellFormed=`isWellFormed`in String.prototype;function isWellFormedString(i){return hasStringIsWellFormed?i.isWellFormed():!/\p{Surrogate}/u.test(i)}const dataToEsm=function(i,x={}){let S=x.compact?``:`indent`in x?x.indent:` `,C=x.compact?``:` `,w=x.compact?``:`
2
- `,T=x.preferConst?`const`:`var`;if(x.namedExports===!1||typeof i!=`object`||Array.isArray(i)||i instanceof Date||i instanceof RegExp||i===null){let w=serialize(i,x.compact?null:S,``);return`export default${C||(/^[{[\-\/]/.test(w)?``:` `)}${w};`}let E=0;for(let x of Object.keys(i)){let i=/^(_+)/.exec(x)?.[0].length??0;i>E&&(E=i)}let D=`${`_`.repeat(E+1)}arbitrary`,O=``,k=[],A=[];for(let[E,j]of Object.entries(i))if(E===makeLegalIdentifier(E))x.objectShorthand?k.push(E):k.push(`${E}:${C}${E}`),O+=`export ${T} ${E}${C}=${C}${serialize(j,x.compact?null:S,``)};${w}`;else if(k.push(`${stringify(E)}:${C}${serialize(j,x.compact?null:S,``)}`),x.includeArbitraryNames&&isWellFormedString(E)){let i=`${D}${A.length}`;O+=`${T} ${i}${C}=${C}${serialize(j,x.compact?null:S,``)};${w}`,A.push(`${i} as ${JSON.stringify(E)}`)}let j=A.length>0?`export${C}{${w}${S}${A.join(`,${w}${S}`)}${w}};${w}`:``,M=`export default${C}{${w}${S}${k.join(`,${w}${S}`)}${w}};${w}`;return`${O}${j}${M}`};function exactRegex(i,x){return RegExp(`^${combineMultipleStrings(i)}$`,x)}function prefixRegex(i,x){return RegExp(`^${combineMultipleStrings(i)}`,x)}function suffixRegex(i,x){return RegExp(`${combineMultipleStrings(i)}$`,x)}const escapeRegexRE=/[-/\\^$*+?.()|[\]{}]/g;function escapeRegex(i){return i.replace(escapeRegexRE,`\\$&`)}function combineMultipleStrings(i){if(Array.isArray(i)){let x=i.map(escapeRegex).join(`|`);return x&&i.length>1?`(?:${x})`:x}return escapeRegex(i)}var index={addExtension,attachScopes,createFilter,dataToEsm,exactRegex,extractAssignedNames,makeLegalIdentifier,normalizePath,prefixRegex,suffixRegex};exports.addExtension=addExtension,exports.attachScopes=attachScopes,exports.createFilter=createFilter,exports.dataToEsm=dataToEsm,exports.default=index,exports.exactRegex=exactRegex,exports.extractAssignedNames=extractAssignedNames,exports.makeLegalIdentifier=makeLegalIdentifier,exports.normalizePath=normalizePath,exports.prefixRegex=prefixRegex,exports.suffixRegex=suffixRegex,module.exports=Object.assign(exports.default,exports);
1
+ "use strict";Object.defineProperty(exports,`__esModule`,{value:!0});var path=require(`path`),estreeWalker=require(`estree-walker`),pm=require(`picomatch`);const addExtension=function(t,n=`.js`){let r=`${t}`;return path.extname(t)||(r+=n),r},extractors={ArrayPattern(e,t){for(let n of t.elements)n&&extractors[n.type](e,n)},AssignmentPattern(e,t){extractors[t.left.type](e,t.left)},Identifier(e,t){e.push(t.name)},MemberExpression(){},ObjectPattern(e,t){for(let n of t.properties)n.type===`RestElement`?extractors.RestElement(e,n):extractors[n.value.type](e,n.value)},RestElement(e,t){extractors[t.argument.type](e,t.argument)}},extractAssignedNames=function(e){let t=[];return extractors[e.type](t,e),t},blockDeclarations={const:!0,let:!0};class Scope{constructor(e={}){this.parent=e.parent,this.isBlockScope=!!e.block,this.declarations=Object.create(null),e.params&&e.params.forEach(e=>{extractAssignedNames(e).forEach(e=>{this.declarations[e]=!0})})}addDeclaration(e,t,n){!t&&this.isBlockScope?this.parent.addDeclaration(e,t,n):e.id&&extractAssignedNames(e.id).forEach(e=>{this.declarations[e]=!0})}contains(e){return this.declarations[e]||(this.parent?this.parent.contains(e):!1)}}const attachScopes=function(e,n=`scope`){let r=new Scope;return estreeWalker.walk(e,{enter(e,t){let i=e;if(/(?:Function|Class)Declaration/.test(i.type)&&r.addDeclaration(i,!1,!1),i.type===`VariableDeclaration`){let{kind:e}=i,t=blockDeclarations[e];i.declarations.forEach(e=>{r.addDeclaration(e,t,!0)})}let a;if(i.type.includes(`Function`)){let e=i;a=new Scope({parent:r,block:!1,params:e.params}),e.type===`FunctionExpression`&&e.id&&a.addDeclaration(e,!1,!1)}/For(?:In|Of)?Statement/.test(i.type)&&(a=new Scope({parent:r,block:!0})),i.type===`BlockStatement`&&!t.type.includes(`Function`)&&(a=new Scope({parent:r,block:!0})),i.type===`CatchClause`&&(a=new Scope({parent:r,params:i.param?[i.param]:[],block:!0})),a&&(Object.defineProperty(i,n,{value:a,configurable:!0}),r=a)},leave(e){e[n]&&(r=r.parent)}}),r};function isArray(e){return Array.isArray(e)}function ensureArray(e){return isArray(e)?e:e==null?[]:[e]}const normalizePathRegExp=RegExp(`\\${path.win32.sep}`,`g`),normalizePath=function(t){return t.replace(normalizePathRegExp,path.posix.sep)};function getMatcherString(t,n){if(n===!1||path.isAbsolute(t)||t.startsWith(`**`))return normalizePath(t);let r=normalizePath(path.resolve(n||``)).replace(/[-^$*+?.()|[\]{}]/g,`\\$&`);return path.posix.join(r,normalizePath(t))}const createFilter=function(e,t,r){let i=r&&r.resolve,a=e=>e instanceof RegExp?e:{test:t=>pm(getMatcherString(e,i),{dot:!0})(t)},o=ensureArray(e).map(a),s=ensureArray(t).map(a);return!o.length&&!s.length?e=>typeof e==`string`&&!e.includes(`\0`):function(e){if(typeof e!=`string`||e.includes(`\0`))return!1;let t=normalizePath(e);for(let e=0;e<s.length;++e){let n=s[e];if(n instanceof RegExp&&(n.lastIndex=0),n.test(t))return!1}for(let e=0;e<o.length;++e){let n=o[e];if(n instanceof RegExp&&(n.lastIndex=0),n.test(t))return!0}return!o.length}},reservedWords=`break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public`,builtins=`arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl`,forbiddenIdentifiers=new Set(`break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl`.split(` `));forbiddenIdentifiers.add(``);const makeLegalIdentifier=function(e){let t=e.replace(/-(\w)/g,(e,t)=>t.toUpperCase()).replace(/[^$_a-zA-Z0-9]/g,`_`);return(/\d/.test(t[0])||forbiddenIdentifiers.has(t))&&(t=`_${t}`),t||`_`};function stringify(e){return(JSON.stringify(e)||`undefined`).replace(/[\u2028\u2029]/g,e=>`\\u${`000${e.charCodeAt(0).toString(16)}`.slice(-4)}`)}function serializeArray(e,t,n){let r=`[`,i=t?`\n${n}${t}`:``;for(let a=0;a<e.length;a++){let o=e[a];r+=`${a>0?`,`:``}${i}${serialize(o,t,n+t)}`}return`${r}${t?`\n${n}`:``}]`}function serializeObject(e,t,n){let r=`{`,i=t?`\n${n}${t}`:``,a=Object.entries(e);for(let e=0;e<a.length;e++){let[o,s]=a[e],c=makeLegalIdentifier(o)===o?o:stringify(o);r+=`${e>0?`,`:``}${i}${c}:${t?` `:``}${serialize(s,t,n+t)}`}return`${r}${t?`\n${n}`:``}}`}function serialize(e,t,n){if(typeof e==`object`&&e)return Array.isArray(e)?serializeArray(e,t,n):e instanceof Date?`new Date(${e.getTime()})`:e instanceof RegExp?e.toString():serializeObject(e,t,n);if(typeof e==`number`){if(e===1/0)return`Infinity`;if(e===-1/0)return`-Infinity`;if(e===0)return 1/e==1/0?`0`:`-0`;if(e!==e)return`NaN`}if(typeof e==`symbol`){let t=Symbol.keyFor(e);if(t!==void 0)return`Symbol.for(${stringify(t)})`}return typeof e==`bigint`?`${e}n`:stringify(e)}const hasStringIsWellFormed=`isWellFormed`in String.prototype;function isWellFormedString(e){return hasStringIsWellFormed?e.isWellFormed():!/\p{Surrogate}/u.test(e)}const dataToEsm=function(e,t={}){let n=t.compact?``:`indent`in t?t.indent:` `,r=t.compact?``:` `,i=t.compact?``:`
2
+ `,a=t.preferConst?`const`:`var`;if(t.namedExports===!1||typeof e!=`object`||Array.isArray(e)||e instanceof Date||e instanceof RegExp||e===null){let i=serialize(e,t.compact?null:n,``);return`export default${r||(/^[{[\-\/]/.test(i)?``:` `)}${i};`}let o=0;for(let t of Object.keys(e)){let e=/^(_+)/.exec(t)?.[0].length??0;e>o&&(o=e)}let s=`${`_`.repeat(o+1)}arbitrary`,c=``,l=[],u=[];for(let[o,d]of Object.entries(e))if(o===makeLegalIdentifier(o))t.objectShorthand?l.push(o):l.push(`${o}:${r}${o}`),c+=`export ${a} ${o}${r}=${r}${serialize(d,t.compact?null:n,``)};${i}`;else if(l.push(`${stringify(o)}:${r}${serialize(d,t.compact?null:n,``)}`),t.includeArbitraryNames&&isWellFormedString(o)){let e=`${s}${u.length}`;c+=`${a} ${e}${r}=${r}${serialize(d,t.compact?null:n,``)};${i}`,u.push(`${e} as ${JSON.stringify(o)}`)}let d=u.length>0?`export${r}{${i}${n}${u.join(`,${i}${n}`)}${i}};${i}`:``,f=`export default${r}{${i}${n}${l.join(`,${i}${n}`)}${i}};${i}`;return`${c}${d}${f}`};function exactRegex(e,t){return RegExp(`^${combineMultipleStrings(e)}$`,t)}function prefixRegex(e,t){return RegExp(`^${combineMultipleStrings(e)}`,t)}function suffixRegex(e,t){return RegExp(`${combineMultipleStrings(e)}$`,t)}const escapeRegexRE=/[-/\\^$*+?.()|[\]{}]/g;function escapeRegex(e){return e.replace(escapeRegexRE,`\\$&`)}function combineMultipleStrings(e){if(Array.isArray(e)){let t=e.map(escapeRegex).join(`|`);return t&&e.length>1?`(?:${t})`:t}return escapeRegex(e)}var index={addExtension,attachScopes,createFilter,dataToEsm,exactRegex,extractAssignedNames,makeLegalIdentifier,normalizePath,prefixRegex,suffixRegex};exports.addExtension=addExtension,exports.attachScopes=attachScopes,exports.createFilter=createFilter,exports.dataToEsm=dataToEsm,exports.default=index,exports.exactRegex=exactRegex,exports.extractAssignedNames=extractAssignedNames,exports.makeLegalIdentifier=makeLegalIdentifier,exports.normalizePath=normalizePath,exports.prefixRegex=prefixRegex,exports.suffixRegex=suffixRegex,module.exports=Object.assign(exports.default,exports);
@@ -1 +1 @@
1
- "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,`__esModule`,{value:!0}),exports.default=analyze;const path_1=__importDefault(require(`path`)),estree_walker_1=require(`estree-walker`),pluginutils_1=require(`@rollup/pluginutils`),static_eval_1=require(`./utils/static-eval`),acorn_1=require(`acorn`),bindings_1=__importDefault(require(`bindings`)),ast_helpers_1=require(`./utils/ast-helpers`),glob_1=require(`glob`),get_package_base_1=require(`./utils/get-package-base`),binary_locators_1=require(`./utils/binary-locators`),interop_require_1=require(`./utils/interop-require`),special_cases_1=__importDefault(require(`./utils/special-cases`)),resolve_dependency_js_1=__importDefault(require(`./resolve-dependency.js`)),node_gyp_build_1=__importDefault(require(`node-gyp-build`)),node_pre_gyp_1=__importDefault(require(`@mapbox/node-pre-gyp`)),url_1=require(`url`),acorn=acorn_1.Parser.extend(require(`acorn-import-attributes`).importAttributesOrAssertions),os_1=__importDefault(require(`os`)),url_2=__importDefault(require(`url`)),wrappers_1=require(`./utils/wrappers`),resolve_from_1=__importDefault(require(`resolve-from`)),staticProcess={cwd:()=>cwd,env:{NODE_ENV:static_eval_1.UNKNOWN,[static_eval_1.UNKNOWN]:!0},[static_eval_1.UNKNOWN]:!0},EXPRESS_SET=Symbol(),EXPRESS_ENGINE=Symbol(),NBIND_INIT=Symbol(),SET_ROOT_DIR=Symbol(),PKG_INFO=Symbol(),FS_FN=Symbol(),FS_DIR_FN=Symbol(),BINDINGS=Symbol(),NODE_GYP_BUILD=Symbol(),fsSymbols={access:FS_FN,accessSync:FS_FN,createReadStream:FS_FN,exists:FS_FN,existsSync:FS_FN,fstat:FS_FN,fstatSync:FS_FN,lstat:FS_FN,lstatSync:FS_FN,open:FS_FN,readdir:FS_DIR_FN,readdirSync:FS_DIR_FN,readFile:FS_FN,readFileSync:FS_FN,stat:FS_FN,statSync:FS_FN},fsExtraSymbols={...fsSymbols,pathExists:FS_FN,pathExistsSync:FS_FN,readJson:FS_FN,readJSON:FS_FN,readJsonSync:FS_FN,readJSONSync:FS_FN},MODULE_FN=Symbol(),CREATE_REQUIRE=Symbol(),moduleSymbols={register:MODULE_FN,createRequire:CREATE_REQUIRE},staticModules=Object.assign(Object.create(null),{bindings:{default:BINDINGS},express:{default:function(){return{[static_eval_1.UNKNOWN]:!0,set:EXPRESS_SET,engine:EXPRESS_ENGINE}}},fs:{default:fsSymbols,...fsSymbols},module:{default:moduleSymbols,...moduleSymbols},"fs-extra":{default:fsExtraSymbols,...fsExtraSymbols},"graceful-fs":{default:fsSymbols,...fsSymbols},process:{default:staticProcess,...staticProcess},path:{default:{}},os:{default:os_1.default,...os_1.default},url:{default:url_2.default,...url_2.default},"@mapbox/node-pre-gyp":{default:node_pre_gyp_1.default,...node_pre_gyp_1.default},"node-pre-gyp":binary_locators_1.pregyp,"node-pre-gyp/lib/pre-binding":binary_locators_1.pregyp,"node-pre-gyp/lib/pre-binding.js":binary_locators_1.pregyp,"node-gyp-build":{default:NODE_GYP_BUILD},"@aminya/node-gyp-build":{default:NODE_GYP_BUILD},nbind:{init:NBIND_INIT,default:{init:NBIND_INIT}},"resolve-from":{default:resolve_from_1.default},"strong-globalize":{default:{SetRootDir:SET_ROOT_DIR},SetRootDir:SET_ROOT_DIR},pkginfo:{default:PKG_INFO}}),globalBindings={_interopRequireDefault:interop_require_1.normalizeDefaultRequire,_interopRequireWildcard:interop_require_1.normalizeWildcardRequire,__importDefault:interop_require_1.normalizeDefaultRequire,__importStar:interop_require_1.normalizeWildcardRequire,MONGOOSE_DRIVER_PATH:void 0,URL:url_1.URL,Object:{assign:Object.assign}};globalBindings.global=globalBindings.GLOBAL=globalBindings.globalThis=globalBindings;const TRIGGER=Symbol();binary_locators_1.pregyp.find[TRIGGER]=!0;const staticPath=staticModules.path;Object.keys(path_1.default).forEach(e=>{let x=path_1.default[e];if(typeof x==`function`){let b=function e(){return x.apply(e,arguments)};b[TRIGGER]=!0,staticPath[e]=staticPath.default[e]=b}else staticPath[e]=staticPath.default[e]=x}),staticPath.resolve=staticPath.default.resolve=function(...e){return path_1.default.resolve.apply(this,[cwd,...e])},staticPath.resolve[TRIGGER]=!0;const excludeAssetExtensions=new Set([`.h`,`.cmake`,`.c`,`.cpp`]),excludeAssetFiles=new Set([`CHANGELOG.md`,`README.md`,`readme.md`,`changelog.md`]);let cwd;const absoluteRegEx=/^\/[^\/]+|^[a-z]:[\\/][^\\/]+/i;function isAbsolutePathOrUrl(e){if(e instanceof url_1.URL)return e.protocol===`file:`;if(typeof e==`string`){if(e.startsWith(`file:`))try{return new url_1.URL(e),!0}catch{return!1}return absoluteRegEx.test(e)}return!1}const BOUND_REQUIRE=Symbol(),repeatGlobRegEx=/([\/\\]\*\*[\/\\]\*)+/g;async function analyze(e,w,D){let O=new Set,k=new Set,A=new Set,j=path_1.default.dirname(e);cwd=D.cwd;let M=(0,get_package_base_1.getPackageBase)(e),N=e=>{if(!D.analysis.emitGlobs)return;e=e.replaceAll(path_1.default.sep,path_1.default.posix.sep);let x=e.indexOf(static_eval_1.WILDCARD),S=x===-1?e.length:e.lastIndexOf(path_1.default.posix.sep,x),w=e.substring(0,S),T=e.slice(S),E=T.replace(static_eval_1.wildcardRegEx,(e,x)=>T[x-1]===path_1.default.posix.sep?`**/*`:`*`).replace(repeatGlobRegEx,`/**/*`)||`/**/*`;D.ignoreFn(path_1.default.relative(D.base,w+E))||(P=P.then(async()=>{D.log&&console.log(`Globbing `+w+E),(await(0,glob_1.glob)(w+E,{mark:!0,ignore:w+`/**/node_modules/**/*`,dot:!0,nodir:!0})).filter(e=>!excludeAssetExtensions.has(path_1.default.extname(e))&&!excludeAssetFiles.has(path_1.default.basename(e))).forEach(e=>O.add(e))}))},P=Promise.resolve();w=w.replace(/^#![^\n\r]*[\r\n]/,``);let F,I=!1;try{F=acorn.parse(w,{ecmaVersion:`latest`,allowReturnOutsideFunction:!0}),I=!1}catch(b){b&&b.message&&b.message.includes(`sourceType: module`)||D.warnings.add(Error(`Failed to parse ${e} as script:\n${b&&b.message}`))}if(!F)try{F=acorn.parse(w,{ecmaVersion:`latest`,sourceType:`module`,allowAwaitOutsideFunction:!0}),I=!0}catch(b){return D.warnings.add(Error(`Failed to parse ${e} as module:\n${b&&b.message}`)),{assets:O,deps:k,imports:A,isESM:!1}}let L=(0,url_1.pathToFileURL)(e).href,R=Object.assign(Object.create(null),{__dirname:{shadowDepth:0,value:{value:path_1.default.resolve(e,`..`)}},__filename:{shadowDepth:0,value:{value:e}},process:{shadowDepth:0,value:{value:staticProcess}}});(!I||D.mixedModules)&&(R.require={shadowDepth:0,value:{value:{[static_eval_1.FUNCTION](e){return k.add(e),staticModules[e.startsWith(`node:`)?e.slice(5):e].default},resolve(b){return(0,resolve_dependency_js_1.default)(b,e,D)}}}},R.require.value.value.resolve[TRIGGER]=!0);function z(e,b){e===`require`&&`value`in b&&b.value!==BOUND_REQUIRE||(R[e]={shadowDepth:0,value:b})}function B(e){let b=R[e];if(b&&b.shadowDepth===0)return b.value}function V(e){let b=R[e];return b&&b.shadowDepth===0}if((I||D.mixedModules)&&isAst(F))for(let e of F.body)if(e.type===`ImportDeclaration`){let b=String(e.source.value);k.add(b);let x=staticModules[b.startsWith(`node:`)?b.slice(5):b];if(x)for(let b of e.specifiers)b.type===`ImportNamespaceSpecifier`?z(b.local.name,{value:x}):b.type===`ImportDefaultSpecifier`&&`default`in x?z(b.local.name,{value:x.default}):b.type===`ImportSpecifier`&&b.imported.name in x&&z(b.local.name,{value:x[b.imported.name]})}else (e.type===`ExportNamedDeclaration`||e.type===`ExportAllDeclaration`)&&e.source&&k.add(String(e.source.value));async function H(e,b=!0){let x=Object.create(null);return Object.keys(globalBindings).forEach(e=>{x[e]={value:globalBindings[e]}}),Object.keys(R).forEach(e=>{x[e]=B(e)}),x[`import.meta`]={url:L},await(0,static_eval_1.evaluate)(e,x,b)}let U,W,G=!1;function K(e){if(!D.analysis.emitGlobs||!e.startsWith(`./`)&&!e.startsWith(`../`))return;e=path_1.default.resolve(j,e).replaceAll(path_1.default.sep,path_1.default.posix.sep);let x=e.indexOf(static_eval_1.WILDCARD),S=x===-1?e.length:e.lastIndexOf(path_1.default.posix.sep,x),w=e.substring(0,S),T=e.slice(S),E=T.replace(static_eval_1.wildcardRegEx,(e,x)=>T[x-1]===path_1.default.posix.sep?`**/*`:`*`)||`/**/*`;E.endsWith(`*`)||(E+=`?(`+(D.ts?`.ts|.tsx|`:``)+`.js|.json|.node)`),!D.ignoreFn(path_1.default.relative(D.base,w+E))&&(P=P.then(async()=>{D.log&&console.log(`Globbing `+w+E),(await(0,glob_1.glob)(w+E,{mark:!0,ignore:w+`/**/node_modules/**/*`,nodir:!0})).filter(e=>!excludeAssetExtensions.has(path_1.default.extname(e))&&!excludeAssetFiles.has(path_1.default.basename(e))).forEach(e=>k.add(e))}))}async function q(e,b=!1){if(e.type===`ConditionalExpression`){await q(e.consequent,b),await q(e.alternate,b);return}if(e.type===`LogicalExpression`){await q(e.left,b),await q(e.right,b);return}let x=await H(e,!0);if(!x)return;function S(e){(b?A:k).add(e)}`value`in x&&typeof x.value==`string`?x.wildcards?x.wildcards.length>=1&&K(x.value):S(x.value):(`ifTrue`in x&&typeof x.ifTrue==`string`&&S(x.ifTrue),`else`in x&&typeof x.else==`string`&&S(x.else))}let J=(0,pluginutils_1.attachScopes)(F,`scope`);isAst(F)&&((0,wrappers_1.handleWrappers)(F),await(0,special_cases_1.default)({id:e,ast:F,emitDependency:e=>k.add(e),emitAsset:e=>O.add(e),emitAssetDirectory:N,job:D}));async function Y(e,b){if(!U)throw Error(`Internal error: No staticChildNode for backtrack.`);let x=await H(e,!0);if(x&&(`value`in x&&typeof x.value!=`symbol`||`ifTrue`in x&&typeof x.ifTrue!=`symbol`&&typeof x.else!=`symbol`)){W=x,U=e,b&&b.skip();return}await $()}return await(0,estree_walker_1.asyncWalk)(F,{async enter(x,S){let C=x,w=S;if(C.scope)for(let e in J=C.scope,C.scope.declarations)e in R&&R[e].shadowDepth++;if(!U&&w){if(C.type===`Identifier`){if((0,ast_helpers_1.isIdentifierRead)(C,w)&&D.analysis.computeFileReferences){let e;(typeof(e=B(C.name)?.value)==`string`&&e.match(absoluteRegEx)||e&&(typeof e==`function`||typeof e==`object`)&&e[TRIGGER])&&(W={value:typeof e==`string`?e:void 0},U=C,await Y(w,this))}}else if(D.analysis.computeFileReferences&&C.type===`MemberExpression`&&C.object.type===`MetaProperty`&&C.object.meta.name===`import`&&C.object.property.name===`meta`&&(C.property.computed?C.property.value:C.property.name)===`url`)W={value:L},U=C,await Y(w,this);else if(C.type===`ImportExpression`){await q(C.source,!0);return}else if(C.type===`CallExpression`){if((!I||D.mixedModules)&&C.callee.type===`Identifier`&&C.arguments.length){if(C.callee.name===`require`&&R.require&&R.require.shadowDepth===0){await q(C.arguments[0]);return}}else if((!I||D.mixedModules)&&C.callee.type===`MemberExpression`&&C.callee.object.type===`Identifier`&&C.callee.object.name===`module`&&!(`module`in R)&&C.callee.property.type===`Identifier`&&!C.callee.computed&&C.callee.property.name===`require`&&C.arguments.length){await q(C.arguments[0]);return}else if((!I||D.mixedModules)&&C.callee.type===`MemberExpression`&&C.callee.object.type===`Identifier`&&C.callee.object.name===`require`&&R.require&&R.require.shadowDepth===0&&C.callee.property.type===`Identifier`&&!C.callee.computed&&C.callee.property.name===`resolve`&&C.arguments.length){await q(C.arguments[0]);return}let x=D.analysis.evaluatePureExpressions&&await H(C.callee,!1);if(x&&`value`in x&&typeof x.value==`function`&&x.value[TRIGGER]&&D.analysis.computeFileReferences)W=await H(C,!0),W&&w&&(U=C,await Y(w,this));else if(x&&`value`in x&&typeof x.value==`symbol`)switch(x.value){case BOUND_REQUIRE:C.arguments.length===1&&C.arguments[0].type===`Literal`&&C.callee.type===`Identifier`&&(!R.require||R.require.shadowDepth===0)&&await q(C.arguments[0]);break;case BINDINGS:if(C.arguments.length){let e=await H(C.arguments[0],!1);if(e&&`value`in e&&e.value){let b;typeof e.value==`object`?b=e.value:typeof e.value==`string`&&(b={bindings:e.value}),b.path||=!0,b.module_root=M;let x;try{x=(0,bindings_1.default)(b)}catch{}x&&(W={value:x},U=C,await $())}}break;case NODE_GYP_BUILD:if(C.arguments.length){let e=await H(C.arguments[0],!1);if(e&&`value`in e&&e.value){let b=e.value,x;try{let e=C?.callee?.arguments?.[0]?.value||`node-gyp-build`,S=(0,resolve_from_1.default)(b,e);x=require(S).path(b)}catch{try{x=node_gyp_build_1.default.path(b)}catch{}}x&&(W={value:x},U=C,await $())}}break;case NBIND_INIT:if(C.arguments.length){let e=await H(C.arguments[0],!1);if(e&&`value`in e&&(typeof e.value==`string`||e.value===void 0)){let x=(0,binary_locators_1.nbind)(e.value);if(x&&x.path)return k.add(path_1.default.relative(j,x.path).replace(/\\/g,`/`)),this.skip()}}break;case EXPRESS_SET:if(C.arguments.length===2&&C.arguments[0].type===`Literal`&&C.arguments[0].value===`view engine`&&!G)return await q(C.arguments[1]),this.skip();break;case EXPRESS_ENGINE:G=!0;break;case FS_FN:case FS_DIR_FN:if(C.arguments[0]&&D.analysis.computeFileReferences&&(W=await H(C.arguments[0],!0),W))return U=C.arguments[0],x.value===FS_DIR_FN&&C.arguments[0].type===`Identifier`&&C.arguments[0].name===`__dirname`?N(j):await Y(w,this),this.skip();break;case SET_ROOT_DIR:if(C.arguments[0]){let e=await H(C.arguments[0],!1);return e&&`value`in e&&e.value&&N(e.value+`/intl`),this.skip()}break;case PKG_INFO:let S=path_1.default.resolve(e,`../package.json`),E=path_1.default.resolve(`/package.json`);for(;S!==E&&await D.stat(S)===null;)S=path_1.default.resolve(S,`../../package.json`);S!==E&&O.add(S);break;case MODULE_FN:if(C.arguments.length&&C.arguments[0].type===`Literal`){let e=C.arguments[0].value;if(e.startsWith(`.`)){let x=C.arguments.length>1?await H(C.arguments[1]):void 0;if(x&&`value`in x){let S=x.value instanceof url_1.URL?x.value.href:typeof x.value==`string`?x.value:x.value.parentURL,C=new url_1.URL(e,S).href,w=L.slice(0,L.lastIndexOf(`/`)),T=path_1.default.relative(w,C),E=T.startsWith(`.`)?T:`./`+T;A.add(E)}}else A.add(e)}break}}else if(C.type===`VariableDeclaration`&&w&&!(0,ast_helpers_1.isVarLoop)(w)&&D.analysis.evaluatePureExpressions)for(let e of C.declarations){if(!e.init)continue;let b=await H(e.init,!0);if(b){if(e.id.type===`Identifier`)z(e.id.name,b);else if(e.id.type===`ObjectPattern`&&`value`in b)for(let x of e.id.properties)x.type!==`Property`||x.key.type!==`Identifier`||x.value.type!==`Identifier`||typeof b.value!=`object`||b.value===null||!(x.key.name in b.value)||z(x.value.name,{value:b.value[x.key.name]});!(`value`in b)&&isAbsolutePathOrUrl(b.ifTrue)&&isAbsolutePathOrUrl(b.else)&&(W=b,U=e.init,await $())}}else if(C.type===`AssignmentExpression`&&w&&!(0,ast_helpers_1.isLoop)(w)&&D.analysis.evaluatePureExpressions){if(!V(C.left.name)){let e=await H(C.right,!1);if(e&&`value`in e){if(C.left.type===`Identifier`)z(C.left.name,e);else if(C.left.type===`ObjectPattern`)for(let b of C.left.properties)b.type!==`Property`||b.key.type!==`Identifier`||b.value.type!==`Identifier`||typeof e.value!=`object`||e.value===null||!(b.key.name in e.value)||z(b.value.name,{value:e.value[b.key.name]});isAbsolutePathOrUrl(e.value)&&(W=e,U=C.right,await $())}}}else if((!I||D.mixedModules)&&(C.type===`FunctionDeclaration`||C.type===`FunctionExpression`||C.type===`ArrowFunctionExpression`)&&(C.arguments||C.params)[0]&&(C.arguments||C.params)[0].type===`Identifier`){let e,b;if((C.type===`ArrowFunctionExpression`||C.type===`FunctionExpression`)&&w&&w.type===`VariableDeclarator`&&w.id.type===`Identifier`?(e=w.id,b=C.arguments||C.params):C.id&&(e=C.id,b=C.arguments||C.params),e&&C.body.body){let x,S=!1;for(let e=0;e<C.body.body.length;e++)if(C.body.body[e].type===`VariableDeclaration`&&!x&&(x=C.body.body[e].declarations.find(e=>e&&e.id&&e.id.type===`Identifier`&&e.init&&e.init.type===`CallExpression`&&e.init.callee.type===`Identifier`&&e.init.callee.name===`require`&&R.require.shadowDepth===0&&e.init.arguments[0]&&e.init.arguments[0].type===`Identifier`&&e.init.arguments[0].name===b[0].name)),x&&C.body.body[e].type===`ReturnStatement`&&C.body.body[e].argument&&C.body.body[e].argument.type===`Identifier`&&C.body.body[e].argument.name===x.id.name){S=!0;break}S&&z(e.name,{value:BOUND_REQUIRE})}}if(C.type===`CallExpression`&&C.callee.type===`MemberExpression`&&C.callee.object.type===`Identifier`&&C.callee.object.name===`module`&&C.callee.property.type===`Identifier`&&C.callee.property.name===`createRequire`&&w.type===`VariableDeclarator`&&w.id.type===`Identifier`){let e=w.id.name;z(e,{value:BOUND_REQUIRE})}if(C.type===`CallExpression`&&C.callee.type===`Identifier`&&C.callee.name===`createRequire`){let e=B(`createRequire`);if(e&&`value`in e&&e.value===CREATE_REQUIRE&&w.type===`VariableDeclarator`&&w.id.type===`Identifier`){let e=w.id.name;z(e,{value:BOUND_REQUIRE})}}}},async leave(e,b){let x=e,S=b;if(x.scope)for(let e in J.parent&&(J=J.parent),x.scope.declarations)e in R&&(R[e].shadowDepth>0?R[e].shadowDepth--:delete R[e]);U&&S&&await Y(S,this)}}),await P,{assets:O,deps:k,imports:A,isESM:I};async function X(e){let x=e.indexOf(static_eval_1.WILDCARD),S=x===-1?e.length:e.lastIndexOf(path_1.default.sep,x),w=e.substring(0,S);try{var T=await D.stat(w);if(T===null)throw Error(`file not found`)}catch{return}x!==-1&&T.isFile()||(T.isFile()?O.add(e):T.isDirectory()&&Z(e)&&N(e))}function Z(x){let S=``;if(x.endsWith(path_1.default.sep)?S=path_1.default.sep:x.endsWith(path_1.default.sep+static_eval_1.WILDCARD)?S=path_1.default.sep+static_eval_1.WILDCARD:x.endsWith(static_eval_1.WILDCARD)&&(S=static_eval_1.WILDCARD),x===j+S||x===cwd+S||x.endsWith(path_1.default.sep+`node_modules`+S)||j.startsWith(x.slice(0,x.length-S.length)+path_1.default.sep))return!1;if(M){let S=e.substring(0,e.indexOf(path_1.default.sep+`node_modules`))+path_1.default.sep+`node_modules`+path_1.default.sep;if(!x.startsWith(S))return D.log&&console.log(`Skipping asset emission of `+x.replace(static_eval_1.wildcardRegEx,`*`)+` for `+e+` as it is outside the package base `+M),!1}return!0}function Q(e){return e instanceof url_1.URL?(0,url_1.fileURLToPath)(e):e.startsWith(`file:`)?(0,url_1.fileURLToPath)(new url_1.URL(e)):path_1.default.resolve(e)}async function $(){if(W){if(`value`in W&&isAbsolutePathOrUrl(W.value))try{await X(Q(W.value))}catch{}else if(`ifTrue`in W&&`else`in W&&isAbsolutePathOrUrl(W.ifTrue)&&isAbsolutePathOrUrl(W.else)){let e;try{e=Q(W.ifTrue)}catch{}let b;try{b=Q(W.else)}catch{}e&&await X(e),b&&await X(b)}else if(U&&U.type===`ArrayExpression`&&`value`in W&&W.value instanceof Array)for(let e of W.value)try{await X(Q(e))}catch{}U=W=void 0}}}function isAst(e){return`body`in e}
1
+ "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,`__esModule`,{value:!0}),exports.default=analyze;const path_1=__importDefault(require(`path`)),estree_walker_1=require(`estree-walker`),pluginutils_1=require(`@rollup/pluginutils`),static_eval_1=require(`./utils/static-eval`),acorn_1=require(`acorn`),bindings_1=__importDefault(require(`bindings`)),ast_helpers_1=require(`./utils/ast-helpers`),glob_1=require(`glob`),get_package_base_1=require(`./utils/get-package-base`),binary_locators_1=require(`./utils/binary-locators`),interop_require_1=require(`./utils/interop-require`),special_cases_1=__importDefault(require(`./utils/special-cases`)),resolve_dependency_js_1=__importDefault(require(`./resolve-dependency.js`)),node_gyp_build_1=__importDefault(require(`node-gyp-build`)),node_pre_gyp_1=__importDefault(require(`@mapbox/node-pre-gyp`)),url_1=require(`url`),acorn=acorn_1.Parser.extend(require(`acorn-import-attributes`).importAttributesOrAssertions),os_1=__importDefault(require(`os`)),url_2=__importDefault(require(`url`)),wrappers_1=require(`./utils/wrappers`),resolve_from_1=__importDefault(require(`resolve-from`)),staticProcess={cwd:()=>cwd,env:{NODE_ENV:static_eval_1.UNKNOWN,[static_eval_1.UNKNOWN]:!0},[static_eval_1.UNKNOWN]:!0},EXPRESS_SET=Symbol(),EXPRESS_ENGINE=Symbol(),NBIND_INIT=Symbol(),SET_ROOT_DIR=Symbol(),PKG_INFO=Symbol(),FS_FN=Symbol(),FS_DIR_FN=Symbol(),BINDINGS=Symbol(),NODE_GYP_BUILD=Symbol(),fsSymbols={access:FS_FN,accessSync:FS_FN,createReadStream:FS_FN,exists:FS_FN,existsSync:FS_FN,fstat:FS_FN,fstatSync:FS_FN,lstat:FS_FN,lstatSync:FS_FN,open:FS_FN,readdir:FS_DIR_FN,readdirSync:FS_DIR_FN,readFile:FS_FN,readFileSync:FS_FN,stat:FS_FN,statSync:FS_FN},fsExtraSymbols={...fsSymbols,pathExists:FS_FN,pathExistsSync:FS_FN,readJson:FS_FN,readJSON:FS_FN,readJsonSync:FS_FN,readJSONSync:FS_FN},MODULE_FN=Symbol(),CREATE_REQUIRE=Symbol(),moduleSymbols={register:MODULE_FN,createRequire:CREATE_REQUIRE},staticModules=Object.assign(Object.create(null),{bindings:{default:BINDINGS},express:{default:function(){return{[static_eval_1.UNKNOWN]:!0,set:EXPRESS_SET,engine:EXPRESS_ENGINE}}},fs:{default:fsSymbols,...fsSymbols},module:{default:moduleSymbols,...moduleSymbols},"fs-extra":{default:fsExtraSymbols,...fsExtraSymbols},"graceful-fs":{default:fsSymbols,...fsSymbols},process:{default:staticProcess,...staticProcess},path:{default:{}},os:{default:os_1.default,...os_1.default},url:{default:url_2.default,...url_2.default},"@mapbox/node-pre-gyp":{default:node_pre_gyp_1.default,...node_pre_gyp_1.default},"node-pre-gyp":binary_locators_1.pregyp,"node-pre-gyp/lib/pre-binding":binary_locators_1.pregyp,"node-pre-gyp/lib/pre-binding.js":binary_locators_1.pregyp,"node-gyp-build":{default:NODE_GYP_BUILD},"@aminya/node-gyp-build":{default:NODE_GYP_BUILD},nbind:{init:NBIND_INIT,default:{init:NBIND_INIT}},"resolve-from":{default:resolve_from_1.default},"strong-globalize":{default:{SetRootDir:SET_ROOT_DIR},SetRootDir:SET_ROOT_DIR},pkginfo:{default:PKG_INFO}}),globalBindings={_interopRequireDefault:interop_require_1.normalizeDefaultRequire,_interopRequireWildcard:interop_require_1.normalizeWildcardRequire,__importDefault:interop_require_1.normalizeDefaultRequire,__importStar:interop_require_1.normalizeWildcardRequire,MONGOOSE_DRIVER_PATH:void 0,URL:url_1.URL,Object:{assign:Object.assign}};globalBindings.global=globalBindings.GLOBAL=globalBindings.globalThis=globalBindings;const TRIGGER=Symbol();binary_locators_1.pregyp.find[TRIGGER]=!0;const staticPath=staticModules.path;Object.keys(path_1.default).forEach(e=>{let n=path_1.default[e];if(typeof n==`function`){let t=function e(){return n.apply(e,arguments)};t[TRIGGER]=!0,staticPath[e]=staticPath.default[e]=t}else staticPath[e]=staticPath.default[e]=n}),staticPath.resolve=staticPath.default.resolve=function(...e){return path_1.default.resolve.apply(this,[cwd,...e])},staticPath.resolve[TRIGGER]=!0;const excludeAssetExtensions=new Set([`.h`,`.cmake`,`.c`,`.cpp`]),excludeAssetFiles=new Set([`CHANGELOG.md`,`README.md`,`readme.md`,`changelog.md`]);let cwd;const absoluteRegEx=/^\/[^\/]+|^[a-z]:[\\/][^\\/]+/i;function isAbsolutePathOrUrl(e){if(e instanceof url_1.URL)return e.protocol===`file:`;if(typeof e==`string`){if(e.startsWith(`file:`))try{return new url_1.URL(e),!0}catch{return!1}return absoluteRegEx.test(e)}return!1}const BOUND_REQUIRE=Symbol(),repeatGlobRegEx=/([\/\\]\*\*[\/\\]\*)+/g;async function analyze(e,a,c){let l=new Set,u=new Set,d=new Set,f=path_1.default.dirname(e);cwd=c.cwd;let p=(0,get_package_base_1.getPackageBase)(e),m=e=>{if(!c.analysis.emitGlobs)return;e=e.replaceAll(path_1.default.sep,path_1.default.posix.sep);let n=e.indexOf(static_eval_1.WILDCARD),r=n===-1?e.length:e.lastIndexOf(path_1.default.posix.sep,n),a=e.substring(0,r),o=e.slice(r),s=o.replace(static_eval_1.wildcardRegEx,(e,n)=>o[n-1]===path_1.default.posix.sep?`**/*`:`*`).replace(repeatGlobRegEx,`/**/*`)||`/**/*`;c.ignoreFn(path_1.default.relative(c.base,a+s))||(h=h.then(async()=>{c.log&&console.log(`Globbing `+a+s),(await(0,glob_1.glob)(a+s,{mark:!0,ignore:a+`/**/node_modules/**/*`,dot:!0,nodir:!0})).filter(e=>!excludeAssetExtensions.has(path_1.default.extname(e))&&!excludeAssetFiles.has(path_1.default.basename(e))).forEach(e=>l.add(e))}))},h=Promise.resolve();a=a.replace(/^#![^\n\r]*[\r\n]/,``);let g,_=!1;try{g=acorn.parse(a,{ecmaVersion:`latest`,allowReturnOutsideFunction:!0}),_=!1}catch(t){t&&t.message&&t.message.includes(`sourceType: module`)||c.warnings.add(Error(`Failed to parse ${e} as script:\n${t&&t.message}`))}if(!g)try{g=acorn.parse(a,{ecmaVersion:`latest`,sourceType:`module`,allowAwaitOutsideFunction:!0}),_=!0}catch(t){return c.warnings.add(Error(`Failed to parse ${e} as module:\n${t&&t.message}`)),{assets:l,deps:u,imports:d,isESM:!1}}let v=(0,url_1.pathToFileURL)(e).href,y=Object.assign(Object.create(null),{__dirname:{shadowDepth:0,value:{value:path_1.default.resolve(e,`..`)}},__filename:{shadowDepth:0,value:{value:e}},process:{shadowDepth:0,value:{value:staticProcess}}});(!_||c.mixedModules)&&(y.require={shadowDepth:0,value:{value:{[static_eval_1.FUNCTION](e){return u.add(e),staticModules[e.startsWith(`node:`)?e.slice(5):e].default},resolve(t){return(0,resolve_dependency_js_1.default)(t,e,c)}}}},y.require.value.value.resolve[TRIGGER]=!0);function b(e,t){e===`require`&&`value`in t&&t.value!==BOUND_REQUIRE||(y[e]={shadowDepth:0,value:t})}function x(e){let t=y[e];if(t&&t.shadowDepth===0)return t.value}function S(e){let t=y[e];return t&&t.shadowDepth===0}if((_||c.mixedModules)&&isAst(g))for(let e of g.body)if(e.type===`ImportDeclaration`){let t=String(e.source.value);u.add(t);let n=staticModules[t.startsWith(`node:`)?t.slice(5):t];if(n)for(let t of e.specifiers)t.type===`ImportNamespaceSpecifier`?b(t.local.name,{value:n}):t.type===`ImportDefaultSpecifier`&&`default`in n?b(t.local.name,{value:n.default}):t.type===`ImportSpecifier`&&t.imported.name in n&&b(t.local.name,{value:n[t.imported.name]})}else (e.type===`ExportNamedDeclaration`||e.type===`ExportAllDeclaration`)&&e.source&&u.add(String(e.source.value));async function C(e,t=!0){let n=Object.create(null);return Object.keys(globalBindings).forEach(e=>{n[e]={value:globalBindings[e]}}),Object.keys(y).forEach(e=>{n[e]=x(e)}),n[`import.meta`]={url:v},await(0,static_eval_1.evaluate)(e,n,t)}let w,T,E=!1;function D(e){if(!c.analysis.emitGlobs||!e.startsWith(`./`)&&!e.startsWith(`../`))return;e=path_1.default.resolve(f,e).replaceAll(path_1.default.sep,path_1.default.posix.sep);let n=e.indexOf(static_eval_1.WILDCARD),r=n===-1?e.length:e.lastIndexOf(path_1.default.posix.sep,n),a=e.substring(0,r),o=e.slice(r),s=o.replace(static_eval_1.wildcardRegEx,(e,n)=>o[n-1]===path_1.default.posix.sep?`**/*`:`*`)||`/**/*`;s.endsWith(`*`)||(s+=`?(`+(c.ts?`.ts|.tsx|`:``)+`.js|.json|.node)`),!c.ignoreFn(path_1.default.relative(c.base,a+s))&&(h=h.then(async()=>{c.log&&console.log(`Globbing `+a+s),(await(0,glob_1.glob)(a+s,{mark:!0,ignore:a+`/**/node_modules/**/*`,nodir:!0})).filter(e=>!excludeAssetExtensions.has(path_1.default.extname(e))&&!excludeAssetFiles.has(path_1.default.basename(e))).forEach(e=>u.add(e))}))}async function O(e,t=!1){if(e.type===`ConditionalExpression`){await O(e.consequent,t),await O(e.alternate,t);return}if(e.type===`LogicalExpression`){await O(e.left,t),await O(e.right,t);return}let n=await C(e,!0);if(!n)return;function r(e){(t?d:u).add(e)}`value`in n&&typeof n.value==`string`?n.wildcards?n.wildcards.length>=1&&D(n.value):r(n.value):(`ifTrue`in n&&typeof n.ifTrue==`string`&&r(n.ifTrue),`else`in n&&typeof n.else==`string`&&r(n.else))}let k=(0,pluginutils_1.attachScopes)(g,`scope`);isAst(g)&&((0,wrappers_1.handleWrappers)(g),await(0,special_cases_1.default)({id:e,ast:g,emitDependency:e=>u.add(e),emitAsset:e=>l.add(e),emitAssetDirectory:m,job:c}));async function A(e,t){if(!w)throw Error(`Internal error: No staticChildNode for backtrack.`);let n=await C(e,!0);if(n&&(`value`in n&&typeof n.value!=`symbol`||`ifTrue`in n&&typeof n.ifTrue!=`symbol`&&typeof n.else!=`symbol`)){T=n,w=e,t&&t.skip();return}await P()}return await(0,estree_walker_1.asyncWalk)(g,{async enter(n,r){let i=n,a=r;if(i.scope)for(let e in k=i.scope,i.scope.declarations)e in y&&y[e].shadowDepth++;if(!w&&a){if(i.type===`Identifier`){if((0,ast_helpers_1.isIdentifierRead)(i,a)&&c.analysis.computeFileReferences){let e;(typeof(e=x(i.name)?.value)==`string`&&e.match(absoluteRegEx)||e&&(typeof e==`function`||typeof e==`object`)&&e[TRIGGER])&&(T={value:typeof e==`string`?e:void 0},w=i,await A(a,this))}}else if(c.analysis.computeFileReferences&&i.type===`MemberExpression`&&i.object.type===`MetaProperty`&&i.object.meta.name===`import`&&i.object.property.name===`meta`&&(i.property.computed?i.property.value:i.property.name)===`url`)T={value:v},w=i,await A(a,this);else if(i.type===`ImportExpression`){await O(i.source,!0);return}else if(i.type===`CallExpression`){if((!_||c.mixedModules)&&i.callee.type===`Identifier`&&i.arguments.length){if(i.callee.name===`require`&&y.require&&y.require.shadowDepth===0){await O(i.arguments[0]);return}}else if((!_||c.mixedModules)&&i.callee.type===`MemberExpression`&&i.callee.object.type===`Identifier`&&i.callee.object.name===`module`&&!(`module`in y)&&i.callee.property.type===`Identifier`&&!i.callee.computed&&i.callee.property.name===`require`&&i.arguments.length){await O(i.arguments[0]);return}else if((!_||c.mixedModules)&&i.callee.type===`MemberExpression`&&i.callee.object.type===`Identifier`&&i.callee.object.name===`require`&&y.require&&y.require.shadowDepth===0&&i.callee.property.type===`Identifier`&&!i.callee.computed&&i.callee.property.name===`resolve`&&i.arguments.length){await O(i.arguments[0]);return}let n=c.analysis.evaluatePureExpressions&&await C(i.callee,!1);if(n&&`value`in n&&typeof n.value==`function`&&n.value[TRIGGER]&&c.analysis.computeFileReferences)T=await C(i,!0),T&&a&&(w=i,await A(a,this));else if(n&&`value`in n&&typeof n.value==`symbol`)switch(n.value){case BOUND_REQUIRE:i.arguments.length===1&&i.arguments[0].type===`Literal`&&i.callee.type===`Identifier`&&(!y.require||y.require.shadowDepth===0)&&await O(i.arguments[0]);break;case BINDINGS:if(i.arguments.length){let e=await C(i.arguments[0],!1);if(e&&`value`in e&&e.value){let t;typeof e.value==`object`?t=e.value:typeof e.value==`string`&&(t={bindings:e.value}),t.path||=!0,t.module_root=p;let n;try{n=(0,bindings_1.default)(t)}catch{}n&&(T={value:n},w=i,await P())}}break;case NODE_GYP_BUILD:if(i.arguments.length){let e=await C(i.arguments[0],!1);if(e&&`value`in e&&e.value){let t=e.value,n;try{let e=i?.callee?.arguments?.[0]?.value||`node-gyp-build`,r=(0,resolve_from_1.default)(t,e);n=require(r).path(t)}catch{try{n=node_gyp_build_1.default.path(t)}catch{}}n&&(T={value:n},w=i,await P())}}break;case NBIND_INIT:if(i.arguments.length){let e=await C(i.arguments[0],!1);if(e&&`value`in e&&(typeof e.value==`string`||e.value===void 0)){let n=(0,binary_locators_1.nbind)(e.value);if(n&&n.path)return u.add(path_1.default.relative(f,n.path).replace(/\\/g,`/`)),this.skip()}}break;case EXPRESS_SET:if(i.arguments.length===2&&i.arguments[0].type===`Literal`&&i.arguments[0].value===`view engine`&&!E)return await O(i.arguments[1]),this.skip();break;case EXPRESS_ENGINE:E=!0;break;case FS_FN:case FS_DIR_FN:if(i.arguments[0]&&c.analysis.computeFileReferences&&(T=await C(i.arguments[0],!0),T))return w=i.arguments[0],n.value===FS_DIR_FN&&i.arguments[0].type===`Identifier`&&i.arguments[0].name===`__dirname`?m(f):await A(a,this),this.skip();break;case SET_ROOT_DIR:if(i.arguments[0]){let e=await C(i.arguments[0],!1);return e&&`value`in e&&e.value&&m(e.value+`/intl`),this.skip()}break;case PKG_INFO:let r=path_1.default.resolve(e,`../package.json`),s=path_1.default.resolve(`/package.json`);for(;r!==s&&await c.stat(r)===null;)r=path_1.default.resolve(r,`../../package.json`);r!==s&&l.add(r);break;case MODULE_FN:if(i.arguments.length&&i.arguments[0].type===`Literal`){let e=i.arguments[0].value;if(e.startsWith(`.`)){let n=i.arguments.length>1?await C(i.arguments[1]):void 0;if(n&&`value`in n){let r=n.value instanceof url_1.URL?n.value.href:typeof n.value==`string`?n.value:n.value.parentURL,i=new url_1.URL(e,r).href,a=v.slice(0,v.lastIndexOf(`/`)),o=path_1.default.relative(a,i),s=o.startsWith(`.`)?o:`./`+o;d.add(s)}}else d.add(e)}break}}else if(i.type===`VariableDeclaration`&&a&&!(0,ast_helpers_1.isVarLoop)(a)&&c.analysis.evaluatePureExpressions)for(let e of i.declarations){if(!e.init)continue;let t=await C(e.init,!0);if(t){if(e.id.type===`Identifier`)b(e.id.name,t);else if(e.id.type===`ObjectPattern`&&`value`in t)for(let n of e.id.properties)n.type!==`Property`||n.key.type!==`Identifier`||n.value.type!==`Identifier`||typeof t.value!=`object`||t.value===null||!(n.key.name in t.value)||b(n.value.name,{value:t.value[n.key.name]});!(`value`in t)&&isAbsolutePathOrUrl(t.ifTrue)&&isAbsolutePathOrUrl(t.else)&&(T=t,w=e.init,await P())}}else if(i.type===`AssignmentExpression`&&a&&!(0,ast_helpers_1.isLoop)(a)&&c.analysis.evaluatePureExpressions){if(!S(i.left.name)){let e=await C(i.right,!1);if(e&&`value`in e){if(i.left.type===`Identifier`)b(i.left.name,e);else if(i.left.type===`ObjectPattern`)for(let t of i.left.properties)t.type!==`Property`||t.key.type!==`Identifier`||t.value.type!==`Identifier`||typeof e.value!=`object`||e.value===null||!(t.key.name in e.value)||b(t.value.name,{value:e.value[t.key.name]});isAbsolutePathOrUrl(e.value)&&(T=e,w=i.right,await P())}}}else if((!_||c.mixedModules)&&(i.type===`FunctionDeclaration`||i.type===`FunctionExpression`||i.type===`ArrowFunctionExpression`)&&(i.arguments||i.params)[0]&&(i.arguments||i.params)[0].type===`Identifier`){let e,t;if((i.type===`ArrowFunctionExpression`||i.type===`FunctionExpression`)&&a&&a.type===`VariableDeclarator`&&a.id.type===`Identifier`?(e=a.id,t=i.arguments||i.params):i.id&&(e=i.id,t=i.arguments||i.params),e&&i.body.body){let n,r=!1;for(let e=0;e<i.body.body.length;e++)if(i.body.body[e].type===`VariableDeclaration`&&!n&&(n=i.body.body[e].declarations.find(e=>e&&e.id&&e.id.type===`Identifier`&&e.init&&e.init.type===`CallExpression`&&e.init.callee.type===`Identifier`&&e.init.callee.name===`require`&&y.require.shadowDepth===0&&e.init.arguments[0]&&e.init.arguments[0].type===`Identifier`&&e.init.arguments[0].name===t[0].name)),n&&i.body.body[e].type===`ReturnStatement`&&i.body.body[e].argument&&i.body.body[e].argument.type===`Identifier`&&i.body.body[e].argument.name===n.id.name){r=!0;break}r&&b(e.name,{value:BOUND_REQUIRE})}}if(i.type===`CallExpression`&&i.callee.type===`MemberExpression`&&i.callee.object.type===`Identifier`&&i.callee.object.name===`module`&&i.callee.property.type===`Identifier`&&i.callee.property.name===`createRequire`&&a.type===`VariableDeclarator`&&a.id.type===`Identifier`){let e=a.id.name;b(e,{value:BOUND_REQUIRE})}if(i.type===`CallExpression`&&i.callee.type===`Identifier`&&i.callee.name===`createRequire`){let e=x(`createRequire`);if(e&&`value`in e&&e.value===CREATE_REQUIRE&&a.type===`VariableDeclarator`&&a.id.type===`Identifier`){let e=a.id.name;b(e,{value:BOUND_REQUIRE})}}}},async leave(e,t){let n=e,r=t;if(n.scope)for(let e in k.parent&&(k=k.parent),n.scope.declarations)e in y&&(y[e].shadowDepth>0?y[e].shadowDepth--:delete y[e]);w&&r&&await A(r,this)}}),await h,{assets:l,deps:u,imports:d,isESM:_};async function j(e){let n=e.indexOf(static_eval_1.WILDCARD),r=n===-1?e.length:e.lastIndexOf(path_1.default.sep,n),a=e.substring(0,r);try{var o=await c.stat(a);if(o===null)throw Error(`file not found`)}catch{return}n!==-1&&o.isFile()||(o.isFile()?l.add(e):o.isDirectory()&&M(e)&&m(e))}function M(n){let r=``;if(n.endsWith(path_1.default.sep)?r=path_1.default.sep:n.endsWith(path_1.default.sep+static_eval_1.WILDCARD)?r=path_1.default.sep+static_eval_1.WILDCARD:n.endsWith(static_eval_1.WILDCARD)&&(r=static_eval_1.WILDCARD),n===f+r||n===cwd+r||n.endsWith(path_1.default.sep+`node_modules`+r)||f.startsWith(n.slice(0,n.length-r.length)+path_1.default.sep))return!1;if(p){let r=e.substring(0,e.indexOf(path_1.default.sep+`node_modules`))+path_1.default.sep+`node_modules`+path_1.default.sep;if(!n.startsWith(r))return c.log&&console.log(`Skipping asset emission of `+n.replace(static_eval_1.wildcardRegEx,`*`)+` for `+e+` as it is outside the package base `+p),!1}return!0}function N(e){return e instanceof url_1.URL?(0,url_1.fileURLToPath)(e):e.startsWith(`file:`)?(0,url_1.fileURLToPath)(new url_1.URL(e)):path_1.default.resolve(e)}async function P(){if(T){if(`value`in T&&isAbsolutePathOrUrl(T.value))try{await j(N(T.value))}catch{}else if(`ifTrue`in T&&`else`in T&&isAbsolutePathOrUrl(T.ifTrue)&&isAbsolutePathOrUrl(T.else)){let e;try{e=N(T.ifTrue)}catch{}let t;try{t=N(T.else)}catch{}e&&await j(e),t&&await j(t)}else if(w&&w.type===`ArrayExpression`&&`value`in T&&T.value instanceof Array)for(let e of T.value)try{await j(N(e))}catch{}w=T=void 0}}}function isAst(e){return`body`in e}
@@ -1 +1 @@
1
- "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,`__esModule`,{value:!0}),exports.CachedFileSystem=void 0;const path_1=require(`path`),graceful_fs_1=__importDefault(require(`graceful-fs`)),async_sema_1=require(`async-sema`),fsReadFile=graceful_fs_1.default.promises.readFile,fsReadlink=graceful_fs_1.default.promises.readlink,fsStat=graceful_fs_1.default.promises.stat;class CachedFileSystem{fileCache;statCache;symlinkCache;fileIOQueue;constructor({cache:e,fileIOConcurrency:a}){this.fileIOQueue=new async_sema_1.Sema(a),this.fileCache=e?.fileCache??new Map,this.statCache=e?.statCache??new Map,this.symlinkCache=e?.symlinkCache??new Map,e&&(e.fileCache=this.fileCache,e.statCache=this.statCache,e.symlinkCache=this.symlinkCache)}async readlink(e){let a=this.symlinkCache.get(e);if(a!==void 0)return a;let o=this.executeFileIO(e,this._internalReadlink);return this.symlinkCache.set(e,o),o}async readFile(e){let a=this.fileCache.get(e);if(a!==void 0)return a;let o=this.executeFileIO(e,this._internalReadFile);return this.fileCache.set(e,o),o}async stat(e){let a=this.statCache.get(e);if(a!==void 0)return a;let o=this.executeFileIO(e,this._internalStat);return this.statCache.set(e,o),o}async _internalReadlink(e){try{let o=await fsReadlink(e),s=this.statCache.get(e);return s&&this.statCache.set((0,path_1.resolve)(e,o),s),o}catch(e){if(e.code!==`EINVAL`&&e.code!==`ENOENT`&&e.code!==`UNKNOWN`)throw e;return null}}async _internalReadFile(e){try{return(await fsReadFile(e)).toString()}catch(e){if(e.code===`ENOENT`||e.code===`EISDIR`)return null;throw e}}async _internalStat(e){try{return await fsStat(e)}catch(e){if(e.code===`ENOENT`)return null;throw e}}async executeFileIO(e,a){await this.fileIOQueue.acquire();try{return a.call(this,e)}finally{this.fileIOQueue.release()}}}exports.CachedFileSystem=CachedFileSystem;
1
+ "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,`__esModule`,{value:!0}),exports.CachedFileSystem=void 0;const path_1=require(`path`),graceful_fs_1=__importDefault(require(`graceful-fs`)),async_sema_1=require(`async-sema`),fsReadFile=graceful_fs_1.default.promises.readFile,fsReadlink=graceful_fs_1.default.promises.readlink,fsStat=graceful_fs_1.default.promises.stat;class CachedFileSystem{fileCache;statCache;symlinkCache;fileIOQueue;constructor({cache:e,fileIOConcurrency:t}){this.fileIOQueue=new async_sema_1.Sema(t),this.fileCache=e?.fileCache??new Map,this.statCache=e?.statCache??new Map,this.symlinkCache=e?.symlinkCache??new Map,e&&(e.fileCache=this.fileCache,e.statCache=this.statCache,e.symlinkCache=this.symlinkCache)}async readlink(e){let t=this.symlinkCache.get(e);if(t!==void 0)return t;let n=this.executeFileIO(e,this._internalReadlink);return this.symlinkCache.set(e,n),n}async readFile(e){let t=this.fileCache.get(e);if(t!==void 0)return t;let n=this.executeFileIO(e,this._internalReadFile);return this.fileCache.set(e,n),n}async stat(e){let t=this.statCache.get(e);if(t!==void 0)return t;let n=this.executeFileIO(e,this._internalStat);return this.statCache.set(e,n),n}async _internalReadlink(e){try{let n=await fsReadlink(e),r=this.statCache.get(e);return r&&this.statCache.set((0,path_1.resolve)(e,n),r),n}catch(e){if(e.code!==`EINVAL`&&e.code!==`ENOENT`&&e.code!==`UNKNOWN`)throw e;return null}}async _internalReadFile(e){try{return(await fsReadFile(e)).toString()}catch(e){if(e.code===`ENOENT`||e.code===`EISDIR`)return null;throw e}}async _internalStat(e){try{return await fsStat(e)}catch(e){if(e.code===`ENOENT`)return null;throw e}}async executeFileIO(e,t){await this.fileIOQueue.acquire();try{return t.call(this,e)}finally{this.fileIOQueue.release()}}}exports.CachedFileSystem=CachedFileSystem;
@@ -1 +1 @@
1
- "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t}),__importStar=this&&this.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},n(e)};return function(r){if(r&&r.__esModule)return r;var i={};if(r!=null)for(var a=n(r),o=0;o<a.length;o++)a[o]!==`default`&&__createBinding(i,r,a[o]);return __setModuleDefault(i,r),i}})(),__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,`__esModule`,{value:!0}),exports.Job=void 0,exports.nodeFileTrace=nodeFileTrace;const path_1=require(`path`),analyze_1=__importDefault(require(`./analyze`)),resolve_dependency_1=__importStar(require(`./resolve-dependency`)),picomatch_1=require(`picomatch`),sharedlib_emit_1=require(`./utils/sharedlib-emit`),fs_1=require(`./fs`);function inPath(e,t){let n=(0,path_1.join)(t,path_1.sep);return e.startsWith(n)&&e!==n}async function nodeFileTrace(e,t={}){let n=new Job(t);return t.readFile&&(n.readFile=t.readFile),t.stat&&(n.stat=t.stat),t.readlink&&(n.readlink=t.readlink),t.resolve&&(n.resolve=t.resolve),n.ts=!0,await Promise.all(e.map(async e=>{let t=(0,path_1.resolve)(e);return await n.emitFile(t,`initial`),n.emitDependency(t)})),{fileList:n.fileList,esmFileList:n.esmFileList,reasons:n.reasons,warnings:n.warnings}}class Job{ts;base;cwd;conditions;exportsOnly;paths;ignoreFn;log;mixedModules;analysis;analysisCache;fileList;esmFileList;processed;warnings;reasons=new Map;cachedFileSystem;remappings=new Map;constructor({base:e=process.cwd(),processCwd:t,exports:n,conditions:r=n||[`node`],exportsOnly:a=!1,paths:o={},ignore:c,log:u=!1,mixedModules:d=!1,ts:f=!0,analysis:p={},cache:m,fileIOConcurrency:h=1024}){if(this.ts=f,e=(0,path_1.resolve)(e),this.ignoreFn=e=>!!e.startsWith(`..`+path_1.sep),typeof c==`string`&&(c=[c]),typeof c==`function`){let e=c;this.ignoreFn=t=>!!(t.startsWith(`..`+path_1.sep)||e(t))}else if(Array.isArray(c)){let t=c.map(t=>(0,path_1.relative)(e,(0,path_1.resolve)(e||process.cwd(),t)));this.ignoreFn=e=>!!(e.startsWith(`..`+path_1.sep)||(0,picomatch_1.isMatch)(e,t))}this.base=e,this.cwd=(0,path_1.resolve)(t||e),this.conditions=r,this.exportsOnly=a;let g={};for(let t of Object.keys(o)){let n=o[t].endsWith(`/`);g[t]=(0,path_1.resolve)(e,o[t])+(n?`/`:``)}this.paths=g,this.log=u,this.mixedModules=d,this.cachedFileSystem=new fs_1.CachedFileSystem({cache:m,fileIOConcurrency:h}),this.analysis={},p!==!1&&Object.assign(this.analysis,{emitGlobs:!0,computeFileReferences:!0,evaluatePureExpressions:!0},p===!0?{}:p),this.analysisCache=m&&m.analysisCache||new Map,m&&(m.analysisCache=this.analysisCache),this.fileList=new Set,this.esmFileList=new Set,this.processed=new Set,this.warnings=new Set}addRemapping(e,t){if(e===t)return;let n=this.remappings.get(e);n||(n=new Set,this.remappings.set(e,n)),n.add(t)}async readlink(e){return this.cachedFileSystem.readlink(e)}async isFile(e){let t=await this.stat(e);return t?t.isFile():!1}async isDir(e){let t=await this.stat(e);return t?t.isDirectory():!1}async stat(e){return this.cachedFileSystem.stat(e)}maybeEmitDep=async(e,t,n)=>{let r=``,i;try{r=await this.resolve(e,t,this,n)}catch(a){i=a;try{if(this.ts&&e.endsWith(`.js`)&&a instanceof resolve_dependency_1.NotFoundError){let a=e.slice(0,-3)+`.ts`;r=await this.resolve(a,t,this,n),i=void 0}}catch(e){i=e}}if(i){this.warnings.add(Error(`Failed to resolve dependency "${e}":\n${i?.message}`));return}if(Array.isArray(r))for(let e of r){if(e.startsWith(`node:`))return;await this.emitDependency(e,t)}else{if(r.startsWith(`node:`))return;await this.emitDependency(r,t)}};async resolve(e,t,n,r){return(0,resolve_dependency_1.default)(e,t,n,r)}async readFile(e){return this.cachedFileSystem.readFile(e)}async realpath(e,t,n=new Set){if(n.has(e))throw Error(`Recursive symlink detected resolving `+e);n.add(e);let r=await this.readlink(e);if(r){let a=(0,path_1.dirname)(e),o=(0,path_1.resolve)(a,r);return inPath(e,await this.realpath(a,t))&&await this.emitFile(e,`resolve`,t,!0),this.realpath(o,t,n)}return inPath(e,this.base)?(0,path_1.join)(await this.realpath((0,path_1.dirname)(e),t,n),(0,path_1.basename)(e)):e}async emitFile(e,t,n,r=!1){r||(e=await this.realpath(e,n)),e=(0,path_1.relative)(this.base,e),n&&=(0,path_1.relative)(this.base,n);let a=this.reasons.get(e);return a?a.type.includes(t)||a.type.push(t):(a={type:[t],ignored:!1,parents:new Set},this.reasons.set(e,a)),n&&this.ignoreFn(e,n)?(!this.fileList.has(e)&&a&&(a.ignored=!0),!1):(n&&a.parents.add(n),this.fileList.add(e),!0)}async getPjsonBoundary(e){let t=e.indexOf(path_1.sep),n;for(;(n=e.lastIndexOf(path_1.sep))>t;)if(e=e.slice(0,n),await this.isFile(e+path_1.sep+`package.json`))return e}async emitDependency(e,t){if(this.processed.has(e)){t&&await this.emitFile(e,`dependency`,t);return}this.processed.add(e);let n=this.remappings.get(e);if(n&&await Promise.all([...n].map(async t=>this.emitDependency(t,e))),!await this.emitFile(e,`dependency`,t)||e.endsWith(`.json`))return;if(e.endsWith(`.node`))return await(0,sharedlib_emit_1.sharedLibEmit)(e,this);if(e.endsWith(`.js`)||e.endsWith(`.ts`)){let t=await this.getPjsonBoundary(e);t&&await this.emitFile(t+path_1.sep+`package.json`,`resolve`,e)}let r,o=this.analysisCache.get(e);if(o)r=o;else{let t=await this.readFile(e);if(t===null)throw Error(`File `+e+` does not exist.`);r=await(0,analyze_1.default)(e,t.toString(),this),this.analysisCache.set(e,r)}let{deps:s,imports:l,assets:u,isESM:d}=r;d&&this.esmFileList.add((0,path_1.relative)(this.base,e)),await Promise.all([...[...u].map(async t=>{let n=(0,path_1.extname)(t);n===`.js`||n===`.mjs`||n===`.node`||n===``||this.ts&&(n===`.ts`||n===`.tsx`)&&t.startsWith(this.base)&&t.slice(this.base.length).indexOf(path_1.sep+`node_modules`+path_1.sep)===-1?await this.emitDependency(t,e):await this.emitFile(t,`asset`,e)}),...[...s].map(async t=>this.maybeEmitDep(t,e,!d)),...[...l].map(async t=>this.maybeEmitDep(t,e,!1))])}}exports.Job=Job;
1
+ "use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t}),__importStar=this&&this.__importStar||(function(){var n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},n(e)};return function(r){if(r&&r.__esModule)return r;var i={};if(r!=null)for(var a=n(r),o=0;o<a.length;o++)a[o]!==`default`&&__createBinding(i,r,a[o]);return __setModuleDefault(i,r),i}})(),__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,`__esModule`,{value:!0}),exports.Job=void 0,exports.nodeFileTrace=nodeFileTrace;const path_1=require(`path`),analyze_1=__importDefault(require(`./analyze`)),resolve_dependency_1=__importStar(require(`./resolve-dependency`)),picomatch_1=require(`picomatch`),sharedlib_emit_1=require(`./utils/sharedlib-emit`),fs_1=require(`./fs`);function inPath(e,t){let n=(0,path_1.join)(t,path_1.sep);return e.startsWith(n)&&e!==n}async function nodeFileTrace(e,t={}){let n=new Job(t);return t.readFile&&(n.readFile=t.readFile),t.stat&&(n.stat=t.stat),t.readlink&&(n.readlink=t.readlink),t.resolve&&(n.resolve=t.resolve),n.ts=!0,await Promise.all(e.map(async e=>{let t=(0,path_1.resolve)(e);return await n.emitFile(t,`initial`),n.emitDependency(t)})),{fileList:n.fileList,esmFileList:n.esmFileList,reasons:n.reasons,warnings:n.warnings}}class Job{ts;base;cwd;conditions;exportsOnly;paths;ignoreFn;log;depth;mixedModules;analysis;analysisCache;fileList;esmFileList;processed;warnings;reasons=new Map;cachedFileSystem;remappings=new Map;constructor({base:e=process.cwd(),processCwd:t,exports:n,conditions:r=n||[`node`],exportsOnly:a=!1,paths:o={},ignore:c,log:u=!1,mixedModules:d=!1,ts:f=!0,analysis:p={},cache:m,fileIOConcurrency:h=1024,depth:g=1/0}){if(this.ts=f,e=(0,path_1.resolve)(e),this.ignoreFn=e=>!!e.startsWith(`..`+path_1.sep),typeof c==`string`&&(c=[c]),typeof c==`function`){let e=c;this.ignoreFn=t=>!!(t.startsWith(`..`+path_1.sep)||e(t))}else if(Array.isArray(c)){let t=c.map(t=>(0,path_1.relative)(e,(0,path_1.resolve)(e||process.cwd(),t)));this.ignoreFn=e=>!!(e.startsWith(`..`+path_1.sep)||(0,picomatch_1.isMatch)(e,t))}this.base=e,this.cwd=(0,path_1.resolve)(t||e),this.conditions=r,this.exportsOnly=a;let _={};for(let t of Object.keys(o)){let n=o[t].endsWith(`/`);_[t]=(0,path_1.resolve)(e,o[t])+(n?`/`:``)}this.paths=_,this.log=u,this.depth=g,this.mixedModules=d,this.cachedFileSystem=new fs_1.CachedFileSystem({cache:m,fileIOConcurrency:h}),this.analysis={},p!==!1&&Object.assign(this.analysis,{emitGlobs:!0,computeFileReferences:!0,evaluatePureExpressions:!0},p===!0?{}:p),this.analysisCache=m&&m.analysisCache||new Map,m&&(m.analysisCache=this.analysisCache),this.fileList=new Set,this.esmFileList=new Set,this.processed=new Set,this.warnings=new Set}addRemapping(e,t){if(e===t)return;let n=this.remappings.get(e);n||(n=new Set,this.remappings.set(e,n)),n.add(t)}async readlink(e){return this.cachedFileSystem.readlink(e)}async isFile(e){let t=await this.stat(e);return t?t.isFile():!1}async isDir(e){let t=await this.stat(e);return t?t.isDirectory():!1}async stat(e){return this.cachedFileSystem.stat(e)}maybeEmitDep=async(e,t,n,r)=>{let i=``,a;try{i=await this.resolve(e,t,this,n)}catch(r){a=r;try{if(this.ts&&e.endsWith(`.js`)&&r instanceof resolve_dependency_1.NotFoundError){let r=e.slice(0,-3)+`.ts`;i=await this.resolve(r,t,this,n),a=void 0}}catch(e){a=e}}if(a){this.warnings.add(Error(`Failed to resolve dependency "${e}":\n${a?.message}`));return}if(Array.isArray(i))for(let e of i){if(e.startsWith(`node:`))return;await this.emitDependency(e,t,r)}else{if(i.startsWith(`node:`))return;await this.emitDependency(i,t,r)}};async resolve(e,t,n,r){return(0,resolve_dependency_1.default)(e,t,n,r)}async readFile(e){return this.cachedFileSystem.readFile(e)}async realpath(e,t,n=new Set){if(n.has(e))throw Error(`Recursive symlink detected resolving `+e);n.add(e);let r=await this.readlink(e);if(r){let a=(0,path_1.dirname)(e),o=(0,path_1.resolve)(a,r);return inPath(e,await this.realpath(a,t))&&await this.emitFile(e,`resolve`,t,!0),this.realpath(o,t,n)}return inPath(e,this.base)?(0,path_1.join)(await this.realpath((0,path_1.dirname)(e),t,n),(0,path_1.basename)(e)):e}async emitFile(e,t,n,r=!1){r||(e=await this.realpath(e,n)),e=(0,path_1.relative)(this.base,e),n&&=(0,path_1.relative)(this.base,n);let a=this.reasons.get(e);return a?a.type.includes(t)||a.type.push(t):(a={type:[t],ignored:!1,parents:new Set},this.reasons.set(e,a)),n&&this.ignoreFn(e,n)?(!this.fileList.has(e)&&a&&(a.ignored=!0),!1):(n&&a.parents.add(n),this.fileList.add(e),!0)}async getPjsonBoundary(e){let t=e.indexOf(path_1.sep),n;for(;(n=e.lastIndexOf(path_1.sep))>t;)if(e=e.slice(0,n),await this.isFile(e+path_1.sep+`package.json`))return e}async emitDependency(e,t,n=this.depth){if(n<0)throw Error(`invariant - depth option cannot be negative`);if(this.processed.has(e)){t&&await this.emitFile(e,`dependency`,t);return}this.processed.add(e);let r=this.remappings.get(e);if(r&&await Promise.all([...r].map(async t=>this.emitDependency(t,e,n))),!await this.emitFile(e,`dependency`,t)||e.endsWith(`.json`))return;if(e.endsWith(`.node`))return await(0,sharedlib_emit_1.sharedLibEmit)(e,this);if(e.endsWith(`.js`)||e.endsWith(`.ts`)){let t=await this.getPjsonBoundary(e);t&&await this.emitFile(t+path_1.sep+`package.json`,`resolve`,e)}if(n===0)return;let o,s=this.analysisCache.get(e);if(s)o=s;else{let t=await this.readFile(e);if(t===null)throw Error(`File `+e+` does not exist.`);o=await(0,analyze_1.default)(e,t.toString(),this),this.analysisCache.set(e,o)}let{deps:l,imports:u,assets:d,isESM:f}=o;f&&this.esmFileList.add((0,path_1.relative)(this.base,e)),await Promise.all([...[...d].map(async t=>{let r=(0,path_1.extname)(t);r===`.js`||r===`.mjs`||r===`.node`||r===``||this.ts&&(r===`.ts`||r===`.tsx`)&&t.startsWith(this.base)&&t.slice(this.base.length).indexOf(path_1.sep+`node_modules`+path_1.sep)===-1?await this.emitDependency(t,e,n-1):await this.emitFile(t,`asset`,e)}),...[...l].map(async t=>this.maybeEmitDep(t,e,!f,n-1)),...[...u].map(async t=>this.maybeEmitDep(t,e,!1,n-1))])}}exports.Job=Job;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,`__esModule`,{value:!0}),exports.NotFoundError=void 0,exports.default=resolveDependency;const path_1=require(`path`),module_1=require(`module`),node_version_1=require(`./utils/node-version`);async function resolveDependency(r,i,a,s=!0){let c;if((0,path_1.isAbsolute)(r)||r===`.`||r===`..`||r.startsWith(`./`)||r.startsWith(`../`)){let s=r.endsWith(`/`);c=await resolvePath((0,path_1.resolve)(i,`..`,r)+(s?`/`:``),i,a)}else c=r[0]===`#`?await packageImportsResolve(r,i,a,s):await resolvePackage(r,i,a,s);return Array.isArray(c)?Promise.all(c.map(e=>a.realpath(e,i))):c.startsWith(`node:`)?c:a.realpath(c,i)}async function resolvePath(e,r,i){let a=await resolveFile(e,r,i)||await resolveDir(e,r,i);if(!a)throw new NotFoundError(e,r);return a}async function resolveFile(r,i,a){if(!r.endsWith(`/`)){if(r=await a.realpath(r,i),await a.isFile(r))return r;if(a.ts&&r.startsWith(a.base)&&r.slice(a.base.length).indexOf(path_1.sep+`node_modules`+path_1.sep)===-1&&await a.isFile(r+`.ts`))return r+`.ts`;if(a.ts&&r.startsWith(a.base)&&r.slice(a.base.length).indexOf(path_1.sep+`node_modules`+path_1.sep)===-1&&await a.isFile(r+`.tsx`))return r+`.tsx`;if(await a.isFile(r+`.js`))return r+`.js`;if(await a.isFile(r+`.json`))return r+`.json`;if(await a.isFile(r+`.node`))return r+`.node`}}async function resolveDir(r,i,a){if(r.endsWith(`/`)&&(r=r.slice(0,-1)),!await a.isDir(r))return;let o=await getPkgCfg(r,a);if(o&&typeof o.main==`string`){let c=await resolveFile((0,path_1.resolve)(r,o.main),i,a)||await resolveFile((0,path_1.resolve)(r,o.main,`index`),i,a);if(c)return await a.emitFile(r+path_1.sep+`package.json`,`resolve`,i),c}return resolveFile((0,path_1.resolve)(r,`index`),i,a)}class NotFoundError extends Error{code;constructor(e,r){super(`Cannot find module '`+e+`' loaded from `+r),this.code=`MODULE_NOT_FOUND`}}exports.NotFoundError=NotFoundError;const nodeBuiltins=new Set(module_1.builtinModules);function getPkgName(e){let r=e.split(`/`);return e[0]===`@`&&r.length>1?r.length>1?r.slice(0,2).join(`/`):null:r.length?r[0]:null}async function getPkgCfg(r,i){let a=await i.readFile(r+path_1.sep+`package.json`);if(a)try{return JSON.parse(a.toString())}catch{}}function getExportsTarget(e,r,a){if(typeof e==`string`||e===null)return e;if(Array.isArray(e))for(let i of e){let e=getExportsTarget(i,r,a);if(e===null||typeof e==`string`&&e.startsWith(`./`))return e}else if(typeof e==`object`){for(let o of Object.keys(e))if(o===`default`||o===`require`&&a||o===`import`&&!a||o===`module-sync`&&(0,node_version_1.getNodeMajorVersion)()>=22||r.includes(o)){let i=getExportsTarget(e[o],r,a);if(i!==void 0)return i}}}async function validateAndResolvePaths(e,r,i,a){let o=[];for(let u of e)if(a){let e=await resolveFile(u,r,i)||await resolveDir(u,r,i);if(!e)throw new NotFoundError(u,r);o.push(e)}else{if(!await i.isFile(u))throw new NotFoundError(u,r);o.push(u)}return o}async function resolveExportsImports(e,r,a,o,s,c,l){let u;if(s){if(!(typeof r==`object`&&!Array.isArray(r)&&r!==null))return;u=r}else u=typeof r==`string`||Array.isArray(r)||r===null||typeof r==`object`&&Object.keys(r).length&&Object.keys(r)[0][0]!==`.`?{".":r}:r;if(a in u){let r=getExportsTarget(u[a],o.conditions,c);if(typeof r==`string`&&r.startsWith(`./`)){let s=e+r.slice(1),d=[s],f=u[a];if(typeof f==`object`&&f&&!Array.isArray(f)&&`module-sync`in f&&(0,node_version_1.getNodeMajorVersion)()>=22){let r=getExportsTarget(f[`require`in f?`require`:`default`],o.conditions,c);if(typeof r==`string`&&r.startsWith(`./`)){let i=e+r.slice(1);i!==s&&d.push(i)}}return await validateAndResolvePaths(d,l,o,c)}}for(let r of Object.keys(u).sort((e,r)=>r.length-e.length)){if(r.endsWith(`*`)&&a.startsWith(r.slice(0,-1))){let i=getExportsTarget(u[r],o.conditions,c);if(typeof i==`string`&&i.startsWith(`./`))return await validateAndResolvePaths([e+i.slice(1).replace(/\*/g,a.slice(r.length-1))],l,o,c)}if(r.endsWith(`/`)&&a.startsWith(r)){let i=getExportsTarget(u[r],o.conditions,c);if(typeof i==`string`&&i.endsWith(`/`)&&i.startsWith(`./`))return await validateAndResolvePaths([e+i.slice(1)+a.slice(r.length)],l,o,c)}}}async function resolveRemappings(r,i,a,o){if(o.conditions?.includes(`browser`)){let{browser:c}=i;if(!c)return;if(typeof c==`object`)for(let[i,l]of Object.entries(c)){if(typeof l!=`string`||!i.startsWith(`./`)||!l.startsWith(`./`))continue;let c=await resolveFile(r+path_1.sep+i,a,o),u=await resolveFile(r+path_1.sep+l,a,o);c&&u&&o.addRemapping(c,u)}}}async function packageImportsResolve(r,i,a,o){if(r!==`#`&&!r.startsWith(`#/`)&&a.conditions){let s=await a.getPjsonBoundary(i);if(s){let c=await getPkgCfg(s,a),{imports:l}=c||{};if(c&&l!=null){let c=await resolveExportsImports(s,l,r,a,!0,o,i);if(c)return await a.emitFile(s+path_1.sep+`package.json`,`resolve`,i),c}}}throw new NotFoundError(r,i)}async function resolvePackage(r,i,a,o){let p=i;if(nodeBuiltins.has(r))return`node:`+r;if(r.startsWith(`node:`))return r;let m=getPkgName(r)||``,h;if(a.conditions){let s=await a.getPjsonBoundary(i);if(s){let c=await getPkgCfg(s,a),{exports:l}=c||{};c&&c.name&&c.name===m&&l!=null&&(h=await resolveExportsImports(s,l,`.`+r.slice(m.length),a,!1,o,i),h&&await a.emitFile(s+path_1.sep+`package.json`,`resolve`,i))}}let g,_=p.indexOf(path_1.sep);for(;(g=p.lastIndexOf(path_1.sep))>_;){p=p.slice(0,g);let l=p+path_1.sep+`node_modules`,u=await a.stat(l);if(!u||!u.isDirectory())continue;let d=await getPkgCfg(l+path_1.sep+m,a),{exports:_}=d||{};if(d&&await resolveRemappings(l+path_1.sep+m,d,i,a),a.conditions&&_!=null&&!h){let u;a.exportsOnly||(u=await resolveFile(l+path_1.sep+r,i,a)||await resolveDir(l+path_1.sep+r,i,a));let d=await resolveExportsImports(l+path_1.sep+m,_,`.`+r.slice(m.length),a,!1,o,i);if(d)return await a.emitFile(l+path_1.sep+m+path_1.sep+`package.json`,`resolve`,i),u&&!d.includes(u)?[...d,u]:d;if(u)return u}else{let o=await resolveFile(l+path_1.sep+r,i,a)||await resolveDir(l+path_1.sep+r,i,a);if(o){if(h){if(Array.isArray(h))return h.includes(o)?h:[o,...h];if(h!==o)return[o,h]}return o}}}if(h)return h;if(Object.hasOwnProperty.call(a.paths,r))return a.paths[r];for(let e of Object.keys(a.paths))if(e.endsWith(`/`)&&r.startsWith(e)){let o=a.paths[e]+r.slice(e.length),u=await resolveFile(o,i,a)||await resolveDir(o,i,a);if(!u)throw new NotFoundError(r,i);return u}throw new NotFoundError(r,i)}
1
+ "use strict";Object.defineProperty(exports,`__esModule`,{value:!0}),exports.NotFoundError=void 0,exports.default=resolveDependency;const path_1=require(`path`),module_1=require(`module`),node_version_1=require(`./utils/node-version`);async function resolveDependency(t,n,r,a=!0){let o;if((0,path_1.isAbsolute)(t)||t===`.`||t===`..`||t.startsWith(`./`)||t.startsWith(`../`)){let a=t.endsWith(`/`);o=await resolvePath((0,path_1.resolve)(n,`..`,t)+(a?`/`:``),n,r)}else o=t[0]===`#`?await packageImportsResolve(t,n,r,a):await resolvePackage(t,n,r,a);return Array.isArray(o)?Promise.all(o.map(e=>r.realpath(e,n))):o.startsWith(`node:`)?o:r.realpath(o,n)}async function resolvePath(e,t,n){let r=await resolveFile(e,t,n)||await resolveDir(e,t,n);if(!r)throw new NotFoundError(e,t);return r}async function resolveFile(t,n,r){if(!t.endsWith(`/`)){if(t=await r.realpath(t,n),await r.isFile(t))return t;if(r.ts&&t.startsWith(r.base)&&t.slice(r.base.length).indexOf(path_1.sep+`node_modules`+path_1.sep)===-1&&await r.isFile(t+`.ts`))return t+`.ts`;if(r.ts&&t.startsWith(r.base)&&t.slice(r.base.length).indexOf(path_1.sep+`node_modules`+path_1.sep)===-1&&await r.isFile(t+`.tsx`))return t+`.tsx`;if(await r.isFile(t+`.js`))return t+`.js`;if(await r.isFile(t+`.json`))return t+`.json`;if(await r.isFile(t+`.node`))return t+`.node`}}async function resolveDir(t,n,r){if(t.endsWith(`/`)&&(t=t.slice(0,-1)),!await r.isDir(t))return;let i=await getPkgCfg(t,r);if(i&&typeof i.main==`string`){let o=await resolveFile((0,path_1.resolve)(t,i.main),n,r)||await resolveFile((0,path_1.resolve)(t,i.main,`index`),n,r);if(o)return await r.emitFile(t+path_1.sep+`package.json`,`resolve`,n),o}return resolveFile((0,path_1.resolve)(t,`index`),n,r)}class NotFoundError extends Error{code;constructor(e,t){super(`Cannot find module '`+e+`' loaded from `+t),this.code=`MODULE_NOT_FOUND`}}exports.NotFoundError=NotFoundError;const nodeBuiltins=new Set(module_1.builtinModules);function getPkgName(e){let t=e.split(`/`);return e[0]===`@`&&t.length>1?t.length>1?t.slice(0,2).join(`/`):null:t.length?t[0]:null}async function getPkgCfg(t,n){let r=await n.readFile(t+path_1.sep+`package.json`);if(r)try{return JSON.parse(r.toString())}catch{}}function getExportsTarget(e,t,r){if(typeof e==`string`||e===null)return e;if(Array.isArray(e))for(let n of e){let e=getExportsTarget(n,t,r);if(e===null||typeof e==`string`&&e.startsWith(`./`))return e}else if(typeof e==`object`){for(let i of Object.keys(e))if(i===`default`||i===`require`&&r||i===`import`&&!r||i===`module-sync`&&(0,node_version_1.getNodeMajorVersion)()>=22||t.includes(i)){let n=getExportsTarget(e[i],t,r);if(n!==void 0)return n}}}async function validateAndResolvePaths(e,t,n,r){let i=[];for(let c of e)if(r){let e=await resolveFile(c,t,n)||await resolveDir(c,t,n);if(!e)throw new NotFoundError(c,t);i.push(e)}else{if(!await n.isFile(c))throw new NotFoundError(c,t);i.push(c)}return i}async function resolveExportsImports(e,t,r,i,a,o,s){let c;if(a){if(!(typeof t==`object`&&!Array.isArray(t)&&t!==null))return;c=t}else c=typeof t==`string`||Array.isArray(t)||t===null||typeof t==`object`&&Object.keys(t).length&&Object.keys(t)[0][0]!==`.`?{".":t}:t;if(r in c){let t=getExportsTarget(c[r],i.conditions,o);if(typeof t==`string`&&t.startsWith(`./`)){let a=e+t.slice(1),l=[a],u=c[r];if(typeof u==`object`&&u&&!Array.isArray(u)&&`module-sync`in u&&(0,node_version_1.getNodeMajorVersion)()>=22){let t=getExportsTarget(u[`require`in u?`require`:`default`],i.conditions,o);if(typeof t==`string`&&t.startsWith(`./`)){let n=e+t.slice(1);n!==a&&l.push(n)}}return await validateAndResolvePaths(l,s,i,o)}}for(let t of Object.keys(c).sort((e,t)=>t.length-e.length)){if(t.endsWith(`*`)&&r.startsWith(t.slice(0,-1))){let n=getExportsTarget(c[t],i.conditions,o);if(typeof n==`string`&&n.startsWith(`./`))return await validateAndResolvePaths([e+n.slice(1).replace(/\*/g,r.slice(t.length-1))],s,i,o)}if(t.endsWith(`/`)&&r.startsWith(t)){let n=getExportsTarget(c[t],i.conditions,o);if(typeof n==`string`&&n.endsWith(`/`)&&n.startsWith(`./`))return await validateAndResolvePaths([e+n.slice(1)+r.slice(t.length)],s,i,o)}}}async function resolveRemappings(t,n,r,i){if(i.conditions?.includes(`browser`)){let{browser:o}=n;if(!o)return;if(typeof o==`object`)for(let[n,s]of Object.entries(o)){if(typeof s!=`string`||!n.startsWith(`./`)||!s.startsWith(`./`))continue;let o=await resolveFile(t+path_1.sep+n,r,i),c=await resolveFile(t+path_1.sep+s,r,i);o&&c&&i.addRemapping(o,c)}}}async function packageImportsResolve(t,n,r,i){if(t!==`#`&&!t.startsWith(`#/`)&&r.conditions){let a=await r.getPjsonBoundary(n);if(a){let o=await getPkgCfg(a,r),{imports:s}=o||{};if(o&&s!=null){let o=await resolveExportsImports(a,s,t,r,!0,i,n);if(o)return await r.emitFile(a+path_1.sep+`package.json`,`resolve`,n),o}}}throw new NotFoundError(t,n)}async function resolvePackage(t,n,r,i){let d=n;if(nodeBuiltins.has(t))return`node:`+t;if(t.startsWith(`node:`))return t;let f=getPkgName(t)||``,p;if(r.conditions){let a=await r.getPjsonBoundary(n);if(a){let o=await getPkgCfg(a,r),{exports:s}=o||{};o&&o.name&&o.name===f&&s!=null&&(p=await resolveExportsImports(a,s,`.`+t.slice(f.length),r,!1,i,n),p&&await r.emitFile(a+path_1.sep+`package.json`,`resolve`,n))}}let m,h=d.indexOf(path_1.sep);for(;(m=d.lastIndexOf(path_1.sep))>h;){d=d.slice(0,m);let s=d+path_1.sep+`node_modules`,c=await r.stat(s);if(!c||!c.isDirectory())continue;let l=await getPkgCfg(s+path_1.sep+f,r),{exports:h}=l||{};if(l&&await resolveRemappings(s+path_1.sep+f,l,n,r),r.conditions&&h!=null&&!p){let c;r.exportsOnly||(c=await resolveFile(s+path_1.sep+t,n,r)||await resolveDir(s+path_1.sep+t,n,r));let l=await resolveExportsImports(s+path_1.sep+f,h,`.`+t.slice(f.length),r,!1,i,n);if(l)return await r.emitFile(s+path_1.sep+f+path_1.sep+`package.json`,`resolve`,n),c&&!l.includes(c)?[...l,c]:l;if(c)return c}else{let i=await resolveFile(s+path_1.sep+t,n,r)||await resolveDir(s+path_1.sep+t,n,r);if(i){if(p){if(Array.isArray(p))return p.includes(i)?p:[i,...p];if(p!==i)return[i,p]}return i}}}if(p)return p;if(Object.hasOwnProperty.call(r.paths,t))return r.paths[t];for(let e of Object.keys(r.paths))if(e.endsWith(`/`)&&t.startsWith(e)){let i=r.paths[e]+t.slice(e.length),c=await resolveFile(i,n,r)||await resolveDir(i,n,r);if(!c)throw new NotFoundError(t,n);return c}throw new NotFoundError(t,n)}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,`__esModule`,{value:!0}),exports.isIdentifierRead=isIdentifierRead,exports.isVarLoop=isVarLoop,exports.isLoop=isLoop;function isIdentifierRead(e,n){switch(n.type){case`ObjectPattern`:case`ArrayPattern`:return!1;case`AssignmentExpression`:return n.right===e;case`MemberExpression`:return n.computed||e===n.object;case`Property`:return e===n.value;case`MethodDefinition`:return!1;case`VariableDeclarator`:return n.id!==e;case`ExportSpecifier`:return!1;case`FunctionExpression`:case`FunctionDeclaration`:case`ArrowFunctionExpression`:return!1;default:return!0}}function isVarLoop(e){return e.type===`ForStatement`||e.type===`ForInStatement`||e.type===`ForOfStatement`}function isLoop(e){return e.type===`ForStatement`||e.type===`ForInStatement`||e.type===`ForOfStatement`||e.type===`WhileStatement`||e.type===`DoWhileStatement`}
1
+ "use strict";Object.defineProperty(exports,`__esModule`,{value:!0}),exports.isIdentifierRead=isIdentifierRead,exports.isVarLoop=isVarLoop,exports.isLoop=isLoop;function isIdentifierRead(e,t){switch(t.type){case`ObjectPattern`:case`ArrayPattern`:return!1;case`AssignmentExpression`:return t.right===e;case`MemberExpression`:return t.computed||e===t.object;case`Property`:return e===t.value;case`MethodDefinition`:return!1;case`VariableDeclarator`:return t.id!==e;case`ExportSpecifier`:return!1;case`FunctionExpression`:case`FunctionDeclaration`:case`ArrowFunctionExpression`:return!1;default:return!0}}function isVarLoop(e){return e.type===`ForStatement`||e.type===`ForInStatement`||e.type===`ForOfStatement`}function isLoop(e){return e.type===`ForStatement`||e.type===`ForInStatement`||e.type===`ForOfStatement`||e.type===`WhileStatement`||e.type===`DoWhileStatement`}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,`__esModule`,{value:!0}),exports.getPackageBase=getPackageBase,exports.getPackageName=getPackageName;const pkgNameRegEx=/^(@[^\\\/]+[\\\/])?[^\\\/]+/;function getPackageBase(t){let n=t.lastIndexOf(`node_modules`);if(n!==-1&&(t[n-1]===`/`||t[n-1]===`\\`)&&(t[n+12]===`/`||t[n+12]===`\\`)){let r=t.slice(n+13).match(pkgNameRegEx);if(r)return t.slice(0,n+13+r[0].length)}}function getPackageName(t){let n=t.lastIndexOf(`node_modules`);if(n!==-1&&(t[n-1]===`/`||t[n-1]===`\\`)&&(t[n+12]===`/`||t[n+12]===`\\`)){let r=t.slice(n+13).match(pkgNameRegEx);if(r&&r.length>0)return r[0].replace(/\\/g,`/`)}}
1
+ "use strict";Object.defineProperty(exports,`__esModule`,{value:!0}),exports.getPackageBase=getPackageBase,exports.getPackageName=getPackageName;const pkgNameRegEx=/^(@[^\\\/]+[\\\/])?[^\\\/]+/;function getPackageBase(e){let t=e.lastIndexOf(`node_modules`);if(t!==-1&&(e[t-1]===`/`||e[t-1]===`\\`)&&(e[t+12]===`/`||e[t+12]===`\\`)){let n=e.slice(t+13).match(pkgNameRegEx);if(n)return e.slice(0,t+13+n[0].length)}}function getPackageName(e){let t=e.lastIndexOf(`node_modules`);if(t!==-1&&(e[t-1]===`/`||e[t-1]===`\\`)&&(e[t+12]===`/`||e[t+12]===`\\`)){let n=e.slice(t+13).match(pkgNameRegEx);if(n&&n.length>0)return n[0].replace(/\\/g,`/`)}}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,`__esModule`,{value:!0}),exports.normalizeDefaultRequire=normalizeDefaultRequire,exports.normalizeWildcardRequire=normalizeWildcardRequire;function normalizeDefaultRequire(e){return e&&e.__esModule?e:{default:e}}const hasOwnProperty=Object.prototype.hasOwnProperty;function normalizeWildcardRequire(e){if(e&&e.__esModule)return e;let n={};for(let r in e)hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n.default=e,n}
1
+ "use strict";Object.defineProperty(exports,`__esModule`,{value:!0}),exports.normalizeDefaultRequire=normalizeDefaultRequire,exports.normalizeWildcardRequire=normalizeWildcardRequire;function normalizeDefaultRequire(e){return e&&e.__esModule?e:{default:e}}const hasOwnProperty=Object.prototype.hasOwnProperty;function normalizeWildcardRequire(e){if(e&&e.__esModule)return e;let t={};for(let n in e)hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}
@@ -1 +1 @@
1
- "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,`__esModule`,{value:!0}),exports.sharedLibEmit=sharedLibEmit;const os_1=__importDefault(require(`os`)),path_1=__importDefault(require(`path`)),glob_1=require(`glob`),get_package_base_1=require(`./get-package-base`);let sharedlibGlob=``;switch(os_1.default.platform()){case`darwin`:sharedlibGlob=`/**/*.@(dylib|so?(.*))`;break;case`win32`:sharedlibGlob=`/**/*.dll`;break;default:sharedlibGlob=`/**/*.so?(.*)`}async function sharedLibEmit(e,i){let o=(0,get_package_base_1.getPackageBase)(e);if(!o)return;let s=await(0,glob_1.glob)(o.replaceAll(path_1.default.sep,path_1.default.posix.sep)+sharedlibGlob,{ignore:o.replaceAll(path_1.default.sep,path_1.default.posix.sep)+`/**/node_modules/**/*`,dot:!0});await Promise.all(s.map(a=>i.emitFile(a,`sharedlib`,e)))}
1
+ "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,`__esModule`,{value:!0}),exports.sharedLibEmit=sharedLibEmit;const os_1=__importDefault(require(`os`)),path_1=__importDefault(require(`path`)),glob_1=require(`glob`),get_package_base_1=require(`./get-package-base`);let sharedlibGlob=``;switch(os_1.default.platform()){case`darwin`:sharedlibGlob=`/**/*.@(dylib|so?(.*))`;break;case`win32`:sharedlibGlob=`/**/*.dll`;break;default:sharedlibGlob=`/**/*.so?(.*)`}async function sharedLibEmit(e,t){let r=(0,get_package_base_1.getPackageBase)(e);if(!r)return;let i=await(0,glob_1.glob)(r.replaceAll(path_1.default.sep,path_1.default.posix.sep)+sharedlibGlob,{ignore:r.replaceAll(path_1.default.sep,path_1.default.posix.sep)+`/**/node_modules/**/*`,dot:!0});await Promise.all(i.map(n=>t.emitFile(n,`sharedlib`,e)))}
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@vercel/nft",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "main": "./out/index.js"
5
5
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,`__esModule`,{value:!0}),exports.importAttributesOrAssertions=exports.importAttributes=exports.importAssertions=void 0;var _acorn=_interopRequireWildcard(require(`acorn`));function _getRequireWildcardCache(e){if(typeof WeakMap!=`function`)return null;var o=new WeakMap,s=new WeakMap;return(_getRequireWildcardCache=function(e){return e?s:o})(e)}function _interopRequireWildcard(e,o){if(!o&&e&&e.__esModule)return e;if(e===null||typeof e!=`object`&&typeof e!=`function`)return{default:e};var s=_getRequireWildcardCache(o);if(s&&s.has(e))return s.get(e);var c={__proto__:null},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var u in e)if(u!==`default`&&{}.hasOwnProperty.call(e,u)){var d=l?Object.getOwnPropertyDescriptor(e,u):null;d&&(d.get||d.set)?Object.defineProperty(c,u,d):c[u]=e[u]}return c.default=e,s&&s.set(e,c),c}const leftCurlyBrace=123,space=32,withKeyword=`with`,assertKeyword=`assert`,FUNC_STATEMENT=1,FUNC_HANGING_STATEMENT=2,FUNC_NULLABLE_ID=4,importAttributes=exports.importAttributes=plugin({keyword:`with`}),importAssertions=exports.importAssertions=plugin({keyword:`assert`}),importAttributesOrAssertions=exports.importAttributesOrAssertions=plugin({keyword:`with-assert`});function plugin(e){return function(a){return pluginImpl(e,a)}}function pluginImpl(a,o){let{tokTypes:s,TokenType:c}=o.acorn||_acorn,{keyword:d}=a,f=d.includes(withKeyword),p=d.includes(assertKeyword),m=f&&p;return class extends o{constructor(...e){super(...e),this.withToken=f&&new c(withKeyword),this.assertToken=p&&new c(assertKeyword)}_codeAt(e){return this.input.charCodeAt(e)}_eat(e){this.type!==e&&this.unexpected(),this.next()}_matchKeywordToken(){return m&&(this.type===this.withToken||this.type===this.assertToken)||f&&this.type===this.withToken||p&&this.type===this.assertToken}_getProperty(){return m?this.type===this.withToken?`attributes`:`assertions`:f?`attributes`:`assertions`}readToken(e){let a=0,o,s;if(m){if(this.input.slice(this.pos,this.pos+4)===withKeyword)o=withKeyword,s=this.withToken;else if(this.input.slice(this.pos,this.pos+6)===assertKeyword)o=assertKeyword,s=this.assertToken;else return super.readToken(e);a+=o.length}else for(o=f?withKeyword:assertKeyword,s=f?this.withToken:this.assertToken;a<o.length;a++)if(this._codeAt(this.pos+a)!==o.charCodeAt(a))return super.readToken(e);for(;this._codeAt(this.pos+a)!==123;a++)if(this._codeAt(this.pos+a)!==32)return super.readToken(e);return this.type.label===`{`?super.readToken(e):(this.pos+=o.length,this.finishToken(s))}parseDynamicImport(e){return this.next(),e.source=this.parseMaybeAssign(),this.eat(s.comma)&&(e.arguments=[this.parseExpression()]),this._eat(s.parenR),this.finishNode(e,`ImportExpression`)}parseExport(e,a){if(this.next(),this.eat(s.star)){if(this.options.ecmaVersion>=11&&(this.eatContextual(`as`)?(e.exported=this.parseIdent(!0),this.checkExport(a,e.exported.name,this.lastTokStart)):e.exported=null),this.expectContextual(`from`),this.type!==s.string&&this.unexpected(),e.source=this.parseExprAtom(),this._matchKeywordToken()){let a=this._getProperty();this.next();let o=this.parseImportAttributes();o&&(e[a]=o)}return this.semicolon(),this.finishNode(e,`ExportAllDeclaration`)}if(this.eat(s._default)){this.checkExport(a,`default`,this.lastTokStart);var o;if(this.type===s._function||(o=this.isAsyncFunction())){var c=this.startNode();this.next(),o&&this.next(),e.declaration=this.parseFunction(c,5,!1,o)}else if(this.type===s._class){var l=this.startNode();e.declaration=this.parseClass(l,`nullableID`)}else e.declaration=this.parseMaybeAssign(),this.semicolon();return this.finishNode(e,`ExportDefaultDeclaration`)}if(this.shouldParseExportStatement())e.declaration=this.parseStatement(null),e.declaration.type===`VariableDeclaration`?this.checkVariableExport(a,e.declaration.declarations):this.checkExport(a,e.declaration.id.name,e.declaration.id.start),e.specifiers=[],e.source=null;else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(a),this.eatContextual(`from`)){if(this.type!==s.string&&this.unexpected(),e.source=this.parseExprAtom(),this._matchKeywordToken()){let a=this._getProperty();this.next();let o=this.parseImportAttributes();o&&(e[a]=o)}}else{for(var u=0,d=e.specifiers;u<d.length;u+=1){var f=d[u];this.checkUnreserved(f.local),this.checkLocalExport(f.local)}e.source=null}this.semicolon()}return this.finishNode(e,`ExportNamedDeclaration`)}parseImport(e){if(this.next(),this.type===s.string?(e.specifiers=[],e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual(`from`),e.source=this.type===s.string?this.parseExprAtom():this.unexpected()),this._matchKeywordToken()){let a=this._getProperty();this.next();let o=this.parseImportAttributes();o&&(e[a]=o)}return this.semicolon(),this.finishNode(e,`ImportDeclaration`)}parseImportAttributes(){this._eat(s.braceL);let e=this.parsewithEntries();return this._eat(s.braceR),e}parsewithEntries(){let e=[],a=new Set;do{if(this.type===s.braceR)break;let o=this.startNode(),c;c=this.type===s.string?this.parseLiteral(this.value):this.parseIdent(!0),this.next(),o.key=c,a.has(o.key.name)&&this.raise(this.pos,`Duplicated key in attributes`),a.add(o.key.name),this.type!==s.string&&this.raise(this.pos,`Only string is supported as an attribute value`),o.value=this.parseLiteral(this.value),e.push(this.finishNode(o,`ImportAttribute`))}while(this.eat(s.comma));return e}}}
1
+ "use strict";Object.defineProperty(exports,`__esModule`,{value:!0}),exports.importAttributesOrAssertions=exports.importAttributes=exports.importAssertions=void 0;var _acorn=_interopRequireWildcard(require(`acorn`));function _getRequireWildcardCache(e){if(typeof WeakMap!=`function`)return null;var n=new WeakMap,r=new WeakMap;return(_getRequireWildcardCache=function(e){return e?r:n})(e)}function _interopRequireWildcard(e,n){if(!n&&e&&e.__esModule)return e;if(e===null||typeof e!=`object`&&typeof e!=`function`)return{default:e};var r=_getRequireWildcardCache(n);if(r&&r.has(e))return r.get(e);var i={__proto__:null},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(o!==`default`&&{}.hasOwnProperty.call(e,o)){var s=a?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(i,o,s):i[o]=e[o]}return i.default=e,r&&r.set(e,i),i}const leftCurlyBrace=123,space=32,withKeyword=`with`,assertKeyword=`assert`,FUNC_STATEMENT=1,FUNC_HANGING_STATEMENT=2,FUNC_NULLABLE_ID=4,importAttributes=exports.importAttributes=plugin({keyword:`with`}),importAssertions=exports.importAssertions=plugin({keyword:`assert`}),importAttributesOrAssertions=exports.importAttributesOrAssertions=plugin({keyword:`with-assert`});function plugin(e){return function(t){return pluginImpl(e,t)}}function pluginImpl(t,n){let{tokTypes:r,TokenType:i}=n.acorn||_acorn,{keyword:s}=t,c=s.includes(withKeyword),l=s.includes(assertKeyword),u=c&&l;return class extends n{constructor(...e){super(...e),this.withToken=c&&new i(withKeyword),this.assertToken=l&&new i(assertKeyword)}_codeAt(e){return this.input.charCodeAt(e)}_eat(e){this.type!==e&&this.unexpected(),this.next()}_matchKeywordToken(){return u&&(this.type===this.withToken||this.type===this.assertToken)||c&&this.type===this.withToken||l&&this.type===this.assertToken}_getProperty(){return u?this.type===this.withToken?`attributes`:`assertions`:c?`attributes`:`assertions`}readToken(e){let t=0,n,r;if(u){if(this.input.slice(this.pos,this.pos+4)===withKeyword)n=withKeyword,r=this.withToken;else if(this.input.slice(this.pos,this.pos+6)===assertKeyword)n=assertKeyword,r=this.assertToken;else return super.readToken(e);t+=n.length}else for(n=c?withKeyword:assertKeyword,r=c?this.withToken:this.assertToken;t<n.length;t++)if(this._codeAt(this.pos+t)!==n.charCodeAt(t))return super.readToken(e);for(;this._codeAt(this.pos+t)!==123;t++)if(this._codeAt(this.pos+t)!==32)return super.readToken(e);return this.type.label===`{`?super.readToken(e):(this.pos+=n.length,this.finishToken(r))}parseDynamicImport(e){return this.next(),e.source=this.parseMaybeAssign(),this.eat(r.comma)&&(e.arguments=[this.parseExpression()]),this._eat(r.parenR),this.finishNode(e,`ImportExpression`)}parseExport(e,t){if(this.next(),this.eat(r.star)){if(this.options.ecmaVersion>=11&&(this.eatContextual(`as`)?(e.exported=this.parseIdent(!0),this.checkExport(t,e.exported.name,this.lastTokStart)):e.exported=null),this.expectContextual(`from`),this.type!==r.string&&this.unexpected(),e.source=this.parseExprAtom(),this._matchKeywordToken()){let t=this._getProperty();this.next();let n=this.parseImportAttributes();n&&(e[t]=n)}return this.semicolon(),this.finishNode(e,`ExportAllDeclaration`)}if(this.eat(r._default)){this.checkExport(t,`default`,this.lastTokStart);var n;if(this.type===r._function||(n=this.isAsyncFunction())){var i=this.startNode();this.next(),n&&this.next(),e.declaration=this.parseFunction(i,5,!1,n)}else if(this.type===r._class){var a=this.startNode();e.declaration=this.parseClass(a,`nullableID`)}else e.declaration=this.parseMaybeAssign(),this.semicolon();return this.finishNode(e,`ExportDefaultDeclaration`)}if(this.shouldParseExportStatement())e.declaration=this.parseStatement(null),e.declaration.type===`VariableDeclaration`?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id.name,e.declaration.id.start),e.specifiers=[],e.source=null;else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual(`from`)){if(this.type!==r.string&&this.unexpected(),e.source=this.parseExprAtom(),this._matchKeywordToken()){let t=this._getProperty();this.next();let n=this.parseImportAttributes();n&&(e[t]=n)}}else{for(var o=0,s=e.specifiers;o<s.length;o+=1){var c=s[o];this.checkUnreserved(c.local),this.checkLocalExport(c.local)}e.source=null}this.semicolon()}return this.finishNode(e,`ExportNamedDeclaration`)}parseImport(e){if(this.next(),this.type===r.string?(e.specifiers=[],e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual(`from`),e.source=this.type===r.string?this.parseExprAtom():this.unexpected()),this._matchKeywordToken()){let t=this._getProperty();this.next();let n=this.parseImportAttributes();n&&(e[t]=n)}return this.semicolon(),this.finishNode(e,`ImportDeclaration`)}parseImportAttributes(){this._eat(r.braceL);let e=this.parsewithEntries();return this._eat(r.braceR),e}parsewithEntries(){let e=[],t=new Set;do{if(this.type===r.braceR)break;let n=this.startNode(),i;i=this.type===r.string?this.parseLiteral(this.value):this.parseIdent(!0),this.next(),n.key=i,t.has(n.key.name)&&this.raise(this.pos,`Duplicated key in attributes`),t.add(n.key.name),this.type!==r.string&&this.raise(this.pos,`Only string is supported as an attribute value`),n.value=this.parseLiteral(this.value),e.push(this.finishNode(n,`ImportAttribute`))}while(this.eat(r.comma));return e}}}
@@ -1 +1 @@
1
- "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,`__esModule`,{value:!0}),exports.RateLimit=exports.Sema=void 0;const events_1=__importDefault(require(`events`));function arrayMove(e,o,s,c,l){for(let u=0;u<l;++u)s[u+c]=e[u+o],e[u+o]=void 0}function pow2AtLeast(e){return e>>>=0,--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e+1}function getCapacity(e){return pow2AtLeast(Math.min(Math.max(16,e),1073741824))}class Deque{constructor(e){this._capacity=getCapacity(e),this._length=0,this._front=0,this.arr=[]}push(e){let o=this._length;this.checkCapacity(o+1);let s=this._front+o&this._capacity-1;return this.arr[s]=e,this._length=o+1,o+1}pop(){let e=this._length;if(e===0)return;let o=this._front+e-1&this._capacity-1,s=this.arr[o];return this.arr[o]=void 0,this._length=e-1,s}shift(){let e=this._length;if(e===0)return;let o=this._front,s=this.arr[o];return this.arr[o]=void 0,this._front=o+1&this._capacity-1,this._length=e-1,s}get length(){return this._length}checkCapacity(e){this._capacity<e&&this.resizeTo(getCapacity(this._capacity*1.5+16))}resizeTo(e){let o=this._capacity;this._capacity=e;let c=this._front,l=this._length;if(c+l>o){let e=c+l&o-1;arrayMove(this.arr,0,this.arr,o,e)}}}class ReleaseEmitter extends events_1.default{}function isFn(e){return typeof e==`function`}function defaultInit(){return`1`}class Sema{constructor(e,{initFn:o=defaultInit,pauseFn:s,resumeFn:c,capacity:l=10}={}){if(isFn(s)!==isFn(c))throw Error(`pauseFn and resumeFn must be both set for pausing`);this.nrTokens=e,this.free=new Deque(e),this.waiting=new Deque(l),this.releaseEmitter=new ReleaseEmitter,this.noTokens=o===defaultInit,this.pauseFn=s,this.resumeFn=c,this.paused=!1,this.releaseEmitter.on(`release`,e=>{let o=this.waiting.shift();o?o.resolve(e):(this.resumeFn&&this.paused&&(this.paused=!1,this.resumeFn()),this.free.push(e))});for(let s=0;s<e;s++)this.free.push(o())}tryAcquire(){return this.free.pop()}async acquire(){let e=this.tryAcquire();return e===void 0?new Promise((e,o)=>{this.pauseFn&&!this.paused&&(this.paused=!0,this.pauseFn()),this.waiting.push({resolve:e,reject:o})}):e}release(e){this.releaseEmitter.emit(`release`,this.noTokens?`1`:e)}drain(){let e=Array(this.nrTokens);for(let o=0;o<this.nrTokens;o++)e[o]=this.acquire();return Promise.all(e)}nrWaiting(){return this.waiting.length}}exports.Sema=Sema;function RateLimit(e,{timeUnit:o=1e3,uniformDistribution:s=!1}={}){let c=new Sema(s?1:e),l=s?o/e:o;return async function(){await c.acquire(),setTimeout(()=>c.release(),l)}}exports.RateLimit=RateLimit;
1
+ "use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,`__esModule`,{value:!0}),exports.RateLimit=exports.Sema=void 0;const events_1=__importDefault(require(`events`));function arrayMove(e,t,n,r,i){for(let a=0;a<i;++a)n[a+r]=e[a+t],e[a+t]=void 0}function pow2AtLeast(e){return e>>>=0,--e,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e+1}function getCapacity(e){return pow2AtLeast(Math.min(Math.max(16,e),1073741824))}class Deque{constructor(e){this._capacity=getCapacity(e),this._length=0,this._front=0,this.arr=[]}push(e){let t=this._length;this.checkCapacity(t+1);let n=this._front+t&this._capacity-1;return this.arr[n]=e,this._length=t+1,t+1}pop(){let e=this._length;if(e===0)return;let t=this._front+e-1&this._capacity-1,n=this.arr[t];return this.arr[t]=void 0,this._length=e-1,n}shift(){let e=this._length;if(e===0)return;let t=this._front,n=this.arr[t];return this.arr[t]=void 0,this._front=t+1&this._capacity-1,this._length=e-1,n}get length(){return this._length}checkCapacity(e){this._capacity<e&&this.resizeTo(getCapacity(this._capacity*1.5+16))}resizeTo(e){let t=this._capacity;this._capacity=e;let r=this._front,i=this._length;if(r+i>t){let e=r+i&t-1;arrayMove(this.arr,0,this.arr,t,e)}}}class ReleaseEmitter extends events_1.default{}function isFn(e){return typeof e==`function`}function defaultInit(){return`1`}class Sema{constructor(e,{initFn:t=defaultInit,pauseFn:n,resumeFn:r,capacity:i=10}={}){if(isFn(n)!==isFn(r))throw Error(`pauseFn and resumeFn must be both set for pausing`);this.nrTokens=e,this.free=new Deque(e),this.waiting=new Deque(i),this.releaseEmitter=new ReleaseEmitter,this.noTokens=t===defaultInit,this.pauseFn=n,this.resumeFn=r,this.paused=!1,this.releaseEmitter.on(`release`,e=>{let t=this.waiting.shift();t?t.resolve(e):(this.resumeFn&&this.paused&&(this.paused=!1,this.resumeFn()),this.free.push(e))});for(let n=0;n<e;n++)this.free.push(t())}tryAcquire(){return this.free.pop()}async acquire(){let e=this.tryAcquire();return e===void 0?new Promise((e,t)=>{this.pauseFn&&!this.paused&&(this.paused=!0,this.pauseFn()),this.waiting.push({resolve:e,reject:t})}):e}release(e){this.releaseEmitter.emit(`release`,this.noTokens?`1`:e)}drain(){let e=Array(this.nrTokens);for(let t=0;t<this.nrTokens;t++)e[t]=this.acquire();return Promise.all(e)}nrWaiting(){return this.waiting.length}}exports.Sema=Sema;function RateLimit(e,{timeUnit:t=1e3,uniformDistribution:n=!1}={}){let r=new Sema(n?1:e),i=n?t/e:t;return async function(){await r.acquire(),setTimeout(()=>r.release(),i)}}exports.RateLimit=RateLimit;
@@ -1,3 +1,3 @@
1
- var fs=require(`fs`),path=require(`path`),fileURLToPath=require(`file-uri-to-path`),join=path.join,dirname=path.dirname,exists=fs.accessSync&&function(n){try{fs.accessSync(n)}catch{return!1}return!0}||fs.existsSync||path.existsSync,defaults={arrow:process.env.NODE_BINDINGS_ARROW||` → `,compiled:process.env.NODE_BINDINGS_COMPILED_DIR||`compiled`,platform:process.platform,arch:process.arch,nodePreGyp:`node-v`+process.versions.modules+`-`+process.platform+`-`+process.arch,version:process.versions.node,bindings:`bindings.node`,try:[[`module_root`,`build`,`bindings`],[`module_root`,`build`,`Debug`,`bindings`],[`module_root`,`build`,`Release`,`bindings`],[`module_root`,`out`,`Debug`,`bindings`],[`module_root`,`Debug`,`bindings`],[`module_root`,`out`,`Release`,`bindings`],[`module_root`,`Release`,`bindings`],[`module_root`,`build`,`default`,`bindings`],[`module_root`,`compiled`,`version`,`platform`,`arch`,`bindings`],[`module_root`,`addon-build`,`release`,`install-root`,`bindings`],[`module_root`,`addon-build`,`debug`,`install-root`,`bindings`],[`module_root`,`addon-build`,`default`,`install-root`,`bindings`],[`module_root`,`lib`,`binding`,`nodePreGyp`,`bindings`]]};function bindings(e){typeof e==`string`?e={bindings:e}:e||={},Object.keys(defaults).map(function(n){n in e||(e[n]=defaults[n])}),e.module_root||=exports.getRoot(exports.getFileName()),path.extname(e.bindings)!=`.node`&&(e.bindings+=`.node`);for(var r=typeof __webpack_require__==`function`?__non_webpack_require__:require,a=[],o=0,s=e.try.length,c,l,u;o<s;o++){c=join.apply(null,e.try[o].map(function(n){return e[n]||n})),a.push(c);try{return l=e.path?r.resolve(c):r(c),e.path||(l.path=c),l}catch(e){if(e.code!==`MODULE_NOT_FOUND`&&e.code!==`QUALIFIED_PATH_RESOLUTION_FAILED`&&!/not find/i.test(e.message))throw e}}throw u=Error(`Could not locate the bindings file. Tried:
2
- `+a.map(function(n){return e.arrow+n}).join(`
3
- `)),u.tries=a,u}module.exports=exports=bindings,exports.getFileName=function(e){var n=Error.prepareStackTrace,i=Error.stackTraceLimit,a={},o;return Error.stackTraceLimit=10,Error.prepareStackTrace=function(n,r){for(var i=0,a=r.length;i<a;i++)if(o=r[i].getFileName(),o!==__filename)if(e){if(o!==e)return}else return},Error.captureStackTrace(a),a.stack,Error.prepareStackTrace=n,Error.stackTraceLimit=i,o.indexOf(`file://`)===0&&(o=fileURLToPath(o)),o},exports.getRoot=function(e){for(var n=dirname(e),r;;){if(n===`.`&&(n=process.cwd()),exists(join(n,`package.json`))||exists(join(n,`node_modules`)))return n;if(r===n)throw Error(`Could not find module root given file: "`+e+'". Do you have a `package.json` file? ');r=n,n=join(n,`..`)}};
1
+ var fs=require(`fs`),path=require(`path`),fileURLToPath=require(`file-uri-to-path`),join=path.join,dirname=path.dirname,exists=fs.accessSync&&function(t){try{fs.accessSync(t)}catch{return!1}return!0}||fs.existsSync||path.existsSync,defaults={arrow:process.env.NODE_BINDINGS_ARROW||` → `,compiled:process.env.NODE_BINDINGS_COMPILED_DIR||`compiled`,platform:process.platform,arch:process.arch,nodePreGyp:`node-v`+process.versions.modules+`-`+process.platform+`-`+process.arch,version:process.versions.node,bindings:`bindings.node`,try:[[`module_root`,`build`,`bindings`],[`module_root`,`build`,`Debug`,`bindings`],[`module_root`,`build`,`Release`,`bindings`],[`module_root`,`out`,`Debug`,`bindings`],[`module_root`,`Debug`,`bindings`],[`module_root`,`out`,`Release`,`bindings`],[`module_root`,`Release`,`bindings`],[`module_root`,`build`,`default`,`bindings`],[`module_root`,`compiled`,`version`,`platform`,`arch`,`bindings`],[`module_root`,`addon-build`,`release`,`install-root`,`bindings`],[`module_root`,`addon-build`,`debug`,`install-root`,`bindings`],[`module_root`,`addon-build`,`default`,`install-root`,`bindings`],[`module_root`,`lib`,`binding`,`nodePreGyp`,`bindings`]]};function bindings(e){typeof e==`string`?e={bindings:e}:e||={},Object.keys(defaults).map(function(t){t in e||(e[t]=defaults[t])}),e.module_root||=exports.getRoot(exports.getFileName()),path.extname(e.bindings)!=`.node`&&(e.bindings+=`.node`);for(var n=typeof __webpack_require__==`function`?__non_webpack_require__:require,i=[],a=0,o=e.try.length,s,c,l;a<o;a++){s=join.apply(null,e.try[a].map(function(t){return e[t]||t})),i.push(s);try{return c=e.path?n.resolve(s):n(s),e.path||(c.path=s),c}catch(e){if(e.code!==`MODULE_NOT_FOUND`&&e.code!==`QUALIFIED_PATH_RESOLUTION_FAILED`&&!/not find/i.test(e.message))throw e}}throw l=Error(`Could not locate the bindings file. Tried:
2
+ `+i.map(function(t){return e.arrow+t}).join(`
3
+ `)),l.tries=i,l}module.exports=exports=bindings,exports.getFileName=function(e){var t=Error.prepareStackTrace,r=Error.stackTraceLimit,i={},a;return Error.stackTraceLimit=10,Error.prepareStackTrace=function(t,n){for(var r=0,i=n.length;r<i;r++)if(a=n[r].getFileName(),a!==__filename)if(e){if(a!==e)return}else return},Error.captureStackTrace(i),i.stack,Error.prepareStackTrace=t,Error.stackTraceLimit=r,a.indexOf(`file://`)===0&&(a=fileURLToPath(a)),a},exports.getRoot=function(e){for(var t=dirname(e),n;;){if(t===`.`&&(t=process.cwd()),exists(join(t,`package.json`))||exists(join(t,`node_modules`)))return t;if(n===t)throw Error(`Could not find module root given file: "`+e+'". Do you have a `package.json` file? ');n=t,t=join(t,`..`)}};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,`__esModule`,{value:!0});const core=require(`./core.cjs`),basic=require(`./shared/consola.DCGIlDNP.cjs`);require(`node:util`),require(`node:path`);function createConsola(n={}){let r=core.LogLevels.info;return process.env.CONSOLA_LEVEL&&(r=Number.parseInt(process.env.CONSOLA_LEVEL)??r),core.createConsola({level:r,defaults:{level:r},stdout:process.stdout,stderr:process.stderr,reporters:n.reporters||[new basic.BasicReporter],...n})}const consola=createConsola();exports.Consola=core.Consola,exports.LogLevels=core.LogLevels,exports.LogTypes=core.LogTypes,exports.consola=consola,exports.createConsola=createConsola,exports.default=consola;
1
+ "use strict";Object.defineProperty(exports,`__esModule`,{value:!0});const core=require(`./core.cjs`),basic=require(`./shared/consola.DCGIlDNP.cjs`);require(`node:util`),require(`node:path`);function createConsola(e={}){let t=core.LogLevels.info;return process.env.CONSOLA_LEVEL&&(t=Number.parseInt(process.env.CONSOLA_LEVEL)??t),core.createConsola({level:t,defaults:{level:t},stdout:process.stdout,stderr:process.stderr,reporters:e.reporters||[new basic.BasicReporter],...e})}const consola=createConsola();exports.Consola=core.Consola,exports.LogLevels=core.LogLevels,exports.LogTypes=core.LogTypes,exports.consola=consola,exports.createConsola=createConsola,exports.default=consola;
@@ -1,4 +1,4 @@
1
- "use strict";const LogLevels={silent:-1/0,fatal:0,error:0,warn:1,log:2,info:3,success:3,fail:3,ready:3,start:3,box:3,debug:4,trace:5,verbose:1/0},LogTypes={silent:{level:-1},fatal:{level:LogLevels.fatal},error:{level:LogLevels.error},warn:{level:LogLevels.warn},log:{level:LogLevels.log},info:{level:LogLevels.info},success:{level:LogLevels.success},fail:{level:LogLevels.fail},ready:{level:LogLevels.info},start:{level:LogLevels.info},box:{level:LogLevels.info},debug:{level:LogLevels.debug},trace:{level:LogLevels.trace},verbose:{level:LogLevels.verbose}};function isPlainObject$1(e){if(typeof e!=`object`||!e)return!1;let o=Object.getPrototypeOf(e);return o!==null&&o!==Object.prototype&&Object.getPrototypeOf(o)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function _defu(e,o,l=`.`,u){if(!isPlainObject$1(o))return _defu(e,{},l,u);let d=Object.assign({},o);for(let o in e){if(o===`__proto__`||o===`constructor`)continue;let f=e[o];f!=null&&(u&&u(d,o,f,l)||(Array.isArray(f)&&Array.isArray(d[o])?d[o]=[...f,...d[o]]:isPlainObject$1(f)&&isPlainObject$1(d[o])?d[o]=_defu(f,d[o],(l?`${l}.`:``)+o.toString(),u):d[o]=f))}return d}function createDefu(e){return(...o)=>o.reduce((o,s)=>_defu(o,s,``,e),{})}const defu=createDefu();function isPlainObject(e){return Object.prototype.toString.call(e)===`[object Object]`}function isLogObj(e){return!(!isPlainObject(e)||!e.message&&!e.args||e.stack)}let paused=!1;const queue=[];class Consola{options;_lastLog;_mockFn;constructor(e={}){let s=e.types||LogTypes;for(let c in this.options=defu({...e,defaults:{...e.defaults},level:_normalizeLogLevel(e.level,s),reporters:[...e.reporters||[]]},{types:LogTypes,throttle:1e3,throttleMin:5,formatOptions:{date:!0,colors:!1,compact:!0}}),s){let e={type:c,...this.options.defaults,...s[c]};this[c]=this._wrapLogFn(e),this[c].raw=this._wrapLogFn(e,!0)}this.options.mockFn&&this.mockTypes(),this._lastLog={}}get level(){return this.options.level}set level(e){this.options.level=_normalizeLogLevel(e,this.options.types,this.options.level)}prompt(e,o){if(!this.options.prompt)throw Error(`prompt is not supported!`);return this.options.prompt(e,o)}create(e){let o=new Consola({...this.options,...e});return this._mockFn&&o.mockTypes(this._mockFn),o}withDefaults(e){return this.create({...this.options,defaults:{...this.options.defaults,...e}})}withTag(e){return this.withDefaults({tag:this.options.defaults.tag?this.options.defaults.tag+`:`+e:e})}addReporter(e){return this.options.reporters.push(e),this}removeReporter(e){if(e){let o=this.options.reporters.indexOf(e);if(o!==-1)return this.options.reporters.splice(o,1)}else this.options.reporters.splice(0);return this}setReporters(e){return this.options.reporters=Array.isArray(e)?e:[e],this}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}wrapConsole(){for(let e in this.options.types)console[`__`+e]||(console[`__`+e]=console[e]),console[e]=this[e].raw}restoreConsole(){for(let e in this.options.types)console[`__`+e]&&(console[e]=console[`__`+e],delete console[`__`+e])}wrapStd(){this._wrapStream(this.options.stdout,`log`),this._wrapStream(this.options.stderr,`log`)}_wrapStream(e,o){e&&(e.__write||=e.write,e.write=e=>{this[o].raw(String(e).trim())})}restoreStd(){this._restoreStream(this.options.stdout),this._restoreStream(this.options.stderr)}_restoreStream(e){e&&e.__write&&(e.write=e.__write,delete e.__write)}pauseLogs(){paused=!0}resumeLogs(){paused=!1;let e=queue.splice(0);for(let o of e)o[0]._logFn(o[1],o[2])}mockTypes(e){let o=e||this.options.mockFn;if(this._mockFn=o,typeof o==`function`)for(let e in this.options.types)this[e]=o(e,this.options.types[e])||this[e],this[e].raw=this[e]}_wrapLogFn(e,o){return(...s)=>{if(paused){queue.push([this,e,s,o]);return}return this._logFn(e,s,o)}}_logFn(e,o,s){if((e.level||0)>this.level)return!1;let c={date:new Date,args:[],...e,level:_normalizeLogLevel(e.level,this.options.types)};!s&&o.length===1&&isLogObj(o[0])?Object.assign(c,o[0]):c.args=[...o],c.message&&(c.args.unshift(c.message),delete c.message),c.additional&&(Array.isArray(c.additional)||(c.additional=c.additional.split(`
2
- `)),c.args.push(`
3
- `+c.additional.join(`
4
- `)),delete c.additional),c.type=typeof c.type==`string`?c.type.toLowerCase():`log`,c.tag=typeof c.tag==`string`?c.tag:``;let l=(e=!1)=>{let o=(this._lastLog.count||0)-this.options.throttleMin;if(this._lastLog.object&&o>0){let e=[...this._lastLog.object.args];o>1&&e.push(`(repeated ${o} times)`),this._log({...this._lastLog.object,args:e}),this._lastLog.count=1}e&&(this._lastLog.object=c,this._log(c))};clearTimeout(this._lastLog.timeout);let u=this._lastLog.time&&c.date?c.date.getTime()-this._lastLog.time.getTime():0;if(this._lastLog.time=c.date,u<this.options.throttle)try{let e=JSON.stringify([c.type,c.tag,c.args]),o=this._lastLog.serialized===e;if(this._lastLog.serialized=e,o&&(this._lastLog.count=(this._lastLog.count||0)+1,this._lastLog.count>this.options.throttleMin)){this._lastLog.timeout=setTimeout(l,this.options.throttle);return}}catch{}l(!0)}_log(e){for(let o of this.options.reporters)o.log(e,{options:this.options})}}function _normalizeLogLevel(e,o={},s=3){return e===void 0?s:typeof e==`number`?e:o[e]&&o[e].level!==void 0?o[e].level:s}Consola.prototype.add=Consola.prototype.addReporter,Consola.prototype.remove=Consola.prototype.removeReporter,Consola.prototype.clear=Consola.prototype.removeReporter,Consola.prototype.withScope=Consola.prototype.withTag,Consola.prototype.mock=Consola.prototype.mockTypes,Consola.prototype.pause=Consola.prototype.pauseLogs,Consola.prototype.resume=Consola.prototype.resumeLogs;function createConsola(e={}){return new Consola(e)}exports.Consola=Consola,exports.LogLevels=LogLevels,exports.LogTypes=LogTypes,exports.createConsola=createConsola;
1
+ "use strict";const LogLevels={silent:-1/0,fatal:0,error:0,warn:1,log:2,info:3,success:3,fail:3,ready:3,start:3,box:3,debug:4,trace:5,verbose:1/0},LogTypes={silent:{level:-1},fatal:{level:LogLevels.fatal},error:{level:LogLevels.error},warn:{level:LogLevels.warn},log:{level:LogLevels.log},info:{level:LogLevels.info},success:{level:LogLevels.success},fail:{level:LogLevels.fail},ready:{level:LogLevels.info},start:{level:LogLevels.info},box:{level:LogLevels.info},debug:{level:LogLevels.debug},trace:{level:LogLevels.trace},verbose:{level:LogLevels.verbose}};function isPlainObject$1(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function _defu(e,t,i=`.`,a){if(!isPlainObject$1(t))return _defu(e,{},i,a);let o=Object.assign({},t);for(let t in e){if(t===`__proto__`||t===`constructor`)continue;let s=e[t];s!=null&&(a&&a(o,t,s,i)||(Array.isArray(s)&&Array.isArray(o[t])?o[t]=[...s,...o[t]]:isPlainObject$1(s)&&isPlainObject$1(o[t])?o[t]=_defu(s,o[t],(i?`${i}.`:``)+t.toString(),a):o[t]=s))}return o}function createDefu(e){return(...t)=>t.reduce((t,n)=>_defu(t,n,``,e),{})}const defu=createDefu();function isPlainObject(e){return Object.prototype.toString.call(e)===`[object Object]`}function isLogObj(e){return!(!isPlainObject(e)||!e.message&&!e.args||e.stack)}let paused=!1;const queue=[];class Consola{options;_lastLog;_mockFn;constructor(e={}){let n=e.types||LogTypes;for(let r in this.options=defu({...e,defaults:{...e.defaults},level:_normalizeLogLevel(e.level,n),reporters:[...e.reporters||[]]},{types:LogTypes,throttle:1e3,throttleMin:5,formatOptions:{date:!0,colors:!1,compact:!0}}),n){let e={type:r,...this.options.defaults,...n[r]};this[r]=this._wrapLogFn(e),this[r].raw=this._wrapLogFn(e,!0)}this.options.mockFn&&this.mockTypes(),this._lastLog={}}get level(){return this.options.level}set level(e){this.options.level=_normalizeLogLevel(e,this.options.types,this.options.level)}prompt(e,t){if(!this.options.prompt)throw Error(`prompt is not supported!`);return this.options.prompt(e,t)}create(e){let t=new Consola({...this.options,...e});return this._mockFn&&t.mockTypes(this._mockFn),t}withDefaults(e){return this.create({...this.options,defaults:{...this.options.defaults,...e}})}withTag(e){return this.withDefaults({tag:this.options.defaults.tag?this.options.defaults.tag+`:`+e:e})}addReporter(e){return this.options.reporters.push(e),this}removeReporter(e){if(e){let t=this.options.reporters.indexOf(e);if(t!==-1)return this.options.reporters.splice(t,1)}else this.options.reporters.splice(0);return this}setReporters(e){return this.options.reporters=Array.isArray(e)?e:[e],this}wrapAll(){this.wrapConsole(),this.wrapStd()}restoreAll(){this.restoreConsole(),this.restoreStd()}wrapConsole(){for(let e in this.options.types)console[`__`+e]||(console[`__`+e]=console[e]),console[e]=this[e].raw}restoreConsole(){for(let e in this.options.types)console[`__`+e]&&(console[e]=console[`__`+e],delete console[`__`+e])}wrapStd(){this._wrapStream(this.options.stdout,`log`),this._wrapStream(this.options.stderr,`log`)}_wrapStream(e,t){e&&(e.__write||=e.write,e.write=e=>{this[t].raw(String(e).trim())})}restoreStd(){this._restoreStream(this.options.stdout),this._restoreStream(this.options.stderr)}_restoreStream(e){e&&e.__write&&(e.write=e.__write,delete e.__write)}pauseLogs(){paused=!0}resumeLogs(){paused=!1;let e=queue.splice(0);for(let t of e)t[0]._logFn(t[1],t[2])}mockTypes(e){let t=e||this.options.mockFn;if(this._mockFn=t,typeof t==`function`)for(let e in this.options.types)this[e]=t(e,this.options.types[e])||this[e],this[e].raw=this[e]}_wrapLogFn(e,t){return(...n)=>{if(paused){queue.push([this,e,n,t]);return}return this._logFn(e,n,t)}}_logFn(e,t,n){if((e.level||0)>this.level)return!1;let r={date:new Date,args:[],...e,level:_normalizeLogLevel(e.level,this.options.types)};!n&&t.length===1&&isLogObj(t[0])?Object.assign(r,t[0]):r.args=[...t],r.message&&(r.args.unshift(r.message),delete r.message),r.additional&&(Array.isArray(r.additional)||(r.additional=r.additional.split(`
2
+ `)),r.args.push(`
3
+ `+r.additional.join(`
4
+ `)),delete r.additional),r.type=typeof r.type==`string`?r.type.toLowerCase():`log`,r.tag=typeof r.tag==`string`?r.tag:``;let i=(e=!1)=>{let t=(this._lastLog.count||0)-this.options.throttleMin;if(this._lastLog.object&&t>0){let e=[...this._lastLog.object.args];t>1&&e.push(`(repeated ${t} times)`),this._log({...this._lastLog.object,args:e}),this._lastLog.count=1}e&&(this._lastLog.object=r,this._log(r))};clearTimeout(this._lastLog.timeout);let a=this._lastLog.time&&r.date?r.date.getTime()-this._lastLog.time.getTime():0;if(this._lastLog.time=r.date,a<this.options.throttle)try{let e=JSON.stringify([r.type,r.tag,r.args]),t=this._lastLog.serialized===e;if(this._lastLog.serialized=e,t&&(this._lastLog.count=(this._lastLog.count||0)+1,this._lastLog.count>this.options.throttleMin)){this._lastLog.timeout=setTimeout(i,this.options.throttle);return}}catch{}i(!0)}_log(e){for(let t of this.options.reporters)t.log(e,{options:this.options})}}function _normalizeLogLevel(e,t={},n=3){return e===void 0?n:typeof e==`number`?e:t[e]&&t[e].level!==void 0?t[e].level:n}Consola.prototype.add=Consola.prototype.addReporter,Consola.prototype.remove=Consola.prototype.removeReporter,Consola.prototype.clear=Consola.prototype.removeReporter,Consola.prototype.withScope=Consola.prototype.withTag,Consola.prototype.mock=Consola.prototype.mockTypes,Consola.prototype.pause=Consola.prototype.pauseLogs,Consola.prototype.resume=Consola.prototype.resumeLogs;function createConsola(e={}){return new Consola(e)}exports.Consola=Consola,exports.LogLevels=LogLevels,exports.LogTypes=LogTypes,exports.createConsola=createConsola;
@@ -1 +1 @@
1
- "use strict";const childProcess=require(`child_process`),{isLinux,getReport}=require(`./process`),{LDD_PATH,SELF_PATH,readFile,readFileSync}=require(`./filesystem`),{interpreterPath}=require(`./elf`);let cachedFamilyInterpreter,cachedFamilyFilesystem,cachedVersionFilesystem;const command=`getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true`;let commandOut=``;const safeCommand=()=>commandOut||new Promise(F=>{childProcess.exec(command,(m,I)=>{commandOut=m?` `:I,F(commandOut)})}),safeCommandSync=()=>{if(!commandOut)try{commandOut=childProcess.execSync(command,{encoding:`utf8`})}catch{commandOut=` `}return commandOut},GLIBC=`glibc`,RE_GLIBC_VERSION=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,MUSL=`musl`,isFileMusl=m=>m.includes(`libc.musl-`)||m.includes(`ld-musl-`),familyFromReport=()=>{let m=getReport();return m.header&&m.header.glibcVersionRuntime?GLIBC:Array.isArray(m.sharedObjects)&&m.sharedObjects.some(isFileMusl)?MUSL:null},familyFromCommand=m=>{let[F,I]=m.split(/[\r\n]+/);return F&&F.includes(GLIBC)?GLIBC:I&&I.includes(MUSL)?MUSL:null},familyFromInterpreterPath=m=>{if(m){if(m.includes(`/ld-musl-`))return MUSL;if(m.includes(`/ld-linux-`))return GLIBC}return null},getFamilyFromLddContent=m=>(m=m.toString(),m.includes(`musl`)?MUSL:m.includes(`GNU C Library`)?GLIBC:null),familyFromFilesystem=async()=>{if(cachedFamilyFilesystem!==void 0)return cachedFamilyFilesystem;cachedFamilyFilesystem=null;try{cachedFamilyFilesystem=getFamilyFromLddContent(await readFile(LDD_PATH))}catch{}return cachedFamilyFilesystem},familyFromFilesystemSync=()=>{if(cachedFamilyFilesystem!==void 0)return cachedFamilyFilesystem;cachedFamilyFilesystem=null;try{cachedFamilyFilesystem=getFamilyFromLddContent(readFileSync(LDD_PATH))}catch{}return cachedFamilyFilesystem},familyFromInterpreter=async()=>{if(cachedFamilyInterpreter!==void 0)return cachedFamilyInterpreter;cachedFamilyInterpreter=null;try{cachedFamilyInterpreter=familyFromInterpreterPath(interpreterPath(await readFile(SELF_PATH)))}catch{}return cachedFamilyInterpreter},familyFromInterpreterSync=()=>{if(cachedFamilyInterpreter!==void 0)return cachedFamilyInterpreter;cachedFamilyInterpreter=null;try{cachedFamilyInterpreter=familyFromInterpreterPath(interpreterPath(readFileSync(SELF_PATH)))}catch{}return cachedFamilyInterpreter},family=async()=>{let m=null;return isLinux()&&(m=await familyFromInterpreter(),m||(m=await familyFromFilesystem(),m||=familyFromReport(),m||=familyFromCommand(await safeCommand()))),m},familySync=()=>{let m=null;return isLinux()&&(m=familyFromInterpreterSync(),m||(m=familyFromFilesystemSync(),m||=familyFromReport(),m||=familyFromCommand(safeCommandSync()))),m},isNonGlibcLinux=async()=>isLinux()&&await family()!==GLIBC,isNonGlibcLinuxSync=()=>isLinux()&&familySync()!==GLIBC,versionFromFilesystem=async()=>{if(cachedVersionFilesystem!==void 0)return cachedVersionFilesystem;cachedVersionFilesystem=null;try{let m=(await readFile(LDD_PATH)).match(RE_GLIBC_VERSION);m&&(cachedVersionFilesystem=m[1])}catch{}return cachedVersionFilesystem},versionFromFilesystemSync=()=>{if(cachedVersionFilesystem!==void 0)return cachedVersionFilesystem;cachedVersionFilesystem=null;try{let m=readFileSync(LDD_PATH).match(RE_GLIBC_VERSION);m&&(cachedVersionFilesystem=m[1])}catch{}return cachedVersionFilesystem},versionFromReport=()=>{let m=getReport();return m.header&&m.header.glibcVersionRuntime?m.header.glibcVersionRuntime:null},versionSuffix=m=>m.trim().split(/\s+/)[1],versionFromCommand=m=>{let[F,I,L]=m.split(/[\r\n]+/);return F&&F.includes(GLIBC)?versionSuffix(F):I&&L&&I.includes(MUSL)?versionSuffix(L):null},version=async()=>{let m=null;return isLinux()&&(m=await versionFromFilesystem(),m||=versionFromReport(),m||=versionFromCommand(await safeCommand())),m},versionSync=()=>{let m=null;return isLinux()&&(m=versionFromFilesystemSync(),m||=versionFromReport(),m||=versionFromCommand(safeCommandSync())),m};module.exports={GLIBC,MUSL,family,familySync,isNonGlibcLinux,isNonGlibcLinuxSync,version,versionSync};
1
+ "use strict";const childProcess=require(`child_process`),{isLinux,getReport}=require(`./process`),{LDD_PATH,SELF_PATH,readFile,readFileSync}=require(`./filesystem`),{interpreterPath}=require(`./elf`);let cachedFamilyInterpreter,cachedFamilyFilesystem,cachedVersionFilesystem;const command=`getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true`;let commandOut=``;const safeCommand=()=>commandOut||new Promise(t=>{childProcess.exec(command,(e,n)=>{commandOut=e?` `:n,t(commandOut)})}),safeCommandSync=()=>{if(!commandOut)try{commandOut=childProcess.execSync(command,{encoding:`utf8`})}catch{commandOut=` `}return commandOut},GLIBC=`glibc`,RE_GLIBC_VERSION=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,MUSL=`musl`,isFileMusl=e=>e.includes(`libc.musl-`)||e.includes(`ld-musl-`),familyFromReport=()=>{let e=getReport();return e.header&&e.header.glibcVersionRuntime?GLIBC:Array.isArray(e.sharedObjects)&&e.sharedObjects.some(isFileMusl)?MUSL:null},familyFromCommand=e=>{let[t,n]=e.split(/[\r\n]+/);return t&&t.includes(GLIBC)?GLIBC:n&&n.includes(MUSL)?MUSL:null},familyFromInterpreterPath=e=>{if(e){if(e.includes(`/ld-musl-`))return MUSL;if(e.includes(`/ld-linux-`))return GLIBC}return null},getFamilyFromLddContent=e=>(e=e.toString(),e.includes(`musl`)?MUSL:e.includes(`GNU C Library`)?GLIBC:null),familyFromFilesystem=async()=>{if(cachedFamilyFilesystem!==void 0)return cachedFamilyFilesystem;cachedFamilyFilesystem=null;try{cachedFamilyFilesystem=getFamilyFromLddContent(await readFile(LDD_PATH))}catch{}return cachedFamilyFilesystem},familyFromFilesystemSync=()=>{if(cachedFamilyFilesystem!==void 0)return cachedFamilyFilesystem;cachedFamilyFilesystem=null;try{cachedFamilyFilesystem=getFamilyFromLddContent(readFileSync(LDD_PATH))}catch{}return cachedFamilyFilesystem},familyFromInterpreter=async()=>{if(cachedFamilyInterpreter!==void 0)return cachedFamilyInterpreter;cachedFamilyInterpreter=null;try{cachedFamilyInterpreter=familyFromInterpreterPath(interpreterPath(await readFile(SELF_PATH)))}catch{}return cachedFamilyInterpreter},familyFromInterpreterSync=()=>{if(cachedFamilyInterpreter!==void 0)return cachedFamilyInterpreter;cachedFamilyInterpreter=null;try{cachedFamilyInterpreter=familyFromInterpreterPath(interpreterPath(readFileSync(SELF_PATH)))}catch{}return cachedFamilyInterpreter},family=async()=>{let e=null;return isLinux()&&(e=await familyFromInterpreter(),e||(e=await familyFromFilesystem(),e||=familyFromReport(),e||=familyFromCommand(await safeCommand()))),e},familySync=()=>{let e=null;return isLinux()&&(e=familyFromInterpreterSync(),e||(e=familyFromFilesystemSync(),e||=familyFromReport(),e||=familyFromCommand(safeCommandSync()))),e},isNonGlibcLinux=async()=>isLinux()&&await family()!==GLIBC,isNonGlibcLinuxSync=()=>isLinux()&&familySync()!==GLIBC,versionFromFilesystem=async()=>{if(cachedVersionFilesystem!==void 0)return cachedVersionFilesystem;cachedVersionFilesystem=null;try{let e=(await readFile(LDD_PATH)).match(RE_GLIBC_VERSION);e&&(cachedVersionFilesystem=e[1])}catch{}return cachedVersionFilesystem},versionFromFilesystemSync=()=>{if(cachedVersionFilesystem!==void 0)return cachedVersionFilesystem;cachedVersionFilesystem=null;try{let e=readFileSync(LDD_PATH).match(RE_GLIBC_VERSION);e&&(cachedVersionFilesystem=e[1])}catch{}return cachedVersionFilesystem},versionFromReport=()=>{let e=getReport();return e.header&&e.header.glibcVersionRuntime?e.header.glibcVersionRuntime:null},versionSuffix=e=>e.trim().split(/\s+/)[1],versionFromCommand=e=>{let[t,n,r]=e.split(/[\r\n]+/);return t&&t.includes(GLIBC)?versionSuffix(t):n&&r&&n.includes(MUSL)?versionSuffix(r):null},version=async()=>{let e=null;return isLinux()&&(e=await versionFromFilesystem(),e||=versionFromReport(),e||=versionFromCommand(await safeCommand())),e},versionSync=()=>{let e=null;return isLinux()&&(e=versionFromFilesystemSync(),e||=versionFromReport(),e||=versionFromCommand(safeCommandSync())),e};module.exports={GLIBC,MUSL,family,familySync,isNonGlibcLinux,isNonGlibcLinuxSync,version,versionSync};
@@ -1 +1 @@
1
- "use strict";const fs=require(`fs`),LDD_PATH=`/usr/bin/ldd`,SELF_PATH=`/proc/self/exe`,MAX_LENGTH=2048,readFileSync=t=>{let n=fs.openSync(t,`r`),i=Buffer.alloc(MAX_LENGTH),a=fs.readSync(n,i,0,MAX_LENGTH,0);return fs.close(n,()=>{}),i.subarray(0,a)},readFile=t=>new Promise((n,i)=>{fs.open(t,`r`,(t,a)=>{if(t)i(t);else{let t=Buffer.alloc(MAX_LENGTH);fs.read(a,t,0,MAX_LENGTH,0,(r,i)=>{n(t.subarray(0,i)),fs.close(a,()=>{})})}})});module.exports={LDD_PATH:`/usr/bin/ldd`,SELF_PATH:`/proc/self/exe`,readFileSync,readFile};
1
+ "use strict";const fs=require(`fs`),LDD_PATH=`/usr/bin/ldd`,SELF_PATH=`/proc/self/exe`,MAX_LENGTH=2048,readFileSync=e=>{let t=fs.openSync(e,`r`),r=Buffer.alloc(MAX_LENGTH),i=fs.readSync(t,r,0,MAX_LENGTH,0);return fs.close(t,()=>{}),r.subarray(0,i)},readFile=e=>new Promise((t,r)=>{fs.open(e,`r`,(e,i)=>{if(e)r(e);else{let e=Buffer.alloc(MAX_LENGTH);fs.read(i,e,0,MAX_LENGTH,0,(n,r)=>{t(e.subarray(0,r)),fs.close(i,()=>{})})}})});module.exports={LDD_PATH:`/usr/bin/ldd`,SELF_PATH:`/proc/self/exe`,readFileSync,readFile};
@@ -1 +1 @@
1
- var sep=require(`path`).sep||`/`;module.exports=fileUriToPath;function fileUriToPath(t){if(typeof t!=`string`||t.length<=7||t.substring(0,7)!=`file://`)throw TypeError(`must pass in a file:// URI to convert to a file path`);var n=decodeURI(t.substring(7)),r=n.indexOf(`/`),i=n.substring(0,r),a=n.substring(r+1);return i==`localhost`&&(i=``),i&&=sep+sep+i,a=a.replace(/^(.+)\|/,`$1:`),sep==`\\`&&(a=a.replace(/\//g,`\\`)),/^.+\:/.test(a)||(a=sep+a),i+a}
1
+ var sep=require(`path`).sep||`/`;module.exports=fileUriToPath;function fileUriToPath(e){if(typeof e!=`string`||e.length<=7||e.substring(0,7)!=`file://`)throw TypeError(`must pass in a file:// URI to convert to a file path`);var t=decodeURI(e.substring(7)),n=t.indexOf(`/`),r=t.substring(0,n),i=t.substring(n+1);return r==`localhost`&&(r=``),r&&=sep+sep+r,i=i.replace(/^(.+)\|/,`$1:`),sep==`\\`&&(i=i.replace(/\//g,`\\`)),/^.+\:/.test(i)||(i=sep+i),r+i}
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,`__esModule`,{value:!0}),exports.Glob=void 0;const minimatch_1=require(`minimatch`),node_url_1=require(`node:url`),path_scurry_1=require(`path-scurry`),pattern_js_1=require(`./pattern.js`),walker_js_1=require(`./walker.js`),defaultPlatform=typeof process==`object`&&process&&typeof process.platform==`string`?process.platform:`linux`;class Glob{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(a,o){if(!o)throw TypeError(`glob options required`);if(this.withFileTypes=!!o.withFileTypes,this.signal=o.signal,this.follow=!!o.follow,this.dot=!!o.dot,this.dotRelative=!!o.dotRelative,this.nodir=!!o.nodir,this.mark=!!o.mark,o.cwd?(o.cwd instanceof URL||o.cwd.startsWith(`file://`))&&(o.cwd=(0,node_url_1.fileURLToPath)(o.cwd)):this.cwd=``,this.cwd=o.cwd||``,this.root=o.root,this.magicalBraces=!!o.magicalBraces,this.nobrace=!!o.nobrace,this.noext=!!o.noext,this.realpath=!!o.realpath,this.absolute=o.absolute,this.includeChildMatches=o.includeChildMatches!==!1,this.noglobstar=!!o.noglobstar,this.matchBase=!!o.matchBase,this.maxDepth=typeof o.maxDepth==`number`?o.maxDepth:1/0,this.stat=!!o.stat,this.ignore=o.ignore,this.withFileTypes&&this.absolute!==void 0)throw Error(`cannot set absolute and withFileTypes:true`);if(typeof a==`string`&&(a=[a]),this.windowsPathsNoEscape=!!o.windowsPathsNoEscape||o.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(a=a.map(e=>e.replace(/\\/g,`/`))),this.matchBase){if(o.noglobstar)throw TypeError(`base matching requires globstar`);a=a.map(e=>e.includes(`/`)?e:`./**/${e}`)}if(this.pattern=a,this.platform=o.platform||defaultPlatform,this.opts={...o,platform:this.platform},o.scurry){if(this.scurry=o.scurry,o.nocase!==void 0&&o.nocase!==o.scurry.nocase)throw Error(`nocase option contradicts provided scurry option`)}else this.scurry=new(o.platform===`win32`?path_scurry_1.PathScurryWin32:o.platform===`darwin`?path_scurry_1.PathScurryDarwin:o.platform?path_scurry_1.PathScurryPosix:path_scurry_1.PathScurry)(this.cwd,{nocase:o.nocase,fs:o.fs});this.nocase=this.scurry.nocase;let s=this.platform===`darwin`||this.platform===`win32`,c={...o,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:s,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},[l,u]=this.pattern.map(r=>new minimatch_1.Minimatch(r,c)).reduce((e,r)=>(e[0].push(...r.set),e[1].push(...r.globParts),e),[[],[]]);this.patterns=l.map((e,r)=>{let i=u[r];if(!i)throw Error(`invalid pattern object`);return new pattern_js_1.Pattern(e,i,0,this.platform)})}async walk(){return[...await new walker_js_1.GlobWalker(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new walker_js_1.GlobWalker(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new walker_js_1.GlobStream(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new walker_js_1.GlobStream(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}exports.Glob=Glob;
1
+ "use strict";Object.defineProperty(exports,`__esModule`,{value:!0}),exports.Glob=void 0;const minimatch_1=require(`minimatch`),node_url_1=require(`node:url`),path_scurry_1=require(`path-scurry`),pattern_js_1=require(`./pattern.js`),walker_js_1=require(`./walker.js`),defaultPlatform=typeof process==`object`&&process&&typeof process.platform==`string`?process.platform:`linux`;class Glob{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(r,i){if(!i)throw TypeError(`glob options required`);if(this.withFileTypes=!!i.withFileTypes,this.signal=i.signal,this.follow=!!i.follow,this.dot=!!i.dot,this.dotRelative=!!i.dotRelative,this.nodir=!!i.nodir,this.mark=!!i.mark,i.cwd?(i.cwd instanceof URL||i.cwd.startsWith(`file://`))&&(i.cwd=(0,node_url_1.fileURLToPath)(i.cwd)):this.cwd=``,this.cwd=i.cwd||``,this.root=i.root,this.magicalBraces=!!i.magicalBraces,this.nobrace=!!i.nobrace,this.noext=!!i.noext,this.realpath=!!i.realpath,this.absolute=i.absolute,this.includeChildMatches=i.includeChildMatches!==!1,this.noglobstar=!!i.noglobstar,this.matchBase=!!i.matchBase,this.maxDepth=typeof i.maxDepth==`number`?i.maxDepth:1/0,this.stat=!!i.stat,this.ignore=i.ignore,this.withFileTypes&&this.absolute!==void 0)throw Error(`cannot set absolute and withFileTypes:true`);if(typeof r==`string`&&(r=[r]),this.windowsPathsNoEscape=!!i.windowsPathsNoEscape||i.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(r=r.map(e=>e.replace(/\\/g,`/`))),this.matchBase){if(i.noglobstar)throw TypeError(`base matching requires globstar`);r=r.map(e=>e.includes(`/`)?e:`./**/${e}`)}if(this.pattern=r,this.platform=i.platform||defaultPlatform,this.opts={...i,platform:this.platform},i.scurry){if(this.scurry=i.scurry,i.nocase!==void 0&&i.nocase!==i.scurry.nocase)throw Error(`nocase option contradicts provided scurry option`)}else this.scurry=new(i.platform===`win32`?path_scurry_1.PathScurryWin32:i.platform===`darwin`?path_scurry_1.PathScurryDarwin:i.platform?path_scurry_1.PathScurryPosix:path_scurry_1.PathScurry)(this.cwd,{nocase:i.nocase,fs:i.fs});this.nocase=this.scurry.nocase;let a=this.platform===`darwin`||this.platform===`win32`,o={...i,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:a,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},[s,c]=this.pattern.map(t=>new minimatch_1.Minimatch(t,o)).reduce((e,t)=>(e[0].push(...t.set),e[1].push(...t.globParts),e),[[],[]]);this.patterns=s.map((e,t)=>{let n=c[t];if(!n)throw Error(`invalid pattern object`);return new pattern_js_1.Pattern(e,n,0,this.platform)})}async walk(){return[...await new walker_js_1.GlobWalker(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new walker_js_1.GlobWalker(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new walker_js_1.GlobStream(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new walker_js_1.GlobStream(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth===1/0?1/0:this.maxDepth+this.scurry.cwd.depth(),platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}exports.Glob=Glob;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,`__esModule`,{value:!0}),exports.hasMagic=void 0;const minimatch_1=require(`minimatch`),hasMagic=(t,n={})=>{Array.isArray(t)||(t=[t]);for(let r of t)if(new minimatch_1.Minimatch(r,n).hasMagic())return!0;return!1};exports.hasMagic=hasMagic;
1
+ "use strict";Object.defineProperty(exports,`__esModule`,{value:!0}),exports.hasMagic=void 0;const minimatch_1=require(`minimatch`),hasMagic=(e,t={})=>{Array.isArray(e)||(e=[e]);for(let n of e)if(new minimatch_1.Minimatch(n,t).hasMagic())return!0;return!1};exports.hasMagic=hasMagic;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,`__esModule`,{value:!0}),exports.glob=exports.sync=exports.iterate=exports.iterateSync=exports.stream=exports.streamSync=exports.Ignore=exports.hasMagic=exports.Glob=exports.unescape=exports.escape=void 0,exports.globStreamSync=globStreamSync,exports.globStream=globStream,exports.globSync=globSync,exports.globIterateSync=globIterateSync,exports.globIterate=globIterate;const minimatch_1=require(`minimatch`),glob_js_1=require(`./glob.js`),has_magic_js_1=require(`./has-magic.js`);var minimatch_2=require(`minimatch`);Object.defineProperty(exports,`escape`,{enumerable:!0,get:function(){return minimatch_2.escape}}),Object.defineProperty(exports,`unescape`,{enumerable:!0,get:function(){return minimatch_2.unescape}});var glob_js_2=require(`./glob.js`);Object.defineProperty(exports,`Glob`,{enumerable:!0,get:function(){return glob_js_2.Glob}});var has_magic_js_2=require(`./has-magic.js`);Object.defineProperty(exports,`hasMagic`,{enumerable:!0,get:function(){return has_magic_js_2.hasMagic}});var ignore_js_1=require(`./ignore.js`);Object.defineProperty(exports,`Ignore`,{enumerable:!0,get:function(){return ignore_js_1.Ignore}});function globStreamSync(e,f={}){return new glob_js_1.Glob(e,f).streamSync()}function globStream(e,f={}){return new glob_js_1.Glob(e,f).stream()}function globSync(e,f={}){return new glob_js_1.Glob(e,f).walkSync()}async function glob_(e,f={}){return new glob_js_1.Glob(e,f).walk()}function globIterateSync(e,f={}){return new glob_js_1.Glob(e,f).iterateSync()}function globIterate(e,f={}){return new glob_js_1.Glob(e,f).iterate()}exports.streamSync=globStreamSync,exports.stream=Object.assign(globStream,{sync:globStreamSync}),exports.iterateSync=globIterateSync,exports.iterate=Object.assign(globIterate,{sync:globIterateSync}),exports.sync=Object.assign(globSync,{stream:globStreamSync,iterate:globIterateSync}),exports.glob=Object.assign(glob_,{glob:glob_,globSync,sync:exports.sync,globStream,stream:exports.stream,globStreamSync,streamSync:exports.streamSync,globIterate,iterate:exports.iterate,globIterateSync,iterateSync:exports.iterateSync,Glob:glob_js_1.Glob,hasMagic:has_magic_js_1.hasMagic,escape:minimatch_1.escape,unescape:minimatch_1.unescape}),exports.glob.glob=exports.glob;
1
+ "use strict";Object.defineProperty(exports,`__esModule`,{value:!0}),exports.glob=exports.sync=exports.iterate=exports.iterateSync=exports.stream=exports.streamSync=exports.Ignore=exports.hasMagic=exports.Glob=exports.unescape=exports.escape=void 0,exports.globStreamSync=globStreamSync,exports.globStream=globStream,exports.globSync=globSync,exports.globIterateSync=globIterateSync,exports.globIterate=globIterate;const minimatch_1=require(`minimatch`),glob_js_1=require(`./glob.js`),has_magic_js_1=require(`./has-magic.js`);var minimatch_2=require(`minimatch`);Object.defineProperty(exports,`escape`,{enumerable:!0,get:function(){return minimatch_2.escape}}),Object.defineProperty(exports,`unescape`,{enumerable:!0,get:function(){return minimatch_2.unescape}});var glob_js_2=require(`./glob.js`);Object.defineProperty(exports,`Glob`,{enumerable:!0,get:function(){return glob_js_2.Glob}});var has_magic_js_2=require(`./has-magic.js`);Object.defineProperty(exports,`hasMagic`,{enumerable:!0,get:function(){return has_magic_js_2.hasMagic}});var ignore_js_1=require(`./ignore.js`);Object.defineProperty(exports,`Ignore`,{enumerable:!0,get:function(){return ignore_js_1.Ignore}});function globStreamSync(e,t={}){return new glob_js_1.Glob(e,t).streamSync()}function globStream(e,t={}){return new glob_js_1.Glob(e,t).stream()}function globSync(e,t={}){return new glob_js_1.Glob(e,t).walkSync()}async function glob_(e,t={}){return new glob_js_1.Glob(e,t).walk()}function globIterateSync(e,t={}){return new glob_js_1.Glob(e,t).iterateSync()}function globIterate(e,t={}){return new glob_js_1.Glob(e,t).iterate()}exports.streamSync=globStreamSync,exports.stream=Object.assign(globStream,{sync:globStreamSync}),exports.iterateSync=globIterateSync,exports.iterate=Object.assign(globIterate,{sync:globIterateSync}),exports.sync=Object.assign(globSync,{stream:globStreamSync,iterate:globIterateSync}),exports.glob=Object.assign(glob_,{glob:glob_,globSync,sync:exports.sync,globStream,stream:exports.stream,globStreamSync,streamSync:exports.streamSync,globIterate,iterate:exports.iterate,globIterateSync,iterateSync:exports.iterateSync,Glob:glob_js_1.Glob,hasMagic:has_magic_js_1.hasMagic,escape:minimatch_1.escape,unescape:minimatch_1.unescape}),exports.glob.glob=exports.glob;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,`__esModule`,{value:!0}),exports.GlobStream=exports.GlobWalker=exports.GlobUtil=void 0;const minipass_1=require(`minipass`),ignore_js_1=require(`./ignore.js`),processor_js_1=require(`./processor.js`),makeIgnore=(e,r)=>typeof e==`string`?new ignore_js_1.Ignore([e],r):Array.isArray(e)?new ignore_js_1.Ignore(e,r):e;class GlobUtil{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#onResume=[];#ignore;#sep;signal;maxDepth;includeChildMatches;constructor(e,n,r){if(this.patterns=e,this.path=n,this.opts=r,this.#sep=!r.posix&&r.platform===`win32`?`\\`:`/`,this.includeChildMatches=r.includeChildMatches!==!1,(r.ignore||!this.includeChildMatches)&&(this.#ignore=makeIgnore(r.ignore??[],r),!this.includeChildMatches&&typeof this.#ignore.add!=`function`))throw Error(`cannot ignore child matches, ignore lacks add() method.`);this.maxDepth=r.maxDepth||1/0,r.signal&&(this.signal=r.signal,this.signal.addEventListener(`abort`,()=>{this.#onResume.length=0}))}#ignored(e){return this.seen.has(e)||!!this.#ignore?.ignored?.(e)}#childrenIgnored(e){return!!this.#ignore?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#onResume.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#onResume.push(e):e())}async matchCheck(e,n){if(n&&this.opts.nodir)return;let r;if(this.opts.realpath){if(r=e.realpathCached()||await e.realpath(),!r)return;e=r}let i=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&i?.isSymbolicLink()){let e=await i.realpath();e&&(e.isUnknown()||this.opts.stat)&&await e.lstat()}return this.matchCheckTest(i,n)}matchCheckTest(e,n){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!n||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#ignored(e)?e:void 0}matchCheckSync(e,n){if(n&&this.opts.nodir)return;let r;if(this.opts.realpath){if(r=e.realpathCached()||e.realpathSync(),!r)return;e=r}let i=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&i?.isSymbolicLink()){let e=i.realpathSync();e&&(e?.isUnknown()||this.opts.stat)&&e.lstatSync()}return this.matchCheckTest(i,n)}matchFinish(e,n){if(this.#ignored(e))return;if(!this.includeChildMatches&&this.#ignore?.add){let n=`${e.relativePosix()}/**`;this.#ignore.add(n)}let r=this.opts.absolute===void 0?n:this.opts.absolute;this.seen.add(e);let i=this.opts.mark&&e.isDirectory()?this.#sep:``;if(this.opts.withFileTypes)this.matchEmit(e);else if(r){let n=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(n+i)}else{let n=this.opts.posix?e.relativePosix():e.relative(),r=this.opts.dotRelative&&!n.startsWith(`..`+this.#sep)?`.`+this.#sep:``;this.matchEmit(n?r+n+i:`.`+i)}}async match(e,n,r){let i=await this.matchCheck(e,r);i&&this.matchFinish(i,n)}matchSync(e,n,r){let i=this.matchCheckSync(e,r);i&&this.matchFinish(i,n)}walkCB(e,n,i){this.signal?.aborted&&i(),this.walkCB2(e,n,new processor_js_1.Processor(this.opts),i)}walkCB2(e,n,r,i){if(this.#childrenIgnored(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(e,n,r,i));return}r.processPatterns(e,n);let a=1,o=()=>{--a===0&&i()};for(let[e,n,i]of r.matches.entries())this.#ignored(e)||(a++,this.match(e,n,i).then(()=>o()));for(let e of r.subwalkTargets()){if(this.maxDepth!==1/0&&e.depth()>=this.maxDepth)continue;a++;let n=e.readdirCached();e.calledReaddir()?this.walkCB3(e,n,r,o):e.readdirCB((n,i)=>this.walkCB3(e,i,r,o),!0)}o()}walkCB3(e,n,r,i){r=r.filterEntries(e,n);let a=1,o=()=>{--a===0&&i()};for(let[e,n,i]of r.matches.entries())this.#ignored(e)||(a++,this.match(e,n,i).then(()=>o()));for(let[e,n]of r.subwalks.entries())a++,this.walkCB2(e,n,r.child(),o);o()}walkCBSync(e,n,i){this.signal?.aborted&&i(),this.walkCB2Sync(e,n,new processor_js_1.Processor(this.opts),i)}walkCB2Sync(e,n,r,i){if(this.#childrenIgnored(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(e,n,r,i));return}r.processPatterns(e,n);let a=1,o=()=>{--a===0&&i()};for(let[e,n,i]of r.matches.entries())this.#ignored(e)||this.matchSync(e,n,i);for(let e of r.subwalkTargets()){if(this.maxDepth!==1/0&&e.depth()>=this.maxDepth)continue;a++;let n=e.readdirSync();this.walkCB3Sync(e,n,r,o)}o()}walkCB3Sync(e,n,r,i){r=r.filterEntries(e,n);let a=1,o=()=>{--a===0&&i()};for(let[e,n,i]of r.matches.entries())this.#ignored(e)||this.matchSync(e,n,i);for(let[e,n]of r.subwalks.entries())a++,this.walkCB2Sync(e,n,r.child(),o);o()}}exports.GlobUtil=GlobUtil;class GlobWalker extends GlobUtil{matches=new Set;constructor(e,n,r){super(e,n,r)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,n)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?n(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}}exports.GlobWalker=GlobWalker;class GlobStream extends GlobUtil{results;constructor(n,r,i){super(n,r,i),this.results=new minipass_1.Minipass({signal:this.signal,objectMode:!0}),this.results.on(`drain`,()=>this.resume()),this.results.on(`resume`,()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}exports.GlobStream=GlobStream;
1
+ "use strict";Object.defineProperty(exports,`__esModule`,{value:!0}),exports.GlobStream=exports.GlobWalker=exports.GlobUtil=void 0;const minipass_1=require(`minipass`),ignore_js_1=require(`./ignore.js`),processor_js_1=require(`./processor.js`),makeIgnore=(e,n)=>typeof e==`string`?new ignore_js_1.Ignore([e],n):Array.isArray(e)?new ignore_js_1.Ignore(e,n):e;class GlobUtil{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#onResume=[];#ignore;#sep;signal;maxDepth;includeChildMatches;constructor(e,t,n){if(this.patterns=e,this.path=t,this.opts=n,this.#sep=!n.posix&&n.platform===`win32`?`\\`:`/`,this.includeChildMatches=n.includeChildMatches!==!1,(n.ignore||!this.includeChildMatches)&&(this.#ignore=makeIgnore(n.ignore??[],n),!this.includeChildMatches&&typeof this.#ignore.add!=`function`))throw Error(`cannot ignore child matches, ignore lacks add() method.`);this.maxDepth=n.maxDepth||1/0,n.signal&&(this.signal=n.signal,this.signal.addEventListener(`abort`,()=>{this.#onResume.length=0}))}#ignored(e){return this.seen.has(e)||!!this.#ignore?.ignored?.(e)}#childrenIgnored(e){return!!this.#ignore?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#onResume.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#onResume.push(e):e())}async matchCheck(e,t){if(t&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||await e.realpath(),!n)return;e=n}let r=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let e=await r.realpath();e&&(e.isUnknown()||this.opts.stat)&&await e.lstat()}return this.matchCheckTest(r,t)}matchCheckTest(e,t){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!t||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#ignored(e)?e:void 0}matchCheckSync(e,t){if(t&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||e.realpathSync(),!n)return;e=n}let r=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let e=r.realpathSync();e&&(e?.isUnknown()||this.opts.stat)&&e.lstatSync()}return this.matchCheckTest(r,t)}matchFinish(e,t){if(this.#ignored(e))return;if(!this.includeChildMatches&&this.#ignore?.add){let t=`${e.relativePosix()}/**`;this.#ignore.add(t)}let n=this.opts.absolute===void 0?t:this.opts.absolute;this.seen.add(e);let r=this.opts.mark&&e.isDirectory()?this.#sep:``;if(this.opts.withFileTypes)this.matchEmit(e);else if(n){let t=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(t+r)}else{let t=this.opts.posix?e.relativePosix():e.relative(),n=this.opts.dotRelative&&!t.startsWith(`..`+this.#sep)?`.`+this.#sep:``;this.matchEmit(t?n+t+r:`.`+r)}}async match(e,t,n){let r=await this.matchCheck(e,n);r&&this.matchFinish(r,t)}matchSync(e,t,n){let r=this.matchCheckSync(e,n);r&&this.matchFinish(r,t)}walkCB(e,t,r){this.signal?.aborted&&r(),this.walkCB2(e,t,new processor_js_1.Processor(this.opts),r)}walkCB2(e,t,n,r){if(this.#childrenIgnored(e))return r();if(this.signal?.aborted&&r(),this.paused){this.onResume(()=>this.walkCB2(e,t,n,r));return}n.processPatterns(e,t);let i=1,a=()=>{--i===0&&r()};for(let[e,t,r]of n.matches.entries())this.#ignored(e)||(i++,this.match(e,t,r).then(()=>a()));for(let e of n.subwalkTargets()){if(this.maxDepth!==1/0&&e.depth()>=this.maxDepth)continue;i++;let t=e.readdirCached();e.calledReaddir()?this.walkCB3(e,t,n,a):e.readdirCB((t,r)=>this.walkCB3(e,r,n,a),!0)}a()}walkCB3(e,t,n,r){n=n.filterEntries(e,t);let i=1,a=()=>{--i===0&&r()};for(let[e,t,r]of n.matches.entries())this.#ignored(e)||(i++,this.match(e,t,r).then(()=>a()));for(let[e,t]of n.subwalks.entries())i++,this.walkCB2(e,t,n.child(),a);a()}walkCBSync(e,t,r){this.signal?.aborted&&r(),this.walkCB2Sync(e,t,new processor_js_1.Processor(this.opts),r)}walkCB2Sync(e,t,n,r){if(this.#childrenIgnored(e))return r();if(this.signal?.aborted&&r(),this.paused){this.onResume(()=>this.walkCB2Sync(e,t,n,r));return}n.processPatterns(e,t);let i=1,a=()=>{--i===0&&r()};for(let[e,t,r]of n.matches.entries())this.#ignored(e)||this.matchSync(e,t,r);for(let e of n.subwalkTargets()){if(this.maxDepth!==1/0&&e.depth()>=this.maxDepth)continue;i++;let t=e.readdirSync();this.walkCB3Sync(e,t,n,a)}a()}walkCB3Sync(e,t,n,r){n=n.filterEntries(e,t);let i=1,a=()=>{--i===0&&r()};for(let[e,t,r]of n.matches.entries())this.#ignored(e)||this.matchSync(e,t,r);for(let[e,t]of n.subwalks.entries())i++,this.walkCB2Sync(e,t,n.child(),a);a()}}exports.GlobUtil=GlobUtil;class GlobWalker extends GlobUtil{matches=new Set;constructor(e,t,n){super(e,t,n)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,t)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?t(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}}exports.GlobWalker=GlobWalker;class GlobStream extends GlobUtil{results;constructor(t,n,r){super(t,n,r),this.results=new minipass_1.Minipass({signal:this.signal,objectMode:!0}),this.results.on(`drain`,()=>this.resume()),this.results.on(`resume`,()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}exports.GlobStream=GlobStream;