@iconify/tools 2.0.0 → 2.0.4

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 (43) hide show
  1. package/lib/colors/parse.d.ts +1 -1
  2. package/lib/colors/parse.js +3 -1
  3. package/lib/colors/parse.mjs +2 -1
  4. package/lib/colors/validate.d.ts +11 -0
  5. package/lib/colors/validate.js +45 -0
  6. package/lib/colors/validate.mjs +33 -0
  7. package/lib/download/git/index.d.ts +7 -3
  8. package/lib/download/git/index.js +0 -3
  9. package/lib/download/github/index.d.ts +7 -3
  10. package/lib/download/github/index.js +13 -10
  11. package/lib/download/github/index.mjs +12 -8
  12. package/lib/download/helpers/untar.d.ts +4 -0
  13. package/lib/download/helpers/untar.js +14 -0
  14. package/lib/download/helpers/untar.mjs +11 -0
  15. package/lib/download/npm/index.d.ts +7 -3
  16. package/lib/download/npm/index.js +43 -15
  17. package/lib/download/npm/index.mjs +35 -9
  18. package/lib/export/helpers/types-version.js +3 -5
  19. package/lib/export/helpers/types-version.mjs +33 -1
  20. package/lib/icon-set/index.js +1 -1
  21. package/lib/icon-set/merge.js +1 -1
  22. package/lib/import/figma/index.d.ts +3 -2
  23. package/lib/import/figma/index.js +0 -3
  24. package/lib/import/figma/query.d.ts +3 -2
  25. package/lib/import/figma/query.js +0 -3
  26. package/lib/import/figma/types/options.d.ts +4 -2
  27. package/lib/index.d.ts +9 -3
  28. package/lib/index.js +20 -6
  29. package/lib/index.mjs +16 -3
  30. package/lib/misc/bump-version.d.ts +4 -0
  31. package/lib/misc/bump-version.js +19 -0
  32. package/lib/misc/bump-version.mjs +15 -0
  33. package/lib/misc/compare-dirs.d.ts +9 -0
  34. package/lib/misc/compare-dirs.js +84 -0
  35. package/lib/misc/compare-dirs.mjs +71 -0
  36. package/lib/optimise/svgo.js +15 -4
  37. package/lib/optimise/svgo.mjs +10 -4
  38. package/lib/svg/cleanup/bad-tags.js +0 -2
  39. package/lib/svg/cleanup/bad-tags.mjs +0 -3
  40. package/lib/svg/data/tags.d.ts +0 -4
  41. package/lib/svg/data/tags.js +1 -9
  42. package/lib/svg/data/tags.mjs +0 -6
  43. package/package.json +29 -5
@@ -4,7 +4,7 @@ import { ColorAttributes } from './attribs';
4
4
  /**
5
5
  * Result
6
6
  */
