@evitcastudio/kit 3.1.0 → 3.1.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.
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  /*!
4
- * @evitcastudio/kit@3.1.0 git+https://github.com/EvitcaStudio/Kit.git
5
- * Compiled Tue, 23 Jun 2026 22:30:34 UTC
4
+ * @evitcastudio/kit@3.1.1 git+https://github.com/EvitcaStudio/Kit.git
5
+ * Compiled Fri, 26 Jun 2026 23:30:10 UTC
6
6
  * Copyright (c) 2026 Jared Bates, Evitca Studio, "doubleactii"
7
7
  *
8
8
  * @evitcastudio/kit is licensed under the MIT License.
@@ -8078,6 +8078,10 @@ async function processAllFiles() {
8078
8078
  await saveResourceJSON();
8079
8079
  const boundsData = await buildBoundsJSON();
8080
8080
  await saveBoundsJSON(boundsData);
8081
+ const pointsData = await buildIconPointsJSON();
8082
+ await saveIconPointsJSON(pointsData);
8083
+ const sizesData = await buildSizesJSON();
8084
+ await saveSizesJSON(sizesData);
8081
8085
  } catch (pError) {
8082
8086
  const errorMessage = pError instanceof Error ? pError.message : String(pError);
8083
8087
  logError(`[Error] Processing files in batch: ${errorMessage}`);
@@ -8130,11 +8134,114 @@ async function buildBoundsJSON() {
8130
8134
  async function saveBoundsJSON(pBoundsData) {
8131
8135
  const filePath = "bounds.json";
8132
8136
  try {
8133
- await fs.writeFile(filePath, JSON.stringify(pBoundsData, null, 4));
8137
+ await fs.writeFile(filePath, JSON.stringify(pBoundsData));
8134
8138
  } catch (pError) {
8135
8139
  logError(`[Error] Saving bounds JSON: ${pError}`);
8136
8140
  }
8137
8141
  }
8142
+ async function buildIconPointsJSON() {
8143
+ const pointsData = {};
8144
+ for (const { filePath, type } of resourcesToProcess) {
8145
+ if (type !== "icon")
8146
+ continue;
8147
+ try {
8148
+ const fileBuffer = await fs.readFile(filePath);
8149
+ const vyi = new VYI().parse(fileBuffer);
8150
+ const atlasName = basename(filePath, ".vyi");
8151
+ const atlasEntry = {};
8152
+ for (const icon of vyi.getIcons()) {
8153
+ const iconName = icon.getName();
8154
+ const iconPoints = icon.getIconPointsExport();
8155
+ const hasIconPoints = iconPoints && iconPoints.length > 0;
8156
+ const iconEntry = {};
8157
+ if (hasIconPoints) {
8158
+ const pointsMap = {};
8159
+ for (const pt of iconPoints) {
8160
+ pointsMap[pt.id] = {
8161
+ width: pt.width,
8162
+ height: pt.height,
8163
+ x: pt.x,
8164
+ y: pt.y
8165
+ };
8166
+ }
8167
+ iconEntry.points = pointsMap;
8168
+ }
8169
+ const statesEntry = {};
8170
+ for (const state of icon.getStates()) {
8171
+ const stateName = state.getName();
8172
+ const statePoints = state.getIconPointsExport();
8173
+ if (statePoints && statePoints.length > 0) {
8174
+ const statePointsMap = {};
8175
+ for (const pt of statePoints) {
8176
+ statePointsMap[pt.id] = {
8177
+ width: pt.width,
8178
+ height: pt.height,
8179
+ x: pt.x,
8180
+ y: pt.y
8181
+ };
8182
+ }
8183
+ statesEntry[stateName] = {
8184
+ points: statePointsMap
8185
+ };
8186
+ }
8187
+ }
8188
+ if (Object.keys(statesEntry).length > 0) {
8189
+ iconEntry.states = statesEntry;
8190
+ }
8191
+ if (Object.keys(iconEntry).length > 0) {
8192
+ atlasEntry[iconName] = iconEntry;
8193
+ }
8194
+ }
8195
+ if (Object.keys(atlasEntry).length > 0) {
8196
+ pointsData[atlasName] = atlasEntry;
8197
+ }
8198
+ } catch (pError) {
8199
+ logError(`[Error] Failed to parse icon points from ${filePath}: ${pError}`);
8200
+ }
8201
+ }
8202
+ return pointsData;
8203
+ }
8204
+ async function saveIconPointsJSON(pPointsData) {
8205
+ const filePath = "icon-points.json";
8206
+ try {
8207
+ await fs.writeFile(filePath, JSON.stringify(pPointsData));
8208
+ } catch (pError) {
8209
+ logError(`[Error] Saving icon points JSON: ${pError}`);
8210
+ }
8211
+ }
8212
+ async function buildSizesJSON() {
8213
+ const sizesData = {};
8214
+ for (const { filePath, type } of resourcesToProcess) {
8215
+ if (type !== "icon")
8216
+ continue;
8217
+ try {
8218
+ const fileBuffer = await fs.readFile(filePath);
8219
+ const vyi = new VYI().parse(fileBuffer);
8220
+ const atlasName = basename(filePath, ".vyi");
8221
+ const atlasEntry = {};
8222
+ for (const icon of vyi.getIcons()) {
8223
+ atlasEntry[icon.getName()] = {
8224
+ width: icon.getWidth(),
8225
+ height: icon.getHeight()
8226
+ };
8227
+ }
8228
+ if (Object.keys(atlasEntry).length > 0) {
8229
+ sizesData[atlasName] = atlasEntry;
8230
+ }
8231
+ } catch (pError) {
8232
+ logError(`[Error] Failed to parse sizes from ${filePath}: ${pError}`);
8233
+ }
8234
+ }
8235
+ return sizesData;
8236
+ }
8237
+ async function saveSizesJSON(pSizesData) {
8238
+ const filePath = "sizes.json";
8239
+ try {
8240
+ await fs.writeFile(filePath, JSON.stringify(pSizesData));
8241
+ } catch (pError) {
8242
+ logError(`[Error] Saving sizes JSON: ${pError}`);
8243
+ }
8244
+ }
8138
8245
  async function clearResourceTypeDirectories(pBaseDirectory) {
8139
8246
  try {
8140
8247
  const directoryExists = await fs.stat(pBaseDirectory).then((stat) => stat.isDirectory()).catch(() => false);
@@ -8179,6 +8286,8 @@ async function processResources({ inDirectory, outDirectory, verbose, ignoreSoun
8179
8286
  logAlert("No resources found!");
8180
8287
  await saveResourceJSON();
8181
8288
  await saveBoundsJSON({});
8289
+ await saveIconPointsJSON({});
8290
+ await saveSizesJSON({});
8182
8291
  }
8183
8292
  }
8184
8293
  function logVerbose(pMessage) {
@@ -9246,7 +9355,7 @@ import os2 from "node:os";
9246
9355
  // package.json
9247
9356
  var package_default = {
9248
9357
  name: "@evitcastudio/kit",
9249
- version: "3.1.0",
9358
+ version: "3.1.1",
9250
9359
  author: "doubleactii 56242467+doubleactii@users.noreply.github.com (https://evitcastudio.com)",
9251
9360
  main: "./lib/index.js",
9252
9361
  types: "./lib/index.d.ts",
@@ -1 +1 @@
1
- {"version":3,"file":"resource-builder.d.ts","sourceRoot":"","sources":["../../src/cli/resource-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAsP9C;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBzH"}
1
+ {"version":3,"file":"resource-builder.d.ts","sourceRoot":"","sources":["../../src/cli/resource-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AA8X9C;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CA2BzH"}
@@ -112,6 +112,10 @@ async function processAllFiles() {
112
112
  await saveResourceJSON();
113
113
  const boundsData = await buildBoundsJSON();
114
114
  await saveBoundsJSON(boundsData);
115
+ const pointsData = await buildIconPointsJSON();
116
+ await saveIconPointsJSON(pointsData);
117
+ const sizesData = await buildSizesJSON();
118
+ await saveSizesJSON(sizesData);
115
119
  }
116
120
  catch (pError) {
117
121
  const errorMessage = pError instanceof Error ? pError.message : String(pError);
@@ -172,12 +176,131 @@ async function buildBoundsJSON() {
172
176
  async function saveBoundsJSON(pBoundsData) {
173
177
  const filePath = 'bounds.json';
174
178
  try {
175
- await fs.writeFile(filePath, JSON.stringify(pBoundsData, null, 4));
179
+ await fs.writeFile(filePath, JSON.stringify(pBoundsData));
176
180
  }
177
181
  catch (pError) {
178
182
  logError(`[Error] Saving bounds JSON: ${pError}`);
179
183
  }
180
184
  }
185
+ /**
186
+ * Builds the icon points map from all processed vyi files.
187
+ */
188
+ async function buildIconPointsJSON() {
189
+ const pointsData = {};
190
+ for (const { filePath, type } of resourcesToProcess) {
191
+ if (type !== 'icon')
192
+ continue;
193
+ try {
194
+ const fileBuffer = await fs.readFile(filePath);
195
+ const vyi = new VYI().parse(fileBuffer);
196
+ const atlasName = basename(filePath, '.vyi');
197
+ const atlasEntry = {};
198
+ for (const icon of vyi.getIcons()) {
199
+ const iconName = icon.getName();
200
+ const iconPoints = icon.getIconPointsExport();
201
+ const hasIconPoints = iconPoints && iconPoints.length > 0;
202
+ const iconEntry = {};
203
+ if (hasIconPoints) {
204
+ const pointsMap = {};
205
+ for (const pt of iconPoints) {
206
+ pointsMap[pt.id] = {
207
+ width: pt.width,
208
+ height: pt.height,
209
+ x: pt.x,
210
+ y: pt.y
211
+ };
212
+ }
213
+ iconEntry.points = pointsMap;
214
+ }
215
+ const statesEntry = {};
216
+ for (const state of icon.getStates()) {
217
+ const stateName = state.getName();
218
+ const statePoints = state.getIconPointsExport();
219
+ if (statePoints && statePoints.length > 0) {
220
+ const statePointsMap = {};
221
+ for (const pt of statePoints) {
222
+ statePointsMap[pt.id] = {
223
+ width: pt.width,
224
+ height: pt.height,
225
+ x: pt.x,
226
+ y: pt.y
227
+ };
228
+ }
229
+ statesEntry[stateName] = {
230
+ points: statePointsMap
231
+ };
232
+ }
233
+ }
234
+ if (Object.keys(statesEntry).length > 0) {
235
+ iconEntry.states = statesEntry;
236
+ }
237
+ if (Object.keys(iconEntry).length > 0) {
238
+ atlasEntry[iconName] = iconEntry;
239
+ }
240
+ }
241
+ if (Object.keys(atlasEntry).length > 0) {
242
+ pointsData[atlasName] = atlasEntry;
243
+ }
244
+ }
245
+ catch (pError) {
246
+ logError(`[Error] Failed to parse icon points from ${filePath}: ${pError}`);
247
+ }
248
+ }
249
+ return pointsData;
250
+ }
251
+ /**
252
+ * Saves the icon points JSON to a file.
253
+ */
254
+ async function saveIconPointsJSON(pPointsData) {
255
+ const filePath = 'icon-points.json';
256
+ try {
257
+ await fs.writeFile(filePath, JSON.stringify(pPointsData));
258
+ }
259
+ catch (pError) {
260
+ logError(`[Error] Saving icon points JSON: ${pError}`);
261
+ }
262
+ }
263
+ /**
264
+ * Builds the sizes map from all processed vyi files.
265
+ */
266
+ async function buildSizesJSON() {
267
+ const sizesData = {};
268
+ for (const { filePath, type } of resourcesToProcess) {
269
+ if (type !== 'icon')
270
+ continue;
271
+ try {
272
+ const fileBuffer = await fs.readFile(filePath);
273
+ const vyi = new VYI().parse(fileBuffer);
274
+ const atlasName = basename(filePath, '.vyi');
275
+ const atlasEntry = {};
276
+ for (const icon of vyi.getIcons()) {
277
+ atlasEntry[icon.getName()] = {
278
+ width: icon.getWidth(),
279
+ height: icon.getHeight()
280
+ };
281
+ }
282
+ if (Object.keys(atlasEntry).length > 0) {
283
+ sizesData[atlasName] = atlasEntry;
284
+ }
285
+ }
286
+ catch (pError) {
287
+ logError(`[Error] Failed to parse sizes from ${filePath}: ${pError}`);
288
+ }
289
+ }
290
+ return sizesData;
291
+ }
292
+ /**
293
+ * Saves the sizes JSON to a file.
294
+ */
295
+ async function saveSizesJSON(pSizesData) {
296
+ const filePath = 'sizes.json';
297
+ try {
298
+ await fs.writeFile(filePath, JSON.stringify(pSizesData));
299
+ }
300
+ catch (pError) {
301
+ logError(`[Error] Saving sizes JSON: ${pError}`);
302
+ }
303
+ }
181
304
  /**
182
305
  * Clears specified directories within a base directory.
183
306
  * @param pBaseDirectory - The path to the base directory.
@@ -242,6 +365,8 @@ export async function processResources({ inDirectory, outDirectory, verbose, ign
242
365
  logAlert('No resources found!');
243
366
  await saveResourceJSON();
244
367
  await saveBoundsJSON({});
368
+ await saveIconPointsJSON({});
369
+ await saveSizesJSON({});
245
370
  }
246
371
  }
247
372
  function logVerbose(pMessage) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evitcastudio/kit",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "author": "doubleactii 56242467+doubleactii@users.noreply.github.com (https://evitcastudio.com)",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",