@nocobase/plugin-file-manager 1.5.19 → 1.5.21

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.
Files changed (42) hide show
  1. package/dist/client/index.js +1 -1
  2. package/dist/client/templates/file.d.ts +0 -24
  3. package/dist/externalVersion.js +7 -7
  4. package/dist/node_modules/@aws-sdk/client-s3/package.json +1 -1
  5. package/dist/node_modules/iconv-lite/.github/dependabot.yml +11 -0
  6. package/dist/node_modules/iconv-lite/.idea/codeStyles/Project.xml +47 -0
  7. package/dist/node_modules/iconv-lite/.idea/codeStyles/codeStyleConfig.xml +5 -0
  8. package/dist/node_modules/iconv-lite/.idea/iconv-lite.iml +12 -0
  9. package/dist/node_modules/iconv-lite/.idea/inspectionProfiles/Project_Default.xml +6 -0
  10. package/dist/node_modules/iconv-lite/.idea/modules.xml +8 -0
  11. package/dist/node_modules/iconv-lite/.idea/vcs.xml +6 -0
  12. package/dist/node_modules/iconv-lite/LICENSE +21 -0
  13. package/dist/node_modules/iconv-lite/encodings/dbcs-codec.js +597 -0
  14. package/dist/node_modules/iconv-lite/encodings/dbcs-data.js +188 -0
  15. package/dist/node_modules/iconv-lite/encodings/index.js +23 -0
  16. package/dist/node_modules/iconv-lite/encodings/internal.js +198 -0
  17. package/dist/node_modules/iconv-lite/encodings/sbcs-codec.js +72 -0
  18. package/dist/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
  19. package/dist/node_modules/iconv-lite/encodings/sbcs-data.js +179 -0
  20. package/dist/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
  21. package/dist/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
  22. package/dist/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
  23. package/dist/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
  24. package/dist/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
  25. package/dist/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
  26. package/dist/node_modules/iconv-lite/encodings/tables/gbk-added.json +56 -0
  27. package/dist/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
  28. package/dist/node_modules/iconv-lite/encodings/utf16.js +197 -0
  29. package/dist/node_modules/iconv-lite/encodings/utf32.js +319 -0
  30. package/dist/node_modules/iconv-lite/encodings/utf7.js +290 -0
  31. package/dist/node_modules/iconv-lite/lib/bom-handling.js +52 -0
  32. package/dist/node_modules/iconv-lite/lib/index.d.ts +41 -0
  33. package/dist/node_modules/iconv-lite/lib/index.js +1 -0
  34. package/dist/node_modules/iconv-lite/lib/streams.js +109 -0
  35. package/dist/node_modules/iconv-lite/package.json +1 -0
  36. package/dist/node_modules/mime-match/package.json +1 -1
  37. package/dist/node_modules/mkdirp/package.json +1 -1
  38. package/dist/node_modules/multer-aliyun-oss/package.json +1 -1
  39. package/dist/node_modules/multer-cos/package.json +1 -1
  40. package/dist/node_modules/multer-s3/package.json +1 -1
  41. package/dist/server/utils.js +4 -2
  42. package/package.json +3 -2
