vite-plugin-millennium-skin 1.1.6 → 1.1.8

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