* 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)
| 73 | * @return {Promise<void>} |
| 74 | */ |
| 75 | async 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. |
no outgoing calls
no test coverage detected