@native-sdk/core 0.0.0 → 0.5.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/package.json +33 -7
- package/sdk/bytes_text_methods.d.ts +88 -0
- package/sdk/core.ts +694 -0
- package/sdk/events.ts +137 -0
- package/sdk/text.ts +519 -0
- package/README.md +0 -3
- package/index.js +0 -2
package/package.json
CHANGED
|
@@ -1,12 +1,38 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@native-sdk/core",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"author": "",
|
|
7
|
-
"license": "MIT",
|
|
3
|
+
"version": "0.5.1",
|
|
4
|
+
"description": "The TypeScript authoring tier: the app-core subset, its dev-time transpiler to arena-backed Zig, and the SDK module cores import",
|
|
8
5
|
"repository": {
|
|
9
6
|
"type": "git",
|
|
10
|
-
"url": ""
|
|
7
|
+
"url": "git+https://github.com/vercel-labs/native.git",
|
|
8
|
+
"directory": "packages/core"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://native-sdk.dev",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"types": "./sdk/core.ts",
|
|
13
|
+
"files": [
|
|
14
|
+
"sdk"
|
|
15
|
+
],
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./sdk/core.ts",
|
|
19
|
+
"default": "./sdk/core.ts"
|
|
20
|
+
},
|
|
21
|
+
"./text": {
|
|
22
|
+
"types": "./sdk/text.ts",
|
|
23
|
+
"default": "./sdk/text.ts"
|
|
24
|
+
},
|
|
25
|
+
"./events": {
|
|
26
|
+
"types": "./sdk/events.ts",
|
|
27
|
+
"default": "./sdk/events.ts"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"test": "node --test \"test/*.test.ts\"",
|
|
32
|
+
"gate": "node scripts/gate.mjs"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@typescript/old": "npm:typescript@6.0.3",
|
|
36
|
+
"@typescript/typescript6": "6.0.2"
|
|
11
37
|
}
|
|
12
|
-
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// The byte-text method surface on core text — ambient declaration merging
|
|
2
|
+
// into lib.esnext's generic Uint8Array. These methods are part of the
|
|
3
|
+
// app-core subset's type environment (the transpiler adds this file to
|
|
4
|
+
// every core's program) and of the editor surface the scaffold ships; at
|
|
5
|
+
// runtime they exist natively in the emitted core (rt.zig's text helpers)
|
|
6
|
+
// and under node through the devhost polyfill (src/text_polyfill.ts) —
|
|
7
|
+
// both built from the same generated Unicode tables.
|
|
8
|
+
//
|
|
9
|
+
// Byte-honest semantics, the one contract worth memorizing: every length,
|
|
10
|
+
// offset, and index below is a BYTE length/offset, search is byte-wise,
|
|
11
|
+
// and case mapping is Unicode SIMPLE case mapping (code point -> code
|
|
12
|
+
// point, locale-free, no special casing — ß stays ß). Invalid UTF-8
|
|
13
|
+
// passes through case mapping unchanged, byte by byte.
|
|
14
|
+
//
|
|
15
|
+
// The `never`-returning tail is the STAYS-OUT set: declared here only so
|
|
16
|
+
// the subset checker can teach each spelling with its reason (UTF-16 code
|
|
17
|
+
// units, ambient locale state, regex engines) instead of tsc's bare
|
|
18
|
+
// "property does not exist".
|
|
19
|
+
|
|
20
|
+
interface Uint8Array<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> {
|
|
21
|
+
/// Unicode simple-case uppercase over UTF-8 (locale-free; invalid bytes
|
|
22
|
+
/// pass through). Fresh bytes.
|
|
23
|
+
toUpperCase(): Uint8Array;
|
|
24
|
+
/// Unicode simple-case lowercase over UTF-8 (locale-free; invalid bytes
|
|
25
|
+
/// pass through). Fresh bytes.
|
|
26
|
+
toLowerCase(): Uint8Array;
|
|
27
|
+
/// The receiver repeated `count` times (`repeat(0)` is empty). A negative
|
|
28
|
+
/// count is JS's RangeError — guard first; native panics there.
|
|
29
|
+
repeat(count: number): Uint8Array;
|
|
30
|
+
/// Byte-wise prefix test; the empty needle is always true.
|
|
31
|
+
startsWith(searchBytes: Uint8Array): boolean;
|
|
32
|
+
/// Byte-wise suffix test; the empty needle is always true.
|
|
33
|
+
endsWith(searchBytes: Uint8Array): boolean;
|
|
34
|
+
/// Byte-substring containment (a BYTES needle). A NUMBER argument keeps
|
|
35
|
+
/// TypedArray element search — one byte value, SameValueZero.
|
|
36
|
+
includes(searchBytes: Uint8Array): boolean;
|
|
37
|
+
/// First byte offset of the byte substring, -1 when absent (empty needle
|
|
38
|
+
/// matches at 0). A NUMBER argument searches one byte value.
|
|
39
|
+
indexOf(searchBytes: Uint8Array): number;
|
|
40
|
+
/// Last byte offset of the byte substring, -1 when absent (empty needle
|
|
41
|
+
/// matches at byte length). A NUMBER argument searches one byte value.
|
|
42
|
+
lastIndexOf(searchBytes: Uint8Array): number;
|
|
43
|
+
/// Pad on the left to `targetByteLength` BYTES (not characters) with
|
|
44
|
+
/// `fillBytes` (default " "), the last repetition truncated; at-or-under
|
|
45
|
+
/// target returns the receiver.
|
|
46
|
+
padStart(targetByteLength: number, fillBytes?: Uint8Array): Uint8Array;
|
|
47
|
+
/// Pad on the right to `targetByteLength` BYTES — see padStart.
|
|
48
|
+
padEnd(targetByteLength: number, fillBytes?: Uint8Array): Uint8Array;
|
|
49
|
+
/// Strip the JS whitespace set (decoded over UTF-8) from both ends — a
|
|
50
|
+
/// view, no copy.
|
|
51
|
+
trim(): Uint8Array;
|
|
52
|
+
/// Strip leading JS whitespace — a view.
|
|
53
|
+
trimStart(): Uint8Array;
|
|
54
|
+
/// Strip trailing JS whitespace — a view.
|
|
55
|
+
trimEnd(): Uint8Array;
|
|
56
|
+
/// Split on a BYTES separator, String.split shapes exactly (adjacent /
|
|
57
|
+
/// leading / trailing separators produce empty elements; no match is
|
|
58
|
+
/// [whole]). Elements are views; the array is locally owned. An empty
|
|
59
|
+
/// separator literal is a taught stop (per-code-point splitting would
|
|
60
|
+
/// expose the encoding seam).
|
|
61
|
+
split(separator: Uint8Array): Uint8Array[];
|
|
62
|
+
|
|
63
|
+
// ------------------------------------------------------ stays out (taught)
|
|
64
|
+
/// STAYS OUT: reads UTF-16 code units (NS1060 teaches the byte read).
|
|
65
|
+
charCodeAt(index: number): never;
|
|
66
|
+
/// STAYS OUT: reads UTF-16 code units (NS1060 teaches the byte read).
|
|
67
|
+
charAt(index: number): never;
|
|
68
|
+
/// STAYS OUT: a code-point index walk over the UTF-16 seam (NS1060).
|
|
69
|
+
codePointAt(index: number): never;
|
|
70
|
+
/// STAYS OUT: Unicode normalization tables are a host-edge concern (NS1060).
|
|
71
|
+
normalize(form?: string): never;
|
|
72
|
+
/// STAYS OUT: locale-dependent collation is ambient state (NS1005).
|
|
73
|
+
localeCompare(other: Uint8Array): never;
|
|
74
|
+
/// STAYS OUT: locale-dependent casing is ambient state (NS1005).
|
|
75
|
+
toLocaleUpperCase(locales?: string): never;
|
|
76
|
+
/// STAYS OUT: locale-dependent casing is ambient state (NS1005).
|
|
77
|
+
toLocaleLowerCase(locales?: string): never;
|
|
78
|
+
/// STAYS OUT: takes a regular expression (NS1040).
|
|
79
|
+
match(pattern: unknown): never;
|
|
80
|
+
/// STAYS OUT: takes a regular expression (NS1040).
|
|
81
|
+
matchAll(pattern: unknown): never;
|
|
82
|
+
/// STAYS OUT: takes a regular expression (NS1040).
|
|
83
|
+
search(pattern: unknown): never;
|
|
84
|
+
/// STAYS OUT in v1: rebuild with split/indexOf and a push-builder (NS1060).
|
|
85
|
+
replace(pattern: unknown, replacement: unknown): never;
|
|
86
|
+
/// STAYS OUT in v1: rebuild with split/indexOf and a push-builder (NS1060).
|
|
87
|
+
replaceAll(pattern: unknown, replacement: unknown): never;
|
|
88
|
+
}
|