@flun/html-template 4.0.14 → 4.0.22

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/f-CHANGELOG.md CHANGED
@@ -1,6 +1,4 @@
1
1
  # 变更日志
2
- ## [4.0.14] - 2026-04-30 20:33
2
+ ## [4.0.16] - 2026-05-01 21:08
3
3
  ### 优化:
4
- - 将静态目录工具中的 browser13.js 重命名为 browser.js;
5
- - 模板的按钮都添加了按钮属性;
6
- - 硬件列表样式优化;
4
+ - 内部文件注释完善;
package/package.json CHANGED
@@ -1,77 +1,77 @@
1
1
  {
2
- "name": "@flun/html-template",
3
- "version": "4.0.14",
4
- "description": "一个HTML模板工具包,提供开发服务器和模板编译功能,支持自定义标签和快捷输入,变量定义,包含文件引用,帮助开发者模块化处理HTML",
5
- "main": "index.js",
6
- "types": "index.d.ts",
7
- "scripts": {
8
- "dev": "node dev-server.js",
9
- "build": "node compile.js",
10
- "postinstall": "node copy-files.js 2>&1"
11
- },
12
- "keywords": [
13
- "html",
14
- "template",
15
- "server",
16
- "flun"
17
- ],
18
- "files": [
19
- "templates",
20
- "services",
21
- "static",
22
- "customize",
23
- ".env",
24
- "dev-server.js",
25
- "dev.js",
26
- "compile.js",
27
- "build.js",
28
- "restoreDefaults.js",
29
- "index.js",
30
- "index.d.ts",
31
- "copy-files.js",
32
- "f-README.md",
33
- "f-CHANGELOG.md",
34
- "LICENSE"
35
- ],
36
- "type": "module",
37
- "exports": {
38
- ".": "./index.js"
39
- },
40
- "author": "flun <cn@flun.top>",
41
- "publishConfig": {
42
- "access": "public"
43
- },
44
- "repository": {
45
- "type": "git",
46
- "url": "git+https://github.com/flunGit/html-template.git"
47
- },
48
- "homepage": "https://www.npmjs.com/package/@flun/html-template#readme",
49
- "bugs": {
50
- "url": "https://github.com/flunGit/html-template/issues"
51
- },
52
- "license": "ISC",
53
- "engines": {
54
- "node": ">=22.12.0",
55
- "npm": ">=10.0.0"
56
- },
57
- "dependencies": {
58
- "bcrypt": "^6.0.0",
59
- "chokidar": "^5.0.0",
60
- "express": "^5.2.1",
61
- "express-rate-limit": "^8.3.2",
62
- "express-session": "^1.19.0",
63
- "@flun/env": "^3.1.6",
64
- "@flun/mailer": "^2.1.6",
65
- "@flun/webauthn-server": "^2.0.8",
66
- "mysql2": "^3.20.0",
67
- "otplib": "^13.4.0",
68
- "qrcode": "^1.5.4",
69
- "socket.io": "^4.8.3"
70
- },
71
- "overrides": {
72
- "fast-xml-parser": "^5.3.4"
73
- },
74
- "devDependencies": {
75
- "nodemon": "^3.1.11"
76
- }
77
- }
2
+ "name": "@flun/html-template",
3
+ "version": "4.0.22",
4
+ "description": "一个HTML模板工具包,提供开发服务器和模板编译功能,支持自定义标签和快捷输入,变量定义,包含文件引用,帮助开发者模块化处理HTML;",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
+ "scripts": {
8
+ "dev": "node dev-server.js",
9
+ "build": "node compile.js",
10
+ "postinstall": "node copy-files.js 2>&1"
11
+ },
12
+ "keywords": [
13
+ "html",
14
+ "template",
15
+ "server",
16
+ "flun"
17
+ ],
18
+ "files": [
19
+ "templates",
20
+ "services",
21
+ "static",
22
+ "customize",
23
+ ".env",
24
+ "dev-server.js",
25
+ "dev.js",
26
+ "compile.js",
27
+ "build.js",
28
+ "restoreDefaults.js",
29
+ "index.js",
30
+ "index.d.ts",
31
+ "copy-files.js",
32
+ "f-README.md",
33
+ "f-CHANGELOG.md",
34
+ "LICENSE"
35
+ ],
36
+ "type": "module",
37
+ "exports": {
38
+ ".": "./index.js"
39
+ },
40
+ "author": "flun <cn@flun.top>",
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "git+https://github.com/flunGit/html-template.git"
47
+ },
48
+ "homepage": "https://www.npmjs.com/package/@flun/html-template#readme",
49
+ "bugs": {
50
+ "url": "https://github.com/flunGit/html-template/issues"
51
+ },
52
+ "license": "ISC",
53
+ "engines": {
54
+ "node": ">=22.12.0",
55
+ "npm": ">=10.0.0"
56
+ },
57
+ "dependencies": {
58
+ "bcrypt": "^6.0.0",
59
+ "chokidar": "^5.0.0",
60
+ "express": "^5.2.1",
61
+ "express-rate-limit": "^8.3.2",
62
+ "express-session": "^1.19.0",
63
+ "@flun/env": "*",
64
+ "@flun/mailer": "*",
65
+ "@flun/webauthn-server": "*",
66
+ "mysql2": "^3.20.0",
67
+ "otplib": "^13.4.0",
68
+ "qrcode": "^1.5.4",
69
+ "socket.io": "^4.8.3"
70
+ },
71
+ "overrides": {
72
+ "fast-xml-parser": "^5.3.4"
73
+ },
74
+ "devDependencies": {
75
+ "nodemon": "^3.1.11"
76
+ }
77
+ }
@@ -19,13 +19,31 @@ import { pathToFileURL } from 'url';
19
19
  // ==================== 1. 常量声明及工具函数====================
