vectify 2.1.0 → 2.1.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.
@@ -0,0 +1,155 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __typeError = (msg) => {
8
+ throw TypeError(msg);
9
+ };
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
12
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
13
+ }) : x)(function(x) {
14
+ if (typeof require !== "undefined") return require.apply(this, arguments);
15
+ throw Error('Dynamic require of "' + x + '" is not supported');
16
+ });
17
+ var __commonJS = (cb, mod) => function __require2() {
18
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") {
22
+ for (let key of __getOwnPropNames(from))
23
+ if (!__hasOwnProp.call(to, key) && key !== except)
24
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
+ }
26
+ return to;
27
+ };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ // If the importer is in node compatibility mode or this is not an ESM
30
+ // file that has been converted to a CommonJS file using a Babel-
31
+ // compatible transform (i.e. "__esModule" has not been set), then set
32
+ // "default" to the CommonJS "module.exports" for node compatibility.
33
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
+ mod
35
+ ));
36
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
37
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
38
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
39
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
40
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
41
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
42
+ var __privateWrapper = (obj, member, setter, getter) => ({
43
+ set _(value) {
44
+ __privateSet(obj, member, value, setter);
45
+ },
46
+ get _() {
47
+ return __privateGet(obj, member, getter);
48
+ }
49
+ });
50
+
51
+ // src/utils/helpers.ts
52
+ function toPascalCase(str) {
53
+ return str.replace(/[-_](.)/g, (_, char) => char.toUpperCase()).replace(/^(.)/, (char) => char.toUpperCase()).replace(/[^a-z0-9]/gi, "");
54
+ }
55
+ function toKebabCase(str) {
56
+ return str.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
57
+ }
58
+ function mergeClasses(...classes) {
59
+ return classes.filter(Boolean).join(" ");
60
+ }
61
+ function getComponentName(fileName, prefix = "", suffix = "", transform) {
62
+ const baseName = fileName.replace(/\.svg$/, "");
63
+ let componentName = toPascalCase(baseName);
64
+ if (transform) {
65
+ componentName = transform(componentName);
66
+ }
67
+ return `${prefix}${componentName}${suffix}`;
68
+ }
69
+ function formatAttributes(attrs) {
70
+ const entries = Object.entries(attrs);
71
+ if (entries.length === 0)
72
+ return "{}";
73
+ const formatted = entries.map(([key, value]) => {
74
+ if (typeof value === "number") {
75
+ return `${key}: ${value}`;
76
+ }
77
+ return `${key}: '${value}'`;
78
+ }).join(", ");
79
+ return `{ ${formatted} }`;
80
+ }
81
+ async function ensureDir(dirPath) {
82
+ const fs = await import("fs/promises");
83
+ try {
84
+ await fs.mkdir(dirPath, { recursive: true });
85
+ } catch (error) {
86
+ if (error.code !== "EEXIST") {
87
+ throw error;
88
+ }
89
+ }
90
+ }
91
+ async function fileExists(filePath) {
92
+ const fs = await import("fs/promises");
93
+ try {
94
+ await fs.access(filePath);
95
+ return true;
96
+ } catch {
97
+ return false;
98
+ }
99
+ }
100
+ async function readFile(filePath) {
101
+ const fs = await import("fs/promises");
102
+ return await fs.readFile(filePath, "utf-8");
103
+ }
104
+ async function writeFile(filePath, content) {
105
+ const fs = await import("fs/promises");
106
+ await fs.writeFile(filePath, content, "utf-8");
107
+ }
108
+ async function getSvgFiles(dirPath) {
109
+ const fs = await import("fs/promises");
110
+ const path = await import("path");
111
+ try {
112
+ const files = await fs.readdir(dirPath);
113
+ return files.filter((file) => file.endsWith(".svg")).map((file) => path.join(dirPath, file));
114
+ } catch {
115
+ return [];
116
+ }
117
+ }
118
+ async function findProjectRoot(startDir = process.cwd()) {
119
+ const path = await import("path");
120
+ let currentDir = startDir;
121
+ while (true) {
122
+ const packageJsonPath = path.join(currentDir, "package.json");
123
+ if (await fileExists(packageJsonPath)) {
124
+ return currentDir;
125
+ }
126
+ const parentDir = path.dirname(currentDir);
127
+ if (parentDir === currentDir) {
128
+ return startDir;
129
+ }
130
+ currentDir = parentDir;
131
+ }
132
+ }
133
+
134
+ export {
135
+ __require,
136
+ __commonJS,
137
+ __toESM,
138
+ __publicField,
139
+ __privateGet,
140
+ __privateAdd,
141
+ __privateSet,
142
+ __privateMethod,
143
+ __privateWrapper,
144
+ toPascalCase,
145
+ toKebabCase,
146
+ mergeClasses,
147
+ getComponentName,
148
+ formatAttributes,
149
+ ensureDir,
150
+ fileExists,
151
+ readFile,
152
+ writeFile,
153
+ getSvgFiles,
154
+ findProjectRoot
155
+ };