Socket
Book a DemoSign in
Socket

nf3

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nf3 - npm Package Compare versions

Comparing version
0.3.11
to
0.3.12
+1
dist/node_modules/.nf3/minipass@7.1.2/dist/commonjs/index.js
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,`__esModule`,{value:!0}),exports.Minipass=exports.isWritable=exports.isReadable=exports.isStream=void 0;const proc=typeof process==`object`&&process?process:{stdout:null,stderr:null},node_events_1=require(`node:events`),node_stream_1=__importDefault(require(`node:stream`)),node_string_decoder_1=require(`node:string_decoder`),isStream=e=>!!e&&typeof e==`object`&&(e instanceof Minipass||e instanceof node_stream_1.default||(0,exports.isReadable)(e)||(0,exports.isWritable)(e));exports.isStream=isStream;const isReadable=e=>!!e&&typeof e==`object`&&e instanceof node_events_1.EventEmitter&&typeof e.pipe==`function`&&e.pipe!==node_stream_1.default.Writable.prototype.pipe;exports.isReadable=isReadable;const isWritable=e=>!!e&&typeof e==`object`&&e instanceof node_events_1.EventEmitter&&typeof e.write==`function`&&typeof e.end==`function`;exports.isWritable=isWritable;const EOF=Symbol(`EOF`),MAYBE_EMIT_END=Symbol(`maybeEmitEnd`),EMITTED_END=Symbol(`emittedEnd`),EMITTING_END=Symbol(`emittingEnd`),EMITTED_ERROR=Symbol(`emittedError`),CLOSED=Symbol(`closed`),READ=Symbol(`read`),FLUSH=Symbol(`flush`),FLUSHCHUNK=Symbol(`flushChunk`),ENCODING=Symbol(`encoding`),DECODER=Symbol(`decoder`),FLOWING=Symbol(`flowing`),PAUSED=Symbol(`paused`),RESUME=Symbol(`resume`),BUFFER=Symbol(`buffer`),PIPES=Symbol(`pipes`),BUFFERLENGTH=Symbol(`bufferLength`),BUFFERPUSH=Symbol(`bufferPush`),BUFFERSHIFT=Symbol(`bufferShift`),OBJECTMODE=Symbol(`objectMode`),DESTROYED=Symbol(`destroyed`),ERROR=Symbol(`error`),EMITDATA=Symbol(`emitData`),EMITEND=Symbol(`emitEnd`),EMITEND2=Symbol(`emitEnd2`),ASYNC=Symbol(`async`),ABORT=Symbol(`abort`),ABORTED=Symbol(`aborted`),SIGNAL=Symbol(`signal`),DATALISTENERS=Symbol(`dataListeners`),DISCARDED=Symbol(`discarded`),defer=e=>Promise.resolve().then(e),nodefer=e=>e(),isEndish=e=>e===`end`||e===`finish`||e===`prefinish`,isArrayBufferLike=e=>e instanceof ArrayBuffer||!!e&&typeof e==`object`&&e.constructor&&e.constructor.name===`ArrayBuffer`&&e.byteLength>=0,isArrayBufferView=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e);class Pipe{src;dest;opts;ondrain;constructor(e,t,n){this.src=e,this.dest=t,this.opts=n,this.ondrain=()=>e[RESUME](),this.dest.on(`drain`,this.ondrain)}unpipe(){this.dest.removeListener(`drain`,this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}}class PipeProxyErrors extends Pipe{unpipe(){this.src.removeListener(`error`,this.proxyErrors),super.unpipe()}constructor(e,t,n){super(e,t,n),this.proxyErrors=e=>t.emit(`error`,e),e.on(`error`,this.proxyErrors)}}const isObjectModeOptions=e=>!!e.objectMode,isEncodingOptions=e=>!e.objectMode&&!!e.encoding&&e.encoding!==`buffer`;class Minipass extends node_events_1.EventEmitter{[FLOWING]=!1;[PAUSED]=!1;[PIPES]=[];[BUFFER]=[];[OBJECTMODE];[ENCODING];[ASYNC];[DECODER];[EOF]=!1;[EMITTED_END]=!1;[EMITTING_END]=!1;[CLOSED]=!1;[EMITTED_ERROR]=null;[BUFFERLENGTH]=0;[DESTROYED]=!1;[SIGNAL];[ABORTED]=!1;[DATALISTENERS]=0;[DISCARDED]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding==`string`)throw TypeError(`Encoding and objectMode may not be used together`);isObjectModeOptions(t)?(this[OBJECTMODE]=!0,this[ENCODING]=null):isEncodingOptions(t)?(this[ENCODING]=t.encoding,this[OBJECTMODE]=!1):(this[OBJECTMODE]=!1,this[ENCODING]=null),this[ASYNC]=!!t.async,this[DECODER]=this[ENCODING]?new node_string_decoder_1.StringDecoder(this[ENCODING]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,`buffer`,{get:()=>this[BUFFER]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,`pipes`,{get:()=>this[PIPES]});let{signal:n}=t;n&&(this[SIGNAL]=n,n.aborted?this[ABORT]():n.addEventListener(`abort`,()=>this[ABORT]()))}get bufferLength(){return this[BUFFERLENGTH]}get encoding(){return this[ENCODING]}set encoding(e){throw Error(`Encoding must be set at instantiation time`)}setEncoding(e){throw Error(`Encoding must be set at instantiation time`)}get objectMode(){return this[OBJECTMODE]}set objectMode(e){throw Error(`objectMode must be set at instantiation time`)}get async(){return this[ASYNC]}set async(e){this[ASYNC]=this[ASYNC]||!!e}[ABORT](){this[ABORTED]=!0,this.emit(`abort`,this[SIGNAL]?.reason),this.destroy(this[SIGNAL]?.reason)}get aborted(){return this[ABORTED]}set aborted(e){}write(e,t,n){if(this[ABORTED])return!1;if(this[EOF])throw Error(`write after end`);if(this[DESTROYED])return this.emit(`error`,Object.assign(Error(`Cannot call write after a stream was destroyed`),{code:`ERR_STREAM_DESTROYED`})),!0;typeof t==`function`&&(n=t,t=`utf8`),t||=`utf8`;let r=this[ASYNC]?defer:nodefer;if(!this[OBJECTMODE]&&!Buffer.isBuffer(e)){if(isArrayBufferView(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(isArrayBufferLike(e))e=Buffer.from(e);else if(typeof e!=`string`)throw Error(`Non-contiguous data written to non-objectMode stream`)}return this[OBJECTMODE]?(this[FLOWING]&&this[BUFFERLENGTH]!==0&&this[FLUSH](!0),this[FLOWING]?this.emit(`data`,e):this[BUFFERPUSH](e),this[BUFFERLENGTH]!==0&&this.emit(`readable`),n&&r(n),this[FLOWING]):e.length?(typeof e==`string`&&!(t===this[ENCODING]&&!this[DECODER]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[ENCODING]&&(e=this[DECODER].write(e)),this[FLOWING]&&this[BUFFERLENGTH]!==0&&this[FLUSH](!0),this[FLOWING]?this.emit(`data`,e):this[BUFFERPUSH](e),this[BUFFERLENGTH]!==0&&this.emit(`readable`),n&&r(n),this[FLOWING]):(this[BUFFERLENGTH]!==0&&this.emit(`readable`),n&&r(n),this[FLOWING])}read(e){if(this[DESTROYED])return null;if(this[DISCARDED]=!1,this[BUFFERLENGTH]===0||e===0||e&&e>this[BUFFERLENGTH])return this[MAYBE_EMIT_END](),null;this[OBJECTMODE]&&(e=null),this[BUFFER].length>1&&!this[OBJECTMODE]&&(this[BUFFER]=[this[ENCODING]?this[BUFFER].join(``):Buffer.concat(this[BUFFER],this[BUFFERLENGTH])]);let t=this[READ](e||null,this[BUFFER][0]);return this[MAYBE_EMIT_END](),t}[READ](e,t){if(this[OBJECTMODE])this[BUFFERSHIFT]();else{let n=t;e===n.length||e===null?this[BUFFERSHIFT]():typeof n==`string`?(this[BUFFER][0]=n.slice(e),t=n.slice(0,e),this[BUFFERLENGTH]-=e):(this[BUFFER][0]=n.subarray(e),t=n.subarray(0,e),this[BUFFERLENGTH]-=e)}return this.emit(`data`,t),!this[BUFFER].length&&!this[EOF]&&this.emit(`drain`),t}end(e,t,n){return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=`utf8`),e!==void 0&&this.write(e,t),n&&this.once(`end`,n),this[EOF]=!0,this.writable=!1,(this[FLOWING]||!this[PAUSED])&&this[MAYBE_EMIT_END](),this}[RESUME](){this[DESTROYED]||(!this[DATALISTENERS]&&!this[PIPES].length&&(this[DISCARDED]=!0),this[PAUSED]=!1,this[FLOWING]=!0,this.emit(`resume`),this[BUFFER].length?this[FLUSH]():this[EOF]?this[MAYBE_EMIT_END]():this.emit(`drain`))}resume(){return this[RESUME]()}pause(){this[FLOWING]=!1,this[PAUSED]=!0,this[DISCARDED]=!1}get destroyed(){return this[DESTROYED]}get flowing(){return this[FLOWING]}get paused(){return this[PAUSED]}[BUFFERPUSH](e){this[OBJECTMODE]?this[BUFFERLENGTH]+=1:this[BUFFERLENGTH]+=e.length,this[BUFFER].push(e)}[BUFFERSHIFT](){return this[OBJECTMODE]?--this[BUFFERLENGTH]:this[BUFFERLENGTH]-=this[BUFFER][0].length,this[BUFFER].shift()}[FLUSH](e=!1){do;while(this[FLUSHCHUNK](this[BUFFERSHIFT]())&&this[BUFFER].length);!e&&!this[BUFFER].length&&!this[EOF]&&this.emit(`drain`)}[FLUSHCHUNK](e){return this.emit(`data`,e),this[FLOWING]}pipe(e,n){if(this[DESTROYED])return e;this[DISCARDED]=!1;let r=this[EMITTED_END];return n||={},e===proc.stdout||e===proc.stderr?n.end=!1:n.end=n.end!==!1,n.proxyErrors=!!n.proxyErrors,r?n.end&&e.end():(this[PIPES].push(n.proxyErrors?new PipeProxyErrors(this,e,n):new Pipe(this,e,n)),this[ASYNC]?defer(()=>this[RESUME]()):this[RESUME]()),e}unpipe(e){let t=this[PIPES].find(t=>t.dest===e);t&&(this[PIPES].length===1?(this[FLOWING]&&this[DATALISTENERS]===0&&(this[FLOWING]=!1),this[PIPES]=[]):this[PIPES].splice(this[PIPES].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let n=super.on(e,t);if(e===`data`)this[DISCARDED]=!1,this[DATALISTENERS]++,!this[PIPES].length&&!this[FLOWING]&&this[RESUME]();else if(e===`readable`&&this[BUFFERLENGTH]!==0)super.emit(`readable`);else if(isEndish(e)&&this[EMITTED_END])super.emit(e),this.removeAllListeners(e);else if(e===`error`&&this[EMITTED_ERROR]){let e=t;this[ASYNC]?defer(()=>e.call(this,this[EMITTED_ERROR])):e.call(this,this[EMITTED_ERROR])}return n}removeListener(e,t){return this.off(e,t)}off(e,t){let n=super.off(e,t);return e===`data`&&(this[DATALISTENERS]=this.listeners(`data`).length,this[DATALISTENERS]===0&&!this[DISCARDED]&&!this[PIPES].length&&(this[FLOWING]=!1)),n}removeAllListeners(e){let t=super.removeAllListeners(e);return(e===`data`||e===void 0)&&(this[DATALISTENERS]=0,!this[DISCARDED]&&!this[PIPES].length&&(this[FLOWING]=!1)),t}get emittedEnd(){return this[EMITTED_END]}[MAYBE_EMIT_END](){!this[EMITTING_END]&&!this[EMITTED_END]&&!this[DESTROYED]&&this[BUFFER].length===0&&this[EOF]&&(this[EMITTING_END]=!0,this.emit(`end`),this.emit(`prefinish`),this.emit(`finish`),this[CLOSED]&&this.emit(`close`),this[EMITTING_END]=!1)}emit(e,...t){let n=t[0];if(e!==`error`&&e!==`close`&&e!==DESTROYED&&this[DESTROYED])return!1;if(e===`data`)return!this[OBJECTMODE]&&!n?!1:this[ASYNC]?(defer(()=>this[EMITDATA](n)),!0):this[EMITDATA](n);if(e===`end`)return this[EMITEND]();if(e===`close`){if(this[CLOSED]=!0,!this[EMITTED_END]&&!this[DESTROYED])return!1;let e=super.emit(`close`);return this.removeAllListeners(`close`),e}else if(e===`error`){this[EMITTED_ERROR]=n,super.emit(ERROR,n);let e=!this[SIGNAL]||this.listeners(`error`).length?super.emit(`error`,n):!1;return this[MAYBE_EMIT_END](),e}else if(e===`resume`){let e=super.emit(`resume`);return this[MAYBE_EMIT_END](),e}else if(e===`finish`||e===`prefinish`){let t=super.emit(e);return this.removeAllListeners(e),t}let r=super.emit(e,...t);return this[MAYBE_EMIT_END](),r}[EMITDATA](e){for(let t of this[PIPES])t.dest.write(e)===!1&&this.pause();let t=this[DISCARDED]?!1:super.emit(`data`,e);return this[MAYBE_EMIT_END](),t}[EMITEND](){return this[EMITTED_END]?!1:(this[EMITTED_END]=!0,this.readable=!1,this[ASYNC]?(defer(()=>this[EMITEND2]()),!0):this[EMITEND2]())}[EMITEND2](){if(this[DECODER]){let e=this[DECODER].end();if(e){for(let t of this[PIPES])t.dest.write(e);this[DISCARDED]||super.emit(`data`,e)}}for(let e of this[PIPES])e.end();let e=super.emit(`end`);return this.removeAllListeners(`end`),e}async collect(){let e=Object.assign([],{dataLength:0});this[OBJECTMODE]||(e.dataLength=0);let t=this.promise();return this.on(`data`,t=>{e.push(t),this[OBJECTMODE]||(e.dataLength+=t.length)}),await t,e}async concat(){if(this[OBJECTMODE])throw Error(`cannot concat in objectMode`);let e=await this.collect();return this[ENCODING]?e.join(``):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(DESTROYED,()=>t(Error(`stream destroyed`))),this.on(`error`,e=>t(e)),this.on(`end`,()=>e())})}[Symbol.asyncIterator](){this[DISCARDED]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let n=this.read();if(n!==null)return Promise.resolve({done:!1,value:n});if(this[EOF])return t();let r,i,a=e=>{this.off(`data`,o),this.off(`end`,s),this.off(DESTROYED,c),t(),i(e)},o=e=>{this.off(`error`,a),this.off(`end`,s),this.off(DESTROYED,c),this.pause(),r({value:e,done:!!this[EOF]})},s=()=>{this.off(`error`,a),this.off(`data`,o),this.off(DESTROYED,c),t(),r({done:!0,value:void 0})},c=()=>a(Error(`stream destroyed`));return new Promise((e,t)=>{i=t,r=e,this.once(DESTROYED,c),this.once(`error`,a),this.once(`end`,s),this.once(`data`,o)})},throw:t,return:t,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[DISCARDED]=!1;let e=!1,t=()=>(this.pause(),this.off(ERROR,t),this.off(DESTROYED,t),this.off(`end`,t),e=!0,{done:!0,value:void 0});return this.once(`end`,t),this.once(ERROR,t),this.once(DESTROYED,t),{next:()=>{if(e)return t();let n=this.read();return n===null?t():{done:!1,value:n}},throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){if(this[DESTROYED])return e?this.emit(`error`,e):this.emit(DESTROYED),this;this[DESTROYED]=!0,this[DISCARDED]=!0,this[BUFFER].length=0,this[BUFFERLENGTH]=0;let t=this;return typeof t.close==`function`&&!this[CLOSED]&&t.close(),e?this.emit(`error`,e):this.emit(DESTROYED),this}static get isStream(){return exports.isStream}}exports.Minipass=Minipass;
{
"name": "minipass",
"version": "7.1.2",
"main": "./dist/commonjs/index.js",
"type": "module",
"exports": {
"./package.json": "./package.json",
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/commonjs/index.d.ts",
"default": "./dist/commonjs/index.js"
}
}
}
}
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,`__esModule`,{value:!0}),exports.Minipass=exports.isWritable=exports.isReadable=exports.isStream=void 0;const proc=typeof process==`object`&&process?process:{stdout:null,stderr:null},node_events_1=require(`node:events`),node_stream_1=__importDefault(require(`node:stream`)),node_string_decoder_1=require(`node:string_decoder`),isStream=e=>!!e&&typeof e==`object`&&(e instanceof Minipass||e instanceof node_stream_1.default||(0,exports.isReadable)(e)||(0,exports.isWritable)(e));exports.isStream=isStream;const isReadable=e=>!!e&&typeof e==`object`&&e instanceof node_events_1.EventEmitter&&typeof e.pipe==`function`&&e.pipe!==node_stream_1.default.Writable.prototype.pipe;exports.isReadable=isReadable;const isWritable=e=>!!e&&typeof e==`object`&&e instanceof node_events_1.EventEmitter&&typeof e.write==`function`&&typeof e.end==`function`;exports.isWritable=isWritable;const EOF=Symbol(`EOF`),MAYBE_EMIT_END=Symbol(`maybeEmitEnd`),EMITTED_END=Symbol(`emittedEnd`),EMITTING_END=Symbol(`emittingEnd`),EMITTED_ERROR=Symbol(`emittedError`),CLOSED=Symbol(`closed`),READ=Symbol(`read`),FLUSH=Symbol(`flush`),FLUSHCHUNK=Symbol(`flushChunk`),ENCODING=Symbol(`encoding`),DECODER=Symbol(`decoder`),FLOWING=Symbol(`flowing`),PAUSED=Symbol(`paused`),RESUME=Symbol(`resume`),BUFFER=Symbol(`buffer`),PIPES=Symbol(`pipes`),BUFFERLENGTH=Symbol(`bufferLength`),BUFFERPUSH=Symbol(`bufferPush`),BUFFERSHIFT=Symbol(`bufferShift`),OBJECTMODE=Symbol(`objectMode`),DESTROYED=Symbol(`destroyed`),ERROR=Symbol(`error`),EMITDATA=Symbol(`emitData`),EMITEND=Symbol(`emitEnd`),EMITEND2=Symbol(`emitEnd2`),ASYNC=Symbol(`async`),ABORT=Symbol(`abort`),ABORTED=Symbol(`aborted`),SIGNAL=Symbol(`signal`),DATALISTENERS=Symbol(`dataListeners`),DISCARDED=Symbol(`discarded`),defer=e=>Promise.resolve().then(e),nodefer=e=>e(),isEndish=e=>e===`end`||e===`finish`||e===`prefinish`,isArrayBufferLike=e=>e instanceof ArrayBuffer||!!e&&typeof e==`object`&&e.constructor&&e.constructor.name===`ArrayBuffer`&&e.byteLength>=0,isArrayBufferView=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e);class Pipe{src;dest;opts;ondrain;constructor(e,t,n){this.src=e,this.dest=t,this.opts=n,this.ondrain=()=>e[RESUME](),this.dest.on(`drain`,this.ondrain)}unpipe(){this.dest.removeListener(`drain`,this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}}class PipeProxyErrors extends Pipe{unpipe(){this.src.removeListener(`error`,this.proxyErrors),super.unpipe()}constructor(e,t,n){super(e,t,n),this.proxyErrors=e=>this.dest.emit(`error`,e),e.on(`error`,this.proxyErrors)}}const isObjectModeOptions=e=>!!e.objectMode,isEncodingOptions=e=>!e.objectMode&&!!e.encoding&&e.encoding!==`buffer`;class Minipass extends node_events_1.EventEmitter{[FLOWING]=!1;[PAUSED]=!1;[PIPES]=[];[BUFFER]=[];[OBJECTMODE];[ENCODING];[ASYNC];[DECODER];[EOF]=!1;[EMITTED_END]=!1;[EMITTING_END]=!1;[CLOSED]=!1;[EMITTED_ERROR]=null;[BUFFERLENGTH]=0;[DESTROYED]=!1;[SIGNAL];[ABORTED]=!1;[DATALISTENERS]=0;[DISCARDED]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&typeof t.encoding==`string`)throw TypeError(`Encoding and objectMode may not be used together`);isObjectModeOptions(t)?(this[OBJECTMODE]=!0,this[ENCODING]=null):isEncodingOptions(t)?(this[ENCODING]=t.encoding,this[OBJECTMODE]=!1):(this[OBJECTMODE]=!1,this[ENCODING]=null),this[ASYNC]=!!t.async,this[DECODER]=this[ENCODING]?new node_string_decoder_1.StringDecoder(this[ENCODING]):null,t&&t.debugExposeBuffer===!0&&Object.defineProperty(this,`buffer`,{get:()=>this[BUFFER]}),t&&t.debugExposePipes===!0&&Object.defineProperty(this,`pipes`,{get:()=>this[PIPES]});let{signal:n}=t;n&&(this[SIGNAL]=n,n.aborted?this[ABORT]():n.addEventListener(`abort`,()=>this[ABORT]()))}get bufferLength(){return this[BUFFERLENGTH]}get encoding(){return this[ENCODING]}set encoding(e){throw Error(`Encoding must be set at instantiation time`)}setEncoding(e){throw Error(`Encoding must be set at instantiation time`)}get objectMode(){return this[OBJECTMODE]}set objectMode(e){throw Error(`objectMode must be set at instantiation time`)}get async(){return this[ASYNC]}set async(e){this[ASYNC]=this[ASYNC]||!!e}[ABORT](){this[ABORTED]=!0,this.emit(`abort`,this[SIGNAL]?.reason),this.destroy(this[SIGNAL]?.reason)}get aborted(){return this[ABORTED]}set aborted(e){}write(e,t,n){if(this[ABORTED])return!1;if(this[EOF])throw Error(`write after end`);if(this[DESTROYED])return this.emit(`error`,Object.assign(Error(`Cannot call write after a stream was destroyed`),{code:`ERR_STREAM_DESTROYED`})),!0;typeof t==`function`&&(n=t,t=`utf8`),t||=`utf8`;let r=this[ASYNC]?defer:nodefer;if(!this[OBJECTMODE]&&!Buffer.isBuffer(e)){if(isArrayBufferView(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(isArrayBufferLike(e))e=Buffer.from(e);else if(typeof e!=`string`)throw Error(`Non-contiguous data written to non-objectMode stream`)}return this[OBJECTMODE]?(this[FLOWING]&&this[BUFFERLENGTH]!==0&&this[FLUSH](!0),this[FLOWING]?this.emit(`data`,e):this[BUFFERPUSH](e),this[BUFFERLENGTH]!==0&&this.emit(`readable`),n&&r(n),this[FLOWING]):e.length?(typeof e==`string`&&!(t===this[ENCODING]&&!this[DECODER]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[ENCODING]&&(e=this[DECODER].write(e)),this[FLOWING]&&this[BUFFERLENGTH]!==0&&this[FLUSH](!0),this[FLOWING]?this.emit(`data`,e):this[BUFFERPUSH](e),this[BUFFERLENGTH]!==0&&this.emit(`readable`),n&&r(n),this[FLOWING]):(this[BUFFERLENGTH]!==0&&this.emit(`readable`),n&&r(n),this[FLOWING])}read(e){if(this[DESTROYED])return null;if(this[DISCARDED]=!1,this[BUFFERLENGTH]===0||e===0||e&&e>this[BUFFERLENGTH])return this[MAYBE_EMIT_END](),null;this[OBJECTMODE]&&(e=null),this[BUFFER].length>1&&!this[OBJECTMODE]&&(this[BUFFER]=[this[ENCODING]?this[BUFFER].join(``):Buffer.concat(this[BUFFER],this[BUFFERLENGTH])]);let t=this[READ](e||null,this[BUFFER][0]);return this[MAYBE_EMIT_END](),t}[READ](e,t){if(this[OBJECTMODE])this[BUFFERSHIFT]();else{let n=t;e===n.length||e===null?this[BUFFERSHIFT]():typeof n==`string`?(this[BUFFER][0]=n.slice(e),t=n.slice(0,e),this[BUFFERLENGTH]-=e):(this[BUFFER][0]=n.subarray(e),t=n.subarray(0,e),this[BUFFERLENGTH]-=e)}return this.emit(`data`,t),!this[BUFFER].length&&!this[EOF]&&this.emit(`drain`),t}end(e,t,n){return typeof e==`function`&&(n=e,e=void 0),typeof t==`function`&&(n=t,t=`utf8`),e!==void 0&&this.write(e,t),n&&this.once(`end`,n),this[EOF]=!0,this.writable=!1,(this[FLOWING]||!this[PAUSED])&&this[MAYBE_EMIT_END](),this}[RESUME](){this[DESTROYED]||(!this[DATALISTENERS]&&!this[PIPES].length&&(this[DISCARDED]=!0),this[PAUSED]=!1,this[FLOWING]=!0,this.emit(`resume`),this[BUFFER].length?this[FLUSH]():this[EOF]?this[MAYBE_EMIT_END]():this.emit(`drain`))}resume(){return this[RESUME]()}pause(){this[FLOWING]=!1,this[PAUSED]=!0,this[DISCARDED]=!1}get destroyed(){return this[DESTROYED]}get flowing(){return this[FLOWING]}get paused(){return this[PAUSED]}[BUFFERPUSH](e){this[OBJECTMODE]?this[BUFFERLENGTH]+=1:this[BUFFERLENGTH]+=e.length,this[BUFFER].push(e)}[BUFFERSHIFT](){return this[OBJECTMODE]?--this[BUFFERLENGTH]:this[BUFFERLENGTH]-=this[BUFFER][0].length,this[BUFFER].shift()}[FLUSH](e=!1){do;while(this[FLUSHCHUNK](this[BUFFERSHIFT]())&&this[BUFFER].length);!e&&!this[BUFFER].length&&!this[EOF]&&this.emit(`drain`)}[FLUSHCHUNK](e){return this.emit(`data`,e),this[FLOWING]}pipe(e,n){if(this[DESTROYED])return e;this[DISCARDED]=!1;let r=this[EMITTED_END];return n||={},e===proc.stdout||e===proc.stderr?n.end=!1:n.end=n.end!==!1,n.proxyErrors=!!n.proxyErrors,r?n.end&&e.end():(this[PIPES].push(n.proxyErrors?new PipeProxyErrors(this,e,n):new Pipe(this,e,n)),this[ASYNC]?defer(()=>this[RESUME]()):this[RESUME]()),e}unpipe(e){let t=this[PIPES].find(t=>t.dest===e);t&&(this[PIPES].length===1?(this[FLOWING]&&this[DATALISTENERS]===0&&(this[FLOWING]=!1),this[PIPES]=[]):this[PIPES].splice(this[PIPES].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let n=super.on(e,t);if(e===`data`)this[DISCARDED]=!1,this[DATALISTENERS]++,!this[PIPES].length&&!this[FLOWING]&&this[RESUME]();else if(e===`readable`&&this[BUFFERLENGTH]!==0)super.emit(`readable`);else if(isEndish(e)&&this[EMITTED_END])super.emit(e),this.removeAllListeners(e);else if(e===`error`&&this[EMITTED_ERROR]){let e=t;this[ASYNC]?defer(()=>e.call(this,this[EMITTED_ERROR])):e.call(this,this[EMITTED_ERROR])}return n}removeListener(e,t){return this.off(e,t)}off(e,t){let n=super.off(e,t);return e===`data`&&(this[DATALISTENERS]=this.listeners(`data`).length,this[DATALISTENERS]===0&&!this[DISCARDED]&&!this[PIPES].length&&(this[FLOWING]=!1)),n}removeAllListeners(e){let t=super.removeAllListeners(e);return(e===`data`||e===void 0)&&(this[DATALISTENERS]=0,!this[DISCARDED]&&!this[PIPES].length&&(this[FLOWING]=!1)),t}get emittedEnd(){return this[EMITTED_END]}[MAYBE_EMIT_END](){!this[EMITTING_END]&&!this[EMITTED_END]&&!this[DESTROYED]&&this[BUFFER].length===0&&this[EOF]&&(this[EMITTING_END]=!0,this.emit(`end`),this.emit(`prefinish`),this.emit(`finish`),this[CLOSED]&&this.emit(`close`),this[EMITTING_END]=!1)}emit(e,...t){let n=t[0];if(e!==`error`&&e!==`close`&&e!==DESTROYED&&this[DESTROYED])return!1;if(e===`data`)return!this[OBJECTMODE]&&!n?!1:this[ASYNC]?(defer(()=>this[EMITDATA](n)),!0):this[EMITDATA](n);if(e===`end`)return this[EMITEND]();if(e===`close`){if(this[CLOSED]=!0,!this[EMITTED_END]&&!this[DESTROYED])return!1;let e=super.emit(`close`);return this.removeAllListeners(`close`),e}else if(e===`error`){this[EMITTED_ERROR]=n,super.emit(ERROR,n);let e=!this[SIGNAL]||this.listeners(`error`).length?super.emit(`error`,n):!1;return this[MAYBE_EMIT_END](),e}else if(e===`resume`){let e=super.emit(`resume`);return this[MAYBE_EMIT_END](),e}else if(e===`finish`||e===`prefinish`){let t=super.emit(e);return this.removeAllListeners(e),t}let r=super.emit(e,...t);return this[MAYBE_EMIT_END](),r}[EMITDATA](e){for(let t of this[PIPES])t.dest.write(e)===!1&&this.pause();let t=this[DISCARDED]?!1:super.emit(`data`,e);return this[MAYBE_EMIT_END](),t}[EMITEND](){return this[EMITTED_END]?!1:(this[EMITTED_END]=!0,this.readable=!1,this[ASYNC]?(defer(()=>this[EMITEND2]()),!0):this[EMITEND2]())}[EMITEND2](){if(this[DECODER]){let e=this[DECODER].end();if(e){for(let t of this[PIPES])t.dest.write(e);this[DISCARDED]||super.emit(`data`,e)}}for(let e of this[PIPES])e.end();let e=super.emit(`end`);return this.removeAllListeners(`end`),e}async collect(){let e=Object.assign([],{dataLength:0});this[OBJECTMODE]||(e.dataLength=0);let t=this.promise();return this.on(`data`,t=>{e.push(t),this[OBJECTMODE]||(e.dataLength+=t.length)}),await t,e}async concat(){if(this[OBJECTMODE])throw Error(`cannot concat in objectMode`);let e=await this.collect();return this[ENCODING]?e.join(``):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(DESTROYED,()=>t(Error(`stream destroyed`))),this.on(`error`,e=>t(e)),this.on(`end`,()=>e())})}[Symbol.asyncIterator](){this[DISCARDED]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return t();let n=this.read();if(n!==null)return Promise.resolve({done:!1,value:n});if(this[EOF])return t();let r,i,a=e=>{this.off(`data`,o),this.off(`end`,s),this.off(DESTROYED,c),t(),i(e)},o=e=>{this.off(`error`,a),this.off(`end`,s),this.off(DESTROYED,c),this.pause(),r({value:e,done:!!this[EOF]})},s=()=>{this.off(`error`,a),this.off(`data`,o),this.off(DESTROYED,c),t(),r({done:!0,value:void 0})},c=()=>a(Error(`stream destroyed`));return new Promise((e,t)=>{i=t,r=e,this.once(DESTROYED,c),this.once(`error`,a),this.once(`end`,s),this.once(`data`,o)})},throw:t,return:t,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[DISCARDED]=!1;let e=!1,t=()=>(this.pause(),this.off(ERROR,t),this.off(DESTROYED,t),this.off(`end`,t),e=!0,{done:!0,value:void 0});return this.once(`end`,t),this.once(ERROR,t),this.once(DESTROYED,t),{next:()=>{if(e)return t();let n=this.read();return n===null?t():{done:!1,value:n}},throw:t,return:t,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(e){if(this[DESTROYED])return e?this.emit(`error`,e):this.emit(DESTROYED),this;this[DESTROYED]=!0,this[DISCARDED]=!0,this[BUFFER].length=0,this[BUFFERLENGTH]=0;let t=this;return typeof t.close==`function`&&!this[CLOSED]&&t.close(),e?this.emit(`error`,e):this.emit(DESTROYED),this}static get isStream(){return exports.isStream}}exports.Minipass=Minipass;
{
"name": "minipass",
"version": "7.1.3",
"main": "./dist/commonjs/index.js",
"type": "module",
"exports": {
"./package.json": "./package.json",
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/commonjs/index.d.ts",
"default": "./dist/commonjs/index.js"
}
}
}
}
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,`__esModule`,{value:!0}),exports.WriteStreamSync=exports.WriteStream=exports.ReadStreamSync=exports.ReadStream=void 0;const events_1=__importDefault(require(`events`)),fs_1=__importDefault(require(`fs`)),minipass_1=require(`minipass`),writev=fs_1.default.writev,_autoClose=Symbol(`_autoClose`),_close=Symbol(`_close`),_ended=Symbol(`_ended`),_fd=Symbol(`_fd`),_finished=Symbol(`_finished`),_flags=Symbol(`_flags`),_flush=Symbol(`_flush`),_handleChunk=Symbol(`_handleChunk`),_makeBuf=Symbol(`_makeBuf`),_mode=Symbol(`_mode`),_needDrain=Symbol(`_needDrain`),_onerror=Symbol(`_onerror`),_onopen=Symbol(`_onopen`),_onread=Symbol(`_onread`),_onwrite=Symbol(`_onwrite`),_open=Symbol(`_open`),_path=Symbol(`_path`),_pos=Symbol(`_pos`),_queue=Symbol(`_queue`),_read=Symbol(`_read`),_readSize=Symbol(`_readSize`),_reading=Symbol(`_reading`),_remain=Symbol(`_remain`),_size=Symbol(`_size`),_write=Symbol(`_write`),_writing=Symbol(`_writing`),_defaultFlag=Symbol(`_defaultFlag`),_errored=Symbol(`_errored`);class ReadStream extends minipass_1.Minipass{[_errored]=!1;[_fd];[_path];[_readSize];[_reading]=!1;[_size];[_remain];[_autoClose];constructor(e,t){if(t||={},super(t),this.readable=!0,this.writable=!1,typeof e!=`string`)throw TypeError(`path must be a string`);this[_errored]=!1,this[_fd]=typeof t.fd==`number`?t.fd:void 0,this[_path]=e,this[_readSize]=t.readSize||16*1024*1024,this[_reading]=!1,this[_size]=typeof t.size==`number`?t.size:1/0,this[_remain]=this[_size],this[_autoClose]=typeof t.autoClose==`boolean`?t.autoClose:!0,typeof this[_fd]==`number`?this[_read]():this[_open]()}get fd(){return this[_fd]}get path(){return this[_path]}write(){throw TypeError(`this is a readable stream`)}end(){throw TypeError(`this is a readable stream`)}[_open](){fs_1.default.open(this[_path],`r`,(e,t)=>this[_onopen](e,t))}[_onopen](e,t){e?this[_onerror](e):(this[_fd]=t,this.emit(`open`,t),this[_read]())}[_makeBuf](){return Buffer.allocUnsafe(Math.min(this[_readSize],this[_remain]))}[_read](){if(!this[_reading]){this[_reading]=!0;let e=this[_makeBuf]();if(e.length===0)return process.nextTick(()=>this[_onread](null,0,e));fs_1.default.read(this[_fd],e,0,e.length,null,(e,t,n)=>this[_onread](e,t,n))}}[_onread](e,t,n){this[_reading]=!1,e?this[_onerror](e):this[_handleChunk](t,n)&&this[_read]()}[_close](){if(this[_autoClose]&&typeof this[_fd]==`number`){let e=this[_fd];this[_fd]=void 0,fs_1.default.close(e,e=>e?this.emit(`error`,e):this.emit(`close`))}}[_onerror](e){this[_reading]=!0,this[_close](),this.emit(`error`,e)}[_handleChunk](e,t){let n=!1;return this[_remain]-=e,e>0&&(n=super.write(e<t.length?t.subarray(0,e):t)),(e===0||this[_remain]<=0)&&(n=!1,this[_close](),super.end()),n}emit(e,...t){switch(e){case`prefinish`:case`finish`:return!1;case`drain`:return typeof this[_fd]==`number`&&this[_read](),!1;case`error`:return this[_errored]?!1:(this[_errored]=!0,super.emit(e,...t));default:return super.emit(e,...t)}}}exports.ReadStream=ReadStream;class ReadStreamSync extends ReadStream{[_open](){let e=!0;try{this[_onopen](null,fs_1.default.openSync(this[_path],`r`)),e=!1}finally{e&&this[_close]()}}[_read](){let e=!0;try{if(!this[_reading]){this[_reading]=!0;do{let e=this[_makeBuf](),t=e.length===0?0:fs_1.default.readSync(this[_fd],e,0,e.length,null);if(!this[_handleChunk](t,e))break}while(!0);this[_reading]=!1}e=!1}finally{e&&this[_close]()}}[_close](){if(this[_autoClose]&&typeof this[_fd]==`number`){let e=this[_fd];this[_fd]=void 0,fs_1.default.closeSync(e),this.emit(`close`)}}}exports.ReadStreamSync=ReadStreamSync;class WriteStream extends events_1.default{readable=!1;writable=!0;[_errored]=!1;[_writing]=!1;[_ended]=!1;[_queue]=[];[_needDrain]=!1;[_path];[_mode];[_autoClose];[_fd];[_defaultFlag];[_flags];[_finished]=!1;[_pos];constructor(e,t){t||={},super(t),this[_path]=e,this[_fd]=typeof t.fd==`number`?t.fd:void 0,this[_mode]=t.mode===void 0?438:t.mode,this[_pos]=typeof t.start==`number`?t.start:void 0,this[_autoClose]=typeof t.autoClose==`boolean`?t.autoClose:!0;let n=this[_pos]===void 0?`w`:`r+`;this[_defaultFlag]=t.flags===void 0,this[_flags]=t.flags===void 0?n:t.flags,this[_fd]===void 0&&this[_open]()}emit(e,...t){if(e===`error`){if(this[_errored])return!1;this[_errored]=!0}return super.emit(e,...t)}get fd(){return this[_fd]}get path(){return this[_path]}[_onerror](e){this[_close](),this[_writing]=!0,this.emit(`error`,e)}[_open](){fs_1.default.open(this[_path],this[_flags],this[_mode],(e,t)=>this[_onopen](e,t))}[_onopen](e,t){this[_defaultFlag]&&this[_flags]===`r+`&&e&&e.code===`ENOENT`?(this[_flags]=`w`,this[_open]()):e?this[_onerror](e):(this[_fd]=t,this.emit(`open`,t),this[_writing]||this[_flush]())}end(e,t){return e&&this.write(e,t),this[_ended]=!0,!this[_writing]&&!this[_queue].length&&typeof this[_fd]==`number`&&this[_onwrite](null,0),this}write(e,t){return typeof e==`string`&&(e=Buffer.from(e,t)),this[_ended]?(this.emit(`error`,Error(`write() after end()`)),!1):this[_fd]===void 0||this[_writing]||this[_queue].length?(this[_queue].push(e),this[_needDrain]=!0,!1):(this[_writing]=!0,this[_write](e),!0)}[_write](e){fs_1.default.write(this[_fd],e,0,e.length,this[_pos],(e,t)=>this[_onwrite](e,t))}[_onwrite](e,t){e?this[_onerror](e):(this[_pos]!==void 0&&typeof t==`number`&&(this[_pos]+=t),this[_queue].length?this[_flush]():(this[_writing]=!1,this[_ended]&&!this[_finished]?(this[_finished]=!0,this[_close](),this.emit(`finish`)):this[_needDrain]&&(this[_needDrain]=!1,this.emit(`drain`))))}[_flush](){if(this[_queue].length===0)this[_ended]&&this[_onwrite](null,0);else if(this[_queue].length===1)this[_write](this[_queue].pop());else{let e=this[_queue];this[_queue]=[],writev(this[_fd],e,this[_pos],(e,t)=>this[_onwrite](e,t))}}[_close](){if(this[_autoClose]&&typeof this[_fd]==`number`){let e=this[_fd];this[_fd]=void 0,fs_1.default.close(e,e=>e?this.emit(`error`,e):this.emit(`close`))}}}exports.WriteStream=WriteStream;class WriteStreamSync extends WriteStream{[_open](){let e;if(this[_defaultFlag]&&this[_flags]===`r+`)try{e=fs_1.default.openSync(this[_path],this[_flags],this[_mode])}catch(e){if(e?.code===`ENOENT`)return this[_flags]=`w`,this[_open]();throw e}else e=fs_1.default.openSync(this[_path],this[_flags],this[_mode]);this[_onopen](null,e)}[_close](){if(this[_autoClose]&&typeof this[_fd]==`number`){let e=this[_fd];this[_fd]=void 0,fs_1.default.closeSync(e),this.emit(`close`)}}[_write](e){let t=!0;try{this[_onwrite](null,fs_1.default.writeSync(this[_fd],e,0,e.length,this[_pos])),t=!1}finally{if(t)try{this[_close]()}catch{}}}}exports.WriteStreamSync=WriteStreamSync;
{
"name": "@isaacs/fs-minipass",
"version": "4.0.1",
"main": "./dist/commonjs/index.js",
"exports": {
"./package.json": "./package.json",
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/commonjs/index.d.ts",
"default": "./dist/commonjs/index.js"
}
}
},
"type": "module"
}
+196
-196

