This commit is contained in:
David Reed 2022-10-01 18:26:29 -04:00
parent da3743f3cf
commit 2da39c96f1
3 changed files with 12 additions and 10 deletions

View file

@ -1,21 +1,23 @@
# v1.0.2
This package now targets CommonJS.
# v1.0.1 # v1.0.1
In your `sw.js` script, you MUST import `uv.bundle.js` then `uv.config.js` in order. This is because we can no longer hard-code the paths. Ideally, we would import `uv.config.js` then use the config.bundle path in the serviceworker, however the config is dependant on `uv.bundle.js`, which we don't know the location to. In your `sw.js` script, you MUST import `uv.bundle.js` then `uv.config.js` in order. This is because we can no longer hard-code the paths. Ideally, we would import `uv.config.js` then use the config.bundle path in the serviceworker, however the config is dependant on `uv.bundle.js`, which we don't know the location to.
Old: Old:
```js ```js
importScripts('./uv/uv.sw.js'); importScripts('./uv/uv.sw.js');
const sw = new UVServiceWorker(); const sw = new UVServiceWorker();
self.addEventListener('fetch', event => self.addEventListener('fetch', (event) => event.respondWith(sw.fetch(event)));
event.respondWith(
sw.fetch(event)
)
);
``` ```
New: New:
```diff ```diff
+ importScripts('./uv/uv.bundle.js'); + importScripts('./uv/uv.bundle.js');
+ importScripts('./uv/uv.config.js'); + importScripts('./uv/uv.config.js');
@ -30,4 +32,4 @@ self.addEventListener('fetch', event =>
); );
``` ```
You are still required to specify all paths in `uv.config.js`. You are still required to specify all paths in `uv.config.js`.

6
package-lock.json generated
View file

@ -1,13 +1,13 @@
{ {
"name": "ultraviolet", "name": "ultraviolet",
"version": "1.0.1", "version": "1.0.2",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "ultraviolet", "name": "ultraviolet",
"version": "1.0.1", "version": "1.0.2",
"license": "ISC", "license": "MIT",
"dependencies": { "dependencies": {
"bowser": "^2.11.0", "bowser": "^2.11.0",
"css-tree": "^2.0.4", "css-tree": "^2.0.4",

View file

@ -1,6 +1,6 @@
{ {
"name": "ultraviolet", "name": "ultraviolet",
"version": "1.0.1", "version": "1.0.2",
"description": "Proxy", "description": "Proxy",
"main": "lib/index.js", "main": "lib/index.js",
"scripts": { "scripts": {