@lolyjs/core 0.1.0-alpha.1 → 0.1.0-alpha.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/README.md +18 -18
- package/dist/cli.cjs +2 -2
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
**A modern, production-ready React framework with file-based routing, SSR, SSG, and built-in security**
|
|
6
6
|
|
|
7
|
-
[](https://www.npmjs.com/package/@lolyjs/core)
|
|
8
8
|
[](https://opensource.org/licenses/ISC)
|
|
9
9
|
|
|
10
10
|
*Built with React 19, Express, Rspack, and TypeScript*
|
|
@@ -32,9 +32,9 @@ Loly is a full-stack React framework that combines the simplicity of file-based
|
|
|
32
32
|
### Installation
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
|
-
npm install @
|
|
35
|
+
npm install @lolyjs/core react react-dom
|
|
36
36
|
# or
|
|
37
|
-
pnpm add @
|
|
37
|
+
pnpm add @lolyjs/core react react-dom
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
### Create Your First App
|
|
@@ -99,7 +99,7 @@ Use `server.hook.ts` to fetch data on the server:
|
|
|
99
99
|
|
|
100
100
|
```tsx
|
|
101
101
|
// app/blog/[slug]/server.hook.ts
|
|
102
|
-
import type { ServerLoader } from "@
|
|
102
|
+
import type { ServerLoader } from "@lolyjs/core";
|
|
103
103
|
|
|
104
104
|
export const getServerSideProps: ServerLoader = async (ctx) => {
|
|
105
105
|
const { slug } = ctx.params;
|
|
@@ -194,7 +194,7 @@ Components using `usePageProps()` automatically update when you call `revalidate
|
|
|
194
194
|
### Server Loader
|
|
195
195
|
|
|
196
196
|
```tsx
|
|
197
|
-
import type { ServerLoader } from "@
|
|
197
|
+
import type { ServerLoader } from "@lolyjs/core";
|
|
198
198
|
|
|
199
199
|
export const getServerSideProps: ServerLoader = async (ctx) => {
|
|
200
200
|
const { req, res, params, pathname, locals } = ctx;
|
|
@@ -227,7 +227,7 @@ export const getServerSideProps: ServerLoader = async (ctx) => {
|
|
|
227
227
|
### Static Site Generation
|
|
228
228
|
|
|
229
229
|
```tsx
|
|
230
|
-
import type { ServerLoader, GenerateStaticParams } from "@
|
|
230
|
+
import type { ServerLoader, GenerateStaticParams } from "@lolyjs/core";
|
|
231
231
|
|
|
232
232
|
export const dynamic = "force-static" as const;
|
|
233
233
|
|
|
@@ -246,8 +246,8 @@ export const getServerSideProps: ServerLoader = async (ctx) => {
|
|
|
246
246
|
### API Routes
|
|
247
247
|
|
|
248
248
|
```tsx
|
|
249
|
-
import type { ApiContext } from "@
|
|
250
|
-
import { validate } from "@
|
|
249
|
+
import type { ApiContext } from "@lolyjs/core";
|
|
250
|
+
import { validate } from "@lolyjs/core";
|
|
251
251
|
import { z } from "zod";
|
|
252
252
|
|
|
253
253
|
const schema = z.object({
|
|
@@ -270,7 +270,7 @@ export async function POST(ctx: ApiContext) {
|
|
|
270
270
|
### Middleware
|
|
271
271
|
|
|
272
272
|
```tsx
|
|
273
|
-
import type { RouteMiddleware } from "@
|
|
273
|
+
import type { RouteMiddleware } from "@lolyjs/core";
|
|
274
274
|
|
|
275
275
|
export const requireAuth: RouteMiddleware = async (ctx, next) => {
|
|
276
276
|
const user = await getUser(ctx.req);
|
|
@@ -439,7 +439,7 @@ export default function RootLayout({ children, theme }) {
|
|
|
439
439
|
### Validation & Sanitization
|
|
440
440
|
|
|
441
441
|
```tsx
|
|
442
|
-
import { validate, safeValidate, sanitizeString } from "@
|
|
442
|
+
import { validate, safeValidate, sanitizeString } from "@lolyjs/core";
|
|
443
443
|
import { z } from "zod";
|
|
444
444
|
|
|
445
445
|
const schema = z.object({
|
|
@@ -463,7 +463,7 @@ const clean = sanitizeString(userInput);
|
|
|
463
463
|
### Logging
|
|
464
464
|
|
|
465
465
|
```tsx
|
|
466
|
-
import { getRequestLogger, createModuleLogger } from "@
|
|
466
|
+
import { getRequestLogger, createModuleLogger } from "@lolyjs/core";
|
|
467
467
|
|
|
468
468
|
// In server hooks or API routes
|
|
469
469
|
export const getServerSideProps: ServerLoader = async (ctx) => {
|
|
@@ -491,7 +491,7 @@ import type {
|
|
|
491
491
|
ApiContext,
|
|
492
492
|
RouteMiddleware,
|
|
493
493
|
ApiMiddleware,
|
|
494
|
-
} from "@
|
|
494
|
+
} from "@lolyjs/core";
|
|
495
495
|
|
|
496
496
|
// Fully typed server loader
|
|
497
497
|
export const getServerSideProps: ServerLoader = async (ctx) => {
|
|
@@ -552,7 +552,7 @@ loly start [--port 3000] [--appDir app]
|
|
|
552
552
|
|
|
553
553
|
```tsx
|
|
554
554
|
// Server
|
|
555
|
-
import { startDevServer, startProdServer, buildApp } from "@
|
|
555
|
+
import { startDevServer, startProdServer, buildApp } from "@lolyjs/core";
|
|
556
556
|
|
|
557
557
|
// Types
|
|
558
558
|
import type {
|
|
@@ -562,17 +562,17 @@ import type {
|
|
|
562
562
|
RouteMiddleware,
|
|
563
563
|
ApiMiddleware,
|
|
564
564
|
GenerateStaticParams,
|
|
565
|
-
} from "@
|
|
565
|
+
} from "@lolyjs/core";
|
|
566
566
|
|
|
567
567
|
// Validation
|
|
568
|
-
import { validate, safeValidate, ValidationError } from "@
|
|
568
|
+
import { validate, safeValidate, ValidationError } from "@lolyjs/core";
|
|
569
569
|
|
|
570
570
|
// Security
|
|
571
|
-
import { sanitizeString, sanitizeObject } from "@
|
|
572
|
-
import { strictRateLimiter, lenientRateLimiter } from "@
|
|
571
|
+
import { sanitizeString, sanitizeObject } from "@lolyjs/core";
|
|
572
|
+
import { strictRateLimiter, lenientRateLimiter } from "@lolyjs/core";
|
|
573
573
|
|
|
574
574
|
// Logging
|
|
575
|
-
import { logger, createModuleLogger, getRequestLogger } from "@
|
|
575
|
+
import { logger, createModuleLogger, getRequestLogger } from "@lolyjs/core";
|
|
576
576
|
|
|
577
577
|
// Client
|
|
578
578
|
import { Link } from "@lolyjs/core/components";
|
package/dist/cli.cjs
CHANGED
|
@@ -1610,7 +1610,7 @@ async function renderStaticRoute(projectRoot, ssgOutDir, route, urlPath, params)
|
|
|
1610
1610
|
initialData,
|
|
1611
1611
|
meta: loaderResult.metadata,
|
|
1612
1612
|
titleFallback: "My Framework Dev",
|
|
1613
|
-
descriptionFallback: "Static page generated by @
|
|
1613
|
+
descriptionFallback: "Static page generated by @lolyjs/core.",
|
|
1614
1614
|
chunkHref,
|
|
1615
1615
|
clientJsPath,
|
|
1616
1616
|
clientCssPath
|
|
@@ -3953,7 +3953,7 @@ function createLogger(options = {}) {
|
|
|
3953
3953
|
const baseConfig = {
|
|
3954
3954
|
level,
|
|
3955
3955
|
base: {
|
|
3956
|
-
name: "@
|
|
3956
|
+
name: "@lolyjs/core",
|
|
3957
3957
|
env: process.env.NODE_ENV || "development"
|
|
3958
3958
|
},
|
|
3959
3959
|
timestamp: import_pino.default.stdTimeFunctions.isoTime,
|