提交 be36ec18 编写于 作者: fxy060608's avatar fxy060608

chore: rename plugins

上级 114fc97f
......@@ -2,7 +2,7 @@ import { Plugin } from 'vite'
import { createRollupOptions } from './rollup'
export function uniNVuePlugin(pagePath: string): Plugin {
return {
name: 'vite:uni-app-nvue',
name: 'uni:app-nvue',
config() {
return {
build: {
......
......@@ -24,7 +24,7 @@ function parseUniNvuePagePath(uniNVuePageUrl: string) {
export function uniNVueEntryPlugin(): Plugin {
const inputDir = process.env.UNI_INPUT_DIR
return {
name: 'vite:uni-app-nvue-entry',
name: 'uni:app-nvue-entry',
enforce: 'pre',
resolveId(id) {
if (isUniNVuePageUrl(id)) {
......
......@@ -14,7 +14,7 @@ export function uniConfusionPlugin(): Plugin {
const hasConfusion =
process.env.NODE_ENV === 'production' && hasConfusionFile(inputDir)
return {
name: 'vite:uni-app-confusion',
name: 'uni:app-confusion',
enforce: 'post',
apply: 'build',
config() {
......
......@@ -18,7 +18,7 @@ interface UniEasycomPluginOptions {
export function uniEasycomPlugin(options: UniEasycomPluginOptions): Plugin {
const filter = createFilter(options.include, options.exclude)
return {
name: 'vite:uni-app-easycom',
name: 'uni:app-easycom',
transform(code, id) {
if (!filter(id)) {
return
......
......@@ -3,7 +3,7 @@ import { defineUniMainJsPlugin } from '@dcloudio/uni-cli-shared'
export function uniMainJsPlugin() {
return defineUniMainJsPlugin((opts) => {
return {
name: 'vite:uni-app-main-js',
name: 'uni:app-main-js',
enforce: 'pre',
transform(code, id) {
if (opts.filter(id)) {
......
......@@ -13,7 +13,7 @@ export function uniManifestJsonPlugin(): Plugin {
return defineUniManifestJsonPlugin((opts) => {
const inputDir = process.env.UNI_INPUT_DIR
return {
name: 'vite:uni-app-manifest-json',
name: 'uni:app-manifest-json',
enforce: 'pre',
transform(code, id) {
if (!opts.filter(id)) {
......
......@@ -14,7 +14,7 @@ import { initWebpackNVueEntry } from '@dcloudio/uni-cli-nvue'
export function uniPagesJsonPlugin(): Plugin {
return defineUniPagesJsonPlugin((opts) => {
return {
name: 'vite:uni-app-pages-json',
name: 'uni:app-pages-json',
enforce: 'pre',
transform(code, id) {
if (!opts.filter(id)) {
......
......@@ -13,7 +13,7 @@ import {
transformWithEsbuild,
} from '@dcloudio/uni-cli-shared'
const debugRenderjs = debug('vite:uni:renderjs')
const debugRenderjs = debug('uni:app-renderjs')
export const APP_WXS_JS = 'app-wxs.js'
export const APP_RENDERJS_JS = 'app-renderjs.js'
......@@ -24,7 +24,7 @@ export function uniRenderjsPlugin(): Plugin {
let resolvedConfig: ResolvedConfig
let changed: boolean = false
return {
name: 'vite:uni-app-renderjs',
name: 'uni:app-renderjs',
configResolved(config) {
resolvedConfig = config
wxsModulesCache.set(resolvedConfig, new Map<string, string>())
......
......@@ -3,12 +3,12 @@ import { Plugin } from 'vite'
import { resolveBuiltIn } from '@dcloudio/uni-cli-shared'
const debugResolve = debug('vite:uni:resolve')
const debugResolve = debug('uni:app-resolve-id')
export function uniResolveIdPlugin(): Plugin {
const resolveCache: Record<string, string> = {}
return {
name: 'vite:uni-app-resolve-id',
name: 'uni:app-resolve-id',
enforce: 'pre',
configResolved() {
resolveCache['@dcloudio/uni-app-vue'] = resolveBuiltIn(
......
......@@ -6,7 +6,7 @@ const emittedHashMap = new WeakMap<ResolvedConfig, Map<string, string>>()
export function uniStatsPlugin(): Plugin {
let resolvedConfig: ResolvedConfig
return {
name: 'vite:uni-app-stats',
name: 'uni:app-stats',
enforce: 'post',
configResolved(config) {
resolvedConfig = config
......
......@@ -45,7 +45,7 @@ function genViewHtml(bundle: OutputBundle) {
export function uniTemplatePlugin(): Plugin {
let outputDir: string
return {
name: 'vite:uni-app-template',
name: 'uni:app-template',
enforce: 'post',
configResolved() {
outputDir = process.env.UNI_OUTPUT_DIR
......
......@@ -9,7 +9,7 @@ const uni_cli_shared_1 = require("@dcloudio/uni-cli-shared");
exports.default = [
(0, uni_cli_shared_1.defineUniMainJsPlugin)((opts) => {
return {
name: 'vite:uni-automator',
name: 'uni:automator',
enforce: 'pre',
configResolved() {
if (!process.env.UNI_AUTOMATOR_WS_ENDPOINT) {
......
......@@ -5,7 +5,7 @@ import { defineUniMainJsPlugin } from '@dcloudio/uni-cli-shared'
export default [
defineUniMainJsPlugin((opts) => {
return {
name: 'vite:uni-automator',
name: 'uni:automator',
enforce: 'pre',
configResolved() {
if (!process.env.UNI_AUTOMATOR_WS_ENDPOINT) {
......
......@@ -9,7 +9,7 @@ const UniAppNVuePlugin = (): UniVitePlugin => {
let lastNVueEntry: string
let isPagesJsonChanged: boolean = false
return {
name: 'vite:uni-cli-nvue',
name: 'uni:cli-nvue',
enforce: 'post',
config() {
if (process.env.UNI_NVUE_COMPILER === 'vue') {
......
......@@ -10,7 +10,7 @@ import { hasOwn, isString, isPlainObject } from '@vue/shared'
import { parseManifestJsonOnce } from './json'
import { isInHBuilderX } from './hbx'
const debugCheckUpdate = debug('vite:uni:check-update')
const debugCheckUpdate = debug('uni:check-update')
interface CheckUpdateOptions {
inputDir: string
......
......@@ -24,7 +24,7 @@ interface EasycomCustom {
[key: string]: string
}
const debugEasycom = debug('vite:uni:easycom')
const debugEasycom = debug('uni:easycom')
const easycoms: EasycomMatcher[] = []
......
......@@ -12,13 +12,13 @@ export interface ConsoleOptions {
exclude?: FilterPattern
}
const debugConsole = debug('vite:uni:console')
const debugConsole = debug('uni:console')
export function uniConsolePlugin(options: ConsoleOptions): Plugin {
const filter = createFilter(options.include, options.exclude)
let resolvedConfig: ResolvedConfig
return {
name: 'vite:uni-console',
name: 'uni:console',
enforce: 'pre',
configResolved(config) {
resolvedConfig = config
......
......@@ -17,7 +17,7 @@ export function uniViteCopyPlugin({
let resolvedConfig: ResolvedConfig
let inited = false
return {
name: 'vite:uni-copy',
name: 'uni:copy',
apply: 'build',
configResolved(config) {
resolvedConfig = config
......
......@@ -4,7 +4,7 @@ import type { Plugin } from 'vite'
import { EXTNAME_VUE } from '../../constants'
import { preHtml, preJs } from '../../preprocess'
const debugScoped = debug('vite:uni:scoped')
const debugScoped = debug('uni:scoped')
const SCOPED_RE = /<style\s[^>]*scoped[^>]*>/i
......@@ -23,7 +23,7 @@ export function uniCssScopedPlugin(
{ filter }: UniCssScopedPluginOptions = { filter: () => false }
): Plugin {
return {
name: 'vite:uni-css-scoped',
name: 'uni:css-scoped',
enforce: 'pre',
transform(code, id) {
if (!filter(id)) return null
......
......@@ -39,8 +39,8 @@ export interface InjectOptions {
[str: string]: Injectment | FilterPattern | Boolean | Function | undefined
}
const debugInject = debug('vite:uni:inject')
const debugInjectTry = debug('vite:uni:inject-try')
const debugInject = debug('uni:inject')
const debugInjectTry = debug('uni:inject-try')
export function uniViteInjectPlugin(options: InjectOptions): Plugin {
if (!options) throw new Error('Missing options')
......@@ -76,7 +76,7 @@ export function uniViteInjectPlugin(options: InjectOptions): Plugin {
const sourceMap = options.sourceMap !== false
const callback = options.callback
return {
name: 'vite:uni-inject',
name: 'uni:inject',
// 确保在 commonjs 之后,否则会混合 es6 module 与 cjs 的代码,导致 commonjs 失效
enforce: 'post',
transform(code, id) {
......
......@@ -10,7 +10,7 @@ initUniCloudEnv();
* @type {import('vite').Plugin}
*/
const UniCloudPlugin = {
name: 'vite:uni-cloud',
name: 'uni:cloud',
config(config) {
const silent = config.build && config.build.ssr ? true : false;
if (silent) {
......
......@@ -6,7 +6,7 @@ function replaceModuleExports(code) {
}
function uniValidateFunctionPlugin() {
return {
name: 'vite:uni-cloud-vf',
name: 'uni:cloud-vf',
enforce: 'pre',
transform(code, id) {
if (id.includes('validator/validateFunction')) {
......
......@@ -23,7 +23,7 @@ initUniCloudEnv()
* @type {import('vite').Plugin}
*/
const UniCloudPlugin: UniVitePlugin = {
name: 'vite:uni-cloud',
name: 'uni:cloud',
config(config) {
const silent = config.build && config.build.ssr ? true : false
if (silent) {
......
......@@ -4,7 +4,7 @@ function replaceModuleExports(code: string) {
}
export function uniValidateFunctionPlugin(): Plugin {
return {
name: 'vite:uni-cloud-vf',
name: 'uni:cloud-vf',
enforce: 'pre',
transform(code, id) {
if (id.includes('validator/validateFunction')) {
......
......@@ -11,7 +11,7 @@ import {
import { uniStaticMiddleware } from './middlewares/static'
const debugStatic = debug('vite:uni:static')
const debugStatic = debug('uni:static')
/**
* devServer时提供static等目录的静态资源服务
* @param server
......
......@@ -7,7 +7,7 @@ export const JS_TYPES_RE = /\.(?:j|t)sx?$|\.mjs$/
export function esbuildPrePlugin(): Plugin {
return {
name: 'vite:dep-scan',
name: 'uni:dep-scan',
setup(build) {
build.onLoad({ filter: JS_TYPES_RE }, ({ path: id }) => {
let ext = path.extname(id).slice(1)
......
......@@ -11,7 +11,7 @@ import {
resolveComponentsLibPath,
} from '@dcloudio/uni-cli-shared'
const debugHmr = debug('vite:uni:hmr')
const debugHmr = debug('uni:hmr')
async function invalidate(file: string, moduleGraph: ModuleGraph) {
const mods = await moduleGraph.getModulesByFile(normalizePath(file))
......
......@@ -18,7 +18,7 @@ export function uniH5Plugin(): UniVitePlugin {
}
rewriteReadFileSync()
return {
name: 'vite:uni-h5',
name: 'uni:h5',
uni: createUni(),
config: createConfig(configOptions),
configResolved(config) {
......
......@@ -21,7 +21,7 @@ export function uniCssPlugin(): Plugin {
let file = ''
let fileName = ''
return {
name: 'vite:uni-h5-css',
name: 'uni:h5-css',
apply: 'build',
enforce: 'pre',
configResolved(config) {
......
......@@ -60,7 +60,7 @@ export function uniEasycomPlugin(options: UniEasycomPluginOptions): Plugin {
const filter = createFilter(options.include, options.exclude)
let needCombineBuiltInCss = false
return {
name: 'vite:uni-h5-easycom',
name: 'uni:h5-easycom',
configResolved(config) {
needCombineBuiltInCss = isCombineBuiltInCss(config)
},
......
......@@ -54,7 +54,7 @@ export function uniInjectPlugin(): Plugin {
let injectPlugin: Plugin
return {
name: 'vite:uni-h5-inject',
name: 'uni:h5-inject',
apply: 'build',
enforce: 'post',
configResolved(config) {
......
......@@ -7,7 +7,7 @@ export function uniMainJsPlugin() {
let pagesJsonJsPath = ''
let runSSR = false
return {
name: 'vite:uni-h5-main-js',
name: 'uni:h5-main-js',
enforce: 'pre',
configResolved(config) {
pagesJsonJsPath = normalizePath(
......
......@@ -23,7 +23,7 @@ const defaultAsync = {
export function uniManifestJsonPlugin(): Plugin {
return defineUniManifestJsonPlugin((opts) => {
return {
name: 'vite:uni-h5-manifest-json',
name: 'uni:h5-manifest-json',
enforce: 'pre',
transform(code, id) {
if (!opts.filter(id)) {
......
......@@ -19,7 +19,7 @@ import { isSSR } from '../utils'
export function uniPagesJsonPlugin(): Plugin {
return defineUniPagesJsonPlugin((opts) => {
return {
name: 'vite:uni-h5-pages-json',
name: 'uni:h5-pages-json',
enforce: 'pre',
transform(code, id, opt) {
if (opts.filter(id)) {
......
......@@ -4,11 +4,11 @@ import { rewriteDefault } from '@vue/compiler-sfc'
import { missingModuleName, parseRenderjs } from '@dcloudio/uni-cli-shared'
const debugRenderjs = debug('vite:uni:renderjs')
const debugRenderjs = debug('uni:h5-renderjs')
export function uniRenderjsPlugin(): Plugin {
return {
name: 'vite:uni-h5-renderjs',
name: 'uni:h5-renderjs',
transform(code, id) {
const { type, name } = parseRenderjs(id)
if (!type) {
......
......@@ -5,12 +5,12 @@ import type { Plugin } from 'vite'
import { resolveBuiltIn } from '@dcloudio/uni-cli-shared'
import { ownerModuleName } from '../utils'
const debugResolve = debug('vite:uni:resolve')
const debugResolve = debug('uni:resolve')
export function uniResolveIdPlugin(): Plugin {
const resolveCache: Record<string, string> = {}
return {
name: 'vite:uni-h5-resolve-id',
name: 'uni:h5-resolve-id',
enforce: 'pre',
config() {
resolveCache[ownerModuleName] = resolveBuiltIn(
......
......@@ -7,13 +7,13 @@ import {
withSourcemap,
} from '@dcloudio/uni-cli-shared'
const debugSetup = debug('vite:uni:setup')
const debugSetup = debug('uni:setup')
export function uniSetupPlugin(): Plugin {
let appVuePath: string
let resolvedConfig: ResolvedConfig
return {
name: 'vite:uni-setup',
name: 'uni:setup',
configResolved(config) {
resolvedConfig = config
appVuePath = normalizePath(
......
......@@ -23,7 +23,7 @@ export function uniSSRPlugin(): Plugin {
let resolvedConfig: ResolvedConfig
const entryServerJsCode = generateSsrEntryServerCode()
return {
name: 'vite:uni-h5-ssr',
name: 'uni:h5-ssr',
config(userConfig, env) {
if (isSsr(env.command, userConfig)) {
rewriteSsrVue()
......
......@@ -234,7 +234,7 @@ const options = {
};
const uniMiniProgramAlipayPlugin = {
name: 'vite:uni-mp-alipay',
name: 'uni:mp-alipay',
config() {
return {
define: {
......
......@@ -4,7 +4,7 @@ import initMiniProgramPlugin from '@dcloudio/uni-mp-vite'
import { options } from './options'
const uniMiniProgramAlipayPlugin: Plugin = {
name: 'vite:uni-mp-alipay',
name: 'uni:mp-alipay',
config() {
return {
define: {
......
......@@ -130,7 +130,7 @@ const options = {
};
const uniMiniProgramBaiduPlugin = {
name: 'vite:uni-mp-baidu',
name: 'uni:mp-baidu',
config() {
return {
define: {
......
......@@ -2,7 +2,7 @@ import type { Plugin } from 'vite'
import initMiniProgramPlugin from '@dcloudio/uni-mp-vite'
import { options } from './options'
const uniMiniProgramBaiduPlugin: Plugin = {
name: 'vite:uni-mp-baidu',
name: 'uni:mp-baidu',
config() {
return {
define: {
......
......@@ -184,7 +184,7 @@ const options = {
};
const uniMiniProgramKuaishouPlugin = {
name: 'vite:uni-mp-kuaishou',
name: 'uni:mp-kuaishou',
config() {
return {
define: {
......
......@@ -4,7 +4,7 @@ import initMiniProgramPlugin from '@dcloudio/uni-mp-vite'
import { options } from './options'
const uniMiniProgramKuaishouPlugin: Plugin = {
name: 'vite:uni-mp-kuaishou',
name: 'uni:mp-kuaishou',
config() {
return {
define: {
......
......@@ -127,7 +127,7 @@ ${filter.code}
};
const uniMiniProgramToutiaoPlugin = {
name: 'vite:uni-mp-lark',
name: 'uni:mp-lark',
config() {
return {
define: {
......
......@@ -5,7 +5,7 @@ import { ASSETS_INLINE_LIMIT } from '@dcloudio/uni-cli-shared'
import { options } from '@dcloudio/uni-mp-toutiao/src/compiler/options'
const uniMiniProgramToutiaoPlugin: Plugin = {
name: 'vite:uni-mp-lark',
name: 'uni:mp-lark',
config() {
return {
define: {
......
......@@ -157,7 +157,7 @@ const options = {
};
const uniMiniProgramQQPlugin = {
name: 'vite:uni-mp-qq',
name: 'uni:mp-qq',
config() {
return {
define: {
......
......@@ -6,7 +6,7 @@ import { fix2648 } from './fix2648'
import { options } from './options'
const uniMiniProgramQQPlugin: Plugin = {
name: 'vite:uni-mp-qq',
name: 'uni:mp-qq',
config() {
return {
define: {
......
......@@ -127,7 +127,7 @@ ${filter.code}
};
const uniMiniProgramToutiaoPlugin = {
name: 'vite:uni-mp-toutiao',
name: 'uni:mp-toutiao',
config() {
return {
define: {
......
......@@ -5,7 +5,7 @@ import initMiniProgramPlugin from '@dcloudio/uni-mp-vite'
import { options } from './options'
const uniMiniProgramToutiaoPlugin: Plugin = {
name: 'vite:uni-mp-toutiao',
name: 'uni:mp-toutiao',
config() {
return {
define: {
......
......@@ -23,7 +23,7 @@ import {
parseVirtualPagePath,
} from '../plugins/entry'
const debugChunk = debug('vite:uni:chunk')
const debugChunk = debug('uni:chunk')
export function buildOptions(): UserConfig['build'] {
const platform = process.env.UNI_PLATFORM
......
......@@ -21,7 +21,7 @@ import {
parseVirtualPagePath,
} from '../plugins/entry'
const debugNVueCss = debug('vite:uni:nvue-css')
const debugNVueCss = debug('uni:nvue-css')
const cssVars = `page{--status-bar-height:25px;--top-window-height:0px;--window-top:0px;--window-bottom:0px;--window-left:0px;--window-right:0px;--window-magin:0px}`
const genShadowCss = (cdn: string) => {
......@@ -114,7 +114,7 @@ export function createConfigResolved({
function adjustCssExtname(extname: string): Plugin {
return {
name: 'vite:uni-adjust-css-extname',
name: 'uni:adjust-css-extname',
generateBundle(_, bundle) {
const files = Object.keys(bundle)
files.forEach((name) => {
......
......@@ -98,7 +98,7 @@ export function uniMiniProgramPlugin(
rewriteCompileScript()
return {
name: 'vite:uni-mp',
name: 'uni:mp',
uni: uniOptions({
copyOptions,
customElements: template.customElements,
......
......@@ -14,7 +14,7 @@ import {
import { getFiltersCache } from '../plugins/renderjs'
import { UniMiniProgramPluginOptions } from '.'
const debugTemplate = debug('vite:uni:mp-template')
const debugTemplate = debug('uni:mp-template')
export function getFilterFiles(
resolvedConfig: ResolvedConfig,
......
......@@ -42,7 +42,7 @@ export function uniEntryPlugin({
}: UniMiniProgramPluginOptions): Plugin {
const inputDir = process.env.UNI_INPUT_DIR
return {
name: 'vite:uni-virtual',
name: 'uni:virtual',
enforce: 'pre',
resolveId(id) {
if (isUniPageUrl(id) || isUniComponentUrl(id)) {
......
......@@ -13,7 +13,7 @@ export function uniMainJsPlugin(
) {
return defineUniMainJsPlugin((opts) => {
return {
name: 'vite:uni-mp-main-js',
name: 'uni:mp-main-js',
enforce: 'pre',
async transform(source, id) {
if (opts.filter(id)) {
......
......@@ -15,7 +15,7 @@ export function uniManifestJsonPlugin(
let projectJson: Record<string, any>
return defineUniManifestJsonPlugin((opts) => {
return {
name: 'vite:uni-mp-manifest-json',
name: 'uni:mp-manifest-json',
enforce: 'pre',
transform(code, id) {
if (!opts.filter(id)) {
......
......@@ -17,7 +17,7 @@ import {
import { virtualPagePath } from './entry'
import { UniMiniProgramPluginOptions } from '../plugin'
const debugPagesJson = debug('vite:uni:pages-json')
const debugPagesJson = debug('uni:pages-json')
const nvueCssPathsCache = new Map<ResolvedConfig, string[]>()
export function getNVueCssPaths(config: ResolvedConfig) {
......@@ -30,7 +30,7 @@ export function uniPagesJsonPlugin(
let resolvedConfig: ResolvedConfig
return defineUniPagesJsonPlugin((opts) => {
return {
name: 'vite:uni-mp-pages-json',
name: 'uni:mp-pages-json',
enforce: 'pre',
configResolved(config) {
resolvedConfig = config
......
......@@ -27,7 +27,7 @@ export function uniMiniProgramPluginPlugin({
)
}
return {
name: 'vite:uni-mp-plugin',
name: 'uni:mp-plugin',
enforce: 'post',
config() {
return {
......
......@@ -8,7 +8,7 @@ import {
parseRenderjs,
} from '@dcloudio/uni-cli-shared'
const debugRenderjs = debug('vite:uni:renderjs')
const debugRenderjs = debug('uni:mp-renderjs')
const filtersCache = new Map<ResolvedConfig, MiniProgramFilterOptions[]>()
......@@ -19,7 +19,7 @@ export function getFiltersCache(resolvedConfig: ResolvedConfig) {
export function uniRenderjsPlugin({ lang }: { lang?: string }): Plugin {
let resolvedConfig: ResolvedConfig
return {
name: 'vite:uni-mp-renderjs',
name: 'uni:mp-renderjs',
configResolved(config) {
resolvedConfig = config
},
......
......@@ -6,7 +6,7 @@ type RuntimeHooks = keyof typeof MINI_PROGRAM_PAGE_RUNTIME_HOOKS
export function uniRuntimeHooksPlugin(): Plugin {
return {
name: 'vite:uni-mp-runtime-hooks',
name: 'uni:mp-runtime-hooks',
enforce: 'post',
async transform(source, id) {
if (!isUniPageSfcFile(id)) {
......
......@@ -7,7 +7,7 @@ export function uniSubpackagePlugin({
style: { extname },
}: UniMiniProgramPluginOptions): Plugin {
return {
name: 'vite:uni-mp-subpackage',
name: 'uni:mp-subpackage',
enforce: 'post',
generateBundle: createNonAppGenerateBundle(extname),
}
......
......@@ -28,7 +28,7 @@ export function uniUsingComponentsPlugin(
const inputDir = process.env.UNI_INPUT_DIR
let resolvedConfig: ResolvedConfig
return {
name: 'vite:uni-mp-using-component',
name: 'uni:mp-using-component',
enforce: 'post',
configResolved(config) {
resolvedConfig = config
......
......@@ -150,7 +150,7 @@ ${filter.code}
};
const uniMiniProgramWeixinPlugin = {
name: 'vite:uni-mp-weixin',
name: 'uni:mp-weixin',
config() {
return {
define: {
......
......@@ -4,7 +4,7 @@ import initMiniProgramPlugin from '@dcloudio/uni-mp-vite'
import { options } from './options'
const uniMiniProgramWeixinPlugin: Plugin = {
name: 'vite:uni-mp-weixin',
name: 'uni:mp-weixin',
config() {
return {
define: {
......
......@@ -110,7 +110,7 @@ ${filter.code}
};
const uniQuickappWebviewPlugin = {
name: 'vite:uni-quickapp-webview',
name: 'uni:quickapp-webview',
config() {
return {
define: {
......
......@@ -4,7 +4,7 @@ import initMiniProgramPlugin from '@dcloudio/uni-mp-vite'
import { options } from './options'
const uniQuickappWebviewPlugin: Plugin = {
name: 'vite:uni-quickapp-webview',
name: 'uni:quickapp-webview',
config() {
return {
define: {
......
......@@ -11,7 +11,7 @@ var index = [
uniCliShared.defineUniMainJsPlugin((opts) => {
let isEnable = false;
return {
name: 'vite:uni-stat',
name: 'uni:stat',
enforce: 'pre',
config(config, env) {
if (isSsr(env.command, config)) {
......@@ -46,7 +46,7 @@ var index = [
}
});
}
debug__default["default"]('vite:uni:stat')('isEnable', isEnable);
debug__default["default"]('uni:stat')('isEnable', isEnable);
process.env.UNI_STAT_TITLE_JSON = JSON.stringify(titlesJson);
return {
define: {
......
......@@ -12,7 +12,7 @@ export default [
defineUniMainJsPlugin((opts) => {
let isEnable = false
return {
name: 'vite:uni-stat',
name: 'uni:stat',
enforce: 'pre',
config(config, env) {
if (isSsr(env.command, config)) {
......@@ -45,7 +45,7 @@ export default [
}
})
}
debug('vite:uni:stat')('isEnable', isEnable)
debug('uni:stat')('isEnable', isEnable)
process.env.UNI_STAT_TITLE_JSON = JSON.stringify(titlesJson)
return {
define: {
......
......@@ -8,13 +8,7 @@ const filterIndex = process.argv.findIndex((arg) =>
if (debugIndex > 0) {
let value = process.argv[debugIndex + 1]
if (!value || value.startsWith('-')) {
value = 'vite:*'
} else {
// support debugging multiple flags with comma-separated list
value = value
.split(',')
.map((v) => `vite:${v}`)
.join(',')
value = 'vite:*,uni:*'
}
process.env.DEBUG = value
......
......@@ -16,7 +16,7 @@ import { uniPreVuePlugin } from './preVue'
import { uniSSRPlugin } from './ssr'
import { uniResolveIdPlugin } from './resolveId'
const debugPlugin = debug('vite:uni:plugin')
const debugPlugin = debug('uni:plugin')
export interface UniPluginFilterOptions extends VitePluginUniResolvedOptions {
include?: FilterPattern
......
......@@ -8,7 +8,7 @@ const SPECIAL_QUERY_RE = /[\?&](?:worker|sharedworker|raw|url)\b/
export function uniJsonPlugin(options: VitePluginUniResolvedOptions): Plugin {
return {
name: 'vite:uni-json',
name: 'uni:json',
transform(code, id) {
if (!jsonExtRE.test(id)) return null
if (SPECIAL_QUERY_RE.test(id)) return null
......
......@@ -12,9 +12,9 @@ import {
} from '@dcloudio/uni-cli-shared'
import { UniPluginFilterOptions } from '.'
const debugPreJs = debug('vite:uni:pre-js')
const debugPreHtml = debug('vite:uni:pre-html')
const debugPreJsTry = debug('vite:uni:pre-js-try')
const debugPreJs = debug('uni:pre-js')
const debugPreHtml = debug('uni:pre-html')
const debugPreJsTry = debug('uni:pre-js-try')
const PRE_JS_EXTNAME = ['.json', '.css'].concat(EXTNAME_VUE).concat(EXTNAME_JS)
const PRE_HTML_EXTNAME = EXTNAME_VUE
......@@ -25,7 +25,7 @@ export function uniPrePlugin(
const filter = createFilter(options.include, options.exclude)
return {
name: 'vite:uni-pre',
name: 'uni:pre',
transform(code, id) {
if (!filter(id)) {
return
......
......@@ -5,8 +5,8 @@ import { preJs, withSourcemap } from '@dcloudio/uni-cli-shared'
import { UniPluginFilterOptions } from '.'
const debugPre = debug('vite:uni:pre-css')
const debugPreTry = debug('vite:uni:pre-css-try')
const debugPre = debug('uni:pre-css')
const debugPreTry = debug('uni:pre-css-try')
const cssLangs = `\\.(css|less|sass|scss|styl|stylus|postcss)($|\\?)`
const cssLangRE = new RegExp(cssLangs)
/**
......@@ -19,7 +19,7 @@ export function uniPreCssPlugin(
): Plugin {
const filter = createFilter(options.include, options.exclude)
return {
name: 'vite:uni-pre-css',
name: 'uni:pre-css',
transform(code, id) {
if (!cssLangRE.test(id)) {
return
......
......@@ -21,7 +21,7 @@ import {
parseVue,
} from '@dcloudio/uni-cli-shared'
const debugPreVue = debug('vite:uni:pre-vue')
const debugPreVue = debug('uni:pre-vue')
const BLOCK_RE = /<\/block>/
......@@ -31,7 +31,7 @@ const WXS_ATTRS = ['wxs', 'renderjs']
export function uniPreVuePlugin(): Plugin {
return {
name: 'vite:uni-pre-vue',
name: 'uni:pre-vue',
async transform(code, id) {
const { filename, query } = parseVueRequest(id)
if (query.vue) {
......
......@@ -5,7 +5,7 @@ import { resolveBuiltIn } from '@dcloudio/uni-cli-shared'
import { VitePluginUniResolvedOptions } from '../..'
const debugResolve = debug('vite:uni:resolve')
const debugResolve = debug('uni:resolve-id')
const BUILT_IN_MODULES = {
'vue-router': 'dist/vue-router.esm-bundler.js',
......@@ -25,7 +25,7 @@ export function uniResolveIdPlugin(
): Plugin {
const resolveCache: Record<string, string> = {}
return {
name: 'vite:uni-resolve-id',
name: 'uni:resolve-id',
resolveId(id) {
const cache = resolveCache[id]
if (cache) {
......
......@@ -15,7 +15,7 @@ import {
} from '@dcloudio/uni-cli-shared'
import { UniPluginFilterOptions } from '.'
const debugSSR = debug('vite:uni:ssr')
const debugSSR = debug('uni:ssr')
const KEYED_FUNC_RE = /(ssrRef|shallowSsrRef)/
......@@ -25,7 +25,7 @@ export function uniSSRPlugin(
): Plugin {
const filter = createFilter(options.include, options.exclude)
return {
name: 'vite:uni-ssr',
name: 'uni:ssr',
transform(code, id) {
if (!filter(id)) return null
if (!KEYED_FUNC_RE.test(code)) {
......
......@@ -5,7 +5,7 @@ import { cleanUrl } from '@dcloudio/uni-cli-shared'
import { UniPluginFilterOptions } from '.'
import { createPublicFileFilter } from '../../utils'
const debugStatic = debug('vite:uni:static')
const debugStatic = debug('uni:static')
/**
* 提供static等目录静态资源加载
* @param _options
......@@ -18,7 +18,7 @@ export function uniStaticPlugin(
): Plugin {
const filter = createPublicFileFilter()
return {
name: 'vite:uni-static',
name: 'uni:static',
resolveId(id) {
if (!config.assetsInclude(cleanUrl(id))) {
return
......
......@@ -29,7 +29,7 @@ import {
} from './vue'
// import { createResolveId } from './resolveId'
const debugUni = debug('vite:uni:plugin')
const debugUni = debug('uni:plugin')
const pkg = require(path.resolve(__dirname, '../package.json'))
......@@ -114,7 +114,7 @@ export default function uniPlugin(
}
plugins.push({
name: 'vite:uni',
name: 'uni',
config: createConfig(options, uniPlugins),
// resolveId: createResolveId(options),
configResolved: createConfigResolved(options),
......
......@@ -13,7 +13,7 @@ import {
} from '@dcloudio/uni-cli-shared'
import { VitePluginUniResolvedOptions } from '..'
const debugCopy = debug('vite:uni:copy')
const debugCopy = debug('uni:copy')
export function uniCopyPlugin({
outputDir,
......
......@@ -7,7 +7,7 @@ import {
resolveComponentsLibPath,
} from '@dcloudio/uni-cli-shared'
const debugEasycom = debug('vite:uni:easycom')
const debugEasycom = debug('uni:easycom')
export const initEasycom = (watcher?: FSWatcher) => {
const { filter, refresh, options } = initEasycomsOnce(
process.env.UNI_INPUT_DIR,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册