cdktn 0.23.1 → 0.23.3

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 (432) hide show
  1. package/.jsii +1592 -1591
  2. package/.spec.swcrc +22 -0
  3. package/README.md +1 -1
  4. package/jest.config.js +18 -15
  5. package/lib/_tokens.js +1 -1
  6. package/lib/annotations.js +2 -2
  7. package/lib/app.js +2 -2
  8. package/lib/aspect.js +2 -2
  9. package/lib/backends/azurerm-backend.js +3 -3
  10. package/lib/backends/cloud-backend.js +5 -5
  11. package/lib/backends/consul-backend.js +3 -3
  12. package/lib/backends/cos-backend.js +3 -3
  13. package/lib/backends/gcs-backend.js +3 -3
  14. package/lib/backends/http-backend.js +3 -3
  15. package/lib/backends/index.js +1 -1
  16. package/lib/backends/local-backend.js +3 -3
  17. package/lib/backends/oss-backend.js +3 -3
  18. package/lib/backends/pg-backend.js +3 -3
  19. package/lib/backends/remote-backend.js +5 -5
  20. package/lib/backends/s3-backend.js +3 -3
  21. package/lib/backends/swift-backend.js +3 -3
  22. package/lib/complex-computed-list.js +25 -25
  23. package/lib/errors.d.ts +1 -2
  24. package/lib/errors.js +11 -8
  25. package/lib/features.js +1 -1
  26. package/lib/functions/helpers.js +1 -1
  27. package/lib/functions/terraform-functions.generated.js +2 -2
  28. package/lib/hcl/render.js +1 -1
  29. package/lib/importable-resource.js +2 -2
  30. package/lib/index.js +1 -1
  31. package/lib/manifest.js +4 -5
  32. package/lib/private/fs.d.ts +20 -5
  33. package/lib/private/fs.js +43 -69
  34. package/lib/private/unique.js +1 -1
  35. package/lib/resource.js +2 -2
  36. package/lib/runtime.js +1 -1
  37. package/lib/synthesize/index.js +1 -1
  38. package/lib/synthesize/synthesizer.js +4 -5
  39. package/lib/synthesize/types.js +1 -1
  40. package/lib/terraform-addressable.js +1 -1
  41. package/lib/terraform-asset.js +2 -2
  42. package/lib/terraform-backend.js +2 -2
  43. package/lib/terraform-conditions.js +1 -1
  44. package/lib/terraform-count.js +2 -2
  45. package/lib/terraform-data-resource.js +2 -2
  46. package/lib/terraform-data-source.js +2 -2
  47. package/lib/terraform-dependable.js +1 -1
  48. package/lib/terraform-dynamic-block.js +2 -2
  49. package/lib/terraform-dynamic-expression.js +2 -2
  50. package/lib/terraform-element.js +2 -2
  51. package/lib/terraform-functions.js +2 -2
  52. package/lib/terraform-hcl-module.js +2 -2
  53. package/lib/terraform-iterator.js +6 -6
  54. package/lib/terraform-local.js +2 -2
  55. package/lib/terraform-module-asset.js +1 -1
  56. package/lib/terraform-module.js +2 -2
  57. package/lib/terraform-operators.js +2 -2
  58. package/lib/terraform-output.js +2 -2
  59. package/lib/terraform-provider.js +2 -2
  60. package/lib/terraform-provisioner.js +2 -2
  61. package/lib/terraform-remote-state.js +2 -2
  62. package/lib/terraform-resource-targets.js +2 -2
  63. package/lib/terraform-resource.js +2 -2
  64. package/lib/terraform-stack.js +2 -2
  65. package/lib/terraform-variable.js +3 -3
  66. package/lib/testing/adapters/jest.js +1 -1
  67. package/lib/testing/index.js +7 -8
  68. package/lib/testing/matchers.js +2 -2
  69. package/lib/tfExpression.js +1 -1
  70. package/lib/tokens/index.js +1 -1
  71. package/lib/tokens/lazy.js +4 -4
  72. package/lib/tokens/private/dependency.js +1 -1
  73. package/lib/tokens/private/encoding.js +1 -1
  74. package/lib/tokens/private/intrinsic.d.ts +0 -5
  75. package/lib/tokens/private/intrinsic.js +2 -9
  76. package/lib/tokens/private/resolve.js +1 -1
  77. package/lib/tokens/private/stack-trace.d.ts +6 -0
  78. package/lib/tokens/private/stack-trace.js +14 -1
  79. package/lib/tokens/private/token-map.js +1 -1
  80. package/lib/tokens/private/uniqueid.js +1 -1
  81. package/lib/tokens/resolvable.js +4 -4
  82. package/lib/tokens/string-fragments.js +2 -2
  83. package/lib/tokens/token.js +3 -3
  84. package/lib/tsconfig.tsbuildinfo +1 -0
  85. package/lib/upgrade-id-aspect.js +2 -2
  86. package/lib/util.js +1 -1
  87. package/lib/validateEnvironment.js +1 -1
  88. package/lib/validations/index.js +1 -1
  89. package/lib/validations/validate-binary-version.js +1 -1
  90. package/lib/validations/validate-provider-presence.js +1 -1
  91. package/lib/validations/validate-terraform-version.js +1 -1
  92. package/node_modules/fflate/CHANGELOG.md +115 -0
  93. package/node_modules/{has-property-descriptors → fflate}/LICENSE +2 -2
  94. package/node_modules/fflate/README.md +558 -0
  95. package/node_modules/fflate/esm/browser.d.ts +1501 -0
  96. package/node_modules/fflate/esm/browser.js +2665 -0
  97. package/node_modules/fflate/esm/index.d.mts +1501 -0
  98. package/node_modules/fflate/esm/index.mjs +2679 -0
  99. package/node_modules/fflate/lib/browser.cjs +2688 -0
  100. package/node_modules/fflate/lib/browser.d.cts +1501 -0
  101. package/node_modules/fflate/lib/index.cjs +2668 -0
  102. package/node_modules/fflate/lib/index.d.ts +1501 -0
  103. package/node_modules/fflate/lib/node-worker.cjs +32 -0
  104. package/node_modules/fflate/lib/node.cjs +2700 -0
  105. package/node_modules/fflate/lib/node.d.cts +1501 -0
  106. package/node_modules/fflate/lib/worker.cjs +20 -0
  107. package/node_modules/fflate/package.json +127 -0
  108. package/node_modules/fflate/umd/index.js +1 -0
  109. package/node_modules/{yazl → safe-stable-stringify}/LICENSE +1 -1
  110. package/node_modules/safe-stable-stringify/esm/package.json +4 -0
  111. package/node_modules/safe-stable-stringify/esm/wrapper.d.ts +4 -0
  112. package/node_modules/safe-stable-stringify/esm/wrapper.js +6 -0
  113. package/node_modules/safe-stable-stringify/index.d.ts +22 -0
  114. package/node_modules/safe-stable-stringify/index.js +625 -0
  115. package/node_modules/safe-stable-stringify/package.json +65 -0
  116. package/node_modules/safe-stable-stringify/readme.md +179 -0
  117. package/package.json +21 -15
  118. package/tsconfig.json +6 -3
  119. package/tsconfig.test.json +12 -0
  120. package/lib/testing/__tests__/matchers.test.d.ts +0 -1
  121. package/lib/testing/__tests__/matchers.test.js +0 -205
  122. package/lib/testing/adapters/__tests__/index.test.d.ts +0 -1
  123. package/lib/testing/adapters/__tests__/index.test.js +0 -67
  124. package/lib/testing/adapters/__tests__/jest.test.d.ts +0 -1
  125. package/lib/testing/adapters/__tests__/jest.test.js +0 -41
  126. package/node_modules/buffer-crc32/LICENSE +0 -19
  127. package/node_modules/buffer-crc32/README.md +0 -55
  128. package/node_modules/buffer-crc32/dist/index.cjs +0 -306
  129. package/node_modules/buffer-crc32/dist/index.d.cts +0 -35
  130. package/node_modules/buffer-crc32/dist/index.d.mts +0 -35
  131. package/node_modules/buffer-crc32/dist/index.mjs +0 -304
  132. package/node_modules/buffer-crc32/index.d.ts +0 -35
  133. package/node_modules/buffer-crc32/package.json +0 -54
  134. package/node_modules/call-bind/.eslintignore +0 -1
  135. package/node_modules/call-bind/.eslintrc +0 -16
  136. package/node_modules/call-bind/.github/FUNDING.yml +0 -12
  137. package/node_modules/call-bind/.nycrc +0 -9
  138. package/node_modules/call-bind/CHANGELOG.md +0 -106
  139. package/node_modules/call-bind/LICENSE +0 -21
  140. package/node_modules/call-bind/README.md +0 -64
  141. package/node_modules/call-bind/callBound.js +0 -15
  142. package/node_modules/call-bind/index.js +0 -24
  143. package/node_modules/call-bind/package.json +0 -93
  144. package/node_modules/call-bind/test/callBound.js +0 -54
  145. package/node_modules/call-bind/test/index.js +0 -74
  146. package/node_modules/call-bind-apply-helpers/.eslintrc +0 -17
  147. package/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +0 -12
  148. package/node_modules/call-bind-apply-helpers/.nycrc +0 -9
  149. package/node_modules/call-bind-apply-helpers/CHANGELOG.md +0 -30
  150. package/node_modules/call-bind-apply-helpers/LICENSE +0 -21
  151. package/node_modules/call-bind-apply-helpers/README.md +0 -62
  152. package/node_modules/call-bind-apply-helpers/actualApply.d.ts +0 -1
  153. package/node_modules/call-bind-apply-helpers/actualApply.js +0 -10
  154. package/node_modules/call-bind-apply-helpers/applyBind.d.ts +0 -19
  155. package/node_modules/call-bind-apply-helpers/applyBind.js +0 -10
  156. package/node_modules/call-bind-apply-helpers/functionApply.d.ts +0 -1
  157. package/node_modules/call-bind-apply-helpers/functionApply.js +0 -4
  158. package/node_modules/call-bind-apply-helpers/functionCall.d.ts +0 -1
  159. package/node_modules/call-bind-apply-helpers/functionCall.js +0 -4
  160. package/node_modules/call-bind-apply-helpers/index.d.ts +0 -64
  161. package/node_modules/call-bind-apply-helpers/index.js +0 -15
  162. package/node_modules/call-bind-apply-helpers/package.json +0 -85
  163. package/node_modules/call-bind-apply-helpers/reflectApply.d.ts +0 -3
  164. package/node_modules/call-bind-apply-helpers/reflectApply.js +0 -4
  165. package/node_modules/call-bind-apply-helpers/test/index.js +0 -63
  166. package/node_modules/call-bind-apply-helpers/tsconfig.json +0 -9
  167. package/node_modules/call-bound/.eslintrc +0 -13
  168. package/node_modules/call-bound/.github/FUNDING.yml +0 -12
  169. package/node_modules/call-bound/.nycrc +0 -9
  170. package/node_modules/call-bound/CHANGELOG.md +0 -42
  171. package/node_modules/call-bound/LICENSE +0 -21
  172. package/node_modules/call-bound/README.md +0 -53
  173. package/node_modules/call-bound/index.d.ts +0 -94
  174. package/node_modules/call-bound/index.js +0 -19
  175. package/node_modules/call-bound/package.json +0 -99
  176. package/node_modules/call-bound/test/index.js +0 -61
  177. package/node_modules/call-bound/tsconfig.json +0 -10
  178. package/node_modules/define-data-property/.eslintrc +0 -24
  179. package/node_modules/define-data-property/.github/FUNDING.yml +0 -12
  180. package/node_modules/define-data-property/.nycrc +0 -13
  181. package/node_modules/define-data-property/CHANGELOG.md +0 -70
  182. package/node_modules/define-data-property/LICENSE +0 -21
  183. package/node_modules/define-data-property/README.md +0 -67
  184. package/node_modules/define-data-property/index.d.ts +0 -12
  185. package/node_modules/define-data-property/index.js +0 -56
  186. package/node_modules/define-data-property/package.json +0 -106
  187. package/node_modules/define-data-property/test/index.js +0 -392
  188. package/node_modules/define-data-property/tsconfig.json +0 -59
  189. package/node_modules/dunder-proto/.eslintrc +0 -5
  190. package/node_modules/dunder-proto/.github/FUNDING.yml +0 -12
  191. package/node_modules/dunder-proto/.nycrc +0 -13
  192. package/node_modules/dunder-proto/CHANGELOG.md +0 -24
  193. package/node_modules/dunder-proto/LICENSE +0 -21
  194. package/node_modules/dunder-proto/README.md +0 -54
  195. package/node_modules/dunder-proto/get.d.ts +0 -5
  196. package/node_modules/dunder-proto/get.js +0 -30
  197. package/node_modules/dunder-proto/package.json +0 -76
  198. package/node_modules/dunder-proto/set.d.ts +0 -5
  199. package/node_modules/dunder-proto/set.js +0 -35
  200. package/node_modules/dunder-proto/test/get.js +0 -34
  201. package/node_modules/dunder-proto/test/index.js +0 -4
  202. package/node_modules/dunder-proto/test/set.js +0 -50
  203. package/node_modules/dunder-proto/tsconfig.json +0 -9
  204. package/node_modules/es-define-property/.eslintrc +0 -13
  205. package/node_modules/es-define-property/.github/FUNDING.yml +0 -12
  206. package/node_modules/es-define-property/.nycrc +0 -9
  207. package/node_modules/es-define-property/CHANGELOG.md +0 -29
  208. package/node_modules/es-define-property/LICENSE +0 -21
  209. package/node_modules/es-define-property/README.md +0 -49
  210. package/node_modules/es-define-property/index.d.ts +0 -3
  211. package/node_modules/es-define-property/index.js +0 -14
  212. package/node_modules/es-define-property/package.json +0 -81
  213. package/node_modules/es-define-property/test/index.js +0 -56
  214. package/node_modules/es-define-property/tsconfig.json +0 -10
  215. package/node_modules/es-errors/.eslintrc +0 -5
  216. package/node_modules/es-errors/.github/FUNDING.yml +0 -12
  217. package/node_modules/es-errors/CHANGELOG.md +0 -40
  218. package/node_modules/es-errors/LICENSE +0 -21
  219. package/node_modules/es-errors/README.md +0 -55
  220. package/node_modules/es-errors/eval.d.ts +0 -3
  221. package/node_modules/es-errors/eval.js +0 -4
  222. package/node_modules/es-errors/index.d.ts +0 -3
  223. package/node_modules/es-errors/index.js +0 -4
  224. package/node_modules/es-errors/package.json +0 -80
  225. package/node_modules/es-errors/range.d.ts +0 -3
  226. package/node_modules/es-errors/range.js +0 -4
  227. package/node_modules/es-errors/ref.d.ts +0 -3
  228. package/node_modules/es-errors/ref.js +0 -4
  229. package/node_modules/es-errors/syntax.d.ts +0 -3
  230. package/node_modules/es-errors/syntax.js +0 -4
  231. package/node_modules/es-errors/test/index.js +0 -19
  232. package/node_modules/es-errors/tsconfig.json +0 -49
  233. package/node_modules/es-errors/type.d.ts +0 -3
  234. package/node_modules/es-errors/type.js +0 -4
  235. package/node_modules/es-errors/uri.d.ts +0 -3
  236. package/node_modules/es-errors/uri.js +0 -4
  237. package/node_modules/es-object-atoms/.eslintrc +0 -16
  238. package/node_modules/es-object-atoms/.github/FUNDING.yml +0 -12
  239. package/node_modules/es-object-atoms/CHANGELOG.md +0 -37
  240. package/node_modules/es-object-atoms/LICENSE +0 -21
  241. package/node_modules/es-object-atoms/README.md +0 -63
  242. package/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +0 -3
  243. package/node_modules/es-object-atoms/RequireObjectCoercible.js +0 -11
  244. package/node_modules/es-object-atoms/ToObject.d.ts +0 -7
  245. package/node_modules/es-object-atoms/ToObject.js +0 -10
  246. package/node_modules/es-object-atoms/index.d.ts +0 -3
  247. package/node_modules/es-object-atoms/index.js +0 -4
  248. package/node_modules/es-object-atoms/isObject.d.ts +0 -3
  249. package/node_modules/es-object-atoms/isObject.js +0 -6
  250. package/node_modules/es-object-atoms/package.json +0 -80
  251. package/node_modules/es-object-atoms/test/index.js +0 -38
  252. package/node_modules/es-object-atoms/tsconfig.json +0 -6
  253. package/node_modules/function-bind/.eslintrc +0 -21
  254. package/node_modules/function-bind/.github/FUNDING.yml +0 -12
  255. package/node_modules/function-bind/.github/SECURITY.md +0 -3
  256. package/node_modules/function-bind/.nycrc +0 -13
  257. package/node_modules/function-bind/CHANGELOG.md +0 -136
  258. package/node_modules/function-bind/LICENSE +0 -20
  259. package/node_modules/function-bind/README.md +0 -46
  260. package/node_modules/function-bind/implementation.js +0 -84
  261. package/node_modules/function-bind/index.js +0 -5
  262. package/node_modules/function-bind/package.json +0 -87
  263. package/node_modules/function-bind/test/.eslintrc +0 -9
  264. package/node_modules/function-bind/test/index.js +0 -252
  265. package/node_modules/get-intrinsic/.eslintrc +0 -42
  266. package/node_modules/get-intrinsic/.github/FUNDING.yml +0 -12
  267. package/node_modules/get-intrinsic/.nycrc +0 -9
  268. package/node_modules/get-intrinsic/CHANGELOG.md +0 -186
  269. package/node_modules/get-intrinsic/LICENSE +0 -21
  270. package/node_modules/get-intrinsic/README.md +0 -71
  271. package/node_modules/get-intrinsic/index.js +0 -378
  272. package/node_modules/get-intrinsic/package.json +0 -97
  273. package/node_modules/get-intrinsic/test/GetIntrinsic.js +0 -274
  274. package/node_modules/get-proto/.eslintrc +0 -10
  275. package/node_modules/get-proto/.github/FUNDING.yml +0 -12
  276. package/node_modules/get-proto/.nycrc +0 -9
  277. package/node_modules/get-proto/CHANGELOG.md +0 -21
  278. package/node_modules/get-proto/LICENSE +0 -21
  279. package/node_modules/get-proto/Object.getPrototypeOf.d.ts +0 -5
  280. package/node_modules/get-proto/Object.getPrototypeOf.js +0 -6
  281. package/node_modules/get-proto/README.md +0 -50
  282. package/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +0 -3
  283. package/node_modules/get-proto/Reflect.getPrototypeOf.js +0 -4
  284. package/node_modules/get-proto/index.d.ts +0 -5
  285. package/node_modules/get-proto/index.js +0 -27
  286. package/node_modules/get-proto/package.json +0 -81
  287. package/node_modules/get-proto/test/index.js +0 -68
  288. package/node_modules/get-proto/tsconfig.json +0 -9
  289. package/node_modules/gopd/.eslintrc +0 -16
  290. package/node_modules/gopd/.github/FUNDING.yml +0 -12
  291. package/node_modules/gopd/CHANGELOG.md +0 -45
  292. package/node_modules/gopd/LICENSE +0 -21
  293. package/node_modules/gopd/README.md +0 -40
  294. package/node_modules/gopd/gOPD.d.ts +0 -1
  295. package/node_modules/gopd/gOPD.js +0 -4
  296. package/node_modules/gopd/index.d.ts +0 -5
  297. package/node_modules/gopd/index.js +0 -15
  298. package/node_modules/gopd/package.json +0 -77
  299. package/node_modules/gopd/test/index.js +0 -36
  300. package/node_modules/gopd/tsconfig.json +0 -9
  301. package/node_modules/has-property-descriptors/.eslintrc +0 -13
  302. package/node_modules/has-property-descriptors/.github/FUNDING.yml +0 -12
  303. package/node_modules/has-property-descriptors/.nycrc +0 -9
  304. package/node_modules/has-property-descriptors/CHANGELOG.md +0 -35
  305. package/node_modules/has-property-descriptors/README.md +0 -43
  306. package/node_modules/has-property-descriptors/index.js +0 -22
  307. package/node_modules/has-property-descriptors/package.json +0 -77
  308. package/node_modules/has-property-descriptors/test/index.js +0 -57
  309. package/node_modules/has-symbols/.eslintrc +0 -11
  310. package/node_modules/has-symbols/.github/FUNDING.yml +0 -12
  311. package/node_modules/has-symbols/.nycrc +0 -9
  312. package/node_modules/has-symbols/CHANGELOG.md +0 -91
  313. package/node_modules/has-symbols/LICENSE +0 -21
  314. package/node_modules/has-symbols/README.md +0 -46
  315. package/node_modules/has-symbols/index.d.ts +0 -3
  316. package/node_modules/has-symbols/index.js +0 -14
  317. package/node_modules/has-symbols/package.json +0 -111
  318. package/node_modules/has-symbols/shams.d.ts +0 -3
  319. package/node_modules/has-symbols/shams.js +0 -45
  320. package/node_modules/has-symbols/test/index.js +0 -22
  321. package/node_modules/has-symbols/test/shams/core-js.js +0 -29
  322. package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +0 -29
  323. package/node_modules/has-symbols/test/tests.js +0 -58
  324. package/node_modules/has-symbols/tsconfig.json +0 -10
  325. package/node_modules/hasown/.eslintrc +0 -5
  326. package/node_modules/hasown/.github/FUNDING.yml +0 -12
  327. package/node_modules/hasown/.nycrc +0 -13
  328. package/node_modules/hasown/CHANGELOG.md +0 -40
  329. package/node_modules/hasown/LICENSE +0 -21
  330. package/node_modules/hasown/README.md +0 -40
  331. package/node_modules/hasown/index.d.ts +0 -3
  332. package/node_modules/hasown/index.js +0 -8
  333. package/node_modules/hasown/package.json +0 -92
  334. package/node_modules/hasown/tsconfig.json +0 -6
  335. package/node_modules/isarray/LICENSE +0 -21
  336. package/node_modules/isarray/README.md +0 -38
  337. package/node_modules/isarray/index.js +0 -5
  338. package/node_modules/isarray/package.json +0 -48
  339. package/node_modules/json-stable-stringify/.eslintrc +0 -31
  340. package/node_modules/json-stable-stringify/.github/FUNDING.yml +0 -12
  341. package/node_modules/json-stable-stringify/CHANGELOG.md +0 -160
  342. package/node_modules/json-stable-stringify/LICENSE +0 -21
  343. package/node_modules/json-stable-stringify/README.md +0 -157
  344. package/node_modules/json-stable-stringify/example/key_cmp.js +0 -9
  345. package/node_modules/json-stable-stringify/example/nested.js +0 -7
  346. package/node_modules/json-stable-stringify/example/str.js +0 -7
  347. package/node_modules/json-stable-stringify/example/value_cmp.js +0 -12
  348. package/node_modules/json-stable-stringify/index.d.ts +0 -25
  349. package/node_modules/json-stable-stringify/index.js +0 -124
  350. package/node_modules/json-stable-stringify/package.json +0 -88
  351. package/node_modules/json-stable-stringify/test/cmp.js +0 -33
  352. package/node_modules/json-stable-stringify/test/nested.js +0 -48
  353. package/node_modules/json-stable-stringify/test/replacer.js +0 -81
  354. package/node_modules/json-stable-stringify/test/space.js +0 -127
  355. package/node_modules/json-stable-stringify/test/str.js +0 -46
  356. package/node_modules/json-stable-stringify/test/to-json.js +0 -22
  357. package/node_modules/json-stable-stringify/tsconfig.json +0 -10
  358. package/node_modules/jsonify/.eslintrc +0 -21
  359. package/node_modules/jsonify/.github/FUNDING.yml +0 -12
  360. package/node_modules/jsonify/CHANGELOG.md +0 -48
  361. package/node_modules/jsonify/README.md +0 -66
  362. package/node_modules/jsonify/index.js +0 -4
  363. package/node_modules/jsonify/lib/parse.js +0 -261
  364. package/node_modules/jsonify/lib/stringify.js +0 -151
  365. package/node_modules/jsonify/package.json +0 -62
  366. package/node_modules/jsonify/test/parse.js +0 -20
  367. package/node_modules/jsonify/test/stringify.js +0 -18
  368. package/node_modules/math-intrinsics/.eslintrc +0 -16
  369. package/node_modules/math-intrinsics/.github/FUNDING.yml +0 -12
  370. package/node_modules/math-intrinsics/CHANGELOG.md +0 -24
  371. package/node_modules/math-intrinsics/LICENSE +0 -21
  372. package/node_modules/math-intrinsics/README.md +0 -50
  373. package/node_modules/math-intrinsics/abs.d.ts +0 -1
  374. package/node_modules/math-intrinsics/abs.js +0 -4
  375. package/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +0 -3
  376. package/node_modules/math-intrinsics/constants/maxArrayLength.js +0 -4
  377. package/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +0 -3
  378. package/node_modules/math-intrinsics/constants/maxSafeInteger.js +0 -5
  379. package/node_modules/math-intrinsics/constants/maxValue.d.ts +0 -3
  380. package/node_modules/math-intrinsics/constants/maxValue.js +0 -5
  381. package/node_modules/math-intrinsics/floor.d.ts +0 -1
  382. package/node_modules/math-intrinsics/floor.js +0 -4
  383. package/node_modules/math-intrinsics/isFinite.d.ts +0 -3
  384. package/node_modules/math-intrinsics/isFinite.js +0 -12
  385. package/node_modules/math-intrinsics/isInteger.d.ts +0 -3
  386. package/node_modules/math-intrinsics/isInteger.js +0 -16
  387. package/node_modules/math-intrinsics/isNaN.d.ts +0 -1
  388. package/node_modules/math-intrinsics/isNaN.js +0 -6
  389. package/node_modules/math-intrinsics/isNegativeZero.d.ts +0 -3
  390. package/node_modules/math-intrinsics/isNegativeZero.js +0 -6
  391. package/node_modules/math-intrinsics/max.d.ts +0 -1
  392. package/node_modules/math-intrinsics/max.js +0 -4
  393. package/node_modules/math-intrinsics/min.d.ts +0 -1
  394. package/node_modules/math-intrinsics/min.js +0 -4
  395. package/node_modules/math-intrinsics/mod.d.ts +0 -3
  396. package/node_modules/math-intrinsics/mod.js +0 -9
  397. package/node_modules/math-intrinsics/package.json +0 -86
  398. package/node_modules/math-intrinsics/pow.d.ts +0 -1
  399. package/node_modules/math-intrinsics/pow.js +0 -4
  400. package/node_modules/math-intrinsics/round.d.ts +0 -1
  401. package/node_modules/math-intrinsics/round.js +0 -4
  402. package/node_modules/math-intrinsics/sign.d.ts +0 -3
  403. package/node_modules/math-intrinsics/sign.js +0 -11
  404. package/node_modules/math-intrinsics/test/index.js +0 -192
  405. package/node_modules/math-intrinsics/tsconfig.json +0 -3
  406. package/node_modules/object-keys/.editorconfig +0 -13
  407. package/node_modules/object-keys/.eslintrc +0 -17
  408. package/node_modules/object-keys/.travis.yml +0 -277
  409. package/node_modules/object-keys/CHANGELOG.md +0 -232
  410. package/node_modules/object-keys/LICENSE +0 -21
  411. package/node_modules/object-keys/README.md +0 -76
  412. package/node_modules/object-keys/implementation.js +0 -122
  413. package/node_modules/object-keys/index.js +0 -32
  414. package/node_modules/object-keys/isArguments.js +0 -17
  415. package/node_modules/object-keys/package.json +0 -88
  416. package/node_modules/object-keys/test/index.js +0 -5
  417. package/node_modules/set-function-length/.eslintrc +0 -27
  418. package/node_modules/set-function-length/.github/FUNDING.yml +0 -12
  419. package/node_modules/set-function-length/.nycrc +0 -13
  420. package/node_modules/set-function-length/CHANGELOG.md +0 -70
  421. package/node_modules/set-function-length/LICENSE +0 -21
  422. package/node_modules/set-function-length/README.md +0 -56
  423. package/node_modules/set-function-length/env.d.ts +0 -9
  424. package/node_modules/set-function-length/env.js +0 -25
  425. package/node_modules/set-function-length/index.d.ts +0 -7
  426. package/node_modules/set-function-length/index.js +0 -42
  427. package/node_modules/set-function-length/package.json +0 -102
  428. package/node_modules/set-function-length/tsconfig.json +0 -9
  429. package/node_modules/yazl/README.md +0 -457
  430. package/node_modules/yazl/index.js +0 -826
  431. package/node_modules/yazl/package.json +0 -34
  432. package/tsconfig.tsbuildinfo +0 -1
