unpeek 3.0.0 → 4.0.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 (69) hide show
  1. package/README.md +31 -16
  2. package/README.tr.md +41 -26
  3. package/dist/adapters/esbuild.cjs +5 -5
  4. package/dist/adapters/esbuild.d.cts +3 -1
  5. package/dist/adapters/esbuild.d.ts +2 -2
  6. package/dist/adapters/esbuild.js +5 -3
  7. package/dist/adapters/next/adapter.cjs +7 -6
  8. package/dist/adapters/next/adapter.d.cts +1 -1
  9. package/dist/adapters/next/adapter.d.ts +1 -1
  10. package/dist/adapters/next/adapter.js +6 -5
  11. package/dist/adapters/next/index.cjs +7 -6
  12. package/dist/adapters/next/index.js +6 -5
  13. package/dist/adapters/rollup.cjs +5 -5
  14. package/dist/adapters/rollup.d.cts +3 -1
  15. package/dist/adapters/rollup.d.ts +2 -2
  16. package/dist/adapters/rollup.js +5 -3
  17. package/dist/adapters/rspack.cjs +5 -4
  18. package/dist/adapters/rspack.d.cts +1 -1
  19. package/dist/adapters/rspack.d.ts +1 -1
  20. package/dist/adapters/rspack.js +3 -2
  21. package/dist/adapters/vite.cjs +5 -5
  22. package/dist/adapters/vite.d.cts +3 -1
  23. package/dist/adapters/vite.d.ts +2 -2
  24. package/dist/adapters/vite.js +5 -3
  25. package/dist/adapters/webpack.cjs +5 -5
  26. package/dist/adapters/webpack.d.cts +3 -1
  27. package/dist/adapters/webpack.d.ts +2 -2
  28. package/dist/adapters/webpack.js +5 -3
  29. package/dist/browser.cjs +3 -3
  30. package/dist/browser.d.cts +20 -17
  31. package/dist/browser.d.ts +20 -17
  32. package/dist/browser.js +2 -2
  33. package/dist/chunk-3GDHYBVH.cjs +1092 -0
  34. package/dist/chunk-4G2HCME5.js +429 -0
  35. package/dist/{chunk-BPRSCRUZ.js → chunk-4SOS3LRV.js} +53 -9
  36. package/dist/chunk-7ZEVJ4OR.cjs +595 -0
  37. package/dist/{chunk-FCF2EGPM.js → chunk-EN6QVR6P.js} +12 -3
  38. package/dist/{chunk-IZIWDJRF.js → chunk-LGTXAAZH.js} +3338 -972
  39. package/dist/chunk-M46SFJE7.cjs +7733 -0
  40. package/dist/{chunk-6TDCSIRZ.cjs → chunk-NNAAPDUS.cjs} +60 -16
  41. package/dist/chunk-OTA75YI6.cjs +429 -0
  42. package/dist/chunk-TYL32LUK.js +1092 -0
  43. package/dist/{chunk-IEBVL5BT.cjs → chunk-URPPSTHZ.cjs} +12 -3
  44. package/dist/{chunk-IICVBTR2.js → chunk-W77DAC3H.js} +22 -3
  45. package/dist/{chunk-ONM2CSTU.cjs → chunk-X6EETCO6.cjs} +64 -45
  46. package/dist/chunk-XYN5NYSD.js +595 -0
  47. package/dist/cli/index.js +4543 -1442
  48. package/dist/{config-CfXY_iDD.d.ts → config-Y6JwVGwX.d.cts} +15 -1
  49. package/dist/{config-CfXY_iDD.d.cts → config-Y6JwVGwX.d.ts} +15 -1
  50. package/dist/config.cjs +3 -3
  51. package/dist/config.d.cts +1 -1
  52. package/dist/config.d.ts +1 -1
  53. package/dist/config.js +2 -2
  54. package/dist/{index-CjRTNPlj.d.cts → index-0O1WSfVP.d.ts} +7 -1
  55. package/dist/{index-Cm1IloVm.d.ts → index-COVHErnx.d.cts} +7 -1
  56. package/dist/index.cjs +231 -291
  57. package/dist/index.d.cts +4 -4
  58. package/dist/index.d.ts +4 -4
  59. package/dist/index.js +225 -285
  60. package/dist/plugins/unplugin.cjs +4 -3
  61. package/dist/plugins/unplugin.js +3 -2
  62. package/dist/{types-DYQIzGf6.d.cts → types-CMtZnV8C.d.ts} +3 -3
  63. package/dist/{types-ZHAFdOd3.d.ts → types-D93PuOOl.d.cts} +3 -3
  64. package/package.json +1 -1
  65. package/dist/chunk-APWMNVAZ.js +0 -764
  66. package/dist/chunk-DUK2SECY.js +0 -83
  67. package/dist/chunk-I6GXEHFR.cjs +0 -764
  68. package/dist/chunk-IAD5DV3D.cjs +0 -5367
  69. package/dist/chunk-RXUY3MPH.cjs +0 -83
