@dream-encode/wp-js-plugin-utils 0.2.4 → 0.2.6
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/dist/index.js +1 -3
- package/dist/webpack/createWebpackConfig.js +0 -2
- package/package.json +1 -1
- package/dist/api/fetchOptions.js +0 -39
- package/dist/api/index.js +0 -16
package/dist/index.js
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.utils = exports.settings = exports.hooks = exports.dataMigrations = exports.components =
|
|
7
|
-
var _api = _interopRequireWildcard(require("./api"));
|
|
8
|
-
exports.api = _api;
|
|
6
|
+
exports.utils = exports.settings = exports.hooks = exports.dataMigrations = exports.components = void 0;
|
|
9
7
|
var _components = _interopRequireWildcard(require("./components"));
|
|
10
8
|
exports.components = _components;
|
|
11
9
|
var _dataMigrations = _interopRequireWildcard(require("./data-migrations"));
|
|
@@ -12,7 +12,6 @@ const TerserPlugin = require('terser-webpack-plugin');
|
|
|
12
12
|
const DependencyExtractionWebpackPlugin = require('@wordpress/dependency-extraction-webpack-plugin');
|
|
13
13
|
const postcssPlugins = require('@wordpress/postcss-plugins-preset');
|
|
14
14
|
const CSSAssetPlugin = require('./CSSAssetPlugin');
|
|
15
|
-
const sassImporters = typeof sass.NodePackageImporter === 'function' ? [new sass.NodePackageImporter()] : [];
|
|
16
15
|
const tryRequire = id => {
|
|
17
16
|
try {
|
|
18
17
|
return require(id);
|
|
@@ -121,7 +120,6 @@ const createWebpackConfig = (options = {}) => {
|
|
|
121
120
|
api: 'modern',
|
|
122
121
|
webpackImporter: false,
|
|
123
122
|
sassOptions: {
|
|
124
|
-
importers: sassImporters,
|
|
125
123
|
loadPaths: [resolve(context, 'node_modules')]
|
|
126
124
|
}
|
|
127
125
|
}
|
package/package.json
CHANGED
package/dist/api/fetchOptions.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.fetchPostOptions = exports.fetchGetOptions = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* Build fetch GET options with the WP REST nonce header.
|
|
9
|
-
*
|
|
10
|
-
* @param {string} nonce WP REST nonce.
|
|
11
|
-
* @return {Object}
|
|
12
|
-
*/
|
|
13
|
-
const fetchGetOptions = nonce => {
|
|
14
|
-
return {
|
|
15
|
-
headers: {
|
|
16
|
-
'X-WP-Nonce': nonce
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Build fetch POST options with the WP REST nonce header.
|
|
23
|
-
*
|
|
24
|
-
* @param {Object} postData Body to JSON-encode.
|
|
25
|
-
* @param {string} nonce WP REST nonce.
|
|
26
|
-
* @return {Object}
|
|
27
|
-
*/
|
|
28
|
-
exports.fetchGetOptions = fetchGetOptions;
|
|
29
|
-
const fetchPostOptions = (postData, nonce) => {
|
|
30
|
-
return {
|
|
31
|
-
method: 'POST',
|
|
32
|
-
headers: {
|
|
33
|
-
'Content-Type': 'application/json',
|
|
34
|
-
'X-WP-Nonce': nonce
|
|
35
|
-
},
|
|
36
|
-
body: JSON.stringify(postData)
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
exports.fetchPostOptions = fetchPostOptions;
|
package/dist/api/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var _fetchOptions = require("./fetchOptions");
|
|
7
|
-
Object.keys(_fetchOptions).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _fetchOptions[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _fetchOptions[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|