@fastly/compute-js-static-publish 8.0.0-beta.2 → 8.0.0-beta.4
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-content.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/publish-content.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"publish-content.d.ts","sourceRoot":"","sources":["../../../../../src/cli/commands/manage/publish-content.ts"],"names":[],"mappings":"AA4GA,wBAAsB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,iBAuehD"}
|
|
@@ -256,7 +256,7 @@ export async function action(actionArgs) {
|
|
|
256
256
|
const assetsIndex = {};
|
|
257
257
|
const baseHashToVariantMetadatasMap = new Map();
|
|
258
258
|
// #### Iterate files
|
|
259
|
-
|
|
259
|
+
const filePromises = files.map(async (file) => {
|
|
260
260
|
// #### asset key
|
|
261
261
|
const assetKey = file.slice(publicDirRoot.length)
|
|
262
262
|
// in Windows, assetKey will otherwise end up as \path\file.html
|
|
@@ -285,7 +285,7 @@ export async function action(actionArgs) {
|
|
|
285
285
|
includeAsset = true;
|
|
286
286
|
}
|
|
287
287
|
if (!includeAsset) {
|
|
288
|
-
|
|
288
|
+
return;
|
|
289
289
|
}
|
|
290
290
|
// #### Base file size, hash, last modified time
|
|
291
291
|
const { size: baseSize, hash: baseHash } = await calculateFileSizeAndHash(file);
|
|
@@ -303,6 +303,7 @@ export async function action(actionArgs) {
|
|
|
303
303
|
'original',
|
|
304
304
|
...contentCompression,
|
|
305
305
|
];
|
|
306
|
+
const batchItems = [];
|
|
306
307
|
for (const variant of variants) {
|
|
307
308
|
let variantKey = `${publishId}_files_sha256_${baseHash}`;
|
|
308
309
|
let variantFilename = `${baseHash}`;
|
|
@@ -359,7 +360,7 @@ export async function action(actionArgs) {
|
|
|
359
360
|
if (variantMetadata.numChunks != null) {
|
|
360
361
|
metadataJson.numChunks = String(variantMetadata.numChunks);
|
|
361
362
|
}
|
|
362
|
-
|
|
363
|
+
batchItems.push({
|
|
363
364
|
write: !variantMetadata.existsInKvStore,
|
|
364
365
|
size: variantMetadata.size,
|
|
365
366
|
key: variantKey,
|
|
@@ -373,13 +374,27 @@ export async function action(actionArgs) {
|
|
|
373
374
|
variantsToKeep.push(variant);
|
|
374
375
|
}
|
|
375
376
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
377
|
+
return {
|
|
378
|
+
assetKey,
|
|
379
|
+
asset: {
|
|
380
|
+
key: `sha256:${baseHash}`,
|
|
381
|
+
size: baseSize,
|
|
382
|
+
contentType: contentTypeTestResult.contentType,
|
|
383
|
+
lastModifiedTime,
|
|
384
|
+
variants: variantsToKeep,
|
|
385
|
+
},
|
|
386
|
+
batchItems,
|
|
382
387
|
};
|
|
388
|
+
});
|
|
389
|
+
const fileResults = await Promise.all(filePromises);
|
|
390
|
+
for (const result of fileResults) {
|
|
391
|
+
if (result == null) {
|
|
392
|
+
continue;
|
|
393
|
+
}
|
|
394
|
+
assetsIndex[result.assetKey] = result.asset;
|
|
395
|
+
for (const batchItem of result.batchItems) {
|
|
396
|
+
batch.add(batchItem);
|
|
397
|
+
}
|
|
383
398
|
}
|
|
384
399
|
console.log(`✅ Scan complete.`);
|
|
385
400
|
await storageProvider.applyBatch(batch);
|