apostrophe 3.67.2 → 3.67.3
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.67.3 (2025-03-31)
|
|
4
|
+
|
|
5
|
+
### Fixes
|
|
6
|
+
|
|
7
|
+
* Hotfix: fixes a bug in which the same on-demand cache was used across multiple sites in the presence of `@apostrophecms/multisite`. In rare cases, this bug could cause the home page of site "A" to be displayed on a request for site "B," but only if requests were simultaneous. This bug did not impact single-site projects.
|
|
8
|
+
|
|
3
9
|
## 3.67.2 (2024-08-08)
|
|
4
10
|
|
|
5
11
|
### Changes
|
|
@@ -292,6 +292,8 @@ module.exports = {
|
|
|
292
292
|
const srcDir = `${dir}/${source}`;
|
|
293
293
|
if (fs.existsSync(srcDir)) {
|
|
294
294
|
if (
|
|
295
|
+
// pnpmPaths is provided
|
|
296
|
+
pnpmPaths &&
|
|
295
297
|
// is pnpm installation
|
|
296
298
|
self.apos.isPnpm &&
|
|
297
299
|
// is npm module and not bundled
|
|
@@ -572,11 +574,15 @@ module.exports = {
|
|
|
572
574
|
registerCode: ''
|
|
573
575
|
};
|
|
574
576
|
|
|
577
|
+
const importIndex = [];
|
|
575
578
|
for (const [ registerAs, importFrom ] of Object.entries(self.iconMap)) {
|
|
576
|
-
if (
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
579
|
+
if (!importIndex.includes(importFrom)) {
|
|
580
|
+
if (importFrom.substring(0, 1) === '~') {
|
|
581
|
+
output.importCode += `import ${importFrom}Icon from '${importFrom.substring(1)}';\n`;
|
|
582
|
+
} else {
|
|
583
|
+
output.importCode += `import ${importFrom}Icon from 'vue-material-design-icons/${importFrom}.vue';\n`;
|
|
584
|
+
}
|
|
585
|
+
importIndex.push(importFrom);
|
|
580
586
|
}
|
|
581
587
|
output.registerCode += `Vue.component('${registerAs}', ${importFrom}Icon);\n`;
|
|
582
588
|
}
|
|
@@ -156,6 +156,7 @@ const qs = require('qs');
|
|
|
156
156
|
const expressBearerToken = require('express-bearer-token');
|
|
157
157
|
const cors = require('cors');
|
|
158
158
|
const Promise = require('bluebird');
|
|
159
|
+
const expressCacheOnDemand = require('express-cache-on-demand');
|
|
159
160
|
|
|
160
161
|
module.exports = {
|
|
161
162
|
init(self) {
|
|
@@ -168,6 +169,7 @@ module.exports = {
|
|
|
168
169
|
self.apos.util.error('Set it as a global option (a property of the main object passed to apostrophe).');
|
|
169
170
|
self.apos.util.error('When you do so other modules will also pick up on it and make URLs absolute.');
|
|
170
171
|
}
|
|
172
|
+
self.createCacheOnDemand();
|
|
171
173
|
},
|
|
172
174
|
tasks(self) {
|
|
173
175
|
return {
|
|
@@ -771,8 +773,14 @@ module.exports = {
|
|
|
771
773
|
}
|
|
772
774
|
}
|
|
773
775
|
}
|
|
774
|
-
|
|
775
776
|
self.finalModuleMiddlewareAndRoutes = labeledList.map(item => (item.prepending || []).concat(item.middleware || item.routes)).flat();
|
|
777
|
+
},
|
|
778
|
+
createCacheOnDemand() {
|
|
779
|
+
const { enableCacheOnDemand = true } = self.options;
|
|
780
|
+
if (enableCacheOnDemand) {
|
|
781
|
+
// Instantiate independently for this instance of ApostropheCMS
|
|
782
|
+
self.apos.expressCacheOnDemand = expressCacheOnDemand();
|
|
783
|
+
}
|
|
776
784
|
}
|
|
777
785
|
};
|
|
778
786
|
}
|
|
@@ -2,7 +2,6 @@ const _ = require('lodash');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const { klona } = require('klona');
|
|
4
4
|
const { SemanticAttributes } = require('@opentelemetry/semantic-conventions');
|
|
5
|
-
const expressCacheOnDemand = require('express-cache-on-demand')();
|
|
6
5
|
|
|
7
6
|
module.exports = {
|
|
8
7
|
cascades: [ 'batchOperations', 'utilityOperations' ],
|
|
@@ -88,9 +87,6 @@ module.exports = {
|
|
|
88
87
|
};
|
|
89
88
|
},
|
|
90
89
|
async init(self) {
|
|
91
|
-
const { enableCacheOnDemand = true } = self.apos
|
|
92
|
-
.modules['@apostrophecms/express'].options;
|
|
93
|
-
self.enableCacheOnDemand = enableCacheOnDemand;
|
|
94
90
|
self.typeChoices = self.options.types || [];
|
|
95
91
|
// If "park" redeclares something with a parkedId present in "minimumPark",
|
|
96
92
|
// the later one should win
|
|
@@ -130,7 +126,7 @@ module.exports = {
|
|
|
130
126
|
// `_publishedDoc` property to each draft that also exists in a published form.
|
|
131
127
|
|
|
132
128
|
getAll: [
|
|
133
|
-
...self.
|
|
129
|
+
...self.apos.expressCacheOnDemand ? [ self.apos.expressCacheOnDemand ] : [],
|
|
134
130
|
async (req) => {
|
|
135
131
|
await self.publicApiCheckAsync(req);
|
|
136
132
|
const all = self.apos.launder.boolean(req.query.all);
|
|
@@ -256,7 +252,7 @@ module.exports = {
|
|
|
256
252
|
// `_home` or `_archive`
|
|
257
253
|
|
|
258
254
|
getOne: [
|
|
259
|
-
...self.
|
|
255
|
+
...self.apos.expressCacheOnDemand ? [ self.apos.expressCacheOnDemand ] : [],
|
|
260
256
|
async (req, _id) => {
|
|
261
257
|
_id = self.inferIdLocaleAndMode(req, _id);
|
|
262
258
|
// Edit access to draft is sufficient to fetch either
|
|
@@ -724,8 +720,8 @@ database.`);
|
|
|
724
720
|
addServeRoute() {
|
|
725
721
|
self.apos.app.get('*',
|
|
726
722
|
(req, res, next) => {
|
|
727
|
-
return self.
|
|
728
|
-
? expressCacheOnDemand(req, res, next)
|
|
723
|
+
return self.apos.expressCacheOnDemand
|
|
724
|
+
? self.apos.expressCacheOnDemand(req, res, next)
|
|
729
725
|
: next();
|
|
730
726
|
},
|
|
731
727
|
self.serve
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
const _ = require('lodash');
|
|
2
|
-
const expressCacheOnDemand = require('express-cache-on-demand')();
|
|
3
2
|
|
|
4
3
|
module.exports = {
|
|
5
4
|
extend: '@apostrophecms/doc-type',
|
|
@@ -225,12 +224,9 @@ module.exports = {
|
|
|
225
224
|
self.addEditorModal();
|
|
226
225
|
},
|
|
227
226
|
restApiRoutes(self) {
|
|
228
|
-
const { enableCacheOnDemand = true } = self.apos
|
|
229
|
-
.modules['@apostrophecms/express'].options;
|
|
230
|
-
|
|
231
227
|
return {
|
|
232
228
|
getAll: [
|
|
233
|
-
...
|
|
229
|
+
...self.apos.expressCacheOnDemand ? [ self.apos.expressCacheOnDemand ] : [],
|
|
234
230
|
async (req) => {
|
|
235
231
|
await self.publicApiCheckAsync(req);
|
|
236
232
|
const query = self.getRestQuery(req);
|
|
@@ -269,7 +265,7 @@ module.exports = {
|
|
|
269
265
|
}
|
|
270
266
|
],
|
|
271
267
|
getOne: [
|
|
272
|
-
...
|
|
268
|
+
...self.apos.expressCacheOnDemand ? [ self.apos.expressCacheOnDemand ] : [],
|
|
273
269
|
async (req, _id) => {
|
|
274
270
|
_id = self.inferIdLocaleAndMode(req, _id);
|
|
275
271
|
await self.publicApiCheckAsync(req);
|