mol_dump_lib 0.0.868 → 0.0.870
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/node.d.ts +2 -1
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +34 -5
- package/node.js.map +1 -1
- package/node.mjs +34 -5
- package/node.test.js +59 -10
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.d.ts +2 -1
- package/web.d.ts.map +1 -1
- package/web.deps.json +1 -1
- package/web.js +34 -5
- package/web.js.map +1 -1
- package/web.mjs +34 -5
- package/web.test.js +25 -5
- package/web.test.js.map +1 -1
package/node.mjs
CHANGED
|
@@ -372,7 +372,7 @@ var $;
|
|
|
372
372
|
if (this[$mol_ambient_ref])
|
|
373
373
|
return this[$mol_ambient_ref];
|
|
374
374
|
const owner = $mol_owning_get(this);
|
|
375
|
-
return this[$mol_ambient_ref] = owner?.$ || $mol_object2.$;
|
|
375
|
+
return this[$mol_ambient_ref] = owner?.$ || this.constructor.$ || $mol_object2.$;
|
|
376
376
|
}
|
|
377
377
|
set $(next) {
|
|
378
378
|
if (this[$mol_ambient_ref])
|
|
@@ -3088,12 +3088,41 @@ var $;
|
|
|
3088
3088
|
"use strict";
|
|
3089
3089
|
var $;
|
|
3090
3090
|
(function ($) {
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3091
|
+
let buf = new Uint8Array(2 ** 12);
|
|
3092
|
+
function $mol_charset_encode(str) {
|
|
3093
|
+
const capacity = str.length * 3;
|
|
3094
|
+
if (buf.byteLength < capacity)
|
|
3095
|
+
buf = new Uint8Array(capacity);
|
|
3096
|
+
return buf.slice(0, $mol_charset_encode_to(str, buf));
|
|
3095
3097
|
}
|
|
3096
3098
|
$.$mol_charset_encode = $mol_charset_encode;
|
|
3099
|
+
function $mol_charset_encode_to(str, buf, from = 0) {
|
|
3100
|
+
let pos = from;
|
|
3101
|
+
for (let i = 0; i < str.length; i++) {
|
|
3102
|
+
let code = str.charCodeAt(i);
|
|
3103
|
+
if (code < 0x80) {
|
|
3104
|
+
buf[pos++] = code;
|
|
3105
|
+
}
|
|
3106
|
+
else if (code < 0x800) {
|
|
3107
|
+
buf[pos++] = 0xc0 | (code >> 6);
|
|
3108
|
+
buf[pos++] = 0x80 | (code & 0x3f);
|
|
3109
|
+
}
|
|
3110
|
+
else if (code < 0xd800 || code >= 0xe000) {
|
|
3111
|
+
buf[pos++] = 0xe0 | (code >> 12);
|
|
3112
|
+
buf[pos++] = 0x80 | ((code >> 6) & 0x3f);
|
|
3113
|
+
buf[pos++] = 0x80 | (code & 0x3f);
|
|
3114
|
+
}
|
|
3115
|
+
else {
|
|
3116
|
+
const point = ((code - 0xd800) << 10) + str.charCodeAt(++i) + 0x2400;
|
|
3117
|
+
buf[pos++] = 0xf0 | (point >> 18);
|
|
3118
|
+
buf[pos++] = 0x80 | ((point >> 12) & 0x3f);
|
|
3119
|
+
buf[pos++] = 0x80 | ((point >> 6) & 0x3f);
|
|
3120
|
+
buf[pos++] = 0x80 | (point & 0x3f);
|
|
3121
|
+
}
|
|
3122
|
+
}
|
|
3123
|
+
return pos - from;
|
|
3124
|
+
}
|
|
3125
|
+
$.$mol_charset_encode_to = $mol_charset_encode_to;
|
|
3097
3126
|
})($ || ($ = {}));
|
|
3098
3127
|
|
|
3099
3128
|
;
|
package/node.test.js
CHANGED
|
@@ -363,7 +363,7 @@ var $;
|
|
|
363
363
|
if (this[$mol_ambient_ref])
|
|
364
364
|
return this[$mol_ambient_ref];
|
|
365
365
|
const owner = $mol_owning_get(this);
|
|
366
|
-
return this[$mol_ambient_ref] = owner?.$ || $mol_object2.$;
|
|
366
|
+
return this[$mol_ambient_ref] = owner?.$ || this.constructor.$ || $mol_object2.$;
|
|
367
367
|
}
|
|
368
368
|
set $(next) {
|
|
369
369
|
if (this[$mol_ambient_ref])
|
|
@@ -3079,12 +3079,41 @@ var $;
|
|
|
3079
3079
|
"use strict";
|
|
3080
3080
|
var $;
|
|
3081
3081
|
(function ($) {
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3082
|
+
let buf = new Uint8Array(2 ** 12);
|
|
3083
|
+
function $mol_charset_encode(str) {
|
|
3084
|
+
const capacity = str.length * 3;
|
|
3085
|
+
if (buf.byteLength < capacity)
|
|
3086
|
+
buf = new Uint8Array(capacity);
|
|
3087
|
+
return buf.slice(0, $mol_charset_encode_to(str, buf));
|
|
3086
3088
|
}
|
|
3087
3089
|
$.$mol_charset_encode = $mol_charset_encode;
|
|
3090
|
+
function $mol_charset_encode_to(str, buf, from = 0) {
|
|
3091
|
+
let pos = from;
|
|
3092
|
+
for (let i = 0; i < str.length; i++) {
|
|
3093
|
+
let code = str.charCodeAt(i);
|
|
3094
|
+
if (code < 0x80) {
|
|
3095
|
+
buf[pos++] = code;
|
|
3096
|
+
}
|
|
3097
|
+
else if (code < 0x800) {
|
|
3098
|
+
buf[pos++] = 0xc0 | (code >> 6);
|
|
3099
|
+
buf[pos++] = 0x80 | (code & 0x3f);
|
|
3100
|
+
}
|
|
3101
|
+
else if (code < 0xd800 || code >= 0xe000) {
|
|
3102
|
+
buf[pos++] = 0xe0 | (code >> 12);
|
|
3103
|
+
buf[pos++] = 0x80 | ((code >> 6) & 0x3f);
|
|
3104
|
+
buf[pos++] = 0x80 | (code & 0x3f);
|
|
3105
|
+
}
|
|
3106
|
+
else {
|
|
3107
|
+
const point = ((code - 0xd800) << 10) + str.charCodeAt(++i) + 0x2400;
|
|
3108
|
+
buf[pos++] = 0xf0 | (point >> 18);
|
|
3109
|
+
buf[pos++] = 0x80 | ((point >> 12) & 0x3f);
|
|
3110
|
+
buf[pos++] = 0x80 | ((point >> 6) & 0x3f);
|
|
3111
|
+
buf[pos++] = 0x80 | (point & 0x3f);
|
|
3112
|
+
}
|
|
3113
|
+
}
|
|
3114
|
+
return pos - from;
|
|
3115
|
+
}
|
|
3116
|
+
$.$mol_charset_encode_to = $mol_charset_encode_to;
|
|
3088
3117
|
})($ || ($ = {}));
|
|
3089
3118
|
|
|
3090
3119
|
;
|
|
@@ -8165,7 +8194,7 @@ var $;
|
|
|
8165
8194
|
;
|
|
8166
8195
|
"use strict";
|
|
8167
8196
|
var $;
|
|
8168
|
-
(function ($) {
|
|
8197
|
+
(function ($_1) {
|
|
8169
8198
|
$mol_test({
|
|
8170
8199
|
'init with overload'() {
|
|
8171
8200
|
class X extends $mol_object {
|
|
@@ -8178,6 +8207,13 @@ var $;
|
|
|
8178
8207
|
});
|
|
8179
8208
|
$mol_assert_equal(x.foo(), 2);
|
|
8180
8209
|
},
|
|
8210
|
+
'Context in instance inherits from class'($) {
|
|
8211
|
+
const custom = $.$mol_ambient({});
|
|
8212
|
+
class X extends $.$mol_object {
|
|
8213
|
+
static $ = custom;
|
|
8214
|
+
}
|
|
8215
|
+
$mol_assert_equal(new X().$, custom);
|
|
8216
|
+
},
|
|
8181
8217
|
});
|
|
8182
8218
|
})($ || ($ = {}));
|
|
8183
8219
|
|
|
@@ -9997,10 +10033,23 @@ var $;
|
|
|
9997
10033
|
var $;
|
|
9998
10034
|
(function ($) {
|
|
9999
10035
|
$mol_test({
|
|
10000
|
-
'encode
|
|
10001
|
-
|
|
10002
|
-
|
|
10003
|
-
|
|
10036
|
+
'encode empty'() {
|
|
10037
|
+
$mol_assert_equal($mol_charset_encode(''), new Uint8Array([]));
|
|
10038
|
+
},
|
|
10039
|
+
'encode 1 octet'() {
|
|
10040
|
+
$mol_assert_equal($mol_charset_encode('F'), new Uint8Array([0x46]));
|
|
10041
|
+
},
|
|
10042
|
+
'encode 2 octet'() {
|
|
10043
|
+
$mol_assert_equal($mol_charset_encode('Б'), new Uint8Array([0xd0, 0x91]));
|
|
10044
|
+
},
|
|
10045
|
+
'encode 3 octet'() {
|
|
10046
|
+
$mol_assert_equal($mol_charset_encode('ह'), new Uint8Array([0xe0, 0xa4, 0xb9]));
|
|
10047
|
+
},
|
|
10048
|
+
'encode 4 octet'() {
|
|
10049
|
+
$mol_assert_equal($mol_charset_encode('𐍈'), new Uint8Array([0xf0, 0x90, 0x8d, 0x88]));
|
|
10050
|
+
},
|
|
10051
|
+
'encode surrogate pair'() {
|
|
10052
|
+
$mol_assert_equal($mol_charset_encode('😀'), new Uint8Array([0xf0, 0x9f, 0x98, 0x80]));
|
|
10004
10053
|
},
|
|
10005
10054
|
});
|
|
10006
10055
|
})($ || ($ = {}));
|