jskelet 0.5.5 → 0.6.1

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.
Files changed (156) hide show
  1. package/AGENTS.md +19 -15
  2. package/CHANGELOG.md +165 -15
  3. package/README.md +16 -21
  4. package/bin/jskelet.mjs +23 -9
  5. package/docs/01-baslangic.md +4 -3
  6. package/docs/02-mimari.md +10 -4
  7. package/docs/03-routing.md +14 -7
  8. package/docs/04-render-ve-sablonlar.md +60 -43
  9. package/docs/05-islands.md +12 -8
  10. package/docs/06-cache.md +18 -7
  11. package/docs/07-yapilandirma.md +69 -27
  12. package/docs/08-build.md +15 -9
  13. package/docs/09-dev-araclari.md +22 -8
  14. package/docs/10-dagitim.md +14 -13
  15. package/docs/11-tasima.md +51 -17
  16. package/docs/12-panel-ve-oturum.md +10 -4
  17. package/docs/README.md +10 -33
  18. package/docs/en/01-getting-started.md +4 -3
  19. package/docs/en/02-architecture.md +12 -6
  20. package/docs/en/03-routing.md +15 -8
  21. package/docs/en/04-rendering.md +71 -59
  22. package/docs/en/05-islands.md +13 -8
  23. package/docs/en/06-caching.md +21 -7
  24. package/docs/en/07-configuration.md +69 -29
  25. package/docs/en/08-build.md +16 -10
  26. package/docs/en/09-dev-tools.md +24 -8
  27. package/docs/en/10-deployment.md +14 -14
  28. package/docs/en/11-migration.md +51 -16
  29. package/docs/en/12-dashboards-and-sessions.md +9 -4
  30. package/docs/en/README.md +10 -35
  31. package/package.json +48 -13
  32. package/src/build/tasks/client.mjs +91 -10
  33. package/src/build/tasks/icons.mjs +11 -1
  34. package/src/client/index.js +2 -2
  35. package/src/compile/codegen.js +4 -0
  36. package/src/compile/compile-all.js +12 -21
  37. package/src/compile/expr.js +5 -0
  38. package/src/compile/parse.js +64 -8
  39. package/src/compile/resolve.js +3 -0
  40. package/src/config/defaults.js +48 -5
  41. package/src/config/index.js +138 -27
  42. package/src/dev-server.mjs +26 -3
  43. package/src/http/cookies-entry.js +1 -0
  44. package/src/http/cookies.js +18 -0
  45. package/src/logo.png +0 -0
  46. package/src/migrate/apply.mjs +262 -0
  47. package/src/migrate/babel.mjs +79 -0
  48. package/src/migrate/classify.mjs +155 -0
  49. package/src/migrate/config.mjs +126 -0
  50. package/src/migrate/fs-walk.mjs +191 -0
  51. package/src/migrate/parse.mjs +26 -0
  52. package/src/migrate/scan.mjs +177 -0
  53. package/src/migrate/transform/expr-source.mjs +168 -0
  54. package/src/migrate/transform/island.mjs +67 -0
  55. package/src/migrate/transform/jsx-to-component.mjs +302 -0
  56. package/src/migrate/transform/jsx-to-jsk.mjs +330 -0
  57. package/src/migrate/transform/page-split.mjs +435 -0
  58. package/src/migrate/write.mjs +81 -0
  59. package/src/migrate.mjs +171 -0
  60. package/src/server/auth/handoff.js +94 -11
  61. package/src/server/create-app.js +37 -10
  62. package/src/server/ejs-adapter.js +59 -0
  63. package/src/server/html-cache.js +178 -32
  64. package/src/server/image-optimizer.js +94 -26
  65. package/src/server/middleware/dev-gate.js +21 -8
  66. package/src/server/middleware/robots-txt.js +341 -0
  67. package/src/server/port-guard.js +255 -0
  68. package/src/server/prewarm.js +137 -51
  69. package/src/server/render.js +30 -10
  70. package/src/server/status-page.js +105 -4
  71. package/src/start.mjs +18 -3
  72. package/src/templates/layout.ejs +8 -28
  73. package/src/templates/layout.jsk +30 -0
  74. package/src/templates/layout.render.js +41 -0
  75. package/src/views/helpers/tags.js +86 -3
  76. package/types/build/resolve-peer.d.mts +13 -0
  77. package/types/client/dom.d.ts +55 -0
  78. package/types/client/form.d.ts +19 -0
  79. package/types/client/index.d.ts +20 -0
  80. package/types/client/registry.d.ts +53 -0
  81. package/types/client/safe-image.d.ts +19 -0
  82. package/types/client/shared-cookie.d.ts +82 -0
  83. package/types/client/store.d.ts +18 -0
  84. package/types/client/swap.d.ts +46 -0
  85. package/types/compile/codegen.d.ts +32 -0
  86. package/types/compile/compile-all.d.ts +42 -0
  87. package/types/compile/errors.d.ts +30 -0
  88. package/types/compile/expr.d.ts +67 -0
  89. package/types/compile/index.d.ts +10 -0
  90. package/types/compile/parse.d.ts +82 -0
  91. package/types/compile/resolve.d.ts +46 -0
  92. package/types/compile/scan-exports.d.ts +9 -0
  93. package/types/config/defaults.d.ts +477 -0
  94. package/types/config/index.d.ts +304 -0
  95. package/types/config/pattern.d.ts +38 -0
  96. package/types/http/control-flow.d.ts +45 -0
  97. package/types/http/cookies-entry.d.ts +5 -0
  98. package/types/http/cookies.d.ts +113 -0
  99. package/types/http/request-cache.d.ts +13 -0
  100. package/types/http/request-context.d.ts +67 -0
  101. package/types/http/shared-cookie.d.ts +73 -0
  102. package/types/index.d.ts +30 -0
  103. package/types/log.d.mts +153 -0
  104. package/types/server/admin/actions.d.ts +16 -0
  105. package/types/server/admin/auth.d.ts +52 -0
  106. package/types/server/admin/event-log.d.ts +38 -0
  107. package/types/server/admin/gate.d.ts +43 -0
  108. package/types/server/admin/inventory.d.ts +40 -0
  109. package/types/server/admin/mount.d.ts +6 -0
  110. package/types/server/admin/router.d.ts +6 -0
  111. package/types/server/admin/snapshot.d.ts +6 -0
  112. package/types/server/assets.d.ts +47 -0
  113. package/types/server/auth/handoff.d.ts +12 -0
  114. package/types/server/cache-deps.d.ts +16 -0
  115. package/types/server/cache-vary.d.ts +30 -0
  116. package/types/server/cloudflare.d.ts +163 -0
  117. package/types/server/create-app.d.ts +25 -0
  118. package/types/server/data-cache.d.ts +116 -0
  119. package/types/server/dev/devtools.d.ts +44 -0
  120. package/types/server/dev/report.d.ts +229 -0
  121. package/types/server/dev/socket.d.ts +17 -0
  122. package/types/server/dev/version-check.d.mts +15 -0
  123. package/types/server/ejs-adapter.d.ts +11 -0
  124. package/types/server/head-hints.d.ts +40 -0
  125. package/types/server/html-cache.d.ts +207 -0
  126. package/types/server/image-optimizer.d.ts +68 -0
  127. package/types/server/logs/access-middleware.d.ts +7 -0
  128. package/types/server/logs/file-sink.d.ts +17 -0
  129. package/types/server/logs/pipeline.d.ts +37 -0
  130. package/types/server/logs/s3-put.d.ts +85 -0
  131. package/types/server/logs/s3-sink.d.ts +26 -0
  132. package/types/server/metadata.d.ts +38 -0
  133. package/types/server/middleware/compression.d.ts +17 -0
  134. package/types/server/middleware/csrf.d.ts +4 -0
  135. package/types/server/middleware/dev-gate.d.ts +2 -0
  136. package/types/server/middleware/headers.d.ts +2 -0
  137. package/types/server/middleware/redirects.d.ts +2 -0
  138. package/types/server/middleware/robots-txt.d.ts +33 -0
  139. package/types/server/middleware/static-precompressed.d.ts +5 -0
  140. package/types/server/middleware/trailing-slash.d.ts +11 -0
  141. package/types/server/middleware/upstream-proxy.d.ts +21 -0
  142. package/types/server/og-image.d.ts +149 -0
  143. package/types/server/port-guard.d.ts +50 -0
  144. package/types/server/prewarm.d.ts +131 -0
  145. package/types/server/redis.d.ts +163 -0
  146. package/types/server/render.d.ts +101 -0
  147. package/types/server/router.d.ts +5 -0
  148. package/types/server/status-page.d.ts +24 -0
  149. package/types/server/upstream-limiter.d.ts +123 -0
  150. package/types/server/upstream-tracking.d.ts +42 -0
  151. package/types/shared/cookie-domain.d.ts +29 -0
  152. package/types/templates/layout.render.d.ts +7 -0
  153. package/types/version.d.mts +10 -0
  154. package/types/views/components/loader.d.ts +5 -0
  155. package/types/views/helpers/html.d.ts +39 -0
  156. package/types/views/helpers/tags.d.ts +127 -0
