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:
parent
15dc342ae8
commit
08316892d0
@ -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);
|
||||
})
|
||||
|
@ -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,6 +11,7 @@ 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());
|
||||
|
||||
if(types){
|
||||
const file_dts= file_root+".d.ts";
|
||||
const file_dts_out= filesOut(file_dts);
|
||||
echoVariant(file_dts_out, true);
|
||||
@ -19,12 +20,13 @@ export async function build({ files, filesOut, minify= "partial", iife= true }){
|
||||
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);
|
||||
|
4
dist/esm-with-signals.min.js
vendored
4
dist/esm-with-signals.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/esm.min.js
vendored
2
dist/esm.min.js
vendored
File diff suppressed because one or more lines are too long
@ -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';
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user