vite-plugin-millennium-skin 1.1.0 → 1.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.
- package/dist/aliasModules.d.ts +8 -0
- package/dist/defaultMatch.d.ts +9 -0
- package/dist/defaultPatches.d.ts +6 -0
- package/dist/git.d.ts +1 -0
- package/dist/index.d.ts +74 -0
- package/dist/index.js +559 -0
- package/dist/versionConfig.d.ts +23 -0
- package/package.json +1 -1
- package/vite.config.ts +3 -1
- package/dist/assets/css/a.css +0 -1
- package/dist/assets/css/color.css +0 -1
- package/dist/assets/js/a.js +0 -1
- package/dist/skin.json +0 -22
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const Root: RegExp;
|
|
2
|
+
export declare const LibraryRoot: RegExp;
|
|
3
|
+
export declare const MenuView: RegExp;
|
|
4
|
+
export declare const MenuSteam: RegExp;
|
|
5
|
+
export declare const MenuFriends: RegExp;
|
|
6
|
+
export declare const MenuGames: RegExp;
|
|
7
|
+
export declare const MenuHelp: RegExp;
|
|
8
|
+
export declare const MenuNotifications: RegExp;
|
|
9
|
+
export declare const MenuAccount: RegExp;
|
package/dist/git.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function gitCommit(needCommitMessage?: boolean): Promise<void>;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Plugin, LogOptions } from 'vite';
|
|
2
|
+
import { versionConfig } from './versionConfig';
|
|
3
|
+
export * from './aliasModules';
|
|
4
|
+
export * from './defaultMatch';
|
|
5
|
+
export * from './versionConfig';
|
|
6
|
+
export * from './versionConfig';
|
|
7
|
+
export type SkinConfig = {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
author: string;
|
|
11
|
+
version?: versionConfig;
|
|
12
|
+
tags?: string[];
|
|
13
|
+
header_image: string;
|
|
14
|
+
splash_image: string;
|
|
15
|
+
github: {
|
|
16
|
+
owner: string;
|
|
17
|
+
repo_name: string;
|
|
18
|
+
};
|
|
19
|
+
discord_support?: {
|
|
20
|
+
inviteCodeExcludingLink?: string;
|
|
21
|
+
};
|
|
22
|
+
"Steam-WebKit"?: string;
|
|
23
|
+
UseDefaultPatches?: boolean;
|
|
24
|
+
RootColors?: string;
|
|
25
|
+
Patches?: Patch[];
|
|
26
|
+
srcJs: string;
|
|
27
|
+
srcCss: string;
|
|
28
|
+
};
|
|
29
|
+
export type SkinConfigResult = {
|
|
30
|
+
name: string;
|
|
31
|
+
description: string;
|
|
32
|
+
author: string;
|
|
33
|
+
version: string;
|
|
34
|
+
header_image: string;
|
|
35
|
+
splash_image: string;
|
|
36
|
+
github: {
|
|
37
|
+
owner: string;
|
|
38
|
+
repo_name: string;
|
|
39
|
+
};
|
|
40
|
+
RootColors?: string;
|
|
41
|
+
Patches: PatchResult[];
|
|
42
|
+
};
|
|
43
|
+
export type Patch = {
|
|
44
|
+
Match: string | RegExp;
|
|
45
|
+
TargetCss?: string;
|
|
46
|
+
TargetJs?: string;
|
|
47
|
+
};
|
|
48
|
+
export type PatchResult = {
|
|
49
|
+
MatchRegexString: string;
|
|
50
|
+
TargetCss?: string;
|
|
51
|
+
TargetJs?: string;
|
|
52
|
+
};
|
|
53
|
+
export type namedExports = namedExport[];
|
|
54
|
+
export type namedExport = {
|
|
55
|
+
exportLocal: string;
|
|
56
|
+
links: string[];
|
|
57
|
+
};
|
|
58
|
+
export type bump_tag = null | undefined | "major" | "minor" | "patch" | "rc" | "gamma" | "beta" | "preview" | "alpha" | "snapshot";
|
|
59
|
+
export type versionObject = {
|
|
60
|
+
major: number;
|
|
61
|
+
minor: number;
|
|
62
|
+
patch: number;
|
|
63
|
+
rc?: number;
|
|
64
|
+
gamma?: number;
|
|
65
|
+
beta?: number;
|
|
66
|
+
preview?: number;
|
|
67
|
+
alpha?: number;
|
|
68
|
+
snapshot?: number;
|
|
69
|
+
};
|
|
70
|
+
export default function millenniumSkin(): Plugin;
|
|
71
|
+
export declare function defineConfig(SkinConfig: SkinConfig): SkinConfig;
|
|
72
|
+
export declare function warn(msg: string, options?: LogOptions): void;
|
|
73
|
+
export declare function info(msg: string, options?: LogOptions): void;
|
|
74
|
+
export declare function error(msg: string, options?: LogOptions): void;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,559 @@
|
|
|
1
|
+
import l from "@babel/types";
|
|
2
|
+
import { parse as O } from "@babel/parser";
|
|
3
|
+
import B from "@babel/traverse";
|
|
4
|
+
import { generate as z } from "@babel/generator";
|
|
5
|
+
import w, { join as f } from "path/posix";
|
|
6
|
+
import { existsSync as D } from "fs";
|
|
7
|
+
import E from "fs/promises";
|
|
8
|
+
import { loadConfigFromFile as Z } from "vite";
|
|
9
|
+
import y from "chalk";
|
|
10
|
+
import G from "inquirer";
|
|
11
|
+
import L from "simple-git";
|
|
12
|
+
const U = [
|
|
13
|
+
{
|
|
14
|
+
Match: "https://.*.steampowered.com",
|
|
15
|
+
TargetCss: "webkit.css",
|
|
16
|
+
TargetJs: "webkit.js"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
Match: "https://steamcommunity.com",
|
|
20
|
+
TargetCss: "webkit.css",
|
|
21
|
+
TargetJs: "webkit.js"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
Match: "^Steam$",
|
|
25
|
+
TargetCss: "libraryroot.custom.css",
|
|
26
|
+
TargetJs: "libraryroot.custom.js"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
Match: "^OverlayBrowser_Browser$",
|
|
30
|
+
TargetCss: "libraryroot.custom.css",
|
|
31
|
+
TargetJs: "libraryroot.custom.js"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
Match: "^SP Overlay:",
|
|
35
|
+
TargetCss: "libraryroot.custom.css",
|
|
36
|
+
TargetJs: "libraryroot.custom.js"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
Match: "Supernav$",
|
|
40
|
+
TargetCss: "libraryroot.custom.css",
|
|
41
|
+
TargetJs: "libraryroot.custom.js"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
Match: "^notificationtoasts_",
|
|
45
|
+
TargetCss: "notifications.custom.css",
|
|
46
|
+
TargetJs: "notifications.custom.js"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
Match: "^SteamBrowser_Find$",
|
|
50
|
+
TargetCss: "libraryroot.custom.css",
|
|
51
|
+
TargetJs: "libraryroot.custom.js"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
Match: "^OverlayTab\\d+_Find$",
|
|
55
|
+
TargetCss: "libraryroot.custom.css",
|
|
56
|
+
TargetJs: "libraryroot.custom.js"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
Match: "^Steam Big Picture Mode$",
|
|
60
|
+
TargetCss: "bigpicture.custom.css",
|
|
61
|
+
TargetJs: "bigpicture.custom.js"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
Match: "^QuickAccess_",
|
|
65
|
+
TargetCss: "bigpicture.custom.css",
|
|
66
|
+
TargetJs: "bigpicture.custom.js"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
Match: "^MainMenu_",
|
|
70
|
+
TargetCss: "bigpicture.custom.css",
|
|
71
|
+
TargetJs: "bigpicture.custom.js"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
Match: ".friendsui-container",
|
|
75
|
+
TargetCss: "friends.custom.css",
|
|
76
|
+
TargetJs: "friends.custom.js"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
Match: "Menu$",
|
|
80
|
+
TargetCss: "libraryroot.custom.css",
|
|
81
|
+
TargetJs: "libraryroot.custom.js"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
Match: ".ModalDialogPopup",
|
|
85
|
+
TargetCss: "libraryroot.custom.css",
|
|
86
|
+
TargetJs: "libraryroot.custom.js"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
Match: ".FullModalOverlay",
|
|
90
|
+
TargetCss: "libraryroot.custom.css",
|
|
91
|
+
TargetJs: "libraryroot.custom.js"
|
|
92
|
+
}
|
|
93
|
+
], J = 0, V = 1, H = [
|
|
94
|
+
{
|
|
95
|
+
method: J,
|
|
96
|
+
module: /^react$/g,
|
|
97
|
+
links: ["window", "opener", "SP_REACT"]
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
method: J,
|
|
101
|
+
module: /^react-dom$/g,
|
|
102
|
+
links: ["window", "opener", "SP_REACTDOM"]
|
|
103
|
+
}
|
|
104
|
+
], W = {
|
|
105
|
+
type: "auto",
|
|
106
|
+
git: {
|
|
107
|
+
major: { autoCommit: !1 },
|
|
108
|
+
minor: { autoCommit: !1 },
|
|
109
|
+
patch: { autoCommit: !1 },
|
|
110
|
+
rc: { autoCommit: !0, needCommitMessage: !0 },
|
|
111
|
+
gamma: { autoCommit: !0, needCommitMessage: !0 },
|
|
112
|
+
beta: { autoCommit: !0, needCommitMessage: !0 },
|
|
113
|
+
preview: { autoCommit: !0, needCommitMessage: !1 },
|
|
114
|
+
alpha: { autoCommit: !0, needCommitMessage: !1 },
|
|
115
|
+
snapshot: { autoCommit: !0, needCommitMessage: !1 }
|
|
116
|
+
}
|
|
117
|
+
}, ge = {
|
|
118
|
+
type: "auto",
|
|
119
|
+
git: {
|
|
120
|
+
major: { autoCommit: !1 },
|
|
121
|
+
minor: { autoCommit: !1 },
|
|
122
|
+
patch: { autoCommit: !1 },
|
|
123
|
+
rc: { autoCommit: !1 },
|
|
124
|
+
gamma: { autoCommit: !1 },
|
|
125
|
+
beta: { autoCommit: !1 },
|
|
126
|
+
preview: { autoCommit: !1 },
|
|
127
|
+
alpha: { autoCommit: !1 },
|
|
128
|
+
snapshot: { autoCommit: !1 }
|
|
129
|
+
}
|
|
130
|
+
}, X = W, $ = L();
|
|
131
|
+
async function q(s = !1) {
|
|
132
|
+
if (s) {
|
|
133
|
+
const o = await G.prompt([
|
|
134
|
+
{
|
|
135
|
+
type: "select",
|
|
136
|
+
name: "type",
|
|
137
|
+
message: "选择提交类型:",
|
|
138
|
+
choices: [
|
|
139
|
+
"feat",
|
|
140
|
+
"fix",
|
|
141
|
+
"docs",
|
|
142
|
+
"style",
|
|
143
|
+
"refactor",
|
|
144
|
+
"test",
|
|
145
|
+
"chore"
|
|
146
|
+
],
|
|
147
|
+
default: "chore"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
type: "input",
|
|
151
|
+
name: "message",
|
|
152
|
+
message: "输入提交信息:"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
type: "confirm",
|
|
156
|
+
name: "confirm",
|
|
157
|
+
message: "确认提交?",
|
|
158
|
+
default: !0
|
|
159
|
+
}
|
|
160
|
+
]);
|
|
161
|
+
if (!o.confirm) {
|
|
162
|
+
k("❌ 已取消提交");
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
try {
|
|
166
|
+
await $.add("."), await $.commit(`${o.type}: ${o.message}`), k("✓ git提交成功");
|
|
167
|
+
} catch (t) {
|
|
168
|
+
F(`❌ git提交失败: ${t.message}`);
|
|
169
|
+
}
|
|
170
|
+
} else
|
|
171
|
+
try {
|
|
172
|
+
await $.add("."), await $.commit("chore: auto commit by MillenniumSkin"), k("✓ git提交成功");
|
|
173
|
+
} catch (o) {
|
|
174
|
+
F(`❌ git提交失败: ${o.message}`);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
const de = /^SharedJSContext$/, he = /^Steam$/, Ce = /^View Root Menu$/, be = /^Steam Root Menu$/, Me = /^Friends Root Menu$/, we = /^Games Root Menu$/, ye = /^Help Root Menu$/, Te = /^Notifications Menu$/, ve = /^Account Menu$/, K = B.default, Q = /(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<preRelease>(?:[a-zA-Z1-9][a-zA-Z\d]*|0\d*[a-zA-Z][a-zA-Z\d]*|0)(?:\.(?:[a-zA-Z1-9][a-zA-Z\d]*|0\d*[a-zA-Z][a-zA-Z\d]*|0))*))?(?:\+(?<metadata>(?:[a-zA-Z\d-]*)(?:\.(?:[a-zA-Z\d-]*))*))?/, Y = /(?:\.)?(?<tag>[a-zA-Z]+)\.(?<number>(?:[1-9]\d*|0\d*|0))/g;
|
|
178
|
+
let C;
|
|
179
|
+
function $e() {
|
|
180
|
+
const s = [], o = [];
|
|
181
|
+
let t, e, a, n;
|
|
182
|
+
const b = "virtual:millennium-skin", A = "\0" + b;
|
|
183
|
+
return {
|
|
184
|
+
name: "vite-plugin-millennium-skin",
|
|
185
|
+
enforce: "pre",
|
|
186
|
+
resolveId(c) {
|
|
187
|
+
if (c === b)
|
|
188
|
+
return A;
|
|
189
|
+
},
|
|
190
|
+
load(c) {
|
|
191
|
+
if (c === A)
|
|
192
|
+
return `export const version = ${n ? JSON.stringify(n) : "undefined"};`;
|
|
193
|
+
},
|
|
194
|
+
async config(c) {
|
|
195
|
+
if (t = (await Z(
|
|
196
|
+
{ command: "build", mode: "profuction" },
|
|
197
|
+
"skin.config.ts",
|
|
198
|
+
c.root
|
|
199
|
+
))?.config, t.Patches === void 0) {
|
|
200
|
+
if (!t.UseDefaultPatches)
|
|
201
|
+
throw new Error("haven't any patch in skin.config.ts");
|
|
202
|
+
t.Patches = U;
|
|
203
|
+
}
|
|
204
|
+
return t.Patches.forEach((i) => {
|
|
205
|
+
i.TargetJs && s.push(f(t.srcJs, i.TargetJs)), i.TargetCss && o.push(
|
|
206
|
+
I(f(t.srcCss, i.TargetCss))
|
|
207
|
+
);
|
|
208
|
+
}), t.RootColors !== void 0 && o.push(
|
|
209
|
+
I(
|
|
210
|
+
f(t.srcCss, t.RootColors)
|
|
211
|
+
)
|
|
212
|
+
), {
|
|
213
|
+
build: {
|
|
214
|
+
rollupOptions: {
|
|
215
|
+
input: [...s, ...o],
|
|
216
|
+
output: {
|
|
217
|
+
entryFileNames: "assets/js/[name].js",
|
|
218
|
+
assetFileNames: (i) => {
|
|
219
|
+
const m = i.names[0], r = w.parse(m);
|
|
220
|
+
return r.ext === ".css" ? `assets/css/${m}` : /\.(png|jpg|jpeg|gif|svg|webp|bmp|heic)/i.test(
|
|
221
|
+
r.ext
|
|
222
|
+
) ? `assets/images/${m}` : `assets/css/${m}`;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
assetsInlineLimit: 0,
|
|
227
|
+
cssCodeSplit: !0
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
},
|
|
231
|
+
async configResolved(c) {
|
|
232
|
+
a = c, C = c.logger;
|
|
233
|
+
const p = a.root, i = f(p, "package.json");
|
|
234
|
+
t.version === void 0 && (t.version = X);
|
|
235
|
+
try {
|
|
236
|
+
const m = JSON.parse(
|
|
237
|
+
await E.readFile(i, {
|
|
238
|
+
flag: "r",
|
|
239
|
+
encoding: "utf-8"
|
|
240
|
+
})
|
|
241
|
+
);
|
|
242
|
+
if (t.version.type === "auto") {
|
|
243
|
+
if (n = await _(
|
|
244
|
+
m.version,
|
|
245
|
+
process.env.RELEASE
|
|
246
|
+
), n) {
|
|
247
|
+
const r = n.newString;
|
|
248
|
+
m.version = r, await E.writeFile(
|
|
249
|
+
i,
|
|
250
|
+
JSON.stringify(m, null, 4)
|
|
251
|
+
), k(`${n.nativeString} -> ${r}`);
|
|
252
|
+
}
|
|
253
|
+
} else t.version.type === "package" && (n = await _(m.version));
|
|
254
|
+
} catch (m) {
|
|
255
|
+
R(`can't use package.json: ${m}`), n = await _("0.0.0");
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
generateBundle(c, p) {
|
|
259
|
+
if (t.Patches === void 0)
|
|
260
|
+
throw new Error("haven't any patch in building");
|
|
261
|
+
const i = a.root, m = structuredClone(
|
|
262
|
+
t.Patches
|
|
263
|
+
).map((r) => {
|
|
264
|
+
if (r.Match instanceof RegExp && (r.Match = r.Match.source), r.TargetJs) {
|
|
265
|
+
const g = w.parse(r.TargetJs);
|
|
266
|
+
r.TargetJs = f(
|
|
267
|
+
i,
|
|
268
|
+
t.srcJs,
|
|
269
|
+
g.dir,
|
|
270
|
+
g.name
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
if (r.TargetCss) {
|
|
274
|
+
const g = w.parse(r.TargetCss);
|
|
275
|
+
r.TargetCss = f(
|
|
276
|
+
i,
|
|
277
|
+
t.srcCss,
|
|
278
|
+
g.dir,
|
|
279
|
+
g.name
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
return {
|
|
283
|
+
MatchRegexString: r.Match,
|
|
284
|
+
TargetJs: r.TargetJs,
|
|
285
|
+
TargetCss: r.TargetCss
|
|
286
|
+
};
|
|
287
|
+
});
|
|
288
|
+
Object.entries(p).forEach(([, r]) => {
|
|
289
|
+
const { type: g } = r, M = r.fileName;
|
|
290
|
+
if (g === "chunk") {
|
|
291
|
+
if (!r.facadeModuleId) return;
|
|
292
|
+
const u = w.parse(r.facadeModuleId), h = f(
|
|
293
|
+
u.dir,
|
|
294
|
+
u.name
|
|
295
|
+
);
|
|
296
|
+
m.forEach((d) => {
|
|
297
|
+
h === d.TargetJs && (d.TargetJs = M);
|
|
298
|
+
});
|
|
299
|
+
} else {
|
|
300
|
+
const u = w.parse(
|
|
301
|
+
f(i, r.originalFileNames[0])
|
|
302
|
+
), h = f(
|
|
303
|
+
u.dir,
|
|
304
|
+
u.name
|
|
305
|
+
);
|
|
306
|
+
m.forEach((d) => {
|
|
307
|
+
h === d.TargetCss && (d.TargetCss = M);
|
|
308
|
+
}), t.RootColors && h === f(
|
|
309
|
+
a.root,
|
|
310
|
+
t.srcCss,
|
|
311
|
+
t.RootColors
|
|
312
|
+
) && (t.RootColors = M);
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
}), e = {
|
|
316
|
+
...t,
|
|
317
|
+
Patches: m,
|
|
318
|
+
version: n?.newString ?? "0.0.0"
|
|
319
|
+
};
|
|
320
|
+
},
|
|
321
|
+
async writeBundle() {
|
|
322
|
+
const c = a.root;
|
|
323
|
+
try {
|
|
324
|
+
await E.writeFile(
|
|
325
|
+
f(c, a.build.outDir, "skin.json"),
|
|
326
|
+
JSON.stringify(e, null, 4)
|
|
327
|
+
);
|
|
328
|
+
} catch (p) {
|
|
329
|
+
throw new Error(`can't write skin.json: ${p}`);
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
transform(c, p) {
|
|
333
|
+
if (!/.+\.(js|ts|tsx)$/g.test(p)) return;
|
|
334
|
+
const i = O(c, {
|
|
335
|
+
sourceType: "module",
|
|
336
|
+
plugins: ["typescript", "jsx"]
|
|
337
|
+
});
|
|
338
|
+
return K(i, {
|
|
339
|
+
Program(r) {
|
|
340
|
+
const g = r.node.body, M = {};
|
|
341
|
+
for (let u = g.length - 1; u >= 0; u--) {
|
|
342
|
+
let h = g[u];
|
|
343
|
+
if (!l.isImportDeclaration(h)) continue;
|
|
344
|
+
const d = h.source.value, T = [];
|
|
345
|
+
for (const v of H) {
|
|
346
|
+
if (!v.module.test(d)) continue;
|
|
347
|
+
const { method: N } = v;
|
|
348
|
+
for (const j of h.specifiers) {
|
|
349
|
+
const x = j.local.name;
|
|
350
|
+
let S;
|
|
351
|
+
switch (j.type === "ImportDefaultSpecifier" ? S = v.links : S = [
|
|
352
|
+
...v.links,
|
|
353
|
+
j.imported.name
|
|
354
|
+
], N) {
|
|
355
|
+
case V:
|
|
356
|
+
M[x] = v.links;
|
|
357
|
+
break;
|
|
358
|
+
case J:
|
|
359
|
+
T.push(
|
|
360
|
+
ee(
|
|
361
|
+
x,
|
|
362
|
+
S
|
|
363
|
+
)
|
|
364
|
+
);
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
T.length && g.splice(u, 1, ...T);
|
|
370
|
+
}
|
|
371
|
+
Object.entries(M).forEach(
|
|
372
|
+
([u, h]) => {
|
|
373
|
+
const d = r.scope.getBinding(u);
|
|
374
|
+
d !== void 0 && (d.referencePaths.forEach((T) => {
|
|
375
|
+
te(T, u, h);
|
|
376
|
+
}), d.scope.removeOwnBinding(u));
|
|
377
|
+
}
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
}), { code: z(i).code };
|
|
381
|
+
},
|
|
382
|
+
async closeBundle(c) {
|
|
383
|
+
if (c) {
|
|
384
|
+
console.error("打包失败:", c);
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
if (t.version?.git !== void 0) {
|
|
388
|
+
const p = process.env.RELEASE;
|
|
389
|
+
if (p && t.version.git[p]) {
|
|
390
|
+
const i = t.version.git[p];
|
|
391
|
+
i.autoCommit && await q(i.needCommitMessage);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
function ke(s) {
|
|
398
|
+
return s;
|
|
399
|
+
}
|
|
400
|
+
function ee(s, o) {
|
|
401
|
+
let t = l.identifier(o[0]);
|
|
402
|
+
for (let a = 1; a < o.length; a++)
|
|
403
|
+
t = l.memberExpression(t, l.identifier(o[a]));
|
|
404
|
+
const e = l.variableDeclarator(
|
|
405
|
+
l.identifier(s),
|
|
406
|
+
t
|
|
407
|
+
);
|
|
408
|
+
return l.variableDeclaration("const", [e]);
|
|
409
|
+
}
|
|
410
|
+
function I(s) {
|
|
411
|
+
if (w.parse(s).ext !== "") return s;
|
|
412
|
+
for (const t of ["scss", "sass", "css"]) {
|
|
413
|
+
const e = `${s}.${t}`;
|
|
414
|
+
if (D(f(process.cwd(), e)))
|
|
415
|
+
return e;
|
|
416
|
+
}
|
|
417
|
+
throw new Error(`can't find css module: ${s}`);
|
|
418
|
+
}
|
|
419
|
+
function te(s, o, t) {
|
|
420
|
+
const e = s.parent;
|
|
421
|
+
if (l.isMemberExpression(e) && e.object === s.node) {
|
|
422
|
+
const a = e.property;
|
|
423
|
+
if (l.isIdentifier(a)) {
|
|
424
|
+
const n = P(t);
|
|
425
|
+
if (!s.parentPath) return;
|
|
426
|
+
s.parentPath.replaceWith(
|
|
427
|
+
l.memberExpression(n, l.identifier(a.name))
|
|
428
|
+
);
|
|
429
|
+
}
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
if (s.isIdentifier()) {
|
|
433
|
+
const a = P(t);
|
|
434
|
+
s.replaceWith(
|
|
435
|
+
l.memberExpression(a, l.identifier(o))
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
function P(s) {
|
|
440
|
+
if (s.length === 0)
|
|
441
|
+
throw new Error("globalObj must not be empty");
|
|
442
|
+
let o = l.identifier(s[0]);
|
|
443
|
+
for (let t = 1; t < s.length; t++)
|
|
444
|
+
o = l.memberExpression(o, l.identifier(s[t]));
|
|
445
|
+
return o;
|
|
446
|
+
}
|
|
447
|
+
async function _(s, o = null) {
|
|
448
|
+
try {
|
|
449
|
+
const t = Q.exec(s);
|
|
450
|
+
if (!t?.groups) {
|
|
451
|
+
R(`can't understand version: ${s}`);
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
let e = {
|
|
455
|
+
major: parseInt(t.groups.major),
|
|
456
|
+
minor: parseInt(t.groups.minor),
|
|
457
|
+
patch: parseInt(t.groups.patch)
|
|
458
|
+
};
|
|
459
|
+
t.groups.preRelease && [
|
|
460
|
+
...t.groups.preRelease.matchAll(Y)
|
|
461
|
+
].forEach((b) => {
|
|
462
|
+
b.groups && (e[b.groups.tag] = parseInt(b.groups.number));
|
|
463
|
+
});
|
|
464
|
+
const a = { ...e };
|
|
465
|
+
switch (o) {
|
|
466
|
+
case null:
|
|
467
|
+
break;
|
|
468
|
+
case void 0:
|
|
469
|
+
break;
|
|
470
|
+
case "major":
|
|
471
|
+
e = {
|
|
472
|
+
major: e.major + 1,
|
|
473
|
+
minor: 0,
|
|
474
|
+
patch: 0
|
|
475
|
+
};
|
|
476
|
+
break;
|
|
477
|
+
case "minor":
|
|
478
|
+
e = {
|
|
479
|
+
major: e.major,
|
|
480
|
+
minor: e.minor + 1,
|
|
481
|
+
patch: 0
|
|
482
|
+
};
|
|
483
|
+
break;
|
|
484
|
+
case "patch":
|
|
485
|
+
e = {
|
|
486
|
+
major: e.major,
|
|
487
|
+
minor: e.minor,
|
|
488
|
+
patch: e.patch + 1
|
|
489
|
+
};
|
|
490
|
+
break;
|
|
491
|
+
case "rc":
|
|
492
|
+
e.rc = (e.rc ?? 0) + 1, delete e.gamma, delete e.beta, delete e.preview, delete e.alpha, delete e.snapshot;
|
|
493
|
+
break;
|
|
494
|
+
case "gamma":
|
|
495
|
+
e.gamma = (e.gamma ?? 0) + 1, delete e.beta, delete e.preview, delete e.alpha, delete e.snapshot;
|
|
496
|
+
break;
|
|
497
|
+
case "beta":
|
|
498
|
+
e.beta = (e.beta ?? 0) + 1, delete e.preview, delete e.alpha, delete e.snapshot;
|
|
499
|
+
break;
|
|
500
|
+
case "preview":
|
|
501
|
+
e.preview = (e.preview ?? 0) + 1, delete e.alpha, delete e.snapshot;
|
|
502
|
+
break;
|
|
503
|
+
case "alpha":
|
|
504
|
+
e.alpha = (e.alpha ?? 0) + 1, delete e.snapshot;
|
|
505
|
+
break;
|
|
506
|
+
case "snapshot":
|
|
507
|
+
e.snapshot = (e.snapshot ?? 0) + 1;
|
|
508
|
+
break;
|
|
509
|
+
}
|
|
510
|
+
return {
|
|
511
|
+
native: a,
|
|
512
|
+
new: e,
|
|
513
|
+
nativeString: s,
|
|
514
|
+
newString: se(e)
|
|
515
|
+
};
|
|
516
|
+
} catch (t) {
|
|
517
|
+
R(`can't bump version: ${t}`);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
function se(s) {
|
|
521
|
+
let o = `${s.major}.${s.minor}.${s.patch}`;
|
|
522
|
+
const t = ["rc", "gamma", "beta", "preview", "alpha", "snapshot"];
|
|
523
|
+
let e = !1;
|
|
524
|
+
for (const a of t) {
|
|
525
|
+
const n = s[a];
|
|
526
|
+
n != null && (e ? o += `.${a}.${n}` : (o += `-${a}.${n}`, e = !0));
|
|
527
|
+
}
|
|
528
|
+
return o;
|
|
529
|
+
}
|
|
530
|
+
function R(s, o) {
|
|
531
|
+
C ? C.warn(y.yellow(`[MillenniumSkin] ${s}`), o) : console.warn(y.yellow(`[MillenniumSkin] ${s}`));
|
|
532
|
+
}
|
|
533
|
+
function k(s, o) {
|
|
534
|
+
C ? C.info(y.greenBright(`[MillenniumSkin] ${s}`), o) : console.log(y.greenBright(`[MillenniumSkin] ${s}`));
|
|
535
|
+
}
|
|
536
|
+
function F(s, o) {
|
|
537
|
+
C ? C.error(y.redBright(`[MillenniumSkin] ${s}`), o) : console.error(y.redBright(`[MillenniumSkin] ${s}`));
|
|
538
|
+
}
|
|
539
|
+
export {
|
|
540
|
+
he as LibraryRoot,
|
|
541
|
+
ve as MenuAccount,
|
|
542
|
+
Me as MenuFriends,
|
|
543
|
+
we as MenuGames,
|
|
544
|
+
ye as MenuHelp,
|
|
545
|
+
Te as MenuNotifications,
|
|
546
|
+
be as MenuSteam,
|
|
547
|
+
Ce as MenuView,
|
|
548
|
+
de as Root,
|
|
549
|
+
W as __AUTO__,
|
|
550
|
+
X as __DEFAULT__,
|
|
551
|
+
J as __DIRECT__,
|
|
552
|
+
ge as __PACKAGE__,
|
|
553
|
+
V as __RUNTIME__,
|
|
554
|
+
$e as default,
|
|
555
|
+
ke as defineConfig,
|
|
556
|
+
F as error,
|
|
557
|
+
k as info,
|
|
558
|
+
R as warn
|
|
559
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const __AUTO__: versionConfig;
|
|
2
|
+
export declare const __PACKAGE__: versionConfig;
|
|
3
|
+
export declare const __DEFAULT__: versionConfig;
|
|
4
|
+
export type autoCommitLevel = {
|
|
5
|
+
autoCommit: false;
|
|
6
|
+
} | {
|
|
7
|
+
autoCommit: true;
|
|
8
|
+
needCommitMessage: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type versionConfig = {
|
|
11
|
+
type: "auto" | "package";
|
|
12
|
+
git?: {
|
|
13
|
+
major: autoCommitLevel;
|
|
14
|
+
minor: autoCommitLevel;
|
|
15
|
+
patch: autoCommitLevel;
|
|
16
|
+
rc: autoCommitLevel;
|
|
17
|
+
gamma: autoCommitLevel;
|
|
18
|
+
beta: autoCommitLevel;
|
|
19
|
+
preview: autoCommitLevel;
|
|
20
|
+
alpha: autoCommitLevel;
|
|
21
|
+
snapshot: autoCommitLevel;
|
|
22
|
+
};
|
|
23
|
+
};
|
package/package.json
CHANGED
package/vite.config.ts
CHANGED
|
@@ -25,6 +25,8 @@ const rg: any = {
|
|
|
25
25
|
"@babel/types",
|
|
26
26
|
"@babel/parser",
|
|
27
27
|
"chalk",
|
|
28
|
+
"inquirer",
|
|
29
|
+
"simple-git",
|
|
28
30
|
],
|
|
29
31
|
output: {
|
|
30
32
|
preserveModules: false,
|
|
@@ -51,4 +53,4 @@ const rt: any = {
|
|
|
51
53
|
plugins: [aaa()],
|
|
52
54
|
};
|
|
53
55
|
|
|
54
|
-
export default defineConfig(
|
|
56
|
+
export default defineConfig(rg);
|
package/dist/assets/css/a.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
a{color:red}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
:root{--aaa: rgb(255, 255, 255, 0)}
|
package/dist/assets/js/a.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e={native:{major:1,minor:0,patch:9,beta:3},new:{major:1,minor:0,patch:9,beta:3,preview:1},nativeString:"1.0.9-beta.3",newString:"1.0.9-beta.3.preview.1"},n=window.opener.SP_REACT.createElement;n("div");console.log(e);
|
package/dist/skin.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "Transparent Steam",
|
|
3
|
-
"description": "description",
|
|
4
|
-
"author": "bvii",
|
|
5
|
-
"header_image": "",
|
|
6
|
-
"splash_image": "",
|
|
7
|
-
"github": {
|
|
8
|
-
"owner": "bviibvii",
|
|
9
|
-
"repo_name": "steam"
|
|
10
|
-
},
|
|
11
|
-
"RootColors": "assets/css/color.css",
|
|
12
|
-
"Patches": [
|
|
13
|
-
{
|
|
14
|
-
"MatchRegexString": "^Steam$",
|
|
15
|
-
"TargetJs": "assets/js/a.js",
|
|
16
|
-
"TargetCss": "assets/css/a.css"
|
|
17
|
-
}
|
|
18
|
-
],
|
|
19
|
-
"srcCss": "lib",
|
|
20
|
-
"srcJs": "lib",
|
|
21
|
-
"version": "1.0.9-beta.3.preview.1"
|
|
22
|
-
}
|