unpeek 2.0.0 → 4.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 (120) hide show
  1. package/README.md +57 -21
  2. package/README.tr.md +65 -29
  3. package/dist/adapters/esbuild.cjs +13 -0
  4. package/dist/adapters/esbuild.d.cts +13 -0
  5. package/dist/adapters/esbuild.d.ts +11 -0
  6. package/dist/adapters/esbuild.js +13 -0
  7. package/dist/adapters/next/adapter.cjs +43 -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 +43 -0
  11. package/dist/adapters/next/index.cjs +16 -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 +16 -0
  15. package/dist/adapters/rollup.cjs +13 -0
  16. package/dist/adapters/rollup.d.cts +13 -0
  17. package/dist/adapters/rollup.d.ts +11 -0
  18. package/dist/adapters/rollup.js +13 -0
  19. package/dist/adapters/rspack.cjs +13 -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 +13 -0
  23. package/dist/adapters/vite.cjs +13 -0
  24. package/dist/adapters/vite.d.cts +13 -0
  25. package/dist/adapters/vite.d.ts +11 -0
  26. package/dist/adapters/vite.js +13 -0
  27. package/dist/adapters/webpack.cjs +13 -0
  28. package/dist/adapters/webpack.d.cts +13 -0
  29. package/dist/adapters/webpack.d.ts +11 -0
  30. package/dist/adapters/webpack.js +13 -0
  31. package/dist/browser.cjs +8 -5
  32. package/dist/browser.d.cts +44 -3
  33. package/dist/browser.d.ts +44 -3
  34. package/dist/browser.js +10 -7
  35. package/dist/{chunk-5QD6FZPB.js → chunk-2JU3V7HW.js} +75 -43
  36. package/dist/chunk-3LWXEJU6.cjs +1054 -0
  37. package/dist/chunk-4FNZNIBW.js +7391 -0
  38. package/dist/chunk-7HXLHLLQ.cjs +503 -0
  39. package/dist/chunk-ADKRENAP.js +1054 -0
  40. package/dist/chunk-EN6QVR6P.js +89 -0
  41. package/dist/chunk-HHC7BUCK.js +503 -0
  42. package/dist/chunk-KLYFNMKS.cjs +7391 -0
  43. package/dist/chunk-L6BOM5VS.cjs +40 -0
  44. package/dist/{chunk-OOXSZTRV.js → chunk-LA6J3BT3.js} +26 -1
  45. package/dist/chunk-URPPSTHZ.cjs +89 -0
  46. package/dist/chunk-VG4Y26ZN.cjs +429 -0
  47. package/dist/{chunk-GZB7PFLY.js → chunk-W77DAC3H.js} +46 -64
  48. package/dist/chunk-X6EETCO6.cjs +352 -0
  49. package/dist/chunk-YCRMTXOE.js +429 -0
  50. package/dist/{chunk-GAVI2C44.cjs → chunk-ZG7BIAUI.cjs} +80 -48
  51. package/dist/cli/index.js +9861 -32
  52. package/dist/{types-BBSRUEab.d.cts → config-Y6JwVGwX.d.cts} +58 -86
  53. package/dist/{types-BBSRUEab.d.ts → config-Y6JwVGwX.d.ts} +58 -86
  54. package/dist/config.cjs +4 -16
  55. package/dist/config.d.cts +1 -12
  56. package/dist/config.d.ts +1 -12
  57. package/dist/config.js +5 -17
  58. package/dist/index-0O1WSfVP.d.ts +52 -0
  59. package/dist/index-COVHErnx.d.cts +52 -0
  60. package/dist/index.cjs +437 -9
  61. package/dist/index.d.cts +9 -17
  62. package/dist/index.d.ts +9 -17
  63. package/dist/index.js +438 -10
  64. package/dist/plugins/unplugin.cjs +21 -0
  65. package/dist/plugins/unplugin.d.cts +17 -0
  66. package/dist/plugins/unplugin.d.ts +15 -0
  67. package/dist/{bundler → plugins}/unplugin.js +6 -5
  68. package/dist/types-CMtZnV8C.d.ts +112 -0
  69. package/dist/types-D93PuOOl.d.cts +112 -0
  70. package/package.json +48 -52
  71. package/dist/ast/index.cjs +0 -17
  72. package/dist/ast/index.d.cts +0 -18
  73. package/dist/ast/index.d.ts +0 -18
  74. package/dist/ast/index.js +0 -17
  75. package/dist/bundler/unplugin.cjs +0 -20
  76. package/dist/bundler/unplugin.d.cts +0 -16
  77. package/dist/bundler/unplugin.d.ts +0 -14
  78. package/dist/chunk-24K5NDXH.cjs +0 -370
  79. package/dist/chunk-27HR647Q.js +0 -190
  80. package/dist/chunk-4TDLLEEU.cjs +0 -15
  81. package/dist/chunk-5LCMI2TL.js +0 -575
  82. package/dist/chunk-5M6Z7ZFT.cjs +0 -83
  83. package/dist/chunk-6N6S6WTQ.cjs +0 -423
  84. package/dist/chunk-7YVEHJVM.cjs +0 -575
  85. package/dist/chunk-J5CGNZDM.cjs +0 -190
  86. package/dist/chunk-KQWNFKT2.js +0 -423
  87. package/dist/chunk-LXP73HJC.cjs +0 -4532
  88. package/dist/chunk-R6EBIR3T.cjs +0 -14
  89. package/dist/chunk-S4S2WXGC.js +0 -14
  90. package/dist/chunk-UMPUYLLZ.js +0 -4532
  91. package/dist/chunk-X5MKMFMX.js +0 -83
  92. package/dist/cli/index.cjs +0 -324
  93. package/dist/cli/index.d.cts +0 -22
  94. package/dist/cli/index.d.ts +0 -22
  95. package/dist/esbuild.cjs +0 -15
  96. package/dist/esbuild.d.cts +0 -11
  97. package/dist/esbuild.d.ts +0 -11
  98. package/dist/esbuild.js +0 -13
  99. package/dist/next/adapter.cjs +0 -31
  100. package/dist/next/adapter.js +0 -31
  101. package/dist/next/index.cjs +0 -18
  102. package/dist/next/index.d.cts +0 -42
  103. package/dist/next/index.d.ts +0 -42
  104. package/dist/next/index.js +0 -18
  105. package/dist/rollup.cjs +0 -15
  106. package/dist/rollup.d.cts +0 -11
  107. package/dist/rollup.d.ts +0 -11
  108. package/dist/rollup.js +0 -13
  109. package/dist/runtime/index.cjs +0 -17
  110. package/dist/runtime/index.d.cts +0 -36
  111. package/dist/runtime/index.d.ts +0 -36
  112. package/dist/runtime/index.js +0 -17
  113. package/dist/vite.cjs +0 -15
  114. package/dist/vite.d.cts +0 -11
  115. package/dist/vite.d.ts +0 -11
  116. package/dist/vite.js +0 -13
  117. package/dist/webpack.cjs +0 -15
  118. package/dist/webpack.d.cts +0 -11
  119. package/dist/webpack.d.ts +0 -11
  120. package/dist/webpack.js +0 -13
