revojs 0.1.19 → 0.1.20

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.
@@ -45,12 +45,12 @@ var Radix = class {
45
45
  }
46
46
  };
47
47
  var Router = class extends Radix {
48
- fetch(scope, next) {
48
+ fetch(scope) {
49
49
  const { request } = useServer(scope);
50
50
  const { pathname } = useUrl(scope);
51
51
  const context = {
52
52
  route: this.rootNode,
53
- segments: (request.method.toUpperCase() + pathname).split("/"),
53
+ segments: pathname.substring(1).split("/").concat(request.method.toLowerCase()),
54
54
  parameters: {}
55
55
  };
56
56
  const invoke$1 = (node, index) => {
@@ -71,7 +71,7 @@ var Router = class extends Radix {
71
71
  if (node.children[WILDCARD]) {
72
72
  const wildcardNode = node.children[WILDCARD];
73
73
  context.parameters[wildcardNode.parameter] = segment;
74
- return wildcardNode.value ?? invoke$1(wildcardNode, segment.length);
74
+ return wildcardNode.value ?? invoke$1(wildcardNode, index + 1);
75
75
  }
76
76
  };
77
77
  const route = invoke$1(this.rootNode, 0);
@@ -79,7 +79,7 @@ var Router = class extends Radix {
79
79
  scope.setContext(ROUTER_CONTEXT, context);
80
80
  return route.fetch(scope);
81
81
  }
82
- return next?.();
82
+ throw sendText(scope, "NOT_FOUND", { status: 404 });
83
83
  }
84
84
  };
85
85
  function defineRoute(route) {
@@ -88,9 +88,6 @@ function defineRoute(route) {
88
88
  function defineMiddleware(middleware) {
89
89
  return middleware;
90
90
  }
91
- function defineException(exception) {
92
- return exception;
93
- }
94
91
  function useRouter(scope) {
95
92
  return scope.getContext(ROUTER_CONTEXT);
96
93
  }
@@ -210,9 +207,9 @@ function mimeType(file) {
210
207
  return mimeTypes[extension ?? ""] ?? "text/plain";
211
208
  }
212
209
  function toRoutePath(path) {
213
- const result = ("/" + path).replaceAll(/\[\.\.\.(.*?)\]/g, (_, value) => WILDCARD + value).replaceAll(/\[(.*?)\]/g, (_, value) => PARAMETER + value).split("/");
214
- const properties = result.pop()?.toUpperCase().split(".") ?? [];
215
- return [result.join("/"), ...properties];
210
+ const result = path.replaceAll(/\[\.\.\.(.*?)\]/g, (_, value) => WILDCARD + value).replaceAll(/\[(.*?)\]/g, (_, value) => PARAMETER + value).split("/");
211
+ const properties = result.pop()?.toLocaleLowerCase().replaceAll("index", "").split(".").slice(0, -1).filter(Boolean) ?? [];
212
+ return result.concat(properties).join("/");
216
213
  }
217
214
  async function invoke(scope, pipeline, index = 0) {
218
215
  return await pipeline.at(index)?.fetch(scope, async () => await invoke(scope, pipeline, index + 1));
@@ -220,35 +217,18 @@ async function invoke(scope, pipeline, index = 0) {
220
217
  async function createServer() {
221
218
  const router = new Router();
222
219
  const middlewares = new Array();
223
- const assets = await import("#virtual/assets").then((module) => Object.entries(module.default));
224
- for (const [path, asset] of assets) router.use(`GET/${path}`, defineRoute({ async fetch(scope) {
225
- const { response } = useServer(scope);
226
- response.headers.set("Content-Type", mimeType(path));
227
- return new Response(asset, response);
228
- } }));
229
220
  const routes = await import("#virtual/routes").then((module) => Object.entries(module.default));
230
- for (const [path, route] of routes) {
231
- const [name, method] = toRoutePath(path);
232
- router.use(method?.toUpperCase() + name, route);
233
- }
234
- const exceptions = await import("#virtual/exceptions").then((module) => Object.values(module.default));
235
- middlewares.push(defineMiddleware({ async fetch(scope, next) {
236
- try {
237
- return await next?.();
238
- } catch (value) {
239
- for (const exception of exceptions) {
240
- const result = exception.fetch(scope, value);
241
- if (result) return result;
242
- }
243
- if (value instanceof Response) return value;
244
- }
245
- } }));
221
+ for (const [path, route] of routes) router.use(toRoutePath(path), route);
246
222
  middlewares.push(router);
247
223
  return {
248
224
  router,
249
225
  middlewares,
250
226
  async fetch(scope) {
251
- return await invoke(scope, middlewares) ?? sendText(scope, "NOT_FOUND", { status: 404 });
227
+ try {
228
+ return await invoke(scope, middlewares);
229
+ } catch (value) {
230
+ if (value instanceof Response) return value;
231
+ }
252
232
  }
253
233
  };
254
234
  }
@@ -367,21 +347,10 @@ function mergeObjects(base, input) {
367
347
  function createApp(inputConfig) {
368
348
  let config = mergeObjects(inputConfig, {
369
349
  modules: [],
370
- sources: {
371
- assets: {
372
- match: "**/*",
373
- entries: ["./public"],
374
- resolve: (path) => path + "?raw"
375
- },
376
- routes: {
377
- match: "**/{get,head,post,put,delete,connect,options,trace,patch}.{js,ts}",
378
- entries: ["./routes"]
379
- },
380
- exceptions: {
381
- match: "**/*.{js,ts}",
382
- entries: ["./exceptions"]
383
- }
384
- },
350
+ sources: { routes: {
351
+ match: "**/*.{get,head,post,put,delete,connect,options,trace,patch}.{js,ts}",
352
+ entries: ["./routes"]
353
+ } },
385
354
  development: { middlewares: [] },
386
355
  build: { externals: [] }
387
356
  });
@@ -396,4 +365,4 @@ const SERVER = "ssr";
396
365
  const CLIENT = "client";
397
366
 
398
367
  //#endregion
399
- export { CLIENT, PARAMETER, ROUTER_CONTEXT, Radix, Router, SERVER, SERVER_CONTEXT, STATES, Scope, StopEvent, WILDCARD, createApp, createServer, defineContext, defineException, defineMiddleware, defineRoute, getState, invoke, isFailure, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery };
368
+ export { CLIENT, PARAMETER, ROUTER_CONTEXT, Radix, Router, SERVER, SERVER_CONTEXT, STATES, Scope, StopEvent, WILDCARD, createApp, createServer, defineContext, defineMiddleware, defineRoute, getState, invoke, isFailure, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery };
@@ -90,13 +90,10 @@ interface Route {
90
90
  interface Middleware {
91
91
  fetch: (scope: Scope, next?: () => Result) => Result;
92
92
  }
93
- interface Exception {
94
- fetch: (scope: Scope, exception: unknown) => Result;
95
- }
96
93
  interface Server {
97
94
  router: Router;
98
95
  middlewares: Array<Middleware>;
99
- fetch: (scope: Scope) => Promise<Response>;
96
+ fetch: (scope: Scope) => Result;
100
97
  }
101
98
  interface WildcardNode<T> {
102
99
  type: "WILDCARD";
@@ -121,11 +118,10 @@ declare class Radix<T> {
121
118
  use(path: string, value: T): Node<T>;
122
119
  }
123
120
  declare class Router extends Radix<Route> implements Middleware {
124
- fetch(scope: Scope, next?: () => Result): Result;
121
+ fetch(scope: Scope): Result;
125
122
  }
126
123
  declare function defineRoute<T extends Route>(route: T): T;
127
124
  declare function defineMiddleware<T extends Middleware>(middleware: T): T;
128
- declare function defineException<T extends Exception>(exception: T): T;
129
125
  declare function useRouter(scope: Scope): RouterContext;
130
126
  declare function useServer<T extends Context>(scope: Scope): ServerContext<T>;
131
127
  declare function useUrl(scope: Scope, base?: string): URL;
@@ -147,7 +143,7 @@ declare function sendRedirect(scope: Scope, path: string, config?: Mergeable<Res
147
143
  declare function sendBadRequest(scope: Scope, text: string, config?: Mergeable<ResponseConfig>): Response;
148
144
  declare function sendUnauthorized(scope: Scope, config?: Mergeable<ResponseConfig>): Response;
149
145
  declare function mimeType(file: string): MimeType;
150
- declare function toRoutePath(path: string): [string, ...Array<string>];
146
+ declare function toRoutePath(path: string): string;
151
147
  declare function invoke(scope: Scope, pipeline: Array<Middleware>, index?: number): Promise<Result>;
152
148
  declare function createServer(): Promise<Server>;
153
149
  declare const ROUTER_CONTEXT: Descriptor<RouterContext>;
@@ -179,7 +175,7 @@ interface Module {
179
175
  setup?: (app: App) => void | Promise<void>;
180
176
  }
181
177
  interface Source {
182
- match: string;
178
+ match: string | Array<string>;
183
179
  entries: Array<string>;
184
180
  resolve?: (path: string) => string;
185
181
  }
@@ -195,4 +191,4 @@ declare const CLIENT = "client";
195
191
  //#region src/client/index.d.ts
196
192
  declare function $fetch<T>(scope: Scope, input: string | URL, options?: RequestInit): Promise<T>;
197
193
  //#endregion
198
- export { $fetch, App, BuildConfig, CLIENT, Config, Context, CookieOptions, CookiePriority, CookieSameSite, Descriptor, DevelopmentConfig, Encoding, Environment, Exception, Failure, HttpMethod, InferInput, InferOutput, Issue, Mergeable, Middleware, MimeType, Module, Node, Output, PARAMETER, ParameterNode, PathNode, ROUTER_CONTEXT, Radix, ResponseConfig, Result, Route, Router, RouterContext, SERVER, SERVER_CONTEXT, STATES, Schema, Scope, Server, ServerContext, Source, States, StatusCode, StopEvent, Success, Virtual, WILDCARD, WildcardNode, createApp, createServer, defineContext, defineException, defineMiddleware, defineRoute, getState, invoke, isFailure, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery };
194
+ export { $fetch, App, BuildConfig, CLIENT, Config, Context, CookieOptions, CookiePriority, CookieSameSite, Descriptor, DevelopmentConfig, Encoding, Environment, Failure, HttpMethod, InferInput, InferOutput, Issue, Mergeable, Middleware, MimeType, Module, Node, Output, PARAMETER, ParameterNode, PathNode, ROUTER_CONTEXT, Radix, ResponseConfig, Result, Route, Router, RouterContext, SERVER, SERVER_CONTEXT, STATES, Schema, Scope, Server, ServerContext, Source, States, StatusCode, StopEvent, Success, Virtual, WILDCARD, WildcardNode, createApp, createServer, defineContext, defineMiddleware, defineRoute, getState, invoke, isFailure, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $fetch, App, BuildConfig, CLIENT, Config, Context, CookieOptions, CookiePriority, CookieSameSite, Descriptor, DevelopmentConfig, Encoding, Environment, Exception, Failure, HttpMethod, InferInput, InferOutput, Issue, Mergeable, Middleware, MimeType, Module, Node, Output, PARAMETER, ParameterNode, PathNode, ROUTER_CONTEXT, Radix, ResponseConfig, Result, Route, Router, RouterContext, SERVER, SERVER_CONTEXT, STATES, Schema, Scope, Server, ServerContext, Source, States, StatusCode, StopEvent, Success, Virtual, WILDCARD, WildcardNode, createApp, createServer, defineContext, defineException, defineMiddleware, defineRoute, getState, invoke, isFailure, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery } from "./index-nAhU8KOA.js";
2
- export { $fetch, App, BuildConfig, CLIENT, Config, Context, CookieOptions, CookiePriority, CookieSameSite, Descriptor, DevelopmentConfig, Encoding, Environment, Exception, Failure, HttpMethod, InferInput, InferOutput, Issue, Mergeable, Middleware, MimeType, Module, Node, Output, PARAMETER, ParameterNode, PathNode, ROUTER_CONTEXT, Radix, ResponseConfig, Result, Route, Router, RouterContext, SERVER, SERVER_CONTEXT, STATES, Schema, Scope, Server, ServerContext, Source, States, StatusCode, StopEvent, Success, Virtual, WILDCARD, WildcardNode, createApp, createServer, defineContext, defineException, defineMiddleware, defineRoute, getState, invoke, isFailure, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery };
1
+ import { $fetch, App, BuildConfig, CLIENT, Config, Context, CookieOptions, CookiePriority, CookieSameSite, Descriptor, DevelopmentConfig, Encoding, Environment, Failure, HttpMethod, InferInput, InferOutput, Issue, Mergeable, Middleware, MimeType, Module, Node, Output, PARAMETER, ParameterNode, PathNode, ROUTER_CONTEXT, Radix, ResponseConfig, Result, Route, Router, RouterContext, SERVER, SERVER_CONTEXT, STATES, Schema, Scope, Server, ServerContext, Source, States, StatusCode, StopEvent, Success, Virtual, WILDCARD, WildcardNode, createApp, createServer, defineContext, defineMiddleware, defineRoute, getState, invoke, isFailure, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery } from "./index-D-rKmbh3.js";
2
+ export { $fetch, App, BuildConfig, CLIENT, Config, Context, CookieOptions, CookiePriority, CookieSameSite, Descriptor, DevelopmentConfig, Encoding, Environment, Failure, HttpMethod, InferInput, InferOutput, Issue, Mergeable, Middleware, MimeType, Module, Node, Output, PARAMETER, ParameterNode, PathNode, ROUTER_CONTEXT, Radix, ResponseConfig, Result, Route, Router, RouterContext, SERVER, SERVER_CONTEXT, STATES, Schema, Scope, Server, ServerContext, Source, States, StatusCode, StopEvent, Success, Virtual, WILDCARD, WildcardNode, createApp, createServer, defineContext, defineMiddleware, defineRoute, getState, invoke, isFailure, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { CLIENT, PARAMETER, ROUTER_CONTEXT, Radix, Router, SERVER, SERVER_CONTEXT, STATES, Scope, StopEvent, WILDCARD, createApp, createServer, defineContext, defineException, defineMiddleware, defineRoute, getState, invoke, isFailure, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery } from "./app-D1k2p6G_.js";
1
+ import { CLIENT, PARAMETER, ROUTER_CONTEXT, Radix, Router, SERVER, SERVER_CONTEXT, STATES, Scope, StopEvent, WILDCARD, createApp, createServer, defineContext, defineMiddleware, defineRoute, getState, invoke, isFailure, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery } from "./app-C4yy27ko.js";
2
2
 
3
3
  //#region src/client/index.ts
4
4
  async function $fetch(scope, input, options) {
@@ -25,4 +25,4 @@ async function $fetch(scope, input, options) {
25
25
  }
26
26
 
27
27
  //#endregion
28
- export { $fetch, CLIENT, PARAMETER, ROUTER_CONTEXT, Radix, Router, SERVER, SERVER_CONTEXT, STATES, Scope, StopEvent, WILDCARD, createApp, createServer, defineContext, defineException, defineMiddleware, defineRoute, getState, invoke, isFailure, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery };
28
+ export { $fetch, CLIENT, PARAMETER, ROUTER_CONTEXT, Radix, Router, SERVER, SERVER_CONTEXT, STATES, Scope, StopEvent, WILDCARD, createApp, createServer, defineContext, defineMiddleware, defineRoute, getState, invoke, isFailure, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery };
@@ -0,0 +1,12 @@
1
+ import { App, Virtual } from "../index-D-rKmbh3.js";
2
+
3
+ //#region src/kit/index.d.ts
4
+ declare function useKit(app: App, source: string | URL): {
5
+ source: string;
6
+ toPath: (...paths: Array<string>) => string;
7
+ addVirtual: (name: string, virtual: Virtual) => void;
8
+ addAlias: (name: string, path: string) => void;
9
+ };
10
+ declare function addRoutes(app: App, path: string): void;
11
+ //#endregion
12
+ export { addRoutes, useKit };
@@ -0,0 +1,3 @@
1
+ import { addRoutes, useKit } from "../kit-Bzr1NqHb.js";
2
+
3
+ export { addRoutes, useKit };
@@ -0,0 +1,26 @@
1
+ import { dirname, join, posix, win32 } from "path";
2
+ import { fileURLToPath } from "url";
3
+
4
+ //#region src/kit/index.ts
5
+ function useKit(app, source) {
6
+ source = source.toString();
7
+ if (source.startsWith("file://")) source = dirname(fileURLToPath(source));
8
+ return {
9
+ source,
10
+ toPath: (...paths) => {
11
+ return join(source, ...paths).split(win32.sep).join(posix.sep);
12
+ },
13
+ addVirtual: (name, virtual) => {
14
+ app.virtuals["#virtual/" + name] = virtual;
15
+ },
16
+ addAlias: (name, path) => {
17
+ app.alias["#alias/" + name] = join(source, path).split(win32.sep).join(posix.sep);
18
+ }
19
+ };
20
+ }
21
+ function addRoutes(app, path) {
22
+ app.config.sources.routes?.entries.push(path);
23
+ }
24
+
25
+ //#endregion
26
+ export { addRoutes, useKit };
@@ -1,15 +1,7 @@
1
- import { App, Config, Mergeable, Virtual } from "../index-nAhU8KOA.js";
1
+ import { Config, Mergeable } from "../index-D-rKmbh3.js";
2
2
  import { Plugin } from "vite";
3
3
 
4
4
  //#region src/vite/index.d.ts
5
- declare function useKit(app: App, source: string | URL): {
6
- source: string;
7
- toPath: (...paths: Array<string>) => string;
8
- addVirtual: (name: string, virtual: Virtual) => void;
9
- addAlias: (name: string, path: string) => void;
10
- };
11
- declare function addRoutes(app: App, path: string): void;
12
- declare function addAssets(app: App, path: string): void;
13
5
  declare function revojs(config?: Mergeable<Config>): Array<Plugin>;
14
6
  //#endregion
15
- export { addAssets, addRoutes, revojs, useKit };
7
+ export { revojs };
@@ -1,11 +1,12 @@
1
- import { CLIENT, SERVER, SERVER_CONTEXT, Scope, createApp, invoke } from "../app-D1k2p6G_.js";
1
+ import { CLIENT, SERVER, SERVER_CONTEXT, Scope, createApp, invoke } from "../app-C4yy27ko.js";
2
+ import { useKit } from "../kit-Bzr1NqHb.js";
3
+ import { basename, dirname, isAbsolute, join, posix, relative, win32 } from "path";
2
4
  import { isRunnableDevEnvironment } from "vite";
3
5
  import { once } from "events";
4
6
  import { Readable, Stream } from "stream";
5
7
  import { existsSync, readFileSync } from "fs";
6
- import { basename, dirname, isAbsolute, join, posix, relative, win32 } from "path";
7
- import { fileURLToPath } from "url";
8
8
  import { globSync } from "tinyglobby";
9
+ import { rm } from "fs/promises";
9
10
 
10
11
  //#region src/vite/node/index.ts
11
12
  function splitSetCookieString(cookiesString) {
@@ -306,32 +307,10 @@ function virtuals(virtuals$1) {
306
307
  //#endregion
307
308
  //#region package.json
308
309
  var name = "revojs";
309
- var version = "0.1.19";
310
+ var version = "0.1.20";
310
311
 
311
312
  //#endregion
312
313
  //#region src/vite/index.ts
313
- function useKit(app, source) {
314
- source = source.toString();
315
- if (source.startsWith("file://")) source = dirname(fileURLToPath(source));
316
- return {
317
- source,
318
- toPath: (...paths) => {
319
- return join(source, ...paths).split(win32.sep).join(posix.sep);
320
- },
321
- addVirtual: (name$1, virtual) => {
322
- app.virtuals["#virtual/" + name$1] = virtual;
323
- },
324
- addAlias: (name$1, path) => {
325
- app.alias["#alias/" + name$1] = join(source, path).split(win32.sep).join(posix.sep);
326
- }
327
- };
328
- }
329
- function addRoutes(app, path) {
330
- app.config.sources.routes?.entries.push(path);
331
- }
332
- function addAssets(app, path) {
333
- app.config.sources.assets?.entries.push(path);
334
- }
335
314
  function revojs(config) {
336
315
  const app = createApp(config);
337
316
  return [
@@ -363,22 +342,32 @@ function revojs(config) {
363
342
  appType: "custom",
364
343
  optimizeDeps: { exclude: ["revojs"] },
365
344
  resolve: { alias: app.alias },
366
- build: { rollupOptions: { external: app.config.build.externals } },
367
- builder: { async buildApp(builder) {
368
- for (const key in builder.environments) {
369
- const environment = builder.environments[key];
370
- if (environment) await builder.build(environment);
345
+ build: {
346
+ emptyOutDir: false,
347
+ assetsInlineLimit: 4096 * 4,
348
+ rollupOptions: { external: app.config.build.externals }
349
+ },
350
+ builder: {
351
+ sharedConfigBuild: true,
352
+ async buildApp(builder) {
353
+ await rm("./dist", {
354
+ recursive: true,
355
+ force: true
356
+ });
357
+ for (const key in builder.environments) {
358
+ const environment = builder.environments[key];
359
+ if (environment) await builder.build(environment);
360
+ }
371
361
  }
372
- } },
362
+ },
373
363
  environments: {
374
364
  ...app.config.client && { [CLIENT]: {
375
365
  consumer: "client",
376
366
  resolve: { noExternal: true },
377
367
  build: {
378
368
  rollupOptions: { input: { index: app.config.client } },
379
- outDir: "./dist/client",
380
- copyPublicDir: true,
381
- emptyOutDir: true
369
+ outDir: "./dist/public",
370
+ copyPublicDir: true
382
371
  },
383
372
  define: {
384
373
  "import.meta.server": false,
@@ -394,9 +383,8 @@ function revojs(config) {
394
383
  },
395
384
  build: {
396
385
  rollupOptions: { input: { index: app.config.server } },
397
- outDir: "./dist/server",
398
- copyPublicDir: false,
399
- emptyOutDir: true
386
+ outDir: "./dist",
387
+ copyPublicDir: false
400
388
  },
401
389
  define: {
402
390
  "import.meta.server": true,
@@ -444,4 +432,4 @@ function revojs(config) {
444
432
  }
445
433
 
446
434
  //#endregion
447
- export { addAssets, addRoutes, revojs, useKit };
435
+ export { revojs };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "revojs",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
4
4
  "type": "module",
5
5
  "repository": "coverbase/revojs",
6
6
  "license": "MIT",
@@ -9,6 +9,10 @@
9
9
  "types": "./dist/index.d.ts",
10
10
  "import": "./dist/index.js"
11
11
  },
12
+ "./kit": {
13
+ "types": "./dist/kit/index.d.ts",
14
+ "import": "./dist/kit/index.js"
15
+ },
12
16
  "./vite": {
13
17
  "types": "./dist/vite/index.d.ts",
14
18
  "import": "./dist/vite/index.js"
@@ -12,12 +12,6 @@ declare module "#virtual/server" {
12
12
  export default server;
13
13
  }
14
14
 
15
- declare module "#virtual/assets" {
16
- const assets: Record<string, string>;
17
-
18
- export default assets;
19
- }
20
-
21
15
  declare module "#virtual/routes" {
22
16
  import type { Route } from "revojs";
23
17
 
@@ -26,14 +20,6 @@ declare module "#virtual/routes" {
26
20
  export default routes;
27
21
  }
28
22
 
29
- declare module "#virtual/exceptions" {
30
- import type { Exception } from "revojs";
31
-
32
- const exceptions: Record<string, Exception>;
33
-
34
- export default exceptions;
35
- }
36
-
37
23
  interface ImportMeta {
38
24
  readonly server: boolean;
39
25
  readonly client: boolean;