unpeek 4.1.0 → 4.3.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 +7 -7
- package/README.tr.md +7 -7
- package/dist/adapters/esbuild.cjs +5 -5
- package/dist/adapters/esbuild.js +3 -3
- package/dist/adapters/next/adapter.cjs +5 -5
- package/dist/adapters/next/adapter.js +4 -4
- package/dist/adapters/next/index.cjs +5 -5
- package/dist/adapters/next/index.js +4 -4
- package/dist/adapters/rollup.cjs +5 -5
- package/dist/adapters/rollup.js +3 -3
- package/dist/adapters/rspack.cjs +5 -5
- package/dist/adapters/rspack.js +3 -3
- package/dist/adapters/vite.cjs +5 -5
- package/dist/adapters/vite.js +3 -3
- package/dist/adapters/webpack.cjs +5 -5
- package/dist/adapters/webpack.js +3 -3
- package/dist/browser.cjs +2 -2
- package/dist/browser.d.cts +3 -2
- package/dist/browser.d.ts +3 -2
- package/dist/browser.js +1 -1
- package/dist/{chunk-Q4DFRMAV.cjs → chunk-4IRIMLT3.cjs} +16 -16
- package/dist/{chunk-AD6UFBPA.cjs → chunk-4XSFPX2Z.cjs} +367 -8
- package/dist/{chunk-WYW5UOBE.cjs → chunk-7F75S3GQ.cjs} +60 -36
- package/dist/{chunk-HV47WJIR.js → chunk-EASD7C2B.js} +3 -3
- package/dist/{chunk-STTUFUDC.js → chunk-GKWTP4Z5.js} +30 -6
- package/dist/{chunk-VLL4THTG.cjs → chunk-OR5M3SN2.cjs} +2432 -636
- package/dist/{chunk-32GLSJAW.js → chunk-RDP4MTHK.js} +359 -0
- package/dist/{chunk-6KLUNEKE.js → chunk-RM3V7KJA.js} +2298 -502
- package/dist/{chunk-FLZ4FSP5.cjs → chunk-SBRU7GSX.cjs} +8 -8
- package/dist/{chunk-TOUYQ4N5.js → chunk-XEYMZUP5.js} +2 -2
- package/dist/cli/index.js +2781 -469
- package/dist/index.cjs +169 -29
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +151 -11
- package/dist/plugins/unplugin.cjs +4 -4
- package/dist/plugins/unplugin.js +3 -3
- package/dist/{types-BZqvBhBI.d.ts → types-BDpFfokR.d.ts} +2 -1
- package/dist/{types-E4ugA4Oz.d.cts → types-WIoud53X.d.cts} +2 -1
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
protectProject,
|
|
3
3
|
serializeNextOptions
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-GKWTP4Z5.js";
|
|
5
5
|
import {
|
|
6
6
|
hasJsBundleFiles
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-RDP4MTHK.js";
|
|
8
8
|
import {
|
|
9
9
|
computeFnv1aHash,
|
|
10
10
|
safeDecodeURIComponent
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-RM3V7KJA.js";
|
|
12
12
|
import {
|
|
13
13
|
UnpeekError,
|
|
14
14
|
__dirname,
|
|
@@ -3,14 +3,16 @@ import {
|
|
|
3
3
|
} from "./chunk-6EWFL4LQ.js";
|
|
4
4
|
import {
|
|
5
5
|
detectTargetFramework,
|
|
6
|
+
discoverHtmlEntryGraph,
|
|
6
7
|
extractDebugId,
|
|
8
|
+
hasNextServerSegment,
|
|
7
9
|
isWorkerOrServiceWorkerFile,
|
|
8
10
|
relocateSourceMaps,
|
|
9
11
|
replaceOrAppendDebugId,
|
|
10
12
|
scanClientBundles,
|
|
11
13
|
stripDebugIdComments,
|
|
12
14
|
stripSourceMapComments
|
|
13
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-RDP4MTHK.js";
|
|
14
16
|
import {
|
|
15
17
|
chainSourceMaps,
|
|
16
18
|
computeDeterministicDebugId,
|
|
@@ -21,7 +23,7 @@ import {
|
|
|
21
23
|
safeDecodeURIComponent,
|
|
22
24
|
shiftSourceMapLines,
|
|
23
25
|
transformJavaScript
|
|
24
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-RM3V7KJA.js";
|
|
25
27
|
import {
|
|
26
28
|
UnpeekError
|
|
27
29
|
} from "./chunk-LA6J3BT3.js";
|
|
@@ -196,21 +198,29 @@ function matchesManifestEntry(relPath, manifestEntries) {
|
|
|
196
198
|
}
|
|
197
199
|
return false;
|
|
198
200
|
}
|
|
199
|
-
function isEntryChunk(relPath, index, allRelPaths, manifestEntries, isWorkerTarget) {
|
|
201
|
+
function isEntryChunk(relPath, index, allRelPaths, manifestEntries, isWorkerTarget, htmlGraph) {
|
|
200
202
|
const norm = relPath.replace(/\\/g, "/");
|
|
201
203
|
const base = path.basename(norm);
|
|
202
204
|
if (isWorkerTarget && isWorkerOrServiceWorkerFile(norm)) {
|
|
203
205
|
return true;
|
|
204
206
|
}
|
|
207
|
+
if (htmlGraph?.workerEntryFiles.has(norm)) {
|
|
208
|
+
return true;
|
|
209
|
+
}
|
|
205
210
|
if (matchesManifestEntry(norm, manifestEntries)) {
|
|
206
211
|
return true;
|
|
207
212
|
}
|
|
213
|
+
const hasKnownManifestEntry = manifestEntries.size > 0 && allRelPaths.some((p) => matchesManifestEntry(p.replace(/\\/g, "/"), manifestEntries));
|
|
214
|
+
const hasKnownHtmlEntry = manifestEntries.size === 0 && Boolean(htmlGraph && allRelPaths.some((p) => htmlGraph.entryFiles.has(p.replace(/\\/g, "/"))));
|
|
215
|
+
if (hasKnownHtmlEntry) {
|
|
216
|
+
return htmlGraph.entryFiles.has(norm);
|
|
217
|
+
}
|
|
208
218
|
if (ENTRY_PATTERN.test(norm) || ENTRY_PATTERN.test(base)) {
|
|
209
219
|
return true;
|
|
210
220
|
}
|
|
211
|
-
const hasAnyKnownEntry = allRelPaths.some((p) => {
|
|
221
|
+
const hasAnyKnownEntry = hasKnownManifestEntry || allRelPaths.some((p) => {
|
|
212
222
|
const n = p.replace(/\\/g, "/");
|
|
213
|
-
return
|
|
223
|
+
return ENTRY_PATTERN.test(n) || ENTRY_PATTERN.test(path.basename(n));
|
|
214
224
|
});
|
|
215
225
|
if (!hasAnyKnownEntry && index === 0) {
|
|
216
226
|
return true;
|
|
@@ -309,6 +319,13 @@ async function protectProject(options = {}) {
|
|
|
309
319
|
const allRelPaths = clientFiles.map((f) => path.relative(outDir, f).replace(/\\/g, "/"));
|
|
310
320
|
const manifestEntries = collectManifestEntryFiles(outDir, cwd, config);
|
|
311
321
|
const isWorkerTarget = config.target === "worker";
|
|
322
|
+
const extraHtmlDirs = [];
|
|
323
|
+
const parentOutDir = path.dirname(outDir);
|
|
324
|
+
const relParent = path.relative(cwd, parentOutDir);
|
|
325
|
+
if (relParent && !relParent.startsWith("..") && !path.isAbsolute(relParent) && !hasNextServerSegment(parentOutDir, cwd)) {
|
|
326
|
+
extraHtmlDirs.push(parentOutDir);
|
|
327
|
+
}
|
|
328
|
+
const htmlGraph = discoverHtmlEntryGraph(outDir, config, extraHtmlDirs);
|
|
312
329
|
let originalBytes = 0;
|
|
313
330
|
let protectedBytes = 0;
|
|
314
331
|
let totalHotFunctionsSkipped = 0;
|
|
@@ -364,7 +381,14 @@ async function protectProject(options = {}) {
|
|
|
364
381
|
const relPath = allRelPaths[i];
|
|
365
382
|
const originalMap = keepPrivateMaps ? readOriginalSourceMapForFile(filePath, relPath, vaultResult.vaultDir, deferVaultWrites) : void 0;
|
|
366
383
|
const preExistingHits = countPreExistingEvalCalls(codeToTransform);
|
|
367
|
-
const isEntry = isEntryChunk(
|
|
384
|
+
const isEntry = isEntryChunk(
|
|
385
|
+
relPath,
|
|
386
|
+
i,
|
|
387
|
+
allRelPaths,
|
|
388
|
+
manifestEntries,
|
|
389
|
+
isWorkerTarget,
|
|
390
|
+
htmlGraph
|
|
391
|
+
);
|
|
368
392
|
const shouldInjectShield = injectRuntimeShield && isEntry;
|
|
369
393
|
const fileSeed = computeFnv1aHash(`${relPath}:${i}`, seed);
|
|
370
394
|
const transformOptions = {
|