@metricinsights/pp-dev 0.12.3 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ # [0.13.0-beta.1](https://github.com/mi-examples/pp-dev/compare/v0.12.4...v0.13.0-beta.1) (2026-01-22)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **plugin:** add null check for integrateMiTopBar validation ([df35e2a](https://github.com/mi-examples/pp-dev/commit/df35e2a8a265bd4a6445ec78c9ae94d4c24f105d))
7
+
8
+
9
+ ### Features
10
+
11
+ * **plugin:** enhance integrateMiTopBar with selective configuration options ([cbb9a6c](https://github.com/mi-examples/pp-dev/commit/cbb9a6c59db401201fb2530f46ca47eaaa585526))
12
+
13
+ ## [0.12.4-beta.1](https://github.com/mi-examples/pp-dev/compare/v0.12.3...v0.12.4-beta.1) (2026-01-14)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * **plugin:** move topbar scripts injection to head-prepend ([a248f91](https://github.com/mi-examples/pp-dev/commit/a248f91b14817a36a37d56e9107762b514bf90ac))
19
+
1
20
  # [@metricinsights/pp-dev-v0.12.3-beta.1](https://github.com/mi-examples/pp-dev-js/compare/v0.12.2...v0.12.3-beta.1) (2025-12-19)
2
21
 
3
22
 
package/README.md CHANGED
@@ -210,7 +210,7 @@ export default config;
210
210
  | Option | Type | Default | Description |
211
211
  |--------|------|---------|-------------|
212
212
  | `miHudLess` | boolean | `false` | Disables Metric Insights navigation bar in development |
213
- | `integrateMiTopBar` | boolean | `false` | Integrates MI Top Bar and script into the App build (requires `miHudLess: true`) |
213
+ | `integrateMiTopBar` | boolean \| object | `false` | Integrates MI Top Bar and scripts into the App build (requires `miHudLess: true`). When `true`, enables both `addRootElement` and `addSharedComponentsScripts`. When an object, allows selective enabling: `{ addRootElement?: boolean, addSharedComponentsScripts?: boolean }` |
214
214
  | `templateLess` | boolean | `false` | Disables template variable transformation |
215
215
  | `enableProxyCache` | boolean | `true` | Enables caching of proxied requests |
216
216
  | `proxyCacheTTL` | number | `600000` | Cache TTL in milliseconds (10 minutes) |
@@ -232,7 +232,24 @@ The `integrateMiTopBar` option allows you to integrate the Metric Insights Top B
232
232
 
233
233
  **Important**: This option can only be enabled when `miHudLess` is set to `true`.
234
234
 
235
- Example configuration:
235
+ #### Configuration Options
236
+
237
+ `integrateMiTopBar` can be configured in two ways:
238
+
239
+ **1. Boolean (Simple)**
240
+ - `true`: Enables both `addRootElement` and `addSharedComponentsScripts`
241
+ - `false`: Disables integration (default)
242
+
243
+ **2. Object (Advanced)**
244
+ - `addRootElement`: Adds `<div id="mi-react-root">` element to the body for React mounting
245
+ - `addSharedComponentsScripts`: Adds MI shared component scripts and styles:
246
+ - `/auth/info.js` - Authentication info script
247
+ - `/js/main.js` - Main MI JavaScript bundle
248
+ - `/css/main.css` - MI stylesheet
249
+
250
+ #### Examples
251
+
252
+ **Simple boolean configuration:**
236
253
  ```javascript
237
254
  // pp-dev.config.js
238
255
  module.exports = {
@@ -243,6 +260,34 @@ module.exports = {
243
260
  };
244
261
  ```
245
262
 
263
+ **Advanced object configuration (selective features):**
264
+ ```javascript
265
+ // pp-dev.config.js
266
+ module.exports = {
267
+ backendBaseURL: 'https://mi.company.com',
268
+ appId: 1,
269
+ miHudLess: true,
270
+ integrateMiTopBar: {
271
+ addRootElement: true, // Add root element for React
272
+ addSharedComponentsScripts: true, // Add MI scripts and styles
273
+ },
274
+ };
275
+ ```
276
+
277
+ **Partial integration (scripts only, manual root element):**
278
+ ```javascript
279
+ // pp-dev.config.js
280
+ module.exports = {
281
+ backendBaseURL: 'https://mi.company.com',
282
+ appId: 1,
283
+ miHudLess: true,
284
+ integrateMiTopBar: {
285
+ addRootElement: false, // Don't add root element
286
+ addSharedComponentsScripts: true, // Add MI scripts and styles
287
+ },
288
+ };
289
+ ```
290
+
246
291
  ### v7Features Details
247
292
 
248
293
  When enabled (`true`), this option:
package/dist/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ # [0.13.0-beta.1](https://github.com/mi-examples/pp-dev/compare/v0.12.4...v0.13.0-beta.1) (2026-01-22)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **plugin:** add null check for integrateMiTopBar validation ([df35e2a](https://github.com/mi-examples/pp-dev/commit/df35e2a8a265bd4a6445ec78c9ae94d4c24f105d))
7
+
8
+
9
+ ### Features
10
+
11
+ * **plugin:** enhance integrateMiTopBar with selective configuration options ([cbb9a6c](https://github.com/mi-examples/pp-dev/commit/cbb9a6c59db401201fb2530f46ca47eaaa585526))
12
+
13
+ ## [0.12.4-beta.1](https://github.com/mi-examples/pp-dev/compare/v0.12.3...v0.12.4-beta.1) (2026-01-14)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * **plugin:** move topbar scripts injection to head-prepend ([a248f91](https://github.com/mi-examples/pp-dev/commit/a248f91b14817a36a37d56e9107762b514bf90ac))
19
+
1
20
  # [@metricinsights/pp-dev-v0.12.3-beta.1](https://github.com/mi-examples/pp-dev-js/compare/v0.12.2...v0.12.3-beta.1) (2025-12-19)
2
21
 
3
22
 
package/dist/README.md CHANGED
@@ -210,7 +210,7 @@ export default config;
210
210
  | Option | Type | Default | Description |
211
211
  |--------|------|---------|-------------|
212
212
  | `miHudLess` | boolean | `false` | Disables Metric Insights navigation bar in development |
213
- | `integrateMiTopBar` | boolean | `false` | Integrates MI Top Bar and script into the App build (requires `miHudLess: true`) |
213
+ | `integrateMiTopBar` | boolean \| object | `false` | Integrates MI Top Bar and scripts into the App build (requires `miHudLess: true`). When `true`, enables both `addRootElement` and `addSharedComponentsScripts`. When an object, allows selective enabling: `{ addRootElement?: boolean, addSharedComponentsScripts?: boolean }` |
214
214
  | `templateLess` | boolean | `false` | Disables template variable transformation |
215
215
  | `enableProxyCache` | boolean | `true` | Enables caching of proxied requests |
216
216
  | `proxyCacheTTL` | number | `600000` | Cache TTL in milliseconds (10 minutes) |
@@ -232,7 +232,24 @@ The `integrateMiTopBar` option allows you to integrate the Metric Insights Top B
232
232
 
233
233
  **Important**: This option can only be enabled when `miHudLess` is set to `true`.
234
234
 
235
- Example configuration:
235
+ #### Configuration Options
236
+
237
+ `integrateMiTopBar` can be configured in two ways:
238
+
239
+ **1. Boolean (Simple)**
240
+ - `true`: Enables both `addRootElement` and `addSharedComponentsScripts`
241
+ - `false`: Disables integration (default)
242
+
243
+ **2. Object (Advanced)**
244
+ - `addRootElement`: Adds `<div id="mi-react-root">` element to the body for React mounting
245
+ - `addSharedComponentsScripts`: Adds MI shared component scripts and styles:
246
+ - `/auth/info.js` - Authentication info script
247
+ - `/js/main.js` - Main MI JavaScript bundle
248
+ - `/css/main.css` - MI stylesheet
249
+
250
+ #### Examples
251
+
252
+ **Simple boolean configuration:**
236
253
  ```javascript
237
254
  // pp-dev.config.js
238
255
  module.exports = {
@@ -243,6 +260,34 @@ module.exports = {
243
260
  };
244
261
  ```
245
262
 
263
+ **Advanced object configuration (selective features):**
264
+ ```javascript
265
+ // pp-dev.config.js
266
+ module.exports = {
267
+ backendBaseURL: 'https://mi.company.com',
268
+ appId: 1,
269
+ miHudLess: true,
270
+ integrateMiTopBar: {
271
+ addRootElement: true, // Add root element for React
272
+ addSharedComponentsScripts: true, // Add MI scripts and styles
273
+ },
274
+ };
275
+ ```
276
+
277
+ **Partial integration (scripts only, manual root element):**
278
+ ```javascript
279
+ // pp-dev.config.js
280
+ module.exports = {
281
+ backendBaseURL: 'https://mi.company.com',
282
+ appId: 1,
283
+ miHudLess: true,
284
+ integrateMiTopBar: {
285
+ addRootElement: false, // Don't add root element
286
+ addSharedComponentsScripts: true, // Add MI scripts and styles
287
+ },
288
+ };
289
+ ```
290
+
246
291
  ### v7Features Details
247
292
 
248
293
  When enabled (`true`), this option:
package/dist/cjs/cli.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("path"),o=require("fs"),t=require("node:perf_hooks"),n=require("chokidar"),i=require("cac"),r=require("vite"),s=require("./index-DJdZe-Ks.js"),a=require("./plugin-xN0M6WT7.js"),l=require("url"),c=require("dir-compare"),d=require("diff-match-patch"),p=require("isbinaryfile"),f=require("os"),h=require("crypto"),g=require("extract-zip"),u=require("svgtofont");function m(e){const o=Object.create(null);if(e)for(const t in e)if("default"!==t){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,n.get?n:{enumerable:!0,get:()=>e[t]})}return o.default=e,Object.freeze(o)}require("ejs"),require("http-proxy-middleware"),require("picocolors"),require("axios"),require("jsdom"),require("https"),require("memory-cache"),require("process"),require("child_process"),require("console"),require("zlib"),require("express");const b=m(e),w=m(o),v=m(c),y=m(f),x=m(h);function P(e){return null!=e&&!1!==e}const T=[{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 L=/(.+)(-[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: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, 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: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, 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:o,newAssetsPath:t,destinationPath:n,changelogTemplate:i,diffFileTemplateHandler:r,diffLineTemplateHandler:s,changelogFilename:l,contextLines:c}=e;if(this.logger=a.createLogger(),!o||!t||!n)throw new Error("Previous assets path, current assets path and destination path are required");if(o===t)throw new Error("Previous and current assets paths must be different");if(!this.isExists(o))throw new Error(`Previous assets path ${o} does not exist`);if(!this.isExists(t))throw new Error(`Current assets path ${t} does not exist`);if(this.isZipFile(o)){const e=b.resolve(y.tmpdir(),x.createHash("md5").update(o).digest("hex"));this.oldAssetsPath=this.unzipFile(o,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(o))throw new Error(`Invalid previous assets path ${o}. It must be a folder or a zip file`);{const e=this.normalizeAssetFolderPath(o);if(this.isEmptyFolder(e))throw new Error(`Previous assets path ${e} is empty`);this.oldAssetsPath=Promise.resolve(e)}}if(this.isZipFile(t)){const e=b.resolve(y.tmpdir(),x.createHash("md5").update(t).digest("hex"));this.newAssetsPath=this.unzipFile(t,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(t))throw new Error(`Invalid current assets path ${t}. It must be a folder or a zip file`);{const e=this.normalizeAssetFolderPath(t);if(this.isEmptyFolder(e))throw new Error(`Current assets path ${t} 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(a.colors.yellow("Invalid changelog template, using default"))),"function"==typeof r&&(this.diffFileTemplateHandler=r),"function"==typeof s&&(this.diffLineTemplateHandler=s),c&&(this.contextLines=c)}templateIsValid(e){return e.includes("%FILES%")}isExists(e){return w.existsSync(e)}isZipFile(e){return e.endsWith(".zip")}isFolder(e){return w.lstatSync(e).isDirectory()}isEmptyFolder(e){return 0===w.readdirSync(e,{withFileTypes:!0}).length}mkdirpSync(e){w.existsSync(e)||w.mkdirSync(e,{recursive:!0})}async unzipFile(e,o){return w.rmSync(o,{force:!0,recursive:!0}),g(e,{dir:o})}normalizeAssetFolderPath(e){const o=w.readdirSync(e);return 1===o.length&&w.lstatSync(b.join(e,o[0])).isDirectory()?this.normalizeAssetFolderPath(b.join(e,o[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 o=e.filter(((e,o,t)=>0!==e.lineType||(o>=0&&o<this.contextLines||o>t.length-(this.contextLines+1)&&o<=t.length-1||t.slice(o-this.contextLines,o+this.contextLines+1).some((e=>0!==e.lineType))))).map(((e,o,t)=>{if(o>0){const n=t[o-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(o)}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:o,lineContent:t,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="${o}"`:""}\n ></td>\n <td\n class="blob-num ${i}${"deletion"===i?" empty":""}"\n ${"deletion"!==i?` data-line-number="${o}"`:""}\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=t??"",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:o}=e;return-1===o?this.diffLineSkipTemplate():this.diffLineTemplate(e)}diffFileTemplate(e,o){return this.diffFileTemplateHandler?this.diffFileTemplateHandler(e,o):`<div class="diff-file">\n <div class="diff-file-title">${e}</div>\n <div class="diff-file-content">${o}</div>\n </div>`}async generateAssetFoldersDiff(){this.logger.info(a.colors.blue(`Comparing asset folders ${await this.oldAssetsPath} and ${await this.newAssetsPath}`));const e=await v.compare(await this.oldAssetsPath,await this.newAssetsPath,{compareContent:!0,skipSymlinks:!0,compareSize:!0,compareDate:!1,compareNameHandler:(e,o)=>(L.test(e)&&(e=e.replace(L,"$1$3")),L.test(o)&&(o=o.replace(L,"$1$3")),0===e.localeCompare(o)?0:e.localeCompare(o)>0?1:-1)});return e.diffSet?.filter((e=>"equal"!==e.state||e.name1!==e.name2))||[]}async generateAssetFilesDiff(e,o){const t=new d,n=t.diff_linesToChars_(e,o),i=t.diff_main(n.chars1,n.chars2,!1);t.diff_charsToLines_(i,n.lineArray);let r=0;return i.map((e=>{const[o,t]=e,n=t.endsWith("\n")?t.split("\n").length-1:t.split("\n").length,i=t.split("\n").map(((e,t)=>({lineContent:e,lineNumber:r+t+1,lineType:o}))).slice(0,n);return-1!==o&&(r+=n),i})).flat()}async generateFilesDiff(e){if("equal"===e.state){const o=this.pathToPosix(b.join(".",e.relativePath,e.name1??"")),t=this.pathToPosix(b.join(".",e.relativePath,e.name2??""));return this.diffFileTemplate(`<span class="renamed"\n >Renamed <span class="from">${o}</span> -> <span class="to">${t}</span></span\n >`,this.diffTableTemplate(this.diffLineMessageTemplate("No changes")))}const o=e.path1&&e.name1?b.join(e.path1,e.name1):null,t=e.path2&&e.name2?b.join(e.path2,e.name2):null,n=this.pathToPosix(b.join(".",e.relativePath,(e.name1||e.name2)??""));if("left"===e.state&&o)return this.diffFileTemplate(`<span class="removed">Removed ${n}</span>`,this.diffTableTemplate(this.diffLineMessageTemplate("File removed")));if("right"===e.state&&t)return this.diffFileTemplate(`<span class="added">Added ${n}</span>`,this.diffTableTemplate(this.diffLineMessageTemplate("File added")));if("distinct"===e.state&&o&&t){const i=this.pathToPosix(b.join(".",e.relativePath,e.name1??"")),r=this.pathToPosix(b.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 p.isBinaryFile(o)||await p.isBinaryFile(t)?this.diffTableTemplate(this.diffLineMessageTemplate("Binary file")):this.getDiffTableHTML(await this.generateAssetFilesDiff(w.readFileSync(o,"utf-8"),w.readFileSync(t,"utf-8"))))}return""}async generateChangelog(){this.logger.info(a.colors.green("Generating changelog"));const e=await this.generateAssetFoldersDiff(),o=(await Promise.all(e.map((e=>this.generateFilesDiff(e))))).join("");this.logger.info(a.colors.green("Writing changelog file"));const t=this.changelogTemplate.split("%FILES%");t.splice(1,0,o);const n=t.join("");w.writeFileSync(b.join(this.destinationPath,this.changelogFilename),n),this.logger.info(a.colors.green(`Changelog file written to ${b.join(this.destinationPath,this.changelogFilename)}`))}}class S{sourceDir;outputDir;fontName;constructor(e){this.sourceDir=e.sourceDir,this.outputDir=e.outputDir,this.fontName=e.fontName}async generate(){await u({src:this.sourceDir,dist:this.outputDir,fontName:this.fontName,css:!0,typescript:!0,startUnicode:59905,svgicons2svgfont:{fontHeight:1024}})}}const F=i.cac("pp-dev");function C(e,o,t){const i=[...s.PP_DEV_CONFIG_NAMES,...s.PP_WATCH_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((o=>b.join(e,o))),r=n.watch(i,{ignored:/(^|[\/\\])\../,persistent:!0,ignoreInitial:!0,followSymlinks:!1});let l=null;return r.on("change",(n=>{t(a.colors.blue(`🔧 Config file changed: ${b.relative(e,n)}`)),l&&clearTimeout(l),l=setTimeout((async()=>{try{t(a.colors.yellow("🔄 Restarting dev server due to config change...")),await o()}catch(e){t(a.colors.red(`❌ Failed to restart dev server: ${e}`))}}),500)})),r.on("error",(e=>{t(a.colors.red(`❌ Config watcher error: ${e}`))})),{watcher:r,restartCallback:o,logger:t}}function j(e){e.watcher&&e.watcher.close()}let E=global.__pp_dev_profile_session,A=0;const D=e=>{if(E)return new Promise(((o,t)=>{E.post("Profiler.stop",((n,{profile:i})=>{if(n)t(n);else{const t=b.resolve(`./pp-dev-profile-${A++}.cpuprofile`);w.writeFileSync(t,JSON.stringify(i)),e(a.colors.yellow(`CPU profile written to ${a.colors.white(a.colors.dim(t))}`)),E=void 0,o()}}))}))},I=e=>{for(const[o,t]of Object.entries(e))Array.isArray(t)&&(e[o]=t[t.length-1])};function N(e){const o={...e};return delete o["--"],delete o.c,delete o.config,delete o.base,delete o.l,delete o.logLevel,delete o.clearScreen,delete o.d,delete o.debug,delete o.f,delete o.filter,delete o.m,delete o.mode,o}F.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"),F.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,o)=>{I(o);let n=null,i=null,l=!1;const c=e?b.resolve(process.cwd(),e):process.cwd(),d=a.createLogger(o.logLevel),p=async()=>{if(!l){l=!0;try{n&&(d.info(a.colors.yellow("🛑 Stopping existing dev server...")),await n.close(),n=null);const{clearConfigCache:f}=await Promise.resolve().then((()=>require("./index-DJdZe-Ks.js"))).then((e=>e.config));f();const{createServer:h}=await import("vite"),g=await r.loadConfigFromFile({mode:o.mode||"development",command:"serve"},o.config,e,o.logLevel);let u=await s.getViteConfig();const m=r.loadEnv(o.mode||"development",e??process.cwd(),"");if(m&&Object.keys(m).forEach((e=>{e.startsWith("MI_")&&(process.env[e]=m[e])})),g){const{plugins:e,...o}=g.config;u=r.mergeConfig(u,o)}if(n=await h(r.mergeConfig(u,{root:e,base:o.base,mode:o.mode,configFile:o.config,logLevel:o.logLevel,clearScreen:o.clearScreen,optimizeDeps:{force:o.force},server:N(o),customLogger:d},!0)),!n.config.base||"/"===n.config.base)throw new Error('base cannot be equal to "/" or empty string');if(!n.httpServer)throw new Error("HTTP server not available");await n.listen();const b=global.__pp_dev_start_time??!1,w=b?a.colors.dim(`ready in ${a.colors.reset(a.colors.bold(Math.ceil(t.performance.now()-b)))} ms`):"";d.info(`\n ${a.colors.green(`${a.colors.bold("PP-DEV")} v${s.VERSION}`)} ${w}\n`),n.printUrls(),function(e,o){if(!e.httpServer||!process.stdin.isTTY||process.env.CI)return;e._shortcutsOptions=o;const t=a.createLogger();o.print&&t.info(a.colors.dim(a.colors.green(" ➜"))+a.colors.dim(" press ")+a.colors.bold("h")+a.colors.dim(" to show help"));const n=(o.customShortcuts??[]).filter(P).concat(T);let i=!1;const r=async o=>{if(""===o||""===o)return void await e.close().finally((()=>process.exit(1)));if(i)return;"h"===o&&t.info(["",a.colors.bold(" Shortcuts"),...n.map((e=>a.colors.dim(" press ")+a.colors.bold(e.key)+a.colors.dim(` to ${e.description}`)))].join("\n"));const r=n.find((e=>e.key===o));r&&(i=!0,await r.action(e),i=!1)};process.stdin.setRawMode(!0),process.stdin.on("data",r).setEncoding("utf8").resume(),e.httpServer.on("close",(()=>{process.stdin.off("data",r).pause()}))}(n,{print:!0,customShortcuts:[...E?[{key:"p",description:"start/stop the profiler",async action(e){if(E)await D(d.info);else{const e=await import("node:inspector").then((e=>e.default));await new Promise((o=>{E=new e.Session,E.connect(),E.post("Profiler.enable",(()=>{E?.post("Profiler.start",(()=>{d.info("Profiler started"),o()}))}))}))}}}]:[],{key:"l",description:"proxy re-login",action(e){e.ws.send({type:"custom",event:"redirect",data:{url:`/auth/index/logout?proxyRedirect=${encodeURIComponent("/")}`}})}}]}),i||(i=C(c,p,d.info),d.info(a.colors.blue("🔧 Config file watcher started"))),l=!1}catch(e){l=!1,d.error(a.colors.red(`error when starting dev server:\n${e.stack}`),{error:e}),D(d.info),process.exit(1)}}},f=async e=>{d.info(a.colors.yellow(`\n🛑 Received ${e}, shutting down gracefully...`));try{i&&(j(i),i=null),n&&(await n.close(),n=null),D(d.info),d.info(a.colors.green("✅ Graceful shutdown completed")),process.exit(0)}catch(e){d.error(a.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(a.colors.red(`❌ Uncaught Exception: ${e}`)),f("uncaughtException")})),process.on("unhandledRejection",((e,o)=>{d.error(a.colors.red(`❌ Unhandled Rejection at: ${o}, reason: ${e}`)),f("unhandledRejection")})),await p()})),F.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").action((async(e,o)=>{I(o);let t=null,n=null,i=null,c=!1;e?b.resolve(process.cwd(),e):process.cwd();const d=a.createLogger(),p=async()=>{if(!c){c=!0;try{n&&(d.info(a.colors.yellow("🛑 Stopping existing Next.js server...")),await new Promise((e=>{n.close((()=>{n=null,e()}))}))),t&&"function"==typeof t.close&&(await t.close(),t=null);const{clearConfigCache:f}=await Promise.resolve().then((()=>require("./index-DJdZe-Ks.js"))).then((e=>e.config));if(f(),!s.isNextAvailable())throw new Error("Next.js is required but not available. Please install Next.js as a dependency:\nnpm install next@^13\n\nThis package requires Next.js >=13 <16 as a peer dependency.");const{next:h}=await s.safeNextImport(),{join:g,basename:u}=await import("path"),{createServer:m}=await import("http"),{default:b}=(await import("next/dist/server/config.js")).default,w=N(o),v=r.loadEnv(o.mode||"development",e??process.cwd(),"");v&&Object.keys(v).forEach((e=>{e.startsWith("MI_")&&(process.env[e]=v[e])}));const y=e?g(process.cwd(),e):process.cwd();d.info(y);const x=await b("development",y);let P=x?.experimental?.ppDev||x?.ppDev||{};if(0===Object.keys(P).length)try{const{getConfig:e}=await Promise.resolve().then((()=>require("./index-DJdZe-Ks.js"))).then((e=>e.config)),o=await e();Object.keys(o).length>0?(P=o,d.info(a.colors.blue("🔧 Loaded pp-dev config from standalone config file"))):d.info(a.colors.yellow("⚠️ No pp-dev config found in Next.js config or standalone file, using defaults"))}catch(e){d.info(a.colors.yellow("⚠️ Failed to load standalone pp-dev config, using defaults")),console.debug("Error loading standalone config:",e)}else d.info(a.colors.blue("🔧 Loaded pp-dev config from Next.js config"));const{backendBaseURL:T=process.env.MI_BACKEND_URL||"http://localhost:8080",portalPageId:L=parseInt(process.env.MI_PORTAL_PAGE_ID||"1"),templateLess:$=!0,v7Features:S=!0,disableSSLValidation:F=!1,enableProxyCache:E=!0,proxyCacheTTL:A=6e5,personalAccessToken:D=process.env.MI_ACCESS_TOKEN,distZip:I=!1,syncBackupsDir:k="./backups",miHudLess:_=!1}=P;let q=P.templateName;if(!q)try{const{getPkg:e}=await Promise.resolve().then((()=>require("./index-DJdZe-Ks.js"))).then((e=>e.config));q=e().name}catch(e){q=u(y)}let R=$?"/p":"/pl";if(R+=`/${q}`,t=h({dev:!0,hostname:w.host||"localhost",port:w.port,dir:y,conf:{...x,basePath:R,assetPrefix:R}}),await t.prepare(),R.endsWith("/")||(R+="/"),"/"===R)throw new Error('basePath cannot be equal to "/" or equal to empty string');R.substring(0,R.lastIndexOf("/"));d.info(a.colors.green("✅ Next.js app prepared successfully")),d.info(a.colors.blue(`🔧 pp-dev plugin configured for template: ${q}`)),d.info(a.colors.blue(`🔧 Base path configured: ${R}`)),T&&(d.info(a.colors.blue(`🌐 Backend URL: ${T}`)),d.info(a.colors.blue(`🆔 Portal Page ID: ${L}`)));const M=t.getRequestHandler(),z="number"==typeof w.port?w.port:3e3,G="string"==typeof w.host?w.host||"0.0.0.0":"localhost",H=new Set;n=m((async(e,o)=>{try{const t=e.url||"/",n=t.split("?")[0];let i=l.parse(t,!0);if(U.length>0){if(n.startsWith("/_next/")||"/favicon.ico"===n||n.startsWith("/__nextjs_")||n.startsWith("/api/")){if(W.length>0){let c=0;const d=()=>{if(c>=W.length)return void r();const t=W[c];c++,t(e,o,d)};return void d()}return void r()}let s=0;const a=()=>{if(s>=U.length)return void r();const t=U[s];s++,t(e,o,a)};return void a()}async function r(){if(n.startsWith(R)){const o=n.substring(R.length);e.url=o||"/",i=l.parse(o,!0)}else if(n===R.replace(/\/$/,""))e.url="/",i=l.parse("/",!0);else if(n.startsWith("/_next/")||"/favicon.ico"===n||n.startsWith("/__nextjs_"));else if("/"===n)return o.writeHead(302,{Location:R}),void o.end();await M(e,o,i)}r()}catch(p){console.error("[DEBUG] Error:",p),o.statusCode=500,o.end("Internal Server Error")}}));let O=null,U=[],W=[];if(T){const e=new URL(T).host,o={headers:{host:e,referer:T,origin:T.replace(/^(https?:\/\/)([^/]+)(\/.*)?$/i,"$1$2")},portalPageId:L,appId:L,templateLess:$,disableSSLValidation:F,v7Features:S,personalAccessToken:D??process.env.MI_ACCESS_TOKEN};O=new a.MiAPI(T,o);const t=a.initPPRedirect(R,q),n=(e,o,n)=>{t(e,o,n)};if(W.push(n),U.push(n),E){let e=+A;(!e||Number.isNaN(e)||e<0)&&(e=6e5);const o={devServer:{middlewares:{use:e=>e},config:{logger:console}},ttl:e},t=a.initProxyCache(o),n=(e,o,n)=>{t(e,o,n)};U.push(n),d.info(a.colors.blue(`🔧 Proxy cache middleware added with TTL: ${e}ms`))}const i=R.endsWith("/")?R.substring(0,R.length-1):R,r={middlewares:{use:e=>e},config:{logger:console}},s=a.initProxy({devServer:r,baseURL:T,proxyIgnore:["/@vite","/@metricinsights","/@",i,"/_next","/favicon.ico","/__nextjs_","/api"],disableSSLValidation:F,miAPI:O}),l=(e,o,t)=>{s(e,o,t)};U.push(l);const c=new RegExp(`^((${R})|/)$`),p=a.initLoadPPData(c,O,{base:R,v7Features:S}),f=(e,o,t)=>{p(e,o,t)};U.push(f);const h=a.internalServer,g=(e,o,t)=>{if(e.url?.startsWith("/@api/")){h(e,o,(()=>{}))}else t()};W.push(g),U.push(g);const u=a.initRewriteResponse((e=>e.split("?")[0].endsWith("index.html")),((o,t)=>Buffer.from(a.urlReplacer(e,t.headers.host??"",O.buildPage(o,_))))),m=(e,o,t)=>{u(e,o,t)};U.push(m),d.info(a.colors.blue(`🔧 ${U.length} pp-dev middlewares initialized`)),d.info(a.colors.blue(`🔧 ${W.length} essential middlewares for internal routes`)),d.info(a.colors.blue(`🔧 MiAPI initialized for backend: ${T}`)),d.info(a.colors.blue(`🔧 Portal Page ID: ${L}`))}n.listen(z,G,(()=>{d.info(a.colors.green(`✅ pp-dev Next.js server running at http://${G}:${z}`)),d.info(a.colors.blue(`📱 Next.js app accessible at http://${G}:${z}${R}`)),d.info(a.colors.blue("🔧 Base path handling active")),i||(i=C(y,p,d.info),d.info(a.colors.blue("🔧 Config file watcher started"))),n.on("connection",(e=>{H.add(e),e.on("close",(()=>H.delete(e)))}));const e=async e=>{d.info(a.colors.yellow(`\n🛑 Received ${e}, shutting down gracefully...`));const o=setTimeout((()=>{d.info(a.colors.yellow("⏰ Shutdown timeout reached, forcing exit")),process.exit(0)}),5e3);try{i&&(j(i),i=null);for(const e of Array.from(H))e.destroy();H.clear(),await new Promise((e=>{n.close((()=>{d.info(a.colors.yellow("🛑 HTTP server closed")),e()}))})),t&&"function"==typeof t.close&&(await t.close(),d.info(a.colors.yellow("🛑 Next.js app closed"))),clearTimeout(o),d.info(a.colors.green("✅ Graceful shutdown completed")),process.exit(0)}catch(e){clearTimeout(o),d.error(a.colors.red(`❌ Error during graceful shutdown: ${e}`)),process.exit(1)}};let o=process;if("function"!=typeof process.on){const e=globalThis.process||global.process;e&&"function"==typeof e.on&&(o=e,d.info(a.colors.green("✅ Using global process object for event handlers")))}if("function"==typeof o.on)try{o.on("SIGINT",(()=>e("SIGINT"))),o.on("SIGTERM",(()=>e("SIGTERM"))),o.on("uncaughtException",(o=>{d.error(a.colors.red(`❌ Uncaught Exception: ${o}`)),e("uncaughtException")})),o.on("unhandledRejection",((o,t)=>{d.error(a.colors.red(`❌ Unhandled Rejection at: ${t}, reason: ${o}`)),e("unhandledRejection")})),d.info(a.colors.green("✅ Process event handlers registered successfully"))}catch(e){d.warn(a.colors.yellow(`⚠️ Failed to register process event handlers: ${e}`))}else d.warn(a.colors.yellow("⚠️ process.on is not available, graceful shutdown handlers will not be registered")),d.info(a.colors.blue("💡 This might be due to bundling or environment constraints"))})),c=!1}catch(e){c=!1,d.error(a.colors.red(`❌ Failed to start Next.js server: ${e}`)),e instanceof Error&&e.message.includes("Next.js is required")&&(d.error(a.colors.red("❌ Next.js Peer Dependency Error:")),d.error(a.colors.red(e.message)),d.error(a.colors.yellow("\n💡 To fix this issue:")),d.error(a.colors.blue(" 1. Install Next.js in your project:")),d.error(a.colors.white(" npm install next@^15")),d.error(a.colors.blue(" 2. Or use yarn:")),d.error(a.colors.white(" yarn add next@^15")),d.error(a.colors.blue(" 3. Or use pnpm:")),d.error(a.colors.white(" pnpm add next@^15")),d.error(a.colors.yellow("\n📖 For more information, see:")),d.error(a.colors.blue(" https://nextjs.org/docs/getting-started"))),process.exit(1)}}},f=async e=>{d.info(a.colors.yellow(`\n🛑 Received ${e}, shutting down gracefully...`));try{i&&(j(i),i=null),n&&await new Promise((e=>{n.close((()=>{n=null,e()}))})),t&&"function"==typeof t.close&&(await t.close(),t=null),d.info(a.colors.green("✅ Graceful shutdown completed")),process.exit(0)}catch(e){d.error(a.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(a.colors.red(`❌ Uncaught Exception: ${e}`)),f("uncaughtException")})),process.on("unhandledRejection",((e,o)=>{d.error(a.colors.red(`❌ Unhandled Rejection at: ${o}, reason: ${e}`)),f("unhandledRejection")})),await p()})),F.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)").action((async(e,o)=>{I(o);const t=N(o);try{const n=await r.loadConfigFromFile({mode:o.mode||"production",command:"build"},o.config,e,o.logLevel);let i=await s.getViteConfig();if(n){const{plugins:e,...o}=n.config;i=r.mergeConfig(i,o)}const l=r.mergeConfig(i,{root:e,base:o.base,mode:o.mode,configFile:o.config,logLevel:o.logLevel,clearScreen:o.clearScreen,optimizeDeps:{force:o.force},build:t},!0);if(await r.build(l),t.changelog){const n=e||process.cwd(),i=l.build?.outDir||"dist";let r="";if("string"==typeof t.changelog)r=b.resolve(n,t.changelog);else{const e=b.resolve(n,l.ppDevConfig?.syncBackupsDir||"backups");if(!w.existsSync(e))return void a.createLogger(o.logLevel).warn(a.colors.yellow("backups directory not found, skipping changelog generation"));const t=w.readdirSync(e,{withFileTypes:!0});if(!t.length)return void a.createLogger(o.logLevel).warn(a.colors.yellow("no backups found, skipping changelog generation"));const i=t.filter((e=>e.isFile()&&e.name.endsWith(".zip"))).reduce(((o,t)=>w.statSync(b.resolve(e,o.name)).mtimeMs>w.statSync(b.resolve(e,t.name)).mtimeMs?o:t),t[0]).name;r=b.resolve(e,i)}const s=b.resolve(n,i);let c="dist-zip";l.ppDevConfig&&(!1===l.ppDevConfig.distZip?c=l.build?.outDir||"dist":"object"==typeof l.ppDevConfig.distZip&&"string"==typeof l.ppDevConfig.distZip.outDir&&(c=l.ppDevConfig.distZip.outDir));const d=new $({oldAssetsPath:r,newAssetsPath:s,destinationPath:b.resolve(n,c)});await d.generateChangelog()}}catch(e){a.createLogger(o.logLevel).error(a.colors.red(`error during build:\n${e.stack}`),{error:e}),process.exit(1)}finally{D((e=>a.createLogger(o.logLevel).info(e)))}})),F.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,o,t)=>{I(t);const{oldAssetsPath:n=e,newAssetsPath:i=o,destination:r=".",filename:s="CHANGELOG.html",logLevel:l}=t,c=process.cwd();n&&i||(a.createLogger(l).error(a.colors.red("error during changelog generation: oldAssetPath and newAssetPath are required")),process.exit(1));const d=b.resolve(c,n),p=b.resolve(c,i),f=b.resolve(c,r),h=new $({oldAssetsPath:d,newAssetsPath:p,destinationPath:f,changelogFilename:s});await h.generateChangelog()})),F.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,o,t)=>{I(t);const{source:n=e,destination:i=o,fontName:r="icon-font"}=t,s=process.cwd(),l=b.resolve(s,n),c=b.resolve(s,i),d=new S({sourceDir:l,outputDir:c,fontName:r}),p=a.createLogger(t.logLevel);p.info(`Generating icon font from SVG files in ${a.colors.dim(l)}`),await d.generate(),p.info(`Icon font generated and saved to ${a.colors.dim(c)}`)})),F.command("optimize [root]","pre-bundle dependencies").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle").action((async(e,o)=>{I(o);try{const t=await r.loadConfigFromFile({mode:o.mode||"production",command:"build"},o.config,e,o.logLevel);let n=await s.getViteConfig();if(t){const{plugins:e,...o}=t.config;n=r.mergeConfig(n,o)}const i=await r.resolveConfig(r.mergeConfig(n,{root:e,base:o.base,configFile:o.config,logLevel:o.logLevel,mode:o.mode}),"serve");await r.optimizeDeps(i,o.force,!0)}catch(e){a.createLogger(o.logLevel).error(a.colors.red(`error when optimizing deps:\n${e.stack}`),{error:e}),process.exit(1)}})),F.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,o)=>{I(o);try{const t=await r.loadConfigFromFile({mode:o.mode||"production",command:"build"},o.config,e,o.logLevel);let n=await s.getViteConfig();if(t){const{plugins:e,...o}=t.config;n=r.mergeConfig(n,o)}(await r.preview(r.mergeConfig(n,{root:e,base:o.base,configFile:o.config,logLevel:o.logLevel,mode:o.mode,build:{outDir:o.outDir},preview:{port:o.port,strictPort:o.strictPort,host:o.host,https:o.https,open:o.open}}))).printUrls()}catch(e){a.createLogger(o.logLevel).error(a.colors.red(`error when starting preview server:\n${e.stack}`),{error:e}),process.exit(1)}finally{D((e=>a.createLogger(o.logLevel).info(e)))}})),F.help(),F.version(s.VERSION),F.parse(),exports.stopProfiler=D;
1
+ "use strict";const e=require("path"),o=require("fs"),t=require("node:perf_hooks"),n=require("chokidar"),i=require("cac"),r=require("vite"),s=require("./index-3fO78t0V.js"),a=require("./plugin-hCHarnpe.js"),l=require("url"),c=require("dir-compare"),d=require("diff-match-patch"),p=require("isbinaryfile"),f=require("os"),h=require("crypto"),g=require("extract-zip"),u=require("svgtofont");function m(e){const o=Object.create(null);if(e)for(const t in e)if("default"!==t){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,n.get?n:{enumerable:!0,get:()=>e[t]})}return o.default=e,Object.freeze(o)}require("ejs"),require("http-proxy-middleware"),require("picocolors"),require("axios"),require("jsdom"),require("https"),require("memory-cache"),require("process"),require("child_process"),require("console"),require("zlib"),require("express");const b=m(e),w=m(o),v=m(c),y=m(f),x=m(h);function P(e){return null!=e&&!1!==e}const T=[{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 L=/(.+)(-[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: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, 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: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, 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:o,newAssetsPath:t,destinationPath:n,changelogTemplate:i,diffFileTemplateHandler:r,diffLineTemplateHandler:s,changelogFilename:l,contextLines:c}=e;if(this.logger=a.createLogger(),!o||!t||!n)throw new Error("Previous assets path, current assets path and destination path are required");if(o===t)throw new Error("Previous and current assets paths must be different");if(!this.isExists(o))throw new Error(`Previous assets path ${o} does not exist`);if(!this.isExists(t))throw new Error(`Current assets path ${t} does not exist`);if(this.isZipFile(o)){const e=b.resolve(y.tmpdir(),x.createHash("md5").update(o).digest("hex"));this.oldAssetsPath=this.unzipFile(o,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(o))throw new Error(`Invalid previous assets path ${o}. It must be a folder or a zip file`);{const e=this.normalizeAssetFolderPath(o);if(this.isEmptyFolder(e))throw new Error(`Previous assets path ${e} is empty`);this.oldAssetsPath=Promise.resolve(e)}}if(this.isZipFile(t)){const e=b.resolve(y.tmpdir(),x.createHash("md5").update(t).digest("hex"));this.newAssetsPath=this.unzipFile(t,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(t))throw new Error(`Invalid current assets path ${t}. It must be a folder or a zip file`);{const e=this.normalizeAssetFolderPath(t);if(this.isEmptyFolder(e))throw new Error(`Current assets path ${t} 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(a.colors.yellow("Invalid changelog template, using default"))),"function"==typeof r&&(this.diffFileTemplateHandler=r),"function"==typeof s&&(this.diffLineTemplateHandler=s),c&&(this.contextLines=c)}templateIsValid(e){return e.includes("%FILES%")}isExists(e){return w.existsSync(e)}isZipFile(e){return e.endsWith(".zip")}isFolder(e){return w.lstatSync(e).isDirectory()}isEmptyFolder(e){return 0===w.readdirSync(e,{withFileTypes:!0}).length}mkdirpSync(e){w.existsSync(e)||w.mkdirSync(e,{recursive:!0})}async unzipFile(e,o){return w.rmSync(o,{force:!0,recursive:!0}),g(e,{dir:o})}normalizeAssetFolderPath(e){const o=w.readdirSync(e);return 1===o.length&&w.lstatSync(b.join(e,o[0])).isDirectory()?this.normalizeAssetFolderPath(b.join(e,o[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 o=e.filter(((e,o,t)=>0!==e.lineType||(o>=0&&o<this.contextLines||o>t.length-(this.contextLines+1)&&o<=t.length-1||t.slice(o-this.contextLines,o+this.contextLines+1).some((e=>0!==e.lineType))))).map(((e,o,t)=>{if(o>0){const n=t[o-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(o)}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:o,lineContent:t,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="${o}"`:""}\n ></td>\n <td\n class="blob-num ${i}${"deletion"===i?" empty":""}"\n ${"deletion"!==i?` data-line-number="${o}"`:""}\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=t??"",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:o}=e;return-1===o?this.diffLineSkipTemplate():this.diffLineTemplate(e)}diffFileTemplate(e,o){return this.diffFileTemplateHandler?this.diffFileTemplateHandler(e,o):`<div class="diff-file">\n <div class="diff-file-title">${e}</div>\n <div class="diff-file-content">${o}</div>\n </div>`}async generateAssetFoldersDiff(){this.logger.info(a.colors.blue(`Comparing asset folders ${await this.oldAssetsPath} and ${await this.newAssetsPath}`));const e=await v.compare(await this.oldAssetsPath,await this.newAssetsPath,{compareContent:!0,skipSymlinks:!0,compareSize:!0,compareDate:!1,compareNameHandler:(e,o)=>(L.test(e)&&(e=e.replace(L,"$1$3")),L.test(o)&&(o=o.replace(L,"$1$3")),0===e.localeCompare(o)?0:e.localeCompare(o)>0?1:-1)});return e.diffSet?.filter((e=>"equal"!==e.state||e.name1!==e.name2))||[]}async generateAssetFilesDiff(e,o){const t=new d,n=t.diff_linesToChars_(e,o),i=t.diff_main(n.chars1,n.chars2,!1);t.diff_charsToLines_(i,n.lineArray);let r=0;return i.map((e=>{const[o,t]=e,n=t.endsWith("\n")?t.split("\n").length-1:t.split("\n").length,i=t.split("\n").map(((e,t)=>({lineContent:e,lineNumber:r+t+1,lineType:o}))).slice(0,n);return-1!==o&&(r+=n),i})).flat()}async generateFilesDiff(e){if("equal"===e.state){const o=this.pathToPosix(b.join(".",e.relativePath,e.name1??"")),t=this.pathToPosix(b.join(".",e.relativePath,e.name2??""));return this.diffFileTemplate(`<span class="renamed"\n >Renamed <span class="from">${o}</span> -> <span class="to">${t}</span></span\n >`,this.diffTableTemplate(this.diffLineMessageTemplate("No changes")))}const o=e.path1&&e.name1?b.join(e.path1,e.name1):null,t=e.path2&&e.name2?b.join(e.path2,e.name2):null,n=this.pathToPosix(b.join(".",e.relativePath,(e.name1||e.name2)??""));if("left"===e.state&&o)return this.diffFileTemplate(`<span class="removed">Removed ${n}</span>`,this.diffTableTemplate(this.diffLineMessageTemplate("File removed")));if("right"===e.state&&t)return this.diffFileTemplate(`<span class="added">Added ${n}</span>`,this.diffTableTemplate(this.diffLineMessageTemplate("File added")));if("distinct"===e.state&&o&&t){const i=this.pathToPosix(b.join(".",e.relativePath,e.name1??"")),r=this.pathToPosix(b.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 p.isBinaryFile(o)||await p.isBinaryFile(t)?this.diffTableTemplate(this.diffLineMessageTemplate("Binary file")):this.getDiffTableHTML(await this.generateAssetFilesDiff(w.readFileSync(o,"utf-8"),w.readFileSync(t,"utf-8"))))}return""}async generateChangelog(){this.logger.info(a.colors.green("Generating changelog"));const e=await this.generateAssetFoldersDiff(),o=(await Promise.all(e.map((e=>this.generateFilesDiff(e))))).join("");this.logger.info(a.colors.green("Writing changelog file"));const t=this.changelogTemplate.split("%FILES%");t.splice(1,0,o);const n=t.join("");w.writeFileSync(b.join(this.destinationPath,this.changelogFilename),n),this.logger.info(a.colors.green(`Changelog file written to ${b.join(this.destinationPath,this.changelogFilename)}`))}}class S{sourceDir;outputDir;fontName;constructor(e){this.sourceDir=e.sourceDir,this.outputDir=e.outputDir,this.fontName=e.fontName}async generate(){await u({src:this.sourceDir,dist:this.outputDir,fontName:this.fontName,css:!0,typescript:!0,startUnicode:59905,svgicons2svgfont:{fontHeight:1024}})}}const F=i.cac("pp-dev");function C(e,o,t){const i=[...s.PP_DEV_CONFIG_NAMES,...s.PP_WATCH_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((o=>b.join(e,o))),r=n.watch(i,{ignored:/(^|[\/\\])\../,persistent:!0,ignoreInitial:!0,followSymlinks:!1});let l=null;return r.on("change",(n=>{t(a.colors.blue(`🔧 Config file changed: ${b.relative(e,n)}`)),l&&clearTimeout(l),l=setTimeout((async()=>{try{t(a.colors.yellow("🔄 Restarting dev server due to config change...")),await o()}catch(e){t(a.colors.red(`❌ Failed to restart dev server: ${e}`))}}),500)})),r.on("error",(e=>{t(a.colors.red(`❌ Config watcher error: ${e}`))})),{watcher:r,restartCallback:o,logger:t}}function j(e){e.watcher&&e.watcher.close()}let E=global.__pp_dev_profile_session,A=0;const D=e=>{if(E)return new Promise(((o,t)=>{E.post("Profiler.stop",((n,{profile:i})=>{if(n)t(n);else{const t=b.resolve(`./pp-dev-profile-${A++}.cpuprofile`);w.writeFileSync(t,JSON.stringify(i)),e(a.colors.yellow(`CPU profile written to ${a.colors.white(a.colors.dim(t))}`)),E=void 0,o()}}))}))},I=e=>{for(const[o,t]of Object.entries(e))Array.isArray(t)&&(e[o]=t[t.length-1])};function N(e){const o={...e};return delete o["--"],delete o.c,delete o.config,delete o.base,delete o.l,delete o.logLevel,delete o.clearScreen,delete o.d,delete o.debug,delete o.f,delete o.filter,delete o.m,delete o.mode,o}F.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"),F.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,o)=>{I(o);let n=null,i=null,l=!1;const c=e?b.resolve(process.cwd(),e):process.cwd(),d=a.createLogger(o.logLevel),p=async()=>{if(!l){l=!0;try{n&&(d.info(a.colors.yellow("🛑 Stopping existing dev server...")),await n.close(),n=null);const{clearConfigCache:f}=await Promise.resolve().then((()=>require("./index-3fO78t0V.js"))).then((e=>e.config));f();const{createServer:h}=await import("vite"),g=await r.loadConfigFromFile({mode:o.mode||"development",command:"serve"},o.config,e,o.logLevel);let u=await s.getViteConfig();const m=r.loadEnv(o.mode||"development",e??process.cwd(),"");if(m&&Object.keys(m).forEach((e=>{e.startsWith("MI_")&&(process.env[e]=m[e])})),g){const{plugins:e,...o}=g.config;u=r.mergeConfig(u,o)}if(n=await h(r.mergeConfig(u,{root:e,base:o.base,mode:o.mode,configFile:o.config,logLevel:o.logLevel,clearScreen:o.clearScreen,optimizeDeps:{force:o.force},server:N(o),customLogger:d},!0)),!n.config.base||"/"===n.config.base)throw new Error('base cannot be equal to "/" or empty string');if(!n.httpServer)throw new Error("HTTP server not available");await n.listen();const b=global.__pp_dev_start_time??!1,w=b?a.colors.dim(`ready in ${a.colors.reset(a.colors.bold(Math.ceil(t.performance.now()-b)))} ms`):"";d.info(`\n ${a.colors.green(`${a.colors.bold("PP-DEV")} v${s.VERSION}`)} ${w}\n`),n.printUrls(),function(e,o){if(!e.httpServer||!process.stdin.isTTY||process.env.CI)return;e._shortcutsOptions=o;const t=a.createLogger();o.print&&t.info(a.colors.dim(a.colors.green(" ➜"))+a.colors.dim(" press ")+a.colors.bold("h")+a.colors.dim(" to show help"));const n=(o.customShortcuts??[]).filter(P).concat(T);let i=!1;const r=async o=>{if(""===o||""===o)return void await e.close().finally((()=>process.exit(1)));if(i)return;"h"===o&&t.info(["",a.colors.bold(" Shortcuts"),...n.map((e=>a.colors.dim(" press ")+a.colors.bold(e.key)+a.colors.dim(` to ${e.description}`)))].join("\n"));const r=n.find((e=>e.key===o));r&&(i=!0,await r.action(e),i=!1)};process.stdin.setRawMode(!0),process.stdin.on("data",r).setEncoding("utf8").resume(),e.httpServer.on("close",(()=>{process.stdin.off("data",r).pause()}))}(n,{print:!0,customShortcuts:[...E?[{key:"p",description:"start/stop the profiler",async action(e){if(E)await D(d.info);else{const e=await import("node:inspector").then((e=>e.default));await new Promise((o=>{E=new e.Session,E.connect(),E.post("Profiler.enable",(()=>{E?.post("Profiler.start",(()=>{d.info("Profiler started"),o()}))}))}))}}}]:[],{key:"l",description:"proxy re-login",action(e){e.ws.send({type:"custom",event:"redirect",data:{url:`/auth/index/logout?proxyRedirect=${encodeURIComponent("/")}`}})}}]}),i||(i=C(c,p,d.info),d.info(a.colors.blue("🔧 Config file watcher started"))),l=!1}catch(e){l=!1,d.error(a.colors.red(`error when starting dev server:\n${e.stack}`),{error:e}),D(d.info),process.exit(1)}}},f=async e=>{d.info(a.colors.yellow(`\n🛑 Received ${e}, shutting down gracefully...`));try{i&&(j(i),i=null),n&&(await n.close(),n=null),D(d.info),d.info(a.colors.green("✅ Graceful shutdown completed")),process.exit(0)}catch(e){d.error(a.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(a.colors.red(`❌ Uncaught Exception: ${e}`)),f("uncaughtException")})),process.on("unhandledRejection",((e,o)=>{d.error(a.colors.red(`❌ Unhandled Rejection at: ${o}, reason: ${e}`)),f("unhandledRejection")})),await p()})),F.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").action((async(e,o)=>{I(o);let t=null,n=null,i=null,c=!1;e?b.resolve(process.cwd(),e):process.cwd();const d=a.createLogger(),p=async()=>{if(!c){c=!0;try{n&&(d.info(a.colors.yellow("🛑 Stopping existing Next.js server...")),await new Promise((e=>{n.close((()=>{n=null,e()}))}))),t&&"function"==typeof t.close&&(await t.close(),t=null);const{clearConfigCache:f}=await Promise.resolve().then((()=>require("./index-3fO78t0V.js"))).then((e=>e.config));if(f(),!s.isNextAvailable())throw new Error("Next.js is required but not available. Please install Next.js as a dependency:\nnpm install next@^13\n\nThis package requires Next.js >=13 <16 as a peer dependency.");const{next:h}=await s.safeNextImport(),{join:g,basename:u}=await import("path"),{createServer:m}=await import("http"),{default:b}=(await import("next/dist/server/config.js")).default,w=N(o),v=r.loadEnv(o.mode||"development",e??process.cwd(),"");v&&Object.keys(v).forEach((e=>{e.startsWith("MI_")&&(process.env[e]=v[e])}));const y=e?g(process.cwd(),e):process.cwd();d.info(y);const x=await b("development",y);let P=x?.experimental?.ppDev||x?.ppDev||{};if(0===Object.keys(P).length)try{const{getConfig:e}=await Promise.resolve().then((()=>require("./index-3fO78t0V.js"))).then((e=>e.config)),o=await e();Object.keys(o).length>0?(P=o,d.info(a.colors.blue("🔧 Loaded pp-dev config from standalone config file"))):d.info(a.colors.yellow("⚠️ No pp-dev config found in Next.js config or standalone file, using defaults"))}catch(e){d.info(a.colors.yellow("⚠️ Failed to load standalone pp-dev config, using defaults")),console.debug("Error loading standalone config:",e)}else d.info(a.colors.blue("🔧 Loaded pp-dev config from Next.js config"));const{backendBaseURL:T=process.env.MI_BACKEND_URL||"http://localhost:8080",portalPageId:L=parseInt(process.env.MI_PORTAL_PAGE_ID||"1"),templateLess:$=!0,v7Features:S=!0,disableSSLValidation:F=!1,enableProxyCache:E=!0,proxyCacheTTL:A=6e5,personalAccessToken:D=process.env.MI_ACCESS_TOKEN,distZip:I=!1,syncBackupsDir:k="./backups",miHudLess:_=!1}=P;let q=P.templateName;if(!q)try{const{getPkg:e}=await Promise.resolve().then((()=>require("./index-3fO78t0V.js"))).then((e=>e.config));q=e().name}catch(e){q=u(y)}let R=$?"/p":"/pl";if(R+=`/${q}`,t=h({dev:!0,hostname:w.host||"localhost",port:w.port,dir:y,conf:{...x,basePath:R,assetPrefix:R}}),await t.prepare(),R.endsWith("/")||(R+="/"),"/"===R)throw new Error('basePath cannot be equal to "/" or equal to empty string');R.substring(0,R.lastIndexOf("/"));d.info(a.colors.green("✅ Next.js app prepared successfully")),d.info(a.colors.blue(`🔧 pp-dev plugin configured for template: ${q}`)),d.info(a.colors.blue(`🔧 Base path configured: ${R}`)),T&&(d.info(a.colors.blue(`🌐 Backend URL: ${T}`)),d.info(a.colors.blue(`🆔 Portal Page ID: ${L}`)));const M=t.getRequestHandler(),z="number"==typeof w.port?w.port:3e3,G="string"==typeof w.host?w.host||"0.0.0.0":"localhost",H=new Set;n=m((async(e,o)=>{try{const t=e.url||"/",n=t.split("?")[0];let i=l.parse(t,!0);if(U.length>0){if(n.startsWith("/_next/")||"/favicon.ico"===n||n.startsWith("/__nextjs_")||n.startsWith("/api/")){if(W.length>0){let c=0;const d=()=>{if(c>=W.length)return void r();const t=W[c];c++,t(e,o,d)};return void d()}return void r()}let s=0;const a=()=>{if(s>=U.length)return void r();const t=U[s];s++,t(e,o,a)};return void a()}async function r(){if(n.startsWith(R)){const o=n.substring(R.length);e.url=o||"/",i=l.parse(o,!0)}else if(n===R.replace(/\/$/,""))e.url="/",i=l.parse("/",!0);else if(n.startsWith("/_next/")||"/favicon.ico"===n||n.startsWith("/__nextjs_"));else if("/"===n)return o.writeHead(302,{Location:R}),void o.end();await M(e,o,i)}r()}catch(p){console.error("[DEBUG] Error:",p),o.statusCode=500,o.end("Internal Server Error")}}));let O=null,U=[],W=[];if(T){const e=new URL(T).host,o={headers:{host:e,referer:T,origin:T.replace(/^(https?:\/\/)([^/]+)(\/.*)?$/i,"$1$2")},portalPageId:L,appId:L,templateLess:$,disableSSLValidation:F,v7Features:S,personalAccessToken:D??process.env.MI_ACCESS_TOKEN};O=new a.MiAPI(T,o);const t=a.initPPRedirect(R,q),n=(e,o,n)=>{t(e,o,n)};if(W.push(n),U.push(n),E){let e=+A;(!e||Number.isNaN(e)||e<0)&&(e=6e5);const o={devServer:{middlewares:{use:e=>e},config:{logger:console}},ttl:e},t=a.initProxyCache(o),n=(e,o,n)=>{t(e,o,n)};U.push(n),d.info(a.colors.blue(`🔧 Proxy cache middleware added with TTL: ${e}ms`))}const i=R.endsWith("/")?R.substring(0,R.length-1):R,r={middlewares:{use:e=>e},config:{logger:console}},s=a.initProxy({devServer:r,baseURL:T,proxyIgnore:["/@vite","/@metricinsights","/@",i,"/_next","/favicon.ico","/__nextjs_","/api"],disableSSLValidation:F,miAPI:O}),l=(e,o,t)=>{s(e,o,t)};U.push(l);const c=new RegExp(`^((${R})|/)$`),p=a.initLoadPPData(c,O,{base:R,v7Features:S}),f=(e,o,t)=>{p(e,o,t)};U.push(f);const h=a.internalServer,g=(e,o,t)=>{if(e.url?.startsWith("/@api/")){h(e,o,(()=>{}))}else t()};W.push(g),U.push(g);const u=a.initRewriteResponse((e=>e.split("?")[0].endsWith("index.html")),((o,t)=>Buffer.from(a.urlReplacer(e,t.headers.host??"",O.buildPage(o,_))))),m=(e,o,t)=>{u(e,o,t)};U.push(m),d.info(a.colors.blue(`🔧 ${U.length} pp-dev middlewares initialized`)),d.info(a.colors.blue(`🔧 ${W.length} essential middlewares for internal routes`)),d.info(a.colors.blue(`🔧 MiAPI initialized for backend: ${T}`)),d.info(a.colors.blue(`🔧 Portal Page ID: ${L}`))}n.listen(z,G,(()=>{d.info(a.colors.green(`✅ pp-dev Next.js server running at http://${G}:${z}`)),d.info(a.colors.blue(`📱 Next.js app accessible at http://${G}:${z}${R}`)),d.info(a.colors.blue("🔧 Base path handling active")),i||(i=C(y,p,d.info),d.info(a.colors.blue("🔧 Config file watcher started"))),n.on("connection",(e=>{H.add(e),e.on("close",(()=>H.delete(e)))}));const e=async e=>{d.info(a.colors.yellow(`\n🛑 Received ${e}, shutting down gracefully...`));const o=setTimeout((()=>{d.info(a.colors.yellow("⏰ Shutdown timeout reached, forcing exit")),process.exit(0)}),5e3);try{i&&(j(i),i=null);for(const e of Array.from(H))e.destroy();H.clear(),await new Promise((e=>{n.close((()=>{d.info(a.colors.yellow("🛑 HTTP server closed")),e()}))})),t&&"function"==typeof t.close&&(await t.close(),d.info(a.colors.yellow("🛑 Next.js app closed"))),clearTimeout(o),d.info(a.colors.green("✅ Graceful shutdown completed")),process.exit(0)}catch(e){clearTimeout(o),d.error(a.colors.red(`❌ Error during graceful shutdown: ${e}`)),process.exit(1)}};let o=process;if("function"!=typeof process.on){const e=globalThis.process||global.process;e&&"function"==typeof e.on&&(o=e,d.info(a.colors.green("✅ Using global process object for event handlers")))}if("function"==typeof o.on)try{o.on("SIGINT",(()=>e("SIGINT"))),o.on("SIGTERM",(()=>e("SIGTERM"))),o.on("uncaughtException",(o=>{d.error(a.colors.red(`❌ Uncaught Exception: ${o}`)),e("uncaughtException")})),o.on("unhandledRejection",((o,t)=>{d.error(a.colors.red(`❌ Unhandled Rejection at: ${t}, reason: ${o}`)),e("unhandledRejection")})),d.info(a.colors.green("✅ Process event handlers registered successfully"))}catch(e){d.warn(a.colors.yellow(`⚠️ Failed to register process event handlers: ${e}`))}else d.warn(a.colors.yellow("⚠️ process.on is not available, graceful shutdown handlers will not be registered")),d.info(a.colors.blue("💡 This might be due to bundling or environment constraints"))})),c=!1}catch(e){c=!1,d.error(a.colors.red(`❌ Failed to start Next.js server: ${e}`)),e instanceof Error&&e.message.includes("Next.js is required")&&(d.error(a.colors.red("❌ Next.js Peer Dependency Error:")),d.error(a.colors.red(e.message)),d.error(a.colors.yellow("\n💡 To fix this issue:")),d.error(a.colors.blue(" 1. Install Next.js in your project:")),d.error(a.colors.white(" npm install next@^15")),d.error(a.colors.blue(" 2. Or use yarn:")),d.error(a.colors.white(" yarn add next@^15")),d.error(a.colors.blue(" 3. Or use pnpm:")),d.error(a.colors.white(" pnpm add next@^15")),d.error(a.colors.yellow("\n📖 For more information, see:")),d.error(a.colors.blue(" https://nextjs.org/docs/getting-started"))),process.exit(1)}}},f=async e=>{d.info(a.colors.yellow(`\n🛑 Received ${e}, shutting down gracefully...`));try{i&&(j(i),i=null),n&&await new Promise((e=>{n.close((()=>{n=null,e()}))})),t&&"function"==typeof t.close&&(await t.close(),t=null),d.info(a.colors.green("✅ Graceful shutdown completed")),process.exit(0)}catch(e){d.error(a.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(a.colors.red(`❌ Uncaught Exception: ${e}`)),f("uncaughtException")})),process.on("unhandledRejection",((e,o)=>{d.error(a.colors.red(`❌ Unhandled Rejection at: ${o}, reason: ${e}`)),f("unhandledRejection")})),await p()})),F.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)").action((async(e,o)=>{I(o);const t=N(o);try{const n=await r.loadConfigFromFile({mode:o.mode||"production",command:"build"},o.config,e,o.logLevel);let i=await s.getViteConfig();if(n){const{plugins:e,...o}=n.config;i=r.mergeConfig(i,o)}const l=r.mergeConfig(i,{root:e,base:o.base,mode:o.mode,configFile:o.config,logLevel:o.logLevel,clearScreen:o.clearScreen,optimizeDeps:{force:o.force},build:t},!0);if(await r.build(l),t.changelog){const n=e||process.cwd(),i=l.build?.outDir||"dist";let r="";if("string"==typeof t.changelog)r=b.resolve(n,t.changelog);else{const e=b.resolve(n,l.ppDevConfig?.syncBackupsDir||"backups");if(!w.existsSync(e))return void a.createLogger(o.logLevel).warn(a.colors.yellow("backups directory not found, skipping changelog generation"));const t=w.readdirSync(e,{withFileTypes:!0});if(!t.length)return void a.createLogger(o.logLevel).warn(a.colors.yellow("no backups found, skipping changelog generation"));const i=t.filter((e=>e.isFile()&&e.name.endsWith(".zip"))).reduce(((o,t)=>w.statSync(b.resolve(e,o.name)).mtimeMs>w.statSync(b.resolve(e,t.name)).mtimeMs?o:t),t[0]).name;r=b.resolve(e,i)}const s=b.resolve(n,i);let c="dist-zip";l.ppDevConfig&&(!1===l.ppDevConfig.distZip?c=l.build?.outDir||"dist":"object"==typeof l.ppDevConfig.distZip&&"string"==typeof l.ppDevConfig.distZip.outDir&&(c=l.ppDevConfig.distZip.outDir));const d=new $({oldAssetsPath:r,newAssetsPath:s,destinationPath:b.resolve(n,c)});await d.generateChangelog()}}catch(e){a.createLogger(o.logLevel).error(a.colors.red(`error during build:\n${e.stack}`),{error:e}),process.exit(1)}finally{D((e=>a.createLogger(o.logLevel).info(e)))}})),F.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,o,t)=>{I(t);const{oldAssetsPath:n=e,newAssetsPath:i=o,destination:r=".",filename:s="CHANGELOG.html",logLevel:l}=t,c=process.cwd();n&&i||(a.createLogger(l).error(a.colors.red("error during changelog generation: oldAssetPath and newAssetPath are required")),process.exit(1));const d=b.resolve(c,n),p=b.resolve(c,i),f=b.resolve(c,r),h=new $({oldAssetsPath:d,newAssetsPath:p,destinationPath:f,changelogFilename:s});await h.generateChangelog()})),F.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,o,t)=>{I(t);const{source:n=e,destination:i=o,fontName:r="icon-font"}=t,s=process.cwd(),l=b.resolve(s,n),c=b.resolve(s,i),d=new S({sourceDir:l,outputDir:c,fontName:r}),p=a.createLogger(t.logLevel);p.info(`Generating icon font from SVG files in ${a.colors.dim(l)}`),await d.generate(),p.info(`Icon font generated and saved to ${a.colors.dim(c)}`)})),F.command("optimize [root]","pre-bundle dependencies").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle").action((async(e,o)=>{I(o);try{const t=await r.loadConfigFromFile({mode:o.mode||"production",command:"build"},o.config,e,o.logLevel);let n=await s.getViteConfig();if(t){const{plugins:e,...o}=t.config;n=r.mergeConfig(n,o)}const i=await r.resolveConfig(r.mergeConfig(n,{root:e,base:o.base,configFile:o.config,logLevel:o.logLevel,mode:o.mode}),"serve");await r.optimizeDeps(i,o.force,!0)}catch(e){a.createLogger(o.logLevel).error(a.colors.red(`error when optimizing deps:\n${e.stack}`),{error:e}),process.exit(1)}})),F.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,o)=>{I(o);try{const t=await r.loadConfigFromFile({mode:o.mode||"production",command:"build"},o.config,e,o.logLevel);let n=await s.getViteConfig();if(t){const{plugins:e,...o}=t.config;n=r.mergeConfig(n,o)}(await r.preview(r.mergeConfig(n,{root:e,base:o.base,configFile:o.config,logLevel:o.logLevel,mode:o.mode,build:{outDir:o.outDir},preview:{port:o.port,strictPort:o.strictPort,host:o.host,https:o.https,open:o.open}}))).printUrls()}catch(e){a.createLogger(o.logLevel).error(a.colors.red(`error when starting preview server:\n${e.stack}`),{error:e}),process.exit(1)}finally{D((e=>a.createLogger(o.logLevel).info(e)))}})),F.help(),F.version(s.VERSION),F.parse(),exports.stopProfiler=D;
2
2
  //# sourceMappingURL=cli.js.map
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("./plugin-xN0M6WT7.js"),t=require("fs"),n=require("path"),i=require("url"),s=require("vite"),a=require("ejs");var r="undefined"!=typeof document?document.currentScript:null;function o(e){const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:()=>e[n]})}return t.default=e,Object.freeze(t)}const c=o(t),p=o(n),l=n.resolve("undefined"!=typeof __filename&&__filename||i.fileURLToPath("undefined"==typeof document?require("url").pathToFileURL(__filename).href:r&&"SCRIPT"===r.tagName.toUpperCase()&&r.src||new URL("index-DJdZe-Ks.js",document.baseURI).href),"../../.."),u=n.resolve("undefined"!=typeof __filename&&__filename||i.fileURLToPath("undefined"==typeof document?require("url").pathToFileURL(__filename).href:r&&"SCRIPT"===r.tagName.toUpperCase()&&r.src||new URL("index-DJdZe-Ks.js",document.baseURI).href),"../.."),f=t.existsSync(n.resolve(l,"package.json"))?l:u,m=n.resolve(f,"dist/client/client.js"),{version:d,name:g}=JSON.parse(t.readFileSync(n.resolve(f,"package.json")).toString()),h=d,v=g,j=[".pp-watch.config.js",".pp-watch.config.ts",".pp-watch.config.json"],y=[".pp-dev.config.js",".pp-dev.config.cjs",".pp-dev.config.mjs",".pp-dev.config.ts",".pp-dev.config.cts",".pp-dev.config.mts",".pp-dev.config.json","pp-dev.config.js","pp-dev.config.cjs","pp-dev.config.mjs","pp-dev.config.ts","pp-dev.config.cts","pp-dev.config.mts","pp-dev.config.json"];const w=new class{cache=new Map;_maxSize;constructor(e=10){this._maxSize=e}get maxSize(){return this._maxSize}set maxSize(e){this._maxSize=e}get(e){if(this.cache.has(e)){const t=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,t),t}}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this._maxSize){const e=this.cache.keys().next().value;void 0!==e&&this.cache.delete(e)}this.cache.set(e,t)}clear(){this.cache.clear()}has(e){return this.cache.has(e)}}(5),x=new Map,b=p.dirname("undefined"!=typeof __filename&&__filename||i.fileURLToPath(new URL(".","undefined"==typeof document?require("url").pathToFileURL(__filename).href:r&&"SCRIPT"===r.tagName.toUpperCase()&&r.src||new URL("index-DJdZe-Ks.js",document.baseURI).href))),P=`/${v}/client`,S=`/${P}`,_=new RegExp(`^\\/?${v}\\/client\\/(.*)$`);const R={templateCompilations:0,cacheHits:0,totalRequests:0};function D(e){let t="",n=!1,i=null;return{name:"pp-dev:client",apply:"serve",config:e=>(e.optimizeDeps?.exclude?.push(`${v}/client`),e),resolveId(e){if(_.test(e))return{id:s.normalizePath(p.join(f,"dist/client",e.replace(_,"$1")))}},transformIndexHtml:async(e,s)=>{R.totalRequests++;const r=s.server?.config.base||"";r!==t&&(t=r,n=!0,i=null),i&&!n||(w.has(t)?(i=w.get(t),R.cacheHits++):(i=function(e,t=!0){const n=e;if(t&&w.has(n))return w.get(n);const i=p.resolve(b,"client","index.html");let s;x.has(i)?s=x.get(i):(s=c.readFileSync(i,{encoding:"utf8"}),x.set(i,s));const r=S.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=a.compile(s.replace(new RegExp(r,"g"),p.posix.join(e,P)),{openDelimiter:"{",closeDelimiter:"}",async:!0,cache:!0,filename:i,rmWhitespace:!0,compileDebug:!1});return t&&w.set(n,o),o}(t,true),R.templateCompilations++),n=!1);const o=function(e){return{css:p.posix.join(e,v,"client/client.css"),js:p.posix.join(e,v,"client/client.js")}}(t),l={html:e,tags:[{tag:"link",injectTo:"head",attrs:{rel:"stylesheet",href:o.css}}]},{backendBaseURL:u,templateLess:f,portalPageId:m,canSync:d=!0}=s.server?.config.clientInjectionPlugin||{},g={PACKAGE_NAME:v,VERSION:h,backendBaseURL:u,templateLess:f,portalPageId:m,canSync:d};return l.tags.push({tag:"div",injectTo:"body-prepend",children:await i(g)}),l.tags.push({tag:"script",injectTo:"body-prepend",attrs:{src:o.js,type:"module"}}),l},configureServer(e){const t=s.normalizePath(p.resolve(e.config.root,p.dirname(m)));e.config.server?.fs?.allow&&e.config.server.fs.allow.push(t),e.middlewares.use("/@api/__pp-dev-metrics",((e,t)=>{t.setHeader("Content-Type","application/json"),t.end(JSON.stringify(R,null,2))}))},closeBundle(){w.clear(),x.clear()}}}const $=(e,t)=>` * ${t}`;function N(e){return`/*!\n${"***** DO NOT EDIT THIS CODE! *****\n***** ------- *****".replace(/^(.*)$/gm,$)}\n */`}async function C(){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}`)}}const I=new Map,T=3e4;let L=null;function O(){const e=Date.now();if(L&&e-L.timestamp<6e4)return L.data;const i=process.cwd();try{const s=JSON.parse(t.readFileSync(n.resolve(i,"package.json"),{encoding:"utf-8",flag:"r"}));return L={data:s,timestamp:e},s}catch{const t={};return L={data:t,timestamp:e},t}}let U=null;async function F(e){const s=process.cwd(),a=`ts:${e}`,r=I.get(a);if(r&&Date.now()-r.timestamp<T)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=O();o=!!e&&"module"===e.type}const c=await async function(){return U||(U=await import("esbuild")),U}(),p=await c.build({absWorkingDir:s,entryPoints:[e],outfile:"out.js",write:!1,target:["node14.18","node16"],platform:"node",bundle:!0,format:o?"esm":"cjs",mainFields:["main"],sourcemap:"inline",metafile:!0}),{text:l}=p.outputFiles[0],u=`${`pp-config.timestamp-${Date.now()}-${Math.random().toString(16).slice(2)}`}.js`,f=i.pathToFileURL(n.resolve(s,u)).toString();t.writeFileSync(u,l);let m={};try{const t=(await import(f)).default;m=t?.default||t,I.set(a,{data:m,timestamp:Date.now(),filePath:e})}finally{t.existsSync(u)&&t.unlink(u,(()=>{}))}return m}async function E(e){const t=`js:${e}`,n=I.get(t);if(n&&Date.now()-n.timestamp<T)return n.data;const s=(await import(i.pathToFileURL(e).toString())).default;return I.set(t,{data:s,timestamp:Date.now(),filePath:e}),s}async function k(e){const n=`json:${e}`,i=I.get(n);if(i&&Date.now()-i.timestamp<T)return i.data;const s=JSON.parse(t.readFileSync(e,{encoding:"utf-8"}));return I.set(n,{data:s,timestamp:Date.now(),filePath:e}),s}let z=null;async function q(e,t){for(const i of t)if(e.includes(i)){if(/\.[cm]?ts$/i.test(i))return await F(i);if(/\.[cm]?js$/i.test(i))return await E(n.resolve(".",i));if(i.endsWith(".json"))return await k(n.resolve(".",i))}return null}function M(){return O()}async function V(){const e=function(){const e=Date.now();if(z&&e-z.timestamp<1e4)return z.files;const n=/\.config\.(([cm]?ts)|([cm]?js)|(json))$/,i=process.cwd(),s=t.readdirSync(i,{withFileTypes:!0}).filter((e=>e.isFile()&&n.test(e.name))).map((e=>e.name));return z={files:s,timestamp:e},s}();let n={},i=!1;const s=await q(e,y);if(s&&(n=s,i=!0),e.length&&!i){const t=await q(e,j);t&&(n={backendBaseURL:t.baseURL,portalPageId:t.portalPageId},i=!0)}const a=O();return i||"object"!=typeof a["pp-dev"]||(n=a["pp-dev"]),n}const A=Object.freeze({__proto__:null,clearConfigCache:function(){I.clear(),L=null,z=null},getConfig:V,getPkg:M});function H(e){return e?.experimental?.ppDev||e?.ppDev||{}}function B(e,t,n){return Object.assign({},e,t,n)}exports.PP_DEV_CONFIG_NAMES=y,exports.PP_WATCH_CONFIG_NAMES=j,exports.VERSION=h,exports.config=A,exports.getNextVersion=async function(){try{return(await import("next/package.json")).version}catch{return null}},exports.getPPDevConfigFromNextConfig=H,exports.getViteConfig=async function(){const t=M().name,n=await V(),i=e.normalizeVitePPDevConfig(Object.assign(n,{templateName:t})),s=[e.vitePPDev(i),D()],{outDir:a,distZip:r,imageOptimizer:o,templateLess:c,integrateMiTopBar:p}=i;if(p&&s.push({name:"mi-topbar-plugin",transformIndexHtml:()=>[{tag:"script",injectTo:"body",attrs:{src:"/auth/info.js"}},{tag:"script",injectTo:"body",attrs:{src:"/js/main.js",defer:"defer"}},{tag:"link",injectTo:"head",attrs:{href:"/css/main.css",rel:"stylesheet"}},{tag:"div",injectTo:"body-prepend",attrs:{id:"mi-react-root"}}]}),o){const{ViteImageOptimizer:e}=await import("vite-plugin-image-optimizer");s.push(e("object"==typeof o?o:void 0))}if(r){const{default:e}=await import("vite-plugin-zip-pack");s.push({...e("object"==typeof r?r:{outFileName:`${t}.zip`}),enforce:"post"})}return{base:c?`/p/${t}`:`/pt/${t}`,server:{port:3e3},build:{minify:!1,assetsInlineLimit:4096,rollupOptions:{output:{banner:N}},outDir:a},css:{modules:{localsConvention:"dashes"},scss:{api:"modern"}},ppDevConfig:i,plugins:s}},exports.isNextAvailable=async function(){try{return await import("next"),!0}catch(e){return!1}},exports.safeNextImport=C,exports.withPPDev=function(e,t){return async(n,i={})=>{try{const{constants:s}=await C(),{PHASE_DEVELOPMENT_SERVER:a}=s,r=await V(),o=M().name,c="function"==typeof e?await e(n,i):e,p=H(c),l=n===a,u=function(e,t,n,i){return n?t?`/p/${e}`:`/pl/${e}`:i?`/pt/${e}`:`/pl/${e}`}(o,r.templateLess??!1,l,r.v7Features??!1),f={basePath:u,trailingSlash:!!l||void 0};if(l){const e=function(e,t){const{appId:n,portalPageId:i,backendBaseURL:s,templateLess:a,v7Features:r,...o}=t,c=n||i,p={backendBaseURL:s,portalPageId:c,appId:c,templateLess:a,v7Features:r,...o};return{serverRuntimeConfig:{templateName:e,ppDevConfig:p},publicRuntimeConfig:{templateName:e,ppDevConfig:p},experimental:{ppDev:p}}}(o,Object.assign({},r,p,t));return B(f,c,e)}return B(f,c)}catch(t){console.error("Error in withPPDev:",t),console.warn("Falling back to original Next.js configuration");try{return"function"==typeof e?await e(n,i):e}catch(e){return console.error("Error in fallback configuration:",e),{}}}}};
2
- //# sourceMappingURL=index-DJdZe-Ks.js.map
1
+ "use strict";const e=require("./plugin-hCHarnpe.js"),t=require("fs"),n=require("path"),i=require("url"),s=require("vite"),a=require("ejs");var r="undefined"!=typeof document?document.currentScript:null;function o(e){const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:()=>e[n]})}return t.default=e,Object.freeze(t)}const c=o(t),p=o(n),l=n.resolve("undefined"!=typeof __filename&&__filename||i.fileURLToPath("undefined"==typeof document?require("url").pathToFileURL(__filename).href:r&&"SCRIPT"===r.tagName.toUpperCase()&&r.src||new URL("index-3fO78t0V.js",document.baseURI).href),"../../.."),u=n.resolve("undefined"!=typeof __filename&&__filename||i.fileURLToPath("undefined"==typeof document?require("url").pathToFileURL(__filename).href:r&&"SCRIPT"===r.tagName.toUpperCase()&&r.src||new URL("index-3fO78t0V.js",document.baseURI).href),"../.."),f=t.existsSync(n.resolve(l,"package.json"))?l:u,d=n.resolve(f,"dist/client/client.js"),{version:m,name:g}=JSON.parse(t.readFileSync(n.resolve(f,"package.json")).toString()),h=m,j=g,v=[".pp-watch.config.js",".pp-watch.config.ts",".pp-watch.config.json"],y=[".pp-dev.config.js",".pp-dev.config.cjs",".pp-dev.config.mjs",".pp-dev.config.ts",".pp-dev.config.cts",".pp-dev.config.mts",".pp-dev.config.json","pp-dev.config.js","pp-dev.config.cjs","pp-dev.config.mjs","pp-dev.config.ts","pp-dev.config.cts","pp-dev.config.mts","pp-dev.config.json"];const w=new class{cache=new Map;_maxSize;constructor(e=10){this._maxSize=e}get maxSize(){return this._maxSize}set maxSize(e){this._maxSize=e}get(e){if(this.cache.has(e)){const t=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,t),t}}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this._maxSize){const e=this.cache.keys().next().value;void 0!==e&&this.cache.delete(e)}this.cache.set(e,t)}clear(){this.cache.clear()}has(e){return this.cache.has(e)}}(5),x=new Map,b=p.dirname("undefined"!=typeof __filename&&__filename||i.fileURLToPath(new URL(".","undefined"==typeof document?require("url").pathToFileURL(__filename).href:r&&"SCRIPT"===r.tagName.toUpperCase()&&r.src||new URL("index-3fO78t0V.js",document.baseURI).href))),P=`/${j}/client`,S=`/${P}`,_=new RegExp(`^\\/?${j}\\/client\\/(.*)$`);const R={templateCompilations:0,cacheHits:0,totalRequests:0};function D(e){let t="",n=!1,i=null;return{name:"pp-dev:client",apply:"serve",config:e=>(e.optimizeDeps?.exclude?.push(`${j}/client`),e),resolveId(e){if(_.test(e))return{id:s.normalizePath(p.join(f,"dist/client",e.replace(_,"$1")))}},transformIndexHtml:async(e,s)=>{R.totalRequests++;const r=s.server?.config.base||"";r!==t&&(t=r,n=!0,i=null),i&&!n||(w.has(t)?(i=w.get(t),R.cacheHits++):(i=function(e,t=!0){const n=e;if(t&&w.has(n))return w.get(n);const i=p.resolve(b,"client","index.html");let s;x.has(i)?s=x.get(i):(s=c.readFileSync(i,{encoding:"utf8"}),x.set(i,s));const r=S.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),o=a.compile(s.replace(new RegExp(r,"g"),p.posix.join(e,P)),{openDelimiter:"{",closeDelimiter:"}",async:!0,cache:!0,filename:i,rmWhitespace:!0,compileDebug:!1});return t&&w.set(n,o),o}(t,true),R.templateCompilations++),n=!1);const o=function(e){return{css:p.posix.join(e,j,"client/client.css"),js:p.posix.join(e,j,"client/client.js")}}(t),l={html:e,tags:[{tag:"link",injectTo:"head",attrs:{rel:"stylesheet",href:o.css}}]},{backendBaseURL:u,templateLess:f,portalPageId:d,canSync:m=!0}=s.server?.config.clientInjectionPlugin||{},g={PACKAGE_NAME:j,VERSION:h,backendBaseURL:u,templateLess:f,portalPageId:d,canSync:m};return l.tags.push({tag:"div",injectTo:"body-prepend",children:await i(g)}),l.tags.push({tag:"script",injectTo:"body-prepend",attrs:{src:o.js,type:"module"}}),l},configureServer(e){const t=s.normalizePath(p.resolve(e.config.root,p.dirname(d)));e.config.server?.fs?.allow&&e.config.server.fs.allow.push(t),e.middlewares.use("/@api/__pp-dev-metrics",((e,t)=>{t.setHeader("Content-Type","application/json"),t.end(JSON.stringify(R,null,2))}))},closeBundle(){w.clear(),x.clear()}}}const $=(e,t)=>` * ${t}`;function C(e){return`/*!\n${"***** DO NOT EDIT THIS CODE! *****\n***** ------- *****".replace(/^(.*)$/gm,$)}\n */`}async function N(){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}`)}}const I=new Map,T=3e4;let L=null;function O(){const e=Date.now();if(L&&e-L.timestamp<6e4)return L.data;const i=process.cwd();try{const s=JSON.parse(t.readFileSync(n.resolve(i,"package.json"),{encoding:"utf-8",flag:"r"}));return L={data:s,timestamp:e},s}catch{const t={};return L={data:t,timestamp:e},t}}let U=null;async function E(e){const s=process.cwd(),a=`ts:${e}`,r=I.get(a);if(r&&Date.now()-r.timestamp<T)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=O();o=!!e&&"module"===e.type}const c=await async function(){return U||(U=await import("esbuild")),U}(),p=await c.build({absWorkingDir:s,entryPoints:[e],outfile:"out.js",write:!1,target:["node14.18","node16"],platform:"node",bundle:!0,format:o?"esm":"cjs",mainFields:["main"],sourcemap:"inline",metafile:!0}),{text:l}=p.outputFiles[0],u=`${`pp-config.timestamp-${Date.now()}-${Math.random().toString(16).slice(2)}`}.js`,f=i.pathToFileURL(n.resolve(s,u)).toString();t.writeFileSync(u,l);let d={};try{const t=(await import(f)).default;d=t?.default||t,I.set(a,{data:d,timestamp:Date.now(),filePath:e})}finally{t.existsSync(u)&&t.unlink(u,(()=>{}))}return d}async function F(e){const t=`js:${e}`,n=I.get(t);if(n&&Date.now()-n.timestamp<T)return n.data;const s=(await import(i.pathToFileURL(e).toString())).default;return I.set(t,{data:s,timestamp:Date.now(),filePath:e}),s}async function k(e){const n=`json:${e}`,i=I.get(n);if(i&&Date.now()-i.timestamp<T)return i.data;const s=JSON.parse(t.readFileSync(e,{encoding:"utf-8"}));return I.set(n,{data:s,timestamp:Date.now(),filePath:e}),s}let z=null;async function q(e,t){for(const i of t)if(e.includes(i)){if(/\.[cm]?ts$/i.test(i))return await E(i);if(/\.[cm]?js$/i.test(i))return await F(n.resolve(".",i));if(i.endsWith(".json"))return await k(n.resolve(".",i))}return null}function M(){return O()}async function V(){const e=function(){const e=Date.now();if(z&&e-z.timestamp<1e4)return z.files;const n=/\.config\.(([cm]?ts)|([cm]?js)|(json))$/,i=process.cwd(),s=t.readdirSync(i,{withFileTypes:!0}).filter((e=>e.isFile()&&n.test(e.name))).map((e=>e.name));return z={files:s,timestamp:e},s}();let n={},i=!1;const s=await q(e,y);if(s&&(n=s,i=!0),e.length&&!i){const t=await q(e,v);t&&(n={backendBaseURL:t.baseURL,portalPageId:t.portalPageId},i=!0)}const a=O();return i||"object"!=typeof a["pp-dev"]||(n=a["pp-dev"]),n}const A=Object.freeze({__proto__:null,clearConfigCache:function(){I.clear(),L=null,z=null},getConfig:V,getPkg:M});function H(e){return e?.experimental?.ppDev||e?.ppDev||{}}function B(e,t,n){return Object.assign({},e,t,n)}exports.PP_DEV_CONFIG_NAMES=y,exports.PP_WATCH_CONFIG_NAMES=v,exports.VERSION=h,exports.config=A,exports.getNextVersion=async function(){try{return(await import("next/package.json")).version}catch{return null}},exports.getPPDevConfigFromNextConfig=H,exports.getViteConfig=async function(){const t=M().name,n=await V(),i=e.normalizeVitePPDevConfig(Object.assign(n,{templateName:t})),s=[e.vitePPDev(i),D()],{outDir:a,distZip:r,imageOptimizer:o,templateLess:c,integrateMiTopBar:p}=i;if(p&&s.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)),o){const{ViteImageOptimizer:e}=await import("vite-plugin-image-optimizer");s.push(e("object"==typeof o?o:void 0))}if(r){const{default:e}=await import("vite-plugin-zip-pack");s.push({...e("object"==typeof r?r:{outFileName:`${t}.zip`}),enforce:"post"})}return{base:c?`/p/${t}`:`/pt/${t}`,server:{port:3e3},build:{minify:!1,assetsInlineLimit:4096,rollupOptions:{output:{banner:C}},outDir:a},css:{modules:{localsConvention:"dashes"},scss:{api:"modern"}},ppDevConfig:i,plugins:s}},exports.isNextAvailable=async function(){try{return await import("next"),!0}catch(e){return!1}},exports.safeNextImport=N,exports.withPPDev=function(e,t){return async(n,i={})=>{try{const{constants:s}=await N(),{PHASE_DEVELOPMENT_SERVER:a}=s,r=await V(),o=M().name,c="function"==typeof e?await e(n,i):e,p=H(c),l=n===a,u=function(e,t,n,i){return n?t?`/p/${e}`:`/pl/${e}`:i?`/pt/${e}`:`/pl/${e}`}(o,r.templateLess??!1,l,r.v7Features??!1),f={basePath:u,trailingSlash:!!l||void 0};if(l){const e=function(e,t){const{appId:n,portalPageId:i,backendBaseURL:s,templateLess:a,v7Features:r,...o}=t,c=n||i,p={backendBaseURL:s,portalPageId:c,appId:c,templateLess:a,v7Features:r,...o};return{serverRuntimeConfig:{templateName:e,ppDevConfig:p},publicRuntimeConfig:{templateName:e,ppDevConfig:p},experimental:{ppDev:p}}}(o,Object.assign({},r,p,t));return B(f,c,e)}return B(f,c)}catch(t){console.error("Error in withPPDev:",t),console.warn("Falling back to original Next.js configuration");try{return"function"==typeof e?await e(n,i):e}catch(e){return console.error("Error in fallback configuration:",e),{}}}}};
2
+ //# sourceMappingURL=index-3fO78t0V.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-3fO78t0V.js","sources":["../../../src/constants.ts","../../../src/plugins/client-injection-plugin.ts","../../../src/banner/header.ts","../../../src/lib/next-import.ts","../../../src/config.ts","../../../src/index.ts","../../../src/plugins/mi-topbar-plugin.ts"],"sourcesContent":[null,null,null,null,null,null,null],"names":["afterBundlePath","resolve","__filename","fileURLToPath","document","require","pathToFileURL","href","_documentCurrentScript","tagName","toUpperCase","src","URL","baseURI","beforeBundlePath","PP_DEV_PACKAGE_DIR","existsSync","PP_DEV_CLIENT_ENTRY","version","name","JSON","parse","readFileSync","toString","VERSION","PACKAGE_NAME","PP_WATCH_CONFIG_NAMES","PP_DEV_CONFIG_NAMES","templateCache","cache","Map","_maxSize","constructor","maxSize","this","value","get","key","has","delete","set","size","firstKey","keys","next","undefined","clear","fileCache","DIRNAME","path","dirname","PACKAGE_IMPORT","CLIENT_PATH","PACKAGE_REGEXP","RegExp","performanceMetrics","templateCompilations","cacheHits","totalRequests","clientInjectionPlugin","opts","base","baseChanged","currentTemplate","apply","config","optimizeDeps","exclude","push","resolveId","source","test","id","normalizePath","join","replace","transformIndexHtml","async","html","ctx","serverBase","server","enableCache","cacheKey","templatePath","templateContent","fs","encoding","escapedClientPath","compiledTemplate","compile","posix","openDelimiter","closeDelimiter","filename","rmWhitespace","compileDebug","getTemplate","assetPaths","css","js","getAssetPaths","result","tags","tag","injectTo","attrs","rel","backendBaseURL","templateLess","portalPageId","canSync","templateData","children","type","configureServer","clientDir","root","allow","middlewares","use","req","res","setHeader","end","stringify","closeBundle","replacer","substring","$1","header","chunk","safeNextImport","constants","Promise","all","import","default","error","Error","configCache","CACHE_TTL","packageJsonCache","getPackageJson","now","Date","timestamp","data","cwd","process","flag","empty","esbuildModule","loadTsConfig","filePath","cached","isESM","pkg","esbuild","getEsbuild","build","absWorkingDir","entryPoints","outfile","write","target","platform","bundle","format","mainFields","sourcemap","metafile","text","code","outputFiles","fileNameTmp","Math","random","slice","fileUrl","writeFileSync","conf","unlink","loadJsConfig","loadJSONConfig","dirContentCache","loadConfig","dirFiles","configNames","configName","includes","endsWith","getPkg","getConfig","dirContent","files","endsWithRegExp","readdirSync","withFileTypes","filter","isFile","map","getDirectoryContent","configFound","newConfig","length","watchConfig","baseURL","getPPDevConfigFromNextConfig","nextConfig","experimental","ppDev","mergeConfigs","baseConfig","nextConfiguration","additionalConfig","Object","assign","templateName","ppDevConfig","normalizedPPDevConfig","normalizeVitePPDevConfig","plugins","vitePPDev","outDir","distZip","imageOptimizer","integrateMiTopBar","addRootElement","addSharedComponentsScripts","defer","miTopBarPlugin","ViteImageOptimizer","zipPack","outFileName","enforce","port","minify","assetsInlineLimit","rollupOptions","output","banner","modules","localsConvention","scss","api","nextjsConfig","phase","PHASE_DEVELOPMENT_SERVER","nextConfigPPDev","isDevelopment","basePath","v7Features","createBasePath","trailingSlash","runtimeConfig","devConfig","appId","originalAppId","rest","normalizedConfig","serverRuntimeConfig","publicRuntimeConfig","createRuntimeConfig","console","warn","fallbackError"],"mappings":"icAIMA,EAAkBC,EAAOA,QAEN,oBAAfC,YAA8BA,YAAeC,EAAAA,cAAc,oBAAAC,SAAAC,QAAA,OAAAC,cAAAJ,YAAAK,KAAAC,GAAA,WAAAA,EAAAC,QAAAC,eAAAF,EAAAG,KAAA,IAAAC,IAAA,oBAAAR,SAAAS,SAAAN,MACnE,YAGIO,EAAmBb,EAAOA,QAEP,oBAAfC,YAA8BA,YAAeC,EAAAA,cAAc,oBAAAC,SAAAC,QAAA,OAAAC,cAAAJ,YAAAK,KAAAC,GAAA,WAAAA,EAAAC,QAAAC,eAAAF,EAAAG,KAAA,IAAAC,IAAA,oBAAAR,SAAAS,SAAAN,MACnE,SAGWQ,EAAqBC,EAAUA,WAACf,UAAQD,EAAiB,iBAAmBA,EAAkBc,EAM9FG,EAAsBhB,EAAAA,QAAQc,EAAoB,0BAEzDG,QAAEA,EAAOC,KAAEA,GAASC,KAAKC,MAAMC,EAAAA,aAAarB,EAAOA,QAACc,EAAoB,iBAAiBQ,YAElFC,EAAUN,EACVO,EAAeN,EAEfO,EAAwB,CAAC,sBAAuB,sBAAuB,yBAEvEC,EAAsB,CACjC,oBACA,qBACA,qBACA,oBACA,qBACA,qBACA,sBACA,mBACA,oBACA,oBACA,mBACA,oBACA,oBACA,sBCoCF,MAAMC,EAAgB,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,EAAQwL,EAAiB9B,IAG7D,OAAOP,EAAaC,EAAYC,EAAmByC,GAIrD,OAAO3C,EAAaC,EAAYC,GAChC,MAAO5E,GACP8H,QAAQ9H,MAAM,sBAAuBA,GACrC8H,QAAQC,KAAK,kDAGb,IAKE,MAH0B,mBAAjBnB,QACGA,EAAaC,EAAOtC,GAC1BqC,EAEN,MAAOoB,GAGP,OAFAF,QAAQ9H,MAAM,mCAAoCgI,GAE3C,CAAE,IAIjB"}
package/dist/cjs/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("./plugin-xN0M6WT7.js"),r=require("./index-DJdZe-Ks.js");require("http-proxy-middleware"),require("vite"),require("picocolors"),require("axios"),require("jsdom"),require("https"),require("memory-cache"),require("path"),require("fs"),require("url"),require("crypto"),require("process"),require("child_process"),require("console"),require("zlib"),require("express"),require("ejs"),exports.AuthProvider=e.AuthProvider,exports.authProvider=e.authProvider,exports.getNextVersion=r.getNextVersion,exports.getPPDevConfigFromNextConfig=r.getPPDevConfigFromNextConfig,exports.getViteConfig=r.getViteConfig,exports.isNextAvailable=r.isNextAvailable,exports.safeNextImport=r.safeNextImport,exports.withPPDev=r.withPPDev;
1
+ "use strict";const e=require("./plugin-hCHarnpe.js"),r=require("./index-3fO78t0V.js");require("http-proxy-middleware"),require("vite"),require("picocolors"),require("axios"),require("jsdom"),require("https"),require("memory-cache"),require("path"),require("fs"),require("url"),require("crypto"),require("process"),require("child_process"),require("console"),require("zlib"),require("express"),require("ejs"),exports.AuthProvider=e.AuthProvider,exports.authProvider=e.authProvider,exports.getNextVersion=r.getNextVersion,exports.getPPDevConfigFromNextConfig=r.getPPDevConfigFromNextConfig,exports.getViteConfig=r.getViteConfig,exports.isNextAvailable=r.isNextAvailable,exports.safeNextImport=r.safeNextImport,exports.withPPDev=r.withPPDev;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@metricinsights/pp-dev",
3
3
  "type": "commonjs",
