revojs 0.1.57 → 0.1.59

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.
@@ -0,0 +1,62 @@
1
+ //#region package.json
2
+ var name = "revojs";
3
+ var version = "0.1.59";
4
+ var repository = {
5
+ "type": "git",
6
+ "url": "git+https://github.com/tellua/revojs.git"
7
+ };
8
+ var bin = { "revojs": "dist/cli/index.js" };
9
+ var files = ["dist", "src/types"];
10
+ var type = "module";
11
+ var main = "./dist/index.js";
12
+ var module = "./dist/index.js";
13
+ var types = "./dist/index.d.ts";
14
+ var exports = {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js"
18
+ },
19
+ "./module": {
20
+ "types": "./dist/module/index.d.ts",
21
+ "import": "./dist/module/index.js"
22
+ },
23
+ "./shared": {
24
+ "types": "./dist/shared/index.d.ts",
25
+ "import": "./dist/shared/index.js"
26
+ }
27
+ };
28
+ var scripts = {
29
+ "build": "vite build",
30
+ "typecheck": "tsc --noEmit -p tsconfig.json",
31
+ "watch": "vite build --watch"
32
+ };
33
+ var dependencies = {
34
+ "@standard-schema/spec": "^1.1.0",
35
+ "rolldown": "^1.2.8",
36
+ "vite": "^8.3.0"
37
+ };
38
+ var devDependencies = {
39
+ "@revojs/tsconfig": "*",
40
+ "@types/node": "^26.4.1"
41
+ };
42
+ var optionalDependencies = { "typescript": "^7.0.2" };
43
+ var package_default = {
44
+ name,
45
+ version,
46
+ license: "MIT",
47
+ repository,
48
+ bin,
49
+ files,
50
+ type,
51
+ sideEffects: false,
52
+ main,
53
+ module,
54
+ types,
55
+ exports,
56
+ scripts,
57
+ dependencies,
58
+ devDependencies,
59
+ optionalDependencies
60
+ };
61
+ //#endregion
62
+ export { bin, package_default as default, dependencies, devDependencies, exports, files, main, module, name, optionalDependencies, repository, scripts, type, types, version };
@@ -0,0 +1,43 @@
1
+ import { type Scope } from "../scope";
2
+ import { type Awaitable } from "../shared";
3
+ export type NodeType = "PATH" | "PARAMETER" | "OPTIONAL-PARAMETER" | "WILDCARD" | "OPTIONAL-WILDCARD" | "GROUP";
4
+ export type RouteResolver = (segments: Array<string>) => Awaitable<Array<string> | false>;
5
+ export interface Node<T> {
6
+ type: NodeType;
7
+ name: string;
8
+ value?: T;
9
+ hooks: Array<T>;
10
+ parameter?: Node<T>;
11
+ optionalParameter?: Node<T>;
12
+ wildcard?: Node<T>;
13
+ optionalWildcard?: Node<T>;
14
+ groups: Map<string, Node<T>>;
15
+ children: Map<string, Node<T>>;
16
+ }
17
+ export interface RouteContext {
18
+ segments: Array<string>;
19
+ parameters: Record<string, string>;
20
+ groups: Array<string>;
21
+ }
22
+ export interface RouterContext<T> extends RouteContext {
23
+ match?: T;
24
+ hooks: Array<T>;
25
+ }
26
+ export declare class Router<T> {
27
+ readonly rootNode: Node<T>;
28
+ constructor(rootNode?: Node<T>);
29
+ use(segments: Array<string>, value: T): Node<T>;
30
+ match(segments: Array<string>): RouterContext<T>;
31
+ resolve(scope: Scope, segments: Array<string>): Promise<RouterContext<T>>;
32
+ }
33
+ export declare function toSegments(route: string): string[];
34
+ export declare function fillSegments(segments: Array<string>, parameters: Record<string, string>): string[];
35
+ export declare function useRoute(scope: Scope): RouteContext;
36
+ export declare const ROUTE_CONTEXT: import("..").Descriptor<RouteContext>;
37
+ export declare const ROUTE_RESOLVER_CONTEXT: import("..").Descriptor<RouteResolver>;
38
+ export declare const WILDCARD_MATCH: RegExp;
39
+ export declare const OPTIONAL_WILDCARD_MATCH: RegExp;
40
+ export declare const PARAMETER_MATCH: RegExp;
41
+ export declare const OPTIONAL_PARAMETER_MATCH: RegExp;
42
+ export declare const GROUP_MATCH: RegExp;
43
+ export declare const HOOK_MATCH: RegExp;
@@ -0,0 +1,183 @@
1
+ import { defineContext, getContext, setContext } from "../scope/index.js";
2
+ //#region src/router/index.ts
3
+ var Router = class {
4
+ rootNode;
5
+ constructor(rootNode) {
6
+ this.rootNode = rootNode ?? {
7
+ type: "PATH",
8
+ name: "",
9
+ children: /* @__PURE__ */ new Map(),
10
+ groups: /* @__PURE__ */ new Map(),
11
+ hooks: []
12
+ };
13
+ }
14
+ use(segments, value) {
15
+ let node = this.rootNode;
16
+ for (const segment of segments) {
17
+ const optionalWildcard = OPTIONAL_WILDCARD_MATCH.exec(segment)?.[1];
18
+ if (typeof optionalWildcard === "string") {
19
+ node.optionalWildcard ??= {
20
+ type: "OPTIONAL-WILDCARD",
21
+ name: optionalWildcard,
22
+ children: /* @__PURE__ */ new Map(),
23
+ groups: /* @__PURE__ */ new Map(),
24
+ hooks: []
25
+ };
26
+ node = node.optionalWildcard;
27
+ continue;
28
+ }
29
+ const wildcard = WILDCARD_MATCH.exec(segment)?.[1];
30
+ if (typeof wildcard === "string") {
31
+ node.wildcard ??= {
32
+ type: "WILDCARD",
33
+ name: wildcard,
34
+ children: /* @__PURE__ */ new Map(),
35
+ groups: /* @__PURE__ */ new Map(),
36
+ hooks: []
37
+ };
38
+ node = node.wildcard;
39
+ continue;
40
+ }
41
+ const optionalParameter = OPTIONAL_PARAMETER_MATCH.exec(segment)?.[1];
42
+ if (typeof optionalParameter === "string") {
43
+ node.optionalParameter ??= {
44
+ type: "OPTIONAL-PARAMETER",
45
+ name: optionalParameter,
46
+ children: /* @__PURE__ */ new Map(),
47
+ groups: /* @__PURE__ */ new Map(),
48
+ hooks: []
49
+ };
50
+ node = node.optionalParameter;
51
+ continue;
52
+ }
53
+ const parameter = PARAMETER_MATCH.exec(segment)?.[1];
54
+ if (typeof parameter === "string") {
55
+ node.parameter ??= {
56
+ type: "PARAMETER",
57
+ name: parameter,
58
+ children: /* @__PURE__ */ new Map(),
59
+ groups: /* @__PURE__ */ new Map(),
60
+ hooks: []
61
+ };
62
+ node = node.parameter;
63
+ continue;
64
+ }
65
+ const group = GROUP_MATCH.exec(segment)?.[1];
66
+ if (typeof group === "string") {
67
+ let child = node.groups.get(group);
68
+ if (!child) {
69
+ child = {
70
+ type: "GROUP",
71
+ name: group,
72
+ children: /* @__PURE__ */ new Map(),
73
+ groups: /* @__PURE__ */ new Map(),
74
+ hooks: []
75
+ };
76
+ node.groups.set(group, child);
77
+ }
78
+ node = child;
79
+ continue;
80
+ }
81
+ if (typeof HOOK_MATCH.exec(segment)?.[1] === "string") {
82
+ node.hooks.push(value);
83
+ return node;
84
+ }
85
+ let child = node.children.get(segment);
86
+ if (!child) {
87
+ child = {
88
+ type: "PATH",
89
+ name: segment,
90
+ children: /* @__PURE__ */ new Map(),
91
+ groups: /* @__PURE__ */ new Map(),
92
+ hooks: []
93
+ };
94
+ node.children.set(segment, child);
95
+ }
96
+ node = child;
97
+ }
98
+ node.value = value;
99
+ return node;
100
+ }
101
+ match(segments) {
102
+ const context = {
103
+ segments,
104
+ parameters: {},
105
+ groups: [],
106
+ hooks: []
107
+ };
108
+ visit(this.rootNode, 0, context);
109
+ return context;
110
+ }
111
+ async resolve(scope, segments) {
112
+ const result = await getContext(scope, ROUTE_RESOLVER_CONTEXT)?.(segments);
113
+ return setContext(scope, ROUTE_CONTEXT, result ? this.match(result) : {
114
+ segments,
115
+ parameters: {},
116
+ groups: [],
117
+ hooks: []
118
+ });
119
+ }
120
+ };
121
+ function visit(node, index, context, parameter) {
122
+ const hookCount = context.hooks.length;
123
+ const groupCount = context.groups.length;
124
+ if (node.hooks.length > 0) context.hooks.push(...node.hooks);
125
+ if (node.type === "GROUP") context.groups.push(node.name);
126
+ if (parameter !== void 0) context.parameters[node.name] = parameter;
127
+ if (descend(node, index, context)) return true;
128
+ context.hooks.length = hookCount;
129
+ context.groups.length = groupCount;
130
+ if (parameter !== void 0) delete context.parameters[node.name];
131
+ return false;
132
+ }
133
+ function descend(node, index, context) {
134
+ if (index === context.segments.length) {
135
+ if (node.value !== void 0) {
136
+ context.match = node.value;
137
+ return true;
138
+ }
139
+ for (const group of node.groups.values()) if (visit(group, index, context)) return true;
140
+ if (node.optionalParameter && visit(node.optionalParameter, index, context)) return true;
141
+ if (node.optionalWildcard && visit(node.optionalWildcard, index, context, "")) return true;
142
+ return false;
143
+ }
144
+ for (const group of node.groups.values()) if (visit(group, index, context)) return true;
145
+ const segment = context.segments[index] ?? "";
146
+ const child = node.children.get(segment);
147
+ if (child && visit(child, index + 1, context)) return true;
148
+ if (node.optionalParameter && visit(node.optionalParameter, index, context)) return true;
149
+ if (node.parameter && visit(node.parameter, index + 1, context, segment)) return true;
150
+ if (node.optionalParameter && visit(node.optionalParameter, index + 1, context, segment)) return true;
151
+ if (node.wildcard && visit(node.wildcard, context.segments.length, context, context.segments.slice(index).join("/"))) return true;
152
+ if (node.optionalWildcard && visit(node.optionalWildcard, context.segments.length, context, context.segments.slice(index).join("/"))) return true;
153
+ return false;
154
+ }
155
+ function toSegments(route) {
156
+ return route.split("/").filter((segment) => segment !== "");
157
+ }
158
+ function fillSegments(segments, parameters) {
159
+ const resolved = new Array();
160
+ for (const segment of segments) {
161
+ const name = OPTIONAL_WILDCARD_MATCH.exec(segment)?.[1] ?? WILDCARD_MATCH.exec(segment)?.[1] ?? OPTIONAL_PARAMETER_MATCH.exec(segment)?.[1] ?? PARAMETER_MATCH.exec(segment)?.[1];
162
+ if (typeof name === "string") {
163
+ const value = parameters[name];
164
+ if (value) resolved.push(...value.split("/"));
165
+ continue;
166
+ }
167
+ resolved.push(segment);
168
+ }
169
+ return resolved;
170
+ }
171
+ function useRoute(scope) {
172
+ return getContext(scope, ROUTE_CONTEXT);
173
+ }
174
+ var ROUTE_CONTEXT = defineContext("ROUTE_CONTEXT");
175
+ var ROUTE_RESOLVER_CONTEXT = defineContext("ROUTE_RESOLVER_CONTEXT");
176
+ var WILDCARD_MATCH = /^\[\.\.\.(.*)\]$/;
177
+ var OPTIONAL_WILDCARD_MATCH = /^\[\[\.\.\.(.*)\]\]$/;
178
+ var PARAMETER_MATCH = /^\[(.*)\]$/;
179
+ var OPTIONAL_PARAMETER_MATCH = /^\[\[(.*)\]\]$/;
180
+ var GROUP_MATCH = /^\((.*)\)$/;
181
+ var HOOK_MATCH = /^\+(.+)$/;
182
+ //#endregion
183
+ export { GROUP_MATCH, HOOK_MATCH, OPTIONAL_PARAMETER_MATCH, OPTIONAL_WILDCARD_MATCH, PARAMETER_MATCH, ROUTE_CONTEXT, ROUTE_RESOLVER_CONTEXT, Router, WILDCARD_MATCH, fillSegments, toSegments, useRoute };
@@ -0,0 +1,43 @@
1
+ import { type Awaitable, type Mergeable } from "../shared";
2
+ export type Descriptor<T> = string & {
3
+ [descriptor]: T;
4
+ };
5
+ export type InferDescriptor<T> = T extends Descriptor<infer U> ? U : never;
6
+ export type Hook = (...inputs: Array<any>) => any;
7
+ export type Hooks<T extends Record<string, Descriptor<Hook>>> = {
8
+ [Key in keyof T]: InferDescriptor<T[Key]>;
9
+ };
10
+ export type Intersection<T> = (T extends any ? (arg: T) => void : never) extends (arg: infer I) => void ? I : never;
11
+ export type Source<T = unknown> = Record<string, Record<string, () => Promise<T>>>;
12
+ export type SourceScope<TSource extends Source> = Extract<keyof TSource, string>;
13
+ export type SourceValue<TSource extends Source, TScope extends SourceScope<TSource>> = Extract<keyof TSource[TScope], string>;
14
+ export type SourceType<TSource extends Source, TScope extends SourceScope<TSource>> = Intersection<Awaited<ReturnType<TSource[TScope][SourceValue<TSource, TScope>]>>>;
15
+ export type SourceTypeProperty<TSource extends Source, TScope extends SourceScope<TSource>, TProperty extends PropertyKey> = SourceType<TSource, TScope> extends Partial<Record<TProperty, infer TValue>> ? TValue : never;
16
+ export interface Plugin {
17
+ setup: (scope: Scope) => Awaitable<void>;
18
+ }
19
+ export interface Scope {
20
+ hooks: Record<string, Array<Hook>>;
21
+ context: Record<string, unknown>;
22
+ }
23
+ export declare function registerHook<T extends Hook>(scope: Scope, name: Descriptor<T>, invoke: T): () => void;
24
+ export declare function createRegisterHooks<T extends Record<string, Descriptor<Hook>>>(descriptors: T): (scope: Scope, hooks: Hooks<T>) => void;
25
+ export declare function dispatchHook<T extends Hook>(scope: Scope, name: Descriptor<T>, ...inputs: Parameters<T>): Promise<Awaited<ReturnType<T>>[]>;
26
+ export declare function dispatchHookSingle<T extends Hook>(scope: Scope, name: Descriptor<T>, ...inputs: Parameters<T>): Promise<ReturnType<T> | undefined>;
27
+ export declare function getContext<T>(scope: Scope, input: Descriptor<T>): T;
28
+ export declare function setContext<T>(scope: Scope, input: Descriptor<T>, value: T): T;
29
+ export declare function createScope(inputScope?: Mergeable<Scope>): Promise<{
30
+ hooks?: {
31
+ [x: string]: ArrayLike<Hook> | undefined;
32
+ } | undefined;
33
+ context?: {
34
+ [x: string]: {} | undefined;
35
+ } | undefined;
36
+ } & Scope>;
37
+ export declare function useVariables<T = typeof import("#variables")>(scope: Scope): T;
38
+ export declare function definePlugin<T extends Plugin>(plugin: T): T;
39
+ export declare function defineHook<T extends Hook>(name: string): Descriptor<T>;
40
+ export declare function defineContext<T>(name: string): Descriptor<T>;
41
+ export declare const VARIABLE_CONTEXT: Descriptor<unknown>;
42
+ declare const descriptor: unique symbol;
43
+ export {};
@@ -0,0 +1,73 @@
1
+ import { mergeObjects } from "../shared/index.js";
2
+ import plugins from "#plugins";
3
+ import variables from "#variables";
4
+ //#region src/scope/index.ts
5
+ function registerHook(scope, name, invoke) {
6
+ const targets = scope.hooks[name] ?? [];
7
+ targets.push(invoke);
8
+ scope.hooks[name] = targets;
9
+ return () => {
10
+ const index = scope.hooks[name]?.indexOf(invoke);
11
+ if (typeof index === "number" && index >= 0) scope.hooks[name]?.splice(index, 1);
12
+ if (scope.hooks[name]?.length === 0) delete scope.hooks[name];
13
+ };
14
+ }
15
+ function createRegisterHooks(descriptors) {
16
+ return (scope, hooks) => {
17
+ for (const name in descriptors) registerHook(scope, descriptors[name], hooks[name]);
18
+ };
19
+ }
20
+ async function dispatchHook(scope, name, ...inputs) {
21
+ const results = new Array();
22
+ for (const invoke of scope.hooks[name] ?? []) results.push(await invoke(...inputs));
23
+ return results;
24
+ }
25
+ async function dispatchHookSingle(scope, name, ...inputs) {
26
+ return await dispatchHook(scope, name, ...inputs).then((results) => results.at(0));
27
+ }
28
+ function getContext(scope, input) {
29
+ if (Object.hasOwn(scope.context, input)) return scope.context[input];
30
+ return {};
31
+ }
32
+ function setContext(scope, input, value) {
33
+ scope.context[input] = value;
34
+ return value;
35
+ }
36
+ async function createScope(inputScope) {
37
+ const scope = mergeObjects(inputScope, {
38
+ hooks: {},
39
+ context: {}
40
+ });
41
+ for (const source of Object.values(plugins)) for (const resolve of Object.values(source)) {
42
+ const plugin = await resolve();
43
+ if (plugin) await plugin.setup(scope);
44
+ }
45
+ return scope;
46
+ }
47
+ function useVariables(scope) {
48
+ const normalize = (name) => name.toLowerCase().replace(/[^a-z0-9]/g, "");
49
+ const entries = new Map(Object.entries(getContext(scope, VARIABLE_CONTEXT)).map(([name, value]) => [normalize(name), [name, value]]));
50
+ for (const [name, variable] of Object.entries(variables)) {
51
+ const key = normalize(name);
52
+ let value = entries.get(key)?.[1] ?? variable.default;
53
+ if (value === void 0 && variable.optional !== true) throw new Error(`Missing required variable "${name}"`);
54
+ if (typeof value === "string") {
55
+ if (variable.type === "boolean") value = value.toLowerCase() === "true";
56
+ if (variable.type === "number") value = Number(value);
57
+ }
58
+ entries.set(key, [name, value]);
59
+ }
60
+ return Object.fromEntries(entries.values());
61
+ }
62
+ function definePlugin(plugin) {
63
+ return plugin;
64
+ }
65
+ function defineHook(name) {
66
+ return name;
67
+ }
68
+ function defineContext(name) {
69
+ return name;
70
+ }
71
+ var VARIABLE_CONTEXT = defineContext("VARIABLE_CONTEXT");
72
+ //#endregion
73
+ export { VARIABLE_CONTEXT, createRegisterHooks, createScope, defineContext, defineHook, definePlugin, dispatchHook, dispatchHookSingle, getContext, registerHook, setContext, useVariables };
@@ -0,0 +1,14 @@
1
+ import type { StandardJSONSchemaV1 } from "@standard-schema/spec";
2
+ export type Awaitable<T> = T | PromiseLike<T>;
3
+ export type Primitive = string | number | boolean | bigint | symbol | null | undefined;
4
+ export type Mergeable<T> = T extends Primitive | ((...args: Array<never>) => unknown) ? T : T extends ArrayLike<infer U> ? ArrayLike<Mergeable<U>> : {
5
+ [K in keyof T]?: Mergeable<T[K]>;
6
+ };
7
+ export type JSONValue = null | string | number | boolean | JSONObject | Array<JSONValue>;
8
+ export interface JSONObject {
9
+ [key: string]: JSONValue | undefined;
10
+ }
11
+ export type JsonSchema = StandardJSONSchemaV1 | JSONObject;
12
+ export declare function mergeObjects<TBase, TInput>(base: TBase, input: TInput): TBase & TInput;
13
+ export declare function toJsonSchema(schema: JsonSchema): JSONObject;
14
+ export declare const scheduleAliases: Record<string, string>;
@@ -0,0 +1,39 @@
1
+ //#region src/shared/index.ts
2
+ function mergeObjects(base, input) {
3
+ if (input === null || input === void 0) return mergeObjects(base, {});
4
+ const object = {};
5
+ for (const key of Object.keys(input)) {
6
+ if (DANGEROUS_KEYS.has(key)) continue;
7
+ object[key] = input[key];
8
+ }
9
+ for (const key in base) {
10
+ if (DANGEROUS_KEYS.has(key)) continue;
11
+ const value = base[key];
12
+ if (value === null || value === void 0) continue;
13
+ if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
14
+ else if (typeof value === "object" && typeof object[key] === "object") object[key] = mergeObjects(value, object[key]);
15
+ else object[key] = value;
16
+ }
17
+ return object;
18
+ }
19
+ function toJsonSchema(schema) {
20
+ const standard = schema["~standard"];
21
+ if (standard?.jsonSchema !== void 0) return standard.jsonSchema.input({ target: "draft-07" });
22
+ return schema;
23
+ }
24
+ var scheduleAliases = {
25
+ "@yearly": "0 0 1 1 *",
26
+ "@annually": "0 0 1 1 *",
27
+ "@monthly": "0 0 1 * *",
28
+ "@weekly": "0 0 * * 0",
29
+ "@daily": "0 0 * * *",
30
+ "@midnight": "0 0 * * *",
31
+ "@hourly": "0 * * * *"
32
+ };
33
+ var DANGEROUS_KEYS = /* @__PURE__ */ new Set([
34
+ "__proto__",
35
+ "constructor",
36
+ "prototype"
37
+ ]);
38
+ //#endregion
39
+ export { mergeObjects, scheduleAliases, toJsonSchema };
@@ -0,0 +1,21 @@
1
+ declare module "#assets" {
2
+ import type { Asset } from "revojs";
3
+
4
+ const entries: Record<string, Asset>;
5
+ export default entries;
6
+ }
7
+
8
+ declare module "#plugins" {
9
+ import type { Plugin, Source } from "revojs";
10
+
11
+ const entries: Source<Plugin>;
12
+ export default entries;
13
+ }
14
+
15
+ declare module "#commands" {
16
+ import type { Source } from "revojs";
17
+ import type { Command } from "revojs/module";
18
+
19
+ const entries: Source<Command>;
20
+ export default entries;
21
+ }
package/package.json CHANGED
@@ -1,49 +1,52 @@
1
1
  {
2
2
  "name": "revojs",
3
- "version": "0.1.57",
3
+ "version": "0.1.59",
4
4
  "license": "MIT",
5
- "repository": "tellua/revojs",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/tellua/revojs.git"
8
+ },
6
9
  "bin": {
7
- "revojs": "./dist/commands/index.mjs"
10
+ "revojs": "dist/cli/index.js"
8
11
  },
