@lmjs/cli 2.4.2 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -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){if(entries.length===0)return null;const parts=[];for(const entry of entries){parts.push(await buildEntryPiece(entry))}
|
|
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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmjs/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
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.
|
|
55
|
+
"@lmjs/core": "2.5.0"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|
|
58
58
|
"node": ">=18.0.0"
|