mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
Add src path alais to be nuxt (#2)
This commit is contained in:
parent
14f187e69b
commit
fd0a437adc
@ -15,8 +15,8 @@ import template from 'lodash/template'
|
|||||||
import uniq from 'lodash/uniq'
|
import uniq from 'lodash/uniq'
|
||||||
import uniqBy from 'lodash/uniqBy'
|
import uniqBy from 'lodash/uniqBy'
|
||||||
|
|
||||||
import { BundleBuilder } from 'src/webpack'
|
import { BundleBuilder } from 'nuxt/webpack'
|
||||||
import vueAppTemplate from 'src/vue-app/template'
|
import vueAppTemplate from 'nuxt/vue-app/template'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
r,
|
r,
|
||||||
@ -29,7 +29,7 @@ import {
|
|||||||
scanRequireTree,
|
scanRequireTree,
|
||||||
TARGETS,
|
TARGETS,
|
||||||
isFullStatic
|
isFullStatic
|
||||||
} from 'src/utils'
|
} from 'nuxt/utils'
|
||||||
|
|
||||||
import Ignore from './ignore'
|
import Ignore from './ignore'
|
||||||
import BuildContext from './context/build'
|
import BuildContext from './context/build'
|
||||||
|
@ -4,7 +4,7 @@ import uniqBy from 'lodash/uniqBy'
|
|||||||
import serialize from 'serialize-javascript'
|
import serialize from 'serialize-javascript'
|
||||||
|
|
||||||
import devalue from '@nuxt/devalue'
|
import devalue from '@nuxt/devalue'
|
||||||
import { r, wp, wChunk, serializeFunction, isFullStatic } from 'src/utils'
|
import { r, wp, wChunk, serializeFunction, isFullStatic } from 'nuxt/utils'
|
||||||
|
|
||||||
export default class TemplateContext {
|
export default class TemplateContext {
|
||||||
constructor(builder, options) {
|
constructor(builder, options) {
|
||||||
|
@ -8,9 +8,9 @@ import { forceExit } from './utils'
|
|||||||
import { loadNuxtConfig } from './utils/config'
|
import { loadNuxtConfig } from './utils/config'
|
||||||
import { indent, foldLines, colorize } from './utils/formatting'
|
import { indent, foldLines, colorize } from './utils/formatting'
|
||||||
import { startSpaces, optionSpaces, forceExitTimeout } from './utils/constants'
|
import { startSpaces, optionSpaces, forceExitTimeout } from './utils/constants'
|
||||||
import { Nuxt } from 'src/core'
|
import { Nuxt } from 'nuxt/core'
|
||||||
import { Builder } from 'src/builder'
|
import { Builder } from 'nuxt/builder'
|
||||||
import { Generator } from 'src/generator'
|
import { Generator } from 'nuxt/generator'
|
||||||
|
|
||||||
export default class NuxtCommand extends Hookable {
|
export default class NuxtCommand extends Hookable {
|
||||||
constructor (cmd = { name: '', usage: '', description: '' }, argv = process.argv.slice(2), hooks = {}) {
|
constructor (cmd = { name: '', usage: '', description: '' }, argv = process.argv.slice(2), hooks = {}) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import { MODES, TARGETS } from 'src/utils'
|
import { MODES, TARGETS } from 'nuxt/utils'
|
||||||
import { common, locking } from '../options'
|
import { common, locking } from '../options'
|
||||||
import { createLock } from '../utils'
|
import { createLock } from '../utils'
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import { TARGETS } from 'src/utils'
|
import { TARGETS } from 'nuxt/utils'
|
||||||
import { common, locking } from '../options'
|
import { common, locking } from '../options'
|
||||||
import { createLock } from '../utils'
|
import { createLock } from '../utils'
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { TARGETS } from 'src/utils'
|
import { TARGETS } from 'nuxt/utils'
|
||||||
import { common, locking } from '../options'
|
import { common, locking } from '../options'
|
||||||
import { normalizeArg, createLock } from '../utils'
|
import { normalizeArg, createLock } from '../utils'
|
||||||
|
|
||||||
|
@ -3,12 +3,12 @@ import { join, extname, basename } from 'path'
|
|||||||
import connect from 'connect'
|
import connect from 'connect'
|
||||||
import serveStatic from 'serve-static'
|
import serveStatic from 'serve-static'
|
||||||
import compression from 'compression'
|
import compression from 'compression'
|
||||||
import { getNuxtConfig } from 'src/config'
|
import { getNuxtConfig } from 'nuxt/config'
|
||||||
import { TARGETS } from 'src/utils'
|
import { TARGETS } from 'nuxt/utils'
|
||||||
import { common, server } from '../options'
|
import { common, server } from '../options'
|
||||||
import { showBanner } from '../utils/banner'
|
import { showBanner } from '../utils/banner'
|
||||||
import { Listener } from 'src/server'
|
import { Listener } from 'nuxt/server'
|
||||||
import { Nuxt } from 'src/core'
|
import { Nuxt } from 'nuxt/core'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'serve',
|
name: 'serve',
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { TARGETS } from 'src/utils'
|
import { TARGETS } from 'nuxt/utils'
|
||||||
import { common, server } from '../options'
|
import { common, server } from '../options'
|
||||||
import { showBanner } from '../utils/banner'
|
import { showBanner } from '../utils/banner'
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { defaultNuxtConfigFile } from 'src/config'
|
import { defaultNuxtConfigFile } from 'nuxt/config'
|
||||||
import { normalizeArg } from '../utils'
|
import { normalizeArg } from '../utils'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import defaultsDeep from 'lodash/defaultsDeep'
|
import defaultsDeep from 'lodash/defaultsDeep'
|
||||||
import { loadNuxtConfig as _loadNuxtConfig, getDefaultNuxtConfig } from 'src/config'
|
import { loadNuxtConfig as _loadNuxtConfig, getDefaultNuxtConfig } from 'nuxt/config'
|
||||||
import { MODES } from 'src/utils'
|
import { MODES } from 'nuxt/utils'
|
||||||
|
|
||||||
export async function loadNuxtConfig (argv, configContext) {
|
export async function loadNuxtConfig (argv, configContext) {
|
||||||
const rootDir = path.resolve(argv._[0] || '.')
|
const rootDir = path.resolve(argv._[0] || '.')
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import exit from 'exit'
|
import exit from 'exit'
|
||||||
|
|
||||||
import { lock } from 'src/utils'
|
import { lock } from 'nuxt/utils'
|
||||||
import chalk from 'chalk'
|
import chalk from 'chalk'
|
||||||
import env from 'std-env'
|
import env from 'std-env'
|
||||||
import { warningBox } from './formatting'
|
import { warningBox } from './formatting'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { loadNuxt } from 'src/core'
|
import { loadNuxt } from 'nuxt/core'
|
||||||
import { getBuilder } from 'src/builder'
|
import { getBuilder } from 'nuxt/builder'
|
||||||
|
|
||||||
export async function getWebpackConfig(name = 'client', loadOptions = {}) {
|
export async function getWebpackConfig(name = 'client', loadOptions = {}) {
|
||||||
const nuxt = await loadNuxt(loadOptions)
|
const nuxt = await loadNuxt(loadOptions)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import capitalize from 'lodash/capitalize'
|
import capitalize from 'lodash/capitalize'
|
||||||
import env from 'std-env'
|
import env from 'std-env'
|
||||||
import { TARGETS, MODES } from 'src/utils'
|
import { TARGETS, MODES } from 'nuxt/utils'
|
||||||
|
|
||||||
export default () => ({
|
export default () => ({
|
||||||
// Env
|
// Env
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { MODES } from 'src/utils'
|
import { MODES } from 'nuxt/utils'
|
||||||
|
|
||||||
export default () => ({
|
export default () => ({
|
||||||
[MODES.universal]: {
|
[MODES.universal]: {
|
||||||
|
@ -3,7 +3,7 @@ import fs from 'fs'
|
|||||||
import defu from 'defu'
|
import defu from 'defu'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import dotenv from 'dotenv'
|
import dotenv from 'dotenv'
|
||||||
import { clearRequireCache, scanRequireTree } from 'src/utils'
|
import { clearRequireCache, scanRequireTree } from 'nuxt/utils'
|
||||||
import jiti from 'jiti'
|
import jiti from 'jiti'
|
||||||
import _createRequire from 'create-require'
|
import _createRequire from 'create-require'
|
||||||
import destr from 'destr'
|
import destr from 'destr'
|
||||||
|
@ -6,7 +6,7 @@ import pick from 'lodash/pick'
|
|||||||
import uniq from 'lodash/uniq'
|
import uniq from 'lodash/uniq'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import destr from 'destr'
|
import destr from 'destr'
|
||||||
import { TARGETS, MODES, guardDir, isNonEmptyString, isPureObject, isUrl, getMainModule, urlJoin, getPKG } from 'src/utils'
|
import { TARGETS, MODES, guardDir, isNonEmptyString, isPureObject, isUrl, getMainModule, urlJoin, getPKG } from 'nuxt/utils'
|
||||||
import { defaultNuxtConfigFile, getDefaultNuxtConfig } from './config'
|
import { defaultNuxtConfigFile, getDefaultNuxtConfig } from './config'
|
||||||
|
|
||||||
export function getNuxtConfig (_options) {
|
export function getNuxtConfig (_options) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
export { default as Module } from './module'
|
export { default as Module } from './module'
|
||||||
export { default as Nuxt } from './nuxt'
|
export { default as Nuxt } from './nuxt'
|
||||||
export { default as Resolver } from './resolver'
|
export { default as Resolver } from './resolver'
|
||||||
export { loadNuxtConfig } from 'src/config'
|
export { loadNuxtConfig } from 'nuxt/config'
|
||||||
export { loadNuxt } from './load'
|
export { loadNuxt } from './load'
|
||||||
|
@ -3,7 +3,7 @@ import fs from 'fs'
|
|||||||
import hash from 'hash-sum'
|
import hash from 'hash-sum'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
|
|
||||||
import { chainFn, sequence } from 'src/utils'
|
import { chainFn, sequence } from 'nuxt/utils'
|
||||||
|
|
||||||
export default class ModuleContainer {
|
export default class ModuleContainer {
|
||||||
constructor (nuxt) {
|
constructor (nuxt) {
|
||||||
|
@ -3,9 +3,9 @@ import isPlainObject from 'lodash/isPlainObject'
|
|||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import Hookable from 'hable'
|
import Hookable from 'hable'
|
||||||
|
|
||||||
import { defineAlias } from 'src/utils'
|
import { defineAlias } from 'nuxt/utils'
|
||||||
import { getNuxtConfig } from 'src/config'
|
import { getNuxtConfig } from 'nuxt/config'
|
||||||
import { Server } from 'src/server'
|
import { Server } from 'nuxt/server'
|
||||||
|
|
||||||
import { version } from '../../package.json'
|
import { version } from '../../package.json'
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import {
|
|||||||
startsWithSrcAlias,
|
startsWithSrcAlias,
|
||||||
isExternalDependency,
|
isExternalDependency,
|
||||||
clearRequireCache
|
clearRequireCache
|
||||||
} from 'src/utils'
|
} from 'nuxt/utils'
|
||||||
|
|
||||||
export default class Resolver {
|
export default class Resolver {
|
||||||
constructor (nuxt) {
|
constructor (nuxt) {
|
||||||
|
@ -6,7 +6,7 @@ import defu from 'defu'
|
|||||||
import htmlMinifier from 'html-minifier'
|
import htmlMinifier from 'html-minifier'
|
||||||
import { parse } from 'node-html-parser'
|
import { parse } from 'node-html-parser'
|
||||||
|
|
||||||
import { isFullStatic, flatRoutes, isString, isUrl, promisifyRoute, waitFor, TARGETS } from 'src/utils'
|
import { isFullStatic, flatRoutes, isString, isUrl, promisifyRoute, waitFor, TARGETS } from 'nuxt/utils'
|
||||||
|
|
||||||
export default class Generator {
|
export default class Generator {
|
||||||
constructor (nuxt, builder) {
|
constructor (nuxt, builder) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import { timeout } from 'src/utils'
|
import { timeout } from 'nuxt/utils'
|
||||||
|
|
||||||
export default async function renderAndGetWindow (
|
export default async function renderAndGetWindow (
|
||||||
url = 'http://localhost:3000',
|
url = 'http://localhost:3000',
|
||||||
|
@ -2,7 +2,7 @@ import generateETag from 'etag'
|
|||||||
import fresh from 'fresh'
|
import fresh from 'fresh'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
|
|
||||||
import { getContext, TARGETS } from 'src/utils'
|
import { getContext, TARGETS } from 'nuxt/utils'
|
||||||
|
|
||||||
export default ({ options, nuxt, renderRoute, resources }) => async function nuxtMiddleware (req, res, next) {
|
export default ({ options, nuxt, renderRoute, resources }) => async function nuxtMiddleware (req, res, next) {
|
||||||
// Get context
|
// Get context
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import onHeaders from 'on-headers'
|
import onHeaders from 'on-headers'
|
||||||
import { Timer } from 'src/utils'
|
import { Timer } from 'nuxt/utils'
|
||||||
|
|
||||||
export default options => (req, res, next) => {
|
export default options => (req, res, next) => {
|
||||||
if (res.timing) {
|
if (res.timing) {
|
||||||
|
@ -4,8 +4,8 @@ import launchMiddleware from 'launch-editor-middleware'
|
|||||||
import serveStatic from 'serve-static'
|
import serveStatic from 'serve-static'
|
||||||
import servePlaceholder from 'serve-placeholder'
|
import servePlaceholder from 'serve-placeholder'
|
||||||
import connect from 'connect'
|
import connect from 'connect'
|
||||||
import { determineGlobals, isUrl } from 'src/utils'
|
import { determineGlobals, isUrl } from 'nuxt/utils'
|
||||||
import { VueRenderer } from 'src/vue-renderer'
|
import { VueRenderer } from 'nuxt/vue-renderer'
|
||||||
|
|
||||||
import ServerContext from './context'
|
import ServerContext from './context'
|
||||||
import renderAndGetWindow from './jsdom'
|
import renderAndGetWindow from './jsdom'
|
||||||
|
@ -2,7 +2,7 @@ import path from 'path'
|
|||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import template from 'lodash/template'
|
import template from 'lodash/template'
|
||||||
import { TARGETS, isModernRequest, waitFor } from 'src/utils'
|
import { TARGETS, isModernRequest, waitFor } from 'nuxt/utils'
|
||||||
|
|
||||||
import SPARenderer from './renderers/spa'
|
import SPARenderer from './renderers/spa'
|
||||||
import SSRRenderer from './renderers/ssr'
|
import SSRRenderer from './renderers/ssr'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { isUrl, urlJoin, safariNoModuleFix } from 'src/utils'
|
import { isUrl, urlJoin, safariNoModuleFix } from 'nuxt/utils'
|
||||||
import SSRRenderer from './ssr'
|
import SSRRenderer from './ssr'
|
||||||
|
|
||||||
export default class ModernRenderer extends SSRRenderer {
|
export default class ModernRenderer extends SSRRenderer {
|
||||||
|
@ -3,7 +3,7 @@ import cloneDeep from 'lodash/cloneDeep'
|
|||||||
import VueMeta from 'vue-meta'
|
import VueMeta from 'vue-meta'
|
||||||
import LRU from 'lru-cache'
|
import LRU from 'lru-cache'
|
||||||
import devalue from '@nuxt/devalue'
|
import devalue from '@nuxt/devalue'
|
||||||
import { TARGETS, isModernRequest } from 'src/utils'
|
import { TARGETS, isModernRequest } from 'nuxt/utils'
|
||||||
import BaseRenderer from './base'
|
import BaseRenderer from './base'
|
||||||
|
|
||||||
export default class SPARenderer extends BaseRenderer {
|
export default class SPARenderer extends BaseRenderer {
|
||||||
|
@ -3,7 +3,7 @@ import crypto from 'crypto'
|
|||||||
import { format } from 'util'
|
import { format } from 'util'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import { TARGETS, urlJoin } from 'src/utils'
|
import { TARGETS, urlJoin } from 'nuxt/utils'
|
||||||
import devalue from '@nuxt/devalue'
|
import devalue from '@nuxt/devalue'
|
||||||
import { createBundleRenderer } from 'vue-bundle-renderer'
|
import { createBundleRenderer } from 'vue-bundle-renderer'
|
||||||
import BaseRenderer from './base'
|
import BaseRenderer from './base'
|
||||||
|
@ -6,7 +6,7 @@ import webpackDevMiddleware from 'webpack-dev-middleware'
|
|||||||
import webpackHotMiddleware from 'webpack-hot-middleware'
|
import webpackHotMiddleware from 'webpack-hot-middleware'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
|
|
||||||
import { TARGETS, parallel, sequence, wrapArray, isModernRequest } from 'src/utils'
|
import { TARGETS, parallel, sequence, wrapArray, isModernRequest } from 'nuxt/utils'
|
||||||
import { createMFS } from './utils/mfs'
|
import { createMFS } from './utils/mfs'
|
||||||
|
|
||||||
import * as WebpackConfigs from './config'
|
import * as WebpackConfigs from './config'
|
||||||
|
@ -9,7 +9,7 @@ import TerserWebpackPlugin from 'terser-webpack-plugin'
|
|||||||
import WebpackBar from 'webpackbar'
|
import WebpackBar from 'webpackbar'
|
||||||
import env from 'std-env'
|
import env from 'std-env'
|
||||||
import semver from 'semver'
|
import semver from 'semver'
|
||||||
import { TARGETS, isUrl, urlJoin, getPKG } from 'src/utils'
|
import { TARGETS, isUrl, urlJoin, getPKG } from 'nuxt/utils'
|
||||||
import PerfLoader from '../utils/perf-loader'
|
import PerfLoader from '../utils/perf-loader'
|
||||||
import StyleLoader from '../utils/style-loader'
|
import StyleLoader from '../utils/style-loader'
|
||||||
import WarningIgnorePlugin from '../plugins/warning-ignore'
|
import WarningIgnorePlugin from '../plugins/warning-ignore'
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import EventEmitter from 'events'
|
import EventEmitter from 'events'
|
||||||
import HtmlWebpackPlugin from 'html-webpack-plugin'
|
import HtmlWebpackPlugin from 'html-webpack-plugin'
|
||||||
import { safariNoModuleFix } from 'src/utils'
|
import { safariNoModuleFix } from 'nuxt/utils'
|
||||||
|
|
||||||
const assetsMap = {}
|
const assetsMap = {}
|
||||||
const watcher = new EventEmitter()
|
const watcher = new EventEmitter()
|
||||||
|
@ -6,7 +6,7 @@ import merge from 'lodash/merge'
|
|||||||
import cloneDeep from 'lodash/cloneDeep'
|
import cloneDeep from 'lodash/cloneDeep'
|
||||||
import createResolver from 'postcss-import-resolver'
|
import createResolver from 'postcss-import-resolver'
|
||||||
|
|
||||||
import { isPureObject } from 'src/utils'
|
import { isPureObject } from 'nuxt/utils'
|
||||||
|
|
||||||
export const orderPresets = {
|
export const orderPresets = {
|
||||||
cssnanoLast (names) {
|
cssnanoLast (names) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import path from 'path'
|
import path from 'path'
|
||||||
import ExtractCssChunksPlugin from 'extract-css-chunks-webpack-plugin'
|
import ExtractCssChunksPlugin from 'extract-css-chunks-webpack-plugin'
|
||||||
|
|
||||||
import { wrapArray } from 'src/utils'
|
import { wrapArray } from 'nuxt/utils'
|
||||||
|
|
||||||
import PostcssConfig from './postcss'
|
import PostcssConfig from './postcss'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user