refactor: move utils to kit

to be rewritten
This commit is contained in:
Pooya Parsa 2021-03-28 23:06:51 +02:00
parent 50e9a04ad4
commit 547b8ec2a7
17 changed files with 14 additions and 9 deletions

View File

@ -15,10 +15,12 @@
"prepublishOnly": "yarn build && yarn genconfig"
},
"dependencies": {
"consola": "^2.15.3",
"create-require": "^1.1.1",
"defu": "^3.2.2",
"dotenv": "^8.2.0",
"jiti": "^1.6.4",
"lodash": "^4.17.21",
"rc9": "^1.2.0",
"scule": "^0.1.1",
"std-env": "^2.3.0",
@ -27,7 +29,9 @@
},
"build": {
"entries": {
"index": { "format": "cjs" }
"index": {
"format": "cjs"
}
}
}
}

View File

@ -1,2 +1,3 @@
export * from './config/load'
export * from './config/env'
export * from './utils'

View File

@ -1,8 +1,8 @@
import { join, relative } from 'path'
import fsExtra from 'fs-extra'
import { debounce } from 'lodash'
import { DeterminedGlobals, determineGlobals } from '@nuxt/kit'
import { Nuxt } from '../core'
import { DeterminedGlobals, determineGlobals } from '../utils'
import {
templateData,
compileTemplates,

View File

@ -5,7 +5,7 @@ import consola from 'consola'
import { DefinePlugin, Configuration } from 'webpack'
import FriendlyErrorsWebpackPlugin from '@nuxt/friendly-errors-webpack-plugin'
import escapeRegExp from 'lodash/escapeRegExp'
import { isUrl, urlJoin, TARGETS } from '../../../utils'
import { isUrl, urlJoin, TARGETS } from '@nuxt/kit'
import WarningIgnorePlugin from '../plugins/warning-ignore'
import { WebpackConfigContext, applyPresets, fileName } from '../utils/config'

View File

@ -1,7 +1,7 @@
import path from 'path'
import MiniCssExtractPlugin from 'mini-css-extract-plugin'
import CssMinimizerPlugin from 'css-minimizer-webpack-plugin'
import { wrapArray } from '../../../utils'
import { wrapArray } from '@nuxt/kit'
import { fileName, WebpackConfigContext, applyPresets } from '../utils/config'
export function style (ctx: WebpackConfigContext) {

View File

@ -6,9 +6,9 @@ import merge from 'lodash/merge'
import cloneDeep from 'lodash/cloneDeep'
import createResolver from 'postcss-import-resolver'
import { isPureObject } from '@nuxt/kit'
import type { Nuxt } from '../../../core'
import type { NormalizedConfiguration } from '../../../config'
import { isPureObject } from '../../../utils'
export const orderPresets = {
cssnanoLast (names) {

View File

@ -10,8 +10,8 @@ import type { Compiler, Watching } from 'webpack'
import type { Context as WebpackDevMiddlewareContext, Options as WebpackDevMiddlewareOptions } from 'webpack-dev-middleware'
import type { MiddlewareOptions as WebpackHotMiddlewareOptions } from 'webpack-hot-middleware'
import { TARGETS, parallel, sequence, wrapArray } from '@nuxt/kit'
import { Nuxt } from '../../core'
import { TARGETS, parallel, sequence, wrapArray } from '../../utils'
import { createMFS } from './utils/mfs'
import { client, server } from './configs'
import { createWebpackConfigContext, applyPresets, getWebpackConfig } from './utils/config'

View File

@ -3,7 +3,7 @@ import fs from 'fs'
import hash from 'hash-sum'
import consola from 'consola'
import { chainFn, sequence } from '../utils'
import { chainFn, sequence } from '@nuxt/kit'
import Nuxt from './nuxt'

View File

@ -2,13 +2,13 @@ import { resolve, join } from 'path'
import fs from 'fs-extra'
import jiti from 'jiti'
import { Nuxt } from '../core'
import {
startsWithRootAlias,
startsWithSrcAlias,
isExternalDependency,
clearRequireCache
} from '../utils'
} from '@nuxt/kit'
import { Nuxt } from '../core'
interface ResolvePathOptions {
isAlias?: boolean