This commit is contained in:
David Reed 2022-09-12 20:31:01 -04:00
parent 6cec2d40d5
commit 83669f9a4a
5 changed files with 19 additions and 27 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
*.tgz

View file

@ -1,30 +1,7 @@
# ultraviolet-scripts
Core Ultraviolet scripts
# Ultraviolet-Static
# Configuration
Configure Ultraviolet for both client-hooking & service worker in `uv.config.js`
```javascript
self.__uv$config = {
bare: '/bare/',
prefix: '/service/',
encodeUrl: Ultraviolet.codec.xor.encode,
decodeUrl: Ultraviolet.codec.xor.decode,
handler: '/uv.handler.js',
bundle: '/uv.bundle.js',
config: '/uv.config.js',
};
```
Static files/assets used to spin up an Ultraviolet website.
## Packaging
# Example Usage
```javascript
importScripts('/PATHTOSCRIPTS/uv.sw.js');
const sw = new UVServiceWorker();
self.addEventListener('fetch', event =>
event.respondWith(
sw.fetch(event)
)
);
```
Run `npm pack` to produce a tgz containing the assets as an NPM package.

1
lib/index.d.ts vendored Normal file
View file

@ -0,0 +1 @@
export const publicPath: string;

3
lib/index.js Normal file
View file

@ -0,0 +1,3 @@
import { fileURLToPath } from 'url';
export const publicPath = fileURLToPath(new URL('../public/', import.meta.url));

10
package.json Normal file
View file

@ -0,0 +1,10 @@
{
"name": "ultraviolet-static",
"main": "lib/index.js",
"version": "1.0.0",
"type": "module",
"files": [
"public",
"lib"
]
}