@@ -4,8 +4,10 @@ import 'rollup';
4
4
  import 'webpack';
5
5
  import 'vite';
6
6
  import 'unplugin';
7
- import '../config-CfXY_iDD.cjs';
7
+ import '../config-Y6JwVGwX.cjs';
8
8
 
9
9
 
10
10
 
11
+ // @ts-ignore
11
12
  export = vitePlugin;
13
+ export { vitePlugin as unpeekVite };
@@ -4,8 +4,8 @@ import 'rollup';
4
4
  import 'webpack';
5
5
  import 'vite';
6
6
  import 'unplugin';
7
- import '../config-CfXY_iDD.js';
7
+ import '../config-Y6JwVGwX.js';
8
8
 
9
9
 
10
10
 
11
- export { vitePlugin as default };
11
+ export { vitePlugin as default, vitePlugin as unpeekVite };
@@ -1,11 +1,13 @@
1
1
  import {
2
2
  vitePlugin
3
- } from "../chunk-DUK2SECY.js";
4
- import "../chunk-IZIWDJRF.js";
3
+ } from "../chunk-4G2HCME5.js";
4
+ import "../chunk-TYL32LUK.js";
5
+ import "../chunk-LGTXAAZH.js";
5
6
  import "../chunk-LA6J3BT3.js";
6
7
 
7
8
  // src/adapters/vite.ts
8
9
  var vite_default = vitePlugin;
9
10
  export {
10
- vite_default as default
11
+ vite_default as default,
12
+ vitePlugin as unpeekVite
11
13
  };
@@ -1,13 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkRXUY3MPHcjs = require('../chunk-RXUY3MPH.cjs');
4
- require('../chunk-IAD5DV3D.cjs');
3
+ var _chunkOTA75YI6cjs = require('../chunk-OTA75YI6.cjs');
4
+ require('../chunk-3GDHYBVH.cjs');
5
+ require('../chunk-M46SFJE7.cjs');
5
6
  require('../chunk-L6BOM5VS.cjs');
6
7
 
7
8
  // src/adapters/webpack.ts
8
- var webpack_default = _chunkRXUY3MPHcjs.webpackPlugin;
9
+ var webpack_default = _chunkOTA75YI6cjs.webpackPlugin;
9
10
 
10
11
 
11
- exports.default = webpack_default;
12
12
 
13
- module.exports = exports.default;
13
+ exports.default = webpack_default; exports.unpeekWebpack = _chunkOTA75YI6cjs.webpackPlugin;
@@ -4,8 +4,10 @@ import 'rollup';
4
4
  import 'webpack';
5
5
  import 'vite';
6
6
  import 'unplugin';
7
- import '../config-CfXY_iDD.cjs';
7
+ import '../config-Y6JwVGwX.cjs';
8
8
 
9
9
 
10
10
 
11
+ // @ts-ignore
11
12
  export = webpackPlugin;
