@atlaspack/cache 2.12.1-dev.3450 → 2.12.1-dev.3466

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.
package/lib/FSCache.js CHANGED
@@ -32,9 +32,9 @@ function _logger() {
32
32
  };
33
33
  return data;
34
34
  }
35
- function _core() {
36
- const data = require("@atlaspack/core");
37
- _core = function () {
35
+ function _buildCache() {
36
+ const data = require("@atlaspack/build-cache");
37
+ _buildCache = function () {
38
38
  return data;
39
39
  };
40
40
  return data;
@@ -146,7 +146,7 @@ class FSCache {
146
146
  async get(key) {
147
147
  try {
148
148
  let data = await this.fs.readFile(this._getCachePath(key));
149
- return (0, _core().deserialize)(data);
149
+ return (0, _buildCache().deserialize)(data);
150
150
  } catch (err) {
151
151
  if (err.code === 'ENOENT') {
152
152
  return null;
@@ -158,7 +158,7 @@ class FSCache {
158
158
  async set(key, value) {
159
159
  try {
160
160
  let blobPath = this._getCachePath(key);
161
- let data = (0, _core().serialize)(value);
161
+ let data = (0, _buildCache().serialize)(value);
162
162
  await this.fs.writeFile(blobPath, data);
163
163
  } catch (err) {
164
164
  _logger().default.error(err, '@atlaspack/cache');
@@ -169,4 +169,4 @@ class FSCache {
169
169
  }
170
170
  }
171
171
  exports.FSCache = FSCache;
172
- (0, _core().registerSerializableClass)(`${_package.default.version}:FSCache`, FSCache);
172
+ (0, _buildCache().registerSerializableClass)(`${_package.default.version}:FSCache`, FSCache);
@@ -11,9 +11,9 @@ function _stream() {
11
11
  };
12
12
  return data;
13
13
  }
14
- function _core() {
15
- const data = require("@atlaspack/core");
16
- _core = function () {
14
+ function _buildCache() {
15
+ const data = require("@atlaspack/build-cache");
16
+ _buildCache = function () {
17
17
  return data;
18
18
  };
19
19
  return data;
@@ -25,7 +25,6 @@ function _utils() {
25
25
  };
26
26
  return data;
27
27
  }
28
- var _package = _interopRequireDefault(require("../package.json"));
29
28
  function _idb() {
30
29
  const data = require("idb");
31
30
  _idb = function () {
@@ -33,6 +32,7 @@ function _idb() {
33
32
  };
34
33
  return data;
35
34
  }
35
+ var _package = _interopRequireDefault(require("../package.json"));
36
36
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
37
  // $FlowFixMe[untyped-import]
38
38
  // $FlowFixMe[untyped-import]
@@ -69,10 +69,10 @@ class IDBCache {
69
69
  if (data == null) {
70
70
  return null;
71
71
  }
72
- return Promise.resolve((0, _core().deserialize)(data));
72
+ return Promise.resolve((0, _buildCache().deserialize)(data));
73
73
  }
74
74
  async set(key, value) {
75
- await (await this.store).put(STORE_NAME, (0, _core().serialize)(value), key);
75
+ await (await this.store).put(STORE_NAME, (0, _buildCache().serialize)(value), key);
76
76
  }
77
77
  getStream(key) {
78
78
  let dataPromise = this.store.then(s => s.get(STORE_NAME, key)).then(d => Buffer.from(d)).catch(e => e);
@@ -145,4 +145,4 @@ class IDBCache {
145
145
  }
146
146
  }
147
147
  exports.IDBCache = IDBCache;
148
- (0, _core().registerSerializableClass)(`${_package.default.version}:IDBCache`, IDBCache);
148
+ (0, _buildCache().registerSerializableClass)(`${_package.default.version}:IDBCache`, IDBCache);
package/lib/LMDBCache.js CHANGED
@@ -25,21 +25,20 @@ function _util() {
25
25
  };
26
26
  return data;
27
27
  }
28
- function _core() {
29
- const data = require("@atlaspack/core");
30
- _core = function () {
28
+ function _fs() {
29
+ const data = require("@atlaspack/fs");
30
+ _fs = function () {
31
31
  return data;
32
32
  };
33
33
  return data;
34
34
  }
35
- function _fs() {
36
- const data = require("@atlaspack/fs");
37
- _fs = function () {
35
+ function _buildCache() {
36
+ const data = require("@atlaspack/build-cache");
37
+ _buildCache = function () {
38
38
  return data;
39
39
  };
40
40
  return data;
41
41
  }
42
- var _package = _interopRequireDefault(require("../package.json"));
43
42
  function _lmdb() {
44
43
  const data = _interopRequireDefault(require("lmdb"));
45
44
  _lmdb = function () {
@@ -47,6 +46,7 @@ function _lmdb() {
47
46
  };
48
47
  return data;
49
48
  }
49
+ var _package = _interopRequireDefault(require("../package.json"));
50
50
  var _FSCache = require("./FSCache");
51
51
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
52
52
  // flowlint-next-line untyped-import:off
@@ -84,10 +84,10 @@ class LMDBCache {
84
84
  if (data == null) {
85
85
  return Promise.resolve(null);
86
86
  }
87
- return Promise.resolve((0, _core().deserialize)(data));
87
+ return Promise.resolve((0, _buildCache().deserialize)(data));
88
88
  }
89
89
  async set(key, value) {
90
- await this.setBlob(key, (0, _core().serialize)(value));
90
+ await this.setBlob(key, (0, _buildCache().serialize)(value));
91
91
  }
92
92
  getStream(key) {
93
93
  return this.fs.createReadStream(_path().default.join(this.dir, key));
@@ -133,4 +133,4 @@ class LMDBCache {
133
133
  }
134
134
  }
135
135
  exports.LMDBCache = LMDBCache;
136
- (0, _core().registerSerializableClass)(`${_package.default.version}:LMDBCache`, LMDBCache);
136
+ (0, _buildCache().registerSerializableClass)(`${_package.default.version}:LMDBCache`, LMDBCache);
@@ -5,6 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.LmdbWrapper = exports.LMDBLiteCache = void 0;
7
7
  exports.open = open;
8
+ function _buildCache() {
9
+ const data = require("@atlaspack/build-cache");
10
+ _buildCache = function () {
11
+ return data;
12
+ };
13
+ return data;
14
+ }
8
15
  function _rust() {
9
16
  const data = require("@atlaspack/rust");
10
17
  _rust = function () {
@@ -33,13 +40,6 @@ function _util() {
33
40
  };
34
41
  return data;
35
42
  }
36
- function _core() {
37
- const data = require("@atlaspack/core");
38
- _core = function () {
39
- return data;
40
- };
41
- return data;
42
- }
43
43
  function _fs() {
44
44
  const data = require("@atlaspack/fs");
45
45
  _fs = function () {
@@ -112,10 +112,10 @@ class LMDBLiteCache {
112
112
  if (data == null) {
113
113
  return Promise.resolve(null);
114
114
  }
115
- return Promise.resolve((0, _core().deserialize)(data));
115
+ return Promise.resolve((0, _buildCache().deserialize)(data));
116
116
  }
117
117
  async set(key, value) {
118
- await this.setBlob(key, (0, _core().serialize)(value));
118
+ await this.setBlob(key, (0, _buildCache().serialize)(value));
119
119
  }
120
120
  getStream(key) {
121
121
  return this.fs.createReadStream(_path().default.join(this.dir, key));
@@ -171,4 +171,4 @@ class LMDBLiteCache {
171
171
  }
172
172
  }
173
173
  exports.LMDBLiteCache = LMDBLiteCache;
174
- (0, _core().registerSerializableClass)(`${_package.default.version}:LMDBLiteCache`, LMDBLiteCache);
174
+ (0, _buildCache().registerSerializableClass)(`${_package.default.version}:LMDBLiteCache`, LMDBLiteCache);
package/lib/index.js CHANGED
@@ -3,47 +3,47 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- var _LMDBCache = require("./LMDBCache");
7
- Object.keys(_LMDBCache).forEach(function (key) {
6
+ var _FSCache = require("./FSCache");
7
+ Object.keys(_FSCache).forEach(function (key) {
8
8
  if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _LMDBCache[key]) return;
9
+ if (key in exports && exports[key] === _FSCache[key]) return;
10
10
  Object.defineProperty(exports, key, {
11
11
  enumerable: true,
12
12
  get: function () {
13
- return _LMDBCache[key];
13
+ return _FSCache[key];
14
14
  }
15
15
  });
16
16
  });
17
- var _LMDBLiteCache = require("./LMDBLiteCache");
18
- Object.keys(_LMDBLiteCache).forEach(function (key) {
17
+ var _IDBCache = require("./IDBCache");
18
+ Object.keys(_IDBCache).forEach(function (key) {
19
19
  if (key === "default" || key === "__esModule") return;
20
- if (key in exports && exports[key] === _LMDBLiteCache[key]) return;
20
+ if (key in exports && exports[key] === _IDBCache[key]) return;
21
21
  Object.defineProperty(exports, key, {
22
22
  enumerable: true,
23
23
  get: function () {
24
- return _LMDBLiteCache[key];
24
+ return _IDBCache[key];
25
25
  }
26
26
  });
27
27
  });
28
- var _FSCache = require("./FSCache");
29
- Object.keys(_FSCache).forEach(function (key) {
28
+ var _LMDBCache = require("./LMDBCache");
29
+ Object.keys(_LMDBCache).forEach(function (key) {
30
30
  if (key === "default" || key === "__esModule") return;
31
- if (key in exports && exports[key] === _FSCache[key]) return;
31
+ if (key in exports && exports[key] === _LMDBCache[key]) return;
32
32
  Object.defineProperty(exports, key, {
33
33
  enumerable: true,
34
34
  get: function () {
35
- return _FSCache[key];
35
+ return _LMDBCache[key];
36
36
  }
37
37
  });
38
38
  });
39
- var _IDBCache = require("./IDBCache");
40
- Object.keys(_IDBCache).forEach(function (key) {
39
+ var _LMDBLiteCache = require("./LMDBLiteCache");
40
+ Object.keys(_LMDBLiteCache).forEach(function (key) {
41
41
  if (key === "default" || key === "__esModule") return;
42
- if (key in exports && exports[key] === _IDBCache[key]) return;
42
+ if (key in exports && exports[key] === _LMDBLiteCache[key]) return;
43
43
  Object.defineProperty(exports, key, {
44
44
  enumerable: true,
45
45
  get: function () {
46
- return _IDBCache[key];
46
+ return _LMDBLiteCache[key];
47
47
  }
48
48
  });
49
49
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@atlaspack/cache",
3
3
  "description": "Interface for defining caches and file-system, IDB and LMDB implementations.",
4
- "version": "2.12.1-dev.3450+58845ef87",
4
+ "version": "2.12.1-dev.3466+9a12fb8bd",
5
5
  "license": "(MIT OR Apache-2.0)",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -22,14 +22,14 @@
22
22
  "check-ts": "tsc --noEmit index.d.ts"
23
23
  },
24
24
  "dependencies": {
25
- "@atlaspack/fs": "2.12.1-dev.3450+58845ef87",
26
- "@atlaspack/logger": "2.12.1-dev.3450+58845ef87",
27
- "@atlaspack/rust": "2.12.1-dev.3450+58845ef87",
28
- "@atlaspack/utils": "2.12.1-dev.3450+58845ef87",
25
+ "@atlaspack/fs": "2.12.1-dev.3466+9a12fb8bd",
26
+ "@atlaspack/logger": "2.12.1-dev.3466+9a12fb8bd",
27
+ "@atlaspack/rust": "2.12.1-dev.3466+9a12fb8bd",
28
+ "@atlaspack/utils": "2.12.1-dev.3466+9a12fb8bd",
29
29
  "lmdb": "2.8.5"
30
30
  },
31
31
  "peerDependencies": {
32
- "@atlaspack/core": "^2.12.1-dev.3450+58845ef87"
32
+ "@atlaspack/build-cache": "^2.12.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "idb": "^5.0.8"
@@ -38,5 +38,5 @@
38
38
  "./src/IDBCache.js": "./src/IDBCache.browser.js",
39
39
  "./src/LMDBCache.js": false
40
40
  },
41
- "gitHead": "58845ef87446fcedb7d7d8876440c64184645cbb"
41
+ "gitHead": "9a12fb8bd1b72e407ed043e20337dc60fbec9cbe"
42
42
  }
package/src/FSCache.js CHANGED
@@ -8,14 +8,17 @@ import type {Cache} from './types';
8
8
  import stream from 'stream';
9
9
  import path from 'path';
10
10
  import {promisify} from 'util';
11
+
11
12
  import logger from '@atlaspack/logger';
12
13
  import {
13
- serialize,
14
14
  deserialize,
15
15
  registerSerializableClass,
16
- } from '@atlaspack/core';
16
+ serialize,
17
+ } from '@atlaspack/build-cache';
18
+
17
19
  // flowlint-next-line untyped-import:off
18
20
  import packageJson from '../package.json';
21
+
19
22
  import {WRITE_LIMIT_CHUNK} from './constants';
20
23
 
21
24
  const pipeline: (Readable, Writable) => Promise<void> = promisify(
@@ -2,17 +2,19 @@
2
2
  import type {Cache} from './types';
3
3
 
4
4
  import {Readable} from 'stream';
5
+
5
6
  import {
6
- serialize,
7
7
  deserialize,
8
8
  registerSerializableClass,
9
- } from '@atlaspack/core';
9
+ serialize,
10
+ } from '@atlaspack/build-cache';
10
11
  import {bufferStream} from '@atlaspack/utils';
11
12
  // $FlowFixMe[untyped-import]
12
- import packageJson from '../package.json';
13
- // $FlowFixMe[untyped-import]
14
13
  import {openDB} from 'idb';
15
14
 
15
+ // $FlowFixMe[untyped-import]
16
+ import packageJson from '../package.json';
17
+
16
18
  const STORE_NAME = 'cache';
17
19
 
18
20
  export class IDBCache implements Cache {
@@ -63,9 +65,9 @@ export class IDBCache implements Cache {
63
65
 
64
66
  getStream(key: string): Readable {
65
67
  let dataPromise = this.store
66
- .then(s => s.get(STORE_NAME, key))
67
- .then(d => Buffer.from(d))
68
- .catch(e => e);
68
+ .then((s) => s.get(STORE_NAME, key))
69
+ .then((d) => Buffer.from(d))
70
+ .catch((e) => e);
69
71
  const stream = new Readable({
70
72
  // $FlowFixMe(incompatible-call)
71
73
  async read() {
package/src/LMDBCache.js CHANGED
@@ -6,17 +6,19 @@ import type {Readable, Writable} from 'stream';
6
6
  import stream from 'stream';
7
7
  import path from 'path';
8
8
  import {promisify} from 'util';
9
+
10
+ import {NodeFS} from '@atlaspack/fs';
9
11
  import {
10
- serialize,
11
12
  deserialize,
12
13
  registerSerializableClass,
13
- } from '@atlaspack/core';
14
- import {NodeFS} from '@atlaspack/fs';
14
+ serialize,
15
+ } from '@atlaspack/build-cache';
15
16
  // flowlint-next-line untyped-import:off
16
- import packageJson from '../package.json';
17
- // $FlowFixMe
18
17
  import lmdb from 'lmdb';
19
18
 
19
+ // $FlowFixMe
20
+ import packageJson from '../package.json';
21
+
20
22
  import {FSCache} from './FSCache';
21
23
 
22
24
  const pipeline: (Readable, Writable) => Promise<void> = promisify(
@@ -1,5 +1,10 @@
1
1
  // @flow strict-local
2
2
 
3
+ import {
4
+ deserialize,
5
+ registerSerializableClass,
6
+ serialize,
7
+ } from '@atlaspack/build-cache';
3
8
  import {Lmdb} from '@atlaspack/rust';
4
9
  import type {FilePath} from '@atlaspack/types';
5
10
  import type {Cache} from './types';
@@ -8,12 +13,9 @@ import type {Readable, Writable} from 'stream';
8
13
  import stream from 'stream';
9
14
  import path from 'path';
10
15
  import {promisify} from 'util';
11
- import {
12
- serialize,
13
- deserialize,
14
- registerSerializableClass,
15
- } from '@atlaspack/core';
16
+
16
17
  import {NodeFS} from '@atlaspack/fs';
18
+
17
19
  // $FlowFixMe
18
20
  import packageJson from '../package.json';
19
21
 
package/src/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  // @flow
2
- export type {Cache} from './types';
3
- export * from './LMDBCache';
4
- export * from './LMDBLiteCache';
2
+
5
3
  export * from './FSCache';
6
4
  export * from './IDBCache';
5
+ export * from './LMDBCache';
6
+ export * from './LMDBLiteCache';
7
+
8
+ export type {Cache} from './types';