@@ -1,3 +0,3 @@

import e, { lstatSync as t, realpathSync as n, statSync as r } from "node:fs";
import { URL as i, fileURLToPath as a, pathToFileURL as o } from "node:url";
import { URL as e, fileURLToPath as t, pathToFileURL as n } from "node:url";
import r, { lstatSync as i, realpathSync as a, statSync as o } from "node:fs";
import s, { isAbsolute as c } from "node:path";

@@ -108,8 +108,8 @@ import l from "node:assert";

const A = {}.hasOwnProperty, j = /* @__PURE__ */ new Map();
function M(t, { base: n, specifier: r }) {
let i = j.get(t);
if (i) return i;
function M(e, { base: n, specifier: i }) {
let a = j.get(e);
if (a) return a;
let o;
try {
o = e.readFileSync(s.toNamespacedPath(t), `utf8`);
o = r.readFileSync(s.toNamespacedPath(e), `utf8`);
} catch (e) {

@@ -121,3 +121,3 @@ let t = e;

exists: !1,
pjsonPath: t,
pjsonPath: e,
main: void 0,

@@ -130,23 +130,23 @@ name: void 0,

if (o !== void 0) {
let e;
let r;
try {
e = JSON.parse(o);
} catch (e) {
let i = new w(t, (n ? `"${r}" from ` : ``) + a(n || r), e.message);
throw i.cause = e, i;
r = JSON.parse(o);
} catch (r) {
let a = new w(e, (n ? `"${i}" from ` : ``) + t(n || i), r.message);
throw a.cause = r, a;
}
c.exists = !0, A.call(e, `name`) && typeof e.name == `string` && (c.name = e.name), A.call(e, `main`) && typeof e.main == `string` && (c.main = e.main), A.call(e, `exports`) && (c.exports = e.exports), A.call(e, `imports`) && (c.imports = e.imports), A.call(e, `type`) && (e.type === `commonjs` || e.type === `module`) && (c.type = e.type);
c.exists = !0, A.call(r, `name`) && typeof r.name == `string` && (c.name = r.name), A.call(r, `main`) && typeof r.main == `string` && (c.main = r.main), A.call(r, `exports`) && (c.exports = r.exports), A.call(r, `imports`) && (c.imports = r.imports), A.call(r, `type`) && (r.type === `commonjs` || r.type === `module`) && (c.type = r.type);
}
return j.set(t, c), c;
return j.set(e, c), c;
}
function N(e) {
let t = new URL(`package.json`, e);
for (; !t.pathname.endsWith(`node_modules/package.json`);) {
let n = M(a(t), { specifier: e });
if (n.exists) return n;
let r = t;
if (t = new URL(`../package.json`, t), t.pathname === r.pathname) break;
let n = new URL(`package.json`, e);
for (; !n.pathname.endsWith(`node_modules/package.json`);) {
let r = M(t(n), { specifier: e });
if (r.exists) return r;
let i = n;
if (n = new URL(`../package.json`, n), n.pathname === i.pathname) break;
}
return {
pjsonPath: a(t),
pjsonPath: t(n),
exists: !1,

@@ -191,15 +191,15 @@ type: `none`

}
function fe(e, t, n) {
let r = de(e);
if (r === `.js`) {
function fe(e, n, r) {
let i = de(e);
if (i === `.js`) {
let { type: t } = N(e);
return t === `none` ? `commonjs` : t;
}
if (r === ``) {
if (i === ``) {
let { type: t } = N(e);
return t === `none` || t === `commonjs` ? `commonjs` : `module`;
}
let i = ce[r];
if (i) return i;
if (!n) throw new oe(r, a(e));
let a = ce[i];
if (a) return a;
if (!r) throw new oe(i, t(e));
}

@@ -211,35 +211,35 @@ function pe(e, t) {

const F = RegExp.prototype[Symbol.replace], I = {}.hasOwnProperty, L = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\|\/|$)/i, R = /(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\|\/|$)/i, z = /^\.|%|\\/, B = /\*/g, me = /%2f|%5c/i, V = /* @__PURE__ */ new Set(), he = /[/\\]{2}/;
function H(e, t, n, r, i, o, s) {
function H(e, n, r, i, a, o, s) {
if (u.noDeprecation) return;
let c = a(r), l = he.exec(s ? e : t) !== null;
u.emitWarning(`Use of deprecated ${l ? `double slash` : `leading or trailing slash matching`} resolving "${e}" for module request "${t}" ${t === n ? `` : `matched to "${n}" `}in the "${i ? `imports` : `exports`}" field module resolution of the package at ${c}${o ? ` imported from ${a(o)}` : ``}.`, `DeprecationWarning`, `DEP0166`);
let c = t(i), l = he.exec(s ? e : n) !== null;
u.emitWarning(`Use of deprecated ${l ? `double slash` : `leading or trailing slash matching`} resolving "${e}" for module request "${n}" ${n === r ? `` : `matched to "${r}" `}in the "${a ? `imports` : `exports`}" field module resolution of the package at ${c}${o ? ` imported from ${t(o)}` : ``}.`, `DeprecationWarning`, `DEP0166`);
}
function U(e, t, n, r) {
if (u.noDeprecation || pe(e, { parentURL: n.href }) !== `module`) return;
let o = a(e.href), c = a(new i(`.`, t)), l = a(n);
r ? s.resolve(c, r) !== o && u.emitWarning(`Package ${c} has a "main" field set to "${r}", excluding the full filename and extension to the resolved file at "${o.slice(c.length)}", imported from ${l}.\n Automatic extension resolution of the "main" field is deprecated for ES modules.`, `DeprecationWarning`, `DEP0151`) : u.emitWarning(`No "main" or "exports" field defined in the package.json for ${c} resolving the main entry point "${o.slice(c.length)}", imported from ${l}.\nDefault "index" lookups for the main are deprecated for ES modules.`, `DeprecationWarning`, `DEP0151`);
function U(n, r, i, a) {
if (u.noDeprecation || pe(n, { parentURL: i.href }) !== `module`) return;
let o = t(n.href), c = t(new e(`.`, r)), l = t(i);
a ? s.resolve(c, a) !== o && u.emitWarning(`Package ${c} has a "main" field set to "${a}", excluding the full filename and extension to the resolved file at "${o.slice(c.length)}", imported from ${l}.\n Automatic extension resolution of the "main" field is deprecated for ES modules.`, `DeprecationWarning`, `DEP0151`) : u.emitWarning(`No "main" or "exports" field defined in the package.json for ${c} resolving the main entry point "${o.slice(c.length)}", imported from ${l}.\nDefault "index" lookups for the main are deprecated for ES modules.`, `DeprecationWarning`, `DEP0151`);
}
function W(e) {
try {
return r(e);
return o(e);
} catch {}
}
function G(e) {
let t = r(e, { throwIfNoEntry: !1 });
let t = o(e, { throwIfNoEntry: !1 });
return (t ? t.isFile() : void 0) ?? !1;
}
function ge(e, t, n) {
let r;
if (t.main !== void 0) {
if (r = new i(t.main, e), G(r)) return r;
let a = [
`./${t.main}.js`,
`./${t.main}.json`,
`./${t.main}.node`,
`./${t.main}/index.js`,
`./${t.main}/index.json`,
`./${t.main}/index.node`
function ge(n, r, i) {
let a;
if (r.main !== void 0) {
if (a = new e(r.main, n), G(a)) return a;
let t = [
`./${r.main}.js`,
`./${r.main}.json`,
`./${r.main}.node`,
`./${r.main}/index.js`,
`./${r.main}/index.json`,
`./${r.main}/index.node`
], o = -1;
for (; ++o < a.length && (r = new i(a[o], e), !G(r));) r = void 0;
if (r) return U(r, e, n, t.main), r;
for (; ++o < t.length && (a = new e(t[o], n), !G(a));) a = void 0;
if (a) return U(a, n, i, r.main), a;
}

@@ -251,67 +251,67 @@ let o = [

], s = -1;
for (; ++s < o.length && (r = new i(o[s], e), !G(r));) r = void 0;
if (r) return U(r, e, n, t.main), r;
throw new T(a(new i(`.`, e)), a(n));
for (; ++s < o.length && (a = new e(o[s], n), !G(a));) a = void 0;
if (a) return U(a, n, i, r.main), a;
throw new T(t(new e(`.`, n)), t(i));
}
function _e(e, t, r) {
if (me.exec(e.pathname) !== null) throw new C(e.pathname, String.raw`must not include encoded "/" or "\" characters`, a(t));
let i;
function _e(e, r, i) {
if (me.exec(e.pathname) !== null) throw new C(e.pathname, String.raw`must not include encoded "/" or "\" characters`, t(r));
let o;
try {
i = a(e);
} catch (n) {
throw Object.defineProperty(n, `input`, { value: String(e) }), Object.defineProperty(n, `module`, { value: String(t) }), n;
o = t(e);
} catch (t) {
throw Object.defineProperty(t, `input`, { value: String(e) }), Object.defineProperty(t, `module`, { value: String(r) }), t;
}
let c = W(i.endsWith(`/`) ? i.slice(-1) : i);
let c = W(o.endsWith(`/`) ? o.slice(-1) : o);
if (c && c.isDirectory()) {
let n = new O(i, a(t));
let n = new O(o, t(r));
throw n.url = String(e), n;
}
if (!c || !c.isFile()) {
let n = new T(i || e.pathname, t && a(t), !0);
let n = new T(o || e.pathname, r && t(r), !0);
throw n.url = String(e), n;
}
if (!r) {
let t = n(i), { search: r, hash: a } = e;
e = o(t + (i.endsWith(s.sep) ? `/` : ``)), e.search = r, e.hash = a;
if (!i) {
let t = a(o), { search: r, hash: i } = e;
e = n(t + (o.endsWith(s.sep) ? `/` : ``)), e.search = r, e.hash = i;
}
return e;
}
function ve(e, t, n) {
return new E(e, t && a(new i(`.`, t)), a(n));
function ve(n, r, i) {
return new E(n, r && t(new e(`.`, r)), t(i));
}
function K(e, t, n) {
return new D(a(new i(`.`, t)), e, n && a(n));
function K(n, r, i) {
return new D(t(new e(`.`, r)), n, i && t(i));
}
function ye(e, t, n, r, i) {
throw new C(e, `request is not a valid match in pattern "${t}" for the "${r ? `imports` : `exports`}" resolution of ${a(n)}`, i && a(i));
function ye(e, n, r, i, a) {
throw new C(e, `request is not a valid match in pattern "${n}" for the "${i ? `imports` : `exports`}" resolution of ${t(r)}`, a && t(a));
}
function q(e, t, n, r, o) {
return t = typeof t == `object` && t ? JSON.stringify(t, null, ``) : `${t}`, new ae(a(new i(`.`, n)), e, t, r, o && a(o));
function q(n, r, i, a, o) {
return r = typeof r == `object` && r ? JSON.stringify(r, null, ``) : `${r}`, new ae(t(new e(`.`, i)), n, r, a, o && t(o));
}
function be(e, t, n, r, a, o, s, c, l) {
if (t !== `` && !o && e.at(-1) !== `/`) throw q(n, e, r, s, a);
if (!e.startsWith(`./`)) {
if (s && !e.startsWith(`../`) && !e.startsWith(`/`)) {
let n = !1;
function be(t, n, r, i, a, o, s, c, l) {
if (n !== `` && !o && t.at(-1) !== `/`) throw q(r, t, i, s, a);
if (!t.startsWith(`./`)) {
if (s && !t.startsWith(`../`) && !t.startsWith(`/`)) {
let r = !1;
try {
new i(e), n = !0;
new e(t), r = !0;
} catch {}
if (!n) return Z(o ? F.call(B, e, () => t) : e + t, r, l);
if (!r) return Z(o ? F.call(B, t, () => n) : t + n, i, l);
}
throw q(n, e, r, s, a);
throw q(r, t, i, s, a);
}
if (L.exec(e.slice(2)) !== null) if (R.exec(e.slice(2)) === null) {
if (L.exec(t.slice(2)) !== null) if (R.exec(t.slice(2)) === null) {
if (!c) {
let i = o ? n.replace(`*`, () => t) : n + t;
H(o ? F.call(B, e, () => t) : e, i, n, r, s, a, !0);
let e = o ? r.replace(`*`, () => n) : r + n;
H(o ? F.call(B, t, () => n) : t, e, r, i, s, a, !0);
}
} else throw q(n, e, r, s, a);
let u = new i(e, r), d = u.pathname, f = new i(`.`, r).pathname;
if (!d.startsWith(f)) throw q(n, e, r, s, a);
if (t === ``) return u;
if (L.exec(t) !== null) {
let i = o ? n.replace(`*`, () => t) : n + t;
R.exec(t) === null ? c || H(o ? F.call(B, e, () => t) : e, i, n, r, s, a, !1) : ye(i, n, r, s, a);
} else throw q(r, t, i, s, a);
let u = new e(t, i), d = u.pathname, f = new e(`.`, i).pathname;
if (!d.startsWith(f)) throw q(r, t, i, s, a);
if (n === ``) return u;
if (L.exec(n) !== null) {
let e = o ? r.replace(`*`, () => n) : r + n;
R.exec(n) === null ? c || H(o ? F.call(B, t, () => n) : t, e, r, i, s, a, !1) : ye(e, r, i, s, a);
}
return o ? new i(F.call(B, u.href, () => t)) : new i(t, u);
return o ? new e(F.call(B, u.href, () => n)) : new e(n, u);
}

@@ -322,12 +322,12 @@ function xe(e) {

}
function J(e, t, n, r, i, o, s, c, l) {
if (typeof t == `string`) return be(t, n, r, e, i, o, s, c, l);
if (Array.isArray(t)) {
let a = t;
if (a.length === 0) return null;
function J(e, n, r, i, a, o, s, c, l) {
if (typeof n == `string`) return be(n, r, i, e, a, o, s, c, l);
if (Array.isArray(n)) {
let t = n;
if (t.length === 0) return null;
let u, d = -1;
for (; ++d < a.length;) {
let t = a[d], f;
for (; ++d < t.length;) {
let n = t[d], f;
try {
f = J(e, t, n, r, i, o, s, c, l);
f = J(e, n, r, i, a, o, s, c, l);
} catch (e) {

@@ -349,12 +349,12 @@ let t = e;

}
if (typeof t == `object` && t) {
let u = Object.getOwnPropertyNames(t), d = -1;
if (typeof n == `object` && n) {
let u = Object.getOwnPropertyNames(n), d = -1;
for (; ++d < u.length;) {
let t = u[d];
if (xe(t)) throw new w(a(e), a(i), `"exports" cannot contain numeric property keys.`);
let n = u[d];
if (xe(n)) throw new w(t(e), t(a), `"exports" cannot contain numeric property keys.`);
}
for (d = -1; ++d < u.length;) {
let a = u[d];
if (a === `default` || l && l.has(a)) {
let u = t[a], d = J(e, u, n, r, i, o, s, c, l);
let t = u[d];
if (t === `default` || l && l.has(t)) {
let u = n[t], d = J(e, u, r, i, a, o, s, c, l);
if (d === void 0) continue;

@@ -366,20 +366,20 @@ return d;

}
if (t === null) return null;
throw q(r, t, e, s, i);
if (n === null) return null;
throw q(i, n, e, s, a);
}
function Se(e, t, n) {
function Se(e, n, r) {
if (typeof e == `string` || Array.isArray(e)) return !0;
if (typeof e != `object` || !e) return !1;
let r = Object.getOwnPropertyNames(e), i = !1, o = 0, s = -1;
for (; ++s < r.length;) {
let e = r[s], c = e === `` || e[0] !== `.`;
if (o++ === 0) i = c;
else if (i !== c) throw new w(a(t), a(n), `"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`);
let i = Object.getOwnPropertyNames(e), a = !1, o = 0, s = -1;
for (; ++s < i.length;) {
let e = i[s], c = e === `` || e[0] !== `.`;
if (o++ === 0) a = c;
else if (a !== c) throw new w(t(n), t(r), `"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`);
}
return i;
return a;
}
function Ce(e, t, n) {
function Ce(e, n, r) {
if (u.noDeprecation) return;
let r = a(t);
V.has(r + `|` + e) || (V.add(r + `|` + e), u.emitWarning(`Use of deprecated trailing slash pattern mapping "${e}" in the "exports" field module resolution of the package at ${r}${n ? ` imported from ${a(n)}` : ``}. Mapping specifiers ending in "/" is no longer supported.`, `DeprecationWarning`, `DEP0155`));
let i = t(n);
V.has(i + `|` + e) || (V.add(i + `|` + e), u.emitWarning(`Use of deprecated trailing slash pattern mapping "${e}" in the "exports" field module resolution of the package at ${i}${r ? ` imported from ${t(r)}` : ``}. Mapping specifiers ending in "/" is no longer supported.`, `DeprecationWarning`, `DEP0155`));
}

@@ -413,22 +413,22 @@ function Y(e, t, n, r, i) {

}
function we(e, t, n) {
if (e === `#` || e.startsWith(`#/`) || e.endsWith(`/`)) throw new C(e, `is not a valid internal imports specifier name`, a(t));
let r, i = N(t);
if (i.exists) {
r = o(i.pjsonPath);
let a = i.imports;
if (a) if (I.call(a, e) && !e.includes(`*`)) {
let i = J(r, a[e], ``, e, t, !1, !0, !1, n);
if (i != null) return i;
function we(e, r, i) {
if (e === `#` || e.startsWith(`#/`) || e.endsWith(`/`)) throw new C(e, `is not a valid internal imports specifier name`, t(r));
let a, o = N(r);
if (o.exists) {
a = n(o.pjsonPath);
let t = o.imports;
if (t) if (I.call(t, e) && !e.includes(`*`)) {
let n = J(a, t[e], ``, e, r, !1, !0, !1, i);
if (n != null) return n;
} else {
let i = ``, o = ``, s = Object.getOwnPropertyNames(a), c = -1;
let n = ``, o = ``, s = Object.getOwnPropertyNames(t), c = -1;
for (; ++c < s.length;) {
let t = s[c], n = t.indexOf(`*`);
if (n !== -1 && e.startsWith(t.slice(0, -1))) {
let r = t.slice(n + 1);
e.length >= t.length && e.endsWith(r) && X(i, t) === 1 && t.lastIndexOf(`*`) === n && (i = t, o = e.slice(n, e.length - r.length));
let t = s[c], r = t.indexOf(`*`);
if (r !== -1 && e.startsWith(t.slice(0, -1))) {
let i = t.slice(r + 1);
e.length >= t.length && e.endsWith(i) && X(n, t) === 1 && t.lastIndexOf(`*`) === r && (n = t, o = e.slice(r, e.length - i.length));
}
}
if (i) {
let e = a[i], s = J(r, e, o, i, t, !0, !0, !1, n);
if (n) {
let e = t[n], s = J(a, e, o, n, r, !0, !0, !1, i);
if (s != null) return s;

@@ -438,33 +438,33 @@ }

}
throw ve(e, r, t);
throw ve(e, a, r);
}
function Te(e, t) {
let n = e.indexOf(`/`), r = !0, i = !1;
e[0] === `@` && (i = !0, n === -1 || e.length === 0 ? r = !1 : n = e.indexOf(`/`, n + 1));
let o = n === -1 ? e : e.slice(0, n);
if (z.exec(o) !== null && (r = !1), !r) throw new C(e, `is not a valid package name`, a(t));
function Te(e, n) {
let r = e.indexOf(`/`), i = !0, a = !1;
e[0] === `@` && (a = !0, r === -1 || e.length === 0 ? i = !1 : r = e.indexOf(`/`, r + 1));
let o = r === -1 ? e : e.slice(0, r);
if (z.exec(o) !== null && (i = !1), !i) throw new C(e, `is not a valid package name`, t(n));
return {
packageName: o,
packageSubpath: `.` + (n === -1 ? `` : e.slice(n)),
isScoped: i
packageSubpath: `.` + (r === -1 ? `` : e.slice(r)),
isScoped: a
};
}
function Z(e, t, n) {
if (m.includes(e)) return new i(`node:` + e);
let { packageName: r, packageSubpath: s, isScoped: c } = Te(e, t), l = N(t);
if (l.exists && l.name === r && l.exports !== void 0 && l.exports !== null) return Y(o(l.pjsonPath), s, l, t, n);
let u = new i(`./node_modules/` + r + `/package.json`, t), d = a(u), f;
function Z(r, i, a) {
if (m.includes(r)) return new e(`node:` + r);
let { packageName: o, packageSubpath: s, isScoped: c } = Te(r, i), l = N(i);
if (l.exists && l.name === o && l.exports !== void 0 && l.exports !== null) return Y(n(l.pjsonPath), s, l, i, a);
let u = new e(`./node_modules/` + o + `/package.json`, i), d = t(u), f;
do {
let o = W(d.slice(0, -13));
if (!o || !o.isDirectory()) {
f = d, u = new i((c ? `../../../../node_modules/` : `../../../node_modules/`) + r + `/package.json`, u), d = a(u);
let n = W(d.slice(0, -13));
if (!n || !n.isDirectory()) {
f = d, u = new e((c ? `../../../../node_modules/` : `../../../node_modules/`) + o + `/package.json`, u), d = t(u);
continue;
}
let l = M(d, {
base: t,
specifier: e
base: i,
specifier: r
});
return l.exports !== void 0 && l.exports !== null ? Y(u, s, l, t, n) : s === `.` ? ge(u, l, t) : new i(s, u);
return l.exports !== void 0 && l.exports !== null ? Y(u, s, l, i, a) : s === `.` ? ge(u, l, i) : new e(s, u);
} while (d.length !== f.length);
throw new T(r, a(t), !1);
throw new T(o, t(i), !1);
}

@@ -477,32 +477,32 @@ function Ee(e) {

}
function Oe(e, t, n, r) {
let a = t.protocol, o = a === `data:`, s;
if (De(e)) try {
s = new i(e, t);
} catch (n) {
let r = new k(e, t);
throw r.cause = n, r;
function Oe(t, n, r, i) {
let a = n.protocol, o = a === `data:`, s;
if (De(t)) try {
s = new e(t, n);
} catch (e) {
let r = new k(t, n);
throw r.cause = e, r;
}
else if (a === `file:` && e[0] === `#`) s = we(e, t, n);
else if (a === `file:` && t[0] === `#`) s = we(t, n, r);
else try {
s = new i(e);
} catch (r) {
if (o && !m.includes(e)) {
let n = new k(e, t);
throw n.cause = r, n;
s = new e(t);
} catch (e) {
if (o && !m.includes(t)) {
let r = new k(t, n);
throw r.cause = e, r;
}
s = Z(e, t, n);
s = Z(t, n, r);
}
return l.ok(s !== void 0, `expected to be defined`), s.protocol === `file:` ? _e(s, t, r) : s;
return l.ok(s !== void 0, `expected to be defined`), s.protocol === `file:` ? _e(s, n, i) : s;
}
const ke = new Set([`node`, `import`]), Ae = process.platform === `win32`, je = globalThis.__EXSOLVE_CACHE__ ||= /* @__PURE__ */ new Map();
function Q(e, r) {
let i = Be(e);
if (`external` in i) return i.external;
let a = i.specifier, s = i.url, c = i.absolutePath, l, u;
if (r?.cache !== !1 && (l = Le(c || a, r), u = r?.cache && typeof r?.cache == `object` ? r.cache : je), u) {
function Q(e, t) {
let r = Be(e);
if (`external` in r) return r.external;
let o = r.specifier, s = r.url, c = r.absolutePath, l, u;
if (t?.cache !== !1 && (l = Le(c || o, t), u = t?.cache && typeof t?.cache == `object` ? t.cache : je), u) {
let e = u.get(l);
if (typeof e == `string`) return e;
if (e instanceof Error) {
if (r?.try) return;
if (t?.try) return;
throw e;

@@ -512,8 +512,8 @@ }

if (c) try {
let e = t(c);
if (e.isSymbolicLink() && (c = n(c), s = o(c)), e.isFile()) return u && u.set(l, s.href), s.href;
let e = i(c);
if (e.isSymbolicLink() && (c = a(c), s = n(c)), e.isFile()) return u && u.set(l, s.href), s.href;
} catch (e) {
if (e?.code !== `ENOENT`) throw u && u.set(l, e), e;
}
let d = r?.conditions ? new Set(r.conditions) : ke, f = a || s.href, p = Pe(r?.from), m = r?.suffixes || [``], h = r?.extensions ? [``, ...r.extensions] : [``], g;
let d = t?.conditions ? new Set(t.conditions) : ke, f = o || s.href, p = Pe(t?.from), m = t?.suffixes || [``], h = t?.extensions ? [``, ...t.extensions] : [``], g;
for (let e of p) {

@@ -529,13 +529,13 @@ for (let t of m) {

if (!g) {
let t = Error(`Cannot resolve module "${e}" (from: ${p.map((e) => Ie(e)).join(`, `)})`);
if (t.code = `ERR_MODULE_NOT_FOUND`, u && u.set(l, t), r?.try) return;
throw t;
let n = Error(`Cannot resolve module "${e}" (from: ${p.map((e) => Ie(e)).join(`, `)})`);
if (n.code = `ERR_MODULE_NOT_FOUND`, u && u.set(l, n), t?.try) return;
throw n;
}
return u && u.set(l, g.href), g.href;
}
function Me(e, t) {
let n = Q(e, t);
if (!n || !n.startsWith(`file://`) && t?.try) return;
let r = a(n);
return Ae ? ze(r) : r;
function Me(e, n) {
let r = Q(e, n);
if (!r || !r.startsWith(`file://`) && n?.try) return;
let i = t(r);
return Ae ? ze(i) : i;
}

@@ -549,3 +549,3 @@ function Ne(e, t, n) {

let t = (Array.isArray(e) ? e : [e]).flatMap((e) => Fe(e));
return t.length === 0 ? [o(`./`)] : t;
return t.length === 0 ? [n(`./`)] : t;
}

@@ -558,5 +558,5 @@ function Fe(e) {

try {
return e.endsWith(`/`) || r(e).isDirectory() ? o(e + `/`) : o(e);
return e.endsWith(`/`) || o(e).isDirectory() ? n(e + `/`) : n(e);
} catch {
return [o(e + `/`), o(e)];
return [n(e + `/`), n(e)];
}

@@ -566,3 +566,3 @@ }

try {
return a(e);
return t(e);
} catch {

@@ -593,10 +593,10 @@ return e;

if (e.startsWith(`file:`)) {
let t = new URL(e);
let n = new URL(e);
return {
url: t,
absolutePath: a(t)
url: n,
absolutePath: t(n)
};
}
return c(e) ? {
url: o(e),
url: n(e),
absolutePath: e

@@ -607,3 +607,3 @@ } : /^(?:node|data|http|https):/.test(e) ? { external: e } : m.includes(e) && !e.includes(`:`) ? { external: `node:${e}` } : { specifier: e };

url: e,
absolutePath: a(e)
absolutePath: t(e)
} : { external: e.href };

@@ -610,0 +610,0 @@ throw TypeError("id must be a `string` or `URL`");

import { a as relative, i as normalize, n as isAbsolute, o as resolve, r as join, t as dirname } from "./libs/pathe.mjs";
import { createRequire } from "node:module";
import { promises } from "node:fs";
import * as fsp from "node:fs/promises";
import { readFile, writeFile } from "node:fs/promises";
import { nodeFileTrace } from "@vercel/nft";
import semver from "semver";
import { readFile, writeFile } from "node:fs/promises";
//#region \0rolldown/runtime.js

@@ -117,3 +117,3 @@ var __defProp = Object.defineProperty;

await opts?.hooks?.traceResult?.(traceResult);
const _resolveTracedPath = (p) => promises.realpath(resolve(opts.nft?.base || "/", p)).then((p) => normalize(p));
const _resolveTracedPath = (p) => fsp.realpath(resolve(opts.nft?.base || "/", p)).then((p) => normalize(p));
const tracedFiles = Object.fromEntries(await Promise.all([...traceResult.reasons.entries()].map(async ([_path, reasons]) => {

@@ -166,2 +166,14 @@ if (reasons.ignored) return;

tracedPackage.versions[pkgJSON.version || "0.0.0"] = tracedPackageVersion;
const fullTraceEntry = resolveFullTraceEntry(opts.fullTraceInclude, pkgName);
if (fullTraceEntry) {
if (!fsp.glob) throw new Error("`fullTraceInclude` requires Node.js >= 22.0.0 (fs.promises.glob)");
const globPattern = fullTraceEntry.glob || "{**,.**}/{.*,*}";
for await (const file of fsp.glob(globPattern, {
cwd: tracedFile.pkgPath,
exclude: (name) => name === "node_modules"
})) {
const fullPath = join(tracedFile.pkgPath, file);
if (await isFile(fullPath)) tracedPackageVersion.files.push(fullPath);
}
}
}

@@ -182,10 +194,10 @@ tracedPackageVersion.files.push(tracedFile.path);

const dst = resolve(outDir, pkgPath, subpath);
await promises.mkdir(dirname(dst), { recursive: true });
await fsp.mkdir(dirname(dst), { recursive: true });
const transformers = (opts.transform || []).filter((t) => t?.filter?.(src) && t.handler);
if (transformers.length > 0) {
let content = await promises.readFile(src, "utf8");
let content = await fsp.readFile(src, "utf8");
for (const transformer of transformers) content = await transformer.handler(content, src) ?? content;
await promises.writeFile(dst, content, "utf8");
} else await promises.copyFile(src, dst);
if (opts.chmod) await promises.chmod(dst, opts.chmod === true ? 420 : opts.chmod);
await fsp.writeFile(dst, content, "utf8");
} else await fsp.copyFile(src, dst);
if (opts.chmod) await fsp.chmod(dst, opts.chmod === true ? 420 : opts.chmod);
}

@@ -195,4 +207,4 @@ const pkgJSON = pkg.versions[version].pkgJSON;

const pkgJSONPath = join(outDir, pkgPath, "package.json");
await promises.mkdir(dirname(pkgJSONPath), { recursive: true });
await promises.writeFile(pkgJSONPath, JSON.stringify(pkgJSON, null, 2), "utf8");
await fsp.mkdir(dirname(pkgJSONPath), { recursive: true });
await fsp.writeFile(pkgJSONPath, JSON.stringify(pkgJSON, null, 2), "utf8");
if (opts.traceAlias && opts.traceAlias[pkgPath]) {

@@ -206,5 +218,5 @@ usedAliases[opts.traceAlias[pkgPath]] = version;

const dst = join(outDir, to);
if ((await promises.lstat(dst).catch(() => null))?.isSymbolicLink()) return;
await promises.mkdir(dirname(dst), { recursive: true });
await promises.symlink(relative(dirname(dst), src), dst, isWindows ? "junction" : "dir").catch((error) => {
if ((await fsp.lstat(dst).catch(() => null))?.isSymbolicLink()) return;
await fsp.mkdir(dirname(dst), { recursive: true });
await fsp.symlink(relative(dirname(dst), src), dst, isWindows ? "junction" : "dir").catch((error) => {
if (error.code !== "EEXIST") console.error("Cannot link", from, "to", to, error);

@@ -214,3 +226,3 @@ });

const findPackageParents = (pkg, version) => {
const versionFiles = pkg.versions[version].files.map((path) => tracedFiles[path]);
const versionFiles = pkg.versions[version].files.map((path) => tracedFiles[path]).filter((x) => x !== void 0);
return [...new Set(versionFiles.flatMap((file) => file.parents.map((parentPath) => {

@@ -274,5 +286,11 @@ const parentFile = tracedFiles[parentPath];

}
function resolveFullTraceEntry(entries, pkgName) {
if (!entries) return;
for (const entry of entries) if (typeof entry === "string") {
if (entry === pkgName) return {};
} else if (entry[0] === pkgName) return entry[1];
}
async function isFile(file) {
try {
return (await promises.stat(file)).isFile();
return (await fsp.stat(file)).isFile();
} catch (error) {

@@ -279,0 +297,0 @@ if (error?.code === "ENOENT") return false;

@@ -68,2 +68,20 @@ import { t as PackageJson } from "./libs/pkg-types.mjs";

/**
* List of package names to include all files for in the trace (not just nft-detected ones).
*
* Each item can be a package name string or a tuple of `[packageName, { glob }]` to customize the glob pattern.
*
* Requires Node.js >= 22.0.0 (`fs.promises.glob`).
*
* @example
* ```ts
* fullTraceInclude: [
* "some-pkg",
* ["other-pkg", { glob: "dist/**" }],
* ]
* ```
*/
fullTraceInclude?: (string | [name: string, options: {
glob?: string;
}])[];
/**
* Hook functions for allow extending tracing behavior.

@@ -70,0 +88,0 @@ */

@@ -1,1 +0,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){k=i.scope;for(let e in 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){k.parent&&(k=k.parent);for(let e in 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(n){let r=n.indexOf(static_eval_1.WILDCARD),a=r===-1?n.length:n.lastIndexOf(path_1.default.sep,r),o=n.substring(0,a);try{var s=await c.stat(o);if(s===null)throw Error(`file not found`)}catch{return}if(!(r!==-1&&s.isFile())){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)){c.log&&console.log(`Skipping asset emission of `+n+` for `+e+` as it is outside the package base `+p);return}}if(s.isFile()){if(c.ignoreFn(path_1.default.relative(c.base,n)))return;l.add(n)}else if(s.isDirectory()){if(c.ignoreFn(path_1.default.relative(c.base,n)))return;M(n)&&m(n)}}}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}
"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(),PINO_TRANSPORT=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},pino:{default:{[static_eval_1.UNKNOWN]:!0,transport:PINO_TRANSPORT},transport:PINO_TRANSPORT}}),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){k=i.scope;for(let e in 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 PINO_TRANSPORT:if(i.arguments.length>=1&&i.arguments[0].type===`ObjectExpression`){for(let e of i.arguments[0].properties)if(e.type===`Property`&&!e.computed&&e.key.type===`Identifier`){if(e.key.name===`target`&&e.value.type===`Literal`)await O(e.value);else if((e.key.name===`targets`||e.key.name===`pipeline`)&&e.value.type===`ArrayExpression`){for(let t of e.value.elements)if(t&&t.type===`ObjectExpression`)for(let e of t.properties)e.type===`Property`&&!e.computed&&e.key.type===`Identifier`&&e.key.name===`target`&&e.value.type===`Literal`&&await O(e.value)}}return this.skip()}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){k.parent&&(k=k.parent);for(let e in 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(n){let r=n.indexOf(static_eval_1.WILDCARD),a=r===-1?n.length:n.lastIndexOf(path_1.default.sep,r),o=n.substring(0,a);try{var s=await c.stat(o);if(s===null)throw Error(`file not found`)}catch{return}if(!(r!==-1&&s.isFile())){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)){c.log&&console.log(`Skipping asset emission of `+n+` for `+e+` as it is outside the package base `+p);return}}if(s.isFile()){if(c.ignoreFn(path_1.default.relative(c.base,n)))return;l.add(n)}else if(s.isDirectory()){if(c.ignoreFn(path_1.default.relative(c.base,n)))return;M(n)&&m(n)}}}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}
{
"name": "@vercel/nft",
"version": "1.3.2",
"version": "1.4.0",
"main": "./out/index.js"
}

@@ -78,3 +78,9 @@ import { a as pathRegExp, i as guessSubpath, o as toImport, s as toPathRegExp, t as DEFAULT_CONDITIONS } from "./_chunks/trace.mjs";

async handler() {
for (const entry of opts.traceInclude || []) tracedPaths.add(isAbsolute(entry) ? entry : tryResolve(entry, void 0) ?? resolve(rootDir, entry));
if (opts.trace === false || tracedPaths.size === 0) return;
const traceOpts = opts.trace === true ? {} : opts.trace;
if (traceOpts?.fullTraceInclude) for (const pkg of traceOpts.fullTraceInclude) {
const resolved = tryResolve(Array.isArray(pkg) ? pkg[0] : pkg, void 0);
if (resolved) tracedPaths.add(resolved);
}
const { traceNodeModules } = await import("./_chunks/trace.mjs").then((n) => n.r);

@@ -84,3 +90,3 @@ await traceNodeModules([...tracedPaths], {

rootDir,
...opts.trace === true ? {} : opts.trace
...traceOpts
});

@@ -87,0 +93,0 @@ }

{
"name": "nf3",
"version": "0.3.11",
"version": "0.3.12",
"description": "",

@@ -30,7 +30,7 @@ "license": "MIT",

"@rollup/plugin-node-resolve": "^16.0.3",
"@types/node": "^25.3.5",
"@types/node": "^25.5.0",
"@types/semver": "^7.7.1",
"@typescript/native-preview": "^7.0.0-dev.20260309.1",
"@vercel/nft": "^1.3.2",
"@vitest/coverage-v8": "^4.0.18",
"@typescript/native-preview": "^7.0.0-dev.20260319.1",
"@vercel/nft": "^1.4.0",
"@vitest/coverage-v8": "^4.1.0",
"automd": "^0.4.3",

@@ -41,8 +41,8 @@ "changelogen": "^0.6.2",

"obuild": "^0.4.32",
"oxc-minify": "^0.116.0",
"oxfmt": "^0.36.0",
"oxlint": "^1.51.0",
"oxc-minify": "^0.121.0",
"oxfmt": "^0.41.0",
"oxlint": "^1.56.0",
"pathe": "^2.0.3",
"pkg-types": "^2.3.0",
"rolldown": "^1.0.0-rc.8",
"rolldown": "^1.0.0-rc.10",
"rollup": "^4.59.0",

@@ -52,5 +52,5 @@ "rollup-plugin-esbuild": "^6.2.1",

"typescript": "^5.9.3",
"vitest": "^4.0.18"
"vitest": "^4.1.0"
},
"packageManager": "pnpm@10.31.0"
"packageManager": "pnpm@10.32.1"
}

@@ -51,3 +51,5 @@ # 📦 nf3

// traceInclude: ["some-lib"],
// trace: {}
// trace: {
// fullTraceInclude: ["some-lib"],
// }
}),

@@ -58,2 +60,19 @@ ],

### Full Trace Include
By default, only files detected by [`@vercel/nft`](https://github.com/vercel/nft) are included in the output. Some packages may require all their files to be present at runtime (e.g., packages with dynamic requires or asset files).
Use `fullTraceInclude` to specify package names that should have **all** files copied to the output:
```js
rollupNodeFileTrace({
trace: {
fullTraceInclude: ["some-package", "@scope/another-package"],
},
});
```
> [!NOTE]
> Requires Node.js >= 22.0.0 (`fs.promises.glob`).
### Hooks

@@ -60,0 +79,0 @@