@e-mc/file-manager 0.9.1 → 0.9.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 +17 -17
  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.9.1/lib/index.d.ts)
12
+ * [View Source](https://www.unpkg.com/@e-mc/types@0.9.2/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.1/lib/squared.d.ts
290
- - https://www.unpkg.com/@e-mc/types@0.9.1/lib/asset.d.ts
291
- - https://www.unpkg.com/@e-mc/types@0.9.1/lib/core.d.ts
292
- - https://www.unpkg.com/@e-mc/types@0.9.1/lib/filemanager.d.ts
293
- - https://www.unpkg.com/@e-mc/types@0.9.1/lib/logger.d.ts
294
- - https://www.unpkg.com/@e-mc/types@0.9.1/lib/module.d.ts
295
- - https://www.unpkg.com/@e-mc/types@0.9.1/lib/node.d.ts
296
- - https://www.unpkg.com/@e-mc/types@0.9.1/lib/request.d.ts
297
- - https://www.unpkg.com/@e-mc/types@0.9.1/lib/settings.d.ts
289
+ - https://www.unpkg.com/@e-mc/types@0.9.2/lib/squared.d.ts
290
+ - https://www.unpkg.com/@e-mc/types@0.9.2/lib/asset.d.ts
291
+ - https://www.unpkg.com/@e-mc/types@0.9.2/lib/core.d.ts
292
+ - https://www.unpkg.com/@e-mc/types@0.9.2/lib/filemanager.d.ts
293
+ - https://www.unpkg.com/@e-mc/types@0.9.2/lib/logger.d.ts
294
+ - https://www.unpkg.com/@e-mc/types@0.9.2/lib/module.d.ts
295
+ - https://www.unpkg.com/@e-mc/types@0.9.2/lib/node.d.ts
296
+ - https://www.unpkg.com/@e-mc/types@0.9.2/lib/request.d.ts
297
+ - https://www.unpkg.com/@e-mc/types@0.9.2/lib/settings.d.ts
298
298
 
299
299
  * https://www.npmjs.com/package/@types/node
300
300
 
package/index.js CHANGED
@@ -2905,8 +2905,8 @@ class FileManager extends core_1.Host {
2905
2905
  data[attr] = undefined;
2906
2906
  }
2907
2907
  };
2908
- const errorRequest = (file, err, preceding) => {
2909
- const { uri, localUri } = file;
2908
+ const errorRequest = (file, localUri, err, preceding) => {
2909
+ const uri = file.uri;
2910
2910
  clearQueue(processing, localUri);
2911
2911
  clearQueue(downloading, uri);
2912
2912
  clearQueue(appending, localUri);
@@ -3191,7 +3191,7 @@ class FileManager extends core_1.Host {
3191
3191
  downloading[uri] = [];
3192
3192
  }
3193
3193
  const url = item.url;
3194
- let cacheDir, cacheBuffer, mainEtag, encoding = item.encoding, client = null;
3194
+ let mainEtag = false, encoding = item.encoding, client = null, cacheDir, cacheBuffer;
3195
3195
  if (type === 1) {
3196
3196
  cacheDir = cacheToDisk.has(url) && isCacheable(item);
3197
3197
  cacheBuffer = cacheToMemory.has(url);
@@ -3239,7 +3239,7 @@ class FileManager extends core_1.Host {
3239
3239
  });
3240
3240
  }
3241
3241
  }, (err) => {
3242
- errorRequest(item, err);
3242
+ errorRequest(item, localUri, err);
3243
3243
  }, 1);
3244
3244
  };
3245
3245
  this.performAsyncTask();
