Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scilla-declare-generator
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
劳工
scilla-declare-generator
Commits
5238c6c8
Commit
5238c6c8
authored
Jul 16, 2019
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
适配scilla-engine
parent
ce220d6a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
10 deletions
+22
-10
index.js
src/index.js
+22
-10
No files found.
src/index.js
View file @
5238c6c8
...
...
@@ -10,8 +10,8 @@ let _componentsSrcPath;
let
_projectPath
;
let
_assetsPath
;
let
_filter
;
let
_nodeModulesPathMap
;
const
scillaCorePrefix
=
'node_modules/scilla/src'
;
const
componentBaseClassNames
=
[
'"scilla/core/Component".Component'
,
'"components/base/ScillaComponent".ScillaComponent'
,
...
...
@@ -20,11 +20,12 @@ const componentBaseClassNames = [
const
showLog
=
false
;
const
showVerboseLog
=
false
;
exports
.
generateDeclareMap
=
function
(
tsconfig
,
dependencies
,
file
,
componentsPath
,
projectPath
,
assetsPath
,
filter
)
{
exports
.
generateDeclareMap
=
function
(
tsconfig
,
dependencies
,
file
,
componentsPath
,
projectPath
,
assetsPath
,
filter
,
nodeModulesPathMap
)
{
_componentsSrcPath
=
path
.
join
(
componentsPath
,
'src'
);
_projectPath
=
projectPath
;
_assetsPath
=
assetsPath
;
_filter
=
filter
;
_nodeModulesPathMap
=
nodeModulesPathMap
;
const
config
=
ts
.
parseJsonConfigFileContent
(
tsconfig
,
ts
.
sys
,
projectPath
);
...
...
@@ -54,18 +55,18 @@ exports.generateDeclareMap = function(tsconfig, dependencies, file, componentsPa
if
(
showLog
)
console
.
time
(
'delint'
);
for
(
let
sourceFile
of
sourceFiles
){
if
(
sourceFile
.
fileName
.
indexOf
(
'.d.ts'
)
<
0
)
{
if
(
!
_filter
||
_filter
(
sourceFile
))
{
if
(
!
_filter
||
_filter
(
sourceFile
))
{
const
fileName
=
sourceFile
.
fileName
;
if
(
sourceFile
.
resolvedModules
)
{
sourceFile
.
resolvedModules
.
forEach
((
item
,
key
)
=>
{
if
(
!
item
)
{
if
(
sourceFile
.
resolvedModules
)
{
sourceFile
.
resolvedModules
.
forEach
((
item
,
key
)
=>
{
if
(
!
item
)
{
missingDependencies
.
push
(
key
);
}
});
}
if
(
showLog
&&
showVerboseLog
)
console
.
time
(
fileName
);
if
(
showLog
&&
showVerboseLog
)
console
.
time
(
fileName
);
delint
(
checker
,
sourceFile
);
if
(
showLog
&&
showVerboseLog
)
console
.
timeEnd
(
fileName
);
if
(
showLog
&&
showVerboseLog
)
console
.
timeEnd
(
fileName
);
}
}
}
...
...
@@ -225,8 +226,19 @@ function getFullyQualifiedNameOfType(type, checker) {
if
(
fullClassName
.
indexOf
(
'
\
"'
)
>=
0
)
{
path
=
fullClassName
.
substring
(
1
,
fullClassName
.
lastIndexOf
(
'.'
)
-
1
);
className
=
fullClassName
.
substring
(
fullClassName
.
lastIndexOf
(
'.'
)
+
1
);
if
(
path
.
indexOf
(
scillaCorePrefix
)
>=
0
)
{
path
=
path
.
substr
(
path
.
indexOf
(
scillaCorePrefix
)).
replace
(
scillaCorePrefix
,
'scilla'
);
let
resolved
=
false
;
if
(
_nodeModulesPathMap
){
for
(
let
key
in
_nodeModulesPathMap
){
if
(
path
.
indexOf
(
key
)
>=
0
)
{
path
=
path
.
substr
(
path
.
indexOf
(
key
)).
replace
(
key
,
_nodeModulesPathMap
[
key
]);
resolved
=
true
;
break
;
}
}
}
if
(
resolved
)
{
}
else
if
(
path
.
indexOf
(
_assetsPath
)
>=
0
)
{
path
=
path
.
replace
(
_assetsPath
,
'.'
)
}
else
if
(
path
.
indexOf
(
'src'
)
===
0
){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment