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 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,80 @@ 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 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: j("src/ts/exports/react-dom.ts", "utf-8"),
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
- ], F = {
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
- }, H = {
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
- }, x = F, b = _();
127
- async function N(s = !1) {
128
- if (s) {
129
- const o = await R.prompt([
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 (!o.confirm) {
158
- w("❌ 已取消提交");
219
+ if (!r.confirm) {
220
+ S("❌ 已取消提交");
159
221
  return;
160
222
  }
161
223
  try {
162
- await b.add("."), await b.commit(`${o.type}: ${o.message}`), w("✓ git提交成功");
224
+ await T.add("."), await T.commit(`${r.type}: ${r.message}`), S("✓ git提交成功");
163
225
  } catch (t) {
164
- J(`❌ git提交失败: ${t.message}`);
226
+ x(`❌ git提交失败: ${t.message}`);
165
227
  }
166
228
  } else
167
229
  try {
168
- await b.add("."), await b.commit("chore: auto commit by MillenniumSkin"), w("✓ git提交成功");
169
- } catch (o) {
170
- J(`❌ git提交失败: ${o.message}`);
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 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;
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(r) {
182
- for (const i of k)
183
- if (i.module.test(r))
184
- return i.id;
243
+ resolveId(n) {
244
+ for (const a of M)
245
+ if (a.module.test(n))
246
+ return a.id;
185
247
  },
186
- load(r) {
187
- for (const i of k)
188
- if (r === i.id) return i.code;
248
+ load(n) {
249
+ for (const a of M)
250
+ if (n === a.id) return a.code;
189
251
  },
190
- async config(r) {
191
- if (t = (await A(
252
+ async config(n) {
253
+ if (t = (await y(
192
254
  { command: "build", mode: "profuction" },
193
255
  "skin.config.ts",
194
- r.root
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 = P;
260
+ t.Patches = $;
199
261
  }
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))
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 && o.push(
205
- S(
206
- l(t.srcCss, t.RootColors)
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: [...s, ...o],
273
+ input: [...o, ...r],
212
274
  output: {
213
275
  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
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(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);
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 y.readFile(n, {
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 (m = await v(
301
+ if (p = await h(
240
302
  c.version,
241
303
  process.env.RELEASE
242
- ), m) {
243
- const a = m.newString;
244
- c.version = a, await y.writeFile(
245
- n,
304
+ ), p) {
305
+ const s = p.newString;
306
+ c.version = s, await R.writeFile(
307
+ i,
246
308
  JSON.stringify(c, null, 4)
247
- ), w(`${m.nativeString} -> ${a}`);
309
+ ), S(`${p.nativeString} -> ${s}`);
248
310
  }
249
- } else t.version.type === "package" && (m = await v(c.version));
311
+ } else t.version.type === "package" && (p = await h(c.version));
250
312
  } catch (c) {
251
- $(`can't use package.json: ${c}`), m = await v("0.0.0");
313
+ A(`can't use package.json: ${c}`), p = await h("0.0.0");
252
314
  }
253
315
  },
254
- generateBundle(r, i) {
316
+ generateBundle(n, a) {
255
317
  if (t.Patches === void 0)
256
318
  throw new Error("haven't any patch in building");
257
- const n = u.root, c = structuredClone(
319
+ const i = u.root, c = structuredClone(
258
320
  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,
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
- g.dir,
266
- g.name
327
+ l.dir,
328
+ l.name
267
329
  );
268
330
  }
269
- if (a.TargetCss) {
270
- const g = f.parse(a.TargetCss);
271
- a.TargetCss = l(
272
- n,
331
+ if (s.TargetCss) {
332
+ const l = w.parse(s.TargetCss);
333
+ s.TargetCss = m(
334
+ i,
273
335
  t.srcCss,
274
- g.dir,
275
- g.name
336
+ l.dir,
337
+ l.name
276
338
  );
277
339
  }
278
340
  return {
279
- MatchRegexString: a.Match,
280
- TargetJs: a.TargetJs,
281
- TargetCss: a.TargetCss
341
+ MatchRegexString: s.Match,
342
+ TargetJs: s.TargetJs,
343
+ TargetCss: s.TargetCss
282
344
  };
283
345
  });
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
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
- M === C.TargetJs && (C.TargetJs = T);
355
+ _ === C.TargetJs && (C.TargetJs = E);
294
356
  });
295
357
  } else {
296
- const h = f.parse(
297
- l(n, a.originalFileNames[0])
298
- ), M = l(
299
- h.dir,
300
- h.name
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
- M === C.TargetCss && (C.TargetCss = T);
304
- }), t.RootColors && M === l(
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 = T);
370
+ ) && (t.RootColors = E);
309
371
  return;
310
372
  }
311
373
  }), e = {
312
374
  ...t,
313
375
  Patches: c,
314
- version: m?.newString ?? "0.0.0"
376
+ version: p?.newString ?? "0.0.0"
315
377
  };
316
378
  },
317
379
  async writeBundle() {
318
- const r = u.root;
380
+ const n = u.root;
319
381
  try {
320
- await y.writeFile(
321
- l(r, u.build.outDir, "skin.json"),
382
+ await R.writeFile(
383
+ m(n, u.build.outDir, "skin.json"),
322
384
  JSON.stringify(e, null, 4)
323
385
  );
324
- } catch (i) {
325
- throw new Error(`can't write skin.json: ${i}`);
386
+ } catch (a) {
387
+ throw new Error(`can't write skin.json: ${a}`);
326
388
  }
327
389
  },
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);
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 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);
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 oe(s) {
414
- return s;
405
+ function se(o) {
406
+ return o;
415
407
  }
416
- function S(s) {
417
- if (f.parse(s).ext !== "") return s;
408
+ function P(o) {
409
+ if (w.parse(o).ext !== "") return o;
418
410
  for (const t of ["scss", "sass", "css"]) {
419
- const e = `${s}.${t}`;
420
- if (E(l(process.cwd(), e)))
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: ${s}`);
415
+ throw new Error(`can't find css module: ${o}`);
424
416
  }
425
- async function v(s, o = null) {
417
+ async function h(o, r = null) {
426
418
  try {
427
- const t = O.exec(s);
419
+ const t = D.exec(o);
428
420
  if (!t?.groups) {
429
- $(`can't understand version: ${s}`);
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(I)
439
- ].forEach((r) => {
440
- r.groups && (e[r.groups.tag] = parseInt(r.groups.number));
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 (o) {
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: s,
492
- newString: z(e)
483
+ nativeString: o,
484
+ newString: I(e)
493
485
  };
494
486
  } catch (t) {
495
- $(`can't bump version: ${t}`);
487
+ A(`can't bump version: ${t}`);
496
488
  }
497
489
  }
498
- function z(s) {
499
- let o = `${s.major}.${s.minor}.${s.patch}`;
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 m = s[u];
504
- m != null && (e ? o += `.${u}.${m}` : (o += `-${u}.${m}`, e = !0));
495
+ const p = o[u];
496
+ p != null && (e ? r += `.${u}.${p}` : (r += `-${u}.${p}`, e = !0));
505
497
  }
506
- return o;
498
+ return r;
507
499
  }
508
- function $(s, o) {
509
- p ? p.warn(d.yellow(`[MillenniumSkin] ${s}`), o) : console.warn(d.yellow(`[MillenniumSkin] ${s}`));
500
+ function A(o, r) {
501
+ d ? d.warn(f.yellow(`[MillenniumSkin] ${o}`), r) : console.warn(f.yellow(`[MillenniumSkin] ${o}`));
510
502
  }
511
- function w(s, o) {
512
- p ? p.info(d.greenBright(`[MillenniumSkin] ${s}`), o) : console.log(d.greenBright(`[MillenniumSkin] ${s}`));
503
+ function S(o, r) {
504
+ d ? d.info(f.greenBright(`[MillenniumSkin] ${o}`), r) : console.log(f.greenBright(`[MillenniumSkin] ${o}`));
513
505
  }
514
- function J(s, o) {
515
- p ? p.error(d.redBright(`[MillenniumSkin] ${s}`), o) : console.error(d.redBright(`[MillenniumSkin] ${s}`));
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
- 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
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-millennium-skin",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "main": "./dist/index.js",
5
5
  "type": "module",
6
6
  "directories": {
@@ -1,14 +1,74 @@
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 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: readFileSync("src/ts/exports/react-dom.ts", "utf-8"),
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;
@@ -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;