pug-site-core 1.0.6 → 1.0.7

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 +6 -2
  2. package/package.json +1 -1
package/lib/generate.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  import _ from "lodash";
14
14
  import async from "async";
15
15
  import UglifyJS from "uglify-js";
16
- import { pathToFileURL } from "url";
16
+ import { pathToFileURL, fileURLToPath } from "url";
17
17
 
18
18
  const projectRoot = process.cwd();
19
19
  const configPath = pathToFileURL(path.resolve(projectRoot, "config.js")).href;
@@ -32,8 +32,12 @@ export async function compilePagesPugToFn(pugPath) {
32
32
  // 获取所有需要编译的pug文件路径
33
33
  const pagesPugFilePathArr = await getPagesPugFilePathArr();
34
34
  const fnRootPath = path.join(projectRoot, "/pagesPugFn");
35
+
36
+ // 获取当前文件的目录路径
37
+ const currentDir = path.dirname(fileURLToPath(import.meta.url));
35
38
  // 读取pug运行时代码作为基础代码
36
- const lastPugFnStr = await fse.readFile("./pugRuntime.js", "utf8");
39
+ const pugRuntimePath = path.join(currentDir, "pugRuntime.js");
40
+ const lastPugFnStr = await fse.readFile(pugRuntimePath, "utf8");
37
41
 
38
42
  // 验证指定路径是否存在
39
43
  if (pugPath && !fse.pathExistsSync(path.join(pugRootPath, pugPath))) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pug-site-core",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "scripts": {},