unpeek 1.7.2 → 1.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/ast/index.cjs +2278 -386
  2. package/dist/ast/index.cjs.map +1 -1
  3. package/dist/ast/index.d.cts +69 -1
  4. package/dist/ast/index.d.ts +69 -1
  5. package/dist/ast/index.js +2266 -385
  6. package/dist/ast/index.js.map +1 -1
  7. package/dist/browser.cjs +2265 -393
  8. package/dist/browser.cjs.map +1 -1
  9. package/dist/browser.d.cts +2 -1
  10. package/dist/browser.d.ts +2 -1
  11. package/dist/browser.js +2260 -388
  12. package/dist/browser.js.map +1 -1
  13. package/dist/bundler/unplugin.cjs +2259 -385
  14. package/dist/bundler/unplugin.cjs.map +1 -1
  15. package/dist/bundler/unplugin.js +2258 -384
  16. package/dist/bundler/unplugin.js.map +1 -1
  17. package/dist/cli/index.cjs +2292 -396
  18. package/dist/cli/index.cjs.map +1 -1
  19. package/dist/cli/index.js +2292 -396
  20. package/dist/cli/index.js.map +1 -1
  21. package/dist/cli/protect.cjs +2284 -391
  22. package/dist/cli/protect.cjs.map +1 -1
  23. package/dist/cli/protect.js +2285 -392
  24. package/dist/cli/protect.js.map +1 -1
  25. package/dist/esbuild.cjs +2259 -385
  26. package/dist/esbuild.cjs.map +1 -1
  27. package/dist/esbuild.d.cts +1 -1
  28. package/dist/esbuild.d.ts +1 -1
  29. package/dist/esbuild.js +2258 -384
  30. package/dist/esbuild.js.map +1 -1
  31. package/dist/index.cjs +2309 -411
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.d.cts +2 -1
  34. package/dist/index.d.ts +2 -1
  35. package/dist/index.js +2296 -398
  36. package/dist/index.js.map +1 -1
  37. package/dist/rollup.cjs +2259 -385
  38. package/dist/rollup.cjs.map +1 -1
  39. package/dist/rollup.d.cts +1 -1
  40. package/dist/rollup.d.ts +1 -1
  41. package/dist/rollup.js +2258 -384
  42. package/dist/rollup.js.map +1 -1
  43. package/dist/runtime/index.cjs +366 -8
  44. package/dist/runtime/index.cjs.map +1 -1
  45. package/dist/runtime/index.d.cts +11 -3
  46. package/dist/runtime/index.d.ts +11 -3
  47. package/dist/runtime/index.js +364 -8
  48. package/dist/runtime/index.js.map +1 -1
  49. package/dist/{types-D-lVfaDU.d.cts → types-CQHprSVk.d.cts} +10 -0
  50. package/dist/{types-D-lVfaDU.d.ts → types-CQHprSVk.d.ts} +10 -0
  51. package/dist/vite.cjs +2259 -385
  52. package/dist/vite.cjs.map +1 -1
  53. package/dist/vite.d.cts +1 -1
  54. package/dist/vite.d.ts +1 -1
  55. package/dist/vite.js +2258 -384
  56. package/dist/vite.js.map +1 -1
  57. package/dist/webpack.cjs +2259 -385
  58. package/dist/webpack.cjs.map +1 -1
  59. package/dist/webpack.d.cts +1 -1
  60. package/dist/webpack.d.ts +1 -1
  61. package/dist/webpack.js +2258 -384
  62. package/dist/webpack.js.map +1 -1
  63. package/package.json +1 -1
@@ -1,9 +1,77 @@
1
1
  import { HotPathReport, TransformOptions, TransformResult } from '../browser.cjs';
2
+ import * as acorn from 'acorn';
2
3
 
4
+ interface HotPathAnalysis {
5
+ report: HotPathReport;
6
+ hotFunctionNodes: WeakSet<acorn.Node>;
7
+ coldFunctionNodes: WeakSet<acorn.Node>;
8
+ hotExemptNodes: WeakSet<acorn.Node>;
9
+ serializedFunctionNodes: WeakSet<acorn.Node>;
10
+ }
11
+ declare function analyzeAstHotPaths(ast: acorn.Program): HotPathAnalysis;
3
12
  declare function detectHotPaths(code: string): HotPathReport;
4
13
 
5
14
  declare function computeFnv1aHash(input: string, seed?: number): number;
