MCPcopy
hub / github.com/ampproject/amphtml / getDependencies

Function getDependencies

build-system/tasks/helpers.js:689–705  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

687 * @return {Promise<Array<string>>}
688 */
689async 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
707module.exports = {
708 bootstrapThirdPartyFrames,

Callers 1

compileJsFunction · 0.85

Calls 2

getEsbuildBabelPluginFunction · 0.85
buildMethod · 0.45

Tested by

no test coverage detected