@buildplease/core 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # @buildplease/core
2
+
3
+ Core is the shared foundation for BuildPlease applications. It provides framework-independent application primitives used by the other BuildPlease kits.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @buildplease/core
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { coreAssembly } from '@buildplease/core';
15
+
16
+ const assemblies = coreAssembly();
17
+ ```
18
+
19
+ Node.js-specific APIs are available from `@buildplease/core/node`.
20
+
21
+ ## Features
22
+
23
+ - dependency injection and application assemblies
24
+ - operations, models, converters, and formatters
25
+ - errors, validation, and normalization primitives
26
+ - L10n resources and localization helpers
27
+ - security, synchronization, and general utilities
28
+ - Node.js infrastructure helpers
29
+
30
+ ## License
31
+
32
+ MIT
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(e,t,n)=>(s(e,t,`default`),n&&s(n,t,`default`)),l=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));let u=require("node:module"),d=require("consola"),f=require("consola/utils"),p=require("inversify"),m=require("date-fns"),h=require("date-fns-tz"),g=require("ms");g=l(g,1);let _=require("node:path");_=l(_,1);let v=require("node:fs");v=l(v,1);let ee=require("node:url"),y=require("pino");y=l(y,1);let b=require("zod");b=l(b,1);function te(e,t={}){let n=t.includePeers??!0,r=t.includeDependencies??!0,i=t.includeSubpaths??!0,a=t.includeNodeBuiltins??!0,o=t.allowPeerBundling??!1,s=Object.keys(e.peerDependencies??{}),c=Object.keys(e.dependencies??{}),l=S(t.bundle??[]),u=S(t.external??[]);se(u,l),D(l),o||E(s,l);let d=new Set(l.map(w)),f=n?s.filter(e=>!d.has(e)):[],p=r?c.filter(e=>!d.has(e)):[];return{external:C([...a?ne():[],...x([...f,...p,...u],i)]),bundle:C(x(l,i))}}function ne(){let e=S(u.builtinModules.map(T)),t=e.map(e=>`node:${e}`);return C([...e,...t,/^node:/])}function x(e,t){return t?e.map(e=>re(e)):[...e]}function re(e){return ae(e)?e:RegExp(`^${oe(e)}(?:/.*)?$`)}function S(e){return Array.from(new Set(e))}function C(e){let t=new Set,n=[];for(let r of e){let e=ie(r);t.has(e)||(t.add(e),n.push(r))}return n}function ie(e){return typeof e==`string`?`string:${e}`:`regexp:${e.source}/${e.flags}`}function w(e){if(e.startsWith(`@`)){let[t,n]=e.split(`/`);return t&&n?`${t}/${n}`:e}let[t]=e.split(`/`);return t??e}function T(e){return e.startsWith(`node:`)?e.slice(5):e}function ae(e){return e.includes(`*`)||e.startsWith(`^`)||e.endsWith(`$`)}function oe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function se(e,t){let n=new Set(e.map(w)),r=t.filter(e=>n.has(w(e)));if(r.length!==0)throw Error(`Packages cannot be both external and bundled: ${r.join(`, `)}`)}function E(e,t){let n=new Set(e),r=t.filter(e=>n.has(w(e)));if(r.length!==0)throw Error(`Peer dependencies must stay external and cannot be bundled by default: ${r.join(`, `)}`)}function D(e){let t=new Set(u.builtinModules.map(T)),n=e.filter(e=>ce(e,t));if(n.length!==0)throw Error(`Node.js built-in modules cannot be bundled: ${n.join(`, `)}`)}function ce(e,t){let n=T(e),[r]=n.split(`/`);return r?t.has(r):t.has(n)}const le=/\u001B\[[0-9;]*m/g;var O=class{instance;constructor(e={}){this.instance=(0,d.createConsola)({level:e.enabled===!1?-999:999,formatOptions:{colors:!0,date:!1}})}title(e,t,n=[]){this.printPanel({title:`${e} ${t}`.trim(),renderedTitle:`${f.colors.cyan(f.colors.bold(e))}${t?` ${f.colors.dim(t)}`:``}`,rows:n,formatValue:f.colors.green})}panel(e,t,n){this.printPanel({title:n===void 0?e:`${e} ${n}`,renderedTitle:`${f.colors.cyan(f.colors.bold(e))}${n===void 0?``:` ${f.colors.green(String(n))}`}`,rows:t,formatValue:f.colors.dim})}step(e,t){return`${f.colors.cyan(e.padEnd(10,` `))}${t}`}duration(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(2)}s`}emptyLine(){this.instance.log(``)}log(e,...t){this.instance.log(e,...t)}info(e,...t){this.instance.info(e,...t)}start(e,...t){this.instance.start(e,...t)}success(e,...t){this.instance.success(e,...t)}warn(e,...t){this.instance.warn(e,...t)}error(e,...t){this.instance.error(e,...t)}debug(e,...t){this.instance.debug(e,...t)}printPanel(e){this.instance.log(this.formatPanel(e))}formatPanel(e){let t=this.getPanelWidth(e);return[this.formatPanelTop(e.renderedTitle,t),...e.rows.map(n=>this.formatPanelRow(n,t,e.formatValue)),this.formatPanelBottom(t)].join(`
2
- `)}formatPanelTop(e,t){let n=Math.max(1,t-this.visibleLength(e)-5);return`${f.colors.dim(`╭─`)} ${e} ${f.colors.dim(`─`.repeat(n))}${f.colors.dim(`╮`)}`}formatPanelBottom(e){return`${f.colors.dim(`╰`)}${f.colors.dim(`─`.repeat(e-2))}${f.colors.dim(`╯`)}`}formatPanelRow(e,t,n){let r=e.label.padEnd(14,` `),i=String(e.value),a=this.visibleLength(r)+this.visibleLength(i)+4,o=Math.max(0,t-a);return`${f.colors.dim(`│`)} ${f.colors.blue(r)}${n(i)}${` `.repeat(o)} ${f.colors.dim(`│`)}`}getPanelWidth(e){return Math.max(48,this.getTitleWidth(e),this.getRowsWidth(e.rows))}getTitleWidth(e){return this.visibleLength(e.title)+6}getRowsWidth(e){return Math.max(0,...e.map(e=>this.getRowWidth(e)))}getRowWidth(e){return 14+this.visibleLength(String(e.value))+4}visibleLength(e){return e.replace(le,``).length}};const k=`${{name:`buildplease`,displayName:`BuildPlease`,scope:`@buildplease`}.name}.Core.DI`,A={DI:{Formatter:{UnitController:Symbol.for(`${k}.Formatter.UnitController`)},Logger:Symbol.for(`${k}.Logger`)}};function ue(e){return e instanceof Error}function j(e,t={}){if(e==null)return{};let{filterNull:n=!0,filterUndefined:r=!0,filterEmptyString:i=!1,filterEmptyObject:a=!1,filterEmptyArray:o=!1}=t;return Object.keys(e).reduce((s,c)=>{let l=e[c];return M(l)&&Object.getPrototypeOf(l)===null&&(l=void 0),de(l)&&(l=j(l,t)),n&&l===null||r&&l===void 0||i&&l===``||a&&N(l)||o&&Array.isArray(l)&&l.length===0||(s[c]=l),s},{})}function M(e){return typeof e==`object`&&!!e}function N(e){return M(e)&&Object.keys(e).length===0}function de(e){return M(e)&&Object.getPrototypeOf(e)===Object.prototype}function fe(e){return e==null||[`string`,`number`,`boolean`,`bigint`,`symbol`].includes(typeof e)}Array.prototype.isEmpty=function(){return this==null||this.length===0},String.prototype.capitalized=function(){let e=this==null?``:this.toString();return e.trim()?e.charAt(0).toUpperCase()+e.slice(1):``};var P=class{streetLine1;streetLine2;postalCode;state;city;country;countryCode;constructor(e){this.streetLine1=e.streetLine1,this.streetLine2=e.streetLine2,this.postalCode=e.postalCode,this.state=e.state,this.city=e.city,this.country=e.country,this.countryCode=e.countryCode}toJSON(){return j({streetLine1:this.streetLine1,streetLine2:this.streetLine2,postalCode:this.postalCode,city:this.city,state:this.state,country:this.country,countryCode:this.countryCode},{filterNull:!0,filterUndefined:!0,filterEmptyString:!0})}formatted(){let e=(e,t)=>e.map(e=>e?.trim()).filter(e=>e&&e.length>0).join(t).trim(),t=this.streetLine1;return e([t,e([this.postalCode,this.city],` `),e([this.country],`, `)],`, `)}},F=class{email;fb;ig;phone;web;constructor({email:e,fb:t,ig:n,phone:r,web:i}){this.email=e,this.fb=t,this.ig=n,this.phone=r,this.web=i}toJSON(){return j({email:this.email,fb:this.fb,ig:this.ig,phone:this.phone,web:this.web},{filterNull:!0,filterUndefined:!0,filterEmptyString:!0})}},I=o({DateFormat:()=>R,DateTime:()=>L});c(I,require("date-fns"));var L=class e{date;constructor(e){if(!e){this.date=new Date;return}if(e instanceof Date){if(!(0,m.isValid)(e))throw Error(`Invalid date object`);this.date=e;return}let t=(0,m.parseISO)(e);if(!(0,m.isValid)(t))throw Error(`Invalid date string`);this.date=t}static fromUnixTimestamp(t,n){return new e((0,m.fromUnixTime)(t,n))}static now(){return new e(new Date)}toJSON(){return this.toISOString()}toDate(){return this.date}toUnixTimestamp(){return(0,m.getUnixTime)(this.date)}getTime(){return this.date.getTime()}toISOString(){return(0,m.formatISO)(this.date)}format(e,t){return(0,m.format)(this.date,e,t)}addingDuration(t){return new e((0,m.add)(this.date,t))}addingMilliseconds(t){return new e((0,m.addMilliseconds)(this.date,t))}addingSeconds(t){return new e((0,m.addSeconds)(this.date,t))}addingMinutes(t){return new e((0,m.addMinutes)(this.date,t))}addingHours(t){return new e((0,m.addHours)(this.date,t))}addingDays(t){return new e((0,m.addDays)(this.date,t))}addingWeeks(t){return new e((0,m.addWeeks)(this.date,t))}addingMonths(t){return new e((0,m.addMonths)(this.date,t))}addingYears(t){return new e((0,m.addYears)(this.date,t))}subtractingDuration(t){return new e((0,m.sub)(this.date,t))}subtractingMilliseconds(t){return new e((0,m.subMilliseconds)(this.date,t))}subtractingSeconds(t){return new e((0,m.subSeconds)(this.date,t))}subtractingMinutes(t){return new e((0,m.subMinutes)(this.date,t))}subtractingHours(t){return new e((0,m.subHours)(this.date,t))}subtractingDays(t){return new e((0,m.subDays)(this.date,t))}subtractingWeeks(t){return new e((0,m.subWeeks)(this.date,t))}subtractingMonths(t){return new e((0,m.subMonths)(this.date,t))}subtractingYears(t){return new e((0,m.subYears)(this.date,t))}differenceInMilliseconds(e){return(0,m.differenceInMilliseconds)(this.date,e.date)}differenceInSeconds(e){return(0,m.differenceInSeconds)(this.date,e.date)}differenceInMinutes(e){return(0,m.differenceInMinutes)(this.date,e.date)}differenceInHours(e){return(0,m.differenceInHours)(this.date,e.date)}differenceInDays(e){return(0,m.differenceInDays)(this.date,e.date)}differenceInWeeks(e){return(0,m.differenceInWeeks)(this.date,e.date)}differenceInMonths(e){return(0,m.differenceInMonths)(this.date,e.date)}differenceInYears(e){return(0,m.differenceInYears)(this.date,e.date)}isEqualTo(e){return(0,m.isEqual)(this.date,e.date)}isBefore(e){return(0,m.isBefore)(this.date,e.date)}isAfter(e){return(0,m.isAfter)(this.date,e.date)}compareTo(e){return(0,m.compareAsc)(this.date,e.date)}isSameDayAs(e){return(0,m.isSameDay)(this.date,e.date)}startOfDay(){return new e((0,m.startOfDay)(this.date))}endOfDay(){return new e((0,m.endOfDay)(this.date))}startOfWeek(){return new e((0,m.startOfWeek)(this.date))}endOfWeek(){return new e((0,m.endOfWeek)(this.date))}startOfMonth(){return new e((0,m.startOfMonth)(this.date))}endOfMonth(){return new e((0,m.endOfMonth)(this.date))}startOfYear(){return new e((0,m.startOfYear)(this.date))}endOfYear(){return new e((0,m.endOfYear)(this.date))}get dayOfMonth(){return(0,m.getDate)(this.date)}get dayOfWeek(){return(0,m.getDay)(this.date)}get month(){return(0,m.getMonth)(this.date)}get year(){return(0,m.getYear)(this.date)}get hours(){return(0,m.getHours)(this.date)}get minutes(){return(0,m.getMinutes)(this.date)}get seconds(){return(0,m.getSeconds)(this.date)}settingDayOfMonth(t){return new e((0,m.setDate)(this.date,t))}settingDayOfWeek(t){return new e((0,m.setDay)(this.date,t))}settingMonth(t){return new e((0,m.setMonth)(this.date,t))}settingYear(t){return new e((0,m.setYear)(this.date,t))}settingHours(t){return new e((0,m.setHours)(this.date,t))}settingMinutes(t){return new e((0,m.setMinutes)(this.date,t))}settingSeconds(t){return new e((0,m.setSeconds)(this.date,t))}};let R=function(e){return e.ISO_DATE=`yyyy-MM-dd`,e.ISO_DATETIME=`yyyy-MM-dd'T'HH:mm:ssXXX`,e.MM_DD_YYYY=`MM/dd/yyyy`,e.FULL_MONTH_DAY_YEAR=`MMMM d, yyyy`,e.ABBR_MONTH_DAY_YEAR=`MMM d, yyyy`,e.RFC_3339=`yyyy-MM-dd'T'HH:mm:ss.SSSxxx`,e.ALT_RSS=`d MMM yyyy HH:mm:ss ZZZ`,e.RSS=`EEE, d MMM yyyy HH:mm:ss ZZZ`,e.HTTP_HEADER=`EEE, dd MMM yyyy HH:mm:ss zzz`,e.STANDARD=`EEE MMM dd HH:mm:ss Z yyyy`,e.EXTENDED=`eee dd-MMM-yyyy GG HH:mm:ss.SSS zzz`,e}({});var z=class e{utc;timeZone;constructor(e,t){this.timeZone=e,this.utc=t??new Date}static fromUtc(t,n){return new e(n,t)}static fromLocalIso(t,n){let r=(0,h.fromZonedTime)(t,n);return new e(n,r)}format(e,t){return(0,h.formatInTimeZone)(this.utc,this.timeZone,e,t)}toLocalIsoMinutes(e){return this.format(`yyyy-MM-dd'T'HH:mm`,e)}toLocalIsoSeconds(e){return this.format(`yyyy-MM-dd'T'HH:mm:ss`,e)}toISOString(){return this.utc.toISOString()}toUnixTimestamp(){return Math.floor(this.utc.getTime()/1e3)}toZonedDate(){return(0,h.toZonedTime)(this.utc,this.timeZone)}timezoneOffsetMs(e){return(0,h.getTimezoneOffset)(this.timeZone,e??this.utc)}},B=class{value;constructor([e,t]){if(e<-180||e>180)throw Error(`Longitude must be between -180 and 180.`);if(t<-90||t>90)throw Error(`Latitude must be between -90 and 90.`);this.value=[e,t]}get longitude(){return this.value[0]}get latitude(){return this.value[1]}toJSON(){return this.value}},V=class{type=`Point`;coordinates;bbox;constructor(e,t){this.coordinates=e,this.bbox=t}toJSON(){return{type:this.type,coordinates:this.coordinates.toJSON(),...this.bbox&&{bbox:this.bbox}}}},pe=class{type=`MultiPoint`;coordinates;bbox;constructor(e,t){this.coordinates=e,this.bbox=t}toJSON(){return{type:this.type,coordinates:this.coordinates.map(e=>e.toJSON()),...this.bbox&&{bbox:this.bbox}}}},me=class{type=`LineString`;coordinates;bbox;constructor(e,t){this.coordinates=e,this.bbox=t}toJSON(){return{type:this.type,coordinates:this.coordinates.map(e=>e.toJSON()),...this.bbox&&{bbox:this.bbox}}}},he=class{type=`MultiLineString`;coordinates;bbox;constructor(e,t){this.coordinates=e,this.bbox=t}toJSON(){return{type:this.type,coordinates:this.coordinates.map(e=>e.map(e=>e.toJSON())),...this.bbox&&{bbox:this.bbox}}}},ge=class{type=`Polygon`;coordinates;bbox;constructor(e,t){this.coordinates=e,this.bbox=t}toJSON(){return{type:this.type,coordinates:this.coordinates.map(e=>e.map(e=>e.toJSON())),...this.bbox&&{bbox:this.bbox}}}},_e=class{type=`MultiPolygon`;coordinates;bbox;constructor(e,t){this.coordinates=e,this.bbox=t}toJSON(){return{type:this.type,coordinates:this.coordinates.map(e=>e.map(e=>e.map(e=>e.toJSON()))),...this.bbox&&{bbox:this.bbox}}}};let ve=function(e){return e.Point=`Point`,e.MultiPoint=`MultiPoint`,e.LineString=`LineString`,e.MultiLineString=`MultiLineString`,e.Polygon=`Polygon`,e.MultiPolygon=`MultiPolygon`,e}({});function H(e){return Error(`Invalid ObjectId value: ${String(e)}`)}var ye=class e{value;constructor(e){if(e==null)throw H(e);let t=e.trim();if(t.length===0)throw H(e);this.value=t,Object.freeze(this)}get asString(){return this.value}equals(t){return this.value===e.from(t).value}compare(t){let n=e.from(t).value;return this.value===n?0:this.value<n?-1:1}hash(){return this.value}toJSON(){return this.value}toString(){return this.value}[Symbol.toPrimitive](){return this.value}static from(t){return t instanceof e?t:new e(t)}static isValid(e){return typeof e==`string`&&e.trim().length>0}static toValueSet(t){let n=new Set;for(let r of t)n.add(e.from(r).value);return n}},be=class{day;intervals;constructor(e,t){this.day=e,this.intervals=t}toJSON(){return j({day:this.day,intervals:this.intervals},{filterNull:!0,filterUndefined:!0,filterEmptyString:!0})}},xe=class{_milliseconds;_long;constructor(e,t){if(this._long=t?.long===!0,e==null)throw Error(`Invalid interval format: ${e}`);if(typeof e==`number`)this._milliseconds=e;else{let t=(0,g.default)(e);if(t===void 0)throw Error(`Invalid interval format: ${e}`);this._milliseconds=t}}get milliseconds(){return this._milliseconds}get seconds(){return Math.floor(this._milliseconds/1e3)}get minutes(){return Math.floor(this._milliseconds/6e4)}get hours(){return Math.floor(this._milliseconds/36e5)}get days(){return Math.floor(this._milliseconds/864e5)}get weeks(){return Math.floor(this._milliseconds/6048e5)}get formatted(){return(0,g.default)(this._milliseconds,{long:this._long})}toString(){return(0,g.default)(this._milliseconds,{long:this._long})}toObject(){return{milliseconds:this._milliseconds,seconds:this.seconds,minutes:this.minutes,hours:this.hours,days:this.days,weeks:this.weeks}}};let Se=function(e){return e.Byte=`B`,e.Kilobyte=`KB`,e.Megabyte=`MB`,e.Gigabyte=`GB`,e.Terabyte=`TB`,e}({}),Ce=function(e){return e.Millimeter=`mm`,e.Centimeter=`cm`,e.Meter=`m`,e.Kilometer=`km`,e}({}),we=function(e){return e.Milligram=`mg`,e.Gram=`g`,e.Kilogram=`kg`,e.Tonne=`t`,e}({});c(o({Address:()=>P,ByteUnit:()=>Se,Contacts:()=>F,Coordinates:()=>B,DateFormat:()=>R,DateTime:()=>L,DistanceUnit:()=>Ce,GeoJsonType:()=>ve,LineString:()=>me,MultiLineString:()=>he,MultiPoint:()=>pe,MultiPolygon:()=>_e,ObjectId:()=>ye,OpeningHour:()=>be,Point:()=>V,Polygon:()=>ge,TimeInterval:()=>xe,WeightUnit:()=>we,ZonedDateTime:()=>z}),I);function U(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let W=class{formatBytes(e,t){let{inputUnit:n=`B`,outputUnit:r=`auto`,decimals:i=1}=t??{},a=e=>e===`B`?1:e===`KB`?1024:e===`MB`?1048576:e===`GB`?1073741824:1099511627776,o=e*a(n),s=r===`auto`?(()=>{for(let e of[`TB`,`GB`,`MB`,`KB`])if(o/a(e)>=1)return e;return`B`})():r,c=o/a(s),l=10**i;return{value:Math.round(c*l)/l,unit:s,bytes:o}}};W=U([(0,p.injectable)()],W);var Te=class{assemble(e){e.bind(A.DI.Formatter.UnitController).to(W)}};function Ee(){return[new Te]}let De=function(e){return e.Critical=`CRITICAL`,e.Serious=`SERIOUS`,e.Important=`IMPORTANT`,e.Notice=`NOTICE`,e.Routine=`ROUTINE`,e}({});function G(e,t){if(_.default.isAbsolute(t))return _.default.normalize(t);let n;try{let t=new URL(e);if(t.protocol!==`file:`)throw Error(`Unsupported URL protocol "${t.protocol}"`);n=_.default.dirname((0,ee.fileURLToPath)(t))}catch{n=e}return _.default.resolve(n,t)}function Oe(e,t={}){let n=G(process.cwd(),e);if(!v.default.existsSync(n))return;let r=v.default.statSync(n),{recursive:i=!0,force:a=!0,cleanOnly:o=!1}=t;if(o&&r.isDirectory()){for(let e of v.default.readdirSync(n))v.default.rmSync(_.default.join(n,e),{recursive:i,force:a});return}if(o&&r.isFile()){v.default.truncateSync(n,0);return}v.default.rmSync(n,{recursive:r.isDirectory()?i:!1,force:a,maxRetries:3,retryDelay:100})}function K(e){let t=G(process.cwd(),e),n=v.default.existsSync(t)&&v.default.statSync(t).isDirectory()?t:_.default.dirname(t);if(!v.default.existsSync(n))throw Error(`Directory "${n}" does not exist.`);return t}function ke(e){let t=G(process.cwd(),e);_.default.extname(e)&&console.warn(`[createDirectory] Warning: "${e}" looks like a file path.`);try{if(!v.default.existsSync(t))v.default.mkdirSync(t,{recursive:!0});else if(!v.default.statSync(t).isDirectory())throw Error(`"${t}" exists but is not a directory.`);return t}catch(e){throw Error(`Failed to create directory "${t}": ${e.message}`)}}function Ae(e,t=``){let n=G(process.cwd(),e);K(_.default.dirname(n));let r=je(n);if(!r)v.default.writeFileSync(n,t,{encoding:`utf8`,flag:`w`});else{if(!r.isFile())throw Error(`"${n}" exists but is not a file.`);t&&v.default.writeFileSync(n,t,{encoding:`utf8`,flag:`a`})}return n}function je(e){try{return v.default.statSync(e)}catch{return}}async function Me(e,t={}){let n=G(process.cwd(),e),r;try{r=await v.promises.stat(n)}catch(e){if((t.force??!0)&&e.code===`ENOENT`)return;throw e}let{recursive:i=!0,force:a=!0,cleanOnly:o=!1}=t;if(o&&r.isDirectory()){let e=await v.promises.readdir(n);for(let t of e)await v.promises.rm(_.default.join(n,t),{recursive:i,force:a});return}if(o&&r.isFile()){await v.promises.truncate(n,0);return}await v.promises.rm(n,{recursive:r.isDirectory()?i:!1,force:a,maxRetries:3,retryDelay:100})}async function q(e){let t=G(process.cwd(),e),n;try{n=await v.promises.stat(t)}catch{}let r=n?.isDirectory()?t:_.default.dirname(t);try{if(!(await v.promises.stat(r)).isDirectory())throw Error(`"${r}" exists but is not a directory.`)}catch(e){throw e.code===`ENOENT`?Error(`Directory "${r}" does not exist.`):e}return t}async function Ne(e){let t=G(process.cwd(),e);_.default.extname(e)&&console.warn(`[createDirectory] Warning: "${e}" looks like a file path (has extension).`);try{let e;try{e=await v.promises.stat(t)}catch{}if(!e)await v.promises.mkdir(t,{recursive:!0});else if(!e.isDirectory())throw Error(`"${t}" exists but is not a directory.`);return t}catch(e){throw Error(`Failed to create directory "${t}": ${e.message}`)}}async function Pe(e,t=``){let n=G(process.cwd(),e);await q(_.default.dirname(n));try{let e=await Fe(n);if(!e)await v.promises.writeFile(n,t,{encoding:`utf8`,flag:`w`});else{if(!e.isFile())throw Error(`"${n}" exists but is not a file.`);t&&await v.promises.writeFile(n,t,{encoding:`utf8`,flag:`a`})}return n}catch(e){throw Error(`Failed to create file "${n}": ${e.message}`)}}async function Fe(e){try{return await v.promises.stat(e)}catch(e){if(e.code===`ENOENT`)return;throw e}}const J={filterNull:!0,filterUndefined:!0,filterEmptyString:!0,filterEmptyArray:!0,filterEmptyObject:!0};var Y=class{options;instance;constructor(e){this.options=e,this.instance=this.makeInstance()}info(e,t){this.log(`info`,e,t)}debug(e,t){this.log(`debug`,e,t)}trace(e,t){this.log(`trace`,e,t)}warn(e,t){this.log(`warn`,e,t)}error(e,t){this.log(`error`,e,t)}fatal(e,t){this.log(`fatal`,e,t)}child(e){return this.instance.child(e)}log(e,t,n){this.instance[e]({msg:t,...this.formatLogOptions(n)})}formatLogOptions(e){return e?j({flag:e.flag,details:this.formatUnknown(e.details),error:this.formatUnknown(e.error),metadata:this.formatUnknown(e.metadata)},J):{}}formatUnknown(e){if(ue(e)){let t={type:e.constructor.name,message:e.message};this.options.debug&&e.stack&&(t.stack=e.stack);for(let n of Object.keys(e))n in t||(t[n]=e[n]);let n=j(t,J);return N(n)?void 0:n}if(Buffer.isBuffer(e))return`[Buffer]`;if(e&&typeof e.pipe==`function`)return`[Stream]`;if(M(e))try{let t=JSON.stringify(e);if(t===void 0)return;let n=JSON.parse(t);if(Array.isArray(n))return n.length>0?n:void 0;if(M(n)){let e=j(n,J);return N(e)?void 0:e}return n}catch{return{type:`NonSerializableObject`}}return fe(e)?e:String(e)}makeInstance(){if(!this.options.enabled)return(0,y.default)({enabled:!1,timestamp:!0});let e=this.options.transports,t={level:this.makeGlobalLogLevel(e),enabled:!0,timestamp:!0,transport:{targets:this.makeTransportTargets(e)}};return(0,y.default)(t)}makeTransportTargets(e){if(e.filter(e=>e.type===`console`).length>1)throw Error(`[Logger] Multiple console transports are not supported.`);return e.map(e=>{switch(e.type){case`console`:return this.makeConsoleTransportTarget(e);case`file`:return this.makeFileTransportTarget(e)}})}makeConsoleTransportTarget(e){return{target:`pino-pretty`,level:this.makeTransportLevel(e.level),options:e.pretty}}makeFileTransportTarget(e){let t=this.makeTransportLevel(e.level),n=_.default.isAbsolute(e.path)?_.default.normalize(e.path):G(process.cwd(),e.path);return K(_.default.dirname(n)),{target:`pino/file`,level:t,options:{destination:n}}}makeTransportLevel(e){return this.options.debug?`trace`:e??`info`}makeGlobalLogLevel(e){if(this.options.debug)return`trace`;let t=e.at(0);if(!t)return`info`;let n={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},r=this.makeTransportLevel(t.level);for(let t of e.slice(1)){let e=this.makeTransportLevel(t.level);n[e]<n[r]&&(r=e)}return r}},Ie=class{options;constructor(e){this.options=e}assemble(e){e.bind(A.DI.Logger).toConstantValue(new Y(this.options))}};function Le(e={}){let t=e.logger??{enabled:!1};return[...Ee(),new Ie(t)]}function X(e){return process.env[e]?.trim()||void 0}function Re(e){let t=X(e);if(!t)throw Error(`Missing required environment variable: ${e}`);return t}const Z=b.default.string().trim().min(1).transform(e=>{let{prefix:t,base:n}=ze(e),r=Be(n);return{original:e,prefix:t,base:n,kebab:Ve(r),snake:He(r),camel:Ue(r),pascal:We(r)}}),Q=b.default.looseObject({name:Z,version:b.default.string().trim().min(1),private:b.default.boolean().optional(),type:b.default.enum([`module`,`commonjs`]).optional(),dependencies:b.default.record(b.default.string(),b.default.string()).default({}),peerDependencies:b.default.record(b.default.string(),b.default.string()).default({}),devDependencies:b.default.record(b.default.string(),b.default.string()).default({})});function ze(e){let t=/^@([^/]+)\/(.+)$/.exec(e);return t&&t[2]?{prefix:t[1],base:t[2]}:{base:e}}function Be(e){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[^a-zA-Z0-9]+/g,` `).trim().toLowerCase();return t?t.split(/\s+/):[]}function Ve(e){return e.join(`-`)}function He(e){return e.join(`_`)}function Ue(e){if(e.length===0)return``;let[t,...n]=e;return t+n.map($).join(``)}function We(e){return e.map($).join(``)}function $(e){return e.length===0?``:e.charAt(0).toUpperCase()+e.slice(1)}function Ge(e){let t,n;try{t=v.default.readFileSync(e,`utf8`)}catch(t){throw Error(`Failed to read package.json at ${e}`,{cause:t})}try{n=JSON.parse(t)}catch(t){throw Error(`Failed to parse package.json at ${e}`,{cause:t})}try{return Q.parse(n)}catch(t){throw Error(`Invalid package.json at ${e}`,{cause:t})}}exports.Console=O,exports.LogFlag=De,exports.LoggerImpl=Y,exports.PackageJSONSchema=Q,exports.PackageNameSchema=Z,exports.coreNodeAssembly=Le,exports.createDirectory=ke,exports.createDirectoryAsync=Ne,exports.createFile=Ae,exports.createFileAsync=Pe,exports.ensureDirectory=K,exports.ensureDirectoryAsync=q,exports.loadPackageJSON=Ge,exports.makeDependencyBundlingPolicy=te,exports.optionalEnvironmentVariable=X,exports.removePath=Oe,exports.removePathAsync=Me,exports.requiredEnvironmentVariable=Re,exports.resolvePath=G;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(e,t,n)=>(s(e,t,`default`),n&&s(n,t,`default`)),l=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));let u=require("node:module"),d=require("consola"),f=require("consola/utils"),p=require("inversify"),m=require("date-fns"),h=require("date-fns-tz"),g=require("ms");g=l(g,1);let _=require("node:path");_=l(_,1);let v=require("node:fs");v=l(v,1);let ee=require("node:url"),y=require("pino");y=l(y,1);let b=require("zod");b=l(b,1);function te(e,t={}){let n=t.includePeers??!0,r=t.includeDependencies??!0,i=t.includeSubpaths??!0,a=t.includeNodeBuiltins??!0,o=t.allowPeerBundling??!1,s=Object.keys(e.peerDependencies??{}),c=Object.keys(e.dependencies??{}),l=S(t.bundle??[]),u=S(t.external??[]);O(u,l),oe(l),o||ae(s,l);let d=new Set(l.map(w)),f=n?s.filter(e=>!d.has(e)):[],p=r?c.filter(e=>!d.has(e)):[];return{external:C([...a?ne():[],...x([...f,...p,...u],i)]),bundle:C(x(l,i))}}function ne(){let e=S(u.builtinModules.map(T)),t=e.map(e=>`node:${e}`);return C([...e,...t,/^node:/])}function x(e,t){return t?e.map(e=>re(e)):[...e]}function re(e){return E(e)?e:RegExp(`^${D(e)}(?:/.*)?$`)}function S(e){return Array.from(new Set(e))}function C(e){let t=new Set,n=[];for(let r of e){let e=ie(r);t.has(e)||(t.add(e),n.push(r))}return n}function ie(e){return typeof e==`string`?`string:${e}`:`regexp:${e.source}/${e.flags}`}function w(e){if(e.startsWith(`@`)){let[t,n]=e.split(`/`);return t&&n?`${t}/${n}`:e}let[t]=e.split(`/`);return t??e}function T(e){return e.startsWith(`node:`)?e.slice(5):e}function E(e){return e.includes(`*`)||e.startsWith(`^`)||e.endsWith(`$`)}function D(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function O(e,t){let n=new Set(e.map(w)),r=t.filter(e=>n.has(w(e)));if(r.length!==0)throw Error(`Packages cannot be both external and bundled: ${r.join(`, `)}`)}function ae(e,t){let n=new Set(e),r=t.filter(e=>n.has(w(e)));if(r.length!==0)throw Error(`Peer dependencies must stay external and cannot be bundled by default: ${r.join(`, `)}`)}function oe(e){let t=new Set(u.builtinModules.map(T)),n=e.filter(e=>se(e,t));if(n.length!==0)throw Error(`Node.js built-in modules cannot be bundled: ${n.join(`, `)}`)}function se(e,t){let n=T(e),[r]=n.split(`/`);return r?t.has(r):t.has(n)}const ce=/\u001B\[[0-9;]*m/g;var le=class{instance;constructor(e={}){this.instance=(0,d.createConsola)({level:e.enabled===!1?-999:999,formatOptions:{colors:!0,date:!1}})}title(e,t,n=[]){this.printPanel({title:`${e} ${t}`.trim(),renderedTitle:`${f.colors.cyan(f.colors.bold(e))}${t?` ${f.colors.dim(t)}`:``}`,rows:n,formatValue:f.colors.green})}panel(e,t,n){this.printPanel({title:n===void 0?e:`${e} ${n}`,renderedTitle:`${f.colors.cyan(f.colors.bold(e))}${n===void 0?``:` ${f.colors.green(String(n))}`}`,rows:t,formatValue:f.colors.dim})}step(e,t){return`${f.colors.cyan(e.padEnd(10,` `))}${t}`}duration(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(2)}s`}emptyLine(){this.instance.log(``)}log(e,...t){this.instance.log(e,...t)}info(e,...t){this.instance.info(e,...t)}start(e,...t){this.instance.start(e,...t)}success(e,...t){this.instance.success(e,...t)}warn(e,...t){this.instance.warn(e,...t)}error(e,...t){this.instance.error(e,...t)}debug(e,...t){this.instance.debug(e,...t)}printPanel(e){this.instance.log(this.formatPanel(e))}formatPanel(e){let t=this.getPanelWidth(e);return[this.formatPanelTop(e.renderedTitle,t),...e.rows.map(n=>this.formatPanelRow(n,t,e.formatValue)),this.formatPanelBottom(t)].join(`
2
+ `)}formatPanelTop(e,t){let n=Math.max(1,t-this.visibleLength(e)-5);return`${f.colors.dim(`╭─`)} ${e} ${f.colors.dim(`─`.repeat(n))}${f.colors.dim(`╮`)}`}formatPanelBottom(e){return`${f.colors.dim(`╰`)}${f.colors.dim(`─`.repeat(e-2))}${f.colors.dim(`╯`)}`}formatPanelRow(e,t,n){let r=e.label.padEnd(14,` `),i=String(e.value),a=this.visibleLength(r)+this.visibleLength(i)+4,o=Math.max(0,t-a);return`${f.colors.dim(`│`)} ${f.colors.blue(r)}${n(i)}${` `.repeat(o)} ${f.colors.dim(`│`)}`}getPanelWidth(e){return Math.max(48,this.getTitleWidth(e),this.getRowsWidth(e.rows))}getTitleWidth(e){return this.visibleLength(e.title)+6}getRowsWidth(e){return Math.max(0,...e.map(e=>this.getRowWidth(e)))}getRowWidth(e){return 14+this.visibleLength(String(e.value))+4}visibleLength(e){return e.replace(ce,``).length}};const k=`${{name:`buildplease`,displayName:`BuildPlease`,scope:`@buildplease`}.name}.Core.DI`,A={DI:{Formatter:{UnitController:Symbol.for(`${k}.Formatter.UnitController`)},Logger:Symbol.for(`${k}.Logger`)}};function ue(e){return e instanceof Error}function j(e,t={}){if(e==null)return{};let{filterNull:n=!0,filterUndefined:r=!0,filterEmptyString:i=!1,filterEmptyObject:a=!1,filterEmptyArray:o=!1}=t;return Object.keys(e).reduce((s,c)=>{let l=e[c];return M(l)&&Object.getPrototypeOf(l)===null&&(l=void 0),de(l)&&(l=j(l,t)),n&&l===null||r&&l===void 0||i&&l===``||a&&N(l)||o&&Array.isArray(l)&&l.length===0||(s[c]=l),s},{})}function M(e){return typeof e==`object`&&!!e}function N(e){return M(e)&&Object.keys(e).length===0}function de(e){return M(e)&&Object.getPrototypeOf(e)===Object.prototype}function P(e){return e==null||[`string`,`number`,`boolean`,`bigint`,`symbol`].includes(typeof e)}Array.prototype.isEmpty=function(){return this==null||this.length===0},String.prototype.capitalized=function(){let e=this==null?``:this.toString();return e.trim()?e.charAt(0).toUpperCase()+e.slice(1):``};var F=class{streetLine1;streetLine2;postalCode;state;city;country;countryCode;constructor(e){this.streetLine1=e.streetLine1,this.streetLine2=e.streetLine2,this.postalCode=e.postalCode,this.state=e.state,this.city=e.city,this.country=e.country,this.countryCode=e.countryCode}toJSON(){return j({streetLine1:this.streetLine1,streetLine2:this.streetLine2,postalCode:this.postalCode,city:this.city,state:this.state,country:this.country,countryCode:this.countryCode},{filterNull:!0,filterUndefined:!0,filterEmptyString:!0})}formatted(){let e=(e,t)=>e.map(e=>e?.trim()).filter(e=>e&&e.length>0).join(t).trim(),t=this.streetLine1;return e([t,e([this.postalCode,this.city],` `),e([this.country],`, `)],`, `)}},I=class{email;fb;ig;phone;web;constructor({email:e,fb:t,ig:n,phone:r,web:i}){this.email=e,this.fb=t,this.ig=n,this.phone=r,this.web=i}toJSON(){return j({email:this.email,fb:this.fb,ig:this.ig,phone:this.phone,web:this.web},{filterNull:!0,filterUndefined:!0,filterEmptyString:!0})}},L=o({DateFormat:()=>z,DateTime:()=>R});c(L,require("date-fns"));var R=class e{date;constructor(e){if(!e){this.date=new Date;return}if(e instanceof Date){if(!(0,m.isValid)(e))throw Error(`Invalid date object`);this.date=e;return}let t=(0,m.parseISO)(e);if(!(0,m.isValid)(t))throw Error(`Invalid date string`);this.date=t}static fromUnixTimestamp(t,n){return new e((0,m.fromUnixTime)(t,n))}static now(){return new e(new Date)}toJSON(){return this.toISOString()}toDate(){return this.date}toUnixTimestamp(){return(0,m.getUnixTime)(this.date)}getTime(){return this.date.getTime()}toISOString(){return(0,m.formatISO)(this.date)}format(e,t){return(0,m.format)(this.date,e,t)}addingDuration(t){return new e((0,m.add)(this.date,t))}addingMilliseconds(t){return new e((0,m.addMilliseconds)(this.date,t))}addingSeconds(t){return new e((0,m.addSeconds)(this.date,t))}addingMinutes(t){return new e((0,m.addMinutes)(this.date,t))}addingHours(t){return new e((0,m.addHours)(this.date,t))}addingDays(t){return new e((0,m.addDays)(this.date,t))}addingWeeks(t){return new e((0,m.addWeeks)(this.date,t))}addingMonths(t){return new e((0,m.addMonths)(this.date,t))}addingYears(t){return new e((0,m.addYears)(this.date,t))}subtractingDuration(t){return new e((0,m.sub)(this.date,t))}subtractingMilliseconds(t){return new e((0,m.subMilliseconds)(this.date,t))}subtractingSeconds(t){return new e((0,m.subSeconds)(this.date,t))}subtractingMinutes(t){return new e((0,m.subMinutes)(this.date,t))}subtractingHours(t){return new e((0,m.subHours)(this.date,t))}subtractingDays(t){return new e((0,m.subDays)(this.date,t))}subtractingWeeks(t){return new e((0,m.subWeeks)(this.date,t))}subtractingMonths(t){return new e((0,m.subMonths)(this.date,t))}subtractingYears(t){return new e((0,m.subYears)(this.date,t))}differenceInMilliseconds(e){return(0,m.differenceInMilliseconds)(this.date,e.date)}differenceInSeconds(e){return(0,m.differenceInSeconds)(this.date,e.date)}differenceInMinutes(e){return(0,m.differenceInMinutes)(this.date,e.date)}differenceInHours(e){return(0,m.differenceInHours)(this.date,e.date)}differenceInDays(e){return(0,m.differenceInDays)(this.date,e.date)}differenceInWeeks(e){return(0,m.differenceInWeeks)(this.date,e.date)}differenceInMonths(e){return(0,m.differenceInMonths)(this.date,e.date)}differenceInYears(e){return(0,m.differenceInYears)(this.date,e.date)}isEqualTo(e){return(0,m.isEqual)(this.date,e.date)}isBefore(e){return(0,m.isBefore)(this.date,e.date)}isAfter(e){return(0,m.isAfter)(this.date,e.date)}compareTo(e){return(0,m.compareAsc)(this.date,e.date)}isSameDayAs(e){return(0,m.isSameDay)(this.date,e.date)}startOfDay(){return new e((0,m.startOfDay)(this.date))}endOfDay(){return new e((0,m.endOfDay)(this.date))}startOfWeek(){return new e((0,m.startOfWeek)(this.date))}endOfWeek(){return new e((0,m.endOfWeek)(this.date))}startOfMonth(){return new e((0,m.startOfMonth)(this.date))}endOfMonth(){return new e((0,m.endOfMonth)(this.date))}startOfYear(){return new e((0,m.startOfYear)(this.date))}endOfYear(){return new e((0,m.endOfYear)(this.date))}get dayOfMonth(){return(0,m.getDate)(this.date)}get dayOfWeek(){return(0,m.getDay)(this.date)}get month(){return(0,m.getMonth)(this.date)}get year(){return(0,m.getYear)(this.date)}get hours(){return(0,m.getHours)(this.date)}get minutes(){return(0,m.getMinutes)(this.date)}get seconds(){return(0,m.getSeconds)(this.date)}settingDayOfMonth(t){return new e((0,m.setDate)(this.date,t))}settingDayOfWeek(t){return new e((0,m.setDay)(this.date,t))}settingMonth(t){return new e((0,m.setMonth)(this.date,t))}settingYear(t){return new e((0,m.setYear)(this.date,t))}settingHours(t){return new e((0,m.setHours)(this.date,t))}settingMinutes(t){return new e((0,m.setMinutes)(this.date,t))}settingSeconds(t){return new e((0,m.setSeconds)(this.date,t))}};let z=function(e){return e.ISO_DATE=`yyyy-MM-dd`,e.ISO_DATETIME=`yyyy-MM-dd'T'HH:mm:ssXXX`,e.MM_DD_YYYY=`MM/dd/yyyy`,e.FULL_MONTH_DAY_YEAR=`MMMM d, yyyy`,e.ABBR_MONTH_DAY_YEAR=`MMM d, yyyy`,e.RFC_3339=`yyyy-MM-dd'T'HH:mm:ss.SSSxxx`,e.ALT_RSS=`d MMM yyyy HH:mm:ss ZZZ`,e.RSS=`EEE, d MMM yyyy HH:mm:ss ZZZ`,e.HTTP_HEADER=`EEE, dd MMM yyyy HH:mm:ss zzz`,e.STANDARD=`EEE MMM dd HH:mm:ss Z yyyy`,e.EXTENDED=`eee dd-MMM-yyyy GG HH:mm:ss.SSS zzz`,e}({});var B=class e{utc;timeZone;constructor(e,t){this.timeZone=e,this.utc=t??new Date}static fromUtc(t,n){return new e(n,t)}static fromLocalIso(t,n){let r=(0,h.fromZonedTime)(t,n);return new e(n,r)}format(e,t){return(0,h.formatInTimeZone)(this.utc,this.timeZone,e,t)}toLocalIsoMinutes(e){return this.format(`yyyy-MM-dd'T'HH:mm`,e)}toLocalIsoSeconds(e){return this.format(`yyyy-MM-dd'T'HH:mm:ss`,e)}toISOString(){return this.utc.toISOString()}toUnixTimestamp(){return Math.floor(this.utc.getTime()/1e3)}toZonedDate(){return(0,h.toZonedTime)(this.utc,this.timeZone)}timezoneOffsetMs(e){return(0,h.getTimezoneOffset)(this.timeZone,e??this.utc)}},V=class{value;constructor([e,t]){if(e<-180||e>180)throw Error(`Longitude must be between -180 and 180.`);if(t<-90||t>90)throw Error(`Latitude must be between -90 and 90.`);this.value=[e,t]}get longitude(){return this.value[0]}get latitude(){return this.value[1]}toJSON(){return this.value}},H=class{type=`Point`;coordinates;bbox;constructor(e,t){this.coordinates=e,this.bbox=t}toJSON(){return{type:this.type,coordinates:this.coordinates.toJSON(),...this.bbox&&{bbox:this.bbox}}}},fe=class{type=`MultiPoint`;coordinates;bbox;constructor(e,t){this.coordinates=e,this.bbox=t}toJSON(){return{type:this.type,coordinates:this.coordinates.map(e=>e.toJSON()),...this.bbox&&{bbox:this.bbox}}}},pe=class{type=`LineString`;coordinates;bbox;constructor(e,t){this.coordinates=e,this.bbox=t}toJSON(){return{type:this.type,coordinates:this.coordinates.map(e=>e.toJSON()),...this.bbox&&{bbox:this.bbox}}}},me=class{type=`MultiLineString`;coordinates;bbox;constructor(e,t){this.coordinates=e,this.bbox=t}toJSON(){return{type:this.type,coordinates:this.coordinates.map(e=>e.map(e=>e.toJSON())),...this.bbox&&{bbox:this.bbox}}}},he=class{type=`Polygon`;coordinates;bbox;constructor(e,t){this.coordinates=e,this.bbox=t}toJSON(){return{type:this.type,coordinates:this.coordinates.map(e=>e.map(e=>e.toJSON())),...this.bbox&&{bbox:this.bbox}}}},ge=class{type=`MultiPolygon`;coordinates;bbox;constructor(e,t){this.coordinates=e,this.bbox=t}toJSON(){return{type:this.type,coordinates:this.coordinates.map(e=>e.map(e=>e.map(e=>e.toJSON()))),...this.bbox&&{bbox:this.bbox}}}};let _e=function(e){return e.Point=`Point`,e.MultiPoint=`MultiPoint`,e.LineString=`LineString`,e.MultiLineString=`MultiLineString`,e.Polygon=`Polygon`,e.MultiPolygon=`MultiPolygon`,e}({});function U(e){return Error(`Invalid ObjectId value: ${String(e)}`)}var ve=class e{value;constructor(e){if(e==null)throw U(e);let t=e.trim();if(t.length===0)throw U(e);this.value=t,Object.freeze(this)}get asString(){return this.value}equals(t){return this.value===e.from(t).value}compare(t){let n=e.from(t).value;return this.value===n?0:this.value<n?-1:1}hash(){return this.value}toJSON(){return this.value}toString(){return this.value}[Symbol.toPrimitive](){return this.value}static from(t){return t instanceof e?t:new e(t)}static isValid(e){return typeof e==`string`&&e.trim().length>0}static toValueSet(t){let n=new Set;for(let r of t)n.add(e.from(r).value);return n}},ye=class{day;intervals;constructor(e,t){this.day=e,this.intervals=t}toJSON(){return j({day:this.day,intervals:this.intervals},{filterNull:!0,filterUndefined:!0,filterEmptyString:!0})}},be=class{_milliseconds;_long;constructor(e,t){if(this._long=t?.long===!0,e==null)throw Error(`Invalid interval format: ${e}`);if(typeof e==`number`)this._milliseconds=e;else{let t=(0,g.default)(e);if(t===void 0)throw Error(`Invalid interval format: ${e}`);this._milliseconds=t}}get milliseconds(){return this._milliseconds}get seconds(){return Math.floor(this._milliseconds/1e3)}get minutes(){return Math.floor(this._milliseconds/6e4)}get hours(){return Math.floor(this._milliseconds/36e5)}get days(){return Math.floor(this._milliseconds/864e5)}get weeks(){return Math.floor(this._milliseconds/6048e5)}get formatted(){return(0,g.default)(this._milliseconds,{long:this._long})}toString(){return(0,g.default)(this._milliseconds,{long:this._long})}toObject(){return{milliseconds:this._milliseconds,seconds:this.seconds,minutes:this.minutes,hours:this.hours,days:this.days,weeks:this.weeks}}};let xe=function(e){return e.Byte=`B`,e.Kilobyte=`KB`,e.Megabyte=`MB`,e.Gigabyte=`GB`,e.Terabyte=`TB`,e}({}),Se=function(e){return e.Millimeter=`mm`,e.Centimeter=`cm`,e.Meter=`m`,e.Kilometer=`km`,e}({}),Ce=function(e){return e.Milligram=`mg`,e.Gram=`g`,e.Kilogram=`kg`,e.Tonne=`t`,e}({});c(o({Address:()=>F,ByteUnit:()=>xe,Contacts:()=>I,Coordinates:()=>V,DateFormat:()=>z,DateTime:()=>R,DistanceUnit:()=>Se,GeoJsonType:()=>_e,LineString:()=>pe,MultiLineString:()=>me,MultiPoint:()=>fe,MultiPolygon:()=>ge,ObjectId:()=>ve,OpeningHour:()=>ye,Point:()=>H,Polygon:()=>he,TimeInterval:()=>be,WeightUnit:()=>Ce,ZonedDateTime:()=>B}),L);function we(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let W=class{formatBytes(e,t){let{inputUnit:n=`B`,outputUnit:r=`auto`,decimals:i=1}=t??{},a=e=>e===`B`?1:e===`KB`?1024:e===`MB`?1048576:e===`GB`?1073741824:1099511627776,o=e*a(n),s=r===`auto`?(()=>{for(let e of[`TB`,`GB`,`MB`,`KB`])if(o/a(e)>=1)return e;return`B`})():r,c=o/a(s),l=10**i;return{value:Math.round(c*l)/l,unit:s,bytes:o}}};W=we([(0,p.injectable)()],W);var Te=class{assemble(e){e.bind(A.DI.Formatter.UnitController).to(W)}};function Ee(){return[new Te]}let De=function(e){return e.Critical=`CRITICAL`,e.Serious=`SERIOUS`,e.Important=`IMPORTANT`,e.Notice=`NOTICE`,e.Routine=`ROUTINE`,e}({});function G(e,t){if(_.default.isAbsolute(t))return _.default.normalize(t);let n;try{let t=new URL(e);if(t.protocol!==`file:`)throw Error(`Unsupported URL protocol "${t.protocol}"`);n=_.default.dirname((0,ee.fileURLToPath)(t))}catch{n=e}return _.default.resolve(n,t)}function Oe(e,t={}){let n=G(process.cwd(),e);if(!v.default.existsSync(n))return;let r=v.default.statSync(n),{recursive:i=!0,force:a=!0,cleanOnly:o=!1}=t;if(o&&r.isDirectory()){for(let e of v.default.readdirSync(n))v.default.rmSync(_.default.join(n,e),{recursive:i,force:a});return}if(o&&r.isFile()){v.default.truncateSync(n,0);return}v.default.rmSync(n,{recursive:r.isDirectory()?i:!1,force:a,maxRetries:3,retryDelay:100})}function K(e){let t=G(process.cwd(),e),n=v.default.existsSync(t)&&v.default.statSync(t).isDirectory()?t:_.default.dirname(t);if(!v.default.existsSync(n))throw Error(`Directory "${n}" does not exist.`);return t}function ke(e){let t=G(process.cwd(),e);_.default.extname(e)&&console.warn(`[createDirectory] Warning: "${e}" looks like a file path.`);try{if(!v.default.existsSync(t))v.default.mkdirSync(t,{recursive:!0});else if(!v.default.statSync(t).isDirectory())throw Error(`"${t}" exists but is not a directory.`);return t}catch(e){throw Error(`Failed to create directory "${t}": ${e.message}`)}}function Ae(e,t=``){let n=G(process.cwd(),e);K(_.default.dirname(n));let r=je(n);if(!r)v.default.writeFileSync(n,t,{encoding:`utf8`,flag:`w`});else{if(!r.isFile())throw Error(`"${n}" exists but is not a file.`);t&&v.default.writeFileSync(n,t,{encoding:`utf8`,flag:`a`})}return n}function je(e){try{return v.default.statSync(e)}catch{return}}async function Me(e,t={}){let n=G(process.cwd(),e),r;try{r=await v.promises.stat(n)}catch(e){if((t.force??!0)&&e.code===`ENOENT`)return;throw e}let{recursive:i=!0,force:a=!0,cleanOnly:o=!1}=t;if(o&&r.isDirectory()){let e=await v.promises.readdir(n);for(let t of e)await v.promises.rm(_.default.join(n,t),{recursive:i,force:a});return}if(o&&r.isFile()){await v.promises.truncate(n,0);return}await v.promises.rm(n,{recursive:r.isDirectory()?i:!1,force:a,maxRetries:3,retryDelay:100})}async function q(e){let t=G(process.cwd(),e),n;try{n=await v.promises.stat(t)}catch{}let r=n?.isDirectory()?t:_.default.dirname(t);try{if(!(await v.promises.stat(r)).isDirectory())throw Error(`"${r}" exists but is not a directory.`)}catch(e){throw e.code===`ENOENT`?Error(`Directory "${r}" does not exist.`):e}return t}async function Ne(e){let t=G(process.cwd(),e);_.default.extname(e)&&console.warn(`[createDirectory] Warning: "${e}" looks like a file path (has extension).`);try{let e;try{e=await v.promises.stat(t)}catch{}if(!e)await v.promises.mkdir(t,{recursive:!0});else if(!e.isDirectory())throw Error(`"${t}" exists but is not a directory.`);return t}catch(e){throw Error(`Failed to create directory "${t}": ${e.message}`)}}async function Pe(e,t=``){let n=G(process.cwd(),e);await q(_.default.dirname(n));try{let e=await Fe(n);if(!e)await v.promises.writeFile(n,t,{encoding:`utf8`,flag:`w`});else{if(!e.isFile())throw Error(`"${n}" exists but is not a file.`);t&&await v.promises.writeFile(n,t,{encoding:`utf8`,flag:`a`})}return n}catch(e){throw Error(`Failed to create file "${n}": ${e.message}`)}}async function Fe(e){try{return await v.promises.stat(e)}catch(e){if(e.code===`ENOENT`)return;throw e}}var J=class{options;instance;constructor(e){this.options=e,this.instance=this.makeInstance()}info(e,t){this.log(`info`,e,t)}debug(e,t){this.log(`debug`,e,t)}trace(e,t){this.log(`trace`,e,t)}warn(e,t){this.log(`warn`,e,t)}error(e,t){this.log(`error`,e,t)}fatal(e,t){this.log(`fatal`,e,t)}child(e){return this.instance.child(e)}log(e,t,n){this.instance[e]({msg:t,...this.formatLogOptions(n)})}formatLogOptions(e){return e?this.normalizeObject({flag:e.flag,details:this.formatUnknown(e.details),error:this.formatUnknown(e.error),metadata:this.formatUnknown(e.metadata)}):{}}formatUnknown(e){if(ue(e)){let t={type:e.constructor.name,message:e.message};this.options.debug&&e.stack&&(t.stack=e.stack);for(let[n,r]of Object.entries(e))n in t||(t[n]=r);let n=this.normalizeObject(t);return N(n)?void 0:n}if(Buffer.isBuffer(e))return`[Buffer]`;if(e&&typeof e.pipe==`function`)return`[Stream]`;if(M(e))try{let t=JSON.stringify(e);if(t===void 0)return;let n=JSON.parse(t);if(Array.isArray(n))return n.length>0?n:void 0;if(M(n)){let e=this.normalizeObject(n);return N(e)?void 0:e}return n}catch{return{type:`NonSerializableObject`}}return P(e)?e:String(e)}normalizeObject(e){return j(Object.fromEntries(Object.entries(e)),{filterNull:!0,filterUndefined:!0,filterEmptyString:!0,filterEmptyArray:!0,filterEmptyObject:!0})}makeInstance(){if(!this.options.enabled)return(0,y.default)({enabled:!1,timestamp:!0});let e=this.options.transports,t={level:this.makeGlobalLogLevel(e),enabled:!0,timestamp:!0,transport:{targets:this.makeTransportTargets(e)}};return(0,y.default)(t)}makeTransportTargets(e){if(e.filter(e=>e.type===`console`).length>1)throw Error(`[Logger] Multiple console transports are not supported.`);return e.map(e=>{switch(e.type){case`console`:return this.makeConsoleTransportTarget(e);case`file`:return this.makeFileTransportTarget(e)}})}makeConsoleTransportTarget(e){return{target:`pino-pretty`,level:this.makeTransportLevel(e.level),options:e.pretty}}makeFileTransportTarget(e){let t=this.makeTransportLevel(e.level),n=_.default.isAbsolute(e.path)?_.default.normalize(e.path):G(process.cwd(),e.path);return K(_.default.dirname(n)),{target:`pino/file`,level:t,options:{destination:n}}}makeTransportLevel(e){return this.options.debug?`trace`:e??`info`}makeGlobalLogLevel(e){if(this.options.debug)return`trace`;let t=e.at(0);if(!t)return`info`;let n={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},r=this.makeTransportLevel(t.level);for(let t of e.slice(1)){let e=this.makeTransportLevel(t.level);n[e]<n[r]&&(r=e)}return r}},Ie=class{options;constructor(e){this.options=e}assemble(e){e.bind(A.DI.Logger).toConstantValue(new J(this.options))}};function Le(e={}){let t=e.logger??{enabled:!1};return[...Ee(),new Ie(t)]}function Y(e){return process.env[e]?.trim()||void 0}function Re(e){let t=Y(e);if(!t)throw Error(`Missing required environment variable: ${e}`);return t}const X=b.default.string().trim().min(1).transform(e=>{let{prefix:t,base:n}=Q(e),r=ze(n);return{original:e,prefix:t,base:n,kebab:Be(r),snake:Ve(r),camel:He(r),pascal:Ue(r)}}),Z=b.default.looseObject({name:X,version:b.default.string().trim().min(1),private:b.default.boolean().optional(),type:b.default.enum([`module`,`commonjs`]).optional(),dependencies:b.default.record(b.default.string(),b.default.string()).default({}),peerDependencies:b.default.record(b.default.string(),b.default.string()).default({}),devDependencies:b.default.record(b.default.string(),b.default.string()).default({})});function Q(e){let t=/^@([^/]+)\/(.+)$/.exec(e);return t&&t[2]?{prefix:t[1],base:t[2]}:{base:e}}function ze(e){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[^a-zA-Z0-9]+/g,` `).trim().toLowerCase();return t?t.split(/\s+/):[]}function Be(e){return e.join(`-`)}function Ve(e){return e.join(`_`)}function He(e){if(e.length===0)return``;let[t,...n]=e;return t+n.map($).join(``)}function Ue(e){return e.map($).join(``)}function $(e){return e.length===0?``:e.charAt(0).toUpperCase()+e.slice(1)}function We(e){let t,n;try{t=v.default.readFileSync(e,`utf8`)}catch(t){throw Error(`Failed to read package.json at ${e}`,{cause:t})}try{n=JSON.parse(t)}catch(t){throw Error(`Failed to parse package.json at ${e}`,{cause:t})}try{return Z.parse(n)}catch(t){throw Error(`Invalid package.json at ${e}`,{cause:t})}}exports.Console=le,exports.LogFlag=De,exports.LoggerImpl=J,exports.PackageJSONSchema=Z,exports.PackageNameSchema=X,exports.coreNodeAssembly=Le,exports.createDirectory=ke,exports.createDirectoryAsync=Ne,exports.createFile=Ae,exports.createFileAsync=Pe,exports.ensureDirectory=K,exports.ensureDirectoryAsync=q,exports.loadPackageJSON=We,exports.makeDependencyBundlingPolicy=te,exports.optionalEnvironmentVariable=Y,exports.removePath=Oe,exports.removePathAsync=Me,exports.requiredEnvironmentVariable=Re,exports.resolvePath=G;
@@ -261,6 +261,7 @@ declare class LoggerImpl implements Logger {
261
261
  private log;
262
262
  private formatLogOptions;
263
263
  private formatUnknown;
264
+ private normalizeObject;
264
265
  private makeInstance;
265
266
  private makeTransportTargets;
266
267
  private makeConsoleTransportTarget;
@@ -261,6 +261,7 @@ declare class LoggerImpl implements Logger {
261
261
  private log;
262
262
  private formatLogOptions;
263
263
  private formatUnknown;
264
+ private normalizeObject;
264
265
  private makeInstance;
265
266
  private makeTransportTargets;
266
267
  private makeConsoleTransportTarget;
@@ -1,2 +1,2 @@
1
- import{builtinModules as e}from"node:module";import{createConsola as t}from"consola";import{colors as n}from"consola/utils";import{injectable as r}from"inversify";import{add as i,addDays as a,addHours as o,addMilliseconds as s,addMinutes as c,addMonths as l,addSeconds as u,addWeeks as d,addYears as f,compareAsc as p,differenceInDays as ee,differenceInHours as te,differenceInMilliseconds as ne,differenceInMinutes as re,differenceInMonths as ie,differenceInSeconds as ae,differenceInWeeks as oe,differenceInYears as se,endOfDay as ce,endOfMonth as m,endOfWeek as le,endOfYear as ue,format as de,formatISO as fe,fromUnixTime as pe,getDate as me,getDay as he,getHours as ge,getMinutes as _e,getMonth as ve,getSeconds as ye,getUnixTime as be,getYear as xe,isAfter as Se,isBefore as Ce,isEqual as we,isSameDay as Te,isValid as h,parseISO as Ee,setDate as De,setDay as Oe,setHours as ke,setMinutes as Ae,setMonth as je,setSeconds as Me,setYear as Ne,startOfDay as Pe,startOfMonth as g,startOfWeek as _,startOfYear as v,sub as y,subDays as Fe,subHours as Ie,subMilliseconds as Le,subMinutes as Re,subMonths as ze,subSeconds as Be,subWeeks as Ve,subYears as He}from"date-fns";import{formatInTimeZone as Ue,fromZonedTime as We,getTimezoneOffset as Ge,toZonedTime as Ke}from"date-fns-tz";import b from"ms";import x from"node:path";import S,{promises as C}from"node:fs";import{fileURLToPath as qe}from"node:url";import w from"pino";import T from"zod";var E=Object.defineProperty,Je=Object.getOwnPropertyDescriptor,Ye=Object.getOwnPropertyNames,Xe=Object.prototype.hasOwnProperty,D=(e,t)=>{let n={};for(var r in e)E(n,r,{get:e[r],enumerable:!0});return t||E(n,Symbol.toStringTag,{value:`Module`}),n},O=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Ye(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Xe.call(e,s)&&s!==n&&E(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Je(t,s))||r.enumerable});return e},k=(e,t,n)=>(O(e,t,`default`),n&&O(n,t,`default`));function Ze(e,t={}){let n=t.includePeers??!0,r=t.includeDependencies??!0,i=t.includeSubpaths??!0,a=t.includeNodeBuiltins??!0,o=t.allowPeerBundling??!1,s=Object.keys(e.peerDependencies??{}),c=Object.keys(e.dependencies??{}),l=j(t.bundle??[]),u=j(t.external??[]);rt(u,l),at(l),o||it(s,l);let d=new Set(l.map(N)),f=n?s.filter(e=>!d.has(e)):[],p=r?c.filter(e=>!d.has(e)):[];return{external:M([...a?Qe():[],...A([...f,...p,...u],i)]),bundle:M(A(l,i))}}function Qe(){let t=j(e.map(P)),n=t.map(e=>`node:${e}`);return M([...t,...n,/^node:/])}function A(e,t){return t?e.map(e=>$e(e)):[...e]}function $e(e){return tt(e)?e:RegExp(`^${nt(e)}(?:/.*)?$`)}function j(e){return Array.from(new Set(e))}function M(e){let t=new Set,n=[];for(let r of e){let e=et(r);t.has(e)||(t.add(e),n.push(r))}return n}function et(e){return typeof e==`string`?`string:${e}`:`regexp:${e.source}/${e.flags}`}function N(e){if(e.startsWith(`@`)){let[t,n]=e.split(`/`);return t&&n?`${t}/${n}`:e}let[t]=e.split(`/`);return t??e}function P(e){return e.startsWith(`node:`)?e.slice(5):e}function tt(e){return e.includes(`*`)||e.startsWith(`^`)||e.endsWith(`$`)}function nt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function rt(e,t){let n=new Set(e.map(N)),r=t.filter(e=>n.has(N(e)));if(r.length!==0)throw Error(`Packages cannot be both external and bundled: ${r.join(`, `)}`)}function it(e,t){let n=new Set(e),r=t.filter(e=>n.has(N(e)));if(r.length!==0)throw Error(`Peer dependencies must stay external and cannot be bundled by default: ${r.join(`, `)}`)}function at(t){let n=new Set(e.map(P)),r=t.filter(e=>ot(e,n));if(r.length!==0)throw Error(`Node.js built-in modules cannot be bundled: ${r.join(`, `)}`)}function ot(e,t){let n=P(e),[r]=n.split(`/`);return r?t.has(r):t.has(n)}const st=/\u001B\[[0-9;]*m/g;var ct=class{instance;constructor(e={}){this.instance=t({level:e.enabled===!1?-999:999,formatOptions:{colors:!0,date:!1}})}title(e,t,r=[]){this.printPanel({title:`${e} ${t}`.trim(),renderedTitle:`${n.cyan(n.bold(e))}${t?` ${n.dim(t)}`:``}`,rows:r,formatValue:n.green})}panel(e,t,r){this.printPanel({title:r===void 0?e:`${e} ${r}`,renderedTitle:`${n.cyan(n.bold(e))}${r===void 0?``:` ${n.green(String(r))}`}`,rows:t,formatValue:n.dim})}step(e,t){return`${n.cyan(e.padEnd(10,` `))}${t}`}duration(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(2)}s`}emptyLine(){this.instance.log(``)}log(e,...t){this.instance.log(e,...t)}info(e,...t){this.instance.info(e,...t)}start(e,...t){this.instance.start(e,...t)}success(e,...t){this.instance.success(e,...t)}warn(e,...t){this.instance.warn(e,...t)}error(e,...t){this.instance.error(e,...t)}debug(e,...t){this.instance.debug(e,...t)}printPanel(e){this.instance.log(this.formatPanel(e))}formatPanel(e){let t=this.getPanelWidth(e);return[this.formatPanelTop(e.renderedTitle,t),...e.rows.map(n=>this.formatPanelRow(n,t,e.formatValue)),this.formatPanelBottom(t)].join(`
2
- `)}formatPanelTop(e,t){let r=Math.max(1,t-this.visibleLength(e)-5);return`${n.dim(`╭─`)} ${e} ${n.dim(`─`.repeat(r))}${n.dim(`╮`)}`}formatPanelBottom(e){return`${n.dim(`╰`)}${n.dim(`─`.repeat(e-2))}${n.dim(`╯`)}`}formatPanelRow(e,t,r){let i=e.label.padEnd(14,` `),a=String(e.value),o=this.visibleLength(i)+this.visibleLength(a)+4,s=Math.max(0,t-o);return`${n.dim(`│`)} ${n.blue(i)}${r(a)}${` `.repeat(s)} ${n.dim(`│`)}`}getPanelWidth(e){return Math.max(48,this.getTitleWidth(e),this.getRowsWidth(e.rows))}getTitleWidth(e){return this.visibleLength(e.title)+6}getRowsWidth(e){return Math.max(0,...e.map(e=>this.getRowWidth(e)))}getRowWidth(e){return 14+this.visibleLength(String(e.value))+4}visibleLength(e){return e.replace(st,``).length}};const F=`${{name:`buildplease`,displayName:`BuildPlease`,scope:`@buildplease`}.name}.Core.DI`,I={DI:{Formatter:{UnitController:Symbol.for(`${F}.Formatter.UnitController`)},Logger:Symbol.for(`${F}.Logger`)}};function lt(e){return e instanceof Error}function L(e,t={}){if(e==null)return{};let{filterNull:n=!0,filterUndefined:r=!0,filterEmptyString:i=!1,filterEmptyObject:a=!1,filterEmptyArray:o=!1}=t;return Object.keys(e).reduce((s,c)=>{let l=e[c];return R(l)&&Object.getPrototypeOf(l)===null&&(l=void 0),ut(l)&&(l=L(l,t)),n&&l===null||r&&l===void 0||i&&l===``||a&&z(l)||o&&Array.isArray(l)&&l.length===0||(s[c]=l),s},{})}function R(e){return typeof e==`object`&&!!e}function z(e){return R(e)&&Object.keys(e).length===0}function ut(e){return R(e)&&Object.getPrototypeOf(e)===Object.prototype}function dt(e){return e==null||[`string`,`number`,`boolean`,`bigint`,`symbol`].includes(typeof e)}Array.prototype.isEmpty=function(){return this==null||this.length===0},String.prototype.capitalized=function(){let e=this==null?``:this.toString();return e.trim()?e.charAt(0).toUpperCase()+e.slice(1):``};var ft=class{streetLine1;streetLine2;postalCode;state;city;country;countryCode;constructor(e){this.streetLine1=e.streetLine1,this.streetLine2=e.streetLine2,this.postalCode=e.postalCode,this.state=e.state,this.city=e.city,this.country=e.country,this.countryCode=e.countryCode}toJSON(){return L({streetLine1:this.streetLine1,streetLine2:this.streetLine2,postalCode:this.postalCode,city:this.city,state:this.state,country:this.country,countryCode:this.countryCode},{filterNull:!0,filterUndefined:!0,filterEmptyString:!0})}formatted(){let e=(e,t)=>e.map(e=>e?.trim()).filter(e=>e&&e.length>0).join(t).trim(),t=this.streetLine1;return e([t,e([this.postalCode,this.city],` `),e([this.country],`, `)],`, `)}},pt=class{email;fb;ig;phone;web;constructor({email:e,fb:t,ig:n,phone:r,web:i}){this.email=e,this.fb=t,this.ig=n,this.phone=r,this.web=i}toJSON(){return L({email:this.email,fb:this.fb,ig:this.ig,phone:this.phone,web:this.web},{filterNull:!0,filterUndefined:!0,filterEmptyString:!0})}},B=D({DateFormat:()=>H,DateTime:()=>V});import*as mt from"date-fns";k(B,mt);var V=class e{date;constructor(e){if(!e){this.date=new Date;return}if(e instanceof Date){if(!h(e))throw Error(`Invalid date object`);this.date=e;return}let t=Ee(e);if(!h(t))throw Error(`Invalid date string`);this.date=t}static fromUnixTimestamp(t,n){return new e(pe(t,n))}static now(){return new e(new Date)}toJSON(){return this.toISOString()}toDate(){return this.date}toUnixTimestamp(){return be(this.date)}getTime(){return this.date.getTime()}toISOString(){return fe(this.date)}format(e,t){return de(this.date,e,t)}addingDuration(t){return new e(i(this.date,t))}addingMilliseconds(t){return new e(s(this.date,t))}addingSeconds(t){return new e(u(this.date,t))}addingMinutes(t){return new e(c(this.date,t))}addingHours(t){return new e(o(this.date,t))}addingDays(t){return new e(a(this.date,t))}addingWeeks(t){return new e(d(this.date,t))}addingMonths(t){return new e(l(this.date,t))}addingYears(t){return new e(f(this.date,t))}subtractingDuration(t){return new e(y(this.date,t))}subtractingMilliseconds(t){return new e(Le(this.date,t))}subtractingSeconds(t){return new e(Be(this.date,t))}subtractingMinutes(t){return new e(Re(this.date,t))}subtractingHours(t){return new e(Ie(this.date,t))}subtractingDays(t){return new e(Fe(this.date,t))}subtractingWeeks(t){return new e(Ve(this.date,t))}subtractingMonths(t){return new e(ze(this.date,t))}subtractingYears(t){return new e(He(this.date,t))}differenceInMilliseconds(e){return ne(this.date,e.date)}differenceInSeconds(e){return ae(this.date,e.date)}differenceInMinutes(e){return re(this.date,e.date)}differenceInHours(e){return te(this.date,e.date)}differenceInDays(e){return ee(this.date,e.date)}differenceInWeeks(e){return oe(this.date,e.date)}differenceInMonths(e){return ie(this.date,e.date)}differenceInYears(e){return se(this.date,e.date)}isEqualTo(e){return we(this.date,e.date)}isBefore(e){return Ce(this.date,e.date)}isAfter(e){return Se(this.date,e.date)}compareTo(e){return p(this.date,e.date)}isSameDayAs(e){return Te(this.date,e.date)}startOfDay(){return new e(Pe(this.date))}endOfDay(){return new e(ce(this.date))}startOfWeek(){return new e(_(this.date))}endOfWeek(){return new e(le(this.date))}startOfMonth(){return new e(g(this.date))}endOfMonth(){return new e(m(this.date))}startOfYear(){return new e(v(this.date))}endOfYear(){return new e(ue(this.date))}get dayOfMonth(){return me(this.date)}get dayOfWeek(){return he(this.date)}get month(){return ve(this.date)}get year(){return xe(this.date)}get hours(){return ge(this.date)}get minutes(){return _e(this.date)}get seconds(){return ye(this.date)}settingDayOfMonth(t){return new e(De(this.date,t))}settingDayOfWeek(t){return new e(Oe(this.date,t))}settingMonth(t){return new e(je(this.date,t))}settingYear(t){return new e(Ne(this.date,t))}settingHours(t){return new e(ke(this.date,t))}settingMinutes(t){return new e(Ae(this.date,t))}settingSeconds(t){return new e(Me(this.date,t))}};let H=function(e){return e.ISO_DATE=`yyyy-MM-dd`,e.ISO_DATETIME=`yyyy-MM-dd'T'HH:mm:ssXXX`,e.MM_DD_YYYY=`MM/dd/yyyy`,e.FULL_MONTH_DAY_YEAR=`MMMM d, yyyy`,e.ABBR_MONTH_DAY_YEAR=`MMM d, yyyy`,e.RFC_3339=`yyyy-MM-dd'T'HH:mm:ss.SSSxxx`,e.ALT_RSS=`d MMM yyyy HH:mm:ss ZZZ`,e.RSS=`EEE, d MMM yyyy HH:mm:ss ZZZ`,e.HTTP_HEADER=`EEE, dd MMM yyyy HH:mm:ss zzz`,e.STANDARD=`EEE MMM dd HH:mm:ss Z yyyy`,e.EXTENDED=`eee dd-MMM-yyyy GG HH:mm:ss.SSS zzz`,e}({});var ht=class e{utc;timeZone;constructor(e,t){this.timeZone=e,this.utc=t??new Date}static fromUtc(t,n){return new e(n,t)}static fromLocalIso(t,n){let r=We(t,n);return new e(n,r)}format(e,t){return Ue(this.utc,this.timeZone,e,t)}toLocalIsoMinutes(e){return this.format(`yyyy-MM-dd'T'HH:mm`,e)}toLocalIsoSeconds(e){return this.format(`yyyy-MM-dd'T'HH:mm:ss`,e)}toISOString(){return this.utc.toISOString()}toUnixTimestamp(){return Math.floor(this.utc.getTime()/1e3)}toZonedDate(){return Ke(this.utc,this.timeZone)}timezoneOffsetMs(e){return Ge(this.timeZone,e??this.utc)}},gt=class{value;constructor([e,t]){if(e<-180||e>180)throw Error(`Longitude must be between -180 and 180.`);if(t<-90||t>90)throw Error(`Latitude must be between -90 and 90.`);this.value=[e,t]}get longitude(){return this.value[0]}get latitude(){return this.value[1]}toJSON(){return this.value}},_t=class{type=`Point`;coordinates;bbox;constructor(e,t){this.coordinates=e,this.bbox=t}toJSON(){return{type:this.type,coordinates:this.coordinates.toJSON(),...this.bbox&&{bbox:this.bbox}}}},vt=class{type=`MultiPoint`;coordinates;bbox;constructor(e,t){this.coordinates=e,this.bbox=t}toJSON(){return{type:this.type,coordinates:this.coordinates.map(e=>e.toJSON()),...this.bbox&&{bbox:this.bbox}}}},yt=class{type=`LineString`;coordinates;bbox;constructor(e,t){this.coordinates=e,this.bbox=t}toJSON(){return{type:this.type,coordinates:this.coordinates.map(e=>e.toJSON()),...this.bbox&&{bbox:this.bbox}}}},bt=class{type=`MultiLineString`;coordinates;bbox;constructor(e,t){this.coordinates=e,this.bbox=t}toJSON(){return{type:this.type,coordinates:this.coordinates.map(e=>e.map(e=>e.toJSON())),...this.bbox&&{bbox:this.bbox}}}},xt=class{type=`Polygon`;coordinates;bbox;constructor(e,t){this.coordinates=e,this.bbox=t}toJSON(){return{type:this.type,coordinates:this.coordinates.map(e=>e.map(e=>e.toJSON())),...this.bbox&&{bbox:this.bbox}}}},St=class{type=`MultiPolygon`;coordinates;bbox;constructor(e,t){this.coordinates=e,this.bbox=t}toJSON(){return{type:this.type,coordinates:this.coordinates.map(e=>e.map(e=>e.map(e=>e.toJSON()))),...this.bbox&&{bbox:this.bbox}}}};let Ct=function(e){return e.Point=`Point`,e.MultiPoint=`MultiPoint`,e.LineString=`LineString`,e.MultiLineString=`MultiLineString`,e.Polygon=`Polygon`,e.MultiPolygon=`MultiPolygon`,e}({});function U(e){return Error(`Invalid ObjectId value: ${String(e)}`)}var wt=class e{value;constructor(e){if(e==null)throw U(e);let t=e.trim();if(t.length===0)throw U(e);this.value=t,Object.freeze(this)}get asString(){return this.value}equals(t){return this.value===e.from(t).value}compare(t){let n=e.from(t).value;return this.value===n?0:this.value<n?-1:1}hash(){return this.value}toJSON(){return this.value}toString(){return this.value}[Symbol.toPrimitive](){return this.value}static from(t){return t instanceof e?t:new e(t)}static isValid(e){return typeof e==`string`&&e.trim().length>0}static toValueSet(t){let n=new Set;for(let r of t)n.add(e.from(r).value);return n}},Tt=class{day;intervals;constructor(e,t){this.day=e,this.intervals=t}toJSON(){return L({day:this.day,intervals:this.intervals},{filterNull:!0,filterUndefined:!0,filterEmptyString:!0})}},Et=class{_milliseconds;_long;constructor(e,t){if(this._long=t?.long===!0,e==null)throw Error(`Invalid interval format: ${e}`);if(typeof e==`number`)this._milliseconds=e;else{let t=b(e);if(t===void 0)throw Error(`Invalid interval format: ${e}`);this._milliseconds=t}}get milliseconds(){return this._milliseconds}get seconds(){return Math.floor(this._milliseconds/1e3)}get minutes(){return Math.floor(this._milliseconds/6e4)}get hours(){return Math.floor(this._milliseconds/36e5)}get days(){return Math.floor(this._milliseconds/864e5)}get weeks(){return Math.floor(this._milliseconds/6048e5)}get formatted(){return b(this._milliseconds,{long:this._long})}toString(){return b(this._milliseconds,{long:this._long})}toObject(){return{milliseconds:this._milliseconds,seconds:this.seconds,minutes:this.minutes,hours:this.hours,days:this.days,weeks:this.weeks}}};let Dt=function(e){return e.Byte=`B`,e.Kilobyte=`KB`,e.Megabyte=`MB`,e.Gigabyte=`GB`,e.Terabyte=`TB`,e}({}),Ot=function(e){return e.Millimeter=`mm`,e.Centimeter=`cm`,e.Meter=`m`,e.Kilometer=`km`,e}({}),kt=function(e){return e.Milligram=`mg`,e.Gram=`g`,e.Kilogram=`kg`,e.Tonne=`t`,e}({});k(D({Address:()=>ft,ByteUnit:()=>Dt,Contacts:()=>pt,Coordinates:()=>gt,DateFormat:()=>H,DateTime:()=>V,DistanceUnit:()=>Ot,GeoJsonType:()=>Ct,LineString:()=>yt,MultiLineString:()=>bt,MultiPoint:()=>vt,MultiPolygon:()=>St,ObjectId:()=>wt,OpeningHour:()=>Tt,Point:()=>_t,Polygon:()=>xt,TimeInterval:()=>Et,WeightUnit:()=>kt,ZonedDateTime:()=>ht}),B);function At(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let W=class{formatBytes(e,t){let{inputUnit:n=`B`,outputUnit:r=`auto`,decimals:i=1}=t??{},a=e=>e===`B`?1:e===`KB`?1024:e===`MB`?1048576:e===`GB`?1073741824:1099511627776,o=e*a(n),s=r===`auto`?(()=>{for(let e of[`TB`,`GB`,`MB`,`KB`])if(o/a(e)>=1)return e;return`B`})():r,c=o/a(s),l=10**i;return{value:Math.round(c*l)/l,unit:s,bytes:o}}};W=At([r()],W);var jt=class{assemble(e){e.bind(I.DI.Formatter.UnitController).to(W)}};function Mt(){return[new jt]}let Nt=function(e){return e.Critical=`CRITICAL`,e.Serious=`SERIOUS`,e.Important=`IMPORTANT`,e.Notice=`NOTICE`,e.Routine=`ROUTINE`,e}({});function G(e,t){if(x.isAbsolute(t))return x.normalize(t);let n;try{let t=new URL(e);if(t.protocol!==`file:`)throw Error(`Unsupported URL protocol "${t.protocol}"`);n=x.dirname(qe(t))}catch{n=e}return x.resolve(n,t)}function Pt(e,t={}){let n=G(process.cwd(),e);if(!S.existsSync(n))return;let r=S.statSync(n),{recursive:i=!0,force:a=!0,cleanOnly:o=!1}=t;if(o&&r.isDirectory()){for(let e of S.readdirSync(n))S.rmSync(x.join(n,e),{recursive:i,force:a});return}if(o&&r.isFile()){S.truncateSync(n,0);return}S.rmSync(n,{recursive:r.isDirectory()?i:!1,force:a,maxRetries:3,retryDelay:100})}function K(e){let t=G(process.cwd(),e),n=S.existsSync(t)&&S.statSync(t).isDirectory()?t:x.dirname(t);if(!S.existsSync(n))throw Error(`Directory "${n}" does not exist.`);return t}function Ft(e){let t=G(process.cwd(),e);x.extname(e)&&console.warn(`[createDirectory] Warning: "${e}" looks like a file path.`);try{if(!S.existsSync(t))S.mkdirSync(t,{recursive:!0});else if(!S.statSync(t).isDirectory())throw Error(`"${t}" exists but is not a directory.`);return t}catch(e){throw Error(`Failed to create directory "${t}": ${e.message}`)}}function It(e,t=``){let n=G(process.cwd(),e);K(x.dirname(n));let r=Lt(n);if(!r)S.writeFileSync(n,t,{encoding:`utf8`,flag:`w`});else{if(!r.isFile())throw Error(`"${n}" exists but is not a file.`);t&&S.writeFileSync(n,t,{encoding:`utf8`,flag:`a`})}return n}function Lt(e){try{return S.statSync(e)}catch{return}}async function Rt(e,t={}){let n=G(process.cwd(),e),r;try{r=await C.stat(n)}catch(e){if((t.force??!0)&&e.code===`ENOENT`)return;throw e}let{recursive:i=!0,force:a=!0,cleanOnly:o=!1}=t;if(o&&r.isDirectory()){let e=await C.readdir(n);for(let t of e)await C.rm(x.join(n,t),{recursive:i,force:a});return}if(o&&r.isFile()){await C.truncate(n,0);return}await C.rm(n,{recursive:r.isDirectory()?i:!1,force:a,maxRetries:3,retryDelay:100})}async function q(e){let t=G(process.cwd(),e),n;try{n=await C.stat(t)}catch{}let r=n?.isDirectory()?t:x.dirname(t);try{if(!(await C.stat(r)).isDirectory())throw Error(`"${r}" exists but is not a directory.`)}catch(e){throw e.code===`ENOENT`?Error(`Directory "${r}" does not exist.`):e}return t}async function zt(e){let t=G(process.cwd(),e);x.extname(e)&&console.warn(`[createDirectory] Warning: "${e}" looks like a file path (has extension).`);try{let e;try{e=await C.stat(t)}catch{}if(!e)await C.mkdir(t,{recursive:!0});else if(!e.isDirectory())throw Error(`"${t}" exists but is not a directory.`);return t}catch(e){throw Error(`Failed to create directory "${t}": ${e.message}`)}}async function Bt(e,t=``){let n=G(process.cwd(),e);await q(x.dirname(n));try{let e=await Vt(n);if(!e)await C.writeFile(n,t,{encoding:`utf8`,flag:`w`});else{if(!e.isFile())throw Error(`"${n}" exists but is not a file.`);t&&await C.writeFile(n,t,{encoding:`utf8`,flag:`a`})}return n}catch(e){throw Error(`Failed to create file "${n}": ${e.message}`)}}async function Vt(e){try{return await C.stat(e)}catch(e){if(e.code===`ENOENT`)return;throw e}}const J={filterNull:!0,filterUndefined:!0,filterEmptyString:!0,filterEmptyArray:!0,filterEmptyObject:!0};var Y=class{options;instance;constructor(e){this.options=e,this.instance=this.makeInstance()}info(e,t){this.log(`info`,e,t)}debug(e,t){this.log(`debug`,e,t)}trace(e,t){this.log(`trace`,e,t)}warn(e,t){this.log(`warn`,e,t)}error(e,t){this.log(`error`,e,t)}fatal(e,t){this.log(`fatal`,e,t)}child(e){return this.instance.child(e)}log(e,t,n){this.instance[e]({msg:t,...this.formatLogOptions(n)})}formatLogOptions(e){return e?L({flag:e.flag,details:this.formatUnknown(e.details),error:this.formatUnknown(e.error),metadata:this.formatUnknown(e.metadata)},J):{}}formatUnknown(e){if(lt(e)){let t={type:e.constructor.name,message:e.message};this.options.debug&&e.stack&&(t.stack=e.stack);for(let n of Object.keys(e))n in t||(t[n]=e[n]);let n=L(t,J);return z(n)?void 0:n}if(Buffer.isBuffer(e))return`[Buffer]`;if(e&&typeof e.pipe==`function`)return`[Stream]`;if(R(e))try{let t=JSON.stringify(e);if(t===void 0)return;let n=JSON.parse(t);if(Array.isArray(n))return n.length>0?n:void 0;if(R(n)){let e=L(n,J);return z(e)?void 0:e}return n}catch{return{type:`NonSerializableObject`}}return dt(e)?e:String(e)}makeInstance(){if(!this.options.enabled)return w({enabled:!1,timestamp:!0});let e=this.options.transports,t={level:this.makeGlobalLogLevel(e),enabled:!0,timestamp:!0,transport:{targets:this.makeTransportTargets(e)}};return w(t)}makeTransportTargets(e){if(e.filter(e=>e.type===`console`).length>1)throw Error(`[Logger] Multiple console transports are not supported.`);return e.map(e=>{switch(e.type){case`console`:return this.makeConsoleTransportTarget(e);case`file`:return this.makeFileTransportTarget(e)}})}makeConsoleTransportTarget(e){return{target:`pino-pretty`,level:this.makeTransportLevel(e.level),options:e.pretty}}makeFileTransportTarget(e){let t=this.makeTransportLevel(e.level),n=x.isAbsolute(e.path)?x.normalize(e.path):G(process.cwd(),e.path);return K(x.dirname(n)),{target:`pino/file`,level:t,options:{destination:n}}}makeTransportLevel(e){return this.options.debug?`trace`:e??`info`}makeGlobalLogLevel(e){if(this.options.debug)return`trace`;let t=e.at(0);if(!t)return`info`;let n={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},r=this.makeTransportLevel(t.level);for(let t of e.slice(1)){let e=this.makeTransportLevel(t.level);n[e]<n[r]&&(r=e)}return r}},Ht=class{options;constructor(e){this.options=e}assemble(e){e.bind(I.DI.Logger).toConstantValue(new Y(this.options))}};function Ut(e={}){let t=e.logger??{enabled:!1};return[...Mt(),new Ht(t)]}function X(e){return process.env[e]?.trim()||void 0}function Wt(e){let t=X(e);if(!t)throw Error(`Missing required environment variable: ${e}`);return t}const Z=T.string().trim().min(1).transform(e=>{let{prefix:t,base:n}=Gt(e),r=Kt(n);return{original:e,prefix:t,base:n,kebab:qt(r),snake:Jt(r),camel:Yt(r),pascal:Xt(r)}}),Q=T.looseObject({name:Z,version:T.string().trim().min(1),private:T.boolean().optional(),type:T.enum([`module`,`commonjs`]).optional(),dependencies:T.record(T.string(),T.string()).default({}),peerDependencies:T.record(T.string(),T.string()).default({}),devDependencies:T.record(T.string(),T.string()).default({})});function Gt(e){let t=/^@([^/]+)\/(.+)$/.exec(e);return t&&t[2]?{prefix:t[1],base:t[2]}:{base:e}}function Kt(e){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[^a-zA-Z0-9]+/g,` `).trim().toLowerCase();return t?t.split(/\s+/):[]}function qt(e){return e.join(`-`)}function Jt(e){return e.join(`_`)}function Yt(e){if(e.length===0)return``;let[t,...n]=e;return t+n.map($).join(``)}function Xt(e){return e.map($).join(``)}function $(e){return e.length===0?``:e.charAt(0).toUpperCase()+e.slice(1)}function Zt(e){let t,n;try{t=S.readFileSync(e,`utf8`)}catch(t){throw Error(`Failed to read package.json at ${e}`,{cause:t})}try{n=JSON.parse(t)}catch(t){throw Error(`Failed to parse package.json at ${e}`,{cause:t})}try{return Q.parse(n)}catch(t){throw Error(`Invalid package.json at ${e}`,{cause:t})}}export{ct as Console,Nt as LogFlag,Y as LoggerImpl,Q as PackageJSONSchema,Z as PackageNameSchema,Ut as coreNodeAssembly,Ft as createDirectory,zt as createDirectoryAsync,It as createFile,Bt as createFileAsync,K as ensureDirectory,q as ensureDirectoryAsync,Zt as loadPackageJSON,Ze as makeDependencyBundlingPolicy,X as optionalEnvironmentVariable,Pt as removePath,Rt as removePathAsync,Wt as requiredEnvironmentVariable,G as resolvePath};
1
+ import{builtinModules as e}from"node:module";import{createConsola as t}from"consola";import{colors as n}from"consola/utils";import{injectable as r}from"inversify";import{add as i,addDays as a,addHours as o,addMilliseconds as s,addMinutes as c,addMonths as l,addSeconds as u,addWeeks as d,addYears as f,compareAsc as p,differenceInDays as ee,differenceInHours as te,differenceInMilliseconds as ne,differenceInMinutes as re,differenceInMonths as ie,differenceInSeconds as ae,differenceInWeeks as oe,differenceInYears as se,endOfDay as m,endOfMonth as ce,endOfWeek as le,endOfYear as ue,format as de,formatISO as fe,fromUnixTime as pe,getDate as me,getDay as he,getHours as ge,getMinutes as _e,getMonth as ve,getSeconds as ye,getUnixTime as be,getYear as xe,isAfter as Se,isBefore as Ce,isEqual as we,isSameDay as Te,isValid as h,parseISO as Ee,setDate as De,setDay as Oe,setHours as ke,setMinutes as Ae,setMonth as je,setSeconds as Me,setYear as Ne,startOfDay as g,startOfMonth as _,startOfWeek as v,startOfYear as y,sub as b,subDays as Pe,subHours as Fe,subMilliseconds as Ie,subMinutes as Le,subMonths as Re,subSeconds as ze,subWeeks as Be,subYears as Ve}from"date-fns";import{formatInTimeZone as He,fromZonedTime as Ue,getTimezoneOffset as We,toZonedTime as Ge}from"date-fns-tz";import x from"ms";import S from"node:path";import C,{promises as w}from"node:fs";import{fileURLToPath as Ke}from"node:url";import T from"pino";import E from"zod";var D=Object.defineProperty,qe=Object.getOwnPropertyDescriptor,Je=Object.getOwnPropertyNames,Ye=Object.prototype.hasOwnProperty,O=(e,t)=>{let n={};for(var r in e)D(n,r,{get:e[r],enumerable:!0});return t||D(n,Symbol.toStringTag,{value:`Module`}),n},k=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Je(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Ye.call(e,s)&&s!==n&&D(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=qe(t,s))||r.enumerable});return e},A=(e,t,n)=>(k(e,t,`default`),n&&k(n,t,`default`));function Xe(e,t={}){let n=t.includePeers??!0,r=t.includeDependencies??!0,i=t.includeSubpaths??!0,a=t.includeNodeBuiltins??!0,o=t.allowPeerBundling??!1,s=Object.keys(e.peerDependencies??{}),c=Object.keys(e.dependencies??{}),l=M(t.bundle??[]),u=M(t.external??[]);nt(u,l),it(l),o||rt(s,l);let d=new Set(l.map(P)),f=n?s.filter(e=>!d.has(e)):[],p=r?c.filter(e=>!d.has(e)):[];return{external:N([...a?Ze():[],...j([...f,...p,...u],i)]),bundle:N(j(l,i))}}function Ze(){let t=M(e.map(F)),n=t.map(e=>`node:${e}`);return N([...t,...n,/^node:/])}function j(e,t){return t?e.map(e=>Qe(e)):[...e]}function Qe(e){return et(e)?e:RegExp(`^${tt(e)}(?:/.*)?$`)}function M(e){return Array.from(new Set(e))}function N(e){let t=new Set,n=[];for(let r of e){let e=$e(r);t.has(e)||(t.add(e),n.push(r))}return n}function $e(e){return typeof e==`string`?`string:${e}`:`regexp:${e.source}/${e.flags}`}function P(e){if(e.startsWith(`@`)){let[t,n]=e.split(`/`);return t&&n?`${t}/${n}`:e}let[t]=e.split(`/`);return t??e}function F(e){return e.startsWith(`node:`)?e.slice(5):e}function et(e){return e.includes(`*`)||e.startsWith(`^`)||e.endsWith(`$`)}function tt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function nt(e,t){let n=new Set(e.map(P)),r=t.filter(e=>n.has(P(e)));if(r.length!==0)throw Error(`Packages cannot be both external and bundled: ${r.join(`, `)}`)}function rt(e,t){let n=new Set(e),r=t.filter(e=>n.has(P(e)));if(r.length!==0)throw Error(`Peer dependencies must stay external and cannot be bundled by default: ${r.join(`, `)}`)}function it(t){let n=new Set(e.map(F)),r=t.filter(e=>at(e,n));if(r.length!==0)throw Error(`Node.js built-in modules cannot be bundled: ${r.join(`, `)}`)}function at(e,t){let n=F(e),[r]=n.split(`/`);return r?t.has(r):t.has(n)}const ot=/\u001B\[[0-9;]*m/g;var st=class{instance;constructor(e={}){this.instance=t({level:e.enabled===!1?-999:999,formatOptions:{colors:!0,date:!1}})}title(e,t,r=[]){this.printPanel({title:`${e} ${t}`.trim(),renderedTitle:`${n.cyan(n.bold(e))}${t?` ${n.dim(t)}`:``}`,rows:r,formatValue:n.green})}panel(e,t,r){this.printPanel({title:r===void 0?e:`${e} ${r}`,renderedTitle:`${n.cyan(n.bold(e))}${r===void 0?``:` ${n.green(String(r))}`}`,rows:t,formatValue:n.dim})}step(e,t){return`${n.cyan(e.padEnd(10,` `))}${t}`}duration(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(2)}s`}emptyLine(){this.instance.log(``)}log(e,...t){this.instance.log(e,...t)}info(e,...t){this.instance.info(e,...t)}start(e,...t){this.instance.start(e,...t)}success(e,...t){this.instance.success(e,...t)}warn(e,...t){this.instance.warn(e,...t)}error(e,...t){this.instance.error(e,...t)}debug(e,...t){this.instance.debug(e,...t)}printPanel(e){this.instance.log(this.formatPanel(e))}formatPanel(e){let t=this.getPanelWidth(e);return[this.formatPanelTop(e.renderedTitle,t),...e.rows.map(n=>this.formatPanelRow(n,t,e.formatValue)),this.formatPanelBottom(t)].join(`
2
+ `)}formatPanelTop(e,t){let r=Math.max(1,t-this.visibleLength(e)-5);return`${n.dim(`╭─`)} ${e} ${n.dim(`─`.repeat(r))}${n.dim(`╮`)}`}formatPanelBottom(e){return`${n.dim(`╰`)}${n.dim(`─`.repeat(e-2))}${n.dim(`╯`)}`}formatPanelRow(e,t,r){let i=e.label.padEnd(14,` `),a=String(e.value),o=this.visibleLength(i)+this.visibleLength(a)+4,s=Math.max(0,t-o);return`${n.dim(`│`)} ${n.blue(i)}${r(a)}${` `.repeat(s)} ${n.dim(`│`)}`}getPanelWidth(e){return Math.max(48,this.getTitleWidth(e),this.getRowsWidth(e.rows))}getTitleWidth(e){return this.visibleLength(e.title)+6}getRowsWidth(e){return Math.max(0,...e.map(e=>this.getRowWidth(e)))}getRowWidth(e){return 14+this.visibleLength(String(e.value))+4}visibleLength(e){return e.replace(ot,``).length}};const I=`${{name:`buildplease`,displayName:`BuildPlease`,scope:`@buildplease`}.name}.Core.DI`,L={DI:{Formatter:{UnitController:Symbol.for(`${I}.Formatter.UnitController`)},Logger:Symbol.for(`${I}.Logger`)}};function ct(e){return e instanceof Error}function R(e,t={}){if(e==null)return{};let{filterNull:n=!0,filterUndefined:r=!0,filterEmptyString:i=!1,filterEmptyObject:a=!1,filterEmptyArray:o=!1}=t;return Object.keys(e).reduce((s,c)=>{let l=e[c];return z(l)&&Object.getPrototypeOf(l)===null&&(l=void 0),lt(l)&&(l=R(l,t)),n&&l===null||r&&l===void 0||i&&l===``||a&&B(l)||o&&Array.isArray(l)&&l.length===0||(s[c]=l),s},{})}function z(e){return typeof e==`object`&&!!e}function B(e){return z(e)&&Object.keys(e).length===0}function lt(e){return z(e)&&Object.getPrototypeOf(e)===Object.prototype}function ut(e){return e==null||[`string`,`number`,`boolean`,`bigint`,`symbol`].includes(typeof e)}Array.prototype.isEmpty=function(){return this==null||this.length===0},String.prototype.capitalized=function(){let e=this==null?``:this.toString();return e.trim()?e.charAt(0).toUpperCase()+e.slice(1):``};var dt=class{streetLine1;streetLine2;postalCode;state;city;country;countryCode;constructor(e){this.streetLine1=e.streetLine1,this.streetLine2=e.streetLine2,this.postalCode=e.postalCode,this.state=e.state,this.city=e.city,this.country=e.country,this.countryCode=e.countryCode}toJSON(){return R({streetLine1:this.streetLine1,streetLine2:this.streetLine2,postalCode:this.postalCode,city:this.city,state:this.state,country:this.country,countryCode:this.countryCode},{filterNull:!0,filterUndefined:!0,filterEmptyString:!0})}formatted(){let e=(e,t)=>e.map(e=>e?.trim()).filter(e=>e&&e.length>0).join(t).trim(),t=this.streetLine1;return e([t,e([this.postalCode,this.city],` `),e([this.country],`, `)],`, `)}},ft=class{email;fb;ig;phone;web;constructor({email:e,fb:t,ig:n,phone:r,web:i}){this.email=e,this.fb=t,this.ig=n,this.phone=r,this.web=i}toJSON(){return R({email:this.email,fb:this.fb,ig:this.ig,phone:this.phone,web:this.web},{filterNull:!0,filterUndefined:!0,filterEmptyString:!0})}},V=O({DateFormat:()=>U,DateTime:()=>H});import*as pt from"date-fns";A(V,pt);var H=class e{date;constructor(e){if(!e){this.date=new Date;return}if(e instanceof Date){if(!h(e))throw Error(`Invalid date object`);this.date=e;return}let t=Ee(e);if(!h(t))throw Error(`Invalid date string`);this.date=t}static fromUnixTimestamp(t,n){return new e(pe(t,n))}static now(){return new e(new Date)}toJSON(){return this.toISOString()}toDate(){return this.date}toUnixTimestamp(){return be(this.date)}getTime(){return this.date.getTime()}toISOString(){return fe(this.date)}format(e,t){return de(this.date,e,t)}addingDuration(t){return new e(i(this.date,t))}addingMilliseconds(t){return new e(s(this.date,t))}addingSeconds(t){return new e(u(this.date,t))}addingMinutes(t){return new e(c(this.date,t))}addingHours(t){return new e(o(this.date,t))}addingDays(t){return new e(a(this.date,t))}addingWeeks(t){return new e(d(this.date,t))}addingMonths(t){return new e(l(this.date,t))}addingYears(t){return new e(f(this.date,t))}subtractingDuration(t){return new e(b(this.date,t))}subtractingMilliseconds(t){return new e(Ie(this.date,t))}subtractingSeconds(t){return new e(ze(this.date,t))}subtractingMinutes(t){return new e(Le(this.date,t))}subtractingHours(t){return new e(Fe(this.date,t))}subtractingDays(t){return new e(Pe(this.date,t))}subtractingWeeks(t){return new e(Be(this.date,t))}subtractingMonths(t){return new e(Re(this.date,t))}subtractingYears(t){return new e(Ve(this.date,t))}differenceInMilliseconds(e){return ne(this.date,e.date)}differenceInSeconds(e){return ae(this.date,e.date)}differenceInMinutes(e){return re(this.date,e.date)}differenceInHours(e){return te(this.date,e.date)}differenceInDays(e){return ee(this.date,e.date)}differenceInWeeks(e){return oe(this.date,e.date)}differenceInMonths(e){return ie(this.date,e.date)}differenceInYears(e){return se(this.date,e.date)}isEqualTo(e){return we(this.date,e.date)}isBefore(e){return Ce(this.date,e.date)}isAfter(e){return Se(this.date,e.date)}compareTo(e){return p(this.date,e.date)}isSameDayAs(e){return Te(this.date,e.date)}startOfDay(){return new e(g(this.date))}endOfDay(){return new e(m(this.date))}startOfWeek(){return new e(v(this.date))}endOfWeek(){return new e(le(this.date))}startOfMonth(){return new e(_(this.date))}endOfMonth(){return new e(ce(this.date))}startOfYear(){return new e(y(this.date))}endOfYear(){return new e(ue(this.date))}get dayOfMonth(){return me(this.date)}get dayOfWeek(){return he(this.date)}get month(){return ve(this.date)}get year(){return xe(this.date)}get hours(){return ge(this.date)}get minutes(){return _e(this.date)}get seconds(){return ye(this.date)}settingDayOfMonth(t){return new e(De(this.date,t))}settingDayOfWeek(t){return new e(Oe(this.date,t))}settingMonth(t){return new e(je(this.date,t))}settingYear(t){return new e(Ne(this.date,t))}settingHours(t){return new e(ke(this.date,t))}settingMinutes(t){return new e(Ae(this.date,t))}settingSeconds(t){return new e(Me(this.date,t))}};let U=function(e){return e.ISO_DATE=`yyyy-MM-dd`,e.ISO_DATETIME=`yyyy-MM-dd'T'HH:mm:ssXXX`,e.MM_DD_YYYY=`MM/dd/yyyy`,e.FULL_MONTH_DAY_YEAR=`MMMM d, yyyy`,e.ABBR_MONTH_DAY_YEAR=`MMM d, yyyy`,e.RFC_3339=`yyyy-MM-dd'T'HH:mm:ss.SSSxxx`,e.ALT_RSS=`d MMM yyyy HH:mm:ss ZZZ`,e.RSS=`EEE, d MMM yyyy HH:mm:ss ZZZ`,e.HTTP_HEADER=`EEE, dd MMM yyyy HH:mm:ss zzz`,e.STANDARD=`EEE MMM dd HH:mm:ss Z yyyy`,e.EXTENDED=`eee dd-MMM-yyyy GG HH:mm:ss.SSS zzz`,e}({});var mt=class e{utc;timeZone;constructor(e,t){this.timeZone=e,this.utc=t??new Date}static fromUtc(t,n){return new e(n,t)}static fromLocalIso(t,n){let r=Ue(t,n);return new e(n,r)}format(e,t){return He(this.utc,this.timeZone,e,t)}toLocalIsoMinutes(e){return this.format(`yyyy-MM-dd'T'HH:mm`,e)}toLocalIsoSeconds(e){return this.format(`yyyy-MM-dd'T'HH:mm:ss`,e)}toISOString(){return this.utc.toISOString()}toUnixTimestamp(){return Math.floor(this.utc.getTime()/1e3)}toZonedDate(){return Ge(this.utc,this.timeZone)}timezoneOffsetMs(e){return We(this.timeZone,e??this.utc)}},ht=class{value;constructor([e,t]){if(e<-180||e>180)throw Error(`Longitude must be between -180 and 180.`);if(t<-90||t>90)throw Error(`Latitude must be between -90 and 90.`);this.value=[e,t]}get longitude(){return this.value[0]}get latitude(){return this.value[1]}toJSON(){return this.value}},gt=class{type=`Point`;coordinates;bbox;constructor(e,t){this.coordinates=e,this.bbox=t}toJSON(){return{type:this.type,coordinates:this.coordinates.toJSON(),...this.bbox&&{bbox:this.bbox}}}},_t=class{type=`MultiPoint`;coordinates;bbox;constructor(e,t){this.coordinates=e,this.bbox=t}toJSON(){return{type:this.type,coordinates:this.coordinates.map(e=>e.toJSON()),...this.bbox&&{bbox:this.bbox}}}},vt=class{type=`LineString`;coordinates;bbox;constructor(e,t){this.coordinates=e,this.bbox=t}toJSON(){return{type:this.type,coordinates:this.coordinates.map(e=>e.toJSON()),...this.bbox&&{bbox:this.bbox}}}},yt=class{type=`MultiLineString`;coordinates;bbox;constructor(e,t){this.coordinates=e,this.bbox=t}toJSON(){return{type:this.type,coordinates:this.coordinates.map(e=>e.map(e=>e.toJSON())),...this.bbox&&{bbox:this.bbox}}}},bt=class{type=`Polygon`;coordinates;bbox;constructor(e,t){this.coordinates=e,this.bbox=t}toJSON(){return{type:this.type,coordinates:this.coordinates.map(e=>e.map(e=>e.toJSON())),...this.bbox&&{bbox:this.bbox}}}},xt=class{type=`MultiPolygon`;coordinates;bbox;constructor(e,t){this.coordinates=e,this.bbox=t}toJSON(){return{type:this.type,coordinates:this.coordinates.map(e=>e.map(e=>e.map(e=>e.toJSON()))),...this.bbox&&{bbox:this.bbox}}}};let St=function(e){return e.Point=`Point`,e.MultiPoint=`MultiPoint`,e.LineString=`LineString`,e.MultiLineString=`MultiLineString`,e.Polygon=`Polygon`,e.MultiPolygon=`MultiPolygon`,e}({});function W(e){return Error(`Invalid ObjectId value: ${String(e)}`)}var Ct=class e{value;constructor(e){if(e==null)throw W(e);let t=e.trim();if(t.length===0)throw W(e);this.value=t,Object.freeze(this)}get asString(){return this.value}equals(t){return this.value===e.from(t).value}compare(t){let n=e.from(t).value;return this.value===n?0:this.value<n?-1:1}hash(){return this.value}toJSON(){return this.value}toString(){return this.value}[Symbol.toPrimitive](){return this.value}static from(t){return t instanceof e?t:new e(t)}static isValid(e){return typeof e==`string`&&e.trim().length>0}static toValueSet(t){let n=new Set;for(let r of t)n.add(e.from(r).value);return n}},wt=class{day;intervals;constructor(e,t){this.day=e,this.intervals=t}toJSON(){return R({day:this.day,intervals:this.intervals},{filterNull:!0,filterUndefined:!0,filterEmptyString:!0})}},Tt=class{_milliseconds;_long;constructor(e,t){if(this._long=t?.long===!0,e==null)throw Error(`Invalid interval format: ${e}`);if(typeof e==`number`)this._milliseconds=e;else{let t=x(e);if(t===void 0)throw Error(`Invalid interval format: ${e}`);this._milliseconds=t}}get milliseconds(){return this._milliseconds}get seconds(){return Math.floor(this._milliseconds/1e3)}get minutes(){return Math.floor(this._milliseconds/6e4)}get hours(){return Math.floor(this._milliseconds/36e5)}get days(){return Math.floor(this._milliseconds/864e5)}get weeks(){return Math.floor(this._milliseconds/6048e5)}get formatted(){return x(this._milliseconds,{long:this._long})}toString(){return x(this._milliseconds,{long:this._long})}toObject(){return{milliseconds:this._milliseconds,seconds:this.seconds,minutes:this.minutes,hours:this.hours,days:this.days,weeks:this.weeks}}};let Et=function(e){return e.Byte=`B`,e.Kilobyte=`KB`,e.Megabyte=`MB`,e.Gigabyte=`GB`,e.Terabyte=`TB`,e}({}),Dt=function(e){return e.Millimeter=`mm`,e.Centimeter=`cm`,e.Meter=`m`,e.Kilometer=`km`,e}({}),Ot=function(e){return e.Milligram=`mg`,e.Gram=`g`,e.Kilogram=`kg`,e.Tonne=`t`,e}({});A(O({Address:()=>dt,ByteUnit:()=>Et,Contacts:()=>ft,Coordinates:()=>ht,DateFormat:()=>U,DateTime:()=>H,DistanceUnit:()=>Dt,GeoJsonType:()=>St,LineString:()=>vt,MultiLineString:()=>yt,MultiPoint:()=>_t,MultiPolygon:()=>xt,ObjectId:()=>Ct,OpeningHour:()=>wt,Point:()=>gt,Polygon:()=>bt,TimeInterval:()=>Tt,WeightUnit:()=>Ot,ZonedDateTime:()=>mt}),V);function kt(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}let G=class{formatBytes(e,t){let{inputUnit:n=`B`,outputUnit:r=`auto`,decimals:i=1}=t??{},a=e=>e===`B`?1:e===`KB`?1024:e===`MB`?1048576:e===`GB`?1073741824:1099511627776,o=e*a(n),s=r===`auto`?(()=>{for(let e of[`TB`,`GB`,`MB`,`KB`])if(o/a(e)>=1)return e;return`B`})():r,c=o/a(s),l=10**i;return{value:Math.round(c*l)/l,unit:s,bytes:o}}};G=kt([r()],G);var At=class{assemble(e){e.bind(L.DI.Formatter.UnitController).to(G)}};function jt(){return[new At]}let Mt=function(e){return e.Critical=`CRITICAL`,e.Serious=`SERIOUS`,e.Important=`IMPORTANT`,e.Notice=`NOTICE`,e.Routine=`ROUTINE`,e}({});function K(e,t){if(S.isAbsolute(t))return S.normalize(t);let n;try{let t=new URL(e);if(t.protocol!==`file:`)throw Error(`Unsupported URL protocol "${t.protocol}"`);n=S.dirname(Ke(t))}catch{n=e}return S.resolve(n,t)}function Nt(e,t={}){let n=K(process.cwd(),e);if(!C.existsSync(n))return;let r=C.statSync(n),{recursive:i=!0,force:a=!0,cleanOnly:o=!1}=t;if(o&&r.isDirectory()){for(let e of C.readdirSync(n))C.rmSync(S.join(n,e),{recursive:i,force:a});return}if(o&&r.isFile()){C.truncateSync(n,0);return}C.rmSync(n,{recursive:r.isDirectory()?i:!1,force:a,maxRetries:3,retryDelay:100})}function q(e){let t=K(process.cwd(),e),n=C.existsSync(t)&&C.statSync(t).isDirectory()?t:S.dirname(t);if(!C.existsSync(n))throw Error(`Directory "${n}" does not exist.`);return t}function Pt(e){let t=K(process.cwd(),e);S.extname(e)&&console.warn(`[createDirectory] Warning: "${e}" looks like a file path.`);try{if(!C.existsSync(t))C.mkdirSync(t,{recursive:!0});else if(!C.statSync(t).isDirectory())throw Error(`"${t}" exists but is not a directory.`);return t}catch(e){throw Error(`Failed to create directory "${t}": ${e.message}`)}}function Ft(e,t=``){let n=K(process.cwd(),e);q(S.dirname(n));let r=It(n);if(!r)C.writeFileSync(n,t,{encoding:`utf8`,flag:`w`});else{if(!r.isFile())throw Error(`"${n}" exists but is not a file.`);t&&C.writeFileSync(n,t,{encoding:`utf8`,flag:`a`})}return n}function It(e){try{return C.statSync(e)}catch{return}}async function Lt(e,t={}){let n=K(process.cwd(),e),r;try{r=await w.stat(n)}catch(e){if((t.force??!0)&&e.code===`ENOENT`)return;throw e}let{recursive:i=!0,force:a=!0,cleanOnly:o=!1}=t;if(o&&r.isDirectory()){let e=await w.readdir(n);for(let t of e)await w.rm(S.join(n,t),{recursive:i,force:a});return}if(o&&r.isFile()){await w.truncate(n,0);return}await w.rm(n,{recursive:r.isDirectory()?i:!1,force:a,maxRetries:3,retryDelay:100})}async function J(e){let t=K(process.cwd(),e),n;try{n=await w.stat(t)}catch{}let r=n?.isDirectory()?t:S.dirname(t);try{if(!(await w.stat(r)).isDirectory())throw Error(`"${r}" exists but is not a directory.`)}catch(e){throw e.code===`ENOENT`?Error(`Directory "${r}" does not exist.`):e}return t}async function Rt(e){let t=K(process.cwd(),e);S.extname(e)&&console.warn(`[createDirectory] Warning: "${e}" looks like a file path (has extension).`);try{let e;try{e=await w.stat(t)}catch{}if(!e)await w.mkdir(t,{recursive:!0});else if(!e.isDirectory())throw Error(`"${t}" exists but is not a directory.`);return t}catch(e){throw Error(`Failed to create directory "${t}": ${e.message}`)}}async function zt(e,t=``){let n=K(process.cwd(),e);await J(S.dirname(n));try{let e=await Bt(n);if(!e)await w.writeFile(n,t,{encoding:`utf8`,flag:`w`});else{if(!e.isFile())throw Error(`"${n}" exists but is not a file.`);t&&await w.writeFile(n,t,{encoding:`utf8`,flag:`a`})}return n}catch(e){throw Error(`Failed to create file "${n}": ${e.message}`)}}async function Bt(e){try{return await w.stat(e)}catch(e){if(e.code===`ENOENT`)return;throw e}}var Y=class{options;instance;constructor(e){this.options=e,this.instance=this.makeInstance()}info(e,t){this.log(`info`,e,t)}debug(e,t){this.log(`debug`,e,t)}trace(e,t){this.log(`trace`,e,t)}warn(e,t){this.log(`warn`,e,t)}error(e,t){this.log(`error`,e,t)}fatal(e,t){this.log(`fatal`,e,t)}child(e){return this.instance.child(e)}log(e,t,n){this.instance[e]({msg:t,...this.formatLogOptions(n)})}formatLogOptions(e){return e?this.normalizeObject({flag:e.flag,details:this.formatUnknown(e.details),error:this.formatUnknown(e.error),metadata:this.formatUnknown(e.metadata)}):{}}formatUnknown(e){if(ct(e)){let t={type:e.constructor.name,message:e.message};this.options.debug&&e.stack&&(t.stack=e.stack);for(let[n,r]of Object.entries(e))n in t||(t[n]=r);let n=this.normalizeObject(t);return B(n)?void 0:n}if(Buffer.isBuffer(e))return`[Buffer]`;if(e&&typeof e.pipe==`function`)return`[Stream]`;if(z(e))try{let t=JSON.stringify(e);if(t===void 0)return;let n=JSON.parse(t);if(Array.isArray(n))return n.length>0?n:void 0;if(z(n)){let e=this.normalizeObject(n);return B(e)?void 0:e}return n}catch{return{type:`NonSerializableObject`}}return ut(e)?e:String(e)}normalizeObject(e){return R(Object.fromEntries(Object.entries(e)),{filterNull:!0,filterUndefined:!0,filterEmptyString:!0,filterEmptyArray:!0,filterEmptyObject:!0})}makeInstance(){if(!this.options.enabled)return T({enabled:!1,timestamp:!0});let e=this.options.transports,t={level:this.makeGlobalLogLevel(e),enabled:!0,timestamp:!0,transport:{targets:this.makeTransportTargets(e)}};return T(t)}makeTransportTargets(e){if(e.filter(e=>e.type===`console`).length>1)throw Error(`[Logger] Multiple console transports are not supported.`);return e.map(e=>{switch(e.type){case`console`:return this.makeConsoleTransportTarget(e);case`file`:return this.makeFileTransportTarget(e)}})}makeConsoleTransportTarget(e){return{target:`pino-pretty`,level:this.makeTransportLevel(e.level),options:e.pretty}}makeFileTransportTarget(e){let t=this.makeTransportLevel(e.level),n=S.isAbsolute(e.path)?S.normalize(e.path):K(process.cwd(),e.path);return q(S.dirname(n)),{target:`pino/file`,level:t,options:{destination:n}}}makeTransportLevel(e){return this.options.debug?`trace`:e??`info`}makeGlobalLogLevel(e){if(this.options.debug)return`trace`;let t=e.at(0);if(!t)return`info`;let n={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},r=this.makeTransportLevel(t.level);for(let t of e.slice(1)){let e=this.makeTransportLevel(t.level);n[e]<n[r]&&(r=e)}return r}},Vt=class{options;constructor(e){this.options=e}assemble(e){e.bind(L.DI.Logger).toConstantValue(new Y(this.options))}};function Ht(e={}){let t=e.logger??{enabled:!1};return[...jt(),new Vt(t)]}function X(e){return process.env[e]?.trim()||void 0}function Ut(e){let t=X(e);if(!t)throw Error(`Missing required environment variable: ${e}`);return t}const Z=E.string().trim().min(1).transform(e=>{let{prefix:t,base:n}=Wt(e),r=Gt(n);return{original:e,prefix:t,base:n,kebab:Kt(r),snake:qt(r),camel:Jt(r),pascal:Yt(r)}}),Q=E.looseObject({name:Z,version:E.string().trim().min(1),private:E.boolean().optional(),type:E.enum([`module`,`commonjs`]).optional(),dependencies:E.record(E.string(),E.string()).default({}),peerDependencies:E.record(E.string(),E.string()).default({}),devDependencies:E.record(E.string(),E.string()).default({})});function Wt(e){let t=/^@([^/]+)\/(.+)$/.exec(e);return t&&t[2]?{prefix:t[1],base:t[2]}:{base:e}}function Gt(e){let t=e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[^a-zA-Z0-9]+/g,` `).trim().toLowerCase();return t?t.split(/\s+/):[]}function Kt(e){return e.join(`-`)}function qt(e){return e.join(`_`)}function Jt(e){if(e.length===0)return``;let[t,...n]=e;return t+n.map($).join(``)}function Yt(e){return e.map($).join(``)}function $(e){return e.length===0?``:e.charAt(0).toUpperCase()+e.slice(1)}function Xt(e){let t,n;try{t=C.readFileSync(e,`utf8`)}catch(t){throw Error(`Failed to read package.json at ${e}`,{cause:t})}try{n=JSON.parse(t)}catch(t){throw Error(`Failed to parse package.json at ${e}`,{cause:t})}try{return Q.parse(n)}catch(t){throw Error(`Invalid package.json at ${e}`,{cause:t})}}export{st as Console,Mt as LogFlag,Y as LoggerImpl,Q as PackageJSONSchema,Z as PackageNameSchema,Ht as coreNodeAssembly,Pt as createDirectory,Rt as createDirectoryAsync,Ft as createFile,zt as createFileAsync,q as ensureDirectory,J as ensureDirectoryAsync,Xt as loadPackageJSON,Xe as makeDependencyBundlingPolicy,X as optionalEnvironmentVariable,Nt as removePath,Lt as removePathAsync,Ut as requiredEnvironmentVariable,K as resolvePath};
@@ -1,2 +1,2 @@
1
1
  Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("consola"),l=require("consola/utils"),u=require("node:path");u=s(u,1);let d=require("node:fs");d=s(d,1);let f=require("node:url"),p=require("pino");p=s(p,1);const m=/\u001B\[[0-9;]*m/g;var h=class{instance;constructor(e={}){this.instance=(0,c.createConsola)({level:e.enabled===!1?-999:999,formatOptions:{colors:!0,date:!1}})}title(e,t,n=[]){this.printPanel({title:`${e} ${t}`.trim(),renderedTitle:`${l.colors.cyan(l.colors.bold(e))}${t?` ${l.colors.dim(t)}`:``}`,rows:n,formatValue:l.colors.green})}panel(e,t,n){this.printPanel({title:n===void 0?e:`${e} ${n}`,renderedTitle:`${l.colors.cyan(l.colors.bold(e))}${n===void 0?``:` ${l.colors.green(String(n))}`}`,rows:t,formatValue:l.colors.dim})}step(e,t){return`${l.colors.cyan(e.padEnd(10,` `))}${t}`}duration(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(2)}s`}emptyLine(){this.instance.log(``)}log(e,...t){this.instance.log(e,...t)}info(e,...t){this.instance.info(e,...t)}start(e,...t){this.instance.start(e,...t)}success(e,...t){this.instance.success(e,...t)}warn(e,...t){this.instance.warn(e,...t)}error(e,...t){this.instance.error(e,...t)}debug(e,...t){this.instance.debug(e,...t)}printPanel(e){this.instance.log(this.formatPanel(e))}formatPanel(e){let t=this.getPanelWidth(e);return[this.formatPanelTop(e.renderedTitle,t),...e.rows.map(n=>this.formatPanelRow(n,t,e.formatValue)),this.formatPanelBottom(t)].join(`
2
- `)}formatPanelTop(e,t){let n=Math.max(1,t-this.visibleLength(e)-5);return`${l.colors.dim(`╭─`)} ${e} ${l.colors.dim(`─`.repeat(n))}${l.colors.dim(`╮`)}`}formatPanelBottom(e){return`${l.colors.dim(`╰`)}${l.colors.dim(`─`.repeat(e-2))}${l.colors.dim(`╯`)}`}formatPanelRow(e,t,n){let r=e.label.padEnd(14,` `),i=String(e.value),a=this.visibleLength(r)+this.visibleLength(i)+4,o=Math.max(0,t-a);return`${l.colors.dim(`│`)} ${l.colors.blue(r)}${n(i)}${` `.repeat(o)} ${l.colors.dim(`│`)}`}getPanelWidth(e){return Math.max(48,this.getTitleWidth(e),this.getRowsWidth(e.rows))}getTitleWidth(e){return this.visibleLength(e.title)+6}getRowsWidth(e){return Math.max(0,...e.map(e=>this.getRowWidth(e)))}getRowWidth(e){return 14+this.visibleLength(String(e.value))+4}visibleLength(e){return e.replace(m,``).length}};function g(){return new h({enabled:!1})}function _(e,t){if(u.default.isAbsolute(t))return u.default.normalize(t);let n;try{let t=new URL(e);if(t.protocol!==`file:`)throw Error(`Unsupported URL protocol "${t.protocol}"`);n=u.default.dirname((0,f.fileURLToPath)(t))}catch{n=e}return u.default.resolve(n,t)}function v(e){let t=_(process.cwd(),e),n=d.default.existsSync(t)&&d.default.statSync(t).isDirectory()?t:u.default.dirname(t);if(!d.default.existsSync(n))throw Error(`Directory "${n}" does not exist.`);return t}function y(e){return e instanceof Error}function b(e,t={}){if(e==null)return{};let{filterNull:n=!0,filterUndefined:r=!0,filterEmptyString:i=!1,filterEmptyObject:a=!1,filterEmptyArray:o=!1}=t;return Object.keys(e).reduce((s,c)=>{let l=e[c];return x(l)&&Object.getPrototypeOf(l)===null&&(l=void 0),C(l)&&(l=b(l,t)),n&&l===null||r&&l===void 0||i&&l===``||a&&S(l)||o&&Array.isArray(l)&&l.length===0||(s[c]=l),s},{})}function x(e){return typeof e==`object`&&!!e}function S(e){return x(e)&&Object.keys(e).length===0}function C(e){return x(e)&&Object.getPrototypeOf(e)===Object.prototype}function w(e){return e==null||[`string`,`number`,`boolean`,`bigint`,`symbol`].includes(typeof e)}Array.prototype.isEmpty=function(){return this==null||this.length===0},String.prototype.capitalized=function(){let e=this==null?``:this.toString();return e.trim()?e.charAt(0).toUpperCase()+e.slice(1):``};const T={filterNull:!0,filterUndefined:!0,filterEmptyString:!0,filterEmptyArray:!0,filterEmptyObject:!0};var E=class{options;instance;constructor(e){this.options=e,this.instance=this.makeInstance()}info(e,t){this.log(`info`,e,t)}debug(e,t){this.log(`debug`,e,t)}trace(e,t){this.log(`trace`,e,t)}warn(e,t){this.log(`warn`,e,t)}error(e,t){this.log(`error`,e,t)}fatal(e,t){this.log(`fatal`,e,t)}child(e){return this.instance.child(e)}log(e,t,n){this.instance[e]({msg:t,...this.formatLogOptions(n)})}formatLogOptions(e){return e?b({flag:e.flag,details:this.formatUnknown(e.details),error:this.formatUnknown(e.error),metadata:this.formatUnknown(e.metadata)},T):{}}formatUnknown(e){if(y(e)){let t={type:e.constructor.name,message:e.message};this.options.debug&&e.stack&&(t.stack=e.stack);for(let n of Object.keys(e))n in t||(t[n]=e[n]);let n=b(t,T);return S(n)?void 0:n}if(Buffer.isBuffer(e))return`[Buffer]`;if(e&&typeof e.pipe==`function`)return`[Stream]`;if(x(e))try{let t=JSON.stringify(e);if(t===void 0)return;let n=JSON.parse(t);if(Array.isArray(n))return n.length>0?n:void 0;if(x(n)){let e=b(n,T);return S(e)?void 0:e}return n}catch{return{type:`NonSerializableObject`}}return w(e)?e:String(e)}makeInstance(){if(!this.options.enabled)return(0,p.default)({enabled:!1,timestamp:!0});let e=this.options.transports,t={level:this.makeGlobalLogLevel(e),enabled:!0,timestamp:!0,transport:{targets:this.makeTransportTargets(e)}};return(0,p.default)(t)}makeTransportTargets(e){if(e.filter(e=>e.type===`console`).length>1)throw Error(`[Logger] Multiple console transports are not supported.`);return e.map(e=>{switch(e.type){case`console`:return this.makeConsoleTransportTarget(e);case`file`:return this.makeFileTransportTarget(e)}})}makeConsoleTransportTarget(e){return{target:`pino-pretty`,level:this.makeTransportLevel(e.level),options:e.pretty}}makeFileTransportTarget(e){let t=this.makeTransportLevel(e.level),n=u.default.isAbsolute(e.path)?u.default.normalize(e.path):_(process.cwd(),e.path);return v(u.default.dirname(n)),{target:`pino/file`,level:t,options:{destination:n}}}makeTransportLevel(e){return this.options.debug?`trace`:e??`info`}makeGlobalLogLevel(e){if(this.options.debug)return`trace`;let t=e.at(0);if(!t)return`info`;let n={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},r=this.makeTransportLevel(t.level);for(let t of e.slice(1)){let e=this.makeTransportLevel(t.level);n[e]<n[r]&&(r=e)}return r}};function D(e={enabled:!1}){return new E(e)}exports.makeConsoleFixture=g,exports.makeLoggerFixture=D;
2
+ `)}formatPanelTop(e,t){let n=Math.max(1,t-this.visibleLength(e)-5);return`${l.colors.dim(`╭─`)} ${e} ${l.colors.dim(`─`.repeat(n))}${l.colors.dim(`╮`)}`}formatPanelBottom(e){return`${l.colors.dim(`╰`)}${l.colors.dim(`─`.repeat(e-2))}${l.colors.dim(`╯`)}`}formatPanelRow(e,t,n){let r=e.label.padEnd(14,` `),i=String(e.value),a=this.visibleLength(r)+this.visibleLength(i)+4,o=Math.max(0,t-a);return`${l.colors.dim(`│`)} ${l.colors.blue(r)}${n(i)}${` `.repeat(o)} ${l.colors.dim(`│`)}`}getPanelWidth(e){return Math.max(48,this.getTitleWidth(e),this.getRowsWidth(e.rows))}getTitleWidth(e){return this.visibleLength(e.title)+6}getRowsWidth(e){return Math.max(0,...e.map(e=>this.getRowWidth(e)))}getRowWidth(e){return 14+this.visibleLength(String(e.value))+4}visibleLength(e){return e.replace(m,``).length}};function g(){return new h({enabled:!1})}function _(e,t){if(u.default.isAbsolute(t))return u.default.normalize(t);let n;try{let t=new URL(e);if(t.protocol!==`file:`)throw Error(`Unsupported URL protocol "${t.protocol}"`);n=u.default.dirname((0,f.fileURLToPath)(t))}catch{n=e}return u.default.resolve(n,t)}function v(e){let t=_(process.cwd(),e),n=d.default.existsSync(t)&&d.default.statSync(t).isDirectory()?t:u.default.dirname(t);if(!d.default.existsSync(n))throw Error(`Directory "${n}" does not exist.`);return t}function y(e){return e instanceof Error}function b(e,t={}){if(e==null)return{};let{filterNull:n=!0,filterUndefined:r=!0,filterEmptyString:i=!1,filterEmptyObject:a=!1,filterEmptyArray:o=!1}=t;return Object.keys(e).reduce((s,c)=>{let l=e[c];return x(l)&&Object.getPrototypeOf(l)===null&&(l=void 0),C(l)&&(l=b(l,t)),n&&l===null||r&&l===void 0||i&&l===``||a&&S(l)||o&&Array.isArray(l)&&l.length===0||(s[c]=l),s},{})}function x(e){return typeof e==`object`&&!!e}function S(e){return x(e)&&Object.keys(e).length===0}function C(e){return x(e)&&Object.getPrototypeOf(e)===Object.prototype}function w(e){return e==null||[`string`,`number`,`boolean`,`bigint`,`symbol`].includes(typeof e)}Array.prototype.isEmpty=function(){return this==null||this.length===0},String.prototype.capitalized=function(){let e=this==null?``:this.toString();return e.trim()?e.charAt(0).toUpperCase()+e.slice(1):``};var T=class{options;instance;constructor(e){this.options=e,this.instance=this.makeInstance()}info(e,t){this.log(`info`,e,t)}debug(e,t){this.log(`debug`,e,t)}trace(e,t){this.log(`trace`,e,t)}warn(e,t){this.log(`warn`,e,t)}error(e,t){this.log(`error`,e,t)}fatal(e,t){this.log(`fatal`,e,t)}child(e){return this.instance.child(e)}log(e,t,n){this.instance[e]({msg:t,...this.formatLogOptions(n)})}formatLogOptions(e){return e?this.normalizeObject({flag:e.flag,details:this.formatUnknown(e.details),error:this.formatUnknown(e.error),metadata:this.formatUnknown(e.metadata)}):{}}formatUnknown(e){if(y(e)){let t={type:e.constructor.name,message:e.message};this.options.debug&&e.stack&&(t.stack=e.stack);for(let[n,r]of Object.entries(e))n in t||(t[n]=r);let n=this.normalizeObject(t);return S(n)?void 0:n}if(Buffer.isBuffer(e))return`[Buffer]`;if(e&&typeof e.pipe==`function`)return`[Stream]`;if(x(e))try{let t=JSON.stringify(e);if(t===void 0)return;let n=JSON.parse(t);if(Array.isArray(n))return n.length>0?n:void 0;if(x(n)){let e=this.normalizeObject(n);return S(e)?void 0:e}return n}catch{return{type:`NonSerializableObject`}}return w(e)?e:String(e)}normalizeObject(e){return b(Object.fromEntries(Object.entries(e)),{filterNull:!0,filterUndefined:!0,filterEmptyString:!0,filterEmptyArray:!0,filterEmptyObject:!0})}makeInstance(){if(!this.options.enabled)return(0,p.default)({enabled:!1,timestamp:!0});let e=this.options.transports,t={level:this.makeGlobalLogLevel(e),enabled:!0,timestamp:!0,transport:{targets:this.makeTransportTargets(e)}};return(0,p.default)(t)}makeTransportTargets(e){if(e.filter(e=>e.type===`console`).length>1)throw Error(`[Logger] Multiple console transports are not supported.`);return e.map(e=>{switch(e.type){case`console`:return this.makeConsoleTransportTarget(e);case`file`:return this.makeFileTransportTarget(e)}})}makeConsoleTransportTarget(e){return{target:`pino-pretty`,level:this.makeTransportLevel(e.level),options:e.pretty}}makeFileTransportTarget(e){let t=this.makeTransportLevel(e.level),n=u.default.isAbsolute(e.path)?u.default.normalize(e.path):_(process.cwd(),e.path);return v(u.default.dirname(n)),{target:`pino/file`,level:t,options:{destination:n}}}makeTransportLevel(e){return this.options.debug?`trace`:e??`info`}makeGlobalLogLevel(e){if(this.options.debug)return`trace`;let t=e.at(0);if(!t)return`info`;let n={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},r=this.makeTransportLevel(t.level);for(let t of e.slice(1)){let e=this.makeTransportLevel(t.level);n[e]<n[r]&&(r=e)}return r}};function E(e={enabled:!1}){return new T(e)}exports.makeConsoleFixture=g,exports.makeLoggerFixture=E;
@@ -1,2 +1,2 @@
1
1
  import{createConsola as e}from"consola";import{colors as t}from"consola/utils";import n from"node:path";import r from"node:fs";import{fileURLToPath as i}from"node:url";import a from"pino";const o=/\u001B\[[0-9;]*m/g;var s=class{instance;constructor(t={}){this.instance=e({level:t.enabled===!1?-999:999,formatOptions:{colors:!0,date:!1}})}title(e,n,r=[]){this.printPanel({title:`${e} ${n}`.trim(),renderedTitle:`${t.cyan(t.bold(e))}${n?` ${t.dim(n)}`:``}`,rows:r,formatValue:t.green})}panel(e,n,r){this.printPanel({title:r===void 0?e:`${e} ${r}`,renderedTitle:`${t.cyan(t.bold(e))}${r===void 0?``:` ${t.green(String(r))}`}`,rows:n,formatValue:t.dim})}step(e,n){return`${t.cyan(e.padEnd(10,` `))}${n}`}duration(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(2)}s`}emptyLine(){this.instance.log(``)}log(e,...t){this.instance.log(e,...t)}info(e,...t){this.instance.info(e,...t)}start(e,...t){this.instance.start(e,...t)}success(e,...t){this.instance.success(e,...t)}warn(e,...t){this.instance.warn(e,...t)}error(e,...t){this.instance.error(e,...t)}debug(e,...t){this.instance.debug(e,...t)}printPanel(e){this.instance.log(this.formatPanel(e))}formatPanel(e){let t=this.getPanelWidth(e);return[this.formatPanelTop(e.renderedTitle,t),...e.rows.map(n=>this.formatPanelRow(n,t,e.formatValue)),this.formatPanelBottom(t)].join(`
2
- `)}formatPanelTop(e,n){let r=Math.max(1,n-this.visibleLength(e)-5);return`${t.dim(`╭─`)} ${e} ${t.dim(`─`.repeat(r))}${t.dim(`╮`)}`}formatPanelBottom(e){return`${t.dim(`╰`)}${t.dim(`─`.repeat(e-2))}${t.dim(`╯`)}`}formatPanelRow(e,n,r){let i=e.label.padEnd(14,` `),a=String(e.value),o=this.visibleLength(i)+this.visibleLength(a)+4,s=Math.max(0,n-o);return`${t.dim(`│`)} ${t.blue(i)}${r(a)}${` `.repeat(s)} ${t.dim(`│`)}`}getPanelWidth(e){return Math.max(48,this.getTitleWidth(e),this.getRowsWidth(e.rows))}getTitleWidth(e){return this.visibleLength(e.title)+6}getRowsWidth(e){return Math.max(0,...e.map(e=>this.getRowWidth(e)))}getRowWidth(e){return 14+this.visibleLength(String(e.value))+4}visibleLength(e){return e.replace(o,``).length}};function c(){return new s({enabled:!1})}function l(e,t){if(n.isAbsolute(t))return n.normalize(t);let r;try{let t=new URL(e);if(t.protocol!==`file:`)throw Error(`Unsupported URL protocol "${t.protocol}"`);r=n.dirname(i(t))}catch{r=e}return n.resolve(r,t)}function u(e){let t=l(process.cwd(),e),i=r.existsSync(t)&&r.statSync(t).isDirectory()?t:n.dirname(t);if(!r.existsSync(i))throw Error(`Directory "${i}" does not exist.`);return t}function d(e){return e instanceof Error}function f(e,t={}){if(e==null)return{};let{filterNull:n=!0,filterUndefined:r=!0,filterEmptyString:i=!1,filterEmptyObject:a=!1,filterEmptyArray:o=!1}=t;return Object.keys(e).reduce((s,c)=>{let l=e[c];return p(l)&&Object.getPrototypeOf(l)===null&&(l=void 0),h(l)&&(l=f(l,t)),n&&l===null||r&&l===void 0||i&&l===``||a&&m(l)||o&&Array.isArray(l)&&l.length===0||(s[c]=l),s},{})}function p(e){return typeof e==`object`&&!!e}function m(e){return p(e)&&Object.keys(e).length===0}function h(e){return p(e)&&Object.getPrototypeOf(e)===Object.prototype}function g(e){return e==null||[`string`,`number`,`boolean`,`bigint`,`symbol`].includes(typeof e)}Array.prototype.isEmpty=function(){return this==null||this.length===0},String.prototype.capitalized=function(){let e=this==null?``:this.toString();return e.trim()?e.charAt(0).toUpperCase()+e.slice(1):``};const _={filterNull:!0,filterUndefined:!0,filterEmptyString:!0,filterEmptyArray:!0,filterEmptyObject:!0};var v=class{options;instance;constructor(e){this.options=e,this.instance=this.makeInstance()}info(e,t){this.log(`info`,e,t)}debug(e,t){this.log(`debug`,e,t)}trace(e,t){this.log(`trace`,e,t)}warn(e,t){this.log(`warn`,e,t)}error(e,t){this.log(`error`,e,t)}fatal(e,t){this.log(`fatal`,e,t)}child(e){return this.instance.child(e)}log(e,t,n){this.instance[e]({msg:t,...this.formatLogOptions(n)})}formatLogOptions(e){return e?f({flag:e.flag,details:this.formatUnknown(e.details),error:this.formatUnknown(e.error),metadata:this.formatUnknown(e.metadata)},_):{}}formatUnknown(e){if(d(e)){let t={type:e.constructor.name,message:e.message};this.options.debug&&e.stack&&(t.stack=e.stack);for(let n of Object.keys(e))n in t||(t[n]=e[n]);let n=f(t,_);return m(n)?void 0:n}if(Buffer.isBuffer(e))return`[Buffer]`;if(e&&typeof e.pipe==`function`)return`[Stream]`;if(p(e))try{let t=JSON.stringify(e);if(t===void 0)return;let n=JSON.parse(t);if(Array.isArray(n))return n.length>0?n:void 0;if(p(n)){let e=f(n,_);return m(e)?void 0:e}return n}catch{return{type:`NonSerializableObject`}}return g(e)?e:String(e)}makeInstance(){if(!this.options.enabled)return a({enabled:!1,timestamp:!0});let e=this.options.transports,t={level:this.makeGlobalLogLevel(e),enabled:!0,timestamp:!0,transport:{targets:this.makeTransportTargets(e)}};return a(t)}makeTransportTargets(e){if(e.filter(e=>e.type===`console`).length>1)throw Error(`[Logger] Multiple console transports are not supported.`);return e.map(e=>{switch(e.type){case`console`:return this.makeConsoleTransportTarget(e);case`file`:return this.makeFileTransportTarget(e)}})}makeConsoleTransportTarget(e){return{target:`pino-pretty`,level:this.makeTransportLevel(e.level),options:e.pretty}}makeFileTransportTarget(e){let t=this.makeTransportLevel(e.level),r=n.isAbsolute(e.path)?n.normalize(e.path):l(process.cwd(),e.path);return u(n.dirname(r)),{target:`pino/file`,level:t,options:{destination:r}}}makeTransportLevel(e){return this.options.debug?`trace`:e??`info`}makeGlobalLogLevel(e){if(this.options.debug)return`trace`;let t=e.at(0);if(!t)return`info`;let n={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},r=this.makeTransportLevel(t.level);for(let t of e.slice(1)){let e=this.makeTransportLevel(t.level);n[e]<n[r]&&(r=e)}return r}};function y(e={enabled:!1}){return new v(e)}export{c as makeConsoleFixture,y as makeLoggerFixture};
2
+ `)}formatPanelTop(e,n){let r=Math.max(1,n-this.visibleLength(e)-5);return`${t.dim(`╭─`)} ${e} ${t.dim(`─`.repeat(r))}${t.dim(`╮`)}`}formatPanelBottom(e){return`${t.dim(`╰`)}${t.dim(`─`.repeat(e-2))}${t.dim(`╯`)}`}formatPanelRow(e,n,r){let i=e.label.padEnd(14,` `),a=String(e.value),o=this.visibleLength(i)+this.visibleLength(a)+4,s=Math.max(0,n-o);return`${t.dim(`│`)} ${t.blue(i)}${r(a)}${` `.repeat(s)} ${t.dim(`│`)}`}getPanelWidth(e){return Math.max(48,this.getTitleWidth(e),this.getRowsWidth(e.rows))}getTitleWidth(e){return this.visibleLength(e.title)+6}getRowsWidth(e){return Math.max(0,...e.map(e=>this.getRowWidth(e)))}getRowWidth(e){return 14+this.visibleLength(String(e.value))+4}visibleLength(e){return e.replace(o,``).length}};function c(){return new s({enabled:!1})}function l(e,t){if(n.isAbsolute(t))return n.normalize(t);let r;try{let t=new URL(e);if(t.protocol!==`file:`)throw Error(`Unsupported URL protocol "${t.protocol}"`);r=n.dirname(i(t))}catch{r=e}return n.resolve(r,t)}function u(e){let t=l(process.cwd(),e),i=r.existsSync(t)&&r.statSync(t).isDirectory()?t:n.dirname(t);if(!r.existsSync(i))throw Error(`Directory "${i}" does not exist.`);return t}function d(e){return e instanceof Error}function f(e,t={}){if(e==null)return{};let{filterNull:n=!0,filterUndefined:r=!0,filterEmptyString:i=!1,filterEmptyObject:a=!1,filterEmptyArray:o=!1}=t;return Object.keys(e).reduce((s,c)=>{let l=e[c];return p(l)&&Object.getPrototypeOf(l)===null&&(l=void 0),h(l)&&(l=f(l,t)),n&&l===null||r&&l===void 0||i&&l===``||a&&m(l)||o&&Array.isArray(l)&&l.length===0||(s[c]=l),s},{})}function p(e){return typeof e==`object`&&!!e}function m(e){return p(e)&&Object.keys(e).length===0}function h(e){return p(e)&&Object.getPrototypeOf(e)===Object.prototype}function g(e){return e==null||[`string`,`number`,`boolean`,`bigint`,`symbol`].includes(typeof e)}Array.prototype.isEmpty=function(){return this==null||this.length===0},String.prototype.capitalized=function(){let e=this==null?``:this.toString();return e.trim()?e.charAt(0).toUpperCase()+e.slice(1):``};var _=class{options;instance;constructor(e){this.options=e,this.instance=this.makeInstance()}info(e,t){this.log(`info`,e,t)}debug(e,t){this.log(`debug`,e,t)}trace(e,t){this.log(`trace`,e,t)}warn(e,t){this.log(`warn`,e,t)}error(e,t){this.log(`error`,e,t)}fatal(e,t){this.log(`fatal`,e,t)}child(e){return this.instance.child(e)}log(e,t,n){this.instance[e]({msg:t,...this.formatLogOptions(n)})}formatLogOptions(e){return e?this.normalizeObject({flag:e.flag,details:this.formatUnknown(e.details),error:this.formatUnknown(e.error),metadata:this.formatUnknown(e.metadata)}):{}}formatUnknown(e){if(d(e)){let t={type:e.constructor.name,message:e.message};this.options.debug&&e.stack&&(t.stack=e.stack);for(let[n,r]of Object.entries(e))n in t||(t[n]=r);let n=this.normalizeObject(t);return m(n)?void 0:n}if(Buffer.isBuffer(e))return`[Buffer]`;if(e&&typeof e.pipe==`function`)return`[Stream]`;if(p(e))try{let t=JSON.stringify(e);if(t===void 0)return;let n=JSON.parse(t);if(Array.isArray(n))return n.length>0?n:void 0;if(p(n)){let e=this.normalizeObject(n);return m(e)?void 0:e}return n}catch{return{type:`NonSerializableObject`}}return g(e)?e:String(e)}normalizeObject(e){return f(Object.fromEntries(Object.entries(e)),{filterNull:!0,filterUndefined:!0,filterEmptyString:!0,filterEmptyArray:!0,filterEmptyObject:!0})}makeInstance(){if(!this.options.enabled)return a({enabled:!1,timestamp:!0});let e=this.options.transports,t={level:this.makeGlobalLogLevel(e),enabled:!0,timestamp:!0,transport:{targets:this.makeTransportTargets(e)}};return a(t)}makeTransportTargets(e){if(e.filter(e=>e.type===`console`).length>1)throw Error(`[Logger] Multiple console transports are not supported.`);return e.map(e=>{switch(e.type){case`console`:return this.makeConsoleTransportTarget(e);case`file`:return this.makeFileTransportTarget(e)}})}makeConsoleTransportTarget(e){return{target:`pino-pretty`,level:this.makeTransportLevel(e.level),options:e.pretty}}makeFileTransportTarget(e){let t=this.makeTransportLevel(e.level),r=n.isAbsolute(e.path)?n.normalize(e.path):l(process.cwd(),e.path);return u(n.dirname(r)),{target:`pino/file`,level:t,options:{destination:r}}}makeTransportLevel(e){return this.options.debug?`trace`:e??`info`}makeGlobalLogLevel(e){if(this.options.debug)return`trace`;let t=e.at(0);if(!t)return`info`;let n={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},r=this.makeTransportLevel(t.level);for(let t of e.slice(1)){let e=this.makeTransportLevel(t.level);n[e]<n[r]&&(r=e)}return r}};function v(e={enabled:!1}){return new _(e)}export{c as makeConsoleFixture,v as makeLoggerFixture};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buildplease/core",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "keywords": [],
5
5
  "repository": {
6
6
  "type": "git",
@@ -57,8 +57,8 @@
57
57
  "pino-pretty": "13.1.3"
58
58
  },
59
59
  "devDependencies": {
60
- "@types/ms": "2.1.0",
61
- "@buildplease/identity": "1.0.0"
60
+ "@buildplease/identity": "1.0.0",
61
+ "@types/ms": "2.1.0"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "inversify": "8.2.3",