@iconify/tools 3.0.0 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -72,15 +72,19 @@ function isValidFile(item) {
72
72
  }
73
73
  function importDirectory(path, options = {}) {
74
74
  return new Promise((fulfill, reject) => {
75
- misc_scan.scanDirectory(path, (ext, file, subdir, path2) => {
76
- const result = {
77
- file,
78
- ext,
79
- subdir,
80
- path: path2
81
- };
82
- return isValidFile(result) ? result : false;
83
- }).then((files) => {
75
+ misc_scan.scanDirectory(
76
+ path,
77
+ (ext, file, subdir, path2) => {
78
+ const result = {
79
+ file,
80
+ ext,
81
+ subdir,
82
+ path: path2
83
+ };
84
+ return isValidFile(result) ? result : false;
85
+ },
86
+ options.includeSubDirs !== false
87
+ ).then((files) => {
84
88
  const iconSet = iconSet_index.blankIconSet(options.prefix || "");
85
89
  try {
86
90
  importDir(
@@ -111,15 +115,19 @@ function importDirectory(path, options = {}) {
111
115
  });
112
116
  }
113
117
  function importDirectorySync(path, options = {}) {
114
- const files = misc_scan.scanDirectorySync(path, (ext, file, subdir, path2) => {
115
- const result = {
116
- file,
117
- ext,
118
- subdir,
119
- path: path2
120
- };
121
- return isValidFile(result) ? result : false;
122
- });
118
+ const files = misc_scan.scanDirectorySync(
119
+ path,
120
+ (ext, file, subdir, path2) => {
121
+ const result = {
122
+ file,
123
+ ext,
124
+ subdir,
125
+ path: path2
126
+ };
127
+ return isValidFile(result) ? result : false;
128
+ },
129
+ options.includeSubDirs !== false
130
+ );
123
131
  const iconSet = iconSet_index.blankIconSet(options.prefix || "");
124
132
  let isSync = true;
125
133
  importDir(
@@ -70,15 +70,19 @@ function isValidFile(item) {
70
70
  }
71
71
  function importDirectory(path, options = {}) {
72
72
  return new Promise((fulfill, reject) => {
73
- scanDirectory(path, (ext, file, subdir, path2) => {
74
- const result = {
75
- file,
76
- ext,
77
- subdir,
78
- path: path2
79
- };
80
- return isValidFile(result) ? result : false;
81
- }).then((files) => {
73
+ scanDirectory(
74
+ path,
75
+ (ext, file, subdir, path2) => {
76
+ const result = {
77
+ file,
78
+ ext,
79
+ subdir,
80
+ path: path2
81
+ };
82
+ return isValidFile(result) ? result : false;
83
+ },
84
+ options.includeSubDirs !== false
85
+ ).then((files) => {
82
86
  const iconSet = blankIconSet(options.prefix || "");
83
87
  try {
84
88
  importDir(
@@ -109,15 +113,19 @@ function importDirectory(path, options = {}) {
109
113
  });
110
114
  }
111
115
  function importDirectorySync(path, options = {}) {
112
- const files = scanDirectorySync(path, (ext, file, subdir, path2) => {
113
- const result = {
114
- file,
115
- ext,
116
- subdir,
117
- path: path2
118
- };
119
- return isValidFile(result) ? result : false;
120
- });
116
+ const files = scanDirectorySync(
117
+ path,
118
+ (ext, file, subdir, path2) => {
119
+ const result = {
120
+ file,
121
+ ext,
122
+ subdir,
123
+ path: path2
124
+ };
125
+ return isValidFile(result) ? result : false;
126
+ },
127
+ options.includeSubDirs !== false
128
+ );
121
129
  const iconSet = blankIconSet(options.prefix || "");
122
130
  let isSync = true;
123
131
  importDir(
@@ -7,7 +7,7 @@ function cleanupIconKeyword(keyword, convertCamelCase = false) {
7
7
  (chars) => "_" + chars.toLowerCase()
8
8
  );
9
9
  }
10
- keyword = keyword.toLowerCase().trim().replace(/[\s_.:]/g, "-").replace(/[^a-z0-9-]/g, "").replace(/[-]+/g, "-");
10
+ keyword = keyword.toLowerCase().trim().replace(/[\s_.:/\\]/g, "-").replace(/[^a-z0-9-]/g, "").replace(/[-]+/g, "-");
11
11
  if (keyword.slice(0, 1) === "-") {
12
12
  keyword = keyword.slice(1);
13
13
  }
@@ -5,7 +5,7 @@ function cleanupIconKeyword(keyword, convertCamelCase = false) {
5
5
  (chars) => "_" + chars.toLowerCase()
6
6
  );
7
7
  }
8
- keyword = keyword.toLowerCase().trim().replace(/[\s_.:]/g, "-").replace(/[^a-z0-9-]/g, "").replace(/[-]+/g, "-");
8
+ keyword = keyword.toLowerCase().trim().replace(/[\s_.:/\\]/g, "-").replace(/[^a-z0-9-]/g, "").replace(/[-]+/g, "-");
9
9
  if (keyword.slice(0, 1) === "-") {
10
10
  keyword = keyword.slice(1);
11
11
  }
@@ -72,7 +72,7 @@ function cleanupSVGRoot(svg) {
72
72
  return;
73
73
  }
74
74
  const tagName2 = child.tagName;
75
- if (tagName2 === "style" || svg_data_tags.reusableElementsWithPalette.has(tagName2) || svg_data_tags.maskTags.has(tagName2)) {
75
+ if (tagName2 === "style" || tagName2 === "title" || svg_data_tags.reusableElementsWithPalette.has(tagName2) || svg_data_tags.maskTags.has(tagName2)) {
76
76
  return;
77
77
  }
78
78
  $child.appendTo($wrapper);
@@ -70,7 +70,7 @@ function cleanupSVGRoot(svg) {
70
70
  return;
71
71
  }
72
72
  const tagName2 = child.tagName;
73
- if (tagName2 === "style" || reusableElementsWithPalette.has(tagName2) || maskTags.has(tagName2)) {
73
+ if (tagName2 === "style" || tagName2 === "title" || reusableElementsWithPalette.has(tagName2) || maskTags.has(tagName2)) {
74
74
  return;
75
75
  }
76
76
  $child.appendTo($wrapper);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "type": "module",
4
4
  "description": "Collection of functions for cleaning up and parsing SVG for Iconify project",
5
5
  "author": "Vjacheslav Trushkin",
6
- "version": "3.0.0",
6
+ "version": "3.0.2",
7
7
  "license": "MIT",
8
8
  "bugs": "https://github.com/iconify/tools/issues",
9
9
  "homepage": "https://github.com/iconify/tools",