13
+ export { webpackPlugin as unpeekWebpack };
@@ -4,8 +4,8 @@ import 'rollup';
4
4
  import 'webpack';
5
5
  import 'vite';
6
6
  import 'unplugin';
7
- import '../config-CfXY_iDD.js';
7
+ import '../config-Y6JwVGwX.js';
8
8
 
9
9
 
10
10
 
11
- export { webpackPlugin as default };
11
+ export { webpackPlugin as default, webpackPlugin as unpeekWebpack };
@@ -1,11 +1,13 @@
1
1
  import {
2
2
  webpackPlugin
3
- } from "../chunk-DUK2SECY.js";
4
- import "../chunk-IZIWDJRF.js";
3
+ } from "../chunk-4G2HCME5.js";
4
+ import "../chunk-TYL32LUK.js";
5
+ import "../chunk-LGTXAAZH.js";
5
6
  import "../chunk-LA6J3BT3.js";
6
7
 
7
8
  // src/adapters/webpack.ts
8
9
  var webpack_default = webpackPlugin;
9
10
  export {
10
- webpack_default as default
11
+ webpack_default as default,
12
+ webpackPlugin as unpeekWebpack
11
13
  };
package/dist/browser.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkIEBVL5BTcjs = require('./chunk-IEBVL5BT.cjs');
3
+ var _chunkURPPSTHZcjs = require('./chunk-URPPSTHZ.cjs');
4
4
 
5
5
 
6
6
 
@@ -9,7 +9,7 @@ var _chunkIEBVL5BTcjs = require('./chunk-IEBVL5BT.cjs');
9
9
 
10
10
 
11
11
 
12
- var _chunkIAD5DV3Dcjs = require('./chunk-IAD5DV3D.cjs');
12
+ var _chunkM46SFJE7cjs = require('./chunk-M46SFJE7.cjs');
13
13
 
14
14
 
15
15
 
@@ -25,4 +25,4 @@ var _chunkL6BOM5VScjs = require('./chunk-L6BOM5VS.cjs');
25
25
 
26
26
 
27
27
 
