@frozzare/pkg 1.0.1 → 1.0.3
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.d.ts +1 -1
- package/dist/index.js +6 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { BuildOptions as ESBuildOptions } from 'esbuild';
|
|
2
2
|
export type BuildOptions = Omit<ESBuildOptions, 'bundle' | 'entryPoints'>;
|
|
3
|
-
export declare const build: (entryPoint: string,
|
|
3
|
+
export declare const build: (entryPoint: string, options?: BuildOptions) => Promise<string | void>;
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,11 @@ exports.build = void 0;
|
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const esbuild_1 = require("esbuild");
|
|
10
|
-
const
|
|
10
|
+
const defaultOptions = {
|
|
11
|
+
write: true,
|
|
12
|
+
};
|
|
13
|
+
const build = async (entryPoint, options = {}) => {
|
|
14
|
+
const config = { ...defaultOptions, ...options };
|
|
11
15
|
const out = await (0, esbuild_1.build)({
|
|
12
16
|
...config,
|
|
13
17
|
entryPoints: [entryPoint],
|
|
@@ -23,7 +27,7 @@ const build = async (entryPoint, config = {}) => {
|
|
|
23
27
|
throw new Error('Failed to find export name');
|
|
24
28
|
}
|
|
25
29
|
const name = match === null || match === void 0 ? void 0 : match[1].replace('_exports', '_default');
|
|
26
|
-
text = text.replace((match === null || match === void 0 ? void 0 : match[0]) || '', '') + `\nmodule.exports = ${name}
|
|
30
|
+
text = text.replace((match === null || match === void 0 ? void 0 : match[0]) || '', '') + `\nmodule.exports = ${name};`;
|
|
27
31
|
}
|
|
28
32
|
if (!config.write) {
|
|
29
33
|
return text;
|