@axiomify/cli 2.0.1 → 3.0.0

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.
@@ -39,7 +39,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.devServer = devServer;
40
40
  const child_process_1 = require("child_process");
41
41
  const esbuild = __importStar(require("esbuild"));
42
+ const fs_1 = __importDefault(require("fs"));
42
43
  const path_1 = __importDefault(require("path"));
44
+ // 🚀 THE FIX: Dynamically detect what the user has installed
45
+ async function getUserExternals(cwd) {
46
+ try {
47
+ const pkg = JSON.parse(fs_1.default.readFileSync(path_1.default.join(cwd, 'package.json'), 'utf8'));
48
+ return [
49
+ ...Object.keys(pkg.dependencies || {}),
50
+ ...Object.keys(pkg.devDependencies || {}),
51
+ ...Object.keys(pkg.peerDependencies || {}),
52
+ ];
53
+ }
54
+ catch {
55
+ return [];
56
+ }
57
+ }
43
58
  async function devServer(entry) {
44
59
  const entryPath = path_1.default.resolve(process.cwd(), entry);
45
60
  const outPath = path_1.default.resolve(process.cwd(), '.axiomify/dev.js');
@@ -63,18 +78,13 @@ async function devServer(entry) {
63
78
  });
64
79
  },
65
80
  };
81
+ const userExternals = await getUserExternals(process.cwd());
66
82
  const ctx = await esbuild.context({
67
83
  entryPoints: [entryPath],
68
84
  bundle: true,
69
85
  platform: 'node',
70
86
  outfile: outPath,
71
- external: [
72
- 'express',
73
- '@axiomify/core',
74
- '@axiomify/express',
75
- '@axiomify/logger',
76
- 'maskify-ts',
77
- ],
87
+ external: [...new Set([...userExternals, 'node:*'])],
78
88
  plugins: [watchPlugin],
79
89
  });
80
90
  console.log(`👀 Axiomify Dev Engine watching for changes...`);
@@ -56,7 +56,8 @@ async function inspectRoutes(entry) {
56
56
  // 2. Clear require cache to ensure fresh load
57
57
  delete require.cache[require.resolve(tempPath)];
58
58
  // 3. Import the compiled app
59
- const mod = require(tempPath);
59
+ const fileUrl = `file://${tempPath}?t=${Date.now()}`;
60
+ const mod = await Promise.resolve(`${fileUrl}`).then(s => __importStar(require(s)));
60
61
  const app = mod.app || mod.default;
61
62
  if (!app || typeof app.registeredRoutes === 'undefined') {
62
63
  console.error('❌ Error: Could not find an exported Axiomify instance.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axiomify/cli",
3
- "version": "2.0.1",
3
+ "version": "3.0.0",
4
4
  "bin": {
5
5
  "axiomify": "./dist/index.js"
6
6
  },