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
@@ -0,0 +1,40 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class;var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
8
+ // ../../node_modules/.pnpm/tsup@9.0.0_jiti@2.7.0_postc_67389378eb6cac6e57778cd40e79e1a8/node_modules/tsup/assets/cjs_shims.js
9
+ var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
10
+ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
11
+
12
+ // src/shared/errors.ts
13
+ var UNPEEK_ERROR_BRAND = /* @__PURE__ */ Symbol.for("unpeek.UnpeekError");
14
+ var UnpeekError = (_class = class extends Error {
15
+
16
+ __init() {this[UNPEEK_ERROR_BRAND] = true}
17
+ constructor(code, message, options) {
18
+ super(message, options);_class.prototype.__init.call(this);;
19
+ this.name = "UnpeekError";
20
+ this.code = code;
21
+ Object.setPrototypeOf(this, new.target.prototype);
22
+ }
23
+ }, _class);
24
+ function isUnpeekError(err) {
25
+ if (err instanceof UnpeekError) {
26
+ return true;
27
+ }
28
+ if (typeof err !== "object" || err === null) {
29
+ return false;
30
+ }
31
+ const candidate = err;
32
+ return candidate[UNPEEK_ERROR_BRAND] === true || candidate.name === "UnpeekError" && typeof candidate.code === "string";
33
+ }
34
+
35
+
36
+
37
+
38
+
39
+
40
+ exports.__require = __require; exports.importMetaUrl = importMetaUrl; exports.UnpeekError = UnpeekError; exports.isUnpeekError = isUnpeekError;
@@ -12,7 +12,32 @@ var getFilename = () => fileURLToPath(import.meta.url);
12
12
  var getDirname = () => path.dirname(getFilename());
13
13
  var __dirname = /* @__PURE__ */ getDirname();
14
14
 
15
+ // src/shared/errors.ts
16
+ var UNPEEK_ERROR_BRAND = /* @__PURE__ */ Symbol.for("unpeek.UnpeekError");
17
+ var UnpeekError = class extends Error {
18
+ code;
19
+ [UNPEEK_ERROR_BRAND] = true;
20
+ constructor(code, message, options) {
21
+ super(message, options);
22
+ this.name = "UnpeekError";
23
+ this.code = code;
24
+ Object.setPrototypeOf(this, new.target.prototype);
25
+ }
26
+ };
27
+ function isUnpeekError(err) {
28
+ if (err instanceof UnpeekError) {
29
+ return true;
30
+ }
31
+ if (typeof err !== "object" || err === null) {
32
+ return false;
33
+ }
34
+ const candidate = err;
35
+ return candidate[UNPEEK_ERROR_BRAND] === true || candidate.name === "UnpeekError" && typeof candidate.code === "string";
36
+ }
37
+
15
38
  export {
16
39
  __require,
17
- __dirname
40
+ __dirname,
41
+ UnpeekError,
42
+ isUnpeekError
18
43
  };
@@ -1,8 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkR6EBIR3Tcjs = require('./chunk-R6EBIR3T.cjs');
3
+ var _chunkIEBVL5BTcjs = require('./chunk-IEBVL5BT.cjs');
4
4
 
5
- // src/config.ts
5
+
6
+ var _chunkL6BOM5VScjs = require('./chunk-L6BOM5VS.cjs');
7
+
8
+ // src/internal/config.ts
6
9
  var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
7
10
  var _path = require('path');
8
11
  var _url = require('url');
@@ -83,6 +86,9 @@ function toRegExpArray(val) {
83
86
  }
84
87
  return result;
85
88
  }