9
12
  "files": [
10
13
  "dist",
11
14
  "src/types"
12
15
  ],
13
16
  "type": "module",
14
- "main": "./dist/index.mjs",
15
- "module": "./dist/index.mjs",
16
- "types": "./dist/index.d.mts",
17
+ "sideEffects": false,
18
+ "main": "./dist/index.js",
19
+ "module": "./dist/index.js",
20
+ "types": "./dist/index.d.ts",
17
21
  "exports": {
18
22
  ".": {
19
- "types": "./dist/index.d.mts",
20
- "import": "./dist/index.mjs"
21
- },
22
- "./kit": {
23
- "types": "./dist/kit/index.d.mts",
24
- "import": "./dist/kit/index.mjs"
23
+ "types": "./dist/index.d.ts",
24
+ "import": "./dist/index.js"
25
25
  },
26
- "./vite": {
27
- "types": "./dist/vite/index.d.mts",
28
- "import": "./dist/vite/index.mjs"
26
+ "./module": {
27
+ "types": "./dist/module/index.d.ts",
28
+ "import": "./dist/module/index.js"
29
29
  },
30
- "./types": {
31
- "types": "./src/types/index.d.ts"
30
+ "./shared": {
31
+ "types": "./dist/shared/index.d.ts",
32
+ "import": "./dist/shared/index.js"
32
33
  }
33
34
  },
34
35
  "scripts": {
35
- "build": "tsdown",
36
- "watch": "tsdown -w"
36
+ "build": "vite build",
37
+ "typecheck": "tsc --noEmit -p tsconfig.json",
38
+ "watch": "vite build --watch"
37
39
  },
38
40
  "dependencies": {
39
- "citty": "^0.2.2",
40
- "rolldown": "^1.0.0-rc.15",
41
- "rolldown-plugin-dts": "^0.23.2",
42
- "vite": "^8.0.8"
41
+ "@standard-schema/spec": "^1.1.0",
42
+ "rolldown": "^1.2.8",
43
+ "vite": "^8.3.0"
43
44
  },
44
45
  "devDependencies": {
45
46
  "@revojs/tsconfig": "*",
46
- "@types/node": "^25.6.0",
47
- "tsdown": "^0.21.8"
47
+ "@types/node": "^26.4.1"
48
+ },
49
+ "optionalDependencies": {
50
+ "typescript": "^7.0.2"
48
51
  }
49
52
  }
@@ -1,18 +1,21 @@
1
- declare module "#client" {
2
- const client: string;
1
+ declare module "#assets" {
2
+ import type { Asset } from "revojs";
3
3
 
4
- export default client;
4
+ const entries: Record<string, Asset>;
5
+ export default entries;
5
6
  }
6
7
 
7
- declare module "#server" {
8
- import type { Server } from "revojs";
8
+ declare module "#plugins" {
9
+ import type { Plugin, Source } from "revojs";
9
10
 
10
- const server: Server;
11
-
12
- export default server;
11
+ const entries: Source<Plugin>;
12
+ export default entries;
13
13
  }
14
14
 
15
- interface ImportMeta {
16
- readonly SERVER: boolean;
17
- readonly CLIENT: boolean;
15
+ declare module "#commands" {
16
+ import type { Source } from "revojs";
17
+ import type { Command } from "revojs/module";
18
+
19
+ const entries: Source<Command>;
20
+ export default entries;
18
21
  }
@@ -1 +0,0 @@
1
- export { };
@@ -1,50 +0,0 @@
1
- #!/usr/bin/env node
2
- import { n as version, t as name } from "../package-DllXqorv.mjs";
3
- import { resolvePaths } from "../kit/index.mjs";
4
- import { defineCommand, runMain } from "citty";
5
- import { copyFileSync, mkdirSync } from "fs";
6
- import { dirname, join, relative } from "path";
7
- import { rolldown } from "rolldown";
8
- import { dts } from "rolldown-plugin-dts";
9
- //#endregion
10
- //#region src/commands/module/index.ts
11
- var module_default = defineCommand({ subCommands: { build: defineCommand({ async setup() {
12
- await (await rolldown({
13
- input: resolvePaths([
14
- "./src/**/*.js",
15
- "./src/**/*.ts",
16
- "!./src/**/*.d.ts"
17
- ]),
18
- plugins: [dts()],
19
- external: () => true
20
- })).write({
21
- cleanDir: true,
22
- preserveModules: true,
23
- sanitizeFileName: false
24
- });
25
- for (const path of resolvePaths([
26
- "./src/**/*.*",
27
- "!./src/**/*.js",
28
- "!./src/**/*.ts"
29
- ])) {
30
- const target = join("./dist", relative("./src", path));
31
- mkdirSync(dirname(target), { recursive: true });
32
- copyFileSync(path, target);
33
- }
34
- for (const path of resolvePaths(["./src/**/*.d.ts"])) {
35
- const target = join("./dist", relative("./src", path));
36
- mkdirSync(dirname(target), { recursive: true });
37
- copyFileSync(path, target);
38
- }
39
- } }) } });
40
- //#endregion
41
- //#region src/commands/index.ts
42
- runMain(defineCommand({
43
- meta: {
44
- name,
45
- version
46
- },
47
- subCommands: { module: module_default }
48
- }));
49
- //#endregion
50
- export {};