@lensmcp/cluster 1.24.1 → 1.24.3
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 +13 -1
- package/checkout-cache.d.ts +5 -0
- package/checkout-cache.js +1 -0
- package/create-webpack-dev.d.ts +1 -1
- package/create-webpack-dev.js +1 -1
- package/devserver-notifier.d.ts +1 -1
- package/devserver-notifier.js +1 -1
- package/devserver-transport.d.ts +41 -0
- package/devserver-transport.js +1 -0
- package/executors/gateway/manifest.js +1 -1
- package/executors/gateway/runtime/auth.d.ts +7 -0
- package/executors/gateway/runtime/auth.js +1 -1
- package/executors/gateway/runtime/chooser.d.ts +2 -1
- package/executors/gateway/runtime/chooser.js +23 -10
- package/executors/gateway/runtime/control.d.ts +14 -0
- package/executors/gateway/runtime/control.js +2 -2
- package/executors/gateway/runtime/discovery.d.ts +15 -2
- package/executors/gateway/runtime/discovery.js +1 -1
- package/executors/gateway/runtime/edge.d.ts +7 -0
- package/executors/gateway/runtime/edge.js +1 -1
- package/executors/gateway/runtime/guest-replay.d.ts +22 -0
- package/executors/gateway/runtime/guest-replay.js +2 -0
- package/executors/gateway/runtime/instance.d.ts +104 -0
- package/executors/gateway/runtime/instance.js +2 -0
- package/executors/gateway/runtime/lens-children.js +1 -1
- package/executors/gateway/runtime/lifecycle.d.ts +2 -0
- package/executors/gateway/runtime/lifecycle.js +3 -3
- package/executors/gateway/runtime/pod-probe.d.ts +17 -0
- package/executors/gateway/runtime/pod-probe.js +1 -1
- package/executors/gateway/runtime/proxy.d.ts +14 -0
- package/executors/gateway/runtime/proxy.js +1 -1
- package/executors/gateway/runtime/registration-guards.js +1 -1
- package/executors/gateway/runtime/route-registry.d.ts +7 -0
- package/executors/gateway/runtime/scope.d.ts +18 -0
- package/executors/gateway/runtime/scope.js +1 -1
- package/executors/gateway/runtime/server.js +2 -2
- package/executors/gateway/runtime/service-keys.d.ts +12 -3
- package/executors/gateway/runtime/service-keys.js +1 -1
- package/executors/gateway/runtime/shared-build.d.ts +1 -1
- package/executors/gateway/runtime/shared-build.js +3 -3
- package/executors/gateway/runtime/types.d.ts +47 -0
- package/executors/gateway/runtime/types.js +1 -1
- package/executors/gateway/runtime/upgrade.d.ts +13 -8
- package/executors/gateway/runtime/upgrade.js +1 -1
- package/executors/gateway/runtime/workspace-middleware.d.ts +38 -0
- package/executors/gateway/runtime/workspace-middleware.js +1 -0
- package/executors/gateway/runtime/workspace-registry.d.ts +7 -0
- package/executors/serve/serve.impl.js +1 -1
- package/executors/trust/trust.impl.js +3 -3
- package/inspector-secret.d.ts +6 -0
- package/inspector-secret.js +1 -1
- package/main.devserver.d.ts +4 -38
- package/main.devserver.js +10 -10
- package/package.json +4 -4
- package/shared-build/host.js +2 -2
package/shared-build/host.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var y=Object.defineProperty;var g=(l,e)=>y(l,"name",{value:e,configurable:!0});var v=Object.defineProperty,p=g((l,e)=>v(l,"name",{value:e,configurable:!0}),"p");Object.defineProperty(exports,"__esModule",{value:!0}),exports.BuildHost=exports.DEFAULT_PAUSE_MS=void 0,exports.withEnv=withEnv,exports.buildTargetString=buildTargetString;const tslib_1=require("tslib"),node_crypto_1=require("node:crypto"),path=tslib_1.__importStar(require("node:path")),dev_devtool_1=require("../dev-devtool"),create_webpack_dev_1=require("../create-webpack-dev"),perf_rules_plugin_1=require("../perf/perf-rules-plugin"),signature_1=require("./signature"),shared_compilation_1=require("./shared-compilation");exports.DEFAULT_PAUSE_MS=5e3;function withEnv(l,e){const t={...process.env};for(const r of Object.keys(process.env))delete process.env[r];for(const[r,s]of Object.entries(l))s!==void 0&&(process.env[r]=s);try{return e()}finally{for(const r of Object.keys(process.env))delete process.env[r];Object.assign(process.env,t)}}g(withEnv,"withEnv"),p(withEnv,"withEnv");function buildTargetString(l){return`${l.project}:${l.target}${l.configuration?`:${l.configuration}`:""}`}g(buildTargetString,"buildTargetString"),p(buildTargetString,"buildTargetString");const shortHash=p(l=>(0,node_crypto_1.createHash)("sha256").update(l).digest("hex").slice(0,16),"shortHash");class BuildHost{static{g(this,"BuildHost")}static{p(this,"BuildHost")}constructor(e){this.opts=e,this.groups=new Map,this.members=new Map,this.stopped=!1,this.pauseMs=e.pauseMs??exports.DEFAULT_PAUSE_MS,this.webpack=e.webpack??require("webpack")}tell(e,t){this.opts.send({type:"member",member:e,event:t})}describe(){return[...this.groups.values()].map(e=>({group:e.key,projects:e.registry.projects()}))}evaluate(e){const t=e.options;if(t.webpackConfigPath)try{delete require.cache[require.resolve(path.resolve(t.appRoot,t.webpackConfigPath))]}catch{}const r={...e.env,NODE_ENV:"development",NX_BUILD_TARGET:buildTargetString(e),NX_WORKSPACE_ROOT:this.opts.root,LENSMCP_TYPECHECK:"off"},s=withEnv(r,()=>(0,create_webpack_dev_1.createDevWebpackConfig)(t)),o=(0,signature_1.transpileCompilerOptions)(t.tsConfig,this.opts.root),n=(0,signature_1.memberSignature)({join:e,devtool:s.devtool,config:s,compilerOptions:o});return{config:s,signature:n}}join(e,t){if(this.stopped)return this.tell(e,{type:"refused",reason:"the build host is stopping"});this.leave(e,{quiet:!0});const r=(0,signature_1.refusalOf)(t,this.opts.root);if(r)return this.opts.log(`${t.project}: compiles on its own \u2014 ${r}`),this.tell(e,{type:"refused",reason:r});let s;try{s=this.evaluate(t)}catch(i){const c=`its webpack config could not be built here (${(i?.message??String(i)).split(`
|
|
1
|
+
"use strict";var y=Object.defineProperty;var g=(l,e)=>y(l,"name",{value:e,configurable:!0});var v=Object.defineProperty,p=g((l,e)=>v(l,"name",{value:e,configurable:!0}),"p");Object.defineProperty(exports,"__esModule",{value:!0}),exports.BuildHost=exports.DEFAULT_PAUSE_MS=void 0,exports.withEnv=withEnv,exports.buildTargetString=buildTargetString;const tslib_1=require("tslib"),node_crypto_1=require("node:crypto"),path=tslib_1.__importStar(require("node:path")),checkout_cache_1=require("../checkout-cache"),dev_devtool_1=require("../dev-devtool"),create_webpack_dev_1=require("../create-webpack-dev"),perf_rules_plugin_1=require("../perf/perf-rules-plugin"),signature_1=require("./signature"),shared_compilation_1=require("./shared-compilation");exports.DEFAULT_PAUSE_MS=5e3;function withEnv(l,e){const t={...process.env};for(const r of Object.keys(process.env))delete process.env[r];for(const[r,s]of Object.entries(l))s!==void 0&&(process.env[r]=s);try{return e()}finally{for(const r of Object.keys(process.env))delete process.env[r];Object.assign(process.env,t)}}g(withEnv,"withEnv"),p(withEnv,"withEnv");function buildTargetString(l){return`${l.project}:${l.target}${l.configuration?`:${l.configuration}`:""}`}g(buildTargetString,"buildTargetString"),p(buildTargetString,"buildTargetString");const shortHash=p(l=>(0,node_crypto_1.createHash)("sha256").update(l).digest("hex").slice(0,16),"shortHash");class BuildHost{static{g(this,"BuildHost")}static{p(this,"BuildHost")}constructor(e){this.opts=e,this.groups=new Map,this.members=new Map,this.stopped=!1,this.pauseMs=e.pauseMs??exports.DEFAULT_PAUSE_MS,this.webpack=e.webpack??require("webpack")}tell(e,t){this.opts.send({type:"member",member:e,event:t})}describe(){return[...this.groups.values()].map(e=>({group:e.key,projects:e.registry.projects()}))}evaluate(e){const t=e.options;if(t.webpackConfigPath)try{delete require.cache[require.resolve(path.resolve(t.appRoot,t.webpackConfigPath))]}catch{}const r={...e.env,NODE_ENV:"development",NX_BUILD_TARGET:buildTargetString(e),NX_WORKSPACE_ROOT:this.opts.root,LENSMCP_TYPECHECK:"off"},s=withEnv(r,()=>(0,create_webpack_dev_1.createDevWebpackConfig)(t)),o=(0,signature_1.transpileCompilerOptions)(t.tsConfig,this.opts.root),n=(0,signature_1.memberSignature)({join:e,devtool:s.devtool,config:s,compilerOptions:o});return{config:s,signature:n}}join(e,t){if(this.stopped)return this.tell(e,{type:"refused",reason:"the build host is stopping"});this.leave(e,{quiet:!0});const r=(0,signature_1.refusalOf)(t,this.opts.root);if(r)return this.opts.log(`${t.project}: compiles on its own \u2014 ${r}`),this.tell(e,{type:"refused",reason:r});let s;try{s=this.evaluate(t)}catch(i){const c=`its webpack config could not be built here (${(i?.message??String(i)).split(`
|
|
2
2
|
`)[0]})`;return this.opts.log(`${t.project}: compiles on its own \u2014 ${c}`),this.tell(e,{type:"refused",reason:c})}let o=this.groups.get(s.signature.key);if(!o){for(const i of this.groups.values()){const c=(0,signature_1.describeDifference)(s.signature,i.signature);this.opts.log(`${t.project}: compiled apart from ${i.registry.projects().sort().join(", ")||"the other group"} \u2014 ${c??"its compile signature differs"}`);break}try{o=this.createGroup(s,t)}catch(i){const c=`the shared compiler could not be created (${(i?.message??String(i)).split(`
|
|
3
|
-
`)[0]})`;return this.opts.log(`${t.project}: compiles on its own \u2014 ${c}`),this.tell(e,{type:"refused",reason:c})}this.groups.set(o.key,o)}this.members.set(e,{project:t.project,group:o});const n=o.projects.get(t.project)??new Set;n.add(e);const a=!o.projects.has(t.project);o.projects.set(t.project,n);const u=o.pausing.get(t.project);if(u&&(clearTimeout(u),o.pausing.delete(t.project)),this.tell(e,{type:"accepted",group:o.key,projects:[...o.projects.keys()]}),a)o.registry.set(t.project,(0,shared_compilation_1.memberEntries)(t.project,t.options)),this.opts.log(`shared compilation ${o.key.slice(0,8)}: ${o.registry.projects().sort().join(", ")}`),this.kick(o);else{const i=o.last.get(t.project);i&&this.tellBuilt(o,e,i)}}leave(e,t={}){const r=this.members.get(e);if(!r)return;this.members.delete(e);const{project:s,group:o}=r;o.told.delete(e),o.toldFiles.delete(e);const n=o.projects.get(s);if(n?.delete(e),n&&n.size>0)return;t.quiet||this.opts.log(`${s}: no member left \u2014 its entries pause in ${Math.round(this.pauseMs/1e3)} s`);const a=setTimeout(()=>this.pause(o,s),this.pauseMs);a.unref?.(),o.pausing.set(s,a)}pause(e,t){if(e.pausing.delete(t),!((e.projects.get(t)?.size??0)>0)){if(e.projects.delete(t),e.registry.delete(t),e.last.delete(t),e.projects.size===0){this.opts.log(`shared compilation ${e.key.slice(0,8)}: no service left \u2014 closed`),this.groups.delete(e.key),this.closeGroup(e);return}this.opts.log(`shared compilation ${e.key.slice(0,8)}: ${t} paused \u2014 ${e.registry.projects().sort().join(", ")}`),this.kick(e)}}kick(e){if(e.watching){e.watching.invalidate();return}e.watching=e.compiler.watch(e.watchOptions,(t,r)=>this.onBuild(e,t,r))}createGroup(e,t){const r=e.signature.key,s=new shared_compilation_1.EntryRegistry,o=t.options,n=e.config,a=n.devtool,u=path.join(this.opts.root,"
|
|
3
|
+
`)[0]})`;return this.opts.log(`${t.project}: compiles on its own \u2014 ${c}`),this.tell(e,{type:"refused",reason:c})}this.groups.set(o.key,o)}this.members.set(e,{project:t.project,group:o});const n=o.projects.get(t.project)??new Set;n.add(e);const a=!o.projects.has(t.project);o.projects.set(t.project,n);const u=o.pausing.get(t.project);if(u&&(clearTimeout(u),o.pausing.delete(t.project)),this.tell(e,{type:"accepted",group:o.key,projects:[...o.projects.keys()]}),a)o.registry.set(t.project,(0,shared_compilation_1.memberEntries)(t.project,t.options)),this.opts.log(`shared compilation ${o.key.slice(0,8)}: ${o.registry.projects().sort().join(", ")}`),this.kick(o);else{const i=o.last.get(t.project);i&&this.tellBuilt(o,e,i)}}leave(e,t={}){const r=this.members.get(e);if(!r)return;this.members.delete(e);const{project:s,group:o}=r;o.told.delete(e),o.toldFiles.delete(e);const n=o.projects.get(s);if(n?.delete(e),n&&n.size>0)return;t.quiet||this.opts.log(`${s}: no member left \u2014 its entries pause in ${Math.round(this.pauseMs/1e3)} s`);const a=setTimeout(()=>this.pause(o,s),this.pauseMs);a.unref?.(),o.pausing.set(s,a)}pause(e,t){if(e.pausing.delete(t),!((e.projects.get(t)?.size??0)>0)){if(e.projects.delete(t),e.registry.delete(t),e.last.delete(t),e.projects.size===0){this.opts.log(`shared compilation ${e.key.slice(0,8)}: no service left \u2014 closed`),this.groups.delete(e.key),this.closeGroup(e);return}this.opts.log(`shared compilation ${e.key.slice(0,8)}: ${t} paused \u2014 ${e.registry.projects().sort().join(", ")}`),this.kick(e)}}kick(e){if(e.watching){e.watching.invalidate();return}e.watching=e.compiler.watch(e.watchOptions,(t,r)=>this.onBuild(e,t,r))}createGroup(e,t){const r=e.signature.key,s=new shared_compilation_1.EntryRegistry,o=t.options,n=e.config,a=n.devtool,u=path.join((0,checkout_cache_1.checkoutCacheDir)(this.opts.root,"lensmcp-build"),r,"out"),i=(0,create_webpack_dev_1.devCacheOptions)(o,a),c={key:r,signature:e.signature,registry:s,projects:new Map,pausing:new Map,last:new Map,told:new Map,toldFiles:new Map,compiler:void 0,watching:void 0,watchOptions:{},sourceMaps:!1,webpackVersion:""},h=n.plugins.filter(f=>!signature_1.PER_SERVICE_PLUGINS.has(f?.constructor?.name));h.push(new perf_rules_plugin_1.PerfRulesPlugin({project:t.project,workspaceRoot:this.opts.root,tsConfig:o.tsConfig,entries:p(()=>s.entryProjects(),"entries")}),new shared_compilation_1.SharedEntriesPlugin({registry:s,workspaceRoot:this.opts.root,outputPath:u,cache:{...i,name:`shared-${r}`,version:`${i.version}-${r}`}}),{apply:p(f=>{f.hooks.watchRun.tap("LensmcpSharedBuild",m=>{const j=[...m.modifiedFiles??[],...m.removedFiles??[]].filter(b=>typeof b=="string").slice(-32);for(const b of this.membersOf(c))this.tell(b,{type:"watch-run",paths:j})}),f.hooks.watchClose.tap("LensmcpSharedBuild",()=>{for(const m of this.membersOf(c))this.tell(m,{type:"watch-closed"})})},"apply")});const d={...n,plugins:h};delete d.watch,c.watchOptions=n.watchOptions??{};const w={...t.env,NODE_ENV:"development",NX_BUILD_TARGET:buildTargetString(t),NX_WORKSPACE_ROOT:this.opts.root,LENSMCP_TYPECHECK:"off"};return c.compiler=withEnv(w,()=>this.webpack(d)),c.sourceMaps=(0,dev_devtool_1.bundleCarriesSourceMaps)(c.compiler.options.devtool),c.webpackVersion=String(c.compiler.webpack?.version??"5"),c}membersOf(e){const t=[];for(const r of e.projects.values())t.push(...r);return t}onBuild(e,t,r){if(this.stopped)return;if(t){const i=t?.message??String(t);this.opts.log(`shared compilation ${e.key.slice(0,8)} failed: ${i}`);for(const c of this.membersOf(e))this.tell(c,{type:"failed",message:i});return}const s=r,o=Math.max(0,(s.endTime??0)-(s.startTime??0)),n=(0,shared_compilation_1.attributeCompilation)(s.compilation,e.registry),a=[];for(const[i,c]of n){e.last.get(i)?.attribution.hash!==c.hash&&a.push(i);const h={attribution:c,durationMs:o};e.last.set(i,h);for(const d of e.projects.get(i)??[])this.tellBuilt(e,d,h)}const u=[...n.values()].filter(i=>i.errorCount>0).map(i=>i.project);this.opts.log(`built ${[...n.keys()].sort().join(", ")||"nothing"} in ${o} ms \u2014 ${a.length?`changed: ${a.sort().join(", ")}`:"no bundle changed"}${u.length?`; errors in: ${u.sort().join(", ")}`:""}`)}tellBuilt(e,t,r){const s=r.attribution,o=e.told.get(t)!==s.hash;e.told.set(t,s.hash);const n=shortHash([...s.files].sort().join(`
|
|
4
4
|
`)),a=e.toldFiles.get(t)!==n;e.toldFiles.set(t,n),this.tell(t,{type:"built",ok:s.errorCount===0,changed:o,hash:s.hash,text:(0,shared_compilation_1.describeBuild)(s,{webpackVersion:e.webpackVersion,durationMs:r.durationMs,changed:o}),errors:s.errorCount,warnings:s.warningCount,durationMs:r.durationMs,sourceMaps:e.sourceMaps,...a?{files:s.files}:{}})}closeGroup(e){for(const o of e.pausing.values())clearTimeout(o);e.pausing.clear();const t=e.compiler,r=e.watching;e.watching=void 0;const s=p(()=>{try{t?.close?.(()=>{})}catch{}},"closeCompiler");r?r.close(s):s()}stop(e=5e3){this.stopped=!0;const t=[...this.groups.values()];return this.groups.clear(),this.members.clear(),new Promise(r=>{let s=t.length;if(s===0)return r();const o=setTimeout(r,e);o.unref?.();for(const n of t){for(const c of n.pausing.values())clearTimeout(c);const a=p(()=>{--s===0&&(clearTimeout(o),r())},"done"),u=n.compiler,i=p(()=>{try{u.close(()=>a())}catch{a()}},"closeCompiler");n.watching?n.watching.close(i):i()}})}}exports.BuildHost=BuildHost;
|