vaderjs 1.3.3-7725242-hotfix → 1.3.3-773562-hotfix

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/package.json +1 -1
  2. package/vader.js +208 -182
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "vaderjs",
3
3
  "description": "A Reactive library aimed to helping you build reactive applications inspired by react.js",
4
4
  "module": "vader.js",
5
- "version": "1.3.3-7725242-hotfix",
5
+ "version": "1.3.3-773562-hotfix",
6
6
  "bin": {
7
7
  "vader": "./vader.js"
8
8
  },
package/vader.js CHANGED
@@ -239,34 +239,34 @@ function Compiler(func, file) {
239
239
  continue;
240
240
  }
241
241
  let old = spread;
242
- spread = spread.trim().replace(/\s+/g, " ");
242
+ spread = spread.trim().replace(/\s+/g, " ");
243
243
  // re,pve $={ and }
244
244
  spread = spread.replace(/\s*\$\s*=\s*{\s*{/gs, '')
245
-
245
+
246
246
  // replace trailing }
247
- spread = spread.replace(/}}\s*$/, '').replace(/}\s*}$/, '')
248
- let splitByCommas = spread.split(/,(?![^{}]*})/gs)
247
+ spread = spread.replace(/}}\s*$/, '').replace(/}\s*}$/, '')
248
+ let splitByCommas = spread.split(/,(?![^{}]*})/gs)
249
249
  // remove empty strings
250
250
  splitByCommas = splitByCommas.filter((e) => e.split(':')[0].trim().length > 0)
