spooder 5.1.5 → 5.1.7
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.
- package/README.md +18 -0
- package/bun.lock +6 -6
- package/package.json +1 -1
- package/src/api.ts +36 -31
- package/src/cli.ts +2 -1
- package/src/config.ts +1 -0
package/README.md
CHANGED
|
@@ -37,6 +37,10 @@ Below is a full map of the available configuration options in their default stat
|
|
|
37
37
|
{
|
|
38
38
|
"spooder": {
|
|
39
39
|
|
|
40
|
+
// see CLI > Usage
|
|
41
|
+
"run": "bun run index.ts",
|
|
42
|
+
"run_dev": "",
|
|
43
|
+
|
|
40
44
|
// see CLI > Auto Restart
|
|
41
45
|
"auto_restart": true,
|
|
42
46
|
"auto_restart_max": 30000,
|
|
@@ -149,6 +153,7 @@ spooder --dev
|
|
|
149
153
|
|
|
150
154
|
The following differences will be observed when running in development mode:
|
|
151
155
|
|
|
156
|
+
- If `run_dev` is configured, it will be used instead of the default `run` command.
|
|
152
157
|
- Update commands defined in `spooder.update` will not be executed when starting a server.
|
|
153
158
|
- If the server crashes and `auto_restart` is enabled, the server will not be restarted, and spooder will exit with the same exit code as the server.
|
|
154
159
|
- If canary is configured, reports will not be dispatched to GitHub and instead be printed to the console; this includes crash reports.
|
|
@@ -161,6 +166,19 @@ if (process.env.SPOODER_ENV === 'dev') {
|
|
|
161
166
|
}
|
|
162
167
|
```
|
|
163
168
|
|
|
169
|
+
### Development Command Override
|
|
170
|
+
|
|
171
|
+
You can configure a different command to run when in development mode using the `run_dev` option:
|
|
172
|
+
|
|
173
|
+
```json
|
|
174
|
+
{
|
|
175
|
+
"spooder": {
|
|
176
|
+
"run": "bun run server.ts",
|
|
177
|
+
"run_dev": "bun run server.ts --inspect"
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
164
182
|
> [!NOTE]
|
|
165
183
|
> `SPOODER_ENV` should be either `dev` or `prod`. If the variable is not defined, the server was not started by the `spooder` CLI.
|
|
166
184
|
|
package/bun.lock
CHANGED
|
@@ -12,15 +12,15 @@
|
|
|
12
12
|
},
|
|
13
13
|
},
|
|
14
14
|
"packages": {
|
|
15
|
-
"@types/bun": ["@types/bun@1.2.
|
|
15
|
+
"@types/bun": ["@types/bun@1.2.20", "", { "dependencies": { "bun-types": "1.2.20" } }, "sha512-dX3RGzQ8+KgmMw7CsW4xT5ITBSCrSbfHc36SNT31EOUg/LA9JWq0VDdEXDRSe1InVWpd2yLUM1FUF/kEOyTzYA=="],
|
|
16
16
|
|
|
17
|
-
"@types/node": ["@types/node@24.
|
|
17
|
+
"@types/node": ["@types/node@24.3.0", "", { "dependencies": { "undici-types": "~7.10.0" } }, "sha512-aPTXCrfwnDLj4VvXrm+UUCQjNEvJgNA8s5F1cvwQU+3KNltTOkBm1j30uNLyqqPNe7gE3KFzImYoZEfLhp4Yow=="],
|
|
18
18
|
|
|
19
|
-
"@types/react": ["@types/react@19.1.
|
|
19
|
+
"@types/react": ["@types/react@19.1.10", "", { "dependencies": { "csstype": "^3.0.2" } }, "sha512-EhBeSYX0Y6ye8pNebpKrwFJq7BoQ8J5SO6NlvNwwHjSj6adXJViPQrKlsyPw7hLBLvckEMO1yxeGdR82YBBlDg=="],
|
|
20
20
|
|
|
21
21
|
"aws-ssl-profiles": ["aws-ssl-profiles@1.1.2", "", {}, "sha512-NZKeq9AfyQvEeNlN0zSYAaWrmBffJh3IELMZfRpJVWgrpEbtEpnjvzqBPf+mxoI287JohRDoa+/nsfqqiZmF6g=="],
|
|
22
22
|
|
|
23
|
-
"bun-types": ["bun-types@1.2.
|
|
23
|
+
"bun-types": ["bun-types@1.2.20", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-pxTnQYOrKvdOwyiyd/7sMt9yFOenN004Y6O4lCcCUoKVej48FS5cvTw9geRaEcB9TsDZaJKAxPTVvi8tFsVuXA=="],
|
|
24
24
|
|
|
25
25
|
"csstype": ["csstype@3.1.3", "", {}, "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="],
|
|
26
26
|
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
|
|
39
39
|
"lru.min": ["lru.min@1.1.2", "", {}, "sha512-Nv9KddBcQSlQopmBHXSsZVY5xsdlZkdH/Iey0BlcBYggMd4two7cZnKOK9vmy3nY0O5RGH99z1PCeTpPqszUYg=="],
|
|
40
40
|
|
|
41
|
-
"mysql2": ["mysql2@3.14.
|
|
41
|
+
"mysql2": ["mysql2@3.14.3", "", { "dependencies": { "aws-ssl-profiles": "^1.1.1", "denque": "^2.1.0", "generate-function": "^2.3.1", "iconv-lite": "^0.6.3", "long": "^5.2.1", "lru.min": "^1.0.0", "named-placeholders": "^1.1.3", "seq-queue": "^0.0.5", "sqlstring": "^2.3.2" } }, "sha512-fD6MLV8XJ1KiNFIF0bS7Msl8eZyhlTDCDl75ajU5SJtpdx9ZPEACulJcqJWr1Y8OYyxsFc4j3+nflpmhxCU5aQ=="],
|
|
42
42
|
|
|
43
43
|
"named-placeholders": ["named-placeholders@1.1.3", "", { "dependencies": { "lru-cache": "^7.14.1" } }, "sha512-eLoBxg6wE/rZkJPhU/xRX1WTpkFEwDJEN96oxFrTsqBdbT5ec295Q+CoHrL9IT0DipqKhmGcaZmwOt8OON5x1w=="],
|
|
44
44
|
|
|
@@ -48,6 +48,6 @@
|
|
|
48
48
|
|
|
49
49
|
"sqlstring": ["sqlstring@2.3.3", "", {}, "sha512-qC9iz2FlN7DQl3+wjwn3802RTyjCx7sDvfQEXchwa6CWOx07/WVfh91gBmQ9fahw8snwGEWU3xGzOt4tFyHLxg=="],
|
|
50
50
|
|
|
51
|
-
"undici-types": ["undici-types@7.
|
|
51
|
+
"undici-types": ["undici-types@7.10.0", "", {}, "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag=="],
|
|
52
52
|
}
|
|
53
53
|
}
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -431,41 +431,46 @@ export async function parse_template(template: string, replacements: Replacement
|
|
|
431
431
|
// Parse t-for tags first (outermost structures)
|
|
432
432
|
const for_regex = /<t-for\s+items="([^"]+)"\s+as="([^"]+)"\s*>(.*?)<\/t-for>/gs;
|
|
433
433
|
result = await replace_async(result, for_regex, async (match, entries_key, alias_name, loop_content) => {
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
if (loop_entries !== undefined && Array.isArray(loop_entries)) {
|
|
437
|
-
let loop_result = '';
|
|
438
|
-
for (const loop_entry of loop_entries) {
|
|
439
|
-
let scoped_replacements: Replacements;
|
|
440
|
-
|
|
441
|
-
if (typeof replacements === 'function') {
|
|
442
|
-
scoped_replacements = async (key: string) => {
|
|
443
|
-
if (key === alias_name)
|
|
444
|
-
return loop_entry;
|
|
445
|
-
|
|
446
|
-
if (key.startsWith(alias_name + '.')) {
|
|
447
|
-
const prop_path = key.substring(alias_name.length + 1);
|
|
448
|
-
return get_nested_property(loop_entry, prop_path);
|
|
449
|
-
}
|
|
434
|
+
let loop_entries = is_replacer_fn ? await replacements(entries_key) : replacements[entries_key];
|
|
450
435
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
436
|
+
if (loop_entries !== undefined) {
|
|
437
|
+
if (typeof loop_entries === 'function')
|
|
438
|
+
loop_entries = await loop_entries();
|
|
439
|
+
|
|
440
|
+
if (Array.isArray(loop_entries)) {
|
|
441
|
+
let loop_result = '';
|
|
442
|
+
for (const loop_entry of loop_entries) {
|
|
443
|
+
let scoped_replacements: Replacements;
|
|
444
|
+
|
|
445
|
+
if (typeof replacements === 'function') {
|
|
446
|
+
scoped_replacements = async (key: string) => {
|
|
447
|
+
if (key === alias_name)
|
|
448
|
+
return loop_entry;
|
|
449
|
+
|
|
450
|
+
if (key.startsWith(alias_name + '.')) {
|
|
451
|
+
const prop_path = key.substring(alias_name.length + 1);
|
|
452
|
+
return get_nested_property(loop_entry, prop_path);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
return await replacements(key);
|
|
456
|
+
};
|
|
457
|
+
} else {
|
|
458
|
+
scoped_replacements = {
|
|
459
|
+
...replacements,
|
|
460
|
+
[alias_name]: loop_entry
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
loop_result += await parse_template(loop_content, scoped_replacements, drop_missing);
|
|
458
465
|
}
|
|
459
|
-
|
|
460
|
-
loop_result += await parse_template(loop_content, scoped_replacements, drop_missing);
|
|
466
|
+
return loop_result;
|
|
461
467
|
}
|
|
462
|
-
return loop_result;
|
|
463
|
-
} else {
|
|
464
|
-
if (!drop_missing)
|
|
465
|
-
return match;
|
|
466
|
-
|
|
467
|
-
return '';
|
|
468
468
|
}
|
|
469
|
+
|
|
470
|
+
if (!drop_missing)
|
|
471
|
+
return match;
|
|
472
|
+
|
|
473
|
+
return '';
|
|
469
474
|
});
|
|
470
475
|
|
|
471
476
|
// Parse t-if tags
|
package/src/cli.ts
CHANGED
|
@@ -103,7 +103,8 @@ async function start_server() {
|
|
|
103
103
|
const include_crash_history = crash_console_history > 0;
|
|
104
104
|
|
|
105
105
|
const std_mode = include_crash_history ? 'pipe' : 'inherit';
|
|
106
|
-
const
|
|
106
|
+
const run_command = is_dev_mode && config.run_dev !== '' ? config.run_dev : config.run;
|
|
107
|
+
const proc = Bun.spawn(parse_command_line(run_command), {
|
|
107
108
|
cwd: process.cwd(),
|
|
108
109
|
env: { ...process.env, SPOODER_ENV: is_dev_mode ? 'dev' : 'prod' },
|
|
109
110
|
stdout: std_mode,
|