vite-plugin-qrcode 0.2.0 → 0.2.2

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 [these people](https://github.com/svitejs/vite-plugin-qrcode/graphs/contributors)
3
+ Copyright (c) 2022 [these people](https://github.com/svitejs/vite-plugin-qrcode/graphs/contributors)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/index.cjs CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -16,7 +17,14 @@ var __copyProps = (to, from, except, desc) => {
16
17
  }
17
18
  return to;
18
19
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
20
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
29
 
22
30
  // src/index.ts
@@ -42,6 +50,14 @@ function qrcode(options = {}) {
42
50
  }
43
51
  return _listen.apply(this, arguments);
44
52
  };
53
+ },
54
+ configurePreviewServer(server) {
55
+ var _a;
56
+ if ("resolvedUrls" in server) {
57
+ (_a = server.httpServer) == null ? void 0 : _a.on("listening", () => {
58
+ setTimeout(() => logQrcode(server, options), 0);
59
+ });
60
+ }
45
61
  }
46
62
  };
47
63
  }
@@ -0,0 +1,19 @@
1
+ import { Plugin } from 'vite';
2
+
3
+ declare function qrcode(options?: PluginOptions): Plugin;
4
+ interface PluginOptions {
5
+ /**
6
+ * filter list of shown QR codes. Useful if you have multiple interfaces and only need one
7
+ *
8
+ * examples:
9
+ * url => url.startsWith('http://192.')
10
+ * url => !url.startsWith('http://172.)
11
+ * url => url === 'http://192.168.1.70:4173'
12
+ *
13
+ * @param url {string} ip address
14
+ * @returns {boolean}
15
+ */
16
+ filter?: (url: string) => boolean;
17
+ }
18
+
19
+ export { PluginOptions, qrcode };
package/dist/index.js CHANGED
@@ -16,6 +16,14 @@ function qrcode(options = {}) {
16
16
  }
17
17
  return _listen.apply(this, arguments);
18
18
  };
19
+ },
20
+ configurePreviewServer(server) {
21
+ var _a;
22
+ if ("resolvedUrls" in server) {
23
+ (_a = server.httpServer) == null ? void 0 : _a.on("listening", () => {
24
+ setTimeout(() => logQrcode(server, options), 0);
25
+ });
26
+ }
19
27
  }
20
28
  };
21
29
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vite-plugin-qrcode",
3
3
  "description": "Show QR code on server start",
4
- "version": "0.2.0",
4
+ "version": "0.2.2",
5
5
  "license": "MIT",
6
6
  "author": "bluwy",
7
7
  "type": "module",
@@ -40,13 +40,12 @@
40
40
  "qrcode-terminal": "^0.12.0"
41
41
  },
42
42
  "peerDependencies": {
43
- "vite": "^3.0.0"
43
+ "vite": "^3.0.0 || ^4.0.0"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/qrcode-terminal": "^0.12.0",
47
- "rollup": "^2.77.1",
48
47
  "uvu": "^0.5.6",
49
- "vite": "^3.0.3"
48
+ "vite": "^4.3.9"
50
49
  },
51
50
  "scripts": {
52
51
  "dev": "tsup-node --sourcemap --watch src",