cdktn 0.23.0 → 0.23.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.
Files changed (125) hide show
  1. package/.jsii +1560 -1559
  2. package/.spec.swcrc +22 -0
  3. package/jest.config.js +18 -15
  4. package/lib/_tokens.js +1 -1
  5. package/lib/annotations.js +2 -2
  6. package/lib/app.js +2 -2
  7. package/lib/aspect.js +2 -2
  8. package/lib/backends/azurerm-backend.js +3 -3
  9. package/lib/backends/cloud-backend.js +5 -5
  10. package/lib/backends/consul-backend.js +3 -3
  11. package/lib/backends/cos-backend.js +3 -3
  12. package/lib/backends/gcs-backend.js +3 -3
  13. package/lib/backends/http-backend.js +3 -3
  14. package/lib/backends/index.js +1 -1
  15. package/lib/backends/local-backend.js +3 -3
  16. package/lib/backends/oss-backend.js +3 -3
  17. package/lib/backends/pg-backend.js +3 -3
  18. package/lib/backends/remote-backend.js +5 -5
  19. package/lib/backends/s3-backend.js +3 -3
  20. package/lib/backends/swift-backend.js +3 -3
  21. package/lib/complex-computed-list.js +24 -24
  22. package/lib/errors.js +1 -1
  23. package/lib/features.js +1 -1
  24. package/lib/functions/helpers.js +1 -1
  25. package/lib/functions/terraform-functions.generated.js +2 -2
  26. package/lib/hcl/render.js +1 -1
  27. package/lib/importable-resource.js +2 -2
  28. package/lib/index.js +1 -1
  29. package/lib/manifest.js +2 -2
  30. package/lib/private/fs.d.ts +20 -5
  31. package/lib/private/fs.js +43 -69
  32. package/lib/private/unique.js +1 -1
  33. package/lib/resource.js +2 -2
  34. package/lib/runtime.js +1 -1
  35. package/lib/synthesize/index.js +1 -1
  36. package/lib/synthesize/synthesizer.js +1 -1
  37. package/lib/synthesize/types.js +1 -1
  38. package/lib/terraform-addressable.js +1 -1
  39. package/lib/terraform-asset.js +2 -2
  40. package/lib/terraform-backend.js +2 -2
  41. package/lib/terraform-conditions.js +1 -1
  42. package/lib/terraform-count.js +2 -2
  43. package/lib/terraform-data-resource.js +2 -2
  44. package/lib/terraform-data-source.js +2 -2
  45. package/lib/terraform-dependable.js +1 -1
  46. package/lib/terraform-dynamic-block.js +1 -1
  47. package/lib/terraform-dynamic-expression.js +1 -1
  48. package/lib/terraform-element.js +2 -2
  49. package/lib/terraform-functions.js +2 -2
  50. package/lib/terraform-hcl-module.js +2 -2
  51. package/lib/terraform-iterator.js +6 -6
  52. package/lib/terraform-local.js +2 -2
  53. package/lib/terraform-module-asset.js +1 -1
  54. package/lib/terraform-module.js +2 -2
  55. package/lib/terraform-operators.js +2 -2
  56. package/lib/terraform-output.js +2 -2
  57. package/lib/terraform-provider.js +2 -2
  58. package/lib/terraform-provisioner.js +2 -2
  59. package/lib/terraform-remote-state.js +2 -2
  60. package/lib/terraform-resource-targets.js +2 -2
  61. package/lib/terraform-resource.js +2 -2
  62. package/lib/terraform-stack.js +2 -2
  63. package/lib/terraform-variable.js +3 -3
  64. package/lib/testing/adapters/jest.js +1 -1
  65. package/lib/testing/index.js +2 -2
  66. package/lib/testing/matchers.js +2 -2
  67. package/lib/tfExpression.js +1 -1
  68. package/lib/tokens/index.js +1 -1
  69. package/lib/tokens/lazy.js +3 -3
  70. package/lib/tokens/private/dependency.js +1 -1
  71. package/lib/tokens/private/encoding.js +1 -1
  72. package/lib/tokens/private/intrinsic.js +1 -1
  73. package/lib/tokens/private/resolve.js +1 -1
  74. package/lib/tokens/private/stack-trace.js +1 -1
  75. package/lib/tokens/private/token-map.js +1 -1
  76. package/lib/tokens/private/uniqueid.js +1 -1
  77. package/lib/tokens/resolvable.js +3 -3
  78. package/lib/tokens/string-fragments.js +2 -2
  79. package/lib/tokens/token.js +3 -3
  80. package/lib/tsconfig.tsbuildinfo +1 -0
  81. package/lib/upgrade-id-aspect.js +2 -2
  82. package/lib/util.js +1 -1
  83. package/lib/validateEnvironment.js +1 -1
  84. package/lib/validations/index.js +1 -1
  85. package/lib/validations/validate-binary-version.js +1 -1
  86. package/lib/validations/validate-provider-presence.js +1 -1
  87. package/lib/validations/validate-terraform-version.js +1 -1
  88. package/node_modules/fflate/CHANGELOG.md +115 -0
  89. package/node_modules/{yazl → fflate}/LICENSE +3 -3
  90. package/node_modules/fflate/README.md +558 -0
  91. package/node_modules/fflate/esm/browser.d.ts +1501 -0
  92. package/node_modules/fflate/esm/browser.js +2665 -0
  93. package/node_modules/fflate/esm/index.d.mts +1501 -0
  94. package/node_modules/fflate/esm/index.mjs +2679 -0
  95. package/node_modules/fflate/lib/browser.cjs +2688 -0
  96. package/node_modules/fflate/lib/browser.d.cts +1501 -0
  97. package/node_modules/fflate/lib/index.cjs +2668 -0
  98. package/node_modules/fflate/lib/index.d.ts +1501 -0
  99. package/node_modules/fflate/lib/node-worker.cjs +32 -0
  100. package/node_modules/fflate/lib/node.cjs +2700 -0
  101. package/node_modules/fflate/lib/node.d.cts +1501 -0
  102. package/node_modules/fflate/lib/worker.cjs +20 -0
  103. package/node_modules/fflate/package.json +127 -0
  104. package/node_modules/fflate/umd/index.js +1 -0
  105. package/package.json +95 -89
  106. package/tsconfig.json +6 -3
  107. package/tsconfig.test.json +12 -0
  108. package/lib/testing/__tests__/matchers.test.d.ts +0 -1
  109. package/lib/testing/__tests__/matchers.test.js +0 -205
  110. package/lib/testing/adapters/__tests__/index.test.d.ts +0 -1
  111. package/lib/testing/adapters/__tests__/index.test.js +0 -67
  112. package/lib/testing/adapters/__tests__/jest.test.d.ts +0 -1
  113. package/lib/testing/adapters/__tests__/jest.test.js +0 -41
  114. package/node_modules/buffer-crc32/LICENSE +0 -19
  115. package/node_modules/buffer-crc32/README.md +0 -55
  116. package/node_modules/buffer-crc32/dist/index.cjs +0 -306
  117. package/node_modules/buffer-crc32/dist/index.d.cts +0 -35
  118. package/node_modules/buffer-crc32/dist/index.d.mts +0 -35
  119. package/node_modules/buffer-crc32/dist/index.mjs +0 -304
  120. package/node_modules/buffer-crc32/index.d.ts +0 -35
  121. package/node_modules/buffer-crc32/package.json +0 -54
  122. package/node_modules/yazl/README.md +0 -457
  123. package/node_modules/yazl/index.js +0 -826
  124. package/node_modules/yazl/package.json +0 -34
  125. package/tsconfig.tsbuildinfo +0 -1
