diff --git a/tests/test_gallery_math.mjs b/tests/test_gallery_math.mjs index 656aa84..4cbe13b 100644 --- a/tests/test_gallery_math.mjs +++ b/tests/test_gallery_math.mjs @@ -1,4 +1,6 @@ import assert from 'node:assert/strict' +import { createHash } from 'node:crypto' +import { readFile } from 'node:fs/promises' import test from 'node:test' import { calculateGalleryMetrics, @@ -26,6 +28,20 @@ import { stepPreviewNavigationIndex } from '../web/image_conveyor_math.mjs' +test('production helper import is cache-keyed to the helper contents', async () => { + const helperUrl = new URL('../web/image_conveyor_math.mjs', import.meta.url) + const extensionUrl = new URL('../web/image_conveyor.js', import.meta.url) + const [helper, extension] = await Promise.all([ + readFile(helperUrl), + readFile(extensionUrl, 'utf8') + ]) + const cacheKey = createHash('sha256').update(helper).digest('hex').slice(0, 16) + assert.match( + extension, + new RegExp(`from ['"]\\./image_conveyor_math\\.mjs\\?v=${cacheKey}['"]`) + ) +}) + test('responsive metrics add columns as width grows', () => { const medium = calculateGalleryMetrics(520, 172, 10) const wide = calculateGalleryMetrics(1040, 172, 10) diff --git a/web/image_conveyor.js b/web/image_conveyor.js index f41728e..c3e2b1f 100644 --- a/web/image_conveyor.js +++ b/web/image_conveyor.js @@ -47,7 +47,7 @@ import { shouldReanchorGalleryResize, isConveyorDeleteShortcut, stepPreviewNavigationIndex -} from './image_conveyor_math.mjs' +} from './image_conveyor_math.mjs?v=ad0ed464cebafbf2' const EXTENSION_NAME = 'Comfy.ImageConveyor.VueNodes' const NODE_CLASSES = new Set(['ImageConveyor', 'SequentialBatchImageLoader'])