Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Velpro187
uni-app
提交
818d981a
U
uni-app
项目概览
Velpro187
/
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,发现更多精彩内容 >>
提交
818d981a
编写于
10月 25, 2021
作者:
fxy060608
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip(mp): support mp-qq
上级
c50973c7
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
358 addition
and
14 deletion
+358
-14
packages/uni-cli-shared/src/mp/template.ts
packages/uni-cli-shared/src/mp/template.ts
+26
-2
packages/uni-mp-qq/build.json
packages/uni-mp-qq/build.json
+5
-1
packages/uni-mp-qq/dist/uni.compiler.js
packages/uni-mp-qq/dist/uni.compiler.js
+158
-0
packages/uni-mp-qq/package.json
packages/uni-mp-qq/package.json
+3
-1
packages/uni-mp-qq/src/plugin/fix2648.ts
packages/uni-mp-qq/src/plugin/fix2648.ts
+35
-0
packages/uni-mp-qq/src/plugin/index.ts
packages/uni-mp-qq/src/plugin/index.ts
+85
-0
packages/uni-mp-qq/src/plugin/project.config.json
packages/uni-mp-qq/src/plugin/project.config.json
+36
-0
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
+1
-1
packages/uni-mp-weixin/dist/uni.compiler.js
packages/uni-mp-weixin/dist/uni.compiler.js
+4
-4
packages/uni-mp-weixin/src/plugin/index.ts
packages/uni-mp-weixin/src/plugin/index.ts
+3
-3
packages/uni-mp-weixin/src/plugin/project.config.json
packages/uni-mp-weixin/src/plugin/project.config.json
+1
-1
未找到文件。
packages/uni-cli-shared/src/mp/template.ts
浏览文件 @
818d981a
import
path
from
'
path
'
import
{
EmittedAsset
}
from
'
rollup
'
import
{
isComponentTag
,
LINEFEED
}
from
'
@dcloudio/uni-shared
'
import
{
...
...
@@ -10,6 +11,7 @@ import {
TemplateChildNode
,
TransformContext
,
}
from
'
@vue/compiler-core
'
import
{
normalizeMiniProgramFilename
}
from
'
../utils
'
export
interface
MiniProgramCompilerOptions
{
slot
:
{
...
...
@@ -29,11 +31,29 @@ export interface MiniProgramFilterOptions {
code
:
string
}
type
GenFilterFn
=
(
filter
:
MiniProgramFilterOptions
)
=>
string
|
void
type
GenFilterFn
=
(
filter
:
MiniProgramFilterOptions
,
filename
:
string
)
=>
string
|
void
const
templateFilesCache
=
new
Map
<
string
,
string
>
()
const
templateFiltersCache
=
new
Map
<
string
,
MiniProgramFilterOptions
[]
>
()
function
relativeFilterFilename
(
filename
:
string
,
filter
:
MiniProgramFilterOptions
)
{
if
(
!
filter
.
src
)
{
return
''
}
return
(
'
./
'
+
normalizeMiniProgramFilename
(
path
.
relative
(
path
.
dirname
(
filename
),
filter
.
src
)
)
)
}
export
function
findMiniProgramTemplateFiles
(
genFilter
?:
GenFilterFn
)
{
const
files
:
Record
<
string
,
string
>
=
Object
.
create
(
null
)
templateFilesCache
.
forEach
((
code
,
filename
)
=>
{
...
...
@@ -43,7 +63,11 @@ export function findMiniProgramTemplateFiles(genFilter?: GenFilterFn) {
const
filters
=
getMiniProgramTemplateFilters
(
filename
)
if
(
filters
&&
filters
.
length
)
{
files
[
filename
]
=
filters
.
map
((
filter
)
=>
genFilter
(
filter
)).
join
(
LINEFEED
)
+
filters
.
map
((
filter
)
=>
genFilter
(
filter
,
relativeFilterFilename
(
filename
,
filter
))
)
.
join
(
LINEFEED
)
+
LINEFEED
+
code
}
else
{
...
...
packages/uni-mp-qq/build.json
浏览文件 @
818d981a
...
...
@@ -6,7 +6,11 @@
"output"
:
{
"format"
:
"cjs"
},
"external"
:
[
"@dcloudio/uni-cli-shared"
,
"@dcloudio/uni-mp-vite"
]
"external"
:
[
"fs-extra"
,
"@dcloudio/uni-cli-shared"
,
"@dcloudio/uni-mp-vite"
]
},
{
"input"
:
{
...
...
packages/uni-mp-qq/dist/uni.compiler.js
0 → 100644
浏览文件 @
818d981a
'
use strict
'
;
var
uniCliShared
=
require
(
'
@dcloudio/uni-cli-shared
'
);
var
initMiniProgramPlugin
=
require
(
'
@dcloudio/uni-mp-vite
'
);
var
path
=
require
(
'
path
'
);
var
fs
=
require
(
'
fs-extra
'
);
function
_interopDefaultLegacy
(
e
)
{
return
e
&&
typeof
e
===
'
object
'
&&
'
default
'
in
e
?
e
:
{
'
default
'
:
e
};
}
var
initMiniProgramPlugin__default
=
/*#__PURE__*/
_interopDefaultLegacy
(
initMiniProgramPlugin
);
var
path__default
=
/*#__PURE__*/
_interopDefaultLegacy
(
path
);
var
fs__default
=
/*#__PURE__*/
_interopDefaultLegacy
(
fs
);
var
description
=
"
项目配置文件。
"
;
var
packOptions
=
{
ignore
:
[
]
};
var
setting
=
{
urlCheck
:
true
,
es6
:
true
,
postcss
:
false
,
minified
:
false
,
newFeature
:
true
,
nodeModules
:
false
};
var
compileType
=
"
miniprogram
"
;
var
libVersion
=
""
;
var
appid
=
"
touristappid
"
;
var
projectname
=
""
;
var
condition
=
{
search
:
{
current
:
-
1
,
list
:
[
]
},
conversation
:
{
current
:
-
1
,
list
:
[
]
},
game
:
{
current
:
-
1
,
list
:
[
]
},
miniprogram
:
{
current
:
-
1
,
list
:
[
]
}
};
var
source
=
{
description
:
description
,
packOptions
:
packOptions
,
setting
:
setting
,
compileType
:
compileType
,
libVersion
:
libVersion
,
appid
:
appid
,
projectname
:
projectname
,
condition
:
condition
};
let
isFixed
=
false
;
function
fix2648
(
bundle
)
{
if
(
isFixed
)
{
return
;
}
const
appJsonAsset
=
bundle
[
'
app.json
'
];
if
(
!
appJsonAsset
)
{
return
;
}
try
{
const
{
usingComponents
}
=
JSON
.
parse
(
appJsonAsset
.
source
.
toString
());
if
(
usingComponents
&&
!
Object
.
keys
(
usingComponents
).
length
)
{
fs__default
[
"
default
"
].
outputFileSync
(
path__default
[
"
default
"
].
resolve
(
process
.
env
.
UNI_OUTPUT_DIR
,
'
fix-2648.json
'
),
`{"component":true}`
);
fs__default
[
"
default
"
].
outputFileSync
(
path__default
[
"
default
"
].
resolve
(
process
.
env
.
UNI_OUTPUT_DIR
,
'
fix-2648.qml
'
),
`<!-- https://github.com/dcloudio/uni-app/issues/2648 -->`
);
fs__default
[
"
default
"
].
outputFileSync
(
path__default
[
"
default
"
].
resolve
(
process
.
env
.
UNI_OUTPUT_DIR
,
'
fix-2648.js
'
),
`Component({})`
);
}
isFixed
=
true
;
}
catch
(
_a
)
{
}
}
const
uniMiniProgramWeixinPlugin
=
{
name
:
'
vite:uni-mp-qq
'
,
config
()
{
return
{
define
:
{
__VUE_CREATED_DEFERRED__
:
false
,
},
};
},
writeBundle
(
_
,
bundle
)
{
fix2648
(
bundle
);
},
};
const
options
=
{
vite
:
{
inject
:
{
uni
:
[
uniCliShared
.
resolveBuiltIn
(
'
@dcloudio/uni-mp-qq/dist/uni.api.esm.js
'
),
'
default
'
,
],
},
alias
:
{
'
uni-mp-runtime
'
:
uniCliShared
.
resolveBuiltIn
(
'
@dcloudio/uni-mp-qq/dist/uni.mp.esm.js
'
),
},
copyOptions
:
{
assets
:
[
'
wxcomponents
'
],
targets
:
[
{
src
:
[
'
custom-tab-bar
'
],
get
dest
()
{
return
process
.
env
.
UNI_OUTPUT_DIR
;
},
},
],
},
},
global
:
'
qq
'
,
app
:
{
darkmode
:
true
,
subpackages
:
true
,
},
project
:
{
filename
:
'
project.config.json
'
,
source
,
},
template
:
{
filter
:
{
extname
:
'
.qs
'
,
lang
:
'
wxs
'
,
generate
(
filter
,
filename
)
{
if
(
filename
)
{
return
`<qs src="
${
filename
}
.qs" module="
${
filter
.
name
}
"/>`
;
}
return
`<qs module="
${
filter
.
name
}
">
${
filter
.
code
}
</qs>`
;
},
},
slot
:
{
fallback
:
false
,
},
extname
:
'
.qml
'
,
directive
:
'
qq:
'
,
compilerOptions
:
{
nodeTransforms
:
[
uniCliShared
.
addComponentBindLink
],
},
},
style
:
{
extname
:
'
.qss
'
,
},
};
var
index
=
[
uniMiniProgramWeixinPlugin
,
...
initMiniProgramPlugin__default
[
"
default
"
](
options
)];
module
.
exports
=
index
;
packages/uni-mp-qq/package.json
浏览文件 @
818d981a
...
...
@@ -14,7 +14,9 @@
"license"
:
"Apache-2.0"
,
"uni-app"
:
{
"name"
:
"mp-qq"
,
"title"
:
"QQ小程序"
"title"
:
"QQ小程序"
,
"apply"
:
"mp-qq"
,
"main"
:
"dist/uni.compiler.js"
},
"gitHead"
:
"1efa8efd0a9eddeabdba75c020d015ebf31b8177"
}
packages/uni-mp-qq/src/plugin/fix2648.ts
0 → 100644
浏览文件 @
818d981a
import
path
from
'
path
'
import
fs
from
'
fs-extra
'
import
{
OutputAsset
,
OutputBundle
}
from
'
rollup
'
let
isFixed
=
false
export
function
fix2648
(
bundle
:
OutputBundle
)
{
if
(
isFixed
)
{
return
}
const
appJsonAsset
=
bundle
[
'
app.json
'
]
as
OutputAsset
if
(
!
appJsonAsset
)
{
return
}
try
{
const
{
usingComponents
}
=
JSON
.
parse
(
appJsonAsset
.
source
.
toString
())
as
{
usingComponents
?:
Record
<
string
,
string
>
}
if
(
usingComponents
&&
!
Object
.
keys
(
usingComponents
).
length
)
{
fs
.
outputFileSync
(
path
.
resolve
(
process
.
env
.
UNI_OUTPUT_DIR
,
'
fix-2648.json
'
),
`{"component":true}`
)
fs
.
outputFileSync
(
path
.
resolve
(
process
.
env
.
UNI_OUTPUT_DIR
,
'
fix-2648.qml
'
),
`<!-- https://github.com/dcloudio/uni-app/issues/2648 -->`
)
fs
.
outputFileSync
(
path
.
resolve
(
process
.
env
.
UNI_OUTPUT_DIR
,
'
fix-2648.js
'
),
`Component({})`
)
}
isFixed
=
true
}
catch
{}
}
packages/uni-mp-qq/src/plugin/index.ts
0 → 100644
浏览文件 @
818d981a
import
{
Plugin
}
from
'
vite
'
import
{
addComponentBindLink
,
resolveBuiltIn
}
from
'
@dcloudio/uni-cli-shared
'
import
initMiniProgramPlugin
,
{
UniMiniProgramPluginOptions
,
}
from
'
@dcloudio/uni-mp-vite
'
import
source
from
'
./project.config.json
'
import
{
fix2648
}
from
'
./fix2648
'
const
uniMiniProgramWeixinPlugin
:
Plugin
=
{
name
:
'
vite:uni-mp-qq
'
,
config
()
{
return
{
define
:
{
__VUE_CREATED_DEFERRED__
:
false
,
},
}
},
writeBundle
(
_
,
bundle
)
{
fix2648
(
bundle
)
},
}
const
options
:
UniMiniProgramPluginOptions
=
{
vite
:
{
inject
:
{
uni
:
[
resolveBuiltIn
(
'
@dcloudio/uni-mp-qq/dist/uni.api.esm.js
'
),
'
default
'
,
],
},
alias
:
{
'
uni-mp-runtime
'
:
resolveBuiltIn
(
'
@dcloudio/uni-mp-qq/dist/uni.mp.esm.js
'
),
},
copyOptions
:
{
assets
:
[
'
wxcomponents
'
],
targets
:
[
{
src
:
[
'
custom-tab-bar
'
],
get
dest
()
{
return
process
.
env
.
UNI_OUTPUT_DIR
},
},
],
},
},
global
:
'
qq
'
,
app
:
{
darkmode
:
true
,
subpackages
:
true
,
},
project
:
{
filename
:
'
project.config.json
'
,
source
,
},
template
:
{
filter
:
{
extname
:
'
.qs
'
,
lang
:
'
wxs
'
,
generate
(
filter
,
filename
)
{
if
(
filename
)
{
return
`<qs src="
${
filename
}
.qs" module="
${
filter
.
name
}
"/>`
}
return
`<qs module="
${
filter
.
name
}
">
${
filter
.
code
}
</qs>`
},
},
slot
:
{
fallback
:
false
,
},
extname
:
'
.qml
'
,
directive
:
'
qq:
'
,
compilerOptions
:
{
nodeTransforms
:
[
addComponentBindLink
],
},
},
style
:
{
extname
:
'
.qss
'
,
},
}
export
default
[
uniMiniProgramWeixinPlugin
,
...
initMiniProgramPlugin
(
options
)]
packages/uni-mp-qq/src/plugin/project.config.json
0 → 100644
浏览文件 @
818d981a
{
"description"
:
"项目配置文件。"
,
"packOptions"
:
{
"ignore"
:
[]
},
"setting"
:
{
"urlCheck"
:
true
,
"es6"
:
true
,
"postcss"
:
false
,
"minified"
:
false
,
"newFeature"
:
true
,
"nodeModules"
:
false
},
"compileType"
:
"miniprogram"
,
"libVersion"
:
""
,
"appid"
:
"touristappid"
,
"projectname"
:
""
,
"condition"
:
{
"search"
:
{
"current"
:
-1
,
"list"
:
[]
},
"conversation"
:
{
"current"
:
-1
,
"list"
:
[]
},
"game"
:
{
"current"
:
-1
,
"list"
:
[]
},
"miniprogram"
:
{
"current"
:
-1
,
"list"
:
[]
}
}
}
packages/uni-mp-vite/src/plugin/build.ts
浏览文件 @
818d981a
...
...
@@ -31,7 +31,7 @@ export function buildOptions(): UserConfig['build'] {
}
return
{
// sourcemap: 'inline', // TODO
target
:
[
'
chrome53
'
],
// target: ['chrome53'], // 由小程序自己启用 es6 编译
emptyOutDir
:
false
,
// 不清空输出目录,否则会影响自定义的一些文件输出,比如wxml
assetsInlineLimit
:
40
*
1024
,
// 40kb
lib
:
{
...
...
packages/uni-mp-vite/src/plugin/configResolved.ts
浏览文件 @
818d981a
...
...
@@ -67,7 +67,7 @@ export function createConfigResolved({
const
normalized
=
normalizePath
(
filename
)
if
(
nvueCssPaths
.
find
((
pageCssPath
)
=>
pageCssPath
===
normalized
))
{
debugNVueCss
(
normalized
)
return
`@import "/nvue
.wxss
";\n`
+
cssCode
return
`@import "/nvue
${
extname
}
";\n`
+
cssCode
}
return
cssCode
},
...
...
packages/uni-mp-weixin/dist/uni.compiler.js
浏览文件 @
818d981a
...
...
@@ -14,7 +14,7 @@ var packOptions = {
};
var
setting
=
{
urlCheck
:
true
,
es6
:
fals
e
,
es6
:
tru
e
,
postcss
:
false
,
minified
:
false
,
newFeature
:
true
...
...
@@ -110,9 +110,9 @@ const options = {
filter
:
{
extname
:
'
.wxs
'
,
lang
:
'
wxs
'
,
generate
(
filter
)
{
if
(
fil
ter
.
src
)
{
return
`<wxs src="
/
${
filter
.
src
}
.wxs" module="
${
filter
.
name
}
"/>`
;
generate
(
filter
,
filename
)
{
if
(
fil
ename
)
{
return
`<wxs src="
${
filename
}
.wxs" module="
${
filter
.
name
}
"/>`
;
}
return
`<wxs module="
${
filter
.
name
}
">
${
filter
.
code
}
...
...
packages/uni-mp-weixin/src/plugin/index.ts
浏览文件 @
818d981a
...
...
@@ -64,9 +64,9 @@ const options: UniMiniProgramPluginOptions = {
filter
:
{
extname
:
'
.wxs
'
,
lang
:
'
wxs
'
,
generate
(
filter
)
{
if
(
fil
ter
.
src
)
{
return
`<wxs src="
/
${
filter
.
src
}
.wxs" module="
${
filter
.
name
}
"/>`
generate
(
filter
,
filename
)
{
if
(
fil
ename
)
{
return
`<wxs src="
${
filename
}
.wxs" module="
${
filter
.
name
}
"/>`
}
return
`<wxs module="
${
filter
.
name
}
">
${
filter
.
code
}
...
...
packages/uni-mp-weixin/src/plugin/project.config.json
浏览文件 @
818d981a
...
...
@@ -5,7 +5,7 @@
},
"setting"
:
{
"urlCheck"
:
true
,
"es6"
:
fals
e
,
"es6"
:
tru
e
,
"postcss"
:
false
,
"minified"
:
false
,
"newFeature"
:
true
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录