vaderjs 1.4.2-yml56 → 1.4.2
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/binaries/Kalix/index.js +0 -3
- package/binaries/compiler/main.js +1 -1
- package/binaries/vader.js +0 -0
- package/binaries/watcher/hmr.js +0 -4
- package/package.json +3 -2
- package/plugins/ssg/index.js +3 -31
- package/router/index.ts +1 -1
- package/server/index.js +1 -1
- package/{vader_dev.js → vader.js} +3 -3
package/binaries/Kalix/index.js
CHANGED
|
@@ -261,7 +261,7 @@ export async function Compile(){
|
|
|
261
261
|
}
|
|
262
262
|
copy = copy.replace(old, newLine)
|
|
263
263
|
break;
|
|
264
|
-
case !line.includes('import') && line.includes('useState') && !line.includes('let useState')
|
|
264
|
+
case !line.includes('import') && line.includes('useState') && !line.includes('let useState'):
|
|
265
265
|
let varType = line.split('[', 1)[0];
|
|
266
266
|
let before = line.split('useState(')[1].split(',')[0];
|
|
267
267
|
let key = line.split('[')[1].split(',')[0];
|
package/binaries/vader.js
CHANGED
|
File without changes
|
package/binaries/watcher/hmr.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { watch } from 'fs'
|
|
2
|
-
import fs from 'fs'
|
|
3
2
|
globalThis.hasLogged = false
|
|
4
3
|
export function watchDir(cwd, _){
|
|
5
4
|
process.chdir(cwd)
|
|
@@ -13,9 +12,6 @@ export function watchDir(cwd, _){
|
|
|
13
12
|
let paths = ['src', 'pages', 'public', 'routes', 'vader.config.ts']
|
|
14
13
|
for(var i in paths){
|
|
15
14
|
let path = paths[i]
|
|
16
|
-
if(!fs.existsSync(process.cwd() + '/' + path)){
|
|
17
|
-
continue;
|
|
18
|
-
}
|
|
19
15
|
watch(process.cwd() + '/' + path, { recursive: true, absolute:true }, (event, filename) => {
|
|
20
16
|
if(filename && !filename.includes('node_modules') && !globalThis.hasLogged){
|
|
21
17
|
console.log(`\x1b[36mwait \x1b[0m - compiling (client and server)`)
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vaderjs",
|
|
3
3
|
"description": "A reactive framework for building fast and scalable web applications",
|
|
4
|
-
"version": "1.4.2
|
|
4
|
+
"version": "1.4.2",
|
|
5
|
+
"main": "vader.js",
|
|
5
6
|
"author": {
|
|
6
7
|
"name": "Malikwhitten67",
|
|
7
8
|
"email": "malikwhitterb@gmail.com"
|
|
@@ -13,7 +14,7 @@
|
|
|
13
14
|
},
|
|
14
15
|
"type": "module",
|
|
15
16
|
"bin":{
|
|
16
|
-
"vader":"./
|
|
17
|
+
"vader":"./vader.js"
|
|
17
18
|
},
|
|
18
19
|
"dependencies": {
|
|
19
20
|
"ws": "latest"
|
package/plugins/ssg/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as Bun from 'bun'
|
|
2
|
-
import {
|
|
2
|
+
import { Element, 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,10 +15,7 @@ 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
|
|
19
|
-
if(!comp){
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
18
|
+
let comp = require(file).default
|
|
22
19
|
let document = new Document()
|
|
23
20
|
let div = document.createElement('div')
|
|
24
21
|
div.setAttribute('id', 'root')
|
|
@@ -27,7 +24,7 @@ async function generate(){
|
|
|
27
24
|
dom = div.toString("outerHTML")
|
|
28
25
|
let folder = path.split('/pages')[0]
|
|
29
26
|
let newPath = process.cwd() + '/build' + folder + '/index.html'
|
|
30
|
-
let name = comp.name
|
|
27
|
+
let name = comp.name
|
|
31
28
|
file = file.replace(/\\/g, '/').replace('\/\/', '/').replace(process.cwd().replace(/\\/g, '/'), '').split('/pages')[1].replace('.tsx', '.js').replace('.jsx', '.js')
|
|
32
29
|
let isParamRoute = path.includes('[')
|
|
33
30
|
let baseFolder = ''
|
|
@@ -36,11 +33,6 @@ async function generate(){
|
|
|
36
33
|
let providerPath;
|
|
37
34
|
switch(true){
|
|
38
35
|
case provider === 'vercel':
|
|
39
|
-
if(path.includes('[[catchall]]')){
|
|
40
|
-
providerPath = `${baseFolder}/${path.replace('[[catchall]]', '*')}`
|
|
41
|
-
providerRoutes.push({source: providerPath, destination: `${path}/index.html`})
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
36
|
providerPath = `${baseFolder}:${path.split('[')[1].split(']')[0]}`
|
|
45
37
|
providerRoutes.push({source: providerPath, dest: `${path}/index.html`})
|
|
46
38
|
break;
|
|
@@ -48,15 +40,6 @@ async function generate(){
|
|
|
48
40
|
providerPath = `RewriteRule ^${baseFolder.replace('/', '')}.*$ ${path}/index.html [L]`
|
|
49
41
|
providerRoutes.push(providerPath)
|
|
50
42
|
break;
|
|
51
|
-
case provider === 'cloudflare':
|
|
52
|
-
if(path.includes('[[catchall]]')){
|
|
53
|
-
providerPath = `${baseFolder}/${path.replace('[[catchall]]', '*')}`
|
|
54
|
-
providerRoutes.push({source: providerPath, destination: `${path}/index.html`})
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
providerPath = `${baseFolder}/:${path.split('[')[1].split(']')[0]}`
|
|
58
|
-
providerRoutes.push({source: providerPath, destination: `${path}/index.html`})
|
|
59
|
-
break;
|
|
60
43
|
}
|
|
61
44
|
}else{
|
|
62
45
|
let providerPath;
|
|
@@ -72,10 +55,6 @@ async function generate(){
|
|
|
72
55
|
providerPath = `RewriteRule ^${path.replace('/', '')}/$ ${path}/index.html [L]`
|
|
73
56
|
providerRoutes.push(providerPath)
|
|
74
57
|
break;
|
|
75
|
-
case provider === 'cloudflare':
|
|
76
|
-
providerPath = `${path}`
|
|
77
|
-
providerRoutes.push({source: providerPath, destination: `${path === '/' ? '' : '/'}/index.html`})
|
|
78
|
-
break;
|
|
79
58
|
|
|
80
59
|
}
|
|
81
60
|
}
|
|
@@ -122,13 +101,6 @@ Header add x-powered-by "vaderjs"
|
|
|
122
101
|
`
|
|
123
102
|
fs.writeFileSync(process.cwd() + '/.htaccess', full)
|
|
124
103
|
break;
|
|
125
|
-
case provider === 'cloudflare':
|
|
126
|
-
let cloudflare = process.cwd() + '/build/_redirects'
|
|
127
|
-
let data = providerRoutes.map((route) => {
|
|
128
|
-
return `${route.source} ${route.destination}`
|
|
129
|
-
}).join('\n')
|
|
130
|
-
fs.writeFileSync(cloudflare, data)
|
|
131
|
-
break;
|
|
132
104
|
}
|
|
133
105
|
console.log(`\x1b[32mSuccess\x1b[0m - Static files generated`)
|
|
134
106
|
|
package/router/index.ts
CHANGED
|
@@ -171,7 +171,7 @@ export default {
|
|
|
171
171
|
if(!globalThis.isListening){
|
|
172
172
|
let config = require(process.cwd() + '/vader.config.js').default
|
|
173
173
|
if(process.env.mode === 'production'){
|
|
174
|
-
console.log(
|
|
174
|
+
console.log(`Listening at - http://${config.host.hostname}:${config.env.PORT}`)
|
|
175
175
|
spawnServer(config)
|
|
176
176
|
}
|
|
177
177
|
config?.env?.SSR ? spawn_ssr_server(config ) : spawnServer(config)
|
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)
|
|
@@ -21,7 +21,7 @@ function checkIFBundleIsInstalled() {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
return new Promise((resolve, reject) => {
|
|
24
|
-
exec("bun -v", (err, stdout, stderr) => {
|
|
24
|
+
exec("bun -v", (err, stdout, stderr) => {
|
|
25
25
|
if (err) {
|
|
26
26
|
reject(err);
|
|
27
27
|
}
|
|
@@ -36,10 +36,10 @@ function checkIFBundleIsInstalled() {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function run() {
|
|
39
|
-
if(!fs.existsSync(
|
|
39
|
+
if(!fs.existsSync(porcess.cwd() + "/pages")) {
|
|
40
40
|
fs.mkdirSync(process.cwd() + "/pages");
|
|
41
41
|
}
|
|
42
|
-
if(!fs.existsSync(
|
|
42
|
+
if(!fs.existsSync(porcess.cwd() + "/public")) {
|
|
43
43
|
fs.mkdirSync(process.cwd() + "/public");
|
|
44
44
|
}
|
|
45
45
|
if(!fs.existsSync(process.cwd() + "/src")) {
|