@e-mc/file-manager 0.11.10 → 0.11.12

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.11.10/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.11.12/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.10/lib/squared.d.ts
310
- - https://www.unpkg.com/@e-mc/types@0.11.10/lib/asset.d.ts
311
- - https://www.unpkg.com/@e-mc/types@0.11.10/lib/core.d.ts
312
- - https://www.unpkg.com/@e-mc/types@0.11.10/lib/filemanager.d.ts
313
- - https://www.unpkg.com/@e-mc/types@0.11.10/lib/logger.d.ts
314
- - https://www.unpkg.com/@e-mc/types@0.11.10/lib/module.d.ts
315
- - https://www.unpkg.com/@e-mc/types@0.11.10/lib/node.d.ts
316
- - https://www.unpkg.com/@e-mc/types@0.11.10/lib/request.d.ts
317
- - https://www.unpkg.com/@e-mc/types@0.11.10/lib/settings.d.ts
309
+ - https://www.unpkg.com/@e-mc/types@0.11.12/lib/squared.d.ts
310
+ - https://www.unpkg.com/@e-mc/types@0.11.12/lib/asset.d.ts
311
+ - https://www.unpkg.com/@e-mc/types@0.11.12/lib/core.d.ts
312
+ - https://www.unpkg.com/@e-mc/types@0.11.12/lib/filemanager.d.ts
313
+ - https://www.unpkg.com/@e-mc/types@0.11.12/lib/logger.d.ts
314
+ - https://www.unpkg.com/@e-mc/types@0.11.12/lib/module.d.ts
315
+ - https://www.unpkg.com/@e-mc/types@0.11.12/lib/node.d.ts
316
+ - https://www.unpkg.com/@e-mc/types@0.11.12/lib/request.d.ts
317
+ - https://www.unpkg.com/@e-mc/types@0.11.12/lib/settings.d.ts
318
318
 
319
319
  * https://www.npmjs.com/package/@types/node
320
320
 
package/index.js CHANGED
@@ -175,9 +175,10 @@ 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) && !(item.isSymbolicLink() && core_1.Host.isDir(pathname))) {
179
- output.push(pathname);
178
+ if (item.isSymbolicLink() && core_1.Host.isDir(pathname) || ignore.length > 0 && (core_1.Host.PLATFORM_WIN32 ? ignore.includes(pathname.toLowerCase()) : ignore.includes(pathname))) {
179
+ continue;
180
180
  }
181
+ output.push(pathname);
181
182
  }
