@raclettejs/core 0.1.30 → 0.1.31
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/CHANGELOG.md +2 -0
- package/dist/cli.js +1562 -0
- package/dist/cli.js.map +7 -0
- package/dist/index.js +452 -0
- package/dist/index.js.map +7 -0
- package/package.json +2 -2
package/dist/cli.js
ADDED
|
@@ -0,0 +1,1562 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
3
|
+
var $h=Object.create;var uo=Object.defineProperty;var Dh=Object.getOwnPropertyDescriptor;var Nh=Object.getOwnPropertyNames;var Lh=Object.getPrototypeOf,Ih=Object.prototype.hasOwnProperty;var M=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var yt=(e,t)=>()=>(e&&(t=e(e=0)),t);var k=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Fh=(e,t)=>{for(var r in t)uo(e,r,{get:t[r],enumerable:!0})},jh=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Nh(t))!Ih.call(e,o)&&o!==r&&uo(e,o,{get:()=>t[o],enumerable:!(n=Dh(t,o))||n.enumerable});return e};var Bt=(e,t,r)=>(r=e!=null?$h(Lh(e)):{},jh(t||!e||!e.__esModule?uo(r,"default",{value:e,enumerable:!0}):r,e));var mr=k(vo=>{var Ur=class extends Error{constructor(t,r,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=r,this.exitCode=t,this.nestedError=void 0}},yo=class extends Ur{constructor(t){super(1,"commander.invalidArgument",t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};vo.CommanderError=Ur;vo.InvalidArgumentError=yo});var qr=k(_o=>{var{InvalidArgumentError:em}=mr(),bo=class{constructor(t,r){switch(this.description=r||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,t[0]){case"<":this.required=!0,this._name=t.slice(1,-1);break;case"[":this.required=!1,this._name=t.slice(1,-1);break;default:this.required=!0,this._name=t;break}this._name.endsWith("...")&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(t,r){return r===this.defaultValue||!Array.isArray(r)?[t]:(r.push(t),r)}default(t,r){return this.defaultValue=t,this.defaultValueDescription=r,this}argParser(t){return this.parseArg=t,this}choices(t){return this.argChoices=t.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new em(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function tm(e){let t=e.name()+(e.variadic===!0?"...":"");return e.required?"<"+t+">":"["+t+"]"}_o.Argument=bo;_o.humanReadableArgName=tm});var ko=k(xo=>{var{humanReadableArgName:rm}=qr(),Eo=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(t){this.helpWidth=this.helpWidth??t.helpWidth??80}visibleCommands(t){let r=t.commands.filter(o=>!o._hidden),n=t._getHelpCommand();return n&&!n._hidden&&r.push(n),this.sortSubcommands&&r.sort((o,i)=>o.name().localeCompare(i.name())),r}compareOptions(t,r){let n=o=>o.short?o.short.replace(/^-/,""):o.long.replace(/^--/,"");return n(t).localeCompare(n(r))}visibleOptions(t){let r=t.options.filter(o=>!o.hidden),n=t._getHelpOption();if(n&&!n.hidden){let o=n.short&&t._findOption(n.short),i=n.long&&t._findOption(n.long);!o&&!i?r.push(n):n.long&&!i?r.push(t.createOption(n.long,n.description)):n.short&&!o&&r.push(t.createOption(n.short,n.description))}return this.sortOptions&&r.sort(this.compareOptions),r}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];let r=[];for(let n=t.parent;n;n=n.parent){let o=n.options.filter(i=>!i.hidden);r.push(...o)}return this.sortOptions&&r.sort(this.compareOptions),r}visibleArguments(t){return t._argsDescription&&t.registeredArguments.forEach(r=>{r.description=r.description||t._argsDescription[r.name()]||""}),t.registeredArguments.find(r=>r.description)?t.registeredArguments:[]}subcommandTerm(t){let r=t.registeredArguments.map(n=>rm(n)).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,r){return r.visibleCommands(t).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleSubcommandTerm(r.subcommandTerm(o)))),0)}longestOptionTermLength(t,r){return r.visibleOptions(t).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(o)))),0)}longestGlobalOptionTermLength(t,r){return r.visibleGlobalOptions(t).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleOptionTerm(r.optionTerm(o)))),0)}longestArgumentTermLength(t,r){return r.visibleArguments(t).reduce((n,o)=>Math.max(n,this.displayWidth(r.styleArgumentTerm(r.argumentTerm(o)))),0)}commandUsage(t){let r=t._name;t._aliases[0]&&(r=r+"|"+t._aliases[0]);let n="";for(let o=t.parent;o;o=o.parent)n=o.name()+" "+n;return n+r+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){let r=[];if(t.argChoices&&r.push(`choices: ${t.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),t.defaultValue!==void 0&&(t.required||t.optional||t.isBoolean()&&typeof t.defaultValue=="boolean")&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),t.presetArg!==void 0&&t.optional&&r.push(`preset: ${JSON.stringify(t.presetArg)}`),t.envVar!==void 0&&r.push(`env: ${t.envVar}`),r.length>0){let n=`(${r.join(", ")})`;return t.description?`${t.description} ${n}`:n}return t.description}argumentDescription(t){let r=[];if(t.argChoices&&r.push(`choices: ${t.argChoices.map(n=>JSON.stringify(n)).join(", ")}`),t.defaultValue!==void 0&&r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`),r.length>0){let n=`(${r.join(", ")})`;return t.description?`${t.description} ${n}`:n}return t.description}formatItemList(t,r,n){return r.length===0?[]:[n.styleTitle(t),...r,""]}groupItems(t,r,n){let o=new Map;return t.forEach(i=>{let s=n(i);o.has(s)||o.set(s,[])}),r.forEach(i=>{let s=n(i);o.has(s)||o.set(s,[]),o.get(s).push(i)}),o}formatHelp(t,r){let n=r.padWidth(t,r),o=r.helpWidth??80;function i(p,d){return r.formatItem(p,n,d,r)}let s=[`${r.styleTitle("Usage:")} ${r.styleUsage(r.commandUsage(t))}`,""],a=r.commandDescription(t);a.length>0&&(s=s.concat([r.boxWrap(r.styleCommandDescription(a),o),""]));let c=r.visibleArguments(t).map(p=>i(r.styleArgumentTerm(r.argumentTerm(p)),r.styleArgumentDescription(r.argumentDescription(p))));if(s=s.concat(this.formatItemList("Arguments:",c,r)),this.groupItems(t.options,r.visibleOptions(t),p=>p.helpGroupHeading??"Options:").forEach((p,d)=>{let y=p.map(g=>i(r.styleOptionTerm(r.optionTerm(g)),r.styleOptionDescription(r.optionDescription(g))));s=s.concat(this.formatItemList(d,y,r))}),r.showGlobalOptions){let p=r.visibleGlobalOptions(t).map(d=>i(r.styleOptionTerm(r.optionTerm(d)),r.styleOptionDescription(r.optionDescription(d))));s=s.concat(this.formatItemList("Global Options:",p,r))}return this.groupItems(t.commands,r.visibleCommands(t),p=>p.helpGroup()||"Commands:").forEach((p,d)=>{let y=p.map(g=>i(r.styleSubcommandTerm(r.subcommandTerm(g)),r.styleSubcommandDescription(r.subcommandDescription(g))));s=s.concat(this.formatItemList(d,y,r))}),s.join(`
|
|
4
|
+
`)}displayWidth(t){return Xa(t).length}styleTitle(t){return t}styleUsage(t){return t.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r==="[command]"?this.styleSubcommandText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleCommandText(r)).join(" ")}styleCommandDescription(t){return this.styleDescriptionText(t)}styleOptionDescription(t){return this.styleDescriptionText(t)}styleSubcommandDescription(t){return this.styleDescriptionText(t)}styleArgumentDescription(t){return this.styleDescriptionText(t)}styleDescriptionText(t){return t}styleOptionTerm(t){return this.styleOptionText(t)}styleSubcommandTerm(t){return t.split(" ").map(r=>r==="[options]"?this.styleOptionText(r):r[0]==="["||r[0]==="<"?this.styleArgumentText(r):this.styleSubcommandText(r)).join(" ")}styleArgumentTerm(t){return this.styleArgumentText(t)}styleOptionText(t){return t}styleArgumentText(t){return t}styleSubcommandText(t){return t}styleCommandText(t){return t}padWidth(t,r){return Math.max(r.longestOptionTermLength(t,r),r.longestGlobalOptionTermLength(t,r),r.longestSubcommandTermLength(t,r),r.longestArgumentTermLength(t,r))}preformatted(t){return/\n[^\S\r\n]/.test(t)}formatItem(t,r,n,o){let s=" ".repeat(2);if(!n)return s+t;let a=t.padEnd(r+t.length-o.displayWidth(t)),c=2,l=(this.helpWidth??80)-r-c-2,p;return l<this.minWidthToWrap||o.preformatted(n)?p=n:p=o.boxWrap(n,l).replace(/\n/g,`
|
|
5
|
+
`+" ".repeat(r+c)),s+a+" ".repeat(c)+p.replace(/\n/g,`
|
|
6
|
+
${s}`)}boxWrap(t,r){if(r<this.minWidthToWrap)return t;let n=t.split(/\r\n|\n/),o=/[\s]*[^\s]+/g,i=[];return n.forEach(s=>{let a=s.match(o);if(a===null){i.push("");return}let c=[a.shift()],u=this.displayWidth(c[0]);a.forEach(l=>{let p=this.displayWidth(l);if(u+p<=r){c.push(l),u+=p;return}i.push(c.join(""));let d=l.trimStart();c=[d],u=this.displayWidth(d)}),i.push(c.join(""))}),i.join(`
|
|
7
|
+
`)}};function Xa(e){let t=/\x1b\[\d*(;\d*)*m/g;return e.replace(t,"")}xo.Help=Eo;xo.stripColor=Xa});var So=k(Ao=>{var{InvalidArgumentError:nm}=mr(),wo=class{constructor(t,r){this.flags=t,this.description=r||"",this.required=t.includes("<"),this.optional=t.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(t),this.mandatory=!1;let n=om(t);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(t,r){return this.defaultValue=t,this.defaultValueDescription=r,this}preset(t){return this.presetArg=t,this}conflicts(t){return this.conflictsWith=this.conflictsWith.concat(t),this}implies(t){let r=t;return typeof t=="string"&&(r={[t]:!0}),this.implied=Object.assign(this.implied||{},r),this}env(t){return this.envVar=t,this}argParser(t){return this.parseArg=t,this}makeOptionMandatory(t=!0){return this.mandatory=!!t,this}hideHelp(t=!0){return this.hidden=!!t,this}_collectValue(t,r){return r===this.defaultValue||!Array.isArray(r)?[t]:(r.push(t),r)}choices(t){return this.argChoices=t.slice(),this.parseArg=(r,n)=>{if(!this.argChoices.includes(r))throw new nm(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._collectValue(r,n):r},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return this.negate?Ja(this.name().replace(/^no-/,"")):Ja(this.name())}helpGroup(t){return this.helpGroupHeading=t,this}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}},Co=class{constructor(t){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,t.forEach(r=>{r.negate?this.negativeOptions.set(r.attributeName(),r):this.positiveOptions.set(r.attributeName(),r)}),this.negativeOptions.forEach((r,n)=>{this.positiveOptions.has(n)&&this.dualOptions.add(n)})}valueFromOption(t,r){let n=r.attributeName();if(!this.dualOptions.has(n))return!0;let o=this.negativeOptions.get(n).presetArg,i=o!==void 0?o:!1;return r.negate===(i===t)}};function Ja(e){return e.split("-").reduce((t,r)=>t+r[0].toUpperCase()+r.slice(1))}function om(e){let t,r,n=/^-[^-]$/,o=/^--[^-]/,i=e.split(/[ |,]+/).concat("guard");if(n.test(i[0])&&(t=i.shift()),o.test(i[0])&&(r=i.shift()),!t&&n.test(i[0])&&(t=i.shift()),!t&&o.test(i[0])&&(t=r,r=i.shift()),i[0].startsWith("-")){let s=i[0],a=`option creation failed due to '${s}' in option flags '${e}'`;throw/^-[^-][^-]/.test(s)?new Error(`${a}
|
|
8
|
+
- a short flag is a single dash and a single character
|
|
9
|
+
- either use a single dash and a single character (for a short flag)
|
|
10
|
+
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`):n.test(s)?new Error(`${a}
|
|
11
|
+
- too many short flags`):o.test(s)?new Error(`${a}
|
|
12
|
+
- too many long flags`):new Error(`${a}
|
|
13
|
+
- unrecognised flag format`)}if(t===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:r}}Ao.Option=wo;Ao.DualOptions=Co});var Za=k(Qa=>{function im(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let r=[];for(let n=0;n<=e.length;n++)r[n]=[n];for(let n=0;n<=t.length;n++)r[0][n]=n;for(let n=1;n<=t.length;n++)for(let o=1;o<=e.length;o++){let i=1;e[o-1]===t[n-1]?i=0:i=1,r[o][n]=Math.min(r[o-1][n]+1,r[o][n-1]+1,r[o-1][n-1]+i),o>1&&n>1&&e[o-1]===t[n-2]&&e[o-2]===t[n-1]&&(r[o][n]=Math.min(r[o][n],r[o-2][n-2]+1))}return r[e.length][t.length]}function sm(e,t){if(!t||t.length===0)return"";t=Array.from(new Set(t));let r=e.startsWith("--");r&&(e=e.slice(2),t=t.map(s=>s.slice(2)));let n=[],o=3,i=.4;return t.forEach(s=>{if(s.length<=1)return;let a=im(e,s),c=Math.max(e.length,s.length);(c-a)/c>i&&(a<o?(o=a,n=[s]):a===o&&n.push(s))}),n.sort((s,a)=>s.localeCompare(a)),r&&(n=n.map(s=>`--${s}`)),n.length>1?`
|
|
14
|
+
(Did you mean one of ${n.join(", ")}?)`:n.length===1?`
|
|
15
|
+
(Did you mean ${n[0]}?)`:""}Qa.suggestSimilar=sm});var nc=k($o=>{var am=M("node:events").EventEmitter,Ro=M("node:child_process"),rt=M("node:path"),Yr=M("node:fs"),B=M("node:process"),{Argument:cm,humanReadableArgName:lm}=qr(),{CommanderError:Oo}=mr(),{Help:um,stripColor:pm}=ko(),{Option:ec,DualOptions:dm}=So(),{suggestSimilar:tc}=Za(),To=class e extends am{constructor(t){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=t||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:r=>B.stdout.write(r),writeErr:r=>B.stderr.write(r),outputError:(r,n)=>n(r),getOutHelpWidth:()=>B.stdout.isTTY?B.stdout.columns:void 0,getErrHelpWidth:()=>B.stderr.isTTY?B.stderr.columns:void 0,getOutHasColors:()=>Po()??(B.stdout.isTTY&&B.stdout.hasColors?.()),getErrHasColors:()=>Po()??(B.stderr.isTTY&&B.stderr.hasColors?.()),stripColor:r=>pm(r)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(t){return this._outputConfiguration=t._outputConfiguration,this._helpOption=t._helpOption,this._helpCommand=t._helpCommand,this._helpConfiguration=t._helpConfiguration,this._exitCallback=t._exitCallback,this._storeOptionsAsProperties=t._storeOptionsAsProperties,this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue,this._allowExcessArguments=t._allowExcessArguments,this._enablePositionalOptions=t._enablePositionalOptions,this._showHelpAfterError=t._showHelpAfterError,this._showSuggestionAfterError=t._showSuggestionAfterError,this}_getCommandAndAncestors(){let t=[];for(let r=this;r;r=r.parent)t.push(r);return t}command(t,r,n){let o=r,i=n;typeof o=="object"&&o!==null&&(i=o,o=null),i=i||{};let[,s,a]=t.match(/([^ ]+) *(.*)/),c=this.createCommand(s);return o&&(c.description(o),c._executableHandler=!0),i.isDefault&&(this._defaultCommandName=c._name),c._hidden=!!(i.noHelp||i.hidden),c._executableFile=i.executableFile||null,a&&c.arguments(a),this._registerCommand(c),c.parent=this,c.copyInheritedSettings(this),o?this:c}createCommand(t){return new e(t)}createHelp(){return Object.assign(new um,this.configureHelp())}configureHelp(t){return t===void 0?this._helpConfiguration:(this._helpConfiguration=t,this)}configureOutput(t){return t===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...t},this)}showHelpAfterError(t=!0){return typeof t!="string"&&(t=!!t),this._showHelpAfterError=t,this}showSuggestionAfterError(t=!0){return this._showSuggestionAfterError=!!t,this}addCommand(t,r){if(!t._name)throw new Error(`Command passed to .addCommand() must have a name
|
|
16
|
+
- specify the name in Command constructor or using .name()`);return r=r||{},r.isDefault&&(this._defaultCommandName=t._name),(r.noHelp||r.hidden)&&(t._hidden=!0),this._registerCommand(t),t.parent=this,t._checkForBrokenPassThrough(),this}createArgument(t,r){return new cm(t,r)}argument(t,r,n,o){let i=this.createArgument(t,r);return typeof n=="function"?i.default(o).argParser(n):i.default(n),this.addArgument(i),this}arguments(t){return t.trim().split(/ +/).forEach(r=>{this.argument(r)}),this}addArgument(t){let r=this.registeredArguments.slice(-1)[0];if(r?.variadic)throw new Error(`only the last argument can be variadic '${r.name()}'`);if(t.required&&t.defaultValue!==void 0&&t.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${t.name()}'`);return this.registeredArguments.push(t),this}helpCommand(t,r){if(typeof t=="boolean")return this._addImplicitHelpCommand=t,t&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let n=t??"help [command]",[,o,i]=n.match(/([^ ]+) *(.*)/),s=r??"display help for command",a=this.createCommand(o);return a.helpOption(!1),i&&a.arguments(i),s&&a.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=a,(t||r)&&this._initCommandGroup(a),this}addHelpCommand(t,r){return typeof t!="object"?(this.helpCommand(t,r),this):(this._addImplicitHelpCommand=!0,this._helpCommand=t,this._initCommandGroup(t),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(t,r){let n=["preSubcommand","preAction","postAction"];if(!n.includes(t))throw new Error(`Unexpected value for event passed to hook : '${t}'.
|
|
17
|
+
Expecting one of '${n.join("', '")}'`);return this._lifeCycleHooks[t]?this._lifeCycleHooks[t].push(r):this._lifeCycleHooks[t]=[r],this}exitOverride(t){return t?this._exitCallback=t:this._exitCallback=r=>{if(r.code!=="commander.executeSubCommandAsync")throw r},this}_exit(t,r,n){this._exitCallback&&this._exitCallback(new Oo(t,r,n)),B.exit(t)}action(t){let r=n=>{let o=this.registeredArguments.length,i=n.slice(0,o);return this._storeOptionsAsProperties?i[o]=this:i[o]=this.opts(),i.push(this),t.apply(this,i)};return this._actionHandler=r,this}createOption(t,r){return new ec(t,r)}_callParseArg(t,r,n,o){try{return t.parseArg(r,n)}catch(i){if(i.code==="commander.invalidArgument"){let s=`${o} ${i.message}`;this.error(s,{exitCode:i.exitCode,code:i.code})}throw i}}_registerOption(t){let r=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(r){let n=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
|
|
18
|
+
- already used by option '${r.flags}'`)}this._initOptionGroup(t),this.options.push(t)}_registerCommand(t){let r=o=>[o.name()].concat(o.aliases()),n=r(t).find(o=>this._findCommand(o));if(n){let o=r(this._findCommand(n)).join("|"),i=r(t).join("|");throw new Error(`cannot add command '${i}' as already have command '${o}'`)}this._initCommandGroup(t),this.commands.push(t)}addOption(t){this._registerOption(t);let r=t.name(),n=t.attributeName();if(t.negate){let i=t.long.replace(/^--no-/,"--");this._findOption(i)||this.setOptionValueWithSource(n,t.defaultValue===void 0?!0:t.defaultValue,"default")}else t.defaultValue!==void 0&&this.setOptionValueWithSource(n,t.defaultValue,"default");let o=(i,s,a)=>{i==null&&t.presetArg!==void 0&&(i=t.presetArg);let c=this.getOptionValue(n);i!==null&&t.parseArg?i=this._callParseArg(t,i,c,s):i!==null&&t.variadic&&(i=t._collectValue(i,c)),i==null&&(t.negate?i=!1:t.isBoolean()||t.optional?i=!0:i=""),this.setOptionValueWithSource(n,i,a)};return this.on("option:"+r,i=>{let s=`error: option '${t.flags}' argument '${i}' is invalid.`;o(i,s,"cli")}),t.envVar&&this.on("optionEnv:"+r,i=>{let s=`error: option '${t.flags}' value '${i}' from env '${t.envVar}' is invalid.`;o(i,s,"env")}),this}_optionEx(t,r,n,o,i){if(typeof r=="object"&&r instanceof ec)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let s=this.createOption(r,n);if(s.makeOptionMandatory(!!t.mandatory),typeof o=="function")s.default(i).argParser(o);else if(o instanceof RegExp){let a=o;o=(c,u)=>{let l=a.exec(c);return l?l[0]:u},s.default(i).argParser(o)}else s.default(o);return this.addOption(s)}option(t,r,n,o){return this._optionEx({},t,r,n,o)}requiredOption(t,r,n,o){return this._optionEx({mandatory:!0},t,r,n,o)}combineFlagAndOptionalValue(t=!0){return this._combineFlagAndOptionalValue=!!t,this}allowUnknownOption(t=!0){return this._allowUnknownOption=!!t,this}allowExcessArguments(t=!0){return this._allowExcessArguments=!!t,this}enablePositionalOptions(t=!0){return this._enablePositionalOptions=!!t,this}passThroughOptions(t=!0){return this._passThroughOptions=!!t,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(t=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!t,this}getOptionValue(t){return this._storeOptionsAsProperties?this[t]:this._optionValues[t]}setOptionValue(t,r){return this.setOptionValueWithSource(t,r,void 0)}setOptionValueWithSource(t,r,n){return this._storeOptionsAsProperties?this[t]=r:this._optionValues[t]=r,this._optionValueSources[t]=n,this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let r;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(t)!==void 0&&(r=n.getOptionValueSource(t))}),r}_prepareUserArgs(t,r){if(t!==void 0&&!Array.isArray(t))throw new Error("first parameter to parse must be array or undefined");if(r=r||{},t===void 0&&r.from===void 0){B.versions?.electron&&(r.from="electron");let o=B.execArgv??[];(o.includes("-e")||o.includes("--eval")||o.includes("-p")||o.includes("--print"))&&(r.from="eval")}t===void 0&&(t=B.argv),this.rawArgs=t.slice();let n;switch(r.from){case void 0:case"node":this._scriptPath=t[1],n=t.slice(2);break;case"electron":B.defaultApp?(this._scriptPath=t[1],n=t.slice(2)):n=t.slice(1);break;case"user":n=t.slice(0);break;case"eval":n=t.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",n}parse(t,r){this._prepareForParse();let n=this._prepareUserArgs(t,r);return this._parseCommand([],n),this}async parseAsync(t,r){this._prepareForParse();let n=this._prepareUserArgs(t,r);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw new Error(`Can not call parse again when storeOptionsAsProperties is true.
|
|
19
|
+
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(t,r,n){if(Yr.existsSync(t))return;let o=r?`searched for local subcommand relative to directory '${r}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",i=`'${t}' does not exist
|
|
20
|
+
- if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
21
|
+
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
22
|
+
- ${o}`;throw new Error(i)}_executeSubCommand(t,r){r=r.slice();let n=!1,o=[".js",".ts",".tsx",".mjs",".cjs"];function i(l,p){let d=rt.resolve(l,p);if(Yr.existsSync(d))return d;if(o.includes(rt.extname(p)))return;let y=o.find(g=>Yr.existsSync(`${d}${g}`));if(y)return`${d}${y}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let s=t._executableFile||`${this._name}-${t._name}`,a=this._executableDir||"";if(this._scriptPath){let l;try{l=Yr.realpathSync(this._scriptPath)}catch{l=this._scriptPath}a=rt.resolve(rt.dirname(l),a)}if(a){let l=i(a,s);if(!l&&!t._executableFile&&this._scriptPath){let p=rt.basename(this._scriptPath,rt.extname(this._scriptPath));p!==this._name&&(l=i(a,`${p}-${t._name}`))}s=l||s}n=o.includes(rt.extname(s));let c;B.platform!=="win32"?n?(r.unshift(s),r=rc(B.execArgv).concat(r),c=Ro.spawn(B.argv[0],r,{stdio:"inherit"})):c=Ro.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,t._name),r.unshift(s),r=rc(B.execArgv).concat(r),c=Ro.spawn(B.execPath,r,{stdio:"inherit"})),c.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(p=>{B.on(p,()=>{c.killed===!1&&c.exitCode===null&&c.kill(p)})});let u=this._exitCallback;c.on("close",l=>{l=l??1,u?u(new Oo(l,"commander.executeSubCommandAsync","(close)")):B.exit(l)}),c.on("error",l=>{if(l.code==="ENOENT")this._checkForMissingExecutable(s,a,t._name);else if(l.code==="EACCES")throw new Error(`'${s}' not executable`);if(!u)B.exit(1);else{let p=new Oo(1,"commander.executeSubCommandAsync","(error)");p.nestedError=l,u(p)}}),this.runningCommand=c}_dispatchSubcommand(t,r,n){let o=this._findCommand(t);o||this.help({error:!0}),o._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,o,"preSubcommand"),i=this._chainOrCall(i,()=>{if(o._executableHandler)this._executeSubCommand(o,r.concat(n));else return o._parseCommand(r,n)}),i}_dispatchHelpCommand(t){t||this.help();let r=this._findCommand(t);return r&&!r._executableHandler&&r.help(),this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((t,r)=>{t.required&&this.args[r]==null&&this.missingArgument(t.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let t=(n,o,i)=>{let s=o;if(o!==null&&n.parseArg){let a=`error: command-argument value '${o}' is invalid for argument '${n.name()}'.`;s=this._callParseArg(n,o,i,a)}return s};this._checkNumberOfArguments();let r=[];this.registeredArguments.forEach((n,o)=>{let i=n.defaultValue;n.variadic?o<this.args.length?(i=this.args.slice(o),n.parseArg&&(i=i.reduce((s,a)=>t(n,a,s),n.defaultValue))):i===void 0&&(i=[]):o<this.args.length&&(i=this.args[o],n.parseArg&&(i=t(n,i,n.defaultValue))),r[o]=i}),this.processedArgs=r}_chainOrCall(t,r){return t?.then&&typeof t.then=="function"?t.then(()=>r()):r()}_chainOrCallHooks(t,r){let n=t,o=[];return this._getCommandAndAncestors().reverse().filter(i=>i._lifeCycleHooks[r]!==void 0).forEach(i=>{i._lifeCycleHooks[r].forEach(s=>{o.push({hookedCommand:i,callback:s})})}),r==="postAction"&&o.reverse(),o.forEach(i=>{n=this._chainOrCall(n,()=>i.callback(i.hookedCommand,this))}),n}_chainOrCallSubCommandHook(t,r,n){let o=t;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(i=>{o=this._chainOrCall(o,()=>i(this,r))}),o}_parseCommand(t,r){let n=this.parseOptions(r);if(this._parseOptionsEnv(),this._parseOptionsImplied(),t=t.concat(n.operands),r=n.unknown,this.args=t.concat(r),t&&this._findCommand(t[0]))return this._dispatchSubcommand(t[0],t.slice(1),r);if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(t[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(r),this._dispatchSubcommand(this._defaultCommandName,t,r);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let o=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){o(),this._processArguments();let s;return s=this._chainOrCallHooks(s,"preAction"),s=this._chainOrCall(s,()=>this._actionHandler(this.processedArgs)),this.parent&&(s=this._chainOrCall(s,()=>{this.parent.emit(i,t,r)})),s=this._chainOrCallHooks(s,"postAction"),s}if(this.parent?.listenerCount(i))o(),this._processArguments(),this.parent.emit(i,t,r);else if(t.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",t,r);this.listenerCount("command:*")?this.emit("command:*",t,r):this.commands.length?this.unknownCommand():(o(),this._processArguments())}else this.commands.length?(o(),this.help({error:!0})):(o(),this._processArguments())}_findCommand(t){if(t)return this.commands.find(r=>r._name===t||r._aliases.includes(t))}_findOption(t){return this.options.find(r=>r.is(t))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(t=>{t.options.forEach(r=>{r.mandatory&&t.getOptionValue(r.attributeName())===void 0&&t.missingMandatoryOptionValue(r)})})}_checkForConflictingLocalOptions(){let t=this.options.filter(n=>{let o=n.attributeName();return this.getOptionValue(o)===void 0?!1:this.getOptionValueSource(o)!=="default"});t.filter(n=>n.conflictsWith.length>0).forEach(n=>{let o=t.find(i=>n.conflictsWith.includes(i.attributeName()));o&&this._conflictingOption(n,o)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(t=>{t._checkForConflictingLocalOptions()})}parseOptions(t){let r=[],n=[],o=r;function i(l){return l.length>1&&l[0]==="-"}let s=l=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(l)?!this._getCommandAndAncestors().some(p=>p.options.map(d=>d.short).some(d=>/^-\d$/.test(d))):!1,a=null,c=null,u=0;for(;u<t.length||c;){let l=c??t[u++];if(c=null,l==="--"){o===n&&o.push(l),o.push(...t.slice(u));break}if(a&&(!i(l)||s(l))){this.emit(`option:${a.name()}`,l);continue}if(a=null,i(l)){let p=this._findOption(l);if(p){if(p.required){let d=t[u++];d===void 0&&this.optionMissingArgument(p),this.emit(`option:${p.name()}`,d)}else if(p.optional){let d=null;u<t.length&&(!i(t[u])||s(t[u]))&&(d=t[u++]),this.emit(`option:${p.name()}`,d)}else this.emit(`option:${p.name()}`);a=p.variadic?p:null;continue}}if(l.length>2&&l[0]==="-"&&l[1]!=="-"){let p=this._findOption(`-${l[1]}`);if(p){p.required||p.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${p.name()}`,l.slice(2)):(this.emit(`option:${p.name()}`),c=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let p=l.indexOf("="),d=this._findOption(l.slice(0,p));if(d&&(d.required||d.optional)){this.emit(`option:${d.name()}`,l.slice(p+1));continue}}if(o===r&&i(l)&&!(this.commands.length===0&&s(l))&&(o=n),(this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&n.length===0){if(this._findCommand(l)){r.push(l),n.push(...t.slice(u));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){r.push(l,...t.slice(u));break}else if(this._defaultCommandName){n.push(l,...t.slice(u));break}}if(this._passThroughOptions){o.push(l,...t.slice(u));break}o.push(l)}return{operands:r,unknown:n}}opts(){if(this._storeOptionsAsProperties){let t={},r=this.options.length;for(let n=0;n<r;n++){let o=this.options[n].attributeName();t[o]=o===this._versionOptionName?this._version:this[o]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((t,r)=>Object.assign(t,r.opts()),{})}error(t,r){this._outputConfiguration.outputError(`${t}
|
|
23
|
+
`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
|
|
24
|
+
`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
25
|
+
`),this.outputHelp({error:!0}));let n=r||{},o=n.exitCode||1,i=n.code||"commander.error";this._exit(o,i,t)}_parseOptionsEnv(){this.options.forEach(t=>{if(t.envVar&&t.envVar in B.env){let r=t.attributeName();(this.getOptionValue(r)===void 0||["default","config","env"].includes(this.getOptionValueSource(r)))&&(t.required||t.optional?this.emit(`optionEnv:${t.name()}`,B.env[t.envVar]):this.emit(`optionEnv:${t.name()}`))}})}_parseOptionsImplied(){let t=new dm(this.options),r=n=>this.getOptionValue(n)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(n));this.options.filter(n=>n.implied!==void 0&&r(n.attributeName())&&t.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(n=>{Object.keys(n.implied).filter(o=>!r(o)).forEach(o=>{this.setOptionValueWithSource(o,n.implied[o],"implied")})})}missingArgument(t){let r=`error: missing required argument '${t}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(t){let r=`error: option '${t.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){let r=`error: required option '${t.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,r){let n=s=>{let a=s.attributeName(),c=this.getOptionValue(a),u=this.options.find(p=>p.negate&&a===p.attributeName()),l=this.options.find(p=>!p.negate&&a===p.attributeName());return u&&(u.presetArg===void 0&&c===!1||u.presetArg!==void 0&&c===u.presetArg)?u:l||s},o=s=>{let a=n(s),c=a.attributeName();return this.getOptionValueSource(c)==="env"?`environment variable '${a.envVar}'`:`option '${a.flags}'`},i=`error: ${o(t)} cannot be used with ${o(r)}`;this.error(i,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let r="";if(t.startsWith("--")&&this._showSuggestionAfterError){let o=[],i=this;do{let s=i.createHelp().visibleOptions(i).filter(a=>a.long).map(a=>a.long);o=o.concat(s),i=i.parent}while(i&&!i._enablePositionalOptions);r=tc(t,o)}let n=`error: unknown option '${t}'${r}`;this.error(n,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;let r=this.registeredArguments.length,n=r===1?"":"s",i=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${r} argument${n} but got ${t.length}.`;this.error(i,{code:"commander.excessArguments"})}unknownCommand(){let t=this.args[0],r="";if(this._showSuggestionAfterError){let o=[];this.createHelp().visibleCommands(this).forEach(i=>{o.push(i.name()),i.alias()&&o.push(i.alias())}),r=tc(t,o)}let n=`error: unknown command '${t}'${r}`;this.error(n,{code:"commander.unknownCommand"})}version(t,r,n){if(t===void 0)return this._version;this._version=t,r=r||"-V, --version",n=n||"output the version number";let o=this.createOption(r,n);return this._versionOptionName=o.attributeName(),this._registerOption(o),this.on("option:"+o.name(),()=>{this._outputConfiguration.writeOut(`${t}
|
|
26
|
+
`),this._exit(0,"commander.version",t)}),this}description(t,r){return t===void 0&&r===void 0?this._description:(this._description=t,r&&(this._argsDescription=r),this)}summary(t){return t===void 0?this._summary:(this._summary=t,this)}alias(t){if(t===void 0)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(r=this.commands[this.commands.length-1]),t===r._name)throw new Error("Command alias can't be the same as its name");let n=this.parent?._findCommand(t);if(n){let o=[n.name()].concat(n.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${o}'`)}return r._aliases.push(t),this}aliases(t){return t===void 0?this._aliases:(t.forEach(r=>this.alias(r)),this)}usage(t){if(t===void 0){if(this._usage)return this._usage;let r=this.registeredArguments.map(n=>lm(n));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?r:[]).join(" ")}return this._usage=t,this}name(t){return t===void 0?this._name:(this._name=t,this)}helpGroup(t){return t===void 0?this._helpGroupHeading??"":(this._helpGroupHeading=t,this)}commandsGroup(t){return t===void 0?this._defaultCommandGroup??"":(this._defaultCommandGroup=t,this)}optionsGroup(t){return t===void 0?this._defaultOptionGroup??"":(this._defaultOptionGroup=t,this)}_initOptionGroup(t){this._defaultOptionGroup&&!t.helpGroupHeading&&t.helpGroup(this._defaultOptionGroup)}_initCommandGroup(t){this._defaultCommandGroup&&!t.helpGroup()&&t.helpGroup(this._defaultCommandGroup)}nameFromFilename(t){return this._name=rt.basename(t,rt.extname(t)),this}executableDir(t){return t===void 0?this._executableDir:(this._executableDir=t,this)}helpInformation(t){let r=this.createHelp(),n=this._getOutputContext(t);r.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let o=r.formatHelp(this,r);return n.hasColors?o:this._outputConfiguration.stripColor(o)}_getOutputContext(t){t=t||{};let r=!!t.error,n,o,i;return r?(n=a=>this._outputConfiguration.writeErr(a),o=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=a=>this._outputConfiguration.writeOut(a),o=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:r,write:a=>(o||(a=this._outputConfiguration.stripColor(a)),n(a)),hasColors:o,helpWidth:i}}outputHelp(t){let r;typeof t=="function"&&(r=t,t=void 0);let n=this._getOutputContext(t),o={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",o)),this.emit("beforeHelp",o);let i=this.helpInformation({error:n.error});if(r&&(i=r(i),typeof i!="string"&&!Buffer.isBuffer(i)))throw new Error("outputHelp callback must return a string or a Buffer");n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",o),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",o))}helpOption(t,r){return typeof t=="boolean"?(t?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(t??"-h, --help",r??"display help for command"),(t||r)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(t){return this._helpOption=t,this._initOptionGroup(t),this}help(t){this.outputHelp(t);let r=Number(B.exitCode??0);r===0&&t&&typeof t!="function"&&t.error&&(r=1),this._exit(r,"commander.help","(outputHelp)")}addHelpText(t,r){let n=["beforeAll","before","after","afterAll"];if(!n.includes(t))throw new Error(`Unexpected value for position to addHelpText.
|
|
27
|
+
Expecting one of '${n.join("', '")}'`);let o=`${t}Help`;return this.on(o,i=>{let s;typeof r=="function"?s=r({error:i.error,command:i.command}):s=r,s&&i.write(`${s}
|
|
28
|
+
`)}),this}_outputHelpIfRequested(t){let r=this._getHelpOption();r&&t.find(o=>r.is(o))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function rc(e){return e.map(t=>{if(!t.startsWith("--inspect"))return t;let r,n="127.0.0.1",o="9229",i;return(i=t.match(/^(--inspect(-brk)?)$/))!==null?r=i[1]:(i=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(r=i[1],/^\d+$/.test(i[3])?o=i[3]:n=i[3]):(i=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(r=i[1],n=i[3],o=i[4]),r&&o!=="0"?`${r}=${n}:${parseInt(o)+1}`:t})}function Po(){if(B.env.NO_COLOR||B.env.FORCE_COLOR==="0"||B.env.FORCE_COLOR==="false")return!1;if(B.env.FORCE_COLOR||B.env.CLICOLOR_FORCE!==void 0)return!0}$o.Command=To;$o.useColor=Po});var ac=k($e=>{var{Argument:oc}=qr(),{Command:Do}=nc(),{CommanderError:fm,InvalidArgumentError:ic}=mr(),{Help:hm}=ko(),{Option:sc}=So();$e.program=new Do;$e.createCommand=e=>new Do(e);$e.createOption=(e,t)=>new sc(e,t);$e.createArgument=(e,t)=>new oc(e,t);$e.Command=Do;$e.Option=sc;$e.Argument=oc;$e.Help=hm;$e.CommanderError=fm;$e.InvalidArgumentError=ic;$e.InvalidOptionArgumentError=ic});var ml=k((MA,Fy)=>{Fy.exports={name:"dotenv",version:"17.3.1",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run tests/**/*.js --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run tests/**/*.js --show-full-coverage --timeout=60000 --coverage-report=text --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},homepage:"https://github.com/motdotla/dotenv#readme",funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var El=k((BA,ot)=>{var Ko=M("fs"),tn=M("path"),jy=M("os"),My=M("crypto"),By=ml(),zo=By.version,gl=["\u{1F510} encrypt with Dotenvx: https://dotenvx.com","\u{1F510} prevent committing .env to code: https://dotenvx.com/precommit","\u{1F510} prevent building .env in docker: https://dotenvx.com/prebuild","\u{1F916} agentic secret storage: https://dotenvx.com/as2","\u26A1\uFE0F secrets for agents: https://dotenvx.com/as2","\u{1F6E1}\uFE0F auth for agents: https://vestauth.com","\u{1F6E0}\uFE0F run anywhere with `dotenvx run -- yourcommand`","\u2699\uFE0F specify custom .env file path with { path: '/custom/path/.env' }","\u2699\uFE0F enable debug logging with { debug: true }","\u2699\uFE0F override existing env vars with { override: true }","\u2699\uFE0F suppress all logs with { quiet: true }","\u2699\uFE0F write to custom object with { processEnv: myObject }","\u2699\uFE0F load multiple .env files with { path: ['.env.local', '.env'] }"];function Hy(){return gl[Math.floor(Math.random()*gl.length)]}function Kt(e){return typeof e=="string"?!["false","0","no","off",""].includes(e.toLowerCase()):!!e}function Gy(){return process.stdout.isTTY}function Vy(e){return Gy()?`\x1B[2m${e}\x1B[0m`:e}var Wy=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function Uy(e){let t={},r=e.toString();r=r.replace(/\r\n?/mg,`
|
|
29
|
+
`);let n;for(;(n=Wy.exec(r))!=null;){let o=n[1],i=n[2]||"";i=i.trim();let s=i[0];i=i.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),s==='"'&&(i=i.replace(/\\n/g,`
|
|
30
|
+
`),i=i.replace(/\\r/g,"\r")),t[o]=i}return t}function qy(e){e=e||{};let t=_l(e);e.path=t;let r=ue.configDotenv(e);if(!r.parsed){let s=new Error(`MISSING_DATA: Cannot parse ${t} for an unknown reason`);throw s.code="MISSING_DATA",s}let n=bl(e).split(","),o=n.length,i;for(let s=0;s<o;s++)try{let a=n[s].trim(),c=Ky(r,a);i=ue.decrypt(c.ciphertext,c.key);break}catch(a){if(s+1>=o)throw a}return ue.parse(i)}function Yy(e){console.error(`[dotenv@${zo}][WARN] ${e}`)}function xr(e){console.log(`[dotenv@${zo}][DEBUG] ${e}`)}function vl(e){console.log(`[dotenv@${zo}] ${e}`)}function bl(e){return e&&e.DOTENV_KEY&&e.DOTENV_KEY.length>0?e.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function Ky(e,t){let r;try{r=new URL(t)}catch(a){if(a.code==="ERR_INVALID_URL"){let c=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw c.code="INVALID_DOTENV_KEY",c}throw a}let n=r.password;if(!n){let a=new Error("INVALID_DOTENV_KEY: Missing key part");throw a.code="INVALID_DOTENV_KEY",a}let o=r.searchParams.get("environment");if(!o){let a=new Error("INVALID_DOTENV_KEY: Missing environment part");throw a.code="INVALID_DOTENV_KEY",a}let i=`DOTENV_VAULT_${o.toUpperCase()}`,s=e.parsed[i];if(!s){let a=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${i} in your .env.vault file.`);throw a.code="NOT_FOUND_DOTENV_ENVIRONMENT",a}return{ciphertext:s,key:n}}function _l(e){let t=null;if(e&&e.path&&e.path.length>0)if(Array.isArray(e.path))for(let r of e.path)Ko.existsSync(r)&&(t=r.endsWith(".vault")?r:`${r}.vault`);else t=e.path.endsWith(".vault")?e.path:`${e.path}.vault`;else t=tn.resolve(process.cwd(),".env.vault");return Ko.existsSync(t)?t:null}function yl(e){return e[0]==="~"?tn.join(jy.homedir(),e.slice(1)):e}function zy(e){let t=Kt(process.env.DOTENV_CONFIG_DEBUG||e&&e.debug),r=Kt(process.env.DOTENV_CONFIG_QUIET||e&&e.quiet);(t||!r)&&vl("Loading env from encrypted .env.vault");let n=ue._parseVault(e),o=process.env;return e&&e.processEnv!=null&&(o=e.processEnv),ue.populate(o,n,e),{parsed:n}}function Xy(e){let t=tn.resolve(process.cwd(),".env"),r="utf8",n=process.env;e&&e.processEnv!=null&&(n=e.processEnv);let o=Kt(n.DOTENV_CONFIG_DEBUG||e&&e.debug),i=Kt(n.DOTENV_CONFIG_QUIET||e&&e.quiet);e&&e.encoding?r=e.encoding:o&&xr("No encoding is specified. UTF-8 is used by default");let s=[t];if(e&&e.path)if(!Array.isArray(e.path))s=[yl(e.path)];else{s=[];for(let l of e.path)s.push(yl(l))}let a,c={};for(let l of s)try{let p=ue.parse(Ko.readFileSync(l,{encoding:r}));ue.populate(c,p,e)}catch(p){o&&xr(`Failed to load ${l} ${p.message}`),a=p}let u=ue.populate(n,c,e);if(o=Kt(n.DOTENV_CONFIG_DEBUG||o),i=Kt(n.DOTENV_CONFIG_QUIET||i),o||!i){let l=Object.keys(u).length,p=[];for(let d of s)try{let y=tn.relative(process.cwd(),d);p.push(y)}catch(y){o&&xr(`Failed to load ${d} ${y.message}`),a=y}vl(`injecting env (${l}) from ${p.join(",")} ${Vy(`-- tip: ${Hy()}`)}`)}return a?{parsed:c,error:a}:{parsed:c}}function Jy(e){if(bl(e).length===0)return ue.configDotenv(e);let t=_l(e);return t?ue._configVault(e):(Yy(`You set DOTENV_KEY but you are missing a .env.vault file at ${t}. Did you forget to build it?`),ue.configDotenv(e))}function Qy(e,t){let r=Buffer.from(t.slice(-64),"hex"),n=Buffer.from(e,"base64"),o=n.subarray(0,12),i=n.subarray(-16);n=n.subarray(12,-16);try{let s=My.createDecipheriv("aes-256-gcm",r,o);return s.setAuthTag(i),`${s.update(n)}${s.final()}`}catch(s){let a=s instanceof RangeError,c=s.message==="Invalid key length",u=s.message==="Unsupported state or unable to authenticate data";if(a||c){let l=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw l.code="INVALID_DOTENV_KEY",l}else if(u){let l=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw l.code="DECRYPTION_FAILED",l}else throw s}}function Zy(e,t,r={}){let n=!!(r&&r.debug),o=!!(r&&r.override),i={};if(typeof t!="object"){let s=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw s.code="OBJECT_REQUIRED",s}for(let s of Object.keys(t))Object.prototype.hasOwnProperty.call(e,s)?(o===!0&&(e[s]=t[s],i[s]=t[s]),n&&xr(o===!0?`"${s}" is already defined and WAS overwritten`:`"${s}" is already defined and was NOT overwritten`)):(e[s]=t[s],i[s]=t[s]);return i}var ue={configDotenv:Xy,_configVault:zy,_parseVault:qy,config:Jy,decrypt:Qy,parse:Uy,populate:Zy};ot.exports.configDotenv=ue.configDotenv;ot.exports._configVault=ue._configVault;ot.exports._parseVault=ue._parseVault;ot.exports.config=ue.config;ot.exports.decrypt=ue.decrypt;ot.exports.parse=ue.parse;ot.exports.populate=ue.populate;ot.exports=ue});var xl=k((VA,ev)=>{ev.exports={name:"@raclettejs/core",version:"0.1.31",description:"racletteJS core package",repository:"https://gitlab.com/raclettejs/core",author:"Pacifico Digital Explorations GmbH <info@raclettejs.com>",license:"AGPL-3.0-only",type:"module",scripts:{build:"node build.mjs || true",dev:"node watch.mjs",watch:"node watch.mjs","format:check":"prettier --check .","format:fix":"prettier --write .",lint:"eslint","lint:grouped":"FILTER_RULE=$RULE eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --format ./dev/eslint/groupByRuleFormatter.cjs","lint:fix":"eslint --fix",prepare:"husky",prepublishOnly:"yarn run build && yarn run sync","publish:patch":"yarn version --patch && yarn publish",sync:"node ./scripts/sync-exports.js"},bin:{raclette:"./bin/cli.js","check-dependencies.sh":"./bin/check-dependencies.sh"},main:"index.js",types:"./types/index.ts",files:["services","bin","dist","types","scripts","index.js","README.md","yarn.lock","src/types.ts","LICENSE.md","CONTRIBUTING.md","raclette.default.config.yaml","templates"],exports:{".":{types:"./types/index.ts",import:"./dist/index.js"},"./backend":{types:"./services/backend/src/index.ts",import:"./services/backend/src/index.ts"},"./frontend":{types:"./services/frontend/src/core/index.ts",import:"./services/frontend/src/core/index.ts"},"./orchestrator":{types:"./services/frontend/src/orchestrator/index.ts",import:"./services/frontend/src/orchestrator/index.ts"}},config:{},dependencies:{"@inquirer/prompts":"8.3.2","@types/mustache":"4.2.6",chalk:"5.6.2",chokidar:"5.0.0","cli-highlight":"2.1.11",commander:"14.0.3",dotenv:"17.3.1",esbuild:"0.27.4","fs-extra":"11.3.4",globby:"16.1.1","js-yaml":"4.1.1",mustache:"4.2.0",ramda:"0.32.0","tsc-alias":"1.8.16"},devDependencies:{"@emnapi/core":"1.9.2","@emnapi/runtime":"1.9.2","@eslint/js":"9.35.0","@raclettejs/types":"workspace:^","@types/fs-extra":"11.0.4","@types/js-yaml":"4.0.9","@types/node":"25.5.0","@types/ramda":"0.31.1",eslint:"9.35.0","eslint-config-prettier":"9.1.2","eslint-flat-config-utils":"3.0.2","eslint-plugin-import":"2.32.0","eslint-plugin-prefer-arrow-functions":"3.9.1","eslint-plugin-prettier":"5.5.5","eslint-plugin-vue":"9.33.0",globals:"17.4.0",husky:"9.1.7",prettier:"3.8.1",typescript:"5.9.3","typescript-eslint":"8.57.1","vue-eslint-parser":"9.4.3"}}});import{on as tv,once as kl}from"node:events";import{PassThrough as rv,getDefaultHighWaterMark as nv}from"node:stream";import{finished as Al}from"node:stream/promises";function Zo(e){if(!Array.isArray(e))throw new TypeError(`Expected an array, got \`${typeof e}\`.`);for(let o of e)Qo(o);let t=e.some(({readableObjectMode:o})=>o),r=ov(e,t),n=new Jo({objectMode:t,writableHighWaterMark:r,readableHighWaterMark:r});for(let o of e)n.add(o);return n}var ov,Jo,iv,sv,av,Qo,cv,lv,uv,pv,dv,Sl,Rl,ei,Ol,fv,rn,wl,Cl,Tl=yt(()=>{ov=(e,t)=>{if(e.length===0)return nv(t);let r=e.filter(({readableObjectMode:n})=>n===t).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},Jo=class extends rv{#e=new Set([]);#o=new Set([]);#i=new Set([]);#r;#n=Symbol("unpipe");#t=new WeakMap;add(t){if(Qo(t),this.#e.has(t))return;this.#e.add(t),this.#r??=iv(this,this.#e,this.#n);let r=cv({passThroughStream:this,stream:t,streams:this.#e,ended:this.#o,aborted:this.#i,onFinished:this.#r,unpipeEvent:this.#n});this.#t.set(t,r),t.pipe(this,{end:!1})}async remove(t){if(Qo(t),!this.#e.has(t))return!1;let r=this.#t.get(t);return r===void 0?!1:(this.#t.delete(t),t.unpipe(this),await r,!0)}},iv=async(e,t,r)=>{rn(e,wl);let n=new AbortController;try{await Promise.race([sv(e,n),av(e,t,r,n)])}finally{n.abort(),rn(e,-wl)}},sv=async(e,{signal:t})=>{try{await Al(e,{signal:t,cleanup:!0})}catch(r){throw Sl(e,r),r}},av=async(e,t,r,{signal:n})=>{for await(let[o]of tv(e,"unpipe",{signal:n}))t.has(o)&&o.emit(r)},Qo=e=>{if(typeof e?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof e}\`.`)},cv=async({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,onFinished:i,unpipeEvent:s})=>{rn(e,Cl);let a=new AbortController;try{await Promise.race([lv(i,t,a),uv({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,controller:a}),pv({stream:t,streams:r,ended:n,aborted:o,unpipeEvent:s,controller:a})])}finally{a.abort(),rn(e,-Cl)}r.size>0&&r.size===n.size+o.size&&(n.size===0&&o.size>0?ei(e):dv(e))},lv=async(e,t,{signal:r})=>{try{await e,r.aborted||ei(t)}catch(n){r.aborted||Sl(t,n)}},uv=async({passThroughStream:e,stream:t,streams:r,ended:n,aborted:o,controller:{signal:i}})=>{try{await Al(t,{signal:i,cleanup:!0,readable:!0,writable:!1}),r.has(t)&&n.add(t)}catch(s){if(i.aborted||!r.has(t))return;Rl(s)?o.add(t):Ol(e,s)}},pv=async({stream:e,streams:t,ended:r,aborted:n,unpipeEvent:o,controller:{signal:i}})=>{if(await kl(e,o,{signal:i}),!e.readable)return kl(i,"abort",{signal:i});t.delete(e),r.delete(e),n.delete(e)},dv=e=>{e.writable&&e.end()},Sl=(e,t)=>{Rl(t)?ei(e):Ol(e,t)},Rl=e=>e?.code==="ERR_STREAM_PREMATURE_CLOSE",ei=e=>{(e.readable||e.writable)&&e.destroy()},Ol=(e,t)=>{e.destroyed||(e.once("error",fv),e.destroy(t))},fv=()=>{},rn=(e,t)=>{let r=e.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&e.setMaxListeners(r+t)},wl=2,Cl=1});var Pl=k(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});zt.splitWhen=zt.flatten=void 0;function hv(e){return e.reduce((t,r)=>[].concat(t,r),[])}zt.flatten=hv;function mv(e,t){let r=[[]],n=0;for(let o of e)t(o)?(n++,r[n]=[]):r[n].push(o);return r}zt.splitWhen=mv});var $l=k(nn=>{"use strict";Object.defineProperty(nn,"__esModule",{value:!0});nn.isEnoentCodeError=void 0;function gv(e){return e.code==="ENOENT"}nn.isEnoentCodeError=gv});var Dl=k(on=>{"use strict";Object.defineProperty(on,"__esModule",{value:!0});on.createDirentFromStats=void 0;var ti=class{constructor(t,r){this.name=t,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function yv(e,t){return new ti(e,t)}on.createDirentFromStats=yv});var Fl=k(se=>{"use strict";Object.defineProperty(se,"__esModule",{value:!0});se.convertPosixPathToPattern=se.convertWindowsPathToPattern=se.convertPathToPattern=se.escapePosixPath=se.escapeWindowsPath=se.escape=se.removeLeadingDotSegment=se.makeAbsolute=se.unixify=void 0;var vv=M("os"),bv=M("path"),Nl=vv.platform()==="win32",_v=2,Ev=/(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g,xv=/(\\?)([()[\]{}]|^!|[!+@](?=\())/g,kv=/^\\\\([.?])/,wv=/\\(?![!()+@[\]{}])/g;function Cv(e){return e.replace(/\\/g,"/")}se.unixify=Cv;function Av(e,t){return bv.resolve(e,t)}se.makeAbsolute=Av;function Sv(e){if(e.charAt(0)==="."){let t=e.charAt(1);if(t==="/"||t==="\\")return e.slice(_v)}return e}se.removeLeadingDotSegment=Sv;se.escape=Nl?ri:ni;function ri(e){return e.replace(xv,"\\$2")}se.escapeWindowsPath=ri;function ni(e){return e.replace(Ev,"\\$2")}se.escapePosixPath=ni;se.convertPathToPattern=Nl?Ll:Il;function Ll(e){return ri(e).replace(kv,"//$1").replace(wv,"/")}se.convertWindowsPathToPattern=Ll;function Il(e){return ni(e)}se.convertPosixPathToPattern=Il});var Ml=k((QA,jl)=>{jl.exports=function(t){if(typeof t!="string"||t==="")return!1;for(var r;r=/(\\).|([@?!+*]\(.*\))/g.exec(t);){if(r[2])return!0;t=t.slice(r.index+r[0].length)}return!1}});var Gl=k((ZA,Hl)=>{var Rv=Ml(),Bl={"{":"}","(":")","[":"]"},Ov=function(e){if(e[0]==="!")return!0;for(var t=0,r=-2,n=-2,o=-2,i=-2,s=-2;t<e.length;){if(e[t]==="*"||e[t+1]==="?"&&/[\].+)]/.test(e[t])||n!==-1&&e[t]==="["&&e[t+1]!=="]"&&(n<t&&(n=e.indexOf("]",t)),n>t&&(s===-1||s>n||(s=e.indexOf("\\",t),s===-1||s>n)))||o!==-1&&e[t]==="{"&&e[t+1]!=="}"&&(o=e.indexOf("}",t),o>t&&(s=e.indexOf("\\",t),s===-1||s>o))||i!==-1&&e[t]==="("&&e[t+1]==="?"&&/[:!=]/.test(e[t+2])&&e[t+3]!==")"&&(i=e.indexOf(")",t),i>t&&(s=e.indexOf("\\",t),s===-1||s>i))||r!==-1&&e[t]==="("&&e[t+1]!=="|"&&(r<t&&(r=e.indexOf("|",t)),r!==-1&&e[r+1]!==")"&&(i=e.indexOf(")",r),i>r&&(s=e.indexOf("\\",r),s===-1||s>i))))return!0;if(e[t]==="\\"){var a=e[t+1];t+=2;var c=Bl[a];if(c){var u=e.indexOf(c,t);u!==-1&&(t=u+1)}if(e[t]==="!")return!0}else t++}return!1},Tv=function(e){if(e[0]==="!")return!0;for(var t=0;t<e.length;){if(/[*?{}()[\]]/.test(e[t]))return!0;if(e[t]==="\\"){var r=e[t+1];t+=2;var n=Bl[r];if(n){var o=e.indexOf(n,t);o!==-1&&(t=o+1)}if(e[t]==="!")return!0}else t++}return!1};Hl.exports=function(t,r){if(typeof t!="string"||t==="")return!1;if(Rv(t))return!0;var n=Ov;return r&&r.strict===!1&&(n=Tv),n(t)}});var Wl=k((eS,Vl)=>{"use strict";var Pv=Gl(),$v=M("path").posix.dirname,Dv=M("os").platform()==="win32",oi="/",Nv=/\\/g,Lv=/[\{\[].*[\}\]]$/,Iv=/(^|[^\\])([\{\[]|\([^\)]+$)/,Fv=/\\([\!\*\?\|\[\]\(\)\{\}])/g;Vl.exports=function(t,r){var n=Object.assign({flipBackslashes:!0},r);n.flipBackslashes&&Dv&&t.indexOf(oi)<0&&(t=t.replace(Nv,oi)),Lv.test(t)&&(t+=oi),t+="a";do t=$v(t);while(Pv(t)||Iv.test(t));return t.replace(Fv,"$1")}});var sn=k(De=>{"use strict";De.isInteger=e=>typeof e=="number"?Number.isInteger(e):typeof e=="string"&&e.trim()!==""?Number.isInteger(Number(e)):!1;De.find=(e,t)=>e.nodes.find(r=>r.type===t);De.exceedsLimit=(e,t,r=1,n)=>n===!1||!De.isInteger(e)||!De.isInteger(t)?!1:(Number(t)-Number(e))/Number(r)>=n;De.escapeNode=(e,t=0,r)=>{let n=e.nodes[t];n&&(r&&n.type===r||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};De.encloseBrace=e=>e.type!=="brace"?!1:e.commas>>0+e.ranges>>0===0?(e.invalid=!0,!0):!1;De.isInvalidBrace=e=>e.type!=="brace"?!1:e.invalid===!0||e.dollar?!0:e.commas>>0+e.ranges>>0===0||e.open!==!0||e.close!==!0?(e.invalid=!0,!0):!1;De.isOpenOrClose=e=>e.type==="open"||e.type==="close"?!0:e.open===!0||e.close===!0;De.reduce=e=>e.reduce((t,r)=>(r.type==="text"&&t.push(r.value),r.type==="range"&&(r.type="text"),t),[]);De.flatten=(...e)=>{let t=[],r=n=>{for(let o=0;o<n.length;o++){let i=n[o];if(Array.isArray(i)){r(i);continue}i!==void 0&&t.push(i)}return t};return r(e),t}});var an=k((rS,ql)=>{"use strict";var Ul=sn();ql.exports=(e,t={})=>{let r=(n,o={})=>{let i=t.escapeInvalid&&Ul.isInvalidBrace(o),s=n.invalid===!0&&t.escapeInvalid===!0,a="";if(n.value)return(i||s)&&Ul.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let c of n.nodes)a+=r(c);return a};return r(e)}});var Kl=k((nS,Yl)=>{"use strict";Yl.exports=function(e){return typeof e=="number"?e-e===0:typeof e=="string"&&e.trim()!==""?Number.isFinite?Number.isFinite(+e):isFinite(+e):!1}});var nu=k((oS,ru)=>{"use strict";var zl=Kl(),Dt=(e,t,r)=>{if(zl(e)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(t===void 0||e===t)return String(e);if(zl(t)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...r};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let o=String(n.relaxZeros),i=String(n.shorthand),s=String(n.capture),a=String(n.wrap),c=e+":"+t+"="+o+i+s+a;if(Dt.cache.hasOwnProperty(c))return Dt.cache[c].result;let u=Math.min(e,t),l=Math.max(e,t);if(Math.abs(u-l)===1){let m=e+"|"+t;return n.capture?`(${m})`:n.wrap===!1?m:`(?:${m})`}let p=tu(e)||tu(t),d={min:e,max:t,a:u,b:l},y=[],g=[];if(p&&(d.isPadded=p,d.maxLen=String(d.max).length),u<0){let m=l<0?Math.abs(l):1;g=Xl(m,Math.abs(u),d,n),u=d.a=0}return l>=0&&(y=Xl(u,l,d,n)),d.negatives=g,d.positives=y,d.result=jv(g,y,n),n.capture===!0?d.result=`(${d.result})`:n.wrap!==!1&&y.length+g.length>1&&(d.result=`(?:${d.result})`),Dt.cache[c]=d,d.result};function jv(e,t,r){let n=ii(e,t,"-",!1,r)||[],o=ii(t,e,"",!1,r)||[],i=ii(e,t,"-?",!0,r)||[];return n.concat(i).concat(o).join("|")}function Mv(e,t){let r=1,n=1,o=Ql(e,r),i=new Set([t]);for(;e<=o&&o<=t;)i.add(o),r+=1,o=Ql(e,r);for(o=Zl(t+1,n)-1;e<o&&o<=t;)i.add(o),n+=1,o=Zl(t+1,n)-1;return i=[...i],i.sort(Gv),i}function Bv(e,t,r){if(e===t)return{pattern:e,count:[],digits:0};let n=Hv(e,t),o=n.length,i="",s=0;for(let a=0;a<o;a++){let[c,u]=n[a];c===u?i+=c:c!=="0"||u!=="9"?i+=Vv(c,u,r):s++}return s&&(i+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:i,count:[s],digits:o}}function Xl(e,t,r,n){let o=Mv(e,t),i=[],s=e,a;for(let c=0;c<o.length;c++){let u=o[c],l=Bv(String(s),String(u),n),p="";if(!r.isPadded&&a&&a.pattern===l.pattern){a.count.length>1&&a.count.pop(),a.count.push(l.count[0]),a.string=a.pattern+eu(a.count),s=u+1;continue}r.isPadded&&(p=Wv(u,r,n)),l.string=p+l.pattern+eu(l.count),i.push(l),s=u+1,a=l}return i}function ii(e,t,r,n,o){let i=[];for(let s of e){let{string:a}=s;!n&&!Jl(t,"string",a)&&i.push(r+a),n&&Jl(t,"string",a)&&i.push(r+a)}return i}function Hv(e,t){let r=[];for(let n=0;n<e.length;n++)r.push([e[n],t[n]]);return r}function Gv(e,t){return e>t?1:t>e?-1:0}function Jl(e,t,r){return e.some(n=>n[t]===r)}function Ql(e,t){return Number(String(e).slice(0,-t)+"9".repeat(t))}function Zl(e,t){return e-e%Math.pow(10,t)}function eu(e){let[t=0,r=""]=e;return r||t>1?`{${t+(r?","+r:"")}}`:""}function Vv(e,t,r){return`[${e}${t-e===1?"":"-"}${t}]`}function tu(e){return/^-?(0+)\d/.test(e)}function Wv(e,t,r){if(!t.isPadded)return e;let n=Math.abs(t.maxLen-String(e).length),o=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:return o?`0{0,${n}}`:`0{${n}}`}}Dt.cache={};Dt.clearCache=()=>Dt.cache={};ru.exports=Dt});var ci=k((iS,uu)=>{"use strict";var Uv=M("util"),iu=nu(),ou=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),qv=e=>t=>e===!0?Number(t):String(t),si=e=>typeof e=="number"||typeof e=="string"&&e!=="",kr=e=>Number.isInteger(+e),ai=e=>{let t=`${e}`,r=-1;if(t[0]==="-"&&(t=t.slice(1)),t==="0")return!1;for(;t[++r]==="0";);return r>0},Yv=(e,t,r)=>typeof e=="string"||typeof t=="string"?!0:r.stringify===!0,Kv=(e,t,r)=>{if(t>0){let n=e[0]==="-"?"-":"";n&&(e=e.slice(1)),e=n+e.padStart(n?t-1:t,"0")}return r===!1?String(e):e},ln=(e,t)=>{let r=e[0]==="-"?"-":"";for(r&&(e=e.slice(1),t--);e.length<t;)e="0"+e;return r?"-"+e:e},zv=(e,t,r)=>{e.negatives.sort((a,c)=>a<c?-1:a>c?1:0),e.positives.sort((a,c)=>a<c?-1:a>c?1:0);let n=t.capture?"":"?:",o="",i="",s;return e.positives.length&&(o=e.positives.map(a=>ln(String(a),r)).join("|")),e.negatives.length&&(i=`-(${n}${e.negatives.map(a=>ln(String(a),r)).join("|")})`),o&&i?s=`${o}|${i}`:s=o||i,t.wrap?`(${n}${s})`:s},su=(e,t,r,n)=>{if(r)return iu(e,t,{wrap:!1,...n});let o=String.fromCharCode(e);if(e===t)return o;let i=String.fromCharCode(t);return`[${o}-${i}]`},au=(e,t,r)=>{if(Array.isArray(e)){let n=r.wrap===!0,o=r.capture?"":"?:";return n?`(${o}${e.join("|")})`:e.join("|")}return iu(e,t,r)},cu=(...e)=>new RangeError("Invalid range arguments: "+Uv.inspect(...e)),lu=(e,t,r)=>{if(r.strictRanges===!0)throw cu([e,t]);return[]},Xv=(e,t)=>{if(t.strictRanges===!0)throw new TypeError(`Expected step "${e}" to be a number`);return[]},Jv=(e,t,r=1,n={})=>{let o=Number(e),i=Number(t);if(!Number.isInteger(o)||!Number.isInteger(i)){if(n.strictRanges===!0)throw cu([e,t]);return[]}o===0&&(o=0),i===0&&(i=0);let s=o>i,a=String(e),c=String(t),u=String(r);r=Math.max(Math.abs(r),1);let l=ai(a)||ai(c)||ai(u),p=l?Math.max(a.length,c.length,u.length):0,d=l===!1&&Yv(e,t,n)===!1,y=n.transform||qv(d);if(n.toRegex&&r===1)return su(ln(e,p),ln(t,p),!0,n);let g={negatives:[],positives:[]},m=S=>g[S<0?"negatives":"positives"].push(Math.abs(S)),E=[],x=0;for(;s?o>=i:o<=i;)n.toRegex===!0&&r>1?m(o):E.push(Kv(y(o,x),p,d)),o=s?o-r:o+r,x++;return n.toRegex===!0?r>1?zv(g,n,p):au(E,null,{wrap:!1,...n}):E},Qv=(e,t,r=1,n={})=>{if(!kr(e)&&e.length>1||!kr(t)&&t.length>1)return lu(e,t,n);let o=n.transform||(d=>String.fromCharCode(d)),i=`${e}`.charCodeAt(0),s=`${t}`.charCodeAt(0),a=i>s,c=Math.min(i,s),u=Math.max(i,s);if(n.toRegex&&r===1)return su(c,u,!1,n);let l=[],p=0;for(;a?i>=s:i<=s;)l.push(o(i,p)),i=a?i-r:i+r,p++;return n.toRegex===!0?au(l,null,{wrap:!1,options:n}):l},cn=(e,t,r,n={})=>{if(t==null&&si(e))return[e];if(!si(e)||!si(t))return lu(e,t,n);if(typeof r=="function")return cn(e,t,1,{transform:r});if(ou(r))return cn(e,t,0,r);let o={...n};return o.capture===!0&&(o.wrap=!0),r=r||o.step||1,kr(r)?kr(e)&&kr(t)?Jv(e,t,r,o):Qv(e,t,Math.max(Math.abs(r),1),o):r!=null&&!ou(r)?Xv(r,o):cn(e,t,1,r)};uu.exports=cn});var fu=k((sS,du)=>{"use strict";var Zv=ci(),pu=sn(),eb=(e,t={})=>{let r=(n,o={})=>{let i=pu.isInvalidBrace(o),s=n.invalid===!0&&t.escapeInvalid===!0,a=i===!0||s===!0,c=t.escapeInvalid===!0?"\\":"",u="";if(n.isOpen===!0)return c+n.value;if(n.isClose===!0)return console.log("node.isClose",c,n.value),c+n.value;if(n.type==="open")return a?c+n.value:"(";if(n.type==="close")return a?c+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":a?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let l=pu.reduce(n.nodes),p=Zv(...l,{...t,wrap:!1,toRegex:!0,strictZeros:!0});if(p.length!==0)return l.length>1&&p.length>1?`(${p})`:p}if(n.nodes)for(let l of n.nodes)u+=r(l,n);return u};return r(e)};du.exports=eb});var gu=k((aS,mu)=>{"use strict";var tb=ci(),hu=an(),Xt=sn(),Nt=(e="",t="",r=!1)=>{let n=[];if(e=[].concat(e),t=[].concat(t),!t.length)return e;if(!e.length)return r?Xt.flatten(t).map(o=>`{${o}}`):t;for(let o of e)if(Array.isArray(o))for(let i of o)n.push(Nt(i,t,r));else for(let i of t)r===!0&&typeof i=="string"&&(i=`{${i}}`),n.push(Array.isArray(i)?Nt(o,i,r):o+i);return Xt.flatten(n)},rb=(e,t={})=>{let r=t.rangeLimit===void 0?1e3:t.rangeLimit,n=(o,i={})=>{o.queue=[];let s=i,a=i.queue;for(;s.type!=="brace"&&s.type!=="root"&&s.parent;)s=s.parent,a=s.queue;if(o.invalid||o.dollar){a.push(Nt(a.pop(),hu(o,t)));return}if(o.type==="brace"&&o.invalid!==!0&&o.nodes.length===2){a.push(Nt(a.pop(),["{}"]));return}if(o.nodes&&o.ranges>0){let p=Xt.reduce(o.nodes);if(Xt.exceedsLimit(...p,t.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let d=tb(...p,t);d.length===0&&(d=hu(o,t)),a.push(Nt(a.pop(),d)),o.nodes=[];return}let c=Xt.encloseBrace(o),u=o.queue,l=o;for(;l.type!=="brace"&&l.type!=="root"&&l.parent;)l=l.parent,u=l.queue;for(let p=0;p<o.nodes.length;p++){let d=o.nodes[p];if(d.type==="comma"&&o.type==="brace"){p===1&&u.push(""),u.push("");continue}if(d.type==="close"){a.push(Nt(a.pop(),u,c));continue}if(d.value&&d.type!=="open"){u.push(Nt(u.pop(),d.value));continue}d.nodes&&n(d,o)}return u};return Xt.flatten(n(e))};mu.exports=rb});var vu=k((cS,yu)=>{"use strict";yu.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
|
|
31
|
+
`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var ku=k((lS,xu)=>{"use strict";var nb=an(),{MAX_LENGTH:bu,CHAR_BACKSLASH:li,CHAR_BACKTICK:ob,CHAR_COMMA:ib,CHAR_DOT:sb,CHAR_LEFT_PARENTHESES:ab,CHAR_RIGHT_PARENTHESES:cb,CHAR_LEFT_CURLY_BRACE:lb,CHAR_RIGHT_CURLY_BRACE:ub,CHAR_LEFT_SQUARE_BRACKET:_u,CHAR_RIGHT_SQUARE_BRACKET:Eu,CHAR_DOUBLE_QUOTE:pb,CHAR_SINGLE_QUOTE:db,CHAR_NO_BREAK_SPACE:fb,CHAR_ZERO_WIDTH_NOBREAK_SPACE:hb}=vu(),mb=(e,t={})=>{if(typeof e!="string")throw new TypeError("Expected a string");let r=t||{},n=typeof r.maxLength=="number"?Math.min(bu,r.maxLength):bu;if(e.length>n)throw new SyntaxError(`Input length (${e.length}), exceeds max characters (${n})`);let o={type:"root",input:e,nodes:[]},i=[o],s=o,a=o,c=0,u=e.length,l=0,p=0,d,y=()=>e[l++],g=m=>{if(m.type==="text"&&a.type==="dot"&&(a.type="text"),a&&a.type==="text"&&m.type==="text"){a.value+=m.value;return}return s.nodes.push(m),m.parent=s,m.prev=a,a=m,m};for(g({type:"bos"});l<u;)if(s=i[i.length-1],d=y(),!(d===hb||d===fb)){if(d===li){g({type:"text",value:(t.keepEscaping?d:"")+y()});continue}if(d===Eu){g({type:"text",value:"\\"+d});continue}if(d===_u){c++;let m;for(;l<u&&(m=y());){if(d+=m,m===_u){c++;continue}if(m===li){d+=y();continue}if(m===Eu&&(c--,c===0))break}g({type:"text",value:d});continue}if(d===ab){s=g({type:"paren",nodes:[]}),i.push(s),g({type:"text",value:d});continue}if(d===cb){if(s.type!=="paren"){g({type:"text",value:d});continue}s=i.pop(),g({type:"text",value:d}),s=i[i.length-1];continue}if(d===pb||d===db||d===ob){let m=d,E;for(t.keepQuotes!==!0&&(d="");l<u&&(E=y());){if(E===li){d+=E+y();continue}if(E===m){t.keepQuotes===!0&&(d+=E);break}d+=E}g({type:"text",value:d});continue}if(d===lb){p++;let E={type:"brace",open:!0,close:!1,dollar:a.value&&a.value.slice(-1)==="$"||s.dollar===!0,depth:p,commas:0,ranges:0,nodes:[]};s=g(E),i.push(s),g({type:"open",value:d});continue}if(d===ub){if(s.type!=="brace"){g({type:"text",value:d});continue}let m="close";s=i.pop(),s.close=!0,g({type:m,value:d}),p--,s=i[i.length-1];continue}if(d===ib&&p>0){if(s.ranges>0){s.ranges=0;let m=s.nodes.shift();s.nodes=[m,{type:"text",value:nb(s)}]}g({type:"comma",value:d}),s.commas++;continue}if(d===sb&&p>0&&s.commas===0){let m=s.nodes;if(p===0||m.length===0){g({type:"text",value:d});continue}if(a.type==="dot"){if(s.range=[],a.value+=d,a.type="range",s.nodes.length!==3&&s.nodes.length!==5){s.invalid=!0,s.ranges=0,a.type="text";continue}s.ranges++,s.args=[];continue}if(a.type==="range"){m.pop();let E=m[m.length-1];E.value+=a.value+d,a=E,s.ranges--;continue}g({type:"dot",value:d});continue}g({type:"text",value:d})}do if(s=i.pop(),s.type!=="root"){s.nodes.forEach(x=>{x.nodes||(x.type==="open"&&(x.isOpen=!0),x.type==="close"&&(x.isClose=!0),x.nodes||(x.type="text"),x.invalid=!0)});let m=i[i.length-1],E=m.nodes.indexOf(s);m.nodes.splice(E,1,...s.nodes)}while(i.length>0);return g({type:"eos"}),o};xu.exports=mb});var Au=k((uS,Cu)=>{"use strict";var wu=an(),gb=fu(),yb=gu(),vb=ku(),Re=(e,t={})=>{let r=[];if(Array.isArray(e))for(let n of e){let o=Re.create(n,t);Array.isArray(o)?r.push(...o):r.push(o)}else r=[].concat(Re.create(e,t));return t&&t.expand===!0&&t.nodupes===!0&&(r=[...new Set(r)]),r};Re.parse=(e,t={})=>vb(e,t);Re.stringify=(e,t={})=>wu(typeof e=="string"?Re.parse(e,t):e,t);Re.compile=(e,t={})=>(typeof e=="string"&&(e=Re.parse(e,t)),gb(e,t));Re.expand=(e,t={})=>{typeof e=="string"&&(e=Re.parse(e,t));let r=yb(e,t);return t.noempty===!0&&(r=r.filter(Boolean)),t.nodupes===!0&&(r=[...new Set(r)]),r};Re.create=(e,t={})=>e===""||e.length<3?[e]:t.expand!==!0?Re.compile(e,t):Re.expand(e,t);Cu.exports=Re});var wr=k((pS,Pu)=>{"use strict";var bb=M("path"),Je="\\\\/",Su=`[^${Je}]`,_b=0,it="\\.",Eb="\\+",xb="\\?",un="\\/",kb="(?=.)",Ru="[^/]",ui=`(?:${un}|$)`,Ou=`(?:^|${un})`,pi=`${it}{1,2}${ui}`,wb=`(?!${it})`,Cb=`(?!${Ou}${pi})`,Ab=`(?!${it}{0,1}${ui})`,Sb=`(?!${pi})`,Rb=`[^.${un}]`,Ob=`${Ru}*?`,Tu={DOT_LITERAL:it,PLUS_LITERAL:Eb,QMARK_LITERAL:xb,SLASH_LITERAL:un,ONE_CHAR:kb,QMARK:Ru,END_ANCHOR:ui,DOTS_SLASH:pi,NO_DOT:wb,NO_DOTS:Cb,NO_DOT_SLASH:Ab,NO_DOTS_SLASH:Sb,QMARK_NO_DOT:Rb,STAR:Ob,START_ANCHOR:Ou},Tb={...Tu,SLASH_LITERAL:`[${Je}]`,QMARK:Su,STAR:`${Su}*?`,DOTS_SLASH:`${it}{1,2}(?:[${Je}]|$)`,NO_DOT:`(?!${it})`,NO_DOTS:`(?!(?:^|[${Je}])${it}{1,2}(?:[${Je}]|$))`,NO_DOT_SLASH:`(?!${it}{0,1}(?:[${Je}]|$))`,NO_DOTS_SLASH:`(?!${it}{1,2}(?:[${Je}]|$))`,QMARK_NO_DOT:`[^.${Je}]`,START_ANCHOR:`(?:^|[${Je}])`,END_ANCHOR:`(?:[${Je}]|$)`},Pb={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};Pu.exports={DEFAULT_MAX_EXTGLOB_RECURSION:_b,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:Pb,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:bb.sep,extglobChars(e){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(e){return e===!0?Tb:Tu}}});var Cr=k(we=>{"use strict";var $b=M("path"),Db=process.platform==="win32",{REGEX_BACKSLASH:Nb,REGEX_REMOVE_BACKSLASH:Lb,REGEX_SPECIAL_CHARS:Ib,REGEX_SPECIAL_CHARS_GLOBAL:Fb}=wr();we.isObject=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);we.hasRegexChars=e=>Ib.test(e);we.isRegexChar=e=>e.length===1&&we.hasRegexChars(e);we.escapeRegex=e=>e.replace(Fb,"\\$1");we.toPosixSlashes=e=>e.replace(Nb,"/");we.removeBackslashes=e=>e.replace(Lb,t=>t==="\\"?"":t);we.supportsLookbehinds=()=>{let e=process.version.slice(1).split(".").map(Number);return e.length===3&&e[0]>=9||e[0]===8&&e[1]>=10};we.isWindows=e=>e&&typeof e.windows=="boolean"?e.windows:Db===!0||$b.sep==="\\";we.escapeLast=(e,t,r)=>{let n=e.lastIndexOf(t,r);return n===-1?e:e[n-1]==="\\"?we.escapeLast(e,t,n-1):`${e.slice(0,n)}\\${e.slice(n)}`};we.removePrefix=(e,t={})=>{let r=e;return r.startsWith("./")&&(r=r.slice(2),t.prefix="./"),r};we.wrapOutput=(e,t={},r={})=>{let n=r.contains?"":"^",o=r.contains?"":"$",i=`${n}(?:${e})${o}`;return t.negated===!0&&(i=`(?:^(?!${i}).*$)`),i}});var Mu=k((fS,ju)=>{"use strict";var $u=Cr(),{CHAR_ASTERISK:di,CHAR_AT:jb,CHAR_BACKWARD_SLASH:Ar,CHAR_COMMA:Mb,CHAR_DOT:fi,CHAR_EXCLAMATION_MARK:hi,CHAR_FORWARD_SLASH:Fu,CHAR_LEFT_CURLY_BRACE:mi,CHAR_LEFT_PARENTHESES:gi,CHAR_LEFT_SQUARE_BRACKET:Bb,CHAR_PLUS:Hb,CHAR_QUESTION_MARK:Du,CHAR_RIGHT_CURLY_BRACE:Gb,CHAR_RIGHT_PARENTHESES:Nu,CHAR_RIGHT_SQUARE_BRACKET:Vb}=wr(),Lu=e=>e===Fu||e===Ar,Iu=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)},Wb=(e,t)=>{let r=t||{},n=e.length-1,o=r.parts===!0||r.scanToEnd===!0,i=[],s=[],a=[],c=e,u=-1,l=0,p=0,d=!1,y=!1,g=!1,m=!1,E=!1,x=!1,S=!1,$=!1,oe=!1,q=!1,T=0,L,w,F={value:"",depth:0,isGlob:!1},ae=()=>u>=n,_=()=>c.charCodeAt(u+1),Q=()=>(L=w,c.charCodeAt(++u));for(;u<n;){w=Q();let ve;if(w===Ar){S=F.backslashes=!0,w=Q(),w===mi&&(x=!0);continue}if(x===!0||w===mi){for(T++;ae()!==!0&&(w=Q());){if(w===Ar){S=F.backslashes=!0,Q();continue}if(w===mi){T++;continue}if(x!==!0&&w===fi&&(w=Q())===fi){if(d=F.isBrace=!0,g=F.isGlob=!0,q=!0,o===!0)continue;break}if(x!==!0&&w===Mb){if(d=F.isBrace=!0,g=F.isGlob=!0,q=!0,o===!0)continue;break}if(w===Gb&&(T--,T===0)){x=!1,d=F.isBrace=!0,q=!0;break}}if(o===!0)continue;break}if(w===Fu){if(i.push(u),s.push(F),F={value:"",depth:0,isGlob:!1},q===!0)continue;if(L===fi&&u===l+1){l+=2;continue}p=u+1;continue}if(r.noext!==!0&&(w===Hb||w===jb||w===di||w===Du||w===hi)===!0&&_()===gi){if(g=F.isGlob=!0,m=F.isExtglob=!0,q=!0,w===hi&&u===l&&(oe=!0),o===!0){for(;ae()!==!0&&(w=Q());){if(w===Ar){S=F.backslashes=!0,w=Q();continue}if(w===Nu){g=F.isGlob=!0,q=!0;break}}continue}break}if(w===di){if(L===di&&(E=F.isGlobstar=!0),g=F.isGlob=!0,q=!0,o===!0)continue;break}if(w===Du){if(g=F.isGlob=!0,q=!0,o===!0)continue;break}if(w===Bb){for(;ae()!==!0&&(ve=Q());){if(ve===Ar){S=F.backslashes=!0,Q();continue}if(ve===Vb){y=F.isBracket=!0,g=F.isGlob=!0,q=!0;break}}if(o===!0)continue;break}if(r.nonegate!==!0&&w===hi&&u===l){$=F.negated=!0,l++;continue}if(r.noparen!==!0&&w===gi){if(g=F.isGlob=!0,o===!0){for(;ae()!==!0&&(w=Q());){if(w===gi){S=F.backslashes=!0,w=Q();continue}if(w===Nu){q=!0;break}}continue}break}if(g===!0){if(q=!0,o===!0)continue;break}}r.noext===!0&&(m=!1,g=!1);let z=c,mt="",v="";l>0&&(mt=c.slice(0,l),c=c.slice(l),p-=l),z&&g===!0&&p>0?(z=c.slice(0,p),v=c.slice(p)):g===!0?(z="",v=c):z=c,z&&z!==""&&z!=="/"&&z!==c&&Lu(z.charCodeAt(z.length-1))&&(z=z.slice(0,-1)),r.unescape===!0&&(v&&(v=$u.removeBackslashes(v)),z&&S===!0&&(z=$u.removeBackslashes(z)));let b={prefix:mt,input:e,start:l,base:z,glob:v,isBrace:d,isBracket:y,isGlob:g,isExtglob:m,isGlobstar:E,negated:$,negatedExtglob:oe};if(r.tokens===!0&&(b.maxDepth=0,Lu(w)||s.push(F),b.tokens=s),r.parts===!0||r.tokens===!0){let ve;for(let j=0;j<i.length;j++){let Ve=ve?ve+1:l,We=i[j],Se=e.slice(Ve,We);r.tokens&&(j===0&&l!==0?(s[j].isPrefix=!0,s[j].value=mt):s[j].value=Se,Iu(s[j]),b.maxDepth+=s[j].depth),(j!==0||Se!=="")&&a.push(Se),ve=We}if(ve&&ve+1<e.length){let j=e.slice(ve+1);a.push(j),r.tokens&&(s[s.length-1].value=j,Iu(s[s.length-1]),b.maxDepth+=s[s.length-1].depth)}b.slashes=i,b.parts=a}return b};ju.exports=Wb});var Wu=k((hS,Vu)=>{"use strict";var Sr=wr(),me=Cr(),{MAX_LENGTH:pn,POSIX_REGEX_SOURCE:Ub,REGEX_NON_SPECIAL_CHARS:qb,REGEX_SPECIAL_CHARS_BACKREF:Yb,REPLACEMENTS:Bu}=Sr,Kb=(e,t)=>{if(typeof t.expandRange=="function")return t.expandRange(...e,t);e.sort();let r=`[${e.join("-")}]`;try{new RegExp(r)}catch{return e.map(o=>me.escapeRegex(o)).join("..")}return r},Jt=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,Hu=e=>{let t=[],r=0,n=0,o=0,i="",s=!1;for(let a of e){if(s===!0){i+=a,s=!1;continue}if(a==="\\"){i+=a,s=!0;continue}if(a==='"'){o=o===1?0:1,i+=a;continue}if(o===0){if(a==="[")r++;else if(a==="]"&&r>0)r--;else if(r===0){if(a==="(")n++;else if(a===")"&&n>0)n--;else if(a==="|"&&n===0){t.push(i),i="";continue}}}i+=a}return t.push(i),t},zb=e=>{let t=!1;for(let r of e){if(t===!0){t=!1;continue}if(r==="\\"){t=!0;continue}if(/[?*+@!()[\]{}]/.test(r))return!1}return!0},Gu=e=>{let t=e.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(t)&&(t=t.slice(2,-1),r=!0);if(zb(t))return t.replace(/\\(.)/g,"$1")},Xb=e=>{let t=e.map(Gu).filter(Boolean);for(let r=0;r<t.length;r++)for(let n=r+1;n<t.length;n++){let o=t[r],i=t[n],s=o[0];if(!(!s||o!==s.repeat(o.length)||i!==s.repeat(i.length))&&(o===i||o.startsWith(i)||i.startsWith(o)))return!0}return!1},yi=(e,t=!0)=>{if(e[0]!=="+"&&e[0]!=="*"||e[1]!=="(")return;let r=0,n=0,o=0,i=!1;for(let s=1;s<e.length;s++){let a=e[s];if(i===!0){i=!1;continue}if(a==="\\"){i=!0;continue}if(a==='"'){o=o===1?0:1;continue}if(o!==1){if(a==="["){r++;continue}if(a==="]"&&r>0){r--;continue}if(!(r>0)){if(a==="("){n++;continue}if(a===")"&&(n--,n===0))return t===!0&&s!==e.length-1?void 0:{type:e[0],body:e.slice(2,s),end:s}}}}},Jb=e=>{let t=0,r=[];for(;t<e.length;){let o=yi(e.slice(t),!1);if(!o||o.type!=="*")return;let i=Hu(o.body).map(a=>a.trim());if(i.length!==1)return;let s=Gu(i[0]);if(!s||s.length!==1)return;r.push(s),t+=o.end+1}return r.length<1?void 0:`${r.length===1?me.escapeRegex(r[0]):`[${r.map(o=>me.escapeRegex(o)).join("")}]`}*`},Qb=e=>{let t=0,r=e.trim(),n=yi(r);for(;n;)t++,r=n.body.trim(),n=yi(r);return t},Zb=(e,t)=>{if(t.maxExtglobRecursion===!1)return{risky:!1};let r=typeof t.maxExtglobRecursion=="number"?t.maxExtglobRecursion:Sr.DEFAULT_MAX_EXTGLOB_RECURSION,n=Hu(e).map(o=>o.trim());if(n.length>1&&(n.some(o=>o==="")||n.some(o=>/^[*?]+$/.test(o))||Xb(n)))return{risky:!0};for(let o of n){let i=Jb(o);if(i)return{risky:!0,safeOutput:i};if(Qb(o)>r)return{risky:!0}}return{risky:!1}},vi=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a string");e=Bu[e]||e;let r={...t},n=typeof r.maxLength=="number"?Math.min(pn,r.maxLength):pn,o=e.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);let i={type:"bos",value:"",output:r.prepend||""},s=[i],a=r.capture?"":"?:",c=me.isWindows(t),u=Sr.globChars(c),l=Sr.extglobChars(u),{DOT_LITERAL:p,PLUS_LITERAL:d,SLASH_LITERAL:y,ONE_CHAR:g,DOTS_SLASH:m,NO_DOT:E,NO_DOT_SLASH:x,NO_DOTS_SLASH:S,QMARK:$,QMARK_NO_DOT:oe,STAR:q,START_ANCHOR:T}=u,L=A=>`(${a}(?:(?!${T}${A.dot?m:p}).)*?)`,w=r.dot?"":E,F=r.dot?$:oe,ae=r.bash===!0?L(r):q;r.capture&&(ae=`(${ae})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let _={input:e,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:s};e=me.removePrefix(e,_),o=e.length;let Q=[],z=[],mt=[],v=i,b,ve=()=>_.index===o-1,j=_.peek=(A=1)=>e[_.index+A],Ve=_.advance=()=>e[++_.index]||"",We=()=>e.slice(_.index+1),Se=(A="",Z=0)=>{_.consumed+=A,_.index+=Z},Mr=A=>{_.output+=A.output!=null?A.output:A.value,Se(A.value)},Th=()=>{let A=1;for(;j()==="!"&&(j(2)!=="("||j(3)==="?");)Ve(),_.start++,A++;return A%2===0?!1:(_.negated=!0,_.start++,!0)},Br=A=>{_[A]++,mt.push(A)},gt=A=>{_[A]--,mt.pop()},N=A=>{if(v.type==="globstar"){let Z=_.braces>0&&(A.type==="comma"||A.type==="brace"),C=A.extglob===!0||Q.length&&(A.type==="pipe"||A.type==="paren");A.type!=="slash"&&A.type!=="paren"&&!Z&&!C&&(_.output=_.output.slice(0,-v.output.length),v.type="star",v.value="*",v.output=ae,_.output+=v.output)}if(Q.length&&A.type!=="paren"&&(Q[Q.length-1].inner+=A.value),(A.value||A.output)&&Mr(A),v&&v.type==="text"&&A.type==="text"){v.value+=A.value,v.output=(v.output||"")+A.value;return}A.prev=v,s.push(A),v=A},Hr=(A,Z)=>{let C={...l[Z],conditions:1,inner:""};C.prev=v,C.parens=_.parens,C.output=_.output,C.startIndex=_.index,C.tokensIndex=s.length;let D=(r.capture?"(":"")+C.open;Br("parens"),N({type:A,value:Z,output:_.output?"":g}),N({type:"paren",extglob:!0,value:Ve(),output:D}),Q.push(C)},Ph=A=>{let Z=e.slice(A.startIndex,_.index+1),C=e.slice(A.startIndex+2,_.index),D=Zb(C,r);if((A.type==="plus"||A.type==="star")&&D.risky){let Y=D.safeOutput?(A.output?"":g)+(r.capture?`(${D.safeOutput})`:D.safeOutput):void 0,Ue=s[A.tokensIndex];Ue.type="text",Ue.value=Z,Ue.output=Y||me.escapeRegex(Z);for(let qe=A.tokensIndex+1;qe<s.length;qe++)s[qe].value="",s[qe].output="",delete s[qe].suffix;_.output=A.output+Ue.output,_.backtrack=!0,N({type:"paren",extglob:!0,value:b,output:""}),gt("parens");return}let X=A.close+(r.capture?")":""),ce;if(A.type==="negate"){let Y=ae;if(A.inner&&A.inner.length>1&&A.inner.includes("/")&&(Y=L(r)),(Y!==ae||ve()||/^\)+$/.test(We()))&&(X=A.close=`)$))${Y}`),A.inner.includes("*")&&(ce=We())&&/^\.[^\\/.]+$/.test(ce)){let Ue=vi(ce,{...t,fastpaths:!1}).output;X=A.close=`)${Ue})${Y})`}A.prev.type==="bos"&&(_.negatedExtglob=!0)}N({type:"paren",extglob:!0,value:b,output:X}),gt("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let A=!1,Z=e.replace(Yb,(C,D,X,ce,Y,Ue)=>ce==="\\"?(A=!0,C):ce==="?"?D?D+ce+(Y?$.repeat(Y.length):""):Ue===0?F+(Y?$.repeat(Y.length):""):$.repeat(X.length):ce==="."?p.repeat(X.length):ce==="*"?D?D+ce+(Y?ae:""):ae:D?C:`\\${C}`);return A===!0&&(r.unescape===!0?Z=Z.replace(/\\/g,""):Z=Z.replace(/\\+/g,C=>C.length%2===0?"\\\\":C?"\\":"")),Z===e&&r.contains===!0?(_.output=e,_):(_.output=me.wrapOutput(Z,_,t),_)}for(;!ve();){if(b=Ve(),b==="\0")continue;if(b==="\\"){let C=j();if(C==="/"&&r.bash!==!0||C==="."||C===";")continue;if(!C){b+="\\",N({type:"text",value:b});continue}let D=/^\\+/.exec(We()),X=0;if(D&&D[0].length>2&&(X=D[0].length,_.index+=X,X%2!==0&&(b+="\\")),r.unescape===!0?b=Ve():b+=Ve(),_.brackets===0){N({type:"text",value:b});continue}}if(_.brackets>0&&(b!=="]"||v.value==="["||v.value==="[^")){if(r.posix!==!1&&b===":"){let C=v.value.slice(1);if(C.includes("[")&&(v.posix=!0,C.includes(":"))){let D=v.value.lastIndexOf("["),X=v.value.slice(0,D),ce=v.value.slice(D+2),Y=Ub[ce];if(Y){v.value=X+Y,_.backtrack=!0,Ve(),!i.output&&s.indexOf(v)===1&&(i.output=g);continue}}}(b==="["&&j()!==":"||b==="-"&&j()==="]")&&(b=`\\${b}`),b==="]"&&(v.value==="["||v.value==="[^")&&(b=`\\${b}`),r.posix===!0&&b==="!"&&v.value==="["&&(b="^"),v.value+=b,Mr({value:b});continue}if(_.quotes===1&&b!=='"'){b=me.escapeRegex(b),v.value+=b,Mr({value:b});continue}if(b==='"'){_.quotes=_.quotes===1?0:1,r.keepQuotes===!0&&N({type:"text",value:b});continue}if(b==="("){Br("parens"),N({type:"paren",value:b});continue}if(b===")"){if(_.parens===0&&r.strictBrackets===!0)throw new SyntaxError(Jt("opening","("));let C=Q[Q.length-1];if(C&&_.parens===C.parens+1){Ph(Q.pop());continue}N({type:"paren",value:b,output:_.parens?")":"\\)"}),gt("parens");continue}if(b==="["){if(r.nobracket===!0||!We().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(Jt("closing","]"));b=`\\${b}`}else Br("brackets");N({type:"bracket",value:b});continue}if(b==="]"){if(r.nobracket===!0||v&&v.type==="bracket"&&v.value.length===1){N({type:"text",value:b,output:`\\${b}`});continue}if(_.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(Jt("opening","["));N({type:"text",value:b,output:`\\${b}`});continue}gt("brackets");let C=v.value.slice(1);if(v.posix!==!0&&C[0]==="^"&&!C.includes("/")&&(b=`/${b}`),v.value+=b,Mr({value:b}),r.literalBrackets===!1||me.hasRegexChars(C))continue;let D=me.escapeRegex(v.value);if(_.output=_.output.slice(0,-v.value.length),r.literalBrackets===!0){_.output+=D,v.value=D;continue}v.value=`(${a}${D}|${v.value})`,_.output+=v.value;continue}if(b==="{"&&r.nobrace!==!0){Br("braces");let C={type:"brace",value:b,output:"(",outputIndex:_.output.length,tokensIndex:_.tokens.length};z.push(C),N(C);continue}if(b==="}"){let C=z[z.length-1];if(r.nobrace===!0||!C){N({type:"text",value:b,output:b});continue}let D=")";if(C.dots===!0){let X=s.slice(),ce=[];for(let Y=X.length-1;Y>=0&&(s.pop(),X[Y].type!=="brace");Y--)X[Y].type!=="dots"&&ce.unshift(X[Y].value);D=Kb(ce,r),_.backtrack=!0}if(C.comma!==!0&&C.dots!==!0){let X=_.output.slice(0,C.outputIndex),ce=_.tokens.slice(C.tokensIndex);C.value=C.output="\\{",b=D="\\}",_.output=X;for(let Y of ce)_.output+=Y.output||Y.value}N({type:"brace",value:b,output:D}),gt("braces"),z.pop();continue}if(b==="|"){Q.length>0&&Q[Q.length-1].conditions++,N({type:"text",value:b});continue}if(b===","){let C=b,D=z[z.length-1];D&&mt[mt.length-1]==="braces"&&(D.comma=!0,C="|"),N({type:"comma",value:b,output:C});continue}if(b==="/"){if(v.type==="dot"&&_.index===_.start+1){_.start=_.index+1,_.consumed="",_.output="",s.pop(),v=i;continue}N({type:"slash",value:b,output:y});continue}if(b==="."){if(_.braces>0&&v.type==="dot"){v.value==="."&&(v.output=p);let C=z[z.length-1];v.type="dots",v.output+=b,v.value+=b,C.dots=!0;continue}if(_.braces+_.parens===0&&v.type!=="bos"&&v.type!=="slash"){N({type:"text",value:b,output:p});continue}N({type:"dot",value:b,output:p});continue}if(b==="?"){if(!(v&&v.value==="(")&&r.noextglob!==!0&&j()==="("&&j(2)!=="?"){Hr("qmark",b);continue}if(v&&v.type==="paren"){let D=j(),X=b;if(D==="<"&&!me.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(v.value==="("&&!/[!=<:]/.test(D)||D==="<"&&!/<([!=]|\w+>)/.test(We()))&&(X=`\\${b}`),N({type:"text",value:b,output:X});continue}if(r.dot!==!0&&(v.type==="slash"||v.type==="bos")){N({type:"qmark",value:b,output:oe});continue}N({type:"qmark",value:b,output:$});continue}if(b==="!"){if(r.noextglob!==!0&&j()==="("&&(j(2)!=="?"||!/[!=<:]/.test(j(3)))){Hr("negate",b);continue}if(r.nonegate!==!0&&_.index===0){Th();continue}}if(b==="+"){if(r.noextglob!==!0&&j()==="("&&j(2)!=="?"){Hr("plus",b);continue}if(v&&v.value==="("||r.regex===!1){N({type:"plus",value:b,output:d});continue}if(v&&(v.type==="bracket"||v.type==="paren"||v.type==="brace")||_.parens>0){N({type:"plus",value:b});continue}N({type:"plus",value:d});continue}if(b==="@"){if(r.noextglob!==!0&&j()==="("&&j(2)!=="?"){N({type:"at",extglob:!0,value:b,output:""});continue}N({type:"text",value:b});continue}if(b!=="*"){(b==="$"||b==="^")&&(b=`\\${b}`);let C=qb.exec(We());C&&(b+=C[0],_.index+=C[0].length),N({type:"text",value:b});continue}if(v&&(v.type==="globstar"||v.star===!0)){v.type="star",v.star=!0,v.value+=b,v.output=ae,_.backtrack=!0,_.globstar=!0,Se(b);continue}let A=We();if(r.noextglob!==!0&&/^\([^?]/.test(A)){Hr("star",b);continue}if(v.type==="star"){if(r.noglobstar===!0){Se(b);continue}let C=v.prev,D=C.prev,X=C.type==="slash"||C.type==="bos",ce=D&&(D.type==="star"||D.type==="globstar");if(r.bash===!0&&(!X||A[0]&&A[0]!=="/")){N({type:"star",value:b,output:""});continue}let Y=_.braces>0&&(C.type==="comma"||C.type==="brace"),Ue=Q.length&&(C.type==="pipe"||C.type==="paren");if(!X&&C.type!=="paren"&&!Y&&!Ue){N({type:"star",value:b,output:""});continue}for(;A.slice(0,3)==="/**";){let qe=e[_.index+4];if(qe&&qe!=="/")break;A=A.slice(3),Se("/**",3)}if(C.type==="bos"&&ve()){v.type="globstar",v.value+=b,v.output=L(r),_.output=v.output,_.globstar=!0,Se(b);continue}if(C.type==="slash"&&C.prev.type!=="bos"&&!ce&&ve()){_.output=_.output.slice(0,-(C.output+v.output).length),C.output=`(?:${C.output}`,v.type="globstar",v.output=L(r)+(r.strictSlashes?")":"|$)"),v.value+=b,_.globstar=!0,_.output+=C.output+v.output,Se(b);continue}if(C.type==="slash"&&C.prev.type!=="bos"&&A[0]==="/"){let qe=A[1]!==void 0?"|$":"";_.output=_.output.slice(0,-(C.output+v.output).length),C.output=`(?:${C.output}`,v.type="globstar",v.output=`${L(r)}${y}|${y}${qe})`,v.value+=b,_.output+=C.output+v.output,_.globstar=!0,Se(b+Ve()),N({type:"slash",value:"/",output:""});continue}if(C.type==="bos"&&A[0]==="/"){v.type="globstar",v.value+=b,v.output=`(?:^|${y}|${L(r)}${y})`,_.output=v.output,_.globstar=!0,Se(b+Ve()),N({type:"slash",value:"/",output:""});continue}_.output=_.output.slice(0,-v.output.length),v.type="globstar",v.output=L(r),v.value+=b,_.output+=v.output,_.globstar=!0,Se(b);continue}let Z={type:"star",value:b,output:ae};if(r.bash===!0){Z.output=".*?",(v.type==="bos"||v.type==="slash")&&(Z.output=w+Z.output),N(Z);continue}if(v&&(v.type==="bracket"||v.type==="paren")&&r.regex===!0){Z.output=b,N(Z);continue}(_.index===_.start||v.type==="slash"||v.type==="dot")&&(v.type==="dot"?(_.output+=x,v.output+=x):r.dot===!0?(_.output+=S,v.output+=S):(_.output+=w,v.output+=w),j()!=="*"&&(_.output+=g,v.output+=g)),N(Z)}for(;_.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Jt("closing","]"));_.output=me.escapeLast(_.output,"["),gt("brackets")}for(;_.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Jt("closing",")"));_.output=me.escapeLast(_.output,"("),gt("parens")}for(;_.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Jt("closing","}"));_.output=me.escapeLast(_.output,"{"),gt("braces")}if(r.strictSlashes!==!0&&(v.type==="star"||v.type==="bracket")&&N({type:"maybe_slash",value:"",output:`${y}?`}),_.backtrack===!0){_.output="";for(let A of _.tokens)_.output+=A.output!=null?A.output:A.value,A.suffix&&(_.output+=A.suffix)}return _};vi.fastpaths=(e,t)=>{let r={...t},n=typeof r.maxLength=="number"?Math.min(pn,r.maxLength):pn,o=e.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);e=Bu[e]||e;let i=me.isWindows(t),{DOT_LITERAL:s,SLASH_LITERAL:a,ONE_CHAR:c,DOTS_SLASH:u,NO_DOT:l,NO_DOTS:p,NO_DOTS_SLASH:d,STAR:y,START_ANCHOR:g}=Sr.globChars(i),m=r.dot?p:l,E=r.dot?d:l,x=r.capture?"":"?:",S={negated:!1,prefix:""},$=r.bash===!0?".*?":y;r.capture&&($=`(${$})`);let oe=w=>w.noglobstar===!0?$:`(${x}(?:(?!${g}${w.dot?u:s}).)*?)`,q=w=>{switch(w){case"*":return`${m}${c}${$}`;case".*":return`${s}${c}${$}`;case"*.*":return`${m}${$}${s}${c}${$}`;case"*/*":return`${m}${$}${a}${c}${E}${$}`;case"**":return m+oe(r);case"**/*":return`(?:${m}${oe(r)}${a})?${E}${c}${$}`;case"**/*.*":return`(?:${m}${oe(r)}${a})?${E}${$}${s}${c}${$}`;case"**/.*":return`(?:${m}${oe(r)}${a})?${s}${c}${$}`;default:{let F=/^(.*?)\.(\w+)$/.exec(w);if(!F)return;let ae=q(F[1]);return ae?ae+s+F[2]:void 0}}},T=me.removePrefix(e,S),L=q(T);return L&&r.strictSlashes!==!0&&(L+=`${a}?`),L};Vu.exports=vi});var qu=k((mS,Uu)=>{"use strict";var e_=M("path"),t_=Mu(),bi=Wu(),_i=Cr(),r_=wr(),n_=e=>e&&typeof e=="object"&&!Array.isArray(e),re=(e,t,r=!1)=>{if(Array.isArray(e)){let l=e.map(d=>re(d,t,r));return d=>{for(let y of l){let g=y(d);if(g)return g}return!1}}let n=n_(e)&&e.tokens&&e.input;if(e===""||typeof e!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let o=t||{},i=_i.isWindows(t),s=n?re.compileRe(e,t):re.makeRe(e,t,!1,!0),a=s.state;delete s.state;let c=()=>!1;if(o.ignore){let l={...t,ignore:null,onMatch:null,onResult:null};c=re(o.ignore,l,r)}let u=(l,p=!1)=>{let{isMatch:d,match:y,output:g}=re.test(l,s,t,{glob:e,posix:i}),m={glob:e,state:a,regex:s,posix:i,input:l,output:g,match:y,isMatch:d};return typeof o.onResult=="function"&&o.onResult(m),d===!1?(m.isMatch=!1,p?m:!1):c(l)?(typeof o.onIgnore=="function"&&o.onIgnore(m),m.isMatch=!1,p?m:!1):(typeof o.onMatch=="function"&&o.onMatch(m),p?m:!0)};return r&&(u.state=a),u};re.test=(e,t,r,{glob:n,posix:o}={})=>{if(typeof e!="string")throw new TypeError("Expected input to be a string");if(e==="")return{isMatch:!1,output:""};let i=r||{},s=i.format||(o?_i.toPosixSlashes:null),a=e===n,c=a&&s?s(e):e;return a===!1&&(c=s?s(e):e,a=c===n),(a===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?a=re.matchBase(e,t,r,o):a=t.exec(c)),{isMatch:!!a,match:a,output:c}};re.matchBase=(e,t,r,n=_i.isWindows(r))=>(t instanceof RegExp?t:re.makeRe(t,r)).test(e_.basename(e));re.isMatch=(e,t,r)=>re(t,r)(e);re.parse=(e,t)=>Array.isArray(e)?e.map(r=>re.parse(r,t)):bi(e,{...t,fastpaths:!1});re.scan=(e,t)=>t_(e,t);re.compileRe=(e,t,r=!1,n=!1)=>{if(r===!0)return e.output;let o=t||{},i=o.contains?"":"^",s=o.contains?"":"$",a=`${i}(?:${e.output})${s}`;e&&e.negated===!0&&(a=`^(?!${a}).*$`);let c=re.toRegex(a,t);return n===!0&&(c.state=e),c};re.makeRe=(e,t={},r=!1,n=!1)=>{if(!e||typeof e!="string")throw new TypeError("Expected a non-empty string");let o={negated:!1,fastpaths:!0};return t.fastpaths!==!1&&(e[0]==="."||e[0]==="*")&&(o.output=bi.fastpaths(e,t)),o.output||(o=bi(e,t)),re.compileRe(o,t,r,n)};re.toRegex=(e,t)=>{try{let r=t||{};return new RegExp(e,r.flags||(r.nocase?"i":""))}catch(r){if(t&&t.debug===!0)throw r;return/$^/}};re.constants=r_;Uu.exports=re});var Ku=k((gS,Yu)=>{"use strict";Yu.exports=qu()});var ep=k((yS,Zu)=>{"use strict";var Xu=M("util"),Ju=Au(),Qe=Ku(),Ei=Cr(),zu=e=>e===""||e==="./",Qu=e=>{let t=e.indexOf("{");return t>-1&&e.indexOf("}",t)>-1},J=(e,t,r)=>{t=[].concat(t),e=[].concat(e);let n=new Set,o=new Set,i=new Set,s=0,a=l=>{i.add(l.output),r&&r.onResult&&r.onResult(l)};for(let l=0;l<t.length;l++){let p=Qe(String(t[l]),{...r,onResult:a},!0),d=p.state.negated||p.state.negatedExtglob;d&&s++;for(let y of e){let g=p(y,!0);(d?!g.isMatch:g.isMatch)&&(d?n.add(g.output):(n.delete(g.output),o.add(g.output)))}}let u=(s===t.length?[...i]:[...o]).filter(l=>!n.has(l));if(r&&u.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${t.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?t.map(l=>l.replace(/\\/g,"")):t}return u};J.match=J;J.matcher=(e,t)=>Qe(e,t);J.isMatch=(e,t,r)=>Qe(t,r)(e);J.any=J.isMatch;J.not=(e,t,r={})=>{t=[].concat(t).map(String);let n=new Set,o=[],i=a=>{r.onResult&&r.onResult(a),o.push(a.output)},s=new Set(J(e,t,{...r,onResult:i}));for(let a of o)s.has(a)||n.add(a);return[...n]};J.contains=(e,t,r)=>{if(typeof e!="string")throw new TypeError(`Expected a string: "${Xu.inspect(e)}"`);if(Array.isArray(t))return t.some(n=>J.contains(e,n,r));if(typeof t=="string"){if(zu(e)||zu(t))return!1;if(e.includes(t)||e.startsWith("./")&&e.slice(2).includes(t))return!0}return J.isMatch(e,t,{...r,contains:!0})};J.matchKeys=(e,t,r)=>{if(!Ei.isObject(e))throw new TypeError("Expected the first argument to be an object");let n=J(Object.keys(e),t,r),o={};for(let i of n)o[i]=e[i];return o};J.some=(e,t,r)=>{let n=[].concat(e);for(let o of[].concat(t)){let i=Qe(String(o),r);if(n.some(s=>i(s)))return!0}return!1};J.every=(e,t,r)=>{let n=[].concat(e);for(let o of[].concat(t)){let i=Qe(String(o),r);if(!n.every(s=>i(s)))return!1}return!0};J.all=(e,t,r)=>{if(typeof e!="string")throw new TypeError(`Expected a string: "${Xu.inspect(e)}"`);return[].concat(t).every(n=>Qe(n,r)(e))};J.capture=(e,t,r)=>{let n=Ei.isWindows(r),i=Qe.makeRe(String(e),{...r,capture:!0}).exec(n?Ei.toPosixSlashes(t):t);if(i)return i.slice(1).map(s=>s===void 0?"":s)};J.makeRe=(...e)=>Qe.makeRe(...e);J.scan=(...e)=>Qe.scan(...e);J.parse=(e,t)=>{let r=[];for(let n of[].concat(e||[]))for(let o of Ju(String(n),t))r.push(Qe.parse(o,t));return r};J.braces=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a string");return t&&t.nobrace===!0||!Qu(e)?[e]:Ju(e,t)};J.braceExpand=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a string");return J.braces(e,{...t,expand:!0})};J.hasBraces=Qu;Zu.exports=J});var up=k(O=>{"use strict";Object.defineProperty(O,"__esModule",{value:!0});O.isAbsolute=O.partitionAbsoluteAndRelative=O.removeDuplicateSlashes=O.matchAny=O.convertPatternsToRe=O.makeRe=O.getPatternParts=O.expandBraceExpansion=O.expandPatternsWithBraceExpansion=O.isAffectDepthOfReadingPattern=O.endsWithSlashGlobStar=O.hasGlobStar=O.getBaseDirectory=O.isPatternRelatedToParentDirectory=O.getPatternsOutsideCurrentDirectory=O.getPatternsInsideCurrentDirectory=O.getPositivePatterns=O.getNegativePatterns=O.isPositivePattern=O.isNegativePattern=O.convertToNegativePattern=O.convertToPositivePattern=O.isDynamicPattern=O.isStaticPattern=void 0;var tp=M("path"),o_=Wl(),xi=ep(),rp="**",i_="\\",s_=/[*?]|^!/,a_=/\[[^[]*]/,c_=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,l_=/[!*+?@]\([^(]*\)/,u_=/,|\.\./,p_=/(?!^)\/{2,}/g;function np(e,t={}){return!op(e,t)}O.isStaticPattern=np;function op(e,t={}){return e===""?!1:!!(t.caseSensitiveMatch===!1||e.includes(i_)||s_.test(e)||a_.test(e)||c_.test(e)||t.extglob!==!1&&l_.test(e)||t.braceExpansion!==!1&&d_(e))}O.isDynamicPattern=op;function d_(e){let t=e.indexOf("{");if(t===-1)return!1;let r=e.indexOf("}",t+1);if(r===-1)return!1;let n=e.slice(t,r);return u_.test(n)}function f_(e){return dn(e)?e.slice(1):e}O.convertToPositivePattern=f_;function h_(e){return"!"+e}O.convertToNegativePattern=h_;function dn(e){return e.startsWith("!")&&e[1]!=="("}O.isNegativePattern=dn;function ip(e){return!dn(e)}O.isPositivePattern=ip;function m_(e){return e.filter(dn)}O.getNegativePatterns=m_;function g_(e){return e.filter(ip)}O.getPositivePatterns=g_;function y_(e){return e.filter(t=>!ki(t))}O.getPatternsInsideCurrentDirectory=y_;function v_(e){return e.filter(ki)}O.getPatternsOutsideCurrentDirectory=v_;function ki(e){return e.startsWith("..")||e.startsWith("./..")}O.isPatternRelatedToParentDirectory=ki;function b_(e){return o_(e,{flipBackslashes:!1})}O.getBaseDirectory=b_;function __(e){return e.includes(rp)}O.hasGlobStar=__;function sp(e){return e.endsWith("/"+rp)}O.endsWithSlashGlobStar=sp;function E_(e){let t=tp.basename(e);return sp(e)||np(t)}O.isAffectDepthOfReadingPattern=E_;function x_(e){return e.reduce((t,r)=>t.concat(ap(r)),[])}O.expandPatternsWithBraceExpansion=x_;function ap(e){let t=xi.braces(e,{expand:!0,nodupes:!0,keepEscaping:!0});return t.sort((r,n)=>r.length-n.length),t.filter(r=>r!=="")}O.expandBraceExpansion=ap;function k_(e,t){let{parts:r}=xi.scan(e,Object.assign(Object.assign({},t),{parts:!0}));return r.length===0&&(r=[e]),r[0].startsWith("/")&&(r[0]=r[0].slice(1),r.unshift("")),r}O.getPatternParts=k_;function cp(e,t){return xi.makeRe(e,t)}O.makeRe=cp;function w_(e,t){return e.map(r=>cp(r,t))}O.convertPatternsToRe=w_;function C_(e,t){return t.some(r=>r.test(e))}O.matchAny=C_;function A_(e){return e.replace(p_,"/")}O.removeDuplicateSlashes=A_;function S_(e){let t=[],r=[];for(let n of e)lp(n)?t.push(n):r.push(n);return[t,r]}O.partitionAbsoluteAndRelative=S_;function lp(e){return tp.isAbsolute(e)}O.isAbsolute=lp});var hp=k((bS,fp)=>{"use strict";var R_=M("stream"),pp=R_.PassThrough,O_=Array.prototype.slice;fp.exports=T_;function T_(){let e=[],t=O_.call(arguments),r=!1,n=t[t.length-1];n&&!Array.isArray(n)&&n.pipe==null?t.pop():n={};let o=n.end!==!1,i=n.pipeError===!0;n.objectMode==null&&(n.objectMode=!0),n.highWaterMark==null&&(n.highWaterMark=64*1024);let s=pp(n);function a(){for(let l=0,p=arguments.length;l<p;l++)e.push(dp(arguments[l],n));return c(),this}function c(){if(r)return;r=!0;let l=e.shift();if(!l){process.nextTick(u);return}Array.isArray(l)||(l=[l]);let p=l.length+1;function d(){--p>0||(r=!1,c())}function y(g){function m(){g.removeListener("merge2UnpipeEnd",m),g.removeListener("end",m),i&&g.removeListener("error",E),d()}function E(x){s.emit("error",x)}if(g._readableState.endEmitted)return d();g.on("merge2UnpipeEnd",m),g.on("end",m),i&&g.on("error",E),g.pipe(s,{end:!1}),g.resume()}for(let g=0;g<l.length;g++)y(l[g]);d()}function u(){r=!1,s.emit("queueDrain"),o&&s.end()}return s.setMaxListeners(0),s.add=a,s.on("unpipe",function(l){l.emit("merge2UnpipeEnd")}),t.length&&a.apply(null,t),s}function dp(e,t){if(Array.isArray(e))for(let r=0,n=e.length;r<n;r++)e[r]=dp(e[r],t);else{if(!e._readableState&&e.pipe&&(e=e.pipe(pp(t))),!e._readableState||!e.pause||!e.pipe)throw new Error("Only readable stream can be merged.");e.pause()}return e}});var gp=k(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.merge=void 0;var P_=hp();function $_(e){let t=P_(e);return e.forEach(r=>{r.once("error",n=>t.emit("error",n))}),t.once("close",()=>mp(e)),t.once("end",()=>mp(e)),t}fn.merge=$_;function mp(e){e.forEach(t=>t.emit("close"))}});var yp=k(Qt=>{"use strict";Object.defineProperty(Qt,"__esModule",{value:!0});Qt.isEmpty=Qt.isString=void 0;function D_(e){return typeof e=="string"}Qt.isString=D_;function N_(e){return e===""}Qt.isEmpty=N_});var st=k(ge=>{"use strict";Object.defineProperty(ge,"__esModule",{value:!0});ge.string=ge.stream=ge.pattern=ge.path=ge.fs=ge.errno=ge.array=void 0;var L_=Pl();ge.array=L_;var I_=$l();ge.errno=I_;var F_=Dl();ge.fs=F_;var j_=Fl();ge.path=j_;var M_=up();ge.pattern=M_;var B_=gp();ge.stream=B_;var H_=yp();ge.string=H_});var Ep=k(ye=>{"use strict";Object.defineProperty(ye,"__esModule",{value:!0});ye.convertPatternGroupToTask=ye.convertPatternGroupsToTasks=ye.groupPatternsByBaseDirectory=ye.getNegativePatternsAsPositive=ye.getPositivePatterns=ye.convertPatternsToTasks=ye.generate=void 0;var Be=st();function G_(e,t){let r=vp(e,t),n=vp(t.ignore,t),o=bp(r),i=_p(r,n),s=o.filter(l=>Be.pattern.isStaticPattern(l,t)),a=o.filter(l=>Be.pattern.isDynamicPattern(l,t)),c=wi(s,i,!1),u=wi(a,i,!0);return c.concat(u)}ye.generate=G_;function vp(e,t){let r=e;return t.braceExpansion&&(r=Be.pattern.expandPatternsWithBraceExpansion(r)),t.baseNameMatch&&(r=r.map(n=>n.includes("/")?n:`**/${n}`)),r.map(n=>Be.pattern.removeDuplicateSlashes(n))}function wi(e,t,r){let n=[],o=Be.pattern.getPatternsOutsideCurrentDirectory(e),i=Be.pattern.getPatternsInsideCurrentDirectory(e),s=Ci(o),a=Ci(i);return n.push(...Ai(s,t,r)),"."in a?n.push(Si(".",i,t,r)):n.push(...Ai(a,t,r)),n}ye.convertPatternsToTasks=wi;function bp(e){return Be.pattern.getPositivePatterns(e)}ye.getPositivePatterns=bp;function _p(e,t){return Be.pattern.getNegativePatterns(e).concat(t).map(Be.pattern.convertToPositivePattern)}ye.getNegativePatternsAsPositive=_p;function Ci(e){let t={};return e.reduce((r,n)=>{let o=Be.pattern.getBaseDirectory(n);return o in r?r[o].push(n):r[o]=[n],r},t)}ye.groupPatternsByBaseDirectory=Ci;function Ai(e,t,r){return Object.keys(e).map(n=>Si(n,e[n],t,r))}ye.convertPatternGroupsToTasks=Ai;function Si(e,t,r,n){return{dynamic:n,positive:t,negative:r,base:e,patterns:[].concat(t,r.map(Be.pattern.convertToNegativePattern))}}ye.convertPatternGroupToTask=Si});var kp=k(hn=>{"use strict";Object.defineProperty(hn,"__esModule",{value:!0});hn.read=void 0;function V_(e,t,r){t.fs.lstat(e,(n,o)=>{if(n!==null){xp(r,n);return}if(!o.isSymbolicLink()||!t.followSymbolicLink){Ri(r,o);return}t.fs.stat(e,(i,s)=>{if(i!==null){if(t.throwErrorOnBrokenSymbolicLink){xp(r,i);return}Ri(r,o);return}t.markSymbolicLink&&(s.isSymbolicLink=()=>!0),Ri(r,s)})})}hn.read=V_;function xp(e,t){e(t)}function Ri(e,t){e(null,t)}});var wp=k(mn=>{"use strict";Object.defineProperty(mn,"__esModule",{value:!0});mn.read=void 0;function W_(e,t){let r=t.fs.lstatSync(e);if(!r.isSymbolicLink()||!t.followSymbolicLink)return r;try{let n=t.fs.statSync(e);return t.markSymbolicLink&&(n.isSymbolicLink=()=>!0),n}catch(n){if(!t.throwErrorOnBrokenSymbolicLink)return r;throw n}}mn.read=W_});var Cp=k(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.createFileSystemAdapter=Et.FILE_SYSTEM_ADAPTER=void 0;var gn=M("fs");Et.FILE_SYSTEM_ADAPTER={lstat:gn.lstat,stat:gn.stat,lstatSync:gn.lstatSync,statSync:gn.statSync};function U_(e){return e===void 0?Et.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},Et.FILE_SYSTEM_ADAPTER),e)}Et.createFileSystemAdapter=U_});var Ap=k(Ti=>{"use strict";Object.defineProperty(Ti,"__esModule",{value:!0});var q_=Cp(),Oi=class{constructor(t={}){this._options=t,this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,!0),this.fs=q_.createFileSystemAdapter(this._options.fs),this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0)}_getValue(t,r){return t??r}};Ti.default=Oi});var Lt=k(xt=>{"use strict";Object.defineProperty(xt,"__esModule",{value:!0});xt.statSync=xt.stat=xt.Settings=void 0;var Sp=kp(),Y_=wp(),Pi=Ap();xt.Settings=Pi.default;function K_(e,t,r){if(typeof t=="function"){Sp.read(e,$i(),t);return}Sp.read(e,$i(t),r)}xt.stat=K_;function z_(e,t){let r=$i(t);return Y_.read(e,r)}xt.statSync=z_;function $i(e={}){return e instanceof Pi.default?e:new Pi.default(e)}});var Tp=k((OS,Op)=>{var Rp;Op.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:global):e=>(Rp||(Rp=Promise.resolve())).then(e).catch(t=>setTimeout(()=>{throw t},0))});var $p=k((TS,Pp)=>{Pp.exports=J_;var X_=Tp();function J_(e,t){let r,n,o,i=!0;Array.isArray(e)?(r=[],n=e.length):(o=Object.keys(e),r={},n=o.length);function s(c){function u(){t&&t(c,r),t=null}i?X_(u):u()}function a(c,u,l){r[c]=l,(--n===0||u)&&s(u)}n?o?o.forEach(function(c){e[c](function(u,l){a(c,u,l)})}):e.forEach(function(c,u){c(function(l,p){a(u,l,p)})}):s(null),i=!1}});var Di=k(vn=>{"use strict";Object.defineProperty(vn,"__esModule",{value:!0});vn.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;var yn=process.versions.node.split(".");if(yn[0]===void 0||yn[1]===void 0)throw new Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);var Dp=Number.parseInt(yn[0],10),Q_=Number.parseInt(yn[1],10),Np=10,Z_=10,eE=Dp>Np,tE=Dp===Np&&Q_>=Z_;vn.IS_SUPPORT_READDIR_WITH_FILE_TYPES=eE||tE});var Lp=k(bn=>{"use strict";Object.defineProperty(bn,"__esModule",{value:!0});bn.createDirentFromStats=void 0;var Ni=class{constructor(t,r){this.name=t,this.isBlockDevice=r.isBlockDevice.bind(r),this.isCharacterDevice=r.isCharacterDevice.bind(r),this.isDirectory=r.isDirectory.bind(r),this.isFIFO=r.isFIFO.bind(r),this.isFile=r.isFile.bind(r),this.isSocket=r.isSocket.bind(r),this.isSymbolicLink=r.isSymbolicLink.bind(r)}};function rE(e,t){return new Ni(e,t)}bn.createDirentFromStats=rE});var Li=k(_n=>{"use strict";Object.defineProperty(_n,"__esModule",{value:!0});_n.fs=void 0;var nE=Lp();_n.fs=nE});var Ii=k(En=>{"use strict";Object.defineProperty(En,"__esModule",{value:!0});En.joinPathSegments=void 0;function oE(e,t,r){return e.endsWith(r)?e+t:e+r+t}En.joinPathSegments=oE});var Hp=k(kt=>{"use strict";Object.defineProperty(kt,"__esModule",{value:!0});kt.readdir=kt.readdirWithFileTypes=kt.read=void 0;var iE=Lt(),Ip=$p(),sE=Di(),Fp=Li(),jp=Ii();function aE(e,t,r){if(!t.stats&&sE.IS_SUPPORT_READDIR_WITH_FILE_TYPES){Mp(e,t,r);return}Bp(e,t,r)}kt.read=aE;function Mp(e,t,r){t.fs.readdir(e,{withFileTypes:!0},(n,o)=>{if(n!==null){xn(r,n);return}let i=o.map(a=>({dirent:a,name:a.name,path:jp.joinPathSegments(e,a.name,t.pathSegmentSeparator)}));if(!t.followSymbolicLinks){Fi(r,i);return}let s=i.map(a=>cE(a,t));Ip(s,(a,c)=>{if(a!==null){xn(r,a);return}Fi(r,c)})})}kt.readdirWithFileTypes=Mp;function cE(e,t){return r=>{if(!e.dirent.isSymbolicLink()){r(null,e);return}t.fs.stat(e.path,(n,o)=>{if(n!==null){if(t.throwErrorOnBrokenSymbolicLink){r(n);return}r(null,e);return}e.dirent=Fp.fs.createDirentFromStats(e.name,o),r(null,e)})}}function Bp(e,t,r){t.fs.readdir(e,(n,o)=>{if(n!==null){xn(r,n);return}let i=o.map(s=>{let a=jp.joinPathSegments(e,s,t.pathSegmentSeparator);return c=>{iE.stat(a,t.fsStatSettings,(u,l)=>{if(u!==null){c(u);return}let p={name:s,path:a,dirent:Fp.fs.createDirentFromStats(s,l)};t.stats&&(p.stats=l),c(null,p)})}});Ip(i,(s,a)=>{if(s!==null){xn(r,s);return}Fi(r,a)})})}kt.readdir=Bp;function xn(e,t){e(t)}function Fi(e,t){e(null,t)}});var qp=k(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.readdir=wt.readdirWithFileTypes=wt.read=void 0;var lE=Lt(),uE=Di(),Gp=Li(),Vp=Ii();function pE(e,t){return!t.stats&&uE.IS_SUPPORT_READDIR_WITH_FILE_TYPES?Wp(e,t):Up(e,t)}wt.read=pE;function Wp(e,t){return t.fs.readdirSync(e,{withFileTypes:!0}).map(n=>{let o={dirent:n,name:n.name,path:Vp.joinPathSegments(e,n.name,t.pathSegmentSeparator)};if(o.dirent.isSymbolicLink()&&t.followSymbolicLinks)try{let i=t.fs.statSync(o.path);o.dirent=Gp.fs.createDirentFromStats(o.name,i)}catch(i){if(t.throwErrorOnBrokenSymbolicLink)throw i}return o})}wt.readdirWithFileTypes=Wp;function Up(e,t){return t.fs.readdirSync(e).map(n=>{let o=Vp.joinPathSegments(e,n,t.pathSegmentSeparator),i=lE.statSync(o,t.fsStatSettings),s={name:n,path:o,dirent:Gp.fs.createDirentFromStats(n,i)};return t.stats&&(s.stats=i),s})}wt.readdir=Up});var Yp=k(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.createFileSystemAdapter=Ct.FILE_SYSTEM_ADAPTER=void 0;var Zt=M("fs");Ct.FILE_SYSTEM_ADAPTER={lstat:Zt.lstat,stat:Zt.stat,lstatSync:Zt.lstatSync,statSync:Zt.statSync,readdir:Zt.readdir,readdirSync:Zt.readdirSync};function dE(e){return e===void 0?Ct.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},Ct.FILE_SYSTEM_ADAPTER),e)}Ct.createFileSystemAdapter=dE});var Kp=k(Mi=>{"use strict";Object.defineProperty(Mi,"__esModule",{value:!0});var fE=M("path"),hE=Lt(),mE=Yp(),ji=class{constructor(t={}){this._options=t,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=mE.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,fE.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new hE.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(t,r){return t??r}};Mi.default=ji});var kn=k(At=>{"use strict";Object.defineProperty(At,"__esModule",{value:!0});At.Settings=At.scandirSync=At.scandir=void 0;var zp=Hp(),gE=qp(),Bi=Kp();At.Settings=Bi.default;function yE(e,t,r){if(typeof t=="function"){zp.read(e,Hi(),t);return}zp.read(e,Hi(t),r)}At.scandir=yE;function vE(e,t){let r=Hi(t);return gE.read(e,r)}At.scandirSync=vE;function Hi(e={}){return e instanceof Bi.default?e:new Bi.default(e)}});var Jp=k((BS,Xp)=>{"use strict";function bE(e){var t=new e,r=t;function n(){var i=t;return i.next?t=i.next:(t=new e,r=t),i.next=null,i}function o(i){r.next=i,r=i}return{get:n,release:o}}Xp.exports=bE});var Zp=k((HS,Gi)=>{"use strict";var _E=Jp();function Qp(e,t,r){if(typeof e=="function"&&(r=t,t=e,e=null),!(r>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");var n=_E(EE),o=null,i=null,s=0,a=null,c={push:m,drain:Ce,saturated:Ce,pause:l,paused:!1,get concurrency(){return r},set concurrency(T){if(!(T>=1))throw new Error("fastqueue concurrency must be equal to or greater than 1");if(r=T,!c.paused)for(;o&&s<r;)s++,x()},running:u,resume:y,idle:g,length:p,getQueue:d,unshift:E,empty:Ce,kill:S,killAndDrain:$,error:q,abort:oe};return c;function u(){return s}function l(){c.paused=!0}function p(){for(var T=o,L=0;T;)T=T.next,L++;return L}function d(){for(var T=o,L=[];T;)L.push(T.value),T=T.next;return L}function y(){if(c.paused){if(c.paused=!1,o===null){s++,x();return}for(;o&&s<r;)s++,x()}}function g(){return s===0&&c.length()===0}function m(T,L){var w=n.get();w.context=e,w.release=x,w.value=T,w.callback=L||Ce,w.errorHandler=a,s>=r||c.paused?i?(i.next=w,i=w):(o=w,i=w,c.saturated()):(s++,t.call(e,w.value,w.worked))}function E(T,L){var w=n.get();w.context=e,w.release=x,w.value=T,w.callback=L||Ce,w.errorHandler=a,s>=r||c.paused?o?(w.next=o,o=w):(o=w,i=w,c.saturated()):(s++,t.call(e,w.value,w.worked))}function x(T){T&&n.release(T);var L=o;L&&s<=r?c.paused?s--:(i===o&&(i=null),o=L.next,L.next=null,t.call(e,L.value,L.worked),i===null&&c.empty()):--s===0&&c.drain()}function S(){o=null,i=null,c.drain=Ce}function $(){o=null,i=null,c.drain(),c.drain=Ce}function oe(){var T=o;for(o=null,i=null;T;){var L=T.next,w=T.callback,F=T.errorHandler,ae=T.value,_=T.context;T.value=null,T.callback=Ce,T.errorHandler=null,F&&F(new Error("abort"),ae),w.call(_,new Error("abort")),T.release(T),T=L}c.drain=Ce}function q(T){a=T}}function Ce(){}function EE(){this.value=null,this.callback=Ce,this.next=null,this.release=Ce,this.context=null,this.errorHandler=null;var e=this;this.worked=function(r,n){var o=e.callback,i=e.errorHandler,s=e.value;e.value=null,e.callback=Ce,e.errorHandler&&i(r,s),o.call(e.context,r,n),e.release(e)}}function xE(e,t,r){typeof e=="function"&&(r=t,t=e,e=null);function n(l,p){t.call(this,l).then(function(d){p(null,d)},p)}var o=Qp(e,n,r),i=o.push,s=o.unshift;return o.push=a,o.unshift=c,o.drained=u,o;function a(l){var p=new Promise(function(d,y){i(l,function(g,m){if(g){y(g);return}d(m)})});return p.catch(Ce),p}function c(l){var p=new Promise(function(d,y){s(l,function(g,m){if(g){y(g);return}d(m)})});return p.catch(Ce),p}function u(){var l=new Promise(function(p){process.nextTick(function(){if(o.idle())p();else{var d=o.drain;o.drain=function(){typeof d=="function"&&d(),p(),o.drain=d}}})});return l}}Gi.exports=Qp;Gi.exports.promise=xE});var wn=k(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.joinPathSegments=Ze.replacePathSegmentSeparator=Ze.isAppliedFilter=Ze.isFatalError=void 0;function kE(e,t){return e.errorFilter===null?!0:!e.errorFilter(t)}Ze.isFatalError=kE;function wE(e,t){return e===null||e(t)}Ze.isAppliedFilter=wE;function CE(e,t){return e.split(/[/\\]/).join(t)}Ze.replacePathSegmentSeparator=CE;function AE(e,t,r){return e===""?t:e.endsWith(r)?e+t:e+r+t}Ze.joinPathSegments=AE});var Ui=k(Wi=>{"use strict";Object.defineProperty(Wi,"__esModule",{value:!0});var SE=wn(),Vi=class{constructor(t,r){this._root=t,this._settings=r,this._root=SE.replacePathSegmentSeparator(t,r.pathSegmentSeparator)}};Wi.default=Vi});var Ki=k(Yi=>{"use strict";Object.defineProperty(Yi,"__esModule",{value:!0});var RE=M("events"),OE=kn(),TE=Zp(),Cn=wn(),PE=Ui(),qi=class extends PE.default{constructor(t,r){super(t,r),this._settings=r,this._scandir=OE.scandir,this._emitter=new RE.EventEmitter,this._queue=TE(this._worker.bind(this),this._settings.concurrency),this._isFatalError=!1,this._isDestroyed=!1,this._queue.drain=()=>{this._isFatalError||this._emitter.emit("end")}}read(){return this._isFatalError=!1,this._isDestroyed=!1,setImmediate(()=>{this._pushToQueue(this._root,this._settings.basePath)}),this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed)throw new Error("The reader is already destroyed");this._isDestroyed=!0,this._queue.killAndDrain()}onEntry(t){this._emitter.on("entry",t)}onError(t){this._emitter.once("error",t)}onEnd(t){this._emitter.once("end",t)}_pushToQueue(t,r){let n={directory:t,base:r};this._queue.push(n,o=>{o!==null&&this._handleError(o)})}_worker(t,r){this._scandir(t.directory,this._settings.fsScandirSettings,(n,o)=>{if(n!==null){r(n,void 0);return}for(let i of o)this._handleEntry(i,t.base);r(null,void 0)})}_handleError(t){this._isDestroyed||!Cn.isFatalError(this._settings,t)||(this._isFatalError=!0,this._isDestroyed=!0,this._emitter.emit("error",t))}_handleEntry(t,r){if(this._isDestroyed||this._isFatalError)return;let n=t.path;r!==void 0&&(t.path=Cn.joinPathSegments(r,t.name,this._settings.pathSegmentSeparator)),Cn.isAppliedFilter(this._settings.entryFilter,t)&&this._emitEntry(t),t.dirent.isDirectory()&&Cn.isAppliedFilter(this._settings.deepFilter,t)&&this._pushToQueue(n,r===void 0?void 0:t.path)}_emitEntry(t){this._emitter.emit("entry",t)}};Yi.default=qi});var ed=k(Xi=>{"use strict";Object.defineProperty(Xi,"__esModule",{value:!0});var $E=Ki(),zi=class{constructor(t,r){this._root=t,this._settings=r,this._reader=new $E.default(this._root,this._settings),this._storage=[]}read(t){this._reader.onError(r=>{DE(t,r)}),this._reader.onEntry(r=>{this._storage.push(r)}),this._reader.onEnd(()=>{NE(t,this._storage)}),this._reader.read()}};Xi.default=zi;function DE(e,t){e(t)}function NE(e,t){e(null,t)}});var td=k(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});var LE=M("stream"),IE=Ki(),Ji=class{constructor(t,r){this._root=t,this._settings=r,this._reader=new IE.default(this._root,this._settings),this._stream=new LE.Readable({objectMode:!0,read:()=>{},destroy:()=>{this._reader.isDestroyed||this._reader.destroy()}})}read(){return this._reader.onError(t=>{this._stream.emit("error",t)}),this._reader.onEntry(t=>{this._stream.push(t)}),this._reader.onEnd(()=>{this._stream.push(null)}),this._reader.read(),this._stream}};Qi.default=Ji});var rd=k(es=>{"use strict";Object.defineProperty(es,"__esModule",{value:!0});var FE=kn(),An=wn(),jE=Ui(),Zi=class extends jE.default{constructor(){super(...arguments),this._scandir=FE.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(t,r){this._queue.add({directory:t,base:r})}_handleQueue(){for(let t of this._queue.values())this._handleDirectory(t.directory,t.base)}_handleDirectory(t,r){try{let n=this._scandir(t,this._settings.fsScandirSettings);for(let o of n)this._handleEntry(o,r)}catch(n){this._handleError(n)}}_handleError(t){if(An.isFatalError(this._settings,t))throw t}_handleEntry(t,r){let n=t.path;r!==void 0&&(t.path=An.joinPathSegments(r,t.name,this._settings.pathSegmentSeparator)),An.isAppliedFilter(this._settings.entryFilter,t)&&this._pushToStorage(t),t.dirent.isDirectory()&&An.isAppliedFilter(this._settings.deepFilter,t)&&this._pushToQueue(n,r===void 0?void 0:t.path)}_pushToStorage(t){this._storage.push(t)}};es.default=Zi});var nd=k(rs=>{"use strict";Object.defineProperty(rs,"__esModule",{value:!0});var ME=rd(),ts=class{constructor(t,r){this._root=t,this._settings=r,this._reader=new ME.default(this._root,this._settings)}read(){return this._reader.read()}};rs.default=ts});var od=k(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});var BE=M("path"),HE=kn(),ns=class{constructor(t={}){this._options=t,this.basePath=this._getValue(this._options.basePath,void 0),this.concurrency=this._getValue(this._options.concurrency,Number.POSITIVE_INFINITY),this.deepFilter=this._getValue(this._options.deepFilter,null),this.entryFilter=this._getValue(this._options.entryFilter,null),this.errorFilter=this._getValue(this._options.errorFilter,null),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,BE.sep),this.fsScandirSettings=new HE.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(t,r){return t??r}};os.default=ns});var Rn=k(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.Settings=et.walkStream=et.walkSync=et.walk=void 0;var id=ed(),GE=td(),VE=nd(),is=od();et.Settings=is.default;function WE(e,t,r){if(typeof t=="function"){new id.default(e,Sn()).read(t);return}new id.default(e,Sn(t)).read(r)}et.walk=WE;function UE(e,t){let r=Sn(t);return new VE.default(e,r).read()}et.walkSync=UE;function qE(e,t){let r=Sn(t);return new GE.default(e,r).read()}et.walkStream=qE;function Sn(e={}){return e instanceof is.default?e:new is.default(e)}});var On=k(as=>{"use strict";Object.defineProperty(as,"__esModule",{value:!0});var YE=M("path"),KE=Lt(),sd=st(),ss=class{constructor(t){this._settings=t,this._fsStatSettings=new KE.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(t){return YE.resolve(this._settings.cwd,t)}_makeEntry(t,r){let n={name:r,path:r,dirent:sd.fs.createDirentFromStats(r,t)};return this._settings.stats&&(n.stats=t),n}_isFatalError(t){return!sd.errno.isEnoentCodeError(t)&&!this._settings.suppressErrors}};as.default=ss});var us=k(ls=>{"use strict";Object.defineProperty(ls,"__esModule",{value:!0});var zE=M("stream"),XE=Lt(),JE=Rn(),QE=On(),cs=class extends QE.default{constructor(){super(...arguments),this._walkStream=JE.walkStream,this._stat=XE.stat}dynamic(t,r){return this._walkStream(t,r)}static(t,r){let n=t.map(this._getFullEntryPath,this),o=new zE.PassThrough({objectMode:!0});o._write=(i,s,a)=>this._getEntry(n[i],t[i],r).then(c=>{c!==null&&r.entryFilter(c)&&o.push(c),i===n.length-1&&o.end(),a()}).catch(a);for(let i=0;i<n.length;i++)o.write(i);return o}_getEntry(t,r,n){return this._getStat(t).then(o=>this._makeEntry(o,r)).catch(o=>{if(n.errorFilter(o))return null;throw o})}_getStat(t){return new Promise((r,n)=>{this._stat(t,this._fsStatSettings,(o,i)=>o===null?r(i):n(o))})}};ls.default=cs});var ad=k(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});var ZE=Rn(),ex=On(),tx=us(),ps=class extends ex.default{constructor(){super(...arguments),this._walkAsync=ZE.walk,this._readerStream=new tx.default(this._settings)}dynamic(t,r){return new Promise((n,o)=>{this._walkAsync(t,r,(i,s)=>{i===null?n(s):o(i)})})}async static(t,r){let n=[],o=this._readerStream.static(t,r);return new Promise((i,s)=>{o.once("error",s),o.on("data",a=>n.push(a)),o.once("end",()=>i(n))})}};ds.default=ps});var cd=k(hs=>{"use strict";Object.defineProperty(hs,"__esModule",{value:!0});var Rr=st(),fs=class{constructor(t,r,n){this._patterns=t,this._settings=r,this._micromatchOptions=n,this._storage=[],this._fillStorage()}_fillStorage(){for(let t of this._patterns){let r=this._getPatternSegments(t),n=this._splitSegmentsIntoSections(r);this._storage.push({complete:n.length<=1,pattern:t,segments:r,sections:n})}}_getPatternSegments(t){return Rr.pattern.getPatternParts(t,this._micromatchOptions).map(n=>Rr.pattern.isDynamicPattern(n,this._settings)?{dynamic:!0,pattern:n,patternRe:Rr.pattern.makeRe(n,this._micromatchOptions)}:{dynamic:!1,pattern:n})}_splitSegmentsIntoSections(t){return Rr.array.splitWhen(t,r=>r.dynamic&&Rr.pattern.hasGlobStar(r.pattern))}};hs.default=fs});var ld=k(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});var rx=cd(),ms=class extends rx.default{match(t){let r=t.split("/"),n=r.length,o=this._storage.filter(i=>!i.complete||i.segments.length>n);for(let i of o){let s=i.sections[0];if(!i.complete&&n>s.length||r.every((c,u)=>{let l=i.segments[u];return!!(l.dynamic&&l.patternRe.test(c)||!l.dynamic&&l.pattern===c)}))return!0}return!1}};gs.default=ms});var ud=k(vs=>{"use strict";Object.defineProperty(vs,"__esModule",{value:!0});var Tn=st(),nx=ld(),ys=class{constructor(t,r){this._settings=t,this._micromatchOptions=r}getFilter(t,r,n){let o=this._getMatcher(r),i=this._getNegativePatternsRe(n);return s=>this._filter(t,s,o,i)}_getMatcher(t){return new nx.default(t,this._settings,this._micromatchOptions)}_getNegativePatternsRe(t){let r=t.filter(Tn.pattern.isAffectDepthOfReadingPattern);return Tn.pattern.convertPatternsToRe(r,this._micromatchOptions)}_filter(t,r,n,o){if(this._isSkippedByDeep(t,r.path)||this._isSkippedSymbolicLink(r))return!1;let i=Tn.path.removeLeadingDotSegment(r.path);return this._isSkippedByPositivePatterns(i,n)?!1:this._isSkippedByNegativePatterns(i,o)}_isSkippedByDeep(t,r){return this._settings.deep===1/0?!1:this._getEntryLevel(t,r)>=this._settings.deep}_getEntryLevel(t,r){let n=r.split("/").length;if(t==="")return n;let o=t.split("/").length;return n-o}_isSkippedSymbolicLink(t){return!this._settings.followSymbolicLinks&&t.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(t,r){return!this._settings.baseNameMatch&&!r.match(t)}_isSkippedByNegativePatterns(t,r){return!Tn.pattern.matchAny(t,r)}};vs.default=ys});var pd=k(_s=>{"use strict";Object.defineProperty(_s,"__esModule",{value:!0});var St=st(),bs=class{constructor(t,r){this._settings=t,this._micromatchOptions=r,this.index=new Map}getFilter(t,r){let[n,o]=St.pattern.partitionAbsoluteAndRelative(r),i={positive:{all:St.pattern.convertPatternsToRe(t,this._micromatchOptions)},negative:{absolute:St.pattern.convertPatternsToRe(n,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0})),relative:St.pattern.convertPatternsToRe(o,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}))}};return s=>this._filter(s,i)}_filter(t,r){let n=St.path.removeLeadingDotSegment(t.path);if(this._settings.unique&&this._isDuplicateEntry(n)||this._onlyFileFilter(t)||this._onlyDirectoryFilter(t))return!1;let o=this._isMatchToPatternsSet(n,r,t.dirent.isDirectory());return this._settings.unique&&o&&this._createIndexRecord(n),o}_isDuplicateEntry(t){return this.index.has(t)}_createIndexRecord(t){this.index.set(t,void 0)}_onlyFileFilter(t){return this._settings.onlyFiles&&!t.dirent.isFile()}_onlyDirectoryFilter(t){return this._settings.onlyDirectories&&!t.dirent.isDirectory()}_isMatchToPatternsSet(t,r,n){return!(!this._isMatchToPatterns(t,r.positive.all,n)||this._isMatchToPatterns(t,r.negative.relative,n)||this._isMatchToAbsoluteNegative(t,r.negative.absolute,n))}_isMatchToAbsoluteNegative(t,r,n){if(r.length===0)return!1;let o=St.path.makeAbsolute(this._settings.cwd,t);return this._isMatchToPatterns(o,r,n)}_isMatchToPatterns(t,r,n){if(r.length===0)return!1;let o=St.pattern.matchAny(t,r);return!o&&n?St.pattern.matchAny(t+"/",r):o}};_s.default=bs});var dd=k(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});var ox=st(),Es=class{constructor(t){this._settings=t}getFilter(){return t=>this._isNonFatalError(t)}_isNonFatalError(t){return ox.errno.isEnoentCodeError(t)||this._settings.suppressErrors}};xs.default=Es});var hd=k(ws=>{"use strict";Object.defineProperty(ws,"__esModule",{value:!0});var fd=st(),ks=class{constructor(t){this._settings=t}getTransformer(){return t=>this._transform(t)}_transform(t){let r=t.path;return this._settings.absolute&&(r=fd.path.makeAbsolute(this._settings.cwd,r),r=fd.path.unixify(r)),this._settings.markDirectories&&t.dirent.isDirectory()&&(r+="/"),this._settings.objectMode?Object.assign(Object.assign({},t),{path:r}):r}};ws.default=ks});var Pn=k(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});var ix=M("path"),sx=ud(),ax=pd(),cx=dd(),lx=hd(),Cs=class{constructor(t){this._settings=t,this.errorFilter=new cx.default(this._settings),this.entryFilter=new ax.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new sx.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new lx.default(this._settings)}_getRootDirectory(t){return ix.resolve(this._settings.cwd,t.base)}_getReaderOptions(t){let r=t.base==="."?"":t.base;return{basePath:r,pathSegmentSeparator:"/",concurrency:this._settings.concurrency,deepFilter:this.deepFilter.getFilter(r,t.positive,t.negative),entryFilter:this.entryFilter.getFilter(t.positive,t.negative),errorFilter:this.errorFilter.getFilter(),followSymbolicLinks:this._settings.followSymbolicLinks,fs:this._settings.fs,stats:this._settings.stats,throwErrorOnBrokenSymbolicLink:this._settings.throwErrorOnBrokenSymbolicLink,transform:this.entryTransformer.getTransformer()}}_getMicromatchOptions(){return{dot:this._settings.dot,matchBase:this._settings.baseNameMatch,nobrace:!this._settings.braceExpansion,nocase:!this._settings.caseSensitiveMatch,noext:!this._settings.extglob,noglobstar:!this._settings.globstar,posix:!0,strictSlashes:!1}}};As.default=Cs});var md=k(Rs=>{"use strict";Object.defineProperty(Rs,"__esModule",{value:!0});var ux=ad(),px=Pn(),Ss=class extends px.default{constructor(){super(...arguments),this._reader=new ux.default(this._settings)}async read(t){let r=this._getRootDirectory(t),n=this._getReaderOptions(t);return(await this.api(r,t,n)).map(i=>n.transform(i))}api(t,r,n){return r.dynamic?this._reader.dynamic(t,n):this._reader.static(r.patterns,n)}};Rs.default=Ss});var gd=k(Ts=>{"use strict";Object.defineProperty(Ts,"__esModule",{value:!0});var dx=M("stream"),fx=us(),hx=Pn(),Os=class extends hx.default{constructor(){super(...arguments),this._reader=new fx.default(this._settings)}read(t){let r=this._getRootDirectory(t),n=this._getReaderOptions(t),o=this.api(r,t,n),i=new dx.Readable({objectMode:!0,read:()=>{}});return o.once("error",s=>i.emit("error",s)).on("data",s=>i.emit("data",n.transform(s))).once("end",()=>i.emit("end")),i.once("close",()=>o.destroy()),i}api(t,r,n){return r.dynamic?this._reader.dynamic(t,n):this._reader.static(r.patterns,n)}};Ts.default=Os});var yd=k($s=>{"use strict";Object.defineProperty($s,"__esModule",{value:!0});var mx=Lt(),gx=Rn(),yx=On(),Ps=class extends yx.default{constructor(){super(...arguments),this._walkSync=gx.walkSync,this._statSync=mx.statSync}dynamic(t,r){return this._walkSync(t,r)}static(t,r){let n=[];for(let o of t){let i=this._getFullEntryPath(o),s=this._getEntry(i,o,r);s===null||!r.entryFilter(s)||n.push(s)}return n}_getEntry(t,r,n){try{let o=this._getStat(t);return this._makeEntry(o,r)}catch(o){if(n.errorFilter(o))return null;throw o}}_getStat(t){return this._statSync(t,this._fsStatSettings)}};$s.default=Ps});var vd=k(Ns=>{"use strict";Object.defineProperty(Ns,"__esModule",{value:!0});var vx=yd(),bx=Pn(),Ds=class extends bx.default{constructor(){super(...arguments),this._reader=new vx.default(this._settings)}read(t){let r=this._getRootDirectory(t),n=this._getReaderOptions(t);return this.api(r,t,n).map(n.transform)}api(t,r,n){return r.dynamic?this._reader.dynamic(t,n):this._reader.static(r.patterns,n)}};Ns.default=Ds});var bd=k(tr=>{"use strict";Object.defineProperty(tr,"__esModule",{value:!0});tr.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;var er=M("fs"),_x=M("os"),Ex=Math.max(_x.cpus().length,1);tr.DEFAULT_FILE_SYSTEM_ADAPTER={lstat:er.lstat,lstatSync:er.lstatSync,stat:er.stat,statSync:er.statSync,readdir:er.readdir,readdirSync:er.readdirSync};var Ls=class{constructor(t={}){this._options=t,this.absolute=this._getValue(this._options.absolute,!1),this.baseNameMatch=this._getValue(this._options.baseNameMatch,!1),this.braceExpansion=this._getValue(this._options.braceExpansion,!0),this.caseSensitiveMatch=this._getValue(this._options.caseSensitiveMatch,!0),this.concurrency=this._getValue(this._options.concurrency,Ex),this.cwd=this._getValue(this._options.cwd,process.cwd()),this.deep=this._getValue(this._options.deep,1/0),this.dot=this._getValue(this._options.dot,!1),this.extglob=this._getValue(this._options.extglob,!0),this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!0),this.fs=this._getFileSystemMethods(this._options.fs),this.globstar=this._getValue(this._options.globstar,!0),this.ignore=this._getValue(this._options.ignore,[]),this.markDirectories=this._getValue(this._options.markDirectories,!1),this.objectMode=this._getValue(this._options.objectMode,!1),this.onlyDirectories=this._getValue(this._options.onlyDirectories,!1),this.onlyFiles=this._getValue(this._options.onlyFiles,!0),this.stats=this._getValue(this._options.stats,!1),this.suppressErrors=this._getValue(this._options.suppressErrors,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!1),this.unique=this._getValue(this._options.unique,!0),this.onlyDirectories&&(this.onlyFiles=!1),this.stats&&(this.objectMode=!0),this.ignore=[].concat(this.ignore)}_getValue(t,r){return t===void 0?r:t}_getFileSystemMethods(t={}){return Object.assign(Object.assign({},tr.DEFAULT_FILE_SYSTEM_ADAPTER),t)}};tr.default=Ls});var $n=k((d0,Ed)=>{"use strict";var _d=Ep(),xx=md(),kx=gd(),wx=vd(),Is=bd(),Ne=st();async function Fs(e,t){He(e);let r=js(e,xx.default,t),n=await Promise.all(r);return Ne.array.flatten(n)}(function(e){e.glob=e,e.globSync=t,e.globStream=r,e.async=e;function t(u,l){He(u);let p=js(u,wx.default,l);return Ne.array.flatten(p)}e.sync=t;function r(u,l){He(u);let p=js(u,kx.default,l);return Ne.stream.merge(p)}e.stream=r;function n(u,l){He(u);let p=[].concat(u),d=new Is.default(l);return _d.generate(p,d)}e.generateTasks=n;function o(u,l){He(u);let p=new Is.default(l);return Ne.pattern.isDynamicPattern(u,p)}e.isDynamicPattern=o;function i(u){return He(u),Ne.path.escape(u)}e.escapePath=i;function s(u){return He(u),Ne.path.convertPathToPattern(u)}e.convertPathToPattern=s;let a;(function(u){function l(d){return He(d),Ne.path.escapePosixPath(d)}u.escapePath=l;function p(d){return He(d),Ne.path.convertPosixPathToPattern(d)}u.convertPathToPattern=p})(a=e.posix||(e.posix={}));let c;(function(u){function l(d){return He(d),Ne.path.escapeWindowsPath(d)}u.escapePath=l;function p(d){return He(d),Ne.path.convertWindowsPathToPattern(d)}u.convertPathToPattern=p})(c=e.win32||(e.win32={}))})(Fs||(Fs={}));function js(e,t,r){let n=[].concat(e),o=new Is.default(r),i=_d.generate(n,o),s=new t(o);return i.map(s.read,s)}function He(e){if(![].concat(e).every(n=>Ne.string.isString(n)&&!Ne.string.isEmpty(n)))throw new TypeError("Patterns must be a string (non empty) or an array of strings")}Ed.exports=Fs});var xd=yt(()=>{});import{promisify as Cx}from"node:util";import{execFile as Ax,execFileSync as g0}from"node:child_process";import{fileURLToPath as Sx}from"node:url";function Or(e){return e instanceof URL?Sx(e):e}var v0,b0,Ms=yt(()=>{xd();v0=Cx(Ax);b0=10*1024*1024});var Pd=k((x0,Ln)=>{function Cd(e){return Array.isArray(e)?e:[e]}var Rx=void 0,Hs="",kd=" ",Bs="\\",Ox=/^\s+$/,Tx=/(?:[^\\]|^)\\$/,Px=/^\\!/,$x=/^\\#/,Dx=/\r?\n/g,Nx=/^\.{0,2}\/|^\.{1,2}$/,Lx=/\/$/,rr="/",Ad="node-ignore";typeof Symbol<"u"&&(Ad=Symbol.for("node-ignore"));var Sd=Ad,nr=(e,t,r)=>(Object.defineProperty(e,t,{value:r}),r),Ix=/([0-z])-([0-z])/g,Rd=()=>!1,Fx=e=>e.replace(Ix,(t,r,n)=>r.charCodeAt(0)<=n.charCodeAt(0)?t:Hs),jx=e=>{let{length:t}=e;return e.slice(0,t-t%2)},Mx=[[/^\uFEFF/,()=>Hs],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,r)=>t+(r.indexOf("\\")===0?kd:Hs)],[/(\\+?)\s/g,(e,t)=>{let{length:r}=t;return t.slice(0,r-r%2)+kd}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>"[^/]"],[/^\//,()=>"^"],[/\//g,()=>"\\/"],[/^\^*\\\*\\\*\\\//,()=>"^(?:.*\\/)?"],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?"^":"(?:^|\\/)"}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,r)=>t+6<r.length?"(?:\\/[^\\/]+)*":"\\/.+"],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,r)=>{let n=r.replace(/\\\*/g,"[^\\/]*");return t+n}],[/\\\\\\(?=[$.|*+(){^])/g,()=>Bs],[/\\\\/g,()=>Bs],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,r,n,o)=>t===Bs?`\\[${r}${jx(n)}${o}`:o==="]"&&n.length%2===0?`[${Fx(r)}${n}]`:"[]"],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`]],Bx=/(^|\\\/)?\\\*$/,Tr="regex",Dn="checkRegex",wd="_",Hx={[Tr](e,t){return`${t?`${t}[^/]+`:"[^/]*"}(?=$|\\/$)`},[Dn](e,t){return`${t?`${t}[^/]*`:"[^/]*"}(?=$|\\/$)`}},Gx=e=>Mx.reduce((t,[r,n])=>t.replace(r,n.bind(e)),e),Nn=e=>typeof e=="string",Vx=e=>e&&Nn(e)&&!Ox.test(e)&&!Tx.test(e)&&e.indexOf("#")!==0,Wx=e=>e.split(Dx).filter(Boolean),Gs=class{constructor(t,r,n,o,i,s){this.pattern=t,this.mark=r,this.negative=i,nr(this,"body",n),nr(this,"ignoreCase",o),nr(this,"regexPrefix",s)}get regex(){let t=wd+Tr;return this[t]?this[t]:this._make(Tr,t)}get checkRegex(){let t=wd+Dn;return this[t]?this[t]:this._make(Dn,t)}_make(t,r){let n=this.regexPrefix.replace(Bx,Hx[t]),o=this.ignoreCase?new RegExp(n,"i"):new RegExp(n);return nr(this,r,o)}},Ux=({pattern:e,mark:t},r)=>{let n=!1,o=e;o.indexOf("!")===0&&(n=!0,o=o.substr(1)),o=o.replace(Px,"!").replace($x,"#");let i=Gx(o);return new Gs(e,t,o,r,n,i)},Vs=class{constructor(t){this._ignoreCase=t,this._rules=[]}_add(t){if(t&&t[Sd]){this._rules=this._rules.concat(t._rules._rules),this._added=!0;return}if(Nn(t)&&(t={pattern:t}),Vx(t.pattern)){let r=Ux(t,this._ignoreCase);this._added=!0,this._rules.push(r)}}add(t){return this._added=!1,Cd(Nn(t)?Wx(t):t).forEach(this._add,this),this._added}test(t,r,n){let o=!1,i=!1,s;this._rules.forEach(c=>{let{negative:u}=c;i===u&&o!==i||u&&!o&&!i&&!r||!c[n].test(t)||(o=!u,i=u,s=u?Rx:c)});let a={ignored:o,unignored:i};return s&&(a.rule=s),a}},qx=(e,t)=>{throw new t(e)},at=(e,t,r)=>Nn(e)?e?at.isNotRelative(e)?r(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):!0:r("path must not be empty",TypeError):r(`path must be a string, but got \`${t}\``,TypeError),Od=e=>Nx.test(e);at.isNotRelative=Od;at.convert=e=>e;var Ws=class{constructor({ignorecase:t=!0,ignoreCase:r=t,allowRelativePaths:n=!1}={}){nr(this,Sd,!0),this._rules=new Vs(r),this._strictPathCheck=!n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}add(t){return this._rules.add(t)&&this._initCache(),this}addPattern(t){return this.add(t)}_test(t,r,n,o){let i=t&&at.convert(t);return at(i,t,this._strictPathCheck?qx:Rd),this._t(i,r,n,o)}checkIgnore(t){if(!Lx.test(t))return this.test(t);let r=t.split(rr).filter(Boolean);if(r.pop(),r.length){let n=this._t(r.join(rr)+rr,this._testCache,!0,r);if(n.ignored)return n}return this._rules.test(t,!1,Dn)}_t(t,r,n,o){if(t in r)return r[t];if(o||(o=t.split(rr).filter(Boolean)),o.pop(),!o.length)return r[t]=this._rules.test(t,n,Tr);let i=this._t(o.join(rr)+rr,r,n,o);return r[t]=i.ignored?i:this._rules.test(t,n,Tr)}ignores(t){return this._test(t,this._ignoreCache,!1).ignored}createFilter(){return t=>!this.ignores(t)}filter(t){return Cd(t).filter(this.createFilter())}test(t){return this._test(t,this._testCache,!0)}},Us=e=>new Ws(e),Yx=e=>at(e&&at.convert(e),e,Rd),Td=()=>{let e=r=>/^\\\\\?\\/.test(r)||/["<>|\u0000-\u001F]+/u.test(r)?r:r.replace(/\\/g,"/");at.convert=e;let t=/^[a-z]:\//i;at.isNotRelative=r=>t.test(r)||Od(r)};typeof process<"u"&&process.platform==="win32"&&Td();Ln.exports=Us;Us.default=Us;Ln.exports.isPathValid=Yx;nr(Ln.exports,Symbol.for("setupWindows"),Td)});import qs from"node:path";function Pr(e,t){let r=qs.relative(t,e);return!!(r&&r!==".."&&!r.startsWith(`..${qs.sep}`)&&r!==qs.resolve(e))}var Ys=yt(()=>{});function In(e){return e.startsWith("\\\\?\\")?e:e.replace(/\\/g,"/")}var $d=yt(()=>{});import Dd from"node:fs";import Oe from"node:path";import{promisify as Kx}from"node:util";var Ks,Ge,zx,Xx,zs,Nd,Ae,Fn,Xs,Jx,jn,Qx,Zx,Ld,Js,ek,tk,Qs,rk,Id,nk,Fd,Zs,ea=yt(()=>{Ks=Bt($n(),1);Ys();Ge=e=>e[0]==="!",zx=e=>{if(!e.startsWith("/"))return e;let t=e.slice(1),r=t.indexOf("/"),n=r>0?t.slice(0,r):t;return r>0&&!Ks.default.isDynamicPattern(n)?e:t},Xx=(e,t)=>t===e,zs=e=>{if(!Oe.isAbsolute(e))return;let t=[];for(let r of e.split("/"))if(r){if(Ks.default.isDynamicPattern(r))break;t.push(r)}return t.length===0?void 0:`/${t.join("/")}`},Nd=(e,t=[],r=!1)=>{if(!e.startsWith("/"))return e;let n=zx(e);if(n!==e)return n;if(r)return e.slice(1);let o=zs(e);return o!==void 0&&t.some(s=>Xx(s,o))?e:e.slice(1)},Ae=(e,t)=>{let r=e?.[t];return typeof r=="function"?r.bind(e):void 0},Fn=(e,t)=>{let r=e?.[t];if(typeof r=="function")return Kx(r.bind(e))},Xs=e=>{if(!e.endsWith("/"))return e;let t=e.replace(/\/+$/u,"");if(!t)return"/**";if(t==="**")return"**/**";let r=t.startsWith("/"),o=(r?t.slice(1):t).includes("/");return`${!r&&!o&&!t.startsWith("**/")?"**/":""}${t}/**`},Jx=e=>{let r=(Ge(e)?e.slice(1):e).match(/^(\.\.\/)+/);return r?r[0]:""},jn=(e,t)=>{if(e.length===0||t.length===0)return t;let r=e.map(i=>Jx(i)),n=r[0];return!n||!r.every(i=>i===n)?t:t.map(i=>i.startsWith("**/")&&!i.startsWith("../")?n+i:i)},Qx=e=>Ae(e?.promises,"stat")??Ae(Dd.promises,"stat"),Zx=e=>Ae(e||Dd,"statSync"),Ld=e=>!!(e?.isDirectory?.()||e?.isFile?.()),Js=(e,t)=>{let r=[],n=e;for(r.push(n);n!==t;){let o=Oe.dirname(n);if(o===n)break;n=o,r.push(n)}return r},ek=async(e,t)=>{for(let r of e){let n=Oe.join(r,".git");try{let o=await t(n);if(Ld(o))return r}catch{}}},tk=(e,t)=>{let r=Zx(t);if(!r)return;let n=Oe.resolve(e),{root:o}=Oe.parse(n),i=Js(n,o);for(let s of i){let a=Oe.join(s,".git");try{let c=r(a);if(Ld(c))return s}catch{}}},Qs=(e,t)=>{if(typeof e!="string")throw new TypeError("cwd must be a string");return tk(e,t)},rk=async(e,t)=>{let r=Qx(t);if(!r)return Qs(e,t);let n=Oe.resolve(e),{root:o}=Oe.parse(n),i=Js(n,o);return ek(i,r)},Id=async(e,t)=>{if(typeof e!="string")throw new TypeError("cwd must be a string");return rk(e,t)},nk=(e,t)=>{let r=Oe.resolve(e),n=Oe.resolve(t);return n===r||Pr(n,r)},Fd=(e,t)=>{if(e&&typeof e!="string")throw new TypeError("gitRoot must be a string or undefined");if(typeof t!="string")throw new TypeError("cwd must be a string");return e?nk(e,t)?[...Js(Oe.resolve(t),Oe.resolve(e))].reverse().map(n=>Oe.join(n,".gitignore")):[]:[]},Zs=(e,t,r)=>{if(t)return[];let n=[],o=!1;for(let i of e){if(Ge(i)){o=!0;break}n.push(r(i))}return o?[]:n}});import ok from"node:process";import ik from"node:fs";import sk from"node:fs/promises";import Te from"node:path";var ta,jd,ak,ck,Mn,lk,uk,Md,Bd,pk,dk,fk,hk,Hd,mk,Gd,Bn,gk,yk,vk,bk,Vd,Wd,Ud,ra,na,_k,qd,Yd,Kd,zd,oa=yt(()=>{ta=Bt($n(),1),jd=Bt(Pd(),1);Ys();$d();Ms();ea();ak=["**/node_modules","**/flow-typed","**/coverage","**/.git"],ck={absolute:!0,dot:!0},Mn="**/.gitignore",lk=e=>Ae(e?.promises,"readFile")??Ae(sk,"readFile")??Fn(e,"readFile"),uk=e=>Ae(e,"readFileSync")??Ae(ik,"readFileSync"),Md=(e,t)=>e&&(e.code==="ENOENT"||e.code==="ENOTDIR")?!0:!!t,Bd=(e,t)=>t instanceof Error?(t.message=`Failed to read ignore file at ${e}: ${t.message}`,t):new Error(`Failed to read ignore file at ${e}: ${String(t)}`),pk=(e,t,r)=>{try{let n=t(e,"utf8");return{filePath:e,content:n}}catch(n){if(Md(n,r))return;throw Bd(e,n)}},dk=async(e,t,r)=>(await Promise.all(e.map(async o=>{try{let i=await t(o,"utf8");return{filePath:o,content:i}}catch(i){if(Md(i,r))return;throw Bd(o,i)}}))).filter(Boolean),fk=(e,t,r)=>e.map(n=>pk(n,t,r)).filter(Boolean),hk=e=>{let t=new Set;return e.filter(r=>t.has(r)?!1:(t.add(r),!0))},Hd=(e,t,r)=>e(t,{...r,...ck}),mk=(e,t)=>e?Fd(e,t.cwd):[],Gd=(e,t,r)=>hk([...mk(e,t),...r]),Bn=(e,t,r)=>{let n=r||t.cwd,o=_k(e,n);return{patterns:o,predicate:bk(o,t.cwd,n),usingGitRoot:!!(r&&r!==t.cwd)}},gk=(e,t)=>{if(!t)return e;let r=Ge(e),n=r?e.slice(1):e,o=n.indexOf("/"),i=o!==-1&&o!==n.length-1,s;return i?n.startsWith("/")?s=Te.posix.join(t,n.slice(1)):s=Te.posix.join(t,n):s=Te.posix.join(t,"**",n),r?"!"+s:s},yk=(e,t)=>{let r=In(Te.relative(t,Te.dirname(e.filePath)));return e.content.split(/\r?\n/).filter(n=>n&&!n.startsWith("#")).map(n=>gk(n,r))},vk=(e,t)=>{if(Te.isAbsolute(e)){let r=Te.relative(t,e);return r&&!Pr(e,t)?void 0:r}if(e.startsWith("./"))return e.slice(2);if(!e.startsWith("../"))return e},bk=(e,t,r)=>{let n=(0,jd.default)().add(e),o=Te.normalize(Te.resolve(t)),i=Te.normalize(Te.resolve(r));return s=>{if(s=Or(s),Te.normalize(Te.resolve(s))===o)return!1;let c=vk(s,i);return c===void 0?!1:c?n.ignores(In(c)):!1}},Vd=(e={})=>{let t=e.ignore?Array.isArray(e.ignore)?e.ignore:[e.ignore]:[],r=Or(e.cwd)??ok.cwd(),n=typeof e.deep=="number"?Math.max(0,e.deep)+1:Number.POSITIVE_INFINITY;return{cwd:r,suppressErrors:e.suppressErrors??!1,deep:n,ignore:[...t,...ak],followSymbolicLinks:e.followSymbolicLinks??!0,concurrency:e.concurrency,throwErrorOnBrokenSymbolicLink:e.throwErrorOnBrokenSymbolicLink??!1,fs:e.fs}},Wd=async(e,t,r)=>{let n=Vd(t),o=await Hd(ta.default,e,n),i=r?await Id(n.cwd,n.fs):void 0,s=Gd(i,n,o),a=lk(n.fs);return{files:await dk(s,a,n.suppressErrors),normalizedOptions:n,gitRoot:i}},Ud=(e,t,r)=>{let n=Vd(t),o=Hd(ta.default.sync,e,n),i=r?Qs(n.cwd,n.fs):void 0,s=Gd(i,n,o),a=uk(n.fs);return{files:fk(s,a,n.suppressErrors),normalizedOptions:n,gitRoot:i}},ra=async(e,t)=>{let{files:r,normalizedOptions:n,gitRoot:o}=await Wd(e,t,!1);return Bn(r,n,o).predicate},na=(e,t)=>{let{files:r,normalizedOptions:n,gitRoot:o}=Ud(e,t,!1);return Bn(r,n,o).predicate},_k=(e,t)=>e.flatMap(r=>yk(r,t)),qd=async(e,t,r=!1)=>{let{files:n,normalizedOptions:o,gitRoot:i}=await Wd(e,t,r);return Bn(n,o,i)},Yd=(e,t,r=!1)=>{let{files:n,normalizedOptions:o,gitRoot:i}=Ud(e,t,r);return Bn(n,o,i)},Kd=e=>ra(Mn,e),zd=e=>na(Mn,e)});var uf={};Fh(uf,{convertPathToPattern:()=>Nk,generateGlobTasks:()=>$k,generateGlobTasksSync:()=>Dk,globby:()=>la,globbyStream:()=>Tk,globbySync:()=>Ok,isDynamicPattern:()=>Pk,isGitIgnored:()=>Kd,isGitIgnoredSync:()=>zd,isIgnoredByIgnoreFiles:()=>ra,isIgnoredByIgnoreFilesSync:()=>na});import ia from"node:process";import sa from"node:fs";import ct from"node:path";import{Readable as Ek}from"node:stream";var or,xk,kk,wk,Ck,Ak,Qd,Zd,Hn,Xd,Jd,aa,Sk,ef,tf,Vn,rf,Rk,nf,Gn,of,sf,af,cf,lf,ca,la,Ok,Tk,Pk,$k,Dk,Nk,ua=yt(()=>{Tl();or=Bt($n(),1);Ms();oa();ea();oa();xk=e=>{if(e.some(t=>typeof t!="string"))throw new TypeError("Patterns must be a string or an array of strings")},kk=e=>Ae(e?.promises,"stat")??Ae(sa.promises,"stat")??Fn(e,"stat"),wk=e=>Ae(e,"statSync")??Ae(sa,"statSync"),Ck=async(e,t)=>{try{return(await kk(t)(e)).isDirectory()}catch{return!1}},Ak=(e,t)=>{try{return wk(t)(e).isDirectory()}catch{return!1}},Qd=(e,t)=>{let r=Ge(e)?e.slice(1):e;return ct.isAbsolute(r)?r:ct.join(t,r)},Zd=e=>{let t=e?.match(/\*\*\/([^/]+)$/);if(!t)return!1;let r=t[1],n=/[*?[\]{}]/.test(r),o=ct.extname(r)&&!r.startsWith(".");return!n&&!o},Hn=({directoryPath:e,files:t,extensions:r})=>{let n=r?.length>0?`.${r.length>1?`{${r.join(",")}}`:r[0]}`:"";return t?t.map(o=>ct.posix.join(e,`**/${ct.extname(o)?o:`${o}${n}`}`)):[ct.posix.join(e,`**${n?`/*${n}`:""}`)]},Xd=async(e,{cwd:t=ia.cwd(),files:r,extensions:n,fs:o}={})=>(await Promise.all(e.map(async s=>{let a=Ge(s)?s.slice(1):s;if(Zd(a))return Hn({directoryPath:s,files:r,extensions:n});let c=Qd(s,t);return await Ck(c,o)?Hn({directoryPath:s,files:r,extensions:n}):s}))).flat(),Jd=(e,{cwd:t=ia.cwd(),files:r,extensions:n,fs:o}={})=>e.flatMap(i=>{let s=Ge(i)?i.slice(1):i;if(Zd(s))return Hn({directoryPath:i,files:r,extensions:n});let a=Qd(i,t);return Ak(a,o)?Hn({directoryPath:i,files:r,extensions:n}):i}),aa=e=>(e=[...new Set([e].flat())],xk(e),e),Sk=(e,t=sa)=>{if(!e||!t.statSync)return;let r;try{r=t.statSync(e)}catch{return}if(!r.isDirectory())throw new Error(`The \`cwd\` option must be a path to a directory, got: ${e}`)},ef=(e={})=>{let t=e.ignore?Array.isArray(e.ignore)?e.ignore:[e.ignore]:[];return e={...e,ignore:t,expandDirectories:e.expandDirectories??!0,cwd:Or(e.cwd)},Sk(e.cwd,e.fs),e},tf=e=>async(t,r)=>e(aa(t),ef(r)),Vn=e=>(t,r)=>e(aa(t),ef(r)),rf=e=>{let{ignoreFiles:t,gitignore:r}=e,n=t?aa(t):[];return r&&n.push(Mn),n},Rk=async e=>{let t=rf(e);if(t.length===0)return{options:e,filter:Gn(!1,e.cwd)};let r=e.gitignore===!0,{patterns:n,predicate:o,usingGitRoot:i}=await qd(t,e,r),s=Zs(n,i,Xs);return{options:{...e,ignore:[...e.ignore,...s]},filter:Gn(o,e.cwd)}},nf=e=>{let t=rf(e);if(t.length===0)return{options:e,filter:Gn(!1,e.cwd)};let r=e.gitignore===!0,{patterns:n,predicate:o,usingGitRoot:i}=Yd(t,e,r),s=Zs(n,i,Xs);return{options:{...e,ignore:[...e.ignore,...s]},filter:Gn(o,e.cwd)}},Gn=(e,t)=>{let r=new Set,n=t||ia.cwd(),o=new Map;return i=>{let s=ct.normalize(i.path??i);if(r.has(s))return!1;if(e){let a=o.get(s);if(a===void 0&&(a=ct.isAbsolute(s)?s:ct.resolve(n,s),o.set(s,a),o.size>1e4&&o.clear()),e(a))return!1}return r.add(s),!0}},of=(e,t)=>e.flat().filter(r=>t(r)),sf=(e,t)=>{if(e.length>0&&e.every(s=>Ge(s))){if(t.expandNegationOnlyPatterns===!1)return[];e=["**/*",...e]}let r=[],n=!1,o=[];for(let s of e){if(Ge(s)){o.push(`!${Nd(s.slice(1),r,n)}`);continue}o.push(s);let a=zs(s);if(a===void 0){n=!0;continue}r.push(a)}e=o;let i=[];for(;e.length>0;){let s=e.findIndex(c=>Ge(c));if(s===-1){i.push({patterns:e,options:t});break}let a=e[s].slice(1);for(let c of i)c.options.ignore.push(a);s!==0&&i.push({patterns:e.slice(0,s),options:{...t,ignore:[...t.ignore,a]}}),e=e.slice(s+1)}return i},af=e=>e.map(t=>({patterns:t.patterns,options:{...t.options,ignore:jn(t.patterns,t.options.ignore)}})),cf=(e,t)=>({...t?{cwd:t}:{},...Array.isArray(e)?{files:e}:e}),lf=async(e,t)=>{let r=sf(e,t),{cwd:n,expandDirectories:o,fs:i}=t;if(!o)return af(r);let s={...cf(o,n),fs:i};return Promise.all(r.map(async a=>{let{patterns:c,options:u}=a;return[c,u.ignore]=await Promise.all([Xd(c,s),Xd(u.ignore,{cwd:n,fs:i})]),u.ignore=jn(c,u.ignore),{patterns:c,options:u}}))},ca=(e,t)=>{let r=sf(e,t),{cwd:n,expandDirectories:o,fs:i}=t;if(!o)return af(r);let s={...cf(o,n),fs:i};return r.map(a=>{let{patterns:c,options:u}=a;return c=Jd(c,s),u.ignore=Jd(u.ignore,{cwd:n,fs:i}),u.ignore=jn(c,u.ignore),{patterns:c,options:u}})},la=tf(async(e,t)=>{let{options:r,filter:n}=await Rk(t),o=await lf(e,r),i=await Promise.all(o.map(s=>(0,or.default)(s.patterns,s.options)));return of(i,n)}),Ok=Vn((e,t)=>{let{options:r,filter:n}=nf(t),i=ca(e,r).map(s=>or.default.sync(s.patterns,s.options));return of(i,n)}),Tk=Vn((e,t)=>{let{options:r,filter:n}=nf(t),i=ca(e,r).map(a=>or.default.stream(a.patterns,a.options));return i.length===0?Ek.from([]):Zo(i).filter(a=>n(a))}),Pk=Vn((e,t)=>e.some(r=>or.default.isDynamicPattern(r,t))),$k=tf(lf),Dk=Vn(ca),{convertPathToPattern:Nk}=or.default});var Ye=["frontend","backend"],po=["workbench.frontend","workbench.backend"],Gr=[...Ye,...po];var Ma=(e=0)=>t=>`\x1B[${t+e}m`,Ba=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,Ha=(e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`,ee={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},FC=Object.keys(ee.modifier),Mh=Object.keys(ee.color),Bh=Object.keys(ee.bgColor),jC=[...Mh,...Bh];function Hh(){let e=new Map;for(let[t,r]of Object.entries(ee)){for(let[n,o]of Object.entries(r))ee[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},r[n]=ee[n],e.set(o[0],o[1]);Object.defineProperty(ee,t,{value:r,enumerable:!1})}return Object.defineProperty(ee,"codes",{value:e,enumerable:!1}),ee.color.close="\x1B[39m",ee.bgColor.close="\x1B[49m",ee.color.ansi=Ma(),ee.color.ansi256=Ba(),ee.color.ansi16m=Ha(),ee.bgColor.ansi=Ma(10),ee.bgColor.ansi256=Ba(10),ee.bgColor.ansi16m=Ha(10),Object.defineProperties(ee,{rgbToAnsi256:{value(t,r,n){return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(i=>i+i).join(""));let o=Number.parseInt(n,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:t=>ee.rgbToAnsi256(...ee.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,n,o;if(t>=232)r=((t-232)*10+8)/255,n=r,o=r;else{t-=16;let a=t%36;r=Math.floor(t/36)/5,n=Math.floor(a/6)/5,o=a%6/5}let i=Math.max(r,n,o)*2;if(i===0)return 30;let s=30+(Math.round(o)<<2|Math.round(n)<<1|Math.round(r));return i===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(t,r,n)=>ee.ansi256ToAnsi(ee.rgbToAnsi256(t,r,n)),enumerable:!1},hexToAnsi:{value:t=>ee.ansi256ToAnsi(ee.hexToAnsi256(t)),enumerable:!1}}),ee}var Gh=Hh(),Me=Gh;import fo from"node:process";import Vh from"node:os";import Ga from"node:tty";function Pe(e,t=globalThis.Deno?globalThis.Deno.args:fo.argv){let r=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(r+e),o=t.indexOf("--");return n!==-1&&(o===-1||n<o)}var{env:te}=fo,Vr;Pe("no-color")||Pe("no-colors")||Pe("color=false")||Pe("color=never")?Vr=0:(Pe("color")||Pe("colors")||Pe("color=true")||Pe("color=always"))&&(Vr=1);function Wh(){if("FORCE_COLOR"in te)return te.FORCE_COLOR==="true"?1:te.FORCE_COLOR==="false"?0:te.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(te.FORCE_COLOR,10),3)}function Uh(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function qh(e,{streamIsTTY:t,sniffFlags:r=!0}={}){let n=Wh();n!==void 0&&(Vr=n);let o=r?Vr:n;if(o===0)return 0;if(r){if(Pe("color=16m")||Pe("color=full")||Pe("color=truecolor"))return 3;if(Pe("color=256"))return 2}if("TF_BUILD"in te&&"AGENT_NAME"in te)return 1;if(e&&!t&&o===void 0)return 0;let i=o||0;if(te.TERM==="dumb")return i;if(fo.platform==="win32"){let s=Vh.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in te)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(s=>s in te)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(s=>s in te)||te.CI_NAME==="codeship"?1:i;if("TEAMCITY_VERSION"in te)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(te.TEAMCITY_VERSION)?1:0;if(te.COLORTERM==="truecolor"||te.TERM==="xterm-kitty"||te.TERM==="xterm-ghostty"||te.TERM==="wezterm")return 3;if("TERM_PROGRAM"in te){let s=Number.parseInt((te.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(te.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(te.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(te.TERM)||"COLORTERM"in te?1:i}function Va(e,t={}){let r=qh(e,{streamIsTTY:e&&e.isTTY,...t});return Uh(r)}var Yh={stdout:Va({isTTY:Ga.isatty(1)}),stderr:Va({isTTY:Ga.isatty(2)})},Wa=Yh;function Ua(e,t,r){let n=e.indexOf(t);if(n===-1)return e;let o=t.length,i=0,s="";do s+=e.slice(i,n)+t+r,i=n+o,n=e.indexOf(t,i);while(n!==-1);return s+=e.slice(i),s}function qa(e,t,r,n){let o=0,i="";do{let s=e[n-1]==="\r";i+=e.slice(o,s?n-1:n)+t+(s?`\r
|
|
32
|
+
`:`
|
|
33
|
+
`)+r,o=n+1,n=e.indexOf(`
|
|
34
|
+
`,o)}while(n!==-1);return i+=e.slice(o),i}var{stdout:Ya,stderr:Ka}=Wa,ho=Symbol("GENERATOR"),Ht=Symbol("STYLER"),fr=Symbol("IS_EMPTY"),za=["ansi","ansi","ansi256","ansi16m"],Gt=Object.create(null),Kh=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let r=Ya?Ya.level:0;e.level=t.level===void 0?r:t.level};var zh=e=>{let t=(...r)=>r.join(" ");return Kh(t,e),Object.setPrototypeOf(t,hr.prototype),t};function hr(e){return zh(e)}Object.setPrototypeOf(hr.prototype,Function.prototype);for(let[e,t]of Object.entries(Me))Gt[e]={get(){let r=Wr(this,go(t.open,t.close,this[Ht]),this[fr]);return Object.defineProperty(this,e,{value:r}),r}};Gt.visible={get(){let e=Wr(this,this[Ht],!0);return Object.defineProperty(this,"visible",{value:e}),e}};var mo=(e,t,r,...n)=>e==="rgb"?t==="ansi16m"?Me[r].ansi16m(...n):t==="ansi256"?Me[r].ansi256(Me.rgbToAnsi256(...n)):Me[r].ansi(Me.rgbToAnsi(...n)):e==="hex"?mo("rgb",t,r,...Me.hexToRgb(...n)):Me[r][e](...n),Xh=["rgb","hex","ansi256"];for(let e of Xh){Gt[e]={get(){let{level:r}=this;return function(...n){let o=go(mo(e,za[r],"color",...n),Me.color.close,this[Ht]);return Wr(this,o,this[fr])}}};let t="bg"+e[0].toUpperCase()+e.slice(1);Gt[t]={get(){let{level:r}=this;return function(...n){let o=go(mo(e,za[r],"bgColor",...n),Me.bgColor.close,this[Ht]);return Wr(this,o,this[fr])}}}}var Jh=Object.defineProperties(()=>{},{...Gt,level:{enumerable:!0,get(){return this[ho].level},set(e){this[ho].level=e}}}),go=(e,t,r)=>{let n,o;return r===void 0?(n=e,o=t):(n=r.openAll+e,o=t+r.closeAll),{open:e,close:t,openAll:n,closeAll:o,parent:r}},Wr=(e,t,r)=>{let n=(...o)=>Qh(n,o.length===1?""+o[0]:o.join(" "));return Object.setPrototypeOf(n,Jh),n[ho]=e,n[Ht]=t,n[fr]=r,n},Qh=(e,t)=>{if(e.level<=0||!t)return e[fr]?"":t;let r=e[Ht];if(r===void 0)return t;let{openAll:n,closeAll:o}=r;if(t.includes("\x1B"))for(;r!==void 0;)t=Ua(t,r.close,r.open),r=r.parent;let i=t.indexOf(`
|
|
35
|
+
`);return i!==-1&&(t=qa(t,o,n,i)),n+t+o};Object.defineProperties(hr.prototype,Gt);var Zh=hr(),KC=hr({level:Ka?Ka.level:0});var h=Zh;var cc=Bt(ac(),1),{program:nA,createCommand:oA,createArgument:iA,createOption:sA,CommanderError:aA,InvalidArgumentError:cA,InvalidOptionArgumentError:lA,Command:lc,Argument:uA,Option:pA,Help:dA}=cc.default;function W(e){return e!=null&&typeof e=="object"&&e["@@functional/placeholder"]===!0}function Ke(e){return function t(r){return arguments.length===0||W(r)?t:e.apply(this,arguments)}}function ze(e){return function t(r,n){switch(arguments.length){case 0:return t;case 1:return W(r)?t:Ke(function(o){return e(r,o)});default:return W(r)&&W(n)?t:W(r)?Ke(function(o){return e(o,n)}):W(n)?Ke(function(o){return e(r,o)}):e(r,n)}}}function gr(e){return function t(r,n,o){switch(arguments.length){case 0:return t;case 1:return W(r)?t:ze(function(i,s){return e(r,i,s)});case 2:return W(r)&&W(n)?t:W(r)?ze(function(i,s){return e(i,n,s)}):W(n)?ze(function(i,s){return e(r,i,s)}):Ke(function(i){return e(r,n,i)});default:return W(r)&&W(n)&&W(o)?t:W(r)&&W(n)?ze(function(i,s){return e(i,s,o)}):W(r)&&W(o)?ze(function(i,s){return e(i,n,s)}):W(n)&&W(o)?ze(function(i,s){return e(r,i,s)}):W(r)?Ke(function(i){return e(i,n,o)}):W(n)?Ke(function(i){return e(r,i,o)}):W(o)?Ke(function(i){return e(r,n,i)}):e(r,n,o)}}}function Vt(e,t){return Object.prototype.hasOwnProperty.call(t,e)}function Kr(e){return Object.prototype.toString.call(e)==="[object Object]"}var mm=gr(function(t,r,n){var o={},i;r=r||{},n=n||{};for(i in r)Vt(i,r)&&(o[i]=Vt(i,n)?t(i,r[i],n[i]):r[i]);for(i in n)Vt(i,n)&&!Vt(i,o)&&(o[i]=n[i]);return o}),uc=mm;var gm=gr(function e(t,r,n){return uc(function(o,i,s){return Kr(i)&&Kr(s)?e(t,i,s):t(o,i,s)},r,n)}),pc=gm;var ym=ze(function(t,r){return pc(function(n,o,i){return i},t,r)}),vt=ym;import Tt from"fs-extra";import dr from"path";function Sc(e){return typeof e>"u"||e===null}function vm(e){return typeof e=="object"&&e!==null}function bm(e){return Array.isArray(e)?e:Sc(e)?[]:[e]}function _m(e,t){var r,n,o,i;if(t)for(i=Object.keys(t),r=0,n=i.length;r<n;r+=1)o=i[r],e[o]=t[o];return e}function Em(e,t){var r="",n;for(n=0;n<t;n+=1)r+=e;return r}function xm(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var km=Sc,wm=vm,Cm=bm,Am=Em,Sm=xm,Rm=_m,le={isNothing:km,isObject:wm,toArray:Cm,repeat:Am,isNegativeZero:Sm,extend:Rm};function Rc(e,t){var r="",n=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(r+='in "'+e.mark.name+'" '),r+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(r+=`
|
|
36
|
+
|
|
37
|
+
`+e.mark.snippet),n+" "+r):n}function vr(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=Rc(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}vr.prototype=Object.create(Error.prototype);vr.prototype.constructor=vr;vr.prototype.toString=function(t){return this.name+": "+Rc(this,t)};var be=vr;function No(e,t,r,n,o){var i="",s="",a=Math.floor(o/2)-1;return n-t>a&&(i=" ... ",t=n-a+i.length),r-n>a&&(s=" ...",r=n+a-s.length),{str:i+e.slice(t,r).replace(/\t/g,"\u2192")+s,pos:n-t+i.length}}function Lo(e,t){return le.repeat(" ",t-e.length)+e}function Om(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var r=/\r?\n|\r|\0/g,n=[0],o=[],i,s=-1;i=r.exec(e.buffer);)o.push(i.index),n.push(i.index+i[0].length),e.position<=i.index&&s<0&&(s=n.length-2);s<0&&(s=n.length-1);var a="",c,u,l=Math.min(e.line+t.linesAfter,o.length).toString().length,p=t.maxLength-(t.indent+l+3);for(c=1;c<=t.linesBefore&&!(s-c<0);c++)u=No(e.buffer,n[s-c],o[s-c],e.position-(n[s]-n[s-c]),p),a=le.repeat(" ",t.indent)+Lo((e.line-c+1).toString(),l)+" | "+u.str+`
|
|
38
|
+
`+a;for(u=No(e.buffer,n[s],o[s],e.position,p),a+=le.repeat(" ",t.indent)+Lo((e.line+1).toString(),l)+" | "+u.str+`
|
|
39
|
+
`,a+=le.repeat("-",t.indent+l+3+u.pos)+`^
|
|
40
|
+
`,c=1;c<=t.linesAfter&&!(s+c>=o.length);c++)u=No(e.buffer,n[s+c],o[s+c],e.position-(n[s]-n[s+c]),p),a+=le.repeat(" ",t.indent)+Lo((e.line+c+1).toString(),l)+" | "+u.str+`
|
|
41
|
+
`;return a.replace(/\n$/,"")}var Tm=Om,Pm=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],$m=["scalar","sequence","mapping"];function Dm(e){var t={};return e!==null&&Object.keys(e).forEach(function(r){e[r].forEach(function(n){t[String(n)]=r})}),t}function Nm(e,t){if(t=t||{},Object.keys(t).forEach(function(r){if(Pm.indexOf(r)===-1)throw new be('Unknown option "'+r+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(r){return r},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=Dm(t.styleAliases||null),$m.indexOf(this.kind)===-1)throw new be('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var fe=Nm;function dc(e,t){var r=[];return e[t].forEach(function(n){var o=r.length;r.forEach(function(i,s){i.tag===n.tag&&i.kind===n.kind&&i.multi===n.multi&&(o=s)}),r[o]=n}),r}function Lm(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,r;function n(o){o.multi?(e.multi[o.kind].push(o),e.multi.fallback.push(o)):e[o.kind][o.tag]=e.fallback[o.tag]=o}for(t=0,r=arguments.length;t<r;t+=1)arguments[t].forEach(n);return e}function Fo(e){return this.extend(e)}Fo.prototype.extend=function(t){var r=[],n=[];if(t instanceof fe)n.push(t);else if(Array.isArray(t))n=n.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(r=r.concat(t.implicit)),t.explicit&&(n=n.concat(t.explicit));else throw new be("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");r.forEach(function(i){if(!(i instanceof fe))throw new be("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(i.loadKind&&i.loadKind!=="scalar")throw new be("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(i.multi)throw new be("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(i){if(!(i instanceof fe))throw new be("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var o=Object.create(Fo.prototype);return o.implicit=(this.implicit||[]).concat(r),o.explicit=(this.explicit||[]).concat(n),o.compiledImplicit=dc(o,"implicit"),o.compiledExplicit=dc(o,"explicit"),o.compiledTypeMap=Lm(o.compiledImplicit,o.compiledExplicit),o};var Oc=Fo,Tc=new fe("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),Pc=new fe("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),$c=new fe("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),Dc=new Oc({explicit:[Tc,Pc,$c]});function Im(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function Fm(){return null}function jm(e){return e===null}var Nc=new fe("tag:yaml.org,2002:null",{kind:"scalar",resolve:Im,construct:Fm,predicate:jm,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function Mm(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}function Bm(e){return e==="true"||e==="True"||e==="TRUE"}function Hm(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var Lc=new fe("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Mm,construct:Bm,predicate:Hm,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function Gm(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function Vm(e){return 48<=e&&e<=55}function Wm(e){return 48<=e&&e<=57}function Um(e){if(e===null)return!1;var t=e.length,r=0,n=!1,o;if(!t)return!1;if(o=e[r],(o==="-"||o==="+")&&(o=e[++r]),o==="0"){if(r+1===t)return!0;if(o=e[++r],o==="b"){for(r++;r<t;r++)if(o=e[r],o!=="_"){if(o!=="0"&&o!=="1")return!1;n=!0}return n&&o!=="_"}if(o==="x"){for(r++;r<t;r++)if(o=e[r],o!=="_"){if(!Gm(e.charCodeAt(r)))return!1;n=!0}return n&&o!=="_"}if(o==="o"){for(r++;r<t;r++)if(o=e[r],o!=="_"){if(!Vm(e.charCodeAt(r)))return!1;n=!0}return n&&o!=="_"}}if(o==="_")return!1;for(;r<t;r++)if(o=e[r],o!=="_"){if(!Wm(e.charCodeAt(r)))return!1;n=!0}return!(!n||o==="_")}function qm(e){var t=e,r=1,n;if(t.indexOf("_")!==-1&&(t=t.replace(/_/g,"")),n=t[0],(n==="-"||n==="+")&&(n==="-"&&(r=-1),t=t.slice(1),n=t[0]),t==="0")return 0;if(n==="0"){if(t[1]==="b")return r*parseInt(t.slice(2),2);if(t[1]==="x")return r*parseInt(t.slice(2),16);if(t[1]==="o")return r*parseInt(t.slice(2),8)}return r*parseInt(t,10)}function Ym(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!le.isNegativeZero(e)}var Ic=new fe("tag:yaml.org,2002:int",{kind:"scalar",resolve:Um,construct:qm,predicate:Ym,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Km=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function zm(e){return!(e===null||!Km.test(e)||e[e.length-1]==="_")}function Xm(e){var t,r;return t=e.replace(/_/g,"").toLowerCase(),r=t[0]==="-"?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),t===".inf"?r===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:r*parseFloat(t,10)}var Jm=/^[-+]?[0-9]+e/;function Qm(e,t){var r;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(le.isNegativeZero(e))return"-0.0";return r=e.toString(10),Jm.test(r)?r.replace("e",".e"):r}function Zm(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||le.isNegativeZero(e))}var Fc=new fe("tag:yaml.org,2002:float",{kind:"scalar",resolve:zm,construct:Xm,predicate:Zm,represent:Qm,defaultStyle:"lowercase"}),jc=Dc.extend({implicit:[Nc,Lc,Ic,Fc]}),Mc=jc,Bc=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Hc=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function eg(e){return e===null?!1:Bc.exec(e)!==null||Hc.exec(e)!==null}function tg(e){var t,r,n,o,i,s,a,c=0,u=null,l,p,d;if(t=Bc.exec(e),t===null&&(t=Hc.exec(e)),t===null)throw new Error("Date resolve error");if(r=+t[1],n=+t[2]-1,o=+t[3],!t[4])return new Date(Date.UTC(r,n,o));if(i=+t[4],s=+t[5],a=+t[6],t[7]){for(c=t[7].slice(0,3);c.length<3;)c+="0";c=+c}return t[9]&&(l=+t[10],p=+(t[11]||0),u=(l*60+p)*6e4,t[9]==="-"&&(u=-u)),d=new Date(Date.UTC(r,n,o,i,s,a,c)),u&&d.setTime(d.getTime()-u),d}function rg(e){return e.toISOString()}var Gc=new fe("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:eg,construct:tg,instanceOf:Date,represent:rg});function ng(e){return e==="<<"||e===null}var Vc=new fe("tag:yaml.org,2002:merge",{kind:"scalar",resolve:ng}),Go=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
42
|
+
\r`;function og(e){if(e===null)return!1;var t,r,n=0,o=e.length,i=Go;for(r=0;r<o;r++)if(t=i.indexOf(e.charAt(r)),!(t>64)){if(t<0)return!1;n+=6}return n%8===0}function ig(e){var t,r,n=e.replace(/[\r\n=]/g,""),o=n.length,i=Go,s=0,a=[];for(t=0;t<o;t++)t%4===0&&t&&(a.push(s>>16&255),a.push(s>>8&255),a.push(s&255)),s=s<<6|i.indexOf(n.charAt(t));return r=o%4*6,r===0?(a.push(s>>16&255),a.push(s>>8&255),a.push(s&255)):r===18?(a.push(s>>10&255),a.push(s>>2&255)):r===12&&a.push(s>>4&255),new Uint8Array(a)}function sg(e){var t="",r=0,n,o,i=e.length,s=Go;for(n=0;n<i;n++)n%3===0&&n&&(t+=s[r>>18&63],t+=s[r>>12&63],t+=s[r>>6&63],t+=s[r&63]),r=(r<<8)+e[n];return o=i%3,o===0?(t+=s[r>>18&63],t+=s[r>>12&63],t+=s[r>>6&63],t+=s[r&63]):o===2?(t+=s[r>>10&63],t+=s[r>>4&63],t+=s[r<<2&63],t+=s[64]):o===1&&(t+=s[r>>2&63],t+=s[r<<4&63],t+=s[64],t+=s[64]),t}function ag(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var Wc=new fe("tag:yaml.org,2002:binary",{kind:"scalar",resolve:og,construct:ig,predicate:ag,represent:sg}),cg=Object.prototype.hasOwnProperty,lg=Object.prototype.toString;function ug(e){if(e===null)return!0;var t=[],r,n,o,i,s,a=e;for(r=0,n=a.length;r<n;r+=1){if(o=a[r],s=!1,lg.call(o)!=="[object Object]")return!1;for(i in o)if(cg.call(o,i))if(!s)s=!0;else return!1;if(!s)return!1;if(t.indexOf(i)===-1)t.push(i);else return!1}return!0}function pg(e){return e!==null?e:[]}var Uc=new fe("tag:yaml.org,2002:omap",{kind:"sequence",resolve:ug,construct:pg}),dg=Object.prototype.toString;function fg(e){if(e===null)return!0;var t,r,n,o,i,s=e;for(i=new Array(s.length),t=0,r=s.length;t<r;t+=1){if(n=s[t],dg.call(n)!=="[object Object]"||(o=Object.keys(n),o.length!==1))return!1;i[t]=[o[0],n[o[0]]]}return!0}function hg(e){if(e===null)return[];var t,r,n,o,i,s=e;for(i=new Array(s.length),t=0,r=s.length;t<r;t+=1)n=s[t],o=Object.keys(n),i[t]=[o[0],n[o[0]]];return i}var qc=new fe("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:fg,construct:hg}),mg=Object.prototype.hasOwnProperty;function gg(e){if(e===null)return!0;var t,r=e;for(t in r)if(mg.call(r,t)&&r[t]!==null)return!1;return!0}function yg(e){return e!==null?e:{}}var Yc=new fe("tag:yaml.org,2002:set",{kind:"mapping",resolve:gg,construct:yg}),Vo=Mc.extend({implicit:[Gc,Vc],explicit:[Wc,Uc,qc,Yc]}),_t=Object.prototype.hasOwnProperty,zr=1,Kc=2,zc=3,Xr=4,Io=1,vg=2,fc=3,bg=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,_g=/[\x85\u2028\u2029]/,Eg=/[,\[\]\{\}]/,Xc=/^(?:!|!!|![a-z\-]+!)$/i,Jc=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function hc(e){return Object.prototype.toString.call(e)}function Xe(e){return e===10||e===13}function $t(e){return e===9||e===32}function xe(e){return e===9||e===32||e===10||e===13}function Ut(e){return e===44||e===91||e===93||e===123||e===125}function xg(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function kg(e){return e===120?2:e===117?4:e===85?8:0}function wg(e){return 48<=e&&e<=57?e-48:-1}function mc(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
|
|
43
|
+
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}function Cg(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function Qc(e,t,r){t==="__proto__"?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:r}):e[t]=r}var Zc=new Array(256),el=new Array(256);for(Pt=0;Pt<256;Pt++)Zc[Pt]=mc(Pt)?1:0,el[Pt]=mc(Pt);var Pt;function Ag(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||Vo,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function tl(e,t){var r={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return r.snippet=Tm(r),new be(t,r)}function R(e,t){throw tl(e,t)}function Jr(e,t){e.onWarning&&e.onWarning.call(null,tl(e,t))}var gc={YAML:function(t,r,n){var o,i,s;t.version!==null&&R(t,"duplication of %YAML directive"),n.length!==1&&R(t,"YAML directive accepts exactly one argument"),o=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),o===null&&R(t,"ill-formed argument of the YAML directive"),i=parseInt(o[1],10),s=parseInt(o[2],10),i!==1&&R(t,"unacceptable YAML version of the document"),t.version=n[0],t.checkLineBreaks=s<2,s!==1&&s!==2&&Jr(t,"unsupported YAML version of the document")},TAG:function(t,r,n){var o,i;n.length!==2&&R(t,"TAG directive accepts exactly two arguments"),o=n[0],i=n[1],Xc.test(o)||R(t,"ill-formed tag handle (first argument) of the TAG directive"),_t.call(t.tagMap,o)&&R(t,'there is a previously declared suffix for "'+o+'" tag handle'),Jc.test(i)||R(t,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch{R(t,"tag prefix is malformed: "+i)}t.tagMap[o]=i}};function bt(e,t,r,n){var o,i,s,a;if(t<r){if(a=e.input.slice(t,r),n)for(o=0,i=a.length;o<i;o+=1)s=a.charCodeAt(o),s===9||32<=s&&s<=1114111||R(e,"expected valid JSON character");else bg.test(a)&&R(e,"the stream contains non-printable characters");e.result+=a}}function yc(e,t,r,n){var o,i,s,a;for(le.isObject(r)||R(e,"cannot merge mappings; the provided source object is unacceptable"),o=Object.keys(r),s=0,a=o.length;s<a;s+=1)i=o[s],_t.call(t,i)||(Qc(t,i,r[i]),n[i]=!0)}function qt(e,t,r,n,o,i,s,a,c){var u,l;if(Array.isArray(o))for(o=Array.prototype.slice.call(o),u=0,l=o.length;u<l;u+=1)Array.isArray(o[u])&&R(e,"nested arrays are not supported inside keys"),typeof o=="object"&&hc(o[u])==="[object Object]"&&(o[u]="[object Object]");if(typeof o=="object"&&hc(o)==="[object Object]"&&(o="[object Object]"),o=String(o),t===null&&(t={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(i))for(u=0,l=i.length;u<l;u+=1)yc(e,t,i[u],r);else yc(e,t,i,r);else!e.json&&!_t.call(r,o)&&_t.call(t,o)&&(e.line=s||e.line,e.lineStart=a||e.lineStart,e.position=c||e.position,R(e,"duplicated mapping key")),Qc(t,o,i),delete r[o];return t}function Wo(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):R(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function ie(e,t,r){for(var n=0,o=e.input.charCodeAt(e.position);o!==0;){for(;$t(o);)o===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),o=e.input.charCodeAt(++e.position);if(t&&o===35)do o=e.input.charCodeAt(++e.position);while(o!==10&&o!==13&&o!==0);if(Xe(o))for(Wo(e),o=e.input.charCodeAt(e.position),n++,e.lineIndent=0;o===32;)e.lineIndent++,o=e.input.charCodeAt(++e.position);else break}return r!==-1&&n!==0&&e.lineIndent<r&&Jr(e,"deficient indentation"),n}function en(e){var t=e.position,r;return r=e.input.charCodeAt(t),!!((r===45||r===46)&&r===e.input.charCodeAt(t+1)&&r===e.input.charCodeAt(t+2)&&(t+=3,r=e.input.charCodeAt(t),r===0||xe(r)))}function Uo(e,t){t===1?e.result+=" ":t>1&&(e.result+=le.repeat(`
|
|
44
|
+
`,t-1))}function Sg(e,t,r){var n,o,i,s,a,c,u,l,p=e.kind,d=e.result,y;if(y=e.input.charCodeAt(e.position),xe(y)||Ut(y)||y===35||y===38||y===42||y===33||y===124||y===62||y===39||y===34||y===37||y===64||y===96||(y===63||y===45)&&(o=e.input.charCodeAt(e.position+1),xe(o)||r&&Ut(o)))return!1;for(e.kind="scalar",e.result="",i=s=e.position,a=!1;y!==0;){if(y===58){if(o=e.input.charCodeAt(e.position+1),xe(o)||r&&Ut(o))break}else if(y===35){if(n=e.input.charCodeAt(e.position-1),xe(n))break}else{if(e.position===e.lineStart&&en(e)||r&&Ut(y))break;if(Xe(y))if(c=e.line,u=e.lineStart,l=e.lineIndent,ie(e,!1,-1),e.lineIndent>=t){a=!0,y=e.input.charCodeAt(e.position);continue}else{e.position=s,e.line=c,e.lineStart=u,e.lineIndent=l;break}}a&&(bt(e,i,s,!1),Uo(e,e.line-c),i=s=e.position,a=!1),$t(y)||(s=e.position+1),y=e.input.charCodeAt(++e.position)}return bt(e,i,s,!1),e.result?!0:(e.kind=p,e.result=d,!1)}function Rg(e,t){var r,n,o;if(r=e.input.charCodeAt(e.position),r!==39)return!1;for(e.kind="scalar",e.result="",e.position++,n=o=e.position;(r=e.input.charCodeAt(e.position))!==0;)if(r===39)if(bt(e,n,e.position,!0),r=e.input.charCodeAt(++e.position),r===39)n=e.position,e.position++,o=e.position;else return!0;else Xe(r)?(bt(e,n,o,!0),Uo(e,ie(e,!1,t)),n=o=e.position):e.position===e.lineStart&&en(e)?R(e,"unexpected end of the document within a single quoted scalar"):(e.position++,o=e.position);R(e,"unexpected end of the stream within a single quoted scalar")}function Og(e,t){var r,n,o,i,s,a;if(a=e.input.charCodeAt(e.position),a!==34)return!1;for(e.kind="scalar",e.result="",e.position++,r=n=e.position;(a=e.input.charCodeAt(e.position))!==0;){if(a===34)return bt(e,r,e.position,!0),e.position++,!0;if(a===92){if(bt(e,r,e.position,!0),a=e.input.charCodeAt(++e.position),Xe(a))ie(e,!1,t);else if(a<256&&Zc[a])e.result+=el[a],e.position++;else if((s=kg(a))>0){for(o=s,i=0;o>0;o--)a=e.input.charCodeAt(++e.position),(s=xg(a))>=0?i=(i<<4)+s:R(e,"expected hexadecimal character");e.result+=Cg(i),e.position++}else R(e,"unknown escape sequence");r=n=e.position}else Xe(a)?(bt(e,r,n,!0),Uo(e,ie(e,!1,t)),r=n=e.position):e.position===e.lineStart&&en(e)?R(e,"unexpected end of the document within a double quoted scalar"):(e.position++,n=e.position)}R(e,"unexpected end of the stream within a double quoted scalar")}function Tg(e,t){var r=!0,n,o,i,s=e.tag,a,c=e.anchor,u,l,p,d,y,g=Object.create(null),m,E,x,S;if(S=e.input.charCodeAt(e.position),S===91)l=93,y=!1,a=[];else if(S===123)l=125,y=!0,a={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=a),S=e.input.charCodeAt(++e.position);S!==0;){if(ie(e,!0,t),S=e.input.charCodeAt(e.position),S===l)return e.position++,e.tag=s,e.anchor=c,e.kind=y?"mapping":"sequence",e.result=a,!0;r?S===44&&R(e,"expected the node content, but found ','"):R(e,"missed comma between flow collection entries"),E=m=x=null,p=d=!1,S===63&&(u=e.input.charCodeAt(e.position+1),xe(u)&&(p=d=!0,e.position++,ie(e,!0,t))),n=e.line,o=e.lineStart,i=e.position,Yt(e,t,zr,!1,!0),E=e.tag,m=e.result,ie(e,!0,t),S=e.input.charCodeAt(e.position),(d||e.line===n)&&S===58&&(p=!0,S=e.input.charCodeAt(++e.position),ie(e,!0,t),Yt(e,t,zr,!1,!0),x=e.result),y?qt(e,a,g,E,m,x,n,o,i):p?a.push(qt(e,null,g,E,m,x,n,o,i)):a.push(m),ie(e,!0,t),S=e.input.charCodeAt(e.position),S===44?(r=!0,S=e.input.charCodeAt(++e.position)):r=!1}R(e,"unexpected end of the stream within a flow collection")}function Pg(e,t){var r,n,o=Io,i=!1,s=!1,a=t,c=0,u=!1,l,p;if(p=e.input.charCodeAt(e.position),p===124)n=!1;else if(p===62)n=!0;else return!1;for(e.kind="scalar",e.result="";p!==0;)if(p=e.input.charCodeAt(++e.position),p===43||p===45)Io===o?o=p===43?fc:vg:R(e,"repeat of a chomping mode identifier");else if((l=wg(p))>=0)l===0?R(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):s?R(e,"repeat of an indentation width identifier"):(a=t+l-1,s=!0);else break;if($t(p)){do p=e.input.charCodeAt(++e.position);while($t(p));if(p===35)do p=e.input.charCodeAt(++e.position);while(!Xe(p)&&p!==0)}for(;p!==0;){for(Wo(e),e.lineIndent=0,p=e.input.charCodeAt(e.position);(!s||e.lineIndent<a)&&p===32;)e.lineIndent++,p=e.input.charCodeAt(++e.position);if(!s&&e.lineIndent>a&&(a=e.lineIndent),Xe(p)){c++;continue}if(e.lineIndent<a){o===fc?e.result+=le.repeat(`
|
|
45
|
+
`,i?1+c:c):o===Io&&i&&(e.result+=`
|
|
46
|
+
`);break}for(n?$t(p)?(u=!0,e.result+=le.repeat(`
|
|
47
|
+
`,i?1+c:c)):u?(u=!1,e.result+=le.repeat(`
|
|
48
|
+
`,c+1)):c===0?i&&(e.result+=" "):e.result+=le.repeat(`
|
|
49
|
+
`,c):e.result+=le.repeat(`
|
|
50
|
+
`,i?1+c:c),i=!0,s=!0,c=0,r=e.position;!Xe(p)&&p!==0;)p=e.input.charCodeAt(++e.position);bt(e,r,e.position,!1)}return!0}function vc(e,t){var r,n=e.tag,o=e.anchor,i=[],s,a=!1,c;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=i),c=e.input.charCodeAt(e.position);c!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,R(e,"tab characters must not be used in indentation")),!(c!==45||(s=e.input.charCodeAt(e.position+1),!xe(s))));){if(a=!0,e.position++,ie(e,!0,-1)&&e.lineIndent<=t){i.push(null),c=e.input.charCodeAt(e.position);continue}if(r=e.line,Yt(e,t,zc,!1,!0),i.push(e.result),ie(e,!0,-1),c=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>t)&&c!==0)R(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return a?(e.tag=n,e.anchor=o,e.kind="sequence",e.result=i,!0):!1}function $g(e,t,r){var n,o,i,s,a,c,u=e.tag,l=e.anchor,p={},d=Object.create(null),y=null,g=null,m=null,E=!1,x=!1,S;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=p),S=e.input.charCodeAt(e.position);S!==0;){if(!E&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,R(e,"tab characters must not be used in indentation")),n=e.input.charCodeAt(e.position+1),i=e.line,(S===63||S===58)&&xe(n))S===63?(E&&(qt(e,p,d,y,g,null,s,a,c),y=g=m=null),x=!0,E=!0,o=!0):E?(E=!1,o=!0):R(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,S=n;else{if(s=e.line,a=e.lineStart,c=e.position,!Yt(e,r,Kc,!1,!0))break;if(e.line===i){for(S=e.input.charCodeAt(e.position);$t(S);)S=e.input.charCodeAt(++e.position);if(S===58)S=e.input.charCodeAt(++e.position),xe(S)||R(e,"a whitespace character is expected after the key-value separator within a block mapping"),E&&(qt(e,p,d,y,g,null,s,a,c),y=g=m=null),x=!0,E=!1,o=!1,y=e.tag,g=e.result;else if(x)R(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=u,e.anchor=l,!0}else if(x)R(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=u,e.anchor=l,!0}if((e.line===i||e.lineIndent>t)&&(E&&(s=e.line,a=e.lineStart,c=e.position),Yt(e,t,Xr,!0,o)&&(E?g=e.result:m=e.result),E||(qt(e,p,d,y,g,m,s,a,c),y=g=m=null),ie(e,!0,-1),S=e.input.charCodeAt(e.position)),(e.line===i||e.lineIndent>t)&&S!==0)R(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return E&&qt(e,p,d,y,g,null,s,a,c),x&&(e.tag=u,e.anchor=l,e.kind="mapping",e.result=p),x}function Dg(e){var t,r=!1,n=!1,o,i,s;if(s=e.input.charCodeAt(e.position),s!==33)return!1;if(e.tag!==null&&R(e,"duplication of a tag property"),s=e.input.charCodeAt(++e.position),s===60?(r=!0,s=e.input.charCodeAt(++e.position)):s===33?(n=!0,o="!!",s=e.input.charCodeAt(++e.position)):o="!",t=e.position,r){do s=e.input.charCodeAt(++e.position);while(s!==0&&s!==62);e.position<e.length?(i=e.input.slice(t,e.position),s=e.input.charCodeAt(++e.position)):R(e,"unexpected end of the stream within a verbatim tag")}else{for(;s!==0&&!xe(s);)s===33&&(n?R(e,"tag suffix cannot contain exclamation marks"):(o=e.input.slice(t-1,e.position+1),Xc.test(o)||R(e,"named tag handle cannot contain such characters"),n=!0,t=e.position+1)),s=e.input.charCodeAt(++e.position);i=e.input.slice(t,e.position),Eg.test(i)&&R(e,"tag suffix cannot contain flow indicator characters")}i&&!Jc.test(i)&&R(e,"tag name cannot contain such characters: "+i);try{i=decodeURIComponent(i)}catch{R(e,"tag name is malformed: "+i)}return r?e.tag=i:_t.call(e.tagMap,o)?e.tag=e.tagMap[o]+i:o==="!"?e.tag="!"+i:o==="!!"?e.tag="tag:yaml.org,2002:"+i:R(e,'undeclared tag handle "'+o+'"'),!0}function Ng(e){var t,r;if(r=e.input.charCodeAt(e.position),r!==38)return!1;for(e.anchor!==null&&R(e,"duplication of an anchor property"),r=e.input.charCodeAt(++e.position),t=e.position;r!==0&&!xe(r)&&!Ut(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&R(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function Lg(e){var t,r,n;if(n=e.input.charCodeAt(e.position),n!==42)return!1;for(n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!xe(n)&&!Ut(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&R(e,"name of an alias node must contain at least one character"),r=e.input.slice(t,e.position),_t.call(e.anchorMap,r)||R(e,'unidentified alias "'+r+'"'),e.result=e.anchorMap[r],ie(e,!0,-1),!0}function Yt(e,t,r,n,o){var i,s,a,c=1,u=!1,l=!1,p,d,y,g,m,E;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,i=s=a=Xr===r||zc===r,n&&ie(e,!0,-1)&&(u=!0,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)),c===1)for(;Dg(e)||Ng(e);)ie(e,!0,-1)?(u=!0,a=i,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)):a=!1;if(a&&(a=u||o),(c===1||Xr===r)&&(zr===r||Kc===r?m=t:m=t+1,E=e.position-e.lineStart,c===1?a&&(vc(e,E)||$g(e,E,m))||Tg(e,m)?l=!0:(s&&Pg(e,m)||Rg(e,m)||Og(e,m)?l=!0:Lg(e)?(l=!0,(e.tag!==null||e.anchor!==null)&&R(e,"alias node should not have any properties")):Sg(e,m,zr===r)&&(l=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):c===0&&(l=a&&vc(e,E))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&R(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),p=0,d=e.implicitTypes.length;p<d;p+=1)if(g=e.implicitTypes[p],g.resolve(e.result)){e.result=g.construct(e.result),e.tag=g.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(_t.call(e.typeMap[e.kind||"fallback"],e.tag))g=e.typeMap[e.kind||"fallback"][e.tag];else for(g=null,y=e.typeMap.multi[e.kind||"fallback"],p=0,d=y.length;p<d;p+=1)if(e.tag.slice(0,y[p].tag.length)===y[p].tag){g=y[p];break}g||R(e,"unknown tag !<"+e.tag+">"),e.result!==null&&g.kind!==e.kind&&R(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+g.kind+'", not "'+e.kind+'"'),g.resolve(e.result,e.tag)?(e.result=g.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):R(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||l}function Ig(e){var t=e.position,r,n,o,i=!1,s;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(s=e.input.charCodeAt(e.position))!==0&&(ie(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||s!==37));){for(i=!0,s=e.input.charCodeAt(++e.position),r=e.position;s!==0&&!xe(s);)s=e.input.charCodeAt(++e.position);for(n=e.input.slice(r,e.position),o=[],n.length<1&&R(e,"directive name must not be less than one character in length");s!==0;){for(;$t(s);)s=e.input.charCodeAt(++e.position);if(s===35){do s=e.input.charCodeAt(++e.position);while(s!==0&&!Xe(s));break}if(Xe(s))break;for(r=e.position;s!==0&&!xe(s);)s=e.input.charCodeAt(++e.position);o.push(e.input.slice(r,e.position))}s!==0&&Wo(e),_t.call(gc,n)?gc[n](e,n,o):Jr(e,'unknown document directive "'+n+'"')}if(ie(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,ie(e,!0,-1)):i&&R(e,"directives end mark is expected"),Yt(e,e.lineIndent-1,Xr,!1,!0),ie(e,!0,-1),e.checkLineBreaks&&_g.test(e.input.slice(t,e.position))&&Jr(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&en(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,ie(e,!0,-1));return}if(e.position<e.length-1)R(e,"end of the stream or a document separator is expected");else return}function rl(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
|
|
51
|
+
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var r=new Ag(e,t),n=e.indexOf("\0");for(n!==-1&&(r.position=n,R(r,"null byte is not allowed in input")),r.input+="\0";r.input.charCodeAt(r.position)===32;)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)Ig(r);return r.documents}function Fg(e,t,r){t!==null&&typeof t=="object"&&typeof r>"u"&&(r=t,t=null);var n=rl(e,r);if(typeof t!="function")return n;for(var o=0,i=n.length;o<i;o+=1)t(n[o])}function jg(e,t){var r=rl(e,t);if(r.length!==0){if(r.length===1)return r[0];throw new be("expected a single document in the stream, but found more")}}var Mg=Fg,Bg=jg,nl={loadAll:Mg,load:Bg},ol=Object.prototype.toString,il=Object.prototype.hasOwnProperty,qo=65279,Hg=9,br=10,Gg=13,Vg=32,Wg=33,Ug=34,jo=35,qg=37,Yg=38,Kg=39,zg=42,sl=44,Xg=45,Qr=58,Jg=61,Qg=62,Zg=63,ey=64,al=91,cl=93,ty=96,ll=123,ry=124,ul=125,he={};he[0]="\\0";he[7]="\\a";he[8]="\\b";he[9]="\\t";he[10]="\\n";he[11]="\\v";he[12]="\\f";he[13]="\\r";he[27]="\\e";he[34]='\\"';he[92]="\\\\";he[133]="\\N";he[160]="\\_";he[8232]="\\L";he[8233]="\\P";var ny=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],oy=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function iy(e,t){var r,n,o,i,s,a,c;if(t===null)return{};for(r={},n=Object.keys(t),o=0,i=n.length;o<i;o+=1)s=n[o],a=String(t[s]),s.slice(0,2)==="!!"&&(s="tag:yaml.org,2002:"+s.slice(2)),c=e.compiledTypeMap.fallback[s],c&&il.call(c.styleAliases,a)&&(a=c.styleAliases[a]),r[s]=a;return r}function sy(e){var t,r,n;if(t=e.toString(16).toUpperCase(),e<=255)r="x",n=2;else if(e<=65535)r="u",n=4;else if(e<=4294967295)r="U",n=8;else throw new be("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+r+le.repeat("0",n-t.length)+t}var ay=1,_r=2;function cy(e){this.schema=e.schema||Vo,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=le.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=iy(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?_r:ay,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function bc(e,t){for(var r=le.repeat(" ",t),n=0,o=-1,i="",s,a=e.length;n<a;)o=e.indexOf(`
|
|
52
|
+
`,n),o===-1?(s=e.slice(n),n=a):(s=e.slice(n,o+1),n=o+1),s.length&&s!==`
|
|
53
|
+
`&&(i+=r),i+=s;return i}function Mo(e,t){return`
|
|
54
|
+
`+le.repeat(" ",e.indent*t)}function ly(e,t){var r,n,o;for(r=0,n=e.implicitTypes.length;r<n;r+=1)if(o=e.implicitTypes[r],o.resolve(t))return!0;return!1}function Zr(e){return e===Vg||e===Hg}function Er(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==qo||65536<=e&&e<=1114111}function _c(e){return Er(e)&&e!==qo&&e!==Gg&&e!==br}function Ec(e,t,r){var n=_c(e),o=n&&!Zr(e);return(r?n:n&&e!==sl&&e!==al&&e!==cl&&e!==ll&&e!==ul)&&e!==jo&&!(t===Qr&&!o)||_c(t)&&!Zr(t)&&e===jo||t===Qr&&o}function uy(e){return Er(e)&&e!==qo&&!Zr(e)&&e!==Xg&&e!==Zg&&e!==Qr&&e!==sl&&e!==al&&e!==cl&&e!==ll&&e!==ul&&e!==jo&&e!==Yg&&e!==zg&&e!==Wg&&e!==ry&&e!==Jg&&e!==Qg&&e!==Kg&&e!==Ug&&e!==qg&&e!==ey&&e!==ty}function py(e){return!Zr(e)&&e!==Qr}function yr(e,t){var r=e.charCodeAt(t),n;return r>=55296&&r<=56319&&t+1<e.length&&(n=e.charCodeAt(t+1),n>=56320&&n<=57343)?(r-55296)*1024+n-56320+65536:r}function pl(e){var t=/^\n* /;return t.test(e)}var dl=1,Bo=2,fl=3,hl=4,Wt=5;function dy(e,t,r,n,o,i,s,a){var c,u=0,l=null,p=!1,d=!1,y=n!==-1,g=-1,m=uy(yr(e,0))&&py(yr(e,e.length-1));if(t||s)for(c=0;c<e.length;u>=65536?c+=2:c++){if(u=yr(e,c),!Er(u))return Wt;m=m&&Ec(u,l,a),l=u}else{for(c=0;c<e.length;u>=65536?c+=2:c++){if(u=yr(e,c),u===br)p=!0,y&&(d=d||c-g-1>n&&e[g+1]!==" ",g=c);else if(!Er(u))return Wt;m=m&&Ec(u,l,a),l=u}d=d||y&&c-g-1>n&&e[g+1]!==" "}return!p&&!d?m&&!s&&!o(e)?dl:i===_r?Wt:Bo:r>9&&pl(e)?Wt:s?i===_r?Wt:Bo:d?hl:fl}function fy(e,t,r,n,o){e.dump=(function(){if(t.length===0)return e.quotingType===_r?'""':"''";if(!e.noCompatMode&&(ny.indexOf(t)!==-1||oy.test(t)))return e.quotingType===_r?'"'+t+'"':"'"+t+"'";var i=e.indent*Math.max(1,r),s=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-i),a=n||e.flowLevel>-1&&r>=e.flowLevel;function c(u){return ly(e,u)}switch(dy(t,a,e.indent,s,c,e.quotingType,e.forceQuotes&&!n,o)){case dl:return t;case Bo:return"'"+t.replace(/'/g,"''")+"'";case fl:return"|"+xc(t,e.indent)+kc(bc(t,i));case hl:return">"+xc(t,e.indent)+kc(bc(hy(t,s),i));case Wt:return'"'+my(t)+'"';default:throw new be("impossible error: invalid scalar style")}})()}function xc(e,t){var r=pl(e)?String(t):"",n=e[e.length-1]===`
|
|
55
|
+
`,o=n&&(e[e.length-2]===`
|
|
56
|
+
`||e===`
|
|
57
|
+
`),i=o?"+":n?"":"-";return r+i+`
|
|
58
|
+
`}function kc(e){return e[e.length-1]===`
|
|
59
|
+
`?e.slice(0,-1):e}function hy(e,t){for(var r=/(\n+)([^\n]*)/g,n=(function(){var u=e.indexOf(`
|
|
60
|
+
`);return u=u!==-1?u:e.length,r.lastIndex=u,wc(e.slice(0,u),t)})(),o=e[0]===`
|
|
61
|
+
`||e[0]===" ",i,s;s=r.exec(e);){var a=s[1],c=s[2];i=c[0]===" ",n+=a+(!o&&!i&&c!==""?`
|
|
62
|
+
`:"")+wc(c,t),o=i}return n}function wc(e,t){if(e===""||e[0]===" ")return e;for(var r=/ [^ ]/g,n,o=0,i,s=0,a=0,c="";n=r.exec(e);)a=n.index,a-o>t&&(i=s>o?s:a,c+=`
|
|
63
|
+
`+e.slice(o,i),o=i+1),s=a;return c+=`
|
|
64
|
+
`,e.length-o>t&&s>o?c+=e.slice(o,s)+`
|
|
65
|
+
`+e.slice(s+1):c+=e.slice(o),c.slice(1)}function my(e){for(var t="",r=0,n,o=0;o<e.length;r>=65536?o+=2:o++)r=yr(e,o),n=he[r],!n&&Er(r)?(t+=e[o],r>=65536&&(t+=e[o+1])):t+=n||sy(r);return t}function gy(e,t,r){var n="",o=e.tag,i,s,a;for(i=0,s=r.length;i<s;i+=1)a=r[i],e.replacer&&(a=e.replacer.call(r,String(i),a)),(nt(e,t,a,!1,!1)||typeof a>"u"&&nt(e,t,null,!1,!1))&&(n!==""&&(n+=","+(e.condenseFlow?"":" ")),n+=e.dump);e.tag=o,e.dump="["+n+"]"}function Cc(e,t,r,n){var o="",i=e.tag,s,a,c;for(s=0,a=r.length;s<a;s+=1)c=r[s],e.replacer&&(c=e.replacer.call(r,String(s),c)),(nt(e,t+1,c,!0,!0,!1,!0)||typeof c>"u"&&nt(e,t+1,null,!0,!0,!1,!0))&&((!n||o!=="")&&(o+=Mo(e,t)),e.dump&&br===e.dump.charCodeAt(0)?o+="-":o+="- ",o+=e.dump);e.tag=i,e.dump=o||"[]"}function yy(e,t,r){var n="",o=e.tag,i=Object.keys(r),s,a,c,u,l;for(s=0,a=i.length;s<a;s+=1)l="",n!==""&&(l+=", "),e.condenseFlow&&(l+='"'),c=i[s],u=r[c],e.replacer&&(u=e.replacer.call(r,c,u)),nt(e,t,c,!1,!1)&&(e.dump.length>1024&&(l+="? "),l+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),nt(e,t,u,!1,!1)&&(l+=e.dump,n+=l));e.tag=o,e.dump="{"+n+"}"}function vy(e,t,r,n){var o="",i=e.tag,s=Object.keys(r),a,c,u,l,p,d;if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys=="function")s.sort(e.sortKeys);else if(e.sortKeys)throw new be("sortKeys must be a boolean or a function");for(a=0,c=s.length;a<c;a+=1)d="",(!n||o!=="")&&(d+=Mo(e,t)),u=s[a],l=r[u],e.replacer&&(l=e.replacer.call(r,u,l)),nt(e,t+1,u,!0,!0,!0)&&(p=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,p&&(e.dump&&br===e.dump.charCodeAt(0)?d+="?":d+="? "),d+=e.dump,p&&(d+=Mo(e,t)),nt(e,t+1,l,!0,p)&&(e.dump&&br===e.dump.charCodeAt(0)?d+=":":d+=": ",d+=e.dump,o+=d));e.tag=i,e.dump=o||"{}"}function Ac(e,t,r){var n,o,i,s,a,c;for(o=r?e.explicitTypes:e.implicitTypes,i=0,s=o.length;i<s;i+=1)if(a=o[i],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof t=="object"&&t instanceof a.instanceOf)&&(!a.predicate||a.predicate(t))){if(r?a.multi&&a.representName?e.tag=a.representName(t):e.tag=a.tag:e.tag="?",a.represent){if(c=e.styleMap[a.tag]||a.defaultStyle,ol.call(a.represent)==="[object Function]")n=a.represent(t,c);else if(il.call(a.represent,c))n=a.represent[c](t,c);else throw new be("!<"+a.tag+'> tag resolver accepts not "'+c+'" style');e.dump=n}return!0}return!1}function nt(e,t,r,n,o,i,s){e.tag=null,e.dump=r,Ac(e,r,!1)||Ac(e,r,!0);var a=ol.call(e.dump),c=n,u;n&&(n=e.flowLevel<0||e.flowLevel>t);var l=a==="[object Object]"||a==="[object Array]",p,d;if(l&&(p=e.duplicates.indexOf(r),d=p!==-1),(e.tag!==null&&e.tag!=="?"||d||e.indent!==2&&t>0)&&(o=!1),d&&e.usedDuplicates[p])e.dump="*ref_"+p;else{if(l&&d&&!e.usedDuplicates[p]&&(e.usedDuplicates[p]=!0),a==="[object Object]")n&&Object.keys(e.dump).length!==0?(vy(e,t,e.dump,o),d&&(e.dump="&ref_"+p+e.dump)):(yy(e,t,e.dump),d&&(e.dump="&ref_"+p+" "+e.dump));else if(a==="[object Array]")n&&e.dump.length!==0?(e.noArrayIndent&&!s&&t>0?Cc(e,t-1,e.dump,o):Cc(e,t,e.dump,o),d&&(e.dump="&ref_"+p+e.dump)):(gy(e,t,e.dump),d&&(e.dump="&ref_"+p+" "+e.dump));else if(a==="[object String]")e.tag!=="?"&&fy(e,e.dump,t,i,c);else{if(a==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new be("unacceptable kind of an object to dump "+a)}e.tag!==null&&e.tag!=="?"&&(u=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?u="!"+u:u.slice(0,18)==="tag:yaml.org,2002:"?u="!!"+u.slice(18):u="!<"+u+">",e.dump=u+" "+e.dump)}return!0}function by(e,t){var r=[],n=[],o,i;for(Ho(e,r,n),o=0,i=n.length;o<i;o+=1)t.duplicates.push(r[n[o]]);t.usedDuplicates=new Array(i)}function Ho(e,t,r){var n,o,i;if(e!==null&&typeof e=="object")if(o=t.indexOf(e),o!==-1)r.indexOf(o)===-1&&r.push(o);else if(t.push(e),Array.isArray(e))for(o=0,i=e.length;o<i;o+=1)Ho(e[o],t,r);else for(n=Object.keys(e),o=0,i=n.length;o<i;o+=1)Ho(e[n[o]],t,r)}function _y(e,t){t=t||{};var r=new cy(t);r.noRefs||by(e,r);var n=e;return r.replacer&&(n=r.replacer.call({"":n},"",n)),nt(r,0,n,!0,!0)?r.dump+`
|
|
66
|
+
`:""}var Ey=_y,xy={dump:Ey};function Yo(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var ky=fe,wy=Oc,Cy=Dc,Ay=jc,Sy=Mc,Ry=Vo,Oy=nl.load,Ty=nl.loadAll,Py=xy.dump,$y=be,Dy={binary:Wc,float:Fc,map:$c,null:Nc,pairs:qc,set:Yc,timestamp:Gc,bool:Lc,int:Ic,merge:Vc,omap:Uc,seq:Pc,str:Tc},Ny=Yo("safeLoad","load"),Ly=Yo("safeLoadAll","loadAll"),Iy=Yo("safeDump","dump"),ke={Type:ky,Schema:wy,FAILSAFE_SCHEMA:Cy,JSON_SCHEMA:Ay,CORE_SCHEMA:Sy,DEFAULT_SCHEMA:Ry,load:Oy,loadAll:Ty,dump:Py,YAMLException:$y,types:Dy,safeLoad:Ny,safeLoadAll:Ly,safeDump:Iy};import qn from"fs-extra";import Lr from"path";import{extname as ew,resolve as tw,join as rw}from"path";var Ef=Bt(El(),1);import nw from"chokidar";import{pathToFileURL as ow}from"url";import ir from"fs-extra";import Wn from"path";var Xo=class{constructor(){this.level="info";this.verbose=!1}setLevel(t){this.level=t}setVerbose(t){this.verbose=t}shouldLog(t){let r={error:0,warn:1,info:2,debug:3};return t==="debug"&&this.verbose?!0:r[t]<=r[this.level]}getTypeStyle(t){switch(t){case"success":return h.green;case"error":return h.red;case"warning":return h.yellow;case"info":return h.blue;case"instruction":return h.cyan;case"progress":return h.reset;case"debug":return h.gray;case"raclette":return h.rgb(221,139,64);default:return r=>r}}getTypeIcon(t){switch(t){case"success":return"\u2705";case"error":return"\u274C";case"warning":return"\u26A0\uFE0F";case"info":return"\u2139\uFE0F ";case"instruction":return"\u{1F4A1}";case"progress":return"\u{1F504}";case"debug":return"";case"raclette":return"\u{1F9C0}";default:return""}}log(t,r,n){if(!this.shouldLog(t))return;let o=n?this.getTypeStyle(n):h.reset,i=n?this.getTypeIcon(n):"",s=i?`${i} `:"";console.log(o(`${s}${r}`))}logError(t,r){if(!this.shouldLog("error"))return;let n=this.getTypeStyle("error"),o=this.getTypeIcon("error"),i=o?`${o} `:"";r?console.error(n(`${i}${t}`),r):console.error(n(`${i}${t}`))}error(t,r){this.logError(t,r)}warn(t){this.log("warn",t,"warning")}info(t){this.log("info",t,"info")}debug(t){this.log("debug",t,"debug")}success(t){this.log("info",t,"success")}instruction(t){this.log("info",t,"instruction")}progress(t){this.log("info",t,"progress")}raclette(t){this.log("info",t,"raclette")}raw(t,r="info"){this.shouldLog(r)&&console.log(t)}},f=new Xo;var pf=(e,t=["js","yaml","yml"])=>{for(let r of t){let n=e+"."+r;if(ir.existsSync(n))return n}throw new Error(`Could not find any of ${e+"{"+t.join(",")+"}"}`)},df=async(e=process.cwd())=>{let t=Wn.join(e,".raclette");return await ir.ensureDir(t),t},$r=(e=process.cwd())=>{let t=xl().name,n=(e.includes("node_modules")?[[e.match(/(.*node_modules)/)?.[1]||"",t],[e,"node_modules",t],[e,"../../..",t]]:[[e,"node_modules",t],[e,"../..","raclette"],[e,"../..",t],[e,"../..","core"],[e,"..","raclette"],[e,"..",t],[e,"..","core"]]).map(i=>Wn.resolve(...i,"package.json")).find(i=>ir.readJsonSync(i,{throws:!1})?.name===t);if(n)return n.slice(0,-12);let o="Could not determine core package path to set up VFS. Canceling...";throw f.error(o),new Error(o)},ff=async(e,t)=>{let{globby:r}=await Promise.resolve().then(()=>(ua(),uf));return r(t,{cwd:e,absolute:!0,ignore:["**/node_modules/**","**/.git/**","**/dist/**"]})},hf=async(e,t)=>await ir.pathExists(e)?(await ir.ensureDir(Wn.dirname(t)),await ir.copy(e,t),f.debug(`\u2705 Copied ${Wn.basename(e)} to ${t}`),!0):(f.warn(chalk.yellow(`[VFS]: Specified source file not found for merging process: ${e}`)),!1);import vf from"fs-extra";import It from"path";var Lk=Object.prototype.toString,ar=Array.isArray||function(t){return Lk.call(t)==="[object Array]"};function da(e){return typeof e=="function"}function Ik(e){return ar(e)?"array":typeof e}function pa(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function mf(e,t){return e!=null&&typeof e=="object"&&t in e}function Fk(e,t){return e!=null&&typeof e!="object"&&e.hasOwnProperty&&e.hasOwnProperty(t)}var jk=RegExp.prototype.test;function Mk(e,t){return jk.call(e,t)}var Bk=/\S/;function Hk(e){return!Mk(Bk,e)}var Gk={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function Vk(e){return String(e).replace(/[&<>"'`=\/]/g,function(r){return Gk[r]})}var Wk=/\s*/,Uk=/\s+/,gf=/\s*=/,qk=/\s*\}/,Yk=/#|\^|\/|>|\{|&|=|!/;function Kk(e,t){if(!e)return[];var r=!1,n=[],o=[],i=[],s=!1,a=!1,c="",u=0;function l(){if(s&&!a)for(;i.length;)delete o[i.pop()];else i=[];s=!1,a=!1}var p,d,y;function g(w){if(typeof w=="string"&&(w=w.split(Uk,2)),!ar(w)||w.length!==2)throw new Error("Invalid tags: "+w);p=new RegExp(pa(w[0])+"\\s*"),d=new RegExp("\\s*"+pa(w[1])),y=new RegExp("\\s*"+pa("}"+w[1]))}g(t||Le.tags);for(var m=new Nr(e),E,x,S,$,oe,q;!m.eos();){if(E=m.pos,S=m.scanUntil(p),S)for(var T=0,L=S.length;T<L;++T)$=S.charAt(T),Hk($)?(i.push(o.length),c+=$):(a=!0,r=!0,c+=" "),o.push(["text",$,E,E+1]),E+=1,$===`
|
|
67
|
+
`&&(l(),c="",u=0,r=!1);if(!m.scan(p))break;if(s=!0,x=m.scan(Yk)||"name",m.scan(Wk),x==="="?(S=m.scanUntil(gf),m.scan(gf),m.scanUntil(d)):x==="{"?(S=m.scanUntil(y),m.scan(qk),m.scanUntil(d),x="&"):S=m.scanUntil(d),!m.scan(d))throw new Error("Unclosed tag at "+m.pos);if(x==">"?oe=[x,S,E,m.pos,c,u,r]:oe=[x,S,E,m.pos],u++,o.push(oe),x==="#"||x==="^")n.push(oe);else if(x==="/"){if(q=n.pop(),!q)throw new Error('Unopened section "'+S+'" at '+E);if(q[1]!==S)throw new Error('Unclosed section "'+q[1]+'" at '+E)}else x==="name"||x==="{"||x==="&"?a=!0:x==="="&&g(S)}if(l(),q=n.pop(),q)throw new Error('Unclosed section "'+q[1]+'" at '+m.pos);return Xk(zk(o))}function zk(e){for(var t=[],r,n,o=0,i=e.length;o<i;++o)r=e[o],r&&(r[0]==="text"&&n&&n[0]==="text"?(n[1]+=r[1],n[3]=r[3]):(t.push(r),n=r));return t}function Xk(e){for(var t=[],r=t,n=[],o,i,s=0,a=e.length;s<a;++s)switch(o=e[s],o[0]){case"#":case"^":r.push(o),n.push(o),r=o[4]=[];break;case"/":i=n.pop(),i[5]=o[2],r=n.length>0?n[n.length-1][4]:t;break;default:r.push(o)}return t}function Nr(e){this.string=e,this.tail=e,this.pos=0}Nr.prototype.eos=function(){return this.tail===""};Nr.prototype.scan=function(t){var r=this.tail.match(t);if(!r||r.index!==0)return"";var n=r[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n};Nr.prototype.scanUntil=function(t){var r=this.tail.search(t),n;switch(r){case-1:n=this.tail,this.tail="";break;case 0:n="";break;default:n=this.tail.substring(0,r),this.tail=this.tail.substring(r)}return this.pos+=n.length,n};function sr(e,t){this.view=e,this.cache={".":this.view},this.parent=t}sr.prototype.push=function(t){return new sr(t,this)};sr.prototype.lookup=function(t){var r=this.cache,n;if(r.hasOwnProperty(t))n=r[t];else{for(var o=this,i,s,a,c=!1;o;){if(t.indexOf(".")>0)for(i=o.view,s=t.split("."),a=0;i!=null&&a<s.length;)a===s.length-1&&(c=mf(i,s[a])||Fk(i,s[a])),i=i[s[a++]];else i=o.view[t],c=mf(o.view,t);if(c){n=i;break}o=o.parent}r[t]=n}return da(n)&&(n=n.call(this.view)),n};function _e(){this.templateCache={_cache:{},set:function(t,r){this._cache[t]=r},get:function(t){return this._cache[t]},clear:function(){this._cache={}}}}_e.prototype.clearCache=function(){typeof this.templateCache<"u"&&this.templateCache.clear()};_e.prototype.parse=function(t,r){var n=this.templateCache,o=t+":"+(r||Le.tags).join(":"),i=typeof n<"u",s=i?n.get(o):void 0;return s==null&&(s=Kk(t,r),i&&n.set(o,s)),s};_e.prototype.render=function(t,r,n,o){var i=this.getConfigTags(o),s=this.parse(t,i),a=r instanceof sr?r:new sr(r,void 0);return this.renderTokens(s,a,n,t,o)};_e.prototype.renderTokens=function(t,r,n,o,i){for(var s="",a,c,u,l=0,p=t.length;l<p;++l)u=void 0,a=t[l],c=a[0],c==="#"?u=this.renderSection(a,r,n,o,i):c==="^"?u=this.renderInverted(a,r,n,o,i):c===">"?u=this.renderPartial(a,r,n,i):c==="&"?u=this.unescapedValue(a,r):c==="name"?u=this.escapedValue(a,r,i):c==="text"&&(u=this.rawValue(a)),u!==void 0&&(s+=u);return s};_e.prototype.renderSection=function(t,r,n,o,i){var s=this,a="",c=r.lookup(t[1]);function u(d){return s.render(d,r,n,i)}if(c){if(ar(c))for(var l=0,p=c.length;l<p;++l)a+=this.renderTokens(t[4],r.push(c[l]),n,o,i);else if(typeof c=="object"||typeof c=="string"||typeof c=="number")a+=this.renderTokens(t[4],r.push(c),n,o,i);else if(da(c)){if(typeof o!="string")throw new Error("Cannot use higher-order sections without the original template");c=c.call(r.view,o.slice(t[3],t[5]),u),c!=null&&(a+=c)}else a+=this.renderTokens(t[4],r,n,o,i);return a}};_e.prototype.renderInverted=function(t,r,n,o,i){var s=r.lookup(t[1]);if(!s||ar(s)&&s.length===0)return this.renderTokens(t[4],r,n,o,i)};_e.prototype.indentPartial=function(t,r,n){for(var o=r.replace(/[^ \t]/g,""),i=t.split(`
|
|
68
|
+
`),s=0;s<i.length;s++)i[s].length&&(s>0||!n)&&(i[s]=o+i[s]);return i.join(`
|
|
69
|
+
`)};_e.prototype.renderPartial=function(t,r,n,o){if(n){var i=this.getConfigTags(o),s=da(n)?n(t[1]):n[t[1]];if(s!=null){var a=t[6],c=t[5],u=t[4],l=s;c==0&&u&&(l=this.indentPartial(s,u,a));var p=this.parse(l,i);return this.renderTokens(p,r,n,l,o)}}};_e.prototype.unescapedValue=function(t,r){var n=r.lookup(t[1]);if(n!=null)return n};_e.prototype.escapedValue=function(t,r,n){var o=this.getConfigEscape(n)||Le.escape,i=r.lookup(t[1]);if(i!=null)return typeof i=="number"&&o===Le.escape?String(i):o(i)};_e.prototype.rawValue=function(t){return t[1]};_e.prototype.getConfigTags=function(t){return ar(t)?t:t&&typeof t=="object"?t.tags:void 0};_e.prototype.getConfigEscape=function(t){if(t&&typeof t=="object"&&!ar(t))return t.escape};var Le={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(e){Dr.templateCache=e},get templateCache(){return Dr.templateCache}},Dr=new _e;Le.clearCache=function(){return Dr.clearCache()};Le.parse=function(t,r){return Dr.parse(t,r)};Le.render=function(t,r,n,o){if(typeof t!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+Ik(t)+'" was given as the first argument for mustache#render(template, view, partials)');return Dr.render(t,r,n,o)};Le.escape=Vk;Le.Scanner=Nr;Le.Context=sr;Le.Writer=_e;var yf=Le;import{fileURLToPath as Jk}from"url";var fa=class extends Error{constructor(t,r=void 0){super(t+(r?": "+r.message:"")),this.name="BuildError"}},Qk={yaml:{entry:e=>Object.entries(e).map(t=>t[0]+": "+JSON.stringify(t[1]))},js:{}},bf=(e,t,r=null)=>{let n=Zk(e);try{let o=yf.render(vf.readFileSync(n,"utf-8"),{...t,...Qk.yaml});return r&&vf.writeFileSync(It.resolve(r,e),o,"utf8"),o}catch(o){throw new fa(`Could not process "${n}"`,o)}},Un=()=>It.resolve(It.dirname(Jk(import.meta.url)),"../package.json"),_f=()=>It.resolve(It.dirname(Un())),Zk=e=>It.resolve(It.dirname(Un()),"templates",e);var iw=["js","mjs","ts","yaml","yml"],xf=async()=>{function e(r){if(typeof r=="string"){if(r==="true")return!0;if(r==="false")return!1;if(/^\d+$/.test(r)){let n=Number(r);if(!isNaN(n))return n}if(/^\d+\.\d+$/.test(r)){let n=Number(r);if(!isNaN(n))return n}return r}if(Array.isArray(r))return r.map(n=>e(n));if(r&&typeof r=="object"){let n={};for(let[o,i]of Object.entries(r))n[o]=e(i);return n}return r}let t=(0,Ef.config)({path:rw(process.cwd(),".env")}).parsed;return e(t)},sw=Lr.join(Lr.dirname(Un()),"raclette.default.config.yaml"),Ft=async(e=sw,t={})=>{let n={env:{[process.env?.environment||"development"]:t}},o=tw(e),i;try{switch(ew(e)){case".*":let s=e.slice(0,-1);i=await Ft(s+iw.find(a=>qn.existsSync(s+a)));break;case".yaml":case".yml":i=ke.load(qn.readFileSync(o,"utf8"),{filename:e});break;case".ts":case".mjs":case".js":i=(await import(`${ow(o).href}?t=${Date.now()}`)).default;break;default:throw new TypeError(`config.load() does not support ${e} file extension.`)}}catch(s){throw new Error(`Failed to load config ${o}: ${s?.message}`)}return vt(i,n)},kf=(e="null")=>{try{return ke.load(e)}catch(t){throw new Error(`Failed to parse config: ${t?.message}`)}},ha=(...e)=>{let t=e[0];for(let r of e.slice(1))t=vt(t,r);return t},ma=async(e,t)=>{f.debug("Generating service configuration files...");let r={name:e.name,env:e.env,modules:e.modules,plugins:e.plugins,global:e.global};for(let n of Ye){let o=Lr.join(t,n);qn.ensureDirSync(o);let i={...r,service:n,...e[n]},s=`// Generated Raclette ${n} Configuration
|
|
70
|
+
// This file is auto-generated, do not edit directly
|
|
71
|
+
|
|
72
|
+
export const racletteConfig = ${JSON.stringify(i,null,2)};
|
|
73
|
+
|
|
74
|
+
export default racletteConfig;
|
|
75
|
+
`;qn.writeFileSync(Lr.join(o,"raclette.config.js"),s)}},wf=(e,t)=>{let r=pf(Lr.join(e,"raclette.config"));f.progress(`\u{1F50D} Watching for changes in original config: ${r}`);let n=nw.watch(r,{ignored:/(^|[/\\])\../,persistent:!0});return n.on("change",async o=>{f.progress(`\u{1F4DD} Original config file changed: ${o}`);try{await Ft(r,t)}catch(i){f.error("Error reloading configuration: "+i.message)}}),()=>n.close()};import{spawn as Ta}from"child_process";import Ot,{pathExists as Lw}from"fs-extra";import Ie from"path";import Xn from"fs-extra";import lr from"path";import{execSync as lt}from"child_process";import cw from"fs-extra";var Yn=null,ga=()=>{if(Yn)return Yn;let e=lw(),t=uw(e),r=e,n=!0,o=pw(t);return Yn={dockerPath:e,composeCommand:r,isModernCompose:n,version:t,isDocker28Plus:o},Yn};var lw=()=>{try{let e;process.platform==="win32"?e=lt("where docker",{stdio:"pipe",encoding:"utf8"}).trim().split(`
|
|
76
|
+
`)[0]:e=lt("which docker",{stdio:"pipe",encoding:"utf8"}).trim();try{return lt(`"${e}" --version`,{stdio:"pipe"}),e}catch{throw new Error(`Docker found at ${e} but not executable`)}}catch{let t=["/Applications/Docker.app/Contents/Resources/bin/docker","/usr/local/bin/docker","C:\\Program Files\\Docker\\Docker\\resources\\bin\\docker.exe","C:\\Program Files\\Docker\\Docker\\resources\\docker.exe","/usr/bin/docker","/snap/docker/current/bin/docker"];for(let r of t)if(cw.existsSync(r))try{return lt(`"${r}" --version`,{stdio:"pipe"}),f.debug(h.yellow(`Found Docker at: ${r}`)),r}catch{}throw new Error("Docker not found in PATH or common installation locations")}},uw=e=>{try{return lt(`"${e}" --version`,{stdio:"pipe",encoding:"utf8"}).trim()}catch{return console.warn(h.yellow("Could not determine Docker version")),"unknown"}},pw=e=>{let t=e.match(/Docker version (\d+)\.(\d+)/);if(!t)return!1;let r=parseInt(t[1]),n=parseInt(t[2]);return r>28||r===28&&n>=0},Kn=()=>{f.raw(h.blue("\u{1F433} Checking Docker installation..."));try{let e=ga();f.debug(`\u2705 Docker found at: ${e.dockerPath}`),f.debug(`Docker version: ${e.version}`);try{lt(`"${e.dockerPath}" compose version`,{stdio:"pipe"}),f.debug("\u2705 Docker Compose (modern) is available")}catch{throw console.error(h.red(`
|
|
77
|
+
\u274C Modern Docker Compose is not available`)),console.warn(h.yellow(`
|
|
78
|
+
\u{1F4CB} Raclette requires Docker with integrated 'compose' command`)),console.warn(h.yellow("Please update to Docker version 20.10.13+ or Docker Desktop 4.1.0+")),new Error("Modern Docker Compose is required")}e.isDocker28Plus&&f.debug("\u26A0\uFE0F Detected Docker 28+, using enhanced path resolution");try{lt(`"${e.dockerPath}" info`,{stdio:"pipe",encoding:"utf8"}),f.success(" Docker daemon is running")}catch{throw f.error("Docker daemon is not running"),f.warn("Please start Docker Desktop or the Docker daemon and try again."),process.platform==="darwin"?console.log(h.yellow(`
|
|
79
|
+
macOS: Start Docker Desktop from the Applications folder`)):process.platform==="win32"?console.log(h.yellow(`
|
|
80
|
+
Windows: Start Docker Desktop from the Start menu`)):console.log(h.yellow(`
|
|
81
|
+
Linux: Start Docker daemon with "systemctl start docker"`)),new Error("Docker daemon is not running")}return e}catch(e){throw e.message.includes("Docker daemon is not running")||e.message.includes("Modern Docker Compose is required")?e:(f.error("Docker installation issue: "+e.message),console.log(h.yellow(`
|
|
82
|
+
\u{1F4E5} Installation guide:`)),console.log(h.yellow(" \u2022 Mac: https://docs.docker.com/desktop/install/mac/")),console.log(h.yellow(" \u2022 Windows: https://docs.docker.com/desktop/install/windows/")),console.log(h.yellow(" \u2022 Linux: https://docs.docker.com/engine/install/")),new Error("Docker is not installed or not accessible"))}},pe=(e,t={})=>{let n=`"${ga().dockerPath}" ${e.join(" ")}`;try{let o=lt(n,{...t,stdio:t.stdio||"pipe",encoding:t.stdio==="inherit"?void 0:t.encoding||"utf8",shell:!0});return typeof o=="string"?o:""}catch(o){throw new Error(`Docker command failed: ${n}
|
|
83
|
+
Error: ${o.message}`)}},Ee=(e,t={})=>{let n=`"${ga().composeCommand}" compose ${e.join(" ")}`;f.debug(`Execute Docker Command: ${n}`);try{let o=lt(n,{stdio:"pipe",encoding:"utf8",shell:!0,...t});return typeof o=="string"?o:""}catch(o){throw new Error(`Docker Compose command failed: ${n}
|
|
84
|
+
Error: ${o.message}`)}},Ir=e=>{try{return pe(["ps","-a","--filter",`name=^${e}$`,"--format",'"{{.Names}}"']).trim().split(`
|
|
85
|
+
`).some(r=>r.trim()===e)}catch{return!1}},cr=e=>{try{return pe(["ps","--filter",`name=^${e}$`,"--format",'"{{.Names}}"']).trim().split(`
|
|
86
|
+
`).some(r=>r.trim()===e)}catch{return!1}},zn=e=>{f.debug(`\u{1F310} Checking for Docker network '${e}'...`);try{pe(["network","inspect",e]),f.debug(`\u2705 Network '${e}' already exists`);return}catch{f.debug(`\u{1F310} Creating Docker network '${e}'...`);try{pe(["network","create",e],{stdio:"inherit"}),f.debug(`\u2705 Network '${e}' created`)}catch(r){if(r.message?.includes("already exists")){f.debug(`\u2705 Network '${e}' already exists`);return}throw f.error("Failed to create network: "+r.message),r}}},ya=(e,t,r={})=>pe(["exec",e,"sh","-c",`"${t}"`],r),dw=e=>{try{let t=pe(["ps","-a","--filter",`name=^${e}`,"--format",'"{{.Names}}"']);return t.trim()?t.trim().split(`
|
|
87
|
+
`).filter(r=>r.trim().length>0):[]}catch{return[]}},Cf=e=>{let t=dw(e);if(t.length===0){f.debug(`\u26A0\uFE0F No containers found with prefix '${e}'`);return}f.debug(`\u26A0\uFE0F Found ${t.length} container(s) with prefix '${e}':`),t.forEach(r=>{f.debug(` - ${r}`)});try{f.debug("Stopping containers..."),pe(["stop",...t],{stdio:"inherit"}),f.debug("Removing containers..."),pe(["rm",...t],{stdio:"inherit"}),f.success(`Successfully stopped and removed ${t.length} container(s)`)}catch(r){throw f.error(`Failed to stop containers with prefix '${e}': ${r.message}`),r}};var fw="raclette-public-shared",hw=e=>e&&(e.startsWith("./")?"../"+e.substring(2):e.startsWith("../")?"../../"+e.substring(3):e),va=(e,t)=>lr.isAbsolute(e)||!e.includes("/")&&!e.includes("\\")?e:e.startsWith("./")||e.startsWith("../")?lr.resolve(t,e):lr.resolve(t,e),Jn=(e,t)=>{if(!e||typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>Jn(n,t));let r={};for(let[n,o]of Object.entries(e))typeof o=="string"&&(n==="source"||n==="device")?r[n]=va(o,t):typeof o=="string"&&(n==="context"||n==="dockerfile"||n.endsWith("Path")||n.endsWith("Dir")||n.includes("path")||n.includes("Path"))?r[n]=hw(o):o&&typeof o=="object"?r[n]=Jn(o,t):r[n]=o;return r},Rt=(e,t)=>{let r=Jn(e,t);if(r.source&&r.source.includes("/")&&(r.source=va(r.source,t)),r.mustExist&&!Xn.existsSync(r.source))return f.debug(`Skipping volume mount: ${r.source} does not exist`),null;if(!r.type&&!r.readonly&&!r.volumeOptions&&!r.bindOptions&&!r.tmpfsOptions)return`${r.source}:${r.target}${r.readonly?":ro":""}`;let n={type:r.type||"volume",source:r.source,target:r.target};return r.readonly&&(n.read_only=!0),r.volumeOptions&&(n.volume=r.volumeOptions),r.bindOptions&&(n.bind=r.bindOptions),r.tmpfsOptions&&(n.tmpfs=r.tmpfsOptions),n},mw=(e,t)=>{if(!e.includes("/")||e.startsWith("${"))return e;let r=e.split(":");if(r.length<2)return e;let n=r[0],o=r[1],i=r.slice(2).join(":"),s=va(n,t);return i?`${s}:${o}:${i}`:`${s}:${o}`},Qn=(e,t)=>e.map(r=>typeof r=="string"?mw(r,t):r).map(r=>r),ba=async(e,t,r,n=!1,o="development",i=!0,s=!0)=>{let a={services:{},volumes:{"yarn-cache":{driver:"local"}},networks:{raclette_shared:{external:!0,name:"raclette_shared"}}},c=e.env[o]||{};a.volumes[fw]=null,e.volumes&&Object.entries(e.volumes).forEach(([p,d])=>{d===null?a.volumes[p]=null:a.volumes[p]=Jn(d,t)});let u=!1,l=!1;if(i&&s){if(e.services.mongodb?.enabled&&e.services.mongodb.name){let p=e.services.mongodb.name;Ir(p)&&(f.debug(`MongoDB container '${p}' already exists, will be skipped`),u=!0)}if(e.services.cache?.enabled&&e.services.cache.name){let p=e.services.cache.name;Ir(p)&&(f.debug(`Cache container '${p}' already exists, will be skipped`),l=!0)}}if(e.services.mongodb?.enabled&&!u){let d=!!e.services.mongodb.name?e.services.mongodb.name:`${e.name}-mongodb`,y=e.services.mongodb.volume?e.services.mongodb.volume:`${e.name}-mongodb-data`,g=e.services.mongodb.volumeConfig?e.services.mongodb.volumeConfig:`${e.name}-mongodb-config`;a.services.mongodb={container_name:`\${RACLETTE_MONGODB_CONTAINERNAME:-${d}}`,image:"mongo:8.2",restart:"unless-stopped",ports:[`127.0.0.1:\${RACLETTE_MONGODB_PORT:-${e.services.mongodb.port}}:27017`],volumes:[`\${RACLETTE_MONGODB_VOLUME:-${y}}:/data/db`,`\${RACLETTE_MONGODB_CONFIG_VOLUME:-${g}}:/data/config`],networks:["raclette_shared"],healthcheck:{test:["CMD","mongosh","--eval","db.adminCommand('ping')"],interval:"10s",timeout:"30s",retries:20}},e.services.mongodb.volumes&&e.services.mongodb.volumes.length>0&&e.services.mongodb.volumes.forEach(m=>{let E=Rt(m,t);E&&a.services.mongodb.volumes.push(E)}),!y.startsWith("/")&&!y.startsWith("./")&&(a.volumes[y]=null),!g.startsWith("/")&&!g.startsWith("./")&&(a.volumes[g]=null)}if(e.services.cache?.enabled&&!l){let d=!!e.services.cache.name?e.services.cache.name:`${e.name}-cache`,y=e.services.cache.volume?e.services.cache.volume:`${e.name}-cache-data`;a.services.cache={container_name:`\${RACLETTE_CACHE_CONTAINERNAME:-${d}}`,image:"valkey/valkey:9.0-alpine",ports:[`127.0.0.1:\${RACLETTE_CACHE_PORT:-${e.services.cache.port}}:6379`],volumes:[`\${RACLETTE_CACHE_VOLUME:-${y}}:/data`],networks:["raclette_shared"],healthcheck:{test:["CMD","valkey-cli","ping"],interval:"10s",timeout:"5s",retries:3}};let g=e?.backend?.cache?.RDB_OPTIONS??"3600 1 300 100 60 10000",m=e?.backend?.cache?.persistence||"none";m==="none"&&(a.services.cache.command='valkey-server --save ""'),m==="aof"&&(a.services.cache.command="valkey-server --appendonly yes"),m==="rdb"&&(a.services.cache.command="valkey-server --save "+g),m==="rdb+aof"&&(a.services.cache.command="valkey-server --appendonly yes --save "+g),e.services.cache.volumes&&e.services.cache.volumes.length>0&&e.services.cache.volumes.forEach(E=>{let x=Rt(E,t);x&&a.services.cache.volumes.push(x)}),!y.startsWith("/")&&!y.startsWith("./")&&(a.volumes[y]=null)}if(!n){let p=process.env.RACLETTE_DEBUG_PORT||(e.services?.backend?.enableDebug?9229:void 0);if(e.services.backend?.enabled){let d=e.services.backend.name??`${e.name}-backend`,y=e.services.backend.nodeModulesVolume||`${e.name}-backend_node_modules`;a.services.backend={container_name:`\${RACLETTE_SERVER_CONTAINERNAME:-${d}}`,build:{context:".",dockerfile:"./backend.Dockerfile",args:{NODE_ENV:o}},command:p?"yarn run dev:inspect":"yarn dev",environment:[`NODE_ENV=\${NODE_ENV:-${o}}`,"DISABLE_PLUGIN_LOGS=${RACLETTE_DISABLE_PLUGIN_LOGS:-false}","SERVER_TOKEN_SECRET=${RACLETTE_SERVER_TOKEN_SECRET:-thisshouldbesetforproduction}","RACLETTE_FRONTEND_URLS=${RACLETTE_FRONTEND_URLS:-}",`MONGO_HOST=\${RACLETTE_MONGODB_HOST:-mongodb://mongodb:\${RACLETTE_MONGODB_PORT:-${e.services.mongodb?.port||27017}}/\${RACLETTE_MONGODB_DATABASE:-${e.services.mongodb?.databaseName||e.name}}}`,`CACHE_URL=\${RACLETTE_CACHE_URL:-redis://cache:\${RACLETTE_CACHE_PORT:-${e.services.cache?.port||6379}}}${e.services.cache?.db?`/${e.services.cache?.db}`:""}`,...Object.entries(c).map(([g,m])=>`${g}=${m}`)],volumes:["yarn-cache:/usr/local/share/.cache/yarn",`${y}:/app/node_modules`,"./.raclette/virtual/backend/src:/app/src","./plugins:/app/src/appPlugins",...o==="development"?["./.raclette/backend/raclette.config.js:/app/raclette.config.js",`${ur("backend",e)}:/app/yarn.lock`]:[]],ports:[`\${RACLETTE_SERVER_PORT:-${e.services.backend.port}}:3000`,...p?[`${p||"9229"}:9229`]:[]],networks:["raclette_shared"],depends_on:{},healthcheck:{test:["CMD","curl","-f","http://0.0.0.0:3000/health"],interval:"10s",timeout:"30s",retries:10}},e.services.backend.volumes&&e.services.backend.volumes.length>0&&e.services.backend.volumes.forEach(g=>{let m=Rt(g,t);m&&a.services.backend.volumes.push(m)}),e.services.mongodb?.enabled&&!u&&(a.services.backend.depends_on.mongodb={condition:"service_started"}),e.services.cache?.enabled&&!l&&(a.services.backend.depends_on.cache={condition:"service_healthy"}),Object.keys(a.services.backend.depends_on).length===0&&delete a.services.backend.depends_on,a.volumes[y]=null}if(e.services.frontend?.enabled){let d=e.services.frontend.name??`${e.name}-frontend`,y=e.services.frontend.nodeModulesVolume||`${e.name}-frontend_node_modules`,g=8081;a.services.frontend={container_name:`\${RACLETTE_CLIENT_CONTAINERNAME:-${d}}`,build:{context:".",dockerfile:"./frontend.Dockerfile",args:{NODE_ENV:`\${NODE_ENV:-${o}}`},target:`\${NODE_ENV:-${o}}`},command:"yarn dev",depends_on:{},environment:[`NODE_ENV=\${NODE_ENV:-${o}}`,"RACLETTE_DEBUG_MODE=${RACLETTE_DEBUG_MODE:-true}",`RACLETTE_SERVER_BASE_URL=\${RACLETTE_SERVER_BASE_URL:-http://localhost:\${RACLETTE_SERVER_PORT:-${e.services.backend?.port||8082}}}`,`RACLETTE_SOCKET_URL=\${RACLETTE_SOCKET_URL:-http://localhost:\${RACLETTE_SERVER_PORT:-${e.services.backend?.port||8082}}}`,...Object.entries(c).map(([m,E])=>`${m}=${E}`)],volumes:["yarn-cache:/usr/local/share/.cache/yarn","./.raclette/virtual/frontend/src:/app/src","./.raclette/virtual/backend/src/shared:/app/src/shared",`${y}:/app/node_modules`,"./plugins:/app/src/plugins","./.raclette/virtual/backend/src/corePlugins:/app/src/corePlugins",...o==="development"?["./.raclette/frontend/raclette.config.js:/app/raclette.config.js",`${ur("frontend",e)}:/app/yarn.lock`]:[]],ports:[`\${RACLETTE_CLIENT_PORT:-${e.services.frontend.port}}:8081`],networks:["raclette_shared"],healthcheck:{test:["CMD","curl","-f","http://0.0.0.0:8081/"],interval:"10s",timeout:"30s",retries:10}},o!=="production"&&(a.services.frontend.volumes.push("./.raclette/dist/check-dependencies.sh:/app/check-dependencies.sh"),a.services.frontend.volumes.push("./.raclette/frontend/package.json:/app/package.json"),a.services.frontend.entrypoint=["/app/check-dependencies.sh"],a.services.backend.volumes.push("./.raclette/dist/check-dependencies.sh:/app/check-dependencies.sh"),a.services.backend.entrypoint=["/app/check-dependencies.sh"],a.services.backend.volumes.push("./.raclette/backend/package.json:/app/package.json")),e.services.frontend.volumes&&e.services.frontend.volumes.length>0&&e.services.frontend.volumes.forEach(m=>{let E=Rt(m,t);E&&a.services.frontend.volumes.push(E)}),e.services.backend?.enabled&&(a.services.frontend.depends_on.backend={condition:"service_healthy"}),Object.keys(a.services.frontend.depends_on).length===0&&delete a.services.frontend.depends_on,a.volumes[y]=null}if(e.env?.development?.RACLETTE_CORE_ABSOLUTE_PATH){let d=e.env?.development?.RACLETTE_CORE_ABSOLUTE_PATH,y=d&&!d.endsWith("/")?d+"/":d;a.services.backend?.volumes?.push(`${y}services/backend/src/corePlugins:/app/src/corePlugins`),a.services.frontend?.volumes?.push(`${y}services/backend/src/corePlugins:/app/src/corePlugins`)}}Object.values(a.services).forEach(p=>{p.volumes&&(p.volumes=Qn(p.volumes,t))}),await Xn.writeFile(r,ke.dump(a)),await Zn(e,lr.dirname(r),o)},ur=(e,t)=>{let r=t.lockFiles?.[e];return r||`./${e}.yarn.lock`},Af=async(e,t,r,n="development")=>{await ba(e,t,r,!1,n,!1,!1)},Zn=async(e,t,r)=>{let n=lr.join(t,"backend.Dockerfile"),o=`FROM node:24.4-alpine3.21
|
|
88
|
+
WORKDIR /app
|
|
89
|
+
|
|
90
|
+
# add bash since alpine doesn't come with a shell
|
|
91
|
+
RUN apk update && apk add bash curl ${(e.services.backend?.installPackages||[]).join(" ")}
|
|
92
|
+
|
|
93
|
+
COPY backend/package.json backend/yarn.lock ./
|
|
94
|
+
COPY backend/raclette.config.js ./
|
|
95
|
+
|
|
96
|
+
ARG NODE_ENV=${r}
|
|
97
|
+
|
|
98
|
+
# until we are published we can't install here due to the sensitive files
|
|
99
|
+
#RUN if [ "$NODE_ENV" = "development" ]; \\
|
|
100
|
+
# then yarn install; \\
|
|
101
|
+
# else yarn install --production=true; \\
|
|
102
|
+
# fi;
|
|
103
|
+
|
|
104
|
+
# make sure our raclette packages are being resolved by adding a symlink to handle nodes module resolution
|
|
105
|
+
RUN mkdir -p /app/node_modules/@raclettejs/core
|
|
106
|
+
RUN ln -sf /app/src /app/node_modules/@raclettejs/core/backend
|
|
107
|
+
|
|
108
|
+
COPY ./dist/check-dependencies.sh /app/
|
|
109
|
+
RUN chmod +x /app/check-dependencies.sh
|
|
110
|
+
|
|
111
|
+
# copy everything else that is not ignored (see .dockerignore)
|
|
112
|
+
COPY ./virtual/backend ./
|
|
113
|
+
|
|
114
|
+
# set default values
|
|
115
|
+
ENV PORT 3000
|
|
116
|
+
|
|
117
|
+
# set port
|
|
118
|
+
EXPOSE 3000
|
|
119
|
+
EXPOSE 9229
|
|
120
|
+
|
|
121
|
+
# default command
|
|
122
|
+
CMD ["yarn", "run", "${r==="production"?"build":"dev"}"]
|
|
123
|
+
`;await Xn.writeFile(n,o);let i=lr.join(t,"frontend.Dockerfile"),s=`FROM node:24-alpine3.21 AS build
|
|
124
|
+
WORKDIR /app
|
|
125
|
+
|
|
126
|
+
RUN apk update && apk add bash curl ${(e.services.frontend?.installPackages||[]).join(" ")}
|
|
127
|
+
|
|
128
|
+
# Copy package files first for better caching
|
|
129
|
+
COPY frontend/package.json frontend/yarn.lock ./
|
|
130
|
+
COPY frontend/raclette.config.js ./
|
|
131
|
+
|
|
132
|
+
ARG NODE_ENV=${r}
|
|
133
|
+
|
|
134
|
+
# until we are published we can't install here due to the sensitive files
|
|
135
|
+
# Install dependencies
|
|
136
|
+
#RUN if [ "$NODE_ENV" = "development" ]; \\
|
|
137
|
+
# then yarn install; \\
|
|
138
|
+
# else yarn install --production=false; \\
|
|
139
|
+
# fi
|
|
140
|
+
|
|
141
|
+
# Copy source files - we'll handle development overrides through volumes
|
|
142
|
+
COPY ./virtual/frontend/ ./
|
|
143
|
+
|
|
144
|
+
COPY ./dist/check-dependencies.sh /app/
|
|
145
|
+
RUN chmod +x /app/check-dependencies.sh
|
|
146
|
+
|
|
147
|
+
RUN rm -rf ./src/shared
|
|
148
|
+
|
|
149
|
+
# Now copy the actual shared folder - be explicit with the path
|
|
150
|
+
COPY virtual/backend/src/shared/ ./src/shared/
|
|
151
|
+
|
|
152
|
+
# Ports
|
|
153
|
+
ENV PORT ${e.services.frontend?.port||8081}
|
|
154
|
+
EXPOSE ${e.services.frontend?.port||8081}
|
|
155
|
+
|
|
156
|
+
# Add development target
|
|
157
|
+
FROM build AS development
|
|
158
|
+
CMD ["yarn", "run", "dev"]
|
|
159
|
+
|
|
160
|
+
# ----------------------------------------------------------------
|
|
161
|
+
# 2. production stage
|
|
162
|
+
# Here we will use a new docker image, which is only the web server
|
|
163
|
+
FROM nginx:stable-alpine AS production
|
|
164
|
+
WORKDIR /app
|
|
165
|
+
|
|
166
|
+
# Copy nginx config as a template
|
|
167
|
+
COPY frontend/provision/nginx.conf /etc/nginx/conf.d/default.conf.template
|
|
168
|
+
|
|
169
|
+
COPY --from=build app/dist /usr/share/nginx/html
|
|
170
|
+
COPY frontend/provision/entrypoint.sh /docker-entrypoint.d/entrypoint.sh
|
|
171
|
+
|
|
172
|
+
# Make sure the entrypoint is executable
|
|
173
|
+
RUN chmod +x /docker-entrypoint.d/entrypoint.sh
|
|
174
|
+
|
|
175
|
+
ENV PORT 80
|
|
176
|
+
EXPOSE 80
|
|
177
|
+
|
|
178
|
+
CMD ["nginx", "-g", "daemon off;"]`;await Xn.writeFile(i,s)};import Sf from"path";var eo=async(e,t,r)=>Ye.filter(n=>r||e.services[n]?.enabled),to=async(e,t,r,n={})=>{if(r.length===0)return;console.log(h.blue(`\u{1F504} Rebuilding services: ${r.join(", ")}`));let o=Sf.join(t,"docker-compose.yml"),s=["-p",e.name??Sf.basename(process.cwd()),"-f",o,"build"];n.noCache&&s.push("--no-cache");for(let a of r)try{console.log(h.blue(`\u{1F504} Rebuilding ${a} service...`)),Ee([...s,a],{stdio:"inherit"}),f.success(` Service ${a} rebuilt successfully`)}catch(c){f.error(`Error rebuilding service ${a}: ${c.message}`)}};import Bf from"fs-extra";import Hf from"path";var Rf=(e=!1)=>["eslint","@eslint/js","globals","eslint-config-prettier","prettier","eslint-plugin-prettier",...e?_a():[]],_a=()=>[],Of=()=>["import globals from 'globals';","import eslintConfigPrettier from 'eslint-config-prettier';"],Tf=(e=!1)=>{let t=` // JavaScript config
|
|
179
|
+
{
|
|
180
|
+
files: ["**/*.{js,mjs,cjs}"],
|
|
181
|
+
languageOptions: {
|
|
182
|
+
globals: {
|
|
183
|
+
...globals.browser,
|
|
184
|
+
...globals.node,
|
|
185
|
+
test: "readonly",
|
|
186
|
+
expect: "readonly",
|
|
187
|
+
it: "readonly",
|
|
188
|
+
cy: "readonly"
|
|
189
|
+
},
|
|
190
|
+
ecmaVersion: 2022,
|
|
191
|
+
sourceType: 'module'
|
|
192
|
+
},
|
|
193
|
+
rules: {
|
|
194
|
+
// Common recommended rules
|
|
195
|
+
"no-console": "warn",
|
|
196
|
+
"prefer-const": "error",
|
|
197
|
+
"no-unused-vars": "warn",
|
|
198
|
+
"curly": ["error", "all"],
|
|
199
|
+
"eqeqeq": ["error", "always"],
|
|
200
|
+
"require-await": "error",
|
|
201
|
+
"padding-line-between-statements": [
|
|
202
|
+
"error",
|
|
203
|
+
// nextline after const
|
|
204
|
+
{ blankLine: "always", prev: "const", next: "*" },
|
|
205
|
+
// nextline after let
|
|
206
|
+
{ blankLine: "always", prev: "let", next: "*" },
|
|
207
|
+
// allow const after const
|
|
208
|
+
{ blankLine: "any", prev: "const", next: "const" },
|
|
209
|
+
// allow let after const
|
|
210
|
+
{ blankLine: "any", prev: "const", next: "let" },
|
|
211
|
+
// allow const after let
|
|
212
|
+
{ blankLine: "any", prev: "let", next: "const" },
|
|
213
|
+
// allow let after let
|
|
214
|
+
{ blankLine: "any", prev: "let", next: "let" },
|
|
215
|
+
// add blank line before return statements
|
|
216
|
+
{ blankLine: "always", prev: "*", next: "return" },
|
|
217
|
+
// new line between method declarations
|
|
218
|
+
{ blankLine: "always", prev: "const", next: "block-like" }
|
|
219
|
+
]
|
|
220
|
+
}
|
|
221
|
+
}`;return e?t+`,
|
|
222
|
+
|
|
223
|
+
`+gw():t},gw=()=>` // Style recommended config
|
|
224
|
+
{
|
|
225
|
+
files: ["**/*.{js,mjs,cjs,ts,tsx}"],
|
|
226
|
+
rules: {
|
|
227
|
+
// Style and formatting rules
|
|
228
|
+
"semi": ["error", "never"],
|
|
229
|
+
"quotes": ["error", "double", { "avoidEscape": true }],
|
|
230
|
+
"comma-dangle": ["error", "always-multiline"],
|
|
231
|
+
"no-multiple-empty-lines": ["error", { "max": 1, "maxEOF": 0 }],
|
|
232
|
+
"object-curly-spacing": ["error", "always"],
|
|
233
|
+
"array-bracket-spacing": ["error", "never"],
|
|
234
|
+
"computed-property-spacing": ["error", "never"],
|
|
235
|
+
"comma-spacing": ["error", { "before": false, "after": true }],
|
|
236
|
+
"eol-last": ["error", "always"],
|
|
237
|
+
"indent": ["error", 2],
|
|
238
|
+
"linebreak-style": ["error", "unix"],
|
|
239
|
+
"no-trailing-spaces": "error",
|
|
240
|
+
"dot-notation": ["error", { allowKeywords: true }],
|
|
241
|
+
"id-length": [
|
|
242
|
+
"error",
|
|
243
|
+
{ min: 3, exceptions: ["i", "j", "a", "b", "fs", "id"], properties: "never" },
|
|
244
|
+
],
|
|
245
|
+
}
|
|
246
|
+
}`;var Ea=(e=!1)=>["eslint-plugin-react","eslint-plugin-react-hooks",...e?xa():[]],xa=()=>[],Pf=()=>["import react from 'eslint-plugin-react';","import reactHooks from 'eslint-plugin-react-hooks';"],$f=(e=!1)=>{let t=` // React config
|
|
247
|
+
{
|
|
248
|
+
files: ["**/*.{jsx,tsx}"],
|
|
249
|
+
plugins: {
|
|
250
|
+
react,
|
|
251
|
+
'react-hooks': reactHooks
|
|
252
|
+
},
|
|
253
|
+
rules: {
|
|
254
|
+
// Essential React rules
|
|
255
|
+
"react/jsx-uses-react": "error",
|
|
256
|
+
"react/jsx-uses-vars": "error",
|
|
257
|
+
"react-hooks/rules-of-hooks": "error",
|
|
258
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
259
|
+
|
|
260
|
+
// Additional sensible React rules
|
|
261
|
+
"react/prop-types": "warn",
|
|
262
|
+
"react/jsx-no-duplicate-props": "error",
|
|
263
|
+
"react/jsx-no-undef": "error",
|
|
264
|
+
"react/jsx-pascal-case": "error",
|
|
265
|
+
"react/no-direct-mutation-state": "error",
|
|
266
|
+
"react/no-unescaped-entities": "error"
|
|
267
|
+
}
|
|
268
|
+
}`;return e?t+`,
|
|
269
|
+
|
|
270
|
+
`+yw():t},yw=()=>"";var Df=(e=!1)=>["typescript-eslint",...e?ka():[]],ka=()=>["eslint-plugin-import","eslint-plugin-prefer-arrow-functions"],Nf=e=>{let t=["import tseslint from 'typescript-eslint';"];return e&&(t.push("import importPlugin from 'eslint-plugin-import';"),t.push("import preferArrow from 'eslint-plugin-prefer-arrow-functions';")),t},Lf=(e=!1)=>{let r=` // TypeScript config
|
|
271
|
+
{
|
|
272
|
+
files: ["**/*.{ts,tsx}"],
|
|
273
|
+
plugins: ${e?`{
|
|
274
|
+
'@typescript-eslint': tseslint.plugin,
|
|
275
|
+
'import': importPlugin,
|
|
276
|
+
'prefer-arrow': preferArrow
|
|
277
|
+
}`:`{
|
|
278
|
+
'@typescript-eslint': tseslint.plugin
|
|
279
|
+
}`},
|
|
280
|
+
languageOptions: {
|
|
281
|
+
parser: tseslint.parser,
|
|
282
|
+
parserOptions: {
|
|
283
|
+
ecmaVersion: 2022,
|
|
284
|
+
sourceType: 'module',
|
|
285
|
+
project: './tsconfig.json'
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
rules: {
|
|
289
|
+
// Basic TypeScript rules
|
|
290
|
+
'no-unused-vars': 'off', // disable JS rule in favor of TS rule
|
|
291
|
+
'@typescript-eslint/no-unused-vars': ['warn', {
|
|
292
|
+
argsIgnorePattern: '^(_|error|config|options|args|props|params|fastify|req|request|res|reply)',
|
|
293
|
+
varsIgnorePattern: '^(_|error|config|options|args|props|params)',
|
|
294
|
+
caughtErrorsIgnorePattern: '^(_|error|config|options|args|props|params)'
|
|
295
|
+
}]
|
|
296
|
+
}
|
|
297
|
+
}`;return e?r+`,
|
|
298
|
+
|
|
299
|
+
`+vw():r},vw=()=>` // TypeScript recommended config
|
|
300
|
+
{
|
|
301
|
+
files: ["**/*.{ts,tsx}"],
|
|
302
|
+
rules: {
|
|
303
|
+
// More opinionated TypeScript rules
|
|
304
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
305
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
306
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
307
|
+
'@typescript-eslint/no-non-null-assertion': 'warn',
|
|
308
|
+
'@typescript-eslint/no-inferrable-types': 'warn',
|
|
309
|
+
'@typescript-eslint/naming-convention': [
|
|
310
|
+
'error',
|
|
311
|
+
{
|
|
312
|
+
selector: 'interface',
|
|
313
|
+
format: ['PascalCase'],
|
|
314
|
+
custom: {
|
|
315
|
+
regex: '^I[A-Z]',
|
|
316
|
+
match: false
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
selector: 'typeAlias',
|
|
321
|
+
format: ['PascalCase']
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
selector: 'enum',
|
|
325
|
+
format: ['PascalCase']
|
|
326
|
+
}
|
|
327
|
+
],
|
|
328
|
+
'@typescript-eslint/consistent-type-imports': [
|
|
329
|
+
'error',
|
|
330
|
+
{
|
|
331
|
+
prefer: 'type-imports',
|
|
332
|
+
disallowTypeAnnotations: false
|
|
333
|
+
}
|
|
334
|
+
],
|
|
335
|
+
'@typescript-eslint/consistent-type-definitions': ['warn', 'interface'],
|
|
336
|
+
'@typescript-eslint/prefer-optional-chain': 'warn',
|
|
337
|
+
'@typescript-eslint/prefer-nullish-coalescing': 'warn',
|
|
338
|
+
'@typescript-eslint/prefer-ts-expect-error': 'warn',
|
|
339
|
+
|
|
340
|
+
// Import organization
|
|
341
|
+
'import/order': ['error', {
|
|
342
|
+
'groups': [
|
|
343
|
+
'type',
|
|
344
|
+
['builtin', 'external'],
|
|
345
|
+
['internal', 'parent', 'sibling', 'index'],
|
|
346
|
+
],
|
|
347
|
+
'alphabetize': {
|
|
348
|
+
'order': 'asc',
|
|
349
|
+
'caseInsensitive': true,
|
|
350
|
+
},
|
|
351
|
+
'pathGroups': [
|
|
352
|
+
// Handle all type imports first, from both external and internal
|
|
353
|
+
{
|
|
354
|
+
'pattern': 'type',
|
|
355
|
+
'group': 'type',
|
|
356
|
+
'position': 'before',
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
'pattern': '{type,types,Types}',
|
|
360
|
+
'group': 'type',
|
|
361
|
+
'position': 'before',
|
|
362
|
+
},
|
|
363
|
+
// Handle aliased paths as internal
|
|
364
|
+
{
|
|
365
|
+
'pattern': '@/**',
|
|
366
|
+
'group': 'internal',
|
|
367
|
+
}
|
|
368
|
+
],
|
|
369
|
+
'pathGroupsExcludedImportTypes': ['type'],
|
|
370
|
+
}],
|
|
371
|
+
|
|
372
|
+
// Arrow function preference
|
|
373
|
+
'prefer-arrow/prefer-arrow-functions': [
|
|
374
|
+
'error',
|
|
375
|
+
{
|
|
376
|
+
'disallowPrototype': true,
|
|
377
|
+
'singleReturnOnly': false,
|
|
378
|
+
'classPropertiesAllowed': false,
|
|
379
|
+
}
|
|
380
|
+
]
|
|
381
|
+
}
|
|
382
|
+
}`;var wa=(e=!1)=>["eslint-plugin-vue","vue-eslint-parser",...e?Ca():[]],Ca=()=>[],If=()=>["import vue from 'eslint-plugin-vue';","import vueEslintParser from 'vue-eslint-parser';"],Ff=(e=!1)=>{let t=` // Vue config
|
|
383
|
+
{
|
|
384
|
+
files: ["**/*.vue"],
|
|
385
|
+
// Manually add Vue plugin
|
|
386
|
+
plugins: {
|
|
387
|
+
vue
|
|
388
|
+
},
|
|
389
|
+
languageOptions: {
|
|
390
|
+
parser: vueEslintParser,
|
|
391
|
+
parserOptions: {
|
|
392
|
+
ecmaVersion: 2022,
|
|
393
|
+
sourceType: 'module',
|
|
394
|
+
parser: tseslint.parser,
|
|
395
|
+
extraFileExtensions: [".vue"]
|
|
396
|
+
}
|
|
397
|
+
},
|
|
398
|
+
rules: {
|
|
399
|
+
// Essential Vue rules (from ESLint plugin Vue)
|
|
400
|
+
"vue/multi-word-component-names": "off",
|
|
401
|
+
"vue/no-mutating-props": "error",
|
|
402
|
+
"vue/no-reserved-component-names": "error",
|
|
403
|
+
"vue/no-use-v-if-with-v-for": "error",
|
|
404
|
+
"vue/require-v-for-key": "error",
|
|
405
|
+
"vue/valid-template-root": "error",
|
|
406
|
+
"vue/valid-v-bind": "error",
|
|
407
|
+
"vue/valid-v-cloak": "error",
|
|
408
|
+
"vue/valid-v-else-if": "error",
|
|
409
|
+
"vue/valid-v-else": "error",
|
|
410
|
+
"vue/valid-v-for": "error",
|
|
411
|
+
"vue/valid-v-html": "error",
|
|
412
|
+
"vue/valid-v-if": "error",
|
|
413
|
+
"vue/valid-v-model": "error",
|
|
414
|
+
"vue/valid-v-on": "error",
|
|
415
|
+
"vue/valid-v-once": "error",
|
|
416
|
+
"vue/valid-v-pre": "error",
|
|
417
|
+
"vue/valid-v-show": "error",
|
|
418
|
+
"vue/valid-v-slot": "error",
|
|
419
|
+
"vue/valid-v-text": "error",
|
|
420
|
+
}
|
|
421
|
+
}`;return e?t+`,
|
|
422
|
+
|
|
423
|
+
`+bw():t},bw=()=>` // Vue recommended config
|
|
424
|
+
{
|
|
425
|
+
files: ["**/*.vue"],
|
|
426
|
+
rules: {
|
|
427
|
+
// Recommended Vue rules
|
|
428
|
+
"vue/component-name-in-template-casing": ["error", "PascalCase"],
|
|
429
|
+
"vue/match-component-file-name": [
|
|
430
|
+
"error",
|
|
431
|
+
{
|
|
432
|
+
extensions: ["vue"],
|
|
433
|
+
shouldMatchCase: true
|
|
434
|
+
}
|
|
435
|
+
],
|
|
436
|
+
"vue/match-component-import-name": "error",
|
|
437
|
+
"vue/attribute-hyphenation": "error",
|
|
438
|
+
"vue/component-definition-name-casing": ["error", "PascalCase"],
|
|
439
|
+
"vue/html-closing-bracket-newline": "error",
|
|
440
|
+
"vue/html-closing-bracket-spacing": "error",
|
|
441
|
+
"vue/html-end-tags": "error",
|
|
442
|
+
"vue/html-indent": ["error", 2],
|
|
443
|
+
"vue/html-quotes": "error",
|
|
444
|
+
"vue/html-self-closing": ["error", {
|
|
445
|
+
"html": {
|
|
446
|
+
"void": "any",
|
|
447
|
+
"normal": "any",
|
|
448
|
+
"component": "always"
|
|
449
|
+
}
|
|
450
|
+
}],
|
|
451
|
+
"vue/max-attributes-per-line": ["error", {
|
|
452
|
+
"singleline": 3,
|
|
453
|
+
"multiline": 1
|
|
454
|
+
}],
|
|
455
|
+
"vue/no-multi-spaces": "error",
|
|
456
|
+
"vue/no-spaces-around-equal-signs-in-attribute": "error",
|
|
457
|
+
"vue/no-template-shadow": "error",
|
|
458
|
+
"vue/one-component-per-file": "error",
|
|
459
|
+
"vue/prop-name-casing": ["error", "camelCase"],
|
|
460
|
+
"vue/require-default-prop": "error",
|
|
461
|
+
"vue/require-prop-types": "error",
|
|
462
|
+
"vue/v-bind-style": "error",
|
|
463
|
+
"vue/v-on-style": "error",
|
|
464
|
+
"vue/v-slot-style": "error"
|
|
465
|
+
}
|
|
466
|
+
}`;var jf=e=>{let t=e.eslint?.useRecommended!==!1,r=[...Rf(),...Df()];return e.frontend?.framework==="vue"?r.push(...wa()):e.frontend?.framework==="react"&&r.push(...Ea()),t&&(r.push(..._a(),...ka()),e.frontend?.framework==="vue"?r.push(...Ca()):e.frontend?.framework==="react"&&r.push(...xa())),[...new Set(r)]};import{existsSync as Aa}from"fs";import Sa from"path";var Mf=e=>{let t=[...e].sort(),r=Aa(Sa.join(process.cwd(),"yarn.lock")),n=Aa(Sa.join(process.cwd(),"pnpm-lock.yaml")),o=Aa(Sa.join(process.cwd(),"bun.lockb")),i="npm",s="install";return r?(i="yarn",s="add"):n?(i="pnpm",s="add"):o&&(i="bun",s="add"),`${i} ${s} -D ${t.join(" ")}`};var ro=async(e,t,r=!0)=>{let n=Hf.join(t,"eslint.config.mjs");f.debug(`Generating eslint.config.mjs in ${t}`);let o=e.eslint?.useRecommended!==!1,i=_w(e,o),s=[];if(s.push(` // TS ESLint base rules
|
|
467
|
+
{
|
|
468
|
+
files: ["**/*.{ts,tsx}"],
|
|
469
|
+
plugins: {
|
|
470
|
+
'@typescript-eslint': tseslint.plugin
|
|
471
|
+
},
|
|
472
|
+
languageOptions: {
|
|
473
|
+
parser: tseslint.parser
|
|
474
|
+
},
|
|
475
|
+
rules: {
|
|
476
|
+
// Essential TypeScript syntax rules - equivalent to tseslint.configs.recommended
|
|
477
|
+
"@typescript-eslint/ban-ts-comment": "warn",
|
|
478
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
479
|
+
"@typescript-eslint/no-var-requires": "error",
|
|
480
|
+
"@typescript-eslint/no-empty-interface": "warn",
|
|
481
|
+
"@typescript-eslint/no-inferrable-types": "warn",
|
|
482
|
+
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
|
483
|
+
"@typescript-eslint/no-non-null-assertion": "warn",
|
|
484
|
+
"@typescript-eslint/no-unnecessary-type-constraint": "error"
|
|
485
|
+
}
|
|
486
|
+
}`),s.push(` // Ignore patterns
|
|
487
|
+
{
|
|
488
|
+
ignores: [
|
|
489
|
+
"**/node_modules/**",
|
|
490
|
+
"**/dist/**",
|
|
491
|
+
"**/build/**",
|
|
492
|
+
"**/coverage/**",
|
|
493
|
+
"**/*.d.ts",
|
|
494
|
+
".raclette/**",
|
|
495
|
+
".gitignore"
|
|
496
|
+
]
|
|
497
|
+
}`),s.push(Tf(o)),s.push(Lf(o)),e.frontend?.framework==="vue"&&s.push(Ff(o)),e.frontend?.framework==="react"&&s.push($f(o)),e.eslint?.rules&&Object.keys(e.eslint.rules).length>0){let c=JSON.stringify(e.eslint.rules,null,2).replace(/"([^"]+)":/g,"$1:");s.push(` // User custom rules
|
|
498
|
+
{
|
|
499
|
+
rules: ${c}
|
|
500
|
+
}`)}if(e.eslint?.ignores&&e.eslint.ignores.length>0){let c=JSON.stringify(e.eslint.ignores).replace(/^\[|\]$/g,"");s.push(` // User custom ignores
|
|
501
|
+
{
|
|
502
|
+
ignores: [${c}]
|
|
503
|
+
}`)}s.push(` // Prettier config (must be last)
|
|
504
|
+
{
|
|
505
|
+
rules: {
|
|
506
|
+
...eslintConfigPrettier.rules
|
|
507
|
+
}
|
|
508
|
+
}`);let a=`/*#############################################################
|
|
509
|
+
|
|
510
|
+
Generated ESLint Configuration for ${e.name||"raclette"}
|
|
511
|
+
This file is auto-generated and should not be edited directly
|
|
512
|
+
Extend this config in your project's eslint.config.mjs
|
|
513
|
+
|
|
514
|
+
#############################################################*/
|
|
515
|
+
|
|
516
|
+
// Import required plugins and parsers
|
|
517
|
+
${i.join(`
|
|
518
|
+
`)}
|
|
519
|
+
|
|
520
|
+
// Exported configuration that can be extended
|
|
521
|
+
export const racletteEslintConfig = [
|
|
522
|
+
${s.join(`,
|
|
523
|
+
|
|
524
|
+
`)}
|
|
525
|
+
]
|
|
526
|
+
|
|
527
|
+
// Helper function for extending the config
|
|
528
|
+
export const withRaclette = (...userConfigs) => {
|
|
529
|
+
// Simple array concatenation
|
|
530
|
+
return [...racletteEslintConfig, ...userConfigs.flat()];
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
// Default export for direct usage
|
|
534
|
+
export default racletteEslintConfig
|
|
535
|
+
`;await Bf.writeFile(n,a),r&&await Ew(t,e),f.debug(`Generated eslint.config.mjs in ${t}`)},_w=(e,t)=>{let r=[];return r.push(...Of()),r.push(...Nf(t)),e.frontend?.framework==="vue"?r.push(...If()):e.frontend?.framework==="react"&&r.push(...Pf()),r},Ew=async(e,t)=>{let r=Hf.join(e,"ESLINT-README.md"),n=jf(t),i=`# racletteJS ESLint Configuration
|
|
536
|
+
|
|
537
|
+
This directory contains an auto-generated ESLint configuration for your racletteJS project.
|
|
538
|
+
|
|
539
|
+
## Required Dependencies
|
|
540
|
+
|
|
541
|
+
To use this ESLint configuration, you need to install the following dependencies:
|
|
542
|
+
|
|
543
|
+
\`\`\`bash
|
|
544
|
+
${Mf(n)}
|
|
545
|
+
\`\`\`
|
|
546
|
+
|
|
547
|
+
## How to Use
|
|
548
|
+
|
|
549
|
+
Create an \`eslint.config.mjs\` file in your project root with:
|
|
550
|
+
|
|
551
|
+
\`\`\`js
|
|
552
|
+
// eslint.config.mjs
|
|
553
|
+
import { withRaclette } from './.raclette/eslint.config.mjs'
|
|
554
|
+
|
|
555
|
+
export default withRaclette(
|
|
556
|
+
// Your custom configs here
|
|
557
|
+
{
|
|
558
|
+
// Example: Override a rule
|
|
559
|
+
rules: {
|
|
560
|
+
'no-console': 'off'
|
|
561
|
+
}
|
|
562
|
+
},
|
|
563
|
+
// Add more config objects as needed
|
|
564
|
+
)
|
|
565
|
+
\`\`\`
|
|
566
|
+
|
|
567
|
+
## Features
|
|
568
|
+
|
|
569
|
+
- Project-aware configuration that understands your racletteJS project structure
|
|
570
|
+
- Framework-specific rules (Vue, React) automatically included based on your project
|
|
571
|
+
- Seamless integration with your IDE
|
|
572
|
+
- Clean, modern approach using ESLint's flat config system
|
|
573
|
+
|
|
574
|
+
## Editor Integration
|
|
575
|
+
|
|
576
|
+
For Visual Studio Code users, make sure to add this to your \`.vscode/settings.json\`:
|
|
577
|
+
|
|
578
|
+
\`\`\`json
|
|
579
|
+
{
|
|
580
|
+
"eslint.experimental.useFlatConfig": true
|
|
581
|
+
}
|
|
582
|
+
\`\`\`
|
|
583
|
+
|
|
584
|
+
This enables support for the flat config format in the ESLint extension.
|
|
585
|
+
|
|
586
|
+
## Adding Custom Rules
|
|
587
|
+
|
|
588
|
+
You can customize the ESLint rules by:
|
|
589
|
+
|
|
590
|
+
1. Adding rules in your \`eslint.config.mjs\` file:
|
|
591
|
+
|
|
592
|
+
\`\`\`js
|
|
593
|
+
export default withRaclette(
|
|
594
|
+
{
|
|
595
|
+
// Your custom rules
|
|
596
|
+
rules: {
|
|
597
|
+
'indent': ['error', 4],
|
|
598
|
+
'quotes': ['error', 'single']
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
)
|
|
602
|
+
\`\`\`
|
|
603
|
+
|
|
604
|
+
2. Or by adding them to your \`raclette.config.js\` file:
|
|
605
|
+
|
|
606
|
+
\`\`\`js
|
|
607
|
+
export default {
|
|
608
|
+
// ...other racletteJS config
|
|
609
|
+
eslint: {
|
|
610
|
+
useRecommended: true, // Set to false to disable recommended rules
|
|
611
|
+
rules: {
|
|
612
|
+
'indent': ['error', 4],
|
|
613
|
+
'quotes': ['error', 'single']
|
|
614
|
+
},
|
|
615
|
+
ignores: [
|
|
616
|
+
'legacy/**'
|
|
617
|
+
]
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
\`\`\`
|
|
621
|
+
`;await Bf.writeFile(r,i)};import{execSync as Gf}from"child_process";import K from"fs-extra";import ne from"path";import{pathToFileURL as xw}from"url";var kw=async(e,t,r=!1)=>{r&&f.progress(`Loading merged packages for ${e}...`);let n=t.packageMerging?.[e]||[{file:"./packages.json",key:e}],o={},i={};for(let s of n)try{let a=await ww(s);if(a.dependencies){o={...o,...a.dependencies};let c=Object.keys(a.dependencies).length;c>0&&r&&f.success(`Merged ${c} dependencies from ${s.file}:${s.key}`)}if(a.devDependencies){i={...i,...a.devDependencies};let c=Object.keys(a.devDependencies).length;c>0&&r&&f.success(`Merged ${c} devDependencies from ${s.file}:${s.key}`)}}catch(a){throw f.error(`Error loading package source ${s.file}:${s.key} - ${a.message}`),f.error(`Aborting package setup for ${e}`),a}return r&&f.raw(h.blue(`\u{1F4CA} Final ${e} package count: ${Object.keys(o).length} deps, ${Object.keys(i).length} devDeps`)),{dependencies:o,devDependencies:i}},ww=async e=>{if(f.progress(`Loading ${e.file}:${e.key}...`),!await K.pathExists(e.file))return f.debug("packages.json file does not yet exist, no packages will be added."),Promise.resolve({dependencies:{},devDependencies:{}});try{let t=await K.readJson(e.file),r=e.key.split("."),n=t;for(let o of r)if(n&&typeof n=="object"&&o in n)n=n[o];else return f.debug(`\u26A0\uFE0F Key '${e.key}' not found in ${e.file}, skipping`),{};return!n||typeof n!="object"?(f.warn(`Invalid package data at '${e.key}' in ${e.file}, skipping`),{}):{dependencies:n.dependencies||{},devDependencies:n.devDependencies||{}}}catch(t){throw new Error(`Failed to parse ${e.file}: ${t.message}`)}},no=(e,t)=>{let r=t.lockFiles?.[e];if(r)return f.debug(`\u{1F512} Using custom lock file path for ${e}: ${r}`),r;let n=ne.join(process.cwd(),`${e}.yarn.lock`);return f.debug(`\u{1F512} Using default lock file path for ${e}: ${n}`),n},Ra=async(e,t)=>{let r=await df();if(!t)try{t=await import(xw(ne.join(process.cwd(),"raclette.config.js")).href).then(n=>n.default||n)}catch(n){f.warn(`Could not load raclette.config.js: ${n.message}`),t={name:"raclette-app"}}Ye.includes(e)&&await Vf(`services/${e}/package.json`,ne.join(r,e),e,t,!1),po.includes(e)&&f.instruction(`Workbench target ${e} - packages.json updated. You need to restart your workbench service manually.`)},Cw=async e=>{if(!e.plugins||e.plugins.length===0)return{};let t=ne.join(process.cwd(),"package.json");if(!await K.pathExists(t))return f.warn("No package.json found in app directory"),{};try{let r=await K.readJson(t),n={...r.dependencies||{},...r.devDependencies||{}},o=e.plugins.map(s=>typeof s=="string"?s:s[0]),i={};for(let s of o)n[s]?(i[s]=n[s],f.debug(`Found plugin ${s}@${n[s]}`)):f.warn(`Plugin ${s} is enabled in config but not found in package.json`);return i}catch(r){return f.warn(`Error reading app package.json: ${r.message}`),{}}},Vf=async(e,t,r,n,o=!1)=>{let i=$r();o&&(f.progress(`Setting up package.json for ${r}`),f.debug(`Source: ${e}`),f.debug(`Target dir: ${t}`)),await K.ensureDir(t);let s=ne.join(i,e),a=ne.dirname(s),c=ne.join(t,"package.json");if(!K.pathExistsSync(s))return f.warn(`Warning: Could not find package.json at ${s}`);o&&f.debug("Reading source package.json...");try{let u=await K.readJson(s),l=["frontend","backend"].includes(r)?await kw(r,n,o):{dependencies:{},devDependencies:{}},p=await Cw(n),d={...u.dependencies,...l.dependencies,...p},y={...u.devDependencies,...l.devDependencies},g=vt(u,{dependencies:d,devDependencies:y});o&&f.debug("Writing merged package.json..."),await K.writeJson(c,g,{spaces:2}),o&&f.success(`Created package.json for ${r}`),await Tw(a,t,r,n)}catch(u){throw f.error(`Error setting up package.json for ${r}: ${u.message}`),u}},oo=async e=>{let t=ne.join(process.cwd(),e.root);f.progress("Setting up node packages for services...");for(let r of Ye){if(!e.services[r]?.enabled)continue;let n=ne.join(t,r);await Vf(`services/${r}/package.json`,n,r,e,!0),await hf(no(r,e),ne.join(n,"yarn.lock"))}},Aw=async()=>{let e=ne.join(process.cwd(),"packages.json");if(await K.pathExists(e))try{return await K.readJson(e)}catch(t){f.warn(`Error reading packages.json: ${t.message}`)}return{frontend:{dependencies:{},devDependencies:{}},backend:{dependencies:{},devDependencies:{}},workbench:{frontend:{dependencies:{},devDependencies:{}},backend:{dependencies:{},devDependencies:{}}}}},Sw=async e=>{let t=ne.join(process.cwd(),"packages.json");await K.writeJson(t,e,{spaces:2})};var Rw=async(e,t,r=!1)=>{let n=ne.join(process.cwd(),"package.json");if(!await K.pathExists(n))throw new Error("No package.json found in project root");try{Gf("yarn --version",{stdio:"pipe"})}catch{throw new Error("Yarn is not available in PATH")}let o=e;t&&(o=`${e}@${t}`);let s=`yarn add ${o} ${r?"--dev":""}`.trim();f.progress(`Running: ${s}`);try{Gf(s,{cwd:process.cwd(),stdio:"pipe",encoding:"utf8"});let a=await K.readJson(n),c=r?"devDependencies":"dependencies",u=a[c]?.[e];if(!u)throw new Error(`Package ${e} was not found in ${c} after installation`);return f.success(`Added ${e}@${u} to app package.json ${c}`),u}catch(a){throw new Error(`Failed to add ${e}${t?`@${t}`:""}: ${a.message}`)}},Ow=e=>{let t=e.match(/^(@[^/]+\/[^@]+)(?:@(.+))?$/);if(t)return{name:t[1],version:t[2]};let r=e.match(/^([^@]+)(?:@(.+))?$/);return r?{name:r[1],version:r[2]}:{name:e}},Wf=async(e,t,r=!1)=>{let{name:n,version:o}=Ow(t);f.raw(h.blue(`\u{1F4E6} Adding package ${n} for ${e}...`));let i=await Rw(n,o,r);f.success(`Package ${n}@${i} validated and installed`);let s=await Aw(),a=[...e.split("."),r?"devDependencies":"dependencies"],c=s;for(let u of a)c[u]||(c[u]={}),c=c[u];c[n]=i,f.success(`Added ${n}@${i} to ${a.join(".")}`),a.length==3&&f.instruction("Note: Workbench packages are stored in packages.json but package.json files are not updated"),await Sw(s),f.success("Updated packages.json in project root")},io=async e=>{let t=$r();if(f.debug("\u{1F512} Ensuring lock files exist for volume mounting..."),e.services.frontend?.enabled){let r=no("frontend",e);if(await K.pathExists(r))f.debug(`\u{1F512} ${ne.basename(r)} already exists`);else{f.debug(`\u{1F512} Creating initial lock file: ${r}`);let n=ne.join(t,"services","frontend","yarn.lock");await K.pathExists(n)?(f.debug("\u{1F512} Using core package yarn.lock as starting point for frontend"),await K.copy(n,r)):(f.debug("\u{1F512} No core frontend yarn.lock found, creating minimal lock file"),await K.writeFile(r,`# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
622
|
+
# yarn lockfile v1
|
|
623
|
+
|
|
624
|
+
`)),f.debug(`\u{1F512}\u2705 Created ${ne.basename(r)}`)}}if(e.services.backend?.enabled){let r=no("backend",e);if(await K.pathExists(r))f.debug(`\u{1F512} ${ne.basename(r)} already exists`);else{f.debug(`\u{1F512} Creating initial lock file: ${r}`);let n=ne.join(t,"services","backend","yarn.lock");await K.pathExists(n)?(f.debug("\u{1F512} Using core package yarn.lock as starting point for backend"),await K.copy(n,r)):(f.debug("\u{1F512} No core backend yarn.lock found, creating minimal lock file"),await K.writeFile(r,`# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
625
|
+
# yarn lockfile v1
|
|
626
|
+
|
|
627
|
+
`)),f.debug(`\u{1F512}\u2705 Created ${ne.basename(r)}`)}}f.success("Lock files ready for volume mounting")},Tw=async(e,t,r,n)=>{let o=ne.join(t,"yarn.lock");f.debug(`\u{1F512} Setting up yarn.lock for ${r} build context`);let i;if((r==="frontend"||r==="backend")&&(i=no(r,n)),i&&await K.pathExists(i))f.debug(`\u{1F512} Copying configured lock file to build context: ${i}`),await K.copy(i,o);else{let s=ne.join(e,"yarn.lock");await K.pathExists(s)?(f.debug(`\u{1F512} Using core yarn.lock for ${r} build context`),await K.copy(s,o)):(f.debug(`\u{1F512} Creating minimal yarn.lock for ${r} build context`),await K.writeFile(o,`# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
628
|
+
# yarn lockfile v1
|
|
629
|
+
|
|
630
|
+
`))}};import Uf from"fs-extra";import qf from"path";var so=async(e,t)=>{let r=qf.join(t,"tsconfig.json"),n={compilerOptions:{target:"ES2020",module:"ESNext",moduleResolution:"node",esModuleInterop:!0,resolveJsonModule:!0,outDir:"dist",declaration:!0,emitDeclarationOnly:!0,strict:!0,paths:{"@app":["../services/frontend/src/app"],"@app/*":["../services/frontend/src/app/*"],"@shared/app/*":["../shared/*"],"@shared/*":["./virtual/backend/src/shared/*"],"@raclettejs/core/backend":["../node_modules/@raclettejs/core/services/backend/src"],"@raclettejs/core/backend/*":["../node_modules/@raclettejs/core/services/backend/src/*"],"@raclettejs/workbench/app/*":["../node_modules/@raclettejs/workbench/frontend/src/app/*"],"@raclettejs/workbench/*":["../node_modules/@raclettejs/workbench/*"],"@raclettejs/core/frontend":["../node_modules/@raclettejs/core/services/frontend/src/core"],"@raclettejs/core/frontend/*":["../node_modules/@raclettejs/core/services/frontend/src/core/*"],"@raclettejs/core/orchestrator":["../node_modules/@raclettejs/core/services/frontend/src/orchestrator"],"@raclettejs/core/orchestrator/*":["../node_modules/@raclettejs/core/services/frontend/src/orchestrator/*"],"@raclettejs/core/orchestrator/components":["../node_modules/@raclettejs/core/services/frontend/src/orchestrator/components"],"@raclettejs/core/orchestrator/components/*":["../node_modules/@raclettejs/core/services/frontend/src/orchestrator/components/*"],"@raclettejs/core/orchestrator/composables":["../node_modules/@raclettejs/core/services/frontend/src/orchestrator/composables"],"@raclettejs/core/orchestrator/composables/*":["../node_modules/@raclettejs/core/services/frontend/src/orchestrator/composables/*"],"@raclettejs/core":["../node_modules/@raclettejs/core"]},typeRoots:["./node_modules/@types","./node_modules/@raclettejs/core/types"]},include:["./src/**/*","types/**/*","../**/*","../node_modules/@raclettejs/core/*"],exclude:["../node_modules","../dist","./**","../node_modules/@raclettejs/core/node_modules"]};e.typescript?.compilerOptions&&Object.assign(n.compilerOptions,e.typescript.compilerOptions),e?.frontend?.framework==="vue"&&(Pw(t),n.include.push("shims.vue.d.ts")),await Uf.writeFile(r,JSON.stringify(n,null,2)),f.debug(`Generated tsconfig.json in ${t}`)},Pw=async e=>{await Uf.writeFile(qf.join(e,"shims.vue.d.ts"),`declare module "*.vue" {
|
|
631
|
+
import { DefineComponent } from "vue"
|
|
632
|
+
const component: DefineComponent<{}, {}, any>
|
|
633
|
+
export default component
|
|
634
|
+
}`)};import $w from"chokidar";import Oa from"fs-extra";import ut from"path";ua();var Dw=[],Yf=async(e,t)=>{let r=process.cwd(),n=ut.join(r,e.root),o=[`**/${e.root}/**`,...t.patterns.ignore],i={"":r,"/":n,".":_f(),undefined:".",null:".",$:process.env.RACLETTE_APP_PATH??r};typeof t?.watcher.ignored=="string"&&(t.watcher.ignored=new RegExp(t.watcher.ignored));let s=d=>d.reduce((y,g)=>y.concat(t.patterns[g]??[g]),[]),a=[],c=async(d,y,g)=>{let m=[];for(let E of y)for(let x of g){let S=ut.join(d,E),$=x.endsWith("/")?ut.join(x,E):x;a.push([E,ut.join(n,"vfs",E)]),m.push(Oa.ensureDir(ut.dirname($)).finally(()=>Oa.link(S,$).catch(oe=>oe.code!=="EEXIST"&&f.error(`Unexpected error" ${oe.code} linking ${S} \u2192 ${$}`))))}return Promise.all(m)},u=async(d,y,g)=>{let m=[];for(let E of y)for(let x of g){let S=x.endsWith("/")?ut.join(x,E):x;m.push(Oa.unlink(ut.join(S)))}return Promise.all(m)},l=async(d,y)=>{let g=$w.watch(d,t.watcher??{});g.on("add",m=>c(d,[m],y)),g.on("unlink",m=>u(d,[m],y)),Dw.push(g)};return Promise.all(t.mappings.map(async d=>{let y=d.src??".",g=ut.join(i[y[0]]??r,y.replace(/^\$/,"")),m=(Array.isArray(d.dst)?d.dst:[d.dst??""]).map(x=>ut.join(e.root,"virtual/",x)),E=s(Array.isArray(d.get)?d.get:[d.get??"**"]);return g.startsWith(n)||l(g,m),la(E,{cwd:g,ignore:o}).then(x=>c(g,x,m)).catch(x=>x.errno!=17&&console.log(x))}))};import pt from"fs-extra";import jt from"path";var Kf=async(e,t)=>{try{await pt.ensureDir(jt.dirname(e)),await pt.pathExists(e)&&(await pt.stat(e)).isDirectory()&&(console.warn(h.yellow(`\u26A0\uFE0F Removing directory at ${e} to create file`)),await pt.remove(e)),await pt.writeFile(e,t)}catch(r){throw f.error(` Error writing file ${e}: ${r.message}`),r}},zf=async(e,t)=>{f.debug("Generating service configuration files...");let r=jt.join(t,"backend"),n=jt.join(t,"frontend");await pt.ensureDir(r),await pt.ensureDir(n);let o={name:e.name,env:e.env,modules:e.modules,plugins:e.plugins,global:e.global},i={...o,service:"backend",...e.backend},s=`
|
|
635
|
+
// Generated racletteJS Backend Configuration
|
|
636
|
+
// This file is auto-generated, do not edit directly
|
|
637
|
+
|
|
638
|
+
export const racletteConfig = ${JSON.stringify(i,null,2)};
|
|
639
|
+
|
|
640
|
+
export default racletteConfig;
|
|
641
|
+
`;await Kf(jt.join(r,"raclette.config.js"),s);let a={...o,service:"frontend",...e.frontend},c=`
|
|
642
|
+
// Generated racletteJS Frontend Configuration
|
|
643
|
+
// This file is auto-generated, do not edit directly
|
|
644
|
+
|
|
645
|
+
export const racletteConfig = ${JSON.stringify(a,null,2)};
|
|
646
|
+
|
|
647
|
+
export default racletteConfig;
|
|
648
|
+
`;await Kf(jt.join(n,"raclette.config.js"),c),f.success("Service configuration files generated")};var ao=e=>{if(!e||typeof e!="object")throw new Error("Workbench configuration must be an object");if(!e.frontend||typeof e.frontend!="object")throw new Error('Workbench configuration must have a "frontend" object');if(e.frontend.i18n!==void 0){if(typeof e.frontend.i18n!="object")throw new Error("frontend.i18n must be an object");if(e.frontend.i18n.locales!==void 0){if(!Array.isArray(e.frontend.i18n.locales))throw new Error("frontend.i18n.locales must be an array");if(!e.frontend.i18n.locales.every(t=>typeof t=="string"))throw new Error("All locales must be strings")}}return!0},co=async(e,t=process.cwd())=>{let r=jt.join(t,".raclette"),n=jt.join(r,"raclette.config.workbench.js");await pt.mkdir(r,{recursive:!0});let o=`import { defineRacletteConfig } from "@raclettejs/core"
|
|
649
|
+
|
|
650
|
+
export default defineRacletteConfig(${JSON.stringify(e,null,2)})
|
|
651
|
+
`;return await pt.writeFile(n,o,"utf8"),n};var Fr=new Map,Xf="yarn",Jf=process.platform==="win32",Qf=async e=>{let t=Ie.join(e,".yarnrc.yml");if(!await Ot.pathExists(t))return!1;let n=(await Ot.readFile(t,"utf8")).match(/^\s*yarnPath\s*:\s*(.+)\s*$/m);if(!n)return!1;let i=n[1].trim().replace(/^['"]|['"]$/g,"");if(!i)return!1;let s=Ie.resolve(e,i);return await Ot.pathExists(s)?!1:(f.warn(`Configured yarnPath is missing (${s}). Falling back to global Yarn.`),!0)},Zf=async(e,t,r,n)=>{f.raclette("Starting development environment...");let o=kf(bf("fs.yml",{appDirName:Ie.basename(n.workingDir)})),i=Ie.dirname(n.dockerComposePath),s=r.name??Ie.basename(e),a=wf(e,t),c={kill:()=>(a(),!0)};Fr.set("originalConfigWatcher",c),await io(r),await oo(r),await Yf(r,o),zn("raclette_shared"),await ba(r,n.workingDir,n.dockerComposePath,!1,"development",!0),await so(r,i),await ro(r,i);let u=await eo(r,i,n.forceRebuild??!1);u.length>0&&await to(r,i,u,{noCache:n.noCache});let l=Iw(r),p=Fw(l);p.length>0&&f.info(`Found existing services: ${p.join(", ")}`);let d=jw(r,s,n.dockerComposePath);["SIGINT","SIGTERM"].forEach(y=>{process.removeAllListeners(y),process.on(y,()=>d(y))}),n.quiet?(await eh(r,s,n.dockerComposePath,l,p,n.verbose??!1),console.log(h.green(`
|
|
652
|
+
\u2705 Development environment is ready!`)),l.frontend.enabled&&console.log(h.blue(`\u{1F30D} Frontend running at: http://localhost:${l.frontend.port}`)),l.backend.enabled&&console.log(h.blue(`\u{1F680} Server running at: http://localhost:${l.backend.port}`)),console.log(h.yellow(`
|
|
653
|
+
\u2139\uFE0F Services are running in detached mode (quiet)`)),console.log(h.yellow('Use "raclette down" to stop the services when finished'))):await Mw(r,s,n.dockerComposePath,l,p,n.logFilter,n.verbose??!1)},Iw=e=>{let t=e.name??Ie.basename(process.cwd());return{frontend:{name:"frontend",containerName:e.services.frontend?.name??`${t}-frontend`,port:e.services.frontend?.port??8081,enabled:e.services.frontend?.enabled??!1,isDatabaseService:!1},backend:{name:"backend",containerName:e.services.backend?.name??`${t}-backend`,port:e.services.backend?.port??8082,enabled:e.services.backend?.enabled??!1,isDatabaseService:!1},mongodb:{name:"mongodb",containerName:e.services.mongodb?.name??`${t}-mongodb`,port:e.services.mongodb?.port??27017,enabled:e.services.mongodb?.enabled??!1,volumeName:e.services.mongodb?.volume??`${t}-mongodb`,isDatabaseService:!0},cache:{name:"cache",containerName:e.services.cache?.name??`${t}-cache`,port:e.services.cache?.port??6379,enabled:e.services.cache?.enabled??!1,volumeName:e.services.cache?.volume??`${t}-cache`,isDatabaseService:!0}}},Fw=e=>{let t=[];return Object.entries(e).forEach(([r,n])=>{n.enabled&&Ir(n.containerName)&&t.push(r)}),t},jw=(e,t,r)=>n=>{console.log(`
|
|
654
|
+
`+"=".repeat(80)),console.log(h.bold.yellow(` CLEANUP: Shutting down services after ${n}...`)),console.log("=".repeat(80)+`
|
|
655
|
+
`);for(let[o,i]of Fr.entries())i&&!i.killed&&typeof i.kill=="function"&&(console.log(h.yellow(`Stopping ${o} process...`)),i.kill("SIGTERM"));try{th(e),Ee(["-p",t,"-f",r,"down"],{stdio:"inherit"}),console.log(`
|
|
656
|
+
`+"=".repeat(80)),console.log(h.bold.green(" \u2705 CLEANUP COMPLETE: All services stopped successfully")),console.log("=".repeat(80))}catch(o){console.error(h.red("Error stopping Docker services:"),o)}process.exit(0)},eh=async(e,t,r,n,o,i)=>{if(console.log(h.blue("\u{1F433} Starting Docker services...")),!await Ot.pathExists(r)){let a=`Docker compose file not found: ${r}`;throw f.error(a),new Error(a)}let s=[];if(Object.entries(n).forEach(([a,c])=>{let u=a;if(c.enabled){if(o.includes(u)){f.info(`Skipping existing service: ${u}`);return}s.push(u)}}),s.length===0){f.warn("No Docker services to start! All services either exist or are not enabled.");return}f.raw(h.blue(`\u{1F680} Starting following services: ${s.join(", ")}`));try{Ee(["-p",t,"-f",r,"up","-d",...s],{stdio:"inherit"}),f.success(`Docker services started: ${s.join(", ")}`)}catch(a){throw f.error(`Error starting Docker services: ${a.message}`),a}try{await Bw(e,i)}catch(a){f.error(`Error starting Workbench: ${a.message}`)}},Mw=async(e,t,r,n,o,i=["frontend","backend"],s)=>{await eh(e,t,r,n,o,s);let a=i.filter(l=>o.includes(l)?!1:n[l]?.enabled);if(a.length===0){f.warn("No services to show logs for");return}f.raw(h.blue(`\u{1F4CB} Showing logs for: ${a.join(", ")} (press Ctrl+C to stop)...`));let c=Ie.resolve(r),u=["-p",t,"-f",c,"logs","--follow",...a];try{f.debug("Running Docker Compose logs...");let l=Ta("docker",["compose",...u],{stdio:"inherit",shell:!0,cwd:Ie.dirname(c)});return Fr.set("dockerLogs",l),new Promise(p=>{l.on("close",d=>{l.killed||console.log(h.yellow(`
|
|
657
|
+
Log process ended with code ${d??0}`)),p()}),l.on("error",d=>{f.error(` Error with log process: ${d.message}`),p()})})}catch(l){throw f.error(`Error setting up log following: ${l.message}`),l}},lo=async e=>{if(!e.services?.workbench?.enabled)return;let t=Ie.join(process.cwd(),"node_modules","@raclettejs","workbench");if(!await Ot.pathExists(t))throw f.error("Workbench package not found. Install with: yarn add @raclettejs/workbench"),new Error("Workbench package not found");let r=Ie.join(t,"package.json");if(!await Ot.pathExists(r))throw f.error(" Workbench package.json not found"),new Error("Workbench package.json not found");return t},Bw=async(e,t)=>{if(!e.services?.workbench?.enabled)return;let r=await lo(e);if(!r)return;let n=r;try{n=await Ot.realpath(r)}catch{}let o=Ie.join(process.cwd(),"workbenchPlugins");await Lw(o)||(o=void 0);let i;if(e.workbench)try{ao(e.workbench),i=await co(e.workbench)}catch(u){throw console.error(h.red("Workbench configuration error:"),u.message),u}let s=Object.fromEntries(Object.entries(e.env.development||{}).filter(([u])=>u.startsWith("RACLETTE_")).flatMap(([u,l])=>{let p=[[u,l]];if(u.startsWith("RACLETTE_WORKBENCH_")){let d=u.replace("RACLETTE_WORKBENCH_","RACLETTE_");p.push([d,l])}return p}));e.services?.workbench?.debugPort&&(s.ENABLE_DEBUG=!0,s.RACLETTE_DEBUG_PORT=e.services.workbench.debugPort);let a={...process.env,NODE_ENV:"development",MONGO_HOST:`mongodb://localhost:${e.services.mongodb?.port||27017}/${e.services.mongodb?.databaseName||e.name}`,CACHE_URL:`raclette-cache://localhost:${e.services.cache?.port||6379}${e.services.cache?.db?`/${e.services.cache.db}`:""}`,RACLETTE_CLIENT_PORT:String(e.services.workbench?.frontendPort||8083),RACLETTE_SERVER_PORT:String(e.services.workbench?.backendPort||8084),...s};return await Qf(process.cwd())&&(a.YARN_IGNORE_PATH="1"),new Promise((u,l)=>{let p=`${e.name}-workbench`;f.progress("Starting workbench as "+p);let d=["dev",t?"-v":"","-p",p,...i?["-f",i]:[]].filter(x=>x!==""),y=["--cwd",n,...d],g=e.services?.workbench?.withLogs||t,m=Ta(Xf,y,{cwd:process.cwd(),env:a,stdio:g?"pipe":"ignore",shell:Jf});Fr.set("workbench",m),g&&(m.stdout?.on("data",x=>{x.toString().trim().split(`
|
|
658
|
+
`).forEach($=>{console.log(h.magenta(`[Workbench] ${$}`))})}),m.stderr?.on("data",x=>{x.toString().trim().split(`
|
|
659
|
+
`).forEach($=>{console.error(h.red(`[Workbench] ${$}`))})}),m.stdout?.on("data",x=>{x.toString().includes("VITE v")&&(clearTimeout(E),u())}));let E=setTimeout(()=>{u()},g?1e3*60*5:5e3);m.on("close",x=>{clearTimeout(E),x!==0&&x!==null?(console.error(h.red(`Workbench process exited with code ${x}`)),l(new Error(`Workbench process exited with code ${x}`))):u()}),m.on("error",x=>{clearTimeout(E),console.error(h.red("Workbench process error:"),x),l(x)}),g||setTimeout(u,1e3)})},th=async e=>{if(e.services?.workbench?.enabled)try{let t=await lo(e);if(!t)return;let r=t;try{r=await Ot.realpath(t)}catch{}let n={...process.env};await Qf(process.cwd())&&(n.YARN_IGNORE_PATH="1"),Ta(Xf,["--cwd",r,"down","-p",`${e.name}-workbench`],{cwd:process.cwd(),env:n,stdio:"pipe",shell:Jf})}catch{f.debug("Workbench down command failed, forcing process termination");let r=Fr.get("workbench");if(r&&!r.killed)r.kill("SIGTERM");else{let n=`${e.name}-workbench`;try{Cf(n)}catch(o){f.warn(`Could not stop workbench containers: ${o.message}`)}}}},Pa=(e,t)=>{let r=t?.name??Ie.basename(process.cwd());f.debug(`\u{1F3F7}\uFE0F Using project name: ${r}`),f.raclette("Stopping all Docker services...");try{th(t),Ee(["-p",r,"-f",e,"down"],{stdio:"inherit"}),f.success("All Docker services stopped successfully")}catch(n){throw f.error("Error stopping Docker services:",n),n}};import nh from"fs-extra";import oh from"path";var Hw=e=>cr(e),jr=async(e,t,r)=>{let o=`${t?.name??oh.basename(process.cwd())}-${e}`;t?.services?.[e]?.name&&(o=t.services[e].name);try{let i=await nh.readFile(r,"utf8"),s=new RegExp(`\\$\\{RACLETTE_${e.toUpperCase()}_CONTAINERNAME:-([^}]+)\\}`).exec(i);s&&s[1]&&(o=s[1])}catch(i){console.warn(h.yellow(`Warning: Could not read docker-compose file to determine container name: ${i.message}`))}return o},rh=async(e,t,r)=>{let n=await jr(e,t,r);if(!Hw(n))return!1;try{console.log(h.blue(`\u{1F4E6} Updating dependencies for ${e}...`)),ya(n,"/app/check-dependencies.sh echo 'Dependency check completed'",{stdio:"inherit"});try{let o=ya(n,"cat /app/node_modules/.install-result",{stdio:"pipe"}).trim();return o==="0"?(console.log(h.green(`\u2705 Dependencies for ${e} updated successfully`)),!0):(console.error(h.red(`\u274C Dependency installation for ${e} failed with code ${o}`)),console.error(h.red("Some packages might be incompatible with your Node.js version or have other issues.")),console.error(h.yellow("Check the logs above for specific error messages.")),!1)}catch{return console.log(h.green(`\u2705 Dependencies for ${e} updated (status unknown)`)),!0}}catch(o){return console.error(h.red(`\u274C Error updating dependencies for ${e}: ${o.message}`)),!1}},$a=async(e,t,r)=>{console.log(h.blue("\u{1F9C0} Updating package dependencies..."));let n=oh.join(r,"docker-compose.yml");if(!await nh.pathExists(n))return console.error(h.yellow("\u26A0\uFE0F No docker-compose.yml found. Services may not be running with racletteJS.")),!1;let o=!1,i=!0;if(e==="frontend"||e==="both"){let s=await rh("frontend",t,n);o=s||o,i=i&&s}if(e==="backend"||e==="both"){let s=await rh("backend",t,n);o=s||o,i=i&&s}return o&&!i&&(console.log(h.yellow("\u26A0\uFE0F Some services encountered errors during dependency installation.")),console.log(h.yellow("You may need to address compatibility issues in your package.json."))),o&&i};import{spawn as ah}from"child_process";import ih from"path";var ch=async(e,t,r,n)=>{if(e.includes("workbench")){await Ww(r,t);return}let o=[];if(e.length===0)o=sh(r),console.log(h.blue(`\u{1F4CB} No services specified, showing logs for all enabled services: ${o.join(", ")}`));else{let s=sh(r),a=e.filter(c=>!s.includes(c));if(a.length>0)throw console.error(h.red(`\u274C Invalid services specified: ${a.join(", ")}`)),console.log(h.yellow(`Available services: ${s.join(", ")}`)),new Error("Invalid services specified");o=e,console.log(h.blue(`\u{1F4CB} Showing logs for: ${o.join(", ")}`))}let i=await Gw(o,r,n);if(i.length===0)throw console.error(h.red("\u274C None of the specified services appear to be running.")),console.log(h.yellow("\u{1F4A1} Try running 'raclette dev' first to start the services.")),new Error("No running services found");if(i.length<o.length){let s=o.filter(a=>!i.includes(a));console.warn(h.yellow(`\u26A0\uFE0F Some services are not running: ${s.join(", ")}`)),console.log(h.blue(`\u{1F4CB} Showing logs for running services: ${i.join(", ")}`)),o=i}await Vw(r,n,o,t)};function sh(e){let t=[];return e.services?.frontend?.enabled&&t.push("frontend"),e.services?.backend?.enabled&&t.push("backend"),e.services?.mongodb?.enabled&&t.push("mongodb"),e.services?.cache?.enabled&&t.push("cache"),e.services?.workbench?.enabled&&t.push("workbench"),e.services?.workbench?.enabled&&t.push("workbench"),t}async function Gw(e,t,r){let n=[];for(let o of e)try{let i=await jr(o,t,r);cr(i)&&n.push(o)}catch(i){console.warn(h.yellow(`\u26A0\uFE0F Could not check status of service '${o}': ${i.message}`))}return n}async function Vw(e,t,r,n){let o=e?.name??ih.basename(process.cwd());console.log(h.blue(`\u{1F4CB} Following logs for: ${r.join(", ")} ${n.follow?"(press Ctrl+C to stop)":""}`));let i=["-p",o,"-f",t,"logs"];n.follow&&i.push("--follow"),n.tail&&i.push("--tail",n.tail),i.push(...r);try{let s=ah("docker",["compose",...i],{stdio:"inherit",shell:!0,cwd:ih.dirname(t)});s.on("close",a=>{s.killed||console.log(h.yellow(`
|
|
660
|
+
Log process ended with code ${a??0}`))}),s.on("error",a=>{console.error(h.red(`\u274C Error with log process: ${a.message}`))}),process.on("SIGINT",()=>{console.log(h.yellow(`
|
|
661
|
+
\u{1F6D1} Stopping log following...`)),s.kill("SIGTERM"),process.exit(0)}),n.follow?await new Promise(()=>{}):await new Promise(a=>{s.on("close",()=>a())})}catch(s){throw console.error(h.red(`\u274C Error following logs: ${s.message}`)),s}}async function Ww(e,t){console.log(h.blue("\u{1F527} Handling workbench logs..."));let r=lo(e);f.debug("Calling yarn log frontend backend on workbench instance...");try{let n=["log","frontend","backend"];t.follow||n.push("--no-follow"),t.tail&&n.push("--tail",t.tail);let o=ah("yarn",n,{cwd:r,stdio:"inherit",shell:!0,env:{...process.env,NODE_ENV:"development"}});o.on("close",i=>{o.killed||console.log(h.yellow(`
|
|
662
|
+
Workbench log process ended with code ${i??0}`))}),o.on("error",i=>{console.error(h.red(`\u274C Error with workbench log process: ${i.message}`)),console.log(h.yellow("\u{1F4A1} Make sure the workbench package has the 'log' script in its package.json"))}),process.on("SIGINT",()=>{console.log(h.yellow(`
|
|
663
|
+
\u{1F6D1} Stopping workbench log following...`)),o.kill("SIGTERM"),process.exit(0)}),t.follow?await new Promise(()=>{}):await new Promise(i=>{o.on("close",()=>i())})}catch(n){throw console.error(h.red(`\u274C Error calling workbench logs: ${n.message}`)),n}}import{spawn as uC}from"child_process";import V from"fs-extra";import G from"path";import Uw from"chokidar";import I from"fs-extra";import P from"path";var lh=[".prettierrc","eslint.config.js"],qw=["bin/check-dependencies.sh"],dh=async(e,t,r)=>{let n=process.cwd(),o=P.join(n,".raclette"),i=P.join(o,"virtual"),s=$r();f.debug(`\u{1F4E6} Using core package at: ${s}`),await Qw(o,s,qw),f.debug("[VFS] Cleaning virtual file system directory..."),await I.pathExists(i)&&await I.rm(i,{recursive:!0}),await I.ensureDir(i);let a=[{name:"generated-service-files",path:o,servicePathMap:{backend:".",frontend:"."},priority:1},{name:"app",path:n,servicePathMap:{backend:"services",frontend:"services"},folderMappings:{shared:"backend/src/shared/app",i18n:"frontend/src/orchestrator/i18n/app"},priority:10},{name:"core-types",path:s,servicePathMap:{backend:"",frontend:""},folderMappings:{"src/types.ts":["backend/types/index.ts","frontend/types/index.ts"]},priority:29},{name:"core",path:s,servicePathMap:{backend:"services",frontend:"services"},priority:30},...e?.sourceDirectories||[],...t??[]],c=new Map,u={backend:["/"],frontend:["/"]},l=[...a].sort((m,E)=>E.priority-m.priority).map(m=>{let E=m.path.startsWith(".")?P.join(process.cwd(),m.path):m.path;return{...m,path:E}});await Xw(l,c,i,u,lh,o),I.writeFileSync(P.join(o,"mappings.tsv"),Array.from(c.entries().map(m=>m.join(" "))).join(`
|
|
664
|
+
`),"utf8"),I.writeFileSync(P.join(o,"dirs.json"),JSON.stringify(l,null,2),"utf8");let p=[],d=m=>{let E=P.relative(n,m);return c.get(E)||m},y=()=>{p.forEach(E=>E.close()),p.length=0,Yw(l,u,i).forEach(E=>{if(I.existsSync(E.sourcePath)){let x=Kw(E,l,c,lh);p.push(x)}})},g=()=>p.forEach(m=>m.close());return r||y(),{resolveFile:d,watchFiles:y,close:g}},Yw=(e,t,r)=>{let n=[];return e.forEach(o=>{Object.entries(t).forEach(([i,s])=>{s.forEach(a=>{let c=o.servicePathMap?.[i]||"",u=P.join(o.path,c,i,a);n.push({sourcePath:u,sourceDir:o,targetResolver:l=>P.join(r,i,a,l),mappingKeyResolver:l=>P.join(i,a,l)})})}),o.folderMappings&&Object.entries(o.folderMappings).forEach(([i,s])=>{let a=P.join(o.path,i);I.existsSync(a)&&I.statSync(a).isFile()?(Array.isArray(s)?s:[s]).forEach(l=>{n.push({sourcePath:P.dirname(a),sourceDir:o,targetResolver:p=>P.basename(a)===p?P.join(r,l):P.join(r,l,p),mappingKeyResolver:p=>P.basename(a)===p?i:P.join(i,p)})}):n.push({sourcePath:a,sourceDir:o,targetResolver:u=>P.join(r,i,u),mappingKeyResolver:u=>P.join(i,u)})})}),n},Kw=(e,t,r,n)=>{f.debug(`[VFS] Setting up watcher for ${e.sourceDir.name}: ${e.sourcePath}`);let o=e.sourceDir.name==="generated-service-files"?["**/*.vue","**/*.ts","**/*.js","**/*.css","**/*.scss","**/package.json","**/yarn.lock","**/*.json"]:["**/*.vue","**/*.ts","**/*.js","**/*.css","**/*.scss"],i=Uw.watch(o,{cwd:e.sourcePath,ignoreInitial:!0,ignored:["**/.git/**","**/dist/**"]}),s=async(a,c=!1)=>{if(Jw(a,n))return;let u=e.mappingKeyResolver(a),l=e.targetResolver(a);await zw(t,r,u,l,a,c)};return i.on("add",a=>s(a)),i.on("change",a=>s(a)),i.on("unlink",a=>s(a,!0)),i},zw=async(e,t,r,n,o,i)=>{let s=[...e].sort((a,c)=>a.priority-c.priority);if(i){let a=uh(s,r,o);a?(await I.ensureDir(P.dirname(n)),await I.copy(a.fullPath,n),t.set(r,n),f.debug(`[VFS] Updated ${r} from ${a.sourceDir.name}`)):(await I.pathExists(n)&&await I.remove(n),t.delete(r),f.debug(`[VFS] Removed ${r}`))}else{let a=uh(s,r,o);a&&(await I.ensureDir(P.dirname(n)),await I.copy(a.fullPath,n),t.set(r,n),f.debug(`[VFS] Updated ${r} from ${a.sourceDir.name}`))}},uh=(e,t,r)=>{for(let n of e){let o={backend:["/"],frontend:["/"]};for(let[i,s]of Object.entries(o))for(let a of s)if(P.join(i,a,r)===t){let u=n.servicePathMap?.[i]||"",l=P.join(n.path,u,i,a,r);if(I.existsSync(l))return{sourceDir:n,fullPath:l}}if(n.folderMappings)for(let[i,s]of Object.entries(n.folderMappings)){let a=Array.isArray(s)?s:[s];for(let c of a){let u,l;if(i===t){if(l=P.join(n.path,i),I.existsSync(l))return{sourceDir:n,fullPath:l}}else if(u=P.join(i,r),u===t&&(l=P.join(n.path,i,r),I.existsSync(l)))return{sourceDir:n,fullPath:l}}}}return null},ph=async(e,t,r,n,o,i)=>{if(!I.pathExistsSync(t))return;await I.ensureDir(P.dirname(r));let s=e.name==="generated-service-files";await I.copy(t,r,{overwrite:!0,filter:u=>{let l=P.basename(u);if(i.includes(l))return!1;if(s&&(l==="package.json"||l==="yarn.lock"))return!0;if(!s&&(l==="package.json"||l==="yarn.lock"))return!1;let p=P.relative(t,u);return!p.startsWith("node_modules")&&!p.startsWith(".git")&&!p.startsWith("dist")}});let c=await ff(t,s?["**/*.vue","**/*.ts","**/*.js","**/*.json","**/*.css","**/*.scss","**/package.json","**/yarn.lock"]:["**/*.vue","**/*.ts","**/*.js","**/*.json","**/*.css","**/*.scss"]);for(let u of c){let l=P.basename(u);if(i.includes(l))continue;if(!(s&&(l==="package.json"||l==="yarn.lock"))){if(!s&&(l==="package.json"||l==="yarn.lock"))continue}let p=P.relative(t,u),d=P.join(o,p),y=P.join(r,p);n.set(d,y)}f.debug(`[VFS] Processed ${e.name}: ${t} -> ${r}`)},Xw=async(e,t,r,n,o,i)=>{t.clear();for(let s of e){if(!await I.pathExists(s.path)){console.warn(h.yellow(`[VFS] Source directory not found: ${s.path}`));continue}for(let[a,c]of Object.entries(n))for(let u of c){let l=s.servicePathMap?.[a]||"";if(!l)continue;let p=P.join(s.path,l,a,u),d=P.join(r,a,u),y=P.join(a,u);await ph(s,p,d,t,y,o)}if(s.folderMappings)for(let[a,c]of Object.entries(s.folderMappings)){let u=P.join(s.path,a),l=(Array.isArray(c)?c:[c]).map(d=>P.join(r,d)),p=await I.pathExists(u)&&(await I.stat(u)).isFile();if(!p&&s.clear)for(let d of l)await I.rm(d,{recursive:!0,force:!0}),await I.ensureDir(d);if(p)for(let d of l)await I.ensureDir(P.dirname(d)),await I.copy(u,d),t.set(a,d),f.debug(`[VFS] Mapped individual file ${a} -> ${d}`);else for(let d of l)await ph(s,u,d,t,d,o)}}f.debug("[VFS] Built virtual file system")},Jw=(e,t)=>t.includes(P.basename(e));var Qw=async(e,t,r)=>{let n=P.join(e,"dist");await I.ensureDir(n);for(let o of r){let i=P.join(t,o),s=P.basename(o),a=P.join(n,s);await I.pathExists(a)&&await I.remove(a),await I.pathExists(i)&&(await I.ensureDir(P.dirname(a)),await I.copy(i,a,{overwrite:!0,preserveTimestamps:!1}),s.endsWith(".sh")&&await I.chmod(a,493),f.debug(`[VFS] Copied ${s} to dist directory`))}};import{execSync as Zw}from"child_process";import H from"fs-extra";import U from"path";var Da=async(e,t,r)=>{console.log(h.blue("\u{1F4E6} Creating production artifacts...")),await rC(t,e,r);let n=U.join(t,"docker-compose.yml");return await nC(e,t,n,r),await oC(e,t,r),await iC(t,r,e),console.log(h.green("\u2705 Production artifacts created")),n},fh=async(e,t,r,n)=>{let{makeExecutable:o=!1,required:i=!1,logPrefix:s=""}=n||{};for(let a of e){let c=U.join(t,a),u=U.basename(a),l=U.join(r,u);if(await H.ensureDir(U.dirname(l)),await H.pathExists(c))await H.copy(c,l),o&&await H.chmod(l,493),console.log(h.gray(`${s} \u2705 Copied ${a}`));else{let p=`${a} not found in ${t}`;if(i)throw new Error(`Required file ${p}`);console.log(h.gray(`${s} \u26A0\uFE0F Skipped ${a} (not found)`))}}},eC=async(e,t,r)=>fh(e,process.cwd(),t,{...r,logPrefix:r?.logPrefix||" "}),tC=async(e,t,r,n)=>fh(e,t,r,{...n,logPrefix:n?.logPrefix||" "}),rC=async(e,t,r)=>{let n=t.services.frontend?.port||8081,o=t.services.workbench?.frontendPort||8083,i=`
|
|
665
|
+
FROM nginx:alpine
|
|
666
|
+
COPY service/frontend /usr/share/nginx/html
|
|
667
|
+
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
668
|
+
COPY entrypoint.sh entrypoint.sh
|
|
669
|
+
|
|
670
|
+
RUN chmod +x /entrypoint.sh
|
|
671
|
+
RUN apk add --no-cache gettext curl
|
|
672
|
+
RUN chmod -R 755 /usr/share/nginx/html
|
|
673
|
+
RUN find /usr/share/nginx/html -type f -exec chmod 644 {} +
|
|
674
|
+
|
|
675
|
+
EXPOSE ${n}
|
|
676
|
+
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \\
|
|
677
|
+
CMD wget --no-verbose --tries=1 --spider http://localhost:${n}/ || exit 1
|
|
678
|
+
ENTRYPOINT ["/entrypoint.sh"]
|
|
679
|
+
CMD ["nginx", "-g", "daemon off;"]
|
|
680
|
+
`,s=`
|
|
681
|
+
FROM node:24.4-alpine
|
|
682
|
+
|
|
683
|
+
# Set working directory
|
|
684
|
+
WORKDIR /app
|
|
685
|
+
|
|
686
|
+
# Install system dependencies that might be needed
|
|
687
|
+
RUN apk add --no-cache tini curl ${(t.services.backend?.installPackages||[]).join(" ")}
|
|
688
|
+
|
|
689
|
+
# Copy package files first for better caching
|
|
690
|
+
COPY service/backend/package*.json ./
|
|
691
|
+
COPY service/backend/yarn.lock* ./
|
|
692
|
+
|
|
693
|
+
# Install only production dependencies
|
|
694
|
+
RUN yarn install --production --frozen-lockfile --silent
|
|
695
|
+
|
|
696
|
+
# Copy the built application (includes dist/ folder)
|
|
697
|
+
COPY service/backend/ ./
|
|
698
|
+
|
|
699
|
+
# Create non-root user for security
|
|
700
|
+
RUN addgroup -g 1001 -S nodejs && \\
|
|
701
|
+
adduser -S fastify -u 1001 && \\
|
|
702
|
+
chown -R fastify:nodejs /app
|
|
703
|
+
USER fastify
|
|
704
|
+
|
|
705
|
+
# Expose port (Fastify should listen on 0.0.0.0 for containers)
|
|
706
|
+
EXPOSE 3000
|
|
707
|
+
|
|
708
|
+
# Health check - point to the correct endpoint
|
|
709
|
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \\
|
|
710
|
+
CMD node -e "require('http').get('http://localhost:3000/health', (res) => process.exit(res.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))"
|
|
711
|
+
|
|
712
|
+
# Use tini to handle signals properly
|
|
713
|
+
ENTRYPOINT ["/sbin/tini", "--"]
|
|
714
|
+
|
|
715
|
+
# Start the application - points to our built dist/src/server.js
|
|
716
|
+
CMD ["yarn", "start"]
|
|
717
|
+
`,a=`
|
|
718
|
+
server {
|
|
719
|
+
listen ${n};
|
|
720
|
+
server_name localhost;
|
|
721
|
+
root /usr/share/nginx/html;
|
|
722
|
+
index index.html;
|
|
723
|
+
|
|
724
|
+
# Security headers
|
|
725
|
+
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
726
|
+
add_header X-Content-Type-Options "nosniff" always;
|
|
727
|
+
add_header Referrer-Policy "no-referrer-when-downgrade" always;
|
|
728
|
+
|
|
729
|
+
# Frontend static files
|
|
730
|
+
location / {
|
|
731
|
+
try_files $uri $uri/ /index.html;
|
|
732
|
+
|
|
733
|
+
# Cache static assets
|
|
734
|
+
location ~* \\.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
|
735
|
+
expires 1y;
|
|
736
|
+
add_header Cache-Control "public, immutable";
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
# API endpoints - proxy to backend on internal port 3000
|
|
741
|
+
location /api/ {
|
|
742
|
+
proxy_pass http://backend:3000/;
|
|
743
|
+
proxy_set_header Host $host;
|
|
744
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
745
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
746
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
|
747
|
+
|
|
748
|
+
# Timeout settings
|
|
749
|
+
proxy_connect_timeout 60s;
|
|
750
|
+
proxy_send_timeout 60s;
|
|
751
|
+
proxy_read_timeout 60s;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
# WebSocket connections
|
|
755
|
+
location /socket.io/ {
|
|
756
|
+
proxy_pass http://backend:3000/socket.io/;
|
|
757
|
+
proxy_http_version 1.1;
|
|
758
|
+
proxy_set_header Upgrade $http_upgrade;
|
|
759
|
+
proxy_set_header Connection "upgrade";
|
|
760
|
+
proxy_set_header Host $host;
|
|
761
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
762
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
763
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
|
764
|
+
proxy_set_header Authorization $http_authorization;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
# Health check endpoint
|
|
768
|
+
location /health {
|
|
769
|
+
proxy_pass http://backend:3000/health;
|
|
770
|
+
proxy_set_header Host $host;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
`;if(await H.writeFile(U.join(e,"Dockerfile.frontend"),i),await H.writeFile(U.join(e,"Dockerfile.backend"),s),await H.writeFile(U.join(e,"nginx.conf"),a),await eC(["node_modules/@raclettejs/core/services/frontend/provision/entrypoint.sh"],e,{makeExecutable:!0,required:!1}),r){let u=`
|
|
774
|
+
FROM nginx:alpine
|
|
775
|
+
COPY workbench/frontend /usr/share/nginx/html
|
|
776
|
+
COPY nginx.workbench.conf /etc/nginx/conf.d/default.conf
|
|
777
|
+
COPY entrypoint.sh /entrypoint.sh
|
|
778
|
+
|
|
779
|
+
RUN chmod +x /entrypoint.sh
|
|
780
|
+
RUN apk add --no-cache gettext curl
|
|
781
|
+
RUN chmod -R 755 /usr/share/nginx/html
|
|
782
|
+
RUN find /usr/share/nginx/html -type f -exec chmod 644 {} +
|
|
783
|
+
|
|
784
|
+
EXPOSE ${o}
|
|
785
|
+
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \\
|
|
786
|
+
CMD wget --no-verbose --tries=1 --spider http://localhost:${o}/ || exit 1
|
|
787
|
+
|
|
788
|
+
ENTRYPOINT ["/entrypoint.sh"]
|
|
789
|
+
CMD ["nginx", "-g", "daemon off;"]
|
|
790
|
+
`,l=`
|
|
791
|
+
FROM node:24.4-alpine
|
|
792
|
+
WORKDIR /app
|
|
793
|
+
|
|
794
|
+
# Install dependencies
|
|
795
|
+
RUN apk add --no-cache tini curl
|
|
796
|
+
|
|
797
|
+
# Copy package files
|
|
798
|
+
COPY workbench/backend/package*.json ./
|
|
799
|
+
COPY workbench/backend/yarn.lock* ./
|
|
800
|
+
|
|
801
|
+
# Install production dependencies
|
|
802
|
+
RUN yarn install --production --frozen-lockfile --silent
|
|
803
|
+
|
|
804
|
+
# Copy application code (includes dist/ if built)
|
|
805
|
+
COPY workbench/backend/ ./
|
|
806
|
+
|
|
807
|
+
# Create non-root user
|
|
808
|
+
RUN addgroup -g 1001 -S nodejs && \\
|
|
809
|
+
adduser -S workbench -u 1001 && \\
|
|
810
|
+
chown -R workbench:nodejs /app
|
|
811
|
+
USER workbench
|
|
812
|
+
|
|
813
|
+
# Expose port (Fastify should listen on 0.0.0.0 for containers)
|
|
814
|
+
EXPOSE 3000
|
|
815
|
+
|
|
816
|
+
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \\
|
|
817
|
+
CMD node -e "require('http').get('http://localhost:3000/health', (res) => process.exit(res.statusCode === 200 ? 0 : 1)).on('error', () => process.exit(1))"
|
|
818
|
+
|
|
819
|
+
ENTRYPOINT ["/sbin/tini", "--"]
|
|
820
|
+
CMD ["yarn", "start"]
|
|
821
|
+
`,p=`
|
|
822
|
+
server {
|
|
823
|
+
listen ${o};
|
|
824
|
+
root /usr/share/nginx/html;
|
|
825
|
+
index index.html;
|
|
826
|
+
|
|
827
|
+
location / {
|
|
828
|
+
try_files $uri $uri/ /index.html;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
location /api/ {
|
|
832
|
+
proxy_pass http://workbench-backend:3000/;
|
|
833
|
+
proxy_set_header Host $host;
|
|
834
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
835
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
836
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
location /socket.io/ {
|
|
840
|
+
proxy_pass http://workbench-backend:3000/socket.io/;
|
|
841
|
+
proxy_http_version 1.1;
|
|
842
|
+
proxy_set_header Upgrade $http_upgrade;
|
|
843
|
+
proxy_set_header Connection "upgrade";
|
|
844
|
+
proxy_set_header Host $host;
|
|
845
|
+
proxy_set_header X-Real-IP $remote_addr;
|
|
846
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
847
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
|
848
|
+
proxy_set_header Authorization $http_authorization;
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
`;await H.writeFile(U.join(e,"Dockerfile.workbench-frontend"),u),await H.writeFile(U.join(e,"Dockerfile.workbench-backend"),l),await H.writeFile(U.join(e,"nginx.workbench.conf"),p)}},nC=async(e,t,r,n)=>{let o=e.services.frontend?.port||8081,i=e.services.workbench?.frontendPort||8083,s=e.env.production||{},a={services:{frontend:{build:{context:".",dockerfile:"Dockerfile.frontend"},ports:[`\${PORT:-${o}}:${o}`],depends_on:["backend"],restart:"unless-stopped",networks:["app-network"],environment:["NODE_ENV=production","RACLETTE_DEBUG_MODE=${RACLETTE_DEBUG_MODE:-false}","RACLETTE_SERVER_BASE_URL=${RACLETTE_SERVER_BASE_URL:-/api}","RACLETTE_SOCKET_URL=${RACLETTE_SOCKET_URL:-}",...Object.entries(s).map(([u,l])=>`${u}=${l}`)]},backend:{build:{context:".",dockerfile:"Dockerfile.backend"},depends_on:["database","cache"],restart:"unless-stopped",networks:["app-network"],environment:["NODE_ENV=production","DISABLE_PLUGIN_LOGS=${RACLETTE_DISABLE_PLUGIN_LOGS:-false}","SERVER_TOKEN_SECRET=${SERVER_TOKEN_SECRET:-thisshouldbesetforproduction}",`MONGO_HOST=\${RACLETTE_MONGODB_HOST:-mongodb://database:27017/\${MONGO_DATABASE:-${e.services.mongodb?.databaseName||e.name}}}`,`CACHE_URL=\${RACLETTE_CACHE_URL:-valkey://cache:6379${e.services.cache?.db?`/${e.services.cache?.db}`:""}}`,...Object.entries(s).map(([u,l])=>`${u}=${l}`)]},database:{image:"mongo:8.2",restart:"unless-stopped",volumes:["mongodb_data:/data/db","mongodb_config:/data/config"],networks:["app-network"],environment:["MONGO_INITDB_DATABASE=${MONGO_DATABASE:-"+(e.services.mongodb?.databaseName||e.name)+"}"],healthcheck:{test:["CMD","mongosh","--eval","db.adminCommand('ping')"],interval:"10s",timeout:"30s",retries:20}},cache:{image:"valkey/valkey:9.0-alpine",restart:"unless-stopped",volumes:["cache_data:/data"],networks:["app-network"],healthcheck:{test:["CMD","valkey-cli","ping"],interval:"10s",timeout:"5s",retries:3}}},volumes:{mongodb_data:{},mongodb_config:{},cache_data:{}},networks:{"app-network":{driver:"bridge"}}},c=e.backend?.cache;if(c?.persistence){let u=c.RDB_OPTIONS||"3600 1 300 100 60 10000";switch(c.persistence){case"none":a.services.cache.command='valkey-server --save ""';break;case"aof":a.services.cache.command="valkey-server --appendonly yes";break;case"rdb":a.services.cache.command="valkey-server --save "+u;break;case"rdb+aof":a.services.cache.command="valkey-server --appendonly yes --save "+u;break}}if(n){let u=e.env.production||{};a.services["workbench-frontend"]={build:{context:".",dockerfile:"Dockerfile.workbench-frontend"},ports:[`\${WORKBENCH_PORT:-${i}}:${i}`],depends_on:["workbench-backend"],restart:"unless-stopped",networks:["app-network"],environment:["NODE_ENV=production","RACLETTE_DEBUG_MODE=${RACLETTE_DEBUG_MODE:-false}",`RACLETTE_SERVER_BASE_URL=\${RACLETTE_SERVER_BASE_URL:-http://localhost:${i}/api}`,"RACLETTE_SOCKET_URL=${RACLETTE_SOCKET_URL:-}",...Object.entries(u).map(([l,p])=>`${l}=${p}`)]},a.services["workbench-backend"]={build:{context:".",dockerfile:"Dockerfile.workbench-backend"},depends_on:["database","cache"],restart:"unless-stopped",networks:["app-network"],environment:["NODE_ENV=production","DISABLE_PLUGIN_LOGS=${RACLETTE_DISABLE_PLUGIN_LOGS:-false}","SERVER_TOKEN_SECRET=${SERVER_TOKEN_SECRET}",`MONGO_HOST=\${RACLETTE_MONGODB_HOST:-mongodb://database:27017/\${MONGO_DATABASE:-${e.services.mongodb?.databaseName||e.name}}}`,`CACHE_URL=\${RACLETTE_CACHE_URL:-valkey://cache:6379${e.services.cache?.db?`/${e.services.cache?.db}`:""}}`,...Object.entries(u).map(([l,p])=>`${l}=${p}`)]}}await H.writeFile(r,ke.dump(a))},oC=async(e,t,r)=>{let n=Na(e,r);await H.writeFile(U.join(t,".env.example"),n)},Na=(e,t)=>{let r=e.services.frontend?.port||8081,n=e.services.workbench?.frontendPort||8083;return`# Production Environment Variables
|
|
852
|
+
# Copy this file to .env and fill in your values
|
|
853
|
+
|
|
854
|
+
# Required - Generate a secure random string for this
|
|
855
|
+
SERVER_TOKEN_SECRET=your-secret-key-here
|
|
856
|
+
|
|
857
|
+
# Auto-generated docker variables, they should work for default configurations
|
|
858
|
+
NODE_ENV=production
|
|
859
|
+
MONGO_DATABASE=${e.services.mongodb?.databaseName||e.name}
|
|
860
|
+
|
|
861
|
+
# Frontend API Configuration
|
|
862
|
+
# In production, API calls should go through nginx proxy
|
|
863
|
+
VITE_API_BASE_URL=/api
|
|
864
|
+
REACT_APP_API_BASE_URL=/api
|
|
865
|
+
|
|
866
|
+
# Application URLs (for reference)
|
|
867
|
+
# Main App: http://localhost:${r}
|
|
868
|
+
${t?`# Workbench: http://localhost:${n}`:""}
|
|
869
|
+
|
|
870
|
+
# Override database and cache connections (default values as set in docker-compose file)
|
|
871
|
+
# RACLETTE_MONGODB_HOST=mongodb://database:27017/\${MONGO_DATABASE}
|
|
872
|
+
# RACLETTE_CACHE_URL=valkey://cache:6379
|
|
873
|
+
|
|
874
|
+
# Frontend environment overrides (optional)
|
|
875
|
+
# RACLETTE_DEBUG_MODE=true # uncomment, if you want to see all the frontend logs in the console
|
|
876
|
+
|
|
877
|
+
# Backend environment overrides (optional)
|
|
878
|
+
# RACLETTE_DISABLE_PLUGIN_LOGS=true
|
|
879
|
+
|
|
880
|
+
# Add any custom environment variables from your config here:
|
|
881
|
+
${Object.keys(e.env.production||{}).map(i=>`# ${i}=`).join(`
|
|
882
|
+
`)}
|
|
883
|
+
|
|
884
|
+
# MongoDB specific overrides (uncomment if using external MongoDB)
|
|
885
|
+
# RACLETTE_MONGODB_HOST=mongodb://your-external-mongodb:27017/your-database
|
|
886
|
+
|
|
887
|
+
# Cache specific overrides (uncomment if using external Valkey/Redis)
|
|
888
|
+
# RACLETTE_CACHE_URL=valkey://your-external-cache:6379
|
|
889
|
+
`},iC=async(e,t,r)=>{let n=r.services.frontend?.port||8081,o=r.services.workbench?.frontendPort||8083,i=`#!/bin/bash
|
|
890
|
+
# racletteJS Production Deployment Script
|
|
891
|
+
|
|
892
|
+
set -e
|
|
893
|
+
|
|
894
|
+
echo "\u{1F680} Deploying racletteJS application..."
|
|
895
|
+
|
|
896
|
+
# Check if .env file exists
|
|
897
|
+
if [ ! -f .env ]; then
|
|
898
|
+
echo "\u274C .env file not found. Copy .env.example and configure it first."
|
|
899
|
+
exit 1
|
|
900
|
+
fi
|
|
901
|
+
|
|
902
|
+
# Build and start services
|
|
903
|
+
echo "\u{1F433} Building Docker images..."
|
|
904
|
+
docker compose build --no-cache
|
|
905
|
+
|
|
906
|
+
echo "\u{1F7E2} Starting services..."
|
|
907
|
+
docker compose up -d
|
|
908
|
+
|
|
909
|
+
echo "\u23F3 Waiting for services to be healthy..."
|
|
910
|
+
sleep 30
|
|
911
|
+
|
|
912
|
+
# Check health
|
|
913
|
+
echo "\u{1F50D} Checking service health..."
|
|
914
|
+
docker compose ps
|
|
915
|
+
|
|
916
|
+
# Test endpoints
|
|
917
|
+
echo "\u{1F9EA} Testing application endpoints..."
|
|
918
|
+
if curl -f http://localhost:${n}/health > /dev/null 2>&1; then
|
|
919
|
+
echo "\u2705 Application health check passed"
|
|
920
|
+
else
|
|
921
|
+
echo "\u26A0\uFE0F Application health check failed, but services are running"
|
|
922
|
+
echo "\u{1F4A1} Make sure your Fastify backend has a /health endpoint and listens on 0.0.0.0:3000"
|
|
923
|
+
fi
|
|
924
|
+
|
|
925
|
+
echo "\u2705 Deployment complete!"
|
|
926
|
+
echo ""
|
|
927
|
+
echo "\u{1F30D} Application URLs:"
|
|
928
|
+
echo " Main App: http://localhost:${n}"
|
|
929
|
+
${t?`echo " Workbench: http://localhost:${o}"`:""}
|
|
930
|
+
echo ""
|
|
931
|
+
echo "\u{1F4CA} Management commands:"
|
|
932
|
+
echo " View logs: docker compose logs -f"
|
|
933
|
+
echo " Stop: docker compose down"
|
|
934
|
+
echo " Restart: docker compose restart"
|
|
935
|
+
echo " Update images: ./load-images.sh && docker compose up -d"
|
|
936
|
+
echo ""
|
|
937
|
+
echo "\u{1F6E0}\uFE0F Backend info:"
|
|
938
|
+
echo " - Built with TypeScript and compiled to dist/src/server.js"
|
|
939
|
+
echo " - Runs on Node.js 24 Alpine with production dependencies only"
|
|
940
|
+
echo " - Should listen on 0.0.0.0:3000 for proper container networking"
|
|
941
|
+
echo " - Accessible via /api proxy on port ${n}"
|
|
942
|
+
`,s=U.join(e,"deploy.sh");await H.writeFile(s,i),await H.chmod(s,493)},hh=async(e,t,r)=>{let n={services:{},volumes:{},networks:{raclette_shared:{external:!0,name:"raclette_shared"}}},o=`${e.name}-build`;if(e.services.mongodb?.enabled){let i=`${o}-mongodb-data`;n.services.mongodb={container_name:`${o}-mongodb`,image:"mongo:8.2",ports:[`127.0.0.1:${e.services.mongodb.port}:27017`],volumes:[`${i}:/data/db`],networks:["raclette_shared"],healthcheck:{test:["CMD","mongosh","--eval","db.adminCommand('ping')"],interval:"10s",timeout:"30s",retries:20}},n.volumes[i]=null}if(e.services.redis?.enabled){let i=`${o}-redis-data`;n.services.redis={container_name:`${o}-redis`,image:"redis:7-alpine",ports:[`127.0.0.1:${e.services.redis.port}:6379`],command:"redis-server --appendonly yes",volumes:[`${i}:/data`],networks:["raclette_shared"],healthcheck:{test:["CMD","redis-cli","ping"],interval:"10s",timeout:"5s",retries:3}},n.volumes[i]=null}if(e.services.backend?.enabled){let i=`${o}-backend_node_modules`;n.services.backend={container_name:`${o}-backend`,build:{context:".",dockerfile:"./backend.Dockerfile",args:{NODE_ENV:"development"}},command:"yarn generate",environment:["NODE_ENV=development","RACLETTE_BUILD_MODE=generate",`MONGO_HOST=mongodb://mongodb:${e.services.mongodb?.port||27017}/${e.services.mongodb?.databaseName||e.name}`,"SERVER_TOKEN_SECRET=${SERVER_TOKEN_SECRET:-thisshouldbesetforproduction}",`CACHE_URL=redis://redis:${e.services.redis?.port||6379}`,...Object.entries(e.env.development||{}).map(([s,a])=>`${s}=${a}`)],volumes:[`${i}:/app/node_modules`,"./.raclette/virtual/backend/src:/app/src","./plugins:/app/src/appPlugins","./.raclette/backend/raclette.config.js:/app/raclette.config.js","./.raclette/backend/package.json:/app/package.json","./.raclette/dist/check-dependencies.sh:/app/check-dependencies.sh",`${ur("backend",e)}:/app/yarn.lock`],networks:["raclette_shared"],depends_on:{...e.services.mongodb?.enabled&&{mongodb:{condition:"service_started"}},...e.services.redis?.enabled&&{redis:{condition:"service_healthy"}}},entrypoint:["/app/check-dependencies.sh"]},n.volumes[i]=null}e.services.backend?.volumes&&e.services.backend.volumes.length>0&&e.services.backend.volumes.forEach(i=>{let s=Rt(i,t);s&&n.services.backend.volumes.push(s)}),Object.values(n.services).forEach(i=>{i.volumes&&(i.volumes=Qn(i.volumes,t))}),await H.writeFile(r,ke.dump(n))},mh=async(e,t,r,n)=>{let o={services:{},volumes:{},networks:{raclette_shared:{external:!0,name:"raclette_shared"}}},i=`${e.name}-build`;if(e.services.frontend?.enabled){let s=e.services.frontend.nodeModulesVolume||`${e.name}-frontend_node_modules`;o.services.frontend={container_name:`${i}-frontend`,build:{context:".",dockerfile:"./frontend.Dockerfile",args:{NODE_ENV:"production"},target:"build"},command:["sh","-c","yarn install --production=false && yarn build && cp -r /app/dist/* /build-output/"],environment:[...Object.entries(e.env.production||{}).map(([a,c])=>`${a}=${c}`),"NODE_ENV=production"],volumes:["./.raclette/virtual/frontend/src:/app/src","./.raclette/virtual/backend/src/shared:/app/src/shared",`${s}:/app/node_modules`,"./plugins:/app/src/plugins","./.raclette/virtual/backend/src/corePlugins:/app/src/corePlugins","./.raclette/virtual/frontend/types:/app/types","./.raclette/frontend/raclette.config.js:/app/raclette.config.js","./.raclette/frontend/package.json:/app/package.json",`${ur("frontend",e)}:/app/yarn.lock`,`${U.resolve(n,"frontend")}:/build-output`],networks:["raclette_shared"]},o.volumes[s]=null;try{e.services.frontend?.volumes&&e.services.frontend.volumes.length>0&&e.services.frontend.volumes.forEach(a=>{let c=Rt(a,t);c&&o.services.frontend.volumes.push(c)})}catch{console.error(h.red("Could not add custom volumes to backend docker-compose file. This might lead to missing data."))}}if(e.services.backend?.enabled){let s=e.services.backend.nodeModulesVolume||`${e.name}-backend_node_modules`;o.services.backend={container_name:`${i}-backend`,build:{context:".",dockerfile:"./backend.Dockerfile",args:{NODE_ENV:"production"}},command:["sh","-c","yarn install --production=false && rm -rf ./dist && yarn build && cp -r /app/dist /build-output/ && cp /app/package.json /build-output/ && cp /app/yarn.lock /build-output/ || echo 'Backend build failed'"],environment:[...Object.entries(e.env.production||{}).map(([a,c])=>`${a}=${c}`),"NODE_ENV=production"],volumes:[`${s}:/app/node_modules`,"./.raclette/virtual/backend/src:/app/src","./.raclette/backend/raclette.config.js:/app/raclette.config.js","./plugins:/app/src/appPlugins","./.raclette/backend/package.json:/app/package.json",`${ur("backend",e)}:/app/yarn.lock`,"./.raclette/virtual/backend/types:/app/types",`${U.resolve(n,"backend")}:/build-output`],networks:["raclette_shared"]},o.volumes[s]=null;try{e.services.backend?.volumes&&e.services.backend.volumes.length>0&&e.services.backend.volumes.forEach(a=>{let c=Rt(a,t);c&&o.services.backend.volumes.push(c)})}catch{console.error(h.red("Could not add custom volumes to backend docker-compose file. This might lead to missing data."))}}Object.values(o.services).forEach(s=>{s.volumes&&(s.volumes=Qn(s.volumes,t))}),await H.writeFile(r,ke.dump(o))},sC=async(e,t,r,n)=>{let o=n.services.frontend?.port||8081,i=n.services.workbench?.frontendPort||8083,s=`#!/bin/bash
|
|
943
|
+
# racletteJS Production Deployment Script with Image Loading
|
|
944
|
+
|
|
945
|
+
set -e
|
|
946
|
+
|
|
947
|
+
echo "\u{1F680} Deploying racletteJS application from packaged images..."
|
|
948
|
+
|
|
949
|
+
# Check if running from package directory
|
|
950
|
+
if [ ! -d "images" ]; then
|
|
951
|
+
echo "\u274C Images directory not found. Make sure you're running this from the extracted package directory."
|
|
952
|
+
exit 1
|
|
953
|
+
fi
|
|
954
|
+
|
|
955
|
+
# Check if .env file exists
|
|
956
|
+
if [ ! -f .env ]; then
|
|
957
|
+
echo "\u274C .env file not found. Copy .env.example and configure it first."
|
|
958
|
+
echo "\u{1F4A1} Run: cp .env.example .env && nano .env"
|
|
959
|
+
exit 1
|
|
960
|
+
fi
|
|
961
|
+
|
|
962
|
+
# Load Docker images
|
|
963
|
+
echo "\u{1F4E5} Loading Docker images..."
|
|
964
|
+
./load-images.sh
|
|
965
|
+
|
|
966
|
+
# Build and start services (images are already loaded)
|
|
967
|
+
echo "\u{1F7E2} Starting services..."
|
|
968
|
+
docker compose up -d
|
|
969
|
+
|
|
970
|
+
echo "\u23F3 Waiting for services to be healthy..."
|
|
971
|
+
sleep 30
|
|
972
|
+
|
|
973
|
+
# Check health
|
|
974
|
+
echo "\u{1F50D} Checking service health..."
|
|
975
|
+
docker compose ps
|
|
976
|
+
|
|
977
|
+
# Test endpoints
|
|
978
|
+
echo "\u{1F9EA} Testing application endpoints..."
|
|
979
|
+
if curl -f http://localhost:${o}/health > /dev/null 2>&1; then
|
|
980
|
+
echo "\u2705 Application health check passed"
|
|
981
|
+
else
|
|
982
|
+
echo "\u26A0\uFE0F Application health check failed, but services are running"
|
|
983
|
+
echo "\u{1F4A1} Make sure your Fastify backend has a /health endpoint and listens on 0.0.0.0:3000"
|
|
984
|
+
fi
|
|
985
|
+
|
|
986
|
+
echo "\u2705 Deployment complete!"
|
|
987
|
+
echo ""
|
|
988
|
+
echo "\u{1F30D} Application URLs:"
|
|
989
|
+
echo " Main App: http://localhost:${o}"
|
|
990
|
+
${r?`echo " Workbench: http://localhost:${i}"`:""}
|
|
991
|
+
echo ""
|
|
992
|
+
echo "\u{1F4CA} Management commands:"
|
|
993
|
+
echo " View logs: docker compose logs -f"
|
|
994
|
+
echo " Stop: docker compose down"
|
|
995
|
+
echo " Restart: docker compose restart"
|
|
996
|
+
echo " Update images: ./load-images.sh && docker compose up -d"
|
|
997
|
+
`;await H.writeFile(U.join(e,"deploy.sh"),s),await H.chmod(U.join(e,"deploy.sh"),493)},aC=async(e,t)=>{let r=`#!/bin/bash
|
|
998
|
+
# Load Docker Images Script
|
|
999
|
+
|
|
1000
|
+
set -e
|
|
1001
|
+
|
|
1002
|
+
echo "\u{1F4E5} Loading Docker images..."
|
|
1003
|
+
|
|
1004
|
+
if [ ! -d "images" ]; then
|
|
1005
|
+
echo "\u274C Images directory not found"
|
|
1006
|
+
exit 1
|
|
1007
|
+
fi
|
|
1008
|
+
|
|
1009
|
+
cd images
|
|
1010
|
+
|
|
1011
|
+
# Load each image
|
|
1012
|
+
${t.map(n=>{let o=n.replace(/[:/]/g,"_");return`echo " \u{1F4E6} Loading ${n}..."
|
|
1013
|
+
if [ -f "${o}.tar" ]; then
|
|
1014
|
+
docker load -i "${o}.tar"
|
|
1015
|
+
echo " \u2705 Loaded ${n}"
|
|
1016
|
+
else
|
|
1017
|
+
echo " \u274C Image file ${o}.tar not found"
|
|
1018
|
+
exit 1
|
|
1019
|
+
fi`}).join(`
|
|
1020
|
+
|
|
1021
|
+
`)}
|
|
1022
|
+
|
|
1023
|
+
cd ..
|
|
1024
|
+
|
|
1025
|
+
echo "\u2705 All images loaded successfully!"
|
|
1026
|
+
echo ""
|
|
1027
|
+
echo "\u{1F433} Available images:"
|
|
1028
|
+
docker images | grep -E "${t.map(n=>n.split(":")[0]).join("|")}" || echo "No images found (this might be expected if tags changed)"
|
|
1029
|
+
`;await H.writeFile(U.join(e,"load-images.sh"),r),await H.chmod(U.join(e,"load-images.sh"),493)},cC=async(e,t,r,n)=>{let o=t.services.frontend?.port||8081,i=t.services.workbench?.frontendPort||8083,s=`# ${t.name} - Deployment Package
|
|
1030
|
+
|
|
1031
|
+
This package contains everything needed to deploy your racletteJS application.
|
|
1032
|
+
|
|
1033
|
+
## Contents
|
|
1034
|
+
|
|
1035
|
+
- \`images/\` - Docker images as TAR files
|
|
1036
|
+
- \`docker-compose.yml\` - Production compose configuration
|
|
1037
|
+
- \`.env.example\` - Environment variables template
|
|
1038
|
+
- \`deploy.sh\` - Main deployment script
|
|
1039
|
+
- \`load-images.sh\` - Load Docker images script
|
|
1040
|
+
- \`nginx.conf\` - Nginx configuration
|
|
1041
|
+
${n?"- `nginx.workbench.conf` - Workbench nginx configuration":""}
|
|
1042
|
+
|
|
1043
|
+
## Quick Start
|
|
1044
|
+
|
|
1045
|
+
1. **Extract the package:**
|
|
1046
|
+
\`\`\`bash
|
|
1047
|
+
tar -xzf ${t.name}-deployment-*.tar.gz
|
|
1048
|
+
cd ${t.name}-deployment-*
|
|
1049
|
+
\`\`\`
|
|
1050
|
+
|
|
1051
|
+
2. **Configure environment:**
|
|
1052
|
+
\`\`\`bash
|
|
1053
|
+
cp .env.example .env
|
|
1054
|
+
nano .env # Edit your configuration
|
|
1055
|
+
\`\`\`
|
|
1056
|
+
|
|
1057
|
+
3. **Deploy:**
|
|
1058
|
+
\`\`\`bash
|
|
1059
|
+
chmod +x deploy.sh load-images.sh
|
|
1060
|
+
./deploy.sh
|
|
1061
|
+
\`\`\`
|
|
1062
|
+
|
|
1063
|
+
## Manual Deployment
|
|
1064
|
+
|
|
1065
|
+
If you prefer manual control:
|
|
1066
|
+
|
|
1067
|
+
1. **Load images:**
|
|
1068
|
+
\`\`\`bash
|
|
1069
|
+
./load-images.sh
|
|
1070
|
+
\`\`\`
|
|
1071
|
+
|
|
1072
|
+
2. **Start services:**
|
|
1073
|
+
\`\`\`bash
|
|
1074
|
+
docker compose up -d
|
|
1075
|
+
\`\`\`
|
|
1076
|
+
|
|
1077
|
+
## Included Images
|
|
1078
|
+
|
|
1079
|
+
${r.map(a=>`- \`${a}\``).join(`
|
|
1080
|
+
`)}
|
|
1081
|
+
|
|
1082
|
+
## Environment Variables
|
|
1083
|
+
|
|
1084
|
+
Copy \`.env.example\` to \`.env\` and configure:
|
|
1085
|
+
|
|
1086
|
+
- \`SERVER_TOKEN_SECRET\` - **Required** - Generate a secure random string
|
|
1087
|
+
- \`MONGO_DATABASE\` - Database name (default: ${t.services.mongodb?.databaseName||t.name})
|
|
1088
|
+
- \`NODE_ENV=production\` - **Required for production**
|
|
1089
|
+
|
|
1090
|
+
## Application URLs
|
|
1091
|
+
|
|
1092
|
+
After deployment:
|
|
1093
|
+
- Main Application: http://localhost:${o}
|
|
1094
|
+
${n?`- Workbench: http://localhost:${i}`:""}
|
|
1095
|
+
|
|
1096
|
+
## Management Commands
|
|
1097
|
+
|
|
1098
|
+
- **View logs:** \`docker compose logs -f\`
|
|
1099
|
+
- **Stop services:** \`docker compose down\`
|
|
1100
|
+
- **Restart services:** \`docker compose restart\`
|
|
1101
|
+
- **Update:** Re-run \`./load-images.sh && docker compose up -d\`
|
|
1102
|
+
|
|
1103
|
+
## Troubleshooting
|
|
1104
|
+
|
|
1105
|
+
- **Health check fails:** Ensure your backend has a \`/health\` endpoint
|
|
1106
|
+
- **502 errors:** Check backend logs with \`docker compose logs backend\`
|
|
1107
|
+
- **Images not loading:** Verify Docker is running and you have sufficient disk space
|
|
1108
|
+
|
|
1109
|
+
## System Requirements
|
|
1110
|
+
|
|
1111
|
+
- Docker and Docker Compose
|
|
1112
|
+
- At least 2GB free disk space
|
|
1113
|
+
- Ports ${o}${n?`, ${i}`:""} available
|
|
1114
|
+
|
|
1115
|
+
Generated on: ${new Date().toISOString()}
|
|
1116
|
+
`;await H.writeFile(U.join(e,"README.md"),s)},gh=async(e,t,r,n,o)=>{console.log(h.blue("\u{1F4E6} Packaging images for distribution..."));let i=U.join(t,"..","package"),s=`${e.name}-deployment-${n}`,a=U.join(i,`${s}.tar.gz`);await H.ensureDir(i),await H.emptyDir(i);let c=U.join(i,s);await H.ensureDir(c);try{console.log(h.gray(" \u{1F4BE} Exporting Docker images..."));let u=U.join(c,"images");await H.ensureDir(u);for(let p of r){let d=`${p.replace(/[:/]/g,"_")}.tar`,y=U.join(u,d);console.log(h.gray(` \u{1F4E6} Exporting ${p}...`)),pe(["save","-o",y,p],{stdio:"pipe"});let g=await H.stat(y);if(g.size===0)throw new Error(`Failed to export image ${p}`);console.log(h.gray(` \u2705 Exported ${p} (${(g.size/1024/1024).toFixed(1)}MB)`))}console.log(h.gray(" \u{1F4C4} Copying deployment files..."));let l=["docker-compose.yml",".env.example","deploy.sh","nginx.conf"];return o&&l.push("nginx.workbench.conf"),await tC(l,t,c,{required:!1,logPrefix:" "}),await sC(c,r,o,e),await aC(c,r),await cC(c,e,r,o),console.log(h.gray(" \u{1F5DC}\uFE0F Creating deployment package...")),await lC(c,a),await H.remove(c),console.log(h.green(` \u2705 Deployment package created: ${s}.tar.gz`)),{packagePath:a,imageNames:r}}catch(u){throw await H.remove(c).catch(()=>{}),u}},lC=async(e,t)=>{let r=U.dirname(e),n=U.basename(e);Zw(`tar -czf "${t}" -C "${r}" "${n}"`,{stdio:"pipe"});let o=await H.stat(t);console.log(h.gray(` \u{1F4E6} Package size: ${(o.size/1024/1024).toFixed(1)}MB`))};var yh=60,La=7200,pC=()=>{let e=process.env.RACLETTE_GENERATION_MODE_TIMEOUT_SECONDS,t,r;if(e===void 0||e==="")t=yh,r="default (env unset)";else{let n=Number.parseInt(e,10);!Number.isFinite(n)||n<1?(t=yh,r=`invalid env "${e}", using default`):(t=Math.min(n,La),r=n>La?`capped from ${n}s to max ${La}s`:`from env RACLETTE_GENERATION_MODE_TIMEOUT_SECONDS=${e}`)}return console.log(h.gray(` \u23F1\uFE0F Generation mode wait: ${t}s (${r})`)),t},vh=async(e,t,r={})=>{let n=Date.now(),o=dC(r);console.log(h.blue(`\u{1F9C0} Starting racletteJS ${o} build...`)),Kn();let i=G.join(process.cwd(),".raclette"),s=G.resolve(r.outputDir||G.join(i,".build"));await V.ensureDir(s),await V.emptyDir(s);try{await _C(e,t,i),await EC(e,t,i);let a={mode:o,buildDir:s,artifacts:{}};switch(o){case"artifacts":a=await fC(e,i,s,r);break;case"images":a=await bh(e,i,s,r);break;case"package":a=await hC(e,i,s,r);break}let c=(Date.now()-n)/1e3;return f.success(` ${o} build completed in ${c}s`),bC(a,e),a}catch(a){throw f.error(`${o} build failed: ${a.message}`),a}},dC=e=>e.mode?e.mode:e.packageImages?"package":e.buildImages?"images":(e.buildOnly,"artifacts"),fC=async(e,t,r,n)=>{if(n.buildOnly){console.log(h.blue("\u{1F4C1} Building application files only...")),await Ia(e,t,r,n);let i=await Fa(e,r,n);return console.log(h.green("\u2705 Build files ready")),{mode:"artifacts",buildDir:r,artifacts:{}}}else{console.log(h.blue("\u{1F4C1} Building local deployment artifacts..."));let i=G.join(r,"service");await Ia(e,t,i,n);let s=await Fa(e,r,n),a=await Da(e,r,s),c=await vC(e,r,s);return console.log(h.green("\u2705 Local deployment artifacts ready")),{mode:"artifacts",buildDir:r,artifacts:{composeFile:a,deployScript:G.join(r,"deploy.sh"),readmeFile:c,envExampleFile:G.join(r,".env.example")}}}},bh=async(e,t,r,n)=>{console.log(h.blue("\u{1F433} Building Docker images for CI/CD..."));let o=G.join(r,"service");await Ia(e,t,o,n);let i=await Fa(e,r,n);await Da(e,r,i);let s=await mC(e,r,i,n);return console.log(h.green("\u2705 Docker images ready for registry push")),{mode:"images",buildDir:r,images:s,artifacts:{}}},hC=async(e,t,r,n)=>{console.log(h.blue("\u{1F4E6} Building offline deployment package..."));let o=await bh(e,t,r,n),i=_h(),s=await gh(e,r,o.images.names,i,o.images.names.some(a=>a.includes("workbench")));return console.log(h.green("\u2705 Offline deployment package ready")),{...o,mode:"package",deploymentPackage:s.packagePath}},mC=async(e,t,r,n)=>{let o=n.imagePrefix||e.name,i=n.imageTag||_h(),s=n.platforms||"linux/amd64,linux/arm64",a=n.buildx||!1,c=[],u=[i];if(n.generateLatest&&!u.includes("latest")&&u.push("latest"),a)try{await gC(),console.log(h.blue(`\u{1F3D7}\uFE0F Building multi-architecture images for: ${s}`))}catch(l){console.warn(h.yellow("\u26A0\uFE0F Buildx not available, falling back to single-architecture builds")),console.warn(h.yellow(` ${l.message}`)),a=!1}if(a){let l=["frontend","backend"];r&&l.push("workbench-frontend","workbench-backend");for(let p of l){let d=`${o}/${p}`,y=G.join(t,`Dockerfile.${p}`);if(!await V.pathExists(y))throw new Error(`Dockerfile not found: ${y}`);let g=u.map(m=>`${d}:${m}`);c.push(...g),await yC({context:t,dockerfile:y,tags:g,platforms:s,push:!1,noCache:n.noCache,verbose:n.verbose}),console.log(h.gray(` \u2705 Built ${p} for ${s}`)),g.forEach(m=>{console.log(h.gray(` ${m}`))})}}else{console.log(h.gray(" \u{1F528} Building single-architecture images..."));let p=["-f",G.join(t,"docker-compose.yml"),"build"];n.noCache&&p.push("--no-cache"),Ee(p,{stdio:n.verbose?"inherit":"pipe",cwd:t});let d=["frontend","backend"];r&&d.push("workbench-frontend","workbench-backend");for(let y of d){let g=`${G.basename(t)}-${y}`.replace(/\./,""),m=`${o}/${y}`;u.forEach(E=>{let x=`${m}:${E}`;pe(["tag",g,x],{stdio:"pipe"}),c.push(x)}),console.log(h.gray(` \u2705 Tagged ${y}`))}}return console.log(h.green(" \u2705 Docker images built and tagged")),{names:c,tags:u}},gC=async()=>{try{pe(["buildx","version"],{stdio:"pipe"}),console.log(h.gray(" \u{1F4E6} Setting up QEMU for cross-platform emulation...")),pe(["run","--rm","--privileged","multiarch/qemu-user-static","--reset","-p","yes"],{stdio:"pipe"}),console.log(h.gray(" \u{1F4E6} Creating buildx builder...")),pe(["buildx","create","--name","multiarch","--use"],{stdio:"pipe"}),pe(["buildx","inspect","--bootstrap"],{stdio:"pipe"}),console.log(h.gray(" \u2705 Buildx builder ready with QEMU emulation"))}catch(e){throw console.warn(h.yellow(" \u26A0\uFE0F Buildx setup failed, falling back to single-architecture builds")),console.warn(h.yellow(` ${e.message}`)),new Error("Buildx not available - use single-architecture builds instead")}},yC=async e=>{let t=["buildx","build","--platform",e.platforms,"--file",e.dockerfile];e.tags.forEach(n=>{t.push("--tag",n)});let r=e.platforms.split(",").length;e.push?t.push("--push"):r===1?t.push("--load"):(console.log(h.yellow(" \u26A0\uFE0F Multi-platform images cannot be loaded locally")),console.log(h.yellow(" \u2139\uFE0F Images built but not loaded to local Docker"))),e.noCache&&t.push("--no-cache"),t.push(e.context);try{pe(t,{stdio:e.verbose?"inherit":"pipe",cwd:e.context})}catch(n){throw new Error(`Failed to build multi-architecture image: ${n}`)}},vC=async(e,t,r)=>{let n=G.join(t,"README.md"),o=e.services.frontend?.port||8081,i=e.services.workbench?.frontendPort||8083,s=`# ${e.name} - Local Deployment
|
|
1117
|
+
|
|
1118
|
+
This build contains everything needed to deploy ${e.name} locally using Docker.
|
|
1119
|
+
|
|
1120
|
+
## Quick Start
|
|
1121
|
+
|
|
1122
|
+
1. **Configure environment:**
|
|
1123
|
+
\`\`\`bash
|
|
1124
|
+
cp .env.example .env
|
|
1125
|
+
nano .env # Edit SERVER_TOKEN_SECRET and other settings
|
|
1126
|
+
\`\`\`
|
|
1127
|
+
|
|
1128
|
+
2. **Deploy:**
|
|
1129
|
+
\`\`\`bash
|
|
1130
|
+
chmod +x deploy.sh
|
|
1131
|
+
./deploy.sh
|
|
1132
|
+
\`\`\`
|
|
1133
|
+
|
|
1134
|
+
## What happens during deployment:
|
|
1135
|
+
|
|
1136
|
+
- \u{1F433} Docker images are built from the included artifacts
|
|
1137
|
+
- \u{1F7E2} Services start: frontend, backend, database, cache${r?", workbench":""}
|
|
1138
|
+
- \u{1F9EA} Health checks verify everything is running
|
|
1139
|
+
- \u2705 Application becomes available
|
|
1140
|
+
|
|
1141
|
+
## Application URLs
|
|
1142
|
+
|
|
1143
|
+
After deployment:
|
|
1144
|
+
- **Main Application:** http://localhost:${o}
|
|
1145
|
+
${r?`- **Workbench:** http://localhost:${i}`:""}
|
|
1146
|
+
|
|
1147
|
+
## Environment Configuration
|
|
1148
|
+
|
|
1149
|
+
**Required settings in .env:**
|
|
1150
|
+
- \`SERVER_TOKEN_SECRET\` - Generate a secure random string (required)
|
|
1151
|
+
- \`MONGO_DATABASE\` - Database name (default: ${e.name})
|
|
1152
|
+
|
|
1153
|
+
**Optional settings:**
|
|
1154
|
+
- \`RACLETTE_DEBUG_MODE\` - Enable debug logging (default: false)
|
|
1155
|
+
- \`RACLETTE_MONGODB_HOST\` - Custom MongoDB connection
|
|
1156
|
+
- \`RACLETTE_CACHE_URL\` - Custom cache connection
|
|
1157
|
+
|
|
1158
|
+
## Management Commands
|
|
1159
|
+
|
|
1160
|
+
- **View logs:** \`docker compose logs -f\`
|
|
1161
|
+
- **Stop services:** \`docker compose down\`
|
|
1162
|
+
- **Restart services:** \`docker compose restart\`
|
|
1163
|
+
- **Remove everything:** \`docker compose down -v\` (\u26A0\uFE0F removes data)
|
|
1164
|
+
|
|
1165
|
+
## Customization
|
|
1166
|
+
|
|
1167
|
+
Edit \`docker-compose.yml\` to:
|
|
1168
|
+
- Change port mappings
|
|
1169
|
+
- Add volume mounts for custom files
|
|
1170
|
+
- Modify environment variables
|
|
1171
|
+
- Add additional services
|
|
1172
|
+
|
|
1173
|
+
## Troubleshooting
|
|
1174
|
+
|
|
1175
|
+
- **Health check fails:** Backend may need more time to start, check logs
|
|
1176
|
+
- **502 errors:** Backend not responding, verify database connection
|
|
1177
|
+
- **Permission issues:** Ensure deploy.sh is executable (\`chmod +x deploy.sh\`)
|
|
1178
|
+
|
|
1179
|
+
Built on: ${new Date().toISOString()}
|
|
1180
|
+
Build type: Local deployment artifacts
|
|
1181
|
+
`;return await V.writeFile(n,s),console.log(h.gray(" \u2705 Created local deployment README")),n},bC=(e,t)=>{let r=t.services.frontend?.port||8081,n=t.services.workbench?.frontendPort||8083,o=e.images?.names.some(i=>i.includes("workbench"))||!1;switch(console.log(""),console.log(h.blue("\u{1F4E6} Build Summary:")),console.log(` Mode: ${h.cyan(e.mode)}`),console.log(` Build Directory: ${h.cyan(e.buildDir)}`),e.mode==="artifacts"&&(console.log(` Docker Compose: ${h.cyan(e.artifacts.composeFile||"N/A")}`),console.log(` Deploy Script: ${h.cyan(e.artifacts.deployScript||"N/A")}`),console.log(` README: ${h.cyan(e.artifacts.readmeFile||"N/A")}`)),e.images&&e.images.names.length>0&&(console.log(` Docker Images: ${h.cyan(e.images.names.length)} built`),e.images.names.forEach(i=>{console.log(` - ${h.gray(i)}`)})),e.deploymentPackage&&console.log(` Deployment Package: ${h.cyan(e.deploymentPackage)}`),console.log(""),console.log(h.blue("\u{1F680} Next steps:")),e.mode){case"artifacts":console.log(h.yellow(" 1. Configure: cp .env.example .env && edit .env")),console.log(h.yellow(" 2. Deploy: chmod +x deploy.sh && ./deploy.sh")),console.log(h.yellow(` \u2192 App will be at http://localhost:${r}`)),o&&console.log(h.yellow(` \u2192 Workbench at http://localhost:${n}`));break;case"images":console.log(h.yellow(" Images ready for registry push:")),e.images?.names.forEach(i=>{console.log(h.yellow(` docker push ${i}`))}),console.log(""),console.log(h.gray(" \u{1F4A1} Example pipeline usage:")),console.log(h.gray(" docker push myregistry.com/myproject/frontend:v1.0.0")),console.log(h.gray(" docker push myregistry.com/myproject/backend:v1.0.0"));break;case"package":console.log(h.yellow(" 1. Transfer package to target system")),console.log(h.yellow(" 2. Extract: tar -xzf deployment-package.tar.gz")),console.log(h.yellow(" 3. Configure: cp .env.example .env && edit .env")),console.log(h.yellow(" 4. Deploy: ./deploy.sh"));break}},_h=()=>new Date().toISOString().slice(0,10).replace(/-/g,""),_C=async(e,t,r)=>{console.log(h.blue("\u{1F4C1} Setting up build environment...")),await io(e),await oo(e),await dh(e),await so(e,r),await ro(e,r),await zf(e,r),console.log(h.green("\u2705 Build environment ready"))},EC=async(e,t,r)=>{console.log(h.blue("\u26A1 Running generation mode..."));let n=`${e.name}-build`,o=G.join(r,"docker-compose.generate.yml");await Zn(e,r,"build"),await hh(e,t,o),zn("raclette_shared");try{console.log(h.gray(" \u{1F433} Starting generation services...")),Ee(["-p",n,"-f",o,"up","-d"],{stdio:"pipe"}),console.log(h.gray(" \u23F3 Waiting for file generation to complete..."));let i=0,s=pC();for(;i<s;)try{if(!(await Ee(["-p",n,"-f",o,"ps","-q","backend"],{stdio:"pipe"})).trim())break;await new Promise(c=>setTimeout(c,1e3)),i++}catch{break}if(i>=s)throw new Error(`Generation mode timed out after ${s}s (set RACLETTE_GENERATION_MODE_TIMEOUT_SECONDS to increase)`);console.log(h.green(" \u2705 File generation completed"))}finally{try{Ee(["-p",n,"-f",o,"down"],{stdio:"pipe"})}catch{console.warn(h.yellow("Warning: Could not cleanup generation services"))}}},Ia=async(e,t,r,n)=>{console.log(h.blue("\u{1F3A8} Building main application...")),await V.ensureDir(r),await Zn(e,t,"build"),await xC(e,t,r,n)},xC=async(e,t,r,n)=>{console.log(h.gray(" \u{1F680} Building frontend and backend..."));let o=`${e.name}-app-build`,i=G.join(t,"docker-compose.app-build.yml"),s=G.join(t,".temp-build");await V.ensureDir(s),await V.ensureDir(G.join(s,"frontend")),await V.ensureDir(G.join(s,"backend"));try{await mh(e,process.cwd(),i,s);let a=["-p",o,"-f",i,"up"];if(n.noCache&&a.push("--build","--force-recreate"),console.log(h.gray(" \u{1F528} Starting parallel build process...")),Ee(a,{stdio:n.verbose?"inherit":"pipe",cwd:process.cwd()}),e.services.frontend?.enabled){let c=G.join(r,"frontend");await V.ensureDir(c);let u=G.join(s,"frontend");if(await V.pathExists(u)){if((await V.readdir(u)).length===0)throw new Error("Frontend build produced no output files");await V.copy(u,c),console.log(h.green(" \u2705 Frontend build complete"))}else throw new Error("Frontend build did not produce expected output directory")}if(e.services.backend?.enabled){let c=G.join(r,"backend");await V.ensureDir(c);let u=G.join(s,"backend");if(!await V.pathExists(u))throw new Error("Backend build did not produce expected output directory");await kC(e,t,c,s),console.log(h.green(" \u2705 Backend build complete"))}console.log(h.green(" \u2705 Application build completed"))}finally{try{Ee(["-p",o,"-f",i,"down"],{stdio:"pipe"})}catch{console.warn(h.yellow("Warning: Could not cleanup build services"))}await V.remove(s),await V.remove(i)}},kC=async(e,t,r,n)=>{console.log(h.gray(" \u{1F4E6} Creating backend Node.js application..."));let o=G.join(n,"backend");await V.ensureDir(r),await V.pathExists(o)&&(await V.copy(o,r),console.log(h.gray(" \u2705 Copied backend build artifacts")));let i=G.join(r,"dist");if(!await V.pathExists(i))throw new Error("Backend build did not produce expected dist/ folder");let s=G.join(i,"src","server.js");if(!await V.pathExists(s))throw new Error("Backend build did not produce expected dist/src/server.js entry point");let a=G.join(r,"package.json");if(await V.pathExists(a)){let u=await V.readJson(a),l={...u,scripts:{start:"node dist/src/server.js",...u.scripts},devDependencies:void 0};await V.writeJson(a,l,{spaces:2}),console.log(h.gray(" \u2705 Updated package.json for production"))}else throw new Error("Backend build did not include package.json");let c=G.join(r,"yarn.lock");await V.pathExists(c)||console.warn(h.yellow(" \u26A0\uFE0F No yarn.lock found in backend build")),console.log(h.gray(" \u2705 Backend Node.js application structure created")),console.log(h.gray(" \u{1F4C1} Entry point: dist/src/server.js")),await wC(r)},wC=async e=>{let t=["package.json","yarn.lock","dist/src/server.js"],r=[];for(let i of t){let s=G.join(e,i);await V.pathExists(s)||r.push(i)}if(r.length>0)throw new Error(`Backend application is missing required files: ${r.join(", ")}`);let n=G.join(e,"package.json"),o=await V.readJson(n);(!o.scripts?.start||!o.scripts.start.includes("dist/src/server.js"))&&console.warn(h.yellow(" \u26A0\uFE0F package.json start script may not point to dist/src/server.js")),console.log(h.gray(" \u2705 Backend structure verified successfully"))},Fa=async(e,t,r)=>!e.services.workbench?.enabled||r.skipWorkbench?!1:(await CC(e,t,r),!0),CC=async(e,t,r)=>{console.log(h.blue("\u{1F527} Building workbench..."));let n=G.join(process.cwd(),"node_modules","@raclettejs","workbench");if(!await V.pathExists(n)){f.warn("Workbench package not found, skipping workbench build");return}let o=G.join(t,"workbench"),i;if(e.workbench)try{ao(e.workbench),i=await co(e.workbench)}catch(s){throw console.error(h.red("Workbench configuration error:"),s.message),s}try{let s={...process.env,MONGO_HOST:`mongodb://localhost:${e.services.mongodb?.port||27017}/${e.services.mongodb?.databaseName||e.name}`,CACHE_URL:`redis://localhost:${e.services.redis?.port||6379}`,...e.env.development},a=`${e.name}-workbench`;console.log(h.gray(" \u{1F527} Running workbench build process as "+a)),await new Promise((c,u)=>{let l=["build","--output-dir",o,"--build-only",r.verbose?"-v":"","-p",a,...i?["-f",i]:[]].filter(d=>d!==""),p=uC("yarn",l,{cwd:n,stdio:r.verbose?"inherit":"ignore",env:s});p.on("close",d=>{f.raw(h.gray(` \u{1F3C1} Workbench build process exited with code ${d}`)),d===0?c():u(new Error(`Workbench build failed with exit code ${d}`))}),p.on("error",d=>{f.raw(h.red(` \u274C Workbench build process error: ${d.message}`)),u(d)})}),f.raw(h.green(" \u2705 Workbench build complete"))}catch(s){throw f.error("Workbench build failed: "+s.message),s}};import ft from"fs-extra";import dt from"path";var ja=()=>[{description:"custom favicon",source:"./branding/favicon.png",target:"/usr/shared/nginx/html/favicon.png",service:"frontend"},{description:"custom logo in app",source:"./branding/custom-logo.png",target:"/usr/shared/nginx/html/logo.png",service:"frontend"},{description:"custom home icon (can be full logo or just an icon)",source:"./branding/custom-home-icon.png",target:"/usr/shared/nginx/html/home-icon.png",service:"frontend"},{description:"custom logo in login screen (not used, if not set)",source:"./branding/custom-login-logo.png",target:"/usr/shared/nginx/html/login-logo.png",service:"frontend"}];var Eh=async(e,t={})=>{console.log(h.blue("\u{1F4CB} Generating deployment guide..."));let r=dt.resolve(t.outputDir||process.cwd()),n=t.imagePrefix||e.name,o=t.imageTag||"latest",i=t.registry||"",s=wh(e,n,o,i);return t.generateFiles?await RC(e,s,r,i):await OC(e,s,r,i)},xh=async(e,t={})=>{let r=t.imagePrefix||e.name,n=t.imageTag||"latest",o=t.registry||"",i=wh(e,r,n,o);return await AC(e,i,n,o)},AC=async(e,t,r,n)=>{let o=e.services.frontend?.port||8081,i=e.services.workbench?.frontendPort||8083,s=await Ah(e,t,r,n),a=await Sh(),c=SC(e.name,r);return`# Deploy ${e.name} with Docker
|
|
1182
|
+
|
|
1183
|
+
Deploy ${e.name} using pre-built Docker images.
|
|
1184
|
+
|
|
1185
|
+
## Quick Start
|
|
1186
|
+
|
|
1187
|
+
### 1. Create docker-compose.yml
|
|
1188
|
+
|
|
1189
|
+
\`\`\`yaml
|
|
1190
|
+
${s}
|
|
1191
|
+
\`\`\`
|
|
1192
|
+
|
|
1193
|
+
### 2. Create .env file
|
|
1194
|
+
|
|
1195
|
+
\`\`\`bash
|
|
1196
|
+
${c}
|
|
1197
|
+
\`\`\`
|
|
1198
|
+
|
|
1199
|
+
### 3. Deploy
|
|
1200
|
+
|
|
1201
|
+
\`\`\`bash
|
|
1202
|
+
docker compose up -d
|
|
1203
|
+
\`\`\`
|
|
1204
|
+
|
|
1205
|
+
## Application URLs
|
|
1206
|
+
|
|
1207
|
+
- **Main Application:** http://localhost:${o}
|
|
1208
|
+
${t.hasWorkbench?`- **Workbench:** http://localhost:${i}`:""}
|
|
1209
|
+
|
|
1210
|
+
## Customization
|
|
1211
|
+
|
|
1212
|
+
Create \`docker-compose.override.yml\` for customizations:
|
|
1213
|
+
|
|
1214
|
+
\`\`\`yaml
|
|
1215
|
+
${a}
|
|
1216
|
+
\`\`\`
|
|
1217
|
+
|
|
1218
|
+
*Note for developers: The volume examples above can be customized based on
|
|
1219
|
+
your application's specific customization points. Update the paths and
|
|
1220
|
+
descriptions as needed for your project.*
|
|
1221
|
+
|
|
1222
|
+
## Management
|
|
1223
|
+
|
|
1224
|
+
\`\`\`bash
|
|
1225
|
+
# View logs
|
|
1226
|
+
docker compose logs -f
|
|
1227
|
+
|
|
1228
|
+
# Update to latest images
|
|
1229
|
+
docker compose pull && docker compose up -d
|
|
1230
|
+
|
|
1231
|
+
# Stop services
|
|
1232
|
+
docker compose down
|
|
1233
|
+
|
|
1234
|
+
# Remove all data (\u26A0\uFE0F destructive)
|
|
1235
|
+
docker compose down -v
|
|
1236
|
+
\`\`\`
|
|
1237
|
+
|
|
1238
|
+
## System Requirements
|
|
1239
|
+
|
|
1240
|
+
- Docker and Docker Compose
|
|
1241
|
+
- 2GB+ available RAM
|
|
1242
|
+
- Ports ${o}${t.hasWorkbench?`, ${i}`:""} available
|
|
1243
|
+
|
|
1244
|
+
## Troubleshooting
|
|
1245
|
+
|
|
1246
|
+
- **502 errors:** Check backend logs with \`docker compose logs backend\`
|
|
1247
|
+
- **Database connection:** Verify MongoDB is healthy with \`docker compose ps\`
|
|
1248
|
+
- **Image pull errors:** Check registry access and IMAGE_TAG value
|
|
1249
|
+
`},SC=(e,t)=>["# Required","RACLETTE_SERVER_TOKEN_SECRET=your-secret-key-here","RACLETTE_FRONTEND_URLS=https://yourdomain.com,https://workbench.yourdomain.com # required to prevent CORS issues","","# Database Name",`RACLETTE_MONGO_DATABASE=${e}`,"","# Image Configuration",`IMAGE_TAG=${t}`,"","# Optional - Debug Mode","# RACLETTE_DEBUG_MODE=true # Uncomment to see frontend logs in console"].join(`
|
|
1250
|
+
`),kh=async(e,t,r)=>{let n=e.services.frontend?.port||8081,o=e.services.workbench?.frontendPort||8083,i=await Ah(e,t,"latest",r),s=await Sh();return`# Deploy ${e.name} with Docker
|
|
1251
|
+
|
|
1252
|
+
Deploy ${e.name} using pre-built Docker images.
|
|
1253
|
+
|
|
1254
|
+
## Quick Start
|
|
1255
|
+
|
|
1256
|
+
### 1. Create docker-compose.yml
|
|
1257
|
+
|
|
1258
|
+
\`\`\`yaml
|
|
1259
|
+
${i}
|
|
1260
|
+
\`\`\`
|
|
1261
|
+
|
|
1262
|
+
### 2. Create .env file
|
|
1263
|
+
|
|
1264
|
+
\`\`\`bash
|
|
1265
|
+
# Required
|
|
1266
|
+
SERVER_TOKEN_SECRET=your-secret-key-here
|
|
1267
|
+
NODE_ENV=production
|
|
1268
|
+
|
|
1269
|
+
# Database Configuration
|
|
1270
|
+
MONGO_DATABASE=${e.name}
|
|
1271
|
+
|
|
1272
|
+
# Image Configuration
|
|
1273
|
+
IMAGE_TAG=latest
|
|
1274
|
+
|
|
1275
|
+
# Optional - Override image registry
|
|
1276
|
+
# DOCKER_REGISTRY=your-registry.com/
|
|
1277
|
+
|
|
1278
|
+
# Optional - Debug Mode
|
|
1279
|
+
# RACLETTE_DEBUG_MODE=true # Uncomment to see frontend logs in console
|
|
1280
|
+
|
|
1281
|
+
# Optional - External Services
|
|
1282
|
+
# RACLETTE_MONGODB_HOST=mongodb://your-mongodb:27017/your-database
|
|
1283
|
+
# RACLETTE_CACHE_URL=valkey://your-cache:6379
|
|
1284
|
+
\`\`\`
|
|
1285
|
+
|
|
1286
|
+
### 3. Deploy
|
|
1287
|
+
|
|
1288
|
+
\`\`\`bash
|
|
1289
|
+
docker compose up -d
|
|
1290
|
+
\`\`\`
|
|
1291
|
+
|
|
1292
|
+
## Application URLs
|
|
1293
|
+
|
|
1294
|
+
- **Main Application:** http://localhost:${n}
|
|
1295
|
+
${t.hasWorkbench?`- **Workbench:** http://localhost:${o}`:""}
|
|
1296
|
+
|
|
1297
|
+
## Configuration
|
|
1298
|
+
|
|
1299
|
+
### Environment Variables
|
|
1300
|
+
|
|
1301
|
+
| Variable | Description | Default |
|
|
1302
|
+
|----------|-------------|---------|
|
|
1303
|
+
| \`SERVER_TOKEN_SECRET\` | **Required** - JWT signing secret | - |
|
|
1304
|
+
| \`MONGO_DATABASE\` | Database name | \`${e.name}\` |
|
|
1305
|
+
| \`IMAGE_TAG\` | Image version | \`latest\` |
|
|
1306
|
+
| \`DOCKER_REGISTRY\` | Registry URL prefix | \`\` (Docker Hub) |
|
|
1307
|
+
| \`RACLETTE_DEBUG_MODE\` | Enable frontend debug logging | \`false\` |
|
|
1308
|
+
|
|
1309
|
+
## Customization
|
|
1310
|
+
|
|
1311
|
+
Create \`docker-compose.override.yml\` for customizations:
|
|
1312
|
+
|
|
1313
|
+
\`\`\`yaml
|
|
1314
|
+
${s}
|
|
1315
|
+
\`\`\`
|
|
1316
|
+
|
|
1317
|
+
*Note for developers: The volume examples above can be customized based on
|
|
1318
|
+
your application's specific customization points. Update the paths and
|
|
1319
|
+
descriptions as needed for your project.*
|
|
1320
|
+
|
|
1321
|
+
## Registry Configuration
|
|
1322
|
+
|
|
1323
|
+
*Note for developers: When copying this guide to your README, update the
|
|
1324
|
+
image names in the docker-compose.yml above to match your actual registry location:*
|
|
1325
|
+
|
|
1326
|
+
- **Docker Hub**: \`myproject/frontend:latest\`
|
|
1327
|
+
- **GitLab Registry**: \`registry.gitlab.com/group/project/frontend:latest\`
|
|
1328
|
+
- **GitHub Registry**: \`ghcr.io/owner/repo/frontend:latest\`
|
|
1329
|
+
- **Private Registry**: \`your-registry.com/project/frontend:latest\`
|
|
1330
|
+
|
|
1331
|
+
## Management
|
|
1332
|
+
|
|
1333
|
+
\`\`\`bash
|
|
1334
|
+
# View logs
|
|
1335
|
+
docker compose logs -f
|
|
1336
|
+
|
|
1337
|
+
# Update to latest images
|
|
1338
|
+
docker compose pull && docker compose up -d
|
|
1339
|
+
|
|
1340
|
+
# Stop services
|
|
1341
|
+
docker compose down
|
|
1342
|
+
|
|
1343
|
+
# Remove all data (\u26A0\uFE0F destructive)
|
|
1344
|
+
docker compose down -v
|
|
1345
|
+
\`\`\`
|
|
1346
|
+
|
|
1347
|
+
## System Requirements
|
|
1348
|
+
|
|
1349
|
+
- Docker and Docker Compose
|
|
1350
|
+
- 2GB+ available RAM
|
|
1351
|
+
- Ports ${n}${t.hasWorkbench?`, ${o}`:""} available
|
|
1352
|
+
|
|
1353
|
+
## Troubleshooting
|
|
1354
|
+
|
|
1355
|
+
- **502 errors:** Check backend logs with \`docker compose logs backend\`
|
|
1356
|
+
- **Database connection:** Verify MongoDB is healthy with \`docker compose ps\`
|
|
1357
|
+
- **Image pull errors:** Check registry access and IMAGE_TAG value
|
|
1358
|
+
`},wh=(e,t,r,n)=>{let o=["frontend","backend"],i=e.services.workbench?.enabled||!1;return i&&o.push("workbench-frontend","workbench-backend"),{names:o.map(a=>{let c=`${t}/${a}`;return`${n?`${n}${c}`:c}:${r}`}),hasWorkbench:i}},RC=async(e,t,r,n)=>{console.log(h.blue("\u{1F4C1} Generating deployment files..."));let o=dt.join(r,"deploy-guide");await ft.ensureDir(o);let i=dt.join(o,"docker-compose.yml");await Ch(e,t,i,"latest",n);let s=dt.join(o,"docker-compose.override.yml.example");await TC(e,s);let a=dt.join(o,".env.example");await PC(e,a,t.hasWorkbench);let c=dt.join(o,"README.md");await $C(e,t,c,n);let u=dt.join(o,"DEPLOY.md");return await DC(e,t,u,n),console.log(h.green("\u2705 Deployment files generated")),console.log(h.gray(` \u{1F4C1} Files created in: ${o}`)),{outputPath:o,mode:"files",deployGuideFile:u,additionalFiles:[i,s,a,c]}},OC=async(e,t,r,n)=>{console.log(h.blue("\u{1F4CB} Generating embedded deployment guide..."));let o=dt.join(r,"DEPLOY.md");return await NC(e,t,o,n),console.log(h.green("\u2705 Deployment guide generated")),console.log(h.gray(` \u{1F4C4} Guide: ${o}`)),{outputPath:r,mode:"embedded",deployGuideFile:o}},Ch=async(e,t,r,n,o)=>{let i=e.services.frontend?.port||8081,s=e.services.workbench?.frontendPort||8083,a=u=>{let d=u.split(":")[0].replace(o,"");return o?`${o}${d}:\${IMAGE_TAG:-${n}}`:`\${DOCKER_REGISTRY:-}${d}:\${IMAGE_TAG:-${n}}`},c={name:e.name,services:{frontend:{image:a(t.names[0]),ports:[`\${FRONTEND_PORT:-${i}}:${i}`],depends_on:["backend"],restart:"unless-stopped",networks:["app-network"],environment:["NODE_ENV=production","RACLETTE_DEBUG_MODE=${RACLETTE_DEBUG_MODE:-false}","RACLETTE_SERVER_BASE_URL=${RACLETTE_SERVER_BASE_URL:-/api}","RACLETTE_SOCKET_URL=${RACLETTE_SOCKET_URL:-}"],healthcheck:{test:["CMD","curl","-f",`http://0.0.0.0:${i}/`],interval:"10s",timeout:"30s",retries:10}},backend:{image:a(t.names[1]),depends_on:["database","cache"],restart:"unless-stopped",networks:["app-network"],environment:["NODE_ENV=production","SERVER_TOKEN_SECRET=${SERVER_TOKEN_SECRET}",`MONGO_HOST=\${RACLETTE_MONGODB_HOST:-mongodb://database:27017/\${MONGO_DATABASE:-${e.name}}}`,"CACHE_URL=${RACLETTE_CACHE_URL:-valkey://cache:6379}"],healthcheck:{test:["CMD","curl","-f","http://0.0.0.0:3000/health"],interval:"10s",timeout:"30s",retries:10}},database:{image:"mongo:8.2",restart:"unless-stopped",volumes:["mongodb_data:/data/db"],networks:["app-network"],environment:[`MONGO_INITDB_DATABASE=\${MONGO_DATABASE:-${e.name}}`],healthcheck:{test:["CMD","mongosh","--eval","db.adminCommand('ping')"],interval:"10s",timeout:"30s",retries:20}},cache:{image:"valkey/valkey:9.0-alpine",restart:"unless-stopped",volumes:["cache_data:/data"],networks:["app-network"],healthcheck:{test:["CMD","valkey-cli","ping"],interval:"10s",timeout:"5s",retries:3}}},volumes:{mongodb_data:{},cache_data:{}},networks:{"app-network":{driver:"bridge"}}};t.hasWorkbench&&t.names.length>=4&&(c.services["workbench-frontend"]={image:a(t.names[2]),ports:[`\${WORKBENCH_FRONTEND_PORT:-${s}}:${s}`],depends_on:["workbench-backend"],restart:"unless-stopped",networks:["app-network"],environment:["NODE_ENV=production","RACLETTE_DEBUG_MODE=${RACLETTE_DEBUG_MODE:-false}","RACLETTE_SERVER_BASE_URL=${RACLETTE_SERVER_BASE_URL:-/api}","RACLETTE_SOCKET_URL=${RACLETTE_SOCKET_URL:-}"],healthcheck:{test:["CMD","curl","-f",`http://0.0.0.0:${s}/`],interval:"10s",timeout:"30s",retries:10}},c.services["workbench-backend"]={image:a(t.names[3]),depends_on:["database","cache"],restart:"unless-stopped",networks:["app-network"],environment:["NODE_ENV=production","PORT=3000","SERVER_TOKEN_SECRET=${SERVER_TOKEN_SECRET}",`MONGO_HOST=\${RACLETTE_MONGODB_HOST:-mongodb://database:27017/\${MONGO_DATABASE:-${e.name}}}`,"CACHE_URL=${RACLETTE_CACHE_URL:-valkey://cache:6379}"],healthcheck:{test:["CMD","curl","-f","http://0.0.0.0:3000/health"],interval:"10s",timeout:"30s",retries:10}}),await ft.writeFile(r,ke.dump(c))},TC=async(e,t)=>{let r=ja(),n=r.filter(s=>s.service==="frontend"),o=r.filter(s=>s.service==="backend"),i=`# docker-compose.override.yml
|
|
1359
|
+
# Copy this file to docker-compose.override.yml and customize as needed
|
|
1360
|
+
# This file allows you to extend the main docker-compose.yml without modifying it
|
|
1361
|
+
|
|
1362
|
+
services:
|
|
1363
|
+
frontend:
|
|
1364
|
+
# Add custom volume mounts for branding and customization
|
|
1365
|
+
volumes:
|
|
1366
|
+
${n.map(s=>` # ${s.description}
|
|
1367
|
+
# - ${s.source}:${s.target}`).join(`
|
|
1368
|
+
`)}
|
|
1369
|
+
# Override environment variables
|
|
1370
|
+
environment:
|
|
1371
|
+
# - CUSTOM_BRAND_NAME=My Company
|
|
1372
|
+
|
|
1373
|
+
backend:
|
|
1374
|
+
# Add custom volume mounts for configuration and files
|
|
1375
|
+
volumes:
|
|
1376
|
+
${o.map(s=>` # ${s.description}
|
|
1377
|
+
# - ${s.source}:${s.target}`).join(`
|
|
1378
|
+
`)}
|
|
1379
|
+
# Override environment variables
|
|
1380
|
+
environment:
|
|
1381
|
+
# - CUSTOM_API_KEY=your-api-key-here
|
|
1382
|
+
|
|
1383
|
+
# Add additional services
|
|
1384
|
+
# custom-service:
|
|
1385
|
+
# image: some/custom-image
|
|
1386
|
+
# networks:
|
|
1387
|
+
# - app-network
|
|
1388
|
+
|
|
1389
|
+
# Add custom volumes
|
|
1390
|
+
# volumes:
|
|
1391
|
+
# custom_data:
|
|
1392
|
+
|
|
1393
|
+
# Add custom networks if needed
|
|
1394
|
+
# networks:
|
|
1395
|
+
# custom-network:
|
|
1396
|
+
`;await ft.writeFile(t,i)},PC=async(e,t,r)=>{let n=Na(e,r);await ft.writeFile(t,n)},$C=async(e,t,r,n)=>{let o=e.services.frontend?.port||8081,i=e.services.workbench?.frontendPort||8083,s=`# ${e.name} - Local Registry Testing
|
|
1397
|
+
|
|
1398
|
+
This folder contains deployment files for testing registry-based deployment locally.
|
|
1399
|
+
|
|
1400
|
+
## Generated Files
|
|
1401
|
+
|
|
1402
|
+
- \`docker-compose.yml\` - Registry-based compose configuration
|
|
1403
|
+
- \`docker-compose.override.yml.example\` - Customization template
|
|
1404
|
+
- \`.env.example\` - Environment variables template
|
|
1405
|
+
- \`DEPLOY.md\` - User deployment guide (copy to your project README)
|
|
1406
|
+
|
|
1407
|
+
## Local Testing Steps
|
|
1408
|
+
|
|
1409
|
+
### 1. Configure Environment
|
|
1410
|
+
\`\`\`bash
|
|
1411
|
+
cp .env.example .env
|
|
1412
|
+
vi .env # Set SERVER_TOKEN_SECRET and other variables
|
|
1413
|
+
\`\`\`
|
|
1414
|
+
|
|
1415
|
+
### 2. Test with Local Images
|
|
1416
|
+
Assuming you built the images locally, you can test without a registry:
|
|
1417
|
+
|
|
1418
|
+
\`\`\`bash
|
|
1419
|
+
# Start services using local images
|
|
1420
|
+
docker compose up -d
|
|
1421
|
+
\`\`\`
|
|
1422
|
+
|
|
1423
|
+
### 3. Test with Registry Images
|
|
1424
|
+
To test the full registry workflow:
|
|
1425
|
+
|
|
1426
|
+
\`\`\`bash
|
|
1427
|
+
# Push your images to registry first
|
|
1428
|
+
${t.names.map(a=>`docker push ${a}`).join(`
|
|
1429
|
+
`)}
|
|
1430
|
+
|
|
1431
|
+
# Pull and start services
|
|
1432
|
+
docker compose pull
|
|
1433
|
+
docker compose up -d
|
|
1434
|
+
\`\`\`
|
|
1435
|
+
|
|
1436
|
+
## Application Access
|
|
1437
|
+
|
|
1438
|
+
After deployment:
|
|
1439
|
+
- **Main Application:** http://localhost:${o}
|
|
1440
|
+
${t.hasWorkbench?`- **Workbench:** http://localhost:${i}`:""}
|
|
1441
|
+
|
|
1442
|
+
## Built Images
|
|
1443
|
+
|
|
1444
|
+
This configuration expects these images:
|
|
1445
|
+
${t.names.map(a=>`- \`${a}\``).join(`
|
|
1446
|
+
`)}
|
|
1447
|
+
|
|
1448
|
+
## Management Commands
|
|
1449
|
+
|
|
1450
|
+
- **View logs:** \`docker compose logs -f\`
|
|
1451
|
+
- **Stop services:** \`docker compose down\`
|
|
1452
|
+
- **Update images:** \`docker compose pull && docker compose up -d\`
|
|
1453
|
+
|
|
1454
|
+
## Next Steps
|
|
1455
|
+
|
|
1456
|
+
1. **Test locally** with the steps above
|
|
1457
|
+
2. **Copy DEPLOY.md** content to your project README
|
|
1458
|
+
3. **Push images to registry** for production use
|
|
1459
|
+
4. **Share deployment instructions** with your users
|
|
1460
|
+
|
|
1461
|
+
## Registry Examples
|
|
1462
|
+
|
|
1463
|
+
*Note for developers: When copying this deployment guide to your project README,
|
|
1464
|
+
you can adjust these registry examples based on where your images will be hosted.*
|
|
1465
|
+
|
|
1466
|
+
### Docker Hub (default)
|
|
1467
|
+
\`\`\`bash
|
|
1468
|
+
# Images: myproject/frontend:latest
|
|
1469
|
+
# No additional configuration needed
|
|
1470
|
+
\`\`\`
|
|
1471
|
+
|
|
1472
|
+
### GitLab Container Registry
|
|
1473
|
+
\`\`\`bash
|
|
1474
|
+
# Images: registry.gitlab.com/group/project/frontend:latest
|
|
1475
|
+
# Update image names in docker-compose.yml to include registry prefix
|
|
1476
|
+
\`\`\`
|
|
1477
|
+
|
|
1478
|
+
### GitHub Container Registry
|
|
1479
|
+
\`\`\`bash
|
|
1480
|
+
# Images: ghcr.io/owner/repo/frontend:latest
|
|
1481
|
+
# Update image names in docker-compose.yml to include registry prefix
|
|
1482
|
+
\`\`\`
|
|
1483
|
+
|
|
1484
|
+
Generated on: ${new Date().toISOString()}
|
|
1485
|
+
`;await ft.writeFile(r,s)},DC=async(e,t,r,n)=>{let o=await kh(e,t,n);await ft.writeFile(r,o)},NC=async(e,t,r,n)=>{let o=await kh(e,t,n),i=`# ${e.name} - Registry Deployment Guide
|
|
1486
|
+
|
|
1487
|
+
## For Developers
|
|
1488
|
+
|
|
1489
|
+
This file contains registry deployment instructions generated from your build configuration.
|
|
1490
|
+
|
|
1491
|
+
**What to do with this:**
|
|
1492
|
+
1. Copy the "User Deployment Section" below to your project README
|
|
1493
|
+
2. Update the documentation as needed for your specific use case
|
|
1494
|
+
3. Users can then deploy your application using the provided instructions
|
|
1495
|
+
|
|
1496
|
+
**Generated for images:**
|
|
1497
|
+
${t.names.map(s=>`- \`${s}\``).join(`
|
|
1498
|
+
`)}
|
|
1499
|
+
|
|
1500
|
+
**Registry:** ${n||"Docker Hub (default)"}
|
|
1501
|
+
|
|
1502
|
+
---
|
|
1503
|
+
|
|
1504
|
+
## User Deployment Section
|
|
1505
|
+
|
|
1506
|
+
*Copy everything below this line to your project README or documentation*
|
|
1507
|
+
|
|
1508
|
+
${o}
|
|
1509
|
+
`;await ft.writeFile(r,i)},Ah=async(e,t,r,n)=>{let o=dt.join(process.cwd(),"temp-compose.yml");await Ch(e,t,o,r,n);let i=await ft.readFile(o,"utf8");return await ft.remove(o),i},Sh=async()=>{let e=ja(),t=e.filter(n=>n.service==="frontend").slice(0,3),r=e.filter(n=>n.service==="backend").slice(0,3);return`services:
|
|
1510
|
+
frontend:
|
|
1511
|
+
volumes:
|
|
1512
|
+
${t.map(n=>` # ${n.description}
|
|
1513
|
+
# - ${n.source}:${n.target}`).join(`
|
|
1514
|
+
`)}
|
|
1515
|
+
environment:
|
|
1516
|
+
# - CUSTOM_BRAND_NAME=My Company
|
|
1517
|
+
|
|
1518
|
+
backend:
|
|
1519
|
+
volumes:
|
|
1520
|
+
${r.map(n=>` # ${n.description}
|
|
1521
|
+
# - ${n.source}:${n.target}`).join(`
|
|
1522
|
+
`)}
|
|
1523
|
+
environment:
|
|
1524
|
+
# - CUSTOM_API_KEY=your-key`};var Mt=process.cwd();process.env.RACLETTE_APP_PATH||(process.env.RACLETTE_APP_PATH=Mt);var pr=await xf(),Rh=Object.keys(pr).length&&h.blue(`\u{1F4C4} Loaded ${Object.keys(pr).length} environment variables from ${Mt}/.env`);pr.RACLETTE_APP_PATH=process.env.RACLETTE_APP_PATH;var de=ha(await Ft(),await Ft("raclette.config.*",pr)),Oh=pr.RACLETTE_ROOT||de.root||".raclette",Fe=dr.join(Mt,Oh),ht=dr.join(Fe,"docker-compose.yml");de.root=Oh;var je=new lc,tt=(e,t)=>{Rh&&f.raclette(Rh),Tt.ensureDirSync(Fe)};je.version("0.1.0");je.command("dev").description("Start development environment").option("-q, --quiet","Run Docker Compose in detached mode without following logs").option("-v, --verbose","Get more information about what is happening").option("--filter <service>","Filter logs to specific services (comma-separated)","frontend,backend").option("--force-rebuild, --rebuild","Force rebuild of Docker images regardless of file changes").option("-p, --project-name <projectName>","Applies a specific project name").option("-f, --config-file <configFile>","Additionally add a raclette.config file to merge on top of the default").option("-r, --root <root>","Raclette tools root directory",".raclette").option("--no-cache","Force rebuild Docker images without using cache").hook("preAction",tt).action(async e=>{f.setVerbose(e.verbose),f.raclette("Starting raclette development environment...");try{Kn();let t=ha(de,e.configFile?await Ft(e.configFile):{});Tt.writeFile(dr.join(Fe,"raclette.config.yaml"),ke.dump(t)),e.projectName&&(f.raclette("Setting project name to "+e.projectName),t.name=e.projectName),ma(t,Fe),await Zf(Fe,pr,t,{workingDir:Mt,dockerComposePath:ht,quiet:e.quiet,verbose:e.verbose,logFilter:e.filter?e.filter.split(","):Ye,forceRebuild:e.forceRebuild||e.rebuild,noCache:e.noCache})}catch(t){f.error("Error starting development environment: "+t?.message),process.exit(1)}});je.command("log [services...]").description("Follow logs for specified services (or all services if none specified)").option("-f, --follow","Follow log output (default: true)",!0).option("--no-follow","Don't follow log output").option("--tail <lines>","Number of lines to show from the end of the logs","100").option("-v, --verbose","Verbose output").hook("preAction",tt).action(async(e,t)=>{try{f.setVerbose(t.verbose),f.raclette("Attaching to service logs..."),await Tt.pathExists(ht)||(f.error("No docker-compose.yml found. Services may not be running."),f.instruction("Try running 'raclette dev' first to start the services."),process.exit(1)),await ch(e,t,de,ht)}catch(r){f.error("Error following logs: "+r.message),process.exit(1)}});je.command("down").description("Stop Docker Compose services").option("--keep-shared","Don't stop shared services like DB and Cache").option("-p, --project-name <projectName>","Applies a specific project name").option("-v, --verbose","Verbose output").hook("preAction",tt).action(async e=>{try{f.setVerbose(e.verbose),console.log(h.blue("\u{1F9C0} Stopping Raclette Docker services..."));let t=Mt;e.projectName&&(f.raclette("Setting project name to "+e.projectName),de.name=e.projectName);let r=dr.join(Fe,"docker-compose.full.yml");if(!await Tt.pathExists(ht)){console.error(h.yellow("\u26A0\uFE0F No docker-compose.yml found. Services may not be running."));return}e.keepShared?(f.debug("\u2139\uFE0F Using standard docker-compose file (keeping shared services)"),await Pa(ht,de)):(f.debug("\u2139Generating full docker-compose file including shared services"),await Af(de,t,r,"development"),await Pa(r,de),await Tt.remove(r)),f.success("Docker services stopped successfully")}catch(t){f.error("Error stopping Docker services: "+t.message),process.exit(1)}});je.command("restart [services...]").option("-v, --verbose","Verbose output").description("Restart specified Docker Compose services (frontend, backend, etc.)").hook("preAction",tt).action(async(e,t)=>{try{if(f.setVerbose(t.verbose),f.raclette("Restarting Raclette services..."),e.length===0){f.warn("No services specified. Please specify which services to restart."),f.instruction("Usage: raclette restart <service1> <service2> ..."),f.instruction("Common services: frontend, backend, mongodb, cache");return}let r=de?.name??dr.basename(Mt);if(!await Tt.pathExists(ht)){f.warn("No docker-compose.yml found. Services may not be running with raclette.");return}for(let n of e)try{let o=await jr(n,de,ht);if(!cr(o)){f.warn(`Service '${n}' (container: ${o}) doesn't appear to be running.`),f.instruction(" If you're sure it's running, it might have a different container name than expected."),f.instruction(" To restart by container name directly, use: docker restart <container_name>");continue}await Tt.pathExists(ht)?(f.progress(`Restarting service: ${n}...`),Ee(["-p",r,"-f",ht,"restart",n],{stdio:"inherit"})):(f.progress(` Restarting container: ${o}...`),pe(["restart",o],{stdio:"inherit"})),f.success(`Service '${n}' restarted successfully`)}catch(o){f.error(`Error restarting service '${n}': ${o.message}`)}}catch(r){f.error("Error restarting services: "+r.message),process.exit(1)}});je.command("update [target]").description("Update dependencies for frontend, backend, or both by running dependency check script").option("-v, --verbose","Verbose output").hook("preAction",tt).action(async(e="both",t)=>{try{f.setVerbose(t.verbose),["frontend","backend","both"].includes(e)||(f.error("Target must be one of: frontend, backend, both"),process.exit(1)),await Ra(e,de),await $a(e,de,Fe)||(f.warn("\u26A0\uFE0F Dependencies update completed with errors"),process.exit(1))}catch(r){f.error("Error updating dependencies: "+r.message),process.exit(1)}});je.command("build").description("Build application with different modes").option("--mode <mode>","Build mode: artifacts (local deployment), images (CI/CD), package (offline)","artifacts").option("--image-tag <tag>","Image tag for registry (e.g., v1.0.0)").option("--image-prefix <prefix>","Image name prefix (default: project name)").option("--generate-latest","Also tag images as :latest").option("--output-dir <dir>","Output directory").option("--skip-workbench","Skip workbench build").option("--no-cache","Build without cache").option("-v, --verbose","Verbose output").option("--buildx","Use Docker buildx for multi-architecture builds").option("--platforms <platforms>","Target platforms for buildx","linux/amd64,linux/arm64").option("--build-only","Legacy: same as --mode artifacts").option("--build-images","Legacy: same as --mode images").option("--package-images","Legacy: same as --mode package").option("-p, --project-name <projectName>","Applies a specific project name").option("-f, --config-file <configFile>","Additionally add a raclette.config file to merge on top of the default").hook("preAction",tt).action(async e=>{try{f.setVerbose(e.verbose),f.raclette("Building raclette application...");let t=Mt,r=vt(de,e.configFile?await Ft(e.configFile):{});Tt.writeFileSync(dr.join(Fe,"raclette.config.yaml"),ke.dump(r)),ma(r,Fe),e.projectName&&(f.raclette("Setting project name to "+e.projectName),r.name=e.projectName);let n={outputDir:e.outputDir,skipWorkbench:e.skipWorkbench,verbose:e.verbose,noCache:e.noCache,mode:e.mode,imageTag:e.imageTag,imagePrefix:e.imagePrefix,generateLatest:e.generateLatest,buildOnly:e.buildOnly,buildImages:e.buildImages,packageImages:e.packageImages,buildx:e.buildx,platforms:e.platforms},o=await vh(r,t,n);switch(f.success("Build complete!"),o.mode){case"artifacts":f.success(`Build files are in ${o.buildDir}!`),f.raw(h.green("\u{1F680} Ready for deployment with deploy.sh"));break;case"images":f.success("Docker images built and tagged"),f.raw(h.green("\u{1F680} Ready for registry push"));break;case"package":f.success(`Build files are in ${o.buildDir}!`),o.deploymentPackage&&f.raw(h.green(`\u{1F680} Deployment package ready: ${o.deploymentPackage}`));break}process.exit(0)}catch(t){f.error("Error building application: "+t?.message),process.exit(1)}});je.command("add-package <target> <package...>").description(`Add a package to the project (target: ${Gr.join(", ")})`).option("--dev","Add as a development dependency").option("--no-update","Skip updating dependencies after adding packages",!0).option("-v, --verbose","Verbose output").hook("preAction",tt).action(async(e,t,r)=>{f.setVerbose(r.verbose);try{Gr.includes(e)||(f.error(`Target must be one of: ${Gr.join(", ")}}`),process.exit(1)),f.raclette(`Adding package(s) to ${e}...`);for(let n of t)await Wf(e,n,r.dev);f.info("Now updating auto-generated package.json file(s) in .raclette folder..."),await Ra(e,de),await $a(e,de,Fe)}catch(n){f.error("Error adding package: "+n.message),process.exit(1)}});je.command("rebuild [services...]").description("Rebuild Docker images for specified services or all services").option("--no-cache","Force rebuild Docker images without using cache").option("-v, --verbose","Verbose output").hook("preAction",tt).action(async(e,t)=>{try{if(f.setVerbose(t.verbose),f.raclette("Rebuilding Raclette Docker images..."),e.length===0){f.debug("\u{1F50D} Detecting services with changes...");let n=await eo(de,Fe);if(n.length===0){f.warn("No service file changes detected. Use service names to force rebuild.");return}e=n}let r=e.filter(n=>n==="frontend"||n==="backend"||n==="workbench");r.length===0&&(f.error("No valid services specified for rebuild"),f.warn("Valid services are: frontend, backend, workbench"),process.exit(1)),await to(de,Fe,r,{noCache:t.noCache}),f.success(`Rebuild complete for services: ${r.join(", ")}`)}catch(r){f.error("Error rebuilding Docker images: "+r.message),process.exit(1)}});je.command("deploy-guide").description("Generate deployment guide and files for registry-based deployment").option("--image-prefix <prefix>","Image name prefix (default: project name)").option("--image-tag <tag>","Image tag (default: latest)").option("--registry <url>","Registry URL prefix (e.g., registry.gitlab.com/group/)").option("--output-dir <dir>","Output directory (default: current directory)").option("--generate-files","Generate separate files for local testing").option("--return-only","Output to stdout only (no file generation)").option("-v, --verbose","Verbose output").hook("preAction",tt).action(async e=>{try{if(f.setVerbose(e.verbose),f.raclette("Generating raclette deployment guide..."),e.returnOnly){let n={imagePrefix:e.imagePrefix,imageTag:e.imageTag,registry:e.registry,outputDir:void 0,generateFiles:!1,returnOnly:!0},o=await xh(de,n);console.log(o),process.exit(0)}let t={imagePrefix:e.imagePrefix,imageTag:e.imageTag,registry:e.registry,outputDir:e.outputDir,generateFiles:e.generateFiles},r=await Eh(de,t);f.success("Deployment guide generated!"),r.mode==="files"?(f.raw(h.cyan(`\u{1F4C1} Files created in: ${r.outputPath}`)),f.raw(h.yellow("\u{1F4A1} Use these files for local testing")),f.raw(h.yellow("\u{1F4A1} Copy DEPLOY.md content to your project README"))):(f.raw(h.cyan(`\u{1F4C4} Guide created: ${r.deployGuideFile}`)),f.raw(h.yellow("\u{1F4A1} Copy the user section to your project README"))),process.exit(0)}catch(t){f.error("Error generating deployment guide: "+t.message),process.exit(1)}});je.command("config").description("(Re)Configure Raclette Application").option("-c, --config <config>","configuration file","raclette.config.yaml").hook("preAction",tt).action(async e=>{console.log(h.bold.green("YO!")+h.bold.red(":"))});je.parse(process.argv);
|
|
1525
|
+
/*!
|
|
1526
|
+
* is-extglob <https://github.com/jonschlinkert/is-extglob>
|
|
1527
|
+
*
|
|
1528
|
+
* Copyright (c) 2014-2016, Jon Schlinkert.
|
|
1529
|
+
* Licensed under the MIT License.
|
|
1530
|
+
*/
|
|
1531
|
+
/*!
|
|
1532
|
+
* is-glob <https://github.com/jonschlinkert/is-glob>
|
|
1533
|
+
*
|
|
1534
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
1535
|
+
* Released under the MIT License.
|
|
1536
|
+
*/
|
|
1537
|
+
/*!
|
|
1538
|
+
* is-number <https://github.com/jonschlinkert/is-number>
|
|
1539
|
+
*
|
|
1540
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
1541
|
+
* Released under the MIT License.
|
|
1542
|
+
*/
|
|
1543
|
+
/*!
|
|
1544
|
+
* to-regex-range <https://github.com/micromatch/to-regex-range>
|
|
1545
|
+
*
|
|
1546
|
+
* Copyright (c) 2015-present, Jon Schlinkert.
|
|
1547
|
+
* Released under the MIT License.
|
|
1548
|
+
*/
|
|
1549
|
+
/*!
|
|
1550
|
+
* fill-range <https://github.com/jonschlinkert/fill-range>
|
|
1551
|
+
*
|
|
1552
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
1553
|
+
* Licensed under the MIT License.
|
|
1554
|
+
*/
|
|
1555
|
+
/*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
1556
|
+
/*! run-parallel. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
1557
|
+
/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */
|
|
1558
|
+
/*!
|
|
1559
|
+
* mustache.js - Logic-less {{mustache}} templates with JavaScript
|
|
1560
|
+
* http://github.com/janl/mustache.js
|
|
1561
|
+
*/
|
|
1562
|
+
//# sourceMappingURL=cli.js.map
|