@@ -3254,7 +3254,7 @@ class FileManager extends core_1.Host {
3254
3254
  const statusCode = res.statusCode;
3255
3255
  if (statusCode < 300) {
3256
3256
  const etag = applyHeaders(item, res.headers, false, mainEtag);
3257
- let tempDir, etagDir;
3257
+ let etagDir = '', tempDir;
3258
3258
  if (etag) {
3259
3259
  if (cacheDir || mainEtag) {
3260
3260
  tempDir = this.getCacheDir(href);
@@ -3371,44 +3371,44 @@ class FileManager extends core_1.Host {
3371
3371
  catch {
3372
3372
  }
3373
3373
  }
3374
- errorRequest(item, (0, types_1.errorMessage)(statusCode, 'Exceeded redirect limit', url.toString()));
3374
+ errorRequest(item, localUri, (0, types_1.errorMessage)(statusCode, 'Exceeded redirect limit', url.toString()));
3375
3375
  }
3376
3376
  else {
3377
- downloadUri(target);
3377
+ downloadUri(target, null);
3378
3378
  }
3379
3379
  })
3380
3380
  .on('error', err => {
3381
3381
  if (!client.destroyed) {
3382
3382
  if ((0, util_1.checkRetryable)(err)) {
3383
- downloadUri(target);
3383
+ downloadUri(target, null);
3384
3384
  }
3385
3385
  else {
3386
- errorRequest(item, err);
3386
+ errorRequest(item, localUri, err);
3387
3387
  }
3388
3388
  }
3389
3389
  })
3390
3390
  .on('timeout', () => {
3391
3391
  if (!client.destroyed) {
3392
- downloadUri(target);
3392
+ downloadUri(target, null);
3393
3393
  }
3394
3394
  });
3395
3395
  }
3396
3396
  catch {
3397
- downloadUri(request.opts(href));
3397
+ downloadUri(request.opts(href), null);
3398
3398
  }
3399
3399
  }).bind(this)(url);
3400
3400
  }
3401
3401
  else {
3402
- downloadUri(this.Request.opts(url));
3402
+ downloadUri(this.Request.opts(url), null);
3403
3403
  }
3404
3404
  }
3405
3405
  }
3406
3406
  }
3407
3407
  else if (type) {
3408
3408
  if (bundleMain && !item.mimeType) {
3409
- errorRequest(item, (0, types_1.errorValue)("MIME not found", uri), true);
3409
+ errorRequest(item, localUri, (0, types_1.errorValue)("MIME not found", uri), true);
3410
3410
  }
3411
- else if (!checkQueue(item, localUri, pathname, false)) {
3411
+ else if (!checkQueue(item, localUri, pathname)) {
3412
3412
  if (downloading[uri]) {
3413
3413
  downloading[uri].push(item);
3414
3414
  continue;
@@ -3417,7 +3417,7 @@ class FileManager extends core_1.Host {
3417
3417
  this.performAsyncTask();
3418
3418
  this.scheduleTask(item.url || uri, { pathname, binOpts: item.binOpts }, (result) => {
3419
3419
  if (result.length === 0) {
3420
- errorRequest(item, (0, types_1.errorValue)("No files were successfully downloaded", uri));
3420
+ errorRequest(item, localUri, (0, types_1.errorValue)("No files were successfully downloaded", uri));
3421
3421
  }
3422
3422
  else if (bundleMain) {
3423
3423
  const encoding = item.encoding || (item.encoding = 'utf-8');
@@ -3427,7 +3427,7 @@ class FileManager extends core_1.Host {
3427
3427
  processQueue(item, localUri);
3428
3428
  }
3429
3429
  else {
3430
- errorRequest(item, err);
3430
+ errorRequest(item, localUri, err);
3431
3431
  }
3432
3432
  });
3433
3433
  }
@@ -3464,7 +3464,7 @@ class FileManager extends core_1.Host {
3464
3464
  }
3465
3465
  }
3466
3466
  }, (err) => {
3467
- errorRequest(item, err);
3467
+ errorRequest(item, localUri, err);
3468
3468
  }, 4);
3469
3469
  }
3470
3470
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/file-manager",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
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.9.1",
24
- "@e-mc/compress": "0.9.1",
25
- "@e-mc/core": "0.9.1",
26
- "@e-mc/document": "0.9.1",
27
- "@e-mc/image": "0.9.1",
28
- "@e-mc/request": "0.9.1",
29
- "@e-mc/task": "0.9.1",
30
- "@e-mc/types": "0.9.1",
31
- "@e-mc/watch": "0.9.1",
23
+ "@e-mc/cloud": "0.9.2",
24
+ "@e-mc/compress": "0.9.2",
25
+ "@e-mc/core": "0.9.2",
26
+ "@e-mc/document": "0.9.2",
27
+ "@e-mc/image": "0.9.2",
28
+ "@e-mc/request": "0.9.2",
29
+ "@e-mc/task": "0.9.2",
30
+ "@e-mc/types": "0.9.2",
31
+ "@e-mc/watch": "0.9.2",
32
32
  "chalk": "4.1.2",
33
33
  "picomatch": "^4.0.2"
34
34
  }