Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DiDi
Chameleon
提交
def5396c
C
Chameleon
项目概览
DiDi
/
Chameleon
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Chameleon
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
def5396c
编写于
6月 24, 2020
作者:
J
JiM-W
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 文件夹带有数字修复
上级
19941152
变更
22
隐藏空白更改
内联
并排
Showing
22 changed file
with
37 addition
and
38 deletion
+37
-38
package.json
package.json
+1
-2
packages/chameleon-loader/test/src/loaderMethods.test.js
packages/chameleon-loader/test/src/loaderMethods.test.js
+3
-3
packages/chameleon-loader/test/src/project/src/pages/pagea.cml
...ges/chameleon-loader/test/src/project/src/pages/pagea.cml
+0
-0
packages/mvvm-interface-parser/test/getInterfaceCode.test.js
packages/mvvm-interface-parser/test/getInterfaceCode.test.js
+8
-8
packages/mvvm-interface-parser/test/lib/components/coma/coma.alipay.cml
...interface-parser/test/lib/components/coma/coma.alipay.cml
+0
-0
packages/mvvm-interface-parser/test/lib/components/coma/coma.baidu.cml
...-interface-parser/test/lib/components/coma/coma.baidu.cml
+0
-0
packages/mvvm-interface-parser/test/lib/components/coma/coma.interface
...-interface-parser/test/lib/components/coma/coma.interface
+0
-0
packages/mvvm-interface-parser/test/lib/components/coma/coma.web.cml
...vm-interface-parser/test/lib/components/coma/coma.web.cml
+0
-0
packages/mvvm-interface-parser/test/lib/components/coma/coma.weex.cml
...m-interface-parser/test/lib/components/coma/coma.weex.cml
+0
-0
packages/mvvm-interface-parser/test/lib/components/coma/coma.wx.cml
...vvm-interface-parser/test/lib/components/coma/coma.wx.cml
+0
-0
packages/mvvm-interface-parser/test/lib/components/comb/comb.baidu.cml
...-interface-parser/test/lib/components/comb/comb.baidu.cml
+0
-0
packages/mvvm-interface-parser/test/lib/components/comb/comb.interface
...-interface-parser/test/lib/components/comb/comb.interface
+0
-0
packages/mvvm-interface-parser/test/lib/components/first/first.interface
...nterface-parser/test/lib/components/first/first.interface
+2
-2
packages/mvvm-interface-parser/test/lib/components/first/test.js
...s/mvvm-interface-parser/test/lib/components/first/test.js
+0
-0
packages/mvvm-interface-parser/test/lib/components/third.interface
...mvvm-interface-parser/test/lib/components/third.interface
+2
-2
packages/mvvm-interface-parser/test/lib/components/third/includea.interface
...rface-parser/test/lib/components/third/includea.interface
+0
-0
packages/mvvm-interface-parser/test/lib/components/third/includeb.interface
...rface-parser/test/lib/components/third/includeb.interface
+0
-0
packages/mvvm-pack/test/demo-project/src/pages/pagea/pagea.cml
...ges/mvvm-pack/test/demo-project/src/pages/pagea/pagea.cml
+0
-0
packages/mvvm-pack/test/demo-project/src/pages/pageb/pageb.cml
...ges/mvvm-pack/test/demo-project/src/pages/pageb/pageb.cml
+0
-0
packages/mvvm-pack/test/demo-project/src/router.config.json
packages/mvvm-pack/test/demo-project/src/router.config.json
+1
-1
packages/mvvm-pack/test/demoPlugin.js
packages/mvvm-pack/test/demoPlugin.js
+13
-13
packages/mvvm-pack/test/mvvmGraphPlugin.test.js
packages/mvvm-pack/test/mvvmGraphPlugin.test.js
+7
-7
未找到文件。
package.json
浏览文件 @
def5396c
...
@@ -28,8 +28,7 @@
...
@@ -28,8 +28,7 @@
},
},
"husky"
:
{
"husky"
:
{
"hooks"
:
{
"hooks"
:
{
"commit-msg"
:
"commitlint -E HUSKY_GIT_PARAMS"
,
"commit-msg"
:
"commitlint -E HUSKY_GIT_PARAMS"
"pre-commit"
:
"lint-staged"
}
}
},
},
"dependencies"
:
{
"dependencies"
:
{
...
...
packages/chameleon-loader/test/src/loaderMethods.test.js
浏览文件 @
def5396c
...
@@ -8,7 +8,7 @@ describe('prepareParseUsingComponents', function() {
...
@@ -8,7 +8,7 @@ describe('prepareParseUsingComponents', function() {
scroller
:
'
/npm/cml-ui/scroller/scroller
'
scroller
:
'
/npm/cml-ui/scroller/scroller
'
}
}
let
loaderContext
=
{
let
loaderContext
=
{
resourcePath
:
path
.
join
(
__dirname
,
'
./project/src/pages/page
1
.cml
'
)
resourcePath
:
path
.
join
(
__dirname
,
'
./project/src/pages/page
a
.cml
'
)
}
}
let
context
=
path
.
join
(
__dirname
,
'
./project
'
);
let
context
=
path
.
join
(
__dirname
,
'
./project
'
);
...
@@ -34,7 +34,7 @@ describe('prepareParseUsingComponents', function() {
...
@@ -34,7 +34,7 @@ describe('prepareParseUsingComponents', function() {
scroller
:
'
./../npm/cml-ui/scroller/scroller
'
scroller
:
'
./../npm/cml-ui/scroller/scroller
'
}
}
let
loaderContext
=
{
let
loaderContext
=
{
resourcePath
:
path
.
join
(
__dirname
,
'
./project/src/pages/page
1
.cml
'
)
resourcePath
:
path
.
join
(
__dirname
,
'
./project/src/pages/page
a
.cml
'
)
}
}
let
context
=
path
.
join
(
__dirname
,
'
./project
'
);
let
context
=
path
.
join
(
__dirname
,
'
./project
'
);
...
@@ -46,7 +46,7 @@ describe('prepareParseUsingComponents', function() {
...
@@ -46,7 +46,7 @@ describe('prepareParseUsingComponents', function() {
});
});
let
expectPath
=
path
.
join
(
__dirname
,
'
./project/node_modules/cml-ui/scroller/scroller.cml
'
)
let
expectPath
=
path
.
join
(
__dirname
,
'
./project/node_modules/cml-ui/scroller/scroller.cml
'
)
result
.
forEach
(
item
=>
{
result
.
forEach
(
item
=>
{
if
(
item
.
tagName
===
'
scroller
'
)
{
if
(
item
.
tagName
===
'
scroller
'
)
{
expect
(
item
.
filePath
).
to
.
be
.
equal
(
expectPath
);
expect
(
item
.
filePath
).
to
.
be
.
equal
(
expectPath
);
expect
(
item
.
isNative
).
to
.
be
.
equal
(
false
);
expect
(
item
.
isNative
).
to
.
be
.
equal
(
false
);
...
...
packages/chameleon-loader/test/src/project/src/pages/page
1
.cml
→
packages/chameleon-loader/test/src/project/src/pages/page
a
.cml
浏览文件 @
def5396c
文件已移动
packages/mvvm-interface-parser/test/getInterfaceCode.test.js
浏览文件 @
def5396c
...
@@ -31,7 +31,7 @@ describe('mvvm-interface-parser/getInterfaceCode', function() {
...
@@ -31,7 +31,7 @@ describe('mvvm-interface-parser/getInterfaceCode', function() {
try
{
try
{
getInterfaceCode
({
interfacePath
,
content
});
getInterfaceCode
({
interfacePath
,
content
});
}
catch
(
e
)
{
}
catch
(
e
)
{
expect
(
!!~
e
.
message
.
indexOf
(
`not find <script cml-type='interface'></script>`
)).
to
.
be
.
equal
(
true
)
expect
(
!!~
e
.
message
.
indexOf
(
'
not find <script cml-type=
\'
interface
\'
></script>
'
)).
to
.
be
.
equal
(
true
)
}
}
})
})
...
@@ -41,7 +41,7 @@ describe('mvvm-interface-parser/getInterfaceCode', function() {
...
@@ -41,7 +41,7 @@ describe('mvvm-interface-parser/getInterfaceCode', function() {
try
{
try
{
getInterfaceCode
({
interfacePath
,
content
});
getInterfaceCode
({
interfacePath
,
content
});
}
catch
(
e
)
{
}
catch
(
e
)
{
expect
(
!!~
e
.
message
.
indexOf
(
`multi <script cml-type='interface'></script>`
)).
to
.
be
.
equal
(
true
)
expect
(
!!~
e
.
message
.
indexOf
(
'
multi <script cml-type=
\'
interface
\'
></script>
'
)).
to
.
be
.
equal
(
true
)
}
}
})
})
...
@@ -51,7 +51,7 @@ describe('mvvm-interface-parser/getInterfaceCode', function() {
...
@@ -51,7 +51,7 @@ describe('mvvm-interface-parser/getInterfaceCode', function() {
try
{
try
{
getInterfaceCode
({
interfacePath
,
content
});
getInterfaceCode
({
interfacePath
,
content
});
}
catch
(
e
)
{
}
catch
(
e
)
{
expect
(
!!~
e
.
message
.
indexOf
(
`not find file: `
)).
to
.
be
.
equal
(
true
)
expect
(
!!~
e
.
message
.
indexOf
(
'
not find file:
'
)).
to
.
be
.
equal
(
true
)
}
}
})
})
...
@@ -61,27 +61,27 @@ describe('mvvm-interface-parser/getInterfaceCode', function() {
...
@@ -61,27 +61,27 @@ describe('mvvm-interface-parser/getInterfaceCode', function() {
try
{
try
{
getInterfaceCode
({
interfacePath
,
content
});
getInterfaceCode
({
interfacePath
,
content
});
}
catch
(
e
)
{
}
catch
(
e
)
{
expect
(
!!~
e
.
message
.
indexOf
(
`multi <script cml-type='interface'></script> has define in `
)).
to
.
be
.
equal
(
true
)
expect
(
!!~
e
.
message
.
indexOf
(
'
multi <script cml-type=
\'
interface
\'
></script> has define in
'
)).
to
.
be
.
equal
(
true
)
}
}
})
})
it
(
'
include src error
'
,
function
()
{
it
(
'
include src error
'
,
function
()
{
const
interfacePath
=
path
.
join
(
__dirname
,
'
./lib/components/third/include
1
.interface
'
);
const
interfacePath
=
path
.
join
(
__dirname
,
'
./lib/components/third/include
a
.interface
'
);
const
content
=
fs
.
readFileSync
(
interfacePath
,
{
encoding
:
'
utf-8
'
});
const
content
=
fs
.
readFileSync
(
interfacePath
,
{
encoding
:
'
utf-8
'
});
try
{
try
{
getInterfaceCode
({
interfacePath
,
content
});
getInterfaceCode
({
interfacePath
,
content
});
}
catch
(
e
)
{
}
catch
(
e
)
{
expect
(
!!~
e
.
message
.
indexOf
(
`not define include src attribute in`
)).
to
.
be
.
equal
(
true
)
expect
(
!!~
e
.
message
.
indexOf
(
'
not define include src attribute in
'
)).
to
.
be
.
equal
(
true
)
}
}
})
})
it
(
'
include src not file
'
,
function
()
{
it
(
'
include src not file
'
,
function
()
{
const
interfacePath
=
path
.
join
(
__dirname
,
'
./lib/components/third/include
2
.interface
'
);
const
interfacePath
=
path
.
join
(
__dirname
,
'
./lib/components/third/include
b
.interface
'
);
const
content
=
fs
.
readFileSync
(
interfacePath
,
{
encoding
:
'
utf-8
'
});
const
content
=
fs
.
readFileSync
(
interfacePath
,
{
encoding
:
'
utf-8
'
});
try
{
try
{
getInterfaceCode
({
interfacePath
,
content
});
getInterfaceCode
({
interfacePath
,
content
});
}
catch
(
e
)
{
}
catch
(
e
)
{
expect
(
!!~
e
.
message
.
indexOf
(
`not find file:`
)).
to
.
be
.
equal
(
true
)
expect
(
!!~
e
.
message
.
indexOf
(
'
not find file:
'
)).
to
.
be
.
equal
(
true
)
}
}
})
})
})
})
packages/mvvm-interface-parser/test/lib/components/com
1/com1
.alipay.cml
→
packages/mvvm-interface-parser/test/lib/components/com
a/coma
.alipay.cml
浏览文件 @
def5396c
文件已移动
packages/mvvm-interface-parser/test/lib/components/com
1/com1
.baidu.cml
→
packages/mvvm-interface-parser/test/lib/components/com
a/coma
.baidu.cml
浏览文件 @
def5396c
文件已移动
packages/mvvm-interface-parser/test/lib/components/com
1/com1
.interface
→
packages/mvvm-interface-parser/test/lib/components/com
a/coma
.interface
浏览文件 @
def5396c
文件已移动
packages/mvvm-interface-parser/test/lib/components/com
1/com1
.web.cml
→
packages/mvvm-interface-parser/test/lib/components/com
a/coma
.web.cml
浏览文件 @
def5396c
文件已移动
packages/mvvm-interface-parser/test/lib/components/com
1/com1
.weex.cml
→
packages/mvvm-interface-parser/test/lib/components/com
a/coma
.weex.cml
浏览文件 @
def5396c
文件已移动
packages/mvvm-interface-parser/test/lib/components/com
1/com1
.wx.cml
→
packages/mvvm-interface-parser/test/lib/components/com
a/coma
.wx.cml
浏览文件 @
def5396c
文件已移动
packages/mvvm-interface-parser/test/lib/components/com
2/com2
.baidu.cml
→
packages/mvvm-interface-parser/test/lib/components/com
b/comb
.baidu.cml
浏览文件 @
def5396c
文件已移动
packages/mvvm-interface-parser/test/lib/components/com
2/com2
.interface
→
packages/mvvm-interface-parser/test/lib/components/com
b/comb
.interface
浏览文件 @
def5396c
文件已移动
packages/mvvm-interface-parser/test/lib/components/first/first.interface
浏览文件 @
def5396c
...
@@ -6,8 +6,8 @@ interface FirstInterface {
...
@@ -6,8 +6,8 @@ interface FirstInterface {
</script>
</script>
<script cml-type="web">
<script cml-type="web">
import test
1 from './test1
.js';
import test
from './test
.js';
const requireModule = require('./test
1
.js');
const requireModule = require('./test.js');
import cml from 'chameleon-api';
import cml from 'chameleon-api';
class Method implements FirstInterface {
class Method implements FirstInterface {
...
...
packages/mvvm-interface-parser/test/lib/components/first/test
1
.js
→
packages/mvvm-interface-parser/test/lib/components/first/test.js
浏览文件 @
def5396c
文件已移动
packages/mvvm-interface-parser/test/lib/components/third.interface
浏览文件 @
def5396c
<script cml-type="interface" src="./thirdinterface.js"></script>
<script cml-type="interface" src="./thirdinterface.js"></script>
<script cml-type="web">
<script cml-type="web">
import test
1 from './test1
.js';
import test
from './test
.js';
const requireModule = require('./test
1
.js');
const requireModule = require('./test.js');
import cml from 'chameleon-api';
import cml from 'chameleon-api';
class Method implements FirstInterface {
class Method implements FirstInterface {
...
...
packages/mvvm-interface-parser/test/lib/components/third/include
1
.interface
→
packages/mvvm-interface-parser/test/lib/components/third/include
a
.interface
浏览文件 @
def5396c
文件已移动
packages/mvvm-interface-parser/test/lib/components/third/include
2
.interface
→
packages/mvvm-interface-parser/test/lib/components/third/include
b
.interface
浏览文件 @
def5396c
文件已移动
packages/mvvm-pack/test/demo-project/src/pages/page
1/page1
.cml
→
packages/mvvm-pack/test/demo-project/src/pages/page
a/pagea
.cml
浏览文件 @
def5396c
文件已移动
packages/mvvm-pack/test/demo-project/src/pages/page
2/page2
.cml
→
packages/mvvm-pack/test/demo-project/src/pages/page
b/pageb
.cml
浏览文件 @
def5396c
文件已移动
packages/mvvm-pack/test/demo-project/src/router.config.json
浏览文件 @
def5396c
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
"routes"
:[
"routes"
:[
{
{
"url"
:
"/cml/h5/index"
,
"url"
:
"/cml/h5/index"
,
"path"
:
"/pages/page
1/page1
"
,
"path"
:
"/pages/page
a/pagea
"
,
"name"
:
"首页"
,
"name"
:
"首页"
,
"mock"
:
"index.php"
"mock"
:
"index.php"
}
}
...
...
packages/mvvm-pack/test/demoPlugin.js
浏览文件 @
def5396c
...
@@ -101,34 +101,34 @@ module.exports = class DemoPlugin {
...
@@ -101,34 +101,34 @@ module.exports = class DemoPlugin {
})
})
/**
/**
* 编译other类型节点
* 编译other类型节点
* currentNode 当前节点
* currentNode 当前节点
*/
*/
compiler
.
hook
(
'
config-json
'
,
function
(
jsonObj
)
{
compiler
.
hook
(
'
config-json
'
,
function
(
jsonObj
)
{
jsonObj
.
name
=
'
chameleon
'
;
jsonObj
.
name
=
'
chameleon
'
;
})
})
/**
/**
* 编译结束进入打包阶段
* 编译结束进入打包阶段
*/
*/
compiler
.
hook
(
'
pack
'
,
function
(
projectGraph
)
{
compiler
.
hook
(
'
pack
'
,
function
(
projectGraph
)
{
compiler
.
writeFile
(
'
static/test
1
.js
'
,
'
dd
'
)
compiler
.
writeFile
(
'
static/test.js
'
,
'
dd
'
)
compiler
.
writeFile
(
'
static/css
1
.css
'
,
'
.class1 {color: red;}
'
)
compiler
.
writeFile
(
'
static/css.css
'
,
'
.class1 {color: red;}
'
)
})
})
cml
.
projectRoot
=
path
.
join
(
__dirname
,
'
demo-project
'
);
cml
.
projectRoot
=
path
.
join
(
__dirname
,
'
demo-project
'
);
cml
.
config
=
{
cml
.
config
=
{
get
()
{
get
()
{
return
{
return
{
subProject
:
[
'
cml-subproject
'
],
subProject
:
[
'
cml-subproject
'
],
wx
:
{
wx
:
{
dev
:
{
dev
:
{
minimize
:
true
,
minimize
:
true
,
hash
:
true
hash
:
true
}
}
}
}
}
}
}
}
}
}
let
result
=
compiler
.
getRouterConfig
();
let
result
=
compiler
.
getRouterConfig
();
...
...
packages/mvvm-pack/test/mvvmGraphPlugin.test.js
浏览文件 @
def5396c
...
@@ -187,7 +187,7 @@ describe('mvvmGraphPlugin.js', function() {
...
@@ -187,7 +187,7 @@ describe('mvvmGraphPlugin.js', function() {
dependencies
:
[],
dependencies
:
[],
_publicPath
:
'
static.chameleon.com
'
,
_publicPath
:
'
static.chameleon.com
'
,
request
:
'
request
'
,
request
:
'
request
'
,
resource
:
'
/pages/page
1
.cml
'
,
resource
:
'
/pages/page
a
.cml
'
,
rawRequest
:
'
rawRequest
'
,
rawRequest
:
'
rawRequest
'
,
id
:
'
id
'
id
:
'
id
'
}
}
...
@@ -199,7 +199,7 @@ describe('mvvmGraphPlugin.js', function() {
...
@@ -199,7 +199,7 @@ describe('mvvmGraphPlugin.js', function() {
dependencies
:
[],
dependencies
:
[],
_publicPath
:
'
static.chameleon.com
'
,
_publicPath
:
'
static.chameleon.com
'
,
request
:
'
request
'
,
request
:
'
request
'
,
resource
:
'
/pages/page
2
.cml
'
,
resource
:
'
/pages/page
b
.cml
'
,
rawRequest
:
'
rawRequest
'
,
rawRequest
:
'
rawRequest
'
,
id
:
'
id
'
id
:
'
id
'
}
}
...
@@ -243,7 +243,7 @@ describe('mvvmGraphPlugin.js', function() {
...
@@ -243,7 +243,7 @@ describe('mvvmGraphPlugin.js', function() {
let
templateModule
=
{
let
templateModule
=
{
_source
:
{
_source
:
{
_value
:
`<view></view>`
_value
:
'
<view></view>
'
},
},
_moduleType
:
'
template
'
,
_moduleType
:
'
template
'
,
dependencies
:
[],
dependencies
:
[],
...
@@ -255,7 +255,7 @@ describe('mvvmGraphPlugin.js', function() {
...
@@ -255,7 +255,7 @@ describe('mvvmGraphPlugin.js', function() {
let
json1Module
=
{
let
json1Module
=
{
_source
:
{
_source
:
{
_value
:
`{"a":"a"}`
_value
:
'
{"a":"a"}
'
},
},
_moduleType
:
'
json
'
,
_moduleType
:
'
json
'
,
dependencies
:
[],
dependencies
:
[],
...
@@ -266,7 +266,7 @@ describe('mvvmGraphPlugin.js', function() {
...
@@ -266,7 +266,7 @@ describe('mvvmGraphPlugin.js', function() {
}
}
let
json2Module
=
{
let
json2Module
=
{
_source
:
{
_source
:
{
_value
:
`module.exports = {a:'a'}`
_value
:
'
module.exports = {a:
\'
a
\'
}
'
},
},
_moduleType
:
'
json
'
,
_moduleType
:
'
json
'
,
dependencies
:
[],
dependencies
:
[],
...
@@ -278,7 +278,7 @@ describe('mvvmGraphPlugin.js', function() {
...
@@ -278,7 +278,7 @@ describe('mvvmGraphPlugin.js', function() {
let
scriptModule
=
{
let
scriptModule
=
{
_source
:
{
_source
:
{
_value
:
`module.exports = {}`
_value
:
'
module.exports = {}
'
},
},
_moduleType
:
'
script
'
,
_moduleType
:
'
script
'
,
dependencies
:
[],
dependencies
:
[],
...
@@ -308,7 +308,7 @@ describe('mvvmGraphPlugin.js', function() {
...
@@ -308,7 +308,7 @@ describe('mvvmGraphPlugin.js', function() {
module
:
scriptModule
module
:
scriptModule
}],
}],
request
:
'
request
'
,
request
:
'
request
'
,
resource
:
'
/pages/page
1
.cml
'
,
resource
:
'
/pages/page
a
.cml
'
,
rawRequest
:
'
rawRequest
'
,
rawRequest
:
'
rawRequest
'
,
id
:
'
id
'
id
:
'
id
'
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录