@lynx-js/qrcode-rsbuild-plugin 0.4.2 → 0.4.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/CHANGELOG.md +12 -0
- package/dist/390.js +170 -0
- package/dist/760.js +939 -0
- package/dist/8.js +2058 -0
- package/dist/generateDevUrls.d.ts +0 -3
- package/dist/index.d.ts +0 -3
- package/dist/index.js +1 -213
- package/dist/rslib-runtime.js +38 -0
- package/dist/shortcuts.d.ts +0 -3
- package/dist/shortcuts.js +1 -208
- package/package.json +5 -5
- package/dist/472.js +0 -940
- package/dist/543.js +0 -45
- package/dist/640.js +0 -30
- package/dist/759.js +0 -2005
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @lynx-js/qrcode-rsbuild-plugin
|
|
2
2
|
|
|
3
|
+
## 0.4.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Bump `@clack/prompts` v1.0 ([#2171](https://github.com/lynx-family/lynx-stack/pull/2171))
|
|
8
|
+
|
|
9
|
+
## 0.4.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- fix: print out the output chunk urls ([#1921](https://github.com/lynx-family/lynx-stack/pull/1921))
|
|
14
|
+
|
|
3
15
|
## 0.4.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/390.js
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
function generateDevUrls(api, entry, schemaFn, port) {
|
|
2
|
+
const { dev: { assetPrefix } } = api.getNormalizedConfig();
|
|
3
|
+
const { config } = api.useExposed(Symbol.for('rspeedy.api'));
|
|
4
|
+
if ('string' != typeof assetPrefix) {
|
|
5
|
+
const errorMsg = 'dev.assetPrefix is not string, skip printing QRCode';
|
|
6
|
+
throw new Error(errorMsg);
|
|
7
|
+
}
|
|
8
|
+
const defaultFilename = '[name].[platform].bundle';
|
|
9
|
+
const { filename } = config.output ?? {};
|
|
10
|
+
let name;
|
|
11
|
+
name = filename ? 'object' == typeof filename ? filename.bundle ?? filename.template ?? defaultFilename : filename : defaultFilename;
|
|
12
|
+
const customSchema = schemaFn(new URL(name.replace('[name]', entry).replace('[platform]', 'lynx'), assetPrefix.replaceAll('<port>', String(port))).toString());
|
|
13
|
+
return 'string' == typeof customSchema ? {
|
|
14
|
+
default: customSchema
|
|
15
|
+
} : customSchema;
|
|
16
|
+
}
|
|
17
|
+
const gExistingShortcuts = new WeakSet();
|
|
18
|
+
async function registerConsoleShortcuts(options) {
|
|
19
|
+
const [{ default: showQRCode }] = await Promise.all([
|
|
20
|
+
import("./760.js").then((mod)=>({
|
|
21
|
+
default: mod.showQRCode
|
|
22
|
+
}))
|
|
23
|
+
]);
|
|
24
|
+
const currentEntry = options.entries[0];
|
|
25
|
+
const devUrls = generateDevUrls(options.api, currentEntry, options.schema, options.port);
|
|
26
|
+
const value = Object.values(devUrls)[0];
|
|
27
|
+
await options.onPrint?.(value);
|
|
28
|
+
showQRCode(value);
|
|
29
|
+
gExistingShortcuts.add(options);
|
|
30
|
+
loop(options, value, devUrls);
|
|
31
|
+
function off() {
|
|
32
|
+
gExistingShortcuts.delete(options);
|
|
33
|
+
}
|
|
34
|
+
return off;
|
|
35
|
+
}
|
|
36
|
+
async function loop(options, value, devUrls) {
|
|
37
|
+
const [{ autocomplete, select, selectKey, isCancel, cancel }, { default: showQRCode }] = await Promise.all([
|
|
38
|
+
import("./8.js").then((mod)=>({
|
|
39
|
+
S_BAR: mod.dist_h,
|
|
40
|
+
S_BAR_END: mod.dist_x,
|
|
41
|
+
S_BAR_END_RIGHT: mod.Oe,
|
|
42
|
+
S_BAR_H: mod.se,
|
|
43
|
+
S_BAR_START: mod.$e,
|
|
44
|
+
S_BAR_START_RIGHT: mod.Re,
|
|
45
|
+
S_CHECKBOX_ACTIVE: mod.te,
|
|
46
|
+
S_CHECKBOX_INACTIVE: mod.dist_z,
|
|
47
|
+
S_CHECKBOX_SELECTED: mod.dist_G,
|
|
48
|
+
S_CONNECT_LEFT: mod.Ne,
|
|
49
|
+
S_CORNER_BOTTOM_LEFT: mod.pe,
|
|
50
|
+
S_CORNER_BOTTOM_RIGHT: mod.me,
|
|
51
|
+
S_CORNER_TOP_LEFT: mod.We,
|
|
52
|
+
S_CORNER_TOP_RIGHT: mod.he,
|
|
53
|
+
S_ERROR: mod.ye,
|
|
54
|
+
S_INFO: mod.ge,
|
|
55
|
+
S_PASSWORD_MASK: mod.Pe,
|
|
56
|
+
S_RADIO_ACTIVE: mod.dist_Y,
|
|
57
|
+
S_RADIO_INACTIVE: mod.dist_K,
|
|
58
|
+
S_STEP_ACTIVE: mod.Me,
|
|
59
|
+
S_STEP_CANCEL: mod.ce,
|
|
60
|
+
S_STEP_ERROR: mod.de,
|
|
61
|
+
S_STEP_SUBMIT: mod.k,
|
|
62
|
+
S_SUCCESS: mod.fe,
|
|
63
|
+
S_WARN: mod.Fe,
|
|
64
|
+
autocomplete: mod.Je,
|
|
65
|
+
autocompleteMultiselect: mod.dist_bt,
|
|
66
|
+
box: mod.dist_Tt,
|
|
67
|
+
cancel: mod.Pt,
|
|
68
|
+
confirm: mod.dist_Mt,
|
|
69
|
+
group: mod.Rt,
|
|
70
|
+
groupMultiselect: mod.Ot,
|
|
71
|
+
intro: mod.Nt,
|
|
72
|
+
isCI: mod.ue,
|
|
73
|
+
isCancel: mod.Ct,
|
|
74
|
+
isTTY: mod.Te,
|
|
75
|
+
limitOptions: mod.J,
|
|
76
|
+
log: mod.R,
|
|
77
|
+
multiselect: mod.dist_Lt,
|
|
78
|
+
note: mod.dist_kt,
|
|
79
|
+
outro: mod.dist_Wt,
|
|
80
|
+
password: mod.Gt,
|
|
81
|
+
path: mod.Ht,
|
|
82
|
+
progress: mod.Kt,
|
|
83
|
+
select: mod.qt,
|
|
84
|
+
selectKey: mod.Jt,
|
|
85
|
+
settings: mod.dist_,
|
|
86
|
+
spinner: mod.Ie,
|
|
87
|
+
stream: mod.dist_H,
|
|
88
|
+
symbol: mod.N,
|
|
89
|
+
symbolBar: mod.Ee,
|
|
90
|
+
taskLog: mod.zt,
|
|
91
|
+
tasks: mod.Xt,
|
|
92
|
+
text: mod.Qt,
|
|
93
|
+
unicode: mod.ee,
|
|
94
|
+
unicodeOr: mod.w,
|
|
95
|
+
updateSettings: mod.It
|
|
96
|
+
})),
|
|
97
|
+
import("./760.js").then((mod)=>({
|
|
98
|
+
default: mod.showQRCode
|
|
99
|
+
}))
|
|
100
|
+
]);
|
|
101
|
+
const selectFn = (length)=>length > 5 ? autocomplete : select;
|
|
102
|
+
let currentEntry = options.entries[0];
|
|
103
|
+
let currentSchema = Object.keys(devUrls)[0];
|
|
104
|
+
while(!isCancel(value)){
|
|
105
|
+
const name = await selectKey({
|
|
106
|
+
message: 'Usage',
|
|
107
|
+
options: [
|
|
108
|
+
{
|
|
109
|
+
value: 'r',
|
|
110
|
+
label: 'Switch entries'
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
value: 'a',
|
|
114
|
+
label: 'Switch schema'
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
value: 'h',
|
|
118
|
+
label: 'Help'
|
|
119
|
+
},
|
|
120
|
+
...Object.values(options.customShortcuts ?? {}),
|
|
121
|
+
{
|
|
122
|
+
value: 'q',
|
|
123
|
+
label: 'Quit'
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
initialValue: 'q'
|
|
127
|
+
});
|
|
128
|
+
if (isCancel(name) || 'q' === name || !gExistingShortcuts.has(options)) break;
|
|
129
|
+
if ('r' === name) {
|
|
130
|
+
const selection = await selectFn(options.entries.length)({
|
|
131
|
+
message: 'Select entry',
|
|
132
|
+
options: options.entries.map((entry)=>({
|
|
133
|
+
value: entry,
|
|
134
|
+
label: entry,
|
|
135
|
+
hint: generateDevUrls(options.api, entry, options.schema, options.port)[currentSchema]
|
|
136
|
+
})),
|
|
137
|
+
initialValue: currentEntry
|
|
138
|
+
});
|
|
139
|
+
if (isCancel(selection)) break;
|
|
140
|
+
currentEntry = selection;
|
|
141
|
+
value = getCurrentUrl();
|
|
142
|
+
} else if ('a' === name) {
|
|
143
|
+
const devUrls = generateDevUrls(options.api, currentEntry, options.schema, options.port);
|
|
144
|
+
const selection = await selectFn(Object.keys(devUrls).length)({
|
|
145
|
+
message: 'Select schema',
|
|
146
|
+
options: Object.entries(devUrls).map(([name, url])=>({
|
|
147
|
+
value: name,
|
|
148
|
+
label: name,
|
|
149
|
+
hint: url
|
|
150
|
+
})),
|
|
151
|
+
initialValue: currentSchema
|
|
152
|
+
});
|
|
153
|
+
if (isCancel(selection)) break;
|
|
154
|
+
currentSchema = selection;
|
|
155
|
+
value = getCurrentUrl();
|
|
156
|
+
} else if (options.customShortcuts?.[name]) await options.customShortcuts[name].action?.();
|
|
157
|
+
await options.onPrint?.(value);
|
|
158
|
+
showQRCode(value);
|
|
159
|
+
}
|
|
160
|
+
if (gExistingShortcuts.has(options)) await exit(1);
|
|
161
|
+
function getCurrentUrl() {
|
|
162
|
+
return generateDevUrls(options.api, currentEntry, options.schema, options.port)[currentSchema];
|
|
163
|
+
}
|
|
164
|
+
function exit(code) {
|
|
165
|
+
cancel('exiting...');
|
|
166
|
+
const { exit } = options.api.useExposed(Symbol.for('rspeedy.api'));
|
|
167
|
+
return exit(code);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
export { registerConsoleShortcuts };
|