prepare
This commit is contained in:
parent
6cec2d40d5
commit
83669f9a4a
5 changed files with 19 additions and 27 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
*.tgz
|
||||
31
README.md
31
README.md
|
|
@ -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
1
lib/index.d.ts
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export const publicPath: string;
|
||||
3
lib/index.js
Normal file
3
lib/index.js
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import { fileURLToPath } from 'url';
|
||||
|
||||
export const publicPath = fileURLToPath(new URL('../public/', import.meta.url));
|
||||
10
package.json
Normal file
10
package.json
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"name": "ultraviolet-static",
|
||||
"main": "lib/index.js",
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"files": [
|
||||
"public",
|
||||
"lib"
|
||||
]
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue