revojs 0.1.22 → 0.1.23

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.
@@ -109,10 +109,7 @@ function useQuery(scope, schema) {
109
109
  }
110
110
  function withQuery(input, query) {
111
111
  const url = new URL(input);
112
- for (const name in query) {
113
- const value = query[name];
114
- if (value) url.searchParams.set(name, value);
115
- }
112
+ for (const name in query) url.searchParams.set(name, query[name]);
116
113
  return url.href;
117
114
  }
118
115
  function useCookies(scope, schema) {
@@ -230,6 +227,7 @@ async function createServer() {
230
227
  return await invoke(scope, middlewares);
231
228
  } catch (value) {
232
229
  if (value instanceof Response) return value;
230
+ throw value;
233
231
  }
234
232
  }
235
233
  };
@@ -289,13 +287,9 @@ const isClient = import.meta.client ?? globalThis?.import?.meta?.client;
289
287
 
290
288
  //#endregion
291
289
  //#region src/shared/index.ts
292
- var Scope = class {
293
- parentScope;
294
- context;
290
+ var Hookable = class {
295
291
  hooks;
296
- constructor(parentScope) {
297
- this.parentScope = parentScope;
298
- this.context = {};
292
+ constructor() {
299
293
  this.hooks = {};
300
294
  }
301
295
  registerHook(name, invoke$1) {
@@ -313,6 +307,15 @@ var Scope = class {
313
307
  for (const invoke$1 of this.hooks[name] ?? []) results.push(await invoke$1(...inputs));
314
308
  return results;
315
309
  }
310
+ };
311
+ var Scope = class extends Hookable {
312
+ parentScope;
313
+ context;
314
+ constructor(parentScope) {
315
+ super();
316
+ this.parentScope = parentScope;
317
+ this.context = {};
318
+ }
316
319
  getContext(input) {
317
320
  let scope = this;
318
321
  while (scope) {
@@ -336,7 +339,7 @@ function isFailure(result) {
336
339
  }
337
340
  function parseSchema(scope, schema, value) {
338
341
  const result = schema["~standard"].validate(value);
339
- if (isFailure(result)) throw sendBadRequest(scope, result.issues.map((issue) => issue.message).join(", "));
342
+ if (isFailure(result)) throw sendJson(scope, result, { status: 400 });
340
343
  return result.value;
341
344
  }
342
345
  function mergeObjects(base, input) {
@@ -355,25 +358,28 @@ function mergeObjects(base, input) {
355
358
 
356
359
  //#endregion
357
360
  //#region src/app/index.ts
358
- function createApp(inputConfig) {
359
- let config = mergeObjects(inputConfig, {
360
- modules: [],
361
- sources: { routes: {
362
- match: "**/*.{get,head,post,put,delete,connect,options,trace,patch}.{js,ts}",
363
- entries: ["./routes"]
364
- } },
365
- development: { middlewares: [] },
366
- build: { externals: [] }
367
- });
368
- for (const module of config.modules) config = mergeObjects(config, module.config);
369
- return {
370
- config,
371
- virtuals: {},
372
- alias: {}
373
- };
374
- }
361
+ var App = class extends Hookable {
362
+ config;
363
+ constructor(inputConfig) {
364
+ super();
365
+ this.config = mergeObjects(inputConfig, {
366
+ modules: [],
367
+ sources: { routes: {
368
+ match: "**/*.{get,head,post,put,delete,connect,options,trace,patch}.{js,ts}",
369
+ entries: ["./routes"]
370
+ } },
371
+ development: { middlewares: [] },
372
+ build: {
373
+ externals: [],
374
+ virtuals: {},
375
+ alias: {}
376
+ }
377
+ });
378
+ for (const module of this.config.modules) this.config = mergeObjects(this.config, module.config);
379
+ }
380
+ };
375
381
  const SERVER = "ssr";
376
382
  const CLIENT = "client";
377
383
 
378
384
  //#endregion
379
- export { CLIENT, PARAMETER, ROUTER_CONTEXT, Radix, Router, SERVER, SERVER_CONTEXT, STATES, Scope, WILDCARD, createApp, createServer, defineContext, defineHook, defineMiddleware, defineRoute, getState, invoke, isClient, isFailure, isServer, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery };
385
+ export { App, CLIENT, Hookable, PARAMETER, ROUTER_CONTEXT, Radix, Router, SERVER, SERVER_CONTEXT, STATES, Scope, WILDCARD, createServer, defineContext, defineHook, defineMiddleware, defineRoute, getState, invoke, isClient, isFailure, isServer, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery };
@@ -26,13 +26,16 @@ interface Schema<T = unknown, TOutput = T> {
26
26
  };
27
27
  };
28
28
  }
29
- declare class Scope {
30
- parentScope?: Scope;
31
- readonly context: Context;
32
- readonly hooks: Record<string, Array<Invoke>>;
33
- constructor(parentScope?: Scope);
29
+ declare class Hookable {
30
+ private readonly hooks;
31
+ constructor();
34
32
  registerHook<T extends Invoke>(name: Descriptor<T>, invoke: T): () => void;
35
33
  dispatchHook<T extends Invoke>(name: Descriptor<T>, ...inputs: Parameters<T>): Promise<Awaited<ReturnType<T>>[]>;
34
+ }
35
+ declare class Scope extends Hookable {
36
+ private parentScope?;
37
+ private readonly context;
38
+ constructor(parentScope?: Scope);
36
39
  getContext<T>(input: Descriptor<T>): T;
37
40
  setContext<T>(input: Descriptor<T>, value: T): void;
38
41
  }
@@ -158,6 +161,8 @@ interface DevelopmentConfig {
158
161
  }
159
162
  interface BuildConfig {
160
163
  externals: Array<string>;
164
+ virtuals: Record<string, Virtual>;
165
+ alias: Record<string, string>;
161
166
  }
162
167
  interface Config {
163
168
  modules: Array<Module>;
@@ -176,16 +181,14 @@ interface Source {
176
181
  entries: Array<string>;
177
182
  resolve?: (path: string) => string;
178
183
  }
179
- interface App {
184
+ declare class App extends Hookable {
180
185
  config: Config;
181
- virtuals: Record<string, Virtual>;
182
- alias: Record<string, string>;
186
+ constructor(inputConfig?: Mergeable<Config>);
183
187
  }
184
- declare function createApp(inputConfig?: Mergeable<Config>): App;
185
188
  declare const SERVER = "ssr";
186
189
  declare const CLIENT = "client";
187
190
  //#endregion
188
191
  //#region src/client/index.d.ts
189
192
  declare function $fetch<T>(scope: Scope, input: string | URL, options?: RequestInit): Promise<T>;
190
193
  //#endregion
191
- export { $fetch, App, BuildConfig, CLIENT, Config, Context, CookieOptions, CookiePriority, CookieSameSite, Descriptor, DevelopmentConfig, Encoding, Environment, Failure, HttpMethod, InferInput, InferOutput, Invoke, 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, Success, Virtual, WILDCARD, WildcardNode, createApp, createServer, defineContext, defineHook, defineMiddleware, defineRoute, getState, invoke, isClient, isFailure, isServer, 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, Hookable, HttpMethod, InferInput, InferOutput, Invoke, 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, Success, Virtual, WILDCARD, WildcardNode, createServer, defineContext, defineHook, defineMiddleware, defineRoute, getState, invoke, isClient, isFailure, isServer, 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, Failure, HttpMethod, InferInput, InferOutput, Invoke, 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, Success, Virtual, WILDCARD, WildcardNode, createApp, createServer, defineContext, defineHook, defineMiddleware, defineRoute, getState, invoke, isClient, isFailure, isServer, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery } from "./index-CUwjaRno.js";
2
- export { $fetch, App, BuildConfig, CLIENT, Config, Context, CookieOptions, CookiePriority, CookieSameSite, Descriptor, DevelopmentConfig, Encoding, Environment, Failure, HttpMethod, InferInput, InferOutput, Invoke, 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, Success, Virtual, WILDCARD, WildcardNode, createApp, createServer, defineContext, defineHook, defineMiddleware, defineRoute, getState, invoke, isClient, isFailure, isServer, 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, Hookable, HttpMethod, InferInput, InferOutput, Invoke, 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, Success, Virtual, WILDCARD, WildcardNode, createServer, defineContext, defineHook, defineMiddleware, defineRoute, getState, invoke, isClient, isFailure, isServer, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery } from "./index-DSP2l2h5.js";
2
+ export { $fetch, App, BuildConfig, CLIENT, Config, Context, CookieOptions, CookiePriority, CookieSameSite, Descriptor, DevelopmentConfig, Encoding, Environment, Failure, Hookable, HttpMethod, InferInput, InferOutput, Invoke, 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, Success, Virtual, WILDCARD, WildcardNode, createServer, defineContext, defineHook, defineMiddleware, defineRoute, getState, invoke, isClient, isFailure, isServer, 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, WILDCARD, createApp, createServer, defineContext, defineHook, defineMiddleware, defineRoute, getState, invoke, isClient, isFailure, isServer, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery } from "./app-CZxSS8Ok.js";
1
+ import { App, CLIENT, Hookable, PARAMETER, ROUTER_CONTEXT, Radix, Router, SERVER, SERVER_CONTEXT, STATES, Scope, WILDCARD, createServer, defineContext, defineHook, defineMiddleware, defineRoute, getState, invoke, isClient, isFailure, isServer, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery } from "./app-COQSSDHs.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, WILDCARD, createApp, createServer, defineContext, defineHook, defineMiddleware, defineRoute, getState, invoke, isClient, isFailure, isServer, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery };
28
+ export { $fetch, App, CLIENT, Hookable, PARAMETER, ROUTER_CONTEXT, Radix, Router, SERVER, SERVER_CONTEXT, STATES, Scope, WILDCARD, createServer, defineContext, defineHook, defineMiddleware, defineRoute, getState, invoke, isClient, isFailure, isServer, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery };
@@ -1,12 +1,11 @@
1
- import { App, Virtual } from "../index-CUwjaRno.js";
1
+ import { App, Virtual } from "../index-DSP2l2h5.js";
2
2
 
3
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;
4
+ declare function useKit(source: string | URL): {
5
+ fromModule(...paths: Array<string>): string;
9
6
  };
7
+ declare function addAlias(app: App, name: string, path: string): void;
8
+ declare function addVirtual(app: App, name: string, virtual: Virtual): void;
10
9
  declare function addRoutes(app: App, path: string): void;
11
10
  //#endregion
12
- export { addRoutes, useKit };
11
+ export { addAlias, addRoutes, addVirtual, useKit };
package/dist/kit/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { addRoutes, useKit } from "../kit-Bzr1NqHb.js";
1
+ import { addAlias, addRoutes, addVirtual, useKit } from "../kit-CUuTaZz2.js";
2
2
 
3
- export { addRoutes, useKit };
3
+ export { addAlias, addRoutes, addVirtual, useKit };
@@ -0,0 +1,23 @@
1
+ import { dirname, join, posix, win32 } from "path";
2
+ import { fileURLToPath } from "url";
3
+
4
+ //#region src/kit/index.ts
5
+ function useKit(source) {
6
+ source = source.toString();
7
+ if (source.startsWith("file://")) source = dirname(fileURLToPath(source));
8
+ return { fromModule(...paths) {
9
+ return join(source, ...paths).split(win32.sep).join(posix.sep);
10
+ } };
11
+ }
12
+ function addAlias(app, name, path) {
13
+ app.config.build.alias["#alias/" + name] = path;
14
+ }
15
+ function addVirtual(app, name, virtual) {
16
+ app.config.build.virtuals["#virtual/" + name] = virtual;
17
+ }
18
+ function addRoutes(app, path) {
19
+ app.config.sources.routes?.entries.push(path);
20
+ }
21
+
22
+ //#endregion
23
+ export { addAlias, addRoutes, addVirtual, useKit };
@@ -1,4 +1,4 @@
1
- import { Config, Mergeable } from "../index-CUwjaRno.js";
1
+ import { Config, Mergeable } from "../index-DSP2l2h5.js";
2
2
  import { Plugin } from "vite";
3
3
 
4
4
  //#region src/vite/index.d.ts
@@ -1,6 +1,6 @@
1
- import { CLIENT, SERVER, SERVER_CONTEXT, Scope, createApp, invoke } from "../app-CZxSS8Ok.js";
2
- import { useKit } from "../kit-Bzr1NqHb.js";
3
- import { basename, dirname, isAbsolute, join, posix, relative, win32 } from "path";
1
+ import { App, CLIENT, SERVER, SERVER_CONTEXT, Scope, invoke } from "../app-COQSSDHs.js";
2
+ import { addVirtual } from "../kit-CUuTaZz2.js";
3
+ import { basename, dirname, isAbsolute, join, posix, relative, resolve, win32 } from "path";
4
4
  import { isRunnableDevEnvironment } from "vite";
5
5
  import { once } from "events";
6
6
  import { Readable, Stream } from "stream";
@@ -175,7 +175,7 @@ function client() {
175
175
  const path = key.substring(0, key.length - 7);
176
176
  if (bundle) for (const name$1 in bundle) {
177
177
  const file = bundle[name$1];
178
- if (file && file.type === "asset" && file.fileName === basename(path)) return file.source.toString();
178
+ if (file.type === "asset" && file.fileName === basename(path)) return file.source.toString();
179
179
  }
180
180
  return readFileSync(path, "utf-8");
181
181
  }
@@ -307,28 +307,27 @@ function virtuals(virtuals$1) {
307
307
  //#endregion
308
308
  //#region package.json
309
309
  var name = "revojs";
310
- var version = "0.1.22";
310
+ var version = "0.1.23";
311
311
 
312
312
  //#endregion
313
313
  //#region src/vite/index.ts
314
314
  function revojs(config) {
315
- const app = createApp(config);
315
+ const app = new App(config);
316
316
  return [
317
317
  {
318
318
  name,
319
319
  version,
320
320
  sharedDuringBuild: true,
321
321
  async config() {
322
- const { toPath, addVirtual } = useKit(app, process.cwd());
323
322
  for (const module of app.config.modules) await module.setup?.(app);
324
- if (app.config.client) addVirtual("client", () => `import client from "${app.config.client}?client"; export default client`);
325
- if (app.config.server) addVirtual("server", () => `import { createServer } from "revojs"; export default await createServer()`);
323
+ if (app.config.client) addVirtual(app, "client", () => `import client from "${app.config.client}?client"; export default client`);
324
+ if (app.config.server) addVirtual(app, "server", () => `import { createServer } from "revojs"; export default await createServer()`);
326
325
  for (const name$1 in app.config.sources) {
327
326
  const source = app.config.sources[name$1];
328
- if (source) addVirtual(name$1, () => {
327
+ addVirtual(app, name$1, () => {
329
328
  const entries = {};
330
329
  for (let path of source.entries) {
331
- path = isAbsolute(path) ? path : toPath(path);
330
+ path = isAbsolute(path) ? path : resolve(path);
332
331
  for (const asset of globSync(source.match, { cwd: path })) entries[asset] = join(path, asset).split(win32.sep).join(posix.sep);
333
332
  }
334
333
  const content = Object.values(entries).reduce((content$1, path, index) => content$1 + `import $${index} from "${source.resolve?.(path) ?? path}" \n`, "");
@@ -341,7 +340,7 @@ function revojs(config) {
341
340
  return {
342
341
  appType: "custom",
343
342
  optimizeDeps: { exclude: ["revojs"] },
344
- resolve: { alias: app.alias },
343
+ resolve: { alias: app.config.build.alias },
345
344
  build: {
346
345
  emptyOutDir: false,
347
346
  assetsInlineLimit: 4096 * 4,
@@ -356,7 +355,8 @@ function revojs(config) {
356
355
  });
357
356
  for (const key in builder.environments) {
358
357
  const environment = builder.environments[key];
359
- if (environment) await builder.build(environment);
358
+ await builder.build(environment);
359
+ if (environment.name === CLIENT && typeof environment.config.build.rollupOptions.input === "string") await rm(resolve(environment.config.build.outDir, basename(environment.config.build.rollupOptions.input)));
360
360
  }
361
361
  }
362
362
  },
@@ -365,7 +365,7 @@ function revojs(config) {
365
365
  consumer: "client",
366
366
  resolve: { noExternal: true },
367
367
  build: {
368
- rollupOptions: { input: { index: app.config.client } },
368
+ rollupOptions: { input: app.config.client },
369
369
  outDir: "./dist/public",
370
370
  copyPublicDir: true
371
371
  },
@@ -382,7 +382,7 @@ function revojs(config) {
382
382
  externalConditions: ["import"]
383
383
  },
384
384
  build: {
385
- rollupOptions: { input: { index: app.config.server } },
385
+ rollupOptions: { input: app.config.server },
386
386
  outDir: "./dist",
387
387
  copyPublicDir: false
388
388
  },
@@ -420,7 +420,7 @@ function revojs(config) {
420
420
  };
421
421
  }
422
422
  },
423
- virtuals(app.virtuals),
423
+ virtuals(app.config.build.virtuals),
424
424
  client(),
425
425
  entry(),
426
426
  css()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "revojs",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "type": "module",
5
5
  "repository": "coverbase/revojs",
6
6
  "license": "MIT",
@@ -1,26 +0,0 @@
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 };