@uiwwsw/workbox 0.1.1 → 0.1.2
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 +62 -60
- package/package.json +46 -11
- package/AI-TRAINING-NOTICE.md +0 -11
package/README.md
CHANGED
|
@@ -1,18 +1,70 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<h1>@uiwwsw/workbox</h1>
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<p>서버가 응답하지 않을 때 미리 저장해 둔 HTML 안내 페이지를 보여주는 서비스워커를 빌드 시점에 생성합니다.<br>
|
|
6
|
+
Generates, at build time, a service worker that shows a pre-cached HTML page when a navigation fails.</p>
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
<p>
|
|
9
|
+
<a href="https://www.npmjs.com/package/@uiwwsw/workbox"><img alt="npm version" src="https://img.shields.io/npm/v/@uiwwsw/workbox?style=flat-square"></a>
|
|
10
|
+
<a href="LICENSE"><img alt="license" src="https://img.shields.io/npm/l/@uiwwsw/workbox?style=flat-square"></a>
|
|
11
|
+
<a href="https://github.com/uiwwsw/workbox/actions/workflows/test.yml"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/uiwwsw/workbox/test.yml?branch=main&style=flat-square"></a>
|
|
12
|
+
<img alt="node" src="https://img.shields.io/node/v/@uiwwsw/workbox?style=flat-square">
|
|
13
|
+
<img alt="dependencies: 0" src="https://img.shields.io/badge/dependencies-0-brightgreen?style=flat-square">
|
|
14
|
+
<img alt="not affiliated with Google Workbox" src="https://img.shields.io/badge/not%20affiliated%20with-Google%20Workbox-lightgrey?style=flat-square">
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<p>
|
|
18
|
+
<a href="https://www.npmjs.com/package/@uiwwsw/workbox">npm</a> ·
|
|
19
|
+
<a href="https://github.com/uiwwsw/workbox/blob/main/docs/REFERENCE.md">Reference</a> ·
|
|
20
|
+
<a href="https://github.com/uiwwsw/workbox/issues">Issues</a>
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
**Google Workbox(`workbox-*` 패키지)와 관계가 없습니다.** Google이 만들거나 보증하지 않았고 코드도 공유하지 않습니다.
|
|
26
|
+
**Not affiliated with Google Workbox (the `workbox-*` packages).** Not made or endorsed by Google; shares no code.
|
|
27
|
+
|
|
28
|
+
서버가 5xx를 반환하거나 응답하지 않을 때, 이전에 방문한 사용자에게 미리 저장한 HTML 페이지를 보여주는 서비스워커를 만듭니다. 번들러와 의존성 없이 JSON 설정 파일 하나로 동작합니다.
|
|
29
|
+
It generates a service worker that serves a pre-cached HTML page to returning visitors when the server fails or does not respond. It needs no bundler and no dependencies, only one JSON config file.
|
|
30
|
+
|
|
31
|
+
## 지금 되는 것 / What works now
|
|
32
|
+
|
|
33
|
+
- `outage-worker` CLI가 JSON 설정으로 서비스워커 파일을 씁니다. / The `outage-worker` CLI writes the worker file from a JSON config.
|
|
34
|
+
- `createWorker`, `writeWorker`: 빌드 스크립트용 Node API. / Node API for build scripts.
|
|
35
|
+
- `registerOutageWorker()`: 브라우저 등록. 범위가 겹치는 다른 워커가 있으면 오류를 던집니다. / Browser registration; throws if another worker overlaps the scope.
|
|
36
|
+
- 폴백 조건: 네트워크 오류, 타임아웃(기본 8000ms), HTTP 5xx. / Fallback on network error, timeout (default 8000 ms), HTTP 5xx.
|
|
37
|
+
- 캐시 대상은 폴백 HTML과 `assets` 목록뿐입니다. / Only the fallback HTML and listed `assets` are cached.
|
|
38
|
+
- 401, 403, 404, 429와 `/api` 경로는 통과시킵니다. / 401, 403, 404, 429 and `/api` paths pass through.
|
|
39
|
+
- 런타임 의존성 0개, TypeScript 선언 포함. / Zero runtime dependencies, TypeScript declarations included.
|
|
40
|
+
|
|
41
|
+
## 아직 안 되는 것 / Not done
|
|
42
|
+
|
|
43
|
+
- 첫 방문은 보호하지 못합니다. 워커가 설치된 뒤의 방문만 대상입니다. / First visits are not covered; only visits after the worker is installed.
|
|
44
|
+
- 이미 있는 서비스워커에 합치는 API가 없습니다. / No way to merge into an existing service worker.
|
|
45
|
+
- 저장소가 비워지거나 제거된 경우, 서비스워커가 꺼진 경우, HTTP 환경은 안 됩니다. / Cleared or evicted storage, disabled service workers and plain HTTP are not covered.
|
|
46
|
+
- 정상 로드된 페이지의 오프라인 저장이 없습니다. / No offline storage of pages that loaded normally.
|
|
47
|
+
- 페이지 안의 API 오류와 클라이언트 라우터 전환을 처리하지 않습니다. / No handling of API errors inside loaded pages or client-side router transitions.
|
|
48
|
+
- 라우팅, 캐싱 전략, 프리캐싱 API가 없습니다. / No routing, caching strategies or precaching API.
|
|
49
|
+
- 공격 방어가 없습니다. / No attack protection.
|
|
50
|
+
|
|
51
|
+
## 현재 위치 / Where it stands
|
|
52
|
+
|
|
53
|
+
- npm 주간 다운로드는 16회입니다. 같은 기간 `workbox-recipes` 11,653,542회, `workbox-window` 12,504,327회, `serwist` 1,042,063회, `@serwist/next` 604,275회입니다. / Weekly npm downloads: 16. Same week: `workbox-recipes` 11,653,542, `workbox-window` 12,504,327, `serwist` 1,042,063, `@serwist/next` 604,275.
|
|
54
|
+
- 패키지 이름이 Google Workbox와 겹쳐 검색과 문서에서 혼동됩니다. / The name collides with Google Workbox, so searches and docs can point to either.
|
|
55
|
+
- Google Workbox의 [`offlineFallback`](https://developer.chrome.com/docs/workbox/modules/workbox-recipes#offline_fallback)이 같은 용도를 이미 제공합니다. Workbox 포크인 [Serwist](https://github.com/serwist/serwist)도 `PrecacheFallbackPlugin`을 제공합니다. / Google Workbox's `offlineFallback` already covers this use. Serwist, a Workbox fork, ships `PrecacheFallbackPlugin`.
|
|
56
|
+
- 작성자 사이트(movvcorp)에서 사용합니다. 외부 사용 사례는 확인된 것이 없습니다. / Used by the author's own site (movvcorp). No external use is known.
|
|
57
|
+
- 맞는 경우: 번들러와 Workbox가 없고 장애 안내 페이지만 필요한 사이트. 그 밖에는 위 대안을 쓰는 편이 낫습니다. / It fits a site with no bundler and no Workbox that only needs an outage page. Otherwise use the alternatives above.
|
|
58
|
+
|
|
59
|
+
## 설치 / Install
|
|
8
60
|
|
|
9
61
|
```sh
|
|
10
62
|
npm install @uiwwsw/workbox
|
|
11
63
|
```
|
|
12
64
|
|
|
13
|
-
|
|
65
|
+
Node.js 20 이상. / Requires Node.js 20 or newer.
|
|
14
66
|
|
|
15
|
-
|
|
67
|
+
`outage.config.json` (`public/unavailable.html`이 있어야 합니다 / `public/unavailable.html` must exist):
|
|
16
68
|
|
|
17
69
|
```json
|
|
18
70
|
{
|
|
@@ -21,13 +73,13 @@ Create `outage.config.json`:
|
|
|
21
73
|
}
|
|
22
74
|
```
|
|
23
75
|
|
|
24
|
-
|
|
76
|
+
빌드 전에 실행 / Run before the build:
|
|
25
77
|
|
|
26
78
|
```sh
|
|
27
79
|
npx outage-worker outage.config.json
|
|
28
80
|
```
|
|
29
81
|
|
|
30
|
-
Register from the browser entry point:
|
|
82
|
+
브라우저 진입점에서 등록 / Register from the browser entry point:
|
|
31
83
|
|
|
32
84
|
```js
|
|
33
85
|
import { registerOutageWorker } from '@uiwwsw/workbox/register';
|
|
@@ -35,60 +87,10 @@ import { registerOutageWorker } from '@uiwwsw/workbox/register';
|
|
|
35
87
|
registerOutageWorker().catch(console.error);
|
|
36
88
|
```
|
|
37
89
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
## Options
|
|
41
|
-
|
|
42
|
-
| Option | Default | Meaning |
|
|
43
|
-
| --- | --- | --- |
|
|
44
|
-
| `fallback` | required | Same-origin absolute path to public static HTML |
|
|
45
|
-
| `outDir` | required for CLI | Public output directory, relative to working directory |
|
|
46
|
-
| `worker` | `/outage-sw.js` | Generated worker pathname |
|
|
47
|
-
| `scope` | `/` | Controlled pathname prefix, ending with `/` |
|
|
48
|
-
| `assets` | `[]` | Public CSS, font or image paths required by the fallback |
|
|
49
|
-
| `timeoutMs` | `8000` | Navigation timeout, 100–120000 milliseconds |
|
|
50
|
-
| `namespace` | `outage` | Cache isolation identifier |
|
|
51
|
-
| `version` | `1` | Optional release identifier; CLI also hashes local HTML/assets |
|
|
52
|
-
|
|
53
|
-
For a subpath deployment, set `scope` and `fallback` to that subpath and pass matching `scope` and `worker` options to registration. Place the worker at or above the scope directory.
|
|
54
|
-
|
|
55
|
-
The CLI validates that declared public files exist and automatically revisions their cache when their contents change.
|
|
56
|
-
|
|
57
|
-
The Node API exports `createWorker(options)` and `writeWorker(options)` for build integrations. Browser registration is a separate export, so Node built-ins never enter the client bundle.
|
|
58
|
-
|
|
59
|
-
## Behavior and limits
|
|
60
|
-
|
|
61
|
-
- Only same-origin GET navigations inside scope receive outage fallback on network failure, timeout or HTTP 500–599. Original 401/403/404/429 responses are preserved.
|
|
62
|
-
- Only the fallback and explicitly listed public assets are cached. Initial caching omits credentials and rejects redirects and unsuccessful responses. The fallback must be HTML.
|
|
63
|
-
- HTTPS and a successful prior installation are required. First visits, cleared/evicted storage, private browsing restrictions and disabled service workers cannot be protected.
|
|
64
|
-
- Existing pages' API errors and client-side router transitions need application UI handling. This package does not replace that handling or provide attack protection.
|
|
65
|
-
- Registration refuses overlapping existing workers. Integrate with an existing PWA worker rather than replacing it; do not add a second competing worker.
|
|
66
|
-
- Updates follow the standard waiting lifecycle. No forced `skipWaiting`, mass unregister or deletion of other packages' caches occurs. Close old tabs to finish activating a waiting update.
|
|
67
|
-
- Retry the original URL from the fallback (for example, a normal reload button). Avoid automatic reload loops or redirecting to the fallback URL.
|
|
68
|
-
- Removing registration code does not uninstall an existing worker. Roll back by serving a network-only worker at the same URL and releasing it through the normal update lifecycle before removing that URL.
|
|
69
|
-
|
|
70
|
-
## Development
|
|
71
|
-
|
|
72
|
-
Node.js 20 or newer; no runtime dependencies.
|
|
73
|
-
|
|
74
|
-
```sh
|
|
75
|
-
npm test
|
|
76
|
-
npm pack --dry-run
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
## Releases
|
|
80
|
-
|
|
81
|
-
The `Publish npm` GitHub Actions workflow publishes from `main` using npm Trusted Publishing (OIDC). It requires no stored npm publishing token. Configure the package's trusted publisher with the repository owner and name, workflow filename `publish.yml`, and direct publishing permission. The workflow uses no GitHub environment binding.
|
|
90
|
+
## 문서 / Docs
|
|
82
91
|
|
|
83
|
-
|
|
92
|
+
[Reference](https://github.com/uiwwsw/workbox/blob/main/docs/REFERENCE.md): options, behavior, architecture, releases.
|
|
84
93
|
|
|
85
94
|
## License
|
|
86
95
|
|
|
87
96
|
MIT. See [LICENSE](LICENSE).
|
|
88
|
-
|
|
89
|
-
<!-- ai-training-notice -->
|
|
90
|
-
## AI 학습·수집 반대 / AI training notice
|
|
91
|
-
|
|
92
|
-
사전 서면 동의 없는 AI 학습·미세조정 및 학습용 데이터 수집에 반대합니다. No AI training, fine-tuning or training-data collection without prior written consent.
|
|
93
|
-
|
|
94
|
-
[전문 / Full notice](AI-TRAINING-NOTICE.md). Existing licenses and third-party/user rights remain unchanged.
|
package/package.json
CHANGED
|
@@ -1,18 +1,53 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uiwwsw/workbox",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Generates a service worker that shows a pre-cached static HTML page when a navigation fails (network error, timeout or HTTP 5xx). Not affiliated with Google Workbox.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"engines": {
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=20"
|
|
8
|
+
},
|
|
7
9
|
"exports": {
|
|
8
|
-
".": {
|
|
9
|
-
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./src/index.d.ts",
|
|
12
|
+
"import": "./src/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./register": {
|
|
15
|
+
"types": "./src/register.d.ts",
|
|
16
|
+
"import": "./src/register.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"bin": {
|
|
20
|
+
"outage-worker": "src/cli.js"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"src",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"test": "node --test",
|
|
29
|
+
"check": "node --test",
|
|
30
|
+
"prepublishOnly": "npm run check"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public",
|
|
34
|
+
"registry": "https://registry.npmjs.org/"
|
|
35
|
+
},
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/uiwwsw/workbox.git"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://github.com/uiwwsw/workbox#readme",
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/uiwwsw/workbox/issues"
|
|
10
43
|
},
|
|
11
|
-
"bin": { "outage-worker": "src/cli.js" },
|
|
12
|
-
"files": ["src", "README.md", "LICENSE", "AI-TRAINING-NOTICE.md"],
|
|
13
|
-
"scripts": { "test": "node --test", "check": "node --test && python3 .github/scripts/check-ai-notice.py", "prepublishOnly": "npm run check" },
|
|
14
|
-
"publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" },
|
|
15
|
-
"repository": { "type": "git", "url": "git+https://github.com/uiwwsw/workbox.git" },
|
|
16
44
|
"license": "MIT",
|
|
17
|
-
"keywords": [
|
|
45
|
+
"keywords": [
|
|
46
|
+
"service-worker",
|
|
47
|
+
"offline-fallback",
|
|
48
|
+
"outage",
|
|
49
|
+
"fallback-page",
|
|
50
|
+
"cache-storage",
|
|
51
|
+
"static-html"
|
|
52
|
+
]
|
|
18
53
|
}
|
package/AI-TRAINING-NOTICE.md
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# AI training and data collection notice / AI 학습·수집 반대 고지
|
|
2
|
-
|
|
3
|
-
이 프로젝트의 관리자는 자신이 권리를 보유한 코드, 문서, 웹사이트, 앱, 데모, 패키지, 이미지와 기타 콘텐츠를 사전 서면 동의 없이 AI·머신러닝 모델의 학습·미세조정 또는 학습용 데이터셋 구축을 위해 수집·저장·이용하는 것에 명시적으로 반대합니다. 해당 목적의 이용 전 권리자의 서면 동의를 받으세요.
|
|
4
|
-
|
|
5
|
-
The maintainer expressly objects to collecting, storing or using maintainer-controlled code, documentation, websites, apps, demos, packages, images and other content for AI or machine-learning training, fine-tuning or training datasets without prior written consent. Obtain the rights holder's written consent before such use.
|
|
6
|
-
|
|
7
|
-
이 고지는 권리자의 의사 표시입니다. 기존 오픈소스·콘텐츠 라이선스를 수정하거나 이미 부여된 권리 및 법령상 허용되는 이용을 제한하지 않습니다. 제삼자 자료와 사용자가 작성한 콘텐츠에는 각 권리자의 조건이 적용됩니다. 서비스 이용자가 요청한 개별 AI 기능의 실행과 학습용 무단 수집은 구분합니다.
|
|
8
|
-
|
|
9
|
-
This notice states the rights holder's preference. It does not amend existing software or content licenses, restrict rights already granted, or override uses permitted by law. Third-party materials and user-created content remain subject to their own rights and terms. User-authorized AI features are distinct from unauthorized collection for training.
|
|
10
|
-
|
|
11
|
-
robots.txt expresses crawler preferences; it does not guarantee compliance or remove previously collected data.
|