Commit 35a6710c authored by Guy Bedford's avatar Guy Bedford Committed by Joe Haddad

babel revert

parent d7684408
import { NodePath, PluginObj } from 'next/dist/compiled/babel--core' import { NodePath, PluginObj } from '@babel/core'
import { JSXOpeningElement } from 'next/dist/compiled/babel--types' import { JSXOpeningElement } from '@babel/types'
export default function AmpAttributePatcher(...args: any): PluginObj { export default function AmpAttributePatcher(...args: any): PluginObj {
return { return {
......
import { NodePath, PluginObj } from 'next/dist/compiled/babel--core' import { NodePath, PluginObj } from '@babel/core'
import commonjsPlugin from 'next/dist/compiled/babel--plugin-transform-modules-commonjs' import commonjsPlugin from '@babel/plugin-transform-modules-commonjs'
import { Program } from 'next/dist/compiled/babel--types' import { Program } from '@babel/types'
// Rewrite imports using next/<something> to next-server/<something> // Rewrite imports using next/<something> to next-server/<something>
export default function NextToNextServer(...args: any): PluginObj { export default function NextToNextServer(...args: any): PluginObj {
......
import { NodePath, PluginObj } from 'next/dist/compiled/babel--core' import { NodePath, PluginObj } from '@babel/core'
import * as BabelTypes from 'next/dist/compiled/babel--types' import * as BabelTypes from '@babel/types'
export default function({ export default function({
types: t, types: t,
...@@ -7,7 +7,7 @@ export default function({ ...@@ -7,7 +7,7 @@ export default function({
types: typeof BabelTypes types: typeof BabelTypes
}): PluginObj<any> { }): PluginObj<any> {
return { return {
inherits: require('next/dist/compiled/babel-plugin-syntax-jsx'), inherits: require('babel-plugin-syntax-jsx'),
visitor: { visitor: {
JSXElement(path, state) { JSXElement(path, state) {
state.set('jsx', true) state.set('jsx', true)
......
import { NodePath, PluginObj } from 'next/dist/compiled/babel--core' import { NodePath, PluginObj } from '@babel/core'
import * as BabelTypes from 'next/dist/compiled/babel--types' import * as BabelTypes from '@babel/types'
export default function({ export default function({
types: t, types: t,
......
import { NodePath, PluginObj } from 'next/dist/compiled/babel--core' import { NodePath, PluginObj } from '@babel/core'
import * as BabelTypes from 'next/dist/compiled/babel--types' import * as BabelTypes from '@babel/types'
import { PageConfig } from 'next/types' import { PageConfig } from 'next/types'
const STRING_LITERAL_DROP_BUNDLE = '__NEXT_DROP_CLIENT_FILE__' const STRING_LITERAL_DROP_BUNDLE = '__NEXT_DROP_CLIENT_FILE__'
......
import { NodePath, PluginObj } from 'next/dist/compiled/babel--core' import { NodePath, PluginObj } from '@babel/core'
import * as BabelTypes from 'next/dist/compiled/babel--types' import * as BabelTypes from '@babel/types'
import { SERVER_PROPS_SSG_CONFLICT } from '../../../lib/constants' import { SERVER_PROPS_SSG_CONFLICT } from '../../../lib/constants'
import { import {
STATIC_PROPS_ID, STATIC_PROPS_ID,
......
import { NodePath, PluginObj } from 'next/dist/compiled/babel--core' import { NodePath, PluginObj } from '@babel/core'
import * as BabelTypes from 'next/dist/compiled/babel--types' import * as BabelTypes from '@babel/types'
// matches any hook-like (the default) // matches any hook-like (the default)
const isHook = /^use[A-Z]/ const isHook = /^use[A-Z]/
......
...@@ -23,8 +23,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWAR ...@@ -23,8 +23,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWAR
// Modified to put `webpack` and `modules` under `loadableGenerated` to be backwards compatible with next/dynamic which has a `modules` key // Modified to put `webpack` and `modules` under `loadableGenerated` to be backwards compatible with next/dynamic which has a `modules` key
// Modified to support `dynamic(import('something'))` and `dynamic(import('something'), options) // Modified to support `dynamic(import('something'))` and `dynamic(import('something'), options)
import { NodePath, PluginObj } from 'next/dist/compiled/babel--core' import { NodePath, PluginObj } from '@babel/core'
import * as BabelTypes from 'next/dist/compiled/babel--types' import * as BabelTypes from '@babel/types'
export default function({ types: t }: { types: typeof BabelTypes }): PluginObj { export default function({ types: t }: { types: typeof BabelTypes }): PluginObj {
return { return {
......
import { PluginItem } from 'next/dist/compiled/babel--core' import { PluginItem } from '@babel/core'
const env = process.env.NODE_ENV const env = process.env.NODE_ENV
const isProduction = env === 'production' const isProduction = env === 'production'
const isDevelopment = env === 'development' const isDevelopment = env === 'development'
...@@ -103,11 +103,11 @@ module.exports = ( ...@@ -103,11 +103,11 @@ module.exports = (
sourceType: 'unambiguous', sourceType: 'unambiguous',
presets: [ presets: [
customModernPreset || [ customModernPreset || [
require('next/dist/compiled/babel--preset-env').default, require('@babel/preset-env').default,
presetEnvConfig, presetEnvConfig,
], ],
[ [
require('next/dist/compiled/babel--preset-react'), require('@babel/preset-react'),
{ {
// This adds @babel/plugin-transform-react-jsx-source and // This adds @babel/plugin-transform-react-jsx-source and
// @babel/plugin-transform-react-jsx-self automatically in development // @babel/plugin-transform-react-jsx-self automatically in development
...@@ -116,10 +116,7 @@ module.exports = ( ...@@ -116,10 +116,7 @@ module.exports = (
...options['preset-react'], ...options['preset-react'],
}, },
], ],
[ [require('@babel/preset-typescript'), { allowNamespaces: true }],
require('next/dist/compiled/babel--preset-typescript'),
{ allowNamespaces: true },
],
], ],
plugins: [ plugins: [
[ [
...@@ -141,20 +138,20 @@ module.exports = ( ...@@ -141,20 +138,20 @@ module.exports = (
lib: true, lib: true,
}, },
], ],
require('next/dist/compiled/babel--plugin-syntax-dynamic-import'), require('@babel/plugin-syntax-dynamic-import'),
require('./plugins/react-loadable-plugin'), require('./plugins/react-loadable-plugin'),
[ [
require('next/dist/compiled/babel--plugin-proposal-class-properties'), require('@babel/plugin-proposal-class-properties'),
options['class-properties'] || {}, options['class-properties'] || {},
], ],
[ [
require('next/dist/compiled/babel--plugin-proposal-object-rest-spread'), require('@babel/plugin-proposal-object-rest-spread'),
{ {
useBuiltIns: true, useBuiltIns: true,
}, },
], ],
!isServer && [ !isServer && [
require('next/dist/compiled/babel--plugin-transform-runtime'), require('@babel/plugin-transform-runtime'),
{ {
corejs: false, corejs: false,
helpers: true, helpers: true,
...@@ -172,27 +169,20 @@ module.exports = ( ...@@ -172,27 +169,20 @@ module.exports = (
], ],
require('./plugins/amp-attributes'), require('./plugins/amp-attributes'),
isProduction && [ isProduction && [
require('next/dist/compiled/babel-plugin-transform-react-remove-prop-types'), require('babel-plugin-transform-react-remove-prop-types'),
{ {
removeImport: true, removeImport: true,
}, },
], ],
require('next/dist/compiled/babel--plugin-proposal-optional-chaining'), require('@babel/plugin-proposal-optional-chaining'),
require('next/dist/compiled/babel--plugin-proposal-nullish-coalescing-operator'), require('@babel/plugin-proposal-nullish-coalescing-operator'),
isServer && require('next/dist/compiled/babel--plugin-syntax-bigint'), isServer && require('@babel/plugin-syntax-bigint'),
[ [require('@babel/plugin-proposal-numeric-separator').default, false],
require('next/dist/compiled/babel--plugin-proposal-numeric-separator')
.default,
false,
],
].filter(Boolean), ].filter(Boolean),
overrides: [ overrides: [
{ {
test: /\.tsx?$/, test: /\.tsx?$/,
plugins: [ plugins: [require('@babel/plugin-proposal-numeric-separator').default],
require('next/dist/compiled/babel--plugin-proposal-numeric-separator')
.default,
],
}, },
], ],
} }
......
import chalk from 'next/dist/compiled/chalk' import chalk from 'next/dist/compiled/chalk'
import { findConfig } from '../../../../../lib/find-config' import { findConfig } from '../../../../../lib/find-config'
import { resolveRequest } from '../../../../../lib/resolve-request' import { resolveRequest } from '../../../../../lib/resolve-request'
import browserslist from 'next/dist/compiled/browserslist' import browserslist from 'browserslist'
type CssPluginCollection_Array = (string | [string, boolean | object])[] type CssPluginCollection_Array = (string | [string, boolean | object])[]
......
import babelLoader from 'next/dist/compiled/babel-loader' import babelLoader from 'babel-loader'
import { basename, join } from 'path' import { basename, join } from 'path'
import hash from 'next/dist/compiled/string-hash' import hash from 'next/dist/compiled/string-hash'
...@@ -44,7 +44,7 @@ module.exports = babelLoader.custom(babel => { ...@@ -44,7 +44,7 @@ module.exports = babelLoader.custom(babel => {
{ type: 'plugin' } { type: 'plugin' }
) )
const commonJsItem = babel.createConfigItem( const commonJsItem = babel.createConfigItem(
require('next/dist/compiled/babel--plugin-transform-modules-commonjs'), require('@babel/plugin-transform-modules-commonjs'),
{ type: 'plugin' } { type: 'plugin' }
) )
...@@ -180,7 +180,7 @@ module.exports = babelLoader.custom(babel => { ...@@ -180,7 +180,7 @@ module.exports = babelLoader.custom(babel => {
} }
options.plugins.push([ options.plugins.push([
require.resolve('next/dist/compiled/babel-plugin-transform-define'), require.resolve('babel-plugin-transform-define'),
{ {
'process.env.NODE_ENV': development ? 'development' : 'production', 'process.env.NODE_ENV': development ? 'development' : 'production',
'typeof window': isServer ? 'undefined' : 'object', 'typeof window': isServer ? 'undefined' : 'object',
......
...@@ -170,7 +170,7 @@ export default class NextEsmPlugin implements Plugin { ...@@ -170,7 +170,7 @@ export default class NextEsmPlugin implements Plugin {
if (IS_PRESET_ENV.test(name)) { if (IS_PRESET_ENV.test(name)) {
presets.push([ presets.push([
require.resolve('next/dist/compiled/babel--preset-modules'), require.resolve('@babel/preset-modules'),
{ loose: true }, { loose: true },
]) ])
} else { } else {
......
...@@ -58,8 +58,29 @@ ...@@ -58,8 +58,29 @@
}, },
"dependencies": { "dependencies": {
"@ampproject/toolbox-optimizer": "2.0.1", "@ampproject/toolbox-optimizer": "2.0.1",
"@babel/core": "7.7.2",
"@babel/plugin-proposal-class-properties": "7.7.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "7.7.4",
"@babel/plugin-proposal-numeric-separator": "7.8.3",
"@babel/plugin-proposal-object-rest-spread": "7.6.2",
"@babel/plugin-proposal-optional-chaining": "7.7.4",
"@babel/plugin-syntax-bigint": "7.8.3",
"@babel/plugin-syntax-dynamic-import": "7.2.0",
"@babel/plugin-transform-modules-commonjs": "7.7.0",
"@babel/plugin-transform-runtime": "7.6.2",
"@babel/preset-env": "7.7.1",
"@babel/preset-modules": "0.1.1",
"@babel/preset-react": "7.7.0",
"@babel/preset-typescript": "7.7.2",
"@babel/runtime": "7.7.2", "@babel/runtime": "7.7.2",
"@babel/types": "7.7.4",
"autodll-webpack-plugin": "0.4.2", "autodll-webpack-plugin": "0.4.2",
"babel-loader": "8.0.6",
"babel-plugin-dynamic-import-node": "2.3.0",
"babel-plugin-syntax-jsx": "6.18.0",
"babel-plugin-transform-define": "2.0.0",
"babel-plugin-transform-react-remove-prop-types": "0.4.24",
"browserslist": "4.8.3",
"cache-loader": "4.1.0", "cache-loader": "4.1.0",
"css-loader": "3.3.0", "css-loader": "3.3.0",
"cssnano-simple": "1.0.0", "cssnano-simple": "1.0.0",
...@@ -95,21 +116,6 @@ ...@@ -95,21 +116,6 @@
"react-dom": "^16.6.0" "react-dom": "^16.6.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "7.7.2",
"@babel/plugin-proposal-class-properties": "7.7.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "7.7.4",
"@babel/plugin-proposal-numeric-separator": "7.8.3",
"@babel/plugin-proposal-object-rest-spread": "7.6.2",
"@babel/plugin-proposal-optional-chaining": "7.7.4",
"@babel/plugin-syntax-bigint": "7.8.3",
"@babel/plugin-syntax-dynamic-import": "7.2.0",
"@babel/plugin-transform-modules-commonjs": "7.7.0",
"@babel/plugin-transform-runtime": "7.6.2",
"@babel/preset-env": "7.7.1",
"@babel/preset-modules": "0.1.1",
"@babel/preset-react": "7.7.0",
"@babel/preset-typescript": "7.7.2",
"@babel/types": "7.7.4",
"@next/polyfill-nomodule": "9.3.4-canary.0", "@next/polyfill-nomodule": "9.3.4-canary.0",
"@taskr/clear": "1.1.0", "@taskr/clear": "1.1.0",
"@taskr/esnext": "1.1.0", "@taskr/esnext": "1.1.0",
...@@ -153,12 +159,6 @@ ...@@ -153,12 +159,6 @@
"ast-types": "0.13.2", "ast-types": "0.13.2",
"async-retry": "1.2.3", "async-retry": "1.2.3",
"async-sema": "3.0.0", "async-sema": "3.0.0",
"babel-loader": "8.0.6",
"babel-plugin-dynamic-import-node": "2.3.0",
"babel-plugin-syntax-jsx": "6.18.0",
"babel-plugin-transform-define": "2.0.0",
"babel-plugin-transform-react-remove-prop-types": "0.4.24",
"browserslist": "4.8.3",
"chalk": "2.4.2", "chalk": "2.4.2",
"ci-info": "2.0.0", "ci-info": "2.0.0",
"compression": "1.7.4", "compression": "1.7.4",
......
This diff is collapsed.
...@@ -26,7 +26,7 @@ type EventCliSessionStarted = { ...@@ -26,7 +26,7 @@ type EventCliSessionStarted = {
function hasBabelConfig(dir: string): boolean { function hasBabelConfig(dir: string): boolean {
try { try {
const noopFile = path.join(dir, 'noop.js') const noopFile = path.join(dir, 'noop.js')
const res = require('next/dist/compiled/babel--core').loadPartialConfig({ const res = require('@babel/core').loadPartialConfig({
cwd: dir, cwd: dir,
filename: noopFile, filename: noopFile,
sourceFileName: noopFile, sourceFileName: noopFile,
......
declare module 'next/dist/compiled/babel--plugin-transform-modules-commonjs' declare module '@babel/plugin-transform-modules-commonjs'
declare module 'webpack/lib/GraphHelpers' declare module 'browserslist'
declare module 'webpack/lib/DynamicEntryPlugin'
declare module 'unfetch'
declare module 'launch-editor'
declare module 'styled-jsx/server'
declare module 'cssnano-simple' { declare module 'cssnano-simple' {
import { Plugin } from 'postcss' import { Plugin } from 'postcss'
const cssnanoSimple: Plugin<{}> const cssnanoSimple: Plugin<{}>
export = cssnanoSimple export = cssnanoSimple
} }
declare module 'launch-editor'
declare module 'styled-jsx/server'
declare module 'unfetch'
declare module 'webpack/lib/GraphHelpers'
declare module 'webpack/lib/DynamicEntryPlugin'
declare module 'next/dist/compiled/amphtml-validator' { declare module 'next/dist/compiled/amphtml-validator' {
import m from 'amphtml-validator' import m from 'amphtml-validator'
export = m export = m
...@@ -46,15 +47,6 @@ declare module 'next/dist/compiled/arg/index.js' { ...@@ -46,15 +47,6 @@ declare module 'next/dist/compiled/arg/index.js' {
export = arg export = arg
} }
declare module 'next/dist/compiled/babel--core' {
import m from '@babel/core'
export = m
}
declare module 'next/dist/compiled/babel--types' {
import m from '@babel/types'
export = m
}
declare module 'next/dist/compiled/browserslist'
declare module 'next/dist/compiled/chalk' { declare module 'next/dist/compiled/chalk' {
import m from 'chalk' import m from 'chalk'
export = m export = m
......
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