@hpcc-js/esbuild-plugins 1.0.10 → 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/LICENSE ADDED
@@ -0,0 +1,43 @@
1
+ HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
14
+
15
+
16
+ Intersection Algorithms Provided by Kevin Lindsey
17
+ Copyright (c) 2000-2011, Kevin Lindsey
18
+ All rights reserved.
19
+
20
+ Redistribution and use in source and binary forms, with or without
21
+ modification, are permitted provided that the following conditions are met:
22
+
23
+ - Redistributions of source code must retain the above copyright notice,
24
+ this list of conditions and the following disclaimer.
25
+
26
+ - Redistributions in binary form must reproduce the above copyright
27
+ notice, this list of conditions and the following disclaimer in the
28
+ documentation and/or other materials provided with the distribution.
29
+
30
+ - Neither the name of this software nor the names of its contributors
31
+ may be used to endorse or promote products derived from this software
32
+ without specific prior written permission.
33
+
34
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
35
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
36
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
37
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
38
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
39
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
40
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
41
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
42
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
43
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -1,45 +1,45 @@
1
- # esbuild-plugin-sfx-wasm
2
-
3
- ## Installation
4
-
5
- With npm:
6
-
7
- ```sh
8
- npm i -D esbuild-plugin-sfx-wasm
9
- ```
10
-
11
- ## Use-cases
12
-
13
- **The primary motivation for this plugin is to simplify the bundling and distribution of web assembly modules**
14
-
15
- - Compresses the wasm module using Zstd
16
- - Encodes the compressed wasm module as a base91 string
17
- - Generates a standalone module that decodes and instantiates the wasm module on demand
18
-
19
- ## Usage
20
-
21
- ### Build Config
22
-
23
- ```ts
24
- import esbuild from "esbuild";
25
- import sfxWasm from "esbuild-plugin-sfx-wasm";
26
-
27
- esbuild.build({
28
- /* ... */
29
- plugins: [
30
- sfxWasm()
31
- ],
32
- /* ... */
33
- });
34
- ```
35
-
36
- ### Usage in your code
37
-
38
- ```js
39
- import loadCalculator from "../build/calculator.wasm";
40
-
41
- async function add(a, b) {
42
- const calc = await loadCalculator();
43
- return calc.add(1, 2);
44
- }
45
- ```
1
+ # esbuild-plugin-sfx-wasm
2
+
3
+ ## Installation
4
+
5
+ With npm:
6
+
7
+ ```sh
8
+ npm i -D esbuild-plugin-sfx-wasm
9
+ ```
10
+
11
+ ## Use-cases
12
+
13
+ **The primary motivation for this plugin is to simplify the bundling and distribution of web assembly modules**
14
+
15
+ - Compresses the wasm module using Zstd
16
+ - Encodes the compressed wasm module as a base91 string
17
+ - Generates a standalone module that decodes and instantiates the wasm module on demand
18
+
19
+ ## Usage
20
+
21
+ ### Build Config
22
+
23
+ ```ts
24
+ import esbuild from "esbuild";
25
+ import sfxWasm from "esbuild-plugin-sfx-wasm";
26
+
27
+ esbuild.build({
28
+ /* ... */
29
+ plugins: [
30
+ sfxWasm()
31
+ ],
32
+ /* ... */
33
+ });
34
+ ```
35
+
36
+ ### Usage in your code
37
+
38
+ ```js
39
+ import loadCalculator from "../build/calculator.wasm";
40
+
41
+ async function add(a, b) {
42
+ const calc = await loadCalculator();
43
+ return calc.add(1, 2);
44
+ }
45
+ ```
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import*as s from"process";import{readFileSync as E}from"fs";import*as f from"path";import*as l from"esbuild";import{umdWrapper as b}from"esbuild-plugin-umd-wrapper";import F from"yargs";import{hideBin as J}from"yargs/helpers";function c(e){return{name:"rebuild-logger",setup(t){t.onStart(()=>{console.log("[watch] build started")}),t.onEnd(()=>{console.log(`Rebuilt ${e.outfile??"Unknown"}`)})}}}import{readFile as $}from"fs/promises";import{existsSync as j}from"fs";import{Base91 as v}from"@hpcc-js/wasm-base91";import{Zstd as S}from"@hpcc-js/wasm-zstd";function O(e,t,r){let o=r.length+8192<=t.length,n=j(e);return`${o?'import { decompress } from "fzstd";':""}
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
2
  ${n?`import wrapper from "${e}";`:""}
3
3
 
4
4
  const table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&()*+,./:;<=>?@[]^_\`{|}~"';
@@ -37,13 +37,13 @@ function decode(raw: string): Uint8Array {
37
37
  return new Uint8Array(ret);
38
38
  }
39
39
 
40
- const blobStr = '${o?r:t}';
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 = ${o?"decompress(decode(blobStr))":"decode(blobStr)"};
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 _(e){let t=await v.load(),r=await S.load(),o=await $(e);e=e.replace(/\.js$/,".xxx");let n=e.replace(/\.wasm$/,".js"),i=t.encode(o),P=r.compress(o),B=t.encode(P);return O(n,i,B)}function u(){return{name:"sfx-wasm",setup(e){e.onLoad({filter:/\.wasm$/},async t=>({contents:await _(t.path),loader:"ts"}))}}}var x=F(J(s.argv));x.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 y=JSON.parse(E(f.join(s.cwd(),"./package.json"),"utf8")),L=y.type==="module"?"js":"mjs",W=y.type==="module"?"cjs":"js",w=await x.argv,a=w.mode==="development",m=!a,A=w.watch;function h(e){return a&&Array.isArray(e.entryPoints)&&console.log("Start: ",e.entryPoints[0],e.outfile),l.build({sourcemap:"linked",...e,plugins:[...e.plugins??[],u()]}).finally(()=>{a&&Array.isArray(e.entryPoints)&&console.log("Stop: ",e.entryPoints[0],e.outfile)})}async function R(e){return await h(e),l.context({sourcemap:"external",...e,plugins:[...e.plugins??[],c(e),u()]}).then(t=>t.watch())}function d(e){return A?R(e):h(e)}function g(e,t,r="esm",o,n,i=[]){return d({entryPoints:[e],outfile:`${t}.${r==="esm"?"js":`${r}.js`}`,platform:"browser",target:"es2022",format:r,globalName:o,bundle:!0,minify:m,external:i,plugins:r==="umd"?[b({libraryName:n})]:[]})}function U(e,t,r,o,n=[]){return Promise.all([g(e,t,"esm",r,o,n),g(e,t,"umd",r,o,n)])}function p(e,t,r="esm",o=[]){return d({entryPoints:[e],outfile:`${t}.${r==="esm"?L:W}`,platform:"node",target:"node20",format:r,bundle:!0,minify:m,external:o})}function q(e,t,r="esm",o,n,i=[]){return d({entryPoints:[e],outfile:`${t}.${r==="esm"?"js":"umd.js"}`,platform:"neutral",target:"es2022",format:r,globalName:o,bundle:!0,minify:m,external:i,plugins:r==="umd"?[b({libraryName:n})]:[]})}function G(e,t,r=[]){return Promise.all([p(e,t,"esm",r),p(e,t,"cjs",r)])}function H(e,t,r,o,n=[]){return Promise.all([U(e,t,r,o,n),p(e,t,"cjs",n)])}import{readFile as z}from"fs/promises";function te(e){return{name:"exclude-sourcemap",setup(t){t.onLoad({filter:e.filter},async r=>({contents:await z(r.path,"utf8")+`
64
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIiJdLCJtYXBwaW5ncyI6IkEifQ==`,loader:"default"}))}}}function oe(){return{name:"problem-matcher",setup(e){e.onStart(()=>{console.log("[watch] build started")}),e.onEnd(t=>{t.errors.forEach(({text:r,location:o})=>{console.error(`\u2718 [ERROR] ${r}`),console.error(` ${o?.file}:${o?.line}:${o?.column}:`)}),console.log("[watch] build finished")})}}}export{W as NODE_CJS,L as NODE_MJS,w as argv,H as bothTpl,U as browserBoth,g as browserTpl,h as build,d as buildWatch,te as excludeSourcemap,a as isDevelopment,m as isProduction,A as isWatch,q as neutralTpl,G as nodeBoth,p as nodeTpl,y as pkg,oe as problemMatcher,c as rebuildLogger,u as sfxWasm,R as watch,_ as wrap};
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
- "sources": ["../src/build.ts", "../src/rebuild-logger.ts", "../src/sfx-wrapper.ts", "../src/exclude-sourcemap.ts", "../src/problem-matcher.ts"],
4
- "sourcesContent": ["import * as process from \"process\";\r\nimport { readFileSync } from \"fs\";\r\nimport * as path from \"path\";\r\nimport * as esbuild from \"esbuild\";\r\nimport type { BuildOptions, Format } from \"esbuild\";\r\nimport { umdWrapper } from \"esbuild-plugin-umd-wrapper\";\r\nimport yargs from \"yargs\";\r\nimport { hideBin } from \"yargs/helpers\";\r\nimport { rebuildLogger } from \"./rebuild-logger.ts\";\r\nimport { sfxWasm } from \"./sfx-wrapper.ts\";\r\n\r\nconst myYargs = yargs(hideBin(process.argv));\r\nmyYargs\r\n .usage(\"Usage: node esbuild.mjs [options]\")\r\n .demandCommand(0, 0)\r\n .example(\"node esbuild.mjs --watch\", \"Bundle and watch for changes\")\r\n .option(\"mode\", {\r\n alias: \"m\",\r\n describe: \"Build mode\",\r\n choices: [\"development\", \"production\"],\r\n default: \"production\"\r\n })\r\n .option(\"w\", {\r\n alias: \"watch\",\r\n describe: \"Watch for changes\",\r\n type: \"boolean\"\r\n })\r\n .help(\"h\")\r\n .alias(\"h\", \"help\")\r\n .epilog(\"https://github.com/hpcc-systems/hpcc-js-wasm\")\r\n ;\r\n\r\nexport const pkg = JSON.parse(readFileSync(path.join(process.cwd(), \"./package.json\"), \"utf8\"));\r\nexport const NODE_MJS = pkg.type === \"module\" ? \"js\" : \"mjs\";\r\nexport const NODE_CJS = pkg.type === \"module\" ? \"cjs\" : \"js\";\r\n\r\nexport const argv = await myYargs.argv;\r\nexport const isDevelopment = argv.mode === \"development\";\r\nexport const isProduction = !isDevelopment;\r\nexport const isWatch = argv.watch;\r\n\r\nexport function build(config: BuildOptions) {\r\n if (isDevelopment && Array.isArray(config.entryPoints)) {\r\n // eslint-disable-next-line no-console\r\n console.log(\"Start: \", config.entryPoints[0], config.outfile);\r\n }\r\n return esbuild.build({\r\n sourcemap: \"linked\",\r\n ...config,\r\n plugins: [\r\n ...(config.plugins ?? []),\r\n sfxWasm()\r\n ]\r\n }).finally(() => {\r\n if (isDevelopment && Array.isArray(config.entryPoints)) {\r\n // eslint-disable-next-line no-console\r\n console.log(\"Stop: \", config.entryPoints[0], config.outfile);\r\n }\r\n });\r\n}\r\n\r\nexport async function watch(config: BuildOptions) {\r\n await build(config);\r\n return esbuild.context({\r\n sourcemap: \"external\",\r\n ...config,\r\n plugins: [\r\n ...(config.plugins ?? []),\r\n rebuildLogger(config),\r\n sfxWasm()\r\n ]\r\n }).then(ctx => {\r\n return ctx.watch();\r\n });\r\n}\r\n\r\nexport function buildWatch(config: BuildOptions) {\r\n return isWatch ? watch(config) : build(config);\r\n}\r\n\r\nexport function browserTpl(input: string, output: string, format: Format | \"umd\" = \"esm\", globalName?: string, libraryName?: string, external: string[] = []) {\r\n return buildWatch({\r\n entryPoints: [input],\r\n outfile: `${output}.${format === \"esm\" ? \"js\" : `${format}.js`}`,\r\n platform: \"browser\",\r\n target: \"es2022\",\r\n format: format as Format,\r\n globalName,\r\n bundle: true,\r\n minify: isProduction,\r\n external,\r\n plugins: format === \"umd\" ? [umdWrapper({ libraryName })] : []\r\n });\r\n}\r\n\r\nexport function browserBoth(input: string, output: string, globalName?: string, libraryName?: string, external: string[] = []) {\r\n return Promise.all([\r\n browserTpl(input, output, \"esm\", globalName, libraryName, external),\r\n browserTpl(input, output, \"umd\", globalName, libraryName, external)\r\n ]);\r\n}\r\n\r\nexport function nodeTpl(input: string, output: string, format: Format | \"umd\" = \"esm\", external: string[] = []) {\r\n return buildWatch({\r\n entryPoints: [input],\r\n outfile: `${output}.${format === \"esm\" ? NODE_MJS : NODE_CJS}`,\r\n platform: \"node\",\r\n target: \"node20\",\r\n format: format as Format,\r\n bundle: true,\r\n minify: isProduction,\r\n external\r\n });\r\n}\r\n\r\nexport function neutralTpl(input: string, output: string, format: Format | \"umd\" = \"esm\", globalName?: string, libraryName?: string, external: string[] = []) {\r\n return buildWatch({\r\n entryPoints: [input],\r\n outfile: `${output}.${format === \"esm\" ? \"js\" : \"umd.js\"}`,\r\n platform: \"neutral\",\r\n target: \"es2022\",\r\n format: format as Format,\r\n globalName,\r\n bundle: true,\r\n minify: isProduction,\r\n external,\r\n plugins: format === \"umd\" ? [umdWrapper({ libraryName })] : []\r\n });\r\n}\r\n\r\nexport function nodeBoth(input: string, output: string, external: string[] = []) {\r\n return Promise.all([\r\n nodeTpl(input, output, \"esm\", external),\r\n nodeTpl(input, output, \"cjs\", external)\r\n ]);\r\n}\r\n\r\nexport function bothTpl(input: string, output: string, globalName?: string, libraryName?: string, external: string[] = []) {\r\n return Promise.all([\r\n browserBoth(input, output, globalName, libraryName, external),\r\n nodeTpl(input, output, \"cjs\", external)\r\n ]);\r\n}\r\n", "import type { PluginBuild, Plugin } from \"esbuild\";\r\n\r\nexport interface RebuildLoggerOptions {\r\n outfile?: string;\r\n}\r\n\r\nexport function rebuildLogger(opts: RebuildLoggerOptions): Plugin {\r\n return {\r\n name: \"rebuild-logger\",\r\n\r\n setup(build: PluginBuild) {\r\n\r\n build.onStart(() => {\r\n // eslint-disable-next-line no-console\r\n console.log(\"[watch] build started\");\r\n });\r\n\r\n build.onEnd(() => {\r\n // eslint-disable-next-line no-console\r\n console.log(`Rebuilt ${opts.outfile ?? \"Unknown\"}`);\r\n });\r\n }\r\n };\r\n}\r\n", "import { readFile } from \"fs/promises\";\r\nimport { existsSync } from \"fs\";\r\nimport { Base91 } from \"@hpcc-js/wasm-base91\";\r\nimport { Zstd } from \"@hpcc-js/wasm-zstd\";\r\nimport type { Plugin, PluginBuild } from \"esbuild\";\r\n\r\nfunction tpl(wasmJsPath: string, base91Wasm: string, base91CompressedWasm: string) {\r\n\r\n const compressed = (base91CompressedWasm.length + 8 * 1024) <= base91Wasm.length;\r\n const wasmJsExists = existsSync(wasmJsPath);\r\n\r\n return `\\\r\n${compressed ? 'import { decompress } from \"fzstd\";' : \"\"}\r\n${wasmJsExists ? `import wrapper from \"${wasmJsPath}\";` : \"\"}\r\n\r\nconst table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&()*+,./:;<=>?@[]^_\\`{|}~\"';\r\n\r\nfunction decode(raw: string): Uint8Array {\r\n const len = raw.length;\r\n const ret: number[] = [];\r\n\r\n let b = 0;\r\n let n = 0;\r\n let v = -1;\r\n\r\n for (let i = 0; i < len; i++) {\r\n const p = table.indexOf(raw[i]);\r\n /* istanbul ignore next */\r\n if (p === -1) continue;\r\n if (v < 0) {\r\n v = p;\r\n } else {\r\n v += p * 91;\r\n b |= v << n;\r\n n += (v & 8191) > 88 ? 13 : 14;\r\n do {\r\n ret.push(b & 0xff);\r\n b >>= 8;\r\n n -= 8;\r\n } while (n > 7);\r\n v = -1;\r\n }\r\n }\r\n\r\n if (v > -1) {\r\n ret.push((b | v << n) & 0xff);\r\n }\r\n\r\n return new Uint8Array(ret);\r\n}\r\n\r\nconst blobStr = '${compressed ? base91CompressedWasm : base91Wasm}';\r\n\r\nlet g_module: Uint8Array | undefined;\r\nlet g_wasmBinary: Uint8Array | undefined;\r\nexport default function() {\r\n if (!g_wasmBinary) {\r\n g_wasmBinary = ${compressed ? \"decompress(decode(blobStr))\" : \"decode(blobStr)\"};\r\n }\r\n${!wasmJsExists ? `\\\r\n return g_wasmBinary;\r\n`: `\\\r\n if (!g_module) {\r\n g_module = wrapper({\r\n wasmBinary: g_wasmBinary,\r\n locateFile: undefined\r\n });\r\n }\r\n return g_module;\r\n`}\r\n}\r\n\r\nexport function reset() {\r\n if (g_module) {\r\n g_module = undefined;\r\n }\r\n} `.trim();\r\n}\r\n\r\nexport async function wrap(path: string) {\r\n const base91 = await Base91.load();\r\n const zstd = await Zstd.load();\r\n\r\n const wasm = await readFile(path);\r\n path = path.replace(/\\.js$/, \".xxx\");\r\n const wasmJsPath = path.replace(/\\.wasm$/, \".js\");\r\n const base91Wasm = base91.encode(wasm);\r\n const compressedWasm = zstd.compress(wasm);\r\n const base91CompressedWasm = base91.encode(compressedWasm);\r\n\r\n return tpl(wasmJsPath, base91Wasm, base91CompressedWasm);\r\n}\r\n\r\nexport function sfxWasm(): Plugin {\r\n return {\r\n name: \"sfx-wasm\",\r\n\r\n setup(build: PluginBuild) {\r\n\r\n build.onLoad({ filter: /\\.wasm$/ }, async args => {\r\n return {\r\n contents: await wrap(args.path),\r\n loader: \"ts\",\r\n };\r\n });\r\n }\r\n };\r\n}\r\n", "import { readFile } from \"fs/promises\";\r\nimport type { PluginBuild, Plugin } from \"esbuild\";\r\n\r\nexport interface ExcludeSourcemapOptions {\r\n filter: RegExp;\r\n}\r\nexport function excludeSourcemap(opts: ExcludeSourcemapOptions): Plugin {\r\n return {\r\n name: \"exclude-sourcemap\",\r\n\r\n setup(build: PluginBuild) {\r\n build.onLoad({ filter: opts.filter }, async args => {\r\n return {\r\n contents: await readFile(args.path, \"utf8\") + \"\\n//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIiJdLCJtYXBwaW5ncyI6IkEifQ==\",\r\n loader: \"default\",\r\n };\r\n });\r\n },\r\n };\r\n}\r\n", "import type { PluginBuild, Plugin } from \"esbuild\";\r\n\r\nexport function problemMatcher(): Plugin {\r\n return {\r\n name: \"problem-matcher\",\r\n\r\n setup(build: PluginBuild) {\r\n\r\n build.onStart(() => {\r\n // eslint-disable-next-line no-console\r\n console.log(\"[watch] build started\");\r\n });\r\n\r\n build.onEnd((result) => {\r\n result.errors.forEach(({ text, location }) => {\r\n console.error(`\u2718 [ERROR] ${text}`);\r\n console.error(` ${location?.file}:${location?.line}:${location?.column}:`);\r\n });\r\n // eslint-disable-next-line no-console\r\n console.log(\"[watch] build finished\");\r\n });\r\n }\r\n };\r\n}\r\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,C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C1C,QAAQ,MAAM,kBAAaD,CAAI,EAAE,EACjC,QAAQ,MAAM,OAAOC,GAAU,IAAI,IAAIA,GAAU,IAAI,IAAIA,GAAU,MAAM,GAAG,CAChF,CAAC,EAED,QAAQ,IAAI,wBAAwB,CACxC,CAAC,CACL,CACJ,CACJ",
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", "build", "config", "sfxWasm", "watch", "rebuildLogger", "ctx", "buildWatch", "browserTpl", "input", "output", "format", "globalName", "libraryName", "external", "umdWrapper", "browserBoth", "nodeTpl", "neutralTpl", "nodeBoth", "bothTpl", "readFile", "excludeSourcemap", "opts", "build", "args", "problemMatcher", "build", "result", "text", "location"]
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\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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M,CAEhB,QAAQ,IAAI,uBAAuB,CACvC,CAAC,EAEDA,EAAM,MAAOC,GAAW,CACpBA,EAAO,OAAO,QAAQ,CAAC,CAAE,KAAAC,EAAM,SAAAC,CAAS,IAAM,CAC1C,QAAQ,MAAM,kBAAaD,CAAI,EAAE,EACjC,QAAQ,MAAM,OAAOC,GAAU,IAAI,IAAIA,GAAU,IAAI,IAAIA,GAAU,MAAM,GAAG,CAChF,CAAC,EAED,QAAQ,IAAI,wBAAwB,CACxC,CAAC,CACL,CACJ,CACJ,CCvBA,OAAS,iBAAAC,MAAqB,UAGvB,SAASC,IAAuB,CACnC,MAAO,CACH,KAAM,gBACN,MAAMC,EAAoB,CACtBA,EAAM,eAAe,MAAQ,GAC7BA,EAAM,MAAOC,GAAW,CACpBA,GAAQ,aAAa,QAAQC,GAAQ,CACjC,GAAIA,EAAK,KAAK,SAAS,KAAK,EAAG,CAC3B,IAAMC,EAAWD,EAAK,KAAK,QAAQ,iBAAkB,EAAE,EACnDC,EAAS,QAAQ,YAAY,GAAK,GAClC,QAAQ,MAAM,mBAAoBD,EAAK,IAAI,EAE/CJ,EAAcI,EAAK,KAAMC,EAAU,CAAE,SAAU,MAAO,CAAC,CAC3D,MACIL,EAAcI,EAAK,KAAMA,EAAK,SAAU,CAAE,SAAU,QAAS,CAAC,CAEtE,CAAC,CACL,CAAC,CACL,CACJ,CACJ",
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", "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
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/sfx-wrapper.ts"],
4
- "sourcesContent": ["import { readFile } from \"fs/promises\";\r\nimport { existsSync } from \"fs\";\r\nimport { Base91 } from \"@hpcc-js/wasm-base91\";\r\nimport { Zstd } from \"@hpcc-js/wasm-zstd\";\r\nimport type { Plugin, PluginBuild } from \"esbuild\";\r\n\r\nfunction tpl(wasmJsPath: string, base91Wasm: string, base91CompressedWasm: string) {\r\n\r\n const compressed = (base91CompressedWasm.length + 8 * 1024) <= base91Wasm.length;\r\n const wasmJsExists = existsSync(wasmJsPath);\r\n\r\n return `\\\r\n${compressed ? 'import { decompress } from \"fzstd\";' : \"\"}\r\n${wasmJsExists ? `import wrapper from \"${wasmJsPath}\";` : \"\"}\r\n\r\nconst table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&()*+,./:;<=>?@[]^_\\`{|}~\"';\r\n\r\nfunction decode(raw: string): Uint8Array {\r\n const len = raw.length;\r\n const ret: number[] = [];\r\n\r\n let b = 0;\r\n let n = 0;\r\n let v = -1;\r\n\r\n for (let i = 0; i < len; i++) {\r\n const p = table.indexOf(raw[i]);\r\n /* istanbul ignore next */\r\n if (p === -1) continue;\r\n if (v < 0) {\r\n v = p;\r\n } else {\r\n v += p * 91;\r\n b |= v << n;\r\n n += (v & 8191) > 88 ? 13 : 14;\r\n do {\r\n ret.push(b & 0xff);\r\n b >>= 8;\r\n n -= 8;\r\n } while (n > 7);\r\n v = -1;\r\n }\r\n }\r\n\r\n if (v > -1) {\r\n ret.push((b | v << n) & 0xff);\r\n }\r\n\r\n return new Uint8Array(ret);\r\n}\r\n\r\nconst blobStr = '${compressed ? base91CompressedWasm : base91Wasm}';\r\n\r\nlet g_module: Uint8Array | undefined;\r\nlet g_wasmBinary: Uint8Array | undefined;\r\nexport default function() {\r\n if (!g_wasmBinary) {\r\n g_wasmBinary = ${compressed ? \"decompress(decode(blobStr))\" : \"decode(blobStr)\"};\r\n }\r\n${!wasmJsExists ? `\\\r\n return g_wasmBinary;\r\n`: `\\\r\n if (!g_module) {\r\n g_module = wrapper({\r\n wasmBinary: g_wasmBinary,\r\n locateFile: undefined\r\n });\r\n }\r\n return g_module;\r\n`}\r\n}\r\n\r\nexport function reset() {\r\n if (g_module) {\r\n g_module = undefined;\r\n }\r\n} `.trim();\r\n}\r\n\r\nexport async function wrap(path: string) {\r\n const base91 = await Base91.load();\r\n const zstd = await Zstd.load();\r\n\r\n const wasm = await readFile(path);\r\n path = path.replace(/\\.js$/, \".xxx\");\r\n const wasmJsPath = path.replace(/\\.wasm$/, \".js\");\r\n const base91Wasm = base91.encode(wasm);\r\n const compressedWasm = zstd.compress(wasm);\r\n const base91CompressedWasm = base91.encode(compressedWasm);\r\n\r\n return tpl(wasmJsPath, base91Wasm, base91CompressedWasm);\r\n}\r\n\r\nexport function sfxWasm(): Plugin {\r\n return {\r\n name: \"sfx-wasm\",\r\n\r\n setup(build: PluginBuild) {\r\n\r\n build.onLoad({ filter: /\\.wasm$/ }, async args => {\r\n return {\r\n contents: await wrap(args.path),\r\n loader: \"ts\",\r\n };\r\n });\r\n }\r\n };\r\n}\r\n"],
4
+ "sourcesContent": ["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: Plugin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AEzD,OAAOX,EAAIC,EAAYC,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",
6
6
  "names": ["readFile", "existsSync", "Base91", "Zstd", "tpl", "wasmJsPath", "base91Wasm", "base91CompressedWasm", "compressed", "wasmJsExists", "wrap", "path", "base91", "zstd", "wasm", "compressedWasm", "sfxWasm", "build", "args"]
7
7
  }
package/package.json CHANGED
@@ -1,63 +1,63 @@
1
- {
2
- "name": "@hpcc-js/esbuild-plugins",
3
- "version": "1.0.10",
4
- "description": "Various esbuild plugins",
5
- "type": "module",
6
- "exports": {
7
- ".": {
8
- "types": "./types/index.d.ts",
9
- "default": "./dist/index.js"
10
- },
11
- "./sfx-wrapper": {
12
- "types": "./types/sfx-wrapper.d.ts",
13
- "default": "./dist/sfx-wrapper.js"
14
- }
15
- },
16
- "main": "./dist/index.js",
17
- "types": "./types/index.d.ts",
18
- "files": [
19
- "dist/**/*",
20
- "src/**/*",
21
- "types/**/*"
22
- ],
23
- "scripts": {
24
- "clean": "rimraf ./dist ./types",
25
- "build-types": "tsc --project tsconfig.json --emitDeclarationOnly",
26
- "build-types-watch": "npm run build-types -- --watch",
27
- "build-ts-dev": "esbuild ./src/index.ts --platform=node --format=esm --bundle --packages=external --sourcemap --outfile=./dist/index.js",
28
- "build-ts": "npm run build-ts-dev -- --minify",
29
- "build-ts-watch": "npm run build-ts-dev -- --watch",
30
- "build-dev": "run-p build-types build-ts-dev",
31
- "build-sfx-wrapper-dev": "esbuild ./src/sfx-wrapper.ts --platform=node --format=esm --bundle --packages=external --sourcemap --outfile=./dist/sfx-wrapper.js",
32
- "build-sfx-wrapper": "npm run build-sfx-wrapper-dev -- --minify",
33
- "build": "run-p build-types build-ts build-sfx-wrapper",
34
- "lint-skypack": "npx -y @skypack/package-check",
35
- "lint-eslint": "eslint src/**/*.ts",
36
- "lint": "run-p lint-eslint lint-skypack",
37
- "test-cli": "npx . -v",
38
- "test-cli-help": "npx .",
39
- "test-node": "npx . -v",
40
- "update": "npx --yes npm-check-updates -u -t minor"
41
- },
42
- "dependencies": {
43
- "@hpcc-js/wasm-base91": "1.0.1",
44
- "@hpcc-js/wasm-zstd": "1.0.1",
45
- "yargs": "17.7.2",
46
- "fzstd": "0.1.1"
47
- },
48
- "devDependencies": {},
49
- "keywords": [
50
- "esbuild",
51
- "plugins",
52
- "WebAssembly",
53
- "wasm",
54
- "sfx"
55
- ],
56
- "author": "hpcc-systems",
57
- "repository": {
58
- "type": "git",
59
- "url": "git+https://github.com/hpcc-systems/hpcc-js-wasm.git"
60
- },
61
- "homepage": "https://hpcc-systems.github.io/hpcc-js-wasm/",
62
- "license": "Apache-2.0"
63
- }
1
+ {
2
+ "name": "@hpcc-js/esbuild-plugins",
3
+ "version": "1.1.1",
4
+ "description": "Various esbuild plugins",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./types/index.d.ts",
9
+ "default": "./dist/index.js"
10
+ },
11
+ "./sfx-wrapper": {
12
+ "types": "./types/sfx-wrapper.d.ts",
13
+ "default": "./dist/sfx-wrapper.js"
14
+ }
15
+ },
16
+ "main": "./dist/index.js",
17
+ "types": "./types/index.d.ts",
18
+ "files": [
19
+ "dist/**/*",
20
+ "src/**/*",
21
+ "types/**/*"
22
+ ],
23
+ "scripts": {
24
+ "clean": "rimraf ./dist ./types",
25
+ "build-types": "tsc --project tsconfig.json --emitDeclarationOnly",
26
+ "build-types-watch": "npm run build-types -- --watch",
27
+ "build-ts-dev": "esbuild ./src/index.ts --platform=node --format=esm --bundle --packages=external --sourcemap --outfile=./dist/index.js",
28
+ "build-ts": "npm run build-ts-dev -- --minify",
29
+ "build-ts-watch": "npm run build-ts-dev -- --watch",
30
+ "build-dev": "run-p build-types build-ts-dev",
31
+ "build-sfx-wrapper-dev": "esbuild ./src/sfx-wrapper.ts --platform=node --format=esm --bundle --packages=external --sourcemap --outfile=./dist/sfx-wrapper.js",
32
+ "build-sfx-wrapper": "npm run build-sfx-wrapper-dev -- --minify",
33
+ "build": "run-p build-types build-ts build-sfx-wrapper",
34
+ "lint-skypack": "npx -y @skypack/package-check",
35
+ "lint-eslint": "eslint src/**/*.ts",
36
+ "lint": "run-p lint-eslint lint-skypack",
37
+ "test-cli": "npx . -v",
38
+ "test-cli-help": "npx .",
39
+ "test-node": "npx . -v",
40
+ "update": "npx --yes npm-check-updates -u -t minor"
41
+ },
42
+ "dependencies": {
43
+ "@hpcc-js/wasm-base91": "1.0.1",
44
+ "@hpcc-js/wasm-zstd": "1.0.1",
45
+ "fzstd": "0.1.1",
46
+ "yargs": "17.7.2"
47
+ },
48
+ "keywords": [
49
+ "esbuild",
50
+ "plugins",
51
+ "WebAssembly",
52
+ "wasm",
53
+ "sfx"
54
+ ],
55
+ "author": "hpcc-systems",
56
+ "repository": {
57
+ "type": "git",
58
+ "url": "git+https://github.com/hpcc-systems/hpcc-js-wasm.git"
59
+ },
60
+ "homepage": "https://hpcc-systems.github.io/hpcc-js-wasm/",
61
+ "license": "Apache-2.0",
62
+ "gitHead": "f63aa89b2c5555e49482c4231b850374ace59904"
63
+ }