@e-mc/file-manager 0.11.5 → 0.11.8

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 +10 -10
  3. 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.5/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.11.8/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.5/lib/squared.d.ts
310
- - https://www.unpkg.com/@e-mc/types@0.11.5/lib/asset.d.ts
311
- - https://www.unpkg.com/@e-mc/types@0.11.5/lib/core.d.ts
312
- - https://www.unpkg.com/@e-mc/types@0.11.5/lib/filemanager.d.ts
313
- - https://www.unpkg.com/@e-mc/types@0.11.5/lib/logger.d.ts
314
- - https://www.unpkg.com/@e-mc/types@0.11.5/lib/module.d.ts
315
- - https://www.unpkg.com/@e-mc/types@0.11.5/lib/node.d.ts
316
- - https://www.unpkg.com/@e-mc/types@0.11.5/lib/request.d.ts
317
- - https://www.unpkg.com/@e-mc/types@0.11.5/lib/settings.d.ts
309
+ - https://www.unpkg.com/@e-mc/types@0.11.8/lib/squared.d.ts
310
+ - https://www.unpkg.com/@e-mc/types@0.11.8/lib/asset.d.ts
311
+ - https://www.unpkg.com/@e-mc/types@0.11.8/lib/core.d.ts
312
+ - https://www.unpkg.com/@e-mc/types@0.11.8/lib/filemanager.d.ts
313
+ - https://www.unpkg.com/@e-mc/types@0.11.8/lib/logger.d.ts
314
+ - https://www.unpkg.com/@e-mc/types@0.11.8/lib/module.d.ts
315
+ - https://www.unpkg.com/@e-mc/types@0.11.8/lib/node.d.ts
316
+ - https://www.unpkg.com/@e-mc/types@0.11.8/lib/request.d.ts
317
+ - https://www.unpkg.com/@e-mc/types@0.11.8/lib/settings.d.ts
318
318
 
319
319
  * https://www.npmjs.com/package/@types/node
320
320
 
package/index.js CHANGED
@@ -216,15 +216,15 @@ function checkHash(host, localUri, output, options, data) {
216
216
  }
217
217
  return true;
218
218
  }
219
- function validatePaths(rootDir, values, patterns, include, dot) {
219
+ function validatePaths(rootDir, values, patterns, include, options) {
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
- 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];
226
+ value = core_1.Permission.toPosix(value);
227
+ return [pm(value, getPmOptions(value, options)), path.isAbsolute(value), invert];
228
228
  });
