@iconify/tools 3.0.6 → 4.0.0-dev.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.
Files changed (51) hide show
  1. package/lib/colors/detect.d.ts +1 -0
  2. package/lib/colors/parse.d.ts +1 -0
  3. package/lib/colors/validate.d.ts +1 -0
  4. package/lib/export/directory.d.ts +1 -0
  5. package/lib/export/icon-package.d.ts +1 -0
  6. package/lib/export/json-package.d.ts +1 -0
  7. package/lib/icon-set/index.d.ts +1 -0
  8. package/lib/icon-set/match.d.ts +1 -0
  9. package/lib/icon-set/merge.d.ts +1 -0
  10. package/lib/icon-set/modified.d.ts +1 -0
  11. package/lib/icon-set/tags.d.ts +1 -0
  12. package/lib/import/directory.d.ts +1 -0
  13. package/lib/import/figma/index.d.ts +1 -0
  14. package/lib/import/figma/nodes.d.ts +1 -0
  15. package/lib/import/figma/query.d.ts +1 -0
  16. package/lib/import/figma/types/nodes.d.ts +1 -0
  17. package/lib/import/figma/types/options.d.ts +1 -0
  18. package/lib/import/figma/types/result.d.ts +1 -0
  19. package/lib/index.d.ts +1 -0
  20. package/lib/misc/cheerio.d.ts +4 -2
  21. package/lib/optimise/figma.cjs +5 -5
  22. package/lib/optimise/figma.d.ts +1 -0
  23. package/lib/optimise/figma.mjs +5 -5
  24. package/lib/optimise/flags.d.ts +1 -0
  25. package/lib/optimise/global-style.d.ts +1 -0
  26. package/lib/optimise/mask.cjs +9 -9
  27. package/lib/optimise/mask.d.ts +1 -0
  28. package/lib/optimise/mask.mjs +9 -9
  29. package/lib/optimise/origin.d.ts +1 -0
  30. package/lib/optimise/scale.d.ts +1 -0
  31. package/lib/optimise/svgo.d.ts +1 -0
  32. package/lib/svg/analyse/error.d.ts +1 -0
  33. package/lib/svg/analyse/types.d.ts +3 -1
  34. package/lib/svg/analyse.d.ts +1 -0
  35. package/lib/svg/cleanup/attribs.d.ts +1 -0
  36. package/lib/svg/cleanup/bad-tags.d.ts +1 -0
  37. package/lib/svg/cleanup/inline-style.d.ts +1 -0
  38. package/lib/svg/cleanup/root-style.d.ts +1 -0
  39. package/lib/svg/cleanup/root-svg.cjs +3 -3
  40. package/lib/svg/cleanup/root-svg.d.ts +1 -0
  41. package/lib/svg/cleanup/root-svg.mjs +3 -3
  42. package/lib/svg/cleanup/svgo-style.d.ts +1 -0
  43. package/lib/svg/cleanup.d.ts +1 -0
  44. package/lib/svg/index.cjs +13 -3
  45. package/lib/svg/index.d.ts +2 -1
  46. package/lib/svg/index.mjs +1 -1
  47. package/lib/svg/parse-style.d.ts +1 -0
  48. package/lib/svg/parse.cjs +2 -2
  49. package/lib/svg/parse.d.ts +1 -0
  50. package/lib/svg/parse.mjs +2 -2
  51. package/package.json +12 -10
@@ -3,6 +3,7 @@ import '@iconify/types';
3
3
  import '@iconify/utils/lib/customisations/defaults';
4
4
  import '../icon-set/types.js';
5
5
  import '../svg/index.js';
6
+ import 'cheerio';
6
7
  import '@iconify/utils/lib/icon-set/tree';
7
8
 