7
- interface FindColorsResult {
7
+ export interface FindColorsResult {
8
8
  colors: (Color | string)[];
9
9
  hasUnsetColor: boolean;
10
10
  hasGlobalStyle: boolean;
@@ -245,13 +245,15 @@ async function parseColors(svg, options = {}) {
245
245
  const color = getElementColor(prop, item);
246
246
  if (color === attribs_1.defaultBlackColor) {
247
247
  // Default black color: change it
248
- result.hasUnsetColor = true;
249
248
  if (defaultColor) {
250
249
  // Add color to results and change attribute
251
250
  findColor(defaultColor, true);
252
251
  $element.attr(prop, (0, colors_1.colorToString)(defaultColor));
253
252
  itemColors[prop] = defaultColor;
254
253
  }
254
+ else {
255
+ result.hasUnsetColor = true;
256
+ }
255
257
  }
256
258
  }
257
259
  }
@@ -197,11 +197,12 @@ async function parseColors(svg, options = {}) {
197
197
  const prop = requiredProps[i];
198
198
  const color = getElementColor(prop, item);
199
199
  if (color === defaultBlackColor) {
200
- result.hasUnsetColor = true;
201
200
  if (defaultColor) {
202
201
  findColor(defaultColor, true);
203
202
  $element.attr(prop, colorToString(defaultColor));
204
203
  itemColors[prop] = defaultColor;
204
+ } else {
205
+ result.hasUnsetColor = true;
205
206
  }
206
207
  }
207
208
  }
@@ -0,0 +1,11 @@
1
+ import type { SVG } from '../svg/index';
2
+ import { ParseColorsOptions } from './parse';
3
+ import type { FindColorsResult } from './parse';
4
+ /**
5
+ * Validate colors in icon
6
+ *
7
+ * If icon is monotone,
8
+ *
9
+ * Throws exception on error
10
+ */
11
+ export declare function validateColors(svg: SVG, expectMonotone: boolean, options?: ParseColorsOptions): Promise<FindColorsResult>;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateColors = void 0;
4
+ const colors_1 = require("@iconify/utils/lib/colors");
5
+ const parse_1 = require("./parse");
6
+ /**
7
+ * Validate colors in icon
8
+ *
9
+ * If icon is monotone,
10
+ *
11
+ * Throws exception on error
12
+ */
13
+ async function validateColors(svg, expectMonotone, options) {
14
+ // Parse colors
15
+ const palette = await (0, parse_1.parseColors)(svg, options);
16
+ // Check palette
17
+ palette.colors.forEach((color) => {
18
+ if (typeof color === 'string') {
19
+ throw new Error('Unexpected color: ' + color);
20
+ }
21
+ switch (color.type) {
22
+ case 'none':
23
+ case 'transparent':
24
+ return;
25
+ // Monotone
26
+ case 'current':
27
+ if (!expectMonotone) {
28
+ throw new Error('Unexpected color: ' + (0, colors_1.colorToString)(color));
29
+ }
30
+ return;
31
+ // Palette
32
+ case 'rgb':
33
+ case 'hsl':
34
+ if (expectMonotone) {
35
+ throw new Error('Unexpected color: ' + (0, colors_1.colorToString)(color));
36
+ }
37
+ return;
38
+ // Do not allow other colors
39
+ default:
40
+ throw new Error('Unexpected color: ' + (0, colors_1.colorToString)(color));
41
+ }
42
+ });
43
+ return palette;
44
+ }
45
+ exports.validateColors = validateColors;
@@ -0,0 +1,33 @@
1
+ // src/colors/validate.ts
2
+ import { colorToString } from "@iconify/utils/lib/colors";
3
+ import { parseColors } from "./parse.mjs";
4
+ async function validateColors(svg, expectMonotone, options) {
5
+ const palette = await parseColors(svg, options);
6
+ palette.colors.forEach((color) => {
7
+ if (typeof color === "string") {
8
+ throw new Error("Unexpected color: " + color);
9
+ }
10
+ switch (color.type) {
11
+ case "none":
12
+ case "transparent":
13
+ return;
14
+ case "current":
15
+ if (!expectMonotone) {
16
+ throw new Error("Unexpected color: " + colorToString(color));
17
+ }
18
+ return;
19
+ case "rgb":
20
+ case "hsl":
21
+ if (expectMonotone) {
22
+ throw new Error("Unexpected color: " + colorToString(color));
23
+ }
24
+ return;
25
+ default:
26
+ throw new Error("Unexpected color: " + colorToString(color));
27
+ }
28
+ });
29
+ return palette;
30
+ }
31
+ export {
32
+ validateColors
33
+ };
@@ -1,12 +1,14 @@
1
1
  import { ExportTargetOptions } from '../../export/helpers/prepare';
2
2
  import type { DocumentNotModified } from '../types/modified';
3
+ interface IfModifiedSinceOption {
4
+ ifModifiedSince: string | true;
5
+ }
3
6
  /**
4
7
  * Options for downloadGitRepo()
5
8
  */
6
- export interface DownloadGitRepoOptions extends ExportTargetOptions {
9
+ export interface DownloadGitRepoOptions extends ExportTargetOptions, Partial<IfModifiedSinceOption> {
7
10
  remote: string;
8
11
  branch: string;
9
- ifModifiedSince?: string | true;
10
12
  log?: boolean;
11
13
  }
12
14
  /**
@@ -19,4 +21,6 @@ export interface DownloadGitRepoResult {
19
21
  /**
20
22
  * Download Git repo
21
23
  */
22
- export declare function downloadGitRepo(options: DownloadGitRepoOptions): Promise<DownloadGitRepoResult | DocumentNotModified>;
24
+ export declare function downloadGitRepo<T extends IfModifiedSinceOption & DownloadGitRepoOptions>(options: T): Promise<DownloadGitRepoResult | DocumentNotModified>;
25
+ export declare function downloadGitRepo(options: DownloadGitRepoOptions): Promise<DownloadGitRepoResult>;
26
+ export {};
@@ -5,9 +5,6 @@ const fs_1 = require("fs");
5
5
  const prepare_1 = require("../../export/helpers/prepare");
6
6
  const exec_1 = require("../../misc/exec");
7
7
  const hash_1 = require("./hash");
8
- /**
9
- * Download Git repo
10
- */
11
8
  async function downloadGitRepo(options) {
12
9
  const { remote, branch } = options;
13
10
  // Check for last commit
@@ -1,11 +1,13 @@
1
1
  import { ExportTargetOptions } from '../../export/helpers/prepare';
2
2
  import type { DocumentNotModified } from '../types/modified';
3
3
  import type { GitHubAPIOptions } from './types';
4
+ interface IfModifiedSinceOption {
5
+ ifModifiedSince: string;
6
+ }
4
7
  /**
5
8
  * Options for downloadGitRepo()
6
9
  */
7
- export interface DownloadGitHubRepoOptions extends ExportTargetOptions, GitHubAPIOptions {
8
- ifModifiedSince?: string;
10
+ export interface DownloadGitHubRepoOptions extends ExportTargetOptions, GitHubAPIOptions, Partial<IfModifiedSinceOption> {
9
11
  cleanupOldFiles?: boolean;
10
12
  cleanupOldDirectories?: boolean;
11
13
  log?: boolean;
@@ -21,4 +23,6 @@ export interface DownloadGitHubRepoResult {
21
23
  /**
22
24
  * Download GitHub repo using API
23
25
  */
24
- export declare function downloadGitHubRepo(options: DownloadGitHubRepoOptions): Promise<DownloadGitHubRepoResult | DocumentNotModified>;
26
+ export declare function downloadGitHubRepo<T extends IfModifiedSinceOption & DownloadGitHubRepoOptions>(options: T): Promise<DownloadGitHubRepoResult | DocumentNotModified>;
27
+ export declare function downloadGitHubRepo(options: DownloadGitHubRepoOptions): Promise<DownloadGitHubRepoResult>;
28
+ export {};
@@ -10,12 +10,13 @@ const unzip_1 = require("../helpers/unzip");
10
10
  * Find matching directories
11
11
  */
12
12
  async function findMatchingDirs(rootDir, hash) {
13
- const search = '-' + hash;
14
13
  const matches = [];
15
14
  const files = await fs_1.promises.readdir(rootDir);
16
15
  for (let i = 0; i < files.length; i++) {
17
16
  const file = files[i];
18
- if (file.slice(0 - search.length) !== search) {
17
+ const lastChunk = file.split('-').pop();
18
+ if (lastChunk.length < 4 ||
19
+ lastChunk !== hash.slice(0, lastChunk.length)) {
19
20
  continue;
20
21
  }
21
22
  const stat = await fs_1.promises.lstat(rootDir + '/' + file);
@@ -25,9 +26,6 @@ async function findMatchingDirs(rootDir, hash) {
25
26
  }
26
27
  return matches;
27
28
  }
28
- /**
29
- * Download GitHub repo using API
30
- */
31
29
  async function downloadGitHubRepo(options) {
32
30
  // Check for last commit
33
31
  const hash = await (0, hash_1.getGitHubRepoHash)(options);
@@ -39,11 +37,11 @@ async function downloadGitHubRepo(options) {
39
37
  // Prepare target directory
40
38
  const rootDir = (options.target = await (0, prepare_1.prepareDirectoryForExport)(options));
41
39
  // Archive name
42
- const zipTarget = rootDir + '/' + hash + '.zip';
40
+ const archiveTarget = rootDir + '/' + hash + '.zip';
43
41
  // Check if archive exists
44
42
  let exists = false;
45
43
  try {
46
- const stat = await fs_1.promises.lstat(zipTarget);
44
+ const stat = await fs_1.promises.lstat(archiveTarget);
47
45
  exists = stat.isFile();
48
46
  }
49
47
  catch (err) {
@@ -51,10 +49,15 @@ async function downloadGitHubRepo(options) {
51
49
  }
52
50
  // Download file
53
51
  if (!exists) {
54
- const uri = `https://codeload.github.com/${options.user}/${options.repo}/zip/${hash}`;
52
+ const uri = `https://api.github.com/repos/${options.user}/${options.repo}/zipball/${hash}`;
53
+ // const uri = `https://codeload.github.com/${options.user}/${options.repo}/zip/${hash}`;
55
54
  await (0, download_1.downloadFile)({
56
55
  uri,
57
- }, zipTarget);
56
+ headers: {
57
+ Accept: 'application/vnd.github.v3+json',
58
+ Authorization: 'token ' + options.token,
59
+ },
60
+ }, archiveTarget);
58
61
  }
59
62
  // Clean up old directories
60
63
  const files = await fs_1.promises.readdir(rootDir);
@@ -86,7 +89,7 @@ async function downloadGitHubRepo(options) {
86
89
  }
87
90
  }
88
91
  // Unpack it
89
- await (0, unzip_1.unzip)(zipTarget, rootDir);
92
+ await (0, unzip_1.unzip)(archiveTarget, rootDir);
90
93
  // Get actual dir
91
94
  const matchingDirs = await findMatchingDirs(rootDir, hash);
92
95
  if (matchingDirs.length !== 1) {
@@ -7,12 +7,12 @@ import { getGitHubRepoHash } from "./hash.mjs";
7
7
  import { downloadFile } from "../api/download.mjs";
8
8
  import { unzip } from "../helpers/unzip.mjs";
9
9
  async function findMatchingDirs(rootDir, hash) {
10
- const search = "-" + hash;
11
10
  const matches = [];
12
11
  const files = await fs.readdir(rootDir);
13
12
  for (let i = 0; i < files.length; i++) {
14
13
  const file = files[i];
15
- if (file.slice(0 - search.length) !== search) {
14
+ const lastChunk = file.split("-").pop();
15
+ if (lastChunk.length < 4 || lastChunk !== hash.slice(0, lastChunk.length)) {
16
16
  continue;
17
17
  }
18
18
  const stat = await fs.lstat(rootDir + "/" + file);
@@ -29,18 +29,22 @@ async function downloadGitHubRepo(options) {
29
29
  }
30
30
  options.target = options.target.replace("{hash}", hash);
31
31
  const rootDir = options.target = await prepareDirectoryForExport(options);
32
- const zipTarget = rootDir + "/" + hash + ".zip";
32
+ const archiveTarget = rootDir + "/" + hash + ".zip";
33
33
  let exists = false;
34
34
  try {
35
- const stat = await fs.lstat(zipTarget);
35
+ const stat = await fs.lstat(archiveTarget);
36
36
  exists = stat.isFile();
37
37
  } catch (err) {
38
38
  }
39
39
  if (!exists) {
40
- const uri = `https://codeload.github.com/${options.user}/${options.repo}/zip/${hash}`;
40
+ const uri = `https://api.github.com/repos/${options.user}/${options.repo}/zipball/${hash}`;
41
41
  await downloadFile({
42
- uri
43
- }, zipTarget);
42
+ uri,
43
+ headers: {
44
+ Accept: "application/vnd.github.v3+json",
45
+ Authorization: "token " + options.token
46
+ }
47
+ }, archiveTarget);
44
48
  }
45
49
  const files = await fs.readdir(rootDir);
46
50
  const hashSearch = "-" + hash;
@@ -62,7 +66,7 @@ async function downloadGitHubRepo(options) {
62
66
  }
63
67
  }
64
68
  }
65
- await unzip(zipTarget, rootDir);
69
+ await unzip(archiveTarget, rootDir);
66
70
  const matchingDirs = await findMatchingDirs(rootDir, hash);
67
71
  if (matchingDirs.length !== 1) {
68
72
  throw new Error(`Error unpacking ${hash}.zip`);
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Unpack .tgz archive
3
+ */
4
+ export declare function untar(file: string, path: string): Promise<void>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.untar = void 0;
4
+ const tar_1 = require("tar");
5
+ /**
6
+ * Unpack .tgz archive
7
+ */
8
+ async function untar(file, path) {
9
+ await (0, tar_1.x)({
10
+ file,
11
+ C: path,
12
+ });
13
+ }
14
+ exports.untar = untar;
@@ -0,0 +1,11 @@
1
+ // src/download/helpers/untar.ts
2
+ import { x } from "tar";
3
+ async function untar(file, path) {
4
+ await x({
5
+ file,
6
+ C: path
7
+ });
8
+ }
9
+ export {
10
+ untar
11
+ };
@@ -1,12 +1,14 @@
1
1
  import { ExportTargetOptions } from '../../export/helpers/prepare';
2
2
  import type { DocumentNotModified } from '../types/modified';
3
+ interface IfModifiedSinceOption {
4
+ ifModifiedSince: string | true;
5
+ }
3
6
  /**
4
7
  * Options for downloadNPMPackage()
5
8
  */
6
- export interface DownloadNPMPackageOptions extends ExportTargetOptions {
9
+ export interface DownloadNPMPackageOptions extends ExportTargetOptions, Partial<IfModifiedSinceOption> {
7
10
  package: string;
8
11
  tag?: string;
9
- ifModifiedSince?: string | true;
10
12
  log?: boolean;
11
13
  }
12
14
  /**
@@ -20,4 +22,6 @@ export interface DownloadNPMPackageResult {
20
22
  /**
21
23
  * Download NPM package
22
24
  */
23
- export declare function downloadNPMPackage(options: DownloadNPMPackageOptions): Promise<DownloadNPMPackageResult | DocumentNotModified>;
25
+ export declare function downloadNPMPackage<T extends IfModifiedSinceOption & DownloadNPMPackageOptions>(options: T): Promise<DownloadNPMPackageResult | DocumentNotModified>;
26
+ export declare function downloadNPMPackage(options: DownloadNPMPackageOptions): Promise<DownloadNPMPackageResult>;
27
+ export {};
@@ -1,25 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.downloadNPMPackage = void 0;
4
+ const fs_1 = require("fs");
4
5
  const prepare_1 = require("../../export/helpers/prepare");
5
- const exec_1 = require("../../misc/exec");
6
+ const download_1 = require("../api/download");
7
+ const untar_1 = require("../helpers/untar");
6
8
  const version_1 = require("./version");
7
- /**
8
- * Download NPM package
9
- */
10
9
  async function downloadNPMPackage(options) {
11
- const packageName = options.package;
12
- const tag = options.tag || 'latest';
13
10
  const rootDir = (options.target = (0, prepare_1.normalizeDir)(options.target));
14
- const actualDir = rootDir + '/node_modules/' + packageName;
15
- // Check for version
11
+ const actualDir = rootDir + '/package';
12
+ // Get latest location
13
+ const versionInfo = await (0, version_1.getNPMVersion)(options);
14
+ const version = versionInfo.version;
15
+ // Check downloaded copy
16
16
  if (options.ifModifiedSince) {
17
17
  try {
18
18
  const expectedVersion = options.ifModifiedSince === true
19
19
  ? await (0, version_1.getPackageVersion)(actualDir)
20
20
  : options.ifModifiedSince;
21
- const latestVersion = (await (0, version_1.getNPMVersion)(options)).version;
22
- if (latestVersion === expectedVersion) {
21
+ if (version === expectedVersion) {
23
22
  return 'not_modified';
24
23
  }
25
24
  }
@@ -27,15 +26,44 @@ async function downloadNPMPackage(options) {
27
26
  //
28
27
  }
29
28
  }
29
+ const archiveURL = versionInfo.file;
30
+ if (!archiveURL) {
31
+ throw new Error(`NPM registry did not provide link to package archive.`);
32
+ }
33
+ const archiveTarget = rootDir + '/' + version + '.tgz';
30
34
  // Prepare target directory
31
35
  await (0, prepare_1.prepareDirectoryForExport)(options);
32
- // Check if directory is empty if directory wasn't cleaned up
36
+ // Check if archive exists
37
+ let archiveExists = false;
38
+ try {
39
+ const stat = await fs_1.promises.lstat(archiveTarget);
40
+ archiveExists = stat.isFile();
41
+ }
42
+ catch (err) {
43
+ //
44
+ }
45
+ // Download file
46
+ if (!archiveExists) {
47
+ if (options.log) {
48
+ console.log(`Downloading ${archiveURL}`);
49
+ }
50
+ await (0, download_1.downloadFile)({
51
+ uri: archiveURL,
52
+ headers: {
53
+ Accept: 'application/tar+gzip',
54
+ },
55
+ }, archiveTarget);
56
+ }
57
+ // Remove old unpacked file
58
+ await (0, prepare_1.prepareDirectoryForExport)({
59
+ target: actualDir,
60
+ cleanup: true,
61
+ });
62
+ // Unpack file
33
63
  if (options.log) {
34
- console.log(`Installing ${packageName}@${tag} to ${rootDir}`);
64
+ console.log(`Unpacking ${archiveTarget}`);
35
65
  }
36
- await (0, exec_1.execAsync)(`npm install --prefix "${rootDir}" ${packageName}@${tag} --no-audit --ignore-scripts --no-save --omit dev --no-bin-links`);
37
- // Get latest version
38
- const version = await (0, version_1.getPackageVersion)(actualDir);
66
+ await (0, untar_1.untar)(archiveTarget, rootDir);
39
67
  return {
40
68
  rootDir,
41
69
  actualDir,
@@ -1,31 +1,57 @@
1
1
  // src/download/npm/index.ts
2
+ import { promises as fs } from "fs";
2
3
  import {
3
4
  normalizeDir,
4
5
  prepareDirectoryForExport
5
6
  } from "../../export/helpers/prepare.mjs";
6
- import { execAsync } from "../../misc/exec.mjs";
7
+ import { downloadFile } from "../api/download.mjs";
8
+ import { untar } from "../helpers/untar.mjs";
7
9
  import { getNPMVersion, getPackageVersion } from "./version.mjs";
8
10
  async function downloadNPMPackage(options) {
9
- const packageName = options.package;
10
- const tag = options.tag || "latest";
11
11
  const rootDir = options.target = normalizeDir(options.target);
12
- const actualDir = rootDir + "/node_modules/" + packageName;
12
+ const actualDir = rootDir + "/package";
13
+ const versionInfo = await getNPMVersion(options);
14
+ const version = versionInfo.version;
13
15
  if (options.ifModifiedSince) {
14
16
  try {
15
17
  const expectedVersion = options.ifModifiedSince === true ? await getPackageVersion(actualDir) : options.ifModifiedSince;
16
- const latestVersion = (await getNPMVersion(options)).version;
17
- if (latestVersion === expectedVersion) {
18
+ if (version === expectedVersion) {
18
19
  return "not_modified";
19
20
  }
20
21
  } catch (err) {
21
22
  }
22
23
  }
24
+ const archiveURL = versionInfo.file;
25
+ if (!archiveURL) {
26
+ throw new Error(`NPM registry did not provide link to package archive.`);
27
+ }
28
+ const archiveTarget = rootDir + "/" + version + ".tgz";
23
29
  await prepareDirectoryForExport(options);
30
+ let archiveExists = false;
31
+ try {
32
+ const stat = await fs.lstat(archiveTarget);
33
+ archiveExists = stat.isFile();
34
+ } catch (err) {
35
+ }
36
+ if (!archiveExists) {
37
+ if (options.log) {
38
+ console.log(`Downloading ${archiveURL}`);
39
+ }
40
+ await downloadFile({
41
+ uri: archiveURL,
42
+ headers: {
43
+ Accept: "application/tar+gzip"
44
+ }
45
+ }, archiveTarget);
46
+ }
47
+ await prepareDirectoryForExport({
48
+ target: actualDir,
49
+ cleanup: true
50
+ });
24
51
  if (options.log) {
25
- console.log(`Installing ${packageName}@${tag} to ${rootDir}`);
52
+ console.log(`Unpacking ${archiveTarget}`);
26
53
  }
27
- await execAsync(`npm install --prefix "${rootDir}" ${packageName}@${tag} --no-audit --ignore-scripts --no-save --omit dev --no-bin-links`);
28
- const version = await getPackageVersion(actualDir);
54
+ await untar(archiveTarget, rootDir);
29
55
  return {
30
56
  rootDir,
31
57
  actualDir,
@@ -1,14 +1,12 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.getTypesVersion = void 0;
7
- const package_json_1 = __importDefault(require("@iconify/types/package.json"));
4
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
5
+ const pkg = require('@iconify/types/package.json');
8
6
  /**
9
7
  * Get current version of Iconify Types package
10
8
  */
11
9
  function getTypesVersion() {
12
- return package_json_1.default.version;
10
+ return pkg.version;
13
11
  }
14
12
  exports.getTypesVersion = getTypesVersion;
@@ -1,5 +1,37 @@
1
+ var __commonJS = (cb, mod) => function __require() {
2
+ return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
3
+ };
4
+
5
+ // ../../node_modules/@iconify/types/package.json
6
+ var require_package = __commonJS({
7
+ "../../node_modules/@iconify/types/package.json"(exports, module) {
8
+ module.exports = {
9
+ name: "@iconify/types",
10
+ description: "Types for Iconify data",
11
+ version: "1.0.12",
12
+ author: "Vjacheslav Trushkin",
13
+ license: "(Apache-2.0 OR GPL-2.0)",
14
+ main: "./index.js",
15
+ types: "./types.ts",
16
+ scripts: {
17
+ test: "tsc --noEmit --strict --typeRoots '[]' types.ts"
18
+ },
19
+ bugs: "https://github.com/iconify/iconify/issues",
20
+ homepage: "https://github.com/iconify/iconify",
21
+ repository: {
22
+ type: "git",
23
+ url: "https://github.com/iconify/iconify.git",
24
+ directory: "packages/types"
25
+ },
26
+ devDependencies: {
27
+ typescript: "^4.4.3"
28
+ }
29
+ };
30
+ }
31
+ });
32
+
1
33
  // src/export/helpers/types-version.ts
2
- import pkg from "@iconify/types/package.json";
34
+ var pkg = require_package();
3
35
  function getTypesVersion() {
4
36
  return pkg.version;
5
37
  }
@@ -8,7 +8,7 @@ const minify_1 = require("@iconify/utils/lib/icon-set/minify");
8
8
  const convert_info_1 = require("@iconify/utils/lib/icon-set/convert-info");
9
9
  const props_1 = require("./props");
10
10
  const svg_1 = require("../svg");
11
- // eslint-disable-next-line @typescript-eslint/no-unused-vars-experimental, @typescript-eslint/no-unused-vars
11
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
12
12
  function assertNever(v) {
13
13
  //
14
14
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.mergeIconSets = void 0;
4
4
  const _1 = require(".");
5
5
  const match_1 = require("./match");
6
- // eslint-disable-next-line @typescript-eslint/no-unused-vars-experimental, @typescript-eslint/no-unused-vars
6
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
7
7
  function assertNever(v) {
8
8
  //
9
9
  }
@@ -1,7 +1,8 @@
1
1
  import type { DocumentNotModified } from '../../download/types/modified';
2
- import type { FigmaImportOptions } from './types/options';
2
+ import type { FigmaImportOptions, FigmaIfModifiedSinceOption } from './types/options';
3
3
  import type { FigmaImportResult } from './types/result';
4
4
  /**
5
5
  * Import icon set from Figma
6
6
  */
7
- export declare function importFromFigma(options: FigmaImportOptions): Promise<FigmaImportResult | DocumentNotModified>;
7
+ export declare function importFromFigma<T extends FigmaIfModifiedSinceOption & FigmaImportOptions>(options: T): Promise<FigmaImportResult | DocumentNotModified>;
8
+ export declare function importFromFigma(options: FigmaImportOptions): Promise<FigmaImportResult>;
@@ -6,9 +6,6 @@ const svg_1 = require("../../svg");
6
6
  const cleanup_1 = require("../../svg/cleanup");
7
7
  const nodes_1 = require("./nodes");
8
8
  const query_1 = require("./query");
9
- /**
10
- * Import icon set from Figma
11
- */
12
9
  async function importFromFigma(options) {
13
10
  const cacheOptions = options.cacheDir
14
11
  ? {
@@ -1,12 +1,13 @@
1
1
  import type { APICacheOptions } from '../../download/api/types';
2
2
  import type { DocumentNotModified } from '../../download/types/modified';
3
3
  import type { FigmaDocument } from './types/api';
4
- import type { FigmaFilesQueryOptions, FigmaImagesQueryOptions } from './types/options';
4
+ import type { FigmaIfModifiedSinceOption, FigmaFilesQueryOptions, FigmaImagesQueryOptions } from './types/options';
5
5
  import type { FigmaNodesImportResult } from './types/result';
6
6
  /**
7
7
  * Get Figma files
8
8
  */
9
- export declare function figmaFilesQuery(options: FigmaFilesQueryOptions, cache?: APICacheOptions): Promise<FigmaDocument | DocumentNotModified>;
9
+ export declare function figmaFilesQuery<T extends FigmaIfModifiedSinceOption & FigmaFilesQueryOptions>(options: T, cache?: APICacheOptions): Promise<FigmaDocument | DocumentNotModified>;
10
+ export declare function figmaFilesQuery(options: FigmaFilesQueryOptions, cache?: APICacheOptions): Promise<FigmaDocument>;
10
11
  /**
11
12
  * Generate all images
12
13
  */
@@ -15,9 +15,6 @@ function identicalDates(actual, expected) {
15
15
  }
16
16
  return new Date(actual).toString() === new Date(expected).toString();
17
17
  }
18
- /**
19
- * Get Figma files
20
- */
21
18
  async function figmaFilesQuery(options, cache) {
22
19
  // Check token
23
20
  if (!options.token) {