druxt 0.17.0 → 0.18.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/dist/druxt.esm.js +26 -13
- package/dist/druxt.ssr.js +26 -13
- package/package.json +3 -2
- package/templates/plugin.js +10 -1
package/dist/druxt.esm.js
CHANGED
|
@@ -9,7 +9,7 @@ import Vue from 'vue';
|
|
|
9
9
|
import { DrupalJsonApiParams } from 'drupal-jsonapi-params';
|
|
10
10
|
|
|
11
11
|
var name = "druxt";
|
|
12
|
-
var version = "0.
|
|
12
|
+
var version = "0.18.0";
|
|
13
13
|
var description = "The Fully Decoupled Drupal Framework for Nuxt.js.";
|
|
14
14
|
var keywords = [
|
|
15
15
|
"cms",
|
|
@@ -47,8 +47,8 @@ var files = [
|
|
|
47
47
|
"templates"
|
|
48
48
|
];
|
|
49
49
|
var dependencies = {
|
|
50
|
+
"@nuxtjs/axios": "^5.13.6",
|
|
50
51
|
"@nuxtjs/proxy": "^2.1.0",
|
|
51
|
-
axios: "^0.21.1",
|
|
52
52
|
chalk: "^4.1.2",
|
|
53
53
|
deepmerge: "^4.2.2",
|
|
54
54
|
"drupal-jsonapi-params": "^1.2.1",
|
|
@@ -60,6 +60,7 @@ var devDependencies = {
|
|
|
60
60
|
"@storybook/addon-docs": "^6.4.13"
|
|
61
61
|
};
|
|
62
62
|
var peerDependencies = {
|
|
63
|
+
axios: "*",
|
|
63
64
|
consola: "*"
|
|
64
65
|
};
|
|
65
66
|
var optionalDependencies = {
|
|
@@ -124,6 +125,14 @@ const DruxtNuxtModule = function(moduleOptions = {}) {
|
|
|
124
125
|
}
|
|
125
126
|
this.addModule("@nuxtjs/proxy");
|
|
126
127
|
}
|
|
128
|
+
if (!options.axios) {
|
|
129
|
+
this.options.axios = {
|
|
130
|
+
baseURL: options.baseUrl,
|
|
131
|
+
proxy: !!this.options.proxy,
|
|
132
|
+
...this.options.axios
|
|
133
|
+
};
|
|
134
|
+
this.addModule("@nuxtjs/axios");
|
|
135
|
+
}
|
|
127
136
|
this.nuxt.hook("components:dirs", (dirs) => {
|
|
128
137
|
dirs.push({ path: join(__dirname, "components") });
|
|
129
138
|
});
|
|
@@ -135,10 +144,13 @@ const DruxtNuxtModule = function(moduleOptions = {}) {
|
|
|
135
144
|
const extendPlugins = this.options.extendPlugins;
|
|
136
145
|
this.options.extendPlugins = (plugins) => {
|
|
137
146
|
plugins = typeof extendPlugins === "function" ? extendPlugins(plugins) : plugins;
|
|
138
|
-
const
|
|
139
|
-
const
|
|
140
|
-
plugins.splice(
|
|
141
|
-
plugins.
|
|
147
|
+
const axiosIndex = plugins.findIndex(({ src }) => src === `${this.options.buildDir}/axios.js`);
|
|
148
|
+
const axiosPlugin = plugins[axiosIndex];
|
|
149
|
+
plugins.splice(axiosIndex, 1);
|
|
150
|
+
const druxtIndex = plugins.findIndex(({ src }) => src === `${this.options.buildDir}/druxt.js`);
|
|
151
|
+
const druxtPlugin = plugins[druxtIndex];
|
|
152
|
+
plugins.splice(druxtIndex, 1);
|
|
153
|
+
plugins = [axiosPlugin, druxtPlugin, ...plugins];
|
|
142
154
|
return plugins;
|
|
143
155
|
};
|
|
144
156
|
this.addPlugin({
|
|
@@ -165,14 +177,15 @@ class DruxtClient {
|
|
|
165
177
|
if (!baseUrl) {
|
|
166
178
|
throw new Error("The 'baseUrl' parameter is required.");
|
|
167
179
|
}
|
|
168
|
-
|
|
169
|
-
if (
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
|
180
|
+
this.axios = {};
|
|
181
|
+
if (typeof options.axios === "function") {
|
|
182
|
+
this.axios = options.axios;
|
|
183
|
+
} else {
|
|
184
|
+
this.axios = axios.create({
|
|
185
|
+
...options.axios || {},
|
|
186
|
+
baseURL: baseUrl
|
|
187
|
+
});
|
|
174
188
|
}
|
|
175
|
-
this.axios = axios.create(axiosSettings);
|
|
176
189
|
if (options.debug) {
|
|
177
190
|
const log = this.log;
|
|
178
191
|
this.axios.interceptors.request.use((config) => {
|
package/dist/druxt.ssr.js
CHANGED
|
@@ -22,7 +22,7 @@ const md5__default = /*#__PURE__*/_interopDefaultLegacy(md5);
|
|
|
22
22
|
const Vue__default = /*#__PURE__*/_interopDefaultLegacy(Vue);
|
|
23
23
|
|
|
24
24
|
var name = "druxt";
|
|
25
|
-
var version = "0.
|
|
25
|
+
var version = "0.18.0";
|
|
26
26
|
var description = "The Fully Decoupled Drupal Framework for Nuxt.js.";
|
|
27
27
|
var keywords = [
|
|
28
28
|
"cms",
|
|
@@ -60,8 +60,8 @@ var files = [
|
|
|
60
60
|
"templates"
|
|
61
61
|
];
|
|
62
62
|
var dependencies = {
|
|
63
|
+
"@nuxtjs/axios": "^5.13.6",
|
|
63
64
|
"@nuxtjs/proxy": "^2.1.0",
|
|
64
|
-
axios: "^0.21.1",
|
|
65
65
|
chalk: "^4.1.2",
|
|
66
66
|
deepmerge: "^4.2.2",
|
|
67
67
|
"drupal-jsonapi-params": "^1.2.1",
|
|
@@ -73,6 +73,7 @@ var devDependencies = {
|
|
|
73
73
|
"@storybook/addon-docs": "^6.4.13"
|
|
74
74
|
};
|
|
75
75
|
var peerDependencies = {
|
|
76
|
+
axios: "*",
|
|
76
77
|
consola: "*"
|
|
77
78
|
};
|
|
78
79
|
var optionalDependencies = {
|
|
@@ -137,6 +138,14 @@ const DruxtNuxtModule = function(moduleOptions = {}) {
|
|
|
137
138
|
}
|
|
138
139
|
this.addModule("@nuxtjs/proxy");
|
|
139
140
|
}
|
|
141
|
+
if (!options.axios) {
|
|
142
|
+
this.options.axios = {
|
|
143
|
+
baseURL: options.baseUrl,
|
|
144
|
+
proxy: !!this.options.proxy,
|
|
145
|
+
...this.options.axios
|
|
146
|
+
};
|
|
147
|
+
this.addModule("@nuxtjs/axios");
|
|
148
|
+
}
|
|
140
149
|
this.nuxt.hook("components:dirs", (dirs) => {
|
|
141
150
|
dirs.push({ path: path.join(__dirname, "components") });
|
|
142
151
|
});
|
|
@@ -148,10 +157,13 @@ const DruxtNuxtModule = function(moduleOptions = {}) {
|
|
|
148
157
|
const extendPlugins = this.options.extendPlugins;
|
|
149
158
|
this.options.extendPlugins = (plugins) => {
|
|
150
159
|
plugins = typeof extendPlugins === "function" ? extendPlugins(plugins) : plugins;
|
|
151
|
-
const
|
|
152
|
-
const
|
|
153
|
-
plugins.splice(
|
|
154
|
-
plugins.
|
|
160
|
+
const axiosIndex = plugins.findIndex(({ src }) => src === `${this.options.buildDir}/axios.js`);
|
|
161
|
+
const axiosPlugin = plugins[axiosIndex];
|
|
162
|
+
plugins.splice(axiosIndex, 1);
|
|
163
|
+
const druxtIndex = plugins.findIndex(({ src }) => src === `${this.options.buildDir}/druxt.js`);
|
|
164
|
+
const druxtPlugin = plugins[druxtIndex];
|
|
165
|
+
plugins.splice(druxtIndex, 1);
|
|
166
|
+
plugins = [axiosPlugin, druxtPlugin, ...plugins];
|
|
155
167
|
return plugins;
|
|
156
168
|
};
|
|
157
169
|
this.addPlugin({
|
|
@@ -178,14 +190,15 @@ class DruxtClient {
|
|
|
178
190
|
if (!baseUrl) {
|
|
179
191
|
throw new Error("The 'baseUrl' parameter is required.");
|
|
180
192
|
}
|
|
181
|
-
|
|
182
|
-
if (
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
|
|
193
|
+
this.axios = {};
|
|
194
|
+
if (typeof options.axios === "function") {
|
|
195
|
+
this.axios = options.axios;
|
|
196
|
+
} else {
|
|
197
|
+
this.axios = axios__default['default'].create({
|
|
198
|
+
...options.axios || {},
|
|
199
|
+
baseURL: baseUrl
|
|
200
|
+
});
|
|
187
201
|
}
|
|
188
|
-
this.axios = axios__default['default'].create(axiosSettings);
|
|
189
202
|
if (options.debug) {
|
|
190
203
|
const log = this.log;
|
|
191
204
|
this.axios.interceptors.request.use((config) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "druxt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "The Fully Decoupled Drupal Framework for Nuxt.js.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cms",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"templates"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
+
"@nuxtjs/axios": "^5.13.6",
|
|
41
42
|
"@nuxtjs/proxy": "^2.1.0",
|
|
42
|
-
"axios": "^0.21.1",
|
|
43
43
|
"chalk": "^4.1.2",
|
|
44
44
|
"deepmerge": "^4.2.2",
|
|
45
45
|
"drupal-jsonapi-params": "^1.2.1",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"@storybook/addon-docs": "^6.4.13"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
+
"axios": "*",
|
|
54
55
|
"consola": "*"
|
|
55
56
|
},
|
|
56
57
|
"optionalDependencies": {
|
package/templates/plugin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DruxtClient } from 'druxt'
|
|
2
2
|
|
|
3
|
-
export default (
|
|
3
|
+
export default ({ app }, inject) => {
|
|
4
4
|
const options = <%= JSON.stringify(options) %>
|
|
5
5
|
|
|
6
6
|
// Disable the proxy for server side requests.
|
|
@@ -8,6 +8,15 @@ export default (context, inject) => {
|
|
|
8
8
|
options.proxy.api = false
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
<% if (typeof options.axios === 'object') { %>
|
|
12
|
+
// Axios settings.
|
|
13
|
+
console.warn('[druxt] Axios instance settings are deprecated, use @nuxtjs/axios module configuration instead.')
|
|
14
|
+
options.axios = <%= JSON.stringify(options.axios) %>
|
|
15
|
+
<% } else { %>
|
|
16
|
+
// Use the @nuxtjs/axios module Axios instance.
|
|
17
|
+
options.axios = app.$axios
|
|
18
|
+
<% } %>
|
|
19
|
+
|
|
11
20
|
const druxt = new DruxtClient(options.baseUrl, options)
|
|
12
21
|
druxt.settings = options
|
|
13
22
|
inject('druxt', druxt)
|