@metricinsights/pp-dev 1.4.1-beta.3 → 1.4.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.
Files changed (31) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/CHANGELOG.md +7 -0
  3. package/dist/cjs/cli.js +1 -1
  4. package/dist/cjs/{index-CtxApOJm.js → index-Cab7kIQH.js} +2 -2
  5. package/dist/cjs/{index-CtxApOJm.js.map → index-Cab7kIQH.js.map} +1 -1
  6. package/dist/cjs/index.js +1 -1
  7. package/dist/cjs/{migrate-t_tUHdbD.js → migrate-tyzkQsrd.js} +2 -2
  8. package/dist/cjs/{migrate-t_tUHdbD.js.map → migrate-tyzkQsrd.js.map} +1 -1
  9. package/dist/cjs/package.json +1 -1
  10. package/dist/cjs/plugin-BcxTOlCf.js +2 -0
  11. package/dist/cjs/plugin-BcxTOlCf.js.map +1 -0
  12. package/dist/cjs/plugin.js +1 -1
  13. package/dist/cjs/{version-plugin-Dozkvk1U.js → version-plugin-rZ3JgnX3.js} +2 -2
  14. package/dist/cjs/{version-plugin-Dozkvk1U.js.map → version-plugin-rZ3JgnX3.js.map} +1 -1
  15. package/dist/esm/cli.js +1 -1
  16. package/dist/esm/{index-CQo1fAKu.js → index-BcReEkRb.js} +2 -2
  17. package/dist/esm/{index-CQo1fAKu.js.map → index-BcReEkRb.js.map} +1 -1
  18. package/dist/esm/index.js +1 -1
  19. package/dist/esm/{migrate-D_3UZxND.js → migrate-Be2sIPUg.js} +2 -2
  20. package/dist/esm/{migrate-D_3UZxND.js.map → migrate-Be2sIPUg.js.map} +1 -1
  21. package/dist/esm/package.json +1 -1
  22. package/dist/esm/plugin-B4Zp4ldE.js +2 -0
  23. package/dist/esm/plugin-B4Zp4ldE.js.map +1 -0
  24. package/dist/esm/plugin.js +1 -1
  25. package/dist/esm/{version-plugin-Tc8xw5lR.js → version-plugin--Vz_dsFm.js} +2 -2
  26. package/dist/esm/{version-plugin-Tc8xw5lR.js.map → version-plugin--Vz_dsFm.js.map} +1 -1
  27. package/package.json +1 -1
  28. package/dist/cjs/plugin-CkZeoDh1.js +0 -2
  29. package/dist/cjs/plugin-CkZeoDh1.js.map +0 -1
  30. package/dist/esm/plugin-sOaJ2ffx.js +0 -2
  31. package/dist/esm/plugin-sOaJ2ffx.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.4.1-beta.4](https://github.com/mi-examples/pp-dev/compare/v1.4.1-beta.3...v1.4.1-beta.4) (2026-09-02)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **dist:** normalize SVGs to match MI's server-side re-serialization (PP-4123) ([fb8441d](https://github.com/mi-examples/pp-dev/commit/fb8441dbe8ea6394cf2ed383bff02fa5dea850d0))
7
+
1
8
  ## [1.4.1-beta.3](https://github.com/mi-examples/pp-dev/compare/v1.4.1-beta.2...v1.4.1-beta.3) (2026-09-02)
2
9
 
3
10
 
package/dist/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.4.1-beta.4](https://github.com/mi-examples/pp-dev/compare/v1.4.1-beta.3...v1.4.1-beta.4) (2026-09-02)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **dist:** normalize SVGs to match MI's server-side re-serialization (PP-4123) ([fb8441d](https://github.com/mi-examples/pp-dev/commit/fb8441dbe8ea6394cf2ed383bff02fa5dea850d0))
7
+
1
8
  ## [1.4.1-beta.3](https://github.com/mi-examples/pp-dev/compare/v1.4.1-beta.2...v1.4.1-beta.3) (2026-09-02)
2
9
 
3
10
 
package/dist/cjs/cli.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("path"),t=require("fs"),o=require("node:events"),n=require("node:perf_hooks"),i=require("chokidar"),r=require("cac"),s=require("./plugin-CkZeoDh1.js"),a=require("./index-CtxApOJm.js"),l=require("vite"),c=require("url"),d=require("dir-compare"),p=require("diff-match-patch"),f=require("isbinaryfile"),u=require("os"),g=require("crypto"),h=require("extract-zip"),m=require("svgtofont"),v=require("ws");require("http-proxy-middleware"),require("picocolors"),require("node:string_decoder"),require("axios"),require("node:http"),require("node:https"),require("jsdom"),require("process"),require("child_process"),require("node:path"),require("jszip"),require("module"),require("memory-cache"),require("zlib"),require("express"),require("node:crypto"),require("./helpers.js"),require("ejs");const b=e=>e&&"object"==typeof e&&"default"in e?e.default:e;function w(e){if(e&&"object"==typeof e&&"default"in e)return e;const t=Object.create(null);if(e)for(const o in e)t[o]=e[o];return t.default=e,Object.freeze(t)}const y=w(e),P=w(t),x=w(d),S=b(p),E=w(u),T=w(g),L=b(h),k=b(m);function D(e){return null!=e&&!1!==e}let F=null;const I=[{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 _=/(.+)(-[a-f0-9]{6,20})(\.[a-z0-9]+)$/i;class ${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(e){const{oldAssetsPath:t,newAssetsPath:o,destinationPath:n,changelogTemplate:i,diffFileTemplateHandler:r,diffLineTemplateHandler:a,changelogFilename:l,contextLines:c}=e;if(this.logger=s.createLogger(),!t||!o||!n)throw new Error("Previous assets path, current assets path and destination path are required");if(t===o)throw new Error("Previous and current assets paths must be different");if(!this.isExists(t))throw new Error(`Previous assets path ${t} does not exist`);if(!this.isExists(o))throw new Error(`Current assets path ${o} does not exist`);if(this.isZipFile(t)){const e=y.resolve(E.tmpdir(),T.createHash("md5").update(t).digest("hex"));this.oldAssetsPath=this.unzipFile(t,e).then(()=>this.normalizeAssetFolderPath(e)).then(e=>{if(this.isEmptyFolder(e))throw new Error(`Previous assets path ${e} is empty`);return e})}else{if(!this.isFolder(t))throw new Error(`Invalid previous assets path ${t}. It must be a folder or a zip file`);{const e=this.normalizeAssetFolderPath(t);if(this.isEmptyFolder(e))throw new Error(`Previous assets path ${e} is empty`);this.oldAssetsPath=Promise.resolve(e)}}if(this.isZipFile(o)){const e=y.resolve(E.tmpdir(),T.createHash("md5").update(o).digest("hex"));this.newAssetsPath=this.unzipFile(o,e).then(()=>this.normalizeAssetFolderPath(e)).then(e=>{if(this.isEmptyFolder(e))throw new Error(`Current assets path ${e} is empty`);return e})}else{if(!this.isFolder(o))throw new Error(`Invalid current assets path ${o}. It must be a folder or a zip file`);{const e=this.normalizeAssetFolderPath(o);if(this.isEmptyFolder(e))throw new Error(`Current assets path ${o} is empty`);this.newAssetsPath=Promise.resolve(e)}}this.destinationPath=n,this.mkdirpSync(this.destinationPath),this.changelogFilename=l||"CHANGELOG.html",i&&(this.templateIsValid(i)?this.changelogTemplate=i:this.logger.warn(s.colors.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 P.existsSync(e)}isZipFile(e){return e.endsWith(".zip")}isFolder(e){return P.lstatSync(e).isDirectory()}isEmptyFolder(e){return 0===P.readdirSync(e,{withFileTypes:!0}).length}mkdirpSync(e){P.existsSync(e)||P.mkdirSync(e,{recursive:!0})}async unzipFile(e,t){P.rmSync(t,{force:!0,recursive:!0}),await L(e,{dir:t}),await s.rejectSymlinks(t)}normalizeAssetFolderPath(e){const t=P.readdirSync(e);return 1===t.length&&P.lstatSync(y.join(e,t[0])).isDirectory()?this.normalizeAssetFolderPath(y.join(e,t[0])):e}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?"-":" "}">${r=o??"",r.replace(/[\u00A0-\u9999<>&]/g,e=>"&#"+e.charCodeAt(0)+";")}</span>\n </td>\n </tr>`;var r}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(s.colors.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)=>(_.test(e)&&(e=e.replace(_,"$1$3")),_.test(t)&&(t=t.replace(_,"$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 S,n=o.diff_linesToChars_(e,t),i=o.diff_main(n.chars1,n.chars2,!1);o.diff_charsToLines_(i,n.lineArray);let r=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:r+o+1,lineType:t})).slice(0,n);return-1!==t&&(r+=n),i}).flat()}async generateFilesDiff(e){if("equal"===e.state){const t=this.pathToPosix(y.join(".",e.relativePath,e.name1??"")),o=this.pathToPosix(y.join(".",e.relativePath,e.name2??""));return this.diffFileTemplate(`<span class="renamed"\n >Renamed <span class="from">${t}</span> -> <span class="to">${o}</span></span\n >`,this.diffTableTemplate(this.diffLineMessageTemplate("No changes")))}const t=e.path1&&e.name1?y.join(e.path1,e.name1):null,o=e.path2&&e.name2?y.join(e.path2,e.name2):null,n=this.pathToPosix(y.join(".",e.relativePath,(e.name1||e.name2)??""));if("left"===e.state&&t)return this.diffFileTemplate(`<span class="removed">Removed ${n}</span>`,this.diffTableTemplate(this.diffLineMessageTemplate("File removed")));if("right"===e.state&&o)return this.diffFileTemplate(`<span class="added">Added ${n}</span>`,this.diffTableTemplate(this.diffLineMessageTemplate("File added")));if("distinct"===e.state&&t&&o){const i=this.pathToPosix(y.join(".",e.relativePath,e.name1??"")),r=this.pathToPosix(y.join(".",e.relativePath,e.name2??"")),s=e.name1!==e.name2?`<span class="renamed"\n >Renamed <span class="from">${i}</span> -> <span class="to">${r}</span></span\n >`:n;return this.diffFileTemplate(s,await f.isBinaryFile(t)||await f.isBinaryFile(o)?this.diffTableTemplate(this.diffLineMessageTemplate("Binary file")):this.getDiffTableHTML(await this.generateAssetFilesDiff(P.readFileSync(t,"utf-8"),P.readFileSync(o,"utf-8"))))}return""}async generateChangelog(){this.logger.info(s.colors.green("Generating changelog"));const e=await this.generateAssetFoldersDiff(),t=(await Promise.all(e.map(e=>this.generateFilesDiff(e)))).join("");this.logger.info(s.colors.green("Writing changelog file"));const o=this.changelogTemplate.split("%FILES%");o.splice(1,0,t);const n=o.join("");P.writeFileSync(y.join(this.destinationPath,this.changelogFilename),n),this.logger.info(s.colors.green(`Changelog file written to ${y.join(this.destinationPath,this.changelogFilename)}`))}}class j{sourceDir;outputDir;fontName;constructor(e){this.sourceDir=e.sourceDir,this.outputDir=e.outputDir,this.fontName=e.fontName}async generate(){await k({src:this.sourceDir,dist:this.outputDir,fontName:this.fontName,css:!0,typescript:!0,startUnicode:59905,svgicons2svgfont:{fontHeight:1024}})}}class C{wss;eventListeners=new Map;lifecycleListeners=new Map;clients=new Map;ws;constructor(){this.wss=new v.WebSocketServer({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===v.WebSocket.OPEN&&e.send(t)}}}}handleUpgrade(e,t,o){return(e.url??"").split("?")[0]===s.PP_DEV_HMR_WS_PATH&&(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){s.createLogger().error(`ws handler for "${o.event}" failed`,{error:e instanceof Error?e:new Error(String(e))})}}sendToSocket(e,t,o){e.readyState===v.WebSocket.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 A=r.cac("pp-dev");function N(e,t,o){const n=[...s.PP_DEV_CONFIG_NAMES,"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(t=>y.join(e,t)),r=i.watch(n,{ignored:e=>{const t=y.basename(e);return/(^|[\/\\])\../.test(e)&&!t.startsWith(".env")&&!t.startsWith(".pp-dev")&&!t.startsWith(".pp-watch")},persistent:!0,ignoreInitial:!0,followSymlinks:!1});let a=null;return r.on("change",n=>{o(s.colors.blue(`🔧 Config file changed: ${y.relative(e,n)}`)),a&&clearTimeout(a),a=setTimeout(async()=>{try{o(s.colors.yellow("🔄 Restarting dev server due to config change...")),await t()}catch(e){o(s.colors.red(`❌ Failed to restart dev server: ${e?.message}. Stack: ${e?.stack}`))}},500)}),r.on("error",e=>{o(s.colors.red(`❌ Config watcher error: ${e}`))}),{watcher:r,restartCallback:t,logger:o}}function R(e){e.watcher&&e.watcher.close()}function M(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 q(e){const{changelog:t,executionRoot:o,newAssetsPath:n,backupsDirPath:i,changelogDestinationPath:r,logLevel:a}=e;let l;if("string"==typeof t)l=y.resolve(o,t);else{if(!P.existsSync(i))return void s.createLogger(a).warn(s.colors.yellow("backups directory not found, skipping changelog generation"));const e=P.readdirSync(i,{withFileTypes:!0});if(!e.length)return void s.createLogger(a).warn(s.colors.yellow("no backups found, skipping changelog generation"));const t=e.filter(e=>e.isFile()&&e.name.endsWith(".zip"));if(!t.length)return void s.createLogger(a).warn(s.colors.yellow("no ZIP backups found, skipping changelog generation"));const o=t.reduce((e,t)=>P.statSync(y.resolve(i,e.name)).mtimeMs>P.statSync(y.resolve(i,t.name)).mtimeMs?e:t).name;l=y.resolve(i,o)}const c=new $({oldAssetsPath:l,newAssetsPath:n,destinationPath:r});await c.generateChangelog()}let O=global.__pp_dev_profile_session,V=0;const H=e=>{if(O)return new Promise((t,o)=>{O.post("Profiler.stop",(n,{profile:i})=>{if(n)o(n);else{const o=y.resolve(`./pp-dev-profile-${V++}.cpuprofile`);P.writeFileSync(o,JSON.stringify(i)),e(s.colors.yellow(`CPU profile written to ${s.colors.white(s.colors.dim(o))}`)),O=void 0,t()}})})},z=e=>{for(const[t,o]of Object.entries(e))Array.isArray(o)&&(e[t]=o[o.length-1])};function U(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}A.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"),A.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(e,t)=>{z(t);let o=null,i=null,r=!1;const c=e?y.resolve(process.cwd(),e):process.cwd(),d=s.createLogger(t.logLevel),p=async()=>{if(!r){r=!0;try{o&&(d.info(s.colors.yellow("🛑 Stopping existing dev server...")),await o.close(),o=null);const{clearConfigCache:f,getConfig:u}=await Promise.resolve().then(()=>require("./index-CtxApOJm.js")).then(e=>e.config);f();const{createServer:g}=await(import("vite")),h=t.mode||"development",m=y.resolve(process.cwd(),e??".");a.loadPPDevEnv(h,m);const v=await l.loadConfigFromFile({mode:h,command:"serve"},t.config,e,t.logLevel);let b=await a.getViteConfig(void 0,{mode:h,root:m});if(v){const{plugins:e,...t}=v.config;b=l.mergeConfig(b,t)}if(o=await g(l.mergeConfig(b,{root:e,base:t.base,mode:t.mode,configFile:t.config,logLevel:t.logLevel,clearScreen:t.clearScreen,optimizeDeps:{force:t.force},server:U(t),customLogger:d},!0)),!o.config.base||"/"===o.config.base)throw new Error('base cannot be equal to "/" or empty string');if(!o.httpServer)throw new Error("HTTP server not available");await o.listen();const w=global.__pp_dev_start_time??!1,P=w?s.colors.dim(`ready in ${s.colors.reset(s.colors.bold(Math.ceil(n.performance.now()-w)))} ms`):"";d.info(`\n ${s.colors.green(`${s.colors.bold("PP-DEV")} v${s.VERSION}`)} ${P}\n`),o.printUrls();const x=await u(m);if(!1!==x.inspector?.enabled){const e=o.resolvedUrls?.local[0],t=e?new URL(e).origin:`http://localhost:${o.config.server.port??5173}`;d.info(`\n ${s.colors.cyan("🔍 Request Inspector")} ${s.colors.dim(t+s.INSPECTOR_PATH)}\n`)}!function(e,t){if(!e.httpServer||!process.stdin.isTTY||process.env.CI)return;e._shortcutsOptions=t;const o=s.createLogger();t.print&&o.info(s.colors.dim(s.colors.green(" ➜"))+s.colors.dim(" press ")+s.colors.bold("h")+s.colors.dim(" to show help"));const n=(t.customShortcuts??[]).filter(D).concat(I);F?.(),F=null;let i=!1;const r=process.stdin.isPaused(),a=process.stdin,l=Boolean(a.isRaw),c=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(["",s.colors.bold(" Shortcuts"),...n.map(e=>s.colors.dim(" press ")+s.colors.bold(e.key)+s.colors.dim(` to ${e.description}`))].join("\n"));const r=n.find(e=>e.key===t);r&&(i=!0,await r.action(e),i=!1)};process.stdin.setRawMode(!0),process.stdin.on("data",c).setEncoding("utf8").resume();const d=e.httpServer,p=()=>{F===p&&(d.removeListener("close",p),process.stdin.off("data",c),l||process.stdin.setRawMode(!1),r&&process.stdin.pause(),F=null)};F=p,d.on("close",p)}(o,{print:!0,customShortcuts:[...O?[{key:"p",description:"start/stop the profiler",async action(e){if(O)await H(d.info);else{const e=await import("node:inspector").then(e=>e.default);await new Promise(t=>{O=new e.Session,O.connect(),O.post("Profiler.enable",()=>{O?.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("/")}`}})}}]}),i||(i=N(c,p,d.info),d.info(s.colors.blue("🔧 Config file watcher started"))),r=!1}catch(e){r=!1,d.error(s.colors.red(`error when starting dev server:\n${e.stack}`),{error:e}),H(d.info),process.exit(1)}}},f=async e=>{d.info(s.colors.yellow(`\n🛑 Received ${e}, shutting down gracefully...`));try{i&&(R(i),i=null),o&&(await o.close(),o=null),H(d.info),d.info(s.colors.green("✅ Graceful shutdown completed")),process.exit(0)}catch(e){d.error(s.colors.red(`❌ Error during graceful shutdown: ${e}`)),process.exit(1)}};process.on("SIGINT",()=>f("SIGINT")),process.on("SIGTERM",()=>f("SIGTERM")),process.on("uncaughtException",e=>{d.error(s.colors.red(`❌ Uncaught Exception: ${e}`)),f("uncaughtException")}),process.on("unhandledRejection",(e,t)=>{d.error(s.colors.red(`❌ Unhandled Rejection at: ${t}, reason: ${e}`)),f("unhandledRejection")}),await p()}),A.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(e,t)=>{z(t);let n=null,i=null,r=null,l=null,d=!1;const p=s.createLogger(),f=async()=>{if(!d){d=!0;try{const{next:g,constants:h}=await a.safeNextImport(),{PHASE_DEVELOPMENT_SERVER:m}=h;r&&(await r.close(),r=null),i&&(p.info(s.colors.yellow("🛑 Stopping existing Next.js server...")),await new Promise(e=>{i.close(()=>{i=null,e()})})),n&&"function"==typeof n.close&&(await n.close(),n=null);const{clearConfigCache:v}=await Promise.resolve().then(()=>require("./index-CtxApOJm.js")).then(e=>e.config);v();const{join:b,basename:w}=await(import("path")),{createServer:x}=await(import("http")),S=await(import("next/dist/server/config.js")),E=S.default.default||S["module.exports"].default||S.default,T=U(t),L=e?b(process.cwd(),e):process.cwd();a.loadPPDevEnv(t.mode||"development",L),p.info(L);const k=await E(m,L);let D=k?.ppDev||{};if(0===Object.keys(D).length)try{const{getConfig:e}=await Promise.resolve().then(()=>require("./index-CtxApOJm.js")).then(e=>e.config),t=await e(L);Object.keys(t).length>0?(D=t,p.info(s.colors.blue("🔧 Loaded pp-dev config from standalone config file"))):p.info(s.colors.yellow("⚠️ No pp-dev config found in Next.js config or standalone file, using defaults"))}catch(e){p.info(s.colors.yellow("⚠️ Failed to load standalone pp-dev config, using defaults")),console.debug("Error loading standalone config:",e)}else p.info(s.colors.blue("🔧 Loaded pp-dev config from Next.js config"));let F=null;try{const{getPkg:e}=await Promise.resolve().then(()=>require("./index-CtxApOJm.js")).then(e=>e.config);F=e(L).name}catch{F=w(L)}s.validatePPDevConfig(D,F??"");const I=s.normalizePPDevConfig(D,F??""),_=I.backendBaseURL??"http://localhost:8080",$=I.templateLess,j=I.v7Features,A=I.disableSSLValidation,q=I.enableProxyCache,O=I.proxyCacheTTL,V=I.personalAccessToken,H=I.miHudLess,z=I.inspectorEnabled,W=I.inspectorMaxMemory,B=I.inspectorCaptureLimit,Z=I.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,G=k?.basePath;let J="";G?J=G:(J=$?s.PATH_PAGE_PREFIX:j?s.PATH_TEMPLATE_LOCAL_PREFIX:s.PATH_TEMPLATE_PREFIX,J+=`/${F}`);const X=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}:{}}(t),K=async e=>{delete process.env.TURBOPACK,n&&"function"==typeof n.close&&(await n.close(),n=null);const t={dev:!0,customServer:!0,hostname:T.host||"localhost",port:T.port,dir:L,conf:{...k,basePath:J,assetPrefix:J}};e.webpack?t.webpack=!0:e.turbopack&&(t.turbopack=!0),n=g(t),await n.prepare()};if(X.webpack)await K({webpack:!0});else if(X.turbopack)try{await K({turbopack:!0})}catch(e){if(!M(e))throw e;p.warn(s.colors.yellow("⚠ Turbopack is unavailable (native bindings). Falling back to Webpack.")),await K({webpack:!0})}else try{await K({})}catch(e){if(!M(e))throw e;p.warn(s.colors.yellow("⚠ Turbopack cannot run (native Next.js bindings unavailable). Falling back to Webpack.")),await K({webpack:!0})}if(!n)throw new Error("Next.js app failed to initialize");if(J.endsWith("/")||(J+="/"),"/"===J)throw new Error('basePath cannot be equal to "/" or equal to empty string');p.info(s.colors.green("✅ Next.js app prepared successfully")),p.info(s.colors.blue(`🔧 pp-dev plugin configured for template: ${F}`)),p.info(s.colors.blue(`🔧 Base path configured: ${J}`)),_&&(p.info(s.colors.blue(`🌐 Backend URL: ${_}`)),p.info(s.colors.blue(`🆔 Custom App ID: ${Z}`)));const Y=n.getRequestHandler(),Q="number"==typeof T.port?T.port:3e3,ee="string"==typeof T.host?T.host||"0.0.0.0":"localhost",te=new Set;i=x(async(e,t)=>{try{const o=e.url||"/",n=o.split("?")[0];let i=c.parse(o,!0);if(ne.length>0){if(n.startsWith("/_next/")||"/favicon.ico"===n||n.startsWith("/__nextjs_")){if(ie.length>0){let l=0;const d=()=>{if(l>=ie.length)return void r();const o=ie[l];l++,o(e,t,d)};return void d()}return void r()}let s=0;const a=()=>{if(s>=ne.length)return void r();const o=ne[s];s++,o(e,t,a)};return void a()}async function r(){if(n.startsWith(J))i=c.parse(o,!0);else{if(n===J.replace(/\/$/,"")){const e=o.replace(n,J);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:J}),void t.end()}await Y(e,t,i)}r()}catch(f){p.error(`Error handling request: ${f instanceof Error?f.message:String(f)}`,{error:f instanceof Error?f:void 0}),t.statusCode=500,t.end("Internal Server Error")}});let oe=null,ne=[],ie=[];if(!1!==z){const e=new s.RequestStore(W);s.registerInspectorRoutes(s.internalServer,e,B);const t=s.createRequestCaptureMiddleware(e,B);ne.push(t)}if(_){const e=new URL(_).host;_.startsWith("https://")&&(o.EventEmitter.defaultMaxListeners=Math.max(o.EventEmitter.defaultMaxListeners,20));const t={headers:{host:e,referer:_,origin:_.replace(/^(https?:\/\/)([^/]+)(\/.*)?$/i,"$1$2")},appId:Z,templateLess:$,disableSSLValidation:A,v7Features:j,personalAccessToken:V??process.env.MI_ACCESS_TOKEN};oe=new s.MiAPI(_,t);const l=s.initPPRedirect(J,F??void 0),c=(e,t,o)=>{l(e,t,o)};ie.push(c),ne.push(c);const d=a.createDevPanelAssetMiddleware(J);if(ie.push(d),ne.push(d),q){let e=+O;(!e||Number.isNaN(e)||e<0)&&(e=6e5);const t={devServer:{middlewares:{use:e=>e},config:{logger:console}},ttl:e},o=s.initProxyCache(t),n=(e,t,n)=>{o(e,t,n)};ne.push(n),p.info(s.colors.blue(`🔧 Proxy cache middleware added with TTL: ${e}ms`))}const f=new RegExp(`^((${u=J,u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})|/)$`),g=s.initLoadPPData(f,oe,Object.assign({base:J},t,{miHudLess:H})),m=(e,t,o)=>{g(e,t,o)};ne.push(m);const v=J.endsWith("/")?J.substring(0,J.length-1):J,b={middlewares:{use:e=>e},config:{logger:console}},x=s.initProxy({devServer:b,baseURL:_,proxyIgnore:["/@vite","/@metricinsights","/@",v,"/_next","/favicon.ico","/__nextjs_","/installHook.js.map"],disableSSLValidation:A,miAPI:oe,templateName:F??void 0}),S=(e,t,o)=>{x(e,t,o)};ne.push(S);const T=s.internalServer,D=(e,t,o)=>{if(e.url?.startsWith("/@api/")||e.url?.startsWith(s.INSPECTOR_PATH)||e.url?.startsWith(s.VARIABLES_EDITOR_PATH)){return void T(e,t,()=>{})}o()};ie.push(D),ne.push(D);const N=s.initRewriteResponse(e=>{const t=e.split("?")[0];return t.startsWith(J)&&!t.includes("/_next/")},(t,o)=>{const n=oe.buildPage(t,H),i=a.injectDevPanel(n,J,{backendBaseURL:_,templateLess:$,appId:Z,devPanelPosition:I.devPanelPosition,devPanelHidden:I.devPanelHidden,devPanelAutoHide:I.devPanelAutoHide});return Buffer.from(s.urlReplacer(e,o.headers.host??"",i))}),R=(e,t,o)=>{N(e,t,o)};ne.push(R),r=new C;let M=k?.distDir;try{process.env[s.PP_DEV_NEXT_BUILD_ENV_VAR]="1";const e=await E(h.PHASE_PRODUCTION_BUILD,L);M=e?.distDir??M}catch{}const z=(M??"").replace(/\\/g,"/").replace(/\/+$/,"").replace(/\/dev$/,""),U=z&&".next"!==z?z:"out";let W,B="0.0.0";try{const e=JSON.parse(P.readFileSync(y.join(L,"package.json"),"utf-8"));B="string"==typeof e.version?e.version:B,W="string"==typeof e.repository?e.repository:e.repository?.url}catch{}const G=new s.DistService(F??w(L),{root:L,backupFolder:y.resolve(L,I.syncBackupsDir),nextBuild:{projectRoot:L,distDir:U,packageVersion:B,packageRepositoryUrl:W}}),X={ws:r.ws,config:{clientInjectionPlugin:{v7Features:j}}};new s.ClientService(X,{distService:G,miAPI:oe}),s.registerVariablesEditorRoutes(s.internalServer,{distService:G,miAPI:oe});const K="function"==typeof n?.getUpgradeHandler?n.getUpgradeHandler():null;i.on("upgrade",(e,t,o)=>{r?.handleUpgrade(e,t,o)||(K?K(e,t,o):t.destroy())}),p.info(s.colors.blue(`🔧 ${ne.length} pp-dev middlewares initialized`)),p.info(s.colors.blue(`🔧 ${ie.length} essential middlewares for internal routes`)),p.info(s.colors.blue(`🔧 MiAPI initialized for backend: ${_}`)),p.info(s.colors.blue(`🔧 Custom App ID: ${Z}`))}i.listen(Q,ee,()=>{p.info(s.colors.green(`✅ pp-dev Next.js server running at http://${ee}:${Q}`)),p.info(s.colors.blue(`📱 Next.js app accessible at http://${ee}:${Q}${J}`)),!1!==z&&p.info(s.colors.cyan(`🔍 Request Inspector: http://${ee}:${Q}${s.INSPECTOR_PATH}`)),p.info(s.colors.blue("🔧 Base path handling active")),l||(l=N(L,f,p.info),p.info(s.colors.blue("🔧 Config file watcher started"))),i.on("connection",e=>{te.add(e),e.on("close",()=>te.delete(e))});const e=async e=>{p.info(s.colors.yellow(`\n🛑 Received ${e}, shutting down gracefully...`));const t=setTimeout(()=>{p.info(s.colors.yellow("⏰ Shutdown timeout reached, forcing exit")),process.exit(0)},5e3);try{l&&(R(l),l=null);for(const e of Array.from(te))e.destroy();te.clear(),r&&(await r.close(),r=null),await new Promise(e=>{i.close(()=>{p.info(s.colors.yellow("🛑 HTTP server closed")),e()})}),n&&"function"==typeof n.close&&(await n.close(),p.info(s.colors.yellow("🛑 Next.js app closed"))),clearTimeout(t),p.info(s.colors.green("✅ Graceful shutdown completed")),process.exit(0)}catch(e){clearTimeout(t),p.error(s.colors.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,p.info(s.colors.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=>{p.error(s.colors.red(`❌ Uncaught Exception: ${t}`)),e("uncaughtException")}),t.on("unhandledRejection",(t,o)=>{p.error(s.colors.red(`❌ Unhandled Rejection at: ${o}, reason: ${t}`)),e("unhandledRejection")}),p.info(s.colors.green("✅ Process event handlers registered successfully"))}catch(e){p.warn(s.colors.yellow(`⚠️ Failed to register process event handlers: ${e}`))}else p.warn(s.colors.yellow("⚠️ process.on is not available, graceful shutdown handlers will not be registered")),p.info(s.colors.blue("💡 This might be due to bundling or environment constraints"))}),d=!1}catch(e){d=!1,p.error(s.colors.red(`❌ Failed to start Next.js server: ${e?.message}. Stack: ${e?.stack}`)),e instanceof Error&&e.message.includes("Next.js is required")&&(p.error(s.colors.red("❌ Next.js Peer Dependency Error:")),p.error(s.colors.red(e.message)),p.error(s.colors.yellow("\n💡 To fix this issue:")),p.error(s.colors.blue(" 1. Install Next.js in your project:")),p.error(s.colors.white(" npm install next@^16")),p.error(s.colors.blue(" 2. Or use yarn:")),p.error(s.colors.white(" yarn add next@^16")),p.error(s.colors.blue(" 3. Or use pnpm:")),p.error(s.colors.white(" pnpm add next@^16")),p.error(s.colors.yellow("\n📖 For more information, see:")),p.error(s.colors.blue(" https://nextjs.org/docs/getting-started"))),process.exit(1)}var u}},u=async e=>{p.info(s.colors.yellow(`\n🛑 Received ${e}, shutting down gracefully...`));try{l&&(R(l),l=null),r&&(await r.close(),r=null),i&&await new Promise(e=>{i.close(()=>{i=null,e()})}),n&&"function"==typeof n.close&&(await n.close(),n=null),p.info(s.colors.green("✅ Graceful shutdown completed")),process.exit(0)}catch(e){p.error(s.colors.red(`❌ Error during graceful shutdown: ${e}`)),process.exit(1)}};process.on("SIGINT",()=>u("SIGINT")),process.on("SIGTERM",()=>u("SIGTERM")),process.on("uncaughtException",e=>{p.error(s.colors.red(`❌ Uncaught Exception: ${e}`)),u("uncaughtException")}),process.on("unhandledRejection",(e,t)=>{p.error(s.colors.red(`❌ Unhandled Rejection at: ${t}, reason: ${e}`)),u("unhandledRejection")}),await f()}),A.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(e,t)=>{z(t);const o=U(t),n=a.resolveBuildCliOverrides(t);try{const i=t.mode||"production",r=y.resolve(process.cwd(),e??".");a.loadPPDevEnv(i,r);const s=await l.loadConfigFromFile({mode:i,command:"build"},t.config,e,t.logLevel);let c=await a.getViteConfig(n,{mode:i,root:r});if(s){const{plugins:e,...t}=s.config;c=l.mergeConfig(c,t)}const d=l.mergeConfig(c,{root:e,base:t.base,mode:t.mode,configFile:t.config,logLevel:t.logLevel,clearScreen:t.clearScreen,optimizeDeps:{force:t.force},build:o},!0);if(await l.build(d),o.changelog){const n=e||process.cwd(),i=d.build?.outDir||"dist";let r="dist-zip";d.ppDevConfig&&(!1===d.ppDevConfig.distZip?r=i:"object"==typeof d.ppDevConfig.distZip&&"string"==typeof d.ppDevConfig.distZip.outDir&&(r=d.ppDevConfig.distZip.outDir)),await q({changelog:o.changelog,executionRoot:n,newAssetsPath:y.resolve(n,i),backupsDirPath:y.resolve(n,d.ppDevConfig?.syncBackupsDir||"backups"),changelogDestinationPath:y.resolve(n,r),logLevel:t.logLevel})}}catch(e){s.createLogger(t.logLevel).error(s.colors.red(`error during build:\n${e.stack}`),{error:e}),process.exit(1)}finally{H(e=>s.createLogger(t.logLevel).info(e))}}),A.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(e,t)=>{z(t);const o=s.createLogger(t.logLevel),n=e?y.resolve(process.cwd(),e):process.cwd(),i=a.resolveBuildCliOverrides(t);process.env[s.PP_DEV_NEXT_BUILD_ENV_VAR]="1";try{a.loadPPDevEnv(t.mode||"production",n);const{constants:e}=await a.safeNextImport(),r=await(import("next/dist/server/config.js")),l=r.default.default||r["module.exports"].default||r.default,c=await l(e.PHASE_PRODUCTION_BUILD,n);let d,p=c?.ppDev||{};if(0===Object.keys(p).length){const{getConfig:e}=await Promise.resolve().then(()=>require("./index-CtxApOJm.js")).then(e=>e.config);p=await e(n)}try{const{getPkg:e}=await Promise.resolve().then(()=>require("./index-CtxApOJm.js")).then(e=>e.config);d=e(n).name}catch{d=y.basename(n)}const f=s.normalizePPDevConfig(p,d),u=a.applyDistZipOverride(f.distZip,i,s.createDefaultZipFileName(d)),g=a.applyVersionManifestOverride(f.versionPlugin,i);o.info(s.colors.cyan("[pp-dev] Running `next build`...")),await s.runNextBuildProcess(n);const h="string"==typeof c?.distDir&&c.distDir?c.distDir:".next",m=".next"===h?"out":h,v=y.resolve(n,m);if(!P.existsSync(v)||!P.statSync(v).isDirectory())throw new Error(`Next.js build output directory not found: ${v}. "next-build" requires "output: 'export'" in next.config (static export).`);const b=JSON.parse(P.readFileSync(y.join(n,"package.json"),"utf-8"));if(!1!==g&&!1!==g.enabled&&(s.writeBuildVersionManifest({outDir:v,packageVersion:"string"==typeof b.version?b.version:"0.0.0",versionFileTemplate:g.versionFileTemplate,packageRepositoryUrl:"string"==typeof b.repository?b.repository:b.repository?.url,enabled:g.enabled}),o.info(s.colors.green(`✅ VERSION / BUILD-MANIFEST written to ${y.relative(n,v)}`))),!1!==u){const e=y.resolve(n,u.outDir),t=u.inDir?y.resolve(v,u.inDir):v,i=s.resolveOutputFilePath(e,u.outFileName,"ZIP output file name");P.mkdirSync(y.dirname(i),{recursive:!0});const r=await s.zipDirectoryToBuffer(t);P.writeFileSync(i,r),o.info(s.colors.green(`✅ Zip archive written to ${y.relative(n,i)}`))}if(t.changelog){const e=!1!==u?u.outDir:m;await q({changelog:t.changelog,executionRoot:n,newAssetsPath:v,backupsDirPath:y.resolve(n,f.syncBackupsDir),changelogDestinationPath:y.resolve(n,e),logLevel:t.logLevel})}}catch(e){s.createLogger(t.logLevel).error(s.colors.red(`error during next-build:\n${e.stack}`),{error:e}),process.exit(1)}finally{H(e=>s.createLogger(t.logLevel).info(e))}}),A.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(e,t,o)=>{z(o);const{oldAssetsPath:n=e,newAssetsPath:i=t,destination:r=".",filename:a="CHANGELOG.html",logLevel:l}=o,c=process.cwd();n&&i||(s.createLogger(l).error(s.colors.red("error during changelog generation: oldAssetPath and newAssetPath are required")),process.exit(1));const d=y.resolve(c,n),p=y.resolve(c,i),f=y.resolve(c,r),u=new $({oldAssetsPath:d,newAssetsPath:p,destinationPath:f,changelogFilename:a});await u.generateChangelog()}),A.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(e,t,o)=>{z(o);const{source:n=e,destination:i=t,fontName:r="icon-font"}=o,a=process.cwd(),l=y.resolve(a,n),c=y.resolve(a,i),d=new j({sourceDir:l,outputDir:c,fontName:r}),p=s.createLogger(o.logLevel);p.info(`Generating icon font from SVG files in ${s.colors.dim(l)}`),await d.generate(),p.info(`Icon font generated and saved to ${s.colors.dim(c)}`)}),A.command("optimize [root]","pre-bundle dependencies").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle").action(async(e,t)=>{z(t);try{const o=t.mode||"production",n=y.resolve(process.cwd(),e??".");a.loadPPDevEnv(o,n);const i=await l.loadConfigFromFile({mode:o,command:"build"},t.config,e,t.logLevel);let r=await a.getViteConfig(void 0,{mode:o,root:n});if(i){const{plugins:e,...t}=i.config;r=l.mergeConfig(r,t)}const s=await l.resolveConfig(l.mergeConfig(r,{root:e,base:t.base,configFile:t.config,logLevel:t.logLevel,mode:t.mode}),"serve");await l.optimizeDeps(s,t.force,!0)}catch(e){s.createLogger(t.logLevel).error(s.colors.red(`error when optimizing deps:\n${e.stack}`),{error:e}),process.exit(1)}}),A.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)=>{z(t);try{const o=t.mode||"production",n=y.resolve(process.cwd(),e??".");a.loadPPDevEnv(o,n);const i=await l.loadConfigFromFile({mode:o,command:"build"},t.config,e,t.logLevel);let r=await a.getViteConfig(void 0,{mode:o,root:n});if(i){const{plugins:e,...t}=i.config;r=l.mergeConfig(r,t)}(await l.preview(l.mergeConfig(r,{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){s.createLogger(t.logLevel).error(s.colors.red(`error when starting preview server:\n${e.stack}`),{error:e}),process.exit(1)}finally{H(e=>s.createLogger(t.logLevel).info(e))}}),A.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(e,t)=>{const o=s.createLogger(t.logLevel),{isLegacyFlatConfig:n,isLegacyPPWatchConfig:i,isAlreadyMigrated:r,migrateLegacyFlatConfig:a,migratePPWatchConfig:l,generateConfigFileContent:c,discoverMigrateSource:d,loadPackageJsonMigrateConfig:p}=await Promise.resolve().then(()=>require("./migrate-t_tUHdbD.js")),f=t.format??"ts",u=!1!==t.backup,g=process.cwd(),h=d(g,e);h||(o.warn(s.colors.yellow("No pp-dev or pp-watch config file found in the current directory.")),o.info(s.colors.blue('Supported files: pp-dev.config.{ts,js,cjs,mjs,json}, .pp-watch.config.{ts,js,json}, or a "pp-dev" field in package.json')),process.exit(1));const{sourceFile:m,isWatchConfig:v,isPackageJsonConfig:b}=h;o.info(s.colors.blue(`Found config: ${y.relative(g,m)}`));const{getPkg:w}=await Promise.resolve().then(()=>require("./index-CtxApOJm.js")).then(e=>e.config),x=w();let S,E={};try{if(/\.[cm]?ts$/i.test(m)){const e=await(import("esbuild")),{pathToFileURL:t}=await(import("url")),o=(await e.build({absWorkingDir:g,entryPoints:[m],outfile:"out.js",write:!1,target:"node24",platform:"node",bundle:!0,packages:"external",format:"esm",mainFields:["main"]})).outputFiles[0].text,n=`pp-migrate-tmp-${Date.now()}.mjs`;P.writeFileSync(n,o);try{const e=await(import(t(y.resolve(g,n)).toString()));E=e.default?.default??e.default??e}finally{P.existsSync(n)&&P.unlinkSync(n)}}else if(/\.[cm]?js$/i.test(m)){const{pathToFileURL:e}=await(import("url")),t=await(import(e(y.resolve(g,m)).toString()));E=t.default?.default??t.default??t}else b?E=p(m):m.endsWith(".json")&&(E=JSON.parse(P.readFileSync(m,"utf-8")))}catch(e){o.error(s.colors.red(`Failed to load config file: ${e.message}`)),process.exit(1)}E&&"object"==typeof E||(o.error(s.colors.red("Config file did not export a valid object.")),process.exit(1)),r(E)?(o.info(s.colors.green("Config is already in 1.0 format — nothing to migrate.")),process.exit(0)):v||i(E)?(o.info(s.colors.blue("Detected pp-watch config format → migrating to 1.0")),S=l(E)):n(E)?(o.info(s.colors.blue("Detected 0.x flat config format → migrating to 1.0")),S=a(E,x.name)):(o.warn(s.colors.yellow("Could not detect config format. No known keys found.")),process.exit(1));const T=c(S,f),L=t.output??y.join(g,`pp-dev.config.${f}`);if(t.dryRun&&(o.info(s.colors.green(`\n--- Migrated config (dry-run) → ${y.relative(g,L)} ---\n`)),process.exit(0)),u&&!b&&P.existsSync(m)){const e=`${m}.bak`;P.copyFileSync(m,e),o.info(s.colors.blue(`Backed up original to: ${y.relative(g,e)}`))}P.writeFileSync(L,T,"utf-8"),o.info(s.colors.green(`✅ Migration complete → ${y.relative(g,L)}`)),b?o.info(s.colors.yellow('You can now remove the "pp-dev" field from package.json.')):m!==L&&P.existsSync(m)&&o.info(s.colors.yellow(`You can now delete the old config: ${y.relative(g,m)}`))}),A.help(),A.version(s.VERSION),A.parse(),exports.stopProfiler=H;
1
+ "use strict";const e=require("path"),t=require("fs"),o=require("node:events"),n=require("node:perf_hooks"),i=require("chokidar"),r=require("cac"),s=require("./plugin-BcxTOlCf.js"),a=require("./index-Cab7kIQH.js"),l=require("vite"),c=require("url"),d=require("dir-compare"),p=require("diff-match-patch"),f=require("isbinaryfile"),u=require("os"),g=require("crypto"),h=require("extract-zip"),m=require("svgtofont"),v=require("ws");require("http-proxy-middleware"),require("picocolors"),require("node:string_decoder"),require("axios"),require("node:http"),require("node:https"),require("jsdom"),require("process"),require("child_process"),require("node:path"),require("jszip"),require("module"),require("memory-cache"),require("zlib"),require("express"),require("node:crypto"),require("./helpers.js"),require("ejs");const b=e=>e&&"object"==typeof e&&"default"in e?e.default:e;function w(e){if(e&&"object"==typeof e&&"default"in e)return e;const t=Object.create(null);if(e)for(const o in e)t[o]=e[o];return t.default=e,Object.freeze(t)}const y=w(e),P=w(t),x=w(d),S=b(p),E=w(u),T=w(g),L=b(h),k=b(m);function D(e){return null!=e&&!1!==e}let F=null;const I=[{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 _=/(.+)(-[a-f0-9]{6,20})(\.[a-z0-9]+)$/i;class ${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(e){const{oldAssetsPath:t,newAssetsPath:o,destinationPath:n,changelogTemplate:i,diffFileTemplateHandler:r,diffLineTemplateHandler:a,changelogFilename:l,contextLines:c}=e;if(this.logger=s.createLogger(),!t||!o||!n)throw new Error("Previous assets path, current assets path and destination path are required");if(t===o)throw new Error("Previous and current assets paths must be different");if(!this.isExists(t))throw new Error(`Previous assets path ${t} does not exist`);if(!this.isExists(o))throw new Error(`Current assets path ${o} does not exist`);if(this.isZipFile(t)){const e=y.resolve(E.tmpdir(),T.createHash("md5").update(t).digest("hex"));this.oldAssetsPath=this.unzipFile(t,e).then(()=>this.normalizeAssetFolderPath(e)).then(e=>{if(this.isEmptyFolder(e))throw new Error(`Previous assets path ${e} is empty`);return e})}else{if(!this.isFolder(t))throw new Error(`Invalid previous assets path ${t}. It must be a folder or a zip file`);{const e=this.normalizeAssetFolderPath(t);if(this.isEmptyFolder(e))throw new Error(`Previous assets path ${e} is empty`);this.oldAssetsPath=Promise.resolve(e)}}if(this.isZipFile(o)){const e=y.resolve(E.tmpdir(),T.createHash("md5").update(o).digest("hex"));this.newAssetsPath=this.unzipFile(o,e).then(()=>this.normalizeAssetFolderPath(e)).then(e=>{if(this.isEmptyFolder(e))throw new Error(`Current assets path ${e} is empty`);return e})}else{if(!this.isFolder(o))throw new Error(`Invalid current assets path ${o}. It must be a folder or a zip file`);{const e=this.normalizeAssetFolderPath(o);if(this.isEmptyFolder(e))throw new Error(`Current assets path ${o} is empty`);this.newAssetsPath=Promise.resolve(e)}}this.destinationPath=n,this.mkdirpSync(this.destinationPath),this.changelogFilename=l||"CHANGELOG.html",i&&(this.templateIsValid(i)?this.changelogTemplate=i:this.logger.warn(s.colors.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 P.existsSync(e)}isZipFile(e){return e.endsWith(".zip")}isFolder(e){return P.lstatSync(e).isDirectory()}isEmptyFolder(e){return 0===P.readdirSync(e,{withFileTypes:!0}).length}mkdirpSync(e){P.existsSync(e)||P.mkdirSync(e,{recursive:!0})}async unzipFile(e,t){P.rmSync(t,{force:!0,recursive:!0}),await L(e,{dir:t}),await s.rejectSymlinks(t)}normalizeAssetFolderPath(e){const t=P.readdirSync(e);return 1===t.length&&P.lstatSync(y.join(e,t[0])).isDirectory()?this.normalizeAssetFolderPath(y.join(e,t[0])):e}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?"-":" "}">${r=o??"",r.replace(/[\u00A0-\u9999<>&]/g,e=>"&#"+e.charCodeAt(0)+";")}</span>\n </td>\n </tr>`;var r}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(s.colors.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)=>(_.test(e)&&(e=e.replace(_,"$1$3")),_.test(t)&&(t=t.replace(_,"$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 S,n=o.diff_linesToChars_(e,t),i=o.diff_main(n.chars1,n.chars2,!1);o.diff_charsToLines_(i,n.lineArray);let r=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:r+o+1,lineType:t})).slice(0,n);return-1!==t&&(r+=n),i}).flat()}async generateFilesDiff(e){if("equal"===e.state){const t=this.pathToPosix(y.join(".",e.relativePath,e.name1??"")),o=this.pathToPosix(y.join(".",e.relativePath,e.name2??""));return this.diffFileTemplate(`<span class="renamed"\n >Renamed <span class="from">${t}</span> -> <span class="to">${o}</span></span\n >`,this.diffTableTemplate(this.diffLineMessageTemplate("No changes")))}const t=e.path1&&e.name1?y.join(e.path1,e.name1):null,o=e.path2&&e.name2?y.join(e.path2,e.name2):null,n=this.pathToPosix(y.join(".",e.relativePath,(e.name1||e.name2)??""));if("left"===e.state&&t)return this.diffFileTemplate(`<span class="removed">Removed ${n}</span>`,this.diffTableTemplate(this.diffLineMessageTemplate("File removed")));if("right"===e.state&&o)return this.diffFileTemplate(`<span class="added">Added ${n}</span>`,this.diffTableTemplate(this.diffLineMessageTemplate("File added")));if("distinct"===e.state&&t&&o){const i=this.pathToPosix(y.join(".",e.relativePath,e.name1??"")),r=this.pathToPosix(y.join(".",e.relativePath,e.name2??"")),s=e.name1!==e.name2?`<span class="renamed"\n >Renamed <span class="from">${i}</span> -> <span class="to">${r}</span></span\n >`:n;return this.diffFileTemplate(s,await f.isBinaryFile(t)||await f.isBinaryFile(o)?this.diffTableTemplate(this.diffLineMessageTemplate("Binary file")):this.getDiffTableHTML(await this.generateAssetFilesDiff(P.readFileSync(t,"utf-8"),P.readFileSync(o,"utf-8"))))}return""}async generateChangelog(){this.logger.info(s.colors.green("Generating changelog"));const e=await this.generateAssetFoldersDiff(),t=(await Promise.all(e.map(e=>this.generateFilesDiff(e)))).join("");this.logger.info(s.colors.green("Writing changelog file"));const o=this.changelogTemplate.split("%FILES%");o.splice(1,0,t);const n=o.join("");P.writeFileSync(y.join(this.destinationPath,this.changelogFilename),n),this.logger.info(s.colors.green(`Changelog file written to ${y.join(this.destinationPath,this.changelogFilename)}`))}}class j{sourceDir;outputDir;fontName;constructor(e){this.sourceDir=e.sourceDir,this.outputDir=e.outputDir,this.fontName=e.fontName}async generate(){await k({src:this.sourceDir,dist:this.outputDir,fontName:this.fontName,css:!0,typescript:!0,startUnicode:59905,svgicons2svgfont:{fontHeight:1024}})}}class C{wss;eventListeners=new Map;lifecycleListeners=new Map;clients=new Map;ws;constructor(){this.wss=new v.WebSocketServer({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===v.WebSocket.OPEN&&e.send(t)}}}}handleUpgrade(e,t,o){return(e.url??"").split("?")[0]===s.PP_DEV_HMR_WS_PATH&&(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){s.createLogger().error(`ws handler for "${o.event}" failed`,{error:e instanceof Error?e:new Error(String(e))})}}sendToSocket(e,t,o){e.readyState===v.WebSocket.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 A=r.cac("pp-dev");function N(e,t,o){const n=[...s.PP_DEV_CONFIG_NAMES,"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(t=>y.join(e,t)),r=i.watch(n,{ignored:e=>{const t=y.basename(e);return/(^|[\/\\])\../.test(e)&&!t.startsWith(".env")&&!t.startsWith(".pp-dev")&&!t.startsWith(".pp-watch")},persistent:!0,ignoreInitial:!0,followSymlinks:!1});let a=null;return r.on("change",n=>{o(s.colors.blue(`🔧 Config file changed: ${y.relative(e,n)}`)),a&&clearTimeout(a),a=setTimeout(async()=>{try{o(s.colors.yellow("🔄 Restarting dev server due to config change...")),await t()}catch(e){o(s.colors.red(`❌ Failed to restart dev server: ${e?.message}. Stack: ${e?.stack}`))}},500)}),r.on("error",e=>{o(s.colors.red(`❌ Config watcher error: ${e}`))}),{watcher:r,restartCallback:t,logger:o}}function R(e){e.watcher&&e.watcher.close()}function M(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 q(e){const{changelog:t,executionRoot:o,newAssetsPath:n,backupsDirPath:i,changelogDestinationPath:r,logLevel:a}=e;let l;if("string"==typeof t)l=y.resolve(o,t);else{if(!P.existsSync(i))return void s.createLogger(a).warn(s.colors.yellow("backups directory not found, skipping changelog generation"));const e=P.readdirSync(i,{withFileTypes:!0});if(!e.length)return void s.createLogger(a).warn(s.colors.yellow("no backups found, skipping changelog generation"));const t=e.filter(e=>e.isFile()&&e.name.endsWith(".zip"));if(!t.length)return void s.createLogger(a).warn(s.colors.yellow("no ZIP backups found, skipping changelog generation"));const o=t.reduce((e,t)=>P.statSync(y.resolve(i,e.name)).mtimeMs>P.statSync(y.resolve(i,t.name)).mtimeMs?e:t).name;l=y.resolve(i,o)}const c=new $({oldAssetsPath:l,newAssetsPath:n,destinationPath:r});await c.generateChangelog()}let O=global.__pp_dev_profile_session,V=0;const H=e=>{if(O)return new Promise((t,o)=>{O.post("Profiler.stop",(n,{profile:i})=>{if(n)o(n);else{const o=y.resolve(`./pp-dev-profile-${V++}.cpuprofile`);P.writeFileSync(o,JSON.stringify(i)),e(s.colors.yellow(`CPU profile written to ${s.colors.white(s.colors.dim(o))}`)),O=void 0,t()}})})},z=e=>{for(const[t,o]of Object.entries(e))Array.isArray(o)&&(e[t]=o[o.length-1])};function U(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}A.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"),A.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(e,t)=>{z(t);let o=null,i=null,r=!1;const c=e?y.resolve(process.cwd(),e):process.cwd(),d=s.createLogger(t.logLevel),p=async()=>{if(!r){r=!0;try{o&&(d.info(s.colors.yellow("🛑 Stopping existing dev server...")),await o.close(),o=null);const{clearConfigCache:f,getConfig:u}=await Promise.resolve().then(()=>require("./index-Cab7kIQH.js")).then(e=>e.config);f();const{createServer:g}=await(import("vite")),h=t.mode||"development",m=y.resolve(process.cwd(),e??".");a.loadPPDevEnv(h,m);const v=await l.loadConfigFromFile({mode:h,command:"serve"},t.config,e,t.logLevel);let b=await a.getViteConfig(void 0,{mode:h,root:m});if(v){const{plugins:e,...t}=v.config;b=l.mergeConfig(b,t)}if(o=await g(l.mergeConfig(b,{root:e,base:t.base,mode:t.mode,configFile:t.config,logLevel:t.logLevel,clearScreen:t.clearScreen,optimizeDeps:{force:t.force},server:U(t),customLogger:d},!0)),!o.config.base||"/"===o.config.base)throw new Error('base cannot be equal to "/" or empty string');if(!o.httpServer)throw new Error("HTTP server not available");await o.listen();const w=global.__pp_dev_start_time??!1,P=w?s.colors.dim(`ready in ${s.colors.reset(s.colors.bold(Math.ceil(n.performance.now()-w)))} ms`):"";d.info(`\n ${s.colors.green(`${s.colors.bold("PP-DEV")} v${s.VERSION}`)} ${P}\n`),o.printUrls();const x=await u(m);if(!1!==x.inspector?.enabled){const e=o.resolvedUrls?.local[0],t=e?new URL(e).origin:`http://localhost:${o.config.server.port??5173}`;d.info(`\n ${s.colors.cyan("🔍 Request Inspector")} ${s.colors.dim(t+s.INSPECTOR_PATH)}\n`)}!function(e,t){if(!e.httpServer||!process.stdin.isTTY||process.env.CI)return;e._shortcutsOptions=t;const o=s.createLogger();t.print&&o.info(s.colors.dim(s.colors.green(" ➜"))+s.colors.dim(" press ")+s.colors.bold("h")+s.colors.dim(" to show help"));const n=(t.customShortcuts??[]).filter(D).concat(I);F?.(),F=null;let i=!1;const r=process.stdin.isPaused(),a=process.stdin,l=Boolean(a.isRaw),c=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(["",s.colors.bold(" Shortcuts"),...n.map(e=>s.colors.dim(" press ")+s.colors.bold(e.key)+s.colors.dim(` to ${e.description}`))].join("\n"));const r=n.find(e=>e.key===t);r&&(i=!0,await r.action(e),i=!1)};process.stdin.setRawMode(!0),process.stdin.on("data",c).setEncoding("utf8").resume();const d=e.httpServer,p=()=>{F===p&&(d.removeListener("close",p),process.stdin.off("data",c),l||process.stdin.setRawMode(!1),r&&process.stdin.pause(),F=null)};F=p,d.on("close",p)}(o,{print:!0,customShortcuts:[...O?[{key:"p",description:"start/stop the profiler",async action(e){if(O)await H(d.info);else{const e=await import("node:inspector").then(e=>e.default);await new Promise(t=>{O=new e.Session,O.connect(),O.post("Profiler.enable",()=>{O?.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("/")}`}})}}]}),i||(i=N(c,p,d.info),d.info(s.colors.blue("🔧 Config file watcher started"))),r=!1}catch(e){r=!1,d.error(s.colors.red(`error when starting dev server:\n${e.stack}`),{error:e}),H(d.info),process.exit(1)}}},f=async e=>{d.info(s.colors.yellow(`\n🛑 Received ${e}, shutting down gracefully...`));try{i&&(R(i),i=null),o&&(await o.close(),o=null),H(d.info),d.info(s.colors.green("✅ Graceful shutdown completed")),process.exit(0)}catch(e){d.error(s.colors.red(`❌ Error during graceful shutdown: ${e}`)),process.exit(1)}};process.on("SIGINT",()=>f("SIGINT")),process.on("SIGTERM",()=>f("SIGTERM")),process.on("uncaughtException",e=>{d.error(s.colors.red(`❌ Uncaught Exception: ${e}`)),f("uncaughtException")}),process.on("unhandledRejection",(e,t)=>{d.error(s.colors.red(`❌ Unhandled Rejection at: ${t}, reason: ${e}`)),f("unhandledRejection")}),await p()}),A.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(e,t)=>{z(t);let n=null,i=null,r=null,l=null,d=!1;const p=s.createLogger(),f=async()=>{if(!d){d=!0;try{const{next:g,constants:h}=await a.safeNextImport(),{PHASE_DEVELOPMENT_SERVER:m}=h;r&&(await r.close(),r=null),i&&(p.info(s.colors.yellow("🛑 Stopping existing Next.js server...")),await new Promise(e=>{i.close(()=>{i=null,e()})})),n&&"function"==typeof n.close&&(await n.close(),n=null);const{clearConfigCache:v}=await Promise.resolve().then(()=>require("./index-Cab7kIQH.js")).then(e=>e.config);v();const{join:b,basename:w}=await(import("path")),{createServer:x}=await(import("http")),S=await(import("next/dist/server/config.js")),E=S.default.default||S["module.exports"].default||S.default,T=U(t),L=e?b(process.cwd(),e):process.cwd();a.loadPPDevEnv(t.mode||"development",L),p.info(L);const k=await E(m,L);let D=k?.ppDev||{};if(0===Object.keys(D).length)try{const{getConfig:e}=await Promise.resolve().then(()=>require("./index-Cab7kIQH.js")).then(e=>e.config),t=await e(L);Object.keys(t).length>0?(D=t,p.info(s.colors.blue("🔧 Loaded pp-dev config from standalone config file"))):p.info(s.colors.yellow("⚠️ No pp-dev config found in Next.js config or standalone file, using defaults"))}catch(e){p.info(s.colors.yellow("⚠️ Failed to load standalone pp-dev config, using defaults")),console.debug("Error loading standalone config:",e)}else p.info(s.colors.blue("🔧 Loaded pp-dev config from Next.js config"));let F=null;try{const{getPkg:e}=await Promise.resolve().then(()=>require("./index-Cab7kIQH.js")).then(e=>e.config);F=e(L).name}catch{F=w(L)}s.validatePPDevConfig(D,F??"");const I=s.normalizePPDevConfig(D,F??""),_=I.backendBaseURL??"http://localhost:8080",$=I.templateLess,j=I.v7Features,A=I.disableSSLValidation,q=I.enableProxyCache,O=I.proxyCacheTTL,V=I.personalAccessToken,H=I.miHudLess,z=I.inspectorEnabled,W=I.inspectorMaxMemory,B=I.inspectorCaptureLimit,Z=I.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,G=k?.basePath;let J="";G?J=G:(J=$?s.PATH_PAGE_PREFIX:j?s.PATH_TEMPLATE_LOCAL_PREFIX:s.PATH_TEMPLATE_PREFIX,J+=`/${F}`);const X=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}:{}}(t),K=async e=>{delete process.env.TURBOPACK,n&&"function"==typeof n.close&&(await n.close(),n=null);const t={dev:!0,customServer:!0,hostname:T.host||"localhost",port:T.port,dir:L,conf:{...k,basePath:J,assetPrefix:J}};e.webpack?t.webpack=!0:e.turbopack&&(t.turbopack=!0),n=g(t),await n.prepare()};if(X.webpack)await K({webpack:!0});else if(X.turbopack)try{await K({turbopack:!0})}catch(e){if(!M(e))throw e;p.warn(s.colors.yellow("⚠ Turbopack is unavailable (native bindings). Falling back to Webpack.")),await K({webpack:!0})}else try{await K({})}catch(e){if(!M(e))throw e;p.warn(s.colors.yellow("⚠ Turbopack cannot run (native Next.js bindings unavailable). Falling back to Webpack.")),await K({webpack:!0})}if(!n)throw new Error("Next.js app failed to initialize");if(J.endsWith("/")||(J+="/"),"/"===J)throw new Error('basePath cannot be equal to "/" or equal to empty string');p.info(s.colors.green("✅ Next.js app prepared successfully")),p.info(s.colors.blue(`🔧 pp-dev plugin configured for template: ${F}`)),p.info(s.colors.blue(`🔧 Base path configured: ${J}`)),_&&(p.info(s.colors.blue(`🌐 Backend URL: ${_}`)),p.info(s.colors.blue(`🆔 Custom App ID: ${Z}`)));const Y=n.getRequestHandler(),Q="number"==typeof T.port?T.port:3e3,ee="string"==typeof T.host?T.host||"0.0.0.0":"localhost",te=new Set;i=x(async(e,t)=>{try{const o=e.url||"/",n=o.split("?")[0];let i=c.parse(o,!0);if(ne.length>0){if(n.startsWith("/_next/")||"/favicon.ico"===n||n.startsWith("/__nextjs_")){if(ie.length>0){let l=0;const d=()=>{if(l>=ie.length)return void r();const o=ie[l];l++,o(e,t,d)};return void d()}return void r()}let s=0;const a=()=>{if(s>=ne.length)return void r();const o=ne[s];s++,o(e,t,a)};return void a()}async function r(){if(n.startsWith(J))i=c.parse(o,!0);else{if(n===J.replace(/\/$/,"")){const e=o.replace(n,J);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:J}),void t.end()}await Y(e,t,i)}r()}catch(f){p.error(`Error handling request: ${f instanceof Error?f.message:String(f)}`,{error:f instanceof Error?f:void 0}),t.statusCode=500,t.end("Internal Server Error")}});let oe=null,ne=[],ie=[];if(!1!==z){const e=new s.RequestStore(W);s.registerInspectorRoutes(s.internalServer,e,B);const t=s.createRequestCaptureMiddleware(e,B);ne.push(t)}if(_){const e=new URL(_).host;_.startsWith("https://")&&(o.EventEmitter.defaultMaxListeners=Math.max(o.EventEmitter.defaultMaxListeners,20));const t={headers:{host:e,referer:_,origin:_.replace(/^(https?:\/\/)([^/]+)(\/.*)?$/i,"$1$2")},appId:Z,templateLess:$,disableSSLValidation:A,v7Features:j,personalAccessToken:V??process.env.MI_ACCESS_TOKEN};oe=new s.MiAPI(_,t);const l=s.initPPRedirect(J,F??void 0),c=(e,t,o)=>{l(e,t,o)};ie.push(c),ne.push(c);const d=a.createDevPanelAssetMiddleware(J);if(ie.push(d),ne.push(d),q){let e=+O;(!e||Number.isNaN(e)||e<0)&&(e=6e5);const t={devServer:{middlewares:{use:e=>e},config:{logger:console}},ttl:e},o=s.initProxyCache(t),n=(e,t,n)=>{o(e,t,n)};ne.push(n),p.info(s.colors.blue(`🔧 Proxy cache middleware added with TTL: ${e}ms`))}const f=new RegExp(`^((${u=J,u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})|/)$`),g=s.initLoadPPData(f,oe,Object.assign({base:J},t,{miHudLess:H})),m=(e,t,o)=>{g(e,t,o)};ne.push(m);const v=J.endsWith("/")?J.substring(0,J.length-1):J,b={middlewares:{use:e=>e},config:{logger:console}},x=s.initProxy({devServer:b,baseURL:_,proxyIgnore:["/@vite","/@metricinsights","/@",v,"/_next","/favicon.ico","/__nextjs_","/installHook.js.map"],disableSSLValidation:A,miAPI:oe,templateName:F??void 0}),S=(e,t,o)=>{x(e,t,o)};ne.push(S);const T=s.internalServer,D=(e,t,o)=>{if(e.url?.startsWith("/@api/")||e.url?.startsWith(s.INSPECTOR_PATH)||e.url?.startsWith(s.VARIABLES_EDITOR_PATH)){return void T(e,t,()=>{})}o()};ie.push(D),ne.push(D);const N=s.initRewriteResponse(e=>{const t=e.split("?")[0];return t.startsWith(J)&&!t.includes("/_next/")},(t,o)=>{const n=oe.buildPage(t,H),i=a.injectDevPanel(n,J,{backendBaseURL:_,templateLess:$,appId:Z,devPanelPosition:I.devPanelPosition,devPanelHidden:I.devPanelHidden,devPanelAutoHide:I.devPanelAutoHide});return Buffer.from(s.urlReplacer(e,o.headers.host??"",i))}),R=(e,t,o)=>{N(e,t,o)};ne.push(R),r=new C;let M=k?.distDir;try{process.env[s.PP_DEV_NEXT_BUILD_ENV_VAR]="1";const e=await E(h.PHASE_PRODUCTION_BUILD,L);M=e?.distDir??M}catch{}const z=(M??"").replace(/\\/g,"/").replace(/\/+$/,"").replace(/\/dev$/,""),U=z&&".next"!==z?z:"out";let W,B="0.0.0";try{const e=JSON.parse(P.readFileSync(y.join(L,"package.json"),"utf-8"));B="string"==typeof e.version?e.version:B,W="string"==typeof e.repository?e.repository:e.repository?.url}catch{}const G=new s.DistService(F??w(L),{root:L,backupFolder:y.resolve(L,I.syncBackupsDir),nextBuild:{projectRoot:L,distDir:U,packageVersion:B,packageRepositoryUrl:W}}),X={ws:r.ws,config:{clientInjectionPlugin:{v7Features:j}}};new s.ClientService(X,{distService:G,miAPI:oe}),s.registerVariablesEditorRoutes(s.internalServer,{distService:G,miAPI:oe});const K="function"==typeof n?.getUpgradeHandler?n.getUpgradeHandler():null;i.on("upgrade",(e,t,o)=>{r?.handleUpgrade(e,t,o)||(K?K(e,t,o):t.destroy())}),p.info(s.colors.blue(`🔧 ${ne.length} pp-dev middlewares initialized`)),p.info(s.colors.blue(`🔧 ${ie.length} essential middlewares for internal routes`)),p.info(s.colors.blue(`🔧 MiAPI initialized for backend: ${_}`)),p.info(s.colors.blue(`🔧 Custom App ID: ${Z}`))}i.listen(Q,ee,()=>{p.info(s.colors.green(`✅ pp-dev Next.js server running at http://${ee}:${Q}`)),p.info(s.colors.blue(`📱 Next.js app accessible at http://${ee}:${Q}${J}`)),!1!==z&&p.info(s.colors.cyan(`🔍 Request Inspector: http://${ee}:${Q}${s.INSPECTOR_PATH}`)),p.info(s.colors.blue("🔧 Base path handling active")),l||(l=N(L,f,p.info),p.info(s.colors.blue("🔧 Config file watcher started"))),i.on("connection",e=>{te.add(e),e.on("close",()=>te.delete(e))});const e=async e=>{p.info(s.colors.yellow(`\n🛑 Received ${e}, shutting down gracefully...`));const t=setTimeout(()=>{p.info(s.colors.yellow("⏰ Shutdown timeout reached, forcing exit")),process.exit(0)},5e3);try{l&&(R(l),l=null);for(const e of Array.from(te))e.destroy();te.clear(),r&&(await r.close(),r=null),await new Promise(e=>{i.close(()=>{p.info(s.colors.yellow("🛑 HTTP server closed")),e()})}),n&&"function"==typeof n.close&&(await n.close(),p.info(s.colors.yellow("🛑 Next.js app closed"))),clearTimeout(t),p.info(s.colors.green("✅ Graceful shutdown completed")),process.exit(0)}catch(e){clearTimeout(t),p.error(s.colors.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,p.info(s.colors.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=>{p.error(s.colors.red(`❌ Uncaught Exception: ${t}`)),e("uncaughtException")}),t.on("unhandledRejection",(t,o)=>{p.error(s.colors.red(`❌ Unhandled Rejection at: ${o}, reason: ${t}`)),e("unhandledRejection")}),p.info(s.colors.green("✅ Process event handlers registered successfully"))}catch(e){p.warn(s.colors.yellow(`⚠️ Failed to register process event handlers: ${e}`))}else p.warn(s.colors.yellow("⚠️ process.on is not available, graceful shutdown handlers will not be registered")),p.info(s.colors.blue("💡 This might be due to bundling or environment constraints"))}),d=!1}catch(e){d=!1,p.error(s.colors.red(`❌ Failed to start Next.js server: ${e?.message}. Stack: ${e?.stack}`)),e instanceof Error&&e.message.includes("Next.js is required")&&(p.error(s.colors.red("❌ Next.js Peer Dependency Error:")),p.error(s.colors.red(e.message)),p.error(s.colors.yellow("\n💡 To fix this issue:")),p.error(s.colors.blue(" 1. Install Next.js in your project:")),p.error(s.colors.white(" npm install next@^16")),p.error(s.colors.blue(" 2. Or use yarn:")),p.error(s.colors.white(" yarn add next@^16")),p.error(s.colors.blue(" 3. Or use pnpm:")),p.error(s.colors.white(" pnpm add next@^16")),p.error(s.colors.yellow("\n📖 For more information, see:")),p.error(s.colors.blue(" https://nextjs.org/docs/getting-started"))),process.exit(1)}var u}},u=async e=>{p.info(s.colors.yellow(`\n🛑 Received ${e}, shutting down gracefully...`));try{l&&(R(l),l=null),r&&(await r.close(),r=null),i&&await new Promise(e=>{i.close(()=>{i=null,e()})}),n&&"function"==typeof n.close&&(await n.close(),n=null),p.info(s.colors.green("✅ Graceful shutdown completed")),process.exit(0)}catch(e){p.error(s.colors.red(`❌ Error during graceful shutdown: ${e}`)),process.exit(1)}};process.on("SIGINT",()=>u("SIGINT")),process.on("SIGTERM",()=>u("SIGTERM")),process.on("uncaughtException",e=>{p.error(s.colors.red(`❌ Uncaught Exception: ${e}`)),u("uncaughtException")}),process.on("unhandledRejection",(e,t)=>{p.error(s.colors.red(`❌ Unhandled Rejection at: ${t}, reason: ${e}`)),u("unhandledRejection")}),await f()}),A.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(e,t)=>{z(t);const o=U(t),n=a.resolveBuildCliOverrides(t);try{const i=t.mode||"production",r=y.resolve(process.cwd(),e??".");a.loadPPDevEnv(i,r);const s=await l.loadConfigFromFile({mode:i,command:"build"},t.config,e,t.logLevel);let c=await a.getViteConfig(n,{mode:i,root:r});if(s){const{plugins:e,...t}=s.config;c=l.mergeConfig(c,t)}const d=l.mergeConfig(c,{root:e,base:t.base,mode:t.mode,configFile:t.config,logLevel:t.logLevel,clearScreen:t.clearScreen,optimizeDeps:{force:t.force},build:o},!0);if(await l.build(d),o.changelog){const n=e||process.cwd(),i=d.build?.outDir||"dist";let r="dist-zip";d.ppDevConfig&&(!1===d.ppDevConfig.distZip?r=i:"object"==typeof d.ppDevConfig.distZip&&"string"==typeof d.ppDevConfig.distZip.outDir&&(r=d.ppDevConfig.distZip.outDir)),await q({changelog:o.changelog,executionRoot:n,newAssetsPath:y.resolve(n,i),backupsDirPath:y.resolve(n,d.ppDevConfig?.syncBackupsDir||"backups"),changelogDestinationPath:y.resolve(n,r),logLevel:t.logLevel})}}catch(e){s.createLogger(t.logLevel).error(s.colors.red(`error during build:\n${e.stack}`),{error:e}),process.exit(1)}finally{H(e=>s.createLogger(t.logLevel).info(e))}}),A.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(e,t)=>{z(t);const o=s.createLogger(t.logLevel),n=e?y.resolve(process.cwd(),e):process.cwd(),i=a.resolveBuildCliOverrides(t);process.env[s.PP_DEV_NEXT_BUILD_ENV_VAR]="1";try{a.loadPPDevEnv(t.mode||"production",n);const{constants:e}=await a.safeNextImport(),r=await(import("next/dist/server/config.js")),l=r.default.default||r["module.exports"].default||r.default,c=await l(e.PHASE_PRODUCTION_BUILD,n);let d,p=c?.ppDev||{};if(0===Object.keys(p).length){const{getConfig:e}=await Promise.resolve().then(()=>require("./index-Cab7kIQH.js")).then(e=>e.config);p=await e(n)}try{const{getPkg:e}=await Promise.resolve().then(()=>require("./index-Cab7kIQH.js")).then(e=>e.config);d=e(n).name}catch{d=y.basename(n)}const f=s.normalizePPDevConfig(p,d),u=a.applyDistZipOverride(f.distZip,i,s.createDefaultZipFileName(d)),g=a.applyVersionManifestOverride(f.versionPlugin,i);o.info(s.colors.cyan("[pp-dev] Running `next build`...")),await s.runNextBuildProcess(n);const h="string"==typeof c?.distDir&&c.distDir?c.distDir:".next",m=".next"===h?"out":h,v=y.resolve(n,m);if(!P.existsSync(v)||!P.statSync(v).isDirectory())throw new Error(`Next.js build output directory not found: ${v}. "next-build" requires "output: 'export'" in next.config (static export).`);const b=JSON.parse(P.readFileSync(y.join(n,"package.json"),"utf-8"));if(!1!==g&&!1!==g.enabled&&(s.writeBuildVersionManifest({outDir:v,packageVersion:"string"==typeof b.version?b.version:"0.0.0",versionFileTemplate:g.versionFileTemplate,packageRepositoryUrl:"string"==typeof b.repository?b.repository:b.repository?.url,enabled:g.enabled}),o.info(s.colors.green(`✅ VERSION / BUILD-MANIFEST written to ${y.relative(n,v)}`))),!1!==u){const e=y.resolve(n,u.outDir),t=u.inDir?y.resolve(v,u.inDir):v,i=s.resolveOutputFilePath(e,u.outFileName,"ZIP output file name");P.mkdirSync(y.dirname(i),{recursive:!0});const r=await s.zipDirectoryToBuffer(t);P.writeFileSync(i,r),o.info(s.colors.green(`✅ Zip archive written to ${y.relative(n,i)}`))}if(t.changelog){const e=!1!==u?u.outDir:m;await q({changelog:t.changelog,executionRoot:n,newAssetsPath:v,backupsDirPath:y.resolve(n,f.syncBackupsDir),changelogDestinationPath:y.resolve(n,e),logLevel:t.logLevel})}}catch(e){s.createLogger(t.logLevel).error(s.colors.red(`error during next-build:\n${e.stack}`),{error:e}),process.exit(1)}finally{H(e=>s.createLogger(t.logLevel).info(e))}}),A.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(e,t,o)=>{z(o);const{oldAssetsPath:n=e,newAssetsPath:i=t,destination:r=".",filename:a="CHANGELOG.html",logLevel:l}=o,c=process.cwd();n&&i||(s.createLogger(l).error(s.colors.red("error during changelog generation: oldAssetPath and newAssetPath are required")),process.exit(1));const d=y.resolve(c,n),p=y.resolve(c,i),f=y.resolve(c,r),u=new $({oldAssetsPath:d,newAssetsPath:p,destinationPath:f,changelogFilename:a});await u.generateChangelog()}),A.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(e,t,o)=>{z(o);const{source:n=e,destination:i=t,fontName:r="icon-font"}=o,a=process.cwd(),l=y.resolve(a,n),c=y.resolve(a,i),d=new j({sourceDir:l,outputDir:c,fontName:r}),p=s.createLogger(o.logLevel);p.info(`Generating icon font from SVG files in ${s.colors.dim(l)}`),await d.generate(),p.info(`Icon font generated and saved to ${s.colors.dim(c)}`)}),A.command("optimize [root]","pre-bundle dependencies").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle").action(async(e,t)=>{z(t);try{const o=t.mode||"production",n=y.resolve(process.cwd(),e??".");a.loadPPDevEnv(o,n);const i=await l.loadConfigFromFile({mode:o,command:"build"},t.config,e,t.logLevel);let r=await a.getViteConfig(void 0,{mode:o,root:n});if(i){const{plugins:e,...t}=i.config;r=l.mergeConfig(r,t)}const s=await l.resolveConfig(l.mergeConfig(r,{root:e,base:t.base,configFile:t.config,logLevel:t.logLevel,mode:t.mode}),"serve");await l.optimizeDeps(s,t.force,!0)}catch(e){s.createLogger(t.logLevel).error(s.colors.red(`error when optimizing deps:\n${e.stack}`),{error:e}),process.exit(1)}}),A.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)=>{z(t);try{const o=t.mode||"production",n=y.resolve(process.cwd(),e??".");a.loadPPDevEnv(o,n);const i=await l.loadConfigFromFile({mode:o,command:"build"},t.config,e,t.logLevel);let r=await a.getViteConfig(void 0,{mode:o,root:n});if(i){const{plugins:e,...t}=i.config;r=l.mergeConfig(r,t)}(await l.preview(l.mergeConfig(r,{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){s.createLogger(t.logLevel).error(s.colors.red(`error when starting preview server:\n${e.stack}`),{error:e}),process.exit(1)}finally{H(e=>s.createLogger(t.logLevel).info(e))}}),A.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(e,t)=>{const o=s.createLogger(t.logLevel),{isLegacyFlatConfig:n,isLegacyPPWatchConfig:i,isAlreadyMigrated:r,migrateLegacyFlatConfig:a,migratePPWatchConfig:l,generateConfigFileContent:c,discoverMigrateSource:d,loadPackageJsonMigrateConfig:p}=await Promise.resolve().then(()=>require("./migrate-tyzkQsrd.js")),f=t.format??"ts",u=!1!==t.backup,g=process.cwd(),h=d(g,e);h||(o.warn(s.colors.yellow("No pp-dev or pp-watch config file found in the current directory.")),o.info(s.colors.blue('Supported files: pp-dev.config.{ts,js,cjs,mjs,json}, .pp-watch.config.{ts,js,json}, or a "pp-dev" field in package.json')),process.exit(1));const{sourceFile:m,isWatchConfig:v,isPackageJsonConfig:b}=h;o.info(s.colors.blue(`Found config: ${y.relative(g,m)}`));const{getPkg:w}=await Promise.resolve().then(()=>require("./index-Cab7kIQH.js")).then(e=>e.config),x=w();let S,E={};try{if(/\.[cm]?ts$/i.test(m)){const e=await(import("esbuild")),{pathToFileURL:t}=await(import("url")),o=(await e.build({absWorkingDir:g,entryPoints:[m],outfile:"out.js",write:!1,target:"node24",platform:"node",bundle:!0,packages:"external",format:"esm",mainFields:["main"]})).outputFiles[0].text,n=`pp-migrate-tmp-${Date.now()}.mjs`;P.writeFileSync(n,o);try{const e=await(import(t(y.resolve(g,n)).toString()));E=e.default?.default??e.default??e}finally{P.existsSync(n)&&P.unlinkSync(n)}}else if(/\.[cm]?js$/i.test(m)){const{pathToFileURL:e}=await(import("url")),t=await(import(e(y.resolve(g,m)).toString()));E=t.default?.default??t.default??t}else b?E=p(m):m.endsWith(".json")&&(E=JSON.parse(P.readFileSync(m,"utf-8")))}catch(e){o.error(s.colors.red(`Failed to load config file: ${e.message}`)),process.exit(1)}E&&"object"==typeof E||(o.error(s.colors.red("Config file did not export a valid object.")),process.exit(1)),r(E)?(o.info(s.colors.green("Config is already in 1.0 format — nothing to migrate.")),process.exit(0)):v||i(E)?(o.info(s.colors.blue("Detected pp-watch config format → migrating to 1.0")),S=l(E)):n(E)?(o.info(s.colors.blue("Detected 0.x flat config format → migrating to 1.0")),S=a(E,x.name)):(o.warn(s.colors.yellow("Could not detect config format. No known keys found.")),process.exit(1));const T=c(S,f),L=t.output??y.join(g,`pp-dev.config.${f}`);if(t.dryRun&&(o.info(s.colors.green(`\n--- Migrated config (dry-run) → ${y.relative(g,L)} ---\n`)),process.exit(0)),u&&!b&&P.existsSync(m)){const e=`${m}.bak`;P.copyFileSync(m,e),o.info(s.colors.blue(`Backed up original to: ${y.relative(g,e)}`))}P.writeFileSync(L,T,"utf-8"),o.info(s.colors.green(`✅ Migration complete → ${y.relative(g,L)}`)),b?o.info(s.colors.yellow('You can now remove the "pp-dev" field from package.json.')):m!==L&&P.existsSync(m)&&o.info(s.colors.yellow(`You can now delete the old config: ${y.relative(g,m)}`))}),A.help(),A.version(s.VERSION),A.parse(),exports.stopProfiler=H;
2
2
  //# sourceMappingURL=cli.js.map
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("child_process"),t=require("./plugin-CkZeoDh1.js"),n=require("vite"),i=require("fs"),r=require("path"),s=require("url");require("./helpers.js");const o=require("ejs");var a="undefined"!=typeof document?document.currentScript:null;const c=e=>e&&"object"==typeof e&&"default"in e?e.default:e;function l(e){if(e&&"object"==typeof e&&"default"in e)return e;const t=Object.create(null);if(e)for(const n in e)t[n]=e[n];return t.default=e,Object.freeze(t)}const p=l(i),u=l(r),d=c(r),f=c(o),m=u.dirname(t.PP_DEV_CLIENT_ENTRY),P=u.join(m,"index.html");let v=null;function E(e){return{css:u.posix.join(e,t.PACKAGE_NAME,"client/client.css"),js:u.posix.join(e,t.PACKAGE_NAME,"client/client.js")}}function g(e){return function(){if(v)return v;const e=p.readFileSync(P,{encoding:"utf8"});return v=f.compile(e,{openDelimiter:"{",closeDelimiter:"}",async:!1,rmWhitespace:!0,compileDebug:!1}),v}()({PACKAGE_NAME:t.PACKAGE_NAME,VERSION:t.VERSION,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})}const _={".js":"text/javascript; charset=utf-8",".css":"text/css; charset=utf-8",".map":"application/json; charset=utf-8"};let h;try{h="undefined"!=typeof __filename&&__filename?u.resolve(u.dirname(__filename),".."):void 0!=={url:"undefined"==typeof document?require("url").pathToFileURL(__filename).href:a&&"SCRIPT"===a.tagName.toUpperCase()&&a.src||new URL("index-CtxApOJm.js",document.baseURI).href}&&("undefined"==typeof document?require("url").pathToFileURL(__filename).href:a&&"SCRIPT"===a.tagName.toUpperCase()&&a.src||new URL("index-CtxApOJm.js",document.baseURI).href,1)&&("undefined"==typeof document?require("url").pathToFileURL(__filename).href:a&&"SCRIPT"===a.tagName.toUpperCase()&&a.src||new URL("index-CtxApOJm.js",document.baseURI).href)?u.resolve(s.fileURLToPath(new URL(".","undefined"==typeof document?require("url").pathToFileURL(__filename).href:a&&"SCRIPT"===a.tagName.toUpperCase()&&a.src||new URL("index-CtxApOJm.js",document.baseURI).href)),".."):process.cwd()}catch{h=process.cwd()}const y=n.normalizePath(u.join(t.PP_DEV_PACKAGE_DIR,"dist/client")),T=new RegExp(`^\\/?${t.PACKAGE_NAME}\\/client\\/(.*)$`);let I=null,R=null;function j(e){return{name:"pp-dev:client",apply:"serve",config:e=>(e.optimizeDeps?.exclude?.push(`${t.PACKAGE_NAME}/client`),e),resolveId(e){const t=e.match(T);if(t){const e=n.normalizePath(u.join(y,t[1]));return e.startsWith(`${y}/`)?{id:e}:null}},transformIndexHtml:async(e,n)=>{const i=n.server?.config.base||"",r=function(){if(R)return R;const e=u.resolve(h,"client","index.html");return I||(I=p.readFileSync(e,{encoding:"utf8"})),R=f.compile(I,{openDelimiter:"{",closeDelimiter:"}",async:!0,cache:!0,filename:e,rmWhitespace:!0,compileDebug:!1}),R}(),s=E(i),o={html:e,tags:[{tag:"link",injectTo:"head",attrs:{rel:"stylesheet",href:s.css}}]},{backendBaseURL:a,templateLess:c=!1,appId:l,canSync:d=!0,devPanelPosition:m="bottom-right",devPanelHidden:P=!1,devPanelAutoHide:v=!1}=n.server?.config.clientInjectionPlugin||{},g={PACKAGE_NAME:t.PACKAGE_NAME,VERSION:t.VERSION,backendBaseURL:a,templateLess:c,appId:l,canSync:d,devPanelPosition:m,devPanelHidden:P,devPanelAutoHide:v};return o.tags.push({tag:"div",injectTo:"body-prepend",children:await r(g)}),o.tags.push({tag:"script",injectTo:"body-prepend",attrs:{src:s.js,type:"module"}}),o},configureServer(e){const i=n.normalizePath(u.resolve(e.config.root,u.dirname(t.PP_DEV_CLIENT_ENTRY)));e.config.server?.fs?.allow&&e.config.server.fs.allow.push(i)}}}const A=(e,t)=>` * ${t}`;function b(e){return`/*!\n${"***** DO NOT EDIT THIS CODE! *****\n***** ------- *****".replace(/^(.*)$/gm,A)}\n */`}async function D(){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}`)}}let w=new Set;function N(e="development",t=process.cwd()){for(const e of w)delete process.env[e];const i=n.loadEnv(e,t,"MI_");for(const[e,t]of Object.entries(i))process.env[e]=t;return w=new Set(Object.keys(i)),i}const S=new Map,L=3e4,F=new Map;function $(e=process.cwd()){const t=Date.now(),n=d.resolve(e),r=F.get(n);if(r&&t-r.timestamp<6e4)return r.data;try{const e=JSON.parse(i.readFileSync(d.resolve(n,"package.json"),{encoding:"utf-8",flag:"r"}));return F.set(n,{data:e,timestamp:t}),e}catch{const e={};return F.set(n,{data:e,timestamp:t}),e}}let C=null;async function x(e,t){const n=`ts:${e}`,r=S.get(n);if(r&&Date.now()-r.timestamp<L)return r.data;let o=!1;if(/\.m[jt]s$/.test(e))o=!0;else if(/\.c[jt]s$/.test(e))o=!1;else{const e=$(t);o=!!e&&"module"===e.type}const a=await async function(){return C||(C=await(import("esbuild"))),C}(),c=await a.build({absWorkingDir:t,entryPoints:[e],outfile:"out.js",write:!1,target:"node24",platform:"node",bundle:!0,packages:"external",format:o?"esm":"cjs",mainFields:["main"],sourcemap:"inline",metafile:!0}),{text:l}=c.outputFiles[0],p=`${`pp-config.timestamp-${Date.now()}-${Math.random().toString(16).slice(2)}`}.js`,u=d.resolve(t,p),f=s.pathToFileURL(u).toString();i.writeFileSync(u,l);let m={};try{const t=(await(import(f))).default;m=t?.default||t,S.set(n,{data:m,timestamp:Date.now(),filePath:e})}finally{i.existsSync(u)&&i.unlink(u,()=>{})}return m}async function O(e){const t=`js:${e}`,n=S.get(t);if(n&&Date.now()-n.timestamp<L)return n.data;const i=(await(import(s.pathToFileURL(e).toString()))).default;return S.set(t,{data:i,timestamp:Date.now(),filePath:e}),i}async function U(e){const t=`json:${e}`,n=S.get(t);if(n&&Date.now()-n.timestamp<L)return n.data;const r=JSON.parse(i.readFileSync(e,{encoding:"utf-8"}));return S.set(t,{data:r,timestamp:Date.now(),filePath:e}),r}const M=new Map;function V(e=process.cwd()){return $(e)}async function H(e=process.cwd()){const n=d.resolve(e),r=function(e){const t=Date.now(),n=M.get(e);if(n&&t-n.timestamp<1e4)return n.files;const r=/\.config\.(([cm]?ts)|([cm]?js)|(json))$/,s=i.readdirSync(e,{withFileTypes:!0}).filter(e=>e.isFile()&&r.test(e.name)).map(e=>e.name);return M.set(e,{files:s,timestamp:t}),s}(n);let s={},o=!1;const a=await async function(e,t,n){for(const i of t)if(e.includes(i)){const e=d.resolve(n,i);if(/\.[cm]?ts$/i.test(i))return await x(e,n);if(/\.[cm]?js$/i.test(i))return await O(e);if(i.endsWith(".json"))return await U(e)}return null}(r,t.PP_DEV_CONFIG_NAMES,n);a&&(s=a,o=!0);const c=$(n)["pp-dev"];return o||!c||"object"!=typeof c||Array.isArray(c)||(s=c),s}const Z=Object.freeze({__proto__:null,clearConfigCache:function(){S.clear(),F.clear(),M.clear()},getConfig:H,getPkg:V});function G(e){if(void 0!==e)return"1"===e||"true"===e.toLowerCase()||"0"!==e&&"false"!==e.toLowerCase()&&void 0}function k(e,n,i){if(!1===n.distZipEnabled)return!1;if(!0!==n.distZipEnabled&&void 0===n.distZipDir&&void 0===n.distZipFilename)return!1!==e&&{...e,outFileName:t.normalizeRelativeOutputPath(e.outFileName,"ZIP output file name")};const r=!1===e?{outFileName:i,outDir:"dist-zip"}:e,s=n.distZipFilename??r.outFileName;return{...r,...void 0!==n.distZipDir?{outDir:n.distZipDir}:{},outFileName:t.normalizeRelativeOutputPath(s,"ZIP output file name")}}function B(e,n){if(!1===n.versionManifestEnabled)return!1;if(!0!==n.versionManifestEnabled&&void 0===n.versionFileTemplate)return!1!==e&&void 0!==e.versionFileTemplate?{...e,versionFileTemplate:t.normalizeRelativeOutputPath(e.versionFileTemplate,"VERSION file name template")}:e;const i=!1===e?{enabled:!0}:e,r=n.versionFileTemplate??i.versionFileTemplate,s=void 0!==r?t.normalizeRelativeOutputPath(r,"VERSION file name template"):void 0;return{...i,enabled:!0,...void 0!==s?{versionFileTemplate:s}:{}}}const z=new Set(["mi","app","proxy","build","sync","inspector","devPanel"]);function q(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 r=process.env.CI_PROJECT_PATH;if("string"==typeof r&&r.trim()){return`${(process.env.CI_SERVER_URL||"https://gitlab.com").replace(/\/+$/,"")}/${r.replace(/^\/+/,"")}`}const s=process.env.BITBUCKET_REPO_FULL_NAME;if("string"==typeof s&&s.trim())return`https://bitbucket.org/${s.replace(/^\/+/,"")}`;const o=process.env.TRAVIS_REPO_SLUG;if("string"==typeof o&&o.trim())return`https://github.com/${o.replace(/^\/+/,"")}`;try{const t=e.execSync("git config --get remote.origin.url",{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(t)return t}catch{}}function K(e){return e?.ppDev||{}}exports.applyDistZipOverride=k,exports.applyVersionManifestOverride=B,exports.config=Z,exports.createDevPanelAssetMiddleware=function(e){const n=u.posix.join(e,t.PACKAGE_NAME,"client")+"/",i=new Set(["client.js","client.css","client.js.map","client.css.map"]);return(e,t,r)=>{const s=(e.url??"").split("?")[0];if(!s.startsWith(n))return void r();const o=s.slice(n.length);if(!i.has(o))return void r();const a=u.join(m,o);p.readFile(a,(e,n)=>{e?r():(t.statusCode=200,t.setHeader("Content-Type",_[u.extname(o)]??"application/octet-stream"),t.setHeader("Cache-Control","no-cache"),t.end(n))})}},exports.getNextVersion=async function(){try{return(await(import("next/package.json"))).version}catch{return null}},exports.getPPDevConfigFromNextConfig=K,exports.getViteConfig=async function(e,n={}){const i=n.root??process.cwd();N(n.mode,i);const r=V(i),s=r.name,o=await H(i);t.validatePPDevConfig(o,s);const a=t.normalizePPDevConfig(o,s);e&&(a.distZip=k(a.distZip,e,t.createDefaultZipFileName(s)),a.versionPlugin=B(a.versionPlugin,e));const{default:c}=await Promise.resolve().then(()=>require("./plugin.js")),l=[c(a),j()],{outDir:p,distZip:u,versionPlugin:d,imageOptimizer:f,templateLess:m,integrateMiTopBar:P}=a;if(P&&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}}}(P)),f){const{ViteImageOptimizer:e}=await(import("vite-plugin-image-optimizer"));l.push(e("object"==typeof f?f:void 0))}if(d){const{versionPlugin:e}=await Promise.resolve().then(()=>require("./version-plugin-Dozkvk1U.js"));l.push(e({outDir:p,packageVersion:r.version??"0.0.0",packageRepositoryUrl:q(r.repository),..."object"==typeof d?d:{}}))}if(u){const{default:e}=await(import("vite-plugin-zip-pack"));l.push({...e("object"==typeof u?u:{outFileName:t.createDefaultZipFileName(s)}),enforce:"post"})}return{base:m?`${t.PATH_PAGE_PREFIX}/${s}`:`${t.PATH_TEMPLATE_PREFIX}/${s}`,server:{port:3e3},build:{minify:!1,assetsInlineLimit:4096,rollupOptions:{output:{banner:b}},outDir:p},css:{modules:{localsConvention:"dashes"}},ppDevConfig:a,plugins:l}},exports.injectDevPanel=function(e,t,n){if(!/<\/?(html|body|head)\b/i.test(e))return e;const{css:i,js:r}=E(t),s=`<link rel="stylesheet" href="${i}">`,o=`${g(n)}${`<script type="module" src="${r}"><\/script>`}`;let a=e,c=!1;if(/<\/head>/i.test(a)&&(a=a.replace(/<\/head>/i,`${s}</head>`),c=!0),/<body[^>]*>/i.test(a)){const e=c?"":s;a=a.replace(/(<body[^>]*>)/i,`$1${e}${o}`)}else a=`${c?"":s}${a}${o}`;return a},exports.isNextAvailable=async function(){try{return await(import("next")),!0}catch{return!1}},exports.loadPPDevEnv=N,exports.resolveBuildCliOverrides=function(e){return{distZipEnabled:e.distZip??G(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??G(process.env.PP_DEV_VERSION_MANIFEST),versionFileTemplate:e.versionFileTemplate??process.env.PP_DEV_VERSION_FILE_TEMPLATE}},exports.safeNextImport=D,exports.withPPDev=function(e,n){return async(i,r={})=>{try{const{constants:s}=await D(),{PHASE_DEVELOPMENT_SERVER:o,PHASE_PRODUCTION_BUILD:a}=s;i!==a||process.env[t.PP_DEV_NEXT_BUILD_ENV_VAR]||t.createLogger().warn(t.colors.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 c=await H(),l=V().name,p="function"==typeof e?await e(i,r):e,u=function(...e){const t={},n=t;for(const t of e)if(t)for(const[e,i]of Object.entries(t))void 0!==i&&(z.has(e)&&i&&"object"==typeof i&&!Array.isArray(i)?n[e]={...n[e]??{},...i}:n[e]=i);return t}(c,K(p),n);t.validatePPDevConfig(u,l);const d=t.normalizePPDevConfig(u,l),{templateLess:f,v7Features:m}=d,P=i===o,v=function(e,n,i,r){return i?r?n?`${t.PATH_PAGE_PREFIX}/${e}`:`${t.PATH_TEMPLATE_LOCAL_PREFIX}/${e}`:n?`${t.PATH_PAGE_PREFIX}/${e}`:`${t.PATH_TEMPLATE_PREFIX}/${e}`:`${t.PATH_PAGE_PREFIX}/${e}`}(d.templateName,f,P,m),E={basePath:v,trailingSlash:!!P||void 0};if(!f){const e=P&&m?t.PATH_TEMPLATE_LOCAL_PREFIX:t.PATH_TEMPLATE_PREFIX;E.assetPrefix=`${e}/${d.templateName}`}const g=Object.assign({},E,p);return Object.defineProperty(g,"ppDev",{value:u,enumerable:!1,configurable:!0}),g}catch(e){throw t.createLogger().error("Error in withPPDev:",{error:e instanceof Error?e:new Error(String(e))}),e}}};
2
- //# sourceMappingURL=index-CtxApOJm.js.map
1
+ "use strict";const e=require("child_process"),t=require("./plugin-BcxTOlCf.js"),n=require("vite"),i=require("fs"),r=require("path"),s=require("url");require("./helpers.js");const o=require("ejs");var a="undefined"!=typeof document?document.currentScript:null;const c=e=>e&&"object"==typeof e&&"default"in e?e.default:e;function l(e){if(e&&"object"==typeof e&&"default"in e)return e;const t=Object.create(null);if(e)for(const n in e)t[n]=e[n];return t.default=e,Object.freeze(t)}const p=l(i),u=l(r),d=c(r),f=c(o),m=u.dirname(t.PP_DEV_CLIENT_ENTRY),P=u.join(m,"index.html");let v=null;function E(e){return{css:u.posix.join(e,t.PACKAGE_NAME,"client/client.css"),js:u.posix.join(e,t.PACKAGE_NAME,"client/client.js")}}function g(e){return function(){if(v)return v;const e=p.readFileSync(P,{encoding:"utf8"});return v=f.compile(e,{openDelimiter:"{",closeDelimiter:"}",async:!1,rmWhitespace:!0,compileDebug:!1}),v}()({PACKAGE_NAME:t.PACKAGE_NAME,VERSION:t.VERSION,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})}const _={".js":"text/javascript; charset=utf-8",".css":"text/css; charset=utf-8",".map":"application/json; charset=utf-8"};let h;try{h="undefined"!=typeof __filename&&__filename?u.resolve(u.dirname(__filename),".."):void 0!=={url:"undefined"==typeof document?require("url").pathToFileURL(__filename).href:a&&"SCRIPT"===a.tagName.toUpperCase()&&a.src||new URL("index-Cab7kIQH.js",document.baseURI).href}&&("undefined"==typeof document?require("url").pathToFileURL(__filename).href:a&&"SCRIPT"===a.tagName.toUpperCase()&&a.src||new URL("index-Cab7kIQH.js",document.baseURI).href,1)&&("undefined"==typeof document?require("url").pathToFileURL(__filename).href:a&&"SCRIPT"===a.tagName.toUpperCase()&&a.src||new URL("index-Cab7kIQH.js",document.baseURI).href)?u.resolve(s.fileURLToPath(new URL(".","undefined"==typeof document?require("url").pathToFileURL(__filename).href:a&&"SCRIPT"===a.tagName.toUpperCase()&&a.src||new URL("index-Cab7kIQH.js",document.baseURI).href)),".."):process.cwd()}catch{h=process.cwd()}const y=n.normalizePath(u.join(t.PP_DEV_PACKAGE_DIR,"dist/client")),T=new RegExp(`^\\/?${t.PACKAGE_NAME}\\/client\\/(.*)$`);let I=null,R=null;function j(e){return{name:"pp-dev:client",apply:"serve",config:e=>(e.optimizeDeps?.exclude?.push(`${t.PACKAGE_NAME}/client`),e),resolveId(e){const t=e.match(T);if(t){const e=n.normalizePath(u.join(y,t[1]));return e.startsWith(`${y}/`)?{id:e}:null}},transformIndexHtml:async(e,n)=>{const i=n.server?.config.base||"",r=function(){if(R)return R;const e=u.resolve(h,"client","index.html");return I||(I=p.readFileSync(e,{encoding:"utf8"})),R=f.compile(I,{openDelimiter:"{",closeDelimiter:"}",async:!0,cache:!0,filename:e,rmWhitespace:!0,compileDebug:!1}),R}(),s=E(i),o={html:e,tags:[{tag:"link",injectTo:"head",attrs:{rel:"stylesheet",href:s.css}}]},{backendBaseURL:a,templateLess:c=!1,appId:l,canSync:d=!0,devPanelPosition:m="bottom-right",devPanelHidden:P=!1,devPanelAutoHide:v=!1}=n.server?.config.clientInjectionPlugin||{},g={PACKAGE_NAME:t.PACKAGE_NAME,VERSION:t.VERSION,backendBaseURL:a,templateLess:c,appId:l,canSync:d,devPanelPosition:m,devPanelHidden:P,devPanelAutoHide:v};return o.tags.push({tag:"div",injectTo:"body-prepend",children:await r(g)}),o.tags.push({tag:"script",injectTo:"body-prepend",attrs:{src:s.js,type:"module"}}),o},configureServer(e){const i=n.normalizePath(u.resolve(e.config.root,u.dirname(t.PP_DEV_CLIENT_ENTRY)));e.config.server?.fs?.allow&&e.config.server.fs.allow.push(i)}}}const A=(e,t)=>` * ${t}`;function b(e){return`/*!\n${"***** DO NOT EDIT THIS CODE! *****\n***** ------- *****".replace(/^(.*)$/gm,A)}\n */`}async function D(){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}`)}}let w=new Set;function N(e="development",t=process.cwd()){for(const e of w)delete process.env[e];const i=n.loadEnv(e,t,"MI_");for(const[e,t]of Object.entries(i))process.env[e]=t;return w=new Set(Object.keys(i)),i}const S=new Map,L=3e4,F=new Map;function $(e=process.cwd()){const t=Date.now(),n=d.resolve(e),r=F.get(n);if(r&&t-r.timestamp<6e4)return r.data;try{const e=JSON.parse(i.readFileSync(d.resolve(n,"package.json"),{encoding:"utf-8",flag:"r"}));return F.set(n,{data:e,timestamp:t}),e}catch{const e={};return F.set(n,{data:e,timestamp:t}),e}}let C=null;async function x(e,t){const n=`ts:${e}`,r=S.get(n);if(r&&Date.now()-r.timestamp<L)return r.data;let o=!1;if(/\.m[jt]s$/.test(e))o=!0;else if(/\.c[jt]s$/.test(e))o=!1;else{const e=$(t);o=!!e&&"module"===e.type}const a=await async function(){return C||(C=await(import("esbuild"))),C}(),c=await a.build({absWorkingDir:t,entryPoints:[e],outfile:"out.js",write:!1,target:"node24",platform:"node",bundle:!0,packages:"external",format:o?"esm":"cjs",mainFields:["main"],sourcemap:"inline",metafile:!0}),{text:l}=c.outputFiles[0],p=`${`pp-config.timestamp-${Date.now()}-${Math.random().toString(16).slice(2)}`}.js`,u=d.resolve(t,p),f=s.pathToFileURL(u).toString();i.writeFileSync(u,l);let m={};try{const t=(await(import(f))).default;m=t?.default||t,S.set(n,{data:m,timestamp:Date.now(),filePath:e})}finally{i.existsSync(u)&&i.unlink(u,()=>{})}return m}async function O(e){const t=`js:${e}`,n=S.get(t);if(n&&Date.now()-n.timestamp<L)return n.data;const i=(await(import(s.pathToFileURL(e).toString()))).default;return S.set(t,{data:i,timestamp:Date.now(),filePath:e}),i}async function U(e){const t=`json:${e}`,n=S.get(t);if(n&&Date.now()-n.timestamp<L)return n.data;const r=JSON.parse(i.readFileSync(e,{encoding:"utf-8"}));return S.set(t,{data:r,timestamp:Date.now(),filePath:e}),r}const M=new Map;function V(e=process.cwd()){return $(e)}async function H(e=process.cwd()){const n=d.resolve(e),r=function(e){const t=Date.now(),n=M.get(e);if(n&&t-n.timestamp<1e4)return n.files;const r=/\.config\.(([cm]?ts)|([cm]?js)|(json))$/,s=i.readdirSync(e,{withFileTypes:!0}).filter(e=>e.isFile()&&r.test(e.name)).map(e=>e.name);return M.set(e,{files:s,timestamp:t}),s}(n);let s={},o=!1;const a=await async function(e,t,n){for(const i of t)if(e.includes(i)){const e=d.resolve(n,i);if(/\.[cm]?ts$/i.test(i))return await x(e,n);if(/\.[cm]?js$/i.test(i))return await O(e);if(i.endsWith(".json"))return await U(e)}return null}(r,t.PP_DEV_CONFIG_NAMES,n);a&&(s=a,o=!0);const c=$(n)["pp-dev"];return o||!c||"object"!=typeof c||Array.isArray(c)||(s=c),s}const Z=Object.freeze({__proto__:null,clearConfigCache:function(){S.clear(),F.clear(),M.clear()},getConfig:H,getPkg:V});function G(e){if(void 0!==e)return"1"===e||"true"===e.toLowerCase()||"0"!==e&&"false"!==e.toLowerCase()&&void 0}function k(e,n,i){if(!1===n.distZipEnabled)return!1;if(!0!==n.distZipEnabled&&void 0===n.distZipDir&&void 0===n.distZipFilename)return!1!==e&&{...e,outFileName:t.normalizeRelativeOutputPath(e.outFileName,"ZIP output file name")};const r=!1===e?{outFileName:i,outDir:"dist-zip"}:e,s=n.distZipFilename??r.outFileName;return{...r,...void 0!==n.distZipDir?{outDir:n.distZipDir}:{},outFileName:t.normalizeRelativeOutputPath(s,"ZIP output file name")}}function B(e,n){if(!1===n.versionManifestEnabled)return!1;if(!0!==n.versionManifestEnabled&&void 0===n.versionFileTemplate)return!1!==e&&void 0!==e.versionFileTemplate?{...e,versionFileTemplate:t.normalizeRelativeOutputPath(e.versionFileTemplate,"VERSION file name template")}:e;const i=!1===e?{enabled:!0}:e,r=n.versionFileTemplate??i.versionFileTemplate,s=void 0!==r?t.normalizeRelativeOutputPath(r,"VERSION file name template"):void 0;return{...i,enabled:!0,...void 0!==s?{versionFileTemplate:s}:{}}}const z=new Set(["mi","app","proxy","build","sync","inspector","devPanel"]);function q(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 r=process.env.CI_PROJECT_PATH;if("string"==typeof r&&r.trim()){return`${(process.env.CI_SERVER_URL||"https://gitlab.com").replace(/\/+$/,"")}/${r.replace(/^\/+/,"")}`}const s=process.env.BITBUCKET_REPO_FULL_NAME;if("string"==typeof s&&s.trim())return`https://bitbucket.org/${s.replace(/^\/+/,"")}`;const o=process.env.TRAVIS_REPO_SLUG;if("string"==typeof o&&o.trim())return`https://github.com/${o.replace(/^\/+/,"")}`;try{const t=e.execSync("git config --get remote.origin.url",{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(t)return t}catch{}}function K(e){return e?.ppDev||{}}exports.applyDistZipOverride=k,exports.applyVersionManifestOverride=B,exports.config=Z,exports.createDevPanelAssetMiddleware=function(e){const n=u.posix.join(e,t.PACKAGE_NAME,"client")+"/",i=new Set(["client.js","client.css","client.js.map","client.css.map"]);return(e,t,r)=>{const s=(e.url??"").split("?")[0];if(!s.startsWith(n))return void r();const o=s.slice(n.length);if(!i.has(o))return void r();const a=u.join(m,o);p.readFile(a,(e,n)=>{e?r():(t.statusCode=200,t.setHeader("Content-Type",_[u.extname(o)]??"application/octet-stream"),t.setHeader("Cache-Control","no-cache"),t.end(n))})}},exports.getNextVersion=async function(){try{return(await(import("next/package.json"))).version}catch{return null}},exports.getPPDevConfigFromNextConfig=K,exports.getViteConfig=async function(e,n={}){const i=n.root??process.cwd();N(n.mode,i);const r=V(i),s=r.name,o=await H(i);t.validatePPDevConfig(o,s);const a=t.normalizePPDevConfig(o,s);e&&(a.distZip=k(a.distZip,e,t.createDefaultZipFileName(s)),a.versionPlugin=B(a.versionPlugin,e));const{default:c}=await Promise.resolve().then(()=>require("./plugin.js")),l=[c(a),j()],{outDir:p,distZip:u,versionPlugin:d,imageOptimizer:f,templateLess:m,integrateMiTopBar:P}=a;if(P&&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}}}(P)),f){const{ViteImageOptimizer:e}=await(import("vite-plugin-image-optimizer"));l.push(e("object"==typeof f?f:void 0))}if(d){const{versionPlugin:e}=await Promise.resolve().then(()=>require("./version-plugin-rZ3JgnX3.js"));l.push(e({outDir:p,packageVersion:r.version??"0.0.0",packageRepositoryUrl:q(r.repository),..."object"==typeof d?d:{}}))}if(u){const{default:e}=await(import("vite-plugin-zip-pack"));l.push({...e("object"==typeof u?u:{outFileName:t.createDefaultZipFileName(s)}),enforce:"post"})}return{base:m?`${t.PATH_PAGE_PREFIX}/${s}`:`${t.PATH_TEMPLATE_PREFIX}/${s}`,server:{port:3e3},build:{minify:!1,assetsInlineLimit:4096,rollupOptions:{output:{banner:b}},outDir:p},css:{modules:{localsConvention:"dashes"}},ppDevConfig:a,plugins:l}},exports.injectDevPanel=function(e,t,n){if(!/<\/?(html|body|head)\b/i.test(e))return e;const{css:i,js:r}=E(t),s=`<link rel="stylesheet" href="${i}">`,o=`${g(n)}${`<script type="module" src="${r}"><\/script>`}`;let a=e,c=!1;if(/<\/head>/i.test(a)&&(a=a.replace(/<\/head>/i,`${s}</head>`),c=!0),/<body[^>]*>/i.test(a)){const e=c?"":s;a=a.replace(/(<body[^>]*>)/i,`$1${e}${o}`)}else a=`${c?"":s}${a}${o}`;return a},exports.isNextAvailable=async function(){try{return await(import("next")),!0}catch{return!1}},exports.loadPPDevEnv=N,exports.resolveBuildCliOverrides=function(e){return{distZipEnabled:e.distZip??G(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??G(process.env.PP_DEV_VERSION_MANIFEST),versionFileTemplate:e.versionFileTemplate??process.env.PP_DEV_VERSION_FILE_TEMPLATE}},exports.safeNextImport=D,exports.withPPDev=function(e,n){return async(i,r={})=>{try{const{constants:s}=await D(),{PHASE_DEVELOPMENT_SERVER:o,PHASE_PRODUCTION_BUILD:a}=s;i!==a||process.env[t.PP_DEV_NEXT_BUILD_ENV_VAR]||t.createLogger().warn(t.colors.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 c=await H(),l=V().name,p="function"==typeof e?await e(i,r):e,u=function(...e){const t={},n=t;for(const t of e)if(t)for(const[e,i]of Object.entries(t))void 0!==i&&(z.has(e)&&i&&"object"==typeof i&&!Array.isArray(i)?n[e]={...n[e]??{},...i}:n[e]=i);return t}(c,K(p),n);t.validatePPDevConfig(u,l);const d=t.normalizePPDevConfig(u,l),{templateLess:f,v7Features:m}=d,P=i===o,v=function(e,n,i,r){return i?r?n?`${t.PATH_PAGE_PREFIX}/${e}`:`${t.PATH_TEMPLATE_LOCAL_PREFIX}/${e}`:n?`${t.PATH_PAGE_PREFIX}/${e}`:`${t.PATH_TEMPLATE_PREFIX}/${e}`:`${t.PATH_PAGE_PREFIX}/${e}`}(d.templateName,f,P,m),E={basePath:v,trailingSlash:!!P||void 0};if(!f){const e=P&&m?t.PATH_TEMPLATE_LOCAL_PREFIX:t.PATH_TEMPLATE_PREFIX;E.assetPrefix=`${e}/${d.templateName}`}const g=Object.assign({},E,p);return Object.defineProperty(g,"ppDev",{value:u,enumerable:!1,configurable:!0}),g}catch(e){throw t.createLogger().error("Error in withPPDev:",{error:e instanceof Error?e:new Error(String(e))}),e}}};
2
+ //# sourceMappingURL=index-Cab7kIQH.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-CtxApOJm.js","sources":["../../../src/lib/dev-panel.ts","../../../src/plugins/client-injection-plugin.ts","../../../src/banner/header.ts","../../../src/lib/next-import.ts","../../../src/lib/env.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,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","CONTENT_TYPES","DIRNAME","__filename","resolve","url","document","require","pathToFileURL","href","_documentCurrentScript","tagName","toUpperCase","src","URL","baseURI","fileURLToPath","process","cwd","normalizePath","PP_DEV_PACKAGE_DIR","PACKAGE_REGEXP","RegExp","cachedTemplateContent","cachedTemplate","clientInjectionPlugin","opts","name","apply","config","optimizeDeps","exclude","push","resolveId","source","match","resolvedId","startsWith","id","transformIndexHtml","html","ctx","server","templatePath","cache","filename","assetPaths","result","tags","tag","injectTo","attrs","rel","templateData","children","type","configureServer","clientDir","root","allow","replacer","substring","$1","header","_chunk","replace","safeNextImport","next","constants","Promise","all","default","error","Error","previouslyLoadedKeys","Set","loadPPDevEnv","mode","envDir","key","env","loadEnv","value","Object","entries","keys","configCache","Map","CACHE_TTL","packageJsonCache","getPackageJson","projectRoot","now","Date","cached","get","timestamp","JSON","parse","flag","set","empty","esbuildModule","loadTsConfig","filePath","cacheKey","isESM","test","pkg","esbuild","getEsbuild","build","absWorkingDir","entryPoints","outfile","write","target","platform","bundle","packages","format","mainFields","sourcemap","metafile","text","code","outputFiles","fileNameTmp","Math","random","toString","slice","tempFilePath","fileUrl","writeFileSync","conf","existsSync","unlink","loadJsConfig","loadJSONConfig","dirContentCache","getPkg","getConfig","dirContent","files","endsWithRegExp","readdirSync","withFileTypes","filter","isFile","map","getDirectoryContent","configFound","newConfig","dirFiles","configNames","configName","includes","configPath","endsWith","loadConfig","PP_DEV_CONFIG_NAMES","packageConfig","Array","isArray","clear","parseBooleanFlag","undefined","toLowerCase","applyDistZipOverride","overrides","defaultFileName","distZipEnabled","distZipDir","distZipFilename","outFileName","normalizeRelativeOutputPath","baseConfig","outDir","applyVersionManifestOverride","versionManifestEnabled","versionFileTemplate","enabled","normalizedVersionFileTemplate","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","getPPDevConfigFromNextConfig","nextConfig","ppDev","assetPrefix","allowed","req","res","pathname","split","fileName","length","has","readFile","err","content","statusCode","setHeader","extname","end","version","environment","templateName","ppDevConfig","validatePPDevConfig","normalizedPPDevConfig","normalizePPDevConfig","distZip","createDefaultZipFileName","versionPlugin","vitePPDev","then","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","linkTag","bodyPrepend","linkInjected","head","options","PP_DEV_DIST_ZIP","PP_DEV_DIST_ZIP_DIR","PP_DEV_DIST_ZIP_FILENAME","versionManifest","PP_DEV_VERSION_MANIFEST","PP_DEV_VERSION_FILE_TEMPLATE","nextjsConfig","phase","PHASE_DEVELOPMENT_SERVER","PHASE_PRODUCTION_BUILD","PP_DEV_NEXT_BUILD_ENV_VAR","createLogger","warn","colors","yellow","nextConfiguration","mergedConfig","configs","merged","mutableMerged","mergePPDevConfigs","normalized","v7Features","isDevelopment","basePath","PATH_TEMPLATE_LOCAL_PREFIX","createBasePath","trailingSlash","prefix","assign","defineProperty","enumerable","configurable","String"],"mappings":"ggBA4BMA,EAAkBC,EAAKC,QAAQC,uBAC/BC,EAAgBH,EAAKI,KAAKL,EAAiB,cAEjD,IAAIM,EAA4C,KAqB1C,SAAUC,EAAsBC,GACpC,MAAO,CACLC,IAAKR,EAAKS,MAAML,KAAKG,EAAMG,EAAAA,aAAc,qBACzCC,GAAIX,EAAKS,MAAML,KAAKG,EAAMG,EAAAA,aAAc,oBAE5C,CAGM,SAAUE,EAAqBC,GAGnC,OA9BF,WACE,GAAIR,EACF,OAAOA,EAGT,MAAMS,EAAkBC,EAAGC,aAAab,EAAe,CAAEc,SAAU,SAUnE,OARAZ,EAAmBa,EAAIC,QAAQL,E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Je0M,EAAAA,eAER1M,MAAM,sBAAuB,CAAEA,MAAOA,aAAiBC,MAAQD,EAAQ,IAAIC,MAAM+N,OAAOhO,MAEzFA,CACR,EAEJ"}
1
+ {"version":3,"file":"index-Cab7kIQH.js","sources":["../../../src/lib/dev-panel.ts","../../../src/plugins/client-injection-plugin.ts","../../../src/banner/header.ts","../../../src/lib/next-import.ts","../../../src/lib/env.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,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","CONTENT_TYPES","DIRNAME","__filename","resolve","url","document","require","pathToFileURL","href","_documentCurrentScript","tagName","toUpperCase","src","URL","baseURI","fileURLToPath","process","cwd","normalizePath","PP_DEV_PACKAGE_DIR","PACKAGE_REGEXP","RegExp","cachedTemplateContent","cachedTemplate","clientInjectionPlugin","opts","name","apply","config","optimizeDeps","exclude","push","resolveId","source","match","resolvedId","startsWith","id","transformIndexHtml","html","ctx","server","templatePath","cache","filename","assetPaths","result","tags","tag","injectTo","attrs","rel","templateData","children","type","configureServer","clientDir","root","allow","replacer","substring","$1","header","_chunk","replace","safeNextImport","next","constants","Promise","all","default","error","Error","previouslyLoadedKeys","Set","loadPPDevEnv","mode","envDir","key","env","loadEnv","value","Object","entries","keys","configCache","Map","CACHE_TTL","packageJsonCache","getPackageJson","projectRoot","now","Date","cached","get","timestamp","JSON","parse","flag","set","empty","esbuildModule","loadTsConfig","filePath","cacheKey","isESM","test","pkg","esbuild","getEsbuild","build","absWorkingDir","entryPoints","outfile","write","target","platform","bundle","packages","format","mainFields","sourcemap","metafile","text","code","outputFiles","fileNameTmp","Math","random","toString","slice","tempFilePath","fileUrl","writeFileSync","conf","existsSync","unlink","loadJsConfig","loadJSONConfig","dirContentCache","getPkg","getConfig","dirContent","files","endsWithRegExp","readdirSync","withFileTypes","filter","isFile","map","getDirectoryContent","configFound","newConfig","dirFiles","configNames","configName","includes","configPath","endsWith","loadConfig","PP_DEV_CONFIG_NAMES","packageConfig","Array","isArray","clear","parseBooleanFlag","undefined","toLowerCase","applyDistZipOverride","overrides","defaultFileName","distZipEnabled","distZipDir","distZipFilename","outFileName","normalizeRelativeOutputPath","baseConfig","outDir","applyVersionManifestOverride","versionManifestEnabled","versionFileTemplate","enabled","normalizedVersionFileTemplate","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","getPPDevConfigFromNextConfig","nextConfig","ppDev","assetPrefix","allowed","req","res","pathname","split","fileName","length","has","readFile","err","content","statusCode","setHeader","extname","end","version","environment","templateName","ppDevConfig","validatePPDevConfig","normalizedPPDevConfig","normalizePPDevConfig","distZip","createDefaultZipFileName","versionPlugin","vitePPDev","then","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","linkTag","bodyPrepend","linkInjected","head","options","PP_DEV_DIST_ZIP","PP_DEV_DIST_ZIP_DIR","PP_DEV_DIST_ZIP_FILENAME","versionManifest","PP_DEV_VERSION_MANIFEST","PP_DEV_VERSION_FILE_TEMPLATE","nextjsConfig","phase","PHASE_DEVELOPMENT_SERVER","PHASE_PRODUCTION_BUILD","PP_DEV_NEXT_BUILD_ENV_VAR","createLogger","warn","colors","yellow","nextConfiguration","mergedConfig","configs","merged","mutableMerged","mergePPDevConfigs","normalized","v7Features","isDevelopment","basePath","PATH_TEMPLATE_LOCAL_PREFIX","createBasePath","trailingSlash","prefix","assign","defineProperty","enumerable","configurable","String"],"mappings":"ggBA4BMA,EAAkBC,EAAKC,QAAQC,uBAC/BC,EAAgBH,EAAKI,KAAKL,EAAiB,cAEjD,IAAIM,EAA4C,KAqB1C,SAAUC,EAAsBC,GACpC,MAAO,CACLC,IAAKR,EAAKS,MAAML,KAAKG,EAAMG,EAAAA,aAAc,qBACzCC,GAAIX,EAAKS,MAAML,KAAKG,EAAMG,EAAAA,aAAc,oBAE5C,CAGM,SAAUE,EAAqBC,GAGnC,OA9BF,WACE,GAAIR,EACF,OAAOA,EAGT,MAAMS,EAAkBC,EAAGC,aAAab,EAAe,CAAEc,SAAU,SAUnE,OARAZ,EAAmBa,EAAIC,QAAQL,EAAiB,CAC9CM,cAAe,IACfC,eAAgB,IAChBC,OAAO,EACPC,cAAc,EACdC,cAAc,IAGTnB,CACT,CAYmBoB,EAEVC,CAAS,cACdhB,EAAAA,qBACAiB,EAAAA,QACAC,eAAgBf,EAAKe,eACrBC,aAAchB,EAAKgB,aACnBC,MAAOjB,EAAKiB,MACZC,QAASlB,EAAKkB,UAAW,EAGzBC,iBAAkBnB,EAAKmB,kBAAoB,eAC3CC,eAAgBpB,EAAKoB,iBAAkB,EACvCC,iBAAkBrB,EAAKqB,mBAAoB,GAE/C,CA0CA,MAAMC,EAAwC,CAC5C,MAAO,iCACP,OAAQ,0BACR,OAAQ,mCC5FV,IAAIC,EAEJ,IAIIA,EAFwB,oBAAfC,YAA8BA,WAE7BrC,EAAKsC,QAAQtC,EAAKC,QAAQoC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GhDtO,aAAEA,EAAYkS,WAAEA,GAAeD,EAG/BE,EAAgBhB,IAAUC,EAC1BgB,EA9EZ,SACE9D,EACAtO,EACAmS,EACAD,GAEA,OAAIC,EACED,EACElS,EACK,GAAG6P,EAAAA,oBAAoBvB,IAEvB,GAAG+D,EAAAA,8BAA8B/D,IAGtCtO,EACK,GAAG6P,EAAAA,oBAAoBvB,IAEvB,GAAGwB,EAAAA,wBAAwBxB,IAKjC,GAAGuB,EAAAA,oBAAoBvB,GAChC,CAuDuBgE,CAAeL,EAAW3D,aAActO,EAAcmS,EAAeD,GAEhF5G,EAAyB,CAC7B8G,WACAG,gBAAeJ,QAAuBvH,GAGxC,IAAK5K,EAAc,CACjB,MAAMwS,EAASL,GAAiBD,EAAaG,EAAAA,2BAA6BvC,EAAAA,qBAE1ExE,EAAW8B,YAAc,GAAGoF,KAAUP,EAAW3D,cACnD,CAKA,MAAMlL,EAASoC,OAAOiN,OAAO,CAAA,EAAInH,EAAYqG,GAQ7C,OANAnM,OAAOkN,eAAetP,EAAQ,QAAS,CACrCmC,MAAOqM,EACPe,YAAY,EACZC,cAAc,IAGTxP,CACT,CAAE,MAAOyB,GAKP,MAJe0M,EAAAA,eAER1M,MAAM,sBAAuB,CAAEA,MAAOA,aAAiBC,MAAQD,EAAQ,IAAIC,MAAM+N,OAAOhO,MAEzFA,CACR,EAEJ"}
package/dist/cjs/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";require("child_process");const e=require("./plugin-CkZeoDh1.js"),r=require("./index-CtxApOJm.js"),i=require("./helpers.js");require("http-proxy-middleware"),require("url"),require("vite"),require("picocolors"),require("node:string_decoder"),require("axios"),require("node:http"),require("node:https"),require("jsdom"),require("path"),require("fs"),require("crypto"),require("process"),require("os"),require("extract-zip"),require("node:path"),require("jszip"),require("module"),require("memory-cache"),require("zlib"),require("express"),require("node:crypto"),require("ejs"),exports.AuthProvider=e.AuthProvider,exports.authProvider=e.authProvider,exports.normalizePPDevConfig=e.normalizePPDevConfig,exports.validatePPDevConfig=e.validatePPDevConfig,exports.getNextVersion=r.getNextVersion,exports.getPPDevConfigFromNextConfig=r.getPPDevConfigFromNextConfig,exports.getViteConfig=r.getViteConfig,exports.isNextAvailable=r.isNextAvailable,exports.safeNextImport=r.safeNextImport,exports.withPPDev=r.withPPDev,exports.defineConfig=i.defineConfig;
1
+ "use strict";require("child_process");const e=require("./plugin-BcxTOlCf.js"),r=require("./index-Cab7kIQH.js"),i=require("./helpers.js");require("http-proxy-middleware"),require("url"),require("vite"),require("picocolors"),require("node:string_decoder"),require("axios"),require("node:http"),require("node:https"),require("jsdom"),require("path"),require("fs"),require("crypto"),require("process"),require("os"),require("extract-zip"),require("node:path"),require("jszip"),require("module"),require("memory-cache"),require("zlib"),require("express"),require("node:crypto"),require("ejs"),exports.AuthProvider=e.AuthProvider,exports.authProvider=e.authProvider,exports.normalizePPDevConfig=e.normalizePPDevConfig,exports.validatePPDevConfig=e.validatePPDevConfig,exports.getNextVersion=r.getNextVersion,exports.getPPDevConfigFromNextConfig=r.getPPDevConfigFromNextConfig,exports.getViteConfig=r.getViteConfig,exports.isNextAvailable=r.isNextAvailable,exports.safeNextImport=r.safeNextImport,exports.withPPDev=r.withPPDev,exports.defineConfig=i.defineConfig;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("fs"),i=require("path"),t=require("./plugin-CkZeoDh1.js");require("http-proxy-middleware"),require("url"),require("vite"),require("picocolors"),require("node:string_decoder"),require("axios"),require("node:http"),require("node:https"),require("jsdom"),require("crypto"),require("process"),require("child_process"),require("os"),require("extract-zip"),require("node:path"),require("jszip"),require("module"),require("memory-cache"),require("zlib"),require("express"),require("node:crypto");const r=(e=>e&&"object"==typeof e&&"default"in e?e.default:e)(i),n=new Set(["backendBaseURL","personalAccessToken","miHudLess","integrateMiTopBar","v7Features","appId","portalPageId","templateName","templateLess","enableProxyCache","proxyCacheTTL","disableSSLValidation","distZip","versionPlugin","imageOptimizer","outDir","syncBackupsDir"]);const o=[".pp-watch.config.ts",".pp-watch.config.js",".pp-watch.config.json","pp-watch.config.ts","pp-watch.config.js","pp-watch.config.json"];function s(e,i=0){const t=" ".repeat(i),r=" ".repeat(i+1);if(null===e)return"null";if("boolean"==typeof e)return String(e);if("number"==typeof e)return String(e);if("string"==typeof e)return`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`;if(Array.isArray(e)){if(0===e.length)return"[]";return`[\n${e.map(e=>`${r}${s(e,i+1)}`).join(",\n")},\n${t}]`}if("object"==typeof e&&null!==e){const n=Object.entries(e).filter(([,e])=>void 0!==e);if(0===n.length)return"{}";return`{\n${n.map(([e,t])=>`${r}${e}: ${s(t,i+1)}`).join(",\n")},\n${t}}`}return String(e)}exports.discoverMigrateSource=function(i,n){let s=n??null,a=!1;if(!s){for(const n of t.PP_DEV_CONFIG_NAMES){const t=r.join(i,n);if(e.existsSync(t)){s=t;break}}if(!s)for(const t of o){const n=r.join(i,t);if(e.existsSync(n)){s=n,a=!0;break}}if(!s){const t=r.join(i,"package.json");if(e.existsSync(t))try{const i=JSON.parse(e.readFileSync(t,"utf-8"));i["pp-dev"]&&"object"==typeof i["pp-dev"]&&!Array.isArray(i["pp-dev"])&&(s=t)}catch{}}}return s?{sourceFile:s,isWatchConfig:a,isPackageJsonConfig:"package.json"===r.basename(s)}:null},exports.generateConfigFileContent=function(e,i="ts"){return"json"===i?JSON.stringify(e,null,2)+"\n":`${"ts"===i?"import { defineConfig } from '@metricinsights/pp-dev';":"const { defineConfig } = require('@metricinsights/pp-dev');"}\n\n${"ts"===i?"export default":"module.exports ="} defineConfig(${s(e)});\n`},exports.isAlreadyMigrated=function(e){const i=new Set(["mi","app","proxy","build","sync","inspector"]);return Object.keys(e).some(e=>i.has(e))},exports.isLegacyFlatConfig=function(e){return Object.keys(e).some(e=>n.has(e))},exports.isLegacyPPWatchConfig=function(e){return"baseURL"in e},exports.loadPackageJsonMigrateConfig=function(i){return JSON.parse(e.readFileSync(i,"utf-8"))["pp-dev"]},exports.migrateLegacyFlatConfig=function(e,i){const t={},r={};void 0!==e.backendBaseURL&&(r.url=e.backendBaseURL),void 0!==e.personalAccessToken&&(r.token=e.personalAccessToken),void 0!==e.miHudLess&&(r.mode=e.miHudLess?"standalone":"embedding"),e.integrateMiTopBar&&(!0===e.integrateMiTopBar?(r.mode||(r.mode="standalone"),r.include="top-bar"):"object"==typeof e.integrateMiTopBar&&(e.integrateMiTopBar.addRootElement||e.integrateMiTopBar.addSharedComponentsScripts)&&(r.mode||(r.mode="standalone"),r.include=e.integrateMiTopBar.addRootElement?"top-bar":"shared-components")),void 0!==e.v7Features&&(r.apiVersion=e.v7Features?7:6),Object.keys(r).length>0&&(t.mi=r);const n={},o=e.appId??e.portalPageId;void 0!==o&&(n.id=o),void 0!==e.templateName&&e.templateName!==i&&(n.name=e.templateName),void 0!==e.templateLess&&(n.type=e.templateLess?"page":"template"),Object.keys(n).length>0&&(t.app=n);const s={};void 0!==e.enableProxyCache&&(s.cache=e.enableProxyCache),void 0!==e.proxyCacheTTL&&(s.cacheTtl=e.proxyCacheTTL),void 0!==e.disableSSLValidation&&(s.tls={allowSelfSigned:e.disableSSLValidation}),Object.keys(s).length>0&&(t.proxy=s);const a={};if(void 0!==e.outDir&&(a.outDir=e.outDir),void 0!==e.distZip)if("object"==typeof e.distZip&&null!==e.distZip){const i={};void 0!==e.distZip.outFileName&&(i.fileName=e.distZip.outFileName),void 0!==e.distZip.outDir&&(i.outDir=e.distZip.outDir),void 0!==e.distZip.inDir&&(i.inDir=e.distZip.inDir),a.zip=!(Object.keys(i).length>0)||i}else a.zip=e.distZip;if(void 0!==e.versionPlugin)if("object"==typeof e.versionPlugin&&null!==e.versionPlugin){const i={};void 0!==e.versionPlugin.enabled&&(i.enabled=e.versionPlugin.enabled),void 0!==e.versionPlugin.versionFileTemplate&&(i.fileNameTemplate=e.versionPlugin.versionFileTemplate),a.versionFile=!(Object.keys(i).length>0)||i}else a.versionFile=e.versionPlugin;return void 0!==e.imageOptimizer&&(a.imageOptimisations=e.imageOptimizer),Object.keys(a).length>0&&(t.build=a),void 0!==e.syncBackupsDir&&(t.sync={backupsDir:e.syncBackupsDir}),t},exports.migratePPWatchConfig=function(e){const i={mi:{url:e.baseURL}};return void 0!==e.portalPageId&&(i.app={id:e.portalPageId}),i};
2
- //# sourceMappingURL=migrate-t_tUHdbD.js.map
1
+ "use strict";const e=require("fs"),i=require("path"),t=require("./plugin-BcxTOlCf.js");require("http-proxy-middleware"),require("url"),require("vite"),require("picocolors"),require("node:string_decoder"),require("axios"),require("node:http"),require("node:https"),require("jsdom"),require("crypto"),require("process"),require("child_process"),require("os"),require("extract-zip"),require("node:path"),require("jszip"),require("module"),require("memory-cache"),require("zlib"),require("express"),require("node:crypto");const r=(e=>e&&"object"==typeof e&&"default"in e?e.default:e)(i),n=new Set(["backendBaseURL","personalAccessToken","miHudLess","integrateMiTopBar","v7Features","appId","portalPageId","templateName","templateLess","enableProxyCache","proxyCacheTTL","disableSSLValidation","distZip","versionPlugin","imageOptimizer","outDir","syncBackupsDir"]);const o=[".pp-watch.config.ts",".pp-watch.config.js",".pp-watch.config.json","pp-watch.config.ts","pp-watch.config.js","pp-watch.config.json"];function s(e,i=0){const t=" ".repeat(i),r=" ".repeat(i+1);if(null===e)return"null";if("boolean"==typeof e)return String(e);if("number"==typeof e)return String(e);if("string"==typeof e)return`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`;if(Array.isArray(e)){if(0===e.length)return"[]";return`[\n${e.map(e=>`${r}${s(e,i+1)}`).join(",\n")},\n${t}]`}if("object"==typeof e&&null!==e){const n=Object.entries(e).filter(([,e])=>void 0!==e);if(0===n.length)return"{}";return`{\n${n.map(([e,t])=>`${r}${e}: ${s(t,i+1)}`).join(",\n")},\n${t}}`}return String(e)}exports.discoverMigrateSource=function(i,n){let s=n??null,a=!1;if(!s){for(const n of t.PP_DEV_CONFIG_NAMES){const t=r.join(i,n);if(e.existsSync(t)){s=t;break}}if(!s)for(const t of o){const n=r.join(i,t);if(e.existsSync(n)){s=n,a=!0;break}}if(!s){const t=r.join(i,"package.json");if(e.existsSync(t))try{const i=JSON.parse(e.readFileSync(t,"utf-8"));i["pp-dev"]&&"object"==typeof i["pp-dev"]&&!Array.isArray(i["pp-dev"])&&(s=t)}catch{}}}return s?{sourceFile:s,isWatchConfig:a,isPackageJsonConfig:"package.json"===r.basename(s)}:null},exports.generateConfigFileContent=function(e,i="ts"){return"json"===i?JSON.stringify(e,null,2)+"\n":`${"ts"===i?"import { defineConfig } from '@metricinsights/pp-dev';":"const { defineConfig } = require('@metricinsights/pp-dev');"}\n\n${"ts"===i?"export default":"module.exports ="} defineConfig(${s(e)});\n`},exports.isAlreadyMigrated=function(e){const i=new Set(["mi","app","proxy","build","sync","inspector"]);return Object.keys(e).some(e=>i.has(e))},exports.isLegacyFlatConfig=function(e){return Object.keys(e).some(e=>n.has(e))},exports.isLegacyPPWatchConfig=function(e){return"baseURL"in e},exports.loadPackageJsonMigrateConfig=function(i){return JSON.parse(e.readFileSync(i,"utf-8"))["pp-dev"]},exports.migrateLegacyFlatConfig=function(e,i){const t={},r={};void 0!==e.backendBaseURL&&(r.url=e.backendBaseURL),void 0!==e.personalAccessToken&&(r.token=e.personalAccessToken),void 0!==e.miHudLess&&(r.mode=e.miHudLess?"standalone":"embedding"),e.integrateMiTopBar&&(!0===e.integrateMiTopBar?(r.mode||(r.mode="standalone"),r.include="top-bar"):"object"==typeof e.integrateMiTopBar&&(e.integrateMiTopBar.addRootElement||e.integrateMiTopBar.addSharedComponentsScripts)&&(r.mode||(r.mode="standalone"),r.include=e.integrateMiTopBar.addRootElement?"top-bar":"shared-components")),void 0!==e.v7Features&&(r.apiVersion=e.v7Features?7:6),Object.keys(r).length>0&&(t.mi=r);const n={},o=e.appId??e.portalPageId;void 0!==o&&(n.id=o),void 0!==e.templateName&&e.templateName!==i&&(n.name=e.templateName),void 0!==e.templateLess&&(n.type=e.templateLess?"page":"template"),Object.keys(n).length>0&&(t.app=n);const s={};void 0!==e.enableProxyCache&&(s.cache=e.enableProxyCache),void 0!==e.proxyCacheTTL&&(s.cacheTtl=e.proxyCacheTTL),void 0!==e.disableSSLValidation&&(s.tls={allowSelfSigned:e.disableSSLValidation}),Object.keys(s).length>0&&(t.proxy=s);const a={};if(void 0!==e.outDir&&(a.outDir=e.outDir),void 0!==e.distZip)if("object"==typeof e.distZip&&null!==e.distZip){const i={};void 0!==e.distZip.outFileName&&(i.fileName=e.distZip.outFileName),void 0!==e.distZip.outDir&&(i.outDir=e.distZip.outDir),void 0!==e.distZip.inDir&&(i.inDir=e.distZip.inDir),a.zip=!(Object.keys(i).length>0)||i}else a.zip=e.distZip;if(void 0!==e.versionPlugin)if("object"==typeof e.versionPlugin&&null!==e.versionPlugin){const i={};void 0!==e.versionPlugin.enabled&&(i.enabled=e.versionPlugin.enabled),void 0!==e.versionPlugin.versionFileTemplate&&(i.fileNameTemplate=e.versionPlugin.versionFileTemplate),a.versionFile=!(Object.keys(i).length>0)||i}else a.versionFile=e.versionPlugin;return void 0!==e.imageOptimizer&&(a.imageOptimisations=e.imageOptimizer),Object.keys(a).length>0&&(t.build=a),void 0!==e.syncBackupsDir&&(t.sync={backupsDir:e.syncBackupsDir}),t},exports.migratePPWatchConfig=function(e){const i={mi:{url:e.baseURL}};return void 0!==e.portalPageId&&(i.app={id:e.portalPageId}),i};
2
+ //# sourceMappingURL=migrate-tyzkQsrd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"migrate-t_tUHdbD.js","sources":["../../../src/lib/migrate.ts"],"sourcesContent":[null],"names":["LEGACY_FLAT_KEYS","Set","WATCH_CONFIG_NAMES","serializeValue","value","depth","indent","repeat","innerIndent","String","replace","Array","isArray","length","map","v","join","entries","Object","filter","undefined","k","projectRoot","configArg","sourceFile","isWatchConfig","name","PP_DEV_CONFIG_NAMES","candidate","path","existsSync","pkgJsonPath","pkgJson","JSON","parse","readFileSync","isPackageJsonConfig","basename","config","format","stringify","NEW_KEYS","keys","some","has","legacy","packageName","mi","backendBaseURL","url","personalAccessToken","token","miHudLess","mode","integrateMiTopBar","include","addRootElement","addSharedComponentsScripts","v7Features","apiVersion","app","appId","portalPageId","id","templateName","templateLess","type","proxy","enableProxyCache","cache","proxyCacheTTL","cacheTtl","disableSSLValidation","tls","allowSelfSigned","build","outDir","distZip","zip","outFileName","fileName","inDir","versionPlugin","vf","enabled","versionFileTemplate","fileNameTemplate","versionFile","imageOptimizer","imageOptimisations","syncBackupsDir","sync","backupsDir","watchCfg","baseURL"],"mappings":"ukBAmCMA,EAAmB,IAAIC,IAAI,CAC/B,iBACA,sBACA,YACA,oBACA,aACA,QACA,eACA,eACA,eACA,mBACA,gBACA,uBACA,UACA,gBACA,iBACA,SACA,mBAmBF,MAAMC,EAAqB,CACzB,sBACA,sBACA,wBACA,qBACA,qBACA,wBA2OF,SAASC,EAAeC,EAAgBC,EAAQ,GAC9C,MAAMC,EAAS,KAAKC,OAAOF,GACrBG,EAAc,KAAKD,OAAOF,EAAQ,GAExC,GAAc,OAAVD,EACF,MAAO,OAGT,GAAqB,kBAAVA,EACT,OAAOK,OAAOL,GAGhB,GAAqB,iBAAVA,EACT,OAAOK,OAAOL,GAGhB,GAAqB,iBAAVA,EACT,MAAO,IAAIA,EAAMM,QAAQ,MAAO,QAAQA,QAAQ,KAAM,UAGxD,GAAIC,MAAMC,QAAQR,GAAQ,CACxB,GAAqB,IAAjBA,EAAMS,OACR,MAAO,KAKT,MAAO,MAFOT,EAAMU,IAAKC,GAAM,GAAGP,IAAcL,EAAeY,EAAGV,EAAQ,MAAMW,KAAK,YAE7DV,IAC1B,CAEA,GAAqB,iBAAVF,GAAgC,OAAVA,EAAgB,CAC/C,MAAMa,EAAUC,OAAOD,QAAQb,GAAkCe,OAAO,GAAIJ,UAAaK,IAANL,GAEnF,GAAuB,IAAnBE,EAAQJ,OACV,MAAO,KAKT,MAAO,MAFOI,EAAQH,IAAI,EAAEO,EAAGN,KAAO,GAA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AO6C,iBACTpD,EAAOqD,KAAO,CAAEC,WAAY/C,EAAO6C,iBAG9BpD,CACT,+BAEM,SAA+BuD,GACnC,MAAMvD,EAAsB,CAAES,GAAI,CAAEE,IAAK4C,EAASC,UAMlD,YAJ8B1E,IAA1ByE,EAAS/B,eACXxB,EAAOsB,IAAM,CAAEG,GAAI8B,EAAS/B,eAGvBxB,CACT"}
1
+ {"version":3,"file":"migrate-tyzkQsrd.js","sources":["../../../src/lib/migrate.ts"],"sourcesContent":[null],"names":["LEGACY_FLAT_KEYS","Set","WATCH_CONFIG_NAMES","serializeValue","value","depth","indent","repeat","innerIndent","String","replace","Array","isArray","length","map","v","join","entries","Object","filter","undefined","k","projectRoot","configArg","sourceFile","isWatchConfig","name","PP_DEV_CONFIG_NAMES","candidate","path","existsSync","pkgJsonPath","pkgJson","JSON","parse","readFileSync","isPackageJsonConfig","basename","config","format","stringify","NEW_KEYS","keys","some","has","legacy","packageName","mi","backendBaseURL","url","personalAccessToken","token","miHudLess","mode","integrateMiTopBar","include","addRootElement","addSharedComponentsScripts","v7Features","apiVersion","app","appId","portalPageId","id","templateName","templateLess","type","proxy","enableProxyCache","cache","proxyCacheTTL","cacheTtl","disableSSLValidation","tls","allowSelfSigned","build","outDir","distZip","zip","outFileName","fileName","inDir","versionPlugin","vf","enabled","versionFileTemplate","fileNameTemplate","versionFile","imageOptimizer","imageOptimisations","syncBackupsDir","sync","backupsDir","watchCfg","baseURL"],"mappings":"ukBAmCMA,EAAmB,IAAIC,IAAI,CAC/B,iBACA,sBACA,YACA,oBACA,aACA,QACA,eACA,eACA,eACA,mBACA,gBACA,uBACA,UACA,gBACA,iBACA,SACA,mBAmBF,MAAMC,EAAqB,CACzB,sBACA,sBACA,wBACA,qBACA,qBACA,wBA2OF,SAASC,EAAeC,EAAgBC,EAAQ,GAC9C,MAAMC,EAAS,KAAKC,OAAOF,GACrBG,EAAc,KAAKD,OAAOF,EAAQ,GAExC,GAAc,OAAVD,EACF,MAAO,OAGT,G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,EAAMG,IAAMjC,EAAOgC,QAIvB,QAA6BzD,IAAzByB,EAAOqC,cACT,GAAoC,iBAAzBrC,EAAOqC,eAAuD,OAAzBrC,EAAOqC,cAAwB,CAC7E,MAAMC,EAAuD,CAAA,OAExB/D,IAAjCyB,EAAOqC,cAAcE,UACvBD,EAAGC,QAAUvC,EAAOqC,cAAcE,cAGahE,IAA7CyB,EAAOqC,cAAcG,sBACvBF,EAAGG,iBAAmBzC,EAAOqC,cAAcG,qBAG7CV,EAAMY,cAAcrE,OAAOwB,KAAKyC,GAAItE,OAAS,IAAIsE,CACnD,MACER,EAAMY,YAAc1C,EAAOqC,cAiB/B,YAb8B9D,IAA1ByB,EAAO2C,iBACTb,EAAMc,mBAAqB5C,EAAO2C,gBAGhCtE,OAAOwB,KAAKiC,GAAO9D,OAAS,IAC9ByB,EAAOqC,MAAQA,QAIavD,IAA1ByB,EAAO6C,iBACTpD,EAAOqD,KAAO,CAAEC,WAAY/C,EAAO6C,iBAG9BpD,CACT,+BAEM,SAA+BuD,GACnC,MAAMvD,EAAsB,CAAES,GAAI,CAAEE,IAAK4C,EAASC,UAMlD,YAJ8B1E,IAA1ByE,EAAS/B,eACXxB,EAAOsB,IAAM,CAAEG,GAAI8B,EAAS/B,eAGvBxB,CACT"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@metricinsights/pp-dev",
3
3
  "type": "commonjs",
4
- "version": "1.4.1-beta.3",
4
+ "version": "1.4.1-beta.4",
5
5
  "description": "Portal Page dev build tool",
6
6
  "bin": {
7
7
  "pp-dev": "bin/pp-dev.js"