28
- exports.PRESETS = _chunkIEBVL5BTcjs.PRESETS; exports.UnpeekError = _chunkL6BOM5VScjs.UnpeekError; exports.computeFnv1aHash = _chunkIAD5DV3Dcjs.computeFnv1aHash; exports.computeIntegrityHash = _chunkIAD5DV3Dcjs.computeIntegrityHash; exports.createDeterrentSnippet = _chunkIAD5DV3Dcjs.createDeterrentSnippet; exports.detectHotPaths = _chunkIAD5DV3Dcjs.detectHotPaths; exports.generateRuntimeShield = _chunkIAD5DV3Dcjs.generateRuntimeShield; exports.isUnpeekError = _chunkL6BOM5VScjs.isUnpeekError; exports.transformJavaScript = _chunkIAD5DV3Dcjs.transformJavaScript; exports.verifyCodeIntegrity = _chunkIAD5DV3Dcjs.verifyCodeIntegrity;
28
+ exports.PRESETS = _chunkURPPSTHZcjs.PRESETS; exports.UnpeekError = _chunkL6BOM5VScjs.UnpeekError; exports.computeFnv1aHash = _chunkM46SFJE7cjs.computeFnv1aHash; exports.computeIntegrityHash = _chunkM46SFJE7cjs.computeIntegrityHash; exports.createDeterrentSnippet = _chunkM46SFJE7cjs.createDeterrentSnippet; exports.detectHotPaths = _chunkM46SFJE7cjs.detectHotPaths; exports.generateRuntimeShield = _chunkM46SFJE7cjs.generateRuntimeShield; exports.isUnpeekError = _chunkL6BOM5VScjs.isUnpeekError; exports.transformJavaScript = _chunkM46SFJE7cjs.transformJavaScript; exports.verifyCodeIntegrity = _chunkM46SFJE7cjs.verifyCodeIntegrity;
@@ -1,7 +1,7 @@
1
- import { U as UnpeekConfig, S as ShieldConfig, a as ShieldPayload } from './config-CfXY_iDD.cjs';
2
- export { B as BaseProtectionOptions, C as ConfigTarget, D as DeterrentMode, F as FilterConfig, H as HotPathConfig, M as ManglerConfig, N as NextConfigOptions, P as PRESETS, b as PatternInput, c as SemanticAnchorsConfig, d as ShieldOptionsConfig, e as SourcemapsConfig, f as UnpeekFramework, g as UnpeekPluginOptions, h as UnpeekProfile, V as VaultConfig, i as ViteConfigOptions } from './config-CfXY_iDD.cjs';
3
- import { H as HotPathReport } from './index-CjRTNPlj.cjs';
4
- export { S as ScrubberOptions, T as TransformOptions, a as TransformResult, b as TransformSkippedReason, U as UnpeekError, c as UnpeekErrorCode, i as isUnpeekError, t as transformJavaScript } from './index-CjRTNPlj.cjs';
1
+ import { U as UnpeekConfig, S as ShieldConfig, a as ShieldPayload } from './config-Y6JwVGwX.cjs';
2
+ export { B as BaseProtectionOptions, C as ConfigTarget, D as DeterrentMode, F as FilterConfig, H as HotPathConfig, M as ManglerConfig, N as NextConfigOptions, P as PRESETS, b as PatternInput, c as SemanticAnchorsConfig, d as ShieldOptionsConfig, e as SourcemapsConfig, f as UnpeekFramework, g as UnpeekPluginOptions, h as UnpeekProfile, V as VaultConfig, i as ViteConfigOptions } from './config-Y6JwVGwX.cjs';
3
+ import { H as HotPathReport } from './index-COVHErnx.cjs';
4
+ export { S as ScrubberOptions, T as TransformOptions, a as TransformResult, b as TransformSkippedReason, U as UnpeekError, c as UnpeekErrorCode, i as isUnpeekError, t as transformJavaScript } from './index-COVHErnx.cjs';
5
5
 
6
6
  declare function computeFnv1aHash(input: string, seed?: number): number;
7
7
 
@@ -14,25 +14,28 @@ declare function detectHotPaths(code: string, config?: UnpeekConfig): HotPathRep
14
14
  */
15
15
  declare function computeIntegrityHash(source: string, seed?: number): number;
16
16
  /**
17
- * Verifies that a function or source string has not been pretty-printed or modified
18
- * by comparing its un-normalized Function.prototype.toString() FNV-1a hash.
17
+ * Verifies that a function or source string has not been pretty-printed,
18
+ * spoofed (`{ toString() {} }`), or modified by comparing its FNV-1a hash
19
+ * after validating native `Reflect.apply` invariants.
19
20
  */
20
- declare function verifyCodeIntegrity(fnOrSource: ((...args: unknown[]) => unknown) | string, expectedHash: number, seed?: number): boolean;
21
+ declare function verifyCodeIntegrity(fnOrSource: ((...args: unknown[]) => unknown) | string, expectedHash: number, seed?: number, normalized?: boolean): boolean;
21
22
 