15
+ interface StringVaultResult {
16
+ encryptedStringsCount: number;
17
+ integrityToken: number;
18
+ shaderBuffersCount?: number;
19
+ }
20
+ declare function applyStringVault(ast: acorn.Program, seed?: number, minStringLength?: number, hotExemptNodes?: WeakSet<acorn.Node>, windowKeySymbol?: string, expectedDelta?: number): StringVaultResult;
21
+
22
+ declare function applyPolymorphicMangler(ast: acorn.Program, seed?: number, serializedFunctionNodes?: WeakSet<acorn.Node>): number;
23
+
24
+ declare function applyColdFlowGuard(ast: acorn.Program, coldFunctionNodes: WeakSet<acorn.Node>, seed?: number, hotExemptNodes?: WeakSet<acorn.Node>): number;
25
+
26
+ type PolymorphicRole = 'vault' | 'shield' | 'decoy' | 'shader' | 'vm' | 'wasm' | 'salted' | 'windowKey' | string;
27
+ /**
28
+ * Deterministically derives a short, collision-free, minify-friendly identifier
29
+ * (_a0, $b1, etc.) for a given seed and role, eliminating fixed _uC and _u$ prefixes.
30
+ */
31
+ declare function derivePolymorphicIdent(seed: number, role: PolymorphicRole): string;
32
+ /**
33
+ * Generates compact, single-line JavaScript using custom astring rules to eliminate
34
+ * redundant whitespace while preserving string literal contents and language semantics.
35
+ */
36
+ declare function generateCompactJs(ast: any): string;
37
+
38
+ interface MicroVmResult {
39
+ virtualizedCount: number;
40
+ vmHelperName: string;
41
+ }
42
+ /**
43
+ * Selective Bytecode Micro-VM virtualization for Layer 2 (--aggressive).
44
+ * Selects qualifying cold functions (not serialized, no JSX, no super/yield/arguments/new.target, 15 <= N <= 80),
45
+ * transforms their bodies into stack-based bytecode calls, and injects the <1.2 KB switch-dispatch interpreter once.
46
+ */
47
+ declare function applyMicroVm(ast: acorn.Program, coldFunctionNodes?: Set<acorn.Node> | WeakSet<acorn.Node>, serializedFunctionNodes?: WeakSet<acorn.Node>, seed?: number): MicroVmResult;
48
+
49
+ interface WasmVaultInjectionResult {
50
+ kdfFnName: string;
51
+ wasmBytes: Uint8Array;
52
+ wasmVarName: string;
53
+ }
54
+ /**
55
+ * Injects the synchronous inline WebAssembly KDF key vault into the AST program.
56
+ * Falls back transparently to Math.imul on strict CSP runtimes.
57
+ */
58
+ declare function injectWasmVault(ast: acorn.Program, seed?: number): WasmVaultInjectionResult;
59
+
60
+ interface SaltedVaultResult {
61
+ encryptedStringsCount: number;
62
+ integrityToken: number;
63
+ vaultVarName: string;
64
+ decryptFnName: string;
65
+ }
66
+ /**
67
+ * Applies idempotent call-site salted lazy string vaulting in Layer 2 (--aggressive).
68
+ * Each eligible string access site receives a deterministic static salt constant and is transformed
69
+ * into a _uD(idx, localSalt) call.
70
+ * Operates with 100% idempotence and order-independence under React 19 Concurrent Mode
71
+ * and StrictMode double-mounting.
72
+ */
73
+ declare function applySaltedStringVault(ast: acorn.Program, seed?: number, minStringLength?: number, hotExemptNodes?: WeakSet<acorn.Node>): SaltedVaultResult;
6
74
 
7
75
  declare function transformJavaScript(code: string, options?: TransformOptions): TransformResult;
8
76
 
9
- export { computeFnv1aHash, detectHotPaths, transformJavaScript };
77
+ export { analyzeAstHotPaths, applyColdFlowGuard, applyMicroVm, applyPolymorphicMangler, applySaltedStringVault, applyStringVault, computeFnv1aHash, derivePolymorphicIdent, detectHotPaths, generateCompactJs, injectWasmVault, transformJavaScript };
@@ -1,9 +1,77 @@
1
1
  import { HotPathReport, TransformOptions, TransformResult } from '../browser.js';
2
+ import * as acorn from 'acorn';
2
3
 
4
+ interface HotPathAnalysis {
5
+ report: HotPathReport;
6
+ hotFunctionNodes: WeakSet<acorn.Node>;
7
+ coldFunctionNodes: WeakSet<acorn.Node>;
8
+ hotExemptNodes: WeakSet<acorn.Node>;
9
+ serializedFunctionNodes: WeakSet<acorn.Node>;
10
+ }
11
+ declare function analyzeAstHotPaths(ast: acorn.Program): HotPathAnalysis;
3
12
  declare function detectHotPaths(code: string): HotPathReport;
