@iconify/tools 3.0.1 → 3.0.3

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 (92) hide show
  1. package/README.md +1 -1
  2. package/lib/export/json-package.cjs +1 -0
  3. package/lib/export/json-package.mjs +1 -0
  4. package/lib/import/directory.cjs +26 -18
  5. package/lib/import/directory.mjs +26 -18
  6. package/lib/misc/keyword.cjs +1 -1
  7. package/lib/misc/keyword.mjs +1 -1
  8. package/license.txt +1 -1
  9. package/package.json +17 -17
  10. package/lib/colors/attribs.d.ts +0 -27
  11. package/lib/colors/detect.d.ts +0 -15
  12. package/lib/colors/parse.d.ts +0 -67
  13. package/lib/colors/validate.d.ts +0 -26
  14. package/lib/css/parse.d.ts +0 -6
  15. package/lib/css/parser/error.d.ts +0 -13
  16. package/lib/css/parser/export.d.ts +0 -8
  17. package/lib/css/parser/strings.d.ts +0 -16
  18. package/lib/css/parser/text.d.ts +0 -20
  19. package/lib/css/parser/tokens.d.ts +0 -9
  20. package/lib/css/parser/tree.d.ts +0 -8
  21. package/lib/css/parser/types.d.ts +0 -52
  22. package/lib/download/api/cache.d.ts +0 -20
  23. package/lib/download/api/download.d.ts +0 -8
  24. package/lib/download/api/index.d.ts +0 -8
  25. package/lib/download/api/types.d.ts +0 -17
  26. package/lib/download/git/branch.d.ts +0 -8
  27. package/lib/download/git/hash.d.ts +0 -8
  28. package/lib/download/git/index.d.ts +0 -29
  29. package/lib/download/git/reset.d.ts +0 -6
  30. package/lib/download/github/hash.d.ts +0 -8
  31. package/lib/download/github/index.d.ts +0 -31
  32. package/lib/download/github/types.d.ts +0 -11
  33. package/lib/download/gitlab/hash.d.ts +0 -8
  34. package/lib/download/gitlab/index.d.ts +0 -31
  35. package/lib/download/gitlab/types.d.ts +0 -15
  36. package/lib/download/helpers/untar.d.ts +0 -6
  37. package/lib/download/helpers/unzip.d.ts +0 -6
  38. package/lib/download/index.d.ts +0 -48
  39. package/lib/download/npm/index.d.ts +0 -30
  40. package/lib/download/npm/types.d.ts +0 -9
  41. package/lib/download/npm/version.d.ts +0 -16
  42. package/lib/download/types/modified.d.ts +0 -6
  43. package/lib/download/types/sources.d.ts +0 -12
  44. package/lib/export/directory.d.ts +0 -25
  45. package/lib/export/helpers/custom-files.d.ts +0 -12
  46. package/lib/export/helpers/prepare.d.ts +0 -19
  47. package/lib/export/helpers/types-version.d.ts +0 -6
  48. package/lib/export/icon-package.d.ts +0 -25
  49. package/lib/export/json-package.d.ts +0 -23
  50. package/lib/icon-set/index.d.ts +0 -161
  51. package/lib/icon-set/match.d.ts +0 -14
  52. package/lib/icon-set/merge.d.ts +0 -13
  53. package/lib/icon-set/modified.d.ts +0 -15
  54. package/lib/icon-set/props.d.ts +0 -13
  55. package/lib/icon-set/tags.d.ts +0 -22
  56. package/lib/icon-set/types.d.ts +0 -75
  57. package/lib/import/directory.d.ts +0 -51
  58. package/lib/import/figma/index.d.ts +0 -19
  59. package/lib/import/figma/nodes.d.ts +0 -17
  60. package/lib/import/figma/query.d.ts +0 -28
  61. package/lib/import/figma/types/api.d.ts +0 -53
  62. package/lib/import/figma/types/nodes.d.ts +0 -43
  63. package/lib/import/figma/types/options.d.ts +0 -58
  64. package/lib/import/figma/types/result.d.ts +0 -43
  65. package/lib/index.d.ts +0 -72
  66. package/lib/misc/bump-version.d.ts +0 -6
  67. package/lib/misc/cheerio.d.ts +0 -7
  68. package/lib/misc/compare-dirs.d.ts +0 -11
  69. package/lib/misc/exec.d.ts +0 -12
  70. package/lib/misc/keyword.d.ts +0 -6
  71. package/lib/misc/scan.d.ts +0 -33
  72. package/lib/misc/write-json.d.ts +0 -6
  73. package/lib/optimise/flags.d.ts +0 -10
  74. package/lib/optimise/global-style.d.ts +0 -10
  75. package/lib/optimise/origin.d.ts +0 -10
  76. package/lib/optimise/scale.d.ts +0 -10
  77. package/lib/optimise/svgo.d.ts +0 -36
  78. package/lib/svg/analyse/error.d.ts +0 -8
  79. package/lib/svg/analyse/types.d.ts +0 -89
  80. package/lib/svg/analyse.d.ts +0 -13
  81. package/lib/svg/cleanup/attribs.d.ts +0 -10
  82. package/lib/svg/cleanup/bad-tags.d.ts +0 -16
  83. package/lib/svg/cleanup/inline-style.d.ts +0 -10
  84. package/lib/svg/cleanup/root-style.d.ts +0 -16
  85. package/lib/svg/cleanup/root-svg.d.ts +0 -10
  86. package/lib/svg/cleanup/svgo-style.d.ts +0 -10
  87. package/lib/svg/cleanup.d.ts +0 -15
  88. package/lib/svg/data/attributes.d.ts +0 -77
  89. package/lib/svg/data/tags.d.ts +0 -95
  90. package/lib/svg/index.d.ts +0 -47
  91. package/lib/svg/parse-style.d.ts +0 -63
  92. package/lib/svg/parse.d.ts +0 -36
