@lmjs/cli 2.8.0 → 2.8.2
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.
|
@@ -28,7 +28,7 @@ var cl=console.log;var LumenJS_HTML_SNIFF_RE=/([&][a-zA-Z]*[;]+)|<\/?[a-z][\s\S]
|
|
|
28
28
|
|
|
29
29
|
var _reactiveEngines=[];var _rxMoustache=/\{\s*\{\s*([\s\S]*?)\s*\}\s*\}/g;var _rxVoid={area:1,base:1,basefont:1,bgsound:1,br:1,col:1,command:1,embed:1,frame:1,hr:1,image:1,img:1,input:1,isindex:1,keygen:1,link:1,menuitem:1,meta:1,nextid:1,param:1,source:1,track:1,wbr:1};var _rxSkip={};"break case catch class const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield await async of static get set null true false undefined NaN Infinity Object Function Boolean Symbol Error Number BigInt Math Date String RegExp Array Map Set WeakMap WeakSet Promise Reflect Proxy Intl JSON console window document navigator location localStorage sessionStorage fetch setTimeout clearTimeout setInterval clearInterval parseInt parseFloat isFinite isNaN encodeURI decodeURI encodeURIComponent decodeURIComponent escape unescape globalThis".split(" ").forEach(function(w){_rxSkip[w]=1});var _rxExprCache=new Map;function _rxKeepOneSpace(t){t=t.replace(/\s\s/gm," ");if(/\s\s/gm.test(t))return _rxKeepOneSpace(t);return t}function _rxClean(t){t=t.replace(/(\r?\n|\r)/gm,"");t=t.replace(/(\t)/gm,"");t=_rxKeepOneSpace(t);return t.replace(/^(?:\s*\t*\r*\n*\{*)+|(?:\s*\t*\r*\n*\})+$/g,"").trim()}function _rxIdents(src,out){var i=0,n=src.length,prev="";function skipTemplate(){i++;while(i<n){var c=src[i];if(c==="\\"){i+=2;continue}if(c==="`"){i++;return}if(c==="$"&&src[i+1]==="{"){i+=2;var depth=1,start=i;while(i<n&&depth){var d=src[i];if(d==="`"){var s=i;skipTemplate();continue}if(d==="{")depth++;else if(d==="}"){depth--;if(!depth)break}else if(d==="'"||d==='"'){var q=d;i++;while(i<n&&src[i]!==q){if(src[i]==="\\")i++;i++}}i++}_rxIdents(src.slice(start,i),out);i++;continue}i++}}while(i<n){var ch=src[i];if(ch==="'"||ch==='"'){i++;while(i<n&&src[i]!==ch){if(src[i]==="\\")i++;i++}i++;prev="s";continue}if(ch==="`"){skipTemplate();prev="s";continue}if(ch==="/"&&src[i+1]==="/"){while(i<n&&src[i]!=="\n")i++;continue}if(ch==="/"&&src[i+1]==="*"){var e=src.indexOf("*/",i+2);i=e<0?n:e+2;continue}if(/\s/.test(ch)){i++;continue}if(/[0-9]/.test(ch)){while(i<n&&/[\w.]/.test(src[i]))i++;prev="n";continue}if(/[A-Za-z_$]/.test(ch)){var st=i;while(i<n&&/[\w$]/.test(src[i]))i++;var id=src.slice(st,i);var j=i;while(j<n&&/\s/.test(src[j]))j++;var isKey=src[j]===":"&&(prev==="{"||prev===",");if(prev!=="."&&!isKey&&!_rxSkip[id]&&out.indexOf(id)===-1)out.push(id);prev="i";continue}prev=ch;i++}return out}function _rxExpr(mux){var hit=_rxExprCache.get(mux);if(hit)return hit;var rv=null;try{new Function(mux);rv=_rxIdents(mux,[])}catch(e){rv=null}if(_rxExprCache.size>2e3)_rxExprCache.clear();_rxExprCache.set(mux,rv);return rv}function _rxEscape(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function _rxMustaches(text,escapeStatic,rvSet){var found=[],m,last=0;_rxMoustache.lastIndex=0;while((m=_rxMoustache.exec(text))!=null){var mux=_rxClean(m[0]);var rvs=_rxExpr(mux);if(rvs)found.push({index:m.index,len:m[0].length,mux,rvs})}if(!found.length)return{content:escapeStatic?_rxEscape(text):text,mss:[]};var esc=escapeStatic?_rxEscape:function(s){return s};var content="",mss=[];for(var k=0;k<found.length;k++){var f=found[k];content+=esc(text.substring(last,f.index));var start=content.length;content+="{{"+f.mux+"}}";mss.push({mus:f.mux,jst:null,rvs:f.rvs.slice(),start,end:content.length});for(var r=0;r<f.rvs.length;r++)rvSet[f.rvs[r]]=1;last=f.index+f.len}content+=esc(text.substring(last));return{content,mss}}function _rxForX(val){var forX={js:"",as:{k:"",v:""},dx:""};val=val.trim();if(val.indexOf(";")>-1){var zxx=val.split(";");forX.dx=zxx[1].trim();val=zxx[0].trim()}if(val.indexOf(" as ")>-1){var arr2=val.split(" as ");var arr3=arr2[1].split(" ").join("").split(",");forX.as.k=arr3[0].trim();if(arr3.length>1)forX.as.v=arr3[1].trim();val=arr2[0].trim()}forX.js=val.trim();return forX}function _rxCompileNode(n,ptag,rvSet){if(n.nodeType===3){var t=n.nodeValue;var mm=_rxMustaches(t,ptag!=="style",rvSet);if(ptag==="textarea"&&mm.mss.length)mm=_rxMustaches(t,false,rvSet);return{type:"text",content:mm.content,mss:mm.mss,tag:ptag}}if(n.nodeType!==1)return null;var name=n.localName;if(name==="script")return null;var res={type:"tag",name,isV:!!_rxVoid[name],attrs:{},ax:{},evs:{},ex:{},children:[]};if(n.namespaceURI==="http://www.w3.org/2000/svg")res.svg=true;var attrs=n.attributes;for(var a=0;a<attrs.length;a++){var an=attrs[a].name,av=attrs[a].value;if(an===":else"){res.type="section";res.cond=""}else if(an===":if"||an===":else-if"){res.type="section";res.cond=av;_rxIdents(av,[]).forEach(function(id){rvSet[id]=1})}else if(an===":for"){res.type="sections";res.content=av;res.forX=_rxForX(av);if(res.forX.js)_rxIdents(res.forX.js,[]).forEach(function(id){rvSet[id]=1})}var ms=_rxMustaches(an.charAt(0)==="@"?av:av.replace(/`(\{\s*\{[\s\S]*?\}\s*\})`/g,"$1"),false,rvSet);if(an.charAt(0)==="@"){res.evs[an]=ms.content;if(ms.mss.length)res.ex[an]=ms.mss}else{res.attrs[an]=ms.content;if(ms.mss.length)res.ax[an]=ms.mss}}_rxOrderIfFor(res);if(!res.isV){var kids=n.childNodes;for(var c=0;c<kids.length;c++){var ch=_rxCompileNode(kids[c],name,rvSet);if(ch)res.children.push(ch)}if(name==="style"&&!res.children.length)res.children.push({type:"text",content:"",mss:[],tag:"style"})}return res}function _rxOrderIfFor(res){if(!res||!res.attrs||!res.forX||!Object.prototype.hasOwnProperty.call(res.attrs,":if"))return;var keys=Object.keys(res.attrs);var cond=String(res.attrs[":if"]);if(keys.indexOf(":if")<keys.indexOf(":for"))res.forX.js="("+cond+") ? ("+res.forX.js+") : []";else res.attrs[":for-if"]=res.attrs[":for-if"]?"("+res.attrs[":for-if"]+") && ("+cond+")":cond;res.type="sections";delete res.cond;delete res.attrs[":if"];if(res.ax)delete res.ax[":if"]}function _rxCompileHost(host){var rvSet={},hst=[],kids=host.childNodes;for(var i=0;i<kids.length;i++){var c=_rxCompileNode(kids[i],host.localName,rvSet);if(c)hst.push(c)}return{hst,reactiveVars:Object.keys(rvSet)}}async function _rxRender(host){host.classList.add("binded");var compiled=_rxCompileHost(host);var sub=null;for(var p=host.parentNode;p;p=p.parentNode){if(p.isSub===true){sub=p;break}}var _re=await renderHST(compiled,"reactive","section",void 0,null,["View"],sub?sub.vars:void 0,sub?sub.fns:void 0);_re._blankUnresolved=true;var bindEl=host.closest("[bind]");if(bindEl){String(bindEl.getAttribute("bind")||"").split(",").forEach(function(v){var parts=v.trim().split(" as ");if(parts.length===2&&parts[0].trim()&&parts[1].trim()){try{_re.vrs[parts[1].trim()]=_re.scopedEval(_re.reactiveVariables,parts[0].trim())}catch(e){}}})}host.textContent="";host.append.apply(host,_re._RealDOM);_re._rxHost=host;_reactiveEngines.push(_re);_re.renderAll("section")}function _updateReactiveEngines(varName){for(var i=_reactiveEngines.length-1;i>=0;i--){var re=_reactiveEngines[i];if(!re._rxHost||!re._rxHost.isConnected){_reactiveEngines.splice(i,1);continue}try{re.update(varName)}catch(e){cl(e)}}}(function(){if(typeof MutationObserver==="undefined"||typeof document==="undefined"||!document.documentElement)return;var pending=[],running=false;function consider(node){if(!node||node.nodeType!==1||node._ownerRe)return;if(node.hasAttribute("reactive"))pending.push(node);if(node.firstElementChild){var found=node.querySelectorAll("[reactive]");for(var i=0;i<found.length;i++)pending.push(found[i])}}async function drain(){if(running)return;running=true;var rendered=0;try{while(pending.length){var h=pending.shift();if(!h.isConnected||h._ownerRe||h.classList.contains("binded"))continue;try{await _rxRender(h);rendered++}catch(e){reportLumenError({stage:"reactive",error:e})}}}finally{running=false}if(rendered&&typeof globalWatch==="function"){try{globalWatch()}catch(e){reportLumenError({stage:"reactive",error:e})}}}new MutationObserver(function(records){for(var r=0;r<records.length;r++){var added=records[r].addedNodes;for(var k=0;k<added.length;k++)consider(added[k])}if(pending.length)drain()}).observe(document.documentElement,{childList:true,subtree:true});function scan(){consider(document.documentElement);if(pending.length)drain()}if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",scan);else setTimeout(scan,0)})();
|
|
30
30
|
|
|
31
|
-
var LM_BUILD=(function(){try{var m=/\/js\/app\.(\d+)\.js/.exec(document.currentScript&&document.currentScript.src||(function(){var s=document.querySelectorAll('script[src*="/js/app."]');return s.length?s[s.length-1].src:""})());
|
|
31
|
+
var LM_BUILD=0;var LM_VERSION="dev";var _lmBuildCache=0;function _lmVersionOf(build){var d=new Date(build);var p=function(n){return(n<10?"0":"")+n};return d.getUTCFullYear()+"."+p(d.getUTCMonth()+1)+"."+p(d.getUTCDate())+"."+p(d.getUTCHours())+p(d.getUTCMinutes())}function lmBuildStamp(){if(_lmBuildCache)return _lmBuildCache;try{var m=/\/js\/app\.(\d+)\.js/.exec(document.currentScript&&document.currentScript.src||(function(){var s=document.querySelectorAll('script[src*="/js/app."]');return s.length?s[s.length-1].src:""})());_lmBuildCache=m&&parseInt(m[1],10)||0}catch(e){_lmBuildCache=0}if(_lmBuildCache){LM_BUILD=_lmBuildCache;LM_VERSION=_lmVersionOf(_lmBuildCache)}return _lmBuildCache}var _lmUpdateShown=false;function _lmUpdateOpts(){var o=typeof appSettings!=="undefined"&&appSettings?appSettings.updateCheck:void 0;if(o===false)return null;return o&&typeof o==="object"?o:{}}function _lmShowUpdateBar(opts,latest){if(_lmUpdateShown)return;_lmUpdateShown=true;var reload=function(){var done=false;var go2=function(){if(!done){done=true;location.reload()}};setTimeout(go2,4e3);try{fetch(location.href,{cache:"reload",credentials:"same-origin"}).then(go2,go2)}catch(e){go2()}};if(typeof opts.onUpdate==="function"){try{opts.onUpdate({current:lmBuildStamp(),latest,reload})}catch(e){cl(e)}return}if(!document.getElementById("lm-update-style")){var st=document.createElement("style");st.id="lm-update-style";st.textContent=".lm-update-bar{position:fixed;left:50%;bottom:22px;transform:translateX(-50%);z-index:100001;display:flex;align-items:center;gap:14px;max-width:calc(100vw - 32px);padding:10px 12px 10px 18px;background:var(--color-card-background,#1c1c1e);border:1px solid var(--color-border--dark,#333);border-radius:12px;box-shadow:0 16px 40px -10px rgba(0,0,0,.55);color:var(--color-text,#e8e8e8);font-size:13px;font-family:inherit}.lm-update-go{background:#e5484d;color:#fff;border:0;border-radius:8px;padding:6px 14px;font-weight:700;cursor:pointer;font-size:13px}.lm-update-x{background:none;border:0;color:#8a8a8a;font-size:18px;line-height:1;cursor:pointer;padding:2px 4px}.lm-update-x:hover{color:var(--color-text,#e8e8e8)}";document.head.appendChild(st)}var bar=document.createElement("div");bar.className="lm-update-bar";bar.setAttribute("role","status");var msg=document.createElement("span");msg.textContent=opts.message||"A new version is available.";var go=document.createElement("button");go.type="button";go.className="lm-update-go";go.textContent=opts.buttonText||"Reload";go.onclick=reload;var x=document.createElement("button");x.type="button";x.className="lm-update-x";x.setAttribute("aria-label","Dismiss");x.textContent="\xD7";x.onclick=function(){if(bar.parentNode)bar.parentNode.removeChild(bar)};bar.appendChild(msg);bar.appendChild(go);bar.appendChild(x);document.body.appendChild(bar)}function _lmAssetSig(html){var out=[];var re=/<(?:script|link)\b[^>]*?\b(?:src|href)\s*=\s*["']([^"']+)["'][^>]*>/gi,m;while(m=re.exec(html||"")){var u=m[1];if(/^(?:https?:)?\/\//i.test(u)||/^(?:data|blob|mailto):/i.test(u))continue;if(/\.(?:js|mjs|css)(?:[?#]|$)/i.test(u))out.push(u)}var b=/<meta\b[^>]*name\s*=\s*["']lm-build["'][^>]*content\s*=\s*["']([^"']*)["']/i.exec(html||"")||/<meta\b[^>]*content\s*=\s*["']([^"']*)["'][^>]*name\s*=\s*["']lm-build["']/i.exec(html||"");if(b)out.push("lm-build="+b[1]);return out.sort().join("|")}var _lmBaseSig=null;function lmCheckForUpdate(){var build=lmBuildStamp();var opts=_lmUpdateOpts();if(!opts||!build||_lmUpdateShown||typeof fetch!=="function")return Promise.resolve(false);var url=opts.url||"/";return fetch(url+(url.indexOf("?")>-1?"&":"?")+"_v="+Date.now(),{cache:"no-store",credentials:"same-origin"}).then(function(r){return r.ok?r.text():""}).then(function(html){if(!html)return false;var m=/\/js\/app\.(\d+)\.js/.exec(html);var latest=m?parseInt(m[1],10):0;if(latest>build){_lmShowUpdateBar(opts,latest);return true}var sig=_lmAssetSig(html);if(_lmBaseSig===null)_lmBaseSig=sig;if(latest===build&&sig!==_lmBaseSig){_lmShowUpdateBar(opts,latest);return true}return false}).catch(function(){return false})}(function(){function start(){lmBuildStamp();document.addEventListener("visibilitychange",function(){if(document.visibilityState==="visible")lmCheckForUpdate()});var opts=_lmUpdateOpts();if(!opts)return;var first=opts.firstCheckMs>0?opts.firstCheckMs:15e3;var tries=0;function tick(){var o=_lmUpdateOpts();if(!o)return;if(!lmBuildStamp()){tries+=1;if(tries<20)setTimeout(tick,first);return}lmCheckForUpdate();var every=o.interval>0?o.interval:5*60*1e3;setInterval(lmCheckForUpdate,every)}setTimeout(tick,first)}if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",start);else start()})();
|
|
32
32
|
|
|
33
33
|
!(function(a,b){"function"==typeof define&&define.amd?define([],b):"undefined"!=typeof module&&module.exports?module.exports=b():a.ReconnectingWebSocket=b()})(this,function(){function a(b,c,d){function l(a2,b2){var c2=document.createEvent("CustomEvent");return c2.initCustomEvent(a2,false,false,b2),c2}var e={debug:false,automaticOpen:true,reconnectInterval:1e3,maxReconnectInterval:3e4,reconnectDecay:1,timeoutInterval:3e3};d||(d={});for(var f in e)this[f]="undefined"!=typeof d[f]?d[f]:e[f];this.url=b,this.reconnectAttempts=0,this.readyState=WebSocket.CONNECTING,this.protocol=null;var h,g=this,i2=false,j=false,k=document.createElement("div");k.addEventListener("open",function(a2){g.onopen(a2)}),k.addEventListener("close",function(a2){g.onclose(a2)}),k.addEventListener("connecting",function(a2){g.onconnecting(a2)}),k.addEventListener("message",function(a2){g.onmessage(a2)}),k.addEventListener("error",function(a2){g.onerror(a2)}),this.addEventListener=k.addEventListener.bind(k),this.removeEventListener=k.removeEventListener.bind(k),this.dispatchEvent=k.dispatchEvent.bind(k),this.open=function(b2){try{h=new WebSocket(g.url,c||[]),b2||k.dispatchEvent(l("connecting")),(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","attempt-connect",g.url);var d2=h,e2=setTimeout(function(){(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","connection-timeout",g.url),j=true,j=false;if(d2.readyState==1)d2.close()},g.timeoutInterval);h.onopen=function(){clearTimeout(e2),(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onopen",g.url),g.protocol=h.protocol,g.readyState=WebSocket.OPEN,g.reconnectAttempts=0;var d3=l("open");d3.isReconnect=b2,b2=false,k.dispatchEvent(d3)},h.onclose=function(c2){if(clearTimeout(e3),h=null,i2)g.readyState=WebSocket.CLOSED,k.dispatchEvent(l("close"));else{g.readyState=WebSocket.CONNECTING;var d3=l("connecting");d3.code=c2.code,d3.reason=c2.reason,d3.wasClean=c2.wasClean,k.dispatchEvent(d3),b2||j||((g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onclose",g.url),k.dispatchEvent(l("close")));var e3=g.reconnectInterval*Math.pow(g.reconnectDecay,g.reconnectAttempts);setTimeout(function(){g.reconnectAttempts++,g.open(true)},e3>g.maxReconnectInterval?g.maxReconnectInterval:e3)}},h.onmessage=function(b3){(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onmessage",g.url,b3.data);var c2=l("message");c2.data=b3.data,k.dispatchEvent(c2)},h.onerror=function(b3){(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","onerror",g.url,b3),k.dispatchEvent(l("error"))}}catch(error){console.error("WebSocket connection error:",error)}},1==this.automaticOpen&&this.open(false),this.send=function(b2){if(h)return(g.debug||a.debugAll)&&console.debug("ReconnectingWebSocket","send",g.url,b2),h.send(b2);throw"INVALID_STATE_ERR : Pausing to reconnect websocket"},this.close=function(a2,b2){"undefined"==typeof a2&&(a2=1e3),i2=true,h&&h.close(a2,b2)},this.refresh=function(){h&&h.readyState==1&&h.close()}}return a.prototype.onopen=function(){},a.prototype.onclose=function(){},a.prototype.onconnecting=function(){},a.prototype.onmessage=function(){},a.prototype.onerror=function(){},a.debugAll=false,a.CONNECTING=WebSocket.CONNECTING,a.OPEN=WebSocket.OPEN,a.CLOSING=WebSocket.CLOSING,a.CLOSED=WebSocket.CLOSED,a});let _isTipped=false;var _debugMode=false;var _initialized=null;var _dbcrs={};var _dbcrsTime=200;var _tickTime=20;var _scW=0;var cl=console.log;if(!_vcData)var _vcData=void 0;if(!_beaTn)var _beaTn=void 0;var beas;var appSettings;var execEl="";var currentlyValidTags=new Array;var _upwrk=new WebWorker("_upw");var _csswrk=new WebWorker("_cssw");_csswrk.start();var _ups=[];(function(e,t2){typeof module!="undefined"&&module.exports?module.exports=t2():typeof define=="function"&&define.amd?define(t2):this[e]=t2()})("bea",function(){function p(e2,t3){for(var n3=0,i3=e2.length;n3<i3;++n3)if(!t3(e2[n3]))return r2;return 1}function d(e2,t3){p(e2,function(e3){return t3(e3),1})}function v(e2,t3,n3){function g(e3){return e3.call?e3():u[e3]}function y(){if(!--h2){u[o2]=1,s2&&s2();for(var e3 in f)p(e3.split("|"),g)&&!d(f[e3],g)&&(f[e3]=[])}}e2=e2[i2]?e2:[e2];var r3=t3&&t3.call,s2=r3?t3:n3,o2=r3?e2.join(""):t3,h2=e2.length;return setTimeout(function(){d(e2,function t4(e3,n4){if(e3===null)return y();/*!n &&
|
|
34
34
|
!/^https?:\/\//.test(e) &&
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
const fs=require("fs");const path=require("path");const esbuild=require("esbuild");const CORE_PACKAGE_DIR=path.dirname(require.resolve("@lmjs/core/package.json"));const registry=require(path.join(CORE_PACKAGE_DIR,"build","plugins-registry.js"));function resolveCoreModule(npmPath){return require.resolve(npmPath,{paths:[CORE_PACKAGE_DIR]})}function selectedRegistryEntries(projectDeps){const selected=registry.filter(e=>projectDeps.hasOwnProperty(e.key));if(selected.length===0)return[];const need=new Set(selected.map(e=>e.key));for(const e of selected){for(const dep of e.after){if(!need.has(dep)){console.log(`LumenJS: "${e.key}" requires "${dep}" \u2014 auto-including it.`);need.add(dep)}}}for(const e of registry){if(e.always)need.add(e.key)}if(need.has("jquery"))need.add("jquery-form");return registry.filter(e=>need.has(e.key))}exports.selectedRegistryEntries=selectedRegistryEntries;async function buildJqueryPiece(entry){const npmPath=[].concat(entry.npm)[0];const result=await esbuild.build({stdin:{contents:`import __jquery from ${JSON.stringify(npmPath)};
|
|
2
2
|
window.jQuery = window.$ = __jquery;`,resolveDir:CORE_PACKAGE_DIR,loader:"js"},bundle:true,format:"cjs",platform:"browser",target:["es2019"],write:false,minify:false,logLevel:"silent"});const parts=[result.outputFiles[0].text];if(entry.code)parts.push(entry.code);return parts.join(";\n")}async function buildCjsFactoryPiece(entry){const npmPath=[].concat(entry.npm)[0];const result=await esbuild.build({stdin:{contents:`import __factory from ${JSON.stringify(npmPath)};
|
|
3
|
-
if (typeof __factory === "function") __factory(window, window.jQuery);`,resolveDir:CORE_PACKAGE_DIR,loader:"js"},bundle:true,format:"cjs",platform:"browser",target:["es2019"],write:false,minify:false,logLevel:"silent"});const parts=[result.outputFiles[0].text];if(entry.code)parts.push(entry.code);return parts.join(";\n")}function buildPlainPiece(entry){const parts=[];for(const npmPath of[].concat(entry.npm||[])){let src=fs.readFileSync(resolveCoreModule(npmPath),"utf8");if(entry.patch)src=entry.patch(src);parts.push(src)}if(entry.code)parts.push(entry.code);return parts.join(";\n")}async function buildEntryPiece(entry){if(entry.key==="jquery")return buildJqueryPiece(entry);if(entry.cjsFactory)return buildCjsFactoryPiece(entry);return buildPlainPiece(entry)}function createPatchPlugin(entries){const patchable=entries.filter(e=>e.patch);return{name:"lumenjs-plugins-patch",setup(build){for(const e of patchable){for(const npmPath of[].concat(e.npm||[])){const escaped=npmPath.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");const filter=new RegExp(escaped.split("/").join("[\\\\/]")+"$");build.onLoad({filter},async args=>{let src=await fs.promises.readFile(args.path,"utf8");return{contents:e.patch(src),loader:"js"}})}}}}}exports.createPatchPlugin=createPatchPlugin;async function buildSelectedCss(entries){const less=require("less");const parts=[];for(const e of entries){if(e.css){for(const cssPath of[].concat(e.css)){let src=fs.readFileSync(resolveCoreModule(cssPath),"utf8");if(e.cssPatch)src=e.cssPatch(src);parts.push(src)}}if(e.lessCss){const lessFile=resolveCoreModule(e.lessCss);const lessSrc=fs.readFileSync(lessFile,"utf8");const vendorStubs=path.join(CORE_PACKAGE_DIR,"vendor","bootstrap2-less-stubs");const lessOut=await less.render(lessSrc,{filename:lessFile,paths:[vendorStubs]});parts.push(lessOut.css)}}return parts.join("\n")}exports.buildSelectedCss=buildSelectedCss;async function buildSelectedPluginsBundle(entries,projectRoot,opts){if(entries.length===0)return null;const parts=[];for(const entry of entries){parts.push(await buildEntryPiece(entry))}const code=parts.join(";\n");if(opts&&opts.minify){return esbuild.transformSync(code,{minify:true,legalComments:"eof",target:["es2019"]}).code}return code}exports.buildSelectedPluginsBundle=buildSelectedPluginsBundle;
|
|
3
|
+
if (typeof __factory === "function") __factory(window, window.jQuery);`,resolveDir:CORE_PACKAGE_DIR,loader:"js"},bundle:true,format:"cjs",platform:"browser",target:["es2019"],write:false,minify:false,logLevel:"silent"});const parts=[result.outputFiles[0].text];if(entry.code)parts.push(entry.code);return parts.join(";\n")}const TOP_LEVEL_ESM=/^[ \t]*(?:import|export)[\s{"'*]/m;function containsEsm(src){return TOP_LEVEL_ESM.test(String(src))}async function bundleEsmSource(src,resolveDir){const result=await esbuild.build({stdin:{contents:src,resolveDir,loader:"js"},bundle:true,format:"cjs",platform:"browser",target:["es2019"],write:false,minify:false,logLevel:"silent"});return result.outputFiles[0].text}function assertNoTopLevelEsm(code){const m=TOP_LEVEL_ESM.exec(String(code));if(m){const at=String(code).slice(m.index,m.index+120).split("\n")[0];throw new Error(`plugins bundle still contains a top-level import/export (${at.trim()}); it would be a SyntaxError as a classic script.`)}return code}async function buildPlainPiece(entry){const parts=[];for(const npmPath of[].concat(entry.npm||[])){let src=fs.readFileSync(resolveCoreModule(npmPath),"utf8");if(entry.patch)src=entry.patch(src);if(containsEsm(src))src=await bundleEsmSource(src,CORE_PACKAGE_DIR);parts.push(src)}if(entry.code)parts.push(entry.code);return parts.join(";\n")}async function buildEntryPiece(entry){if(entry.key==="jquery")return buildJqueryPiece(entry);if(entry.cjsFactory)return buildCjsFactoryPiece(entry);return buildPlainPiece(entry)}function createPatchPlugin(entries){const patchable=entries.filter(e=>e.patch);return{name:"lumenjs-plugins-patch",setup(build){for(const e of patchable){for(const npmPath of[].concat(e.npm||[])){const escaped=npmPath.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");const filter=new RegExp(escaped.split("/").join("[\\\\/]")+"$");build.onLoad({filter},async args=>{let src=await fs.promises.readFile(args.path,"utf8");return{contents:e.patch(src),loader:"js"}})}}}}}exports.createPatchPlugin=createPatchPlugin;async function buildSelectedCss(entries){const less=require("less");const parts=[];for(const e of entries){if(e.css){for(const cssPath of[].concat(e.css)){let src=fs.readFileSync(resolveCoreModule(cssPath),"utf8");if(e.cssPatch)src=e.cssPatch(src);parts.push(src)}}if(e.lessCss){const lessFile=resolveCoreModule(e.lessCss);const lessSrc=fs.readFileSync(lessFile,"utf8");const vendorStubs=path.join(CORE_PACKAGE_DIR,"vendor","bootstrap2-less-stubs");const lessOut=await less.render(lessSrc,{filename:lessFile,paths:[vendorStubs]});parts.push(lessOut.css)}}return parts.join("\n")}exports.buildSelectedCss=buildSelectedCss;async function buildSelectedPluginsBundle(entries,projectRoot,opts){if(entries.length===0)return null;const parts=[];for(const entry of entries){parts.push(await buildEntryPiece(entry))}const code=assertNoTopLevelEsm(parts.join(";\n"));if(opts&&opts.minify){return esbuild.transformSync(code,{minify:true,legalComments:"eof",target:["es2019"]}).code}return code}exports.buildSelectedPluginsBundle=buildSelectedPluginsBundle;exports.containsEsm=containsEsm;exports.assertNoTopLevelEsm=assertNoTopLevelEsm;exports.bundleEsmSource=bundleEsmSource;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmjs/cli",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.2",
|
|
4
4
|
"description": "Command line interface for LumenJS — scaffold, develop, and build LumenJS applications. LumenJS is a tiny, fast reactive JavaScript framework for building web applications and interfaces with standard HTML, CSS, and JavaScript.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"lm": "./dist/bin/commands.js",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"ora": "^6.1.2",
|
|
53
53
|
"semver": "^7.3.7",
|
|
54
54
|
"ws": "^8.8.1",
|
|
55
|
-
"@lmjs/core": "2.8.
|
|
55
|
+
"@lmjs/core": "2.8.2"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|
|
58
58
|
"node": ">=18.0.0"
|