rsf-zero 0.3.0 → 0.3.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.
|
@@ -40,7 +40,8 @@ const callActionFn = async (actionId, actionFn, fnArgs) => {
|
|
|
40
40
|
return actionFnReturnValue;
|
|
41
41
|
}
|
|
42
42
|
catch (e) {
|
|
43
|
-
|
|
43
|
+
const errorWithStack = (e instanceof Error) ? e.stack : e;
|
|
44
|
+
throw new Error('Error thrown in action handler ' + actionId + ': ' + errorWithStack);
|
|
44
45
|
}
|
|
45
46
|
};
|
|
46
47
|
const serialiseReturnValue = (actionId, value) => {
|
package/dist/cli/start.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/cli/start.ts"],"names":[],"mappings":"AAIA,OAAO,eAAe,CAAC;AAGvB,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAKvD,eAAO,MAAM,KAAK,GAAU,SAAS,aAAa,
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/cli/start.ts"],"names":[],"mappings":"AAIA,OAAO,eAAe,CAAC;AAGvB,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAKvD,eAAO,MAAM,KAAK,GAAU,SAAS,aAAa,kBAkCjD,CAAA"}
|
package/dist/cli/start.js
CHANGED
|
@@ -18,10 +18,6 @@ export const start = async (options) => {
|
|
|
18
18
|
const port = 3000;
|
|
19
19
|
app.use(morgan("dev"));
|
|
20
20
|
app.use(express.json());
|
|
21
|
-
// Client
|
|
22
|
-
const staticPath = path.join(process.cwd(), 'dist/client/');
|
|
23
|
-
debug('Serving static files from: ' + staticPath);
|
|
24
|
-
app.use(express.static('dist/client/', options.startStatic ?? {}));
|
|
25
21
|
// Server
|
|
26
22
|
// - create action route
|
|
27
23
|
const { set: setActionRegistry } = createActionRoute(app);
|
|
@@ -32,6 +28,17 @@ export const start = async (options) => {
|
|
|
32
28
|
setActionRegistry(actionRegistry);
|
|
33
29
|
// - register custom routes
|
|
34
30
|
await customRoutes(options, app);
|
|
31
|
+
// Client
|
|
32
|
+
const staticPath = path.join(process.cwd(), 'dist/client/');
|
|
33
|
+
debug('Serving static files from: ' + staticPath);
|
|
34
|
+
app.use(express.static('dist/client/', options.startStatic ?? {}));
|
|
35
|
+
// catch-all rule for SPAs with routing
|
|
36
|
+
app.use((req, res) => {
|
|
37
|
+
if (req.method === 'GET') {
|
|
38
|
+
debug('Hit fallback path: ' + req.path);
|
|
39
|
+
res.sendFile(path.join(process.cwd(), 'dist/client/index.html'));
|
|
40
|
+
}
|
|
41
|
+
});
|
|
35
42
|
app.listen(port, () => {
|
|
36
43
|
console.log(`Server is running at http://localhost:${port}`);
|
|
37
44
|
});
|
package/package.json
CHANGED