Unverified Commit 351d225f authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Remove isWebpack5 checks (#29677)

* Remove isWebpack5 checks

* Remove next-babel-loader (replaced by babel-turbo-loader), hotSelfAccept, and BuildStatsPlugin

* Remove cacache file

* Remove unused variable

* remove old test

* lint-fix

* update babel-loader tests

* lint-fix

* update compiled
Co-authored-by: 's avatarjj@jjsweb.site <jj@jjsweb.site>
parent c70931bc
......@@ -19,7 +19,6 @@ type PagesMapping = {
export function createPagesMapping(
pagePaths: string[],
extensions: string[],
isWebpack5: boolean,
isDev: boolean
): PagesMapping {
const previousPages: PagesMapping = {}
......@@ -51,7 +50,7 @@ export function createPagesMapping(
// we alias these in development and allow webpack to
// allow falling back to the correct source file so
// that HMR can work properly when a file is added/removed
if (isWebpack5 && isDev) {
if (isDev) {
pages['/_app'] = `${PAGES_DIR_ALIAS}/_app`
pages['/_error'] = `${PAGES_DIR_ALIAS}/_error`
pages['/_document'] = `${PAGES_DIR_ALIAS}/_document`
......
......@@ -89,7 +89,6 @@ import getBaseWebpackConfig from './webpack-config'
import { PagesManifest } from './webpack/plugins/pages-manifest-plugin'
import { writeBuildId } from './write-build-id'
import { normalizeLocalePath } from '../shared/lib/i18n/normalize-locale-path'
import { isWebpack5 } from 'next/dist/compiled/webpack/webpack'
import { NextConfigComplete } from '../server/config-shared'
import isError from '../lib/is-error'
import { TelemetryPlugin } from './webpack/plugins/telemetry-plugin'
......@@ -170,7 +169,7 @@ export default async function build(
telemetry.record(
eventCliSession(PHASE_PRODUCTION_BUILD, dir, {
webpackVersion: isWebpack5 ? 5 : 4,
webpackVersion: 5,
cliCommand: 'build',
isSrcDir: path.relative(dir, pagesDir!).startsWith('src'),
hasNowJson: !!(await findUp('now.json', { cwd: dir })),
......@@ -263,7 +262,7 @@ export default async function build(
const mappedPages = nextBuildSpan
.traceChild('create-pages-mapping')
.traceFn(() =>
createPagesMapping(pagePaths, config.pageExtensions, isWebpack5, false)
createPagesMapping(pagePaths, config.pageExtensions, false)
)
const entrypoints = nextBuildSpan
.traceChild('create-entrypoints')
......
......@@ -35,7 +35,6 @@ import * as Log from './output/log'
import { build as buildConfiguration } from './webpack/config'
import { __overrideCssConfiguration } from './webpack/config/blocks/css/overrideCssConfiguration'
import BuildManifestPlugin from './webpack/plugins/build-manifest-plugin'
import BuildStatsPlugin from './webpack/plugins/build-stats-plugin'
import { JsConfigPathsPlugin } from './webpack/plugins/jsconfig-paths-plugin'
import { DropClientPage } from './webpack/plugins/next-drop-client-page-plugin'
import { TraceEntryPointsPlugin } from './webpack/plugins/next-trace-entrypoints-plugin'
......@@ -321,10 +320,6 @@ export default async function getBaseWebpackConfig(
hasJsxRuntime: true,
},
},
// Backwards compat
hotSelfAccept: {
loader: 'noop-loader',
},
}
const babelIncludeRegexes: RegExp[] = [
......@@ -995,13 +990,12 @@ export default async function getBaseWebpackConfig(
// The loaders Next.js provides
alias: [
'error-loader',
'next-babel-loader',
'next-swc-loader',
'next-client-pages-loader',
'next-image-loader',
'next-serverless-loader',
'noop-loader',
'next-style-loader',
'noop-loader',
].reduce((alias, loader) => {
// using multiple aliases to replace `resolveLoader.modules`
alias[loader] = path.join(__dirname, 'webpack', 'loaders', loader)
......@@ -1240,12 +1234,6 @@ export default async function getBaseWebpackConfig(
rewrites,
isDevFallback,
}),
!dev &&
!isServer &&
config.experimental.stats &&
new BuildStatsPlugin({
distDir,
}),
new ProfilingPlugin({ runWebpackSpan }),
config.optimizeFonts &&
!dev &&
......
import curry from 'next/dist/compiled/lodash.curry'
import { webpack, isWebpack5 } from 'next/dist/compiled/webpack/webpack'
import { webpack } from 'next/dist/compiled/webpack/webpack'
import { ConfigurationContext } from '../utils'
export const base = curry(function base(
......@@ -8,12 +8,8 @@ export const base = curry(function base(
) {
config.mode = ctx.isDevelopment ? 'development' : 'production'
config.name = ctx.isServer ? 'server' : 'client'
if (isWebpack5) {
// @ts-ignore TODO webpack 5 typings
config.target = ctx.isServer ? 'node12.17' : ['web', 'es5']
} else {
config.target = ctx.isServer ? 'node' : 'web'
}
// @ts-ignore TODO webpack 5 typings
config.target = ctx.isServer ? 'node12.17' : ['web', 'es5']
// Stop compilation early in a production build when an error is encountered.
// This behavior isn't desirable in development due to how the HMR system
......@@ -45,7 +41,7 @@ export const base = curry(function base(
}
// TODO: add codemod for "Should not import the named export" with JSON files
config.module.strictExportPresence = !isWebpack5
// config.module.strictExportPresence = !isWebpack5
return config
})
import curry from 'next/dist/compiled/lodash.curry'
import { webpack, isWebpack5 } from 'next/dist/compiled/webpack/webpack'
import { webpack } from 'next/dist/compiled/webpack/webpack'
import MiniCssExtractPlugin from '../../../plugins/mini-css-extract-plugin'
import { loader, plugin } from '../../helpers'
import { ConfigurationContext, ConfigurationFn, pipe } from '../../utils'
......@@ -382,7 +382,7 @@ export const css = curry(async function css(
plugin(
// @ts-ignore webpack 5 compat
new MiniCssExtractPlugin({
experimentalUseImportModule: isWebpack5,
experimentalUseImportModule: true,
filename: 'static/css/[contenthash].css',
chunkFilename: 'static/css/[contenthash].css',
// Next.js guarantees that CSS order "doesn't matter", due to imposed
......
Copyright (c) 2014-2019 Luís Couto <hello@luiscouto.pt>
MIT License
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
const STRIP_FILENAME_RE = /^[^:]+: /
const format = (err) => {
if (err instanceof SyntaxError) {
err.name = 'SyntaxError'
err.message = err.message.replace(STRIP_FILENAME_RE, '')
err.hideStack = true
} else if (err instanceof TypeError) {
err.name = null
err.message = err.message.replace(STRIP_FILENAME_RE, '')
err.hideStack = true
}
return err
}
class LoaderError extends Error {
constructor(err) {
super()
const { name, message, codeFrame, hideStack } = format(err)
this.name = 'BabelLoaderError'
this.message = `${name ? `${name}: ` : ''}${message}\n\n${codeFrame}\n`
this.hideStack = hideStack
Error.captureStackTrace(this, this.constructor)
}
}
export default LoaderError
import { createHash } from 'crypto'
import { trace } from '../../../../../trace'
import transform from './transform'
import cacache from 'next/dist/compiled/cacache'
async function read(cacheDirectory, etag) {
const cachedResult = await trace('read-cache-file').traceAsyncFn(() =>
cacache.get(cacheDirectory, etag)
)
return JSON.parse(cachedResult.data)
}
function write(cacheDirectory, etag, data) {
return trace('write-cache-file').traceAsyncFn(() =>
cacache.put(cacheDirectory, etag, JSON.stringify(data))
)
}
const etag = function (source, identifier, options) {
return trace('etag').traceFn(() => {
const hash = createHash('md4')
const contents = JSON.stringify({ source, options, identifier })
hash.update(contents)
return hash.digest('hex')
})
}
export default async function handleCache(params) {
const span = trace('handle-cache')
return span.traceAsyncFn(async () => {
const { source, options = {}, cacheIdentifier, cacheDirectory } = params
const file = etag(source, cacheIdentifier)
try {
// No errors mean that the file was previously cached
// we just need to return it
const res = await read(cacheDirectory, file)
span.setAttribute('cache', res ? 'HIT' : 'MISS')
return res
} catch (err) {}
// Otherwise just transform the file
// return it to the user asap and write it in cache
const result = await trace('transform').traceAsyncFn(async () => {
return transform(source, options)
})
await write(cacheDirectory, file, result)
return result
})
}
// import babel from 'next/dist/compiled/babel/core'
import loaderUtils from 'next/dist/compiled/loader-utils'
import { trace } from '../../../../../trace'
import cache from './cache'
import transform from './transform'
// When using `import` Babel will be undefined
const babel = require('next/dist/compiled/babel/core')
export default function makeLoader(callback) {
const overrides = callback(babel)
return function (source, inputSourceMap) {
// Make the loader async
const cb = this.async()
loader.call(this, source, inputSourceMap, overrides).then(
(args) => cb(null, ...args),
(err) => cb(err)
)
}
}
async function loader(source, inputSourceMap, overrides) {
// this.currentTraceSpan is provided by profiling-plugin.ts
const loaderSpan = trace('babel-loader', this.currentTraceSpan?.id)
return loaderSpan.traceAsyncFn(async () => {
const filename = this.resourcePath
loaderSpan.setAttribute('filename', filename)
let loaderOptions = loaderUtils.getOptions(this) || {}
let customOptions
if (overrides && overrides.customOptions) {
const customoptionsSpan = trace('loader-overrides-customoptions')
const result = await customoptionsSpan.traceAsyncFn(
async () =>
await overrides.customOptions.call(this, loaderOptions, {
source,
map: inputSourceMap,
})
)
customOptions = result.custom
loaderOptions = result.loader
}
// Standardize on 'sourceMaps' as the key passed through to Webpack, so that
// users may safely use either one alongside our default use of
// 'this.sourceMap' below without getting error about conflicting aliases.
if (
Object.prototype.hasOwnProperty.call(loaderOptions, 'sourceMap') &&
!Object.prototype.hasOwnProperty.call(loaderOptions, 'sourceMaps')
) {
loaderOptions = Object.assign({}, loaderOptions, {
sourceMaps: loaderOptions.sourceMap,
})
delete loaderOptions.sourceMap
}
const programmaticOptions = Object.assign({}, loaderOptions, {
filename,
inputSourceMap: inputSourceMap || undefined,
// Set the default sourcemap behavior based on Webpack's mapping flag,
// but allow users to override if they want.
sourceMaps:
loaderOptions.sourceMaps === undefined
? this.sourceMap
: loaderOptions.sourceMaps,
// Ensure that Webpack will get a full absolute path in the sourcemap
// so that it can properly map the module back to its internal cached
// modules.
sourceFileName: filename,
caller: {
name: 'babel-loader',
// Provide plugins with insight into webpack target.
// https://github.com/babel/babel-loader/issues/787
target: this.target,
// Webpack >= 2 supports ESM and dynamic import.
supportsStaticESM: true,
supportsDynamicImport: true,
// Webpack 5 supports TLA behind a flag. We enable it by default
// for Babel, and then webpack will throw an error if the experimental
// flag isn't enabled.
supportsTopLevelAwait: true,
...loaderOptions.caller,
},
})
// Remove loader related options
delete programmaticOptions.cacheDirectory
delete programmaticOptions.cacheIdentifier
const partialConfigSpan = trace('babel-load-partial-config-async')
const config = partialConfigSpan.traceFn(() => {
return babel.loadPartialConfig(programmaticOptions)
})
if (config) {
let options = config.options
if (overrides && overrides.config) {
const overridesSpan = trace('loader-overrides-config')
options = await overridesSpan.traceAsyncFn(
async () =>
await overrides.config.call(this, config, {
source,
map: inputSourceMap,
customOptions,
})
)
}
if (options.sourceMaps === 'inline') {
// Babel has this weird behavior where if you set "inline", we
// inline the sourcemap, and set 'result.map = null'. This results
// in bad behavior from Babel since the maps get put into the code,
// which Webpack does not expect, and because the map we return to
// Webpack is null, which is also bad. To avoid that, we override the
// behavior here so "inline" just behaves like 'true'.
options.sourceMaps = true
}
const { cacheDirectory, cacheIdentifier } = loaderOptions
let result
if (cacheDirectory) {
result = await cache({
source,
options,
cacheDirectory,
cacheIdentifier,
cacheCompression: false,
})
} else {
const transformSpan = trace('transform')
transformSpan.setAttribute('filename', filename)
transformSpan.setAttribute('cache', 'DISABLED')
result = await transformSpan.traceAsyncFn(async () => {
return transform(source, options)
})
}
// TODO: Babel should really provide the full list of config files that
// were used so that this can also handle files loaded with 'extends'.
if (typeof config.babelrc === 'string') {
this.addDependency(config.babelrc)
}
if (result) {
const { code, map } = result
return [code, map]
}
}
// If the file was ignored, pass through the original content.
return [source, inputSourceMap]
})
}
import { transform as _transform } from 'next/dist/compiled/babel/core'
import { promisify } from 'util'
import LoaderError from './Error'
const transform = promisify(_transform)
export default async function (source, options) {
let result
try {
result = await transform(source, options)
} catch (err) {
throw err.message && err.codeFrame ? new LoaderError(err) : err
}
if (!result) return null
// We don't return the full result here because some entries are not
// really serializable. For a full list of properties see here:
// https://github.com/babel/babel/blob/main/packages/babel-core/src/transformation/index.js
// For discussion on this topic see here:
// https://github.com/babel/babel-loader/pull/629
const { ast, code, map, metadata, sourceType } = result
if (map && (!map.sourcesContent || !map.sourcesContent.length)) {
map.sourcesContent = [source]
}
return { ast, code, map, metadata, sourceType }
}
import { join } from 'path'
import * as Log from '../../output/log'
import babelLoader from './babel-loader/src/index'
// increment 'p' to invalidate cache
// eslint-disable-next-line no-useless-concat
const cacheKey = 'babel-cache-' + 'p' + '-'
const nextBabelPreset = require('../../babel/preset')
const customBabelLoader = babelLoader((babel) => {
const presetItem = babel.createConfigItem(nextBabelPreset, {
type: 'preset',
})
const applyCommonJs = babel.createConfigItem(
require('../../babel/plugins/commonjs'),
{ type: 'plugin' }
)
const commonJsItem = babel.createConfigItem(
require('next/dist/compiled/babel/plugin-transform-modules-commonjs'),
{ type: 'plugin' }
)
const configs = new Set()
return {
customOptions(opts) {
const custom = {
isServer: opts.isServer,
pagesDir: opts.pagesDir,
development: opts.development,
hasReactRefresh: opts.hasReactRefresh,
hasJsxRuntime: opts.hasJsxRuntime,
}
const filename = join(opts.cwd, 'noop.js')
const loader = Object.assign(
opts.cache
? {
cacheDirectory: join(opts.distDir, 'cache', 'next-babel-loader'),
cacheIdentifier:
cacheKey +
(opts.isServer ? '-server' : '') +
'-new-polyfills' +
(opts.development ? '-development' : '-production') +
(opts.hasReactRefresh ? '-react-refresh' : '') +
(opts.hasJsxRuntime ? '-jsx-runtime' : '') +
JSON.stringify(
babel.loadPartialConfig({
filename,
cwd: opts.cwd,
sourceFileName: filename,
}).options
),
}
: {
cacheDirectory: false,
},
opts
)
delete loader.isServer
delete loader.cache
delete loader.distDir
delete loader.pagesDir
delete loader.development
delete loader.hasReactRefresh
delete loader.hasJsxRuntime
return { loader, custom }
},
config(
cfg,
{
source,
customOptions: {
isServer,
pagesDir,
development,
hasReactRefresh,
hasJsxRuntime,
},
}
) {
const filename = this.resourcePath
const options = Object.assign({}, cfg.options)
const isPageFile = filename.startsWith(pagesDir)
if (cfg.hasFilesystemConfig()) {
for (const file of [cfg.babelrc, cfg.config]) {
// We only log for client compilation otherwise there will be double output
if (file && !isServer && !configs.has(file)) {
configs.add(file)
Log.info(`Using external babel configuration from ${file}`)
}
}
} else {
// Add our default preset if the no "babelrc" found.
options.presets = [...options.presets, presetItem]
}
options.caller.isServer = isServer
options.caller.isDev = development
options.caller.hasJsxRuntime = hasJsxRuntime
options.caller.pagesDir = pagesDir
const emitWarning = this.emitWarning.bind(this)
Object.defineProperty(options.caller, 'onWarning', {
enumerable: false,
writable: false,
value: (options.caller.onWarning = function (reason) {
if (!(reason instanceof Error)) {
reason = new Error(reason)
}
emitWarning(reason)
}),
})
options.plugins = options.plugins || []
if (hasReactRefresh) {
const reactRefreshPlugin = babel.createConfigItem(
[require('react-refresh/babel'), { skipEnvCheck: true }],
{ type: 'plugin' }
)
options.plugins.unshift(reactRefreshPlugin)
if (!isServer) {
const noAnonymousDefaultExportPlugin = babel.createConfigItem(
[require('../../babel/plugins/no-anonymous-default-export'), {}],
{ type: 'plugin' }
)
options.plugins.unshift(noAnonymousDefaultExportPlugin)
}
}
if (!isServer && isPageFile) {
const pageConfigPlugin = babel.createConfigItem(
[require('../../babel/plugins/next-page-config')],
{ type: 'plugin' }
)
options.plugins.push(pageConfigPlugin)
const diallowExportAll = babel.createConfigItem(
[
require('../../babel/plugins/next-page-disallow-re-export-all-exports'),
],
{ type: 'plugin' }
)
options.plugins.push(diallowExportAll)
}
// If the file has `module.exports` we have to transpile commonjs because Babel adds `import` statements
// That break webpack, since webpack doesn't support combining commonjs and esmodules
if (source.indexOf('module.exports') !== -1) {
options.plugins.push(applyCommonJs)
}
options.plugins.push([
require.resolve('next/dist/compiled/babel/plugin-transform-define'),
{
'process.env.NODE_ENV': development ? 'development' : 'production',
'typeof window': isServer ? 'undefined' : 'object',
'process.browser': isServer ? false : true,
},
'next-js-transform-define-instance',
])
if (isPageFile) {
if (!isServer) {
options.plugins.push([
require.resolve('../../babel/plugins/next-ssg-transform'),
{},
])
}
}
// As shared/lib has stateful modules we have to transpile commonjs
options.overrides = [
...(options.overrides || []),
{
test: [
/next[\\/]dist[\\/]shared[\\/]lib/,
/next[\\/]dist[\\/]client/,
/next[\\/]dist[\\/]pages/,
],
plugins: [commonJsItem],
},
]
return options
},
}
})
export default customBabelLoader
import devalue from 'next/dist/compiled/devalue'
import {
webpack,
isWebpack5,
sources,
} from 'next/dist/compiled/webpack/webpack'
import { webpack, sources } from 'next/dist/compiled/webpack/webpack'
import {
BUILD_MANIFEST,
CLIENT_STATIC_FILES_PATH,
......@@ -243,25 +239,19 @@ export default class BuildManifestPlugin {
}
apply(compiler: webpack.Compiler) {
if (isWebpack5) {
compiler.hooks.make.tap('NextJsBuildManifest', (compilation) => {
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
compilation.hooks.processAssets.tap(
{
name: 'NextJsBuildManifest',
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
},
(assets: any) => {
this.createAssets(compiler, compilation, assets)
}
)
})
return
}
compiler.hooks.emit.tap('NextJsBuildManifest', (compilation: any) => {
this.createAssets(compiler, compilation, compilation.assets)
compiler.hooks.make.tap('NextJsBuildManifest', (compilation) => {
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
compilation.hooks.processAssets.tap(
{
name: 'NextJsBuildManifest',
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
},
(assets: any) => {
this.createAssets(compiler, compilation, assets)
}
)
})
return
}
}
import fs from 'fs'
import path from 'path'
import { Transform, TransformCallback } from 'stream'
// @ts-ignore no types package
import bfj from 'next/dist/compiled/bfj'
import { spans } from './profiling-plugin'
import { isWebpack5 } from 'next/dist/compiled/webpack/webpack'
import type webpack from 'webpack'
import type webpack4 from 'webpack4'
import type webpack5 from 'webpack5'
const STATS_VERSION = 0
function reduceSize(stats: any) {
stats.chunks = stats.chunks.map((chunk: any) => {
const reducedChunk: any = {
id: chunk.id,
files: chunk.files,
size: chunk.size,
}
for (const module of chunk.modules) {
if (!module.id) {
continue
}
if (!reducedChunk.modules) {
reducedChunk.modules = []
}
reducedChunk.modules.push(module.id)
}
return reducedChunk
})
stats.modules = stats.modules.map((module: any) => {
const reducedModule: any = {
type: module.type,
moduleType: module.moduleType,
size: module.size,
name: module.name,
}
if (module.reasons) {
for (const reason of module.reasons) {
if (!reason.moduleName || reason.moduleId === module.id) {
continue
}
if (!reducedModule.reasons) {
reducedModule.reasons = []
}
reducedModule.reasons.push(reason.moduleId)
}
}
return [module.id, reducedModule]
})
for (const entrypointName in stats.entrypoints) {
delete stats.entrypoints[entrypointName].assets
}
return stats
}
const THRESHOLD = 16 * 1024
class BufferingStream extends Transform {
private items: Buffer[] = []
private itemsSize = 0
_transform(
chunk: Buffer | string,
encoding: BufferEncoding,
callback: TransformCallback
): void {
const buffer = Buffer.isBuffer(chunk)
? chunk
: Buffer.from(chunk as string, encoding)
const size = buffer.length
if (this.itemsSize > 0 && this.itemsSize + size > THRESHOLD) {
this.push(Buffer.concat(this.items))
this.itemsSize = 0
this.items.length = 0
}
if (size > THRESHOLD) {
this.push(buffer)
} else {
this.items.push(buffer)
this.itemsSize += size
}
callback()
}
_flush(callback: TransformCallback): void {
if (this.itemsSize > 0) {
this.push(Buffer.concat(this.items))
this.itemsSize = 0
this.items.length = 0
}
callback()
}
}
// This plugin creates a stats.json for a build when enabled
export default class BuildStatsPlugin {
private distDir: string
constructor(options: { distDir: string }) {
this.distDir = options.distDir
}
apply(compiler: webpack.Compiler) {
compiler.hooks.done.tapAsync(
'NextJsBuildStats',
async (stats, callback) => {
const compilationSpan =
spans.get(stats.compilation) || spans.get(compiler)
try {
const writeStatsSpan = compilationSpan!.traceChild('NextJsBuildStats')
await writeStatsSpan.traceAsyncFn(() => {
return new Promise((resolve, reject) => {
const baseOptions = {
all: false,
cached: true,
reasons: true,
entrypoints: true,
chunks: true,
errors: false,
warnings: false,
maxModules: Infinity,
chunkModules: true,
modules: true,
}
const statsJson = reduceSize(
isWebpack5
? (stats as webpack5.Stats).toJson({
...baseOptions,
modulesSpace: Infinity,
ids: true,
})
: (stats as webpack4.Stats).toJson({
...baseOptions,
maxModules: Infinity,
})
)
const fileStream = fs.createWriteStream(
path.join(this.distDir, 'next-stats.json'),
{ highWaterMark: THRESHOLD }
)
const jsonStream = bfj.streamify({
version: STATS_VERSION,
stats: statsJson,
})
jsonStream.pipe(new BufferingStream()).pipe(fileStream)
jsonStream.on('error', reject)
fileStream.on('error', reject)
jsonStream.on('dataError', reject)
fileStream.on('close', resolve)
})
})
callback()
} catch (err) {
callback(err)
}
}
)
}
}
import { promises as fs } from 'fs'
import loaderUtils from 'next/dist/compiled/loader-utils'
import {
isWebpack5,
sources,
webpack,
} from 'next/dist/compiled/webpack/webpack'
import { sources, webpack } from 'next/dist/compiled/webpack/webpack'
const PLUGIN_NAME = 'CopyFilePlugin'
......@@ -34,19 +30,14 @@ export class CopyFilePlugin {
apply(compiler: webpack.Compiler) {
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation: any) => {
const cache = isWebpack5 ? compilation.getCache('CopyFilePlugin') : null
const hook = isWebpack5
? // @ts-ignore
compilation.hooks.processAssets
: compilation.hooks.additionalAssets
const cache = compilation.getCache('CopyFilePlugin')
const hook = compilation.hooks.processAssets
hook.tapPromise(
isWebpack5
? {
name: PLUGIN_NAME,
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
}
: PLUGIN_NAME,
{
name: PLUGIN_NAME,
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
},
async () => {
if (cache) {
const cachedResult = await cache.getPromise(
......
import cssnanoSimple from 'cssnano-simple'
import postcssScss from 'next/dist/compiled/postcss-scss'
import postcss, { Parser } from 'postcss'
import {
webpack,
isWebpack5,
sources,
} from 'next/dist/compiled/webpack/webpack'
import { webpack, sources } from 'next/dist/compiled/webpack/webpack'
import { spans } from './profiling-plugin'
// https://github.com/NMFR/optimize-css-assets-webpack-plugin/blob/0a410a9bf28c7b0e81a3470a13748e68ca2f50aa/src/index.js#L20
......@@ -60,89 +56,48 @@ export class CssMinimizerPlugin {
apply(compiler: webpack.Compiler) {
compiler.hooks.compilation.tap('CssMinimizerPlugin', (compilation: any) => {
if (isWebpack5) {
const cache = compilation.getCache('CssMinimizerPlugin')
compilation.hooks.processAssets.tapPromise(
{
name: 'CssMinimizerPlugin',
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,
},
async (assets: any) => {
const compilationSpan =
spans.get(compilation) || spans.get(compiler)
const cssMinimizerSpan = compilationSpan!.traceChild(
'css-minimizer-plugin'
)
cssMinimizerSpan.setAttribute('webpackVersion', 5)
return cssMinimizerSpan.traceAsyncFn(async () => {
const files = Object.keys(assets)
await Promise.all(
files
.filter((file) => CSS_REGEX.test(file))
.map(async (file) => {
const assetSpan = cssMinimizerSpan.traceChild('minify-css')
assetSpan.setAttribute('file', file)
return assetSpan.traceAsyncFn(async () => {
const asset = assets[file]
const etag = cache.getLazyHashedEtag(asset)
const cachedResult = await cache.getPromise(file, etag)
assetSpan.setAttribute(
'cache',
cachedResult ? 'HIT' : 'MISS'
)
if (cachedResult) {
assets[file] = cachedResult
return
}
const result = await this.optimizeAsset(file, asset)
await cache.storePromise(file, etag, result)
assets[file] = result
})
})
)
})
}
)
return
}
compilation.hooks.optimizeChunkAssets.tapPromise(
'CssMinimizerPlugin',
(chunks: webpack.compilation.Chunk[]) => {
const cache = compilation.getCache('CssMinimizerPlugin')
compilation.hooks.processAssets.tapPromise(
{
name: 'CssMinimizerPlugin',
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,
},
async (assets: any) => {
const compilationSpan = spans.get(compilation) || spans.get(compiler)
const cssMinimizerSpan = compilationSpan!.traceChild(
'css-minimizer-plugin'
)
cssMinimizerSpan.setAttribute('webpackVersion', 4)
cssMinimizerSpan.setAttribute('compilationName', compilation.name)
cssMinimizerSpan.setAttribute('webpackVersion', 5)
return cssMinimizerSpan.traceAsyncFn(async () => {
return await Promise.all(
chunks
.reduce(
(acc, chunk) => acc.concat(chunk.files || []),
[] as string[]
)
.filter((entry) => CSS_REGEX.test(entry))
const files = Object.keys(assets)
await Promise.all(
files
.filter((file) => CSS_REGEX.test(file))
.map(async (file) => {
const assetSpan = cssMinimizerSpan.traceChild('minify-css')
assetSpan.setAttribute('file', file)
return assetSpan.traceAsyncFn(async () => {
const asset = compilation.assets[file]
// Makes trace attributes the same as webpack 5
// When using webpack 4 the result is not cached
assetSpan.setAttribute('cache', 'MISS')
compilation.assets[file] = await this.optimizeAsset(
file,
asset
const asset = assets[file]
const etag = cache.getLazyHashedEtag(asset)
const cachedResult = await cache.getPromise(file, etag)
assetSpan.setAttribute(
'cache',
cachedResult ? 'HIT' : 'MISS'
)
if (cachedResult) {
assets[file] = cachedResult
return
}
const result = await this.optimizeAsset(file, asset)
await cache.storePromise(file, etag, result)
assets[file] = result
})
})
)
......
import {
webpack,
BasicEvaluatedExpression,
isWebpack5,
sources,
} from 'next/dist/compiled/webpack/webpack'
import {
......@@ -73,10 +72,8 @@ export class FontStylesheetGatheringPlugin {
result.setExpression(node)
result.setIdentifier(node.name)
// This was added webpack 5.
if (isWebpack5) {
result.getMembers = () => []
}
// This was added in webpack 5.
result.getMembers = () => []
}
return result
})
......@@ -123,15 +120,13 @@ export class FontStylesheetGatheringPlugin {
this.gatheredStylesheets.push(props.href)
if (isWebpack5) {
const buildInfo = parser?.state?.module?.buildInfo
const buildInfo = parser?.state?.module?.buildInfo
if (buildInfo) {
buildInfo.valueDependencies.set(
FONT_MANIFEST,
this.gatheredStylesheets
)
}
if (buildInfo) {
buildInfo.valueDependencies.set(
FONT_MANIFEST,
this.gatheredStylesheets
)
}
}
......@@ -169,11 +164,9 @@ export class FontStylesheetGatheringPlugin {
(source: string) => {
return `${source}
// Font manifest declaration
${
isWebpack5 ? '__webpack_require__' : mainTemplate.requireFn
}.__NEXT_FONT_MANIFEST__ = ${JSON.stringify(
this.manifestContent
)};
__webpack_require__.__NEXT_FONT_MANIFEST__ = ${JSON.stringify(
this.manifestContent
)};
// Enable feature:
process.env.__NEXT_OPTIMIZE_FONTS = JSON.stringify(true);`
}
......@@ -184,18 +177,16 @@ export class FontStylesheetGatheringPlugin {
async (modules: any, modulesFinished: Function) => {
let fontStylesheets = this.gatheredStylesheets
if (isWebpack5) {
const fontUrls = new Set<string>()
modules.forEach((module: any) => {
const fontDependencies =
module?.buildInfo?.valueDependencies?.get(FONT_MANIFEST)
if (fontDependencies) {
fontDependencies.forEach((v: string) => fontUrls.add(v))
}
})
const fontUrls = new Set<string>()
modules.forEach((module: any) => {
const fontDependencies =
module?.buildInfo?.valueDependencies?.get(FONT_MANIFEST)
if (fontDependencies) {
fontDependencies.forEach((v: string) => fontUrls.add(v))
}
})
fontStylesheets = Array.from(fontUrls)
}
fontStylesheets = Array.from(fontUrls)
const fontDefinitionPromises = fontStylesheets.map((url) =>
getFontDefinitionFromNetwork(url)
......@@ -213,34 +204,32 @@ export class FontStylesheetGatheringPlugin {
})
}
}
if (!isWebpack5) {
compilation.assets[FONT_MANIFEST] = new sources.RawSource(
JSON.stringify(this.manifestContent, null, ' ')
)
}
compilation.assets[FONT_MANIFEST] = new sources.RawSource(
JSON.stringify(this.manifestContent, null, ' ')
)
modulesFinished()
}
)
cb()
})
if (isWebpack5) {
compiler.hooks.make.tap(this.constructor.name, (compilation) => {
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
compilation.hooks.processAssets.tap(
{
name: this.constructor.name,
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
},
(assets: any) => {
assets['../' + FONT_MANIFEST] = new sources.RawSource(
JSON.stringify(this.manifestContent, null, ' ')
)
}
)
})
}
compiler.hooks.make.tap(this.constructor.name, (compilation) => {
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
compilation.hooks.processAssets.tap(
{
name: this.constructor.name,
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
},
(assets: any) => {
assets['../' + FONT_MANIFEST] = new sources.RawSource(
JSON.stringify(this.manifestContent, null, ' ')
)
}
)
})
}
}
......
import { webpack } from 'next/dist/compiled/webpack/webpack'
import { isWebpack5 } from 'next/dist/compiled/webpack/webpack'
import { STRING_LITERAL_DROP_BUNDLE } from '../../../shared/lib/constants'
export const ampFirstEntryNamesMap: WeakMap<
......@@ -21,21 +20,13 @@ export class DropClientPage implements webpack.Plugin {
function findEntryModule(mod: any): webpack.compilation.Module | null {
const queue = new Set([mod])
for (const module of queue) {
if (isWebpack5) {
// @ts-ignore TODO: webpack 5 types
const incomingConnections =
compilation.moduleGraph.getIncomingConnections(module)
for (const incomingConnection of incomingConnections) {
if (!incomingConnection.originModule) return module
queue.add(incomingConnection.originModule)
}
continue
}
// @ts-ignore TODO: webpack 5 types
const incomingConnections =
compilation.moduleGraph.getIncomingConnections(module)
for (const reason of module.reasons) {
if (!reason.module) return module
queue.add(reason.module)
for (const incomingConnection of incomingConnections) {
if (!incomingConnection.originModule) return module
queue.add(incomingConnection.originModule)
}
}
......@@ -54,18 +45,11 @@ export class DropClientPage implements webpack.Plugin {
entryModule.buildInfo.NEXT_ampFirst = true
}
if (isWebpack5) {
parser.hooks.preDeclarator.tap(PLUGIN_NAME, (declarator: any) => {
if (declarator?.id?.name === STRING_LITERAL_DROP_BUNDLE) {
markAsAmpFirst()
}
})
return
}
parser.hooks.varDeclaration
.for(STRING_LITERAL_DROP_BUNDLE)
.tap(PLUGIN_NAME, markAsAmpFirst)
parser.hooks.preDeclarator.tap(PLUGIN_NAME, (declarator: any) => {
if (declarator?.id?.name === STRING_LITERAL_DROP_BUNDLE) {
markAsAmpFirst()
}
})
}
normalModuleFactory.hooks.parser
......@@ -89,39 +73,16 @@ export class DropClientPage implements webpack.Plugin {
) as string[]
compilation.hooks.seal.tap(PLUGIN_NAME, () => {
if (isWebpack5) {
for (const [name, entryData] of compilation.entries) {
for (const dependency of entryData.dependencies) {
// @ts-ignore TODO: webpack 5 types
const module = compilation.moduleGraph.getModule(dependency)
if (module?.buildInfo?.NEXT_ampFirst) {
ampFirstEntryNamesItem.push(name)
// @ts-ignore @types/webpack has outdated types for webpack 5
compilation.entries.delete(name)
}
for (const [name, entryData] of compilation.entries) {
for (const dependency of entryData.dependencies) {
// @ts-ignore TODO: webpack 5 types
const module = compilation.moduleGraph.getModule(dependency)
if (module?.buildInfo?.NEXT_ampFirst) {
ampFirstEntryNamesItem.push(name)
// @ts-ignore @types/webpack has outdated types for webpack 5
compilation.entries.delete(name)
}
}
return
}
// Remove preparedEntrypoint that has bundle drop marker
// This will ensure webpack does not create chunks/bundles for this particular entrypoint
for (
let i = compilation._preparedEntrypoints.length - 1;
i >= 0;
i--
) {
const entrypoint = compilation._preparedEntrypoints[i]
if (entrypoint?.module?.buildInfo?.NEXT_ampFirst) {
ampFirstEntryNamesItem.push(entrypoint.name)
compilation._preparedEntrypoints.splice(i, 1)
}
}
for (let i = compilation.entries.length - 1; i >= 0; i--) {
const entryModule = compilation.entries[i]
if (entryModule?.buildInfo?.NEXT_ampFirst) {
compilation.entries.splice(i, 1)
}
}
})
}
......
import { webpack } from 'next/dist/compiled/webpack/webpack'
import { isWebpack5 } from 'next/dist/compiled/webpack/webpack'
import { realpathSync } from 'fs'
import path from 'path'
import isError from '../../../lib/is-error'
......@@ -44,64 +43,41 @@ export class NextJsRequireCacheHotReloader implements webpack.Plugin {
currentOutputPathsWebpack5: Set<string> = new Set()
apply(compiler: webpack.Compiler) {
if (isWebpack5) {
// @ts-ignored Webpack has this hooks
compiler.hooks.assetEmitted.tap(
PLUGIN_NAME,
(_file: any, { targetPath }: any) => {
this.currentOutputPathsWebpack5.add(targetPath)
deleteCache(targetPath)
}
)
compiler.hooks.afterEmit.tap(PLUGIN_NAME, (compilation) => {
RUNTIME_NAMES.forEach((name) => {
const runtimeChunkPath = path.join(
compilation.outputOptions.path,
`${name}.js`
)
deleteCache(runtimeChunkPath)
})
// @ts-ignored Webpack has this hooks
compiler.hooks.assetEmitted.tap(
PLUGIN_NAME,
(_file: any, { targetPath }: any) => {
this.currentOutputPathsWebpack5.add(targetPath)
deleteCache(targetPath)
}
)
// we need to make sure to clear all server entries from cache
// since they can have a stale webpack-runtime cache
// which needs to always be in-sync
const entries = [...compilation.entries.keys()].filter((entry) =>
entry.toString().startsWith('pages/')
compiler.hooks.afterEmit.tap(PLUGIN_NAME, (compilation) => {
RUNTIME_NAMES.forEach((name) => {
const runtimeChunkPath = path.join(
compilation.outputOptions.path,
`${name}.js`
)
entries.forEach((page) => {
const outputPath = path.join(
compilation.outputOptions.path,
page + '.js'
)
deleteCache(outputPath)
})
deleteCache(runtimeChunkPath)
})
this.previousOutputPathsWebpack5 = new Set(
this.currentOutputPathsWebpack5
// we need to make sure to clear all server entries from cache
// since they can have a stale webpack-runtime cache
// which needs to always be in-sync
const entries = [...compilation.entries.keys()].filter((entry) =>
entry.toString().startsWith('pages/')
)
this.currentOutputPathsWebpack5.clear()
return
}
compiler.hooks.afterEmit.tapAsync(PLUGIN_NAME, (compilation, callback) => {
const { assets } = compilation
if (this.prevAssets) {
for (const f of Object.keys(assets)) {
deleteCache(assets[f].existsAt)
}
for (const f of Object.keys(this.prevAssets)) {
if (!assets[f]) {
deleteCache(this.prevAssets[f].existsAt)
}
}
}
this.prevAssets = assets
callback()
entries.forEach((page) => {
const outputPath = path.join(
compilation.outputOptions.path,
page + '.js'
)
deleteCache(outputPath)
})
})
this.previousOutputPathsWebpack5 = new Set(this.currentOutputPathsWebpack5)
this.currentOutputPathsWebpack5.clear()
}
}
import {
webpack,
isWebpack5,
sources,
} from 'next/dist/compiled/webpack/webpack'
import { webpack, sources } from 'next/dist/compiled/webpack/webpack'
import { PAGES_MANIFEST } from '../../../shared/lib/constants'
import getRouteFromEntrypoint from '../../../server/get-route-from-entrypoint'
......@@ -40,47 +36,32 @@ export default class PagesManifestPlugin implements webpack.Plugin {
file.endsWith('.js')
)
if (!isWebpack5 && files.length > 1) {
console.log(
`Found more than one file in server entrypoint ${entrypoint.name}`,
files
)
continue
}
// Write filename, replace any backslashes in path (on windows) with forwardslashes for cross-platform consistency.
pages[pagePath] = files[files.length - 1]
if (isWebpack5 && !this.dev) {
if (!this.dev) {
pages[pagePath] = pages[pagePath].slice(3)
}
pages[pagePath] = pages[pagePath].replace(/\\/g, '/')
}
assets[`${isWebpack5 && !this.dev ? '../' : ''}` + PAGES_MANIFEST] =
assets[`${!this.dev ? '../' : ''}` + PAGES_MANIFEST] =
new sources.RawSource(JSON.stringify(pages, null, 2))
}
apply(compiler: webpack.Compiler): void {
if (isWebpack5) {
compiler.hooks.make.tap('NextJsPagesManifest', (compilation) => {
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
compilation.hooks.processAssets.tap(
{
name: 'NextJsPagesManifest',
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
},
(assets: any) => {
this.createAssets(compilation, assets)
}
)
})
return
}
compiler.hooks.emit.tap('NextJsPagesManifest', (compilation: any) => {
this.createAssets(compilation, compilation.assets)
compiler.hooks.make.tap('NextJsPagesManifest', (compilation) => {
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
compilation.hooks.processAssets.tap(
{
name: 'NextJsPagesManifest',
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
},
(assets: any) => {
this.createAssets(compilation, assets)
}
)
})
}
}
import { NormalModule, isWebpack5 } from 'next/dist/compiled/webpack/webpack'
import { NormalModule } from 'next/dist/compiled/webpack/webpack'
import { Span } from '../../../trace'
import type webpack from 'webpack'
......@@ -11,12 +11,8 @@ const moduleSpansByCompilation = new WeakMap<
export const webpackInvalidSpans = new WeakMap<any, Span>()
function getNormalModuleLoaderHook(compilation: any) {
if (isWebpack5) {
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
return NormalModule.getCompilationHooks(compilation).loader
}
return compilation.hooks.normalModuleLoader
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
return NormalModule.getCompilationHooks(compilation).loader
}
export class ProfilingPlugin {
......@@ -78,7 +74,7 @@ export class ProfilingPlugin {
this.traceHookPair(
'webpack-compilation',
compiler.hooks.compilation,
isWebpack5 ? compiler.hooks.afterCompile : compiler.hooks.done,
compiler.hooks.afterCompile,
{
parentSpan: () =>
webpackInvalidSpans.get(compiler) || this.runWebpackSpan,
......@@ -113,17 +109,10 @@ export class ProfilingPlugin {
webpackInvalidSpans.get(compiler) || this.runWebpackSpan,
})
if (isWebpack5) {
this.traceHookPair(
'make',
compiler.hooks.make,
compiler.hooks.finishMake,
{
parentSpan: () =>
webpackInvalidSpans.get(compiler) || this.runWebpackSpan,
}
)
}
this.traceHookPair('make', compiler.hooks.make, compiler.hooks.finishMake, {
parentSpan: () =>
webpackInvalidSpans.get(compiler) || this.runWebpackSpan,
})
compiler.hooks.compilation.tap(pluginName, (compilation: any) => {
compilation.hooks.buildModule.tap(pluginName, (module: any) => {
......@@ -171,28 +160,26 @@ export class ProfilingPlugin {
moduleSpansByCompilation?.get(compilation)?.get(module)?.stop()
})
if (isWebpack5) {
this.traceHookPair(
'webpack-compilation-seal',
compilation.hooks.seal,
compilation.hooks.afterSeal,
{ parentSpan: () => spans.get(compilation)! }
)
compilation.hooks.addEntry.tap(pluginName, (entry: any) => {
const compilationSpan = spans.get(compilation)
if (!compilationSpan) {
return
}
const addEntrySpan = compilationSpan.traceChild('add-entry')
addEntrySpan.setAttribute('request', entry.request)
spans.set(entry, addEntrySpan)
})
compilation.hooks.succeedEntry.tap(pluginName, (entry: any) => {
spans.get(entry)?.stop()
})
}
this.traceHookPair(
'webpack-compilation-seal',
compilation.hooks.seal,
compilation.hooks.afterSeal,
{ parentSpan: () => spans.get(compilation)! }
)
compilation.hooks.addEntry.tap(pluginName, (entry: any) => {
const compilationSpan = spans.get(compilation)
if (!compilationSpan) {
return
}
const addEntrySpan = compilationSpan.traceChild('add-entry')
addEntrySpan.setAttribute('request', entry.request)
spans.set(entry, addEntrySpan)
})
compilation.hooks.succeedEntry.tap(pluginName, (entry: any) => {
spans.get(entry)?.stop()
})
this.traceHookPair(
'webpack-compilation-chunk-graph',
......
......@@ -21,53 +21,33 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWAR
// Implementation of this PR: https://github.com/jamiebuilds/react-loadable/pull/132
// Modified to strip out unneeded results for Next's specific use case
import {
webpack,
isWebpack5,
sources,
} from 'next/dist/compiled/webpack/webpack'
import { webpack, sources } from 'next/dist/compiled/webpack/webpack'
import path from 'path'
function getModuleId(compilation: any, module: any): string | number {
if (isWebpack5) {
return compilation.chunkGraph.getModuleId(module)
}
return module.id
return compilation.chunkGraph.getModuleId(module)
}
function getModuleFromDependency(
compilation: any,
dep: any
): webpack.Module & { resource?: string } {
if (isWebpack5) {
return compilation.moduleGraph.getModule(dep)
}
return dep.module
return compilation.moduleGraph.getModule(dep)
}
function getOriginModuleFromDependency(
compilation: any,
dep: any
): webpack.Module & { resource?: string } {
if (isWebpack5) {
return compilation.moduleGraph.getParentModule(dep)
}
return dep.originModule
return compilation.moduleGraph.getParentModule(dep)
}
function getChunkGroupFromBlock(
compilation: any,
block: any
): webpack.compilation.ChunkGroup {
if (isWebpack5) {
return compilation.chunkGraph.getBlockChunkGroup(block)
}
return block.chunkGroup
return compilation.chunkGraph.getBlockChunkGroup(block)
}
function buildManifest(
......@@ -181,25 +161,18 @@ export class ReactLoadablePlugin {
}
apply(compiler: webpack.Compiler) {
if (isWebpack5) {
compiler.hooks.make.tap('ReactLoadableManifest', (compilation) => {
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
compilation.hooks.processAssets.tap(
{
name: 'ReactLoadableManifest',
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
},
(assets: any) => {
this.createAssets(compiler, compilation, assets)
}
)
})
return
}
compiler.hooks.emit.tap('ReactLoadableManifest', (compilation: any) => {
this.createAssets(compiler, compilation, compilation.assets)
compiler.hooks.make.tap('ReactLoadableManifest', (compilation) => {
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
compilation.hooks.processAssets.tap(
{
name: 'ReactLoadableManifest',
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_ADDITIONS,
},
(assets: any) => {
this.createAssets(compiler, compilation, assets)
}
)
})
}
}
import { webpack } from 'next/dist/compiled/webpack/webpack'
import { isWebpack5, GraphHelpers } from 'next/dist/compiled/webpack/webpack'
/**
* Makes sure there are no dynamic chunks when the target is serverless
......@@ -10,9 +9,7 @@ import { isWebpack5, GraphHelpers } from 'next/dist/compiled/webpack/webpack'
export class ServerlessPlugin {
apply(compiler: webpack.Compiler) {
compiler.hooks.compilation.tap('ServerlessPlugin', (compilation) => {
const hook = isWebpack5
? compilation.hooks.optimizeChunks
: compilation.hooks.optimizeChunksBasic
const hook = compilation.hooks.optimizeChunks
hook.tap('ServerlessPlugin', (chunks) => {
for (const chunk of chunks) {
......@@ -24,20 +21,12 @@ export class ServerlessPlugin {
// Async chunks are usages of import() for example
const dynamicChunks = chunk.getAllAsyncChunks()
for (const dynamicChunk of dynamicChunks) {
if (isWebpack5) {
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
for (const module of compilation.chunkGraph.getChunkModulesIterable(
chunk
)) {
// Add module back into the entry chunk
chunk.addModule(module)
}
continue
}
for (const module of dynamicChunk.modulesIterable) {
// Webpack 4 has separate GraphHelpers
GraphHelpers.connectChunkAndModule(chunk, module)
// @ts-ignore TODO: Remove ignore when webpack 5 is stable
for (const module of compilation.chunkGraph.getChunkModulesIterable(
dynamicChunk
)) {
// Add module back into the entry chunk
chunk.addModule(module)
}
}
}
......
......@@ -3,13 +3,10 @@ import * as path from 'path'
import {
webpack,
ModuleFilenameHelpers,
isWebpack5,
sources,
} from 'next/dist/compiled/webpack/webpack'
import pLimit from 'p-limit'
import { Worker } from 'jest-worker'
import crypto from 'crypto'
import cacache from 'next/dist/compiled/cacache'
import { spans } from '../../profiling-plugin'
function getEcmaVersion(environment) {
......@@ -50,58 +47,6 @@ function buildError(error, file) {
return new Error(`${file} from Terser\n${error.message}`)
}
class Webpack4Cache {
constructor(cacheDir, { SourceMapSource, RawSource }) {
this.cacheDir = cacheDir
this.sources = { SourceMapSource, RawSource }
}
getLazyHashedEtag(obj) {
let str
if (obj.source) {
str = obj.source()
}
const hash = crypto.createHash('md4')
hash.update(str ? str : obj)
return hash.digest('base64')
}
async getPromise(identifier, etag) {
let cachedResult
try {
cachedResult = await cacache.get(this.cacheDir, etag)
} catch (ignoreError) {
// eslint-disable-next-line no-undefined
return undefined
}
cachedResult = JSON.parse(cachedResult.data)
const { code, name, map, input, inputSourceMap } = cachedResult
let source
if (map) {
source = new this.sources.SourceMapSource(
code,
name,
map,
input,
inputSourceMap,
true
)
} else {
source = new this.sources.RawSource(code)
}
return { source }
}
async storePromise(identifier, etag, data) {
await cacache.put(this.cacheDir, etag, JSON.stringify(data))
}
}
export class TerserPlugin {
constructor(options = {}) {
const { cacheDir, terserOptions = {}, parallel, swcMinify } = options
......@@ -126,19 +71,11 @@ export class TerserPlugin {
const terserSpan = compilationSpan.traceChild(
'terser-webpack-plugin-optimize'
)
terserSpan.setAttribute('webpackVersion', isWebpack5 ? 5 : 4)
terserSpan.setAttribute('compilationName', compilation.name)
return terserSpan.traceAsyncFn(async () => {
let numberOfAssetsForMinify = 0
const assetsList = isWebpack5
? Object.keys(assets)
: [
...Array.from(compilation.additionalChunkAssets || []),
...Array.from(assets).reduce((acc, chunk) => {
return acc.concat(Array.from(chunk.files || []))
}, []),
]
const assetsList = Object.keys(assets)
const assetsForMinify = await Promise.all(
assetsList
......@@ -292,19 +229,9 @@ export class TerserPlugin {
output.source = new RawSource(output.code)
}
if (isWebpack5) {
await cache.storePromise(name, eTag, {
source: output.source,
})
} else {
await cache.storePromise(name, eTag, {
code: output.code,
map: output.map,
name,
input,
inputSourceMap,
})
}
await cache.storePromise(name, eTag, {
source: output.source,
})
}
/** @type {AssetInfo} */
......@@ -346,80 +273,48 @@ export class TerserPlugin {
return
}
const cache = isWebpack5
? compilation.getCache('TerserWebpackPlugin')
: new Webpack4Cache(this.options.cacheDir, {
SourceMapSource,
RawSource,
})
const cache = compilation.getCache('TerserWebpackPlugin')
const handleHashForChunk = (hash, chunk) => {
// increment 'c' to invalidate cache
hash.update('c')
}
if (isWebpack5) {
const JSModulesHooks =
webpack.javascript.JavascriptModulesPlugin.getCompilationHooks(
compilation
)
JSModulesHooks.chunkHash.tap(pluginName, (chunk, hash) => {
if (!chunk.hasRuntime()) return
return handleHashForChunk(hash, chunk)
})
compilation.hooks.processAssets.tapPromise(
{
name: pluginName,
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,
},
(assets) =>
this.optimize(
compiler,
compilation,
assets,
{
availableNumberOfCores,
},
cache,
{ SourceMapSource, RawSource }
)
)
compilation.hooks.statsPrinter.tap(pluginName, (stats) => {
stats.hooks.print
.for('asset.info.minimized')
.tap('terser-webpack-plugin', (minimized, { green, formatFlag }) =>
// eslint-disable-next-line no-undefined
minimized ? green(formatFlag('minimized')) : undefined
)
})
} else {
compilation.mainTemplate.hooks.hashForChunk.tap(
pluginName,
handleHashForChunk
)
compilation.chunkTemplate.hooks.hashForChunk.tap(
pluginName,
handleHashForChunk
const JSModulesHooks =
webpack.javascript.JavascriptModulesPlugin.getCompilationHooks(
compilation
)
JSModulesHooks.chunkHash.tap(pluginName, (chunk, hash) => {
if (!chunk.hasRuntime()) return
return handleHashForChunk(hash, chunk)
})
compilation.hooks.processAssets.tapPromise(
{
name: pluginName,
stage: webpack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE_SIZE,
},
(assets) =>
this.optimize(
compiler,
compilation,
assets,
{
availableNumberOfCores,
},
cache,
{ SourceMapSource, RawSource }
)
)
compilation.hooks.optimizeChunkAssets.tapPromise(
pluginName,
async (assets) => {
return await this.optimize(
compiler,
compilation,
assets,
{
availableNumberOfCores,
},
cache,
{ SourceMapSource, RawSource }
)
}
)
}
compilation.hooks.statsPrinter.tap(pluginName, (stats) => {
stats.hooks.print
.for('asset.info.minimized')
.tap('terser-webpack-plugin', (minimized, { green, formatFlag }) =>
// eslint-disable-next-line no-undefined
minimized ? green(formatFlag('minimized')) : undefined
)
})
})
}
}
import Chalk from 'chalk'
import { SimpleWebpackError } from './simpleWebpackError'
import { createOriginalStackFrame } from '@next/react-dev-overlay/lib/middleware'
import { isWebpack5 } from 'next/dist/compiled/webpack/webpack'
import path from 'path'
const chalk = new Chalk.constructor({ enabled: true })
......@@ -79,10 +78,6 @@ export async function getNotFoundError(
.replace(/Can't resolve '(.*)'/, `Can't resolve '${chalk.green('$1')}'`)
const importTrace = () => {
if (!isWebpack5) {
return ''
}
let importTraceLine = '\nImport trace for requested module:\n'
const moduleTrace = getModuleTrace(input, compilation)
......
exports.__esModule = true
exports.isWebpack5 = false
exports.default = undefined
let initializedWebpack5 = false
let initFns = []
exports.init = function () {
if (process.env.NEXT_PRIVATE_LOCAL_WEBPACK5) {
Object.assign(exports, {
......@@ -24,16 +20,7 @@ exports.init = function () {
// eslint-disable-next-line import/no-extraneous-dependencies
webpack: require('webpack5'),
})
exports.isWebpack5 = true
} else {
Object.assign(exports, require('./bundle5')())
exports.isWebpack5 = true
if (!initializedWebpack5) for (const cb of initFns) cb()
initializedWebpack5 = true
}
}
exports.onWebpackInit = function (cb) {
if (initializedWebpack5) cb()
else initFns.push(cb)
}
This source diff could not be displayed because it is too large. You can view the blob instead.
{"name":"bfj","main":"index.js","author":"Phil Booth (https://gitlab.com/philbooth)","license":"MIT"}
This source diff could not be displayed because it is too large. You can view the blob instead.
{"name":"cacache","main":"index.js","author":{"name":"Kat Marchán","email":"kzm@sykosomatic.org","twitter":"maybekatz"},"license":"ISC"}
exports.__esModule = true
exports.isWebpack5 = false
exports.default = undefined
let initializedWebpack5 = false
let initFns = []
exports.init = function () {
if (process.env.NEXT_PRIVATE_LOCAL_WEBPACK5) {
Object.assign(exports, {
......@@ -24,16 +20,7 @@ exports.init = function () {
// eslint-disable-next-line import/no-extraneous-dependencies
webpack: require('webpack5'),
})
exports.isWebpack5 = true
} else {
Object.assign(exports, require('./bundle5')())
exports.isWebpack5 = true
if (!initializedWebpack5) for (const cb of initFns) cb()
initializedWebpack5 = true
}
}
exports.onWebpackInit = function (cb) {
if (initializedWebpack5) cb()
else initFns.push(cb)
}
......@@ -191,8 +191,6 @@
"async-sema": "3.0.0",
"babel-plugin-transform-define": "2.0.0",
"babel-plugin-transform-react-remove-prop-types": "0.4.24",
"bfj": "7.0.2",
"cacache": "15.0.5",
"ci-info": "watson/ci-info#f43f6a1cefff47fb361c88cf4b943fdbcaafe540",
"cli-select": "1.1.2",
"comment-json": "3.0.3",
......
......@@ -127,7 +127,6 @@ export type NextConfig = { [key: string]: any } & {
optimizeImages?: boolean
optimizeCss?: boolean
scrollRestoration?: boolean
stats?: boolean
externalDir?: boolean
conformance?: boolean
amp?: {
......@@ -213,7 +212,6 @@ export const defaultConfig: NextConfig = {
optimizeImages: false,
optimizeCss: false,
scrollRestoration: false,
stats: false,
externalDir: false,
reactRoot: Number(process.env.NEXT_PRIVATE_REACT_ROOT) > 0,
disableOptimizedLoading: false,
......
......@@ -4,7 +4,7 @@ import { IncomingMessage, ServerResponse } from 'http'
import { WebpackHotMiddleware } from './hot-middleware'
import { join } from 'path'
import { UrlObject } from 'url'
import { webpack, isWebpack5 } from 'next/dist/compiled/webpack/webpack'
import { webpack } from 'next/dist/compiled/webpack/webpack'
import {
createEntrypoints,
createPagesMapping,
......@@ -150,7 +150,6 @@ export default class HotReloader {
private rewrites: CustomRoutes['rewrites']
private fallbackWatcher: any
private hotReloaderSpan: Span
public isWebpack5: any
constructor(
dir: string,
......@@ -180,7 +179,6 @@ export default class HotReloader {
this.config = config
this.previewProps = previewProps
this.rewrites = rewrites
this.isWebpack5 = isWebpack5
this.hotReloaderSpan = trace('hot-reloader')
// Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
// of the current `next dev` invocation.
......@@ -294,7 +292,6 @@ export default class HotReloader {
createPagesMapping(
pagePaths.filter((i) => i !== null) as string[],
this.config.pageExtensions,
this.isWebpack5,
true
)
)
......@@ -620,7 +617,6 @@ export default class HotReloader {
this.onDemandEntries.middleware,
this.webpackHotMiddleware.middleware,
getOverlayMiddleware({
isWebpack5,
rootDirectory: this.dir,
stats: () => this.stats,
serverStats: () => this.serverStats,
......
......@@ -326,7 +326,7 @@ export default class DevServer extends Server {
const telemetry = new Telemetry({ distDir: this.distDir })
telemetry.record(
eventCliSession(PHASE_DEVELOPMENT_SERVER, this.distDir, {
webpackVersion: this.hotReloader.isWebpack5 ? 5 : 4,
webpackVersion: 5,
cliCommand: 'dev',
isSrcDir: relative(this.dir, this.pagesDir!).startsWith('src'),
hasNowJson: !!(await findUp('now.json', { cwd: this.dir })),
......@@ -488,8 +488,7 @@ export default class DevServer extends Server {
const source = await getSourceById(
!!frame.file?.startsWith(sep) || !!frame.file?.startsWith('file:'),
moduleId,
compilation,
this.hotReloader!.isWebpack5
compilation
)
const originalFrame = await createOriginalStackFrame({
......
......@@ -2,7 +2,7 @@ import { EventEmitter } from 'events'
import { IncomingMessage, ServerResponse } from 'http'
import { join, posix } from 'path'
import { parse } from 'url'
import { webpack, isWebpack5 } from 'next/dist/compiled/webpack/webpack'
import { webpack } from 'next/dist/compiled/webpack/webpack'
import * as Log from '../../build/output/log'
import { normalizePagePath, normalizePathSep } from '../normalize-page-path'
import { pageNotFoundError } from '../require'
......@@ -323,14 +323,6 @@ class Invalidator {
}
this.building = true
if (!isWebpack5) {
// Work around a bug in webpack, calling `invalidate` on Watching.js
// doesn't trigger the invalid call used to keep track of the `.done` hook on multiCompiler
for (const compiler of this.multiCompiler.compilers) {
compiler.hooks.invalid.call()
}
}
this.watcher.invalidate()
}
......
......@@ -159,22 +159,6 @@ export async function ncc_babel_bundle_packages(task, opts) {
.target('compiled/babel')
}
// eslint-disable-next-line camelcase
externals['bfj'] = 'next/dist/compiled/bfj'
export async function ncc_bfj(task, opts) {
await task
.source(opts.src || relative(__dirname, require.resolve('bfj')))
.ncc({ packageName: 'bfj' })
.target('compiled/bfj')
}
// eslint-disable-next-line camelcase
externals['cacache'] = 'next/dist/compiled/cacache'
export async function ncc_cacache(task, opts) {
await task
.source(opts.src || relative(__dirname, require.resolve('cacache')))
.ncc({ packageName: 'cacache' })
.target('compiled/cacache')
}
// eslint-disable-next-line camelcase
externals['ci-info'] = 'next/dist/compiled/ci-info'
export async function ncc_ci_info(task, opts) {
......@@ -829,8 +813,6 @@ export async function ncc(task, opts) {
'ncc_async_retry',
'ncc_async_sema',
'ncc_babel_bundle',
'ncc_bfj',
'ncc_cacache',
'ncc_ci_info',
'ncc_cli_select',
'ncc_comment_json',
......
......@@ -30,11 +30,9 @@ declare module 'next/dist/compiled/webpack/webpack' {
import webpackSources from 'webpack-sources1'
import webpack4, { loader } from 'webpack4'
export { NormalModule } from 'webpack'
export let isWebpack5: boolean
export function init(): void
export let BasicEvaluatedExpression: any
export let GraphHelpers: any
export function onWebpackInit(cb: () => void): void
// TODO change this to webpack4 | webpack5
export let sources: typeof webpackSources
// TODO change this to webpack
......
......@@ -16,7 +16,6 @@ import { getRawSourceMap } from './internal/helpers/getRawSourceMap'
import { launchEditor } from './internal/helpers/launchEditor'
export type OverlayMiddlewareOptions = {
isWebpack5?: boolean
rootDirectory: string
stats(): webpack.Stats | null
serverStats(): webpack.Stats | null
......@@ -29,34 +28,17 @@ export type OriginalStackFrameResponse = {
type Source = { map: () => RawSourceMap } | null
function getModuleId(compilation: any, module: any, isWebpack5?: boolean) {
if (isWebpack5) {
return compilation.chunkGraph.getModuleId(module)
}
return module.id
function getModuleId(compilation: any, module: any) {
return compilation.chunkGraph.getModuleId(module)
}
function getModuleSource(
compilation: any,
module: any,
isWebpack5?: boolean
): any {
if (isWebpack5) {
return (
(module &&
compilation.codeGenerationResults
.get(module)
?.sources.get('javascript')) ??
null
)
}
function getModuleSource(compilation: any, module: any): any {
return (
module?.source(
compilation.dependencyTemplates,
compilation.runtimeTemplate
) ?? null
(module &&
compilation.codeGenerationResults
.get(module)
?.sources.get('javascript')) ??
null
)
}
......@@ -180,8 +162,7 @@ export async function createOriginalStackFrame({
export async function getSourceById(
isFile: boolean,
id: string,
compilation: any,
isWebpack5: boolean
compilation: any
): Promise<Source> {
if (isFile) {
const fileContent: string | null = await fs
......@@ -210,10 +191,9 @@ export async function getSourceById(
}
const module = [...compilation.modules].find(
(searchModule) =>
getModuleId(compilation, searchModule, isWebpack5) === id
(searchModule) => getModuleId(compilation, searchModule) === id
)
return getModuleSource(compilation, module, isWebpack5)
return getModuleSource(compilation, module)
} catch (err) {
console.error(`Failed to lookup module by ID ("${id}"):`, err)
return null
......@@ -259,8 +239,7 @@ function getOverlayMiddleware(options: OverlayMiddlewareOptions) {
source = await getSourceById(
frame.file.startsWith('file:'),
moduleId,
compilation,
!!options.isWebpack5
compilation
)
} catch (err) {
console.log('Failed to get source map:', err)
......
module.exports = {
experimental: {
stats: true,
},
}
export default function Index(props) {
return <p>Hello world</p>
}
/* eslint-env jest */
import fs from 'fs-extra'
import { join } from 'path'
import { nextBuild } from 'next-test-utils'
const appDir = join(__dirname, '../')
const statsPath = join(appDir, '.next/next-stats.json')
describe('Build Stats', () => {
it('outputs next-stats.json when enabled', async () => {
await nextBuild(appDir)
expect(await fs.pathExists(statsPath)).toBe(true)
const statsString = await fs.readFile(statsPath, 'utf8')
const statsData = JSON.parse(statsString)
expect(statsData.version).toBe(0)
expect(typeof statsData.stats).toBe('object')
})
})
/* eslint-env jest */
import os from 'os'
import path from 'path'
import { Span } from 'next/dist/trace'
import loader from 'next/dist/build/babel/loader'
const dir = path.resolve(os.tmpdir())
const babel = async (code: string, queryOpts = {} as any) => {
const { isServer = false, resourcePath = `index.js` } = queryOpts
let isAsync = false
return new Promise<string>((resolve, reject) => {
function callback(err, content) {
if (err) {
reject(err)
} else {
resolve(content.replace(/\n/g, ''))
}
}
const res = loader.bind({
resourcePath,
async() {
isAsync = true
return callback
},
callback,
emitWarning() {},
query: {
// loader opts
cwd: dir,
isServer,
distDir: path.resolve(dir, '.next'),
pagesDir:
'pagesDir' in queryOpts
? queryOpts.pagesDir
: path.resolve(dir, 'pages'),
cache: false,
development: true,
hasReactRefresh: !isServer,
},
currentTraceSpan: new Span({ name: 'test' }),
})(code, null)
if (!isAsync) {
resolve(res)
}
})
}
describe('next-babel-loader', () => {
describe('replace constants', () => {
it('should replace NODE_ENV on client (dev)', async () => {
const code = await babel(`process.env.NODE_ENV`, {
isServer: false,
})
expect(code).toMatchInlineSnapshot(`"\\"development\\";"`)
})
it('should replace NODE_ENV in statement (dev)', async () => {
const code = await babel(`if (process.env.NODE_ENV === 'development') {}`)
expect(code).toMatchInlineSnapshot(`"if (true) {}"`)
})
it('should support 9.4 regression', async () => {
const pageFile = path.resolve(dir, 'pages', 'index.js')
const output = await babel(
`
import React from "react";
import queryGraphql from "../graphql/schema";
const gql = String.raw;
export default function Home({ greeting }) {
return <h1>{greeting}</h1>;
}
export async function getStaticProps() {
const greeting = await getGreeting();
return {
props: {
greeting,
},
};
}
async function getGreeting() {
const result = await queryGraphql(
gql\`
{
query {
greeting
}
}
\`
);
return result.data.greeting;
}
`,
{ resourcePath: pageFile, isServer: false }
)
expect(output).toContain(
`var __jsx = React.createElement;import React from "react";export var __N_SSG = true;export default function Home(_ref) { var greeting = _ref.greeting; return __jsx("h1", { __self: this, __source: { fileName: _jsxFileName, lineNumber: 8, columnNumber: 20 } }, greeting);}_c = Home;var _c;$RefreshReg$(_c, "Home");`
)
})
})
})
......@@ -6182,16 +6182,6 @@ before-after-hook@^2.2.0:
resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.2.2.tgz#a6e8ca41028d90ee2c24222f201c90956091613e"
integrity sha512-3pZEU3NT5BFUo/AD5ERPWOgQOCZITni6iavr5AUw5AUwQjMlI0kzu5btnyD39AF0gUEsDPwJT+oY1ORBJijPjQ==
bfj@7.0.2:
version "7.0.2"
resolved "https://registry.yarnpkg.com/bfj/-/bfj-7.0.2.tgz#1988ce76f3add9ac2913fd8ba47aad9e651bfbb2"
integrity sha512-+e/UqUzwmzJamNF50tBV6tZPTORow7gQ96iFow+8b562OdMpEK0BcJEq2OSPEDmAbSMBQ7PKZ87ubFkgxpYWgw==
dependencies:
bluebird "^3.5.5"
check-types "^11.1.1"
hoopy "^0.1.4"
tryer "^1.0.1"
big.js@^5.2.2:
version "5.2.2"
resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328"
......@@ -6479,7 +6469,27 @@ bytes@3.1.0, bytes@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6"
cacache@15.0.5, cacache@^15.0.5:
cacache@^12.0.2:
version "12.0.3"
resolved "https://registry.yarnpkg.com/cacache/-/cacache-12.0.3.tgz#be99abba4e1bf5df461cd5a2c1071fc432573390"
dependencies:
bluebird "^3.5.5"
chownr "^1.1.1"
figgy-pudding "^3.5.1"
glob "^7.1.4"
graceful-fs "^4.1.15"
infer-owner "^1.0.3"
lru-cache "^5.1.1"
mississippi "^3.0.0"
mkdirp "^0.5.1"
move-concurrently "^1.0.1"
promise-inflight "^1.0.1"
rimraf "^2.6.3"
ssri "^6.0.1"
unique-filename "^1.1.1"
y18n "^4.0.0"
cacache@^15.0.5:
version "15.0.5"
resolved "https://registry.yarnpkg.com/cacache/-/cacache-15.0.5.tgz#69162833da29170d6732334643c60e005f5f17d0"
integrity sha512-lloiL22n7sOjEEXdL8NAjTgv9a1u43xICE9/203qonkZUCj5X1UEWIdf2/Y0d6QcCtMzbKQyhrcDbdvlZTs/+A==
......@@ -6502,26 +6512,6 @@ cacache@15.0.5, cacache@^15.0.5:
tar "^6.0.2"
unique-filename "^1.1.1"
cacache@^12.0.2:
version "12.0.3"
resolved "https://registry.yarnpkg.com/cacache/-/cacache-12.0.3.tgz#be99abba4e1bf5df461cd5a2c1071fc432573390"
dependencies:
bluebird "^3.5.5"
chownr "^1.1.1"
figgy-pudding "^3.5.1"
glob "^7.1.4"
graceful-fs "^4.1.15"
infer-owner "^1.0.3"
lru-cache "^5.1.1"
mississippi "^3.0.0"
mkdirp "^0.5.1"
move-concurrently "^1.0.1"
promise-inflight "^1.0.1"
rimraf "^2.6.3"
ssri "^6.0.1"
unique-filename "^1.1.1"
y18n "^4.0.0"
cache-base@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2"
......@@ -6790,11 +6780,6 @@ chardet@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e"
check-types@^11.1.1:
version "11.1.2"
resolved "https://registry.yarnpkg.com/check-types/-/check-types-11.1.2.tgz#86a7c12bf5539f6324eb0e70ca8896c0e38f3e2f"
integrity sha512-tzWzvgePgLORb9/3a0YenggReLKAIb2owL03H2Xdoe5pKcUyWRSEQ8xfCar8t2SIAuEDwtmx2da1YB52YuHQMQ==
checkup@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/checkup/-/checkup-1.3.0.tgz#d3800276fea5d0f247ffc951be78c8b02f8e0d76"
......@@ -10575,11 +10560,6 @@ homedir-polyfill@^1.0.0:
dependencies:
parse-passwd "^1.0.0"
hoopy@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/hoopy/-/hoopy-0.1.4.tgz#609207d661100033a9a9402ad3dea677381c1b1d"
integrity sha512-HRcs+2mr52W0K+x8RzcLzuPPmVIKMSv97RGHy0Ea9y/mpcaK+xTrjICA04KAHi4GRzxliNqNJEFYWHghy3rSfQ==
hosted-git-info@^2.1.4:
version "2.8.5"
resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.5.tgz#759cfcf2c4d156ade59b0b2dfabddc42a6b9c70c"
......@@ -18804,11 +18784,6 @@ try-to-catch@^3.0.0:
resolved "https://registry.yarnpkg.com/try-to-catch/-/try-to-catch-3.0.0.tgz#a1903b44d13d5124c54d14a461d22ec1f52ea14b"
integrity sha512-eIm6ZXwR35jVF8By/HdbbkcaCDTBI5PpCPkejRKrYp0jyf/DbCCcRhHD7/O9jtFI3ewsqo9WctFEiJTS6i+CQA==
tryer@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/tryer/-/tryer-1.0.1.tgz#f2c85406800b9b0f74c9f7465b81eaad241252f8"
integrity sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA==
tsconfig-paths@^3.9.0:
version "3.9.0"
resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz#098547a6c4448807e8fcb8eae081064ee9a3c90b"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment