njk-tool 0.0.3 → 0.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.
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "njk-tool",
|
|
3
|
+
"version": "0.0.4",
|
|
4
|
+
"description": "nunjucks no JavaScript 模板工具,兼容jinja",
|
|
5
|
+
"types": "dist/bundle/type.d.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"require": "./dist/bundle/app.min.cjs",
|
|
9
|
+
"import": "./dist/bundle/app.min.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"author": "zggong",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/SHgzg/njk-tool.git"
|
|
17
|
+
},
|
|
18
|
+
"type": "module",
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"nunjucks": "^3.2.4"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist/bundle",
|
|
24
|
+
"LICENSE",
|
|
25
|
+
"README.md"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "rollup -c && rollup -c rollup.dts.config.js",
|
|
29
|
+
"build:type": "rollup -c rollup.dts.config.js",
|
|
30
|
+
"dev": "npx tsc && node ./dist/dev/main.js"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"nunjucks",
|
|
34
|
+
"template"
|
|
35
|
+
],
|
|
36
|
+
"packageManager": "pnpm@10.9.0",
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"nunjucks": "^3.2.4"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@rollup/plugin-commonjs": "^28.0.6",
|
|
42
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
43
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
44
|
+
"@rollup/plugin-typescript": "^12.1.4",
|
|
45
|
+
"@types/express": "^5.0.2",
|
|
46
|
+
"@types/node": "^22.15.30",
|
|
47
|
+
"@types/nunjucks": "^3.2.6",
|
|
48
|
+
"chokidar": "3.6.0",
|
|
49
|
+
"dotenv": "^16.5.0",
|
|
50
|
+
"express": "^5.1.0",
|
|
51
|
+
"rollup": "^4.45.1",
|
|
52
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
53
|
+
"rollup-plugin-dts": "^6.2.1",
|
|
54
|
+
"tslib": "^2.8.1",
|
|
55
|
+
"typescript": "^5.8.3"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
declare enum TagType {
|
|
2
|
+
Title = "title",
|
|
3
|
+
Date = "date",
|
|
4
|
+
Checker = "checker",
|
|
5
|
+
Head = "head",
|
|
6
|
+
Text = "text",
|
|
7
|
+
Toc = "toc",
|
|
8
|
+
Notice = "notice",
|
|
9
|
+
Block = "block",
|
|
10
|
+
Table = "table"
|
|
11
|
+
}
|
|
12
|
+
interface BaseConfItem {
|
|
13
|
+
tag: TagType;
|
|
14
|
+
type?: string;
|
|
15
|
+
title?: string;
|
|
16
|
+
text?: string;
|
|
17
|
+
style?: string;
|
|
18
|
+
cssFiles?: string[];
|
|
19
|
+
jsFiles?: string[];
|
|
20
|
+
}
|
|
21
|
+
interface ListConfItem extends BaseConfItem {
|
|
22
|
+
tag: TagType.Toc | TagType.Block;
|
|
23
|
+
data?: Array<object>;
|
|
24
|
+
}
|
|
25
|
+
interface TableConfItem extends BaseConfItem {
|
|
26
|
+
tag: TagType.Table;
|
|
27
|
+
columns?: Array<{
|
|
28
|
+
key: string;
|
|
29
|
+
label: string;
|
|
30
|
+
}>;
|
|
31
|
+
data?: Array<object>;
|
|
32
|
+
th?: Array<{
|
|
33
|
+
key: string;
|
|
34
|
+
width?: string;
|
|
35
|
+
}>;
|
|
36
|
+
tbody?: Array<object[]>;
|
|
37
|
+
}
|
|
38
|
+
type ConfItem = BaseConfItem | ListConfItem | TableConfItem;
|
|
39
|
+
|
|
40
|
+
interface Options {
|
|
41
|
+
cssUrl?: string | string[];
|
|
42
|
+
templateDir?: string;
|
|
43
|
+
asyncLoad?: boolean;
|
|
44
|
+
}
|
|
45
|
+
declare const njkRender: (config: ConfItem | ConfItem[], options?: Options) => Promise<string>;
|
|
46
|
+
declare const njkRenderSync: (config: ConfItem | ConfItem[], options?: Options) => string;
|
|
47
|
+
|
|
48
|
+
export { njkRender, njkRenderSync };
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "njk-tool",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "nunjucks no JavaScript 模板工具,兼容jinja",
|
|
5
|
+
"types": "dist/bundle/type.d.ts",
|
|
5
6
|
"exports": {
|
|
6
7
|
".": {
|
|
7
8
|
"require": "./dist/bundle/app.min.cjs",
|
|
@@ -24,7 +25,8 @@
|
|
|
24
25
|
"README.md"
|
|
25
26
|
],
|
|
26
27
|
"scripts": {
|
|
27
|
-
"build": "rollup -c",
|
|
28
|
+
"build": "rollup -c && rollup -c rollup.dts.config.js",
|
|
29
|
+
"build:type": "rollup -c rollup.dts.config.js",
|
|
28
30
|
"dev": "npx tsc && node ./dist/dev/main.js"
|
|
29
31
|
},
|
|
30
32
|
"keywords": [
|
|
@@ -48,7 +50,8 @@
|
|
|
48
50
|
"express": "^5.1.0",
|
|
49
51
|
"rollup": "^4.45.1",
|
|
50
52
|
"rollup-plugin-copy": "^3.5.0",
|
|
53
|
+
"rollup-plugin-dts": "^6.2.1",
|
|
51
54
|
"tslib": "^2.8.1",
|
|
52
55
|
"typescript": "^5.8.3"
|
|
53
56
|
}
|
|
54
|
-
}
|
|
57
|
+
}
|