unpeek 1.1.0 → 1.4.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 +68 -18
- package/README.tr.md +93 -25
- package/assets/banner.svg +22 -0
- package/dist/cli/index.cjs +106 -43
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +106 -43
- package/dist/cli/index.js.map +1 -1
- package/dist/index.cjs +106 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +106 -43
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Woffluon/unpeek/main/assets/banner.svg">
|
|
4
|
+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/Woffluon/unpeek/main/assets/banner.svg">
|
|
5
|
+
<img src="https://raw.githubusercontent.com/Woffluon/unpeek/main/assets/banner.svg" alt="unpeek - call-graph aware client-side javascript protection" width="100%">
|
|
6
|
+
</picture>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
1
9
|
# unpeek
|
|
2
10
|
|
|
3
|
-
**
|
|
11
|
+
**Nothing to peek at. Nothing to slow down.**
|
|
12
|
+
|
|
13
|
+
Zero-config, call-graph-aware client-side JavaScript protection and runtime anti-tamper toolkit with <2% CPU overhead and <15% Gzip budget.
|
|
4
14
|
|
|
5
|
-
[](LICENSE)
|
|
16
|
+
[](packages/unpeek/benchmarks/overhead.bench.ts)
|
|
17
|
+
[](packages/unpeek/benchmarks/overhead.bench.ts)
|
|
18
|
+
[](https://woffluon.github.io/unpeek)
|
|
19
|
+
[](https://woffluon.github.io/unpeek/docs)
|
|
9
20
|
|
|
10
|
-
English | [Türkçe](./README.tr.md) · [
|
|
21
|
+
English | [Türkçe](./README.tr.md) · [Interactive Showcase](https://woffluon.github.io/unpeek) · [Documentation](https://woffluon.github.io/unpeek/docs) · [Agent Architecture Guide](./AGENTS.md) · [AI Skill](./skills/unpeek/SKILL.md)
|
|
11
22
|
|
|
12
23
|
---
|
|
13
24
|
|
|
@@ -199,34 +210,73 @@ npx @sentry/cli sourcemaps upload .unpeek-maps --release="$GIT_COMMIT_SHA"
|
|
|
199
210
|
|
|
200
211
|
---
|
|
201
212
|
|
|
202
|
-
##
|
|
213
|
+
## AI Coding Agent Integration
|
|
203
214
|
|
|
204
|
-
`unpeek` ships with an official
|
|
215
|
+
`unpeek` ships with an official AI Agent Skill ([`skills/unpeek/SKILL.md`](skills/unpeek/SKILL.md)) following the open Vercel Agent Skills specification and Agent Skills Discovery Optimization (SDO) standards. Installing this skill equips coding agents (Claude Code, Cursor, OpenAI Codex, Gemini CLI, GitHub Copilot, OpenCode) with deep domain knowledge for protecting client-side bundles, preserving hot-path performance budgets (<2% CPU, <15% Gzip), guarding SSR boundaries, and managing `.unpeek-maps/` in CI/CD pipelines.
|
|
205
216
|
|
|
206
|
-
###
|
|
217
|
+
### Skill Installation
|
|
207
218
|
|
|
208
|
-
|
|
219
|
+
#### 1. Standard Installation (Vercel Agent Skills CLI)
|
|
220
|
+
|
|
221
|
+
Install the skill directly into your project or configured agent environment:
|
|
209
222
|
|
|
210
223
|
```bash
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
224
|
+
npx skills add Woffluon/unpeek
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
#### 2. Local Repository Installation
|
|
228
|
+
|
|
229
|
+
When developing or testing directly within the `unpeek` repository:
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
npx skills add .
|
|
214
233
|
```
|
|
215
234
|
|
|
216
|
-
|
|
235
|
+
#### 3. Multi-Agent Targeting & Global Installation
|
|
236
|
+
|
|
237
|
+
Install globally across multiple coding agents without interactive confirmation:
|
|
217
238
|
|
|
218
239
|
```bash
|
|
219
|
-
|
|
220
|
-
|
|
240
|
+
npx skills add Woffluon/unpeek --agent claude-code codex cursor gemini-cli github-copilot opencode --global --yes
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
#### 4. Manual / Direct Copy Fallback
|
|
244
|
+
|
|
245
|
+
You can also copy the skill definition manually into project-level or global agent skill directories:
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
# Project-scoped (.agents/skills/unpeek/SKILL.md)
|
|
249
|
+
mkdir -p .agents/skills/unpeek
|
|
221
250
|
curl -fsSL https://raw.githubusercontent.com/Woffluon/unpeek/main/skills/unpeek/SKILL.md \
|
|
222
|
-
-o
|
|
251
|
+
-o .agents/skills/unpeek/SKILL.md
|
|
223
252
|
|
|
224
|
-
#
|
|
253
|
+
# Global agent directories (Antigravity / Gemini CLI / Claude Code)
|
|
225
254
|
mkdir -p ~/.agents/skills/unpeek
|
|
226
255
|
curl -fsSL https://raw.githubusercontent.com/Woffluon/unpeek/main/skills/unpeek/SKILL.md \
|
|
227
256
|
-o ~/.agents/skills/unpeek/SKILL.md
|
|
228
257
|
```
|
|
229
258
|
|
|
259
|
+
### Agent Trigger Example
|
|
260
|
+
|
|
261
|
+
Once installed, invoke the skill directly in any agent session using the `$unpeek` prompt:
|
|
262
|
+
|
|
263
|
+
```text
|
|
264
|
+
$unpeek Protect this build with passive telemetry and seed 0x7f4a2c.
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Token-Optimized Modular References (`skills/unpeek/references/`)
|
|
268
|
+
|
|
269
|
+
To conserve agent context windows and eliminate unnecessary token consumption, the primary [`skills/unpeek/SKILL.md`](skills/unpeek/SKILL.md) remains concise while delegating specialized guidance to on-demand modular reference documents in `skills/unpeek/references/`:
|
|
270
|
+
|
|
271
|
+
- **`quickstart.md`**: Immediate setup, zero-config postbuild wiring, and 3-step verification loops.
|
|
272
|
+
- **`frameworks.md`**: Bundler configurations and SSR client boundaries (Next.js, Vite, Webpack, Rollup).
|
|
273
|
+
- **`architecture.md`**: Acorn AST parsing, transitive call-graph hot-path exemption, and FNV-1a checksums.
|
|
274
|
+
- **`sourcemaps.md`**: `.unpeek-maps/` vault isolation, CI pipelines, and Sentry/Datadog symbol uploads.
|
|
275
|
+
- **`api.md`**: CLI flags, programmatic Node.js methods (`protectProject`, `transformJavaScript`), and TypeScript interfaces.
|
|
276
|
+
- **`recipes.md`**: Production hardening recipes, deterministic CI seeds, and passive telemetry troubleshooting.
|
|
277
|
+
|
|
278
|
+
Agents read only the relevant reference file on-demand, preventing context bloat.
|
|
279
|
+
|
|
230
280
|
---
|
|
231
281
|
|
|
232
282
|
## Verification, Testing & Benchmarks
|
package/README.tr.md
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Woffluon/unpeek/main/assets/banner.svg">
|
|
4
|
+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/Woffluon/unpeek/main/assets/banner.svg">
|
|
5
|
+
<img src="https://raw.githubusercontent.com/Woffluon/unpeek/main/assets/banner.svg" alt="unpeek - call-graph aware client-side javascript protection" width="100%">
|
|
6
|
+
</picture>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
1
9
|
# unpeek
|
|
2
10
|
|
|
3
|
-
**
|
|
11
|
+
**Bakılacak bir şey yok. Yavaşlayacak hiçbir şey yok.**
|
|
12
|
+
|
|
13
|
+
Sıfır yapılandırma gerektiren, çağrı grafiği (call-graph) farkındalıklı, <%2 CPU ek yükü ve <%15 Gzip bütçesine sahip istemci tarafı JavaScript koruma ve çalışma zamanı (runtime) müdahale önleme aracı.
|
|
4
14
|
|
|
5
|
-
[](LICENSE)
|
|
16
|
+
[](packages/unpeek/benchmarks/overhead.bench.ts)
|
|
17
|
+
[](packages/unpeek/benchmarks/overhead.bench.ts)
|
|
18
|
+
[](https://woffluon.github.io/unpeek)
|
|
19
|
+
[](https://woffluon.github.io/unpeek/docs)
|
|
9
20
|
|
|
10
|
-
[English](./README.md) | Türkçe · [
|
|
21
|
+
[English](./README.md) | Türkçe · [İnteraktif Vitrin](https://woffluon.github.io/unpeek) · [Dokümantasyon](https://woffluon.github.io/unpeek/docs) · [Ajan Mimari Kılavuzu](./AGENTS.md) · [Yapay Zeka Becerisi (SKILL.md)](./skills/unpeek/SKILL.md)
|
|
11
22
|
|
|
12
23
|
---
|
|
13
24
|
|
|
@@ -50,13 +61,13 @@ flowchart TD
|
|
|
50
61
|
```
|
|
51
62
|
|
|
52
63
|
1. **Çağrı Grafiği (Call-Graph) Hot-Path Muafiyeti (`<%2` CPU Bütçesi)**
|
|
53
|
-
[`detectHotPaths`](
|
|
64
|
+
[`detectHotPaths`](packages/unpeek/src/ast/index.ts), tek bir AST düğümünü değiştirmeden önce dosyanın çağrı grafiğini tarar. Döngü içeren fonksiyonlar (`for`, `while`, `do-while`, `for-of`), dizi yüksek mertebe geri çağrıları (`.map`, `.filter`, `.reduce`, `.forEach`), `requestAnimationFrame` zamanlayıcıları ve React/UI bileşenleri (`useState`, `useEffect`, `createElement`) sıcak yol (hot path) olarak işaretlenir. `unpeek` tüm paketteki yerel tanımlayıcıları maskeler ve metin sabitlerini şifreler; opak kontrol akışı korumalarını ise yalnızca soğuk fonksiyonlara (lisans doğrulama, istek imzalama, yetki kontrolü gibi) enjekte eder. Sıcak döngülerdeki V8 JIT optimizasyonu doğal hızında çalışmayı sürdürür.
|
|
54
65
|
2. **O(1) Tembel Metin Kasası (Lazy String Vault, `<%15` Gzip Bütçesi)**
|
|
55
66
|
Düz metin sabitleri (`minStringLength >= 4`), derleme zamanında 32-bitlik polimorfik bir tohum (seed) ile anahtarlanan XOR akış şifresiyle kodlanır. Sayfa açılışında tüm metinleri aynı anda çözmek yerine, enjekte edilen kasa yardımcısı her metni ilk erişildiğinde tembel (lazy) olarak çözer ve düz metin sonucunu kendi dizi hücresine önbellekler. Sonraki tüm okumalar doğrudan dizi indeksleme ile O(1) sürede tamamlanır.
|
|
56
67
|
3. **Öz-Savunmalı `Function.prototype.toString()` Bütünlük Kontrolü ve Pasif Caydırıcı**
|
|
57
|
-
Bir analist korumalı bir dosyayı DevTools Pretty-Print (`{}`) ile biçimlendirdiğinde veya Sources panelinde bir koşulu değiştirdiğinde, biçimlendirilen kod `Function.prototype.toString()` çıktısını değiştirir. [`verifyCodeIntegrity`](
|
|
68
|
+
Bir analist korumalı bir dosyayı DevTools Pretty-Print (`{}`) ile biçimlendirdiğinde veya Sources panelinde bir koşulu değiştirdiğinde, biçimlendirilen kod `Function.prototype.toString()` çıktısını değiştirir. [`verifyCodeIntegrity`](packages/unpeek/src/runtime/index.ts), dokunulmamış küçültülmüş kodda sıfır yanlış pozitif oranıyla 32-bit FNV-1a özetini doğrular ve saldırganların doğrudan yamayabileceği ani bir çökme yerine kademeli durum bozulması (`deterrentMode: 'gradual'`) başlatır.
|
|
58
69
|
4. **Otomatik Source Map Kasası (`.unpeek-maps/`)**
|
|
59
|
-
Üretim çıktısında `.js.map` dosyalarını bırakmak, orijinal TypeScript proje ağacınızın DevTools içinde birebir yeniden oluşturulmasına yol açar. [`protectProject`](
|
|
70
|
+
Üretim çıktısında `.js.map` dosyalarını bırakmak, orijinal TypeScript proje ağacınızın DevTools içinde birebir yeniden oluşturulmasına yol açar. [`protectProject`](packages/unpeek/src/cli/protect.ts), `.map` dosyalarını genel çıktı dizininden özel `.unpeek-maps/` klasörüne taşır ve tüm istemci paketlerinden `//# sourceMappingURL=` yorumlarını temizler. Böylece haritaları son kullanıcılara sunmadan Sentry veya Datadog gibi platformlara yükleyebilirsiniz.
|
|
60
71
|
|
|
61
72
|
---
|
|
62
73
|
|
|
@@ -114,7 +125,7 @@ npx unpeek protect
|
|
|
114
125
|
|
|
115
126
|
### 3. Evrensel Paketleyici Eklentisi (`unpeek/unplugin`)
|
|
116
127
|
|
|
117
|
-
Derleme sonrası CLI adımı yerine paketleyicinin `renderChunk` yaşam döngüsü sırasında bellek içi dönüşüm yapmak isterseniz [`unpeek/unplugin`](
|
|
128
|
+
Derleme sonrası CLI adımı yerine paketleyicinin `renderChunk` yaşam döngüsü sırasında bellek içi dönüşüm yapmak isterseniz [`unpeek/unplugin`](packages/unpeek/src/bundler/unplugin.ts) modülünü kullanabilirsiniz:
|
|
118
129
|
|
|
119
130
|
#### Vite (`vite.config.ts`)
|
|
120
131
|
|
|
@@ -199,38 +210,79 @@ npx @sentry/cli sourcemaps upload .unpeek-maps --release="$GIT_COMMIT_SHA"
|
|
|
199
210
|
|
|
200
211
|
---
|
|
201
212
|
|
|
202
|
-
##
|
|
213
|
+
## Yapay Zeka Kodlama Ajanı Entegrasyonu (AI Coding Agent Integration)
|
|
214
|
+
|
|
215
|
+
`unpeek`, açık Vercel Agent Skills belirtimi ve Ajan Becerileri Keşif Optimizasyonu (SDO) standartlarıyla tam uyumlu resmi bir Yapay Zeka Ajan Becerisi ([`skills/unpeek/SKILL.md`](skills/unpeek/SKILL.md)) sunar. Bu beceriyi eklemek; kodlama ajanlarınıza (Claude Code, Cursor, OpenAI Codex, Gemini CLI, GitHub Copilot, OpenCode) istemci paketlerini koruma, hot-path performans bütçelerini (<%2 CPU, <%15 Gzip) koruma, SSR sınırlarını gözetme ve `.unpeek-maps/` kasasını CI/CD hatlarına bağlama konularında derin uzmanlık kazandırır.
|
|
203
216
|
|
|
204
|
-
|
|
217
|
+
### Beceri (Skill) Kurulumu
|
|
205
218
|
|
|
206
|
-
|
|
219
|
+
#### 1. Standart Kurulum (Vercel Agent Skills CLI)
|
|
207
220
|
|
|
208
|
-
Beceriyi
|
|
221
|
+
Beceriyi doğrudan GitHub üzerinden projenize veya yapılandırılmış ajan ortamınıza kurun:
|
|
209
222
|
|
|
210
223
|
```bash
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
224
|
+
npx skills add Woffluon/unpeek
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
#### 2. Yerel Depo Kurulumu
|
|
228
|
+
|
|
229
|
+
`unpeek` deposu içerisinde doğrudan geliştirme veya test yaparken:
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
npx skills add .
|
|
214
233
|
```
|
|
215
234
|
|
|
216
|
-
|
|
235
|
+
#### 3. Çoklu Ajan Hedefleme ve Global Kurulum
|
|
236
|
+
|
|
237
|
+
Etkileşimli onay istemlerini atlayarak birden çok kodlama ajanını global olarak hedefleyin:
|
|
217
238
|
|
|
218
239
|
```bash
|
|
219
|
-
|
|
220
|
-
|
|
240
|
+
npx skills add Woffluon/unpeek --agent claude-code codex cursor gemini-cli github-copilot opencode --global --yes
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
#### 4. Manuel / Doğrudan Kopyalama ile Kurulum
|
|
244
|
+
|
|
245
|
+
Beceriyi proje düzeyindeki veya genel ajan dizinlerine manuel olarak da indirebilirsiniz:
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
# Proje kapsamında (.agents/skills/unpeek/SKILL.md)
|
|
249
|
+
mkdir -p .agents/skills/unpeek
|
|
221
250
|
curl -fsSL https://raw.githubusercontent.com/Woffluon/unpeek/main/skills/unpeek/SKILL.md \
|
|
222
|
-
-o
|
|
251
|
+
-o .agents/skills/unpeek/SKILL.md
|
|
223
252
|
|
|
224
|
-
#
|
|
253
|
+
# Genel ajan dizinleri (Antigravity / Gemini CLI / Claude Code)
|
|
225
254
|
mkdir -p ~/.agents/skills/unpeek
|
|
226
255
|
curl -fsSL https://raw.githubusercontent.com/Woffluon/unpeek/main/skills/unpeek/SKILL.md \
|
|
227
256
|
-o ~/.agents/skills/unpeek/SKILL.md
|
|
228
257
|
```
|
|
229
258
|
|
|
259
|
+
### Ajan Tetikleme Örneği (Prompt)
|
|
260
|
+
|
|
261
|
+
Kurulum tamamlandıktan sonra herhangi bir ajan oturumunda `$unpeek` istemiyle koruma sürecini başlatın:
|
|
262
|
+
|
|
263
|
+
```text
|
|
264
|
+
$unpeek Protect this build with passive telemetry and seed 0x7f4a2c.
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
### Token-Optimize Modüler Referans Yapısı (`skills/unpeek/references/`)
|
|
268
|
+
|
|
269
|
+
Ajan bağlam penceresini (context window) korumak ve gereksiz token tüketimini önlemek için ana [`skills/unpeek/SKILL.md`](skills/unpeek/SKILL.md) dosyası kompakt tutulmuş; detaylı rehberler `skills/unpeek/references/` dizini altındaki 6 modüler dokümana ayrılmıştır:
|
|
270
|
+
|
|
271
|
+
- **`quickstart.md`**: Sıfır ayarlı kurulum, postbuild betikleri ve 3 adımlı doğrulama döngüsü.
|
|
272
|
+
- **`frameworks.md`**: Çatı bazlı yapılandırmalar ve SSR istemci sınırları (Next.js, Vite, Webpack, Rollup).
|
|
273
|
+
- **`architecture.md`**: Acorn AST ayrıştırma, geçişken çağrı grafiği hot-path muafiyeti ve FNV-1a sağlama toplamları.
|
|
274
|
+
- **`sourcemaps.md`**: `.unpeek-maps/` kasa izolasyonu, CI hatları ve Sentry/Datadog sembol yükleme iş akışları.
|
|
275
|
+
- **`api.md`**: CLI bayrakları, programatik Node.js metotları (`protectProject`, `transformJavaScript`) ve TypeScript arayüzleri.
|
|
276
|
+
- **`recipes.md`**: Üretim zırhlama tarifleri, deterministik CI tohumları ve pasif telemetri sorun giderme adımları.
|
|
277
|
+
|
|
278
|
+
Ajanlar yalnızca o anki görevin gerektirdiği referans dosyasını seçici olarak okur; böylece bağlam şişmesi engellenir.
|
|
279
|
+
|
|
230
280
|
---
|
|
231
281
|
|
|
232
282
|
## Doğrulama, Testler ve Benchmarklar
|
|
233
283
|
|
|
284
|
+
Bu monorepo `pnpm` ile yönetilir; semantik denklik, çözücü direnci ve çalışma zamanı ek yük bütçeleri doğrulanır:
|
|
285
|
+
|
|
234
286
|
```bash
|
|
235
287
|
# Çalışma alanı bağımlılıklarını kurun
|
|
236
288
|
pnpm install
|
|
@@ -244,11 +296,27 @@ pnpm --filter unpeek run test:coverage
|
|
|
244
296
|
# V8 VM CPU ek yükü (<%2) ve Gzip artışı (<%15) benchmark testini çalıştırın
|
|
245
297
|
pnpm bench
|
|
246
298
|
|
|
247
|
-
#
|
|
299
|
+
# packages/unpeek ve apps/web genelinde katı TypeScript tip kontrolü yapın
|
|
248
300
|
pnpm typecheck
|
|
301
|
+
|
|
302
|
+
# Çekirdek paketi ve statik interaktif web arayüzünü derleyin
|
|
303
|
+
pnpm build
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Monorepo Betikleri ve Sürüm Bütünlüğü
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
# Conventional Commit sürüm hesaplamasını test edin
|
|
310
|
+
powershell -File scripts/test-versioning.ps1
|
|
311
|
+
|
|
312
|
+
# Planlanan commit ile sürüm uygunluğunu doğrulayın
|
|
313
|
+
powershell -File scripts/validate-version.ps1 -Message "fix: description"
|
|
314
|
+
|
|
315
|
+
# Sürüm paketlerini ve SHA-256 manifestlerini hazırlayın
|
|
316
|
+
powershell -File scripts/stage-release.ps1
|
|
249
317
|
```
|
|
250
318
|
|
|
251
|
-
### Benchmark Çıktı Referansı ([`benchmarks/overhead.bench.ts`](
|
|
319
|
+
### Benchmark Çıktı Referansı ([`packages/unpeek/benchmarks/overhead.bench.ts`](packages/unpeek/benchmarks/overhead.bench.ts))
|
|
252
320
|
|
|
253
321
|
- **Derleme / Dönüşüm Süresi:** `< 3000 ms`
|
|
254
322
|
- **Gzip Boyut Artışı:** `< %15` (üretim uygulama paketlerinde)
|
|
@@ -257,4 +325,4 @@ pnpm typecheck
|
|
|
257
325
|
|
|
258
326
|
## Lisans
|
|
259
327
|
|
|
260
|
-
[MIT Lisansı](
|
|
328
|
+
[MIT Lisansı](./LICENSE) kapsamında yayınlanmıştır.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 200" width="100%" height="auto" fill="none">
|
|
2
|
+
<!-- Minimalist Carbon Canvas -->
|
|
3
|
+
<rect width="960" height="200" rx="6" fill="#111111" />
|
|
4
|
+
<rect x="0.5" y="0.5" width="959" height="199" rx="5.5" stroke="#2A2A28" />
|
|
5
|
+
|
|
6
|
+
<!-- Signal Orange Top Line -->
|
|
7
|
+
<rect x="0" y="0" width="960" height="2" fill="#FF3300" />
|
|
8
|
+
|
|
9
|
+
<!-- Iconic Brand Mark (Sealed block with open hot-path cut) -->
|
|
10
|
+
<g transform="translate(458, 30) scale(1.833)">
|
|
11
|
+
<path d="M2 2h15l5 5v15H2V2Z" fill="#EDEAE1" />
|
|
12
|
+
<rect x="0" y="10.5" width="24" height="3" fill="#FF3300" />
|
|
13
|
+
</g>
|
|
14
|
+
|
|
15
|
+
<!-- Wordmark -->
|
|
16
|
+
<text x="480" y="122" text-anchor="middle" fill="#EDEAE1" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="38" font-weight="700" letter-spacing="-0.035em">unpeek</text>
|
|
17
|
+
|
|
18
|
+
<!-- Tagline -->
|
|
19
|
+
<text x="480" y="154" text-anchor="middle" fill="#8E8A7E" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="14" font-weight="400" letter-spacing="-0.01em">
|
|
20
|
+
Nothing to peek at. <tspan fill="#EDEAE1">Nothing to slow down.</tspan>
|
|
21
|
+
</text>
|
|
22
|
+
</svg>
|
package/dist/cli/index.cjs
CHANGED
|
@@ -1224,7 +1224,7 @@ ${finalCode}`;
|
|
|
1224
1224
|
}
|
|
1225
1225
|
|
|
1226
1226
|
// src/cli/index.ts
|
|
1227
|
-
var VERSION = "1.
|
|
1227
|
+
var VERSION = "1.4.0";
|
|
1228
1228
|
function getPackageVersion() {
|
|
1229
1229
|
try {
|
|
1230
1230
|
const pkgUrl = new URL("../../package.json", importMetaUrl);
|
|
@@ -1236,25 +1236,52 @@ function getPackageVersion() {
|
|
|
1236
1236
|
}
|
|
1237
1237
|
}
|
|
1238
1238
|
var RUNTIME_VERSION = getPackageVersion();
|
|
1239
|
+
var MARK_TOP = " \u259B\u2580\u2580\u259C";
|
|
1240
|
+
var MARK_BOTTOM = " \u2599\u2584\u2584\u259F";
|
|
1241
|
+
var RULE = "\u2500";
|
|
1242
|
+
var LABEL_WIDTH = 19;
|
|
1243
|
+
function colorEnabled() {
|
|
1244
|
+
if (process.env.NO_COLOR) return false;
|
|
1245
|
+
if (process.env.TERM === "dumb") return false;
|
|
1246
|
+
return Boolean(process.stdout.isTTY);
|
|
1247
|
+
}
|
|
1248
|
+
function paint(code, text) {
|
|
1249
|
+
return colorEnabled() ? `\x1B[${code}m${text}\x1B[0m` : text;
|
|
1250
|
+
}
|
|
1251
|
+
function dim(text) {
|
|
1252
|
+
return paint("2", text);
|
|
1253
|
+
}
|
|
1254
|
+
function brandBlock() {
|
|
1255
|
+
return [
|
|
1256
|
+
`${MARK_TOP} ${paint("1", `unpeek ${RUNTIME_VERSION}`)}`,
|
|
1257
|
+
`${MARK_BOTTOM} ${dim("client bundle protection")}`
|
|
1258
|
+
].join("\n");
|
|
1259
|
+
}
|
|
1260
|
+
function sectionBlock(title, rows) {
|
|
1261
|
+
const fill = Math.max(2, 46 - title.length);
|
|
1262
|
+
const header = ` ${dim(title)} ${dim(RULE.repeat(fill))}`;
|
|
1263
|
+
const body = rows.map(([label, value]) => ` ${dim(label.padEnd(LABEL_WIDTH))} ${value}`);
|
|
1264
|
+
return [header, ...body].join("\n");
|
|
1265
|
+
}
|
|
1239
1266
|
function printHelp() {
|
|
1240
|
-
const helpText =
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
Usage:
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
Options:
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1267
|
+
const helpText = [
|
|
1268
|
+
brandBlock(),
|
|
1269
|
+
"",
|
|
1270
|
+
" Usage:",
|
|
1271
|
+
" unpeek init [--dry-run] wire postbuild and the .unpeek-maps/ vault",
|
|
1272
|
+
" unpeek protect [options] protect client bundles in place",
|
|
1273
|
+
"",
|
|
1274
|
+
" Options:",
|
|
1275
|
+
" --out-dir <dir> explicit client output directory",
|
|
1276
|
+
" --seed <number> deterministic polymorphic seed",
|
|
1277
|
+
" --passive passive deterrent mode instead of gradual",
|
|
1278
|
+
" --no-maps delete .map files instead of vaulting them",
|
|
1279
|
+
" --min-string-length <num> minimum string length for the vault (default: 4)",
|
|
1280
|
+
" --private-maps-dir <dir> vault directory (default: .unpeek-maps)",
|
|
1281
|
+
" --no-shield skip the runtime anti-tamper shield",
|
|
1282
|
+
" -h, --help show help",
|
|
1283
|
+
" -v, --version show version"
|
|
1284
|
+
].join("\n");
|
|
1258
1285
|
console.log(helpText);
|
|
1259
1286
|
}
|
|
1260
1287
|
function formatBytes(bytes) {
|
|
@@ -1263,30 +1290,66 @@ function formatBytes(bytes) {
|
|
|
1263
1290
|
}
|
|
1264
1291
|
function printSummaryTable(summary) {
|
|
1265
1292
|
const sign = summary.gzipDeltaPercent > 0 ? "+" : "";
|
|
1266
|
-
const
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
]
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
console.log("
|
|
1285
|
-
console.log(
|
|
1286
|
-
|
|
1287
|
-
|
|
1293
|
+
const gzip = `${formatBytes(summary.originalGzipBytes)} -> ${formatBytes(summary.protectedGzipBytes)} ${sign}${summary.gzipDeltaPercent}%`;
|
|
1294
|
+
console.log("");
|
|
1295
|
+
console.log(brandBlock());
|
|
1296
|
+
console.log("");
|
|
1297
|
+
console.log(
|
|
1298
|
+
sectionBlock("PROJECT", [
|
|
1299
|
+
["framework", summary.framework],
|
|
1300
|
+
["output", summary.outDir],
|
|
1301
|
+
["bundles", String(summary.processedFiles)]
|
|
1302
|
+
])
|
|
1303
|
+
);
|
|
1304
|
+
console.log("");
|
|
1305
|
+
console.log(
|
|
1306
|
+
sectionBlock("CALL GRAPH", [
|
|
1307
|
+
["hot path exempt", `${summary.totalHotFunctionsSkipped} ${dim("0% tax")}`],
|
|
1308
|
+
["cold path protected", String(summary.totalColdFunctionsProtected)]
|
|
1309
|
+
])
|
|
1310
|
+
);
|
|
1311
|
+
console.log("");
|
|
1312
|
+
console.log(
|
|
1313
|
+
sectionBlock("TRANSFORM", [
|
|
1314
|
+
["string vault", `${summary.totalEncryptedStrings} literals ${dim("O(1) memo")}`],
|
|
1315
|
+
["symbol mangling", `${summary.totalMangledSymbols} bindings`]
|
|
1316
|
+
])
|
|
1317
|
+
);
|
|
1318
|
+
console.log("");
|
|
1319
|
+
console.log(
|
|
1320
|
+
sectionBlock("OUTPUT", [
|
|
1321
|
+
["source maps", `${summary.movedSourceMaps} moved -> .unpeek-maps/`],
|
|
1322
|
+
["gzip", gzip],
|
|
1323
|
+
["elapsed", `${summary.elapsedMs} ms`]
|
|
1324
|
+
])
|
|
1325
|
+
);
|
|
1326
|
+
console.log("");
|
|
1327
|
+
console.log(` ${dim("done. maps are private. hot path untouched.")}`);
|
|
1328
|
+
}
|
|
1329
|
+
function printInitResult(result, dryRun) {
|
|
1330
|
+
const postbuild = result.updatedPackageJson ? dryRun ? "would be added" : "unpeek protect (added)" : "already configured";
|
|
1331
|
+
const vault = result.updatedGitignore ? dryRun ? "would be ignored" : ".unpeek-maps/ (added)" : "already ignored";
|
|
1332
|
+
console.log("");
|
|
1333
|
+
console.log(brandBlock());
|
|
1334
|
+
console.log("");
|
|
1335
|
+
console.log(
|
|
1336
|
+
sectionBlock("PROJECT", [
|
|
1337
|
+
["framework", result.framework ?? "unknown"],
|
|
1338
|
+
["postbuild", postbuild],
|
|
1339
|
+
["vault", vault]
|
|
1340
|
+
])
|
|
1341
|
+
);
|
|
1342
|
+
console.log("");
|
|
1343
|
+
if (dryRun) {
|
|
1344
|
+
console.log(` ${dim(result.message)}`);
|
|
1345
|
+
} else if (result.updatedPackageJson || result.updatedGitignore) {
|
|
1346
|
+
console.log(` ${dim("postbuild wired. maps stay private from the first build.")}`);
|
|
1347
|
+
} else {
|
|
1348
|
+
console.log(` ${dim(result.message)}`);
|
|
1349
|
+
}
|
|
1350
|
+
if (!dryRun) {
|
|
1351
|
+
console.log(` ${dim("run your build to protect the first bundle.")}`);
|
|
1288
1352
|
}
|
|
1289
|
-
console.log(divider);
|
|
1290
1353
|
}
|
|
1291
1354
|
async function runCli(args) {
|
|
1292
1355
|
if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
|
|
@@ -1301,7 +1364,7 @@ async function runCli(args) {
|
|
|
1301
1364
|
if (command === "init") {
|
|
1302
1365
|
const dryRun = args.includes("--dry-run");
|
|
1303
1366
|
const res = initProject(process.cwd(), { dryRun });
|
|
1304
|
-
|
|
1367
|
+
printInitResult(res, dryRun);
|
|
1305
1368
|
return;
|
|
1306
1369
|
}
|
|
1307
1370
|
if (command === "protect" || args.length > 0 && args[0].startsWith("-")) {
|