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