From 424e66a69ebb0554d329224d8590a185cff15be1 Mon Sep 17 00:00:00 2001 From: msojocs Date: Thu, 8 Sep 2022 21:47:18 +0800 Subject: [PATCH] perf: test for module --- test/node-modules/cases/wcc.test.js | 51 - .../cases/wcc/case1/output/wcc_node_wine.js | 1421 ----------------- .../cases/wcc/{ => raw}/case1/config.json | 2 +- test/node-modules/cases/wcc/wcc.test.js | 60 + .../wcsc/case1/output/wcsc_node_wine.json | 18 - .../wcsc/{ => lazyload}/case1/config.json | 2 +- test/node-modules/cases/wcsc/wcsc.test.js | 60 + wcc_node/src/wcsc.js | 11 +- 8 files changed, 127 insertions(+), 1498 deletions(-) delete mode 100644 test/node-modules/cases/wcc.test.js delete mode 100644 test/node-modules/cases/wcc/case1/output/wcc_node_wine.js rename test/node-modules/cases/wcc/{ => raw}/case1/config.json (97%) create mode 100644 test/node-modules/cases/wcc/wcc.test.js delete mode 100644 test/node-modules/cases/wcsc/case1/output/wcsc_node_wine.json rename test/node-modules/cases/wcsc/{ => lazyload}/case1/config.json (94%) create mode 100644 test/node-modules/cases/wcsc/wcsc.test.js diff --git a/test/node-modules/cases/wcc.test.js b/test/node-modules/cases/wcc.test.js deleted file mode 100644 index e6ffacc..0000000 --- a/test/node-modules/cases/wcc.test.js +++ /dev/null @@ -1,51 +0,0 @@ -const assert = require("assert"); -const ASTHelper = require("../../runner/ast-helper"); -const path = require("path"); -const fs = require("fs"); -const COMPILER = require('../wcc_node/lib/index') - -const originDE = assert.deepEqual -assert.deepEqual = function(){ - // console.log(arguments[0]) - try { - originDE.apply(this, arguments) - } catch (error) { - console.log('\t默认deepEqual检测失败,尝试检测语法') - const dw = ASTHelper.code2ast(JSON.stringify(arguments[0])) - const dn = ASTHelper.code2ast(JSON.stringify(arguments[1])) - originDE(dw, dn); - } -} - -describe("wcc - lla", function () { - describe("lla: node output should deep equal with wine", function () { - it("case1", async function () { - const casePath = path.resolve(__dirname, './wcc/case1') - const configPath = path.resolve(__dirname, './wcc/case1/config.json') - const projectPath = path.resolve( - __dirname, - "../../examples/miniprogram-demo/miniprogram" - ); - const storagePath = path.resolve( - __dirname, - `wcc/case1/output` - ); - const config = JSON.parse(fs.readFileSync(configPath).toString()); - config.cwd = path.join(configPath, config.cwd) - try { - fs.mkdirSync(storagePath, { recursive: true }); - } catch (error) {} - - let nodeResult = await COMPILER.wcc(config); - nodeResult = nodeResult.substring(0, nodeResult.length - 1) - - const wineResult = fs.readFileSync(`${casePath}/output/wcc_node_wine.js`) - fs.writeFileSync( - `${storagePath}/node-output.js`, - nodeResult - ); - assert.equal(wineResult, nodeResult); - }); - - }); -}); \ No newline at end of file diff --git a/test/node-modules/cases/wcc/case1/output/wcc_node_wine.js b/test/node-modules/cases/wcc/case1/output/wcc_node_wine.js deleted file mode 100644 index 1dde0d9..0000000 --- a/test/node-modules/cases/wcc/case1/output/wcc_node_wine.js +++ /dev/null @@ -1,1421 +0,0 @@ -/*v0.5vv_20200413_syb_scopedata*/global.__wcc_version__='v0.5vv_20200413_syb_scopedata';global.__wcc_version_info__={"customComponents":true,"fixZeroRpx":true,"propValueDeepCopy":false}; -var $gwxc -var $gaic={} -$gwx=function(path,global){ -if(typeof global === 'undefined') global={};if(typeof __WXML_GLOBAL__ === 'undefined') {__WXML_GLOBAL__={}; -}__WXML_GLOBAL__.modules = __WXML_GLOBAL__.modules || {}; -function _(a,b){if(typeof(b)!='undefined')a.children.push(b);} -function _v(k){if(typeof(k)!='undefined')return {tag:'virtual','wxKey':k,children:[]};return {tag:'virtual',children:[]};} -function _n(tag){$gwxc++;if($gwxc>=16000){throw 'Dom limit exceeded, please check if there\'s any mistake you\'ve made.'};return {tag:'wx-'+tag,attr:{},children:[],n:[],raw:{},generics:{}}} -function _p(a,b){b&&a.properities.push(b);} -function _s(scope,env,key){return typeof(scope[key])!='undefined'?scope[key]:env[key]} -function _wp(m){console.warn("WXMLRT_$gwx:"+m)} -function _wl(tname,prefix){_wp(prefix+':-1:-1:-1: Template `' + tname + '` is being called recursively, will be stop.')} -$gwn=console.warn; -$gwl=console.log; -function $gwh() -{ -function x() -{ -} -x.prototype = -{ -hn: function( obj, all ) -{ -if( typeof(obj) == 'object' ) -{ -var cnt=0; -var any1=false,any2=false; -for(var x in obj) -{ -any1=any1|x==='__value__'; -any2=any2|x==='__wxspec__'; -cnt++; -if(cnt>2)break; -} -return cnt == 2 && any1 && any2 && ( all || obj.__wxspec__ !== 'm' || this.hn(obj.__value__) === 'h' ) ? "h" : "n"; -} -return "n"; -}, -nh: function( obj, special ) -{ -return { __value__: obj, __wxspec__: special ? special : true } -}, -rv: function( obj ) -{ -return this.hn(obj,true)==='n'?obj:this.rv(obj.__value__); -}, -hm: function( obj ) -{ -if( typeof(obj) == 'object' ) -{ -var cnt=0; -var any1=false,any2=false; -for(var x in obj) -{ -any1=any1|x==='__value__'; -any2=any2|x==='__wxspec__'; -cnt++; -if(cnt>2)break; -} -return cnt == 2 && any1 && any2 && (obj.__wxspec__ === 'm' || this.hm(obj.__value__) ); -} -return false; -} -} -return new x; -} -wh=$gwh(); -function $gstack(s){ -var tmp=s.split('\n '+' '+' '+' '); -for(var i=0;i=': -case '<=': -case '>': -case '<': -case '<<': -case '>>': -_a = rev( ops[1], e, s, g, o, _f ); -_b = rev( ops[2], e, s, g, o, _f ); -_c = should_pass_type_info && (wh.hn( _a ) === 'h' || wh.hn( _b ) === 'h'); -switch( rop ) -{ -case '+': -_d = wh.rv( _a ) + wh.rv( _b ); -break; -case '*': -_d = wh.rv( _a ) * wh.rv( _b ); -break; -case '/': -_d = wh.rv( _a ) / wh.rv( _b ); -break; -case '%': -_d = wh.rv( _a ) % wh.rv( _b ); -break; -case '|': -_d = wh.rv( _a ) | wh.rv( _b ); -break; -case '^': -_d = wh.rv( _a ) ^ wh.rv( _b ); -break; -case '&': -_d = wh.rv( _a ) & wh.rv( _b ); -break; -case '===': -_d = wh.rv( _a ) === wh.rv( _b ); -break; -case '==': -_d = wh.rv( _a ) == wh.rv( _b ); -break; -case '!=': -_d = wh.rv( _a ) != wh.rv( _b ); -break; -case '!==': -_d = wh.rv( _a ) !== wh.rv( _b ); -break; -case '>=': -_d = wh.rv( _a ) >= wh.rv( _b ); -break; -case '<=': -_d = wh.rv( _a ) <= wh.rv( _b ); -break; -case '>': -_d = wh.rv( _a ) > wh.rv( _b ); -break; -case '<': -_d = wh.rv( _a ) < wh.rv( _b ); -break; -case '<<': -_d = wh.rv( _a ) << wh.rv( _b ); -break; -case '>>': -_d = wh.rv( _a ) >> wh.rv( _b ); -break; -default: -break; -} -return _c ? wh.nh( _d, "c" ) : _d; -break; -case '-': -_a = ops.length === 3 ? rev( ops[1], e, s, g, o, _f ) : 0; -_b = ops.length === 3 ? rev( ops[2], e, s, g, o, _f ) : rev( ops[1], e, s, g, o, _f ); -_c = should_pass_type_info && (wh.hn( _a ) === 'h' || wh.hn( _b ) === 'h'); -_d = _c ? wh.rv( _a ) - wh.rv( _b ) : _a - _b; -return _c ? wh.nh( _d, "c" ) : _d; -break; -case '!': -_a = rev( ops[1], e, s, g, o, _f ); -_c = should_pass_type_info && (wh.hn( _a ) == 'h'); -_d = !wh.rv(_a); -return _c ? wh.nh( _d, "c" ) : _d; -case '~': -_a = rev( ops[1], e, s, g, o, _f ); -_c = should_pass_type_info && (wh.hn( _a ) == 'h'); -_d = ~wh.rv(_a); -return _c ? wh.nh( _d, "c" ) : _d; -default: -$gwn('unrecognized op' + rop ); -} -} -function rev( ops, e, s, g, o, newap ) -{ -var op = ops[0]; -var _f = false; -if ( typeof newap !== "undefined" ) o.ap = newap; -if( typeof(op)==='object' ) -{ -var vop=op[0]; -var _a, _aa, _b, _bb, _c, _d, _s, _e, _ta, _tb, _td; -switch(vop) -{ -case 2: -return ArithmeticEv(ops,e,s,g,o); -break; -case 4: -return rev( ops[1], e, s, g, o, _f ); -break; -case 5: -switch( ops.length ) -{ -case 2: -_a = rev( ops[1],e,s,g,o,_f ); -return should_pass_type_info?[_a]:[wh.rv(_a)]; -return [_a]; -break; -case 1: -return []; -break; -default: -_a = rev( ops[1],e,s,g,o,_f ); -_b = rev( ops[2],e,s,g,o,_f ); -_a.push( -should_pass_type_info ? -_b : -wh.rv( _b ) -); -return _a; -break; -} -break; -case 6: -_a = rev(ops[1],e,s,g,o); -var ap = o.ap; -_ta = wh.hn(_a)==='h'; -_aa = _ta ? wh.rv(_a) : _a; -o.is_affected |= _ta; -if( should_pass_type_info ) -{ -if( _aa===null || typeof(_aa) === 'undefined' ) -{ -return _ta ? wh.nh(undefined, 'e') : undefined; -} -_b = rev(ops[2],e,s,g,o,_f); -_tb = wh.hn(_b) === 'h'; -_bb = _tb ? wh.rv(_b) : _b; -o.ap = ap; -o.is_affected |= _tb; -if( _bb===null || typeof(_bb) === 'undefined' || -_bb === "__proto__" || _bb === "prototype" || _bb === "caller" ) -{ -return (_ta || _tb) ? wh.nh(undefined, 'e') : undefined; -} -_d = _aa[_bb]; -if ( typeof _d === 'function' && !ap ) _d = undefined; -_td = wh.hn(_d)==='h'; -o.is_affected |= _td; -return (_ta || _tb) ? (_td ? _d : wh.nh(_d, 'e')) : _d; -} -else -{ -if( _aa===null || typeof(_aa) === 'undefined' ) -{ -return undefined; -} -_b = rev(ops[2],e,s,g,o,_f); -_tb = wh.hn(_b) === 'h'; -_bb = _tb ? wh.rv(_b) : _b; -o.ap = ap; -o.is_affected |= _tb; -if( _bb===null || typeof(_bb) === 'undefined' || -_bb === "__proto__" || _bb === "prototype" || _bb === "caller" ) -{ -return undefined; -} -_d = _aa[_bb]; -if ( typeof _d === 'function' && !ap ) _d = undefined; -_td = wh.hn(_d)==='h'; -o.is_affected |= _td; -return _td ? wh.rv(_d) : _d; -} -case 7: -switch(ops[1][0]) -{ -case 11: -o.is_affected |= wh.hn(g)==='h'; -return g; -case 3: -_s = wh.rv( s ); -_e = wh.rv( e ); -_b = ops[1][1]; -if (g && g.f && g.f.hasOwnProperty(_b) ) -{ -_a = g.f; -o.ap = true; -} -else -{ -_a = _s && _s.hasOwnProperty(_b) ? -s : (_e && _e.hasOwnProperty(_b) ? e : undefined ); -} -if( should_pass_type_info ) -{ -if( _a ) -{ -_ta = wh.hn(_a) === 'h'; -_aa = _ta ? wh.rv( _a ) : _a; -_d = _aa[_b]; -_td = wh.hn(_d) === 'h'; -o.is_affected |= _ta || _td; -_d = _ta && !_td ? wh.nh(_d,'e') : _d; -return _d; -} -} -else -{ -if( _a ) -{ -_ta = wh.hn(_a) === 'h'; -_aa = _ta ? wh.rv( _a ) : _a; -_d = _aa[_b]; -_td = wh.hn(_d) === 'h'; -o.is_affected |= _ta || _td; -return wh.rv(_d); -} -} -return undefined; -} -break; -case 8: -_a = {}; -_a[ops[1]] = rev(ops[2],e,s,g,o,_f); -return _a; -break; -case 9: -_a = rev(ops[1],e,s,g,o,_f); -_b = rev(ops[2],e,s,g,o,_f); -function merge( _a, _b, _ow ) -{ -var ka, _bbk; -_ta = wh.hn(_a)==='h'; -_tb = wh.hn(_b)==='h'; -_aa = wh.rv(_a); -_bb = wh.rv(_b); -for(var k in _bb) -{ -if ( _ow || !_aa.hasOwnProperty(k) ) -{ -_aa[k] = should_pass_type_info ? (_tb ? wh.nh(_bb[k],'e') : _bb[k]) : wh.rv(_bb[k]); -} -} -return _a; -} -var _c = _a -var _ow = true -if ( typeof(ops[1][0]) === "object" && ops[1][0][0] === 10 ) { -_a = _b -_b = _c -_ow = false -} -if ( typeof(ops[1][0]) === "object" && ops[1][0][0] === 10 ) { -var _r = {} -return merge( merge( _r, _a, _ow ), _b, _ow ); -} -else -return merge( _a, _b, _ow ); -break; -case 10: -_a = rev(ops[1],e,s,g,o,_f); -_a = should_pass_type_info ? _a : wh.rv( _a ); -return _a ; -break; -case 12: -var _r; -_a = rev(ops[1],e,s,g,o); -if ( !o.ap ) -{ -return should_pass_type_info && wh.hn(_a)==='h' ? wh.nh( _r, 'f' ) : _r; -} -var ap = o.ap; -_b = rev(ops[2],e,s,g,o,_f); -o.ap = ap; -_ta = wh.hn(_a)==='h'; -_tb = _ca(_b); -_aa = wh.rv(_a); -_bb = wh.rv(_b); snap_bb=$gdc(_bb,"nv_"); -try{ -_r = typeof _aa === "function" ? $gdc(_aa.apply(null, snap_bb)) : undefined; -} catch (e){ -e.message = e.message.replace(/nv_/g,""); -e.stack = e.stack.substring(0,e.stack.indexOf("\n", e.stack.lastIndexOf("at nv_"))); -e.stack = e.stack.replace(/\snv_/g," "); -e.stack = $gstack(e.stack); -if(g.debugInfo) -{ -e.stack += "\n "+" "+" "+" at "+g.debugInfo[0]+":"+g.debugInfo[1]+":"+g.debugInfo[2]; -console.error(e); -} -_r = undefined; -} -return should_pass_type_info && (_tb || _ta) ? wh.nh( _r, 'f' ) : _r; -} -} -else -{ -if( op === 3 || op === 1) return ops[1]; -else if( op === 11 ) -{ -var _a=''; -for( var i = 1 ; i < ops.length ; i++ ) -{ -var xp = wh.rv(rev(ops[i],e,s,g,o,_f)); -_a += typeof(xp) === 'undefined' ? '' : xp; -} -return _a; -} -} -} -function wrapper( ops, e, s, g, o, newap ) -{ -if( ops[0] == '11182016' ) -{ -g.debugInfo = ops[2]; -return rev( ops[1], e, s, g, o, newap ); -} -else -{ -g.debugInfo = null; -return rev( ops, e, s, g, o, newap ); -} -} -return wrapper; -} -gra=$gwrt(true); -grb=$gwrt(false); -function TestTest( expr, ops, e,s,g, expect_a, expect_b, expect_affected ) -{ -{ -var o = {is_affected:false}; -var a = gra( ops, e,s,g, o ); -if( JSON.stringify(a) != JSON.stringify( expect_a ) -|| o.is_affected != expect_affected ) -{ -console.warn( "A. " + expr + " get result " + JSON.stringify(a) + ", " + o.is_affected + ", but " + JSON.stringify( expect_a ) + ", " + expect_affected + " is expected" ); -} -} -{ -var o = {is_affected:false}; -var a = grb( ops, e,s,g, o ); -if( JSON.stringify(a) != JSON.stringify( expect_b ) -|| o.is_affected != expect_affected ) -{ -console.warn( "B. " + expr + " get result " + JSON.stringify(a) + ", " + o.is_affected + ", but " + JSON.stringify( expect_b ) + ", " + expect_affected + " is expected" ); -} -} -} - -function wfor( to_iter, func, env, _s, global, father, itemname, indexname, keyname ) -{ -var _n = wh.hn( to_iter ) === 'n'; -var scope = wh.rv( _s ); -var has_old_item = scope.hasOwnProperty(itemname); -var has_old_index = scope.hasOwnProperty(indexname); -var old_item = scope[itemname]; -var old_index = scope[indexname]; -var full = Object.prototype.toString.call(wh.rv(to_iter)); -var type = full[8]; -if( type === 'N' && full[10] === 'l' ) type = 'X'; -var _y; -if( _n ) -{ -if( type === 'A' ) -{ -var r_iter_item; -for( var i = 0 ; i < to_iter.length ; i++ ) -{ -scope[itemname] = to_iter[i]; -scope[indexname] = _n ? i : wh.nh(i, 'h'); -r_iter_item = wh.rv(to_iter[i]); -var key = keyname && r_iter_item ? (keyname==="*this" ? r_iter_item : wh.rv(r_iter_item[keyname])) : undefined; -_y = _v(key); -_(father,_y); -func( env, scope, _y, global ); -} -} -else if( type === 'O' ) -{ -var i = 0; -var r_iter_item; -for( var k in to_iter ) -{ -scope[itemname] = to_iter[k]; -scope[indexname] = _n ? k : wh.nh(k, 'h'); -r_iter_item = wh.rv(to_iter[k]); -var key = keyname && r_iter_item ? (keyname==="*this" ? r_iter_item : wh.rv(r_iter_item[keyname])) : undefined; -_y = _v(key); -_(father,_y); -func( env,scope,_y,global ); -i++; -} -} -else if( type === 'S' ) -{ -for( var i = 0 ; i < to_iter.length ; i++ ) -{ -scope[itemname] = to_iter[i]; -scope[indexname] = _n ? i : wh.nh(i, 'h'); -_y = _v( to_iter[i] + i ); -_(father,_y); -func( env,scope,_y,global ); -} -} -else if( type === 'N' ) -{ -for( var i = 0 ; i < to_iter ; i++ ) -{ -scope[itemname] = i; -scope[indexname] = _n ? i : wh.nh(i, 'h'); -_y = _v( i ); -_(father,_y); -func(env,scope,_y,global); -} -} -else -{ -} -} -else -{ -var r_to_iter = wh.rv(to_iter); -var r_iter_item, iter_item; -if( type === 'A' ) -{ -for( var i = 0 ; i < r_to_iter.length ; i++ ) -{ -iter_item = r_to_iter[i]; -iter_item = wh.hn(iter_item)==='n' ? wh.nh(iter_item,'h') : iter_item; -r_iter_item = wh.rv( iter_item ); -scope[itemname] = iter_item -scope[indexname] = _n ? i : wh.nh(i, 'h'); -var key = keyname && r_iter_item ? (keyname==="*this" ? r_iter_item : wh.rv(r_iter_item[keyname])) : undefined; -_y = _v(key); -_(father,_y); -func( env, scope, _y, global ); -} -} -else if( type === 'O' ) -{ -var i=0; -for( var k in r_to_iter ) -{ -iter_item = r_to_iter[k]; -iter_item = wh.hn(iter_item)==='n'? wh.nh(iter_item,'h') : iter_item; -r_iter_item = wh.rv( iter_item ); -scope[itemname] = iter_item; -scope[indexname] = _n ? k : wh.nh(k, 'h'); -var key = keyname && r_iter_item ? (keyname==="*this" ? r_iter_item : wh.rv(r_iter_item[keyname])) : undefined; -_y=_v(key); -_(father,_y); -func( env, scope, _y, global ); -i++ -} -} -else if( type === 'S' ) -{ -for( var i = 0 ; i < r_to_iter.length ; i++ ) -{ -iter_item = wh.nh(r_to_iter[i],'h'); -scope[itemname] = iter_item; -scope[indexname] = _n ? i : wh.nh(i, 'h'); -_y = _v( to_iter[i] + i ); -_(father,_y); -func( env, scope, _y, global ); -} -} -else if( type === 'N' ) -{ -for( var i = 0 ; i < r_to_iter ; i++ ) -{ -iter_item = wh.nh(i,'h'); -scope[itemname] = iter_item; -scope[indexname]= _n ? i : wh.nh(i,'h'); -_y = _v( i ); -_(father,_y); -func(env,scope,_y,global); -} -} -else -{ -} -} -if(has_old_item) -{ -scope[itemname]=old_item; -} -else -{ -delete scope[itemname]; -} -if(has_old_index) -{ -scope[indexname]=old_index; -} -else -{ -delete scope[indexname]; -} -} - -function _ca(o) -{ -if ( wh.hn(o) == 'h' ) return true; -if ( typeof o !== "object" ) return false; -for(var i in o){ -if ( o.hasOwnProperty(i) ){ -if (_ca(o[i])) return true; -} -} -return false; -} -function _da( node, attrname, opindex, raw, o ) -{ -var isaffected = false; -var value = $gdc( raw, "", 2 ); -if ( o.ap && value && value.constructor===Function ) -{ -attrname = "$wxs:" + attrname; -node.attr["$gdc"] = $gdc; -} -if ( o.is_affected || _ca(raw) ) -{ -node.n.push( attrname ); -node.raw[attrname] = raw; -} -node.attr[attrname] = value; -} -function _r( node, attrname, opindex, env, scope, global ) -{ -global.opindex=opindex; -var o = {}, _env; -var a = grb( z[opindex], env, scope, global, o ); -_da( node, attrname, opindex, a, o ); -} -function _rz( z, node, attrname, opindex, env, scope, global ) -{ -global.opindex=opindex; -var o = {}, _env; -var a = grb( z[opindex], env, scope, global, o ); -_da( node, attrname, opindex, a, o ); -} -function _o( opindex, env, scope, global ) -{ -global.opindex=opindex; -var nothing = {}; -var r = grb( z[opindex], env, scope, global, nothing ); -return (r&&r.constructor===Function) ? undefined : r; -} -function _oz( z, opindex, env, scope, global ) -{ -global.opindex=opindex; -var nothing = {}; -var r = grb( z[opindex], env, scope, global, nothing ); -return (r&&r.constructor===Function) ? undefined : r; -} -function _1( opindex, env, scope, global, o ) -{ -var o = o || {}; -global.opindex=opindex; -return gra( z[opindex], env, scope, global, o ); -} -function _1z( z, opindex, env, scope, global, o ) -{ -var o = o || {}; -global.opindex=opindex; -return gra( z[opindex], env, scope, global, o ); -} -function _2( opindex, func, env, scope, global, father, itemname, indexname, keyname ) -{ -var o = {}; -var to_iter = _1( opindex, env, scope, global ); -wfor( to_iter, func, env, scope, global, father, itemname, indexname, keyname ); -} -function _2z( z, opindex, func, env, scope, global, father, itemname, indexname, keyname ) -{ -var o = {}; -var to_iter = _1z( z, opindex, env, scope, global ); -wfor( to_iter, func, env, scope, global, father, itemname, indexname, keyname ); -} - - -function _m(tag,attrs,generics,env,scope,global) -{ -var tmp=_n(tag); -var base=0; -for(var i = 0 ; i < attrs.length ; i+=2 ) -{ -if(base+attrs[i+1]<0) -{ -tmp.attr[attrs[i]]=true; -} -else -{ -_r(tmp,attrs[i],base+attrs[i+1],env,scope,global); -if(base===0)base=attrs[i+1]; -} -} -for(var i=0;i=0;x--){if(e[p].i[x]&&d[e[p].i[x]][c])return d[e[p].i[x]][c]};for(var x=e[p].ti.length-1;x>=0;x--){var q=_grp(e[p].ti[x],e,p);if(q&&d[q][c])return d[q][c]}var ii=_gapi(e,p);for(var x=0;x=0;k--)if(e[p].j[k]){for(var q=e[e[p].j[k]].ti.length-1;q>=0;q--){var pp=_grp(e[e[p].j[k]].ti[q],e,p);if(pp&&d[pp][c]){return d[pp][c]}}}} -function _gapi(e,p){if(!p)return [];if($gaic[p]){return $gaic[p]};var ret=[],q=[],h=0,t=0,put={},visited={};q.push(p);visited[p]=true;t++;while(h'],[[6],[[7],[3,'bullet']],[3,'duration']],[1,0]],[1,'bullet-move'],[1,'']],[3,' '],[[2,'?:'],[[6],[[7],[3,'bullet']],[3,'paused']],[1,'paused'],[1,'']]]) -Z([[7],[3,'bulletId']]) -Z([[7],[3,'tunnelId']]) -Z([a,[3,'color: '],[[2,'?:'],[[6],[[7],[3,'bullet']],[3,'paused']],[1,'#fff'],[[6],[[7],[3,'bullet']],[3,'color']]],[3,'; height: '],[[6],[[7],[3,'tunnel']],[3,'height']],[3,'px; line-height: '],[[6],[[7],[3,'tunnel']],[3,'height']],[3,'px; animation-duration: '],[[6],[[7],[3,'bullet']],[3,'duration']],[3,'s; animation-play-state: '],[[2,'?:'],[[6],[[7],[3,'bullet']],[3,'paused']],[1,'paused'],[1,'running']]]) -Z([[6],[[6],[[7],[3,'bullet']],[3,'image']],[3,'head']]) -Z([[6],[[6],[[7],[3,'bullet']],[3,'image']],[3,'tail']]) -})(__WXML_GLOBAL__.ops_cached.$gwx_1);return __WXML_GLOBAL__.ops_cached.$gwx_1 -} -function gz$gwx_2(){ -if( __WXML_GLOBAL__.ops_cached.$gwx_2)return __WXML_GLOBAL__.ops_cached.$gwx_2 -__WXML_GLOBAL__.ops_cached.$gwx_2=[]; -(function(z){var a=11;function Z(ops){z.push(ops)} -})(__WXML_GLOBAL__.ops_cached.$gwx_2);return __WXML_GLOBAL__.ops_cached.$gwx_2 -} -function gz$gwx_3(){ -if( __WXML_GLOBAL__.ops_cached.$gwx_3)return __WXML_GLOBAL__.ops_cached.$gwx_3 -__WXML_GLOBAL__.ops_cached.$gwx_3=[]; -(function(z){var a=11;function Z(ops){z.push(ops)} -Z([3,'_beginToScroll']) -Z([3,'wrap']) -Z([3,'content']) -Z([a,[3,'height:'],[[2,'?:'],[[7],[3,'useInPage']],[[2,'+'],[[2,'+'],[[7],[3,'totalHeight']],[[2,'?:'],[[7],[3,'hasBeforeSlotHeight']],[[7],[3,'beforeSlotHeight']],[1,0]]],[[2,'?:'],[[7],[3,'hasAfterSlotHeight']],[[7],[3,'afterSlotHeight']],[1,0]]],[[7],[3,'height']]],[3,'px;width:'],[[7],[3,'width']],[3,'px;transform:translateZ(0);-webkit-transform:translateZ(0);']]) -Z([3,'_scrollViewDidScroll']) -Z([3,'_scrollToLower']) -Z([3,'_scrollToUpper']) -Z(z[2]) -Z([[7],[3,'enableBackToTop']]) -Z([[7],[3,'lowerThreshold']]) -Z([[7],[3,'innerScrollIntoView']]) -Z([[7],[3,'innerScrollTop']]) -Z([[7],[3,'scrollWithAnimation']]) -Z([1,false]) -Z([[2,'?:'],[[7],[3,'useInPage']],[1,false],[[7],[3,'scrollY']]]) -Z([3,'height:100%;position: relative;']) -Z([[7],[3,'throttle']]) -Z([[7],[3,'upperThreshold']]) -Z([3,'itemsize']) -Z([3,'before']) -Z([3,'after']) -})(__WXML_GLOBAL__.ops_cached.$gwx_3);return __WXML_GLOBAL__.ops_cached.$gwx_3 -} -function gz$gwx_4(){ -if( __WXML_GLOBAL__.ops_cached.$gwx_4)return __WXML_GLOBAL__.ops_cached.$gwx_4 -__WXML_GLOBAL__.ops_cached.$gwx_4=[]; -(function(z){var a=11;function Z(ops){z.push(ops)} -})(__WXML_GLOBAL__.ops_cached.$gwx_4);return __WXML_GLOBAL__.ops_cached.$gwx_4 -} -function gz$gwx_5(){ -if( __WXML_GLOBAL__.ops_cached.$gwx_5)return __WXML_GLOBAL__.ops_cached.$gwx_5 -__WXML_GLOBAL__.ops_cached.$gwx_5=[]; -(function(z){var a=11;function Z(ops){z.push(ops)} -Z([3,'container page']) -Z([[7],[3,'theme']]) -Z([[8],'title',[1,'tabBar']]) -Z([3,'head']) -Z([3,'foot']) -})(__WXML_GLOBAL__.ops_cached.$gwx_5);return __WXML_GLOBAL__.ops_cached.$gwx_5 -} -function gz$gwx_6(){ -if( __WXML_GLOBAL__.ops_cached.$gwx_6)return __WXML_GLOBAL__.ops_cached.$gwx_6 -__WXML_GLOBAL__.ops_cached.$gwx_6=[]; -(function(z){var a=11;function Z(ops){z.push(ops)} -Z([3,'page-scroll-view']) -Z([3,'list']) -Z([[7],[3,'isSetTabBarPage']]) -Z([3,'leaveSetTabBarPage']) -})(__WXML_GLOBAL__.ops_cached.$gwx_6);return __WXML_GLOBAL__.ops_cached.$gwx_6 -} -function gz$gwx_7(){ -if( __WXML_GLOBAL__.ops_cached.$gwx_7)return __WXML_GLOBAL__.ops_cached.$gwx_7 -__WXML_GLOBAL__.ops_cached.$gwx_7=[]; -(function(z){var a=11;function Z(ops){z.push(ops)} -})(__WXML_GLOBAL__.ops_cached.$gwx_7);return __WXML_GLOBAL__.ops_cached.$gwx_7 -} -function gz$gwx_8(){ -if( __WXML_GLOBAL__.ops_cached.$gwx_8)return __WXML_GLOBAL__.ops_cached.$gwx_8 -__WXML_GLOBAL__.ops_cached.$gwx_8=[]; -(function(z){var a=11;function Z(ops){z.push(ops)} -Z([3,'foot']) -})(__WXML_GLOBAL__.ops_cached.$gwx_8);return __WXML_GLOBAL__.ops_cached.$gwx_8 -} -function gz$gwx_9(){ -if( __WXML_GLOBAL__.ops_cached.$gwx_9)return __WXML_GLOBAL__.ops_cached.$gwx_9 -__WXML_GLOBAL__.ops_cached.$gwx_9=[]; -(function(z){var a=11;function Z(ops){z.push(ops)} -Z([3,'head']) -Z([[7],[3,'desc']]) -})(__WXML_GLOBAL__.ops_cached.$gwx_9);return __WXML_GLOBAL__.ops_cached.$gwx_9 -} -function gz$gwx_10(){ -if( __WXML_GLOBAL__.ops_cached.$gwx_10)return __WXML_GLOBAL__.ops_cached.$gwx_10 -__WXML_GLOBAL__.ops_cached.$gwx_10=[]; -(function(z){var a=11;function Z(ops){z.push(ops)} -})(__WXML_GLOBAL__.ops_cached.$gwx_10);return __WXML_GLOBAL__.ops_cached.$gwx_10 -} -function gz$gwx_11(){ -if( __WXML_GLOBAL__.ops_cached.$gwx_11)return __WXML_GLOBAL__.ops_cached.$gwx_11 -__WXML_GLOBAL__.ops_cached.$gwx_11=[]; -(function(z){var a=11;function Z(ops){z.push(ops)} -})(__WXML_GLOBAL__.ops_cached.$gwx_11);return __WXML_GLOBAL__.ops_cached.$gwx_11 -} -__WXML_GLOBAL__.ops_set.$gwx=z; -__WXML_GLOBAL__.ops_init.$gwx=true; -var nv_require=function(){var nnm={};var nom={};return function(n){if(n[0]==='p'&&n[1]==='_'&&f_[n.slice(2)])return f_[n.slice(2)];return function(){if(!nnm[n]) return undefined;try{if(!nom[n])nom[n]=nnm[n]();return nom[n];}catch(e){e.message=e.message.replace(/nv_/g,'');var tmp = e.stack.substring(0,e.stack.lastIndexOf(n));e.stack = tmp.substring(0,tmp.lastIndexOf('\n'));e.stack = e.stack.replace(/\snv_/g,' ');e.stack = $gstack(e.stack);e.stack += '\n at ' + n.substring(2);console.error(e);} -}}}() -var x=['./miniprogram_npm/miniprogram-barrage/index.wxml','./miniprogram_npm/miniprogram-recycle-view/recycle-item.wxml','./miniprogram_npm/miniprogram-recycle-view/recycle-view.wxml','./miniprogram_npm/wxml-to-canvas/index.wxml','./page/API/components/set-tab-bar/set-tab-bar.wxml','../../../common/head.wxml','../../../common/foot.wxml','./page/API/index.wxml','./page/cloud/index.wxml','./page/common/foot.wxml','./page/common/head.wxml','./page/component/index.wxml','./page/extend/index.wxml'];d_[x[0]]={} -var m0=function(e,s,r,gg){ -var z=gz$gwx_1() -var oB=_v() -_(r,oB) -if(_oz(z,0,e,s,gg)){oB.wxVkey=1 -cs.push("./miniprogram_npm/miniprogram-barrage/index.wxml:view:1:1") -cs.pop() -} -else{oB.wxVkey=2 -cs.push("./miniprogram_npm/miniprogram-barrage/index.wxml:view:5:2") -var xC=_v() -_(oB,xC) -cs.push("./miniprogram_npm/miniprogram-barrage/index.wxml:block:6:4") -var oD=function(cF,fE,hG,gg){ -var cI=_v() -_(hG,cI) -cs.push("./miniprogram_npm/miniprogram-barrage/index.wxml:block:9:8") -var oJ=function(aL,lK,tM,gg){ -cs.push("./miniprogram_npm/miniprogram-barrage/index.wxml:view:10:10") -var bO=_mz(z,'view',['bindanimationend',9,'bindtap',1,'class',2,'data-bulletid',3,'data-tunnelid',4,'style',5],[],aL,lK,gg) -var oP=_v() -_(bO,oP) -if(_oz(z,15,aL,lK,gg)){oP.wxVkey=1 -cs.push("./miniprogram_npm/miniprogram-barrage/index.wxml:image:18:12") -cs.pop() -} -var xQ=_v() -_(bO,xQ) -if(_oz(z,16,aL,lK,gg)){xQ.wxVkey=1 -cs.push("./miniprogram_npm/miniprogram-barrage/index.wxml:image:28:12") -cs.pop() -} -oP.wxXCkey=1 -xQ.wxXCkey=1 -cs.pop() -_(tM,bO) -return tM -} -cI.wxXCkey=2 -_2z(z,7,oJ,cF,fE,gg,cI,'bullet','bulletId','bulletId') -cs.pop() -return hG -} -xC.wxXCkey=2 -_2z(z,3,oD,e,s,gg,xC,'tunnel','tunnelId','tunnelId') -cs.pop() -cs.pop() -} -oB.wxXCkey=1 -return r -} -e_[x[0]]={f:m0,j:[],i:[],ti:[],ic:[]} -d_[x[1]]={} -var m1=function(e,s,r,gg){ -var z=gz$gwx_2() -cs.push("./miniprogram_npm/miniprogram-recycle-view/recycle-item.wxml:slot:3:4") -var fS=_n('slot') -cs.pop() -_(r,fS) -return r -} -e_[x[1]]={f:m1,j:[],i:[],ti:[],ic:[]} -d_[x[2]]={} -var m2=function(e,s,r,gg){ -var z=gz$gwx_3() -cs.push("./miniprogram_npm/miniprogram-recycle-view/recycle-view.wxml:view:2:2") -var hU=_mz(z,'view',['bindtouchstart',0,'class',1,'id',1,'style',2],[],e,s,gg) -cs.push("./miniprogram_npm/miniprogram-recycle-view/recycle-view.wxml:scroll-view:3:4") -var oV=_mz(z,'scroll-view',['scrollAnchoring',-1,'bindscroll',4,'bindscrolltolower',1,'bindscrolltoupper',2,'class',3,'enableBackToTop',4,'lowerThreshold',5,'scrollIntoView',6,'scrollTop',7,'scrollWithAnimation',8,'scrollX',9,'scrollY',10,'style',11,'throttle',12,'upperThreshold',13],[],e,s,gg) -cs.push("./miniprogram_npm/miniprogram-recycle-view/recycle-view.wxml:slot:5:8") -var cW=_n('slot') -_rz(z,cW,'name',18,e,s,gg) -cs.pop() -_(oV,cW) -cs.push("./miniprogram_npm/miniprogram-recycle-view/recycle-view.wxml:slot:8:8") -var oX=_n('slot') -_rz(z,oX,'name',19,e,s,gg) -cs.pop() -_(oV,oX) -cs.push("./miniprogram_npm/miniprogram-recycle-view/recycle-view.wxml:slot:13:10") -var lY=_n('slot') -cs.pop() -_(oV,lY) -cs.push("./miniprogram_npm/miniprogram-recycle-view/recycle-view.wxml:slot:18:8") -var aZ=_n('slot') -_rz(z,aZ,'name',20,e,s,gg) -cs.pop() -_(oV,aZ) -cs.pop() -_(hU,oV) -cs.pop() -_(r,hU) -return r -} -e_[x[2]]={f:m2,j:[],i:[],ti:[],ic:[]} -d_[x[3]]={} -var m3=function(e,s,r,gg){ -var z=gz$gwx_4() -return r -} -e_[x[3]]={f:m3,j:[],i:[],ti:[],ic:[]} -d_[x[4]]={} -var m4=function(e,s,r,gg){ -var z=gz$gwx_5() -var b3=e_[x[4]].i -_ai(b3,x[5],e_,x[4],1,1) -_ai(b3,x[6],e_,x[4],2,2) -cs.push("./page/API/components/set-tab-bar/set-tab-bar.wxml:view:4:2") -var o4=_mz(z,'view',['class',0,'data-weui-theme',1],[],e,s,gg) -var x5=_v() -_(o4,x5) -cs.push("./page/API/components/set-tab-bar/set-tab-bar.wxml:template:5:4") -var o6=_oz(z,3,e,s,gg) -var f7=_gd(x[4],o6,e_,d_) -if(f7){ -var c8=_1z(z,2,e,s,gg) || {} -var cur_globalf=gg.f -x5.wxXCkey=3 -f7(c8,c8,x5,gg) -gg.f=cur_globalf -} -else _w(o6,x[4],5,16) -cs.pop() -var h9=_v() -_(o4,h9) -cs.push("./page/API/components/set-tab-bar/set-tab-bar.wxml:template:31:4") -var o0=_oz(z,4,e,s,gg) -var cAB=_gd(x[4],o0,e_,d_) -if(cAB){ -var oBB={} -var cur_globalf=gg.f -h9.wxXCkey=3 -cAB(oBB,oBB,h9,gg) -gg.f=cur_globalf -} -else _w(o0,x[4],31,16) -cs.pop() -cs.pop() -_(r,o4) -b3.pop() -b3.pop() -return r -} -e_[x[4]]={f:m4,j:[],i:[],ti:[x[5],x[6]],ic:[]} -d_[x[7]]={} -var m5=function(e,s,r,gg){ -var z=gz$gwx_6() -cs.push("./page/API/index.wxml:scroll-view:2:2") -var aDB=_mz(z,'scroll-view',['scrollY',-1,'class',0,'type',1],[],e,s,gg) -var tEB=_v() -_(aDB,tEB) -if(_oz(z,2,e,s,gg)){tEB.wxVkey=1 -cs.push("./page/API/index.wxml:set-tab-bar:3:2") -cs.push("./page/API/index.wxml:set-tab-bar:3:2") -var eFB=_n('set-tab-bar') -_rz(z,eFB,'bindunmount',3,e,s,gg) -cs.pop() -_(tEB,eFB) -cs.pop() -} -else{tEB.wxVkey=2 -cs.push("./page/API/index.wxml:view:4:2") -cs.pop() -} -tEB.wxXCkey=1 -tEB.wxXCkey=3 -cs.pop() -_(r,aDB) -return r -} -e_[x[7]]={f:m5,j:[],i:[],ti:[],ic:[]} -d_[x[8]]={} -var m6=function(e,s,r,gg){ -var z=gz$gwx_7() -return r -} -e_[x[8]]={f:m6,j:[],i:[],ti:[],ic:[]} -d_[x[9]]={} -d_[x[9]]["foot"]=function(e,s,r,gg){ -var z=gz$gwx_8() -var b=x[9]+':foot' -r.wxVkey=b -gg.f=$gdc(f_["./page/common/foot.wxml"],"",1) -if(p_[b]){_wl(b,x[9]);return} -p_[b]=true -try{ -}catch(err){ -p_[b]=false -throw err -} -p_[b]=false -return r -} -var m7=function(e,s,r,gg){ -var z=gz$gwx_8() -return r -} -e_[x[9]]={f:m7,j:[],i:[],ti:[],ic:[]} -d_[x[10]]={} -d_[x[10]]["head"]=function(e,s,r,gg){ -var z=gz$gwx_9() -var b=x[10]+':head' -r.wxVkey=b -gg.f=$gdc(f_["./page/common/head.wxml"],"",1) -if(p_[b]){_wl(b,x[10]);return} -p_[b]=true -try{ -var oB=_v() -_(r,oB) -if(_oz(z,1,e,s,gg)){oB.wxVkey=1 -cs.push("./page/common/head.wxml:view:5:6") -cs.pop() -} -oB.wxXCkey=1 -}catch(err){ -p_[b]=false -throw err -} -p_[b]=false -return r -} -var m8=function(e,s,r,gg){ -var z=gz$gwx_9() -return r -} -e_[x[10]]={f:m8,j:[],i:[],ti:[],ic:[]} -d_[x[11]]={} -var m9=function(e,s,r,gg){ -var z=gz$gwx_10() -return r -} -e_[x[11]]={f:m9,j:[],i:[],ti:[],ic:[]} -d_[x[12]]={} -var m10=function(e,s,r,gg){ -var z=gz$gwx_11() -return r -} -e_[x[12]]={f:m10,j:[],i:[],ti:[],ic:[]} -if(path&&e_[path]){ -return function(env,dd,global){$gwxc=0;var root={"tag":"wx-page"};root.children=[] -var main=e_[path].f -cs=[] -if (typeof global==="undefined")global={};global.f=$gdc(f_[path],"",1); -try{ -main(env,{},root,global); -_tsd(root) -}catch(err){ -console.log(cs, env); -console.log(err) -throw err -} -return root; -} -} -} diff --git a/test/node-modules/cases/wcc/case1/config.json b/test/node-modules/cases/wcc/raw/case1/config.json similarity index 97% rename from test/node-modules/cases/wcc/case1/config.json rename to test/node-modules/cases/wcc/raw/case1/config.json index d965728..1624584 100644 --- a/test/node-modules/cases/wcc/case1/config.json +++ b/test/node-modules/cases/wcc/raw/case1/config.json @@ -9,6 +9,6 @@ "replaceContent": { "./packageComponent/pages/camera-scan-code/camera-scan-code.wxml": "\n\n\n\n