@e-mc/file-manager 0.14.1 → 0.14.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.
Files changed (3) hide show
  1. package/README.md +10 -10
  2. package/index.js +11 -13
  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.14.1/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.14.2/lib/index.d.ts)
13
13
 
14
14
  ```typescript
15
15
  import type { ChecksumValue, DataSource, IncrementalMatch, TaskAction } from "./squared";
@@ -297,15 +297,15 @@ NOTE: **FileManager** is a sub-class of [Host](https://www.npmjs.com/package/@e-
297
297
 
298
298
  ## References
299
299
 
300
- - https://www.unpkg.com/@e-mc/types@0.14.1/lib/squared.d.ts
301
- - https://www.unpkg.com/@e-mc/types@0.14.1/lib/asset.d.ts
302
- - https://www.unpkg.com/@e-mc/types@0.14.1/lib/core.d.ts
303
- - https://www.unpkg.com/@e-mc/types@0.14.1/lib/filemanager.d.ts
304
- - https://www.unpkg.com/@e-mc/types@0.14.1/lib/logger.d.ts
305
- - https://www.unpkg.com/@e-mc/types@0.14.1/lib/module.d.ts
306
- - https://www.unpkg.com/@e-mc/types@0.14.1/lib/node.d.ts
307
- - https://www.unpkg.com/@e-mc/types@0.14.1/lib/request.d.ts
308
- - https://www.unpkg.com/@e-mc/types@0.14.1/lib/settings.d.ts
300
+ - https://www.unpkg.com/@e-mc/types@0.14.2/lib/squared.d.ts
301
+ - https://www.unpkg.com/@e-mc/types@0.14.2/lib/asset.d.ts
302
+ - https://www.unpkg.com/@e-mc/types@0.14.2/lib/core.d.ts
303
+ - https://www.unpkg.com/@e-mc/types@0.14.2/lib/filemanager.d.ts
304
+ - https://www.unpkg.com/@e-mc/types@0.14.2/lib/logger.d.ts
305
+ - https://www.unpkg.com/@e-mc/types@0.14.2/lib/module.d.ts
306
+ - https://www.unpkg.com/@e-mc/types@0.14.2/lib/node.d.ts
307
+ - https://www.unpkg.com/@e-mc/types@0.14.2/lib/request.d.ts
308
+ - https://www.unpkg.com/@e-mc/types@0.14.2/lib/settings.d.ts
309
309
 
310
310
  * https://www.npmjs.com/package/@types/node
311
311
 
package/index.js CHANGED
@@ -153,12 +153,12 @@ 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 (item.isSymbolicLink() && Host.isDir(pathname) || ignore.length > 0 && !hasPath(ignore, pathname)) {
156
+ if (item.isSymbolicLink() && Host.isDir(pathname) || ignore.length > 0 && (Host.PLATFORM_WIN32 ? ignore.includes(pathname.toLowerCase()) : ignore.includes(pathname))) {
157
157
  continue;
158
158
  }
159
159
  output.push(pathname);
160
160
  }
161
- else if (recursive && (subDirs.length > 1 || !hasPath(ignoreRoot, item.name))) {
161
+ else if (recursive && (subDirs.length > 1 || (Host.PLATFORM_WIN32 ? !ignoreRoot.includes(item.name.toLowerCase()) : !ignoreRoot.includes(item.name)))) {
162
162
  recurseDir(output, subDirs.concat(item.name), options);
163
163
  }
164
164
  }
@@ -498,10 +498,10 @@ const downloadStats = () => [[0, 0], [0, 0], [0, 0]];
498
498
  const isCacheable = (item) => item.initialValue?.cacheable !== false;
499
499
  const getPmOptions = (value, { matchBase = value.startsWith('*') && !value.includes('/'), dot = false } = {}) => ({ nocase: Host.PLATFORM_WIN32, matchBase, dot });
500
500
  const isDownloadAll = (type) => type === 4 || type === 0;
501
+ const isNoContent = (statusCode) => statusCode === 204 || statusCode === 304;
501
502
  const isStored = (noCache, maxAge) => !noCache || typeof maxAge === 'number';
502
503
  const hasFiles = (type, uri) => type === 3 || type === 4 || type === 0 && Request.isRclone(uri);
503
504
  const hasIncremental = (value) => value === "etag" || value === "exists";
504
- const hasPath = (values, name) => Host.PLATFORM_WIN32 ? !values.includes(name.toLowerCase()) : !values.includes(name);
505
505
  const toPathCase = (value) => Host.PLATFORM_WIN32 ? value.toLowerCase() : value;
506
506
  const toPosix = (values) => Host.PLATFORM_WIN32 ? values.map(value => Permission.toPosix(value).toLowerCase()) : values;
507
507
  const formatPercent = (value) => Math.round(value).toString().padStart(3) + '%';
@@ -912,7 +912,7 @@ class ProcessFile {
912
912
  host.Request.open(url, { method: 'HEAD', httpVersion: 1, headers: file.headers })
913
913
  .on('response', res => {
914
914
  const statusCode = res.statusCode;
915
- if (statusCode === 204 || statusCode === 304) {
915
+ if (isNoContent(statusCode)) {
916
916
  file.contentLength = 0;
917
917
  }
918
918
  else if (statusCode < 300) {
@@ -1148,12 +1148,7 @@ class ProcessFile {
1148
1148
  const downloaded = groupData.bundling[uri];
1149
1149
  if (isArray(downloaded)) {
1150
1150
  if (data && !queue.invalid) {
1151
- if (typeof data === 'string') {
1152
- queue.sourceUTF8 = data;
1153
- }
1154
- else {
1155
- queue.buffer = data;
1156
- }
1151
+ setContent(queue, data);
1157
1152
  this.copyDownload(queue, downloaded);
1158
1153
  }
1159
1154
  else {
@@ -3572,10 +3567,13 @@ class FileManager extends Host {
3572
3567
  .on('response', res => {
3573
3568
  --processTask.pending;
3574
3569
  const statusCode = res.statusCode;
3575
- if (statusCode < 300) {
3576
- const etag = processHeaders(res.headers, item, false, mainEtag);
3570
+ if (isNoContent(statusCode)) {
3571
+ downloadUri(opts, null);
3572
+ }
3573
+ else if (statusCode < 300) {
3574
+ const etag = processHeaders(res.headers, item, false, mainEtag && !opts.noStore);
3577
3575
  let etagDir = null, tempDir;
3578
- if (etag && !opts.noCache) {
3576
+ if (etag && !opts.noCache && !opts.noStore) {
3579
3577
  if (cacheDir || mainEtag) {
3580
3578
  tempDir = this.getCacheDir(href);
3581
3579
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/file-manager",
3
- "version": "0.14.1",
3
+ "version": "0.14.2",
4
4
  "description": "FileManager constructor for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -16,15 +16,15 @@
16
16
  "license": "BSD-3-Clause",
17
17
  "homepage": "https://github.com/anpham6/e-mc#readme",
18
18
  "dependencies": {
19
- "@e-mc/cloud": "0.14.1",
20
- "@e-mc/compress": "0.14.1",
21
- "@e-mc/core": "0.14.1",
22
- "@e-mc/document": "0.14.1",
23
- "@e-mc/image": "0.14.1",
24
- "@e-mc/request": "0.14.1",
25
- "@e-mc/task": "0.14.1",
26
- "@e-mc/types": "0.14.1",
27
- "@e-mc/watch": "0.14.1",
19
+ "@e-mc/cloud": "0.14.2",
20
+ "@e-mc/compress": "0.14.2",
21
+ "@e-mc/core": "0.14.2",
22
+ "@e-mc/document": "0.14.2",
23
+ "@e-mc/image": "0.14.2",
24
+ "@e-mc/request": "0.14.2",
25
+ "@e-mc/task": "0.14.2",
26
+ "@e-mc/types": "0.14.2",
27
+ "@e-mc/watch": "0.14.2",
28
28
  "chalk": "4.1.2",
29
29
  "diff": "^9.0.0",
30
30
  "picomatch": "^4.0.4"