89
+ function clonePatterns(patterns) {
90
+ return patterns ? [...patterns] : void 0;
91
+ }
86
92
  function normalizeConfig(raw) {
87
93
  if (!isRecord(raw)) {
88
94
  return {};
@@ -112,15 +118,14 @@ function normalizeConfig(raw) {
112
118
  }
113
119
  return result;
114
120
  }
115
- function mergeUnpeekConfig(base, override) {
116
- if (!override) {
117
- return { ...base };
118
- }
121
+ function mergeTwoConfigs(base, override) {
119
122
  return {
120
123
  ...base,
121
124
  framework: _nullishCoalesce(override.framework, () => ( base.framework)),
122
125
  target: _nullishCoalesce(override.target, () => ( base.target)),
126
+ profile: _nullishCoalesce(override.profile, () => ( base.profile)),
123
127
  outDir: _nullishCoalesce(override.outDir, () => ( base.outDir)),
128
+ scrubPaths: _nullishCoalesce(override.scrubPaths, () => ( base.scrubPaths)),
124
129
  extensions: override.extensions ? [...override.extensions] : base.extensions ? [...base.extensions] : void 0,
125
130
  publicDirs: override.publicDirs ? [...override.publicDirs] : base.publicDirs ? [...base.publicDirs] : void 0,
126
131
  filter: {
@@ -168,41 +173,50 @@ function mergeUnpeekConfig(base, override) {
168
173
  ),
169
174
  cssFramework: _nullishCoalesce(_nullishCoalesce(_optionalChain([override, 'access', _57 => _57.vault, 'optionalAccess', _58 => _58.cssFramework]), () => ( _optionalChain([base, 'access', _59 => _59.vault, 'optionalAccess', _60 => _60.cssFramework]))), () => ( "tailwind")),
170
175
  semanticAnchors: {
171
- patterns: _optionalChain([override, 'access', _61 => _61.vault, 'optionalAccess', _62 => _62.semanticAnchors, 'optionalAccess', _63 => _63.patterns]) ? [...override.vault.semanticAnchors.patterns] : _optionalChain([base, 'access', _64 => _64.vault, 'optionalAccess', _65 => _65.semanticAnchors, 'optionalAccess', _66 => _66.patterns]),
176
+ patterns: _nullishCoalesce(clonePatterns(_optionalChain([override, 'access', _61 => _61.vault, 'optionalAccess', _62 => _62.semanticAnchors, 'optionalAccess', _63 => _63.patterns])), () => ( clonePatterns(_optionalChain([base, 'access', _64 => _64.vault, 'optionalAccess', _65 => _65.semanticAnchors, 'optionalAccess', _66 => _66.patterns])))),
172
177
  excludeUiClasses: _nullishCoalesce(_nullishCoalesce(_optionalChain([override, 'access', _67 => _67.vault, 'optionalAccess', _68 => _68.semanticAnchors, 'optionalAccess', _69 => _69.excludeUiClasses]), () => ( _optionalChain([base, 'access', _70 => _70.vault, 'optionalAccess', _71 => _71.semanticAnchors, 'optionalAccess', _72 => _72.excludeUiClasses]))), () => ( true))
173
178
  },
174
- polymorphicDecoys: _nullishCoalesce(_nullishCoalesce(_optionalChain([override, 'access', _73 => _73.vault, 'optionalAccess', _74 => _74.polymorphicDecoys]), () => ( _optionalChain([base, 'access', _75 => _75.vault, 'optionalAccess', _76 => _76.polymorphicDecoys]))), () => ( true))
179
+ polymorphicDecoys: _nullishCoalesce(_nullishCoalesce(_optionalChain([override, 'access', _73 => _73.vault, 'optionalAccess', _74 => _74.polymorphicDecoys]), () => ( _optionalChain([base, 'access', _75 => _75.vault, 'optionalAccess', _76 => _76.polymorphicDecoys]))), () => ( true)),
180
+ fragmented: _nullishCoalesce(_optionalChain([override, 'access', _77 => _77.vault, 'optionalAccess', _78 => _78.fragmented]), () => ( _optionalChain([base, 'access', _79 => _79.vault, 'optionalAccess', _80 => _80.fragmented]))),
181
+ fragmentCount: _nullishCoalesce(_optionalChain([override, 'access', _81 => _81.vault, 'optionalAccess', _82 => _82.fragmentCount]), () => ( _optionalChain([base, 'access', _83 => _83.vault, 'optionalAccess', _84 => _84.fragmentCount])))
175
182
  },
176
183
  mangler: {
177
- minLength: _nullishCoalesce(_nullishCoalesce(_optionalChain([override, 'access', _77 => _77.mangler, 'optionalAccess', _78 => _78.minLength]), () => ( _optionalChain([base, 'access', _79 => _79.mangler, 'optionalAccess', _80 => _80.minLength]))), () => ( 3)),
184
+ minLength: _nullishCoalesce(_nullishCoalesce(_optionalChain([override, 'access', _85 => _85.mangler, 'optionalAccess', _86 => _86.minLength]), () => ( _optionalChain([base, 'access', _87 => _87.mangler, 'optionalAccess', _88 => _88.minLength]))), () => ( 3)),
178
185
  reservedIdentifiers: mergeStringArrays(
179
- _optionalChain([base, 'access', _81 => _81.mangler, 'optionalAccess', _82 => _82.reservedIdentifiers]),
180
- _optionalChain([override, 'access', _83 => _83.mangler, 'optionalAccess', _84 => _84.reservedIdentifiers])
186
+ _optionalChain([base, 'access', _89 => _89.mangler, 'optionalAccess', _90 => _90.reservedIdentifiers]),
187
+ _optionalChain([override, 'access', _91 => _91.mangler, 'optionalAccess', _92 => _92.reservedIdentifiers])
181
188
  ),
182
189
  excludePrefixes: mergeStringArrays(
183
- _optionalChain([base, 'access', _85 => _85.mangler, 'optionalAccess', _86 => _86.excludePrefixes]),
184
- _optionalChain([override, 'access', _87 => _87.mangler, 'optionalAccess', _88 => _88.excludePrefixes])
190
+ _optionalChain([base, 'access', _93 => _93.mangler, 'optionalAccess', _94 => _94.excludePrefixes]),
191
+ _optionalChain([override, 'access', _95 => _95.mangler, 'optionalAccess', _96 => _96.excludePrefixes])
185
192
  ),
186
- excludePatterns: _optionalChain([override, 'access', _89 => _89.mangler, 'optionalAccess', _90 => _90.excludePatterns]) ? [...override.mangler.excludePatterns] : _optionalChain([base, 'access', _91 => _91.mangler, 'optionalAccess', _92 => _92.excludePatterns])
193
+ excludePatterns: _nullishCoalesce(clonePatterns(_optionalChain([override, 'access', _97 => _97.mangler, 'optionalAccess', _98 => _98.excludePatterns])), () => ( clonePatterns(_optionalChain([base, 'access', _99 => _99.mangler, 'optionalAccess', _100 => _100.excludePatterns]))))
187
194
  },
188
195
  shield: {
189
- detectHeadless: _nullishCoalesce(_nullishCoalesce(_optionalChain([override, 'access', _93 => _93.shield, 'optionalAccess', _94 => _94.detectHeadless]), () => ( _optionalChain([base, 'access', _95 => _95.shield, 'optionalAccess', _96 => _96.detectHeadless]))), () => ( false)),
190
- deterrentMode: _nullishCoalesce(_nullishCoalesce(_optionalChain([override, 'access', _97 => _97.shield, 'optionalAccess', _98 => _98.deterrentMode]), () => ( _optionalChain([base, 'access', _99 => _99.shield, 'optionalAccess', _100 => _100.deterrentMode]))), () => ( "passive"))
196
+ detectHeadless: _nullishCoalesce(_nullishCoalesce(_optionalChain([override, 'access', _101 => _101.shield, 'optionalAccess', _102 => _102.detectHeadless]), () => ( _optionalChain([base, 'access', _103 => _103.shield, 'optionalAccess', _104 => _104.detectHeadless]))), () => ( false)),
197
+ deterrentMode: _nullishCoalesce(_nullishCoalesce(_optionalChain([override, 'access', _105 => _105.shield, 'optionalAccess', _106 => _106.deterrentMode]), () => ( _optionalChain([base, 'access', _107 => _107.shield, 'optionalAccess', _108 => _108.deterrentMode]))), () => ( "passive"))
191
198
  },
192
199
  sourcemaps: {
193
- keepPrivate: _nullishCoalesce(_nullishCoalesce(_optionalChain([override, 'access', _101 => _101.sourcemaps, 'optionalAccess', _102 => _102.keepPrivate]), () => ( _optionalChain([base, 'access', _103 => _103.sourcemaps, 'optionalAccess', _104 => _104.keepPrivate]))), () => ( true)),
194
- vaultDir: _nullishCoalesce(_nullishCoalesce(_optionalChain([override, 'access', _105 => _105.sourcemaps, 'optionalAccess', _106 => _106.vaultDir]), () => ( _optionalChain([base, 'access', _107 => _107.sourcemaps, 'optionalAccess', _108 => _108.vaultDir]))), () => ( ".unpeek-maps")),
195
- stripComments: _nullishCoalesce(_nullishCoalesce(_optionalChain([override, 'access', _109 => _109.sourcemaps, 'optionalAccess', _110 => _110.stripComments]), () => ( _optionalChain([base, 'access', _111 => _111.sourcemaps, 'optionalAccess', _112 => _112.stripComments]))), () => ( true))
200
+ keepPrivate: _nullishCoalesce(_nullishCoalesce(_optionalChain([override, 'access', _109 => _109.sourcemaps, 'optionalAccess', _110 => _110.keepPrivate]), () => ( _optionalChain([base, 'access', _111 => _111.sourcemaps, 'optionalAccess', _112 => _112.keepPrivate]))), () => ( true)),
201
+ vaultDir: _nullishCoalesce(_nullishCoalesce(_optionalChain([override, 'access', _113 => _113.sourcemaps, 'optionalAccess', _114 => _114.vaultDir]), () => ( _optionalChain([base, 'access', _115 => _115.sourcemaps, 'optionalAccess', _116 => _116.vaultDir]))), () => ( ".unpeek-maps")),
202
+ stripComments: _nullishCoalesce(_nullishCoalesce(_optionalChain([override, 'access', _117 => _117.sourcemaps, 'optionalAccess', _118 => _118.stripComments]), () => ( _optionalChain([base, 'access', _119 => _119.sourcemaps, 'optionalAccess', _120 => _120.stripComments]))), () => ( true))
196
203
  },
197
204
  next: {
198
- distDir: _nullishCoalesce(_optionalChain([override, 'access', _113 => _113.next, 'optionalAccess', _114 => _114.distDir]), () => ( _optionalChain([base, 'access', _115 => _115.next, 'optionalAccess', _116 => _116.distDir])))
205
+ distDir: _nullishCoalesce(_optionalChain([override, 'access', _121 => _121.next, 'optionalAccess', _122 => _122.distDir]), () => ( _optionalChain([base, 'access', _123 => _123.next, 'optionalAccess', _124 => _124.distDir])))
199
206
  },
200
207
  vite: {
201
- outDir: _nullishCoalesce(_optionalChain([override, 'access', _117 => _117.vite, 'optionalAccess', _118 => _118.outDir]), () => ( _optionalChain([base, 'access', _119 => _119.vite, 'optionalAccess', _120 => _120.outDir]))),
202
- assetsDir: _nullishCoalesce(_optionalChain([override, 'access', _121 => _121.vite, 'optionalAccess', _122 => _122.assetsDir]), () => ( _optionalChain([base, 'access', _123 => _123.vite, 'optionalAccess', _124 => _124.assetsDir])))
208
+ outDir: _nullishCoalesce(_optionalChain([override, 'access', _125 => _125.vite, 'optionalAccess', _126 => _126.outDir]), () => ( _optionalChain([base, 'access', _127 => _127.vite, 'optionalAccess', _128 => _128.outDir]))),
209
+ assetsDir: _nullishCoalesce(_optionalChain([override, 'access', _129 => _129.vite, 'optionalAccess', _130 => _130.assetsDir]), () => ( _optionalChain([base, 'access', _131 => _131.vite, 'optionalAccess', _132 => _132.assetsDir])))
203
210
  }
204
211
  };
205
212
  }
213
+ function mergeUnpeekConfig(base, override) {
214
+ if (!override) {
215
+ return { ...base };
216
+ }
217
+ const effectiveBase = override.profile ? mergeTwoConfigs(base, _chunkIEBVL5BTcjs.PRESETS[override.profile]) : base;
218
+ return mergeTwoConfigs(effectiveBase, override);
219
+ }
206
220
  function findConfigFile(cwd = process.cwd()) {
207
221
  const root = cwd ? _path.resolve.call(void 0, cwd) : process.cwd();
208
222
  for (const filename of CONFIG_CANDIDATES) {
@@ -227,7 +241,7 @@ function validateAndNormalizeConfig(raw, configPath) {
227
241
  return {};
228
242
  }
229
243
  if (!isRecord(raw)) {
230
- throw new (0, _chunkR6EBIR3Tcjs.UnpeekError)(
244
+ throw new (0, _chunkL6BOM5VScjs.UnpeekError)(
231
245
  "ERR_CONFIG_INVALID",
232
246
  `Configuration at "${configPath}" must export or contain a JSON object.`
233
247
  );
@@ -235,8 +249,8 @@ function validateAndNormalizeConfig(raw, configPath) {
235
249
  try {
236
250
  return normalizeConfig(raw);
237
251
  } catch (err) {
238
- if (err instanceof _chunkR6EBIR3Tcjs.UnpeekError) throw err;
239
- throw new (0, _chunkR6EBIR3Tcjs.UnpeekError)(
252
+ if (err instanceof _chunkL6BOM5VScjs.UnpeekError) throw err;
253
+ throw new (0, _chunkL6BOM5VScjs.UnpeekError)(
240
254
  "ERR_CONFIG_INVALID",
241
255
  `Invalid configuration at "${configPath}": ${formatErr(err)}`,
242
256
  { cause: err }
@@ -248,7 +262,7 @@ function parseJsonConfig(content, configPath) {
248
262
  try {
249
263
  parsed = JSON.parse(content);
250
264
  } catch (err) {
251
- throw new (0, _chunkR6EBIR3Tcjs.UnpeekError)(
265
+ throw new (0, _chunkL6BOM5VScjs.UnpeekError)(
252
266
  "ERR_CONFIG_INVALID",
253
267
  `Failed to parse JSON configuration at "${configPath}": ${formatErr(err)}`,
254
268
  { cause: err }
@@ -267,7 +281,7 @@ async function loadUnpeekConfig(cwd = process.cwd(), explicitConfig) {
267
281
  try {
268
282
  content = await _fs2.default.promises.readFile(configPath, "utf8");
269
283
  } catch (err) {
270
- throw new (0, _chunkR6EBIR3Tcjs.UnpeekError)(
284
+ throw new (0, _chunkL6BOM5VScjs.UnpeekError)(
271
285
  "ERR_CONFIG_LOAD",
272
286
  `Failed to read configuration at "${configPath}": ${formatErr(err)}`,
273
287
  { cause: err }
@@ -294,7 +308,7 @@ async function loadUnpeekConfig(cwd = process.cwd(), explicitConfig) {
294
308
  }
295
309
  raw = cjsRaw;
296
310
  } catch (e) {
297
- throw new (0, _chunkR6EBIR3Tcjs.UnpeekError)(
311
+ throw new (0, _chunkL6BOM5VScjs.UnpeekError)(
298
312
  "ERR_CONFIG_LOAD",
299
313
  `Failed to load configuration at "${configPath}": ${formatErr(importErr)}`,
300
314
  { cause: importErr }
@@ -307,53 +321,8 @@ async function loadUnpeekConfig(cwd = process.cwd(), explicitConfig) {
307
321
  const baseConfig = mergeUnpeekConfig(DEFAULT_CONFIG, parsedConfig);
308
322
  return explicitConfig ? mergeUnpeekConfig(baseConfig, explicitConfig) : baseConfig;
309
323
  }
310
- function resolveUnpeekConfigSync(cwd = process.cwd(), explicitConfig) {
311
- const root = cwd ? _path.resolve.call(void 0, cwd) : process.cwd();
312
- const configPath = findConfigFile(root);
313
- let parsedConfig = {};
314
- if (configPath) {
315
- const ext = _path.extname.call(void 0, configPath).toLowerCase();
316
- if (ext === ".json") {
317
- let content;
318
- try {
319
- content = _fs.readFileSync.call(void 0, configPath, "utf8");
320
- } catch (err) {
321
- throw new (0, _chunkR6EBIR3Tcjs.UnpeekError)(
322
- "ERR_CONFIG_LOAD",
323
- `Failed to read configuration at "${configPath}": ${formatErr(err)}`,
324
- { cause: err }
325
- );
326
- }
327
- parsedConfig = parseJsonConfig(content, configPath);
328
- } else {
329
- let raw;
330
- try {
331
- const req = _module.createRequire.call(void 0, configPath);
332
- raw = unwrapDefaultExport(req(configPath));
333
- if (typeof raw === "function") {
334
- raw = raw();
335
- }
336
- } catch (err) {
337
- const errCode = isRecord(err) ? err.code : void 0;
338
- if (errCode === "ERR_REQUIRE_ESM") {
339
- throw new (0, _chunkR6EBIR3Tcjs.UnpeekError)(
340
- "ERR_CONFIG_LOAD",
341
- `Synchronous loading of ESM configuration "${configPath}" is not supported by Node.js require(). Use loadUnpeekConfig() or CommonJS/JSON config format instead.`,
342
- { cause: err }
343
- );
344
- }
345
- throw new (0, _chunkR6EBIR3Tcjs.UnpeekError)(
346
- "ERR_CONFIG_LOAD",
347
- `Failed to load configuration at "${configPath}": ${formatErr(err)}`,
348
- { cause: err }
349
- );
350
- }
351
- parsedConfig = validateAndNormalizeConfig(_nullishCoalesce(raw, () => ( {})), configPath);
352
- }
353
- }
354
- const baseConfig = mergeUnpeekConfig(DEFAULT_CONFIG, parsedConfig);
355
- return explicitConfig ? mergeUnpeekConfig(baseConfig, explicitConfig) : baseConfig;
356
- }
324
+
325
+ // src/config.ts
357
326
  function defineConfig(config) {
358
327
  return config;
359
328
  }
@@ -361,10 +330,4 @@ function defineConfig(config) {
361
330
 
362
331
 
363
332
 
364
-
365
-
366
-
367
-
368
-
369
-
370
- exports.CONFIG_CANDIDATES = CONFIG_CANDIDATES; exports.DEFAULT_CONFIG = DEFAULT_CONFIG; exports.normalizeConfig = normalizeConfig; exports.mergeUnpeekConfig = mergeUnpeekConfig; exports.findConfigFile = findConfigFile; exports.loadUnpeekConfig = loadUnpeekConfig; exports.resolveUnpeekConfigSync = resolveUnpeekConfigSync; exports.defineConfig = defineConfig;
333
+ exports.loadUnpeekConfig = loadUnpeekConfig; exports.defineConfig = defineConfig;
@@ -1,25 +1,23 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkLXP73HJCcjs = require('./chunk-LXP73HJC.cjs');
4
3
 
5
4
 
6
5
 
6
+ var _chunkIAD5DV3Dcjs = require('./chunk-IAD5DV3D.cjs');
7
7
 
8
- var _chunk6N6S6WTQcjs = require('./chunk-6N6S6WTQ.cjs');
9
-
10
- // src/bundler/unplugin.ts
8
+ // src/plugins/unplugin.ts
11
9
  var _unplugin = require('unplugin');
12
10
  var ENTRY_CHUNK_PATTERN = /(?:^|\/)(?:webpack|main|index|runtime|turbopack|pages\/_app|pages\/index)(?:[-._/]|$)/i;
13
11
  var unpeekPlugin = _unplugin.createUnplugin.call(void 0, (options = {}) => {
14
- const config = _nullishCoalesce(options.config, () => ( ("framework" in options || "target" in options || "vault" in options || "hotPath" in options || "mangler" in options || "shield" in options || "sourcemaps" in options ? options : void 0)));
12
+ const config = options.config;
15
13
  const baseSeed = typeof options.seed === "number" ? options.seed : Math.floor(Math.random() * 2147483647) || 322420463;
16
14
  const deterrentMode = _nullishCoalesce(_nullishCoalesce(options.deterrentMode, () => ( _optionalChain([config, 'optionalAccess', _ => _.shield, 'optionalAccess', _2 => _2.deterrentMode]))), () => ( "passive"));
17
15
  const detectHeadless = _nullishCoalesce(_nullishCoalesce(options.detectHeadless, () => ( _optionalChain([config, 'optionalAccess', _3 => _3.shield, 'optionalAccess', _4 => _4.detectHeadless]))), () => ( false));
18
16
  const injectRuntimeShield = _nullishCoalesce(options.injectRuntimeShield, () => ( true));
19
17
  const minStringLength = _nullishCoalesce(_nullishCoalesce(options.minStringLength, () => ( _optionalChain([config, 'optionalAccess', _5 => _5.vault, 'optionalAccess', _6 => _6.minStringLength]))), () => ( 4));
20
18
  const aggressive = _nullishCoalesce(options.aggressive, () => ( false));
21
- const masterSym = _chunk6N6S6WTQcjs.deriveWindowKeySymbol.call(void 0, baseSeed);
22
- const masterShield = injectRuntimeShield ? _chunk6N6S6WTQcjs.generateRuntimeShield.call(void 0, {
19
+ const masterSym = _chunkIAD5DV3Dcjs.deriveWindowKeySymbol.call(void 0, baseSeed);
20
+ const masterShield = injectRuntimeShield ? _chunkIAD5DV3Dcjs.generateRuntimeShield.call(void 0, {
23
21
  seed: baseSeed,
24
22
  deterrentMode,
25
23
  detectHeadless,
@@ -38,7 +36,7 @@ var unpeekPlugin = _unplugin.createUnplugin.call(void 0, (options = {}) => {
38
36
  }
39
37
  const isEntry = chunk.isEntry !== void 0 ? chunk.isEntry : ENTRY_CHUNK_PATTERN.test(normalizedFileName);
40
38
  const shouldInjectShield = injectRuntimeShield && isEntry;
41
- const chunkSeed = _chunk6N6S6WTQcjs.computeFnv1aHash.call(void 0, chunk.fileName, baseSeed);
39
+ const chunkSeed = _chunkIAD5DV3Dcjs.computeFnv1aHash.call(void 0, chunk.fileName, baseSeed);
42
40
  const transformOptions = {
43
41
  seed: chunkSeed,
44
42
  minStringLength,
@@ -53,7 +51,7 @@ var unpeekPlugin = _unplugin.createUnplugin.call(void 0, (options = {}) => {
53
51
  aggressive,
54
52
  config
55
53
  };
56
- const result = _chunkLXP73HJCcjs.transformJavaScript.call(void 0, code, transformOptions);
54
+ const result = _chunkIAD5DV3Dcjs.transformJavaScript.call(void 0, code, transformOptions);
57
55
  let finalCode = result.code;
58
56
  const integrityCheckFnName = masterShield && "integrityCheckFnName" in masterShield ? masterShield.integrityCheckFnName : void 0;
59
57
  if (shouldInjectShield && _optionalChain([masterShield, 'optionalAccess', _8 => _8.preambleCode]) && !finalCode.includes("__unpeek_tampered") && !finalCode.includes("(function _u$") && (!integrityCheckFnName || !finalCode.includes(integrityCheckFnName)) && !finalCode.startsWith(masterShield.preambleCode)) {
@@ -71,6 +69,7 @@ var vitePlugin = unpeekPlugin.vite;
71
69
  var webpackPlugin = unpeekPlugin.webpack;
72
70
  var rollupPlugin = unpeekPlugin.rollup;
73
71
  var esbuildPlugin = unpeekPlugin.esbuild;
72
+ var rspackPlugin = unpeekPlugin.rspack;
74
73
  var unplugin_default = unpeekPlugin;
75
74
 
76
75
 
@@ -80,4 +79,5 @@ var unplugin_default = unpeekPlugin;
80
79
 
81
80
 
82
81
 
83
- exports.unpeekPlugin = unpeekPlugin; exports.vitePlugin = vitePlugin; exports.webpackPlugin = webpackPlugin; exports.rollupPlugin = rollupPlugin; exports.esbuildPlugin = esbuildPlugin; exports.unplugin_default = unplugin_default;
82
+
83
+ exports.unpeekPlugin = unpeekPlugin; exports.vitePlugin = vitePlugin; exports.webpackPlugin = webpackPlugin; exports.rollupPlugin = rollupPlugin; exports.esbuildPlugin = esbuildPlugin; exports.rspackPlugin = rspackPlugin; exports.unplugin_default = unplugin_default;