@@ -0,0 +1,197 @@
1
+ "use strict";
2
+ var Buffer = require("safer-buffer").Buffer;
3
+
4
+ // Note: UTF16-LE (or UCS2) codec is Node.js native. See encodings/internal.js
5
+
6
+ // == UTF16-BE codec. ==========================================================
7
+
8
+ exports.utf16be = Utf16BECodec;
9
+ function Utf16BECodec() {
10
+ }
11
+
12
+ Utf16BECodec.prototype.encoder = Utf16BEEncoder;
13
+ Utf16BECodec.prototype.decoder = Utf16BEDecoder;
14
+ Utf16BECodec.prototype.bomAware = true;
15
+
16
+
17
+ // -- Encoding
18
+
19
+ function Utf16BEEncoder() {
20
+ }
21
+
22
+ Utf16BEEncoder.prototype.write = function(str) {
23
+ var buf = Buffer.from(str, 'ucs2');
24
+ for (var i = 0; i < buf.length; i += 2) {
25
+ var tmp = buf[i]; buf[i] = buf[i+1]; buf[i+1] = tmp;
26
+ }
27
+ return buf;
28
+ }
29
+
30
+ Utf16BEEncoder.prototype.end = function() {
31
+ }
32
+
33
+
34
+ // -- Decoding
35
+
36
+ function Utf16BEDecoder() {
37
+ this.overflowByte = -1;
38
+ }
39
+
40
+ Utf16BEDecoder.prototype.write = function(buf) {
41
+ if (buf.length == 0)
42
+ return '';
43
+
44
+ var buf2 = Buffer.alloc(buf.length + 1),
45
+ i = 0, j = 0;
46
+
47
+ if (this.overflowByte !== -1) {
48
+ buf2[0] = buf[0];
49
+ buf2[1] = this.overflowByte;
50
+ i = 1; j = 2;
51
+ }
52
+
53
+ for (; i < buf.length-1; i += 2, j+= 2) {
54
+ buf2[j] = buf[i+1];
55
+ buf2[j+1] = buf[i];
56
+ }
57
+
58
+ this.overflowByte = (i == buf.length-1) ? buf[buf.length-1] : -1;
59
+
60
+ return buf2.slice(0, j).toString('ucs2');
61
+ }
62
+
63
+ Utf16BEDecoder.prototype.end = function() {
64
+ this.overflowByte = -1;
65
+ }
66
+
67
+
68
+ // == UTF-16 codec =============================================================
69
+ // Decoder chooses automatically from UTF-16LE and UTF-16BE using BOM and space-based heuristic.
70
+ // Defaults to UTF-16LE, as it's prevalent and default in Node.
71
+ // http://en.wikipedia.org/wiki/UTF-16 and http://encoding.spec.whatwg.org/#utf-16le
72
+ // Decoder default can be changed: iconv.decode(buf, 'utf16', {defaultEncoding: 'utf-16be'});
73
+
74
+ // Encoder uses UTF-16LE and prepends BOM (which can be overridden with addBOM: false).
75
+
76
+ exports.utf16 = Utf16Codec;
77
+ function Utf16Codec(codecOptions, iconv) {
78
+ this.iconv = iconv;
79
+ }
80
+
81
+ Utf16Codec.prototype.encoder = Utf16Encoder;
82
+ Utf16Codec.prototype.decoder = Utf16Decoder;
83
+
84
+
85
+ // -- Encoding (pass-through)
86
+
87
+ function Utf16Encoder(options, codec) {
88
+ options = options || {};
89
+ if (options.addBOM === undefined)
90
+ options.addBOM = true;
91
+ this.encoder = codec.iconv.getEncoder('utf-16le', options);
92
+ }
93
+
94
+ Utf16Encoder.prototype.write = function(str) {
95
+ return this.encoder.write(str);
96
+ }
97
+
98
+ Utf16Encoder.prototype.end = function() {
99
+ return this.encoder.end();
100
+ }
101
+
102
+
103
+ // -- Decoding
104
+
105
+ function Utf16Decoder(options, codec) {
106
+ this.decoder = null;
107
+ this.initialBufs = [];
108
+ this.initialBufsLen = 0;
109
+
110
+ this.options = options || {};
111
+ this.iconv = codec.iconv;
112
+ }
113
+
114
+ Utf16Decoder.prototype.write = function(buf) {
115
+ if (!this.decoder) {
116
+ // Codec is not chosen yet. Accumulate initial bytes.
117
+ this.initialBufs.push(buf);
118
+ this.initialBufsLen += buf.length;
119
+
120
+ if (this.initialBufsLen < 16) // We need more bytes to use space heuristic (see below)
121
+ return '';
122
+
123
+ // We have enough bytes -> detect endianness.
124
+ var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding);
125
+ this.decoder = this.iconv.getDecoder(encoding, this.options);
126
+
127
+ var resStr = '';
128
+ for (var i = 0; i < this.initialBufs.length; i++)
129
+ resStr += this.decoder.write(this.initialBufs[i]);
130
+
131
+ this.initialBufs.length = this.initialBufsLen = 0;
132
+ return resStr;
133
+ }
134
+
135
+ return this.decoder.write(buf);
136
+ }
137
+
138
+ Utf16Decoder.prototype.end = function() {
139
+ if (!this.decoder) {
140
+ var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding);
141
+ this.decoder = this.iconv.getDecoder(encoding, this.options);
142
+
143
+ var resStr = '';
144
+ for (var i = 0; i < this.initialBufs.length; i++)
145
+ resStr += this.decoder.write(this.initialBufs[i]);
146
+
147
+ var trail = this.decoder.end();
148
+ if (trail)
149
+ resStr += trail;
150
+
151
+ this.initialBufs.length = this.initialBufsLen = 0;
152
+ return resStr;
153
+ }
154
+ return this.decoder.end();
155
+ }
156
+
157
+ function detectEncoding(bufs, defaultEncoding) {
158
+ var b = [];
159
+ var charsProcessed = 0;
160
+ var asciiCharsLE = 0, asciiCharsBE = 0; // Number of ASCII chars when decoded as LE or BE.
161
+
162
+ outer_loop:
163
+ for (var i = 0; i < bufs.length; i++) {
164
+ var buf = bufs[i];
165
+ for (var j = 0; j < buf.length; j++) {
166
+ b.push(buf[j]);
167
+ if (b.length === 2) {
168
+ if (charsProcessed === 0) {
169
+ // Check BOM first.
170
+ if (b[0] === 0xFF && b[1] === 0xFE) return 'utf-16le';
171
+ if (b[0] === 0xFE && b[1] === 0xFF) return 'utf-16be';
172
+ }
173
+
174
+ if (b[0] === 0 && b[1] !== 0) asciiCharsBE++;
175
+ if (b[0] !== 0 && b[1] === 0) asciiCharsLE++;
176
+
177
+ b.length = 0;
178
+ charsProcessed++;
179
+
180
+ if (charsProcessed >= 100) {
181
+ break outer_loop;
182
+ }
183
+ }
184
+ }
185
+ }
186
+
187
+ // Make decisions.
188
+ // Most of the time, the content has ASCII chars (U+00**), but the opposite (U+**00) is uncommon.
189
+ // So, we count ASCII as if it was LE or BE, and decide from that.
190
+ if (asciiCharsBE > asciiCharsLE) return 'utf-16be';
191
+ if (asciiCharsBE < asciiCharsLE) return 'utf-16le';
192
+
193
+ // Couldn't decide (likely all zeros or not enough data).
194
+ return defaultEncoding || 'utf-16le';
195
+ }
196
+
197
+
@@ -0,0 +1,319 @@
1
+ 'use strict';
2
+
3
+ var Buffer = require('safer-buffer').Buffer;
4
+
5
+ // == UTF32-LE/BE codec. ==========================================================
6
+
7
+ exports._utf32 = Utf32Codec;
8
+
9
+ function Utf32Codec(codecOptions, iconv) {
10
+ this.iconv = iconv;
11
+ this.bomAware = true;
12
+ this.isLE = codecOptions.isLE;
13
+ }
14
+
15
+ exports.utf32le = { type: '_utf32', isLE: true };
16
+ exports.utf32be = { type: '_utf32', isLE: false };
17
+
18
+ // Aliases
19
+ exports.ucs4le = 'utf32le';
20
+ exports.ucs4be = 'utf32be';
21
+
22
+ Utf32Codec.prototype.encoder = Utf32Encoder;
23
+ Utf32Codec.prototype.decoder = Utf32Decoder;
24
+
25
+ // -- Encoding
26
+
27
+ function Utf32Encoder(options, codec) {
28
+ this.isLE = codec.isLE;
29
+ this.highSurrogate = 0;
30
+ }
31
+
32
+ Utf32Encoder.prototype.write = function(str) {
33
+ var src = Buffer.from(str, 'ucs2');
34
+ var dst = Buffer.alloc(src.length * 2);
35
+ var write32 = this.isLE ? dst.writeUInt32LE : dst.writeUInt32BE;
36
+ var offset = 0;
37
+
38
+ for (var i = 0; i < src.length; i += 2) {
39
+ var code = src.readUInt16LE(i);
40
+ var isHighSurrogate = (0xD800 <= code && code < 0xDC00);
41
+ var isLowSurrogate = (0xDC00 <= code && code < 0xE000);
42
+
43
+ if (this.highSurrogate) {
44
+ if (isHighSurrogate || !isLowSurrogate) {
45
+ // There shouldn't be two high surrogates in a row, nor a high surrogate which isn't followed by a low
46
+ // surrogate. If this happens, keep the pending high surrogate as a stand-alone semi-invalid character
47
+ // (technically wrong, but expected by some applications, like Windows file names).
48
+ write32.call(dst, this.highSurrogate, offset);
49
+ offset += 4;
50
+ }
51
+ else {
52
+ // Create 32-bit value from high and low surrogates;
53
+ var codepoint = (((this.highSurrogate - 0xD800) << 10) | (code - 0xDC00)) + 0x10000;
54
+
55
+ write32.call(dst, codepoint, offset);
56
+ offset += 4;
57
+ this.highSurrogate = 0;
58
+
59
+ continue;
60
+ }
61
+ }
62
+
63
+ if (isHighSurrogate)
64
+ this.highSurrogate = code;
65
+ else {
66
+ // Even if the current character is a low surrogate, with no previous high surrogate, we'll
67
+ // encode it as a semi-invalid stand-alone character for the same reasons expressed above for
68
+ // unpaired high surrogates.
69
+ write32.call(dst, code, offset);
70
+ offset += 4;
71
+ this.highSurrogate = 0;
72
+ }
73
+ }
74
+
75
+ if (offset < dst.length)
76
+ dst = dst.slice(0, offset);
77
+
78
+ return dst;
79
+ };
80
+
81
+ Utf32Encoder.prototype.end = function() {
82
+ // Treat any leftover high surrogate as a semi-valid independent character.
83
+ if (!this.highSurrogate)
84
+ return;
85
+
86
+ var buf = Buffer.alloc(4);
87
+
88
+ if (this.isLE)
89
+ buf.writeUInt32LE(this.highSurrogate, 0);
90
+ else
91
+ buf.writeUInt32BE(this.highSurrogate, 0);
92
+
93
+ this.highSurrogate = 0;
94
+
95
+ return buf;
96
+ };
97
+
98
+ // -- Decoding
99
+
100
+ function Utf32Decoder(options, codec) {
101
+ this.isLE = codec.isLE;
102
+ this.badChar = codec.iconv.defaultCharUnicode.charCodeAt(0);
103
+ this.overflow = [];
104
+ }
105
+
106
+ Utf32Decoder.prototype.write = function(src) {
107
+ if (src.length === 0)
108
+ return '';
109
+
110
+ var i = 0;
111
+ var codepoint = 0;
112
+ var dst = Buffer.alloc(src.length + 4);
113
+ var offset = 0;
114
+ var isLE = this.isLE;
115
+ var overflow = this.overflow;
116
+ var badChar = this.badChar;
117
+
118
+ if (overflow.length > 0) {
119
+ for (; i < src.length && overflow.length < 4; i++)
120
+ overflow.push(src[i]);
121
+
122
+ if (overflow.length === 4) {
123
+ // NOTE: codepoint is a signed int32 and can be negative.
124
+ // NOTE: We copied this block from below to help V8 optimize it (it works with array, not buffer).
125
+ if (isLE) {
126
+ codepoint = overflow[i] | (overflow[i+1] << 8) | (overflow[i+2] << 16) | (overflow[i+3] << 24);
127
+ } else {
128
+ codepoint = overflow[i+3] | (overflow[i+2] << 8) | (overflow[i+1] << 16) | (overflow[i] << 24);
129
+ }
130
+ overflow.length = 0;
131
+
132
+ offset = _writeCodepoint(dst, offset, codepoint, badChar);
133
+ }
134
+ }
135
+
136
+ // Main loop. Should be as optimized as possible.
137
+ for (; i < src.length - 3; i += 4) {
138
+ // NOTE: codepoint is a signed int32 and can be negative.
139
+ if (isLE) {
140
+ codepoint = src[i] | (src[i+1] << 8) | (src[i+2] << 16) | (src[i+3] << 24);
141
+ } else {
142
+ codepoint = src[i+3] | (src[i+2] << 8) | (src[i+1] << 16) | (src[i] << 24);
143
+ }
144
+ offset = _writeCodepoint(dst, offset, codepoint, badChar);
145
+ }
146
+
147
+ // Keep overflowing bytes.
148
+ for (; i < src.length; i++) {
149
+ overflow.push(src[i]);
150
+ }
151
+
152
+ return dst.slice(0, offset).toString('ucs2');
153
+ };
154
+
155
+ function _writeCodepoint(dst, offset, codepoint, badChar) {
156
+ // NOTE: codepoint is signed int32 and can be negative. We keep it that way to help V8 with optimizations.
157
+ if (codepoint < 0 || codepoint > 0x10FFFF) {
158
+ // Not a valid Unicode codepoint
159
+ codepoint = badChar;
160
+ }
161
+
162
+ // Ephemeral Planes: Write high surrogate.
163
+ if (codepoint >= 0x10000) {
164
+ codepoint -= 0x10000;
165
+
166
+ var high = 0xD800 | (codepoint >> 10);
167
+ dst[offset++] = high & 0xff;
168
+ dst[offset++] = high >> 8;
169
+
170
+ // Low surrogate is written below.
171
+ var codepoint = 0xDC00 | (codepoint & 0x3FF);
172
+ }
173
+
174
+ // Write BMP char or low surrogate.
175
+ dst[offset++] = codepoint & 0xff;
176
+ dst[offset++] = codepoint >> 8;
177
+
178
+ return offset;
179
+ };
180
+
181
+ Utf32Decoder.prototype.end = function() {
182
+ this.overflow.length = 0;
183
+ };
184
+
185
+ // == UTF-32 Auto codec =============================================================
186
+ // Decoder chooses automatically from UTF-32LE and UTF-32BE using BOM and space-based heuristic.
187
+ // Defaults to UTF-32LE. http://en.wikipedia.org/wiki/UTF-32
188
+ // Encoder/decoder default can be changed: iconv.decode(buf, 'utf32', {defaultEncoding: 'utf-32be'});
189
+
190
+ // Encoder prepends BOM (which can be overridden with (addBOM: false}).
191
+
192
+ exports.utf32 = Utf32AutoCodec;
193
+ exports.ucs4 = 'utf32';
194
+
195
+ function Utf32AutoCodec(options, iconv) {
196
+ this.iconv = iconv;
197
+ }
198
+
199
+ Utf32AutoCodec.prototype.encoder = Utf32AutoEncoder;
200
+ Utf32AutoCodec.prototype.decoder = Utf32AutoDecoder;
201
+
202
+ // -- Encoding
203
+
204
+ function Utf32AutoEncoder(options, codec) {
205
+ options = options || {};
206
+
207
+ if (options.addBOM === undefined)
208
+ options.addBOM = true;
209
+
210
+ this.encoder = codec.iconv.getEncoder(options.defaultEncoding || 'utf-32le', options);
211
+ }
212
+
213
+ Utf32AutoEncoder.prototype.write = function(str) {
214
+ return this.encoder.write(str);
215
+ };
216
+
217
+ Utf32AutoEncoder.prototype.end = function() {
218
+ return this.encoder.end();
219
+ };
220
+
221
+ // -- Decoding
222
+
223
+ function Utf32AutoDecoder(options, codec) {
224
+ this.decoder = null;
225
+ this.initialBufs = [];
226
+ this.initialBufsLen = 0;
227
+ this.options = options || {};
228
+ this.iconv = codec.iconv;
229
+ }
230
+
231
+ Utf32AutoDecoder.prototype.write = function(buf) {
232
+ if (!this.decoder) {
233
+ // Codec is not chosen yet. Accumulate initial bytes.
234
+ this.initialBufs.push(buf);
235
+ this.initialBufsLen += buf.length;
236
+
237
+ if (this.initialBufsLen < 32) // We need more bytes to use space heuristic (see below)
238
+ return '';
239
+
240
+ // We have enough bytes -> detect endianness.
241
+ var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding);
242
+ this.decoder = this.iconv.getDecoder(encoding, this.options);
243
+
244
+ var resStr = '';
245
+ for (var i = 0; i < this.initialBufs.length; i++)
246
+ resStr += this.decoder.write(this.initialBufs[i]);
247
+
248
+ this.initialBufs.length = this.initialBufsLen = 0;
249
+ return resStr;
250
+ }
251
+
252
+ return this.decoder.write(buf);
253
+ };
254
+
255
+ Utf32AutoDecoder.prototype.end = function() {
256
+ if (!this.decoder) {
257
+ var encoding = detectEncoding(this.initialBufs, this.options.defaultEncoding);
258
+ this.decoder = this.iconv.getDecoder(encoding, this.options);
259
+
260
+ var resStr = '';
261
+ for (var i = 0; i < this.initialBufs.length; i++)
262
+ resStr += this.decoder.write(this.initialBufs[i]);
263
+
264
+ var trail = this.decoder.end();
265
+ if (trail)
266
+ resStr += trail;
267
+
268
+ this.initialBufs.length = this.initialBufsLen = 0;
269
+ return resStr;
270
+ }
271
+
272
+ return this.decoder.end();
273
+ };
274
+
275
+ function detectEncoding(bufs, defaultEncoding) {
276
+ var b = [];
277
+ var charsProcessed = 0;
278
+ var invalidLE = 0, invalidBE = 0; // Number of invalid chars when decoded as LE or BE.
279
+ var bmpCharsLE = 0, bmpCharsBE = 0; // Number of BMP chars when decoded as LE or BE.
280
+
281
+ outer_loop:
282
+ for (var i = 0; i < bufs.length; i++) {
283
+ var buf = bufs[i];
284
+ for (var j = 0; j < buf.length; j++) {
285
+ b.push(buf[j]);
286
+ if (b.length === 4) {
287
+ if (charsProcessed === 0) {
288
+ // Check BOM first.
289
+ if (b[0] === 0xFF && b[1] === 0xFE && b[2] === 0 && b[3] === 0) {
290
+ return 'utf-32le';
291
+ }
292
+ if (b[0] === 0 && b[1] === 0 && b[2] === 0xFE && b[3] === 0xFF) {
293
+ return 'utf-32be';
294
+ }
295
+ }
296
+
297
+ if (b[0] !== 0 || b[1] > 0x10) invalidBE++;
298
+ if (b[3] !== 0 || b[2] > 0x10) invalidLE++;
299
+
300
+ if (b[0] === 0 && b[1] === 0 && (b[2] !== 0 || b[3] !== 0)) bmpCharsBE++;
301
+ if ((b[0] !== 0 || b[1] !== 0) && b[2] === 0 && b[3] === 0) bmpCharsLE++;
302
+
303
+ b.length = 0;
304
+ charsProcessed++;
305
+
306
+ if (charsProcessed >= 100) {
307
+ break outer_loop;
308
+ }
309
+ }
310
+ }
311
+ }
312
+
313
+ // Make decisions.
314
+ if (bmpCharsBE - invalidBE > bmpCharsLE - invalidLE) return 'utf-32be';
315
+ if (bmpCharsBE - invalidBE < bmpCharsLE - invalidLE) return 'utf-32le';
316
+
317
+ // Couldn't decide (likely all zeros or not enough data).
318
+ return defaultEncoding || 'utf-32le';
319
+ }