Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
genary
uni-app
提交
e4f443b1
U
uni-app
项目概览
genary
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e4f443b1
编写于
8月 03, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(app): transformAssetUrls
上级
dbea30e6
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
97 addition
and
33 deletion
+97
-33
packages/uni-app-vite/src/plugin/uni.ts
packages/uni-app-vite/src/plugin/uni.ts
+4
-0
packages/uni-cli-nvue/src/webpack/config/optimization.ts
packages/uni-cli-nvue/src/webpack/config/optimization.ts
+2
-2
packages/uni-cli-shared/src/vite/index.ts
packages/uni-cli-shared/src/vite/index.ts
+2
-1
packages/uni-h5-vite/dist/index.js
packages/uni-h5-vite/dist/index.js
+18
-0
packages/uni-h5-vite/src/index.ts
packages/uni-h5-vite/src/index.ts
+18
-0
packages/vite-plugin-uni/src/vue/options.ts
packages/vite-plugin-uni/src/vue/options.ts
+10
-29
yarn.lock
yarn.lock
+43
-1
未找到文件。
packages/uni-app-vite/src/plugin/uni.ts
浏览文件 @
e4f443b1
...
...
@@ -12,4 +12,8 @@ export const uniOptions: UniVitePlugin['uni'] = {
transformEvent
:
{
tap
:
'
click
'
,
},
transformAssetUrls
:
{
base
:
'
/
'
,
tags
:
{},
},
}
packages/uni-cli-nvue/src/webpack/config/optimization.ts
浏览文件 @
e4f443b1
import
TerserPlugin
from
'
terser-webpack-plugin
'
import
{
Configuration
}
from
'
webpack
'
import
{
Configuration
,
WebpackPluginInstance
}
from
'
webpack
'
export
function
createOptimization
():
Configuration
[
'
optimization
'
]
{
return
{
...
...
@@ -13,7 +13,7 @@ export function createOptimization(): Configuration['optimization'] {
ascii_only
:
true
,
},
},
}),
})
as
unknown
as
WebpackPluginInstance
,
],
}
}
packages/uni-cli-shared/src/vite/index.ts
浏览文件 @
e4f443b1
import
{
Plugin
}
from
'
vite
'
import
{
ParserOptions
}
from
'
@vue/compiler-core
'
import
{
CompilerOptions
}
from
'
@vue/compiler-sfc
'
import
{
CompilerOptions
,
SFCTemplateCompileOptions
}
from
'
@vue/compiler-sfc
'
export
interface
UniVitePlugin
extends
Plugin
{
uni
?:
{
compilerOptions
?:
{
...
...
@@ -9,6 +9,7 @@ export interface UniVitePlugin extends Plugin {
directiveTransforms
?:
CompilerOptions
[
'
directiveTransforms
'
]
}
transformEvent
?:
Record
<
string
,
string
>
transformAssetUrls
?:
SFCTemplateCompileOptions
[
'
transformAssetUrls
'
]
}
}
...
...
packages/uni-h5-vite/dist/index.js
浏览文件 @
e4f443b1
...
...
@@ -24,6 +24,24 @@ const UniH5Plugin = {
transformEvent
:
{
tap
:
'
click
'
,
},
transformAssetUrls
:
{
base
:
'
/
'
,
tags
:
{
audio
:
[
'
src
'
],
video
:
[
'
src
'
,
'
poster
'
],
img
:
[
'
src
'
],
image
:
[
'
src
'
],
'
cover-image
'
:
[
'
src
'
],
// h5
'
v-uni-audio
'
:
[
'
src
'
],
'
v-uni-video
'
:
[
'
src
'
,
'
poster
'
],
'
v-uni-image
'
:
[
'
src
'
],
'
v-uni-cover-image
'
:
[
'
src
'
],
// nvue
'
u-image
'
:
[
'
src
'
],
'
u-video
'
:
[
'
src
'
,
'
poster
'
],
},
},
},
config
(
config
,
env
)
{
if
(
uni_cli_shared_1
.
isInHBuilderX
())
{
...
...
packages/uni-h5-vite/src/index.ts
浏览文件 @
e4f443b1
...
...
@@ -21,6 +21,24 @@ const UniH5Plugin: UniVitePlugin = {
transformEvent
:
{
tap
:
'
click
'
,
},
transformAssetUrls
:
{
base
:
'
/
'
,
tags
:
{
audio
:
[
'
src
'
],
video
:
[
'
src
'
,
'
poster
'
],
img
:
[
'
src
'
],
image
:
[
'
src
'
],
'
cover-image
'
:
[
'
src
'
],
// h5
'
v-uni-audio
'
:
[
'
src
'
],
'
v-uni-video
'
:
[
'
src
'
,
'
poster
'
],
'
v-uni-image
'
:
[
'
src
'
],
'
v-uni-cover-image
'
:
[
'
src
'
],
// nvue
'
u-image
'
:
[
'
src
'
],
'
u-video
'
:
[
'
src
'
,
'
poster
'
],
},
},
},
config
(
config
,
env
)
{
if
(
isInHBuilderX
())
{
...
...
packages/vite-plugin-uni/src/vue/options.ts
浏览文件 @
e4f443b1
...
...
@@ -14,29 +14,6 @@ import { transformMatchMedia } from './transforms/transformMatchMedia'
import
{
createTransformEvent
}
from
'
./transforms/transformEvent
'
// import { transformContext } from './transforms/transformContext'
function
createUniVueTransformAssetUrls
(
base
:
string
):
SFCTemplateCompileOptions
[
'
transformAssetUrls
'
]
{
return
{
base
,
tags
:
{
audio
:
[
'
src
'
],
video
:
[
'
src
'
,
'
poster
'
],
img
:
[
'
src
'
],
image
:
[
'
src
'
],
'
cover-image
'
:
[
'
src
'
],
// h5
'
v-uni-audio
'
:
[
'
src
'
],
'
v-uni-video
'
:
[
'
src
'
,
'
poster
'
],
'
v-uni-image
'
:
[
'
src
'
],
'
v-uni-cover-image
'
:
[
'
src
'
],
// nvue
'
u-image
'
:
[
'
src
'
],
'
u-video
'
:
[
'
src
'
,
'
poster
'
],
},
}
}
export
function
initPluginVueOptions
(
options
:
VitePluginUniResolvedOptions
,
UniVitePlugins
:
UniVitePlugin
[]
...
...
@@ -52,18 +29,15 @@ export function initPluginVueOptions(
const
templateOptions
=
vueOptions
.
template
||
(
vueOptions
.
template
=
{})
templateOptions
.
transformAssetUrls
=
createUniVueTransformAssetUrls
(
options
.
base
)
let
transformAssetUrls
:
SFCTemplateCompileOptions
[
'
transformAssetUrls
'
]
let
isCompilerNativeTag
:
ParserOptions
[
'
isNativeTag
'
]
=
isNativeTag
let
isCompilerCustomElement
:
ParserOptions
[
'
isCustomElement
'
]
=
isCustomElement
let
directiveTransforms
:
CompilerOptions
[
'
directiveTransforms
'
]
UniVitePlugins
.
forEach
((
plugin
)
=>
{
const
compilerOptions
=
plugin
.
uni
?.
compilerOptions
UniVitePlugins
.
forEach
((
{
uni
}
)
=>
{
const
compilerOptions
=
uni
?.
compilerOptions
if
(
compilerOptions
)
{
if
(
compilerOptions
.
isNativeTag
)
{
isCompilerNativeTag
=
compilerOptions
.
isNativeTag
...
...
@@ -74,14 +48,21 @@ export function initPluginVueOptions(
if
(
compilerOptions
.
directiveTransforms
)
{
directiveTransforms
=
compilerOptions
.
directiveTransforms
}
if
(
uni
!
.
transformAssetUrls
)
{
transformAssetUrls
=
uni
!
.
transformAssetUrls
}
}
})
const
compilerOptions
=
templateOptions
.
compilerOptions
||
(
templateOptions
.
compilerOptions
=
{})
compilerOptions
.
isNativeTag
=
isCompilerNativeTag
if
(
!
compilerOptions
.
nodeTransforms
)
{
compilerOptions
.
nodeTransforms
=
[]
}
if
(
transformAssetUrls
)
{
templateOptions
.
transformAssetUrls
=
transformAssetUrls
}
const
compatConfig
=
parseCompatConfigOnce
(
options
.
inputDir
)
...
...
yarn.lock
浏览文件 @
e4f443b1
...
...
@@ -9032,6 +9032,11 @@ sort-keys@^4.0.0:
dependencies:
is-plain-obj "^2.0.0"
source-list-map@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34"
integrity sha512-qnQ7gVMxGNxsiL4lEuJwe/To8UnK7fAnmbGEEH8RpLouuKbeEm0lhbQVFIrNSuB+G7tVrAlVsZgETT5nljf+Iw==
source-map-js@^0.6.2:
version "0.6.2"
resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-0.6.2.tgz#0bb5de631b41cfbda6cfba8bd05a80efdfd2385e"
...
...
@@ -9997,12 +10002,20 @@ webidl-conversions@^6.1.0:
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-6.1.0.tgz#9111b4d7ea80acd40f5270d666621afa78b69514"
integrity sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w==
webpack-sources@^2.3.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-2.3.1.tgz#570de0af163949fe272233c2cefe1b56f74511fd"
integrity sha512-y9EI9AO42JjEcrTJFOYmVywVZdKVUfOvDUPsJea5GIr1JOEGFVqwlY2K098fFoIjOkDzHn2AjRvM8dsBZu+gCA==
dependencies:
source-list-map "^2.0.1"
source-map "^0.6.1"
webpack-sources@^3.1.2, webpack-sources@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.0.tgz#b16973bcf844ebcdb3afde32eda1c04d0b90f89d"
integrity sha512-fahN08Et7P9trej8xz/Z7eRu8ltyiygEo/hnRi9KqBUs80KeDcnf96ZJo++ewWd84fEf3xSX9bp4ZS9hbw0OBw==
webpack@^5.1.0
, webpack@^5.45.1
:
webpack@^5.1.0:
version "5.48.0"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.48.0.tgz#06180fef9767a6fd066889559a4c4d49bee19b83"
integrity sha512-CGe+nfbHrYzbk7SKoYITCgN3LRAG0yVddjNUecz9uugo1QtYdiyrVD8nP1PhkNqPfdxC2hknmmKpP355Epyn6A==
...
...
@@ -10032,6 +10045,35 @@ webpack@^5.1.0, webpack@^5.45.1:
watchpack "^2.2.0"
webpack-sources "^3.2.0"
webpack@~5.45.1:
version "5.45.1"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.45.1.tgz#d78dcbeda18a872dc62b0455d3ed3dcfd1c886bb"
integrity sha512-68VT2ZgG9EHs6h6UxfV2SEYewA9BA3SOLSnC2NEbJJiEwbAiueDL033R1xX0jzjmXvMh0oSeKnKgbO2bDXIEyQ==
dependencies:
"@types/eslint-scope" "^3.7.0"
"@types/estree" "^0.0.50"
"@webassemblyjs/ast" "1.11.1"
"@webassemblyjs/wasm-edit" "1.11.1"
"@webassemblyjs/wasm-parser" "1.11.1"
acorn "^8.4.1"
browserslist "^4.14.5"
chrome-trace-event "^1.0.2"
enhanced-resolve "^5.8.0"
es-module-lexer "^0.7.1"
eslint-scope "5.1.1"
events "^3.2.0"
glob-to-regexp "^0.4.1"
graceful-fs "^4.2.4"
json-parse-better-errors "^1.0.2"
loader-runner "^4.2.0"
mime-types "^2.1.27"
neo-async "^2.6.2"
schema-utils "^3.1.0"
tapable "^2.1.1"
terser-webpack-plugin "^5.1.3"
watchpack "^2.2.0"
webpack-sources "^2.3.0"
whatwg-encoding@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录