@hpcc-js/esbuild-plugins 1.4.4 → 1.4.6
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 +5 -67
- package/dist/index.js.map +4 -4
- package/dist/sfx-wrapper.js +5 -5
- package/dist/sfx-wrapper.js.map +4 -4
- package/package.json +8 -6
- package/src/index.ts +0 -1
- package/types/index.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -1,75 +1,13 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as a from"process";import{readFileSync as b,existsSync as v,writeFileSync as L}from"fs";import*as c from"path";import*as h from"esbuild";import{umdWrapper as y}from"esbuild-plugin-umd-wrapper";import*as Q from"esbuild-copy-static-files";import E from"path";import k from"crypto";import{readFile as C}from"fs/promises";function f(t={}){return{name:"inline-css",setup(r){r.onLoad({filter:/\.(css)$/},async e=>{if(r.initialOptions.platform==="browser"){let n=E.resolve(e.path);return{contents:await $(n),loader:"js"}}})}}}async function $(t){let r=B(t),e=await C(t,"utf8");return`(function(){
|
|
2
2
|
if (!document.getElementById('${r}')) {
|
|
3
3
|
var e = document.createElement('style');
|
|
4
4
|
e.id = '${r}';
|
|
5
5
|
e.textContent = \`${e.split("\\25").join("\\x15")}\`;
|
|
6
6
|
document.head.appendChild(e);
|
|
7
7
|
}
|
|
8
|
-
})();`}function
|
|
9
|
-
export const PKG_VERSION = "${
|
|
8
|
+
})();`}function B(t){return k.createHash("sha256").update(t).digest("hex").slice(0,8)}function g(t){return{name:"rebuild-logger",setup(r){r.onStart(()=>{console.log("[watch] build started")}),r.onEnd(()=>{console.log(`Rebuilt ${t.outfile??"Unknown"}`)})}}}var s=JSON.parse(b(c.join(a.cwd(),"./package.json"),"utf8")),I=s.type==="module"?"js":"mjs",R=s.type==="module"?"cjs":"js";async function d(t,r){let e=a.argv.includes("--development"),n=a.argv.includes("--watch"),i=!e;if(i&&v(c.join(a.cwd(),"../../package.json"))){let o=JSON.parse(b(c.join(a.cwd(),"../../package.json"),"utf8"));L(c.join(a.cwd(),"src/__package__.ts"),`export const PKG_NAME = "${s.name}";
|
|
9
|
+
export const PKG_VERSION = "${s.version}";
|
|
10
10
|
export const BUILD_VERSION = "${o.version}";
|
|
11
|
-
`,"utf8")}r={entryPoints:t,format:"esm",bundle:!0,minify:
|
|
12
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIiJdLCJtYXBwaW5ncyI6IkEifQ==`,loader:"default"}))}}}function
|
|
13
|
-
${s?`import wrapper from "${t}";`:""}
|
|
14
|
-
|
|
15
|
-
const table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!#$%&()*+,./:;<=>?@[]^_\`{|}~"';
|
|
16
|
-
|
|
17
|
-
function decode(raw: string): Uint8Array {
|
|
18
|
-
const len = raw.length;
|
|
19
|
-
const ret: number[] = [];
|
|
20
|
-
|
|
21
|
-
let b = 0;
|
|
22
|
-
let n = 0;
|
|
23
|
-
let v = -1;
|
|
24
|
-
|
|
25
|
-
for (let i = 0; i < len; i++) {
|
|
26
|
-
const p = table.indexOf(raw[i]);
|
|
27
|
-
/* istanbul ignore next */
|
|
28
|
-
if (p === -1) continue;
|
|
29
|
-
if (v < 0) {
|
|
30
|
-
v = p;
|
|
31
|
-
} else {
|
|
32
|
-
v += p * 91;
|
|
33
|
-
b |= v << n;
|
|
34
|
-
n += (v & 8191) > 88 ? 13 : 14;
|
|
35
|
-
do {
|
|
36
|
-
ret.push(b & 0xff);
|
|
37
|
-
b >>= 8;
|
|
38
|
-
n -= 8;
|
|
39
|
-
} while (n > 7);
|
|
40
|
-
v = -1;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (v > -1) {
|
|
45
|
-
ret.push((b | v << n) & 0xff);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return new Uint8Array(ret);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const blobStr = '${n?e:r}';
|
|
52
|
-
|
|
53
|
-
let g_module: Uint8Array | undefined;
|
|
54
|
-
let g_wasmBinary: Uint8Array | undefined;
|
|
55
|
-
export default function() {
|
|
56
|
-
if (!g_wasmBinary) {
|
|
57
|
-
g_wasmBinary = ${n?"decompress(decode(blobStr))":"decode(blobStr)"};
|
|
58
|
-
}
|
|
59
|
-
${s?` if (!g_module) {
|
|
60
|
-
g_module = wrapper({
|
|
61
|
-
wasmBinary: g_wasmBinary,
|
|
62
|
-
locateFile: undefined
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
return g_module;
|
|
66
|
-
`:` return g_wasmBinary;
|
|
67
|
-
`}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export function reset() {
|
|
71
|
-
if (g_module) {
|
|
72
|
-
g_module = undefined;
|
|
73
|
-
}
|
|
74
|
-
} `.trim()}async function z(t){let r=await U.load(),e=await D.load(),n=await A(t);t=t.replace(/\.js$/,".xxx");let s=t.replace(/\.wasm$/,".js"),l=r.encode(n),o=e.compress(n),u=r.encode(o);return W(s,l,u)}function Pe(){return{name:"sfx-wasm",setup(t){t.onLoad({filter:/\.wasm$/},async r=>({contents:await z(r.path),loader:"ts"}))}}}import{defineConfig as V}from"vite";import H from"vite-plugin-css-injected-by-js";import{viteStaticCopy as M}from"vite-plugin-static-copy";var G={"d3-array":"@hpcc-js/common","d3-brush":"@hpcc-js/common","d3-collection":"@hpcc-js/common","d3-color":"@hpcc-js/common","d3-dispatch":"@hpcc-js/common","d3-drag":"@hpcc-js/common","d3-dsv":"@hpcc-js/common","d3-ease":"@hpcc-js/common","d3-format":"@hpcc-js/common","d3-interpolate":"@hpcc-js/common","d3-scale":"@hpcc-js/common","d3-selection":"@hpcc-js/common","d3-time-format":"@hpcc-js/common","d3-transition":"@hpcc-js/common","d3-zoom":"@hpcc-js/common"};function K(t){let r=[],e={};for(let n in t.dependencies)r.push(n),e[n]=n;for(let n in t.peerDependencies??{})r.push(n),e[n]=n;return{alias:t.name!=="@hpcc-js/common"&&t.dependencies["@hpcc-js/common"]?G:{},external:r,globals:e}}function ve(t,r={}){let{external:e=[],plugins:n=[],includeFontAwesome:s=!1,entry:l="src/index.ts",configOverrides:o={}}=r,{alias:u,external:P,globals:O}=K(t),S=[...P,...e],f=[H({topExecutionPriority:!1}),...n];s&&f.push(M({targets:[{src:"../../node_modules/font-awesome/fonts",dest:"../font-awesome"},{src:"../../node_modules/font-awesome/css",dest:"../font-awesome"}]}));let $={build:{lib:{...{entry:l,name:t.name,fileName:"index"},...o.build?.lib||{}},rollupOptions:{external:S,output:{globals:O},...o.build?.rollupOptions||{}},sourcemap:!0,...o.build?Object.fromEntries(Object.entries(o.build).filter(([m])=>m!=="lib"&&m!=="rollupOptions")):{}},resolve:{alias:u,...o.resolve||{}},esbuild:{minifyIdentifiers:!1,...o.esbuild||{}},plugins:f,...Object.fromEntries(Object.entries(o).filter(([m])=>!["build","resolve","esbuild","plugins"].includes(m)))};return V($)}export{F as NODE_CJS,L as NODE_MJS,le as bothTpl,J as browserBoth,b as browserTpl,p as buildWatch,ne as copyStaticFiles,ve as createHpccViteConfig,ue as excludeSourcemap,K as hpccBundleNames,g as inlineCSS,ae as neutralTpl,ie as nodeBoth,d as nodeTpl,a as pkg,pe as problemMatcher,x as rebuildLogger,xe as removeStrict,Pe as sfxWasm,z as wrap};
|
|
11
|
+
`,"utf8")}r={entryPoints:t,format:"esm",bundle:!0,minify:i,sourcemap:!0,external:[...r.external??[]],...r,loader:{...r.loader},outExtension:{...r.outExtension},banner:{...r.banner},footer:{...r.footer},plugins:[...n?[g(r)]:[],...r.plugins??[],f()],nodePaths:[...r.nodePaths??[]]};let l=await h.context(r);n?await l.watch():(e&&Array.isArray(r.entryPoints)&&console.log("Start: ",r.entryPoints[0],r.outfile),await l.rebuild(),await l.dispose(),e&&Array.isArray(r.entryPoints)&&console.log("Stop: ",r.entryPoints[0],r.outfile))}function J(t){return[...s.dependencies?Object.keys(s.dependencies):[],...s.peerDependencies?Object.keys(s.peerDependencies):[],...t??[]]}function x(t,r,e={}){return e.format=e.format??"esm",d([t],{format:e.format==="umd"?"esm":e.format,external:e.external??[],outfile:`${r}.${e.format==="esm"?"js":`${e.format}.js`}`,platform:"browser",target:"es2022",globalName:e.globalName,keepNames:e.keepNames,plugins:e.format==="umd"?[...e.plugins??[],y({libraryName:e.libraryName})]:e.plugins,alias:e.alias,define:e.define,loader:e.loader,supported:e.supported})}function u(t,r,e={}){return e.format=e.format??"esm",e.packages=e.packages??"external",e.packages==="auto"&&(e.external=J(e.external)),d([t],{format:e.format==="umd"?"esm":e.format,external:e.external??[],outfile:`${r}.${e.format==="esm"?I:R}`,platform:"node",target:"node22",packages:e.packages==="auto"?"bundle":e.packages,globalName:e.globalName,keepNames:e.keepNames,plugins:e.plugins,alias:e.alias,define:e.define,loader:e.loader,supported:e.supported})}function ee(t,r,e={}){return e.format=e.format??"esm",d([t],{format:e.format==="umd"?"esm":e.format,external:e.external??[],outfile:`${r}.${e.format==="esm"?"js":`${e.format}.js`}`,platform:"neutral",target:"es2022",globalName:e.globalName,keepNames:e.keepNames,plugins:e.format==="umd"?[...e.plugins??[],y({libraryName:e.libraryName})]:e.plugins,alias:e.alias,define:e.define,loader:e.loader,supported:e.supported})}function F(t,r,e={}){return Promise.all([x(t,r,{format:"esm",...e}),x(t,r,{format:"umd",...e})])}function re(t,r,e={}){return Promise.all([u(t,r,{format:"esm",...e}),u(t,r,{format:"cjs",...e})])}function te(t,r,e={}){return Promise.all([F(t,r,{...e}),u(t,r,{format:"cjs",...e})])}import{readFile as T}from"fs/promises";function se(t){return{name:"exclude-sourcemap",setup(r){r.onLoad({filter:t.filter},async e=>({contents:await T(e.path,"utf8")+`
|
|
12
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIiJdLCJtYXBwaW5ncyI6IkEifQ==`,loader:"default"}))}}}function ie(){return{name:"problem-matcher",setup(t){t.onStart(()=>{console.log("[watch] build started")}),t.onEnd(r=>{r.errors.forEach(({text:e,location:n})=>{console.error(`\u2718 [ERROR] ${e}`),console.error(` ${n?.file}:${n?.line}:${n?.column}:`)}),console.log("[watch] build finished")})}}}import{writeFileSync as j}from"node:fs";function me(){return{name:"remove-strict",setup(t){t.initialOptions.write=!1,t.onEnd(r=>{r?.outputFiles?.forEach(e=>{if(e.path.endsWith(".js")){let n=e.text.replace(/"use strict";/g,"");j(e.path,n,{encoding:"utf8"})}else j(e.path,e.contents,{encoding:"binary"})})})}}}import{defineConfig as _}from"vite";import D from"vite-plugin-css-injected-by-js";import{viteStaticCopy as A}from"vite-plugin-static-copy";var U={"d3-array":"@hpcc-js/common","d3-brush":"@hpcc-js/common","d3-collection":"@hpcc-js/common","d3-color":"@hpcc-js/common","d3-dispatch":"@hpcc-js/common","d3-drag":"@hpcc-js/common","d3-dsv":"@hpcc-js/common","d3-ease":"@hpcc-js/common","d3-format":"@hpcc-js/common","d3-interpolate":"@hpcc-js/common","d3-scale":"@hpcc-js/common","d3-selection":"@hpcc-js/common","d3-time-format":"@hpcc-js/common","d3-transition":"@hpcc-js/common","d3-zoom":"@hpcc-js/common"};function V(t){let r=[],e={};for(let n in t.dependencies)r.push(n),e[n]=n;for(let n in t.peerDependencies??{})r.push(n),e[n]=n;return{alias:t.name!=="@hpcc-js/common"&&t.dependencies["@hpcc-js/common"]?U:{},external:r,globals:e}}function xe(t,r={}){let{external:e=[],plugins:n=[],includeFontAwesome:i=!1,entry:l="src/index.ts",configOverrides:o={}}=r,{alias:P,external:O,globals:w}=V(t),S=[...O,...e],p=[D({topExecutionPriority:!1}),...n];i&&p.push(A({targets:[{src:"../../node_modules/font-awesome/fonts",dest:"../font-awesome"},{src:"../../node_modules/font-awesome/css",dest:"../font-awesome"}]}));let N={build:{lib:{...{entry:l,name:t.name,fileName:"index"},...o.build?.lib||{}},rollupOptions:{external:S,output:{globals:w},...o.build?.rollupOptions||{}},sourcemap:!0,...o.build?Object.fromEntries(Object.entries(o.build).filter(([m])=>m!=="lib"&&m!=="rollupOptions")):{}},resolve:{alias:P,...o.resolve||{}},esbuild:{minifyIdentifiers:!1,...o.esbuild||{}},plugins:p,...Object.fromEntries(Object.entries(o).filter(([m])=>!["build","resolve","esbuild","plugins"].includes(m)))};return _(N)}export{R as NODE_CJS,I as NODE_MJS,te as bothTpl,F as browserBoth,x as browserTpl,d as buildWatch,Q as copyStaticFiles,xe as createHpccViteConfig,se as excludeSourcemap,V as hpccBundleNames,f as inlineCSS,ee as neutralTpl,re as nodeBoth,u as nodeTpl,s as pkg,ie as problemMatcher,g as rebuildLogger,me as removeStrict};
|
|
75
13
|
//# 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/inline-css.ts", "../src/rebuild-logger.ts", "../src/exclude-sourcemap.ts", "../src/problem-matcher.ts", "../src/remove-strict.ts", "../src/
|
|
4
|
-
"sourcesContent": ["import * as process from \"process\";\nimport { readFileSync, existsSync, writeFileSync } from \"fs\";\nimport * as path from \"path\";\nimport * as esbuild from \"esbuild\";\nimport type { BuildOptions, Format, Loader, Plugin } from \"esbuild\";\nimport { umdWrapper } from \"esbuild-plugin-umd-wrapper\";\nimport * as copyStaticFiles from \"esbuild-copy-static-files\";\nimport { inlineCSS } from \"./inline-css.ts\";\nimport { rebuildLogger } from \"./rebuild-logger.ts\";\n\nexport { copyStaticFiles };\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 async function buildWatch(inputs: string[] | Record<string, string> | { in: string, out: string }[], config: BuildOptions): Promise<void> {\n const isDevelopment = process.argv.includes(\"--development\");\n const isWatch = process.argv.includes(\"--watch\");\n const isProduction = !isDevelopment;\n\n if (isProduction && existsSync(path.join(process.cwd(), \"../../package.json\"))) {\n const rootPkg = JSON.parse(readFileSync(path.join(process.cwd(), \"../../package.json\"), \"utf8\"));\n writeFileSync(path.join(process.cwd(), \"src/__package__.ts\"), `\\\nexport const PKG_NAME = \"${pkg.name}\";\nexport const PKG_VERSION = \"${pkg.version}\";\nexport const BUILD_VERSION = \"${rootPkg.version}\";\n`, \"utf8\");\n }\n\n config = {\n entryPoints: inputs,\n format: \"esm\",\n bundle: true,\n minify: isProduction,\n sourcemap: true,\n external: [\n ...config.external ?? []\n ],\n ...config,\n loader: {\n ...config.loader\n },\n outExtension: {\n ...config.outExtension\n },\n banner: {\n ...config.banner\n },\n footer: {\n ...config.footer\n },\n plugins: [\n ...(isWatch ? [rebuildLogger(config)] : []),\n ...config.plugins ?? [],\n inlineCSS()\n ],\n nodePaths: [\n ...config.nodePaths ?? []\n ]\n };\n const ctx = await esbuild.context(config);\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 type TplOptions = {\n format?: Format | \"umd\";\n globalName?: string;\n libraryName?: string;\n keepNames?: boolean;\n external?: string[];\n plugins?: Plugin[];\n loader?: { [ext: string]: Loader };\n supported?: Record<string, boolean>;\n alias?: Record<string, string>;\n define?: { [key: string]: string };\n packages?: \"bundle\" | \"external\" | \"auto\";\n};\n\nfunction autoExternal(external?: string[]): string[] {\n return [\n ...pkg.dependencies ? Object.keys(pkg.dependencies) : [], ...pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : [],\n ...external ?? []\n ];\n}\n\nexport function browserTpl(input: string, output: string, options: TplOptions = {}) {\n options.format = options.format ?? \"esm\";\n\n return buildWatch([input], {\n format: options.format === \"umd\" ? \"esm\" : options.format,\n external: options.external ?? [],\n outfile: `${output}.${options.format === \"esm\" ? \"js\" : `${options.format}.js`}`,\n platform: \"browser\",\n target: \"es2022\",\n globalName: options.globalName,\n keepNames: options.keepNames,\n plugins: options.format === \"umd\" ? [...options.plugins ?? [], umdWrapper({ libraryName: options.libraryName })] : options.plugins,\n alias: options.alias,\n define: options.define,\n loader: options.loader,\n supported: options.supported,\n });\n}\n\nexport function nodeTpl(input: string, output: string, options: TplOptions = {}) {\n options.format = options.format ?? \"esm\";\n options.packages = options.packages ?? \"external\";\n if (options.packages === \"auto\") {\n options.external = autoExternal(options.external);\n }\n\n return buildWatch([input], {\n format: options.format === \"umd\" ? \"esm\" : options.format,\n external: options.external ?? [],\n outfile: `${output}.${options.format === \"esm\" ? NODE_MJS : NODE_CJS}`,\n platform: \"node\",\n target: \"node22\",\n packages: options.packages === \"auto\" ? \"bundle\" : options.packages,\n globalName: options.globalName,\n keepNames: options.keepNames,\n plugins: options.plugins,\n alias: options.alias,\n define: options.define,\n loader: options.loader,\n supported: options.supported,\n });\n}\n\nexport function neutralTpl(input: string, output: string, options: TplOptions = {}) {\n options.format = options.format ?? \"esm\";\n\n return buildWatch([input], {\n format: options.format === \"umd\" ? \"esm\" : options.format,\n external: options.external ?? [],\n outfile: `${output}.${options.format === \"esm\" ? \"js\" : `${options.format}.js`}`,\n platform: \"neutral\",\n target: \"es2022\",\n globalName: options.globalName,\n keepNames: options.keepNames,\n plugins: options.format === \"umd\" ? [...options.plugins ?? [], umdWrapper({ libraryName: options.libraryName })] : options.plugins,\n alias: options.alias,\n define: options.define,\n loader: options.loader,\n supported: options.supported,\n });\n}\n\nexport function browserBoth(input: string, output: string, options: TplOptions = {}) {\n return Promise.all([\n browserTpl(input, output, { format: \"esm\", ...options }),\n browserTpl(input, output, { format: \"umd\", ...options })\n ]);\n}\n\nexport function nodeBoth(input: string, output: string, options: TplOptions = {}) {\n return Promise.all([\n nodeTpl(input, output, { format: \"esm\", ...options }),\n nodeTpl(input, output, { format: \"cjs\", ...options })\n ]);\n}\n\nexport function bothTpl(input: string, output: string, options: TplOptions = {}) {\n return Promise.all([\n browserBoth(input, output, { ...options }),\n nodeTpl(input, output, { format: \"cjs\", ...options })\n ]);\n}\n", "import type { PluginBuild, Plugin } from \"esbuild\";\nimport path from \"path\";\nimport crypto from \"crypto\";\nimport { readFile } from \"fs/promises\";\n\nexport function inlineCSS(options = {}) {\n return {\n name: \"inline-css\",\n\n setup(build: PluginBuild) {\n\n build.onLoad({ filter: /\\.(css)$/ }, async (args) => {\n if (build.initialOptions.platform === \"browser\") {\n const sourcePath = path.resolve(args.path);\n const sourceJS = await generateInjectCSS(sourcePath);\n return {\n contents: sourceJS,\n loader: \"js\"\n };\n }\n });\n },\n };\n}\n\nasync function generateInjectCSS(sourcePath: string) {\n const styleID = sha256(sourcePath);\n const sourceCSS = await readFile(sourcePath, \"utf8\");\n\n return `(function(){\n if (!document.getElementById('${styleID}')) {\n var e = document.createElement('style');\n e.id = '${styleID}';\n e.textContent = \\`${sourceCSS.split(\"\\\\25\").join(\"\\\\x15\")}\\`;\n document.head.appendChild(e);\n }\n })();`;\n}\n\nfunction sha256(sourcePath: string) {\n const hash = crypto.createHash(\"sha256\").update(sourcePath).digest(\"hex\");\n return hash.slice(0, 8); // Use the first 8 characters of the hash\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 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 writeFileSync(file.path, contents, { encoding: \"utf8\" });\n } else {\n writeFileSync(file.path, file.contents, { encoding: \"binary\" });\n }\n });\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 { defineConfig, UserConfig } from \"vite\";\nimport cssInjectedByJsPlugin from \"vite-plugin-css-injected-by-js\";\nimport { viteStaticCopy } from \"vite-plugin-static-copy\";\n\nconst alias = {\n \"d3-array\": \"@hpcc-js/common\",\n \"d3-brush\": \"@hpcc-js/common\",\n \"d3-collection\": \"@hpcc-js/common\",\n \"d3-color\": \"@hpcc-js/common\",\n \"d3-dispatch\": \"@hpcc-js/common\",\n \"d3-drag\": \"@hpcc-js/common\",\n \"d3-dsv\": \"@hpcc-js/common\",\n \"d3-ease\": \"@hpcc-js/common\",\n \"d3-format\": \"@hpcc-js/common\",\n \"d3-interpolate\": \"@hpcc-js/common\",\n \"d3-scale\": \"@hpcc-js/common\",\n \"d3-selection\": \"@hpcc-js/common\",\n \"d3-time-format\": \"@hpcc-js/common\",\n \"d3-transition\": \"@hpcc-js/common\",\n \"d3-zoom\": \"@hpcc-js/common\"\n};\n\nexport function hpccBundleNames(pkg: any) {\n const external: string[] = [];\n const globals: { [id: string]: string } = {};\n for (const dep in pkg.dependencies) {\n external.push(dep);\n globals[dep] = dep;\n }\n for (const dep in pkg.peerDependencies ?? {}) {\n external.push(dep);\n globals[dep] = dep;\n }\n return { alias: (pkg.name !== \"@hpcc-js/common\" && pkg.dependencies[\"@hpcc-js/common\"]) ? alias : {}, external, globals };\n}\n\nexport interface ViteHpccConfigOptions {\n /**\n * Additional external items\n */\n external?: string[];\n /**\n * Additional plugins to include in the configuration\n */\n plugins?: any[];\n /**\n * Whether to include font-awesome static copy (used by @hpcc-js/common)\n */\n includeFontAwesome?: boolean;\n /**\n * Custom entry point (defaults to \"src/index.ts\")\n */\n entry?: string;\n /**\n * Additional vite config options to merge\n */\n configOverrides?: Partial<UserConfig>;\n}\n\n/**\n * Creates a standardized Vite configuration for HPCC-JS packages\n */\nexport function createHpccViteConfig(pkg: any, options: ViteHpccConfigOptions = {}): UserConfig {\n const {\n external: additionalExternal = [],\n plugins: additionalPlugins = [],\n includeFontAwesome = false,\n entry = \"src/index.ts\",\n configOverrides = {}\n } = options;\n\n const { alias, external, globals } = hpccBundleNames(pkg);\n const allExternals = [...external, ...additionalExternal];\n\n const allPlugins = [\n cssInjectedByJsPlugin({\n topExecutionPriority: false\n }),\n ...additionalPlugins\n ];\n\n if (includeFontAwesome) {\n allPlugins.push(\n viteStaticCopy({\n targets: [\n {\n src: \"../../node_modules/font-awesome/fonts\",\n dest: \"../font-awesome\"\n }, {\n src: \"../../node_modules/font-awesome/css\",\n dest: \"../font-awesome\",\n }\n ]\n })\n );\n }\n\n const defaultLibConfig = {\n entry,\n name: pkg.name,\n fileName: \"index\",\n };\n\n const config: UserConfig = {\n build: {\n lib: {\n ...defaultLibConfig,\n ...(configOverrides.build?.lib || {})\n },\n rollupOptions: {\n external: allExternals,\n output: {\n globals,\n },\n ...(configOverrides.build?.rollupOptions || {})\n },\n sourcemap: true,\n ...(configOverrides.build ? Object.fromEntries(Object.entries(configOverrides.build).filter(([key]) => key !== \"lib\" && key !== \"rollupOptions\")) : {})\n },\n resolve: {\n alias,\n ...(configOverrides.resolve || {})\n },\n esbuild: {\n minifyIdentifiers: false,\n ...(configOverrides.esbuild || {})\n },\n plugins: allPlugins,\n ...Object.fromEntries(Object.entries(configOverrides).filter(([key]) => ![\"build\", \"resolve\", \"esbuild\", \"plugins\"].includes(key)))\n };\n\n return defineConfig(config);\n}"],
|
|
5
|
-
"mappings": "AAAA,UAAYA,MAAa,UACzB,OAAS,gBAAAC,EAAc,cAAAC,EAAY,iBAAAC,MAAqB,KACxD,UAAYC,MAAU,OACtB,UAAYC,MAAa,UAEzB,OAAS,cAAAC,MAAkB,6BAC3B,UAAYC,
|
|
6
|
-
"names": ["process", "readFileSync", "existsSync", "writeFileSync", "path", "esbuild", "umdWrapper", "copyStaticFiles", "path", "crypto", "readFile", "inlineCSS", "options", "build", "args", "sourcePath", "generateInjectCSS", "styleID", "sha256", "sourceCSS", "rebuildLogger", "opts", "build", "pkg", "readFileSync", "NODE_MJS", "NODE_CJS", "buildWatch", "inputs", "config", "isDevelopment", "isWatch", "isProduction", "existsSync", "rootPkg", "writeFileSync", "rebuildLogger", "inlineCSS", "ctx", "autoExternal", "external", "browserTpl", "input", "output", "options", "umdWrapper", "nodeTpl", "neutralTpl", "browserBoth", "nodeBoth", "bothTpl", "readFile", "excludeSourcemap", "opts", "build", "args", "problemMatcher", "build", "result", "text", "location", "writeFileSync", "removeStrict", "build", "result", "file", "contents", "
|
|
3
|
+
"sources": ["../src/build.ts", "../src/inline-css.ts", "../src/rebuild-logger.ts", "../src/exclude-sourcemap.ts", "../src/problem-matcher.ts", "../src/remove-strict.ts", "../src/vite-utils.ts"],
|
|
4
|
+
"sourcesContent": ["import * as process from \"process\";\nimport { readFileSync, existsSync, writeFileSync } from \"fs\";\nimport * as path from \"path\";\nimport * as esbuild from \"esbuild\";\nimport type { BuildOptions, Format, Loader, Plugin } from \"esbuild\";\nimport { umdWrapper } from \"esbuild-plugin-umd-wrapper\";\nimport * as copyStaticFiles from \"esbuild-copy-static-files\";\nimport { inlineCSS } from \"./inline-css.ts\";\nimport { rebuildLogger } from \"./rebuild-logger.ts\";\n\nexport { copyStaticFiles };\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 async function buildWatch(inputs: string[] | Record<string, string> | { in: string, out: string }[], config: BuildOptions): Promise<void> {\n const isDevelopment = process.argv.includes(\"--development\");\n const isWatch = process.argv.includes(\"--watch\");\n const isProduction = !isDevelopment;\n\n if (isProduction && existsSync(path.join(process.cwd(), \"../../package.json\"))) {\n const rootPkg = JSON.parse(readFileSync(path.join(process.cwd(), \"../../package.json\"), \"utf8\"));\n writeFileSync(path.join(process.cwd(), \"src/__package__.ts\"), `\\\nexport const PKG_NAME = \"${pkg.name}\";\nexport const PKG_VERSION = \"${pkg.version}\";\nexport const BUILD_VERSION = \"${rootPkg.version}\";\n`, \"utf8\");\n }\n\n config = {\n entryPoints: inputs,\n format: \"esm\",\n bundle: true,\n minify: isProduction,\n sourcemap: true,\n external: [\n ...config.external ?? []\n ],\n ...config,\n loader: {\n ...config.loader\n },\n outExtension: {\n ...config.outExtension\n },\n banner: {\n ...config.banner\n },\n footer: {\n ...config.footer\n },\n plugins: [\n ...(isWatch ? [rebuildLogger(config)] : []),\n ...config.plugins ?? [],\n inlineCSS()\n ],\n nodePaths: [\n ...config.nodePaths ?? []\n ]\n };\n const ctx = await esbuild.context(config);\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 type TplOptions = {\n format?: Format | \"umd\";\n globalName?: string;\n libraryName?: string;\n keepNames?: boolean;\n external?: string[];\n plugins?: Plugin[];\n loader?: { [ext: string]: Loader };\n supported?: Record<string, boolean>;\n alias?: Record<string, string>;\n define?: { [key: string]: string };\n packages?: \"bundle\" | \"external\" | \"auto\";\n};\n\nfunction autoExternal(external?: string[]): string[] {\n return [\n ...pkg.dependencies ? Object.keys(pkg.dependencies) : [], ...pkg.peerDependencies ? Object.keys(pkg.peerDependencies) : [],\n ...external ?? []\n ];\n}\n\nexport function browserTpl(input: string, output: string, options: TplOptions = {}) {\n options.format = options.format ?? \"esm\";\n\n return buildWatch([input], {\n format: options.format === \"umd\" ? \"esm\" : options.format,\n external: options.external ?? [],\n outfile: `${output}.${options.format === \"esm\" ? \"js\" : `${options.format}.js`}`,\n platform: \"browser\",\n target: \"es2022\",\n globalName: options.globalName,\n keepNames: options.keepNames,\n plugins: options.format === \"umd\" ? [...options.plugins ?? [], umdWrapper({ libraryName: options.libraryName })] : options.plugins,\n alias: options.alias,\n define: options.define,\n loader: options.loader,\n supported: options.supported,\n });\n}\n\nexport function nodeTpl(input: string, output: string, options: TplOptions = {}) {\n options.format = options.format ?? \"esm\";\n options.packages = options.packages ?? \"external\";\n if (options.packages === \"auto\") {\n options.external = autoExternal(options.external);\n }\n\n return buildWatch([input], {\n format: options.format === \"umd\" ? \"esm\" : options.format,\n external: options.external ?? [],\n outfile: `${output}.${options.format === \"esm\" ? NODE_MJS : NODE_CJS}`,\n platform: \"node\",\n target: \"node22\",\n packages: options.packages === \"auto\" ? \"bundle\" : options.packages,\n globalName: options.globalName,\n keepNames: options.keepNames,\n plugins: options.plugins,\n alias: options.alias,\n define: options.define,\n loader: options.loader,\n supported: options.supported,\n });\n}\n\nexport function neutralTpl(input: string, output: string, options: TplOptions = {}) {\n options.format = options.format ?? \"esm\";\n\n return buildWatch([input], {\n format: options.format === \"umd\" ? \"esm\" : options.format,\n external: options.external ?? [],\n outfile: `${output}.${options.format === \"esm\" ? \"js\" : `${options.format}.js`}`,\n platform: \"neutral\",\n target: \"es2022\",\n globalName: options.globalName,\n keepNames: options.keepNames,\n plugins: options.format === \"umd\" ? [...options.plugins ?? [], umdWrapper({ libraryName: options.libraryName })] : options.plugins,\n alias: options.alias,\n define: options.define,\n loader: options.loader,\n supported: options.supported,\n });\n}\n\nexport function browserBoth(input: string, output: string, options: TplOptions = {}) {\n return Promise.all([\n browserTpl(input, output, { format: \"esm\", ...options }),\n browserTpl(input, output, { format: \"umd\", ...options })\n ]);\n}\n\nexport function nodeBoth(input: string, output: string, options: TplOptions = {}) {\n return Promise.all([\n nodeTpl(input, output, { format: \"esm\", ...options }),\n nodeTpl(input, output, { format: \"cjs\", ...options })\n ]);\n}\n\nexport function bothTpl(input: string, output: string, options: TplOptions = {}) {\n return Promise.all([\n browserBoth(input, output, { ...options }),\n nodeTpl(input, output, { format: \"cjs\", ...options })\n ]);\n}\n", "import type { PluginBuild, Plugin } from \"esbuild\";\nimport path from \"path\";\nimport crypto from \"crypto\";\nimport { readFile } from \"fs/promises\";\n\nexport function inlineCSS(options = {}) {\n return {\n name: \"inline-css\",\n\n setup(build: PluginBuild) {\n\n build.onLoad({ filter: /\\.(css)$/ }, async (args) => {\n if (build.initialOptions.platform === \"browser\") {\n const sourcePath = path.resolve(args.path);\n const sourceJS = await generateInjectCSS(sourcePath);\n return {\n contents: sourceJS,\n loader: \"js\"\n };\n }\n });\n },\n };\n}\n\nasync function generateInjectCSS(sourcePath: string) {\n const styleID = sha256(sourcePath);\n const sourceCSS = await readFile(sourcePath, \"utf8\");\n\n return `(function(){\n if (!document.getElementById('${styleID}')) {\n var e = document.createElement('style');\n e.id = '${styleID}';\n e.textContent = \\`${sourceCSS.split(\"\\\\25\").join(\"\\\\x15\")}\\`;\n document.head.appendChild(e);\n }\n })();`;\n}\n\nfunction sha256(sourcePath: string) {\n const hash = crypto.createHash(\"sha256\").update(sourcePath).digest(\"hex\");\n return hash.slice(0, 8); // Use the first 8 characters of the hash\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 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 writeFileSync(file.path, contents, { encoding: \"utf8\" });\n } else {\n writeFileSync(file.path, file.contents, { encoding: \"binary\" });\n }\n });\n });\n }\n };\n}\n", "import { defineConfig, UserConfig } from \"vite\";\nimport cssInjectedByJsPlugin from \"vite-plugin-css-injected-by-js\";\nimport { viteStaticCopy } from \"vite-plugin-static-copy\";\n\nconst alias = {\n \"d3-array\": \"@hpcc-js/common\",\n \"d3-brush\": \"@hpcc-js/common\",\n \"d3-collection\": \"@hpcc-js/common\",\n \"d3-color\": \"@hpcc-js/common\",\n \"d3-dispatch\": \"@hpcc-js/common\",\n \"d3-drag\": \"@hpcc-js/common\",\n \"d3-dsv\": \"@hpcc-js/common\",\n \"d3-ease\": \"@hpcc-js/common\",\n \"d3-format\": \"@hpcc-js/common\",\n \"d3-interpolate\": \"@hpcc-js/common\",\n \"d3-scale\": \"@hpcc-js/common\",\n \"d3-selection\": \"@hpcc-js/common\",\n \"d3-time-format\": \"@hpcc-js/common\",\n \"d3-transition\": \"@hpcc-js/common\",\n \"d3-zoom\": \"@hpcc-js/common\"\n};\n\nexport function hpccBundleNames(pkg: any) {\n const external: string[] = [];\n const globals: { [id: string]: string } = {};\n for (const dep in pkg.dependencies) {\n external.push(dep);\n globals[dep] = dep;\n }\n for (const dep in pkg.peerDependencies ?? {}) {\n external.push(dep);\n globals[dep] = dep;\n }\n return { alias: (pkg.name !== \"@hpcc-js/common\" && pkg.dependencies[\"@hpcc-js/common\"]) ? alias : {}, external, globals };\n}\n\nexport interface ViteHpccConfigOptions {\n /**\n * Additional external items\n */\n external?: string[];\n /**\n * Additional plugins to include in the configuration\n */\n plugins?: any[];\n /**\n * Whether to include font-awesome static copy (used by @hpcc-js/common)\n */\n includeFontAwesome?: boolean;\n /**\n * Custom entry point (defaults to \"src/index.ts\")\n */\n entry?: string;\n /**\n * Additional vite config options to merge\n */\n configOverrides?: Partial<UserConfig>;\n}\n\n/**\n * Creates a standardized Vite configuration for HPCC-JS packages\n */\nexport function createHpccViteConfig(pkg: any, options: ViteHpccConfigOptions = {}): UserConfig {\n const {\n external: additionalExternal = [],\n plugins: additionalPlugins = [],\n includeFontAwesome = false,\n entry = \"src/index.ts\",\n configOverrides = {}\n } = options;\n\n const { alias, external, globals } = hpccBundleNames(pkg);\n const allExternals = [...external, ...additionalExternal];\n\n const allPlugins = [\n cssInjectedByJsPlugin({\n topExecutionPriority: false\n }),\n ...additionalPlugins\n ];\n\n if (includeFontAwesome) {\n allPlugins.push(\n viteStaticCopy({\n targets: [\n {\n src: \"../../node_modules/font-awesome/fonts\",\n dest: \"../font-awesome\"\n }, {\n src: \"../../node_modules/font-awesome/css\",\n dest: \"../font-awesome\",\n }\n ]\n })\n );\n }\n\n const defaultLibConfig = {\n entry,\n name: pkg.name,\n fileName: \"index\",\n };\n\n const config: UserConfig = {\n build: {\n lib: {\n ...defaultLibConfig,\n ...(configOverrides.build?.lib || {})\n },\n rollupOptions: {\n external: allExternals,\n output: {\n globals,\n },\n ...(configOverrides.build?.rollupOptions || {})\n },\n sourcemap: true,\n ...(configOverrides.build ? Object.fromEntries(Object.entries(configOverrides.build).filter(([key]) => key !== \"lib\" && key !== \"rollupOptions\")) : {})\n },\n resolve: {\n alias,\n ...(configOverrides.resolve || {})\n },\n esbuild: {\n minifyIdentifiers: false,\n ...(configOverrides.esbuild || {})\n },\n plugins: allPlugins,\n ...Object.fromEntries(Object.entries(configOverrides).filter(([key]) => ![\"build\", \"resolve\", \"esbuild\", \"plugins\"].includes(key)))\n };\n\n return defineConfig(config);\n}"],
|
|
5
|
+
"mappings": "AAAA,UAAYA,MAAa,UACzB,OAAS,gBAAAC,EAAc,cAAAC,EAAY,iBAAAC,MAAqB,KACxD,UAAYC,MAAU,OACtB,UAAYC,MAAa,UAEzB,OAAS,cAAAC,MAAkB,6BAC3B,UAAYC,MAAqB,4BCLjC,OAAOC,MAAU,OACjB,OAAOC,MAAY,SACnB,OAAS,YAAAC,MAAgB,cAElB,SAASC,EAAUC,EAAU,CAAC,EAAG,CACpC,MAAO,CACH,KAAM,aAEN,MAAMC,EAAoB,CAEtBA,EAAM,OAAO,CAAE,OAAQ,UAAW,EAAG,MAAOC,GAAS,CACjD,GAAID,EAAM,eAAe,WAAa,UAAW,CAC7C,IAAME,EAAaP,EAAK,QAAQM,EAAK,IAAI,EAEzC,MAAO,CACH,SAFa,MAAME,EAAkBD,CAAU,EAG/C,OAAQ,IACZ,CACJ,CACJ,CAAC,CACL,CACJ,CACJ,CAEA,eAAeC,EAAkBD,EAAoB,CACjD,IAAME,EAAUC,EAAOH,CAAU,EAC3BI,EAAY,MAAMT,EAASK,EAAY,MAAM,EAEnD,MAAO;AAAA,wCAC6BE,CAAO;AA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,GAAIA,EAAgB,SAAW,CAAC,CACpC,EACA,QAASE,EACT,GAAG,OAAO,YAAY,OAAO,QAAQF,CAAe,EAAE,OAAO,CAAC,CAACI,CAAG,IAAM,CAAC,CAAC,QAAS,UAAW,UAAW,SAAS,EAAE,SAASA,CAAG,CAAC,CAAC,CACtI,EAEA,OAAOnB,EAAakB,CAAM,CAC9B",
|
|
6
|
+
"names": ["process", "readFileSync", "existsSync", "writeFileSync", "path", "esbuild", "umdWrapper", "copyStaticFiles", "path", "crypto", "readFile", "inlineCSS", "options", "build", "args", "sourcePath", "generateInjectCSS", "styleID", "sha256", "sourceCSS", "rebuildLogger", "opts", "build", "pkg", "readFileSync", "NODE_MJS", "NODE_CJS", "buildWatch", "inputs", "config", "isDevelopment", "isWatch", "isProduction", "existsSync", "rootPkg", "writeFileSync", "rebuildLogger", "inlineCSS", "ctx", "autoExternal", "external", "browserTpl", "input", "output", "options", "umdWrapper", "nodeTpl", "neutralTpl", "browserBoth", "nodeBoth", "bothTpl", "readFile", "excludeSourcemap", "opts", "build", "args", "problemMatcher", "build", "result", "text", "location", "writeFileSync", "removeStrict", "build", "result", "file", "contents", "defineConfig", "cssInjectedByJsPlugin", "viteStaticCopy", "alias", "hpccBundleNames", "pkg", "external", "globals", "dep", "createHpccViteConfig", "options", "additionalExternal", "additionalPlugins", "includeFontAwesome", "entry", "configOverrides", "allExternals", "allPlugins", "config", "key"]
|
|
7
7
|
}
|