@@ -1,306 +0,0 @@
1
- 'use strict';
2
-
3
- function getDefaultExportFromCjs (x) {
4
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5
- }
6
-
7
- const CRC_TABLE = new Int32Array([
8
- 0,
9
- 1996959894,
10
- 3993919788,
11
- 2567524794,
12
- 124634137,
13
- 1886057615,
14
- 3915621685,
15
- 2657392035,
16
- 249268274,
17
- 2044508324,
18
- 3772115230,
19
- 2547177864,
20
- 162941995,
21
- 2125561021,
22
- 3887607047,
23
- 2428444049,
24
- 498536548,
25
- 1789927666,
26
- 4089016648,
27
- 2227061214,
28
- 450548861,
29
- 1843258603,
30
- 4107580753,
31
- 2211677639,
32
- 325883990,
33
- 1684777152,
34
- 4251122042,
35
- 2321926636,
36
- 335633487,
37
- 1661365465,
38
- 4195302755,
39
- 2366115317,
40
- 997073096,
41
- 1281953886,
42
- 3579855332,
43
- 2724688242,
44
- 1006888145,
45
- 1258607687,
46
- 3524101629,
47
- 2768942443,
48
- 901097722,
49
- 1119000684,
50
- 3686517206,
51
- 2898065728,
52
- 853044451,
53
- 1172266101,
54
- 3705015759,
55
- 2882616665,
56
- 651767980,
57
- 1373503546,
58
- 3369554304,
59
- 3218104598,
60
- 565507253,
61
- 1454621731,
62
- 3485111705,
63
- 3099436303,
64
- 671266974,
65
- 1594198024,
66
- 3322730930,
67
- 2970347812,
68
- 795835527,
69
- 1483230225,
70
- 3244367275,
71
- 3060149565,
72
- 1994146192,
73
- 31158534,
74
- 2563907772,
75
- 4023717930,
76
- 1907459465,
77
- 112637215,
78
- 2680153253,
79
- 3904427059,
80
- 2013776290,
81
- 251722036,
82
- 2517215374,
83
- 3775830040,
84
- 2137656763,
85
- 141376813,
86
- 2439277719,
87
- 3865271297,
88
- 1802195444,
89
- 476864866,
90
- 2238001368,
91
- 4066508878,
92
- 1812370925,
93
- 453092731,
94
- 2181625025,
95
- 4111451223,
96
- 1706088902,
97
- 314042704,
98
- 2344532202,
99
- 4240017532,
100
- 1658658271,
101
- 366619977,
102
- 2362670323,
103
- 4224994405,
104
- 1303535960,
105
- 984961486,
106
- 2747007092,
107
- 3569037538,
108
- 1256170817,
109
- 1037604311,
110
- 2765210733,
111
- 3554079995,
112
- 1131014506,
113
- 879679996,
114
- 2909243462,
115
- 3663771856,
116
- 1141124467,
117
- 855842277,
118
- 2852801631,
119
- 3708648649,
120
- 1342533948,
121
- 654459306,
122
- 3188396048,
123
- 3373015174,
124
- 1466479909,
125
- 544179635,
126
- 3110523913,
127
- 3462522015,
128
- 1591671054,
129
- 702138776,
130
- 2966460450,
131
- 3352799412,
132
- 1504918807,
133
- 783551873,
134
- 3082640443,
135
- 3233442989,
136
- 3988292384,
137
- 2596254646,
138
- 62317068,
139
- 1957810842,
140
- 3939845945,
141
- 2647816111,
142
- 81470997,
143
- 1943803523,
144
- 3814918930,
145
- 2489596804,
146
- 225274430,
147
- 2053790376,
148
- 3826175755,
149
- 2466906013,
150
- 167816743,
151
- 2097651377,
152
- 4027552580,
153
- 2265490386,
154
- 503444072,
155
- 1762050814,
156
- 4150417245,
157
- 2154129355,
158
- 426522225,
159
- 1852507879,
160
- 4275313526,
161
- 2312317920,
162
- 282753626,
163
- 1742555852,
164
- 4189708143,
165
- 2394877945,
166
- 397917763,
167
- 1622183637,
168
- 3604390888,
169
- 2714866558,
170
- 953729732,
171
- 1340076626,
172
- 3518719985,
173
- 2797360999,
174
- 1068828381,
175
- 1219638859,
176
- 3624741850,
177
- 2936675148,
178
- 906185462,
179
- 1090812512,
180
- 3747672003,
181
- 2825379669,
182
- 829329135,
183
- 1181335161,
184
- 3412177804,
185
- 3160834842,
186
- 628085408,
187
- 1382605366,
188
- 3423369109,
189
- 3138078467,
190
- 570562233,
191
- 1426400815,
192
- 3317316542,
193
- 2998733608,
194
- 733239954,
195
- 1555261956,
196
- 3268935591,
197
- 3050360625,
198
- 752459403,
199
- 1541320221,
200
- 2607071920,
201
- 3965973030,
202
- 1969922972,
203
- 40735498,
204
- 2617837225,
205
- 3943577151,
206
- 1913087877,
207
- 83908371,
208
- 2512341634,
209
- 3803740692,
210
- 2075208622,
211
- 213261112,
212
- 2463272603,
213
- 3855990285,
214
- 2094854071,
215
- 198958881,
216
- 2262029012,
217
- 4057260610,
218
- 1759359992,
219
- 534414190,
220
- 2176718541,
221
- 4139329115,
222
- 1873836001,
223
- 414664567,
224
- 2282248934,
225
- 4279200368,
226
- 1711684554,
227
- 285281116,
228
- 2405801727,
229
- 4167216745,
230
- 1634467795,
231
- 376229701,
232
- 2685067896,
233
- 3608007406,
234
- 1308918612,
235
- 956543938,
236
- 2808555105,
237
- 3495958263,
238
- 1231636301,
239
- 1047427035,
240
- 2932959818,
241
- 3654703836,
242
- 1088359270,
243
- 936918e3,
244
- 2847714899,
245
- 3736837829,
246
- 1202900863,
247
- 817233897,
248
- 3183342108,
249
- 3401237130,
250
- 1404277552,
251
- 615818150,
252
- 3134207493,
253
- 3453421203,
254
- 1423857449,
255
- 601450431,
256
- 3009837614,
257
- 3294710456,
258
- 1567103746,
259
- 711928724,
260
- 3020668471,
261
- 3272380065,
262
- 1510334235,
263
- 755167117
264
- ]);
265
- function ensureBuffer(input) {
266
- if (Buffer.isBuffer(input)) {
267
- return input;
268
- }
269
- if (typeof input === "number") {
270
- return Buffer.alloc(input);
271
- } else if (typeof input === "string") {
272
- return Buffer.from(input);
273
- } else {
274
- throw new Error("input must be buffer, number, or string, received " + typeof input);
275
- }
276
- }
277
- function bufferizeInt(num) {
278
- const tmp = ensureBuffer(4);
279
- tmp.writeInt32BE(num, 0);
280
- return tmp;
281
- }
282
- function _crc32(buf, previous) {
283
- buf = ensureBuffer(buf);
284
- if (Buffer.isBuffer(previous)) {
285
- previous = previous.readUInt32BE(0);
286
- }
287
- let crc = ~~previous ^ -1;
288
- for (var n = 0; n < buf.length; n++) {
289
- crc = CRC_TABLE[(crc ^ buf[n]) & 255] ^ crc >>> 8;
290
- }
291
- return crc ^ -1;
292
- }
293
- function crc32() {
294
- return bufferizeInt(_crc32.apply(null, arguments));
295
- }
296
- crc32.signed = function() {
297
- return _crc32.apply(null, arguments);
298
- };
299
- crc32.unsigned = function() {
300
- return _crc32.apply(null, arguments) >>> 0;
301
- };
302
- var bufferCrc32 = crc32;
303
-
304
- const index = /*@__PURE__*/getDefaultExportFromCjs(bufferCrc32);
305
-
306
- module.exports = index;
@@ -1,35 +0,0 @@
1
- /// <reference types="node" />
2
-
3
- /**
4
- * These definitions were written by BendingBender (https://github.com/BendingBender)
5
- */
6
-
7
- export = crc32;
8
-
9
- declare function crc32(input: string | Buffer, partialCrc?: Buffer | number): Buffer;
10
-
11
- declare namespace crc32 {
12
- /**
13
- * Convenience method that returns a signed int instead of a `Buffer`.
14
- *
15
- * @example
16
- * import crc32 = require('buffer-crc32');
17
- *
18
- * // works with buffers
19
- * const buf = Buffer.from([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00]);
20
- * crc32.signed(buf); // -> -1805997238
21
- */
22
- function signed(buffer: string | Buffer, partialCrc?: Buffer | number): number;
23
-
24
- /**
25
- * Convenience method that returns an unsigned int instead of a `Buffer`.
26
- *
27
- * @example
28
- * import crc32 = require('buffer-crc32');
29
- *
30
- * // works with buffers
31
- * const buf = Buffer.from([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00]);
32
- * crc32.unsigned(buf); // -> 2488970058
33
- */
34
- function unsigned(buffer: string | Buffer, partialCrc?: Buffer | number): number;
35
- }
@@ -1,35 +0,0 @@
1
- /// <reference types="node" />
2
-
3
- /**
4
- * These definitions were written by BendingBender (https://github.com/BendingBender)
5
- */
6
-
7
- export = crc32;
8
-
9
- declare function crc32(input: string | Buffer, partialCrc?: Buffer | number): Buffer;
10
-
11
- declare namespace crc32 {
12
- /**
13
- * Convenience method that returns a signed int instead of a `Buffer`.
14
- *
15
- * @example
16
- * import crc32 = require('buffer-crc32');
17
- *
18
- * // works with buffers
19
- * const buf = Buffer.from([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00]);
20
- * crc32.signed(buf); // -> -1805997238
21
- */
22
- function signed(buffer: string | Buffer, partialCrc?: Buffer | number): number;
23
-
24
- /**
25
- * Convenience method that returns an unsigned int instead of a `Buffer`.
26
- *
27
- * @example
28
- * import crc32 = require('buffer-crc32');
29
- *
30
- * // works with buffers
31
- * const buf = Buffer.from([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00]);
32
- * crc32.unsigned(buf); // -> 2488970058
33
- */
34
- function unsigned(buffer: string | Buffer, partialCrc?: Buffer | number): number;
35
- }
@@ -1,304 +0,0 @@
1
- function getDefaultExportFromCjs (x) {
2
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
3
- }
4
-
5
- const CRC_TABLE = new Int32Array([
6
- 0,
7
- 1996959894,
8
- 3993919788,
9
- 2567524794,
10
- 124634137,
11
- 1886057615,
12
- 3915621685,
13
- 2657392035,
14
- 249268274,
15
- 2044508324,
16
- 3772115230,
17
- 2547177864,
18
- 162941995,
19
- 2125561021,
20
- 3887607047,
21
- 2428444049,
22
- 498536548,
23
- 1789927666,
24
- 4089016648,
25
- 2227061214,
26
- 450548861,
27
- 1843258603,
28
- 4107580753,
29
- 2211677639,
30
- 325883990,
31
- 1684777152,
32
- 4251122042,
33
- 2321926636,
34
- 335633487,
35
- 1661365465,
36
- 4195302755,
37
- 2366115317,
38
- 997073096,
39
- 1281953886,
40
- 3579855332,
41
- 2724688242,
42
- 1006888145,
43
- 1258607687,
44
- 3524101629,
45
- 2768942443,
46
- 901097722,
47
- 1119000684,
48
- 3686517206,
49
- 2898065728,
50
- 853044451,
51
- 1172266101,
52
- 3705015759,
53
- 2882616665,
54
- 651767980,
55
- 1373503546,
56
- 3369554304,
57
- 3218104598,
58
- 565507253,
59
- 1454621731,
60
- 3485111705,
61
- 3099436303,
62
- 671266974,
63
- 1594198024,
64
- 3322730930,
65
- 2970347812,
66
- 795835527,
67
- 1483230225,
68
- 3244367275,
69
- 3060149565,
70
- 1994146192,
71
- 31158534,
72
- 2563907772,
73
- 4023717930,
74
- 1907459465,
75
- 112637215,
76
- 2680153253,
77
- 3904427059,
78
- 2013776290,
79
- 251722036,
80
- 2517215374,
81
- 3775830040,
82
- 2137656763,
83
- 141376813,
84
- 2439277719,
85
- 3865271297,
86
- 1802195444,
87
- 476864866,
88
- 2238001368,
89
- 4066508878,
90
- 1812370925,
91
- 453092731,
92
- 2181625025,
93
- 4111451223,
94
- 1706088902,
95
- 314042704,
96
- 2344532202,
97
- 4240017532,
98
- 1658658271,
99
- 366619977,
100
- 2362670323,
101
- 4224994405,
102
- 1303535960,
103
- 984961486,
104
- 2747007092,
105
- 3569037538,
106
- 1256170817,
107
- 1037604311,
108
- 2765210733,
109
- 3554079995,
110
- 1131014506,
111
- 879679996,
112
- 2909243462,
113
- 3663771856,
114
- 1141124467,
115
- 855842277,
116
- 2852801631,
117
- 3708648649,
118
- 1342533948,
119
- 654459306,
120
- 3188396048,
121
- 3373015174,
122
- 1466479909,
123
- 544179635,
124
- 3110523913,
125
- 3462522015,
126
- 1591671054,
127
- 702138776,
128
- 2966460450,
129
- 3352799412,
130
- 1504918807,
131
- 783551873,
132
- 3082640443,
133
- 3233442989,
134
- 3988292384,
135
- 2596254646,
136
- 62317068,
137
- 1957810842,
138
- 3939845945,
139
- 2647816111,
140
- 81470997,
141
- 1943803523,
142
- 3814918930,
143
- 2489596804,
144
- 225274430,
145
- 2053790376,
146
- 3826175755,
147
- 2466906013,
148
- 167816743,
149
- 2097651377,
150
- 4027552580,
151
- 2265490386,
152
- 503444072,
153
- 1762050814,
154
- 4150417245,
155
- 2154129355,
156
- 426522225,
157
- 1852507879,
158
- 4275313526,
159
- 2312317920,
160
- 282753626,
161
- 1742555852,
162
- 4189708143,
163
- 2394877945,
164
- 397917763,
165
- 1622183637,
166
- 3604390888,
167
- 2714866558,
168
- 953729732,
169
- 1340076626,
170
- 3518719985,
171
- 2797360999,
172
- 1068828381,
173
- 1219638859,
174
- 3624741850,
175
- 2936675148,
176
- 906185462,
177
- 1090812512,
178
- 3747672003,
179
- 2825379669,
180
- 829329135,
181
- 1181335161,
182
- 3412177804,
183
- 3160834842,
184
- 628085408,
185
- 1382605366,
186
- 3423369109,
187
- 3138078467,
188
- 570562233,
189
- 1426400815,
190
- 3317316542,
191
- 2998733608,
192
- 733239954,
193
- 1555261956,
194
- 3268935591,
195
- 3050360625,
196
- 752459403,
197
- 1541320221,
198
- 2607071920,
199
- 3965973030,
200
- 1969922972,
201
- 40735498,
202
- 2617837225,
203
- 3943577151,
204
- 1913087877,
205
- 83908371,
206
- 2512341634,
207
- 3803740692,
208
- 2075208622,
209
- 213261112,
210
- 2463272603,
211
- 3855990285,
212
- 2094854071,
213
- 198958881,
214
- 2262029012,
215
- 4057260610,
216
- 1759359992,
217
- 534414190,
218
- 2176718541,
219
- 4139329115,
220
- 1873836001,
221
- 414664567,
222
- 2282248934,
223
- 4279200368,
224
- 1711684554,
225
- 285281116,
226
- 2405801727,
227
- 4167216745,
228
- 1634467795,
229
- 376229701,
230
- 2685067896,
231
- 3608007406,
232
- 1308918612,
233
- 956543938,
234
- 2808555105,
235
- 3495958263,
236
- 1231636301,
237
- 1047427035,
238
- 2932959818,
239
- 3654703836,
240
- 1088359270,
241
- 936918e3,
242
- 2847714899,
243
- 3736837829,
244
- 1202900863,
245
- 817233897,
246
- 3183342108,
247
- 3401237130,
248
- 1404277552,
249
- 615818150,
250
- 3134207493,
251
- 3453421203,
252
- 1423857449,
253
- 601450431,
254
- 3009837614,
255
- 3294710456,
256
- 1567103746,
257
- 711928724,
258
- 3020668471,
259
- 3272380065,
260
- 1510334235,
261
- 755167117
262
- ]);
263
- function ensureBuffer(input) {
264
- if (Buffer.isBuffer(input)) {
265
- return input;
266
- }
267
- if (typeof input === "number") {
268
- return Buffer.alloc(input);
269
- } else if (typeof input === "string") {
270
- return Buffer.from(input);
271
- } else {
272
- throw new Error("input must be buffer, number, or string, received " + typeof input);
273
- }
274
- }
275
- function bufferizeInt(num) {
276
- const tmp = ensureBuffer(4);
277
- tmp.writeInt32BE(num, 0);
278
- return tmp;
279
- }
280
- function _crc32(buf, previous) {
281
- buf = ensureBuffer(buf);
282
- if (Buffer.isBuffer(previous)) {
283
- previous = previous.readUInt32BE(0);
284
- }
285
- let crc = ~~previous ^ -1;
286
- for (var n = 0; n < buf.length; n++) {
287
- crc = CRC_TABLE[(crc ^ buf[n]) & 255] ^ crc >>> 8;
288
- }
289
- return crc ^ -1;
290
- }
291
- function crc32() {
292
- return bufferizeInt(_crc32.apply(null, arguments));
293
- }
294
- crc32.signed = function() {
295
- return _crc32.apply(null, arguments);
296
- };
297
- crc32.unsigned = function() {
298
- return _crc32.apply(null, arguments) >>> 0;
299
- };
300
- var bufferCrc32 = crc32;
301
-
302
- const index = /*@__PURE__*/getDefaultExportFromCjs(bufferCrc32);
303
-
304
- export { index as default };
@@ -1,35 +0,0 @@
1
- /// <reference types="node" />
2
-
3
- /**
4
- * These definitions were written by BendingBender (https://github.com/BendingBender)
5
- */
6
-
7
- export = crc32;
8
-
9
- declare function crc32(input: string | Buffer, partialCrc?: Buffer | number): Buffer;
10
-
11
- declare namespace crc32 {
12
- /**
13
- * Convenience method that returns a signed int instead of a `Buffer`.
14
- *
15
- * @example
16
- * import crc32 = require('buffer-crc32');
17
- *
18
- * // works with buffers
19
- * const buf = Buffer.from([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00]);
20
- * crc32.signed(buf); // -> -1805997238
21
- */
22
- function signed(buffer: string | Buffer, partialCrc?: Buffer | number): number;
23
-
24
- /**
25
- * Convenience method that returns an unsigned int instead of a `Buffer`.
26
- *
27
- * @example
28
- * import crc32 = require('buffer-crc32');
29
- *
30
- * // works with buffers
31
- * const buf = Buffer.from([0x00, 0x73, 0x75, 0x70, 0x20, 0x62, 0x72, 0x6f, 0x00]);
32
- * crc32.unsigned(buf); // -> 2488970058
33
- */
34
- function unsigned(buffer: string | Buffer, partialCrc?: Buffer | number): number;
35
- }