@evitcastudio/kit 3.0.0 → 3.1.0

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,180 +1,180 @@
1
- dist/
2
- lib/
3
- **/resource.json
4
- tests/temp/
5
-
6
- # Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
7
-
8
- # Logs
9
-
10
- logs
11
- _.log
12
- npm-debug.log_
13
- yarn-debug.log*
14
- yarn-error.log*
15
- lerna-debug.log*
16
- .pnpm-debug.log*
17
-
18
- # Caches
19
-
20
- .cache
21
-
22
- # Diagnostic reports (https://nodejs.org/api/report.html)
23
-
24
- report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
25
-
26
- # Runtime data
27
-
28
- pids
29
- _.pid
30
- _.seed
31
- *.pid.lock
32
-
33
- # Directory for instrumented libs generated by jscoverage/JSCover
34
-
35
- lib-cov
36
-
37
- # Coverage directory used by tools like istanbul
38
-
39
- coverage
40
- *.lcov
41
-
42
- # nyc test coverage
43
-
44
- .nyc_output
45
-
46
- # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
47
-
48
- .grunt
49
-
50
- # Bower dependency directory (https://bower.io/)
51
-
52
- bower_components
53
-
54
- # node-waf configuration
55
-
56
- .lock-wscript
57
-
58
- # Compiled binary addons (https://nodejs.org/api/addons.html)
59
-
60
- build/Release
61
-
62
- # Dependency directories
63
-
64
- node_modules/
65
- jspm_packages/
66
-
67
- # Snowpack dependency directory (https://snowpack.dev/)
68
-
69
- web_modules/
70
-
71
- # TypeScript cache
72
-
73
- *.tsbuildinfo
74
-
75
- # Optional npm cache directory
76
-
77
- .npm
78
-
79
- # Optional eslint cache
80
-
81
- .eslintcache
82
-
83
- # Optional stylelint cache
84
-
85
- .stylelintcache
86
-
87
- # Microbundle cache
88
-
89
- .rpt2_cache/
90
- .rts2_cache_cjs/
91
- .rts2_cache_es/
92
- .rts2_cache_umd/
93
-
94
- # Optional REPL history
95
-
96
- .node_repl_history
97
-
98
- # Output of 'npm pack'
99
-
100
- *.tgz
101
-
102
- # Yarn Integrity file
103
-
104
- .yarn-integrity
105
-
106
- # dotenv environment variable files
107
-
108
- .env
109
- .env.development.local
110
- .env.test.local
111
- .env.production.local
112
- .env.local
113
-
114
- # parcel-bundler cache (https://parceljs.org/)
115
-
116
- .parcel-cache
117
-
118
- # Next.js build output
119
-
120
- .next
121
- out
122
-
123
- # Nuxt.js build / generate output
124
-
125
- .nuxt
126
- dist
127
-
128
- # Gatsby files
129
-
130
- # Comment in the public line in if your project uses Gatsby and not Next.js
131
-
132
- # https://nextjs.org/blog/next-9-1#public-directory-support
133
-
134
- # public
135
-
136
- # vuepress build output
137
-
138
- .vuepress/dist
139
-
140
- # vuepress v2.x temp and cache directory
141
-
142
- .temp
143
-
144
- # Docusaurus cache and generated files
145
-
146
- .docusaurus
147
-
148
- # Serverless directories
149
-
150
- .serverless/
151
-
152
- # FuseBox cache
153
-
154
- .fusebox/
155
-
156
- # DynamoDB Local files
157
-
158
- .dynamodb/
159
-
160
- # TernJS port file
161
-
162
- .tern-port
163
-
164
- # Stores VSCode versions used for testing VSCode extensions
165
-
166
- .vscode-test
167
-
168
- # yarn v2
169
-
170
- .yarn/cache
171
- .yarn/unplugged
172
- .yarn/build-state.yml
173
- .yarn/install-state.gz
174
- .pnp.*
175
-
176
- # IntelliJ based IDEs
177
- .idea
178
-
179
- # Finder (MacOS) folder config
180
- .DS_Store
1
+ dist/
2
+ lib/
3
+ **/resource.json
4
+ tests/temp/
5
+
6
+ # Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
7
+
8
+ # Logs
9
+
10
+ logs
11
+ _.log
12
+ npm-debug.log_
13
+ yarn-debug.log*
14
+ yarn-error.log*
15
+ lerna-debug.log*
16
+ .pnpm-debug.log*
17
+
18
+ # Caches
19
+
20
+ .cache
21
+
22
+ # Diagnostic reports (https://nodejs.org/api/report.html)
23
+
24
+ report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
25
+
26
+ # Runtime data
27
+
28
+ pids
29
+ _.pid
30
+ _.seed
31
+ *.pid.lock
32
+
33
+ # Directory for instrumented libs generated by jscoverage/JSCover
34
+
35
+ lib-cov
36
+
37
+ # Coverage directory used by tools like istanbul
38
+
39
+ coverage
40
+ *.lcov
41
+
42
+ # nyc test coverage
43
+
44
+ .nyc_output
45
+
46
+ # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
47
+
48
+ .grunt
49
+
50
+ # Bower dependency directory (https://bower.io/)
51
+
52
+ bower_components
53
+
54
+ # node-waf configuration
55
+
56
+ .lock-wscript
57
+
58
+ # Compiled binary addons (https://nodejs.org/api/addons.html)
59
+
60
+ build/Release
61
+
62
+ # Dependency directories
63
+
64
+ node_modules/
65
+ jspm_packages/
66
+
67
+ # Snowpack dependency directory (https://snowpack.dev/)
68
+
69
+ web_modules/
70
+
71
+ # TypeScript cache
72
+
73
+ *.tsbuildinfo
74
+
75
+ # Optional npm cache directory
76
+
77
+ .npm
78
+
79
+ # Optional eslint cache
80
+
81
+ .eslintcache
82
+
83
+ # Optional stylelint cache
84
+
85
+ .stylelintcache
86
+
87
+ # Microbundle cache
88
+
89
+ .rpt2_cache/
90
+ .rts2_cache_cjs/
91
+ .rts2_cache_es/
92
+ .rts2_cache_umd/
93
+
94
+ # Optional REPL history
95
+
96
+ .node_repl_history
97
+
98
+ # Output of 'npm pack'
99
+
100
+ *.tgz
101
+
102
+ # Yarn Integrity file
103
+
104
+ .yarn-integrity
105
+
106
+ # dotenv environment variable files
107
+
108
+ .env
109
+ .env.development.local
110
+ .env.test.local
111
+ .env.production.local
112
+ .env.local
113
+
114
+ # parcel-bundler cache (https://parceljs.org/)
115
+
116
+ .parcel-cache
117
+
118
+ # Next.js build output
119
+
120
+ .next
121
+ out
122
+
123
+ # Nuxt.js build / generate output
124
+
125
+ .nuxt
126
+ dist
127
+
128
+ # Gatsby files
129
+
130
+ # Comment in the public line in if your project uses Gatsby and not Next.js
131
+
132
+ # https://nextjs.org/blog/next-9-1#public-directory-support
133
+
134
+ # public
135
+
136
+ # vuepress build output
137
+
138
+ .vuepress/dist
139
+
140
+ # vuepress v2.x temp and cache directory
141
+
142
+ .temp
143
+
144
+ # Docusaurus cache and generated files
145
+
146
+ .docusaurus
147
+
148
+ # Serverless directories
149
+
150
+ .serverless/
151
+
152
+ # FuseBox cache
153
+
154
+ .fusebox/
155
+
156
+ # DynamoDB Local files
157
+
158
+ .dynamodb/
159
+
160
+ # TernJS port file
161
+
162
+ .tern-port
163
+
164
+ # Stores VSCode versions used for testing VSCode extensions
165
+
166
+ .vscode-test
167
+
168
+ # yarn v2
169
+
170
+ .yarn/cache
171
+ .yarn/unplugged
172
+ .yarn/build-state.yml
173
+ .yarn/install-state.gz
174
+ .pnp.*
175
+
176
+ # IntelliJ based IDEs
177
+ .idea
178
+
179
+ # Finder (MacOS) folder config
180
+ .DS_Store
@@ -1,28 +1,28 @@
1
- import { logMessage } from './bun-build.ts';
2
-
3
- const server = Bun.serve({
4
- port: 8090,
5
- fetch(req) {
6
- const path = new URL(req.url).pathname;
7
- // Default to index.html if the user hits the root URL
8
- const target = path === "/" ? "/index.html" : path;
9
-
10
- return new Response(Bun.file(`./dist${target}`));
11
- },
12
- });
13
-
14
- // signal interrupt event
15
- process.on('SIGINT', () => {
16
- logMessage('info', 'Shutting down server...');
17
- server.stop();
18
- process.exit(0);
19
- });
20
-
21
- // signal termination event
22
- process.on('SIGTERM', () => {
23
- logMessage('info', 'Shutting down server...');
24
- server.stop();
25
- process.exit(0);
26
- });
27
-
1
+ import { logMessage } from './bun-build.ts';
2
+
3
+ const server = Bun.serve({
4
+ port: 8090,
5
+ fetch(req) {
6
+ const path = new URL(req.url).pathname;
7
+ // Default to index.html if the user hits the root URL
8
+ const target = path === "/" ? "/index.html" : path;
9
+
10
+ return new Response(Bun.file(`./dist${target}`));
11
+ },
12
+ });
13
+
14
+ // signal interrupt event
15
+ process.on('SIGINT', () => {
16
+ logMessage('info', 'Shutting down server...');
17
+ server.stop();
18
+ process.exit(0);
19
+ });
20
+
21
+ // signal termination event
22
+ process.on('SIGTERM', () => {
23
+ logMessage('info', 'Shutting down server...');
24
+ server.stop();
25
+ process.exit(0);
26
+ });
27
+
28
28
  logMessage('info', `Ready to play at http://localhost:8090`);
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAyFD;;;GAGG;AACH,wBAAsB,WAAW,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA6JtE"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAyFD;;;GAGG;AACH,wBAAsB,WAAW,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA8JtE"}
package/lib/cli/init.js CHANGED
@@ -111,6 +111,7 @@ export async function processInit(pOptions) {
111
111
  note(`Please install Bun manually: ${chalk.cyan('https://bun.sh/')}`, 'Manual Installation Required');
112
112
  process.exit(1);
113
113
  }
