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

View File

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

View File

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

View File

@ -5,7 +5,7 @@ import consola from 'consola'
import { DefinePlugin, Configuration } from 'webpack' import { DefinePlugin, Configuration } from 'webpack'
import FriendlyErrorsWebpackPlugin from '@nuxt/friendly-errors-webpack-plugin' import FriendlyErrorsWebpackPlugin from '@nuxt/friendly-errors-webpack-plugin'
import escapeRegExp from 'lodash/escapeRegExp' 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 WarningIgnorePlugin from '../plugins/warning-ignore'
import { WebpackConfigContext, applyPresets, fileName } from '../utils/config' import { WebpackConfigContext, applyPresets, fileName } from '../utils/config'

View File

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

View File

@ -6,9 +6,9 @@ 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 '@nuxt/kit'
import type { Nuxt } from '../../../core' import type { Nuxt } from '../../../core'
import type { NormalizedConfiguration } from '../../../config' import type { NormalizedConfiguration } from '../../../config'
import { isPureObject } from '../../../utils'
export const orderPresets = { export const orderPresets = {
cssnanoLast (names) { 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 { Context as WebpackDevMiddlewareContext, Options as WebpackDevMiddlewareOptions } from 'webpack-dev-middleware'
import type { MiddlewareOptions as WebpackHotMiddlewareOptions } from 'webpack-hot-middleware' import type { MiddlewareOptions as WebpackHotMiddlewareOptions } from 'webpack-hot-middleware'
import { TARGETS, parallel, sequence, wrapArray } from '@nuxt/kit'
import { Nuxt } from '../../core' import { Nuxt } from '../../core'
import { TARGETS, parallel, sequence, wrapArray } from '../../utils'
import { createMFS } from './utils/mfs' import { createMFS } from './utils/mfs'
import { client, server } from './configs' import { client, server } from './configs'
import { createWebpackConfigContext, applyPresets, getWebpackConfig } from './utils/config' import { createWebpackConfigContext, applyPresets, getWebpackConfig } from './utils/config'

View File

@ -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 '../utils' import { chainFn, sequence } from '@nuxt/kit'
import Nuxt from './nuxt' import Nuxt from './nuxt'

View File

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