unpeek 2.0.0 → 3.0.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.
Files changed (103) hide show
  1. package/README.md +30 -8
  2. package/README.tr.md +30 -8
  3. package/dist/adapters/esbuild.cjs +13 -0
  4. package/dist/{esbuild.d.cts → adapters/esbuild.d.cts} +2 -2
  5. package/dist/{esbuild.d.ts → adapters/esbuild.d.ts} +2 -2
  6. package/dist/adapters/esbuild.js +11 -0
  7. package/dist/adapters/next/adapter.cjs +42 -0
  8. package/dist/{next → adapters/next}/adapter.d.cts +4 -4
  9. package/dist/{next → adapters/next}/adapter.d.ts +4 -4
  10. package/dist/adapters/next/adapter.js +42 -0
  11. package/dist/adapters/next/index.cjs +15 -0
  12. package/dist/adapters/next/index.d.cts +53 -0
  13. package/dist/adapters/next/index.d.ts +53 -0
  14. package/dist/adapters/next/index.js +15 -0
  15. package/dist/adapters/rollup.cjs +13 -0
  16. package/dist/{rollup.d.cts → adapters/rollup.d.cts} +2 -2
  17. package/dist/{rollup.d.ts → adapters/rollup.d.ts} +2 -2
  18. package/dist/adapters/rollup.js +11 -0
  19. package/dist/adapters/rspack.cjs +12 -0
  20. package/dist/adapters/rspack.d.cts +13 -0
  21. package/dist/adapters/rspack.d.ts +11 -0
  22. package/dist/adapters/rspack.js +12 -0
  23. package/dist/adapters/vite.cjs +13 -0
  24. package/dist/{vite.d.cts → adapters/vite.d.cts} +2 -2
  25. package/dist/{vite.d.ts → adapters/vite.d.ts} +2 -2
  26. package/dist/adapters/vite.js +11 -0
  27. package/dist/adapters/webpack.cjs +13 -0
  28. package/dist/{webpack.d.cts → adapters/webpack.d.cts} +2 -2
  29. package/dist/{webpack.d.ts → adapters/webpack.d.ts} +2 -2
  30. package/dist/adapters/webpack.js +11 -0
  31. package/dist/browser.cjs +8 -5
  32. package/dist/browser.d.cts +41 -3
  33. package/dist/browser.d.ts +41 -3
  34. package/dist/browser.js +10 -7
  35. package/dist/{chunk-GAVI2C44.cjs → chunk-6TDCSIRZ.cjs} +76 -47
  36. package/dist/{chunk-5LCMI2TL.js → chunk-APWMNVAZ.js} +221 -32
  37. package/dist/{chunk-5QD6FZPB.js → chunk-BPRSCRUZ.js} +71 -42
  38. package/dist/{chunk-X5MKMFMX.js → chunk-DUK2SECY.js} +7 -7
  39. package/dist/chunk-FCF2EGPM.js +80 -0
  40. package/dist/{chunk-7YVEHJVM.cjs → chunk-I6GXEHFR.cjs} +241 -52
  41. package/dist/{chunk-LXP73HJC.cjs → chunk-IAD5DV3D.cjs} +1048 -213
  42. package/dist/chunk-IEBVL5BT.cjs +80 -0
  43. package/dist/{chunk-GZB7PFLY.js → chunk-IICVBTR2.js} +25 -62
  44. package/dist/{chunk-UMPUYLLZ.js → chunk-IZIWDJRF.js} +936 -101
  45. package/dist/chunk-L6BOM5VS.cjs +40 -0
  46. package/dist/{chunk-OOXSZTRV.js → chunk-LA6J3BT3.js} +26 -1
  47. package/dist/{chunk-24K5NDXH.cjs → chunk-ONM2CSTU.cjs} +45 -82
  48. package/dist/{chunk-5M6Z7ZFT.cjs → chunk-RXUY3MPH.cjs} +10 -10
  49. package/dist/cli/index.js +7309 -32
  50. package/dist/{types-BBSRUEab.d.cts → config-CfXY_iDD.d.cts} +44 -86
  51. package/dist/{types-BBSRUEab.d.ts → config-CfXY_iDD.d.ts} +44 -86
  52. package/dist/config.cjs +4 -16
  53. package/dist/config.d.cts +1 -12
  54. package/dist/config.d.ts +1 -12
  55. package/dist/config.js +5 -17
  56. package/dist/index-CjRTNPlj.d.cts +46 -0
  57. package/dist/index-Cm1IloVm.d.ts +46 -0
  58. package/dist/index.cjs +636 -9
  59. package/dist/index.d.cts +9 -17
  60. package/dist/index.d.ts +9 -17
  61. package/dist/index.js +638 -11
  62. package/dist/plugins/unplugin.cjs +20 -0
  63. package/dist/plugins/unplugin.d.cts +17 -0
  64. package/dist/plugins/unplugin.d.ts +15 -0
  65. package/dist/{bundler → plugins}/unplugin.js +5 -5
  66. package/dist/types-DYQIzGf6.d.cts +112 -0
  67. package/dist/types-ZHAFdOd3.d.ts +112 -0
  68. package/package.json +48 -52
  69. package/dist/ast/index.cjs +0 -17
  70. package/dist/ast/index.d.cts +0 -18
  71. package/dist/ast/index.d.ts +0 -18
  72. package/dist/ast/index.js +0 -17
  73. package/dist/bundler/unplugin.cjs +0 -20
  74. package/dist/bundler/unplugin.d.cts +0 -16
  75. package/dist/bundler/unplugin.d.ts +0 -14
  76. package/dist/chunk-27HR647Q.js +0 -190
  77. package/dist/chunk-4TDLLEEU.cjs +0 -15
  78. package/dist/chunk-6N6S6WTQ.cjs +0 -423
  79. package/dist/chunk-J5CGNZDM.cjs +0 -190
  80. package/dist/chunk-KQWNFKT2.js +0 -423
  81. package/dist/chunk-R6EBIR3T.cjs +0 -14
  82. package/dist/chunk-S4S2WXGC.js +0 -14
  83. package/dist/cli/index.cjs +0 -324
  84. package/dist/cli/index.d.cts +0 -22
  85. package/dist/cli/index.d.ts +0 -22
  86. package/dist/esbuild.cjs +0 -15
  87. package/dist/esbuild.js +0 -13
  88. package/dist/next/adapter.cjs +0 -31
  89. package/dist/next/adapter.js +0 -31
  90. package/dist/next/index.cjs +0 -18
  91. package/dist/next/index.d.cts +0 -42
  92. package/dist/next/index.d.ts +0 -42
  93. package/dist/next/index.js +0 -18
  94. package/dist/rollup.cjs +0 -15
  95. package/dist/rollup.js +0 -13
  96. package/dist/runtime/index.cjs +0 -17
  97. package/dist/runtime/index.d.cts +0 -36
  98. package/dist/runtime/index.d.ts +0 -36
  99. package/dist/runtime/index.js +0 -17
  100. package/dist/vite.cjs +0 -15
  101. package/dist/vite.js +0 -13
  102. package/dist/webpack.cjs +0 -15
  103. package/dist/webpack.js +0 -13
