vaderjs 1.3.7 → 1.4.0-169o234

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.
@@ -0,0 +1,676 @@
1
+ import { Glob } from "bun";
2
+ import fs from "fs";
3
+ import * as Bun from "bun";
4
+ import WebSocket from 'ws'
5
+ let config = await import(process.cwd() + '/vader.config.js').then((m) => m ? m.default : {}).catch((e) => {
6
+ console.error(e)
7
+ return {}
8
+ })
9
+ /**@description - Used to store hmr websocket clients */
10
+ globalThis.clients = []
11
+ /**@description - Used to keep track of routes */
12
+ globalThis.routes = []
13
+ /**
14
+ * @description - Used to keep track of the mode
15
+ */
16
+ globalThis.mode = 'dev'
17
+ /**@usedby @transForm */
18
+ globalThis.isBuilding = false
19
+ globalThis.hasGenerated = []
20
+ /**
21
+ * @description - Used to keep track of the bundle size
22
+ */
23
+ let bundleSize = 0
24
+
25
+
26
+ if(globalThis.mode === 'dev'){
27
+ Bun.spawn({
28
+ cwd: process.cwd() + '/node_modules/vaderjs/binaries/',
29
+ env: {
30
+ PWD: process.cwd(),
31
+ onExit: (code) => {
32
+ globalThis.isBuilding = false
33
+ globalThis.oneAndDone = true
34
+ }
35
+ },
36
+ cmd: ['node', 'generator.js'],
37
+ })
38
+ globalThis.generatorWs = new WebSocket(`ws://localhost:${3436}`)
39
+ globalThis.generatorWs.on('message', (message) => {
40
+ let data = JSON.parse(message.toString())
41
+ switch(true){
42
+ case data.type === 'done':
43
+ let file = data.file
44
+ globalThis.hasGenerated.push(file)
45
+ console.log('Generated', file)
46
+ break;
47
+ case data.type === 'error':
48
+ console.error(data.message)
49
+ break;
50
+ }
51
+ })
52
+ globalThis.generatorWs.on('connection', (ws) => {
53
+ console.log('Connected to generator...')
54
+ })
55
+
56
+ if(!globalThis.generatorWs.readyState === 1){
57
+ console.log('Generator is not ready...')
58
+ }
59
+ }
60
+
61
+ /**
62
+ * @description - variables used to generate arrays of paths recursively
63
+ */
64
+ const glob = new Glob("/pages/**/**/*.{,tsx,js,jsx}", {absolute: true});
65
+ const vaderGlob = new Glob("/node_modules/vaderjs/runtime/**/**/*.{,tsx,js}", {absolute: true});
66
+ const srcGlob = new Glob("/src/**/**/*.{jsx,ts,tsx,js}", {absolute: true});
67
+ const publicGlob = new Glob("/public/**/**/*.{css,js,html,jpg,png,gif,svg,ico,video,webm,mp4,jpeg}", {absolute: true});
68
+ const distPages = new Glob("/dist/pages/**/**/*.{tsx,js,jsx}", {absolute: true})
69
+ const distSrc = new Glob("/dist/src/**/**/*.{tsx,js,jsx}", {absolute: true})
70
+ const distPublic = new Glob("/dist/public/**/**/*.{css,js,html,jpg,png,gif,svg,ico,video,webm,mp4,jpeg}", {absolute: true});
71
+
72
+ const router = new Bun.FileSystemRouter({
73
+ style: "nextjs",
74
+ dir: process.cwd() + '/pages',
75
+ origin: process.env.ORIGIN || "http://localhost:3000",
76
+ assetPrefix: "_next/static/"
77
+ });
78
+ /**
79
+ * @function handleReplaceMents
80
+ * @description - replaces data to be compatible with Vader.js
81
+ * @param {*} data
82
+ * @returns
83
+ */
84
+ function handleReplaceMents(data){
85
+ data.split('\n').forEach((line, index)=>{
86
+ switch(true){
87
+
88
+ case line.includes('useReducer') && !line.includes('import'):
89
+ line = line.replaceAll(/\s+/g, " ");
90
+
91
+ let varTypereducer = line.split("=")[0].trim().split("[")[0].trim();
92
+ let keyreducer = line.split("=")[0].trim().split("[")[1].trim().split(",")[0].trim();
93
+ let setKeyreducer = line.split("=")[0].trim().split(",")[1].trim().replace("]", "");
94
+ let reducer = line.split("=")[1].split("useReducer(")[1];
95
+
96
+ let newStatereducer = `${varTypereducer} [${keyreducer}, ${setKeyreducer}] = this.useReducer('${keyreducer}', ${line.includes('=>') ? reducer + '=>{' : reducer}`;
97
+
98
+ data = data.replace(line, newStatereducer);
99
+ break
100
+
101
+ case line.includes('useState') && !line.includes('import'):
102
+ let varType = line.split("[")[0]
103
+ if (!line.split("=")[0].split(",")[1]) {
104
+ throw new Error('You forgot to value selector (useState) ' + ' at ' + `${file}:${string.split(line)[0].split('\n').length}`)
105
+ }
106
+ let key = line.split("=")[0].split(",")[0].trim().split('[')[1];
107
+
108
+ if (!line.split("=")[0].split(",")[1]) {
109
+ throw new Error('You forgot to add a setter (useState) ' + ' at ' + `${file}:${string.split(line)[0].split('\n').length}`)
110
+ }
111
+ let setKey = line.split("=")[0].split(",")[1].trim().replace("]", "");
112
+ key = key.replace("[", "").replace(",", "");
113
+ let valuestate = line.split("=")[1].split("useState(")[1];
114
+
115
+ let regex = /useState\((.*)\)/gs;
116
+ valuestate = valuestate.match(regex) ? valuestate.match(regex)[0].split("useState(")[1].split(")")[0].trim() : valuestate
117
+ let newState = `${varType} [${key}, ${setKey}] = this.useState('${key}', ${valuestate}`;
118
+ data = data.replace(line, newState);
119
+ break;
120
+
121
+ case line.includes("useRef") && !line.includes("import"):
122
+ line = line.trim();
123
+ let typeref = line.split(" ")[0]
124
+
125
+ let keyref = line.split(typeref)[1].split("=")[0].trim().replace("[", "").replace(",", "");
126
+
127
+
128
+ let valueref = line.split("=")[1].split("useRef(")[1];
129
+
130
+ let newStateref = `${typeref} ${keyref} = this.useRef('${keyref}', ${valueref}`;
131
+ data = data.replace(line, newStateref);
132
+ case line.includes('.jsx') && line.includes('import') || line.includes('.tsx') && line.includes('import'):
133
+ let old = line
134
+ line = line.replace('.jsx', '.js')
135
+ line = line.replace('.tsx', '.js')
136
+ data = data.replace(old, line)
137
+
138
+ break;
139
+ }
140
+ })
141
+
142
+ data = data.replaceAll('jsxDEV', 'Vader.createElement')
143
+ data = data.replaceAll('jsx', 'Vader.createElement')
144
+ data = data.replaceAll('vaderjs/client', '/vader.js')
145
+ data = data.replaceAll('.tsx', '.js')
146
+ let reactImportMatch = data.match(/import React/g);
147
+ if(reactImportMatch){
148
+ let fullmatch = data.match(/import React from "react"/g);
149
+ if(fullmatch){
150
+ data = data.replaceAll('import React from "react"', '');
151
+ }
152
+ }
153
+ data = data.replaceAll('.ts', '.js')
154
+
155
+ // check if Vader is imported
156
+ let vaderImport = data.match(/import Vader/g);
157
+ if(!vaderImport){
158
+ data = `import Vader from "/vader.js";\n` + data;
159
+ }
160
+ return data;
161
+ }
162
+
163
+
164
+ /**
165
+ * @function ContentType
166
+ * @description - returns the content type based on the file extension
167
+ * @param {*} url
168
+ * @returns
169
+ */
170
+ const ContentType = (url)=>{
171
+ switch(url.split('.').pop()){
172
+ case 'css':
173
+ return 'text/css';
174
+ case 'js':
175
+ return 'text/javascript';
176
+ case 'json':
177
+ return 'application/json';
178
+ case 'html':
179
+ return 'text/html';
180
+ case 'jpg':
181
+ return 'image/jpg';
182
+ case 'png':
183
+ return 'image/png';
184
+ case 'gif':
185
+ return 'image/gif';
186
+ case 'svg':
187
+ return 'image/svg+xml';
188
+ case 'ico':
189
+ return 'image/x-icon';
190
+ default:
191
+ return 'text/html';
192
+
193
+ }
194
+ }
195
+
196
+
197
+ /**
198
+ * @function Server
199
+ * @description - Creates a hmr development server
200
+ * @param {Number} port
201
+ */
202
+ function Server(port){
203
+ Bun.serve({
204
+ port: port,
205
+ fetch(req, res){
206
+ const url = new URL(req.url);
207
+ const success = res.upgrade(req);
208
+ if(success){
209
+ return new Response('Connected', {
210
+ headers: {
211
+ "Content-Type": "text/html"
212
+ }
213
+ })
214
+ }
215
+ if(req.url.includes('.')){
216
+ return new Response(fs.readFileSync(process.cwd() + '/dist/' + url.pathname, 'utf8'), {
217
+ headers: {
218
+ "Content-Type": ContentType(req.url)
219
+ }
220
+ })
221
+ }
222
+ let matchedRoute = router.match(url.pathname);
223
+ if(matchedRoute){
224
+ let {filePath, kind, name, params, pathname, query,} = matchedRoute
225
+ let folder = url.pathname.split('/')[1]
226
+ let jsFile = filePath.split('pages/').pop().split('.').shift() + '.js'
227
+ let pageContent = fs.readFileSync(process.cwd() + '/dist/pages/' + folder + '/index.html', 'utf8')
228
+ globalThis.mode === 'dev' ? pageContent += `
229
+ <script type="module">
230
+ let ws = new WebSocket('ws://localhost:${port}');
231
+ ws.onmessage = async (e) => {
232
+ if(e.data === 'reload'){
233
+ window.location.reload()
234
+ console.log('Reloading...')
235
+ }
236
+ }
237
+ </script>
238
+ ` : void 0
239
+ return new Response( pageContent, {
240
+ headers: {
241
+ "Content-Type": "text/html",
242
+ "X-Powered-By": "Vader.js v1.3.3"
243
+ }
244
+ })
245
+ }
246
+
247
+ return new Response('Not Found', {
248
+ status: 404,
249
+ headers: {
250
+ "Content-Type": "text/html"
251
+ }
252
+ })
253
+ },
254
+ websocket: {
255
+ open(ws){
256
+ clients.push(ws)
257
+ },
258
+ }
259
+ })
260
+ }
261
+ /**
262
+ * @function write
263
+ * @description - Writes data to a file
264
+ * @returns {void} 0
265
+ * @param {string} file
266
+ * @param {any} data
267
+ * @returns
268
+ */
269
+ const write = (file, data) => {
270
+ try {
271
+ if(!fs.existsSync('./dist')){
272
+ fs.mkdirSync('./dist')
273
+ }
274
+ Bun.write(file, data);
275
+ } catch (error) {
276
+ console.error(error)
277
+ }
278
+
279
+ }
280
+ /**
281
+ * @function read
282
+ * @param {path} file
283
+ * @returns {Promise<string>}
284
+ */
285
+ const read = async (file) => {
286
+ return await Bun.file(file).text();
287
+ }
288
+
289
+ /**
290
+ * @function generateProviderRoutes
291
+ * @description - Generates routes for hosting provders ie: vercel, cloudflare
292
+ * @returns {void} 0
293
+ */
294
+ async function generateProviderRoutes(){
295
+ if(!config?.host?.provider){
296
+ console.warn('No provider found in vader.config.js ignoring route generation...')
297
+ return void 0;
298
+ }
299
+ let providerType = [{
300
+ provider: 'vercel',
301
+ file: 'vercel.json',
302
+ out: process.cwd() + '/vercel.json',
303
+ obj: {
304
+ rewrites:[]
305
+ }
306
+ },{
307
+ provider: 'cloudflare',
308
+ file:'_redirects',
309
+ out: 'dist/_redirects'
310
+ }]
311
+
312
+ let provider = providerType.find((p) => p.provider === config.host.provider)
313
+ if(provider){
314
+ let prev = null
315
+
316
+ switch(provider.provider){
317
+ case 'vercel':
318
+ prev = await read(provider.out);
319
+ if(!prev.includes('rewrites')){
320
+ prev = []
321
+ } else{
322
+ prev = JSON.parse(prev).rewrites
323
+ }
324
+ routes.forEach((r) => {
325
+ if(r.path === '/'
326
+ || prev.find((p) => p.source === '/'+ r.path + '/index.html')
327
+ ){
328
+ return void 0;
329
+ }
330
+ prev.push({
331
+ source: '/'+ r.path,
332
+ destination: '/'+ r.path + '/index.html'
333
+ })
334
+
335
+ if(r.params.length > 0){
336
+ r.params.forEach((param)=>{
337
+ if(!param.paramData){
338
+ return void 0;
339
+ }
340
+ let parampath= Object.keys(param.paramData).map((p)=>`:${p}`).join('/')
341
+ prev.push({
342
+ source: '/'+ r.path + '/' + parampath ,
343
+ destination: '/'+ r.path + '/index.html'
344
+ })
345
+ })
346
+ }
347
+
348
+ fs.writeFileSync(provider.out, JSON.stringify({rewrites: prev}, null, 2))
349
+
350
+
351
+ })
352
+ provider.obj.rewrites = prev
353
+ write(provider.out, JSON.stringify(provider.obj, null, 2))
354
+ break;
355
+ case 'cloudflare':
356
+ console.warn('Cloudflare is not supported yet refer to their documentation for more information:https://developers.cloudflare.com/pages/configuration/redirects/')
357
+ break;
358
+ }
359
+
360
+
361
+
362
+
363
+ }
364
+ return void 0;
365
+ }
366
+
367
+ /**
368
+ * @function transform
369
+ * @description - Transforms the jsx files to js files based on file paths
370
+ */
371
+
372
+ async function transForm(){
373
+ globalThis.isBuilding = true
374
+ router.reload()
375
+ for await (var file of glob.scan('.')) {
376
+ file = file.replace(/\\/g, '/');
377
+ let isBasePath = file.split('pages/')?.[1]?.split('/').length === 1;
378
+ let folder = file.split('pages/')?.[1]?.split('/').slice(0, -1).join('/') || null;
379
+ let route = isBasePath ? router.match('/') : router.match('/' + folder)
380
+ if(route){
381
+ let {filePath, kind, name, params, pathname, query,} = route
382
+ let data = await read(filePath);
383
+ try{
384
+ data = new Bun.Transpiler({loader: "tsx", target:"browser", }).transformSync(data);
385
+ }catch(e){
386
+ console.error(e)
387
+ }
388
+ let out = `./dist/pages/${isBasePath ? 'index.js' : folder + '/index.js'}`;
389
+ isBasePath ? folder = '/': null;
390
+ data = handleReplaceMents(data);
391
+ globalThis.routes.push({path: folder, file: out, isParam: kind === 'dynamic' ? true : false, params, query, pathname})
392
+ write(out, data);
393
+ bundleSize += data.length
394
+
395
+
396
+ }
397
+
398
+ }
399
+
400
+ for await (var file of srcGlob.scan('.')) {
401
+ if(!fs.existsSync(process.cwd() +'/dist/src/')){
402
+ fs.mkdirSync(process.cwd() +'/dist/src/')
403
+ }
404
+ file = file.replace(/\\/g, '/');
405
+ switch(file.split('.').pop()){
406
+ case 'ts':
407
+ let transpiler = new Bun.Transpiler({loader: "ts", target:"browser", });
408
+ let data = await read(file);
409
+ try {
410
+ data = transpiler.transformSync(data);
411
+ } catch (error) {
412
+ console.error(error)
413
+ }
414
+ file = file.replace('.ts', '.js')
415
+ let path = process.cwd() +'/dist/src/' + file.split('src/').pop()
416
+ write(path, data);
417
+ bundleSize += data.length
418
+
419
+ break;
420
+
421
+ case 'tsx':
422
+ let transpilerx = new Bun.Transpiler({loader: "tsx", target:"browser", });
423
+ let datax = await read(file);
424
+ try {
425
+ datax = transpilerx.transformSync(datax);
426
+ } catch (error) {
427
+ console.error(error)
428
+ }
429
+ datax = handleReplaceMents(datax);
430
+ file = file.replace('.tsx', '.js')
431
+ let pathx = process.cwd() +'/dist/src/' + file.split('src/').pop()
432
+ write(pathx, datax);
433
+
434
+
435
+ break;
436
+ case 'jsx':
437
+ let transpilerjx = new Bun.Transpiler({loader: "jsx", target:"browser", });
438
+ let datajx = await read(file);
439
+ try {
440
+ datajx = transpilerjx.transformSync(datajx);
441
+ } catch (error) {
442
+ console.error(error)
443
+ }
444
+ datajx = handleReplaceMents(datajx);
445
+ file = file.replace('.jsx', '.js')
446
+ let pathjx = process.cwd() +'/dist/src/' + file.split('src/').pop()
447
+ write(pathjx, datajx);
448
+ bundleSize += datajx.length
449
+ break;
450
+ }
451
+ }
452
+
453
+
454
+ for await (var file of publicGlob.scan('.')) {
455
+ let data = await read(file);
456
+ file = file.replace(/\\/g, '/');
457
+ write(process.cwd() +'/dist/public/' + file.split('public/').pop(), data);
458
+ bundleSize += fs.statSync(process.cwd() +'/dist/public/' + file.split('public/').pop()).size
459
+ }
460
+ for await (var file of vaderGlob.scan('.')) {
461
+ let data = await read(file);
462
+ file = file.replace(/\\/g, '/');
463
+ write(process.cwd() +'/dist/' + file.split('node_modules/vaderjs/runtime/').pop(), data);
464
+ bundleSize += fs.statSync(process.cwd() +'/dist/' + file.split('node_modules/vaderjs/runtime/').pop()).size
465
+ }
466
+
467
+ // clean dist folder
468
+ for await( var file of distPages.scan('.')){
469
+ file = file.replace(/\\/g, '/');
470
+ let path = process.cwd() +'/pages/' + file.split('dist/pages/').pop()
471
+ path = path.replace('.js', config?.files?.mimeType || '.jsx')
472
+
473
+ if(!fs.existsSync(path)){
474
+ fs.unlinkSync(file)
475
+ }
476
+
477
+ }
478
+
479
+ for await( var file of distSrc.scan('.')){
480
+ file = file.replace(/\\/g, '/');
481
+ let path = process.cwd() +'/src/' + file.split('dist/src/').pop()
482
+ // if the file is a js file see if theirs a matching ts file
483
+ if(file.split('.').pop() === 'js'){
484
+ let tsFile = path.replace('.js', '.ts')
485
+ // if the ts file exists then the js file is valid else if not the js file exists then remove
486
+ switch(true){
487
+ case !fs.existsSync(tsFile):
488
+ // check if a tsx or jsx file exists
489
+ let tsxFile = path.replace('.js', '.tsx')
490
+ let jsxFile = path.replace('.js', '.jsx')
491
+ let tsfile = path.replace('.js', '.ts')
492
+ switch(true){
493
+ case fs.existsSync(tsxFile):
494
+ break;
495
+ case fs.existsSync(jsxFile):
496
+ break;
497
+ case fs.existsSync(tsfile):
498
+ break
499
+ default:
500
+ fs.unlinkSync(file)
501
+ break;
502
+ }
503
+ break;
504
+ case fs.existsSync(tsFile):
505
+
506
+ break;
507
+ }
508
+ }
509
+ }
510
+
511
+ for await( var file of distPublic.scan('.')){
512
+ file = file.replace(/\\/g, '/');
513
+ let path = process.cwd() +'/public/' + file.split('dist/public/').pop()
514
+ if(!fs.existsSync(path)){
515
+ fs.unlinkSync(file)
516
+ }
517
+ }
518
+
519
+
520
+
521
+ /**
522
+ * @function organizeRoutes
523
+ * @description - Organizes routes that have param paths
524
+ */
525
+
526
+ const organizeRoutes = () => {
527
+ // if path starts with the same path and is dynamic then they are the same route and push params to the same route
528
+ let newRoutes = []
529
+ routes.forEach((route) => {
530
+ let exists = routes.find((r) => r.path.startsWith(route.path) && r.isParam === true)
531
+ if(exists){
532
+ let b4Params = route.params
533
+ route.params = []
534
+ route.params.push(b4Params)
535
+ route.params.push( {
536
+ jsFile: '/pages/' + exists.path + '/index.js',
537
+ folder: '/pages/' + exists.path,
538
+ paramData:exists.params
539
+ }
540
+ )
541
+ route.query = exists.query
542
+ newRoutes.push(route)
543
+ }
544
+ else if(!exists && !route.isParam){
545
+ newRoutes.push(route)
546
+
547
+ }
548
+ //remove param route that matched
549
+ routes = routes.filter((r) => exists ? r.path !== exists.path : true)
550
+
551
+ })
552
+ globalThis.routes = newRoutes
553
+ }
554
+ organizeRoutes()
555
+
556
+
557
+ if(globalThis.mode === 'dev' && !globalThis.oneAndDone || globalThis.mode === 'build'){
558
+
559
+ /**
560
+ * @description - create an html file for each route
561
+ */
562
+ routes.forEach((r)=>{
563
+
564
+
565
+ globalThis.generatorWs.send(JSON.stringify({
566
+ type:'generate',
567
+ PWD: process.cwd(),
568
+ output: process.cwd() + '/dist/pages/' + r.path + '/index.html',
569
+ file: '/pages/' + r.path + '/index.js',
570
+ folder:'/pages/' + r.path,
571
+ params: JSON.stringify(r.params),
572
+ }))
573
+
574
+ })
575
+ let i = setInterval(() => {
576
+ if(hasGenerated.length === routes.length){
577
+ globalThis.generatorWs.send(JSON.stringify({
578
+ type:'done'
579
+ }))
580
+ globalThis.oneAndDone = true
581
+ clearInterval(i)
582
+ }
583
+ }, 1000)
584
+ }
585
+ generateProviderRoutes( )
586
+ globalThis.isBuilding = false
587
+ console.log(`Finished building ${Math.round(bundleSize / 1000)}kb`)
588
+ bundleSize = 0
589
+ return void 0;
590
+
591
+ }
592
+ let port = 3000
593
+ switch (true) {
594
+ case process.argv.includes('dev') && !process.argv.includes('build') && !process.argv.includes('start'):
595
+
596
+ port = process.env.PORT || process.argv.includes('-p') ? process.argv[process.argv.indexOf('-p') + 1] : 3000
597
+ globalThis.oneAndDone = false
598
+ console.log(`
599
+ Vader.js v${fs.readFileSync(process.cwd() + '/node_modules/vaderjs/package.json', 'utf8').split('"version": "')[1].split('"')[0]}
600
+ - Watching for changes in ./pages
601
+ - Watching for changes in ./src
602
+ - Watching for changes in ./public
603
+ - Serving on port ${port}
604
+ `)
605
+ globalThis.mode = 'dev'
606
+ Server(port)
607
+ transForm()
608
+
609
+ Bun.spawn({
610
+ cwd: process.cwd() + '/node_modules/vaderjs/binaries/',
611
+ env: {
612
+ PWD: process.cwd(),
613
+ FOLDERS: 'pages,src,public',
614
+ onExit: (code) => {
615
+ globalThis.isBuilding = false
616
+ globalThis.oneAndDone = true
617
+ }
618
+ },
619
+ cmd: ['node', 'watcher.js'],
620
+ })
621
+
622
+ const ws = new WebSocket(`ws://localhost:${3434}`)
623
+ ws.on('open', () => {
624
+ console.log('Watching for changes...')
625
+ })
626
+ ws.on('message', (message) => {
627
+ message = JSON.parse(message.toString())
628
+ switch(true){
629
+ case message.type === 'change' && !globalThis.isBuilding:
630
+ console.log('Rebuilding...')
631
+ globalThis.clients.forEach((client) => {
632
+ client.send('reload')
633
+ })
634
+ transForm()
635
+ break;
636
+ case message.type === 'add' && !globalThis.isBuilding:
637
+ console.log('Rebuilding...')
638
+ globalThis.clients.forEach((client) => {
639
+ client.send('reload')
640
+ })
641
+ transForm()
642
+ break;
643
+ }
644
+
645
+ })
646
+
647
+ break;
648
+ case process.argv.includes('build') && !process.argv.includes('dev') && !process.argv.includes('start'):
649
+ globalThis.devMode = false
650
+ globalThis.isProduction = true
651
+ globalThis.routeStates = []
652
+ console.log(`
653
+ Vader.js v1.3.3
654
+ Building to ./dist
655
+ `)
656
+
657
+ globalThis.mode = 'build'
658
+ transForm()
659
+ break;
660
+ case process.argv.includes('start') && !process.argv.includes('dev') && !process.argv.includes('build'):
661
+ port = process.env.PORT || process.argv.includes('-p') ? process.argv[process.argv.indexOf('-p') + 1] : 3000
662
+ console.log(`
663
+ Vader.js v1.3.3
664
+ Serving ./dist on port ${port}
665
+ url: http://localhost:${port}
666
+ `)
667
+ globalThis.devMode = false
668
+ globalThis.isProduction = true
669
+
670
+ Server(port)
671
+ break;
672
+ default:
673
+
674
+ break;
675
+
676
+ }
@@ -0,0 +1,4 @@
1
+ #Binaries
2
+
3
+ Folder contains polyfills for missing functionality within windows
4
+ Folder contains ssg code for generating html pages for each route on the fly