@pnpm/exe 11.0.0-beta.0 → 11.0.0-beta.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/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 +63952 -54674
- 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,122 +1,122 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
var Buffer = require("safer-buffer").Buffer
|
|
1
|
+
"use strict"
|
|
2
|
+
var Buffer = require("safer-buffer").Buffer
|
|
3
3
|
|
|
4
4
|
// UTF-7 codec, according to https://tools.ietf.org/html/rfc2152
|
|
5
5
|
// See also below a UTF-7-IMAP codec, according to http://tools.ietf.org/html/rfc3501#section-5.1.3
|
|
6
6
|
|
|
7
|
-
exports.utf7 = Utf7Codec
|
|
8
|
-
exports.unicode11utf7 =
|
|
9
|
-
function Utf7Codec(codecOptions, iconv) {
|
|
10
|
-
|
|
7
|
+
exports.utf7 = Utf7Codec
|
|
8
|
+
exports.unicode11utf7 = "utf7" // Alias UNICODE-1-1-UTF-7
|
|
9
|
+
function Utf7Codec (codecOptions, iconv) {
|
|
10
|
+
this.iconv = iconv
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
Utf7Codec.prototype.encoder = Utf7Encoder
|
|
14
|
-
Utf7Codec.prototype.decoder = Utf7Decoder
|
|
15
|
-
Utf7Codec.prototype.bomAware = true
|
|
16
|
-
|
|
13
|
+
Utf7Codec.prototype.encoder = Utf7Encoder
|
|
14
|
+
Utf7Codec.prototype.decoder = Utf7Decoder
|
|
15
|
+
Utf7Codec.prototype.bomAware = true
|
|
17
16
|
|
|
18
17
|
// -- Encoding
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
// Why scape ()?./?
|
|
20
|
+
// eslint-disable-next-line no-useless-escape
|
|
21
|
+
var nonDirectChars = /[^A-Za-z0-9'\(\),-\.\/:\? \n\r\t]+/g
|
|
21
22
|
|
|
22
|
-
function Utf7Encoder(options, codec) {
|
|
23
|
-
|
|
23
|
+
function Utf7Encoder (options, codec) {
|
|
24
|
+
this.iconv = codec.iconv
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
Utf7Encoder.prototype.write = function(str) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
Utf7Encoder.prototype.write = function (str) {
|
|
28
|
+
// Naive implementation.
|
|
29
|
+
// Non-direct chars are encoded as "+<base64>-"; single "+" char is encoded as "+-".
|
|
30
|
+
return Buffer.from(str.replace(nonDirectChars, function (chunk) {
|
|
31
|
+
return "+" + (chunk === "+"
|
|
32
|
+
? ""
|
|
33
|
+
: this.iconv.encode(chunk, "utf16-be").toString("base64").replace(/=+$/, "")) +
|
|
34
|
+
"-"
|
|
35
|
+
}.bind(this)))
|
|
34
36
|
}
|
|
35
37
|
|
|
36
|
-
Utf7Encoder.prototype.end = function() {
|
|
38
|
+
Utf7Encoder.prototype.end = function () {
|
|
37
39
|
}
|
|
38
40
|
|
|
39
|
-
|
|
40
41
|
// -- Decoding
|
|
41
42
|
|
|
42
|
-
function Utf7Decoder(options, codec) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
function Utf7Decoder (options, codec) {
|
|
44
|
+
this.iconv = codec.iconv
|
|
45
|
+
this.inBase64 = false
|
|
46
|
+
this.base64Accum = ""
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (buf[i] != minusChar) // Minus is absorbed after base64.
|
|
82
|
-
i--;
|
|
83
|
-
|
|
84
|
-
lastI = i+1;
|
|
85
|
-
inBase64 = false;
|
|
86
|
-
base64Accum = '';
|
|
87
|
-
}
|
|
49
|
+
// Why scape /?
|
|
50
|
+
// eslint-disable-next-line no-useless-escape
|
|
51
|
+
var base64Regex = /[A-Za-z0-9\/+]/
|
|
52
|
+
var base64Chars = []
|
|
53
|
+
for (var i = 0; i < 256; i++) { base64Chars[i] = base64Regex.test(String.fromCharCode(i)) }
|
|
54
|
+
|
|
55
|
+
var plusChar = "+".charCodeAt(0)
|
|
56
|
+
var minusChar = "-".charCodeAt(0)
|
|
57
|
+
var andChar = "&".charCodeAt(0)
|
|
58
|
+
|
|
59
|
+
Utf7Decoder.prototype.write = function (buf) {
|
|
60
|
+
var res = ""; var lastI = 0
|
|
61
|
+
var inBase64 = this.inBase64
|
|
62
|
+
var base64Accum = this.base64Accum
|
|
63
|
+
|
|
64
|
+
// The decoder is more involved as we must handle chunks in stream.
|
|
65
|
+
|
|
66
|
+
for (var i = 0; i < buf.length; i++) {
|
|
67
|
+
if (!inBase64) { // We're in direct mode.
|
|
68
|
+
// Write direct chars until '+'
|
|
69
|
+
if (buf[i] == plusChar) {
|
|
70
|
+
res += this.iconv.decode(buf.slice(lastI, i), "ascii") // Write direct chars.
|
|
71
|
+
lastI = i + 1
|
|
72
|
+
inBase64 = true
|
|
73
|
+
}
|
|
74
|
+
} else { // We decode base64.
|
|
75
|
+
if (!base64Chars[buf[i]]) { // Base64 ended.
|
|
76
|
+
if (i == lastI && buf[i] == minusChar) { // "+-" -> "+"
|
|
77
|
+
res += "+"
|
|
78
|
+
} else {
|
|
79
|
+
var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i), "ascii")
|
|
80
|
+
res += this.iconv.decode(Buffer.from(b64str, "base64"), "utf16-be")
|
|
88
81
|
}
|
|
82
|
+
|
|
83
|
+
if (buf[i] != minusChar) // Minus is absorbed after base64.
|
|
84
|
+
{ i-- }
|
|
85
|
+
|
|
86
|
+
lastI = i + 1
|
|
87
|
+
inBase64 = false
|
|
88
|
+
base64Accum = ""
|
|
89
|
+
}
|
|
89
90
|
}
|
|
91
|
+
}
|
|
90
92
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
if (!inBase64) {
|
|
94
|
+
res += this.iconv.decode(buf.slice(lastI), "ascii") // Write direct chars.
|
|
95
|
+
} else {
|
|
96
|
+
var b64str = base64Accum + this.iconv.decode(buf.slice(lastI), "ascii")
|
|
95
97
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
var canBeDecoded = b64str.length - (b64str.length % 8) // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars.
|
|
99
|
+
base64Accum = b64str.slice(canBeDecoded) // The rest will be decoded in future.
|
|
100
|
+
b64str = b64str.slice(0, canBeDecoded)
|
|
99
101
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
+
res += this.iconv.decode(Buffer.from(b64str, "base64"), "utf16-be")
|
|
103
|
+
}
|
|
102
104
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
this.inBase64 = inBase64
|
|
106
|
+
this.base64Accum = base64Accum
|
|
105
107
|
|
|
106
|
-
|
|
108
|
+
return res
|
|
107
109
|
}
|
|
108
110
|
|
|
109
|
-
Utf7Decoder.prototype.end = function() {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
res = this.iconv.decode(Buffer.from(this.base64Accum, 'base64'), "utf16-be");
|
|
111
|
+
Utf7Decoder.prototype.end = function () {
|
|
112
|
+
var res = ""
|
|
113
|
+
if (this.inBase64 && this.base64Accum.length > 0) { res = this.iconv.decode(Buffer.from(this.base64Accum, "base64"), "utf16-be") }
|
|
113
114
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
this.inBase64 = false
|
|
116
|
+
this.base64Accum = ""
|
|
117
|
+
return res
|
|
117
118
|
}
|
|
118
119
|
|
|
119
|
-
|
|
120
120
|
// UTF-7-IMAP codec.
|
|
121
121
|
// RFC3501 Sec. 5.1.3 Modified UTF-7 (http://tools.ietf.org/html/rfc3501#section-5.1.3)
|
|
122
122
|
// Differences:
|
|
@@ -128,163 +128,156 @@ Utf7Decoder.prototype.end = function() {
|
|
|
128
128
|
// * String must end in non-shifted position.
|
|
129
129
|
// * "-&" while in base64 is not allowed.
|
|
130
130
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
this.iconv = iconv;
|
|
131
|
+
exports.utf7imap = Utf7IMAPCodec
|
|
132
|
+
function Utf7IMAPCodec (codecOptions, iconv) {
|
|
133
|
+
this.iconv = iconv
|
|
135
134
|
};
|
|
136
135
|
|
|
137
|
-
Utf7IMAPCodec.prototype.encoder = Utf7IMAPEncoder
|
|
138
|
-
Utf7IMAPCodec.prototype.decoder = Utf7IMAPDecoder
|
|
139
|
-
Utf7IMAPCodec.prototype.bomAware = true
|
|
140
|
-
|
|
136
|
+
Utf7IMAPCodec.prototype.encoder = Utf7IMAPEncoder
|
|
137
|
+
Utf7IMAPCodec.prototype.decoder = Utf7IMAPDecoder
|
|
138
|
+
Utf7IMAPCodec.prototype.bomAware = true
|
|
141
139
|
|
|
142
140
|
// -- Encoding
|
|
143
141
|
|
|
144
|
-
function Utf7IMAPEncoder(options, codec) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
142
|
+
function Utf7IMAPEncoder (options, codec) {
|
|
143
|
+
this.iconv = codec.iconv
|
|
144
|
+
this.inBase64 = false
|
|
145
|
+
this.base64Accum = Buffer.alloc(6)
|
|
146
|
+
this.base64AccumIdx = 0
|
|
149
147
|
}
|
|
150
148
|
|
|
151
|
-
Utf7IMAPEncoder.prototype.write = function(str) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
base64AccumIdx = 0;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
149
|
+
Utf7IMAPEncoder.prototype.write = function (str) {
|
|
150
|
+
var inBase64 = this.inBase64
|
|
151
|
+
var base64Accum = this.base64Accum
|
|
152
|
+
var base64AccumIdx = this.base64AccumIdx
|
|
153
|
+
var buf = Buffer.alloc(str.length * 5 + 10); var bufIdx = 0
|
|
154
|
+
|
|
155
|
+
for (var i = 0; i < str.length; i++) {
|
|
156
|
+
var uChar = str.charCodeAt(i)
|
|
157
|
+
if (uChar >= 0x20 && uChar <= 0x7E) { // Direct character or '&'.
|
|
158
|
+
if (inBase64) {
|
|
159
|
+
if (base64AccumIdx > 0) {
|
|
160
|
+
bufIdx += buf.write(base64Accum.slice(0, base64AccumIdx).toString("base64").replace(/\//g, ",").replace(/=+$/, ""), bufIdx)
|
|
161
|
+
base64AccumIdx = 0
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
buf[bufIdx++] = minusChar // Write '-', then go to direct mode.
|
|
165
|
+
inBase64 = false
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (!inBase64) {
|
|
169
|
+
buf[bufIdx++] = uChar // Write direct character
|
|
170
|
+
|
|
171
|
+
if (uChar === andChar) // Ampersand -> '&-'
|
|
172
|
+
{ buf[bufIdx++] = minusChar }
|
|
173
|
+
}
|
|
174
|
+
} else { // Non-direct character
|
|
175
|
+
if (!inBase64) {
|
|
176
|
+
buf[bufIdx++] = andChar // Write '&', then go to base64 mode.
|
|
177
|
+
inBase64 = true
|
|
178
|
+
}
|
|
179
|
+
if (inBase64) {
|
|
180
|
+
base64Accum[base64AccumIdx++] = uChar >> 8
|
|
181
|
+
base64Accum[base64AccumIdx++] = uChar & 0xFF
|
|
182
|
+
|
|
183
|
+
if (base64AccumIdx == base64Accum.length) {
|
|
184
|
+
bufIdx += buf.write(base64Accum.toString("base64").replace(/\//g, ","), bufIdx)
|
|
185
|
+
base64AccumIdx = 0
|
|
191
186
|
}
|
|
187
|
+
}
|
|
192
188
|
}
|
|
189
|
+
}
|
|
193
190
|
|
|
194
|
-
|
|
195
|
-
|
|
191
|
+
this.inBase64 = inBase64
|
|
192
|
+
this.base64AccumIdx = base64AccumIdx
|
|
196
193
|
|
|
197
|
-
|
|
194
|
+
return buf.slice(0, bufIdx)
|
|
198
195
|
}
|
|
199
196
|
|
|
200
|
-
Utf7IMAPEncoder.prototype.end = function() {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
buf[bufIdx++] = minusChar; // Write '-', then go to direct mode.
|
|
209
|
-
this.inBase64 = false;
|
|
197
|
+
Utf7IMAPEncoder.prototype.end = function () {
|
|
198
|
+
var buf = Buffer.alloc(10); var bufIdx = 0
|
|
199
|
+
if (this.inBase64) {
|
|
200
|
+
if (this.base64AccumIdx > 0) {
|
|
201
|
+
bufIdx += buf.write(this.base64Accum.slice(0, this.base64AccumIdx).toString("base64").replace(/\//g, ",").replace(/=+$/, ""), bufIdx)
|
|
202
|
+
this.base64AccumIdx = 0
|
|
210
203
|
}
|
|
211
204
|
|
|
212
|
-
|
|
213
|
-
|
|
205
|
+
buf[bufIdx++] = minusChar // Write '-', then go to direct mode.
|
|
206
|
+
this.inBase64 = false
|
|
207
|
+
}
|
|
214
208
|
|
|
209
|
+
return buf.slice(0, bufIdx)
|
|
210
|
+
}
|
|
215
211
|
|
|
216
212
|
// -- Decoding
|
|
217
213
|
|
|
218
|
-
function Utf7IMAPDecoder(options, codec) {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
214
|
+
function Utf7IMAPDecoder (options, codec) {
|
|
215
|
+
this.iconv = codec.iconv
|
|
216
|
+
this.inBase64 = false
|
|
217
|
+
this.base64Accum = ""
|
|
222
218
|
}
|
|
223
219
|
|
|
224
|
-
var base64IMAPChars = base64Chars.slice()
|
|
225
|
-
base64IMAPChars[
|
|
226
|
-
|
|
227
|
-
Utf7IMAPDecoder.prototype.write = function(buf) {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
if (buf[i] != minusChar) // Minus may be absorbed after base64.
|
|
253
|
-
i--;
|
|
254
|
-
|
|
255
|
-
lastI = i+1;
|
|
256
|
-
inBase64 = false;
|
|
257
|
-
base64Accum = '';
|
|
258
|
-
}
|
|
220
|
+
var base64IMAPChars = base64Chars.slice()
|
|
221
|
+
base64IMAPChars[",".charCodeAt(0)] = true
|
|
222
|
+
|
|
223
|
+
Utf7IMAPDecoder.prototype.write = function (buf) {
|
|
224
|
+
var res = ""; var lastI = 0
|
|
225
|
+
var inBase64 = this.inBase64
|
|
226
|
+
var base64Accum = this.base64Accum
|
|
227
|
+
|
|
228
|
+
// The decoder is more involved as we must handle chunks in stream.
|
|
229
|
+
// It is forgiving, closer to standard UTF-7 (for example, '-' is optional at the end).
|
|
230
|
+
|
|
231
|
+
for (var i = 0; i < buf.length; i++) {
|
|
232
|
+
if (!inBase64) { // We're in direct mode.
|
|
233
|
+
// Write direct chars until '&'
|
|
234
|
+
if (buf[i] == andChar) {
|
|
235
|
+
res += this.iconv.decode(buf.slice(lastI, i), "ascii") // Write direct chars.
|
|
236
|
+
lastI = i + 1
|
|
237
|
+
inBase64 = true
|
|
238
|
+
}
|
|
239
|
+
} else { // We decode base64.
|
|
240
|
+
if (!base64IMAPChars[buf[i]]) { // Base64 ended.
|
|
241
|
+
if (i == lastI && buf[i] == minusChar) { // "&-" -> "&"
|
|
242
|
+
res += "&"
|
|
243
|
+
} else {
|
|
244
|
+
var b64str = base64Accum + this.iconv.decode(buf.slice(lastI, i), "ascii").replace(/,/g, "/")
|
|
245
|
+
res += this.iconv.decode(Buffer.from(b64str, "base64"), "utf16-be")
|
|
259
246
|
}
|
|
260
|
-
}
|
|
261
247
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
} else {
|
|
265
|
-
var b64str = base64Accum + this.iconv.decode(buf.slice(lastI), "ascii").replace(/,/g, '/');
|
|
248
|
+
if (buf[i] != minusChar) // Minus may be absorbed after base64.
|
|
249
|
+
{ i-- }
|
|
266
250
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be");
|
|
251
|
+
lastI = i + 1
|
|
252
|
+
inBase64 = false
|
|
253
|
+
base64Accum = ""
|
|
254
|
+
}
|
|
272
255
|
}
|
|
256
|
+
}
|
|
273
257
|
|
|
274
|
-
|
|
275
|
-
this.
|
|
258
|
+
if (!inBase64) {
|
|
259
|
+
res += this.iconv.decode(buf.slice(lastI), "ascii") // Write direct chars.
|
|
260
|
+
} else {
|
|
261
|
+
var b64str = base64Accum + this.iconv.decode(buf.slice(lastI), "ascii").replace(/,/g, "/")
|
|
276
262
|
|
|
277
|
-
|
|
278
|
-
|
|
263
|
+
var canBeDecoded = b64str.length - (b64str.length % 8) // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars.
|
|
264
|
+
base64Accum = b64str.slice(canBeDecoded) // The rest will be decoded in future.
|
|
265
|
+
b64str = b64str.slice(0, canBeDecoded)
|
|
279
266
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
if (this.inBase64 && this.base64Accum.length > 0)
|
|
283
|
-
res = this.iconv.decode(Buffer.from(this.base64Accum, 'base64'), "utf16-be");
|
|
267
|
+
res += this.iconv.decode(Buffer.from(b64str, "base64"), "utf16-be")
|
|
268
|
+
}
|
|
284
269
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
270
|
+
this.inBase64 = inBase64
|
|
271
|
+
this.base64Accum = base64Accum
|
|
272
|
+
|
|
273
|
+
return res
|
|
288
274
|
}
|
|
289
275
|
|
|
276
|
+
Utf7IMAPDecoder.prototype.end = function () {
|
|
277
|
+
var res = ""
|
|
278
|
+
if (this.inBase64 && this.base64Accum.length > 0) { res = this.iconv.decode(Buffer.from(this.base64Accum, "base64"), "utf16-be") }
|
|
290
279
|
|
|
280
|
+
this.inBase64 = false
|
|
281
|
+
this.base64Accum = ""
|
|
282
|
+
return res
|
|
283
|
+
}
|
|
@@ -1,52 +1,48 @@
|
|
|
1
|
-
"use strict"
|
|
1
|
+
"use strict"
|
|
2
2
|
|
|
3
|
-
var BOMChar =
|
|
3
|
+
var BOMChar = "\uFEFF"
|
|
4
4
|
|
|
5
5
|
exports.PrependBOM = PrependBOMWrapper
|
|
6
|
-
function PrependBOMWrapper(encoder, options) {
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
function PrependBOMWrapper (encoder, options) {
|
|
7
|
+
this.encoder = encoder
|
|
8
|
+
this.addBOM = true
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
PrependBOMWrapper.prototype.write = function(str) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
PrependBOMWrapper.prototype.write = function (str) {
|
|
12
|
+
if (this.addBOM) {
|
|
13
|
+
str = BOMChar + str
|
|
14
|
+
this.addBOM = false
|
|
15
|
+
}
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
return this.encoder.write(str)
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
PrependBOMWrapper.prototype.end = function() {
|
|
21
|
-
|
|
20
|
+
PrependBOMWrapper.prototype.end = function () {
|
|
21
|
+
return this.encoder.end()
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
// ------------------------------------------------------------------------------
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
this.pass = false;
|
|
31
|
-
this.options = options || {};
|
|
26
|
+
exports.StripBOM = StripBOMWrapper
|
|
27
|
+
function StripBOMWrapper (decoder, options) {
|
|
28
|
+
this.decoder = decoder
|
|
29
|
+
this.pass = false
|
|
30
|
+
this.options = options || {}
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
StripBOMWrapper.prototype.write = function(buf) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return res;
|
|
33
|
+
StripBOMWrapper.prototype.write = function (buf) {
|
|
34
|
+
var res = this.decoder.write(buf)
|
|
35
|
+
if (this.pass || !res) { return res }
|
|
38
36
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
37
|
+
if (res[0] === BOMChar) {
|
|
38
|
+
res = res.slice(1)
|
|
39
|
+
if (typeof this.options.stripBOM === "function") { this.options.stripBOM() }
|
|
40
|
+
}
|
|
44
41
|
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
this.pass = true
|
|
43
|
+
return res
|
|
47
44
|
}
|
|
48
45
|
|
|
49
|
-
StripBOMWrapper.prototype.end = function() {
|
|
50
|
-
|
|
46
|
+
StripBOMWrapper.prototype.end = function () {
|
|
47
|
+
return this.decoder.end()
|
|
51
48
|
}
|
|
52
|
-
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict"
|
|
2
|
+
|
|
3
|
+
var hasOwn = typeof Object.hasOwn === "undefined" ? Function.call.bind(Object.prototype.hasOwnProperty) : Object.hasOwn
|
|
4
|
+
|
|
5
|
+
function mergeModules (target, module) {
|
|
6
|
+
for (var key in module) {
|
|
7
|
+
if (hasOwn(module, key)) {
|
|
8
|
+
target[key] = module[key]
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
module.exports = mergeModules
|