251
- splitByCommas = splitByCommas.map((e, index) => {
251
+ splitByCommas = splitByCommas.map((e, index) => {
252
252
  let key = e.split(':')[0].trim()
253
253
  switch (true) {
254
254
  case e.includes('function') && !e.includes('this.bind') || e && e.includes('=>') && !e.includes('this.bind'):
255
255
  let value = e.split(':')[1].trim()
256
- let ref = Math.random().toString(36).substring(2).split('').filter((e) => !Number(e)).join('');
256
+ let ref = Math.random().toString(36).substring(2).split('').filter((e) => !Number(e)).join('');
257
257
  value = `this.bind(${value}, false, "${ref}", "")`
258
258
  e = `${key}="\${${value}}"`
259
259
  break;
260
- case e.includes('style:'):
261
- let v2 = e.split('style:')[1].trim().replace(/,$/, '')
262
- v2 = v2.replace(/,$/, '')
260
+ case e.includes('style:'):
261
+ let v2 = e.split('style:')[1].trim().replace(/,$/, '')
262
+ v2 = v2.replace(/,$/, '')
263
263
  e = `${key}="\${this.parseStyle(${v2})}"`
264
- break;
265
-
266
- default:
267
- let v = e.split(':')
264
+ break;
265
+
266
+ default:
267
+ let v = e.split(':')
268
268
  key = v[0].trim()
269
- // remove key from v
269
+ // remove key from v
270
270
  v.shift()
271
271
  v = v.join(' ')
272
272
  e = `${key}="\${${v}}"`
@@ -277,7 +277,7 @@ function Compiler(func, file) {
277
277
 
278
278
  return e;
279
279
  });
280
-
280
+
281
281
 
282
282
  let newSpread = splitByCommas.join(' ').trim().replace(/,$/, '');
283
283
 
@@ -348,7 +348,7 @@ function Compiler(func, file) {
348
348
  newAttributes.push(attribute);
349
349
  for (let key in attributes) {
350
350
 
351
- let value = attributes[key];
351
+ let value = attributes[key];
352
352
  let oldvalue = value;
353
353
  if (value && !value.new) {
354
354
 
@@ -479,7 +479,7 @@ function Compiler(func, file) {
479
479
 
480
480
  let name = component.split("<")[1].split(">")[0].split(" ")[0].replace("/", "");
481
481
  let componentAttributes = component.split("<")[1].split(">")[0].split(" ").join(" ").replace(name, "").trim();
482
- const dynamicAttributesRegex = /(\w+)(?:="([^"]*?)"|='([^']*?)'|(?:=\{([^}]*?)\})?|(?:=\{(.*?)*\})?|(?:={([^}]*?)})?|(?:{([^}]*?)})?|(?:}))?|={\s*.*?\s*}/gs;
482
+ const dynamicAttributesRegex = /(\w+)(?:="([^"]*?)"|='([^']*?)'|(?:=\{([^}]*?)\})?|(?:=\{(.*?)*\})?|(?:={([^}]*?)})?|(?:{([^}]*?)})?|(?:}))?|\$=\s*\{\s*\{\s*([^]*?)\s*\}\s*\}/gs;
483
483
 
484
484
 
485
485
 
@@ -499,8 +499,18 @@ function Compiler(func, file) {
499
499
  isWithinComponent = true;
500
500
  filteredProps.push(prop);
501
501
  } else if (isWithinComponent && prop.includes('=')) {
502
-
503
- if (prop.includes('${')) {
502
+
503
+ if (prop.startsWith('$=')) {
504
+ let old = prop
505
+ let match = prop.replace(/\$\s*=\s*\{\s*\{\s*([^]*?)\s*\}\s*\}/gs, '$1')
506
+ match = match.replace('$:', '$_ternary:')
507
+ component = component.replace(old, '')
508
+ componentAttributes = componentAttributes.replace(old, match)
509
+
510
+ $_ternaryprops.push(prop)
511
+
512
+ }
513
+ else if (prop.includes('${')) {
504
514
 
505
515
 
506
516
  prop = prop.replace('="', ':')
@@ -519,16 +529,14 @@ function Compiler(func, file) {
519
529
  if (prop.includes('={')) {
520
530
  let value = prop.split('={')
521
531
  let isObj = value[1].match(/^{.*}$/gs) ? true : false
522
- if (!isObj) {
532
+ if (!isObj) {
533
+ // remove trailing }
523
534
  value[1] = value[1].replace(/}\s*$/, '')
524
- }else if(!value[0].length > 0 && isObj){
525
- value[0] = '$'
526
535
  }
527
-
528
536
 
529
537
  if (value[0] == 'style' && isObj) {
530
538
  value[1] = `this.parseStyle(${value[1]})`
531
- }
539
+ }
532
540
  prop = `${value[0]}:${value[1]}`
533
541
  }
534
542
 
@@ -627,52 +635,54 @@ function Compiler(func, file) {
627
635
 
628
636
  string = string.replaceAll('vaderjs/client', '/vader.js')
629
637
 
630
- const importRegex = /import\s*([^\s,]+|\{[^}]+\})\s*from\s*(['"])(.*?)\2/g;
638
+ const importRegex = /import\s*([^\s,]+|\{[^}]+\})\s*from\s*(['"])(.*?)\2/gs;
631
639
  const imports = string.match(importRegex);
632
640
  let replaceMents = [];
633
641
 
634
642
 
635
- for (let match of imports) {
636
- let path = match.split('from')[1].trim().replace(/'/g, '').replace(/"/g, '').trim()
637
- switch (true) {
638
- case path && !path.includes('./') && !path.includes('/vader.js') && !path.includes('/vaderjs/client') && !path.startsWith('src') && !path.startsWith('public') && !path.includes('http') && !path.includes('https'):
639
- let componentFolder = fs.existsSync(process.cwd() + '/node_modules/' + path) ? process.cwd() + '/node_modules/' + path : process.cwd() + '/node_modules/' + path.split('/')[0]
640
- componentFolder = componentFolder.split(process.cwd())[1]
641
- if (!fs.existsSync(process.cwd() + componentFolder)) {
642
- throw new Error('Could not find ' + path + ' at ' + match + ' in file ' + file)
643
- }
643
+ if (imports) {
644
+ for (let match of imports) {
645
+ let path = match.split('from')[1].trim().replace(/'/g, '').replace(/"/g, '').trim()
646
+ switch (true) {
647
+ case path && !path.includes('./') && !path.includes('/vader.js') && !path.includes('/vaderjs/client') && !path.startsWith('src') && !path.startsWith('public') && !path.includes('http') && !path.includes('https'):
648
+ let componentFolder = fs.existsSync(process.cwd() + '/node_modules/' + path) ? process.cwd() + '/node_modules/' + path : process.cwd() + '/node_modules/' + path.split('/')[0]
649
+ componentFolder = componentFolder.split(process.cwd())[1]
650
+ if (!fs.existsSync(process.cwd() + componentFolder)) {
651
+ throw new Error('Could not find ' + path + ' at ' + match + ' in file ' + file)
652
+ }
644
653
 
645
- if (!fs.existsSync(process.cwd() + '/dist/src/' + componentFolder.split('/').slice(2).join('/'))) {
646
- fs.mkdirSync(process.cwd() + '/dist/src/' + componentFolder.split('/').slice(2).join('/'), { recursive: true })
647
- }
654
+ if (!fs.existsSync(process.cwd() + '/dist/src/' + componentFolder.split('/').slice(2).join('/'))) {
655
+ fs.mkdirSync(process.cwd() + '/dist/src/' + componentFolder.split('/').slice(2).join('/'), { recursive: true })
656
+ }
648
657
 
649
- let baseFolder = componentFolder.split('node_modules')[1].split('/')[1]
650
- let glp = globSync('**/**/**/**.{jsx,js}', {
651
- cwd: process.cwd() + '/node_modules/' + baseFolder + '/',
652
- absolute: true,
653
- recursive: true
654
- })
655
- for (let file of glp) {
656
- let text = fs.readFileSync(file, "utf8");
657
- if (!file.endsWith('.js') && file.endsWith('.jsx')) {
658
- text = Compiler(text, file);
658
+ let baseFolder = componentFolder.split('node_modules')[1].split('/')[1]
659
+ let glp = globSync('**/**/**/**.{jsx,js}', {
660
+ cwd: process.cwd() + '/node_modules/' + baseFolder + '/',
661
+ absolute: true,
662
+ recursive: true
663
+ })
664
+ for (let file of glp) {
665
+ let text = fs.readFileSync(file, "utf8");
666
+ if (!file.endsWith('.js') && file.endsWith('.jsx')) {
667
+ text = Compiler(text, file);
659
668
 
669
+ }
670
+ let dest = file.split('node_modules')[1]
671
+ dest = dest.split(baseFolder)[1]
672
+ writer(process.cwd() + '/dist/src/' + baseFolder + dest, text)
673
+ let importname = match.split('import')[1].split('from')[0].trim()
674
+ let oldImportstring = match.split('from')[1].trim().replace(/'/g, '').replace(/"/g, '').trim()
675
+ let newImport = `/src/${baseFolder + dest}`
676
+ newImport = newImport.replaceAll('.jsx', '.js').replaceAll('\\', '/')
677
+ replaceMents.push({ match: oldImportstring, replace: newImport })
678
+ console.log(`📦 imported Node Package ${baseFolder} `)
660
679
  }
661
- let dest = file.split('node_modules')[1]
662
- dest = dest.split(baseFolder)[1]
663
- writer(process.cwd() + '/dist/src/' + baseFolder + dest, text)
664
- let importname = match.split('import')[1].split('from')[0].trim()
665
- let oldImportstring = match.split('from')[1].trim().replace(/'/g, '').replace(/"/g, '').trim()
666
- let newImport = `/src/${baseFolder + dest}`
667
- newImport = newImport.replaceAll('.jsx', '.js').replaceAll('\\', '/')
668
- replaceMents.push({ match: oldImportstring, replace: newImport })
669
- console.log(`📦 imported Node Package ${baseFolder} `)
670
- }
671
680
 
672
681
 
673
- break;
674
- default:
675
- break;
682
+ break;
683
+ default:
684
+ break;
685
+ }
676
686
  }
677
687
  }
678
688
 
@@ -865,6 +875,7 @@ const glb = await glob("**/**/**/**.{jsx,js}", {
865
875
  absolute: true,
866
876
  recursive: true
867
877
  });
878
+ let hasRendered = []
868
879
  async function Build() {
869
880
  globalThis.isBuilding = true
870
881
  console.log(globalThis.isProduction ? 'Creating Optimized Production Build\n' : '')
@@ -879,119 +890,49 @@ async function Build() {
879
890
 
880
891
  function ssg(routes = []) {
881
892
  globalThis.isBuilding = true
893
+ let server = http.createServer((req, res) => {
894
+ let route = routes.find((e) => e.url === req.url)
895
+ if (route) {
896
+ let document = globalThis.routeDocuments.find((e) => e.url === req.url)
897
+ console.log(`\x1b[32m%s\x1b[0m`, `Prerendering ${req.url}...`)
898
+ res.writeHead(200, { 'Content-Type': 'text/html' });
899
+ res.end(document.document);
900
+ } else {
901
+ const filePath = process.cwd() + '/dist/' + req.url
902
+
903
+ fs.readFile(filePath, (err, data) => {
904
+ if (err) {
905
+ res.writeHead(404, { 'Content-Type': filePath.includes('js') ? 'text/javascript' : 'text/html' });
906
+ res.end('File not found');
907
+ } else {
908
+ res.writeHead(200, { 'Content-Type': filePath.includes('js') ? 'text/javascript' : 'text/html' });
909
+ res.end(data);
910
+ }
911
+ });
912
+ }
913
+ });
914
+
915
+ let port = 12000
916
+ server.on('error', (err) => {
917
+ if (err.code === 'EADDRINUSE') {
918
+ setTimeout(() => {
919
+ server.close();
920
+ server.listen(++port);
921
+ }, 1000);
922
+ }
923
+ })
924
+
925
+ server.listen(port);
882
926
  routes.forEach(async (route) => {
883
927
  if (route.url.includes(':')) {
884
928
  return
885
929
  }
886
- let equalparamroute = routes.map((e) => {
887
- if (e.url.includes(':')) {
888
- let url = e.url.split('/:')[0]
889
- if (url && route.url === url) {
890
- return e
891
- } else {
892
- return null
893
-
894
- }
895
- }
896
- return null
897
- }).filter(Boolean)
898
- let document = `
899
- <!DOCTYPE html>
900
- <html lang="en">
901
- <head>
902
- <script>
903
- window.routes = JSON.parse('${JSON.stringify(routes)}')
904
-
905
-
906
- </script>
907
- <script id="isServer">
908
- window.isServer = true
909
- </script>
910
- <meta charset="UTF-8">
911
- <meta name="viewport" content="width=device-width,initial-scale=1.0">
912
- <script type="module" id="meta">
913
- window.history.pushState({}, '', '${route.url}')
914
-
915
- </script>
916
- <script type="module" id="router">
917
- import VaderRouter from '/router.js'
918
- const router = new VaderRouter('${route.url}', 3000)
919
- router.get('${route.url}', async (req, res) => {
920
- try{
921
- let module = await import('/${route.fileName.replace('.jsx', '.js')}')
922
- if(Object.keys(module).includes('$prerender') && !module.$prerender){
923
- document.head.setAttribute('prerender', 'false')
924
- }
925
- res.render(module, req, res, module.$metadata)
926
- }
927
- catch(error){
928
- let errorMessage = {
929
- message: error.message,
930
- name: error.name,
931
- stack: error.stack,
932
- path: window.location.pathname
933
- };
934
-
935
-
936
- document.documentElement.setAttribute('error', JSON.stringify(errorMessage));
937
- throw new Error(error)
938
- }
939
- })
940
- ${equalparamroute.length > 0 ? equalparamroute.map((e) => {
941
930
 
942
931
 
943
932
 
944
- return `router.get('${e.url}', async (req, res) => {
945
- let module = await import('/${e.fileName.replace('.jsx', '.js')}')
946
- res.render(module, req, res, module.$metadata)
947
- })\n`
948
- }) : ''}
949
- router.listen(3000)
950
-
951
- </script>
952
- </head>
953
- <body>
954
- <div id="root"></div>
955
- </body>
956
-
957
-
958
- </html>
959
- `;
960
933
 
961
- // generate random but common ports
962
- let port = Math.floor(Math.random() * (65535 - 49152 + 1) + 49152)
963
934
 
964
- const server = http.createServer((req, res) => {
965
935
 
966
- if (req.url === '/') {
967
- res.writeHead(200, { 'Content-Type': 'text/html' });
968
- res.end(document);
969
- } else {
970
- // Serve static files (adjust the file paths based on your project structure)
971
- const filePath = process.cwd() + '/dist/' + req.url
972
-
973
- fs.readFile(filePath, (err, data) => {
974
- if (err) {
975
- res.writeHead(404, { 'Content-Type': filePath.includes('js') ? 'text/javascript' : 'text/html' });
976
- res.end('File not found');
977
- } else {
978
- res.writeHead(200, { 'Content-Type': filePath.includes('js') ? 'text/javascript' : 'text/html' });
979
- res.end(data);
980
- }
981
- });
982
- }
983
- });
984
-
985
- server.listen(port)
986
- server.on('error', (err) => {
987
- if (err.code === 'EADDRINUSE') {
988
- console.log(`Port ${port} is in use, trying another port...`);
989
- setTimeout(() => {
990
- server.close();
991
- server.listen(++port);
992
- }, 1000);
993
- }
994
- })
995
936
 
996
937
  globalThis.listen = true;
997
938
 
@@ -1007,14 +948,16 @@ async function Build() {
1007
948
  page.on('error', (err) => {
1008
949
  console.error('BROWSER ERROR:', JSON.parse(err));
1009
950
  });
1010
-
951
+
1011
952
  try {
1012
- page.on('pageerror', async err => {
1013
- let errorObj = JSON.parse(await page.evaluate(() => document.documentElement.getAttribute('error')) || '{}')
1014
- console.log('\x1b[31m%s\x1b[0m', 'Compiler Error:', errorObj)
953
+ page.on('pageerror', async err => {
954
+ let errorObj = JSON.parse(await page.evaluate(() => document.documentElement.getAttribute('error')) || '{}')
955
+ console.log('\x1b[31m%s\x1b[0m', 'Compiler Error:', errorObj)
1015
956
 
957
+ console.log('\x1b[31m%s\x1b[0m', 'Error:', err)
1016
958
  });
1017
959
  } catch (error) {
960
+ console.log(error)
1018
961
  browser.close()
1019
962
  }
1020
963
  // Handle page crashes
@@ -1024,16 +967,10 @@ async function Build() {
1024
967
  page.on('requestfailed', request => {
1025
968
  console.error('REQUEST FAILED:', request.url(), request.failure().errorText);
1026
969
  });
1027
- await page.goto(`http://localhost:${port}/`, { waitUntil: 'networkidle2' });
1028
-
1029
-
1030
-
1031
-
1032
-
1033
-
970
+ await page.goto(`http://localhost:${port}${route.url}`, { waitUntil: 'networkidle2' });
1034
971
 
1035
972
  await page.evaluate(() => {
1036
- document.getElementById('meta').remove()
973
+ document.querySelector('#meta').remove()
1037
974
  document.querySelector('#isServer').innerHTML = 'window.isServer = false'
1038
975
  if (document.head.getAttribute('prerender') === 'false') {
1039
976
  document.querySelector('#root').innerHTML = ''
@@ -1049,19 +986,26 @@ async function Build() {
1049
986
 
1050
987
 
1051
988
  } catch (error) {
1052
- console.log(error)
989
+
1053
990
  }
1054
991
 
1055
992
  finally {
1056
993
  browser.close()
1057
994
  server.close()
995
+ hasRendered.push(route.url)
996
+ console.log(`\x1b[32m%s\x1b[0m`, `Prerendered ${route.url}...`)
1058
997
  }
1059
998
  })
1060
999
 
1061
- let timeout = setTimeout(() => {
1000
+
1001
+
1002
+ if (hasRendered.length === routes.length) {
1003
+ server.close()
1004
+ hasRendered = []
1062
1005
  globalThis.isBuilding = false
1063
1006
  clearTimeout(timeout)
1064
- }, 1000)
1007
+ }
1008
+
1065
1009
  }
1066
1010
 
1067
1011
  globalThis.routes = []
@@ -1163,6 +1107,7 @@ async function Build() {
1163
1107
  }
1164
1108
 
1165
1109
 
1110
+
1166
1111
  globalThis.routes.push({ fileName: fileName, url: obj.url, html: '/' + (isBasePath ? 'index.html' : `${obj.url}/` + 'index.html') })
1167
1112
 
1168
1113
 
@@ -1180,6 +1125,87 @@ async function Build() {
1180
1125
  globalThis.isProduction ? console.log(string) : null
1181
1126
  }
1182
1127
 
1128
+
1129
+ globalThis.routeDocuments = []
1130
+ globalThis.routes.map((route) => {
1131
+ let equalparamroute = globalThis.routes.map((e) => {
1132
+ if (e.url.includes(':')) {
1133
+ let url = e.url.split('/:')[0]
1134
+ if (url && route.url === url) {
1135
+ return e
1136
+ } else {
1137
+ return null
1138
+
1139
+ }
1140
+ }
1141
+ return null
1142
+ }).filter(Boolean)
1143
+ let document = `
1144
+ <!DOCTYPE html>
1145
+ <html lang="en">
1146
+ <head>
1147
+ <script>
1148
+ window.routes = JSON.parse('${JSON.stringify(globalThis.routes)}')
1149
+ </script>
1150
+ <script type="module" id="meta">
1151
+ window.history.pushState({}, '', '${route.url}')
1152
+
1153
+ </script>
1154
+ <script id="isServer">
1155
+ window.isServer = true
1156
+ </script>
1157
+ <meta charset="UTF-8">
1158
+ <meta name="viewport" content="width=device-width,initial-scale=1.0">
1159
+
1160
+ <script type="module" id="router">
1161
+ import VaderRouter from '/router.js'
1162
+ const router = new VaderRouter('${route.url}')
1163
+ router.get('${route.url}', async (req, res) => {
1164
+ try{
1165
+ let module = await import('/${route.fileName.replace('.jsx', '.js')}')
1166
+ if(Object.keys(module).includes('$prerender') && !module.$prerender){
1167
+ document.head.setAttribute('prerender', 'false')
1168
+ }
1169
+ res.render(module, req, res, module.$metadata)
1170
+ }
1171
+ catch(error){
1172
+ let errorMessage = {
1173
+ message: error.message,
1174
+ name: error.name,
1175
+ stack: error.stack,
1176
+ path: window.location.pathname
1177
+ };
1178
+
1179
+
1180
+ document.documentElement.setAttribute('error', JSON.stringify(errorMessage));
1181
+ throw new Error(error)
1182
+ }
1183
+ })
1184
+ ${equalparamroute.length > 0 ? equalparamroute.map((e) => {
1185
+
1186
+
1187
+
1188
+ return `router.get('${e.url}', async (req, res) => {
1189
+ let module = await import('/${e.fileName.replace('.jsx', '.js')}')
1190
+ res.render(module, req, res, module.$metadata)
1191
+ })\n`
1192
+ }) : ''}
1193
+ router.listen(3000)
1194
+
1195
+ </script>
1196
+ </head>
1197
+ <body>
1198
+ <div id="root"></div>
1199
+ </body>
1200
+
1201
+
1202
+ </html>
1203
+ `;
1204
+ globalThis.routeDocuments.push({ url: route.url, document: document })
1205
+ })
1206
+
1207
+
1208
+
1183
1209
  ssg(globalThis.routes)
1184
1210
 
1185
1211
 
@@ -1212,7 +1238,7 @@ async function Build() {
1212
1238
 
1213
1239
  let data = await reader(process.cwd() + "/src/" + name)
1214
1240
  if (name.includes('.jsx')) {
1215
- let origin = process.cwd() + "/src/" + name
1241
+ let origin = process.cwd() + "/src/" + name
1216
1242
  if (!globalThis.isProduction) {
1217
1243
  let { sourceMap } = sourceMapGen({ origin: origin, fileName: name }, await Compiler(data, origin))
1218
1244
  data = data + `\n//# sourceMappingURL=/src/maps/${name.replace('.jsx', '.js.map')}\n //#sourceURL=${origin}`
@@ -1225,7 +1251,7 @@ async function Build() {
1225
1251
  await writer(process.cwd() + "/dist/src/" + name, data);
1226
1252
  })
1227
1253
 
1228
- const scannedPublicFiles = await glob("**/**/**.{css,js,html,mjs,cjs,png,jpg,jpeg,gif,svg,mp4,webm,ogg}", {
1254
+ const scannedPublicFiles = await glob("**/**.{css,js,html,mjs,cjs}", {
1229
1255
  ignore: ["node_modules/**/*", "dist/**/*"],
1230
1256
  cwd: process.cwd() + '/public/',
1231
1257
  absolute: true,
@@ -1233,7 +1259,7 @@ async function Build() {
1233
1259
  scannedPublicFiles.forEach(async (file) => {
1234
1260
  file = file.replace(/\\/g, '/');
1235
1261
  file = file.split('/public/')[1]
1236
- let data = fs.readFileSync(process.cwd() + "/public/" + file);
1262
+ let data = await reader(process.cwd() + "/public/" + file)
1237
1263
  bundleSize += fs.statSync(process.cwd() + "/public/" + file).size;
1238
1264
  await writer(process.cwd() + "/dist/public/" + file, data);
1239
1265
  })
@@ -1266,7 +1292,7 @@ async function Build() {
1266
1292
  }
1267
1293
 
1268
1294
  globalThis.isBuilding = false
1269
- console.log(`\nTotal bundle size: ${Math.round(bundleSize / 1000)}kb`)
1295
+ globalThis.isProduction ? console.log(`\nTotal bundle size: ${Math.round(bundleSize / 1000)}kb`) : null
1270
1296
 
1271
1297
  bundleSize = 0;
1272
1298