Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
菜鸟程序猿_c
uni-app
提交
4678dfc2
U
uni-app
项目概览
菜鸟程序猿_c
/
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,发现更多精彩内容 >>
提交
4678dfc2
编写于
8月 16, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(app): sourcemap
上级
b54cfdbe
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
128 addition
and
97 deletion
+128
-97
packages/uni-app-plus/dist/uni-app-service.es.js
packages/uni-app-plus/dist/uni-app-service.es.js
+3
-2
packages/uni-app-plus/dist/uni-app-view.umd.js
packages/uni-app-plus/dist/uni-app-view.umd.js
+1
-1
packages/uni-app-vite/src/plugin/build.ts
packages/uni-app-vite/src/plugin/build.ts
+1
-0
packages/uni-app-vite/src/plugins/manifestJson.ts
packages/uni-app-vite/src/plugins/manifestJson.ts
+4
-1
packages/uni-app-vite/src/plugins/pagesJson.ts
packages/uni-app-vite/src/plugins/pagesJson.ts
+5
-3
packages/uni-app-vite/src/plugins/renderjs.ts
packages/uni-app-vite/src/plugins/renderjs.ts
+7
-4
packages/uni-cli-shared/src/vite/plugins/cssScoped.ts
packages/uni-cli-shared/src/vite/plugins/cssScoped.ts
+2
-2
packages/uni-h5/dist/uni-h5.cjs.js
packages/uni-h5/dist/uni-h5.cjs.js
+34
-32
packages/uni-h5/dist/uni-h5.es.js
packages/uni-h5/dist/uni-h5.es.js
+39
-38
packages/vite-plugin-uni/src/configResolved/plugins/easycom.ts
...ges/vite-plugin-uni/src/configResolved/plugins/easycom.ts
+4
-1
packages/vite-plugin-uni/src/configResolved/plugins/json.ts
packages/vite-plugin-uni/src/configResolved/plugins/json.ts
+4
-1
packages/vite-plugin-uni/src/configResolved/plugins/pre.ts
packages/vite-plugin-uni/src/configResolved/plugins/pre.ts
+2
-2
packages/vite-plugin-uni/src/configResolved/plugins/preCss.ts
...ages/vite-plugin-uni/src/configResolved/plugins/preCss.ts
+5
-2
packages/vite-plugin-uni/src/configResolved/plugins/preVue.ts
...ages/vite-plugin-uni/src/configResolved/plugins/preVue.ts
+8
-2
packages/vite-plugin-uni/src/configResolved/plugins/renderjs.ts
...es/vite-plugin-uni/src/configResolved/plugins/renderjs.ts
+8
-5
packages/vite-plugin-uni/src/configResolved/plugins/ssr.ts
packages/vite-plugin-uni/src/configResolved/plugins/ssr.ts
+1
-1
未找到文件。
packages/uni-app-plus/dist/uni-app-service.es.js
浏览文件 @
4678dfc2
...
@@ -2965,8 +2965,9 @@ var serviceContext = (function (vue) {
...
@@ -2965,8 +2965,9 @@ var serviceContext = (function (vue) {
}
}
class Pattern {
class Pattern {
constructor(image, repetition) {
constructor(image, repetition) {
this.image = image;
this.type = 'pattern';
this.repetition = repetition;
this.data = image;
this.colorStop = repetition;
}
}
}
}
class TextMetrics {
class TextMetrics {
...
...
packages/uni-app-plus/dist/uni-app-view.umd.js
浏览文件 @
4678dfc2
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
packages/uni-app-vite/src/plugin/build.ts
浏览文件 @
4678dfc2
...
@@ -14,6 +14,7 @@ export function buildOptions(): UserConfig['build'] {
...
@@ -14,6 +14,7 @@ export function buildOptions(): UserConfig['build'] {
emptyDir
(
process
.
env
.
UNI_OUTPUT_DIR
)
emptyDir
(
process
.
env
.
UNI_OUTPUT_DIR
)
}
}
return
{
return
{
// sourcemap: 'inline',
emptyOutDir
:
false
,
// 不清空输出目录,否则会影响 webpack 的输出
emptyOutDir
:
false
,
// 不清空输出目录,否则会影响 webpack 的输出
assetsInlineLimit
:
0
,
assetsInlineLimit
:
0
,
rollupOptions
:
{
rollupOptions
:
{
...
...
packages/uni-app-vite/src/plugins/manifestJson.ts
浏览文件 @
4678dfc2
...
@@ -28,7 +28,10 @@ export function uniManifestJsonPlugin(): Plugin {
...
@@ -28,7 +28,10 @@ export function uniManifestJsonPlugin(): Plugin {
process
.
env
.
UNI_PLATFORM
process
.
env
.
UNI_PLATFORM
)
)
)
)
return
''
return
{
code
:
''
,
map
:
this
.
getCombinedSourcemap
(),
}
},
},
generateBundle
()
{
generateBundle
()
{
// 生成一个空的app-config.js,兼容基座已有规范
// 生成一个空的app-config.js,兼容基座已有规范
...
...
packages/uni-app-vite/src/plugins/pagesJson.ts
浏览文件 @
4678dfc2
...
@@ -27,9 +27,11 @@ export function uniPagesJsonPlugin(): Plugin {
...
@@ -27,9 +27,11 @@ export function uniPagesJsonPlugin(): Plugin {
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
page
.
path
+
'
.vue
'
)
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
page
.
path
+
'
.vue
'
)
)
)
})
})
return
(
return
{
`import './manifest.json.js'\n`
+
normalizeAppPagesJson
(
pagesJson
)
code
:
)
`import './manifest.json.js'\n`
+
normalizeAppPagesJson
(
pagesJson
),
map
:
this
.
getCombinedSourcemap
(),
}
},
},
generateBundle
()
{
generateBundle
()
{
this
.
emitFile
({
this
.
emitFile
({
...
...
packages/uni-app-vite/src/plugins/renderjs.ts
浏览文件 @
4678dfc2
...
@@ -68,10 +68,13 @@ export function uniRenderjsPlugin(): Plugin {
...
@@ -68,10 +68,13 @@ export function uniRenderjsPlugin(): Plugin {
}
}
changed
=
true
changed
=
true
debugRenderjs
(
type
,
modulePath
,
moduleHashId
)
debugRenderjs
(
type
,
modulePath
,
moduleHashId
)
return
`export default Comp => {
return
{
;(Comp.$
${
type
}
|| (Comp.$
${
type
}
= [])).push('
${
name
}
')
code
:
`export default Comp => {
;(Comp.$
${
globalName
}
|| (Comp.$
${
globalName
}
= {}))['
${
name
}
'] = '
${
moduleHashId
}
'
;(Comp.$
${
type
}
|| (Comp.$
${
type
}
= [])).push('
${
name
}
')
}`
;(Comp.$
${
globalName
}
|| (Comp.$
${
globalName
}
= {}))['
${
name
}
'] = '
${
moduleHashId
}
'
}`
,
map
:
null
,
}
},
},
generateBundle
()
{
generateBundle
()
{
if
(
!
changed
)
{
if
(
!
changed
)
{
...
...
packages/uni-cli-shared/src/vite/plugins/cssScoped.ts
浏览文件 @
4678dfc2
...
@@ -31,13 +31,13 @@ export function uniCssScopedPlugin(
...
@@ -31,13 +31,13 @@ export function uniCssScopedPlugin(
enforce
:
'
pre
'
,
enforce
:
'
pre
'
,
transform
(
code
,
id
)
{
transform
(
code
,
id
)
{
if
(
id
.
endsWith
(
'
App.vue
'
))
{
if
(
id
.
endsWith
(
'
App.vue
'
))
{
return
code
return
}
}
if
(
!
filter
(
id
))
return
null
if
(
!
filter
(
id
))
return
null
const
{
filename
,
query
}
=
parseVueRequest
(
id
)
const
{
filename
,
query
}
=
parseVueRequest
(
id
)
if
(
query
.
vue
)
{
if
(
query
.
vue
)
{
return
code
return
}
}
if
(
EXTNAME_VUE
.
includes
(
path
.
extname
(
filename
)))
{
if
(
EXTNAME_VUE
.
includes
(
path
.
extname
(
filename
)))
{
debugScoped
(
id
)
debugScoped
(
id
)
...
...
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
4678dfc2
...
@@ -1674,10 +1674,10 @@ function useMethods(canvasRef, actionsWaiting) {
...
@@ -1674,10 +1674,10 @@ function useMethods(canvasRef, actionsWaiting) {
let
_actionsDefer
=
[];
let
_actionsDefer
=
[];
let
_images
=
{};
let
_images
=
{};
function
_resize
()
{
function
_resize
()
{
var
canvas
=
canvasRef
.
value
;
let
canvas
=
canvasRef
.
value
;
if
(
canvas
.
width
>
0
&&
canvas
.
height
>
0
)
{
if
(
canvas
.
width
>
0
&&
canvas
.
height
>
0
)
{
var
context
=
canvas
.
getContext
(
"
2d
"
);
let
context
=
canvas
.
getContext
(
"
2d
"
);
var
imageData
=
context
.
getImageData
(
0
,
0
,
canvas
.
width
,
canvas
.
height
);
let
imageData
=
context
.
getImageData
(
0
,
0
,
canvas
.
width
,
canvas
.
height
);
wrapper
(
canvas
);
wrapper
(
canvas
);
context
.
putImageData
(
imageData
,
0
,
0
);
context
.
putImageData
(
imageData
,
0
,
0
);
}
else
{
}
else
{
...
@@ -1695,8 +1695,8 @@ function useMethods(canvasRef, actionsWaiting) {
...
@@ -1695,8 +1695,8 @@ function useMethods(canvasRef, actionsWaiting) {
_actionsDefer
.
push
([
actions
,
reserve
]);
_actionsDefer
.
push
([
actions
,
reserve
]);
return
;
return
;
}
}
var
canvas
=
canvasRef
.
value
;
let
canvas
=
canvasRef
.
value
;
var
c2d
=
canvas
.
getContext
(
"
2d
"
);
let
c2d
=
canvas
.
getContext
(
"
2d
"
);
if
(
!
reserve
)
{
if
(
!
reserve
)
{
c2d
.
fillStyle
=
"
#000000
"
;
c2d
.
fillStyle
=
"
#000000
"
;
c2d
.
strokeStyle
=
"
#000000
"
;
c2d
.
strokeStyle
=
"
#000000
"
;
...
@@ -1712,13 +1712,14 @@ function useMethods(canvasRef, actionsWaiting) {
...
@@ -1712,13 +1712,14 @@ function useMethods(canvasRef, actionsWaiting) {
const
action
=
actions
[
index2
];
const
action
=
actions
[
index2
];
let
method
=
action
.
method
;
let
method
=
action
.
method
;
const
data
=
action
.
data
;
const
data
=
action
.
data
;
const
actionType
=
data
[
0
];
if
(
/^set/
.
test
(
method
)
&&
method
!==
"
setTransform
"
)
{
if
(
/^set/
.
test
(
method
)
&&
method
!==
"
setTransform
"
)
{
const
method1
=
method
[
3
].
toLowerCase
()
+
method
.
slice
(
4
);
const
method1
=
method
[
3
].
toLowerCase
()
+
method
.
slice
(
4
);
let
color
;
let
color
;
if
(
method1
===
"
fillStyle
"
||
method1
===
"
strokeStyle
"
)
{
if
(
method1
===
"
fillStyle
"
||
method1
===
"
strokeStyle
"
)
{
if
(
data
[
0
]
===
"
normal
"
)
{
if
(
actionType
===
"
normal
"
)
{
color
=
resolveColor
(
data
[
1
]);
color
=
resolveColor
(
data
[
1
]);
}
else
if
(
data
[
0
]
===
"
linear
"
)
{
}
else
if
(
actionType
===
"
linear
"
)
{
const
LinearGradient
=
c2d
.
createLinearGradient
(...
data
[
1
]);
const
LinearGradient
=
c2d
.
createLinearGradient
(...
data
[
1
]);
data
[
2
].
forEach
(
function
(
data2
)
{
data
[
2
].
forEach
(
function
(
data2
)
{
const
offset
=
data2
[
0
];
const
offset
=
data2
[
0
];
...
@@ -1726,10 +1727,11 @@ function useMethods(canvasRef, actionsWaiting) {
...
@@ -1726,10 +1727,11 @@ function useMethods(canvasRef, actionsWaiting) {
LinearGradient
.
addColorStop
(
offset
,
color2
);
LinearGradient
.
addColorStop
(
offset
,
color2
);
});
});
color
=
LinearGradient
;
color
=
LinearGradient
;
}
else
if
(
data
[
0
]
===
"
radial
"
)
{
}
else
if
(
actionType
===
"
radial
"
)
{
const
x
=
data
[
1
][
0
];
let
_data
=
data
[
1
];
const
y
=
data
[
1
][
1
];
const
x
=
_data
[
0
];
const
r
=
data
[
1
][
2
];
const
y
=
_data
[
1
];
const
r
=
_data
[
2
];
const
LinearGradient
=
c2d
.
createRadialGradient
(
x
,
y
,
0
,
x
,
y
,
r
);
const
LinearGradient
=
c2d
.
createRadialGradient
(
x
,
y
,
0
,
x
,
y
,
r
);
data
[
2
].
forEach
(
function
(
data2
)
{
data
[
2
].
forEach
(
function
(
data2
)
{
const
offset
=
data2
[
0
];
const
offset
=
data2
[
0
];
...
@@ -1737,7 +1739,7 @@ function useMethods(canvasRef, actionsWaiting) {
...
@@ -1737,7 +1739,7 @@ function useMethods(canvasRef, actionsWaiting) {
LinearGradient
.
addColorStop
(
offset
,
color2
);
LinearGradient
.
addColorStop
(
offset
,
color2
);
});
});
color
=
LinearGradient
;
color
=
LinearGradient
;
}
else
if
(
data
[
0
]
===
"
pattern
"
)
{
}
else
if
(
actionType
===
"
pattern
"
)
{
const
loaded
=
checkImageLoaded
(
data
[
1
],
actions
.
slice
(
index2
+
1
),
resolve
,
function
(
image
)
{
const
loaded
=
checkImageLoaded
(
data
[
1
],
actions
.
slice
(
index2
+
1
),
resolve
,
function
(
image
)
{
if
(
image
)
{
if
(
image
)
{
c2d
[
method1
]
=
c2d
.
createPattern
(
image
,
data
[
2
]);
c2d
[
method1
]
=
c2d
.
createPattern
(
image
,
data
[
2
]);
...
@@ -1750,27 +1752,27 @@ function useMethods(canvasRef, actionsWaiting) {
...
@@ -1750,27 +1752,27 @@ function useMethods(canvasRef, actionsWaiting) {
}
}
c2d
[
method1
]
=
color
;
c2d
[
method1
]
=
color
;
}
else
if
(
method1
===
"
globalAlpha
"
)
{
}
else
if
(
method1
===
"
globalAlpha
"
)
{
c2d
[
method1
]
=
Number
(
data
[
0
]
)
/
255
;
c2d
[
method1
]
=
Number
(
actionType
)
/
255
;
}
else
if
(
method1
===
"
shadow
"
)
{
}
else
if
(
method1
===
"
shadow
"
)
{
var
_
=
[
"
shadowOffsetX
"
,
"
shadowOffsetY
"
,
"
shadowBlur
"
,
"
shadowColor
"
];
let
shadowArray
=
[
"
shadowOffsetX
"
,
"
shadowOffsetY
"
,
"
shadowBlur
"
,
"
shadowColor
"
];
data
.
forEach
(
function
(
color_
,
method_
)
{
data
.
forEach
(
function
(
color_
,
method_
)
{
c2d
[
_
[
method_
]]
=
_
[
method_
]
===
"
shadowColor
"
?
resolveColor
(
color_
)
:
color_
;
c2d
[
shadowArray
[
method_
]]
=
shadowArray
[
method_
]
===
"
shadowColor
"
?
resolveColor
(
color_
)
:
color_
;
});
});
}
else
if
(
method1
===
"
fontSize
"
)
{
}
else
if
(
method1
===
"
fontSize
"
)
{
const
font
=
c2d
.
__font__
||
c2d
.
font
;
const
font
=
c2d
.
__font__
||
c2d
.
font
;
c2d
.
__font__
=
c2d
.
font
=
font
.
replace
(
/
\d
+
\.?\d
*px/
,
data
[
0
]
+
"
px
"
);
c2d
.
__font__
=
c2d
.
font
=
font
.
replace
(
/
\d
+
\.?\d
*px/
,
actionType
+
"
px
"
);
}
else
if
(
method1
===
"
lineDash
"
)
{
}
else
if
(
method1
===
"
lineDash
"
)
{
c2d
.
setLineDash
(
data
[
0
]
);
c2d
.
setLineDash
(
actionType
);
c2d
.
lineDashOffset
=
data
[
1
]
||
0
;
c2d
.
lineDashOffset
=
data
[
1
]
||
0
;
}
else
if
(
method1
===
"
textBaseline
"
)
{
}
else
if
(
method1
===
"
textBaseline
"
)
{
if
(
data
[
0
]
===
"
normal
"
)
{
if
(
actionType
===
"
normal
"
)
{
data
[
0
]
=
"
alphabetic
"
;
data
[
0
]
=
"
alphabetic
"
;
}
}
c2d
[
method1
]
=
data
[
0
]
;
c2d
[
method1
]
=
actionType
;
}
else
if
(
method1
===
"
font
"
)
{
}
else
if
(
method1
===
"
font
"
)
{
c2d
.
__font__
=
c2d
.
font
=
data
[
0
]
;
c2d
.
__font__
=
c2d
.
font
=
actionType
;
}
else
{
}
else
{
c2d
[
method1
]
=
data
[
0
]
;
c2d
[
method1
]
=
actionType
;
}
}
}
else
if
(
method
===
"
fillPath
"
||
method
===
"
strokePath
"
)
{
}
else
if
(
method
===
"
fillPath
"
||
method
===
"
strokePath
"
)
{
method
=
method
.
replace
(
/Path/
,
""
);
method
=
method
.
replace
(
/Path/
,
""
);
...
@@ -1782,10 +1784,10 @@ function useMethods(canvasRef, actionsWaiting) {
...
@@ -1782,10 +1784,10 @@ function useMethods(canvasRef, actionsWaiting) {
}
else
if
(
method
===
"
fillText
"
)
{
}
else
if
(
method
===
"
fillText
"
)
{
c2d
.
fillText
.
apply
(
c2d
,
data
);
c2d
.
fillText
.
apply
(
c2d
,
data
);
}
else
if
(
method
===
"
drawImage
"
)
{
}
else
if
(
method
===
"
drawImage
"
)
{
var
A
=
function
()
{
let
drawImage
=
function
()
{
var
dataArray
=
[...
data
];
let
dataArray
=
[...
data
];
var
url
=
dataArray
[
0
];
let
url
=
dataArray
[
0
];
var
otherData
=
dataArray
.
slice
(
1
);
let
otherData
=
dataArray
.
slice
(
1
);
_images
=
_images
||
{};
_images
=
_images
||
{};
if
(
checkImageLoaded
(
url
,
actions
.
slice
(
index2
+
1
),
resolve
,
function
(
image
)
{
if
(
checkImageLoaded
(
url
,
actions
.
slice
(
index2
+
1
),
resolve
,
function
(
image
)
{
if
(
image
)
{
if
(
image
)
{
...
@@ -1794,7 +1796,7 @@ function useMethods(canvasRef, actionsWaiting) {
...
@@ -1794,7 +1796,7 @@ function useMethods(canvasRef, actionsWaiting) {
}))
}))
return
"
break
"
;
return
"
break
"
;
}();
}();
if
(
A
===
"
break
"
)
{
if
(
drawImage
===
"
break
"
)
{
break
;
break
;
}
}
}
else
{
}
else
{
...
@@ -1816,9 +1818,9 @@ function useMethods(canvasRef, actionsWaiting) {
...
@@ -1816,9 +1818,9 @@ function useMethods(canvasRef, actionsWaiting) {
}
}
function
preloadImage
(
actions
)
{
function
preloadImage
(
actions
)
{
actions
.
forEach
(
function
(
action
)
{
actions
.
forEach
(
function
(
action
)
{
var
method
=
action
.
method
;
let
method
=
action
.
method
;
var
data
=
action
.
data
;
let
data
=
action
.
data
;
var
src
=
""
;
let
src
=
""
;
if
(
method
===
"
drawImage
"
)
{
if
(
method
===
"
drawImage
"
)
{
src
=
data
[
0
];
src
=
data
[
0
];
src
=
$getRealPath
(
src
);
src
=
$getRealPath
(
src
);
...
@@ -1845,7 +1847,7 @@ function useMethods(canvasRef, actionsWaiting) {
...
@@ -1845,7 +1847,7 @@ function useMethods(canvasRef, actionsWaiting) {
});
});
}
}
function
checkImageLoaded
(
src
,
actions
,
resolve
,
fn
)
{
function
checkImageLoaded
(
src
,
actions
,
resolve
,
fn
)
{
var
image
=
_images
[
src
];
let
image
=
_images
[
src
];
if
(
image
.
ready
)
{
if
(
image
.
ready
)
{
fn
(
image
);
fn
(
image
);
return
true
;
return
true
;
...
@@ -1856,9 +1858,9 @@ function useMethods(canvasRef, actionsWaiting) {
...
@@ -1856,9 +1858,9 @@ function useMethods(canvasRef, actionsWaiting) {
image
.
ready
=
true
;
image
.
ready
=
true
;
fn
(
image
);
fn
(
image
);
actionsWaiting
.
value
=
false
;
actionsWaiting
.
value
=
false
;
var
actions2
=
_actionsDefer
.
slice
(
0
);
let
actions2
=
_actionsDefer
.
slice
(
0
);
_actionsDefer
=
[];
_actionsDefer
=
[];
for
(
var
action
=
actions2
.
shift
();
action
;
)
{
for
(
let
action
=
actions2
.
shift
();
action
;
)
{
actionsChanged
({
actionsChanged
({
actions
:
action
[
0
],
actions
:
action
[
0
],
reserve
:
action
[
1
]
reserve
:
action
[
1
]
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
4678dfc2
...
@@ -3258,8 +3258,9 @@ class CanvasGradient {
...
@@ -3258,8 +3258,9 @@ class CanvasGradient {
}
}
class Pattern {
class Pattern {
constructor(image2, repetition) {
constructor(image2, repetition) {
this.image = image2;
this.type = "pattern";
this.repetition = repetition;
this.data = image2;
this.colorStop = repetition;
}
}
}
}
class TextMetrics {
class TextMetrics {
...
@@ -6179,10 +6180,10 @@ function useMethods(canvasRef, actionsWaiting) {
...
@@ -6179,10 +6180,10 @@ function useMethods(canvasRef, actionsWaiting) {
let _actionsDefer = [];
let _actionsDefer = [];
let _images = {};
let _images = {};
function _resize() {
function _resize() {
var
canvas = canvasRef.value;
let
canvas = canvasRef.value;
if (canvas.width > 0 && canvas.height > 0) {
if (canvas.width > 0 && canvas.height > 0) {
var
context = canvas.getContext("2d");
let
context = canvas.getContext("2d");
var
imageData = context.getImageData(0, 0, canvas.width, canvas.height);
let
imageData = context.getImageData(0, 0, canvas.width, canvas.height);
wrapper(canvas);
wrapper(canvas);
context.putImageData(imageData, 0, 0);
context.putImageData(imageData, 0, 0);
} else {
} else {
...
@@ -6200,8 +6201,8 @@ function useMethods(canvasRef, actionsWaiting) {
...
@@ -6200,8 +6201,8 @@ function useMethods(canvasRef, actionsWaiting) {
_actionsDefer.push([actions, reserve]);
_actionsDefer.push([actions, reserve]);
return;
return;
}
}
var
canvas = canvasRef.value;
let
canvas = canvasRef.value;
var
c2d = canvas.getContext("2d");
let
c2d = canvas.getContext("2d");
if (!reserve) {
if (!reserve) {
c2d.fillStyle = "#000000";
c2d.fillStyle = "#000000";
c2d.strokeStyle = "#000000";
c2d.strokeStyle = "#000000";
...
@@ -6217,13 +6218,14 @@ function useMethods(canvasRef, actionsWaiting) {
...
@@ -6217,13 +6218,14 @@ function useMethods(canvasRef, actionsWaiting) {
const action = actions[index2];
const action = actions[index2];
let method = action.method;
let method = action.method;
const data = action.data;
const data = action.data;
const actionType = data[0];
if (/^set/.test(method) && method !== "setTransform") {
if (/^set/.test(method) && method !== "setTransform") {
const method1 = method[3].toLowerCase() + method.slice(4);
const method1 = method[3].toLowerCase() + method.slice(4);
let color;
let color;
if (method1 === "fillStyle" || method1 === "strokeStyle") {
if (method1 === "fillStyle" || method1 === "strokeStyle") {
if (
data[0]
=== "normal") {
if (
actionType
=== "normal") {
color = resolveColor(data[1]);
color = resolveColor(data[1]);
} else if (
data[0]
=== "linear") {
} else if (
actionType
=== "linear") {
const LinearGradient = c2d.createLinearGradient(...data[1]);
const LinearGradient = c2d.createLinearGradient(...data[1]);
data[2].forEach(function(data2) {
data[2].forEach(function(data2) {
const offset = data2[0];
const offset = data2[0];
...
@@ -6231,10 +6233,11 @@ function useMethods(canvasRef, actionsWaiting) {
...
@@ -6231,10 +6233,11 @@ function useMethods(canvasRef, actionsWaiting) {
LinearGradient.addColorStop(offset, color2);
LinearGradient.addColorStop(offset, color2);
});
});
color = LinearGradient;
color = LinearGradient;
} else if (data[0] === "radial") {
} else if (actionType === "radial") {
const x = data[1][0];
let _data = data[1];
const y = data[1][1];
const x = _data[0];
const r = data[1][2];
const y = _data[1];
const r = _data[2];
const LinearGradient = c2d.createRadialGradient(x, y, 0, x, y, r);
const LinearGradient = c2d.createRadialGradient(x, y, 0, x, y, r);
data[2].forEach(function(data2) {
data[2].forEach(function(data2) {
const offset = data2[0];
const offset = data2[0];
...
@@ -6242,7 +6245,7 @@ function useMethods(canvasRef, actionsWaiting) {
...
@@ -6242,7 +6245,7 @@ function useMethods(canvasRef, actionsWaiting) {
LinearGradient.addColorStop(offset, color2);
LinearGradient.addColorStop(offset, color2);
});
});
color = LinearGradient;
color = LinearGradient;
} else if (
data[0]
=== "pattern") {
} else if (
actionType
=== "pattern") {
const loaded = checkImageLoaded(data[1], actions.slice(index2 + 1), resolve, function(image2) {
const loaded = checkImageLoaded(data[1], actions.slice(index2 + 1), resolve, function(image2) {
if (image2) {
if (image2) {
c2d[method1] = c2d.createPattern(image2, data[2]);
c2d[method1] = c2d.createPattern(image2, data[2]);
...
@@ -6255,27 +6258,27 @@ function useMethods(canvasRef, actionsWaiting) {
...
@@ -6255,27 +6258,27 @@ function useMethods(canvasRef, actionsWaiting) {
}
}
c2d[method1] = color;
c2d[method1] = color;
} else if (method1 === "globalAlpha") {
} else if (method1 === "globalAlpha") {
c2d[method1] = Number(
data[0]
) / 255;
c2d[method1] = Number(
actionType
) / 255;
} else if (method1 === "shadow") {
} else if (method1 === "shadow") {
var _
= ["shadowOffsetX", "shadowOffsetY", "shadowBlur", "shadowColor"];
let shadowArray
= ["shadowOffsetX", "shadowOffsetY", "shadowBlur", "shadowColor"];
data.forEach(function(color_, method_) {
data.forEach(function(color_, method_) {
c2d[
_[method_]] = _
[method_] === "shadowColor" ? resolveColor(color_) : color_;
c2d[
shadowArray[method_]] = shadowArray
[method_] === "shadowColor" ? resolveColor(color_) : color_;
});
});
} else if (method1 === "fontSize") {
} else if (method1 === "fontSize") {
const font2 = c2d.__font__ || c2d.font;
const font2 = c2d.__font__ || c2d.font;
c2d.__font__ = c2d.font = font2.replace(/\d+\.?\d*px/,
data[0]
+ "px");
c2d.__font__ = c2d.font = font2.replace(/\d+\.?\d*px/,
actionType
+ "px");
} else if (method1 === "lineDash") {
} else if (method1 === "lineDash") {
c2d.setLineDash(
data[0]
);
c2d.setLineDash(
actionType
);
c2d.lineDashOffset = data[1] || 0;
c2d.lineDashOffset = data[1] || 0;
} else if (method1 === "textBaseline") {
} else if (method1 === "textBaseline") {
if (
data[0]
=== "normal") {
if (
actionType
=== "normal") {
data[0] = "alphabetic";
data[0] = "alphabetic";
}
}
c2d[method1] =
data[0]
;
c2d[method1] =
actionType
;
} else if (method1 === "font") {
} else if (method1 === "font") {
c2d.__font__ = c2d.font =
data[0]
;
c2d.__font__ = c2d.font =
actionType
;
} else {
} else {
c2d[method1] =
data[0]
;
c2d[method1] =
actionType
;
}
}
} else if (method === "fillPath" || method === "strokePath") {
} else if (method === "fillPath" || method === "strokePath") {
method = method.replace(/Path/, "");
method = method.replace(/Path/, "");
...
@@ -6287,10 +6290,10 @@ function useMethods(canvasRef, actionsWaiting) {
...
@@ -6287,10 +6290,10 @@ function useMethods(canvasRef, actionsWaiting) {
} else if (method === "fillText") {
} else if (method === "fillText") {
c2d.fillText.apply(c2d, data);
c2d.fillText.apply(c2d, data);
} else if (method === "drawImage") {
} else if (method === "drawImage") {
var A
= function() {
let drawImage
= function() {
var
dataArray = [...data];
let
dataArray = [...data];
var
url = dataArray[0];
let
url = dataArray[0];
var
otherData = dataArray.slice(1);
let
otherData = dataArray.slice(1);
_images = _images || {};
_images = _images || {};
if (checkImageLoaded(url, actions.slice(index2 + 1), resolve, function(image2) {
if (checkImageLoaded(url, actions.slice(index2 + 1), resolve, function(image2) {
if (image2) {
if (image2) {
...
@@ -6299,7 +6302,7 @@ function useMethods(canvasRef, actionsWaiting) {
...
@@ -6299,7 +6302,7 @@ function useMethods(canvasRef, actionsWaiting) {
}))
}))
return "break";
return "break";
}();
}();
if (
A
=== "break") {
if (
drawImage
=== "break") {
break;
break;
}
}
} else {
} else {
...
@@ -6321,9 +6324,9 @@ function useMethods(canvasRef, actionsWaiting) {
...
@@ -6321,9 +6324,9 @@ function useMethods(canvasRef, actionsWaiting) {
}
}
function preloadImage(actions) {
function preloadImage(actions) {
actions.forEach(function(action) {
actions.forEach(function(action) {
var
method = action.method;
let
method = action.method;
var
data = action.data;
let
data = action.data;
var
src = "";
let
src = "";
if (method === "drawImage") {
if (method === "drawImage") {
src = data[0];
src = data[0];
src = $getRealPath(src);
src = $getRealPath(src);
...
@@ -6350,7 +6353,7 @@ function useMethods(canvasRef, actionsWaiting) {
...
@@ -6350,7 +6353,7 @@ function useMethods(canvasRef, actionsWaiting) {
});
});
}
}
function checkImageLoaded(src, actions, resolve, fn) {
function checkImageLoaded(src, actions, resolve, fn) {
var
image2 = _images[src];
let
image2 = _images[src];
if (image2.ready) {
if (image2.ready) {
fn(image2);
fn(image2);
return true;
return true;
...
@@ -6361,9 +6364,9 @@ function useMethods(canvasRef, actionsWaiting) {
...
@@ -6361,9 +6364,9 @@ function useMethods(canvasRef, actionsWaiting) {
image2.ready = true;
image2.ready = true;
fn(image2);
fn(image2);
actionsWaiting.value = false;
actionsWaiting.value = false;
var
actions2 = _actionsDefer.slice(0);
let
actions2 = _actionsDefer.slice(0);
_actionsDefer = [];
_actionsDefer = [];
for (
var
action = actions2.shift(); action; ) {
for (
let
action = actions2.shift(); action; ) {
actionsChanged({
actionsChanged({
actions: action[0],
actions: action[0],
reserve: action[1]
reserve: action[1]
...
@@ -16132,12 +16135,10 @@ function useKeyboard() {
...
@@ -16132,12 +16135,10 @@ function useKeyboard() {
}
}
const VNODE_MASK = /* @__PURE__ */ createVNode("div", { class: "uni-mask" }, null, -1);
const VNODE_MASK = /* @__PURE__ */ createVNode("div", { class: "uni-mask" }, null, -1);
function createRootApp(component, rootState, callback) {
function createRootApp(component, rootState, callback) {
const
onClose = (...args) => (rootState.visible = false, callback.apply(null, args));
rootState.
onClose = (...args) => (rootState.visible = false, callback.apply(null, args));
return createApp(defineComponent({
return createApp(defineComponent({
setup() {
setup() {
return () => (openBlock(), createBlock(component, mergeProps({
return () => (openBlock(), createBlock(component, rootState, null, 16));
onClose
}, rootState)));
}
}
}));
}));
}
}
...
...
packages/vite-plugin-uni/src/configResolved/plugins/easycom.ts
浏览文件 @
4678dfc2
...
@@ -118,7 +118,10 @@ export function uniEasycomPlugin(
...
@@ -118,7 +118,10 @@ export function uniEasycomPlugin(
if
(
importDeclarations
.
length
)
{
if
(
importDeclarations
.
length
)
{
code
=
importDeclarations
.
join
(
''
)
+
code
code
=
importDeclarations
.
join
(
''
)
+
code
}
}
return
code
return
{
code
,
map
:
this
.
getCombinedSourcemap
(),
}
},
},
}
}
}
}
...
...
packages/vite-plugin-uni/src/configResolved/plugins/json.ts
浏览文件 @
4678dfc2
...
@@ -20,7 +20,10 @@ export function uniJsonPlugin(options: VitePluginUniResolvedOptions): Plugin {
...
@@ -20,7 +20,10 @@ export function uniJsonPlugin(options: VitePluginUniResolvedOptions): Plugin {
)
{
)
{
code
=
JSON
.
stringify
(
parse
(
code
))
code
=
JSON
.
stringify
(
parse
(
code
))
}
}
return
code
return
{
code
,
map
:
this
.
getCombinedSourcemap
(),
}
},
},
}
}
}
}
packages/vite-plugin-uni/src/configResolved/plugins/pre.ts
浏览文件 @
4678dfc2
...
@@ -23,11 +23,11 @@ export function uniPrePlugin(options: UniPluginFilterOptions): Plugin {
...
@@ -23,11 +23,11 @@ export function uniPrePlugin(options: UniPluginFilterOptions): Plugin {
name
:
'
vite:uni-pre
'
,
name
:
'
vite:uni-pre
'
,
transform
(
code
,
id
)
{
transform
(
code
,
id
)
{
if
(
!
filter
(
id
))
{
if
(
!
filter
(
id
))
{
return
code
return
}
}
const
{
filename
,
query
}
=
parseVueRequest
(
id
)
const
{
filename
,
query
}
=
parseVueRequest
(
id
)
if
(
query
.
vue
&&
query
.
type
!==
'
template
'
)
{
if
(
query
.
vue
&&
query
.
type
!==
'
template
'
)
{
return
code
return
}
}
const
extname
=
path
.
extname
(
filename
)
const
extname
=
path
.
extname
(
filename
)
const
isHtml
=
const
isHtml
=
...
...
packages/vite-plugin-uni/src/configResolved/plugins/preCss.ts
浏览文件 @
4678dfc2
...
@@ -22,14 +22,17 @@ export function uniPreCssPlugin(options: UniPluginFilterOptions): Plugin {
...
@@ -22,14 +22,17 @@ export function uniPreCssPlugin(options: UniPluginFilterOptions): Plugin {
return
return
}
}
if
(
!
filter
(
id
))
{
if
(
!
filter
(
id
))
{
return
code
return
}
}
debugPreTry
(
id
)
debugPreTry
(
id
)
if
(
!
code
.
includes
(
'
#endif
'
))
{
if
(
!
code
.
includes
(
'
#endif
'
))
{
return
return
}
}
debugPre
(
id
)
debugPre
(
id
)
return
preJs
(
code
)
return
{
code
:
preJs
(
code
),
map
:
this
.
getCombinedSourcemap
(),
}
},
},
}
}
}
}
packages/vite-plugin-uni/src/configResolved/plugins/preVue.ts
浏览文件 @
4678dfc2
...
@@ -39,7 +39,10 @@ export function uniPreVuePlugin(): Plugin {
...
@@ -39,7 +39,10 @@ export function uniPreVuePlugin(): Plugin {
const
cache
=
sourceToSFC
.
get
(
sourceKey
)
const
cache
=
sourceToSFC
.
get
(
sourceKey
)
if
(
cache
)
{
if
(
cache
)
{
debugPreVue
(
'
cache
'
,
id
)
debugPreVue
(
'
cache
'
,
id
)
return
cache
return
{
code
:
cache
,
map
:
null
,
}
}
}
const
hasBlock
=
BLOCK_RE
.
test
(
code
)
const
hasBlock
=
BLOCK_RE
.
test
(
code
)
const
hasWxs
=
WXS_LANG_RE
.
test
(
code
)
const
hasWxs
=
WXS_LANG_RE
.
test
(
code
)
...
@@ -59,7 +62,10 @@ export function uniPreVuePlugin(): Plugin {
...
@@ -59,7 +62,10 @@ export function uniPreVuePlugin(): Plugin {
// this.error(errors.join('\n'))
// this.error(errors.join('\n'))
// }
// }
sourceToSFC
.
set
(
sourceKey
,
code
)
sourceToSFC
.
set
(
sourceKey
,
code
)
return
code
// 暂不提供sourcemap,意义不大
return
{
code
,
// 暂不提供sourcemap,意义不大
map
:
null
,
}
},
},
}
}
}
}
...
...
packages/vite-plugin-uni/src/configResolved/plugins/renderjs.ts
浏览文件 @
4678dfc2
...
@@ -26,11 +26,14 @@ ${code}
...
@@ -26,11 +26,14 @@ ${code}
</script>`
</script>`
)
)
}
}
return
`
${
rewriteDefault
(
return
{
code
.
replace
(
/module
\.
exports
\s
*=/
,
'
export default
'
),
code
:
`
${
rewriteDefault
(
'
_sfc_
'
+
type
code
.
replace
(
/module
\.
exports
\s
*=/
,
'
export default
'
),
)}
'
_sfc_
'
+
type
${
type
===
'
renderjs
'
?
genRenderjsCode
(
name
)
:
genWxsCode
(
name
)}
`
)}
${
type
===
'
renderjs
'
?
genRenderjsCode
(
name
)
:
genWxsCode
(
name
)}
`
,
map
:
null
,
}
},
},
}
}
}
}
...
...
packages/vite-plugin-uni/src/configResolved/plugins/ssr.ts
浏览文件 @
4678dfc2
...
@@ -25,7 +25,7 @@ export function uniSSRPlugin(
...
@@ -25,7 +25,7 @@ export function uniSSRPlugin(
transform
(
code
,
id
)
{
transform
(
code
,
id
)
{
if
(
!
filter
(
id
))
return
null
if
(
!
filter
(
id
))
return
null
if
(
!
KEYED_FUNC_RE
.
test
(
code
))
{
if
(
!
KEYED_FUNC_RE
.
test
(
code
))
{
return
code
return
}
}
debugSSR
(
'
try
'
,
id
)
debugSSR
(
'
try
'
,
id
)
const
ast
=
this
.
parse
(
code
)
const
ast
=
this
.
parse
(
code
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录