@web-applets/inspector 0.2.0 → 0.2.2

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.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export declare function serve(): Promise<void>;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../cli/index.ts"],"names":[],"mappings":";AAeA,wBAAsB,KAAK,kBAyB1B"}
package/dist/index.js ADDED
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.serve = serve;
8
+ const commander_1 = require("commander");
9
+ const express_1 = __importDefault(require("express"));
10
+ const path_1 = __importDefault(require("path"));
11
+ const program = new commander_1.Command();
12
+ program
13
+ .name('@web-applets/inspector')
14
+ .description('Launch the web applets inspector.')
15
+ .action(serve);
16
+ program.parse(process.argv);
17
+ async function serve() {
18
+ let port = 1234;
19
+ const serverDir = path_1.default.join(__dirname, 'web');
20
+ const app = (0, express_1.default)();
21
+ app.use(express_1.default.static(serverDir));
22
+ try {
23
+ const server = app
24
+ .listen(port, () => {
25
+ console.log(`Applets inspector running at http://localhost:${port}`);
26
+ })
27
+ .on('error', (err) => {
28
+ if (err.code === 'EADDRINUSE') {
29
+ const oldPort = port;
30
+ port += 1;
31
+ console.log(`Port ${oldPort} is busy, trying port ${port}`);
32
+ server.listen(port);
33
+ }
34
+ else {
35
+ console.error(err);
36
+ }
37
+ });
38
+ }
39
+ catch (error) {
40
+ console.error('Error starting inspector web server:', error);
41
+ process.exit(1);
42
+ }
43
+ }
package/package.json CHANGED
@@ -9,7 +9,8 @@
9
9
  "start": "npm run build && node dist/index.js",
10
10
  "build": "./scripts/build.sh",
11
11
  "build:cli": "tsc",
12
- "build:web": "cd web && npm run build"
12
+ "build:web": "cd web && npm run build",
13
+ "prepublishOnly": "npm run build"
13
14
  },
14
15
  "files": [
15
16
  "dist"
@@ -32,7 +33,8 @@
32
33
  "@types/express": "^5.0.0",
33
34
  "@types/fs-extra": "^11.0.4",
34
35
  "@types/node": "^22.7.5",
35
- "typescript": "^5.6.2"
36
+ "typescript": "^5.6.2",
37
+ "rollup": "^4.34.9"
36
38
  },
37
- "version": "0.2.0"
39
+ "version": "0.2.2"
38
40
  }