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