22
23
  /**
23
- * Generates a single-line, self-executing (IIFE), polymorphic, synchronous, SSR-safe (<1.5 KB)
24
- * anti-tamper deterrent snippet that calculates a synchronous 32-bit FNV-1a hash of its own
25
- * Function.prototype.toString() representation and writes the 16-bit key component (expectedDelta)
26
- * to window[windowKeySymbol].
24
+ * Generates a single-line, self-executing (IIFE), polymorphic, synchronous, SSR- & Worker-safe (<1.5 KB)
25
+ * anti-tamper deterrent snippet that calculates a normalized synchronous 32-bit FNV-1a hash of its own
26
+ * Function.prototype.toString() representation, writes the 16-bit key component (expectedDelta) to
27
+ * globalThis[windowKeySymbol], and records the v4 non-poisoning state tuple
28
+ * globalThis[windowKeySymbol + '_s'] = [status, k0, k1, epoch, nonce] (status: 1=VERIFIED, 2=TAMPERED).
27
29
  *
28
30
  * Freedom To Operate (FTO) Compliance:
29
- * Strictly avoids timer / setInterval active debugging checks, timing differential loops,
30
- * and periodic debugger polling covered by third-party patents (e.g. Jscrambler US9979726B2).
31
- * Operates purely via synchronous cryptographic state coupling via FNV-1a hash and tamper flags.
31
+ * US9979726B2 covers server-mediated intervention combined with a DOM sweeping loop, while
32
+ * US10380382B2 covers periodic debugger console polling. unpeek strictly avoids both mechanisms
33
+ * and operates purely client-side and build-time synchronously within the expired US7757097B2
34
+ * (Expired - Lifetime) public prior-art domain.
32
35
  *
33
- * When tampering is detected (formatting, pretty-print, webdriver, toString spoofing):
34
- * window.__unpeek_tampered is set to true, String.prototype._u is poisoned to 14,
35
- * window[sym] is poisoned to expectedDelta ^ 0x5a5b, and CustomEvent('unpeek:tamper') is dispatched.
36
+ * When tampering is detected (webdriver when enabled, toString/Reflect/descriptor spoofing, or code alteration):
37
+ * globalThis.__unpeek_tampered is set to true, state status is pinned to 2, String.prototype._u is poisoned to 14,
38
+ * globalThis[sym] is poisoned to expectedDelta ^ mask, and CustomEvent('unpeek:tamper') is dispatched.
36
39
  */
37
40
  declare function createDeterrentSnippet(config: ShieldConfig): string;
38
41
 
package/dist/browser.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { U as UnpeekConfig, S as ShieldConfig, a as ShieldPayload } from './config-CfXY_iDD.js';
2
- export { B as BaseProtectionOptions, C as ConfigTarget, D as DeterrentMode, F as FilterConfig, H as HotPathConfig, M as ManglerConfig, N as NextConfigOptions, P as PRESETS, b as PatternInput, c as SemanticAnchorsConfig, d as ShieldOptionsConfig, e as SourcemapsConfig, f as UnpeekFramework, g as UnpeekPluginOptions, h as UnpeekProfile, V as VaultConfig, i as ViteConfigOptions } from './config-CfXY_iDD.js';
3
- import { H as HotPathReport } from './index-Cm1IloVm.js';
4
- export { S as ScrubberOptions, T as TransformOptions, a as TransformResult, b as TransformSkippedReason, U as UnpeekError, c as UnpeekErrorCode, i as isUnpeekError, t as transformJavaScript } from './index-Cm1IloVm.js';
1
+ import { U as UnpeekConfig, S as ShieldConfig, a as ShieldPayload } from './config-Y6JwVGwX.js';
2
+ export { B as BaseProtectionOptions, C as ConfigTarget, D as DeterrentMode, F as FilterConfig, H as HotPathConfig, M as ManglerConfig, N as NextConfigOptions, P as PRESETS, b as PatternInput, c as SemanticAnchorsConfig, d as ShieldOptionsConfig, e as SourcemapsConfig, f as UnpeekFramework, g as UnpeekPluginOptions, h as UnpeekProfile, V as VaultConfig, i as ViteConfigOptions } from './config-Y6JwVGwX.js';
3
+ import { H as HotPathReport } from './index-0O1WSfVP.js';
4
+ export { S as ScrubberOptions, T as TransformOptions, a as TransformResult, b as TransformSkippedReason, U as UnpeekError, c as UnpeekErrorCode, i as isUnpeekError, t as transformJavaScript } from './index-0O1WSfVP.js';
5
5
 
6
6
  declare function computeFnv1aHash(input: string, seed?: number): number;
7
7
 
@@ -14,25 +14,28 @@ declare function detectHotPaths(code: string, config?: UnpeekConfig): HotPathRep
14
14
  */
15
15
  declare function computeIntegrityHash(source: string, seed?: number): number;
