Skip to content

Commit 662f73d

Browse files
committed
update: update logic to v2.01.2510250
1 parent 0818a27 commit 662f73d

File tree

14 files changed

+303708
-298026
lines changed

14 files changed

+303708
-298026
lines changed

.mocharc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ module.exports = {
1212
// 'test/spec/issue/129/issue129.spec.ts',
1313
// 'test/spec/issue/115/issue115.spec.ts',
1414
// 'test/spec/wcc/module/module.spec.ts',
15+
// 'test/spec/wcc/wxs/wxs.spec.ts',
16+
// 'test/spec/wcsc/raw/raw.spec.ts',
1517
],
1618
// spec: "test/spec/wcc/wxs/wxs.spec.ts",
1719
timeout: 20000,

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
🚀Features
44
- 架构:添加龙芯支持
5+
- 编译器:跟进v2.01.2510250版本
56

67
## 🌈 v0.1.5 / 2025-05-02
78

src/include/define.h

Lines changed: 5 additions & 1 deletion
Large diffs are not rendered by default.

src/include/wxml.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ namespace WXML
718718
} // namespace EXPRLib
719719

720720
namespace GlassEaselWxs {
721-
const std::string sWrapper = "function n(nv_require,nv_exports,nv_module){%s}const t={nv_exports:{}};n((function(n){n.startsWith(\"p_\")&&(n=\"/\"+n.slice(2)),n.endsWith(\".wxs\")&&(n=n.slice(0,n.length-4));const t=gdc(require(n),\"nv_\");return function(){return t}}),t.nv_exports,t),Object.assign(module,gdc(t,void 0));";
721+
const std::string sWrapper = "function e(nv_require,nv_exports,nv_module){\u000a%s\u000a}const n={nv_exports:{}};e((function(e){return e.startsWith(\u0022p_\u0022)&&(e=\u0022/\u0022+e.slice(2)),e.endsWith(\u0022.wxs\u0022)&&(e=e.slice(0,e.length-4)),()=>gdc(require(e)(),\u0022nv_\u0022,2)}),n.nv_exports,n),Object.assign(module,gdc(n,void 0,2));";
722722
const std::string sGenFuncDeepCopy = "var gdc=function(){var e=function(){return void 0!==this?this:\"undefined\"!=typeof globalThis?globalThis:\"undefine"
723723
"d\"!=typeof self?self:\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:{}}();return function("
724724
"n,t,o,i=e){if(null==n)return n;if(\"undefined\"!=typeof __wxCodeSpace__&&\"function\"==typeof __wxCodeSpace__.isWxsS"

src/module/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ add_library(wcc_module
105105
../utils/file.cpp
106106
${CMAKE_JS_SRC}
107107
)
108+
target_compile_definitions(wcc_module PUBLIC -D__ADDON__)
108109
target_link_libraries(wcc_module PRIVATE rt pthread)
109110
set_target_properties(wcc_module PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
110111
set_target_properties(wcc_module PROPERTIES PREFIX "" SUFFIX ".node")
@@ -139,6 +140,7 @@ add_library(wcsc_module
139140
../utils/file.cpp
140141
${CMAKE_JS_SRC}
141142
)
143+
target_compile_definitions(wcsc_module PUBLIC -D__ADDON__)
142144
target_link_libraries(wcsc_module PRIVATE rt pthread)
143145
set_target_properties(wcsc_module PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
144146
set_target_properties(wcsc_module PROPERTIES PREFIX "" SUFFIX ".node")

src/wxml/compiler.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -963,8 +963,11 @@ namespace WXML{
963963
// Compile - 15
964964
v317 << "function _(a,b){if(typeof(b)!='undefined')a.children.push(b);}" << lineEndMark;
965965
v317 << "function _v(k){if(typeof(k)!='undefined')return {tag:'virtual','wxKey':k,children:[]};return {tag:'virtual',children:[]};}" << lineEndMark;
966-
v317 << "function _n(tag){$gwxc++;if($gwxc>=16000){throw 'Dom limit exceeded, please check if there\\'s any mistake you"
967-
"\\'ve made.'};return {tag:'wx-'+tag,attr:{},children:[],n:[],raw:{},generics:{}}}" << lineEndMark;
966+
v317 << "function _n(tag){";
967+
#ifdef __ADDON__
968+
v317 << "$gwxc++;if($gwxc>=16000){throw 'Dom limit exceeded, please check if there\\'s any mistake you\\'ve made.'};";
969+
#endif
970+
v317 << "return {tag:'wx-'+tag,attr:{},children:[],n:[],raw:{},generics:{}}}" << lineEndMark;
968971
v317 << "function _p(a,b){b&&a.properities.push(b);}" << lineEndMark;
969972
v317 << "function _s(scope,env,key){return typeof(scope[key])!='undefined'?scope[key]:env[key]}" << lineEndMark;
970973
v317 << "function _wp(m){console.warn(\"WXMLRT_" << gwxMark << ":\"+m)}" << lineEndMark;

src/wxss/x_compiler.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,11 @@ namespace WXSS
321321
"{\n"
322322
"var op = content[0];\n"
323323
"if ( op == 0 )\n"
324+
#ifdef __ADDON__
324325
"res = transformRPX(content[1], opt.deviceWidth) + \"px\" + res;\n"
326+
#else
327+
"res = transformRPX(content[1], opt.deviceWidth) + (window.__convertRpxToVw__ ? \"vw\" : \"px\") + res;\n"
328+
#endif
325329
"else if ( op == 1)\n"
326330
"res = opt.suffix + res;\n"
327331
"else if ( op == 2 )\n"
@@ -590,7 +594,7 @@ namespace WXSS
590594
v29 += "();";
591595
}
592596
std::string v33 = v37.str();
593-
int v23 = v33.length() + 3022;
597+
int v23 = v33.length() + 3059;
594598
char buf[v23];
595599
snprintf(buf, v23, "var BASE_DEVICE_WIDTH = 750;\n"
596600
"var isIOS=navigator.userAgent.match(\"iPhone\");\n"
@@ -642,7 +646,11 @@ namespace WXSS
642646
"{\n"
643647
"var op = content[0];\n"
644648
"if ( op == 0 )\n"
649+
#ifdef __ADDON__
645650
"res = transformRPX(content[1], opt.deviceWidth) + \"px\" + res;\n"
651+
#else
652+
"res = transformRPX(content[1], opt.deviceWidth) + (window.__convertRpxToVw__ ? \"vw\" : \"px\") + res;\n"
653+
#endif
646654
"else if ( op == 1)\n"
647655
"res = opt.suffix + res;\n"
648656
"else if ( op == 2 )\n"
-2.73 KB
Binary file not shown.
-2.73 KB
Binary file not shown.

test/spec/wcsc/raw/raw.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import linux from '../../../runner/binary-linux'
44
import windows from '../../../runner/binary-windows'
55
import * as fs from 'fs'
66

7-
describe("wcsc", function () {
7+
describe("wcsc - raw", function () {
88
describe("Raw: node output should equal with wine", function () {
99
// afterEach(function(){
1010
// if(this.currentTest.state === 'failed'){

0 commit comments

Comments
 (0)