@hpcc-js/esbuild-plugins 1.5.2 → 1.6.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 CHANGED
@@ -1,13 +1,10 @@
1
- import*as a from"process";import{readFileSync as h,existsSync as _,writeFileSync as L}from"fs";import*as c from"path";import*as y from"esbuild";import{umdWrapper as j}from"esbuild-plugin-umd-wrapper";import*as ee from"esbuild-copy-static-files";import B from"path";import C from"crypto";import{readFile as v}from"fs/promises";function g(t={}){return{name:"inline-css",setup(r){r.onLoad({filter:/\.(css)$/},async e=>{if(r.initialOptions.platform==="browser"){let n=B.resolve(e.path);return{contents:await $(n),loader:"js"}}})}}}async function $(t){let r=F(t),e=await v(t,"utf8");return`(function(){
1
+ import*as c from"process";import{readFileSync as F}from"fs";import*as P from"path";import*as y from"esbuild";import{umdWrapper as j}from"esbuild-plugin-umd-wrapper";import*as se from"esbuild-copy-static-files";import _ from"path";import B from"crypto";import{readFile as V}from"fs/promises";function x(t={}){return{name:"inline-css",setup(r){r.onLoad({filter:/\.(css)$/},async e=>{if(r.initialOptions.platform==="browser"){let n=_.resolve(e.path);return{contents:await R(n),loader:"js"}}})}}}async function R(t){let r=$(t),e=await V(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 F(t){return C.createHash("sha256").update(t).digest("hex").slice(0,8)}function x(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(h(c.join(a.cwd(),"./package.json"),"utf8")),R=s.type==="module"?"js":"mjs",I=s.type==="module"?"cjs":"js";async function p(t,r){let e=a.argv.includes("--development"),n=a.argv.includes("--watch"),i=!e;if(i&&_(c.join(a.cwd(),"../../package.json"))){let o=JSON.parse(h(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
- export const BUILD_VERSION = "${o.version}";
11
- `,"utf8")}r={entryPoints:t,format:r.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?[x(r)]:[],...r.plugins??[],g()],nodePaths:[...r.nodePaths??[]]};let l=await y.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 b(t,r,e={}){return e.format=e.format??"esm",p([t],{format: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"?[j({libraryName:e.libraryName}),...e.plugins??[]]: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)),p([t],{format:e.format,external:e.external??[],outfile:`${r}.${e.format==="esm"?R:I}`,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 ne(t,r,e={}){return e.format=e.format??"esm",p([t],{format: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"?[j({libraryName:e.libraryName}),...e.plugins??[]]:e.plugins,alias:e.alias,define:e.define,loader:e.loader,supported:e.supported})}function T(t,r,e={}){return Promise.all([b(t,r,{format:"esm",...e}),b(t,r,{format:"umd",...e})])}function oe(t,r,e={}){return Promise.all([u(t,r,{format:"esm",...e}),u(t,r,{format:"cjs",...e})])}function se(t,r,e={}){return Promise.all([T(t,r,{...e}),u(t,r,{format:"cjs",...e})])}import{readFile as V}from"fs/promises";function le(t){return{name:"exclude-sourcemap",setup(r){r.onLoad({filter:t.filter},async e=>({contents:await V(e.path,"utf8")+`
12
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIiJdLCJtYXBwaW5ncyI6IkEifQ==`,loader:"default"}))}}}function me(){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 P}from"node:fs";function de(){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,"");P(e.path,n,{encoding:"utf8"})}else P(e.path,e.contents,{encoding:"binary"})})})}}}import{configDefaults as O,defineConfig as d}from"vitest/config";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 W(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}}var z=d({test:{name:"node",exclude:[...O.exclude,"**/*.browser.spec.{ts,js}","**/node_modules/**","**/.nx/**","**/apps/**","**/components/**","**/demos/**"],environment:"node",setupFiles:[]}}),H=d({test:{exclude:[...O.exclude,"@hpcc-js/dgrid-shim","**/*.node.spec.{ts,js}","**/node_modules/**","**/.nx/**","**/apps/**","**/components/**","**/demos/**","**/src/**"],browser:{enabled:!0,provider:"playwright",instances:[{name:"chromium",browser:"chromium",headless:!0,launch:{args:["--disable-web-security"]}}],screenshotFailures:!1},setupFiles:[]}});function ye(t,r={}){let{external:e=[],plugins:n=[],includeFontAwesome:i=!1,entry:l="src/index.ts",configOverrides:o={}}=r,{alias:w,external:S,globals:N}=W(t),E=[...S,...e],f=[D({topExecutionPriority:!1}),...n];i&&f.push(A({targets:[{src:"../../node_modules/font-awesome/fonts",dest:"../font-awesome"},{src:"../../node_modules/font-awesome/css",dest:"../font-awesome"}]}));let k={build:{lib:{...{entry:l,name:t.name,fileName:"index"},...o.build?.lib||{}},rollupOptions:{external:E,output:{globals:N},...o.build?.rollupOptions||{}},minify:"terser",terserOptions:{keep_classnames:!0,mangle:{keep_classnames:!0}},sourcemap:!0,...o.build?Object.fromEntries(Object.entries(o.build).filter(([m])=>m!=="lib"&&m!=="rollupOptions")):{}},resolve:{alias:w,...o.resolve||{}},esbuild:{keepNames:!0,...o.esbuild||{}},plugins:f,test:{projects:[z,H],...o.test||{}},...Object.fromEntries(Object.entries(o).filter(([m])=>!["build","resolve","esbuild","plugins"].includes(m)))};return d(k)}export{I as NODE_CJS,R as NODE_MJS,se as bothTpl,T as browserBoth,H as browserConfig,b as browserTpl,p as buildWatch,ee as copyStaticFiles,ye as createHpccViteConfig,le as excludeSourcemap,W as hpccBundleNames,g as inlineCSS,ne as neutralTpl,oe as nodeBoth,z as nodeConfig,u as nodeTpl,s as pkg,me as problemMatcher,x as rebuildLogger,de as removeStrict};
8
+ })();`}function $(t){return B.createHash("sha256").update(t).digest("hex").slice(0,8)}function b(t){return{name:"rebuild-logger",setup(r){r.onStart(()=>{console.log("[watch] build started")}),r.onEnd(()=>{console.log(`Rebuilt ${t.outfile??"Unknown"}`)})}}}var l=JSON.parse(F(P.join(c.cwd(),"./package.json"),"utf8")),L=l.type==="module"?"js":"mjs",A=l.type==="module"?"cjs":"js";async function d(t,r){let e=c.argv.includes("--development"),n=c.argv.includes("--watch"),i=!e;r={entryPoints:t,format:r.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?[b(r)]:[],...r.plugins??[],x()],nodePaths:[...r.nodePaths??[]]};let s=await y.context(r);n?await s.watch():(e&&Array.isArray(r.entryPoints)&&console.log("Start: ",r.entryPoints[0],r.outfile),await s.rebuild(),await s.dispose(),e&&Array.isArray(r.entryPoints)&&console.log("Stop: ",r.entryPoints[0],r.outfile))}function I(t){return[...l.dependencies?Object.keys(l.dependencies):[],...l.peerDependencies?Object.keys(l.peerDependencies):[],...t??[]]}function h(t,r,e={}){return e.format=e.format??"esm",d([t],{format: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"?[j({libraryName:e.libraryName}),...e.plugins??[]]:e.plugins,alias:e.alias,define:e.define,loader:e.loader,supported:e.supported})}function p(t,r,e={}){return e.format=e.format??"esm",e.packages=e.packages??"external",e.packages==="auto"&&(e.external=I(e.external)),d([t],{format:e.format,external:e.external??[],outfile:`${r}.${e.format==="esm"?L:A}`,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 le(t,r,e={}){return e.format=e.format??"esm",d([t],{format: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"?[j({libraryName:e.libraryName}),...e.plugins??[]]:e.plugins,alias:e.alias,define:e.define,loader:e.loader,supported:e.supported})}function J(t,r,e={}){return Promise.all([h(t,r,{format:"esm",...e}),h(t,r,{format:"umd",...e})])}function ce(t,r,e={}){return Promise.all([p(t,r,{format:"esm",...e}),p(t,r,{format:"cjs",...e})])}function ue(t,r,e={}){return Promise.all([J(t,r,{...e}),p(t,r,{format:"cjs",...e})])}import{readFile as T}from"fs/promises";function de(t){return{name:"exclude-sourcemap",setup(r){r.onLoad({filter:t.filter},async e=>({contents:await T(e.path,"utf8")+`
9
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIiJdLCJtYXBwaW5ncyI6IkEifQ==`,loader:"default"}))}}}function ge(){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 O}from"node:fs";function he(){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,"");O(e.path,n,{encoding:"utf8"})}else O(e.path,e.contents,{encoding:"binary"})})})}}}import{configDefaults as E,defineConfig as f}from"vitest/config";import D from"vite-plugin-css-injected-by-js";import{viteStaticCopy as U}from"vite-plugin-static-copy";function w(t){let{pkg:r,buildVersion:e=r.version,namePlaceholder:n="__PACKAGE_NAME__",versionPlaceholder:i="__PACKAGE_VERSION__",buildVersionPlaceholder:s="__BUILD_VERSION__"}=t;return{name:"hpcc-package-version-plugin",enforce:"pre",transform(o,u){if(!u.endsWith(".ts")&&!u.endsWith(".js")||!o.includes(n)&&!o.includes(i)&&!o.includes(s))return null;let a=o;return o.includes(n)&&(a=a.replace(new RegExp(n,"g"),r.name)),o.includes(i)&&(a=a.replace(new RegExp(i,"g"),r.version)),o.includes(s)&&(a=a.replace(new RegExp(s,"g"),e)),{code:a,map:null}}}}import{readFileSync as W}from"fs";import{resolve as z,dirname as k}from"path";import{fileURLToPath as H}from"url";var M={"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 G(){try{let t=k(H(import.meta.url)),r=0,e=10;for(;r<e;){try{let i=z(t,"package.json"),s=W(i,"utf-8"),o=JSON.parse(s);if(o.workspaces)return o.version}catch{}let n=k(t);if(n===t)break;t=n,r++}}catch(t){console.warn("Could not read root package.json, using package version as build version:",t)}return""}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"]?M:{},external:r,globals:e}}var X=f({test:{name:"node",exclude:[...E.exclude,"**/*.browser.spec.{ts,js}","**/node_modules/**","**/.nx/**","**/apps/**","**/components/**","**/demos/**"],environment:"node",setupFiles:[]}}),Y=f({test:{exclude:[...E.exclude,"@hpcc-js/dgrid-shim","**/*.node.spec.{ts,js}","**/node_modules/**","**/.nx/**","**/apps/**","**/components/**","**/demos/**","**/src/**"],browser:{enabled:!0,provider:"playwright",instances:[{name:"chromium",browser:"chromium",headless:!0,launch:{args:["--disable-web-security"]}}],screenshotFailures:!1},setupFiles:[]}});function Ce(t,r={}){let{external:e=[],plugins:n=[],includeFontAwesome:i=!1,entry:s="src/index.ts",configOverrides:o={}}=r,{alias:u,external:a,globals:v}=K(t),N=[...a,...e],S=G()||t.version,g=[w({pkg:t,buildVersion:S}),D({topExecutionPriority:!1}),...n];i&&g.push(U({targets:[{src:"../../node_modules/font-awesome/fonts",dest:"../font-awesome"},{src:"../../node_modules/font-awesome/css",dest:"../font-awesome"}]}));let C={build:{lib:{...{entry:s,name:t.name,fileName:"index"},...o.build?.lib||{}},rollupOptions:{external:N,output:{globals:v},...o.build?.rollupOptions||{}},minify:"terser",terserOptions:{keep_classnames:!0,mangle:{keep_classnames:!0}},sourcemap:!0,...o.build?Object.fromEntries(Object.entries(o.build).filter(([m])=>m!=="lib"&&m!=="rollupOptions")):{}},resolve:{alias:u,...o.resolve||{}},esbuild:{keepNames:!0,...o.esbuild||{}},plugins:g,test:{projects:[X,Y],...o.test||{}},...Object.fromEntries(Object.entries(o).filter(([m])=>!["build","resolve","esbuild","plugins"].includes(m)))};return f(C)}export{A as NODE_CJS,L as NODE_MJS,ue as bothTpl,J as browserBoth,Y as browserConfig,h as browserTpl,d as buildWatch,se as copyStaticFiles,Ce as createHpccViteConfig,de as excludeSourcemap,K as hpccBundleNames,x as inlineCSS,le as neutralTpl,ce as nodeBoth,X as nodeConfig,p as nodeTpl,w as packageVersionPlugin,l as pkg,ge as problemMatcher,b as rebuildLogger,he as removeStrict};
13
10
  //# 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/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\ninterface BuildOptionsEx extends Omit<BuildOptions, \"format\"> {\n format?: Format | \"umd\";\n}\n\nexport async function buildWatch(inputs: string[] | Record<string, string> | { in: string, out: string }[], config: BuildOptionsEx): 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: config.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 as BuildOptions);\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,\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\" ? [umdWrapper({ libraryName: options.libraryName }) as Plugin, ...options.plugins ?? []] : 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,\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,\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\" ? [umdWrapper({ libraryName: options.libraryName }) as Plugin, ...options.plugins ?? []] : 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 { configDefaults, defineConfig, ViteUserConfig } from \"vitest/config\";\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<ViteUserConfig>;\n}\n\nexport const nodeConfig = defineConfig({\n test: {\n name: \"node\",\n\n exclude: [\n ...configDefaults.exclude,\n \"**/*.browser.spec.{ts,js}\",\n \"**/node_modules/**\",\n \"**/.nx/**\",\n \"**/apps/**\",\n \"**/components/**\",\n \"**/demos/**\",\n ],\n environment: \"node\",\n setupFiles: []\n }\n});\n\nexport const browserConfig = defineConfig({\n test: {\n exclude: [\n ...configDefaults.exclude,\n \"@hpcc-js/dgrid-shim\",\n \"**/*.node.spec.{ts,js}\",\n \"**/node_modules/**\",\n \"**/.nx/**\",\n \"**/apps/**\",\n \"**/components/**\",\n \"**/demos/**\",\n \"**/src/**\",\n ],\n browser: {\n enabled: true,\n provider: \"playwright\",\n instances: [{\n name: \"chromium\",\n browser: \"chromium\",\n headless: true,\n //@ts-expect-error\n launch: {\n args: [\"--disable-web-security\"],\n }\n }],\n screenshotFailures: false,\n },\n setupFiles: [],\n }\n});\n\nexport function createHpccViteConfig(pkg: any, options: ViteHpccConfigOptions = {}): ViteUserConfig {\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: ViteUserConfig = {\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 // Preserve class names and function names in minified output\n minify: \"terser\",\n terserOptions: {\n keep_classnames: true,\n mangle: {\n keep_classnames: true,\n }\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 keepNames: true,\n ...(configOverrides.esbuild || {})\n },\n plugins: allPlugins,\n test: {\n projects: [nodeConfig, browserConfig],\n ...(configOverrides.test || {})\n },\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,OAAqB,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,EAA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,EASJ,IAAMkB,EAAyB,CAC3B,MAAO,CACH,IAAK,CACD,GATa,CACrB,MAAAJ,EACA,KAAMX,EAAI,KACV,SAAU,OACd,EAMY,GAAIY,EAAgB,OAAO,KAAO,CAAC,CACvC,EACA,cAAe,CACX,SAAUC,EACV,OAAQ,CACJ,QAAAX,CACJ,EACA,GAAIU,EAAgB,OAAO,eAAiB,CAAC,CACjD,EAEA,OAAQ,SACR,cAAe,CACX,gBAAiB,GACjB,OAAQ,CACJ,gBAAiB,EACrB,CACJ,EACA,UAAW,GACX,GAAIA,EAAgB,MAAQ,OAAO,YAAY,OAAO,QAAQA,EAAgB,KAAK,EAAE,OAAO,CAAC,CAACI,CAAG,IAAMA,IAAQ,OAASA,IAAQ,eAAe,CAAC,EAAI,CAAC,CACzJ,EACA,QAAS,CACL,MAAAlB,EACA,GAAIc,EAAgB,SAAW,CAAC,CACpC,EACA,QAAS,CACL,UAAW,GACX,GAAIA,EAAgB,SAAW,CAAC,CACpC,EACA,QAASE,EACT,KAAM,CACF,SAAU,CAACV,EAAYC,CAAa,EACpC,GAAIO,EAAgB,MAAQ,CAAC,CACjC,EACA,GAAG,OAAO,YAAY,OAAO,QAAQA,CAAe,EAAE,OAAO,CAAC,CAACI,CAAG,IAAM,CAAC,CAAC,QAAS,UAAW,UAAW,SAAS,EAAE,SAASA,CAAG,CAAC,CAAC,CACtI,EAEA,OAAOrB,EAAaoB,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", "configDefaults", "defineConfig", "cssInjectedByJsPlugin", "viteStaticCopy", "alias", "hpccBundleNames", "pkg", "external", "globals", "dep", "nodeConfig", "browserConfig", "createHpccViteConfig", "options", "additionalExternal", "additionalPlugins", "includeFontAwesome", "entry", "configOverrides", "allExternals", "allPlugins", "config", "key"]
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", "../src/package-version-plugin.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, 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\ninterface BuildOptionsEx extends Omit<BuildOptions, \"format\"> {\n format?: Format | \"umd\";\n}\n\nexport async function buildWatch(inputs: string[] | Record<string, string> | { in: string, out: string }[], config: BuildOptionsEx): Promise<void> {\n const isDevelopment = process.argv.includes(\"--development\");\n const isWatch = process.argv.includes(\"--watch\");\n const isProduction = !isDevelopment;\n\n config = {\n entryPoints: inputs,\n format: config.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 as BuildOptions);\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,\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\" ? [umdWrapper({ libraryName: options.libraryName }) as Plugin, ...options.plugins ?? []] : 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,\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,\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\" ? [umdWrapper({ libraryName: options.libraryName }) as Plugin, ...options.plugins ?? []] : 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 { configDefaults, defineConfig, ViteUserConfig } from \"vitest/config\";\nimport cssInjectedByJsPlugin from \"vite-plugin-css-injected-by-js\";\nimport { viteStaticCopy } from \"vite-plugin-static-copy\";\nimport { packageVersionPlugin } from \"./package-version-plugin.ts\";\nimport { readFileSync } from \"fs\";\nimport { resolve, dirname } from \"path\";\nimport { fileURLToPath } from \"url\";\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\n/**\n * Find and read the root package.json (monorepo root)\n * Walks up the directory tree looking for a package.json with \"workspaces\"\n */\nfunction getRootPackageVersion(): string {\n try {\n // Try to find root package.json by walking up from current file\n let currentDir = dirname(fileURLToPath(import.meta.url));\n let attempts = 0;\n const maxAttempts = 10;\n\n while (attempts < maxAttempts) {\n try {\n const pkgPath = resolve(currentDir, \"package.json\");\n const pkgContent = readFileSync(pkgPath, \"utf-8\");\n const pkg = JSON.parse(pkgContent);\n\n // Check if this is the root by looking for workspaces\n if (pkg.workspaces) {\n return pkg.version;\n }\n } catch {\n // File doesn't exist or couldn't be read, continue up\n }\n\n const parentDir = dirname(currentDir);\n if (parentDir === currentDir) {\n // Reached filesystem root\n break;\n }\n currentDir = parentDir;\n attempts++;\n }\n } catch (error) {\n console.warn(\"Could not read root package.json, using package version as build version:\", error);\n }\n\n return \"\";\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<ViteUserConfig>;\n}\n\nexport const nodeConfig = defineConfig({\n test: {\n name: \"node\",\n\n exclude: [\n ...configDefaults.exclude,\n \"**/*.browser.spec.{ts,js}\",\n \"**/node_modules/**\",\n \"**/.nx/**\",\n \"**/apps/**\",\n \"**/components/**\",\n \"**/demos/**\",\n ],\n environment: \"node\",\n setupFiles: []\n }\n});\n\nexport const browserConfig = defineConfig({\n test: {\n exclude: [\n ...configDefaults.exclude,\n \"@hpcc-js/dgrid-shim\",\n \"**/*.node.spec.{ts,js}\",\n \"**/node_modules/**\",\n \"**/.nx/**\",\n \"**/apps/**\",\n \"**/components/**\",\n \"**/demos/**\",\n \"**/src/**\",\n ],\n browser: {\n enabled: true,\n provider: \"playwright\",\n instances: [{\n name: \"chromium\",\n browser: \"chromium\",\n headless: true,\n //@ts-expect-error\n launch: {\n args: [\"--disable-web-security\"],\n }\n }],\n screenshotFailures: false,\n },\n setupFiles: [],\n }\n});\n\nexport function createHpccViteConfig(pkg: any, options: ViteHpccConfigOptions = {}): ViteUserConfig {\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 // Get build version from root package.json\n const buildVersion = getRootPackageVersion() || pkg.version;\n\n const allPlugins = [\n packageVersionPlugin({ pkg, buildVersion }),\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: ViteUserConfig = {\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 // Preserve class names and function names in minified output\n minify: \"terser\",\n terserOptions: {\n keep_classnames: true,\n mangle: {\n keep_classnames: true,\n }\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 keepNames: true,\n ...(configOverrides.esbuild || {})\n },\n plugins: allPlugins,\n test: {\n projects: [nodeConfig, browserConfig],\n ...(configOverrides.test || {})\n },\n ...Object.fromEntries(Object.entries(configOverrides).filter(([key]) => ![\"build\", \"resolve\", \"esbuild\", \"plugins\"].includes(key)))\n };\n\n return defineConfig(config);\n}", "import type { Plugin } from \"vite\";\n\nexport interface PackageVersionPluginOptions {\n /**\n * Package.json object containing name and version\n */\n pkg: {\n name: string;\n version: string;\n };\n /**\n * Build version (typically from root package.json)\n * If not provided, defaults to pkg.version\n */\n buildVersion?: string;\n /**\n * Placeholder for package name (default: \"__PACKAGE_NAME__\")\n */\n namePlaceholder?: string;\n /**\n * Placeholder for package version (default: \"__PACKAGE_VERSION__\")\n */\n versionPlaceholder?: string;\n /**\n * Placeholder for build version (default: \"__BUILD_VERSION__\")\n */\n buildVersionPlaceholder?: string;\n}\n\n/**\n * Vite plugin to replace package version placeholders during build\n * This allows keeping version information in source files as placeholders\n * that get replaced with actual values from package.json during the build\n */\nexport function packageVersionPlugin(options: PackageVersionPluginOptions): Plugin {\n const {\n pkg,\n buildVersion = pkg.version,\n namePlaceholder = \"__PACKAGE_NAME__\",\n versionPlaceholder = \"__PACKAGE_VERSION__\",\n buildVersionPlaceholder = \"__BUILD_VERSION__\"\n } = options;\n\n return {\n name: \"hpcc-package-version-plugin\",\n enforce: \"pre\",\n transform(code: string, id: string) {\n // Only process TypeScript/JavaScript files\n if (!id.endsWith(\".ts\") && !id.endsWith(\".js\")) {\n return null;\n }\n\n // Check if the file contains any placeholders\n if (!code.includes(namePlaceholder) &&\n !code.includes(versionPlaceholder) &&\n !code.includes(buildVersionPlaceholder)) {\n return null;\n }\n\n // Replace placeholders with actual values\n let transformedCode = code;\n if (code.includes(namePlaceholder)) {\n transformedCode = transformedCode.replace(\n new RegExp(namePlaceholder, \"g\"),\n pkg.name\n );\n }\n if (code.includes(versionPlaceholder)) {\n transformedCode = transformedCode.replace(\n new RegExp(versionPlaceholder, \"g\"),\n pkg.version\n );\n }\n if (code.includes(buildVersionPlaceholder)) {\n transformedCode = transformedCode.replace(\n new RegExp(buildVersionPlaceholder, \"g\"),\n buildVersion\n );\n }\n\n return {\n code: transformedCode,\n map: null // Could generate source map if needed\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,UAAYC,OAAqB,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;AAAA;AAAA,sBAEzBA,CAAO;AAAA,gCACGE,EAAU,MAAM,MAAM,EAAE,KAAK,OAAO,CAAC;AAAA;AAAA;AAAA,UAIrE,CAEA,SAASD,EAAOH,EAAoB,CAEhC,OADaN,EAAO,WAAW,QAAQ,EAAE,OAAOM,CAAU,EAAE,OAAO,KAAK,EAC5D,MAAM,EAAG,CAAC,CAC1B,CCpCO,SAASK,E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CAAC,CAACQ,CAAG,IAAMA,IAAQ,OAASA,IAAQ,eAAe,CAAC,EAAI,CAAC,CACzJ,EACA,QAAS,CACL,MAAAhC,EACA,GAAIwB,EAAgB,SAAW,CAAC,CACpC,EACA,QAAS,CACL,UAAW,GACX,GAAIA,EAAgB,SAAW,CAAC,CACpC,EACA,QAASG,EACT,KAAM,CACF,SAAU,CAACb,EAAYG,CAAa,EACpC,GAAIO,EAAgB,MAAQ,CAAC,CACjC,EACA,GAAG,OAAO,YAAY,OAAO,QAAQA,CAAe,EAAE,OAAO,CAAC,CAACQ,CAAG,IAAM,CAAC,CAAC,QAAS,UAAW,UAAW,SAAS,EAAE,SAASA,CAAG,CAAC,CAAC,CACtI,EAEA,OAAOjB,EAAagB,CAAM,CAC9B",
6
+ "names": ["process", "readFileSync", "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", "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", "configDefaults", "defineConfig", "cssInjectedByJsPlugin", "viteStaticCopy", "packageVersionPlugin", "options", "pkg", "buildVersion", "namePlaceholder", "versionPlaceholder", "buildVersionPlaceholder", "code", "id", "transformedCode", "readFileSync", "resolve", "dirname", "fileURLToPath", "alias", "getRootPackageVersion", "currentDir", "attempts", "maxAttempts", "pkgPath", "pkgContent", "pkg", "parentDir", "error", "hpccBundleNames", "external", "globals", "dep", "nodeConfig", "defineConfig", "configDefaults", "browserConfig", "createHpccViteConfig", "options", "additionalExternal", "additionalPlugins", "includeFontAwesome", "entry", "configOverrides", "allExternals", "buildVersion", "allPlugins", "packageVersionPlugin", "cssInjectedByJsPlugin", "viteStaticCopy", "config", "key"]
7
7
  }