vaderjs 1.4.2-kml56 → 1.4.2-vml56

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.
@@ -444,6 +444,9 @@ export class Document {
444
444
  * @returns {HTMLElement}
445
445
  */
446
446
  createElement(nodeData) {
447
+ if(!nodeData){
448
+ return new HTMLElement("div", {}, [])
449
+ }
447
450
  if (typeof nodeData === 'string') {
448
451
  return new HTMLElement(nodeData, {}, [])
449
452
  }
package/binaries/vader.js CHANGED
File without changes
@@ -1,4 +1,5 @@
1
1
  import { watch } from 'fs'
2
+ import fs from 'fs'
2
3
  globalThis.hasLogged = false
3
4
  export function watchDir(cwd, _){
4
5
  process.chdir(cwd)
@@ -12,6 +13,9 @@ export function watchDir(cwd, _){
12
13
  let paths = ['src', 'pages', 'public', 'routes', 'vader.config.ts']
13
14
  for(var i in paths){
14
15
  let path = paths[i]
16
+ if(!fs.existsSync(process.cwd() + '/' + path)){
17
+ continue;
18
+ }
15
19
  watch(process.cwd() + '/' + path, { recursive: true, absolute:true }, (event, filename) => {
16
20
  if(filename && !filename.includes('node_modules') && !globalThis.hasLogged){
17
21
  console.log(`\x1b[36mwait \x1b[0m - compiling (client and server)`)
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "vaderjs",
3
3
  "description": "A reactive framework for building fast and scalable web applications",
4
- "version": "1.4.2-kml56",
5
- "main": "vader.js",
4
+ "version": "1.4.2-vml56",
6
5
  "author": {
7
6
  "name": "Malikwhitten67",
8
7
  "email": "malikwhitterb@gmail.com"
@@ -14,7 +13,7 @@
14
13
  },
15
14
  "type": "module",
16
15
  "bin":{
17
- "vader":"./vader.js"
16
+ "vader":"./vader_dev.js"
18
17
  },
19
18
  "dependencies": {
20
19
  "ws": "latest"
@@ -1,5 +1,5 @@
1
1
  import * as Bun from 'bun'
2
- import { Element, Document, DOMParser} from 'vaderjs/binaries/Kalix/index.js'
2
+ import { Document, DOMParser} from 'vaderjs/binaries/Kalix/index.js'
3
3
  import { renderToString } from '../../server'
4
4
  import fs from 'fs'
5
5
  let routes = new Bun.FileSystemRouter({
@@ -15,7 +15,10 @@ async function generate(){
15
15
  for(var i in routes){
16
16
  let path = i
17
17
  let file = routes[i]
18
- let comp = require(file).default
18
+ let comp = require(file).default
19
+ if(!comp){
20
+ continue;
21
+ }
19
22
  let document = new Document()
20
23
  let div = document.createElement('div')
21
24
  div.setAttribute('id', 'root')
@@ -24,7 +27,7 @@ async function generate(){
24
27
  dom = div.toString("outerHTML")
25
28
  let folder = path.split('/pages')[0]
26
29
  let newPath = process.cwd() + '/build' + folder + '/index.html'
27
- let name = comp.name
30
+ let name = comp.name || 'App'
28
31
  file = file.replace(/\\/g, '/').replace('\/\/', '/').replace(process.cwd().replace(/\\/g, '/'), '').split('/pages')[1].replace('.tsx', '.js').replace('.jsx', '.js')
29
32
  let isParamRoute = path.includes('[')
30
33
  let baseFolder = ''
package/server/index.js CHANGED
@@ -47,7 +47,7 @@ class Component {
47
47
  }
48
48
 
49
49
  }
50
- export async function renderToString(element, args = []) {
50
+ export async function renderToString(element, args = []) {
51
51
  let data = typeof element === 'function' ? await element(args) : element
52
52
  let doc = new Document()
53
53
  let el = doc.createElement(data)
File without changes