diff --git a/spec/manifest_parsing_test.js b/spec/manifest_parsing_test.js index 71ecd1453fcec2eb92845e79a8ae713612903ca2..58b0035b9a00e47f22da0a4fe6e6e94e3615f0b4 100644 --- a/spec/manifest_parsing_test.js +++ b/spec/manifest_parsing_test.js @@ -107,5 +107,10 @@ describe('Vite manifest parsing', () => { 'settings', 'io.ox/core/main' ]) + expect(manifests.map(manifest => manifest.dependencies)).toEqual([ + ['io.ox/guidedtours/preload-helper-a7bbbf37.js'], + ['io.ox/guidedtours/preload-helper-a7bbbf37.js', 'io.ox/guidedtours/i18n.3de05d46.js'], + ['io.ox/guidedtours/preload-helper-a7bbbf37.js', 'io.ox/guidedtours/i18n.3de05d46.js'] + ]) }) }) diff --git a/src/manifests.js b/src/manifests.js index 656416005cbda19d19f881c96f5ad4c774abdb68..34945feb5b4ea44d57b05f2791664909385ff724 100644 --- a/src/manifests.js +++ b/src/manifests.js @@ -41,14 +41,18 @@ export const loadViteManifests = (() => { })() export function viteToOxManifest (viteManifests) { + const deps = viteManifestToDeps(viteManifests) return Object.values(viteManifests) .filter(manifest => Array.isArray(manifest?.meta?.manifests)) .map(manifest => manifest.meta.manifests.map(oxManifest => { - return { + const dependencies = deps[manifest.file] + const data = { ...oxManifest, path: manifest.file.slice(0, -path.parse(manifest.file).ext.length) } + if (dependencies?.length > 0) data.dependencies = dependencies + return data }) ) .flat()