package/README.md CHANGED
@@ -93,4 +93,4 @@ If you need to import or parse icons synchronously, such as in config file of pa
93
93
 
94
94
  Library is released with MIT license.
95
95
 
96
- © 2021 Vjacheslav Trushkin
96
+ © 2021-PRESENT Vjacheslav Trushkin
@@ -58,6 +58,7 @@ async function exportJSONPackage(iconSet, options) {
58
58
  const packageJSONExports = {
59
59
  "./*": "./*",
60
60
  ".": {
61
+ types: "./index.d.ts",
61
62
  require: "./index.js",
62
63
  import: "./index.mjs"
63
64
  }
@@ -56,6 +56,7 @@ async function exportJSONPackage(iconSet, options) {
56
56
  const packageJSONExports = {
57
57
  "./*": "./*",
58
58
  ".": {
59
+ types: "./index.d.ts",
59
60
  require: "./index.js",
60
61
  import: "./index.mjs"
61
62
  }
@@ -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
  }
package/license.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 Vjacheslav Trushkin
3
+ Copyright (c) 2021-PRESENT Vjacheslav Trushkin
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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.1",
6
+ "version": "3.0.3",
7
7
  "license": "MIT",
8
8
  "bugs": "https://github.com/iconify/tools/issues",
9
9
  "homepage": "https://github.com/iconify/tools",
@@ -16,32 +16,32 @@
16
16
  "types": "./lib/index.d.ts",
17
17
  "dependencies": {
18
18
  "@iconify/types": "^2.0.0",
19
- "@iconify/utils": "^2.1.5",
19
+ "@iconify/utils": "^2.1.7",
20
20
  "@types/cheerio": "^0.22.31",
21
- "@types/tar": "^6.1.4",
21
+ "@types/tar": "^6.1.5",
22
22
  "cheerio": "^1.0.0-rc.12",
23
23
  "extract-zip": "^2.0.1",
24
24
  "local-pkg": "^0.4.3",
25
- "pathe": "^1.1.0",
25
+ "pathe": "^1.1.1",
26
26
  "svgo": "^3.0.2",
27
- "tar": "^6.1.13"
27
+ "tar": "^6.1.15"
28
28
  },
29
29
  "devDependencies": {
30
- "@types/jest": "^29.5.0",
31
- "@types/node": "^18.15.11",
32
- "@typescript-eslint/eslint-plugin": "^5.58.0",
33
- "@typescript-eslint/parser": "^5.58.0",
30
+ "@types/jest": "^29.5.3",
31
+ "@types/node": "^18.17.3",
32
+ "@typescript-eslint/eslint-plugin": "^5.62.0",
33
+ "@typescript-eslint/parser": "^5.62.0",
34
34
  "cross-env": "^7.0.3",
35
- "eslint": "^8.38.0",
36
- "eslint-config-prettier": "^8.8.0",
35
+ "eslint": "^8.46.0",
36
+ "eslint-config-prettier": "^8.10.0",
37
37
  "eslint-plugin-jasmine": "^4.1.3",
38
38
  "eslint-plugin-prettier": "^4.2.1",
39
- "jasmine": "^4.6.0",
40
- "jest": "^29.5.0",
41
- "prettier": "^2.8.7",
42
- "rimraf": "^5.0.0",
43
- "ts-jest": "^29.1.0",
44
- "typescript": "^5.0.4",
39
+ "jasmine": "^5.1.0",
40
+ "jest": "^29.6.2",
41
+ "prettier": "^2.8.8",
42
+ "rimraf": "^5.0.1",
43
+ "ts-jest": "^29.1.1",
44
+ "typescript": "^5.1.6",
45
45
  "unbuild": "^1.2.1"
46
46
  },
47
47
  "exports": {
@@ -1,27 +0,0 @@
1
- import { Color } from '@iconify/utils/lib/colors/types';
2
-
3
- /**
4
- * Color attributes
5
- */
6
- type CommonColorAttributes = 'color';
7
- declare const commonColorAttributes: CommonColorAttributes[];
8
- type ShapeColorAttributes = 'fill' | 'stroke';
9
- declare const shapeColorAttributes: ShapeColorAttributes[];
10
- type SpecialColorAttributes = 'stop-color' | 'flood-color';
11
- declare const specialColorAttributes: SpecialColorAttributes[];
12
- type ColorAttributes = CommonColorAttributes | ShapeColorAttributes | SpecialColorAttributes;
13
- /**
14
- * Default values
15
- */
16
- declare const defaultBlackColor: Color;
17
- declare const defaultColorValues: Record<ColorAttributes, Color>;
18
- /**
19
- * Ignore default color for some tags:
20
- * - If value is true, allow default color
21
- * - If value is attribute name, allow default color if attribute is set
22
- *
23
- * Parent elements are not checked for these tags!
24
- */
25
- declare const allowDefaultColorValue: Partial<Record<ColorAttributes, string | true>>;
26
-
27
- export { ColorAttributes, CommonColorAttributes, ShapeColorAttributes, SpecialColorAttributes, allowDefaultColorValue, commonColorAttributes, defaultBlackColor, defaultColorValues, shapeColorAttributes, specialColorAttributes };
@@ -1,15 +0,0 @@
1
- import { IconSet } from '../icon-set/index.js';
2
- import '@iconify/types';
3
- import '@iconify/utils/lib/customisations/defaults';
4
- import '../icon-set/types.js';
5
- import '../svg/index.js';
6
- import '@iconify/utils/lib/icon-set/tree';
7
-
8
- /**
9
- * Detect palette
10
- *
11
- * Returns null if icon set has mixed colors
12
- */
13
- declare function detectIconSetPalette(iconSet: IconSet): boolean | null;
14
-
15
- export { detectIconSetPalette };
@@ -1,67 +0,0 @@
1
- import { Color } from '@iconify/utils/lib/colors/types';
2
- import { SVG } from '../svg/index.js';
3
- import { ColorAttributes } from './attribs.js';
4
- import { ElementsTreeItem, AnalyseSVGStructureResult, ExtendedTagElement, AnalyseSVGStructureOptions } from '../svg/analyse/types.js';
5
- import '@iconify/types';
6
- import '@iconify/utils/lib/customisations/defaults';
7
-
8
- /**
9
- * Result
10
- */
11
- interface FindColorsResult {
12
- colors: (Color | string)[];
13
- hasUnsetColor: boolean;
14
- hasGlobalStyle: boolean;
15
- }
16
- /**
17
- * Callback to call for each found color
18
- *
19
- * Callback should return:
20
- * - new color value to change color
21
- * - first parameter to keep old value
22
- * - 'unset' to delete old value
23
- * - 'remove' to remove shape or rule
24
- */
25
- type ParseColorsCallbackResult = Color | string | 'remove' | 'unset';
26
- type ParseColorsCallback<T> = (attr: ColorAttributes, colorString: string, parsedColor: Color | null, tagName?: string, item?: ExtendedTagElementWithColors) => T;
27
- /**
28
- * Callback for default color
29
- */
30
- type ParseColorOptionsDefaultColorCallback = (prop: string, item: ExtendedTagElementWithColors, treeItem: ElementsTreeItem, iconData: AnalyseSVGStructureResult) => Color;
31
- /**
32
- * Options
33
- */
34
- interface Options<T> extends AnalyseSVGStructureOptions {
35
- callback?: T;
36
- defaultColor?: Color | string | ParseColorOptionsDefaultColorCallback;
37
- }
38
- type ParseColorsOptions = Options<ParseColorsCallback<ParseColorsCallbackResult | Promise<ParseColorsCallbackResult>>>;
39
- type ParseColorsSyncOptions = Options<ParseColorsCallback<ParseColorsCallbackResult>>;
40
- /**
41
- * Extend properties for element
42
- */
43
- type ItemColors = Partial<Record<ColorAttributes, Color | string>>;
44
- interface ExtendedTagElementWithColors extends ExtendedTagElement {
45
- _colors?: ItemColors;
46
- _removed?: boolean;
47
- }
48
- /**
49
- * Find colors in icon
50
- *
51
- * Clean up icon before running this function to convert style to attributes using
52
- * cleanupInlineStyle() or cleanupSVG(), otherwise results might be inaccurate
53
- */
54
- declare function parseColors(svg: SVG, options?: ParseColorsOptions): Promise<FindColorsResult>;
55
- /**
56
- * Find colors in icon, synchronous version
57
- *
58
- * Clean up icon before running this function to convert style to attributes using
59
- * cleanupInlineStyle() or cleanupSVG(), otherwise results might be inaccurate
60
- */
61
- declare function parseColorsSync(svg: SVG, options?: ParseColorsSyncOptions): FindColorsResult;
62
- /**
63
- * Check if color is empty, such as 'none' or 'transparent'
64
- */
65
- declare function isEmptyColor(color: Color): boolean;
66
-
67
- export { ExtendedTagElementWithColors, FindColorsResult, ParseColorOptionsDefaultColorCallback, ParseColorsOptions, ParseColorsSyncOptions, isEmptyColor, parseColors, parseColorsSync };
@@ -1,26 +0,0 @@
1
- import { SVG } from '../svg/index.js';
2
- import { ParseColorsOptions, FindColorsResult, ParseColorsSyncOptions } from './parse.js';
3
- import '@iconify/types';
4
- import '@iconify/utils/lib/customisations/defaults';
5
- import '@iconify/utils/lib/colors/types';
6
- import './attribs.js';
7
- import '../svg/analyse/types.js';
8
-
9
- /**
10
- * Validate colors in icon
11
- *
12
- * If icon is monotone,
13
- *
14
- * Throws exception on error
15
- */
16
- declare function validateColors(svg: SVG, expectMonotone: boolean, options?: ParseColorsOptions): Promise<FindColorsResult>;
17
- /**
18
- * Validate colors in icon, synchronous version
19
- *
20
- * If icon is monotone,
21
- *
22
- * Throws exception on error
23
- */
24
- declare function validateColorsSync(svg: SVG, expectMonotone: boolean, options?: ParseColorsSyncOptions): FindColorsResult;
25
-
26
- export { validateColors, validateColorsSync };
@@ -1,6 +0,0 @@
1
- /**
2
- * Parse inline style
3
- */
4
- declare function parseInlineStyle(style: string): Record<string, string> | null;
5
-
6
- export { parseInlineStyle };
@@ -1,13 +0,0 @@
1
- interface StyleParseError {
2
- type: 'style-parse-error';
3
- message: string;
4
- code: string;
5
- index?: number;
6
- fullMessage: string;
7
- }
8
- /**
9
- * Create error message
10
- */
11
- declare function styleParseError(message: string, code: string, index?: number): StyleParseError;
12
-
13
- export { StyleParseError, styleParseError };
@@ -1,8 +0,0 @@
1
- import { CSSTreeToken } from './types.js';
2
-
3
- /**
4
- * Convert tokens tree to string
5
- */
6
- declare function tokensToString(tree: CSSTreeToken[]): string;
7
-
8
- export { tokensToString };
@@ -1,16 +0,0 @@
1
- import { StyleParseError } from './error.js';
2
-
3
- /**
4
- * Find end of quoted string
5
- *
6
- * Returns index of character after quote
7
- */
8
- declare function findEndOfQuotedString(code: string, quote: string, start: number): number | null;
9
- /**
10
- * Find end of url
11
- *
12
- * Returns index of character after end of URL
13
- */
14
- declare function findEndOfURL(code: string, start: number): number | StyleParseError;
15
-
16
- export { findEndOfQuotedString, findEndOfURL };
@@ -1,20 +0,0 @@
1
- import { TextToken, CSSRuleToken, CSSTokenWithSelector } from './types.js';
2
-
3
- /**
4
- * Merge text tokens to string
5
- */
6
- declare function mergeTextTokens(tokens: TextToken[]): string;
7
- /**
8
- * Get list of selectors from list of words
9
- */
10
- declare function getSelectors(tokens: TextToken[]): string[];
11
- /**
12
- * Convert text token to rule
13
- */
14
- declare function textTokensToRule(tokens: TextToken[]): CSSRuleToken | null;
15
- /**
16
- * Create at-rule or selector token from text tokens
17
- */
18
- declare function textTokensToSelector(tokens: TextToken[]): CSSTokenWithSelector | null;
19
-
20
- export { getSelectors, mergeTextTokens, textTokensToRule, textTokensToSelector };
@@ -1,9 +0,0 @@
1
- import { StyleParseError } from './error.js';
2
- import { CSSToken } from './types.js';
3
-
4
- /**
5
- * Get tokens
6
- */
7
- declare function getTokens(css: string): CSSToken[] | StyleParseError;
8
-
9
- export { getTokens };
@@ -1,8 +0,0 @@
1
- import { CSSToken, CSSTreeToken } from './types.js';
2
-
3
- /**
4
- * Convert tokens list to tree
5
- */
6
- declare function tokensTree(tokens: CSSToken[]): CSSTreeToken[];
7
-
8
- export { tokensTree };
@@ -1,52 +0,0 @@
1
- /**
2
- * Text tokens, to be split combined into correct tokens later
3
- */
4
- interface TextToken {
5
- type: 'chunk' | 'url' | 'quoted-string';
6
- index: number;
7
- text: string;
8
- }
9
- /**
10
- * Values
11
- */
12
- type CSSATValue = string | string[];
13
- /**
14
- * Tokens
15
- */
16
- interface CSSRuleToken {
17
- type: 'rule';
18
- index: number;
19
- prop: string;
20
- value: string;
21
- important?: boolean;
22
- }
23
- interface CSSSelectorToken {
24
- type: 'selector';
25
- index: number;
26
- code: string;
27
- selectors: string[];
28
- }
29
- interface CSSAtRuleToken {
30
- type: 'at-rule';
31
- index: number;
32
- rule: string;
33
- value: string;
34
- }
35
- interface CSSCloseToken {
36
- type: 'close';
37
- index: number;
38
- }
39
- type CSSTokenWithSelector = CSSSelectorToken | CSSAtRuleToken;
40
- type CSSToken = CSSRuleToken | CSSSelectorToken | CSSAtRuleToken | CSSCloseToken;
41
- /**
42
- * Tree tokens
43
- */
44
- interface CSSSelectorTreeToken extends CSSSelectorToken {
45
- children: CSSTreeToken[];
46
- }
47
- interface CSSAtRuleTreeToken extends CSSAtRuleToken {
48
- children: CSSTreeToken[];
49
- }
50
- type CSSTreeToken = CSSRuleToken | CSSSelectorTreeToken | CSSAtRuleTreeToken;
51
-
52
- export { CSSATValue, CSSAtRuleToken, CSSAtRuleTreeToken, CSSCloseToken, CSSRuleToken, CSSSelectorToken, CSSSelectorTreeToken, CSSToken, CSSTokenWithSelector, CSSTreeToken, TextToken };
@@ -1,20 +0,0 @@
1
- import { APIQueryParams, APICacheOptions } from './types.js';
2
-
3
- /**
4
- * Unique key
5
- */
6
- declare function apiCacheKey(query: APIQueryParams): string;
7
- /**
8
- * Store cache
9
- */
10
- declare function storeAPICache(options: APICacheOptions, key: string, data: string): Promise<void>;
11
- /**
12
- * Get item from cache
13
- */
14
- declare function getAPICache(dir: string, key: string): Promise<string | null>;
15
- /**
16
- * Clear cache
17
- */
18
- declare function clearAPICache(dir: string): Promise<void>;
19
-
20
- export { apiCacheKey, clearAPICache, getAPICache, storeAPICache };
@@ -1,8 +0,0 @@
1
- import { APIQueryParams } from './types.js';
2
-
3
- /**
4
- * Download file
5
- */
6
- declare function downloadFile(query: APIQueryParams, target: string): Promise<void>;
7
-
8
- export { downloadFile };
@@ -1,8 +0,0 @@
1
- import { APIQueryParams, APICacheOptions } from './types.js';
2
-
3
- /**
4
- * Send API query
5
- */
6
- declare function sendAPIQuery(query: APIQueryParams, cache?: APICacheOptions): Promise<number | string>;
7
-
8
- export { sendAPIQuery };
@@ -1,17 +0,0 @@
1
- /**
2
- * API Cache
3
- */
4
- interface APICacheOptions {
5
- dir: string;
6
- ttl: number;
7
- }
8
- /**
9
- * Params
10
- */
11
- interface APIQueryParams {
12
- uri: string;
13
- params?: URLSearchParams;
14
- headers?: Record<string, string>;
15
- }
16
-
17
- export { APICacheOptions, APIQueryParams };
@@ -1,8 +0,0 @@
1
- import { ExportTargetOptions } from '../../export/helpers/prepare.js';
2
-
3
- /**
4
- * Get current branch from cloned git repo
5
- */
6
- declare function getGitRepoBranch(options: ExportTargetOptions, checkout?: string): Promise<string>;
7
-
8
- export { getGitRepoBranch };
@@ -1,8 +0,0 @@
1
- import { ExportTargetOptions } from '../../export/helpers/prepare.js';
2
-
3
- /**
4
- * Get latest hash from cloned git repo
5
- */
6
- declare function getGitRepoHash(options: ExportTargetOptions): Promise<string>;
7
-
8
- export { getGitRepoHash };
@@ -1,29 +0,0 @@
1
- import { ExportTargetOptions } from '../../export/helpers/prepare.js';
2
- import { DocumentNotModified } from '../types/modified.js';
3
- import { DownloadSourceMixin } from '../types/sources.js';
4
-
5
- interface IfModifiedSinceOption {
6
- ifModifiedSince: string | true | DownloadGitRepoResult;
7
- }
8
- /**
9
- * Options for downloadGitRepo()
10
- */
11
- interface DownloadGitRepoOptions extends ExportTargetOptions, Partial<IfModifiedSinceOption> {
12
- remote: string;
13
- branch: string;
14
- log?: boolean;
15
- }
16
- /**
17
- * Result
18
- */
19
- interface DownloadGitRepoResult extends DownloadSourceMixin<'git'> {
20
- contentsDir: string;
21
- hash: string;
22
- }
23
- /**
24
- * Download Git repo
25
- */
26
- declare function downloadGitRepo<T extends IfModifiedSinceOption & DownloadGitRepoOptions>(options: T): Promise<DownloadGitRepoResult | DocumentNotModified>;
27
- declare function downloadGitRepo(options: DownloadGitRepoOptions): Promise<DownloadGitRepoResult>;
28
-
29
- export { DownloadGitRepoOptions, DownloadGitRepoResult, downloadGitRepo };
@@ -1,6 +0,0 @@
1
- /**
2
- * Reset Git repo contents
3
- */
4
- declare function resetGitRepoContents(target: string): Promise<void>;
5
-
6
- export { resetGitRepoContents };
@@ -1,8 +0,0 @@
1
- import { GitHubAPIOptions } from './types.js';
2
-
3
- /**
4
- * Get latest hash from GitHub using API
5
- */
6
- declare function getGitHubRepoHash(options: GitHubAPIOptions): Promise<string>;
7
-
8
- export { getGitHubRepoHash };