@@ -1,7 +1,35 @@
1
- type DetectedFramework = 'nextjs' | 'vite' | 'webpack' | 'vanilla';
2
1
  type DeterrentMode = 'gradual' | 'passive';
3
- type ConfigFramework = 'nextjs' | 'vite' | 'webpack' | 'vanilla';
2
+ interface ShieldConfig {
3
+ seed: number;
4
+ deterrentMode?: DeterrentMode;
5
+ detectHeadless?: boolean;
6
+ expectedIntegrityHash?: number;
7
+ windowKeySymbol?: string;
8
+ expectedDelta?: number;
9
+ }
10
+ interface ShieldPayload {
11
+ preambleCode: string;
12
+ expectedHash: number;
13
+ windowKeySymbol?: string;
14
+ expectedDelta?: number;
15
+ stateKeySymbol?: string;
16
+ }
17
+
18
+ type UnpeekProfile = 'minimal' | 'recommended' | 'strict';
19
+ declare const PRESETS: Record<UnpeekProfile, UnpeekConfig>;
20
+
21
+ declare function loadUnpeekConfig(cwd?: string, explicitConfig?: UnpeekConfig): Promise<UnpeekConfig>;
22
+
23
+ type UnpeekFramework = 'nextjs' | 'vite' | 'webpack' | 'vanilla';
4
24
  type ConfigTarget = 'browser' | 'worker' | 'universal';
