@lingxia/rong 0.0.1
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 +59 -0
- package/dist/abort.d.ts +36 -0
- package/dist/abort.d.ts.map +1 -0
- package/dist/abort.js +6 -0
- package/dist/assert.d.ts +44 -0
- package/dist/assert.d.ts.map +1 -0
- package/dist/assert.js +6 -0
- package/dist/buffer.d.ts +45 -0
- package/dist/buffer.d.ts.map +1 -0
- package/dist/buffer.js +6 -0
- package/dist/child_process.d.ts +99 -0
- package/dist/child_process.d.ts.map +1 -0
- package/dist/child_process.js +6 -0
- package/dist/console.d.ts +40 -0
- package/dist/console.d.ts.map +1 -0
- package/dist/console.js +9 -0
- package/dist/encoding.d.ts +10 -0
- package/dist/encoding.d.ts.map +1 -0
- package/dist/encoding.js +10 -0
- package/dist/error.d.ts +104 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/error.js +90 -0
- package/dist/event.d.ts +96 -0
- package/dist/event.d.ts.map +1 -0
- package/dist/event.js +6 -0
- package/dist/exception.d.ts +19 -0
- package/dist/exception.d.ts.map +1 -0
- package/dist/exception.js +6 -0
- package/dist/fs.d.ts +450 -0
- package/dist/fs.d.ts.map +1 -0
- package/dist/fs.js +23 -0
- package/dist/global.d.ts +76 -0
- package/dist/global.d.ts.map +1 -0
- package/dist/global.js +8 -0
- package/dist/http.d.ts +117 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +9 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +77 -0
- package/dist/navigator.d.ts +16 -0
- package/dist/navigator.d.ts.map +1 -0
- package/dist/navigator.js +6 -0
- package/dist/path.d.ts +70 -0
- package/dist/path.d.ts.map +1 -0
- package/dist/path.js +6 -0
- package/dist/process.d.ts +53 -0
- package/dist/process.d.ts.map +1 -0
- package/dist/process.js +6 -0
- package/dist/storage.d.ts +53 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +8 -0
- package/dist/stream.d.ts +90 -0
- package/dist/stream.d.ts.map +1 -0
- package/dist/stream.js +90 -0
- package/dist/timer.d.ts +52 -0
- package/dist/timer.d.ts.map +1 -0
- package/dist/timer.js +6 -0
- package/dist/url.d.ts +75 -0
- package/dist/url.d.ts.map +1 -0
- package/dist/url.js +6 -0
- package/package.json +27 -0
- package/src/abort.ts +50 -0
- package/src/assert.ts +51 -0
- package/src/buffer.ts +60 -0
- package/src/child_process.ts +116 -0
- package/src/console.ts +53 -0
- package/src/encoding.ts +10 -0
- package/src/error.ts +149 -0
- package/src/event.ts +128 -0
- package/src/exception.ts +77 -0
- package/src/fs.ts +514 -0
- package/src/global.ts +98 -0
- package/src/http.ts +151 -0
- package/src/index.ts +67 -0
- package/src/navigator.ts +20 -0
- package/src/path.ts +83 -0
- package/src/process.ts +74 -0
- package/src/storage.ts +64 -0
- package/src/stream.ts +98 -0
- package/src/timer.ts +61 -0
- package/src/url.ts +106 -0
package/dist/global.d.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Global API declarations for Rong JavaScript Runtime
|
|
3
|
+
*
|
|
4
|
+
* This file declares all globally available APIs injected by the Rong runtime.
|
|
5
|
+
* These declarations enable IDE autocomplete and TypeScript type checking.
|
|
6
|
+
*/
|
|
7
|
+
import type { AssertFunction } from './assert';
|
|
8
|
+
import type { ChildProcessModule } from './child_process';
|
|
9
|
+
import type { DirEntry, FileInfo, FileOpenOptions, FsFile, MkdirOptions, ReadFileOptions, RemoveOptions, SeekMode, UTimeOptions, WriteFileOptions } from './fs';
|
|
10
|
+
import type { PathModule } from './path';
|
|
11
|
+
import type { Process } from './process';
|
|
12
|
+
import type { StorageConstructor, StorageModule } from './storage';
|
|
13
|
+
declare global {
|
|
14
|
+
/**
|
|
15
|
+
* Rong runtime namespace - Core APIs for file system and storage
|
|
16
|
+
*/
|
|
17
|
+
const Rong: {
|
|
18
|
+
readTextFile(path: string, options?: ReadFileOptions): Promise<string>;
|
|
19
|
+
readFile(path: string, options?: ReadFileOptions): Promise<ArrayBuffer>;
|
|
20
|
+
writeTextFile(path: string, text: string, options?: WriteFileOptions): Promise<void>;
|
|
21
|
+
writeFile(path: string, data: ArrayBufferView, options?: WriteFileOptions): Promise<void>;
|
|
22
|
+
copyFile(from: string, to: string): Promise<void>;
|
|
23
|
+
truncate(path: string, len?: number): Promise<void>;
|
|
24
|
+
open(path: string, options?: FileOpenOptions): Promise<FsFile>;
|
|
25
|
+
mkdir(path: string, options?: MkdirOptions): Promise<void>;
|
|
26
|
+
readDir(path: string): Promise<AsyncIterableIterator<DirEntry>>;
|
|
27
|
+
stat(path: string): Promise<FileInfo>;
|
|
28
|
+
lstat(path: string): Promise<FileInfo>;
|
|
29
|
+
remove(path: string, options?: RemoveOptions): Promise<void>;
|
|
30
|
+
chdir(path: string): Promise<void>;
|
|
31
|
+
symlink(target: string, path: string): Promise<void>;
|
|
32
|
+
readlink(path: string): Promise<string>;
|
|
33
|
+
/**
|
|
34
|
+
* Change file permissions (Unix only)
|
|
35
|
+
* @platform unix
|
|
36
|
+
*/
|
|
37
|
+
chmod(path: string, mode: number): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Change file ownership (Unix only)
|
|
40
|
+
* @platform unix
|
|
41
|
+
*/
|
|
42
|
+
chown(path: string, uid: number, gid: number): Promise<void>;
|
|
43
|
+
utime(path: string, options: UTimeOptions): Promise<void>;
|
|
44
|
+
rename(oldPath: string, newPath: string): Promise<void>;
|
|
45
|
+
realPath(path: string): Promise<string>;
|
|
46
|
+
readonly SeekMode: typeof SeekMode;
|
|
47
|
+
readonly Storage: StorageConstructor;
|
|
48
|
+
readonly storage: StorageModule;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Process object - Access to process information and environment
|
|
52
|
+
*/
|
|
53
|
+
const process: Process;
|
|
54
|
+
/**
|
|
55
|
+
* Child Process module - Node.js compatible child process spawning (globalThis.child_process)
|
|
56
|
+
*/
|
|
57
|
+
const child_process: ChildProcessModule;
|
|
58
|
+
/**
|
|
59
|
+
* Path module - Path manipulation utilities (Node.js compatible)
|
|
60
|
+
*/
|
|
61
|
+
const path: PathModule;
|
|
62
|
+
/**
|
|
63
|
+
* Base64 decode - Decode base64 string to binary string
|
|
64
|
+
*/
|
|
65
|
+
function atob(data: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* Base64 encode - Encode binary string to base64
|
|
68
|
+
*/
|
|
69
|
+
function btoa(data: string): string;
|
|
70
|
+
/**
|
|
71
|
+
* Assert function - Test assertions (Node.js compatible)
|
|
72
|
+
*/
|
|
73
|
+
const assert: AssertFunction;
|
|
74
|
+
}
|
|
75
|
+
export {};
|
|
76
|
+
//# sourceMappingURL=global.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../src/global.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EACV,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,MAAM,EACN,YAAY,EACZ,eAAe,EACf,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,gBAAgB,EACjB,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAEnE,OAAO,CAAC,MAAM,CAAC;IACb;;OAEG;IACH,MAAM,IAAI,EAAE;QAEV,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QACvE,QAAQ,CAAC,IAA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
* Global API declarations for Rong JavaScript Runtime
|
|
4
|
+
*
|
|
5
|
+
* This file declares all globally available APIs injected by the Rong runtime.
|
|
6
|
+
* These declarations enable IDE autocomplete and TypeScript type checking.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/http.d.ts
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP module type definitions
|
|
3
|
+
* Corresponds to: modules/rong_http
|
|
4
|
+
*
|
|
5
|
+
* The HTTP module provides the standard `fetch` API for making HTTP requests.
|
|
6
|
+
* It does NOT provide an `http` object or `download` function.
|
|
7
|
+
*/
|
|
8
|
+
export interface FetchOptions {
|
|
9
|
+
method?: string;
|
|
10
|
+
headers?: HeadersInit | Headers;
|
|
11
|
+
body?: BodyInit | null;
|
|
12
|
+
signal?: AbortSignal | null;
|
|
13
|
+
redirect?: 'follow' | 'error' | 'manual';
|
|
14
|
+
}
|
|
15
|
+
export interface FetchResponse {
|
|
16
|
+
/** HTTP status code */
|
|
17
|
+
readonly status: number;
|
|
18
|
+
/** HTTP status text */
|
|
19
|
+
readonly statusText: string;
|
|
20
|
+
/** Whether the response was successful (status in 200-299) */
|
|
21
|
+
readonly ok: boolean;
|
|
22
|
+
/** Response headers */
|
|
23
|
+
readonly headers: Headers;
|
|
24
|
+
/** Whether the response body has been read */
|
|
25
|
+
readonly bodyUsed: boolean;
|
|
26
|
+
/** Response type */
|
|
27
|
+
readonly type: string;
|
|
28
|
+
/** Whether the response was redirected */
|
|
29
|
+
readonly redirected: boolean;
|
|
30
|
+
/** Response URL */
|
|
31
|
+
readonly url: string;
|
|
32
|
+
/** Parse response body as text */
|
|
33
|
+
text(): Promise<string>;
|
|
34
|
+
/** Parse response body as JSON */
|
|
35
|
+
json<T = any>(): Promise<T>;
|
|
36
|
+
/** Get response body as ArrayBuffer */
|
|
37
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
38
|
+
/** Get response body as Blob */
|
|
39
|
+
blob(): Promise<Blob>;
|
|
40
|
+
/** Get response body as FormData */
|
|
41
|
+
formData(): Promise<FormData>;
|
|
42
|
+
/** Get response body as ReadableStream */
|
|
43
|
+
readonly body: ReadableStream<Uint8Array> | null;
|
|
44
|
+
}
|
|
45
|
+
declare global {
|
|
46
|
+
/**
|
|
47
|
+
* Fetch API - Make HTTP requests
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const response = await fetch('https://api.example.com/data', {
|
|
52
|
+
* method: 'POST',
|
|
53
|
+
* headers: { 'Content-Type': 'application/json' },
|
|
54
|
+
* body: JSON.stringify({ key: 'value' })
|
|
55
|
+
* });
|
|
56
|
+
* const data = await response.json();
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
function fetch(url: RequestInfo | URL, options?: RequestInit): Promise<Response>;
|
|
60
|
+
}
|
|
61
|
+
export {};
|
|
62
|
+
export type BodyInit = string | Blob | ArrayBuffer | ArrayBufferView | FormData | URLSearchParams | ReadableStream<Uint8Array>;
|
|
63
|
+
export interface Body {
|
|
64
|
+
/** Consumes the body and returns a promise that resolves with a Blob */
|
|
65
|
+
blob(): Promise<Blob>;
|
|
66
|
+
/** Consumes the body and returns a promise that resolves with a FormData */
|
|
67
|
+
formData(): Promise<FormData>;
|
|
68
|
+
/** Consumes the body and returns a promise that resolves with the result of parsing the body text as JSON */
|
|
69
|
+
json<T = any>(): Promise<T>;
|
|
70
|
+
/** Consumes the body and returns a promise that resolves with the result of parsing the body text as a String */
|
|
71
|
+
text(): Promise<string>;
|
|
72
|
+
/** Consumes the body and returns a promise that resolves with an ArrayBuffer */
|
|
73
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
74
|
+
/** Returns a boolean indicating whether body has been consumed */
|
|
75
|
+
readonly bodyUsed: boolean;
|
|
76
|
+
/** The body content */
|
|
77
|
+
readonly body: ReadableStream<Uint8Array> | null;
|
|
78
|
+
}
|
|
79
|
+
export interface RequestInit {
|
|
80
|
+
method?: string;
|
|
81
|
+
headers?: HeadersInit | Headers;
|
|
82
|
+
body?: BodyInit | null;
|
|
83
|
+
redirect?: 'follow' | 'error' | 'manual';
|
|
84
|
+
signal?: AbortSignal | null;
|
|
85
|
+
}
|
|
86
|
+
export interface Request extends Body {
|
|
87
|
+
readonly method: string;
|
|
88
|
+
readonly headers: Headers;
|
|
89
|
+
readonly redirect: string;
|
|
90
|
+
readonly signal: AbortSignal | null;
|
|
91
|
+
readonly url: string;
|
|
92
|
+
clone(): Request;
|
|
93
|
+
}
|
|
94
|
+
export interface RequestConstructor {
|
|
95
|
+
new (input: RequestInfo | string, init?: RequestInit): Request;
|
|
96
|
+
prototype: Request;
|
|
97
|
+
}
|
|
98
|
+
export type RequestInfo = string | Request | URL;
|
|
99
|
+
export type HeadersInit = Record<string, string> | Array<[string, string]> | Headers;
|
|
100
|
+
export interface Headers {
|
|
101
|
+
append(name: string, value: string): void;
|
|
102
|
+
delete(name: string): void;
|
|
103
|
+
get(name: string): string | null;
|
|
104
|
+
has(name: string): boolean;
|
|
105
|
+
set(name: string, value: string): void;
|
|
106
|
+
forEach(callback: (value: string, name: string, self: Headers) => void, thisArg?: any): void;
|
|
107
|
+
entries(): IterableIterator<[string, string]>;
|
|
108
|
+
keys(): IterableIterator<string>;
|
|
109
|
+
values(): IterableIterator<string>;
|
|
110
|
+
/** Returns all Set-Cookie values (Rong extension) */
|
|
111
|
+
getSetCookie(): string[];
|
|
112
|
+
}
|
|
113
|
+
export interface HeadersConstructor {
|
|
114
|
+
new (init?: HeadersInit): Headers;
|
|
115
|
+
prototype: Headers;
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;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AC;CAC1B;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAI,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC;IACjC,SAAS,EAAE,OAAO,CAAC;CACpB"}
|
package/dist/http.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* HTTP module type definitions
|
|
4
|
+
* Corresponds to: modules/rong_http
|
|
5
|
+
*
|
|
6
|
+
* The HTTP module provides the standard `fetch` API for making HTTP requests.
|
|
7
|
+
* It does NOT provide an `http` object or `download` function.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rong JavaScript Runtime Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* This package provides TypeScript type definitions for all Rust-driven
|
|
5
|
+
* JavaScript APIs in the Rong runtime.
|
|
6
|
+
*
|
|
7
|
+
* ## Quick Start
|
|
8
|
+
*
|
|
9
|
+
* Add to your tsconfig.json:
|
|
10
|
+
* ```json
|
|
11
|
+
* {
|
|
12
|
+
* "compilerOptions": {
|
|
13
|
+
* "types": ["@lingxia/rong"]
|
|
14
|
+
* }
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* Then use the global APIs:
|
|
19
|
+
* ```typescript
|
|
20
|
+
* // File system
|
|
21
|
+
* const text = await Rong.readTextFile('/path/to/file.txt');
|
|
22
|
+
* await Rong.writeTextFile('/output.txt', 'Hello World');
|
|
23
|
+
*
|
|
24
|
+
* // Process
|
|
25
|
+
* console.log(process.pid);
|
|
26
|
+
* console.log(process.env.PATH);
|
|
27
|
+
*
|
|
28
|
+
* // HTTP
|
|
29
|
+
* const response = await fetch('https://api.example.com');
|
|
30
|
+
*
|
|
31
|
+
* // Child process
|
|
32
|
+
* const child = child_process.spawn('ls', ['-la']);
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* For detailed API documentation, see individual module exports below.
|
|
36
|
+
*/
|
|
37
|
+
import './global';
|
|
38
|
+
export * from './process';
|
|
39
|
+
export * from './child_process';
|
|
40
|
+
export * from './stream';
|
|
41
|
+
export * from './encoding';
|
|
42
|
+
export * from './storage';
|
|
43
|
+
export * from './http';
|
|
44
|
+
export * from './fs';
|
|
45
|
+
export * from './url';
|
|
46
|
+
export * from './buffer';
|
|
47
|
+
export * from './event';
|
|
48
|
+
export * from './abort';
|
|
49
|
+
export * from './exception';
|
|
50
|
+
export * from './navigator';
|
|
51
|
+
export * from './timer';
|
|
52
|
+
export * from './path';
|
|
53
|
+
export * from './assert';
|
|
54
|
+
export * from './console';
|
|
55
|
+
export * from './error';
|
|
56
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAGH,OAAO,UAAU,CAAC;AAGlB,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AAGvB,cAAc,MAAM,CAAC;AAGrB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAG5B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAG1B,cAAc,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Rong JavaScript Runtime Type Definitions
|
|
4
|
+
*
|
|
5
|
+
* This package provides TypeScript type definitions for all Rust-driven
|
|
6
|
+
* JavaScript APIs in the Rong runtime.
|
|
7
|
+
*
|
|
8
|
+
* ## Quick Start
|
|
9
|
+
*
|
|
10
|
+
* Add to your tsconfig.json:
|
|
11
|
+
* ```json
|
|
12
|
+
* {
|
|
13
|
+
* "compilerOptions": {
|
|
14
|
+
* "types": ["@lingxia/rong"]
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* Then use the global APIs:
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // File system
|
|
22
|
+
* const text = await Rong.readTextFile('/path/to/file.txt');
|
|
23
|
+
* await Rong.writeTextFile('/output.txt', 'Hello World');
|
|
24
|
+
*
|
|
25
|
+
* // Process
|
|
26
|
+
* console.log(process.pid);
|
|
27
|
+
* console.log(process.env.PATH);
|
|
28
|
+
*
|
|
29
|
+
* // HTTP
|
|
30
|
+
* const response = await fetch('https://api.example.com');
|
|
31
|
+
*
|
|
32
|
+
* // Child process
|
|
33
|
+
* const child = child_process.spawn('ls', ['-la']);
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* For detailed API documentation, see individual module exports below.
|
|
37
|
+
*/
|
|
38
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
39
|
+
if (k2 === undefined) k2 = k;
|
|
40
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
41
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
42
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
43
|
+
}
|
|
44
|
+
Object.defineProperty(o, k2, desc);
|
|
45
|
+
}) : (function(o, m, k, k2) {
|
|
46
|
+
if (k2 === undefined) k2 = k;
|
|
47
|
+
o[k2] = m[k];
|
|
48
|
+
}));
|
|
49
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
50
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
51
|
+
};
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
// Global API declarations - Import this for full IDE autocomplete
|
|
54
|
+
require("./global");
|
|
55
|
+
// Core runtime modules
|
|
56
|
+
__exportStar(require("./process"), exports);
|
|
57
|
+
__exportStar(require("./child_process"), exports);
|
|
58
|
+
__exportStar(require("./stream"), exports);
|
|
59
|
+
__exportStar(require("./encoding"), exports);
|
|
60
|
+
__exportStar(require("./storage"), exports);
|
|
61
|
+
__exportStar(require("./http"), exports);
|
|
62
|
+
// File system
|
|
63
|
+
__exportStar(require("./fs"), exports);
|
|
64
|
+
// Web APIs
|
|
65
|
+
__exportStar(require("./url"), exports);
|
|
66
|
+
__exportStar(require("./buffer"), exports);
|
|
67
|
+
__exportStar(require("./event"), exports);
|
|
68
|
+
__exportStar(require("./abort"), exports);
|
|
69
|
+
__exportStar(require("./exception"), exports);
|
|
70
|
+
// Utility modules
|
|
71
|
+
__exportStar(require("./navigator"), exports);
|
|
72
|
+
__exportStar(require("./timer"), exports);
|
|
73
|
+
__exportStar(require("./path"), exports);
|
|
74
|
+
__exportStar(require("./assert"), exports);
|
|
75
|
+
__exportStar(require("./console"), exports);
|
|
76
|
+
// Error types
|
|
77
|
+
__exportStar(require("./error"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigator module type definitions
|
|
3
|
+
* Corresponds to: modules/rong_navigator
|
|
4
|
+
*/
|
|
5
|
+
declare global {
|
|
6
|
+
interface Navigator {
|
|
7
|
+
/** User agent string */
|
|
8
|
+
readonly userAgent: string;
|
|
9
|
+
/** Platform identifier (e.g., "macos", "linux", "windows") */
|
|
10
|
+
readonly platform: string;
|
|
11
|
+
/** CPU architecture (e.g., "x86_64", "aarch64") */
|
|
12
|
+
readonly arch: string;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=navigator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigator.d.ts","sourceRoot":"","sources":["../src/navigator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,SAAS;QACjB,wBAAwB;QACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAE3B,8DAA8D;QAC9D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAE1B,mDAAmD;QACnD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;KACvB;CACF;AAED,OAAO,EAAE,CAAC"}
|
package/dist/path.d.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path module type definitions
|
|
3
|
+
* Corresponds to: modules/rong_path
|
|
4
|
+
*/
|
|
5
|
+
export interface ParsedPath {
|
|
6
|
+
/** Root directory (e.g., "/" on Unix, "C:\\" on Windows) */
|
|
7
|
+
root: string;
|
|
8
|
+
/** Directory path */
|
|
9
|
+
dir: string;
|
|
10
|
+
/** File name with extension */
|
|
11
|
+
base: string;
|
|
12
|
+
/** File extension (including the dot) */
|
|
13
|
+
ext: string;
|
|
14
|
+
/** File name without extension */
|
|
15
|
+
name: string;
|
|
16
|
+
}
|
|
17
|
+
export interface PathModule {
|
|
18
|
+
/**
|
|
19
|
+
* Returns the last portion of a path
|
|
20
|
+
* @param path - The path to process
|
|
21
|
+
* @param suffix - Optional suffix to remove from the result
|
|
22
|
+
*/
|
|
23
|
+
basename(path: string, suffix?: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* Returns the directory name of a path
|
|
26
|
+
* @param path - The path to process
|
|
27
|
+
*/
|
|
28
|
+
dirname(path: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Returns the extension of a path (including the dot)
|
|
31
|
+
* @param path - The path to process
|
|
32
|
+
*/
|
|
33
|
+
extname(path: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Determines whether a path is absolute
|
|
36
|
+
* @param path - The path to check
|
|
37
|
+
*/
|
|
38
|
+
isAbsolute(path: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Joins path segments together
|
|
41
|
+
* @param paths - Path segments to join
|
|
42
|
+
*/
|
|
43
|
+
join(...paths: string[]): string;
|
|
44
|
+
/**
|
|
45
|
+
* Normalizes a path by resolving '..' and '.' segments
|
|
46
|
+
* @param path - The path to normalize
|
|
47
|
+
*/
|
|
48
|
+
normalize(path: string): string;
|
|
49
|
+
/**
|
|
50
|
+
* Resolves a sequence of paths to an absolute path
|
|
51
|
+
* @param paths - Paths to resolve
|
|
52
|
+
*/
|
|
53
|
+
resolve(...paths: string[]): string;
|
|
54
|
+
/**
|
|
55
|
+
* Parses a path into an object
|
|
56
|
+
* @param path - The path to parse
|
|
57
|
+
*/
|
|
58
|
+
parse(path: string): ParsedPath;
|
|
59
|
+
/**
|
|
60
|
+
* Formats a path object into a path string
|
|
61
|
+
* @param pathObject - Path object to format
|
|
62
|
+
*/
|
|
63
|
+
format(pathObject: Partial<ParsedPath>): string;
|
|
64
|
+
/** Platform-specific path segment separator ("/" on Unix, "\\" on Windows) */
|
|
65
|
+
readonly sep: string;
|
|
66
|
+
/** Platform-specific PATH delimiter (":" on Unix, ";" on Windows) */
|
|
67
|
+
readonly delimiter: string;
|
|
68
|
+
}
|
|
69
|
+
export {};
|
|
70
|
+
//# sourceMappingURL=path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../src/path.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,UAAU;IACzB,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAEhD;;;OAGG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAE9B;;;OAGG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAE9B;;;OAGG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAElC;;;OAGG;IACH,IAAI,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAEjC;;;OAGG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAEhC;;;OAGG;IACH,OAAO,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAEpC;;;OAGG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;IAEhC;;;OAGG;IACH,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC;IAEhD,8EAA8E;IAC9E,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,qEAAqE;IACrE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAGD,OAAO,EAAE,CAAC"}
|
package/dist/path.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process module type definitions
|
|
3
|
+
* Corresponds to: modules/rong_process
|
|
4
|
+
*/
|
|
5
|
+
import type { EventEmitter } from './event';
|
|
6
|
+
export interface ProcessEnv {
|
|
7
|
+
[key: string]: string | undefined;
|
|
8
|
+
}
|
|
9
|
+
export interface ProcessStdin extends ReadableStream<Uint8Array> {
|
|
10
|
+
readonly isTTY: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface ProcessStdout {
|
|
13
|
+
write(data: string): boolean;
|
|
14
|
+
readonly isTTY: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface ProcessStderr {
|
|
17
|
+
write(data: string): boolean;
|
|
18
|
+
readonly isTTY: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface Process extends EventEmitter {
|
|
21
|
+
/** Process ID */
|
|
22
|
+
readonly pid: number;
|
|
23
|
+
/** Current working directory */
|
|
24
|
+
cwd(): string;
|
|
25
|
+
/** Change working directory */
|
|
26
|
+
chdir(directory: string): void;
|
|
27
|
+
/** Environment variables */
|
|
28
|
+
readonly env: ProcessEnv;
|
|
29
|
+
/** Platform (e.g., 'darwin', 'linux', 'win32') */
|
|
30
|
+
readonly platform: string;
|
|
31
|
+
/** CPU architecture (e.g., 'x64', 'arm64') */
|
|
32
|
+
readonly arch: string;
|
|
33
|
+
/** Process version */
|
|
34
|
+
readonly version: string;
|
|
35
|
+
/** Command line arguments */
|
|
36
|
+
readonly argv: string[];
|
|
37
|
+
/** Exit the process */
|
|
38
|
+
exit(code?: number): never;
|
|
39
|
+
/** Process uptime in seconds */
|
|
40
|
+
uptime(): number;
|
|
41
|
+
/** High-resolution real time - returns [seconds, nanoseconds] since arbitrary point */
|
|
42
|
+
hrtime(prev?: [number, number]): [number, number];
|
|
43
|
+
/** Schedule callback for next tick (microtask) */
|
|
44
|
+
nextTick(callback: (...args: any[]) => void, ...args: any[]): void;
|
|
45
|
+
/** Standard input stream */
|
|
46
|
+
readonly stdin: ProcessStdin;
|
|
47
|
+
/** Standard output stream */
|
|
48
|
+
readonly stdout: ProcessStdout;
|
|
49
|
+
/** Standard error stream */
|
|
50
|
+
readonly stderr: ProcessStderr;
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=process.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../src/process.ts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MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAElD,kDAAkD;IAClD,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAEnE,4BAA4B;IAC5B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAE7B,6BAA6B;IAC7B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAE/B,4BAA4B;IAC5B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;CAChC;AAGD,OAAO,EAAE,CAAC"}
|
package/dist/process.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage module type definitions
|
|
3
|
+
* Corresponds to: modules/rong_storage
|
|
4
|
+
*
|
|
5
|
+
* IMPORTANT: Storage is accessed via `Rong.storage.open(path)` or `new Rong.Storage(path)`
|
|
6
|
+
*/
|
|
7
|
+
export interface StorageInfo {
|
|
8
|
+
/** Current storage size in bytes */
|
|
9
|
+
currentSize: number;
|
|
10
|
+
/** Size limit in bytes */
|
|
11
|
+
limitSize: number;
|
|
12
|
+
/** Number of keys */
|
|
13
|
+
keyCount: number;
|
|
14
|
+
}
|
|
15
|
+
export interface Storage {
|
|
16
|
+
/** Set a key-value pair */
|
|
17
|
+
set(key: string, value: any): Promise<void>;
|
|
18
|
+
/** Get value by key */
|
|
19
|
+
get(key: string): Promise<any>;
|
|
20
|
+
/** Delete a key */
|
|
21
|
+
delete(key: string): Promise<void>;
|
|
22
|
+
/** Clear all items */
|
|
23
|
+
clear(): Promise<void>;
|
|
24
|
+
/** Get all keys (returns async iterator) */
|
|
25
|
+
list(prefix?: string): Promise<IterableIterator<string>>;
|
|
26
|
+
/** Get storage info */
|
|
27
|
+
info(): Promise<StorageInfo>;
|
|
28
|
+
}
|
|
29
|
+
export interface StorageConstructor {
|
|
30
|
+
/** Create a new Storage instance for the given database path */
|
|
31
|
+
new (path: string, options?: StorageOptionsInput): Storage;
|
|
32
|
+
}
|
|
33
|
+
export interface StorageOptionsInput {
|
|
34
|
+
maxKeySize?: number;
|
|
35
|
+
maxValueSize?: number;
|
|
36
|
+
maxDataSize?: number;
|
|
37
|
+
}
|
|
38
|
+
export interface StorageModule {
|
|
39
|
+
/**
|
|
40
|
+
* Open a storage database at the given path
|
|
41
|
+
* @param path - Path to the database file
|
|
42
|
+
* @returns Storage instance
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* const storage = Rong.storage.open('/path/to/db.sqlite');
|
|
47
|
+
* await storage.set('key', 'value');
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
open(path: string, options?: StorageOptionsInput): Promise<Storage>;
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,WAAW;IAC1B,oCAAoC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,0BAA0B;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB;IACrB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,OAAO;IACtB,2BAA2B;IAC3B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5C,uBAAuB;IACvB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAE/B,mBAAmB;IACnB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnC,sBAAsB;IACtB,KAAK,IAAI,OAAO,CAAC,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