8
9
  /**
@@ -2,6 +2,7 @@ import { Color } from '@iconify/utils/lib/colors/types';
2
2
  import { SVG } from '../svg/index.js';
3
3
  import { ColorAttributes } from './attribs.js';
4
4
  import { ElementsTreeItem, AnalyseSVGStructureResult, ExtendedTagElement, AnalyseSVGStructureOptions } from '../svg/analyse/types.js';
5
+ import 'cheerio';
5
6
  import '@iconify/types';
6
7
  import '@iconify/utils/lib/customisations/defaults';
7
8
 
@@ -1,5 +1,6 @@
1
1
  import { SVG } from '../svg/index.js';
2
2
  import { ParseColorsOptions, FindColorsResult, ParseColorsSyncOptions } from './parse.js';
3
+ import 'cheerio';
3
4
  import '@iconify/types';
4
5
  import '@iconify/utils/lib/customisations/defaults';
5
6
  import '@iconify/utils/lib/colors/types';
@@ -4,6 +4,7 @@ import '@iconify/types';
4
4
  import '@iconify/utils/lib/customisations/defaults';
5
5
  import '../icon-set/types.js';
6
6
  import '../svg/index.js';
7
+ import 'cheerio';
7
8
  import '@iconify/utils/lib/icon-set/tree';
8
9
 
9
10
  /**
@@ -5,6 +5,7 @@ import '@iconify/types';
5
5
  import '@iconify/utils/lib/customisations/defaults';
6
6
  import '../icon-set/types.js';
7
7
  import '../svg/index.js';
8
+ import 'cheerio';
8
9
  import '@iconify/utils/lib/icon-set/tree';
9
10
 
10
11
  /**
@@ -5,6 +5,7 @@ import '@iconify/types';
5
5
  import '@iconify/utils/lib/customisations/defaults';
6
6
  import '../icon-set/types.js';
7
7
  import '../svg/index.js';
8
+ import 'cheerio';
8
9
  import '@iconify/utils/lib/icon-set/tree';
9
10
 
10
11
  /**
@@ -3,6 +3,7 @@ import { IconifyIconCustomisations } from '@iconify/utils/lib/customisations/def
3
3
  import { IconSetIconEntry, IconCategory, IconSetIconType, IconSetAsyncForEachCallback, IconSetSyncForEachCallback, ResolvedIconifyIcon, CommonIconProps, CheckThemeResult } from './types.js';
4
4
  import { SVG } from '../svg/index.js';
5
5
  import { ParentIconsTree } from '@iconify/utils/lib/icon-set/tree';
6
+ import 'cheerio';
6
7
 
7
8
  /**
8
9
  * Sort theme keys: long keys first
@@ -4,6 +4,7 @@ import '@iconify/types';
4
4
  import '@iconify/utils/lib/customisations/defaults';
5
5
  import './types.js';
6
6
  import '../svg/index.js';
7
+ import 'cheerio';
7
8
  import '@iconify/utils/lib/icon-set/tree';
8
9
 
9
10
  /**
@@ -3,6 +3,7 @@ import '@iconify/types';
3
3
  import '@iconify/utils/lib/customisations/defaults';
4
4
  import './types.js';
5
5
  import '../svg/index.js';
6
+ import 'cheerio';
6
7
  import '@iconify/utils/lib/icon-set/tree';
7
8
 
8
9
  /**
@@ -3,6 +3,7 @@ import '@iconify/types';
3
3
  import '@iconify/utils/lib/customisations/defaults';
4
4
  import './types.js';
5
5
  import '../svg/index.js';
6
+ import 'cheerio';
6
7
  import '@iconify/utils/lib/icon-set/tree';
7
8
 
8
9
  /**
@@ -3,6 +3,7 @@ import '@iconify/types';
3
3
  import '@iconify/utils/lib/customisations/defaults';
4
4
  import './types.js';
5
5
  import '../svg/index.js';
6
+ import 'cheerio';
6
7
  import '@iconify/utils/lib/icon-set/tree';
7
8
 
8
9
  declare const paletteTags: {
@@ -4,6 +4,7 @@ import '@iconify/types';
4
4
  import '@iconify/utils/lib/customisations/defaults';
5
5
  import '../icon-set/types.js';
6
6
  import '../svg/index.js';
7
+ import 'cheerio';
7
8
  import '@iconify/utils/lib/icon-set/tree';
8
9
  import '../svg/cleanup/bad-tags.js';
9
10
 
@@ -6,6 +6,7 @@ import '@iconify/types';
6
6
  import '@iconify/utils/lib/customisations/defaults';
7
7
  import '../../icon-set/types.js';
8
8
  import '../../svg/index.js';
9
+ import 'cheerio';
9
10
  import '@iconify/utils/lib/icon-set/tree';
10
11
  import './types/nodes.js';
11
12
  import './types/api.js';
@@ -6,6 +6,7 @@ import '@iconify/types';
6
6
  import '@iconify/utils/lib/customisations/defaults';
7
7
  import '../../icon-set/types.js';
8
8
  import '../../svg/index.js';
9
+ import 'cheerio';
9
10
  import '@iconify/utils/lib/icon-set/tree';
10
11
  import './types/nodes.js';
11
12
 
@@ -8,6 +8,7 @@ import '@iconify/types';
8
8
  import '@iconify/utils/lib/customisations/defaults';
9
9
  import '../../icon-set/types.js';
10
10
  import '../../svg/index.js';
11
+ import 'cheerio';
11
12
  import '@iconify/utils/lib/icon-set/tree';
12
13
  import './types/nodes.js';
13
14
 
@@ -5,6 +5,7 @@ import '@iconify/types';
5
5
  import '@iconify/utils/lib/customisations/defaults';
6
6
  import '../../../icon-set/types.js';
7
7
  import '../../../svg/index.js';
8
+ import 'cheerio';
8
9
  import '@iconify/utils/lib/icon-set/tree';
9
10
 
10
11
  type FigmaImportParentNodeType = 'CANVAS' | 'FRAME' | 'GROUP' | 'SECTION';
@@ -5,6 +5,7 @@ import '@iconify/types';
5
5
  import '@iconify/utils/lib/customisations/defaults';
6
6
  import '../../../icon-set/types.js';
7
7
  import '../../../svg/index.js';
8
+ import 'cheerio';
8
9
  import '@iconify/utils/lib/icon-set/tree';
9
10
  import './api.js';
10
11
 
@@ -3,6 +3,7 @@ import '@iconify/types';
3
3
  import '@iconify/utils/lib/customisations/defaults';
4
4
  import '../../../icon-set/types.js';
5
5
  import '../../../svg/index.js';
6
+ import 'cheerio';
6
7
  import '@iconify/utils/lib/icon-set/tree';
7
8
 
8
9
  /**
package/lib/index.d.ts CHANGED
@@ -49,6 +49,7 @@ export { execAsync } from './misc/exec.js';
49
49
  export { cleanupIconKeyword } from './misc/keyword.js';
50
50
  export { bumpVersion } from './misc/bump-version.js';
51
51
  export { sendAPIQuery } from './download/api/index.js';
52
+ import 'cheerio';
52
53
  import '@iconify/types';
53
54
  import '@iconify/utils/lib/customisations/defaults';
54
55
  import './misc/cheerio.js';
@@ -1,7 +1,9 @@
1
+ import * as cheerio from 'cheerio';
2
+
1
3
  /**
2
4
  * Shortcuts for Cheerio elements
3
5
  */
