neutronium 3.0.9 → 3.1.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/sandbox.mjs +29 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neutronium",
3
- "version": "3.0.9",
3
+ "version": "3.1.0",
4
4
  "description": "Ultra-dense JavaScript framework – maximum performance, minimal overhead",
5
5
  "main": "src/index.js",
6
6
  "type": "commonjs",
package/sandbox.mjs CHANGED
@@ -1,29 +1,36 @@
1
- import * as Babel from 'https://esm.sh/@babel/standalone@7.28.6/es2022/standalone.mjs';
2
- import { baseHtml } from './compiler/template.js';
1
+ import * as Babel from "https://esm.sh/@babel/standalone@7.28.6/es2022/standalone.mjs";
2
+ import { baseHtml } from "./compiler/template.js";
3
3
 
4
- export async function compileAndReturnOutput(source) {
4
+ export function compileAndReturnOutput(source) {
5
5
  try {
6
- console.log(`⚙️ Babel transforming`);
6
+ console.log("⚙️ Babel transforming");
7
7
 
8
- const result = Babel.transform(source, {
9
- plugins: [
10
- Babel.availablePlugins["transform-react-jsx"], {
11
- pragma: "neutronium.h",
12
- pragmaFrag: "_neutronium.Fragment",
13
- runtime: "classic",
14
- }
15
- ]
16
- })
17
- let code = result.code;
18
- code = `<script>${code}</script>`
19
- console.log('🛠️ Generating index.html...');
20
- const htmlContent = baseHtml(code);
21
-
8
+ const result = Babel.transform(source, {
9
+ plugins: [[
10
+ Babel.availablePlugins["transform-react-jsx"],
11
+ {
12
+ pragma: "_neutronium.h",
13
+ pragmaFrag: "_neutronium.Fragment",
14
+ runtime: "classic",
15
+ }
16
+ ]]
17
+ });
18
+
19
+ const compiledCode = `
20
+ import * as _neutronium from "neutronium";
21
+ ${result.code}
22
+ `;
23
+
24
+ console.log("🛠️ Generating index.html...");
25
+
26
+ return baseHtml(`
27
+ <script type="module">
28
+ ${compiledCode}
29
+ </script>
30
+ `);
22
31
 
23
- console.log('✅ Compilation complete!');
24
- return htmlContent;
25
32
  } catch (e) {
26
- console.error('❌ Compilation failed:', e.message);
27
- return false;
33
+ console.error("❌ Compilation failed:", e);
34
+ return null;
28
35
  }
29
36
  }