@iconify/tools 4.0.0-dev.1 → 4.0.0

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 (295) hide show
  1. package/lib/colors/attribs.d.cts +27 -0
  2. package/lib/colors/attribs.d.mts +27 -0
  3. package/lib/colors/attribs.d.ts +1 -1
  4. package/lib/colors/detect.cjs +2 -2
  5. package/lib/colors/detect.d.cts +16 -0
  6. package/lib/colors/detect.d.mts +16 -0
  7. package/lib/colors/detect.mjs +3 -3
  8. package/lib/colors/parse.cjs +132 -276
  9. package/lib/colors/parse.d.cts +60 -0
  10. package/lib/colors/parse.d.mts +60 -0
  11. package/lib/colors/parse.d.ts +7 -15
  12. package/lib/colors/parse.mjs +136 -279
  13. package/lib/colors/validate.cjs +2 -11
  14. package/lib/colors/validate.d.cts +20 -0
  15. package/lib/colors/validate.d.mts +20 -0
  16. package/lib/colors/validate.d.ts +4 -11
  17. package/lib/colors/validate.mjs +4 -12
  18. package/lib/css/parse.d.cts +6 -0
  19. package/lib/css/parse.d.mts +6 -0
  20. package/lib/css/parser/error.d.cts +13 -0
  21. package/lib/css/parser/error.d.mts +13 -0
  22. package/lib/css/parser/error.d.ts +1 -1
  23. package/lib/css/parser/export.d.cts +8 -0
  24. package/lib/css/parser/export.d.mts +8 -0
  25. package/lib/css/parser/strings.d.cts +16 -0
  26. package/lib/css/parser/strings.d.mts +16 -0
  27. package/lib/css/parser/text.d.cts +20 -0
  28. package/lib/css/parser/text.d.mts +20 -0
  29. package/lib/css/parser/tokens.d.cts +9 -0
  30. package/lib/css/parser/tokens.d.mts +9 -0
  31. package/lib/css/parser/tree.d.cts +8 -0
  32. package/lib/css/parser/tree.d.mts +8 -0
  33. package/lib/css/parser/types.d.cts +52 -0
  34. package/lib/css/parser/types.d.mts +52 -0
  35. package/lib/css/parser/types.d.ts +1 -1
  36. package/lib/download/api/cache.d.cts +20 -0
  37. package/lib/download/api/cache.d.mts +20 -0
  38. package/lib/download/api/config.cjs +11 -0
  39. package/lib/download/api/config.d.cts +18 -0
  40. package/lib/download/api/config.d.mts +18 -0
  41. package/lib/download/api/config.d.ts +18 -0
  42. package/lib/download/api/config.mjs +8 -0
  43. package/lib/download/api/download.cjs +15 -7
  44. package/lib/download/api/download.d.cts +8 -0
  45. package/lib/download/api/download.d.mts +8 -0
  46. package/lib/download/api/download.mjs +11 -7
  47. package/lib/download/api/index.cjs +23 -7
  48. package/lib/download/api/index.d.cts +8 -0
  49. package/lib/download/api/index.d.mts +8 -0
  50. package/lib/download/api/index.mjs +19 -7
  51. package/lib/download/api/queue.cjs +104 -0
  52. package/lib/download/api/queue.d.cts +32 -0
  53. package/lib/download/api/queue.d.mts +32 -0
  54. package/lib/download/api/queue.d.ts +32 -0
  55. package/lib/download/api/queue.mjs +101 -0
  56. package/lib/download/api/types.d.cts +17 -0
  57. package/lib/download/api/types.d.mts +17 -0
  58. package/lib/download/api/types.d.ts +1 -1
  59. package/lib/download/git/branch.d.cts +8 -0
  60. package/lib/download/git/branch.d.mts +8 -0
  61. package/lib/download/git/hash.d.cts +8 -0
  62. package/lib/download/git/hash.d.mts +8 -0
  63. package/lib/download/git/index.cjs +2 -4
  64. package/lib/download/git/index.d.cts +29 -0
  65. package/lib/download/git/index.d.mts +29 -0
  66. package/lib/download/git/index.d.ts +1 -1
  67. package/lib/download/git/index.mjs +2 -4
  68. package/lib/download/git/reset.cjs +2 -4
  69. package/lib/download/git/reset.d.cts +6 -0
  70. package/lib/download/git/reset.d.mts +6 -0
  71. package/lib/download/git/reset.mjs +2 -4
  72. package/lib/download/github/hash.cjs +2 -0
  73. package/lib/download/github/hash.d.cts +8 -0
  74. package/lib/download/github/hash.d.mts +8 -0
  75. package/lib/download/github/hash.mjs +2 -0
  76. package/lib/download/github/index.cjs +2 -2
  77. package/lib/download/github/index.d.cts +31 -0
  78. package/lib/download/github/index.d.mts +31 -0
  79. package/lib/download/github/index.d.ts +1 -1
  80. package/lib/download/github/index.mjs +2 -2
  81. package/lib/download/github/types.d.cts +11 -0
  82. package/lib/download/github/types.d.mts +11 -0
  83. package/lib/download/github/types.d.ts +1 -1
  84. package/lib/download/gitlab/hash.cjs +2 -0
  85. package/lib/download/gitlab/hash.d.cts +8 -0
  86. package/lib/download/gitlab/hash.d.mts +8 -0
  87. package/lib/download/gitlab/hash.mjs +2 -0
  88. package/lib/download/gitlab/index.cjs +2 -2
  89. package/lib/download/gitlab/index.d.cts +31 -0
  90. package/lib/download/gitlab/index.d.mts +31 -0
  91. package/lib/download/gitlab/index.d.ts +1 -1
  92. package/lib/download/gitlab/index.mjs +2 -2
  93. package/lib/download/gitlab/types.d.cts +15 -0
  94. package/lib/download/gitlab/types.d.mts +15 -0
  95. package/lib/download/gitlab/types.d.ts +1 -1
  96. package/lib/download/helpers/untar.d.cts +6 -0
  97. package/lib/download/helpers/untar.d.mts +6 -0
  98. package/lib/download/helpers/unzip.d.cts +6 -0
  99. package/lib/download/helpers/unzip.d.mts +6 -0
  100. package/lib/download/index.cjs +2 -2
  101. package/lib/download/index.d.cts +48 -0
  102. package/lib/download/index.d.mts +48 -0
  103. package/lib/download/index.d.ts +1 -1
  104. package/lib/download/index.mjs +2 -2
  105. package/lib/download/npm/index.cjs +2 -2
  106. package/lib/download/npm/index.d.cts +30 -0
  107. package/lib/download/npm/index.d.mts +30 -0
  108. package/lib/download/npm/index.d.ts +1 -1
  109. package/lib/download/npm/index.mjs +2 -2
  110. package/lib/download/npm/types.d.cts +9 -0
  111. package/lib/download/npm/types.d.mts +9 -0
  112. package/lib/download/npm/types.d.ts +1 -1
  113. package/lib/download/npm/version.d.cts +16 -0
  114. package/lib/download/npm/version.d.mts +16 -0
  115. package/lib/download/npm/version.d.ts +1 -1
  116. package/lib/download/types/modified.d.cts +6 -0
  117. package/lib/download/types/modified.d.mts +6 -0
  118. package/lib/download/types/modified.d.ts +1 -1
  119. package/lib/download/types/sources.d.cts +12 -0
  120. package/lib/download/types/sources.d.mts +12 -0
  121. package/lib/download/types/sources.d.ts +1 -1
  122. package/lib/export/directory.d.cts +26 -0
  123. package/lib/export/directory.d.mts +26 -0
  124. package/lib/export/directory.d.ts +1 -1
  125. package/lib/export/helpers/custom-files.d.cts +12 -0
  126. package/lib/export/helpers/custom-files.d.mts +12 -0
  127. package/lib/export/helpers/custom-files.d.ts +1 -1
  128. package/lib/export/helpers/prepare.d.cts +19 -0
  129. package/lib/export/helpers/prepare.d.mts +19 -0
  130. package/lib/export/helpers/prepare.d.ts +1 -1
  131. package/lib/export/helpers/types-version.d.cts +6 -0
  132. package/lib/export/helpers/types-version.d.mts +6 -0
  133. package/lib/export/icon-package.d.cts +26 -0
  134. package/lib/export/icon-package.d.mts +26 -0
  135. package/lib/export/icon-package.d.ts +2 -2
  136. package/lib/export/json-package.cjs +1 -0
  137. package/lib/export/json-package.d.cts +25 -0
  138. package/lib/export/json-package.d.mts +25 -0
  139. package/lib/export/json-package.d.ts +2 -1
  140. package/lib/export/json-package.mjs +1 -0
  141. package/lib/icon-set/index.cjs +25 -4
  142. package/lib/icon-set/index.d.cts +162 -0
  143. package/lib/icon-set/index.d.mts +162 -0
  144. package/lib/icon-set/index.mjs +25 -4
  145. package/lib/icon-set/match.d.cts +15 -0
  146. package/lib/icon-set/match.d.mts +15 -0
  147. package/lib/icon-set/merge.d.cts +14 -0
  148. package/lib/icon-set/merge.d.mts +14 -0
  149. package/lib/icon-set/modified.d.cts +16 -0
  150. package/lib/icon-set/modified.d.mts +16 -0
  151. package/lib/icon-set/props.d.cts +13 -0
  152. package/lib/icon-set/props.d.mts +13 -0
  153. package/lib/icon-set/tags.d.cts +23 -0
  154. package/lib/icon-set/tags.d.mts +23 -0
  155. package/lib/icon-set/types.d.cts +75 -0
  156. package/lib/icon-set/types.d.mts +75 -0
  157. package/lib/icon-set/types.d.ts +1 -1
  158. package/lib/import/directory.d.cts +52 -0
  159. package/lib/import/directory.d.mts +52 -0
  160. package/lib/import/directory.d.ts +1 -1
  161. package/lib/import/figma/index.cjs +3 -0
  162. package/lib/import/figma/index.d.cts +20 -0
  163. package/lib/import/figma/index.d.mts +20 -0
  164. package/lib/import/figma/index.mjs +3 -0
  165. package/lib/import/figma/nodes.cjs +1 -1
  166. package/lib/import/figma/nodes.d.cts +18 -0
  167. package/lib/import/figma/nodes.d.mts +18 -0
  168. package/lib/import/figma/nodes.mjs +1 -1
  169. package/lib/import/figma/query.cjs +104 -76
  170. package/lib/import/figma/query.d.cts +42 -0
  171. package/lib/import/figma/query.d.mts +42 -0
  172. package/lib/import/figma/query.d.ts +15 -2
  173. package/lib/import/figma/query.mjs +106 -78
  174. package/lib/import/figma/types/api.d.cts +53 -0
  175. package/lib/import/figma/types/api.d.mts +53 -0
  176. package/lib/import/figma/types/api.d.ts +1 -1
  177. package/lib/import/figma/types/nodes.d.cts +44 -0
  178. package/lib/import/figma/types/nodes.d.mts +44 -0
  179. package/lib/import/figma/types/nodes.d.ts +1 -1
  180. package/lib/import/figma/types/options.d.cts +59 -0
  181. package/lib/import/figma/types/options.d.mts +59 -0
  182. package/lib/import/figma/types/options.d.ts +1 -1
  183. package/lib/import/figma/types/result.d.cts +44 -0
  184. package/lib/import/figma/types/result.d.mts +44 -0
  185. package/lib/import/figma/types/result.d.ts +1 -1
  186. package/lib/index.cjs +14 -13
  187. package/lib/index.d.cts +78 -0
  188. package/lib/index.d.mts +78 -0
  189. package/lib/index.d.ts +8 -5
  190. package/lib/index.mjs +13 -12
  191. package/lib/misc/bump-version.d.cts +6 -0
  192. package/lib/misc/bump-version.d.mts +6 -0
  193. package/lib/misc/cheerio.d.cts +9 -0
  194. package/lib/misc/cheerio.d.mts +9 -0
  195. package/lib/misc/cheerio.d.ts +1 -1
  196. package/lib/misc/compare-dirs.cjs +3 -3
  197. package/lib/misc/compare-dirs.d.cts +11 -0
  198. package/lib/misc/compare-dirs.d.mts +11 -0
  199. package/lib/misc/compare-dirs.d.ts +1 -1
  200. package/lib/misc/compare-dirs.mjs +3 -3
  201. package/lib/misc/exec.d.cts +12 -0
  202. package/lib/misc/exec.d.mts +12 -0
  203. package/lib/misc/exec.d.ts +1 -1
  204. package/lib/misc/keyword.d.cts +6 -0
  205. package/lib/misc/keyword.d.mts +6 -0
  206. package/lib/misc/scan.d.cts +33 -0
  207. package/lib/misc/scan.d.mts +33 -0
  208. package/lib/misc/scan.d.ts +1 -1
  209. package/lib/misc/write-json.d.cts +6 -0
  210. package/lib/misc/write-json.d.mts +6 -0
  211. package/lib/optimise/figma.cjs +5 -5
  212. package/lib/optimise/figma.d.cts +11 -0
  213. package/lib/optimise/figma.d.mts +11 -0
  214. package/lib/optimise/figma.mjs +5 -5
  215. package/lib/optimise/flags.cjs +3 -3
  216. package/lib/optimise/flags.d.cts +11 -0
  217. package/lib/optimise/flags.d.mts +11 -0
  218. package/lib/optimise/flags.d.ts +1 -1
  219. package/lib/optimise/flags.mjs +3 -3
  220. package/lib/optimise/global-style.cjs +7 -7
  221. package/lib/optimise/global-style.d.cts +11 -0
  222. package/lib/optimise/global-style.d.mts +11 -0
  223. package/lib/optimise/global-style.d.ts +1 -1
  224. package/lib/optimise/global-style.mjs +7 -7
  225. package/lib/optimise/mask.cjs +1 -1
  226. package/lib/optimise/mask.d.cts +24 -0
  227. package/lib/optimise/mask.d.mts +24 -0
  228. package/lib/optimise/mask.mjs +2 -2
  229. package/lib/optimise/origin.d.cts +11 -0
  230. package/lib/optimise/origin.d.mts +11 -0
  231. package/lib/optimise/scale.d.cts +11 -0
  232. package/lib/optimise/scale.d.mts +11 -0
  233. package/lib/optimise/svgo.cjs +1 -1
  234. package/lib/optimise/svgo.d.cts +37 -0
  235. package/lib/optimise/svgo.d.mts +37 -0
  236. package/lib/optimise/svgo.mjs +1 -1
  237. package/lib/svg/analyse/error.d.cts +10 -0
  238. package/lib/svg/analyse/error.d.mts +10 -0
  239. package/lib/svg/analyse/error.d.ts +1 -0
  240. package/lib/svg/analyse/types.d.cts +92 -0
  241. package/lib/svg/analyse/types.d.mts +92 -0
  242. package/lib/svg/analyse/types.d.ts +4 -3
  243. package/lib/svg/analyse.cjs +2 -2
  244. package/lib/svg/analyse.d.cts +15 -0
  245. package/lib/svg/analyse.d.mts +15 -0
  246. package/lib/svg/analyse.d.ts +1 -0
  247. package/lib/svg/analyse.mjs +4 -4
  248. package/lib/svg/cleanup/attribs.cjs +1 -1
  249. package/lib/svg/cleanup/attribs.d.cts +11 -0
  250. package/lib/svg/cleanup/attribs.d.mts +11 -0
  251. package/lib/svg/cleanup/attribs.mjs +2 -2
  252. package/lib/svg/cleanup/bad-tags.cjs +1 -1
  253. package/lib/svg/cleanup/bad-tags.d.cts +17 -0
  254. package/lib/svg/cleanup/bad-tags.d.mts +17 -0
  255. package/lib/svg/cleanup/bad-tags.d.ts +1 -1
  256. package/lib/svg/cleanup/bad-tags.mjs +2 -2
  257. package/lib/svg/cleanup/inline-style.cjs +1 -1
  258. package/lib/svg/cleanup/inline-style.d.cts +11 -0
  259. package/lib/svg/cleanup/inline-style.d.mts +11 -0
  260. package/lib/svg/cleanup/inline-style.mjs +2 -2
  261. package/lib/svg/cleanup/root-style.cjs +1 -1
  262. package/lib/svg/cleanup/root-style.d.cts +17 -0
  263. package/lib/svg/cleanup/root-style.d.mts +17 -0
  264. package/lib/svg/cleanup/root-style.mjs +2 -2
  265. package/lib/svg/cleanup/root-svg.cjs +3 -3
  266. package/lib/svg/cleanup/root-svg.d.cts +11 -0
  267. package/lib/svg/cleanup/root-svg.d.mts +11 -0
  268. package/lib/svg/cleanup/root-svg.mjs +3 -3
  269. package/lib/svg/cleanup/svgo-style.cjs +2 -2
  270. package/lib/svg/cleanup/svgo-style.d.cts +11 -0
  271. package/lib/svg/cleanup/svgo-style.d.mts +11 -0
  272. package/lib/svg/cleanup/svgo-style.mjs +3 -3
  273. package/lib/svg/cleanup.d.cts +16 -0
  274. package/lib/svg/cleanup.d.mts +16 -0
  275. package/lib/svg/cleanup.d.ts +1 -1
  276. package/lib/svg/data/attributes.d.cts +77 -0
  277. package/lib/svg/data/attributes.d.mts +77 -0
  278. package/lib/svg/data/tags.d.cts +95 -0
  279. package/lib/svg/data/tags.d.mts +95 -0
  280. package/lib/svg/index.cjs +18 -1
  281. package/lib/svg/index.d.cts +52 -0
  282. package/lib/svg/index.d.mts +52 -0
  283. package/lib/svg/index.d.ts +5 -1
  284. package/lib/svg/index.mjs +19 -2
  285. package/lib/svg/parse-style.cjs +178 -235
  286. package/lib/svg/parse-style.d.cts +58 -0
  287. package/lib/svg/parse-style.d.mts +58 -0
  288. package/lib/svg/parse-style.d.ts +3 -9
  289. package/lib/svg/parse-style.mjs +180 -236
  290. package/lib/svg/parse.cjs +27 -59
  291. package/lib/svg/parse.d.cts +30 -0
  292. package/lib/svg/parse.d.mts +30 -0
  293. package/lib/svg/parse.d.ts +3 -10
  294. package/lib/svg/parse.mjs +28 -59
  295. package/package.json +26 -21