4
- type CheerioElement = cheerio.TagElement;
5
- type WrappedCheerioElement = cheerio.Cheerio;
6
+ type CheerioElement = cheerio.Element;
7
+ type WrappedCheerioElement = cheerio.Cheerio<cheerio.Element>;
6
8
 
7
9
  export { CheerioElement, WrappedCheerioElement };
@@ -75,7 +75,7 @@ function checkClipPathNode(clipNode, expectedWidth, expectedHeight) {
75
75
  const urlStart = "url(#";
76
76
  const urlEnd = ")";
77
77
  function removeFigmaClipPathFromSVG(svg) {
78
- const cheerio = svg.$svg;
78
+ const cheerio2 = svg.$svg;
79
79
  const $root = svg.$svg(":root");
80
80
  const children = $root.children();
81
81
  const backup = svg.toString();
@@ -112,7 +112,7 @@ function removeFigmaClipPathFromSVG(svg) {
112
112
  svg.viewBox.width,
113
113
  svg.viewBox.height
114
114
  );
115
- cheerio(node).remove();
115
+ cheerio2(node).remove();
116
116
  return result;
117
117
  };
118
118
  const findClipPath = () => {
@@ -136,7 +136,7 @@ function removeFigmaClipPathFromSVG(svg) {
136
136
  }
137
137
  );
138
138
  if (!validChildren.length) {
139
- cheerio(node).remove();
139
+ cheerio2(node).remove();
140
140
  }
141
141
  return result;
142
142
  }
