@path-ioc/pack 0.1.1
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 +93 -0
- package/dist/index.cjs +147 -0
- package/dist/index.d.cts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +112 -0
- package/package.json +63 -0
package/README.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
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
|
+
</div>
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 核心特性 (Features)
|
|
17
|
+
|
|
18
|
+
- **物理入口自动生成 (Physical Entrypoint Generation)**:
|
|
19
|
+
在 Vite 构建流程中,自动深度扫描 `src/modules` 下所有包含 `index.ts/tsx` 的物理子目录,并在磁盘上自动生成/更新干净的入口文件(默认 `.modular-plugin-entry.ts`)。
|
|
20
|
+
- **Mesh 注册表与类型全导出**:
|
|
21
|
+
自动生成统一的模块导入别名与导出,并导出标准运行期注册表数组 `modules`:
|
|
22
|
+
```typescript
|
|
23
|
+
export const modules = [
|
|
24
|
+
{ key: "/math/add", module: _Modular_Mod_0 },
|
|
25
|
+
{ key: "/math/isEven", module: _Modular_Mod_1 },
|
|
26
|
+
];
|
|
27
|
+
```
|
|
28
|
+
- **静态类型映射提取 (`sharedMappings`)**:
|
|
29
|
+
自动填充 `sharedMappings` 与 `sharedContainerMappings` 集合,为构建跨包 SDK 或微前端网格映射提供准确的类型描述。
|
|
30
|
+
- **物理隔离与代码混淆兼容**:
|
|
31
|
+
物理生成的入口文件可直接用于 npm 打包流程,完美兼容各类 AST 物理打散与防篡改混淆工具。
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 安装 (Installation)
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pnpm add -D @path-ioc/pack
|
|
39
|
+
# 或
|
|
40
|
+
npm install -D @path-ioc/pack
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 快速上手 (Quick Start)
|
|
46
|
+
|
|
47
|
+
### Vite 配置 (`vite.config.ts`)
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
import { defineConfig } from "vite";
|
|
51
|
+
import { modularPackPlugin } from "@path-ioc/pack";
|
|
52
|
+
|
|
53
|
+
const sharedMappings: string[] = [];
|
|
54
|
+
const sharedContainerMappings: string[] = [];
|
|
55
|
+
|
|
56
|
+
export default defineConfig({
|
|
57
|
+
plugins: [
|
|
58
|
+
modularPackPlugin({
|
|
59
|
+
modulesPath: "src/modules",
|
|
60
|
+
// 可选:自定义生成的入口文件路径(默认存放在 node_modules/.path-ioc/.modular-plugin-entry.ts)
|
|
61
|
+
entryFile: "node_modules/.path-ioc/.modular-plugin-entry.ts",
|
|
62
|
+
sharedMappings,
|
|
63
|
+
sharedContainerMappings,
|
|
64
|
+
}),
|
|
65
|
+
],
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 配置选项 (PackPluginOptions)
|
|
72
|
+
|
|
73
|
+
| 配置项 | 类型 | 默认值 | 描述 |
|
|
74
|
+
| :--- | :--- | :--- | :--- |
|
|
75
|
+
| **`modulesPath`** | `string` | `'src/modules'` | 模块扫描的物理根目录路径。 |
|
|
76
|
+
| **`entryFile`** | `string` | `'node_modules/.path-ioc/.modular-plugin-entry.ts'` | 物理生成的入口文件路径。 |
|
|
77
|
+
| **`sharedMappings`** | `string[]` | `[]` *(可选)* | 接收生成的类型映射字符串数组引用。 |
|
|
78
|
+
| **`sharedContainerMappings`** | `string[]` | `[]` *(可选)* | 接收生成的容器类型映射字符串数组引用。 |
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 导出的 API
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
import { modularPackPlugin, type PackPluginOptions } from "@path-ioc/pack";
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 开源协议 (License)
|
|
91
|
+
|
|
92
|
+
Released under the [MIT License](./LICENSE).
|
|
93
|
+
Copyright © 2026 [Path-IoC Organization](https://github.com/path-ioc) & Lian HanLin.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var index_exports = {};
|
|
32
|
+
__export(index_exports, {
|
|
33
|
+
modularPackPlugin: () => modularPackPlugin
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(index_exports);
|
|
36
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
37
|
+
var import_promises = __toESM(require("fs/promises"), 1);
|
|
38
|
+
var import_lodash_es = require("lodash-es");
|
|
39
|
+
function modularPackPlugin({
|
|
40
|
+
modulesPath = "src/modules",
|
|
41
|
+
entryFile = "node_modules/.path-ioc/.modular-plugin-entry.ts",
|
|
42
|
+
sharedMappings = [],
|
|
43
|
+
sharedContainerMappings = []
|
|
44
|
+
} = {}) {
|
|
45
|
+
let projectRoot;
|
|
46
|
+
return {
|
|
47
|
+
name: "vite-plugin-modular-pack",
|
|
48
|
+
enforce: "pre",
|
|
49
|
+
async config(config) {
|
|
50
|
+
projectRoot = import_node_path.default.resolve(config.root || process.cwd());
|
|
51
|
+
const modulesRoot = import_node_path.default.resolve(projectRoot, modulesPath);
|
|
52
|
+
const entryFilePath = import_node_path.default.resolve(projectRoot, entryFile);
|
|
53
|
+
const entryFileDir = import_node_path.default.dirname(entryFilePath);
|
|
54
|
+
await import_promises.default.mkdir(entryFileDir, { recursive: true });
|
|
55
|
+
const absoluteFolders = await searchIndexTsFiles(modulesRoot);
|
|
56
|
+
const entryLines = [];
|
|
57
|
+
const runtimeModulesArray = [];
|
|
58
|
+
sharedMappings.length = 0;
|
|
59
|
+
sharedContainerMappings.length = 0;
|
|
60
|
+
const moduleFullNames = [];
|
|
61
|
+
const moduleNames = [];
|
|
62
|
+
const aliases = [];
|
|
63
|
+
const shortNameCountMap = /* @__PURE__ */ new Map();
|
|
64
|
+
absoluteFolders.forEach((absolutePath, index) => {
|
|
65
|
+
const dirPath = import_node_path.default.dirname(absolutePath);
|
|
66
|
+
let importRelPath = import_node_path.default.relative(entryFileDir, dirPath).replace(/\\/g, "/");
|
|
67
|
+
if (!importRelPath.startsWith(".")) {
|
|
68
|
+
importRelPath = "./" + importRelPath;
|
|
69
|
+
}
|
|
70
|
+
const logicalPath = import_node_path.default.relative(modulesRoot, dirPath).replace(/\\/g, "/");
|
|
71
|
+
const folderName = logicalPath.split("/").pop();
|
|
72
|
+
if (!folderName) return;
|
|
73
|
+
const moduleName = folderName.charAt(0) + (0, import_lodash_es.camelCase)(folderName).slice(1);
|
|
74
|
+
const logicalDir = logicalPath.substring(0, logicalPath.lastIndexOf(folderName));
|
|
75
|
+
const moduleFullName = `/${logicalDir}${moduleName}`;
|
|
76
|
+
const alias = `_Modular_Mod_${index}`;
|
|
77
|
+
entryLines.push(`import * as ${alias} from '${importRelPath}/index';`);
|
|
78
|
+
entryLines.push(`export { ${alias} };`);
|
|
79
|
+
moduleFullNames.push(moduleFullName);
|
|
80
|
+
moduleNames.push(moduleName);
|
|
81
|
+
aliases.push(alias);
|
|
82
|
+
if (!shortNameCountMap.has(moduleName)) {
|
|
83
|
+
shortNameCountMap.set(moduleName, [moduleFullName]);
|
|
84
|
+
} else {
|
|
85
|
+
shortNameCountMap.get(moduleName).push(moduleFullName);
|
|
86
|
+
}
|
|
87
|
+
runtimeModulesArray.push(` { key: "${moduleFullName}", module: ${alias} }`);
|
|
88
|
+
});
|
|
89
|
+
const namePushedSet = /* @__PURE__ */ new Set();
|
|
90
|
+
moduleFullNames.forEach((moduleFullName, i) => {
|
|
91
|
+
const alias = aliases[i];
|
|
92
|
+
const moduleName = moduleNames[i];
|
|
93
|
+
if (!namePushedSet.has(moduleFullName)) {
|
|
94
|
+
namePushedSet.add(moduleFullName);
|
|
95
|
+
sharedMappings.push(` "${moduleFullName}": typeof ${alias};`);
|
|
96
|
+
sharedContainerMappings.push(` "${moduleFullName}": Awaited<ReturnType<typeof ${alias}["main"]>>;`);
|
|
97
|
+
}
|
|
98
|
+
const countList = shortNameCountMap.get(moduleName);
|
|
99
|
+
if (countList && countList.length === 1 && !namePushedSet.has(moduleName)) {
|
|
100
|
+
namePushedSet.add(moduleName);
|
|
101
|
+
sharedMappings.push(` "${moduleName}": typeof ${alias};`);
|
|
102
|
+
sharedContainerMappings.push(` "${moduleName}": Awaited<ReturnType<typeof ${alias}["main"]>>;`);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
entryLines.push(`
|
|
106
|
+
// --- Runtime Exports ---`);
|
|
107
|
+
entryLines.push(`export const modules = [`);
|
|
108
|
+
entryLines.push(runtimeModulesArray.join(",\n"));
|
|
109
|
+
entryLines.push(`];
|
|
110
|
+
`);
|
|
111
|
+
await import_promises.default.writeFile(entryFilePath, entryLines.join("\n"), "utf-8");
|
|
112
|
+
console.log(`\x1B[32m[ModularPack] Generated physical entry file: ${entryFile}\x1B[0m`);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
var searchIndexTsFiles = async (rootPath) => {
|
|
117
|
+
try {
|
|
118
|
+
await import_promises.default.access(rootPath);
|
|
119
|
+
} catch {
|
|
120
|
+
return [];
|
|
121
|
+
}
|
|
122
|
+
const dirsToScan = [rootPath];
|
|
123
|
+
const result = [];
|
|
124
|
+
while (dirsToScan.length > 0) {
|
|
125
|
+
const currentDir = dirsToScan.shift();
|
|
126
|
+
if (!currentDir) continue;
|
|
127
|
+
try {
|
|
128
|
+
const entries = await import_promises.default.readdir(currentDir);
|
|
129
|
+
for (const entry of entries) {
|
|
130
|
+
if (entry === "node_modules" || entry.startsWith(".")) continue;
|
|
131
|
+
const fullPath = import_node_path.default.join(currentDir, entry);
|
|
132
|
+
const stats = await import_promises.default.stat(fullPath);
|
|
133
|
+
if (stats.isDirectory()) {
|
|
134
|
+
dirsToScan.push(fullPath);
|
|
135
|
+
} else if (["index.ts", "index.tsx"].includes(entry)) {
|
|
136
|
+
result.push(fullPath);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
} catch (e) {
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return result;
|
|
143
|
+
};
|
|
144
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
145
|
+
0 && (module.exports = {
|
|
146
|
+
modularPackPlugin
|
|
147
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
|
|
3
|
+
interface PackPluginOptions {
|
|
4
|
+
modulesPath?: string;
|
|
5
|
+
entryFile?: string;
|
|
6
|
+
sharedMappings?: string[];
|
|
7
|
+
sharedContainerMappings?: string[];
|
|
8
|
+
}
|
|
9
|
+
type ModularPackPlugin = Pick<Plugin, "name" | "enforce" | "config">;
|
|
10
|
+
declare function modularPackPlugin({ modulesPath, entryFile, sharedMappings, sharedContainerMappings, }?: PackPluginOptions): ModularPackPlugin;
|
|
11
|
+
|
|
12
|
+
export { type ModularPackPlugin, type PackPluginOptions, modularPackPlugin };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
|
|
3
|
+
interface PackPluginOptions {
|
|
4
|
+
modulesPath?: string;
|
|
5
|
+
entryFile?: string;
|
|
6
|
+
sharedMappings?: string[];
|
|
7
|
+
sharedContainerMappings?: string[];
|
|
8
|
+
}
|
|
9
|
+
type ModularPackPlugin = Pick<Plugin, "name" | "enforce" | "config">;
|
|
10
|
+
declare function modularPackPlugin({ modulesPath, entryFile, sharedMappings, sharedContainerMappings, }?: PackPluginOptions): ModularPackPlugin;
|
|
11
|
+
|
|
12
|
+
export { type ModularPackPlugin, type PackPluginOptions, modularPackPlugin };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import path from "path";
|
|
3
|
+
import fs from "fs/promises";
|
|
4
|
+
import { camelCase } from "lodash-es";
|
|
5
|
+
function modularPackPlugin({
|
|
6
|
+
modulesPath = "src/modules",
|
|
7
|
+
entryFile = "node_modules/.path-ioc/.modular-plugin-entry.ts",
|
|
8
|
+
sharedMappings = [],
|
|
9
|
+
sharedContainerMappings = []
|
|
10
|
+
} = {}) {
|
|
11
|
+
let projectRoot;
|
|
12
|
+
return {
|
|
13
|
+
name: "vite-plugin-modular-pack",
|
|
14
|
+
enforce: "pre",
|
|
15
|
+
async config(config) {
|
|
16
|
+
projectRoot = path.resolve(config.root || process.cwd());
|
|
17
|
+
const modulesRoot = path.resolve(projectRoot, modulesPath);
|
|
18
|
+
const entryFilePath = path.resolve(projectRoot, entryFile);
|
|
19
|
+
const entryFileDir = path.dirname(entryFilePath);
|
|
20
|
+
await fs.mkdir(entryFileDir, { recursive: true });
|
|
21
|
+
const absoluteFolders = await searchIndexTsFiles(modulesRoot);
|
|
22
|
+
const entryLines = [];
|
|
23
|
+
const runtimeModulesArray = [];
|
|
24
|
+
sharedMappings.length = 0;
|
|
25
|
+
sharedContainerMappings.length = 0;
|
|
26
|
+
const moduleFullNames = [];
|
|
27
|
+
const moduleNames = [];
|
|
28
|
+
const aliases = [];
|
|
29
|
+
const shortNameCountMap = /* @__PURE__ */ new Map();
|
|
30
|
+
absoluteFolders.forEach((absolutePath, index) => {
|
|
31
|
+
const dirPath = path.dirname(absolutePath);
|
|
32
|
+
let importRelPath = path.relative(entryFileDir, dirPath).replace(/\\/g, "/");
|
|
33
|
+
if (!importRelPath.startsWith(".")) {
|
|
34
|
+
importRelPath = "./" + importRelPath;
|
|
35
|
+
}
|
|
36
|
+
const logicalPath = path.relative(modulesRoot, dirPath).replace(/\\/g, "/");
|
|
37
|
+
const folderName = logicalPath.split("/").pop();
|
|
38
|
+
if (!folderName) return;
|
|
39
|
+
const moduleName = folderName.charAt(0) + camelCase(folderName).slice(1);
|
|
40
|
+
const logicalDir = logicalPath.substring(0, logicalPath.lastIndexOf(folderName));
|
|
41
|
+
const moduleFullName = `/${logicalDir}${moduleName}`;
|
|
42
|
+
const alias = `_Modular_Mod_${index}`;
|
|
43
|
+
entryLines.push(`import * as ${alias} from '${importRelPath}/index';`);
|
|
44
|
+
entryLines.push(`export { ${alias} };`);
|
|
45
|
+
moduleFullNames.push(moduleFullName);
|
|
46
|
+
moduleNames.push(moduleName);
|
|
47
|
+
aliases.push(alias);
|
|
48
|
+
if (!shortNameCountMap.has(moduleName)) {
|
|
49
|
+
shortNameCountMap.set(moduleName, [moduleFullName]);
|
|
50
|
+
} else {
|
|
51
|
+
shortNameCountMap.get(moduleName).push(moduleFullName);
|
|
52
|
+
}
|
|
53
|
+
runtimeModulesArray.push(` { key: "${moduleFullName}", module: ${alias} }`);
|
|
54
|
+
});
|
|
55
|
+
const namePushedSet = /* @__PURE__ */ new Set();
|
|
56
|
+
moduleFullNames.forEach((moduleFullName, i) => {
|
|
57
|
+
const alias = aliases[i];
|
|
58
|
+
const moduleName = moduleNames[i];
|
|
59
|
+
if (!namePushedSet.has(moduleFullName)) {
|
|
60
|
+
namePushedSet.add(moduleFullName);
|
|
61
|
+
sharedMappings.push(` "${moduleFullName}": typeof ${alias};`);
|
|
62
|
+
sharedContainerMappings.push(` "${moduleFullName}": Awaited<ReturnType<typeof ${alias}["main"]>>;`);
|
|
63
|
+
}
|
|
64
|
+
const countList = shortNameCountMap.get(moduleName);
|
|
65
|
+
if (countList && countList.length === 1 && !namePushedSet.has(moduleName)) {
|
|
66
|
+
namePushedSet.add(moduleName);
|
|
67
|
+
sharedMappings.push(` "${moduleName}": typeof ${alias};`);
|
|
68
|
+
sharedContainerMappings.push(` "${moduleName}": Awaited<ReturnType<typeof ${alias}["main"]>>;`);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
entryLines.push(`
|
|
72
|
+
// --- Runtime Exports ---`);
|
|
73
|
+
entryLines.push(`export const modules = [`);
|
|
74
|
+
entryLines.push(runtimeModulesArray.join(",\n"));
|
|
75
|
+
entryLines.push(`];
|
|
76
|
+
`);
|
|
77
|
+
await fs.writeFile(entryFilePath, entryLines.join("\n"), "utf-8");
|
|
78
|
+
console.log(`\x1B[32m[ModularPack] Generated physical entry file: ${entryFile}\x1B[0m`);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
var searchIndexTsFiles = async (rootPath) => {
|
|
83
|
+
try {
|
|
84
|
+
await fs.access(rootPath);
|
|
85
|
+
} catch {
|
|
86
|
+
return [];
|
|
87
|
+
}
|
|
88
|
+
const dirsToScan = [rootPath];
|
|
89
|
+
const result = [];
|
|
90
|
+
while (dirsToScan.length > 0) {
|
|
91
|
+
const currentDir = dirsToScan.shift();
|
|
92
|
+
if (!currentDir) continue;
|
|
93
|
+
try {
|
|
94
|
+
const entries = await fs.readdir(currentDir);
|
|
95
|
+
for (const entry of entries) {
|
|
96
|
+
if (entry === "node_modules" || entry.startsWith(".")) continue;
|
|
97
|
+
const fullPath = path.join(currentDir, entry);
|
|
98
|
+
const stats = await fs.stat(fullPath);
|
|
99
|
+
if (stats.isDirectory()) {
|
|
100
|
+
dirsToScan.push(fullPath);
|
|
101
|
+
} else if (["index.ts", "index.tsx"].includes(entry)) {
|
|
102
|
+
result.push(fullPath);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
} catch (e) {
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return result;
|
|
109
|
+
};
|
|
110
|
+
export {
|
|
111
|
+
modularPackPlugin
|
|
112
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@path-ioc/pack",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Mesh registry distribution bundler & obfuscator for Path-IoC",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"ioc",
|
|
7
|
+
"bundler",
|
|
8
|
+
"obfuscator",
|
|
9
|
+
"distribution",
|
|
10
|
+
"vite-plugin"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://path-ioc.dev",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/path-ioc/path-ioc.git",
|
|
16
|
+
"directory": "packages/pack"
|
|
17
|
+
},
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/path-ioc/path-ioc/issues"
|
|
20
|
+
},
|
|
21
|
+
"author": "Lian HanLin",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"main": "dist/index.cjs",
|
|
24
|
+
"module": "dist/index.js",
|
|
25
|
+
"types": "dist/index.d.ts",
|
|
26
|
+
"type": "module",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"import": "./dist/index.js",
|
|
31
|
+
"require": "./dist/index.cjs"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist"
|
|
36
|
+
],
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"javascript-obfuscator": "^4.1.0",
|
|
42
|
+
"lodash-es": "^4.17.21"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"vite": "*"
|
|
46
|
+
},
|
|
47
|
+
"peerDependenciesMeta": {
|
|
48
|
+
"vite": {
|
|
49
|
+
"optional": true
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@types/node": "^20.0.0",
|
|
54
|
+
"vite": "^8.2.2",
|
|
55
|
+
"tsup": "^8.0.0",
|
|
56
|
+
"typescript": "^5.4.5",
|
|
57
|
+
"@path-ioc/unplugin": "0.1.1"
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"build": "tsup src/index.ts --format cjs,esm --dts",
|
|
61
|
+
"dev": "tsup src/index.ts --format cjs,esm --dts --watch"
|
|
62
|
+
}
|
|
63
|
+
}
|