@e-mc/file-manager 0.10.14 → 0.10.16

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 (3) hide show
  1. package/README.md +10 -10
  2. package/index.js +13 -14
  3. package/package.json +11 -11
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.10.14/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.10.16/lib/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { DataSource, IncrementalMatch, TaskAction } from "./squared";
@@ -305,15 +305,15 @@ NOTE: **FileManager** is a sub-class of [Host](https://www.npmjs.com/package/@e-
305
305
 
306
306
  ## References
307
307
 
308
- - https://www.unpkg.com/@e-mc/types@0.10.14/lib/squared.d.ts
309
- - https://www.unpkg.com/@e-mc/types@0.10.14/lib/asset.d.ts
310
- - https://www.unpkg.com/@e-mc/types@0.10.14/lib/core.d.ts
311
- - https://www.unpkg.com/@e-mc/types@0.10.14/lib/filemanager.d.ts
312
- - https://www.unpkg.com/@e-mc/types@0.10.14/lib/logger.d.ts
313
- - https://www.unpkg.com/@e-mc/types@0.10.14/lib/module.d.ts
314
- - https://www.unpkg.com/@e-mc/types@0.10.14/lib/node.d.ts
315
- - https://www.unpkg.com/@e-mc/types@0.10.14/lib/request.d.ts
316
- - https://www.unpkg.com/@e-mc/types@0.10.14/lib/settings.d.ts
308
+ - https://www.unpkg.com/@e-mc/types@0.10.16/lib/squared.d.ts
309
+ - https://www.unpkg.com/@e-mc/types@0.10.16/lib/asset.d.ts
310
+ - https://www.unpkg.com/@e-mc/types@0.10.16/lib/core.d.ts
311
+ - https://www.unpkg.com/@e-mc/types@0.10.16/lib/filemanager.d.ts
312
+ - https://www.unpkg.com/@e-mc/types@0.10.16/lib/logger.d.ts
313
+ - https://www.unpkg.com/@e-mc/types@0.10.16/lib/module.d.ts
314
+ - https://www.unpkg.com/@e-mc/types@0.10.16/lib/node.d.ts
315
+ - https://www.unpkg.com/@e-mc/types@0.10.16/lib/request.d.ts
316
+ - https://www.unpkg.com/@e-mc/types@0.10.16/lib/settings.d.ts
317
317
 
318
318
  * https://www.npmjs.com/package/@types/node
319
319
 
package/index.js CHANGED
@@ -176,9 +176,10 @@ function recurseDir(output, subDirs, options) {
176
176
  for (const item of items) {
177
177
  if (!item.isDirectory()) {
178
178
  const pathname = path.join(baseDir, item.name);
179
- if (!ignore.includes(pathname) && !(item.isSymbolicLink() && core_1.Host.isDir(pathname))) {
180
- output.push(pathname);
179
+ if (item.isSymbolicLink() && core_1.Host.isDir(pathname) || ignore.length > 0 && (core_1.Host.PLATFORM_WIN32 ? ignore.includes(pathname.toLowerCase()) : ignore.includes(pathname))) {
180
+ continue;
181
181
  }
182
+ output.push(pathname);
182
183
  }
183
184
  else if (recursive) {
184
185
  recurseDir(output, subDirs.concat(item.name), options);
@@ -548,7 +549,7 @@ async function doVerifyChecksum(root, from, options, nested) {
548
549
  const filename = path.basename(from);
549
550
  const files = [];
550
551
  from = joinRoot ? path.join(root, filename) : path.resolve(from);
551
- recurseDir(files, [root], { ignore: [...ignore, from], sortBy, recursive });
552
+ recurseDir(files, [root], { ignore: mapLower([...ignore, from]), sortBy, recursive });
552
553
  const items = fs.readFileSync(from, 'utf-8').split('\n').map(item => {
553
554
  const index = item.indexOf(' ');
554
555
  return [item.substring(0, index), path.join(root, item.substring(index + 1))];
@@ -683,6 +684,7 @@ const isCacheable = (item) => item.initialValue?.cacheable !== false;
683
684
  const getPmOptions = (value, dot = false) => ({ nocase: core_1.Host.PLATFORM_WIN32, matchBase: value.startsWith('*') && !value.includes('/'), dot });
684
685
  const hasIncremental = (value) => value === "etag" || value === "exists";
685
686
  const matchPathname = (value) => core_1.Host.PLATFORM_WIN32 ? value.toLowerCase() : value;
687
+ const mapLower = (values) => core_1.Host.PLATFORM_WIN32 ? values.map(value => value.toLowerCase()) : values;
686
688
  const sanitizePath = (value) => value.replace(/(?:^\\|\\+)/g, '/');
687
689
  const equalAddress = (value, other) => value === other || decodeURIComponent(value) === decodeURIComponent(other);
688
690
  const formatPercent = (value) => Math.round(value).toString().padStart(3) + '%';
@@ -1618,7 +1620,7 @@ class FileManager extends core_1.Host {
1618
1620
  const filename = path.basename(to);
1619
1621
  const output = [];
1620
1622
  to = joinRoot ? path.join(root, to) : path.resolve(to);
1621
- recurseDir(result, [root], { ignore: [...ignore, to], sortBy, recursive });
1623
+ recurseDir(result, [root], { ignore: mapLower([...ignore, to]), sortBy, recursive });
1622
1624
  result = filterPaths(root, result, include, exclude, options.dot);
1623
1625
  for (const pathname of result) {
1624
1626
  if (recursive === 1 && path.basename(pathname) === filename) {
@@ -2274,12 +2276,9 @@ class FileManager extends core_1.Host {
2274
2276
  }
2275
2277
  removeCwd(value) {
2276
2278
  if (typeof value === 'string') {
2277
- let baseDir = this.baseDirectory + path.sep, leading = value.substring(0, baseDir.length);
2278
- if (core_1.Host.PLATFORM_WIN32) {
2279
- baseDir = baseDir.toLowerCase();
2280
- leading = leading.toLowerCase();
2281
- }
2282
- if (leading === baseDir) {
2279
+ const baseDir = this.baseDirectory + path.sep;
2280
+ const leading = value.substring(0, baseDir.length);
2281
+ if (leading === baseDir || core_1.Host.PLATFORM_WIN32 && leading.toLowerCase() === baseDir.toLowerCase()) {
2283
2282
  return value.substring(baseDir.length);
2284
2283
  }
2285
2284
  }
@@ -3981,11 +3980,11 @@ class FileManager extends core_1.Host {
3981
3980
  if (cleared) {
3982
3981
  last = item;
3983
3982
  }
3983
+ else if (!redraw && scroll[i] === item) {
3984
+ PROCESS_STDOUT.moveCursor(0, 1);
3985
+ continue;
3986
+ }
3984
3987
  else {
3985
- if (!redraw && scroll[i] === item) {
3986
- PROCESS_STDOUT.moveCursor(0, 1);
3987
- continue;
3988
- }
3989
3988
  const options = { ...item[4], messageTextWrap, broadcastId: '' };
3990
3989
  if (!useColor) {
3991
3990
  options.useColor = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/file-manager",
3
- "version": "0.10.14",
3
+ "version": "0.10.16",
4
4
  "description": "FileManager constructor for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -20,18 +20,18 @@
20
20
  "license": "MIT",
21
21
  "homepage": "https://github.com/anpham6/e-mc#readme",
22
22
  "dependencies": {
23
- "@e-mc/cloud": "0.10.14",
24
- "@e-mc/compress": "0.10.14",
25
- "@e-mc/core": "0.10.14",
26
- "@e-mc/document": "0.10.14",
27
- "@e-mc/image": "0.10.14",
28
- "@e-mc/request": "0.10.14",
29
- "@e-mc/task": "0.10.14",
30
- "@e-mc/types": "0.10.14",
31
- "@e-mc/watch": "0.10.14",
23
+ "@e-mc/cloud": "0.10.16",
24
+ "@e-mc/compress": "0.10.16",
25
+ "@e-mc/core": "0.10.16",
26
+ "@e-mc/document": "0.10.16",
27
+ "@e-mc/image": "0.10.16",
28
+ "@e-mc/request": "0.10.16",
29
+ "@e-mc/task": "0.10.16",
30
+ "@e-mc/types": "0.10.16",
31
+ "@e-mc/watch": "0.10.16",
32
32
  "chalk": "4.1.2",
33
33
  "diff": "^5.2.0",
34
- "picomatch": "^4.0.2",
34
+ "picomatch": "^4.0.3",
35
35
  "strip-ansi": "6.0.1"
36
36
  }
37
37
  }