(
ctx: Rollup.PluginContext,
rollupBundle: Rollup.OutputBundle,
bundleGraphAdders?: Set<BundleGraphAdder>,
manifestExtra?: Partial<QwikManifest>
)
| 997 | }; |
| 998 | |
| 999 | async function generateManifest( |
| 1000 | ctx: Rollup.PluginContext, |
| 1001 | rollupBundle: Rollup.OutputBundle, |
| 1002 | bundleGraphAdders?: Set<BundleGraphAdder>, |
| 1003 | manifestExtra?: Partial<QwikManifest> |
| 1004 | ) { |
| 1005 | const outputAnalyzer = createOutputAnalyzer(rollupBundle); |
| 1006 | const manifest = await outputAnalyzer.generateManifest(manifestExtra); |
| 1007 | |
| 1008 | manifest.platform = { |
| 1009 | ...manifestExtra?.platform, |
| 1010 | rollup: ctx.meta?.rollupVersion || '', |
| 1011 | env: optimizer.sys.env, |
| 1012 | os: optimizer.sys.os, |
| 1013 | }; |
| 1014 | if (optimizer.sys.env === 'node') { |
| 1015 | manifest.platform!.node = process.versions.node; |
| 1016 | } |
| 1017 | |
| 1018 | const bundleGraph = convertManifestToBundleGraph(manifest, bundleGraphAdders); |
| 1019 | const bgAsset = ctx.emitFile({ |
| 1020 | type: 'asset', |
| 1021 | name: 'bundle-graph.json', |
| 1022 | source: JSON.stringify(bundleGraph), |
| 1023 | }); |
| 1024 | const bgPath = ctx.getFileName(bgAsset); |
| 1025 | manifest.bundleGraphAsset = bgPath; |
| 1026 | // we already generated the assets list so we need to update it |
| 1027 | manifest.assets![bgPath] = { |
| 1028 | name: 'bundle-graph.json', |
| 1029 | size: bundleGraph.length, |
| 1030 | }; |
| 1031 | |
| 1032 | const manifestStr = JSON.stringify(manifest, null, '\t'); |
| 1033 | ctx.emitFile({ |
| 1034 | fileName: Q_MANIFEST_FILENAME, |
| 1035 | type: 'asset', |
| 1036 | source: manifestStr, |
| 1037 | }); |
| 1038 | |
| 1039 | if (typeof opts.manifestOutput === 'function') { |
| 1040 | await opts.manifestOutput(manifest); |
| 1041 | } |
| 1042 | |
| 1043 | if (typeof opts.transformedModuleOutput === 'function') { |
| 1044 | await opts.transformedModuleOutput(getTransformedOutputs()); |
| 1045 | } |
| 1046 | |
| 1047 | // TODO get rid of this with the vite environment api |
| 1048 | return manifestStr; |
| 1049 | } |
| 1050 | |
| 1051 | return { |
| 1052 | buildStart, |
nothing calls this directly
no test coverage detected