@iconify/tools 2.1.0-beta.7 → 2.1.1
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.
- package/lib/colors/attribs.d.ts +2 -0
- package/lib/colors/detect.cjs +68 -0
- package/lib/colors/detect.d.ts +15 -0
- package/lib/colors/detect.mjs +64 -0
- package/lib/colors/parse.cjs +31 -7
- package/lib/colors/parse.d.ts +1 -1
- package/lib/colors/parse.mjs +31 -7
- package/lib/colors/validate.cjs +9 -3
- package/lib/colors/validate.d.ts +1 -1
- package/lib/colors/validate.mjs +9 -3
- package/lib/css/parser/error.cjs +1 -1
- package/lib/css/parser/error.mjs +1 -1
- package/lib/css/parser/strings.cjs +10 -2
- package/lib/css/parser/strings.mjs +10 -2
- package/lib/css/parser/tokens.cjs +133 -109
- package/lib/css/parser/tokens.mjs +133 -109
- package/lib/download/api/cache.cjs +28 -21
- package/lib/download/api/cache.mjs +28 -21
- package/lib/download/git/branch.cjs +1 -1
- package/lib/download/git/branch.mjs +1 -1
- package/lib/download/git/hash.cjs +1 -1
- package/lib/download/git/hash.mjs +1 -1
- package/lib/download/git/index.cjs +7 -4
- package/lib/download/git/index.mjs +7 -4
- package/lib/download/git/reset.cjs +1 -2
- package/lib/download/git/reset.mjs +1 -2
- package/lib/download/github/index.cjs +10 -7
- package/lib/download/github/index.mjs +10 -7
- package/lib/download/gitlab/hash.cjs +3 -1
- package/lib/download/gitlab/hash.mjs +3 -1
- package/lib/download/gitlab/index.cjs +9 -6
- package/lib/download/gitlab/index.mjs +9 -6
- package/lib/download/index.cjs +4 -3
- package/lib/download/index.mjs +4 -3
- package/lib/download/npm/index.cjs +12 -8
- package/lib/download/npm/index.mjs +12 -8
- package/lib/download/npm/version.cjs +4 -2
- package/lib/download/npm/version.mjs +4 -2
- package/lib/export/directory.d.ts +1 -1
- package/lib/export/helpers/types-version.cjs +3 -1
- package/lib/export/helpers/types-version.mjs +3 -1
- package/lib/export/icon-package.d.ts +1 -1
- package/lib/export/json-package.cjs +13 -3
- package/lib/export/json-package.d.ts +1 -1
- package/lib/export/json-package.mjs +13 -3
- package/lib/icon-set/index.cjs +20 -8
- package/lib/icon-set/index.d.ts +1 -1
- package/lib/icon-set/index.mjs +20 -8
- package/lib/icon-set/match.d.ts +1 -1
- package/lib/icon-set/merge.d.ts +1 -1
- package/lib/icon-set/modified.d.ts +1 -1
- package/lib/icon-set/props.d.ts +1 -1
- package/lib/icon-set/tags.cjs +97 -0
- package/lib/icon-set/tags.d.ts +22 -0
- package/lib/icon-set/tags.mjs +91 -0
- package/lib/icon-set/types.d.ts +1 -1
- package/lib/import/directory.cjs +4 -1
- package/lib/import/directory.d.ts +1 -1
- package/lib/import/directory.mjs +4 -1
- package/lib/import/figma/index.cjs +5 -2
- package/lib/import/figma/index.d.ts +1 -1
- package/lib/import/figma/index.mjs +5 -2
- package/lib/import/figma/nodes.cjs +6 -2
- package/lib/import/figma/nodes.d.ts +2 -2
- package/lib/import/figma/nodes.mjs +6 -2
- package/lib/import/figma/query.cjs +29 -15
- package/lib/import/figma/query.d.ts +1 -1
- package/lib/import/figma/query.mjs +29 -15
- package/lib/import/figma/types/nodes.d.ts +1 -1
- package/lib/import/figma/types/options.d.ts +1 -1
- package/lib/import/figma/types/result.d.ts +1 -1
- package/lib/index.cjs +6 -3
- package/lib/index.d.ts +3 -1
- package/lib/index.mjs +4 -3
- package/lib/misc/compare-dirs.cjs +3 -1
- package/lib/misc/compare-dirs.mjs +3 -1
- package/lib/misc/exec.cjs +7 -8
- package/lib/misc/exec.mjs +7 -8
- package/lib/misc/keyword.cjs +4 -1
- package/lib/misc/keyword.mjs +4 -1
- package/lib/misc/scan.cjs +3 -1
- package/lib/misc/scan.mjs +3 -1
- package/lib/optimise/flags.cjs +9 -3
- package/lib/optimise/flags.d.ts +1 -1
- package/lib/optimise/flags.mjs +9 -3
- package/lib/optimise/global-style.cjs +10 -3
- package/lib/optimise/global-style.d.ts +1 -1
- package/lib/optimise/global-style.mjs +10 -3
- package/lib/optimise/scale.d.ts +1 -1
- package/lib/optimise/svgo.d.ts +1 -1
- package/lib/svg/analyse.cjs +20 -6
- package/lib/svg/analyse.d.ts +1 -1
- package/lib/svg/analyse.mjs +20 -6
- package/lib/svg/cleanup/attribs.d.ts +1 -1
- package/lib/svg/cleanup/bad-tags.cjs +7 -2
- package/lib/svg/cleanup/bad-tags.d.ts +1 -1
- package/lib/svg/cleanup/bad-tags.mjs +7 -2
- package/lib/svg/cleanup/inline-style.cjs +12 -4
- package/lib/svg/cleanup/inline-style.d.ts +1 -1
- package/lib/svg/cleanup/inline-style.mjs +12 -4
- package/lib/svg/cleanup/root-style.d.ts +1 -1
- package/lib/svg/cleanup/root-svg.d.ts +1 -1
- package/lib/svg/cleanup/svgo-style.d.ts +1 -1
- package/lib/svg/cleanup.d.ts +1 -1
- package/lib/svg/data/attributes.cjs +0 -1
- package/lib/svg/data/attributes.mjs +0 -1
- package/lib/svg/index.cjs +12 -3
- package/lib/svg/index.d.ts +2 -2
- package/lib/svg/index.mjs +12 -3
- package/lib/svg/parse-style.cjs +13 -8
- package/lib/svg/parse-style.d.ts +1 -1
- package/lib/svg/parse-style.mjs +13 -8
- package/lib/svg/parse.d.ts +1 -1
- package/package.json +24 -9
- package/lib/types-f0980297.d.ts +0 -258
|
@@ -9,7 +9,6 @@ const download_git_hash = require('./hash.cjs');
|
|
|
9
9
|
const download_git_reset = require('./reset.cjs');
|
|
10
10
|
require('fs');
|
|
11
11
|
require('pathe');
|
|
12
|
-
require('path');
|
|
13
12
|
require('child_process');
|
|
14
13
|
require('cheerio');
|
|
15
14
|
require('@iconify/utils');
|
|
@@ -24,6 +23,7 @@ require('@iconify/utils/lib/icon-set/minify');
|
|
|
24
23
|
require('@iconify/utils/lib/icon-set/convert-info');
|
|
25
24
|
require('../../icon-set/props.cjs');
|
|
26
25
|
require('@iconify/utils/lib/misc/objects');
|
|
26
|
+
require('@iconify/utils/lib/colors');
|
|
27
27
|
require('node-fetch');
|
|
28
28
|
require('crypto');
|
|
29
29
|
require('../api/download.cjs');
|
|
@@ -31,14 +31,15 @@ require('util');
|
|
|
31
31
|
require('stream');
|
|
32
32
|
require('extract-zip');
|
|
33
33
|
require('tar');
|
|
34
|
-
require('@iconify/utils/lib/colors');
|
|
35
34
|
|
|
36
35
|
async function downloadGitRepo(options) {
|
|
37
36
|
const { remote, branch } = options;
|
|
38
37
|
const hasHashInTarget = options.target.indexOf("{hash}") !== -1;
|
|
39
38
|
const ifModifiedSince = options.ifModifiedSince;
|
|
40
39
|
if (ifModifiedSince || hasHashInTarget) {
|
|
41
|
-
const result = await misc_exec.execAsync(
|
|
40
|
+
const result = await misc_exec.execAsync(
|
|
41
|
+
`git ls-remote ${remote} --branch ${branch}`
|
|
42
|
+
);
|
|
42
43
|
const parts = result.stdout.split(/\s/);
|
|
43
44
|
const latestHash = parts.shift();
|
|
44
45
|
if (hasHashInTarget) {
|
|
@@ -63,7 +64,9 @@ async function downloadGitRepo(options) {
|
|
|
63
64
|
if (options.log) {
|
|
64
65
|
console.log(`Cloning ${remote}#${branch} to ${target}`);
|
|
65
66
|
}
|
|
66
|
-
await misc_exec.execAsync(
|
|
67
|
+
await misc_exec.execAsync(
|
|
68
|
+
`git clone --branch ${branch} --no-tags --depth 1 ${remote} "${target}"`
|
|
69
|
+
);
|
|
67
70
|
const hash = await download_git_hash.getGitRepoHash(options);
|
|
68
71
|
await download_git_branch.getGitRepoBranch(options, branch);
|
|
69
72
|
return {
|
|
@@ -5,7 +5,6 @@ import { getGitRepoHash } from './hash.mjs';
|
|
|
5
5
|
import { resetGitRepoContents } from './reset.mjs';
|
|
6
6
|
import 'fs';
|
|
7
7
|
import 'pathe';
|
|
8
|
-
import 'path';
|
|
9
8
|
import 'child_process';
|
|
10
9
|
import 'cheerio';
|
|
11
10
|
import '@iconify/utils';
|
|
@@ -20,6 +19,7 @@ import '@iconify/utils/lib/icon-set/minify';
|
|
|
20
19
|
import '@iconify/utils/lib/icon-set/convert-info';
|
|
21
20
|
import '../../icon-set/props.mjs';
|
|
22
21
|
import '@iconify/utils/lib/misc/objects';
|
|
22
|
+
import '@iconify/utils/lib/colors';
|
|
23
23
|
import 'node-fetch';
|
|
24
24
|
import 'crypto';
|
|
25
25
|
import '../api/download.mjs';
|
|
@@ -27,14 +27,15 @@ import 'util';
|
|
|
27
27
|
import 'stream';
|
|
28
28
|
import 'extract-zip';
|
|
29
29
|
import 'tar';
|
|
30
|
-
import '@iconify/utils/lib/colors';
|
|
31
30
|
|
|
32
31
|
async function downloadGitRepo(options) {
|
|
33
32
|
const { remote, branch } = options;
|
|
34
33
|
const hasHashInTarget = options.target.indexOf("{hash}") !== -1;
|
|
35
34
|
const ifModifiedSince = options.ifModifiedSince;
|
|
36
35
|
if (ifModifiedSince || hasHashInTarget) {
|
|
37
|
-
const result = await execAsync(
|
|
36
|
+
const result = await execAsync(
|
|
37
|
+
`git ls-remote ${remote} --branch ${branch}`
|
|
38
|
+
);
|
|
38
39
|
const parts = result.stdout.split(/\s/);
|
|
39
40
|
const latestHash = parts.shift();
|
|
40
41
|
if (hasHashInTarget) {
|
|
@@ -59,7 +60,9 @@ async function downloadGitRepo(options) {
|
|
|
59
60
|
if (options.log) {
|
|
60
61
|
console.log(`Cloning ${remote}#${branch} to ${target}`);
|
|
61
62
|
}
|
|
62
|
-
await execAsync(
|
|
63
|
+
await execAsync(
|
|
64
|
+
`git clone --branch ${branch} --no-tags --depth 1 ${remote} "${target}"`
|
|
65
|
+
);
|
|
63
66
|
const hash = await getGitRepoHash(options);
|
|
64
67
|
await getGitRepoBranch(options, branch);
|
|
65
68
|
return {
|
|
@@ -13,6 +13,7 @@ require('@iconify/utils/lib/svg/build');
|
|
|
13
13
|
require('@iconify/utils/lib/icon-set/minify');
|
|
14
14
|
require('@iconify/utils/lib/icon-set/convert-info');
|
|
15
15
|
require('../../icon-set/props.cjs');
|
|
16
|
+
require('@iconify/utils/lib/colors');
|
|
16
17
|
require('node-fetch');
|
|
17
18
|
require('fs');
|
|
18
19
|
require('crypto');
|
|
@@ -21,10 +22,8 @@ const misc_exec = require('../../misc/exec.cjs');
|
|
|
21
22
|
require('../api/download.cjs');
|
|
22
23
|
require('extract-zip');
|
|
23
24
|
require('tar');
|
|
24
|
-
require('@iconify/utils/lib/colors');
|
|
25
25
|
require('../../svg/parse.cjs');
|
|
26
26
|
require('@iconify/utils/lib/misc/objects');
|
|
27
|
-
require('path');
|
|
28
27
|
require('child_process');
|
|
29
28
|
require('util');
|
|
30
29
|
require('stream');
|
|
@@ -9,6 +9,7 @@ import '@iconify/utils/lib/svg/build';
|
|
|
9
9
|
import '@iconify/utils/lib/icon-set/minify';
|
|
10
10
|
import '@iconify/utils/lib/icon-set/convert-info';
|
|
11
11
|
import '../../icon-set/props.mjs';
|
|
12
|
+
import '@iconify/utils/lib/colors';
|
|
12
13
|
import 'node-fetch';
|
|
13
14
|
import 'fs';
|
|
14
15
|
import 'crypto';
|
|
@@ -17,10 +18,8 @@ import { execAsync } from '../../misc/exec.mjs';
|
|
|
17
18
|
import '../api/download.mjs';
|
|
18
19
|
import 'extract-zip';
|
|
19
20
|
import 'tar';
|
|
20
|
-
import '@iconify/utils/lib/colors';
|
|
21
21
|
import '../../svg/parse.mjs';
|
|
22
22
|
import '@iconify/utils/lib/misc/objects';
|
|
23
|
-
import 'path';
|
|
24
23
|
import 'child_process';
|
|
25
24
|
import 'util';
|
|
26
25
|
import 'stream';
|
|
@@ -53,13 +53,16 @@ async function downloadGitHubRepo(options) {
|
|
|
53
53
|
}
|
|
54
54
|
if (!exists) {
|
|
55
55
|
const uri = `https://api.github.com/repos/${options.user}/${options.repo}/zipball/${hash}`;
|
|
56
|
-
await download_api_download.downloadFile(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
await download_api_download.downloadFile(
|
|
57
|
+
{
|
|
58
|
+
uri,
|
|
59
|
+
headers: {
|
|
60
|
+
Accept: "application/vnd.github.v3+json",
|
|
61
|
+
Authorization: "token " + options.token
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
archiveTarget
|
|
65
|
+
);
|
|
63
66
|
}
|
|
64
67
|
const files = await fs.promises.readdir(rootDir);
|
|
65
68
|
const hashSearch = "-" + hash;
|
|
@@ -49,13 +49,16 @@ async function downloadGitHubRepo(options) {
|
|
|
49
49
|
}
|
|
50
50
|
if (!exists) {
|
|
51
51
|
const uri = `https://api.github.com/repos/${options.user}/${options.repo}/zipball/${hash}`;
|
|
52
|
-
await downloadFile(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
await downloadFile(
|
|
53
|
+
{
|
|
54
|
+
uri,
|
|
55
|
+
headers: {
|
|
56
|
+
Accept: "application/vnd.github.v3+json",
|
|
57
|
+
Authorization: "token " + options.token
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
archiveTarget
|
|
61
|
+
);
|
|
59
62
|
}
|
|
60
63
|
const files = await promises.readdir(rootDir);
|
|
61
64
|
const hashSearch = "-" + hash;
|
|
@@ -22,7 +22,9 @@ async function getGitLabRepoHash(options) {
|
|
|
22
22
|
throw new Error(`Error downloading data from GitLab API: ${data}`);
|
|
23
23
|
}
|
|
24
24
|
const content = JSON.parse(data);
|
|
25
|
-
const item = (content instanceof Array ? content : [content]).find(
|
|
25
|
+
const item = (content instanceof Array ? content : [content]).find(
|
|
26
|
+
(item2) => item2.name === options.branch && typeof item2.commit.id === "string"
|
|
27
|
+
);
|
|
26
28
|
if (!item) {
|
|
27
29
|
throw new Error("Error parsing GitLab API response");
|
|
28
30
|
}
|
|
@@ -18,7 +18,9 @@ async function getGitLabRepoHash(options) {
|
|
|
18
18
|
throw new Error(`Error downloading data from GitLab API: ${data}`);
|
|
19
19
|
}
|
|
20
20
|
const content = JSON.parse(data);
|
|
21
|
-
const item = (content instanceof Array ? content : [content]).find(
|
|
21
|
+
const item = (content instanceof Array ? content : [content]).find(
|
|
22
|
+
(item2) => item2.name === options.branch && typeof item2.commit.id === "string"
|
|
23
|
+
);
|
|
22
24
|
if (!item) {
|
|
23
25
|
throw new Error("Error parsing GitLab API response");
|
|
24
26
|
}
|
|
@@ -54,12 +54,15 @@ async function downloadGitLabRepo(options) {
|
|
|
54
54
|
}
|
|
55
55
|
if (!exists) {
|
|
56
56
|
const uri = `${options.uri || download_gitlab_types.defaultGitLabBaseURI}/${options.project}/repository/archive.zip?sha=${hash}`;
|
|
57
|
-
await download_api_download.downloadFile(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
await download_api_download.downloadFile(
|
|
58
|
+
{
|
|
59
|
+
uri,
|
|
60
|
+
headers: {
|
|
61
|
+
Authorization: "token " + options.token
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
archiveTarget
|
|
65
|
+
);
|
|
63
66
|
}
|
|
64
67
|
const files = await fs.promises.readdir(rootDir);
|
|
65
68
|
const hashSearch = "-" + hash;
|
|
@@ -50,12 +50,15 @@ async function downloadGitLabRepo(options) {
|
|
|
50
50
|
}
|
|
51
51
|
if (!exists) {
|
|
52
52
|
const uri = `${options.uri || defaultGitLabBaseURI}/${options.project}/repository/archive.zip?sha=${hash}`;
|
|
53
|
-
await downloadFile(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
await downloadFile(
|
|
54
|
+
{
|
|
55
|
+
uri,
|
|
56
|
+
headers: {
|
|
57
|
+
Authorization: "token " + options.token
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
archiveTarget
|
|
61
|
+
);
|
|
59
62
|
}
|
|
60
63
|
const files = await promises.readdir(rootDir);
|
|
61
64
|
const hashSearch = "-" + hash;
|
package/lib/download/index.cjs
CHANGED
|
@@ -21,7 +21,6 @@ require('stream');
|
|
|
21
21
|
require('./helpers/unzip.cjs');
|
|
22
22
|
require('extract-zip');
|
|
23
23
|
require('../misc/exec.cjs');
|
|
24
|
-
require('path');
|
|
25
24
|
require('child_process');
|
|
26
25
|
require('./git/branch.cjs');
|
|
27
26
|
require('./git/hash.cjs');
|
|
@@ -39,8 +38,8 @@ require('@iconify/utils/lib/icon-set/minify');
|
|
|
39
38
|
require('@iconify/utils/lib/icon-set/convert-info');
|
|
40
39
|
require('../icon-set/props.cjs');
|
|
41
40
|
require('@iconify/utils/lib/misc/objects');
|
|
42
|
-
require('tar');
|
|
43
41
|
require('@iconify/utils/lib/colors');
|
|
42
|
+
require('tar');
|
|
44
43
|
require('./helpers/untar.cjs');
|
|
45
44
|
require('./npm/version.cjs');
|
|
46
45
|
require('./gitlab/hash.cjs');
|
|
@@ -57,7 +56,9 @@ function downloadPackage(options) {
|
|
|
57
56
|
case "npm":
|
|
58
57
|
return download_npm_index.downloadNPMPackage(options);
|
|
59
58
|
default:
|
|
60
|
-
throw new Error(
|
|
59
|
+
throw new Error(
|
|
60
|
+
`Invalid download type: ${options.downloadType}`
|
|
61
|
+
);
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
64
|
|
package/lib/download/index.mjs
CHANGED
|
@@ -17,7 +17,6 @@ import 'stream';
|
|
|
17
17
|
import './helpers/unzip.mjs';
|
|
18
18
|
import 'extract-zip';
|
|
19
19
|
import '../misc/exec.mjs';
|
|
20
|
-
import 'path';
|
|
21
20
|
import 'child_process';
|
|
22
21
|
import './git/branch.mjs';
|
|
23
22
|
import './git/hash.mjs';
|
|
@@ -35,8 +34,8 @@ import '@iconify/utils/lib/icon-set/minify';
|
|
|
35
34
|
import '@iconify/utils/lib/icon-set/convert-info';
|
|
36
35
|
import '../icon-set/props.mjs';
|
|
37
36
|
import '@iconify/utils/lib/misc/objects';
|
|
38
|
-
import 'tar';
|
|
39
37
|
import '@iconify/utils/lib/colors';
|
|
38
|
+
import 'tar';
|
|
40
39
|
import './helpers/untar.mjs';
|
|
41
40
|
import './npm/version.mjs';
|
|
42
41
|
import './gitlab/hash.mjs';
|
|
@@ -53,7 +52,9 @@ function downloadPackage(options) {
|
|
|
53
52
|
case "npm":
|
|
54
53
|
return downloadNPMPackage(options);
|
|
55
54
|
default:
|
|
56
|
-
throw new Error(
|
|
55
|
+
throw new Error(
|
|
56
|
+
`Invalid download type: ${options.downloadType}`
|
|
57
|
+
);
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
60
|
|
|
@@ -13,7 +13,6 @@ require('util');
|
|
|
13
13
|
require('stream');
|
|
14
14
|
require('tar');
|
|
15
15
|
require('../../misc/exec.cjs');
|
|
16
|
-
require('path');
|
|
17
16
|
require('child_process');
|
|
18
17
|
|
|
19
18
|
async function downloadNPMPackage(options) {
|
|
@@ -43,7 +42,9 @@ async function downloadNPMPackage(options) {
|
|
|
43
42
|
}
|
|
44
43
|
const archiveURL = versionInfo.file;
|
|
45
44
|
if (!archiveURL) {
|
|
46
|
-
throw new Error(
|
|
45
|
+
throw new Error(
|
|
46
|
+
`NPM registry did not provide link to package archive.`
|
|
47
|
+
);
|
|
47
48
|
}
|
|
48
49
|
const archiveTarget = rootDir + "/" + version + ".tgz";
|
|
49
50
|
await export_helpers_prepare.prepareDirectoryForExport(options);
|
|
@@ -57,12 +58,15 @@ async function downloadNPMPackage(options) {
|
|
|
57
58
|
if (options.log) {
|
|
58
59
|
console.log(`Downloading ${archiveURL}`);
|
|
59
60
|
}
|
|
60
|
-
await download_api_download.downloadFile(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
await download_api_download.downloadFile(
|
|
62
|
+
{
|
|
63
|
+
uri: archiveURL,
|
|
64
|
+
headers: {
|
|
65
|
+
Accept: "application/tar+gzip"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
archiveTarget
|
|
69
|
+
);
|
|
66
70
|
}
|
|
67
71
|
await export_helpers_prepare.prepareDirectoryForExport({
|
|
68
72
|
target: contentsDir,
|
|
@@ -9,7 +9,6 @@ import 'util';
|
|
|
9
9
|
import 'stream';
|
|
10
10
|
import 'tar';
|
|
11
11
|
import '../../misc/exec.mjs';
|
|
12
|
-
import 'path';
|
|
13
12
|
import 'child_process';
|
|
14
13
|
|
|
15
14
|
async function downloadNPMPackage(options) {
|
|
@@ -39,7 +38,9 @@ async function downloadNPMPackage(options) {
|
|
|
39
38
|
}
|
|
40
39
|
const archiveURL = versionInfo.file;
|
|
41
40
|
if (!archiveURL) {
|
|
42
|
-
throw new Error(
|
|
41
|
+
throw new Error(
|
|
42
|
+
`NPM registry did not provide link to package archive.`
|
|
43
|
+
);
|
|
43
44
|
}
|
|
44
45
|
const archiveTarget = rootDir + "/" + version + ".tgz";
|
|
45
46
|
await prepareDirectoryForExport(options);
|
|
@@ -53,12 +54,15 @@ async function downloadNPMPackage(options) {
|
|
|
53
54
|
if (options.log) {
|
|
54
55
|
console.log(`Downloading ${archiveURL}`);
|
|
55
56
|
}
|
|
56
|
-
await downloadFile(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
await downloadFile(
|
|
58
|
+
{
|
|
59
|
+
uri: archiveURL,
|
|
60
|
+
headers: {
|
|
61
|
+
Accept: "application/tar+gzip"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
archiveTarget
|
|
65
|
+
);
|
|
62
66
|
}
|
|
63
67
|
await prepareDirectoryForExport({
|
|
64
68
|
target: contentsDir,
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const fs = require('fs');
|
|
6
6
|
const misc_exec = require('../../misc/exec.cjs');
|
|
7
|
-
require('
|
|
7
|
+
require('pathe');
|
|
8
8
|
require('child_process');
|
|
9
9
|
|
|
10
10
|
async function getNPMVersion(options) {
|
|
@@ -17,7 +17,9 @@ async function getNPMVersion(options) {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
async function getPackageVersion(target) {
|
|
20
|
-
return JSON.parse(
|
|
20
|
+
return JSON.parse(
|
|
21
|
+
await fs.promises.readFile(target + "/package.json", "utf8")
|
|
22
|
+
).version;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
exports.getNPMVersion = getNPMVersion;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { promises } from 'fs';
|
|
2
2
|
import { execAsync } from '../../misc/exec.mjs';
|
|
3
|
-
import '
|
|
3
|
+
import 'pathe';
|
|
4
4
|
import 'child_process';
|
|
5
5
|
|
|
6
6
|
async function getNPMVersion(options) {
|
|
@@ -13,7 +13,9 @@ async function getNPMVersion(options) {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
async function getPackageVersion(target) {
|
|
16
|
-
return JSON.parse(
|
|
16
|
+
return JSON.parse(
|
|
17
|
+
await promises.readFile(target + "/package.json", "utf8")
|
|
18
|
+
).version;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
export { getNPMVersion, getPackageVersion };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IconSet } from '../icon-set/index.js';
|
|
2
2
|
import { ExportTargetOptions } from './helpers/prepare.js';
|
|
3
|
-
import '
|
|
3
|
+
import '@iconify/types';
|
|
4
4
|
import '@iconify/utils/lib/customisations/defaults';
|
|
5
5
|
import '../icon-set/types.js';
|
|
6
6
|
import '../svg/index.js';
|
|
@@ -6,7 +6,9 @@ require('local-pkg');
|
|
|
6
6
|
require('fs');
|
|
7
7
|
|
|
8
8
|
async function getTypesVersion() {
|
|
9
|
-
throw new Error(
|
|
9
|
+
throw new Error(
|
|
10
|
+
`getTypesVersion() is deprecated, use wildcard to make packages work with all versions`
|
|
11
|
+
);
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
exports.getTypesVersion = getTypesVersion;
|
|
@@ -2,7 +2,9 @@ import 'local-pkg';
|
|
|
2
2
|
import 'fs';
|
|
3
3
|
|
|
4
4
|
async function getTypesVersion() {
|
|
5
|
-
throw new Error(
|
|
5
|
+
throw new Error(
|
|
6
|
+
`getTypesVersion() is deprecated, use wildcard to make packages work with all versions`
|
|
7
|
+
);
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
export { getTypesVersion };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IconSet } from '../icon-set/index.js';
|
|
2
2
|
import { ExportTargetOptions } from './helpers/prepare.js';
|
|
3
3
|
import { ExportOptionsWithCustomFiles } from './helpers/custom-files.js';
|
|
4
|
-
import '
|
|
4
|
+
import '@iconify/types';
|
|
5
5
|
import '@iconify/utils/lib/customisations/defaults';
|
|
6
6
|
import '../icon-set/types.js';
|
|
7
7
|
import '../svg/index.js';
|
|
@@ -15,7 +15,9 @@ const exportTypes = {
|
|
|
15
15
|
metadata: "IconifyMetaData",
|
|
16
16
|
chars: "IconifyChars"
|
|
17
17
|
};
|
|
18
|
-
const iconsKeys = ["aliases", "lastModified"].concat(
|
|
18
|
+
const iconsKeys = ["aliases", "lastModified"].concat(
|
|
19
|
+
Object.keys(defaults.defaultIconDimensions)
|
|
20
|
+
);
|
|
19
21
|
const metadataKeys = [
|
|
20
22
|
"categories",
|
|
21
23
|
"themes",
|
|
@@ -111,7 +113,11 @@ async function exportJSONPackage(iconSet, options) {
|
|
|
111
113
|
const mjsContent = mjsImports.concat([""], mjsConsts, [
|
|
112
114
|
`export { ${mjsExports.join(", ")} };`
|
|
113
115
|
]);
|
|
114
|
-
await fs.promises.writeFile(
|
|
116
|
+
await fs.promises.writeFile(
|
|
117
|
+
dir + "/index.mjs",
|
|
118
|
+
mjsContent.join("\n") + "\n",
|
|
119
|
+
"utf8"
|
|
120
|
+
);
|
|
115
121
|
files.add("index.mjs");
|
|
116
122
|
const usedTypes = Object.values(exportTypes);
|
|
117
123
|
const typesData = [
|
|
@@ -120,7 +126,11 @@ async function exportJSONPackage(iconSet, options) {
|
|
|
120
126
|
`export { ${usedTypes.join(", ")} };`,
|
|
121
127
|
""
|
|
122
128
|
].concat(dtsContent);
|
|
123
|
-
await fs.promises.writeFile(
|
|
129
|
+
await fs.promises.writeFile(
|
|
130
|
+
dir + "/index.d.ts",
|
|
131
|
+
typesData.join("\n") + "\n",
|
|
132
|
+
"utf8"
|
|
133
|
+
);
|
|
124
134
|
files.add("index.d.ts");
|
|
125
135
|
await export_helpers_customFiles.exportCustomFiles(dir, options, files);
|
|
126
136
|
await misc_writeJson.writeJSONFile(dir + "/package.json", packageJSON);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IconSet } from '../icon-set/index.js';
|
|
2
2
|
import { ExportTargetOptions } from './helpers/prepare.js';
|
|
3
3
|
import { ExportOptionsWithCustomFiles } from './helpers/custom-files.js';
|
|
4
|
-
import '
|
|
4
|
+
import '@iconify/types';
|
|
5
5
|
import '@iconify/utils/lib/customisations/defaults';
|
|
6
6
|
import '../icon-set/types.js';
|
|
7
7
|
import '../svg/index.js';
|
|
@@ -11,7 +11,9 @@ const exportTypes = {
|
|
|
11
11
|
metadata: "IconifyMetaData",
|
|
12
12
|
chars: "IconifyChars"
|
|
13
13
|
};
|
|
14
|
-
const iconsKeys = ["aliases", "lastModified"].concat(
|
|
14
|
+
const iconsKeys = ["aliases", "lastModified"].concat(
|
|
15
|
+
Object.keys(defaultIconDimensions)
|
|
16
|
+
);
|
|
15
17
|
const metadataKeys = [
|
|
16
18
|
"categories",
|
|
17
19
|
"themes",
|
|
@@ -107,7 +109,11 @@ async function exportJSONPackage(iconSet, options) {
|
|
|
107
109
|
const mjsContent = mjsImports.concat([""], mjsConsts, [
|
|
108
110
|
`export { ${mjsExports.join(", ")} };`
|
|
109
111
|
]);
|
|
110
|
-
await promises.writeFile(
|
|
112
|
+
await promises.writeFile(
|
|
113
|
+
dir + "/index.mjs",
|
|
114
|
+
mjsContent.join("\n") + "\n",
|
|
115
|
+
"utf8"
|
|
116
|
+
);
|
|
111
117
|
files.add("index.mjs");
|
|
112
118
|
const usedTypes = Object.values(exportTypes);
|
|
113
119
|
const typesData = [
|
|
@@ -116,7 +122,11 @@ async function exportJSONPackage(iconSet, options) {
|
|
|
116
122
|
`export { ${usedTypes.join(", ")} };`,
|
|
117
123
|
""
|
|
118
124
|
].concat(dtsContent);
|
|
119
|
-
await promises.writeFile(
|
|
125
|
+
await promises.writeFile(
|
|
126
|
+
dir + "/index.d.ts",
|
|
127
|
+
typesData.join("\n") + "\n",
|
|
128
|
+
"utf8"
|
|
129
|
+
);
|
|
120
130
|
files.add("index.d.ts");
|
|
121
131
|
await exportCustomFiles(dir, options, files);
|
|
122
132
|
await writeJSONFile(dir + "/package.json", packageJSON);
|
package/lib/icon-set/index.cjs
CHANGED
|
@@ -14,7 +14,9 @@ require('cheerio');
|
|
|
14
14
|
|
|
15
15
|
const themeKeys = ["prefixes", "suffixes"];
|
|
16
16
|
function sortThemeKeys(keys) {
|
|
17
|
-
return keys.sort(
|
|
17
|
+
return keys.sort(
|
|
18
|
+
(a, b) => a.length === b.length ? a.localeCompare(b) : b.length - a.length
|
|
19
|
+
);
|
|
18
20
|
}
|
|
19
21
|
class IconSet {
|
|
20
22
|
constructor(data) {
|
|
@@ -30,10 +32,14 @@ class IconSet {
|
|
|
30
32
|
const entry = {
|
|
31
33
|
type: "icon",
|
|
32
34
|
body: item.body,
|
|
33
|
-
props: iconSet_props.filterProps(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
props: iconSet_props.filterProps(
|
|
36
|
+
{
|
|
37
|
+
...defaultProps,
|
|
38
|
+
...item
|
|
39
|
+
},
|
|
40
|
+
iconSet_props.defaultCommonProps,
|
|
41
|
+
true
|
|
42
|
+
),
|
|
37
43
|
chars: /* @__PURE__ */ new Set(),
|
|
38
44
|
categories: /* @__PURE__ */ new Set()
|
|
39
45
|
};
|
|
@@ -205,7 +211,9 @@ class IconSet {
|
|
|
205
211
|
return null;
|
|
206
212
|
}
|
|
207
213
|
const result = build.iconToSVG(item, customisations);
|
|
208
|
-
const attributes = Object.keys(result.attributes).map(
|
|
214
|
+
const attributes = Object.keys(result.attributes).map(
|
|
215
|
+
(key) => ` ${key}="${result.attributes[key]}"`
|
|
216
|
+
).join("");
|
|
209
217
|
return `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"${attributes}>${result.body}</svg>`;
|
|
210
218
|
}
|
|
211
219
|
toSVG(name) {
|
|
@@ -262,7 +270,9 @@ class IconSet {
|
|
|
262
270
|
if (Object.keys(aliases).length) {
|
|
263
271
|
result.aliases = aliases;
|
|
264
272
|
}
|
|
265
|
-
const chars = this.chars(
|
|
273
|
+
const chars = this.chars(
|
|
274
|
+
Object.keys(icons).concat(Object.keys(aliases))
|
|
275
|
+
);
|
|
266
276
|
if (Object.keys(chars).length) {
|
|
267
277
|
result.chars = chars;
|
|
268
278
|
}
|
|
@@ -342,7 +352,9 @@ class IconSet {
|
|
|
342
352
|
}).length;
|
|
343
353
|
}
|
|
344
354
|
findCategory(title, add) {
|
|
345
|
-
const categoryItem = Array.from(this.categories).find(
|
|
355
|
+
const categoryItem = Array.from(this.categories).find(
|
|
356
|
+
(item) => item.title === title
|
|
357
|
+
);
|
|
346
358
|
if (categoryItem) {
|
|
347
359
|
return categoryItem;
|
|
348
360
|
}
|