@metricinsights/pp-dev 1.2.0 → 1.2.1
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 +7 -0
- package/dist/CHANGELOG.md +7 -0
- package/dist/cjs/cli.js +1 -1
- package/dist/cjs/{index-C3Gqeex0.js → index-XIFH2ace.js} +2 -2
- package/dist/cjs/{index-C3Gqeex0.js.map → index-XIFH2ace.js.map} +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/{plugin-858WhooP.js → plugin-lLb1ogcl.js} +2 -2
- package/dist/cjs/{plugin-858WhooP.js.map → plugin-lLb1ogcl.js.map} +1 -1
- package/dist/cjs/plugin.js +1 -1
- package/dist/cjs/{version-plugin-Df39hYA4.js → version-plugin-C0xv4wbw.js} +2 -2
- package/dist/cjs/{version-plugin-Df39hYA4.js.map → version-plugin-C0xv4wbw.js.map} +1 -1
- package/dist/esm/cli.js +1 -1
- package/dist/esm/{index-BGMOUqHR.js → index-BtZKQ3Ni.js} +2 -2
- package/dist/esm/{index-BGMOUqHR.js.map → index-BtZKQ3Ni.js.map} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/package.json +1 -1
- package/dist/esm/{plugin-C-TsWzim.js → plugin-BtTlYPNc.js} +2 -2
- package/dist/esm/{plugin-C-TsWzim.js.map → plugin-BtTlYPNc.js.map} +1 -1
- package/dist/esm/plugin.js +1 -1
- package/dist/esm/{version-plugin-DcuQh2S4.js → version-plugin-7_CHPYR-.js} +2 -2
- package/dist/esm/{version-plugin-DcuQh2S4.js.map → version-plugin-7_CHPYR-.js.map} +1 -1
- package/package.json +1 -1
package/dist/esm/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as e from"path";import*as t from"fs";import{EventEmitter as o}from"node:events";import{performance as n}from"node:perf_hooks";import{watch as i}from"chokidar";import{cac as s}from"cac";import{loadConfigFromFile as r,mergeConfig as a,build as l,resolveConfig as c,optimizeDeps as d,preview as p,loadEnv as f}from"vite";import{c as u,a as h,P as g,b as m,n as b,r as w,w as v,z as y,d as P,V as x,I as S,v as T,e as E,f as k,g as L,R as $,h as j,i as I,j as D,M as F,k as _,l as N,m as A,o as C,p as R,q as M,u as O,D as z,C as H,s as U}from"./plugin-C-TsWzim.js";import{r as V,g as W,s as Z,a as G,b as B,c as q,i as J}from"./index-BGMOUqHR.js";import{parse as K}from"url";import*as X from"dir-compare";import Y from"diff-match-patch";import{isBinaryFile as Q}from"isbinaryfile";import*as ee from"os";import*as te from"crypto";import oe from"extract-zip";import ne from"svgtofont";import{WebSocketServer as ie,WebSocket as se}from"ws";import"http-proxy-middleware";import"picocolors";import"axios";import"node:http";import"node:https";import"jsdom";import"process";import"child_process";import"jszip";import"module";import"memory-cache";import"zlib";import"express";import"node:crypto";import"./helpers.js";import"ejs";function re(e){return null!=e&&!1!==e}let ae=null;const le=[{key:"r",description:"restart the server",async action(e){await e.restart()}},{key:"u",description:"show server url",action(e){e.config.logger.info(""),e.printUrls()}},{key:"o",description:"open in browser",action(e){e.openBrowser()}},{key:"c",description:"clear console",action(e){e.config.logger.clearScreen("error")}},{key:"q",description:"quit",async action(e){await e.close().finally(()=>process.exit())}},{key:"C",description:"clear proxy cache",action(e){e.cache&&(e.cache.clear(),e.config.logger.info("Proxy cache cleared"))}}];const ce=/(.+)(-[a-f0-9]{6,20})(\.[a-z0-9]+)$/i;class de{oldAssetsPath;newAssetsPath;destinationPath;changelogFilename;changelogTemplate='<!DOCTYPE html>\n <html lang="en">\n <head>\n <meta charset="UTF-8" />\n <title>Changelog Diff</title>\n <style>\n tr,\n td {\n padding: 0;\n }\n .diff-file {\n margin-top: 20px;\n border: 1px solid #e1e4e8;\n border-radius: 6px;\n }\n .diff-file-title {\n padding: 10px 20px;\n background-color: #f6f8fa;\n border-bottom: 1px solid #e1e4e8;\n border-radius: 6px 6px 0 0;\n font-weight: bold;\n }\n .diff-file-title .renamed {\n font-weight: normal;\n }\n .diff-file-title .renamed .from {\n color: #cb2431;\n }\n .diff-file-title .renamed .to {\n color: #22863a;\n }\n .diff-file-title .added {\n color: #22863a;\n }\n .diff-file-title .deleted {\n color: #cb2431;\n }\n .diff-file-content {\n }\n .diff-table {\n tab-size: 8;\n width: 100%;\n border-collapse: separate;\n border-spacing: 0;\n }\n .blob-num {\n position: relative;\n color: #1f2328;\n width: 1%;\n min-width: 50px;\n padding: 0 10px;\n font-family:\n ui-monospace,\n SFMono-Regular,\n SF Mono,\n Menlo,\n Consolas,\n Liberation Mono,\n monospace;\n font-size: 12px;\n line-height: 20px;\n text-align: right;\n white-space: nowrap;\n vertical-align: top;\n cursor: pointer;\n -webkit-user-select: none;\n user-select: none;\n }\n .blob-num.addition {\n background-color: #ccffd8;\n border-color: #1f883e;\n }\n .blob-num.deletion {\n background-color: #ffd7d5;\n border-color: #cf222e;\n }\n .blob-num::before {\n content: attr(data-line-number);\n }\n .blob-code {\n position: relative;\n padding: 0 10px 0 22px;\n vertical-align: top;\n color: #1f2329;\n }\n .blob-code.code-addition {\n background-color: #e6ffec;\n }\n .blob-code.code-deletion {\n background-color: #ffebe9;\n }\n .blob-code.skip,\n .blob-code.message {\n text-align: center;\n }\n .blob-code.skip .blob-code-inner,\n .blob-code.message .blob-code-inner {\n font-weight: bold;\n color: #6a737d;\n padding: 10px 0;\n }\n .blob-code-inner {\n display: table-cell;\n overflow: visible;\n font-family:\n ui-monospace,\n SFMono-Regular,\n SF Mono,\n Menlo,\n Consolas,\n Liberation Mono,\n monospace;\n font-size: 12px;\n word-wrap: anywhere;\n white-space: pre-wrap;\n }\n .blob-code-inner::before {\n content: attr(data-code-prefix);\n position: absolute;\n top: 1px;\n left: 8px;\n padding-right: 8px;\n }\n </style>\n </head>\n <body>\n <h1>Changelog Diff</h1>\n\n %FILES%\n </body>\n </html>';diffFileTemplateHandler;diffLineTemplateHandler;contextLines=3;logger;constructor(t){const{oldAssetsPath:o,newAssetsPath:n,destinationPath:i,changelogTemplate:s,diffFileTemplateHandler:r,diffLineTemplateHandler:a,changelogFilename:l,contextLines:c}=t;if(this.logger=u(),!o||!n||!i)throw new Error("Previous assets path, current assets path and destination path are required");if(o===n)throw new Error("Previous and current assets paths must be different");if(!this.isExists(o))throw new Error(`Previous assets path ${o} does not exist`);if(!this.isExists(n))throw new Error(`Current assets path ${n} does not exist`);if(this.isZipFile(o)){const t=e.resolve(ee.tmpdir(),te.createHash("md5").update(o).digest("hex"));this.oldAssetsPath=this.unzipFile(o,t).then(()=>this.normalizeAssetFolderPath(t)).then(e=>{if(this.isEmptyFolder(e))throw new Error(`Previous assets path ${e} is empty`);return e})}else{if(!this.isFolder(o))throw new Error(`Invalid previous assets path ${o}. It must be a folder or a zip file`);{const e=this.normalizeAssetFolderPath(o);if(this.isEmptyFolder(e))throw new Error(`Previous assets path ${e} is empty`);this.oldAssetsPath=Promise.resolve(e)}}if(this.isZipFile(n)){const t=e.resolve(ee.tmpdir(),te.createHash("md5").update(n).digest("hex"));this.newAssetsPath=this.unzipFile(n,t).then(()=>this.normalizeAssetFolderPath(t)).then(e=>{if(this.isEmptyFolder(e))throw new Error(`Current assets path ${e} is empty`);return e})}else{if(!this.isFolder(n))throw new Error(`Invalid current assets path ${n}. It must be a folder or a zip file`);{const e=this.normalizeAssetFolderPath(n);if(this.isEmptyFolder(e))throw new Error(`Current assets path ${n} is empty`);this.newAssetsPath=Promise.resolve(e)}}this.destinationPath=i,this.mkdirpSync(this.destinationPath),this.changelogFilename=l||"CHANGELOG.html",s&&(this.templateIsValid(s)?this.changelogTemplate=s:this.logger.warn(h.yellow("Invalid changelog template, using default"))),"function"==typeof r&&(this.diffFileTemplateHandler=r),"function"==typeof a&&(this.diffLineTemplateHandler=a),c&&(this.contextLines=c)}templateIsValid(e){return e.includes("%FILES%")}isExists(e){return t.existsSync(e)}isZipFile(e){return e.endsWith(".zip")}isFolder(e){return t.lstatSync(e).isDirectory()}isEmptyFolder(e){return 0===t.readdirSync(e,{withFileTypes:!0}).length}mkdirpSync(e){t.existsSync(e)||t.mkdirSync(e,{recursive:!0})}async unzipFile(e,o){return t.rmSync(o,{force:!0,recursive:!0}),oe(e,{dir:o})}normalizeAssetFolderPath(o){const n=t.readdirSync(o);return 1===n.length&&t.lstatSync(e.join(o,n[0])).isDirectory()?this.normalizeAssetFolderPath(e.join(o,n[0])):o}pathToPosix(e){return e.replace(/\\/g,"/")}diffTableTemplate(e){return`<table class="diff-table">\n <tbody>\n ${e}\n </tbody>\n </table>`}getDiffTableHTML(e){const t=e.filter((e,t,o)=>0!==e.lineType||(t>=0&&t<this.contextLines||t>o.length-(this.contextLines+1)&&t<=o.length-1||o.slice(t-this.contextLines,t+this.contextLines+1).some(e=>0!==e.lineType))).map((e,t,o)=>{if(t>0){const n=o[t-1];if(e.lineNumber-n.lineNumber>1)return[{lineNumber:-1,lineContent:"",lineType:0},e]}return[e]}).flat().map(e=>this.diffLineHTML(e)).join("");return this.diffTableTemplate(t)}diffLineMessageTemplate(e){return`<tr>\n <td class="blob-num"></td>\n <td class="blob-num"></td>\n <td class="blob-code message">\n <span class="blob-code-inner">${e}</span>\n </td>\n </tr>`}diffLineSkipTemplate(){return'<tr>\n <td class="blob-num"></td>\n <td class="blob-num"></td>\n <td class="blob-code skip">\n <span class="blob-code-inner">Skip</span>\n </td>\n </tr>'}diffLineTemplate(e){const{lineNumber:t,lineContent:o,lineType:n}=e,i=1===n?"addition":-1===n?"deletion":"";return`<tr>\n <td\n class="blob-num ${i}${"addition"===i?" empty":""}"\n ${"addition"!==i?` data-line-number="${t}"`:""}\n ></td>\n <td\n class="blob-num ${i}${"deletion"===i?" empty":""}"\n ${"deletion"!==i?` data-line-number="${t}"`:""}\n ></td>\n <td class="blob-code ${1===n?"code-addition":-1===n?"code-deletion":""}">\n <span class="blob-code-inner" data-code-prefix="${1===n?"+":-1===n?"-":" "}">${s=o??"",s.replace(/[\u00A0-\u9999<>&]/g,e=>"&#"+e.charCodeAt(0)+";")}</span>\n </td>\n </tr>`;var s}diffLineHTML(e){if(this.diffLineTemplateHandler)return this.diffLineTemplateHandler(e);const{lineNumber:t}=e;return-1===t?this.diffLineSkipTemplate():this.diffLineTemplate(e)}diffFileTemplate(e,t){return this.diffFileTemplateHandler?this.diffFileTemplateHandler(e,t):`<div class="diff-file">\n <div class="diff-file-title">${e}</div>\n <div class="diff-file-content">${t}</div>\n </div>`}async generateAssetFoldersDiff(){this.logger.info(h.blue(`Comparing asset folders ${await this.oldAssetsPath} and ${await this.newAssetsPath}`));const e=await X.compare(await this.oldAssetsPath,await this.newAssetsPath,{compareContent:!0,skipSymlinks:!0,compareSize:!0,compareDate:!1,compareNameHandler:(e,t)=>(ce.test(e)&&(e=e.replace(ce,"$1$3")),ce.test(t)&&(t=t.replace(ce,"$1$3")),0===e.localeCompare(t)?0:e.localeCompare(t)>0?1:-1)});return e.diffSet?.filter(e=>"equal"!==e.state||e.name1!==e.name2)||[]}async generateAssetFilesDiff(e,t){const o=new Y,n=o.diff_linesToChars_(e,t),i=o.diff_main(n.chars1,n.chars2,!1);o.diff_charsToLines_(i,n.lineArray);let s=0;return i.map(e=>{const[t,o]=e,n=o.endsWith("\n")?o.split("\n").length-1:o.split("\n").length,i=o.split("\n").map((e,o)=>({lineContent:e,lineNumber:s+o+1,lineType:t})).slice(0,n);return-1!==t&&(s+=n),i}).flat()}async generateFilesDiff(o){if("equal"===o.state){const t=this.pathToPosix(e.join(".",o.relativePath,o.name1??"")),n=this.pathToPosix(e.join(".",o.relativePath,o.name2??""));return this.diffFileTemplate(`<span class="renamed"\n >Renamed <span class="from">${t}</span> -> <span class="to">${n}</span></span\n >`,this.diffTableTemplate(this.diffLineMessageTemplate("No changes")))}const n=o.path1&&o.name1?e.join(o.path1,o.name1):null,i=o.path2&&o.name2?e.join(o.path2,o.name2):null,s=this.pathToPosix(e.join(".",o.relativePath,(o.name1||o.name2)??""));if("left"===o.state&&n)return this.diffFileTemplate(`<span class="removed">Removed ${s}</span>`,this.diffTableTemplate(this.diffLineMessageTemplate("File removed")));if("right"===o.state&&i)return this.diffFileTemplate(`<span class="added">Added ${s}</span>`,this.diffTableTemplate(this.diffLineMessageTemplate("File added")));if("distinct"===o.state&&n&&i){const r=this.pathToPosix(e.join(".",o.relativePath,o.name1??"")),a=this.pathToPosix(e.join(".",o.relativePath,o.name2??"")),l=o.name1!==o.name2?`<span class="renamed"\n >Renamed <span class="from">${r}</span> -> <span class="to">${a}</span></span\n >`:s;return this.diffFileTemplate(l,await Q(n)||await Q(i)?this.diffTableTemplate(this.diffLineMessageTemplate("Binary file")):this.getDiffTableHTML(await this.generateAssetFilesDiff(t.readFileSync(n,"utf-8"),t.readFileSync(i,"utf-8"))))}return""}async generateChangelog(){this.logger.info(h.green("Generating changelog"));const o=await this.generateAssetFoldersDiff(),n=(await Promise.all(o.map(e=>this.generateFilesDiff(e)))).join("");this.logger.info(h.green("Writing changelog file"));const i=this.changelogTemplate.split("%FILES%");i.splice(1,0,n);const s=i.join("");t.writeFileSync(e.join(this.destinationPath,this.changelogFilename),s),this.logger.info(h.green(`Changelog file written to ${e.join(this.destinationPath,this.changelogFilename)}`))}}class pe{sourceDir;outputDir;fontName;constructor(e){this.sourceDir=e.sourceDir,this.outputDir=e.outputDir,this.fontName=e.fontName}async generate(){await ne({src:this.sourceDir,dist:this.outputDir,fontName:this.fontName,css:!0,typescript:!0,startUnicode:59905,svgicons2svgfont:{fontHeight:1024}})}}class fe{wss;eventListeners=new Map;lifecycleListeners=new Map;clients=new Map;ws;constructor(){this.wss=new ie({noServer:!0}),this.wss.on("connection",e=>this.onConnection(e)),this.wss.on("error",e=>this.fireLifecycle("error",e)),this.ws={on:(e,t)=>{"close"!==e&&"error"!==e?this.getEventSet(e).add(t):this.getLifecycleSet(e).add(t)},off:(e,t)=>{this.eventListeners.get(e)?.delete(t),"close"!==e&&"error"!==e||this.lifecycleListeners.get(e)?.delete(t)},send:(e,t)=>{if("string"==typeof e)for(const o of this.clients.keys())this.sendToSocket(o,e,t);else{const t=JSON.stringify(e);for(const e of this.clients.keys())e.readyState===se.OPEN&&e.send(t)}}}}handleUpgrade(e,t,o){return(e.url??"").split("?")[0]===g&&(this.wss.handleUpgrade(e,t,o,t=>{this.wss.emit("connection",t,e)}),!0)}async close(){this.fireLifecycle("close");for(const e of this.clients.keys())e.terminate();this.clients.clear(),await new Promise(e=>this.wss.close(()=>e()))}onConnection(e){const t={send:(t,o)=>this.sendToSocket(e,t,o)};this.clients.set(e,t),e.on("message",e=>this.onMessage(t,e)),e.on("close",()=>this.clients.delete(e)),e.on("error",()=>{})}onMessage(e,t){let o;try{o=JSON.parse(t.toString())}catch{return}if(!o||"custom"!==o.type||"string"!=typeof o.event)return;const n=this.eventListeners.get(o.event);if(n)for(const t of n)try{t(o.data,e)}catch(e){u().error(`ws handler for "${o.event}" failed`,{error:e instanceof Error?e:new Error(String(e))})}}sendToSocket(e,t,o){e.readyState===se.OPEN&&e.send(JSON.stringify({type:"custom",event:t,data:o}))}fireLifecycle(e,t){for(const o of this.lifecycleListeners.get(e)??[])try{o(t)}catch{}}getEventSet(e){let t=this.eventListeners.get(e);return t||(t=new Set,this.eventListeners.set(e,t)),t}getLifecycleSet(e){let t=this.lifecycleListeners.get(e);return t||(t=new Set,this.lifecycleListeners.set(e,t)),t}}const ue=s("pp-dev");function he(t,o,n){const s=[...P,"package.json","next.config.js","next.config.mjs","next.config.ts","vite.config.js","vite.config.mjs","vite.config.ts",".env",".env.local",".env.development",".env.development.local"].map(o=>e.join(t,o)),r=i(s,{ignored:t=>{const o=e.basename(t);return/(^|[\/\\])\../.test(t)&&!o.startsWith(".env")&&!o.startsWith(".pp-dev")&&!o.startsWith(".pp-watch")},persistent:!0,ignoreInitial:!0,followSymlinks:!1});let a=null;return r.on("change",i=>{n(h.blue(`🔧 Config file changed: ${e.relative(t,i)}`)),a&&clearTimeout(a),a=setTimeout(async()=>{try{n(h.yellow("🔄 Restarting dev server due to config change...")),await o()}catch(e){n(h.red(`❌ Failed to restart dev server: ${e?.message}. Stack: ${e?.stack}`))}},500)}),r.on("error",e=>{n(h.red(`❌ Config watcher error: ${e}`))}),{watcher:r,restartCallback:o,logger:n}}function ge(e){e.watcher&&e.watcher.close()}function me(e){if(!e||"object"!=typeof e||!("message"in e))return!1;const t=String(e.message);return/Turbopack is not supported/i.test(t)||/native bindings are not available/i.test(t)||/Only WebAssembly \(WASM\) bindings were loaded/i.test(t)}async function be(o){const{changelog:n,executionRoot:i,newAssetsPath:s,backupsDirPath:r,changelogDestinationPath:a,logLevel:l}=o;let c;if("string"==typeof n)c=e.resolve(i,n);else{if(!t.existsSync(r))return void u(l).warn(h.yellow("backups directory not found, skipping changelog generation"));const o=t.readdirSync(r,{withFileTypes:!0});if(!o.length)return void u(l).warn(h.yellow("no backups found, skipping changelog generation"));const n=o.filter(e=>e.isFile()&&e.name.endsWith(".zip"));if(!n.length)return void u(l).warn(h.yellow("no ZIP backups found, skipping changelog generation"));const i=n.reduce((o,n)=>t.statSync(e.resolve(r,o.name)).mtimeMs>t.statSync(e.resolve(r,n.name)).mtimeMs?o:n).name;c=e.resolve(r,i)}const d=new de({oldAssetsPath:c,newAssetsPath:s,destinationPath:a});await d.generateChangelog()}let we=global.__pp_dev_profile_session,ve=0;const ye=o=>{if(we)return new Promise((n,i)=>{we.post("Profiler.stop",(s,{profile:r})=>{if(s)i(s);else{const i=e.resolve(`./pp-dev-profile-${ve++}.cpuprofile`);t.writeFileSync(i,JSON.stringify(r)),o(h.yellow(`CPU profile written to ${h.white(h.dim(i))}`)),we=void 0,n()}})})},Pe=e=>{for(const[t,o]of Object.entries(e))Array.isArray(o)&&(e[t]=o[o.length-1])};function xe(e){const t={...e};return delete t["--"],delete t.c,delete t.config,delete t.base,delete t.l,delete t.logLevel,delete t.clearScreen,delete t.d,delete t.debug,delete t.f,delete t.filter,delete t.m,delete t.mode,t}ue.option("-c, --config <file>","[string] use specified config file").option("--base <path>","[string] public base path (default: /)").option("-l, --logLevel <level>","[string] info | warn | error | silent").option("--clearScreen","[boolean] allow/disable clear screen when logging").option("-d, --debug [feat]","[string | boolean] show debug logs").option("-f, --filter <filter>","[string] filter debug logs").option("-m, --mode <mode>","[string] set env mode"),ue.command("[root]","start dev server").alias("serve").alias("dev").option("--host [host]","[string] specify hostname").option("--port <port>","[number] specify port").option("--https","[boolean] use TLS + HTTP/2").option("--open [path]","[boolean | string] open browser on startup").option("--cors","[boolean] enable CORS").option("--strictPort","[boolean] exit if specified port is already in use").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle").action(async(t,o)=>{Pe(o);let i=null,s=null,l=!1;const c=t?e.resolve(process.cwd(),t):process.cwd(),d=u(o.logLevel),p=async()=>{if(!l){l=!0;try{i&&(d.info(h.yellow("🛑 Stopping existing dev server...")),await i.close(),i=null);const{clearConfigCache:e,getConfig:g}=await import("./index-BGMOUqHR.js").then(e=>e.h);e();const{createServer:m}=await import("vite"),b=await r({mode:o.mode||"development",command:"serve"},o.config,t,o.logLevel);let w=await W();const v=f(o.mode||"development",t??process.cwd(),"");if(v&&Object.keys(v).forEach(e=>{e.startsWith("MI_")&&(process.env[e]=v[e])}),b){const{plugins:e,...t}=b.config;w=a(w,t)}if(i=await m(a(w,{root:t,base:o.base,mode:o.mode,configFile:o.config,logLevel:o.logLevel,clearScreen:o.clearScreen,optimizeDeps:{force:o.force},server:xe(o),customLogger:d},!0)),!i.config.base||"/"===i.config.base)throw new Error('base cannot be equal to "/" or empty string');if(!i.httpServer)throw new Error("HTTP server not available");await i.listen();const y=global.__pp_dev_start_time??!1,P=y?h.dim(`ready in ${h.reset(h.bold(Math.ceil(n.now()-y)))} ms`):"";d.info(`\n ${h.green(`${h.bold("PP-DEV")} v${x}`)} ${P}\n`),i.printUrls();const T=await g();if(!1!==T.inspector?.enabled){const e=i.resolvedUrls?.local[0],t=e?new URL(e).origin:`http://localhost:${i.config.server.port??5173}`;d.info(`\n ${h.cyan("🔍 Request Inspector")} ${h.dim(t+S)}\n`)}!function(e,t){if(!e.httpServer||!process.stdin.isTTY||process.env.CI)return;e._shortcutsOptions=t;const o=u();t.print&&o.info(h.dim(h.green(" ➜"))+h.dim(" press ")+h.bold("h")+h.dim(" to show help"));const n=(t.customShortcuts??[]).filter(re).concat(le);ae?.(),ae=null;let i=!1;const s=process.stdin.isPaused(),r=process.stdin,a=Boolean(r.isRaw),l=async t=>{if(""===t)return void process.kill(process.pid,"SIGINT");if(""===t)return void await e.close().finally(()=>process.exit(0));if(i)return;"h"===t&&o.info(["",h.bold(" Shortcuts"),...n.map(e=>h.dim(" press ")+h.bold(e.key)+h.dim(` to ${e.description}`))].join("\n"));const s=n.find(e=>e.key===t);s&&(i=!0,await s.action(e),i=!1)};process.stdin.setRawMode(!0),process.stdin.on("data",l).setEncoding("utf8").resume();const c=e.httpServer,d=()=>{ae===d&&(c.removeListener("close",d),process.stdin.off("data",l),a||process.stdin.setRawMode(!1),s&&process.stdin.pause(),ae=null)};ae=d,c.on("close",d)}(i,{print:!0,customShortcuts:[...we?[{key:"p",description:"start/stop the profiler",async action(e){if(we)await ye(d.info);else{const e=await import("node:inspector").then(e=>e.default);await new Promise(t=>{we=new e.Session,we.connect(),we.post("Profiler.enable",()=>{we?.post("Profiler.start",()=>{d.info("Profiler started"),t()})})})}}}]:[],{key:"l",description:"proxy re-login",action(e){e.ws.send({type:"custom",event:"redirect",data:{url:`/auth/index/logout?proxyRedirect=${encodeURIComponent("/")}`}})}}]}),s||(s=he(c,p,d.info),d.info(h.blue("🔧 Config file watcher started"))),l=!1}catch(e){l=!1,d.error(h.red(`error when starting dev server:\n${e.stack}`),{error:e}),ye(d.info),process.exit(1)}}},g=async e=>{d.info(h.yellow(`\n🛑 Received ${e}, shutting down gracefully...`));try{s&&(ge(s),s=null),i&&(await i.close(),i=null),ye(d.info),d.info(h.green("✅ Graceful shutdown completed")),process.exit(0)}catch(e){d.error(h.red(`❌ Error during graceful shutdown: ${e}`)),process.exit(1)}};process.on("SIGINT",()=>g("SIGINT")),process.on("SIGTERM",()=>g("SIGTERM")),process.on("uncaughtException",e=>{d.error(h.red(`❌ Uncaught Exception: ${e}`)),g("uncaughtException")}),process.on("unhandledRejection",(e,t)=>{d.error(h.red(`❌ Unhandled Rejection at: ${t}, reason: ${e}`)),g("unhandledRejection")}),await p()}),ue.command("next [root]","start Next.js development server with pp-dev integration").alias("next-serve").alias("next-dev").option("--host [host]","[string] specify hostname").option("--port <port>","[number] specify port",{default:3e3}).option("--https","[boolean] use TLS + HTTP/2").option("--open [path]","[boolean | string] open browser on startup").option("--cors","[boolean] enable CORS").option("--strictPort","[boolean] exit if specified port is already in use").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle").option("--webpack","[boolean] use Webpack for Next dev (use when Turbopack/native SWC is unavailable)").option("--turbopack","[boolean] use Turbopack for Next dev when native bindings work").action(async(n,i)=>{Pe(i);let s=null,r=null,a=null,l=null,c=!1;const d=u(),p=async()=>{if(!c){c=!0;try{const{next:g,constants:w}=await Z(),{PHASE_DEVELOPMENT_SERVER:v}=w;a&&(await a.close(),a=null),r&&(d.info(h.yellow("🛑 Stopping existing Next.js server...")),await new Promise(e=>{r.close(()=>{r=null,e()})})),s&&"function"==typeof s.close&&(await s.close(),s=null);const{clearConfigCache:y}=await import("./index-BGMOUqHR.js").then(e=>e.h);y();const{join:P,basename:x}=await import("path"),{createServer:V}=await import("http"),W=await import("next/dist/server/config.js"),G=W.default.default||W["module.exports"].default||W.default,B=xe(i),X=f(i.mode||"development",n??process.cwd(),"");X&&Object.keys(X).forEach(e=>{e.startsWith("MI_")&&(process.env[e]=X[e])});const Y=n?P(process.cwd(),n):process.cwd();d.info(Y);const Q=await G(v,Y);let ee=Q?.ppDev||{};if(0===Object.keys(ee).length)try{const{getConfig:e}=await import("./index-BGMOUqHR.js").then(e=>e.h),t=await e();Object.keys(t).length>0?(ee=t,d.info(h.blue("🔧 Loaded pp-dev config from standalone config file"))):d.info(h.yellow("⚠️ No pp-dev config found in Next.js config or standalone file, using defaults"))}catch(e){d.info(h.yellow("⚠️ Failed to load standalone pp-dev config, using defaults")),console.debug("Error loading standalone config:",e)}else d.info(h.blue("🔧 Loaded pp-dev config from Next.js config"));let te=null;try{const{getPkg:e}=await import("./index-BGMOUqHR.js").then(e=>e.h);te=e().name}catch{te=x(Y)}T(ee,te??"");const oe=b(ee,te??""),ne=oe.backendBaseURL??"http://localhost:8080",ie=oe.templateLess,se=oe.v7Features,re=oe.disableSSLValidation,ae=oe.enableProxyCache,le=oe.proxyCacheTTL,ce=oe.personalAccessToken,de=oe.miHudLess,pe=oe.inspectorEnabled,ue=oe.inspectorMaxMemory,be=oe.inspectorCaptureLimit,we=oe.appId??(process.env.MI_APP_ID&&parseInt(process.env.MI_APP_ID,10)||void 0)??(process.env.MI_PORTAL_PAGE_ID&&parseInt(process.env.MI_PORTAL_PAGE_ID,10)||void 0)??1,ve=Q?.basePath;let ye="";ve?ye=ve:(ye=ie?E:se?k:L,ye+=`/${te}`);const Pe=function(e){const t="1"===process.env.PP_DEV_NEXT_WEBPACK||"true"===process.env.PP_DEV_NEXT_WEBPACK;if(t&&(e.webpack||e.turbopack))throw new Error("Do not combine PP_DEV_NEXT_WEBPACK with --webpack or --turbopack");if(t)return{webpack:!0};if(e.webpack&&e.turbopack)throw new Error("Use only one of --webpack or --turbopack");return e.webpack?{webpack:!0}:e.turbopack?{turbopack:!0}:{}}(i),Se=async e=>{delete process.env.TURBOPACK,s&&"function"==typeof s.close&&(await s.close(),s=null);const t={dev:!0,customServer:!0,hostname:B.host||"localhost",port:B.port,dir:Y,conf:{...Q,basePath:ye,assetPrefix:ye}};e.webpack?t.webpack=!0:e.turbopack&&(t.turbopack=!0),s=g(t),await s.prepare()};if(Pe.webpack)await Se({webpack:!0});else if(Pe.turbopack)try{await Se({turbopack:!0})}catch(e){if(!me(e))throw e;d.warn(h.yellow("⚠ Turbopack is unavailable (native bindings). Falling back to Webpack.")),await Se({webpack:!0})}else try{await Se({})}catch(e){if(!me(e))throw e;d.warn(h.yellow("⚠ Turbopack cannot run (native Next.js bindings unavailable). Falling back to Webpack.")),await Se({webpack:!0})}if(!s)throw new Error("Next.js app failed to initialize");if(ye.endsWith("/")||(ye+="/"),"/"===ye)throw new Error('basePath cannot be equal to "/" or equal to empty string');d.info(h.green("✅ Next.js app prepared successfully")),d.info(h.blue(`🔧 pp-dev plugin configured for template: ${te}`)),d.info(h.blue(`🔧 Base path configured: ${ye}`)),ne&&(d.info(h.blue(`🌐 Backend URL: ${ne}`)),d.info(h.blue(`🆔 Custom App ID: ${we}`)));const Te=s.getRequestHandler(),Ee="number"==typeof B.port?B.port:3e3,ke="string"==typeof B.host?B.host||"0.0.0.0":"localhost",Le=new Set;r=V(async(e,t)=>{try{const o=e.url||"/",n=o.split("?")[0];let i=K(o,!0);if(je.length>0){if(n.startsWith("/_next/")||"/favicon.ico"===n||n.startsWith("/__nextjs_")){if(Ie.length>0){let l=0;const c=()=>{if(l>=Ie.length)return void s();const o=Ie[l];l++,o(e,t,c)};return void c()}return void s()}let r=0;const a=()=>{if(r>=je.length)return void s();const o=je[r];r++,o(e,t,a)};return void a()}async function s(){if(n.startsWith(ye))i=K(o,!0);else{if(n===ye.replace(/\/$/,"")){const e=o.replace(n,ye);return t.writeHead(302,{Location:e}),void t.end()}if(n.startsWith("/_next/")||"/favicon.ico"===n||n.startsWith("/__nextjs_"));else if("/"===n)return t.writeHead(302,{Location:ye}),void t.end()}await Te(e,t,i)}s()}catch(p){d.error(`Error handling request: ${p instanceof Error?p.message:String(p)}`,{error:p instanceof Error?p:void 0}),t.statusCode=500,t.end("Internal Server Error")}});let $e=null,je=[],Ie=[];if(!1!==pe){const e=new $(ue);j(I,e,be);const t=D(e,be);je.push(t)}if(ne){const n=new URL(ne).host;ne.startsWith("https://")&&(o.defaultMaxListeners=Math.max(o.defaultMaxListeners,20));const i={headers:{host:n,referer:ne,origin:ne.replace(/^(https?:\/\/)([^/]+)(\/.*)?$/i,"$1$2")},appId:we,templateLess:ie,disableSSLValidation:re,v7Features:se,personalAccessToken:ce??process.env.MI_ACCESS_TOKEN};$e=new F(ne,i);const l=_(ye,te??void 0),c=(e,t,o)=>{l(e,t,o)};Ie.push(c),je.push(c);const p=q(ye);if(Ie.push(p),je.push(p),ae){let e=+le;(!e||Number.isNaN(e)||e<0)&&(e=6e5);const t={middlewares:{use:e=>e},config:{logger:console}},o=N({devServer:t,ttl:e}),n=(e,t,n)=>{o(e,t,n)};je.push(n),d.info(h.blue(`🔧 Proxy cache middleware added with TTL: ${e}ms`))}const f=new RegExp(`^((${u=ye,u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})|/)$`),g=A(f,$e,Object.assign({base:ye},i,{miHudLess:de})),b=(e,t,o)=>{g(e,t,o)};je.push(b);const v=ye.endsWith("/")?ye.substring(0,ye.length-1):ye,y={middlewares:{use:e=>e},config:{logger:console}},P=C({devServer:y,baseURL:ne,proxyIgnore:["/@vite","/@metricinsights","/@",v,"/_next","/favicon.ico","/__nextjs_","/installHook.js.map"],disableSSLValidation:re,miAPI:$e,templateName:te??void 0}),T=(e,t,o)=>{P(e,t,o)};je.push(T);const E=I,k=(e,t,o)=>{if(e.url?.startsWith("/@api/")||e.url?.startsWith(S)||e.url?.startsWith(R)){return void E(e,t,()=>{})}o()};Ie.push(k),je.push(k);const L=M(e=>{const t=e.split("?")[0];return t.startsWith(ye)&&!t.includes("/_next/")},(e,t)=>{const o=$e.buildPage(e,de),i=J(o,ye,{backendBaseURL:ne,templateLess:ie,appId:we,devPanelPosition:oe.devPanelPosition,devPanelHidden:oe.devPanelHidden,devPanelAutoHide:oe.devPanelAutoHide});return Buffer.from(O(n,t.headers.host??"",i))}),$=(e,t,o)=>{L(e,t,o)};je.push($),a=new fe;let j=Q?.distDir;try{process.env[m]="1";const e=await G(w.PHASE_PRODUCTION_BUILD,Y);j=e?.distDir??j}catch{}const D=(j??"").replace(/\\/g,"/").replace(/\/+$/,"").replace(/\/dev$/,""),V=D&&".next"!==D?D:"out";let W,Z="0.0.0";try{const o=JSON.parse(t.readFileSync(e.join(Y,"package.json"),"utf-8"));Z="string"==typeof o.version?o.version:Z,W="string"==typeof o.repository?o.repository:o.repository?.url}catch{}const B=!1!==oe.distZip?new z(te??x(Y),{nextBuild:{projectRoot:Y,distDir:V,packageVersion:Z,packageRepositoryUrl:W}}):void 0,K={ws:a.ws,config:{clientInjectionPlugin:{v7Features:se}}};new H(K,{distService:B,miAPI:$e}),U(I,{distService:B,miAPI:$e});const X="function"==typeof s?.getUpgradeHandler?s.getUpgradeHandler():null;r.on("upgrade",(e,t,o)=>{a?.handleUpgrade(e,t,o)||(X?X(e,t,o):t.destroy())}),d.info(h.blue(`🔧 ${je.length} pp-dev middlewares initialized`)),d.info(h.blue(`🔧 ${Ie.length} essential middlewares for internal routes`)),d.info(h.blue(`🔧 MiAPI initialized for backend: ${ne}`)),d.info(h.blue(`🔧 Custom App ID: ${we}`))}r.listen(Ee,ke,()=>{d.info(h.green(`✅ pp-dev Next.js server running at http://${ke}:${Ee}`)),d.info(h.blue(`📱 Next.js app accessible at http://${ke}:${Ee}${ye}`)),!1!==pe&&d.info(h.cyan(`🔍 Request Inspector: http://${ke}:${Ee}${S}`)),d.info(h.blue("🔧 Base path handling active")),l||(l=he(Y,p,d.info),d.info(h.blue("🔧 Config file watcher started"))),r.on("connection",e=>{Le.add(e),e.on("close",()=>Le.delete(e))});const e=async e=>{d.info(h.yellow(`\n🛑 Received ${e}, shutting down gracefully...`));const t=setTimeout(()=>{d.info(h.yellow("⏰ Shutdown timeout reached, forcing exit")),process.exit(0)},5e3);try{l&&(ge(l),l=null);for(const e of Array.from(Le))e.destroy();Le.clear(),a&&(await a.close(),a=null),await new Promise(e=>{r.close(()=>{d.info(h.yellow("🛑 HTTP server closed")),e()})}),s&&"function"==typeof s.close&&(await s.close(),d.info(h.yellow("🛑 Next.js app closed"))),clearTimeout(t),d.info(h.green("✅ Graceful shutdown completed")),process.exit(0)}catch(e){clearTimeout(t),d.error(h.red(`❌ Error during graceful shutdown: ${e}`)),process.exit(1)}};let t=process;if("function"!=typeof process.on){const e=globalThis.process||global.process;e&&"function"==typeof e.on&&(t=e,d.info(h.green("✅ Using global process object for event handlers")))}if("function"==typeof t.on)try{t.on("SIGINT",()=>e("SIGINT")),t.on("SIGTERM",()=>e("SIGTERM")),t.on("uncaughtException",t=>{d.error(h.red(`❌ Uncaught Exception: ${t}`)),e("uncaughtException")}),t.on("unhandledRejection",(t,o)=>{d.error(h.red(`❌ Unhandled Rejection at: ${o}, reason: ${t}`)),e("unhandledRejection")}),d.info(h.green("✅ Process event handlers registered successfully"))}catch(e){d.warn(h.yellow(`⚠️ Failed to register process event handlers: ${e}`))}else d.warn(h.yellow("⚠️ process.on is not available, graceful shutdown handlers will not be registered")),d.info(h.blue("💡 This might be due to bundling or environment constraints"))}),c=!1}catch(e){c=!1,d.error(h.red(`❌ Failed to start Next.js server: ${e?.message}. Stack: ${e?.stack}`)),e instanceof Error&&e.message.includes("Next.js is required")&&(d.error(h.red("❌ Next.js Peer Dependency Error:")),d.error(h.red(e.message)),d.error(h.yellow("\n💡 To fix this issue:")),d.error(h.blue(" 1. Install Next.js in your project:")),d.error(h.white(" npm install next@^16")),d.error(h.blue(" 2. Or use yarn:")),d.error(h.white(" yarn add next@^16")),d.error(h.blue(" 3. Or use pnpm:")),d.error(h.white(" pnpm add next@^16")),d.error(h.yellow("\n📖 For more information, see:")),d.error(h.blue(" https://nextjs.org/docs/getting-started"))),process.exit(1)}var u}},g=async e=>{d.info(h.yellow(`\n🛑 Received ${e}, shutting down gracefully...`));try{l&&(ge(l),l=null),a&&(await a.close(),a=null),r&&await new Promise(e=>{r.close(()=>{r=null,e()})}),s&&"function"==typeof s.close&&(await s.close(),s=null),d.info(h.green("✅ Graceful shutdown completed")),process.exit(0)}catch(e){d.error(h.red(`❌ Error during graceful shutdown: ${e}`)),process.exit(1)}};process.on("SIGINT",()=>g("SIGINT")),process.on("SIGTERM",()=>g("SIGTERM")),process.on("uncaughtException",e=>{d.error(h.red(`❌ Uncaught Exception: ${e}`)),g("uncaughtException")}),process.on("unhandledRejection",(e,t)=>{d.error(h.red(`❌ Unhandled Rejection at: ${t}, reason: ${e}`)),g("unhandledRejection")}),await p()}),ue.command("build [root]","build for production").option("--target <target>","[string] transpile target (default: 'modules')").option("--outDir <dir>","[string] output directory (default: dist)").option("--assetsDir <dir>","[string] directory under outDir to place assets in (default: assets)").option("--assetsInlineLimit <number>","[number] static asset base64 inline threshold in bytes (default: 4096)").option("--ssr [entry]","[string] build specified entry for server-side rendering").option("--sourcemap [output]",'[boolean | "inline" | "hidden"] output source maps for build (default: false)').option("--minify [minifier]",'[boolean | "terser" | "esbuild"] enable/disable minification, or specify minifier to use (default: esbuild)').option("--manifest [name]","[boolean | string] emit build manifest json").option("--ssrManifest [name]","[boolean | string] emit ssr manifest json").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle (experimental)").option("--emptyOutDir","[boolean] force empty outDir when it's outside of root").option("-w, --watch","[boolean] rebuilds when modules have changed on disk").option("--changelog [assetsFile]","[boolean | string] generate changelog between assetsFile and current build (default: false)").option("--distZip","[boolean] pack build output into a ZIP archive; use --no-distZip to disable (default: pp-dev config build.zip, or true). Env: PP_DEV_DIST_ZIP").option("--distZipDir <dir>","[string] override the ZIP output directory (default: 'dist-zip'). Env: PP_DEV_DIST_ZIP_DIR").option("--distZipFilename <filename>","[string] override the ZIP output file name (default: '<app-name>.zip'). Env: PP_DEV_DIST_ZIP_FILENAME").option("--versionManifest","[boolean] emit VERSION-*.json + BUILD-MANIFEST.json; use --no-versionManifest to disable (default: pp-dev config build.versionFile, or true). Env: PP_DEV_VERSION_MANIFEST").option("--versionFileTemplate <template>","[string] override the VERSION file name template (default: 'VERSION-v{packageversion}-{currentDate}.json'). Env: PP_DEV_VERSION_FILE_TEMPLATE").action(async(t,o)=>{Pe(o);const n=xe(o),i=V(o);try{const s=await r({mode:o.mode||"production",command:"build"},o.config,t,o.logLevel);let c=await W(i);if(s){const{plugins:e,...t}=s.config;c=a(c,t)}const d=a(c,{root:t,base:o.base,mode:o.mode,configFile:o.config,logLevel:o.logLevel,clearScreen:o.clearScreen,optimizeDeps:{force:o.force},build:n},!0);if(await l(d),n.changelog){const i=t||process.cwd(),s=d.build?.outDir||"dist";let r="dist-zip";d.ppDevConfig&&(!1===d.ppDevConfig.distZip?r=s:"object"==typeof d.ppDevConfig.distZip&&"string"==typeof d.ppDevConfig.distZip.outDir&&(r=d.ppDevConfig.distZip.outDir)),await be({changelog:n.changelog,executionRoot:i,newAssetsPath:e.resolve(i,s),backupsDirPath:e.resolve(i,d.ppDevConfig?.syncBackupsDir||"backups"),changelogDestinationPath:e.resolve(i,r),logLevel:o.logLevel})}}catch(e){u(o.logLevel).error(h.red(`error during build:\n${e.stack}`),{error:e}),process.exit(1)}finally{ye(e=>u(o.logLevel).info(e))}}),ue.command("next-build [root]","build a Next.js app for production (`next build`) and emit VERSION/BUILD-MANIFEST/zip in the same format as `pp-dev build`").option("--changelog [assetsFile]","[boolean | string] generate changelog between assetsFile and current build (default: false)").option("--distZip","[boolean] pack build output into a ZIP archive; use --no-distZip to disable (default: pp-dev config build.zip, or true). Env: PP_DEV_DIST_ZIP").option("--distZipDir <dir>","[string] override the ZIP output directory (default: 'dist-zip'). Env: PP_DEV_DIST_ZIP_DIR").option("--distZipFilename <filename>","[string] override the ZIP output file name (default: '<app-name>.zip'). Env: PP_DEV_DIST_ZIP_FILENAME").option("--versionManifest","[boolean] emit VERSION-*.json + BUILD-MANIFEST.json; use --no-versionManifest to disable (default: pp-dev config build.versionFile, or true). Env: PP_DEV_VERSION_MANIFEST").option("--versionFileTemplate <template>","[string] override the VERSION file name template (default: 'VERSION-v{packageversion}-{currentDate}.json'). Env: PP_DEV_VERSION_FILE_TEMPLATE").action(async(o,n)=>{Pe(n);const i=u(n.logLevel),s=o?e.resolve(process.cwd(),o):process.cwd(),r=V(n);process.env[m]="1";try{const{constants:o}=await Z(),a=await import("next/dist/server/config.js"),l=a.default.default||a["module.exports"].default||a.default,c=await l(o.PHASE_PRODUCTION_BUILD,s);let d,p=c?.ppDev||{};if(0===Object.keys(p).length){const{getConfig:e}=await import("./index-BGMOUqHR.js").then(e=>e.h);p=await e()}try{const{getPkg:e}=await import("./index-BGMOUqHR.js").then(e=>e.h);d=e().name}catch{d=e.basename(s)}const f=b(p,d),u=G(f.distZip,r,`${d}.zip`),g=B(f.versionPlugin,r);i.info(h.cyan("[pp-dev] Running `next build`...")),await w(s);const m="string"==typeof c?.distDir&&c.distDir?c.distDir:".next",P=".next"===m?"out":m,x=e.resolve(s,P);if(!t.existsSync(x)||!t.statSync(x).isDirectory())throw new Error(`Next.js build output directory not found: ${x}. "next-build" requires "output: 'export'" in next.config (static export).`);const S=JSON.parse(t.readFileSync(e.join(s,"package.json"),"utf-8"));if(!1!==g&&!1!==g.enabled&&(v({outDir:x,packageVersion:"string"==typeof S.version?S.version:"0.0.0",versionFileTemplate:g.versionFileTemplate,packageRepositoryUrl:"string"==typeof S.repository?S.repository:S.repository?.url,enabled:g.enabled}),i.info(h.green(`✅ VERSION / BUILD-MANIFEST written to ${e.relative(s,x)}`))),!1!==u){const o=e.resolve(s,u.outDir),n=u.inDir?e.resolve(x,u.inDir):x,r=e.join(o,u.outFileName);t.mkdirSync(o,{recursive:!0});const a=await y(n);t.writeFileSync(r,a),i.info(h.green(`✅ Zip archive written to ${e.relative(s,r)}`))}if(n.changelog){const t=!1!==u?u.outDir:P;await be({changelog:n.changelog,executionRoot:s,newAssetsPath:x,backupsDirPath:e.resolve(s,f.syncBackupsDir),changelogDestinationPath:e.resolve(s,t),logLevel:n.logLevel})}}catch(e){u(n.logLevel).error(h.red(`error during next-build:\n${e.stack}`),{error:e}),process.exit(1)}finally{ye(e=>u(n.logLevel).info(e))}}),ue.command("changelog [oldAssetPath] [newAssetPath]","generate changelog between two assets files/folders").option("--oldAssetsPath <oldAssetsPath>","[string] path to the old assets zip file or folder").option("--newAssetsPath <newAssetsPath>","[string] path to the new assets zip file or folder").option("--destination <destination>","[string] destination folder for the changelog (default: .)").option("--filename <filename>","[string] filename for the changelog (default: CHANGELOG.html)").action(async(t,o,n)=>{Pe(n);const{oldAssetsPath:i=t,newAssetsPath:s=o,destination:r=".",filename:a="CHANGELOG.html",logLevel:l}=n,c=process.cwd();i&&s||(u(l).error(h.red("error during changelog generation: oldAssetPath and newAssetPath are required")),process.exit(1));const d=e.resolve(c,i),p=e.resolve(c,s),f=e.resolve(c,r),g=new de({oldAssetsPath:d,newAssetsPath:p,destinationPath:f,changelogFilename:a});await g.generateChangelog()}),ue.command("generate-icon-font [source] [destination]","generate icon font from SVG files").option("--source <source>","[string] path to the source directory with SVG files").option("--destination <destination>","[string] path to the destination directory to save the generated font files").option("--font-name, -n <fontName>","[string] name of the font to generate (default: 'icon-font')").action(async(t,o,n)=>{Pe(n);const{source:i=t,destination:s=o,fontName:r="icon-font"}=n,a=process.cwd(),l=e.resolve(a,i),c=e.resolve(a,s),d=new pe({sourceDir:l,outputDir:c,fontName:r}),p=u(n.logLevel);p.info(`Generating icon font from SVG files in ${h.dim(l)}`),await d.generate(),p.info(`Icon font generated and saved to ${h.dim(c)}`)}),ue.command("optimize [root]","pre-bundle dependencies").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle").action(async(e,t)=>{Pe(t);try{const o=await r({mode:t.mode||"production",command:"build"},t.config,e,t.logLevel);let n=await W();if(o){const{plugins:e,...t}=o.config;n=a(n,t)}const i=await c(a(n,{root:e,base:t.base,configFile:t.config,logLevel:t.logLevel,mode:t.mode}),"serve");await d(i,t.force,!0)}catch(e){u(t.logLevel).error(h.red(`error when optimizing deps:\n${e.stack}`),{error:e}),process.exit(1)}}),ue.command("preview [root]","locally preview production build").option("--host [host]","[string] specify hostname").option("--port <port>","[number] specify port").option("--strictPort","[boolean] exit if specified port is already in use").option("--https","[boolean] use TLS + HTTP/2").option("--open [path]","[boolean | string] open browser on startup").option("--outDir <dir>","[string] output directory (default: dist)").action(async(e,t)=>{Pe(t);try{const o=await r({mode:t.mode||"production",command:"build"},t.config,e,t.logLevel);let n=await W();if(o){const{plugins:e,...t}=o.config;n=a(n,t)}(await p(a(n,{root:e,base:t.base,configFile:t.config,logLevel:t.logLevel,mode:t.mode,build:{outDir:t.outDir},preview:{port:t.port,strictPort:t.strictPort,host:t.host,https:t.https,open:t.open}}))).printUrls()}catch(e){u(t.logLevel).error(h.red(`error when starting preview server:\n${e.stack}`),{error:e}),process.exit(1)}finally{ye(e=>u(t.logLevel).info(e))}}),ue.command("migrate [config]","migrate pp-dev config from 0.x flat format to 1.0 grouped format").option("--dry-run","[boolean] print migrated config without writing any files").option("--format <format>","[string] output format: ts (default), js, json").option("--output <file>","[string] output file path (default: pp-dev.config.ts)").option("--no-backup","[boolean] skip backup of original config file").action(async(o,n)=>{const i=u(n.logLevel),{isLegacyFlatConfig:s,isLegacyPPWatchConfig:r,isAlreadyMigrated:a,migrateLegacyFlatConfig:l,migratePPWatchConfig:c,generateConfigFileContent:d}=await import("./migrate-BYuCtRbI.js"),p=n.format??"ts",f=!1!==n.backup,g=process.cwd(),m=[".pp-watch.config.ts",".pp-watch.config.js",".pp-watch.config.json","pp-watch.config.ts","pp-watch.config.js","pp-watch.config.json"];let b=o??null,w=!1;if(!b){for(const o of P)if(t.existsSync(e.join(g,o))){b=e.join(g,o);break}if(!b)for(const o of m)if(t.existsSync(e.join(g,o))){b=e.join(g,o),w=!0;break}}b||(i.warn(h.yellow("No pp-dev or pp-watch config file found in the current directory.")),i.info(h.blue("Supported files: pp-dev.config.{ts,js,cjs,mjs,json}, .pp-watch.config.{ts,js,json}")),process.exit(1)),i.info(h.blue(`Found config: ${e.relative(g,b)}`));const{getPkg:v}=await import("./index-BGMOUqHR.js").then(e=>e.h),y=v();let x,S={};try{if(/\.[cm]?ts$/i.test(b)){const o=await import("esbuild"),{pathToFileURL:n}=await import("url"),i=(await o.build({absWorkingDir:g,entryPoints:[b],outfile:"out.js",write:!1,target:"node24",platform:"node",bundle:!0,packages:"external",format:"esm",mainFields:["main"]})).outputFiles[0].text,s=`pp-migrate-tmp-${Date.now()}.mjs`;t.writeFileSync(s,i);try{const t=await import(n(e.resolve(g,s)).toString());S=t.default?.default??t.default??t}finally{t.existsSync(s)&&t.unlinkSync(s)}}else if(/\.[cm]?js$/i.test(b)){const{pathToFileURL:t}=await import("url"),o=await import(t(e.resolve(g,b)).toString());S=o.default?.default??o.default??o}else b.endsWith(".json")&&(S=JSON.parse(t.readFileSync(b,"utf-8")))}catch(e){i.error(h.red(`Failed to load config file: ${e.message}`)),process.exit(1)}S&&"object"==typeof S||(i.error(h.red("Config file did not export a valid object.")),process.exit(1)),a(S)?(i.info(h.green("Config is already in 1.0 format — nothing to migrate.")),process.exit(0)):w||r(S)?(i.info(h.blue("Detected pp-watch config format → migrating to 1.0")),x=c(S)):s(S)?(i.info(h.blue("Detected 0.x flat config format → migrating to 1.0")),x=l(S,y.name)):(i.warn(h.yellow("Could not detect config format. No known keys found.")),process.exit(1));const T=d(x,p),E=n.output??e.join(g,`pp-dev.config.${p}`);if(n.dryRun&&(i.info(h.green(`\n--- Migrated config (dry-run) → ${e.relative(g,E)} ---\n`)),process.exit(0)),f&&t.existsSync(b)){const o=`${b}.bak`;t.copyFileSync(b,o),i.info(h.blue(`Backed up original to: ${e.relative(g,o)}`))}t.writeFileSync(E,T,"utf-8"),i.info(h.green(`✅ Migration complete → ${e.relative(g,E)}`)),b!==E&&t.existsSync(b)&&i.info(h.yellow(`You can now delete the old config: ${e.relative(g,b)}`))}),ue.help(),ue.version(x),ue.parse();export{ye as stopProfiler};
|
|
1
|
+
import*as e from"path";import*as t from"fs";import{EventEmitter as o}from"node:events";import{performance as n}from"node:perf_hooks";import{watch as i}from"chokidar";import{cac as s}from"cac";import{loadConfigFromFile as r,mergeConfig as a,build as l,resolveConfig as c,optimizeDeps as d,preview as p,loadEnv as f}from"vite";import{c as u,a as h,P as g,b as m,n as b,r as w,w as v,z as y,d as P,V as x,I as S,v as T,e as E,f as k,g as L,R as $,h as j,i as I,j as D,M as F,k as _,l as N,m as A,o as C,p as R,q as M,u as O,D as z,C as H,s as U}from"./plugin-BtTlYPNc.js";import{r as V,g as W,s as Z,a as G,b as B,c as q,i as J}from"./index-BtZKQ3Ni.js";import{parse as K}from"url";import*as X from"dir-compare";import Y from"diff-match-patch";import{isBinaryFile as Q}from"isbinaryfile";import*as ee from"os";import*as te from"crypto";import oe from"extract-zip";import ne from"svgtofont";import{WebSocketServer as ie,WebSocket as se}from"ws";import"http-proxy-middleware";import"picocolors";import"axios";import"node:http";import"node:https";import"jsdom";import"process";import"child_process";import"jszip";import"module";import"memory-cache";import"zlib";import"express";import"node:crypto";import"./helpers.js";import"ejs";function re(e){return null!=e&&!1!==e}let ae=null;const le=[{key:"r",description:"restart the server",async action(e){await e.restart()}},{key:"u",description:"show server url",action(e){e.config.logger.info(""),e.printUrls()}},{key:"o",description:"open in browser",action(e){e.openBrowser()}},{key:"c",description:"clear console",action(e){e.config.logger.clearScreen("error")}},{key:"q",description:"quit",async action(e){await e.close().finally(()=>process.exit())}},{key:"C",description:"clear proxy cache",action(e){e.cache&&(e.cache.clear(),e.config.logger.info("Proxy cache cleared"))}}];const ce=/(.+)(-[a-f0-9]{6,20})(\.[a-z0-9]+)$/i;class de{oldAssetsPath;newAssetsPath;destinationPath;changelogFilename;changelogTemplate='<!DOCTYPE html>\n <html lang="en">\n <head>\n <meta charset="UTF-8" />\n <title>Changelog Diff</title>\n <style>\n tr,\n td {\n padding: 0;\n }\n .diff-file {\n margin-top: 20px;\n border: 1px solid #e1e4e8;\n border-radius: 6px;\n }\n .diff-file-title {\n padding: 10px 20px;\n background-color: #f6f8fa;\n border-bottom: 1px solid #e1e4e8;\n border-radius: 6px 6px 0 0;\n font-weight: bold;\n }\n .diff-file-title .renamed {\n font-weight: normal;\n }\n .diff-file-title .renamed .from {\n color: #cb2431;\n }\n .diff-file-title .renamed .to {\n color: #22863a;\n }\n .diff-file-title .added {\n color: #22863a;\n }\n .diff-file-title .deleted {\n color: #cb2431;\n }\n .diff-file-content {\n }\n .diff-table {\n tab-size: 8;\n width: 100%;\n border-collapse: separate;\n border-spacing: 0;\n }\n .blob-num {\n position: relative;\n color: #1f2328;\n width: 1%;\n min-width: 50px;\n padding: 0 10px;\n font-family:\n ui-monospace,\n SFMono-Regular,\n SF Mono,\n Menlo,\n Consolas,\n Liberation Mono,\n monospace;\n font-size: 12px;\n line-height: 20px;\n text-align: right;\n white-space: nowrap;\n vertical-align: top;\n cursor: pointer;\n -webkit-user-select: none;\n user-select: none;\n }\n .blob-num.addition {\n background-color: #ccffd8;\n border-color: #1f883e;\n }\n .blob-num.deletion {\n background-color: #ffd7d5;\n border-color: #cf222e;\n }\n .blob-num::before {\n content: attr(data-line-number);\n }\n .blob-code {\n position: relative;\n padding: 0 10px 0 22px;\n vertical-align: top;\n color: #1f2329;\n }\n .blob-code.code-addition {\n background-color: #e6ffec;\n }\n .blob-code.code-deletion {\n background-color: #ffebe9;\n }\n .blob-code.skip,\n .blob-code.message {\n text-align: center;\n }\n .blob-code.skip .blob-code-inner,\n .blob-code.message .blob-code-inner {\n font-weight: bold;\n color: #6a737d;\n padding: 10px 0;\n }\n .blob-code-inner {\n display: table-cell;\n overflow: visible;\n font-family:\n ui-monospace,\n SFMono-Regular,\n SF Mono,\n Menlo,\n Consolas,\n Liberation Mono,\n monospace;\n font-size: 12px;\n word-wrap: anywhere;\n white-space: pre-wrap;\n }\n .blob-code-inner::before {\n content: attr(data-code-prefix);\n position: absolute;\n top: 1px;\n left: 8px;\n padding-right: 8px;\n }\n </style>\n </head>\n <body>\n <h1>Changelog Diff</h1>\n\n %FILES%\n </body>\n </html>';diffFileTemplateHandler;diffLineTemplateHandler;contextLines=3;logger;constructor(t){const{oldAssetsPath:o,newAssetsPath:n,destinationPath:i,changelogTemplate:s,diffFileTemplateHandler:r,diffLineTemplateHandler:a,changelogFilename:l,contextLines:c}=t;if(this.logger=u(),!o||!n||!i)throw new Error("Previous assets path, current assets path and destination path are required");if(o===n)throw new Error("Previous and current assets paths must be different");if(!this.isExists(o))throw new Error(`Previous assets path ${o} does not exist`);if(!this.isExists(n))throw new Error(`Current assets path ${n} does not exist`);if(this.isZipFile(o)){const t=e.resolve(ee.tmpdir(),te.createHash("md5").update(o).digest("hex"));this.oldAssetsPath=this.unzipFile(o,t).then(()=>this.normalizeAssetFolderPath(t)).then(e=>{if(this.isEmptyFolder(e))throw new Error(`Previous assets path ${e} is empty`);return e})}else{if(!this.isFolder(o))throw new Error(`Invalid previous assets path ${o}. It must be a folder or a zip file`);{const e=this.normalizeAssetFolderPath(o);if(this.isEmptyFolder(e))throw new Error(`Previous assets path ${e} is empty`);this.oldAssetsPath=Promise.resolve(e)}}if(this.isZipFile(n)){const t=e.resolve(ee.tmpdir(),te.createHash("md5").update(n).digest("hex"));this.newAssetsPath=this.unzipFile(n,t).then(()=>this.normalizeAssetFolderPath(t)).then(e=>{if(this.isEmptyFolder(e))throw new Error(`Current assets path ${e} is empty`);return e})}else{if(!this.isFolder(n))throw new Error(`Invalid current assets path ${n}. It must be a folder or a zip file`);{const e=this.normalizeAssetFolderPath(n);if(this.isEmptyFolder(e))throw new Error(`Current assets path ${n} is empty`);this.newAssetsPath=Promise.resolve(e)}}this.destinationPath=i,this.mkdirpSync(this.destinationPath),this.changelogFilename=l||"CHANGELOG.html",s&&(this.templateIsValid(s)?this.changelogTemplate=s:this.logger.warn(h.yellow("Invalid changelog template, using default"))),"function"==typeof r&&(this.diffFileTemplateHandler=r),"function"==typeof a&&(this.diffLineTemplateHandler=a),c&&(this.contextLines=c)}templateIsValid(e){return e.includes("%FILES%")}isExists(e){return t.existsSync(e)}isZipFile(e){return e.endsWith(".zip")}isFolder(e){return t.lstatSync(e).isDirectory()}isEmptyFolder(e){return 0===t.readdirSync(e,{withFileTypes:!0}).length}mkdirpSync(e){t.existsSync(e)||t.mkdirSync(e,{recursive:!0})}async unzipFile(e,o){return t.rmSync(o,{force:!0,recursive:!0}),oe(e,{dir:o})}normalizeAssetFolderPath(o){const n=t.readdirSync(o);return 1===n.length&&t.lstatSync(e.join(o,n[0])).isDirectory()?this.normalizeAssetFolderPath(e.join(o,n[0])):o}pathToPosix(e){return e.replace(/\\/g,"/")}diffTableTemplate(e){return`<table class="diff-table">\n <tbody>\n ${e}\n </tbody>\n </table>`}getDiffTableHTML(e){const t=e.filter((e,t,o)=>0!==e.lineType||(t>=0&&t<this.contextLines||t>o.length-(this.contextLines+1)&&t<=o.length-1||o.slice(t-this.contextLines,t+this.contextLines+1).some(e=>0!==e.lineType))).map((e,t,o)=>{if(t>0){const n=o[t-1];if(e.lineNumber-n.lineNumber>1)return[{lineNumber:-1,lineContent:"",lineType:0},e]}return[e]}).flat().map(e=>this.diffLineHTML(e)).join("");return this.diffTableTemplate(t)}diffLineMessageTemplate(e){return`<tr>\n <td class="blob-num"></td>\n <td class="blob-num"></td>\n <td class="blob-code message">\n <span class="blob-code-inner">${e}</span>\n </td>\n </tr>`}diffLineSkipTemplate(){return'<tr>\n <td class="blob-num"></td>\n <td class="blob-num"></td>\n <td class="blob-code skip">\n <span class="blob-code-inner">Skip</span>\n </td>\n </tr>'}diffLineTemplate(e){const{lineNumber:t,lineContent:o,lineType:n}=e,i=1===n?"addition":-1===n?"deletion":"";return`<tr>\n <td\n class="blob-num ${i}${"addition"===i?" empty":""}"\n ${"addition"!==i?` data-line-number="${t}"`:""}\n ></td>\n <td\n class="blob-num ${i}${"deletion"===i?" empty":""}"\n ${"deletion"!==i?` data-line-number="${t}"`:""}\n ></td>\n <td class="blob-code ${1===n?"code-addition":-1===n?"code-deletion":""}">\n <span class="blob-code-inner" data-code-prefix="${1===n?"+":-1===n?"-":" "}">${s=o??"",s.replace(/[\u00A0-\u9999<>&]/g,e=>"&#"+e.charCodeAt(0)+";")}</span>\n </td>\n </tr>`;var s}diffLineHTML(e){if(this.diffLineTemplateHandler)return this.diffLineTemplateHandler(e);const{lineNumber:t}=e;return-1===t?this.diffLineSkipTemplate():this.diffLineTemplate(e)}diffFileTemplate(e,t){return this.diffFileTemplateHandler?this.diffFileTemplateHandler(e,t):`<div class="diff-file">\n <div class="diff-file-title">${e}</div>\n <div class="diff-file-content">${t}</div>\n </div>`}async generateAssetFoldersDiff(){this.logger.info(h.blue(`Comparing asset folders ${await this.oldAssetsPath} and ${await this.newAssetsPath}`));const e=await X.compare(await this.oldAssetsPath,await this.newAssetsPath,{compareContent:!0,skipSymlinks:!0,compareSize:!0,compareDate:!1,compareNameHandler:(e,t)=>(ce.test(e)&&(e=e.replace(ce,"$1$3")),ce.test(t)&&(t=t.replace(ce,"$1$3")),0===e.localeCompare(t)?0:e.localeCompare(t)>0?1:-1)});return e.diffSet?.filter(e=>"equal"!==e.state||e.name1!==e.name2)||[]}async generateAssetFilesDiff(e,t){const o=new Y,n=o.diff_linesToChars_(e,t),i=o.diff_main(n.chars1,n.chars2,!1);o.diff_charsToLines_(i,n.lineArray);let s=0;return i.map(e=>{const[t,o]=e,n=o.endsWith("\n")?o.split("\n").length-1:o.split("\n").length,i=o.split("\n").map((e,o)=>({lineContent:e,lineNumber:s+o+1,lineType:t})).slice(0,n);return-1!==t&&(s+=n),i}).flat()}async generateFilesDiff(o){if("equal"===o.state){const t=this.pathToPosix(e.join(".",o.relativePath,o.name1??"")),n=this.pathToPosix(e.join(".",o.relativePath,o.name2??""));return this.diffFileTemplate(`<span class="renamed"\n >Renamed <span class="from">${t}</span> -> <span class="to">${n}</span></span\n >`,this.diffTableTemplate(this.diffLineMessageTemplate("No changes")))}const n=o.path1&&o.name1?e.join(o.path1,o.name1):null,i=o.path2&&o.name2?e.join(o.path2,o.name2):null,s=this.pathToPosix(e.join(".",o.relativePath,(o.name1||o.name2)??""));if("left"===o.state&&n)return this.diffFileTemplate(`<span class="removed">Removed ${s}</span>`,this.diffTableTemplate(this.diffLineMessageTemplate("File removed")));if("right"===o.state&&i)return this.diffFileTemplate(`<span class="added">Added ${s}</span>`,this.diffTableTemplate(this.diffLineMessageTemplate("File added")));if("distinct"===o.state&&n&&i){const r=this.pathToPosix(e.join(".",o.relativePath,o.name1??"")),a=this.pathToPosix(e.join(".",o.relativePath,o.name2??"")),l=o.name1!==o.name2?`<span class="renamed"\n >Renamed <span class="from">${r}</span> -> <span class="to">${a}</span></span\n >`:s;return this.diffFileTemplate(l,await Q(n)||await Q(i)?this.diffTableTemplate(this.diffLineMessageTemplate("Binary file")):this.getDiffTableHTML(await this.generateAssetFilesDiff(t.readFileSync(n,"utf-8"),t.readFileSync(i,"utf-8"))))}return""}async generateChangelog(){this.logger.info(h.green("Generating changelog"));const o=await this.generateAssetFoldersDiff(),n=(await Promise.all(o.map(e=>this.generateFilesDiff(e)))).join("");this.logger.info(h.green("Writing changelog file"));const i=this.changelogTemplate.split("%FILES%");i.splice(1,0,n);const s=i.join("");t.writeFileSync(e.join(this.destinationPath,this.changelogFilename),s),this.logger.info(h.green(`Changelog file written to ${e.join(this.destinationPath,this.changelogFilename)}`))}}class pe{sourceDir;outputDir;fontName;constructor(e){this.sourceDir=e.sourceDir,this.outputDir=e.outputDir,this.fontName=e.fontName}async generate(){await ne({src:this.sourceDir,dist:this.outputDir,fontName:this.fontName,css:!0,typescript:!0,startUnicode:59905,svgicons2svgfont:{fontHeight:1024}})}}class fe{wss;eventListeners=new Map;lifecycleListeners=new Map;clients=new Map;ws;constructor(){this.wss=new ie({noServer:!0}),this.wss.on("connection",e=>this.onConnection(e)),this.wss.on("error",e=>this.fireLifecycle("error",e)),this.ws={on:(e,t)=>{"close"!==e&&"error"!==e?this.getEventSet(e).add(t):this.getLifecycleSet(e).add(t)},off:(e,t)=>{this.eventListeners.get(e)?.delete(t),"close"!==e&&"error"!==e||this.lifecycleListeners.get(e)?.delete(t)},send:(e,t)=>{if("string"==typeof e)for(const o of this.clients.keys())this.sendToSocket(o,e,t);else{const t=JSON.stringify(e);for(const e of this.clients.keys())e.readyState===se.OPEN&&e.send(t)}}}}handleUpgrade(e,t,o){return(e.url??"").split("?")[0]===g&&(this.wss.handleUpgrade(e,t,o,t=>{this.wss.emit("connection",t,e)}),!0)}async close(){this.fireLifecycle("close");for(const e of this.clients.keys())e.terminate();this.clients.clear(),await new Promise(e=>this.wss.close(()=>e()))}onConnection(e){const t={send:(t,o)=>this.sendToSocket(e,t,o)};this.clients.set(e,t),e.on("message",e=>this.onMessage(t,e)),e.on("close",()=>this.clients.delete(e)),e.on("error",()=>{})}onMessage(e,t){let o;try{o=JSON.parse(t.toString())}catch{return}if(!o||"custom"!==o.type||"string"!=typeof o.event)return;const n=this.eventListeners.get(o.event);if(n)for(const t of n)try{t(o.data,e)}catch(e){u().error(`ws handler for "${o.event}" failed`,{error:e instanceof Error?e:new Error(String(e))})}}sendToSocket(e,t,o){e.readyState===se.OPEN&&e.send(JSON.stringify({type:"custom",event:t,data:o}))}fireLifecycle(e,t){for(const o of this.lifecycleListeners.get(e)??[])try{o(t)}catch{}}getEventSet(e){let t=this.eventListeners.get(e);return t||(t=new Set,this.eventListeners.set(e,t)),t}getLifecycleSet(e){let t=this.lifecycleListeners.get(e);return t||(t=new Set,this.lifecycleListeners.set(e,t)),t}}const ue=s("pp-dev");function he(t,o,n){const s=[...P,"package.json","next.config.js","next.config.mjs","next.config.ts","vite.config.js","vite.config.mjs","vite.config.ts",".env",".env.local",".env.development",".env.development.local"].map(o=>e.join(t,o)),r=i(s,{ignored:t=>{const o=e.basename(t);return/(^|[\/\\])\../.test(t)&&!o.startsWith(".env")&&!o.startsWith(".pp-dev")&&!o.startsWith(".pp-watch")},persistent:!0,ignoreInitial:!0,followSymlinks:!1});let a=null;return r.on("change",i=>{n(h.blue(`🔧 Config file changed: ${e.relative(t,i)}`)),a&&clearTimeout(a),a=setTimeout(async()=>{try{n(h.yellow("🔄 Restarting dev server due to config change...")),await o()}catch(e){n(h.red(`❌ Failed to restart dev server: ${e?.message}. Stack: ${e?.stack}`))}},500)}),r.on("error",e=>{n(h.red(`❌ Config watcher error: ${e}`))}),{watcher:r,restartCallback:o,logger:n}}function ge(e){e.watcher&&e.watcher.close()}function me(e){if(!e||"object"!=typeof e||!("message"in e))return!1;const t=String(e.message);return/Turbopack is not supported/i.test(t)||/native bindings are not available/i.test(t)||/Only WebAssembly \(WASM\) bindings were loaded/i.test(t)}async function be(o){const{changelog:n,executionRoot:i,newAssetsPath:s,backupsDirPath:r,changelogDestinationPath:a,logLevel:l}=o;let c;if("string"==typeof n)c=e.resolve(i,n);else{if(!t.existsSync(r))return void u(l).warn(h.yellow("backups directory not found, skipping changelog generation"));const o=t.readdirSync(r,{withFileTypes:!0});if(!o.length)return void u(l).warn(h.yellow("no backups found, skipping changelog generation"));const n=o.filter(e=>e.isFile()&&e.name.endsWith(".zip"));if(!n.length)return void u(l).warn(h.yellow("no ZIP backups found, skipping changelog generation"));const i=n.reduce((o,n)=>t.statSync(e.resolve(r,o.name)).mtimeMs>t.statSync(e.resolve(r,n.name)).mtimeMs?o:n).name;c=e.resolve(r,i)}const d=new de({oldAssetsPath:c,newAssetsPath:s,destinationPath:a});await d.generateChangelog()}let we=global.__pp_dev_profile_session,ve=0;const ye=o=>{if(we)return new Promise((n,i)=>{we.post("Profiler.stop",(s,{profile:r})=>{if(s)i(s);else{const i=e.resolve(`./pp-dev-profile-${ve++}.cpuprofile`);t.writeFileSync(i,JSON.stringify(r)),o(h.yellow(`CPU profile written to ${h.white(h.dim(i))}`)),we=void 0,n()}})})},Pe=e=>{for(const[t,o]of Object.entries(e))Array.isArray(o)&&(e[t]=o[o.length-1])};function xe(e){const t={...e};return delete t["--"],delete t.c,delete t.config,delete t.base,delete t.l,delete t.logLevel,delete t.clearScreen,delete t.d,delete t.debug,delete t.f,delete t.filter,delete t.m,delete t.mode,t}ue.option("-c, --config <file>","[string] use specified config file").option("--base <path>","[string] public base path (default: /)").option("-l, --logLevel <level>","[string] info | warn | error | silent").option("--clearScreen","[boolean] allow/disable clear screen when logging").option("-d, --debug [feat]","[string | boolean] show debug logs").option("-f, --filter <filter>","[string] filter debug logs").option("-m, --mode <mode>","[string] set env mode"),ue.command("[root]","start dev server").alias("serve").alias("dev").option("--host [host]","[string] specify hostname").option("--port <port>","[number] specify port").option("--https","[boolean] use TLS + HTTP/2").option("--open [path]","[boolean | string] open browser on startup").option("--cors","[boolean] enable CORS").option("--strictPort","[boolean] exit if specified port is already in use").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle").action(async(t,o)=>{Pe(o);let i=null,s=null,l=!1;const c=t?e.resolve(process.cwd(),t):process.cwd(),d=u(o.logLevel),p=async()=>{if(!l){l=!0;try{i&&(d.info(h.yellow("🛑 Stopping existing dev server...")),await i.close(),i=null);const{clearConfigCache:e,getConfig:g}=await import("./index-BtZKQ3Ni.js").then(e=>e.h);e();const{createServer:m}=await import("vite"),b=await r({mode:o.mode||"development",command:"serve"},o.config,t,o.logLevel);let w=await W();const v=f(o.mode||"development",t??process.cwd(),"");if(v&&Object.keys(v).forEach(e=>{e.startsWith("MI_")&&(process.env[e]=v[e])}),b){const{plugins:e,...t}=b.config;w=a(w,t)}if(i=await m(a(w,{root:t,base:o.base,mode:o.mode,configFile:o.config,logLevel:o.logLevel,clearScreen:o.clearScreen,optimizeDeps:{force:o.force},server:xe(o),customLogger:d},!0)),!i.config.base||"/"===i.config.base)throw new Error('base cannot be equal to "/" or empty string');if(!i.httpServer)throw new Error("HTTP server not available");await i.listen();const y=global.__pp_dev_start_time??!1,P=y?h.dim(`ready in ${h.reset(h.bold(Math.ceil(n.now()-y)))} ms`):"";d.info(`\n ${h.green(`${h.bold("PP-DEV")} v${x}`)} ${P}\n`),i.printUrls();const T=await g();if(!1!==T.inspector?.enabled){const e=i.resolvedUrls?.local[0],t=e?new URL(e).origin:`http://localhost:${i.config.server.port??5173}`;d.info(`\n ${h.cyan("🔍 Request Inspector")} ${h.dim(t+S)}\n`)}!function(e,t){if(!e.httpServer||!process.stdin.isTTY||process.env.CI)return;e._shortcutsOptions=t;const o=u();t.print&&o.info(h.dim(h.green(" ➜"))+h.dim(" press ")+h.bold("h")+h.dim(" to show help"));const n=(t.customShortcuts??[]).filter(re).concat(le);ae?.(),ae=null;let i=!1;const s=process.stdin.isPaused(),r=process.stdin,a=Boolean(r.isRaw),l=async t=>{if(""===t)return void process.kill(process.pid,"SIGINT");if(""===t)return void await e.close().finally(()=>process.exit(0));if(i)return;"h"===t&&o.info(["",h.bold(" Shortcuts"),...n.map(e=>h.dim(" press ")+h.bold(e.key)+h.dim(` to ${e.description}`))].join("\n"));const s=n.find(e=>e.key===t);s&&(i=!0,await s.action(e),i=!1)};process.stdin.setRawMode(!0),process.stdin.on("data",l).setEncoding("utf8").resume();const c=e.httpServer,d=()=>{ae===d&&(c.removeListener("close",d),process.stdin.off("data",l),a||process.stdin.setRawMode(!1),s&&process.stdin.pause(),ae=null)};ae=d,c.on("close",d)}(i,{print:!0,customShortcuts:[...we?[{key:"p",description:"start/stop the profiler",async action(e){if(we)await ye(d.info);else{const e=await import("node:inspector").then(e=>e.default);await new Promise(t=>{we=new e.Session,we.connect(),we.post("Profiler.enable",()=>{we?.post("Profiler.start",()=>{d.info("Profiler started"),t()})})})}}}]:[],{key:"l",description:"proxy re-login",action(e){e.ws.send({type:"custom",event:"redirect",data:{url:`/auth/index/logout?proxyRedirect=${encodeURIComponent("/")}`}})}}]}),s||(s=he(c,p,d.info),d.info(h.blue("🔧 Config file watcher started"))),l=!1}catch(e){l=!1,d.error(h.red(`error when starting dev server:\n${e.stack}`),{error:e}),ye(d.info),process.exit(1)}}},g=async e=>{d.info(h.yellow(`\n🛑 Received ${e}, shutting down gracefully...`));try{s&&(ge(s),s=null),i&&(await i.close(),i=null),ye(d.info),d.info(h.green("✅ Graceful shutdown completed")),process.exit(0)}catch(e){d.error(h.red(`❌ Error during graceful shutdown: ${e}`)),process.exit(1)}};process.on("SIGINT",()=>g("SIGINT")),process.on("SIGTERM",()=>g("SIGTERM")),process.on("uncaughtException",e=>{d.error(h.red(`❌ Uncaught Exception: ${e}`)),g("uncaughtException")}),process.on("unhandledRejection",(e,t)=>{d.error(h.red(`❌ Unhandled Rejection at: ${t}, reason: ${e}`)),g("unhandledRejection")}),await p()}),ue.command("next [root]","start Next.js development server with pp-dev integration").alias("next-serve").alias("next-dev").option("--host [host]","[string] specify hostname").option("--port <port>","[number] specify port",{default:3e3}).option("--https","[boolean] use TLS + HTTP/2").option("--open [path]","[boolean | string] open browser on startup").option("--cors","[boolean] enable CORS").option("--strictPort","[boolean] exit if specified port is already in use").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle").option("--webpack","[boolean] use Webpack for Next dev (use when Turbopack/native SWC is unavailable)").option("--turbopack","[boolean] use Turbopack for Next dev when native bindings work").action(async(n,i)=>{Pe(i);let s=null,r=null,a=null,l=null,c=!1;const d=u(),p=async()=>{if(!c){c=!0;try{const{next:g,constants:w}=await Z(),{PHASE_DEVELOPMENT_SERVER:v}=w;a&&(await a.close(),a=null),r&&(d.info(h.yellow("🛑 Stopping existing Next.js server...")),await new Promise(e=>{r.close(()=>{r=null,e()})})),s&&"function"==typeof s.close&&(await s.close(),s=null);const{clearConfigCache:y}=await import("./index-BtZKQ3Ni.js").then(e=>e.h);y();const{join:P,basename:x}=await import("path"),{createServer:V}=await import("http"),W=await import("next/dist/server/config.js"),G=W.default.default||W["module.exports"].default||W.default,B=xe(i),X=f(i.mode||"development",n??process.cwd(),"");X&&Object.keys(X).forEach(e=>{e.startsWith("MI_")&&(process.env[e]=X[e])});const Y=n?P(process.cwd(),n):process.cwd();d.info(Y);const Q=await G(v,Y);let ee=Q?.ppDev||{};if(0===Object.keys(ee).length)try{const{getConfig:e}=await import("./index-BtZKQ3Ni.js").then(e=>e.h),t=await e();Object.keys(t).length>0?(ee=t,d.info(h.blue("🔧 Loaded pp-dev config from standalone config file"))):d.info(h.yellow("⚠️ No pp-dev config found in Next.js config or standalone file, using defaults"))}catch(e){d.info(h.yellow("⚠️ Failed to load standalone pp-dev config, using defaults")),console.debug("Error loading standalone config:",e)}else d.info(h.blue("🔧 Loaded pp-dev config from Next.js config"));let te=null;try{const{getPkg:e}=await import("./index-BtZKQ3Ni.js").then(e=>e.h);te=e().name}catch{te=x(Y)}T(ee,te??"");const oe=b(ee,te??""),ne=oe.backendBaseURL??"http://localhost:8080",ie=oe.templateLess,se=oe.v7Features,re=oe.disableSSLValidation,ae=oe.enableProxyCache,le=oe.proxyCacheTTL,ce=oe.personalAccessToken,de=oe.miHudLess,pe=oe.inspectorEnabled,ue=oe.inspectorMaxMemory,be=oe.inspectorCaptureLimit,we=oe.appId??(process.env.MI_APP_ID&&parseInt(process.env.MI_APP_ID,10)||void 0)??(process.env.MI_PORTAL_PAGE_ID&&parseInt(process.env.MI_PORTAL_PAGE_ID,10)||void 0)??1,ve=Q?.basePath;let ye="";ve?ye=ve:(ye=ie?E:se?k:L,ye+=`/${te}`);const Pe=function(e){const t="1"===process.env.PP_DEV_NEXT_WEBPACK||"true"===process.env.PP_DEV_NEXT_WEBPACK;if(t&&(e.webpack||e.turbopack))throw new Error("Do not combine PP_DEV_NEXT_WEBPACK with --webpack or --turbopack");if(t)return{webpack:!0};if(e.webpack&&e.turbopack)throw new Error("Use only one of --webpack or --turbopack");return e.webpack?{webpack:!0}:e.turbopack?{turbopack:!0}:{}}(i),Se=async e=>{delete process.env.TURBOPACK,s&&"function"==typeof s.close&&(await s.close(),s=null);const t={dev:!0,customServer:!0,hostname:B.host||"localhost",port:B.port,dir:Y,conf:{...Q,basePath:ye,assetPrefix:ye}};e.webpack?t.webpack=!0:e.turbopack&&(t.turbopack=!0),s=g(t),await s.prepare()};if(Pe.webpack)await Se({webpack:!0});else if(Pe.turbopack)try{await Se({turbopack:!0})}catch(e){if(!me(e))throw e;d.warn(h.yellow("⚠ Turbopack is unavailable (native bindings). Falling back to Webpack.")),await Se({webpack:!0})}else try{await Se({})}catch(e){if(!me(e))throw e;d.warn(h.yellow("⚠ Turbopack cannot run (native Next.js bindings unavailable). Falling back to Webpack.")),await Se({webpack:!0})}if(!s)throw new Error("Next.js app failed to initialize");if(ye.endsWith("/")||(ye+="/"),"/"===ye)throw new Error('basePath cannot be equal to "/" or equal to empty string');d.info(h.green("✅ Next.js app prepared successfully")),d.info(h.blue(`🔧 pp-dev plugin configured for template: ${te}`)),d.info(h.blue(`🔧 Base path configured: ${ye}`)),ne&&(d.info(h.blue(`🌐 Backend URL: ${ne}`)),d.info(h.blue(`🆔 Custom App ID: ${we}`)));const Te=s.getRequestHandler(),Ee="number"==typeof B.port?B.port:3e3,ke="string"==typeof B.host?B.host||"0.0.0.0":"localhost",Le=new Set;r=V(async(e,t)=>{try{const o=e.url||"/",n=o.split("?")[0];let i=K(o,!0);if(je.length>0){if(n.startsWith("/_next/")||"/favicon.ico"===n||n.startsWith("/__nextjs_")){if(Ie.length>0){let l=0;const c=()=>{if(l>=Ie.length)return void s();const o=Ie[l];l++,o(e,t,c)};return void c()}return void s()}let r=0;const a=()=>{if(r>=je.length)return void s();const o=je[r];r++,o(e,t,a)};return void a()}async function s(){if(n.startsWith(ye))i=K(o,!0);else{if(n===ye.replace(/\/$/,"")){const e=o.replace(n,ye);return t.writeHead(302,{Location:e}),void t.end()}if(n.startsWith("/_next/")||"/favicon.ico"===n||n.startsWith("/__nextjs_"));else if("/"===n)return t.writeHead(302,{Location:ye}),void t.end()}await Te(e,t,i)}s()}catch(p){d.error(`Error handling request: ${p instanceof Error?p.message:String(p)}`,{error:p instanceof Error?p:void 0}),t.statusCode=500,t.end("Internal Server Error")}});let $e=null,je=[],Ie=[];if(!1!==pe){const e=new $(ue);j(I,e,be);const t=D(e,be);je.push(t)}if(ne){const n=new URL(ne).host;ne.startsWith("https://")&&(o.defaultMaxListeners=Math.max(o.defaultMaxListeners,20));const i={headers:{host:n,referer:ne,origin:ne.replace(/^(https?:\/\/)([^/]+)(\/.*)?$/i,"$1$2")},appId:we,templateLess:ie,disableSSLValidation:re,v7Features:se,personalAccessToken:ce??process.env.MI_ACCESS_TOKEN};$e=new F(ne,i);const l=_(ye,te??void 0),c=(e,t,o)=>{l(e,t,o)};Ie.push(c),je.push(c);const p=q(ye);if(Ie.push(p),je.push(p),ae){let e=+le;(!e||Number.isNaN(e)||e<0)&&(e=6e5);const t={middlewares:{use:e=>e},config:{logger:console}},o=N({devServer:t,ttl:e}),n=(e,t,n)=>{o(e,t,n)};je.push(n),d.info(h.blue(`🔧 Proxy cache middleware added with TTL: ${e}ms`))}const f=new RegExp(`^((${u=ye,u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})|/)$`),g=A(f,$e,Object.assign({base:ye},i,{miHudLess:de})),b=(e,t,o)=>{g(e,t,o)};je.push(b);const v=ye.endsWith("/")?ye.substring(0,ye.length-1):ye,y={middlewares:{use:e=>e},config:{logger:console}},P=C({devServer:y,baseURL:ne,proxyIgnore:["/@vite","/@metricinsights","/@",v,"/_next","/favicon.ico","/__nextjs_","/installHook.js.map"],disableSSLValidation:re,miAPI:$e,templateName:te??void 0}),T=(e,t,o)=>{P(e,t,o)};je.push(T);const E=I,k=(e,t,o)=>{if(e.url?.startsWith("/@api/")||e.url?.startsWith(S)||e.url?.startsWith(R)){return void E(e,t,()=>{})}o()};Ie.push(k),je.push(k);const L=M(e=>{const t=e.split("?")[0];return t.startsWith(ye)&&!t.includes("/_next/")},(e,t)=>{const o=$e.buildPage(e,de),i=J(o,ye,{backendBaseURL:ne,templateLess:ie,appId:we,devPanelPosition:oe.devPanelPosition,devPanelHidden:oe.devPanelHidden,devPanelAutoHide:oe.devPanelAutoHide});return Buffer.from(O(n,t.headers.host??"",i))}),$=(e,t,o)=>{L(e,t,o)};je.push($),a=new fe;let j=Q?.distDir;try{process.env[m]="1";const e=await G(w.PHASE_PRODUCTION_BUILD,Y);j=e?.distDir??j}catch{}const D=(j??"").replace(/\\/g,"/").replace(/\/+$/,"").replace(/\/dev$/,""),V=D&&".next"!==D?D:"out";let W,Z="0.0.0";try{const o=JSON.parse(t.readFileSync(e.join(Y,"package.json"),"utf-8"));Z="string"==typeof o.version?o.version:Z,W="string"==typeof o.repository?o.repository:o.repository?.url}catch{}const B=!1!==oe.distZip?new z(te??x(Y),{nextBuild:{projectRoot:Y,distDir:V,packageVersion:Z,packageRepositoryUrl:W}}):void 0,K={ws:a.ws,config:{clientInjectionPlugin:{v7Features:se}}};new H(K,{distService:B,miAPI:$e}),U(I,{distService:B,miAPI:$e});const X="function"==typeof s?.getUpgradeHandler?s.getUpgradeHandler():null;r.on("upgrade",(e,t,o)=>{a?.handleUpgrade(e,t,o)||(X?X(e,t,o):t.destroy())}),d.info(h.blue(`🔧 ${je.length} pp-dev middlewares initialized`)),d.info(h.blue(`🔧 ${Ie.length} essential middlewares for internal routes`)),d.info(h.blue(`🔧 MiAPI initialized for backend: ${ne}`)),d.info(h.blue(`🔧 Custom App ID: ${we}`))}r.listen(Ee,ke,()=>{d.info(h.green(`✅ pp-dev Next.js server running at http://${ke}:${Ee}`)),d.info(h.blue(`📱 Next.js app accessible at http://${ke}:${Ee}${ye}`)),!1!==pe&&d.info(h.cyan(`🔍 Request Inspector: http://${ke}:${Ee}${S}`)),d.info(h.blue("🔧 Base path handling active")),l||(l=he(Y,p,d.info),d.info(h.blue("🔧 Config file watcher started"))),r.on("connection",e=>{Le.add(e),e.on("close",()=>Le.delete(e))});const e=async e=>{d.info(h.yellow(`\n🛑 Received ${e}, shutting down gracefully...`));const t=setTimeout(()=>{d.info(h.yellow("⏰ Shutdown timeout reached, forcing exit")),process.exit(0)},5e3);try{l&&(ge(l),l=null);for(const e of Array.from(Le))e.destroy();Le.clear(),a&&(await a.close(),a=null),await new Promise(e=>{r.close(()=>{d.info(h.yellow("🛑 HTTP server closed")),e()})}),s&&"function"==typeof s.close&&(await s.close(),d.info(h.yellow("🛑 Next.js app closed"))),clearTimeout(t),d.info(h.green("✅ Graceful shutdown completed")),process.exit(0)}catch(e){clearTimeout(t),d.error(h.red(`❌ Error during graceful shutdown: ${e}`)),process.exit(1)}};let t=process;if("function"!=typeof process.on){const e=globalThis.process||global.process;e&&"function"==typeof e.on&&(t=e,d.info(h.green("✅ Using global process object for event handlers")))}if("function"==typeof t.on)try{t.on("SIGINT",()=>e("SIGINT")),t.on("SIGTERM",()=>e("SIGTERM")),t.on("uncaughtException",t=>{d.error(h.red(`❌ Uncaught Exception: ${t}`)),e("uncaughtException")}),t.on("unhandledRejection",(t,o)=>{d.error(h.red(`❌ Unhandled Rejection at: ${o}, reason: ${t}`)),e("unhandledRejection")}),d.info(h.green("✅ Process event handlers registered successfully"))}catch(e){d.warn(h.yellow(`⚠️ Failed to register process event handlers: ${e}`))}else d.warn(h.yellow("⚠️ process.on is not available, graceful shutdown handlers will not be registered")),d.info(h.blue("💡 This might be due to bundling or environment constraints"))}),c=!1}catch(e){c=!1,d.error(h.red(`❌ Failed to start Next.js server: ${e?.message}. Stack: ${e?.stack}`)),e instanceof Error&&e.message.includes("Next.js is required")&&(d.error(h.red("❌ Next.js Peer Dependency Error:")),d.error(h.red(e.message)),d.error(h.yellow("\n💡 To fix this issue:")),d.error(h.blue(" 1. Install Next.js in your project:")),d.error(h.white(" npm install next@^16")),d.error(h.blue(" 2. Or use yarn:")),d.error(h.white(" yarn add next@^16")),d.error(h.blue(" 3. Or use pnpm:")),d.error(h.white(" pnpm add next@^16")),d.error(h.yellow("\n📖 For more information, see:")),d.error(h.blue(" https://nextjs.org/docs/getting-started"))),process.exit(1)}var u}},g=async e=>{d.info(h.yellow(`\n🛑 Received ${e}, shutting down gracefully...`));try{l&&(ge(l),l=null),a&&(await a.close(),a=null),r&&await new Promise(e=>{r.close(()=>{r=null,e()})}),s&&"function"==typeof s.close&&(await s.close(),s=null),d.info(h.green("✅ Graceful shutdown completed")),process.exit(0)}catch(e){d.error(h.red(`❌ Error during graceful shutdown: ${e}`)),process.exit(1)}};process.on("SIGINT",()=>g("SIGINT")),process.on("SIGTERM",()=>g("SIGTERM")),process.on("uncaughtException",e=>{d.error(h.red(`❌ Uncaught Exception: ${e}`)),g("uncaughtException")}),process.on("unhandledRejection",(e,t)=>{d.error(h.red(`❌ Unhandled Rejection at: ${t}, reason: ${e}`)),g("unhandledRejection")}),await p()}),ue.command("build [root]","build for production").option("--target <target>","[string] transpile target (default: 'modules')").option("--outDir <dir>","[string] output directory (default: dist)").option("--assetsDir <dir>","[string] directory under outDir to place assets in (default: assets)").option("--assetsInlineLimit <number>","[number] static asset base64 inline threshold in bytes (default: 4096)").option("--ssr [entry]","[string] build specified entry for server-side rendering").option("--sourcemap [output]",'[boolean | "inline" | "hidden"] output source maps for build (default: false)').option("--minify [minifier]",'[boolean | "terser" | "esbuild"] enable/disable minification, or specify minifier to use (default: esbuild)').option("--manifest [name]","[boolean | string] emit build manifest json").option("--ssrManifest [name]","[boolean | string] emit ssr manifest json").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle (experimental)").option("--emptyOutDir","[boolean] force empty outDir when it's outside of root").option("-w, --watch","[boolean] rebuilds when modules have changed on disk").option("--changelog [assetsFile]","[boolean | string] generate changelog between assetsFile and current build (default: false)").option("--distZip","[boolean] pack build output into a ZIP archive; use --no-distZip to disable (default: pp-dev config build.zip, or true). Env: PP_DEV_DIST_ZIP").option("--distZipDir <dir>","[string] override the ZIP output directory (default: 'dist-zip'). Env: PP_DEV_DIST_ZIP_DIR").option("--distZipFilename <filename>","[string] override the ZIP output file name (default: '<app-name>.zip'). Env: PP_DEV_DIST_ZIP_FILENAME").option("--versionManifest","[boolean] emit VERSION-*.json + BUILD-MANIFEST.json; use --no-versionManifest to disable (default: pp-dev config build.versionFile, or true). Env: PP_DEV_VERSION_MANIFEST").option("--versionFileTemplate <template>","[string] override the VERSION file name template (default: 'VERSION-v{packageversion}-{currentDate}.json'). Env: PP_DEV_VERSION_FILE_TEMPLATE").action(async(t,o)=>{Pe(o);const n=xe(o),i=V(o);try{const s=await r({mode:o.mode||"production",command:"build"},o.config,t,o.logLevel);let c=await W(i);if(s){const{plugins:e,...t}=s.config;c=a(c,t)}const d=a(c,{root:t,base:o.base,mode:o.mode,configFile:o.config,logLevel:o.logLevel,clearScreen:o.clearScreen,optimizeDeps:{force:o.force},build:n},!0);if(await l(d),n.changelog){const i=t||process.cwd(),s=d.build?.outDir||"dist";let r="dist-zip";d.ppDevConfig&&(!1===d.ppDevConfig.distZip?r=s:"object"==typeof d.ppDevConfig.distZip&&"string"==typeof d.ppDevConfig.distZip.outDir&&(r=d.ppDevConfig.distZip.outDir)),await be({changelog:n.changelog,executionRoot:i,newAssetsPath:e.resolve(i,s),backupsDirPath:e.resolve(i,d.ppDevConfig?.syncBackupsDir||"backups"),changelogDestinationPath:e.resolve(i,r),logLevel:o.logLevel})}}catch(e){u(o.logLevel).error(h.red(`error during build:\n${e.stack}`),{error:e}),process.exit(1)}finally{ye(e=>u(o.logLevel).info(e))}}),ue.command("next-build [root]","build a Next.js app for production (`next build`) and emit VERSION/BUILD-MANIFEST/zip in the same format as `pp-dev build`").option("--changelog [assetsFile]","[boolean | string] generate changelog between assetsFile and current build (default: false)").option("--distZip","[boolean] pack build output into a ZIP archive; use --no-distZip to disable (default: pp-dev config build.zip, or true). Env: PP_DEV_DIST_ZIP").option("--distZipDir <dir>","[string] override the ZIP output directory (default: 'dist-zip'). Env: PP_DEV_DIST_ZIP_DIR").option("--distZipFilename <filename>","[string] override the ZIP output file name (default: '<app-name>.zip'). Env: PP_DEV_DIST_ZIP_FILENAME").option("--versionManifest","[boolean] emit VERSION-*.json + BUILD-MANIFEST.json; use --no-versionManifest to disable (default: pp-dev config build.versionFile, or true). Env: PP_DEV_VERSION_MANIFEST").option("--versionFileTemplate <template>","[string] override the VERSION file name template (default: 'VERSION-v{packageversion}-{currentDate}.json'). Env: PP_DEV_VERSION_FILE_TEMPLATE").action(async(o,n)=>{Pe(n);const i=u(n.logLevel),s=o?e.resolve(process.cwd(),o):process.cwd(),r=V(n);process.env[m]="1";try{const{constants:o}=await Z(),a=await import("next/dist/server/config.js"),l=a.default.default||a["module.exports"].default||a.default,c=await l(o.PHASE_PRODUCTION_BUILD,s);let d,p=c?.ppDev||{};if(0===Object.keys(p).length){const{getConfig:e}=await import("./index-BtZKQ3Ni.js").then(e=>e.h);p=await e()}try{const{getPkg:e}=await import("./index-BtZKQ3Ni.js").then(e=>e.h);d=e().name}catch{d=e.basename(s)}const f=b(p,d),u=G(f.distZip,r,`${d}.zip`),g=B(f.versionPlugin,r);i.info(h.cyan("[pp-dev] Running `next build`...")),await w(s);const m="string"==typeof c?.distDir&&c.distDir?c.distDir:".next",P=".next"===m?"out":m,x=e.resolve(s,P);if(!t.existsSync(x)||!t.statSync(x).isDirectory())throw new Error(`Next.js build output directory not found: ${x}. "next-build" requires "output: 'export'" in next.config (static export).`);const S=JSON.parse(t.readFileSync(e.join(s,"package.json"),"utf-8"));if(!1!==g&&!1!==g.enabled&&(v({outDir:x,packageVersion:"string"==typeof S.version?S.version:"0.0.0",versionFileTemplate:g.versionFileTemplate,packageRepositoryUrl:"string"==typeof S.repository?S.repository:S.repository?.url,enabled:g.enabled}),i.info(h.green(`✅ VERSION / BUILD-MANIFEST written to ${e.relative(s,x)}`))),!1!==u){const o=e.resolve(s,u.outDir),n=u.inDir?e.resolve(x,u.inDir):x,r=e.join(o,u.outFileName);t.mkdirSync(o,{recursive:!0});const a=await y(n);t.writeFileSync(r,a),i.info(h.green(`✅ Zip archive written to ${e.relative(s,r)}`))}if(n.changelog){const t=!1!==u?u.outDir:P;await be({changelog:n.changelog,executionRoot:s,newAssetsPath:x,backupsDirPath:e.resolve(s,f.syncBackupsDir),changelogDestinationPath:e.resolve(s,t),logLevel:n.logLevel})}}catch(e){u(n.logLevel).error(h.red(`error during next-build:\n${e.stack}`),{error:e}),process.exit(1)}finally{ye(e=>u(n.logLevel).info(e))}}),ue.command("changelog [oldAssetPath] [newAssetPath]","generate changelog between two assets files/folders").option("--oldAssetsPath <oldAssetsPath>","[string] path to the old assets zip file or folder").option("--newAssetsPath <newAssetsPath>","[string] path to the new assets zip file or folder").option("--destination <destination>","[string] destination folder for the changelog (default: .)").option("--filename <filename>","[string] filename for the changelog (default: CHANGELOG.html)").action(async(t,o,n)=>{Pe(n);const{oldAssetsPath:i=t,newAssetsPath:s=o,destination:r=".",filename:a="CHANGELOG.html",logLevel:l}=n,c=process.cwd();i&&s||(u(l).error(h.red("error during changelog generation: oldAssetPath and newAssetPath are required")),process.exit(1));const d=e.resolve(c,i),p=e.resolve(c,s),f=e.resolve(c,r),g=new de({oldAssetsPath:d,newAssetsPath:p,destinationPath:f,changelogFilename:a});await g.generateChangelog()}),ue.command("generate-icon-font [source] [destination]","generate icon font from SVG files").option("--source <source>","[string] path to the source directory with SVG files").option("--destination <destination>","[string] path to the destination directory to save the generated font files").option("--font-name, -n <fontName>","[string] name of the font to generate (default: 'icon-font')").action(async(t,o,n)=>{Pe(n);const{source:i=t,destination:s=o,fontName:r="icon-font"}=n,a=process.cwd(),l=e.resolve(a,i),c=e.resolve(a,s),d=new pe({sourceDir:l,outputDir:c,fontName:r}),p=u(n.logLevel);p.info(`Generating icon font from SVG files in ${h.dim(l)}`),await d.generate(),p.info(`Icon font generated and saved to ${h.dim(c)}`)}),ue.command("optimize [root]","pre-bundle dependencies").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle").action(async(e,t)=>{Pe(t);try{const o=await r({mode:t.mode||"production",command:"build"},t.config,e,t.logLevel);let n=await W();if(o){const{plugins:e,...t}=o.config;n=a(n,t)}const i=await c(a(n,{root:e,base:t.base,configFile:t.config,logLevel:t.logLevel,mode:t.mode}),"serve");await d(i,t.force,!0)}catch(e){u(t.logLevel).error(h.red(`error when optimizing deps:\n${e.stack}`),{error:e}),process.exit(1)}}),ue.command("preview [root]","locally preview production build").option("--host [host]","[string] specify hostname").option("--port <port>","[number] specify port").option("--strictPort","[boolean] exit if specified port is already in use").option("--https","[boolean] use TLS + HTTP/2").option("--open [path]","[boolean | string] open browser on startup").option("--outDir <dir>","[string] output directory (default: dist)").action(async(e,t)=>{Pe(t);try{const o=await r({mode:t.mode||"production",command:"build"},t.config,e,t.logLevel);let n=await W();if(o){const{plugins:e,...t}=o.config;n=a(n,t)}(await p(a(n,{root:e,base:t.base,configFile:t.config,logLevel:t.logLevel,mode:t.mode,build:{outDir:t.outDir},preview:{port:t.port,strictPort:t.strictPort,host:t.host,https:t.https,open:t.open}}))).printUrls()}catch(e){u(t.logLevel).error(h.red(`error when starting preview server:\n${e.stack}`),{error:e}),process.exit(1)}finally{ye(e=>u(t.logLevel).info(e))}}),ue.command("migrate [config]","migrate pp-dev config from 0.x flat format to 1.0 grouped format").option("--dry-run","[boolean] print migrated config without writing any files").option("--format <format>","[string] output format: ts (default), js, json").option("--output <file>","[string] output file path (default: pp-dev.config.ts)").option("--no-backup","[boolean] skip backup of original config file").action(async(o,n)=>{const i=u(n.logLevel),{isLegacyFlatConfig:s,isLegacyPPWatchConfig:r,isAlreadyMigrated:a,migrateLegacyFlatConfig:l,migratePPWatchConfig:c,generateConfigFileContent:d}=await import("./migrate-BYuCtRbI.js"),p=n.format??"ts",f=!1!==n.backup,g=process.cwd(),m=[".pp-watch.config.ts",".pp-watch.config.js",".pp-watch.config.json","pp-watch.config.ts","pp-watch.config.js","pp-watch.config.json"];let b=o??null,w=!1;if(!b){for(const o of P)if(t.existsSync(e.join(g,o))){b=e.join(g,o);break}if(!b)for(const o of m)if(t.existsSync(e.join(g,o))){b=e.join(g,o),w=!0;break}}b||(i.warn(h.yellow("No pp-dev or pp-watch config file found in the current directory.")),i.info(h.blue("Supported files: pp-dev.config.{ts,js,cjs,mjs,json}, .pp-watch.config.{ts,js,json}")),process.exit(1)),i.info(h.blue(`Found config: ${e.relative(g,b)}`));const{getPkg:v}=await import("./index-BtZKQ3Ni.js").then(e=>e.h),y=v();let x,S={};try{if(/\.[cm]?ts$/i.test(b)){const o=await import("esbuild"),{pathToFileURL:n}=await import("url"),i=(await o.build({absWorkingDir:g,entryPoints:[b],outfile:"out.js",write:!1,target:"node24",platform:"node",bundle:!0,packages:"external",format:"esm",mainFields:["main"]})).outputFiles[0].text,s=`pp-migrate-tmp-${Date.now()}.mjs`;t.writeFileSync(s,i);try{const t=await import(n(e.resolve(g,s)).toString());S=t.default?.default??t.default??t}finally{t.existsSync(s)&&t.unlinkSync(s)}}else if(/\.[cm]?js$/i.test(b)){const{pathToFileURL:t}=await import("url"),o=await import(t(e.resolve(g,b)).toString());S=o.default?.default??o.default??o}else b.endsWith(".json")&&(S=JSON.parse(t.readFileSync(b,"utf-8")))}catch(e){i.error(h.red(`Failed to load config file: ${e.message}`)),process.exit(1)}S&&"object"==typeof S||(i.error(h.red("Config file did not export a valid object.")),process.exit(1)),a(S)?(i.info(h.green("Config is already in 1.0 format — nothing to migrate.")),process.exit(0)):w||r(S)?(i.info(h.blue("Detected pp-watch config format → migrating to 1.0")),x=c(S)):s(S)?(i.info(h.blue("Detected 0.x flat config format → migrating to 1.0")),x=l(S,y.name)):(i.warn(h.yellow("Could not detect config format. No known keys found.")),process.exit(1));const T=d(x,p),E=n.output??e.join(g,`pp-dev.config.${p}`);if(n.dryRun&&(i.info(h.green(`\n--- Migrated config (dry-run) → ${e.relative(g,E)} ---\n`)),process.exit(0)),f&&t.existsSync(b)){const o=`${b}.bak`;t.copyFileSync(b,o),i.info(h.blue(`Backed up original to: ${e.relative(g,o)}`))}t.writeFileSync(E,T,"utf-8"),i.info(h.green(`✅ Migration complete → ${e.relative(g,E)}`)),b!==E&&t.existsSync(b)&&i.info(h.yellow(`You can now delete the old config: ${e.relative(g,b)}`))}),ue.help(),ue.version(x),ue.parse();export{ye as stopProfiler};
|
|
2
2
|
//# sourceMappingURL=cli.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{execSync as e}from"child_process";import{t,x as n,V as i,y as s,d as r,v as o,n as a,e as c,g as p,b as l,c as u,a as d,f as m}from"./plugin-C-TsWzim.js";import*as f from"fs";import{readdirSync as g,readFileSync as v,writeFileSync as h,existsSync as y,unlink as P}from"fs";import*as j from"path";import b from"path";import{fileURLToPath as E,pathToFileURL as _}from"url";import"./helpers.js";import{normalizePath as $}from"vite";import w from"ejs";const I=j.dirname(n),D=j.join(I,"index.html");let T=null;function R(e){return{css:j.posix.join(e,t,"client/client.css"),js:j.posix.join(e,t,"client/client.js")}}function S(e){return function(){if(T)return T;const e=f.readFileSync(D,{encoding:"utf8"});return T=w.compile(e,{openDelimiter:"{",closeDelimiter:"}",async:!1,rmWhitespace:!0,compileDebug:!1}),T}()({PACKAGE_NAME:t,VERSION:i,backendBaseURL:e.backendBaseURL,templateLess:e.templateLess,appId:e.appId,canSync:e.canSync??!0,devPanelPosition:e.devPanelPosition??"bottom-right",devPanelHidden:e.devPanelHidden??!1,devPanelAutoHide:e.devPanelAutoHide??!1})}function O(e,t,n){if(!/<\/?(html|body|head)\b/i.test(e))return e;const{css:i,js:s}=R(t),r=`<link rel="stylesheet" href="${i}">`,o=`${S(n)}${`<script type="module" src="${s}"><\/script>`}`;let a=e,c=!1;if(/<\/head>/i.test(a)&&(a=a.replace(/<\/head>/i,`${r}</head>`),c=!0),/<body[^>]*>/i.test(a)){const e=c?"":r;a=a.replace(/(<body[^>]*>)/i,`$1${e}${o}`)}else a=`${c?"":r}${a}${o}`;return a}const x={".js":"text/javascript; charset=utf-8",".css":"text/css; charset=utf-8",".map":"application/json; charset=utf-8"};function L(e){const n=j.posix.join(e,t,"client")+"/",i=new Set(["client.js","client.css","client.js.map","client.css.map"]);return(e,t,s)=>{const r=(e.url??"").split("?")[0];if(!r.startsWith(n))return void s();const o=r.slice(n.length);if(!i.has(o))return void s();const a=j.join(I,o);f.readFile(a,(e,n)=>{e?s():(t.statusCode=200,t.setHeader("Content-Type",x[j.extname(o)]??"application/octet-stream"),t.setHeader("Cache-Control","no-cache"),t.end(n))})}}let F;try{F="undefined"!=typeof __filename&&__filename?j.resolve(j.dirname(__filename),".."):void 0!==import.meta&&import.meta&&import.meta.url?j.resolve(E(new URL(".",import.meta.url)),".."):process.cwd()}catch{F=process.cwd()}const N=$(j.join(s,"dist/client")),A=new RegExp(`^\\/?${t}\\/client\\/(.*)$`);let C=null,U=null;function Z(e){return{name:"pp-dev:client",apply:"serve",config:e=>(e.optimizeDeps?.exclude?.push(`${t}/client`),e),resolveId(e){const t=e.match(A);if(t){const e=$(j.join(N,t[1]));return e.startsWith(`${N}/`)?{id:e}:null}},transformIndexHtml:async(e,n)=>{const s=n.server?.config.base||"",r=function(){if(U)return U;const e=j.resolve(F,"client","index.html");return C||(C=f.readFileSync(e,{encoding:"utf8"})),U=w.compile(C,{openDelimiter:"{",closeDelimiter:"}",async:!0,cache:!0,filename:e,rmWhitespace:!0,compileDebug:!1}),U}(),o=R(s),a={html:e,tags:[{tag:"link",injectTo:"head",attrs:{rel:"stylesheet",href:o.css}}]},{backendBaseURL:c,templateLess:p=!1,appId:l,canSync:u=!0,devPanelPosition:d="bottom-right",devPanelHidden:m=!1,devPanelAutoHide:g=!1}=n.server?.config.clientInjectionPlugin||{},v={PACKAGE_NAME:t,VERSION:i,backendBaseURL:c,templateLess:p,appId:l,canSync:u,devPanelPosition:d,devPanelHidden:m,devPanelAutoHide:g};return a.tags.push({tag:"div",injectTo:"body-prepend",children:await r(v)}),a.tags.push({tag:"script",injectTo:"body-prepend",attrs:{src:o.js,type:"module"}}),a},configureServer(e){const t=$(j.resolve(e.config.root,j.dirname(n)));e.config.server?.fs?.allow&&e.config.server.fs.allow.push(t)}}}const H=(e,t)=>` * ${t}`;function V(e){return`/*!\n${"***** DO NOT EDIT THIS CODE! *****\n***** ------- *****".replace(/^(.*)$/gm,H)}\n */`}async function k(){try{const[e,t]=await Promise.all([import("next"),import("next/constants.js")]);return{next:e.default,constants:t}}catch(e){throw new Error(`Next.js is required but not available. Please install Next.js as a dependency:\nnpm install next@^15\n\nThis package requires Next.js >=15 <17 as a peer dependency.\n\nError: ${e}`)}}async function B(){try{return await import("next"),!0}catch{return!1}}async function M(){try{return(await import("next/package.json")).version}catch{return null}}const z=new Map,G=3e4;let W=null;function K(){const e=Date.now();if(W&&e-W.timestamp<6e4)return W.data;const t=process.cwd();try{const n=JSON.parse(v(b.resolve(t,"package.json"),{encoding:"utf-8",flag:"r"}));return W={data:n,timestamp:e},n}catch{const t={};return W={data:t,timestamp:e},t}}let J=null;async function Y(e){const t=process.cwd(),n=`ts:${e}`,i=z.get(n);if(i&&Date.now()-i.timestamp<G)return i.data;let s=!1;if(/\.m[jt]s$/.test(e))s=!0;else if(/\.c[jt]s$/.test(e))s=!1;else{const e=K();s=!!e&&"module"===e.type}const r=await async function(){return J||(J=await import("esbuild")),J}(),o=await r.build({absWorkingDir:t,entryPoints:[e],outfile:"out.js",write:!1,target:"node24",platform:"node",bundle:!0,packages:"external",format:s?"esm":"cjs",mainFields:["main"],sourcemap:"inline",metafile:!0}),{text:a}=o.outputFiles[0],c=`${`pp-config.timestamp-${Date.now()}-${Math.random().toString(16).slice(2)}`}.js`,p=_(b.resolve(t,c)).toString();h(c,a);let l={};try{const t=(await import(p)).default;l=t?.default||t,z.set(n,{data:l,timestamp:Date.now(),filePath:e})}finally{y(c)&&P(c,()=>{})}return l}async function q(e){const t=`js:${e}`,n=z.get(t);if(n&&Date.now()-n.timestamp<G)return n.data;const i=(await import(_(e).toString())).default;return z.set(t,{data:i,timestamp:Date.now(),filePath:e}),i}async function Q(e){const t=`json:${e}`,n=z.get(t);if(n&&Date.now()-n.timestamp<G)return n.data;const i=JSON.parse(v(e,{encoding:"utf-8"}));return z.set(t,{data:i,timestamp:Date.now(),filePath:e}),i}let X=null;function ee(){return K()}async function te(){const e=function(){const e=Date.now();if(X&&e-X.timestamp<1e4)return X.files;const t=/\.config\.(([cm]?ts)|([cm]?js)|(json))$/,n=process.cwd(),i=g(n,{withFileTypes:!0}).filter(e=>e.isFile()&&t.test(e.name)).map(e=>e.name);return X={files:i,timestamp:e},i}();let t={},n=!1;const i=await async function(e,t){for(const n of t)if(e.includes(n)){if(/\.[cm]?ts$/i.test(n))return await Y(n);if(/\.[cm]?js$/i.test(n))return await q(b.resolve(".",n));if(n.endsWith(".json"))return await Q(b.resolve(".",n))}return null}(e,r);i&&(t=i,n=!0);const s=K()["pp-dev"];return n||!s||"object"!=typeof s||Array.isArray(s)||(t=s),t}const ne=Object.freeze({__proto__:null,clearConfigCache:function(){z.clear(),W=null,X=null},getConfig:te,getPkg:ee});function ie(e){if(void 0!==e)return"1"===e||"true"===e.toLowerCase()||"0"!==e&&"false"!==e.toLowerCase()&&void 0}function se(e){return{distZipEnabled:e.distZip??ie(process.env.PP_DEV_DIST_ZIP),distZipDir:e.distZipDir??process.env.PP_DEV_DIST_ZIP_DIR,distZipFilename:e.distZipFilename??process.env.PP_DEV_DIST_ZIP_FILENAME,versionManifestEnabled:e.versionManifest??ie(process.env.PP_DEV_VERSION_MANIFEST),versionFileTemplate:e.versionFileTemplate??process.env.PP_DEV_VERSION_FILE_TEMPLATE}}function re(e,t,n){if(!1===t.distZipEnabled)return!1;if(!0!==t.distZipEnabled&&void 0===t.distZipDir&&void 0===t.distZipFilename)return e;return{...!1===e?{outFileName:n,outDir:"dist-zip"}:e,...void 0!==t.distZipDir?{outDir:t.distZipDir}:{},...void 0!==t.distZipFilename?{outFileName:t.distZipFilename}:{}}}function oe(e,t){if(!1===t.versionManifestEnabled)return!1;if(!0!==t.versionManifestEnabled&&void 0===t.versionFileTemplate)return e;return{...!1===e?{enabled:!0}:e,enabled:!0,...void 0!==t.versionFileTemplate?{versionFileTemplate:t.versionFileTemplate}:{}}}const ae=new Set(["mi","app","proxy","build","sync","inspector","devPanel"]);function ce(t){if("string"==typeof t)return t;if(t&&"object"==typeof t&&"url"in t&&"string"==typeof t.url)return t.url;const n=["CI_REPOSITORY_URL","GIT_URL","BUILD_REPOSITORY_URI","CI_PROJECT_URL","BITBUCKET_GIT_HTTP_ORIGIN","BUILDKITE_REPO"];for(const e of n){const t=process.env[e];if("string"==typeof t&&t.trim())return t}const i=process.env.GITHUB_REPOSITORY;if("string"==typeof i&&i.trim()){return`${(process.env.GITHUB_SERVER_URL||"https://github.com").replace(/\/+$/,"")}/${i.replace(/^\/+/,"")}`}const s=process.env.CI_PROJECT_PATH;if("string"==typeof s&&s.trim()){return`${(process.env.CI_SERVER_URL||"https://gitlab.com").replace(/\/+$/,"")}/${s.replace(/^\/+/,"")}`}const r=process.env.BITBUCKET_REPO_FULL_NAME;if("string"==typeof r&&r.trim())return`https://bitbucket.org/${r.replace(/^\/+/,"")}`;const o=process.env.TRAVIS_REPO_SLUG;if("string"==typeof o&&o.trim())return`https://github.com/${o.replace(/^\/+/,"")}`;try{const t=e("git config --get remote.origin.url",{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(t)return t}catch{}}async function pe(e){const t=ee(),n=t.name,i=await te();o(i,n);const s=a(i,n);e&&(s.distZip=re(s.distZip,e,`${n}.zip`),s.versionPlugin=oe(s.versionPlugin,e));const{default:r}=await import("./plugin.js"),l=[r(s),Z()],{outDir:u,distZip:d,versionPlugin:m,imageOptimizer:f,templateLess:g,integrateMiTopBar:v}=s;if(v&&l.push(function(e){return{name:"mi-topbar-plugin",transformIndexHtml(){const t=[];return(!0===e||"object"==typeof e&&!0===e.addRootElement)&&t.push({tag:"div",injectTo:"body-prepend",attrs:{id:"mi-react-root"}}),(!0===e||"object"==typeof e&&!0===e.addSharedComponentsScripts)&&t.push({tag:"script",injectTo:"head-prepend",attrs:{src:"/auth/info.js"}},{tag:"script",injectTo:"head-prepend",attrs:{src:"/js/main.js",defer:"defer"}},{tag:"link",injectTo:"head-prepend",attrs:{href:"/css/main.css",rel:"stylesheet"}}),t}}}(v)),f){const{ViteImageOptimizer:e}=await import("vite-plugin-image-optimizer");l.push(e("object"==typeof f?f:void 0))}if(m){const{versionPlugin:e}=await import("./version-plugin-DcuQh2S4.js");l.push(e({outDir:u,packageVersion:t.version??"0.0.0",packageRepositoryUrl:ce(t.repository),..."object"==typeof m?m:{}}))}if(d){const{default:e}=await import("vite-plugin-zip-pack");l.push({...e("object"==typeof d?d:{outFileName:`${n}.zip`}),enforce:"post"})}return{base:g?`${c}/${n}`:`${p}/${n}`,server:{port:3e3},build:{minify:!1,assetsInlineLimit:4096,rollupOptions:{output:{banner:V}},outDir:u},css:{modules:{localsConvention:"dashes"}},ppDevConfig:s,plugins:l}}function le(e){return e?.ppDev||{}}function ue(e,t){return async(n,i={})=>{try{const{constants:s}=await k(),{PHASE_DEVELOPMENT_SERVER:r,PHASE_PRODUCTION_BUILD:f}=s;n!==f||process.env[l]||u().warn(d.yellow('⚠ Building with plain `next build`. Use `pp-dev next-build` instead to get VERSION/BUILD-MANIFEST/zip build output in the same format as `pp-dev build` (see the "Next.js Build" section in the pp-dev README).'));const g=await te(),v=ee().name,h="function"==typeof e?await e(n,i):e,y=function(...e){const t={},n=t;for(const t of e)if(t)for(const[e,i]of Object.entries(t))void 0!==i&&(ae.has(e)&&i&&"object"==typeof i&&!Array.isArray(i)?n[e]={...n[e]??{},...i}:n[e]=i);return t}(g,le(h),t);o(y,v);const P=a(y,v),{templateLess:j,v7Features:b}=P,E=n===r,_=function(e,t,n,i){return n?i?t?`${c}/${e}`:`${m}/${e}`:t?`${c}/${e}`:`${p}/${e}`:`${c}/${e}`}(P.templateName,j,E,b),$={basePath:_,trailingSlash:!!E||void 0};if(!j){const e=E&&b?m:p;$.assetPrefix=`${e}/${P.templateName}`}const w=Object.assign({},$,h);return Object.defineProperty(w,"ppDev",{value:y,enumerable:!1,configurable:!0}),w}catch(e){throw u().error("Error in withPPDev:",{error:e instanceof Error?e:new Error(String(e))}),e}}}export{re as a,oe as b,L as c,M as d,le as e,B as f,pe as g,ne as h,O as i,se as r,k as s,ue as w};
|
|
2
|
-
//# sourceMappingURL=index-
|
|
1
|
+
import{execSync as e}from"child_process";import{t,x as n,V as i,y as s,d as r,v as o,n as a,e as c,g as p,b as l,c as u,a as d,f as m}from"./plugin-BtTlYPNc.js";import*as f from"fs";import{readdirSync as g,readFileSync as v,writeFileSync as h,existsSync as y,unlink as P}from"fs";import*as j from"path";import b from"path";import{fileURLToPath as E,pathToFileURL as _}from"url";import"./helpers.js";import{normalizePath as $}from"vite";import w from"ejs";const I=j.dirname(n),D=j.join(I,"index.html");let T=null;function R(e){return{css:j.posix.join(e,t,"client/client.css"),js:j.posix.join(e,t,"client/client.js")}}function S(e){return function(){if(T)return T;const e=f.readFileSync(D,{encoding:"utf8"});return T=w.compile(e,{openDelimiter:"{",closeDelimiter:"}",async:!1,rmWhitespace:!0,compileDebug:!1}),T}()({PACKAGE_NAME:t,VERSION:i,backendBaseURL:e.backendBaseURL,templateLess:e.templateLess,appId:e.appId,canSync:e.canSync??!0,devPanelPosition:e.devPanelPosition??"bottom-right",devPanelHidden:e.devPanelHidden??!1,devPanelAutoHide:e.devPanelAutoHide??!1})}function O(e,t,n){if(!/<\/?(html|body|head)\b/i.test(e))return e;const{css:i,js:s}=R(t),r=`<link rel="stylesheet" href="${i}">`,o=`${S(n)}${`<script type="module" src="${s}"><\/script>`}`;let a=e,c=!1;if(/<\/head>/i.test(a)&&(a=a.replace(/<\/head>/i,`${r}</head>`),c=!0),/<body[^>]*>/i.test(a)){const e=c?"":r;a=a.replace(/(<body[^>]*>)/i,`$1${e}${o}`)}else a=`${c?"":r}${a}${o}`;return a}const x={".js":"text/javascript; charset=utf-8",".css":"text/css; charset=utf-8",".map":"application/json; charset=utf-8"};function L(e){const n=j.posix.join(e,t,"client")+"/",i=new Set(["client.js","client.css","client.js.map","client.css.map"]);return(e,t,s)=>{const r=(e.url??"").split("?")[0];if(!r.startsWith(n))return void s();const o=r.slice(n.length);if(!i.has(o))return void s();const a=j.join(I,o);f.readFile(a,(e,n)=>{e?s():(t.statusCode=200,t.setHeader("Content-Type",x[j.extname(o)]??"application/octet-stream"),t.setHeader("Cache-Control","no-cache"),t.end(n))})}}let F;try{F="undefined"!=typeof __filename&&__filename?j.resolve(j.dirname(__filename),".."):void 0!==import.meta&&import.meta&&import.meta.url?j.resolve(E(new URL(".",import.meta.url)),".."):process.cwd()}catch{F=process.cwd()}const N=$(j.join(s,"dist/client")),A=new RegExp(`^\\/?${t}\\/client\\/(.*)$`);let C=null,U=null;function Z(e){return{name:"pp-dev:client",apply:"serve",config:e=>(e.optimizeDeps?.exclude?.push(`${t}/client`),e),resolveId(e){const t=e.match(A);if(t){const e=$(j.join(N,t[1]));return e.startsWith(`${N}/`)?{id:e}:null}},transformIndexHtml:async(e,n)=>{const s=n.server?.config.base||"",r=function(){if(U)return U;const e=j.resolve(F,"client","index.html");return C||(C=f.readFileSync(e,{encoding:"utf8"})),U=w.compile(C,{openDelimiter:"{",closeDelimiter:"}",async:!0,cache:!0,filename:e,rmWhitespace:!0,compileDebug:!1}),U}(),o=R(s),a={html:e,tags:[{tag:"link",injectTo:"head",attrs:{rel:"stylesheet",href:o.css}}]},{backendBaseURL:c,templateLess:p=!1,appId:l,canSync:u=!0,devPanelPosition:d="bottom-right",devPanelHidden:m=!1,devPanelAutoHide:g=!1}=n.server?.config.clientInjectionPlugin||{},v={PACKAGE_NAME:t,VERSION:i,backendBaseURL:c,templateLess:p,appId:l,canSync:u,devPanelPosition:d,devPanelHidden:m,devPanelAutoHide:g};return a.tags.push({tag:"div",injectTo:"body-prepend",children:await r(v)}),a.tags.push({tag:"script",injectTo:"body-prepend",attrs:{src:o.js,type:"module"}}),a},configureServer(e){const t=$(j.resolve(e.config.root,j.dirname(n)));e.config.server?.fs?.allow&&e.config.server.fs.allow.push(t)}}}const H=(e,t)=>` * ${t}`;function V(e){return`/*!\n${"***** DO NOT EDIT THIS CODE! *****\n***** ------- *****".replace(/^(.*)$/gm,H)}\n */`}async function k(){try{const[e,t]=await Promise.all([import("next"),import("next/constants.js")]);return{next:e.default,constants:t}}catch(e){throw new Error(`Next.js is required but not available. Please install Next.js as a dependency:\nnpm install next@^15\n\nThis package requires Next.js >=15 <17 as a peer dependency.\n\nError: ${e}`)}}async function B(){try{return await import("next"),!0}catch{return!1}}async function M(){try{return(await import("next/package.json")).version}catch{return null}}const z=new Map,G=3e4;let W=null;function K(){const e=Date.now();if(W&&e-W.timestamp<6e4)return W.data;const t=process.cwd();try{const n=JSON.parse(v(b.resolve(t,"package.json"),{encoding:"utf-8",flag:"r"}));return W={data:n,timestamp:e},n}catch{const t={};return W={data:t,timestamp:e},t}}let J=null;async function Y(e){const t=process.cwd(),n=`ts:${e}`,i=z.get(n);if(i&&Date.now()-i.timestamp<G)return i.data;let s=!1;if(/\.m[jt]s$/.test(e))s=!0;else if(/\.c[jt]s$/.test(e))s=!1;else{const e=K();s=!!e&&"module"===e.type}const r=await async function(){return J||(J=await import("esbuild")),J}(),o=await r.build({absWorkingDir:t,entryPoints:[e],outfile:"out.js",write:!1,target:"node24",platform:"node",bundle:!0,packages:"external",format:s?"esm":"cjs",mainFields:["main"],sourcemap:"inline",metafile:!0}),{text:a}=o.outputFiles[0],c=`${`pp-config.timestamp-${Date.now()}-${Math.random().toString(16).slice(2)}`}.js`,p=_(b.resolve(t,c)).toString();h(c,a);let l={};try{const t=(await import(p)).default;l=t?.default||t,z.set(n,{data:l,timestamp:Date.now(),filePath:e})}finally{y(c)&&P(c,()=>{})}return l}async function q(e){const t=`js:${e}`,n=z.get(t);if(n&&Date.now()-n.timestamp<G)return n.data;const i=(await import(_(e).toString())).default;return z.set(t,{data:i,timestamp:Date.now(),filePath:e}),i}async function Q(e){const t=`json:${e}`,n=z.get(t);if(n&&Date.now()-n.timestamp<G)return n.data;const i=JSON.parse(v(e,{encoding:"utf-8"}));return z.set(t,{data:i,timestamp:Date.now(),filePath:e}),i}let X=null;function ee(){return K()}async function te(){const e=function(){const e=Date.now();if(X&&e-X.timestamp<1e4)return X.files;const t=/\.config\.(([cm]?ts)|([cm]?js)|(json))$/,n=process.cwd(),i=g(n,{withFileTypes:!0}).filter(e=>e.isFile()&&t.test(e.name)).map(e=>e.name);return X={files:i,timestamp:e},i}();let t={},n=!1;const i=await async function(e,t){for(const n of t)if(e.includes(n)){if(/\.[cm]?ts$/i.test(n))return await Y(n);if(/\.[cm]?js$/i.test(n))return await q(b.resolve(".",n));if(n.endsWith(".json"))return await Q(b.resolve(".",n))}return null}(e,r);i&&(t=i,n=!0);const s=K()["pp-dev"];return n||!s||"object"!=typeof s||Array.isArray(s)||(t=s),t}const ne=Object.freeze({__proto__:null,clearConfigCache:function(){z.clear(),W=null,X=null},getConfig:te,getPkg:ee});function ie(e){if(void 0!==e)return"1"===e||"true"===e.toLowerCase()||"0"!==e&&"false"!==e.toLowerCase()&&void 0}function se(e){return{distZipEnabled:e.distZip??ie(process.env.PP_DEV_DIST_ZIP),distZipDir:e.distZipDir??process.env.PP_DEV_DIST_ZIP_DIR,distZipFilename:e.distZipFilename??process.env.PP_DEV_DIST_ZIP_FILENAME,versionManifestEnabled:e.versionManifest??ie(process.env.PP_DEV_VERSION_MANIFEST),versionFileTemplate:e.versionFileTemplate??process.env.PP_DEV_VERSION_FILE_TEMPLATE}}function re(e,t,n){if(!1===t.distZipEnabled)return!1;if(!0!==t.distZipEnabled&&void 0===t.distZipDir&&void 0===t.distZipFilename)return e;return{...!1===e?{outFileName:n,outDir:"dist-zip"}:e,...void 0!==t.distZipDir?{outDir:t.distZipDir}:{},...void 0!==t.distZipFilename?{outFileName:t.distZipFilename}:{}}}function oe(e,t){if(!1===t.versionManifestEnabled)return!1;if(!0!==t.versionManifestEnabled&&void 0===t.versionFileTemplate)return e;return{...!1===e?{enabled:!0}:e,enabled:!0,...void 0!==t.versionFileTemplate?{versionFileTemplate:t.versionFileTemplate}:{}}}const ae=new Set(["mi","app","proxy","build","sync","inspector","devPanel"]);function ce(t){if("string"==typeof t)return t;if(t&&"object"==typeof t&&"url"in t&&"string"==typeof t.url)return t.url;const n=["CI_REPOSITORY_URL","GIT_URL","BUILD_REPOSITORY_URI","CI_PROJECT_URL","BITBUCKET_GIT_HTTP_ORIGIN","BUILDKITE_REPO"];for(const e of n){const t=process.env[e];if("string"==typeof t&&t.trim())return t}const i=process.env.GITHUB_REPOSITORY;if("string"==typeof i&&i.trim()){return`${(process.env.GITHUB_SERVER_URL||"https://github.com").replace(/\/+$/,"")}/${i.replace(/^\/+/,"")}`}const s=process.env.CI_PROJECT_PATH;if("string"==typeof s&&s.trim()){return`${(process.env.CI_SERVER_URL||"https://gitlab.com").replace(/\/+$/,"")}/${s.replace(/^\/+/,"")}`}const r=process.env.BITBUCKET_REPO_FULL_NAME;if("string"==typeof r&&r.trim())return`https://bitbucket.org/${r.replace(/^\/+/,"")}`;const o=process.env.TRAVIS_REPO_SLUG;if("string"==typeof o&&o.trim())return`https://github.com/${o.replace(/^\/+/,"")}`;try{const t=e("git config --get remote.origin.url",{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(t)return t}catch{}}async function pe(e){const t=ee(),n=t.name,i=await te();o(i,n);const s=a(i,n);e&&(s.distZip=re(s.distZip,e,`${n}.zip`),s.versionPlugin=oe(s.versionPlugin,e));const{default:r}=await import("./plugin.js"),l=[r(s),Z()],{outDir:u,distZip:d,versionPlugin:m,imageOptimizer:f,templateLess:g,integrateMiTopBar:v}=s;if(v&&l.push(function(e){return{name:"mi-topbar-plugin",transformIndexHtml(){const t=[];return(!0===e||"object"==typeof e&&!0===e.addRootElement)&&t.push({tag:"div",injectTo:"body-prepend",attrs:{id:"mi-react-root"}}),(!0===e||"object"==typeof e&&!0===e.addSharedComponentsScripts)&&t.push({tag:"script",injectTo:"head-prepend",attrs:{src:"/auth/info.js"}},{tag:"script",injectTo:"head-prepend",attrs:{src:"/js/main.js",defer:"defer"}},{tag:"link",injectTo:"head-prepend",attrs:{href:"/css/main.css",rel:"stylesheet"}}),t}}}(v)),f){const{ViteImageOptimizer:e}=await import("vite-plugin-image-optimizer");l.push(e("object"==typeof f?f:void 0))}if(m){const{versionPlugin:e}=await import("./version-plugin-7_CHPYR-.js");l.push(e({outDir:u,packageVersion:t.version??"0.0.0",packageRepositoryUrl:ce(t.repository),..."object"==typeof m?m:{}}))}if(d){const{default:e}=await import("vite-plugin-zip-pack");l.push({...e("object"==typeof d?d:{outFileName:`${n}.zip`}),enforce:"post"})}return{base:g?`${c}/${n}`:`${p}/${n}`,server:{port:3e3},build:{minify:!1,assetsInlineLimit:4096,rollupOptions:{output:{banner:V}},outDir:u},css:{modules:{localsConvention:"dashes"}},ppDevConfig:s,plugins:l}}function le(e){return e?.ppDev||{}}function ue(e,t){return async(n,i={})=>{try{const{constants:s}=await k(),{PHASE_DEVELOPMENT_SERVER:r,PHASE_PRODUCTION_BUILD:f}=s;n!==f||process.env[l]||u().warn(d.yellow('⚠ Building with plain `next build`. Use `pp-dev next-build` instead to get VERSION/BUILD-MANIFEST/zip build output in the same format as `pp-dev build` (see the "Next.js Build" section in the pp-dev README).'));const g=await te(),v=ee().name,h="function"==typeof e?await e(n,i):e,y=function(...e){const t={},n=t;for(const t of e)if(t)for(const[e,i]of Object.entries(t))void 0!==i&&(ae.has(e)&&i&&"object"==typeof i&&!Array.isArray(i)?n[e]={...n[e]??{},...i}:n[e]=i);return t}(g,le(h),t);o(y,v);const P=a(y,v),{templateLess:j,v7Features:b}=P,E=n===r,_=function(e,t,n,i){return n?i?t?`${c}/${e}`:`${m}/${e}`:t?`${c}/${e}`:`${p}/${e}`:`${c}/${e}`}(P.templateName,j,E,b),$={basePath:_,trailingSlash:!!E||void 0};if(!j){const e=E&&b?m:p;$.assetPrefix=`${e}/${P.templateName}`}const w=Object.assign({},$,h);return Object.defineProperty(w,"ppDev",{value:y,enumerable:!1,configurable:!0}),w}catch(e){throw u().error("Error in withPPDev:",{error:e instanceof Error?e:new Error(String(e))}),e}}}export{re as a,oe as b,L as c,M as d,le as e,B as f,pe as g,ne as h,O as i,se as r,k as s,ue as w};
|
|
2
|
+
//# sourceMappingURL=index-BtZKQ3Ni.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-BGMOUqHR.js","sources":["../../../src/lib/dev-panel.ts","../../../src/plugins/client-injection-plugin.ts","../../../src/banner/header.ts","../../../src/lib/next-import.ts","../../../src/config.ts","../../../src/lib/build-cli-overrides.ts","../../../src/index.ts","../../../src/plugins/mi-topbar-plugin.ts"],"sourcesContent":[null,null,null,null,null,null,null,null],"names":["CLIENT_DIST_DIR","path","dirname","PP_DEV_CLIENT_ENTRY","TEMPLATE_PATH","join","compiledTemplate","getDevPanelAssetPaths","base","css","posix","PACKAGE_NAME","js","renderDevPanelMarkup","data","templateContent","fs","readFileSync","encoding","ejs","compile","openDelimiter","closeDelimiter","async","rmWhitespace","compileDebug","getTemplate","template","VERSION","backendBaseURL","templateLess","appId","canSync","devPanelPosition","devPanelHidden","devPanelAutoHide","injectDevPanel","html","test","linkTag","bodyPrepend","result","linkInjected","replace","head","CONTENT_TYPES","createDevPanelAssetMiddleware","assetPrefix","allowed","Set","req","res","next","pathname","url","split","startsWith","fileName","slice","length","has","filePath","readFile","err","content","statusCode","setHeader","extname","end","DIRNAME","__filename","resolve","fileURLToPath","URL","process","cwd","normalizePath","PP_DEV_PACKAGE_DIR","PACKAGE_REGEXP","RegExp","cachedTemplateContent","cachedTemplate","clientInjectionPlugin","opts","name","apply","config","optimizeDeps","exclude","push","resolveId","source","match","resolvedId","id","transformIndexHtml","ctx","server","templatePath","cache","filename","assetPaths","tags","tag","injectTo","attrs","rel","href","templateData","children","src","type","configureServer","clientDir","root","allow","replacer","substring","$1","header","_chunk","safeNextImport","constants","Promise","all","import","default","error","Error","isNextAvailable","getNextVersion","version","configCache","Map","CACHE_TTL","packageJsonCache","getPackageJson","now","Date","timestamp","JSON","parse","flag","empty","esbuildModule","loadTsConfig","cacheKey","cached","get","isESM","pkg","esbuild","getEsbuild","build","absWorkingDir","entryPoints","outfile","write","target","platform","bundle","packages","format","mainFields","sourcemap","metafile","text","code","outputFiles","fileNameTmp","Math","random","toString","fileUrl","pathToFileURL","writeFileSync","conf","set","existsSync","unlink","loadJsConfig","loadJSONConfig","dirContentCache","getPkg","getConfig","dirContent","files","endsWithRegExp","readdirSync","withFileTypes","filter","value","isFile","map","getDirectoryContent","configFound","newConfig","dirFiles","configNames","configName","includes","endsWith","loadConfig","PP_DEV_CONFIG_NAMES","packageConfig","Array","isArray","clear","parseBooleanFlag","undefined","toLowerCase","resolveBuildCliOverrides","options","distZipEnabled","distZip","env","PP_DEV_DIST_ZIP","distZipDir","PP_DEV_DIST_ZIP_DIR","distZipFilename","PP_DEV_DIST_ZIP_FILENAME","versionManifestEnabled","versionManifest","PP_DEV_VERSION_MANIFEST","versionFileTemplate","PP_DEV_VERSION_FILE_TEMPLATE","applyDistZipOverride","overrides","defaultFileName","outFileName","outDir","applyVersionManifestOverride","enabled","PP_DEV_CONFIG_GROUPS","resolveRepositoryUrl","repository","directCiRepositoryUrlEnvVars","variableName","ciRepositoryUrl","trim","githubRepository","GITHUB_REPOSITORY","GITHUB_SERVER_URL","gitlabProjectPath","CI_PROJECT_PATH","CI_SERVER_URL","bitbucketRepositoryFullName","BITBUCKET_REPO_FULL_NAME","travisRepositorySlug","TRAVIS_REPO_SLUG","gitRemoteOriginUrl","execSync","stdio","getViteConfig","templateName","ppDevConfig","validatePPDevConfig","normalizedPPDevConfig","normalizePPDevConfig","versionPlugin","vitePPDev","plugins","imageOptimizer","integrateMiTopBar","addRootElement","addSharedComponentsScripts","defer","miTopBarPlugin","ViteImageOptimizer","versionPluginFn","packageVersion","packageRepositoryUrl","zipPack","enforce","PATH_PAGE_PREFIX","PATH_TEMPLATE_PREFIX","port","minify","assetsInlineLimit","rollupOptions","output","banner","modules","localsConvention","getPPDevConfigFromNextConfig","nextConfig","ppDev","withPPDev","nextjsConfig","phase","PHASE_DEVELOPMENT_SERVER","PHASE_PRODUCTION_BUILD","PP_DEV_NEXT_BUILD_ENV_VAR","createLogger","warn","colors","yellow","nextConfiguration","mergedConfig","configs","merged","mutableMerged","key","Object","entries","mergePPDevConfigs","normalized","v7Features","isDevelopment","basePath","PATH_TEMPLATE_LOCAL_PREFIX","createBasePath","baseConfig","trailingSlash","prefix","assign","defineProperty","enumerable","configurable","String"],"mappings":"ucA4BA,MAAMA,EAAkBC,EAAKC,QAAQC,GAC/BC,EAAgBH,EAAKI,KAAKL,EAAiB,cAEjD,IAAIM,EAA4C,KAqB1C,SAAUC,EAAsBC,GACpC,MAAO,CACLC,IAAKR,EAAKS,MAAML,KAAKG,EAAMG,EAAc,qBACzCC,GAAIX,EAAKS,MAAML,KAAKG,EAAMG,EAAc,oBAE5C,CAGM,SAAUE,EAAqBC,GAGnC,OA9BF,W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EA,EAAYqR,WAAEA,GAAeD,EAG/BE,EAAgBnB,IAAUC,EAC1BmB,EA/EZ,SACEvD,EACAhO,EACAsR,EACAD,GAEA,OAAIC,EACED,EACErR,EACK,GAAGoP,KAAoBpB,IAEvB,GAAGwD,KAA8BxD,IAGtChO,EACK,GAAGoP,KAAoBpB,IAEvB,GAAGqB,KAAwBrB,IAKjC,GAAGoB,KAAoBpB,GAChC,CAwDuByD,CAAeL,EAAWpD,aAAchO,EAAcsR,EAAeD,GAEhFK,EAAyB,CAC7BH,WACAI,gBAAeL,QAAuBnG,GAGxC,IAAKnL,EAAc,CACjB,MAAM4R,EAASN,GAAiBD,EAAaG,EAA6BnC,EAE1EqC,EAAWzQ,YAAc,GAAG2Q,KAAUR,EAAWpD,cACnD,CAKA,MAAMrN,EAASsQ,OAAOY,OAAO,CAAA,EAAIH,EAAYf,GAQ7C,OANAM,OAAOa,eAAenR,EAAQ,QAAS,CACrCsJ,MAAO2G,EACPmB,YAAY,EACZC,cAAc,IAGTrR,CACT,CAAE,MAAOsF,GAKP,MAJesK,IAERtK,MAAM,sBAAuB,CAAEA,MAAOA,aAAiBC,MAAQD,EAAQ,IAAIC,MAAM+L,OAAOhM,MAEzFA,CACR,EAEJ"}
|
|
1
|
+
{"version":3,"file":"index-BtZKQ3Ni.js","sources":["../../../src/lib/dev-panel.ts","../../../src/plugins/client-injection-plugin.ts","../../../src/banner/header.ts","../../../src/lib/next-import.ts","../../../src/config.ts","../../../src/lib/build-cli-overrides.ts","../../../src/index.ts","../../../src/plugins/mi-topbar-plugin.ts"],"sourcesContent":[null,null,null,null,null,null,null,null],"names":["CLIENT_DIST_DIR","path","dirname","PP_DEV_CLIENT_ENTRY","TEMPLATE_PATH","join","compiledTemplate","getDevPanelAssetPaths","base","css","posix","PACKAGE_NAME","js","renderDevPanelMarkup","data","templateContent","fs","readFileSync","encoding","ejs","compile","openDelimiter","closeDelimiter","async","rmWhitespace","compileDebug","getTemplate","template","VERSION","backendBaseURL","templateLess","appId","canSync","devPanelPosition","devPanelHidden","devPanelAutoHide","injectDevPanel","html","test","linkTag","bodyPrepend","result","linkInjected","replace","head","CONTENT_TYPES","createDevPanelAssetMiddleware","assetPrefix","allowed","Set","req","res","next","pathname","url","split","startsWith","fileName","slice","length","has","filePath","readFile","err","content","statusCode","setHeader","extname","end","DIRNAME","__filename","resolve","fileURLToPath","URL","process","cwd","normalizePath","PP_DEV_PACKAGE_DIR","PACKAGE_REGEXP","RegExp","cachedTemplateContent","cachedTemplate","clientInjectionPlugin","opts","name","apply","config","optimizeDeps","exclude","push","resolveId","source","match","resolvedId","id","transformIndexHtml","ctx","server","templatePath","cache","filename","assetPaths","tags","tag","injectTo","attrs","rel","href","templateData","children","src","type","configureServer","clientDir","root","allow","replacer","substring","$1","header","_chunk","safeNextImport","constants","Promise","all","import","default","error","Error","isNextAvailable","getNextVersion","version","configCache","Map","CACHE_TTL","packageJsonCache","getPackageJson","now","Date","timestamp","JSON","parse","flag","empty","esbuildModule","loadTsConfig","cacheKey","cached","get","isESM","pkg","esbuild","getEsbuild","build","absWorkingDir","entryPoints","outfile","write","target","platform","bundle","packages","format","mainFields","sourcemap","metafile","text","code","outputFiles","fileNameTmp","Math","random","toString","fileUrl","pathToFileURL","writeFileSync","conf","set","existsSync","unlink","loadJsConfig","loadJSONConfig","dirContentCache","getPkg","getConfig","dirContent","files","endsWithRegExp","readdirSync","withFileTypes","filter","value","isFile","map","getDirectoryContent","configFound","newConfig","dirFiles","configNames","configName","includes","endsWith","loadConfig","PP_DEV_CONFIG_NAMES","packageConfig","Array","isArray","clear","parseBooleanFlag","undefined","toLowerCase","resolveBuildCliOverrides","options","distZipEnabled","distZip","env","PP_DEV_DIST_ZIP","distZipDir","PP_DEV_DIST_ZIP_DIR","distZipFilename","PP_DEV_DIST_ZIP_FILENAME","versionManifestEnabled","versionManifest","PP_DEV_VERSION_MANIFEST","versionFileTemplate","PP_DEV_VERSION_FILE_TEMPLATE","applyDistZipOverride","overrides","defaultFileName","outFileName","outDir","applyVersionManifestOverride","enabled","PP_DEV_CONFIG_GROUPS","resolveRepositoryUrl","repository","directCiRepositoryUrlEnvVars","variableName","ciRepositoryUrl","trim","githubRepository","GITHUB_REPOSITORY","GITHUB_SERVER_URL","gitlabProjectPath","CI_PROJECT_PATH","CI_SERVER_URL","bitbucketRepositoryFullName","BITBUCKET_REPO_FULL_NAME","travisRepositorySlug","TRAVIS_REPO_SLUG","gitRemoteOriginUrl","execSync","stdio","getViteConfig","templateName","ppDevConfig","validatePPDevConfig","normalizedPPDevConfig","normalizePPDevConfig","versionPlugin","vitePPDev","plugins","imageOptimizer","integrateMiTopBar","addRootElement","addSharedComponentsScripts","defer","miTopBarPlugin","ViteImageOptimizer","versionPluginFn","packageVersion","packageRepositoryUrl","zipPack","enforce","PATH_PAGE_PREFIX","PATH_TEMPLATE_PREFIX","port","minify","assetsInlineLimit","rollupOptions","output","banner","modules","localsConvention","getPPDevConfigFromNextConfig","nextConfig","ppDev","withPPDev","nextjsConfig","phase","PHASE_DEVELOPMENT_SERVER","PHASE_PRODUCTION_BUILD","PP_DEV_NEXT_BUILD_ENV_VAR","createLogger","warn","colors","yellow","nextConfiguration","mergedConfig","configs","merged","mutableMerged","key","Object","entries","mergePPDevConfigs","normalized","v7Features","isDevelopment","basePath","PATH_TEMPLATE_LOCAL_PREFIX","createBasePath","baseConfig","trailingSlash","prefix","assign","defineProperty","enumerable","configurable","String"],"mappings":"ucA4BA,MAAMA,EAAkBC,EAAKC,QAAQC,GAC/BC,EAAgBH,EAAKI,KAAKL,EAAiB,cAEjD,IAAIM,EAA4C,KAqB1C,SAAUC,EAAsBC,GACpC,MAAO,CACLC,IAAKR,EAAKS,MAAML,KAAKG,EAAMG,EAAc,qBACzCC,GAAIX,EAAKS,MAAML,KAAKG,EAAMG,EAAc,oBAE5C,CAGM,SAAUE,EAAqBC,GAGnC,OA9BF,WACE,GAAIR,EACF,OAAOA,EAGT,MAAMS,EAAkBC,EAAGC,aAAab,EAAe,CA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Z,SACEvD,EACAhO,EACAsR,EACAD,GAEA,OAAIC,EACED,EACErR,EACK,GAAGoP,KAAoBpB,IAEvB,GAAGwD,KAA8BxD,IAGtChO,EACK,GAAGoP,KAAoBpB,IAEvB,GAAGqB,KAAwBrB,IAKjC,GAAGoB,KAAoBpB,GAChC,CAwDuByD,CAAeL,EAAWpD,aAAchO,EAAcsR,EAAeD,GAEhFK,EAAyB,CAC7BH,WACAI,gBAAeL,QAAuBnG,GAGxC,IAAKnL,EAAc,CACjB,MAAM4R,EAASN,GAAiBD,EAAaG,EAA6BnC,EAE1EqC,EAAWzQ,YAAc,GAAG2Q,KAAUR,EAAWpD,cACnD,CAKA,MAAMrN,EAASsQ,OAAOY,OAAO,CAAA,EAAIH,EAAYf,GAQ7C,OANAM,OAAOa,eAAenR,EAAQ,QAAS,CACrCsJ,MAAO2G,EACPmB,YAAY,EACZC,cAAc,IAGTrR,CACT,CAAE,MAAOsF,GAKP,MAJesK,IAERtK,MAAM,sBAAuB,CAAEA,MAAOA,aAAiBC,MAAQD,EAAQ,IAAIC,MAAM+L,OAAOhM,MAEzFA,CACR,EAEJ"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"child_process";export{A as AuthProvider,B as authProvider,n as normalizePPDevConfig,v as validatePPDevConfig}from"./plugin-
|
|
1
|
+
import"child_process";export{A as AuthProvider,B as authProvider,n as normalizePPDevConfig,v as validatePPDevConfig}from"./plugin-BtTlYPNc.js";export{d as getNextVersion,e as getPPDevConfigFromNextConfig,g as getViteConfig,f as isNextAvailable,s as safeNextImport,w as withPPDev}from"./index-BtZKQ3Ni.js";export{defineConfig}from"./helpers.js";import"http-proxy-middleware";import"url";import"vite";import"picocolors";import"axios";import"node:http";import"node:https";import"jsdom";import"path";import"fs";import"crypto";import"process";import"os";import"extract-zip";import"jszip";import"module";import"memory-cache";import"zlib";import"express";import"node:crypto";import"ejs";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|