Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
m0_68066342
uni-app
提交
e18bd5bf
U
uni-app
项目概览
m0_68066342
/
uni-app
与 Fork 源项目一致
Fork自
DCloud / uni-app
通知
1
Star
0
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,发现更多精彩内容 >>
提交
e18bd5bf
编写于
3月 12, 2020
作者:
Q
qiang
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' of github.com:dcloudio/uni-app into dev
上级
9c25c667
9b232b8d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
94 addition
and
26 deletion
+94
-26
docs/api/file/file.md
docs/api/file/file.md
+1
-1
packages/uni-template-compiler/lib/index.js
packages/uni-template-compiler/lib/index.js
+15
-1
packages/vue-cli-plugin-hbuilderx/build/css-loader.conf.js
packages/vue-cli-plugin-hbuilderx/build/css-loader.conf.js
+10
-2
packages/vue-cli-plugin-uni/lib/configure-webpack.js
packages/vue-cli-plugin-uni/lib/configure-webpack.js
+5
-4
packages/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js
...ni/packages/vue-loader/lib/runtime/componentNormalizer.js
+9
-1
packages/webpack-uni-mp-loader/lib/babel/plugin-dynamic-import.js
.../webpack-uni-mp-loader/lib/babel/plugin-dynamic-import.js
+29
-16
src/platforms/h5/helpers/todo-api.js
src/platforms/h5/helpers/todo-api.js
+0
-1
src/platforms/h5/service/api/file/file.js
src/platforms/h5/service/api/file/file.js
+25
-0
未找到文件。
docs/api/file/file.md
浏览文件 @
e18bd5bf
...
...
@@ -162,7 +162,7 @@ uni.getSavedFileList({
|App|H5|微信小程序|支付宝小程序|百度小程序|头条小程序|QQ小程序|
|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
|√|
x
|√|√|√|√|√|
|√|
√
|√|√|√|√|√|
**OBJECT 参数说明:**
...
...
packages/uni-template-compiler/lib/index.js
浏览文件 @
e18bd5bf
...
...
@@ -33,6 +33,10 @@ const {
compileTemplate
}
=
require
(
'
./auto-components
'
)
const
isWin
=
/^win/
.
test
(
process
.
platform
)
const
normalizePath
=
path
=>
(
isWin
?
path
.
replace
(
/
\\
/g
,
'
/
'
)
:
path
)
module
.
exports
=
{
compile
(
source
,
options
=
{})
{
if
(
// 启用摇树优化后,需要过滤内置组件
...
...
@@ -192,10 +196,20 @@ at ${resourcePath}.vue:1`)
options
.
mp
.
filterModules
.
forEach
(
name
=>
{
const
filterModule
=
options
.
filterModules
[
name
]
if
(
filterModule
.
type
!==
'
renderjs
'
&&
filterModule
.
attrs
.
lang
!==
'
renderjs
'
)
{
if
(
filterModule
.
attrs
&&
filterModule
.
attrs
.
src
&&
filterModule
.
attrs
.
src
.
indexOf
(
'
@/
'
)
===
0
)
{
const
src
=
filterModule
.
attrs
.
src
filterModule
.
attrs
.
src
=
normalizePath
(
path
.
relative
(
path
.
dirname
(
resourcePath
),
src
.
replace
(
'
@/
'
,
''
)
))
}
filterTemplate
.
push
(
options
.
mp
.
platform
.
createFilterTag
(
options
.
filterTagName
,
options
.
filterModules
[
name
]
filterModule
)
)
}
...
...
packages/vue-cli-plugin-hbuilderx/build/css-loader.conf.js
浏览文件 @
e18bd5bf
...
...
@@ -59,13 +59,21 @@ const sassLoader = {
}
if
(
sassLoaderVersion
<
8
)
{
scssLoader
.
options
.
data
=
sassData
scssLoader
.
options
.
data
=
sassData
scssLoader
.
options
.
outputStyle
=
'
nested
'
sassLoader
.
options
.
data
=
sassData
sassLoader
.
options
.
outputStyle
=
'
nested
'
sassLoader
.
options
.
indentedSyntax
=
true
}
else
{
scssLoader
.
options
.
prependData
=
sassData
scssLoader
.
options
.
prependData
=
sassData
scssLoader
.
options
.
sassOptions
=
{
outputStyle
:
'
nested
'
}
sassLoader
.
options
.
prependData
=
sassData
sassLoader
.
options
.
sassOptions
=
{
outputStyle
:
'
nested
'
,
indentedSyntax
:
true
}
}
...
...
packages/vue-cli-plugin-uni/lib/configure-webpack.js
浏览文件 @
e18bd5bf
...
...
@@ -137,15 +137,16 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
}
}
}
const
babelLoaderRe
=
/^babel-loader|
(\/
|
\\)
babel-loader/
const
cacheLoaderRe
=
/^cache-loader|
(\/
|
\\)
cache-loader/
return
function
(
webpackConfig
)
{
// disable js cache-loader
const
rawRules
=
webpackConfig
.
module
.
rules
for
(
let
i
=
rawRules
.
length
-
1
;
i
>=
0
;
i
--
)
{
const
uses
=
rawRules
[
i
].
use
if
(
Array
.
isArray
(
uses
))
{
if
(
uses
.
find
(
use
=>
use
.
loader
===
'
babel-loader
'
))
{
const
index
=
uses
.
findIndex
(
use
=>
use
.
loader
===
'
cache-loader
'
)
if
(
uses
.
find
(
use
=>
babelLoaderRe
.
test
(
use
.
loader
)
))
{
const
index
=
uses
.
findIndex
(
use
=>
cacheLoaderRe
.
test
(
use
.
loader
)
)
if
(
process
.
env
.
UNI_USING_CACHE
)
{
Object
.
assign
(
uses
[
index
].
options
,
api
.
genCacheConfig
(
'
babel-loader/
'
+
process
.
env
.
UNI_PLATFORM
,
...
...
@@ -159,7 +160,7 @@ module.exports = function configureWebpack (platformOptions, manifestPlatformOpt
}
// js preprocess
updateJsLoader
(
rawRules
,
'
foo.js
'
,
/^
(
.*
[/\\])?
babel-loader/
,
{
updateJsLoader
(
rawRules
,
'
foo.js
'
,
babelLoaderRe
,
{
loader
:
resolve
(
'
packages/webpack-preprocess-loader
'
),
options
:
jsPreprocessOptions
})
...
...
packages/vue-cli-plugin-uni/packages/vue-loader/lib/runtime/componentNormalizer.js
浏览文件 @
e18bd5bf
...
...
@@ -23,7 +23,15 @@ export default function normalizeComponent (
// fixed by xxxxxx auto components
if
(
components
)
{
options
.
components
=
Object
.
assign
(
components
,
options
.
components
||
{})
if
(
!
options
.
components
)
{
options
.
components
=
{}
}
var
hasOwn
=
Object
.
prototype
.
hasOwnProperty
for
(
var
name
in
components
)
{
if
(
hasOwn
.
call
(
components
,
name
)
&&
!
hasOwn
.
call
(
options
.
components
,
name
))
{
options
.
components
[
name
]
=
components
[
name
]
}
}
}
// fixed by xxxxxx renderjs
if
(
renderjs
)
{
...
...
packages/webpack-uni-mp-loader/lib/babel/plugin-dynamic-import.js
浏览文件 @
e18bd5bf
const
t
=
require
(
'
@babel/types
'
)
const
babelTemplate
=
require
(
'
@babel/template
'
).
default
const
buildDynamicImport
=
babelTemplate
(
`var IMPORT_NAME = ()=>import(IMPORT_SOURCE)`
,
{
preserveComments
:
true
,
plugins
:
[
'
dynamicImport
'
]
})
// const buildDynamicImport = babelTemplate(`var IMPORT_NAME = ()=>import(IMPORT_SOURCE)`, {
// preserveComments: true,
// plugins: [
// 'dynamicImport'
// ]
// })
// 已废弃,@vue/cli-plugin-babel@4 增加了 dynamic import 转换
// var test = ()=>import(/* webpackChunkName: "components/test" */'../../components/test')
function
getDynamicImport
(
name
,
source
,
chunkName
)
{
const
stringLiteral
=
t
.
stringLiteral
(
source
)
const
dynamicImportComment
=
{
type
:
'
CommentBlock
'
,
value
:
`webpackChunkName: "
${
chunkName
}
"`
}
stringLiteral
.
leadingComments
=
[
dynamicImportComment
]
return
buildDynamicImport
({
// function getDynamicImport (name, source, chunkName) {
// const stringLiteral = t.stringLiteral(source)
// const dynamicImportComment = {
// type: 'CommentBlock',
// value: `webpackChunkName: "${chunkName}"`
// }
// stringLiteral.leadingComments = [dynamicImportComment]
// return buildDynamicImport({
// IMPORT_NAME: t.identifier(name),
// IMPORT_SOURCE: stringLiteral
// })
// }
// var test = function(resolve) {require.ensure([], () => resolve(require('../../components/test')),'components/test')}
const
buildRequireEnsure
=
babelTemplate
(
`var IMPORT_NAME = function(){require.ensure([],()=>resolve(require(IMPORT_SOURCE)),CHUNK_NAME)}`
)
function
getRequireEnsure
(
name
,
source
,
chunkName
)
{
return
buildRequireEnsure
({
IMPORT_NAME
:
t
.
identifier
(
name
),
IMPORT_SOURCE
:
stringLiteral
IMPORT_SOURCE
:
t
.
stringLiteral
(
source
),
CHUNK_NAME
:
t
.
stringLiteral
(
chunkName
)
})
}
...
...
@@ -30,7 +43,7 @@ module.exports = function ({
const
dynamicImport
=
state
.
opts
.
dynamicImports
[
path
.
node
.
source
.
value
]
if
(
dynamicImport
)
{
path
.
insertBefore
(
get
DynamicImport
(
get
RequireEnsure
(
path
.
node
.
specifiers
[
0
].
local
.
name
,
dynamicImport
.
source
,
dynamicImport
.
chunkName
...
...
src/platforms/h5/helpers/todo-api.js
浏览文件 @
e18bd5bf
...
...
@@ -9,7 +9,6 @@ export default [
'
getSavedFileList
'
,
'
getSavedFileInfo
'
,
'
removeSavedFileInfo
'
,
'
getFileInfo
'
,
'
onMemoryWarning
'
,
'
onGyroscopeChange
'
,
'
startGyroscope
'
,
...
...
src/platforms/h5/service/api/file/file.js
0 → 100644
浏览文件 @
e18bd5bf
import
{
urlToFile
}
from
'
uni-platform/helpers/file
'
const
{
invokeCallbackHandler
:
invoke
}
=
UniServiceJSBridge
export
function
getFileInfo
({
filePath
}
=
{},
callbackId
)
{
// TODO 计算文件摘要
urlToFile
(
filePath
).
then
((
res
)
=>
{
invoke
(
callbackId
,
{
errMsg
:
'
getFileInfo:ok
'
,
size
:
res
.
size
})
}).
catch
((
err
)
=>
{
invoke
(
callbackId
,
{
errMsg
:
'
getFileInfo:fail 文件[
'
+
filePath
+
'
] getFileInfo 失败:
'
+
err
.
message
})
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录