@pezkuwi/x-textencoder 14.0.13 → 14.0.14
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/cjs/packageInfo.js +1 -1
- package/package.json +15 -54
- package/packageInfo.js +1 -1
- package/build/LICENSE +0 -201
- package/build/README.md +0 -12
- package/build/browser.d.ts +0 -5
- package/build/browser.js +0 -4
- package/build/cjs/browser.d.ts +0 -5
- package/build/cjs/browser.js +0 -8
- package/build/cjs/fallback.d.ts +0 -3
- package/build/cjs/fallback.js +0 -14
- package/build/cjs/node.d.ts +0 -5
- package/build/cjs/node.js +0 -19
- package/build/cjs/package.json +0 -3
- package/build/cjs/packageInfo.d.ts +0 -6
- package/build/cjs/packageInfo.js +0 -4
- package/build/cjs/react-native.d.ts +0 -1
- package/build/cjs/react-native.js +0 -4
- package/build/cjs/shim.d.ts +0 -1
- package/build/cjs/shim.js +0 -5
- package/build/cjs/typeCheck.d.ts +0 -1
- package/build/cjs/typeCheck.js +0 -6
- package/build/fallback.d.ts +0 -3
- package/build/fallback.js +0 -10
- package/build/node.d.ts +0 -5
- package/build/node.js +0 -14
- package/build/package.json +0 -168
- package/build/packageInfo.d.ts +0 -6
- package/build/packageInfo.js +0 -1
- package/build/react-native.d.ts +0 -1
- package/build/react-native.js +0 -1
- package/build/shim.d.ts +0 -1
- package/build/shim.js +0 -3
- package/build/typeCheck.d.ts +0 -1
- package/build/typeCheck.js +0 -4
- package/build-deno/README.md +0 -12
- package/build-deno/browser.ts +0 -8
- package/build-deno/fallback.ts +0 -13
- package/build-deno/mod.ts +0 -2
- package/build-deno/node.ts +0 -23
- package/build-deno/packageInfo.ts +0 -3
- package/build-deno/react-native.ts +0 -2
- package/build-deno/shim.ts +0 -5
- package/build-deno/typeCheck.ts +0 -6
- package/build-tsc/browser.d.ts +0 -5
- package/build-tsc/fallback.d.ts +0 -3
- package/build-tsc/node.d.ts +0 -5
- package/build-tsc/packageInfo.d.ts +0 -6
- package/build-tsc/react-native.d.ts +0 -1
- package/build-tsc/shim.d.ts +0 -1
- package/build-tsc/typeCheck.d.ts +0 -1
- package/build-tsc-cjs/browser.js +0 -8
- package/build-tsc-cjs/fallback.js +0 -14
- package/build-tsc-cjs/node.js +0 -19
- package/build-tsc-cjs/packageInfo.js +0 -4
- package/build-tsc-cjs/react-native.js +0 -4
- package/build-tsc-cjs/shim.js +0 -5
- package/build-tsc-cjs/typeCheck.js +0 -6
- package/build-tsc-esm/browser.js +0 -4
- package/build-tsc-esm/fallback.js +0 -10
- package/build-tsc-esm/node.js +0 -14
- package/build-tsc-esm/packageInfo.js +0 -1
- package/build-tsc-esm/react-native.js +0 -1
- package/build-tsc-esm/shim.js +0 -3
- package/build-tsc-esm/typeCheck.js +0 -4
- package/src/browser.ts +0 -10
- package/src/fallback.spec.ts +0 -14
- package/src/fallback.ts +0 -16
- package/src/mod.ts +0 -4
- package/src/node.spec.ts +0 -25
- package/src/node.ts +0 -23
- package/src/packageInfo.ts +0 -6
- package/src/react-native.ts +0 -4
- package/src/shim.ts +0 -7
- package/src/typeCheck.ts +0 -8
- package/tsconfig.build.json +0 -15
- package/tsconfig.build.tsbuildinfo +0 -1
- package/tsconfig.spec.json +0 -17
- package/tsconfig.spec.tsbuildinfo +0 -1
package/build/package.json
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"author": "Dijital Kurdistan Tech Institute <dev@pezkuwichain.io>",
|
|
3
|
-
"bugs": "https://github.com/pezkuwichain/pezkuwi-common/issues",
|
|
4
|
-
"description": "A TextDecoder replacement",
|
|
5
|
-
"engines": {
|
|
6
|
-
"node": ">=18"
|
|
7
|
-
},
|
|
8
|
-
"homepage": "https://github.com/pezkuwichain/pezkuwi-common/tree/master/packages/x-textencoder#readme",
|
|
9
|
-
"license": "Apache-2.0",
|
|
10
|
-
"name": "@pezkuwi/x-textencoder",
|
|
11
|
-
"repository": {
|
|
12
|
-
"directory": "packages/x-textencoder",
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "https://github.com/pezkuwichain/pezkuwi-common.git"
|
|
15
|
-
},
|
|
16
|
-
"sideEffects": false,
|
|
17
|
-
"type": "module",
|
|
18
|
-
"version": "14.0.13",
|
|
19
|
-
"main": "./cjs/node.js",
|
|
20
|
-
"module": "./cjs/node.js",
|
|
21
|
-
"browser": "./cjs/browser.js",
|
|
22
|
-
"react-native": "./cjs/react-native.js",
|
|
23
|
-
"types": "./cjs/node.d.ts",
|
|
24
|
-
"exports": {
|
|
25
|
-
"./cjs/package.json": "./cjs/package.json",
|
|
26
|
-
"./cjs/*": "./cjs/*.js",
|
|
27
|
-
".": {
|
|
28
|
-
"types": "./cjs/node.d.ts./cjs/node.js",
|
|
29
|
-
"react-native": "./cjs/react-native.js./cjs/react-native.js",
|
|
30
|
-
"browser": "./cjs/browser.js./cjs/browser.js",
|
|
31
|
-
"node": "./cjs/node.js./cjs/node.js"
|
|
32
|
-
},
|
|
33
|
-
"./browser": {
|
|
34
|
-
"module": {
|
|
35
|
-
"types": "./browser.d.ts",
|
|
36
|
-
"default": "./browser.js"
|
|
37
|
-
},
|
|
38
|
-
"require": {
|
|
39
|
-
"types": "./cjs/browser.d.ts",
|
|
40
|
-
"default": "./cjs/browser.js"
|
|
41
|
-
},
|
|
42
|
-
"default": {
|
|
43
|
-
"types": "./browser.d.ts",
|
|
44
|
-
"default": "./browser.js"
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
"./fallback": {
|
|
48
|
-
"module": {
|
|
49
|
-
"types": "./fallback.d.ts",
|
|
50
|
-
"default": "./fallback.js"
|
|
51
|
-
},
|
|
52
|
-
"require": {
|
|
53
|
-
"types": "./cjs/fallback.d.ts",
|
|
54
|
-
"default": "./cjs/fallback.js"
|
|
55
|
-
},
|
|
56
|
-
"default": {
|
|
57
|
-
"types": "./fallback.d.ts",
|
|
58
|
-
"default": "./fallback.js"
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
"./node": {
|
|
62
|
-
"module": {
|
|
63
|
-
"types": "./node.d.ts",
|
|
64
|
-
"default": "./node.js"
|
|
65
|
-
},
|
|
66
|
-
"require": {
|
|
67
|
-
"types": "./cjs/node.d.ts",
|
|
68
|
-
"default": "./cjs/node.js"
|
|
69
|
-
},
|
|
70
|
-
"default": {
|
|
71
|
-
"types": "./node.d.ts",
|
|
72
|
-
"default": "./node.js"
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
"./package.json": {
|
|
76
|
-
"require": "./cjs/package.json",
|
|
77
|
-
"default": "./package.json"
|
|
78
|
-
},
|
|
79
|
-
"./packageInfo.js": {
|
|
80
|
-
"module": {
|
|
81
|
-
"types": "./packageInfo.d.ts",
|
|
82
|
-
"default": "./packageInfo.js"
|
|
83
|
-
},
|
|
84
|
-
"require": {
|
|
85
|
-
"types": "./cjs/packageInfo.d.ts",
|
|
86
|
-
"default": "./cjs/packageInfo.js"
|
|
87
|
-
},
|
|
88
|
-
"default": {
|
|
89
|
-
"types": "./packageInfo.d.ts",
|
|
90
|
-
"default": "./packageInfo.js"
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
"./packageInfo": {
|
|
94
|
-
"module": {
|
|
95
|
-
"types": "./packageInfo.d.ts",
|
|
96
|
-
"default": "./packageInfo.js"
|
|
97
|
-
},
|
|
98
|
-
"require": {
|
|
99
|
-
"types": "./cjs/packageInfo.d.ts",
|
|
100
|
-
"default": "./cjs/packageInfo.js"
|
|
101
|
-
},
|
|
102
|
-
"default": {
|
|
103
|
-
"types": "./packageInfo.d.ts",
|
|
104
|
-
"default": "./packageInfo.js"
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
"./react-native": {
|
|
108
|
-
"module": {
|
|
109
|
-
"types": "./react-native.d.ts",
|
|
110
|
-
"default": "./react-native.js"
|
|
111
|
-
},
|
|
112
|
-
"require": {
|
|
113
|
-
"types": "./cjs/react-native.d.ts",
|
|
114
|
-
"default": "./cjs/react-native.js"
|
|
115
|
-
},
|
|
116
|
-
"default": {
|
|
117
|
-
"types": "./react-native.d.ts",
|
|
118
|
-
"default": "./react-native.js"
|
|
119
|
-
}
|
|
120
|
-
},
|
|
121
|
-
"./shim.js": {
|
|
122
|
-
"module": {
|
|
123
|
-
"types": "./shim.d.ts",
|
|
124
|
-
"default": "./shim.js"
|
|
125
|
-
},
|
|
126
|
-
"require": {
|
|
127
|
-
"types": "./cjs/shim.d.ts",
|
|
128
|
-
"default": "./cjs/shim.js"
|
|
129
|
-
},
|
|
130
|
-
"default": {
|
|
131
|
-
"types": "./shim.d.ts",
|
|
132
|
-
"default": "./shim.js"
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
"./shim": {
|
|
136
|
-
"module": {
|
|
137
|
-
"types": "./shim.d.ts",
|
|
138
|
-
"default": "./shim.js"
|
|
139
|
-
},
|
|
140
|
-
"require": {
|
|
141
|
-
"types": "./cjs/shim.d.ts",
|
|
142
|
-
"default": "./cjs/shim.js"
|
|
143
|
-
},
|
|
144
|
-
"default": {
|
|
145
|
-
"types": "./shim.d.ts",
|
|
146
|
-
"default": "./shim.js"
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
"./typeCheck": {
|
|
150
|
-
"module": {
|
|
151
|
-
"types": "./typeCheck.d.ts",
|
|
152
|
-
"default": "./typeCheck.js"
|
|
153
|
-
},
|
|
154
|
-
"require": {
|
|
155
|
-
"types": "./cjs/typeCheck.d.ts",
|
|
156
|
-
"default": "./cjs/typeCheck.js"
|
|
157
|
-
},
|
|
158
|
-
"default": {
|
|
159
|
-
"types": "./typeCheck.d.ts",
|
|
160
|
-
"default": "./typeCheck.js"
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
},
|
|
164
|
-
"dependencies": {
|
|
165
|
-
"@pezkuwi/x-global": "14.0.12",
|
|
166
|
-
"tslib": "^2.8.0"
|
|
167
|
-
}
|
|
168
|
-
}
|
package/build/packageInfo.d.ts
DELETED
package/build/packageInfo.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const packageInfo = { name: '@pezkuwi/x-textencoder', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '14.0.13' };
|
package/build/react-native.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './browser.js';
|
package/build/react-native.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './browser.js';
|
package/build/shim.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/build/shim.js
DELETED
package/build/typeCheck.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/build/typeCheck.js
DELETED
package/build-deno/README.md
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# @pezkuwi/x-textencoder
|
|
2
|
-
|
|
3
|
-
A cross-environment TextEncoder.
|
|
4
|
-
|
|
5
|
-
Install it via `yarn add @pezkuwi/x-textencoder`
|
|
6
|
-
|
|
7
|
-
```js
|
|
8
|
-
import { TextEncoder } from 'https://deno.land/x/pezkuwi/x-textencoder/mod.ts';
|
|
9
|
-
|
|
10
|
-
...
|
|
11
|
-
const encoder = new TextEncoder();
|
|
12
|
-
```
|
package/build-deno/browser.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { extractGlobal } from 'https://deno.land/x/pezkuwi/x-global/mod.ts';
|
|
3
|
-
|
|
4
|
-
import { TextEncoder as Fallback } from './fallback.ts';
|
|
5
|
-
|
|
6
|
-
export { packageInfo } from './packageInfo.ts';
|
|
7
|
-
|
|
8
|
-
export const TextEncoder = /*#__PURE__*/ extractGlobal('TextEncoder', Fallback);
|
package/build-deno/fallback.ts
DELETED
package/build-deno/mod.ts
DELETED
package/build-deno/node.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Buffer } from 'node:buffer';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import util from 'node:util';
|
|
5
|
-
|
|
6
|
-
import { extractGlobal } from 'https://deno.land/x/pezkuwi/x-global/mod.ts';
|
|
7
|
-
|
|
8
|
-
export { packageInfo } from './packageInfo.ts';
|
|
9
|
-
|
|
10
|
-
class Fallback {
|
|
11
|
-
#encoder: util.TextEncoder;
|
|
12
|
-
|
|
13
|
-
constructor () {
|
|
14
|
-
this.#encoder = new util.TextEncoder();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// For a Jest 26.0.1 environment, Buffer !== Uint8Array
|
|
18
|
-
encode (value: string): Uint8Array {
|
|
19
|
-
return Uint8Array.from(this.#encoder.encode(value));
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const TextEncoder = /*#__PURE__*/ extractGlobal('TextEncoder', Fallback);
|
package/build-deno/shim.ts
DELETED
package/build-deno/typeCheck.ts
DELETED
package/build-tsc/browser.d.ts
DELETED
package/build-tsc/fallback.d.ts
DELETED
package/build-tsc/node.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './browser.js';
|
package/build-tsc/shim.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/build-tsc/typeCheck.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/build-tsc-cjs/browser.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TextEncoder = exports.packageInfo = void 0;
|
|
4
|
-
const x_global_1 = require("@pezkuwi/x-global");
|
|
5
|
-
const fallback_js_1 = require("./fallback.js");
|
|
6
|
-
var packageInfo_js_1 = require("./packageInfo.js");
|
|
7
|
-
Object.defineProperty(exports, "packageInfo", { enumerable: true, get: function () { return packageInfo_js_1.packageInfo; } });
|
|
8
|
-
exports.TextEncoder = (0, x_global_1.extractGlobal)('TextEncoder', fallback_js_1.TextEncoder);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TextEncoder = void 0;
|
|
4
|
-
class TextEncoder {
|
|
5
|
-
encode(value) {
|
|
6
|
-
const count = value.length;
|
|
7
|
-
const u8a = new Uint8Array(count);
|
|
8
|
-
for (let i = 0; i < count; i++) {
|
|
9
|
-
u8a[i] = value.charCodeAt(i);
|
|
10
|
-
}
|
|
11
|
-
return u8a;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.TextEncoder = TextEncoder;
|
package/build-tsc-cjs/node.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TextEncoder = exports.packageInfo = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const node_util_1 = tslib_1.__importDefault(require("node:util"));
|
|
6
|
-
const x_global_1 = require("@pezkuwi/x-global");
|
|
7
|
-
var packageInfo_js_1 = require("./packageInfo.js");
|
|
8
|
-
Object.defineProperty(exports, "packageInfo", { enumerable: true, get: function () { return packageInfo_js_1.packageInfo; } });
|
|
9
|
-
class Fallback {
|
|
10
|
-
#encoder;
|
|
11
|
-
constructor() {
|
|
12
|
-
this.#encoder = new node_util_1.default.TextEncoder();
|
|
13
|
-
}
|
|
14
|
-
// For a Jest 26.0.1 environment, Buffer !== Uint8Array
|
|
15
|
-
encode(value) {
|
|
16
|
-
return Uint8Array.from(this.#encoder.encode(value));
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.TextEncoder = (0, x_global_1.extractGlobal)('TextEncoder', Fallback);
|
package/build-tsc-cjs/shim.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const browser_js_1 = require("./browser.js");
|
|
4
|
-
const node_js_1 = require("./node.js");
|
|
5
|
-
console.log(new browser_js_1.TextEncoder().encode('abc'));
|
|
6
|
-
console.log(new node_js_1.TextEncoder().encode('abc'));
|
package/build-tsc-esm/browser.js
DELETED
package/build-tsc-esm/node.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import util from 'node:util';
|
|
2
|
-
import { extractGlobal } from '@pezkuwi/x-global';
|
|
3
|
-
export { packageInfo } from './packageInfo.js';
|
|
4
|
-
class Fallback {
|
|
5
|
-
#encoder;
|
|
6
|
-
constructor() {
|
|
7
|
-
this.#encoder = new util.TextEncoder();
|
|
8
|
-
}
|
|
9
|
-
// For a Jest 26.0.1 environment, Buffer !== Uint8Array
|
|
10
|
-
encode(value) {
|
|
11
|
-
return Uint8Array.from(this.#encoder.encode(value));
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
export const TextEncoder = /*#__PURE__*/ extractGlobal('TextEncoder', Fallback);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const packageInfo = { name: '@pezkuwi/x-textencoder', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '14.0.13' };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './browser.js';
|
package/build-tsc-esm/shim.js
DELETED
package/src/browser.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @pezkuwi/x-textencoder authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { extractGlobal } from '@pezkuwi/x-global';
|
|
5
|
-
|
|
6
|
-
import { TextEncoder as Fallback } from './fallback.js';
|
|
7
|
-
|
|
8
|
-
export { packageInfo } from './packageInfo.js';
|
|
9
|
-
|
|
10
|
-
export const TextEncoder = /*#__PURE__*/ extractGlobal('TextEncoder', Fallback);
|
package/src/fallback.spec.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @pezkuwi/x-textencoder authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
/// <reference types="@pezkuwi/dev-test/globals.d.ts" />
|
|
5
|
-
|
|
6
|
-
import { TextEncoder } from './fallback.js';
|
|
7
|
-
|
|
8
|
-
describe('TextEncoder (fallback)', (): void => {
|
|
9
|
-
it('encodes correctly', (): void => {
|
|
10
|
-
expect(
|
|
11
|
-
new TextEncoder().encode('abc')
|
|
12
|
-
).toEqual(new Uint8Array([97, 98, 99]));
|
|
13
|
-
});
|
|
14
|
-
});
|
package/src/fallback.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @pezkuwi/x-textencoder authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
// This is very limited, only handling Ascii values
|
|
5
|
-
export class TextEncoder {
|
|
6
|
-
encode (value: string): Uint8Array {
|
|
7
|
-
const count = value.length;
|
|
8
|
-
const u8a = new Uint8Array(count);
|
|
9
|
-
|
|
10
|
-
for (let i = 0; i < count; i++) {
|
|
11
|
-
u8a[i] = value.charCodeAt(i);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return u8a;
|
|
15
|
-
}
|
|
16
|
-
}
|
package/src/mod.ts
DELETED
package/src/node.spec.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @pezkuwi/x-textencoder authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
/// <reference types="@pezkuwi/dev-test/globals.d.ts" />
|
|
5
|
-
|
|
6
|
-
import { xglobal } from '@pezkuwi/x-global';
|
|
7
|
-
|
|
8
|
-
// @ts-expect-error Clearing this, it is obviously not valid in normal code
|
|
9
|
-
xglobal.TextEncoder = undefined;
|
|
10
|
-
|
|
11
|
-
describe('TextEncoder (node)', (): void => {
|
|
12
|
-
let TE: typeof TextEncoder;
|
|
13
|
-
|
|
14
|
-
beforeEach(async (): Promise<void> => {
|
|
15
|
-
const node = await import('./node.js');
|
|
16
|
-
|
|
17
|
-
TE = node.TextEncoder;
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('encodes correctly', (): void => {
|
|
21
|
-
expect(
|
|
22
|
-
new TE().encode('abc')
|
|
23
|
-
).toEqual(new Uint8Array([97, 98, 99]));
|
|
24
|
-
});
|
|
25
|
-
});
|
package/src/node.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @pezkuwi/x-textencoder authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import util from 'node:util';
|
|
5
|
-
|
|
6
|
-
import { extractGlobal } from '@pezkuwi/x-global';
|
|
7
|
-
|
|
8
|
-
export { packageInfo } from './packageInfo.js';
|
|
9
|
-
|
|
10
|
-
class Fallback {
|
|
11
|
-
#encoder: util.TextEncoder;
|
|
12
|
-
|
|
13
|
-
constructor () {
|
|
14
|
-
this.#encoder = new util.TextEncoder();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// For a Jest 26.0.1 environment, Buffer !== Uint8Array
|
|
18
|
-
encode (value: string): Uint8Array {
|
|
19
|
-
return Uint8Array.from(this.#encoder.encode(value));
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const TextEncoder = /*#__PURE__*/ extractGlobal('TextEncoder', Fallback);
|
package/src/packageInfo.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2026 @pezkuwi/x-textencoder authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
// Do not edit, auto-generated by @pezkuwi/dev
|
|
5
|
-
|
|
6
|
-
export const packageInfo = { name: '@pezkuwi/x-textencoder', path: 'auto', type: 'auto', version: '14.0.13' };
|
package/src/react-native.ts
DELETED
package/src/shim.ts
DELETED
package/src/typeCheck.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Copyright 2017-2025 @pezkuwi/x-textencoder authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { TextEncoder as BrowserTE } from './browser.js';
|
|
5
|
-
import { TextEncoder as NodeTE } from './node.js';
|
|
6
|
-
|
|
7
|
-
console.log(new BrowserTE().encode('abc'));
|
|
8
|
-
console.log(new NodeTE().encode('abc'));
|
package/tsconfig.build.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../tsconfig.base.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"baseUrl": "..",
|
|
5
|
-
"outDir": "./build",
|
|
6
|
-
"rootDir": "./src"
|
|
7
|
-
},
|
|
8
|
-
"exclude": [
|
|
9
|
-
"**/mod.ts",
|
|
10
|
-
"**/*.spec.ts"
|
|
11
|
-
],
|
|
12
|
-
"references": [
|
|
13
|
-
{ "path": "../x-global/tsconfig.build.json" }
|
|
14
|
-
]
|
|
15
|
-
}
|