@hpcc-js/esbuild-plugins 1.4.8 → 1.5.0
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 +4 -4
- package/dist/index.js.map +3 -3
- package/dist/sfx-wrapper.js +5 -5
- package/dist/sfx-wrapper.js.map +4 -4
- package/package.json +6 -7
- package/src/build.ts +2 -2
- package/src/vite-utils.ts +67 -9
- package/types/vite-utils.d.ts +5 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hpcc-js/esbuild-plugins",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Various esbuild plugins",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -37,18 +37,17 @@
|
|
|
37
37
|
"update": "npx --yes npm-check-updates -u -t minor"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"esbuild": "0.25.
|
|
40
|
+
"esbuild": "0.25.9",
|
|
41
41
|
"esbuild-copy-static-files": "0.1.0",
|
|
42
42
|
"esbuild-plugin-inline-css": "0.0.1",
|
|
43
43
|
"esbuild-plugin-umd-wrapper": "3.0.0",
|
|
44
44
|
"fzstd": "0.1.1",
|
|
45
|
-
"vite": "7.0.0",
|
|
46
45
|
"vite-plugin-css-injected-by-js": "3.5.2",
|
|
47
|
-
"vite-plugin-static-copy": "3.1.
|
|
46
|
+
"vite-plugin-static-copy": "3.1.2"
|
|
48
47
|
},
|
|
49
48
|
"devDependencies": {
|
|
50
|
-
"@hpcc-js/wasm-base91": "1.
|
|
51
|
-
"@hpcc-js/wasm-zstd": "1.
|
|
49
|
+
"@hpcc-js/wasm-base91": "1.6.0",
|
|
50
|
+
"@hpcc-js/wasm-zstd": "1.5.0"
|
|
52
51
|
},
|
|
53
52
|
"keywords": [
|
|
54
53
|
"esbuild",
|
|
@@ -64,5 +63,5 @@
|
|
|
64
63
|
},
|
|
65
64
|
"homepage": "https://hpcc-systems.github.io/hpcc-js-wasm/",
|
|
66
65
|
"license": "Apache-2.0",
|
|
67
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "e0dd2c2201ba3d9bd92665026ef38e3220065a9c"
|
|
68
67
|
}
|
package/src/build.ts
CHANGED
|
@@ -113,7 +113,7 @@ export function browserTpl(input: string, output: string, options: TplOptions =
|
|
|
113
113
|
target: "es2022",
|
|
114
114
|
globalName: options.globalName,
|
|
115
115
|
keepNames: options.keepNames,
|
|
116
|
-
plugins: options.format === "umd" ? [umdWrapper({ libraryName: options.libraryName }), ...options.plugins ?? []] : options.plugins,
|
|
116
|
+
plugins: options.format === "umd" ? [umdWrapper({ libraryName: options.libraryName }) as Plugin, ...options.plugins ?? []] : options.plugins,
|
|
117
117
|
alias: options.alias,
|
|
118
118
|
define: options.define,
|
|
119
119
|
loader: options.loader,
|
|
@@ -156,7 +156,7 @@ export function neutralTpl(input: string, output: string, options: TplOptions =
|
|
|
156
156
|
target: "es2022",
|
|
157
157
|
globalName: options.globalName,
|
|
158
158
|
keepNames: options.keepNames,
|
|
159
|
-
plugins: options.format === "umd" ? [umdWrapper({ libraryName: options.libraryName }), ...options.plugins ?? []] : options.plugins,
|
|
159
|
+
plugins: options.format === "umd" ? [umdWrapper({ libraryName: options.libraryName }) as Plugin, ...options.plugins ?? []] : options.plugins,
|
|
160
160
|
alias: options.alias,
|
|
161
161
|
define: options.define,
|
|
162
162
|
loader: options.loader,
|
package/src/vite-utils.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineConfig,
|
|
1
|
+
import { configDefaults, defineConfig, ViteUserConfig } from "vitest/config";
|
|
2
2
|
import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
|
|
3
3
|
import { viteStaticCopy } from "vite-plugin-static-copy";
|
|
4
4
|
|
|
@@ -54,19 +54,65 @@ export interface ViteHpccConfigOptions {
|
|
|
54
54
|
/**
|
|
55
55
|
* Additional vite config options to merge
|
|
56
56
|
*/
|
|
57
|
-
configOverrides?: Partial<
|
|
57
|
+
configOverrides?: Partial<ViteUserConfig>;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
export const nodeConfig = defineConfig({
|
|
61
|
+
test: {
|
|
62
|
+
name: "node",
|
|
63
|
+
|
|
64
|
+
exclude: [
|
|
65
|
+
...configDefaults.exclude,
|
|
66
|
+
"**/*.browser.spec.{ts,js}",
|
|
67
|
+
"**/node_modules/**",
|
|
68
|
+
"**/.nx/**",
|
|
69
|
+
"**/apps/**",
|
|
70
|
+
"**/components/**",
|
|
71
|
+
"**/demos/**",
|
|
72
|
+
],
|
|
73
|
+
environment: "node",
|
|
74
|
+
setupFiles: []
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
export const browserConfig = defineConfig({
|
|
79
|
+
test: {
|
|
80
|
+
exclude: [
|
|
81
|
+
...configDefaults.exclude,
|
|
82
|
+
"@hpcc-js/dgrid-shim",
|
|
83
|
+
"**/*.node.spec.{ts,js}",
|
|
84
|
+
"**/node_modules/**",
|
|
85
|
+
"**/.nx/**",
|
|
86
|
+
"**/apps/**",
|
|
87
|
+
"**/components/**",
|
|
88
|
+
"**/demos/**",
|
|
89
|
+
"**/src/**",
|
|
90
|
+
],
|
|
91
|
+
browser: {
|
|
92
|
+
enabled: true,
|
|
93
|
+
provider: "playwright",
|
|
94
|
+
instances: [{
|
|
95
|
+
name: "chromium",
|
|
96
|
+
browser: "chromium",
|
|
97
|
+
headless: true,
|
|
98
|
+
//@ts-expect-error
|
|
99
|
+
launch: {
|
|
100
|
+
args: ["--disable-web-security"],
|
|
101
|
+
}
|
|
102
|
+
}],
|
|
103
|
+
screenshotFailures: false,
|
|
104
|
+
},
|
|
105
|
+
setupFiles: [],
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
export function createHpccViteConfig(pkg: any, options: ViteHpccConfigOptions = {}): ViteUserConfig {
|
|
64
110
|
const {
|
|
65
111
|
external: additionalExternal = [],
|
|
66
112
|
plugins: additionalPlugins = [],
|
|
67
113
|
includeFontAwesome = false,
|
|
68
114
|
entry = "src/index.ts",
|
|
69
|
-
configOverrides = {}
|
|
115
|
+
configOverrides = {},
|
|
70
116
|
} = options;
|
|
71
117
|
|
|
72
118
|
const { alias, external, globals } = hpccBundleNames(pkg);
|
|
@@ -101,7 +147,7 @@ export function createHpccViteConfig(pkg: any, options: ViteHpccConfigOptions =
|
|
|
101
147
|
fileName: "index",
|
|
102
148
|
};
|
|
103
149
|
|
|
104
|
-
const config:
|
|
150
|
+
const config: ViteUserConfig = {
|
|
105
151
|
build: {
|
|
106
152
|
lib: {
|
|
107
153
|
...defaultLibConfig,
|
|
@@ -114,6 +160,14 @@ export function createHpccViteConfig(pkg: any, options: ViteHpccConfigOptions =
|
|
|
114
160
|
},
|
|
115
161
|
...(configOverrides.build?.rollupOptions || {})
|
|
116
162
|
},
|
|
163
|
+
// Preserve class names and function names in minified output
|
|
164
|
+
minify: "terser",
|
|
165
|
+
terserOptions: {
|
|
166
|
+
keep_classnames: true,
|
|
167
|
+
mangle: {
|
|
168
|
+
keep_classnames: true,
|
|
169
|
+
}
|
|
170
|
+
},
|
|
117
171
|
sourcemap: true,
|
|
118
172
|
...(configOverrides.build ? Object.fromEntries(Object.entries(configOverrides.build).filter(([key]) => key !== "lib" && key !== "rollupOptions")) : {})
|
|
119
173
|
},
|
|
@@ -122,10 +176,14 @@ export function createHpccViteConfig(pkg: any, options: ViteHpccConfigOptions =
|
|
|
122
176
|
...(configOverrides.resolve || {})
|
|
123
177
|
},
|
|
124
178
|
esbuild: {
|
|
125
|
-
|
|
179
|
+
keepNames: true,
|
|
126
180
|
...(configOverrides.esbuild || {})
|
|
127
181
|
},
|
|
128
182
|
plugins: allPlugins,
|
|
183
|
+
test: {
|
|
184
|
+
projects: [nodeConfig, browserConfig],
|
|
185
|
+
...(configOverrides.test || {})
|
|
186
|
+
},
|
|
129
187
|
...Object.fromEntries(Object.entries(configOverrides).filter(([key]) => !["build", "resolve", "esbuild", "plugins"].includes(key)))
|
|
130
188
|
};
|
|
131
189
|
|
package/types/vite-utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ViteUserConfig } from "vitest/config";
|
|
2
2
|
export declare function hpccBundleNames(pkg: any): {
|
|
3
3
|
alias: {};
|
|
4
4
|
external: string[];
|
|
@@ -26,9 +26,8 @@ export interface ViteHpccConfigOptions {
|
|
|
26
26
|
/**
|
|
27
27
|
* Additional vite config options to merge
|
|
28
28
|
*/
|
|
29
|
-
configOverrides?: Partial<
|
|
29
|
+
configOverrides?: Partial<ViteUserConfig>;
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
export declare function createHpccViteConfig(pkg: any, options?: ViteHpccConfigOptions): UserConfig;
|
|
31
|
+
export declare const nodeConfig: ViteUserConfig;
|
|
32
|
+
export declare const browserConfig: ViteUserConfig & Promise<ViteUserConfig> & (import("vitest/config").UserConfigFnObject & import("vitest/config").UserConfigExport);
|
|
33
|
+
export declare function createHpccViteConfig(pkg: any, options?: ViteHpccConfigOptions): ViteUserConfig;
|