| 58 | // the UMD detection shim above. `$` inside umd-body.ts is a free reference |
| 59 | // that binds to the factory parameter at runtime. |
| 60 | async function buildUmd(outfile, minify) { |
| 61 | const result = await esbuild({ |
| 62 | entryPoints: [path("src/umd-body.ts")], |
| 63 | bundle: true, |
| 64 | write: false, |
| 65 | format: "iife", |
| 66 | target: "es2020", |
| 67 | minify, |
| 68 | legalComments: "none", |
| 69 | }); |
| 70 | const body = result.outputFiles[0].text; |
| 71 | const wrapped = banner + "\n" + umdHead + body + umdTail; |
| 72 | console.log(`Building: ${outfile}`); |
| 73 | await writeFile(outfile, wrapped); |
| 74 | } |
| 75 | |
| 76 | await buildUmd(path("dist/jquery.autocomplete.js"), false); |
| 77 | await buildUmd(path("dist/jquery.autocomplete.min.js"), true); |