@path-ioc/pack 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  <div align="center">
2
2
  <h1>@path-ioc/pack</h1>
3
3
  <p><b>Mesh Registry Distribution Bundler for Path-IoC</b></p>
4
- <p>专为微前端、组件库分发与 Mesh 网格化依赖设计的物理打包与发布构建插件</p>
4
+ <p>Physical bundling and publishing plugin designed for microfrontends, component distribution, and Mesh registry architectures</p>
5
5
 
6
6
  <p>
7
7
  <a href="https://www.npmjs.com/package/@path-ioc/pack"><img src="https://img.shields.io/npm/v/@path-ioc/pack.svg" alt="NPM version"></a>
@@ -9,42 +9,46 @@
9
9
  <a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-5.0+-3178C6?logo=typescript&logoColor=white" alt="TypeScript"></a>
10
10
  <a href="https://vite.dev"><img src="https://img.shields.io/badge/powered%20by-Vite-646CFF?logo=vite&logoColor=white" alt="Vite"></a>
11
11
  </p>
12
+
13
+ <p>
14
+ <b>English</b> | <a href="./README.zh-CN.md">简体中文</a> | <a href="https://path-ioc.dev/api/pack">Official Docs</a>
15
+ </p>
12
16
  </div>
13
17
 
14
18
  ---
15
19
 
16
- ## 核心特性 (Features)
20
+ ## Features
17
21
 
18
- - **物理入口自动生成 (Physical Entrypoint Generation)**:
19
- 在 Vite 构建流程中,自动深度扫描 `src/modules` 下所有包含 `index.ts/tsx` 的物理子目录,并在磁盘上自动生成/更新干净的入口文件(默认 `.modular-plugin-entry.ts`)。
20
- - **Mesh 注册表与类型全导出**:
21
- 自动生成统一的模块导入别名与导出,并导出标准运行期注册表数组 `modules`:
22
+ - **Physical Entrypoint Generation**:
23
+ During Vite builds, automatically scans `src/modules` for physical directories containing `index.ts/tsx` and synthesizes clean on-disk entrypoints (default `.modular-plugin-entry.ts`).
24
+ - **Full Mesh Registry & Type Exports**:
25
+ Generates unified module import aliases and exports the canonical runtime module registry array `modules`:
22
26
  ```typescript
23
27
  export const modules = [
24
28
  { key: "/math/add", module: _Modular_Mod_0 },
25
29
  { key: "/math/isEven", module: _Modular_Mod_1 },
26
30
  ];
27
31
  ```
28
- - **静态类型映射提取 (`sharedMappings`)**:
29
- 自动填充 `sharedMappings` 与 `sharedContainerMappings` 集合,为构建跨包 SDK 或微前端网格映射提供准确的类型描述。
30
- - **物理隔离与代码混淆兼容**:
31
- 物理生成的入口文件可直接用于 npm 打包流程,完美兼容各类 AST 物理打散与防篡改混淆工具。
32
+ - **Static Type Mapping Extraction (`sharedMappings`)**:
33
+ Fills `sharedMappings` and `sharedContainerMappings` to provide accurate type descriptions for cross-package SDKs or microfrontend mesh topologies.
34
+ - **Physical Isolation & Bundler Obfuscation Compatibility**:
35
+ Generated physical entrypoint files integrate seamlessly into standard npm packaging pipelines, fully compatible with downstream AST transformers and code protection tools.
32
36
 
33
37
  ---
34
38
 
35
- ## 安装 (Installation)
39
+ ## Installation
36
40
 
37
41
  ```bash
38
42
  pnpm add -D @path-ioc/pack
39
- # 或
43
+ # or
40
44
  npm install -D @path-ioc/pack
41
45
  ```
42
46
 
43
47
  ---
44
48
 
45
- ## 快速上手 (Quick Start)
49
+ ## Quick Start
46
50
 
47
- ### Vite 配置 (`vite.config.ts`)
51
+ ### Vite Configuration (`vite.config.ts`)
48
52
 
