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.
- package/README.md +30 -8
- package/README.tr.md +30 -8
- package/dist/adapters/esbuild.cjs +13 -0
- package/dist/{esbuild.d.cts → adapters/esbuild.d.cts} +2 -2
- package/dist/{esbuild.d.ts → adapters/esbuild.d.ts} +2 -2
- package/dist/adapters/esbuild.js +11 -0
- package/dist/adapters/next/adapter.cjs +42 -0
- package/dist/{next → adapters/next}/adapter.d.cts +4 -4
- package/dist/{next → adapters/next}/adapter.d.ts +4 -4
- package/dist/adapters/next/adapter.js +42 -0
- package/dist/adapters/next/index.cjs +15 -0
- package/dist/adapters/next/index.d.cts +53 -0
- package/dist/adapters/next/index.d.ts +53 -0
- package/dist/adapters/next/index.js +15 -0
- package/dist/adapters/rollup.cjs +13 -0
- package/dist/{rollup.d.cts → adapters/rollup.d.cts} +2 -2
- package/dist/{rollup.d.ts → adapters/rollup.d.ts} +2 -2
- package/dist/adapters/rollup.js +11 -0
- package/dist/adapters/rspack.cjs +12 -0
- package/dist/adapters/rspack.d.cts +13 -0
- package/dist/adapters/rspack.d.ts +11 -0
- package/dist/adapters/rspack.js +12 -0
- package/dist/adapters/vite.cjs +13 -0
- package/dist/{vite.d.cts → adapters/vite.d.cts} +2 -2
- package/dist/{vite.d.ts → adapters/vite.d.ts} +2 -2
- package/dist/adapters/vite.js +11 -0
- package/dist/adapters/webpack.cjs +13 -0
- package/dist/{webpack.d.cts → adapters/webpack.d.cts} +2 -2
- package/dist/{webpack.d.ts → adapters/webpack.d.ts} +2 -2
- package/dist/adapters/webpack.js +11 -0
- package/dist/browser.cjs +8 -5
- package/dist/browser.d.cts +41 -3
- package/dist/browser.d.ts +41 -3
- package/dist/browser.js +10 -7
- package/dist/{chunk-GAVI2C44.cjs → chunk-6TDCSIRZ.cjs} +76 -47
- package/dist/{chunk-5LCMI2TL.js → chunk-APWMNVAZ.js} +221 -32
- package/dist/{chunk-5QD6FZPB.js → chunk-BPRSCRUZ.js} +71 -42
- package/dist/{chunk-X5MKMFMX.js → chunk-DUK2SECY.js} +7 -7
- package/dist/chunk-FCF2EGPM.js +80 -0
- package/dist/{chunk-7YVEHJVM.cjs → chunk-I6GXEHFR.cjs} +241 -52
- package/dist/{chunk-LXP73HJC.cjs → chunk-IAD5DV3D.cjs} +1048 -213
- package/dist/chunk-IEBVL5BT.cjs +80 -0
- package/dist/{chunk-GZB7PFLY.js → chunk-IICVBTR2.js} +25 -62
- package/dist/{chunk-UMPUYLLZ.js → chunk-IZIWDJRF.js} +936 -101
- package/dist/chunk-L6BOM5VS.cjs +40 -0
- package/dist/{chunk-OOXSZTRV.js → chunk-LA6J3BT3.js} +26 -1
- package/dist/{chunk-24K5NDXH.cjs → chunk-ONM2CSTU.cjs} +45 -82
- package/dist/{chunk-5M6Z7ZFT.cjs → chunk-RXUY3MPH.cjs} +10 -10
- package/dist/cli/index.js +7309 -32
- package/dist/{types-BBSRUEab.d.cts → config-CfXY_iDD.d.cts} +44 -86
- package/dist/{types-BBSRUEab.d.ts → config-CfXY_iDD.d.ts} +44 -86
- package/dist/config.cjs +4 -16
- package/dist/config.d.cts +1 -12
- package/dist/config.d.ts +1 -12
- package/dist/config.js +5 -17
- package/dist/index-CjRTNPlj.d.cts +46 -0
- package/dist/index-Cm1IloVm.d.ts +46 -0
- package/dist/index.cjs +636 -9
- package/dist/index.d.cts +9 -17
- package/dist/index.d.ts +9 -17
- package/dist/index.js +638 -11
- package/dist/plugins/unplugin.cjs +20 -0
- package/dist/plugins/unplugin.d.cts +17 -0
- package/dist/plugins/unplugin.d.ts +15 -0
- package/dist/{bundler → plugins}/unplugin.js +5 -5
- package/dist/types-DYQIzGf6.d.cts +112 -0
- package/dist/types-ZHAFdOd3.d.ts +112 -0
- package/package.json +48 -52
- package/dist/ast/index.cjs +0 -17
- package/dist/ast/index.d.cts +0 -18
- package/dist/ast/index.d.ts +0 -18
- package/dist/ast/index.js +0 -17
- package/dist/bundler/unplugin.cjs +0 -20
- package/dist/bundler/unplugin.d.cts +0 -16
- package/dist/bundler/unplugin.d.ts +0 -14
- package/dist/chunk-27HR647Q.js +0 -190
- package/dist/chunk-4TDLLEEU.cjs +0 -15
- package/dist/chunk-6N6S6WTQ.cjs +0 -423
- package/dist/chunk-J5CGNZDM.cjs +0 -190
- package/dist/chunk-KQWNFKT2.js +0 -423
- package/dist/chunk-R6EBIR3T.cjs +0 -14
- package/dist/chunk-S4S2WXGC.js +0 -14
- package/dist/cli/index.cjs +0 -324
- package/dist/cli/index.d.cts +0 -22
- package/dist/cli/index.d.ts +0 -22
- package/dist/esbuild.cjs +0 -15
- package/dist/esbuild.js +0 -13
- package/dist/next/adapter.cjs +0 -31
- package/dist/next/adapter.js +0 -31
- package/dist/next/index.cjs +0 -18
- package/dist/next/index.d.cts +0 -42
- package/dist/next/index.d.ts +0 -42
- package/dist/next/index.js +0 -18
- package/dist/rollup.cjs +0 -15
- package/dist/rollup.js +0 -13
- package/dist/runtime/index.cjs +0 -17
- package/dist/runtime/index.d.cts +0 -36
- package/dist/runtime/index.d.ts +0 -36
- package/dist/runtime/index.js +0 -17
- package/dist/vite.cjs +0 -15
- package/dist/vite.js +0 -13
- package/dist/webpack.cjs +0 -15
- package/dist/webpack.js +0 -13
package/dist/index.cjs
CHANGED
|
@@ -1,26 +1,653 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
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 _chunkJ5CGNZDMcjs = require('./chunk-J5CGNZDM.cjs');
|
|
4
3
|
|
|
5
4
|
|
|
6
|
-
var _chunk7YVEHJVMcjs = require('./chunk-7YVEHJVM.cjs');
|
|
7
5
|
|
|
8
6
|
|
|
9
7
|
|
|
10
|
-
var _chunk24K5NDXHcjs = require('./chunk-24K5NDXH.cjs');
|
|
11
8
|
|
|
9
|
+
var _chunkI6GXEHFRcjs = require('./chunk-I6GXEHFR.cjs');
|
|
12
10
|
|
|
13
|
-
var _chunkLXP73HJCcjs = require('./chunk-LXP73HJC.cjs');
|
|
14
|
-
require('./chunk-6N6S6WTQ.cjs');
|
|
15
11
|
|
|
16
12
|
|
|
17
|
-
var
|
|
18
|
-
require('./chunk-4TDLLEEU.cjs');
|
|
13
|
+
var _chunkONM2CSTUcjs = require('./chunk-ONM2CSTU.cjs');
|
|
19
14
|
|
|
20
15
|
|
|
16
|
+
var _chunkIEBVL5BTcjs = require('./chunk-IEBVL5BT.cjs');
|
|
21
17
|
|
|
22
18
|
|
|
19
|
+
var _chunkIAD5DV3Dcjs = require('./chunk-IAD5DV3D.cjs');
|
|
23
20
|
|
|
24
21
|
|
|
25
22
|
|
|
26
|
-
|
|
23
|
+
var _chunkL6BOM5VScjs = require('./chunk-L6BOM5VS.cjs');
|
|
24
|
+
|
|
25
|
+
// src/core/init.ts
|
|
26
|
+
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
27
|
+
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
28
|
+
function isPlainObject(val) {
|
|
29
|
+
return typeof val === "object" && val !== null && !Array.isArray(val);
|
|
30
|
+
}
|
|
31
|
+
function detectIndentation(rawJson) {
|
|
32
|
+
const match = rawJson.match(/^[ \t]+(?=["{\[])/m);
|
|
33
|
+
if (!match) return 2;
|
|
34
|
+
const indent = match[0];
|
|
35
|
+
if (indent.includes(" ")) return " ";
|
|
36
|
+
return indent.length;
|
|
37
|
+
}
|
|
38
|
+
var NEXT_CONFIG_FILES = ["next.config.ts", "next.config.mjs", "next.config.js", "next.config.cjs"];
|
|
39
|
+
function wireNextConfig(rootDir, dryRun) {
|
|
40
|
+
let targetFile;
|
|
41
|
+
for (const f of NEXT_CONFIG_FILES) {
|
|
42
|
+
if (_fs2.default.existsSync(_path2.default.join(rootDir, f))) {
|
|
43
|
+
targetFile = f;
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (!targetFile) {
|
|
48
|
+
const defaultMjs = `import { withUnpeek } from 'unpeek/next';
|
|
49
|
+
|
|
50
|
+
/** @type {import('next').NextConfig} */
|
|
51
|
+
const nextConfig = {};
|
|
52
|
+
|
|
53
|
+
export default withUnpeek(nextConfig);
|
|
54
|
+
`;
|
|
55
|
+
if (!dryRun) {
|
|
56
|
+
_fs2.default.writeFileSync(_path2.default.join(rootDir, "next.config.mjs"), defaultMjs, "utf8");
|
|
57
|
+
}
|
|
58
|
+
return { updated: true, filename: "next.config.mjs" };
|
|
59
|
+
}
|
|
60
|
+
const filePath = _path2.default.join(rootDir, targetFile);
|
|
61
|
+
const content = _fs2.default.readFileSync(filePath, "utf8");
|
|
62
|
+
if (content.includes("withUnpeek")) {
|
|
63
|
+
return { updated: false, filename: targetFile };
|
|
64
|
+
}
|
|
65
|
+
const isCjs = targetFile.endsWith(".cjs") || targetFile.endsWith(".js") && !content.includes("import ") && !content.includes("export ");
|
|
66
|
+
let modified = content;
|
|
67
|
+
if (isCjs) {
|
|
68
|
+
const importStmt = `const { withUnpeek } = require('unpeek/next');
|
|
69
|
+
`;
|
|
70
|
+
modified = `${importStmt}${modified}`;
|
|
71
|
+
if (/module\.exports\s*=\s*([a-zA-Z0-9_$]+)\s*;?/.test(modified)) {
|
|
72
|
+
modified = modified.replace(/module\.exports\s*=\s*([a-zA-Z0-9_$]+)\s*;?/, "module.exports = withUnpeek($1);");
|
|
73
|
+
} else if (/module\.exports\s*=\s*/.test(modified)) {
|
|
74
|
+
modified = modified.replace(/module\.exports\s*=\s*([\s\S]+?);?\s*$/, "module.exports = withUnpeek($1);");
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
const importStmt = `import { withUnpeek } from 'unpeek/next';
|
|
78
|
+
`;
|
|
79
|
+
modified = `${importStmt}${modified}`;
|
|
80
|
+
if (/export\s+default\s+([a-zA-Z0-9_$]+)\s*;?/.test(modified)) {
|
|
81
|
+
modified = modified.replace(/export\s+default\s+([a-zA-Z0-9_$]+)\s*;?/, "export default withUnpeek($1);");
|
|
82
|
+
} else if (/export\s+default\s+/.test(modified)) {
|
|
83
|
+
modified = modified.replace(/export\s+default\s+([\s\S]+?);?\s*$/, "export default withUnpeek($1);");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (!dryRun && modified !== content) {
|
|
87
|
+
_fs2.default.writeFileSync(filePath, modified, "utf8");
|
|
88
|
+
}
|
|
89
|
+
return { updated: modified !== content, filename: targetFile };
|
|
90
|
+
}
|
|
91
|
+
function initProject(cwd = process.cwd(), options = {}) {
|
|
92
|
+
const dryRun = typeof options === "boolean" ? options : _nullishCoalesce(options.dryRun, () => ( false));
|
|
93
|
+
const rootDir = _path2.default.resolve(cwd);
|
|
94
|
+
const { framework } = _chunkI6GXEHFRcjs.detectTargetFramework.call(void 0, rootDir);
|
|
95
|
+
const pkgPath = _path2.default.join(rootDir, "package.json");
|
|
96
|
+
let updatedPackageJson = false;
|
|
97
|
+
let updatedGitignore = false;
|
|
98
|
+
let updatedNextConfig = false;
|
|
99
|
+
let isNext16 = false;
|
|
100
|
+
let nextVersion;
|
|
101
|
+
let pkg = {};
|
|
102
|
+
let rawPkgContent = "";
|
|
103
|
+
if (_fs2.default.existsSync(pkgPath)) {
|
|
104
|
+
rawPkgContent = _fs2.default.readFileSync(pkgPath, "utf8");
|
|
105
|
+
let parsed;
|
|
106
|
+
try {
|
|
107
|
+
parsed = JSON.parse(rawPkgContent);
|
|
108
|
+
} catch (err) {
|
|
109
|
+
throw new (0, _chunkL6BOM5VScjs.UnpeekError)(
|
|
110
|
+
"ERR_INIT_INVALID_PACKAGE_JSON",
|
|
111
|
+
`Invalid JSON in package.json at "${pkgPath}": ${err instanceof Error ? err.message : String(err)}`,
|
|
112
|
+
{ cause: err }
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
if (!isPlainObject(parsed)) {
|
|
116
|
+
throw new (0, _chunkL6BOM5VScjs.UnpeekError)(
|
|
117
|
+
"ERR_INIT_INVALID_PACKAGE_JSON",
|
|
118
|
+
`package.json at "${pkgPath}" must contain a JSON object.`
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
pkg = parsed;
|
|
122
|
+
const deps = isPlainObject(pkg.dependencies) ? pkg.dependencies : void 0;
|
|
123
|
+
const devDeps = isPlainObject(pkg.devDependencies) ? pkg.devDependencies : void 0;
|
|
124
|
+
const rawNext = _nullishCoalesce(_optionalChain([deps, 'optionalAccess', _ => _.next]), () => ( _optionalChain([devDeps, 'optionalAccess', _2 => _2.next])));
|
|
125
|
+
nextVersion = typeof rawNext === "string" ? rawNext : void 0;
|
|
126
|
+
}
|
|
127
|
+
if (framework === "nextjs" && _chunkI6GXEHFRcjs.isNext16OrAbove.call(void 0, nextVersion)) {
|
|
128
|
+
isNext16 = true;
|
|
129
|
+
const configRes = wireNextConfig(rootDir, dryRun);
|
|
130
|
+
updatedNextConfig = configRes.updated;
|
|
131
|
+
} else if (_fs2.default.existsSync(pkgPath)) {
|
|
132
|
+
const indent = detectIndentation(rawPkgContent);
|
|
133
|
+
const trailingNewline = rawPkgContent.endsWith("\r\n") ? "\r\n" : rawPkgContent.endsWith("\n") ? "\n" : "";
|
|
134
|
+
const scripts = isPlainObject(pkg.scripts) ? { ...pkg.scripts } : {};
|
|
135
|
+
pkg.scripts = scripts;
|
|
136
|
+
const existingPostbuild = typeof scripts.postbuild === "string" ? scripts.postbuild : void 0;
|
|
137
|
+
if (!existingPostbuild) {
|
|
138
|
+
scripts.postbuild = "unpeek protect";
|
|
139
|
+
updatedPackageJson = true;
|
|
140
|
+
} else if (!existingPostbuild.includes("unpeek protect")) {
|
|
141
|
+
scripts.postbuild = `${existingPostbuild.trim()} && unpeek protect`;
|
|
142
|
+
updatedPackageJson = true;
|
|
143
|
+
}
|
|
144
|
+
if (updatedPackageJson && !dryRun) {
|
|
145
|
+
_fs2.default.writeFileSync(pkgPath, `${JSON.stringify(pkg, null, indent)}${trailingNewline}`, "utf8");
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
const gitignorePath = _path2.default.join(rootDir, ".gitignore");
|
|
149
|
+
if (_fs2.default.existsSync(gitignorePath)) {
|
|
150
|
+
const current = _fs2.default.readFileSync(gitignorePath, "utf8");
|
|
151
|
+
const lines = current.split(/\r?\n/).map((line) => line.trim());
|
|
152
|
+
if (!lines.includes(".unpeek-maps/") && !lines.includes(".unpeek-maps")) {
|
|
153
|
+
const prefix = current.length > 0 && !current.endsWith("\n") ? "\n" : "";
|
|
154
|
+
if (!dryRun) {
|
|
155
|
+
_fs2.default.writeFileSync(gitignorePath, `${current}${prefix}.unpeek-maps/
|
|
156
|
+
`, "utf8");
|
|
157
|
+
}
|
|
158
|
+
updatedGitignore = true;
|
|
159
|
+
}
|
|
160
|
+
} else {
|
|
161
|
+
if (!dryRun) {
|
|
162
|
+
_fs2.default.writeFileSync(gitignorePath, ".unpeek-maps/\n", "utf8");
|
|
163
|
+
}
|
|
164
|
+
updatedGitignore = true;
|
|
165
|
+
}
|
|
166
|
+
let message;
|
|
167
|
+
if (isNext16) {
|
|
168
|
+
if (dryRun) {
|
|
169
|
+
message = `[dry-run] Detected Next.js 16.2+ (${nextVersion}). Would configure withUnpeek adapter in next.config and .unpeek-maps/ vault.`;
|
|
170
|
+
} else if (updatedNextConfig || updatedGitignore) {
|
|
171
|
+
message = `Detected Next.js 16.2+ (${nextVersion}). Initialized unpeek: configured withUnpeek adapter in next.config and .unpeek-maps/ vault.`;
|
|
172
|
+
} else {
|
|
173
|
+
message = `Detected Next.js 16.2+ (${nextVersion}). unpeek is already initialized in this project.`;
|
|
174
|
+
}
|
|
175
|
+
} else {
|
|
176
|
+
if (dryRun) {
|
|
177
|
+
message = `[dry-run] Detected framework: ${framework}. Would configure postbuild hook and .unpeek-maps/ vault.`;
|
|
178
|
+
} else if (updatedPackageJson || updatedGitignore) {
|
|
179
|
+
message = `Detected framework: ${framework}. Initialized unpeek: configured postbuild hook and .unpeek-maps/ vault.`;
|
|
180
|
+
} else {
|
|
181
|
+
message = `Detected framework: ${framework}. unpeek is already initialized in this project.`;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return {
|
|
185
|
+
updatedPackageJson,
|
|
186
|
+
updatedGitignore,
|
|
187
|
+
updatedNextConfig,
|
|
188
|
+
framework,
|
|
189
|
+
isNext162Plus: isNext16,
|
|
190
|
+
message
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// src/core/check.ts
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
var _acorn = require('acorn'); var acorn = _interopRequireWildcard(_acorn);
|
|
198
|
+
var _acornwalk = require('acorn-walk');
|
|
199
|
+
function walkPublicMaps(currentDir, rootOutDir, found) {
|
|
200
|
+
if (_chunkI6GXEHFRcjs.hasNextServerSegment.call(void 0, currentDir, rootOutDir)) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
let entries;
|
|
204
|
+
try {
|
|
205
|
+
entries = _fs2.default.readdirSync(currentDir, { withFileTypes: true });
|
|
206
|
+
} catch (e) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
for (const entry of entries) {
|
|
210
|
+
const fullPath = _path2.default.join(currentDir, entry.name);
|
|
211
|
+
if (entry.isDirectory()) {
|
|
212
|
+
if (entry.name === "node_modules" || entry.name === ".unpeek-maps") {
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
if (_chunkI6GXEHFRcjs.hasNextServerSegment.call(void 0, fullPath, rootOutDir)) {
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
walkPublicMaps(fullPath, rootOutDir, found);
|
|
219
|
+
} else if (entry.isFile() && entry.name.endsWith(".map")) {
|
|
220
|
+
found.push(fullPath);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
function hasIgnoreEntry(filePath, ignoreEntry) {
|
|
225
|
+
try {
|
|
226
|
+
const content = _fs2.default.readFileSync(filePath, "utf8");
|
|
227
|
+
const normalizedEntry = ignoreEntry.endsWith("/") ? ignoreEntry : `${ignoreEntry}/`;
|
|
228
|
+
const bareEntry = normalizedEntry.slice(0, -1);
|
|
229
|
+
const lines = content.split(/\r?\n/).map((line) => line.trim());
|
|
230
|
+
return lines.includes(normalizedEntry) || lines.includes(bareEntry) || lines.includes(".unpeek-maps") || lines.includes(".unpeek-maps/");
|
|
231
|
+
} catch (e2) {
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
function findEvalOrFunctionCalls(code) {
|
|
236
|
+
const hits = [];
|
|
237
|
+
let ast;
|
|
238
|
+
try {
|
|
239
|
+
ast = acorn.parse(code, {
|
|
240
|
+
ecmaVersion: "latest",
|
|
241
|
+
sourceType: "module",
|
|
242
|
+
allowReturnOutsideFunction: true
|
|
243
|
+
});
|
|
244
|
+
} catch (e3) {
|
|
245
|
+
try {
|
|
246
|
+
ast = acorn.parse(code, {
|
|
247
|
+
ecmaVersion: "latest",
|
|
248
|
+
sourceType: "script",
|
|
249
|
+
allowReturnOutsideFunction: true
|
|
250
|
+
});
|
|
251
|
+
} catch (e4) {
|
|
252
|
+
return hits;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
_acornwalk.simple.call(void 0, ast, {
|
|
256
|
+
CallExpression(node) {
|
|
257
|
+
if (node.callee.type === "Identifier") {
|
|
258
|
+
if (node.callee.name === "eval") {
|
|
259
|
+
hits.push("eval(...)");
|
|
260
|
+
} else if (node.callee.name === "Function") {
|
|
261
|
+
hits.push("Function(...)");
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
NewExpression(node) {
|
|
266
|
+
if (node.callee.type === "Identifier" && node.callee.name === "Function") {
|
|
267
|
+
hits.push("new Function(...)");
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
return Array.from(new Set(hits));
|
|
272
|
+
}
|
|
273
|
+
async function checkProject(options = {}) {
|
|
274
|
+
const cwd = _path2.default.resolve(_nullishCoalesce(options.cwd, () => ( process.cwd())));
|
|
275
|
+
const config = await _chunkONM2CSTUcjs.loadUnpeekConfig.call(void 0, cwd);
|
|
276
|
+
const { outDir } = _chunkI6GXEHFRcjs.detectTargetFramework.call(void 0, cwd, options.outDir, config);
|
|
277
|
+
const resolvedOutDir = _path2.default.resolve(outDir);
|
|
278
|
+
const privateMapsDir = _nullishCoalesce(_nullishCoalesce(options.privateMapsDir, () => ( _optionalChain([config, 'access', _3 => _3.sourcemaps, 'optionalAccess', _4 => _4.vaultDir]))), () => ( ".unpeek-maps"));
|
|
279
|
+
const maxGzipDelta = _nullishCoalesce(options.maxGzipDelta, () => ( 15));
|
|
280
|
+
const requireZeroEval = Boolean(options.requireZeroEval || options.strictCsp);
|
|
281
|
+
const violations = [];
|
|
282
|
+
const warnings = [];
|
|
283
|
+
const publicMaps = [];
|
|
284
|
+
if (_fs2.default.existsSync(resolvedOutDir)) {
|
|
285
|
+
walkPublicMaps(resolvedOutDir, resolvedOutDir, publicMaps);
|
|
286
|
+
}
|
|
287
|
+
for (const mapFile of publicMaps) {
|
|
288
|
+
const rel = _path2.default.relative(resolvedOutDir, mapFile).replace(/\\/g, "/");
|
|
289
|
+
violations.push({
|
|
290
|
+
rule: "public-map",
|
|
291
|
+
severity: "error",
|
|
292
|
+
message: `Public source map exposed in client output: "${rel}".`,
|
|
293
|
+
file: rel
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
const clientFiles = _chunkI6GXEHFRcjs.scanClientBundles.call(void 0, resolvedOutDir, config);
|
|
297
|
+
for (const filePath of clientFiles) {
|
|
298
|
+
const rel = _path2.default.relative(resolvedOutDir, filePath).replace(/\\/g, "/");
|
|
299
|
+
let content;
|
|
300
|
+
try {
|
|
301
|
+
content = _fs2.default.readFileSync(filePath, "utf8");
|
|
302
|
+
} catch (e5) {
|
|
303
|
+
continue;
|
|
304
|
+
}
|
|
305
|
+
_chunkI6GXEHFRcjs.SOURCE_MAP_COMMENT_REGEX.lastIndex = 0;
|
|
306
|
+
if (_chunkI6GXEHFRcjs.SOURCE_MAP_COMMENT_REGEX.test(content)) {
|
|
307
|
+
violations.push({
|
|
308
|
+
rule: "sourcemap-comment",
|
|
309
|
+
severity: "error",
|
|
310
|
+
message: `Residual sourceMappingURL comment found in "${rel}".`,
|
|
311
|
+
file: rel
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
const evalHits = findEvalOrFunctionCalls(content);
|
|
315
|
+
if (evalHits.length > 0) {
|
|
316
|
+
const violation = {
|
|
317
|
+
rule: "eval-csp",
|
|
318
|
+
severity: requireZeroEval ? "error" : "warning",
|
|
319
|
+
message: `Dynamic code evaluation (${evalHits.join(", ")}) detected in "${rel}".`,
|
|
320
|
+
file: rel
|
|
321
|
+
};
|
|
322
|
+
if (requireZeroEval) {
|
|
323
|
+
violations.push(violation);
|
|
324
|
+
} else {
|
|
325
|
+
warnings.push(violation);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
const vaultDir = _path2.default.resolve(cwd, privateMapsDir);
|
|
330
|
+
const relVault = _path2.default.relative(cwd, vaultDir).replace(/\\/g, "/");
|
|
331
|
+
const ignoreEntry = relVault && !relVault.startsWith("..") ? `${relVault}/` : ".unpeek-maps/";
|
|
332
|
+
const roots = _chunkI6GXEHFRcjs.findMonorepoRoots.call(void 0, cwd);
|
|
333
|
+
let foundGitignore = false;
|
|
334
|
+
let gitignoreProtected = false;
|
|
335
|
+
let foundDockerignore = false;
|
|
336
|
+
let dockerignoreProtected = false;
|
|
337
|
+
for (const root of roots) {
|
|
338
|
+
const gitignorePath = _path2.default.join(root, ".gitignore");
|
|
339
|
+
if (_fs2.default.existsSync(gitignorePath)) {
|
|
340
|
+
foundGitignore = true;
|
|
341
|
+
if (hasIgnoreEntry(gitignorePath, ignoreEntry)) {
|
|
342
|
+
gitignoreProtected = true;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
const dockerignorePath = _path2.default.join(root, ".dockerignore");
|
|
346
|
+
if (_fs2.default.existsSync(dockerignorePath)) {
|
|
347
|
+
foundDockerignore = true;
|
|
348
|
+
if (hasIgnoreEntry(dockerignorePath, ignoreEntry)) {
|
|
349
|
+
dockerignoreProtected = true;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
if (!foundGitignore || !gitignoreProtected) {
|
|
354
|
+
violations.push({
|
|
355
|
+
rule: "ignore-missing",
|
|
356
|
+
severity: "error",
|
|
357
|
+
message: `.gitignore is missing "${ignoreEntry}". Private source maps may be committed to Git.`
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
if (!foundDockerignore) {
|
|
361
|
+
warnings.push({
|
|
362
|
+
rule: "ignore-missing",
|
|
363
|
+
severity: "warning",
|
|
364
|
+
message: `.dockerignore not found. If using Docker, ensure "${ignoreEntry}" is excluded.`
|
|
365
|
+
});
|
|
366
|
+
} else if (!dockerignoreProtected) {
|
|
367
|
+
violations.push({
|
|
368
|
+
rule: "ignore-missing",
|
|
369
|
+
severity: "error",
|
|
370
|
+
message: `.dockerignore is missing "${ignoreEntry}". Private source maps may leak into Docker images.`
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
const manifestPath = _path2.default.join(vaultDir, "manifest.json");
|
|
374
|
+
if (_fs2.default.existsSync(manifestPath)) {
|
|
375
|
+
try {
|
|
376
|
+
const manifest = JSON.parse(_fs2.default.readFileSync(manifestPath, "utf8"));
|
|
377
|
+
if (typeof manifest.gzipDeltaPercent === "number" && manifest.gzipDeltaPercent > maxGzipDelta) {
|
|
378
|
+
violations.push({
|
|
379
|
+
rule: "gzip-budget",
|
|
380
|
+
severity: "error",
|
|
381
|
+
message: `Bundle Gzip delta (${manifest.gzipDeltaPercent}%) exceeds maxGzipDelta (${maxGzipDelta}%).`
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
} catch (e6) {
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
return {
|
|
388
|
+
passed: violations.length === 0,
|
|
389
|
+
outDir: resolvedOutDir,
|
|
390
|
+
checkedFiles: clientFiles.length,
|
|
391
|
+
violations,
|
|
392
|
+
warnings
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// src/core/vlq.ts
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
400
|
+
var BASE64_MAP = /* @__PURE__ */ new Map();
|
|
401
|
+
for (let i = 0; i < BASE64_CHARS.length; i++) {
|
|
402
|
+
BASE64_MAP.set(BASE64_CHARS[i], i);
|
|
403
|
+
}
|
|
404
|
+
var VLQ_BASE_SHIFT = 5;
|
|
405
|
+
var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
|
|
406
|
+
var VLQ_BASE_MASK = VLQ_BASE - 1;
|
|
407
|
+
var VLQ_CONTINUATION_BIT = VLQ_BASE;
|
|
408
|
+
function decodeVlq(segment, startIndex) {
|
|
409
|
+
let result = 0;
|
|
410
|
+
let shift = 0;
|
|
411
|
+
let index = startIndex;
|
|
412
|
+
while (index < segment.length) {
|
|
413
|
+
const digit = BASE64_MAP.get(segment[index]);
|
|
414
|
+
if (digit === void 0) {
|
|
415
|
+
return null;
|
|
416
|
+
}
|
|
417
|
+
index++;
|
|
418
|
+
const continuation = (digit & VLQ_CONTINUATION_BIT) !== 0;
|
|
419
|
+
result += (digit & VLQ_BASE_MASK) << shift;
|
|
420
|
+
shift += VLQ_BASE_SHIFT;
|
|
421
|
+
if (!continuation) {
|
|
422
|
+
const isNegative = (result & 1) === 1;
|
|
423
|
+
const shifted = result >> 1;
|
|
424
|
+
return {
|
|
425
|
+
value: isNegative ? -shifted : shifted,
|
|
426
|
+
nextIndex: index
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
if (shift > 30) {
|
|
430
|
+
return null;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
return null;
|
|
434
|
+
}
|
|
435
|
+
function decodeMappings(mappingsStr) {
|
|
436
|
+
const mappings = [];
|
|
437
|
+
let malformedCount = 0;
|
|
438
|
+
if (!mappingsStr) {
|
|
439
|
+
return { mappings, malformedCount };
|
|
440
|
+
}
|
|
441
|
+
let sourceIndex = 0;
|
|
442
|
+
let originalLine = 0;
|
|
443
|
+
let originalColumn = 0;
|
|
444
|
+
let nameIndex = 0;
|
|
445
|
+
const lines = mappingsStr.split(";");
|
|
446
|
+
for (let genLine = 0; genLine < lines.length; genLine++) {
|
|
447
|
+
const lineStr = lines[genLine];
|
|
448
|
+
if (!lineStr) continue;
|
|
449
|
+
let genCol = 0;
|
|
450
|
+
const segments = lineStr.split(",");
|
|
451
|
+
for (const seg of segments) {
|
|
452
|
+
if (!seg) continue;
|
|
453
|
+
const values = [];
|
|
454
|
+
let idx = 0;
|
|
455
|
+
let valid = true;
|
|
456
|
+
while (idx < seg.length) {
|
|
457
|
+
const decoded = decodeVlq(seg, idx);
|
|
458
|
+
if (!decoded) {
|
|
459
|
+
valid = false;
|
|
460
|
+
break;
|
|
461
|
+
}
|
|
462
|
+
values.push(decoded.value);
|
|
463
|
+
idx = decoded.nextIndex;
|
|
464
|
+
}
|
|
465
|
+
if (!valid || values.length !== 1 && values.length !== 4 && values.length !== 5) {
|
|
466
|
+
malformedCount++;
|
|
467
|
+
continue;
|
|
468
|
+
}
|
|
469
|
+
genCol += values[0];
|
|
470
|
+
if (values.length >= 4) {
|
|
471
|
+
sourceIndex += values[1];
|
|
472
|
+
originalLine += values[2];
|
|
473
|
+
originalColumn += values[3];
|
|
474
|
+
const mapping = {
|
|
475
|
+
generatedLine: genLine,
|
|
476
|
+
generatedColumn: genCol,
|
|
477
|
+
sourceIndex,
|
|
478
|
+
originalLine,
|
|
479
|
+
originalColumn
|
|
480
|
+
};
|
|
481
|
+
if (values.length === 5) {
|
|
482
|
+
nameIndex += values[4];
|
|
483
|
+
mapping.nameIndex = nameIndex;
|
|
484
|
+
}
|
|
485
|
+
mappings.push(mapping);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
return { mappings, malformedCount };
|
|
490
|
+
}
|
|
491
|
+
function findMappingAt(mappings, line0, col0) {
|
|
492
|
+
let lo = 0;
|
|
493
|
+
let hi = mappings.length - 1;
|
|
494
|
+
let best;
|
|
495
|
+
while (lo <= hi) {
|
|
496
|
+
const mid = lo + hi >> 1;
|
|
497
|
+
const m = mappings[mid];
|
|
498
|
+
if (m.generatedLine < line0 || m.generatedLine === line0 && m.generatedColumn <= col0) {
|
|
499
|
+
if (m.generatedLine === line0) {
|
|
500
|
+
best = m;
|
|
501
|
+
}
|
|
502
|
+
lo = mid + 1;
|
|
503
|
+
} else {
|
|
504
|
+
hi = mid - 1;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
return best;
|
|
508
|
+
}
|
|
509
|
+
function resolvePosition(map, line1Based, column1Based) {
|
|
510
|
+
const { mappings, malformedCount } = decodeMappings(map.mappings);
|
|
511
|
+
const match = findMappingAt(mappings, Math.max(0, line1Based - 1), Math.max(0, column1Based - 1));
|
|
512
|
+
if (!match) {
|
|
513
|
+
return { malformedCount };
|
|
514
|
+
}
|
|
515
|
+
const rawSource = map.sources[match.sourceIndex];
|
|
516
|
+
const source = map.sourceRoot && rawSource && !rawSource.startsWith(map.sourceRoot) ? `${map.sourceRoot.replace(/\/$/, "")}/${rawSource.replace(/^\//, "")}` : rawSource;
|
|
517
|
+
return {
|
|
518
|
+
source,
|
|
519
|
+
line: match.originalLine + 1,
|
|
520
|
+
column: match.originalColumn + 1,
|
|
521
|
+
name: match.nameIndex !== void 0 ? map.names[match.nameIndex] : void 0,
|
|
522
|
+
malformedCount
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
function collectMapFiles(mapsDir) {
|
|
526
|
+
if (!_fs2.default.existsSync(mapsDir)) return [];
|
|
527
|
+
const results = [];
|
|
528
|
+
const walk = (dir) => {
|
|
529
|
+
let entries;
|
|
530
|
+
try {
|
|
531
|
+
entries = _fs2.default.readdirSync(dir, { withFileTypes: true });
|
|
532
|
+
} catch (e7) {
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
for (const entry of entries) {
|
|
536
|
+
const fullPath = _path2.default.join(dir, entry.name);
|
|
537
|
+
if (entry.isDirectory()) {
|
|
538
|
+
walk(fullPath);
|
|
539
|
+
} else if (entry.isFile() && entry.name.endsWith(".map")) {
|
|
540
|
+
results.push(fullPath);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
walk(mapsDir);
|
|
545
|
+
return results;
|
|
546
|
+
}
|
|
547
|
+
function findMatchingMapFile(fileRef, mapsDir, allMaps) {
|
|
548
|
+
let cleanRef = fileRef.trim();
|
|
549
|
+
try {
|
|
550
|
+
if (/^https?:\/\//i.test(cleanRef)) {
|
|
551
|
+
cleanRef = new URL(cleanRef).pathname;
|
|
552
|
+
}
|
|
553
|
+
} catch (e8) {
|
|
554
|
+
}
|
|
555
|
+
cleanRef = cleanRef.split("?")[0].split("#")[0].replace(/\\/g, "/").replace(/^\/+/, "");
|
|
556
|
+
const targetMapName = `${_path2.default.posix.basename(cleanRef)}.map`;
|
|
557
|
+
const exactCandidate = _path2.default.join(mapsDir, `${cleanRef}.map`);
|
|
558
|
+
if (_fs2.default.existsSync(exactCandidate)) {
|
|
559
|
+
return exactCandidate;
|
|
560
|
+
}
|
|
561
|
+
for (const mapPath of allMaps) {
|
|
562
|
+
const rel = _path2.default.relative(mapsDir, mapPath).replace(/\\/g, "/");
|
|
563
|
+
if (rel === `${cleanRef}.map` || rel.endsWith(`/${cleanRef}.map`) || cleanRef.endsWith(`/${rel.slice(0, -4)}`)) {
|
|
564
|
+
return mapPath;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
return allMaps.find((m) => _path2.default.basename(m) === targetMapName);
|
|
568
|
+
}
|
|
569
|
+
var STACK_FRAME_REGEX = /(?:at\s+(?:[^(]+\s+\()?|\@)([^\s()]+?):(\d+):(\d+)\)?/;
|
|
570
|
+
async function symbolicateStackTrace(options) {
|
|
571
|
+
const cwd = _path2.default.resolve(_nullishCoalesce(options.cwd, () => ( process.cwd())));
|
|
572
|
+
const mapsDir = _path2.default.resolve(cwd, _nullishCoalesce(options.mapsDir, () => ( ".unpeek-maps")));
|
|
573
|
+
const allMaps = collectMapFiles(mapsDir);
|
|
574
|
+
const warnings = [];
|
|
575
|
+
const mapCache = /* @__PURE__ */ new Map();
|
|
576
|
+
if (allMaps.length === 0) {
|
|
577
|
+
warnings.push(`No .map files found in "${mapsDir}".`);
|
|
578
|
+
}
|
|
579
|
+
const lines = options.stackTrace.split(/\r?\n/);
|
|
580
|
+
const frames = [];
|
|
581
|
+
const outputLines = [];
|
|
582
|
+
for (const rawLine of lines) {
|
|
583
|
+
const match = rawLine.match(STACK_FRAME_REGEX);
|
|
584
|
+
if (!match) {
|
|
585
|
+
frames.push({ raw: rawLine, resolved: false });
|
|
586
|
+
outputLines.push(rawLine);
|
|
587
|
+
continue;
|
|
588
|
+
}
|
|
589
|
+
const fileRef = match[1];
|
|
590
|
+
const lineNum = Number(match[2]);
|
|
591
|
+
const colNum = Number(match[3]);
|
|
592
|
+
const mapPath = findMatchingMapFile(fileRef, mapsDir, allMaps);
|
|
593
|
+
if (!mapPath) {
|
|
594
|
+
frames.push({ raw: rawLine, file: fileRef, line: lineNum, column: colNum, resolved: false });
|
|
595
|
+
outputLines.push(rawLine);
|
|
596
|
+
continue;
|
|
597
|
+
}
|
|
598
|
+
let parsedMap = mapCache.get(mapPath);
|
|
599
|
+
if (parsedMap === void 0) {
|
|
600
|
+
try {
|
|
601
|
+
parsedMap = JSON.parse(_fs2.default.readFileSync(mapPath, "utf8"));
|
|
602
|
+
} catch (e9) {
|
|
603
|
+
parsedMap = null;
|
|
604
|
+
warnings.push(`Failed to parse source map "${mapPath}".`);
|
|
605
|
+
}
|
|
606
|
+
mapCache.set(mapPath, parsedMap);
|
|
607
|
+
}
|
|
608
|
+
if (!parsedMap || typeof parsedMap.mappings !== "string" || !Array.isArray(parsedMap.sources)) {
|
|
609
|
+
frames.push({ raw: rawLine, file: fileRef, line: lineNum, column: colNum, resolved: false });
|
|
610
|
+
outputLines.push(rawLine);
|
|
611
|
+
continue;
|
|
612
|
+
}
|
|
613
|
+
const pos = resolvePosition(parsedMap, lineNum, colNum);
|
|
614
|
+
if (pos.malformedCount > 0) {
|
|
615
|
+
warnings.push(`Skipped ${pos.malformedCount} malformed VLQ segment(s) in "${_path2.default.basename(mapPath)}".`);
|
|
616
|
+
}
|
|
617
|
+
if (!pos.source || pos.line === void 0 || pos.column === void 0) {
|
|
618
|
+
frames.push({ raw: rawLine, file: fileRef, line: lineNum, column: colNum, resolved: false });
|
|
619
|
+
outputLines.push(rawLine);
|
|
620
|
+
continue;
|
|
621
|
+
}
|
|
622
|
+
frames.push({
|
|
623
|
+
raw: rawLine,
|
|
624
|
+
file: fileRef,
|
|
625
|
+
line: lineNum,
|
|
626
|
+
column: colNum,
|
|
627
|
+
originalSource: pos.source,
|
|
628
|
+
originalLine: pos.line,
|
|
629
|
+
originalColumn: pos.column,
|
|
630
|
+
originalName: pos.name,
|
|
631
|
+
resolved: true
|
|
632
|
+
});
|
|
633
|
+
const fnPrefix = pos.name ? `${pos.name} ` : "";
|
|
634
|
+
outputLines.push(` at ${fnPrefix}(${pos.source}:${pos.line}:${pos.column})`);
|
|
635
|
+
}
|
|
636
|
+
return {
|
|
637
|
+
stackTrace: outputLines.join("\n"),
|
|
638
|
+
frames,
|
|
639
|
+
warnings: Array.from(new Set(warnings))
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
exports.PRESETS = _chunkIEBVL5BTcjs.PRESETS; exports.UnpeekError = _chunkL6BOM5VScjs.UnpeekError; exports.checkProject = checkProject; exports.defineConfig = _chunkONM2CSTUcjs.defineConfig; exports.initProject = initProject; exports.isUnpeekError = _chunkL6BOM5VScjs.isUnpeekError; exports.loadUnpeekConfig = _chunkONM2CSTUcjs.loadUnpeekConfig; exports.protectProject = _chunkI6GXEHFRcjs.protectProject; exports.symbolicateStackTrace = symbolicateStackTrace; exports.transformJavaScript = _chunkIAD5DV3Dcjs.transformJavaScript;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
export {
|
|
1
|
+
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, S as ShieldConfig, d as ShieldOptionsConfig, a as ShieldPayload, e as SourcemapsConfig, U as UnpeekConfig, f as UnpeekFramework, g as UnpeekPluginOptions, h as UnpeekProfile, V as VaultConfig, i as ViteConfigOptions, j as defineConfig, l as loadUnpeekConfig } from './config-CfXY_iDD.cjs';
|
|
2
|
+
export { H as HotPathReport, 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';
|
|
3
|
+
import { I as InitOptions, b as InitResult, a as ProtectOptions, P as ProtectSummary, C as CheckOptions, c as CheckResult, S as SymbolicateOptions, d as SymbolicateResult } from './types-DYQIzGf6.cjs';
|
|
4
|
+
export { e as CheckViolation, f as SourceMapVaultResult, g as SymbolicateFrame, U as UnpeekDiagnostic, h as UnpeekDiagnosticSeverity } from './types-DYQIzGf6.cjs';
|
|
5
5
|
|
|
6
|
-
interface InitOptions {
|
|
7
|
-
dryRun?: boolean;
|
|
8
|
-
}
|
|
9
|
-
interface InitResult {
|
|
10
|
-
updatedPackageJson: boolean;
|
|
11
|
-
updatedGitignore: boolean;
|
|
12
|
-
updatedNextConfig?: boolean;
|
|
13
|
-
framework?: string;
|
|
14
|
-
isNext162Plus?: boolean;
|
|
15
|
-
message: string;
|
|
16
|
-
}
|
|
17
6
|
declare function initProject(cwd?: string, options?: InitOptions): InitResult;
|
|
18
7
|
/**
|
|
19
8
|
* @deprecated Pass an options object `{ dryRun: boolean }` instead of a boolean.
|
|
@@ -22,5 +11,8 @@ declare function initProject(cwd: string, dryRun: boolean): InitResult;
|
|
|
22
11
|
|
|
23
12
|
declare function protectProject(options?: ProtectOptions): Promise<ProtectSummary>;
|
|
24
13
|
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
declare function checkProject(options?: CheckOptions): Promise<CheckResult>;
|
|
15
|
+
|
|
16
|
+
declare function symbolicateStackTrace(options: SymbolicateOptions): Promise<SymbolicateResult>;
|
|
17
|
+
|
|
18
|
+
export { CheckOptions, CheckResult, InitOptions, InitResult, ProtectOptions, ProtectSummary, SymbolicateOptions, SymbolicateResult, checkProject, initProject, protectProject, symbolicateStackTrace };
|