@idleberg/vite-plugin-devcert 0.1.0 → 0.1.1
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/README.md +3 -3
- package/dist/plugin.d.ts +17 -8
- package/dist/plugin.js +1 -34
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
[](https://github.com/idleberg/vite-plugin-devcert/actions/workflows/node.yml)
|
|
9
9
|
[](https://github.com/idleberg/vite-plugin-devcert/actions/workflows/deno.yml)
|
|
10
10
|
|
|
11
|
-
> !
|
|
12
|
-
> This plugin is based on `@expo/devcert`, an actively maintained
|
|
11
|
+
> [!IMPORTANT]
|
|
12
|
+
> This plugin is based on `@expo/devcert`, an actively maintained fork of `devcert`. Read about [how it works](https://github.com/expo/devcert/tree/master?tab=readme-ov-file#how-it-works) and what the [security concerns](https://github.com/expo/devcert/tree/master?tab=readme-ov-file#security-concerns) are.
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
15
15
|
|
|
@@ -46,7 +46,7 @@ export default defineConfig({
|
|
|
46
46
|
|
|
47
47
|
If `certutil` is not installed already (for updating NSS databases; e.g. Firefox), do not attempt to install it. [Read more](https://github.com/expo/devcert#skiphostsfile).
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
#### `options.skipCertutil`
|
|
50
50
|
|
|
51
51
|
Do not update your systems host file with the domain name of the certificate. [Read more](https://github.com/expo/devcert#skipcertutil).
|
|
52
52
|
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
2
|
|
|
3
|
-
type PluginOptions =
|
|
4
|
-
|
|
3
|
+
type PluginOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* If `certutil` is not installed already (for updating NSS databases; e.g. Firefox), do not attempt to install it.
|
|
6
|
+
* {@see {@link https://github.com/expo/devcert#skiphostsfile}}
|
|
7
|
+
*/
|
|
8
|
+
skipHostsFile: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Do not update your systems host file with the domain name of the certificate.
|
|
11
|
+
* {@see {@link https://github.com/expo/devcert#skipcertutil}}
|
|
12
|
+
*/
|
|
13
|
+
skipCertutil: boolean;
|
|
5
14
|
};
|
|
6
15
|
/**
|
|
7
|
-
*
|
|
8
|
-
* @param options -
|
|
9
|
-
* @returns a Vite
|
|
16
|
+
* Generate trusted SSL/TLS certificates for local development.
|
|
17
|
+
* @param options - options passed to `@expo/devcert`
|
|
18
|
+
* @returns a Vite plugin
|
|
10
19
|
*/
|
|
11
|
-
declare function
|
|
20
|
+
declare function DevcertPlugin(options?: PluginOptions): Plugin;
|
|
12
21
|
|
|
13
|
-
export {
|
|
22
|
+
export { DevcertPlugin as default };
|
package/dist/plugin.js
CHANGED
|
@@ -1,34 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import logSymbols from 'log-symbols';
|
|
3
|
-
|
|
4
|
-
// src/plugin.ts
|
|
5
|
-
function DevcertPlugin(options) {
|
|
6
|
-
return {
|
|
7
|
-
name: "@idleberg/vite-plugin-devcert",
|
|
8
|
-
config: async (userConfig, { command }) => {
|
|
9
|
-
if (command !== "serve") {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
const { server } = userConfig;
|
|
13
|
-
if (server?.https?.key && server?.https?.cert) {
|
|
14
|
-
console.warn(`${logSymbols.warning} Skipping devcert, key and cert already provided.`);
|
|
15
|
-
return userConfig;
|
|
16
|
-
}
|
|
17
|
-
const domain = server?.host && typeof server.host === "string" ? server.host : "localhost";
|
|
18
|
-
const { key, cert } = await certificateFor(domain, options);
|
|
19
|
-
return {
|
|
20
|
-
...userConfig,
|
|
21
|
-
server: {
|
|
22
|
-
...server,
|
|
23
|
-
https: {
|
|
24
|
-
...server?.https,
|
|
25
|
-
key: key ?? void 0,
|
|
26
|
-
cert: cert ?? void 0
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export { DevcertPlugin as default };
|
|
1
|
+
import {certificateFor}from'@expo/devcert';import l from'log-symbols';function c(r){return {name:"@idleberg/vite-plugin-devcert",config:async(t,{command:n})=>{if(n!=="serve")return;let{server:e}=t;if(e?.https?.key&&e?.https?.cert)return console.warn(`${l.warning} Skipping devcert, key and cert already provided.`),t;let i=e?.host&&typeof e.host=="string"?e.host:"localhost",{key:o,cert:s}=await certificateFor(i,r);return {...t,server:{...e,https:{...e?.https,key:o??void 0,cert:s??void 0}}}}}}export{c as default};
|