Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qianlong66
uni-app
提交
4678dfc2
U
uni-app
项目概览
qianlong66
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-app
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
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) {
}
class Pattern {
constructor(image, repetition) {
this.image = image;
this.repetition = repetition;
this.type = 'pattern';
this.data = image;
this.colorStop = repetition;
}
}
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'] {
emptyDir
(
process
.
env
.
UNI_OUTPUT_DIR
)
}
return
{
// sourcemap: 'inline',
emptyOutDir
:
false
,
// 不清空输出目录,否则会影响 webpack 的输出
assetsInlineLimit
:
0
,
rollupOptions
:
{
...
...
packages/uni-app-vite/src/plugins/manifestJson.ts
浏览文件 @
4678dfc2
...
...
@@ -28,7 +28,10 @@ export function uniManifestJsonPlugin(): Plugin {
process
.
env
.
UNI_PLATFORM
)
)
return
''
return
{
code
:
''
,
map
:
this
.
getCombinedSourcemap
(),
}
},
generateBundle
()
{
// 生成一个空的app-config.js,兼容基座已有规范
...
...
packages/uni-app-vite/src/plugins/pagesJson.ts
浏览文件 @
4678dfc2
...
...
@@ -27,9 +27,11 @@ export function uniPagesJsonPlugin(): Plugin {
path
.
resolve
(
process
.
env
.
UNI_INPUT_DIR
,
page
.
path
+
'
.vue
'
)
)
})
return
(
`import './manifest.json.js'\n`
+
normalizeAppPagesJson
(
pagesJson
)
)
return
{
code
:
`import './manifest.json.js'\n`
+
normalizeAppPagesJson
(
pagesJson
),
map
:
this
.
getCombinedSourcemap
(),
}
},
generateBundle
()
{
this
.
emitFile
({
...
...
packages/uni-app-vite/src/plugins/renderjs.ts
浏览文件 @
4678dfc2
...
...
@@ -68,10 +68,13 @@ export function uniRenderjsPlugin(): Plugin {
}
changed
=
true
debugRenderjs
(
type
,
modulePath
,
moduleHashId
)
return
`export default Comp => {
;(Comp.$
${
type
}
|| (Comp.$
${
type
}
= [])).push('
${
name
}
')
;(Comp.$
${
globalName
}
|| (Comp.$
${
globalName
}
= {}))['
${
name
}
'] = '
${
moduleHashId
}
'
}`
return
{
code
:
`export default Comp => {
;(Comp.$
${
type
}
|| (Comp.$
${
type
}
= [])).push('
${
name
}
')
;(Comp.$
${
globalName
}
|| (Comp.$
${
globalName
}
= {}))['
${
name
}
'] = '
${
moduleHashId
}
'
}`
,
map
:
null
,
}
},
generateBundle
()
{
if
(
!
changed
)
{
...
...
packages/uni-cli-shared/src/vite/plugins/cssScoped.ts
浏览文件 @
4678dfc2
...
...
@@ -31,13 +31,13 @@ export function uniCssScopedPlugin(
enforce
:
'
pre
'
,
transform
(
code
,
id
)
{
if
(
id
.
endsWith
(
'
App.vue
'
))
{
return
code
return
}
if
(
!
filter
(
id
))
return
null
const
{
filename
,
query
}
=
parseVueRequest
(
id
)
if
(
query
.
vue
)
{
return
code
return
}
if
(
EXTNAME_VUE
.
includes
(
path
.
extname
(
filename
)))
{
debugScoped
(
id
)
...
...
packages/uni-h5/dist/uni-h5.cjs.js
浏览文件 @
4678dfc2
...
...
@@ -1674,10 +1674,10 @@ function useMethods(canvasRef, actionsWaiting) {
let
_actionsDefer
=
[];
let
_images
=
{};
function
_resize
()
{
var
canvas
=
canvasRef
.
value
;
let
canvas
=
canvasRef
.
value
;
if
(
canvas
.
width
>
0
&&
canvas
.
height
>
0
)
{
var
context
=
canvas
.
getContext
(
"
2d
"
);
var
imageData
=
context
.
getImageData
(
0
,
0
,
canvas
.
width
,
canvas
.
height
);
let
context
=
canvas
.
getContext
(
"
2d
"
);
let
imageData
=
context
.
getImageData
(
0
,
0
,
canvas
.
width
,
canvas
.
height
);
wrapper
(
canvas
);
context
.
putImageData
(
imageData
,
0
,
0
);
}
else
{
...
...
@@ -1695,8 +1695,8 @@ function useMethods(canvasRef, actionsWaiting) {
_actionsDefer
.
push
([
actions
,
reserve
]);
return
;
}
var
canvas
=
canvasRef
.
value
;
var
c2d
=
canvas
.
getContext
(
"
2d
"
);
let
canvas
=
canvasRef
.
value
;
let
c2d
=
canvas
.
getContext
(
"
2d
"
);
if
(
!
reserve
)
{
c2d
.
fillStyle
=
"
#000000
"
;
c2d
.
strokeStyle
=
"
#000000
"
;
...
...
@@ -1712,13 +1712,14 @@ function useMethods(canvasRef, actionsWaiting) {
const
action
=
actions
[
index2
];
let
method
=
action
.
method
;
const
data
=
action
.
data
;
const
actionType
=
data
[
0
];
if
(
/^set/
.
test
(
method
)
&&
method
!==
"
setTransform
"
)
{
const
method1
=
method
[
3
].
toLowerCase
()
+
method
.
slice
(
4
);
let
color
;
if
(
method1
===
"
fillStyle
"
||
method1
===
"
strokeStyle
"
)
{
if
(
data
[
0
]
===
"
normal
"
)
{
if
(
actionType
===
"
normal
"
)
{
color
=
resolveColor
(
data
[
1
]);
}
else
if
(
data
[
0
]
===
"
linear
"
)
{
}
else
if
(
actionType
===
"
linear
"
)
{
const
LinearGradient
=
c2d
.
createLinearGradient
(...
data
[
1
]);
data
[
2
].
forEach
(
function
(
data2
)
{
const
offset
=
data2
[
0
];
...
...
@@ -1726,10 +1727,11 @@ function useMethods(canvasRef, actionsWaiting) {
LinearGradient
.
addColorStop
(
offset
,
color2
);
});
color
=
LinearGradient
;
}
else
if
(
data
[
0
]
===
"
radial
"
)
{
const
x
=
data
[
1
][
0
];
const
y
=
data
[
1
][
1
];
const
r
=
data
[
1
][
2
];
}
else
if
(
actionType
===
"
radial
"
)
{
let
_data
=
data
[
1
];
const
x
=
_data
[
0
];
const
y
=
_data
[
1
];
const
r
=
_data
[
2
];
const
LinearGradient
=
c2d
.
createRadialGradient
(
x
,
y
,
0
,
x
,
y
,
r
);
data
[
2
].
forEach
(
function
(
data2
)
{
const
offset
=
data2
[
0
];
...
...
@@ -1737,7 +1739,7 @@ function useMethods(canvasRef, actionsWaiting) {
LinearGradient
.
addColorStop
(
offset
,
color2
);
});
color
=
LinearGradient
;
}
else
if
(
data
[
0
]
===
"
pattern
"
)
{
}
else
if
(
actionType
===
"
pattern
"
)
{
const
loaded
=
checkImageLoaded
(
data
[
1
],
actions
.
slice
(
index2
+
1
),
resolve
,
function
(
image
)
{
if
(
image
)
{
c2d
[
method1
]
=
c2d
.
createPattern
(
image
,
data
[
2
]);
...
...
@@ -1750,27 +1752,27 @@ function useMethods(canvasRef, actionsWaiting) {
}
c2d
[
method1
]
=
color
;
}
else
if
(
method1
===
"
globalAlpha
"
)
{
c2d
[
method1
]
=
Number
(
data
[
0
]
)
/
255
;
c2d
[
method1
]
=
Number
(
actionType
)
/
255
;
}
else
if
(
method1
===
"
shadow
"
)
{
var
_
=
[
"
shadowOffsetX
"
,
"
shadowOffsetY
"
,
"
shadowBlur
"
,
"
shadowColor
"
];
let
shadowArray
=
[
"
shadowOffsetX
"
,
"
shadowOffsetY
"
,
"
shadowBlur
"
,
"
shadowColor
"
];
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
"
)
{
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
"
)
{
c2d
.
setLineDash
(
data
[
0
]
);
c2d
.
setLineDash
(
actionType
);
c2d
.
lineDashOffset
=
data
[
1
]
||
0
;
}
else
if
(
method1
===
"
textBaseline
"
)
{
if
(
data
[
0
]
===
"
normal
"
)
{
if
(
actionType
===
"
normal
"
)
{
data
[
0
]
=
"
alphabetic
"
;
}
c2d
[
method1
]
=
data
[
0
]
;
c2d
[
method1
]
=
actionType
;
}
else
if
(
method1
===
"
font
"
)
{
c2d
.
__font__
=
c2d
.
font
=
data
[
0
]
;
c2d
.
__font__
=
c2d
.
font
=
actionType
;
}
else
{
c2d
[
method1
]
=
data
[
0
]
;
c2d
[
method1
]
=
actionType
;
}
}
else
if
(
method
===
"
fillPath
"
||
method
===
"
strokePath
"
)
{
method
=
method
.
replace
(
/Path/
,
""
);
...
...
@@ -1782,10 +1784,10 @@ function useMethods(canvasRef, actionsWaiting) {
}
else
if
(
method
===
"
fillText
"
)
{
c2d
.
fillText
.
apply
(
c2d
,
data
);
}
else
if
(
method
===
"
drawImage
"
)
{
var
A
=
function
()
{
var
dataArray
=
[...
data
];
var
url
=
dataArray
[
0
];
var
otherData
=
dataArray
.
slice
(
1
);
let
drawImage
=
function
()
{
let
dataArray
=
[...
data
];
let
url
=
dataArray
[
0
];
let
otherData
=
dataArray
.
slice
(
1
);
_images
=
_images
||
{};
if
(
checkImageLoaded
(
url
,
actions
.
slice
(
index2
+
1
),
resolve
,
function
(
image
)
{
if
(
image
)
{
...
...
@@ -1794,7 +1796,7 @@ function useMethods(canvasRef, actionsWaiting) {
}))
return
"
break
"
;
}();
if
(
A
===
"
break
"
)
{
if
(
drawImage
===
"
break
"
)
{
break
;
}
}
else
{
...
...
@@ -1816,9 +1818,9 @@ function useMethods(canvasRef, actionsWaiting) {
}
function
preloadImage
(
actions
)
{
actions
.
forEach
(
function
(
action
)
{
var
method
=
action
.
method
;
var
data
=
action
.
data
;
var
src
=
""
;
let
method
=
action
.
method
;
let
data
=
action
.
data
;
let
src
=
""
;
if
(
method
===
"
drawImage
"
)
{
src
=
data
[
0
];
src
=
$getRealPath
(
src
);
...
...
@@ -1845,7 +1847,7 @@ function useMethods(canvasRef, actionsWaiting) {
});
}
function
checkImageLoaded
(
src
,
actions
,
resolve
,
fn
)
{
var
image
=
_images
[
src
];
let
image
=
_images
[
src
];
if
(
image
.
ready
)
{
fn
(
image
);
return
true
;
...
...
@@ -1856,9 +1858,9 @@ function useMethods(canvasRef, actionsWaiting) {
image
.
ready
=
true
;
fn
(
image
);
actionsWaiting
.
value
=
false
;
var
actions2
=
_actionsDefer
.
slice
(
0
);
let
actions2
=
_actionsDefer
.
slice
(
0
);
_actionsDefer
=
[];
for
(
var
action
=
actions2
.
shift
();
action
;
)
{
for
(
let
action
=
actions2
.
shift
();
action
;
)
{
actionsChanged
({
actions
:
action
[
0
],
reserve
:
action
[
1
]
...
...
packages/uni-h5/dist/uni-h5.es.js
浏览文件 @
4678dfc2
...
...
@@ -3258,8 +3258,9 @@ class CanvasGradient {
}
class Pattern {
constructor(image2, repetition) {
this.image = image2;
this.repetition = repetition;
this.type = "pattern";
this.data = image2;
this.colorStop = repetition;
}
}
class TextMetrics {
...
...
@@ -6179,10 +6180,10 @@ function useMethods(canvasRef, actionsWaiting) {
let _actionsDefer = [];
let _images = {};
function _resize() {
var
canvas = canvasRef.value;
let
canvas = canvasRef.value;
if (canvas.width > 0 && canvas.height > 0) {
var
context = canvas.getContext("2d");
var
imageData = context.getImageData(0, 0, canvas.width, canvas.height);
let
context = canvas.getContext("2d");
let
imageData = context.getImageData(0, 0, canvas.width, canvas.height);
wrapper(canvas);
context.putImageData(imageData, 0, 0);
} else {
...
...
@@ -6200,8 +6201,8 @@ function useMethods(canvasRef, actionsWaiting) {
_actionsDefer.push([actions, reserve]);
return;
}
var
canvas = canvasRef.value;
var
c2d = canvas.getContext("2d");
let
canvas = canvasRef.value;
let
c2d = canvas.getContext("2d");
if (!reserve) {
c2d.fillStyle = "#000000";
c2d.strokeStyle = "#000000";
...
...
@@ -6217,13 +6218,14 @@ function useMethods(canvasRef, actionsWaiting) {
const action = actions[index2];
let method = action.method;
const data = action.data;
const actionType = data[0];
if (/^set/.test(method) && method !== "setTransform") {
const method1 = method[3].toLowerCase() + method.slice(4);
let color;
if (method1 === "fillStyle" || method1 === "strokeStyle") {
if (
data[0]
=== "normal") {
if (
actionType
=== "normal") {
color = resolveColor(data[1]);
} else if (
data[0]
=== "linear") {
} else if (
actionType
=== "linear") {
const LinearGradient = c2d.createLinearGradient(...data[1]);
data[2].forEach(function(data2) {
const offset = data2[0];
...
...
@@ -6231,10 +6233,11 @@ function useMethods(canvasRef, actionsWaiting) {
LinearGradient.addColorStop(offset, color2);
});
color = LinearGradient;
} else if (data[0] === "radial") {
const x = data[1][0];
const y = data[1][1];
const r = data[1][2];
} else if (actionType === "radial") {
let _data = data[1];
const x = _data[0];
const y = _data[1];
const r = _data[2];
const LinearGradient = c2d.createRadialGradient(x, y, 0, x, y, r);
data[2].forEach(function(data2) {
const offset = data2[0];
...
...
@@ -6242,7 +6245,7 @@ function useMethods(canvasRef, actionsWaiting) {
LinearGradient.addColorStop(offset, color2);
});
color = LinearGradient;
} else if (
data[0]
=== "pattern") {
} else if (
actionType
=== "pattern") {
const loaded = checkImageLoaded(data[1], actions.slice(index2 + 1), resolve, function(image2) {
if (image2) {
c2d[method1] = c2d.createPattern(image2, data[2]);
...
...
@@ -6255,27 +6258,27 @@ function useMethods(canvasRef, actionsWaiting) {
}
c2d[method1] = color;
} else if (method1 === "globalAlpha") {
c2d[method1] = Number(
data[0]
) / 255;
c2d[method1] = Number(
actionType
) / 255;
} else if (method1 === "shadow") {
var _
= ["shadowOffsetX", "shadowOffsetY", "shadowBlur", "shadowColor"];
let shadowArray
= ["shadowOffsetX", "shadowOffsetY", "shadowBlur", "shadowColor"];
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") {
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") {
c2d.setLineDash(
data[0]
);
c2d.setLineDash(
actionType
);
c2d.lineDashOffset = data[1] || 0;
} else if (method1 === "textBaseline") {
if (
data[0]
=== "normal") {
if (
actionType
=== "normal") {
data[0] = "alphabetic";
}
c2d[method1] =
data[0]
;
c2d[method1] =
actionType
;
} else if (method1 === "font") {
c2d.__font__ = c2d.font =
data[0]
;
c2d.__font__ = c2d.font =
actionType
;
} else {
c2d[method1] =
data[0]
;
c2d[method1] =
actionType
;
}
} else if (method === "fillPath" || method === "strokePath") {
method = method.replace(/Path/, "");
...
...
@@ -6287,10 +6290,10 @@ function useMethods(canvasRef, actionsWaiting) {
} else if (method === "fillText") {
c2d.fillText.apply(c2d, data);
} else if (method === "drawImage") {
var A
= function() {
var
dataArray = [...data];
var
url = dataArray[0];
var
otherData = dataArray.slice(1);
let drawImage
= function() {
let
dataArray = [...data];
let
url = dataArray[0];
let
otherData = dataArray.slice(1);
_images = _images || {};
if (checkImageLoaded(url, actions.slice(index2 + 1), resolve, function(image2) {
if (image2) {
...
...
@@ -6299,7 +6302,7 @@ function useMethods(canvasRef, actionsWaiting) {
}))
return "break";
}();
if (
A
=== "break") {
if (
drawImage
=== "break") {
break;
}
} else {
...
...
@@ -6321,9 +6324,9 @@ function useMethods(canvasRef, actionsWaiting) {
}
function preloadImage(actions) {
actions.forEach(function(action) {
var
method = action.method;
var
data = action.data;
var
src = "";
let
method = action.method;
let
data = action.data;
let
src = "";
if (method === "drawImage") {
src = data[0];
src = $getRealPath(src);
...
...
@@ -6350,7 +6353,7 @@ function useMethods(canvasRef, actionsWaiting) {
});
}
function checkImageLoaded(src, actions, resolve, fn) {
var
image2 = _images[src];
let
image2 = _images[src];
if (image2.ready) {
fn(image2);
return true;
...
...
@@ -6361,9 +6364,9 @@ function useMethods(canvasRef, actionsWaiting) {
image2.ready = true;
fn(image2);
actionsWaiting.value = false;
var
actions2 = _actionsDefer.slice(0);
let
actions2 = _actionsDefer.slice(0);
_actionsDefer = [];
for (
var
action = actions2.shift(); action; ) {
for (
let
action = actions2.shift(); action; ) {
actionsChanged({
actions: action[0],
reserve: action[1]
...
...
@@ -16132,12 +16135,10 @@ function useKeyboard() {
}
const VNODE_MASK = /* @__PURE__ */ createVNode("div", { class: "uni-mask" }, null, -1);
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({
setup() {
return () => (openBlock(), createBlock(component, mergeProps({
onClose
}, rootState)));
return () => (openBlock(), createBlock(component, rootState, null, 16));
}
}));
}
...
...
packages/vite-plugin-uni/src/configResolved/plugins/easycom.ts
浏览文件 @
4678dfc2
...
...
@@ -118,7 +118,10 @@ export function uniEasycomPlugin(
if
(
importDeclarations
.
length
)
{
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 {
)
{
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 {
name
:
'
vite:uni-pre
'
,
transform
(
code
,
id
)
{
if
(
!
filter
(
id
))
{
return
code
return
}
const
{
filename
,
query
}
=
parseVueRequest
(
id
)
if
(
query
.
vue
&&
query
.
type
!==
'
template
'
)
{
return
code
return
}
const
extname
=
path
.
extname
(
filename
)
const
isHtml
=
...
...
packages/vite-plugin-uni/src/configResolved/plugins/preCss.ts
浏览文件 @
4678dfc2
...
...
@@ -22,14 +22,17 @@ export function uniPreCssPlugin(options: UniPluginFilterOptions): Plugin {
return
}
if
(
!
filter
(
id
))
{
return
code
return
}
debugPreTry
(
id
)
if
(
!
code
.
includes
(
'
#endif
'
))
{
return
}
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 {
const
cache
=
sourceToSFC
.
get
(
sourceKey
)
if
(
cache
)
{
debugPreVue
(
'
cache
'
,
id
)
return
cache
return
{
code
:
cache
,
map
:
null
,
}
}
const
hasBlock
=
BLOCK_RE
.
test
(
code
)
const
hasWxs
=
WXS_LANG_RE
.
test
(
code
)
...
...
@@ -59,7 +62,10 @@ export function uniPreVuePlugin(): Plugin {
// this.error(errors.join('\n'))
// }
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}
</script>`
)
}
return
`
${
rewriteDefault
(
code
.
replace
(
/module
\.
exports
\s
*=/
,
'
export default
'
),
'
_sfc_
'
+
type
)}
${
type
===
'
renderjs
'
?
genRenderjsCode
(
name
)
:
genWxsCode
(
name
)}
`
return
{
code
:
`
${
rewriteDefault
(
code
.
replace
(
/module
\.
exports
\s
*=/
,
'
export default
'
),
'
_sfc_
'
+
type
)}
${
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(
transform
(
code
,
id
)
{
if
(
!
filter
(
id
))
return
null
if
(
!
KEYED_FUNC_RE
.
test
(
code
))
{
return
code
return
}
debugSSR
(
'
try
'
,
id
)
const
ast
=
this
.
parse
(
code
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录