@@ -1,826 +0,0 @@
1
- var fs = require("fs");
2
- var Transform = require("stream").Transform;
3
- var PassThrough = require("stream").PassThrough;
4
- var zlib = require("zlib");
5
- var util = require("util");
6
- var EventEmitter = require("events").EventEmitter;
7
- var errorMonitor = require("events").errorMonitor;
8
- var crc32 = require("buffer-crc32");
9
-
10
- exports.ZipFile = ZipFile;
11
- exports.dateToDosDateTime = dateToDosDateTime;
12
-
13
- util.inherits(ZipFile, EventEmitter);
14
- function ZipFile() {
15
- this.outputStream = new PassThrough();
16
- this.entries = [];
17
- this.outputStreamCursor = 0;
18
- this.ended = false; // .end() sets this
19
- this.allDone = false; // set when we've written the last bytes
20
- this.forceZip64Eocd = false; // configurable in .end()
21
- this.errored = false;
22
- this.on(errorMonitor, function() {
23
- this.errored = true;
24
- });
25
- }
26
-
27
- ZipFile.prototype.addFile = function(realPath, metadataPath, options) {
28
- var self = this;
29
- metadataPath = validateMetadataPath(metadataPath, false);
30
- if (options == null) options = {};
31
-
32
- if (shouldIgnoreAdding(self)) return;
33
- var entry = new Entry(metadataPath, false, options);
34
- self.entries.push(entry);
35
- fs.stat(realPath, function(err, stats) {
36
- if (err) return self.emit("error", err);
37
- if (!stats.isFile()) return self.emit("error", new Error("not a file: " + realPath));
38
- entry.uncompressedSize = stats.size;
39
- if (options.mtime == null) entry.setLastModDate(stats.mtime);
40
- if (options.mode == null) entry.setFileAttributesMode(stats.mode);
41
- entry.setFileDataPumpFunction(function() {
42
- var readStream = fs.createReadStream(realPath);
43
- entry.state = Entry.FILE_DATA_IN_PROGRESS;
44
- readStream.on("error", function(err) {
45
- self.emit("error", err);
46
- });
47
- pumpFileDataReadStream(self, entry, readStream);
48
- });
49
- pumpEntries(self);
50
- });
51
- };
52
-
53
- ZipFile.prototype.addReadStream = function(readStream, metadataPath, options) {
54
- this.addReadStreamLazy(metadataPath, options, function(cb) {
55
- cb(null, readStream);
56
- });
57
- };
58
-
59
- ZipFile.prototype.addReadStreamLazy = function(metadataPath, options, getReadStreamFunction) {
60
- var self = this;
61
- if (typeof options === "function") {
62
- getReadStreamFunction = options;
63
- options = null;
64
- }
65
- if (options == null) options = {};
66
- metadataPath = validateMetadataPath(metadataPath, false);
67
-
68
- if (shouldIgnoreAdding(self)) return;
69
- var entry = new Entry(metadataPath, false, options);
70
- self.entries.push(entry);
71
- entry.setFileDataPumpFunction(function() {
72
- entry.state = Entry.FILE_DATA_IN_PROGRESS;
73
- getReadStreamFunction(function(err, readStream) {
74
- if (err) return self.emit("error", err);
75
- pumpFileDataReadStream(self, entry, readStream);
76
- });
77
- });
78
- pumpEntries(self);
79
- };
80
-
81
- ZipFile.prototype.addBuffer = function(buffer, metadataPath, options) {
82
- var self = this;
83
- metadataPath = validateMetadataPath(metadataPath, false);
84
- if (buffer.length > 0x3fffffff) throw new Error("buffer too large: " + buffer.length + " > " + 0x3fffffff);
85
- if (options == null) options = {};
86
- if (options.size != null) throw new Error("options.size not allowed");
87
-
88
- if (shouldIgnoreAdding(self)) return;
89
- var entry = new Entry(metadataPath, false, options);
90
- entry.uncompressedSize = buffer.length;
91
- entry.crc32 = crc32.unsigned(buffer);
92
- entry.crcAndFileSizeKnown = true;
93
- self.entries.push(entry);
94
- if (entry.compressionLevel === 0) {
95
- setCompressedBuffer(buffer);
96
- } else {
97
- zlib.deflateRaw(buffer, {level:entry.compressionLevel}, function(err, compressedBuffer) {
98
- setCompressedBuffer(compressedBuffer);
99
- });
100
- }
101
- function setCompressedBuffer(compressedBuffer) {
102
- entry.compressedSize = compressedBuffer.length;
103
- entry.setFileDataPumpFunction(function() {
104
- writeToOutputStream(self, compressedBuffer);
105
- writeToOutputStream(self, entry.getDataDescriptor());
106
- entry.state = Entry.FILE_DATA_DONE;
107
-
108
- // don't call pumpEntries() recursively.
109
- // (also, don't call process.nextTick recursively.)
110
- setImmediate(function() {
111
- pumpEntries(self);
112
- });
113
- });
114
- pumpEntries(self);
115
- }
116
- };
117
-
118
- ZipFile.prototype.addEmptyDirectory = function(metadataPath, options) {
119
- var self = this;
120
- metadataPath = validateMetadataPath(metadataPath, true);
121
- if (options == null) options = {};
122
- if (options.size != null) throw new Error("options.size not allowed");
123
- if (options.compress != null) throw new Error("options.compress not allowed");
124
- if (options.compressionLevel != null) throw new Error("options.compressionLevel not allowed");
125
-
126
- if (shouldIgnoreAdding(self)) return;
127
- var entry = new Entry(metadataPath, true, options);
128
- self.entries.push(entry);
129
- entry.setFileDataPumpFunction(function() {
130
- writeToOutputStream(self, entry.getDataDescriptor());
131
- entry.state = Entry.FILE_DATA_DONE;
132
- pumpEntries(self);
133
- });
134
- pumpEntries(self);
135
- };
136
-
137
- var eocdrSignatureBuffer = bufferFrom([0x50, 0x4b, 0x05, 0x06]);
138
-
139
- ZipFile.prototype.end = function(options, calculatedTotalSizeCallback) {
140
- if (typeof options === "function") {
141
- calculatedTotalSizeCallback = options;
142
- options = null;
143
- }
144
- if (options == null) options = {};
145
- if (this.ended) return;
146
- this.ended = true;
147
- if (this.errored) return;
148
- this.calculatedTotalSizeCallback = calculatedTotalSizeCallback;
149
- this.forceZip64Eocd = !!options.forceZip64Format;
150
- if (options.comment) {
151
- if (typeof options.comment === "string") {
152
- this.comment = encodeCp437(options.comment);
153
- } else {
154
- // It should be a Buffer
155
- this.comment = options.comment;
156
- }
157
- if (this.comment.length > 0xffff) throw new Error("comment is too large");
158
- // gotta check for this, because the zipfile format is actually ambiguous.
159
- if (bufferIncludes(this.comment, eocdrSignatureBuffer)) throw new Error("comment contains end of central directory record signature");
160
- } else {
161
- // no comment.
162
- this.comment = EMPTY_BUFFER;
163
- }
164
- pumpEntries(this);
165
- };
166
-
167
- function writeToOutputStream(self, buffer) {
168
- self.outputStream.write(buffer);
169
- self.outputStreamCursor += buffer.length;
170
- }
171
-
172
- function pumpFileDataReadStream(self, entry, readStream) {
173
- var crc32Watcher = new Crc32Watcher();
174
- var uncompressedSizeCounter = new ByteCounter();
175
- var compressor = entry.compressionLevel !== 0 ? new zlib.DeflateRaw({level:entry.compressionLevel}) : new PassThrough();
176
- var compressedSizeCounter = new ByteCounter();
177
- readStream.pipe(crc32Watcher)
178
- .pipe(uncompressedSizeCounter)
179
- .pipe(compressor)
180
- .pipe(compressedSizeCounter)
181
- .pipe(self.outputStream, {end: false});
182
- compressedSizeCounter.on("end", function() {
183
- entry.crc32 = crc32Watcher.crc32;
184
- if (entry.uncompressedSize == null) {
185
- entry.uncompressedSize = uncompressedSizeCounter.byteCount;
186
- } else {
187
- if (entry.uncompressedSize !== uncompressedSizeCounter.byteCount) return self.emit("error", new Error("file data stream has unexpected number of bytes"));
188
- }
189
- entry.compressedSize = compressedSizeCounter.byteCount;
190
- self.outputStreamCursor += entry.compressedSize;
191
- writeToOutputStream(self, entry.getDataDescriptor());
192
- entry.state = Entry.FILE_DATA_DONE;
193
- pumpEntries(self);
194
- });
195
- }
196
-
197
- function determineCompressionLevel(options) {
198
- if (options.compress != null && options.compressionLevel != null) {
199
- if (!!options.compress !== !!options.compressionLevel) throw new Error("conflicting settings for compress and compressionLevel");
200
- }
201
- if (options.compressionLevel != null) return options.compressionLevel;
202
- if (options.compress === false) return 0;
203
- return 6;
204
- }
205
-
206
- function pumpEntries(self) {
207
- if (self.allDone || self.errored) return;
208
- // first check if calculatedTotalSize is finally known
209
- if (self.ended && self.calculatedTotalSizeCallback != null) {
210
- var calculatedTotalSize = calculateTotalSize(self);
211
- if (calculatedTotalSize != null) {
212
- // we have an answer
213
- self.calculatedTotalSizeCallback(calculatedTotalSize);
214
- self.calculatedTotalSizeCallback = null;
215
- }
216
- }
217
-
218
- // pump entries
219
- var entry = getFirstNotDoneEntry();
220
- function getFirstNotDoneEntry() {
221
- for (var i = 0; i < self.entries.length; i++) {
222
- var entry = self.entries[i];
223
- if (entry.state < Entry.FILE_DATA_DONE) return entry;
224
- }
225
- return null;
226
- }
227
- if (entry != null) {
228
- // this entry is not done yet
229
- if (entry.state < Entry.READY_TO_PUMP_FILE_DATA) return; // input file not open yet
230
- if (entry.state === Entry.FILE_DATA_IN_PROGRESS) return; // we'll get there
231
- // start with local file header
232
- entry.relativeOffsetOfLocalHeader = self.outputStreamCursor;
233
- var localFileHeader = entry.getLocalFileHeader();
234
- writeToOutputStream(self, localFileHeader);
235
- entry.doFileDataPump();
236
- } else {
237
- // all cought up on writing entries
238
- if (self.ended) {
239
- // head for the exit
240
- self.offsetOfStartOfCentralDirectory = self.outputStreamCursor;
241
- self.entries.forEach(function(entry) {
242
- var centralDirectoryRecord = entry.getCentralDirectoryRecord();
243
- writeToOutputStream(self, centralDirectoryRecord);
244
- });
245
- writeToOutputStream(self, getEndOfCentralDirectoryRecord(self));
246
- self.outputStream.end();
247
- self.allDone = true;
248
- }
249
- }
250
- }
251
-
252
- function calculateTotalSize(self) {
253
- var pretendOutputCursor = 0;
254
- var centralDirectorySize = 0;
255
- for (var i = 0; i < self.entries.length; i++) {
256
- var entry = self.entries[i];
257
- // compression is too hard to predict
258
- if (entry.compressionLevel !== 0) return -1;
259
- if (entry.state >= Entry.READY_TO_PUMP_FILE_DATA) {
260
- // if addReadStream was called without providing the size, we can't predict the total size
261
- if (entry.uncompressedSize == null) return -1;
262
- } else {
263
- // if we're still waiting for fs.stat, we might learn the size someday
264
- if (entry.uncompressedSize == null) return null;
265
- }
266
- // we know this for sure, and this is important to know if we need ZIP64 format.
267
- entry.relativeOffsetOfLocalHeader = pretendOutputCursor;
268
- var useZip64Format = entry.useZip64Format();
269
-
270
- pretendOutputCursor += LOCAL_FILE_HEADER_FIXED_SIZE + entry.utf8FileName.length;
271
- pretendOutputCursor += entry.uncompressedSize;
272
- if (!entry.crcAndFileSizeKnown) {
273
- // use a data descriptor
274
- if (useZip64Format) {
275
- pretendOutputCursor += ZIP64_DATA_DESCRIPTOR_SIZE;
276
- } else {
277
- pretendOutputCursor += DATA_DESCRIPTOR_SIZE;
278
- }
279
- }
280
-
281
- centralDirectorySize += CENTRAL_DIRECTORY_RECORD_FIXED_SIZE + entry.utf8FileName.length + entry.fileComment.length;
282
- if (!entry.forceDosTimestamp) {
283
- centralDirectorySize += INFO_ZIP_UNIVERSAL_TIMESTAMP_EXTRA_FIELD_SIZE;
284
- }
285
- if (useZip64Format) {
286
- centralDirectorySize += ZIP64_EXTENDED_INFORMATION_EXTRA_FIELD_SIZE;
287
- }
288
- }
289
-
290
- var endOfCentralDirectorySize = 0;
291
- if (self.forceZip64Eocd ||
292
- self.entries.length >= 0xffff ||
293
- centralDirectorySize >= 0xffff ||
294
- pretendOutputCursor >= 0xffffffff) {
295
- // use zip64 end of central directory stuff
296
- endOfCentralDirectorySize += ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE + ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIZE;
297
- }
298
- endOfCentralDirectorySize += END_OF_CENTRAL_DIRECTORY_RECORD_SIZE + self.comment.length;
299
- return pretendOutputCursor + centralDirectorySize + endOfCentralDirectorySize;
300
- }
301
-
302
- function shouldIgnoreAdding(self) {
303
- if (self.ended) throw new Error("cannot add entries after calling end()");
304
- if (self.errored) return true;
305
- return false;
306
- }
307
-
308
- var ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE = 56;
309
- var ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIZE = 20;
310
- var END_OF_CENTRAL_DIRECTORY_RECORD_SIZE = 22;
311
- function getEndOfCentralDirectoryRecord(self, actuallyJustTellMeHowLongItWouldBe) {
312
- var needZip64Format = false;
313
- var normalEntriesLength = self.entries.length;
314
- if (self.forceZip64Eocd || self.entries.length >= 0xffff) {
315
- normalEntriesLength = 0xffff;
316
- needZip64Format = true;
317
- }
318
- var sizeOfCentralDirectory = self.outputStreamCursor - self.offsetOfStartOfCentralDirectory;
319
- var normalSizeOfCentralDirectory = sizeOfCentralDirectory;
320
- if (self.forceZip64Eocd || sizeOfCentralDirectory >= 0xffffffff) {
321
- normalSizeOfCentralDirectory = 0xffffffff;
322
- needZip64Format = true;
323
- }
324
- var normalOffsetOfStartOfCentralDirectory = self.offsetOfStartOfCentralDirectory;
325
- if (self.forceZip64Eocd || self.offsetOfStartOfCentralDirectory >= 0xffffffff) {
326
- normalOffsetOfStartOfCentralDirectory = 0xffffffff;
327
- needZip64Format = true;
328
- }
329
- if (actuallyJustTellMeHowLongItWouldBe) {
330
- if (needZip64Format) {
331
- return (
332
- ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE +
333
- ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIZE +
334
- END_OF_CENTRAL_DIRECTORY_RECORD_SIZE
335
- );
336
- } else {
337
- return END_OF_CENTRAL_DIRECTORY_RECORD_SIZE;
338
- }
339
- }
340
-
341
- var eocdrBuffer = bufferAlloc(END_OF_CENTRAL_DIRECTORY_RECORD_SIZE + self.comment.length);
342
- // end of central dir signature 4 bytes (0x06054b50)
343
- eocdrBuffer.writeUInt32LE(0x06054b50, 0);
344
- // number of this disk 2 bytes
345
- eocdrBuffer.writeUInt16LE(0, 4);
346
- // number of the disk with the start of the central directory 2 bytes
347
- eocdrBuffer.writeUInt16LE(0, 6);
348
- // total number of entries in the central directory on this disk 2 bytes
349
- eocdrBuffer.writeUInt16LE(normalEntriesLength, 8);
350
- // total number of entries in the central directory 2 bytes
351
- eocdrBuffer.writeUInt16LE(normalEntriesLength, 10);
352
- // size of the central directory 4 bytes
353
- eocdrBuffer.writeUInt32LE(normalSizeOfCentralDirectory, 12);
354
- // offset of start of central directory with respect to the starting disk number 4 bytes
355
- eocdrBuffer.writeUInt32LE(normalOffsetOfStartOfCentralDirectory, 16);
356
- // .ZIP file comment length 2 bytes
357
- eocdrBuffer.writeUInt16LE(self.comment.length, 20);
358
- // .ZIP file comment (variable size)
359
- self.comment.copy(eocdrBuffer, 22);
360
-
361
- if (!needZip64Format) return eocdrBuffer;
362
-
363
- // ZIP64 format
364
- // ZIP64 End of Central Directory Record
365
- var zip64EocdrBuffer = bufferAlloc(ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE);
366
- // zip64 end of central dir signature 4 bytes (0x06064b50)
367
- zip64EocdrBuffer.writeUInt32LE(0x06064b50, 0);
368
- // size of zip64 end of central directory record 8 bytes
369
- writeUInt64LE(zip64EocdrBuffer, ZIP64_END_OF_CENTRAL_DIRECTORY_RECORD_SIZE - 12, 4);
370
- // version made by 2 bytes
371
- zip64EocdrBuffer.writeUInt16LE(VERSION_MADE_BY, 12);
372
- // version needed to extract 2 bytes
373
- zip64EocdrBuffer.writeUInt16LE(VERSION_NEEDED_TO_EXTRACT_ZIP64, 14);
374
- // number of this disk 4 bytes
375
- zip64EocdrBuffer.writeUInt32LE(0, 16);
376
- // number of the disk with the start of the central directory 4 bytes
377
- zip64EocdrBuffer.writeUInt32LE(0, 20);
378
- // total number of entries in the central directory on this disk 8 bytes
379
- writeUInt64LE(zip64EocdrBuffer, self.entries.length, 24);
380
- // total number of entries in the central directory 8 bytes
381
- writeUInt64LE(zip64EocdrBuffer, self.entries.length, 32);
382
- // size of the central directory 8 bytes
383
- writeUInt64LE(zip64EocdrBuffer, sizeOfCentralDirectory, 40);
384
- // offset of start of central directory with respect to the starting disk number 8 bytes
385
- writeUInt64LE(zip64EocdrBuffer, self.offsetOfStartOfCentralDirectory, 48);
386
- // zip64 extensible data sector (variable size)
387
- // nothing in the zip64 extensible data sector
388
-
389
-
390
- // ZIP64 End of Central Directory Locator
391
- var zip64EocdlBuffer = bufferAlloc(ZIP64_END_OF_CENTRAL_DIRECTORY_LOCATOR_SIZE);
392
- // zip64 end of central dir locator signature 4 bytes (0x07064b50)
393
- zip64EocdlBuffer.writeUInt32LE(0x07064b50, 0);
394
- // number of the disk with the start of the zip64 end of central directory 4 bytes
395
- zip64EocdlBuffer.writeUInt32LE(0, 4);
396
- // relative offset of the zip64 end of central directory record 8 bytes
397
- writeUInt64LE(zip64EocdlBuffer, self.outputStreamCursor, 8);
398
- // total number of disks 4 bytes
399
- zip64EocdlBuffer.writeUInt32LE(1, 16);
400
-
401
-
402
- return Buffer.concat([
403
- zip64EocdrBuffer,
404
- zip64EocdlBuffer,
405
- eocdrBuffer,
406
- ]);
407
- }
408
-
409
- function validateMetadataPath(metadataPath, isDirectory) {
410
- if (metadataPath === "") throw new Error("empty metadataPath");
411
- metadataPath = metadataPath.replace(/\\/g, "/");
412
- if (/^[a-zA-Z]:/.test(metadataPath) || /^\//.test(metadataPath)) throw new Error("absolute path: " + metadataPath);
413
- if (metadataPath.split("/").indexOf("..") !== -1) throw new Error("invalid relative path: " + metadataPath);
414
- var looksLikeDirectory = /\/$/.test(metadataPath);
415
- if (isDirectory) {
416
- // append a trailing '/' if necessary.
417
- if (!looksLikeDirectory) metadataPath += "/";
418
- } else {
419
- if (looksLikeDirectory) throw new Error("file path cannot end with '/': " + metadataPath);
420
- }
421
- return metadataPath;
422
- }
423
-
424
- var EMPTY_BUFFER = bufferAlloc(0);
425
-
426
- // this class is not part of the public API
427
- function Entry(metadataPath, isDirectory, options) {
428
- this.utf8FileName = bufferFrom(metadataPath);
429
- if (this.utf8FileName.length > 0xffff) throw new Error("utf8 file name too long. " + utf8FileName.length + " > " + 0xffff);
430
- this.isDirectory = isDirectory;
431
- this.state = Entry.WAITING_FOR_METADATA;
432
- this.setLastModDate(options.mtime != null ? options.mtime : new Date());
433
- this.forceDosTimestamp = !!options.forceDosTimestamp;
434
- if (options.mode != null) {
435
- this.setFileAttributesMode(options.mode);
436
- } else {
437
- this.setFileAttributesMode(isDirectory ? 0o40775 : 0o100664);
438
- }
439
- if (isDirectory) {
440
- this.crcAndFileSizeKnown = true;
441
- this.crc32 = 0;
442
- this.uncompressedSize = 0;
443
- this.compressedSize = 0;
444
- } else {
445
- // unknown so far
446
- this.crcAndFileSizeKnown = false;
447
- this.crc32 = null;
448
- this.uncompressedSize = null;
449
- this.compressedSize = null;
450
- if (options.size != null) this.uncompressedSize = options.size;
451
- }
452
- if (isDirectory) {
453
- this.compressionLevel = 0;
454
- } else {
455
- this.compressionLevel = determineCompressionLevel(options);
456
- }
457
- this.forceZip64Format = !!options.forceZip64Format;
458
- if (options.fileComment) {
459
- if (typeof options.fileComment === "string") {
460
- this.fileComment = bufferFrom(options.fileComment, "utf-8");
461
- } else {
462
- // It should be a Buffer
463
- this.fileComment = options.fileComment;
464
- }
465
- if (this.fileComment.length > 0xffff) throw new Error("fileComment is too large");
466
- } else {
467
- // no comment.
468
- this.fileComment = EMPTY_BUFFER;
469
- }
470
- }
471
- Entry.WAITING_FOR_METADATA = 0;
472
- Entry.READY_TO_PUMP_FILE_DATA = 1;
473
- Entry.FILE_DATA_IN_PROGRESS = 2;
474
- Entry.FILE_DATA_DONE = 3;
475
- Entry.prototype.setLastModDate = function(date) {
476
- this.mtime = date;
477
- var dosDateTime = dateToDosDateTime(date);
478
- this.lastModFileTime = dosDateTime.time;
479
- this.lastModFileDate = dosDateTime.date;
480
- };
481
- Entry.prototype.setFileAttributesMode = function(mode) {
482
- if ((mode & 0xffff) !== mode) throw new Error("invalid mode. expected: 0 <= " + mode + " <= " + 0xffff);
483
- // http://unix.stackexchange.com/questions/14705/the-zip-formats-external-file-attribute/14727#14727
484
- this.externalFileAttributes = (mode << 16) >>> 0;
485
- };
486
- // doFileDataPump() should not call pumpEntries() directly. see issue #9.
487
- Entry.prototype.setFileDataPumpFunction = function(doFileDataPump) {
488
- this.doFileDataPump = doFileDataPump;
489
- this.state = Entry.READY_TO_PUMP_FILE_DATA;
490
- };
491
- Entry.prototype.useZip64Format = function() {
492
- return (
493
- (this.forceZip64Format) ||
494
- (this.uncompressedSize != null && this.uncompressedSize > 0xfffffffe) ||
495
- (this.compressedSize != null && this.compressedSize > 0xfffffffe) ||
496
- (this.relativeOffsetOfLocalHeader != null && this.relativeOffsetOfLocalHeader > 0xfffffffe)
497
- );
498
- }
499
- var LOCAL_FILE_HEADER_FIXED_SIZE = 30;
500
- var VERSION_NEEDED_TO_EXTRACT_UTF8 = 20;
501
- var VERSION_NEEDED_TO_EXTRACT_ZIP64 = 45;
502
- // 3 = unix. 63 = spec version 6.3
503
- var VERSION_MADE_BY = (3 << 8) | 63;
504
- var FILE_NAME_IS_UTF8 = 1 << 11;
505
- var UNKNOWN_CRC32_AND_FILE_SIZES = 1 << 3;
506
- Entry.prototype.getLocalFileHeader = function() {
507
- var crc32 = 0;
508
- var compressedSize = 0;
509
- var uncompressedSize = 0;
510
- if (this.crcAndFileSizeKnown) {
511
- crc32 = this.crc32;
512
- compressedSize = this.compressedSize;
513
- uncompressedSize = this.uncompressedSize;
514
- }
515
-
516
- var fixedSizeStuff = bufferAlloc(LOCAL_FILE_HEADER_FIXED_SIZE);
517
- var generalPurposeBitFlag = FILE_NAME_IS_UTF8;
518
- if (!this.crcAndFileSizeKnown) generalPurposeBitFlag |= UNKNOWN_CRC32_AND_FILE_SIZES;
519
-
520
- // local file header signature 4 bytes (0x04034b50)
521
- fixedSizeStuff.writeUInt32LE(0x04034b50, 0);
522
- // version needed to extract 2 bytes
523
- fixedSizeStuff.writeUInt16LE(VERSION_NEEDED_TO_EXTRACT_UTF8, 4);
524
- // general purpose bit flag 2 bytes
525
- fixedSizeStuff.writeUInt16LE(generalPurposeBitFlag, 6);
526
- // compression method 2 bytes
527
- fixedSizeStuff.writeUInt16LE(this.getCompressionMethod(), 8);
528
- // last mod file time 2 bytes
529
- fixedSizeStuff.writeUInt16LE(this.lastModFileTime, 10);
530
- // last mod file date 2 bytes
531
- fixedSizeStuff.writeUInt16LE(this.lastModFileDate, 12);
532
- // crc-32 4 bytes
533
- fixedSizeStuff.writeUInt32LE(crc32, 14);
534
- // compressed size 4 bytes
535
- fixedSizeStuff.writeUInt32LE(compressedSize, 18);
536
- // uncompressed size 4 bytes
537
- fixedSizeStuff.writeUInt32LE(uncompressedSize, 22);
538
- // file name length 2 bytes
539
- fixedSizeStuff.writeUInt16LE(this.utf8FileName.length, 26);
540
- // extra field length 2 bytes
541
- fixedSizeStuff.writeUInt16LE(0, 28);
542
- return Buffer.concat([
543
- fixedSizeStuff,
544
- // file name (variable size)
545
- this.utf8FileName,
546
- // extra field (variable size)
547
- // no extra fields
548
- ]);
549
- };
550
- var DATA_DESCRIPTOR_SIZE = 16;
551
- var ZIP64_DATA_DESCRIPTOR_SIZE = 24;
552
- Entry.prototype.getDataDescriptor = function() {
553
- if (this.crcAndFileSizeKnown) {
554
- // the Mac Archive Utility requires this not be present unless we set general purpose bit 3
555
- return EMPTY_BUFFER;
556
- }
557
- if (!this.useZip64Format()) {
558
- var buffer = bufferAlloc(DATA_DESCRIPTOR_SIZE);
559
- // optional signature (required according to Archive Utility)
560
- buffer.writeUInt32LE(0x08074b50, 0);
561
- // crc-32 4 bytes
562
- buffer.writeUInt32LE(this.crc32, 4);
563
- // compressed size 4 bytes
564
- buffer.writeUInt32LE(this.compressedSize, 8);
565
- // uncompressed size 4 bytes
566
- buffer.writeUInt32LE(this.uncompressedSize, 12);
567
- return buffer;
568
- } else {
569
- // ZIP64 format
570
- var buffer = bufferAlloc(ZIP64_DATA_DESCRIPTOR_SIZE);
571
- // optional signature (unknown if anyone cares about this)
572
- buffer.writeUInt32LE(0x08074b50, 0);
573
- // crc-32 4 bytes
574
- buffer.writeUInt32LE(this.crc32, 4);
575
- // compressed size 8 bytes
576
- writeUInt64LE(buffer, this.compressedSize, 8);
577
- // uncompressed size 8 bytes
578
- writeUInt64LE(buffer, this.uncompressedSize, 16);
579
- return buffer;
580
- }
581
- };
582
- var CENTRAL_DIRECTORY_RECORD_FIXED_SIZE = 46;
583
- var INFO_ZIP_UNIVERSAL_TIMESTAMP_EXTRA_FIELD_SIZE = 9;
584
- var ZIP64_EXTENDED_INFORMATION_EXTRA_FIELD_SIZE = 28;
585
- Entry.prototype.getCentralDirectoryRecord = function() {
586
- var fixedSizeStuff = bufferAlloc(CENTRAL_DIRECTORY_RECORD_FIXED_SIZE);
587
- var generalPurposeBitFlag = FILE_NAME_IS_UTF8;
588
- if (!this.crcAndFileSizeKnown) generalPurposeBitFlag |= UNKNOWN_CRC32_AND_FILE_SIZES;
589
-
590
- var izutefBuffer = EMPTY_BUFFER;
591
- if (!this.forceDosTimestamp) {
592
- // Here is one specification for this: https://commons.apache.org/proper/commons-compress/apidocs/org/apache/commons/compress/archivers/zip/X5455_ExtendedTimestamp.html
593
- // See also the Info-ZIP source code unix/unix.c:set_extra_field() and zipfile.c:ef_scan_ut_time().
594
- izutefBuffer = bufferAlloc(INFO_ZIP_UNIVERSAL_TIMESTAMP_EXTRA_FIELD_SIZE);
595
- // 0x5455 Short tag for this extra block type ("UT")
596
- izutefBuffer.writeUInt16LE(0x5455, 0);
597
- // TSize Short total data size for this block
598
- izutefBuffer.writeUInt16LE(INFO_ZIP_UNIVERSAL_TIMESTAMP_EXTRA_FIELD_SIZE - 4, 2);
599
- // See Info-ZIP source code zip.h for these constant values:
600
- var EB_UT_FL_MTIME = (1 << 0);
601
- var EB_UT_FL_ATIME = (1 << 1);
602
- // Note that we set the atime flag despite not providing the atime field.
603
- // The central directory version of this extra field is specified to never contain the atime field even when the flag is set.
604
- // We set it to match the Info-ZIP behavior in order to minimize incompatibility with zip file readers that may have rigid input expectations.
605
- // Flags Byte info bits
606
- izutefBuffer.writeUInt8(EB_UT_FL_MTIME | EB_UT_FL_ATIME, 4);
607
- // (ModTime) Long time of last modification (UTC/GMT)
608
- var timestamp = Math.floor(this.mtime.getTime() / 1000);
609
- if (timestamp < -0x80000000) timestamp = -0x80000000; // 1901-12-13T20:45:52.000Z
610
- if (timestamp > 0x7fffffff) timestamp = 0x7fffffff; // 2038-01-19T03:14:07.000Z
611
- izutefBuffer.writeUInt32LE(timestamp, 5);
612
- }
613
-
614
- var normalCompressedSize = this.compressedSize;
615
- var normalUncompressedSize = this.uncompressedSize;
616
- var normalRelativeOffsetOfLocalHeader = this.relativeOffsetOfLocalHeader;
617
- var versionNeededToExtract = VERSION_NEEDED_TO_EXTRACT_UTF8;
618
- var zeiefBuffer = EMPTY_BUFFER;
619
- if (this.useZip64Format()) {
620
- normalCompressedSize = 0xffffffff;
621
- normalUncompressedSize = 0xffffffff;
622
- normalRelativeOffsetOfLocalHeader = 0xffffffff;
623
- versionNeededToExtract = VERSION_NEEDED_TO_EXTRACT_ZIP64;
624
-
625
- // ZIP64 extended information extra field
626
- zeiefBuffer = bufferAlloc(ZIP64_EXTENDED_INFORMATION_EXTRA_FIELD_SIZE);
627
- // 0x0001 2 bytes Tag for this "extra" block type
628
- zeiefBuffer.writeUInt16LE(0x0001, 0);
629
- // Size 2 bytes Size of this "extra" block
630
- zeiefBuffer.writeUInt16LE(ZIP64_EXTENDED_INFORMATION_EXTRA_FIELD_SIZE - 4, 2);
631
- // Original Size 8 bytes Original uncompressed file size
632
- writeUInt64LE(zeiefBuffer, this.uncompressedSize, 4);
633
- // Compressed Size 8 bytes Size of compressed data
634
- writeUInt64LE(zeiefBuffer, this.compressedSize, 12);
635
- // Relative Header Offset 8 bytes Offset of local header record
636
- writeUInt64LE(zeiefBuffer, this.relativeOffsetOfLocalHeader, 20);
637
- // Disk Start Number 4 bytes Number of the disk on which this file starts
638
- // (omit)
639
- }
640
-
641
- // central file header signature 4 bytes (0x02014b50)
642
- fixedSizeStuff.writeUInt32LE(0x02014b50, 0);
643
- // version made by 2 bytes
644
- fixedSizeStuff.writeUInt16LE(VERSION_MADE_BY, 4);
645
- // version needed to extract 2 bytes
646
- fixedSizeStuff.writeUInt16LE(versionNeededToExtract, 6);
647
- // general purpose bit flag 2 bytes
648
- fixedSizeStuff.writeUInt16LE(generalPurposeBitFlag, 8);
649
- // compression method 2 bytes
650
- fixedSizeStuff.writeUInt16LE(this.getCompressionMethod(), 10);
651
- // last mod file time 2 bytes
652
- fixedSizeStuff.writeUInt16LE(this.lastModFileTime, 12);
653
- // last mod file date 2 bytes
654
- fixedSizeStuff.writeUInt16LE(this.lastModFileDate, 14);
655
- // crc-32 4 bytes
656
- fixedSizeStuff.writeUInt32LE(this.crc32, 16);
657
- // compressed size 4 bytes
658
- fixedSizeStuff.writeUInt32LE(normalCompressedSize, 20);
659
- // uncompressed size 4 bytes
660
- fixedSizeStuff.writeUInt32LE(normalUncompressedSize, 24);
661
- // file name length 2 bytes
662
- fixedSizeStuff.writeUInt16LE(this.utf8FileName.length, 28);
663
- // extra field length 2 bytes
664
- fixedSizeStuff.writeUInt16LE(izutefBuffer.length + zeiefBuffer.length, 30);
665
- // file comment length 2 bytes
666
- fixedSizeStuff.writeUInt16LE(this.fileComment.length, 32);
667
- // disk number start 2 bytes
668
- fixedSizeStuff.writeUInt16LE(0, 34);
669
- // internal file attributes 2 bytes
670
- fixedSizeStuff.writeUInt16LE(0, 36);
671
- // external file attributes 4 bytes
672
- fixedSizeStuff.writeUInt32LE(this.externalFileAttributes, 38);
673
- // relative offset of local header 4 bytes
674
- fixedSizeStuff.writeUInt32LE(normalRelativeOffsetOfLocalHeader, 42);
675
-
676
- return Buffer.concat([
677
- fixedSizeStuff,
678
- // file name (variable size)
679
- this.utf8FileName,
680
- // extra field (variable size)
681
- izutefBuffer,
682
- zeiefBuffer,
683
- // file comment (variable size)
684
- this.fileComment,
685
- ]);
686
- };
687
- Entry.prototype.getCompressionMethod = function() {
688
- var NO_COMPRESSION = 0;
689
- var DEFLATE_COMPRESSION = 8;
690
- return this.compressionLevel === 0 ? NO_COMPRESSION : DEFLATE_COMPRESSION;
691
- };
692
-
693
- // These are intentionally computed in the current system timezone
694
- // to match how the DOS encoding operates in this library.
695
- var minDosDate = new Date(1980, 0, 1);
696
- var maxDosDate = new Date(2107, 11, 31, 23, 59, 58);
697
- function dateToDosDateTime(jsDate) {
698
- // Clamp out of bounds timestamps.
699
- if (jsDate < minDosDate) jsDate = minDosDate;
700
- else if (jsDate > maxDosDate) jsDate = maxDosDate;
701
-
702
- var date = 0;
703
- date |= jsDate.getDate() & 0x1f; // 1-31
704
- date |= ((jsDate.getMonth() + 1) & 0xf) << 5; // 0-11, 1-12
705
- date |= ((jsDate.getFullYear() - 1980) & 0x7f) << 9; // 0-128, 1980-2108
706
-
707
- var time = 0;
708
- time |= Math.floor(jsDate.getSeconds() / 2); // 0-59, 0-29 (lose odd numbers)
709
- time |= (jsDate.getMinutes() & 0x3f) << 5; // 0-59
710
- time |= (jsDate.getHours() & 0x1f) << 11; // 0-23
711
-
712
- return {date: date, time: time};
713
- }
714
-
715
- function writeUInt64LE(buffer, n, offset) {
716
- // can't use bitshift here, because JavaScript only allows bitshifting on 32-bit integers.
717
- var high = Math.floor(n / 0x100000000);
718
- var low = n % 0x100000000;
719
- buffer.writeUInt32LE(low, offset);
720
- buffer.writeUInt32LE(high, offset + 4);
721
- }
722
-
723
- function defaultCallback(err) {
724
- if (err) throw err;
725
- }
726
-
727
- util.inherits(ByteCounter, Transform);
728
- function ByteCounter(options) {
729
- Transform.call(this, options);
730
- this.byteCount = 0;
731
- }
732
- ByteCounter.prototype._transform = function(chunk, encoding, cb) {
733
- this.byteCount += chunk.length;
734
- cb(null, chunk);
735
- };
736
-
737
- util.inherits(Crc32Watcher, Transform);
738
- function Crc32Watcher(options) {
739
- Transform.call(this, options);
740
- this.crc32 = 0;
741
- }
742
- Crc32Watcher.prototype._transform = function(chunk, encoding, cb) {
743
- this.crc32 = crc32.unsigned(chunk, this.crc32);
744
- cb(null, chunk);
745
- };
746
-
747
- var cp437 = '\u0000☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ';
748
- if (cp437.length !== 256) throw new Error("assertion failure");
749
- var reverseCp437 = null;
750
-
751
- function encodeCp437(string) {
752
- if (/^[\x20-\x7e]*$/.test(string)) {
753
- // CP437, ASCII, and UTF-8 overlap in this range.
754
- return bufferFrom(string, "utf-8");
755
- }
756
-
757
- // This is the slow path.
758
- if (reverseCp437 == null) {
759
- // cache this once
760
- reverseCp437 = {};
761
- for (var i = 0; i < cp437.length; i++) {
762
- reverseCp437[cp437[i]] = i;
763
- }
764
- }
765
-
766
- var result = bufferAlloc(string.length);
767
- for (var i = 0; i < string.length; i++) {
768
- var b = reverseCp437[string[i]];
769
- if (b == null) throw new Error("character not encodable in CP437: " + JSON.stringify(string[i]));
770
- result[i] = b;
771
- }
772
-
773
- return result;
774
- }
775
-
776
- function bufferAlloc(size) {
777
- bufferAlloc = modern;
778
- try {
779
- return bufferAlloc(size);
780
- } catch (e) {
781
- bufferAlloc = legacy;
782
- return bufferAlloc(size);
783
- }
784
- function modern(size) {
785
- return Buffer.allocUnsafe(size);
786
- }
787
- function legacy(size) {
788
- return new Buffer(size);
789
- }
790
- }
791
- function bufferFrom(something, encoding) {
792
- bufferFrom = modern;
793
- try {
794
- return bufferFrom(something, encoding);
795
- } catch (e) {
796
- bufferFrom = legacy;
797
- return bufferFrom(something, encoding);
798
- }
799
- function modern(something, encoding) {
800
- return Buffer.from(something, encoding);
801
- }
802
- function legacy(something, encoding) {
803
- return new Buffer(something, encoding);
804
- }
805
- }
806
- function bufferIncludes(buffer, content) {
807
- bufferIncludes = modern;
808
- try {
809
- return bufferIncludes(buffer, content);
810
- } catch (e) {
811
- bufferIncludes = legacy;
812
- return bufferIncludes(buffer, content);
813
- }
814
- function modern(buffer, content) {
815
- return buffer.includes(content);
816
- }
817
- function legacy(buffer, content) {
818
- for (var i = 0; i <= buffer.length - content.length; i++) {
819
- for (var j = 0;; j++) {
820
- if (j === content.length) return true;
821
- if (buffer[i + j] !== content[j]) break;
822
- }
823
- }
824
- return false;
825
- }
826
- }