@@ -0,0 +1,153 @@
1
+ /**
2
+ * @param {{ console?: boolean, emitHttp?: boolean }} [options]
3
+ */
4
+ export declare function configureLog(options?: {
5
+ console?: boolean;
6
+ emitHttp?: boolean;
7
+ }): void;
8
+ export declare const c: {
9
+ bold: (text: string) => string;
10
+ dim: (text: string) => string;
11
+ red: (text: string) => string;
12
+ green: (text: string) => string;
13
+ yellow: (text: string) => string;
14
+ blue: (text: string) => string;
15
+ magenta: (text: string) => string;
16
+ cyan: (text: string) => string;
17
+ gray: (text: string) => string;
18
+ };
19
+ export declare const symbols: {
20
+ ok: string;
21
+ fail: string;
22
+ warn: string;
23
+ cycle: string;
24
+ ready: string;
25
+ arrow: string;
26
+ };
27
+ /** @param {number} value */
28
+ export declare function ms(value: number): string;
29
+ /** @param {number} bytes */
30
+ export declare function size(bytes: number): string;
31
+ /**
32
+ * Saat, yerelden bağımsız olarak 24 saatlik biçimde. Dil etiketi vermek
33
+ * sunucunun bulunduğu makinenin diline göre `ÖÖ/ÖS` ya da `AM/PM` basılmasına
34
+ * yol açıyordu; log satırının genişliği sabit kalmalı.
35
+ *
36
+ * @returns {string} `01:49:02`
37
+ */
38
+ export declare function clock(): string;
39
+ /**
40
+ * @param {string} version
41
+ * @param {string} mode
42
+ * @param {string} [root]
43
+ */
44
+ export declare function banner(version: string, mode: string, root?: string): void;
45
+ /** @param {string} title */
46
+ export declare function section(title: string): void;
47
+ /**
48
+ * Build adımı. TTY'de spinner döner; bitince satır aynı ızgaraya oturur.
49
+ *
50
+ * @param {string} label
51
+ * @returns {{ done: (detail?: string) => number, fail: (error: unknown) => void }}
52
+ */
53
+ export declare function task(label: string): {
54
+ done: (detail?: string) => number;
55
+ fail: (error: unknown) => void;
56
+ };
57
+ /**
58
+ * Adımın sütununa yazılacak kısa özet; ikinci ve sonraki çağrılar alt satıra
59
+ * düşer. Adım dışında çağrılırsa doğrudan basılır.
60
+ *
61
+ * @param {string} text
62
+ */
63
+ export declare function detail(text: string): void;
64
+ /**
65
+ * Sütuna yazılacak özeti, adım içinde daha önce ayrıntı basılmış olsa bile
66
+ * öne alır (ör. font indirme satırlarından sonra "4/4 weights").
67
+ *
68
+ * @param {string} text
69
+ */
70
+ export declare function summary(text: string): void;
71
+ /** @param {string} text */
72
+ export declare function warn(text: string): void;
73
+ /**
74
+ * Bölüm gövdesindeki düz satır (ör. çıktı boyutları).
75
+ * @param {string} text
76
+ */
77
+ export declare function line(text: string): void;
78
+ /** @param {string} text */
79
+ export declare function error(text: string): void;
80
+ /**
81
+ * Başlangıç özeti: süre, adres ve watch durumu.
82
+ *
83
+ * @param {{ elapsed: number, url?: string | null, watching?: boolean, label?: string }} info
84
+ */
85
+ export declare function ready({ elapsed, url, watching, label }: {
86
+ elapsed: number;
87
+ url?: string | null;
88
+ watching?: boolean;
89
+ label?: string;
90
+ }): void;
91
+ /**
92
+ * Çalışma anı olayı: `01:49:03 ✓ css rebuilt 195.9 kB 150ms`
93
+ *
94
+ * Hizalama ANSI kodlarından etkilenmesin diye `message` düz metin olmalı;
95
+ * ek bilgi `note` ile geçilir.
96
+ *
97
+ * @param {{ symbol?: string, scope: string, message: string, note?: string, time?: number | null }} info
98
+ */
99
+ export declare function event({ symbol, scope, message, note, time }: {
100
+ symbol?: string;
101
+ scope: string;
102
+ message: string;
103
+ note?: string;
104
+ time?: number | null;
105
+ }): void;
106
+ /**
107
+ * HTTP isteği. Cache bilgisi yalnızca gerçekten anlamlıysa (HIT) gösterilir;
108
+ * her satıra MISS yazmak akışı okunmaz hâle getiriyor.
109
+ *
110
+ * @param {{ method: string, url: string, status: number, ms: number, cache?: string | null }} info
111
+ */
112
+ export declare function http(info: {
113
+ method: string;
114
+ url: string;
115
+ status: number;
116
+ ms: number;
117
+ cache?: string | null;
118
+ }): void;
119
+ /**
120
+ * Çerçeveli bilgi kutusu.
121
+ *
122
+ * Açılış logunda kaybolmaması gereken tek şey sır: önbellek panelinin şifresi
123
+ * her restart'ta değişiyor ve kullanıcı onu bir kez, akışın içinde görüyor.
124
+ * Genişlik içeriğe göre büyür — bir URL'i ya da 32 haneli bir şifreyi
125
+ * kırpmak kutunun bütün amacını bozar.
126
+ *
127
+ * @param {{ title: string, lines: string[],
128
+ * tint?: (value: string) => string }} info `lines` içinde boş string ayırıcı
129
+ * satır olur. Satırlar **düz metin** olmalı: bir ANSI dizisi `length`e
130
+ * sayıldığı için hizalamayı bozar, rengi çerçeve taşır.
131
+ */
132
+ export declare function box({ title, lines, tint }: {
133
+ title: string;
134
+ lines: string[];
135
+ tint?: (value: string) => string;
136
+ }): void;
137
+ /**
138
+ * Çerçeveli hata kutusu — kendi framework'ünü geliştirirken hatanın
139
+ * akış içinde kaybolmaması için.
140
+ *
141
+ * @param {{ title: string, name: string, message: string, lines?: string[] }} info
142
+ */
143
+ export declare function errorBox({ title, name, message, lines }: {
144
+ title: string;
145
+ name: string;
146
+ message: string;
147
+ lines?: string[];
148
+ }): void;
149
+ /**
150
+ * @param {(entry: Record<string, unknown>) => void} listener
151
+ * @returns {() => void} Aboneliği iptal eden fonksiyon.
152
+ */
153
+ export declare function subscribe(listener: (entry: Record<string, unknown>) => void): () => void;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @param {Record<string, any>} body
3
+ * @param {import('express').Request} req
4
+ * @returns {Promise<{ ok: boolean, code?: string,
5
+ * params?: Record<string, string | number>,
6
+ * parts?: ({ code: string, params?: Record<string, string | number> } | null)[] }>}
7
+ */
8
+ export declare function runAction(body: Record<string, any>, req: import('express').Request): Promise<{
9
+ ok: boolean;
10
+ code?: string;
11
+ params?: Record<string, string | number>;
12
+ parts?: ({
13
+ code: string;
14
+ params?: Record<string, string | number>;
15
+ } | null)[];
16
+ }>;
@@ -0,0 +1,52 @@
1
+ export declare const COOKIE_NAME = "jskelet_admin_sid";
2
+ /**
3
+ * Aksiyon isteklerinde beklenen başlık. Tarayıcı bu başlığı çapraz site bir
4
+ * formla gönderemez (preflight gerekir), yani panelin kendi CSRF freni.
5
+ */
6
+ export declare const ACTION_HEADER = "x-jskelet-admin";
7
+ /** 32 haneli, süreç ömrü kadar geçerli şifre. */
8
+ export declare const PASSWORD: string;
9
+ /**
10
+ * @param {import('express').Request} req
11
+ * @param {string} name
12
+ * @returns {string | null}
13
+ */
14
+ export declare function readCookie(req: import('express').Request, name: string): string | null;
15
+ /**
16
+ * Süresi geçmiş oturumları eler.
17
+ */
18
+ export declare function pruneSessions(): void;
19
+ /**
20
+ * @param {import('express').Request} req
21
+ * @returns {boolean}
22
+ */
23
+ export declare function authenticated(req: import('express').Request): boolean;
24
+ /**
25
+ * @param {string} password
26
+ * @returns {boolean}
27
+ */
28
+ export declare function passwordMatches(password: string): boolean;
29
+ /**
30
+ * @param {number} sessionHours
31
+ * @returns {{ token: string, maxAge: number }}
32
+ */
33
+ export declare function createSession(sessionHours: number): {
34
+ token: string;
35
+ maxAge: number;
36
+ };
37
+ /**
38
+ * @param {import('express').Request} req
39
+ */
40
+ export declare function destroySession(req: import('express').Request): void;
41
+ /**
42
+ * @param {string} basePath
43
+ * @param {string} token
44
+ * @param {number} maxAge
45
+ * @returns {string}
46
+ */
47
+ export declare function sessionCookie(basePath: string, token: string, maxAge: number): string;
48
+ /**
49
+ * @param {string} basePath
50
+ * @returns {string}
51
+ */
52
+ export declare function clearSessionCookie(basePath: string): string;
@@ -0,0 +1,38 @@
1
+ export type LogEntry = {
2
+ kind: string;
3
+ id: number;
4
+ at: number;
5
+ [key: string]: unknown;
6
+ };
7
+ /**
8
+ * @param {{ basePath: string, logSize: number, prewarmUserAgent?: string }} options
9
+ */
10
+ export declare function configureEventLog(options: {
11
+ basePath: string;
12
+ logSize: number;
13
+ prewarmUserAgent?: string;
14
+ }): void;
15
+ /**
16
+ * @param {Omit<LogEntry, "id" | "at"> & { kind: string }} partial
17
+ * @returns {LogEntry}
18
+ */
19
+ export declare function push(partial: Omit<LogEntry, "id" | "at"> & {
20
+ kind: string;
21
+ }): LogEntry;
22
+ /**
23
+ * @param {number} [afterId]
24
+ * @param {number} [limit]
25
+ * @returns {LogEntry[]}
26
+ */
27
+ export declare function list(afterId?: number, limit?: number): LogEntry[];
28
+ /**
29
+ * @param {(entry: LogEntry) => void} listener
30
+ * @returns {() => void}
31
+ */
32
+ export declare function subscribeLive(listener: (entry: LogEntry) => void): () => void;
33
+ /**
34
+ * HTTP yanıt bitiminde ring'e yazar. Admin yolları ve prewarm UA atlanır.
35
+ *
36
+ * @returns {import('express').RequestHandler}
37
+ */
38
+ export declare function requestLogMiddleware(): import('express').RequestHandler;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @param {import('express').Request} req
3
+ * @returns {string}
4
+ */
5
+ export declare function clientKey(req: import('express').Request): string;
6
+ /**
7
+ * @param {string} ua
8
+ * @returns {boolean}
9
+ */
10
+ export declare function looksLikeBot(ua: string): boolean;
11
+ /**
12
+ * Exact IP veya CIDR (`10.0.0.0/8`). IPv6 için yalnızca exact eşleşme.
13
+ *
14
+ * @param {string} ip
15
+ * @param {string[]} allowIps
16
+ * @returns {boolean}
17
+ */
18
+ export declare function ipAllowed(ip: string, allowIps: string[]): boolean;
19
+ /**
20
+ * @param {import('express').Request} req
21
+ * @returns {boolean}
22
+ */
23
+ export declare function banned(req: import('express').Request): boolean;
24
+ /**
25
+ * @param {import('express').Request} req
26
+ * @param {string} reason
27
+ * @param {{ banAttempts: number, banHours: number }} settings
28
+ */
29
+ export declare function noteFailure(req: import('express').Request, reason: string, settings: {
30
+ banAttempts: number;
31
+ banHours: number;
32
+ }): void;
33
+ /**
34
+ * @param {import('express').Request} req
35
+ */
36
+ export declare function clearOffender(req: import('express').Request): void;
37
+ /**
38
+ * Kapı middleware'i: ban → IP → bot. Hepsi 404.
39
+ *
40
+ * @param {() => typeof import('../../config/defaults.js').DEFAULT_ADMIN} getSettings
41
+ * @returns {import('express').RequestHandler}
42
+ */
43
+ export declare function gateMiddleware(getSettings: () => typeof import('../../config/defaults.js').DEFAULT_ADMIN): import('express').RequestHandler;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Express router stack'ini dolaşır. İç API kırılgan; yalnızca gözlem için.
3
+ *
4
+ * @param {import('express').Express} app
5
+ * @returns {{ method: string, path: string }[]}
6
+ */
7
+ export declare function listExpressRoutes(app: import('express').Express): {
8
+ method: string;
9
+ path: string;
10
+ }[];
11
+ /**
12
+ * `routes/` altındaki (veya config.routes listesindeki) modül dosyaları.
13
+ *
14
+ * @returns {{ file: string, relative: string }[]}
15
+ */
16
+ export declare function listRouteModules(): {
17
+ file: string;
18
+ relative: string;
19
+ }[];
20
+ /**
21
+ * `views/` altındaki şablon ve bileşen dosyaları.
22
+ *
23
+ * @returns {{ relative: string, kind: "ejs" | "js" | "other" }[]}
24
+ */
25
+ export declare function listViews(): {
26
+ relative: string;
27
+ kind: "ejs" | "js" | "other";
28
+ }[];
29
+ /**
30
+ * Son HTTP log'larından path başına özet.
31
+ *
32
+ * @returns {Record<string, { status: number, ms: number, cache: string | null, at: number, count: number }>}
33
+ */
34
+ export declare function routeActivity(): Record<string, {
35
+ status: number;
36
+ ms: number;
37
+ cache: string | null;
38
+ at: number;
39
+ count: number;
40
+ }>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Paneli uygulamaya bağlar, istek log middleware'ini kurar ve şifreyi loglar.
3
+ *
4
+ * @param {import('express').Express} app
5
+ */
6
+ export declare function mountAdmin(app: import('express').Express): void;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @param {() => typeof import('../../config/defaults.js').DEFAULT_ADMIN} getSettings
3
+ * @param {import('express').Express} app
4
+ * @returns {import('express').Router}
5
+ */
6
+ export declare function createAdminRouter(getSettings: () => typeof import('../../config/defaults.js').DEFAULT_ADMIN, app: import('express').Express): import('express').Router;
@@ -0,0 +1,6 @@
1
+ export declare const BOOT_ID: string;
2
+ /**
3
+ * @param {string} query Anahtar filtresi (boş → filtre yok).
4
+ * @returns {Promise<object>}
5
+ */
6
+ export declare function snapshot(query: string): Promise<object>;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @param {string} name Örn. "app.css", "main.js", "sprite.svg"
3
+ * @returns {string}
4
+ */
5
+ export declare function asset(name: string): string;
6
+ /**
7
+ * @param {string} name
8
+ * @returns {boolean}
9
+ */
10
+ export declare function hasAsset(name: string): boolean;
11
+ /**
12
+ * Bu build'i tanımlayan kısa kimlik (`build.json` → `id`).
13
+ *
14
+ * Paylaşımlı önbellek anahtarlarının isim alanı bu: saklanan HTML hash'li
15
+ * varlık yollarını gömdüğü için bir deploy'dan sonra eski HTML **geçersizdir**.
16
+ *
17
+ * Build çalışmadıysa `"dev"` döner — build çıktısı olmadan da ayağa kalkma
18
+ * kuralı burada da geçerli.
19
+ *
20
+ * @returns {string}
21
+ */
22
+ export declare function getBuildId(): string;
23
+ export type OptimizedImage = {
24
+ width: number;
25
+ height: number;
26
+ variants: {
27
+ width: number;
28
+ url: string;
29
+ }[];
30
+ };
31
+ /**
32
+ * `build/tasks/images.mjs` çıktısı: kaynak yolundan webp varyantlarına.
33
+ * Build çalışmadıysa boş kalır ve görseller orijinalleriyle servis edilir.
34
+ *
35
+ * @param {string} [src] Örn. "/hero.png"
36
+ * @returns {OptimizedImage | undefined}
37
+ */
38
+ export declare function optimizedImage(src?: string): OptimizedImage | undefined;
39
+ /**
40
+ * Sprite'taki sembol kimlikleri. Sprite yalnızca kaynakta **statik olarak**
41
+ * görülen ikon adlarını içerir; adı çalışma anında hesaplanan bir `icon()`
42
+ * çağrısı eksik sembole işaret ederse ekranda sessizce boşluk kalır. Dev'de
43
+ * `icon()` bu kümeye bakıp uyarır.
44
+ *
45
+ * @returns {Set<string>}
46
+ */
47
+ export declare function getSpriteIds(): Set<string>;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Handoff uçlarını mount eder. `auth.crossSubdomainHandoff` kapalıysa no-op.
3
+ * create-app CSRF'den *sonra* çağırmalıdır.
4
+ *
5
+ * @param {import('express').Express} app
6
+ * @returns {void}
7
+ */
8
+ export declare function mountAuthHandoff(app: import('express').Express): void;
9
+ /** @returns {void} */
10
+ export declare function _resetHandoffTickets(): void;
11
+ /** @returns {number} */
12
+ export declare function _handoffTicketCount(): number;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * `run`'ı, içindeki `recordDependency()` çağrılarının `deps`'e yazacağı bir
3
+ * bağlamda çalıştırır.
4
+ *
5
+ * @template T
6
+ * @param {Set<string>} deps
7
+ * @param {() => T} run
8
+ * @returns {T}
9
+ */
10
+ export declare function collectDependencies<T>(deps: Set<string>, run: () => T): T;
11
+ /**
12
+ * Bu render'ın bir veri anahtarını okuduğunu bildirir. Bağlam yoksa no-op.
13
+ *
14
+ * @param {string} key
15
+ */
16
+ export declare function recordDependency(key: string): void;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Public Host: `x-forwarded-host` (ilk değer) yoksa `Host`. Lowercase, portsuz.
3
+ * IPv6 (`[::1]:3000`) köşeli parantezleri korur.
4
+ *
5
+ * @param {{ headers?: Record<string, unknown>, get?: (name: string) => string | undefined }} req
6
+ * @returns {string}
7
+ */
8
+ export declare function publicHost(req: {
9
+ headers?: Record<string, unknown>;
10
+ get?: (name: string) => string | undefined;
11
+ }): string;
12
+ /**
13
+ * Anahtarın başına eklenen önek: `h=tr.example.com|` veya
14
+ * `h=…&x-locale=tr|`. Vary yoksa boş string.
15
+ *
16
+ * @param {{ headers?: Record<string, unknown>, get?: (name: string) => string | undefined }} [req]
17
+ * @returns {string}
18
+ */
19
+ export declare function buildVaryPrefix(req?: {
20
+ headers?: Record<string, unknown>;
21
+ get?: (name: string) => string | undefined;
22
+ }): string;
23
+ /**
24
+ * Anahtardan yol kısmını çıkarır (`[vary|]yol?query` → `yol`).
25
+ * Invalidation hedefleri `/…` ile başlar; vary öneki eşleşmeye karışmamalı.
26
+ *
27
+ * @param {string} key
28
+ * @returns {string}
29
+ */
30
+ export declare function pathOfCacheKey(key: string): string;
@@ -0,0 +1,163 @@
1
+ /** @returns {boolean} */
2
+ export declare function cloudflareConfigured(): boolean;
3
+ /**
4
+ * Panelin gösterdiği kurulum özeti. Token'ın kendisi değil, **nereden
5
+ * geldiği** döner.
6
+ *
7
+ * @returns {{ configured: boolean, enabled: boolean, zoneId: string | null,
8
+ * tokenSource: "env" | "config" | null, hostname: string | null }}
9
+ */
10
+ export declare function getCloudflareStatus(): {
11
+ configured: boolean;
12
+ enabled: boolean;
13
+ zoneId: string | null;
14
+ tokenSource: "env" | "config" | null;
15
+ hostname: string | null;
16
+ };
17
+ /**
18
+ * Zone künyesi + cache ile ilgili ayarlar.
19
+ *
20
+ * Ayarlar tek tek değil, tek `GET /settings` turuyla okunur ve ilgili olanlar
21
+ * ayıklanır. Tiered Cache ve Cache Reserve ayrı uçlarda yaşıyor; ikisi de
22
+ * planla sınırlı olduğu için hataları **yok sayılır**, yalnızca `null` olurlar
23
+ * — Free bir zone'da panel yine açılmalı.
24
+ *
25
+ * @param {{ force?: boolean }} [options]
26
+ * @returns {Promise<object>}
27
+ */
28
+ export declare function fetchCloudflareOverview(options?: {
29
+ force?: boolean;
30
+ }): Promise<object>;
31
+ /**
32
+ * Zone'un cache durumu kırılımı: `hit`, `miss`, `dynamic`, `expired`… her biri
33
+ * için istek sayısı ve edge'den giden bayt.
34
+ *
35
+ * `httpRequestsAdaptiveGroups` bilinçli seçildi: `cacheStatus` boyutu eski
36
+ * `httpRequests1hGroups` veri kümesinde yok ve pek çok hesapta hata veriyor.
37
+ * Adaptive küme örnekleme kullanıyor, yani sayılar **tahmindir** — oranlar
38
+ * doğru, mutlak değerler yaklaşık.
39
+ *
40
+ * @param {{ hours?: number }} [options]
41
+ * @returns {Promise<{ ok: boolean, hours: number, sampled: boolean,
42
+ * rows: { status: string, requests: number, bytes: number }[],
43
+ * error?: string }>}
44
+ */
45
+ export declare function fetchCacheAnalytics(options?: {
46
+ hours?: number;
47
+ }): Promise<{
48
+ ok: boolean;
49
+ hours: number;
50
+ sampled: boolean;
51
+ rows: {
52
+ status: string;
53
+ requests: number;
54
+ bytes: number;
55
+ }[];
56
+ error?: string;
57
+ }>;
58
+ /**
59
+ * Bir yolun **kolo bazında** cache kırılımı.
60
+ *
61
+ * Bu, "kaç edge'de bu sayfanın kopyası var" sorusunun API'nin verdiği en yakın
62
+ * cevabı: son `hours` saatte hangi Cloudflare şehri o yolu kaç kez cache'ten
63
+ * (`hit`) ya da origin'den (`miss`, `expired`, `dynamic`) servis etti. Envanter
64
+ * değil, gözlem — hiç istek almamış bir edge listede görünmez, kopyası olsa da.
65
+ *
66
+ * @param {{ path: string, hours?: number }} options
67
+ * @returns {Promise<{ ok: boolean, path: string, hours: number,
68
+ * colos: { colo: string, hits: number, misses: number }[],
69
+ * hits: number, misses: number, error?: string }>}
70
+ */
71
+ export declare function fetchPathEdges({ path, hours }: {
72
+ path: string;
73
+ hours?: number;
74
+ }): Promise<{
75
+ ok: boolean;
76
+ path: string;
77
+ hours: number;
78
+ colos: {
79
+ colo: string;
80
+ hits: number;
81
+ misses: number;
82
+ }[];
83
+ hits: number;
84
+ misses: number;
85
+ error?: string;
86
+ }>;
87
+ /**
88
+ * Cloudflare önbelleğini düşürür.
89
+ *
90
+ * Dört hedefleme biçimi de API'nin verdiği hâliyle: `files` (tam URL),
91
+ * `prefixes`, `hosts`, `tags`. Hepsi artık her planda çalışıyor ama istek
92
+ * başına en fazla 100 anahtar kabul ediliyor; uzun listeler burada parçalanır
93
+ * ve **sırayla** gönderilir — paralel göndermek Free planda dakikada beş
94
+ * istekle sınırlı olan hız freni yüzünden yarısı reddedilen bir tur demek.
95
+ *
96
+ * @param {{ everything?: boolean, files?: string[], prefixes?: string[],
97
+ * hosts?: string[], tags?: string[] }} target
98
+ * @returns {Promise<{ ok: boolean, purged: number, batches: number,
99
+ * error?: string }>}
100
+ */
101
+ export declare function purgeCloudflare(target: {
102
+ everything?: boolean;
103
+ files?: string[];
104
+ prefixes?: string[];
105
+ hosts?: string[];
106
+ tags?: string[];
107
+ }): Promise<{
108
+ ok: boolean;
109
+ purged: number;
110
+ batches: number;
111
+ error?: string;
112
+ }>;
113
+ /**
114
+ * Yolları tam URL'e çevirir. Cloudflare `files` purge'ü şemayı da içeren tam
115
+ * URL istiyor; panel elinde yol (`/haber/abc`) tutuyor.
116
+ *
117
+ * @param {string[]} paths
118
+ * @param {string} [fallbackOrigin] `cloudflare.hostname` verilmediğinde
119
+ * kullanılacak kök (panelin açıldığı origin).
120
+ * @returns {string[]}
121
+ */
122
+ export declare function toCloudflareUrls(paths: string[], fallbackOrigin?: string): string[];
123
+ /**
124
+ * Cache ile ilgili bir zone ayarını değiştirir.
125
+ *
126
+ * Yalnızca beyaz listedeki ayarlar: panelin işi cache, ve bir teşhis
127
+ * arayüzünden zone'un tamamını yeniden yapılandırılabilir yapmak gereksiz bir
128
+ * yüzey.
129
+ *
130
+ * @param {"development_mode" | "cache_level" | "browser_cache_ttl" |
131
+ * "always_online" | "sort_query_string_for_cache"} id
132
+ * @param {string | number} value
133
+ * @returns {Promise<{ ok: boolean, value?: unknown, error?: string }>}
134
+ */
135
+ export declare function setCloudflareSetting(id: "development_mode" | "cache_level" | "browser_cache_ttl" | "always_online" | "sort_query_string_for_cache", value: string | number): Promise<{
136
+ ok: boolean;
137
+ value?: unknown;
138
+ error?: string;
139
+ }>;
140
+ /**
141
+ * Tiered Cache ya da Cache Reserve'ü açar/kapatır. İkisi de ayrı uçlarda ve
142
+ * planla sınırlı; kapalı bir planda Cloudflare açıklayıcı bir hata döner ve
143
+ * panel onu gösterir.
144
+ *
145
+ * @param {"tiered_caching" | "cache_reserve" | "regional_tiered_cache"} feature
146
+ * @param {"on" | "off"} value
147
+ * @returns {Promise<{ ok: boolean, error?: string }>}
148
+ */
149
+ export declare function setCloudflareFeature(feature: "tiered_caching" | "cache_reserve" | "regional_tiered_cache", value: "on" | "off"): Promise<{
150
+ ok: boolean;
151
+ error?: string;
152
+ }>;
153
+ /**
154
+ * Cache Reserve'ü (R2'deki kalıcı kopya) boşaltır. Purge'den ayrı bir işlem:
155
+ * `purge_everything` edge önbelleklerini düşürüyor, Cache Reserve'deki kopya
156
+ * kalıyor.
157
+ *
158
+ * @returns {Promise<{ ok: boolean, error?: string }>}
159
+ */
160
+ export declare function clearCloudflareCacheReserve(): Promise<{
161
+ ok: boolean;
162
+ error?: string;
163
+ }>;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @param {{ root?: string, configFile?: string }} [options]
3
+ * @returns {Promise<import('express').Express>}
4
+ */
5
+ export declare function createApp(options?: {
6
+ root?: string;
7
+ configFile?: string;
8
+ }): Promise<import('express').Express>;
9
+ /**
10
+ * Uygulamayı kurup dinlemeye başlar. CLI `jskelet start` bunu çağırır;
11
+ * gömülü kullanımda `createApp()` tercih edilir.
12
+ *
13
+ * Port doluysa başlamaz. `murder: true` veya argv'de `--murder` varsa
14
+ * dinleyen süreç öldürülüp bağlama denenir.
15
+ *
16
+ * @param {{ root?: string, configFile?: string, port?: number, host?: string, murder?: boolean }} [options]
17
+ * @returns {Promise<import('http').Server>}
18
+ */
19
+ export declare function startServer(options?: {
20
+ root?: string;
21
+ configFile?: string;
22
+ port?: number;
23
+ host?: string;
24
+ murder?: boolean;
25
+ }): Promise<import('http').Server>;