neutronium 3.0.2 → 3.0.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.
- package/compiler/compiler.js +11 -22
- package/package.json +3 -2
package/compiler/compiler.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const babel = require('@babel/core');
|
|
2
|
+
import * as Babel from "@babel/standalone";
|
|
2
3
|
const path = require('path');
|
|
3
4
|
const fs = require('fs');
|
|
4
5
|
const { baseHtml } = require('./template');
|
|
@@ -92,32 +93,20 @@ async function compileProject(projectDir = process.cwd()) {
|
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
|
|
95
|
-
async function compileAndReturnOutput(
|
|
96
|
+
async function compileAndReturnOutput(source) {
|
|
96
97
|
try {
|
|
97
|
-
log('📁 Scanning project files...');
|
|
98
98
|
log(`⚙️ Babel transforming`);
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
{
|
|
107
|
-
pragma: '_neutronium.h',
|
|
108
|
-
pragmaFrag: '_neutronium.Fragment',
|
|
109
|
-
runtime: 'classic',
|
|
100
|
+
const result = Babel.transform(source, {
|
|
101
|
+
plugins: [
|
|
102
|
+
'@babel/plugin-transform-react-jsx', {
|
|
103
|
+
pragma: "neutronium.h",
|
|
104
|
+
pragmaFrag: "_neutronium.Fragment",
|
|
105
|
+
runtime: "classic",
|
|
110
106
|
}
|
|
111
|
-
]
|
|
112
|
-
})
|
|
113
|
-
code =
|
|
114
|
-
// Ensure _neutronium is imported
|
|
115
|
-
if (!code.includes('_neutronium')) {
|
|
116
|
-
code = `import * as _neutronium from 'https://esm.sh/neutronium@3.0.2/es2022/neutronium.mjs`;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Replace imports to "neutronium" with local path
|
|
120
|
-
code = code.replace(/from\s+['"]neutronium['"]/g, `from '${neutroniumPath.replace(/\\/g, '/')}'`);
|
|
107
|
+
]
|
|
108
|
+
})
|
|
109
|
+
let code = result.code;
|
|
121
110
|
|
|
122
111
|
console.log('🛠️ Generating index.html...');
|
|
123
112
|
const htmlContent = baseHtml(code);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neutronium",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "Ultra-dense JavaScript framework – maximum performance, minimal overhead",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -32,9 +32,10 @@
|
|
|
32
32
|
"license": "MIT",
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/core": "^7.28.0",
|
|
35
|
-
"@babel/plugin-transform-react-jsx": "^7.
|
|
35
|
+
"@babel/plugin-transform-react-jsx": "^7.28.6",
|
|
36
36
|
"@babel/preset-env": "^7.28.0",
|
|
37
37
|
"@babel/preset-react": "^7.27.1",
|
|
38
|
+
"@babel/standalone": "^7.28.6",
|
|
38
39
|
"chokidar": "^4.0.3",
|
|
39
40
|
"inquirer": "^12.7.0",
|
|
40
41
|
"mime": "^4.0.7",
|