makepack 1.7.4 → 1.7.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "makepack",
3
- "version": "1.7.4",
3
+ "version": "1.7.6",
4
4
  "type": "module",
5
5
  "description": "A CLI tool to create, build, and manage JavaScript, TypeScript, React, and React-TypeScript libraries for npm projects.",
6
6
  "categories": [
@@ -30,6 +30,7 @@
30
30
  "@rollup/plugin-node-resolve": "^16.0.1",
31
31
  "@rollup/plugin-terser": "^0.4.4",
32
32
  "@rollup/plugin-typescript": "^12.1.2",
33
+ "@types/fs-extra": "^11.0.4",
33
34
  "chokidar": "^4.0.3",
34
35
  "commander": "^12.1.0",
35
36
  "esbuild": "^0.25.5",
@@ -39,13 +40,12 @@
39
40
  "lodash.debounce": "^4.0.8",
40
41
  "madge": "^8.0.0",
41
42
  "ora": "^8.1.1",
43
+ "react": "^19.1.0",
44
+ "react-dom": "^19.0.0",
42
45
  "rollup": "^4.43.0",
43
46
  "rollup-plugin-dts": "^6.2.1",
44
47
  "tslib": "^2.8.1",
45
- "vite": "^6.0.2",
46
- "@types/fs-extra": "^11.0.4",
47
- "react": "^19.1.0",
48
- "react-dom": "^19.0.0"
48
+ "vite": "^6.0.2"
49
49
  },
50
50
  "keywords": [
51
51
  "CLI",
@@ -9,38 +9,40 @@ import dts from "rollup-plugin-dts";
9
9
  import json from '@rollup/plugin-json';
10
10
  import terser from "@rollup/plugin-terser";
11
11
 
12
- async function bundler(args, spinner) {
12
+ async function bind(args, spinner) {
13
13
  const pkg = JSON.parse(fs.readFileSync("./package.json", "utf-8"));
14
- const external = [
14
+ const _external = [
15
15
  ...builtinModules,
16
16
  ...Object.keys(pkg.dependencies ?? {}),
17
17
  ...Object.keys(pkg.devDependencies ?? {}),
18
18
  ...Object.keys(pkg.peerDependencies ?? {}),
19
+ "tslib",
19
20
  ];
20
21
 
21
- // remove tslib
22
- const tslibIndex = external.indexOf("tslib");
23
- if (tslibIndex !== -1) {
24
- external.splice(tslibIndex, 1);
25
- }
26
-
27
22
  const isTs = args.entry.endsWith(".ts")
28
23
 
29
24
  const config = {
30
25
  input: [args.entry],
31
- external,
26
+ external: (id) => {
27
+ return !id.startsWith('.') && !id.startsWith('/') && !/^[A-Za-z]:\\/.test(id);
28
+ },
32
29
  plugins: [
33
30
  json(),
34
- resolve(),
31
+ resolve({
32
+ extensions: ['.js', '.ts', '.jsx', '.tsx', '.json', '.mjs', '.cjs'],
33
+ browser: false
34
+ }),
35
35
  commonjs(),
36
36
  isTs ? typescript({
37
- compilerOptions: {
38
- "module": "ESNext",
39
- "jsx": "react",
40
- "strict": true,
41
- "forceConsistentCasingInFileNames": true,
42
- "esModuleInterop": true
43
- },
37
+ target: "ES2017",
38
+ module: "ESNext",
39
+ jsx: "react",
40
+ strict: true,
41
+ forceConsistentCasingInFileNames: true,
42
+ esModuleInterop: true,
43
+ importHelpers: true,
44
+ moduleResolution: "node",
45
+ skipLibCheck: true,
44
46
  include: ["src/**/*.ts", "src/**/*.tsx"],
45
47
  exclude: ["node_modules", ".mpack"],
46
48
  }) : null,
@@ -80,6 +82,20 @@ async function bundler(args, spinner) {
80
82
  outputOptions = [esm];
81
83
  } else if (args.format === "cjs") {
82
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
+ }];
83
99
  }
84
100
 
85
101
  for (const output of outputOptions) {
@@ -102,4 +118,4 @@ async function bundler(args, spinner) {
102
118
  }
103
119
  }
104
120
 
105
- export default bundler;
121
+ export default bind;