4
- "version": "0.12.3-beta.1",
4
+ "version": "0.13.0-beta.1",
5
5
  "description": "Portal Page dev build tool",
6
6
  "bin": {
7
7
  "pp-dev": "bin/pp-dev.js"
@@ -39,6 +39,9 @@
39
39
  "engines": {
40
40
  "node": ">=22.14"
41
41
  },
42
+ "overrides": {
43
+ "chokidar": "^4.0.3"
44
+ },
42
45
  "peerDependencies": {
43
46
  "next": ">= 13 < 16"
44
47
  },
@@ -92,7 +95,7 @@
92
95
  },
93
96
  "repository": {
94
97
  "type": "git",
95
- "url": "git+https://github.com/mi-examples/pp-dev-js.git"
98
+ "url": "git+https://github.com/mi-examples/pp-dev.git"
96
99
  },
97
100
  "keywords": [
98
101
  "mi",
@@ -103,8 +106,8 @@
103
106
  "helper"
104
107
  ],
105
108
  "bugs": {
106
- "url": "https://github.com/mi-examples/pp-dev-js/issues"
109
+ "url": "https://github.com/mi-examples/pp-dev/issues"
107
110
  },
108
- "homepage": "https://github.com/mi-examples/pp-dev-js#readme",
111
+ "homepage": "https://github.com/mi-examples/pp-dev#readme",
109
112
  "private": false
110
113
  }