unpeek 4.0.1 → 4.2.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 +21 -13
- package/README.tr.md +21 -13
- package/dist/adapters/esbuild.cjs +5 -5
- package/dist/adapters/esbuild.d.cts +1 -1
- package/dist/adapters/esbuild.d.ts +1 -1
- package/dist/adapters/esbuild.js +3 -3
- package/dist/adapters/next/adapter.cjs +6 -6
- package/dist/adapters/next/adapter.d.cts +1 -1
- package/dist/adapters/next/adapter.d.ts +1 -1
- package/dist/adapters/next/adapter.js +5 -5
- package/dist/adapters/next/index.cjs +6 -6
- package/dist/adapters/next/index.js +5 -5
- package/dist/adapters/rollup.cjs +5 -5
- package/dist/adapters/rollup.d.cts +1 -1
- package/dist/adapters/rollup.d.ts +1 -1
- package/dist/adapters/rollup.js +3 -3
- package/dist/adapters/rspack.cjs +5 -5
- package/dist/adapters/rspack.d.cts +1 -1
- package/dist/adapters/rspack.d.ts +1 -1
- package/dist/adapters/rspack.js +3 -3
- package/dist/adapters/vite.cjs +5 -5
- package/dist/adapters/vite.d.cts +1 -1
- package/dist/adapters/vite.d.ts +1 -1
- package/dist/adapters/vite.js +3 -3
- package/dist/adapters/webpack.cjs +5 -5
- package/dist/adapters/webpack.d.cts +1 -1
- package/dist/adapters/webpack.d.ts +1 -1
- package/dist/adapters/webpack.js +3 -3
- package/dist/browser.cjs +2 -2
- package/dist/browser.d.cts +7 -6
- package/dist/browser.d.ts +7 -6
- package/dist/browser.js +1 -1
- package/dist/{chunk-TYL32LUK.js → chunk-32GLSJAW.js} +91 -569
- package/dist/{chunk-W77DAC3H.js → chunk-6EWFL4LQ.js} +16 -0
- package/dist/{chunk-3GDHYBVH.cjs → chunk-AD6UFBPA.cjs} +96 -574
- package/dist/{chunk-XYN5NYSD.js → chunk-APQOBFRO.js} +21 -15
- package/dist/{chunk-LGTXAAZH.js → chunk-BL2UXZGD.js} +3155 -481
- package/dist/{chunk-X6EETCO6.cjs → chunk-BQ2O6HM5.cjs} +16 -0
- package/dist/{chunk-4G2HCME5.js → chunk-GCWXTWTN.js} +30 -13
- package/dist/{chunk-4SOS3LRV.js → chunk-K77WRITN.js} +6 -6
- package/dist/{chunk-7ZEVJ4OR.cjs → chunk-KIAYVIC5.cjs} +40 -34
- package/dist/{chunk-M46SFJE7.cjs → chunk-MSECP2P4.cjs} +3351 -677
- package/dist/{chunk-NNAAPDUS.cjs → chunk-SJK45WAU.cjs} +8 -8
- package/dist/{chunk-OTA75YI6.cjs → chunk-UUJLTW7O.cjs} +53 -36
- package/dist/cli/index.js +2808 -528
- package/dist/{config-Y6JwVGwX.d.cts → config-BFAZrfjQ.d.cts} +2 -0
- package/dist/{config-Y6JwVGwX.d.ts → config-BFAZrfjQ.d.ts} +2 -0
- package/dist/config.cjs +2 -2
- package/dist/config.d.cts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +1 -1
- package/dist/{index-COVHErnx.d.cts → index-Bo4S_VVM.d.cts} +1 -1
- package/dist/{index-0O1WSfVP.d.ts → index-CKdYVt_L.d.ts} +1 -1
- package/dist/index.cjs +171 -31
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +156 -16
- package/dist/plugins/unplugin.cjs +4 -4
- package/dist/plugins/unplugin.js +3 -3
- package/dist/{types-CMtZnV8C.d.ts → types-BDpFfokR.d.ts} +6 -3
- package/dist/{types-D93PuOOl.d.cts → types-WIoud53X.d.cts} +6 -3
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
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
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkKIAYVIC5cjs = require('./chunk-KIAYVIC5.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
var _chunkAD6UFBPAcjs = require('./chunk-AD6UFBPA.cjs');
|
|
7
8
|
|
|
8
|
-
var _chunk3GDHYBVHcjs = require('./chunk-3GDHYBVH.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkMSECP2P4cjs = require('./chunk-MSECP2P4.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
@@ -114,7 +114,7 @@ function createUnpeekNextAdapter(options = {}) {
|
|
|
114
114
|
const distDir = _path2.default.resolve(cwd, configuredDistDir);
|
|
115
115
|
const staticDir = _path2.default.join(distDir, "static");
|
|
116
116
|
const vercelStaticDir = _path2.default.join(cwd, ".vercel", "output", "static", "_next", "static");
|
|
117
|
-
const targetDir = _fs2.default.existsSync(staticDir) && (
|
|
117
|
+
const targetDir = _fs2.default.existsSync(staticDir) && (_chunkAD6UFBPAcjs.hasJsBundleFiles.call(void 0, staticDir) || !_fs2.default.existsSync(vercelStaticDir)) ? staticDir : _fs2.default.existsSync(vercelStaticDir) ? vercelStaticDir : _fs2.default.existsSync(staticDir) ? staticDir : distDir;
|
|
118
118
|
const phase = _nullishCoalesce(context.phase, () => ( recordedPhase));
|
|
119
119
|
if (isNonProductionPhase(phase)) {
|
|
120
120
|
await delegateToUpstreamOnBuildComplete(upstreamPath, context);
|
|
@@ -135,8 +135,8 @@ function createUnpeekNextAdapter(options = {}) {
|
|
|
135
135
|
elapsedMs: 0
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
|
-
const deterministicSeed = typeof options.seed === "number" ? options.seed : context.buildId ?
|
|
139
|
-
const summary = await
|
|
138
|
+
const deterministicSeed = typeof options.seed === "number" ? options.seed : context.buildId ? _chunkMSECP2P4cjs.computeFnv1aHash.call(void 0, context.buildId, 1597463007) : 1597463007;
|
|
139
|
+
const summary = await _chunkKIAYVIC5cjs.protectProject.call(void 0, {
|
|
140
140
|
...options,
|
|
141
141
|
cwd,
|
|
142
142
|
outDir: targetDir,
|
|
@@ -151,7 +151,7 @@ function createUnpeekNextAdapter(options = {}) {
|
|
|
151
151
|
if (!rawFilePath) continue;
|
|
152
152
|
let absPath = _path2.default.isAbsolute(rawFilePath) ? rawFilePath : _path2.default.resolve(cwd, rawFilePath);
|
|
153
153
|
if (!_fs2.default.existsSync(absPath)) {
|
|
154
|
-
const relClean =
|
|
154
|
+
const relClean = _chunkMSECP2P4cjs.safeDecodeURIComponent.call(void 0, rawFilePath).replace(/\\/g, "/").replace(/^\/?(?:_next\/|\.next\/)/, "");
|
|
155
155
|
const fromDist = _path2.default.resolve(distDir, relClean);
|
|
156
156
|
if (_fs2.default.existsSync(fromDist)) {
|
|
157
157
|
absPath = fromDist;
|
|
@@ -232,7 +232,7 @@ function applyWithUnpeek(config = {}, options) {
|
|
|
232
232
|
process.env.UNPEEK_UPSTREAM_ADAPTER_PATH = options.upstreamAdapterPath;
|
|
233
233
|
}
|
|
234
234
|
if (options) {
|
|
235
|
-
const serialized =
|
|
235
|
+
const serialized = _chunkKIAYVIC5cjs.serializeNextOptions.call(void 0, options);
|
|
236
236
|
const byteLength = Buffer.byteLength(serialized, "utf8");
|
|
237
237
|
if (byteLength > MAX_NEXT_OPTIONS_ENV_BYTES) {
|
|
238
238
|
throw new (0, _chunkL6BOM5VScjs.UnpeekError)(
|
|
@@ -4,16 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
var _chunkAD6UFBPAcjs = require('./chunk-AD6UFBPA.cjs');
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
|
|
10
|
-
var _chunk3GDHYBVHcjs = require('./chunk-3GDHYBVH.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
var _chunkMSECP2P4cjs = require('./chunk-MSECP2P4.cjs');
|
|
17
18
|
|
|
18
19
|
// src/plugins/unplugin.ts
|
|
19
20
|
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
@@ -33,6 +34,17 @@ function isExcludedClientAsset(fileName, config) {
|
|
|
33
34
|
if (_optionalChain([config, 'optionalAccess', _ => _.target]) !== "worker" && SW_OR_WORKBOX_PATTERN.test(norm)) {
|
|
34
35
|
return true;
|
|
35
36
|
}
|
|
37
|
+
const cleanRel = norm.replace(/^\/+/, "");
|
|
38
|
+
if (_optionalChain([config, 'optionalAccess', _2 => _2.filter, 'optionalAccess', _3 => _3.include]) && config.filter.include.length > 0) {
|
|
39
|
+
if (!config.filter.include.some((pattern) => _chunkAD6UFBPAcjs.matchesGlobPattern.call(void 0, cleanRel, pattern))) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (_optionalChain([config, 'optionalAccess', _4 => _4.filter, 'optionalAccess', _5 => _5.exclude]) && config.filter.exclude.length > 0) {
|
|
44
|
+
if (config.filter.exclude.some((pattern) => _chunkAD6UFBPAcjs.matchesGlobPattern.call(void 0, cleanRel, pattern))) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
36
48
|
return false;
|
|
37
49
|
}
|
|
38
50
|
function createWebpackRawSource(sources, content) {
|
|
@@ -52,14 +64,14 @@ function createWebpackRawSource(sources, content) {
|
|
|
52
64
|
}
|
|
53
65
|
var unpeekPlugin = _unplugin.createUnplugin.call(void 0, (options = {}) => {
|
|
54
66
|
const config = options.config;
|
|
55
|
-
const baseSeed = typeof options.seed === "number" ? options.seed : Math.floor(Math.random() * 2147483647) || 322420463;
|
|
56
|
-
const deterrentMode = _nullishCoalesce(_nullishCoalesce(options.deterrentMode, () => ( _optionalChain([config, 'optionalAccess',
|
|
57
|
-
const detectHeadless = _nullishCoalesce(_nullishCoalesce(options.detectHeadless, () => ( _optionalChain([config, 'optionalAccess',
|
|
67
|
+
const baseSeed = typeof options.seed === "number" && Number.isFinite(options.seed) ? options.seed : typeof _optionalChain([config, 'optionalAccess', _6 => _6.seed]) === "number" && Number.isFinite(config.seed) ? config.seed : Math.floor(Math.random() * 2147483647) || 322420463;
|
|
68
|
+
const deterrentMode = _nullishCoalesce(_nullishCoalesce(options.deterrentMode, () => ( _optionalChain([config, 'optionalAccess', _7 => _7.shield, 'optionalAccess', _8 => _8.deterrentMode]))), () => ( "passive"));
|
|
69
|
+
const detectHeadless = _nullishCoalesce(_nullishCoalesce(options.detectHeadless, () => ( _optionalChain([config, 'optionalAccess', _9 => _9.shield, 'optionalAccess', _10 => _10.detectHeadless]))), () => ( false));
|
|
58
70
|
const injectRuntimeShield = _nullishCoalesce(options.injectRuntimeShield, () => ( true));
|
|
59
|
-
const minStringLength = _nullishCoalesce(_nullishCoalesce(options.minStringLength, () => ( _optionalChain([config, 'optionalAccess',
|
|
71
|
+
const minStringLength = _nullishCoalesce(_nullishCoalesce(options.minStringLength, () => ( _optionalChain([config, 'optionalAccess', _11 => _11.vault, 'optionalAccess', _12 => _12.minStringLength]))), () => ( 4));
|
|
60
72
|
const aggressive = _nullishCoalesce(options.aggressive, () => ( false));
|
|
61
|
-
const masterSym =
|
|
62
|
-
const masterShield = injectRuntimeShield ?
|
|
73
|
+
const masterSym = _chunkMSECP2P4cjs.deriveWindowKeySymbol.call(void 0, baseSeed);
|
|
74
|
+
const masterShield = injectRuntimeShield ? _chunkMSECP2P4cjs.generateRuntimeShield.call(void 0, {
|
|
63
75
|
seed: baseSeed,
|
|
64
76
|
deterrentMode,
|
|
65
77
|
detectHeadless,
|
|
@@ -70,14 +82,15 @@ var unpeekPlugin = _unplugin.createUnplugin.call(void 0, (options = {}) => {
|
|
|
70
82
|
if (!isSupportedJsAsset(normalizedFileName) || isExcludedClientAsset(normalizedFileName, config)) {
|
|
71
83
|
return null;
|
|
72
84
|
}
|
|
73
|
-
const fileDebugId =
|
|
74
|
-
const shouldStripComments = _optionalChain([config, 'optionalAccess',
|
|
85
|
+
const fileDebugId = _chunkAD6UFBPAcjs.extractDebugId.call(void 0, rawCode);
|
|
86
|
+
const shouldStripComments = _optionalChain([config, 'optionalAccess', _13 => _13.sourcemaps, 'optionalAccess', _14 => _14.stripComments]) !== false;
|
|
75
87
|
let codeToTransform = rawCode;
|
|
76
88
|
if (shouldStripComments && rawCode.includes("sourceMappingURL=")) {
|
|
77
|
-
codeToTransform =
|
|
89
|
+
codeToTransform = _chunkAD6UFBPAcjs.stripSourceMapComments.call(void 0, rawCode).code;
|
|
78
90
|
}
|
|
79
91
|
const shouldInjectShield = injectRuntimeShield && isEntry;
|
|
80
|
-
const
|
|
92
|
+
const shouldGenerateMap = requestMap || Boolean(inputMap);
|
|
93
|
+
const chunkSeed = _chunkMSECP2P4cjs.computeFnv1aHash.call(void 0, fileName, baseSeed);
|
|
81
94
|
const transformOptions = {
|
|
82
95
|
seed: chunkSeed,
|
|
83
96
|
minStringLength,
|
|
@@ -86,43 +99,46 @@ var unpeekPlugin = _unplugin.createUnplugin.call(void 0, (options = {}) => {
|
|
|
86
99
|
skipShieldPreamble: true,
|
|
87
100
|
shieldCoupled: injectRuntimeShield,
|
|
88
101
|
windowKeySymbol: masterSym,
|
|
89
|
-
expectedDelta: _optionalChain([masterShield, 'optionalAccess',
|
|
102
|
+
expectedDelta: _optionalChain([masterShield, 'optionalAccess', _15 => _15.expectedDelta]),
|
|
103
|
+
expectedStateHash: _optionalChain([masterShield, 'optionalAccess', _16 => _16.expectedStateHash]),
|
|
104
|
+
originalSourceMap: inputMap,
|
|
90
105
|
deterrentMode,
|
|
91
106
|
detectHeadless,
|
|
92
107
|
aggressive,
|
|
93
|
-
config
|
|
108
|
+
config,
|
|
109
|
+
generateMap: shouldGenerateMap,
|
|
110
|
+
rootDir: process.cwd()
|
|
94
111
|
};
|
|
95
|
-
|
|
96
|
-
transformOptions.rootDir = process.cwd();
|
|
97
|
-
const result = _chunkM46SFJE7cjs.transformJavaScript.call(void 0, codeToTransform, transformOptions);
|
|
112
|
+
const result = _chunkMSECP2P4cjs.transformJavaScript.call(void 0, codeToTransform, transformOptions);
|
|
98
113
|
let finalCode = result.code;
|
|
99
114
|
let preambleLineOffset = 0;
|
|
100
115
|
const integrityCheckFnName = masterShield && "integrityCheckFnName" in masterShield ? masterShield.integrityCheckFnName : void 0;
|
|
101
|
-
if (shouldInjectShield && _optionalChain([masterShield, 'optionalAccess',
|
|
116
|
+
if (shouldInjectShield && _optionalChain([masterShield, 'optionalAccess', _17 => _17.preambleCode]) && !finalCode.includes("(function _u$") && (!integrityCheckFnName || !finalCode.includes(integrityCheckFnName)) && !finalCode.startsWith(masterShield.preambleCode)) {
|
|
102
117
|
const prefix = `${masterShield.preambleCode}
|
|
103
118
|
`;
|
|
104
119
|
preambleLineOffset = (_nullishCoalesce(prefix.match(/\n/g), () => ( []))).length;
|
|
105
120
|
finalCode = `${prefix}${finalCode}`;
|
|
106
121
|
}
|
|
107
122
|
const rawTransformMap = result.sourceMap;
|
|
108
|
-
const shiftedTransformMap = rawTransformMap ?
|
|
123
|
+
const shiftedTransformMap = rawTransformMap ? _chunkMSECP2P4cjs.shiftSourceMapLines.call(void 0, rawTransformMap, preambleLineOffset) : void 0;
|
|
109
124
|
let composedMap = null;
|
|
110
125
|
if (shiftedTransformMap && inputMap) {
|
|
111
|
-
composedMap =
|
|
126
|
+
composedMap = _chunkMSECP2P4cjs.chainSourceMaps.call(void 0, shiftedTransformMap, inputMap);
|
|
112
127
|
} else if (shiftedTransformMap) {
|
|
113
128
|
composedMap = shiftedTransformMap;
|
|
114
129
|
} else if (inputMap) {
|
|
115
|
-
composedMap =
|
|
130
|
+
composedMap = _chunkMSECP2P4cjs.flattenSourceMapSections.call(void 0, inputMap);
|
|
116
131
|
}
|
|
117
|
-
const inputMapDebugId = _nullishCoalesce(_optionalChain([inputMap, 'optionalAccess',
|
|
132
|
+
const inputMapDebugId = _nullishCoalesce(_optionalChain([inputMap, 'optionalAccess', _18 => _18.debugId]), () => ( _optionalChain([inputMap, 'optionalAccess', _19 => _19.debug_id])));
|
|
118
133
|
const hadDebugId = Boolean(fileDebugId || inputMapDebugId || result.debugId);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const
|
|
134
|
+
const shouldMintDebugId = hadDebugId || shouldGenerateMap && !result.skippedReason && Boolean(composedMap || inputMap);
|
|
135
|
+
if (shouldMintDebugId) {
|
|
136
|
+
const codeWithoutDebugId = _chunkAD6UFBPAcjs.stripDebugIdComments.call(void 0, finalCode);
|
|
137
|
+
const mintedDebugId = _chunkMSECP2P4cjs.computeDeterministicDebugId.call(void 0,
|
|
122
138
|
codeWithoutDebugId,
|
|
123
|
-
_nullishCoalesce(_optionalChain([composedMap, 'optionalAccess',
|
|
139
|
+
_nullishCoalesce(_optionalChain([composedMap, 'optionalAccess', _20 => _20.mappings]), () => ( ""))
|
|
124
140
|
);
|
|
125
|
-
finalCode =
|
|
141
|
+
finalCode = _chunkAD6UFBPAcjs.replaceOrAppendDebugId.call(void 0, codeWithoutDebugId, mintedDebugId);
|
|
126
142
|
if (composedMap) {
|
|
127
143
|
composedMap.debugId = mintedDebugId;
|
|
128
144
|
delete composedMap.debug_id;
|
|
@@ -158,7 +174,7 @@ var unpeekPlugin = _unplugin.createUnplugin.call(void 0, (options = {}) => {
|
|
|
158
174
|
};
|
|
159
175
|
const attachWebpackLikeProcessAssets = (compiler, framework) => {
|
|
160
176
|
compiler.hooks.thisCompilation.tap("unpeek", (compilation) => {
|
|
161
|
-
const stage = _nullishCoalesce((framework === "rspack" ? _optionalChain([compiler, 'access',
|
|
177
|
+
const stage = _nullishCoalesce((framework === "rspack" ? _optionalChain([compiler, 'access', _21 => _21.rspack, 'optionalAccess', _22 => _22.Compilation, 'optionalAccess', _23 => _23.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE]) : _optionalChain([compiler, 'access', _24 => _24.webpack, 'optionalAccess', _25 => _25.Compilation, 'optionalAccess', _26 => _26.PROCESS_ASSETS_STAGE_OPTIMIZE_INLINE])), () => ( 700));
|
|
162
178
|
compilation.hooks.processAssets.tap(
|
|
163
179
|
{ name: "unpeek", stage },
|
|
164
180
|
(assets) => {
|
|
@@ -182,14 +198,14 @@ var unpeekPlugin = _unplugin.createUnplugin.call(void 0, (options = {}) => {
|
|
|
182
198
|
}
|
|
183
199
|
}
|
|
184
200
|
}
|
|
185
|
-
const sources = _nullishCoalesce(_nullishCoalesce((framework === "rspack" ? _optionalChain([compiler, 'access',
|
|
201
|
+
const sources = _nullishCoalesce(_nullishCoalesce((framework === "rspack" ? _optionalChain([compiler, 'access', _27 => _27.rspack, 'optionalAccess', _28 => _28.sources]) : _optionalChain([compiler, 'access', _29 => _29.webpack, 'optionalAccess', _30 => _30.sources])), () => ( _optionalChain([compiler, 'access', _31 => _31.webpack, 'optionalAccess', _32 => _32.sources]))), () => ( _optionalChain([compiler, 'access', _33 => _33.rspack, 'optionalAccess', _34 => _34.sources])));
|
|
186
202
|
for (const assetName of Object.keys(assets)) {
|
|
187
203
|
const normalizedName = assetName.replace(/\\/g, "/").split("?")[0];
|
|
188
204
|
if (!isSupportedJsAsset(normalizedName) || isExcludedClientAsset(normalizedName, config)) {
|
|
189
205
|
continue;
|
|
190
206
|
}
|
|
191
207
|
const existingAsset = typeof compilation.getAsset === "function" ? compilation.getAsset(assetName) : { source: assets[assetName] };
|
|
192
|
-
const sourceObj = _nullishCoalesce(_optionalChain([existingAsset, 'optionalAccess',
|
|
208
|
+
const sourceObj = _nullishCoalesce(_optionalChain([existingAsset, 'optionalAccess', _35 => _35.source]), () => ( assets[assetName]));
|
|
193
209
|
if (!sourceObj) continue;
|
|
194
210
|
const rawContent = typeof sourceObj.source === "function" ? sourceObj.source() : sourceObj;
|
|
195
211
|
const code = Buffer.isBuffer(rawContent) ? rawContent.toString("utf8") : String(rawContent);
|
|
@@ -247,10 +263,10 @@ var unpeekPlugin = _unplugin.createUnplugin.call(void 0, (options = {}) => {
|
|
|
247
263
|
apply: "build",
|
|
248
264
|
renderChunk: void 0,
|
|
249
265
|
config(userConfig) {
|
|
250
|
-
if (_optionalChain([config, 'optionalAccess',
|
|
266
|
+
if (_optionalChain([config, 'optionalAccess', _36 => _36.target]) === "worker") {
|
|
251
267
|
return void 0;
|
|
252
268
|
}
|
|
253
|
-
const existingWorkerPlugins = _optionalChain([userConfig, 'optionalAccess',
|
|
269
|
+
const existingWorkerPlugins = _optionalChain([userConfig, 'optionalAccess', _37 => _37.worker, 'optionalAccess', _38 => _38.plugins]);
|
|
254
270
|
return {
|
|
255
271
|
worker: {
|
|
256
272
|
plugins: () => {
|
|
@@ -318,7 +334,7 @@ var unpeekPlugin = _unplugin.createUnplugin.call(void 0, (options = {}) => {
|
|
|
318
334
|
build.onEnd(async (result) => {
|
|
319
335
|
const workDir = _nullishCoalesce(build.initialOptions.absWorkingDir, () => ( process.cwd()));
|
|
320
336
|
const entryOutputs = /* @__PURE__ */ new Set();
|
|
321
|
-
if (_optionalChain([result, 'access',
|
|
337
|
+
if (_optionalChain([result, 'access', _39 => _39.metafile, 'optionalAccess', _40 => _40.outputs])) {
|
|
322
338
|
for (const [outKey, meta] of Object.entries(result.metafile.outputs)) {
|
|
323
339
|
if (meta && meta.entryPoint) {
|
|
324
340
|
entryOutputs.add(_path2.default.resolve(workDir, outKey));
|
|
@@ -336,7 +352,9 @@ var unpeekPlugin = _unplugin.createUnplugin.call(void 0, (options = {}) => {
|
|
|
336
352
|
const jsOutCount = result.outputFiles.filter((f) => isSupportedJsAsset(f.path)).length;
|
|
337
353
|
for (const outFile of result.outputFiles) {
|
|
338
354
|
const normPath = outFile.path.replace(/\\/g, "/");
|
|
339
|
-
|
|
355
|
+
const relFromWork = _path2.default.relative(workDir, outFile.path).replace(/\\/g, "/");
|
|
356
|
+
const filterPath = relFromWork && !relFromWork.startsWith("..") && !_path2.default.isAbsolute(relFromWork) ? relFromWork : normPath;
|
|
357
|
+
if (!isSupportedJsAsset(normPath) || isExcludedClientAsset(filterPath, config)) {
|
|
340
358
|
continue;
|
|
341
359
|
}
|
|
342
360
|
const mapFile = mapFilesByPath.get(`${outFile.path}.map`);
|
|
@@ -347,7 +365,6 @@ var unpeekPlugin = _unplugin.createUnplugin.call(void 0, (options = {}) => {
|
|
|
347
365
|
} catch (e4) {
|
|
348
366
|
}
|
|
349
367
|
}
|
|
350
|
-
const relFromWork = _path2.default.relative(workDir, outFile.path).replace(/\\/g, "/");
|
|
351
368
|
const isEntry = entryOutputs.size > 0 ? entryOutputs.has(outFile.path) || entryOutputs.has(relFromWork) || ENTRY_CHUNK_PATTERN.test(relFromWork) : ENTRY_CHUNK_PATTERN.test(relFromWork) || jsOutCount === 1;
|
|
352
369
|
const res = transformChunk(
|
|
353
370
|
outFile.text,
|
|
@@ -365,7 +382,7 @@ var unpeekPlugin = _unplugin.createUnplugin.call(void 0, (options = {}) => {
|
|
|
365
382
|
return;
|
|
366
383
|
}
|
|
367
384
|
const diskOutputs = /* @__PURE__ */ new Set();
|
|
368
|
-
if (_optionalChain([result, 'access',
|
|
385
|
+
if (_optionalChain([result, 'access', _41 => _41.metafile, 'optionalAccess', _42 => _42.outputs])) {
|
|
369
386
|
for (const outKey of Object.keys(result.metafile.outputs)) {
|
|
370
387
|
const abs = _path2.default.resolve(workDir, outKey);
|
|
371
388
|
if (isSupportedJsAsset(abs)) {
|