@e-mc/file-manager 0.9.22 → 0.9.24

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 +9 -10
  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.9.22/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.9.24/lib/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { DataSource, IncrementalMatch, TaskAction } from "./squared";
@@ -286,15 +286,15 @@ NOTE: **FileManager** is a sub-class of [Host](https://www.npmjs.com/package/@e-
286
286
 
287
287
  ## References
288
288
 
289
- - https://www.unpkg.com/@e-mc/types@0.9.22/lib/squared.d.ts
290
- - https://www.unpkg.com/@e-mc/types@0.9.22/lib/asset.d.ts
291
- - https://www.unpkg.com/@e-mc/types@0.9.22/lib/core.d.ts
292
- - https://www.unpkg.com/@e-mc/types@0.9.22/lib/filemanager.d.ts
293
- - https://www.unpkg.com/@e-mc/types@0.9.22/lib/logger.d.ts
294
- - https://www.unpkg.com/@e-mc/types@0.9.22/lib/module.d.ts
295
- - https://www.unpkg.com/@e-mc/types@0.9.22/lib/node.d.ts
296
- - https://www.unpkg.com/@e-mc/types@0.9.22/lib/request.d.ts
297
- - https://www.unpkg.com/@e-mc/types@0.9.22/lib/settings.d.ts
289
+ - https://www.unpkg.com/@e-mc/types@0.9.24/lib/squared.d.ts
290
+ - https://www.unpkg.com/@e-mc/types@0.9.24/lib/asset.d.ts
291
+ - https://www.unpkg.com/@e-mc/types@0.9.24/lib/core.d.ts
292
+ - https://www.unpkg.com/@e-mc/types@0.9.24/lib/filemanager.d.ts
293
+ - https://www.unpkg.com/@e-mc/types@0.9.24/lib/logger.d.ts
294
+ - https://www.unpkg.com/@e-mc/types@0.9.24/lib/module.d.ts
295
+ - https://www.unpkg.com/@e-mc/types@0.9.24/lib/node.d.ts
296
+ - https://www.unpkg.com/@e-mc/types@0.9.24/lib/request.d.ts
297
+ - https://www.unpkg.com/@e-mc/types@0.9.24/lib/settings.d.ts
298
298
 
299
299
  * https://www.npmjs.com/package/@types/node
300
300
 
package/index.js CHANGED
@@ -153,9 +153,10 @@ function recurseDir(output, subDirs, options) {
153
153
  for (const item of items) {
154
154
  if (!item.isDirectory()) {
155
155
  const pathname = path.join(baseDir, item.name);
156
- if (!ignore.includes(pathname) && !(item.isSymbolicLink() && core_1.Host.isDir(pathname))) {
157
- output.push(pathname);
156
+ if (item.isSymbolicLink() && core_1.Host.isDir(pathname) || ignore.length > 0 && (PLATFORM_WIN32 ? ignore.includes(pathname.toLowerCase()) : ignore.includes(pathname))) {
157
+ continue;
158
158
  }
159
+ output.push(pathname);
159
160
  }
160
161
  else if (recursive) {
161
162
  recurseDir(output, subDirs.concat(item.name), options);
@@ -320,6 +321,7 @@ function collectErrors() {
320
321
  function rejectModule(err, type, hint) {
321
322
  this.writeFail(["Handled rejection", this.moduleName + (hint ? ': ' + hint : '')], err, type);
322
323
  }
324
+ const mapLower = (values) => PLATFORM_WIN32 ? values.map(value => value.toLowerCase()) : values;
323
325
  const padStart = (value, char) => value > 9 ? value.toString() : char + value;
324
326
  const checksumFile = (algorithm) => "checksum" + '.' + ((0, types_1.isString)(algorithm) ? algorithm.toLowerCase() : "sha256");
325
327
  const checksumError = (algorithm) => new Error("Invalid parameters" + ` (${algorithm || "sha256"})`);
@@ -754,7 +756,7 @@ class FileManager extends core_1.Host {
754
756
  const filename = path.basename(to);
755
757
  const output = [];
756
758
  to = joinRoot ? path.join(root, to) : path.resolve(to);
757
- recurseDir(result, [root], { ignore: [...ignore, to], sortBy, recursive });
759
+ recurseDir(result, [root], { ignore: mapLower([...ignore, to]), sortBy, recursive });
758
760
  result = filterPaths(root, result, include, exclude, options.dot);
759
761
  for (const pathname of result) {
760
762
  if (recursive === 1 && path.basename(pathname) === filename) {
@@ -819,7 +821,7 @@ class FileManager extends core_1.Host {
819
821
  const filename = path.basename(from);
820
822
  const files = [];
821
823
  from = joinRoot ? path.join(root, filename) : path.resolve(from);
822
- recurseDir(files, [root], { ignore: [...ignore, from], sortBy, recursive });
824
+ recurseDir(files, [root], { ignore: mapLower([...ignore, from]), sortBy, recursive });
823
825
  const items = fs.readFileSync(from, 'utf-8').split('\n').map(item => {
824
826
  const index = item.indexOf(' ');
825
827
  return [item.substring(0, index), path.join(root, item.substring(index + 1))];
@@ -1577,12 +1579,9 @@ class FileManager extends core_1.Host {
1577
1579
  }
1578
1580
  removeCwd(value) {
1579
1581
  if (typeof value === 'string') {
1580
- let baseDir = this.baseDirectory + path.sep, leading = value.substring(0, baseDir.length);
1581
- if (PLATFORM_WIN32) {
1582
- baseDir = baseDir.toLowerCase();
1583
- leading = leading.toLowerCase();
1584
- }
1585
- if (leading === baseDir) {
1582
+ const baseDir = this.baseDirectory + path.sep;
1583
+ const leading = value.substring(0, baseDir.length);
1584
+ if (leading === baseDir || PLATFORM_WIN32 && leading.toLowerCase() === baseDir.toLowerCase()) {
1586
1585
  return value.substring(baseDir.length);
1587
1586
  }
1588
1587
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/file-manager",
3
- "version": "0.9.22",
3
+ "version": "0.9.24",
4
4
  "description": "FileManager constructor for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -20,16 +20,16 @@
20
20
  "license": "MIT",
21
21
  "homepage": "https://github.com/anpham6/e-mc#readme",
22
22
  "dependencies": {
23
- "@e-mc/cloud": "0.9.22",
24
- "@e-mc/compress": "0.9.22",
25
- "@e-mc/core": "0.9.22",
26
- "@e-mc/document": "0.9.22",
27
- "@e-mc/image": "0.9.22",
28
- "@e-mc/request": "0.9.22",
29
- "@e-mc/task": "0.9.22",
30
- "@e-mc/types": "0.9.22",
31
- "@e-mc/watch": "0.9.22",
23
+ "@e-mc/cloud": "0.9.24",
24
+ "@e-mc/compress": "0.9.24",
25
+ "@e-mc/core": "0.9.24",
26
+ "@e-mc/document": "0.9.24",
27
+ "@e-mc/image": "0.9.24",
28
+ "@e-mc/request": "0.9.24",
29
+ "@e-mc/task": "0.9.24",
30
+ "@e-mc/types": "0.9.24",
31
+ "@e-mc/watch": "0.9.24",
32
32
  "chalk": "4.1.2",
33
- "picomatch": "^4.0.2"
33
+ "picomatch": "^4.0.3"
34
34
  }
35
35
  }