wgt-node-utils 1.2.7 → 1.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -4
- package/dist/bundle.js +1 -1
- package/package.json +1 -1
- package/src/index.js +9 -18
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -252,7 +252,7 @@ class wgtNodeUtils {
|
|
|
252
252
|
* @dirname 项目的绝对地址
|
|
253
253
|
* @useReactRouterDom 是否需要reactRouterDom
|
|
254
254
|
*/
|
|
255
|
-
readF2eFiles = (buildName, version, dirname
|
|
255
|
+
readF2eFiles = (buildName, version, dirname) => {
|
|
256
256
|
console.log('静态资源:开始读取');
|
|
257
257
|
return new Promise((resolve, reject) => {
|
|
258
258
|
try {
|
|
@@ -273,14 +273,9 @@ class wgtNodeUtils {
|
|
|
273
273
|
}
|
|
274
274
|
});
|
|
275
275
|
// 增加react依赖
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
if (useReactRouterDom) {
|
|
280
|
-
this.fileContents['react-router-dom.min.js'] = fs.readFileSync(path.join(dirname, `../${buildName}/dist/react-router-dom.min.js`),'utf8');
|
|
281
|
-
}
|
|
276
|
+
fileContents['preact.min.js'] = fs.readFileSync(path.join(__dirname, `../${name}/dist/preact.min.js`),'utf8');
|
|
277
|
+
console.log('静态资源列表:');
|
|
282
278
|
|
|
283
|
-
console.log('静态资源列表:');
|
|
284
279
|
const f2eFileLoadStatus = Object.keys(this.fileContents).every((item) => {
|
|
285
280
|
const file = this.fileContents[item];
|
|
286
281
|
console.log(item, ':', file ? file.length : 'null');
|
|
@@ -646,7 +641,7 @@ class wgtNodeUtils {
|
|
|
646
641
|
* @pageName 页面名称
|
|
647
642
|
* @isMobile 是否为移动端
|
|
648
643
|
*/
|
|
649
|
-
getModelF2eFiles = (pageName, isMobile
|
|
644
|
+
getModelF2eFiles = (pageName, isMobile) => {
|
|
650
645
|
let jsName = `${pageName}.entry.js`;
|
|
651
646
|
let cssName = `${pageName}.entry.css`;
|
|
652
647
|
// 带设备信息的静态资源
|
|
@@ -658,13 +653,9 @@ class wgtNodeUtils {
|
|
|
658
653
|
let f2eFiles = {
|
|
659
654
|
jsStr: this.fileContents[jsName],
|
|
660
655
|
cssStr: this.fileContents[cssName],
|
|
661
|
-
|
|
662
|
-
reactDomStr: this.fileContents['react-dom.production.min.js']
|
|
656
|
+
preactStr: fileContents['preact.min.js']
|
|
663
657
|
};
|
|
664
|
-
|
|
665
|
-
if (useReactRouterDom) {
|
|
666
|
-
f2eFiles.reactRouterStr = this.fileContents['react-router-dom.min.js']
|
|
667
|
-
}
|
|
658
|
+
|
|
668
659
|
// 每次启动服务后仅对第一次失败进行验证
|
|
669
660
|
if (!this.filesErrorSendStatus) {
|
|
670
661
|
const fileStatus = Object.keys(f2eFiles).every(item => {
|
|
@@ -672,7 +663,7 @@ class wgtNodeUtils {
|
|
|
672
663
|
if (file && file.length > 0) {
|
|
673
664
|
return true;
|
|
674
665
|
}
|
|
675
|
-
this.appendLog(`文件加载失败:${pageName}[${item}]
|
|
666
|
+
this.appendLog(`文件加载失败:${pageName}[${item}]`);
|
|
676
667
|
return false;
|
|
677
668
|
});
|
|
678
669
|
this.filesErrorSendStatus = !fileStatus;
|
|
@@ -757,8 +748,8 @@ class wgtNodeUtils {
|
|
|
757
748
|
// 检查是否包含大写字母(排除大写字母)
|
|
758
749
|
const hasUpperCase = /[A-Z]/;
|
|
759
750
|
|
|
760
|
-
//
|
|
761
|
-
const hasSpecialChar = /[^a-zA-Z0-9/_]/;
|
|
751
|
+
// 检查是否包含特殊字符(除斜杠 、下划线 横杠外)
|
|
752
|
+
const hasSpecialChar = /[^a-zA-Z0-9/_-]/;
|
|
762
753
|
|
|
763
754
|
|
|
764
755
|
// 任意条件满足即为非法路径
|