pug-site-core 1.0.3 → 1.0.5
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/devServer.js +1 -1
- package/lib/generate.js +11 -4
- package/package.json +2 -3
package/lib/devServer.js
CHANGED
|
@@ -129,7 +129,7 @@ function setupRoutes(app, wss) {
|
|
|
129
129
|
`请求路径:${req.path} 模版路径:${pugPath} 数据JSON文件路径或getData中的函数名:${jsonDataPath}`
|
|
130
130
|
);
|
|
131
131
|
let commonData = {};
|
|
132
|
-
if (config.
|
|
132
|
+
if (config.langChangeUpdateCommon) {
|
|
133
133
|
const getDataPath = pathToFileURL(
|
|
134
134
|
path.resolve(projectRoot, "getData.js")
|
|
135
135
|
).href;
|
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, "
|
|
22
|
+
const pugRootPath = path.join(projectRoot, "template/pages");
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* 将pages目录下的pug模板编译为JS函数
|
|
@@ -34,7 +34,7 @@ export async function compilePagesPugToFn(pugPath) {
|
|
|
34
34
|
const fnRootPath = path.join(projectRoot, "/pagesPugFn");
|
|
35
35
|
|
|
36
36
|
// 读取pug运行时代码作为基础代码
|
|
37
|
-
const pugRuntimePath = path.join(projectRoot, "pugRuntime.js");
|
|
37
|
+
const pugRuntimePath = path.join(projectRoot, "/lib/pugRuntime.js");
|
|
38
38
|
const lastPugFnStr = await fse.readFile(pugRuntimePath, "utf8");
|
|
39
39
|
|
|
40
40
|
// 验证指定路径是否存在
|
|
@@ -484,8 +484,15 @@ export async function buildStatic() {
|
|
|
484
484
|
);
|
|
485
485
|
|
|
486
486
|
await compilePagesPugToFn();
|
|
487
|
-
|
|
488
|
-
|
|
487
|
+
const pagesPugFnPath = pathToFileURL(
|
|
488
|
+
path.resolve(projectRoot, "pagesPugFn/index.js")
|
|
489
|
+
).href;
|
|
490
|
+
let PagesPugToFn = await import(pagesPugFnPath);
|
|
491
|
+
const getDataPath = pathToFileURL(
|
|
492
|
+
path.resolve(projectRoot, "getData.js")
|
|
493
|
+
).href;
|
|
494
|
+
const getData = await import(getDataPath);
|
|
495
|
+
|
|
489
496
|
const fileMapTable = config.fileMapTable;
|
|
490
497
|
await async.each(config.languageList, async (lang) => {
|
|
491
498
|
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.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {},
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@google-cloud/translate": "^8.5.0",
|
|
11
11
|
"async": "^3.2.6",
|
|
12
|
-
"axios": "^1.7.7",
|
|
13
12
|
"chokidar": "^3.6.0",
|
|
14
13
|
"express": "^4.19.2",
|
|
15
14
|
"express-useragent": "^1.0.15",
|
|
@@ -28,7 +27,7 @@
|
|
|
28
27
|
"ws": "^8.18.0"
|
|
29
28
|
},
|
|
30
29
|
"license": "ISC",
|
|
31
|
-
"description": "
|
|
30
|
+
"description": "指令修复",
|
|
32
31
|
"files": [
|
|
33
32
|
"lib/",
|
|
34
33
|
"index.js"
|