@spicemod/creator 0.0.32 → 0.0.33
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/dist/bin.mjs +26 -11
- package/dist/index.d.mts +4 -4
- package/package.json +3 -1
package/dist/bin.mjs
CHANGED
|
@@ -145,7 +145,7 @@ const injectCSSFilePath = dist("templates/injectCSS.js", import.meta.url);
|
|
|
145
145
|
//#endregion
|
|
146
146
|
//#region package.json
|
|
147
147
|
var name = "@spicemod/creator";
|
|
148
|
-
var version = "0.0.
|
|
148
|
+
var version = "0.0.33";
|
|
149
149
|
|
|
150
150
|
//#endregion
|
|
151
151
|
//#region src/utils/common.ts
|
|
@@ -343,7 +343,7 @@ const CUSTOM_APP_NAME_LOCALES = [
|
|
|
343
343
|
//#region src/config/schema.ts
|
|
344
344
|
const ServerConfigSchema = v.object({
|
|
345
345
|
port: v.optional(v.number()),
|
|
346
|
-
serveDir: v.string(),
|
|
346
|
+
serveDir: v.optional(v.string()),
|
|
347
347
|
hmrPath: v.optional(v.string())
|
|
348
348
|
});
|
|
349
349
|
const EntryFileSchema = v.string();
|
|
@@ -594,11 +594,22 @@ async function loadConfig(cb) {
|
|
|
594
594
|
defaults: CONFIG_DEFAULTS,
|
|
595
595
|
configFileRequired: true,
|
|
596
596
|
packageJson: true,
|
|
597
|
-
async onUpdate({ newConfig }) {
|
|
597
|
+
async onUpdate({ oldConfig, newConfig }) {
|
|
598
598
|
try {
|
|
599
|
-
|
|
600
|
-
|
|
599
|
+
logger$1.debug("Config update triggered", {
|
|
600
|
+
oldConfig,
|
|
601
|
+
newConfig
|
|
602
|
+
});
|
|
603
|
+
const resolved = await getResolvedConfig(newConfig.config, { exitOnError: false });
|
|
604
|
+
logger$1.debug("Resolved config", { resolved });
|
|
605
|
+
try {
|
|
606
|
+
await runCb(resolved, true);
|
|
607
|
+
} catch (error) {
|
|
608
|
+
logger$1.error(error);
|
|
609
|
+
}
|
|
610
|
+
} catch (err) {
|
|
601
611
|
logger$1.error(pc.red("Config validation failed, keeping previous configuration"));
|
|
612
|
+
if (err instanceof Error) logger$1.error(pc.dim(" └─ ") + err.message);
|
|
602
613
|
}
|
|
603
614
|
}
|
|
604
615
|
});
|
|
@@ -2093,14 +2104,16 @@ async function createHmrServer(config, logger = createLogger("hmrServer")) {
|
|
|
2093
2104
|
});
|
|
2094
2105
|
}),
|
|
2095
2106
|
stop: async () => new Promise((resolve, reject) => {
|
|
2096
|
-
if (!isRunning
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
if ("closeAllConnections" in httpServer) httpServer.closeAllConnections();
|
|
2107
|
+
if (!isRunning || !httpServer.listening) {
|
|
2108
|
+
isRunning = false;
|
|
2109
|
+
return resolve();
|
|
2110
|
+
}
|
|
2101
2111
|
httpServer.close((err) => {
|
|
2102
|
-
if (err) return reject(err);
|
|
2103
2112
|
isRunning = false;
|
|
2113
|
+
if (err) {
|
|
2114
|
+
if (err.code === "ERR_SERVER_NOT_RUNNING") return resolve();
|
|
2115
|
+
return reject(err);
|
|
2116
|
+
}
|
|
2104
2117
|
logger.debug(`${pc.yellow("! ")} ${pc.gray("HTTP server stopped")}`);
|
|
2105
2118
|
resolve();
|
|
2106
2119
|
});
|
|
@@ -2261,6 +2274,8 @@ async function dev$1(options) {
|
|
|
2261
2274
|
if (isNewUpdate) {
|
|
2262
2275
|
logger$2.clear();
|
|
2263
2276
|
logger$2.info(pc.green("Config updated, reloading..."));
|
|
2277
|
+
await server?.stop();
|
|
2278
|
+
server = void 0;
|
|
2264
2279
|
}
|
|
2265
2280
|
try {
|
|
2266
2281
|
server = await createHmrServer({
|
package/dist/index.d.mts
CHANGED
|
@@ -15,12 +15,12 @@ declare const FileOptionsSchema: v.IntersectSchema<[Omit<v.ObjectSchema<{
|
|
|
15
15
|
readonly esbuildOptions: v.GenericSchema<ESBuildOptions>;
|
|
16
16
|
readonly serverConfig: Omit<v.ObjectSchema<{
|
|
17
17
|
readonly port: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
18
|
-
readonly serveDir: v.StringSchema<undefined>;
|
|
18
|
+
readonly serveDir: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
19
19
|
readonly hmrPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
20
20
|
}, undefined>, "~types" | "~run" | "~standard" | "entries"> & {
|
|
21
21
|
readonly entries: {
|
|
22
22
|
readonly port: v.OptionalSchema<v.OptionalSchema<v.NumberSchema<undefined>, undefined>, undefined>;
|
|
23
|
-
readonly serveDir: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
23
|
+
readonly serveDir: v.OptionalSchema<v.OptionalSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
24
24
|
readonly hmrPath: v.OptionalSchema<v.OptionalSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
25
25
|
};
|
|
26
26
|
readonly "~standard": v.StandardProps<{
|
|
@@ -61,12 +61,12 @@ declare const FileOptionsSchema: v.IntersectSchema<[Omit<v.ObjectSchema<{
|
|
|
61
61
|
readonly esbuildOptions: v.OptionalSchema<v.GenericSchema<ESBuildOptions>, undefined>;
|
|
62
62
|
readonly serverConfig: v.OptionalSchema<Omit<v.ObjectSchema<{
|
|
63
63
|
readonly port: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
64
|
-
readonly serveDir: v.StringSchema<undefined>;
|
|
64
|
+
readonly serveDir: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
65
65
|
readonly hmrPath: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
66
66
|
}, undefined>, "~types" | "~run" | "~standard" | "entries"> & {
|
|
67
67
|
readonly entries: {
|
|
68
68
|
readonly port: v.OptionalSchema<v.OptionalSchema<v.NumberSchema<undefined>, undefined>, undefined>;
|
|
69
|
-
readonly serveDir: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
69
|
+
readonly serveDir: v.OptionalSchema<v.OptionalSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
70
70
|
readonly hmrPath: v.OptionalSchema<v.OptionalSchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
71
71
|
};
|
|
72
72
|
readonly "~standard": v.StandardProps<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spicemod/creator",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.33",
|
|
4
4
|
"description": "Easily make Spicetify extensions and themes",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"esbuild-plugin-sass": "^1.0.1",
|
|
59
59
|
"esbuild-sass-plugin": "^3.6.0",
|
|
60
60
|
"ini": "^6.0.0",
|
|
61
|
+
"lodash-es": "^4.17.23",
|
|
61
62
|
"nanostores": "^1.1.0",
|
|
62
63
|
"picocolors": "^1.1.1",
|
|
63
64
|
"postcss": "^8.5.6",
|
|
@@ -70,6 +71,7 @@
|
|
|
70
71
|
},
|
|
71
72
|
"devDependencies": {
|
|
72
73
|
"@types/ini": "^4.1.1",
|
|
74
|
+
"@types/lodash-es": "^4.17.12",
|
|
73
75
|
"@types/node": "^25.2.0",
|
|
74
76
|
"@types/postcss-import": "^14.0.3",
|
|
75
77
|
"@types/ws": "^8.18.1",
|