@@ -1,324 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
-
3
- var _chunkJ5CGNZDMcjs = require('../chunk-J5CGNZDM.cjs');
4
-
5
-
6
- var _chunk7YVEHJVMcjs = require('../chunk-7YVEHJVM.cjs');
7
- require('../chunk-24K5NDXH.cjs');
8
- require('../chunk-LXP73HJC.cjs');
9
- require('../chunk-6N6S6WTQ.cjs');
10
- require('../chunk-R6EBIR3T.cjs');
11
-
12
-
13
- var _chunk4TDLLEEUcjs = require('../chunk-4TDLLEEU.cjs');
14
-
15
- // src/cli/index.ts
16
- var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
17
- var _path = require('path'); var _path2 = _interopRequireDefault(_path);
18
- var _url = require('url');
19
- var VERSION = "2.0.0";
20
- var cachedPackageVersion;
21
- function getPackageVersion() {
22
- if (cachedPackageVersion !== void 0) {
23
- return cachedPackageVersion;
24
- }
25
- try {
26
- const pkgUrl = new URL("../../package.json", _chunk4TDLLEEUcjs.importMetaUrl);
27
- const content = _fs2.default.readFileSync(pkgUrl, "utf8");
28
- const parsed = JSON.parse(content);
29
- cachedPackageVersion = _nullishCoalesce(parsed.version, () => ( VERSION));
30
- } catch (e) {
31
- cachedPackageVersion = VERSION;
32
- }
33
- return cachedPackageVersion;
34
- }
35
- var MARK_TOP = " \u259B\u2580\u2580\u259C";
36
- var MARK_BOTTOM = " \u2599\u2584\u2584\u259F";
37
- var RULE = "\u2500";
38
- var LABEL_WIDTH = 19;
39
- function colorEnabled() {
40
- if (process.env.NO_COLOR) return false;
41
- if (process.env.TERM === "dumb") return false;
42
- return Boolean(process.stdout.isTTY);
43
- }
44
- function paint(code, text) {
45
- return colorEnabled() ? `\x1B[${code}m${text}\x1B[0m` : text;
46
- }
47
- function dim(text) {
48
- return paint("2", text);
49
- }
50
- function brandBlock() {
51
- return [
52
- `${MARK_TOP} ${paint("1", `unpeek ${getPackageVersion()}`)}`,
53
- `${MARK_BOTTOM} ${dim("client bundle protection")}`
54
- ].join("\n");
55
- }
56
- function sectionBlock(title, rows) {
57
- const fill = Math.max(2, 46 - title.length);
58
- const header = ` ${dim(title)} ${dim(RULE.repeat(fill))}`;
59
- const body = rows.map(([label, value]) => ` ${dim(label.padEnd(LABEL_WIDTH))} ${value}`);
60
- return [header, ...body].join("\n");
61
- }
62
- function printHelp() {
63
- const helpText = [
64
- brandBlock(),
65
- "",
66
- " Usage:",
67
- " unpeek init [--dry-run] wire postbuild and the .unpeek-maps/ vault",
68
- " unpeek protect [options] protect client bundles in place (Tier 1 default: <2% CPU, <15% Gzip)",
69
- "",
70
- " Options:",
71
- " --out-dir <dir> explicit client output directory",
72
- " --seed <number> deterministic polymorphic seed",
73
- " --passive passive deterrent mode (default: marks tamper, keeps console)",
74
- " --gradual gradual deterrent mode (silences console on tamper)",
75
- " --detect-headless treat navigator.webdriver / HeadlessChrome as tamper",
76
- " --no-maps delete .map files instead of vaulting them",
77
- " --min-string-length <num> minimum string length for the vault (default: 4)",
78
- " --private-maps-dir <dir> vault directory (default: .unpeek-maps)",
79
- " --no-shield skip the runtime anti-tamper shield",
80
- " --aggressive enable Tier 2 aggressive protection (Micro-VM & WASM KDF)",
81
- " -h, --help show help",
82
- " -v, --version show version",
83
- "",
84
- " Tiers:",
85
- " Tier 1 (default) call-graph hot-path exemption (<2% CPU, <15% Gzip)",
86
- " Tier 2 (--aggressive) zero plaintext exposure via Micro-VM & WASM KDF"
87
- ].join("\n");
88
- console.log(helpText);
89
- }
90
- function formatBytes(bytes) {
91
- if (bytes < 1024) return `${bytes} B`;
92
- return `${(bytes / 1024).toFixed(2)} KB`;
93
- }
94
- function printSummaryTable(summary) {
95
- const sign = summary.gzipDeltaPercent > 0 ? "+" : "";
96
- const gzip = `${formatBytes(summary.originalGzipBytes)} -> ${formatBytes(summary.protectedGzipBytes)} ${sign}${summary.gzipDeltaPercent}%`;
97
- const tierLabel = summary.aggressive ? "Tier 2 (--aggressive: Micro-VM & WASM KDF)" : "Tier 1 (default: <2% CPU, <15% Gzip)";
98
- console.log("");
99
- console.log(brandBlock());
100
- console.log("");
101
- console.log(
102
- sectionBlock("PROJECT", [
103
- ["framework", summary.framework],
104
- ["tier", tierLabel],
105
- ["output", summary.outDir],
106
- ["bundles", String(summary.processedFiles)]
107
- ])
108
- );
109
- console.log("");
110
- console.log(
111
- sectionBlock("CALL GRAPH", [
112
- ["hot path exempt", `${summary.totalHotFunctionsSkipped} ${dim("0% tax")}`],
113
- ["cold path protected", String(summary.totalColdFunctionsProtected)]
114
- ])
115
- );
116
- console.log("");
117
- console.log(
118
- sectionBlock("TRANSFORM", [
119
- ["string vault", `${summary.totalEncryptedStrings} literals ${dim("O(1) memo")}`],
120
- ["symbol mangling", `${summary.totalMangledSymbols} bindings`]
121
- ])
122
- );
123
- console.log("");
124
- console.log(
125
- sectionBlock("OUTPUT", [
126
- ["source maps", `${summary.movedSourceMaps} moved -> .unpeek-maps/`],
127
- ["gzip", gzip],
128
- ["elapsed", `${summary.elapsedMs} ms`]
129
- ])
130
- );
131
- console.log("");
132
- console.log(` ${dim("done. maps are private. hot path untouched.")}`);
133
- if (summary.dockerIgnoreMissing) {
134
- console.log("");
135
- console.log(
136
- "[unpeek:advisory] .dockerignore is missing .unpeek-maps/. Private maps may leak into Docker image during 'COPY . .'."
137
- );
138
- }
139
- }
140
- function printInitResult(result, dryRun) {
141
- const postbuild = result.isNext162Plus ? "n/a (Build Adapter)" : result.updatedPackageJson ? dryRun ? "would be added" : "unpeek protect (added)" : "already configured";
142
- const adapterStatus = result.isNext162Plus ? result.updatedNextConfig ? dryRun ? "withUnpeek (would be configured)" : "withUnpeek (configured)" : "withUnpeek (already configured)" : void 0;
143
- const vault = result.updatedGitignore ? dryRun ? "would be ignored" : ".unpeek-maps/ (added)" : "already ignored";
144
- const rows = [
145
- ["framework", _nullishCoalesce(result.framework, () => ( "unknown"))]
146
- ];
147
- if (adapterStatus) {
148
- rows.push(["next.config", adapterStatus]);
149
- }
150
- rows.push(["postbuild", postbuild]);
151
- rows.push(["vault", vault]);
152
- console.log("");
153
- console.log(brandBlock());
154
- console.log("");
155
- console.log(sectionBlock("PROJECT", rows));
156
- console.log("");
157
- if (dryRun) {
158
- console.log(` ${dim(result.message)}`);
159
- } else if (result.updatedPackageJson || result.updatedGitignore || result.updatedNextConfig) {
160
- console.log(` ${dim("unpeek wired. maps stay private from the first build.")}`);
161
- } else {
162
- console.log(` ${dim(result.message)}`);
163
- }
164
- if (!dryRun) {
165
- console.log(` ${dim("run your build to protect the first bundle.")}`);
166
- }
167
- }
168
- function readFlagValue(args, index, flag) {
169
- const arg = args[index];
170
- if (arg.startsWith(`${flag}=`)) {
171
- const value = arg.slice(flag.length + 1);
172
- if (!value) {
173
- return { error: `Missing value for ${flag}` };
174
- }
175
- return { value, nextIndex: index };
176
- }
177
- const next = args[index + 1];
178
- if (!next || next.startsWith("-")) {
179
- return { error: `Missing value for ${flag}` };
180
- }
181
- return { value: next, nextIndex: index + 1 };
182
- }
183
- function parseNumericFlag(raw, flag, requireNonNegativeInt = false) {
184
- const trimmed = raw.trim();
185
- if (!trimmed) {
186
- return { error: `Invalid numeric value for ${flag}: "${raw}"` };
187
- }
188
- const parsed = Number(trimmed);
189
- if (Number.isNaN(parsed) || !Number.isFinite(parsed)) {
190
- return { error: `Invalid numeric value for ${flag}: "${raw}"` };
191
- }
192
- if (requireNonNegativeInt && (!Number.isInteger(parsed) || parsed < 0)) {
193
- return { error: `Invalid non-negative integer for ${flag}: "${raw}"` };
194
- }
195
- return { value: parsed };
196
- }
197
- function parseCliArgs(args, cwd = process.cwd()) {
198
- if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
199
- return { kind: "help" };
200
- }
201
- if (args.includes("--version") || args.includes("-v")) {
202
- return { kind: "version" };
203
- }
204
- const first = args[0];
205
- const hasSubcommand = !first.startsWith("-");
206
- if (hasSubcommand && first !== "init" && first !== "protect") {
207
- return {
208
- kind: "error",
209
- message: `Unknown command "${first}". Run "unpeek --help" for usage.`
210
- };
211
- }
212
- if (first === "init") {
213
- let dryRun = false;
214
- for (let i = 1; i < args.length; i++) {
215
- const arg = args[i];
216
- if (arg === "--dry-run") {
217
- dryRun = true;
218
- } else {
219
- return {
220
- kind: "error",
221
- message: `Unknown option "${arg}" for init. Run "unpeek --help" for usage.`
222
- };
223
- }
224
- }
225
- return { kind: "init", dryRun };
226
- }
227
- const options = { cwd };
228
- const startIndex = first === "protect" ? 1 : 0;
229
- for (let i = startIndex; i < args.length; i++) {
230
- const arg = args[i];
231
- if (arg === "--out-dir" || arg.startsWith("--out-dir=")) {
232
- const res = readFlagValue(args, i, "--out-dir");
233
- if ("error" in res) return { kind: "error", message: res.error };
234
- options.outDir = res.value;
235
- i = res.nextIndex;
236
- } else if (arg === "--private-maps-dir" || arg.startsWith("--private-maps-dir=")) {
237
- const res = readFlagValue(args, i, "--private-maps-dir");
238
- if ("error" in res) return { kind: "error", message: res.error };
239
- options.privateMapsDir = res.value;
240
- i = res.nextIndex;
241
- } else if (arg === "--seed" || arg.startsWith("--seed=")) {
242
- const res = readFlagValue(args, i, "--seed");
243
- if ("error" in res) return { kind: "error", message: res.error };
244
- const num = parseNumericFlag(res.value, "--seed");
245
- if ("error" in num) return { kind: "error", message: num.error };
246
- options.seed = num.value;
247
- i = res.nextIndex;
248
- } else if (arg === "--min-string-length" || arg.startsWith("--min-string-length=")) {
249
- const res = readFlagValue(args, i, "--min-string-length");
250
- if ("error" in res) return { kind: "error", message: res.error };
251
- const num = parseNumericFlag(res.value, "--min-string-length", true);
252
- if ("error" in num) return { kind: "error", message: num.error };
253
- options.minStringLength = num.value;
254
- i = res.nextIndex;
255
- } else if (arg === "--aggressive") {
256
- options.aggressive = true;
257
- } else if (arg === "--no-shield") {
258
- options.injectRuntimeShield = false;
259
- } else if (arg === "--passive") {
260
- options.deterrentMode = "passive";
261
- } else if (arg === "--gradual") {
262
- options.deterrentMode = "gradual";
263
- } else if (arg === "--detect-headless") {
264
- options.detectHeadless = true;
265
- } else if (arg === "--no-maps") {
266
- options.keepPrivateMaps = false;
267
- } else {
268
- return {
269
- kind: "error",
270
- message: `Unknown option "${arg}". Run "unpeek --help" for usage.`
271
- };
272
- }
273
- }
274
- return { kind: "protect", options };
275
- }
276
- async function runCli(args) {
277
- const parsed = parseCliArgs(args, process.cwd());
278
- switch (parsed.kind) {
279
- case "help":
280
- printHelp();
281
- return;
282
- case "version":
283
- console.log(getPackageVersion());
284
- return;
285
- case "error":
286
- console.error(`[unpeek] ${parsed.message}`);
287
- process.exitCode = 1;
288
- return;
289
- case "init": {
290
- const res = _chunkJ5CGNZDMcjs.initProject.call(void 0, process.cwd(), { dryRun: parsed.dryRun });
291
- printInitResult(res, parsed.dryRun);
292
- return;
293
- }
294
- case "protect": {
295
- const summary = await _chunk7YVEHJVMcjs.protectProject.call(void 0, parsed.options);
296
- printSummaryTable(summary);
297
- return;
298
- }
299
- }
300
- }
301
- function isDirectCliExecution(argv1) {
302
- if (!argv1) return false;
303
- try {
304
- const executedPath = _fs2.default.realpathSync(_path2.default.resolve(argv1));
305
- const currentPath = _fs2.default.realpathSync(_url.fileURLToPath.call(void 0, _chunk4TDLLEEUcjs.importMetaUrl));
306
- if (process.platform === "win32") {
307
- return executedPath.toLowerCase() === currentPath.toLowerCase();
308
- }
309
- return executedPath === currentPath;
310
- } catch (e2) {
311
- return false;
312
- }
313
- }
314
- if (isDirectCliExecution(process.argv[1])) {
315
- runCli(process.argv.slice(2)).catch((err) => {
316
- console.error("[unpeek] fatal error:", err instanceof Error ? err.message : String(err));
317
- process.exit(1);
318
- });
319
- }
320
-
321
-
322
-
323
-
324
- exports.getPackageVersion = getPackageVersion; exports.parseCliArgs = parseCliArgs; exports.runCli = runCli;
@@ -1,22 +0,0 @@
1
- import { ProtectOptions } from '../index.cjs';
2
-
3
- declare function getPackageVersion(): string;
4
- type ParsedCliCommand = {
5
- kind: 'help';
6
- } | {
7
- kind: 'version';
8
- } | {
9
- kind: 'init';
10
- dryRun: boolean;
11
- } | {
12
- kind: 'protect';
13
- options: ProtectOptions;
14
- } | {
15
- kind: 'error';
16
- message: string;
17
- };
18
- declare function parseCliArgs(args: string[], cwd?: string): ParsedCliCommand;
19
- declare function runCli(args: string[]): Promise<void>;
20
-
21
- export { getPackageVersion, parseCliArgs, runCli };
22
- export type { ParsedCliCommand };
@@ -1,22 +0,0 @@
1
- import { ProtectOptions } from '../index.js';
2
-
3
- declare function getPackageVersion(): string;
4
- type ParsedCliCommand = {
5
- kind: 'help';
6
- } | {
7
- kind: 'version';
8
- } | {
9
- kind: 'init';
10
- dryRun: boolean;
11
- } | {
12
- kind: 'protect';
13
- options: ProtectOptions;
14
- } | {
15
- kind: 'error';
16
- message: string;
17
- };
18
- declare function parseCliArgs(args: string[], cwd?: string): ParsedCliCommand;
19
- declare function runCli(args: string[]): Promise<void>;
20
-
21
- export { getPackageVersion, parseCliArgs, runCli };
22
- export type { ParsedCliCommand };
package/dist/esbuild.cjs DELETED
@@ -1,15 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunk5M6Z7ZFTcjs = require('./chunk-5M6Z7ZFT.cjs');
4
- require('./chunk-LXP73HJC.cjs');
5
- require('./chunk-6N6S6WTQ.cjs');
6
- require('./chunk-R6EBIR3T.cjs');
7
- require('./chunk-4TDLLEEU.cjs');
8
-
9
- // src/esbuild.ts
10
- var esbuild_default = _chunk5M6Z7ZFTcjs.esbuildPlugin;
11
-
12
-
13
- exports.default = esbuild_default;
14
-
15
- module.exports = exports.default;
package/dist/esbuild.js DELETED
@@ -1,13 +0,0 @@
1
- import {
2
- esbuildPlugin
3
- } from "./chunk-X5MKMFMX.js";
4
- import "./chunk-UMPUYLLZ.js";
5
- import "./chunk-KQWNFKT2.js";
6
- import "./chunk-S4S2WXGC.js";
7
- import "./chunk-OOXSZTRV.js";
8
-
9
- // src/esbuild.ts
10
- var esbuild_default = esbuildPlugin;
11
- export {
12
- esbuild_default as default
13
- };
@@ -1,31 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
- var _chunkGAVI2C44cjs = require('../chunk-GAVI2C44.cjs');
5
- require('../chunk-7YVEHJVM.cjs');
6
- require('../chunk-24K5NDXH.cjs');
7
- require('../chunk-LXP73HJC.cjs');
8
- require('../chunk-6N6S6WTQ.cjs');
9
- require('../chunk-R6EBIR3T.cjs');
10
- require('../chunk-4TDLLEEU.cjs');
11
-
12
- // src/next/adapter.ts
13
- var options = _chunkGAVI2C44cjs.readUnpeekNextOptionsFromEnv.call(void 0, );
14
- var adapter = _chunkGAVI2C44cjs.createUnpeekNextAdapter.call(void 0, options);
15
- var adapter_default = adapter;
16
- var name = adapter.name;
17
- async function modifyConfig(config, context) {
18
- if (typeof adapter.modifyConfig === "function") {
19
- return adapter.modifyConfig(config, context);
20
- }
21
- return config;
22
- }
23
- async function onBuildComplete(context) {
24
- return adapter.onBuildComplete(context);
25
- }
26
-
27
-
28
-
29
-
30
-
31
- exports.default = adapter_default; exports.modifyConfig = modifyConfig; exports.name = name; exports.onBuildComplete = onBuildComplete;
@@ -1,31 +0,0 @@
1
- import {
2
- createUnpeekNextAdapter,
3
- readUnpeekNextOptionsFromEnv
4
- } from "../chunk-5QD6FZPB.js";
5
- import "../chunk-5LCMI2TL.js";
6
- import "../chunk-GZB7PFLY.js";
7
- import "../chunk-UMPUYLLZ.js";
8
- import "../chunk-KQWNFKT2.js";
9
- import "../chunk-S4S2WXGC.js";
10
- import "../chunk-OOXSZTRV.js";
11
-
12
- // src/next/adapter.ts
13
- var options = readUnpeekNextOptionsFromEnv();
14
- var adapter = createUnpeekNextAdapter(options);
15
- var adapter_default = adapter;
16
- var name = adapter.name;
17
- async function modifyConfig(config, context) {
18
- if (typeof adapter.modifyConfig === "function") {
19
- return adapter.modifyConfig(config, context);
20
- }
21
- return config;
22
- }
23
- async function onBuildComplete(context) {
24
- return adapter.onBuildComplete(context);
25
- }
26
- export {
27
- adapter_default as default,
28
- modifyConfig,
29
- name,
30
- onBuildComplete
31
- };
@@ -1,18 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
-
6
- var _chunkGAVI2C44cjs = require('../chunk-GAVI2C44.cjs');
7
- require('../chunk-7YVEHJVM.cjs');
8
- require('../chunk-24K5NDXH.cjs');
9
- require('../chunk-LXP73HJC.cjs');
10
- require('../chunk-6N6S6WTQ.cjs');
11
- require('../chunk-R6EBIR3T.cjs');
12
- require('../chunk-4TDLLEEU.cjs');
13
-
14
-
15
-
16
-
17
-
18
- exports.createUnpeekNextAdapter = _chunkGAVI2C44cjs.createUnpeekNextAdapter; exports.getUnpeekAdapterPath = _chunkGAVI2C44cjs.getUnpeekAdapterPath; exports.readUnpeekNextOptionsFromEnv = _chunkGAVI2C44cjs.readUnpeekNextOptionsFromEnv; exports.withUnpeek = _chunkGAVI2C44cjs.withUnpeek;
@@ -1,42 +0,0 @@
1
- import { UnpeekConfig } from '../browser.cjs';
2
- import { ProtectSummary, ProtectOptions } from '../index.cjs';
3
-
4
- interface NextStaticFileOutput {
5
- filePath?: string;
6
- path?: string;
7
- immutableHash?: string;
8
- size?: number;
9
- [key: string]: unknown;
10
- }
11
- interface NextConfigObject {
12
- adapterPath?: string;
13
- [key: string]: unknown;
14
- }
15
- type NextConfigLike = NextConfigObject | ((...args: never[]) => NextConfigObject | Promise<NextConfigObject>);
16
- interface NextAdapterContext {
17
- distDir: string;
18
- buildId?: string;
19
- config?: Record<string, unknown>;
20
- routing?: Record<string, unknown>;
21
- outputs?: {
22
- staticFiles?: NextStaticFileOutput[] | Map<string, NextStaticFileOutput> | Record<string, NextStaticFileOutput>;
23
- [key: string]: unknown;
24
- };
25
- [key: string]: unknown;
26
- }
27
- interface UnpeekNextAdapterOptions extends ProtectOptions {
28
- upstreamAdapterPath?: string;
29
- config?: UnpeekConfig;
30
- }
31
- interface UnpeekNextAdapter {
32
- name: string;
33
- modifyConfig?: (config: NextConfigObject, context?: Record<string, unknown>) => Promise<NextConfigObject> | NextConfigObject;
34
- onBuildComplete: (context: NextAdapterContext) => Promise<ProtectSummary>;
35
- }
36
- declare function createUnpeekNextAdapter(options?: UnpeekNextAdapterOptions): UnpeekNextAdapter;
37
- declare function getUnpeekAdapterPath(): string;
38
- declare function readUnpeekNextOptionsFromEnv(): UnpeekNextAdapterOptions | undefined;
39
- declare function withUnpeek<T extends NextConfigLike = NextConfigObject>(nextConfig?: T, options?: UnpeekNextAdapterOptions): T;
40
-
41
- export { createUnpeekNextAdapter, getUnpeekAdapterPath, readUnpeekNextOptionsFromEnv, withUnpeek };
42
- export type { NextAdapterContext, NextConfigLike, NextConfigObject, NextStaticFileOutput, UnpeekNextAdapter, UnpeekNextAdapterOptions };
@@ -1,42 +0,0 @@
1
- import { UnpeekConfig } from '../browser.js';
2
- import { ProtectSummary, ProtectOptions } from '../index.js';
3
-
4
- interface NextStaticFileOutput {
5
- filePath?: string;
6
- path?: string;
7
- immutableHash?: string;
8
- size?: number;
9
- [key: string]: unknown;
10
- }
11
- interface NextConfigObject {
12
- adapterPath?: string;
13
- [key: string]: unknown;
14
- }
15
- type NextConfigLike = NextConfigObject | ((...args: never[]) => NextConfigObject | Promise<NextConfigObject>);
16
- interface NextAdapterContext {
17
- distDir: string;
18
- buildId?: string;
19
- config?: Record<string, unknown>;
20
- routing?: Record<string, unknown>;
21
- outputs?: {
22
- staticFiles?: NextStaticFileOutput[] | Map<string, NextStaticFileOutput> | Record<string, NextStaticFileOutput>;
23
- [key: string]: unknown;
24
- };
25
- [key: string]: unknown;
26
- }
27
- interface UnpeekNextAdapterOptions extends ProtectOptions {
28
- upstreamAdapterPath?: string;
29
- config?: UnpeekConfig;
30
- }
31
- interface UnpeekNextAdapter {
32
- name: string;
33
- modifyConfig?: (config: NextConfigObject, context?: Record<string, unknown>) => Promise<NextConfigObject> | NextConfigObject;
34
- onBuildComplete: (context: NextAdapterContext) => Promise<ProtectSummary>;
35
- }
36
- declare function createUnpeekNextAdapter(options?: UnpeekNextAdapterOptions): UnpeekNextAdapter;
37
- declare function getUnpeekAdapterPath(): string;
38
- declare function readUnpeekNextOptionsFromEnv(): UnpeekNextAdapterOptions | undefined;
39
- declare function withUnpeek<T extends NextConfigLike = NextConfigObject>(nextConfig?: T, options?: UnpeekNextAdapterOptions): T;
40
-
41
- export { createUnpeekNextAdapter, getUnpeekAdapterPath, readUnpeekNextOptionsFromEnv, withUnpeek };
42
- export type { NextAdapterContext, NextConfigLike, NextConfigObject, NextStaticFileOutput, UnpeekNextAdapter, UnpeekNextAdapterOptions };
@@ -1,18 +0,0 @@
1
- import {
2
- createUnpeekNextAdapter,
3
- getUnpeekAdapterPath,
4
- readUnpeekNextOptionsFromEnv,
5
- withUnpeek
6
- } from "../chunk-5QD6FZPB.js";
7
- import "../chunk-5LCMI2TL.js";
8
- import "../chunk-GZB7PFLY.js";
9
- import "../chunk-UMPUYLLZ.js";
10
- import "../chunk-KQWNFKT2.js";
11
- import "../chunk-S4S2WXGC.js";
12
- import "../chunk-OOXSZTRV.js";
13
- export {
14
- createUnpeekNextAdapter,
15
- getUnpeekAdapterPath,
16
- readUnpeekNextOptionsFromEnv,
17
- withUnpeek
18
- };
package/dist/rollup.cjs DELETED
@@ -1,15 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunk5M6Z7ZFTcjs = require('./chunk-5M6Z7ZFT.cjs');
4
- require('./chunk-LXP73HJC.cjs');
5
- require('./chunk-6N6S6WTQ.cjs');
6
- require('./chunk-R6EBIR3T.cjs');
7
- require('./chunk-4TDLLEEU.cjs');
8
-
9
- // src/rollup.ts
10
- var rollup_default = _chunk5M6Z7ZFTcjs.rollupPlugin;
11
-
12
-
13
- exports.default = rollup_default;
14
-
15
- module.exports = exports.default;
package/dist/rollup.js DELETED
@@ -1,13 +0,0 @@
1
- import {
2
- rollupPlugin
3
- } from "./chunk-X5MKMFMX.js";
4
- import "./chunk-UMPUYLLZ.js";
5
- import "./chunk-KQWNFKT2.js";
6
- import "./chunk-S4S2WXGC.js";
7
- import "./chunk-OOXSZTRV.js";
8
-
9
- // src/rollup.ts
10
- var rollup_default = rollupPlugin;
11
- export {
12
- rollup_default as default
13
- };
@@ -1,17 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
-
6
-
7
-
8
- var _chunk6N6S6WTQcjs = require('../chunk-6N6S6WTQ.cjs');
9
- require('../chunk-4TDLLEEU.cjs');
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
- exports.computeIntegrityHash = _chunk6N6S6WTQcjs.computeIntegrityHash; exports.createDeterrentSnippet = _chunk6N6S6WTQcjs.createDeterrentSnippet; exports.deriveIntegrityFnName = _chunk6N6S6WTQcjs.deriveIntegrityFnName; exports.deriveWindowKeySymbol = _chunk6N6S6WTQcjs.deriveWindowKeySymbol; exports.generateRuntimeShield = _chunk6N6S6WTQcjs.generateRuntimeShield; exports.verifyCodeIntegrity = _chunk6N6S6WTQcjs.verifyCodeIntegrity;
@@ -1,36 +0,0 @@
1
- import { ShieldConfig, ShieldPayload } from '../browser.cjs';
2
-
3
- /**
4
- * Computes a 32-bit unsigned FNV-1a hash over the un-normalized source string.
5
- * Any formatting change (such as DevTools Pretty-Print adding newlines or spaces)
6
- * or monkeypatching alters the resulting hash.
7
- */
8
- declare function computeIntegrityHash(source: string, seed?: number): number;
9
- /**
10
- * Verifies that a function or source string has not been pretty-printed or modified
11
- * by comparing its un-normalized Function.prototype.toString() FNV-1a hash.
12
- */
13
- declare function verifyCodeIntegrity(fnOrSource: ((...args: unknown[]) => unknown) | string, expectedHash: number, seed?: number): boolean;
14
-
15
- declare function deriveIntegrityFnName(seed: number): string;
16
- declare function deriveWindowKeySymbol(seed: number): string;
17
- /**
18
- * Generates a single-line, self-executing (IIFE), polymorphic, synchronous, SSR-safe (<1.5 KB)
19
- * anti-tamper deterrent snippet that calculates a synchronous 32-bit FNV-1a hash of its own
20
- * Function.prototype.toString() representation and writes the 16-bit key component (expectedDelta)
21
- * to window[windowKeySymbol].
22
- *
23
- * Freedom To Operate (FTO) Compliance:
24
- * Strictly avoids timer / setInterval active debugging checks, timing differential loops,
25
- * and periodic debugger polling covered by third-party patents (e.g. Jscrambler US9979726B2).
26
- * Operates purely via synchronous cryptographic state coupling via FNV-1a hash and tamper flags.
27
- *
28
- * When tampering is detected (formatting, pretty-print, webdriver, toString spoofing):
29
- * window.__unpeek_tampered is set to true, String.prototype._u is poisoned to 14,
30
- * window[sym] is poisoned to expectedDelta ^ 0x5a5b, and CustomEvent('unpeek:tamper') is dispatched.
31
- */
32
- declare function createDeterrentSnippet(config: ShieldConfig): string;
33
-
34
- declare function generateRuntimeShield(config: ShieldConfig): ShieldPayload;
35
-
36
- export { computeIntegrityHash, createDeterrentSnippet, deriveIntegrityFnName, deriveWindowKeySymbol, generateRuntimeShield, verifyCodeIntegrity };