@lytjs/bundler 6.5.0 → 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 +81 -81
- package/dist/index.cjs +6 -7
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.mjs +6 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
# @lytjs/bundler
|
|
2
|
-
|
|
3
|
-
LytJS 构建工具集成,提供 Vite 和 Webpack 插件支持。
|
|
4
|
-
|
|
5
|
-
## 安装
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
pnpm add -D @lytjs/bundler
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## 快速开始
|
|
12
|
-
|
|
13
|
-
### Vite 配置
|
|
14
|
-
|
|
15
|
-
```typescript
|
|
16
|
-
import { defineConfig } from 'vite';
|
|
17
|
-
import { createVitePlugin } from '@lytjs/bundler';
|
|
18
|
-
|
|
19
|
-
export default defineConfig({
|
|
20
|
-
plugins: [
|
|
21
|
-
createVitePlugin({
|
|
22
|
-
ssr: false,
|
|
23
|
-
ssg: false,
|
|
24
|
-
}),
|
|
25
|
-
],
|
|
26
|
-
});
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
### 预设配置
|
|
30
|
-
|
|
31
|
-
```typescript
|
|
32
|
-
import { createViteConfig } from '@lytjs/bundler';
|
|
33
|
-
|
|
34
|
-
export default createViteConfig({
|
|
35
|
-
ssg: true,
|
|
36
|
-
});
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## 特性
|
|
40
|
-
|
|
41
|
-
- Vite 插件集成
|
|
42
|
-
- Webpack 插件集成
|
|
43
|
-
- SSG 支持
|
|
44
|
-
- SSR 配置优化
|
|
45
|
-
|
|
46
|
-
## API
|
|
47
|
-
|
|
48
|
-
### createVitePlugin(options)
|
|
49
|
-
|
|
50
|
-
创建 Vite 插件。
|
|
51
|
-
|
|
52
|
-
```typescript
|
|
53
|
-
import { createVitePlugin } from '@lytjs/bundler';
|
|
54
|
-
|
|
55
|
-
const plugin = createVitePlugin({
|
|
56
|
-
ssr: false,
|
|
57
|
-
ssg: false,
|
|
58
|
-
});
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
### createWebpackPlugin(options)
|
|
62
|
-
|
|
63
|
-
创建 Webpack 插件。
|
|
64
|
-
|
|
65
|
-
### getPreset(name)
|
|
66
|
-
|
|
67
|
-
获取预设配置。
|
|
68
|
-
|
|
69
|
-
```typescript
|
|
70
|
-
import { getPreset } from '@lytjs/bundler';
|
|
71
|
-
|
|
72
|
-
const preset = getPreset('ssg');
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### createViteConfig(options)
|
|
76
|
-
|
|
77
|
-
创建完整的 Vite 配置。
|
|
78
|
-
|
|
79
|
-
## 许可证
|
|
80
|
-
|
|
81
|
-
MIT
|
|
1
|
+
# @lytjs/bundler
|
|
2
|
+
|
|
3
|
+
LytJS 构建工具集成,提供 Vite 和 Webpack 插件支持。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add -D @lytjs/bundler
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 快速开始
|
|
12
|
+
|
|
13
|
+
### Vite 配置
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { defineConfig } from 'vite';
|
|
17
|
+
import { createVitePlugin } from '@lytjs/bundler';
|
|
18
|
+
|
|
19
|
+
export default defineConfig({
|
|
20
|
+
plugins: [
|
|
21
|
+
createVitePlugin({
|
|
22
|
+
ssr: false,
|
|
23
|
+
ssg: false,
|
|
24
|
+
}),
|
|
25
|
+
],
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 预设配置
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { createViteConfig } from '@lytjs/bundler';
|
|
33
|
+
|
|
34
|
+
export default createViteConfig({
|
|
35
|
+
ssg: true,
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## 特性
|
|
40
|
+
|
|
41
|
+
- Vite 插件集成
|
|
42
|
+
- Webpack 插件集成
|
|
43
|
+
- SSG 支持
|
|
44
|
+
- SSR 配置优化
|
|
45
|
+
|
|
46
|
+
## API
|
|
47
|
+
|
|
48
|
+
### createVitePlugin(options)
|
|
49
|
+
|
|
50
|
+
创建 Vite 插件。
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
import { createVitePlugin } from '@lytjs/bundler';
|
|
54
|
+
|
|
55
|
+
const plugin = createVitePlugin({
|
|
56
|
+
ssr: false,
|
|
57
|
+
ssg: false,
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### createWebpackPlugin(options)
|
|
62
|
+
|
|
63
|
+
创建 Webpack 插件。
|
|
64
|
+
|
|
65
|
+
### getPreset(name)
|
|
66
|
+
|
|
67
|
+
获取预设配置。
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import { getPreset } from '@lytjs/bundler';
|
|
71
|
+
|
|
72
|
+
const preset = getPreset('ssg');
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### createViteConfig(options)
|
|
76
|
+
|
|
77
|
+
创建完整的 Vite 配置。
|
|
78
|
+
|
|
79
|
+
## 许可证
|
|
80
|
+
|
|
81
|
+
MIT
|
package/dist/index.cjs
CHANGED
|
@@ -26,11 +26,10 @@ __export(index_exports, {
|
|
|
26
26
|
getPreset: () => getPreset
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(index_exports);
|
|
29
|
-
function createVitePlugin(
|
|
30
|
-
const { ssg = false, ssgPages = [], ssr = false } = options;
|
|
29
|
+
function createVitePlugin(_options = {}) {
|
|
31
30
|
return {
|
|
32
31
|
name: "lytjs",
|
|
33
|
-
configResolved(
|
|
32
|
+
configResolved(_config) {
|
|
34
33
|
console.log("[lytjs] Vite plugin resolved");
|
|
35
34
|
},
|
|
36
35
|
transform(code, id) {
|
|
@@ -39,17 +38,17 @@ function createVitePlugin(options = {}) {
|
|
|
39
38
|
}
|
|
40
39
|
return null;
|
|
41
40
|
},
|
|
42
|
-
configureServer(
|
|
41
|
+
configureServer(_server) {
|
|
43
42
|
console.log("[lytjs] Dev server configured");
|
|
44
43
|
}
|
|
45
44
|
};
|
|
46
45
|
}
|
|
47
|
-
function createWebpackPlugin(
|
|
48
|
-
const { ssg = false, ssgPages = [], ssr = false } = options;
|
|
46
|
+
function createWebpackPlugin(_options = {}) {
|
|
49
47
|
return {
|
|
50
48
|
name: "lytjs",
|
|
51
49
|
apply(compiler) {
|
|
52
|
-
compiler.hooks
|
|
50
|
+
const hooks = compiler.hooks;
|
|
51
|
+
hooks.beforeCompile.tap("LytPlugin", () => {
|
|
53
52
|
console.log("[lytjs] Webpack plugin applied");
|
|
54
53
|
});
|
|
55
54
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -11,17 +11,17 @@ interface LytPluginOptions {
|
|
|
11
11
|
}
|
|
12
12
|
interface LytPluginConfig {
|
|
13
13
|
/** Vite 插件配置 */
|
|
14
|
-
vite?:
|
|
14
|
+
vite?: Record<string, unknown>;
|
|
15
15
|
/** Webpack 插件配置 */
|
|
16
|
-
webpack?:
|
|
16
|
+
webpack?: Record<string, unknown>;
|
|
17
17
|
}
|
|
18
18
|
interface BundlerPreset {
|
|
19
19
|
/** 预设名称 */
|
|
20
20
|
name: string;
|
|
21
21
|
/** Vite 配置 */
|
|
22
|
-
vite?:
|
|
22
|
+
vite?: Record<string, unknown>;
|
|
23
23
|
/** Webpack 配置 */
|
|
24
|
-
webpack?:
|
|
24
|
+
webpack?: Record<string, unknown>;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -36,14 +36,14 @@ interface BundlerPreset {
|
|
|
36
36
|
* @param options - 插件选项
|
|
37
37
|
* @returns Vite 插件
|
|
38
38
|
*/
|
|
39
|
-
declare function createVitePlugin(
|
|
39
|
+
declare function createVitePlugin(_options?: LytPluginOptions): Record<string, unknown>;
|
|
40
40
|
/**
|
|
41
41
|
* 创建 Webpack 插件
|
|
42
42
|
*
|
|
43
43
|
* @param options - 插件选项
|
|
44
44
|
* @returns Webpack 插件
|
|
45
45
|
*/
|
|
46
|
-
declare function createWebpackPlugin(
|
|
46
|
+
declare function createWebpackPlugin(_options?: LytPluginOptions): Record<string, unknown>;
|
|
47
47
|
/**
|
|
48
48
|
* 获取默认预设配置
|
|
49
49
|
*
|
|
@@ -57,6 +57,6 @@ declare function getPreset(name?: string): BundlerPreset;
|
|
|
57
57
|
* @param options - 插件选项
|
|
58
58
|
* @returns Vite 配置
|
|
59
59
|
*/
|
|
60
|
-
declare function createViteConfig(options?: LytPluginOptions):
|
|
60
|
+
declare function createViteConfig(options?: LytPluginOptions): Record<string, unknown>;
|
|
61
61
|
|
|
62
62
|
export { type BundlerPreset, type LytPluginConfig, type LytPluginOptions, createViteConfig, createVitePlugin, createWebpackPlugin, getPreset };
|
package/dist/index.d.ts
CHANGED
|
@@ -11,17 +11,17 @@ interface LytPluginOptions {
|
|
|
11
11
|
}
|
|
12
12
|
interface LytPluginConfig {
|
|
13
13
|
/** Vite 插件配置 */
|
|
14
|
-
vite?:
|
|
14
|
+
vite?: Record<string, unknown>;
|
|
15
15
|
/** Webpack 插件配置 */
|
|
16
|
-
webpack?:
|
|
16
|
+
webpack?: Record<string, unknown>;
|
|
17
17
|
}
|
|
18
18
|
interface BundlerPreset {
|
|
19
19
|
/** 预设名称 */
|
|
20
20
|
name: string;
|
|
21
21
|
/** Vite 配置 */
|
|
22
|
-
vite?:
|
|
22
|
+
vite?: Record<string, unknown>;
|
|
23
23
|
/** Webpack 配置 */
|
|
24
|
-
webpack?:
|
|
24
|
+
webpack?: Record<string, unknown>;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -36,14 +36,14 @@ interface BundlerPreset {
|
|
|
36
36
|
* @param options - 插件选项
|
|
37
37
|
* @returns Vite 插件
|
|
38
38
|
*/
|
|
39
|
-
declare function createVitePlugin(
|
|
39
|
+
declare function createVitePlugin(_options?: LytPluginOptions): Record<string, unknown>;
|
|
40
40
|
/**
|
|
41
41
|
* 创建 Webpack 插件
|
|
42
42
|
*
|
|
43
43
|
* @param options - 插件选项
|
|
44
44
|
* @returns Webpack 插件
|
|
45
45
|
*/
|
|
46
|
-
declare function createWebpackPlugin(
|
|
46
|
+
declare function createWebpackPlugin(_options?: LytPluginOptions): Record<string, unknown>;
|
|
47
47
|
/**
|
|
48
48
|
* 获取默认预设配置
|
|
49
49
|
*
|
|
@@ -57,6 +57,6 @@ declare function getPreset(name?: string): BundlerPreset;
|
|
|
57
57
|
* @param options - 插件选项
|
|
58
58
|
* @returns Vite 配置
|
|
59
59
|
*/
|
|
60
|
-
declare function createViteConfig(options?: LytPluginOptions):
|
|
60
|
+
declare function createViteConfig(options?: LytPluginOptions): Record<string, unknown>;
|
|
61
61
|
|
|
62
62
|
export { type BundlerPreset, type LytPluginConfig, type LytPluginOptions, createViteConfig, createVitePlugin, createWebpackPlugin, getPreset };
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
function createVitePlugin(
|
|
3
|
-
const { ssg = false, ssgPages = [], ssr = false } = options;
|
|
2
|
+
function createVitePlugin(_options = {}) {
|
|
4
3
|
return {
|
|
5
4
|
name: "lytjs",
|
|
6
|
-
configResolved(
|
|
5
|
+
configResolved(_config) {
|
|
7
6
|
console.log("[lytjs] Vite plugin resolved");
|
|
8
7
|
},
|
|
9
8
|
transform(code, id) {
|
|
@@ -12,17 +11,17 @@ function createVitePlugin(options = {}) {
|
|
|
12
11
|
}
|
|
13
12
|
return null;
|
|
14
13
|
},
|
|
15
|
-
configureServer(
|
|
14
|
+
configureServer(_server) {
|
|
16
15
|
console.log("[lytjs] Dev server configured");
|
|
17
16
|
}
|
|
18
17
|
};
|
|
19
18
|
}
|
|
20
|
-
function createWebpackPlugin(
|
|
21
|
-
const { ssg = false, ssgPages = [], ssr = false } = options;
|
|
19
|
+
function createWebpackPlugin(_options = {}) {
|
|
22
20
|
return {
|
|
23
21
|
name: "lytjs",
|
|
24
22
|
apply(compiler) {
|
|
25
|
-
compiler.hooks
|
|
23
|
+
const hooks = compiler.hooks;
|
|
24
|
+
hooks.beforeCompile.tap("LytPlugin", () => {
|
|
26
25
|
console.log("[lytjs] Webpack plugin applied");
|
|
27
26
|
});
|
|
28
27
|
}
|