makepack 1.7.5 → 1.7.7
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/package.json +1 -1
- package/src/actions/build/bundler.js +29 -10
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import { rollup } from "rollup";
|
|
|
2
2
|
import resolve from "@rollup/plugin-node-resolve";
|
|
3
3
|
import commonjs from "@rollup/plugin-commonjs";
|
|
4
4
|
import typescript from "@rollup/plugin-typescript";
|
|
5
|
-
import { builtinModules } from "module";
|
|
5
|
+
// import { builtinModules } from "module";
|
|
6
6
|
import fs from "fs";
|
|
7
7
|
import path from "path";
|
|
8
8
|
import dts from "rollup-plugin-dts";
|
|
@@ -10,14 +10,14 @@ import json from '@rollup/plugin-json';
|
|
|
10
10
|
import terser from "@rollup/plugin-terser";
|
|
11
11
|
|
|
12
12
|
async function bind(args, spinner) {
|
|
13
|
-
const pkg = JSON.parse(fs.readFileSync("./package.json", "utf-8"));
|
|
14
|
-
const _external = [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
];
|
|
13
|
+
// const pkg = JSON.parse(fs.readFileSync("./package.json", "utf-8"));
|
|
14
|
+
// const _external = [
|
|
15
|
+
// ...builtinModules,
|
|
16
|
+
// ...Object.keys(pkg.dependencies ?? {}),
|
|
17
|
+
// ...Object.keys(pkg.devDependencies ?? {}),
|
|
18
|
+
// ...Object.keys(pkg.peerDependencies ?? {}),
|
|
19
|
+
// "tslib",
|
|
20
|
+
// ];
|
|
21
21
|
|
|
22
22
|
const isTs = args.entry.endsWith(".ts")
|
|
23
23
|
|
|
@@ -28,7 +28,10 @@ async function bind(args, spinner) {
|
|
|
28
28
|
},
|
|
29
29
|
plugins: [
|
|
30
30
|
json(),
|
|
31
|
-
resolve(
|
|
31
|
+
resolve({
|
|
32
|
+
extensions: ['.js', '.ts', '.jsx', '.tsx', '.json', '.mjs', '.cjs'],
|
|
33
|
+
browser: false
|
|
34
|
+
}),
|
|
32
35
|
commonjs(),
|
|
33
36
|
isTs ? typescript({
|
|
34
37
|
target: "ES2017",
|
|
@@ -79,6 +82,20 @@ async function bind(args, spinner) {
|
|
|
79
82
|
outputOptions = [esm];
|
|
80
83
|
} else if (args.format === "cjs") {
|
|
81
84
|
outputOptions = [cjs];
|
|
85
|
+
} else if (args.format === "iife") {
|
|
86
|
+
outputOptions = [{
|
|
87
|
+
...esm,
|
|
88
|
+
format: "iife",
|
|
89
|
+
name: args.name || path.basename(args.entry, path.extname(args.entry)),
|
|
90
|
+
entryFileNames: '[name].js',
|
|
91
|
+
}];
|
|
92
|
+
} else if (args.format === "umd") {
|
|
93
|
+
outputOptions = [{
|
|
94
|
+
...esm,
|
|
95
|
+
format: "umd",
|
|
96
|
+
name: args.name || path.basename(args.entry, path.extname(args.entry)),
|
|
97
|
+
entryFileNames: '[name].js',
|
|
98
|
+
}];
|
|
82
99
|
}
|
|
83
100
|
|
|
84
101
|
for (const output of outputOptions) {
|
|
@@ -95,6 +112,8 @@ async function bind(args, spinner) {
|
|
|
95
112
|
});
|
|
96
113
|
await bundlets.write({
|
|
97
114
|
format: "esm",
|
|
115
|
+
preserveModules: true,
|
|
116
|
+
preserveModulesRoot: args.rootdir,
|
|
98
117
|
dir: path.join(args.outdir),
|
|
99
118
|
});
|
|
100
119
|
await bundlets.close();
|