@metricinsights/pp-dev 1.5.0-beta.16 → 1.5.0-beta.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/README.md +2 -2
- package/dist/cjs/auth.provider-CejYwjcG.js +2 -0
- package/dist/cjs/auth.provider-CejYwjcG.js.map +1 -0
- package/dist/cjs/cli.js +1 -1
- package/dist/cjs/{index-DB5b_ENM.js → index-Cev20Ede.js} +2 -2
- package/dist/cjs/{index-DB5b_ENM.js.map → index-Cev20Ede.js.map} +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/{migrate-CelZGq8b.js → migrate-MxrkBSEh.js} +2 -2
- package/dist/cjs/{migrate-CelZGq8b.js.map → migrate-MxrkBSEh.js.map} +1 -1
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/plugin.js +1 -1
- package/dist/cjs/variables-editor-DW2WJZHw.js +106 -0
- package/dist/cjs/variables-editor-DW2WJZHw.js.map +1 -0
- package/dist/cjs/{version-manifest-CWhZ6pMJ.js → version-manifest-DjLJQWWa.js} +2 -2
- package/dist/cjs/{version-manifest-CWhZ6pMJ.js.map → version-manifest-DjLJQWWa.js.map} +1 -1
- package/dist/cjs/{version-plugin-BA18wf3V.js → version-plugin-sUHrN2Jo.js} +2 -2
- package/dist/cjs/{version-plugin-BA18wf3V.js.map → version-plugin-sUHrN2Jo.js.map} +1 -1
- package/dist/client/client.js +67 -14
- package/dist/client/client.js.map +1 -1
- package/dist/esm/{auth.provider-JbhiukCJ.js → auth.provider-BijrVDxp.js} +2 -2
- package/dist/esm/auth.provider-BijrVDxp.js.map +1 -0
- package/dist/esm/cli.js +1 -1
- package/dist/esm/{index-CLZFEGjm.js → index-CL8_j3ER.js} +2 -2
- package/dist/esm/{index-CLZFEGjm.js.map → index-CL8_j3ER.js.map} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/{migrate-k56kAk34.js → migrate-B0hgQCl_.js} +2 -2
- package/dist/esm/{migrate-k56kAk34.js.map → migrate-B0hgQCl_.js.map} +1 -1
- package/dist/esm/package.json +1 -1
- package/dist/esm/plugin.js +1 -1
- package/dist/esm/{variables-editor-DejgONni.js → variables-editor-w314pia8.js} +3 -3
- package/dist/esm/variables-editor-w314pia8.js.map +1 -0
- package/dist/esm/{version-manifest-Dwqb65_g.js → version-manifest-1KdgXTW2.js} +2 -2
- package/dist/esm/{version-manifest-Dwqb65_g.js.map → version-manifest-1KdgXTW2.js.map} +1 -1
- package/dist/esm/{version-plugin-DFyZTNxe.js → version-plugin-BExwn1e0.js} +2 -2
- package/dist/esm/{version-plugin-DFyZTNxe.js.map → version-plugin-BExwn1e0.js.map} +1 -1
- package/dist/types/index.d.ts +0 -6
- package/package.json +1 -1
- package/dist/cjs/auth.provider-Co900L4C.js +0 -2
- package/dist/cjs/auth.provider-Co900L4C.js.map +0 -1
- package/dist/cjs/variables-editor-BWjt3zQ-.js +0 -106
- package/dist/cjs/variables-editor-BWjt3zQ-.js.map +0 -1
- package/dist/esm/auth.provider-JbhiukCJ.js.map +0 -1
- package/dist/esm/variables-editor-DejgONni.js.map +0 -1
package/README.md
CHANGED
|
@@ -215,7 +215,7 @@ section for the full feature description.
|
|
|
215
215
|
|
|
216
216
|
| Field | Type | Default | Description |
|
|
217
217
|
|-----------|-----------|---------|--------------------------------------------------------------------------------------------------------------|
|
|
218
|
-
| `persist` | `boolean` | `false` | Keep the users added with an API token between dev server runs, in `~/.pp-dev/users/` (readable by you only) |
|
|
218
|
+
| `persist` | `boolean` | `false` | Keep the users added with an API token between dev server runs, in `~/.pp-dev/users/` (plain text, readable by you only; on Windows, by your profile's permissions) |
|
|
219
219
|
|
|
220
220
|
See [Working as other users](#working-as-other-users).
|
|
221
221
|
|
|
@@ -594,7 +594,7 @@ Logging out on a user's host ends that user's MI session (or token) as it would
|
|
|
594
594
|
|
|
595
595
|
### Keeping users between runs
|
|
596
596
|
|
|
597
|
-
Users live as long as the dev server. With `users: { persist: true }` the users added with an API token are kept in `~/.pp-dev/users/<hash>.json` — one file per project and MI instance,
|
|
597
|
+
Users live as long as the dev server. With `users: { persist: true }` the users added with an API token are kept in `~/.pp-dev/users/<hash>.json` — one file per project and MI instance, outside the project so it never ends up in git or a build. The tokens are stored as plain text: on macOS and Linux the file is readable by you only (mode `0600`); Windows ignores file modes, so there it is as private as your user profile folder (by default readable by you, administrators and the system). Two dev servers on the same project and MI instance share the file: each keeps the users the other added. Passwords and MI sessions are never written. On start, every kept token is checked with MI again; one MI turns down shows as *API token turned down by MI*.
|
|
598
598
|
|
|
599
599
|
```typescript
|
|
600
600
|
// pp-dev.config.ts
|
package/dist/README.md
CHANGED
|
@@ -215,7 +215,7 @@ section for the full feature description.
|
|
|
215
215
|
|
|
216
216
|
| Field | Type | Default | Description |
|
|
217
217
|
|-----------|-----------|---------|--------------------------------------------------------------------------------------------------------------|
|
|
218
|
-
| `persist` | `boolean` | `false` | Keep the users added with an API token between dev server runs, in `~/.pp-dev/users/` (readable by you only) |
|
|
218
|
+
| `persist` | `boolean` | `false` | Keep the users added with an API token between dev server runs, in `~/.pp-dev/users/` (plain text, readable by you only; on Windows, by your profile's permissions) |
|
|
219
219
|
|
|
220
220
|
See [Working as other users](#working-as-other-users).
|
|
221
221
|
|
|
@@ -594,7 +594,7 @@ Logging out on a user's host ends that user's MI session (or token) as it would
|
|
|
594
594
|
|
|
595
595
|
### Keeping users between runs
|
|
596
596
|
|
|
597
|
-
Users live as long as the dev server. With `users: { persist: true }` the users added with an API token are kept in `~/.pp-dev/users/<hash>.json` — one file per project and MI instance,
|
|
597
|
+
Users live as long as the dev server. With `users: { persist: true }` the users added with an API token are kept in `~/.pp-dev/users/<hash>.json` — one file per project and MI instance, outside the project so it never ends up in git or a build. The tokens are stored as plain text: on macOS and Linux the file is readable by you only (mode `0600`); Windows ignores file modes, so there it is as private as your user profile folder (by default readable by you, administrators and the system). Two dev servers on the same project and MI instance share the file: each keeps the users the other added. Passwords and MI sessions are never written. On start, every kept token is checked with MI again; one MI turns down shows as *API token turned down by MI*.
|
|
598
598
|
|
|
599
599
|
```typescript
|
|
600
600
|
// pp-dev.config.ts
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const e=require("fs"),t=require("path"),i=require("url"),r=require("picocolors"),s=require("node:path"),o=require("vite");var n="undefined"!=typeof document?document.currentScript:null;const a=(e=>e&&"object"==typeof e&&"default"in e?e.default:e)(s),p=t.resolve("undefined"!=typeof __filename&&__filename||i.fileURLToPath("undefined"==typeof document?require("url").pathToFileURL(__filename).href:n&&"SCRIPT"===n.tagName.toUpperCase()&&n.src||new URL("auth.provider-CejYwjcG.js",document.baseURI).href),"../../.."),d=t.resolve("undefined"!=typeof __filename&&__filename||i.fileURLToPath("undefined"==typeof document?require("url").pathToFileURL(__filename).href:n&&"SCRIPT"===n.tagName.toUpperCase()&&n.src||new URL("auth.provider-CejYwjcG.js",document.baseURI).href),"../.."),l=e.existsSync(t.resolve(p,"package.json"))?p:d,c=t.resolve(l,"dist/client/client.js"),{version:u,name:m}=JSON.parse(e.readFileSync(t.resolve(l,"package.json")).toString()),f=u,h=m,v="info";let g,w;function E(){return g??={level:v,logger:o.createLogger(v)},g.logger}function P(e){return void 0!==e&&e!==g?.level&&(g={level:e,logger:o.createLogger(e)}),w??={info:(e,t)=>E().info(e,t),warn:(e,t)=>E().warn(e,t),warnOnce:(e,t)=>E().warnOnce(e,t),error:(e,t)=>E().error(e,t),clearScreen:e=>E().clearScreen(e),hasErrorLogged:e=>E().hasErrorLogged(e),get hasWarned(){return E().hasWarned},set hasWarned(e){E().hasWarned=e}},w}const b=r.createColors();function _(e,t){if(!e||e.includes("\0")||a.posix.isAbsolute(e)||a.win32.isAbsolute(e)||a.win32.parse(e).root)throw new Error(`[pp-dev] ${t} must be a relative path inside its output directory.`);const i=a.posix.normalize(e.replace(/\\/g,"/"));if("."===i||".."===i||i.startsWith("../"))throw new Error(`[pp-dev] ${t} must stay inside its output directory.`);return i}function y(e){return _(`${e.replace(/^@/,"").replace(/[\\/]+/g,"-")}.zip`,"default ZIP output file name")}const A=["top-left","top-right","bottom-left","bottom-right"],L=2147483647;class R{state={isAuthenticated:!1,isRedirected:!1,lastChecked:0};listeners=new Set;getState(){return{...this.state}}isAuthenticated(){return this.state.isAuthenticated}isRedirected(){return this.state.isRedirected}setAuthenticated(e){this.state.isAuthenticated=e,this.state.lastChecked=Date.now(),this.notifyListeners()}setRedirected(e){this.state.isRedirected=e,this.notifyListeners()}updateState(e){void 0!==e.isAuthenticated&&(this.state.isAuthenticated=e.isAuthenticated),void 0!==e.isRedirected&&(this.state.isRedirected=e.isRedirected),this.state.lastChecked=Date.now(),this.notifyListeners()}reset(){this.state={isAuthenticated:!1,isRedirected:!1,lastChecked:0},this.notifyListeners()}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notifyListeners(){this.listeners.forEach(e=>{try{e(this.getState())}catch(e){P().error(`Error in auth state listener: ${e instanceof Error?e.stack??e.message:String(e)}`)}})}}const x=new R;exports.AuthProvider=R,exports.PACKAGE_NAME=h,exports.PATH_PAGE_PREFIX="/p",exports.PATH_TEMPLATE_LOCAL_PREFIX="/pl",exports.PATH_TEMPLATE_PREFIX="/pt",exports.PP_DEV_CLIENT_ENTRY=c,exports.PP_DEV_CONFIG_NAMES=[".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"],exports.PP_DEV_NEXT_BUILD_ENV_VAR="PP_DEV_NEXT_BUILD",exports.PP_DEV_PACKAGE_DIR=l,exports.VERSION=f,exports.authProvider=x,exports.colors=b,exports.createDefaultZipFileName=y,exports.createLogger=P,exports.normalizePPDevConfig=function(e,t){const{mi:i={},app:r={},proxy:s={},build:o={},sync:n={},inspector:a={},devPanel:p={},users:d={}}=e,l=i.mode??"standalone",c=r.type??"template",u=i.apiVersion??7,m="standalone"===l;let f=!1;"top-bar"===i.include?f=!0:"shared-components"===i.include&&(f={addSharedComponentsScripts:!0,addRootElement:!1});const h="page"===c,v=r.name??t;if(!v)throw new Error("[pp-dev] app.name is required (or set package.json#name)");const g="VERSION-v{packageversion}-{currentDate}.json";let w;const E=o.zip;let P;w=!1!==E&&(!0===E||void 0===E?{outFileName:y(v),outDir:"dist-zip"}:{outFileName:_(E.fileName??y(v),"build.zip.fileName"),outDir:E.outDir??"dist-zip",...E.inDir?{inDir:E.inDir}:{}});const b=o.versionFile;let A;P=!1!==b&&(!0===b||void 0===b?{versionFileTemplate:g,enabled:!0}:{versionFileTemplate:_(b.fileNameTemplate??g,"build.versionFile.fileNameTemplate"),enabled:b.enabled??!0});const L=o.imageOptimisations;return A=!1!==L&&(!0===L||void 0===L?{}:L),{templateName:v,backendBaseURL:i.url??process.env.MI_BACKEND_URL,appId:r.id,templateLess:h,miHudLess:m,integrateMiTopBar:f,enableProxyCache:s.cache??!0,proxyCacheTTL:s.cacheTtl??6e5,disableSSLValidation:s.tls?.allowSelfSigned??!1,imageOptimizer:A,outDir:o.outDir??"dist",distZip:w,versionPlugin:P,syncBackupsDir:n.backupsDir??"backups",syncMaxBackups:n.maxBackups,syncBuildTimeoutMs:n.buildTimeoutMs,v7Features:u>=7,personalAccessToken:i.token??process.env.MI_ACCESS_TOKEN,inspectorEnabled:a.enabled??!0,inspectorMaxMemory:a.maxMemory??1073741824,inspectorCaptureLimit:a.captureLimit??10485760,devPanelPosition:p.position??"bottom-right",devPanelHidden:p.hidden??!1,devPanelAutoHide:p.autoHide??!1,persistUsers:d.persist??!1}},exports.normalizeRelativeOutputPath=_,exports.resolveOutputFilePath=function(e,t,i){const r=_(t,i),s=a.resolve(e),o=a.resolve(s,...r.split("/")),n=a.relative(s,o);if(".."===n||n.startsWith(`..${a.sep}`)||a.isAbsolute(n))throw new Error(`[pp-dev] ${i} must resolve inside its output directory.`);return o},exports.validatePPDevConfig=function(e,t){const i=e.mi?.mode??"standalone",r=e.app?.type??"template",s=e.mi?.apiVersion??7,o=e.mi?.url??process.env.MI_BACKEND_URL;if(!(e.app?.name??t))throw new Error("[pp-dev] app.name is required (or set package.json#name)");const n=e.sync?.maxBackups;if(void 0!==n&&!1!==n&&!(Number.isInteger(n)&&n>=0))throw new Error(`[pp-dev] sync.maxBackups must be a whole number ≥ 0 or false (0 and false keep every backup), got ${JSON.stringify(n)}`);const a=e.sync?.buildTimeoutMs;if(void 0!==a&&!(Number.isInteger(a)&&a>0&&a<=L))throw new Error(`[pp-dev] sync.buildTimeoutMs must be a whole number of milliseconds between 1 and 2147483647, got ${JSON.stringify(a)}`);if(e.mi?.include&&"standalone"!==i)throw console.warn('[pp-dev] mi.include is only valid when mi.mode is "standalone"'),new Error('[pp-dev] mi.include requires mi.mode to be "standalone"');if(!o){if("embedding"===i||"template"===r)throw new Error('[pp-dev] mi.url is required when mi.mode is "embedding" or app.type is "template"');"standalone"===i&&"page"===r&&console.warn("[pp-dev] mi.url is not set — dev server will run without a backend proxy")}if("template"===r&&!e.app?.id)throw new Error('[pp-dev] app.id is required when app.type is "template"');if("page"===r&&o&&("standalone"===i||s>=7)&&!e.app?.id)throw new Error('[pp-dev] app.id is required when backend page data is loaded for app.type "page"');if(void 0!==e.devPanel?.position&&!A.includes(e.devPanel.position))throw new Error(`[pp-dev] devPanel.position must be one of: ${A.join(", ")}`)};
|
|
2
|
+
//# sourceMappingURL=auth.provider-CejYwjcG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.provider-CejYwjcG.js","sources":["../../../src/constants.ts","../../../src/lib/logger.ts","../../../src/lib/helpers/color.helper.ts","../../../src/lib/output-path.ts","../../../src/lib/pp-dev-config.ts","../../../src/lib/auth.provider.ts"],"sourcesContent":[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","DEFAULT_LEVEL","current","shared","active","level","logger","createViteLogger","createLogger","undefined","info","msg","options","warn","warnOnce","error","clearScreen","type","hasErrorLogged","hasWarned","value","colors","createColors","normalizeRelativeOutputPath","relativePath","optionName","includes","path","posix","isAbsolute","win32","root","Error","normalized","normalize","replace","startsWith","createDefaultZipFileName","appName","DEV_PANEL_POSITIONS","MAX_TIMER_DELAY_MS","AuthProvider","state","isAuthenticated","isRedirected","lastChecked","listeners","Set","getState","this","setAuthenticated","authenticated","Date","now","notifyListeners","setRedirected","redirected","updateState","updates","reset","subscribe","listener","add","delete","forEach","stack","message","String","authProvider","config","templateName","mi","app","proxy","build","sync","inspector","devPanel","users","miMode","mode","appType","apiVersion","miHudLess","integrateMiTopBar","include","addSharedComponentsScripts","addRootElement","templateLess","resolvedName","defaultVersionFileTemplate","distZip","zipCfg","zip","versionPlugin","outFileName","outDir","fileName","inDir","vfCfg","versionFile","imageOptimizer","versionFileTemplate","enabled","fileNameTemplate","imgCfg","imageOptimisations","backendBaseURL","url","process","env","MI_BACKEND_URL","appId","id","enableProxyCache","cache","proxyCacheTTL","cacheTtl","disableSSLValidation","tls","allowSelfSigned","syncBackupsDir","backupsDir","syncMaxBackups","maxBackups","syncBuildTimeoutMs","buildTimeoutMs","v7Features","personalAccessToken","token","MI_ACCESS_TOKEN","inspectorEnabled","inspectorMaxMemory","maxMemory","inspectorCaptureLimit","captureLimit","devPanelPosition","position","devPanelHidden","hidden","devPanelAutoHide","autoHide","persistUsers","persist","directory","safeRelativePath","resolvedDirectory","resolvedFile","split","relativeToDirectory","relative","sep","miUrl","Number","isInteger","stringify","console","join"],"mappings":"uQAIMA,EAAkBC,EAAAA,QAEC,oBAAfC,YAA8BA,YAAeC,EAAAA,cAAc,oBAAAC,SAAAC,QA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AOG,KAAKyC,GACpC,MAAM,IAAIjF,MAAM,oFAGlB,QAAkCvB,IAA9B4D,EAAOQ,UAAU4D,WAA2BlG,EAAoBb,SAAS2C,EAAOQ,SAAS4D,UAC3F,MAAM,IAAIzG,MAAM,8CAA8CO,EAAoBsH,KAAK,QAE3F"}
|
package/dist/cjs/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e=require("path"),t=require("fs"),o=require("node:events"),n=require("node:perf_hooks"),i=require("chokidar"),r=require("cac"),s=require("./auth.provider-Co900L4C.js"),a=require("./index-DB5b_ENM.js"),l=require("vite"),c=require("url"),d=require("./variables-editor-BWjt3zQ-.js"),p=require("dir-compare"),f=require("diff-match-patch"),u=require("isbinaryfile"),g=require("os"),h=require("crypto"),m=require("ws"),v=require("./version-manifest-CWhZ6pMJ.js");require("picocolors"),require("node:path"),require("child_process"),require("node:module"),require("./helpers.js"),require("ejs"),require("zlib"),require("axios"),require("node:http"),require("node:https"),require("http-proxy-middleware"),require("node:string_decoder"),require("node:crypto"),require("node:fs"),require("node:os"),require("express"),require("process"),require("jszip"),require("module"),require("fs/promises"),require("util");const w=e=>e&&"object"==typeof e&&"default"in e?e.default:e;function b(e){if(e&&"object"==typeof e&&"default"in e)return e;const t=Object.create(null);if(e)for(const o in e)t[o]=e[o];return t.default=e,Object.freeze(t)}const y=b(e),P=b(t),S=b(p),x=w(f),E=b(g),T=b(h);function L(e){return null!=e&&!1!==e}let k=null;const D=new WeakMap;function F(e,t){if(!e.httpServer||!process.stdin.isTTY||process.env.CI)return;D.set(e,t);const o=s.createLogger();t.print&&o.info(s.colors.dim(s.colors.green(" ➜"))+s.colors.dim(" press ")+s.colors.bold("h")+s.colors.dim(" to show help"));const n=(t.customShortcuts??[]).filter(L).concat(I);k?.(),k=null;let i=!1;const r=process.stdin.isPaused(),a=process.stdin,l=Boolean(a.isRaw),c=async t=>{if(""===t)return void function(e=process){"win32"===e.platform?e.emit("SIGINT","SIGINT"):e.kill(e.pid,"SIGINT")}();if(""===t)return void await e.close().finally(()=>process.exit(0));if(i)return;"h"===t&&o.info(["",s.colors.bold(" Shortcuts"),...n.map(e=>s.colors.dim(" press ")+s.colors.bold(e.key)+s.colors.dim(` to ${e.description}`))].join("\n"));const r=n.find(e=>e.key===t);r&&(i=!0,await r.action(e),i=!1)};process.stdin.setRawMode(!0),process.stdin.on("data",c).setEncoding("utf8").resume();const d=e.httpServer,p=()=>{k===p&&(d.removeListener("close",p),process.stdin.off("data",c),l||process.stdin.setRawMode(!1),r&&process.stdin.pause(),k=null)};k=p,d.on("close",p)}const I=[{key:"r",description:"restart the server",async action(e){const t=D.get(e);await e.restart(),t&&F(e,{...t,print:!1})}},{key:"u",description:"show server url",action(e){e.config.logger.info(""),e.printUrls()}},{key:"o",description:"open in browser",action(e){e.openBrowser()}},{key:"c",description:"clear console",action(e){e.config.logger.clearScreen("error")}},{key:"q",description:"quit",async action(e){await e.close().finally(()=>process.exit())}},{key:"C",description:"clear proxy cache",action(e){e.cache&&(e.cache.clear(),e.config.logger.info("Proxy cache cleared"))}}];const _=/(.+)(-[a-f0-9]{6,20})(\.[a-z0-9]+)$/i;class ${oldAssetsPath;newAssetsPath;destinationPath;changelogFilename;changelogTemplate='<!DOCTYPE html>\n <html lang="en">\n <head>\n <meta charset="UTF-8" />\n <title>Changelog Diff</title>\n <style>\n tr,\n td {\n padding: 0;\n }\n .diff-file {\n margin-top: 20px;\n border: 1px solid #e1e4e8;\n border-radius: 6px;\n }\n .diff-file-title {\n padding: 10px 20px;\n background-color: #f6f8fa;\n border-bottom: 1px solid #e1e4e8;\n border-radius: 6px 6px 0 0;\n font-weight: bold;\n }\n .diff-file-title .renamed {\n font-weight: normal;\n }\n .diff-file-title .renamed .from {\n color: #cb2431;\n }\n .diff-file-title .renamed .to {\n color: #22863a;\n }\n .diff-file-title .added {\n color: #22863a;\n }\n .diff-file-title .deleted {\n color: #cb2431;\n }\n .diff-file-content {\n }\n .diff-table {\n tab-size: 8;\n width: 100%;\n border-collapse: separate;\n border-spacing: 0;\n }\n .blob-num {\n position: relative;\n color: #1f2328;\n width: 1%;\n min-width: 50px;\n padding: 0 10px;\n font-family:\n ui-monospace,\n SFMono-Regular,\n SF Mono,\n Menlo,\n Consolas,\n Liberation Mono,\n monospace;\n font-size: 12px;\n line-height: 20px;\n text-align: right;\n white-space: nowrap;\n vertical-align: top;\n cursor: pointer;\n -webkit-user-select: none;\n user-select: none;\n }\n .blob-num.addition {\n background-color: #ccffd8;\n border-color: #1f883e;\n }\n .blob-num.deletion {\n background-color: #ffd7d5;\n border-color: #cf222e;\n }\n .blob-num::before {\n content: attr(data-line-number);\n }\n .blob-code {\n position: relative;\n padding: 0 10px 0 22px;\n vertical-align: top;\n color: #1f2329;\n }\n .blob-code.code-addition {\n background-color: #e6ffec;\n }\n .blob-code.code-deletion {\n background-color: #ffebe9;\n }\n .blob-code.skip,\n .blob-code.message {\n text-align: center;\n }\n .blob-code.skip .blob-code-inner,\n .blob-code.message .blob-code-inner {\n font-weight: bold;\n color: #6a737d;\n padding: 10px 0;\n }\n .blob-code-inner {\n display: table-cell;\n overflow: visible;\n font-family:\n ui-monospace,\n SFMono-Regular,\n SF Mono,\n Menlo,\n Consolas,\n Liberation Mono,\n monospace;\n font-size: 12px;\n word-wrap: anywhere;\n white-space: pre-wrap;\n }\n .blob-code-inner::before {\n content: attr(data-code-prefix);\n position: absolute;\n top: 1px;\n left: 8px;\n padding-right: 8px;\n }\n </style>\n </head>\n <body>\n <h1>Changelog Diff</h1>\n\n %FILES%\n </body>\n </html>';diffFileTemplateHandler;diffLineTemplateHandler;contextLines=3;logger;constructor(e){const{oldAssetsPath:t,newAssetsPath:o,destinationPath:n,changelogTemplate:i,diffFileTemplateHandler:r,diffLineTemplateHandler:a,changelogFilename:l,contextLines:c}=e;if(this.logger=s.createLogger(),!t||!o||!n)throw new Error("Previous assets path, current assets path and destination path are required");if(t===o)throw new Error("Previous and current assets paths must be different");if(!this.isExists(t))throw new Error(`Previous assets path ${t} does not exist`);if(!this.isExists(o))throw new Error(`Current assets path ${o} does not exist`);if(this.isZipFile(t)){const e=y.resolve(E.tmpdir(),T.createHash("md5").update(t).digest("hex"));this.oldAssetsPath=this.unzipFile(t,e).then(()=>this.normalizeAssetFolderPath(e)).then(e=>{if(this.isEmptyFolder(e))throw new Error(`Previous assets path ${e} is empty`);return e})}else{if(!this.isFolder(t))throw new Error(`Invalid previous assets path ${t}. It must be a folder or a zip file`);{const e=this.normalizeAssetFolderPath(t);if(this.isEmptyFolder(e))throw new Error(`Previous assets path ${e} is empty`);this.oldAssetsPath=Promise.resolve(e)}}if(this.isZipFile(o)){const e=y.resolve(E.tmpdir(),T.createHash("md5").update(o).digest("hex"));this.newAssetsPath=this.unzipFile(o,e).then(()=>this.normalizeAssetFolderPath(e)).then(e=>{if(this.isEmptyFolder(e))throw new Error(`Current assets path ${e} is empty`);return e})}else{if(!this.isFolder(o))throw new Error(`Invalid current assets path ${o}. It must be a folder or a zip file`);{const e=this.normalizeAssetFolderPath(o);if(this.isEmptyFolder(e))throw new Error(`Current assets path ${o} is empty`);this.newAssetsPath=Promise.resolve(e)}}this.destinationPath=n,this.mkdirpSync(this.destinationPath),this.changelogFilename=l||"CHANGELOG.html",i&&(this.templateIsValid(i)?this.changelogTemplate=i:this.logger.warn(s.colors.yellow("Invalid changelog template, using default"))),"function"==typeof r&&(this.diffFileTemplateHandler=r),"function"==typeof a&&(this.diffLineTemplateHandler=a),c&&(this.contextLines=c)}templateIsValid(e){return e.includes("%FILES%")}isExists(e){return P.existsSync(e)}isZipFile(e){return e.endsWith(".zip")}isFolder(e){return P.lstatSync(e).isDirectory()}isEmptyFolder(e){return 0===P.readdirSync(e,{withFileTypes:!0}).length}mkdirpSync(e){P.existsSync(e)||P.mkdirSync(e,{recursive:!0})}async unzipFile(e,t){P.rmSync(t,{force:!0,recursive:!0}),await d.extractZipSafe(e,t)}normalizeAssetFolderPath(e){const t=P.readdirSync(e);return 1===t.length&&P.lstatSync(y.join(e,t[0])).isDirectory()?this.normalizeAssetFolderPath(y.join(e,t[0])):e}pathToPosix(e){return e.replace(/\\/g,"/")}diffTableTemplate(e){return`<table class="diff-table">\n <tbody>\n ${e}\n </tbody>\n </table>`}getDiffTableHTML(e){const t=e.filter((e,t,o)=>0!==e.lineType||(t>=0&&t<this.contextLines||t>o.length-(this.contextLines+1)&&t<=o.length-1||o.slice(t-this.contextLines,t+this.contextLines+1).some(e=>0!==e.lineType))).map((e,t,o)=>{if(t>0){const n=o[t-1];if(e.lineNumber-n.lineNumber>1)return[{lineNumber:-1,lineContent:"",lineType:0},e]}return[e]}).flat().map(e=>this.diffLineHTML(e)).join("");return this.diffTableTemplate(t)}diffLineMessageTemplate(e){return`<tr>\n <td class="blob-num"></td>\n <td class="blob-num"></td>\n <td class="blob-code message">\n <span class="blob-code-inner">${e}</span>\n </td>\n </tr>`}diffLineSkipTemplate(){return'<tr>\n <td class="blob-num"></td>\n <td class="blob-num"></td>\n <td class="blob-code skip">\n <span class="blob-code-inner">Skip</span>\n </td>\n </tr>'}diffLineTemplate(e){const{lineNumber:t,lineContent:o,lineType:n}=e,i=1===n?"addition":-1===n?"deletion":"";return`<tr>\n <td\n class="blob-num ${i}${"addition"===i?" empty":""}"\n ${"addition"!==i?` data-line-number="${t}"`:""}\n ></td>\n <td\n class="blob-num ${i}${"deletion"===i?" empty":""}"\n ${"deletion"!==i?` data-line-number="${t}"`:""}\n ></td>\n <td class="blob-code ${1===n?"code-addition":-1===n?"code-deletion":""}">\n <span class="blob-code-inner" data-code-prefix="${1===n?"+":-1===n?"-":" "}">${r=o??"",r.replace(/[\u00A0-\u9999<>&]/g,e=>"&#"+e.charCodeAt(0)+";")}</span>\n </td>\n </tr>`;var r}diffLineHTML(e){if(this.diffLineTemplateHandler)return this.diffLineTemplateHandler(e);const{lineNumber:t}=e;return-1===t?this.diffLineSkipTemplate():this.diffLineTemplate(e)}diffFileTemplate(e,t){return this.diffFileTemplateHandler?this.diffFileTemplateHandler(e,t):`<div class="diff-file">\n <div class="diff-file-title">${e}</div>\n <div class="diff-file-content">${t}</div>\n </div>`}async generateAssetFoldersDiff(){this.logger.info(s.colors.blue(`Comparing asset folders ${await this.oldAssetsPath} and ${await this.newAssetsPath}`));const e=await S.compare(await this.oldAssetsPath,await this.newAssetsPath,{compareContent:!0,skipSymlinks:!0,compareSize:!0,compareDate:!1,compareNameHandler:(e,t)=>(_.test(e)&&(e=e.replace(_,"$1$3")),_.test(t)&&(t=t.replace(_,"$1$3")),0===e.localeCompare(t)?0:e.localeCompare(t)>0?1:-1)});return e.diffSet?.filter(e=>"equal"!==e.state||e.name1!==e.name2)||[]}async generateAssetFilesDiff(e,t){const o=new x,n=o.diff_linesToChars_(e,t),i=o.diff_main(n.chars1,n.chars2,!1);o.diff_charsToLines_(i,n.lineArray);let r=0;return i.map(e=>{const[t,o]=e,n=o.endsWith("\n")?o.split("\n").length-1:o.split("\n").length,i=o.split("\n").map((e,o)=>({lineContent:e,lineNumber:r+o+1,lineType:t})).slice(0,n);return-1!==t&&(r+=n),i}).flat()}async generateFilesDiff(e){if("equal"===e.state){const t=this.pathToPosix(y.join(".",e.relativePath,e.name1??"")),o=this.pathToPosix(y.join(".",e.relativePath,e.name2??""));return this.diffFileTemplate(`<span class="renamed"\n >Renamed <span class="from">${t}</span> -> <span class="to">${o}</span></span\n >`,this.diffTableTemplate(this.diffLineMessageTemplate("No changes")))}const t=e.path1&&e.name1?y.join(e.path1,e.name1):null,o=e.path2&&e.name2?y.join(e.path2,e.name2):null,n=this.pathToPosix(y.join(".",e.relativePath,(e.name1||e.name2)??""));if("left"===e.state&&t)return this.diffFileTemplate(`<span class="removed">Removed ${n}</span>`,this.diffTableTemplate(this.diffLineMessageTemplate("File removed")));if("right"===e.state&&o)return this.diffFileTemplate(`<span class="added">Added ${n}</span>`,this.diffTableTemplate(this.diffLineMessageTemplate("File added")));if("distinct"===e.state&&t&&o){const i=this.pathToPosix(y.join(".",e.relativePath,e.name1??"")),r=this.pathToPosix(y.join(".",e.relativePath,e.name2??"")),s=e.name1!==e.name2?`<span class="renamed"\n >Renamed <span class="from">${i}</span> -> <span class="to">${r}</span></span\n >`:n;return this.diffFileTemplate(s,await u.isBinaryFile(t)||await u.isBinaryFile(o)?this.diffTableTemplate(this.diffLineMessageTemplate("Binary file")):this.getDiffTableHTML(await this.generateAssetFilesDiff(P.readFileSync(t,"utf-8"),P.readFileSync(o,"utf-8"))))}return""}async generateChangelog(){this.logger.info(s.colors.green("Generating changelog"));const e=await this.generateAssetFoldersDiff(),t=(await Promise.all(e.map(e=>this.generateFilesDiff(e)))).join("");this.logger.info(s.colors.green("Writing changelog file"));const o=this.changelogTemplate.split("%FILES%");o.splice(1,0,t);const n=o.join("");P.writeFileSync(y.join(this.destinationPath,this.changelogFilename),n),this.logger.info(s.colors.green(`Changelog file written to ${y.join(this.destinationPath,this.changelogFilename)}`))}}class N{sourceDir;outputDir;fontName;constructor(e){this.sourceDir=e.sourceDir,this.outputDir=e.outputDir,this.fontName=e.fontName}async generate(){const{default:e}=await(import("svgtofont"));await e({src:this.sourceDir,dist:this.outputDir,fontName:this.fontName,css:!0,typescript:!0,startUnicode:59905,svgicons2svgfont:{fontHeight:1024}})}}class j{wss;eventListeners=new Map;lifecycleListeners=new Map;clients=new Map;ws;constructor(){this.wss=new m.WebSocketServer({noServer:!0}),this.wss.on("connection",e=>this.onConnection(e)),this.wss.on("error",e=>this.fireLifecycle("error",e)),this.ws={on:(e,t)=>{"close"!==e&&"error"!==e?this.getEventSet(e).add(t):this.getLifecycleSet(e).add(t)},off:(e,t)=>{this.eventListeners.get(e)?.delete(t),"close"!==e&&"error"!==e||this.lifecycleListeners.get(e)?.delete(t)},send:(e,t)=>{if("string"==typeof e)for(const o of this.clients.keys())this.sendToSocket(o,e,t);else{const t=JSON.stringify(e);for(const e of this.clients.keys())e.readyState===m.WebSocket.OPEN&&e.send(t)}}}}handleUpgrade(e,t,o){if((e.url??"").split("?")[0]!==d.PP_DEV_HMR_WS_PATH)return!1;return d.crossOriginReason(e)?(t.once("error",()=>t.destroy()),t.end("HTTP/1.1 403 Forbidden\r\nConnection: close\r\nContent-Length: 0\r\n\r\n",()=>t.destroy()),!0):(this.wss.handleUpgrade(e,t,o,t=>{this.wss.emit("connection",t,e)}),!0)}async close(){this.fireLifecycle("close");for(const e of this.clients.keys())e.terminate();this.clients.clear(),await new Promise(e=>this.wss.close(()=>e()))}onConnection(e){const t={send:(t,o)=>this.sendToSocket(e,t,o),socket:e};this.clients.set(e,t),e.on("message",e=>this.onMessage(t,e)),e.on("close",()=>this.clients.delete(e)),e.on("error",()=>{})}onMessage(e,t){let o;try{o=JSON.parse(t.toString())}catch{return}if(!o||"custom"!==o.type||"string"!=typeof o.event)return;const n=this.eventListeners.get(o.event);if(n)for(const t of n)try{t(o.data,e)}catch(e){s.createLogger().error(`ws handler for "${o.event}" failed`,{error:e instanceof Error?e:new Error(String(e))})}}sendToSocket(e,t,o){e.readyState===m.WebSocket.OPEN&&e.send(JSON.stringify({type:"custom",event:t,data:o}))}fireLifecycle(e,t){for(const o of this.lifecycleListeners.get(e)??[])try{o(t)}catch{}}getEventSet(e){let t=this.eventListeners.get(e);return t||(t=new Set,this.eventListeners.set(e,t)),t}getLifecycleSet(e){let t=this.lifecycleListeners.get(e);return t||(t=new Set,this.lifecycleListeners.set(e,t)),t}}function C(e){return e instanceof Error?e.stack??e.message:String(e)}function A({logger:e,knownRejections:t=[],shutdown:o,shutdownTimeoutMs:n=5e3,processRef:i=process}){let r=!1,a=0;const l=async(t,l)=>{if((e=>{a=Math.max(a,e)})(l),r)return void("SIGINT"!==t&&"SIGTERM"!==t&&"SIGHUP"!==t||(e.warn(s.colors.yellow(`\n⚠️ Received ${t} again, exiting without waiting for the shutdown`)),i.exit(a)));r=!0,e.info(s.colors.yellow(`\n🛑 Received ${t}, shutting down gracefully...`));const c=setTimeout(()=>{e.error(s.colors.red(`⏰ Shutdown did not finish within ${n} ms, forcing exit`)),i.exit(1)},n);try{await o(),clearTimeout(c),e.info(s.colors.green("✅ Graceful shutdown completed")),i.exit(a)}catch(t){clearTimeout(c),e.error(s.colors.red(`❌ Error during graceful shutdown: ${C(t)}`)),i.exit(1)}},c=()=>{l("SIGINT",0)},d=()=>{l("SIGTERM",0)},p=()=>{l("SIGHUP",0)},f=t=>{e.error(s.colors.red(`❌ Uncaught exception: ${C(t)}`)),l("uncaughtException",1)},u=o=>{const n=t.find(e=>e.matches(o));n?e.info(s.colors.dim(n.message)):e.error(s.colors.red(`❌ Unhandled promise rejection (the server keeps running): ${C(o)}`))};return i.on("SIGINT",c),i.on("SIGTERM",d),i.on("SIGHUP",p),i.on("uncaughtException",f),i.on("unhandledRejection",u),()=>{i.off("SIGINT",c),i.off("SIGTERM",d),i.off("SIGHUP",p),i.off("uncaughtException",f),i.off("unhandledRejection",u)}}const R={matches:e=>e instanceof Error&&"Worker creator already registered"===e.message,message:"Next.js kept its Turbopack worker pool from before the restart ('Worker creator already registered')"};const M=["--","c","config","base","l","logLevel","clearScreen","configLoader","profile","d","debug","f","filter","m","mode","force","w","changelog","distZip","distZipDir","distZipFilename","versionManifest","versionFileTemplate","webpack","turbopack"];function V(e){const t={...e};for(const e of M)delete t[e];return"sourcemap"in t&&(t.sourcemap="true"===t.sourcemap||"false"!==t.sourcemap&&t.sourcemap),"watch"in t&&(t.watch=t.watch?{}:void 0),t}const q=["https","open","cors","strictPort","force"];const O=r.cac("pp-dev");function H(e,t,o){const n=[...s.PP_DEV_CONFIG_NAMES,"package.json","next.config.js","next.config.mjs","next.config.ts","vite.config.js","vite.config.mjs","vite.config.ts",".env",".env.local",".env.development",".env.development.local"].map(t=>y.join(e,t)),r=i.watch(n,{ignored:e=>{const t=y.basename(e);return/(^|[\/\\])\../.test(e)&&!t.startsWith(".env")&&!t.startsWith(".pp-dev")&&!t.startsWith(".pp-watch")},persistent:!0,ignoreInitial:!0,followSymlinks:!1});let a=null;return r.on("change",n=>{o(s.colors.blue(`🔧 Config file changed: ${y.relative(e,n)}`)),a&&clearTimeout(a),a=setTimeout(async()=>{try{o(s.colors.yellow("🔄 Restarting dev server due to config change...")),await t()}catch(e){o(s.colors.red(`❌ Failed to restart dev server: ${e?.message}. Stack: ${e?.stack}`))}},500)}),r.on("error",e=>{o(s.colors.red(`❌ Config watcher error: ${e}`))}),{watcher:r}}function U(e){e.watcher&&e.watcher.close()}function z(e){if(!e||"object"!=typeof e||!("message"in e))return!1;const t=String(e.message);return/Turbopack is not supported/i.test(t)||/native bindings are not available/i.test(t)||/Only WebAssembly \(WASM\) bindings were loaded/i.test(t)}async function B(e){const{changelog:t,executionRoot:o,newAssetsPath:n,backupsDirPath:i,changelogDestinationPath:r,logLevel:a}=e;let l;if("string"==typeof t)l=y.resolve(o,t);else{if(!P.existsSync(i))return void s.createLogger(a).warn(s.colors.yellow("backups directory not found, skipping changelog generation"));const e=P.readdirSync(i,{withFileTypes:!0});if(!e.length)return void s.createLogger(a).warn(s.colors.yellow("no backups found, skipping changelog generation"));const t=e.filter(e=>e.isFile()&&e.name.endsWith(".zip"));if(!t.length)return void s.createLogger(a).warn(s.colors.yellow("no ZIP backups found, skipping changelog generation"));const o=t.reduce((e,t)=>P.statSync(y.resolve(i,e.name)).mtimeMs>P.statSync(y.resolve(i,t.name)).mtimeMs?e:t).name;l=y.resolve(i,o)}const c=new $({oldAssetsPath:l,newAssetsPath:n,destinationPath:r});await c.generateChangelog()}let W=global.__pp_dev_profile_session,Z=0;const G=e=>{if(W)return new Promise((t,o)=>{W.post("Profiler.stop",(n,{profile:i})=>{if(n)o(n);else{const o=y.resolve(`./pp-dev-profile-${Z++}.cpuprofile`);P.writeFileSync(o,JSON.stringify(i)),e(s.colors.yellow(`CPU profile written to ${s.colors.white(s.colors.dim(o))}`)),W=void 0,t()}})})},X=e=>{for(const[t,o]of Object.entries(e))Array.isArray(o)&&(e[t]=o[o.length-1])};O.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"),O.command("[root]","start dev server").alias("serve").alias("dev").option("--host [host]","[string] specify hostname").option("--port <port>","[number] specify port").option("--https","[boolean] use TLS + HTTP/2").option("--open [path]","[boolean | string] open browser on startup").option("--cors","[boolean] enable CORS").option("--strictPort","[boolean] exit if specified port is already in use").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle").action(async(e,t)=>{X(t);let o=null,i=null,r=!1;const c=e?y.resolve(process.cwd(),e):process.cwd(),p=s.createLogger(t.logLevel),f=async()=>{if(!r){r=!0;try{o&&(p.info(s.colors.yellow("🛑 Stopping existing dev server...")),await o.close(),o=null);const{clearConfigCache:u,getConfig:g}=await Promise.resolve().then(()=>require("./index-DB5b_ENM.js")).then(e=>e.config);u();const{createServer:h}=await(import("vite")),m=t.mode||"development",v=y.resolve(process.cwd(),e??".");a.loadPPDevEnv(m,v);const w=await l.loadConfigFromFile({mode:m,command:"serve"},t.config,e,t.logLevel);let b=await a.getViteConfig(void 0,{mode:m,root:v});if(w){const{plugins:e,...t}=w.config;b=l.mergeConfig(b,t)}if(o=await h(l.mergeConfig(b,{root:e,base:t.base,mode:t.mode,configFile:t.config,logLevel:t.logLevel,clearScreen:t.clearScreen,optimizeDeps:{force:t.force},server:V(t),customLogger:p},!0)),!o.config.base||"/"===o.config.base)throw new Error('base cannot be equal to "/" or empty string');if(!o.httpServer)throw new Error("HTTP server not available");await o.listen();const P=global.__pp_dev_start_time??!1,S=P?s.colors.dim(`ready in ${s.colors.reset(s.colors.bold(Math.ceil(n.performance.now()-P)))} ms`):"";p.info(`\n ${s.colors.green(`${s.colors.bold("PP-DEV")} v${s.VERSION}`)} ${S}\n`),o.printUrls();const x=await g(v);if(!1!==x.inspector?.enabled){const e=o.resolvedUrls?.local[0],t=e?new URL(e).origin:`http://localhost:${o.config.server.port??5173}`;p.info(`\n ${s.colors.cyan("🔍 Request Inspector")} ${s.colors.dim(t+d.INSPECTOR_PATH)}\n`)}F(o,{print:!0,customShortcuts:[...W?[{key:"p",description:"start/stop the profiler",async action(e){if(W)await G(p.info);else{const e=await import("node:inspector").then(e=>e.default);await new Promise(t=>{W=new e.Session,W.connect(),W.post("Profiler.enable",()=>{W?.post("Profiler.start",()=>{p.info("Profiler started"),t()})})})}}}]:[],{key:"l",description:"proxy re-login",action(e){e.ws.send({type:"custom",event:"redirect",data:{url:`/auth/index/logout?proxyRedirect=${encodeURIComponent("/")}`}})}}]}),i||(i=H(c,f,p.info),p.info(s.colors.blue("🔧 Config file watcher started"))),r=!1}catch(e){r=!1,p.error(s.colors.red(`error when starting dev server:\n${e.stack}`),{error:e}),G(p.info),process.exit(1)}}};A({logger:p,shutdown:async()=>{i&&(U(i),i=null),o&&(await o.close(),o=null),G(p.info)}}),await f()}),O.command("next [root]","start Next.js development server with pp-dev integration").alias("next-serve").alias("next-dev").option("--host [host]","[string] specify hostname; without a value, listen on all addresses").option("--port <port>","[number] specify port",{default:3e3}).option("--https","[boolean] no effect with pp-dev next (deprecated)").option("--open [path]","[boolean | string] no effect with pp-dev next (deprecated)").option("--cors","[boolean] no effect with pp-dev next (deprecated)").option("--strictPort","[boolean] no effect with pp-dev next (deprecated)").option("--force","[boolean] no effect with pp-dev next (deprecated)").option("--webpack","[boolean] use Webpack for Next dev (use when Turbopack/native SWC is unavailable)").option("--turbopack","[boolean] use Turbopack for Next dev when native bindings work").action(async(e,t)=>{X(t);const n=q.filter(e=>void 0!==t[e]);n.length>0&&s.createLogger(t.logLevel).warn(s.colors.yellow(`⚠️ ${n.map(e=>`--${e}`).join(", ")} ${1===n.length?"has":"have"} no effect with pp-dev next and will be removed.`));const{host:i,port:r}=function(e,t){let o="localhost";!0===e||""===e?o="0.0.0.0":"string"==typeof e?o=e:"number"==typeof e&&(o=String(e));const n="number"==typeof t?t:"string"==typeof t?Number.parseInt(t,10):NaN;return{host:o,port:Number.isInteger(n)&&n>=0?n:3e3}}(t.host,t.port);let l=null,p=null,f=null,u=null,g=null,h=!1;const m=new Set,v=s.createLogger(t.logLevel),w=function(e=["uncaughtException"],t=process){const o=e=>t.listeners(e);let n=null,i=null;return{beforeCreate(){n=new Map(e.map(e=>[e,new Set(o(e))]))},afterCreate(){if(!n)return 0;const r=n,s=new Map(e.map(e=>[e,o(e).filter(t=>!r.get(e).has(t))]));let a=0;if(i)for(const[e,o]of i){const n=new Set(s.get(e).map(e=>e.toString()));for(const i of o)n.has(i.toString())&&(t.off(e,i),a+=1)}return i=s,n=null,a}}}(),b=async()=>{l&&"function"==typeof l.close&&await l.close(),l=null},S=async()=>{const e=p;if(e){for(const e of m)e.destroy();m.clear(),await new Promise(t=>{e.close(()=>t())}),p===e&&(p=null)}},x=async()=>{if(!h){h=!0;try{const{next:E,constants:T}=await a.safeNextImport(),{PHASE_DEVELOPMENT_SERVER:L}=T;u?.dispose(),u=null,f&&(await f.close(),f=null),p&&(v.info(s.colors.yellow("🛑 Stopping existing Next.js server...")),await S()),await b();const{clearConfigCache:k}=await Promise.resolve().then(()=>require("./index-DB5b_ENM.js")).then(e=>e.config);k();const{join:D}=await(import("path")),{createServer:F}=await(import("http")),I=await(import("next/dist/server/config.js")),_=I.default.default||I["module.exports"].default||I.default,$=e?D(process.cwd(),e):process.cwd();a.loadPPDevEnv(t.mode||"development",$);const N=await _(L,$);let C=N?.ppDev||{};if(0===Object.keys(C).length)try{const{getConfig:e}=await Promise.resolve().then(()=>require("./index-DB5b_ENM.js")).then(e=>e.config),t=await e($);Object.keys(t).length>0?(C=t,v.info(s.colors.blue("🔧 Loaded pp-dev config from standalone config file"))):v.info(s.colors.yellow("⚠️ No pp-dev config found in Next.js config or standalone file, using defaults"))}catch(e){v.warn(s.colors.yellow(`⚠️ Failed to load standalone pp-dev config, using defaults: ${e instanceof Error?e.message:String(e)}`))}else v.info(s.colors.blue("🔧 Loaded pp-dev config from Next.js config"));const{getPkg:A}=await Promise.resolve().then(()=>require("./index-DB5b_ENM.js")).then(e=>e.config),R=A($).name;s.validatePPDevConfig(C,R);const M=s.normalizePPDevConfig(C,R),{templateName:V}=M,q=M.backendBaseURL,O=M.templateLess,U=M.v7Features,B=M.disableSSLValidation,W=M.enableProxyCache,Z=M.proxyCacheTTL,G=M.personalAccessToken,X=M.miHudLess,J=M.inspectorEnabled,K=M.inspectorMaxMemory,Y=M.inspectorCaptureLimit,Q=M.appId,ee=N?.basePath;let te="";ee?te=ee:(te=O?s.PATH_PAGE_PREFIX:U?s.PATH_TEMPLATE_LOCAL_PREFIX:s.PATH_TEMPLATE_PREFIX,te+=`/${V}`);const oe=function(e){const t="1"===process.env.PP_DEV_NEXT_WEBPACK||"true"===process.env.PP_DEV_NEXT_WEBPACK;if(t&&(e.webpack||e.turbopack))throw new Error("Do not combine PP_DEV_NEXT_WEBPACK with --webpack or --turbopack");if(t)return{webpack:!0};if(e.webpack&&e.turbopack)throw new Error("Use only one of --webpack or --turbopack");return e.webpack?{webpack:!0}:e.turbopack?{turbopack:!0}:{}}(t),ne=async e=>{delete process.env.TURBOPACK,await b();const t={dev:!0,customServer:!0,hostname:i,port:r,dir:$,conf:{...N,basePath:te,assetPrefix:te}};e.webpack?t.webpack=!0:e.turbopack&&(t.turbopack=!0),w.beforeCreate(),l=E(t),await l.prepare(),w.afterCreate()};if(oe.webpack)await ne({webpack:!0});else if(oe.turbopack)try{await ne({turbopack:!0})}catch(e){if(!z(e))throw e;v.warn(s.colors.yellow("⚠ Turbopack is unavailable (native bindings). Falling back to Webpack.")),await ne({webpack:!0})}else try{await ne({})}catch(e){if(!z(e))throw e;v.warn(s.colors.yellow("⚠ Turbopack cannot run (native Next.js bindings unavailable). Falling back to Webpack.")),await ne({webpack:!0})}if(!l)throw new Error("Next.js app failed to initialize");if(te.endsWith("/")||(te+="/"),"/"===te)throw new Error('basePath cannot be equal to "/" or equal to empty string');v.info(s.colors.green("✅ Next.js app prepared successfully")),v.info(s.colors.blue(`🔧 pp-dev plugin configured for template: ${V}`)),v.info(s.colors.blue(`🔧 Base path configured: ${te}`)),q&&(v.info(s.colors.blue(`🌐 Backend URL: ${q}`)),v.info(s.colors.blue(`🆔 Custom App ID: ${Q}`)));const ie=l.getRequestHandler(),re=r,se=i;p=F(async(e,t)=>{try{const o=e.url||"/",n=o.split("?")[0];let i=c.parse(o,!0);if(le.length>0){if(n.startsWith("/_next/")||"/favicon.ico"===n||n.startsWith("/__nextjs_")){if(ce.length>0){let l=0;const d=()=>{if(l>=ce.length)return void r();const o=ce[l];l++,o(e,t,d)};return void d()}return void r()}let s=0;const a=()=>{if(s>=le.length)return void r();const o=le[s];s++,o(e,t,a)};return void a()}async function r(){if(n.startsWith(te))i=c.parse(o,!0);else{if(n===te.replace(/\/$/,"")){const e=o.replace(n,te);return t.writeHead(302,{Location:e}),void t.end()}if(n.startsWith("/_next/")||"/favicon.ico"===n||n.startsWith("/__nextjs_"));else if("/"===n)return t.writeHead(302,{Location:te}),void t.end()}await ie(e,t,i)}r()}catch(p){v.error(`Error handling request: ${p instanceof Error?p.message:String(p)}`,{error:p instanceof Error?p:void 0}),t.statusCode=500,t.end("Internal Server Error")}});let ae=null,le=[],ce=[];if(!1!==J){const e=new d.RequestStore(K);d.registerInspectorRoutes(d.internalServer,e,Y);const t=d.createRequestCaptureMiddleware(e,Y);le.push(t)}const de=(e,t,o)=>{if(e.url?.startsWith("/@api/")||e.url?.startsWith(d.INSPECTOR_PATH)||e.url?.startsWith(d.VARIABLES_EDITOR_PATH)){const o=()=>{};return void d.internalServer(e,t,o)}o()};if(q||!1===J||(ce.push(de),le.push(de)),q){const e=new URL(q).host,t=d.createUserHostGuard();ce.unshift(t),le.unshift(t),q.startsWith("https://")&&(o.EventEmitter.defaultMaxListeners=Math.max(o.EventEmitter.defaultMaxListeners,20));const i={headers:{host:e,referer:q,origin:q.replace(/^(https?:\/\/)([^/]+)(\/.*)?$/i,"$1$2")},appId:Q,templateLess:O,disableSSLValidation:B,v7Features:U,personalAccessToken:G??process.env.MI_ACCESS_TOKEN};ae=new d.MiAPI(q,i);const r=d.initPPRedirect(te,V),c=(e,t,o)=>{r(e,t,o)};ce.push(c),le.push(c);const g=a.createDevPanelAssetMiddleware(te);if(ce.push(g),le.push(g),W){let e=+Z;(!e||Number.isNaN(e)||e<0)&&(e=6e5);const t={devServer:{middlewares:{use:e=>e},config:{logger:console}},ttl:e},o=d.initProxyCache(t),n=(e,t,n)=>{o(e,t,n)};le.push(n),v.info(s.colors.blue(`🔧 Proxy cache middleware added with TTL: ${e}ms`))}const h=new RegExp(`^((${n=te,n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})|/)$`),m=d.initLoadPPData(h,ae,Object.assign({base:te},i,{miHudLess:X})),w=(e,t,o)=>{m(e,t,o)};le.push(w);const b=te.endsWith("/")?te.substring(0,te.length-1):te,S={middlewares:{use:e=>e},config:{logger:console}},x=d.initProxy({devServer:S,baseURL:q,proxyIgnore:["/@vite","/@metricinsights","/@",b,"/_next","/favicon.ico","/__nextjs_","/installHook.js.map"],disableSSLValidation:B,miAPI:ae,templateName:V}),E=(e,t,o)=>{x(e,t,o)};le.push(E),ce.push(de),le.push(de);const L=d.initRewriteResponse(e=>{const t=e.split("?")[0];return t.startsWith(te)&&!t.includes("/_next/")},(t,o)=>{const n=ae.buildPage(t,X),i=a.injectDevPanel(n,te,{backendBaseURL:q,templateLess:O,appId:Q,devPanelPosition:M.devPanelPosition,devPanelHidden:M.devPanelHidden,devPanelAutoHide:M.devPanelAutoHide});return Buffer.from(d.urlReplacer(e,o.headers.host??"",i))}),k=(e,t,o)=>{L(e,t,o)};le.push(k),f=new j;let D=N?.distDir;const F=process.env[s.PP_DEV_NEXT_BUILD_ENV_VAR];process.env[s.PP_DEV_NEXT_BUILD_ENV_VAR]="1";try{const e=await _(T.PHASE_PRODUCTION_BUILD,$);D=e?.distDir??D}catch{}finally{void 0===F?delete process.env[s.PP_DEV_NEXT_BUILD_ENV_VAR]:process.env[s.PP_DEV_NEXT_BUILD_ENV_VAR]=F}const I=(D??"").replace(/\\/g,"/").replace(/\/+$/,"").replace(/\/dev$/,""),C=I&&".next"!==I?I:"out";let A,R="0.0.0";try{const e=JSON.parse(P.readFileSync(y.join($,"package.json"),"utf-8"));R="string"==typeof e.version?e.version:R,A="string"==typeof e.repository?e.repository:e.repository?.url}catch{}const H=new d.DistService(V,{root:$,backupFolder:y.resolve($,M.syncBackupsDir),maxBackups:M.syncMaxBackups,buildTimeoutMs:M.syncBuildTimeoutMs,nextBuild:{projectRoot:$,distDir:C,packageVersion:R,packageRepositoryUrl:A}}),z={ws:f.ws,config:{clientInjectionPlugin:{v7Features:U}}};u=new d.ClientService(z,{distService:H,miAPI:ae}),d.registerVariablesEditorRoutes(d.internalServer,{distService:H,miAPI:ae}),d.registerUserRoutes(d.internalServer,{miAPI:ae}),d.startKeepingUsers({persist:M.persistUsers,miAPI:ae,projectRoot:$,miUrl:q});const J="function"==typeof l?.getUpgradeHandler?l.getUpgradeHandler():null;p.on("upgrade",(e,t,o)=>{f?.handleUpgrade(e,t,o)||(J?J(e,t,o):t.destroy())}),v.info(s.colors.blue(`🔧 ${le.length} pp-dev middlewares initialized`)),v.info(s.colors.blue(`🔧 ${ce.length} essential middlewares for internal routes`)),v.info(s.colors.blue(`🔧 MiAPI initialized for backend: ${q}`)),v.info(s.colors.blue(`🔧 Custom App ID: ${Q}`))}p.listen(re,se,()=>{v.info(s.colors.green(`✅ pp-dev Next.js server running at http://${se}:${re}`)),v.info(s.colors.blue(`📱 Next.js app accessible at http://${se}:${re}${te}`)),!1!==J&&v.info(s.colors.cyan(`🔍 Request Inspector: http://${se}:${re}${d.INSPECTOR_PATH}`)),v.info(s.colors.blue("🔧 Base path handling active")),g||(g=H($,x,v.info),v.info(s.colors.blue("🔧 Config file watcher started"))),p.on("connection",e=>{m.add(e),e.on("close",()=>m.delete(e))})}),h=!1}catch(e){h=!1,v.error(s.colors.red(`❌ Failed to start Next.js server: ${e?.message}. Stack: ${e?.stack}`)),e instanceof Error&&e.message.includes("Next.js is required")&&(v.error(s.colors.red("❌ Next.js Peer Dependency Error:")),v.error(s.colors.red(e.message)),v.error(s.colors.yellow("\n💡 To fix this issue:")),v.error(s.colors.blue(" 1. Install Next.js in your project:")),v.error(s.colors.white(" npm install next@^16")),v.error(s.colors.blue(" 2. Or use yarn:")),v.error(s.colors.white(" yarn add next@^16")),v.error(s.colors.blue(" 3. Or use pnpm:")),v.error(s.colors.white(" pnpm add next@^16")),v.error(s.colors.yellow("\n📖 For more information, see:")),v.error(s.colors.blue(" https://nextjs.org/docs/getting-started"))),process.exit(1)}var n}};A({logger:v,knownRejections:[R],shutdown:async()=>{g&&(U(g),g=null),u?.dispose(),u=null,f&&(await f.close(),f=null),await S(),await b()}}),await x()}),O.command("build [root]","build for production").option("--target <target>","[string] transpile target (default: 'modules')").option("--outDir <dir>","[string] output directory (default: dist)").option("--assetsDir <dir>","[string] directory under outDir to place assets in (default: assets)").option("--assetsInlineLimit <number>","[number] static asset base64 inline threshold in bytes (default: 4096)").option("--ssr [entry]","[string] build specified entry for server-side rendering").option("--sourcemap [output]",'[boolean | "inline" | "hidden"] output source maps for build (default: false)').option("--minify [minifier]",'[boolean | "terser" | "esbuild"] enable/disable minification, or specify minifier to use (default: esbuild)').option("--manifest [name]","[boolean | string] emit build manifest json").option("--ssrManifest [name]","[boolean | string] emit ssr manifest json").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle (experimental)").option("--emptyOutDir","[boolean] force empty outDir when it's outside of root").option("-w, --watch","[boolean] rebuilds when modules have changed on disk").option("--changelog [assetsFile]","[boolean | string] generate changelog between assetsFile and current build (default: false)").option("--distZip","[boolean] pack build output into a ZIP archive; use --no-distZip to disable (default: pp-dev config build.zip, or true). Env: PP_DEV_DIST_ZIP").option("--distZipDir <dir>","[string] override the ZIP output directory (default: 'dist-zip'). Env: PP_DEV_DIST_ZIP_DIR").option("--distZipFilename <filename>","[string] override the ZIP output file name (default: '<app-name>.zip'). Env: PP_DEV_DIST_ZIP_FILENAME").option("--versionManifest","[boolean] emit VERSION-*.json + BUILD-MANIFEST.json; use --no-versionManifest to disable (default: pp-dev config build.versionFile, or true). Env: PP_DEV_VERSION_MANIFEST").option("--versionFileTemplate <template>","[string] override the VERSION file name template (default: 'VERSION-v{packageversion}-{currentDate}.json'). Env: PP_DEV_VERSION_FILE_TEMPLATE").action(async(e,t)=>{X(t);const o=V(t),n=a.resolveBuildCliOverrides(t);try{const i=t.mode||"production",r=y.resolve(process.cwd(),e??".");a.loadPPDevEnv(i,r);const s=await l.loadConfigFromFile({mode:i,command:"build"},t.config,e,t.logLevel);let c=await a.getViteConfig(n,{mode:i,root:r});if(s){const{plugins:e,...t}=s.config;c=l.mergeConfig(c,t)}const d=l.mergeConfig(c,{root:e,base:t.base,mode:t.mode,configFile:t.config,logLevel:t.logLevel,clearScreen:t.clearScreen,optimizeDeps:{force:t.force},build:o},!0);if(await l.build(d),t.changelog){const o=e||process.cwd(),n=d.build?.outDir||"dist";let i="dist-zip";d.ppDevConfig&&(!1===d.ppDevConfig.distZip?i=n:"object"==typeof d.ppDevConfig.distZip&&"string"==typeof d.ppDevConfig.distZip.outDir&&(i=d.ppDevConfig.distZip.outDir)),await B({changelog:t.changelog,executionRoot:o,newAssetsPath:y.resolve(o,n),backupsDirPath:y.resolve(o,d.ppDevConfig?.syncBackupsDir||"backups"),changelogDestinationPath:y.resolve(o,i),logLevel:t.logLevel})}}catch(e){s.createLogger(t.logLevel).error(s.colors.red(`error during build:\n${e.stack}`),{error:e}),process.exit(1)}finally{G(e=>s.createLogger(t.logLevel).info(e))}}),O.command("next-build [root]","build a Next.js app for production (`next build`) and emit VERSION/BUILD-MANIFEST/zip in the same format as `pp-dev build`").option("--changelog [assetsFile]","[boolean | string] generate changelog between assetsFile and current build (default: false)").option("--distZip","[boolean] pack build output into a ZIP archive; use --no-distZip to disable (default: pp-dev config build.zip, or true). Env: PP_DEV_DIST_ZIP").option("--distZipDir <dir>","[string] override the ZIP output directory (default: 'dist-zip'). Env: PP_DEV_DIST_ZIP_DIR").option("--distZipFilename <filename>","[string] override the ZIP output file name (default: '<app-name>.zip'). Env: PP_DEV_DIST_ZIP_FILENAME").option("--versionManifest","[boolean] emit VERSION-*.json + BUILD-MANIFEST.json; use --no-versionManifest to disable (default: pp-dev config build.versionFile, or true). Env: PP_DEV_VERSION_MANIFEST").option("--versionFileTemplate <template>","[string] override the VERSION file name template (default: 'VERSION-v{packageversion}-{currentDate}.json'). Env: PP_DEV_VERSION_FILE_TEMPLATE").action(async(e,t)=>{X(t);const o=s.createLogger(t.logLevel),n=e?y.resolve(process.cwd(),e):process.cwd(),i=a.resolveBuildCliOverrides(t);process.env[s.PP_DEV_NEXT_BUILD_ENV_VAR]="1";try{a.loadPPDevEnv(t.mode||"production",n);const{constants:e}=await a.safeNextImport(),r=await(import("next/dist/server/config.js")),l=r.default.default||r["module.exports"].default||r.default,c=await l(e.PHASE_PRODUCTION_BUILD,n);let p=c?.ppDev||{};if(0===Object.keys(p).length){const{getConfig:e}=await Promise.resolve().then(()=>require("./index-DB5b_ENM.js")).then(e=>e.config);p=await e(n)}const{getPkg:f}=await Promise.resolve().then(()=>require("./index-DB5b_ENM.js")).then(e=>e.config),u=s.normalizePPDevConfig(p,f(n).name),g=a.applyDistZipOverride(u.distZip,i,s.createDefaultZipFileName(u.templateName)),h=a.applyVersionManifestOverride(u.versionPlugin,i),m=d.removeStaleDevTypes(n,c);m&&o.info(s.colors.dim(`[pp-dev] Removed stale dev route types: ${y.relative(n,m)}`)),o.info(s.colors.cyan("[pp-dev] Running `next build`...")),await d.runNextBuildProcess(n);const w="string"==typeof c?.distDir&&c.distDir?c.distDir:".next",b=".next"===w?"out":w,S=y.resolve(n,b);if(!P.existsSync(S)||!P.statSync(S).isDirectory())throw new Error(`Next.js build output directory not found: ${S}. "next-build" requires "output: 'export'" in next.config (static export).`);const x=JSON.parse(P.readFileSync(y.join(n,"package.json"),"utf-8"));if(!1!==h&&!1!==h.enabled&&(await v.writeBuildVersionManifest({outDir:S,packageVersion:"string"==typeof x.version?x.version:"0.0.0",versionFileTemplate:h.versionFileTemplate,packageRepositoryUrl:"string"==typeof x.repository?x.repository:x.repository?.url,enabled:h.enabled}),o.info(s.colors.green(`✅ VERSION / BUILD-MANIFEST written to ${y.relative(n,S)}`))),!1!==g){const e=y.resolve(n,g.outDir),t=g.inDir?y.resolve(S,g.inDir):S,i=s.resolveOutputFilePath(e,g.outFileName,"ZIP output file name");P.mkdirSync(y.dirname(i),{recursive:!0});const r=await d.zipDirectoryToBuffer(t);P.writeFileSync(i,r),o.info(s.colors.green(`✅ Zip archive written to ${y.relative(n,i)}`))}if(t.changelog){const e=!1!==g?g.outDir:b;await B({changelog:t.changelog,executionRoot:n,newAssetsPath:S,backupsDirPath:y.resolve(n,u.syncBackupsDir),changelogDestinationPath:y.resolve(n,e),logLevel:t.logLevel})}}catch(e){s.createLogger(t.logLevel).error(s.colors.red(`error during next-build:\n${e.stack}`),{error:e}),process.exit(1)}finally{G(e=>s.createLogger(t.logLevel).info(e))}}),O.command("changelog [oldAssetPath] [newAssetPath]","generate changelog between two assets files/folders").option("--oldAssetsPath <oldAssetsPath>","[string] path to the old assets zip file or folder").option("--newAssetsPath <newAssetsPath>","[string] path to the new assets zip file or folder").option("--destination <destination>","[string] destination folder for the changelog (default: .)").option("--filename <filename>","[string] filename for the changelog (default: CHANGELOG.html)").action(async(e,t,o)=>{X(o);const{oldAssetsPath:n=e,newAssetsPath:i=t,destination:r=".",filename:a="CHANGELOG.html",logLevel:l}=o,c=process.cwd();n&&i||(s.createLogger(l).error(s.colors.red("error during changelog generation: oldAssetPath and newAssetPath are required")),process.exit(1));const d=y.resolve(c,n),p=y.resolve(c,i),f=y.resolve(c,r),u=new $({oldAssetsPath:d,newAssetsPath:p,destinationPath:f,changelogFilename:a});await u.generateChangelog()}),O.command("generate-icon-font [source] [destination]","generate icon font from SVG files").option("--source <source>","[string] path to the source directory with SVG files").option("--destination <destination>","[string] path to the destination directory to save the generated font files").option("--font-name, -n <fontName>","[string] name of the font to generate (default: 'icon-font')").action(async(e,t,o)=>{X(o);const{source:n=e,destination:i=t,fontName:r="icon-font"}=o,a=process.cwd(),l=y.resolve(a,n),c=y.resolve(a,i),d=new N({sourceDir:l,outputDir:c,fontName:r}),p=s.createLogger(o.logLevel);p.info(`Generating icon font from SVG files in ${s.colors.dim(l)}`),await d.generate(),p.info(`Icon font generated and saved to ${s.colors.dim(c)}`)}),O.command("optimize [root]","pre-bundle dependencies").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle").action(async(e,t)=>{X(t);try{const o=t.mode||"production",n=y.resolve(process.cwd(),e??".");a.loadPPDevEnv(o,n);const i=await l.loadConfigFromFile({mode:o,command:"build"},t.config,e,t.logLevel);let r=await a.getViteConfig(void 0,{mode:o,root:n});if(i){const{plugins:e,...t}=i.config;r=l.mergeConfig(r,t)}const s=await l.resolveConfig(l.mergeConfig(r,{root:e,base:t.base,configFile:t.config,logLevel:t.logLevel,mode:t.mode}),"serve");await l.optimizeDeps(s,t.force,!0)}catch(e){s.createLogger(t.logLevel).error(s.colors.red(`error when optimizing deps:\n${e.stack}`),{error:e}),process.exit(1)}}),O.command("preview [root]","locally preview production build").option("--host [host]","[string] specify hostname").option("--port <port>","[number] specify port").option("--strictPort","[boolean] exit if specified port is already in use").option("--https","[boolean] use TLS + HTTP/2").option("--open [path]","[boolean | string] open browser on startup").option("--outDir <dir>","[string] output directory (default: dist)").action(async(e,t)=>{X(t);try{const o=t.mode||"production",n=y.resolve(process.cwd(),e??".");a.loadPPDevEnv(o,n);const i=await l.loadConfigFromFile({mode:o,command:"build"},t.config,e,t.logLevel);let r=await a.getViteConfig(void 0,{mode:o,root:n});if(i){const{plugins:e,...t}=i.config;r=l.mergeConfig(r,t)}(await l.preview(l.mergeConfig(r,{root:e,base:t.base,configFile:t.config,logLevel:t.logLevel,mode:t.mode,build:{outDir:t.outDir},preview:{port:t.port,strictPort:t.strictPort,host:t.host,https:t.https,open:t.open}}))).printUrls()}catch(e){s.createLogger(t.logLevel).error(s.colors.red(`error when starting preview server:\n${e.stack}`),{error:e}),process.exit(1)}finally{G(e=>s.createLogger(t.logLevel).info(e))}}),O.command("migrate [config]","migrate pp-dev config from 0.x flat format to 1.0 grouped format").option("--dry-run","[boolean] print migrated config without writing any files").option("--format <format>","[string] output format: ts (default), js, json").option("--output <file>","[string] output file path (default: pp-dev.config.ts)").option("--no-backup","[boolean] skip backup of original config file").action(async(e,t)=>{const o=s.createLogger(t.logLevel),{isLegacyFlatConfig:n,isLegacyPPWatchConfig:i,isAlreadyMigrated:r,migrateLegacyFlatConfig:a,migratePPWatchConfig:l,generateConfigFileContent:c,discoverMigrateSource:d,loadPackageJsonMigrateConfig:p}=await Promise.resolve().then(()=>require("./migrate-CelZGq8b.js")),f=t.format??"ts",u=!1!==t.backup,g=process.cwd(),h=d(g,e);h||(o.warn(s.colors.yellow("No pp-dev or pp-watch config file found in the current directory.")),o.info(s.colors.blue('Supported files: pp-dev.config.{ts,js,cjs,mjs,json}, .pp-watch.config.{ts,js,json}, or a "pp-dev" field in package.json')),process.exit(1));const{sourceFile:m,isWatchConfig:v,isPackageJsonConfig:w}=h;o.info(s.colors.blue(`Found config: ${y.relative(g,m)}`));const{getPkg:b}=await Promise.resolve().then(()=>require("./index-DB5b_ENM.js")).then(e=>e.config),S=b();let x,E={};try{if(/\.[cm]?ts$/i.test(m)){const e=await(import("esbuild")),{pathToFileURL:t}=await(import("url")),o=(await e.build({absWorkingDir:g,entryPoints:[m],outfile:"out.js",write:!1,target:"node24",platform:"node",bundle:!0,packages:"external",format:"esm",mainFields:["main"]})).outputFiles[0].text,n=`pp-migrate-tmp-${Date.now()}.mjs`;P.writeFileSync(n,o);try{const e=await(import(t(y.resolve(g,n)).toString()));E=e.default?.default??e.default??e}finally{P.existsSync(n)&&P.unlinkSync(n)}}else if(/\.[cm]?js$/i.test(m)){const{pathToFileURL:e}=await(import("url")),t=await(import(e(y.resolve(g,m)).toString()));E=t.default?.default??t.default??t}else w?E=p(m):m.endsWith(".json")&&(E=JSON.parse(P.readFileSync(m,"utf-8")))}catch(e){o.error(s.colors.red(`Failed to load config file: ${e.message}`)),process.exit(1)}E&&"object"==typeof E||(o.error(s.colors.red("Config file did not export a valid object.")),process.exit(1)),r(E)?(o.info(s.colors.green("Config is already in 1.0 format — nothing to migrate.")),process.exit(0)):v||i(E)?(o.info(s.colors.blue("Detected pp-watch config format → migrating to 1.0")),x=l(E)):n(E)?(o.info(s.colors.blue("Detected 0.x flat config format → migrating to 1.0")),x=a(E,S.name)):(o.warn(s.colors.yellow("Could not detect config format. No known keys found.")),process.exit(1));const T=c(x,f),L=t.output??y.join(g,`pp-dev.config.${f}`);if(t.dryRun&&(o.info(s.colors.green(`\n--- Migrated config (dry-run) → ${y.relative(g,L)} ---\n`)),process.exit(0)),u&&!w&&P.existsSync(m)){const e=`${m}.bak`;P.copyFileSync(m,e),o.info(s.colors.blue(`Backed up original to: ${y.relative(g,e)}`))}P.writeFileSync(L,T,"utf-8"),o.info(s.colors.green(`✅ Migration complete → ${y.relative(g,L)}`)),w?o.info(s.colors.yellow('You can now remove the "pp-dev" field from package.json.')):m!==L&&P.existsSync(m)&&o.info(s.colors.yellow(`You can now delete the old config: ${y.relative(g,m)}`))}),O.help(),O.version(s.VERSION),O.parse(),exports.stopProfiler=G;
|
|
1
|
+
"use strict";const e=require("path"),t=require("fs"),o=require("node:events"),n=require("node:perf_hooks"),i=require("chokidar"),r=require("cac"),s=require("./auth.provider-CejYwjcG.js"),a=require("./index-Cev20Ede.js"),l=require("vite"),c=require("url"),d=require("./variables-editor-DW2WJZHw.js"),p=require("dir-compare"),f=require("diff-match-patch"),u=require("isbinaryfile"),g=require("os"),h=require("crypto"),m=require("ws"),v=require("./version-manifest-DjLJQWWa.js");require("picocolors"),require("node:path"),require("child_process"),require("node:module"),require("./helpers.js"),require("ejs"),require("zlib"),require("axios"),require("node:http"),require("node:https"),require("http-proxy-middleware"),require("node:string_decoder"),require("node:crypto"),require("node:fs"),require("node:os"),require("express"),require("process"),require("jszip"),require("module"),require("fs/promises"),require("util");const w=e=>e&&"object"==typeof e&&"default"in e?e.default:e;function b(e){if(e&&"object"==typeof e&&"default"in e)return e;const t=Object.create(null);if(e)for(const o in e)t[o]=e[o];return t.default=e,Object.freeze(t)}const y=b(e),P=b(t),S=b(p),x=w(f),E=b(g),T=b(h);function L(e){return null!=e&&!1!==e}let k=null;const D=new WeakMap;function F(e,t){if(!e.httpServer||!process.stdin.isTTY||process.env.CI)return;D.set(e,t);const o=s.createLogger();t.print&&o.info(s.colors.dim(s.colors.green(" ➜"))+s.colors.dim(" press ")+s.colors.bold("h")+s.colors.dim(" to show help"));const n=(t.customShortcuts??[]).filter(L).concat(I);k?.(),k=null;let i=!1;const r=process.stdin.isPaused(),a=process.stdin,l=Boolean(a.isRaw),c=async t=>{if(""===t)return void function(e=process){"win32"===e.platform?e.emit("SIGINT","SIGINT"):e.kill(e.pid,"SIGINT")}();if(""===t)return void await e.close().finally(()=>process.exit(0));if(i)return;"h"===t&&o.info(["",s.colors.bold(" Shortcuts"),...n.map(e=>s.colors.dim(" press ")+s.colors.bold(e.key)+s.colors.dim(` to ${e.description}`))].join("\n"));const r=n.find(e=>e.key===t);r&&(i=!0,await r.action(e),i=!1)};process.stdin.setRawMode(!0),process.stdin.on("data",c).setEncoding("utf8").resume();const d=e.httpServer,p=()=>{k===p&&(d.removeListener("close",p),process.stdin.off("data",c),l||process.stdin.setRawMode(!1),r&&process.stdin.pause(),k=null)};k=p,d.on("close",p)}const I=[{key:"r",description:"restart the server",async action(e){const t=D.get(e);await e.restart(),t&&F(e,{...t,print:!1})}},{key:"u",description:"show server url",action(e){e.config.logger.info(""),e.printUrls()}},{key:"o",description:"open in browser",action(e){e.openBrowser()}},{key:"c",description:"clear console",action(e){e.config.logger.clearScreen("error")}},{key:"q",description:"quit",async action(e){await e.close().finally(()=>process.exit())}},{key:"C",description:"clear proxy cache",action(e){e.cache&&(e.cache.clear(),e.config.logger.info("Proxy cache cleared"))}}];const _=/(.+)(-[a-f0-9]{6,20})(\.[a-z0-9]+)$/i;class ${oldAssetsPath;newAssetsPath;destinationPath;changelogFilename;changelogTemplate='<!DOCTYPE html>\n <html lang="en">\n <head>\n <meta charset="UTF-8" />\n <title>Changelog Diff</title>\n <style>\n tr,\n td {\n padding: 0;\n }\n .diff-file {\n margin-top: 20px;\n border: 1px solid #e1e4e8;\n border-radius: 6px;\n }\n .diff-file-title {\n padding: 10px 20px;\n background-color: #f6f8fa;\n border-bottom: 1px solid #e1e4e8;\n border-radius: 6px 6px 0 0;\n font-weight: bold;\n }\n .diff-file-title .renamed {\n font-weight: normal;\n }\n .diff-file-title .renamed .from {\n color: #cb2431;\n }\n .diff-file-title .renamed .to {\n color: #22863a;\n }\n .diff-file-title .added {\n color: #22863a;\n }\n .diff-file-title .deleted {\n color: #cb2431;\n }\n .diff-file-content {\n }\n .diff-table {\n tab-size: 8;\n width: 100%;\n border-collapse: separate;\n border-spacing: 0;\n }\n .blob-num {\n position: relative;\n color: #1f2328;\n width: 1%;\n min-width: 50px;\n padding: 0 10px;\n font-family:\n ui-monospace,\n SFMono-Regular,\n SF Mono,\n Menlo,\n Consolas,\n Liberation Mono,\n monospace;\n font-size: 12px;\n line-height: 20px;\n text-align: right;\n white-space: nowrap;\n vertical-align: top;\n cursor: pointer;\n -webkit-user-select: none;\n user-select: none;\n }\n .blob-num.addition {\n background-color: #ccffd8;\n border-color: #1f883e;\n }\n .blob-num.deletion {\n background-color: #ffd7d5;\n border-color: #cf222e;\n }\n .blob-num::before {\n content: attr(data-line-number);\n }\n .blob-code {\n position: relative;\n padding: 0 10px 0 22px;\n vertical-align: top;\n color: #1f2329;\n }\n .blob-code.code-addition {\n background-color: #e6ffec;\n }\n .blob-code.code-deletion {\n background-color: #ffebe9;\n }\n .blob-code.skip,\n .blob-code.message {\n text-align: center;\n }\n .blob-code.skip .blob-code-inner,\n .blob-code.message .blob-code-inner {\n font-weight: bold;\n color: #6a737d;\n padding: 10px 0;\n }\n .blob-code-inner {\n display: table-cell;\n overflow: visible;\n font-family:\n ui-monospace,\n SFMono-Regular,\n SF Mono,\n Menlo,\n Consolas,\n Liberation Mono,\n monospace;\n font-size: 12px;\n word-wrap: anywhere;\n white-space: pre-wrap;\n }\n .blob-code-inner::before {\n content: attr(data-code-prefix);\n position: absolute;\n top: 1px;\n left: 8px;\n padding-right: 8px;\n }\n </style>\n </head>\n <body>\n <h1>Changelog Diff</h1>\n\n %FILES%\n </body>\n </html>';diffFileTemplateHandler;diffLineTemplateHandler;contextLines=3;logger;constructor(e){const{oldAssetsPath:t,newAssetsPath:o,destinationPath:n,changelogTemplate:i,diffFileTemplateHandler:r,diffLineTemplateHandler:a,changelogFilename:l,contextLines:c}=e;if(this.logger=s.createLogger(),!t||!o||!n)throw new Error("Previous assets path, current assets path and destination path are required");if(t===o)throw new Error("Previous and current assets paths must be different");if(!this.isExists(t))throw new Error(`Previous assets path ${t} does not exist`);if(!this.isExists(o))throw new Error(`Current assets path ${o} does not exist`);if(this.isZipFile(t)){const e=y.resolve(E.tmpdir(),T.createHash("md5").update(t).digest("hex"));this.oldAssetsPath=this.unzipFile(t,e).then(()=>this.normalizeAssetFolderPath(e)).then(e=>{if(this.isEmptyFolder(e))throw new Error(`Previous assets path ${e} is empty`);return e})}else{if(!this.isFolder(t))throw new Error(`Invalid previous assets path ${t}. It must be a folder or a zip file`);{const e=this.normalizeAssetFolderPath(t);if(this.isEmptyFolder(e))throw new Error(`Previous assets path ${e} is empty`);this.oldAssetsPath=Promise.resolve(e)}}if(this.isZipFile(o)){const e=y.resolve(E.tmpdir(),T.createHash("md5").update(o).digest("hex"));this.newAssetsPath=this.unzipFile(o,e).then(()=>this.normalizeAssetFolderPath(e)).then(e=>{if(this.isEmptyFolder(e))throw new Error(`Current assets path ${e} is empty`);return e})}else{if(!this.isFolder(o))throw new Error(`Invalid current assets path ${o}. It must be a folder or a zip file`);{const e=this.normalizeAssetFolderPath(o);if(this.isEmptyFolder(e))throw new Error(`Current assets path ${o} is empty`);this.newAssetsPath=Promise.resolve(e)}}this.destinationPath=n,this.mkdirpSync(this.destinationPath),this.changelogFilename=l||"CHANGELOG.html",i&&(this.templateIsValid(i)?this.changelogTemplate=i:this.logger.warn(s.colors.yellow("Invalid changelog template, using default"))),"function"==typeof r&&(this.diffFileTemplateHandler=r),"function"==typeof a&&(this.diffLineTemplateHandler=a),c&&(this.contextLines=c)}templateIsValid(e){return e.includes("%FILES%")}isExists(e){return P.existsSync(e)}isZipFile(e){return e.endsWith(".zip")}isFolder(e){return P.lstatSync(e).isDirectory()}isEmptyFolder(e){return 0===P.readdirSync(e,{withFileTypes:!0}).length}mkdirpSync(e){P.existsSync(e)||P.mkdirSync(e,{recursive:!0})}async unzipFile(e,t){P.rmSync(t,{force:!0,recursive:!0}),await d.extractZipSafe(e,t)}normalizeAssetFolderPath(e){const t=P.readdirSync(e);return 1===t.length&&P.lstatSync(y.join(e,t[0])).isDirectory()?this.normalizeAssetFolderPath(y.join(e,t[0])):e}pathToPosix(e){return e.replace(/\\/g,"/")}diffTableTemplate(e){return`<table class="diff-table">\n <tbody>\n ${e}\n </tbody>\n </table>`}getDiffTableHTML(e){const t=e.filter((e,t,o)=>0!==e.lineType||(t>=0&&t<this.contextLines||t>o.length-(this.contextLines+1)&&t<=o.length-1||o.slice(t-this.contextLines,t+this.contextLines+1).some(e=>0!==e.lineType))).map((e,t,o)=>{if(t>0){const n=o[t-1];if(e.lineNumber-n.lineNumber>1)return[{lineNumber:-1,lineContent:"",lineType:0},e]}return[e]}).flat().map(e=>this.diffLineHTML(e)).join("");return this.diffTableTemplate(t)}diffLineMessageTemplate(e){return`<tr>\n <td class="blob-num"></td>\n <td class="blob-num"></td>\n <td class="blob-code message">\n <span class="blob-code-inner">${e}</span>\n </td>\n </tr>`}diffLineSkipTemplate(){return'<tr>\n <td class="blob-num"></td>\n <td class="blob-num"></td>\n <td class="blob-code skip">\n <span class="blob-code-inner">Skip</span>\n </td>\n </tr>'}diffLineTemplate(e){const{lineNumber:t,lineContent:o,lineType:n}=e,i=1===n?"addition":-1===n?"deletion":"";return`<tr>\n <td\n class="blob-num ${i}${"addition"===i?" empty":""}"\n ${"addition"!==i?` data-line-number="${t}"`:""}\n ></td>\n <td\n class="blob-num ${i}${"deletion"===i?" empty":""}"\n ${"deletion"!==i?` data-line-number="${t}"`:""}\n ></td>\n <td class="blob-code ${1===n?"code-addition":-1===n?"code-deletion":""}">\n <span class="blob-code-inner" data-code-prefix="${1===n?"+":-1===n?"-":" "}">${r=o??"",r.replace(/[\u00A0-\u9999<>&]/g,e=>"&#"+e.charCodeAt(0)+";")}</span>\n </td>\n </tr>`;var r}diffLineHTML(e){if(this.diffLineTemplateHandler)return this.diffLineTemplateHandler(e);const{lineNumber:t}=e;return-1===t?this.diffLineSkipTemplate():this.diffLineTemplate(e)}diffFileTemplate(e,t){return this.diffFileTemplateHandler?this.diffFileTemplateHandler(e,t):`<div class="diff-file">\n <div class="diff-file-title">${e}</div>\n <div class="diff-file-content">${t}</div>\n </div>`}async generateAssetFoldersDiff(){this.logger.info(s.colors.blue(`Comparing asset folders ${await this.oldAssetsPath} and ${await this.newAssetsPath}`));const e=await S.compare(await this.oldAssetsPath,await this.newAssetsPath,{compareContent:!0,skipSymlinks:!0,compareSize:!0,compareDate:!1,compareNameHandler:(e,t)=>(_.test(e)&&(e=e.replace(_,"$1$3")),_.test(t)&&(t=t.replace(_,"$1$3")),0===e.localeCompare(t)?0:e.localeCompare(t)>0?1:-1)});return e.diffSet?.filter(e=>"equal"!==e.state||e.name1!==e.name2)||[]}async generateAssetFilesDiff(e,t){const o=new x,n=o.diff_linesToChars_(e,t),i=o.diff_main(n.chars1,n.chars2,!1);o.diff_charsToLines_(i,n.lineArray);let r=0;return i.map(e=>{const[t,o]=e,n=o.endsWith("\n")?o.split("\n").length-1:o.split("\n").length,i=o.split("\n").map((e,o)=>({lineContent:e,lineNumber:r+o+1,lineType:t})).slice(0,n);return-1!==t&&(r+=n),i}).flat()}async generateFilesDiff(e){if("equal"===e.state){const t=this.pathToPosix(y.join(".",e.relativePath,e.name1??"")),o=this.pathToPosix(y.join(".",e.relativePath,e.name2??""));return this.diffFileTemplate(`<span class="renamed"\n >Renamed <span class="from">${t}</span> -> <span class="to">${o}</span></span\n >`,this.diffTableTemplate(this.diffLineMessageTemplate("No changes")))}const t=e.path1&&e.name1?y.join(e.path1,e.name1):null,o=e.path2&&e.name2?y.join(e.path2,e.name2):null,n=this.pathToPosix(y.join(".",e.relativePath,(e.name1||e.name2)??""));if("left"===e.state&&t)return this.diffFileTemplate(`<span class="removed">Removed ${n}</span>`,this.diffTableTemplate(this.diffLineMessageTemplate("File removed")));if("right"===e.state&&o)return this.diffFileTemplate(`<span class="added">Added ${n}</span>`,this.diffTableTemplate(this.diffLineMessageTemplate("File added")));if("distinct"===e.state&&t&&o){const i=this.pathToPosix(y.join(".",e.relativePath,e.name1??"")),r=this.pathToPosix(y.join(".",e.relativePath,e.name2??"")),s=e.name1!==e.name2?`<span class="renamed"\n >Renamed <span class="from">${i}</span> -> <span class="to">${r}</span></span\n >`:n;return this.diffFileTemplate(s,await u.isBinaryFile(t)||await u.isBinaryFile(o)?this.diffTableTemplate(this.diffLineMessageTemplate("Binary file")):this.getDiffTableHTML(await this.generateAssetFilesDiff(P.readFileSync(t,"utf-8"),P.readFileSync(o,"utf-8"))))}return""}async generateChangelog(){this.logger.info(s.colors.green("Generating changelog"));const e=await this.generateAssetFoldersDiff(),t=(await Promise.all(e.map(e=>this.generateFilesDiff(e)))).join("");this.logger.info(s.colors.green("Writing changelog file"));const o=this.changelogTemplate.split("%FILES%");o.splice(1,0,t);const n=o.join("");P.writeFileSync(y.join(this.destinationPath,this.changelogFilename),n),this.logger.info(s.colors.green(`Changelog file written to ${y.join(this.destinationPath,this.changelogFilename)}`))}}class N{sourceDir;outputDir;fontName;constructor(e){this.sourceDir=e.sourceDir,this.outputDir=e.outputDir,this.fontName=e.fontName}async generate(){const{default:e}=await(import("svgtofont"));await e({src:this.sourceDir,dist:this.outputDir,fontName:this.fontName,css:!0,typescript:!0,startUnicode:59905,svgicons2svgfont:{fontHeight:1024}})}}class j{wss;eventListeners=new Map;lifecycleListeners=new Map;clients=new Map;ws;constructor(){this.wss=new m.WebSocketServer({noServer:!0}),this.wss.on("connection",e=>this.onConnection(e)),this.wss.on("error",e=>this.fireLifecycle("error",e)),this.ws={on:(e,t)=>{"close"!==e&&"error"!==e?this.getEventSet(e).add(t):this.getLifecycleSet(e).add(t)},off:(e,t)=>{this.eventListeners.get(e)?.delete(t),"close"!==e&&"error"!==e||this.lifecycleListeners.get(e)?.delete(t)},send:(e,t)=>{if("string"==typeof e)for(const o of this.clients.keys())this.sendToSocket(o,e,t);else{const t=JSON.stringify(e);for(const e of this.clients.keys())e.readyState===m.WebSocket.OPEN&&e.send(t)}}}}handleUpgrade(e,t,o){if((e.url??"").split("?")[0]!==d.PP_DEV_HMR_WS_PATH)return!1;return d.crossOriginReason(e)?(t.once("error",()=>t.destroy()),t.end("HTTP/1.1 403 Forbidden\r\nConnection: close\r\nContent-Length: 0\r\n\r\n",()=>t.destroy()),!0):(this.wss.handleUpgrade(e,t,o,t=>{this.wss.emit("connection",t,e)}),!0)}async close(){this.fireLifecycle("close");for(const e of this.clients.keys())e.terminate();this.clients.clear(),await new Promise(e=>this.wss.close(()=>e()))}onConnection(e){const t={send:(t,o)=>this.sendToSocket(e,t,o),socket:e};this.clients.set(e,t),e.on("message",e=>this.onMessage(t,e)),e.on("close",()=>this.clients.delete(e)),e.on("error",()=>{})}onMessage(e,t){let o;try{o=JSON.parse(t.toString())}catch{return}if(!o||"custom"!==o.type||"string"!=typeof o.event)return;const n=this.eventListeners.get(o.event);if(n)for(const t of n)try{t(o.data,e)}catch(e){s.createLogger().error(`ws handler for "${o.event}" failed`,{error:e instanceof Error?e:new Error(String(e))})}}sendToSocket(e,t,o){e.readyState===m.WebSocket.OPEN&&e.send(JSON.stringify({type:"custom",event:t,data:o}))}fireLifecycle(e,t){for(const o of this.lifecycleListeners.get(e)??[])try{o(t)}catch{}}getEventSet(e){let t=this.eventListeners.get(e);return t||(t=new Set,this.eventListeners.set(e,t)),t}getLifecycleSet(e){let t=this.lifecycleListeners.get(e);return t||(t=new Set,this.lifecycleListeners.set(e,t)),t}}function C(e){return e instanceof Error?e.stack??e.message:String(e)}function A({logger:e,knownRejections:t=[],shutdown:o,shutdownTimeoutMs:n=5e3,processRef:i=process}){let r=!1,a=0;const l=async(t,l)=>{if((e=>{a=Math.max(a,e)})(l),r)return void("SIGINT"!==t&&"SIGTERM"!==t&&"SIGHUP"!==t||(e.warn(s.colors.yellow(`\n⚠️ Received ${t} again, exiting without waiting for the shutdown`)),i.exit(a)));r=!0,e.info(s.colors.yellow(`\n🛑 Received ${t}, shutting down gracefully...`));const c=setTimeout(()=>{e.error(s.colors.red(`⏰ Shutdown did not finish within ${n} ms, forcing exit`)),i.exit(1)},n);try{await o(),clearTimeout(c),e.info(s.colors.green("✅ Graceful shutdown completed")),i.exit(a)}catch(t){clearTimeout(c),e.error(s.colors.red(`❌ Error during graceful shutdown: ${C(t)}`)),i.exit(1)}},c=()=>{l("SIGINT",0)},d=()=>{l("SIGTERM",0)},p=()=>{l("SIGHUP",0)},f=t=>{e.error(s.colors.red(`❌ Uncaught exception: ${C(t)}`)),l("uncaughtException",1)},u=o=>{const n=t.find(e=>e.matches(o));n?e.info(s.colors.dim(n.message)):e.error(s.colors.red(`❌ Unhandled promise rejection (the server keeps running): ${C(o)}`))};return i.on("SIGINT",c),i.on("SIGTERM",d),i.on("SIGHUP",p),i.on("uncaughtException",f),i.on("unhandledRejection",u),()=>{i.off("SIGINT",c),i.off("SIGTERM",d),i.off("SIGHUP",p),i.off("uncaughtException",f),i.off("unhandledRejection",u)}}const R={matches:e=>e instanceof Error&&"Worker creator already registered"===e.message,message:"Next.js kept its Turbopack worker pool from before the restart ('Worker creator already registered')"};const M=["--","c","config","base","l","logLevel","clearScreen","configLoader","profile","d","debug","f","filter","m","mode","force","w","changelog","distZip","distZipDir","distZipFilename","versionManifest","versionFileTemplate","webpack","turbopack"];function V(e){const t={...e};for(const e of M)delete t[e];return"sourcemap"in t&&(t.sourcemap="true"===t.sourcemap||"false"!==t.sourcemap&&t.sourcemap),"watch"in t&&(t.watch=t.watch?{}:void 0),t}const q=["https","open","cors","strictPort","force"];const O=r.cac("pp-dev");function H(e,t,o){const n=[...s.PP_DEV_CONFIG_NAMES,"package.json","next.config.js","next.config.mjs","next.config.ts","vite.config.js","vite.config.mjs","vite.config.ts",".env",".env.local",".env.development",".env.development.local"].map(t=>y.join(e,t)),r=i.watch(n,{ignored:e=>{const t=y.basename(e);return/(^|[\/\\])\../.test(e)&&!t.startsWith(".env")&&!t.startsWith(".pp-dev")&&!t.startsWith(".pp-watch")},persistent:!0,ignoreInitial:!0,followSymlinks:!1});let a=null;return r.on("change",n=>{o(s.colors.blue(`🔧 Config file changed: ${y.relative(e,n)}`)),a&&clearTimeout(a),a=setTimeout(async()=>{try{o(s.colors.yellow("🔄 Restarting dev server due to config change...")),await t()}catch(e){o(s.colors.red(`❌ Failed to restart dev server: ${e?.message}. Stack: ${e?.stack}`))}},500)}),r.on("error",e=>{o(s.colors.red(`❌ Config watcher error: ${e}`))}),{watcher:r}}function U(e){e.watcher&&e.watcher.close()}function z(e){if(!e||"object"!=typeof e||!("message"in e))return!1;const t=String(e.message);return/Turbopack is not supported/i.test(t)||/native bindings are not available/i.test(t)||/Only WebAssembly \(WASM\) bindings were loaded/i.test(t)}async function B(e){const{changelog:t,executionRoot:o,newAssetsPath:n,backupsDirPath:i,changelogDestinationPath:r,logLevel:a}=e;let l;if("string"==typeof t)l=y.resolve(o,t);else{if(!P.existsSync(i))return void s.createLogger(a).warn(s.colors.yellow("backups directory not found, skipping changelog generation"));const e=P.readdirSync(i,{withFileTypes:!0});if(!e.length)return void s.createLogger(a).warn(s.colors.yellow("no backups found, skipping changelog generation"));const t=e.filter(e=>e.isFile()&&e.name.endsWith(".zip"));if(!t.length)return void s.createLogger(a).warn(s.colors.yellow("no ZIP backups found, skipping changelog generation"));const o=t.reduce((e,t)=>P.statSync(y.resolve(i,e.name)).mtimeMs>P.statSync(y.resolve(i,t.name)).mtimeMs?e:t).name;l=y.resolve(i,o)}const c=new $({oldAssetsPath:l,newAssetsPath:n,destinationPath:r});await c.generateChangelog()}let W=global.__pp_dev_profile_session,Z=0;const G=e=>{if(W)return new Promise((t,o)=>{W.post("Profiler.stop",(n,{profile:i})=>{if(n)o(n);else{const o=y.resolve(`./pp-dev-profile-${Z++}.cpuprofile`);P.writeFileSync(o,JSON.stringify(i)),e(s.colors.yellow(`CPU profile written to ${s.colors.white(s.colors.dim(o))}`)),W=void 0,t()}})})},X=e=>{for(const[t,o]of Object.entries(e))Array.isArray(o)&&(e[t]=o[o.length-1])};O.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"),O.command("[root]","start dev server").alias("serve").alias("dev").option("--host [host]","[string] specify hostname").option("--port <port>","[number] specify port").option("--https","[boolean] use TLS + HTTP/2").option("--open [path]","[boolean | string] open browser on startup").option("--cors","[boolean] enable CORS").option("--strictPort","[boolean] exit if specified port is already in use").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle").action(async(e,t)=>{X(t);let o=null,i=null,r=!1;const c=e?y.resolve(process.cwd(),e):process.cwd(),p=s.createLogger(t.logLevel),f=async()=>{if(!r){r=!0;try{o&&(p.info(s.colors.yellow("🛑 Stopping existing dev server...")),await o.close(),o=null);const{clearConfigCache:u,getConfig:g}=await Promise.resolve().then(()=>require("./index-Cev20Ede.js")).then(e=>e.config);u();const{createServer:h}=await(import("vite")),m=t.mode||"development",v=y.resolve(process.cwd(),e??".");a.loadPPDevEnv(m,v);const w=await l.loadConfigFromFile({mode:m,command:"serve"},t.config,e,t.logLevel);let b=await a.getViteConfig(void 0,{mode:m,root:v});if(w){const{plugins:e,...t}=w.config;b=l.mergeConfig(b,t)}if(o=await h(l.mergeConfig(b,{root:e,base:t.base,mode:t.mode,configFile:t.config,logLevel:t.logLevel,clearScreen:t.clearScreen,optimizeDeps:{force:t.force},server:V(t),customLogger:p},!0)),!o.config.base||"/"===o.config.base)throw new Error('base cannot be equal to "/" or empty string');if(!o.httpServer)throw new Error("HTTP server not available");await o.listen();const P=global.__pp_dev_start_time??!1,S=P?s.colors.dim(`ready in ${s.colors.reset(s.colors.bold(Math.ceil(n.performance.now()-P)))} ms`):"";p.info(`\n ${s.colors.green(`${s.colors.bold("PP-DEV")} v${s.VERSION}`)} ${S}\n`),o.printUrls();const x=await g(v);if(!1!==x.inspector?.enabled){const e=o.resolvedUrls?.local[0],t=e?new URL(e).origin:`http://localhost:${o.config.server.port??5173}`;p.info(`\n ${s.colors.cyan("🔍 Request Inspector")} ${s.colors.dim(t+d.INSPECTOR_PATH)}\n`)}F(o,{print:!0,customShortcuts:[...W?[{key:"p",description:"start/stop the profiler",async action(e){if(W)await G(p.info);else{const e=await import("node:inspector").then(e=>e.default);await new Promise(t=>{W=new e.Session,W.connect(),W.post("Profiler.enable",()=>{W?.post("Profiler.start",()=>{p.info("Profiler started"),t()})})})}}}]:[],{key:"l",description:"proxy re-login",action(e){e.ws.send({type:"custom",event:"redirect",data:{url:`/auth/index/logout?proxyRedirect=${encodeURIComponent("/")}`}})}}]}),i||(i=H(c,f,p.info),p.info(s.colors.blue("🔧 Config file watcher started"))),r=!1}catch(e){r=!1,p.error(s.colors.red(`error when starting dev server:\n${e.stack}`),{error:e}),G(p.info),process.exit(1)}}};A({logger:p,shutdown:async()=>{i&&(U(i),i=null),o&&(await o.close(),o=null),G(p.info)}}),await f()}),O.command("next [root]","start Next.js development server with pp-dev integration").alias("next-serve").alias("next-dev").option("--host [host]","[string] specify hostname; without a value, listen on all addresses").option("--port <port>","[number] specify port",{default:3e3}).option("--https","[boolean] no effect with pp-dev next (deprecated)").option("--open [path]","[boolean | string] no effect with pp-dev next (deprecated)").option("--cors","[boolean] no effect with pp-dev next (deprecated)").option("--strictPort","[boolean] no effect with pp-dev next (deprecated)").option("--force","[boolean] no effect with pp-dev next (deprecated)").option("--webpack","[boolean] use Webpack for Next dev (use when Turbopack/native SWC is unavailable)").option("--turbopack","[boolean] use Turbopack for Next dev when native bindings work").action(async(e,t)=>{X(t);const n=q.filter(e=>void 0!==t[e]);n.length>0&&s.createLogger(t.logLevel).warn(s.colors.yellow(`⚠️ ${n.map(e=>`--${e}`).join(", ")} ${1===n.length?"has":"have"} no effect with pp-dev next and will be removed.`));const{host:i,port:r}=function(e,t){let o="localhost";!0===e||""===e?o="0.0.0.0":"string"==typeof e?o=e:"number"==typeof e&&(o=String(e));const n="number"==typeof t?t:"string"==typeof t?Number.parseInt(t,10):NaN;return{host:o,port:Number.isInteger(n)&&n>=0?n:3e3}}(t.host,t.port);let l=null,p=null,f=null,u=null,g=null,h=!1;const m=new Set,v=s.createLogger(t.logLevel),w=function(e=["uncaughtException"],t=process){const o=e=>t.listeners(e);let n=null,i=null;return{beforeCreate(){n=new Map(e.map(e=>[e,new Set(o(e))]))},afterCreate(){if(!n)return 0;const r=n,s=new Map(e.map(e=>[e,o(e).filter(t=>!r.get(e).has(t))]));let a=0;if(i)for(const[e,o]of i){const n=new Set(s.get(e).map(e=>e.toString()));for(const i of o)n.has(i.toString())&&(t.off(e,i),a+=1)}return i=s,n=null,a}}}(),b=async()=>{l&&"function"==typeof l.close&&await l.close(),l=null},S=async()=>{const e=p;if(e){for(const e of m)e.destroy();m.clear(),await new Promise(t=>{e.close(()=>t())}),p===e&&(p=null)}},x=async()=>{if(!h){h=!0;try{const{next:E,constants:T}=await a.safeNextImport(),{PHASE_DEVELOPMENT_SERVER:L}=T;u?.dispose(),u=null,f&&(await f.close(),f=null),p&&(v.info(s.colors.yellow("🛑 Stopping existing Next.js server...")),await S()),await b();const{clearConfigCache:k}=await Promise.resolve().then(()=>require("./index-Cev20Ede.js")).then(e=>e.config);k();const{join:D}=await(import("path")),{createServer:F}=await(import("http")),I=await(import("next/dist/server/config.js")),_=I.default.default||I["module.exports"].default||I.default,$=e?D(process.cwd(),e):process.cwd();a.loadPPDevEnv(t.mode||"development",$);const N=await _(L,$);let C=N?.ppDev||{};if(0===Object.keys(C).length)try{const{getConfig:e}=await Promise.resolve().then(()=>require("./index-Cev20Ede.js")).then(e=>e.config),t=await e($);Object.keys(t).length>0?(C=t,v.info(s.colors.blue("🔧 Loaded pp-dev config from standalone config file"))):v.info(s.colors.yellow("⚠️ No pp-dev config found in Next.js config or standalone file, using defaults"))}catch(e){v.warn(s.colors.yellow(`⚠️ Failed to load standalone pp-dev config, using defaults: ${e instanceof Error?e.message:String(e)}`))}else v.info(s.colors.blue("🔧 Loaded pp-dev config from Next.js config"));const{getPkg:A}=await Promise.resolve().then(()=>require("./index-Cev20Ede.js")).then(e=>e.config),R=A($).name;s.validatePPDevConfig(C,R);const M=s.normalizePPDevConfig(C,R),{templateName:V}=M,q=M.backendBaseURL,O=M.templateLess,U=M.v7Features,B=M.disableSSLValidation,W=M.enableProxyCache,Z=M.proxyCacheTTL,G=M.personalAccessToken,X=M.miHudLess,J=M.inspectorEnabled,K=M.inspectorMaxMemory,Y=M.inspectorCaptureLimit,Q=M.appId,ee=N?.basePath;let te="";ee?te=ee:(te=O?s.PATH_PAGE_PREFIX:U?s.PATH_TEMPLATE_LOCAL_PREFIX:s.PATH_TEMPLATE_PREFIX,te+=`/${V}`);const oe=function(e){const t="1"===process.env.PP_DEV_NEXT_WEBPACK||"true"===process.env.PP_DEV_NEXT_WEBPACK;if(t&&(e.webpack||e.turbopack))throw new Error("Do not combine PP_DEV_NEXT_WEBPACK with --webpack or --turbopack");if(t)return{webpack:!0};if(e.webpack&&e.turbopack)throw new Error("Use only one of --webpack or --turbopack");return e.webpack?{webpack:!0}:e.turbopack?{turbopack:!0}:{}}(t),ne=async e=>{delete process.env.TURBOPACK,await b();const t={dev:!0,customServer:!0,hostname:i,port:r,dir:$,conf:{...N,basePath:te,assetPrefix:te}};e.webpack?t.webpack=!0:e.turbopack&&(t.turbopack=!0),w.beforeCreate(),l=E(t),await l.prepare(),w.afterCreate()};if(oe.webpack)await ne({webpack:!0});else if(oe.turbopack)try{await ne({turbopack:!0})}catch(e){if(!z(e))throw e;v.warn(s.colors.yellow("⚠ Turbopack is unavailable (native bindings). Falling back to Webpack.")),await ne({webpack:!0})}else try{await ne({})}catch(e){if(!z(e))throw e;v.warn(s.colors.yellow("⚠ Turbopack cannot run (native Next.js bindings unavailable). Falling back to Webpack.")),await ne({webpack:!0})}if(!l)throw new Error("Next.js app failed to initialize");if(te.endsWith("/")||(te+="/"),"/"===te)throw new Error('basePath cannot be equal to "/" or equal to empty string');v.info(s.colors.green("✅ Next.js app prepared successfully")),v.info(s.colors.blue(`🔧 pp-dev plugin configured for template: ${V}`)),v.info(s.colors.blue(`🔧 Base path configured: ${te}`)),q&&(v.info(s.colors.blue(`🌐 Backend URL: ${q}`)),v.info(s.colors.blue(`🆔 Custom App ID: ${Q}`)));const ie=l.getRequestHandler(),re=r,se=i;p=F(async(e,t)=>{try{const o=e.url||"/",n=o.split("?")[0];let i=c.parse(o,!0);if(le.length>0){if(n.startsWith("/_next/")||"/favicon.ico"===n||n.startsWith("/__nextjs_")){if(ce.length>0){let l=0;const d=()=>{if(l>=ce.length)return void r();const o=ce[l];l++,o(e,t,d)};return void d()}return void r()}let s=0;const a=()=>{if(s>=le.length)return void r();const o=le[s];s++,o(e,t,a)};return void a()}async function r(){if(n.startsWith(te))i=c.parse(o,!0);else{if(n===te.replace(/\/$/,"")){const e=o.replace(n,te);return t.writeHead(302,{Location:e}),void t.end()}if(n.startsWith("/_next/")||"/favicon.ico"===n||n.startsWith("/__nextjs_"));else if("/"===n)return t.writeHead(302,{Location:te}),void t.end()}await ie(e,t,i)}r()}catch(p){v.error(`Error handling request: ${p instanceof Error?p.message:String(p)}`,{error:p instanceof Error?p:void 0}),t.statusCode=500,t.end("Internal Server Error")}});let ae=null,le=[],ce=[];if(!1!==J){const e=new d.RequestStore(K);d.registerInspectorRoutes(d.internalServer,e,Y);const t=d.createRequestCaptureMiddleware(e,Y);le.push(t)}const de=(e,t,o)=>{if(e.url?.startsWith("/@api/")||e.url?.startsWith(d.INSPECTOR_PATH)||e.url?.startsWith(d.VARIABLES_EDITOR_PATH)){const o=()=>{};return void d.internalServer(e,t,o)}o()};if(q||!1===J||(ce.push(de),le.push(de)),q){const e=new URL(q).host,t=d.createUserHostGuard();ce.unshift(t),le.unshift(t),q.startsWith("https://")&&(o.EventEmitter.defaultMaxListeners=Math.max(o.EventEmitter.defaultMaxListeners,20));const i={headers:{host:e,referer:q,origin:q.replace(/^(https?:\/\/)([^/]+)(\/.*)?$/i,"$1$2")},appId:Q,templateLess:O,disableSSLValidation:B,v7Features:U,personalAccessToken:G??process.env.MI_ACCESS_TOKEN};ae=new d.MiAPI(q,i);const r=d.initPPRedirect(te,V),c=(e,t,o)=>{r(e,t,o)};ce.push(c),le.push(c);const g=a.createDevPanelAssetMiddleware(te);if(ce.push(g),le.push(g),W){let e=+Z;(!e||Number.isNaN(e)||e<0)&&(e=6e5);const t={devServer:{middlewares:{use:e=>e},config:{logger:console}},ttl:e},o=d.initProxyCache(t),n=(e,t,n)=>{o(e,t,n)};le.push(n),v.info(s.colors.blue(`🔧 Proxy cache middleware added with TTL: ${e}ms`))}const h=new RegExp(`^((${n=te,n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})|/)$`),m=d.initLoadPPData(h,ae,Object.assign({base:te},i,{miHudLess:X})),w=(e,t,o)=>{m(e,t,o)};le.push(w);const b=te.endsWith("/")?te.substring(0,te.length-1):te,S={middlewares:{use:e=>e},config:{logger:console}},x=d.initProxy({devServer:S,baseURL:q,proxyIgnore:["/@vite","/@metricinsights","/@",b,"/_next","/favicon.ico","/__nextjs_","/installHook.js.map"],disableSSLValidation:B,miAPI:ae,templateName:V}),E=(e,t,o)=>{x(e,t,o)};le.push(E),ce.push(de),le.push(de);const L=d.initRewriteResponse(e=>{const t=e.split("?")[0];return t.startsWith(te)&&!t.includes("/_next/")},(t,o)=>{const n=ae.buildPage(t,X),i=a.injectDevPanel(n,te,{backendBaseURL:q,templateLess:O,appId:Q,devPanelPosition:M.devPanelPosition,devPanelHidden:M.devPanelHidden,devPanelAutoHide:M.devPanelAutoHide});return Buffer.from(d.urlReplacer(e,o.headers.host??"",i))}),k=(e,t,o)=>{L(e,t,o)};le.push(k),f=new j;let D=N?.distDir;const F=process.env[s.PP_DEV_NEXT_BUILD_ENV_VAR];process.env[s.PP_DEV_NEXT_BUILD_ENV_VAR]="1";try{const e=await _(T.PHASE_PRODUCTION_BUILD,$);D=e?.distDir??D}catch{}finally{void 0===F?delete process.env[s.PP_DEV_NEXT_BUILD_ENV_VAR]:process.env[s.PP_DEV_NEXT_BUILD_ENV_VAR]=F}const I=(D??"").replace(/\\/g,"/").replace(/\/+$/,"").replace(/\/dev$/,""),C=I&&".next"!==I?I:"out";let A,R="0.0.0";try{const e=JSON.parse(P.readFileSync(y.join($,"package.json"),"utf-8"));R="string"==typeof e.version?e.version:R,A="string"==typeof e.repository?e.repository:e.repository?.url}catch{}const H=new d.DistService(V,{root:$,backupFolder:y.resolve($,M.syncBackupsDir),maxBackups:M.syncMaxBackups,buildTimeoutMs:M.syncBuildTimeoutMs,nextBuild:{projectRoot:$,distDir:C,packageVersion:R,packageRepositoryUrl:A}}),z={ws:f.ws,config:{clientInjectionPlugin:{v7Features:U}}};u=new d.ClientService(z,{distService:H,miAPI:ae}),d.registerVariablesEditorRoutes(d.internalServer,{distService:H,miAPI:ae}),d.registerUserRoutes(d.internalServer,{miAPI:ae}),d.startKeepingUsers({persist:M.persistUsers,miAPI:ae,projectRoot:$,miUrl:q});const J="function"==typeof l?.getUpgradeHandler?l.getUpgradeHandler():null;p.on("upgrade",(e,t,o)=>{f?.handleUpgrade(e,t,o)||(J?J(e,t,o):t.destroy())}),v.info(s.colors.blue(`🔧 ${le.length} pp-dev middlewares initialized`)),v.info(s.colors.blue(`🔧 ${ce.length} essential middlewares for internal routes`)),v.info(s.colors.blue(`🔧 MiAPI initialized for backend: ${q}`)),v.info(s.colors.blue(`🔧 Custom App ID: ${Q}`))}p.listen(re,se,()=>{v.info(s.colors.green(`✅ pp-dev Next.js server running at http://${se}:${re}`)),v.info(s.colors.blue(`📱 Next.js app accessible at http://${se}:${re}${te}`)),!1!==J&&v.info(s.colors.cyan(`🔍 Request Inspector: http://${se}:${re}${d.INSPECTOR_PATH}`)),v.info(s.colors.blue("🔧 Base path handling active")),g||(g=H($,x,v.info),v.info(s.colors.blue("🔧 Config file watcher started"))),p.on("connection",e=>{m.add(e),e.on("close",()=>m.delete(e))})}),h=!1}catch(e){h=!1,v.error(s.colors.red(`❌ Failed to start Next.js server: ${e?.message}. Stack: ${e?.stack}`)),e instanceof Error&&e.message.includes("Next.js is required")&&(v.error(s.colors.red("❌ Next.js Peer Dependency Error:")),v.error(s.colors.red(e.message)),v.error(s.colors.yellow("\n💡 To fix this issue:")),v.error(s.colors.blue(" 1. Install Next.js in your project:")),v.error(s.colors.white(" npm install next@^16")),v.error(s.colors.blue(" 2. Or use yarn:")),v.error(s.colors.white(" yarn add next@^16")),v.error(s.colors.blue(" 3. Or use pnpm:")),v.error(s.colors.white(" pnpm add next@^16")),v.error(s.colors.yellow("\n📖 For more information, see:")),v.error(s.colors.blue(" https://nextjs.org/docs/getting-started"))),process.exit(1)}var n}};A({logger:v,knownRejections:[R],shutdown:async()=>{g&&(U(g),g=null),u?.dispose(),u=null,f&&(await f.close(),f=null),await S(),await b()}}),await x()}),O.command("build [root]","build for production").option("--target <target>","[string] transpile target (default: 'modules')").option("--outDir <dir>","[string] output directory (default: dist)").option("--assetsDir <dir>","[string] directory under outDir to place assets in (default: assets)").option("--assetsInlineLimit <number>","[number] static asset base64 inline threshold in bytes (default: 4096)").option("--ssr [entry]","[string] build specified entry for server-side rendering").option("--sourcemap [output]",'[boolean | "inline" | "hidden"] output source maps for build (default: false)').option("--minify [minifier]",'[boolean | "terser" | "esbuild"] enable/disable minification, or specify minifier to use (default: esbuild)').option("--manifest [name]","[boolean | string] emit build manifest json").option("--ssrManifest [name]","[boolean | string] emit ssr manifest json").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle (experimental)").option("--emptyOutDir","[boolean] force empty outDir when it's outside of root").option("-w, --watch","[boolean] rebuilds when modules have changed on disk").option("--changelog [assetsFile]","[boolean | string] generate changelog between assetsFile and current build (default: false)").option("--distZip","[boolean] pack build output into a ZIP archive; use --no-distZip to disable (default: pp-dev config build.zip, or true). Env: PP_DEV_DIST_ZIP").option("--distZipDir <dir>","[string] override the ZIP output directory (default: 'dist-zip'). Env: PP_DEV_DIST_ZIP_DIR").option("--distZipFilename <filename>","[string] override the ZIP output file name (default: '<app-name>.zip'). Env: PP_DEV_DIST_ZIP_FILENAME").option("--versionManifest","[boolean] emit VERSION-*.json + BUILD-MANIFEST.json; use --no-versionManifest to disable (default: pp-dev config build.versionFile, or true). Env: PP_DEV_VERSION_MANIFEST").option("--versionFileTemplate <template>","[string] override the VERSION file name template (default: 'VERSION-v{packageversion}-{currentDate}.json'). Env: PP_DEV_VERSION_FILE_TEMPLATE").action(async(e,t)=>{X(t);const o=V(t),n=a.resolveBuildCliOverrides(t);try{const i=t.mode||"production",r=y.resolve(process.cwd(),e??".");a.loadPPDevEnv(i,r);const s=await l.loadConfigFromFile({mode:i,command:"build"},t.config,e,t.logLevel);let c=await a.getViteConfig(n,{mode:i,root:r});if(s){const{plugins:e,...t}=s.config;c=l.mergeConfig(c,t)}const d=l.mergeConfig(c,{root:e,base:t.base,mode:t.mode,configFile:t.config,logLevel:t.logLevel,clearScreen:t.clearScreen,optimizeDeps:{force:t.force},build:o},!0);if(await l.build(d),t.changelog){const o=e||process.cwd(),n=d.build?.outDir||"dist";let i="dist-zip";d.ppDevConfig&&(!1===d.ppDevConfig.distZip?i=n:"object"==typeof d.ppDevConfig.distZip&&"string"==typeof d.ppDevConfig.distZip.outDir&&(i=d.ppDevConfig.distZip.outDir)),await B({changelog:t.changelog,executionRoot:o,newAssetsPath:y.resolve(o,n),backupsDirPath:y.resolve(o,d.ppDevConfig?.syncBackupsDir||"backups"),changelogDestinationPath:y.resolve(o,i),logLevel:t.logLevel})}}catch(e){s.createLogger(t.logLevel).error(s.colors.red(`error during build:\n${e.stack}`),{error:e}),process.exit(1)}finally{G(e=>s.createLogger(t.logLevel).info(e))}}),O.command("next-build [root]","build a Next.js app for production (`next build`) and emit VERSION/BUILD-MANIFEST/zip in the same format as `pp-dev build`").option("--changelog [assetsFile]","[boolean | string] generate changelog between assetsFile and current build (default: false)").option("--distZip","[boolean] pack build output into a ZIP archive; use --no-distZip to disable (default: pp-dev config build.zip, or true). Env: PP_DEV_DIST_ZIP").option("--distZipDir <dir>","[string] override the ZIP output directory (default: 'dist-zip'). Env: PP_DEV_DIST_ZIP_DIR").option("--distZipFilename <filename>","[string] override the ZIP output file name (default: '<app-name>.zip'). Env: PP_DEV_DIST_ZIP_FILENAME").option("--versionManifest","[boolean] emit VERSION-*.json + BUILD-MANIFEST.json; use --no-versionManifest to disable (default: pp-dev config build.versionFile, or true). Env: PP_DEV_VERSION_MANIFEST").option("--versionFileTemplate <template>","[string] override the VERSION file name template (default: 'VERSION-v{packageversion}-{currentDate}.json'). Env: PP_DEV_VERSION_FILE_TEMPLATE").action(async(e,t)=>{X(t);const o=s.createLogger(t.logLevel),n=e?y.resolve(process.cwd(),e):process.cwd(),i=a.resolveBuildCliOverrides(t);process.env[s.PP_DEV_NEXT_BUILD_ENV_VAR]="1";try{a.loadPPDevEnv(t.mode||"production",n);const{constants:e}=await a.safeNextImport(),r=await(import("next/dist/server/config.js")),l=r.default.default||r["module.exports"].default||r.default,c=await l(e.PHASE_PRODUCTION_BUILD,n);let p=c?.ppDev||{};if(0===Object.keys(p).length){const{getConfig:e}=await Promise.resolve().then(()=>require("./index-Cev20Ede.js")).then(e=>e.config);p=await e(n)}const{getPkg:f}=await Promise.resolve().then(()=>require("./index-Cev20Ede.js")).then(e=>e.config),u=s.normalizePPDevConfig(p,f(n).name),g=a.applyDistZipOverride(u.distZip,i,s.createDefaultZipFileName(u.templateName)),h=a.applyVersionManifestOverride(u.versionPlugin,i),m=d.removeStaleDevTypes(n,c);m&&o.info(s.colors.dim(`[pp-dev] Removed stale dev route types: ${y.relative(n,m)}`)),o.info(s.colors.cyan("[pp-dev] Running `next build`...")),await d.runNextBuildProcess(n);const w="string"==typeof c?.distDir&&c.distDir?c.distDir:".next",b=".next"===w?"out":w,S=y.resolve(n,b);if(!P.existsSync(S)||!P.statSync(S).isDirectory())throw new Error(`Next.js build output directory not found: ${S}. "next-build" requires "output: 'export'" in next.config (static export).`);const x=JSON.parse(P.readFileSync(y.join(n,"package.json"),"utf-8"));if(!1!==h&&!1!==h.enabled&&(await v.writeBuildVersionManifest({outDir:S,packageVersion:"string"==typeof x.version?x.version:"0.0.0",versionFileTemplate:h.versionFileTemplate,packageRepositoryUrl:"string"==typeof x.repository?x.repository:x.repository?.url,enabled:h.enabled}),o.info(s.colors.green(`✅ VERSION / BUILD-MANIFEST written to ${y.relative(n,S)}`))),!1!==g){const e=y.resolve(n,g.outDir),t=g.inDir?y.resolve(S,g.inDir):S,i=s.resolveOutputFilePath(e,g.outFileName,"ZIP output file name");P.mkdirSync(y.dirname(i),{recursive:!0});const r=await d.zipDirectoryToBuffer(t);P.writeFileSync(i,r),o.info(s.colors.green(`✅ Zip archive written to ${y.relative(n,i)}`))}if(t.changelog){const e=!1!==g?g.outDir:b;await B({changelog:t.changelog,executionRoot:n,newAssetsPath:S,backupsDirPath:y.resolve(n,u.syncBackupsDir),changelogDestinationPath:y.resolve(n,e),logLevel:t.logLevel})}}catch(e){s.createLogger(t.logLevel).error(s.colors.red(`error during next-build:\n${e.stack}`),{error:e}),process.exit(1)}finally{G(e=>s.createLogger(t.logLevel).info(e))}}),O.command("changelog [oldAssetPath] [newAssetPath]","generate changelog between two assets files/folders").option("--oldAssetsPath <oldAssetsPath>","[string] path to the old assets zip file or folder").option("--newAssetsPath <newAssetsPath>","[string] path to the new assets zip file or folder").option("--destination <destination>","[string] destination folder for the changelog (default: .)").option("--filename <filename>","[string] filename for the changelog (default: CHANGELOG.html)").action(async(e,t,o)=>{X(o);const{oldAssetsPath:n=e,newAssetsPath:i=t,destination:r=".",filename:a="CHANGELOG.html",logLevel:l}=o,c=process.cwd();n&&i||(s.createLogger(l).error(s.colors.red("error during changelog generation: oldAssetPath and newAssetPath are required")),process.exit(1));const d=y.resolve(c,n),p=y.resolve(c,i),f=y.resolve(c,r),u=new $({oldAssetsPath:d,newAssetsPath:p,destinationPath:f,changelogFilename:a});await u.generateChangelog()}),O.command("generate-icon-font [source] [destination]","generate icon font from SVG files").option("--source <source>","[string] path to the source directory with SVG files").option("--destination <destination>","[string] path to the destination directory to save the generated font files").option("--font-name, -n <fontName>","[string] name of the font to generate (default: 'icon-font')").action(async(e,t,o)=>{X(o);const{source:n=e,destination:i=t,fontName:r="icon-font"}=o,a=process.cwd(),l=y.resolve(a,n),c=y.resolve(a,i),d=new N({sourceDir:l,outputDir:c,fontName:r}),p=s.createLogger(o.logLevel);p.info(`Generating icon font from SVG files in ${s.colors.dim(l)}`),await d.generate(),p.info(`Icon font generated and saved to ${s.colors.dim(c)}`)}),O.command("optimize [root]","pre-bundle dependencies").option("--force","[boolean] force the optimizer to ignore the cache and re-bundle").action(async(e,t)=>{X(t);try{const o=t.mode||"production",n=y.resolve(process.cwd(),e??".");a.loadPPDevEnv(o,n);const i=await l.loadConfigFromFile({mode:o,command:"build"},t.config,e,t.logLevel);let r=await a.getViteConfig(void 0,{mode:o,root:n});if(i){const{plugins:e,...t}=i.config;r=l.mergeConfig(r,t)}const s=await l.resolveConfig(l.mergeConfig(r,{root:e,base:t.base,configFile:t.config,logLevel:t.logLevel,mode:t.mode}),"serve");await l.optimizeDeps(s,t.force,!0)}catch(e){s.createLogger(t.logLevel).error(s.colors.red(`error when optimizing deps:\n${e.stack}`),{error:e}),process.exit(1)}}),O.command("preview [root]","locally preview production build").option("--host [host]","[string] specify hostname").option("--port <port>","[number] specify port").option("--strictPort","[boolean] exit if specified port is already in use").option("--https","[boolean] use TLS + HTTP/2").option("--open [path]","[boolean | string] open browser on startup").option("--outDir <dir>","[string] output directory (default: dist)").action(async(e,t)=>{X(t);try{const o=t.mode||"production",n=y.resolve(process.cwd(),e??".");a.loadPPDevEnv(o,n);const i=await l.loadConfigFromFile({mode:o,command:"build"},t.config,e,t.logLevel);let r=await a.getViteConfig(void 0,{mode:o,root:n});if(i){const{plugins:e,...t}=i.config;r=l.mergeConfig(r,t)}(await l.preview(l.mergeConfig(r,{root:e,base:t.base,configFile:t.config,logLevel:t.logLevel,mode:t.mode,build:{outDir:t.outDir},preview:{port:t.port,strictPort:t.strictPort,host:t.host,https:t.https,open:t.open}}))).printUrls()}catch(e){s.createLogger(t.logLevel).error(s.colors.red(`error when starting preview server:\n${e.stack}`),{error:e}),process.exit(1)}finally{G(e=>s.createLogger(t.logLevel).info(e))}}),O.command("migrate [config]","migrate pp-dev config from 0.x flat format to 1.0 grouped format").option("--dry-run","[boolean] print migrated config without writing any files").option("--format <format>","[string] output format: ts (default), js, json").option("--output <file>","[string] output file path (default: pp-dev.config.ts)").option("--no-backup","[boolean] skip backup of original config file").action(async(e,t)=>{const o=s.createLogger(t.logLevel),{isLegacyFlatConfig:n,isLegacyPPWatchConfig:i,isAlreadyMigrated:r,migrateLegacyFlatConfig:a,migratePPWatchConfig:l,generateConfigFileContent:c,discoverMigrateSource:d,loadPackageJsonMigrateConfig:p}=await Promise.resolve().then(()=>require("./migrate-MxrkBSEh.js")),f=t.format??"ts",u=!1!==t.backup,g=process.cwd(),h=d(g,e);h||(o.warn(s.colors.yellow("No pp-dev or pp-watch config file found in the current directory.")),o.info(s.colors.blue('Supported files: pp-dev.config.{ts,js,cjs,mjs,json}, .pp-watch.config.{ts,js,json}, or a "pp-dev" field in package.json')),process.exit(1));const{sourceFile:m,isWatchConfig:v,isPackageJsonConfig:w}=h;o.info(s.colors.blue(`Found config: ${y.relative(g,m)}`));const{getPkg:b}=await Promise.resolve().then(()=>require("./index-Cev20Ede.js")).then(e=>e.config),S=b();let x,E={};try{if(/\.[cm]?ts$/i.test(m)){const e=await(import("esbuild")),{pathToFileURL:t}=await(import("url")),o=(await e.build({absWorkingDir:g,entryPoints:[m],outfile:"out.js",write:!1,target:"node24",platform:"node",bundle:!0,packages:"external",format:"esm",mainFields:["main"]})).outputFiles[0].text,n=`pp-migrate-tmp-${Date.now()}.mjs`;P.writeFileSync(n,o);try{const e=await(import(t(y.resolve(g,n)).toString()));E=e.default?.default??e.default??e}finally{P.existsSync(n)&&P.unlinkSync(n)}}else if(/\.[cm]?js$/i.test(m)){const{pathToFileURL:e}=await(import("url")),t=await(import(e(y.resolve(g,m)).toString()));E=t.default?.default??t.default??t}else w?E=p(m):m.endsWith(".json")&&(E=JSON.parse(P.readFileSync(m,"utf-8")))}catch(e){o.error(s.colors.red(`Failed to load config file: ${e.message}`)),process.exit(1)}E&&"object"==typeof E||(o.error(s.colors.red("Config file did not export a valid object.")),process.exit(1)),r(E)?(o.info(s.colors.green("Config is already in 1.0 format — nothing to migrate.")),process.exit(0)):v||i(E)?(o.info(s.colors.blue("Detected pp-watch config format → migrating to 1.0")),x=l(E)):n(E)?(o.info(s.colors.blue("Detected 0.x flat config format → migrating to 1.0")),x=a(E,S.name)):(o.warn(s.colors.yellow("Could not detect config format. No known keys found.")),process.exit(1));const T=c(x,f),L=t.output??y.join(g,`pp-dev.config.${f}`);if(t.dryRun&&(o.info(s.colors.green(`\n--- Migrated config (dry-run) → ${y.relative(g,L)} ---\n`)),process.exit(0)),u&&!w&&P.existsSync(m)){const e=`${m}.bak`;P.copyFileSync(m,e),o.info(s.colors.blue(`Backed up original to: ${y.relative(g,e)}`))}P.writeFileSync(L,T,"utf-8"),o.info(s.colors.green(`✅ Migration complete → ${y.relative(g,L)}`)),w?o.info(s.colors.yellow('You can now remove the "pp-dev" field from package.json.')):m!==L&&P.existsSync(m)&&o.info(s.colors.yellow(`You can now delete the old config: ${y.relative(g,m)}`))}),O.help(),O.version(s.VERSION),O.parse(),exports.stopProfiler=G;
|
|
2
2
|
//# sourceMappingURL=cli.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e=require("child_process"),t=require("./auth.provider-Co900L4C.js"),n=require("node:module"),i=require("vite"),r=require("fs"),s=require("path"),o=require("url");require("./helpers.js");const a=require("ejs");var c="undefined"!=typeof document?document.currentScript:null;const l=e=>e&&"object"==typeof e&&"default"in e?e.default:e;function p(e){if(e&&"object"==typeof e&&"default"in e)return e;const t=Object.create(null);if(e)for(const n in e)t[n]=e[n];return t.default=e,Object.freeze(t)}const u=p(r),d=p(s),f=l(s),m=l(a),v=d.dirname(t.PP_DEV_CLIENT_ENTRY),P=d.join(v,"index.html");let _=null;function E(e){return{css:d.posix.join(e,t.PACKAGE_NAME,"client/client.css"),js:d.posix.join(e,t.PACKAGE_NAME,"client/client.js")}}function g(e){return function(){if(_)return _;const e=u.readFileSync(P,{encoding:"utf8"});return _=m.compile(e,{openDelimiter:"{",closeDelimiter:"}",async:!1,rmWhitespace:!0,compileDebug:!1}),_}()({PACKAGE_NAME:t.PACKAGE_NAME,VERSION:t.VERSION,backendBaseURL:e.backendBaseURL,templateLess:e.templateLess,appId:e.appId,canSync:e.canSync??!0,devPanelPosition:e.devPanelPosition??"bottom-right",devPanelHidden:e.devPanelHidden??!1,devPanelAutoHide:e.devPanelAutoHide??!1})}const h={".js":"text/javascript; charset=utf-8",".css":"text/css; charset=utf-8",".map":"application/json; charset=utf-8"};const y=i.normalizePath(d.join(t.PP_DEV_PACKAGE_DIR,"dist/client")),j=new RegExp(`^\\/?${t.PACKAGE_NAME}\\/client\\/(.*)$`);const T=(e,t)=>` * ${t}`;function I(e){return`/*!\n${"***** DO NOT EDIT THIS CODE! *****\n***** ------- *****".replace(/^(.*)$/gm,T)}\n */`}async function R(){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 b=()=>n.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:c&&"SCRIPT"===c.tagName.toUpperCase()&&c.src||new URL("index-DB5b_ENM.js",document.baseURI).href);let D=new Set;function A(e="development",t=process.cwd()){for(const e of D)delete process.env[e];const n=new Set(Object.keys(process.env).filter(e=>e.startsWith("MI_"))),r=i.loadEnv(e,t,"MI_");for(const[e,t]of Object.entries(r))process.env[e]=t;return D=new Set(Object.keys(r).filter(e=>!n.has(e))),r}const $=new Map,w=new Map;function N(e=process.cwd()){const t=Date.now(),n=f.resolve(e),i=w.get(n);if(i&&t-i.timestamp<6e4)return i.data;try{const e=JSON.parse(r.readFileSync(f.resolve(n,"package.json"),{encoding:"utf-8",flag:"r"}));return w.set(n,{data:e,timestamp:t}),e}catch{const e={};return w.set(n,{data:e,timestamp:t}),e}}let S=null;const O="__pp_dev_injected_dirname",x="__pp_dev_injected_filename",F="__pp_dev_injected_import_meta_url",C={__dirname:O,__filename:x,"import.meta.url":F,"import.meta.dirname":O,"import.meta.filename":x},L={name:"pp-dev:config-module-location",setup(e){e.onLoad({filter:/\.([cm]?[jt]s|[jt]sx)$/},e=>{const t=r.readFileSync(e.path,"utf-8").replace(/^#![^\r\n]*/,"");return{contents:`const ${O} = ${JSON.stringify(f.dirname(e.path))};const ${x} = ${JSON.stringify(e.path)};const ${F} = ${JSON.stringify(o.pathToFileURL(e.path).href)};`+t,loader:e.path.endsWith(".tsx")?"tsx":e.path.endsWith(".jsx")?"jsx":/ts$/.test(e.path)?"ts":"js"}})}};async function M(e,t){const n=`bundled:${e}`,i=$.get(n);if(i&&Date.now()-i.timestamp<3e4)return i.data;let s=!1;if(/\.m[jt]s$/.test(e))s=!0;else if(/\.c[jt]s$/.test(e))s=!1;else{const e=N(t);s=!!e&&"module"===e.type}const a=await async function(){return S||(S=await(import("esbuild"))),S}(),c=await a.build({absWorkingDir:t,entryPoints:[e],outfile:"out.js",write:!1,target:"node24",platform:"node",bundle:!0,packages:"external",format:s?"esm":"cjs",mainFields:["main"],sourcemap:"inline",metafile:!0,plugins:[L],define:C,...s?{banner:{js:"import { createRequire as __ppDevCreateRequire } from 'node:module';const require = __ppDevCreateRequire(import.meta.url);"}}:{}}),{text:l}=c.outputFiles[0],p=`${`pp-config.timestamp-${Date.now()}-${Math.random().toString(16).slice(2)}`}.${s?"mjs":"cjs"}`,u=f.resolve(t,p),d=o.pathToFileURL(u).toString();r.writeFileSync(u,l);let m={};try{const t=(await(import(d))).default;m=t?.default||t,$.set(n,{data:m,timestamp:Date.now(),filePath:e})}finally{try{r.unlinkSync(u)}catch{}}return m}async function V(e){const t=`json:${e}`,n=$.get(t);if(n&&Date.now()-n.timestamp<3e4)return n.data;const i=JSON.parse(r.readFileSync(e,{encoding:"utf-8"}));return $.set(t,{data:i,timestamp:Date.now(),filePath:e}),i}const U=new Map;function H(e=process.cwd()){return N(e)}async function Z(e=process.cwd()){const n=f.resolve(e),i=function(e){const t=Date.now(),n=U.get(e);if(n&&t-n.timestamp<1e4)return n.files;const i=/\.config\.(([cm]?ts)|([cm]?js)|(json))$/,s=r.readdirSync(e,{withFileTypes:!0}).filter(e=>e.isFile()&&i.test(e.name)).map(e=>e.name);return U.set(e,{files:s,timestamp:t}),s}(n);let s={},o=!1;const a=await async function(e,t,n){for(const i of t)if(e.includes(i)){const e=f.resolve(n,i);if(/\.[cm]?[jt]s$/i.test(i))return await M(e,n);if(i.endsWith(".json"))return await V(e)}return null}(i,t.PP_DEV_CONFIG_NAMES,n);a&&(s=a,o=!0);const c=N(n)["pp-dev"];return o||!c||"object"!=typeof c||Array.isArray(c)||(s=c),s}const q=Object.freeze({__proto__:null,clearConfigCache:function(){$.clear(),w.clear(),U.clear()},getConfig:Z,getPkg:H});function G(e){if(void 0!==e)return"1"===e||"true"===e.toLowerCase()||"0"!==e&&"false"!==e.toLowerCase()&&void 0}function k(e,n,i){if(!1===n.distZipEnabled)return!1;if(!0!==n.distZipEnabled&&void 0===n.distZipDir&&void 0===n.distZipFilename)return!1!==e&&{...e,outFileName:t.normalizeRelativeOutputPath(e.outFileName,"ZIP output file name")};const r=!1===e?{outFileName:i,outDir:"dist-zip"}:e,s=n.distZipFilename??r.outFileName;return{...r,...void 0!==n.distZipDir?{outDir:n.distZipDir}:{},outFileName:t.normalizeRelativeOutputPath(s,"ZIP output file name")}}function z(e,n){if(!1===n.versionManifestEnabled)return!1;if(!0!==n.versionManifestEnabled&&void 0===n.versionFileTemplate)return!1!==e&&void 0!==e.versionFileTemplate?{...e,versionFileTemplate:t.normalizeRelativeOutputPath(e.versionFileTemplate,"VERSION file name template")}:e;const i=!1===e?{enabled:!0}:e,r=n.versionFileTemplate??i.versionFileTemplate,s=void 0!==r?t.normalizeRelativeOutputPath(r,"VERSION file name template"):void 0;return{...i,enabled:!0,...void 0!==s?{versionFileTemplate:s}:{}}}const B=new Set(["mi","app","proxy","build","sync","inspector","devPanel"]);function K(t){if("string"==typeof t)return t;if(t&&"object"==typeof t&&"url"in t&&"string"==typeof t.url)return t.url;const n=["CI_REPOSITORY_URL","GIT_URL","BUILD_REPOSITORY_URI","CI_PROJECT_URL","BITBUCKET_GIT_HTTP_ORIGIN","BUILDKITE_REPO"];for(const e of n){const t=process.env[e];if("string"==typeof t&&t.trim())return t}const i=process.env.GITHUB_REPOSITORY;if("string"==typeof i&&i.trim()){return`${(process.env.GITHUB_SERVER_URL||"https://github.com").replace(/\/+$/,"")}/${i.replace(/^\/+/,"")}`}const r=process.env.CI_PROJECT_PATH;if("string"==typeof r&&r.trim()){return`${(process.env.CI_SERVER_URL||"https://gitlab.com").replace(/\/+$/,"")}/${r.replace(/^\/+/,"")}`}const s=process.env.BITBUCKET_REPO_FULL_NAME;if("string"==typeof s&&s.trim())return`https://bitbucket.org/${s.replace(/^\/+/,"")}`;const o=process.env.TRAVIS_REPO_SLUG;if("string"==typeof o&&o.trim())return`https://github.com/${o.replace(/^\/+/,"")}`;try{const t=e.execSync("git config --get remote.origin.url",{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(t)return t}catch{}}function X(e){return e?.ppDev||{}}exports.applyDistZipOverride=k,exports.applyVersionManifestOverride=z,exports.config=q,exports.createDevPanelAssetMiddleware=function(e){const n=d.posix.join(e,t.PACKAGE_NAME,"client")+"/",i=new Set(["client.js","client.css","client.js.map","client.css.map"]);return(e,t,r)=>{const s=(e.url??"").split("?")[0];if(!s.startsWith(n))return void r();const o=s.slice(n.length);if(!i.has(o))return void r();const a=d.join(v,o);u.readFile(a,(e,n)=>{e?r():(t.statusCode=200,t.setHeader("Content-Type",h[d.extname(o)]??"application/octet-stream"),t.setHeader("Cache-Control","no-cache"),t.end(n))})}},exports.getNextVersion=async function(){try{const e=b()("next/package.json");return"string"==typeof e.version?e.version:null}catch{return null}},exports.getPPDevConfigFromNextConfig=X,exports.getViteConfig=async function(e,n={}){const r=n.root??process.cwd();A(n.mode,r);const s=H(r),o=await Z(r);t.validatePPDevConfig(o,s.name);const a=t.normalizePPDevConfig(o,s.name),{templateName:c}=a;e&&(a.distZip=k(a.distZip,e,t.createDefaultZipFileName(c)),a.versionPlugin=z(a.versionPlugin,e));const{default:l}=await Promise.resolve().then(()=>require("./plugin.js")),p=[l(a),{name:"pp-dev:client",apply:"serve",config:e=>(e.optimizeDeps?.exclude?.push(`${t.PACKAGE_NAME}/client`),e),resolveId(e){const t=e.match(j);if(t){const e=i.normalizePath(d.join(y,t[1]));return e.startsWith(`${y}/`)?{id:e}:null}},transformIndexHtml:async(e,t)=>{const n=E(t.server?.config.base||""),i={html:e,tags:[{tag:"link",injectTo:"head",attrs:{rel:"stylesheet",href:n.css}}]},{templateLess:r=!1,...s}=t.server?.config.clientInjectionPlugin||{};return i.tags.push({tag:"div",injectTo:"body-prepend",children:g({templateLess:r,...s})}),i.tags.push({tag:"script",injectTo:"body-prepend",attrs:{src:n.js,type:"module"}}),i},configureServer(e){const n=i.normalizePath(d.resolve(e.config.root,d.dirname(t.PP_DEV_CLIENT_ENTRY)));e.config.server?.fs?.allow&&e.config.server.fs.allow.push(n)}}],{outDir:u,distZip:f,versionPlugin:m,imageOptimizer:v,templateLess:P,integrateMiTopBar:_}=a;if(_&&p.push(function(e){return{name:"mi-topbar-plugin",transformIndexHtml(){const t=[];return(!0===e||"object"==typeof e&&!0===e.addRootElement)&&t.push({tag:"div",injectTo:"body-prepend",attrs:{id:"mi-react-root"}}),(!0===e||"object"==typeof e&&!0===e.addSharedComponentsScripts)&&t.push({tag:"script",injectTo:"head-prepend",attrs:{src:"/auth/info.js"}},{tag:"script",injectTo:"head-prepend",attrs:{src:"/js/main.js",defer:"defer"}},{tag:"link",injectTo:"head-prepend",attrs:{href:"/css/main.css",rel:"stylesheet"}}),t}}}(_)),v){const{ViteImageOptimizer:e}=await(import("vite-plugin-image-optimizer"));p.push(e("object"==typeof v?v:void 0))}if(m){const{versionPlugin:e}=await Promise.resolve().then(()=>require("./version-plugin-BA18wf3V.js"));p.push(e({outDir:u,packageVersion:s.version??"0.0.0",packageRepositoryUrl:K(s.repository),..."object"==typeof m?m:{}}))}if(f){const{default:e}=await(import("vite-plugin-zip-pack"));p.push({...e("object"==typeof f?f:{outFileName:t.createDefaultZipFileName(c)}),enforce:"post"})}return{base:P?`${t.PATH_PAGE_PREFIX}/${c}`:`${t.PATH_TEMPLATE_PREFIX}/${c}`,server:{port:3e3},build:{minify:!1,assetsInlineLimit:4096,rollupOptions:{output:{banner:I}},outDir:u},css:{modules:{localsConvention:"dashes"}},ppDevConfig:a,plugins:p}},exports.injectDevPanel=function(e,t,n){if(!/<\/?(html|body|head)\b/i.test(e))return e;const{css:i,js:r}=E(t),s=g(n),o=`<link rel="stylesheet" href="${i}">`,a=`${s}${`<script type="module" src="${r}"><\/script>`}`;let c=e,l=!1;if(/<\/head>/i.test(c)&&(c=c.replace(/<\/head>/i,e=>`${o}${e}`),l=!0),/<body[^>]*>/i.test(c)){const e=l?"":o;c=c.replace(/<body[^>]*>/i,t=>`${t}${e}${a}`)}else c=`${l?"":o}${c}${a}`;return c},exports.isNextAvailable=async function(){try{return b().resolve("next"),!0}catch{return!1}},exports.loadPPDevEnv=A,exports.resolveBuildCliOverrides=function(e){return{distZipEnabled:e.distZip??G(process.env.PP_DEV_DIST_ZIP),distZipDir:e.distZipDir??process.env.PP_DEV_DIST_ZIP_DIR,distZipFilename:e.distZipFilename??process.env.PP_DEV_DIST_ZIP_FILENAME,versionManifestEnabled:e.versionManifest??G(process.env.PP_DEV_VERSION_MANIFEST),versionFileTemplate:e.versionFileTemplate??process.env.PP_DEV_VERSION_FILE_TEMPLATE}},exports.safeNextImport=R,exports.withPPDev=function(e,n){return async(i,r={})=>{try{const{constants:s}=await R(),{PHASE_DEVELOPMENT_SERVER:o,PHASE_PRODUCTION_BUILD:a}=s;i!==a||process.env[t.PP_DEV_NEXT_BUILD_ENV_VAR]||t.createLogger().warn(t.colors.yellow('⚠ Building with plain `next build`. Use `pp-dev next-build` instead to get VERSION/BUILD-MANIFEST/zip build output in the same format as `pp-dev build` (see the "Next.js Build" section in the pp-dev README).'));const c=await Z(),l=H().name,p="function"==typeof e?await e(i,r):e,u=function(...e){const t={},n=t;for(const t of e)if(t)for(const[e,i]of Object.entries(t))void 0!==i&&(B.has(e)&&i&&"object"==typeof i&&!Array.isArray(i)?n[e]={...n[e]??{},...i}:n[e]=i);return t}(c,X(p),n);t.validatePPDevConfig(u,l);const d=t.normalizePPDevConfig(u,l),{templateLess:f,v7Features:m}=d,v=i===o,P=function(e,n,i,r){return i?r?n?`${t.PATH_PAGE_PREFIX}/${e}`:`${t.PATH_TEMPLATE_LOCAL_PREFIX}/${e}`:n?`${t.PATH_PAGE_PREFIX}/${e}`:`${t.PATH_TEMPLATE_PREFIX}/${e}`:`${t.PATH_PAGE_PREFIX}/${e}`}(d.templateName,f,v,m),_={basePath:P,trailingSlash:!!v||void 0};if(!f){const e=v&&m?t.PATH_TEMPLATE_LOCAL_PREFIX:t.PATH_TEMPLATE_PREFIX;_.assetPrefix=`${e}/${d.templateName}`}const E=Object.assign({},_,p);return Object.defineProperty(E,"ppDev",{value:u,enumerable:!1,configurable:!0}),E}catch(e){throw t.createLogger().error("Error in withPPDev:",{error:e instanceof Error?e:new Error(String(e))}),e}}};
|
|
2
|
-
//# sourceMappingURL=index-
|
|
1
|
+
"use strict";const e=require("child_process"),t=require("./auth.provider-CejYwjcG.js"),n=require("node:module"),i=require("vite"),r=require("fs"),s=require("path"),o=require("url");require("./helpers.js");const a=require("ejs");var c="undefined"!=typeof document?document.currentScript:null;const l=e=>e&&"object"==typeof e&&"default"in e?e.default:e;function p(e){if(e&&"object"==typeof e&&"default"in e)return e;const t=Object.create(null);if(e)for(const n in e)t[n]=e[n];return t.default=e,Object.freeze(t)}const u=p(r),d=p(s),f=l(s),m=l(a),v=d.dirname(t.PP_DEV_CLIENT_ENTRY),P=d.join(v,"index.html");let _=null;function E(e){return{css:d.posix.join(e,t.PACKAGE_NAME,"client/client.css"),js:d.posix.join(e,t.PACKAGE_NAME,"client/client.js")}}function g(e){return function(){if(_)return _;const e=u.readFileSync(P,{encoding:"utf8"});return _=m.compile(e,{openDelimiter:"{",closeDelimiter:"}",async:!1,rmWhitespace:!0,compileDebug:!1}),_}()({PACKAGE_NAME:t.PACKAGE_NAME,VERSION:t.VERSION,backendBaseURL:e.backendBaseURL,templateLess:e.templateLess,appId:e.appId,canSync:e.canSync??!0,devPanelPosition:e.devPanelPosition??"bottom-right",devPanelHidden:e.devPanelHidden??!1,devPanelAutoHide:e.devPanelAutoHide??!1})}const h={".js":"text/javascript; charset=utf-8",".css":"text/css; charset=utf-8",".map":"application/json; charset=utf-8"};const y=i.normalizePath(d.join(t.PP_DEV_PACKAGE_DIR,"dist/client")),j=new RegExp(`^\\/?${t.PACKAGE_NAME}\\/client\\/(.*)$`);const T=(e,t)=>` * ${t}`;function I(e){return`/*!\n${"***** DO NOT EDIT THIS CODE! *****\n***** ------- *****".replace(/^(.*)$/gm,T)}\n */`}async function R(){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 b=()=>n.createRequire("undefined"==typeof document?require("url").pathToFileURL(__filename).href:c&&"SCRIPT"===c.tagName.toUpperCase()&&c.src||new URL("index-Cev20Ede.js",document.baseURI).href);let D=new Set;function A(e="development",t=process.cwd()){for(const e of D)delete process.env[e];const n=new Set(Object.keys(process.env).filter(e=>e.startsWith("MI_"))),r=i.loadEnv(e,t,"MI_");for(const[e,t]of Object.entries(r))process.env[e]=t;return D=new Set(Object.keys(r).filter(e=>!n.has(e))),r}const $=new Map,w=new Map;function N(e=process.cwd()){const t=Date.now(),n=f.resolve(e),i=w.get(n);if(i&&t-i.timestamp<6e4)return i.data;try{const e=JSON.parse(r.readFileSync(f.resolve(n,"package.json"),{encoding:"utf-8",flag:"r"}));return w.set(n,{data:e,timestamp:t}),e}catch{const e={};return w.set(n,{data:e,timestamp:t}),e}}let S=null;const O="__pp_dev_injected_dirname",x="__pp_dev_injected_filename",F="__pp_dev_injected_import_meta_url",C={__dirname:O,__filename:x,"import.meta.url":F,"import.meta.dirname":O,"import.meta.filename":x},L={name:"pp-dev:config-module-location",setup(e){e.onLoad({filter:/\.([cm]?[jt]s|[jt]sx)$/},e=>{const t=r.readFileSync(e.path,"utf-8").replace(/^#![^\r\n]*/,"");return{contents:`const ${O} = ${JSON.stringify(f.dirname(e.path))};const ${x} = ${JSON.stringify(e.path)};const ${F} = ${JSON.stringify(o.pathToFileURL(e.path).href)};`+t,loader:e.path.endsWith(".tsx")?"tsx":e.path.endsWith(".jsx")?"jsx":/ts$/.test(e.path)?"ts":"js"}})}};async function M(e,t){const n=`bundled:${e}`,i=$.get(n);if(i&&Date.now()-i.timestamp<3e4)return i.data;let s=!1;if(/\.m[jt]s$/.test(e))s=!0;else if(/\.c[jt]s$/.test(e))s=!1;else{const e=N(t);s=!!e&&"module"===e.type}const a=await async function(){return S||(S=await(import("esbuild"))),S}(),c=await a.build({absWorkingDir:t,entryPoints:[e],outfile:"out.js",write:!1,target:"node24",platform:"node",bundle:!0,packages:"external",format:s?"esm":"cjs",mainFields:["main"],sourcemap:"inline",metafile:!0,plugins:[L],define:C,...s?{banner:{js:"import { createRequire as __ppDevCreateRequire } from 'node:module';const require = __ppDevCreateRequire(import.meta.url);"}}:{}}),{text:l}=c.outputFiles[0],p=`${`pp-config.timestamp-${Date.now()}-${Math.random().toString(16).slice(2)}`}.${s?"mjs":"cjs"}`,u=f.resolve(t,p),d=o.pathToFileURL(u).toString();r.writeFileSync(u,l);let m={};try{const t=(await(import(d))).default;m=t?.default||t,$.set(n,{data:m,timestamp:Date.now(),filePath:e})}finally{try{r.unlinkSync(u)}catch{}}return m}async function V(e){const t=`json:${e}`,n=$.get(t);if(n&&Date.now()-n.timestamp<3e4)return n.data;const i=JSON.parse(r.readFileSync(e,{encoding:"utf-8"}));return $.set(t,{data:i,timestamp:Date.now(),filePath:e}),i}const U=new Map;function H(e=process.cwd()){return N(e)}async function Z(e=process.cwd()){const n=f.resolve(e),i=function(e){const t=Date.now(),n=U.get(e);if(n&&t-n.timestamp<1e4)return n.files;const i=/\.config\.(([cm]?ts)|([cm]?js)|(json))$/,s=r.readdirSync(e,{withFileTypes:!0}).filter(e=>e.isFile()&&i.test(e.name)).map(e=>e.name);return U.set(e,{files:s,timestamp:t}),s}(n);let s={},o=!1;const a=await async function(e,t,n){for(const i of t)if(e.includes(i)){const e=f.resolve(n,i);if(/\.[cm]?[jt]s$/i.test(i))return await M(e,n);if(i.endsWith(".json"))return await V(e)}return null}(i,t.PP_DEV_CONFIG_NAMES,n);a&&(s=a,o=!0);const c=N(n)["pp-dev"];return o||!c||"object"!=typeof c||Array.isArray(c)||(s=c),s}const q=Object.freeze({__proto__:null,clearConfigCache:function(){$.clear(),w.clear(),U.clear()},getConfig:Z,getPkg:H});function G(e){if(void 0!==e)return"1"===e||"true"===e.toLowerCase()||"0"!==e&&"false"!==e.toLowerCase()&&void 0}function k(e,n,i){if(!1===n.distZipEnabled)return!1;if(!0!==n.distZipEnabled&&void 0===n.distZipDir&&void 0===n.distZipFilename)return!1!==e&&{...e,outFileName:t.normalizeRelativeOutputPath(e.outFileName,"ZIP output file name")};const r=!1===e?{outFileName:i,outDir:"dist-zip"}:e,s=n.distZipFilename??r.outFileName;return{...r,...void 0!==n.distZipDir?{outDir:n.distZipDir}:{},outFileName:t.normalizeRelativeOutputPath(s,"ZIP output file name")}}function z(e,n){if(!1===n.versionManifestEnabled)return!1;if(!0!==n.versionManifestEnabled&&void 0===n.versionFileTemplate)return!1!==e&&void 0!==e.versionFileTemplate?{...e,versionFileTemplate:t.normalizeRelativeOutputPath(e.versionFileTemplate,"VERSION file name template")}:e;const i=!1===e?{enabled:!0}:e,r=n.versionFileTemplate??i.versionFileTemplate,s=void 0!==r?t.normalizeRelativeOutputPath(r,"VERSION file name template"):void 0;return{...i,enabled:!0,...void 0!==s?{versionFileTemplate:s}:{}}}const B=new Set(["mi","app","proxy","build","sync","inspector","devPanel"]);function K(t){if("string"==typeof t)return t;if(t&&"object"==typeof t&&"url"in t&&"string"==typeof t.url)return t.url;const n=["CI_REPOSITORY_URL","GIT_URL","BUILD_REPOSITORY_URI","CI_PROJECT_URL","BITBUCKET_GIT_HTTP_ORIGIN","BUILDKITE_REPO"];for(const e of n){const t=process.env[e];if("string"==typeof t&&t.trim())return t}const i=process.env.GITHUB_REPOSITORY;if("string"==typeof i&&i.trim()){return`${(process.env.GITHUB_SERVER_URL||"https://github.com").replace(/\/+$/,"")}/${i.replace(/^\/+/,"")}`}const r=process.env.CI_PROJECT_PATH;if("string"==typeof r&&r.trim()){return`${(process.env.CI_SERVER_URL||"https://gitlab.com").replace(/\/+$/,"")}/${r.replace(/^\/+/,"")}`}const s=process.env.BITBUCKET_REPO_FULL_NAME;if("string"==typeof s&&s.trim())return`https://bitbucket.org/${s.replace(/^\/+/,"")}`;const o=process.env.TRAVIS_REPO_SLUG;if("string"==typeof o&&o.trim())return`https://github.com/${o.replace(/^\/+/,"")}`;try{const t=e.execSync("git config --get remote.origin.url",{encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();if(t)return t}catch{}}function X(e){return e?.ppDev||{}}exports.applyDistZipOverride=k,exports.applyVersionManifestOverride=z,exports.config=q,exports.createDevPanelAssetMiddleware=function(e){const n=d.posix.join(e,t.PACKAGE_NAME,"client")+"/",i=new Set(["client.js","client.css","client.js.map","client.css.map"]);return(e,t,r)=>{const s=(e.url??"").split("?")[0];if(!s.startsWith(n))return void r();const o=s.slice(n.length);if(!i.has(o))return void r();const a=d.join(v,o);u.readFile(a,(e,n)=>{e?r():(t.statusCode=200,t.setHeader("Content-Type",h[d.extname(o)]??"application/octet-stream"),t.setHeader("Cache-Control","no-cache"),t.end(n))})}},exports.getNextVersion=async function(){try{const e=b()("next/package.json");return"string"==typeof e.version?e.version:null}catch{return null}},exports.getPPDevConfigFromNextConfig=X,exports.getViteConfig=async function(e,n={}){const r=n.root??process.cwd();A(n.mode,r);const s=H(r),o=await Z(r);t.validatePPDevConfig(o,s.name);const a=t.normalizePPDevConfig(o,s.name),{templateName:c}=a;e&&(a.distZip=k(a.distZip,e,t.createDefaultZipFileName(c)),a.versionPlugin=z(a.versionPlugin,e));const{default:l}=await Promise.resolve().then(()=>require("./plugin.js")),p=[l(a),{name:"pp-dev:client",apply:"serve",config:e=>(e.optimizeDeps?.exclude?.push(`${t.PACKAGE_NAME}/client`),e),resolveId(e){const t=e.match(j);if(t){const e=i.normalizePath(d.join(y,t[1]));return e.startsWith(`${y}/`)?{id:e}:null}},transformIndexHtml:async(e,t)=>{const n=E(t.server?.config.base||""),i={html:e,tags:[{tag:"link",injectTo:"head",attrs:{rel:"stylesheet",href:n.css}}]},{templateLess:r=!1,...s}=t.server?.config.clientInjectionPlugin||{};return i.tags.push({tag:"div",injectTo:"body-prepend",children:g({templateLess:r,...s})}),i.tags.push({tag:"script",injectTo:"body-prepend",attrs:{src:n.js,type:"module"}}),i},configureServer(e){const n=i.normalizePath(d.resolve(e.config.root,d.dirname(t.PP_DEV_CLIENT_ENTRY)));e.config.server?.fs?.allow&&e.config.server.fs.allow.push(n)}}],{outDir:u,distZip:f,versionPlugin:m,imageOptimizer:v,templateLess:P,integrateMiTopBar:_}=a;if(_&&p.push(function(e){return{name:"mi-topbar-plugin",transformIndexHtml(){const t=[];return(!0===e||"object"==typeof e&&!0===e.addRootElement)&&t.push({tag:"div",injectTo:"body-prepend",attrs:{id:"mi-react-root"}}),(!0===e||"object"==typeof e&&!0===e.addSharedComponentsScripts)&&t.push({tag:"script",injectTo:"head-prepend",attrs:{src:"/auth/info.js"}},{tag:"script",injectTo:"head-prepend",attrs:{src:"/js/main.js",defer:"defer"}},{tag:"link",injectTo:"head-prepend",attrs:{href:"/css/main.css",rel:"stylesheet"}}),t}}}(_)),v){const{ViteImageOptimizer:e}=await(import("vite-plugin-image-optimizer"));p.push(e("object"==typeof v?v:void 0))}if(m){const{versionPlugin:e}=await Promise.resolve().then(()=>require("./version-plugin-sUHrN2Jo.js"));p.push(e({outDir:u,packageVersion:s.version??"0.0.0",packageRepositoryUrl:K(s.repository),..."object"==typeof m?m:{}}))}if(f){const{default:e}=await(import("vite-plugin-zip-pack"));p.push({...e("object"==typeof f?f:{outFileName:t.createDefaultZipFileName(c)}),enforce:"post"})}return{base:P?`${t.PATH_PAGE_PREFIX}/${c}`:`${t.PATH_TEMPLATE_PREFIX}/${c}`,server:{port:3e3},build:{minify:!1,assetsInlineLimit:4096,rollupOptions:{output:{banner:I}},outDir:u},css:{modules:{localsConvention:"dashes"}},ppDevConfig:a,plugins:p}},exports.injectDevPanel=function(e,t,n){if(!/<\/?(html|body|head)\b/i.test(e))return e;const{css:i,js:r}=E(t),s=g(n),o=`<link rel="stylesheet" href="${i}">`,a=`${s}${`<script type="module" src="${r}"><\/script>`}`;let c=e,l=!1;if(/<\/head>/i.test(c)&&(c=c.replace(/<\/head>/i,e=>`${o}${e}`),l=!0),/<body[^>]*>/i.test(c)){const e=l?"":o;c=c.replace(/<body[^>]*>/i,t=>`${t}${e}${a}`)}else c=`${l?"":o}${c}${a}`;return c},exports.isNextAvailable=async function(){try{return b().resolve("next"),!0}catch{return!1}},exports.loadPPDevEnv=A,exports.resolveBuildCliOverrides=function(e){return{distZipEnabled:e.distZip??G(process.env.PP_DEV_DIST_ZIP),distZipDir:e.distZipDir??process.env.PP_DEV_DIST_ZIP_DIR,distZipFilename:e.distZipFilename??process.env.PP_DEV_DIST_ZIP_FILENAME,versionManifestEnabled:e.versionManifest??G(process.env.PP_DEV_VERSION_MANIFEST),versionFileTemplate:e.versionFileTemplate??process.env.PP_DEV_VERSION_FILE_TEMPLATE}},exports.safeNextImport=R,exports.withPPDev=function(e,n){return async(i,r={})=>{try{const{constants:s}=await R(),{PHASE_DEVELOPMENT_SERVER:o,PHASE_PRODUCTION_BUILD:a}=s;i!==a||process.env[t.PP_DEV_NEXT_BUILD_ENV_VAR]||t.createLogger().warn(t.colors.yellow('⚠ Building with plain `next build`. Use `pp-dev next-build` instead to get VERSION/BUILD-MANIFEST/zip build output in the same format as `pp-dev build` (see the "Next.js Build" section in the pp-dev README).'));const c=await Z(),l=H().name,p="function"==typeof e?await e(i,r):e,u=function(...e){const t={},n=t;for(const t of e)if(t)for(const[e,i]of Object.entries(t))void 0!==i&&(B.has(e)&&i&&"object"==typeof i&&!Array.isArray(i)?n[e]={...n[e]??{},...i}:n[e]=i);return t}(c,X(p),n);t.validatePPDevConfig(u,l);const d=t.normalizePPDevConfig(u,l),{templateLess:f,v7Features:m}=d,v=i===o,P=function(e,n,i,r){return i?r?n?`${t.PATH_PAGE_PREFIX}/${e}`:`${t.PATH_TEMPLATE_LOCAL_PREFIX}/${e}`:n?`${t.PATH_PAGE_PREFIX}/${e}`:`${t.PATH_TEMPLATE_PREFIX}/${e}`:`${t.PATH_PAGE_PREFIX}/${e}`}(d.templateName,f,v,m),_={basePath:P,trailingSlash:!!v||void 0};if(!f){const e=v&&m?t.PATH_TEMPLATE_LOCAL_PREFIX:t.PATH_TEMPLATE_PREFIX;_.assetPrefix=`${e}/${d.templateName}`}const E=Object.assign({},_,p);return Object.defineProperty(E,"ppDev",{value:u,enumerable:!1,configurable:!0}),E}catch(e){throw t.createLogger().error("Error in withPPDev:",{error:e instanceof Error?e:new Error(String(e))}),e}}};
|
|
2
|
+
//# sourceMappingURL=index-Cev20Ede.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-DB5b_ENM.js","sources":["../../../src/lib/dev-panel.ts","../../../src/plugins/client-injection-plugin.ts","../../../src/banner/header.ts","../../../src/lib/next-import.ts","../../../src/lib/env.ts","../../../src/config.ts","../../../src/lib/build-cli-overrides.ts","../../../src/index.ts","../../../src/plugins/mi-topbar-plugin.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null],"names":["CLIENT_DIST_DIR","path","dirname","PP_DEV_CLIENT_ENTRY","TEMPLATE_PATH","join","compiledTemplate","getDevPanelAssetPaths","base","css","posix","PACKAGE_NAME","js","renderDevPanelMarkup","data","templateContent","fs","readFileSync","encoding","ejs","compile","openDelimiter","closeDelimiter","async","rmWhitespace","compileDebug","getTemplate","template","VERSION","backendBaseURL","templateLess","appId","canSync","devPanelPosition","devPanelHidden","devPanelAutoHide","CONTENT_TYPES","normalizePath","PP_DEV_PACKAGE_DIR","PACKAGE_REGEXP","RegExp","replacer","substring","$1","header","_chunk","replace","safeNextImport","next","constants","Promise","all","default","error","Error","requireFromPPDev","createRequire","previouslyLoadedKeys","Set","loadPPDevEnv","mode","envDir","process","cwd","key","env","fromEnvironment","Object","keys","filter","startsWith","loadEnv","value","entries","has","configCache","Map","packageJsonCache","getPackageJson","projectRoot","now","Date","root","resolve","cached","get","timestamp","JSON","parse","flag","set","empty","esbuildModule","MODULE_LOCATION","MODULE_LOCATION_DEFINE","__dirname","__filename","moduleLocationPlugin","name","setup","build","onLoad","args","contents","stringify","pathToFileURL","href","loader","endsWith","test","loadBundledConfig","filePath","cacheKey","isESM","pkg","type","esbuild","getEsbuild","result","absWorkingDir","entryPoints","outfile","write","target","platform","bundle","packages","format","mainFields","sourcemap","metafile","plugins","define","banner","text","code","outputFiles","fileNameTmp","Math","random","toString","slice","tempFilePath","fileUrl","writeFileSync","config","conf","unlinkSync","loadJSONConfig","dirContentCache","getPkg","getConfig","dirContent","files","endsWithRegExp","readdirSync","withFileTypes","isFile","map","getDirectoryContent","configFound","newConfig","dirFiles","configNames","configName","includes","configPath","loadConfig","PP_DEV_CONFIG_NAMES","packageConfig","Array","isArray","clear","parseBooleanFlag","undefined","toLowerCase","applyDistZipOverride","overrides","defaultFileName","distZipEnabled","distZipDir","distZipFilename","outFileName","normalizeRelativeOutputPath","baseConfig","outDir","applyVersionManifestOverride","versionManifestEnabled","versionFileTemplate","enabled","normalizedVersionFileTemplate","PP_DEV_CONFIG_GROUPS","resolveRepositoryUrl","repository","url","directCiRepositoryUrlEnvVars","variableName","ciRepositoryUrl","trim","githubRepository","GITHUB_REPOSITORY","GITHUB_SERVER_URL","gitlabProjectPath","CI_PROJECT_PATH","CI_SERVER_URL","bitbucketRepositoryFullName","BITBUCKET_REPO_FULL_NAME","travisRepositorySlug","TRAVIS_REPO_SLUG","gitRemoteOriginUrl","execSync","stdio","getPPDevConfigFromNextConfig","nextConfig","ppDev","assetPrefix","allowed","req","res","pathname","split","fileName","length","readFile","err","content","statusCode","setHeader","extname","end","nextPkg","version","environment","ppDevConfig","validatePPDevConfig","normalizedPPDevConfig","normalizePPDevConfig","templateName","distZip","createDefaultZipFileName","versionPlugin","vitePPDev","then","require","apply","optimizeDeps","exclude","push","resolveId","source","match","resolvedId","id","transformIndexHtml","html","ctx","assetPaths","server","tags","tag","injectTo","attrs","rel","panelOptions","clientInjectionPlugin","children","src","configureServer","clientDir","allow","imageOptimizer","integrateMiTopBar","addRootElement","addSharedComponentsScripts","defer","miTopBarPlugin","ViteImageOptimizer","versionPluginFn","packageVersion","packageRepositoryUrl","zipPack","enforce","PATH_PAGE_PREFIX","PATH_TEMPLATE_PREFIX","port","minify","assetsInlineLimit","rollupOptions","output","modules","localsConvention","panelMarkup","linkTag","bodyPrepend","linkInjected","headEnd","head","bodyStart","options","PP_DEV_DIST_ZIP","PP_DEV_DIST_ZIP_DIR","PP_DEV_DIST_ZIP_FILENAME","versionManifest","PP_DEV_VERSION_MANIFEST","PP_DEV_VERSION_FILE_TEMPLATE","nextjsConfig","phase","PHASE_DEVELOPMENT_SERVER","PHASE_PRODUCTION_BUILD","PP_DEV_NEXT_BUILD_ENV_VAR","createLogger","warn","colors","yellow","nextConfiguration","mergedConfig","configs","merged","mutableMerged","mergePPDevConfigs","normalized","v7Features","isDevelopment","basePath","PATH_TEMPLATE_LOCAL_PREFIX","createBasePath","trailingSlash","prefix","assign","defineProperty","enumerable","configurable","String"],"mappings":"giBA4BMA,EAAkBC,EAAKC,QAAQC,uBAC/BC,EAAgBH,EAAKI,KAAKL,EAAiB,cAEjD,IAAIM,EAA4C,KAqB1C,SAAUC,EAAsBC,GACpC,MAAO,CACLC,IAAKR,EAAKS,MAAML,KAAKG,EAAMG,EAAAA,aAAc,qBACzCC,GAAIX,EAAKS,MAAML,KAAKG,EAAMG,EAAAA,aAAc,oBAE5C,CAGM,SAAUE,EAAqBC,GAGnC,OA9BF,WACE,GAAIR,EACF,OAAOA,EAGT,MAAMS,EAAkBC,EAAGC,aAAab,EAAe,CAAEc,SAAU,SAUnE,OARAZ,EAAmBa,EAAIC,QAAQL,EAAiB,CAC9CM,cAAe,IACfC,eAAgB,IAChBC,OAAO,EACPC,cAAc,EACdC,cAAc,IAG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AcoS,EAAeD,GAEhFzI,EAAyB,CAC7B2I,WACAG,gBAAeJ,QAAuBpJ,GAGxC,IAAKhJ,EAAc,CACjB,MAAMyS,EAASL,GAAiBD,EAAaG,EAAAA,2BAA6BzC,EAAAA,qBAE1EnG,EAAW+B,YAAc,GAAGgH,KAAUP,EAAWnF,cACnD,CAKA,MAAMvH,EAASnD,OAAOqQ,OAAO,CAAA,EAAIhJ,EAAYkI,GAQ7C,OANAvP,OAAOsQ,eAAenN,EAAQ,QAAS,CACrC9C,MAAOmP,EACPe,YAAY,EACZC,cAAc,IAGTrN,CACT,CAAE,MAAOjE,GAKP,MAJeiQ,EAAAA,eAERjQ,MAAM,sBAAuB,CAAEA,MAAOA,aAAiBC,MAAQD,EAAQ,IAAIC,MAAMsR,OAAOvR,MAEzFA,CACR,EAEJ"}
|
|
1
|
+
{"version":3,"file":"index-Cev20Ede.js","sources":["../../../src/lib/dev-panel.ts","../../../src/plugins/client-injection-plugin.ts","../../../src/banner/header.ts","../../../src/lib/next-import.ts","../../../src/lib/env.ts","../../../src/config.ts","../../../src/lib/build-cli-overrides.ts","../../../src/index.ts","../../../src/plugins/mi-topbar-plugin.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null],"names":["CLIENT_DIST_DIR","path","dirname","PP_DEV_CLIENT_ENTRY","TEMPLATE_PATH","join","compiledTemplate","getDevPanelAssetPaths","base","css","posix","PACKAGE_NAME","js","renderDevPanelMarkup","data","templateContent","fs","readFileSync","encoding","ejs","compile","openDelimiter","closeDelimiter","async","rmWhitespace","compileDebug","getTemplate","template","VERSION","backendBaseURL","templateLess","appId","canSync","devPanelPosition","devPanelHidden","devPanelAutoHide","CONTENT_TYPES","normalizePath","PP_DEV_PACKAGE_DIR","PACKAGE_REGEXP","RegExp","replacer","substring","$1","header","_chunk","replace","safeNextImport","next","constants","Promise","all","default","error","Error","requireFromPPDev","createRequire","previouslyLoadedKeys","Set","loadPPDevEnv","mode","envDir","process","cwd","key","env","fromEnvironment","Object","keys","filter","startsWith","loadEnv","value","entries","has","configCache","Map","packageJsonCache","getPackageJson","projectRoot","now","Date","root","resolve","cached","get","timestamp","JSON","parse","flag","set","empty","esbuildModule","MODULE_LOCATION","MODULE_LOCATION_DEFINE","__dirname","__filename","moduleLocationPlugin","name","setup","build","onLoad","args","contents","stringify","pathToFileURL","href","loader","endsWith","test","loadBundledConfig","filePath","cacheKey","isESM","pkg","type","esbuild","getEsbuild","result","absWorkingDir","entryPoints","outfile","write","target","platform","bundle","packages","format","mainFields","sourcemap","metafile","plugins","define","banner","text","code","outputFiles","fileNameTmp","Math","random","toString","slice","tempFilePath","fileUrl","writeFileSync","config","conf","unlinkSync","loadJSONConfig","dirContentCache","getPkg","getConfig","dirContent","files","endsWithRegExp","readdirSync","withFileTypes","isFile","map","getDirectoryContent","configFound","newConfig","dirFiles","configNames","configName","includes","configPath","loadConfig","PP_DEV_CONFIG_NAMES","packageConfig","Array","isArray","clear","parseBooleanFlag","undefined","toLowerCase","applyDistZipOverride","overrides","defaultFileName","distZipEnabled","distZipDir","distZipFilename","outFileName","normalizeRelativeOutputPath","baseConfig","outDir","applyVersionManifestOverride","versionManifestEnabled","versionFileTemplate","enabled","normalizedVersionFileTemplate","PP_DEV_CONFIG_GROUPS","resolveRepositoryUrl","repository","url","directCiRepositoryUrlEnvVars","variableName","ciRepositoryUrl","trim","githubRepository","GITHUB_REPOSITORY","GITHUB_SERVER_URL","gitlabProjectPath","CI_PROJECT_PATH","CI_SERVER_URL","bitbucketRepositoryFullName","BITBUCKET_REPO_FULL_NAME","travisRepositorySlug","TRAVIS_REPO_SLUG","gitRemoteOriginUrl","execSync","stdio","getPPDevConfigFromNextConfig","nextConfig","ppDev","assetPrefix","allowed","req","res","pathname","split","fileName","length","readFile","err","content","statusCode","setHeader","extname","end","nextPkg","version","environment","ppDevConfig","validatePPDevConfig","normalizedPPDevConfig","normalizePPDevConfig","templateName","distZip","createDefaultZipFileName","versionPlugin","vitePPDev","then","require","apply","optimizeDeps","exclude","push","resolveId","source","match","resolvedId","id","transformIndexHtml","html","ctx","assetPaths","server","tags","tag","injectTo","attrs","rel","panelOptions","clientInjectionPlugin","children","src","configureServer","clientDir","allow","imageOptimizer","integrateMiTopBar","addRootElement","addSharedComponentsScripts","defer","miTopBarPlugin","ViteImageOptimizer","versionPluginFn","packageVersion","packageRepositoryUrl","zipPack","enforce","PATH_PAGE_PREFIX","PATH_TEMPLATE_PREFIX","port","minify","assetsInlineLimit","rollupOptions","output","modules","localsConvention","panelMarkup","linkTag","bodyPrepend","linkInjected","headEnd","head","bodyStart","options","PP_DEV_DIST_ZIP","PP_DEV_DIST_ZIP_DIR","PP_DEV_DIST_ZIP_FILENAME","versionManifest","PP_DEV_VERSION_MANIFEST","PP_DEV_VERSION_FILE_TEMPLATE","nextjsConfig","phase","PHASE_DEVELOPMENT_SERVER","PHASE_PRODUCTION_BUILD","PP_DEV_NEXT_BUILD_ENV_VAR","createLogger","warn","colors","yellow","nextConfiguration","mergedConfig","configs","merged","mutableMerged","mergePPDevConfigs","normalized","v7Features","isDevelopment","basePath","PATH_TEMPLATE_LOCAL_PREFIX","createBasePath","trailingSlash","prefix","assign","defineProperty","enumerable","configurable","String"],"mappings":"giBA4BMA,EAAkBC,EAAKC,QAAQC,uBAC/BC,EAAgBH,EAAKI,KAAKL,EAAiB,cAEjD,IAAIM,EAA4C,KAqB1C,SAAUC,EAAsBC,GACpC,MAAO,CACLC,IAAKR,EAAKS,MAAML,KAAKG,EAAMG,EAAAA,aAAc,qBACzCC,GAAIX,EAAKS,MAAML,KAAKG,EAAMG,EAAAA,aAAc,oBAE5C,CAGM,SAAUE,EAAqBC,GAGnC,OA9BF,WACE,GAAIR,EACF,OAAOA,EAGT,MAAMS,EAAkBC,EAAGC,aAAab,EAAe,CAAEc,SAAU,SAUnE,OARAZ,EAAmBa,EAAIC,QAAQL,EAAiB,CAC9CM,cAAe,IACfC,eAAgB,IAChBC,OAAO,EACPC,cAAc,EACdC,cAAc,IAGTnB,CACT,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eD,GAEhFzI,EAAyB,CAC7B2I,WACAG,gBAAeJ,QAAuBpJ,GAGxC,IAAKhJ,EAAc,CACjB,MAAMyS,EAASL,GAAiBD,EAAaG,EAAAA,2BAA6BzC,EAAAA,qBAE1EnG,EAAW+B,YAAc,GAAGgH,KAAUP,EAAWnF,cACnD,CAKA,MAAMvH,EAASnD,OAAOqQ,OAAO,CAAA,EAAIhJ,EAAYkI,GAQ7C,OANAvP,OAAOsQ,eAAenN,EAAQ,QAAS,CACrC9C,MAAOmP,EACPe,YAAY,EACZC,cAAc,IAGTrN,CACT,CAAE,MAAOjE,GAKP,MAJeiQ,EAAAA,eAERjQ,MAAM,sBAAuB,CAAEA,MAAOA,aAAiBC,MAAQD,EAAQ,IAAIC,MAAMsR,OAAOvR,MAEzFA,CACR,EAEJ"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";require("child_process");const e=require("./auth.provider-
|
|
1
|
+
"use strict";require("child_process");const e=require("./auth.provider-CejYwjcG.js"),r=require("./index-Cev20Ede.js"),i=require("./helpers.js");require("fs"),require("path"),require("url"),require("picocolors"),require("node:path"),require("vite"),require("node:module"),require("ejs"),exports.AuthProvider=e.AuthProvider,exports.authProvider=e.authProvider,exports.normalizePPDevConfig=e.normalizePPDevConfig,exports.validatePPDevConfig=e.validatePPDevConfig,exports.getNextVersion=r.getNextVersion,exports.getPPDevConfigFromNextConfig=r.getPPDevConfigFromNextConfig,exports.getViteConfig=r.getViteConfig,exports.isNextAvailable=r.isNextAvailable,exports.safeNextImport=r.safeNextImport,exports.withPPDev=r.withPPDev,exports.defineConfig=i.defineConfig;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e=require("fs"),i=require("path"),t=require("./auth.provider-
|
|
2
|
-
//# sourceMappingURL=migrate-
|
|
1
|
+
"use strict";const e=require("fs"),i=require("path"),t=require("./auth.provider-CejYwjcG.js");require("url"),require("picocolors"),require("node:path"),require("vite");const n=(e=>e&&"object"==typeof e&&"default"in e?e.default:e)(i),o=new Set(["backendBaseURL","personalAccessToken","miHudLess","integrateMiTopBar","v7Features","appId","portalPageId","templateName","templateLess","enableProxyCache","proxyCacheTTL","disableSSLValidation","distZip","versionPlugin","imageOptimizer","outDir","syncBackupsDir"]);const r=[".pp-watch.config.ts",".pp-watch.config.js",".pp-watch.config.json","pp-watch.config.ts","pp-watch.config.js","pp-watch.config.json"];function a(e,i=0){const t=" ".repeat(i),n=" ".repeat(i+1);if(null===e)return"null";if("boolean"==typeof e)return String(e);if("number"==typeof e)return String(e);if("string"==typeof e)return`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`;if(Array.isArray(e)){if(0===e.length)return"[]";return`[\n${e.map(e=>`${n}${a(e,i+1)}`).join(",\n")},\n${t}]`}if("object"==typeof e&&null!==e){const o=Object.entries(e).filter(([,e])=>void 0!==e);if(0===o.length)return"{}";return`{\n${o.map(([e,t])=>`${n}${e}: ${a(t,i+1)}`).join(",\n")},\n${t}}`}return String(e)}exports.discoverMigrateSource=function(i,o){let a=o??null,s=!1;if(!a){for(const o of t.PP_DEV_CONFIG_NAMES){const t=n.join(i,o);if(e.existsSync(t)){a=t;break}}if(!a)for(const t of r){const o=n.join(i,t);if(e.existsSync(o)){a=o,s=!0;break}}if(!a){const t=n.join(i,"package.json");if(e.existsSync(t))try{const i=JSON.parse(e.readFileSync(t,"utf-8"));i["pp-dev"]&&"object"==typeof i["pp-dev"]&&!Array.isArray(i["pp-dev"])&&(a=t)}catch{}}}return a?{sourceFile:a,isWatchConfig:s,isPackageJsonConfig:"package.json"===n.basename(a)}:null},exports.generateConfigFileContent=function(e,i="ts"){return"json"===i?JSON.stringify(e,null,2)+"\n":`${"ts"===i?"import { defineConfig } from '@metricinsights/pp-dev';":"const { defineConfig } = require('@metricinsights/pp-dev');"}\n\n${"ts"===i?"export default":"module.exports ="} defineConfig(${a(e)});\n`},exports.isAlreadyMigrated=function(e){const i=new Set(["mi","app","proxy","build","sync","inspector"]);return Object.keys(e).some(e=>i.has(e))},exports.isLegacyFlatConfig=function(e){return Object.keys(e).some(e=>o.has(e))},exports.isLegacyPPWatchConfig=function(e){return"baseURL"in e},exports.loadPackageJsonMigrateConfig=function(i){return JSON.parse(e.readFileSync(i,"utf-8"))["pp-dev"]},exports.migrateLegacyFlatConfig=function(e,i){const t={},n={};void 0!==e.backendBaseURL&&(n.url=e.backendBaseURL),void 0!==e.personalAccessToken&&(n.token=e.personalAccessToken),void 0!==e.miHudLess&&(n.mode=e.miHudLess?"standalone":"embedding"),e.integrateMiTopBar&&(!0===e.integrateMiTopBar?(n.mode||(n.mode="standalone"),n.include="top-bar"):"object"==typeof e.integrateMiTopBar&&(e.integrateMiTopBar.addRootElement||e.integrateMiTopBar.addSharedComponentsScripts)&&(n.mode||(n.mode="standalone"),n.include=e.integrateMiTopBar.addRootElement?"top-bar":"shared-components")),void 0!==e.v7Features&&(n.apiVersion=e.v7Features?7:6),Object.keys(n).length>0&&(t.mi=n);const o={},r=e.appId??e.portalPageId;void 0!==r&&(o.id=r),void 0!==e.templateName&&e.templateName!==i&&(o.name=e.templateName),void 0!==e.templateLess&&(o.type=e.templateLess?"page":"template"),Object.keys(o).length>0&&(t.app=o);const a={};void 0!==e.enableProxyCache&&(a.cache=e.enableProxyCache),void 0!==e.proxyCacheTTL&&(a.cacheTtl=e.proxyCacheTTL),void 0!==e.disableSSLValidation&&(a.tls={allowSelfSigned:e.disableSSLValidation}),Object.keys(a).length>0&&(t.proxy=a);const s={};if(void 0!==e.outDir&&(s.outDir=e.outDir),void 0!==e.distZip)if("object"==typeof e.distZip&&null!==e.distZip){const i={};void 0!==e.distZip.outFileName&&(i.fileName=e.distZip.outFileName),void 0!==e.distZip.outDir&&(i.outDir=e.distZip.outDir),void 0!==e.distZip.inDir&&(i.inDir=e.distZip.inDir),s.zip=!(Object.keys(i).length>0)||i}else s.zip=e.distZip;if(void 0!==e.versionPlugin)if("object"==typeof e.versionPlugin&&null!==e.versionPlugin){const i={};void 0!==e.versionPlugin.enabled&&(i.enabled=e.versionPlugin.enabled),void 0!==e.versionPlugin.versionFileTemplate&&(i.fileNameTemplate=e.versionPlugin.versionFileTemplate),s.versionFile=!(Object.keys(i).length>0)||i}else s.versionFile=e.versionPlugin;return void 0!==e.imageOptimizer&&(s.imageOptimisations=e.imageOptimizer),Object.keys(s).length>0&&(t.build=s),void 0!==e.syncBackupsDir&&(t.sync={backupsDir:e.syncBackupsDir}),t},exports.migratePPWatchConfig=function(e){const i={mi:{url:e.baseURL}};return void 0!==e.portalPageId&&(i.app={id:e.portalPageId}),i};
|
|
2
|
+
//# sourceMappingURL=migrate-MxrkBSEh.js.map
|