4
13
 
5
14
  declare function computeFnv1aHash(input: string, seed?: number): number;
15
+ interface StringVaultResult {
16
+ encryptedStringsCount: number;
17
+ integrityToken: number;
18
+ shaderBuffersCount?: number;
19
+ }
20
+ declare function applyStringVault(ast: acorn.Program, seed?: number, minStringLength?: number, hotExemptNodes?: WeakSet<acorn.Node>, windowKeySymbol?: string, expectedDelta?: number): StringVaultResult;
21
+
22
+ declare function applyPolymorphicMangler(ast: acorn.Program, seed?: number, serializedFunctionNodes?: WeakSet<acorn.Node>): number;
23
+
24
+ declare function applyColdFlowGuard(ast: acorn.Program, coldFunctionNodes: WeakSet<acorn.Node>, seed?: number, hotExemptNodes?: WeakSet<acorn.Node>): number;
25
+
26
+ type PolymorphicRole = 'vault' | 'shield' | 'decoy' | 'shader' | 'vm' | 'wasm' | 'salted' | 'windowKey' | string;
27
+ /**
28
+ * Deterministically derives a short, collision-free, minify-friendly identifier
29
+ * (_a0, $b1, etc.) for a given seed and role, eliminating fixed _uC and _u$ prefixes.
30
+ */
31
+ declare function derivePolymorphicIdent(seed: number, role: PolymorphicRole): string;
32
+ /**
33
+ * Generates compact, single-line JavaScript using custom astring rules to eliminate
34
+ * redundant whitespace while preserving string literal contents and language semantics.
35
+ */
36
+ declare function generateCompactJs(ast: any): string;
37
+
38
+ interface MicroVmResult {
39
+ virtualizedCount: number;
40
+ vmHelperName: string;
41
+ }
42
+ /**
43
+ * Selective Bytecode Micro-VM virtualization for Layer 2 (--aggressive).
44
+ * Selects qualifying cold functions (not serialized, no JSX, no super/yield/arguments/new.target, 15 <= N <= 80),
45
+ * transforms their bodies into stack-based bytecode calls, and injects the <1.2 KB switch-dispatch interpreter once.
46
+ */
47
+ declare function applyMicroVm(ast: acorn.Program, coldFunctionNodes?: Set<acorn.Node> | WeakSet<acorn.Node>, serializedFunctionNodes?: WeakSet<acorn.Node>, seed?: number): MicroVmResult;
48
+
49
+ interface WasmVaultInjectionResult {
50
+ kdfFnName: string;
51
+ wasmBytes: Uint8Array;
52
+ wasmVarName: string;
53
+ }
54
+ /**
55
+ * Injects the synchronous inline WebAssembly KDF key vault into the AST program.
56
+ * Falls back transparently to Math.imul on strict CSP runtimes.
57
+ */
58
+ declare function injectWasmVault(ast: acorn.Program, seed?: number): WasmVaultInjectionResult;
59
+
60
+ interface SaltedVaultResult {
61
+ encryptedStringsCount: number;
62
+ integrityToken: number;
63
+ vaultVarName: string;
64
+ decryptFnName: string;
65
+ }
66
+ /**
67
+ * Applies idempotent call-site salted lazy string vaulting in Layer 2 (--aggressive).
68
+ * Each eligible string access site receives a deterministic static salt constant and is transformed
69
+ * into a _uD(idx, localSalt) call.
70
+ * Operates with 100% idempotence and order-independence under React 19 Concurrent Mode
71
+ * and StrictMode double-mounting.
72
+ */
73
+ declare function applySaltedStringVault(ast: acorn.Program, seed?: number, minStringLength?: number, hotExemptNodes?: WeakSet<acorn.Node>): SaltedVaultResult;
6
74
 
7
75
  declare function transformJavaScript(code: string, options?: TransformOptions): TransformResult;
8
76
 
9
- export { computeFnv1aHash, detectHotPaths, transformJavaScript };
77
+ export { analyzeAstHotPaths, applyColdFlowGuard, applyMicroVm, applyPolymorphicMangler, applySaltedStringVault, applyStringVault, computeFnv1aHash, derivePolymorphicIdent, detectHotPaths, generateCompactJs, injectWasmVault, transformJavaScript };