@lytjs/ssg 6.6.0

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/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # @lytjs/ssg
2
+
3
+ > LytJS 静态站点生成工具。
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@lytjs/ssg.svg)](https://www.npmjs.com/package/@lytjs/ssg)
6
+ [![license](https://img.shields.io/npm/l/@lytjs/ssg.svg)](https://gitee.com/lytjs/lytjs/blob/main/LICENSE)
7
+
8
+ ## 简介
9
+
10
+ `@lytjs/ssg` 是 LytJS 框架的静态站点生成工具,用于将动态内容预渲染为静态 HTML 文件。
11
+
12
+ ### 核心特性
13
+
14
+ - **增量静态生成**:支持增量预渲染
15
+ - **路由清单生成**:自动生成路由清单
16
+ - **零依赖**:不引入任何外部依赖
17
+
18
+ ## 安装
19
+
20
+ ```bash
21
+ npm install @lytjs/ssg
22
+ ```
23
+
24
+ 或使用 pnpm:
25
+
26
+ ```bash
27
+ pnpm add @lytjs/ssg
28
+ ```
29
+
30
+ ## 许可证
31
+
32
+ MIT License - [查看许可证](https://gitee.com/lytjs/lytjs/blob/main/LICENSE)
33
+
34
+ ## 贡献指南
35
+
36
+ 欢迎提交 Issue 和 Pull Request!
37
+
38
+ - [Gitee 仓库](https://gitee.com/lytjs/lytjs)
39
+ - [问题反馈](https://gitee.com/lytjs/lytjs/issues)
package/dist/index.cjs ADDED
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ var __defProp = Object.defineProperty;
4
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5
+ var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
6
+
7
+ // src/generator.ts
8
+ var SSGGenerator = class {
9
+ constructor(config) {
10
+ __publicField(this, "config", config);
11
+ }
12
+ async generate() {
13
+ const results = [];
14
+ for (const route of this.config.routes) {
15
+ results.push(await this.generateRoute(route));
16
+ }
17
+ return results;
18
+ }
19
+ async generateRoute(route) {
20
+ return {
21
+ route,
22
+ outputPath: "",
23
+ success: true
24
+ };
25
+ }
26
+ };
27
+
28
+ exports.SSGGenerator = SSGGenerator;
29
+ //# sourceMappingURL=index.cjs.map
30
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/generator.ts"],"names":[],"mappings":";;;;;;;AAEO,IAAM,eAAN,MAAmB;AAAA,EACxB,YAAoB,MAAA,EAAmB;AAAnB,IAAA,aAAA,CAAA,IAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AAAA,EAAoB;AAAA,EAExC,MAAM,QAAA,GAAiC;AACrC,IAAA,MAAM,UAAuB,EAAC;AAE9B,IAAA,KAAA,MAAW,KAAA,IAAS,IAAA,CAAK,MAAA,CAAO,MAAA,EAAQ;AACtC,MAAA,OAAA,CAAQ,IAAA,CAAK,MAAM,IAAA,CAAK,aAAA,CAAc,KAAK,CAAC,CAAA;AAAA,IAC9C;AAEA,IAAA,OAAO,OAAA;AAAA,EACT;AAAA,EAEA,MAAc,cAAc,KAAA,EAAmC;AAC7D,IAAA,OAAO;AAAA,MACL,KAAA;AAAA,MACA,UAAA,EAAY,EAAA;AAAA,MACZ,OAAA,EAAS;AAAA,KACX;AAAA,EACF;AACF","file":"index.cjs","sourcesContent":["import type { SSGConfig, SSGResult } from './types';\n\nexport class SSGGenerator {\n constructor(private config: SSGConfig) {}\n\n async generate(): Promise<SSGResult[]> {\n const results: SSGResult[] = [];\n\n for (const route of this.config.routes) {\n results.push(await this.generateRoute(route));\n }\n\n return results;\n }\n\n private async generateRoute(route: string): Promise<SSGResult> {\n return {\n route,\n outputPath: '',\n success: true,\n };\n }\n}\n"]}
@@ -0,0 +1,20 @@
1
+ interface SSGConfig {
2
+ routes: string[];
3
+ outputDir: string;
4
+ template?: string;
5
+ }
6
+ interface SSGResult {
7
+ route: string;
8
+ outputPath: string;
9
+ success: boolean;
10
+ error?: Error;
11
+ }
12
+
13
+ declare class SSGGenerator {
14
+ private config;
15
+ constructor(config: SSGConfig);
16
+ generate(): Promise<SSGResult[]>;
17
+ private generateRoute;
18
+ }
19
+
20
+ export { type SSGConfig, SSGGenerator, type SSGResult };
@@ -0,0 +1,20 @@
1
+ interface SSGConfig {
2
+ routes: string[];
3
+ outputDir: string;
4
+ template?: string;
5
+ }
6
+ interface SSGResult {
7
+ route: string;
8
+ outputPath: string;
9
+ success: boolean;
10
+ error?: Error;
11
+ }
12
+
13
+ declare class SSGGenerator {
14
+ private config;
15
+ constructor(config: SSGConfig);
16
+ generate(): Promise<SSGResult[]>;
17
+ private generateRoute;
18
+ }
19
+
20
+ export { type SSGConfig, SSGGenerator, type SSGResult };
package/dist/index.mjs ADDED
@@ -0,0 +1,28 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
4
+
5
+ // src/generator.ts
6
+ var SSGGenerator = class {
7
+ constructor(config) {
8
+ __publicField(this, "config", config);
9
+ }
10
+ async generate() {
11
+ const results = [];
12
+ for (const route of this.config.routes) {
13
+ results.push(await this.generateRoute(route));
14
+ }
15
+ return results;
16
+ }
17
+ async generateRoute(route) {
18
+ return {
19
+ route,
20
+ outputPath: "",
21
+ success: true
22
+ };
23
+ }
24
+ };
25
+
26
+ export { SSGGenerator };
27
+ //# sourceMappingURL=index.mjs.map
28
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/generator.ts"],"names":[],"mappings":";;;;;AAEO,IAAM,eAAN,MAAmB;AAAA,EACxB,YAAoB,MAAA,EAAmB;AAAnB,IAAA,aAAA,CAAA,IAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AAAA,EAAoB;AAAA,EAExC,MAAM,QAAA,GAAiC;AACrC,IAAA,MAAM,UAAuB,EAAC;AAE9B,IAAA,KAAA,MAAW,KAAA,IAAS,IAAA,CAAK,MAAA,CAAO,MAAA,EAAQ;AACtC,MAAA,OAAA,CAAQ,IAAA,CAAK,MAAM,IAAA,CAAK,aAAA,CAAc,KAAK,CAAC,CAAA;AAAA,IAC9C;AAEA,IAAA,OAAO,OAAA;AAAA,EACT;AAAA,EAEA,MAAc,cAAc,KAAA,EAAmC;AAC7D,IAAA,OAAO;AAAA,MACL,KAAA;AAAA,MACA,UAAA,EAAY,EAAA;AAAA,MACZ,OAAA,EAAS;AAAA,KACX;AAAA,EACF;AACF","file":"index.mjs","sourcesContent":["import type { SSGConfig, SSGResult } from './types';\n\nexport class SSGGenerator {\n constructor(private config: SSGConfig) {}\n\n async generate(): Promise<SSGResult[]> {\n const results: SSGResult[] = [];\n\n for (const route of this.config.routes) {\n results.push(await this.generateRoute(route));\n }\n\n return results;\n }\n\n private async generateRoute(route: string): Promise<SSGResult> {\n return {\n route,\n outputPath: '',\n success: true,\n };\n }\n}\n"]}
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@lytjs/ssg",
3
+ "version": "6.6.0",
4
+ "description": "LytJS Static Site Generation (SSG) support",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.mjs",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.mjs",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsup",
21
+ "dev": "tsup --watch",
22
+ "test": "vitest run",
23
+ "type-check": "tsc --noEmit",
24
+ "clean": "rm -rf dist"
25
+ },
26
+ "dependencies": {
27
+ "@lytjs/ssr": "workspace:*",
28
+ "@lytjs/common-is": "workspace:*",
29
+ "@lytjs/common-path": "workspace:*"
30
+ },
31
+ "devDependencies": {
32
+ "tsup": "^8.0.0",
33
+ "typescript": "^5.4.0",
34
+ "vitest": "^3.0.0"
35
+ },
36
+ "license": "MIT",
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "https://gitee.com/lytjs/lytjs.git",
40
+ "directory": "packages/ecosystem/packages/ssr-kit/packages/ssg"
41
+ },
42
+ "keywords": [
43
+ "lytjs",
44
+ "ssg",
45
+ "static-site-generation"
46
+ ]
47
+ }