MCPcopy Index your code
hub / github.com/ampproject/amphtml / build

Function build

build-system/server/lazy-build.js:75–96  ·  view source on GitHub ↗

* Actually build a JS file or extension. Only will allow one build per * bundle at a time. * * @param {!Object} bundles * @param {string} name * @param {function(!Object, string, ?Object):Promise} buildFunc * @return {Promise }

(bundles, name, buildFunc)

Source from the content-addressed store, hash-verified

73 * @return {Promise<void>}
74 */
75async function build(bundles, name, buildFunc) {
76 const bundle = bundles[name];
77 if (bundle.pendingBuild) {
78 return await bundle.pendingBuild;
79 }
80 if (bundle.watched) {
81 return;
82 }
83 bundle.watched = true;
84 bundle.pendingBuild = buildFunc(bundles, name, {
85 watch: true,
86 minify: argv.minified,
87 localDev: true,
88 onWatchBuild: async (bundlePromise) => {
89 bundle.pendingBuild = bundlePromise;
90 await bundlePromise;
91 bundle.pendingBuild = undefined;
92 },
93 });
94 await bundle.pendingBuild;
95 bundle.pendingBuild = undefined;
96}
97
98/**
99 * Lazy builds the correct version of an extension when requested.

Callers 3

lazyBuildFunction · 0.70
preBuildRuntimeFilesFunction · 0.70
preBuildExtensionsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected