@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/stream.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stream module type definitions
|
|
3
|
+
* Corresponds to: modules/rong_stream
|
|
4
|
+
*
|
|
5
|
+
* Rong runtime provides the Web Streams API, which is a standard for handling
|
|
6
|
+
* streaming data in JavaScript. These APIs are globally available.
|
|
7
|
+
*
|
|
8
|
+
* ## Available Stream Types
|
|
9
|
+
*
|
|
10
|
+
* ### ReadableStream<T>
|
|
11
|
+
* Represents a readable stream of data.
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
* ```typescript
|
|
15
|
+
* // From file
|
|
16
|
+
* const file = await Rong.open('/path/to/file.txt', { read: true });
|
|
17
|
+
* const readable = file.readable;
|
|
18
|
+
*
|
|
19
|
+
* // Read from stream
|
|
20
|
+
* const reader = readable.getReader();
|
|
21
|
+
* while (true) {
|
|
22
|
+
* const { done, value } = await reader.read();
|
|
23
|
+
* if (done) break;
|
|
24
|
+
* console.log('Received:', value);
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* ### WritableStream<T>
|
|
29
|
+
* Represents a writable stream of data.
|
|
30
|
+
*
|
|
31
|
+
* Usage:
|
|
32
|
+
* ```typescript
|
|
33
|
+
* // To file
|
|
34
|
+
* const file = await Rong.open('/path/to/output.txt', { write: true, create: true });
|
|
35
|
+
* const writable = file.writable;
|
|
36
|
+
*
|
|
37
|
+
* // Write to stream
|
|
38
|
+
* const writer = writable.getWriter();
|
|
39
|
+
* await writer.write(new TextEncoder().encode('Hello World'));
|
|
40
|
+
* await writer.close();
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* ### TransformStream<I, O>
|
|
44
|
+
* Represents a transform stream for processing data.
|
|
45
|
+
*
|
|
46
|
+
* Usage:
|
|
47
|
+
* ```typescript
|
|
48
|
+
* // Pipe with transformation
|
|
49
|
+
* await readable
|
|
50
|
+
* .pipeThrough(new TransformStream({
|
|
51
|
+
* transform(chunk, controller) {
|
|
52
|
+
* // Process chunk
|
|
53
|
+
* controller.enqueue(processedChunk);
|
|
54
|
+
* }
|
|
55
|
+
* }))
|
|
56
|
+
* .pipeTo(writable);
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* ## Common Use Cases
|
|
60
|
+
*
|
|
61
|
+
* ### Pipe streams
|
|
62
|
+
* ```typescript
|
|
63
|
+
* // Pipe stdin to stdout
|
|
64
|
+
* await process.stdin.pipeTo(process.stdout);
|
|
65
|
+
*
|
|
66
|
+
* // Pipe file to file
|
|
67
|
+
* const source = await Rong.open('/source.txt', { read: true });
|
|
68
|
+
* const dest = await Rong.open('/dest.txt', { write: true, create: true });
|
|
69
|
+
* await source.readable.pipeTo(dest.writable);
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* ### Process data in chunks
|
|
73
|
+
* ```typescript
|
|
74
|
+
* const file = await Rong.open('/large-file.txt', { read: true });
|
|
75
|
+
* const reader = file.readable.getReader();
|
|
76
|
+
*
|
|
77
|
+
* let totalBytes = 0;
|
|
78
|
+
* while (true) {
|
|
79
|
+
* const { done, value } = await reader.read();
|
|
80
|
+
* if (done) break;
|
|
81
|
+
* totalBytes += value.byteLength;
|
|
82
|
+
* // Process chunk...
|
|
83
|
+
* }
|
|
84
|
+
* console.log(`Processed ${totalBytes} bytes`);
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Streams_API
|
|
88
|
+
*/
|
|
89
|
+
export {};
|
|
90
|
+
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuFG;AAUH,OAAO,EAAE,CAAC"}
|
package/dist/stream.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Stream module type definitions
|
|
4
|
+
* Corresponds to: modules/rong_stream
|
|
5
|
+
*
|
|
6
|
+
* Rong runtime provides the Web Streams API, which is a standard for handling
|
|
7
|
+
* streaming data in JavaScript. These APIs are globally available.
|
|
8
|
+
*
|
|
9
|
+
* ## Available Stream Types
|
|
10
|
+
*
|
|
11
|
+
* ### ReadableStream<T>
|
|
12
|
+
* Represents a readable stream of data.
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
* ```typescript
|
|
16
|
+
* // From file
|
|
17
|
+
* const file = await Rong.open('/path/to/file.txt', { read: true });
|
|
18
|
+
* const readable = file.readable;
|
|
19
|
+
*
|
|
20
|
+
* // Read from stream
|
|
21
|
+
* const reader = readable.getReader();
|
|
22
|
+
* while (true) {
|
|
23
|
+
* const { done, value } = await reader.read();
|
|
24
|
+
* if (done) break;
|
|
25
|
+
* console.log('Received:', value);
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* ### WritableStream<T>
|
|
30
|
+
* Represents a writable stream of data.
|
|
31
|
+
*
|
|
32
|
+
* Usage:
|
|
33
|
+
* ```typescript
|
|
34
|
+
* // To file
|
|
35
|
+
* const file = await Rong.open('/path/to/output.txt', { write: true, create: true });
|
|
36
|
+
* const writable = file.writable;
|
|
37
|
+
*
|
|
38
|
+
* // Write to stream
|
|
39
|
+
* const writer = writable.getWriter();
|
|
40
|
+
* await writer.write(new TextEncoder().encode('Hello World'));
|
|
41
|
+
* await writer.close();
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* ### TransformStream<I, O>
|
|
45
|
+
* Represents a transform stream for processing data.
|
|
46
|
+
*
|
|
47
|
+
* Usage:
|
|
48
|
+
* ```typescript
|
|
49
|
+
* // Pipe with transformation
|
|
50
|
+
* await readable
|
|
51
|
+
* .pipeThrough(new TransformStream({
|
|
52
|
+
* transform(chunk, controller) {
|
|
53
|
+
* // Process chunk
|
|
54
|
+
* controller.enqueue(processedChunk);
|
|
55
|
+
* }
|
|
56
|
+
* }))
|
|
57
|
+
* .pipeTo(writable);
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* ## Common Use Cases
|
|
61
|
+
*
|
|
62
|
+
* ### Pipe streams
|
|
63
|
+
* ```typescript
|
|
64
|
+
* // Pipe stdin to stdout
|
|
65
|
+
* await process.stdin.pipeTo(process.stdout);
|
|
66
|
+
*
|
|
67
|
+
* // Pipe file to file
|
|
68
|
+
* const source = await Rong.open('/source.txt', { read: true });
|
|
69
|
+
* const dest = await Rong.open('/dest.txt', { write: true, create: true });
|
|
70
|
+
* await source.readable.pipeTo(dest.writable);
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* ### Process data in chunks
|
|
74
|
+
* ```typescript
|
|
75
|
+
* const file = await Rong.open('/large-file.txt', { read: true });
|
|
76
|
+
* const reader = file.readable.getReader();
|
|
77
|
+
*
|
|
78
|
+
* let totalBytes = 0;
|
|
79
|
+
* while (true) {
|
|
80
|
+
* const { done, value } = await reader.read();
|
|
81
|
+
* if (done) break;
|
|
82
|
+
* totalBytes += value.byteLength;
|
|
83
|
+
* // Process chunk...
|
|
84
|
+
* }
|
|
85
|
+
* console.log(`Processed ${totalBytes} bytes`);
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Streams_API
|
|
89
|
+
*/
|
|
90
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/timer.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Timer module type definitions
|
|
3
|
+
* Corresponds to: modules/rong_timer
|
|
4
|
+
*/
|
|
5
|
+
export type TimerCallback = () => void;
|
|
6
|
+
export type TimerId = number;
|
|
7
|
+
export interface TimersNamespace {
|
|
8
|
+
/**
|
|
9
|
+
* Promise-based timeout that resolves with a timestamp (ms since epoch).
|
|
10
|
+
*/
|
|
11
|
+
setTimeout(delay?: number): Promise<number>;
|
|
12
|
+
/**
|
|
13
|
+
* Promise-based immediate that resolves with a timestamp (ms since epoch).
|
|
14
|
+
*/
|
|
15
|
+
setImmediate(): Promise<number>;
|
|
16
|
+
/**
|
|
17
|
+
* Async iterator that yields timestamps (ms since epoch) on each interval tick.
|
|
18
|
+
*/
|
|
19
|
+
setInterval(delay?: number): AsyncIterableIterator<number>;
|
|
20
|
+
}
|
|
21
|
+
declare global {
|
|
22
|
+
/**
|
|
23
|
+
* Set a timer that executes a callback once after a delay
|
|
24
|
+
* @param callback - Function to execute
|
|
25
|
+
* @param delay - Delay in milliseconds (default: 0)
|
|
26
|
+
* @returns Timer ID that can be used with clearTimeout
|
|
27
|
+
*/
|
|
28
|
+
function setTimeout(callback: TimerCallback, delay?: number): TimerId;
|
|
29
|
+
/**
|
|
30
|
+
* Clear a timer set with setTimeout
|
|
31
|
+
* @param id - Timer ID returned by setTimeout
|
|
32
|
+
*/
|
|
33
|
+
function clearTimeout(id: TimerId): void;
|
|
34
|
+
/**
|
|
35
|
+
* Set a timer that executes a callback repeatedly with a delay between executions
|
|
36
|
+
* @param callback - Function to execute
|
|
37
|
+
* @param delay - Delay in milliseconds between executions (default: 0)
|
|
38
|
+
* @returns Timer ID that can be used with clearInterval
|
|
39
|
+
*/
|
|
40
|
+
function setInterval(callback: TimerCallback, delay?: number): TimerId;
|
|
41
|
+
/**
|
|
42
|
+
* Clear a timer set with setInterval
|
|
43
|
+
* @param id - Timer ID returned by setInterval
|
|
44
|
+
*/
|
|
45
|
+
function clearInterval(id: TimerId): void;
|
|
46
|
+
/**
|
|
47
|
+
* Promise-based timer namespace
|
|
48
|
+
*/
|
|
49
|
+
const timers: TimersNamespace;
|
|
50
|
+
}
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=timer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timer.d.ts","sourceRoot":"","sources":["../src/timer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC;AACvC,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAE7B,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE5C;;OAEG;IACH,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAEhC;;OAEG;IACH,WAAW,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;CAC5D;AAED,OAAO,CAAC,MAAM,CAAC;IACb;;;;;OAKG;IACH,SAAS,UAAU,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAEtE;;;OAGG;IACH,SAAS,YAAY,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAAC;IAEzC;;;;;OAKG;IACH,SAAS,WAAW,CAAC,QAAQ,EAAE,aAAa,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAEvE;;;OAGG;IACH,SAAS,aAAa,CAAC,EAAE,EAAE,OAAO,GAAG,IAAI,CAAC;IAE1C;;OAEG;IACH,MAAM,MAAM,EAAE,eAAe,CAAC;CAC/B;AAED,OAAO,EAAE,CAAC"}
|
package/dist/timer.js
ADDED
package/dist/url.d.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URL module type definitions
|
|
3
|
+
* Corresponds to: modules/rong_url
|
|
4
|
+
*/
|
|
5
|
+
export interface URLSearchParams {
|
|
6
|
+
/** Append a parameter */
|
|
7
|
+
append(name: string, value: string): void;
|
|
8
|
+
/** Delete all parameters with the given name */
|
|
9
|
+
delete(name: string): void;
|
|
10
|
+
/** Get the first value for a parameter */
|
|
11
|
+
get(name: string): string | null;
|
|
12
|
+
/** Get all values for a parameter */
|
|
13
|
+
getAll(name: string): string[];
|
|
14
|
+
/** Check if a parameter exists */
|
|
15
|
+
has(name: string): boolean;
|
|
16
|
+
/** Set a parameter value (replaces existing) */
|
|
17
|
+
set(name: string, value: string): void;
|
|
18
|
+
/** Sort parameters by name */
|
|
19
|
+
sort(): void;
|
|
20
|
+
/** Get all parameter entries */
|
|
21
|
+
entries(): Array<[string, string]>;
|
|
22
|
+
/** Get all parameter names */
|
|
23
|
+
keys(): string[];
|
|
24
|
+
/** Get all parameter values */
|
|
25
|
+
values(): string[];
|
|
26
|
+
/** Iterate over parameters */
|
|
27
|
+
forEach(callback: (value: string, key: string) => void, thisArg?: any): void;
|
|
28
|
+
/** Convert to query string */
|
|
29
|
+
toString(): string;
|
|
30
|
+
/** Number of parameters */
|
|
31
|
+
readonly size: number;
|
|
32
|
+
}
|
|
33
|
+
export interface URLSearchParamsConstructor {
|
|
34
|
+
new (): URLSearchParams;
|
|
35
|
+
new (init: string): URLSearchParams;
|
|
36
|
+
new (init: Array<[string, string]>): URLSearchParams;
|
|
37
|
+
new (init: Record<string, string>): URLSearchParams;
|
|
38
|
+
prototype: URLSearchParams;
|
|
39
|
+
}
|
|
40
|
+
export interface URL {
|
|
41
|
+
/** Fragment identifier (e.g., "#section") */
|
|
42
|
+
hash: string;
|
|
43
|
+
/** Hostname with port (e.g., "example.com:8080") */
|
|
44
|
+
host: string;
|
|
45
|
+
/** Hostname only (e.g., "example.com") */
|
|
46
|
+
hostname: string;
|
|
47
|
+
/** Full URL string */
|
|
48
|
+
href: string;
|
|
49
|
+
/** Protocol + host (e.g., "https://example.com") */
|
|
50
|
+
readonly origin: string;
|
|
51
|
+
/** Password component */
|
|
52
|
+
password: string;
|
|
53
|
+
/** Path component (e.g., "/path/to/resource") */
|
|
54
|
+
pathname: string;
|
|
55
|
+
/** Port number as string */
|
|
56
|
+
port: string;
|
|
57
|
+
/** Protocol scheme (e.g., "https:") */
|
|
58
|
+
protocol: string;
|
|
59
|
+
/** Query string (e.g., "?key=value") */
|
|
60
|
+
search: string;
|
|
61
|
+
/** Username component */
|
|
62
|
+
username: string;
|
|
63
|
+
/** URL search parameters interface */
|
|
64
|
+
readonly searchParams: URLSearchParams;
|
|
65
|
+
/** Convert to string */
|
|
66
|
+
toString(): string;
|
|
67
|
+
/** Convert to JSON */
|
|
68
|
+
toJSON(): string;
|
|
69
|
+
}
|
|
70
|
+
export interface URLConstructor {
|
|
71
|
+
new (url: string, base?: string): URL;
|
|
72
|
+
prototype: URL;
|
|
73
|
+
}
|
|
74
|
+
export {};
|
|
75
|
+
//# sourceMappingURL=url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../src/url.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,eAAe;IAC9B,yBAAyB;IACzB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1C,gDAAgD;IAChD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3B,0CAA0C;IAC1C,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAEjC,qCAAqC;IACrC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE/B,kCAAkC;IAClC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAE3B,gDAAgD;IAChD,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvC,8BAA8B;IAC9B,IAAI,IAAI,IAAI,CAAC;IAEb,gCAAgC;IAChC,OAAO,IAAI,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAEnC,8BAA8B;IAC9B,IAAI,IAAI,MAAM,EAAE,CAAC;IAEjB,+BAA+B;IAC/B,MAAM,IAAI,MAAM,EAAE,CAAC;IAEnB,8BAA8B;IAC9B,OAAO,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;IAE7E,8BAA8B;IAC9B,QAAQ,IAAI,MAAM,CAAC;IAEnB,2BAA2B;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAO,eAAe,CAAC;IACvB,KAAI,IAAI,EAAE,MAAM,GAAG,eAAe,CAAC;IACnC,KAAI,IAAI,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,eAAe,CAAC;IACpD,KAAI,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,eAAe,CAAC;IACnD,SAAS,EAAE,eAAe,CAAC;CAC5B;AAED,MAAM,WAAW,GAAG;IAClB,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IAEb,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IAEb,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;IAEjB,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IAEb,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,yBAAyB;IACzB,QAAQ,EAAE,MAAM,CAAC;IAEjB,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IAEjB,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IAEb,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAC;IAEjB,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IAEf,yBAAyB;IACzB,QAAQ,EAAE,MAAM,CAAC;IAEjB,sCAAsC;IACtC,QAAQ,CAAC,YAAY,EAAE,eAAe,CAAC;IAEvC,wBAAwB;IACxB,QAAQ,IAAI,MAAM,CAAC;IAEnB,sBAAsB;IACtB,MAAM,IAAI,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAI,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IACrC,SAAS,EAAE,GAAG,CAAC;CAChB;AAID,OAAO,EAAE,CAAC"}
|
package/dist/url.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lingxia/rong",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "TypeScript type definitions for Rong JavaScript runtime",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"watch": "tsc --watch",
|
|
10
|
+
"prepublishOnly": "npm run build"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"rong",
|
|
14
|
+
"types",
|
|
15
|
+
"typescript",
|
|
16
|
+
"runtime"
|
|
17
|
+
],
|
|
18
|
+
"author": "",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"typescript": "^5.0.0"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"src"
|
|
26
|
+
]
|
|
27
|
+
}
|
package/src/abort.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abort module type definitions
|
|
3
|
+
* Corresponds to: modules/rong_abort
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { EventTarget } from './event';
|
|
7
|
+
|
|
8
|
+
export interface AbortSignal extends EventTarget {
|
|
9
|
+
/** Whether the signal has been aborted */
|
|
10
|
+
readonly aborted: boolean;
|
|
11
|
+
|
|
12
|
+
/** Reason for abort (if any) */
|
|
13
|
+
readonly reason: any;
|
|
14
|
+
|
|
15
|
+
/** Abort event handler */
|
|
16
|
+
onabort: ((event: Event) => void) | null;
|
|
17
|
+
|
|
18
|
+
/** If the signal has been aborted, throw the abort reason */
|
|
19
|
+
throwIfAborted(): void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface AbortSignalConstructor {
|
|
23
|
+
prototype: AbortSignal;
|
|
24
|
+
|
|
25
|
+
/** Returns an AbortSignal that is aborted when any of the given signals are aborted */
|
|
26
|
+
any(signals: AbortSignal[]): AbortSignal;
|
|
27
|
+
|
|
28
|
+
/** Returns an AbortSignal that is already aborted */
|
|
29
|
+
abort(reason?: any): AbortSignal;
|
|
30
|
+
|
|
31
|
+
/** Returns an AbortSignal that will abort after the specified milliseconds */
|
|
32
|
+
timeout(milliseconds: number): AbortSignal;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface AbortController {
|
|
36
|
+
/** The AbortSignal associated with this controller */
|
|
37
|
+
readonly signal: AbortSignal;
|
|
38
|
+
|
|
39
|
+
/** Abort the associated signal */
|
|
40
|
+
abort(reason?: any): void;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface AbortControllerConstructor {
|
|
44
|
+
new(): AbortController;
|
|
45
|
+
prototype: AbortController;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Note: AbortSignal and AbortController are provided by the global environment
|
|
49
|
+
// These type definitions are for reference and extend the standard Web API
|
|
50
|
+
export {};
|
package/src/assert.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Assert module type definitions
|
|
3
|
+
* Corresponds to: modules/rong_assert
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export type AssertionErrorMessage = string | Error;
|
|
7
|
+
|
|
8
|
+
export interface AssertFunction {
|
|
9
|
+
/**
|
|
10
|
+
* Assert that a value is truthy
|
|
11
|
+
* @param value - Value to check
|
|
12
|
+
* @param message - Optional error message
|
|
13
|
+
* @throws Error if value is falsy
|
|
14
|
+
*/
|
|
15
|
+
(value: any, message?: AssertionErrorMessage): asserts value;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Assert that a value is truthy (alias)
|
|
19
|
+
* @param value - Value to check
|
|
20
|
+
* @param message - Optional error message
|
|
21
|
+
* @throws Error if value is falsy
|
|
22
|
+
*/
|
|
23
|
+
ok(value: any, message?: AssertionErrorMessage): asserts value;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Assert that two values are equal
|
|
27
|
+
* @param left - Left value
|
|
28
|
+
* @param right - Right value
|
|
29
|
+
* @param message - Optional error message
|
|
30
|
+
* @throws Error if values are not equal
|
|
31
|
+
*/
|
|
32
|
+
equal(left: any, right: any, message?: AssertionErrorMessage): void;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Force assertion failure
|
|
36
|
+
* @param message - Error message
|
|
37
|
+
* @throws Error always
|
|
38
|
+
*/
|
|
39
|
+
fail(message?: AssertionErrorMessage): never;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Assert that a function does not throw
|
|
43
|
+
* @param fn - Function to execute
|
|
44
|
+
* @param message - Optional error message
|
|
45
|
+
* @throws Error if function throws
|
|
46
|
+
*/
|
|
47
|
+
doesNotThrow(fn: () => void, message?: AssertionErrorMessage): void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Note: assert is declared as a global in global.d.ts
|
|
51
|
+
export {};
|
package/src/buffer.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Buffer module type definitions (Blob and File)
|
|
3
|
+
* Corresponds to: modules/rong_buffer
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export type BlobPart = Blob | ArrayBuffer | ArrayBufferView | string;
|
|
7
|
+
|
|
8
|
+
export interface BlobOptions {
|
|
9
|
+
/** MIME type of the blob */
|
|
10
|
+
type?: string;
|
|
11
|
+
/** Line ending normalization: "transparent" (default) or "native" */
|
|
12
|
+
endings?: 'transparent' | 'native';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface Blob {
|
|
16
|
+
/** Blob size in bytes */
|
|
17
|
+
readonly size: number;
|
|
18
|
+
|
|
19
|
+
/** MIME type of the blob */
|
|
20
|
+
readonly type: string;
|
|
21
|
+
|
|
22
|
+
/** Create a slice of the blob */
|
|
23
|
+
slice(start?: number, end?: number, contentType?: string): Blob;
|
|
24
|
+
|
|
25
|
+
/** Get blob contents as ArrayBuffer */
|
|
26
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
27
|
+
|
|
28
|
+
/** Get blob contents as text */
|
|
29
|
+
text(): Promise<string>;
|
|
30
|
+
|
|
31
|
+
/** Get blob contents as Uint8Array */
|
|
32
|
+
bytes(): Promise<Uint8Array>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface BlobConstructor {
|
|
36
|
+
new(blobParts?: BlobPart[], options?: BlobOptions): Blob;
|
|
37
|
+
prototype: Blob;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface FileOptions extends BlobOptions {
|
|
41
|
+
/** Last modified timestamp (milliseconds since epoch) */
|
|
42
|
+
lastModified?: number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface File extends Blob {
|
|
46
|
+
/** File name */
|
|
47
|
+
readonly name: string;
|
|
48
|
+
|
|
49
|
+
/** Last modified timestamp (milliseconds since epoch) */
|
|
50
|
+
readonly lastModified: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface FileConstructor {
|
|
54
|
+
new(fileBits: BlobPart[], fileName: string, options?: FileOptions): File;
|
|
55
|
+
prototype: File;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Note: Blob and File are provided by the global environment
|
|
59
|
+
// These type definitions are for reference and extend the standard Web API
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Child Process module type definitions
|
|
3
|
+
* Corresponds to: modules/rong_child_process
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { EventEmitter } from './event';
|
|
7
|
+
|
|
8
|
+
export interface SpawnOptions {
|
|
9
|
+
/** Current working directory */
|
|
10
|
+
cwd?: string;
|
|
11
|
+
/** Environment variables */
|
|
12
|
+
env?: Record<string, string>;
|
|
13
|
+
/** Use shell to execute command */
|
|
14
|
+
shell?: boolean;
|
|
15
|
+
/** Timeout in milliseconds */
|
|
16
|
+
timeout?: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ExecOptions {
|
|
20
|
+
/** Current working directory */
|
|
21
|
+
cwd?: string;
|
|
22
|
+
/** Environment variables */
|
|
23
|
+
env?: Record<string, string>;
|
|
24
|
+
/** Timeout in milliseconds */
|
|
25
|
+
timeout?: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface ExecResult {
|
|
29
|
+
/** Exit code (null if not yet exited) */
|
|
30
|
+
code: number | null;
|
|
31
|
+
/** Standard output */
|
|
32
|
+
stdout: string;
|
|
33
|
+
/** Standard error */
|
|
34
|
+
stderr: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface ChildProcess extends EventEmitter {
|
|
38
|
+
/** Process ID (null if process failed to spawn) */
|
|
39
|
+
readonly pid: number | null;
|
|
40
|
+
|
|
41
|
+
/** Exit code (available after process exits) */
|
|
42
|
+
readonly exitCode: number | null;
|
|
43
|
+
|
|
44
|
+
/** Standard input stream (if configured as 'piped') */
|
|
45
|
+
readonly stdin: WritableStream<Uint8Array> | null;
|
|
46
|
+
|
|
47
|
+
/** Standard output stream (if configured as 'piped') */
|
|
48
|
+
readonly stdout: ReadableStream<Uint8Array> | null;
|
|
49
|
+
|
|
50
|
+
/** Standard error stream (if configured as 'piped') */
|
|
51
|
+
readonly stderr: ReadableStream<Uint8Array> | null;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Wait for process to exit
|
|
55
|
+
* @returns Exit code (null if terminated by signal)
|
|
56
|
+
*/
|
|
57
|
+
wait(): Promise<number | null>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Kill the process with a signal
|
|
61
|
+
* @param signal - Signal name (e.g., 'SIGTERM', 'SIGKILL') or number
|
|
62
|
+
* @returns true if signal was sent successfully
|
|
63
|
+
*/
|
|
64
|
+
kill(signal?: string): boolean;
|
|
65
|
+
|
|
66
|
+
// Event emitter methods (Node.js style)
|
|
67
|
+
on(event: 'exit', listener: (code: number | null) => void): this;
|
|
68
|
+
once(event: 'exit', listener: (code: number | null) => void): this;
|
|
69
|
+
off(event: 'exit', listener: (code: number | null) => void): this;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface ChildProcessModule {
|
|
73
|
+
/**
|
|
74
|
+
* Spawn a child process
|
|
75
|
+
* @param command - Command to execute
|
|
76
|
+
* @param args - Command arguments (optional)
|
|
77
|
+
* @param options - Spawn options
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* const child = child_process.spawn('ls', ['-la'], { cwd: '/tmp' });
|
|
82
|
+
* const code = await child.wait();
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
spawn(command: string, args?: string[], options?: SpawnOptions): ChildProcess;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Execute a shell command and capture output
|
|
89
|
+
* @param command - Shell command to execute
|
|
90
|
+
* @param options - Execution options
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* const result = await child_process.exec('echo "Hello"', { timeout: 5000 });
|
|
95
|
+
* console.log(result.stdout);
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
exec(command: string, options?: ExecOptions): Promise<ExecResult>;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Execute a file directly without shell
|
|
102
|
+
* @param file - File path to execute
|
|
103
|
+
* @param args - Command arguments
|
|
104
|
+
* @param options - Execution options
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* const result = await child_process.execFile('/usr/bin/node', ['--version']);
|
|
109
|
+
* console.log(result.stdout);
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
execFile(file: string, args?: string[], options?: ExecOptions): Promise<ExecResult>;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Note: ChildProcess module is mounted as globalThis.child_process
|
|
116
|
+
export {};
|