neutronium 1.9.2 → 1.9.3

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.
@@ -21,13 +21,17 @@ function compileProject(projectDir = process.cwd()) {
21
21
  const sourceCode = fs.readFileSync(appJsPath, 'utf-8');
22
22
 
23
23
  log('⚙️ Compiling JSX with Babel...');
24
- const { code: transpiled } = babel.transformSync(sourceCode, {
24
+ let { code: transpiled } = babel.transformSync(sourceCode, {
25
25
  filename: 'App.js',
26
26
  presets: [['@babel/preset-env', { targets: { esmodules: true } }]],
27
27
  plugins: [['@babel/plugin-transform-react-jsx', { pragma: '_neutronium.h' }]],
28
28
  });
29
29
 
30
- transpiled = transpiled.replace(/(const|var|let)\s+_neutronium\s*=\s*require\(["']neutronium["']\);?/g, '');
30
+ // Remove CommonJS require if present
31
+ transpiled = transpiled.replace(
32
+ /(const|var|let)\s+_neutronium\s*=\s*require\(["']neutronium["']\);?/g,
33
+ ''
34
+ );
31
35
 
32
36
  const finalJsCode = `
33
37
  import * as _neutronium from '${neutroniumPath}';
@@ -36,7 +40,6 @@ import * as _neutronium from '${neutroniumPath}';
36
40
 
37
41
  ${transpiled}
38
42
 
39
- (0, _neutronium.createApp)(App).mount('#app');
40
43
  _neutronium.createApp(App).mount('#app');
41
44
  `.trim();
42
45
 
@@ -54,23 +57,6 @@ _neutronium.createApp(App).mount('#app');
54
57
  }
55
58
  }
56
59
 
57
- function compileProjectWatch(projectDir = process.cwd(), port = 3000) {
58
- const appJsPath = path.join(projectDir, 'App.js');
59
-
60
- const server = serveProject(projectDir, port);
61
- compileProject(projectDir);
62
-
63
- log('👀 Watching App.js for changes...');
64
- chokidar.watch(appJsPath).on('change', () => {
65
- console.clear();
66
- log('🔁 Detected change in App.js...');
67
- compileProject(projectDir);
68
- if (server.broadcastReload) {
69
- server.broadcastReload();
70
- }
71
- });
72
- }
73
-
74
60
  function serveProject(projectDir = process.cwd(), port = 3000) {
75
61
  const distDir = path.join(projectDir, 'dist');
76
62
 
@@ -106,7 +92,7 @@ function serveProject(projectDir = process.cwd(), port = 3000) {
106
92
 
107
93
  server.listen(port, () => {
108
94
  log(`🚀 Server running at http://localhost:${port}`);
109
- open(`http://localhost:${port}`);
95
+ open(`http://localhost:${port}/dist/index.html`);
110
96
  });
111
97
 
112
98
  return server;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neutronium",
3
- "version": "1.9.2",
3
+ "version": "1.9.3",
4
4
  "description": "A dense, efficient JavaScript framework for building modern web applications",
5
5
  "main": "src/index.js",
6
6
  "type": "commonjs",