@@ -160,13 +160,13 @@ function removeFigmaClipPathFromSVG(svg) {
160
160
  const attribs = clipPath.attribs;
161
161
  for (let i = 0; i < shapesToClip.length; i++) {
162
162
  const node = shapesToClip[i];
163
- cheerio(node).removeAttr("clip-path");
163
+ cheerio2(node).removeAttr("clip-path");
164
164
  for (const attr in attribs) {
165
165
  if (node.attribs[attr] !== void 0) {
166
166
  svg.load(backup);
167
167
  return false;
168
168
  }
169
- cheerio(node).attr(attr, attribs[attr]);
169
+ cheerio2(node).attr(attr, attribs[attr]);
170
170
  }
171
171
  }
172
172
  return true;
@@ -1,4 +1,5 @@
1
1
  import { SVG } from '../svg/index.js';
2
+ import 'cheerio';
2
3
  import '@iconify/types';
3
4
  import '@iconify/utils/lib/customisations/defaults';
4
5
 
@@ -73,7 +73,7 @@ function checkClipPathNode(clipNode, expectedWidth, expectedHeight) {
73
73
  const urlStart = "url(#";
74
74
  const urlEnd = ")";
75
75
  function removeFigmaClipPathFromSVG(svg) {
76
- const cheerio = svg.$svg;
76
+ const cheerio2 = svg.$svg;
77
77
  const $root = svg.$svg(":root");
78
78
  const children = $root.children();
79
79
  const backup = svg.toString();
@@ -110,7 +110,7 @@ function removeFigmaClipPathFromSVG(svg) {
110
110
  svg.viewBox.width,
111
111
  svg.viewBox.height
112
112
  );
113
- cheerio(node).remove();
113
+ cheerio2(node).remove();
114
114
  return result;
115
115
  };
116
116
  const findClipPath = () => {
@@ -134,7 +134,7 @@ function removeFigmaClipPathFromSVG(svg) {
134
134
  }
135
135
  );
136
136
  if (!validChildren.length) {
137
- cheerio(node).remove();
137
+ cheerio2(node).remove();
138
138
  }
139
139
  return result;
140
140
  }
@@ -158,13 +158,13 @@ function removeFigmaClipPathFromSVG(svg) {
158
158
  const attribs = clipPath.attribs;
159
159
  for (let i = 0; i < shapesToClip.length; i++) {
160
160
  const node = shapesToClip[i];
161
- cheerio(node).removeAttr("clip-path");
161
+ cheerio2(node).removeAttr("clip-path");
162
162
  for (const attr in attribs) {
163
163
  if (node.attribs[attr] !== void 0) {
164
164
  svg.load(backup);
165
165
  return false;
166
166
  }
167
- cheerio(node).attr(attr, attribs[attr]);
167
+ cheerio2(node).attr(attr, attribs[attr]);
168
168
  }
169
169
  }
170
170
  return true;
@@ -1,4 +1,5 @@
1
1
  import { SVG } from '../svg/index.js';
2
+ import 'cheerio';
2
3
  import '@iconify/types';
3
4
  import '@iconify/utils/lib/customisations/defaults';
4
5
 
@@ -1,4 +1,5 @@
1
1
  import { SVG } from '../svg/index.js';
2
+ import 'cheerio';
2
3
  import '@iconify/types';
3
4
  import '@iconify/utils/lib/customisations/defaults';
4
5
 
@@ -51,16 +51,8 @@ function convertSVGToMask(svg, options = {}) {
51
51
  if (!color || colors_parse.isEmptyColor(color)) {
52
52
  return colorStr;
53
53
  }
54
- if (check(props.solid, colorStr, color)) {
55
- foundSolid = true;
56
- return "#fff";
57
- }
58
- if (check(props.transparent, colorStr, color)) {
59
- foundTransparent = true;
60
- return "#000";
61
- }
62
54
  if (props.custom) {
63
- let customValue = props.custom(colorStr, color);
55
+ let customValue = props.custom(colorStr.toLowerCase(), color);
64
56
  if (typeof customValue === "number") {
65
57
  const num = Math.max(
66
58
  Math.min(Math.round(customValue * 255), 255),
@@ -86,6 +78,14 @@ function convertSVGToMask(svg, options = {}) {
86
78
  return customValue;
87
79
  }
88
80
  }
81
+ if (check(props.solid, colorStr, color)) {
82
+ foundSolid = true;
83
+ return "#fff";
84
+ }
85
+ if (check(props.transparent, colorStr, color)) {
86
+ foundTransparent = true;
87
+ return "#000";
88
+ }
89
89
  failed = true;
90
90
  console.warn("Unexpected color:", colorStr);
91
91
  return color;
@@ -1,5 +1,6 @@
1
1
  import { Color } from '@iconify/utils/lib/colors/types';
2
2
  import { SVG } from '../svg/index.js';
3
+ import 'cheerio';
3
4
  import '@iconify/types';
4
5
  import '@iconify/utils/lib/customisations/defaults';
5
6
 
@@ -49,16 +49,8 @@ function convertSVGToMask(svg, options = {}) {
49
49
  if (!color || isEmptyColor(color)) {
50
50
  return colorStr;
51
51
  }
52
- if (check(props.solid, colorStr, color)) {
53
- foundSolid = true;
54
- return "#fff";
55
- }
56
- if (check(props.transparent, colorStr, color)) {
57
- foundTransparent = true;
58
- return "#000";
59
- }
60
52
  if (props.custom) {
61
- let customValue = props.custom(colorStr, color);
53
+ let customValue = props.custom(colorStr.toLowerCase(), color);
62
54
  if (typeof customValue === "number") {
63
55
  const num = Math.max(
64
56
  Math.min(Math.round(customValue * 255), 255),
@@ -84,6 +76,14 @@ function convertSVGToMask(svg, options = {}) {
84
76
  return customValue;
85
77
  }
86
78
  }
79
+ if (check(props.solid, colorStr, color)) {
80
+ foundSolid = true;
81
+ return "#fff";
82
+ }
83
+ if (check(props.transparent, colorStr, color)) {
84
+ foundTransparent = true;
85
+ return "#000";
86
+ }
87
87
  failed = true;
88
88
  console.warn("Unexpected color:", colorStr);
89
89
  return color;
@@ -1,4 +1,5 @@
1
1
  import { SVG } from '../svg/index.js';
2
+ import 'cheerio';
2
3
  import '@iconify/types';
3
4
  import '@iconify/utils/lib/customisations/defaults';
4
5
 
@@ -1,4 +1,5 @@
1
1
  import { SVG } from '../svg/index.js';
2
+ import 'cheerio';
2
3
  import '@iconify/types';
3
4
  import '@iconify/utils/lib/customisations/defaults';
4
5
 
@@ -1,5 +1,6 @@
1
1
  import { PluginConfig } from 'svgo';
2
2
  import { SVG } from '../svg/index.js';
3
+ import 'cheerio';
3
4
  import '@iconify/types';
4
5
  import '@iconify/utils/lib/customisations/defaults';
5
6
 
@@ -1,4 +1,5 @@
1
1
  import { ExtendedTagElement } from './types.js';
2
+ import 'cheerio';
2
3
 
3
4
  /**
4
5
  * Get tag for error message
@@ -1,3 +1,5 @@
1
+ import * as cheerio from 'cheerio';
2
+
1
3
  /**
2
4
  * Options
3
5
  */
@@ -50,7 +52,7 @@ interface ExtendedTagElementRelations {
50
52
  /**
51
53
  * Extended tag
52
54
  */
53
- interface ExtendedTagElement extends cheerio.TagElement, ExtendedTagElementUses, ExtendedTagElementRelations {
55
+ interface ExtendedTagElement extends cheerio.Element, ExtendedTagElementUses, ExtendedTagElementRelations {
54
56
  _index: number;
55
57
  _id?: string;
56
58
  _belongsTo?: ElementWithID[];
@@ -1,5 +1,6 @@
1
1
  import { SVG } from './index.js';
2
2
  import { AnalyseSVGStructureOptions, AnalyseSVGStructureResult } from './analyse/types.js';
3
+ import 'cheerio';
3
4
  import '@iconify/types';
4
5
  import '@iconify/utils/lib/customisations/defaults';
5
6
 
@@ -1,4 +1,5 @@
1
1
  import { SVG } from '../index.js';
2
+ import 'cheerio';
2
3
  import '@iconify/types';
3
4
  import '@iconify/utils/lib/customisations/defaults';
4
5
 
@@ -1,4 +1,5 @@
1
1
  import { SVG } from '../index.js';
2
+ import 'cheerio';
2
3
  import '@iconify/types';
3
4
  import '@iconify/utils/lib/customisations/defaults';
4
5
 
@@ -1,4 +1,5 @@
1
1
  import { SVG } from '../index.js';
2
+ import 'cheerio';
2
3
  import '@iconify/types';
3
4
  import '@iconify/utils/lib/customisations/defaults';
4
5
 
@@ -1,4 +1,5 @@
1
1
  import { SVG } from '../index.js';
2
+ import 'cheerio';
2
3
  import '@iconify/types';
3
4
  import '@iconify/utils/lib/customisations/defaults';
4
5
 
@@ -4,7 +4,7 @@ const svg_data_attributes = require('../data/attributes.cjs');
4
4
  const svg_data_tags = require('../data/tags.cjs');
5
5
 
6
6
  function cleanupSVGRoot(svg) {
7
- const cheerio = svg.$svg;
7
+ const cheerio2 = svg.$svg;
8
8
  const $root = svg.$svg(":root");
9
9
  const root = $root.get(0);
10
10
  const tagName = "svg";
@@ -61,12 +61,12 @@ function cleanupSVGRoot(svg) {
61
61
  $root.removeAttr(attr);
62
62
  });
63
63
  if (Object.keys(moveToChildren).length) {
64
- const $wrapper = cheerio("<g />");
64
+ const $wrapper = cheerio2("<g />");
65
65
  for (const key in moveToChildren) {
66
66
  $wrapper.attr(key, moveToChildren[key]);
67
67
  }
68
68
  $root.children().each((_index, child) => {
69
- const $child = cheerio(child);
69
+ const $child = cheerio2(child);
70
70
  if (child.type !== "tag") {
71
71
  $child.appendTo($wrapper);
72
72
  return;
@@ -1,4 +1,5 @@
1
1
  import { SVG } from '../index.js';
2
+ import 'cheerio';
2
3
  import '@iconify/types';
3
4
  import '@iconify/utils/lib/customisations/defaults';
4
5
 
@@ -2,7 +2,7 @@ import { commonAttributes, badAttributes, junkSVGAttributes, badSoftwareAttribut
2
2
  import { reusableElementsWithPalette, maskTags } from '../data/tags.mjs';
3
3
 
4
4
  function cleanupSVGRoot(svg) {
5
- const cheerio = svg.$svg;
5
+ const cheerio2 = svg.$svg;
6
6
  const $root = svg.$svg(":root");
7
7
  const root = $root.get(0);
8
8
  const tagName = "svg";
@@ -59,12 +59,12 @@ function cleanupSVGRoot(svg) {
59
59
  $root.removeAttr(attr);
60
60
  });
61
61
  if (Object.keys(moveToChildren).length) {
62
- const $wrapper = cheerio("<g />");
62
+ const $wrapper = cheerio2("<g />");
63
63
  for (const key in moveToChildren) {
64
64
  $wrapper.attr(key, moveToChildren[key]);
65
65
  }
66
66
  $root.children().each((_index, child) => {
67
- const $child = cheerio(child);
67
+ const $child = cheerio2(child);
68
68
  if (child.type !== "tag") {
69
69
  $child.appendTo($wrapper);
70
70
  return;
@@ -1,4 +1,5 @@
1
1
  import { SVG } from '../index.js';
2
+ import 'cheerio';
2
3
  import '@iconify/types';
3
4
  import '@iconify/utils/lib/customisations/defaults';
4
5
 
@@ -1,5 +1,6 @@
1
1
  import { SVG } from './index.js';
2
2
  import { CheckBadTagsOptions } from './cleanup/bad-tags.js';
3
+ import 'cheerio';
3
4
  import '@iconify/types';
4
5
  import '@iconify/utils/lib/customisations/defaults';
5
6
 
package/lib/svg/index.cjs CHANGED
@@ -3,9 +3,19 @@
3
3
  const cheerio = require('cheerio');
4
4
  const utils = require('@iconify/utils');
5
5
 
6
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
6
+ function _interopNamespaceCompat(e) {
7
+ if (e && typeof e === 'object' && 'default' in e) return e;
8
+ const n = Object.create(null);
9
+ if (e) {
10
+ for (const k in e) {
11
+ n[k] = e[k];
12
+ }
13
+ }
14
+ n.default = e;
15
+ return n;
16
+ }
7
17
 
8
- const cheerio__default = /*#__PURE__*/_interopDefaultCompat(cheerio);
18
+ const cheerio__namespace = /*#__PURE__*/_interopNamespaceCompat(cheerio);
9
19
 
10
20
  class SVG {
11
21
  /**
@@ -108,7 +118,7 @@ class SVG {
108
118
  );
109
119
  remove('xml:space="preserve"', "", "");
110
120
  content = content.replace(/<g>\s*<\/g>/g, "");
111
- this.$svg = cheerio__default.load(content.trim(), {
121
+ this.$svg = cheerio__namespace.load(content.trim(), {
112
122
  lowerCaseAttributeNames: false,
113
123
  xmlMode: true
114
124
  });
@@ -1,3 +1,4 @@
1
+ import * as cheerio from 'cheerio';
1
2
  import { IconifyIcon } from '@iconify/types';
2
3
  export { IconifyIcon } from '@iconify/types';
3
4
  import { IconifyIconCustomisations } from '@iconify/utils/lib/customisations/defaults';
@@ -14,7 +15,7 @@ interface ViewBox {
14
15
  * SVG class, used to manipulate icon content.
15
16
  */
16
17
  declare class SVG {
17
- $svg: cheerio.Root;
18
+ $svg: cheerio.CheerioAPI;
18
19
  viewBox: ViewBox;
19
20
  /**
20
21
  * Constructor
package/lib/svg/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import cheerio from 'cheerio';
1
+ import * as cheerio from 'cheerio';
2
2
  import { iconToSVG, trimSVG } from '@iconify/utils';
3
3
 
4
4
  class SVG {
@@ -1,6 +1,7 @@
1
1
  import { SVG } from './index.js';
2
2
  import { CSSRuleToken, CSSToken, CSSAtRuleToken } from '../css/parser/types.js';
3
3
  import { ParseSVGCallbackItem } from './parse.js';
4
+ import 'cheerio';
4
5
  import '@iconify/types';
5
6
  import '@iconify/utils/lib/customisations/defaults';
6
7
  import '../misc/cheerio.js';
package/lib/svg/parse.cjs CHANGED
@@ -5,7 +5,7 @@ function parse(svg, callback, done) {
5
5
  if (element.type !== "tag") {
6
6
  return done2();
7
7
  }
8
- const $element = cheerio(element);
8
+ const $element = cheerio2(element);
9
9
  const tagName = element.tagName;
10
10
  const item = {
11
11
  tagName,
@@ -37,7 +37,7 @@ function parse(svg, callback, done) {
37
37
  next();
38
38
  });
39
39
  }
40
- const cheerio = svg.$svg;
40
+ const cheerio2 = svg.$svg;
41
41
  const $root = svg.$svg(":root");
42
42
  checkNode($root.get(0), [], done);
43
43
  }
@@ -1,5 +1,6 @@
1
1
  import { CheerioElement, WrappedCheerioElement } from '../misc/cheerio.js';
2
2
  import { SVG } from './index.js';
3
+ import 'cheerio';
3
4
  import '@iconify/types';
4
5
  import '@iconify/utils/lib/customisations/defaults';
5
6
 
package/lib/svg/parse.mjs CHANGED
@@ -3,7 +3,7 @@ function parse(svg, callback, done) {
3
3
  if (element.type !== "tag") {
4
4
  return done2();
5
5
  }
6
- const $element = cheerio(element);
6
+ const $element = cheerio2(element);
7
7
  const tagName = element.tagName;
8
8
  const item = {
9
9
  tagName,
@@ -35,7 +35,7 @@ function parse(svg, callback, done) {
35
35
  next();
36
36
  });
37
37
  }
38
- const cheerio = svg.$svg;
38
+ const cheerio2 = svg.$svg;
39
39
  const $root = svg.$svg(":root");
40
40
  checkNode($root.get(0), [], done);
41
41
  }
package/package.json CHANGED
@@ -3,7 +3,10 @@
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.6",
6
+ "version": "4.0.0-dev.1",
7
+ "publishConfig": {
8
+ "tag": "next"
9
+ },
7
10
  "license": "MIT",
8
11
  "bugs": "https://github.com/iconify/tools/issues",
9
12
  "homepage": "https://github.com/iconify/tools",
@@ -16,23 +19,22 @@
16
19
  "types": "./lib/index.d.ts",
17
20
  "dependencies": {
18
21
  "@iconify/types": "^2.0.0",
19
- "@iconify/utils": "^2.1.10",
20
- "@types/cheerio": "^0.22.32",
21
- "@types/tar": "^6.1.6",
22
- "cheerio": "^1.0.0-rc.12",
22
+ "@iconify/utils": "^2.1.12",
23
+ "@types/tar": "^6.1.10",
24
+ "cheerio": "1.0.0-rc.12",
23
25
  "extract-zip": "^2.0.1",
24
26
  "local-pkg": "^0.4.3",
25
27
  "pathe": "^1.1.1",
26
- "svgo": "^3.0.2",
28
+ "svgo": "^3.0.4",
27
29
  "tar": "^6.2.0"
28
30
  },
29
31
  "devDependencies": {
30
- "@types/jest": "^29.5.5",
31
- "@types/node": "^18.18.0",
32
+ "@types/jest": "^29.5.10",
33
+ "@types/node": "^18.18.13",
32
34
  "@typescript-eslint/eslint-plugin": "^5.62.0",
33
35
  "@typescript-eslint/parser": "^5.62.0",
34
36
  "cross-env": "^7.0.3",
35
- "eslint": "^8.50.0",
37
+ "eslint": "^8.54.0",
36
38
  "eslint-config-prettier": "^8.10.0",
37
39
  "eslint-plugin-jasmine": "^4.1.3",
38
40
  "eslint-plugin-prettier": "^4.2.1",
@@ -41,7 +43,7 @@
41
43
  "prettier": "^2.8.8",
42
44
  "rimraf": "^5.0.5",
43
45
  "ts-jest": "^29.1.1",
44
- "typescript": "^5.2.2",
46
+ "typescript": "^5.3.2",
45
47
  "unbuild": "^1.2.1"
46
48
  },
47
49
  "exports": {