@typeberry/lib 0.1.2-3178190 → 0.1.2-753d258
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/index.cjs +15 -34
- package/index.d.ts +17 -25
- package/index.js +15 -34
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -10,7 +10,6 @@ var GpVersion;
|
|
|
10
10
|
GpVersion["V0_6_7"] = "0.6.7";
|
|
11
11
|
GpVersion["V0_7_0"] = "0.7.0";
|
|
12
12
|
GpVersion["V0_7_1"] = "0.7.1-preview";
|
|
13
|
-
GpVersion["V0_7_2"] = "0.7.2-preview";
|
|
14
13
|
})(GpVersion || (GpVersion = {}));
|
|
15
14
|
var TestSuite;
|
|
16
15
|
(function (TestSuite) {
|
|
@@ -18,7 +17,7 @@ var TestSuite;
|
|
|
18
17
|
TestSuite["JAMDUNA"] = "jamduna";
|
|
19
18
|
})(TestSuite || (TestSuite = {}));
|
|
20
19
|
const DEFAULT_SUITE = TestSuite.W3F_DAVXY;
|
|
21
|
-
const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1
|
|
20
|
+
const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1];
|
|
22
21
|
const env$1 = typeof process === "undefined" ? {} : process.env;
|
|
23
22
|
const DEFAULT_VERSION = GpVersion.V0_7_0;
|
|
24
23
|
let CURRENT_VERSION = parseCurrentVersion(env$1.GP_VERSION) ?? DEFAULT_VERSION;
|
|
@@ -27,26 +26,20 @@ function parseCurrentVersion(env) {
|
|
|
27
26
|
if (env === undefined) {
|
|
28
27
|
return undefined;
|
|
29
28
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
case GpVersion.V0_7_1:
|
|
34
|
-
case GpVersion.V0_7_2:
|
|
35
|
-
return env;
|
|
36
|
-
default:
|
|
37
|
-
throw new Error(`Configured environment variable GP_VERSION is unknown: '${env}'. Use one of: ${ALL_VERSIONS_IN_ORDER}`);
|
|
29
|
+
const version = env;
|
|
30
|
+
if (!Object.values(GpVersion).includes(version)) {
|
|
31
|
+
throw new Error(`Configured environment variable GP_VERSION is unknown: '${env}'. Use one of: ${ALL_VERSIONS_IN_ORDER}`);
|
|
38
32
|
}
|
|
33
|
+
return version;
|
|
39
34
|
}
|
|
40
35
|
function parseCurrentSuite(env) {
|
|
41
36
|
if (env === undefined)
|
|
42
37
|
return undefined;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return env;
|
|
47
|
-
default:
|
|
48
|
-
throw new Error(`Configured environment variable TEST_SUITE is unknown: '${env}'. Use one of: ${Object.values(TestSuite)}`);
|
|
38
|
+
const val = env;
|
|
39
|
+
if (!Object.values(TestSuite).includes(val)) {
|
|
40
|
+
throw new Error(`Configured environment variable TEST_SUITE is unknown: '${env}'. Use one of: ${Object.values(TestSuite)}`);
|
|
49
41
|
}
|
|
42
|
+
return val;
|
|
50
43
|
}
|
|
51
44
|
class Compatibility {
|
|
52
45
|
static override(version) {
|
|
@@ -8052,8 +8045,8 @@ function print(level, levelAndName, strings, data) {
|
|
|
8052
8045
|
return;
|
|
8053
8046
|
}
|
|
8054
8047
|
const lvlText = Level[level].padEnd(5);
|
|
8055
|
-
const val = strings.map((v, idx) => `${v}${
|
|
8056
|
-
const msg = `${lvlText} [${levelAndName[1]}] ${val
|
|
8048
|
+
const val = strings.map((v, idx) => `${v}${data[idx]}`);
|
|
8049
|
+
const msg = `${lvlText} [${levelAndName[1]}] ${val}`;
|
|
8057
8050
|
if (level === Level.WARN) {
|
|
8058
8051
|
console.warn(msg);
|
|
8059
8052
|
}
|
|
@@ -14125,17 +14118,6 @@ class PageRange {
|
|
|
14125
14118
|
}
|
|
14126
14119
|
return new PageRange(start, length);
|
|
14127
14120
|
}
|
|
14128
|
-
/** Returns true if the page range is wrapped (`start` >= `end`) and is not empty */
|
|
14129
|
-
isWrapped() {
|
|
14130
|
-
return this.start >= this.end && !this.isEmpty();
|
|
14131
|
-
}
|
|
14132
|
-
/** Checks if given page number is within the range */
|
|
14133
|
-
isInRange(page) {
|
|
14134
|
-
if (this.isWrapped()) {
|
|
14135
|
-
return page >= this.start || page < this.end;
|
|
14136
|
-
}
|
|
14137
|
-
return page >= this.start && page < this.end;
|
|
14138
|
-
}
|
|
14139
14121
|
/** Checks if a range is empty (`length === 0`) */
|
|
14140
14122
|
isEmpty() {
|
|
14141
14123
|
return this.length === 0;
|
|
@@ -14476,11 +14458,10 @@ class MemoryBuilder {
|
|
|
14476
14458
|
startHeapIndex (${startHeapIndex}) has to be less than or equal to endHeapIndex (${endHeapIndex})
|
|
14477
14459
|
`;
|
|
14478
14460
|
this.ensureNotFinalized();
|
|
14479
|
-
const
|
|
14480
|
-
const
|
|
14481
|
-
const
|
|
14482
|
-
|
|
14483
|
-
if (heapPagesRange.isInRange(pageNumber)) {
|
|
14461
|
+
const range = MemoryRange.fromStartAndLength(startHeapIndex, endHeapIndex - startHeapIndex);
|
|
14462
|
+
const pages = PageRange.fromMemoryRange(range);
|
|
14463
|
+
for (const pageNumber of pages) {
|
|
14464
|
+
if (this.initialMemory.has(pageNumber)) {
|
|
14484
14465
|
throw new IncorrectSbrkIndex();
|
|
14485
14466
|
}
|
|
14486
14467
|
}
|
package/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ declare enum GpVersion {
|
|
|
2
2
|
V0_6_7 = "0.6.7",
|
|
3
3
|
V0_7_0 = "0.7.0",
|
|
4
4
|
V0_7_1 = "0.7.1-preview",
|
|
5
|
-
V0_7_2 = "0.7.2-preview",
|
|
6
5
|
}
|
|
7
6
|
|
|
8
7
|
declare enum TestSuite {
|
|
@@ -12,7 +11,7 @@ declare enum TestSuite {
|
|
|
12
11
|
|
|
13
12
|
declare const DEFAULT_SUITE = TestSuite.W3F_DAVXY;
|
|
14
13
|
|
|
15
|
-
declare const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1
|
|
14
|
+
declare const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1];
|
|
16
15
|
declare const DEFAULT_VERSION = GpVersion.V0_7_0;
|
|
17
16
|
declare let CURRENT_VERSION = parseCurrentVersion(env.GP_VERSION) ?? DEFAULT_VERSION;
|
|
18
17
|
declare let CURRENT_SUITE = parseCurrentSuite(env.TEST_SUITE) ?? DEFAULT_SUITE;
|
|
@@ -21,30 +20,24 @@ declare function parseCurrentVersion(env?: string): GpVersion | undefined {
|
|
|
21
20
|
if (env === undefined) {
|
|
22
21
|
return undefined;
|
|
23
22
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return env;
|
|
30
|
-
default:
|
|
31
|
-
throw new Error(
|
|
32
|
-
`Configured environment variable GP_VERSION is unknown: '${env}'. Use one of: ${ALL_VERSIONS_IN_ORDER}`,
|
|
33
|
-
);
|
|
23
|
+
const version = env as GpVersion;
|
|
24
|
+
if (!Object.values(GpVersion).includes(version)) {
|
|
25
|
+
throw new Error(
|
|
26
|
+
`Configured environment variable GP_VERSION is unknown: '${env}'. Use one of: ${ALL_VERSIONS_IN_ORDER}`,
|
|
27
|
+
);
|
|
34
28
|
}
|
|
29
|
+
return version;
|
|
35
30
|
}
|
|
36
31
|
|
|
37
32
|
declare function parseCurrentSuite(env?: string): TestSuite | undefined {
|
|
38
33
|
if (env === undefined) return undefined;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
throw new Error(
|
|
45
|
-
`Configured environment variable TEST_SUITE is unknown: '${env}'. Use one of: ${Object.values(TestSuite)}`,
|
|
46
|
-
);
|
|
34
|
+
const val = env as TestSuite;
|
|
35
|
+
if (!Object.values(TestSuite).includes(val)) {
|
|
36
|
+
throw new Error(
|
|
37
|
+
`Configured environment variable TEST_SUITE is unknown: '${env}'. Use one of: ${Object.values(TestSuite)}`,
|
|
38
|
+
);
|
|
47
39
|
}
|
|
40
|
+
return val;
|
|
48
41
|
}
|
|
49
42
|
|
|
50
43
|
declare class Compatibility {
|
|
@@ -14780,12 +14773,11 @@ declare class MemoryBuilder {
|
|
|
14780
14773
|
`;
|
|
14781
14774
|
this.ensureNotFinalized();
|
|
14782
14775
|
|
|
14783
|
-
const
|
|
14784
|
-
const
|
|
14785
|
-
const initializedPageNumbers = Array.from(this.initialMemory.keys());
|
|
14776
|
+
const range = MemoryRange.fromStartAndLength(startHeapIndex, endHeapIndex - startHeapIndex);
|
|
14777
|
+
const pages = PageRange.fromMemoryRange(range);
|
|
14786
14778
|
|
|
14787
|
-
for (const pageNumber of
|
|
14788
|
-
if (
|
|
14779
|
+
for (const pageNumber of pages) {
|
|
14780
|
+
if (this.initialMemory.has(pageNumber)) {
|
|
14789
14781
|
throw new IncorrectSbrkIndex();
|
|
14790
14782
|
}
|
|
14791
14783
|
}
|
package/index.js
CHANGED
|
@@ -7,7 +7,6 @@ var GpVersion;
|
|
|
7
7
|
GpVersion["V0_6_7"] = "0.6.7";
|
|
8
8
|
GpVersion["V0_7_0"] = "0.7.0";
|
|
9
9
|
GpVersion["V0_7_1"] = "0.7.1-preview";
|
|
10
|
-
GpVersion["V0_7_2"] = "0.7.2-preview";
|
|
11
10
|
})(GpVersion || (GpVersion = {}));
|
|
12
11
|
var TestSuite;
|
|
13
12
|
(function (TestSuite) {
|
|
@@ -15,7 +14,7 @@ var TestSuite;
|
|
|
15
14
|
TestSuite["JAMDUNA"] = "jamduna";
|
|
16
15
|
})(TestSuite || (TestSuite = {}));
|
|
17
16
|
const DEFAULT_SUITE = TestSuite.W3F_DAVXY;
|
|
18
|
-
const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1
|
|
17
|
+
const ALL_VERSIONS_IN_ORDER = [GpVersion.V0_6_7, GpVersion.V0_7_0, GpVersion.V0_7_1];
|
|
19
18
|
const env$1 = typeof process === "undefined" ? {} : process.env;
|
|
20
19
|
const DEFAULT_VERSION = GpVersion.V0_7_0;
|
|
21
20
|
let CURRENT_VERSION = parseCurrentVersion(env$1.GP_VERSION) ?? DEFAULT_VERSION;
|
|
@@ -24,26 +23,20 @@ function parseCurrentVersion(env) {
|
|
|
24
23
|
if (env === undefined) {
|
|
25
24
|
return undefined;
|
|
26
25
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
case GpVersion.V0_7_1:
|
|
31
|
-
case GpVersion.V0_7_2:
|
|
32
|
-
return env;
|
|
33
|
-
default:
|
|
34
|
-
throw new Error(`Configured environment variable GP_VERSION is unknown: '${env}'. Use one of: ${ALL_VERSIONS_IN_ORDER}`);
|
|
26
|
+
const version = env;
|
|
27
|
+
if (!Object.values(GpVersion).includes(version)) {
|
|
28
|
+
throw new Error(`Configured environment variable GP_VERSION is unknown: '${env}'. Use one of: ${ALL_VERSIONS_IN_ORDER}`);
|
|
35
29
|
}
|
|
30
|
+
return version;
|
|
36
31
|
}
|
|
37
32
|
function parseCurrentSuite(env) {
|
|
38
33
|
if (env === undefined)
|
|
39
34
|
return undefined;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return env;
|
|
44
|
-
default:
|
|
45
|
-
throw new Error(`Configured environment variable TEST_SUITE is unknown: '${env}'. Use one of: ${Object.values(TestSuite)}`);
|
|
35
|
+
const val = env;
|
|
36
|
+
if (!Object.values(TestSuite).includes(val)) {
|
|
37
|
+
throw new Error(`Configured environment variable TEST_SUITE is unknown: '${env}'. Use one of: ${Object.values(TestSuite)}`);
|
|
46
38
|
}
|
|
39
|
+
return val;
|
|
47
40
|
}
|
|
48
41
|
class Compatibility {
|
|
49
42
|
static override(version) {
|
|
@@ -8049,8 +8042,8 @@ function print(level, levelAndName, strings, data) {
|
|
|
8049
8042
|
return;
|
|
8050
8043
|
}
|
|
8051
8044
|
const lvlText = Level[level].padEnd(5);
|
|
8052
|
-
const val = strings.map((v, idx) => `${v}${
|
|
8053
|
-
const msg = `${lvlText} [${levelAndName[1]}] ${val
|
|
8045
|
+
const val = strings.map((v, idx) => `${v}${data[idx]}`);
|
|
8046
|
+
const msg = `${lvlText} [${levelAndName[1]}] ${val}`;
|
|
8054
8047
|
if (level === Level.WARN) {
|
|
8055
8048
|
console.warn(msg);
|
|
8056
8049
|
}
|
|
@@ -14122,17 +14115,6 @@ class PageRange {
|
|
|
14122
14115
|
}
|
|
14123
14116
|
return new PageRange(start, length);
|
|
14124
14117
|
}
|
|
14125
|
-
/** Returns true if the page range is wrapped (`start` >= `end`) and is not empty */
|
|
14126
|
-
isWrapped() {
|
|
14127
|
-
return this.start >= this.end && !this.isEmpty();
|
|
14128
|
-
}
|
|
14129
|
-
/** Checks if given page number is within the range */
|
|
14130
|
-
isInRange(page) {
|
|
14131
|
-
if (this.isWrapped()) {
|
|
14132
|
-
return page >= this.start || page < this.end;
|
|
14133
|
-
}
|
|
14134
|
-
return page >= this.start && page < this.end;
|
|
14135
|
-
}
|
|
14136
14118
|
/** Checks if a range is empty (`length === 0`) */
|
|
14137
14119
|
isEmpty() {
|
|
14138
14120
|
return this.length === 0;
|
|
@@ -14473,11 +14455,10 @@ class MemoryBuilder {
|
|
|
14473
14455
|
startHeapIndex (${startHeapIndex}) has to be less than or equal to endHeapIndex (${endHeapIndex})
|
|
14474
14456
|
`;
|
|
14475
14457
|
this.ensureNotFinalized();
|
|
14476
|
-
const
|
|
14477
|
-
const
|
|
14478
|
-
const
|
|
14479
|
-
|
|
14480
|
-
if (heapPagesRange.isInRange(pageNumber)) {
|
|
14458
|
+
const range = MemoryRange.fromStartAndLength(startHeapIndex, endHeapIndex - startHeapIndex);
|
|
14459
|
+
const pages = PageRange.fromMemoryRange(range);
|
|
14460
|
+
for (const pageNumber of pages) {
|
|
14461
|
+
if (this.initialMemory.has(pageNumber)) {
|
|
14481
14462
|
throw new IncorrectSbrkIndex();
|
|
14482
14463
|
}
|
|
14483
14464
|
}
|