49
53
  ```typescript
50
54
  import { defineConfig } from "vite";
@@ -57,7 +61,7 @@ export default defineConfig({
57
61
  plugins: [
58
62
  modularPackPlugin({
59
63
  modulesPath: "src/modules",
60
- // 可选:自定义生成的入口文件路径(默认存放在 node_modules/.path-ioc/.modular-plugin-entry.ts)
64
+ // Optional: Custom on-disk entrypoint path (default: node_modules/.path-ioc/.modular-plugin-entry.ts)
61
65
  entryFile: "node_modules/.path-ioc/.modular-plugin-entry.ts",
62
66
  sharedMappings,
63
67
  sharedContainerMappings,
@@ -68,18 +72,18 @@ export default defineConfig({
68
72
 
69
73
  ---
70
74
 
71
- ## 配置选项 (PackPluginOptions)
75
+ ## Configuration Options (`PackPluginOptions`)
72
76
 
73
- | 配置项 | 类型 | 默认值 | 描述 |
77
+ | Option | Type | Default | Description |
74
78
  | :--- | :--- | :--- | :--- |
75
- | **`modulesPath`** | `string` | `'src/modules'` | 模块扫描的物理根目录路径。 |
76
- | **`entryFile`** | `string` | `'node_modules/.path-ioc/.modular-plugin-entry.ts'` | 物理生成的入口文件路径。 |
77
- | **`sharedMappings`** | `string[]` | `[]` *(可选)* | 接收生成的类型映射字符串数组引用。 |
78
- | **`sharedContainerMappings`** | `string[]` | `[]` *(可选)* | 接收生成的容器类型映射字符串数组引用。 |
79
+ | **`modulesPath`** | `string` | `'src/modules'` | Root directory scanned for modular IoC entrypoints. |
80
+ | **`entryFile`** | `string` | `'node_modules/.path-ioc/.modular-plugin-entry.ts'` | Target physical path for the generated entrypoint file. |
81
+ | **`sharedMappings`** | `string[]` | `[]` *(optional)* | Reference to an array that receives generated type mapping strings. |
82
+ | **`sharedContainerMappings`** | `string[]` | `[]` *(optional)* | Reference to an array that receives generated container type mapping strings. |
79
83
 
80
84
  ---
81
85
 
82
- ## 导出的 API
86
+ ## Exported API
83
87
 
84
88
  ```typescript
85
89
  import { modularPackPlugin, type PackPluginOptions } from "@path-ioc/pack";
@@ -87,7 +91,7 @@ import { modularPackPlugin, type PackPluginOptions } from "@path-ioc/pack";
87
91
 
88
92
  ---
89
93
 
90
- ## 开源协议 (License)
94
+ ## License
91
95
 
92
96
  Released under the [MIT License](./LICENSE).
