@cyberalien/svg-utils 1.0.4 → 1.0.5
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.
|
@@ -5,5 +5,5 @@ import { ComponentFactoryFileSystemOptions, GeneratedAssetPath } from "../../typ
|
|
|
5
5
|
* @param options Factory options
|
|
6
6
|
* @returns Asset path
|
|
7
7
|
*/
|
|
8
|
-
declare function getFactoryRelativeRootPath(options: Pick<ComponentFactoryFileSystemOptions, 'doubleDirsForComponents' | 'prefixDirsForComponents'
|
|
8
|
+
declare function getFactoryRelativeRootPath(options: Pick<ComponentFactoryFileSystemOptions, 'doubleDirsForComponents' | 'prefixDirsForComponents'>, pathPrefix?: string): GeneratedAssetPath;
|
|
9
9
|
export { getFactoryRelativeRootPath };
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* @param options Factory options
|
|
5
5
|
* @returns Asset path
|
|
6
6
|
*/
|
|
7
|
-
function getFactoryRelativeRootPath(options) {
|
|
7
|
+
function getFactoryRelativeRootPath(options, pathPrefix) {
|
|
8
8
|
const { prefixDirsForComponents } = options;
|
|
9
9
|
const prefixDir = prefixDirsForComponents ? typeof prefixDirsForComponents === "string" ? prefixDirsForComponents : "prefix" : "";
|
|
10
10
|
const parentCount = (prefixDir ? prefixDir.split("/").length : 0) + (options.doubleDirsForComponents ? 1 : 0);
|
|
11
11
|
return {
|
|
12
12
|
import: parentCount ? "../".repeat(parentCount - 1) + ".." : ".",
|
|
13
|
-
filename: ""
|
|
13
|
+
filename: pathPrefix ?? ""
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -11,8 +11,9 @@ function getGeneratedComponentTypesFilename(icon, content, options) {
|
|
|
11
11
|
length: 8
|
|
12
12
|
})}.d.ts`, options.rootPath);
|
|
13
13
|
const filename = getGeneratedComponentFilename(icon, ".d.ts", options);
|
|
14
|
+
const rootPath = options.rootPath.filename;
|
|
14
15
|
return {
|
|
15
|
-
filename
|
|
16
|
+
filename: `${rootPath ? rootPath + "/" : ""}${filename}`,
|
|
16
17
|
import: `./${filename.split("/").pop()}`
|
|
17
18
|
};
|
|
18
19
|
}
|
|
@@ -2,5 +2,5 @@ import { ComponentFactoryFileSystemOptions } from "../types/options.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Generate file system options
|
|
4
4
|
*/
|
|
5
|
-
declare function componentFactoryFileSystemOptions(base: Partial<ComponentFactoryFileSystemOptions
|
|
5
|
+
declare function componentFactoryFileSystemOptions(base: Partial<ComponentFactoryFileSystemOptions>, pathPrefix?: string): ComponentFactoryFileSystemOptions;
|
|
6
6
|
export { componentFactoryFileSystemOptions };
|
|
@@ -4,14 +4,14 @@ import { getFactoryRelativeRootPath } from "../helpers/filenames/path.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* Generate file system options
|
|
6
6
|
*/
|
|
7
|
-
function componentFactoryFileSystemOptions(base) {
|
|
7
|
+
function componentFactoryFileSystemOptions(base, pathPrefix) {
|
|
8
8
|
const doubleDirsForCSS = base.doubleDirsForCSS ?? true;
|
|
9
9
|
const prefixDirsForComponents = base.prefixDirsForComponents ?? false;
|
|
10
10
|
const doubleDirsForComponents = base.doubleDirsForComponents ?? true;
|
|
11
11
|
const rootPath = base.rootPath ?? getFactoryRelativeRootPath({
|
|
12
12
|
doubleDirsForComponents,
|
|
13
13
|
prefixDirsForComponents
|
|
14
|
-
});
|
|
14
|
+
}, pathPrefix);
|
|
15
15
|
return {
|
|
16
16
|
doubleDirsForCSS,
|
|
17
17
|
prefixDirsForComponents,
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "Common functions for working with SVG used by various packages.",
|
|
5
5
|
"author": "Vjacheslav Trushkin",
|
|
6
|
-
"version": "1.0.
|
|
6
|
+
"version": "1.0.5",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"bugs": "https://github.com/cyberalien/svg-utils/issues",
|
|
9
9
|
"homepage": "https://cyberalien.dev/",
|