wirejs-scripts 3.0.0 → 3.0.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/bin.js +13 -7
- package/package.json +1 -4
package/bin.js
CHANGED
|
@@ -11,7 +11,7 @@ import { rimraf } from 'rimraf';
|
|
|
11
11
|
|
|
12
12
|
import { JSDOM } from 'jsdom';
|
|
13
13
|
import { useJSDOM } from 'wirejs-dom/v2';
|
|
14
|
-
import { requiresContext, Context, CookieJar } from '
|
|
14
|
+
import { requiresContext, Context, CookieJar } from 'wirejs-resources';
|
|
15
15
|
|
|
16
16
|
const CWD = process.cwd();
|
|
17
17
|
const webpackConfig = webpackConfigure(process.env, process.argv);
|
|
@@ -89,6 +89,7 @@ async function callApiMethod(api, call, context) {
|
|
|
89
89
|
}, context);
|
|
90
90
|
}
|
|
91
91
|
} catch (error) {
|
|
92
|
+
console.log(error);
|
|
92
93
|
return { error: error.message };
|
|
93
94
|
}
|
|
94
95
|
}
|
|
@@ -275,10 +276,10 @@ async function trySSRPath(req, res) {
|
|
|
275
276
|
|
|
276
277
|
try {
|
|
277
278
|
useJSDOM(JSDOM);
|
|
278
|
-
|
|
279
|
-
await
|
|
279
|
+
const self = {};
|
|
280
|
+
const moduleData = await fs.promises.readFile(srcPath);
|
|
281
|
+
eval(`${moduleData}`);
|
|
280
282
|
const module = self.exports;
|
|
281
|
-
console.log({module});
|
|
282
283
|
if (typeof module.generate === 'function') {
|
|
283
284
|
const doc = await module.generate(context);
|
|
284
285
|
const doctype = doc.parentNode.doctype?.name || '';
|
|
@@ -295,7 +296,7 @@ async function trySSRPath(req, res) {
|
|
|
295
296
|
doc.parentNode.body.appendChild(script);
|
|
296
297
|
}
|
|
297
298
|
|
|
298
|
-
res.setHeader('Content-type', 'text/html; charset=utf-8')
|
|
299
|
+
res.setHeader('Content-type', 'text/html; charset=utf-8');
|
|
299
300
|
res.end([
|
|
300
301
|
doctype ? `<!doctype ${doctype}>\n` : '',
|
|
301
302
|
doc.outerHTML
|
|
@@ -368,11 +369,16 @@ async function compile(watch = false) {
|
|
|
368
369
|
...webpackConfig,
|
|
369
370
|
mode: 'development',
|
|
370
371
|
watch: true
|
|
371
|
-
}, () => {
|
|
372
|
+
}, () => {
|
|
373
|
+
console.log();
|
|
374
|
+
console.log('Compiled: http://localhost:3000/');
|
|
375
|
+
}).run(() => {});
|
|
372
376
|
|
|
373
377
|
logger.log('Starting server...');
|
|
374
378
|
const server = http.createServer(handleRequest);
|
|
375
|
-
server.listen(3000)
|
|
379
|
+
server.listen(3000).on('listening', () => {
|
|
380
|
+
console.log('Started listening on http://localhost:3000/')
|
|
381
|
+
});
|
|
376
382
|
} else {
|
|
377
383
|
logger.log('instantiating webpack compiler');
|
|
378
384
|
compiler = webpack(webpackConfig);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wirejs-scripts",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Basic build and start commands for wirejs apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -25,15 +25,12 @@
|
|
|
25
25
|
"css-loader": "^5.2.0",
|
|
26
26
|
"file-loader": "^6.2.0",
|
|
27
27
|
"glob": "^7.2.0",
|
|
28
|
-
"highlight.js": "^11.1.0",
|
|
29
28
|
"jsdom": "^25.0.1",
|
|
30
29
|
"marked": "^2.0.1",
|
|
31
30
|
"raw-loader": "^4.0.2",
|
|
32
31
|
"rimraf": "^6.0.1",
|
|
33
32
|
"style-loader": "^2.0.0",
|
|
34
33
|
"webpack": "^5.97.1",
|
|
35
|
-
"webpack-cli": "^6.0.1",
|
|
36
|
-
"webpack-dev-server": "^5.2.0",
|
|
37
34
|
"wirejs-dom": "^1.0.34"
|
|
38
35
|
}
|
|
39
36
|
}
|