20
20
  let isCompilationMode = false;
21
21
  /**
22
- * 所有路径常量,其他文件从此导入
23
- * >查看定义:@see {@link fsPromises}、{@link CWD}、{@link templatesDir}、{@link templatesAbsDir}、{@link staticDir}、
24
- * {@link customizeDir}、{@link accountDir}、{@link defaultPort}、{@link writtenFilesToIgnore}
22
+ * fs模块的Promise版本,用于异步文件操作
23
+ * >查看定义:@see {@link fsPromises}
25
24
  */
26
- const fsPromises = fs.promises, CWD = process.cwd(), templatesDir = 'templates', templatesAbsDir = path.join(CWD, templatesDir),
27
- pRes = path.resolve, staticDir = 'static', customizeDir = 'customize', accountDir = 'account', defaultPort = 7296,
28
- userFeatures = {}, writtenFilesToIgnore = [], includedFiles = new Set(),
25
+ const fsPromises = fs.promises;
26
+ /**
27
+ * 当前工作目录
28
+ * >查看定义:@see {@link CWD}、{@link templatesDir}、{@link staticDir}、{@link customizeDir}、{@link accountDir}、{@link defaultPort}
29
+ */
30
+ const CWD = process.cwd(), templatesDir = 'templates', staticDir = 'static', customizeDir = 'customize',
31
+ accountDir = 'account', defaultPort = 7296;
32
+ /**
33
+ * 模板文件绝对路径
34
+ * >查看定义:@see {@link templatesAbsDir}
35
+ */
36
+ const templatesAbsDir = path.join(CWD, templatesDir);
37
+ /**
38
+ * 路径解析函数
39
+ * >查看定义:@see {@link pRes}
40
+ */
41
+ const pRes = path.resolve;
42
+ /**
43
+ * 已写入文件忽略列表(监控文件写入时使用,防止编译器误触发重新编译)
44
+ * >查看定义:@see {@link writtenFilesToIgnore}
45
+ */
46
+ const writtenFilesToIgnore = [], userFeatures = {}, includedFiles = new Set(),
29
47
  // 预编译所有高频正则表达式
30
48
  includeRegex = /(\"|')\[include\s+([^\]]+)\](\"|')|\[include\s+([\S\s]+?)\]/gi, quotedVarRegex = /`\s*{{(.*?)}}\s*`/g,
31
49
  userFuncRegex = /\{\{\s*user:\s*([^\s()]+?)\s*\(([^)]*)\)\s*\}\}/g, templateTagRegex = /\[!([^\]]*?)\]|\[\~([^\]]*?)\]/g,