Spring.River.Flower.Moon.Night

2023-03-10

Do not gently go into the night.

Doing recently

Static Mangle and compress for dynamic template App such as Miniprogram and vue

Minify class names in css

1
2
3
4
.veryLongClass {}

# will be changed into
.a {}
1
2
3
<div class="veryLongClass"></div>
<!--will be changed into-->
<div class="a"></div>
1
2
3
4
var test = document.querySelector('.veryLongClass');

// will be changed into
var test = document.querySelector('.a');

Mangle exports and imports for esm to cjs case

WIP

TODOs

Minify Protobuf.js generated static-module in esm

Protobuf is a kind of mechanism for serializing data. And it doesn’t support es module now. Also, its static-module generated by Closure Compiler in js is too large for no eval/Function case.

More info: Issue

How can I trace variables referenced and compress them

Somehow, we can use babel to trace var reference. But, it is based on static analysing. It means, while facing ‘bind’, ‘apply’, ‘call’ and some dynamic calling, like ‘eval’/ ‘Function’. It may failed.

However, maybe typescript can be referred to solve with tracing. As it can help you to ‘go to definition’ while coding with enhanced charactors.

Xml parser/transfomer/generator but supporting js expression

While parsing html/xml, we are using htmlparser2 as it has more useful tool sdks. Yet we still meet a trouble that it can not work with template with dynamic js expression such as vue template or miniprogram ‘wxml’ files. So we intended to make it supported.

Also, there is a prepared wxml parser has been widely used in vscode plugin.

More info: Wxml Parser

Ts and compiler stuff

WIP

More info: A useful Playground