jeasx 0.0.3 → 0.0.5
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/README.md +4 -2
- package/cli.js +38 -17
- package/package.json +6 -5
- package/serverless.js +1 -1
- package/serverless.ts +1 -1
- package/tsconfig.json +2 -1
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
#
|
|
1
|
+
# jeasx - server side rendering with the ease of JSX
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This is the `jeasx` core repository.
|
|
4
|
+
|
|
5
|
+
Please visit <https://github.com/jeasx/quickstart> to get started.
|
package/cli.js
CHANGED
|
@@ -1,34 +1,55 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import fs from "node:fs";
|
|
3
|
-
|
|
4
|
-
export {};
|
|
2
|
+
import fs from "node:fs/promises";
|
|
5
3
|
|
|
6
4
|
switch (process.argv[2]) {
|
|
7
5
|
case "start":
|
|
8
|
-
await
|
|
6
|
+
await start();
|
|
9
7
|
break;
|
|
10
8
|
|
|
11
9
|
case "build":
|
|
12
|
-
|
|
13
|
-
process.argv[3] = "js";
|
|
14
|
-
process.argv[4] = "css";
|
|
15
|
-
clearDist();
|
|
16
|
-
await import("./esbuild.config.js");
|
|
10
|
+
await build();
|
|
17
11
|
break;
|
|
18
12
|
|
|
19
13
|
case "dev":
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
await
|
|
14
|
+
await dev();
|
|
15
|
+
break;
|
|
16
|
+
|
|
17
|
+
case "clean":
|
|
18
|
+
await clean();
|
|
19
|
+
break;
|
|
20
|
+
|
|
21
|
+
case "help":
|
|
22
|
+
console.info(`Usage: jeasx [start|build|dev|clean|help]`);
|
|
25
23
|
break;
|
|
26
24
|
|
|
27
25
|
default:
|
|
28
|
-
console.info(
|
|
26
|
+
console.info(
|
|
27
|
+
`❌ Error: Unknown command '${process.argv[2]}'.\nUse 'jeasx help' for options.`
|
|
28
|
+
);
|
|
29
29
|
process.exit(1);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
function
|
|
33
|
-
|
|
32
|
+
async function start() {
|
|
33
|
+
await import("./server.js");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async function build() {
|
|
37
|
+
process.argv = process.argv.splice(0, 2);
|
|
38
|
+
await clean();
|
|
39
|
+
await import("./esbuild.config.js");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function dev() {
|
|
43
|
+
process.env.NODE_ENV = "development";
|
|
44
|
+
process.argv[2] = "start";
|
|
45
|
+
process.argv[3] ??= "node_modules/jeasx/ecosystem.config.cjs";
|
|
46
|
+
await clean();
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
await import("pm2/bin/pm2-runtime");
|
|
34
49
|
}
|
|
50
|
+
|
|
51
|
+
async function clean() {
|
|
52
|
+
await fs.rm("dist", { recursive: true, force: true });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jeasx",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"description": "jeasx - the power of server side rendering with the ease of jsx",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jsx",
|
|
7
|
-
"ssr"
|
|
7
|
+
"ssr",
|
|
8
|
+
"node"
|
|
8
9
|
],
|
|
9
10
|
"license": "MIT",
|
|
10
11
|
"repository": {
|
|
@@ -31,10 +32,10 @@
|
|
|
31
32
|
"dotenv": "16.3.1",
|
|
32
33
|
"esbuild": "0.19.11",
|
|
33
34
|
"fastify": "4.25.2",
|
|
34
|
-
"jsx-async-runtime": "0.1.
|
|
35
|
+
"jsx-async-runtime": "0.1.3",
|
|
35
36
|
"pm2": "5.3.0"
|
|
36
37
|
},
|
|
37
38
|
"scripts": {
|
|
38
|
-
"build": "esbuild --platform=node --format=esm --
|
|
39
|
+
"build": "esbuild --platform=node --format=esm --outdir=. serverless.ts"
|
|
39
40
|
}
|
|
40
41
|
}
|
package/serverless.js
CHANGED
|
@@ -54,7 +54,7 @@ serverless.all("*", async (request, reply) => {
|
|
|
54
54
|
const modulePath = join(process.cwd(), "dist", pathname);
|
|
55
55
|
try {
|
|
56
56
|
(await stat(modulePath)).isFile();
|
|
57
|
-
} catch
|
|
57
|
+
} catch {
|
|
58
58
|
continue;
|
|
59
59
|
}
|
|
60
60
|
const hash = process.env.NODE_ENV === "development" ? "?" + createHash("sha1").update(await readFile(modulePath, "utf-8")).digest("hex") : "";
|
package/serverless.ts
CHANGED