resourcerer 1.1.0 → 1.1.1
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 -3
- package/lib/collection.js +4 -4
- package/lib/config.js +2 -2
- package/lib/error-boundary.js +2 -2
- package/lib/model-cache.js +1 -1
- package/lib/model.js +3 -3
- package/lib/prefetch.js +4 -4
- package/lib/request.js +2 -2
- package/lib/resourcerer.js +14 -11
- package/lib/sync.js +2 -2
- package/lib/utils.js +1 -1
- package/package.json +3 -2
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export {default as Collection} from './lib/collection';
|
|
2
|
-
export {default as Model} from './lib/model';
|
|
3
|
-
export {default as sync, ajax} from './lib/sync';
|
|
1
|
+
export {default as Collection} from './lib/collection.js';
|
|
2
|
+
export {default as Model} from './lib/model.js';
|
|
3
|
+
export {default as sync, ajax} from './lib/sync.js';
|
|
4
4
|
export {default as prefetch} from './lib/prefetch.js';
|
|
5
5
|
export {default as request} from './lib/request.js';
|
|
6
6
|
export {default as ModelCache} from './lib/model-cache.js';
|
package/lib/collection.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {isDeepEqual, sortBy} from './utils';
|
|
1
|
+
import {isDeepEqual, sortBy} from './utils.js';
|
|
2
2
|
|
|
3
|
-
import Events from './events';
|
|
4
|
-
import Model from './model';
|
|
5
|
-
import sync from './sync';
|
|
3
|
+
import Events from './events.js';
|
|
4
|
+
import Model from './model.js';
|
|
5
|
+
import sync from './sync.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* A Collection instance represents a list of items in a RESTful sense. Each item returned at the
|
package/lib/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {camelize, noOp} from './utils';
|
|
1
|
+
import {camelize, noOp} from './utils.js';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {setRequestPrefilter} from './sync';
|
|
3
|
+
import {setRequestPrefilter} from './sync.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* This module contains all the required setup for implementing withResources
|
package/lib/error-boundary.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {omit} from './utils';
|
|
1
|
+
import {omit} from './utils.js';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import {ResourcesConfig} from './config';
|
|
3
|
+
import {ResourcesConfig} from './config.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* As of React 16, Error Boundaries (components with a componentDidCatch method)
|
package/lib/model-cache.js
CHANGED
package/lib/model.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {isDeepEqual, result, uniqueId, urlError} from './utils';
|
|
1
|
+
import {isDeepEqual, result, uniqueId, urlError} from './utils.js';
|
|
2
2
|
|
|
3
|
-
import Events from './events';
|
|
4
|
-
import sync from './sync';
|
|
3
|
+
import Events from './events.js';
|
|
4
|
+
import sync from './sync.js';
|
|
5
5
|
|
|
6
6
|
const RESERVED_OPTION_KEYS = [
|
|
7
7
|
'Model',
|
package/lib/prefetch.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {ModelMap, ResourceKeys} from './config';
|
|
2
|
-
import {noOp, once} from './utils';
|
|
1
|
+
import {ModelMap, ResourceKeys} from './config.js';
|
|
2
|
+
import {noOp, once} from './utils.js';
|
|
3
3
|
|
|
4
|
-
import {getCacheKey} from './resourcerer';
|
|
5
|
-
import request from './request';
|
|
4
|
+
import {getCacheKey} from './resourcerer.js';
|
|
5
|
+
import request from './request.js';
|
|
6
6
|
|
|
7
7
|
// prevents api request bursts based on quick swipes
|
|
8
8
|
const PREFETCH_TIMEOUT = 50;
|
package/lib/request.js
CHANGED
package/lib/resourcerer.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {hasErrored, hasLoaded, isLoading} from './utils';
|
|
2
|
-
import {ModelMap, ResourceKeys, ResourcesConfig, UnfetchedResources} from './config';
|
|
1
|
+
import {hasErrored, hasLoaded, isLoading} from './utils.js';
|
|
2
|
+
import {ModelMap, ResourceKeys, ResourcesConfig, UnfetchedResources} from './config.js';
|
|
3
3
|
/* eslint-disable no-unused-vars */
|
|
4
4
|
import React, {useEffect, useReducer, useRef, useState} from 'react';
|
|
5
5
|
/* eslint-enable no-unused-vars */
|
|
6
6
|
|
|
7
|
-
import Collection from './collection';
|
|
8
|
-
import ErrorBoundary from './error-boundary';
|
|
9
|
-
import {LoadingStates} from './constants';
|
|
10
|
-
import Model from './model';
|
|
11
|
-
import ModelCache from './model-cache';
|
|
7
|
+
import Collection from './collection.js';
|
|
8
|
+
import ErrorBoundary from './error-boundary.js';
|
|
9
|
+
import {LoadingStates} from './constants.js';
|
|
10
|
+
import Model from './model.js';
|
|
11
|
+
import ModelCache from './model-cache.js';
|
|
12
12
|
import ReactDOM from 'react-dom';
|
|
13
|
-
import request from './request';
|
|
13
|
+
import request from './request.js';
|
|
14
14
|
|
|
15
15
|
const SPREAD_PROVIDES_CHAR = '_';
|
|
16
16
|
|
|
@@ -340,9 +340,12 @@ export const withResources = (getResources) => (Component) =>
|
|
|
340
340
|
var resources = useResources(getResources, props);
|
|
341
341
|
|
|
342
342
|
return (
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
343
|
+
React.createElement(ErrorBoundary, {
|
|
344
|
+
children: React.createElement(Component, {
|
|
345
|
+
...props,
|
|
346
|
+
...resources
|
|
347
|
+
})
|
|
348
|
+
})
|
|
346
349
|
);
|
|
347
350
|
};
|
|
348
351
|
|
package/lib/sync.js
CHANGED
package/lib/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "resourcerer",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"repository": "github.com/noahgrant/resourcerer",
|
|
5
5
|
"description": "Declarative data-fetching and caching framework for React",
|
|
6
6
|
"keywords": [
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"docs/*.md"
|
|
17
17
|
],
|
|
18
18
|
"main": "index.js",
|
|
19
|
+
"type": "module",
|
|
19
20
|
"scripts": {
|
|
20
21
|
"checks": "npm test && npm run lint",
|
|
21
22
|
"lint": "eslint lib/*.js* test/*.js*",
|
|
@@ -36,7 +37,7 @@
|
|
|
36
37
|
],
|
|
37
38
|
"testEnvironment": "jsdom"
|
|
38
39
|
},
|
|
39
|
-
"
|
|
40
|
+
"exports": "index.js",
|
|
40
41
|
"devDependencies": {
|
|
41
42
|
"@babel/cli": "^7.10.5",
|
|
42
43
|
"@babel/core": "^7.10.5",
|