@ainc/fs 0.1.11 → 0.1.15

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.
Files changed (186) hide show
  1. package/README.md +1 -0
  2. package/dist/basename.d.ts +6 -6
  3. package/dist/basename.js +16 -16
  4. package/dist/copy.d.ts +40 -40
  5. package/dist/copy.js +89 -89
  6. package/dist/copy.js.map +1 -1
  7. package/dist/cpdir.d.ts +19 -19
  8. package/dist/cpdir.js +28 -28
  9. package/dist/cpdir.js.map +1 -1
  10. package/dist/cwd.d.ts +6 -6
  11. package/dist/cwd.js +16 -16
  12. package/dist/dirname.d.ts +6 -6
  13. package/dist/dirname.js +30 -30
  14. package/dist/extname.d.ts +6 -6
  15. package/dist/extname.js +16 -16
  16. package/dist/filename.d.ts +6 -6
  17. package/dist/filename.js +24 -24
  18. package/dist/find.d.ts +26 -26
  19. package/dist/find.js +72 -72
  20. package/dist/find.js.map +1 -1
  21. package/dist/findFile.d.ts +20 -20
  22. package/dist/findFile.js +39 -39
  23. package/dist/findFile.js.map +1 -1
  24. package/dist/finddir.d.ts +20 -20
  25. package/dist/finddir.js +39 -39
  26. package/dist/finddir.js.map +1 -1
  27. package/dist/helpers/FileResolver.d.ts +54 -0
  28. package/dist/helpers/FileResolver.d.ts.map +1 -0
  29. package/dist/helpers/FileResolver.js +184 -0
  30. package/dist/helpers/FileResolver.js.map +1 -0
  31. package/dist/helpers/compose.d.ts +14 -0
  32. package/dist/helpers/compose.d.ts.map +1 -0
  33. package/dist/helpers/compose.js +38 -0
  34. package/dist/helpers/compose.js.map +1 -0
  35. package/dist/helpers/each.d.ts +7 -0
  36. package/dist/helpers/each.d.ts.map +1 -0
  37. package/dist/helpers/each.js +21 -0
  38. package/dist/helpers/each.js.map +1 -0
  39. package/dist/helpers/match.d.ts +7 -0
  40. package/dist/helpers/match.d.ts.map +1 -0
  41. package/dist/helpers/match.js +30 -0
  42. package/dist/helpers/match.js.map +1 -0
  43. package/dist/helpers/normalizePath.d.ts +23 -0
  44. package/dist/helpers/normalizePath.d.ts.map +1 -0
  45. package/dist/helpers/normalizePath.js +37 -0
  46. package/dist/helpers/normalizePath.js.map +1 -0
  47. package/dist/helpers/safeCall.d.ts +7 -0
  48. package/dist/helpers/safeCall.d.ts.map +1 -0
  49. package/dist/helpers/safeCall.js +24 -0
  50. package/dist/helpers/safeCall.js.map +1 -0
  51. package/dist/helpers/split.d.ts +7 -0
  52. package/dist/helpers/split.d.ts.map +1 -0
  53. package/dist/helpers/split.js +25 -0
  54. package/dist/helpers/split.js.map +1 -0
  55. package/dist/helpers/stripBOM.d.ts +7 -0
  56. package/dist/helpers/stripBOM.d.ts.map +1 -0
  57. package/dist/helpers/stripBOM.js +19 -0
  58. package/dist/helpers/stripBOM.js.map +1 -0
  59. package/dist/helpers/stripComments.d.ts +7 -0
  60. package/dist/helpers/stripComments.d.ts.map +1 -0
  61. package/dist/{normalizeJSON.js → helpers/stripComments.js} +145 -145
  62. package/dist/helpers/stripComments.js.map +1 -0
  63. package/dist/homedir.d.ts +6 -6
  64. package/dist/homedir.js +31 -31
  65. package/dist/includePaths.d.ts +6 -6
  66. package/dist/includePaths.js +53 -53
  67. package/dist/includePaths.js.map +1 -1
  68. package/dist/index.d.ts +43 -44
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.js +90 -92
  71. package/dist/index.js.map +1 -1
  72. package/dist/indir.d.ts +13 -13
  73. package/dist/indir.js +26 -26
  74. package/dist/isAbsolutePath.d.ts +6 -6
  75. package/dist/isAbsolutePath.js +24 -24
  76. package/dist/isDirectory.d.ts +12 -12
  77. package/dist/isDirectory.js +26 -26
  78. package/dist/isDirectory.js.map +1 -1
  79. package/dist/isRelativePath.d.ts +6 -6
  80. package/dist/isRelativePath.js +44 -44
  81. package/dist/json.d.ts +21 -21
  82. package/dist/json.d.ts.map +1 -1
  83. package/dist/json.js +34 -33
  84. package/dist/json.js.map +1 -1
  85. package/dist/jsonc.d.ts +21 -21
  86. package/dist/jsonc.js +40 -40
  87. package/dist/jsonc.js.map +1 -1
  88. package/dist/lstat.d.ts +22 -22
  89. package/dist/lstat.js +30 -30
  90. package/dist/mapdir.d.ts +22 -22
  91. package/dist/mapdir.js +42 -42
  92. package/dist/mapdir.js.map +1 -1
  93. package/dist/mkdir.d.ts +6 -6
  94. package/dist/mkdir.js +37 -37
  95. package/dist/mkdir.js.map +1 -1
  96. package/dist/parseJSON.d.ts +16 -0
  97. package/dist/parseJSON.d.ts.map +1 -0
  98. package/dist/parseJSON.js +29 -0
  99. package/dist/parseJSON.js.map +1 -0
  100. package/dist/readFile.d.ts +29 -29
  101. package/dist/readFile.js +26 -26
  102. package/dist/readFile.js.map +1 -1
  103. package/dist/readStream.d.ts +36 -36
  104. package/dist/readStream.d.ts.map +1 -1
  105. package/dist/readStream.js +19 -19
  106. package/dist/readStream.js.map +1 -1
  107. package/dist/readdir.d.ts +16 -16
  108. package/dist/readdir.js +34 -34
  109. package/dist/readdir.js.map +1 -1
  110. package/dist/readline.d.ts +16 -16
  111. package/dist/readline.d.ts.map +1 -1
  112. package/dist/readline.js +24 -24
  113. package/dist/readline.js.map +1 -1
  114. package/dist/realpath.d.ts +12 -12
  115. package/dist/realpath.js +32 -32
  116. package/dist/realpath.js.map +1 -1
  117. package/dist/relative.d.ts +6 -6
  118. package/dist/relative.js +38 -38
  119. package/dist/resolve.d.ts +26 -26
  120. package/dist/resolve.js +53 -53
  121. package/dist/resolve.js.map +1 -1
  122. package/dist/resolvePath.d.ts +27 -0
  123. package/dist/resolvePath.d.ts.map +1 -0
  124. package/dist/resolvePath.js +178 -0
  125. package/dist/resolvePath.js.map +1 -0
  126. package/dist/rmdir.d.ts +6 -6
  127. package/dist/rmdir.js +40 -40
  128. package/dist/rmdir.js.map +1 -1
  129. package/dist/stat.d.ts +21 -21
  130. package/dist/stat.js +30 -30
  131. package/dist/supdir.d.ts +21 -15
  132. package/dist/supdir.d.ts.map +1 -1
  133. package/dist/supdir.js +62 -35
  134. package/dist/supdir.js.map +1 -1
  135. package/dist/symlink.d.ts +22 -22
  136. package/dist/symlink.js +39 -39
  137. package/dist/symlink.js.map +1 -1
  138. package/dist/unlink.d.ts +6 -6
  139. package/dist/unlink.js +28 -28
  140. package/dist/unlink.js.map +1 -1
  141. package/dist/usedir.d.ts +6 -6
  142. package/dist/usedir.js +24 -24
  143. package/dist/writeFile.d.ts +33 -33
  144. package/dist/writeFile.js +49 -49
  145. package/dist/writeFile.js.map +1 -1
  146. package/dist/writeStream.d.ts +35 -35
  147. package/dist/writeStream.d.ts.map +1 -1
  148. package/dist/writeStream.js +19 -19
  149. package/dist/writeStream.js.map +1 -1
  150. package/package.json +5 -5
  151. package/src/helpers/FileResolver.ts +282 -0
  152. package/src/helpers/compose.ts +49 -0
  153. package/src/helpers/each.ts +19 -0
  154. package/src/helpers/match.ts +31 -0
  155. package/src/helpers/normalizePath.ts +51 -0
  156. package/src/helpers/safeCall.ts +21 -0
  157. package/src/helpers/split.ts +25 -0
  158. package/src/helpers/stripBOM.ts +17 -0
  159. package/src/{normalizeJSON.ts → helpers/stripComments.ts} +1 -1
  160. package/src/index.ts +2 -3
  161. package/src/json.ts +2 -1
  162. package/src/jsonc.ts +2 -2
  163. package/src/parseJSON.ts +40 -0
  164. package/src/readStream.ts +2 -2
  165. package/src/readline.ts +2 -2
  166. package/src/resolvePath.ts +234 -0
  167. package/src/supdir.ts +31 -0
  168. package/src/writeStream.ts +2 -2
  169. package/dist/normalizeJSON.d.ts +0 -7
  170. package/dist/normalizeJSON.d.ts.map +0 -1
  171. package/dist/normalizeJSON.js.map +0 -1
  172. package/dist/resolveFile.d.ts +0 -22
  173. package/dist/resolveFile.d.ts.map +0 -1
  174. package/dist/resolveFile.js +0 -80
  175. package/dist/resolveFile.js.map +0 -1
  176. package/dist/resolveModule.d.ts +0 -41
  177. package/dist/resolveModule.d.ts.map +0 -1
  178. package/dist/resolveModule.js +0 -119
  179. package/dist/resolveModule.js.map +0 -1
  180. package/dist/resolvePaths.d.ts +0 -22
  181. package/dist/resolvePaths.d.ts.map +0 -1
  182. package/dist/resolvePaths.js +0 -233
  183. package/dist/resolvePaths.js.map +0 -1
  184. package/src/resolveFile.ts +0 -103
  185. package/src/resolveModule.ts +0 -157
  186. package/src/resolvePaths.ts +0 -320
