@lolyjs/core 0.1.0-alpha.6 → 0.1.0-alpha.8
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/cli.cjs.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +22 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +39 -2
- package/dist/index.d.ts +39 -2
- package/dist/index.js +22 -1
- package/dist/index.js.map +1 -1
- package/dist/runtime.cjs +46 -23
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.mts +49 -3
- package/dist/runtime.d.ts +49 -3
- package/dist/runtime.js +46 -19
- package/dist/runtime.js.map +1 -1
- package/package.json +4 -2
- package/dist/bootstrap-BiCQmSkx.d.mts +0 -50
- package/dist/bootstrap-BiCQmSkx.d.ts +0 -50
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import http from 'http';
|
|
2
2
|
import { Request, Response } from 'express';
|
|
3
3
|
import { Socket, Server } from 'socket.io';
|
|
4
|
-
export { c as bootstrapClient } from './bootstrap-BiCQmSkx.mjs';
|
|
5
4
|
import { ZodSchema, z } from 'zod';
|
|
6
5
|
import * as express_rate_limit from 'express-rate-limit';
|
|
7
6
|
import pino, { Logger as Logger$1 } from 'pino';
|
|
@@ -216,6 +215,44 @@ interface BuildAppOptions {
|
|
|
216
215
|
}
|
|
217
216
|
declare function buildApp(options?: BuildAppOptions): Promise<void>;
|
|
218
217
|
|
|
218
|
+
declare const WINDOW_DATA_KEY = "__FW_DATA__";
|
|
219
|
+
|
|
220
|
+
type InitialData = {
|
|
221
|
+
pathname: string;
|
|
222
|
+
params: Record<string, string>;
|
|
223
|
+
props: Record<string, any>;
|
|
224
|
+
metadata?: {
|
|
225
|
+
title?: string;
|
|
226
|
+
description?: string;
|
|
227
|
+
} | null;
|
|
228
|
+
notFound?: boolean;
|
|
229
|
+
error?: boolean;
|
|
230
|
+
theme?: string;
|
|
231
|
+
};
|
|
232
|
+
declare global {
|
|
233
|
+
interface Window {
|
|
234
|
+
[WINDOW_DATA_KEY]?: InitialData;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
type ClientLoadedComponents = {
|
|
238
|
+
Page: React.ComponentType<any>;
|
|
239
|
+
layouts: React.ComponentType<any>[];
|
|
240
|
+
};
|
|
241
|
+
type ClientRouteLoaded = {
|
|
242
|
+
pattern: string;
|
|
243
|
+
paramNames: string[];
|
|
244
|
+
load: () => Promise<ClientLoadedComponents>;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Bootstraps the client-side application.
|
|
249
|
+
*
|
|
250
|
+
* @param routes - Array of client routes
|
|
251
|
+
* @param notFoundRoute - Not-found route definition
|
|
252
|
+
* @param errorRoute - Error route definition
|
|
253
|
+
*/
|
|
254
|
+
declare function bootstrapClient(routes: ClientRouteLoaded[], notFoundRoute: ClientRouteLoaded | null, errorRoute?: ClientRouteLoaded | null): void;
|
|
255
|
+
|
|
219
256
|
declare function withCache(fn: any, options: any): any;
|
|
220
257
|
|
|
221
258
|
/**
|
|
@@ -442,4 +479,4 @@ declare function requestLoggerMiddleware(options?: {
|
|
|
442
479
|
*/
|
|
443
480
|
declare function getRequestLogger(req: Request): Logger;
|
|
444
481
|
|
|
445
|
-
export { type ApiContext, type ApiMiddleware, DEFAULT_CONFIG, type FrameworkConfig, type GenerateStaticParams, type InitServerData, type LoaderResult, type LogLevel, Logger, type LoggerContext, type LoggerOptions, type MetadataLoader, type RouteMiddleware, type ServerConfig, type ServerContext, type ServerLoader, ValidationError, type WssContext, buildApp, commonSchemas, createModuleLogger, createRateLimiter, defaultRateLimiter, generateRequestId, getAppDir, getBuildDir, getLogger, getRequestLogger, getStaticDir, lenientRateLimiter, loadConfig, logger, requestLoggerMiddleware, resetLogger, safeValidate, sanitizeObject, sanitizeParams, sanitizeQuery, sanitizeString, setLogger, startDevServer, startProdServer, strictRateLimiter, validate, withCache };
|
|
482
|
+
export { type ApiContext, type ApiMiddleware, DEFAULT_CONFIG, type FrameworkConfig, type GenerateStaticParams, type InitServerData, type LoaderResult, type LogLevel, Logger, type LoggerContext, type LoggerOptions, type MetadataLoader, type RouteMiddleware, type ServerConfig, type ServerContext, type ServerLoader, ValidationError, type WssContext, bootstrapClient, buildApp, commonSchemas, createModuleLogger, createRateLimiter, defaultRateLimiter, generateRequestId, getAppDir, getBuildDir, getLogger, getRequestLogger, getStaticDir, lenientRateLimiter, loadConfig, logger, requestLoggerMiddleware, resetLogger, safeValidate, sanitizeObject, sanitizeParams, sanitizeQuery, sanitizeString, setLogger, startDevServer, startProdServer, strictRateLimiter, validate, withCache };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import http from 'http';
|
|
2
2
|
import { Request, Response } from 'express';
|
|
3
3
|
import { Socket, Server } from 'socket.io';
|
|
4
|
-
export { c as bootstrapClient } from './bootstrap-BiCQmSkx.js';
|
|
5
4
|
import { ZodSchema, z } from 'zod';
|
|
6
5
|
import * as express_rate_limit from 'express-rate-limit';
|
|
7
6
|
import pino, { Logger as Logger$1 } from 'pino';
|
|
@@ -216,6 +215,44 @@ interface BuildAppOptions {
|
|
|
216
215
|
}
|
|
217
216
|
declare function buildApp(options?: BuildAppOptions): Promise<void>;
|
|
218
217
|
|
|
218
|
+
declare const WINDOW_DATA_KEY = "__FW_DATA__";
|
|
219
|
+
|
|
220
|
+
type InitialData = {
|
|
221
|
+
pathname: string;
|
|
222
|
+
params: Record<string, string>;
|
|
223
|
+
props: Record<string, any>;
|
|
224
|
+
metadata?: {
|
|
225
|
+
title?: string;
|
|
226
|
+
description?: string;
|
|
227
|
+
} | null;
|
|
228
|
+
notFound?: boolean;
|
|
229
|
+
error?: boolean;
|
|
230
|
+
theme?: string;
|
|
231
|
+
};
|
|
232
|
+
declare global {
|
|
233
|
+
interface Window {
|
|
234
|
+
[WINDOW_DATA_KEY]?: InitialData;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
type ClientLoadedComponents = {
|
|
238
|
+
Page: React.ComponentType<any>;
|
|
239
|
+
layouts: React.ComponentType<any>[];
|
|
240
|
+
};
|
|
241
|
+
type ClientRouteLoaded = {
|
|
242
|
+
pattern: string;
|
|
243
|
+
paramNames: string[];
|
|
244
|
+
load: () => Promise<ClientLoadedComponents>;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Bootstraps the client-side application.
|
|
249
|
+
*
|
|
250
|
+
* @param routes - Array of client routes
|
|
251
|
+
* @param notFoundRoute - Not-found route definition
|
|
252
|
+
* @param errorRoute - Error route definition
|
|
253
|
+
*/
|
|
254
|
+
declare function bootstrapClient(routes: ClientRouteLoaded[], notFoundRoute: ClientRouteLoaded | null, errorRoute?: ClientRouteLoaded | null): void;
|
|
255
|
+
|
|
219
256
|
declare function withCache(fn: any, options: any): any;
|
|
220
257
|
|
|
221
258
|
/**
|
|
@@ -442,4 +479,4 @@ declare function requestLoggerMiddleware(options?: {
|
|
|
442
479
|
*/
|
|
443
480
|
declare function getRequestLogger(req: Request): Logger;
|
|
444
481
|
|
|
445
|
-
export { type ApiContext, type ApiMiddleware, DEFAULT_CONFIG, type FrameworkConfig, type GenerateStaticParams, type InitServerData, type LoaderResult, type LogLevel, Logger, type LoggerContext, type LoggerOptions, type MetadataLoader, type RouteMiddleware, type ServerConfig, type ServerContext, type ServerLoader, ValidationError, type WssContext, buildApp, commonSchemas, createModuleLogger, createRateLimiter, defaultRateLimiter, generateRequestId, getAppDir, getBuildDir, getLogger, getRequestLogger, getStaticDir, lenientRateLimiter, loadConfig, logger, requestLoggerMiddleware, resetLogger, safeValidate, sanitizeObject, sanitizeParams, sanitizeQuery, sanitizeString, setLogger, startDevServer, startProdServer, strictRateLimiter, validate, withCache };
|
|
482
|
+
export { type ApiContext, type ApiMiddleware, DEFAULT_CONFIG, type FrameworkConfig, type GenerateStaticParams, type InitServerData, type LoaderResult, type LogLevel, Logger, type LoggerContext, type LoggerOptions, type MetadataLoader, type RouteMiddleware, type ServerConfig, type ServerContext, type ServerLoader, ValidationError, type WssContext, bootstrapClient, buildApp, commonSchemas, createModuleLogger, createRateLimiter, defaultRateLimiter, generateRequestId, getAppDir, getBuildDir, getLogger, getRequestLogger, getStaticDir, lenientRateLimiter, loadConfig, logger, requestLoggerMiddleware, resetLogger, safeValidate, sanitizeObject, sanitizeParams, sanitizeQuery, sanitizeString, setLogger, startDevServer, startProdServer, strictRateLimiter, validate, withCache };
|
package/dist/index.js
CHANGED
|
@@ -5099,6 +5099,11 @@ import { useEffect, useState, useRef } from "react";
|
|
|
5099
5099
|
// modules/runtime/client/RouterView.tsx
|
|
5100
5100
|
import { jsx } from "react/jsx-runtime";
|
|
5101
5101
|
function RouterView({ state }) {
|
|
5102
|
+
console.log("[loly:RouterView] Rendering", {
|
|
5103
|
+
url: state.url,
|
|
5104
|
+
hasRoute: !!state.route,
|
|
5105
|
+
hasComponents: !!state.components
|
|
5106
|
+
});
|
|
5102
5107
|
if (!state.route) {
|
|
5103
5108
|
if (state.components === null) {
|
|
5104
5109
|
return null;
|
|
@@ -5110,6 +5115,11 @@ function RouterView({ state }) {
|
|
|
5110
5115
|
}
|
|
5111
5116
|
const { Page, layouts } = state.components;
|
|
5112
5117
|
const { params, props } = state;
|
|
5118
|
+
console.log("[loly:RouterView] Creating page element", {
|
|
5119
|
+
hasPage: !!Page,
|
|
5120
|
+
layoutsCount: layouts.length,
|
|
5121
|
+
paramsKeys: Object.keys(params)
|
|
5122
|
+
});
|
|
5113
5123
|
let element = /* @__PURE__ */ jsx(Page, { params, ...props });
|
|
5114
5124
|
const layoutChain = layouts.slice().reverse();
|
|
5115
5125
|
for (const Layout of layoutChain) {
|
|
@@ -5580,6 +5590,10 @@ function AppShell({
|
|
|
5580
5590
|
notFoundRoute,
|
|
5581
5591
|
errorRoute
|
|
5582
5592
|
}) {
|
|
5593
|
+
console.log("[loly:AppShell] Component rendering", {
|
|
5594
|
+
url: initialState.url,
|
|
5595
|
+
hasRoute: !!initialState.route
|
|
5596
|
+
});
|
|
5583
5597
|
const [state, setState] = useState(initialState);
|
|
5584
5598
|
const handlersRef = useRef({
|
|
5585
5599
|
setState,
|
|
@@ -5588,6 +5602,11 @@ function AppShell({
|
|
|
5588
5602
|
errorRoute
|
|
5589
5603
|
});
|
|
5590
5604
|
useEffect(() => {
|
|
5605
|
+
console.log("[loly:AppShell] Updating handlersRef", {
|
|
5606
|
+
routesCount: routes.length,
|
|
5607
|
+
hasNotFound: !!notFoundRoute,
|
|
5608
|
+
hasError: !!errorRoute
|
|
5609
|
+
});
|
|
5591
5610
|
handlersRef.current = {
|
|
5592
5611
|
setState,
|
|
5593
5612
|
routes,
|
|
@@ -5596,7 +5615,8 @@ function AppShell({
|
|
|
5596
5615
|
};
|
|
5597
5616
|
}, [routes, notFoundRoute, errorRoute]);
|
|
5598
5617
|
useEffect(() => {
|
|
5599
|
-
|
|
5618
|
+
const effectId = Math.random().toString(36).substring(7);
|
|
5619
|
+
console.log("[loly:AppShell] Setting up event listeners", { effectId });
|
|
5600
5620
|
let isMounted = true;
|
|
5601
5621
|
let listenerCount = 0;
|
|
5602
5622
|
async function handleNavigate(nextUrl, options) {
|
|
@@ -5619,6 +5639,7 @@ function AppShell({
|
|
|
5619
5639
|
});
|
|
5620
5640
|
return () => {
|
|
5621
5641
|
console.log("[loly:AppShell] Cleaning up event listeners", {
|
|
5642
|
+
effectId,
|
|
5622
5643
|
wasMounted: isMounted,
|
|
5623
5644
|
listenersToRemove: listenerCount
|
|
5624
5645
|
});
|