@lynx-js/qrcode-rsbuild-plugin 0.3.5 → 0.4.0

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/640.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export const __webpack_ids__ = [
2
- '640'
2
+ "640"
3
3
  ];
4
4
  export const __webpack_modules__ = {
5
5
  "../../../node_modules/.pnpm/uqr@0.1.2/node_modules/uqr/dist/index.mjs": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
package/dist/index.d.ts CHANGED
@@ -22,7 +22,7 @@ export interface PluginQRCodeOptions {
22
22
  * @example
23
23
  *
24
24
  * ```js
25
- * import { pluginQRCode } from '@lynx-js/plugin-qrcode'
25
+ * import { pluginQRCode } from '@lynx-js/qrcode-rsbuild-plugin'
26
26
  * import { defineConfig } from '@lynx-js/rspeedy'
27
27
  *
28
28
  * export default defineConfig({
@@ -43,7 +43,7 @@ export interface PluginQRCodeOptions {
43
43
  * You may press `a` in the terminal to switch between schemas.
44
44
  *
45
45
  * ```js
46
- * import { pluginQRCode } from '@lynx-js/plugin-qrcode'
46
+ * import { pluginQRCode } from '@lynx-js/qrcode-rsbuild-plugin'
47
47
  * import { defineConfig } from '@lynx-js/rspeedy'
48
48
  *
49
49
  * export default defineConfig({
package/dist/index.js CHANGED
@@ -1,8 +1,16 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
1
3
  import * as __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__ from "node:process";
2
4
  import * as __WEBPACK_EXTERNAL_MODULE_node_readline_91c31510__ from "node:readline";
3
5
  import * as __WEBPACK_EXTERNAL_MODULE_node_tty_c64aab7e__ from "node:tty";
4
6
  import * as __WEBPACK_EXTERNAL_MODULE_node_util_1b29d436__ from "node:util";
5
7
  var __webpack_modules__ = {
8
+ "node:fs": function(module) {
9
+ module.exports = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__;
10
+ },
11
+ "node:path": function(module) {
12
+ module.exports = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__;
13
+ },
6
14
  "node:process": function(module) {
7
15
  module.exports = __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__;
8
16
  },
@@ -124,9 +132,9 @@ const gExistingShortcuts = new WeakSet();
124
132
  async function registerConsoleShortcuts(options) {
125
133
  const [{ default: showQRCode }] = await Promise.all([
126
134
  Promise.all([
127
- __webpack_require__.e("517"),
135
+ __webpack_require__.e("441"),
128
136
  __webpack_require__.e("640"),
129
- __webpack_require__.e("113")
137
+ __webpack_require__.e("204")
130
138
  ]).then(__webpack_require__.bind(__webpack_require__, "./src/showQRCode.ts"))
131
139
  ]);
132
140
  const currentEntry = options.entries[0];
@@ -142,14 +150,15 @@ async function registerConsoleShortcuts(options) {
142
150
  return off;
143
151
  }
144
152
  async function loop(options, value, devUrls) {
145
- const [{ select, selectKey, isCancel, cancel }, { default: showQRCode }] = await Promise.all([
146
- __webpack_require__.e("517").then(__webpack_require__.bind(__webpack_require__, "../../../node_modules/.pnpm/@clack+prompts@0.10.0/node_modules/@clack/prompts/dist/index.mjs")),
153
+ const [{ autocomplete, select, selectKey, isCancel, cancel }, { default: showQRCode }] = await Promise.all([
154
+ __webpack_require__.e("441").then(__webpack_require__.bind(__webpack_require__, "../../../node_modules/.pnpm/@clack+prompts@1.0.0-alpha.1/node_modules/@clack/prompts/dist/index.mjs")),
147
155
  Promise.all([
148
- __webpack_require__.e("517"),
156
+ __webpack_require__.e("441"),
149
157
  __webpack_require__.e("640"),
150
- __webpack_require__.e("113")
158
+ __webpack_require__.e("204")
151
159
  ]).then(__webpack_require__.bind(__webpack_require__, "./src/showQRCode.ts"))
152
160
  ]);
161
+ const selectFn = (length)=>length > 5 ? autocomplete : select;
153
162
  let currentEntry = options.entries[0];
154
163
  let currentSchema = Object.keys(devUrls)[0];
155
164
  while(!isCancel(value)){
@@ -178,7 +187,7 @@ async function loop(options, value, devUrls) {
178
187
  });
179
188
  if (isCancel(name) || 'q' === name || !gExistingShortcuts.has(options)) break;
180
189
  if ('r' === name) {
181
- const selection = await select({
190
+ const selection = await selectFn(options.entries.length)({
182
191
  message: 'Select entry',
183
192
  options: options.entries.map((entry)=>({
184
193
  value: entry,
@@ -192,7 +201,7 @@ async function loop(options, value, devUrls) {
192
201
  value = getCurrentUrl();
193
202
  } else if ('a' === name) {
194
203
  const devUrls = generateDevUrls(options.api, currentEntry, options.schema, options.port);
195
- const selection = await select({
204
+ const selection = await selectFn(Object.keys(devUrls).length)({
196
205
  message: 'Select schema',
197
206
  options: Object.entries(devUrls).map(([name, url])=>({
198
207
  value: name,
@@ -234,10 +243,12 @@ function pluginQRCode(options) {
234
243
  api.onAfterStartProdServer(async ({ environments, port })=>{
235
244
  await main(environments['lynx'], port);
236
245
  });
237
- api.onDevCompileDone(async ({ isFirstCompile, stats, environments })=>{
246
+ let printedQRCode = false;
247
+ api.onDevCompileDone(async ({ stats, environments })=>{
238
248
  if (!api.context.devServer) return;
239
- if (!isFirstCompile) return;
240
249
  if (stats.hasErrors()) return;
250
+ if (printedQRCode) return;
251
+ printedQRCode = true;
241
252
  await main(environments['lynx'], api.context.devServer.port);
242
253
  });
243
254
  api.modifyRsbuildConfig((config)=>{
package/dist/shortcuts.js CHANGED
@@ -1,8 +1,16 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
1
3
  import * as __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__ from "node:process";
2
4
  import * as __WEBPACK_EXTERNAL_MODULE_node_readline_91c31510__ from "node:readline";
3
5
  import * as __WEBPACK_EXTERNAL_MODULE_node_tty_c64aab7e__ from "node:tty";
4
6
  import * as __WEBPACK_EXTERNAL_MODULE_node_util_1b29d436__ from "node:util";
5
7
  var __webpack_modules__ = {
8
+ "node:fs": function(module) {
9
+ module.exports = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__;
10
+ },
11
+ "node:path": function(module) {
12
+ module.exports = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__;
13
+ },
6
14
  "node:process": function(module) {
7
15
  module.exports = __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__;
8
16
  },
@@ -124,9 +132,9 @@ const gExistingShortcuts = new WeakSet();
124
132
  async function registerConsoleShortcuts(options) {
125
133
  const [{ default: showQRCode }] = await Promise.all([
126
134
  Promise.all([
127
- __webpack_require__.e("517"),
135
+ __webpack_require__.e("441"),
128
136
  __webpack_require__.e("640"),
129
- __webpack_require__.e("113")
137
+ __webpack_require__.e("204")
130
138
  ]).then(__webpack_require__.bind(__webpack_require__, "./src/showQRCode.ts"))
131
139
  ]);
132
140
  const currentEntry = options.entries[0];
@@ -142,14 +150,15 @@ async function registerConsoleShortcuts(options) {
142
150
  return off;
143
151
  }
144
152
  async function loop(options, value, devUrls) {
145
- const [{ select, selectKey, isCancel, cancel }, { default: showQRCode }] = await Promise.all([
146
- __webpack_require__.e("517").then(__webpack_require__.bind(__webpack_require__, "../../../node_modules/.pnpm/@clack+prompts@0.10.0/node_modules/@clack/prompts/dist/index.mjs")),
153
+ const [{ autocomplete, select, selectKey, isCancel, cancel }, { default: showQRCode }] = await Promise.all([
154
+ __webpack_require__.e("441").then(__webpack_require__.bind(__webpack_require__, "../../../node_modules/.pnpm/@clack+prompts@1.0.0-alpha.1/node_modules/@clack/prompts/dist/index.mjs")),
147
155
  Promise.all([
148
- __webpack_require__.e("517"),
156
+ __webpack_require__.e("441"),
149
157
  __webpack_require__.e("640"),
150
- __webpack_require__.e("113")
158
+ __webpack_require__.e("204")
151
159
  ]).then(__webpack_require__.bind(__webpack_require__, "./src/showQRCode.ts"))
152
160
  ]);
161
+ const selectFn = (length)=>length > 5 ? autocomplete : select;
153
162
  let currentEntry = options.entries[0];
154
163
  let currentSchema = Object.keys(devUrls)[0];
155
164
  while(!isCancel(value)){
@@ -178,7 +187,7 @@ async function loop(options, value, devUrls) {
178
187
  });
179
188
  if (isCancel(name) || 'q' === name || !gExistingShortcuts.has(options)) break;
180
189
  if ('r' === name) {
181
- const selection = await select({
190
+ const selection = await selectFn(options.entries.length)({
182
191
  message: 'Select entry',
183
192
  options: options.entries.map((entry)=>({
184
193
  value: entry,
@@ -192,7 +201,7 @@ async function loop(options, value, devUrls) {
192
201
  value = getCurrentUrl();
193
202
  } else if ('a' === name) {
194
203
  const devUrls = generateDevUrls(options.api, currentEntry, options.schema, options.port);
195
- const selection = await select({
204
+ const selection = await selectFn(Object.keys(devUrls).length)({
196
205
  message: 'Select schema',
197
206
  options: Object.entries(devUrls).map(([name, url])=>({
198
207
  value: name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lynx-js/qrcode-rsbuild-plugin",
3
- "version": "0.3.5",
3
+ "version": "0.4.0",
4
4
  "description": "A rsbuild plugin for printing QRCode in terminal",
5
5
  "keywords": [
6
6
  "rsbuild",
@@ -43,12 +43,12 @@
43
43
  "README.md"
44
44
  ],
45
45
  "devDependencies": {
46
- "@clack/prompts": "^0.10.0",
47
- "@microsoft/api-extractor": "7.52.2",
48
- "@rsbuild/core": "1.3.2",
46
+ "@clack/prompts": "1.0.0-alpha.1",
47
+ "@microsoft/api-extractor": "7.52.8",
48
+ "@rsbuild/core": "1.3.21",
49
49
  "picocolors": "^1.1.1",
50
50
  "uqr": "0.1.2",
51
- "@lynx-js/rspeedy": "0.9.0"
51
+ "@lynx-js/rspeedy": "0.9.11"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=18"