makepack 1.5.8 → 1.5.10

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.5.8",
3
+ "version": "1.5.10",
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
  "files": [
@@ -22,38 +22,45 @@ const build = async () => {
22
22
  fs.mkdirSync(outdir);
23
23
  } catch (err) { }
24
24
 
25
+ const batchSize = 500;
25
26
  for (let ebconfig of configs) {
26
- const files = await glob(ebconfig.entryPoints) || []
27
- const entryPoints = files.map(entry => path.join(process.cwd(), entry))
28
- esbuild.buildSync({
29
- ...ebconfig,
30
- entryPoints,
31
- outdir: path.join(outdir, ebconfig.outdir || ''),
32
- });
27
+ const files = await glob(ebconfig.entryPoints) || [];
28
+ const entryPoints = files.map(entry => path.join(process.cwd(), entry));
29
+ for (let i = 0; i < entryPoints.length; i += batchSize) {
30
+ const batch = entryPoints.slice(i, i + batchSize);
31
+ await esbuild.build({
32
+ ...ebconfig,
33
+ entryPoints: batch,
34
+ outdir: path.join(outdir, ebconfig.outdir || ''),
35
+ });
36
+ }
33
37
  }
34
38
 
35
39
  if (build.types) {
36
- const rootDir = process.cwd(); // Get the project root directory
37
- const tsconfigPath = path.join(rootDir, 'tsconfig.json');
38
-
40
+ const tsconfigPath = path.resolve(process.cwd(), "tsconfig.json");
39
41
  let tsconfig = {};
40
42
  if (fs.existsSync(tsconfigPath)) {
41
- const rawConfig = fs.readFileSync(tsconfigPath, 'utf8');
42
- const parsedConfig = ts.parseConfigFileTextToJson(tsconfigPath, rawConfig);
43
- if (parsedConfig.error) {
44
- console.error("❌ Error parsing tsconfig.json:", parsedConfig.error);
43
+ const parsedConfig = ts.getParsedCommandLineOfConfigFile(
44
+ tsconfigPath,
45
+ {},
46
+ ts.sys
47
+ );
48
+
49
+ if (!parsedConfig) {
50
+ console.error("❌ Error parsing tsconfig.json");
51
+ process.exit(1);
45
52
  } else {
46
- tsconfig = parsedConfig.config.compilerOptions || {};
53
+ tsconfig = parsedConfig.options;
47
54
  }
48
55
  }
49
56
 
50
57
  tsconfig = {
51
58
  allowJs: true,
52
- target: ts.ScriptTarget.ESNext,
59
+ target: ts.ScriptTarget.ESNext, // Ensure it's an enum
53
60
  skipLibCheck: true,
54
61
  moduleResolution: ts.ModuleResolutionKind.Node10,
55
- ...tsconfig,
56
- outDir: path.join(outdir, 'types'),
62
+ ...tsconfig, // Preserve root tsconfig settings
63
+ outDir: path.join(outdir, "types"),
57
64
  declaration: true,
58
65
  emitDeclarationOnly: true,
59
66
  noEmit: false,