@zealakit/css-doctor-next 0.0.0-stage → 1.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Zealamic
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,66 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ # @zealakit/css-doctor-next
4
+
5
+ **Next.js App Router and Pages Router integration for css-doctor.**
6
+
7
+ [English](https://github.com/zealakit/css-doctor/blob/main/packages/css-doctor-next/README.md) | [Tiếng Việt](https://github.com/zealakit/css-doctor/blob/main/packages/css-doctor-next/README_VI.md) | [简体中文](https://github.com/zealakit/css-doctor/blob/main/packages/css-doctor-next/README_CN.md)
8
+
9
+ </div>
10
+
11
+ ---
12
+
13
+ ![css doctor](https://github.com/zealakit/css-doctor/blob/main/assets/images/css-doctor.jpg)
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ pnpm add -D @zealakit/css-doctor-next
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ```ts
24
+ import { withCssDoctor } from "@zealakit/css-doctor-next";
25
+
26
+ export default withCssDoctor(
27
+ { reactStrictMode: true },
28
+ {
29
+ pageCoverage: {
30
+ enabled: true,
31
+ minPageRatio: 0.5,
32
+ forceCommon: [".app-shell", ".nav-link"],
33
+ },
34
+ sizeBudget: {
35
+ enabled: true,
36
+ maxChunkSize: 40 * 1024,
37
+ isolateVariables: true,
38
+ },
39
+ report: true,
40
+ },
41
+ );
42
+ ```
43
+
44
+ ## Options
45
+
46
+ | Option | Default | Description |
47
+ | --- | --- | --- |
48
+ | `pageCoverage.enabled` | `true` | Enable page/class coverage classification. |
49
+ | `pageCoverage.minPageRatio` | `0.5` | Minimum ratio (0.0-1.0) for the common chunk. |
50
+ | `pageCoverage.forceCommon` | `[]` | Selectors or classes forced into common CSS. |
51
+ | `sizeBudget.enabled` | `true` | Enable byte-budget splitting. |
52
+ | `sizeBudget.maxChunkSize` | `60 * 1024` | Maximum bytes per emitted chunk. |
53
+ | `sizeBudget.isolateVariables` | `true` | Extract `:root` and `@theme` variables first. |
54
+ | `minify` | production | Minify emitted CSS with LightningCSS. |
55
+ | `report` | `true` | Print coverage and chunk diagnostics. |
56
+ | `exclude` | CSS Modules safety | Skip matching CSS assets. |
57
+
58
+ ## Safety and limitations
59
+
60
+ - Preserves the existing webpack callback and applies only to the production client build.
61
+ - CSS Modules are skipped automatically; common chunks remain linked through @import wrappers.
62
+ - Peer range next >=13 is intentionally broad.
63
+
64
+ ## Full documentation
65
+
66
+ Project README: [English](https://github.com/zealakit/css-doctor/blob/main/README.md) | [Tiếng Việt](https://github.com/zealakit/css-doctor/blob/main/README_VI.md) | [简体中文](https://github.com/zealakit/css-doctor/blob/main/README_CN.md)
package/README_CN.md ADDED
@@ -0,0 +1,66 @@
1
+ <div align="center">
2
+
3
+ # @zealakit/css-doctor-next
4
+
5
+ **面向 Next.js App Router 与 Pages Router 的 css-doctor 集成。**
6
+
7
+ [English](https://github.com/zealakit/css-doctor/blob/main/packages/css-doctor-next/README.md) | [Tiếng Việt](https://github.com/zealakit/css-doctor/blob/main/packages/css-doctor-next/README_VI.md) | [简体中文](https://github.com/zealakit/css-doctor/blob/main/packages/css-doctor-next/README_CN.md)
8
+
9
+ </div>
10
+
11
+ ---
12
+
13
+ ![css doctor](https://github.com/zealakit/css-doctor/blob/main/assets/images/css-doctor.jpg)
14
+
15
+ ## 安装
16
+
17
+ ```bash
18
+ pnpm add -D @zealakit/css-doctor-next
19
+ ```
20
+
21
+ ## 使用
22
+
23
+ ```ts
24
+ import { withCssDoctor } from "@zealakit/css-doctor-next";
25
+
26
+ export default withCssDoctor(
27
+ { reactStrictMode: true },
28
+ {
29
+ pageCoverage: {
30
+ enabled: true,
31
+ minPageRatio: 0.5,
32
+ forceCommon: [".app-shell", ".nav-link"],
33
+ },
34
+ sizeBudget: {
35
+ enabled: true,
36
+ maxChunkSize: 40 * 1024,
37
+ isolateVariables: true,
38
+ },
39
+ report: true,
40
+ },
41
+ );
42
+ ```
43
+
44
+ ## 配置
45
+
46
+ | 参数 | 默认值 | 说明 |
47
+ | --- | --- | --- |
48
+ | `pageCoverage.enabled` | `true` | 启用页面/class 覆盖率分类。 |
49
+ | `pageCoverage.minPageRatio` | `0.5` | 进入 common chunk 的最小比例(0.0-1.0)。 |
50
+ | `pageCoverage.forceCommon` | `[]` | 强制保留在 common CSS 中的 selector/class。 |
51
+ | `sizeBudget.enabled` | `true` | 启用按字节预算分割。 |
52
+ | `sizeBudget.maxChunkSize` | `60 * 1024` | 每个 chunk 的最大字节数。 |
53
+ | `sizeBudget.isolateVariables` | `true` | 先提取 `:root` 与 `@theme` 变量。 |
54
+ | `minify` | production | 使用 LightningCSS 压缩输出 CSS。 |
55
+ | `report` | `true` | 输出覆盖率和 chunk 诊断。 |
56
+ | `exclude` | CSS Modules safety | 跳过匹配的 CSS 资源。 |
57
+
58
+ ## 安全与限制
59
+
60
+ - 保留现有 webpack callback,仅作用于生产客户端构建。
61
+ - 自动跳过 CSS Modules;公共 chunk 通过 @import wrapper 保持链接。
62
+ - peer 范围 next >=13 有意保持宽泛。
63
+
64
+ ## 完整文档
65
+
66
+ 项目 README:[English](https://github.com/zealakit/css-doctor/blob/main/README.md) | [Tiếng Việt](https://github.com/zealakit/css-doctor/blob/main/README_VI.md) | [简体中文](https://github.com/zealakit/css-doctor/blob/main/README_CN.md)
package/README_VI.md ADDED
@@ -0,0 +1,66 @@
1
+ <div align="center">
2
+
3
+ # @zealakit/css-doctor-next
4
+
5
+ **Tích hợp Next.js App Router và Pages Router cho css-doctor.**
6
+
7
+ [English](https://github.com/zealakit/css-doctor/blob/main/packages/css-doctor-next/README.md) | [Tiếng Việt](https://github.com/zealakit/css-doctor/blob/main/packages/css-doctor-next/README_VI.md) | [简体中文](https://github.com/zealakit/css-doctor/blob/main/packages/css-doctor-next/README_CN.md)
8
+
9
+ </div>
10
+
11
+ ---
12
+
13
+ ![css doctor](https://github.com/zealakit/css-doctor/blob/main/assets/images/css-doctor.jpg)
14
+
15
+ ## Cài đặt
16
+
17
+ ```bash
18
+ pnpm add -D @zealakit/css-doctor-next
19
+ ```
20
+
21
+ ## Sử dụng
22
+
23
+ ```ts
24
+ import { withCssDoctor } from "@zealakit/css-doctor-next";
25
+
26
+ export default withCssDoctor(
27
+ { reactStrictMode: true },
28
+ {
29
+ pageCoverage: {
30
+ enabled: true,
31
+ minPageRatio: 0.5,
32
+ forceCommon: [".app-shell", ".nav-link"],
33
+ },
34
+ sizeBudget: {
35
+ enabled: true,
36
+ maxChunkSize: 40 * 1024,
37
+ isolateVariables: true,
38
+ },
39
+ report: true,
40
+ },
41
+ );
42
+ ```
43
+
44
+ ## Tùy chọn
45
+
46
+ | Tùy chọn | Mặc định | Mô tả |
47
+ | --- | --- | --- |
48
+ | `pageCoverage.enabled` | `true` | Bật phân loại page/class coverage. |
49
+ | `pageCoverage.minPageRatio` | `0.5` | Tỷ lệ tối thiểu (0.0-1.0) để vào common chunk. |
50
+ | `pageCoverage.forceCommon` | `[]` | Selector/class luôn giữ trong common CSS. |
51
+ | `sizeBudget.enabled` | `true` | Bật chia nhỏ theo byte budget. |
52
+ | `sizeBudget.maxChunkSize` | `60 * 1024` | Số byte tối đa mỗi chunk. |
53
+ | `sizeBudget.isolateVariables` | `true` | Tách biến `:root` và `@theme` trước. |
54
+ | `minify` | production | Minify CSS bằng LightningCSS. |
55
+ | `report` | `true` | In chẩn đoán coverage và chunk. |
56
+ | `exclude` | CSS Modules safety | Bỏ qua asset CSS khớp mẫu. |
57
+
58
+ ## An toàn và giới hạn
59
+
60
+ - Giữ nguyên webpack callback cũ và chỉ áp dụng cho production client build.
61
+ - CSS Modules được tự động bỏ qua; common chunk vẫn được link qua @import wrapper.
62
+ - Peer range next >=13 được giữ rộng có chủ đích.
63
+
64
+ ## Tài liệu đầy đủ
65
+
66
+ README dự án: [English](https://github.com/zealakit/css-doctor/blob/main/README.md) | [Tiếng Việt](https://github.com/zealakit/css-doctor/blob/main/README_VI.md) | [简体中文](https://github.com/zealakit/css-doctor/blob/main/README_CN.md)