@hpcc-js/esbuild-plugins 1.4.6 → 1.4.8
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 +2 -2
- package/dist/sfx-wrapper.js +3 -3
- package/dist/sfx-wrapper.js.map +1 -1
- package/package.json +4 -4
- package/src/build.ts +12 -8
- package/src/sfx-wrapper.ts +1 -1
- package/types/build.d.ts +4 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hpcc-js/esbuild-plugins",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.8",
|
|
4
4
|
"description": "Various esbuild plugins",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -41,14 +41,14 @@
|
|
|
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
|
+
"fzstd": "0.1.1",
|
|
44
45
|
"vite": "7.0.0",
|
|
45
46
|
"vite-plugin-css-injected-by-js": "3.5.2",
|
|
46
47
|
"vite-plugin-static-copy": "3.1.0"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
50
|
"@hpcc-js/wasm-base91": "1.3.1",
|
|
50
|
-
"@hpcc-js/wasm-zstd": "1.2.1"
|
|
51
|
-
"fzstd": "0.1.1"
|
|
51
|
+
"@hpcc-js/wasm-zstd": "1.2.1"
|
|
52
52
|
},
|
|
53
53
|
"keywords": [
|
|
54
54
|
"esbuild",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
},
|
|
65
65
|
"homepage": "https://hpcc-systems.github.io/hpcc-js-wasm/",
|
|
66
66
|
"license": "Apache-2.0",
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "ef271e12a3730c4503a82f80a37aaaa29643e1e3"
|
|
68
68
|
}
|
package/src/build.ts
CHANGED
|
@@ -14,7 +14,11 @@ export const pkg = JSON.parse(readFileSync(path.join(process.cwd(), "./package.j
|
|
|
14
14
|
export const NODE_MJS = pkg.type === "module" ? "js" : "mjs";
|
|
15
15
|
export const NODE_CJS = pkg.type === "module" ? "cjs" : "js";
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
interface BuildOptionsEx extends Omit<BuildOptions, "format"> {
|
|
18
|
+
format?: Format | "umd";
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export async function buildWatch(inputs: string[] | Record<string, string> | { in: string, out: string }[], config: BuildOptionsEx): Promise<void> {
|
|
18
22
|
const isDevelopment = process.argv.includes("--development");
|
|
19
23
|
const isWatch = process.argv.includes("--watch");
|
|
20
24
|
const isProduction = !isDevelopment;
|
|
@@ -30,7 +34,7 @@ export const BUILD_VERSION = "${rootPkg.version}";
|
|
|
30
34
|
|
|
31
35
|
config = {
|
|
32
36
|
entryPoints: inputs,
|
|
33
|
-
format: "esm",
|
|
37
|
+
format: config.format ?? "esm",
|
|
34
38
|
bundle: true,
|
|
35
39
|
minify: isProduction,
|
|
36
40
|
sourcemap: true,
|
|
@@ -59,7 +63,7 @@ export const BUILD_VERSION = "${rootPkg.version}";
|
|
|
59
63
|
...config.nodePaths ?? []
|
|
60
64
|
]
|
|
61
65
|
};
|
|
62
|
-
const ctx = await esbuild.context(config);
|
|
66
|
+
const ctx = await esbuild.context(config as BuildOptions);
|
|
63
67
|
|
|
64
68
|
if (isWatch) {
|
|
65
69
|
await ctx.watch();
|
|
@@ -102,14 +106,14 @@ export function browserTpl(input: string, output: string, options: TplOptions =
|
|
|
102
106
|
options.format = options.format ?? "esm";
|
|
103
107
|
|
|
104
108
|
return buildWatch([input], {
|
|
105
|
-
format: options.format
|
|
109
|
+
format: options.format,
|
|
106
110
|
external: options.external ?? [],
|
|
107
111
|
outfile: `${output}.${options.format === "esm" ? "js" : `${options.format}.js`}`,
|
|
108
112
|
platform: "browser",
|
|
109
113
|
target: "es2022",
|
|
110
114
|
globalName: options.globalName,
|
|
111
115
|
keepNames: options.keepNames,
|
|
112
|
-
plugins: options.format === "umd" ? [
|
|
116
|
+
plugins: options.format === "umd" ? [umdWrapper({ libraryName: options.libraryName }), ...options.plugins ?? []] : options.plugins,
|
|
113
117
|
alias: options.alias,
|
|
114
118
|
define: options.define,
|
|
115
119
|
loader: options.loader,
|
|
@@ -125,7 +129,7 @@ export function nodeTpl(input: string, output: string, options: TplOptions = {})
|
|
|
125
129
|
}
|
|
126
130
|
|
|
127
131
|
return buildWatch([input], {
|
|
128
|
-
format: options.format
|
|
132
|
+
format: options.format,
|
|
129
133
|
external: options.external ?? [],
|
|
130
134
|
outfile: `${output}.${options.format === "esm" ? NODE_MJS : NODE_CJS}`,
|
|
131
135
|
platform: "node",
|
|
@@ -145,14 +149,14 @@ export function neutralTpl(input: string, output: string, options: TplOptions =
|
|
|
145
149
|
options.format = options.format ?? "esm";
|
|
146
150
|
|
|
147
151
|
return buildWatch([input], {
|
|
148
|
-
format: options.format
|
|
152
|
+
format: options.format,
|
|
149
153
|
external: options.external ?? [],
|
|
150
154
|
outfile: `${output}.${options.format === "esm" ? "js" : `${options.format}.js`}`,
|
|
151
155
|
platform: "neutral",
|
|
152
156
|
target: "es2022",
|
|
153
157
|
globalName: options.globalName,
|
|
154
158
|
keepNames: options.keepNames,
|
|
155
|
-
plugins: options.format === "umd" ? [
|
|
159
|
+
plugins: options.format === "umd" ? [umdWrapper({ libraryName: options.libraryName }), ...options.plugins ?? []] : options.plugins,
|
|
156
160
|
alias: options.alias,
|
|
157
161
|
define: options.define,
|
|
158
162
|
loader: options.loader,
|
package/src/sfx-wrapper.ts
CHANGED
package/types/build.d.ts
CHANGED
|
@@ -4,10 +4,13 @@ export { copyStaticFiles };
|
|
|
4
4
|
export declare const pkg: any;
|
|
5
5
|
export declare const NODE_MJS: string;
|
|
6
6
|
export declare const NODE_CJS: string;
|
|
7
|
+
interface BuildOptionsEx extends Omit<BuildOptions, "format"> {
|
|
8
|
+
format?: Format | "umd";
|
|
9
|
+
}
|
|
7
10
|
export declare function buildWatch(inputs: string[] | Record<string, string> | {
|
|
8
11
|
in: string;
|
|
9
12
|
out: string;
|
|
10
|
-
}[], config:
|
|
13
|
+
}[], config: BuildOptionsEx): Promise<void>;
|
|
11
14
|
export type TplOptions = {
|
|
12
15
|
format?: Format | "umd";
|
|
13
16
|
globalName?: string;
|