pug-site-core 1.0.4 → 1.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.
Files changed (2) hide show
  1. package/lib/generate.js +11 -6
  2. package/package.json +2 -2
package/lib/generate.js CHANGED
@@ -19,7 +19,7 @@ const projectRoot = process.cwd();
19
19
  const configPath = pathToFileURL(path.resolve(projectRoot, "config.js")).href;
20
20
  const { config } = await import(configPath);
21
21
 
22
- const pugRootPath = path.join(projectRoot, "/template/pages");
22
+ const pugRootPath = path.join(projectRoot, "template/pages");
23
23
 
24
24
  /**
25
25
  * 将pages目录下的pug模板编译为JS函数
@@ -32,10 +32,8 @@ export async function compilePagesPugToFn(pugPath) {
32
32
  // 获取所有需要编译的pug文件路径
33
33
  const pagesPugFilePathArr = await getPagesPugFilePathArr();
34
34
  const fnRootPath = path.join(projectRoot, "/pagesPugFn");
35
-
36
35
  // 读取pug运行时代码作为基础代码
37
- const pugRuntimePath = path.join(projectRoot, "pugRuntime.js");
38
- const lastPugFnStr = await fse.readFile(pugRuntimePath, "utf8");
36
+ const lastPugFnStr = await fse.readFile("./pugRuntime.js", "utf8");
39
37
 
40
38
  // 验证指定路径是否存在
41
39
  if (pugPath && !fse.pathExistsSync(path.join(pugRootPath, pugPath))) {
@@ -484,8 +482,15 @@ export async function buildStatic() {
484
482
  );
485
483
 
486
484
  await compilePagesPugToFn();
487
- let PagesPugToFn = await import("./pagesPugFn/index.js");
488
- const getData = await import("./getData.js");
485
+ const pagesPugFnPath = pathToFileURL(
486
+ path.resolve(projectRoot, "pagesPugFn/index.js")
487
+ ).href;
488
+ let PagesPugToFn = await import(pagesPugFnPath);
489
+ const getDataPath = pathToFileURL(
490
+ path.resolve(projectRoot, "getData.js")
491
+ ).href;
492
+ const getData = await import(getDataPath);
493
+
489
494
  const fileMapTable = config.fileMapTable;
490
495
  await async.each(config.languageList, async (lang) => {
491
496
  let langDataPath = path.join(jsonDataPath, lang);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pug-site-core",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "scripts": {},
@@ -27,7 +27,7 @@
27
27
  "ws": "^8.18.0"
28
28
  },
29
29
  "license": "ISC",
30
- "description": "配置参数优化",
30
+ "description": "指令修复",
31
31
  "files": [
32
32
  "lib/",
33
33
  "index.js"