@envelop/parser-cache 4.3.1 → 4.4.0-alpha-3936561.0
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/index.js +3 -9
- package/index.mjs +3 -7
- package/package.json +2 -5
package/index.js
CHANGED
|
@@ -2,18 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const core = require('@envelop/core');
|
|
7
6
|
const graphql = require('graphql');
|
|
8
|
-
const lru = _interopDefault(require('tiny-lru'));
|
|
9
7
|
|
|
10
|
-
const DEFAULT_MAX = 1000;
|
|
11
|
-
const DEFAULT_TTL = 3600000;
|
|
12
8
|
const useParserCache = (pluginOptions = {}) => {
|
|
13
|
-
const documentCache = typeof pluginOptions.documentCache !== 'undefined'
|
|
14
|
-
|
|
15
|
-
: lru(DEFAULT_MAX, DEFAULT_TTL);
|
|
16
|
-
const errorCache = typeof pluginOptions.errorCache !== 'undefined' ? pluginOptions.errorCache : lru(DEFAULT_MAX, DEFAULT_TTL);
|
|
9
|
+
const documentCache = typeof pluginOptions.documentCache !== 'undefined' ? pluginOptions.documentCache : core.getInMemoryLRUCache();
|
|
10
|
+
const errorCache = typeof pluginOptions.errorCache !== 'undefined' ? pluginOptions.errorCache : core.getInMemoryLRUCache();
|
|
17
11
|
return {
|
|
18
12
|
onParse({ params, setParsedDocument }) {
|
|
19
13
|
const { source } = params;
|
package/index.mjs
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
+
import { getInMemoryLRUCache } from '@envelop/core';
|
|
1
2
|
import { Source } from 'graphql';
|
|
2
|
-
import lru from 'tiny-lru';
|
|
3
3
|
|
|
4
|
-
const DEFAULT_MAX = 1000;
|
|
5
|
-
const DEFAULT_TTL = 3600000;
|
|
6
4
|
const useParserCache = (pluginOptions = {}) => {
|
|
7
|
-
const documentCache = typeof pluginOptions.documentCache !== 'undefined'
|
|
8
|
-
|
|
9
|
-
: lru(DEFAULT_MAX, DEFAULT_TTL);
|
|
10
|
-
const errorCache = typeof pluginOptions.errorCache !== 'undefined' ? pluginOptions.errorCache : lru(DEFAULT_MAX, DEFAULT_TTL);
|
|
5
|
+
const documentCache = typeof pluginOptions.documentCache !== 'undefined' ? pluginOptions.documentCache : getInMemoryLRUCache();
|
|
6
|
+
const errorCache = typeof pluginOptions.errorCache !== 'undefined' ? pluginOptions.errorCache : getInMemoryLRUCache();
|
|
11
7
|
return {
|
|
12
8
|
onParse({ params, setParsedDocument }) {
|
|
13
9
|
const { source } = params;
|
package/package.json
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envelop/parser-cache",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0-alpha-3936561.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@envelop/core": "
|
|
6
|
+
"@envelop/core": "2.4.0-alpha-3936561.0",
|
|
7
7
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
8
8
|
},
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"tiny-lru": "7.0.6"
|
|
11
|
-
},
|
|
12
9
|
"repository": {
|
|
13
10
|
"type": "git",
|
|
14
11
|
"url": "https://github.com/dotansimha/envelop.git",
|