@batijs/cli 0.0.1 → 0.0.3
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/dist/boilerplates/@batijs/express/$$express-entry.ts.ts +124 -0
- package/dist/boilerplates/@batijs/express/$package.json.js +21 -0
- package/dist/boilerplates/@batijs/express/chunk-package-BS6EEBE7.js +81 -0
- package/dist/boilerplates/@batijs/hattip/$$hattip-entry.ts.ts +84 -0
- package/dist/boilerplates/@batijs/hattip/$package.json.js +23 -0
- package/dist/boilerplates/@batijs/hattip/chunk-package-P5FG3FJS.js +81 -0
- package/dist/boilerplates/@batijs/shared/package.json +17 -0
- package/dist/boilerplates/@batijs/shared/tsconfig.json +18 -0
- package/dist/boilerplates/@batijs/shared/vite.config.ts +5 -0
- package/dist/boilerplates/@batijs/solid/$package.json.js +11 -0
- package/dist/boilerplates/@batijs/solid/$tsconfig.json.js +12 -0
- package/dist/boilerplates/@batijs/solid/$vite.config.ts.js +13 -0
- package/dist/boilerplates/@batijs/solid/assets/logo.svg +36 -0
- package/dist/boilerplates/@batijs/solid/chunk-package-IU66XUZ2.js +79 -0
- package/dist/boilerplates/@batijs/solid/components/Link.tsx +16 -0
- package/dist/boilerplates/@batijs/solid/layouts/LayoutDefault.tsx +74 -0
- package/dist/boilerplates/@batijs/solid/layouts/style.css +29 -0
- package/dist/boilerplates/@batijs/solid/pages/+config.ts +11 -0
- package/dist/boilerplates/@batijs/solid/pages/_error/+Page.tsx +20 -0
- package/dist/boilerplates/@batijs/solid/pages/index/+Page.tsx +17 -0
- package/dist/boilerplates/@batijs/solid/pages/index/Counter.tsx +13 -0
- package/dist/boilerplates/@batijs/solid/pages/star-wars/@id/+Page.tsx +15 -0
- package/dist/boilerplates/@batijs/solid/pages/star-wars/@id/+onBeforeRender.ts +29 -0
- package/dist/boilerplates/@batijs/solid/pages/star-wars/filterMovieData.ts +11 -0
- package/dist/boilerplates/@batijs/solid/pages/star-wars/index/+Page.tsx +23 -0
- package/dist/boilerplates/@batijs/solid/pages/star-wars/index/+onBeforeRender.ts +80 -0
- package/dist/boilerplates/@batijs/solid/pages/star-wars/types.ts +13 -0
- package/dist/boilerplates/@batijs/telefunc/$package.json.js +11 -0
- package/dist/boilerplates/@batijs/telefunc/$vite.config.ts.js +14 -0
- package/dist/boilerplates/@batijs/telefunc/chunk-package-PYDSUPTJ.js +75 -0
- package/dist/boilerplates/boilerplates.json +1 -0
- package/dist/index.js +638 -29
- package/package.json +13 -9
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { renderPage } from "vite-plugin-ssr/server";
|
|
2
|
+
import { telefunc } from "telefunc";
|
|
3
|
+
import { VikeAuth } from "vike-authjs";
|
|
4
|
+
import CredentialsProvider from "@auth/core/providers/credentials";
|
|
5
|
+
import express from "express";
|
|
6
|
+
import { createMiddleware } from "@hattip/adapter-node";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
import { dirname } from "node:path/posix";
|
|
9
|
+
|
|
10
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
11
|
+
const __dirname = dirname(__filename);
|
|
12
|
+
const isProduction = process.env.NODE_ENV === "production";
|
|
13
|
+
const root = __dirname;
|
|
14
|
+
|
|
15
|
+
startServer();
|
|
16
|
+
|
|
17
|
+
async function startServer() {
|
|
18
|
+
const app = express();
|
|
19
|
+
|
|
20
|
+
if (isProduction) {
|
|
21
|
+
app.use(express.static(`${root}/dist/client`));
|
|
22
|
+
} else {
|
|
23
|
+
// Instantiate Vite's development server and integrate its middleware to our server.
|
|
24
|
+
// ⚠️ We should instantiate it *only* in development. (It isn't needed in production
|
|
25
|
+
// and would unnecessarily bloat our server in production.)
|
|
26
|
+
const vite = await import("vite");
|
|
27
|
+
const viteDevMiddleware = (
|
|
28
|
+
await vite.createServer({
|
|
29
|
+
root,
|
|
30
|
+
server: { middlewareMode: true },
|
|
31
|
+
})
|
|
32
|
+
).middlewares;
|
|
33
|
+
app.use(viteDevMiddleware);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (import.meta.VIKE_MODULES?.includes("auth:authjs")) {
|
|
37
|
+
const Auth = VikeAuth({
|
|
38
|
+
secret: "bibou",
|
|
39
|
+
/**
|
|
40
|
+
* Add your providers here
|
|
41
|
+
*
|
|
42
|
+
* @link {@see https://authjs.dev/guides/providers/custom-provider}
|
|
43
|
+
* */
|
|
44
|
+
providers: [
|
|
45
|
+
CredentialsProvider({
|
|
46
|
+
// The name to display on the sign in form (e.g. "Sign in with...")
|
|
47
|
+
name: "Credentials",
|
|
48
|
+
// `credentials` is used to generate a form on the sign in page.
|
|
49
|
+
// You can specify which fields should be submitted, by adding keys to the `credentials` object.
|
|
50
|
+
// e.g. domain, username, password, 2FA token, etc.
|
|
51
|
+
// You can pass any HTML attribute to the <input> tag through the object.
|
|
52
|
+
credentials: {
|
|
53
|
+
username: { label: "Username", type: "text", placeholder: "jsmith" },
|
|
54
|
+
password: { label: "Password", type: "password" },
|
|
55
|
+
},
|
|
56
|
+
async authorize(credentials, req) {
|
|
57
|
+
// Add logic here to look up the user from the credentials supplied
|
|
58
|
+
const user = { id: "1", name: "J Smith", email: "jsmith@example.com" };
|
|
59
|
+
|
|
60
|
+
if (user) {
|
|
61
|
+
// Any object returned will be saved in `user` property of the JWT
|
|
62
|
+
return user;
|
|
63
|
+
} else {
|
|
64
|
+
// If you return null then an error will be displayed advising the user to check their details.
|
|
65
|
+
return null;
|
|
66
|
+
|
|
67
|
+
// You can also Reject this callback with an Error thus the user will be sent to the error page with the error message as a query parameter
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
}),
|
|
71
|
+
],
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
app.all(
|
|
75
|
+
"/api/auth/*",
|
|
76
|
+
createMiddleware(Auth, {
|
|
77
|
+
alwaysCallNext: false,
|
|
78
|
+
})
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (import.meta.VIKE_MODULES?.includes("rpc:telefunc")) {
|
|
83
|
+
app.post(
|
|
84
|
+
"/_telefunc",
|
|
85
|
+
createMiddleware(
|
|
86
|
+
async (context) => {
|
|
87
|
+
const httpResponse = await telefunc({
|
|
88
|
+
url: context.request.url.toString(),
|
|
89
|
+
method: context.request.method,
|
|
90
|
+
body: await context.request.text(),
|
|
91
|
+
context,
|
|
92
|
+
});
|
|
93
|
+
const { body, statusCode, contentType } = httpResponse;
|
|
94
|
+
return new Response(body, {
|
|
95
|
+
status: statusCode,
|
|
96
|
+
headers: {
|
|
97
|
+
"content-type": contentType,
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
alwaysCallNext: false,
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
app.all("*", async (req, res, next) => {
|
|
109
|
+
const pageContextInit = { urlOriginal: req.originalUrl };
|
|
110
|
+
const pageContext = await renderPage(pageContextInit);
|
|
111
|
+
if (pageContext.httpResponse === null) return next();
|
|
112
|
+
|
|
113
|
+
if ((pageContext as Record<string, unknown>)._isStream) {
|
|
114
|
+
pageContext.httpResponse.pipe(res);
|
|
115
|
+
} else {
|
|
116
|
+
const { body, statusCode, contentType } = pageContext.httpResponse;
|
|
117
|
+
res.status(statusCode).type(contentType).send(body);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
app.listen(3000, "localhost", () => {
|
|
122
|
+
console.log("Server listening on http://localhost:3000");
|
|
123
|
+
});
|
|
124
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// files/$package.json.ts
|
|
2
|
+
import { addDependency, loadAsJson } from "@batijs/core";
|
|
3
|
+
async function getPackageJson(currentContent, meta) {
|
|
4
|
+
const packageJson = await loadAsJson(currentContent);
|
|
5
|
+
packageJson.scripts.dev = "tsx ./express-entry.ts";
|
|
6
|
+
packageJson.scripts.build = "vite build";
|
|
7
|
+
return addDependency(packageJson, await import("./chunk-package-BS6EEBE7.js"), {
|
|
8
|
+
devDependencies: ["@types/express"],
|
|
9
|
+
dependencies: [
|
|
10
|
+
"@hattip/adapter-node",
|
|
11
|
+
"express",
|
|
12
|
+
"tsx",
|
|
13
|
+
"vite",
|
|
14
|
+
"vite-plugin-ssr",
|
|
15
|
+
...meta.VIKE_MODULES?.includes("auth:authjs") ? ["@auth/core", "vike-authjs"] : []
|
|
16
|
+
]
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
getPackageJson as default
|
|
21
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// package.json
|
|
2
|
+
var name = "@batijs/express";
|
|
3
|
+
var version = "0.0.3";
|
|
4
|
+
var description = "";
|
|
5
|
+
var type = "module";
|
|
6
|
+
var scripts = {
|
|
7
|
+
build: "tsup"
|
|
8
|
+
};
|
|
9
|
+
var keywords = [];
|
|
10
|
+
var author = "";
|
|
11
|
+
var license = "MIT";
|
|
12
|
+
var devDependencies = {
|
|
13
|
+
"@auth/core": "^0.7.0",
|
|
14
|
+
"@batijs/tsup": "workspace:*",
|
|
15
|
+
"@hattip/adapter-node": "^0.0.33",
|
|
16
|
+
"@types/express": "^4.17.17",
|
|
17
|
+
"@types/node": "^16.18.24",
|
|
18
|
+
express: "^4.18.2",
|
|
19
|
+
telefunc: "^0.1.52",
|
|
20
|
+
tsx: "^3.12.7",
|
|
21
|
+
"vike-authjs": "^0.0.2",
|
|
22
|
+
vite: "^4.3.2",
|
|
23
|
+
"vite-plugin-ssr": "^0.4.117"
|
|
24
|
+
};
|
|
25
|
+
var dependencies = {
|
|
26
|
+
"@batijs/core": "workspace:*"
|
|
27
|
+
};
|
|
28
|
+
var exports = {
|
|
29
|
+
".": "./dist/index.js",
|
|
30
|
+
"./files": "./dist/index.js"
|
|
31
|
+
};
|
|
32
|
+
var typesVersions = {
|
|
33
|
+
"*": {
|
|
34
|
+
".": [
|
|
35
|
+
"./dist/index.d.ts"
|
|
36
|
+
],
|
|
37
|
+
files: [
|
|
38
|
+
"./dist/index.d.ts"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var files = [
|
|
43
|
+
"dist/"
|
|
44
|
+
];
|
|
45
|
+
var bati = {
|
|
46
|
+
flag: "express",
|
|
47
|
+
boilerplate: "./dist/files"
|
|
48
|
+
};
|
|
49
|
+
var package_default = {
|
|
50
|
+
name,
|
|
51
|
+
version,
|
|
52
|
+
description,
|
|
53
|
+
type,
|
|
54
|
+
scripts,
|
|
55
|
+
keywords,
|
|
56
|
+
author,
|
|
57
|
+
license,
|
|
58
|
+
devDependencies,
|
|
59
|
+
dependencies,
|
|
60
|
+
exports,
|
|
61
|
+
typesVersions,
|
|
62
|
+
files,
|
|
63
|
+
bati
|
|
64
|
+
};
|
|
65
|
+
export {
|
|
66
|
+
author,
|
|
67
|
+
bati,
|
|
68
|
+
package_default as default,
|
|
69
|
+
dependencies,
|
|
70
|
+
description,
|
|
71
|
+
devDependencies,
|
|
72
|
+
exports,
|
|
73
|
+
files,
|
|
74
|
+
keywords,
|
|
75
|
+
license,
|
|
76
|
+
name,
|
|
77
|
+
scripts,
|
|
78
|
+
type,
|
|
79
|
+
typesVersions,
|
|
80
|
+
version
|
|
81
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { createRouter } from "@hattip/router";
|
|
2
|
+
import { renderPage } from "vite-plugin-ssr/server";
|
|
3
|
+
import { telefunc } from "telefunc";
|
|
4
|
+
import { VikeAuth } from "vike-authjs";
|
|
5
|
+
import CredentialsProvider from "@auth/core/providers/credentials";
|
|
6
|
+
|
|
7
|
+
const router = createRouter();
|
|
8
|
+
|
|
9
|
+
if (import.meta.VIKE_MODULES?.includes("rpc:telefunc")) {
|
|
10
|
+
router.post("/_telefunc", async (context) => {
|
|
11
|
+
const httpResponse = await telefunc({
|
|
12
|
+
url: context.url.toString(),
|
|
13
|
+
method: context.method,
|
|
14
|
+
body: await context.request.text(),
|
|
15
|
+
context,
|
|
16
|
+
});
|
|
17
|
+
const { body, statusCode, contentType } = httpResponse;
|
|
18
|
+
return new Response(body, {
|
|
19
|
+
status: statusCode,
|
|
20
|
+
headers: {
|
|
21
|
+
"content-type": contentType,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (import.meta.VIKE_MODULES?.includes("auth:authjs")) {
|
|
28
|
+
const Auth = VikeAuth({
|
|
29
|
+
secret: "bibou",
|
|
30
|
+
/**
|
|
31
|
+
* Add your providers here
|
|
32
|
+
*
|
|
33
|
+
* @link {@see https://authjs.dev/guides/providers/custom-provider}
|
|
34
|
+
* */
|
|
35
|
+
providers: [
|
|
36
|
+
CredentialsProvider({
|
|
37
|
+
// The name to display on the sign in form (e.g. "Sign in with...")
|
|
38
|
+
name: "Credentials",
|
|
39
|
+
// `credentials` is used to generate a form on the sign in page.
|
|
40
|
+
// You can specify which fields should be submitted, by adding keys to the `credentials` object.
|
|
41
|
+
// e.g. domain, username, password, 2FA token, etc.
|
|
42
|
+
// You can pass any HTML attribute to the <input> tag through the object.
|
|
43
|
+
credentials: {
|
|
44
|
+
username: { label: "Username", type: "text", placeholder: "jsmith" },
|
|
45
|
+
password: { label: "Password", type: "password" },
|
|
46
|
+
},
|
|
47
|
+
async authorize(credentials, req) {
|
|
48
|
+
// Add logic here to look up the user from the credentials supplied
|
|
49
|
+
const user = { id: "1", name: "J Smith", email: "jsmith@example.com" };
|
|
50
|
+
|
|
51
|
+
if (user) {
|
|
52
|
+
// Any object returned will be saved in `user` property of the JWT
|
|
53
|
+
return user;
|
|
54
|
+
} else {
|
|
55
|
+
// If you return null then an error will be displayed advising the user to check their details.
|
|
56
|
+
return null;
|
|
57
|
+
|
|
58
|
+
// You can also Reject this callback with an Error thus the user will be sent to the error page with the error message as a query parameter
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
}),
|
|
62
|
+
],
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
router.get("/api/auth/*", Auth);
|
|
66
|
+
router.post("/api/auth/*", Auth);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
router.use(async (context) => {
|
|
70
|
+
const pageContextInit = { urlOriginal: context.request.url };
|
|
71
|
+
const pageContext = await renderPage(pageContextInit);
|
|
72
|
+
const response = pageContext.httpResponse;
|
|
73
|
+
|
|
74
|
+
return new Response(await response?.getBody(), {
|
|
75
|
+
status: response?.statusCode,
|
|
76
|
+
headers: response
|
|
77
|
+
? {
|
|
78
|
+
"content-type": response.contentType,
|
|
79
|
+
}
|
|
80
|
+
: {},
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
export default router.buildHandler();
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// files/$package.json.ts
|
|
2
|
+
import { addDependency, loadAsJson } from "@batijs/core";
|
|
3
|
+
async function getPackageJson(currentContent, meta) {
|
|
4
|
+
const packageJson = await loadAsJson(currentContent);
|
|
5
|
+
packageJson.scripts.dev = "hattip serve ./hattip-entry.ts --client";
|
|
6
|
+
packageJson.scripts.build = "hattip build ./hattip-entry.ts --client";
|
|
7
|
+
if (packageJson.scripts.preview) {
|
|
8
|
+
delete packageJson.scripts.preview;
|
|
9
|
+
}
|
|
10
|
+
return addDependency(packageJson, await import("./chunk-package-P5FG3FJS.js"), {
|
|
11
|
+
devDependencies: ["@hattip/vite"],
|
|
12
|
+
dependencies: [
|
|
13
|
+
"@hattip/router",
|
|
14
|
+
"hattip",
|
|
15
|
+
"vite",
|
|
16
|
+
"vite-plugin-ssr",
|
|
17
|
+
...meta.VIKE_MODULES?.includes("auth:authjs") ? ["@auth/core", "vike-authjs"] : []
|
|
18
|
+
]
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
getPackageJson as default
|
|
23
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// package.json
|
|
2
|
+
var name = "@batijs/hattip";
|
|
3
|
+
var version = "0.0.3";
|
|
4
|
+
var description = "";
|
|
5
|
+
var type = "module";
|
|
6
|
+
var scripts = {
|
|
7
|
+
build: "tsup"
|
|
8
|
+
};
|
|
9
|
+
var keywords = [];
|
|
10
|
+
var author = "";
|
|
11
|
+
var license = "MIT";
|
|
12
|
+
var devDependencies = {
|
|
13
|
+
"@auth/core": "^0.7.0",
|
|
14
|
+
"@batijs/tsup": "workspace:*",
|
|
15
|
+
"@hattip/adapter-node": "^0.0.33",
|
|
16
|
+
"@hattip/router": "^0.0.33",
|
|
17
|
+
"@hattip/vite": "^0.0.33",
|
|
18
|
+
"@types/node": "^16.18.24",
|
|
19
|
+
hattip: "^0.0.33",
|
|
20
|
+
telefunc: "^0.1.52",
|
|
21
|
+
"vike-authjs": "^0.0.2",
|
|
22
|
+
vite: "^4.3.2",
|
|
23
|
+
"vite-plugin-ssr": "^0.4.117"
|
|
24
|
+
};
|
|
25
|
+
var dependencies = {
|
|
26
|
+
"@batijs/core": "workspace:*"
|
|
27
|
+
};
|
|
28
|
+
var exports = {
|
|
29
|
+
".": "./dist/index.js",
|
|
30
|
+
"./files": "./dist/index.js"
|
|
31
|
+
};
|
|
32
|
+
var typesVersions = {
|
|
33
|
+
"*": {
|
|
34
|
+
".": [
|
|
35
|
+
"./dist/index.d.ts"
|
|
36
|
+
],
|
|
37
|
+
files: [
|
|
38
|
+
"./dist/index.d.ts"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
var files = [
|
|
43
|
+
"dist/"
|
|
44
|
+
];
|
|
45
|
+
var bati = {
|
|
46
|
+
flag: "hattip",
|
|
47
|
+
boilerplate: "./dist/files"
|
|
48
|
+
};
|
|
49
|
+
var package_default = {
|
|
50
|
+
name,
|
|
51
|
+
version,
|
|
52
|
+
description,
|
|
53
|
+
type,
|
|
54
|
+
scripts,
|
|
55
|
+
keywords,
|
|
56
|
+
author,
|
|
57
|
+
license,
|
|
58
|
+
devDependencies,
|
|
59
|
+
dependencies,
|
|
60
|
+
exports,
|
|
61
|
+
typesVersions,
|
|
62
|
+
files,
|
|
63
|
+
bati
|
|
64
|
+
};
|
|
65
|
+
export {
|
|
66
|
+
author,
|
|
67
|
+
bati,
|
|
68
|
+
package_default as default,
|
|
69
|
+
dependencies,
|
|
70
|
+
description,
|
|
71
|
+
devDependencies,
|
|
72
|
+
exports,
|
|
73
|
+
files,
|
|
74
|
+
keywords,
|
|
75
|
+
license,
|
|
76
|
+
name,
|
|
77
|
+
scripts,
|
|
78
|
+
type,
|
|
79
|
+
typesVersions,
|
|
80
|
+
version
|
|
81
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "my-app",
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"description": "",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "vite build",
|
|
9
|
+
"preview": "vite build && vite preview"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [],
|
|
12
|
+
"author": "",
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"typescript": "^5.0.0"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {}
|
|
17
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"strict": true,
|
|
4
|
+
"allowJs": true,
|
|
5
|
+
"checkJs": true,
|
|
6
|
+
"esModuleInterop": true,
|
|
7
|
+
"forceConsistentCasingInFileNames": true,
|
|
8
|
+
"resolveJsonModule": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"sourceMap": true,
|
|
11
|
+
"module": "ESNext",
|
|
12
|
+
"noEmit": true,
|
|
13
|
+
"moduleResolution": "node",
|
|
14
|
+
"target": "ES2020",
|
|
15
|
+
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
16
|
+
"types": ["vite/client"]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// files/$package.json.ts
|
|
2
|
+
import { addDependency, loadAsJson } from "@batijs/core";
|
|
3
|
+
async function getPackageJson(currentContent) {
|
|
4
|
+
const packageJson = await loadAsJson(currentContent);
|
|
5
|
+
return addDependency(packageJson, await import("./chunk-package-IU66XUZ2.js"), {
|
|
6
|
+
dependencies: ["cross-fetch", "solid-js", "solide"]
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
getPackageJson as default
|
|
11
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// files/$tsconfig.json.ts
|
|
2
|
+
import { loadAsJson } from "@batijs/core";
|
|
3
|
+
async function getTsConfig(currentContent) {
|
|
4
|
+
const tsConfig = await loadAsJson(currentContent);
|
|
5
|
+
tsConfig.compilerOptions.jsx = "preserve";
|
|
6
|
+
tsConfig.compilerOptions.jsxImportSource = "solid-js";
|
|
7
|
+
tsConfig.compilerOptions.types = [...tsConfig.compilerOptions.types ?? [], "solide/types"];
|
|
8
|
+
return tsConfig;
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
getTsConfig as default
|
|
12
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// files/$vite.config.ts.ts
|
|
2
|
+
import { addVitePlugin, loadAsMagicast } from "@batijs/core";
|
|
3
|
+
async function getViteConfig(currentContent) {
|
|
4
|
+
const mod = await loadAsMagicast(currentContent);
|
|
5
|
+
addVitePlugin(mod, {
|
|
6
|
+
from: "solide/vite",
|
|
7
|
+
constructor: "solid"
|
|
8
|
+
});
|
|
9
|
+
return mod.generate().code;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
getViteConfig as default
|
|
13
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="175" height="175" fill="none" version="1.1" viewBox="0 0 175 175" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
|
3
|
+
<metadata>
|
|
4
|
+
<rdf:RDF>
|
|
5
|
+
<cc:Work rdf:about="">
|
|
6
|
+
<dc:format>image/svg+xml</dc:format>
|
|
7
|
+
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
|
|
8
|
+
<dc:title/>
|
|
9
|
+
</cc:Work>
|
|
10
|
+
</rdf:RDF>
|
|
11
|
+
</metadata>
|
|
12
|
+
<defs>
|
|
13
|
+
<linearGradient id="linearGradient880" x1="108.64" x2="115.51" y1="88.726" y2="136.2" gradientTransform="matrix(1.0498 0 0 1.0498 -2.9171 -2.9658)" gradientUnits="userSpaceOnUse">
|
|
14
|
+
<stop stop-color="#ffea83" offset="0"/>
|
|
15
|
+
<stop stop-color="#FFDD35" offset=".083333"/>
|
|
16
|
+
<stop stop-color="#FFA800" offset="1"/>
|
|
17
|
+
</linearGradient>
|
|
18
|
+
<linearGradient id="paint2_linear" x1="48.975" x2="61.299" y1="3.9232" y2="158.04" gradientTransform="translate(-2.832e-5)" gradientUnits="userSpaceOnUse">
|
|
19
|
+
<stop stop-color="#FFEA83" offset="0"/>
|
|
20
|
+
<stop stop-color="#FFDD35" offset=".083333"/>
|
|
21
|
+
<stop stop-color="#FFA800" offset="1"/>
|
|
22
|
+
</linearGradient>
|
|
23
|
+
<linearGradient id="paint0_linear-6" x1="-1.4492" x2="116.62" y1="-5.8123" y2="137.08" gradientTransform="translate(-2.832e-5)" gradientUnits="userSpaceOnUse">
|
|
24
|
+
<stop stop-color="#41D1FF" offset="0"/>
|
|
25
|
+
<stop stop-color="#BD34FE" offset="1"/>
|
|
26
|
+
</linearGradient>
|
|
27
|
+
</defs>
|
|
28
|
+
<circle cx="87.5" cy="87.5" r="87.5" fill="#c4c4c4"/>
|
|
29
|
+
<circle cx="87.5" cy="87.5" r="87.5" fill="url(#paint0_linear-6)"/>
|
|
30
|
+
<g transform="translate(632.92 54.355)" fill="#d38787" stroke-width="1.0614">
|
|
31
|
+
<path d="m-549.75 68.457c-5.7533-3.1217-6.1166-5.2295-6.1166-35.489 0-30.458 0.35464-32.448 6.3339-35.54 3.9943-2.0655 24.279-2.2805 26.735-0.28333 0.89718 0.72974 6.7203 6.6637 12.94 13.187l11.309 11.86v19.575c0 18.473-0.12956 19.74-2.3011 22.5-4.0223 5.1136-7.558 5.8565-27.65 5.8099-14.15-0.03287-19.008-0.40294-21.25-1.6191zm42.473-6.3594c2.27-1.59 2.359-2.2909 2.359-18.575v-16.923h-6.9521c-12.443 0-16.4-4.0845-16.4-16.93v-7.4828h-8.9464c-6.7178 0-9.3619 0.41549-10.614 1.668-2.5031 2.5031-2.5031 55.724 0 58.228 2.4502 2.4502 37.058 2.4636 40.553 0.01609zm-1.8867-42.165c0-0.16422-2.8659-3.1346-6.3686-6.6008l-6.3686-6.3022v4.9328c0 6.3185 1.8955 8.2687 8.0366 8.2687 2.5854 0 4.7007-0.13434 4.7007-0.29859zm-57.57 44.279c-5.6185-3.0486-6.1166-5.593-6.1166-31.243 0-18.891 0.31331-24.063 1.6101-26.571 1.809-3.4981 6.5048-6.3339 10.489-6.3339 2.4847 0 2.5814 0.19984 1.541 3.1843-0.61054 1.7514-1.7457 3.1843-2.5226 3.1843-0.77686 0-2.1631 0.75059-3.0805 1.668-2.4923 2.4923-2.4923 47.244 0 49.736 0.91739 0.9174 2.3036 1.668 3.0805 1.668 0.77688 0 1.912 1.4329 2.5226 3.1843 1.0562 3.0298 0.97108 3.1822-1.7537 3.1418-1.575-0.02331-4.1713-0.75194-5.7694-1.6191zm-16.983-4.2458c-5.4392-2.9512-6.1166-5.9415-6.1166-26.997 0-15.096 0.345-19.878 1.6101-22.325 1.7476-3.3796 6.4758-6.3339 10.137-6.3339 1.8666 0 2.1789 0.44955 1.6594 2.3882-0.35184 1.3135-0.64655 2.7465-0.65453 3.1843-8e-3 0.43784-0.69682 0.79608-1.5308 0.79608-0.83399 0-2.2669 0.75059-3.1843 1.668-2.4767 2.4767-2.4767 38.768 0 41.244 0.91741 0.91739 2.2946 1.668 3.0605 1.668 1.196 0 2.6402 2.995 2.6871 5.5726 0.0241 1.3294-4.5804 0.80962-7.6676-0.8655z" style="mix-blend-mode:lighten"/>
|
|
32
|
+
<path d="m-552.2 68.911c-5.7533-3.1217-6.1166-5.2295-6.1166-35.489 0-30.458 0.35463-32.448 6.3339-35.54 3.9943-2.0655 24.279-2.2805 26.735-0.28333 0.89718 0.72974 6.7203 6.6637 12.94 13.187l11.309 11.86v19.575c0 18.473-0.12957 19.74-2.3011 22.5-4.0223 5.1136-7.558 5.8565-27.65 5.8099-14.15-0.03287-19.008-0.40294-21.25-1.6191zm42.473-6.3594c2.27-1.59 2.359-2.2909 2.359-18.575v-16.923h-6.952c-12.443 0-16.4-4.0845-16.4-16.93v-7.4828h-8.9464c-6.7179 0-9.3619 0.41549-10.614 1.668-2.5031 2.5031-2.5031 55.724 0 58.228 2.4502 2.4502 37.058 2.4636 40.553 0.01609zm-1.8867-42.165c0-0.16422-2.8659-3.1346-6.3686-6.6008l-6.3686-6.3022v4.9328c0 6.3185 1.8955 8.2688 8.0366 8.2688 2.5854 0 4.7007-0.13434 4.7007-0.29859zm-57.57 44.279c-5.6185-3.0486-6.1166-5.593-6.1166-31.243 0-18.891 0.31331-24.063 1.6101-26.571 1.809-3.4981 6.5048-6.3339 10.489-6.3339 2.4847 0 2.5814 0.19984 1.541 3.1843-0.61054 1.7514-1.7457 3.1843-2.5226 3.1843-0.77687 0-2.1631 0.75059-3.0805 1.668-2.4923 2.4923-2.4923 47.244 0 49.736 0.91741 0.91739 2.3036 1.668 3.0805 1.668 0.77686 0 1.912 1.4329 2.5226 3.1843 1.0562 3.0298 0.97107 3.1822-1.7537 3.1418-1.575-0.02331-4.1713-0.75194-5.7694-1.6191zm-16.983-4.2458c-5.4392-2.9512-6.1166-5.9415-6.1166-26.997 0-15.096 0.34502-19.878 1.6101-22.325 1.7476-3.3796 6.4758-6.3339 10.137-6.3339 1.8666 0 2.1789 0.44955 1.6594 2.3882-0.35182 1.3135-0.64653 2.7465-0.65452 3.1843-8e-3 0.43784-0.69683 0.79608-1.5308 0.79608-0.83397 0-2.2669 0.75059-3.1843 1.668-2.4767 2.4767-2.4767 38.768 0 41.245 0.9174 0.91739 2.2946 1.668 3.0605 1.668 1.196 0 2.6402 2.995 2.6871 5.5726 0.0241 1.3294-4.5804 0.80962-7.6676-0.8655z" fill-opacity=".47466" style="mix-blend-mode:lighten"/>
|
|
33
|
+
</g>
|
|
34
|
+
<path d="m128.48 88.913-24.027 4.6784c-0.39475 0.07685-0.68766 0.40944-0.71076 0.80849l-1.4782 24.805c-0.0347 0.58371 0.50497 1.0372 1.0792 0.90602l6.6886-1.5338c0.62676-0.14383 1.1916 0.40419 1.0635 1.0299l-1.9874 9.6702c-0.13438 0.65091 0.48084 1.2073 1.1202 1.0142l4.1322-1.2472c0.64041-0.19317 1.2556 0.36535 1.1202 1.0162l-3.158 15.191c-0.19842 0.95011 1.074 1.4677 1.6042 0.653l0.35485-0.54382 19.578-38.827c0.32755-0.64985-0.23727-1.391-0.95641-1.2535l-6.8849 1.3207c-0.6467 0.12389-1.1979-0.47453-1.0152-1.1034l4.4944-15.482c0.18266-0.63012-0.36955-1.2295-1.0173-1.1034z" fill="url(#linearGradient880)" stroke-width="1.0498"/>
|
|
35
|
+
<rect x="3" y="3" width="169" height="169" rx="84.5" stroke="url(#paint2_linear)" stroke-width="6" style="mix-blend-mode:soft-light"/>
|
|
36
|
+
</svg>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// package.json
|
|
2
|
+
var name = "@batijs/solid";
|
|
3
|
+
var version = "0.0.3";
|
|
4
|
+
var description = "";
|
|
5
|
+
var type = "module";
|
|
6
|
+
var scripts = {
|
|
7
|
+
build: "tsup"
|
|
8
|
+
};
|
|
9
|
+
var keywords = [];
|
|
10
|
+
var author = "";
|
|
11
|
+
var license = "MIT";
|
|
12
|
+
var devDependencies = {
|
|
13
|
+
"@types/node": "^16.18.24",
|
|
14
|
+
"cross-fetch": "^3.1.5",
|
|
15
|
+
"solid-js": "^1.7.3",
|
|
16
|
+
solide: "^0.0.2",
|
|
17
|
+
"@batijs/tsup": "workspace:*",
|
|
18
|
+
typescript: "^5.0.4",
|
|
19
|
+
vite: "^4.3.2",
|
|
20
|
+
"vite-plugin-solid": "^2.7.0",
|
|
21
|
+
"vite-plugin-ssr": "^0.4.117"
|
|
22
|
+
};
|
|
23
|
+
var dependencies = {
|
|
24
|
+
"@batijs/core": "workspace:*"
|
|
25
|
+
};
|
|
26
|
+
var exports = {
|
|
27
|
+
".": "./dist/index.js",
|
|
28
|
+
"./files": "./dist/index.js"
|
|
29
|
+
};
|
|
30
|
+
var typesVersions = {
|
|
31
|
+
"*": {
|
|
32
|
+
".": [
|
|
33
|
+
"./dist/index.d.ts"
|
|
34
|
+
],
|
|
35
|
+
files: [
|
|
36
|
+
"./dist/index.d.ts"
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
var files = [
|
|
41
|
+
"dist/"
|
|
42
|
+
];
|
|
43
|
+
var bati = {
|
|
44
|
+
flag: "solid",
|
|
45
|
+
boilerplate: "./dist/files"
|
|
46
|
+
};
|
|
47
|
+
var package_default = {
|
|
48
|
+
name,
|
|
49
|
+
version,
|
|
50
|
+
description,
|
|
51
|
+
type,
|
|
52
|
+
scripts,
|
|
53
|
+
keywords,
|
|
54
|
+
author,
|
|
55
|
+
license,
|
|
56
|
+
devDependencies,
|
|
57
|
+
dependencies,
|
|
58
|
+
exports,
|
|
59
|
+
typesVersions,
|
|
60
|
+
files,
|
|
61
|
+
bati
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
author,
|
|
65
|
+
bati,
|
|
66
|
+
package_default as default,
|
|
67
|
+
dependencies,
|
|
68
|
+
description,
|
|
69
|
+
devDependencies,
|
|
70
|
+
exports,
|
|
71
|
+
files,
|
|
72
|
+
keywords,
|
|
73
|
+
license,
|
|
74
|
+
name,
|
|
75
|
+
scripts,
|
|
76
|
+
type,
|
|
77
|
+
typesVersions,
|
|
78
|
+
version
|
|
79
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** @jsxImportSource solid-js */
|
|
2
|
+
|
|
3
|
+
import { createMemo } from "solid-js";
|
|
4
|
+
import { usePageContext } from "solide/usePageContext";
|
|
5
|
+
|
|
6
|
+
export function Link(props: { href: string; children: string }) {
|
|
7
|
+
const pageContext = usePageContext();
|
|
8
|
+
const isActive = createMemo(() =>
|
|
9
|
+
props.href === "/" ? pageContext.urlPathname === props.href : pageContext.urlPathname.startsWith(props.href)
|
|
10
|
+
);
|
|
11
|
+
return (
|
|
12
|
+
<a href={props.href} class={isActive() ? "is-active" : undefined}>
|
|
13
|
+
{props.children}
|
|
14
|
+
</a>
|
|
15
|
+
);
|
|
16
|
+
}
|