25
+ type UnpeekTier = 'Tier 1' | 'Tier 2' | 'Tier 3';
26
+ type PatternInput = RegExp | string;
27
+
28
+ interface CriticalConfig {
29
+ include?: PatternInput[];
30
+ annotation?: string;
31
+ maxFunctionsPerChunk?: number;
32
+ }
5
33
  interface FilterConfig {
6
34
  include?: string[];
7
35
  exclude?: string[];
@@ -9,16 +37,16 @@ interface FilterConfig {
9
37
  interface HotPathConfig {
10
38
  customAnimationCalls?: string[];
11
39
  importSources?: Record<string, string[]>;
12
- hookPattern?: RegExp;
40
+ hookPattern?: PatternInput;
13
41
  customHooks?: string[];
14
42
  arrayHofMethods?: string[];
15
- eventHandlerRegex?: RegExp;
43
+ eventHandlerRegex?: PatternInput;
16
44
  maxPipelineCallers?: number;
17
45
  hocWrappers?: string[];
18
46
  excludeComponents?: string[];
19
47
  }
20
48
  interface SemanticAnchorsConfig {
21
- patterns?: RegExp[];
49
+ patterns?: PatternInput[];
22
50
  excludeUiClasses?: boolean;
23
51
  }
24
52
  interface VaultConfig {
@@ -28,12 +56,14 @@ interface VaultConfig {
28
56
  cssFramework?: 'tailwind' | 'unocss' | 'none';
29
57
  semanticAnchors?: SemanticAnchorsConfig;
30
58
  polymorphicDecoys?: boolean;
59
+ fragmented?: boolean;
60
+ fragmentCount?: number;
31
61
  }
32
62
  interface ManglerConfig {
33
63
  minLength?: number;
34
64
  reservedIdentifiers?: string[];
35
65
  excludePrefixes?: string[];
36
- excludePatterns?: RegExp[];
66
+ excludePatterns?: PatternInput[];
37
67
  }
38
68
  interface ShieldOptionsConfig {
39
69
  detectHeadless?: boolean;
@@ -52,13 +82,18 @@ interface ViteConfigOptions {
52
82
  assetsDir?: string;
53
83
  }
54
84
  interface UnpeekConfig {
55
- framework?: ConfigFramework;
85
+ framework?: UnpeekFramework;
56
86
  target?: ConfigTarget;
87
+ profile?: UnpeekProfile;
88
+ tier?: UnpeekTier;
89
+ coldFlow?: boolean;
57
90
  outDir?: string;
58
91
  extensions?: string[];
59
92
  publicDirs?: string[];
93
+ scrubPaths?: boolean;
60
94
  filter?: FilterConfig;
61
95
  hotPath?: HotPathConfig;
96
+ critical?: CriticalConfig;
62
97
  vault?: VaultConfig;
63
98
  mangler?: ManglerConfig;
64
99
  shield?: ShieldOptionsConfig;
@@ -66,96 +101,33 @@ interface UnpeekConfig {
66
101
  next?: NextConfigOptions;
67
102
  vite?: ViteConfigOptions;
68
103
  }
69
- interface ProtectOptions {
70
- /** Target project root directory (defaults to process.cwd()) */
71
- cwd?: string;
72
- /** Explicit client output directory override */
73
- outDir?: string;
104
+ interface BaseProtectionOptions {
74
105
  /** Polymorphic deterministic seed (defaults to random per build) */
75
106
  seed?: number;
76
- /** Move .map files to .unpeek-maps/ instead of permanently deleting (default: true) */
77
- keepPrivateMaps?: boolean;
78
- /** Private directory to store extracted source maps (default: '.unpeek-maps') */
79
- privateMapsDir?: string;
107
+ /** Minimum string length to encrypt in the O(1) kConst string vault (default: 4) */
108
+ minStringLength?: number;
109
+ /** Inject runtime integrity and DevTools shield into entry chunks (default: true) */
110
+ injectRuntimeShield?: boolean;
80
111
  /** Runtime anti-tamper deterrent mode (default: 'passive') */
81
112
  deterrentMode?: DeterrentMode;
82
113
  /** Treat navigator.webdriver / HeadlessChrome as tamper (default: false) */
83
114
  detectHeadless?: boolean;
84
- /** Inject runtime integrity and DevTools shield into entry chunks (default: true) */
85
- injectRuntimeShield?: boolean;
86
- /** Minimum string length to encrypt in the O(1) kConst string vault (default: 4) */
87
- minStringLength?: number;
88
115
  /** Enable Layer 2 aggressive protection (Bytecode Micro-VM, Inline WASM KDF, Call-Site Salted Vault) */
89
116
  aggressive?: boolean;
117
+ /** Protection preset profile */
118
+ profile?: UnpeekProfile;
119
+ /** Explicit protection tier override */
120
+ tier?: UnpeekTier;
121
+ /** Tier 3 enclave targeting configuration (@unpeek-critical / include patterns) */
122
+ critical?: CriticalConfig;
90
123
  /** Optional Unpeek configuration */
91
124
  config?: UnpeekConfig;
92
125
  }
93
- interface HotPathReport {
94
- totalFunctions: number;
95
- hotFunctionsSkipped: string[];
96
- coldFunctionsProtected: string[];
97
- }
98
- interface TransformOptions {
99
- seed?: number;
100
- minStringLength?: number;
101
- filename?: string;
102
- injectRuntimeShield?: boolean;
103
- deterrentMode?: DeterrentMode;
104
- detectHeadless?: boolean;
105
- /** Enable Layer 2 aggressive protection */
106
- aggressive?: boolean;
107
- /** Throw UnpeekError on JavaScript parse failures instead of returning input unchanged */
108
- strict?: boolean;
109
- /** Optional Unpeek configuration */
126
+ interface UnpeekPluginOptions extends BaseProtectionOptions {
127
+ /** Explicit Unpeek configuration object */
110
128
  config?: UnpeekConfig;
111
129
  }
112
- interface TransformResult {
113
- code: string;
114
- encryptedStringsCount: number;
115
- mangledSymbolsCount: number;
116
- hotPathReport: HotPathReport;
117
- integrityToken: number;
118
- virtualizedFunctionsCount?: number;
119
- }
120
- interface ShieldConfig {
121
- seed: number;
122
- deterrentMode?: DeterrentMode;
123
- detectHeadless?: boolean;
124
- expectedIntegrityHash?: number;
125
- windowKeySymbol?: string;
126
- expectedDelta?: number;
127
- }
128
- interface ShieldPayload {
129
- preambleCode: string;
130
- expectedHash: number;
131
- windowKeySymbol?: string;
132
- expectedDelta?: number;
133
- }
134
- interface SourceMapVaultResult {
135
- movedMapsCount: number;
136
- strippedFilesCount: number;
137
- vaultDir: string;
138
- movedFiles: string[];
139
- dockerIgnoreMissing?: boolean;
140
- }
141
- interface ProtectSummary {
142
- framework: DetectedFramework;
143
- outDir: string;
144
- processedFiles: number;
145
- movedSourceMaps: number;
146
- originalBytes: number;
147
- protectedBytes: number;
148
- originalGzipBytes: number;
149
- protectedGzipBytes: number;
150
- gzipDeltaPercent: number;
151
- totalHotFunctionsSkipped: number;
152
- totalColdFunctionsProtected: number;
153
- totalEncryptedStrings: number;
154
- totalMangledSymbols: number;
155
- elapsedMs: number;
156
- tier?: string;
157
- aggressive?: boolean;
158
- dockerIgnoreMissing?: boolean;
159
- }
130
+ declare function defineConfig<const T extends UnpeekConfig>(config: T): T;
160
131
 
161
- export type { ConfigFramework as C, DetectedFramework as D, FilterConfig as F, HotPathConfig as H, ManglerConfig as M, NextConfigOptions as N, ProtectOptions as P, SemanticAnchorsConfig as S, TransformOptions as T, UnpeekConfig as U, VaultConfig as V, ConfigTarget as a, DeterrentMode as b, HotPathReport as c, ShieldConfig as d, ShieldOptionsConfig as e, ShieldPayload as f, SourcemapsConfig as g, TransformResult as h, ViteConfigOptions as i, ProtectSummary as j, SourceMapVaultResult as k };
132
+ export { PRESETS as P, defineConfig as j, loadUnpeekConfig as l };
133
+ export type { BaseProtectionOptions as B, ConfigTarget as C, DeterrentMode as D, FilterConfig as F, HotPathConfig as H, ManglerConfig as M, NextConfigOptions as N, ShieldConfig as S, UnpeekConfig as U, VaultConfig as V, ShieldPayload as a, PatternInput as b, SemanticAnchorsConfig as c, ShieldOptionsConfig as d, SourcemapsConfig as e, UnpeekFramework as f, UnpeekPluginOptions as g, UnpeekProfile as h, ViteConfigOptions as i, CriticalConfig as k, UnpeekTier as m };
@@ -1,7 +1,35 @@
1
- type DetectedFramework = 'nextjs' | 'vite' | 'webpack' | 'vanilla';
2
1
  type DeterrentMode = 'gradual' | 'passive';
3
- type ConfigFramework = 'nextjs' | 'vite' | 'webpack' | 'vanilla';
2
+ interface ShieldConfig {
3
+ seed: number;
4
+ deterrentMode?: DeterrentMode;
5
+ detectHeadless?: boolean;
6
+ expectedIntegrityHash?: number;
7
+ windowKeySymbol?: string;
8
+ expectedDelta?: number;
9
+ }
10
+ interface ShieldPayload {
11
+ preambleCode: string;
12
+ expectedHash: number;
13
+ windowKeySymbol?: string;
14
+ expectedDelta?: number;
15
+ stateKeySymbol?: string;
16
+ }
17
+
18
+ type UnpeekProfile = 'minimal' | 'recommended' | 'strict';
19
+ declare const PRESETS: Record<UnpeekProfile, UnpeekConfig>;
20
+
21
+ declare function loadUnpeekConfig(cwd?: string, explicitConfig?: UnpeekConfig): Promise<UnpeekConfig>;
22
+
23
+ type UnpeekFramework = 'nextjs' | 'vite' | 'webpack' | 'vanilla';
4
24
  type ConfigTarget = 'browser' | 'worker' | 'universal';
25
+ type UnpeekTier = 'Tier 1' | 'Tier 2' | 'Tier 3';
26
+ type PatternInput = RegExp | string;
27
+
28
+ interface CriticalConfig {
29
+ include?: PatternInput[];
30
+ annotation?: string;
31
+ maxFunctionsPerChunk?: number;
32
+ }
5
33
  interface FilterConfig {
6
34
  include?: string[];
7
35
  exclude?: string[];
@@ -9,16 +37,16 @@ interface FilterConfig {
9
37
  interface HotPathConfig {
10
38
  customAnimationCalls?: string[];
11
39
  importSources?: Record<string, string[]>;
12
- hookPattern?: RegExp;
40
+ hookPattern?: PatternInput;
13
41
  customHooks?: string[];
14
42
  arrayHofMethods?: string[];
15
- eventHandlerRegex?: RegExp;
43
+ eventHandlerRegex?: PatternInput;
16
44
  maxPipelineCallers?: number;
17
45
  hocWrappers?: string[];
18
46
  excludeComponents?: string[];
19
47
  }
20
48
  interface SemanticAnchorsConfig {
21
- patterns?: RegExp[];
49
+ patterns?: PatternInput[];
22
50
  excludeUiClasses?: boolean;
23
51
  }
24
52
  interface VaultConfig {
@@ -28,12 +56,14 @@ interface VaultConfig {
28
56
  cssFramework?: 'tailwind' | 'unocss' | 'none';
29
57
  semanticAnchors?: SemanticAnchorsConfig;
30
58
  polymorphicDecoys?: boolean;
59
+ fragmented?: boolean;
60
+ fragmentCount?: number;
31
61
  }
32
62
  interface ManglerConfig {
33
63
  minLength?: number;
34
64
  reservedIdentifiers?: string[];
35
65
  excludePrefixes?: string[];
36
- excludePatterns?: RegExp[];
66
+ excludePatterns?: PatternInput[];
37
67
  }
38
68
  interface ShieldOptionsConfig {
39
69
  detectHeadless?: boolean;
@@ -52,13 +82,18 @@ interface ViteConfigOptions {
52
82
  assetsDir?: string;
53
83
  }
54
84
  interface UnpeekConfig {
55
- framework?: ConfigFramework;
85
+ framework?: UnpeekFramework;
56
86
  target?: ConfigTarget;
87
+ profile?: UnpeekProfile;
88
+ tier?: UnpeekTier;
89
+ coldFlow?: boolean;
57
90
  outDir?: string;
58
91
  extensions?: string[];
59
92
  publicDirs?: string[];
93
+ scrubPaths?: boolean;
60
94
  filter?: FilterConfig;
61
95
  hotPath?: HotPathConfig;
96
+ critical?: CriticalConfig;
62
97
  vault?: VaultConfig;
63
98
  mangler?: ManglerConfig;
64
99
  shield?: ShieldOptionsConfig;
@@ -66,96 +101,33 @@ interface UnpeekConfig {
66
101
  next?: NextConfigOptions;
67
102
  vite?: ViteConfigOptions;
68
103
  }
69
- interface ProtectOptions {
70
- /** Target project root directory (defaults to process.cwd()) */
71
- cwd?: string;
72
- /** Explicit client output directory override */
73
- outDir?: string;
104
+ interface BaseProtectionOptions {
74
105
  /** Polymorphic deterministic seed (defaults to random per build) */
75
106
  seed?: number;
76
- /** Move .map files to .unpeek-maps/ instead of permanently deleting (default: true) */
77
- keepPrivateMaps?: boolean;
78
- /** Private directory to store extracted source maps (default: '.unpeek-maps') */
79
- privateMapsDir?: string;
107
+ /** Minimum string length to encrypt in the O(1) kConst string vault (default: 4) */
108
+ minStringLength?: number;
109
+ /** Inject runtime integrity and DevTools shield into entry chunks (default: true) */
110
+ injectRuntimeShield?: boolean;
80
111
  /** Runtime anti-tamper deterrent mode (default: 'passive') */
81
112
  deterrentMode?: DeterrentMode;
82
113
  /** Treat navigator.webdriver / HeadlessChrome as tamper (default: false) */
83
114
  detectHeadless?: boolean;
84
- /** Inject runtime integrity and DevTools shield into entry chunks (default: true) */
85
- injectRuntimeShield?: boolean;
86
- /** Minimum string length to encrypt in the O(1) kConst string vault (default: 4) */
87
- minStringLength?: number;
88
115
  /** Enable Layer 2 aggressive protection (Bytecode Micro-VM, Inline WASM KDF, Call-Site Salted Vault) */
89
116
  aggressive?: boolean;
117
+ /** Protection preset profile */
118
+ profile?: UnpeekProfile;
119
+ /** Explicit protection tier override */
120
+ tier?: UnpeekTier;
121
+ /** Tier 3 enclave targeting configuration (@unpeek-critical / include patterns) */
122
+ critical?: CriticalConfig;
90
123
  /** Optional Unpeek configuration */
91
124
  config?: UnpeekConfig;
92
125
  }
93
- interface HotPathReport {
94
- totalFunctions: number;
95
- hotFunctionsSkipped: string[];
96
- coldFunctionsProtected: string[];
97
- }
98
- interface TransformOptions {
99
- seed?: number;
100
- minStringLength?: number;
101
- filename?: string;
102
- injectRuntimeShield?: boolean;
103
- deterrentMode?: DeterrentMode;
104
- detectHeadless?: boolean;
105
- /** Enable Layer 2 aggressive protection */
106
- aggressive?: boolean;
107
- /** Throw UnpeekError on JavaScript parse failures instead of returning input unchanged */
108
- strict?: boolean;
109
- /** Optional Unpeek configuration */
126
+ interface UnpeekPluginOptions extends BaseProtectionOptions {
127
+ /** Explicit Unpeek configuration object */
110
128
  config?: UnpeekConfig;
111
129
  }
112
- interface TransformResult {
113
- code: string;
114
- encryptedStringsCount: number;
115
- mangledSymbolsCount: number;
116
- hotPathReport: HotPathReport;
117
- integrityToken: number;
118
- virtualizedFunctionsCount?: number;
119
- }
120
- interface ShieldConfig {
121
- seed: number;
122
- deterrentMode?: DeterrentMode;
123
- detectHeadless?: boolean;
124
- expectedIntegrityHash?: number;
125
- windowKeySymbol?: string;
126
- expectedDelta?: number;
127
- }
128
- interface ShieldPayload {
129
- preambleCode: string;
130
- expectedHash: number;
131
- windowKeySymbol?: string;
132
- expectedDelta?: number;
133
- }
134
- interface SourceMapVaultResult {
135
- movedMapsCount: number;
136
- strippedFilesCount: number;
137
- vaultDir: string;
138
- movedFiles: string[];
139
- dockerIgnoreMissing?: boolean;
140
- }
141
- interface ProtectSummary {
142
- framework: DetectedFramework;
143
- outDir: string;
144
- processedFiles: number;
145
- movedSourceMaps: number;
146
- originalBytes: number;
147
- protectedBytes: number;
148
- originalGzipBytes: number;
149
- protectedGzipBytes: number;
150
- gzipDeltaPercent: number;
151
- totalHotFunctionsSkipped: number;
152
- totalColdFunctionsProtected: number;
153
- totalEncryptedStrings: number;
154
- totalMangledSymbols: number;
155
- elapsedMs: number;
156
- tier?: string;
157
- aggressive?: boolean;
158
- dockerIgnoreMissing?: boolean;
159
- }
130
+ declare function defineConfig<const T extends UnpeekConfig>(config: T): T;
160
131
 
161
- export type { ConfigFramework as C, DetectedFramework as D, FilterConfig as F, HotPathConfig as H, ManglerConfig as M, NextConfigOptions as N, ProtectOptions as P, SemanticAnchorsConfig as S, TransformOptions as T, UnpeekConfig as U, VaultConfig as V, ConfigTarget as a, DeterrentMode as b, HotPathReport as c, ShieldConfig as d, ShieldOptionsConfig as e, ShieldPayload as f, SourcemapsConfig as g, TransformResult as h, ViteConfigOptions as i, ProtectSummary as j, SourceMapVaultResult as k };
132
+ export { PRESETS as P, defineConfig as j, loadUnpeekConfig as l };
133
+ export type { BaseProtectionOptions as B, ConfigTarget as C, DeterrentMode as D, FilterConfig as F, HotPathConfig as H, ManglerConfig as M, NextConfigOptions as N, ShieldConfig as S, UnpeekConfig as U, VaultConfig as V, ShieldPayload as a, PatternInput as b, SemanticAnchorsConfig as c, ShieldOptionsConfig as d, SourcemapsConfig as e, UnpeekFramework as f, UnpeekPluginOptions as g, UnpeekProfile as h, ViteConfigOptions as i, CriticalConfig as k, UnpeekTier as m };
package/dist/config.cjs CHANGED
@@ -1,22 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
+ var _chunkX6EETCO6cjs = require('./chunk-X6EETCO6.cjs');
5
+ require('./chunk-URPPSTHZ.cjs');
6
+ require('./chunk-L6BOM5VS.cjs');
4
7
 
5
8
 
6
9
 
7
-
8
-
9
-
10
- var _chunk24K5NDXHcjs = require('./chunk-24K5NDXH.cjs');
11
- require('./chunk-R6EBIR3T.cjs');
12
- require('./chunk-4TDLLEEU.cjs');
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
- exports.CONFIG_CANDIDATES = _chunk24K5NDXHcjs.CONFIG_CANDIDATES; exports.DEFAULT_CONFIG = _chunk24K5NDXHcjs.DEFAULT_CONFIG; exports.defineConfig = _chunk24K5NDXHcjs.defineConfig; exports.findConfigFile = _chunk24K5NDXHcjs.findConfigFile; exports.loadUnpeekConfig = _chunk24K5NDXHcjs.loadUnpeekConfig; exports.mergeUnpeekConfig = _chunk24K5NDXHcjs.mergeUnpeekConfig; exports.normalizeConfig = _chunk24K5NDXHcjs.normalizeConfig; exports.resolveUnpeekConfigSync = _chunk24K5NDXHcjs.resolveUnpeekConfigSync;
10
+ exports.defineConfig = _chunkX6EETCO6cjs.defineConfig; exports.loadUnpeekConfig = _chunkX6EETCO6cjs.loadUnpeekConfig;
package/dist/config.d.cts CHANGED
@@ -1,12 +1 @@
1
- import { UnpeekConfig } from './browser.cjs';
2
-
3
- declare const CONFIG_CANDIDATES: string[];
4
- declare const DEFAULT_CONFIG: UnpeekConfig;
5
- declare function normalizeConfig(raw: Record<string, unknown>): UnpeekConfig;
6
- declare function mergeUnpeekConfig(base: UnpeekConfig, override?: UnpeekConfig): UnpeekConfig;
7
- declare function findConfigFile(cwd?: string): string | null;
8
- declare function loadUnpeekConfig(cwd?: string, explicitConfig?: UnpeekConfig): Promise<UnpeekConfig>;
9
- declare function resolveUnpeekConfigSync(cwd?: string, explicitConfig?: UnpeekConfig): UnpeekConfig;
10
- declare function defineConfig(config: UnpeekConfig): UnpeekConfig;
11
-
12
- export { CONFIG_CANDIDATES, DEFAULT_CONFIG, defineConfig, findConfigFile, loadUnpeekConfig, mergeUnpeekConfig, normalizeConfig, resolveUnpeekConfigSync };
1
+ export { B as BaseProtectionOptions, C as ConfigTarget, k as CriticalConfig, F as FilterConfig, H as HotPathConfig, M as ManglerConfig, N as NextConfigOptions, b as PatternInput, c as SemanticAnchorsConfig, d as ShieldOptionsConfig, e as SourcemapsConfig, U as UnpeekConfig, f as UnpeekFramework, g as UnpeekPluginOptions, h as UnpeekProfile, m as UnpeekTier, V as VaultConfig, i as ViteConfigOptions, j as defineConfig, l as loadUnpeekConfig } from './config-Y6JwVGwX.cjs';
package/dist/config.d.ts CHANGED
@@ -1,12 +1 @@
1
- import { UnpeekConfig } from './browser.js';
2
-
3
- declare const CONFIG_CANDIDATES: string[];
4
- declare const DEFAULT_CONFIG: UnpeekConfig;
5
- declare function normalizeConfig(raw: Record<string, unknown>): UnpeekConfig;
6
- declare function mergeUnpeekConfig(base: UnpeekConfig, override?: UnpeekConfig): UnpeekConfig;
7
- declare function findConfigFile(cwd?: string): string | null;
8
- declare function loadUnpeekConfig(cwd?: string, explicitConfig?: UnpeekConfig): Promise<UnpeekConfig>;
9
- declare function resolveUnpeekConfigSync(cwd?: string, explicitConfig?: UnpeekConfig): UnpeekConfig;
10
- declare function defineConfig(config: UnpeekConfig): UnpeekConfig;
11
-
12
- export { CONFIG_CANDIDATES, DEFAULT_CONFIG, defineConfig, findConfigFile, loadUnpeekConfig, mergeUnpeekConfig, normalizeConfig, resolveUnpeekConfigSync };
1
+ export { B as BaseProtectionOptions, C as ConfigTarget, k as CriticalConfig, F as FilterConfig, H as HotPathConfig, M as ManglerConfig, N as NextConfigOptions, b as PatternInput, c as SemanticAnchorsConfig, d as ShieldOptionsConfig, e as SourcemapsConfig, U as UnpeekConfig, f as UnpeekFramework, g as UnpeekPluginOptions, h as UnpeekProfile, m as UnpeekTier, V as VaultConfig, i as ViteConfigOptions, j as defineConfig, l as loadUnpeekConfig } from './config-Y6JwVGwX.js';
package/dist/config.js CHANGED
@@ -1,22 +1,10 @@
1
1
  import {
2
- CONFIG_CANDIDATES,
3
- DEFAULT_CONFIG,
4
2
  defineConfig,
5
- findConfigFile,
6
- loadUnpeekConfig,
7
- mergeUnpeekConfig,
8
- normalizeConfig,
9
- resolveUnpeekConfigSync
10
- } from "./chunk-GZB7PFLY.js";
11
- import "./chunk-S4S2WXGC.js";
12
- import "./chunk-OOXSZTRV.js";
3
+ loadUnpeekConfig
4
+ } from "./chunk-W77DAC3H.js";
5
+ import "./chunk-EN6QVR6P.js";
6
+ import "./chunk-LA6J3BT3.js";
13
7
  export {
14
- CONFIG_CANDIDATES,
15
- DEFAULT_CONFIG,
16
8
  defineConfig,
17
- findConfigFile,
18
- loadUnpeekConfig,
19
- mergeUnpeekConfig,
20
- normalizeConfig,
21
- resolveUnpeekConfigSync
9
+ loadUnpeekConfig
22
10
  };
@@ -0,0 +1,52 @@
1
+ import { B as BaseProtectionOptions, k as CriticalConfig } from './config-Y6JwVGwX.js';
2
+
3
+ interface HotPathReport {
4
+ totalFunctions: number;
5
+ hotFunctionsSkipped: string[];
6
+ coldFunctionsProtected: string[];
7
+ }
8
+ type TransformSkippedReason = 'empty' | 'already-protected' | 'parse-error';
9
+ interface ScrubberOptions {
10
+ scrubPaths?: boolean;
11
+ rootDir?: string;
12
+ exemptStrings?: string[];
13
+ }
14
+ interface TransformOptions extends BaseProtectionOptions {
15
+ filename?: string;
16
+ /** Project root directory stripped by the CWE-540 path scrubber */
17
+ rootDir?: string;
18
+ /** Tier 3 critical enclave targeting overrides */
19
+ critical?: CriticalConfig;
20
+ /** Generate an M2 Source Map v3 alongside the transformed output */
21
+ map?: boolean;
22
+ /** Throw UnpeekError on JavaScript parse failures instead of returning input unchanged */
23
+ strict?: boolean;
24
+ /** Scrub local filesystem paths and residual dev metadata (CWE-540) */
25
+ scrubPaths?: boolean;
26
+ }
27
+ interface TransformResult {
28
+ code: string;
29
+ encryptedStringsCount: number;
30
+ mangledSymbolsCount: number;
31
+ hotPathReport: HotPathReport;
32
+ integrityToken: number;
33
+ virtualizedFunctionsCount?: number;
34
+ skippedReason?: TransformSkippedReason;
35
+ debugId?: string;
36
+ }
37
+
38
+ type UnpeekErrorCode = 'ERR_CONFIG_INVALID' | 'ERR_CONFIG_LOAD' | 'ERR_INIT_INVALID_PACKAGE_JSON' | 'ERR_SECURITY_PATH_TRAVERSAL' | 'ERR_CLI_INVALID_ARGS' | 'ERR_PARSE_FAILED' | 'ERR_NEXT_ADAPTER' | 'ERR_BUDGET_EXCEEDED';
39
+ declare const UNPEEK_ERROR_BRAND: unique symbol;
40
+ declare class UnpeekError extends Error {
41
+ readonly code: UnpeekErrorCode;
42
+ readonly [UNPEEK_ERROR_BRAND] = true;
43
+ constructor(code: UnpeekErrorCode, message: string, options?: {
44
+ cause?: unknown;
45
+ });
46
+ }
47
+ declare function isUnpeekError(err: unknown): err is UnpeekError;
48
+
49
+ declare function transformJavaScript(code: string, options?: TransformOptions): TransformResult;
50
+
51
+ export { UnpeekError as U, isUnpeekError as i, transformJavaScript as t };
52
+ export type { HotPathReport as H, ScrubberOptions as S, TransformOptions as T, TransformResult as a, TransformSkippedReason as b, UnpeekErrorCode as c };
@@ -0,0 +1,52 @@
1
+ import { B as BaseProtectionOptions, k as CriticalConfig } from './config-Y6JwVGwX.cjs';
2
+
3
+ interface HotPathReport {
4
+ totalFunctions: number;
5
+ hotFunctionsSkipped: string[];
6
+ coldFunctionsProtected: string[];
7
+ }
8
+ type TransformSkippedReason = 'empty' | 'already-protected' | 'parse-error';
9
+ interface ScrubberOptions {
10
+ scrubPaths?: boolean;
11
+ rootDir?: string;
12
+ exemptStrings?: string[];
13
+ }
14
+ interface TransformOptions extends BaseProtectionOptions {
15
+ filename?: string;
16
+ /** Project root directory stripped by the CWE-540 path scrubber */
17
+ rootDir?: string;
18
+ /** Tier 3 critical enclave targeting overrides */
19
+ critical?: CriticalConfig;
20
+ /** Generate an M2 Source Map v3 alongside the transformed output */
21
+ map?: boolean;
22
+ /** Throw UnpeekError on JavaScript parse failures instead of returning input unchanged */
23
+ strict?: boolean;
24
+ /** Scrub local filesystem paths and residual dev metadata (CWE-540) */
25
+ scrubPaths?: boolean;
26
+ }
27
+ interface TransformResult {
28
+ code: string;
29
+ encryptedStringsCount: number;
30
+ mangledSymbolsCount: number;
31
+ hotPathReport: HotPathReport;
32
+ integrityToken: number;
33
+ virtualizedFunctionsCount?: number;
34
+ skippedReason?: TransformSkippedReason;
35
+ debugId?: string;
36
+ }
37
+
38
+ type UnpeekErrorCode = 'ERR_CONFIG_INVALID' | 'ERR_CONFIG_LOAD' | 'ERR_INIT_INVALID_PACKAGE_JSON' | 'ERR_SECURITY_PATH_TRAVERSAL' | 'ERR_CLI_INVALID_ARGS' | 'ERR_PARSE_FAILED' | 'ERR_NEXT_ADAPTER' | 'ERR_BUDGET_EXCEEDED';
39
+ declare const UNPEEK_ERROR_BRAND: unique symbol;
40
+ declare class UnpeekError extends Error {
41
+ readonly code: UnpeekErrorCode;
42
+ readonly [UNPEEK_ERROR_BRAND] = true;
43
+ constructor(code: UnpeekErrorCode, message: string, options?: {
44
+ cause?: unknown;
45
+ });
46
+ }
47
+ declare function isUnpeekError(err: unknown): err is UnpeekError;
48
+
49
+ declare function transformJavaScript(code: string, options?: TransformOptions): TransformResult;
50
+
51
+ export { UnpeekError as U, isUnpeekError as i, transformJavaScript as t };
52
+ export type { HotPathReport as H, ScrubberOptions as S, TransformOptions as T, TransformResult as a, TransformSkippedReason as b, UnpeekErrorCode as c };