vite-plugin-millennium-skin 1.1.3 → 1.1.4
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/index.js +218 -226
- package/package.json +1 -1
- package/src/ts/aliasModules.ts +64 -4
- package/dist/exports/react-dom.d.ts +0 -17
- package/dist/exports/react.d.ts +0 -41
- package/src/ts/exports/react-dom.ts +0 -19
- package/src/ts/exports/react.ts +0 -43
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { loadConfigFromFile as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
const
|
|
1
|
+
import w, { join as m } from "path/posix";
|
|
2
|
+
import { existsSync as b } from "fs";
|
|
3
|
+
import R from "fs/promises";
|
|
4
|
+
import { loadConfigFromFile as y } from "vite";
|
|
5
|
+
import f from "chalk";
|
|
6
|
+
import v from "inquirer";
|
|
7
|
+
import O from "simple-git";
|
|
8
|
+
const $ = [
|
|
9
9
|
{
|
|
10
10
|
Match: "https://.*.steampowered.com",
|
|
11
11
|
TargetCss: "webkit.css",
|
|
@@ -86,18 +86,80 @@ const P = [
|
|
|
86
86
|
TargetCss: "libraryroot.custom.css",
|
|
87
87
|
TargetJs: "libraryroot.custom.js"
|
|
88
88
|
}
|
|
89
|
-
],
|
|
89
|
+
], M = [
|
|
90
90
|
{
|
|
91
91
|
module: /^react(\/.*)?$/g,
|
|
92
|
-
code:
|
|
92
|
+
code: `export default window.opener.SP_REACT;
|
|
93
|
+
export const Children = window.opener.SP_REACT.Children;
|
|
94
|
+
export const Component = window.opener.SP_REACT.Component;
|
|
95
|
+
export const Fragment = window.opener.SP_REACT.Fragment;
|
|
96
|
+
export const Profiler = window.opener.SP_REACT.Profiler;
|
|
97
|
+
export const PureComponent = window.opener.SP_REACT.PureComponent;
|
|
98
|
+
export const StrictMode = window.opener.SP_REACT.StrictMode;
|
|
99
|
+
export const Suspense = window.opener.SP_REACT.Suspense;
|
|
100
|
+
export const __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
|
|
101
|
+
window.opener.SP_REACT
|
|
102
|
+
.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
103
|
+
export const __COMPILER_RUNTIME = window.opener.SP_REACT.__COMPILER_RUNTIME;
|
|
104
|
+
export const cache = window.opener.SP_REACT.cache;
|
|
105
|
+
export const cloneElement = window.opener.SP_REACT.cloneElement;
|
|
106
|
+
export const createContext = window.opener.SP_REACT.createContext;
|
|
107
|
+
export const createElement = window.opener.SP_REACT.createElement;
|
|
108
|
+
export const createRef = window.opener.SP_REACT.createRef;
|
|
109
|
+
export const forwardRef = window.opener.SP_REACT.forwardRef;
|
|
110
|
+
export const isValidElement = window.opener.SP_REACT.isValidElement;
|
|
111
|
+
export const lazy = window.opener.SP_REACT.lazy;
|
|
112
|
+
export const memo = window.opener.SP_REACT.memo;
|
|
113
|
+
export const startTransition = window.opener.SP_REACT.startTransition;
|
|
114
|
+
export const unstable_useCacheRefresh =
|
|
115
|
+
window.opener.SP_REACT.unstable_useCacheRefresh;
|
|
116
|
+
export const use = window.opener.SP_REACT.use;
|
|
117
|
+
export const useActionState = window.opener.SP_REACT.useActionState;
|
|
118
|
+
export const useCallback = window.opener.SP_REACT.useCallback;
|
|
119
|
+
export const useContext = window.opener.SP_REACT.useContext;
|
|
120
|
+
export const useDebugValue = window.opener.SP_REACT.useDebugValue;
|
|
121
|
+
export const useDeferredValue = window.opener.SP_REACT.useDeferredValue;
|
|
122
|
+
export const useEffect = window.opener.SP_REACT.useEffect;
|
|
123
|
+
export const useId = window.opener.SP_REACT.useId;
|
|
124
|
+
export const useImperativeHandle = window.opener.SP_REACT.useImperativeHandle;
|
|
125
|
+
export const useInsertionEffect = window.opener.SP_REACT.useInsertionEffect;
|
|
126
|
+
export const useLayoutEffect = window.opener.SP_REACT.useLayoutEffect;
|
|
127
|
+
export const useMemo = window.opener.SP_REACT.useMemo;
|
|
128
|
+
export const useOptimistic = window.opener.SP_REACT.useOptimistic;
|
|
129
|
+
export const useReducer = window.opener.SP_REACT.useReducer;
|
|
130
|
+
export const useRef = window.opener.SP_REACT.useRef;
|
|
131
|
+
export const useState = window.opener.SP_REACT.useState;
|
|
132
|
+
export const useSyncExternalStore = window.opener.SP_REACT.useSyncExternalStore;
|
|
133
|
+
export const useTransition = window.opener.SP_REACT.useTransition;
|
|
134
|
+
export const version = window.opener.SP_REACT.version;
|
|
135
|
+
`,
|
|
93
136
|
id: "virtual:react"
|
|
94
137
|
},
|
|
95
138
|
{
|
|
96
139
|
module: /^react-dom(\/.*)?$/g,
|
|
97
|
-
code:
|
|
140
|
+
code: `export default window.opener.SP_REACTDOM;
|
|
141
|
+
export const __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
|
|
142
|
+
window.opener.SP_REACTDOM
|
|
143
|
+
.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
144
|
+
export const createPortal = window.opener.SP_REACTDOM.createPortal;
|
|
145
|
+
export const flushSync = window.opener.SP_REACTDOM.flushSync;
|
|
146
|
+
export const preconnect = window.opener.SP_REACTDOM.preconnect;
|
|
147
|
+
export const prefetchDNS = window.opener.SP_REACTDOM.prefetchDNS;
|
|
148
|
+
export const preinit = window.opener.SP_REACTDOM.preinit;
|
|
149
|
+
export const preinitModule = window.opener.SP_REACTDOM.preinitModule;
|
|
150
|
+
export const preload = window.opener.SP_REACTDOM.preload;
|
|
151
|
+
export const preloadModule = window.opener.SP_REACTDOM.preloadModule;
|
|
152
|
+
export const requestFormReset = window.opener.SP_REACTDOM.requestFormReset;
|
|
153
|
+
export const unstable_batchedUpdates =
|
|
154
|
+
window.opener.SP_REACTDOM.unstable_batchedUpdates;
|
|
155
|
+
export const useFormState = window.opener.SP_REACTDOM.useFormState;
|
|
156
|
+
export const useFormStatus = window.opener.SP_REACTDOM.useFormStatus;
|
|
157
|
+
export const version = window.opener.SP_REACTDOM.version;
|
|
158
|
+
export const createRoot = window.opener.SP_REACTDOM.createRoot;
|
|
159
|
+
`,
|
|
98
160
|
id: "virtual:react-dom"
|
|
99
161
|
}
|
|
100
|
-
],
|
|
162
|
+
], N = {
|
|
101
163
|
type: "auto",
|
|
102
164
|
git: {
|
|
103
165
|
major: { autoCommit: !1 },
|
|
@@ -110,7 +172,7 @@ const P = [
|
|
|
110
172
|
alpha: { autoCommit: !0, needCommitMessage: !1 },
|
|
111
173
|
snapshot: { autoCommit: !0, needCommitMessage: !1 }
|
|
112
174
|
}
|
|
113
|
-
},
|
|
175
|
+
}, V = {
|
|
114
176
|
type: "auto",
|
|
115
177
|
git: {
|
|
116
178
|
major: { autoCommit: !1 },
|
|
@@ -123,10 +185,10 @@ const P = [
|
|
|
123
185
|
alpha: { autoCommit: !1 },
|
|
124
186
|
snapshot: { autoCommit: !1 }
|
|
125
187
|
}
|
|
126
|
-
},
|
|
127
|
-
async function
|
|
128
|
-
if (
|
|
129
|
-
const
|
|
188
|
+
}, j = N, T = O();
|
|
189
|
+
async function k(o = !1) {
|
|
190
|
+
if (o) {
|
|
191
|
+
const r = await v.prompt([
|
|
130
192
|
{
|
|
131
193
|
type: "select",
|
|
132
194
|
name: "type",
|
|
@@ -154,67 +216,67 @@ async function N(s = !1) {
|
|
|
154
216
|
default: !0
|
|
155
217
|
}
|
|
156
218
|
]);
|
|
157
|
-
if (!
|
|
158
|
-
|
|
219
|
+
if (!r.confirm) {
|
|
220
|
+
S("❌ 已取消提交");
|
|
159
221
|
return;
|
|
160
222
|
}
|
|
161
223
|
try {
|
|
162
|
-
await
|
|
224
|
+
await T.add("."), await T.commit(`${r.type}: ${r.message}`), S("✓ git提交成功");
|
|
163
225
|
} catch (t) {
|
|
164
|
-
|
|
226
|
+
x(`❌ git提交失败: ${t.message}`);
|
|
165
227
|
}
|
|
166
228
|
} else
|
|
167
229
|
try {
|
|
168
|
-
await
|
|
169
|
-
} catch (
|
|
170
|
-
|
|
230
|
+
await T.add("."), await T.commit("chore: auto commit by MillenniumSkin"), S("✓ git提交成功");
|
|
231
|
+
} catch (r) {
|
|
232
|
+
x(`❌ git提交失败: ${r.message}`);
|
|
171
233
|
}
|
|
172
234
|
}
|
|
173
|
-
const
|
|
174
|
-
let
|
|
175
|
-
function
|
|
176
|
-
const
|
|
177
|
-
let t, e, u,
|
|
235
|
+
const H = /^SharedJSContext$/, W = /^Steam$/, Y = /^View Root Menu$/, q = /^Steam Root Menu$/, X = /^Friends Root Menu$/, K = /^Games Root Menu$/, Q = /^Help Root Menu$/, ee = /^Notifications Menu$/, te = /^Account Menu$/, D = /(?<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-]*))*))?/, J = /(?:\.)?(?<tag>[a-zA-Z]+)\.(?<number>(?:[1-9]\d*|0\d*|0))/g;
|
|
236
|
+
let d;
|
|
237
|
+
function oe() {
|
|
238
|
+
const o = [], r = [];
|
|
239
|
+
let t, e, u, p;
|
|
178
240
|
return {
|
|
179
241
|
name: "vite-plugin-millennium-skin",
|
|
180
242
|
enforce: "pre",
|
|
181
|
-
resolveId(
|
|
182
|
-
for (const
|
|
183
|
-
if (
|
|
184
|
-
return
|
|
243
|
+
resolveId(n) {
|
|
244
|
+
for (const a of M)
|
|
245
|
+
if (a.module.test(n))
|
|
246
|
+
return a.id;
|
|
185
247
|
},
|
|
186
|
-
load(
|
|
187
|
-
for (const
|
|
188
|
-
if (
|
|
248
|
+
load(n) {
|
|
249
|
+
for (const a of M)
|
|
250
|
+
if (n === a.id) return a.code;
|
|
189
251
|
},
|
|
190
|
-
async config(
|
|
191
|
-
if (t = (await
|
|
252
|
+
async config(n) {
|
|
253
|
+
if (t = (await y(
|
|
192
254
|
{ command: "build", mode: "profuction" },
|
|
193
255
|
"skin.config.ts",
|
|
194
|
-
|
|
256
|
+
n.root
|
|
195
257
|
))?.config, t.Patches === void 0) {
|
|
196
258
|
if (!t.UseDefaultPatches)
|
|
197
259
|
throw new Error("haven't any patch in skin.config.ts");
|
|
198
|
-
t.Patches =
|
|
260
|
+
t.Patches = $;
|
|
199
261
|
}
|
|
200
|
-
return t.Patches.forEach((
|
|
201
|
-
|
|
202
|
-
|
|
262
|
+
return t.Patches.forEach((i) => {
|
|
263
|
+
i.TargetJs && o.push(m(t.srcJs, i.TargetJs)), i.TargetCss && r.push(
|
|
264
|
+
P(m(t.srcCss, i.TargetCss))
|
|
203
265
|
);
|
|
204
|
-
}), t.RootColors !== void 0 &&
|
|
205
|
-
|
|
206
|
-
|
|
266
|
+
}), t.RootColors !== void 0 && r.push(
|
|
267
|
+
P(
|
|
268
|
+
m(t.srcCss, t.RootColors)
|
|
207
269
|
)
|
|
208
270
|
), {
|
|
209
271
|
build: {
|
|
210
272
|
rollupOptions: {
|
|
211
|
-
input: [...
|
|
273
|
+
input: [...o, ...r],
|
|
212
274
|
output: {
|
|
213
275
|
entryFileNames: "assets/js/[name].js",
|
|
214
|
-
assetFileNames: (
|
|
215
|
-
const c =
|
|
216
|
-
return
|
|
217
|
-
|
|
276
|
+
assetFileNames: (i) => {
|
|
277
|
+
const c = i.names[0], s = w.parse(c);
|
|
278
|
+
return s.ext === ".css" ? `assets/css/${c}` : /\.(png|jpg|jpeg|gif|svg|webp|bmp|heic)/i.test(
|
|
279
|
+
s.ext
|
|
218
280
|
) ? `assets/images/${c}` : `assets/css/${c}`;
|
|
219
281
|
}
|
|
220
282
|
}
|
|
@@ -224,209 +286,139 @@ function ae() {
|
|
|
224
286
|
}
|
|
225
287
|
};
|
|
226
288
|
},
|
|
227
|
-
async configResolved(
|
|
228
|
-
u =
|
|
229
|
-
const
|
|
230
|
-
t.version === void 0 && (t.version =
|
|
289
|
+
async configResolved(n) {
|
|
290
|
+
u = n, d = n.logger;
|
|
291
|
+
const a = u.root, i = m(a, "package.json");
|
|
292
|
+
t.version === void 0 && (t.version = j);
|
|
231
293
|
try {
|
|
232
294
|
const c = JSON.parse(
|
|
233
|
-
await
|
|
295
|
+
await R.readFile(i, {
|
|
234
296
|
flag: "r",
|
|
235
297
|
encoding: "utf-8"
|
|
236
298
|
})
|
|
237
299
|
);
|
|
238
300
|
if (t.version.type === "auto") {
|
|
239
|
-
if (
|
|
301
|
+
if (p = await h(
|
|
240
302
|
c.version,
|
|
241
303
|
process.env.RELEASE
|
|
242
|
-
),
|
|
243
|
-
const
|
|
244
|
-
c.version =
|
|
245
|
-
|
|
304
|
+
), p) {
|
|
305
|
+
const s = p.newString;
|
|
306
|
+
c.version = s, await R.writeFile(
|
|
307
|
+
i,
|
|
246
308
|
JSON.stringify(c, null, 4)
|
|
247
|
-
),
|
|
309
|
+
), S(`${p.nativeString} -> ${s}`);
|
|
248
310
|
}
|
|
249
|
-
} else t.version.type === "package" && (
|
|
311
|
+
} else t.version.type === "package" && (p = await h(c.version));
|
|
250
312
|
} catch (c) {
|
|
251
|
-
|
|
313
|
+
A(`can't use package.json: ${c}`), p = await h("0.0.0");
|
|
252
314
|
}
|
|
253
315
|
},
|
|
254
|
-
generateBundle(
|
|
316
|
+
generateBundle(n, a) {
|
|
255
317
|
if (t.Patches === void 0)
|
|
256
318
|
throw new Error("haven't any patch in building");
|
|
257
|
-
const
|
|
319
|
+
const i = u.root, c = structuredClone(
|
|
258
320
|
t.Patches
|
|
259
|
-
).map((
|
|
260
|
-
if (
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
|
|
321
|
+
).map((s) => {
|
|
322
|
+
if (s.Match instanceof RegExp && (s.Match = s.Match.source), s.TargetJs) {
|
|
323
|
+
const l = w.parse(s.TargetJs);
|
|
324
|
+
s.TargetJs = m(
|
|
325
|
+
i,
|
|
264
326
|
t.srcJs,
|
|
265
|
-
|
|
266
|
-
|
|
327
|
+
l.dir,
|
|
328
|
+
l.name
|
|
267
329
|
);
|
|
268
330
|
}
|
|
269
|
-
if (
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
|
|
331
|
+
if (s.TargetCss) {
|
|
332
|
+
const l = w.parse(s.TargetCss);
|
|
333
|
+
s.TargetCss = m(
|
|
334
|
+
i,
|
|
273
335
|
t.srcCss,
|
|
274
|
-
|
|
275
|
-
|
|
336
|
+
l.dir,
|
|
337
|
+
l.name
|
|
276
338
|
);
|
|
277
339
|
}
|
|
278
340
|
return {
|
|
279
|
-
MatchRegexString:
|
|
280
|
-
TargetJs:
|
|
281
|
-
TargetCss:
|
|
341
|
+
MatchRegexString: s.Match,
|
|
342
|
+
TargetJs: s.TargetJs,
|
|
343
|
+
TargetCss: s.TargetCss
|
|
282
344
|
};
|
|
283
345
|
});
|
|
284
|
-
Object.entries(
|
|
285
|
-
const { type:
|
|
286
|
-
if (
|
|
287
|
-
if (!
|
|
288
|
-
const
|
|
289
|
-
|
|
290
|
-
|
|
346
|
+
Object.entries(a).forEach(([, s]) => {
|
|
347
|
+
const { type: l } = s, E = s.fileName;
|
|
348
|
+
if (l === "chunk") {
|
|
349
|
+
if (!s.facadeModuleId) return;
|
|
350
|
+
const g = w.parse(s.facadeModuleId), _ = m(
|
|
351
|
+
g.dir,
|
|
352
|
+
g.name
|
|
291
353
|
);
|
|
292
354
|
c.forEach((C) => {
|
|
293
|
-
|
|
355
|
+
_ === C.TargetJs && (C.TargetJs = E);
|
|
294
356
|
});
|
|
295
357
|
} else {
|
|
296
|
-
const
|
|
297
|
-
|
|
298
|
-
),
|
|
299
|
-
|
|
300
|
-
|
|
358
|
+
const g = w.parse(
|
|
359
|
+
m(i, s.originalFileNames[0])
|
|
360
|
+
), _ = m(
|
|
361
|
+
g.dir,
|
|
362
|
+
g.name
|
|
301
363
|
);
|
|
302
364
|
c.forEach((C) => {
|
|
303
|
-
|
|
304
|
-
}), t.RootColors &&
|
|
365
|
+
_ === C.TargetCss && (C.TargetCss = E);
|
|
366
|
+
}), t.RootColors && _ === m(
|
|
305
367
|
u.root,
|
|
306
368
|
t.srcCss,
|
|
307
369
|
t.RootColors
|
|
308
|
-
) && (t.RootColors =
|
|
370
|
+
) && (t.RootColors = E);
|
|
309
371
|
return;
|
|
310
372
|
}
|
|
311
373
|
}), e = {
|
|
312
374
|
...t,
|
|
313
375
|
Patches: c,
|
|
314
|
-
version:
|
|
376
|
+
version: p?.newString ?? "0.0.0"
|
|
315
377
|
};
|
|
316
378
|
},
|
|
317
379
|
async writeBundle() {
|
|
318
|
-
const
|
|
380
|
+
const n = u.root;
|
|
319
381
|
try {
|
|
320
|
-
await
|
|
321
|
-
|
|
382
|
+
await R.writeFile(
|
|
383
|
+
m(n, u.build.outDir, "skin.json"),
|
|
322
384
|
JSON.stringify(e, null, 4)
|
|
323
385
|
);
|
|
324
|
-
} catch (
|
|
325
|
-
throw new Error(`can't write skin.json: ${
|
|
386
|
+
} catch (a) {
|
|
387
|
+
throw new Error(`can't write skin.json: ${a}`);
|
|
326
388
|
}
|
|
327
389
|
},
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
// */
|
|
332
|
-
// if (!/.+\.(js|ts|tsx|jsx)$/g.test(id)) return;
|
|
333
|
-
// const ast = parse(code, {
|
|
334
|
-
// sourceType: "module",
|
|
335
|
-
// plugins: ["typescript", "jsx"],
|
|
336
|
-
// });
|
|
337
|
-
// traver(ast, {
|
|
338
|
-
// Program(path) {
|
|
339
|
-
// const body = path.node.body;
|
|
340
|
-
// const runtimeLinks: Record<string, string[]> = {};
|
|
341
|
-
// // 处理静态引入别名,收集动态引入别名
|
|
342
|
-
// for (let i = body.length - 1; i >= 0; i--) {
|
|
343
|
-
// let node = body[i];
|
|
344
|
-
// if (!t.isImportDeclaration(node)) continue;
|
|
345
|
-
// const moduleName: string = node.source.value;
|
|
346
|
-
// const match: Statement[] = [];
|
|
347
|
-
// for (const aliasMod of aliasModules) {
|
|
348
|
-
// if (!aliasMod.module.test(moduleName)) continue;
|
|
349
|
-
// const { method } = aliasMod;
|
|
350
|
-
// for (const local of node.specifiers) {
|
|
351
|
-
// const exportLocal = local.local.name;
|
|
352
|
-
// let links: string[];
|
|
353
|
-
// if (local.type === "ImportDefaultSpecifier")
|
|
354
|
-
// // 默认导出
|
|
355
|
-
// links = aliasMod.links;
|
|
356
|
-
// else
|
|
357
|
-
// // 指定导出
|
|
358
|
-
// links = [
|
|
359
|
-
// ...aliasMod.links,
|
|
360
|
-
// (local as any).imported.name,
|
|
361
|
-
// ];
|
|
362
|
-
// switch (method) {
|
|
363
|
-
// case __RUNTIME__:
|
|
364
|
-
// runtimeLinks[exportLocal] =
|
|
365
|
-
// aliasMod.links;
|
|
366
|
-
// break;
|
|
367
|
-
// case __DIRECT__:
|
|
368
|
-
// match.push(
|
|
369
|
-
// generateConstDeclaration(
|
|
370
|
-
// exportLocal,
|
|
371
|
-
// links,
|
|
372
|
-
// ),
|
|
373
|
-
// );
|
|
374
|
-
// break;
|
|
375
|
-
// }
|
|
376
|
-
// }
|
|
377
|
-
// }
|
|
378
|
-
// if (match.length) {
|
|
379
|
-
// body.splice(i, 1, ...match);
|
|
380
|
-
// }
|
|
381
|
-
// }
|
|
382
|
-
// // 处理动态引入
|
|
383
|
-
// Object.entries(runtimeLinks).forEach(
|
|
384
|
-
// ([localName, runtimeLink]) => {
|
|
385
|
-
// const binding = path.scope.getBinding(localName);
|
|
386
|
-
// if (binding === undefined) return;
|
|
387
|
-
// binding.referencePaths.forEach((refPath) => {
|
|
388
|
-
// replaceRef(refPath, localName, runtimeLink);
|
|
389
|
-
// });
|
|
390
|
-
// binding.scope.removeOwnBinding(localName);
|
|
391
|
-
// },
|
|
392
|
-
// );
|
|
393
|
-
// },
|
|
394
|
-
// });
|
|
395
|
-
// const result = generate(ast);
|
|
396
|
-
// return { code: result.code };
|
|
397
|
-
// },
|
|
398
|
-
async closeBundle(r) {
|
|
399
|
-
if (r) {
|
|
400
|
-
console.error("打包失败:", r);
|
|
390
|
+
async closeBundle(n) {
|
|
391
|
+
if (n) {
|
|
392
|
+
console.error("打包失败:", n);
|
|
401
393
|
return;
|
|
402
394
|
}
|
|
403
395
|
if (t.version?.git !== void 0) {
|
|
404
|
-
const
|
|
405
|
-
if (
|
|
406
|
-
const
|
|
407
|
-
|
|
396
|
+
const a = process.env.RELEASE;
|
|
397
|
+
if (a && t.version.git[a]) {
|
|
398
|
+
const i = t.version.git[a];
|
|
399
|
+
i.autoCommit && await k(i.needCommitMessage);
|
|
408
400
|
}
|
|
409
401
|
}
|
|
410
402
|
}
|
|
411
403
|
};
|
|
412
404
|
}
|
|
413
|
-
function
|
|
414
|
-
return
|
|
405
|
+
function se(o) {
|
|
406
|
+
return o;
|
|
415
407
|
}
|
|
416
|
-
function
|
|
417
|
-
if (
|
|
408
|
+
function P(o) {
|
|
409
|
+
if (w.parse(o).ext !== "") return o;
|
|
418
410
|
for (const t of ["scss", "sass", "css"]) {
|
|
419
|
-
const e = `${
|
|
420
|
-
if (
|
|
411
|
+
const e = `${o}.${t}`;
|
|
412
|
+
if (b(m(process.cwd(), e)))
|
|
421
413
|
return e;
|
|
422
414
|
}
|
|
423
|
-
throw new Error(`can't find css module: ${
|
|
415
|
+
throw new Error(`can't find css module: ${o}`);
|
|
424
416
|
}
|
|
425
|
-
async function
|
|
417
|
+
async function h(o, r = null) {
|
|
426
418
|
try {
|
|
427
|
-
const t =
|
|
419
|
+
const t = D.exec(o);
|
|
428
420
|
if (!t?.groups) {
|
|
429
|
-
|
|
421
|
+
A(`can't understand version: ${o}`);
|
|
430
422
|
return;
|
|
431
423
|
}
|
|
432
424
|
let e = {
|
|
@@ -435,12 +427,12 @@ async function v(s, o = null) {
|
|
|
435
427
|
patch: parseInt(t.groups.patch)
|
|
436
428
|
};
|
|
437
429
|
t.groups.preRelease && [
|
|
438
|
-
...t.groups.preRelease.matchAll(
|
|
439
|
-
].forEach((
|
|
440
|
-
|
|
430
|
+
...t.groups.preRelease.matchAll(J)
|
|
431
|
+
].forEach((n) => {
|
|
432
|
+
n.groups && (e[n.groups.tag] = parseInt(n.groups.number));
|
|
441
433
|
});
|
|
442
434
|
const u = { ...e };
|
|
443
|
-
switch (
|
|
435
|
+
switch (r) {
|
|
444
436
|
case null:
|
|
445
437
|
break;
|
|
446
438
|
case void 0:
|
|
@@ -488,48 +480,48 @@ async function v(s, o = null) {
|
|
|
488
480
|
return {
|
|
489
481
|
native: u,
|
|
490
482
|
new: e,
|
|
491
|
-
nativeString:
|
|
492
|
-
newString:
|
|
483
|
+
nativeString: o,
|
|
484
|
+
newString: I(e)
|
|
493
485
|
};
|
|
494
486
|
} catch (t) {
|
|
495
|
-
|
|
487
|
+
A(`can't bump version: ${t}`);
|
|
496
488
|
}
|
|
497
489
|
}
|
|
498
|
-
function
|
|
499
|
-
let
|
|
490
|
+
function I(o) {
|
|
491
|
+
let r = `${o.major}.${o.minor}.${o.patch}`;
|
|
500
492
|
const t = ["rc", "gamma", "beta", "preview", "alpha", "snapshot"];
|
|
501
493
|
let e = !1;
|
|
502
494
|
for (const u of t) {
|
|
503
|
-
const
|
|
504
|
-
|
|
495
|
+
const p = o[u];
|
|
496
|
+
p != null && (e ? r += `.${u}.${p}` : (r += `-${u}.${p}`, e = !0));
|
|
505
497
|
}
|
|
506
|
-
return
|
|
498
|
+
return r;
|
|
507
499
|
}
|
|
508
|
-
function
|
|
509
|
-
|
|
500
|
+
function A(o, r) {
|
|
501
|
+
d ? d.warn(f.yellow(`[MillenniumSkin] ${o}`), r) : console.warn(f.yellow(`[MillenniumSkin] ${o}`));
|
|
510
502
|
}
|
|
511
|
-
function
|
|
512
|
-
|
|
503
|
+
function S(o, r) {
|
|
504
|
+
d ? d.info(f.greenBright(`[MillenniumSkin] ${o}`), r) : console.log(f.greenBright(`[MillenniumSkin] ${o}`));
|
|
513
505
|
}
|
|
514
|
-
function
|
|
515
|
-
|
|
506
|
+
function x(o, r) {
|
|
507
|
+
d ? d.error(f.redBright(`[MillenniumSkin] ${o}`), r) : console.error(f.redBright(`[MillenniumSkin] ${o}`));
|
|
516
508
|
}
|
|
517
509
|
export {
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
510
|
+
W as LibraryRoot,
|
|
511
|
+
te as MenuAccount,
|
|
512
|
+
X as MenuFriends,
|
|
513
|
+
K as MenuGames,
|
|
514
|
+
Q as MenuHelp,
|
|
515
|
+
ee as MenuNotifications,
|
|
516
|
+
q as MenuSteam,
|
|
517
|
+
Y as MenuView,
|
|
518
|
+
H as Root,
|
|
519
|
+
N as __AUTO__,
|
|
520
|
+
j as __DEFAULT__,
|
|
521
|
+
V as __PACKAGE__,
|
|
522
|
+
oe as default,
|
|
523
|
+
se as defineConfig,
|
|
524
|
+
x as error,
|
|
525
|
+
S as info,
|
|
526
|
+
A as warn
|
|
535
527
|
};
|
package/package.json
CHANGED
package/src/ts/aliasModules.ts
CHANGED
|
@@ -1,14 +1,74 @@
|
|
|
1
|
-
import { readFileSync } from "fs";
|
|
2
|
-
|
|
3
1
|
export default [
|
|
4
2
|
{
|
|
5
3
|
module: /^react(\/.*)?$/g,
|
|
6
|
-
code:
|
|
4
|
+
code: `export default window.opener.SP_REACT;
|
|
5
|
+
export const Children = window.opener.SP_REACT.Children;
|
|
6
|
+
export const Component = window.opener.SP_REACT.Component;
|
|
7
|
+
export const Fragment = window.opener.SP_REACT.Fragment;
|
|
8
|
+
export const Profiler = window.opener.SP_REACT.Profiler;
|
|
9
|
+
export const PureComponent = window.opener.SP_REACT.PureComponent;
|
|
10
|
+
export const StrictMode = window.opener.SP_REACT.StrictMode;
|
|
11
|
+
export const Suspense = window.opener.SP_REACT.Suspense;
|
|
12
|
+
export const __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
|
|
13
|
+
window.opener.SP_REACT
|
|
14
|
+
.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
15
|
+
export const __COMPILER_RUNTIME = window.opener.SP_REACT.__COMPILER_RUNTIME;
|
|
16
|
+
export const cache = window.opener.SP_REACT.cache;
|
|
17
|
+
export const cloneElement = window.opener.SP_REACT.cloneElement;
|
|
18
|
+
export const createContext = window.opener.SP_REACT.createContext;
|
|
19
|
+
export const createElement = window.opener.SP_REACT.createElement;
|
|
20
|
+
export const createRef = window.opener.SP_REACT.createRef;
|
|
21
|
+
export const forwardRef = window.opener.SP_REACT.forwardRef;
|
|
22
|
+
export const isValidElement = window.opener.SP_REACT.isValidElement;
|
|
23
|
+
export const lazy = window.opener.SP_REACT.lazy;
|
|
24
|
+
export const memo = window.opener.SP_REACT.memo;
|
|
25
|
+
export const startTransition = window.opener.SP_REACT.startTransition;
|
|
26
|
+
export const unstable_useCacheRefresh =
|
|
27
|
+
window.opener.SP_REACT.unstable_useCacheRefresh;
|
|
28
|
+
export const use = window.opener.SP_REACT.use;
|
|
29
|
+
export const useActionState = window.opener.SP_REACT.useActionState;
|
|
30
|
+
export const useCallback = window.opener.SP_REACT.useCallback;
|
|
31
|
+
export const useContext = window.opener.SP_REACT.useContext;
|
|
32
|
+
export const useDebugValue = window.opener.SP_REACT.useDebugValue;
|
|
33
|
+
export const useDeferredValue = window.opener.SP_REACT.useDeferredValue;
|
|
34
|
+
export const useEffect = window.opener.SP_REACT.useEffect;
|
|
35
|
+
export const useId = window.opener.SP_REACT.useId;
|
|
36
|
+
export const useImperativeHandle = window.opener.SP_REACT.useImperativeHandle;
|
|
37
|
+
export const useInsertionEffect = window.opener.SP_REACT.useInsertionEffect;
|
|
38
|
+
export const useLayoutEffect = window.opener.SP_REACT.useLayoutEffect;
|
|
39
|
+
export const useMemo = window.opener.SP_REACT.useMemo;
|
|
40
|
+
export const useOptimistic = window.opener.SP_REACT.useOptimistic;
|
|
41
|
+
export const useReducer = window.opener.SP_REACT.useReducer;
|
|
42
|
+
export const useRef = window.opener.SP_REACT.useRef;
|
|
43
|
+
export const useState = window.opener.SP_REACT.useState;
|
|
44
|
+
export const useSyncExternalStore = window.opener.SP_REACT.useSyncExternalStore;
|
|
45
|
+
export const useTransition = window.opener.SP_REACT.useTransition;
|
|
46
|
+
export const version = window.opener.SP_REACT.version;
|
|
47
|
+
`,
|
|
7
48
|
id: "virtual:react",
|
|
8
49
|
},
|
|
9
50
|
{
|
|
10
51
|
module: /^react-dom(\/.*)?$/g,
|
|
11
|
-
code:
|
|
52
|
+
code: `export default window.opener.SP_REACTDOM;
|
|
53
|
+
export const __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
|
|
54
|
+
window.opener.SP_REACTDOM
|
|
55
|
+
.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
56
|
+
export const createPortal = window.opener.SP_REACTDOM.createPortal;
|
|
57
|
+
export const flushSync = window.opener.SP_REACTDOM.flushSync;
|
|
58
|
+
export const preconnect = window.opener.SP_REACTDOM.preconnect;
|
|
59
|
+
export const prefetchDNS = window.opener.SP_REACTDOM.prefetchDNS;
|
|
60
|
+
export const preinit = window.opener.SP_REACTDOM.preinit;
|
|
61
|
+
export const preinitModule = window.opener.SP_REACTDOM.preinitModule;
|
|
62
|
+
export const preload = window.opener.SP_REACTDOM.preload;
|
|
63
|
+
export const preloadModule = window.opener.SP_REACTDOM.preloadModule;
|
|
64
|
+
export const requestFormReset = window.opener.SP_REACTDOM.requestFormReset;
|
|
65
|
+
export const unstable_batchedUpdates =
|
|
66
|
+
window.opener.SP_REACTDOM.unstable_batchedUpdates;
|
|
67
|
+
export const useFormState = window.opener.SP_REACTDOM.useFormState;
|
|
68
|
+
export const useFormStatus = window.opener.SP_REACTDOM.useFormStatus;
|
|
69
|
+
export const version = window.opener.SP_REACTDOM.version;
|
|
70
|
+
export const createRoot = window.opener.SP_REACTDOM.createRoot;
|
|
71
|
+
`,
|
|
12
72
|
id: "virtual:react-dom",
|
|
13
73
|
},
|
|
14
74
|
];
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
declare const _default: any;
|
|
2
|
-
export default _default;
|
|
3
|
-
export declare const __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE: any;
|
|
4
|
-
export declare const createPortal: any;
|
|
5
|
-
export declare const flushSync: any;
|
|
6
|
-
export declare const preconnect: any;
|
|
7
|
-
export declare const prefetchDNS: any;
|
|
8
|
-
export declare const preinit: any;
|
|
9
|
-
export declare const preinitModule: any;
|
|
10
|
-
export declare const preload: any;
|
|
11
|
-
export declare const preloadModule: any;
|
|
12
|
-
export declare const requestFormReset: any;
|
|
13
|
-
export declare const unstable_batchedUpdates: any;
|
|
14
|
-
export declare const useFormState: any;
|
|
15
|
-
export declare const useFormStatus: any;
|
|
16
|
-
export declare const version: any;
|
|
17
|
-
export declare const createRoot: any;
|
package/dist/exports/react.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
declare const _default: any;
|
|
2
|
-
export default _default;
|
|
3
|
-
export declare const Children: any;
|
|
4
|
-
export declare const Component: any;
|
|
5
|
-
export declare const Fragment: any;
|
|
6
|
-
export declare const Profiler: any;
|
|
7
|
-
export declare const PureComponent: any;
|
|
8
|
-
export declare const StrictMode: any;
|
|
9
|
-
export declare const Suspense: any;
|
|
10
|
-
export declare const __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE: any;
|
|
11
|
-
export declare const __COMPILER_RUNTIME: any;
|
|
12
|
-
export declare const cache: any;
|
|
13
|
-
export declare const cloneElement: any;
|
|
14
|
-
export declare const createContext: any;
|
|
15
|
-
export declare const createElement: any;
|
|
16
|
-
export declare const createRef: any;
|
|
17
|
-
export declare const forwardRef: any;
|
|
18
|
-
export declare const isValidElement: any;
|
|
19
|
-
export declare const lazy: any;
|
|
20
|
-
export declare const memo: any;
|
|
21
|
-
export declare const startTransition: any;
|
|
22
|
-
export declare const unstable_useCacheRefresh: any;
|
|
23
|
-
export declare const use: any;
|
|
24
|
-
export declare const useActionState: any;
|
|
25
|
-
export declare const useCallback: any;
|
|
26
|
-
export declare const useContext: any;
|
|
27
|
-
export declare const useDebugValue: any;
|
|
28
|
-
export declare const useDeferredValue: any;
|
|
29
|
-
export declare const useEffect: any;
|
|
30
|
-
export declare const useId: any;
|
|
31
|
-
export declare const useImperativeHandle: any;
|
|
32
|
-
export declare const useInsertionEffect: any;
|
|
33
|
-
export declare const useLayoutEffect: any;
|
|
34
|
-
export declare const useMemo: any;
|
|
35
|
-
export declare const useOptimistic: any;
|
|
36
|
-
export declare const useReducer: any;
|
|
37
|
-
export declare const useRef: any;
|
|
38
|
-
export declare const useState: any;
|
|
39
|
-
export declare const useSyncExternalStore: any;
|
|
40
|
-
export declare const useTransition: any;
|
|
41
|
-
export declare const version: any;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export default window.opener.SP_REACTDOM;
|
|
2
|
-
export const __DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
|
|
3
|
-
window.opener.SP_REACTDOM
|
|
4
|
-
.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
5
|
-
export const createPortal = window.opener.SP_REACTDOM.createPortal;
|
|
6
|
-
export const flushSync = window.opener.SP_REACTDOM.flushSync;
|
|
7
|
-
export const preconnect = window.opener.SP_REACTDOM.preconnect;
|
|
8
|
-
export const prefetchDNS = window.opener.SP_REACTDOM.prefetchDNS;
|
|
9
|
-
export const preinit = window.opener.SP_REACTDOM.preinit;
|
|
10
|
-
export const preinitModule = window.opener.SP_REACTDOM.preinitModule;
|
|
11
|
-
export const preload = window.opener.SP_REACTDOM.preload;
|
|
12
|
-
export const preloadModule = window.opener.SP_REACTDOM.preloadModule;
|
|
13
|
-
export const requestFormReset = window.opener.SP_REACTDOM.requestFormReset;
|
|
14
|
-
export const unstable_batchedUpdates =
|
|
15
|
-
window.opener.SP_REACTDOM.unstable_batchedUpdates;
|
|
16
|
-
export const useFormState = window.opener.SP_REACTDOM.useFormState;
|
|
17
|
-
export const useFormStatus = window.opener.SP_REACTDOM.useFormStatus;
|
|
18
|
-
export const version = window.opener.SP_REACTDOM.version;
|
|
19
|
-
export const createRoot = window.opener.SP_REACTDOM.createRoot;
|
package/src/ts/exports/react.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export default window.opener.SP_REACT;
|
|
2
|
-
export const Children = window.opener.SP_REACT.Children;
|
|
3
|
-
export const Component = window.opener.SP_REACT.Component;
|
|
4
|
-
export const Fragment = window.opener.SP_REACT.Fragment;
|
|
5
|
-
export const Profiler = window.opener.SP_REACT.Profiler;
|
|
6
|
-
export const PureComponent = window.opener.SP_REACT.PureComponent;
|
|
7
|
-
export const StrictMode = window.opener.SP_REACT.StrictMode;
|
|
8
|
-
export const Suspense = window.opener.SP_REACT.Suspense;
|
|
9
|
-
export const __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
|
|
10
|
-
window.opener.SP_REACT
|
|
11
|
-
.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
12
|
-
export const __COMPILER_RUNTIME = window.opener.SP_REACT.__COMPILER_RUNTIME;
|
|
13
|
-
export const cache = window.opener.SP_REACT.cache;
|
|
14
|
-
export const cloneElement = window.opener.SP_REACT.cloneElement;
|
|
15
|
-
export const createContext = window.opener.SP_REACT.createContext;
|
|
16
|
-
export const createElement = window.opener.SP_REACT.createElement;
|
|
17
|
-
export const createRef = window.opener.SP_REACT.createRef;
|
|
18
|
-
export const forwardRef = window.opener.SP_REACT.forwardRef;
|
|
19
|
-
export const isValidElement = window.opener.SP_REACT.isValidElement;
|
|
20
|
-
export const lazy = window.opener.SP_REACT.lazy;
|
|
21
|
-
export const memo = window.opener.SP_REACT.memo;
|
|
22
|
-
export const startTransition = window.opener.SP_REACT.startTransition;
|
|
23
|
-
export const unstable_useCacheRefresh =
|
|
24
|
-
window.opener.SP_REACT.unstable_useCacheRefresh;
|
|
25
|
-
export const use = window.opener.SP_REACT.use;
|
|
26
|
-
export const useActionState = window.opener.SP_REACT.useActionState;
|
|
27
|
-
export const useCallback = window.opener.SP_REACT.useCallback;
|
|
28
|
-
export const useContext = window.opener.SP_REACT.useContext;
|
|
29
|
-
export const useDebugValue = window.opener.SP_REACT.useDebugValue;
|
|
30
|
-
export const useDeferredValue = window.opener.SP_REACT.useDeferredValue;
|
|
31
|
-
export const useEffect = window.opener.SP_REACT.useEffect;
|
|
32
|
-
export const useId = window.opener.SP_REACT.useId;
|
|
33
|
-
export const useImperativeHandle = window.opener.SP_REACT.useImperativeHandle;
|
|
34
|
-
export const useInsertionEffect = window.opener.SP_REACT.useInsertionEffect;
|
|
35
|
-
export const useLayoutEffect = window.opener.SP_REACT.useLayoutEffect;
|
|
36
|
-
export const useMemo = window.opener.SP_REACT.useMemo;
|
|
37
|
-
export const useOptimistic = window.opener.SP_REACT.useOptimistic;
|
|
38
|
-
export const useReducer = window.opener.SP_REACT.useReducer;
|
|
39
|
-
export const useRef = window.opener.SP_REACT.useRef;
|
|
40
|
-
export const useState = window.opener.SP_REACT.useState;
|
|
41
|
-
export const useSyncExternalStore = window.opener.SP_REACT.useSyncExternalStore;
|
|
42
|
-
export const useTransition = window.opener.SP_REACT.useTransition;
|
|
43
|
-
export const version = window.opener.SP_REACT.version;
|