2020-05-28 10:23:10 +02:00
|
|
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
2018-10-01 01:02:10 +02:00
|
|
|
const notifier = require('node-notifier')
|
2021-04-29 19:50:06 +02:00
|
|
|
const { relative, basename, resolve } = require('path')
|
2021-01-14 02:59:08 +01:00
|
|
|
const { Module } = require('module')
|
|
|
|
|
|
|
|
// Note:
|
|
|
|
// "bundles" folder shadows main node_modules in workspace where all installs in
|
|
|
|
// this shadow node_modules are alias installs only.
|
|
|
|
// This is because Yarn alias installs have bugs with version deduping where
|
|
|
|
// transitive versions are not resolved correctly - for example, webpack5
|
|
|
|
// will end up resolving webpack-sources@1 instead of webpack-sources@2.
|
|
|
|
// If/when this issue is fixed upstream in Yarn, this "shadowing" workaround can
|
|
|
|
// then be removed to directly install the bundles/package.json packages into
|
|
|
|
// the main package.json as normal devDependencies aliases.
|
|
|
|
const m = new Module(resolve(__dirname, 'bundles', '_'))
|
|
|
|
m.filename = m.id
|
|
|
|
m.paths = Module._nodeModulePaths(m.id)
|
|
|
|
const bundleRequire = m.require
|
|
|
|
bundleRequire.resolve = (request, options) =>
|
|
|
|
Module._resolveFilename(request, m, false, options)
|
2019-02-27 15:12:40 +01:00
|
|
|
|
2020-03-29 18:56:34 +02:00
|
|
|
export async function next__polyfill_nomodule(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(
|
|
|
|
opts.src ||
|
|
|
|
relative(__dirname, require.resolve('@next/polyfill-nomodule'))
|
|
|
|
)
|
|
|
|
.target('dist/build/polyfills')
|
|
|
|
}
|
|
|
|
|
2021-02-03 18:02:44 +01:00
|
|
|
export async function browser_polyfills(task, opts) {
|
|
|
|
await task.parallel(['next__polyfill_nomodule'], opts)
|
2020-03-29 18:56:34 +02:00
|
|
|
}
|
|
|
|
|
2020-03-29 18:16:32 +02:00
|
|
|
const externals = {
|
2020-03-30 03:25:10 +02:00
|
|
|
// Browserslist (post-css plugins)
|
|
|
|
browserslist: 'browserslist',
|
2020-11-15 22:18:16 +01:00
|
|
|
'caniuse-lite': 'caniuse-lite', // FIXME: `autoprefixer` will still bundle this because it uses direct imports
|
2021-01-25 18:08:08 +01:00
|
|
|
'caniuse-lite/data/features/border-radius':
|
|
|
|
'caniuse-lite/data/features/border-radius',
|
|
|
|
'caniuse-lite/data/features/css-featurequeries.js':
|
|
|
|
'caniuse-lite/data/features/css-featurequeries',
|
2020-03-30 03:25:10 +02:00
|
|
|
|
2020-11-06 03:33:14 +01:00
|
|
|
chalk: 'chalk',
|
|
|
|
'node-fetch': 'node-fetch',
|
2021-01-15 02:51:45 +01:00
|
|
|
// postcss: 'postcss',
|
2020-11-06 03:33:14 +01:00
|
|
|
|
2021-01-14 02:59:08 +01:00
|
|
|
// webpack
|
|
|
|
'node-libs-browser': 'node-libs-browser',
|
|
|
|
|
|
|
|
// sass-loader
|
|
|
|
// (also responsible for these dependencies in package.json)
|
|
|
|
'node-sass': 'node-sass',
|
|
|
|
sass: 'sass',
|
|
|
|
fibers: 'fibers',
|
|
|
|
|
2020-03-30 03:25:10 +02:00
|
|
|
chokidar: 'chokidar',
|
2020-04-15 20:20:25 +02:00
|
|
|
'jest-worker': 'jest-worker',
|
2020-03-29 05:41:35 +02:00
|
|
|
}
|
2020-03-29 00:31:06 +01:00
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['amphtml-validator'] = 'next/dist/compiled/amphtml-validator'
|
2020-03-29 00:31:06 +01:00
|
|
|
export async function ncc_amphtml_validator(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(
|
|
|
|
opts.src || relative(__dirname, require.resolve('amphtml-validator'))
|
|
|
|
)
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'amphtml-validator', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/amphtml-validator')
|
2020-03-29 00:31:06 +01:00
|
|
|
}
|
2019-03-24 23:38:03 +01:00
|
|
|
// eslint-disable-next-line camelcase
|
2021-02-11 10:55:56 +01:00
|
|
|
externals['@ampproject/toolbox-optimizer'] =
|
|
|
|
'next/dist/compiled/@ampproject/toolbox-optimizer'
|
|
|
|
export async function ncc_amp_optimizer(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(
|
|
|
|
opts.src ||
|
|
|
|
relative(__dirname, require.resolve('@ampproject/toolbox-optimizer'))
|
|
|
|
)
|
|
|
|
.ncc({
|
|
|
|
externals,
|
|
|
|
precompiled: false,
|
|
|
|
packageName: '@ampproject/toolbox-optimizer',
|
|
|
|
})
|
|
|
|
.target('dist/compiled/@ampproject/toolbox-optimizer')
|
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['arg'] = 'distcompiled/arg'
|
2019-11-11 04:24:53 +01:00
|
|
|
export async function ncc_arg(task, opts) {
|
2019-03-24 23:38:03 +01:00
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('arg')))
|
|
|
|
.ncc({ packageName: 'arg' })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/arg')
|
2019-03-24 23:38:03 +01:00
|
|
|
}
|
2019-02-27 15:22:18 +01:00
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['async-retry'] = 'next/dist/compiled/async-retry'
|
2020-03-29 00:27:09 +01:00
|
|
|
export async function ncc_async_retry(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('async-retry')))
|
2020-03-29 01:53:00 +01:00
|
|
|
.ncc({
|
|
|
|
packageName: 'async-retry',
|
2020-03-29 18:16:32 +02:00
|
|
|
externals,
|
2020-03-29 01:53:00 +01:00
|
|
|
})
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/async-retry')
|
2020-03-29 00:27:09 +01:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['async-sema'] = 'next/dist/compiled/async-sema'
|
2020-03-29 00:27:09 +01:00
|
|
|
export async function ncc_async_sema(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('async-sema')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'async-sema', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/async-sema')
|
2020-03-29 00:27:09 +01:00
|
|
|
}
|
2020-06-02 21:20:37 +02:00
|
|
|
|
2020-11-06 03:33:14 +01:00
|
|
|
// eslint-disable-next-line camelcase
|
|
|
|
export async function ncc_babel_bundle(task, opts) {
|
|
|
|
const bundleExternals = { ...externals }
|
2021-04-08 14:03:02 +02:00
|
|
|
for (const pkg of Object.keys(babelBundlePackages)) {
|
2020-11-06 03:33:14 +01:00
|
|
|
delete bundleExternals[pkg]
|
2021-04-08 14:03:02 +02:00
|
|
|
}
|
2020-11-06 03:33:14 +01:00
|
|
|
await task
|
|
|
|
.source(opts.src || 'bundles/babel/bundle.js')
|
|
|
|
.ncc({
|
|
|
|
packageName: '@babel/core',
|
|
|
|
bundleName: 'babel',
|
|
|
|
externals: bundleExternals,
|
|
|
|
})
|
|
|
|
.target('compiled/babel')
|
|
|
|
}
|
|
|
|
|
|
|
|
const babelBundlePackages = {
|
|
|
|
'code-frame': 'next/dist/compiled/babel/code-frame',
|
2021-04-08 14:03:02 +02:00
|
|
|
'@babel/generator': 'next/dist/compiled/babel/generator',
|
|
|
|
'@babel/traverse': 'next/dist/compiled/babel/traverse',
|
2020-11-06 03:33:14 +01:00
|
|
|
'@babel/core': 'next/dist/compiled/babel/core',
|
2021-04-08 14:03:02 +02:00
|
|
|
'@babel/core/lib/config': 'next/dist/compiled/babel/core-lib-config',
|
|
|
|
'@babel/core/lib/transformation/normalize-file':
|
|
|
|
'next/dist/compiled/babel/core-lib-normalize-config',
|
|
|
|
'@babel/core/lib/transformation/normalize-opts':
|
|
|
|
'next/dist/compiled/babel/core-lib-normalize-opts',
|
|
|
|
'@babel/core/lib/transformation/block-hoist-plugin':
|
|
|
|
'next/dist/compiled/babel/core-lib-block-hoisting-plugin',
|
|
|
|
'@babel/core/lib/transformation/plugin-pass':
|
|
|
|
'next/dist/compiled/babel/core-lib-plugin-pass',
|
2020-11-06 03:33:14 +01:00
|
|
|
'@babel/plugin-proposal-class-properties':
|
|
|
|
'next/dist/compiled/babel/plugin-proposal-class-properties',
|
|
|
|
'@babel/plugin-proposal-export-namespace-from':
|
|
|
|
'next/dist/compiled/babel/plugin-proposal-export-namespace-from',
|
|
|
|
'@babel/plugin-proposal-numeric-separator':
|
|
|
|
'next/dist/compiled/babel/plugin-proposal-numeric-separator',
|
|
|
|
'@babel/plugin-proposal-object-rest-spread':
|
|
|
|
'next/dist/compiled/babel/plugin-proposal-object-rest-spread',
|
|
|
|
'@babel/plugin-syntax-bigint':
|
|
|
|
'next/dist/compiled/babel/plugin-syntax-bigint',
|
|
|
|
'@babel/plugin-syntax-dynamic-import':
|
|
|
|
'next/dist/compiled/babel/plugin-syntax-dynamic-import',
|
|
|
|
'@babel/plugin-syntax-jsx': 'next/dist/compiled/babel/plugin-syntax-jsx',
|
|
|
|
'@babel/plugin-transform-modules-commonjs':
|
|
|
|
'next/dist/compiled/babel/plugin-transform-modules-commonjs',
|
|
|
|
'@babel/plugin-transform-runtime':
|
|
|
|
'next/dist/compiled/babel/plugin-transform-runtime',
|
|
|
|
'@babel/preset-env': 'next/dist/compiled/babel/preset-env',
|
|
|
|
'@babel/preset-react': 'next/dist/compiled/babel/preset-react',
|
|
|
|
'@babel/preset-typescript': 'next/dist/compiled/babel/preset-typescript',
|
2021-04-30 13:09:07 +02:00
|
|
|
'@babel/eslint-parser': 'next/dist/compiled/babel/eslint-parser',
|
2020-11-06 03:33:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Object.assign(externals, babelBundlePackages)
|
|
|
|
|
|
|
|
export async function ncc_babel_bundle_packages(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || 'bundles/babel/packages/*')
|
|
|
|
.target('compiled/babel/')
|
|
|
|
}
|
|
|
|
|
2021-02-02 16:39:39 +01:00
|
|
|
// 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')
|
|
|
|
}
|
2020-03-30 03:25:10 +02:00
|
|
|
// eslint-disable-next-line camelcase
|
2020-11-04 22:52:49 +01:00
|
|
|
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
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['ci-info'] = 'next/dist/compiled/ci-info'
|
2020-03-29 00:43:52 +01:00
|
|
|
export async function ncc_ci_info(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('ci-info')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'ci-info', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/ci-info')
|
2020-03-29 00:43:52 +01:00
|
|
|
}
|
2021-08-04 23:53:15 +02:00
|
|
|
// eslint-disable-next-line camelcase
|
|
|
|
externals['cli-select'] = 'next/dist/compiled/cli-select'
|
|
|
|
export async function ncc_cli_select(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('cli-select')))
|
|
|
|
.ncc({ packageName: 'cli-select', externals })
|
|
|
|
.target('compiled/cli-select')
|
|
|
|
}
|
2021-01-14 02:59:08 +01:00
|
|
|
externals['comment-json'] = 'next/dist/compiled/comment-json'
|
|
|
|
export async function ncc_comment_json(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('comment-json')))
|
|
|
|
.ncc({ packageName: 'comment-json', externals })
|
|
|
|
.target('compiled/comment-json')
|
|
|
|
}
|
2020-03-29 00:43:52 +01:00
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['compression'] = 'next/dist/compiled/compression'
|
2020-03-29 00:56:38 +01:00
|
|
|
export async function ncc_compression(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('compression')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'compression', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/compression')
|
2020-03-29 00:56:38 +01:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['conf'] = 'next/dist/compiled/conf'
|
2020-03-29 17:46:33 +02:00
|
|
|
export async function ncc_conf(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('conf')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'conf', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/conf')
|
2020-03-29 17:46:33 +02:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['content-type'] = 'next/dist/compiled/content-type'
|
2020-03-29 00:56:38 +01:00
|
|
|
export async function ncc_content_type(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('content-type')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'content-type', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/content-type')
|
2020-03-29 00:56:38 +01:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['cookie'] = 'next/dist/compiled/cookie'
|
2020-03-29 01:02:03 +01:00
|
|
|
export async function ncc_cookie(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('cookie')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'cookie', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/cookie')
|
2020-03-29 01:02:03 +01:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2021-08-04 23:53:15 +02:00
|
|
|
externals['cross-spawn'] = 'next/dist/compiled/cross-spawn'
|
|
|
|
export async function ncc_cross_spawn(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('cross-spawn')))
|
|
|
|
.ncc({ packageName: 'cross-spawn', externals })
|
|
|
|
.target('compiled/cross-spawn')
|
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2021-01-20 06:47:25 +01:00
|
|
|
externals['css-loader'] = 'next/dist/compiled/css-loader'
|
|
|
|
export async function ncc_css_loader(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('css-loader')))
|
|
|
|
.ncc({
|
|
|
|
packageName: 'css-loader',
|
|
|
|
externals: {
|
|
|
|
...externals,
|
|
|
|
'schema-utils': 'next/dist/compiled/schema-utils',
|
|
|
|
},
|
|
|
|
target: 'es5',
|
|
|
|
})
|
|
|
|
.target('compiled/css-loader')
|
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-04-29 17:04:42 +02:00
|
|
|
externals['debug'] = 'next/dist/compiled/debug'
|
|
|
|
export async function ncc_debug(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('debug')))
|
|
|
|
.ncc({ packageName: 'debug', externals })
|
|
|
|
.target('compiled/debug')
|
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['devalue'] = 'next/dist/compiled/devalue'
|
2020-03-29 01:18:22 +01:00
|
|
|
export async function ncc_devalue(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('devalue')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'devalue', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/devalue')
|
2020-03-29 01:18:22 +01:00
|
|
|
}
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['escape-string-regexp'] = 'next/dist/compiled/escape-string-regexp'
|
2020-03-28 20:42:35 +01:00
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-29 01:21:07 +01:00
|
|
|
export async function ncc_escape_string_regexp(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(
|
|
|
|
opts.src || relative(__dirname, require.resolve('escape-string-regexp'))
|
|
|
|
)
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'escape-string-regexp', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/escape-string-regexp')
|
2020-03-29 01:21:07 +01:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 03:30:55 +02:00
|
|
|
externals['file-loader'] = 'next/dist/compiled/file-loader'
|
|
|
|
export async function ncc_file_loader(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('file-loader')))
|
|
|
|
.ncc({ packageName: 'file-loader', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/file-loader')
|
2020-03-30 03:30:55 +02:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-11-04 22:52:49 +01:00
|
|
|
externals['find-cache-dir'] = 'next/dist/compiled/find-cache-dir'
|
|
|
|
export async function ncc_find_cache_dir(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('find-cache-dir')))
|
|
|
|
.ncc({ packageName: 'find-cache-dir', externals })
|
|
|
|
.target('compiled/find-cache-dir')
|
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['find-up'] = 'next/dist/compiled/find-up'
|
2020-03-29 18:21:53 +02:00
|
|
|
export async function ncc_find_up(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('find-up')))
|
|
|
|
.ncc({ packageName: 'find-up', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/find-up')
|
2020-03-29 18:21:53 +02:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['fresh'] = 'next/dist/compiled/fresh'
|
2020-03-29 01:27:13 +01:00
|
|
|
export async function ncc_fresh(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('fresh')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'fresh', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/fresh')
|
2020-03-29 01:27:13 +01:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['gzip-size'] = 'next/dist/compiled/gzip-size'
|
2020-03-29 01:29:14 +01:00
|
|
|
export async function ncc_gzip_size(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('gzip-size')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'gzip-size', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/gzip-size')
|
2020-03-29 01:29:14 +01:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['http-proxy'] = 'next/dist/compiled/http-proxy'
|
2020-03-29 01:30:34 +01:00
|
|
|
export async function ncc_http_proxy(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('http-proxy')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'http-proxy', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/http-proxy')
|
2020-03-29 01:30:34 +01:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 03:37:41 +02:00
|
|
|
externals['ignore-loader'] = 'next/dist/compiled/ignore-loader'
|
|
|
|
export async function ncc_ignore_loader(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('ignore-loader')))
|
|
|
|
.ncc({ packageName: 'ignore-loader', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/ignore-loader')
|
2020-03-30 03:37:41 +02:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-10-17 21:22:10 +02:00
|
|
|
externals['is-animated'] = 'next/dist/compiled/is-animated'
|
|
|
|
export async function ncc_is_animated(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('is-animated')))
|
|
|
|
.ncc({ packageName: 'is-animated', externals })
|
|
|
|
.target('compiled/is-animated')
|
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['is-docker'] = 'next/dist/compiled/is-docker'
|
2020-03-29 01:33:35 +01:00
|
|
|
export async function ncc_is_docker(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('is-docker')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'is-docker', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/is-docker')
|
2020-03-29 01:33:35 +01:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['is-wsl'] = 'next/dist/compiled/is-wsl'
|
2020-03-29 01:33:35 +01:00
|
|
|
export async function ncc_is_wsl(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('is-wsl')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'is-wsl', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/is-wsl')
|
2020-03-29 01:33:35 +01:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['json5'] = 'next/dist/compiled/json5'
|
2020-03-29 01:36:15 +01:00
|
|
|
export async function ncc_json5(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('json5')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'json5', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/json5')
|
2020-03-29 01:36:15 +01:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['jsonwebtoken'] = 'next/dist/compiled/jsonwebtoken'
|
2020-03-29 01:37:45 +01:00
|
|
|
export async function ncc_jsonwebtoken(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('jsonwebtoken')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'jsonwebtoken', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/jsonwebtoken')
|
2020-03-29 01:37:45 +01:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2021-01-15 02:51:45 +01:00
|
|
|
externals['loader-utils'] = 'next/dist/compiled/loader-utils'
|
|
|
|
export async function ncc_loader_utils(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('loader-utils')))
|
|
|
|
.ncc({ packageName: 'loader-utils', externals })
|
|
|
|
.target('compiled/loader-utils')
|
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['lodash.curry'] = 'next/dist/compiled/lodash.curry'
|
2020-03-29 01:43:59 +01:00
|
|
|
export async function ncc_lodash_curry(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('lodash.curry')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'lodash.curry', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/lodash.curry')
|
2020-03-29 01:43:59 +01:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['lru-cache'] = 'next/dist/compiled/lru-cache'
|
2020-03-29 01:46:22 +01:00
|
|
|
export async function ncc_lru_cache(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('lru-cache')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'lru-cache', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/lru-cache')
|
2020-03-29 01:46:22 +01:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['nanoid'] = 'next/dist/compiled/nanoid'
|
2020-03-28 20:42:35 +01:00
|
|
|
export async function ncc_nanoid(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('nanoid')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'nanoid', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/nanoid')
|
2020-03-28 20:42:35 +01:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-11-04 22:52:49 +01:00
|
|
|
externals['neo-async'] = 'next/dist/compiled/neo-async'
|
|
|
|
export async function ncc_neo_async(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('neo-async')))
|
|
|
|
.ncc({ packageName: 'neo-async', externals })
|
|
|
|
.target('compiled/neo-async')
|
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['ora'] = 'next/dist/compiled/ora'
|
2020-03-29 01:53:00 +01:00
|
|
|
export async function ncc_ora(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('ora')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'ora', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/ora')
|
2020-03-29 01:53:00 +01:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 04:01:30 +02:00
|
|
|
externals['postcss-flexbugs-fixes'] =
|
|
|
|
'next/dist/compiled/postcss-flexbugs-fixes'
|
|
|
|
export async function ncc_postcss_flexbugs_fixes(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(
|
|
|
|
opts.src || relative(__dirname, require.resolve('postcss-flexbugs-fixes'))
|
|
|
|
)
|
|
|
|
.ncc({ packageName: 'postcss-flexbugs-fixes', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/postcss-flexbugs-fixes')
|
2020-03-30 04:01:30 +02:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
|
|
|
externals['postcss-loader'] = 'next/dist/compiled/postcss-loader'
|
|
|
|
export async function ncc_postcss_loader(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('postcss-loader')))
|
2021-05-19 21:14:46 +02:00
|
|
|
.ncc({
|
|
|
|
packageName: 'postcss-loader',
|
|
|
|
externals: {
|
|
|
|
...externals,
|
|
|
|
'schema-utils': 'next/dist/compiled/schema-utils3',
|
|
|
|
},
|
|
|
|
})
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/postcss-loader')
|
2020-03-30 04:01:30 +02:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
|
|
|
externals['postcss-preset-env'] = 'next/dist/compiled/postcss-preset-env'
|
|
|
|
export async function ncc_postcss_preset_env(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(
|
|
|
|
opts.src || relative(__dirname, require.resolve('postcss-preset-env'))
|
|
|
|
)
|
|
|
|
.ncc({ packageName: 'postcss-preset-env', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/postcss-preset-env')
|
2020-03-30 04:01:30 +02:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-11-14 16:03:04 +01:00
|
|
|
externals['postcss-scss'] = 'next/dist/compiled/postcss-scss'
|
|
|
|
export async function ncc_postcss_scss(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('postcss-scss')))
|
|
|
|
.ncc({
|
|
|
|
packageName: 'postcss-scss',
|
|
|
|
externals: {
|
|
|
|
postcss: 'postcss',
|
|
|
|
'postcss/lib/parser': 'postcss/lib/parser',
|
|
|
|
...externals,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
.target('compiled/postcss-scss')
|
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['recast'] = 'next/dist/compiled/recast'
|
2020-03-29 03:36:38 +02:00
|
|
|
export async function ncc_recast(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('recast')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'recast', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/recast')
|
2020-03-29 03:36:38 +02:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2021-01-19 21:08:24 +01:00
|
|
|
externals['resolve-url-loader'] = 'next/dist/compiled/resolve-url-loader'
|
|
|
|
export async function ncc_resolve_url_loader(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(
|
|
|
|
opts.src || relative(__dirname, require.resolve('resolve-url-loader'))
|
|
|
|
)
|
|
|
|
.ncc({ packageName: 'resolve-url-loader', externals })
|
|
|
|
.target('compiled/resolve-url-loader')
|
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2021-01-14 02:59:08 +01:00
|
|
|
externals['sass-loader'] = 'next/dist/compiled/sass-loader'
|
|
|
|
export async function ncc_sass_loader(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('sass-loader')))
|
|
|
|
.ncc({
|
|
|
|
packageName: 'sass-loader',
|
|
|
|
customEmit(path, isRequire) {
|
|
|
|
if (isRequire && path === 'sass') return false
|
|
|
|
if (path.indexOf('node-sass') !== -1)
|
|
|
|
return `eval("require.resolve('node-sass')")`
|
|
|
|
},
|
|
|
|
externals: {
|
|
|
|
...externals,
|
|
|
|
'schema-utils': 'next/dist/compiled/schema-utils3',
|
|
|
|
},
|
2021-01-15 02:51:45 +01:00
|
|
|
target: 'es5',
|
2021-01-14 02:59:08 +01:00
|
|
|
})
|
|
|
|
.target('compiled/sass-loader')
|
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-11-04 22:52:49 +01:00
|
|
|
externals['schema-utils'] = 'next/dist/compiled/schema-utils'
|
|
|
|
export async function ncc_schema_utils(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('schema-utils')))
|
|
|
|
.ncc({
|
|
|
|
packageName: 'schema-utils',
|
|
|
|
externals,
|
|
|
|
})
|
|
|
|
.target('compiled/schema-utils')
|
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2021-01-14 02:59:08 +01:00
|
|
|
externals['schema-utils3'] = 'next/dist/compiled/schema-utils3'
|
|
|
|
export async function ncc_schema_utils3(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(
|
|
|
|
opts.src || relative(__dirname, bundleRequire.resolve('schema-utils3'))
|
|
|
|
)
|
|
|
|
.ncc({
|
|
|
|
packageName: 'schema-utils3',
|
|
|
|
externals,
|
|
|
|
})
|
|
|
|
.target('compiled/schema-utils3')
|
|
|
|
}
|
|
|
|
externals['semver'] = 'next/dist/compiled/semver'
|
|
|
|
export async function ncc_semver(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('semver')))
|
|
|
|
.ncc({ packageName: 'semver', externals })
|
|
|
|
.target('compiled/semver')
|
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['send'] = 'next/dist/compiled/send'
|
2020-03-29 03:40:29 +02:00
|
|
|
export async function ncc_send(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('send')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'send', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/send')
|
2020-03-29 03:40:29 +02:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-05-09 17:21:53 +02:00
|
|
|
// NB: Used by other dependencies, but Vercel version is a duplicate
|
2020-03-29 21:07:55 +02:00
|
|
|
// version so can be inlined anyway (although may change in future)
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['source-map'] = 'next/dist/compiled/source-map'
|
2020-03-29 05:41:35 +02:00
|
|
|
export async function ncc_source_map(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('source-map')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'source-map', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/source-map')
|
2020-03-29 05:41:35 +02:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['string-hash'] = 'next/dist/compiled/string-hash'
|
2020-03-29 05:05:26 +02:00
|
|
|
export async function ncc_string_hash(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('string-hash')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'string-hash', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/string-hash')
|
2020-03-29 05:05:26 +02:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['strip-ansi'] = 'next/dist/compiled/strip-ansi'
|
2020-03-29 05:05:26 +02:00
|
|
|
export async function ncc_strip_ansi(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('strip-ansi')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'strip-ansi', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/strip-ansi')
|
2020-03-29 05:05:26 +02:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['terser'] = 'next/dist/compiled/terser'
|
2020-03-29 05:52:40 +02:00
|
|
|
export async function ncc_terser(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('terser')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'terser', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/terser')
|
2020-03-29 05:52:40 +02:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['text-table'] = 'next/dist/compiled/text-table'
|
2020-03-28 20:42:35 +01:00
|
|
|
export async function ncc_text_table(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('text-table')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'text-table', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/text-table')
|
2020-03-28 20:42:35 +01:00
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['unistore'] = 'next/dist/compiled/unistore'
|
2020-03-28 20:42:35 +01:00
|
|
|
export async function ncc_unistore(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('unistore')))
|
2020-03-29 18:16:32 +02:00
|
|
|
.ncc({ packageName: 'unistore', externals })
|
2020-04-07 15:42:16 +02:00
|
|
|
.target('compiled/unistore')
|
2020-03-28 20:42:35 +01:00
|
|
|
}
|
2020-11-04 22:52:49 +01:00
|
|
|
// eslint-disable-next-line camelcase
|
|
|
|
externals['web-vitals'] = 'next/dist/compiled/web-vitals'
|
|
|
|
export async function ncc_web_vitals(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('web-vitals')))
|
2020-11-06 22:02:28 +01:00
|
|
|
.ncc({ packageName: 'web-vitals', externals, target: 'es5' })
|
2020-11-04 22:52:49 +01:00
|
|
|
.target('compiled/web-vitals')
|
|
|
|
}
|
2021-01-14 02:59:08 +01:00
|
|
|
// eslint-disable-next-line camelcase
|
|
|
|
externals['webpack-sources'] = 'next/dist/compiled/webpack-sources'
|
|
|
|
export async function ncc_webpack_sources(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('webpack-sources')))
|
|
|
|
.ncc({ packageName: 'webpack-sources', externals, target: 'es5' })
|
|
|
|
.target('compiled/webpack-sources')
|
|
|
|
}
|
|
|
|
// eslint-disable-next-line camelcase
|
2021-07-29 18:10:51 +02:00
|
|
|
externals['webpack-sources3'] = 'next/dist/compiled/webpack-sources3'
|
|
|
|
export async function ncc_webpack_sources3(task, opts) {
|
2021-01-14 02:59:08 +01:00
|
|
|
await task
|
|
|
|
.source(
|
2021-07-29 18:10:51 +02:00
|
|
|
opts.src || relative(__dirname, bundleRequire.resolve('webpack-sources3'))
|
2021-01-14 02:59:08 +01:00
|
|
|
)
|
2021-07-29 18:10:51 +02:00
|
|
|
.ncc({ packageName: 'webpack-sources3', externals, target: 'es5' })
|
|
|
|
.target('compiled/webpack-sources3')
|
2021-01-14 02:59:08 +01:00
|
|
|
}
|
2021-05-12 18:04:01 +02:00
|
|
|
// eslint-disable-next-line camelcase
|
|
|
|
externals['mini-css-extract-plugin'] =
|
|
|
|
'next/dist/compiled/mini-css-extract-plugin'
|
|
|
|
export async function ncc_mini_css_extract_plugin(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(
|
|
|
|
relative(
|
|
|
|
__dirname,
|
|
|
|
resolve(require.resolve('mini-css-extract-plugin'), '../index.js')
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.ncc({
|
|
|
|
externals: {
|
|
|
|
...externals,
|
|
|
|
'./index': './index.js',
|
|
|
|
'schema-utils': 'next/dist/compiled/schema-utils3',
|
|
|
|
},
|
|
|
|
})
|
|
|
|
.target('compiled/mini-css-extract-plugin')
|
|
|
|
await task
|
|
|
|
.source(
|
|
|
|
opts.src ||
|
|
|
|
relative(__dirname, require.resolve('mini-css-extract-plugin'))
|
|
|
|
)
|
|
|
|
.ncc({
|
|
|
|
packageName: 'mini-css-extract-plugin',
|
|
|
|
externals: {
|
|
|
|
...externals,
|
|
|
|
'./index': './index.js',
|
|
|
|
'schema-utils': 'next/dist/compiled/schema-utils3',
|
|
|
|
},
|
|
|
|
})
|
|
|
|
.target('compiled/mini-css-extract-plugin')
|
|
|
|
}
|
2020-06-26 06:26:09 +02:00
|
|
|
|
2021-01-14 02:59:08 +01:00
|
|
|
// eslint-disable-next-line camelcase
|
|
|
|
export async function ncc_webpack_bundle4(task, opts) {
|
2020-05-27 20:46:18 +02:00
|
|
|
await task
|
2021-01-14 02:59:08 +01:00
|
|
|
.source(opts.src || 'bundles/webpack/bundle4.js')
|
|
|
|
.ncc({
|
|
|
|
packageName: 'webpack',
|
|
|
|
bundleName: 'webpack',
|
|
|
|
externals,
|
|
|
|
minify: false,
|
|
|
|
target: 'es5',
|
|
|
|
})
|
|
|
|
.target('compiled/webpack')
|
2020-05-27 20:46:18 +02:00
|
|
|
}
|
|
|
|
|
2021-01-14 02:59:08 +01:00
|
|
|
// eslint-disable-next-line camelcase
|
|
|
|
export async function ncc_webpack_bundle5(task, opts) {
|
2020-08-06 16:41:11 +02:00
|
|
|
await task
|
2021-01-14 02:59:08 +01:00
|
|
|
.source(opts.src || 'bundles/webpack/bundle5.js')
|
|
|
|
.ncc({
|
|
|
|
packageName: 'webpack5',
|
|
|
|
bundleName: 'webpack',
|
|
|
|
customEmit(path) {
|
|
|
|
if (path.endsWith('.runtime.js')) return `'./${basename(path)}'`
|
|
|
|
},
|
|
|
|
externals: {
|
|
|
|
...externals,
|
|
|
|
'schema-utils': 'next/dist/compiled/schema-utils3',
|
2021-07-29 18:10:51 +02:00
|
|
|
'webpack-sources': 'next/dist/compiled/webpack-sources3',
|
2021-01-14 02:59:08 +01:00
|
|
|
},
|
|
|
|
minify: false,
|
|
|
|
target: 'es5',
|
|
|
|
})
|
|
|
|
.target('compiled/webpack')
|
|
|
|
}
|
|
|
|
|
|
|
|
const webpackBundlePackages = {
|
2021-05-23 13:15:58 +02:00
|
|
|
webpack: 'next/dist/compiled/webpack/webpack-lib',
|
2021-01-14 02:59:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Object.assign(externals, webpackBundlePackages)
|
|
|
|
|
|
|
|
export async function ncc_webpack_bundle_packages(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || 'bundles/webpack/packages/*')
|
|
|
|
.target('compiled/webpack/')
|
2020-08-06 16:41:11 +02:00
|
|
|
}
|
|
|
|
|
2020-03-30 00:41:15 +02:00
|
|
|
externals['path-to-regexp'] = 'next/dist/compiled/path-to-regexp'
|
2020-03-29 19:17:06 +02:00
|
|
|
export async function path_to_regexp(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || relative(__dirname, require.resolve('path-to-regexp')))
|
|
|
|
.target('dist/compiled/path-to-regexp')
|
|
|
|
}
|
2020-03-29 19:31:43 +02:00
|
|
|
|
2021-02-03 18:02:44 +01:00
|
|
|
export async function precompile(task, opts) {
|
|
|
|
await task.parallel(
|
2021-04-29 19:50:06 +02:00
|
|
|
['browser_polyfills', 'path_to_regexp', 'copy_ncced'],
|
2021-02-03 18:02:44 +01:00
|
|
|
opts
|
|
|
|
)
|
2019-02-27 15:12:40 +01:00
|
|
|
}
|
|
|
|
|
2020-04-07 15:42:16 +02:00
|
|
|
// eslint-disable-next-line camelcase
|
|
|
|
export async function copy_ncced(task) {
|
|
|
|
// we don't ncc every time we build since these won't change
|
|
|
|
// that often and can be committed to the repo saving build time
|
|
|
|
await task.source('compiled/**/*').target('dist/compiled')
|
|
|
|
}
|
|
|
|
|
2021-02-03 18:02:44 +01:00
|
|
|
export async function ncc(task, opts) {
|
2020-07-01 17:34:00 +02:00
|
|
|
await task
|
|
|
|
.clear('compiled')
|
2021-02-03 18:02:44 +01:00
|
|
|
.parallel(
|
|
|
|
[
|
|
|
|
'ncc_amphtml_validator',
|
|
|
|
'ncc_arg',
|
|
|
|
'ncc_async_retry',
|
|
|
|
'ncc_async_sema',
|
|
|
|
'ncc_babel_bundle',
|
|
|
|
'ncc_babel_bundle_packages',
|
|
|
|
'ncc_bfj',
|
|
|
|
'ncc_cacache',
|
|
|
|
'ncc_ci_info',
|
2021-08-04 23:53:15 +02:00
|
|
|
'ncc_cli_select',
|
2021-02-03 18:02:44 +01:00
|
|
|
'ncc_comment_json',
|
|
|
|
'ncc_compression',
|
|
|
|
'ncc_conf',
|
|
|
|
'ncc_content_type',
|
|
|
|
'ncc_cookie',
|
2021-08-04 23:53:15 +02:00
|
|
|
'ncc_cross_spawn',
|
2021-02-03 18:02:44 +01:00
|
|
|
'ncc_css_loader',
|
|
|
|
'ncc_debug',
|
|
|
|
'ncc_devalue',
|
|
|
|
'ncc_escape_string_regexp',
|
|
|
|
'ncc_file_loader',
|
|
|
|
'ncc_find_cache_dir',
|
|
|
|
'ncc_find_up',
|
|
|
|
'ncc_fresh',
|
|
|
|
'ncc_gzip_size',
|
|
|
|
'ncc_http_proxy',
|
|
|
|
'ncc_ignore_loader',
|
|
|
|
'ncc_is_animated',
|
|
|
|
'ncc_is_docker',
|
|
|
|
'ncc_is_wsl',
|
|
|
|
'ncc_json5',
|
|
|
|
'ncc_jsonwebtoken',
|
|
|
|
'ncc_loader_utils',
|
|
|
|
'ncc_lodash_curry',
|
|
|
|
'ncc_lru_cache',
|
|
|
|
'ncc_nanoid',
|
|
|
|
'ncc_neo_async',
|
|
|
|
'ncc_ora',
|
|
|
|
'ncc_postcss_flexbugs_fixes',
|
|
|
|
'ncc_postcss_loader',
|
|
|
|
'ncc_postcss_preset_env',
|
|
|
|
'ncc_postcss_scss',
|
|
|
|
'ncc_recast',
|
|
|
|
'ncc_resolve_url_loader',
|
|
|
|
'ncc_sass_loader',
|
|
|
|
'ncc_schema_utils',
|
|
|
|
'ncc_schema_utils3',
|
|
|
|
'ncc_semver',
|
|
|
|
'ncc_send',
|
|
|
|
'ncc_source_map',
|
|
|
|
'ncc_string_hash',
|
|
|
|
'ncc_strip_ansi',
|
|
|
|
'ncc_terser',
|
|
|
|
'ncc_text_table',
|
|
|
|
'ncc_unistore',
|
|
|
|
'ncc_web_vitals',
|
|
|
|
'ncc_webpack_bundle4',
|
|
|
|
'ncc_webpack_bundle5',
|
|
|
|
'ncc_webpack_bundle_packages',
|
|
|
|
'ncc_webpack_sources',
|
2021-07-29 18:10:51 +02:00
|
|
|
'ncc_webpack_sources3',
|
2021-05-12 18:04:01 +02:00
|
|
|
'ncc_mini_css_extract_plugin',
|
2021-02-03 18:02:44 +01:00
|
|
|
],
|
|
|
|
opts
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function compile(task, opts) {
|
|
|
|
await task.parallel(
|
|
|
|
[
|
|
|
|
'cli',
|
|
|
|
'bin',
|
|
|
|
'server',
|
|
|
|
'nextbuild',
|
|
|
|
'nextbuildstatic',
|
|
|
|
'pages',
|
|
|
|
'lib',
|
|
|
|
'client',
|
|
|
|
'telemetry',
|
2021-06-30 11:43:31 +02:00
|
|
|
'shared',
|
2021-06-30 13:44:40 +02:00
|
|
|
'server_wasm',
|
2021-02-11 10:55:56 +01:00
|
|
|
// we compile this each time so that fresh runtime data is pulled
|
|
|
|
// before each publish
|
|
|
|
'ncc_amp_optimizer',
|
2021-02-03 18:02:44 +01:00
|
|
|
],
|
|
|
|
opts
|
|
|
|
)
|
2018-10-01 01:02:10 +02:00
|
|
|
}
|
|
|
|
|
2019-11-11 04:24:53 +01:00
|
|
|
export async function bin(task, opts) {
|
2019-05-29 13:57:26 +02:00
|
|
|
await task
|
|
|
|
.source(opts.src || 'bin/*')
|
2021-07-14 20:12:04 +02:00
|
|
|
.swc('server', { stripExtension: true, dev: opts.dev })
|
2019-05-29 13:57:26 +02:00
|
|
|
.target('dist/bin', { mode: '0755' })
|
2018-10-01 01:02:10 +02:00
|
|
|
notify('Compiled binaries')
|
|
|
|
}
|
|
|
|
|
2019-11-11 04:24:53 +01:00
|
|
|
export async function cli(task, opts) {
|
2019-05-29 13:57:26 +02:00
|
|
|
await task
|
2021-07-14 20:12:04 +02:00
|
|
|
.source('cli/**/*.+(js|ts|tsx)')
|
|
|
|
.swc('server', { dev: opts.dev })
|
2019-05-29 13:57:26 +02:00
|
|
|
.target('dist/cli')
|
2019-02-26 21:57:32 +01:00
|
|
|
notify('Compiled cli files')
|
|
|
|
}
|
|
|
|
|
2019-11-11 04:24:53 +01:00
|
|
|
export async function lib(task, opts) {
|
2019-05-29 13:57:26 +02:00
|
|
|
await task
|
|
|
|
.source(opts.src || 'lib/**/*.+(js|ts|tsx)')
|
2021-07-14 20:12:04 +02:00
|
|
|
.swc('server', { dev: opts.dev })
|
2019-05-29 13:57:26 +02:00
|
|
|
.target('dist/lib')
|
2018-10-01 01:02:10 +02:00
|
|
|
notify('Compiled lib files')
|
|
|
|
}
|
|
|
|
|
2019-11-11 04:24:53 +01:00
|
|
|
export async function server(task, opts) {
|
2019-05-29 13:57:26 +02:00
|
|
|
await task
|
|
|
|
.source(opts.src || 'server/**/*.+(js|ts|tsx)')
|
2021-07-14 20:12:04 +02:00
|
|
|
.swc('server', { dev: opts.dev })
|
2019-05-29 13:57:26 +02:00
|
|
|
.target('dist/server')
|
2018-10-01 01:02:10 +02:00
|
|
|
notify('Compiled server files')
|
|
|
|
}
|
|
|
|
|
2019-11-11 04:24:53 +01:00
|
|
|
export async function nextbuild(task, opts) {
|
2019-05-29 13:57:26 +02:00
|
|
|
await task
|
2021-08-03 14:02:23 +02:00
|
|
|
.source(opts.src || 'build/**/*.+(js|ts|tsx)', {
|
|
|
|
ignore: '**/fixture/**',
|
|
|
|
})
|
2021-07-14 20:12:04 +02:00
|
|
|
.swc('server', { dev: opts.dev })
|
2019-05-29 13:57:26 +02:00
|
|
|
.target('dist/build')
|
2018-10-01 01:02:10 +02:00
|
|
|
notify('Compiled build files')
|
|
|
|
}
|
|
|
|
|
2019-11-11 04:24:53 +01:00
|
|
|
export async function client(task, opts) {
|
2019-05-29 13:57:26 +02:00
|
|
|
await task
|
|
|
|
.source(opts.src || 'client/**/*.+(js|ts|tsx)')
|
2021-07-28 17:10:51 +02:00
|
|
|
.swc('client', { dev: opts.dev })
|
2019-05-29 13:57:26 +02:00
|
|
|
.target('dist/client')
|
2018-10-01 01:02:10 +02:00
|
|
|
notify('Compiled client files')
|
|
|
|
}
|
|
|
|
|
|
|
|
// export is a reserved keyword for functions
|
2019-11-11 04:24:53 +01:00
|
|
|
export async function nextbuildstatic(task, opts) {
|
2019-05-29 13:57:26 +02:00
|
|
|
await task
|
|
|
|
.source(opts.src || 'export/**/*.+(js|ts|tsx)')
|
2021-07-14 20:12:04 +02:00
|
|
|
.swc('server', { dev: opts.dev })
|
2019-05-29 13:57:26 +02:00
|
|
|
.target('dist/export')
|
2018-10-01 01:02:10 +02:00
|
|
|
notify('Compiled export files')
|
|
|
|
}
|
|
|
|
|
2021-02-03 18:02:44 +01:00
|
|
|
export async function pages_app(task, opts) {
|
|
|
|
await task
|
|
|
|
.source('pages/_app.tsx')
|
2021-07-28 17:10:51 +02:00
|
|
|
.swc('client', { dev: opts.dev })
|
2021-02-03 18:02:44 +01:00
|
|
|
.target('dist/pages')
|
2020-01-21 15:18:06 +01:00
|
|
|
}
|
|
|
|
|
2021-02-03 18:02:44 +01:00
|
|
|
export async function pages_error(task, opts) {
|
|
|
|
await task
|
|
|
|
.source('pages/_error.tsx')
|
2021-07-28 17:10:51 +02:00
|
|
|
.swc('client', { dev: opts.dev })
|
2021-02-03 18:02:44 +01:00
|
|
|
.target('dist/pages')
|
2018-10-01 01:02:10 +02:00
|
|
|
}
|
|
|
|
|
2021-02-03 18:02:44 +01:00
|
|
|
export async function pages_document(task, opts) {
|
|
|
|
await task
|
|
|
|
.source('pages/_document.tsx')
|
2021-07-14 20:12:04 +02:00
|
|
|
.swc('server', { dev: opts.dev })
|
2021-02-03 18:02:44 +01:00
|
|
|
.target('dist/pages')
|
2020-01-21 15:18:06 +01:00
|
|
|
}
|
|
|
|
|
2021-02-03 18:02:44 +01:00
|
|
|
export async function pages(task, opts) {
|
|
|
|
await task.parallel(['pages_app', 'pages_error', 'pages_document'], opts)
|
2020-01-21 15:18:06 +01:00
|
|
|
}
|
|
|
|
|
2019-11-11 04:24:53 +01:00
|
|
|
export async function telemetry(task, opts) {
|
2019-08-29 18:43:06 +02:00
|
|
|
await task
|
|
|
|
.source(opts.src || 'telemetry/**/*.+(js|ts|tsx)')
|
2021-07-14 20:12:04 +02:00
|
|
|
.swc('server', { dev: opts.dev })
|
2019-08-29 18:43:06 +02:00
|
|
|
.target('dist/telemetry')
|
|
|
|
notify('Compiled telemetry files')
|
|
|
|
}
|
|
|
|
|
2021-02-03 18:02:44 +01:00
|
|
|
export async function build(task, opts) {
|
|
|
|
await task.serial(['precompile', 'compile'], opts)
|
2018-10-01 01:02:10 +02:00
|
|
|
}
|
|
|
|
|
2020-05-18 21:24:37 +02:00
|
|
|
export default async function (task) {
|
2021-02-03 18:02:44 +01:00
|
|
|
const opts = { dev: true }
|
2018-11-30 13:10:30 +01:00
|
|
|
await task.clear('dist')
|
2021-02-03 18:02:44 +01:00
|
|
|
await task.start('build', opts)
|
|
|
|
await task.watch('bin/*', 'bin', opts)
|
|
|
|
await task.watch('pages/**/*.+(js|ts|tsx)', 'pages', opts)
|
|
|
|
await task.watch('server/**/*.+(js|ts|tsx)', 'server', opts)
|
|
|
|
await task.watch('build/**/*.+(js|ts|tsx)', 'nextbuild', opts)
|
|
|
|
await task.watch('export/**/*.+(js|ts|tsx)', 'nextbuildstatic', opts)
|
|
|
|
await task.watch('client/**/*.+(js|ts|tsx)', 'client', opts)
|
|
|
|
await task.watch('lib/**/*.+(js|ts|tsx)', 'lib', opts)
|
|
|
|
await task.watch('cli/**/*.+(js|ts|tsx)', 'cli', opts)
|
|
|
|
await task.watch('telemetry/**/*.+(js|ts|tsx)', 'telemetry', opts)
|
2021-06-30 11:43:31 +02:00
|
|
|
await task.watch('shared/**/*.+(js|ts|tsx)', 'shared', opts)
|
2021-06-30 13:44:40 +02:00
|
|
|
await task.watch('server/**/*.+(wasm)', 'server_wasm', opts)
|
2019-09-04 16:00:54 +02:00
|
|
|
}
|
|
|
|
|
2021-06-30 11:43:31 +02:00
|
|
|
export async function shared(task, opts) {
|
|
|
|
await task
|
|
|
|
.source(opts.src || 'shared/**/*.+(js|ts|tsx)')
|
2021-07-14 20:12:04 +02:00
|
|
|
.swc('server', { dev: opts.dev })
|
2021-06-30 11:43:31 +02:00
|
|
|
.target('dist/shared')
|
|
|
|
notify('Compiled shared files')
|
|
|
|
}
|
|
|
|
|
2021-06-30 13:44:40 +02:00
|
|
|
export async function server_wasm(task, opts) {
|
|
|
|
await task.source(opts.src || 'server/**/*.+(wasm)').target('dist/server')
|
2021-02-18 11:23:24 +01:00
|
|
|
notify('Moved server wasm files')
|
|
|
|
}
|
|
|
|
|
2019-11-11 04:24:53 +01:00
|
|
|
export async function release(task) {
|
2018-10-01 01:02:10 +02:00
|
|
|
await task.clear('dist').start('build')
|
|
|
|
}
|
|
|
|
|
|
|
|
// notification helper
|
2019-11-11 04:24:53 +01:00
|
|
|
function notify(msg) {
|
2018-10-01 01:02:10 +02:00
|
|
|
return notifier.notify({
|
|
|
|
title: '▲ Next',
|
|
|
|
message: msg,
|
2019-11-11 04:24:53 +01:00
|
|
|
icon: false,
|
2018-10-01 01:02:10 +02:00
|
|
|
})
|
|
|
|
}
|