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 CHANGED
@@ -1,11 +1,11 @@
1
- import f, { join as l } from "path/posix";
2
- import { readFileSync as j, existsSync as E } from "fs";
3
- import y from "fs/promises";
4
- import { loadConfigFromFile as A } from "vite";
5
- import d from "chalk";
6
- import R from "inquirer";
7
- import _ from "simple-git";
8
- const P = [
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
- ], k = [
89
+ ], M = [
90
90
  {
91
91
  module: /^react(\/.*)?$/g,
92
- code: j("src/ts/exports/react.ts", "utf-8"),
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: j("src/ts/exports/react-dom.ts", "utf-8"),
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
- ], F = {
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
- }, H = {
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
- }, x = F, b = _();
127
- async function N(s = !1) {
128
- if (s) {
129
- const o = await R.prompt([
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 (!o.confirm) {
158
- w("❌ 已取消提交");
220
+ if (!r.confirm) {
221
+ S("❌ 已取消提交");
159
222
  return;
160
223
  }
161
224
  try {
162
- await b.add("."), await b.commit(`${o.type}: ${o.message}`), w("✓ git提交成功");
225
+ await T.add("."), await T.commit(`${r.type}: ${r.message}`), S("✓ git提交成功");
163
226
  } catch (t) {
164
- J(`❌ git提交失败: ${t.message}`);
227
+ x(`❌ git提交失败: ${t.message}`);
165
228
  }
166
229
  } else
167
230
  try {
168
- await b.add("."), await b.commit("chore: auto commit by MillenniumSkin"), w("✓ git提交成功");
169
- } catch (o) {
170
- J(`❌ git提交失败: ${o.message}`);
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 X = /^SharedJSContext$/, q = /^Steam$/, K = /^View Root Menu$/, Q = /^Steam Root Menu$/, W = /^Friends Root Menu$/, Y = /^Games Root Menu$/, ee = /^Help Root Menu$/, te = /^Notifications Menu$/, se = /^Account Menu$/, O = /(?<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-]*))*))?/, I = /(?:\.)?(?<tag>[a-zA-Z]+)\.(?<number>(?:[1-9]\d*|0\d*|0))/g;
174
- let p;
175
- function ae() {
176
- const s = [], o = [];
177
- let t, e, u, m;
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(r) {
182
- for (const i of k)
183
- if (i.module.test(r))
184
- return i.id;
244
+ resolveId(n) {
245
+ for (const a of M)
246
+ if (a.module.test(n))
247
+ return a.id;
185
248
  },
186
- load(r) {
187
- for (const i of k)
188
- if (r === i.id) return i.code;
249
+ load(n) {
250
+ for (const a of M)
251
+ if (n === a.id) return a.code;
189
252
  },
190
- async config(r) {
191
- if (t = (await A(
253
+ async config(n) {
254
+ if (t = (await y(
192
255
  { command: "build", mode: "profuction" },
193
256
  "skin.config.ts",
194
- r.root
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 = P;
261
+ t.Patches = $;
199
262
  }
200
- return t.Patches.forEach((n) => {
201
- n.TargetJs && s.push(l(t.srcJs, n.TargetJs)), n.TargetCss && o.push(
202
- S(l(t.srcCss, n.TargetCss))
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 && o.push(
205
- S(
206
- l(t.srcCss, t.RootColors)
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: [...s, ...o],
274
+ input: [...o, ...r],
212
275
  output: {
213
276
  entryFileNames: "assets/js/[name].js",
214
- assetFileNames: (n) => {
215
- const c = n.names[0], a = f.parse(c);
216
- return a.ext === ".css" ? `assets/css/${c}` : /\.(png|jpg|jpeg|gif|svg|webp|bmp|heic)/i.test(
217
- a.ext
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(r) {
228
- u = r, p = r.logger;
229
- const i = u.root, n = l(i, "package.json");
230
- t.version === void 0 && (t.version = x);
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 y.readFile(n, {
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 (m = await v(
302
+ if (p = await h(
240
303
  c.version,
241
304
  process.env.RELEASE
242
- ), m) {
243
- const a = m.newString;
244
- c.version = a, await y.writeFile(
245
- n,
305
+ ), p) {
306
+ const s = p.newString;
307
+ c.version = s, await R.writeFile(
308
+ i,
246
309
  JSON.stringify(c, null, 4)
247
- ), w(`${m.nativeString} -> ${a}`);
310
+ ), S(`${p.nativeString} -> ${s}`);
248
311
  }
249
- } else t.version.type === "package" && (m = await v(c.version));
312
+ } else t.version.type === "package" && (p = await h(c.version));
250
313
  } catch (c) {
251
- $(`can't use package.json: ${c}`), m = await v("0.0.0");
314
+ A(`can't use package.json: ${c}`), p = await h("0.0.0");
252
315
  }
253
316
  },
254
- generateBundle(r, i) {
317
+ generateBundle(n, a) {
255
318
  if (t.Patches === void 0)
256
319
  throw new Error("haven't any patch in building");
257
- const n = u.root, c = structuredClone(
320
+ const i = u.root, c = structuredClone(
258
321
  t.Patches
259
- ).map((a) => {
260
- if (a.Match instanceof RegExp && (a.Match = a.Match.source), a.TargetJs) {
261
- const g = f.parse(a.TargetJs);
262
- a.TargetJs = l(
263
- n,
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
- g.dir,
266
- g.name
328
+ l.dir,
329
+ l.name
267
330
  );
268
331
  }
269
- if (a.TargetCss) {
270
- const g = f.parse(a.TargetCss);
271
- a.TargetCss = l(
272
- n,
332
+ if (s.TargetCss) {
333
+ const l = w.parse(s.TargetCss);
334
+ s.TargetCss = m(
335
+ i,
273
336
  t.srcCss,
274
- g.dir,
275
- g.name
337
+ l.dir,
338
+ l.name
276
339
  );
277
340
  }
278
341
  return {
279
- MatchRegexString: a.Match,
280
- TargetJs: a.TargetJs,
281
- TargetCss: a.TargetCss
342
+ MatchRegexString: s.Match,
343
+ TargetJs: s.TargetJs,
344
+ TargetCss: s.TargetCss
282
345
  };
283
346
  });
284
- Object.entries(i).forEach(([, a]) => {
285
- const { type: g } = a, T = a.fileName;
286
- if (g === "chunk") {
287
- if (!a.facadeModuleId) return;
288
- const h = f.parse(a.facadeModuleId), M = l(
289
- h.dir,
290
- h.name
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
- M === C.TargetJs && (C.TargetJs = T);
356
+ _ === C.TargetJs && (C.TargetJs = E);
294
357
  });
295
358
  } else {
296
- const h = f.parse(
297
- l(n, a.originalFileNames[0])
298
- ), M = l(
299
- h.dir,
300
- h.name
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
- M === C.TargetCss && (C.TargetCss = T);
304
- }), t.RootColors && M === l(
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 = T);
371
+ ) && (t.RootColors = E);
309
372
  return;
310
373
  }
311
374
  }), e = {
312
375
  ...t,
313
376
  Patches: c,
314
- version: m?.newString ?? "0.0.0"
377
+ version: p?.newString ?? "0.0.0"
315
378
  };
316
379
  },
317
380
  async writeBundle() {
318
- const r = u.root;
381
+ const n = u.root;
319
382
  try {
320
- await y.writeFile(
321
- l(r, u.build.outDir, "skin.json"),
383
+ await R.writeFile(
384
+ m(n, u.build.outDir, "skin.json"),
322
385
  JSON.stringify(e, null, 4)
323
386
  );
324
- } catch (i) {
325
- throw new Error(`can't write skin.json: ${i}`);
387
+ } catch (a) {
388
+ throw new Error(`can't write skin.json: ${a}`);
326
389
  }
327
390
  },
328
- // transform(code, id) {
329
- // /**
330
- // * 别名处理, @see aliasModules
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 i = process.env.RELEASE;
405
- if (i && t.version.git[i]) {
406
- const n = t.version.git[i];
407
- n.autoCommit && await N(n.needCommitMessage);
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 oe(s) {
414
- return s;
406
+ function se(o) {
407
+ return o;
415
408
  }
416
- function S(s) {
417
- if (f.parse(s).ext !== "") return s;
409
+ function P(o) {
410
+ if (w.parse(o).ext !== "") return o;
418
411
  for (const t of ["scss", "sass", "css"]) {
419
- const e = `${s}.${t}`;
420
- if (E(l(process.cwd(), e)))
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: ${s}`);
416
+ throw new Error(`can't find css module: ${o}`);
424
417
  }
425
- async function v(s, o = null) {
418
+ async function h(o, r = null) {
426
419
  try {
427
- const t = O.exec(s);
420
+ const t = D.exec(o);
428
421
  if (!t?.groups) {
429
- $(`can't understand version: ${s}`);
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(I)
439
- ].forEach((r) => {
440
- r.groups && (e[r.groups.tag] = parseInt(r.groups.number));
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 (o) {
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: s,
492
- newString: z(e)
484
+ nativeString: o,
485
+ newString: I(e)
493
486
  };
494
487
  } catch (t) {
495
- $(`can't bump version: ${t}`);
488
+ A(`can't bump version: ${t}`);
496
489
  }
497
490
  }
498
- function z(s) {
499
- let o = `${s.major}.${s.minor}.${s.patch}`;
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 m = s[u];
504
- m != null && (e ? o += `.${u}.${m}` : (o += `-${u}.${m}`, e = !0));
496
+ const p = o[u];
497
+ p != null && (e ? r += `.${u}.${p}` : (r += `-${u}.${p}`, e = !0));
505
498
  }
506
- return o;
499
+ return r;
507
500
  }
508
- function $(s, o) {
509
- p ? p.warn(d.yellow(`[MillenniumSkin] ${s}`), o) : console.warn(d.yellow(`[MillenniumSkin] ${s}`));
501
+ function A(o, r) {
502
+ d ? d.warn(f.yellow(`[MillenniumSkin] ${o}`), r) : console.warn(f.yellow(`[MillenniumSkin] ${o}`));
510
503
  }
511
- function w(s, o) {
512
- p ? p.info(d.greenBright(`[MillenniumSkin] ${s}`), o) : console.log(d.greenBright(`[MillenniumSkin] ${s}`));
504
+ function S(o, r) {
505
+ d ? d.info(f.greenBright(`[MillenniumSkin] ${o}`), r) : console.log(f.greenBright(`[MillenniumSkin] ${o}`));
513
506
  }
514
- function J(s, o) {
515
- p ? p.error(d.redBright(`[MillenniumSkin] ${s}`), o) : console.error(d.redBright(`[MillenniumSkin] ${s}`));
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
- q as LibraryRoot,
519
- se as MenuAccount,
520
- W as MenuFriends,
521
- Y as MenuGames,
522
- ee as MenuHelp,
523
- te as MenuNotifications,
524
- Q as MenuSteam,
525
- K as MenuView,
526
- X as Root,
527
- F as __AUTO__,
528
- x as __DEFAULT__,
529
- H as __PACKAGE__,
530
- ae as default,
531
- oe as defineConfig,
532
- J as error,
533
- w as info,
534
- $ as warn
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-millennium-skin",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "main": "./dist/index.js",
5
5
  "type": "module",
6
6
  "directories": {
@@ -1,14 +1,75 @@
1
- import { readFileSync } from "fs";
2
-
3
1
  export default [
4
2
  {
5
3
  module: /^react(\/.*)?$/g,
6
- code: readFileSync("src/ts/exports/react.ts", "utf-8"),
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: readFileSync("src/ts/exports/react-dom.ts", "utf-8"),
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;
@@ -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;
@@ -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;