Skip to content

Commit

Permalink
Pre-compile more dependencies continued (#32679)
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk authored Dec 21, 2021
1 parent 4f67edd commit 3667eba
Show file tree
Hide file tree
Showing 263 changed files with 4,924 additions and 1,953 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PluginObj, types as BabelTypes } from 'next/dist/compiled/babel/core'
import chalk from 'chalk'
import chalk from 'next/dist/compiled/chalk'

export default function NoAnonymousDefaultExport({
types: t,
Expand Down
6 changes: 5 additions & 1 deletion packages/next/build/babel/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,11 @@ export default (
regenerator: true,
useESModules: supportsESM && presetEnvConfig.modules !== 'commonjs',
absoluteRuntime: isBabelLoader
? dirname(require.resolve('@babel/runtime/package.json'))
? dirname(
require.resolve(
'next/dist/compiled/@babel/runtime/package.json'
)
)
: undefined,
...options['transform-runtime'],
},
Expand Down
2 changes: 1 addition & 1 deletion packages/next/build/entries.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chalk from 'chalk'
import chalk from 'next/dist/compiled/chalk'
import { posix, join } from 'path'
import { stringify } from 'querystring'
import { API_ROUTE, DOT_NEXT_ALIAS, PAGES_DIR_ALIAS } from '../lib/constants'
Expand Down
2 changes: 1 addition & 1 deletion packages/next/build/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { loadEnvConfig } from '@next/env'
import chalk from 'chalk'
import chalk from 'next/dist/compiled/chalk'
import crypto from 'crypto'
import { isMatch } from 'next/dist/compiled/micromatch'
import { promises, writeFileSync } from 'fs'
Expand Down
2 changes: 1 addition & 1 deletion packages/next/build/output/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chalk from 'chalk'
import chalk from 'next/dist/compiled/chalk'
import stripAnsi from 'next/dist/compiled/strip-ansi'
import textTable from 'next/dist/compiled/text-table'
import createStore from 'next/dist/compiled/unistore'
Expand Down
2 changes: 1 addition & 1 deletion packages/next/build/output/log.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chalk from 'chalk'
import chalk from 'next/dist/compiled/chalk'

export const prefixes = {
wait: chalk.cyan('wait') + ' -',
Expand Down
2 changes: 1 addition & 1 deletion packages/next/build/swc/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { platform, arch } from 'os'
import { platformArchTriples } from '@napi-rs/triples'
import { platformArchTriples } from 'next/dist/compiled/@napi-rs/triples'
import * as Log from '../output/log'

const ArchName = arch()
Expand Down
4 changes: 3 additions & 1 deletion packages/next/build/swc/options.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const nextDistPath =
/(next[\\/]dist[\\/]shared[\\/]lib)|(next[\\/]dist[\\/]client)|(next[\\/]dist[\\/]pages)/

const regeneratorRuntimePath = require.resolve('regenerator-runtime')
const regeneratorRuntimePath = require.resolve(
'next/dist/compiled/regenerator-runtime'
)

function getBaseSWCOptions({
filename,
Expand Down
2 changes: 1 addition & 1 deletion packages/next/build/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import '../server/node-polyfill-fetch'
import chalk from 'chalk'
import chalk from 'next/dist/compiled/chalk'
import getGzipSize from 'next/dist/compiled/gzip-size'
import textTable from 'next/dist/compiled/text-table'
import path from 'path'
Expand Down
4 changes: 2 additions & 2 deletions packages/next/build/webpack-config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ReactRefreshWebpackPlugin from '@next/react-refresh-utils/ReactRefreshWebpackPlugin'
import chalk from 'chalk'
import chalk from 'next/dist/compiled/chalk'
import crypto from 'crypto'
import { stringify } from 'querystring'
import semver from 'next/dist/compiled/semver'
Expand Down Expand Up @@ -50,7 +50,7 @@ import { FlightManifestPlugin } from './webpack/plugins/flight-manifest-plugin'
import { TelemetryPlugin } from './webpack/plugins/telemetry-plugin'
import type { Span } from '../trace'
import { getRawPageExtensions } from './utils'
import browserslist from 'browserslist'
import browserslist from 'next/dist/compiled/browserslist'
import loadJsConfig from './load-jsconfig'

const watchOptions = Object.freeze({
Expand Down
2 changes: 1 addition & 1 deletion packages/next/build/webpack/config/blocks/css/messages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chalk from 'chalk'
import chalk from 'next/dist/compiled/chalk'

export function getGlobalImportError() {
return `Global CSS ${chalk.bold(
Expand Down
2 changes: 1 addition & 1 deletion packages/next/build/webpack/config/blocks/css/plugins.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chalk from 'chalk'
import chalk from 'next/dist/compiled/chalk'
import { findConfig } from '../../../../../lib/find-config'

type CssPluginCollection_Array = (string | [string, boolean | object])[]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chalk from 'chalk'
import chalk from 'next/dist/compiled/chalk'

export function getCustomDocumentImageError() {
return `Images ${chalk.bold('cannot')} be imported within ${chalk.cyan(
Expand Down
2 changes: 1 addition & 1 deletion packages/next/build/webpack/loaders/error-loader.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chalk from 'chalk'
import chalk from 'next/dist/compiled/chalk'
import path from 'path'
import { webpack } from 'next/dist/compiled/webpack/webpack'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Chalk from 'chalk'
import Chalk from 'next/dist/compiled/chalk'
import { SimpleWebpackError } from './simpleWebpackError'

const chalk = new Chalk.constructor({ enabled: true })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Chalk from 'chalk'
import Chalk from 'next/dist/compiled/chalk'
import { SimpleWebpackError } from './simpleWebpackError'

const chalk = new Chalk.constructor({ enabled: true })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Chalk from 'chalk'
import Chalk from 'next/dist/compiled/chalk'
import { SimpleWebpackError } from './simpleWebpackError'
import { createOriginalStackFrame } from '@next/react-dev-overlay/lib/middleware'
import { createOriginalStackFrame } from 'next/dist/compiled/@next/react-dev-overlay/middleware'
import type { webpack5 } from 'next/dist/compiled/webpack/webpack'

const chalk = new Chalk.constructor({ enabled: true })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { codeFrameColumns } from 'next/dist/compiled/babel/code-frame'
import Chalk from 'chalk'
import Chalk from 'next/dist/compiled/chalk'
import { SimpleWebpackError } from './simpleWebpackError'

const chalk = new Chalk.constructor({ enabled: true })
Expand Down
5 changes: 5 additions & 0 deletions packages/next/build/webpack/require-hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ const hookPropertyMap = new Map(
['webpack-sources/lib', 'next/dist/compiled/webpack/sources'],
['webpack-sources/lib/index', 'next/dist/compiled/webpack/sources'],
['webpack-sources/lib/index.js', 'next/dist/compiled/webpack/sources'],
['@babel/runtime', 'next/dist/compiled/@babel/runtime/package.json'],
[
'@babel/runtime/package.json',
'next/dist/compiled/@babel/runtime/package.json',
],
].map(([request, replacement]) => [request, require.resolve(replacement)])
)

Expand Down
2 changes: 1 addition & 1 deletion packages/next/cli/next-lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { existsSync } from 'fs'
import arg from 'next/dist/compiled/arg/index.js'
import { join } from 'path'
import chalk from 'chalk'
import chalk from 'next/dist/compiled/chalk'

import { cliCommand } from '../bin/next'
import { ESLINT_DEFAULT_DIRS } from '../lib/constants'
Expand Down
2 changes: 1 addition & 1 deletion packages/next/cli/next-telemetry.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node
import chalk from 'chalk'
import chalk from 'next/dist/compiled/chalk'
import arg from 'next/dist/compiled/arg/index.js'
import { printAndExit } from '../server/lib/utils'
import { cliCommand } from '../bin/next'
Expand Down
2 changes: 1 addition & 1 deletion packages/next/client/dev/error-overlay/hot-dev-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
onBuildOk,
onRefresh,
onFullRefreshNeeded,
} from '@next/react-dev-overlay/lib/client'
} from 'next/dist/compiled/@next/react-dev-overlay/client'
import stripAnsi from 'next/dist/compiled/strip-ansi'
import { addMessageListener } from './websocket'
import formatWebpackMessages from './format-webpack-messages'
Expand Down
10 changes: 7 additions & 3 deletions packages/next/client/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* global location */
import '@next/polyfill-module'
import '../build/polyfills/polyfill-module'
import React, { useState } from 'react'
import ReactDOM from 'react-dom'
import { StyleRegistry } from 'styled-jsx'
Expand Down Expand Up @@ -258,7 +258,9 @@ class Container extends React.Component<{
if (process.env.NODE_ENV === 'production') {
return this.props.children
} else {
const { ReactDevOverlay } = require('@next/react-dev-overlay/lib/client')
const {
ReactDevOverlay,
} = require('next/dist/compiled/@next/react-dev-overlay/client')
return <ReactDevOverlay>{this.props.children}</ReactDevOverlay>
}
}
Expand Down Expand Up @@ -342,7 +344,9 @@ export async function initNext(opts: { webpackHMR?: any } = {}) {
}

if (process.env.NODE_ENV === 'development') {
const { getNodeError } = require('@next/react-dev-overlay/lib/client')
const {
getNodeError,
} = require('next/dist/compiled/@next/react-dev-overlay/client')
// Server-side runtime errors need to be re-thrown on the client-side so
// that the overlay is rendered.
if (initialErr) {
Expand Down
22 changes: 22 additions & 0 deletions packages/next/compiled/@babel/runtime/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2014-present Sebastian McKenzie and other contributors

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.
19 changes: 19 additions & 0 deletions packages/next/compiled/@babel/runtime/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# @babel/runtime

> babel's modular runtime helpers
See our website [@babel/runtime](https://babeljs.io/docs/en/babel-runtime) for more information.

## Install

Using npm:

```sh
npm install --save @babel/runtime
```

or using yarn:

```sh
yarn add @babel/runtime
```
99 changes: 99 additions & 0 deletions packages/next/compiled/@babel/runtime/helpers/AsyncGenerator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
var AwaitValue = require("./AwaitValue.js");

function AsyncGenerator(gen) {
var front, back;

function send(key, arg) {
return new Promise(function (resolve, reject) {
var request = {
key: key,
arg: arg,
resolve: resolve,
reject: reject,
next: null
};

if (back) {
back = back.next = request;
} else {
front = back = request;
resume(key, arg);
}
});
}

function resume(key, arg) {
try {
var result = gen[key](arg);
var value = result.value;
var wrappedAwait = value instanceof AwaitValue;
Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) {
if (wrappedAwait) {
resume(key === "return" ? "return" : "next", arg);
return;
}

settle(result.done ? "return" : "normal", arg);
}, function (err) {
resume("throw", err);
});
} catch (err) {
settle("throw", err);
}
}

function settle(type, value) {
switch (type) {
case "return":
front.resolve({
value: value,
done: true
});
break;

case "throw":
front.reject(value);
break;

default:
front.resolve({
value: value,
done: false
});
break;
}

front = front.next;

if (front) {
resume(front.key, front.arg);
} else {
back = null;
}
}

this._invoke = send;

if (typeof gen["return"] !== "function") {
this["return"] = undefined;
}
}

AsyncGenerator.prototype[typeof Symbol === "function" && Symbol.asyncIterator || "@@asyncIterator"] = function () {
return this;
};

AsyncGenerator.prototype.next = function (arg) {
return this._invoke("next", arg);
};

AsyncGenerator.prototype["throw"] = function (arg) {
return this._invoke("throw", arg);
};

AsyncGenerator.prototype["return"] = function (arg) {
return this._invoke("return", arg);
};

module.exports = AsyncGenerator;
module.exports["default"] = module.exports, module.exports.__esModule = true;
6 changes: 6 additions & 0 deletions packages/next/compiled/@babel/runtime/helpers/AwaitValue.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function _AwaitValue(value) {
this.wrapped = value;
}

module.exports = _AwaitValue;
module.exports["default"] = module.exports, module.exports.__esModule = true;
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
var desc = {};
Object.keys(descriptor).forEach(function (key) {
desc[key] = descriptor[key];
});
desc.enumerable = !!desc.enumerable;
desc.configurable = !!desc.configurable;

if ('value' in desc || desc.initializer) {
desc.writable = true;
}

desc = decorators.slice().reverse().reduce(function (desc, decorator) {
return decorator(target, property, desc) || desc;
}, desc);

if (context && desc.initializer !== void 0) {
desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
desc.initializer = undefined;
}

if (desc.initializer === void 0) {
Object.defineProperty(target, property, desc);
desc = null;
}

return desc;
}

module.exports = _applyDecoratedDescriptor;
module.exports["default"] = module.exports, module.exports.__esModule = true;
Loading

0 comments on commit 3667eba

Please sign in to comment.