@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 CHANGED
@@ -8,8 +8,8 @@
8
8
  [![CI: Node](https://img.shields.io/github/actions/workflow/status/idleberg/vite-plugin-devcert/node.yml?logo=nodedotjs&logoColor=white&style=for-the-badge)](https://github.com/idleberg/vite-plugin-devcert/actions/workflows/node.yml)
9
9
  [![CI: Deno](https://img.shields.io/github/actions/workflow/status/idleberg/vite-plugin-devcert/deno.yml?logo=deno&logoColor=white&style=for-the-badge)](https://github.com/idleberg/vite-plugin-devcert/actions/workflows/deno.yml)
10
10
 
11
- > ![NOTE]
12
- > This plugin is based on `@expo/devcert`, an actively maintained version 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).
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
- ### `options.skipCertutil``
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 { CommonServerOptions, UserConfig, Plugin } from 'vite';
1
+ import { Plugin } from 'vite';
2
2
 
3
- type PluginOptions = CommonServerOptions & {
4
- overrides?: Pick<UserConfig, 'base' | 'cacheDir' | 'clearScreen' | 'customLogger' | 'define' | 'envDir' | 'envPrefix' | 'mode' | 'plugins' | 'publicDir' | 'root'>;
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
- * Exports a Vite plugin launches multiple servers.
8
- * @param options - an array of server options and Vite overrides
9
- * @returns a Vite plugins
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 MultiserverPlugin(options: PluginOptions | PluginOptions[]): Plugin;
20
+ declare function DevcertPlugin(options?: PluginOptions): Plugin;
12
21
 
13
- export { MultiserverPlugin as default };
22
+ export { DevcertPlugin as default };
package/dist/plugin.js CHANGED
@@ -1,34 +1 @@
1
- import { certificateFor } from '@expo/devcert';
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@idleberg/vite-plugin-devcert",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A Vite plugin to generate trusted SSL/TLS certificates for local development",
5
5
  "license": "MIT",
6
6
  "author": "Jan T. Sott",