114
+ sInstall.stop();
114
115
  }
115
116
  let projectName = pOptions.projectName;
116
117
  let gameType = 'single';
@@ -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;AA+K9C;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBzH"}
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"}
@@ -2,6 +2,7 @@ import { promises as fs } from 'fs';
2
2
  import { join, extname, basename } from 'path';
3
3
  import chalk from 'chalk';
4
4
  import { v4 as uuidv4 } from 'uuid';
5
+ import { VYI } from '../vendor/vyi';
5
6
  // Logging helpers
6
7
  const log = console.log;
7
8
  const info = chalk.hex('#ffa552');
@@ -109,12 +110,74 @@ async function processAllFiles() {
109
110
  await Promise.all(copyOperations);
110
111
  logVerbose(`[Kit CLI] All resources have been processed.`);
111
112
  await saveResourceJSON();
113
+ const boundsData = await buildBoundsJSON();
114
+ await saveBoundsJSON(boundsData);
112
115
  }
113
116
  catch (pError) {
114
117
  const errorMessage = pError instanceof Error ? pError.message : String(pError);
115
118
  logError(`[Error] Processing files in batch: ${errorMessage}`);
116
119
  }
117
120
  }
121
+ /**
122
+ * Builds the bounds map from all processed vyi files.
123
+ */
124
+ async function buildBoundsJSON() {
125
+ const boundsData = {};
126
+ for (const { filePath, type } of resourcesToProcess) {
127
+ if (type !== 'icon')
128
+ continue;
129
+ try {
130
+ const fileBuffer = await fs.readFile(filePath);
131
+ const vyi = new VYI().parse(fileBuffer);
132
+ const atlasName = basename(filePath, '.vyi');
133
+ const atlasEntry = {};
134
+ for (const icon of vyi.getIcons()) {
135
+ const iconName = icon.getName();
136
+ const iconBounds = icon.getBoundsExport();
137
+ const hasIconBounds = Object.keys(iconBounds).length > 0;
138
+ const iconEntry = {};
139
+ if (hasIconBounds) {
140
+ iconEntry.bounds = iconBounds;
141
+ }
142
+ const statesEntry = {};
143
+ for (const state of icon.getStates()) {
144
+ const stateName = state.getName();
145
+ const stateBounds = state.getBoundsExport();
146
+ if (Object.keys(stateBounds).length > 0) {
147
+ statesEntry[stateName] = {
148
+ bounds: stateBounds
149
+ };
150
+ }
151
+ }
152
+ if (Object.keys(statesEntry).length > 0) {
153
+ iconEntry.states = statesEntry;
154
+ }
155
+ if (Object.keys(iconEntry).length > 0) {
156
+ atlasEntry[iconName] = iconEntry;
157
+ }
158
+ }
159
+ if (Object.keys(atlasEntry).length > 0) {
160
+ boundsData[atlasName] = atlasEntry;
161
+ }
162
+ }
163
+ catch (pError) {
164
+ logError(`[Error] Failed to parse bounds from ${filePath}: ${pError}`);
165
+ }
166
+ }
167
+ return boundsData;
168
+ }
169
+ /**
170
+ * Saves the bounds JSON to a file.
171
+ */
172
+ async function saveBoundsJSON(pBoundsData) {
173
+ const filePath = 'bounds.json';
174
+ try {
175
+ await fs.writeFile(filePath, JSON.stringify(pBoundsData, null, 4));
176
+ }
177
+ catch (pError) {
178
+ logError(`[Error] Saving bounds JSON: ${pError}`);
179
+ }
180
+ }
118
181
  /**
119
182
  * Clears specified directories within a base directory.
120
183
  * @param pBaseDirectory - The path to the base directory.
@@ -164,6 +227,7 @@ export async function processResources({ inDirectory, outDirectory, verbose, ign
164
227
  isVerbose = verbose;
165
228
  ignoringSound = ignoreSound;
166
229
  resourceJSON = initializeResourceJSON();
230
+ resourcesToProcess.length = 0;
167
231
  // Validate inputs
168
232
  if (!resourceInDirectory || !resourceOutDirectory) {
169
233
  logError('[Error] Input and output directories must be specified');
@@ -177,6 +241,7 @@ export async function processResources({ inDirectory, outDirectory, verbose, ign
177
241
  else {
178
242
  logAlert('No resources found!');
179
243
  await saveResourceJSON();
244
+ await saveBoundsJSON({});
180
245
  }
181
246
  }
182
247
  function logVerbose(pMessage) {