@pnpm/exe 11.0.0-beta.0 → 11.0.0-beta.2
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/dist/node_modules/@gar/promise-retry/lib/index.js +28 -0
- package/dist/node_modules/@gar/promise-retry/package.json +48 -0
- package/dist/node_modules/@npmcli/agent/package.json +7 -7
- package/dist/node_modules/@npmcli/fs/package.json +4 -4
- package/dist/node_modules/abbrev/package.json +11 -15
- package/dist/node_modules/cacache/package.json +10 -11
- package/dist/node_modules/glob/dist/commonjs/glob.js +2 -1
- package/dist/node_modules/glob/dist/commonjs/index.min.js +4 -0
- package/dist/node_modules/glob/dist/commonjs/pattern.js +4 -0
- package/dist/node_modules/glob/dist/esm/glob.js +2 -1
- package/dist/node_modules/glob/dist/esm/index.min.js +4 -0
- package/dist/node_modules/glob/dist/esm/pattern.js +4 -0
- package/dist/node_modules/glob/package.json +38 -37
- package/dist/node_modules/graceful-fs/graceful-fs.js +1 -1
- package/dist/node_modules/iconv-lite/encodings/dbcs-codec.js +460 -525
- package/dist/node_modules/iconv-lite/encodings/dbcs-data.js +179 -182
- package/dist/node_modules/iconv-lite/encodings/index.js +15 -15
- package/dist/node_modules/iconv-lite/encodings/internal.js +168 -148
- package/dist/node_modules/iconv-lite/encodings/sbcs-codec.js +55 -52
- package/dist/node_modules/iconv-lite/encodings/sbcs-data.js +174 -175
- package/dist/node_modules/iconv-lite/encodings/utf16.js +121 -131
- package/dist/node_modules/iconv-lite/encodings/utf32.js +226 -238
- package/dist/node_modules/iconv-lite/encodings/utf7.js +208 -215
- package/dist/node_modules/iconv-lite/lib/bom-handling.js +30 -34
- package/dist/node_modules/iconv-lite/lib/helpers/merge-exports.js +13 -0
- package/dist/node_modules/iconv-lite/lib/index.js +125 -123
- package/dist/node_modules/iconv-lite/lib/streams.js +92 -96
- package/dist/node_modules/iconv-lite/package.json +34 -8
- package/dist/node_modules/isexe/package.json +65 -18
- package/dist/node_modules/lru-cache/dist/commonjs/index.js +134 -85
- package/dist/node_modules/lru-cache/dist/commonjs/index.min.js +1 -1
- package/dist/node_modules/lru-cache/dist/esm/index.js +134 -85
- package/dist/node_modules/lru-cache/dist/esm/index.min.js +1 -1
- package/dist/node_modules/lru-cache/package.json +18 -41
- package/dist/node_modules/make-fetch-happen/lib/remote.js +1 -1
- package/dist/node_modules/make-fetch-happen/package.json +10 -10
- package/dist/node_modules/minipass-fetch/lib/body.js +25 -15
- package/dist/node_modules/minipass-fetch/package.json +7 -7
- package/dist/node_modules/minipass-sized/dist/commonjs/index.js +69 -0
- package/dist/node_modules/minipass-sized/dist/esm/index.js +64 -0
- package/dist/node_modules/minipass-sized/package.json +39 -9
- package/dist/node_modules/node-gyp/.release-please-manifest.json +1 -1
- package/dist/node_modules/node-gyp/bin/node-gyp.js +7 -0
- package/dist/node_modules/node-gyp/gyp/.release-please-manifest.json +1 -1
- package/dist/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +3 -3
- package/dist/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +26 -1
- package/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +1 -1
- package/dist/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +3 -4
- package/dist/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +1 -1
- package/dist/node_modules/node-gyp/gyp/pyproject.toml +1 -1
- package/dist/node_modules/node-gyp/lib/build.js +2 -2
- package/dist/node_modules/node-gyp/lib/find-python.js +2 -8
- package/dist/node_modules/node-gyp/lib/find-visualstudio.js +11 -5
- package/dist/node_modules/node-gyp/lib/install.js +1 -1
- package/dist/node_modules/node-gyp/lib/process-release.js +3 -3
- package/dist/node_modules/node-gyp/package.json +13 -13
- package/dist/node_modules/nopt/package.json +5 -5
- package/dist/node_modules/proc-log/lib/index.js +10 -5
- package/dist/node_modules/proc-log/package.json +5 -5
- package/dist/node_modules/retry/lib/retry.js +2 -2
- package/dist/node_modules/retry/lib/retry_operation.js +10 -6
- package/dist/node_modules/retry/package.json +6 -2
- package/dist/node_modules/ssri/lib/index.js +33 -63
- package/dist/node_modules/ssri/package.json +17 -17
- package/dist/node_modules/unique-filename/package.json +5 -5
- package/dist/node_modules/unique-slug/package.json +4 -4
- package/dist/node_modules/which/package.json +29 -20
- package/dist/pnpm.mjs +63969 -54688
- package/dist/worker.js +601 -2162
- package/package.json +8 -8
- package/dist/node_modules/@isaacs/cliui/dist/commonjs/ansi-regex/index.js +0 -16
- package/dist/node_modules/@isaacs/cliui/dist/commonjs/ansi-styles/index.js +0 -170
- package/dist/node_modules/@isaacs/cliui/dist/commonjs/eastasianwidth/index.js +0 -307
- package/dist/node_modules/@isaacs/cliui/dist/commonjs/emoji-regex/index.js +0 -7
- package/dist/node_modules/@isaacs/cliui/dist/commonjs/index.js +0 -322
- package/dist/node_modules/@isaacs/cliui/dist/commonjs/index.min.js +0 -12
- package/dist/node_modules/@isaacs/cliui/dist/commonjs/string-width/index.js +0 -49
- package/dist/node_modules/@isaacs/cliui/dist/commonjs/strip-ansi/index.js +0 -8
- package/dist/node_modules/@isaacs/cliui/dist/commonjs/wrap-ansi/index.js +0 -176
- package/dist/node_modules/@isaacs/cliui/dist/esm/ansi-regex/index.js +0 -12
- package/dist/node_modules/@isaacs/cliui/dist/esm/ansi-styles/index.js +0 -167
- package/dist/node_modules/@isaacs/cliui/dist/esm/eastasianwidth/index.js +0 -299
- package/dist/node_modules/@isaacs/cliui/dist/esm/emoji-regex/index.js +0 -3
- package/dist/node_modules/@isaacs/cliui/dist/esm/index.js +0 -317
- package/dist/node_modules/@isaacs/cliui/dist/esm/index.min.js +0 -12
- package/dist/node_modules/@isaacs/cliui/dist/esm/string-width/index.js +0 -46
- package/dist/node_modules/@isaacs/cliui/dist/esm/strip-ansi/index.js +0 -4
- package/dist/node_modules/@isaacs/cliui/dist/esm/wrap-ansi/index.js +0 -172
- package/dist/node_modules/@isaacs/cliui/package.json +0 -163
- package/dist/node_modules/cross-spawn/LICENSE +0 -21
- package/dist/node_modules/cross-spawn/index.js +0 -39
- package/dist/node_modules/cross-spawn/lib/enoent.js +0 -59
- package/dist/node_modules/cross-spawn/lib/parse.js +0 -91
- package/dist/node_modules/cross-spawn/lib/util/escape.js +0 -47
- package/dist/node_modules/cross-spawn/lib/util/readShebang.js +0 -23
- package/dist/node_modules/cross-spawn/lib/util/resolveCommand.js +0 -52
- package/dist/node_modules/cross-spawn/package.json +0 -73
- package/dist/node_modules/encoding/.prettierrc.js +0 -8
- package/dist/node_modules/encoding/LICENSE +0 -16
- package/dist/node_modules/encoding/lib/encoding.js +0 -83
- package/dist/node_modules/encoding/package.json +0 -18
- package/dist/node_modules/err-code/.eslintrc.json +0 -7
- package/dist/node_modules/err-code/bower.json +0 -30
- package/dist/node_modules/err-code/index.js +0 -47
- package/dist/node_modules/err-code/index.umd.js +0 -51
- package/dist/node_modules/err-code/package.json +0 -34
- package/dist/node_modules/foreground-child/LICENSE +0 -15
- package/dist/node_modules/foreground-child/dist/commonjs/all-signals.js +0 -58
- package/dist/node_modules/foreground-child/dist/commonjs/index.js +0 -123
- package/dist/node_modules/foreground-child/dist/commonjs/proxy-signals.js +0 -38
- package/dist/node_modules/foreground-child/dist/commonjs/watchdog.js +0 -50
- package/dist/node_modules/foreground-child/dist/esm/all-signals.js +0 -52
- package/dist/node_modules/foreground-child/dist/esm/index.js +0 -115
- package/dist/node_modules/foreground-child/dist/esm/proxy-signals.js +0 -34
- package/dist/node_modules/foreground-child/dist/esm/watchdog.js +0 -46
- package/dist/node_modules/foreground-child/package.json +0 -106
- package/dist/node_modules/glob/dist/esm/bin.d.mts +0 -3
- package/dist/node_modules/glob/dist/esm/bin.mjs +0 -346
- package/dist/node_modules/iconv-lite/.github/dependabot.yml +0 -11
- package/dist/node_modules/iconv-lite/.idea/codeStyles/Project.xml +0 -47
- package/dist/node_modules/iconv-lite/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/dist/node_modules/iconv-lite/.idea/iconv-lite.iml +0 -12
- package/dist/node_modules/iconv-lite/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/dist/node_modules/iconv-lite/.idea/modules.xml +0 -8
- package/dist/node_modules/iconv-lite/.idea/vcs.xml +0 -6
- package/dist/node_modules/isexe/LICENSE +0 -15
- package/dist/node_modules/isexe/index.js +0 -57
- package/dist/node_modules/isexe/mode.js +0 -41
- package/dist/node_modules/isexe/windows.js +0 -42
- package/dist/node_modules/jackspeak/dist/commonjs/index.js +0 -944
- package/dist/node_modules/jackspeak/dist/commonjs/index.min.js +0 -33
- package/dist/node_modules/jackspeak/dist/commonjs/package.json +0 -3
- package/dist/node_modules/jackspeak/dist/esm/index.js +0 -936
- package/dist/node_modules/jackspeak/dist/esm/index.min.js +0 -33
- package/dist/node_modules/jackspeak/dist/esm/package.json +0 -3
- package/dist/node_modules/jackspeak/package.json +0 -115
- package/dist/node_modules/lru-cache/LICENSE +0 -15
- package/dist/node_modules/minipass-sized/index.js +0 -67
- package/dist/node_modules/minipass-sized/node_modules/minipass/LICENSE +0 -15
- package/dist/node_modules/minipass-sized/node_modules/minipass/index.js +0 -649
- package/dist/node_modules/minipass-sized/node_modules/minipass/package.json +0 -56
- package/dist/node_modules/minipass-sized/package-lock.json +0 -3464
- package/dist/node_modules/node-gyp/node_modules/isexe/dist/commonjs/package.json +0 -3
- package/dist/node_modules/node-gyp/node_modules/isexe/dist/esm/package.json +0 -3
- package/dist/node_modules/node-gyp/node_modules/isexe/package.json +0 -78
- package/dist/node_modules/node-gyp/node_modules/which/LICENSE +0 -15
- package/dist/node_modules/node-gyp/node_modules/which/package.json +0 -52
- package/dist/node_modules/package-json-from-dist/dist/commonjs/index.js +0 -134
- package/dist/node_modules/package-json-from-dist/dist/commonjs/package.json +0 -3
- package/dist/node_modules/package-json-from-dist/dist/esm/index.js +0 -129
- package/dist/node_modules/package-json-from-dist/dist/esm/package.json +0 -3
- package/dist/node_modules/package-json-from-dist/package.json +0 -68
- package/dist/node_modules/path-key/index.js +0 -16
- package/dist/node_modules/path-key/license +0 -9
- package/dist/node_modules/path-key/package.json +0 -39
- package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.js +0 -1589
- package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/index.min.js +0 -2
- package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/commonjs/package.json +0 -3
- package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.js +0 -1585
- package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/esm/index.min.js +0 -2
- package/dist/node_modules/path-scurry/node_modules/lru-cache/dist/esm/package.json +0 -3
- package/dist/node_modules/path-scurry/node_modules/lru-cache/package.json +0 -101
- package/dist/node_modules/promise-retry/index.js +0 -52
- package/dist/node_modules/promise-retry/package.json +0 -37
- package/dist/node_modules/retry/equation.gif +0 -0
- package/dist/node_modules/shebang-command/index.js +0 -19
- package/dist/node_modules/shebang-command/license +0 -9
- package/dist/node_modules/shebang-command/package.json +0 -34
- package/dist/node_modules/shebang-regex/index.js +0 -2
- package/dist/node_modules/shebang-regex/license +0 -9
- package/dist/node_modules/shebang-regex/package.json +0 -35
- package/dist/node_modules/signal-exit/LICENSE.txt +0 -16
- package/dist/node_modules/signal-exit/dist/cjs/browser.js +0 -10
- package/dist/node_modules/signal-exit/dist/cjs/index.js +0 -279
- package/dist/node_modules/signal-exit/dist/cjs/package.json +0 -3
- package/dist/node_modules/signal-exit/dist/cjs/signals.js +0 -42
- package/dist/node_modules/signal-exit/dist/mjs/browser.js +0 -4
- package/dist/node_modules/signal-exit/dist/mjs/index.js +0 -275
- package/dist/node_modules/signal-exit/dist/mjs/package.json +0 -3
- package/dist/node_modules/signal-exit/dist/mjs/signals.js +0 -39
- package/dist/node_modules/signal-exit/package.json +0 -106
- package/dist/node_modules/which/bin/node-which +0 -52
- package/dist/node_modules/which/which.js +0 -125
- /package/dist/node_modules/{promise-retry → @gar/promise-retry}/LICENSE +0 -0
- /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/commonjs/index.js +0 -0
- /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/commonjs/index.min.js +0 -0
- /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/commonjs/options.js +0 -0
- /package/dist/node_modules/{@isaacs/cliui → isexe}/dist/commonjs/package.json +0 -0
- /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/commonjs/posix.js +0 -0
- /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/commonjs/win32.js +0 -0
- /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/esm/index.js +0 -0
- /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/esm/index.min.js +0 -0
- /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/esm/options.js +0 -0
- /package/dist/node_modules/{@isaacs/cliui → isexe}/dist/esm/package.json +0 -0
- /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/esm/posix.js +0 -0
- /package/dist/node_modules/{node-gyp/node_modules/isexe → isexe}/dist/esm/win32.js +0 -0
- /package/dist/node_modules/{foreground-child → minipass-sized}/dist/commonjs/package.json +0 -0
- /package/dist/node_modules/{foreground-child → minipass-sized}/dist/esm/package.json +0 -0
- /package/dist/node_modules/{node-gyp/node_modules/which → which}/bin/which.js +0 -0
- /package/dist/node_modules/{node-gyp/node_modules/which → which}/lib/index.js +0 -0
|
@@ -1,134 +1,136 @@
|
|
|
1
|
-
"use strict"
|
|
1
|
+
"use strict"
|
|
2
2
|
|
|
3
|
-
var Buffer = require("safer-buffer").Buffer
|
|
3
|
+
var Buffer = require("safer-buffer").Buffer
|
|
4
4
|
|
|
5
|
-
var bomHandling = require("./bom-handling")
|
|
6
|
-
|
|
5
|
+
var bomHandling = require("./bom-handling")
|
|
6
|
+
var mergeModules = require("./helpers/merge-exports")
|
|
7
7
|
|
|
8
8
|
// All codecs and aliases are kept here, keyed by encoding name/alias.
|
|
9
9
|
// They are lazy loaded in `iconv.getCodec` from `encodings/index.js`.
|
|
10
|
-
|
|
10
|
+
// Cannot initialize with { __proto__: null } because Boolean({ __proto__: null }) === true
|
|
11
|
+
module.exports.encodings = null
|
|
11
12
|
|
|
12
13
|
// Characters emitted in case of error.
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
module.exports.defaultCharUnicode = "�"
|
|
15
|
+
module.exports.defaultCharSingleByte = "?"
|
|
15
16
|
|
|
16
17
|
// Public API.
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
module.exports.encode = function encode (str, encoding, options) {
|
|
19
|
+
str = "" + (str || "") // Ensure string.
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
var encoder = module.exports.getEncoder(encoding, options)
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return (trail && trail.length > 0) ? Buffer.concat([res, trail]) : res;
|
|
26
|
-
}
|
|
23
|
+
var res = encoder.write(str)
|
|
24
|
+
var trail = encoder.end()
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (!iconv.skipDecodeWarning) {
|
|
31
|
-
console.error('Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding');
|
|
32
|
-
iconv.skipDecodeWarning = true;
|
|
33
|
-
}
|
|
26
|
+
return (trail && trail.length > 0) ? Buffer.concat([res, trail]) : res
|
|
27
|
+
}
|
|
34
28
|
|
|
35
|
-
|
|
29
|
+
module.exports.decode = function decode (buf, encoding, options) {
|
|
30
|
+
if (typeof buf === "string") {
|
|
31
|
+
if (!module.exports.skipDecodeWarning) {
|
|
32
|
+
console.error("Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding")
|
|
33
|
+
module.exports.skipDecodeWarning = true
|
|
36
34
|
}
|
|
37
35
|
|
|
38
|
-
|
|
36
|
+
buf = Buffer.from("" + (buf || ""), "binary") // Ensure buffer.
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var decoder = module.exports.getDecoder(encoding, options)
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
var res = decoder.write(buf)
|
|
42
|
+
var trail = decoder.end()
|
|
42
43
|
|
|
43
|
-
|
|
44
|
+
return trail ? (res + trail) : res
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
module.exports.encodingExists = function encodingExists (enc) {
|
|
48
|
+
try {
|
|
49
|
+
module.exports.getCodec(enc)
|
|
50
|
+
return true
|
|
51
|
+
} catch (e) {
|
|
52
|
+
return false
|
|
53
|
+
}
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
// Legacy aliases to convert functions
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
module.exports.toEncoding = module.exports.encode
|
|
58
|
+
module.exports.fromEncoding = module.exports.decode
|
|
58
59
|
|
|
59
60
|
// Search for a codec in iconv.encodings. Cache codec data in iconv._codecDataCache.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
61
|
+
module.exports._codecDataCache = { __proto__: null }
|
|
62
|
+
|
|
63
|
+
module.exports.getCodec = function getCodec (encoding) {
|
|
64
|
+
if (!module.exports.encodings) {
|
|
65
|
+
var raw = require("../encodings")
|
|
66
|
+
// TODO: In future versions when old nodejs support is removed can use object.assign
|
|
67
|
+
module.exports.encodings = { __proto__: null } // Initialize as empty object.
|
|
68
|
+
mergeModules(module.exports.encodings, raw)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Canonicalize encoding name: strip all non-alphanumeric chars and appended year.
|
|
72
|
+
var enc = module.exports._canonicalizeEncoding(encoding)
|
|
73
|
+
|
|
74
|
+
// Traverse iconv.encodings to find actual codec.
|
|
75
|
+
var codecOptions = {}
|
|
76
|
+
while (true) {
|
|
77
|
+
var codec = module.exports._codecDataCache[enc]
|
|
78
|
+
|
|
79
|
+
if (codec) { return codec }
|
|
80
|
+
|
|
81
|
+
var codecDef = module.exports.encodings[enc]
|
|
82
|
+
|
|
83
|
+
switch (typeof codecDef) {
|
|
84
|
+
case "string": // Direct alias to other encoding.
|
|
85
|
+
enc = codecDef
|
|
86
|
+
break
|
|
87
|
+
|
|
88
|
+
case "object": // Alias with options. Can be layered.
|
|
89
|
+
for (var key in codecDef) { codecOptions[key] = codecDef[key] }
|
|
90
|
+
|
|
91
|
+
if (!codecOptions.encodingName) { codecOptions.encodingName = enc }
|
|
92
|
+
|
|
93
|
+
enc = codecDef.type
|
|
94
|
+
break
|
|
95
|
+
|
|
96
|
+
case "function": // Codec itself.
|
|
97
|
+
if (!codecOptions.encodingName) { codecOptions.encodingName = enc }
|
|
98
|
+
|
|
99
|
+
// The codec function must load all tables and return object with .encoder and .decoder methods.
|
|
100
|
+
// It'll be called only once (for each different options object).
|
|
101
|
+
//
|
|
102
|
+
codec = new codecDef(codecOptions, module.exports)
|
|
103
|
+
|
|
104
|
+
module.exports._codecDataCache[codecOptions.encodingName] = codec // Save it to be reused later.
|
|
105
|
+
return codec
|
|
106
|
+
|
|
107
|
+
default:
|
|
108
|
+
throw new Error("Encoding not recognized: '" + encoding + "' (searched as: '" + enc + "')")
|
|
106
109
|
}
|
|
110
|
+
}
|
|
107
111
|
}
|
|
108
112
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
113
|
+
module.exports._canonicalizeEncoding = function (encoding) {
|
|
114
|
+
// Canonicalize encoding name: strip all non-alphanumeric chars and appended year.
|
|
115
|
+
return ("" + encoding).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g, "")
|
|
112
116
|
}
|
|
113
117
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
118
|
+
module.exports.getEncoder = function getEncoder (encoding, options) {
|
|
119
|
+
var codec = module.exports.getCodec(encoding)
|
|
120
|
+
var encoder = new codec.encoder(options, codec)
|
|
117
121
|
|
|
118
|
-
|
|
119
|
-
encoder = new bomHandling.PrependBOM(encoder, options);
|
|
122
|
+
if (codec.bomAware && options && options.addBOM) { encoder = new bomHandling.PrependBOM(encoder, options) }
|
|
120
123
|
|
|
121
|
-
|
|
124
|
+
return encoder
|
|
122
125
|
}
|
|
123
126
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
+
module.exports.getDecoder = function getDecoder (encoding, options) {
|
|
128
|
+
var codec = module.exports.getCodec(encoding)
|
|
129
|
+
var decoder = new codec.decoder(options, codec)
|
|
127
130
|
|
|
128
|
-
|
|
129
|
-
decoder = new bomHandling.StripBOM(decoder, options);
|
|
131
|
+
if (codec.bomAware && !(options && options.stripBOM === false)) { decoder = new bomHandling.StripBOM(decoder, options) }
|
|
130
132
|
|
|
131
|
-
|
|
133
|
+
return decoder
|
|
132
134
|
}
|
|
133
135
|
|
|
134
136
|
// Streaming API
|
|
@@ -136,45 +138,45 @@ iconv.getDecoder = function getDecoder(encoding, options) {
|
|
|
136
138
|
// up to 100Kb to the output bundle. To avoid unnecessary code bloat, we don't enable Streaming API in browser by default.
|
|
137
139
|
// If you would like to enable it explicitly, please add the following code to your app:
|
|
138
140
|
// > iconv.enableStreamingAPI(require('stream'));
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
return;
|
|
141
|
+
module.exports.enableStreamingAPI = function enableStreamingAPI (streamModule) {
|
|
142
|
+
if (module.exports.supportsStreams) { return }
|
|
142
143
|
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
// Dependency-inject stream module to create IconvLite stream classes.
|
|
145
|
+
var streams = require("./streams")(streamModule)
|
|
145
146
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
// Not public API yet, but expose the stream classes.
|
|
148
|
+
module.exports.IconvLiteEncoderStream = streams.IconvLiteEncoderStream
|
|
149
|
+
module.exports.IconvLiteDecoderStream = streams.IconvLiteDecoderStream
|
|
149
150
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
// Streaming API.
|
|
152
|
+
module.exports.encodeStream = function encodeStream (encoding, options) {
|
|
153
|
+
return new module.exports.IconvLiteEncoderStream(module.exports.getEncoder(encoding, options), options)
|
|
154
|
+
}
|
|
154
155
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
module.exports.decodeStream = function decodeStream (encoding, options) {
|
|
157
|
+
return new module.exports.IconvLiteDecoderStream(module.exports.getDecoder(encoding, options), options)
|
|
158
|
+
}
|
|
158
159
|
|
|
159
|
-
|
|
160
|
+
module.exports.supportsStreams = true
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
// Enable Streaming API automatically if 'stream' module is available and non-empty (the majority of environments).
|
|
163
|
-
var
|
|
164
|
+
var streamModule
|
|
164
165
|
try {
|
|
165
|
-
|
|
166
|
+
streamModule = require("stream")
|
|
166
167
|
} catch (e) {}
|
|
167
168
|
|
|
168
|
-
if (
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
if (streamModule && streamModule.Transform) {
|
|
170
|
+
module.exports.enableStreamingAPI(streamModule)
|
|
171
171
|
} else {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
172
|
+
// In rare cases where 'stream' module is not available by default, throw a helpful exception.
|
|
173
|
+
module.exports.encodeStream = module.exports.decodeStream = function () {
|
|
174
|
+
throw new Error("iconv-lite Streaming API is not enabled. Use iconv.enableStreamingAPI(require('stream')); to enable it.")
|
|
175
|
+
}
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
// Some environments, such as browsers, may not load JavaScript files as UTF-8
|
|
179
|
+
// eslint-disable-next-line no-constant-condition
|
|
180
|
+
if ("Ā" !== "\u0100") {
|
|
181
|
+
console.error("iconv-lite warning: js files use non-utf8 encoding. See https://github.com/ashtuchkin/iconv-lite/wiki/Javascript-source-file-encodings for more info.")
|
|
180
182
|
}
|
|
@@ -1,109 +1,105 @@
|
|
|
1
|
-
"use strict"
|
|
1
|
+
"use strict"
|
|
2
2
|
|
|
3
|
-
var Buffer = require("safer-buffer").Buffer
|
|
3
|
+
var Buffer = require("safer-buffer").Buffer
|
|
4
4
|
|
|
5
|
-
// NOTE: Due to 'stream' module being pretty large (~100Kb, significant in browser environments),
|
|
5
|
+
// NOTE: Due to 'stream' module being pretty large (~100Kb, significant in browser environments),
|
|
6
6
|
// we opt to dependency-inject it instead of creating a hard dependency.
|
|
7
|
-
module.exports = function(
|
|
8
|
-
|
|
7
|
+
module.exports = function (streamModule) {
|
|
8
|
+
var Transform = streamModule.Transform
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
// == Encoder stream =======================================================
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
function IconvLiteEncoderStream (conv, options) {
|
|
13
|
+
this.conv = conv
|
|
14
|
+
options = options || {}
|
|
15
|
+
options.decodeStrings = false // We accept only strings, so we don't need to decode them.
|
|
16
|
+
Transform.call(this, options)
|
|
17
|
+
}
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
IconvLiteEncoderStream.prototype._transform = function(chunk, encoding, done) {
|
|
24
|
-
if (typeof chunk != 'string')
|
|
25
|
-
return done(new Error("Iconv encoding stream needs strings as its input."));
|
|
26
|
-
try {
|
|
27
|
-
var res = this.conv.write(chunk);
|
|
28
|
-
if (res && res.length) this.push(res);
|
|
29
|
-
done();
|
|
30
|
-
}
|
|
31
|
-
catch (e) {
|
|
32
|
-
done(e);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
19
|
+
IconvLiteEncoderStream.prototype = Object.create(Transform.prototype, {
|
|
20
|
+
constructor: { value: IconvLiteEncoderStream }
|
|
21
|
+
})
|
|
35
22
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (res && res.length) this.push(res);
|
|
40
|
-
done();
|
|
41
|
-
}
|
|
42
|
-
catch (e) {
|
|
43
|
-
done(e);
|
|
44
|
-
}
|
|
23
|
+
IconvLiteEncoderStream.prototype._transform = function (chunk, encoding, done) {
|
|
24
|
+
if (typeof chunk !== "string") {
|
|
25
|
+
return done(new Error("Iconv encoding stream needs strings as its input."))
|
|
45
26
|
}
|
|
46
27
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
54
|
-
return this;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
// == Decoder stream =======================================================
|
|
59
|
-
|
|
60
|
-
function IconvLiteDecoderStream(conv, options) {
|
|
61
|
-
this.conv = conv;
|
|
62
|
-
options = options || {};
|
|
63
|
-
options.encoding = this.encoding = 'utf8'; // We output strings.
|
|
64
|
-
Transform.call(this, options);
|
|
28
|
+
try {
|
|
29
|
+
var res = this.conv.write(chunk)
|
|
30
|
+
if (res && res.length) this.push(res)
|
|
31
|
+
done()
|
|
32
|
+
} catch (e) {
|
|
33
|
+
done(e)
|
|
65
34
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
var res = this.conv.write(chunk);
|
|
76
|
-
if (res && res.length) this.push(res, this.encoding);
|
|
77
|
-
done();
|
|
78
|
-
}
|
|
79
|
-
catch (e) {
|
|
80
|
-
done(e);
|
|
81
|
-
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
IconvLiteEncoderStream.prototype._flush = function (done) {
|
|
38
|
+
try {
|
|
39
|
+
var res = this.conv.end()
|
|
40
|
+
if (res && res.length) this.push(res)
|
|
41
|
+
done()
|
|
42
|
+
} catch (e) {
|
|
43
|
+
done(e)
|
|
82
44
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
IconvLiteEncoderStream.prototype.collect = function (cb) {
|
|
48
|
+
var chunks = []
|
|
49
|
+
this.on("error", cb)
|
|
50
|
+
this.on("data", function (chunk) { chunks.push(chunk) })
|
|
51
|
+
this.on("end", function () {
|
|
52
|
+
cb(null, Buffer.concat(chunks))
|
|
53
|
+
})
|
|
54
|
+
return this
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// == Decoder stream =======================================================
|
|
58
|
+
|
|
59
|
+
function IconvLiteDecoderStream (conv, options) {
|
|
60
|
+
this.conv = conv
|
|
61
|
+
options = options || {}
|
|
62
|
+
options.encoding = this.encoding = "utf8" // We output strings.
|
|
63
|
+
Transform.call(this, options)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
IconvLiteDecoderStream.prototype = Object.create(Transform.prototype, {
|
|
67
|
+
constructor: { value: IconvLiteDecoderStream }
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
IconvLiteDecoderStream.prototype._transform = function (chunk, encoding, done) {
|
|
71
|
+
if (!Buffer.isBuffer(chunk) && !(chunk instanceof Uint8Array)) { return done(new Error("Iconv decoding stream needs buffers as its input.")) }
|
|
72
|
+
try {
|
|
73
|
+
var res = this.conv.write(chunk)
|
|
74
|
+
if (res && res.length) this.push(res, this.encoding)
|
|
75
|
+
done()
|
|
76
|
+
} catch (e) {
|
|
77
|
+
done(e)
|
|
93
78
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
IconvLiteDecoderStream.prototype._flush = function (done) {
|
|
82
|
+
try {
|
|
83
|
+
var res = this.conv.end()
|
|
84
|
+
if (res && res.length) this.push(res, this.encoding)
|
|
85
|
+
done()
|
|
86
|
+
} catch (e) {
|
|
87
|
+
done(e)
|
|
103
88
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
IconvLiteDecoderStream.prototype.collect = function (cb) {
|
|
92
|
+
var res = ""
|
|
93
|
+
this.on("error", cb)
|
|
94
|
+
this.on("data", function (chunk) { res += chunk })
|
|
95
|
+
this.on("end", function () {
|
|
96
|
+
cb(null, res)
|
|
97
|
+
})
|
|
98
|
+
return this
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return {
|
|
102
|
+
IconvLiteEncoderStream: IconvLiteEncoderStream,
|
|
103
|
+
IconvLiteDecoderStream: IconvLiteDecoderStream
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iconv-lite",
|
|
3
3
|
"description": "Convert character encodings in pure javascript.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.7.2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"iconv",
|
|
@@ -12,30 +12,56 @@
|
|
|
12
12
|
"author": "Alexander Shtuchkin <ashtuchkin@gmail.com>",
|
|
13
13
|
"main": "./lib/index.js",
|
|
14
14
|
"typings": "./lib/index.d.ts",
|
|
15
|
-
"homepage": "https://github.com/
|
|
16
|
-
"bugs": "https://github.com/
|
|
15
|
+
"homepage": "https://github.com/pillarjs/iconv-lite",
|
|
16
|
+
"bugs": "https://github.com/pillarjs/iconv-lite/issues",
|
|
17
|
+
"files": [
|
|
18
|
+
"lib/",
|
|
19
|
+
"encodings/",
|
|
20
|
+
"types/"
|
|
21
|
+
],
|
|
22
|
+
"funding": {
|
|
23
|
+
"type": "opencollective",
|
|
24
|
+
"url": "https://opencollective.com/express"
|
|
25
|
+
},
|
|
17
26
|
"repository": {
|
|
18
27
|
"type": "git",
|
|
19
|
-
"url": "
|
|
28
|
+
"url": "https://github.com/pillarjs/iconv-lite.git"
|
|
20
29
|
},
|
|
21
30
|
"engines": {
|
|
22
31
|
"node": ">=0.10.0"
|
|
23
32
|
},
|
|
24
33
|
"scripts": {
|
|
25
|
-
"
|
|
26
|
-
"
|
|
34
|
+
"lint": "eslint",
|
|
35
|
+
"lint:fix": "eslint --fix",
|
|
36
|
+
"test": "mocha --reporter spec --check-leaks --grep .",
|
|
37
|
+
"test:ci": "nyc --exclude test --reporter=lcovonly --reporter=text npm test",
|
|
38
|
+
"test:cov": "nyc --exclude test --reporter=html --reporter=text npm test",
|
|
39
|
+
"test:performance": "node --allow-natives-syntax performance/index.js",
|
|
40
|
+
"test:tap": "mocha --reporter tap --check-leaks --grep .",
|
|
41
|
+
"test:typescript": "tsc && attw --pack",
|
|
42
|
+
"test:webpack": "npm pack && mv iconv-lite-*.tgz test/webpack/iconv-lite.tgz && cd test/webpack && npm install && npm run test && rm iconv-lite.tgz",
|
|
43
|
+
"typegen": "node generation/gen-typings.js"
|
|
27
44
|
},
|
|
28
45
|
"browser": {
|
|
29
46
|
"stream": false
|
|
30
47
|
},
|
|
31
48
|
"devDependencies": {
|
|
49
|
+
"@arethetypeswrong/cli": "^0.17.4",
|
|
50
|
+
"@stylistic/eslint-plugin": "^5.1.0",
|
|
51
|
+
"@stylistic/eslint-plugin-js": "^4.1.0",
|
|
52
|
+
"@types/node": "^24.0.12",
|
|
32
53
|
"async": "^3.2.0",
|
|
33
|
-
"
|
|
54
|
+
"bench-node": "^0.10.0",
|
|
55
|
+
"eslint": "^9.0.0",
|
|
34
56
|
"errto": "^0.2.1",
|
|
57
|
+
"expect-type": "^1.2.0",
|
|
35
58
|
"iconv": "^2.3.5",
|
|
36
|
-
"mocha": "^
|
|
59
|
+
"mocha": "^6.2.2",
|
|
60
|
+
"neostandard": "^0.12.0",
|
|
61
|
+
"nyc": "^14.1.1",
|
|
37
62
|
"request": "^2.88.2",
|
|
38
63
|
"semver": "^6.3.0",
|
|
64
|
+
"typescript": "~5.9.2",
|
|
39
65
|
"unorm": "^1.6.0"
|
|
40
66
|
},
|
|
41
67
|
"dependencies": {
|