vaderjs 1.4.2-vml56 → 1.4.2-yml56
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/compiler/main.js +1 -1
- package/package.json +1 -1
- package/plugins/ssg/index.js +25 -0
- package/router/index.ts +1 -1
|
@@ -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') && !line.includes('var useState') && !line.includes('console'):
|
|
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/package.json
CHANGED
package/plugins/ssg/index.js
CHANGED
|
@@ -36,6 +36,11 @@ async function generate(){
|
|
|
36
36
|
let providerPath;
|
|
37
37
|
switch(true){
|
|
38
38
|
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
|
+
}
|
|
39
44
|
providerPath = `${baseFolder}:${path.split('[')[1].split(']')[0]}`
|
|
40
45
|
providerRoutes.push({source: providerPath, dest: `${path}/index.html`})
|
|
41
46
|
break;
|
|
@@ -43,6 +48,15 @@ async function generate(){
|
|
|
43
48
|
providerPath = `RewriteRule ^${baseFolder.replace('/', '')}.*$ ${path}/index.html [L]`
|
|
44
49
|
providerRoutes.push(providerPath)
|
|
45
50
|
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;
|
|
46
60
|
}
|
|
47
61
|
}else{
|
|
48
62
|
let providerPath;
|
|
@@ -58,6 +72,10 @@ async function generate(){
|
|
|
58
72
|
providerPath = `RewriteRule ^${path.replace('/', '')}/$ ${path}/index.html [L]`
|
|
59
73
|
providerRoutes.push(providerPath)
|
|
60
74
|
break;
|
|
75
|
+
case provider === 'cloudflare':
|
|
76
|
+
providerPath = `${path}`
|
|
77
|
+
providerRoutes.push({source: providerPath, destination: `${path === '/' ? '' : '/'}/index.html`})
|
|
78
|
+
break;
|
|
61
79
|
|
|
62
80
|
}
|
|
63
81
|
}
|
|
@@ -104,6 +122,13 @@ Header add x-powered-by "vaderjs"
|
|
|
104
122
|
`
|
|
105
123
|
fs.writeFileSync(process.cwd() + '/.htaccess', full)
|
|
106
124
|
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;
|
|
107
132
|
}
|
|
108
133
|
console.log(`\x1b[32mSuccess\x1b[0m - Static files generated`)
|
|
109
134
|
|
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(`\x1b[32msuccess \x1b[0m- listening on port ${config.env.PORT || 3000}`)
|
|
175
175
|
spawnServer(config)
|
|
176
176
|
}
|
|
177
177
|
config?.env?.SSR ? spawn_ssr_server(config ) : spawnServer(config)
|