nuxt-skew-protection 0.3.8 → 0.3.10
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/module.json +1 -1
- package/dist/module.mjs +9 -5
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -249,10 +249,9 @@ async function processBatch(items, batchSize, processor) {
|
|
|
249
249
|
}
|
|
250
250
|
function extractFileId(assetPath) {
|
|
251
251
|
const filename = assetPath.split("/").pop();
|
|
252
|
-
if (!filename)
|
|
252
|
+
if (!filename || !filename.includes("."))
|
|
253
253
|
return null;
|
|
254
|
-
|
|
255
|
-
return match ? match[1] ?? null : null;
|
|
254
|
+
return filename;
|
|
256
255
|
}
|
|
257
256
|
function calculateDeletedChunks(currentAssets, previousAssets) {
|
|
258
257
|
const currentSet = new Set(currentAssets);
|
|
@@ -433,8 +432,9 @@ function createAssetManager(options) {
|
|
|
433
432
|
const previousAssets = manifest.versions[previousVersionId].assets;
|
|
434
433
|
const assetIndex = previousAssets.findIndex((a) => extractFileId(a) === fileId);
|
|
435
434
|
if (assetIndex !== -1) {
|
|
435
|
+
const oldAssetPath = previousAssets[assetIndex];
|
|
436
436
|
previousAssets.splice(assetIndex, 1);
|
|
437
|
-
const oldStorageKey = `${previousVersionId}/${
|
|
437
|
+
const oldStorageKey = `${previousVersionId}/${oldAssetPath}`;
|
|
438
438
|
await storage.removeItem(oldStorageKey).catch((error) => {
|
|
439
439
|
if (options.debug) {
|
|
440
440
|
logger.warn(`Failed to remove duplicate asset ${oldStorageKey}:`, error);
|
|
@@ -775,7 +775,11 @@ export {}
|
|
|
775
775
|
const daysSince = Math.floor((Date.now() - oldestTimestamp) / (1e3 * 60 * 60 * 24));
|
|
776
776
|
const timeInfo = daysSince > 0 ? `${daysSince} day${daysSince > 1 ? "s" : ""} ago` : "today";
|
|
777
777
|
logger.log(colors.cyan(`Initialising Nuxt Skew Protection v${version}...`));
|
|
778
|
-
|
|
778
|
+
if (totalReleases === 1) {
|
|
779
|
+
logger.warn(`No previous versions found in storage. This is either the first deployment or storage is misconfigured. https://nuxtseo.com/docs/skew-protection/storage-configuration`);
|
|
780
|
+
} else {
|
|
781
|
+
logger.log(` ${totalReleases} releases stored (oldest from ${timeInfo})`);
|
|
782
|
+
}
|
|
779
783
|
const storageInfo = options.storage.base ? `${colors.green(options.storage.driver)} ${colors.gray(`(${options.storage.base})`)}` : colors.green(options.storage.driver);
|
|
780
784
|
logger.log(` Database: ${storageInfo}`);
|
|
781
785
|
logger.log(` Storing ${colors.yellow(assets.length.toString())} assets in storage...`);
|