@@ -1,10 +1,12 @@
1
1
  'use strict';
2
2
 
3
3
  const download_api_index = require('../api/index.cjs');
4
+ require('axios');
4
5
  require('../api/cache.cjs');
5
6
  require('fs');
6
7
  require('crypto');
7
8
  require('../../misc/scan.cjs');
9
+ require('../api/config.cjs');
8
10
 
9
11
  async function getGitHubRepoHash(options) {
10
12
  const uri = `https://api.github.com/repos/${options.user}/${options.repo}/branches/${options.branch}`;
@@ -0,0 +1,8 @@
1
+ import { GitHubAPIOptions } from './types.cjs';
2
+
3
+ /**
4
+ * Get latest hash from GitHub using API
5
+ */
6
+ declare function getGitHubRepoHash(options: GitHubAPIOptions): Promise<string>;
7
+
8
+ export { getGitHubRepoHash };
@@ -0,0 +1,8 @@
1
+ import { GitHubAPIOptions } from './types.mjs';
2
+
3
+ /**
4
+ * Get latest hash from GitHub using API
5
+ */
6
+ declare function getGitHubRepoHash(options: GitHubAPIOptions): Promise<string>;
7
+
8
+ export { getGitHubRepoHash };
@@ -1,8 +1,10 @@
1
1
  import { sendAPIQuery } from '../api/index.mjs';
2
+ import 'axios';
2
3
  import '../api/cache.mjs';
3
4
  import 'fs';
4
5
  import 'crypto';
5
6
  import '../../misc/scan.mjs';
7
+ import '../api/config.mjs';
6
8
 
7
9
  async function getGitHubRepoHash(options) {
8
10
  const uri = `https://api.github.com/repos/${options.user}/${options.repo}/branches/${options.branch}`;
@@ -7,11 +7,11 @@ const download_api_download = require('../api/download.cjs');
7
7
  const download_helpers_unzip = require('../helpers/unzip.cjs');
8
8
  require('pathe');
9
9
  require('../api/index.cjs');
10
+ require('axios');
10
11
  require('../api/cache.cjs');
11
12
  require('crypto');
12
13
  require('../../misc/scan.cjs');
13
- require('util');
14
- require('stream');
14
+ require('../api/config.cjs');
15
15
  require('fs/promises');
16
16
  require('extract-zip');
17
17
 
@@ -0,0 +1,31 @@
1
+ import { ExportTargetOptions } from '../../export/helpers/prepare.cjs';
2
+ import { DocumentNotModified } from '../types/modified.cjs';
3
+ import { GitHubAPIOptions } from './types.cjs';
4
+ import { DownloadSourceMixin } from '../types/sources.cjs';
5
+
6
+ interface IfModifiedSinceOption {
7
+ ifModifiedSince: string | DownloadGitHubRepoResult;
8
+ }
9
+ /**
10
+ * Options for downloadGitHubRepo()
11
+ */
12
+ interface DownloadGitHubRepoOptions extends ExportTargetOptions, GitHubAPIOptions, Partial<IfModifiedSinceOption> {
13
+ cleanupOldFiles?: boolean;
14
+ cleanupOldDirectories?: boolean;
15
+ log?: boolean;
16
+ }
17
+ /**
18
+ * Result
19
+ */
20
+ interface DownloadGitHubRepoResult extends DownloadSourceMixin<'github'> {
21
+ rootDir: string;
22
+ contentsDir: string;
23
+ hash: string;
24
+ }
25
+ /**
26
+ * Download GitHub repo using API
27
+ */
28
+ declare function downloadGitHubRepo<T extends IfModifiedSinceOption & DownloadGitHubRepoOptions>(options: T): Promise<DownloadGitHubRepoResult | DocumentNotModified>;
29
+ declare function downloadGitHubRepo(options: DownloadGitHubRepoOptions): Promise<DownloadGitHubRepoResult>;
30
+
31
+ export { type DownloadGitHubRepoOptions, type DownloadGitHubRepoResult, downloadGitHubRepo };
@@ -0,0 +1,31 @@
1
+ import { ExportTargetOptions } from '../../export/helpers/prepare.mjs';
2
+ import { DocumentNotModified } from '../types/modified.mjs';
3
+ import { GitHubAPIOptions } from './types.mjs';
4
+ import { DownloadSourceMixin } from '../types/sources.mjs';
5
+
6
+ interface IfModifiedSinceOption {
7
+ ifModifiedSince: string | DownloadGitHubRepoResult;
8
+ }
9
+ /**
10
+ * Options for downloadGitHubRepo()
11
+ */
12
+ interface DownloadGitHubRepoOptions extends ExportTargetOptions, GitHubAPIOptions, Partial<IfModifiedSinceOption> {
13
+ cleanupOldFiles?: boolean;
14
+ cleanupOldDirectories?: boolean;
15
+ log?: boolean;
16
+ }
17
+ /**
18
+ * Result
19
+ */
20
+ interface DownloadGitHubRepoResult extends DownloadSourceMixin<'github'> {
21
+ rootDir: string;
22
+ contentsDir: string;
23
+ hash: string;
24
+ }
25
+ /**
26
+ * Download GitHub repo using API
27
+ */
28
+ declare function downloadGitHubRepo<T extends IfModifiedSinceOption & DownloadGitHubRepoOptions>(options: T): Promise<DownloadGitHubRepoResult | DocumentNotModified>;
29
+ declare function downloadGitHubRepo(options: DownloadGitHubRepoOptions): Promise<DownloadGitHubRepoResult>;
30
+
31
+ export { type DownloadGitHubRepoOptions, type DownloadGitHubRepoResult, downloadGitHubRepo };
@@ -28,4 +28,4 @@ interface DownloadGitHubRepoResult extends DownloadSourceMixin<'github'> {
28
28
  declare function downloadGitHubRepo<T extends IfModifiedSinceOption & DownloadGitHubRepoOptions>(options: T): Promise<DownloadGitHubRepoResult | DocumentNotModified>;
29
29
  declare function downloadGitHubRepo(options: DownloadGitHubRepoOptions): Promise<DownloadGitHubRepoResult>;
30
30
 
31
- export { DownloadGitHubRepoOptions, DownloadGitHubRepoResult, downloadGitHubRepo };
31
+ export { type DownloadGitHubRepoOptions, type DownloadGitHubRepoResult, downloadGitHubRepo };
@@ -5,11 +5,11 @@ import { downloadFile } from '../api/download.mjs';
5
5
  import { unzip } from '../helpers/unzip.mjs';
6
6
  import 'pathe';
7
7
  import '../api/index.mjs';
8
+ import 'axios';
8
9
  import '../api/cache.mjs';
9
10
  import 'crypto';
10
11
  import '../../misc/scan.mjs';
11
- import 'util';
12
- import 'stream';
12
+ import '../api/config.mjs';
13
13
  import 'fs/promises';
14
14
  import 'extract-zip';
15
15
 
@@ -0,0 +1,11 @@
1
+ /**
2
+ * API options
3
+ */
4
+ interface GitHubAPIOptions {
5
+ token: string;
6
+ user: string;
7
+ repo: string;
8
+ branch: string;
9
+ }
10
+
11
+ export type { GitHubAPIOptions };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * API options
3
+ */
4
+ interface GitHubAPIOptions {
5
+ token: string;
6
+ user: string;
7
+ repo: string;
8
+ branch: string;
9
+ }
10
+
11
+ export type { GitHubAPIOptions };
@@ -8,4 +8,4 @@ interface GitHubAPIOptions {
8
8
  branch: string;
9
9
  }
10
10
 
11
- export { GitHubAPIOptions };
11
+ export type { GitHubAPIOptions };
@@ -2,10 +2,12 @@
2
2
 
3
3
  const download_api_index = require('../api/index.cjs');
4
4
  const download_gitlab_types = require('./types.cjs');
5
+ require('axios');
5
6
  require('../api/cache.cjs');
6
7
  require('fs');
7
8
  require('crypto');
8
9
  require('../../misc/scan.cjs');
10
+ require('../api/config.cjs');
9
11
 
10
12
  async function getGitLabRepoHash(options) {
11
13
  const uri = `${options.uri || download_gitlab_types.defaultGitLabBaseURI}/${options.project}/repository/branches/${options.branch}/`;
@@ -0,0 +1,8 @@
1
+ import { GitLabAPIOptions } from './types.cjs';
2
+
3
+ /**
4
+ * Get latest hash from GitHub using API
5
+ */
6
+ declare function getGitLabRepoHash(options: GitLabAPIOptions): Promise<string>;
7
+
8
+ export { getGitLabRepoHash };
@@ -0,0 +1,8 @@
1
+ import { GitLabAPIOptions } from './types.mjs';
2
+
3
+ /**
4
+ * Get latest hash from GitHub using API
5
+ */
6
+ declare function getGitLabRepoHash(options: GitLabAPIOptions): Promise<string>;
7
+
8
+ export { getGitLabRepoHash };
@@ -1,9 +1,11 @@
1
1
  import { sendAPIQuery } from '../api/index.mjs';
2
2
  import { defaultGitLabBaseURI } from './types.mjs';
3
+ import 'axios';
3
4
  import '../api/cache.mjs';
4
5
  import 'fs';
5
6
  import 'crypto';
6
7
  import '../../misc/scan.mjs';
8
+ import '../api/config.mjs';
7
9
 
8
10
  async function getGitLabRepoHash(options) {
9
11
  const uri = `${options.uri || defaultGitLabBaseURI}/${options.project}/repository/branches/${options.branch}/`;
@@ -8,11 +8,11 @@ const download_api_download = require('../api/download.cjs');
8
8
  const download_helpers_unzip = require('../helpers/unzip.cjs');
9
9
  require('pathe');
10
10
  require('../api/index.cjs');
11
+ require('axios');
11
12
  require('../api/cache.cjs');
12
13
  require('crypto');
13
14
  require('../../misc/scan.cjs');
14
- require('util');
15
- require('stream');
15
+ require('../api/config.cjs');
16
16
  require('fs/promises');
17
17
  require('extract-zip');
18
18
 
@@ -0,0 +1,31 @@
1
+ import { ExportTargetOptions } from '../../export/helpers/prepare.cjs';
2
+ import { DocumentNotModified } from '../types/modified.cjs';
3
+ import { GitLabAPIOptions } from './types.cjs';
4
+ import { DownloadSourceMixin } from '../types/sources.cjs';
5
+
6
+ interface IfModifiedSinceOption {
7
+ ifModifiedSince: string | DownloadGitLabRepoResult;
8
+ }
9
+ /**
10
+ * Options for downloadGitLabRepo()
11
+ */
12
+ interface DownloadGitLabRepoOptions extends ExportTargetOptions, GitLabAPIOptions, Partial<IfModifiedSinceOption> {
13
+ cleanupOldFiles?: boolean;
14
+ cleanupOldDirectories?: boolean;
15
+ log?: boolean;
16
+ }
17
+ /**
18
+ * Result
19
+ */
20
+ interface DownloadGitLabRepoResult extends DownloadSourceMixin<'gitlab'> {
21
+ rootDir: string;
22
+ contentsDir: string;
23
+ hash: string;
24
+ }
25
+ /**
26
+ * Download GitLab repo using API
27
+ */
28
+ declare function downloadGitLabRepo<T extends IfModifiedSinceOption & DownloadGitLabRepoOptions>(options: T): Promise<DownloadGitLabRepoResult | DocumentNotModified>;
29
+ declare function downloadGitLabRepo(options: DownloadGitLabRepoOptions): Promise<DownloadGitLabRepoResult>;
30
+
31
+ export { type DownloadGitLabRepoOptions, type DownloadGitLabRepoResult, downloadGitLabRepo };
@@ -0,0 +1,31 @@
1
+ import { ExportTargetOptions } from '../../export/helpers/prepare.mjs';
2
+ import { DocumentNotModified } from '../types/modified.mjs';
3
+ import { GitLabAPIOptions } from './types.mjs';
4
+ import { DownloadSourceMixin } from '../types/sources.mjs';
5
+
6
+ interface IfModifiedSinceOption {
7
+ ifModifiedSince: string | DownloadGitLabRepoResult;
8
+ }
9
+ /**
10
+ * Options for downloadGitLabRepo()
11
+ */
12
+ interface DownloadGitLabRepoOptions extends ExportTargetOptions, GitLabAPIOptions, Partial<IfModifiedSinceOption> {
13
+ cleanupOldFiles?: boolean;
14
+ cleanupOldDirectories?: boolean;
15
+ log?: boolean;
16
+ }
17
+ /**
18
+ * Result
19
+ */
20
+ interface DownloadGitLabRepoResult extends DownloadSourceMixin<'gitlab'> {
21
+ rootDir: string;
22
+ contentsDir: string;
23
+ hash: string;
24
+ }
25
+ /**
26
+ * Download GitLab repo using API
27
+ */
28
+ declare function downloadGitLabRepo<T extends IfModifiedSinceOption & DownloadGitLabRepoOptions>(options: T): Promise<DownloadGitLabRepoResult | DocumentNotModified>;
29
+ declare function downloadGitLabRepo(options: DownloadGitLabRepoOptions): Promise<DownloadGitLabRepoResult>;
30
+
31
+ export { type DownloadGitLabRepoOptions, type DownloadGitLabRepoResult, downloadGitLabRepo };
@@ -28,4 +28,4 @@ interface DownloadGitLabRepoResult extends DownloadSourceMixin<'gitlab'> {
28
28
  declare function downloadGitLabRepo<T extends IfModifiedSinceOption & DownloadGitLabRepoOptions>(options: T): Promise<DownloadGitLabRepoResult | DocumentNotModified>;
29
29
  declare function downloadGitLabRepo(options: DownloadGitLabRepoOptions): Promise<DownloadGitLabRepoResult>;
30
30
 
31
- export { DownloadGitLabRepoOptions, DownloadGitLabRepoResult, downloadGitLabRepo };
31
+ export { type DownloadGitLabRepoOptions, type DownloadGitLabRepoResult, downloadGitLabRepo };
@@ -6,11 +6,11 @@ import { downloadFile } from '../api/download.mjs';
6
6
  import { unzip } from '../helpers/unzip.mjs';
7
7
  import 'pathe';
8
8
  import '../api/index.mjs';
9
+ import 'axios';
9
10
  import '../api/cache.mjs';
10
11
  import 'crypto';
11
12
  import '../../misc/scan.mjs';
12
- import 'util';
13
- import 'stream';
13
+ import '../api/config.mjs';
14
14
  import 'fs/promises';
15
15
  import 'extract-zip';
16
16
 
@@ -0,0 +1,15 @@
1
+ /**
2
+ * API options
3
+ */
4
+ interface GitLabAPIOptions {
5
+ uri?: string;
6
+ token: string;
7
+ project: string;
8
+ branch: string;
9
+ }
10
+ /**
11
+ * Default base URI for GitLab API
12
+ */
13
+ declare const defaultGitLabBaseURI = "https://gitlab.com/api/v4/projects";
14
+
15
+ export { type GitLabAPIOptions, defaultGitLabBaseURI };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * API options
3
+ */
4
+ interface GitLabAPIOptions {
5
+ uri?: string;
6
+ token: string;
7
+ project: string;
8
+ branch: string;
9
+ }
10
+ /**
11
+ * Default base URI for GitLab API
12
+ */
13
+ declare const defaultGitLabBaseURI = "https://gitlab.com/api/v4/projects";
14
+
15
+ export { type GitLabAPIOptions, defaultGitLabBaseURI };
@@ -12,4 +12,4 @@ interface GitLabAPIOptions {
12
12
  */
13
13
  declare const defaultGitLabBaseURI = "https://gitlab.com/api/v4/projects";
14
14
 
15
- export { GitLabAPIOptions, defaultGitLabBaseURI };
15
+ export { type GitLabAPIOptions, defaultGitLabBaseURI };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Unpack .tgz archive
3
+ */
4
+ declare function untar(file: string, path: string): Promise<void>;
5
+
6
+ export { untar };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Unpack .tgz archive
3
+ */
4
+ declare function untar(file: string, path: string): Promise<void>;
5
+
6
+ export { untar };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Unzip archive
3
+ */
4
+ declare function unzip(source: string, path: string): Promise<void>;
5
+
6
+ export { unzip };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Unzip archive
3
+ */
4
+ declare function unzip(source: string, path: string): Promise<void>;
5
+
6
+ export { unzip };
@@ -9,12 +9,12 @@ require('../export/helpers/prepare.cjs');
9
9
  require('pathe');
10
10
  require('./github/hash.cjs');
11
11
  require('./api/index.cjs');
12
+ require('axios');
12
13
  require('./api/cache.cjs');
13
14
  require('crypto');
14
15
  require('../misc/scan.cjs');
16
+ require('./api/config.cjs');
15
17
  require('./api/download.cjs');
16
- require('util');
17
- require('stream');
18
18
  require('fs/promises');
19
19
  require('./helpers/unzip.cjs');
20
20
  require('extract-zip');
@@ -0,0 +1,48 @@
1
+ import { DownloadGitHubRepoOptions, DownloadGitHubRepoResult } from './github/index.cjs';
2
+ import { DownloadGitRepoOptions, DownloadGitRepoResult } from './git/index.cjs';
3
+ import { DownloadNPMPackageOptions, DownloadNPMPackageResult } from './npm/index.cjs';
4
+ import { DocumentNotModified } from './types/modified.cjs';
5
+ import { DownloadSourceType, DownloadSourceMixin } from './types/sources.cjs';
6
+ import { DownloadGitLabRepoOptions, DownloadGitLabRepoResult } from './gitlab/index.cjs';
7
+ import '../export/helpers/prepare.cjs';
8
+ import './github/types.cjs';
9
+ import './gitlab/types.cjs';
10
+
11
+ /**
12
+ * Options and result combinations
13
+ */
14
+ interface DownloadGitRepo {
15
+ options: DownloadGitRepoOptions & DownloadSourceMixin<'git'>;
16
+ result: DownloadGitRepoResult;
17
+ }
18
+ interface DownloadGitHubRepo {
19
+ options: DownloadGitHubRepoOptions & DownloadSourceMixin<'github'>;
20
+ result: DownloadGitHubRepoResult;
21
+ }
22
+ interface DownloadGitLabRepo {
23
+ options: DownloadGitLabRepoOptions & DownloadSourceMixin<'gitlab'>;
24
+ result: DownloadGitLabRepoResult;
25
+ }
26
+ interface DownloadNPMPackage {
27
+ options: DownloadNPMPackageOptions & DownloadSourceMixin<'npm'>;
28
+ result: DownloadNPMPackageResult;
29
+ }
30
+ /**
31
+ * Combinations based on type
32
+ */
33
+ type DownloadParamsMixin<T extends DownloadSourceType> = T extends 'git' ? DownloadGitRepo : T extends 'github' ? DownloadGitHubRepo : T extends 'gitlab' ? DownloadGitLabRepo : T extends 'npm' ? DownloadNPMPackage : never;
34
+ /**
35
+ * Combinations
36
+ */
37
+ type DownloadParams = DownloadGitRepo | DownloadGitHubRepo | DownloadGitLabRepo | DownloadNPMPackage;
38
+ /**
39
+ * Pick options or result from combinations
40
+ */
41
+ type DownloadOptions<T extends DownloadSourceType> = DownloadParamsMixin<T>['options'];
42
+ type DownloadResult<T extends DownloadSourceType> = Promise<DocumentNotModified | DownloadParamsMixin<T>['result']>;
43
+ declare function downloadPackage<T extends 'git'>(options: DownloadOptions<T>): DownloadResult<T>;
44
+ declare function downloadPackage<T extends 'github'>(options: DownloadOptions<T>): DownloadResult<T>;
45
+ declare function downloadPackage<T extends 'gitlab'>(options: DownloadOptions<T>): DownloadResult<T>;
46
+ declare function downloadPackage<T extends 'npm'>(options: DownloadOptions<T>): DownloadResult<T>;
47
+
48
+ export { type DownloadParams, type DownloadParamsMixin, downloadPackage };
@@ -0,0 +1,48 @@
1
+ import { DownloadGitHubRepoOptions, DownloadGitHubRepoResult } from './github/index.mjs';
2
+ import { DownloadGitRepoOptions, DownloadGitRepoResult } from './git/index.mjs';
3
+ import { DownloadNPMPackageOptions, DownloadNPMPackageResult } from './npm/index.mjs';
4
+ import { DocumentNotModified } from './types/modified.mjs';
5
+ import { DownloadSourceType, DownloadSourceMixin } from './types/sources.mjs';
6
+ import { DownloadGitLabRepoOptions, DownloadGitLabRepoResult } from './gitlab/index.mjs';
7
+ import '../export/helpers/prepare.mjs';
8
+ import './github/types.mjs';
9
+ import './gitlab/types.mjs';
10
+
11
+ /**
12
+ * Options and result combinations
13
+ */
14
+ interface DownloadGitRepo {
15
+ options: DownloadGitRepoOptions & DownloadSourceMixin<'git'>;
16
+ result: DownloadGitRepoResult;
17
+ }
18
+ interface DownloadGitHubRepo {
19
+ options: DownloadGitHubRepoOptions & DownloadSourceMixin<'github'>;
20
+ result: DownloadGitHubRepoResult;
21
+ }
22
+ interface DownloadGitLabRepo {
23
+ options: DownloadGitLabRepoOptions & DownloadSourceMixin<'gitlab'>;
24
+ result: DownloadGitLabRepoResult;
25
+ }
26
+ interface DownloadNPMPackage {
27
+ options: DownloadNPMPackageOptions & DownloadSourceMixin<'npm'>;
28
+ result: DownloadNPMPackageResult;
29
+ }
30
+ /**
31
+ * Combinations based on type
32
+ */
33
+ type DownloadParamsMixin<T extends DownloadSourceType> = T extends 'git' ? DownloadGitRepo : T extends 'github' ? DownloadGitHubRepo : T extends 'gitlab' ? DownloadGitLabRepo : T extends 'npm' ? DownloadNPMPackage : never;
34
+ /**
35
+ * Combinations
36
+ */
37
+ type DownloadParams = DownloadGitRepo | DownloadGitHubRepo | DownloadGitLabRepo | DownloadNPMPackage;
38
+ /**
39
+ * Pick options or result from combinations
40
+ */
41
+ type DownloadOptions<T extends DownloadSourceType> = DownloadParamsMixin<T>['options'];
42
+ type DownloadResult<T extends DownloadSourceType> = Promise<DocumentNotModified | DownloadParamsMixin<T>['result']>;
43
+ declare function downloadPackage<T extends 'git'>(options: DownloadOptions<T>): DownloadResult<T>;
44
+ declare function downloadPackage<T extends 'github'>(options: DownloadOptions<T>): DownloadResult<T>;
45
+ declare function downloadPackage<T extends 'gitlab'>(options: DownloadOptions<T>): DownloadResult<T>;
46
+ declare function downloadPackage<T extends 'npm'>(options: DownloadOptions<T>): DownloadResult<T>;
47
+
48
+ export { type DownloadParams, type DownloadParamsMixin, downloadPackage };
@@ -45,4 +45,4 @@ declare function downloadPackage<T extends 'github'>(options: DownloadOptions<T>
45
45
  declare function downloadPackage<T extends 'gitlab'>(options: DownloadOptions<T>): DownloadResult<T>;
46
46
  declare function downloadPackage<T extends 'npm'>(options: DownloadOptions<T>): DownloadResult<T>;
47
47
 
48
- export { DownloadParams, DownloadParamsMixin, downloadPackage };
48
+ export { type DownloadParams, type DownloadParamsMixin, downloadPackage };
@@ -7,12 +7,12 @@ import '../export/helpers/prepare.mjs';
7
7
  import 'pathe';
8
8
  import './github/hash.mjs';
9
9
  import './api/index.mjs';
10
+ import 'axios';
10
11
  import './api/cache.mjs';
11
12
  import 'crypto';
12
13
  import '../misc/scan.mjs';
14
+ import './api/config.mjs';
13
15
  import './api/download.mjs';
14
- import 'util';
15
- import 'stream';
16
16
  import 'fs/promises';
17
17
  import './helpers/unzip.mjs';
18
18
  import 'extract-zip';
@@ -6,9 +6,9 @@ const download_api_download = require('../api/download.cjs');
6
6
  const download_helpers_untar = require('../helpers/untar.cjs');
7
7
  const download_npm_version = require('./version.cjs');
8
8
  require('pathe');
9
- require('util');
10
- require('stream');
9
+ require('axios');
11
10
  require('fs/promises');
11
+ require('../api/config.cjs');
12
12
  require('tar');
13
13
  require('../../misc/exec.cjs');
14
14
  require('child_process');
@@ -0,0 +1,30 @@
1
+ import { ExportTargetOptions } from '../../export/helpers/prepare.cjs';
2
+ import { DocumentNotModified } from '../types/modified.cjs';
3
+ import { DownloadSourceMixin } from '../types/sources.cjs';
4
+
5
+ interface IfModifiedSinceOption {
6
+ ifModifiedSince: string | true | DownloadNPMPackageResult;
7
+ }
8
+ /**
9
+ * Options for downloadNPMPackage()
10
+ */
11
+ interface DownloadNPMPackageOptions extends ExportTargetOptions, Partial<IfModifiedSinceOption> {
12
+ package: string;
13
+ tag?: string;
14
+ log?: boolean;
15
+ }
16
+ /**
17
+ * Result
18
+ */
19
+ interface DownloadNPMPackageResult extends DownloadSourceMixin<'npm'> {
20
+ rootDir: string;
21
+ contentsDir: string;
22
+ version: string;
23
+ }
24
+ /**
25
+ * Download NPM package
26
+ */
27
+ declare function downloadNPMPackage<T extends IfModifiedSinceOption & DownloadNPMPackageOptions>(options: T): Promise<DownloadNPMPackageResult | DocumentNotModified>;
28
+ declare function downloadNPMPackage(options: DownloadNPMPackageOptions): Promise<DownloadNPMPackageResult>;
29
+
30
+ export { type DownloadNPMPackageOptions, type DownloadNPMPackageResult, downloadNPMPackage };
@@ -0,0 +1,30 @@
1
+ import { ExportTargetOptions } from '../../export/helpers/prepare.mjs';
2
+ import { DocumentNotModified } from '../types/modified.mjs';
3
+ import { DownloadSourceMixin } from '../types/sources.mjs';
4
+
5
+ interface IfModifiedSinceOption {
6
+ ifModifiedSince: string | true | DownloadNPMPackageResult;
7
+ }
8
+ /**
9
+ * Options for downloadNPMPackage()
10
+ */
11
+ interface DownloadNPMPackageOptions extends ExportTargetOptions, Partial<IfModifiedSinceOption> {
12
+ package: string;
13
+ tag?: string;
14
+ log?: boolean;
15
+ }
16
+ /**
17
+ * Result
18
+ */
19
+ interface DownloadNPMPackageResult extends DownloadSourceMixin<'npm'> {
20
+ rootDir: string;
21
+ contentsDir: string;
22
+ version: string;
23
+ }
24
+ /**
25
+ * Download NPM package
26
+ */
27
+ declare function downloadNPMPackage<T extends IfModifiedSinceOption & DownloadNPMPackageOptions>(options: T): Promise<DownloadNPMPackageResult | DocumentNotModified>;
28
+ declare function downloadNPMPackage(options: DownloadNPMPackageOptions): Promise<DownloadNPMPackageResult>;
29
+
30
+ export { type DownloadNPMPackageOptions, type DownloadNPMPackageResult, downloadNPMPackage };
@@ -27,4 +27,4 @@ interface DownloadNPMPackageResult extends DownloadSourceMixin<'npm'> {
27
27
  declare function downloadNPMPackage<T extends IfModifiedSinceOption & DownloadNPMPackageOptions>(options: T): Promise<DownloadNPMPackageResult | DocumentNotModified>;
28
28
  declare function downloadNPMPackage(options: DownloadNPMPackageOptions): Promise<DownloadNPMPackageResult>;
29
29
 
30
- export { DownloadNPMPackageOptions, DownloadNPMPackageResult, downloadNPMPackage };
30
+ export { type DownloadNPMPackageOptions, type DownloadNPMPackageResult, downloadNPMPackage };
@@ -4,9 +4,9 @@ import { downloadFile } from '../api/download.mjs';
4
4
  import { untar } from '../helpers/untar.mjs';
5
5
  import { getNPMVersion, getPackageVersion } from './version.mjs';
6
6
  import 'pathe';
7
- import 'util';
8
- import 'stream';
7
+ import 'axios';
9
8
  import 'fs/promises';
9
+ import '../api/config.mjs';
10
10
  import 'tar';
11
11
  import '../../misc/exec.mjs';
12
12
  import 'child_process';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Package options
3
+ */
4
+ interface NPMPackageOptions {
5
+ package: string;
6
+ tag?: string;
7
+ }
8
+
9
+ export type { NPMPackageOptions };