@e-mc/file-manager 0.11.0 → 0.11.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 +10 -10
- package/index.js +13 -11
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
## Interface
|
|
11
11
|
|
|
12
|
-
* [View Source](https://www.unpkg.com/@e-mc/types@0.11.
|
|
12
|
+
* [View Source](https://www.unpkg.com/@e-mc/types@0.11.2/lib/index.d.ts)
|
|
13
13
|
|
|
14
14
|
```typescript
|
|
15
15
|
import type { DataSource, IncrementalMatch, TaskAction } from "./squared";
|
|
@@ -306,15 +306,15 @@ NOTE: **FileManager** is a sub-class of [Host](https://www.npmjs.com/package/@e-
|
|
|
306
306
|
|
|
307
307
|
## References
|
|
308
308
|
|
|
309
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
310
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
311
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
312
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
313
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
314
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
315
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
316
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
317
|
-
- https://www.unpkg.com/@e-mc/types@0.11.
|
|
309
|
+
- https://www.unpkg.com/@e-mc/types@0.11.2/lib/squared.d.ts
|
|
310
|
+
- https://www.unpkg.com/@e-mc/types@0.11.2/lib/asset.d.ts
|
|
311
|
+
- https://www.unpkg.com/@e-mc/types@0.11.2/lib/core.d.ts
|
|
312
|
+
- https://www.unpkg.com/@e-mc/types@0.11.2/lib/filemanager.d.ts
|
|
313
|
+
- https://www.unpkg.com/@e-mc/types@0.11.2/lib/logger.d.ts
|
|
314
|
+
- https://www.unpkg.com/@e-mc/types@0.11.2/lib/module.d.ts
|
|
315
|
+
- https://www.unpkg.com/@e-mc/types@0.11.2/lib/node.d.ts
|
|
316
|
+
- https://www.unpkg.com/@e-mc/types@0.11.2/lib/request.d.ts
|
|
317
|
+
- https://www.unpkg.com/@e-mc/types@0.11.2/lib/settings.d.ts
|
|
318
318
|
|
|
319
319
|
* https://www.npmjs.com/package/@types/node
|
|
320
320
|
|
package/index.js
CHANGED
|
@@ -135,7 +135,7 @@ function unsetContent(item) {
|
|
|
135
135
|
item.buffer = null;
|
|
136
136
|
}
|
|
137
137
|
if ('sourceUTF8' in item) {
|
|
138
|
-
item.sourceUTF8 =
|
|
138
|
+
item.sourceUTF8 = undefined;
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
function bundleTorrent(host, files, mimeType, encoding) {
|
|
@@ -175,7 +175,7 @@ function recurseDir(output, subDirs, options) {
|
|
|
175
175
|
for (const item of items) {
|
|
176
176
|
if (!item.isDirectory()) {
|
|
177
177
|
const pathname = path.join(baseDir, item.name);
|
|
178
|
-
if (!ignore.includes(pathname)) {
|
|
178
|
+
if (!ignore.includes(pathname) && !(item.isSymbolicLink() && core_1.Host.isDir(pathname))) {
|
|
179
179
|
output.push(pathname);
|
|
180
180
|
}
|
|
181
181
|
}
|
|
@@ -216,31 +216,33 @@ function checkHash(host, localUri, output, options, data) {
|
|
|
216
216
|
}
|
|
217
217
|
return true;
|
|
218
218
|
}
|
|
219
|
-
function validatePaths(values, patterns, include, dot) {
|
|
219
|
+
function validatePaths(rootDir, values, patterns, include, dot) {
|
|
220
220
|
const items = patterns.map(value => {
|
|
221
221
|
let invert = false;
|
|
222
222
|
if (!include && value.startsWith('!')) {
|
|
223
223
|
value = value.substring(1);
|
|
224
224
|
invert = true;
|
|
225
225
|
}
|
|
226
|
-
|
|
226
|
+
const matchBase = !isMatchRoot(value = core_1.Permission.toPosix(value));
|
|
227
|
+
return [pm(value, { posixSlashes: true, windows: true, nocase: core_1.Host.PLATFORM_WIN32, dot, matchBase }), path.isAbsolute(value), invert];
|
|
227
228
|
});
|
|
228
229
|
return values.filter(value => {
|
|
229
|
-
for (const [pattern,
|
|
230
|
-
if (
|
|
230
|
+
for (const [pattern, absolute, invert] of items) {
|
|
231
|
+
if (pattern(absolute ? value : value.substring(rootDir.length))) {
|
|
231
232
|
return invert ? !include : include;
|
|
232
233
|
}
|
|
233
234
|
}
|
|
234
235
|
return !include;
|
|
235
236
|
});
|
|
236
237
|
}
|
|
237
|
-
function filterPaths(values, include, exclude, dot) {
|
|
238
|
+
function filterPaths(rootDir, values, include, exclude, dot) {
|
|
239
|
+
rootDir = core_1.Host.normalizePath(rootDir, 2);
|
|
238
240
|
if (include) {
|
|
239
241
|
if ((0, types_1.isString)(include)) {
|
|
240
242
|
include = [include];
|
|
241
243
|
}
|
|
242
244
|
if ((0, types_1.isArray)(include)) {
|
|
243
|
-
values = validatePaths(values, include, true, dot);
|
|
245
|
+
values = validatePaths(rootDir, values, include, true, dot);
|
|
244
246
|
}
|
|
245
247
|
}
|
|
246
248
|
if (exclude) {
|
|
@@ -248,7 +250,7 @@ function filterPaths(values, include, exclude, dot) {
|
|
|
248
250
|
exclude = [exclude];
|
|
249
251
|
}
|
|
250
252
|
if ((0, types_1.isArray)(exclude)) {
|
|
251
|
-
return validatePaths(values, exclude, false, dot);
|
|
253
|
+
return validatePaths(rootDir, values, exclude, false, dot);
|
|
252
254
|
}
|
|
253
255
|
}
|
|
254
256
|
return values;
|
|
@@ -550,7 +552,7 @@ async function doVerifyChecksum(root, from, options, nested) {
|
|
|
550
552
|
const index = item.indexOf(' ');
|
|
551
553
|
return [item.substring(0, index), path.join(root, item.substring(index + 1))];
|
|
552
554
|
});
|
|
553
|
-
const checked = include || exclude ? filterPaths(items.map(item => item[1]), include, exclude, options.dot) : null;
|
|
555
|
+
const checked = include || exclude ? filterPaths(root, items.map(item => item[1]), include, exclude, options.dot) : null;
|
|
554
556
|
let valid = false;
|
|
555
557
|
for (const [previous, pathname] of items) {
|
|
556
558
|
if (checked !== null && !checked.includes(pathname) || recursive === 1 && path.basename(pathname) === filename) {
|
|
@@ -1608,7 +1610,7 @@ class FileManager extends core_1.Host {
|
|
|
1608
1610
|
to = joinRoot ? path.join(root, to) : path.resolve(to);
|
|
1609
1611
|
recurseDir(result, [root], { ignore: [...ignore, to], sortBy, recursive });
|
|
1610
1612
|
const output = [];
|
|
1611
|
-
for (const pathname of result = filterPaths(result, include, exclude, options.dot)) {
|
|
1613
|
+
for (const pathname of result = filterPaths(root, result, include, exclude, options.dot)) {
|
|
1612
1614
|
if (recursive === 1 && path.basename(pathname) === filename) {
|
|
1613
1615
|
continue;
|
|
1614
1616
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@e-mc/file-manager",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.2",
|
|
4
4
|
"description": "FileManager constructor for E-mc.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -20,15 +20,15 @@
|
|
|
20
20
|
"license": "BSD-3-Clause",
|
|
21
21
|
"homepage": "https://github.com/anpham6/e-mc#readme",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@e-mc/cloud": "0.11.
|
|
24
|
-
"@e-mc/compress": "0.11.
|
|
25
|
-
"@e-mc/core": "0.11.
|
|
26
|
-
"@e-mc/document": "0.11.
|
|
27
|
-
"@e-mc/image": "0.11.
|
|
28
|
-
"@e-mc/request": "0.11.
|
|
29
|
-
"@e-mc/task": "0.11.
|
|
30
|
-
"@e-mc/types": "0.11.
|
|
31
|
-
"@e-mc/watch": "0.11.
|
|
23
|
+
"@e-mc/cloud": "0.11.2",
|
|
24
|
+
"@e-mc/compress": "0.11.2",
|
|
25
|
+
"@e-mc/core": "0.11.2",
|
|
26
|
+
"@e-mc/document": "0.11.2",
|
|
27
|
+
"@e-mc/image": "0.11.2",
|
|
28
|
+
"@e-mc/request": "0.11.2",
|
|
29
|
+
"@e-mc/task": "0.11.2",
|
|
30
|
+
"@e-mc/types": "0.11.2",
|
|
31
|
+
"@e-mc/watch": "0.11.2",
|
|
32
32
|
"chalk": "4.1.2",
|
|
33
33
|
"diff": "^7.0.0",
|
|
34
34
|
"picomatch": "^4.0.2"
|