93
- Copyright © 2026 [Path-IoC Organization](https://github.com/path-ioc) & Lian HanLin.
97
+ Copyright © 2026-present [Path-IoC Organization](https://github.com/path-ioc) & Lian HanLin.
@@ -0,0 +1,97 @@
1
+ <div align="center">
2
+ <h1>@path-ioc/pack</h1>
3
+ <p><b>Mesh Registry Distribution Bundler for Path-IoC</b></p>
4
+ <p>专为微前端、组件库分发与 Mesh 网格化依赖设计的物理打包与发布构建插件</p>
5
+
6
+ <p>
7
+ <a href="https://www.npmjs.com/package/@path-ioc/pack"><img src="https://img.shields.io/npm/v/@path-ioc/pack.svg" alt="NPM version"></a>
8
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/npm/l/@path-ioc/pack.svg" alt="License"></a>
9
+ <a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-5.0+-3178C6?logo=typescript&logoColor=white" alt="TypeScript"></a>
10
+ <a href="https://vite.dev"><img src="https://img.shields.io/badge/powered%20by-Vite-646CFF?logo=vite&logoColor=white" alt="Vite"></a>
11
+ </p>
12
+
13
+ <p>
14
+ <a href="./README.md">English</a> | <b>简体中文</b> | <a href="https://path-ioc.dev/zh/api/pack">官方文档</a>
15
+ </p>
16
+ </div>
17
+
18
+ ---
19
+
20
+ ## 核心特性 (Features)
21
+
22
+ - **物理入口自动生成 (Physical Entrypoint Generation)**:
23
+ 在 Vite 构建流程中,自动深度扫描 `src/modules` 下所有包含 `index.ts/tsx` 的物理子目录,并在磁盘上自动生成/更新干净的入口文件(默认 `.modular-plugin-entry.ts`)。
24
+ - **Mesh 注册表与类型全导出**:
25
+ 自动生成统一的模块导入别名与导出,并导出标准运行期注册表数组 `modules`:
26
+ ```typescript
27
+ export const modules = [
28
+ { key: "/math/add", module: _Modular_Mod_0 },
29
+ { key: "/math/isEven", module: _Modular_Mod_1 },
30
+ ];
31
+ ```
32
+ - **静态类型映射提取 (`sharedMappings`)**:
33
+ 自动填充 `sharedMappings` 与 `sharedContainerMappings` 集合,为构建跨包 SDK 或微前端网格映射提供准确的类型描述。
34
+ - **物理隔离与代码混淆兼容**:
35
+ 物理生成的入口文件可直接用于 npm 打包流程,完美兼容各类 AST 物理打散与防篡改混淆工具。
36
+
37
+ ---
38
+
39
+ ## 安装 (Installation)
40
+
41
+ ```bash
42
+ pnpm add -D @path-ioc/pack
43
+ # 或
44
+ npm install -D @path-ioc/pack
45
+ ```
46
+
47
+ ---
48
+
49
+ ## 快速上手 (Quick Start)
50
+
51
+ ### Vite 配置 (`vite.config.ts`)
52
+
53
+ ```typescript
54
+ import { defineConfig } from "vite";
55
+ import { modularPackPlugin } from "@path-ioc/pack";
56
+
57
+ const sharedMappings: string[] = [];
58
+ const sharedContainerMappings: string[] = [];
59
+
60
+ export default defineConfig({
61
+ plugins: [
62
+ modularPackPlugin({
63
+ modulesPath: "src/modules",
64
+ // 可选:自定义生成的入口文件路径(默认存放在 node_modules/.path-ioc/.modular-plugin-entry.ts)
65
+ entryFile: "node_modules/.path-ioc/.modular-plugin-entry.ts",
66
+ sharedMappings,
67
+ sharedContainerMappings,
68
+ }),
69
+ ],
70
+ });
71
+ ```
72
+
73
+ ---
74
+
75
+ ## 配置选项 (PackPluginOptions)
76
+
77
+ | 配置项 | 类型 | 默认值 | 描述 |
78
+ | :--- | :--- | :--- | :--- |
79
+ | **`modulesPath`** | `string` | `'src/modules'` | 模块扫描的物理根目录路径。 |
80
+ | **`entryFile`** | `string` | `'node_modules/.path-ioc/.modular-plugin-entry.ts'` | 物理生成的入口文件路径。 |
81
+ | **`sharedMappings`** | `string[]` | `[]` *(可选)* | 接收生成的类型映射字符串数组引用。 |
82
+ | **`sharedContainerMappings`** | `string[]` | `[]` *(可选)* | 接收生成的容器类型映射字符串数组引用。 |
83
+
84
+ ---
85
+
86
+ ## 导出的 API
87
+
88
+ ```typescript
89
+ import { modularPackPlugin, type PackPluginOptions } from "@path-ioc/pack";
90
+ ```
91
+
92
+ ---
93
+
94
+ ## 开源协议 (License)
95
+
96
+ Released under the [MIT License](./LICENSE).
97
+ Copyright © 2026 [Path-IoC Organization](https://github.com/path-ioc) & Lian HanLin.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@path-ioc/pack",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Mesh registry distribution bundler & obfuscator for Path-IoC",
5
5
  "keywords": [
6
6
  "ioc",
@@ -54,7 +54,7 @@
54
54
  "vite": "^8.2.2",
55
55
  "tsup": "^8.0.0",
56
56
  "typescript": "^5.4.5",
57
- "@path-ioc/unplugin": "0.1.1"
57
+ "@path-ioc/unplugin": "0.1.2"
58
58
  },
59
59
  "scripts": {
60
60
  "build": "tsup src/index.ts --format cjs,esm --dts",