@hpcc-js/esbuild-plugins 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +6 -6
- package/dist/index.js.map +3 -3
- package/package.json +2 -2
- package/src/build.ts +33 -54
- package/types/build.d.ts +7 -983
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import*as
|
|
2
|
-
${n?`import wrapper from "${
|
|
1
|
+
import*as a from"process";import{readFileSync as _}from"fs";import*as g from"path";import*as f from"esbuild";import{umdWrapper as x}from"esbuild-plugin-umd-wrapper";import F from"yargs";import{hideBin as W}from"yargs/helpers";function p(e){return{name:"rebuild-logger",setup(o){o.onStart(()=>{console.log("[watch] build started")}),o.onEnd(()=>{console.log(`Rebuilt ${e.outfile??"Unknown"}`)})}}}import{readFile as j}from"fs/promises";import{existsSync as $}from"fs";import{Base91 as v}from"@hpcc-js/wasm-base91";import{Zstd as S}from"@hpcc-js/wasm-zstd";function E(e,o,t){let r=t.length+8192<=o.length,n=$(e);return`${r?'import { decompress } from "fzstd";':""}
|
|
2
|
+
${n?`import wrapper from "${e}";`:""}
|
|
3
3
|
|
|
4
4
|
const table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&()*+,./:;<=>?@[]^_\`{|}~"';
|
|
5
5
|
|
|
@@ -37,13 +37,13 @@ function decode(raw: string): Uint8Array {
|
|
|
37
37
|
return new Uint8Array(ret);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
const blobStr = '${
|
|
40
|
+
const blobStr = '${r?t:o}';
|
|
41
41
|
|
|
42
42
|
let g_module: Uint8Array | undefined;
|
|
43
43
|
let g_wasmBinary: Uint8Array | undefined;
|
|
44
44
|
export default function() {
|
|
45
45
|
if (!g_wasmBinary) {
|
|
46
|
-
g_wasmBinary = ${
|
|
46
|
+
g_wasmBinary = ${r?"decompress(decode(blobStr))":"decode(blobStr)"};
|
|
47
47
|
}
|
|
48
48
|
${n?` if (!g_module) {
|
|
49
49
|
g_module = wrapper({
|
|
@@ -60,6 +60,6 @@ export function reset() {
|
|
|
60
60
|
if (g_module) {
|
|
61
61
|
g_module = undefined;
|
|
62
62
|
}
|
|
63
|
-
} `.trim()}async function
|
|
64
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIiJdLCJtYXBwaW5ncyI6IkEifQ==`,loader:"default"}))}}}function
|
|
63
|
+
} `.trim()}async function O(e){let o=await v.load(),t=await S.load(),r=await j(e);e=e.replace(/\.js$/,".xxx");let n=e.replace(/\.wasm$/,".js"),i=o.encode(r),P=t.compress(r),B=o.encode(P);return E(n,i,B)}function m(){return{name:"sfx-wasm",setup(e){e.onLoad({filter:/\.wasm$/},async o=>({contents:await O(o.path),loader:"ts"}))}}}var b=F(W(a.argv));b.usage("Usage: node esbuild.mjs [options]").demandCommand(0,0).example("node esbuild.mjs --watch","Bundle and watch for changes").option("mode",{alias:"m",describe:"Build mode",choices:["development","production"],default:"production"}).option("w",{alias:"watch",describe:"Watch for changes",type:"boolean"}).help("h").alias("h","help").epilog("https://github.com/hpcc-systems/hpcc-js-wasm");var w=JSON.parse(_(g.join(a.cwd(),"./package.json"),"utf8")),J=w.type==="module"?"js":"mjs",L=w.type==="module"?"cjs":"js",h=await b.argv,s=h.mode==="development",A=!s,c=h.watch;async function u(e,o="esm",t=[],r){let n=await f.context({entryPoints:[e],format:o,bundle:!0,minify:A,sourcemap:s,external:t,...r,plugins:[...c?[p(r)]:[],...r.plugins??[],m()]});c?await n.watch():(s&&Array.isArray(r.entryPoints)&&console.log("Start: ",r.entryPoints[0],r.outfile),await n.rebuild(),await n.dispose(),s&&Array.isArray(r.entryPoints)&&console.log("Stop: ",r.entryPoints[0],r.outfile))}function d(e,o,t="esm",r,n,i=[]){return u(e,t,i,{outfile:`${o}.${t==="esm"?"js":`${t}.js`}`,platform:"browser",target:"es2022",globalName:r,plugins:t==="umd"?[x({libraryName:n})]:[]})}function l(e,o,t="esm",r=[]){return u(e,t,r,{outfile:`${o}.${t==="esm"?J:L}`,platform:"node",target:"node20"})}function Q(e,o,t="esm",r,n,i=[]){return u(e,t,i,{outfile:`${o}.${t==="esm"?"js":"umd.js"}`,platform:"neutral",target:"es2022",globalName:r,plugins:t==="umd"?[x({libraryName:n})]:[]})}function R(e,o,t,r,n=[]){return Promise.all([d(e,o,"esm",t,r,n),d(e,o,"umd",t,r,n)])}function q(e,o,t=[]){return Promise.all([l(e,o,"esm",t),l(e,o,"cjs",t)])}function G(e,o,t,r,n=[]){return Promise.all([R(e,o,t,r,n),l(e,o,"cjs",n)])}import{readFile as U}from"fs/promises";function tt(e){return{name:"exclude-sourcemap",setup(o){o.onLoad({filter:e.filter},async t=>({contents:await U(t.path,"utf8")+`
|
|
64
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIiJdLCJtYXBwaW5ncyI6IkEifQ==`,loader:"default"}))}}}function rt(){return{name:"problem-matcher",setup(e){e.onStart(()=>{console.log("[watch] build started")}),e.onEnd(o=>{o.errors.forEach(({text:t,location:r})=>{console.error(`\u2718 [ERROR] ${t}`),console.error(` ${r?.file}:${r?.line}:${r?.column}:`)}),console.log("[watch] build finished")})}}}import{writeFileSync as y}from"node:fs";function it(){return{name:"remove-strict",setup(e){e.initialOptions.write=!1,e.onEnd(o=>{o?.outputFiles?.forEach(t=>{if(t.path.endsWith(".js")){let r=t.text.replace(/"use strict";/g,"");r.indexOf("use strict")>=0&&console.error("remove-strict: ",t.path),y(t.path,r,{encoding:"utf8"})}else y(t.path,t.contents,{encoding:"binary"})})})}}}export{L as NODE_CJS,J as NODE_MJS,h as argv,G as bothTpl,R as browserBoth,d as browserTpl,tt as excludeSourcemap,s as isDevelopment,A as isProduction,c as isWatch,Q as neutralTpl,q as nodeBoth,l as nodeTpl,w as pkg,rt as problemMatcher,p as rebuildLogger,it as removeStrict,m as sfxWasm,O as wrap};
|
|
65
65
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/build.ts", "../src/rebuild-logger.ts", "../src/sfx-wrapper.ts", "../src/exclude-sourcemap.ts", "../src/problem-matcher.ts", "../src/remove-strict.ts"],
|
|
4
|
-
"sourcesContent": ["import * as process from \"process\";\nimport { readFileSync } from \"fs\";\nimport * as path from \"path\";\nimport * as esbuild from \"esbuild\";\nimport type { BuildOptions, Format } from \"esbuild\";\nimport { umdWrapper } from \"esbuild-plugin-umd-wrapper\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { rebuildLogger } from \"./rebuild-logger.ts\";\nimport { sfxWasm } from \"./sfx-wrapper.ts\";\n\nconst myYargs = yargs(hideBin(process.argv));\nmyYargs\n .usage(\"Usage: node esbuild.mjs [options]\")\n .demandCommand(0, 0)\n .example(\"node esbuild.mjs --watch\", \"Bundle and watch for changes\")\n .option(\"mode\", {\n alias: \"m\",\n describe: \"Build mode\",\n choices: [\"development\", \"production\"],\n default: \"production\"\n })\n .option(\"w\", {\n alias: \"watch\",\n describe: \"Watch for changes\",\n type: \"boolean\"\n })\n .help(\"h\")\n .alias(\"h\", \"help\")\n .epilog(\"https://github.com/hpcc-systems/hpcc-js-wasm\")\n ;\n\nexport const pkg = JSON.parse(readFileSync(path.join(process.cwd(), \"./package.json\"), \"utf8\"));\nexport const NODE_MJS = pkg.type === \"module\" ? \"js\" : \"mjs\";\nexport const NODE_CJS = pkg.type === \"module\" ? \"cjs\" : \"js\";\n\nexport const argv = await myYargs.argv;\nexport const isDevelopment = argv.mode === \"development\";\nexport const isProduction = !isDevelopment;\nexport const isWatch = argv.watch;\n\nexport function build(config: BuildOptions) {\n if (isDevelopment && Array.isArray(config.entryPoints)) {\n // eslint-disable-next-line no-console\n console.log(\"Start: \", config.entryPoints[0], config.outfile);\n }\n return esbuild.build({\n sourcemap: \"linked\",\n ...config,\n plugins: [\n ...(config.plugins ?? []),\n sfxWasm()\n ]\n }).finally(() => {\n if (isDevelopment && Array.isArray(config.entryPoints)) {\n // eslint-disable-next-line no-console\n console.log(\"Stop: \", config.entryPoints[0], config.outfile);\n }\n });\n}\n\nexport async function watch(config: BuildOptions) {\n await build(config);\n return esbuild.context({\n sourcemap: \"external\",\n ...config,\n plugins: [\n ...(config.plugins ?? []),\n rebuildLogger(config),\n sfxWasm()\n ]\n }).then(ctx => {\n return ctx.watch();\n });\n}\n\nexport function buildWatch(config: BuildOptions) {\n return isWatch ? watch(config) : build(config);\n}\n\nexport function browserTpl(input: string, output: string, format: Format | \"umd\" = \"esm\", globalName?: string, libraryName?: string, external: string[] = []) {\n return buildWatch({\n entryPoints: [input],\n outfile: `${output}.${format === \"esm\" ? \"js\" : `${format}.js`}`,\n platform: \"browser\",\n target: \"es2022\",\n format: format as Format,\n globalName,\n bundle: true,\n minify: isProduction,\n external,\n plugins: format === \"umd\" ? [umdWrapper({ libraryName })] : []\n });\n}\n\nexport function browserBoth(input: string, output: string, globalName?: string, libraryName?: string, external: string[] = []) {\n return Promise.all([\n browserTpl(input, output, \"esm\", globalName, libraryName, external),\n browserTpl(input, output, \"umd\", globalName, libraryName, external)\n ]);\n}\n\nexport function nodeTpl(input: string, output: string, format: Format | \"umd\" = \"esm\", external: string[] = []) {\n return buildWatch({\n entryPoints: [input],\n outfile: `${output}.${format === \"esm\" ? NODE_MJS : NODE_CJS}`,\n platform: \"node\",\n target: \"node20\",\n format: format as Format,\n bundle: true,\n minify: isProduction,\n external\n });\n}\n\nexport function neutralTpl(input: string, output: string, format: Format | \"umd\" = \"esm\", globalName?: string, libraryName?: string, external: string[] = []) {\n return buildWatch({\n entryPoints: [input],\n outfile: `${output}.${format === \"esm\" ? \"js\" : \"umd.js\"}`,\n platform: \"neutral\",\n target: \"es2022\",\n format: format as Format,\n globalName,\n bundle: true,\n minify: isProduction,\n external,\n plugins: format === \"umd\" ? [umdWrapper({ libraryName })] : []\n });\n}\n\nexport function nodeBoth(input: string, output: string, external: string[] = []) {\n return Promise.all([\n nodeTpl(input, output, \"esm\", external),\n nodeTpl(input, output, \"cjs\", external)\n ]);\n}\n\nexport function bothTpl(input: string, output: string, globalName?: string, libraryName?: string, external: string[] = []) {\n return Promise.all([\n browserBoth(input, output, globalName, libraryName, external),\n nodeTpl(input, output, \"cjs\", external)\n ]);\n}\n", "import type { PluginBuild, Plugin } from \"esbuild\";\n\nexport interface RebuildLoggerOptions {\n outfile?: string;\n}\n\nexport function rebuildLogger(opts: RebuildLoggerOptions): Plugin {\n return {\n name: \"rebuild-logger\",\n\n setup(build: PluginBuild) {\n\n build.onStart(() => {\n // eslint-disable-next-line no-console\n console.log(\"[watch] build started\");\n });\n\n build.onEnd(() => {\n // eslint-disable-next-line no-console\n console.log(`Rebuilt ${opts.outfile ?? \"Unknown\"}`);\n });\n }\n };\n}\n", "import { readFile } from \"fs/promises\";\nimport { existsSync } from \"fs\";\nimport { Base91 } from \"@hpcc-js/wasm-base91\";\nimport { Zstd } from \"@hpcc-js/wasm-zstd\";\nimport type { Plugin, PluginBuild } from \"esbuild\";\n\nfunction tpl(wasmJsPath: string, base91Wasm: string, base91CompressedWasm: string) {\n\n const compressed = (base91CompressedWasm.length + 8 * 1024) <= base91Wasm.length;\n const wasmJsExists = existsSync(wasmJsPath);\n\n return `\\\n${compressed ? 'import { decompress } from \"fzstd\";' : \"\"}\n${wasmJsExists ? `import wrapper from \"${wasmJsPath}\";` : \"\"}\n\nconst table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&()*+,./:;<=>?@[]^_\\`{|}~\"';\n\nfunction decode(raw: string): Uint8Array {\n const len = raw.length;\n const ret: number[] = [];\n\n let b = 0;\n let n = 0;\n let v = -1;\n\n for (let i = 0; i < len; i++) {\n const p = table.indexOf(raw[i]);\n /* istanbul ignore next */\n if (p === -1) continue;\n if (v < 0) {\n v = p;\n } else {\n v += p * 91;\n b |= v << n;\n n += (v & 8191) > 88 ? 13 : 14;\n do {\n ret.push(b & 0xff);\n b >>= 8;\n n -= 8;\n } while (n > 7);\n v = -1;\n }\n }\n\n if (v > -1) {\n ret.push((b | v << n) & 0xff);\n }\n\n return new Uint8Array(ret);\n}\n\nconst blobStr = '${compressed ? base91CompressedWasm : base91Wasm}';\n\nlet g_module: Uint8Array | undefined;\nlet g_wasmBinary: Uint8Array | undefined;\nexport default function() {\n if (!g_wasmBinary) {\n g_wasmBinary = ${compressed ? \"decompress(decode(blobStr))\" : \"decode(blobStr)\"};\n }\n${!wasmJsExists ? `\\\n return g_wasmBinary;\n`: `\\\n if (!g_module) {\n g_module = wrapper({\n wasmBinary: g_wasmBinary,\n locateFile: undefined\n });\n }\n return g_module;\n`}\n}\n\nexport function reset() {\n if (g_module) {\n g_module = undefined;\n }\n} `.trim();\n}\n\nexport async function wrap(path: string) {\n const base91 = await Base91.load();\n const zstd = await Zstd.load();\n\n const wasm = await readFile(path);\n path = path.replace(/\\.js$/, \".xxx\");\n const wasmJsPath = path.replace(/\\.wasm$/, \".js\");\n const base91Wasm = base91.encode(wasm);\n const compressedWasm = zstd.compress(wasm);\n const base91CompressedWasm = base91.encode(compressedWasm);\n\n return tpl(wasmJsPath, base91Wasm, base91CompressedWasm);\n}\n\nexport function sfxWasm(): Plugin {\n return {\n name: \"sfx-wasm\",\n\n setup(build: PluginBuild) {\n\n build.onLoad({ filter: /\\.wasm$/ }, async args => {\n return {\n contents: await wrap(args.path),\n loader: \"ts\",\n };\n });\n }\n };\n}\n", "import { readFile } from \"fs/promises\";\nimport type { PluginBuild, Plugin } from \"esbuild\";\n\nexport interface ExcludeSourcemapOptions {\n filter: RegExp;\n}\nexport function excludeSourcemap(opts: ExcludeSourcemapOptions): Plugin {\n return {\n name: \"exclude-sourcemap\",\n\n setup(build: PluginBuild) {\n build.onLoad({ filter: opts.filter }, async args => {\n return {\n contents: await readFile(args.path, \"utf8\") + \"\\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIiJdLCJtYXBwaW5ncyI6IkEifQ==\",\n loader: \"default\",\n };\n });\n },\n };\n}\n", "import type { PluginBuild, Plugin } from \"esbuild\";\n\nexport function problemMatcher(): Plugin {\n return {\n name: \"problem-matcher\",\n\n setup(build: PluginBuild) {\n\n build.onStart(() => {\n // eslint-disable-next-line no-console\n console.log(\"[watch] build started\");\n });\n\n build.onEnd((result) => {\n result.errors.forEach(({ text, location }) => {\n console.error(`\u2718 [ERROR] ${text}`);\n console.error(` ${location?.file}:${location?.line}:${location?.column}:`);\n });\n // eslint-disable-next-line no-console\n console.log(\"[watch] build finished\");\n });\n }\n };\n}\n", "import { writeFileSync } from \"node:fs\";\nimport type { PluginBuild, Plugin } from \"esbuild\";\n\nexport function removeStrict(): Plugin {\n return {\n name: \"remove-strict\",\n setup(build: PluginBuild) {\n build.initialOptions.write = false;\n build.onEnd((result) => {\n result?.outputFiles?.forEach(file => {\n if (file.path.endsWith(\".js\")) {\n const contents = file.text.replace(/\"use strict\";/g, \"\");\n if (contents.indexOf(\"use strict\") >= 0) {\n console.error(\"remove-strict: \", file.path);\n }\n writeFileSync(file.path, contents, { encoding: \"utf8\" });\n } else {\n writeFileSync(file.path, file.contents, { encoding: \"binary\" });\n }\n });\n });\n }\n };\n}\n"],
|
|
5
|
-
"mappings": "AAAA,UAAYA,MAAa,UACzB,OAAS,gBAAAC,MAAoB,KAC7B,UAAYC,MAAU,OACtB,UAAYC,MAAa,UAEzB,OAAS,cAAAC,MAAkB,6BAC3B,OAAOC,MAAW,QAClB,OAAS,WAAAC,MAAe,gBCDjB,SAASC,EAAcC,EAAoC,CAC9D,MAAO,CACH,KAAM,iBAEN,MAAMC,EAAoB,CAEtBA,EAAM,QAAQ,IAAM,CAEhB,QAAQ,IAAI,uBAAuB,CACvC,CAAC,EAEDA,EAAM,MA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C,EAAYC,CAAoB,CAC3D,CAEO,SAASS,GAAkB,CAC9B,MAAO,CACH,KAAM,WAEN,MAAMC,EAAoB,CAEtBA,EAAM,OAAO,CAAE,OAAQ,SAAU,EAAG,MAAMC,IAC/B,CACH,SAAU,MAAMR,EAAKQ,EAAK,IAAI,EAC9B,OAAQ,IACZ,EACH,CACL,CACJ,CACJ,CFhGA,IAAMC,EAAUC,EAAMC,EAAgB,MAAI,CAAC,EAC3CF,EACK,MAAM,mCAAmC,EACzC,cAAc,EAAG,CAAC,EAClB,QAAQ,2BAA4B,8BAA8B,EAClE,OAAO,OAAQ,CACZ,MAAO,IACP,SAAU,aACV,QAAS,CAAC,cAAe,YAAY,EACrC,QAAS,YACb,CAAC,EACA,OAAO,IAAK,CACT,MAAO,QACP,SAAU,oBACV,KAAM,SACV,CAAC,EACA,KAAK,GAAG,EACR,MAAM,IAAK,MAAM,EACjB,OAAO,8CAA8C,EAGnD,IAAMG,EAAM,KAAK,MAAMC,EAAkB,OAAa,MAAI,EAAG,gBAAgB,EAAG,MAAM,CAAC,EACjFC,EAAWF,EAAI,OAAS,SAAW,KAAO,MAC1CG,EAAWH,EAAI,OAAS,SAAW,MAAQ,KAE3CI,EAAO,MAAMP,EAAQ,KACrBQ,EAAgBD,EAAK,OAAS,cAC9BE,EAAe,CAACD,EAChBE,EAAUH,EAAK,
|
|
6
|
-
"names": ["process", "readFileSync", "path", "esbuild", "umdWrapper", "yargs", "hideBin", "rebuildLogger", "opts", "build", "readFile", "existsSync", "Base91", "Zstd", "tpl", "wasmJsPath", "base91Wasm", "base91CompressedWasm", "compressed", "wasmJsExists", "wrap", "path", "base91", "zstd", "wasm", "compressedWasm", "sfxWasm", "build", "args", "myYargs", "yargs", "hideBin", "pkg", "readFileSync", "NODE_MJS", "NODE_CJS", "argv", "isDevelopment", "isProduction", "isWatch", "
|
|
4
|
+
"sourcesContent": ["import * as process from \"process\";\nimport { readFileSync } from \"fs\";\nimport * as path from \"path\";\nimport * as esbuild from \"esbuild\";\nimport type { BuildOptions, Format } from \"esbuild\";\nimport { umdWrapper } from \"esbuild-plugin-umd-wrapper\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { rebuildLogger } from \"./rebuild-logger.ts\";\nimport { sfxWasm } from \"./sfx-wrapper.ts\";\n\nconst myYargs = yargs(hideBin(process.argv));\nmyYargs\n .usage(\"Usage: node esbuild.mjs [options]\")\n .demandCommand(0, 0)\n .example(\"node esbuild.mjs --watch\", \"Bundle and watch for changes\")\n .option(\"mode\", {\n alias: \"m\",\n describe: \"Build mode\",\n choices: [\"development\", \"production\"],\n default: \"production\"\n })\n .option(\"w\", {\n alias: \"watch\",\n describe: \"Watch for changes\",\n type: \"boolean\"\n })\n .help(\"h\")\n .alias(\"h\", \"help\")\n .epilog(\"https://github.com/hpcc-systems/hpcc-js-wasm\")\n ;\n\nexport const pkg = JSON.parse(readFileSync(path.join(process.cwd(), \"./package.json\"), \"utf8\"));\nexport const NODE_MJS = pkg.type === \"module\" ? \"js\" : \"mjs\";\nexport const NODE_CJS = pkg.type === \"module\" ? \"cjs\" : \"js\";\n\nexport const argv = await myYargs.argv;\nexport const isDevelopment = argv.mode === \"development\";\nexport const isProduction = !isDevelopment;\nexport const isWatch = argv.watch;\n\nasync function buildWatch(input: string, format: Format | \"umd\" = \"esm\", external: string[] = [], config: BuildOptions): Promise<void> {\n\n const ctx = await esbuild.context({\n entryPoints: [input],\n format: format as Format,\n bundle: true,\n minify: isProduction,\n sourcemap: isDevelopment,\n external,\n ...config,\n plugins: [\n ...(isWatch ? [rebuildLogger(config)] : []),\n ...(config.plugins ?? []),\n sfxWasm()\n ]\n });\n\n if (isWatch) {\n await ctx.watch();\n } else {\n if (isDevelopment && Array.isArray(config.entryPoints)) {\n // eslint-disable-next-line no-console\n console.log(\"Start: \", config.entryPoints[0], config.outfile);\n }\n await ctx.rebuild();\n await ctx.dispose();\n if (isDevelopment && Array.isArray(config.entryPoints)) {\n // eslint-disable-next-line no-console\n console.log(\"Stop: \", config.entryPoints[0], config.outfile);\n }\n }\n}\n\nexport function browserTpl(input: string, output: string, format: Format | \"umd\" = \"esm\", globalName?: string, libraryName?: string, external: string[] = []) {\n return buildWatch(input, format, external, {\n outfile: `${output}.${format === \"esm\" ? \"js\" : `${format}.js`}`,\n platform: \"browser\",\n target: \"es2022\",\n globalName,\n plugins: format === \"umd\" ? [umdWrapper({ libraryName })] : []\n });\n}\n\nexport function nodeTpl(input: string, output: string, format: Format | \"umd\" = \"esm\", external: string[] = []) {\n return buildWatch(input, format, external, {\n outfile: `${output}.${format === \"esm\" ? NODE_MJS : NODE_CJS}`,\n platform: \"node\",\n target: \"node20\"\n });\n}\n\nexport function neutralTpl(input: string, output: string, format: Format | \"umd\" = \"esm\", globalName?: string, libraryName?: string, external: string[] = []) {\n return buildWatch(input, format, external, {\n outfile: `${output}.${format === \"esm\" ? \"js\" : \"umd.js\"}`,\n platform: \"neutral\",\n target: \"es2022\",\n globalName,\n plugins: format === \"umd\" ? [umdWrapper({ libraryName })] : []\n });\n}\n\nexport function browserBoth(input: string, output: string, globalName?: string, libraryName?: string, external: string[] = []) {\n return Promise.all([\n browserTpl(input, output, \"esm\", globalName, libraryName, external),\n browserTpl(input, output, \"umd\", globalName, libraryName, external)\n ]);\n}\n\nexport function nodeBoth(input: string, output: string, external: string[] = []) {\n return Promise.all([\n nodeTpl(input, output, \"esm\", external),\n nodeTpl(input, output, \"cjs\", external)\n ]);\n}\n\nexport function bothTpl(input: string, output: string, globalName?: string, libraryName?: string, external: string[] = []) {\n return Promise.all([\n browserBoth(input, output, globalName, libraryName, external),\n nodeTpl(input, output, \"cjs\", external)\n ]);\n}\n", "import type { PluginBuild, Plugin } from \"esbuild\";\n\nexport interface RebuildLoggerOptions {\n outfile?: string;\n}\n\nexport function rebuildLogger(opts: RebuildLoggerOptions): Plugin {\n return {\n name: \"rebuild-logger\",\n\n setup(build: PluginBuild) {\n\n build.onStart(() => {\n // eslint-disable-next-line no-console\n console.log(\"[watch] build started\");\n });\n\n build.onEnd(() => {\n // eslint-disable-next-line no-console\n console.log(`Rebuilt ${opts.outfile ?? \"Unknown\"}`);\n });\n }\n };\n}\n", "import { readFile } from \"fs/promises\";\nimport { existsSync } from \"fs\";\nimport { Base91 } from \"@hpcc-js/wasm-base91\";\nimport { Zstd } from \"@hpcc-js/wasm-zstd\";\nimport type { Plugin, PluginBuild } from \"esbuild\";\n\nfunction tpl(wasmJsPath: string, base91Wasm: string, base91CompressedWasm: string) {\n\n const compressed = (base91CompressedWasm.length + 8 * 1024) <= base91Wasm.length;\n const wasmJsExists = existsSync(wasmJsPath);\n\n return `\\\n${compressed ? 'import { decompress } from \"fzstd\";' : \"\"}\n${wasmJsExists ? `import wrapper from \"${wasmJsPath}\";` : \"\"}\n\nconst table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&()*+,./:;<=>?@[]^_\\`{|}~\"';\n\nfunction decode(raw: string): Uint8Array {\n const len = raw.length;\n const ret: number[] = [];\n\n let b = 0;\n let n = 0;\n let v = -1;\n\n for (let i = 0; i < len; i++) {\n const p = table.indexOf(raw[i]);\n /* istanbul ignore next */\n if (p === -1) continue;\n if (v < 0) {\n v = p;\n } else {\n v += p * 91;\n b |= v << n;\n n += (v & 8191) > 88 ? 13 : 14;\n do {\n ret.push(b & 0xff);\n b >>= 8;\n n -= 8;\n } while (n > 7);\n v = -1;\n }\n }\n\n if (v > -1) {\n ret.push((b | v << n) & 0xff);\n }\n\n return new Uint8Array(ret);\n}\n\nconst blobStr = '${compressed ? base91CompressedWasm : base91Wasm}';\n\nlet g_module: Uint8Array | undefined;\nlet g_wasmBinary: Uint8Array | undefined;\nexport default function() {\n if (!g_wasmBinary) {\n g_wasmBinary = ${compressed ? \"decompress(decode(blobStr))\" : \"decode(blobStr)\"};\n }\n${!wasmJsExists ? `\\\n return g_wasmBinary;\n`: `\\\n if (!g_module) {\n g_module = wrapper({\n wasmBinary: g_wasmBinary,\n locateFile: undefined\n });\n }\n return g_module;\n`}\n}\n\nexport function reset() {\n if (g_module) {\n g_module = undefined;\n }\n} `.trim();\n}\n\nexport async function wrap(path: string) {\n const base91 = await Base91.load();\n const zstd = await Zstd.load();\n\n const wasm = await readFile(path);\n path = path.replace(/\\.js$/, \".xxx\");\n const wasmJsPath = path.replace(/\\.wasm$/, \".js\");\n const base91Wasm = base91.encode(wasm);\n const compressedWasm = zstd.compress(wasm);\n const base91CompressedWasm = base91.encode(compressedWasm);\n\n return tpl(wasmJsPath, base91Wasm, base91CompressedWasm);\n}\n\nexport function sfxWasm(): Plugin {\n return {\n name: \"sfx-wasm\",\n\n setup(build: PluginBuild) {\n\n build.onLoad({ filter: /\\.wasm$/ }, async args => {\n return {\n contents: await wrap(args.path),\n loader: \"ts\",\n };\n });\n }\n };\n}\n", "import { readFile } from \"fs/promises\";\nimport type { PluginBuild, Plugin } from \"esbuild\";\n\nexport interface ExcludeSourcemapOptions {\n filter: RegExp;\n}\nexport function excludeSourcemap(opts: ExcludeSourcemapOptions): Plugin {\n return {\n name: \"exclude-sourcemap\",\n\n setup(build: PluginBuild) {\n build.onLoad({ filter: opts.filter }, async args => {\n return {\n contents: await readFile(args.path, \"utf8\") + \"\\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIiJdLCJtYXBwaW5ncyI6IkEifQ==\",\n loader: \"default\",\n };\n });\n },\n };\n}\n", "import type { PluginBuild, Plugin } from \"esbuild\";\n\nexport function problemMatcher(): Plugin {\n return {\n name: \"problem-matcher\",\n\n setup(build: PluginBuild) {\n\n build.onStart(() => {\n // eslint-disable-next-line no-console\n console.log(\"[watch] build started\");\n });\n\n build.onEnd((result) => {\n result.errors.forEach(({ text, location }) => {\n console.error(`\u2718 [ERROR] ${text}`);\n console.error(` ${location?.file}:${location?.line}:${location?.column}:`);\n });\n // eslint-disable-next-line no-console\n console.log(\"[watch] build finished\");\n });\n }\n };\n}\n", "import { writeFileSync } from \"node:fs\";\nimport type { PluginBuild, Plugin } from \"esbuild\";\n\nexport function removeStrict(): Plugin {\n return {\n name: \"remove-strict\",\n setup(build: PluginBuild) {\n build.initialOptions.write = false;\n build.onEnd((result) => {\n result?.outputFiles?.forEach(file => {\n if (file.path.endsWith(\".js\")) {\n const contents = file.text.replace(/\"use strict\";/g, \"\");\n if (contents.indexOf(\"use strict\") >= 0) {\n console.error(\"remove-strict: \", file.path);\n }\n writeFileSync(file.path, contents, { encoding: \"utf8\" });\n } else {\n writeFileSync(file.path, file.contents, { encoding: \"binary\" });\n }\n });\n });\n }\n };\n}\n"],
|
|
5
|
+
"mappings": "AAAA,UAAYA,MAAa,UACzB,OAAS,gBAAAC,MAAoB,KAC7B,UAAYC,MAAU,OACtB,UAAYC,MAAa,UAEzB,OAAS,cAAAC,MAAkB,6BAC3B,OAAOC,MAAW,QAClB,OAAS,WAAAC,MAAe,gBCDjB,SAASC,EAAcC,EAAoC,CAC9D,MAAO,CACH,KAAM,iBAEN,MAAMC,EAAoB,CAEtBA,EAAM,QAAQ,IAAM,CAEhB,QAAQ,IAAI,uBAAuB,CACvC,CAAC,EAEDA,EAAM,MAAM,IAAM,CAEd,QAAQ,IAAI,WAAWD,EAAK,SAAW,SAAS,EAAE,CACtD,CAAC,CACL,CACJ,CACJ,CCvBA,OAAS,YAAAE,MAAgB,cACzB,OAAS,cAAAC,MAAkB,KAC3B,OAAS,UAAAC,MAAc,uBACvB,OAAS,QAAAC,MAAY,qBAGrB,SAASC,EAAIC,EAAoBC,EAAoBC,EAA8B,CAE/E,IAAMC,EAAcD,EAAqB,OAAS,MAAaD,EAAW,OACpEG,EAAeR,EAAWI,CAAU,EAE1C,MAAO,GACTG,EAAa,sCAAwC,EAAE;AAAA,EACvDC,EAAe,wBAAwBJ,CAAU,KAAO,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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+
"names": ["process", "readFileSync", "path", "esbuild", "umdWrapper", "yargs", "hideBin", "rebuildLogger", "opts", "build", "readFile", "existsSync", "Base91", "Zstd", "tpl", "wasmJsPath", "base91Wasm", "base91CompressedWasm", "compressed", "wasmJsExists", "wrap", "path", "base91", "zstd", "wasm", "compressedWasm", "sfxWasm", "build", "args", "myYargs", "yargs", "hideBin", "pkg", "readFileSync", "NODE_MJS", "NODE_CJS", "argv", "isDevelopment", "isProduction", "isWatch", "buildWatch", "input", "format", "external", "config", "ctx", "rebuildLogger", "sfxWasm", "browserTpl", "output", "globalName", "libraryName", "umdWrapper", "nodeTpl", "neutralTpl", "browserBoth", "nodeBoth", "bothTpl", "readFile", "excludeSourcemap", "opts", "build", "args", "problemMatcher", "build", "result", "text", "location", "writeFileSync", "removeStrict", "build", "result", "file", "contents"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hpcc-js/esbuild-plugins",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Various esbuild plugins",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
},
|
|
60
60
|
"homepage": "https://hpcc-systems.github.io/hpcc-js-wasm/",
|
|
61
61
|
"license": "Apache-2.0",
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "f63aa89b2c5555e49482c4231b850374ace59904"
|
|
63
63
|
}
|
package/src/build.ts
CHANGED
|
@@ -39,95 +39,74 @@ export const isDevelopment = argv.mode === "development";
|
|
|
39
39
|
export const isProduction = !isDevelopment;
|
|
40
40
|
export const isWatch = argv.watch;
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
42
|
+
async function buildWatch(input: string, format: Format | "umd" = "esm", external: string[] = [], config: BuildOptions): Promise<void> {
|
|
43
|
+
|
|
44
|
+
const ctx = await esbuild.context({
|
|
45
|
+
entryPoints: [input],
|
|
46
|
+
format: format as Format,
|
|
47
|
+
bundle: true,
|
|
48
|
+
minify: isProduction,
|
|
49
|
+
sourcemap: isDevelopment,
|
|
50
|
+
external,
|
|
49
51
|
...config,
|
|
50
52
|
plugins: [
|
|
53
|
+
...(isWatch ? [rebuildLogger(config)] : []),
|
|
51
54
|
...(config.plugins ?? []),
|
|
52
55
|
sfxWasm()
|
|
53
56
|
]
|
|
54
|
-
})
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
if (isWatch) {
|
|
60
|
+
await ctx.watch();
|
|
61
|
+
} else {
|
|
62
|
+
if (isDevelopment && Array.isArray(config.entryPoints)) {
|
|
63
|
+
// eslint-disable-next-line no-console
|
|
64
|
+
console.log("Start: ", config.entryPoints[0], config.outfile);
|
|
65
|
+
}
|
|
66
|
+
await ctx.rebuild();
|
|
67
|
+
await ctx.dispose();
|
|
55
68
|
if (isDevelopment && Array.isArray(config.entryPoints)) {
|
|
56
69
|
// eslint-disable-next-line no-console
|
|
57
70
|
console.log("Stop: ", config.entryPoints[0], config.outfile);
|
|
58
71
|
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export async function watch(config: BuildOptions) {
|
|
63
|
-
await build(config);
|
|
64
|
-
return esbuild.context({
|
|
65
|
-
sourcemap: "external",
|
|
66
|
-
...config,
|
|
67
|
-
plugins: [
|
|
68
|
-
...(config.plugins ?? []),
|
|
69
|
-
rebuildLogger(config),
|
|
70
|
-
sfxWasm()
|
|
71
|
-
]
|
|
72
|
-
}).then(ctx => {
|
|
73
|
-
return ctx.watch();
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export function buildWatch(config: BuildOptions) {
|
|
78
|
-
return isWatch ? watch(config) : build(config);
|
|
72
|
+
}
|
|
79
73
|
}
|
|
80
74
|
|
|
81
75
|
export function browserTpl(input: string, output: string, format: Format | "umd" = "esm", globalName?: string, libraryName?: string, external: string[] = []) {
|
|
82
|
-
return buildWatch({
|
|
83
|
-
entryPoints: [input],
|
|
76
|
+
return buildWatch(input, format, external, {
|
|
84
77
|
outfile: `${output}.${format === "esm" ? "js" : `${format}.js`}`,
|
|
85
78
|
platform: "browser",
|
|
86
79
|
target: "es2022",
|
|
87
|
-
format: format as Format,
|
|
88
80
|
globalName,
|
|
89
|
-
bundle: true,
|
|
90
|
-
minify: isProduction,
|
|
91
|
-
external,
|
|
92
81
|
plugins: format === "umd" ? [umdWrapper({ libraryName })] : []
|
|
93
82
|
});
|
|
94
83
|
}
|
|
95
84
|
|
|
96
|
-
export function browserBoth(input: string, output: string, globalName?: string, libraryName?: string, external: string[] = []) {
|
|
97
|
-
return Promise.all([
|
|
98
|
-
browserTpl(input, output, "esm", globalName, libraryName, external),
|
|
99
|
-
browserTpl(input, output, "umd", globalName, libraryName, external)
|
|
100
|
-
]);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
85
|
export function nodeTpl(input: string, output: string, format: Format | "umd" = "esm", external: string[] = []) {
|
|
104
|
-
return buildWatch({
|
|
105
|
-
entryPoints: [input],
|
|
86
|
+
return buildWatch(input, format, external, {
|
|
106
87
|
outfile: `${output}.${format === "esm" ? NODE_MJS : NODE_CJS}`,
|
|
107
88
|
platform: "node",
|
|
108
|
-
target: "node20"
|
|
109
|
-
format: format as Format,
|
|
110
|
-
bundle: true,
|
|
111
|
-
minify: isProduction,
|
|
112
|
-
external
|
|
89
|
+
target: "node20"
|
|
113
90
|
});
|
|
114
91
|
}
|
|
115
92
|
|
|
116
93
|
export function neutralTpl(input: string, output: string, format: Format | "umd" = "esm", globalName?: string, libraryName?: string, external: string[] = []) {
|
|
117
|
-
return buildWatch({
|
|
118
|
-
entryPoints: [input],
|
|
94
|
+
return buildWatch(input, format, external, {
|
|
119
95
|
outfile: `${output}.${format === "esm" ? "js" : "umd.js"}`,
|
|
120
96
|
platform: "neutral",
|
|
121
97
|
target: "es2022",
|
|
122
|
-
format: format as Format,
|
|
123
98
|
globalName,
|
|
124
|
-
bundle: true,
|
|
125
|
-
minify: isProduction,
|
|
126
|
-
external,
|
|
127
99
|
plugins: format === "umd" ? [umdWrapper({ libraryName })] : []
|
|
128
100
|
});
|
|
129
101
|
}
|
|
130
102
|
|
|
103
|
+
export function browserBoth(input: string, output: string, globalName?: string, libraryName?: string, external: string[] = []) {
|
|
104
|
+
return Promise.all([
|
|
105
|
+
browserTpl(input, output, "esm", globalName, libraryName, external),
|
|
106
|
+
browserTpl(input, output, "umd", globalName, libraryName, external)
|
|
107
|
+
]);
|
|
108
|
+
}
|
|
109
|
+
|
|
131
110
|
export function nodeBoth(input: string, output: string, external: string[] = []) {
|
|
132
111
|
return Promise.all([
|
|
133
112
|
nodeTpl(input, output, "esm", external),
|
package/types/build.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { BuildOptions, Format } from "esbuild";
|
|
1
|
+
import type { Format } from "esbuild";
|
|
3
2
|
export declare const pkg: any;
|
|
4
3
|
export declare const NODE_MJS: string;
|
|
5
4
|
export declare const NODE_CJS: string;
|
|
@@ -15,984 +14,9 @@ export declare const argv: {
|
|
|
15
14
|
export declare const isDevelopment: boolean;
|
|
16
15
|
export declare const isProduction: boolean;
|
|
17
16
|
export declare const isWatch: unknown;
|
|
18
|
-
export declare function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
metafile?: boolean;
|
|
25
|
-
outdir?: string;
|
|
26
|
-
outbase?: string;
|
|
27
|
-
external?: string[];
|
|
28
|
-
packages?: "bundle" | "external";
|
|
29
|
-
alias?: Record<string, string>;
|
|
30
|
-
loader?: {
|
|
31
|
-
[ext: string]: esbuild.Loader;
|
|
32
|
-
};
|
|
33
|
-
resolveExtensions?: string[];
|
|
34
|
-
mainFields?: string[];
|
|
35
|
-
conditions?: string[];
|
|
36
|
-
write?: boolean;
|
|
37
|
-
allowOverwrite?: boolean;
|
|
38
|
-
tsconfig?: string;
|
|
39
|
-
outExtension?: {
|
|
40
|
-
[ext: string]: string;
|
|
41
|
-
};
|
|
42
|
-
publicPath?: string;
|
|
43
|
-
entryNames?: string;
|
|
44
|
-
chunkNames?: string;
|
|
45
|
-
assetNames?: string;
|
|
46
|
-
inject?: string[];
|
|
47
|
-
banner?: {
|
|
48
|
-
[type: string]: string;
|
|
49
|
-
};
|
|
50
|
-
footer?: {
|
|
51
|
-
[type: string]: string;
|
|
52
|
-
};
|
|
53
|
-
entryPoints?: string[] | Record<string, string> | {
|
|
54
|
-
in: string;
|
|
55
|
-
out: string;
|
|
56
|
-
}[];
|
|
57
|
-
stdin?: esbuild.StdinOptions;
|
|
58
|
-
absWorkingDir?: string;
|
|
59
|
-
nodePaths?: string[];
|
|
60
|
-
sourcemap: boolean | "linked" | "inline" | "external" | "both";
|
|
61
|
-
legalComments?: "none" | "inline" | "eof" | "linked" | "external";
|
|
62
|
-
sourceRoot?: string;
|
|
63
|
-
sourcesContent?: boolean;
|
|
64
|
-
format?: Format;
|
|
65
|
-
globalName?: string;
|
|
66
|
-
target?: string | string[];
|
|
67
|
-
supported?: Record<string, boolean>;
|
|
68
|
-
platform?: esbuild.Platform;
|
|
69
|
-
mangleProps?: RegExp;
|
|
70
|
-
reserveProps?: RegExp;
|
|
71
|
-
mangleQuoted?: boolean;
|
|
72
|
-
mangleCache?: Record<string, string | false>;
|
|
73
|
-
drop?: esbuild.Drop[];
|
|
74
|
-
dropLabels?: string[];
|
|
75
|
-
minify?: boolean;
|
|
76
|
-
minifyWhitespace?: boolean;
|
|
77
|
-
minifyIdentifiers?: boolean;
|
|
78
|
-
minifySyntax?: boolean;
|
|
79
|
-
lineLimit?: number;
|
|
80
|
-
charset?: esbuild.Charset;
|
|
81
|
-
treeShaking?: boolean;
|
|
82
|
-
ignoreAnnotations?: boolean;
|
|
83
|
-
jsx?: "transform" | "preserve" | "automatic";
|
|
84
|
-
jsxFactory?: string;
|
|
85
|
-
jsxFragment?: string;
|
|
86
|
-
jsxImportSource?: string;
|
|
87
|
-
jsxDev?: boolean;
|
|
88
|
-
jsxSideEffects?: boolean;
|
|
89
|
-
define?: {
|
|
90
|
-
[key: string]: string;
|
|
91
|
-
};
|
|
92
|
-
pure?: string[];
|
|
93
|
-
keepNames?: boolean;
|
|
94
|
-
color?: boolean;
|
|
95
|
-
logLevel?: esbuild.LogLevel;
|
|
96
|
-
logLimit?: number;
|
|
97
|
-
logOverride?: Record<string, esbuild.LogLevel>;
|
|
98
|
-
tsconfigRaw?: string | esbuild.TsconfigRaw;
|
|
99
|
-
}>>;
|
|
100
|
-
export declare function watch(config: BuildOptions): Promise<void>;
|
|
101
|
-
export declare function buildWatch(config: BuildOptions): Promise<void> | Promise<esbuild.BuildResult<{
|
|
102
|
-
plugins: esbuild.Plugin[];
|
|
103
|
-
bundle?: boolean;
|
|
104
|
-
splitting?: boolean;
|
|
105
|
-
preserveSymlinks?: boolean;
|
|
106
|
-
outfile?: string;
|
|
107
|
-
metafile?: boolean;
|
|
108
|
-
outdir?: string;
|
|
109
|
-
outbase?: string;
|
|
110
|
-
external?: string[];
|
|
111
|
-
packages?: "bundle" | "external";
|
|
112
|
-
alias?: Record<string, string>;
|
|
113
|
-
loader?: {
|
|
114
|
-
[ext: string]: esbuild.Loader;
|
|
115
|
-
};
|
|
116
|
-
resolveExtensions?: string[];
|
|
117
|
-
mainFields?: string[];
|
|
118
|
-
conditions?: string[];
|
|
119
|
-
write?: boolean;
|
|
120
|
-
allowOverwrite?: boolean;
|
|
121
|
-
tsconfig?: string;
|
|
122
|
-
outExtension?: {
|
|
123
|
-
[ext: string]: string;
|
|
124
|
-
};
|
|
125
|
-
publicPath?: string;
|
|
126
|
-
entryNames?: string;
|
|
127
|
-
chunkNames?: string;
|
|
128
|
-
assetNames?: string;
|
|
129
|
-
inject?: string[];
|
|
130
|
-
banner?: {
|
|
131
|
-
[type: string]: string;
|
|
132
|
-
};
|
|
133
|
-
footer?: {
|
|
134
|
-
[type: string]: string;
|
|
135
|
-
};
|
|
136
|
-
entryPoints?: string[] | Record<string, string> | {
|
|
137
|
-
in: string;
|
|
138
|
-
out: string;
|
|
139
|
-
}[];
|
|
140
|
-
stdin?: esbuild.StdinOptions;
|
|
141
|
-
absWorkingDir?: string;
|
|
142
|
-
nodePaths?: string[];
|
|
143
|
-
sourcemap: boolean | "linked" | "inline" | "external" | "both";
|
|
144
|
-
legalComments?: "none" | "inline" | "eof" | "linked" | "external";
|
|
145
|
-
sourceRoot?: string;
|
|
146
|
-
sourcesContent?: boolean;
|
|
147
|
-
format?: Format;
|
|
148
|
-
globalName?: string;
|
|
149
|
-
target?: string | string[];
|
|
150
|
-
supported?: Record<string, boolean>;
|
|
151
|
-
platform?: esbuild.Platform;
|
|
152
|
-
mangleProps?: RegExp;
|
|
153
|
-
reserveProps?: RegExp;
|
|
154
|
-
mangleQuoted?: boolean;
|
|
155
|
-
mangleCache?: Record<string, string | false>;
|
|
156
|
-
drop?: esbuild.Drop[];
|
|
157
|
-
dropLabels?: string[];
|
|
158
|
-
minify?: boolean;
|
|
159
|
-
minifyWhitespace?: boolean;
|
|
160
|
-
minifyIdentifiers?: boolean;
|
|
161
|
-
minifySyntax?: boolean;
|
|
162
|
-
lineLimit?: number;
|
|
163
|
-
charset?: esbuild.Charset;
|
|
164
|
-
treeShaking?: boolean;
|
|
165
|
-
ignoreAnnotations?: boolean;
|
|
166
|
-
jsx?: "transform" | "preserve" | "automatic";
|
|
167
|
-
jsxFactory?: string;
|
|
168
|
-
jsxFragment?: string;
|
|
169
|
-
jsxImportSource?: string;
|
|
170
|
-
jsxDev?: boolean;
|
|
171
|
-
jsxSideEffects?: boolean;
|
|
172
|
-
define?: {
|
|
173
|
-
[key: string]: string;
|
|
174
|
-
};
|
|
175
|
-
pure?: string[];
|
|
176
|
-
keepNames?: boolean;
|
|
177
|
-
color?: boolean;
|
|
178
|
-
logLevel?: esbuild.LogLevel;
|
|
179
|
-
logLimit?: number;
|
|
180
|
-
logOverride?: Record<string, esbuild.LogLevel>;
|
|
181
|
-
tsconfigRaw?: string | esbuild.TsconfigRaw;
|
|
182
|
-
}>>;
|
|
183
|
-
export declare function browserTpl(input: string, output: string, format?: Format | "umd", globalName?: string, libraryName?: string, external?: string[]): Promise<void> | Promise<esbuild.BuildResult<{
|
|
184
|
-
plugins: esbuild.Plugin[];
|
|
185
|
-
bundle?: boolean;
|
|
186
|
-
splitting?: boolean;
|
|
187
|
-
preserveSymlinks?: boolean;
|
|
188
|
-
outfile?: string;
|
|
189
|
-
metafile?: boolean;
|
|
190
|
-
outdir?: string;
|
|
191
|
-
outbase?: string;
|
|
192
|
-
external?: string[];
|
|
193
|
-
packages?: "bundle" | "external";
|
|
194
|
-
alias?: Record<string, string>;
|
|
195
|
-
loader?: {
|
|
196
|
-
[ext: string]: esbuild.Loader;
|
|
197
|
-
};
|
|
198
|
-
resolveExtensions?: string[];
|
|
199
|
-
mainFields?: string[];
|
|
200
|
-
conditions?: string[];
|
|
201
|
-
write?: boolean;
|
|
202
|
-
allowOverwrite?: boolean;
|
|
203
|
-
tsconfig?: string;
|
|
204
|
-
outExtension?: {
|
|
205
|
-
[ext: string]: string;
|
|
206
|
-
};
|
|
207
|
-
publicPath?: string;
|
|
208
|
-
entryNames?: string;
|
|
209
|
-
chunkNames?: string;
|
|
210
|
-
assetNames?: string;
|
|
211
|
-
inject?: string[];
|
|
212
|
-
banner?: {
|
|
213
|
-
[type: string]: string;
|
|
214
|
-
};
|
|
215
|
-
footer?: {
|
|
216
|
-
[type: string]: string;
|
|
217
|
-
};
|
|
218
|
-
entryPoints?: string[] | Record<string, string> | {
|
|
219
|
-
in: string;
|
|
220
|
-
out: string;
|
|
221
|
-
}[];
|
|
222
|
-
stdin?: esbuild.StdinOptions;
|
|
223
|
-
absWorkingDir?: string;
|
|
224
|
-
nodePaths?: string[];
|
|
225
|
-
sourcemap: boolean | "linked" | "inline" | "external" | "both";
|
|
226
|
-
legalComments?: "none" | "inline" | "eof" | "linked" | "external";
|
|
227
|
-
sourceRoot?: string;
|
|
228
|
-
sourcesContent?: boolean;
|
|
229
|
-
format?: Format;
|
|
230
|
-
globalName?: string;
|
|
231
|
-
target?: string | string[];
|
|
232
|
-
supported?: Record<string, boolean>;
|
|
233
|
-
platform?: esbuild.Platform;
|
|
234
|
-
mangleProps?: RegExp;
|
|
235
|
-
reserveProps?: RegExp;
|
|
236
|
-
mangleQuoted?: boolean;
|
|
237
|
-
mangleCache?: Record<string, string | false>;
|
|
238
|
-
drop?: esbuild.Drop[];
|
|
239
|
-
dropLabels?: string[];
|
|
240
|
-
minify?: boolean;
|
|
241
|
-
minifyWhitespace?: boolean;
|
|
242
|
-
minifyIdentifiers?: boolean;
|
|
243
|
-
minifySyntax?: boolean;
|
|
244
|
-
lineLimit?: number;
|
|
245
|
-
charset?: esbuild.Charset;
|
|
246
|
-
treeShaking?: boolean;
|
|
247
|
-
ignoreAnnotations?: boolean;
|
|
248
|
-
jsx?: "transform" | "preserve" | "automatic";
|
|
249
|
-
jsxFactory?: string;
|
|
250
|
-
jsxFragment?: string;
|
|
251
|
-
jsxImportSource?: string;
|
|
252
|
-
jsxDev?: boolean;
|
|
253
|
-
jsxSideEffects?: boolean;
|
|
254
|
-
define?: {
|
|
255
|
-
[key: string]: string;
|
|
256
|
-
};
|
|
257
|
-
pure?: string[];
|
|
258
|
-
keepNames?: boolean;
|
|
259
|
-
color?: boolean;
|
|
260
|
-
logLevel?: esbuild.LogLevel;
|
|
261
|
-
logLimit?: number;
|
|
262
|
-
logOverride?: Record<string, esbuild.LogLevel>;
|
|
263
|
-
tsconfigRaw?: string | esbuild.TsconfigRaw;
|
|
264
|
-
}>>;
|
|
265
|
-
export declare function browserBoth(input: string, output: string, globalName?: string, libraryName?: string, external?: string[]): Promise<[void | esbuild.BuildResult<{
|
|
266
|
-
plugins: esbuild.Plugin[];
|
|
267
|
-
bundle?: boolean;
|
|
268
|
-
splitting?: boolean;
|
|
269
|
-
preserveSymlinks?: boolean;
|
|
270
|
-
outfile?: string;
|
|
271
|
-
metafile?: boolean;
|
|
272
|
-
outdir?: string;
|
|
273
|
-
outbase?: string;
|
|
274
|
-
external?: string[];
|
|
275
|
-
packages?: "bundle" | "external";
|
|
276
|
-
alias?: Record<string, string>;
|
|
277
|
-
loader?: {
|
|
278
|
-
[ext: string]: esbuild.Loader;
|
|
279
|
-
};
|
|
280
|
-
resolveExtensions?: string[];
|
|
281
|
-
mainFields?: string[];
|
|
282
|
-
conditions?: string[];
|
|
283
|
-
write?: boolean;
|
|
284
|
-
allowOverwrite?: boolean;
|
|
285
|
-
tsconfig?: string;
|
|
286
|
-
outExtension?: {
|
|
287
|
-
[ext: string]: string;
|
|
288
|
-
};
|
|
289
|
-
publicPath?: string;
|
|
290
|
-
entryNames?: string;
|
|
291
|
-
chunkNames?: string;
|
|
292
|
-
assetNames?: string;
|
|
293
|
-
inject?: string[];
|
|
294
|
-
banner?: {
|
|
295
|
-
[type: string]: string;
|
|
296
|
-
};
|
|
297
|
-
footer?: {
|
|
298
|
-
[type: string]: string;
|
|
299
|
-
};
|
|
300
|
-
entryPoints?: string[] | Record<string, string> | {
|
|
301
|
-
in: string;
|
|
302
|
-
out: string;
|
|
303
|
-
}[];
|
|
304
|
-
stdin?: esbuild.StdinOptions;
|
|
305
|
-
absWorkingDir?: string;
|
|
306
|
-
nodePaths?: string[];
|
|
307
|
-
sourcemap: boolean | "linked" | "inline" | "external" | "both";
|
|
308
|
-
legalComments?: "none" | "inline" | "eof" | "linked" | "external";
|
|
309
|
-
sourceRoot?: string;
|
|
310
|
-
sourcesContent?: boolean;
|
|
311
|
-
format?: Format;
|
|
312
|
-
globalName?: string;
|
|
313
|
-
target?: string | string[];
|
|
314
|
-
supported?: Record<string, boolean>;
|
|
315
|
-
platform?: esbuild.Platform;
|
|
316
|
-
mangleProps?: RegExp;
|
|
317
|
-
reserveProps?: RegExp;
|
|
318
|
-
mangleQuoted?: boolean;
|
|
319
|
-
mangleCache?: Record<string, string | false>;
|
|
320
|
-
drop?: esbuild.Drop[];
|
|
321
|
-
dropLabels?: string[];
|
|
322
|
-
minify?: boolean;
|
|
323
|
-
minifyWhitespace?: boolean;
|
|
324
|
-
minifyIdentifiers?: boolean;
|
|
325
|
-
minifySyntax?: boolean;
|
|
326
|
-
lineLimit?: number;
|
|
327
|
-
charset?: esbuild.Charset;
|
|
328
|
-
treeShaking?: boolean;
|
|
329
|
-
ignoreAnnotations?: boolean;
|
|
330
|
-
jsx?: "transform" | "preserve" | "automatic";
|
|
331
|
-
jsxFactory?: string;
|
|
332
|
-
jsxFragment?: string;
|
|
333
|
-
jsxImportSource?: string;
|
|
334
|
-
jsxDev?: boolean;
|
|
335
|
-
jsxSideEffects?: boolean;
|
|
336
|
-
define?: {
|
|
337
|
-
[key: string]: string;
|
|
338
|
-
};
|
|
339
|
-
pure?: string[];
|
|
340
|
-
keepNames?: boolean;
|
|
341
|
-
color?: boolean;
|
|
342
|
-
logLevel?: esbuild.LogLevel;
|
|
343
|
-
logLimit?: number;
|
|
344
|
-
logOverride?: Record<string, esbuild.LogLevel>;
|
|
345
|
-
tsconfigRaw?: string | esbuild.TsconfigRaw;
|
|
346
|
-
}>, void | esbuild.BuildResult<{
|
|
347
|
-
plugins: esbuild.Plugin[];
|
|
348
|
-
bundle?: boolean;
|
|
349
|
-
splitting?: boolean;
|
|
350
|
-
preserveSymlinks?: boolean;
|
|
351
|
-
outfile?: string;
|
|
352
|
-
metafile?: boolean;
|
|
353
|
-
outdir?: string;
|
|
354
|
-
outbase?: string;
|
|
355
|
-
external?: string[];
|
|
356
|
-
packages?: "bundle" | "external";
|
|
357
|
-
alias?: Record<string, string>;
|
|
358
|
-
loader?: {
|
|
359
|
-
[ext: string]: esbuild.Loader;
|
|
360
|
-
};
|
|
361
|
-
resolveExtensions?: string[];
|
|
362
|
-
mainFields?: string[];
|
|
363
|
-
conditions?: string[];
|
|
364
|
-
write?: boolean;
|
|
365
|
-
allowOverwrite?: boolean;
|
|
366
|
-
tsconfig?: string;
|
|
367
|
-
outExtension?: {
|
|
368
|
-
[ext: string]: string;
|
|
369
|
-
};
|
|
370
|
-
publicPath?: string;
|
|
371
|
-
entryNames?: string;
|
|
372
|
-
chunkNames?: string;
|
|
373
|
-
assetNames?: string;
|
|
374
|
-
inject?: string[];
|
|
375
|
-
banner?: {
|
|
376
|
-
[type: string]: string;
|
|
377
|
-
};
|
|
378
|
-
footer?: {
|
|
379
|
-
[type: string]: string;
|
|
380
|
-
};
|
|
381
|
-
entryPoints?: string[] | Record<string, string> | {
|
|
382
|
-
in: string;
|
|
383
|
-
out: string;
|
|
384
|
-
}[];
|
|
385
|
-
stdin?: esbuild.StdinOptions;
|
|
386
|
-
absWorkingDir?: string;
|
|
387
|
-
nodePaths?: string[];
|
|
388
|
-
sourcemap: boolean | "linked" | "inline" | "external" | "both";
|
|
389
|
-
legalComments?: "none" | "inline" | "eof" | "linked" | "external";
|
|
390
|
-
sourceRoot?: string;
|
|
391
|
-
sourcesContent?: boolean;
|
|
392
|
-
format?: Format;
|
|
393
|
-
globalName?: string;
|
|
394
|
-
target?: string | string[];
|
|
395
|
-
supported?: Record<string, boolean>;
|
|
396
|
-
platform?: esbuild.Platform;
|
|
397
|
-
mangleProps?: RegExp;
|
|
398
|
-
reserveProps?: RegExp;
|
|
399
|
-
mangleQuoted?: boolean;
|
|
400
|
-
mangleCache?: Record<string, string | false>;
|
|
401
|
-
drop?: esbuild.Drop[];
|
|
402
|
-
dropLabels?: string[];
|
|
403
|
-
minify?: boolean;
|
|
404
|
-
minifyWhitespace?: boolean;
|
|
405
|
-
minifyIdentifiers?: boolean;
|
|
406
|
-
minifySyntax?: boolean;
|
|
407
|
-
lineLimit?: number;
|
|
408
|
-
charset?: esbuild.Charset;
|
|
409
|
-
treeShaking?: boolean;
|
|
410
|
-
ignoreAnnotations?: boolean;
|
|
411
|
-
jsx?: "transform" | "preserve" | "automatic";
|
|
412
|
-
jsxFactory?: string;
|
|
413
|
-
jsxFragment?: string;
|
|
414
|
-
jsxImportSource?: string;
|
|
415
|
-
jsxDev?: boolean;
|
|
416
|
-
jsxSideEffects?: boolean;
|
|
417
|
-
define?: {
|
|
418
|
-
[key: string]: string;
|
|
419
|
-
};
|
|
420
|
-
pure?: string[];
|
|
421
|
-
keepNames?: boolean;
|
|
422
|
-
color?: boolean;
|
|
423
|
-
logLevel?: esbuild.LogLevel;
|
|
424
|
-
logLimit?: number;
|
|
425
|
-
logOverride?: Record<string, esbuild.LogLevel>;
|
|
426
|
-
tsconfigRaw?: string | esbuild.TsconfigRaw;
|
|
427
|
-
}>]>;
|
|
428
|
-
export declare function nodeTpl(input: string, output: string, format?: Format | "umd", external?: string[]): Promise<void> | Promise<esbuild.BuildResult<{
|
|
429
|
-
plugins: esbuild.Plugin[];
|
|
430
|
-
bundle?: boolean;
|
|
431
|
-
splitting?: boolean;
|
|
432
|
-
preserveSymlinks?: boolean;
|
|
433
|
-
outfile?: string;
|
|
434
|
-
metafile?: boolean;
|
|
435
|
-
outdir?: string;
|
|
436
|
-
outbase?: string;
|
|
437
|
-
external?: string[];
|
|
438
|
-
packages?: "bundle" | "external";
|
|
439
|
-
alias?: Record<string, string>;
|
|
440
|
-
loader?: {
|
|
441
|
-
[ext: string]: esbuild.Loader;
|
|
442
|
-
};
|
|
443
|
-
resolveExtensions?: string[];
|
|
444
|
-
mainFields?: string[];
|
|
445
|
-
conditions?: string[];
|
|
446
|
-
write?: boolean;
|
|
447
|
-
allowOverwrite?: boolean;
|
|
448
|
-
tsconfig?: string;
|
|
449
|
-
outExtension?: {
|
|
450
|
-
[ext: string]: string;
|
|
451
|
-
};
|
|
452
|
-
publicPath?: string;
|
|
453
|
-
entryNames?: string;
|
|
454
|
-
chunkNames?: string;
|
|
455
|
-
assetNames?: string;
|
|
456
|
-
inject?: string[];
|
|
457
|
-
banner?: {
|
|
458
|
-
[type: string]: string;
|
|
459
|
-
};
|
|
460
|
-
footer?: {
|
|
461
|
-
[type: string]: string;
|
|
462
|
-
};
|
|
463
|
-
entryPoints?: string[] | Record<string, string> | {
|
|
464
|
-
in: string;
|
|
465
|
-
out: string;
|
|
466
|
-
}[];
|
|
467
|
-
stdin?: esbuild.StdinOptions;
|
|
468
|
-
absWorkingDir?: string;
|
|
469
|
-
nodePaths?: string[];
|
|
470
|
-
sourcemap: boolean | "linked" | "inline" | "external" | "both";
|
|
471
|
-
legalComments?: "none" | "inline" | "eof" | "linked" | "external";
|
|
472
|
-
sourceRoot?: string;
|
|
473
|
-
sourcesContent?: boolean;
|
|
474
|
-
format?: Format;
|
|
475
|
-
globalName?: string;
|
|
476
|
-
target?: string | string[];
|
|
477
|
-
supported?: Record<string, boolean>;
|
|
478
|
-
platform?: esbuild.Platform;
|
|
479
|
-
mangleProps?: RegExp;
|
|
480
|
-
reserveProps?: RegExp;
|
|
481
|
-
mangleQuoted?: boolean;
|
|
482
|
-
mangleCache?: Record<string, string | false>;
|
|
483
|
-
drop?: esbuild.Drop[];
|
|
484
|
-
dropLabels?: string[];
|
|
485
|
-
minify?: boolean;
|
|
486
|
-
minifyWhitespace?: boolean;
|
|
487
|
-
minifyIdentifiers?: boolean;
|
|
488
|
-
minifySyntax?: boolean;
|
|
489
|
-
lineLimit?: number;
|
|
490
|
-
charset?: esbuild.Charset;
|
|
491
|
-
treeShaking?: boolean;
|
|
492
|
-
ignoreAnnotations?: boolean;
|
|
493
|
-
jsx?: "transform" | "preserve" | "automatic";
|
|
494
|
-
jsxFactory?: string;
|
|
495
|
-
jsxFragment?: string;
|
|
496
|
-
jsxImportSource?: string;
|
|
497
|
-
jsxDev?: boolean;
|
|
498
|
-
jsxSideEffects?: boolean;
|
|
499
|
-
define?: {
|
|
500
|
-
[key: string]: string;
|
|
501
|
-
};
|
|
502
|
-
pure?: string[];
|
|
503
|
-
keepNames?: boolean;
|
|
504
|
-
color?: boolean;
|
|
505
|
-
logLevel?: esbuild.LogLevel;
|
|
506
|
-
logLimit?: number;
|
|
507
|
-
logOverride?: Record<string, esbuild.LogLevel>;
|
|
508
|
-
tsconfigRaw?: string | esbuild.TsconfigRaw;
|
|
509
|
-
}>>;
|
|
510
|
-
export declare function neutralTpl(input: string, output: string, format?: Format | "umd", globalName?: string, libraryName?: string, external?: string[]): Promise<void> | Promise<esbuild.BuildResult<{
|
|
511
|
-
plugins: esbuild.Plugin[];
|
|
512
|
-
bundle?: boolean;
|
|
513
|
-
splitting?: boolean;
|
|
514
|
-
preserveSymlinks?: boolean;
|
|
515
|
-
outfile?: string;
|
|
516
|
-
metafile?: boolean;
|
|
517
|
-
outdir?: string;
|
|
518
|
-
outbase?: string;
|
|
519
|
-
external?: string[];
|
|
520
|
-
packages?: "bundle" | "external";
|
|
521
|
-
alias?: Record<string, string>;
|
|
522
|
-
loader?: {
|
|
523
|
-
[ext: string]: esbuild.Loader;
|
|
524
|
-
};
|
|
525
|
-
resolveExtensions?: string[];
|
|
526
|
-
mainFields?: string[];
|
|
527
|
-
conditions?: string[];
|
|
528
|
-
write?: boolean;
|
|
529
|
-
allowOverwrite?: boolean;
|
|
530
|
-
tsconfig?: string;
|
|
531
|
-
outExtension?: {
|
|
532
|
-
[ext: string]: string;
|
|
533
|
-
};
|
|
534
|
-
publicPath?: string;
|
|
535
|
-
entryNames?: string;
|
|
536
|
-
chunkNames?: string;
|
|
537
|
-
assetNames?: string;
|
|
538
|
-
inject?: string[];
|
|
539
|
-
banner?: {
|
|
540
|
-
[type: string]: string;
|
|
541
|
-
};
|
|
542
|
-
footer?: {
|
|
543
|
-
[type: string]: string;
|
|
544
|
-
};
|
|
545
|
-
entryPoints?: string[] | Record<string, string> | {
|
|
546
|
-
in: string;
|
|
547
|
-
out: string;
|
|
548
|
-
}[];
|
|
549
|
-
stdin?: esbuild.StdinOptions;
|
|
550
|
-
absWorkingDir?: string;
|
|
551
|
-
nodePaths?: string[];
|
|
552
|
-
sourcemap: boolean | "linked" | "inline" | "external" | "both";
|
|
553
|
-
legalComments?: "none" | "inline" | "eof" | "linked" | "external";
|
|
554
|
-
sourceRoot?: string;
|
|
555
|
-
sourcesContent?: boolean;
|
|
556
|
-
format?: Format;
|
|
557
|
-
globalName?: string;
|
|
558
|
-
target?: string | string[];
|
|
559
|
-
supported?: Record<string, boolean>;
|
|
560
|
-
platform?: esbuild.Platform;
|
|
561
|
-
mangleProps?: RegExp;
|
|
562
|
-
reserveProps?: RegExp;
|
|
563
|
-
mangleQuoted?: boolean;
|
|
564
|
-
mangleCache?: Record<string, string | false>;
|
|
565
|
-
drop?: esbuild.Drop[];
|
|
566
|
-
dropLabels?: string[];
|
|
567
|
-
minify?: boolean;
|
|
568
|
-
minifyWhitespace?: boolean;
|
|
569
|
-
minifyIdentifiers?: boolean;
|
|
570
|
-
minifySyntax?: boolean;
|
|
571
|
-
lineLimit?: number;
|
|
572
|
-
charset?: esbuild.Charset;
|
|
573
|
-
treeShaking?: boolean;
|
|
574
|
-
ignoreAnnotations?: boolean;
|
|
575
|
-
jsx?: "transform" | "preserve" | "automatic";
|
|
576
|
-
jsxFactory?: string;
|
|
577
|
-
jsxFragment?: string;
|
|
578
|
-
jsxImportSource?: string;
|
|
579
|
-
jsxDev?: boolean;
|
|
580
|
-
jsxSideEffects?: boolean;
|
|
581
|
-
define?: {
|
|
582
|
-
[key: string]: string;
|
|
583
|
-
};
|
|
584
|
-
pure?: string[];
|
|
585
|
-
keepNames?: boolean;
|
|
586
|
-
color?: boolean;
|
|
587
|
-
logLevel?: esbuild.LogLevel;
|
|
588
|
-
logLimit?: number;
|
|
589
|
-
logOverride?: Record<string, esbuild.LogLevel>;
|
|
590
|
-
tsconfigRaw?: string | esbuild.TsconfigRaw;
|
|
591
|
-
}>>;
|
|
592
|
-
export declare function nodeBoth(input: string, output: string, external?: string[]): Promise<[void | esbuild.BuildResult<{
|
|
593
|
-
plugins: esbuild.Plugin[];
|
|
594
|
-
bundle?: boolean;
|
|
595
|
-
splitting?: boolean;
|
|
596
|
-
preserveSymlinks?: boolean;
|
|
597
|
-
outfile?: string;
|
|
598
|
-
metafile?: boolean;
|
|
599
|
-
outdir?: string;
|
|
600
|
-
outbase?: string;
|
|
601
|
-
external?: string[];
|
|
602
|
-
packages?: "bundle" | "external";
|
|
603
|
-
alias?: Record<string, string>;
|
|
604
|
-
loader?: {
|
|
605
|
-
[ext: string]: esbuild.Loader;
|
|
606
|
-
};
|
|
607
|
-
resolveExtensions?: string[];
|
|
608
|
-
mainFields?: string[];
|
|
609
|
-
conditions?: string[];
|
|
610
|
-
write?: boolean;
|
|
611
|
-
allowOverwrite?: boolean;
|
|
612
|
-
tsconfig?: string;
|
|
613
|
-
outExtension?: {
|
|
614
|
-
[ext: string]: string;
|
|
615
|
-
};
|
|
616
|
-
publicPath?: string;
|
|
617
|
-
entryNames?: string;
|
|
618
|
-
chunkNames?: string;
|
|
619
|
-
assetNames?: string;
|
|
620
|
-
inject?: string[];
|
|
621
|
-
banner?: {
|
|
622
|
-
[type: string]: string;
|
|
623
|
-
};
|
|
624
|
-
footer?: {
|
|
625
|
-
[type: string]: string;
|
|
626
|
-
};
|
|
627
|
-
entryPoints?: string[] | Record<string, string> | {
|
|
628
|
-
in: string;
|
|
629
|
-
out: string;
|
|
630
|
-
}[];
|
|
631
|
-
stdin?: esbuild.StdinOptions;
|
|
632
|
-
absWorkingDir?: string;
|
|
633
|
-
nodePaths?: string[];
|
|
634
|
-
sourcemap: boolean | "linked" | "inline" | "external" | "both";
|
|
635
|
-
legalComments?: "none" | "inline" | "eof" | "linked" | "external";
|
|
636
|
-
sourceRoot?: string;
|
|
637
|
-
sourcesContent?: boolean;
|
|
638
|
-
format?: Format;
|
|
639
|
-
globalName?: string;
|
|
640
|
-
target?: string | string[];
|
|
641
|
-
supported?: Record<string, boolean>;
|
|
642
|
-
platform?: esbuild.Platform;
|
|
643
|
-
mangleProps?: RegExp;
|
|
644
|
-
reserveProps?: RegExp;
|
|
645
|
-
mangleQuoted?: boolean;
|
|
646
|
-
mangleCache?: Record<string, string | false>;
|
|
647
|
-
drop?: esbuild.Drop[];
|
|
648
|
-
dropLabels?: string[];
|
|
649
|
-
minify?: boolean;
|
|
650
|
-
minifyWhitespace?: boolean;
|
|
651
|
-
minifyIdentifiers?: boolean;
|
|
652
|
-
minifySyntax?: boolean;
|
|
653
|
-
lineLimit?: number;
|
|
654
|
-
charset?: esbuild.Charset;
|
|
655
|
-
treeShaking?: boolean;
|
|
656
|
-
ignoreAnnotations?: boolean;
|
|
657
|
-
jsx?: "transform" | "preserve" | "automatic";
|
|
658
|
-
jsxFactory?: string;
|
|
659
|
-
jsxFragment?: string;
|
|
660
|
-
jsxImportSource?: string;
|
|
661
|
-
jsxDev?: boolean;
|
|
662
|
-
jsxSideEffects?: boolean;
|
|
663
|
-
define?: {
|
|
664
|
-
[key: string]: string;
|
|
665
|
-
};
|
|
666
|
-
pure?: string[];
|
|
667
|
-
keepNames?: boolean;
|
|
668
|
-
color?: boolean;
|
|
669
|
-
logLevel?: esbuild.LogLevel;
|
|
670
|
-
logLimit?: number;
|
|
671
|
-
logOverride?: Record<string, esbuild.LogLevel>;
|
|
672
|
-
tsconfigRaw?: string | esbuild.TsconfigRaw;
|
|
673
|
-
}>, void | esbuild.BuildResult<{
|
|
674
|
-
plugins: esbuild.Plugin[];
|
|
675
|
-
bundle?: boolean;
|
|
676
|
-
splitting?: boolean;
|
|
677
|
-
preserveSymlinks?: boolean;
|
|
678
|
-
outfile?: string;
|
|
679
|
-
metafile?: boolean;
|
|
680
|
-
outdir?: string;
|
|
681
|
-
outbase?: string;
|
|
682
|
-
external?: string[];
|
|
683
|
-
packages?: "bundle" | "external";
|
|
684
|
-
alias?: Record<string, string>;
|
|
685
|
-
loader?: {
|
|
686
|
-
[ext: string]: esbuild.Loader;
|
|
687
|
-
};
|
|
688
|
-
resolveExtensions?: string[];
|
|
689
|
-
mainFields?: string[];
|
|
690
|
-
conditions?: string[];
|
|
691
|
-
write?: boolean;
|
|
692
|
-
allowOverwrite?: boolean;
|
|
693
|
-
tsconfig?: string;
|
|
694
|
-
outExtension?: {
|
|
695
|
-
[ext: string]: string;
|
|
696
|
-
};
|
|
697
|
-
publicPath?: string;
|
|
698
|
-
entryNames?: string;
|
|
699
|
-
chunkNames?: string;
|
|
700
|
-
assetNames?: string;
|
|
701
|
-
inject?: string[];
|
|
702
|
-
banner?: {
|
|
703
|
-
[type: string]: string;
|
|
704
|
-
};
|
|
705
|
-
footer?: {
|
|
706
|
-
[type: string]: string;
|
|
707
|
-
};
|
|
708
|
-
entryPoints?: string[] | Record<string, string> | {
|
|
709
|
-
in: string;
|
|
710
|
-
out: string;
|
|
711
|
-
}[];
|
|
712
|
-
stdin?: esbuild.StdinOptions;
|
|
713
|
-
absWorkingDir?: string;
|
|
714
|
-
nodePaths?: string[];
|
|
715
|
-
sourcemap: boolean | "linked" | "inline" | "external" | "both";
|
|
716
|
-
legalComments?: "none" | "inline" | "eof" | "linked" | "external";
|
|
717
|
-
sourceRoot?: string;
|
|
718
|
-
sourcesContent?: boolean;
|
|
719
|
-
format?: Format;
|
|
720
|
-
globalName?: string;
|
|
721
|
-
target?: string | string[];
|
|
722
|
-
supported?: Record<string, boolean>;
|
|
723
|
-
platform?: esbuild.Platform;
|
|
724
|
-
mangleProps?: RegExp;
|
|
725
|
-
reserveProps?: RegExp;
|
|
726
|
-
mangleQuoted?: boolean;
|
|
727
|
-
mangleCache?: Record<string, string | false>;
|
|
728
|
-
drop?: esbuild.Drop[];
|
|
729
|
-
dropLabels?: string[];
|
|
730
|
-
minify?: boolean;
|
|
731
|
-
minifyWhitespace?: boolean;
|
|
732
|
-
minifyIdentifiers?: boolean;
|
|
733
|
-
minifySyntax?: boolean;
|
|
734
|
-
lineLimit?: number;
|
|
735
|
-
charset?: esbuild.Charset;
|
|
736
|
-
treeShaking?: boolean;
|
|
737
|
-
ignoreAnnotations?: boolean;
|
|
738
|
-
jsx?: "transform" | "preserve" | "automatic";
|
|
739
|
-
jsxFactory?: string;
|
|
740
|
-
jsxFragment?: string;
|
|
741
|
-
jsxImportSource?: string;
|
|
742
|
-
jsxDev?: boolean;
|
|
743
|
-
jsxSideEffects?: boolean;
|
|
744
|
-
define?: {
|
|
745
|
-
[key: string]: string;
|
|
746
|
-
};
|
|
747
|
-
pure?: string[];
|
|
748
|
-
keepNames?: boolean;
|
|
749
|
-
color?: boolean;
|
|
750
|
-
logLevel?: esbuild.LogLevel;
|
|
751
|
-
logLimit?: number;
|
|
752
|
-
logOverride?: Record<string, esbuild.LogLevel>;
|
|
753
|
-
tsconfigRaw?: string | esbuild.TsconfigRaw;
|
|
754
|
-
}>]>;
|
|
755
|
-
export declare function bothTpl(input: string, output: string, globalName?: string, libraryName?: string, external?: string[]): Promise<[[void | esbuild.BuildResult<{
|
|
756
|
-
plugins: esbuild.Plugin[];
|
|
757
|
-
bundle?: boolean;
|
|
758
|
-
splitting?: boolean;
|
|
759
|
-
preserveSymlinks?: boolean;
|
|
760
|
-
outfile?: string;
|
|
761
|
-
metafile?: boolean;
|
|
762
|
-
outdir?: string;
|
|
763
|
-
outbase?: string;
|
|
764
|
-
external?: string[];
|
|
765
|
-
packages?: "bundle" | "external";
|
|
766
|
-
alias?: Record<string, string>;
|
|
767
|
-
loader?: {
|
|
768
|
-
[ext: string]: esbuild.Loader;
|
|
769
|
-
};
|
|
770
|
-
resolveExtensions?: string[];
|
|
771
|
-
mainFields?: string[];
|
|
772
|
-
conditions?: string[];
|
|
773
|
-
write?: boolean;
|
|
774
|
-
allowOverwrite?: boolean;
|
|
775
|
-
tsconfig?: string;
|
|
776
|
-
outExtension?: {
|
|
777
|
-
[ext: string]: string;
|
|
778
|
-
};
|
|
779
|
-
publicPath?: string;
|
|
780
|
-
entryNames?: string;
|
|
781
|
-
chunkNames?: string;
|
|
782
|
-
assetNames?: string;
|
|
783
|
-
inject?: string[];
|
|
784
|
-
banner?: {
|
|
785
|
-
[type: string]: string;
|
|
786
|
-
};
|
|
787
|
-
footer?: {
|
|
788
|
-
[type: string]: string;
|
|
789
|
-
};
|
|
790
|
-
entryPoints?: string[] | Record<string, string> | {
|
|
791
|
-
in: string;
|
|
792
|
-
out: string;
|
|
793
|
-
}[];
|
|
794
|
-
stdin?: esbuild.StdinOptions;
|
|
795
|
-
absWorkingDir?: string;
|
|
796
|
-
nodePaths?: string[];
|
|
797
|
-
sourcemap: boolean | "linked" | "inline" | "external" | "both";
|
|
798
|
-
legalComments?: "none" | "inline" | "eof" | "linked" | "external";
|
|
799
|
-
sourceRoot?: string;
|
|
800
|
-
sourcesContent?: boolean;
|
|
801
|
-
format?: Format;
|
|
802
|
-
globalName?: string;
|
|
803
|
-
target?: string | string[];
|
|
804
|
-
supported?: Record<string, boolean>;
|
|
805
|
-
platform?: esbuild.Platform;
|
|
806
|
-
mangleProps?: RegExp;
|
|
807
|
-
reserveProps?: RegExp;
|
|
808
|
-
mangleQuoted?: boolean;
|
|
809
|
-
mangleCache?: Record<string, string | false>;
|
|
810
|
-
drop?: esbuild.Drop[];
|
|
811
|
-
dropLabels?: string[];
|
|
812
|
-
minify?: boolean;
|
|
813
|
-
minifyWhitespace?: boolean;
|
|
814
|
-
minifyIdentifiers?: boolean;
|
|
815
|
-
minifySyntax?: boolean;
|
|
816
|
-
lineLimit?: number;
|
|
817
|
-
charset?: esbuild.Charset;
|
|
818
|
-
treeShaking?: boolean;
|
|
819
|
-
ignoreAnnotations?: boolean;
|
|
820
|
-
jsx?: "transform" | "preserve" | "automatic";
|
|
821
|
-
jsxFactory?: string;
|
|
822
|
-
jsxFragment?: string;
|
|
823
|
-
jsxImportSource?: string;
|
|
824
|
-
jsxDev?: boolean;
|
|
825
|
-
jsxSideEffects?: boolean;
|
|
826
|
-
define?: {
|
|
827
|
-
[key: string]: string;
|
|
828
|
-
};
|
|
829
|
-
pure?: string[];
|
|
830
|
-
keepNames?: boolean;
|
|
831
|
-
color?: boolean;
|
|
832
|
-
logLevel?: esbuild.LogLevel;
|
|
833
|
-
logLimit?: number;
|
|
834
|
-
logOverride?: Record<string, esbuild.LogLevel>;
|
|
835
|
-
tsconfigRaw?: string | esbuild.TsconfigRaw;
|
|
836
|
-
}>, void | esbuild.BuildResult<{
|
|
837
|
-
plugins: esbuild.Plugin[];
|
|
838
|
-
bundle?: boolean;
|
|
839
|
-
splitting?: boolean;
|
|
840
|
-
preserveSymlinks?: boolean;
|
|
841
|
-
outfile?: string;
|
|
842
|
-
metafile?: boolean;
|
|
843
|
-
outdir?: string;
|
|
844
|
-
outbase?: string;
|
|
845
|
-
external?: string[];
|
|
846
|
-
packages?: "bundle" | "external";
|
|
847
|
-
alias?: Record<string, string>;
|
|
848
|
-
loader?: {
|
|
849
|
-
[ext: string]: esbuild.Loader;
|
|
850
|
-
};
|
|
851
|
-
resolveExtensions?: string[];
|
|
852
|
-
mainFields?: string[];
|
|
853
|
-
conditions?: string[];
|
|
854
|
-
write?: boolean;
|
|
855
|
-
allowOverwrite?: boolean;
|
|
856
|
-
tsconfig?: string;
|
|
857
|
-
outExtension?: {
|
|
858
|
-
[ext: string]: string;
|
|
859
|
-
};
|
|
860
|
-
publicPath?: string;
|
|
861
|
-
entryNames?: string;
|
|
862
|
-
chunkNames?: string;
|
|
863
|
-
assetNames?: string;
|
|
864
|
-
inject?: string[];
|
|
865
|
-
banner?: {
|
|
866
|
-
[type: string]: string;
|
|
867
|
-
};
|
|
868
|
-
footer?: {
|
|
869
|
-
[type: string]: string;
|
|
870
|
-
};
|
|
871
|
-
entryPoints?: string[] | Record<string, string> | {
|
|
872
|
-
in: string;
|
|
873
|
-
out: string;
|
|
874
|
-
}[];
|
|
875
|
-
stdin?: esbuild.StdinOptions;
|
|
876
|
-
absWorkingDir?: string;
|
|
877
|
-
nodePaths?: string[];
|
|
878
|
-
sourcemap: boolean | "linked" | "inline" | "external" | "both";
|
|
879
|
-
legalComments?: "none" | "inline" | "eof" | "linked" | "external";
|
|
880
|
-
sourceRoot?: string;
|
|
881
|
-
sourcesContent?: boolean;
|
|
882
|
-
format?: Format;
|
|
883
|
-
globalName?: string;
|
|
884
|
-
target?: string | string[];
|
|
885
|
-
supported?: Record<string, boolean>;
|
|
886
|
-
platform?: esbuild.Platform;
|
|
887
|
-
mangleProps?: RegExp;
|
|
888
|
-
reserveProps?: RegExp;
|
|
889
|
-
mangleQuoted?: boolean;
|
|
890
|
-
mangleCache?: Record<string, string | false>;
|
|
891
|
-
drop?: esbuild.Drop[];
|
|
892
|
-
dropLabels?: string[];
|
|
893
|
-
minify?: boolean;
|
|
894
|
-
minifyWhitespace?: boolean;
|
|
895
|
-
minifyIdentifiers?: boolean;
|
|
896
|
-
minifySyntax?: boolean;
|
|
897
|
-
lineLimit?: number;
|
|
898
|
-
charset?: esbuild.Charset;
|
|
899
|
-
treeShaking?: boolean;
|
|
900
|
-
ignoreAnnotations?: boolean;
|
|
901
|
-
jsx?: "transform" | "preserve" | "automatic";
|
|
902
|
-
jsxFactory?: string;
|
|
903
|
-
jsxFragment?: string;
|
|
904
|
-
jsxImportSource?: string;
|
|
905
|
-
jsxDev?: boolean;
|
|
906
|
-
jsxSideEffects?: boolean;
|
|
907
|
-
define?: {
|
|
908
|
-
[key: string]: string;
|
|
909
|
-
};
|
|
910
|
-
pure?: string[];
|
|
911
|
-
keepNames?: boolean;
|
|
912
|
-
color?: boolean;
|
|
913
|
-
logLevel?: esbuild.LogLevel;
|
|
914
|
-
logLimit?: number;
|
|
915
|
-
logOverride?: Record<string, esbuild.LogLevel>;
|
|
916
|
-
tsconfigRaw?: string | esbuild.TsconfigRaw;
|
|
917
|
-
}>], void | esbuild.BuildResult<{
|
|
918
|
-
plugins: esbuild.Plugin[];
|
|
919
|
-
bundle?: boolean;
|
|
920
|
-
splitting?: boolean;
|
|
921
|
-
preserveSymlinks?: boolean;
|
|
922
|
-
outfile?: string;
|
|
923
|
-
metafile?: boolean;
|
|
924
|
-
outdir?: string;
|
|
925
|
-
outbase?: string;
|
|
926
|
-
external?: string[];
|
|
927
|
-
packages?: "bundle" | "external";
|
|
928
|
-
alias?: Record<string, string>;
|
|
929
|
-
loader?: {
|
|
930
|
-
[ext: string]: esbuild.Loader;
|
|
931
|
-
};
|
|
932
|
-
resolveExtensions?: string[];
|
|
933
|
-
mainFields?: string[];
|
|
934
|
-
conditions?: string[];
|
|
935
|
-
write?: boolean;
|
|
936
|
-
allowOverwrite?: boolean;
|
|
937
|
-
tsconfig?: string;
|
|
938
|
-
outExtension?: {
|
|
939
|
-
[ext: string]: string;
|
|
940
|
-
};
|
|
941
|
-
publicPath?: string;
|
|
942
|
-
entryNames?: string;
|
|
943
|
-
chunkNames?: string;
|
|
944
|
-
assetNames?: string;
|
|
945
|
-
inject?: string[];
|
|
946
|
-
banner?: {
|
|
947
|
-
[type: string]: string;
|
|
948
|
-
};
|
|
949
|
-
footer?: {
|
|
950
|
-
[type: string]: string;
|
|
951
|
-
};
|
|
952
|
-
entryPoints?: string[] | Record<string, string> | {
|
|
953
|
-
in: string;
|
|
954
|
-
out: string;
|
|
955
|
-
}[];
|
|
956
|
-
stdin?: esbuild.StdinOptions;
|
|
957
|
-
absWorkingDir?: string;
|
|
958
|
-
nodePaths?: string[];
|
|
959
|
-
sourcemap: boolean | "linked" | "inline" | "external" | "both";
|
|
960
|
-
legalComments?: "none" | "inline" | "eof" | "linked" | "external";
|
|
961
|
-
sourceRoot?: string;
|
|
962
|
-
sourcesContent?: boolean;
|
|
963
|
-
format?: Format;
|
|
964
|
-
globalName?: string;
|
|
965
|
-
target?: string | string[];
|
|
966
|
-
supported?: Record<string, boolean>;
|
|
967
|
-
platform?: esbuild.Platform;
|
|
968
|
-
mangleProps?: RegExp;
|
|
969
|
-
reserveProps?: RegExp;
|
|
970
|
-
mangleQuoted?: boolean;
|
|
971
|
-
mangleCache?: Record<string, string | false>;
|
|
972
|
-
drop?: esbuild.Drop[];
|
|
973
|
-
dropLabels?: string[];
|
|
974
|
-
minify?: boolean;
|
|
975
|
-
minifyWhitespace?: boolean;
|
|
976
|
-
minifyIdentifiers?: boolean;
|
|
977
|
-
minifySyntax?: boolean;
|
|
978
|
-
lineLimit?: number;
|
|
979
|
-
charset?: esbuild.Charset;
|
|
980
|
-
treeShaking?: boolean;
|
|
981
|
-
ignoreAnnotations?: boolean;
|
|
982
|
-
jsx?: "transform" | "preserve" | "automatic";
|
|
983
|
-
jsxFactory?: string;
|
|
984
|
-
jsxFragment?: string;
|
|
985
|
-
jsxImportSource?: string;
|
|
986
|
-
jsxDev?: boolean;
|
|
987
|
-
jsxSideEffects?: boolean;
|
|
988
|
-
define?: {
|
|
989
|
-
[key: string]: string;
|
|
990
|
-
};
|
|
991
|
-
pure?: string[];
|
|
992
|
-
keepNames?: boolean;
|
|
993
|
-
color?: boolean;
|
|
994
|
-
logLevel?: esbuild.LogLevel;
|
|
995
|
-
logLimit?: number;
|
|
996
|
-
logOverride?: Record<string, esbuild.LogLevel>;
|
|
997
|
-
tsconfigRaw?: string | esbuild.TsconfigRaw;
|
|
998
|
-
}>]>;
|
|
17
|
+
export declare function browserTpl(input: string, output: string, format?: Format | "umd", globalName?: string, libraryName?: string, external?: string[]): Promise<void>;
|
|
18
|
+
export declare function nodeTpl(input: string, output: string, format?: Format | "umd", external?: string[]): Promise<void>;
|
|
19
|
+
export declare function neutralTpl(input: string, output: string, format?: Format | "umd", globalName?: string, libraryName?: string, external?: string[]): Promise<void>;
|
|
20
|
+
export declare function browserBoth(input: string, output: string, globalName?: string, libraryName?: string, external?: string[]): Promise<[void, void]>;
|
|
21
|
+
export declare function nodeBoth(input: string, output: string, external?: string[]): Promise<[void, void]>;
|
|
22
|
+
export declare function bothTpl(input: string, output: string, globalName?: string, libraryName?: string, external?: string[]): Promise<[[void, void], void]>;
|