1 | module.exports =
|
2 | (function() {
|
3 | "use strict";
|
4 | var __webpack_modules__ = ({
|
5 |
|
6 | 149:
|
7 | (function(module, exports, __nccwpck_require__) {
|
8 |
|
9 | module = __nccwpck_require__.nmd(module);
|
10 |
|
11 |
|
12 | const {
|
13 | minify: terserMinify
|
14 | } = __nccwpck_require__(775);
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 | function buildTerserOptions(terserOptions = {}) {
|
64 | return { ...terserOptions,
|
65 | mangle: terserOptions.mangle == null ? true : typeof terserOptions.mangle === "boolean" ? terserOptions.mangle : { ...terserOptions.mangle
|
66 | },
|
67 |
|
68 |
|
69 | sourceMap: undefined,
|
70 |
|
71 | ...(terserOptions.format ? {
|
72 | format: {
|
73 | beautify: false,
|
74 | ...terserOptions.format
|
75 | }
|
76 | } : {
|
77 | output: {
|
78 | beautify: false,
|
79 | ...terserOptions.output
|
80 | }
|
81 | })
|
82 | };
|
83 | }
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 | function isObject(value) {
|
91 | const type = typeof value;
|
92 | return value != null && (type === "object" || type === "function");
|
93 | }
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 | function buildComments(extractComments, terserOptions, extractedComments) {
|
103 |
|
104 | const condition = {};
|
105 | let comments;
|
106 |
|
107 | if (terserOptions.format) {
|
108 | ({
|
109 | comments
|
110 | } = terserOptions.format);
|
111 | } else if (terserOptions.output) {
|
112 | ({
|
113 | comments
|
114 | } = terserOptions.output);
|
115 | }
|
116 |
|
117 | condition.preserve = typeof comments !== "undefined" ? comments : false;
|
118 |
|
119 | if (typeof extractComments === "boolean" && extractComments) {
|
120 | condition.extract = "some";
|
121 | } else if (typeof extractComments === "string" || extractComments instanceof RegExp) {
|
122 | condition.extract = extractComments;
|
123 | } else if (typeof extractComments === "function") {
|
124 | condition.extract = extractComments;
|
125 | } else if (extractComments && isObject(extractComments)) {
|
126 | condition.extract = typeof extractComments.condition === "boolean" && extractComments.condition ? "some" : typeof extractComments.condition !== "undefined" ? extractComments.condition : "some";
|
127 | } else {
|
128 |
|
129 |
|
130 | condition.preserve = typeof comments !== "undefined" ? comments : "some";
|
131 | condition.extract = false;
|
132 | }
|
133 |
|
134 |
|
135 | ["preserve", "extract"].forEach(key => {
|
136 |
|
137 | let regexStr;
|
138 |
|
139 |
|
140 | let regex;
|
141 |
|
142 | switch (typeof condition[key]) {
|
143 | case "boolean":
|
144 | condition[key] = condition[key] ? () => true : () => false;
|
145 | break;
|
146 |
|
147 | case "function":
|
148 | break;
|
149 |
|
150 | case "string":
|
151 | if (condition[key] === "all") {
|
152 | condition[key] = () => true;
|
153 |
|
154 | break;
|
155 | }
|
156 |
|
157 | if (condition[key] === "some") {
|
158 | condition[key] =
|
159 |
|
160 | (astNode, comment) => (comment.type === "comment2" || comment.type === "comment1") && /@preserve|@lic|@cc_on|^\**!/i.test(comment.value);
|
161 |
|
162 | break;
|
163 | }
|
164 |
|
165 | regexStr =
|
166 |
|
167 | condition[key];
|
168 |
|
169 | condition[key] =
|
170 |
|
171 | (astNode, comment) => new RegExp(
|
172 |
|
173 | regexStr).test(comment.value);
|
174 |
|
175 | break;
|
176 |
|
177 | default:
|
178 | regex =
|
179 |
|
180 | condition[key];
|
181 |
|
182 | condition[key] =
|
183 |
|
184 | (astNode, comment) =>
|
185 |
|
186 | regex.test(comment.value);
|
187 |
|
188 | }
|
189 | });
|
190 |
|
191 |
|
192 | return (astNode, comment) => {
|
193 | if (
|
194 |
|
195 | condition.extract(astNode, comment)) {
|
196 | const commentText = comment.type === "comment2" ? `/*${comment.value}*/` : `//${comment.value}`;
|
197 |
|
198 | if (!extractedComments.includes(commentText)) {
|
199 | extractedComments.push(commentText);
|
200 | }
|
201 | }
|
202 |
|
203 | return (
|
204 |
|
205 | condition.preserve(astNode, comment)
|
206 | );
|
207 | };
|
208 | }
|
209 |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 |
|
215 | async function minify(options) {
|
216 | const {
|
217 | name,
|
218 | input,
|
219 | inputSourceMap,
|
220 | minify: minifyFn,
|
221 | minifyOptions
|
222 | } = options;
|
223 |
|
224 | if (minifyFn) {
|
225 | return minifyFn({
|
226 | [name]: input
|
227 | }, inputSourceMap, minifyOptions);
|
228 | }
|
229 |
|
230 |
|
231 | const terserOptions = buildTerserOptions(minifyOptions);
|
232 |
|
233 | if (inputSourceMap) {
|
234 |
|
235 | terserOptions.sourceMap = {
|
236 | asObject: true
|
237 | };
|
238 | }
|
239 |
|
240 |
|
241 |
|
242 | const extractedComments = [];
|
243 | const {
|
244 | extractComments
|
245 | } = options;
|
246 |
|
247 | if (terserOptions.output) {
|
248 | terserOptions.output.comments = buildComments(extractComments, terserOptions, extractedComments);
|
249 | } else if (terserOptions.format) {
|
250 | terserOptions.format.comments = buildComments(extractComments, terserOptions, extractedComments);
|
251 | }
|
252 |
|
253 | const result = await terserMinify({
|
254 | [name]: input
|
255 | }, terserOptions);
|
256 | return { ...result,
|
257 | extractedComments
|
258 | };
|
259 | }
|
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 | function transform(options) {
|
267 |
|
268 |
|
269 |
|
270 | const evaluatedOptions =
|
271 |
|
272 |
|
273 | new Function("exports", "require", "module", "__filename", "__dirname", `'use strict'\nreturn ${options}`)(exports, require, module, __filename, __dirname);
|
274 | return minify(evaluatedOptions);
|
275 | }
|
276 |
|
277 | module.exports.minify = minify;
|
278 | module.exports.transform = transform;
|
279 |
|
280 | }),
|
281 |
|
282 | 775:
|
283 | (function(module) {
|
284 |
|
285 | module.exports = require("next/dist/compiled/terser");;
|
286 |
|
287 | })
|
288 |
|
289 | });
|
290 |
|
291 |
|
292 | var __webpack_module_cache__ = {};
|
293 |
|
294 |
|
295 | function __nccwpck_require__(moduleId) {
|
296 |
|
297 | if(__webpack_module_cache__[moduleId]) {
|
298 | return __webpack_module_cache__[moduleId].exports;
|
299 | }
|
300 |
|
301 | var module = __webpack_module_cache__[moduleId] = {
|
302 | id: moduleId,
|
303 | loaded: false,
|
304 | exports: {}
|
305 | };
|
306 |
|
307 |
|
308 | var threw = true;
|
309 | try {
|
310 | __webpack_modules__[moduleId](module, module.exports, __nccwpck_require__);
|
311 | threw = false;
|
312 | } finally {
|
313 | if(threw) delete __webpack_module_cache__[moduleId];
|
314 | }
|
315 |
|
316 |
|
317 | module.loaded = true;
|
318 |
|
319 |
|
320 | return module.exports;
|
321 | }
|
322 |
|
323 |
|
324 |
|
325 | !function() {
|
326 | __nccwpck_require__.nmd = function(module) {
|
327 | module.paths = [];
|
328 | if (!module.children) module.children = [];
|
329 | return module;
|
330 | };
|
331 | }();
|
332 |
|
333 |
|
334 |
|
335 | __nccwpck_require__.ab = __dirname + "/";
|
336 |
|
337 |
|
338 |
|
339 | return __nccwpck_require__(149);
|
340 | })()
|
341 | ; |
\ | No newline at end of file |