vite-plugin-millennium-skin 1.1.2 → 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/aliasModules.d.ts +2 -4
- package/dist/index.js +227 -259
- package/package.json +1 -1
- package/src/ts/aliasModules.ts +66 -7
- package/src/ts/index.ts +8 -139
package/dist/aliasModules.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
import y from "chalk";
|
|
10
|
-
import G from "inquirer";
|
|
11
|
-
import L from "simple-git";
|
|
12
|
-
const U = [
|
|
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 $ = [
|
|
13
9
|
{
|
|
14
10
|
Match: "https://.*.steampowered.com",
|
|
15
11
|
TargetCss: "webkit.css",
|
|
@@ -90,18 +86,80 @@ const U = [
|
|
|
90
86
|
TargetCss: "libraryroot.custom.css",
|
|
91
87
|
TargetJs: "libraryroot.custom.js"
|
|
92
88
|
}
|
|
93
|
-
],
|
|
89
|
+
], M = [
|
|
94
90
|
{
|
|
95
|
-
method: J,
|
|
96
91
|
module: /^react(\/.*)?$/g,
|
|
97
|
-
|
|
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
|
+
`,
|
|
136
|
+
id: "virtual:react"
|
|
98
137
|
},
|
|
99
138
|
{
|
|
100
|
-
method: J,
|
|
101
139
|
module: /^react-dom(\/.*)?$/g,
|
|
102
|
-
|
|
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
|
+
`,
|
|
160
|
+
id: "virtual:react-dom"
|
|
103
161
|
}
|
|
104
|
-
],
|
|
162
|
+
], N = {
|
|
105
163
|
type: "auto",
|
|
106
164
|
git: {
|
|
107
165
|
major: { autoCommit: !1 },
|
|
@@ -114,7 +172,7 @@ const U = [
|
|
|
114
172
|
alpha: { autoCommit: !0, needCommitMessage: !1 },
|
|
115
173
|
snapshot: { autoCommit: !0, needCommitMessage: !1 }
|
|
116
174
|
}
|
|
117
|
-
},
|
|
175
|
+
}, V = {
|
|
118
176
|
type: "auto",
|
|
119
177
|
git: {
|
|
120
178
|
major: { autoCommit: !1 },
|
|
@@ -127,10 +185,10 @@ const U = [
|
|
|
127
185
|
alpha: { autoCommit: !1 },
|
|
128
186
|
snapshot: { autoCommit: !1 }
|
|
129
187
|
}
|
|
130
|
-
},
|
|
131
|
-
async function
|
|
132
|
-
if (
|
|
133
|
-
const
|
|
188
|
+
}, j = N, T = O();
|
|
189
|
+
async function k(o = !1) {
|
|
190
|
+
if (o) {
|
|
191
|
+
const r = await v.prompt([
|
|
134
192
|
{
|
|
135
193
|
type: "select",
|
|
136
194
|
name: "type",
|
|
@@ -158,68 +216,68 @@ async function q(s = !1) {
|
|
|
158
216
|
default: !0
|
|
159
217
|
}
|
|
160
218
|
]);
|
|
161
|
-
if (!
|
|
162
|
-
|
|
219
|
+
if (!r.confirm) {
|
|
220
|
+
S("❌ 已取消提交");
|
|
163
221
|
return;
|
|
164
222
|
}
|
|
165
223
|
try {
|
|
166
|
-
await
|
|
224
|
+
await T.add("."), await T.commit(`${r.type}: ${r.message}`), S("✓ git提交成功");
|
|
167
225
|
} catch (t) {
|
|
168
|
-
|
|
226
|
+
x(`❌ git提交失败: ${t.message}`);
|
|
169
227
|
}
|
|
170
228
|
} else
|
|
171
229
|
try {
|
|
172
|
-
await
|
|
173
|
-
} catch (
|
|
174
|
-
|
|
230
|
+
await T.add("."), await T.commit("chore: auto commit by MillenniumSkin"), S("✓ git提交成功");
|
|
231
|
+
} catch (r) {
|
|
232
|
+
x(`❌ git提交失败: ${r.message}`);
|
|
175
233
|
}
|
|
176
234
|
}
|
|
177
|
-
const
|
|
178
|
-
let
|
|
179
|
-
function
|
|
180
|
-
const
|
|
181
|
-
let t, e,
|
|
182
|
-
const b = "virtual:millennium-skin", A = "\0" + b;
|
|
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;
|
|
183
240
|
return {
|
|
184
241
|
name: "vite-plugin-millennium-skin",
|
|
185
242
|
enforce: "pre",
|
|
186
|
-
resolveId(
|
|
187
|
-
|
|
188
|
-
|
|
243
|
+
resolveId(n) {
|
|
244
|
+
for (const a of M)
|
|
245
|
+
if (a.module.test(n))
|
|
246
|
+
return a.id;
|
|
189
247
|
},
|
|
190
|
-
load(
|
|
191
|
-
|
|
192
|
-
|
|
248
|
+
load(n) {
|
|
249
|
+
for (const a of M)
|
|
250
|
+
if (n === a.id) return a.code;
|
|
193
251
|
},
|
|
194
|
-
async config(
|
|
195
|
-
if (t = (await
|
|
252
|
+
async config(n) {
|
|
253
|
+
if (t = (await y(
|
|
196
254
|
{ command: "build", mode: "profuction" },
|
|
197
255
|
"skin.config.ts",
|
|
198
|
-
|
|
256
|
+
n.root
|
|
199
257
|
))?.config, t.Patches === void 0) {
|
|
200
258
|
if (!t.UseDefaultPatches)
|
|
201
259
|
throw new Error("haven't any patch in skin.config.ts");
|
|
202
|
-
t.Patches =
|
|
260
|
+
t.Patches = $;
|
|
203
261
|
}
|
|
204
262
|
return t.Patches.forEach((i) => {
|
|
205
|
-
i.TargetJs &&
|
|
206
|
-
|
|
263
|
+
i.TargetJs && o.push(m(t.srcJs, i.TargetJs)), i.TargetCss && r.push(
|
|
264
|
+
P(m(t.srcCss, i.TargetCss))
|
|
207
265
|
);
|
|
208
|
-
}), t.RootColors !== void 0 &&
|
|
209
|
-
|
|
210
|
-
|
|
266
|
+
}), t.RootColors !== void 0 && r.push(
|
|
267
|
+
P(
|
|
268
|
+
m(t.srcCss, t.RootColors)
|
|
211
269
|
)
|
|
212
270
|
), {
|
|
213
271
|
build: {
|
|
214
272
|
rollupOptions: {
|
|
215
|
-
input: [...
|
|
273
|
+
input: [...o, ...r],
|
|
216
274
|
output: {
|
|
217
275
|
entryFileNames: "assets/js/[name].js",
|
|
218
276
|
assetFileNames: (i) => {
|
|
219
|
-
const
|
|
220
|
-
return
|
|
221
|
-
|
|
222
|
-
) ? `assets/images/${
|
|
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
|
|
280
|
+
) ? `assets/images/${c}` : `assets/css/${c}`;
|
|
223
281
|
}
|
|
224
282
|
}
|
|
225
283
|
},
|
|
@@ -228,227 +286,139 @@ function $e() {
|
|
|
228
286
|
}
|
|
229
287
|
};
|
|
230
288
|
},
|
|
231
|
-
async configResolved(
|
|
232
|
-
|
|
233
|
-
const
|
|
234
|
-
t.version === void 0 && (t.version =
|
|
289
|
+
async configResolved(n) {
|
|
290
|
+
u = n, d = n.logger;
|
|
291
|
+
const a = u.root, i = m(a, "package.json");
|
|
292
|
+
t.version === void 0 && (t.version = j);
|
|
235
293
|
try {
|
|
236
|
-
const
|
|
237
|
-
await
|
|
294
|
+
const c = JSON.parse(
|
|
295
|
+
await R.readFile(i, {
|
|
238
296
|
flag: "r",
|
|
239
297
|
encoding: "utf-8"
|
|
240
298
|
})
|
|
241
299
|
);
|
|
242
300
|
if (t.version.type === "auto") {
|
|
243
|
-
if (
|
|
244
|
-
|
|
301
|
+
if (p = await h(
|
|
302
|
+
c.version,
|
|
245
303
|
process.env.RELEASE
|
|
246
|
-
),
|
|
247
|
-
const
|
|
248
|
-
|
|
304
|
+
), p) {
|
|
305
|
+
const s = p.newString;
|
|
306
|
+
c.version = s, await R.writeFile(
|
|
249
307
|
i,
|
|
250
|
-
JSON.stringify(
|
|
251
|
-
),
|
|
308
|
+
JSON.stringify(c, null, 4)
|
|
309
|
+
), S(`${p.nativeString} -> ${s}`);
|
|
252
310
|
}
|
|
253
|
-
} else t.version.type === "package" && (
|
|
254
|
-
} catch (
|
|
255
|
-
|
|
311
|
+
} else t.version.type === "package" && (p = await h(c.version));
|
|
312
|
+
} catch (c) {
|
|
313
|
+
A(`can't use package.json: ${c}`), p = await h("0.0.0");
|
|
256
314
|
}
|
|
257
315
|
},
|
|
258
|
-
generateBundle(
|
|
316
|
+
generateBundle(n, a) {
|
|
259
317
|
if (t.Patches === void 0)
|
|
260
318
|
throw new Error("haven't any patch in building");
|
|
261
|
-
const i =
|
|
319
|
+
const i = u.root, c = structuredClone(
|
|
262
320
|
t.Patches
|
|
263
|
-
).map((
|
|
264
|
-
if (
|
|
265
|
-
const
|
|
266
|
-
|
|
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(
|
|
267
325
|
i,
|
|
268
326
|
t.srcJs,
|
|
269
|
-
|
|
270
|
-
|
|
327
|
+
l.dir,
|
|
328
|
+
l.name
|
|
271
329
|
);
|
|
272
330
|
}
|
|
273
|
-
if (
|
|
274
|
-
const
|
|
275
|
-
|
|
331
|
+
if (s.TargetCss) {
|
|
332
|
+
const l = w.parse(s.TargetCss);
|
|
333
|
+
s.TargetCss = m(
|
|
276
334
|
i,
|
|
277
335
|
t.srcCss,
|
|
278
|
-
|
|
279
|
-
|
|
336
|
+
l.dir,
|
|
337
|
+
l.name
|
|
280
338
|
);
|
|
281
339
|
}
|
|
282
340
|
return {
|
|
283
|
-
MatchRegexString:
|
|
284
|
-
TargetJs:
|
|
285
|
-
TargetCss:
|
|
341
|
+
MatchRegexString: s.Match,
|
|
342
|
+
TargetJs: s.TargetJs,
|
|
343
|
+
TargetCss: s.TargetCss
|
|
286
344
|
};
|
|
287
345
|
});
|
|
288
|
-
Object.entries(
|
|
289
|
-
const { type:
|
|
290
|
-
if (
|
|
291
|
-
if (!
|
|
292
|
-
const
|
|
293
|
-
|
|
294
|
-
|
|
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
|
|
295
353
|
);
|
|
296
|
-
|
|
297
|
-
|
|
354
|
+
c.forEach((C) => {
|
|
355
|
+
_ === C.TargetJs && (C.TargetJs = E);
|
|
298
356
|
});
|
|
299
357
|
} else {
|
|
300
|
-
const
|
|
301
|
-
|
|
302
|
-
),
|
|
303
|
-
|
|
304
|
-
|
|
358
|
+
const g = w.parse(
|
|
359
|
+
m(i, s.originalFileNames[0])
|
|
360
|
+
), _ = m(
|
|
361
|
+
g.dir,
|
|
362
|
+
g.name
|
|
305
363
|
);
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
}), t.RootColors &&
|
|
309
|
-
|
|
364
|
+
c.forEach((C) => {
|
|
365
|
+
_ === C.TargetCss && (C.TargetCss = E);
|
|
366
|
+
}), t.RootColors && _ === m(
|
|
367
|
+
u.root,
|
|
310
368
|
t.srcCss,
|
|
311
369
|
t.RootColors
|
|
312
|
-
) && (t.RootColors =
|
|
370
|
+
) && (t.RootColors = E);
|
|
313
371
|
return;
|
|
314
372
|
}
|
|
315
373
|
}), e = {
|
|
316
374
|
...t,
|
|
317
|
-
Patches:
|
|
318
|
-
version:
|
|
375
|
+
Patches: c,
|
|
376
|
+
version: p?.newString ?? "0.0.0"
|
|
319
377
|
};
|
|
320
378
|
},
|
|
321
379
|
async writeBundle() {
|
|
322
|
-
const
|
|
380
|
+
const n = u.root;
|
|
323
381
|
try {
|
|
324
|
-
await
|
|
325
|
-
|
|
382
|
+
await R.writeFile(
|
|
383
|
+
m(n, u.build.outDir, "skin.json"),
|
|
326
384
|
JSON.stringify(e, null, 4)
|
|
327
385
|
);
|
|
328
|
-
} catch (
|
|
329
|
-
throw new Error(`can't write skin.json: ${
|
|
386
|
+
} catch (a) {
|
|
387
|
+
throw new Error(`can't write skin.json: ${a}`);
|
|
330
388
|
}
|
|
331
389
|
},
|
|
332
|
-
|
|
333
|
-
if (
|
|
334
|
-
|
|
335
|
-
sourceType: "module",
|
|
336
|
-
plugins: ["typescript", "jsx"]
|
|
337
|
-
});
|
|
338
|
-
return K(i, {
|
|
339
|
-
Program(r) {
|
|
340
|
-
const g = r.node.body, M = {};
|
|
341
|
-
for (let u = g.length - 1; u >= 0; u--) {
|
|
342
|
-
let h = g[u];
|
|
343
|
-
if (!l.isImportDeclaration(h)) continue;
|
|
344
|
-
const d = h.source.value, T = [];
|
|
345
|
-
for (const v of H) {
|
|
346
|
-
if (!v.module.test(d)) continue;
|
|
347
|
-
const { method: N } = v;
|
|
348
|
-
for (const j of h.specifiers) {
|
|
349
|
-
const x = j.local.name;
|
|
350
|
-
let S;
|
|
351
|
-
switch (j.type === "ImportDefaultSpecifier" ? S = v.links : S = [
|
|
352
|
-
...v.links,
|
|
353
|
-
j.imported.name
|
|
354
|
-
], N) {
|
|
355
|
-
case V:
|
|
356
|
-
M[x] = v.links;
|
|
357
|
-
break;
|
|
358
|
-
case J:
|
|
359
|
-
T.push(
|
|
360
|
-
ee(
|
|
361
|
-
x,
|
|
362
|
-
S
|
|
363
|
-
)
|
|
364
|
-
);
|
|
365
|
-
break;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
T.length && g.splice(u, 1, ...T);
|
|
370
|
-
}
|
|
371
|
-
Object.entries(M).forEach(
|
|
372
|
-
([u, h]) => {
|
|
373
|
-
const d = r.scope.getBinding(u);
|
|
374
|
-
d !== void 0 && (d.referencePaths.forEach((T) => {
|
|
375
|
-
te(T, u, h);
|
|
376
|
-
}), d.scope.removeOwnBinding(u));
|
|
377
|
-
}
|
|
378
|
-
);
|
|
379
|
-
}
|
|
380
|
-
}), { code: z(i).code };
|
|
381
|
-
},
|
|
382
|
-
async closeBundle(c) {
|
|
383
|
-
if (c) {
|
|
384
|
-
console.error("打包失败:", c);
|
|
390
|
+
async closeBundle(n) {
|
|
391
|
+
if (n) {
|
|
392
|
+
console.error("打包失败:", n);
|
|
385
393
|
return;
|
|
386
394
|
}
|
|
387
395
|
if (t.version?.git !== void 0) {
|
|
388
|
-
const
|
|
389
|
-
if (
|
|
390
|
-
const i = t.version.git[
|
|
391
|
-
i.autoCommit && await
|
|
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);
|
|
392
400
|
}
|
|
393
401
|
}
|
|
394
402
|
}
|
|
395
403
|
};
|
|
396
404
|
}
|
|
397
|
-
function
|
|
398
|
-
return
|
|
399
|
-
}
|
|
400
|
-
function ee(s, o) {
|
|
401
|
-
let t = l.identifier(o[0]);
|
|
402
|
-
for (let a = 1; a < o.length; a++)
|
|
403
|
-
t = l.memberExpression(t, l.identifier(o[a]));
|
|
404
|
-
const e = l.variableDeclarator(
|
|
405
|
-
l.identifier(s),
|
|
406
|
-
t
|
|
407
|
-
);
|
|
408
|
-
return l.variableDeclaration("const", [e]);
|
|
405
|
+
function se(o) {
|
|
406
|
+
return o;
|
|
409
407
|
}
|
|
410
|
-
function
|
|
411
|
-
if (w.parse(
|
|
408
|
+
function P(o) {
|
|
409
|
+
if (w.parse(o).ext !== "") return o;
|
|
412
410
|
for (const t of ["scss", "sass", "css"]) {
|
|
413
|
-
const e = `${
|
|
414
|
-
if (
|
|
411
|
+
const e = `${o}.${t}`;
|
|
412
|
+
if (b(m(process.cwd(), e)))
|
|
415
413
|
return e;
|
|
416
414
|
}
|
|
417
|
-
throw new Error(`can't find css module: ${
|
|
418
|
-
}
|
|
419
|
-
function te(s, o, t) {
|
|
420
|
-
const e = s.parent;
|
|
421
|
-
if (l.isMemberExpression(e) && e.object === s.node) {
|
|
422
|
-
const a = e.property;
|
|
423
|
-
if (l.isIdentifier(a)) {
|
|
424
|
-
const n = P(t);
|
|
425
|
-
if (!s.parentPath) return;
|
|
426
|
-
s.parentPath.replaceWith(
|
|
427
|
-
l.memberExpression(n, l.identifier(a.name))
|
|
428
|
-
);
|
|
429
|
-
}
|
|
430
|
-
return;
|
|
431
|
-
}
|
|
432
|
-
if (s.isIdentifier()) {
|
|
433
|
-
const a = P(t);
|
|
434
|
-
s.replaceWith(
|
|
435
|
-
l.memberExpression(a, l.identifier(o))
|
|
436
|
-
);
|
|
437
|
-
}
|
|
415
|
+
throw new Error(`can't find css module: ${o}`);
|
|
438
416
|
}
|
|
439
|
-
function
|
|
440
|
-
if (s.length === 0)
|
|
441
|
-
throw new Error("globalObj must not be empty");
|
|
442
|
-
let o = l.identifier(s[0]);
|
|
443
|
-
for (let t = 1; t < s.length; t++)
|
|
444
|
-
o = l.memberExpression(o, l.identifier(s[t]));
|
|
445
|
-
return o;
|
|
446
|
-
}
|
|
447
|
-
async function _(s, o = null) {
|
|
417
|
+
async function h(o, r = null) {
|
|
448
418
|
try {
|
|
449
|
-
const t =
|
|
419
|
+
const t = D.exec(o);
|
|
450
420
|
if (!t?.groups) {
|
|
451
|
-
|
|
421
|
+
A(`can't understand version: ${o}`);
|
|
452
422
|
return;
|
|
453
423
|
}
|
|
454
424
|
let e = {
|
|
@@ -457,12 +427,12 @@ async function _(s, o = null) {
|
|
|
457
427
|
patch: parseInt(t.groups.patch)
|
|
458
428
|
};
|
|
459
429
|
t.groups.preRelease && [
|
|
460
|
-
...t.groups.preRelease.matchAll(
|
|
461
|
-
].forEach((
|
|
462
|
-
|
|
430
|
+
...t.groups.preRelease.matchAll(J)
|
|
431
|
+
].forEach((n) => {
|
|
432
|
+
n.groups && (e[n.groups.tag] = parseInt(n.groups.number));
|
|
463
433
|
});
|
|
464
|
-
const
|
|
465
|
-
switch (
|
|
434
|
+
const u = { ...e };
|
|
435
|
+
switch (r) {
|
|
466
436
|
case null:
|
|
467
437
|
break;
|
|
468
438
|
case void 0:
|
|
@@ -508,52 +478,50 @@ async function _(s, o = null) {
|
|
|
508
478
|
break;
|
|
509
479
|
}
|
|
510
480
|
return {
|
|
511
|
-
native:
|
|
481
|
+
native: u,
|
|
512
482
|
new: e,
|
|
513
|
-
nativeString:
|
|
514
|
-
newString:
|
|
483
|
+
nativeString: o,
|
|
484
|
+
newString: I(e)
|
|
515
485
|
};
|
|
516
486
|
} catch (t) {
|
|
517
|
-
|
|
487
|
+
A(`can't bump version: ${t}`);
|
|
518
488
|
}
|
|
519
489
|
}
|
|
520
|
-
function
|
|
521
|
-
let
|
|
490
|
+
function I(o) {
|
|
491
|
+
let r = `${o.major}.${o.minor}.${o.patch}`;
|
|
522
492
|
const t = ["rc", "gamma", "beta", "preview", "alpha", "snapshot"];
|
|
523
493
|
let e = !1;
|
|
524
|
-
for (const
|
|
525
|
-
const
|
|
526
|
-
|
|
494
|
+
for (const u of t) {
|
|
495
|
+
const p = o[u];
|
|
496
|
+
p != null && (e ? r += `.${u}.${p}` : (r += `-${u}.${p}`, e = !0));
|
|
527
497
|
}
|
|
528
|
-
return
|
|
498
|
+
return r;
|
|
529
499
|
}
|
|
530
|
-
function
|
|
531
|
-
|
|
500
|
+
function A(o, r) {
|
|
501
|
+
d ? d.warn(f.yellow(`[MillenniumSkin] ${o}`), r) : console.warn(f.yellow(`[MillenniumSkin] ${o}`));
|
|
532
502
|
}
|
|
533
|
-
function
|
|
534
|
-
|
|
503
|
+
function S(o, r) {
|
|
504
|
+
d ? d.info(f.greenBright(`[MillenniumSkin] ${o}`), r) : console.log(f.greenBright(`[MillenniumSkin] ${o}`));
|
|
535
505
|
}
|
|
536
|
-
function
|
|
537
|
-
|
|
506
|
+
function x(o, r) {
|
|
507
|
+
d ? d.error(f.redBright(`[MillenniumSkin] ${o}`), r) : console.error(f.redBright(`[MillenniumSkin] ${o}`));
|
|
538
508
|
}
|
|
539
509
|
export {
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
k as info,
|
|
558
|
-
R 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
|
|
559
527
|
};
|
package/package.json
CHANGED
package/src/ts/aliasModules.ts
CHANGED
|
@@ -1,15 +1,74 @@
|
|
|
1
|
-
export const __DIRECT__ = 0;
|
|
2
|
-
export const __RUNTIME__ = 1;
|
|
3
|
-
|
|
4
1
|
export default [
|
|
5
2
|
{
|
|
6
|
-
method: __DIRECT__,
|
|
7
3
|
module: /^react(\/.*)?$/g,
|
|
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
|
+
`,
|
|
48
|
+
id: "virtual:react",
|
|
9
49
|
},
|
|
10
50
|
{
|
|
11
|
-
method: __DIRECT__,
|
|
12
51
|
module: /^react-dom(\/.*)?$/g,
|
|
13
|
-
|
|
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
|
+
`,
|
|
72
|
+
id: "virtual:react-dom",
|
|
14
73
|
},
|
|
15
74
|
];
|
package/src/ts/index.ts
CHANGED
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
import type { Plugin, ResolvedConfig, Logger, LogOptions } from "vite";
|
|
2
|
-
import type { Statement, MemberExpression, Identifier } from "@babel/types";
|
|
3
2
|
import type { autoCommitLevel, versionConfig } from "./versionConfig";
|
|
4
|
-
import type { NodePath } from "@babel/traverse";
|
|
5
|
-
import t from "@babel/types";
|
|
6
|
-
import { parse } from "@babel/parser";
|
|
7
|
-
import traverse from "@babel/traverse";
|
|
8
|
-
import { generate } from "@babel/generator";
|
|
9
3
|
import path, { join } from "path/posix";
|
|
10
4
|
import { existsSync } from "fs";
|
|
11
5
|
import fsp from "fs/promises";
|
|
12
6
|
import { loadConfigFromFile } from "vite";
|
|
13
7
|
import chalk from "chalk";
|
|
14
8
|
import defaultPatches from "./defaultPatches";
|
|
15
|
-
import aliasModules
|
|
9
|
+
import aliasModules from "./aliasModules";
|
|
16
10
|
import { __DEFAULT__ } from "./versionConfig";
|
|
17
11
|
import { gitCommit } from "./git";
|
|
18
12
|
|
|
@@ -103,7 +97,7 @@ export type versionObject = {
|
|
|
103
97
|
snapshot?: number;
|
|
104
98
|
};
|
|
105
99
|
|
|
106
|
-
const traver = (traverse as any).default as typeof traverse;
|
|
100
|
+
// const traver = (traverse as any).default as typeof traverse;
|
|
107
101
|
const SEMANTIC_VERSIONING_REGEXP =
|
|
108
102
|
/(?<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-]*))*))?/;
|
|
109
103
|
const SEMANTIC_TAGS_REGEXP =
|
|
@@ -117,21 +111,21 @@ export default function millenniumSkin(): Plugin {
|
|
|
117
111
|
let skinConfigResult: SkinConfigResult;
|
|
118
112
|
let viteConfig: ResolvedConfig;
|
|
119
113
|
let versions: bumpResult | undefined;
|
|
120
|
-
const virtualModuleId = "virtual:millennium-skin";
|
|
121
|
-
const resolvedVirtualModuleId = "\0" + virtualModuleId;
|
|
122
114
|
return {
|
|
123
115
|
name: "vite-plugin-millennium-skin",
|
|
124
116
|
enforce: "pre",
|
|
125
117
|
|
|
126
118
|
resolveId(source) {
|
|
127
|
-
|
|
128
|
-
|
|
119
|
+
for (const aliasMod of aliasModules) {
|
|
120
|
+
if (aliasMod.module.test(source)) {
|
|
121
|
+
return aliasMod.id;
|
|
122
|
+
}
|
|
129
123
|
}
|
|
130
124
|
},
|
|
131
125
|
|
|
132
126
|
load(id) {
|
|
133
|
-
|
|
134
|
-
|
|
127
|
+
for (const aliasMod of aliasModules) {
|
|
128
|
+
if (id === aliasMod.id) return aliasMod.code;
|
|
135
129
|
}
|
|
136
130
|
},
|
|
137
131
|
|
|
@@ -329,84 +323,6 @@ export default function millenniumSkin(): Plugin {
|
|
|
329
323
|
}
|
|
330
324
|
},
|
|
331
325
|
|
|
332
|
-
transform(code, id) {
|
|
333
|
-
/**
|
|
334
|
-
* 别名处理, @see aliasModules
|
|
335
|
-
*/
|
|
336
|
-
if (!/.+\.(js|ts|tsx)$/g.test(id)) return;
|
|
337
|
-
|
|
338
|
-
const ast = parse(code, {
|
|
339
|
-
sourceType: "module",
|
|
340
|
-
plugins: ["typescript", "jsx"],
|
|
341
|
-
});
|
|
342
|
-
traver(ast, {
|
|
343
|
-
Program(path) {
|
|
344
|
-
const body = path.node.body;
|
|
345
|
-
|
|
346
|
-
const runtimeLinks: Record<string, string[]> = {};
|
|
347
|
-
// 处理静态引入别名,收集动态引入别名
|
|
348
|
-
for (let i = body.length - 1; i >= 0; i--) {
|
|
349
|
-
let node = body[i];
|
|
350
|
-
if (!t.isImportDeclaration(node)) continue;
|
|
351
|
-
|
|
352
|
-
const moduleName: string = node.source.value;
|
|
353
|
-
|
|
354
|
-
const match: Statement[] = [];
|
|
355
|
-
for (const aliasMod of aliasModules) {
|
|
356
|
-
if (!aliasMod.module.test(moduleName)) continue;
|
|
357
|
-
const { method } = aliasMod;
|
|
358
|
-
|
|
359
|
-
for (const local of node.specifiers) {
|
|
360
|
-
const exportLocal = local.local.name;
|
|
361
|
-
let links: string[];
|
|
362
|
-
if (local.type === "ImportDefaultSpecifier")
|
|
363
|
-
// 默认导出
|
|
364
|
-
links = aliasMod.links;
|
|
365
|
-
else
|
|
366
|
-
// 指定导出
|
|
367
|
-
links = [
|
|
368
|
-
...aliasMod.links,
|
|
369
|
-
(local as any).imported.name,
|
|
370
|
-
];
|
|
371
|
-
|
|
372
|
-
switch (method) {
|
|
373
|
-
case __RUNTIME__:
|
|
374
|
-
runtimeLinks[exportLocal] =
|
|
375
|
-
aliasMod.links;
|
|
376
|
-
break;
|
|
377
|
-
case __DIRECT__:
|
|
378
|
-
match.push(
|
|
379
|
-
generateConstDeclaration(
|
|
380
|
-
exportLocal,
|
|
381
|
-
links,
|
|
382
|
-
),
|
|
383
|
-
);
|
|
384
|
-
break;
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
if (match.length) {
|
|
389
|
-
body.splice(i, 1, ...match);
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
// 处理动态引入
|
|
393
|
-
Object.entries(runtimeLinks).forEach(
|
|
394
|
-
([localName, runtimeLink]) => {
|
|
395
|
-
const binding = path.scope.getBinding(localName);
|
|
396
|
-
if (binding === undefined) return;
|
|
397
|
-
|
|
398
|
-
binding.referencePaths.forEach((refPath) => {
|
|
399
|
-
replaceRef(refPath, localName, runtimeLink);
|
|
400
|
-
});
|
|
401
|
-
binding.scope.removeOwnBinding(localName);
|
|
402
|
-
},
|
|
403
|
-
);
|
|
404
|
-
},
|
|
405
|
-
});
|
|
406
|
-
const result = generate(ast);
|
|
407
|
-
return { code: result.code };
|
|
408
|
-
},
|
|
409
|
-
|
|
410
326
|
async closeBundle(error?: Error) {
|
|
411
327
|
if (error) {
|
|
412
328
|
console.error("打包失败:", error);
|
|
@@ -432,18 +348,6 @@ export function defineConfig(SkinConfig: SkinConfig): SkinConfig {
|
|
|
432
348
|
return SkinConfig;
|
|
433
349
|
}
|
|
434
350
|
|
|
435
|
-
function generateConstDeclaration(moduleName: string, links: string[]) {
|
|
436
|
-
let expression: t.Identifier | t.MemberExpression = t.identifier(links[0]);
|
|
437
|
-
for (let i = 1; i < links.length; i++) {
|
|
438
|
-
expression = t.memberExpression(expression, t.identifier(links[i]));
|
|
439
|
-
}
|
|
440
|
-
const declarator = t.variableDeclarator(
|
|
441
|
-
t.identifier(moduleName),
|
|
442
|
-
expression,
|
|
443
|
-
);
|
|
444
|
-
return t.variableDeclaration("const", [declarator]);
|
|
445
|
-
}
|
|
446
|
-
|
|
447
351
|
function findCssModule(cssPath: string): string {
|
|
448
352
|
const parsed = path.parse(cssPath);
|
|
449
353
|
if (parsed.ext !== "") return cssPath;
|
|
@@ -456,41 +360,6 @@ function findCssModule(cssPath: string): string {
|
|
|
456
360
|
throw new Error(`can't find css module: ${cssPath}`);
|
|
457
361
|
}
|
|
458
362
|
|
|
459
|
-
function replaceRef(refPath: NodePath, localName: string, globalObj: string[]) {
|
|
460
|
-
const parent = refPath.parent;
|
|
461
|
-
|
|
462
|
-
if (t.isMemberExpression(parent) && parent.object === refPath.node) {
|
|
463
|
-
const prop = parent.property;
|
|
464
|
-
if (t.isIdentifier(prop)) {
|
|
465
|
-
const globalMember = createNestedMemberExpression(globalObj);
|
|
466
|
-
if (!refPath.parentPath) return;
|
|
467
|
-
refPath.parentPath.replaceWith(
|
|
468
|
-
t.memberExpression(globalMember, t.identifier(prop.name)),
|
|
469
|
-
);
|
|
470
|
-
}
|
|
471
|
-
return;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
if (refPath.isIdentifier()) {
|
|
475
|
-
const globalMember = createNestedMemberExpression(globalObj);
|
|
476
|
-
refPath.replaceWith(
|
|
477
|
-
t.memberExpression(globalMember, t.identifier(localName)),
|
|
478
|
-
);
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
function createNestedMemberExpression(globalObj: string[]): t.MemberExpression {
|
|
483
|
-
if (globalObj.length === 0) {
|
|
484
|
-
throw new Error("globalObj must not be empty");
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
let node: Identifier | MemberExpression = t.identifier(globalObj[0]);
|
|
488
|
-
for (let i = 1; i < globalObj.length; i++) {
|
|
489
|
-
node = t.memberExpression(node, t.identifier(globalObj[i]));
|
|
490
|
-
}
|
|
491
|
-
return node as t.MemberExpression;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
363
|
type bumpResult = {
|
|
495
364
|
native: versionObject;
|
|
496
365
|
new: versionObject;
|