Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-app
提交
be36ec18
U
uni-app
项目概览
DCloud
/
uni-app
3 个月 前同步成功
通知
725
Star
38705
Fork
3642
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
7
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
7
Issue
7
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
be36ec18
编写于
1月 12, 2022
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: rename plugins
上级
114fc97f
变更
81
显示空白变更内容
内联
并排
Showing
81 changed file
with
105 addition
and
111 deletion
+105
-111
packages/uni-app-vite/src/nvue/index.ts
packages/uni-app-vite/src/nvue/index.ts
+1
-1
packages/uni-app-vite/src/nvue/plugins/entry.ts
packages/uni-app-vite/src/nvue/plugins/entry.ts
+1
-1
packages/uni-app-vite/src/plugins/confusion.ts
packages/uni-app-vite/src/plugins/confusion.ts
+1
-1
packages/uni-app-vite/src/plugins/easycom.ts
packages/uni-app-vite/src/plugins/easycom.ts
+1
-1
packages/uni-app-vite/src/plugins/mainJs.ts
packages/uni-app-vite/src/plugins/mainJs.ts
+1
-1
packages/uni-app-vite/src/plugins/manifestJson.ts
packages/uni-app-vite/src/plugins/manifestJson.ts
+1
-1
packages/uni-app-vite/src/plugins/pagesJson.ts
packages/uni-app-vite/src/plugins/pagesJson.ts
+1
-1
packages/uni-app-vite/src/plugins/renderjs.ts
packages/uni-app-vite/src/plugins/renderjs.ts
+2
-2
packages/uni-app-vite/src/plugins/resolveId.ts
packages/uni-app-vite/src/plugins/resolveId.ts
+2
-2
packages/uni-app-vite/src/plugins/stats.ts
packages/uni-app-vite/src/plugins/stats.ts
+1
-1
packages/uni-app-vite/src/plugins/template.ts
packages/uni-app-vite/src/plugins/template.ts
+1
-1
packages/uni-automator/lib/uni.plugin.js
packages/uni-automator/lib/uni.plugin.js
+1
-1
packages/uni-automator/src/uni.plugin.ts
packages/uni-automator/src/uni.plugin.ts
+1
-1
packages/uni-cli-nvue/src/plugin.ts
packages/uni-cli-nvue/src/plugin.ts
+1
-1
packages/uni-cli-shared/src/checkUpdate.ts
packages/uni-cli-shared/src/checkUpdate.ts
+1
-1
packages/uni-cli-shared/src/easycom.ts
packages/uni-cli-shared/src/easycom.ts
+1
-1
packages/uni-cli-shared/src/vite/plugins/console.ts
packages/uni-cli-shared/src/vite/plugins/console.ts
+2
-2
packages/uni-cli-shared/src/vite/plugins/copy.ts
packages/uni-cli-shared/src/vite/plugins/copy.ts
+1
-1
packages/uni-cli-shared/src/vite/plugins/cssScoped.ts
packages/uni-cli-shared/src/vite/plugins/cssScoped.ts
+2
-2
packages/uni-cli-shared/src/vite/plugins/inject.ts
packages/uni-cli-shared/src/vite/plugins/inject.ts
+3
-3
packages/uni-cloud/lib/uni.plugin.js
packages/uni-cloud/lib/uni.plugin.js
+1
-1
packages/uni-cloud/lib/validateFunction.js
packages/uni-cloud/lib/validateFunction.js
+1
-1
packages/uni-cloud/src/uni.plugin.ts
packages/uni-cloud/src/uni.plugin.ts
+1
-1
packages/uni-cloud/src/validateFunction.ts
packages/uni-cloud/src/validateFunction.ts
+1
-1
packages/uni-h5-vite/src/plugin/configureServer/static.ts
packages/uni-h5-vite/src/plugin/configureServer/static.ts
+1
-1
packages/uni-h5-vite/src/plugin/esbuild/esbuildPrePlugin.ts
packages/uni-h5-vite/src/plugin/esbuild/esbuildPrePlugin.ts
+1
-1
packages/uni-h5-vite/src/plugin/handleHotUpdate/index.ts
packages/uni-h5-vite/src/plugin/handleHotUpdate/index.ts
+1
-1
packages/uni-h5-vite/src/plugin/index.ts
packages/uni-h5-vite/src/plugin/index.ts
+1
-1
packages/uni-h5-vite/src/plugins/css.ts
packages/uni-h5-vite/src/plugins/css.ts
+1
-1
packages/uni-h5-vite/src/plugins/easycom.ts
packages/uni-h5-vite/src/plugins/easycom.ts
+1
-1
packages/uni-h5-vite/src/plugins/inject.ts
packages/uni-h5-vite/src/plugins/inject.ts
+1
-1
packages/uni-h5-vite/src/plugins/mainJs.ts
packages/uni-h5-vite/src/plugins/mainJs.ts
+1
-1
packages/uni-h5-vite/src/plugins/manifestJson.ts
packages/uni-h5-vite/src/plugins/manifestJson.ts
+1
-1
packages/uni-h5-vite/src/plugins/pagesJson.ts
packages/uni-h5-vite/src/plugins/pagesJson.ts
+1
-1
packages/uni-h5-vite/src/plugins/renderjs.ts
packages/uni-h5-vite/src/plugins/renderjs.ts
+2
-2
packages/uni-h5-vite/src/plugins/resolveId.ts
packages/uni-h5-vite/src/plugins/resolveId.ts
+2
-2
packages/uni-h5-vite/src/plugins/setup.ts
packages/uni-h5-vite/src/plugins/setup.ts
+2
-2
packages/uni-h5-vite/src/plugins/ssr.ts
packages/uni-h5-vite/src/plugins/ssr.ts
+1
-1
packages/uni-mp-alipay/dist/uni.compiler.js
packages/uni-mp-alipay/dist/uni.compiler.js
+1
-1
packages/uni-mp-alipay/src/compiler/index.ts
packages/uni-mp-alipay/src/compiler/index.ts
+1
-1
packages/uni-mp-baidu/dist/uni.compiler.js
packages/uni-mp-baidu/dist/uni.compiler.js
+1
-1
packages/uni-mp-baidu/src/compiler/index.ts
packages/uni-mp-baidu/src/compiler/index.ts
+1
-1
packages/uni-mp-kuaishou/dist/uni.compiler.js
packages/uni-mp-kuaishou/dist/uni.compiler.js
+1
-1
packages/uni-mp-kuaishou/src/compiler/index.ts
packages/uni-mp-kuaishou/src/compiler/index.ts
+1
-1
packages/uni-mp-lark/dist/uni.compiler.js
packages/uni-mp-lark/dist/uni.compiler.js
+1
-1
packages/uni-mp-lark/src/compiler/index.ts
packages/uni-mp-lark/src/compiler/index.ts
+1
-1
packages/uni-mp-qq/dist/uni.compiler.js
packages/uni-mp-qq/dist/uni.compiler.js
+1
-1
packages/uni-mp-qq/src/compiler/index.ts
packages/uni-mp-qq/src/compiler/index.ts
+1
-1
packages/uni-mp-toutiao/dist/uni.compiler.js
packages/uni-mp-toutiao/dist/uni.compiler.js
+1
-1
packages/uni-mp-toutiao/src/compiler/index.ts
packages/uni-mp-toutiao/src/compiler/index.ts
+1
-1
packages/uni-mp-vite/src/plugin/build.ts
packages/uni-mp-vite/src/plugin/build.ts
+1
-1
packages/uni-mp-vite/src/plugin/configResolved.ts
packages/uni-mp-vite/src/plugin/configResolved.ts
+2
-2
packages/uni-mp-vite/src/plugin/index.ts
packages/uni-mp-vite/src/plugin/index.ts
+1
-1
packages/uni-mp-vite/src/plugin/template.ts
packages/uni-mp-vite/src/plugin/template.ts
+1
-1
packages/uni-mp-vite/src/plugins/entry.ts
packages/uni-mp-vite/src/plugins/entry.ts
+1
-1
packages/uni-mp-vite/src/plugins/mainJs.ts
packages/uni-mp-vite/src/plugins/mainJs.ts
+1
-1
packages/uni-mp-vite/src/plugins/manifestJson.ts
packages/uni-mp-vite/src/plugins/manifestJson.ts
+1
-1
packages/uni-mp-vite/src/plugins/pagesJson.ts
packages/uni-mp-vite/src/plugins/pagesJson.ts
+2
-2
packages/uni-mp-vite/src/plugins/plugin.ts
packages/uni-mp-vite/src/plugins/plugin.ts
+1
-1
packages/uni-mp-vite/src/plugins/renderjs.ts
packages/uni-mp-vite/src/plugins/renderjs.ts
+2
-2
packages/uni-mp-vite/src/plugins/runtimeHooks.ts
packages/uni-mp-vite/src/plugins/runtimeHooks.ts
+1
-1
packages/uni-mp-vite/src/plugins/subpackage.ts
packages/uni-mp-vite/src/plugins/subpackage.ts
+1
-1
packages/uni-mp-vite/src/plugins/usingComponents.ts
packages/uni-mp-vite/src/plugins/usingComponents.ts
+1
-1
packages/uni-mp-weixin/dist/uni.compiler.js
packages/uni-mp-weixin/dist/uni.compiler.js
+1
-1
packages/uni-mp-weixin/src/compiler/index.ts
packages/uni-mp-weixin/src/compiler/index.ts
+1
-1
packages/uni-quickapp-webview/dist/uni.compiler.js
packages/uni-quickapp-webview/dist/uni.compiler.js
+1
-1
packages/uni-quickapp-webview/src/compiler/index.ts
packages/uni-quickapp-webview/src/compiler/index.ts
+1
-1
packages/uni-stat/lib/uni.plugin.js
packages/uni-stat/lib/uni.plugin.js
+2
-2
packages/uni-stat/src/plugin/index.ts
packages/uni-stat/src/plugin/index.ts
+2
-2
packages/vite-plugin-uni/bin/uni.js
packages/vite-plugin-uni/bin/uni.js
+1
-7
packages/vite-plugin-uni/src/configResolved/plugins/index.ts
packages/vite-plugin-uni/src/configResolved/plugins/index.ts
+1
-1
packages/vite-plugin-uni/src/configResolved/plugins/json.ts
packages/vite-plugin-uni/src/configResolved/plugins/json.ts
+1
-1
packages/vite-plugin-uni/src/configResolved/plugins/pre.ts
packages/vite-plugin-uni/src/configResolved/plugins/pre.ts
+4
-4
packages/vite-plugin-uni/src/configResolved/plugins/preCss.ts
...ages/vite-plugin-uni/src/configResolved/plugins/preCss.ts
+3
-3
packages/vite-plugin-uni/src/configResolved/plugins/preVue.ts
...ages/vite-plugin-uni/src/configResolved/plugins/preVue.ts
+2
-2
packages/vite-plugin-uni/src/configResolved/plugins/resolveId.ts
...s/vite-plugin-uni/src/configResolved/plugins/resolveId.ts
+2
-2
packages/vite-plugin-uni/src/configResolved/plugins/ssr.ts
packages/vite-plugin-uni/src/configResolved/plugins/ssr.ts
+2
-2
packages/vite-plugin-uni/src/configResolved/plugins/static.ts
...ages/vite-plugin-uni/src/configResolved/plugins/static.ts
+2
-2
packages/vite-plugin-uni/src/index.ts
packages/vite-plugin-uni/src/index.ts
+2
-2
packages/vite-plugin-uni/src/plugins/copy.ts
packages/vite-plugin-uni/src/plugins/copy.ts
+1
-1
packages/vite-plugin-uni/src/utils/easycom.ts
packages/vite-plugin-uni/src/utils/easycom.ts
+1
-1
未找到文件。
packages/uni-app-vite/src/nvue/index.ts
浏览文件 @
be36ec18
...
...
@@ -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
:
{
...
...
packages/uni-app-vite/src/nvue/plugins/entry.ts
浏览文件 @
be36ec18
...
...
@@ -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
))
{
...
...
packages/uni-app-vite/src/plugins/confusion.ts
浏览文件 @
be36ec18
...
...
@@ -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
()
{
...
...
packages/uni-app-vite/src/plugins/easycom.ts
浏览文件 @
be36ec18
...
...
@@ -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
...
...
packages/uni-app-vite/src/plugins/mainJs.ts
浏览文件 @
be36ec18
...
...
@@ -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
))
{
...
...
packages/uni-app-vite/src/plugins/manifestJson.ts
浏览文件 @
be36ec18
...
...
@@ -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
))
{
...
...
packages/uni-app-vite/src/plugins/pagesJson.ts
浏览文件 @
be36ec18
...
...
@@ -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
))
{
...
...
packages/uni-app-vite/src/plugins/renderjs.ts
浏览文件 @
be36ec18
...
...
@@ -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
>
())
...
...
packages/uni-app-vite/src/plugins/resolveId.ts
浏览文件 @
be36ec18
...
...
@@ -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
(
...
...
packages/uni-app-vite/src/plugins/stats.ts
浏览文件 @
be36ec18
...
...
@@ -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
...
...
packages/uni-app-vite/src/plugins/template.ts
浏览文件 @
be36ec18
...
...
@@ -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
...
...
packages/uni-automator/lib/uni.plugin.js
浏览文件 @
be36ec18
...
...
@@ -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
)
{
...
...
packages/uni-automator/src/uni.plugin.ts
浏览文件 @
be36ec18
...
...
@@ -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
)
{
...
...
packages/uni-cli-nvue/src/plugin.ts
浏览文件 @
be36ec18
...
...
@@ -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
'
)
{
...
...
packages/uni-cli-shared/src/checkUpdate.ts
浏览文件 @
be36ec18
...
...
@@ -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
...
...
packages/uni-cli-shared/src/easycom.ts
浏览文件 @
be36ec18
...
...
@@ -24,7 +24,7 @@ interface EasycomCustom {
[
key
:
string
]:
string
}
const
debugEasycom
=
debug
(
'
vite:
uni:easycom
'
)
const
debugEasycom
=
debug
(
'
uni:easycom
'
)
const
easycoms
:
EasycomMatcher
[]
=
[]
...
...
packages/uni-cli-shared/src/vite/plugins/console.ts
浏览文件 @
be36ec18
...
...
@@ -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
...
...
packages/uni-cli-shared/src/vite/plugins/copy.ts
浏览文件 @
be36ec18
...
...
@@ -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
...
...
packages/uni-cli-shared/src/vite/plugins/cssScoped.ts
浏览文件 @
be36ec18
...
...
@@ -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
...
...
packages/uni-cli-shared/src/vite/plugins/inject.ts
浏览文件 @
be36ec18
...
...
@@ -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
)
{
...
...
packages/uni-cloud/lib/uni.plugin.js
浏览文件 @
be36ec18
...
...
@@ -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
)
{
...
...
packages/uni-cloud/lib/validateFunction.js
浏览文件 @
be36ec18
...
...
@@ -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
'
))
{
...
...
packages/uni-cloud/src/uni.plugin.ts
浏览文件 @
be36ec18
...
...
@@ -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
)
{
...
...
packages/uni-cloud/src/validateFunction.ts
浏览文件 @
be36ec18
...
...
@@ -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
'
))
{
...
...
packages/uni-h5-vite/src/plugin/configureServer/static.ts
浏览文件 @
be36ec18
...
...
@@ -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
...
...
packages/uni-h5-vite/src/plugin/esbuild/esbuildPrePlugin.ts
浏览文件 @
be36ec18
...
...
@@ -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
)
...
...
packages/uni-h5-vite/src/plugin/handleHotUpdate/index.ts
浏览文件 @
be36ec18
...
...
@@ -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
))
...
...
packages/uni-h5-vite/src/plugin/index.ts
浏览文件 @
be36ec18
...
...
@@ -18,7 +18,7 @@ export function uniH5Plugin(): UniVitePlugin {
}
rewriteReadFileSync
()
return
{
name
:
'
vite:uni-
h5
'
,
name
:
'
uni:
h5
'
,
uni
:
createUni
(),
config
:
createConfig
(
configOptions
),
configResolved
(
config
)
{
...
...
packages/uni-h5-vite/src/plugins/css.ts
浏览文件 @
be36ec18
...
...
@@ -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
)
{
...
...
packages/uni-h5-vite/src/plugins/easycom.ts
浏览文件 @
be36ec18
...
...
@@ -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
)
},
...
...
packages/uni-h5-vite/src/plugins/inject.ts
浏览文件 @
be36ec18
...
...
@@ -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
)
{
...
...
packages/uni-h5-vite/src/plugins/mainJs.ts
浏览文件 @
be36ec18
...
...
@@ -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
(
...
...
packages/uni-h5-vite/src/plugins/manifestJson.ts
浏览文件 @
be36ec18
...
...
@@ -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
))
{
...
...
packages/uni-h5-vite/src/plugins/pagesJson.ts
浏览文件 @
be36ec18
...
...
@@ -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
))
{
...
...
packages/uni-h5-vite/src/plugins/renderjs.ts
浏览文件 @
be36ec18
...
...
@@ -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
)
{
...
...
packages/uni-h5-vite/src/plugins/resolveId.ts
浏览文件 @
be36ec18
...
...
@@ -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
(
...
...
packages/uni-h5-vite/src/plugins/setup.ts
浏览文件 @
be36ec18
...
...
@@ -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
(
...
...
packages/uni-h5-vite/src/plugins/ssr.ts
浏览文件 @
be36ec18
...
...
@@ -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
()
...
...
packages/uni-mp-alipay/dist/uni.compiler.js
浏览文件 @
be36ec18
...
...
@@ -234,7 +234,7 @@ const options = {
};
const
uniMiniProgramAlipayPlugin
=
{
name
:
'
vite:uni-
mp-alipay
'
,
name
:
'
uni:
mp-alipay
'
,
config
()
{
return
{
define
:
{
...
...
packages/uni-mp-alipay/src/compiler/index.ts
浏览文件 @
be36ec18
...
...
@@ -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
:
{
...
...
packages/uni-mp-baidu/dist/uni.compiler.js
浏览文件 @
be36ec18
...
...
@@ -130,7 +130,7 @@ const options = {
};
const
uniMiniProgramBaiduPlugin
=
{
name
:
'
vite:uni-
mp-baidu
'
,
name
:
'
uni:
mp-baidu
'
,
config
()
{
return
{
define
:
{
...
...
packages/uni-mp-baidu/src/compiler/index.ts
浏览文件 @
be36ec18
...
...
@@ -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
:
{
...
...
packages/uni-mp-kuaishou/dist/uni.compiler.js
浏览文件 @
be36ec18
...
...
@@ -184,7 +184,7 @@ const options = {
};
const
uniMiniProgramKuaishouPlugin
=
{
name
:
'
vite:uni-
mp-kuaishou
'
,
name
:
'
uni:
mp-kuaishou
'
,
config
()
{
return
{
define
:
{
...
...
packages/uni-mp-kuaishou/src/compiler/index.ts
浏览文件 @
be36ec18
...
...
@@ -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
:
{
...
...
packages/uni-mp-lark/dist/uni.compiler.js
浏览文件 @
be36ec18
...
...
@@ -127,7 +127,7 @@ ${filter.code}
};
const
uniMiniProgramToutiaoPlugin
=
{
name
:
'
vite:uni-
mp-lark
'
,
name
:
'
uni:
mp-lark
'
,
config
()
{
return
{
define
:
{
...
...
packages/uni-mp-lark/src/compiler/index.ts
浏览文件 @
be36ec18
...
...
@@ -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
:
{
...
...
packages/uni-mp-qq/dist/uni.compiler.js
浏览文件 @
be36ec18
...
...
@@ -157,7 +157,7 @@ const options = {
};
const
uniMiniProgramQQPlugin
=
{
name
:
'
vite:uni-
mp-qq
'
,
name
:
'
uni:
mp-qq
'
,
config
()
{
return
{
define
:
{
...
...
packages/uni-mp-qq/src/compiler/index.ts
浏览文件 @
be36ec18
...
...
@@ -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
:
{
...
...
packages/uni-mp-toutiao/dist/uni.compiler.js
浏览文件 @
be36ec18
...
...
@@ -127,7 +127,7 @@ ${filter.code}
};
const
uniMiniProgramToutiaoPlugin
=
{
name
:
'
vite:uni-
mp-toutiao
'
,
name
:
'
uni:
mp-toutiao
'
,
config
()
{
return
{
define
:
{
...
...
packages/uni-mp-toutiao/src/compiler/index.ts
浏览文件 @
be36ec18
...
...
@@ -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
:
{
...
...
packages/uni-mp-vite/src/plugin/build.ts
浏览文件 @
be36ec18
...
...
@@ -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
...
...
packages/uni-mp-vite/src/plugin/configResolved.ts
浏览文件 @
be36ec18
...
...
@@ -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
)
=>
{
...
...
packages/uni-mp-vite/src/plugin/index.ts
浏览文件 @
be36ec18
...
...
@@ -98,7 +98,7 @@ export function uniMiniProgramPlugin(
rewriteCompileScript
()
return
{
name
:
'
vite:uni-
mp
'
,
name
:
'
uni:
mp
'
,
uni
:
uniOptions
({
copyOptions
,
customElements
:
template
.
customElements
,
...
...
packages/uni-mp-vite/src/plugin/template.ts
浏览文件 @
be36ec18
...
...
@@ -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
,
...
...
packages/uni-mp-vite/src/plugins/entry.ts
浏览文件 @
be36ec18
...
...
@@ -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
))
{
...
...
packages/uni-mp-vite/src/plugins/mainJs.ts
浏览文件 @
be36ec18
...
...
@@ -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
))
{
...
...
packages/uni-mp-vite/src/plugins/manifestJson.ts
浏览文件 @
be36ec18
...
...
@@ -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
))
{
...
...
packages/uni-mp-vite/src/plugins/pagesJson.ts
浏览文件 @
be36ec18
...
...
@@ -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
...
...
packages/uni-mp-vite/src/plugins/plugin.ts
浏览文件 @
be36ec18
...
...
@@ -27,7 +27,7 @@ export function uniMiniProgramPluginPlugin({
)
}
return
{
name
:
'
vite:uni-
mp-plugin
'
,
name
:
'
uni:
mp-plugin
'
,
enforce
:
'
post
'
,
config
()
{
return
{
...
...
packages/uni-mp-vite/src/plugins/renderjs.ts
浏览文件 @
be36ec18
...
...
@@ -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
},
...
...
packages/uni-mp-vite/src/plugins/runtimeHooks.ts
浏览文件 @
be36ec18
...
...
@@ -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
))
{
...
...
packages/uni-mp-vite/src/plugins/subpackage.ts
浏览文件 @
be36ec18
...
...
@@ -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
),
}
...
...
packages/uni-mp-vite/src/plugins/usingComponents.ts
浏览文件 @
be36ec18
...
...
@@ -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
...
...
packages/uni-mp-weixin/dist/uni.compiler.js
浏览文件 @
be36ec18
...
...
@@ -150,7 +150,7 @@ ${filter.code}
};
const
uniMiniProgramWeixinPlugin
=
{
name
:
'
vite:uni-
mp-weixin
'
,
name
:
'
uni:
mp-weixin
'
,
config
()
{
return
{
define
:
{
...
...
packages/uni-mp-weixin/src/compiler/index.ts
浏览文件 @
be36ec18
...
...
@@ -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
:
{
...
...
packages/uni-quickapp-webview/dist/uni.compiler.js
浏览文件 @
be36ec18
...
...
@@ -110,7 +110,7 @@ ${filter.code}
};
const
uniQuickappWebviewPlugin
=
{
name
:
'
vite:uni-
quickapp-webview
'
,
name
:
'
uni:
quickapp-webview
'
,
config
()
{
return
{
define
:
{
...
...
packages/uni-quickapp-webview/src/compiler/index.ts
浏览文件 @
be36ec18
...
...
@@ -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
:
{
...
...
packages/uni-stat/lib/uni.plugin.js
浏览文件 @
be36ec18
...
...
@@ -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
:
{
...
...
packages/uni-stat/src/plugin/index.ts
浏览文件 @
be36ec18
...
...
@@ -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
:
{
...
...
packages/vite-plugin-uni/bin/uni.js
浏览文件 @
be36ec18
...
...
@@ -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
...
...
packages/vite-plugin-uni/src/configResolved/plugins/index.ts
浏览文件 @
be36ec18
...
...
@@ -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
...
...
packages/vite-plugin-uni/src/configResolved/plugins/json.ts
浏览文件 @
be36ec18
...
...
@@ -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
...
...
packages/vite-plugin-uni/src/configResolved/plugins/pre.ts
浏览文件 @
be36ec18
...
...
@@ -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
...
...
packages/vite-plugin-uni/src/configResolved/plugins/preCss.ts
浏览文件 @
be36ec18
...
...
@@ -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
...
...
packages/vite-plugin-uni/src/configResolved/plugins/preVue.ts
浏览文件 @
be36ec18
...
...
@@ -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
)
{
...
...
packages/vite-plugin-uni/src/configResolved/plugins/resolveId.ts
浏览文件 @
be36ec18
...
...
@@ -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
)
{
...
...
packages/vite-plugin-uni/src/configResolved/plugins/ssr.ts
浏览文件 @
be36ec18
...
...
@@ -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
))
{
...
...
packages/vite-plugin-uni/src/configResolved/plugins/static.ts
浏览文件 @
be36ec18
...
...
@@ -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
...
...
packages/vite-plugin-uni/src/index.ts
浏览文件 @
be36ec18
...
...
@@ -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
),
...
...
packages/vite-plugin-uni/src/plugins/copy.ts
浏览文件 @
be36ec18
...
...
@@ -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
,
...
...
packages/vite-plugin-uni/src/utils/easycom.ts
浏览文件 @
be36ec18
...
...
@@ -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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录