makepack 1.5.18 → 1.5.20

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.18",
3
+ "version": "1.5.20",
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": [
@@ -4,14 +4,12 @@ import chalk from 'chalk';
4
4
  import makepackConfig from '../../makepack-config.js';
5
5
  import viteSetup from './vite.js';
6
6
  import userExpress from './user-express.js';
7
- import path from 'path';
8
7
 
9
8
  const app = express();
10
9
  const server = async () => {
11
10
  const config = await makepackConfig()
12
11
  userExpress(app)
13
12
  await viteSetup(app)
14
- app.use(express.static(path.join(process.cwd(), 'public')));
15
13
  app.use((_req, res) => {
16
14
  res.status(500).send('Internal Server Error');
17
15
  });
@@ -44,29 +44,25 @@ const start = async () => {
44
44
 
45
45
  if (fs.existsSync(expressjs) || fs.existsSync(expressts)) {
46
46
  let filename = fs.existsSync(expressjs) ? "express.js" : "express.ts";
47
- const build = () => {
48
- esbuild.build({
49
- entryPoints: [filename],
50
- outfile: path.resolve(__dirname, 'user-express.js'),
51
- bundle: true,
52
- format: 'esm',
53
- platform: 'node',
54
- });
55
- }
47
+ let outfile = path.resolve(__dirname, 'user-express.js')
56
48
 
57
- build()
49
+ const ctx = await esbuild.context({
50
+ entryPoints: [filename],
51
+ outfile: path.resolve(__dirname, 'user-express.js'),
52
+ bundle: true,
53
+ format: 'esm',
54
+ platform: 'node',
55
+ external: ['*'],
56
+ })
58
57
 
59
- const watcher = chokidar.watch(filename, {
58
+ ctx.watch()
59
+
60
+ const watcher = chokidar.watch(outfile, {
60
61
  persistent: true,
61
62
  ignoreInitial: true,
62
63
  });
63
64
 
64
65
  watcher.on('change', async () => {
65
- build()
66
- startServer(config)
67
- });
68
-
69
- watcher.on('unlink', (path) => {
70
66
  startServer(config)
71
67
  });
72
68
 
@@ -1,7 +1,7 @@
1
1
  // express.ts
2
- var express = (app) => {
2
+ var expressApp = (app) => {
3
3
  };
4
- var express_default = express;
4
+ var express_default = expressApp;
5
5
  export {
6
6
  express_default as default
7
7
  };