229
229
  return values.filter(value => {
230
230
  for (const [pattern, absolute, invert] of items) {
@@ -235,14 +235,14 @@ function validatePaths(rootDir, values, patterns, include, dot) {
235
235
  return !include;
236
236
  });
237
237
  }
238
- function filterPaths(rootDir, values, include, exclude, dot) {
238
+ function filterPaths(rootDir, values, include, exclude, options = {}) {
239
239
  rootDir = core_1.Host.normalizePath(rootDir, 2);
240
240
  if (include) {
241
241
  if ((0, types_1.isString)(include)) {
242
242
  include = [include];
243
243
  }
244
244
  if ((0, types_1.isArray)(include)) {
245
- values = validatePaths(rootDir, values, include, true, dot);
245
+ values = validatePaths(rootDir, values, include, true, options);
246
246
  }
247
247
  }
248
248
  if (exclude) {
@@ -250,7 +250,7 @@ function filterPaths(rootDir, values, include, exclude, dot) {
250
250
  exclude = [exclude];
251
251
  }
252
252
  if ((0, types_1.isArray)(exclude)) {
253
- return validatePaths(rootDir, values, exclude, false, dot);
253
+ return validatePaths(rootDir, values, exclude, false, options);
254
254
  }
255
255
  }
256
256
  return values;
@@ -552,7 +552,7 @@ async function doVerifyChecksum(root, from, options, nested) {
552
552
  const index = item.indexOf(' ');
553
553
  return [item.substring(0, index), path.join(root, item.substring(index + 1))];
554
554
  });
555
- const checked = include || exclude ? filterPaths(root, 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) : null;
556
556
  let valid = false;
557
557
  for (const [previous, pathname] of items) {
558
558
  if (checked !== null && !checked.includes(pathname) || recursive === 1 && path.basename(pathname) === filename) {
@@ -679,7 +679,7 @@ function setLogMinWidth() {
679
679
  }
680
680
  const closeResponse = (client) => client?.destroy();
681
681
  const isCacheable = (item) => item.initialValue?.cacheable !== false;
682
- const isMatchRoot = (value) => !value.startsWith('*') && value.includes('/');
682
+ const getPmOptions = (value, { matchBase = value.startsWith('*') && !value.includes('/'), dot = false } = {}) => ({ matchBase, nocase: core_1.Host.PLATFORM_WIN32, dot });
683
683
  const hasIncremental = (value) => value === "etag" || value === "exists";
684
684
  const matchPathname = (value) => core_1.Host.PLATFORM_WIN32 ? value.toLowerCase() : value;
685
685
  const equalAddress = (value, other) => value === other || decodeURIComponent(value) === decodeURIComponent(other);
@@ -1610,7 +1610,7 @@ class FileManager extends core_1.Host {
1610
1610
  to = joinRoot ? path.join(root, to) : path.resolve(to);
1611
1611
  recurseDir(result, [root], { ignore: [...ignore, to], sortBy, recursive });
1612
1612
  const output = [];
1613
- for (const pathname of result = filterPaths(root, result, include, exclude, options.dot)) {
1613
+ for (const pathname of result = filterPaths(root, result, include, exclude, options)) {
1614
1614
  if (recursive === 1 && path.basename(pathname) === filename) {
1615
1615
  continue;
1616
1616
  }
@@ -1788,7 +1788,7 @@ class FileManager extends core_1.Host {
1788
1788
  this.setTaskLimit(config.threads);
1789
1789
  }
1790
1790
  if ((0, types_1.isPlainObject)(config.log) && (0, types_1.isArray)(config.log.showDiff) && this.incremental !== "staging") {
1791
- this[kDiffSource] = [config.log.showDiff.map(value => (0, types_1.hasGlob)(value) ? (value = core_1.Permission.toPosix(value), pm(value, { matchBase: !isMatchRoot(value), nocase: core_1.Host.PLATFORM_WIN32 })) : value), {}];
1791
+ this[kDiffSource] = [config.log.showDiff.map(value => (0, types_1.hasGlob)(value) ? (value = core_1.Permission.toPosix(value), pm(value, getPmOptions(value))) : value), {}];
1792
1792
  }
1793
1793
  const request = new request_1();
1794
1794
  request.host = this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/file-manager",
3
- "version": "0.11.5",
3
+ "version": "0.11.8",
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.5",
24
- "@e-mc/compress": "0.11.5",
25
- "@e-mc/core": "0.11.5",
26
- "@e-mc/document": "0.11.5",
27
- "@e-mc/image": "0.11.5",
28
- "@e-mc/request": "0.11.5",
29
- "@e-mc/task": "0.11.5",
30
- "@e-mc/types": "0.11.5",
31
- "@e-mc/watch": "0.11.5",
23
+ "@e-mc/cloud": "0.11.8",
24
+ "@e-mc/compress": "0.11.8",
25
+ "@e-mc/core": "0.11.8",
26
+ "@e-mc/document": "0.11.8",
27
+ "@e-mc/image": "0.11.8",
28
+ "@e-mc/request": "0.11.8",
29
+ "@e-mc/task": "0.11.8",
30
+ "@e-mc/types": "0.11.8",
31
+ "@e-mc/watch": "0.11.8",
32
32
  "chalk": "4.1.2",
33
33
  "diff": "^7.0.0",
34
34
  "picomatch": "^4.0.2"