vaderjs 2.2.2 → 2.2.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.
Files changed (2) hide show
  1. package/bundler/index.js +16 -13
  2. package/package.json +1 -1
package/bundler/index.js CHANGED
@@ -97,9 +97,9 @@ const handleReplacements = (code) => {
97
97
  }
98
98
  if (hasImport && line.includes('react')) {
99
99
  line = line.replace('react', '/src/vader/index.js')
100
- }
100
+ }
101
101
  if(hasImport && line.includes('public') && line.includes('.png') ||
102
- hasImport && line.includes('.jpg') || hasImport && line.includes('.jpeg') || hasImport && line.includes('.gif') || hasImport && line.includes('.svg')) {
102
+ line.includes('.jpg') || line.includes('.jpeg') || line.includes('.gif') || line.includes('.svg')) {
103
103
  let url = line.split('"')[1]
104
104
  // replace ../../
105
105
  var b4 = url
@@ -182,17 +182,21 @@ hasImport && line.includes('.jpg') || hasImport && line.includes('.jpeg')
182
182
  return c
183
183
  }
184
184
  builtCode = handleReplacements(builtCode)
185
- builtCode = await new Bun.Transpiler({
186
- loader: 'tsx',
187
- tsconfig:{
188
- "compilerOptions": {
189
- "jsx": "react",
190
- "jsxFactory": "e",
191
- "jsxFragmentFactory": "Fragment"
192
- }
185
+
186
+ builtCode += `
187
+ var process = {
188
+ env: {
189
+ ${Object.keys(process.env)
190
+ .filter((key) =>
191
+ !['bindes', 'ENTRYPOINT', 'ROOT', 'OUT', 'file', 'DEV',
192
+ 'size', 'filePath', 'isAppFile', 'isJsx', 'INPUT'].includes(key)
193
+ )
194
+ .map((key) => `${key}: "${process.env[key]}"`)
195
+ .join(',\n')}
193
196
  }
194
- }).transformSync(builtCode)
195
- fs.writeFileSync(path.join(process.cwd(), 'dist', process.env.filePath), builtCode)
197
+ }
198
+ `;
199
+ fs.writeFileSync(path.join(process.cwd(), 'dist', process.env.filePath), builtCode)
196
200
  let isClass = function (element) {
197
201
  return element && element.toString().startsWith("class");
198
202
  };
@@ -264,7 +268,6 @@ const generatePage = async (
264
268
  import {render, e} from '/src/vader/index.js'
265
269
  window.e = e
266
270
  render(c, document.body)
267
- console.log(e)
268
271
  </script>
269
272
 
270
273
  ${process.env.bindes}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vaderjs",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "description": "A simple and powerful JavaScript library for building modern web applications.",
5
5
  "bin": {
6
6
  "vaderjs": "./main.js"