16
16
  /**
17
- * Verifies that a function or source string has not been pretty-printed or modified
18
- * by comparing its un-normalized Function.prototype.toString() FNV-1a hash.
17
+ * Verifies that a function or source string has not been pretty-printed,
18
+ * spoofed (`{ toString() {} }`), or modified by comparing its FNV-1a hash
19
+ * after validating native `Reflect.apply` invariants.
19
20
  */
20
- declare function verifyCodeIntegrity(fnOrSource: ((...args: unknown[]) => unknown) | string, expectedHash: number, seed?: number): boolean;
21
+ declare function verifyCodeIntegrity(fnOrSource: ((...args: unknown[]) => unknown) | string, expectedHash: number, seed?: number, normalized?: boolean): boolean;
21
22
 
22
23
  /**
23
- * Generates a single-line, self-executing (IIFE), polymorphic, synchronous, SSR-safe (<1.5 KB)
24
- * anti-tamper deterrent snippet that calculates a synchronous 32-bit FNV-1a hash of its own
25
- * Function.prototype.toString() representation and writes the 16-bit key component (expectedDelta)
26
- * to window[windowKeySymbol].
24
+ * Generates a single-line, self-executing (IIFE), polymorphic, synchronous, SSR- & Worker-safe (<1.5 KB)
25
+ * anti-tamper deterrent snippet that calculates a normalized synchronous 32-bit FNV-1a hash of its own
26
+ * Function.prototype.toString() representation, writes the 16-bit key component (expectedDelta) to
27
+ * globalThis[windowKeySymbol], and records the v4 non-poisoning state tuple
28
+ * globalThis[windowKeySymbol + '_s'] = [status, k0, k1, epoch, nonce] (status: 1=VERIFIED, 2=TAMPERED).
27
29
  *
28
30
  * Freedom To Operate (FTO) Compliance:
29
- * Strictly avoids timer / setInterval active debugging checks, timing differential loops,
30
- * and periodic debugger polling covered by third-party patents (e.g. Jscrambler US9979726B2).
31
- * Operates purely via synchronous cryptographic state coupling via FNV-1a hash and tamper flags.
31
+ * US9979726B2 covers server-mediated intervention combined with a DOM sweeping loop, while
32
+ * US10380382B2 covers periodic debugger console polling. unpeek strictly avoids both mechanisms
33
+ * and operates purely client-side and build-time synchronously within the expired US7757097B2
34
+ * (Expired - Lifetime) public prior-art domain.
32
35
  *
33
- * When tampering is detected (formatting, pretty-print, webdriver, toString spoofing):
34
- * window.__unpeek_tampered is set to true, String.prototype._u is poisoned to 14,
35
- * window[sym] is poisoned to expectedDelta ^ 0x5a5b, and CustomEvent('unpeek:tamper') is dispatched.
36
+ * When tampering is detected (webdriver when enabled, toString/Reflect/descriptor spoofing, or code alteration):
37
+ * globalThis.__unpeek_tampered is set to true, state status is pinned to 2, String.prototype._u is poisoned to 14,
38
+ * globalThis[sym] is poisoned to expectedDelta ^ mask, and CustomEvent('unpeek:tamper') is dispatched.
36
39
  */
37
40
  declare function createDeterrentSnippet(config: ShieldConfig): string;
38
41
 
package/dist/browser.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PRESETS
3
- } from "./chunk-FCF2EGPM.js";
3
+ } from "./chunk-EN6QVR6P.js";
4
4
  import {
5
5
  computeFnv1aHash,
6
6
  computeIntegrityHash,
@@ -9,7 +9,7 @@ import {
9
9
  generateRuntimeShield,
10
10
  transformJavaScript,
11
11
  verifyCodeIntegrity
12
- } from "./chunk-IZIWDJRF.js";
12
+ } from "./chunk-LGTXAAZH.js";
13
13
  import {
14
14
  UnpeekError,
15
15
  isUnpeekError