chemicaljs 1.2.5 → 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:
@@ -9,7 +9,7 @@
9
9
  "version": "1.0.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
- "chemicaljs": "^1.2.4",
12
+ "chemicaljs": "^1.2.5",
13
13
  "express": "^4.19.2"
14
14
  }
15
15
  },
@@ -1146,12 +1146,12 @@
1146
1146
  }
1147
1147
  },
1148
1148
  "node_modules/chemicaljs": {
1149
- "version": "1.2.4",
1150
- "resolved": "https://registry.npmjs.org/chemicaljs/-/chemicaljs-1.2.4.tgz",
1151
- "integrity": "sha512-gHFje3KkFNHT49jsRibzcSFACAg49VjNAy9mcqB7yII2vwIQr41SvRZ2+BwHIa8uA3ep/ovlty6qGBZxkTjgbg==",
1149
+ "version": "1.2.5",
1150
+ "resolved": "https://registry.npmjs.org/chemicaljs/-/chemicaljs-1.2.5.tgz",
1151
+ "integrity": "sha512-MHCs5CDzzwKwdT9ce2ZRdaod0+LoDmtbK7bkyl1I0dfg9Xt8rFeR+dyum4JnYJPHXfwgP86KgHTvSkDEVakT6Q==",
1152
1152
  "dependencies": {
1153
1153
  "@mercuryworkshop/bare-mux": "^2.0.1",
1154
- "@mercuryworkshop/epoxy-transport": "^2.1.2",
1154
+ "@mercuryworkshop/epoxy-transport": "^2.1.3",
1155
1155
  "@mercuryworkshop/scramjet": "^1.0.2",
1156
1156
  "@titaniumnetwork-dev/ultraviolet": "^3.2.1",
1157
1157
  "express": "^4.19.2",
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "homepage": "https://github.com/chemicaljs/chemical#readme",
20
20
  "dependencies": {
21
- "chemicaljs": "^1.2.4",
21
+ "chemicaljs": "^1.2.5",
22
22
  "express": "^4.19.2"
23
23
  }
24
24
  }
@@ -0,0 +1,9 @@
1
+ # Chemical Example Vite
2
+
3
+ Note: This example uses Preact but any framework will work.
4
+
5
+ Run `npm install` to install dependencies.
6
+
7
+ Run `npm run build` to build and `npm start` to start.
8
+
9
+ Run `npm run dev` to start the dev server which is the point of this example.
@@ -0,0 +1,12 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <script src="/chemical.js"></script>
7
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ <script type="module" src="/src/main.jsx"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,14 @@
1
+ import { ChemicalServer } from "chemicaljs";
2
+ import express from "express";
3
+
4
+ const chemical = new ChemicalServer();
5
+ const port = process.env.PORT || 3000;
6
+
7
+ chemical.app.use(express.static("dist", {
8
+ index: "index.html",
9
+ extensions: ["html"]
10
+ }));
11
+
12
+ chemical.server.listen(port, () => {
13
+ console.log(`Chemical example vite listening on port ${port}`);
14
+ });