pug-site-core 3.0.1 → 3.0.2

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.
Files changed (2) hide show
  1. package/lib/generate.js +8 -7
  2. package/package.json +2 -2
package/lib/generate.js CHANGED
@@ -556,7 +556,7 @@ export async function buildStatic() {
556
556
  if (regex.test(name)) {
557
557
  const property = name.slice(1, -1);
558
558
 
559
- await async.eachLimit(data, 12, async (dataItem, index) => {
559
+ await async.eachLimit(data, 64, async (dataItem, index) => {
560
560
  try {
561
561
  const fileName = dataItem[property];
562
562
  if (!fileName) {
@@ -601,11 +601,11 @@ export async function buildStatic() {
601
601
  async function processCustomBuildHtml(pagesPugToFn, lang, getData, commonData, dealWithEndFunName) {
602
602
  if (!config.customBuildHtml?.length) return;
603
603
 
604
- for (const obj of config.customBuildHtml) {
604
+ await async.eachLimit(config.customBuildHtml, 3, async (obj) => {
605
605
  try {
606
606
  // 检查语言过滤
607
607
  if (obj.includeLang?.length > 0 && !obj.includeLang.includes(lang)) {
608
- continue;
608
+ return;
609
609
  }
610
610
 
611
611
  // 获取数据
@@ -632,7 +632,7 @@ export async function buildStatic() {
632
632
  } catch (error) {
633
633
  throw new Error(`处理自定义HTML构建失败 [lang: ${lang}, config: ${JSON.stringify(obj)}]: ${error.message}`);
634
634
  }
635
- }
635
+ });
636
636
  }
637
637
 
638
638
  /**
@@ -644,7 +644,7 @@ export async function buildStatic() {
644
644
  await fse.readdir(langDataPath, { recursive: true })
645
645
  ).filter((fileName) => fileName.endsWith(".json"));
646
646
 
647
- await async.eachLimit(pagesAllJsonFileName, 12, async (jsonFileName) => {
647
+ await async.eachLimit(pagesAllJsonFileName, 64, async (jsonFileName) => {
648
648
  try {
649
649
  const data = await fse.readJSON(paths.resolveRoot(langDataPath, jsonFileName));
650
650
  const pugTemplate = data._template;
@@ -675,7 +675,7 @@ export async function buildStatic() {
675
675
  lang,
676
676
  finalPugTemplate.replace(/\..*$/, ".html")
677
677
  );
678
-
678
+ console.log(htmlPath);
679
679
  await fse.outputFile(htmlPath, html);
680
680
  } catch (error) {
681
681
  throw new Error(`处理JSON文件失败 [file: ${jsonFileName}]: ${error.message}`);
@@ -719,7 +719,7 @@ export async function buildStatic() {
719
719
  const PagesPugToFn = await import(paths.pagesPugFn);
720
720
 
721
721
  // 处理每种语言
722
- await async.each(config.languageList, async (lang) => {
722
+ await async.eachSeries(config.languageList, async (lang) => {
723
723
  try {
724
724
  console.log("开始处理语言:", lang);
725
725
  const langDataPath = paths.resolveRoot(jsonDataPath, lang);
@@ -743,6 +743,7 @@ export async function buildStatic() {
743
743
  // 处理页面JSON文件
744
744
  await processPageJsonFiles(PagesPugToFn, lang, langDataPath, commonData, dealWithEndFunName);
745
745
 
746
+ console.log("处理语言:", lang, "完成");
746
747
  } catch (error) {
747
748
  throw new Error(`处理语言 ${lang} 失败: ${error.message}`);
748
749
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pug-site-core",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -51,7 +51,7 @@
51
51
  "ws": "^8.18.0"
52
52
  },
53
53
  "license": "ISC",
54
- "description": "修复并优化静态html打包功能、并将默认下载数据线程12->3",
54
+ "description": "优化静态html打包的log、并优化默认下载数据线程",
55
55
  "files": [
56
56
  "lib/",
57
57
  "index.js"