next 15.2.0-canary.54 → 15.2.0-canary.55
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.
Potentially problematic release.
This version of next might be problematic. Click here for more details.
- package/dist/bin/next +1 -1
- package/dist/build/index.js +2 -2
- package/dist/build/swc/generated-native.d.ts +12 -0
- package/dist/build/swc/index.d.ts +4 -1
- package/dist/build/swc/index.js +1 -1
- package/dist/build/swc/index.js.map +1 -1
- package/dist/build/swc/types.d.ts +6 -0
- package/dist/build/turbopack-build/impl.js +3 -1
- package/dist/build/turbopack-build/impl.js.map +1 -1
- package/dist/build/webpack/plugins/css-minimizer-plugin.d.ts +2 -2
- package/dist/build/webpack/plugins/minify-webpack-plugin/src/index.d.ts +9 -1
- package/dist/build/webpack/plugins/minify-webpack-plugin/src/index.js +27 -33
- package/dist/build/webpack/plugins/minify-webpack-plugin/src/index.js.map +1 -1
- package/dist/build/webpack-config.d.ts +1 -1
- package/dist/build/webpack-config.js +6 -4
- package/dist/build/webpack-config.js.map +1 -1
- package/dist/client/app-bootstrap.js +1 -1
- package/dist/client/index.js +1 -1
- package/dist/esm/build/index.js +2 -2
- package/dist/esm/build/swc/generated-native.d.ts +12 -0
- package/dist/esm/build/swc/index.js +1 -1
- package/dist/esm/build/swc/index.js.map +1 -1
- package/dist/esm/build/swc/types.js.map +1 -1
- package/dist/esm/build/turbopack-build/impl.js +3 -1
- package/dist/esm/build/turbopack-build/impl.js.map +1 -1
- package/dist/esm/build/webpack/plugins/minify-webpack-plugin/src/index.js +28 -34
- package/dist/esm/build/webpack/plugins/minify-webpack-plugin/src/index.js.map +1 -1
- package/dist/esm/build/webpack-config.js +6 -4
- package/dist/esm/build/webpack-config.js.map +1 -1
- package/dist/esm/client/app-bootstrap.js +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/server/config.js +1 -1
- package/dist/esm/server/dev/hot-reloader-turbopack.js +3 -2
- package/dist/esm/server/dev/hot-reloader-turbopack.js.map +1 -1
- package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/esm/server/lib/app-info-log.js +1 -1
- package/dist/esm/server/lib/start-server.js +1 -1
- package/dist/server/config.js +1 -1
- package/dist/server/dev/hot-reloader-turbopack.js +3 -2
- package/dist/server/dev/hot-reloader-turbopack.js.map +1 -1
- package/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/server/lib/app-info-log.js +1 -1
- package/dist/server/lib/start-server.js +1 -1
- package/dist/telemetry/anonymous-meta.js +1 -1
- package/dist/telemetry/events/session-stopped.js +2 -2
- package/dist/telemetry/events/version.js +2 -2
- package/package.json +15 -15
|
@@ -18,31 +18,26 @@ function _interop_require_default(obj) {
|
|
|
18
18
|
}
|
|
19
19
|
function buildError(error, file) {
|
|
20
20
|
if (error.line) {
|
|
21
|
-
return
|
|
22
|
-
value: "E351",
|
|
23
|
-
enumerable: false,
|
|
24
|
-
configurable: true
|
|
25
|
-
});
|
|
21
|
+
return new _webpack.WebpackError(`${file} from Minifier\n${error.message} [${file}:${error.line},${error.col}]${error.stack ? `\n${error.stack.split('\n').slice(1).join('\n')}` : ''}`);
|
|
26
22
|
}
|
|
27
23
|
if (error.stack) {
|
|
28
|
-
return
|
|
29
|
-
value: "E331",
|
|
30
|
-
enumerable: false,
|
|
31
|
-
configurable: true
|
|
32
|
-
});
|
|
24
|
+
return new _webpack.WebpackError(`${file} from Minifier\n${error.message}\n${error.stack}`);
|
|
33
25
|
}
|
|
34
|
-
return
|
|
35
|
-
value: "E166",
|
|
36
|
-
enumerable: false,
|
|
37
|
-
configurable: true
|
|
38
|
-
});
|
|
26
|
+
return new _webpack.WebpackError(`${file} from Minifier\n${error.message}`);
|
|
39
27
|
}
|
|
40
28
|
const debugMinify = process.env.NEXT_DEBUG_MINIFY;
|
|
41
29
|
class MinifyPlugin {
|
|
30
|
+
constructor(options){
|
|
31
|
+
this.options = options;
|
|
32
|
+
}
|
|
42
33
|
async optimize(compiler, compilation, assets, cache, { SourceMapSource, RawSource }) {
|
|
34
|
+
const mangle = !this.options.noMangling;
|
|
43
35
|
const compilationSpan = _profilingplugin.spans.get(compilation) || _profilingplugin.spans.get(compiler);
|
|
44
36
|
const MinifierSpan = compilationSpan.traceChild('minify-webpack-plugin-optimize');
|
|
45
|
-
|
|
37
|
+
if (compilation.name) {
|
|
38
|
+
MinifierSpan.setAttribute('compilationName', compilation.name);
|
|
39
|
+
}
|
|
40
|
+
MinifierSpan.setAttribute('mangle', String(mangle));
|
|
46
41
|
return MinifierSpan.traceAsyncFn(async ()=>{
|
|
47
42
|
const assetsList = Object.keys(assets);
|
|
48
43
|
const assetsForMinify = await Promise.all(assetsList.filter((name)=>{
|
|
@@ -65,7 +60,7 @@ class MinifyPlugin {
|
|
|
65
60
|
return true;
|
|
66
61
|
}).map(async (name)=>{
|
|
67
62
|
const { info, source } = compilation.getAsset(name);
|
|
68
|
-
const eTag = cache.getLazyHashedEtag(source);
|
|
63
|
+
const eTag = cache.mergeEtags(cache.getLazyHashedEtag(source), JSON.stringify(this.options));
|
|
69
64
|
const output = await cache.getPromise(name, eTag);
|
|
70
65
|
if (debugMinify && debugMinify === '1') {
|
|
71
66
|
console.log(JSON.stringify({
|
|
@@ -95,8 +90,10 @@ class MinifyPlugin {
|
|
|
95
90
|
content: JSON.stringify(options.inputSourceMap)
|
|
96
91
|
}
|
|
97
92
|
} : {},
|
|
98
|
-
|
|
99
|
-
|
|
93
|
+
// Compress options are defined in crates/napi/src/minify.rs.
|
|
94
|
+
compress: false,
|
|
95
|
+
// Mangle options may be amended in crates/napi/src/minify.rs.
|
|
96
|
+
mangle,
|
|
100
97
|
module: 'unknown',
|
|
101
98
|
output: {
|
|
102
99
|
comments: false
|
|
@@ -120,31 +117,28 @@ class MinifyPlugin {
|
|
|
120
117
|
if (!output) {
|
|
121
118
|
const { source: sourceFromInputSource, map: inputSourceMap } = inputSource.sourceAndMap();
|
|
122
119
|
const input = Buffer.isBuffer(sourceFromInputSource) ? sourceFromInputSource.toString() : sourceFromInputSource;
|
|
123
|
-
|
|
124
|
-
name,
|
|
125
|
-
input,
|
|
126
|
-
inputSourceMap
|
|
127
|
-
};
|
|
120
|
+
let minifiedOutput;
|
|
128
121
|
try {
|
|
129
|
-
|
|
122
|
+
minifiedOutput = await getWorker().minify({
|
|
123
|
+
input,
|
|
124
|
+
inputSourceMap
|
|
125
|
+
});
|
|
130
126
|
} catch (error) {
|
|
131
127
|
compilation.errors.push(buildError(error, name));
|
|
132
128
|
return;
|
|
133
129
|
}
|
|
134
|
-
|
|
135
|
-
output.source = new SourceMapSource(output.code, name, output.map, input, inputSourceMap, true);
|
|
136
|
-
} else {
|
|
137
|
-
output.source = new RawSource(output.code);
|
|
138
|
-
}
|
|
130
|
+
const source = minifiedOutput.map ? new SourceMapSource(minifiedOutput.code, name, minifiedOutput.map, input, inputSourceMap, true) : new RawSource(minifiedOutput.code);
|
|
139
131
|
await cache.storePromise(name, eTag, {
|
|
140
|
-
source
|
|
132
|
+
source
|
|
141
133
|
});
|
|
134
|
+
output = {
|
|
135
|
+
source
|
|
136
|
+
};
|
|
142
137
|
}
|
|
143
138
|
const newInfo = {
|
|
144
139
|
minimized: true
|
|
145
140
|
};
|
|
146
|
-
|
|
147
|
-
compilation.updateAsset(name, source, newInfo);
|
|
141
|
+
compilation.updateAsset(name, output.source, newInfo);
|
|
148
142
|
});
|
|
149
143
|
}));
|
|
150
144
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/build/webpack/plugins/minify-webpack-plugin/src/index.ts"],"sourcesContent":["import {\n webpack,\n ModuleFilenameHelpers,\n sources,\n} from 'next/dist/compiled/webpack/webpack'\nimport pLimit from 'next/dist/compiled/p-limit'\nimport { spans } from '../../profiling-plugin'\n\nfunction buildError(error: any, file: string) {\n if (error.line) {\n return new Error(\n `${file} from Minifier\\n${error.message} [${file}:${error.line},${\n error.col\n }]${\n error.stack ? `\\n${error.stack.split('\\n').slice(1).join('\\n')}` : ''\n }`\n )\n }\n\n if (error.stack) {\n return new Error(`${file} from Minifier\\n${error.message}\\n${error.stack}`)\n }\n\n return new Error(`${file} from Minifier\\n${error.message}`)\n}\n\nconst debugMinify = process.env.NEXT_DEBUG_MINIFY\n\nexport class MinifyPlugin {\n async optimize(\n compiler: any,\n compilation: any,\n assets: any,\n cache: any,\n { SourceMapSource, RawSource }: any\n ) {\n const compilationSpan = spans.get(compilation)! || spans.get(compiler)\n const MinifierSpan = compilationSpan.traceChild(\n 'minify-webpack-plugin-optimize'\n )\n MinifierSpan.setAttribute('compilationName', compilation.name)\n\n return MinifierSpan.traceAsyncFn(async () => {\n const assetsList = Object.keys(assets)\n\n const assetsForMinify = await Promise.all(\n assetsList\n .filter((name) => {\n if (\n !ModuleFilenameHelpers.matchObject.bind(\n // eslint-disable-next-line no-undefined\n undefined,\n { test: /\\.[cm]?js(\\?.*)?$/i }\n )(name)\n ) {\n return false\n }\n\n const res = compilation.getAsset(name)\n if (!res) {\n console.log(name)\n return false\n }\n\n const { info } = res\n\n // Skip double minimize assets from child compilation\n if (info.minimized) {\n return false\n }\n\n return true\n })\n .map(async (name) => {\n const { info, source } = compilation.getAsset(name)\n\n const eTag = cache.getLazyHashedEtag(source)\n const output = await cache.getPromise(name, eTag)\n\n if (debugMinify && debugMinify === '1') {\n console.log(\n JSON.stringify({\n name,\n source: source.source().toString(),\n }),\n {\n breakLength: Infinity,\n maxStringLength: Infinity,\n }\n )\n }\n return { name, info, inputSource: source, output, eTag }\n })\n )\n\n let initializedWorker: any\n\n // eslint-disable-next-line consistent-return\n const getWorker = () => {\n return {\n minify: async (options: any) => {\n const result = await require('../../../../swc').minify(\n options.input,\n {\n ...(options.inputSourceMap\n ? {\n sourceMap: {\n content: JSON.stringify(options.inputSourceMap),\n },\n }\n : {}),\n compress: true,\n mangle: true,\n module: 'unknown',\n output: {\n comments: false,\n },\n }\n )\n\n return result\n },\n }\n }\n\n // The limit in the SWC minifier will be handled by Node.js\n const limit = pLimit(Infinity)\n const scheduledTasks = []\n\n for (const asset of assetsForMinify) {\n scheduledTasks.push(\n limit(async () => {\n const { name, inputSource, eTag } = asset\n let { output } = asset\n\n const minifySpan = MinifierSpan.traceChild('minify-js')\n minifySpan.setAttribute('name', name)\n minifySpan.setAttribute(\n 'cache',\n typeof output === 'undefined' ? 'MISS' : 'HIT'\n )\n\n return minifySpan.traceAsyncFn(async () => {\n if (!output) {\n const { source: sourceFromInputSource, map: inputSourceMap } =\n inputSource.sourceAndMap()\n\n const input = Buffer.isBuffer(sourceFromInputSource)\n ? sourceFromInputSource.toString()\n : sourceFromInputSource\n\n const options = {\n name,\n input,\n inputSourceMap,\n }\n\n try {\n output = await getWorker().minify(options)\n } catch (error) {\n compilation.errors.push(buildError(error, name))\n\n return\n }\n\n if (output.map) {\n output.source = new SourceMapSource(\n output.code,\n name,\n output.map,\n input,\n inputSourceMap,\n true\n )\n } else {\n output.source = new RawSource(output.code)\n }\n\n await cache.storePromise(name, eTag, {\n source: output.source,\n })\n }\n\n const newInfo = { minimized: true }\n const { source } = output\n\n compilation.updateAsset(name, source, newInfo)\n })\n })\n )\n }\n\n await Promise.all(scheduledTasks)\n\n if (initializedWorker) {\n await initializedWorker.end()\n }\n })\n }\n\n apply(compiler: any) {\n const { SourceMapSource, RawSource } = compiler?.webpack?.sources || sources\n const pluginName = this.constructor.name\n\n compiler.hooks.thisCompilation.tap(pluginName, (compilation: any) => {\n const cache = compilation.getCache('MinifierWebpackPlugin')\n\n const handleHashForChunk = (hash: any, _chunk: any) => {\n // increment 'c' to invalidate cache\n hash.update('c')\n }\n\n const JSModulesHooks =\n webpack.javascript.JavascriptModulesPlugin.getCompilationHooks(\n compilation\n )\n JSModulesHooks.chunkHash.tap(pluginName, (chunk, hash) => {\n if (!chunk.hasRuntime()) return\n return handleHashForChunk(hash, chunk)\n })\n\n compilation.hooks.processAssets.tapPromise(\n {\n name: pluginName,\n stage: webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,\n },\n (assets: any) =>\n this.optimize(compiler, compilation, assets, cache, {\n SourceMapSource,\n RawSource,\n })\n )\n\n compilation.hooks.statsPrinter.tap(pluginName, (stats: any) => {\n stats.hooks.print\n .for('asset.info.minimized')\n .tap(\n 'minify-webpack-plugin',\n (minimized: any, { green, formatFlag }: any) =>\n // eslint-disable-next-line no-undefined\n minimized ? green(formatFlag('minimized')) : undefined\n )\n })\n })\n }\n}\n"],"names":["MinifyPlugin","buildError","error","file","line","Error","message","col","stack","split","slice","join","debugMinify","process","env","NEXT_DEBUG_MINIFY","optimize","compiler","compilation","assets","cache","SourceMapSource","RawSource","compilationSpan","spans","get","MinifierSpan","traceChild","setAttribute","name","traceAsyncFn","assetsList","Object","keys","assetsForMinify","Promise","all","filter","ModuleFilenameHelpers","matchObject","bind","undefined","test","res","getAsset","console","log","info","minimized","map","source","eTag","getLazyHashedEtag","output","getPromise","JSON","stringify","toString","breakLength","Infinity","maxStringLength","inputSource","initializedWorker","getWorker","minify","options","result","require","input","inputSourceMap","sourceMap","content","compress","mangle","module","comments","limit","pLimit","scheduledTasks","asset","push","minifySpan","sourceFromInputSource","sourceAndMap","Buffer","isBuffer","errors","code","storePromise","newInfo","updateAsset","end","apply","webpack","sources","pluginName","constructor","hooks","thisCompilation","tap","getCache","handleHashForChunk","hash","_chunk","update","JSModulesHooks","javascript","JavascriptModulesPlugin","getCompilationHooks","chunkHash","chunk","hasRuntime","processAssets","tapPromise","stage","Compilation","PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE","statsPrinter","stats","print","for","green","formatFlag"],"mappings":";;;;+BA4BaA;;;eAAAA;;;yBAxBN;+DACY;iCACG;;;;;;AAEtB,SAASC,WAAWC,KAAU,EAAEC,IAAY;IAC1C,IAAID,MAAME,IAAI,EAAE;QACd,OAAO,qBAMN,CANM,IAAIC,MACT,GAAGF,KAAK,gBAAgB,EAAED,MAAMI,OAAO,CAAC,EAAE,EAAEH,KAAK,CAAC,EAAED,MAAME,IAAI,CAAC,CAAC,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plugin/src/index.ts"],"sourcesContent":["import {\n webpack,\n ModuleFilenameHelpers,\n sources,\n WebpackError,\n type CacheFacade,\n type Compilation,\n} from 'next/dist/compiled/webpack/webpack'\nimport pLimit from 'next/dist/compiled/p-limit'\nimport { spans } from '../../profiling-plugin'\n\nfunction buildError(error: any, file: string) {\n if (error.line) {\n return new WebpackError(\n `${file} from Minifier\\n${error.message} [${file}:${error.line},${\n error.col\n }]${\n error.stack ? `\\n${error.stack.split('\\n').slice(1).join('\\n')}` : ''\n }`\n )\n }\n\n if (error.stack) {\n return new WebpackError(\n `${file} from Minifier\\n${error.message}\\n${error.stack}`\n )\n }\n\n return new WebpackError(`${file} from Minifier\\n${error.message}`)\n}\n\nconst debugMinify = process.env.NEXT_DEBUG_MINIFY\n\nexport class MinifyPlugin {\n constructor(private options: { noMangling?: boolean }) {}\n\n async optimize(\n compiler: any,\n compilation: Compilation,\n assets: any,\n cache: CacheFacade,\n {\n SourceMapSource,\n RawSource,\n }: {\n SourceMapSource: typeof sources.SourceMapSource\n RawSource: typeof sources.RawSource\n }\n ) {\n const mangle = !this.options.noMangling\n const compilationSpan = spans.get(compilation)! || spans.get(compiler)\n\n const MinifierSpan = compilationSpan.traceChild(\n 'minify-webpack-plugin-optimize'\n )\n\n if (compilation.name) {\n MinifierSpan.setAttribute('compilationName', compilation.name)\n }\n\n MinifierSpan.setAttribute('mangle', String(mangle))\n\n return MinifierSpan.traceAsyncFn(async () => {\n const assetsList = Object.keys(assets)\n\n const assetsForMinify = await Promise.all(\n assetsList\n .filter((name) => {\n if (\n !ModuleFilenameHelpers.matchObject.bind(\n // eslint-disable-next-line no-undefined\n undefined,\n { test: /\\.[cm]?js(\\?.*)?$/i }\n )(name)\n ) {\n return false\n }\n\n const res = compilation.getAsset(name)\n if (!res) {\n console.log(name)\n return false\n }\n\n const { info } = res\n\n // Skip double minimize assets from child compilation\n if (info.minimized) {\n return false\n }\n\n return true\n })\n .map(async (name) => {\n const { info, source } = compilation.getAsset(name)!\n\n const eTag = cache.mergeEtags(\n cache.getLazyHashedEtag(source),\n JSON.stringify(this.options)\n )\n\n const output = await cache.getPromise<\n { source: sources.Source } | undefined\n >(name, eTag)\n\n if (debugMinify && debugMinify === '1') {\n console.log(\n JSON.stringify({ name, source: source.source().toString() }),\n { breakLength: Infinity, maxStringLength: Infinity }\n )\n }\n return { name, info, inputSource: source, output, eTag }\n })\n )\n\n let initializedWorker: any\n\n // eslint-disable-next-line consistent-return\n const getWorker = () => {\n return {\n minify: async (options: {\n input: string\n inputSourceMap: Object\n }) => {\n const result = await (\n require('../../../../swc') as typeof import('../../../../swc')\n ).minify(options.input, {\n ...(options.inputSourceMap\n ? {\n sourceMap: {\n content: JSON.stringify(options.inputSourceMap),\n },\n }\n : {}),\n // Compress options are defined in crates/napi/src/minify.rs.\n compress: false,\n // Mangle options may be amended in crates/napi/src/minify.rs.\n mangle,\n module: 'unknown',\n output: {\n comments: false,\n },\n })\n\n return result\n },\n }\n }\n\n // The limit in the SWC minifier will be handled by Node.js\n const limit = pLimit(Infinity)\n const scheduledTasks = []\n\n for (const asset of assetsForMinify) {\n scheduledTasks.push(\n limit(async () => {\n const { name, inputSource, eTag } = asset\n let { output } = asset\n\n const minifySpan = MinifierSpan.traceChild('minify-js')\n minifySpan.setAttribute('name', name)\n minifySpan.setAttribute(\n 'cache',\n typeof output === 'undefined' ? 'MISS' : 'HIT'\n )\n\n return minifySpan.traceAsyncFn(async () => {\n if (!output) {\n const { source: sourceFromInputSource, map: inputSourceMap } =\n inputSource.sourceAndMap()\n\n const input = Buffer.isBuffer(sourceFromInputSource)\n ? sourceFromInputSource.toString()\n : sourceFromInputSource\n\n let minifiedOutput: { code: string; map: any } | undefined\n\n try {\n minifiedOutput = await getWorker().minify({\n input,\n inputSourceMap,\n })\n } catch (error) {\n compilation.errors.push(buildError(error, name))\n\n return\n }\n\n const source = minifiedOutput.map\n ? new SourceMapSource(\n minifiedOutput.code,\n name,\n minifiedOutput.map,\n input,\n inputSourceMap,\n true\n )\n : new RawSource(minifiedOutput.code)\n\n await cache.storePromise(name, eTag, { source })\n\n output = { source }\n }\n\n const newInfo = { minimized: true }\n\n compilation.updateAsset(name, output.source, newInfo)\n })\n })\n )\n }\n\n await Promise.all(scheduledTasks)\n\n if (initializedWorker) {\n await initializedWorker.end()\n }\n })\n }\n\n apply(compiler: any) {\n const { SourceMapSource, RawSource } = (compiler?.webpack?.sources ||\n sources) as typeof sources\n\n const pluginName = this.constructor.name\n\n compiler.hooks.thisCompilation.tap(\n pluginName,\n (compilation: Compilation) => {\n const cache = compilation.getCache('MinifierWebpackPlugin')\n\n const handleHashForChunk = (hash: any, _chunk: any) => {\n // increment 'c' to invalidate cache\n hash.update('c')\n }\n\n const JSModulesHooks =\n webpack.javascript.JavascriptModulesPlugin.getCompilationHooks(\n compilation\n )\n JSModulesHooks.chunkHash.tap(pluginName, (chunk, hash) => {\n if (!chunk.hasRuntime()) return\n return handleHashForChunk(hash, chunk)\n })\n\n compilation.hooks.processAssets.tapPromise(\n {\n name: pluginName,\n stage: webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,\n },\n (assets: any) =>\n this.optimize(compiler, compilation, assets, cache, {\n SourceMapSource,\n RawSource,\n })\n )\n\n compilation.hooks.statsPrinter.tap(pluginName, (stats: any) => {\n stats.hooks.print\n .for('asset.info.minimized')\n .tap(\n 'minify-webpack-plugin',\n (minimized: any, { green, formatFlag }: any) =>\n // eslint-disable-next-line no-undefined\n minimized ? green(formatFlag('minimized')) : undefined\n )\n })\n }\n )\n }\n}\n"],"names":["MinifyPlugin","buildError","error","file","line","WebpackError","message","col","stack","split","slice","join","debugMinify","process","env","NEXT_DEBUG_MINIFY","constructor","options","optimize","compiler","compilation","assets","cache","SourceMapSource","RawSource","mangle","noMangling","compilationSpan","spans","get","MinifierSpan","traceChild","name","setAttribute","String","traceAsyncFn","assetsList","Object","keys","assetsForMinify","Promise","all","filter","ModuleFilenameHelpers","matchObject","bind","undefined","test","res","getAsset","console","log","info","minimized","map","source","eTag","mergeEtags","getLazyHashedEtag","JSON","stringify","output","getPromise","toString","breakLength","Infinity","maxStringLength","inputSource","initializedWorker","getWorker","minify","result","require","input","inputSourceMap","sourceMap","content","compress","module","comments","limit","pLimit","scheduledTasks","asset","push","minifySpan","sourceFromInputSource","sourceAndMap","Buffer","isBuffer","minifiedOutput","errors","code","storePromise","newInfo","updateAsset","end","apply","webpack","sources","pluginName","hooks","thisCompilation","tap","getCache","handleHashForChunk","hash","_chunk","update","JSModulesHooks","javascript","JavascriptModulesPlugin","getCompilationHooks","chunkHash","chunk","hasRuntime","processAssets","tapPromise","stage","Compilation","PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE","statsPrinter","stats","print","for","green","formatFlag"],"mappings":";;;;+BAiCaA;;;eAAAA;;;yBA1BN;+DACY;iCACG;;;;;;AAEtB,SAASC,WAAWC,KAAU,EAAEC,IAAY;IAC1C,IAAID,MAAME,IAAI,EAAE;QACd,OAAO,IAAIC,qBAAY,CACrB,GAAGF,KAAK,gBAAgB,EAAED,MAAMI,OAAO,CAAC,EAAE,EAAEH,KAAK,CAAC,EAAED,MAAME,IAAI,CAAC,CAAC,EAC9DF,MAAMK,GAAG,CACV,CAAC,EACAL,MAAMM,KAAK,GAAG,CAAC,EAAE,EAAEN,MAAMM,KAAK,CAACC,KAAK,CAAC,MAAMC,KAAK,CAAC,GAAGC,IAAI,CAAC,OAAO,GAAG,IACnE;IAEN;IAEA,IAAIT,MAAMM,KAAK,EAAE;QACf,OAAO,IAAIH,qBAAY,CACrB,GAAGF,KAAK,gBAAgB,EAAED,MAAMI,OAAO,CAAC,EAAE,EAAEJ,MAAMM,KAAK,EAAE;IAE7D;IAEA,OAAO,IAAIH,qBAAY,CAAC,GAAGF,KAAK,gBAAgB,EAAED,MAAMI,OAAO,EAAE;AACnE;AAEA,MAAMM,cAAcC,QAAQC,GAAG,CAACC,iBAAiB;AAE1C,MAAMf;IACXgB,YAAY,AAAQC,OAAiC,CAAE;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AoC;gBACpCD,KAAKE,MAAM,CAAC;YACd;YAEA,MAAMC,iBACJX,gBAAO,CAACY,UAAU,CAACC,uBAAuB,CAACC,mBAAmB,CAC5D5F;YAEJyF,eAAeI,SAAS,CAACV,GAAG,CAACH,YAAY,CAACc,OAAOR;gBAC/C,IAAI,CAACQ,MAAMC,UAAU,IAAI;gBACzB,OAAOV,mBAAmBC,MAAMQ;YAClC;YAEA9F,YAAYiF,KAAK,CAACe,aAAa,CAACC,UAAU,CACxC;gBACErF,MAAMoE;gBACNkB,OAAOpB,gBAAO,CAACqB,WAAW,CAACC,kCAAkC;YAC/D,GACA,CAACnG,SACC,IAAI,CAACH,QAAQ,CAACC,UAAUC,aAAaC,QAAQC,OAAO;oBAClDC;oBACAC;gBACF;YAGJJ,YAAYiF,KAAK,CAACoB,YAAY,CAAClB,GAAG,CAACH,YAAY,CAACsB;gBAC9CA,MAAMrB,KAAK,CAACsB,KAAK,CACdC,GAAG,CAAC,wBACJrB,GAAG,CACF,yBACA,CAAClD,WAAgB,EAAEwE,KAAK,EAAEC,UAAU,EAAO,GACzC,wCAAwC;oBACxCzE,YAAYwE,MAAMC,WAAW,gBAAgBhF;YAErD;QACF;IAEJ;AACF"}
|
|
@@ -98,7 +98,7 @@ export declare function loadProjectInfo({ dir, config, dev, }: {
|
|
|
98
98
|
supportedBrowsers: string[] | undefined;
|
|
99
99
|
}>;
|
|
100
100
|
export declare function hasExternalOtelApiPackage(): boolean;
|
|
101
|
-
export default function getBaseWebpackConfig(dir: string, { buildId, encryptionKey, config, compilerType, dev, entrypoints, isDevFallback, pagesDir, reactProductionProfiling, rewrites, originalRewrites, originalRedirects, runWebpackSpan, appDir, middlewareMatchers, jsConfig, jsConfigPath, resolvedBaseUrl, supportedBrowsers, clientRouterFilters, fetchCacheKeyPrefix, edgePreviewProps, }: {
|
|
101
|
+
export default function getBaseWebpackConfig(dir: string, { buildId, encryptionKey, config, compilerType, dev, entrypoints, isDevFallback, pagesDir, reactProductionProfiling, rewrites, originalRewrites, originalRedirects, runWebpackSpan, appDir, middlewareMatchers, noMangling, jsConfig, jsConfigPath, resolvedBaseUrl, supportedBrowsers, clientRouterFilters, fetchCacheKeyPrefix, edgePreviewProps, }: {
|
|
102
102
|
buildId: string;
|
|
103
103
|
encryptionKey: string;
|
|
104
104
|
config: NextConfigComplete;
|
|
@@ -288,7 +288,7 @@ function hasExternalOtelApiPackage() {
|
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
const UNSAFE_CACHE_REGEX = /[\\/]pages[\\/][^\\/]+(?:$|\?|#)/;
|
|
291
|
-
async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compilerType, dev = false, entrypoints, isDevFallback = false, pagesDir, reactProductionProfiling = false, rewrites, originalRewrites, originalRedirects, runWebpackSpan, appDir, middlewareMatchers, jsConfig, jsConfigPath, resolvedBaseUrl, supportedBrowsers, clientRouterFilters, fetchCacheKeyPrefix, edgePreviewProps }) {
|
|
291
|
+
async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compilerType, dev = false, entrypoints, isDevFallback = false, pagesDir, reactProductionProfiling = false, rewrites, originalRewrites, originalRedirects, runWebpackSpan, appDir, middlewareMatchers, noMangling, jsConfig, jsConfigPath, resolvedBaseUrl, supportedBrowsers, clientRouterFilters, fetchCacheKeyPrefix, edgePreviewProps }) {
|
|
292
292
|
var _config_experimental, _config_experimental1, _config_watchOptions, _config_experimental_sri, _config_experimental_sri1, _config_compiler, _config_compiler1, _config_compiler2, _jsConfig_compilerOptions, _config_compiler3, _jsConfig_compilerOptions1, _config_compiler4, _jsConfig_compilerOptions2, // always add JsConfigPathsPlugin to allow hot-reloading
|
|
293
293
|
// if the config is added/removed
|
|
294
294
|
_webpackConfig_resolve_plugins, _webpackConfig_resolve, _config_experimental2, _config_compiler5, _config_compiler6, _config_compiler7, _config_compiler8, _config_compiler9, _webpack5Config_plugins, _webpackConfig_module, _webpackConfig_module1, _webpackConfig_module_rules, _webpackConfig_module2;
|
|
@@ -833,7 +833,9 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
|
|
|
833
833
|
(compiler)=>{
|
|
834
834
|
// @ts-ignore No typings yet
|
|
835
835
|
const { MinifyPlugin } = require('./webpack/plugins/minify-webpack-plugin/src/index.js');
|
|
836
|
-
new MinifyPlugin(
|
|
836
|
+
new MinifyPlugin({
|
|
837
|
+
noMangling
|
|
838
|
+
}).apply(compiler);
|
|
837
839
|
},
|
|
838
840
|
// Minify CSS
|
|
839
841
|
(compiler)=>{
|
|
@@ -1534,7 +1536,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
|
|
|
1534
1536
|
isClient && new _copyfileplugin.CopyFilePlugin({
|
|
1535
1537
|
// file path to build output of `@next/polyfill-nomodule`
|
|
1536
1538
|
filePath: require.resolve('./polyfills/polyfill-nomodule'),
|
|
1537
|
-
cacheKey: "15.2.0-canary.
|
|
1539
|
+
cacheKey: "15.2.0-canary.55",
|
|
1538
1540
|
name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
|
|
1539
1541
|
minimize: false,
|
|
1540
1542
|
info: {
|
|
@@ -1767,7 +1769,7 @@ async function getBaseWebpackConfig(dir, { buildId, encryptionKey, config, compi
|
|
|
1767
1769
|
// - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
|
|
1768
1770
|
// - Next.js version
|
|
1769
1771
|
// - next.config.js keys that affect compilation
|
|
1770
|
-
version: `${__dirname}|${"15.2.0-canary.
|
|
1772
|
+
version: `${__dirname}|${"15.2.0-canary.55"}|${configVars}`,
|
|
1771
1773
|
cacheDirectory: _path.default.join(distDir, 'cache', 'webpack'),
|
|
1772
1774
|
// For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
|
|
1773
1775
|
// So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
|