182
183
  else if (recursive) {
183
184
  recurseDir(output, subDirs.concat(item.name), options);
@@ -547,7 +548,7 @@ async function doVerifyChecksum(root, from, options, nested) {
547
548
  const filename = path.basename(from);
548
549
  const files = [];
549
550
  from = joinRoot ? path.join(root, filename) : path.resolve(from);
550
- recurseDir(files, [root], { ignore: [...ignore, from], sortBy, recursive });
551
+ recurseDir(files, [root], { ignore: mapLower([...ignore, from]), sortBy, recursive });
551
552
  const items = fs.readFileSync(from, 'utf-8').split('\n').map(item => {
552
553
  const index = item.indexOf(' ');
553
554
  return [item.substring(0, index), path.join(root, item.substring(index + 1))];
@@ -682,6 +683,7 @@ const isCacheable = (item) => item.initialValue?.cacheable !== false;
682
683
  const getPmOptions = (value, { matchBase = value.startsWith('*') && !value.includes('/'), dot = false } = {}) => ({ matchBase, nocase: core_1.Host.PLATFORM_WIN32, dot });
683
684
  const hasIncremental = (value) => value === "etag" || value === "exists";
684
685
  const matchPathname = (value) => core_1.Host.PLATFORM_WIN32 ? value.toLowerCase() : value;
686
+ const mapLower = (values) => core_1.Host.PLATFORM_WIN32 ? values.map(value => value.toLowerCase()) : values;
685
687
  const equalAddress = (value, other) => value === other || decodeURIComponent(value) === decodeURIComponent(other);
686
688
  const formatPercent = (value) => Math.round(value).toString().padStart(3) + '%';
687
689
  const checkEOF = (value) => /\n$/.test(value) ? value : value + '\n';
@@ -1608,7 +1610,7 @@ class FileManager extends core_1.Host {
1608
1610
  try {
1609
1611
  const filename = path.basename(to);
1610
1612
  to = joinRoot ? path.join(root, to) : path.resolve(to);
1611
- recurseDir(result, [root], { ignore: [...ignore, to], sortBy, recursive });
1613
+ recurseDir(result, [root], { ignore: mapLower([...ignore, to]), sortBy, recursive });
1612
1614
  const output = [];
1613
1615
  for (const pathname of result = filterPaths(root, result, include, exclude, options)) {
1614
1616
  if (recursive === 1 && path.basename(pathname) === filename) {
@@ -2272,12 +2274,9 @@ class FileManager extends core_1.Host {
2272
2274
  }
2273
2275
  removeCwd(value) {
2274
2276
  if (typeof value === 'string') {
2275
- let baseDir = this.baseDirectory + path.sep, leading = value.substring(0, baseDir.length);
2276
- if (core_1.Host.PLATFORM_WIN32) {
2277
- baseDir = baseDir.toLowerCase();
2278
- leading = leading.toLowerCase();
2279
- }
2280
- if (leading === baseDir) {
2277
+ const baseDir = this.baseDirectory + path.sep;
2278
+ const leading = value.substring(0, baseDir.length);
2279
+ if (leading === baseDir || core_1.Host.PLATFORM_WIN32 && leading.toLowerCase() === baseDir.toLowerCase()) {
2281
2280
  return value.substring(baseDir.length);
2282
2281
  }
2283
2282
  }
@@ -3982,11 +3981,11 @@ class FileManager extends core_1.Host {
3982
3981
  if (cleared) {
3983
3982
  last = item;
3984
3983
  }
3984
+ else if (!redraw && scroll[i] === item) {
3985
+ PROCESS_STDOUT.moveCursor(0, 1);
3986
+ continue;
3987
+ }
3985
3988
  else {
3986
- if (!redraw && scroll[i] === item) {
3987
- PROCESS_STDOUT.moveCursor(0, 1);
3988
- continue;
3989
- }
3990
3989
  const options = { ...item[4], messageTextWrap, broadcastId: '' };
3991
3990
  if (!useColor) {
3992
3991
  options.useColor = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/file-manager",
3
- "version": "0.11.10",
3
+ "version": "0.11.12",
4
4
  "description": "FileManager constructor for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -20,17 +20,17 @@
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.10",
24
- "@e-mc/compress": "0.11.10",
25
- "@e-mc/core": "0.11.10",
26
- "@e-mc/document": "0.11.10",
27
- "@e-mc/image": "0.11.10",
28
- "@e-mc/request": "0.11.10",
29
- "@e-mc/task": "0.11.10",
30
- "@e-mc/types": "0.11.10",
31
- "@e-mc/watch": "0.11.10",
23
+ "@e-mc/cloud": "0.11.12",
24
+ "@e-mc/compress": "0.11.12",
25
+ "@e-mc/core": "0.11.12",
26
+ "@e-mc/document": "0.11.12",
27
+ "@e-mc/image": "0.11.12",
28
+ "@e-mc/request": "0.11.12",
29
+ "@e-mc/task": "0.11.12",
30
+ "@e-mc/types": "0.11.12",
31
+ "@e-mc/watch": "0.11.12",
32
32
  "chalk": "4.1.2",
33
33
  "diff": "^7.0.0",
34
- "picomatch": "^4.0.2"
34
+ "picomatch": "^4.0.3"
35
35
  }
36
36
  }