pug-site-core 3.0.4 → 3.0.6
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/lib/generate.js +15 -6
- package/package.json +2 -2
package/lib/generate.js
CHANGED
|
@@ -565,7 +565,7 @@ export async function buildStatic() {
|
|
|
565
565
|
return htmlPath;
|
|
566
566
|
} catch (error) {
|
|
567
567
|
throw new Error(
|
|
568
|
-
`构建HTML路径失败 [lang: ${lang}, outputPath: ${outputPath}, fileName: ${fileName}]: ${error
|
|
568
|
+
`构建HTML路径失败 [lang: ${lang}, outputPath: ${outputPath}, fileName: ${fileName}]: ${error}`
|
|
569
569
|
);
|
|
570
570
|
}
|
|
571
571
|
}
|
|
@@ -586,7 +586,7 @@ export async function buildStatic() {
|
|
|
586
586
|
});
|
|
587
587
|
} catch (error) {
|
|
588
588
|
throw new Error(
|
|
589
|
-
`生成HTML失败 [funName: ${funName}, pagePath: ${pagePath}]: ${error
|
|
589
|
+
`生成HTML失败 [funName: ${funName}, pagePath: ${pagePath}]: ${error}`
|
|
590
590
|
);
|
|
591
591
|
}
|
|
592
592
|
}
|
|
@@ -632,7 +632,7 @@ export async function buildStatic() {
|
|
|
632
632
|
await fse.outputFile(htmlPath, compressedHtml);
|
|
633
633
|
} catch (error) {
|
|
634
634
|
throw new Error(
|
|
635
|
-
`处理数组数据项失败 [index: ${index}, property: ${property}]: ${error
|
|
635
|
+
`处理数组数据项失败 [index: ${index}, property: ${property}]: ${error}`
|
|
636
636
|
);
|
|
637
637
|
}
|
|
638
638
|
});
|
|
@@ -644,7 +644,7 @@ export async function buildStatic() {
|
|
|
644
644
|
}
|
|
645
645
|
} catch (error) {
|
|
646
646
|
throw new Error(
|
|
647
|
-
`处理数组数据失败 [lang: ${lang}, getDataFn: ${obj.getDataFn}]: ${error
|
|
647
|
+
`处理数组数据失败 [lang: ${lang}, getDataFn: ${obj.getDataFn}]: ${error}`
|
|
648
648
|
);
|
|
649
649
|
}
|
|
650
650
|
}
|
|
@@ -668,7 +668,7 @@ export async function buildStatic() {
|
|
|
668
668
|
await fse.outputFile(htmlPath, compressedHtml);
|
|
669
669
|
} catch (error) {
|
|
670
670
|
throw new Error(
|
|
671
|
-
`处理对象数据失败 [lang: ${lang}, getDataFn: ${obj.getDataFn}]: ${error
|
|
671
|
+
`处理对象数据失败 [lang: ${lang}, getDataFn: ${obj.getDataFn}]: ${error}`
|
|
672
672
|
);
|
|
673
673
|
}
|
|
674
674
|
}
|
|
@@ -735,7 +735,7 @@ export async function buildStatic() {
|
|
|
735
735
|
} catch (error) {
|
|
736
736
|
throw new Error(
|
|
737
737
|
`处理自定义HTML构建失败 [lang: ${lang}, config: ${JSON.stringify(obj)}]: ${
|
|
738
|
-
error
|
|
738
|
+
error
|
|
739
739
|
}`
|
|
740
740
|
);
|
|
741
741
|
}
|
|
@@ -849,6 +849,15 @@ export async function buildStatic() {
|
|
|
849
849
|
console.log("HTML压缩功能已禁用");
|
|
850
850
|
}
|
|
851
851
|
|
|
852
|
+
// 执行初始化函数
|
|
853
|
+
if (getData.init && typeof getData.init === "function") {
|
|
854
|
+
console.log("开始执行init初始化函数...");
|
|
855
|
+
const initStartTime = Date.now();
|
|
856
|
+
await getData.init();
|
|
857
|
+
const initCostTime = (Date.now() - initStartTime) / 1000;
|
|
858
|
+
console.log("初始化函数执行完成,耗时:", initCostTime, "s");
|
|
859
|
+
}
|
|
860
|
+
|
|
852
861
|
// 处理每种语言
|
|
853
862
|
await async.eachSeries(config.languageList, async (lang) => {
|
|
854
863
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pug-site-core",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.6",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"ws": "^8.18.0"
|
|
53
53
|
},
|
|
54
54
|
"license": "ISC",
|
|
55
|
-
"description": "
|
|
55
|
+
"description": "静态打包增加初始化函数的调用",
|
|
56
56
|
"files": [
|
|
57
57
|
"lib/",
|
|
58
58
|
"index.js"
|