update: wcc, wcsc

This commit is contained in:
msojocs 2022-04-23 22:16:07 +08:00
parent a8c772b9a0
commit c9fcf1d8c8
14 changed files with 5191 additions and 182 deletions

View File

@ -75,7 +75,9 @@ function parseDeps(source, x, pageConfig){
new RegExp(`\\${funcName}\\_\\d+`, "g"),
`${funcName}_${i}`
)
.replace(/m\d+/g, `m${i - 1}`) + "\n";
.replace(/m\d+/g, `m${i - 1}`).replace('={f', `=e_[x[${t_x.indexOf(dep)}]]||{f`) + "\n";
DEBUG_OUTPUT &&
process.stderr.write("dep_d_: " + dep_d_ + "\n");
let gz_name = m0_str.match(/var z=gz(.*?)\(\)/)[1];
// process.stderr.write("get funcName - " + t[0].match(/var z=gz(.*?)\(\)/)[1] + "\n")
// gz
@ -154,7 +156,7 @@ function genFunctionContent_LLW(wxmlName, config = {}, source, x) {
content += m0_str.replace(
new RegExp(`\\${funcName}\\_\\d+`, "g"),
`${config.funcName}_1`
);
).replace('={f', `=e_[x[0]]||{f`);
// path
content += `\u000aif(path&&e_[path]){\u000aouterGlobal.__wxml_comp_version__=0.02\u000areturn function(env,dd,global){$gwxc=0;var root={\u0022tag\u0022:\u0022wx-page\u0022};root.children=[]\u000a;g=\u0022${config.funcName}\u0022;var main=e_[path].f\u000acs=[]\u000aif (typeof global===\u0022undefined\u0022)global={};global.f=$gdc(f_[path],\u0022\u0022,1);\u000aif(typeof(outerGlobal.__webview_engine_version__)!='undefined'&&outerGlobal.__webview_engine_version__+1e-6>=0.02+1e-6&&outerGlobal.__mergeData__)\u000a{\u000aenv=outerGlobal.__mergeData__(env,dd);\u000a}\u000atry{\u000amain(env,{},root,global);\u000a_tsd(root)\u000aif(typeof(outerGlobal.__webview_engine_version__)=='undefined'|| outerGlobal.__webview_engine_version__+1e-6<0.01+1e-6){return _ev(root);}\u000a}catch(err){\u000aconsole.log(cs, env);\u000aconsole.log(err)\u000athrow err\u000a}\u000a;g=\u0022\u0022;\u000areturn root;\u000a}\u000a}\u000a}\u000a}`;
@ -262,7 +264,7 @@ function genFunctionContent_LLA(wxmlName, config = {}, source, x) {
content += `var x=['./${wxmlName}.wxml'`;
if (!debugWXS && !hasDeps) {
content += `];d_[x[0]]={}\u000a`;
content += `var m0=function(e,s,r,gg){\u000avar z=gz${config.funcName}_1()\u000areturn r\u000a}\u000ae_[x[0]]={f:m0,j:[],i:[],ti:[],ic:[]}`;
content += `var m0=function(e,s,r,gg){\u000avar z=gz${config.funcName}_1()\u000areturn r\u000a}\u000ae_[x[0]]=e_[x[0]]||{f:m0,j:[],i:[],ti:[],ic:[]}`;
} else {
// m0 --- m{num}
const m0Exp = `var m${config.num}=function\\(e,s,r,gg\\){[\\s\\S]*e_\\[x\\[(\\d+)\\]\\]={f:m${config.num},j:\\[.*?\\],i:\\[.*?\\],ti:\\[(.*?)\\],ic:\\[.*?\\]}`;

View File

@ -0,0 +1,12 @@
# NODE模块的编译器测试目录
## 代码存放位置
wine版存放于`node_modules/wcc_wine`
linux版存放于`node_modules/wcc_linux`
## 生成代码
wine版按`./vscode/launch.json`配置执行nwjs生成`wine.txt`结尾的文件
linux版执行`wcc_test.js` `wcsc_test.js`生成`linux.txt`结尾的文件

View File

@ -1,4 +1,4 @@
<script>
require('./wcc_test')
require('./wcsc_test')
require('./wcsc_test')
</script>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -96,6 +96,7 @@ const test_node = () => {
return new Promise((resolve, reject) => {
node_exec.on("close", (n) => {
console.log("node n: ", n);
process.stderr.write(Buffer.concat(errData).toString());
if (0 === n) {
let result = Buffer.concat(spwanData).toString();
// require('fs').writeFileSync('/mnt/disk2/wechat-web-devtools-linux/tmp/llw2.json', result)

View File

@ -79,7 +79,7 @@ const config = [
const test_wine = () => {
const wine = spawn(
path.resolve(__dirname, "../../package.nw/js/vendor/wcc.exe"),
path.resolve(__dirname, "../../../package.nw/js/vendor/wcc.exe"),
config,
{
cwd: projectPath,
@ -111,7 +111,7 @@ const test_wine = () => {
const test_node = () => {
const node_exec = spawn(
path.resolve(__dirname, "../../compiler/nodejs/wcc"),
path.resolve(__dirname, "../../../compiler/nodejs/wcc"),
config,
{
cwd: projectPath,

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -10,6 +10,7 @@ const config = [
"-db",
"-pc",
"9",
"-ll",
"./page/component/index.wxss",
"./page/API/index.wxss",
"./page/cloud/index.wxss",