chemicaljs 1.2.4 → 1.3.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/README.md CHANGED
@@ -3,7 +3,9 @@ Easily create your own web proxy with no experience required.
3
3
 
4
4
  ## Setup
5
5
 
6
- A simple example can be found in `/example/`.
6
+ A simple example can be found in [`/example/`](https://github.com/chemicaljs/chemical/tree/main/example).
7
+
8
+ A example with the vite plugin can be found in [`/example-vite/`](https://github.com/chemicaljs/chemical/tree/main/example).
7
9
 
8
10
  ### Server
9
11
 
@@ -123,6 +125,36 @@ Below is a simple example of a simple input that redirects to the encoded URL wh
123
125
  </script>
124
126
  ```
125
127
 
128
+ ### Vite Plugin
129
+
130
+ 1. Create a new vite app and open `vite.config.js` or `vite.config.ts`
131
+
132
+ 2. Import `ChemicalPluginVite` and add it to plugins.
133
+
134
+ ```js
135
+ import { defineConfig } from "vite"
136
+ import { ChemicalPluginVite } from "chemicaljs"
137
+
138
+ export default defineConfig({
139
+ plugins: [/*Other plugins*/ChemicalPluginVite()],
140
+ })
141
+ ```
142
+
143
+ You can pass options to just like on the main server.
144
+
145
+ ```js
146
+ export default defineConfig({
147
+ plugins: [
148
+ ChemicalPluginVite({
149
+ default: "rammerhead",
150
+ uv: true,
151
+ scramjet: false,
152
+ rammerhead: true
153
+ })
154
+ ],
155
+ })
156
+ ```
157
+
126
158
  ## Future Addition
127
159
 
128
160
  Some features that may come in the future are:
@@ -206,7 +206,7 @@ let wispURL = document.currentScript.getAttribute("wisp");
206
206
 
207
207
  async function registerSW() {
208
208
  const connection = new window.BareMux.BareMuxConnection("/baremux/worker.js");
209
- await connection.setTransport("/epoxy/module.js", [{ wisp: wispURL || (location.protocol === "https:" ? "wss" : "ws") + "://" + location.host + "/wisp/" }]);
209
+ await connection.setTransport("/epoxy/index.mjs", [{ wisp: wispURL || (location.protocol === "https:" ? "wss" : "ws") + "://" + location.host + "/wisp/" }]);
210
210
 
211
211
  if ("serviceWorker" in navigator) {
212
212
  await navigator.serviceWorker.register("/chemical.sw.js");