package/src/readStream.ts CHANGED
@@ -38,9 +38,9 @@ export interface Options {
38
38
  * 创建可读流
39
39
  *****************************************
40
40
  */
41
- function readStream(path: string, encoding?: string): fs.ReadStream;
41
+ function readStream(path: string, encoding?: BufferEncoding): fs.ReadStream;
42
42
  function readStream(path: string, options?: Options): fs.ReadStream;
43
- function readStream(path: string, options?: string | Options): fs.ReadStream {
43
+ function readStream(path: string, options?: BufferEncoding | Options): fs.ReadStream {
44
44
  return fs.createReadStream(path, options);
45
45
  }
46
46
 
package/src/readline.ts CHANGED
@@ -23,9 +23,9 @@ import { Options } from './readStream';
23
23
  * 逐行读取
24
24
  *****************************************
25
25
  */
26
- function readline(path: string, encoding?: string): Readable;
26
+ function readline(path: string, encoding?: BufferEncoding): Readable;
27
27
  function readline(path: string, options?: Options): Readable;
28
- function readline(path: string, options?: string | Options): Readable {
28
+ function readline(path: string, options?: BufferEncoding | Options): Readable {
29
29
  const input = fs.createReadStream(path, options);
30
30
  const readable = Readable.from(createInterface({ input, crlfDelay: Infinity }));
31
31
 
@@ -0,0 +1,234 @@
1
+ /**
2
+ *****************************************
3
+ * Created by edonet@163.com
4
+ * Created on 2021-06-19 00:16:40
5
+ *****************************************
6
+ */
7
+ 'use strict';
8
+
9
+
10
+ /**
11
+ *****************************************
12
+ * 加载依赖
13
+ *****************************************
14
+ */
15
+ import { createFileResolver, FileResolver, Handler, Options as FileOptions } from './helpers/FileResolver';
16
+ import { split } from './helpers/split';
17
+ import { each } from './helpers/each';
18
+ import { compose } from './helpers/compose';
19
+ import { cwd } from './cwd';
20
+
21
+
22
+ /**
23
+ *****************************************
24
+ * 格式化别名
25
+ *****************************************
26
+ */
27
+ function normalizePaths(value: string | string[]): void | string[] {
28
+
29
+ // 校验值
30
+ if (!value) {
31
+ return;
32
+ }
33
+
34
+ // 处理字符串配置
35
+ if (typeof value === 'string') {
36
+ return [value];
37
+ }
38
+
39
+ // 校验数组配置参数
40
+ if (!Array.isArray(value) || !value.length) {
41
+ return;
42
+ }
43
+
44
+ // 校验参数
45
+ if (value.find(path => !path || typeof path !== 'string')) {
46
+ throw new Error('expect paths value to be valid string[]!');
47
+ }
48
+
49
+ // 返回结果
50
+ return value;
51
+ }
52
+
53
+
54
+ /**
55
+ *****************************************
56
+ * 创建路径解析器
57
+ *****************************************
58
+ */
59
+ function createPathsResolver(resolver: FileResolver, options: Options): Handler {
60
+ const rules: Handler[] = [];
61
+ const baseURL = cwd(options.context || process.cwd(), options.baseUrl || './');
62
+ const resolvePath = resolver.resolvePath;
63
+
64
+ // 解析路径
65
+ function resolvePaths(paths: string[]): Handler {
66
+ return compose(paths.map(value => {
67
+ const [start, end] = split(value, '*');
68
+
69
+ // 处理绝对匹配
70
+ if (end === undefined) {
71
+ return (_, context) => resolvePath(cwd(baseURL, start), context);
72
+ } else {
73
+ return (id, context) => resolvePath(cwd(baseURL, start + id + end), context);
74
+ }
75
+ }));
76
+ }
77
+
78
+ // 校验存在路径映射配置
79
+ each(options.paths, (value, key) => {
80
+ const paths = normalizePaths(value);
81
+
82
+ // 校验配置
83
+ if (!paths) {
84
+ return;
85
+ }
86
+
87
+ // 生成解析函数
88
+ const resolve = resolvePaths(paths);
89
+
90
+ // 解析匹配项
91
+ const [start, end] = split(key, '*');
92
+
93
+ // 完成匹配
94
+ if (end === undefined) {
95
+ return rules.push((id, context) => {
96
+ return id === start ? resolve('', context) : undefined;
97
+ });
98
+ }
99
+
100
+ // 获取前/后缀长度
101
+ const startLength = start.length;
102
+ const endLength = end.length;
103
+ const idx = (startLength ? 1 : 0) + (endLength ? 2 : 0);
104
+
105
+ // 匹配前缀
106
+ if (idx === 1) {
107
+ return rules.push((id, context) => {
108
+ if (id.startsWith(start)) {
109
+ return resolve(id.slice(startLength), context);
110
+ }
111
+ });
112
+ }
113
+
114
+ // 匹配后缀
115
+ if (idx === 2) {
116
+ return rules.push((id, context) => {
117
+ if (id.endsWith(end)) {
118
+ return resolve(id.slice(0, - endLength), context);
119
+ }
120
+ });
121
+ }
122
+
123
+ // 匹配前缀和后缀
124
+ if (idx === 3) {
125
+ return rules.push((id, context) => {
126
+ if (id.startsWith(start) && id.endsWith(end)) {
127
+ return resolve(id.slice(startLength, - endLength), context);
128
+ }
129
+ });
130
+ }
131
+
132
+ // 默认完全匹配
133
+ return rules.push((id, context) => resolve(id, context));
134
+ });
135
+
136
+ // 组件规则解析方法
137
+ if (rules.length) {
138
+ return resolver.wrapHandler(compose([...rules, resolver.resolveModule]));
139
+ } else {
140
+ return resolvePath;
141
+ }
142
+ }
143
+
144
+
145
+ /**
146
+ *****************************************
147
+ * 创建别名解析器
148
+ *****************************************
149
+ */
150
+ function createAliasResolver(resolver: FileResolver, options: Options): Handler {
151
+ const resolvePaths = createPathsResolver(resolver, options);
152
+ const rules: Handler[] = [];
153
+
154
+ // 解析别名
155
+ each(options.alias, (value, key) => {
156
+ const paths = normalizePaths(value);
157
+
158
+ // 校验参数
159
+ if (!paths) {
160
+ return;
161
+ }
162
+
163
+ // 生成解析函数
164
+ const resolve: Handler = compose(
165
+ paths.map(start => (id, context) => resolvePaths(start + id, context))
166
+ );
167
+
168
+ // 绝对匹配
169
+ if (key.endsWith('$')) {
170
+
171
+ // 去除匹配符
172
+ key = key.slice(0, -1);
173
+
174
+ // 添加匹配规则
175
+ return rules.push(
176
+ (id, context) => (id === key ? resolve('', context) : undefined)
177
+ );
178
+ }
179
+
180
+ // 生成配置前缀
181
+ const prefix = key + '/';
182
+ const prefixLength = key.length;
183
+
184
+ // 添加匹配规则
185
+ return rules.push(
186
+ (id, context) => (id === key ? resolve('', context) : undefined),
187
+ (id, context) => (id.startsWith(prefix) ? resolve(id.slice(prefixLength), context) : undefined)
188
+ );
189
+ });
190
+
191
+ // 返回解析函数
192
+ if (rules.length) {
193
+ return resolver.wrapHandler(compose([...rules, resolvePaths]));
194
+ } else {
195
+ return resolvePaths;
196
+ }
197
+ }
198
+
199
+
200
+ /**
201
+ *****************************************
202
+ * 选项
203
+ *****************************************
204
+ */
205
+ export interface Options extends FileOptions {
206
+ baseUrl?: string;
207
+ paths?: {
208
+ [key: string]: string[];
209
+ };
210
+ alias?: {
211
+ [key: string]: string | string[];
212
+ };
213
+ }
214
+
215
+
216
+ /**
217
+ *****************************************
218
+ * 解析文件
219
+ *****************************************
220
+ */
221
+ export function resolvePath(options: Options = {}): Handler {
222
+ const modules = options.modules || ['node_modules'];
223
+
224
+ // 添加基准模块解析
225
+ if (options.baseUrl || options.paths) {
226
+ modules.unshift(options.baseUrl || '.');
227
+ }
228
+
229
+ // 创建文件解析器
230
+ const resolver = createFileResolver({ ...options, modules });
231
+
232
+ // 返回解析函数
233
+ return createAliasResolver(resolver, options);
234
+ }
package/src/supdir.ts CHANGED
@@ -16,6 +16,37 @@ import * as path from 'path';
16
16
  import { dirname } from './dirname';
17
17
 
18
18
 
19
+ /**
20
+ *****************************************
21
+ * 遍历目录
22
+ *****************************************
23
+ */
24
+ export function mapdir(dir: string, handler: (dir: string) => void): void {
25
+ const resolveFrom = path.resolve(dir);
26
+ const sep = path.sep;
27
+ const end = resolveFrom.indexOf(sep);
28
+
29
+ // 不存在结束符
30
+ if (end < 0) {
31
+ return handler(resolveFrom);
32
+ }
33
+
34
+ // 遍历目录
35
+ for (let idx = resolveFrom.length; idx >= end; ) {
36
+
37
+ // 执行回调
38
+ if (idx === 0) {
39
+ return handler('/');
40
+ } else {
41
+ handler(resolveFrom.slice(0, idx));
42
+ }
43
+
44
+ // 更新索引
45
+ idx = resolveFrom.lastIndexOf(sep, idx - 1);
46
+ }
47
+ }
48
+
49
+
19
50
  /**
20
51
  *****************************************
21
52
  * 查找上一级目录回调
@@ -37,9 +37,9 @@ interface Options {
37
37
  * 创建可写流
38
38
  *****************************************
39
39
  */
40
- function writeStream(path: string, encoding?: string): fs.WriteStream;
40
+ function writeStream(path: string, encoding?: BufferEncoding): fs.WriteStream;
41
41
  function writeStream(path: string, options?: Options): fs.WriteStream;
42
- function writeStream(path: string, options?: string | Options): fs.WriteStream {
42
+ function writeStream(path: string, options?: BufferEncoding | Options): fs.WriteStream {
43
43
  return fs.createWriteStream(path, options);
44
44
  }
45
45
 
@@ -1,7 +0,0 @@
1
- /**
2
- *****************************************
3
- * 过滤注释
4
- *****************************************
5
- */
6
- export declare function normalizeJSON(content: string): string;
7
- //# sourceMappingURL=normalizeJSON.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalizeJSON.d.ts","sourceRoot":"","sources":["../src/normalizeJSON.ts"],"names":[],"mappings":"AAiGA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAgErD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalizeJSON.js","sourceRoot":"","sources":["../src/normalizeJSON.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,YAAY,CAAC;;;AAGb;;;;GAIG;AACH,SAAS,SAAS,CAAC,KAAa,EAAE,MAAc;IAC5C,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,SAAS;IACT,OAAO,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,EAAE;QACnC,KAAK,EAAG,CAAC;KACZ;IAED,SAAS;IACT,OAAO,KAAK,GAAG,CAAC,CAAC;AACrB,CAAC;AAGD;;;;GAIG;AACH,SAAS,eAAe,CAAC,KAAa,EAAE,MAAc;IAClD,IAAI,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAEvB,SAAS;IACT,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE;QAC7B,EAAE,GAAG,MAAM,CAAC,EAAG,KAAK,CAAC,CAAC;KACzB;IAED,WAAW;IACX,OAAO,IAAI,CAAC,OAAO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AAK,GAAG,mBAAmB,CAAC,GAAG,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;YAC9C,GAAG,GAAG,KAAK,GAAG,CAAC,CAAC;YAChB,SAAS;SACZ;QAED,SAAS;QACT,IAAI,IAAI,KAAK,GAAG,EAAE;YACd,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC;YACxC,KAAK,GAAG,oBAAoB,CAAC,GAAG,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC;YAC/C,GAAG,GAAG,KAAK,CAAC;YACZ,SAAS;SACZ;KACJ;IAED,SAAS;IACT,IAAI,KAAK,GAAG,GAAG,EAAE;QACb,MAAM,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KAClC;IAED,OAAO;IACP,OAAO,MAAM,CAAC;AAClB,CAAC;AAhED,sCAgEC"}
@@ -1,22 +0,0 @@
1
- /**
2
- *****************************************
3
- * 配置项
4
- *****************************************
5
- */
6
- export interface Options {
7
- extensions?: string[];
8
- mainFields?: string[];
9
- }
10
- /**
11
- *****************************************
12
- * 匹配列表
13
- *****************************************
14
- */
15
- export declare function match<T, P>(list: T[], handler: (data: T, index: number) => void | P): void | P;
16
- /**
17
- *****************************************
18
- * 解析文件
19
- *****************************************
20
- */
21
- export declare function resolveFile(file: string, options?: Options): void | string;
22
- //# sourceMappingURL=resolveFile.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolveFile.d.ts","sourceRoot":"","sources":["../src/resolveFile.ts"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH,MAAM,WAAW,OAAO;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAGD;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAgB9F;AAGD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,OAAY,GAAG,IAAI,GAAG,MAAM,CA2C9E"}
@@ -1,80 +0,0 @@
1
- /**
2
- *****************************************
3
- * Created by edonet@163.com
4
- * Created on 2021-06-19 00:16:40
5
- *****************************************
6
- */
7
- 'use strict';
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.resolveFile = exports.match = void 0;
10
- /**
11
- *****************************************
12
- * 加载依赖
13
- *****************************************
14
- */
15
- const path_1 = require("path");
16
- const stat_1 = require("./stat");
17
- const json_1 = require("./json");
18
- /**
19
- *****************************************
20
- * 匹配列表
21
- *****************************************
22
- */
23
- function match(list, handler) {
24
- // 处理长度为1
25
- if (list.length === 1) {
26
- return handler(list[0], 0);
27
- }
28
- // 处理列表
29
- for (let idx = 0, len = list.length; idx < len; idx++) {
30
- const result = handler(list[idx], idx);
31
- // 返回结果
32
- if (typeof result !== 'undefined') {
33
- return result;
34
- }
35
- }
36
- }
37
- exports.match = match;
38
- /**
39
- *****************************************
40
- * 解析文件
41
- *****************************************
42
- */
43
- function resolveFile(file, options = {}) {
44
- const exts = [''].concat(options.extensions || ['.js', '.ts', '.mjs', '.jsx', '.tsx', '.json']);
45
- const dirs = [];
46
- // 解析文件
47
- for (let idx = 0, len = exts.length; idx < len; idx++) {
48
- const stats = stat_1.stat(file + exts[idx]);
49
- // 存在目录
50
- if (stats) {
51
- if (stats.isFile()) {
52
- return stats.path;
53
- }
54
- // 添加解析目录
55
- stats.isDirectory() && dirs.push(stats.path);
56
- }
57
- }
58
- // 解析目录
59
- return match(dirs, (dir) => {
60
- const pkg = json_1.json(path_1.join(dir, 'package.json'));
61
- // 配置包对象
62
- if (pkg) {
63
- const result = match(options.mainFields || ['main'], field => {
64
- const main = pkg[field];
65
- // 存在对象
66
- if (main) {
67
- return resolveFile(path_1.resolve(dir, main), options);
68
- }
69
- });
70
- // 匹配成功
71
- if (typeof result !== 'undefined') {
72
- return result;
73
- }
74
- }
75
- // 配置默认文件
76
- return resolveFile(path_1.join(dir, 'index'), options);
77
- });
78
- }
79
- exports.resolveFile = resolveFile;
80
- //# sourceMappingURL=resolveFile.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolveFile.js","sourceRoot":"","sources":["../src/resolveFile.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,YAAY,CAAC;;;AAGb;;;;GAIG;AACH,+BAAqC;AACrC,iCAA8B;AAC9B,iCAA8B;AAc9B;;;;GAIG;AACH,SAAgB,KAAK,CAAO,IAAS,EAAE,OAA6C;IAEhF,SAAS;IACT,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QACnB,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KAC9B;IAED,OAAO;IACP,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,EAAG,EAAE;QACpD,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;QAEvC,OAAO;QACP,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;YAC/B,OAAO,MAAM,CAAC;SACjB;KACJ;AACL,CAAC;AAhBD,sBAgBC;AAGD;;;;GAIG;AACH,SAAgB,WAAW,CAAC,IAAY,EAAE,UAAmB,EAAE;IAC3D,MAAM,IAAI,GAAa,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1G,MAAM,IAAI,GAAa,EAAE,CAAC;IAE1B,OAAO;IACP,KA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************
4
- * 解析函数
5
- *****************************************
6
- */
7
- export declare type Handler = (id: string, context?: string) => void | string;
8
- /**
9
- *****************************************
10
- * 格式化路径
11
- *****************************************
12
- */
13
- export declare function normalizePaths(paths: string | string[]): string[];
14
- /**
15
- *****************************************
16
- * 解析内置模块
17
- *****************************************
18
- */
19
- export declare function resolveBuiltinModule(name: string): void | string;
20
- /**
21
- *****************************************
22
- * 解析模块目录
23
- *****************************************
24
- */
25
- export declare function resolveModulePaths(options: Options): Handler;
26
- /**
27
- *****************************************
28
- * 解析配置
29
- *****************************************
30
- */
31
- export interface Options extends ResolveFileOptions {
32
- modules?: string[];
33
- useRelativePath?: boolean;
34
- }
35
- /**
36
- *****************************************
37
- * 解析模块
38
- *****************************************
39
- */
40
- export declare function resolveModule(id: string, context?: string, options?: Options): void | string;
41
- //# sourceMappingURL=resolveModule.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolveModule.d.ts","sourceRoot":"","sources":["../src/resolveModule.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAsB,OAAO,IAAI,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGlF;;;;GAIG;AACH,oBAAY,OAAO,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,MAAM,CAAC;AAGtE;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,CAuBjE;AAGD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAEhE;AAWD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAiD5D;AAGD;;;;GAIG;AACH,MAAM,WAAW,OAAQ,SAAQ,kBAAkB;IAC/C,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B;AAGD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,GAAG,MAAM,CAE5F"}
@@ -1,119 +0,0 @@
1
- /**
2
- *****************************************
3
- * Created by edonet@163.com
4
- * Created on 2021-07-10 17:01:38
5
- *****************************************
6
- */
7
- 'use strict';
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.resolveModule = exports.resolveModulePaths = exports.resolveBuiltinModule = exports.normalizePaths = void 0;
10
- /**
11
- *****************************************
12
- * 加载依赖
13
- *****************************************
14
- */
15
- const Module = require("module");
16
- const cwd_1 = require("./cwd");
17
- const supdir_1 = require("./supdir");
18
- const relative_1 = require("./relative");
19
- const isDirectory_1 = require("./isDirectory");
20
- const isRelativePath_1 = require("./isRelativePath");
21
- const isAbsolutePath_1 = require("./isAbsolutePath");
22
- const resolveFile_1 = require("./resolveFile");
23
- /**
24
- *****************************************
25
- * 格式化路径
26
- *****************************************
27
- */
28
- function normalizePaths(paths) {
29
- // 重载参数
30
- if (typeof paths === 'string') {
31
- paths = [paths];
32
- }
33
- // 校验参数
34
- if (!Array.isArray(paths)) {
35
- throw new Error('expect paths to be path string or string[]!');
36
- }
37
- // 生成处理函数
38
- return paths.map(name => {
39
- // 校验路径
40
- if (!name || typeof name !== 'string') {
41
- throw new Error('expect paths to be path string or string[]!');
42
- }
43
- // 解析路径
44
- return isRelativePath_1.isRelativePath(name) ? cwd_1.cwd(name) : name;
45
- });
46
- }
47
- exports.normalizePaths = normalizePaths;
48
- /**
49
- *****************************************
50
- * 解析内置模块
51
- *****************************************
52
- */
53
- function resolveBuiltinModule(name) {
54
- return Module.builtinModules.includes(name) ? name : undefined;
55
- }
56
- exports.resolveBuiltinModule = resolveBuiltinModule;
57
- /**
58
- *****************************************
59
- * 第三方模块路径
60
- *****************************************
61
- */
62
- const nodeModulesRegExp = /^(\.?\.\/)*node_modules\//i;
63
- /**
64
- *****************************************
65
- * 解析模块目录
66
- *****************************************
67
- */
68
- function resolveModulePaths(options) {
69
- const baseDir = process.cwd();
70
- const cached = new Map();
71
- const modules = normalizePaths(options.modules || ['node_modules']);
72
- const useRelativePath = !!options.useRelativePath;
73
- // 解析模块上下文
74
- function resolveModuleContext(context) {
75
- const paths = [];
76
- // 遍历路径
77
- modules.forEach(path => {
78
- if (isAbsolutePath_1.isAbsolutePath(path)) {
79
- paths.push(path);
80
- }
81
- else {
82
- supdir_1.supdir(context, (dir, next) => (paths.push(cwd_1.cwd(dir, path)), next()));
83
- }
84
- });
85
- // 生成解析函数
86
- const resolve = id => resolveFile_1.match(paths, dir => {
87
- return isDirectory_1.isDirectory(dir) ? resolveFile_1.resolveFile(cwd_1.cwd(dir, id), options) : undefined;
88
- });
89
- // 缓存函数
90
- cached.set(context, resolve);
91
- // 返回函数函数
92
- return resolve;
93
- }
94
- // 返回结果
95
- return (id, context) => {
96
- const dir = context || baseDir;
97
- const resolve = cached.get(dir) || resolveModuleContext(dir);
98
- const modulePath = resolve(id);
99
- // 解析失败
100
- if (!modulePath) {
101
- return;
102
- }
103
- // 解析返回路径
104
- return (useRelativePath ?
105
- relative_1.relative(dir, modulePath).replace(nodeModulesRegExp, '') :
106
- modulePath);
107
- };
108
- }
109
- exports.resolveModulePaths = resolveModulePaths;
110
- /**
111
- *****************************************
112
- * 解析模块
113
- *****************************************
114
- */
115
- function resolveModule(id, context, options) {
116
- return resolveModulePaths(options || {})(id, context);
117
- }
118
- exports.resolveModule = resolveModule;
119
- //# sourceMappingURL=resolveModule.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolveModule.js","sourceRoot":"","sources":["../src/resolveModule.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,YAAY,CAAC;;;AAGb;;;;GAIG;AACH,iCAAiC;AACjC,+BAA4B;AAC5B,qCAAkC;AAClC,yCAAsC;AACtC,+CAA4C;AAC5C,qDAAkD;AAClD,qDA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E,UAAU,CAAC,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC,CAAC;YAC1D,UAAU,CACb,CAAC;IACN,CAAC,CAAC;AACN,CAAC;AAjDD,gDAiDC;AAcD;;;;GAIG;AACH,SAAgB,aAAa,CAAC,EAAU,EAAE,OAAgB,EAAE,OAAiB;IACzE,OAAO,kBAAkB,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;AAC1D,CAAC;AAFD,sCAEC"}
@@ -1,22 +0,0 @@
1
- import { Handler, Options as ResolveModuleOptions } from './resolveModule';
2
- /**
3
- *****************************************
4
- * 别名配置
5
- *****************************************
6
- */
7
- export interface Options extends ResolveModuleOptions {
8
- baseUrl?: string;
9
- paths?: {
10
- [key: string]: string[];
11
- };
12
- alias?: {
13
- [key: string]: string | string[];
14
- };
15
- }
16
- /**
17
- *****************************************
18
- * 解析模块路径
19
- *****************************************
20
- */
21
- export declare function resolvePaths(options: Options): Handler;
22
- //# sourceMappingURL=resolvePaths.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolvePaths.d.ts","sourceRoot":"","sources":["../src/resolvePaths.ts"],"names":[],"mappings":"AAkBA,OAAO,EAA4D,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAoPrI;;;;GAIG;AACH,MAAM,WAAW,OAAQ,SAAQ,oBAAoB;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE;QACJ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;KAC3B,CAAC;IACF,KAAK,CAAC,EAAE;QACJ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;KACpC,CAAC;CACL;AAGD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAoCtD"}