vaderjs 1.3.3-1b2198a8b18b → 1.3.3-1b2198a8b18b-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 +14 -13
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-1b2198a8b18b",
5
+ "version": "1.3.3-1b2198a8b18b-hotfix",
6
6
  "bin": {
7
7
  "vader": "./vader.js"
8
8
  },
package/vader.js CHANGED
@@ -907,9 +907,7 @@ async function Build() {
907
907
  page.on('crash', () => {
908
908
  console.error(`Render process crashed for ${route.url}`)
909
909
  });
910
- page.on('requestfailed', request => {
911
- console.error('REQUEST FAILED:', request.url(), request.failure().errorText);
912
- });
910
+
913
911
  await page.goto(`http://localhost:${port}${route.url}`, { waitUntil: 'networkidle2' });
914
912
 
915
913
  page.evaluate(() => {
@@ -1165,8 +1163,12 @@ async function Build() {
1165
1163
  `;
1166
1164
  globalThis.routeDocuments.push({ url: route.url, document: document })
1167
1165
  })
1168
-
1169
- ssg(globalThis.routes)
1166
+
1167
+ if(globalThis.devMode && !globalThis.oneAndDone){
1168
+ ssg(globalThis.routes)
1169
+ globalThis.oneAndDone = true
1170
+ console.log('Prerendering...')
1171
+ }
1170
1172
 
1171
1173
 
1172
1174
  const scannedSourceFiles = await glob("**/**.{jsx,js,json}", {
@@ -1258,7 +1260,7 @@ async function Build() {
1258
1260
 
1259
1261
  return true
1260
1262
  }
1261
- const s = () => {
1263
+ const s = (port) => {
1262
1264
 
1263
1265
  const server = http.createServer((req, res) => {
1264
1266
 
@@ -1343,10 +1345,9 @@ const s = () => {
1343
1345
  return 'application/octet-stream';
1344
1346
  }
1345
1347
  }
1346
-
1347
- const PORT = process.env.PORT || 3000;
1348
- server.listen(PORT, () => {
1349
- console.log(`Server is running on port ${PORT}`);
1348
+
1349
+ server.listen(port, () => {
1350
+ console.log(`Server is running on port ${port}`);
1350
1351
  globalThis.ws = ws
1351
1352
  });
1352
1353
 
@@ -1359,6 +1360,7 @@ switch (true) {
1359
1360
 
1360
1361
  globalThis.devMode = true
1361
1362
  globalThis.isProduction = false
1363
+ globalThis.oneAndDone = false
1362
1364
  console.log(`
1363
1365
  Vader.js v${fs.readFileSync(process.cwd() + '/node_modules/vaderjs/package.json', 'utf8').split('"version": "')[1].split('"')[0]}
1364
1366
  - Watching for changes in ./pages
@@ -1411,15 +1413,14 @@ Building to ./dist
1411
1413
 
1412
1414
  break;
1413
1415
  case process.argv.includes('start') && !process.argv.includes('dev') && !process.argv.includes('build'):
1414
- let port = process.argv[process.argv.indexOf('--serve') + 1] || 3000
1415
- process.env.PORT = port
1416
+ let port = process.argv[process.argv.indexOf('serve') + 1] || process.env.PORT || 3000
1416
1417
  globalThis.devMode = false
1417
1418
  console.log(`
1418
1419
  Vader.js v1.3.3
1419
1420
  Serving ./dist on port ${port}
1420
1421
  url: http://localhost:${port}
1421
1422
  `)
1422
- s()
1423
+ s(port)
1423
1424
  break;
1424
1425
  default:
1425
1426
  // add color