Skip to content

Commit e294d39

Browse files
committed
refactor: 将模块导出标识符从 npm: 替换为 pkg:
统一使用 `pkg:` 作为第三方依赖的导出标识符,以提高代码一致性和可读性
1 parent adea2bc commit e294d39

File tree

14 files changed

+35
-35
lines changed

14 files changed

+35
-35
lines changed

README.en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Configure modules to expose in `remote`:
6161
export default {
6262
modules: {
6363
exports: [
64-
'npm:axios',
64+
'pkg:axios',
6565
'root:src/utils.ts'
6666
]
6767
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
export default {
6363
modules: {
6464
exports: [
65-
'npm:axios',
65+
'pkg:axios',
6666
'root:src/utils.ts'
6767
]
6868
}

examples/docs/src/en/api/core/module-config.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ ModuleConfig provides module configuration capabilities for the Esmx framework,
1818
- **Type Definition**:
1919
```ts
2020
enum PathType {
21-
npm = 'npm:',
21+
npm = 'pkg:',
2222
root = 'root:'
2323
}
2424
```
@@ -46,10 +46,10 @@ Export configuration list that exposes specific code units (such as components,
4646

4747
Supports two types:
4848
- `root:*`: Exports source files, e.g., `root:src/components/button.vue`
49-
- `npm:*`: Exports third-party dependencies, e.g., `npm:vue`
49+
- `pkg:*`: Exports third-party dependencies, e.g., `pkg:vue`
5050

5151
Each export item contains the following properties:
52-
- `name`: Original export path, e.g., `npm:vue` or `root:src/components`
52+
- `name`: Original export path, e.g., `pkg:vue` or `root:src/components`
5353
- `type`: Path type (`npm` or `root`)
5454
- `importName`: Import name in the format: `${serviceName}/${type}/${path}`
5555
- `exportName`: Export path relative to the service root directory
@@ -82,8 +82,8 @@ export default {
8282
exports: [
8383
'root:src/components/button.vue', // Export source file
8484
'root:src/utils/format.ts',
85-
'npm:vue', // Export third-party dependency
86-
'npm:vue-router'
85+
'pkg:vue', // Export third-party dependency
86+
'pkg:vue-router'
8787
],
8888

8989
// Import configuration
@@ -144,7 +144,7 @@ Current service root directory path
144144

145145
#### exports
146146
Export configuration list
147-
- `name`: Original export path, e.g., 'npm:vue' or 'root:src/components'
147+
- `name`: Original export path, e.g., 'pkg:vue' or 'root:src/components'
148148
- `type`: Path type (npm or root)
149149
- `importName`: Import name in the format: '${serviceName}/${type}/${path}'
150150
- `exportName`: Export path relative to the service root directory

examples/docs/src/en/api/core/pack-config.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ export default {
160160
exports: [
161161
'root:src/components/button.vue',
162162
'root:src/utils/format.ts',
163-
'npm:vue',
164-
'npm:vue-router'
163+
'pkg:vue',
164+
'pkg:vue-router'
165165
]
166166
},
167167
// Packaging configuration

examples/docs/src/en/guide/essentials/module-link.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ export default {
3939
'root:src/components/button.vue', // Vue component
4040
'root:src/utils/format.ts', // Utility function
4141
// Export third-party dependencies
42-
'npm:vue', // Vue framework
43-
'npm:vue-router' // Vue Router
42+
'pkg:vue', // Vue framework
43+
'pkg:vue-router' // Vue Router
4444
]
4545
}
4646
} satisfies EsmxOptions;
4747
```
4848

4949
Export configuration supports two types:
5050
- `root:*`: Exports source files, with paths relative to the project root
51-
- `npm:*`: Exports third-party dependencies, specified by package name directly
51+
- `pkg:*`: Exports third-party dependencies, specified by package name directly
5252

5353
## Module Import
5454

@@ -151,7 +151,7 @@ export default {
151151
exports: [
152152
'root:src/components/button.vue',
153153
'root:src/utils/format.ts',
154-
'npm:vue'
154+
'pkg:vue'
155155
]
156156
},
157157
// Build configuration

examples/docs/src/zh/api/core/module-config.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ ModuleConfig 提供了 Esmx 框架的模块配置功能,用于定义模块的
1818
- **类型定义**:
1919
```ts
2020
enum PathType {
21-
npm = 'npm:',
21+
npm = 'pkg:',
2222
root = 'root:'
2323
}
2424
```
@@ -46,10 +46,10 @@ interface ModuleConfig {
4646

4747
支持两种类型:
4848
- `root:*`: 导出源码文件,如:`root:src/components/button.vue`
49-
- `npm:*`: 导出第三方依赖,如:`npm:vue`
49+
- `pkg:*`: 导出第三方依赖,如:`pkg:vue`
5050

5151
每个导出项包含以下属性:
52-
- `name`: 原始导出路径,如:`npm:vue``root:src/components`
52+
- `name`: 原始导出路径,如:`pkg:vue``root:src/components`
5353
- `type`: 路径类型(`npm``root`
5454
- `importName`: 导入名称,格式:`${serviceName}/${type}/${path}`
5555
- `exportName`: 导出路径,相对于服务根目录
@@ -82,8 +82,8 @@ export default {
8282
exports: [
8383
'root:src/components/button.vue', // 导出源码文件
8484
'root:src/utils/format.ts',
85-
'npm:vue', // 导出第三方依赖
86-
'npm:vue-router'
85+
'pkg:vue', // 导出第三方依赖
86+
'pkg:vue-router'
8787
],
8888

8989
// 导入配置
@@ -144,7 +144,7 @@ interface ParsedModuleConfig {
144144

145145
#### exports
146146
导出配置列表
147-
- `name`: 原始导出路径,如:'npm:vue' 或 'root:src/components'
147+
- `name`: 原始导出路径,如:'pkg:vue' 或 'root:src/components'
148148
- `type`: 路径类型(npm 或 root)
149149
- `importName`: 导入名称,格式:'${serviceName}/${type}/${path}'
150150
- `exportName`: 导出路径,相对于服务根目录

examples/docs/src/zh/api/core/pack-config.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ export default {
160160
exports: [
161161
'root:src/components/button.vue',
162162
'root:src/utils/format.ts',
163-
'npm:vue',
164-
'npm:vue-router'
163+
'pkg:vue',
164+
'pkg:vue-router'
165165
]
166166
},
167167
// 打包配置

examples/docs/src/zh/guide/essentials/module-link.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ export default {
3939
'root:src/components/button.vue', // Vue 组件
4040
'root:src/utils/format.ts', // 工具函数
4141
// 导出第三方依赖
42-
'npm:vue', // Vue 框架
43-
'npm:vue-router' // Vue Router
42+
'pkg:vue', // Vue 框架
43+
'pkg:vue-router' // Vue Router
4444
]
4545
}
4646
} satisfies EsmxOptions;
4747
```
4848

4949
导出配置支持两种类型:
5050
- `root:*`:导出源码文件,路径相对于项目根目录
51-
- `npm:*`:导出第三方依赖,直接指定包名
51+
- `pkg:*`:导出第三方依赖,直接指定包名
5252

5353
## 模块导入
5454

@@ -151,7 +151,7 @@ export default {
151151
exports: [
152152
'root:src/components/button.vue',
153153
'root:src/utils/format.ts',
154-
'npm:vue'
154+
'pkg:vue'
155155
]
156156
},
157157
// 构建配置

examples/ssr-vue2-remote/src/app.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<span class="property">modules</span>: {
3939
<span class="property">exports</span>: [
4040
<span class="comment">// 导出 Vue 实例</span>
41-
<span class="string">'npm:vue'</span>,
41+
<span class="string">'pkg:vue'</span>,
4242
<span class="comment">// UI 组件</span>
4343
<span class="string">'root:src/components/index.ts'</span>,
4444
<span class="comment">// 组合式函数</span>
@@ -64,7 +64,7 @@
6464
<h3>导出类型</h3>
6565
<div class="export-types">
6666
<div class="export-type">
67-
<code class="highlight">npm:package</code>
67+
<code class="highlight">pkg:package</code>
6868
<p>用于共享核心依赖包(如 Vue),确保所有应用使用相同版本。</p>
6969
</div>
7070
<div class="export-type">

examples/ssr-vue2-remote/src/components/ui/ui-module-guide.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
&nbsp;&nbsp;modules: {<br>
99
&nbsp;&nbsp;&nbsp;&nbsp;exports: [<br>
1010
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">// Vue 实例</span><br>
11-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="string">'npm:vue'</span><br>
11+
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="string">'pkg:vue'</span><br>
1212
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">// UI 组件</span><br>
1313
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="string">'root:src/components/index.ts'</span>,<br>
1414
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="comment">// 组合式函数</span><br>

0 commit comments

Comments
 (0)