1
0
mirror of https://github.com/jaandrle/deka-dom-el synced 2025-04-06 05:35:54 +02:00

import optimalization

This commit is contained in:
Jan Andrle 2025-03-10 11:08:45 +01:00
parent 15dc342ae8
commit 08316892d0
5 changed files with 22 additions and 16 deletions

View File

@ -4,11 +4,13 @@ const files= [ "index", "index-with-signals" ];
$.api("")
.command("main", "Build main files", { default: true })
.action(async function main(){
.option("--no-types", "Also generate d.ts files", false)
.action(async function main({ types }){
const regular = await build({
files,
filesOut,
minify: "no",
types,
});
const min = await build({
files,
@ -18,6 +20,7 @@ $.api("")
return out.slice(0, idx)+".min"+out.slice(idx);
},
minify: "full",
types,
});
return $.exit(regular + min);
})

View File

@ -3,7 +3,7 @@ const css= echo.css`
.info{ color: gray; }
`;
export async function build({ files, filesOut, minify= "partial", iife= true }){
export function build({ files, filesOut, minify= "partial", iife= true, types= true }){
for(const file_root of files){
const file= file_root+".js";
echo(`Processing ${file} (minified: ${minify})`);
@ -11,20 +11,22 @@ export async function build({ files, filesOut, minify= "partial", iife= true }){
const esbuild_output= buildEsbuild({ file, out, minify });
echoVariant(esbuild_output.stderr.split("\n")[1].trim());
const file_dts= file_root+".d.ts";
const file_dts_out= filesOut(file_dts);
echoVariant(file_dts_out, true);
buildDts({
bundle: out,
entry: file_dts,
});
echoVariant(file_dts_out);
if(types){
const file_dts= file_root+".d.ts";
const file_dts_out= filesOut(file_dts);
echoVariant(file_dts_out, true);
buildDts({
bundle: out,
entry: file_dts,
});
echoVariant(file_dts_out);
}
if(iife) toIIFE(file, file_root);
if(iife) toIIFE(file, file_root, types);
}
return 0;
async function toIIFE(file, file_root){
function toIIFE(file, file_root, types){
const fileMark= "iife";
const name= "DDE";
const out= filesOut(file_root+".js", fileMark);
@ -36,6 +38,7 @@ export async function build({ files, filesOut, minify= "partial", iife= true }){
const dde_output= buildEsbuild({ file, out, minify, params });
echoVariant(`${out} (${name})`)
if(!types) return dde_output;
const file_dts= file_root+".d.ts";
const file_dts_out= filesOut(file_dts, fileMark);
echoVariant(file_dts_out, true);

File diff suppressed because one or more lines are too long

2
dist/esm.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
export { registerReactivity } from './signals-lib/common.js';
import { enviroment as env, keyLTE, evc, evd, eva } from './dom-common.js';
import { keyLTE, evc, evd } from './dom-common.js';
import { oAssign, onAbort } from './helpers.js';
/**