* Returns the list of dependencies for a given JS entrypoint by having esbuild * generate a metafile for it. Uses the set of babel plugins that would've been * used to compile the entrypoint. * * @param {string} entryPoint * @param {!Object} options * @return {Promise >}
(entryPoint, options)
| 687 | * @return {Promise<Array<string>>} |
| 688 | */ |
| 689 | async function getDependencies(entryPoint, options) { |
| 690 | let caller = options.minify ? 'minified' : 'unminified'; |
| 691 | // We read from the current binary configuration options if it is an |
| 692 | // no css binary output. (removes CSS installation) |
| 693 | if (options.ssrCss) { |
| 694 | caller += '-ssr-css'; |
| 695 | } |
| 696 | const babelPlugin = getEsbuildBabelPlugin(caller, /* enableCache */ true); |
| 697 | const result = await esbuild.build({ |
| 698 | entryPoints: [entryPoint], |
| 699 | bundle: true, |
| 700 | write: false, |
| 701 | metafile: true, |
| 702 | plugins: [babelPlugin], |
| 703 | }); |
| 704 | return Object.keys(result.metafile?.inputs ?? {}); |
| 705 | } |
| 706 | |
| 707 | module.exports = { |
| 708 | bootstrapThirdPartyFrames, |
no test coverage detected