Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-pack
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
劳工
zeroing-pack
Commits
519d7866
Commit
519d7866
authored
Nov 15, 2019
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
处理循环依赖的逻辑
parent
7e2446b6
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
191 additions
and
47 deletions
+191
-47
index.es.js
dist/index.es.js
+42
-11
index.es.js.map
dist/index.es.js.map
+1
-1
index.js
dist/index.js
+42
-11
index.js.map
dist/index.js.map
+1
-1
index.umd.js
dist/index.umd.js
+42
-11
index.umd.js.map
dist/index.umd.js.map
+1
-1
index.js
src/index.js
+42
-11
project.js
tests/project.js
+4
-0
test.js
tests/test.js
+16
-0
No files found.
dist/index.es.js
View file @
519d7866
...
@@ -44,7 +44,7 @@ async function packData(data, {getProcesses, getScripts}) {
...
@@ -44,7 +44,7 @@ async function packData(data, {getProcesses, getScripts}) {
}
}
//console.log('scriptIDs:', scriptIDs);
//console.log('scriptIDs:', scriptIDs);
let
scriptsContainer
=
newData
.
scripts
=
{};
let
scriptsContainer
=
newData
.
scripts
=
{};
if
(
scriptIDs
.
length
>
0
)
{
if
(
scriptIDs
.
length
>
0
)
{
const
scripts
=
await
getScripts
(
scriptIDs
);
const
scripts
=
await
getScripts
(
scriptIDs
);
for
(
let
scriptData
of
scripts
)
{
for
(
let
scriptData
of
scripts
)
{
let
{
id
,
code
}
=
JSON
.
parse
(
scriptData
);
let
{
id
,
code
}
=
JSON
.
parse
(
scriptData
);
...
@@ -54,26 +54,57 @@ async function packData(data, {getProcesses, getScripts}) {
...
@@ -54,26 +54,57 @@ async function packData(data, {getProcesses, getScripts}) {
}
}
let
processIDs
=
[];
let
processIDs
=
[];
for
(
let
process
of
newData
.
processes
)
{
findDepPidsBat
(
processIDs
,
newData
.
processes
);
//console.log('processIDs:', processIDs);
let
builtinProcesses
=
newData
.
builtinProcesses
=
[];
let
bProcessIDs
=
processIDs
;
while
(
true
)
{
let
newPids
=
await
addBuiltinProcesses
(
builtinProcesses
,
bProcessIDs
,
getProcesses
);
bProcessIDs
=
[];
for
(
let
id
of
newPids
)
{
if
(
!
processIDs
.
includes
(
id
))
{
bProcessIDs
.
push
(
id
);
processIDs
.
push
(
id
);
}
}
if
(
bProcessIDs
.
length
===
0
)
{
break
;
}
}
return
JSON
.
stringify
(
newData
);
}
function
findDepPids
(
list
,
process
)
{
if
(
process
.
sub
){
for
(
let
key
in
process
.
sub
)
{
for
(
let
key
in
process
.
sub
)
{
let
p
=
process
.
sub
[
key
];
let
p
=
process
.
sub
[
key
];
if
(
!
processIDs
.
includes
(
p
.
meta
))
{
if
(
!
list
.
includes
(
p
.
meta
))
{
processIDs
.
push
(
p
.
meta
);
list
.
push
(
p
.
meta
);
}
}
}
}
}
}
//console.log('processIDs:', processIDs);
}
let
builtinProcesses
=
newData
.
builtinProcesses
=
[];
if
(
processIDs
.
length
>
0
){
function
findDepPidsBat
(
list
,
processes
)
{
let
processes
=
await
getProcesses
(
processIDs
);
for
(
let
process
of
processes
)
{
findDepPids
(
list
,
process
);
}
}
async
function
addBuiltinProcesses
(
list
,
ids
,
getProcesses
)
{
let
newPids
=
[];
if
(
ids
.
length
>
0
)
{
let
processes
=
await
getProcesses
(
ids
);
for
(
let
processData
of
processes
)
{
for
(
let
processData
of
processes
)
{
let
process
=
JSON
.
parse
(
processData
);
let
process
=
JSON
.
parse
(
processData
);
builtinProcesses
.
push
(
process
);
list
.
push
(
process
);
findDepPids
(
newPids
,
process
);
}
}
//console.log('processes:', data.processes);
//console.log('processes:', data.processes);
}
}
return
newPids
;
return
JSON
.
stringify
(
newData
);
}
}
async
function
pageTemplate
(
data
,
options
,
version
)
{
async
function
pageTemplate
(
data
,
options
,
version
)
{
...
...
dist/index.es.js.map
View file @
519d7866
This diff is collapsed.
Click to expand it.
dist/index.js
View file @
519d7866
...
@@ -48,7 +48,7 @@ async function packData(data, {getProcesses, getScripts}) {
...
@@ -48,7 +48,7 @@ async function packData(data, {getProcesses, getScripts}) {
}
}
//console.log('scriptIDs:', scriptIDs);
//console.log('scriptIDs:', scriptIDs);
let
scriptsContainer
=
newData
.
scripts
=
{};
let
scriptsContainer
=
newData
.
scripts
=
{};
if
(
scriptIDs
.
length
>
0
)
{
if
(
scriptIDs
.
length
>
0
)
{
const
scripts
=
await
getScripts
(
scriptIDs
);
const
scripts
=
await
getScripts
(
scriptIDs
);
for
(
let
scriptData
of
scripts
)
{
for
(
let
scriptData
of
scripts
)
{
let
{
id
,
code
}
=
JSON
.
parse
(
scriptData
);
let
{
id
,
code
}
=
JSON
.
parse
(
scriptData
);
...
@@ -58,26 +58,57 @@ async function packData(data, {getProcesses, getScripts}) {
...
@@ -58,26 +58,57 @@ async function packData(data, {getProcesses, getScripts}) {
}
}
let
processIDs
=
[];
let
processIDs
=
[];
for
(
let
process
of
newData
.
processes
)
{
findDepPidsBat
(
processIDs
,
newData
.
processes
);
//console.log('processIDs:', processIDs);
let
builtinProcesses
=
newData
.
builtinProcesses
=
[];
let
bProcessIDs
=
processIDs
;
while
(
true
)
{
let
newPids
=
await
addBuiltinProcesses
(
builtinProcesses
,
bProcessIDs
,
getProcesses
);
bProcessIDs
=
[];
for
(
let
id
of
newPids
)
{
if
(
!
processIDs
.
includes
(
id
))
{
bProcessIDs
.
push
(
id
);
processIDs
.
push
(
id
);
}
}
if
(
bProcessIDs
.
length
===
0
)
{
break
;
}
}
return
JSON
.
stringify
(
newData
);
}
function
findDepPids
(
list
,
process
)
{
if
(
process
.
sub
){
for
(
let
key
in
process
.
sub
)
{
for
(
let
key
in
process
.
sub
)
{
let
p
=
process
.
sub
[
key
];
let
p
=
process
.
sub
[
key
];
if
(
!
processIDs
.
includes
(
p
.
meta
))
{
if
(
!
list
.
includes
(
p
.
meta
))
{
processIDs
.
push
(
p
.
meta
);
list
.
push
(
p
.
meta
);
}
}
}
}
}
}
//console.log('processIDs:', processIDs);
}
let
builtinProcesses
=
newData
.
builtinProcesses
=
[];
if
(
processIDs
.
length
>
0
){
function
findDepPidsBat
(
list
,
processes
)
{
let
processes
=
await
getProcesses
(
processIDs
);
for
(
let
process
of
processes
)
{
findDepPids
(
list
,
process
);
}
}
async
function
addBuiltinProcesses
(
list
,
ids
,
getProcesses
)
{
let
newPids
=
[];
if
(
ids
.
length
>
0
)
{
let
processes
=
await
getProcesses
(
ids
);
for
(
let
processData
of
processes
)
{
for
(
let
processData
of
processes
)
{
let
process
=
JSON
.
parse
(
processData
);
let
process
=
JSON
.
parse
(
processData
);
builtinProcesses
.
push
(
process
);
list
.
push
(
process
);
findDepPids
(
newPids
,
process
);
}
}
//console.log('processes:', data.processes);
//console.log('processes:', data.processes);
}
}
return
newPids
;
return
JSON
.
stringify
(
newData
);
}
}
async
function
pageTemplate
(
data
,
options
,
version
)
{
async
function
pageTemplate
(
data
,
options
,
version
)
{
...
...
dist/index.js.map
View file @
519d7866
This diff is collapsed.
Click to expand it.
dist/index.umd.js
View file @
519d7866
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
}
}
//console.log('scriptIDs:', scriptIDs);
//console.log('scriptIDs:', scriptIDs);
let
scriptsContainer
=
newData
.
scripts
=
{};
let
scriptsContainer
=
newData
.
scripts
=
{};
if
(
scriptIDs
.
length
>
0
)
{
if
(
scriptIDs
.
length
>
0
)
{
const
scripts
=
await
getScripts
(
scriptIDs
);
const
scripts
=
await
getScripts
(
scriptIDs
);
for
(
let
scriptData
of
scripts
)
{
for
(
let
scriptData
of
scripts
)
{
let
{
id
,
code
}
=
JSON
.
parse
(
scriptData
);
let
{
id
,
code
}
=
JSON
.
parse
(
scriptData
);
...
@@ -60,26 +60,57 @@
...
@@ -60,26 +60,57 @@
}
}
let
processIDs
=
[];
let
processIDs
=
[];
for
(
let
process
of
newData
.
processes
)
{
findDepPidsBat
(
processIDs
,
newData
.
processes
);
//console.log('processIDs:', processIDs);
let
builtinProcesses
=
newData
.
builtinProcesses
=
[];
let
bProcessIDs
=
processIDs
;
while
(
true
)
{
let
newPids
=
await
addBuiltinProcesses
(
builtinProcesses
,
bProcessIDs
,
getProcesses
);
bProcessIDs
=
[];
for
(
let
id
of
newPids
)
{
if
(
!
processIDs
.
includes
(
id
))
{
bProcessIDs
.
push
(
id
);
processIDs
.
push
(
id
);
}
}
if
(
bProcessIDs
.
length
===
0
)
{
break
;
}
}
return
JSON
.
stringify
(
newData
);
}
function
findDepPids
(
list
,
process
)
{
if
(
process
.
sub
){
for
(
let
key
in
process
.
sub
)
{
for
(
let
key
in
process
.
sub
)
{
let
p
=
process
.
sub
[
key
];
let
p
=
process
.
sub
[
key
];
if
(
!
processIDs
.
includes
(
p
.
meta
))
{
if
(
!
list
.
includes
(
p
.
meta
))
{
processIDs
.
push
(
p
.
meta
);
list
.
push
(
p
.
meta
);
}
}
}
}
}
}
//console.log('processIDs:', processIDs);
}
let
builtinProcesses
=
newData
.
builtinProcesses
=
[];
if
(
processIDs
.
length
>
0
){
function
findDepPidsBat
(
list
,
processes
)
{
let
processes
=
await
getProcesses
(
processIDs
);
for
(
let
process
of
processes
)
{
findDepPids
(
list
,
process
);
}
}
async
function
addBuiltinProcesses
(
list
,
ids
,
getProcesses
)
{
let
newPids
=
[];
if
(
ids
.
length
>
0
)
{
let
processes
=
await
getProcesses
(
ids
);
for
(
let
processData
of
processes
)
{
for
(
let
processData
of
processes
)
{
let
process
=
JSON
.
parse
(
processData
);
let
process
=
JSON
.
parse
(
processData
);
builtinProcesses
.
push
(
process
);
list
.
push
(
process
);
findDepPids
(
newPids
,
process
);
}
}
//console.log('processes:', data.processes);
//console.log('processes:', data.processes);
}
}
return
newPids
;
return
JSON
.
stringify
(
newData
);
}
}
async
function
pageTemplate
(
data
,
options
,
version
)
{
async
function
pageTemplate
(
data
,
options
,
version
)
{
...
...
dist/index.umd.js.map
View file @
519d7866
This diff is collapsed.
Click to expand it.
src/index.js
View file @
519d7866
...
@@ -44,7 +44,7 @@ async function packData(data, {getProcesses, getScripts}) {
...
@@ -44,7 +44,7 @@ async function packData(data, {getProcesses, getScripts}) {
}
}
//console.log('scriptIDs:', scriptIDs);
//console.log('scriptIDs:', scriptIDs);
let
scriptsContainer
=
newData
.
scripts
=
{};
let
scriptsContainer
=
newData
.
scripts
=
{};
if
(
scriptIDs
.
length
>
0
)
{
if
(
scriptIDs
.
length
>
0
)
{
const
scripts
=
await
getScripts
(
scriptIDs
);
const
scripts
=
await
getScripts
(
scriptIDs
);
for
(
let
scriptData
of
scripts
)
{
for
(
let
scriptData
of
scripts
)
{
let
{
id
,
code
}
=
JSON
.
parse
(
scriptData
);
let
{
id
,
code
}
=
JSON
.
parse
(
scriptData
);
...
@@ -54,26 +54,57 @@ async function packData(data, {getProcesses, getScripts}) {
...
@@ -54,26 +54,57 @@ async function packData(data, {getProcesses, getScripts}) {
}
}
let
processIDs
=
[];
let
processIDs
=
[];
for
(
let
process
of
newData
.
processes
)
{
findDepPidsBat
(
processIDs
,
newData
.
processes
);
//console.log('processIDs:', processIDs);
let
builtinProcesses
=
newData
.
builtinProcesses
=
[];
let
bProcessIDs
=
processIDs
;
while
(
true
)
{
let
newPids
=
await
addBuiltinProcesses
(
builtinProcesses
,
bProcessIDs
,
getProcesses
);
bProcessIDs
=
[];
for
(
let
id
of
newPids
)
{
if
(
!
processIDs
.
includes
(
id
))
{
bProcessIDs
.
push
(
id
);
processIDs
.
push
(
id
);
}
}
if
(
bProcessIDs
.
length
===
0
)
{
break
;
}
}
return
JSON
.
stringify
(
newData
);
}
function
findDepPids
(
list
,
process
)
{
if
(
process
.
sub
){
for
(
let
key
in
process
.
sub
)
{
for
(
let
key
in
process
.
sub
)
{
let
p
=
process
.
sub
[
key
];
let
p
=
process
.
sub
[
key
];
if
(
!
processIDs
.
includes
(
p
.
meta
))
{
if
(
!
list
.
includes
(
p
.
meta
))
{
processIDs
.
push
(
p
.
meta
);
list
.
push
(
p
.
meta
);
}
}
}
}
}
}
//console.log('processIDs:', processIDs);
}
let
builtinProcesses
=
newData
.
builtinProcesses
=
[];
if
(
processIDs
.
length
>
0
){
function
findDepPidsBat
(
list
,
processes
)
{
let
processes
=
await
getProcesses
(
processIDs
);
for
(
let
process
of
processes
)
{
findDepPids
(
list
,
process
);
}
}
async
function
addBuiltinProcesses
(
list
,
ids
,
getProcesses
)
{
let
newPids
=
[];
if
(
ids
.
length
>
0
)
{
let
processes
=
await
getProcesses
(
ids
);
for
(
let
processData
of
processes
)
{
for
(
let
processData
of
processes
)
{
let
process
=
JSON
.
parse
(
processData
);
let
process
=
JSON
.
parse
(
processData
);
builtinProcesses
.
push
(
process
);
list
.
push
(
process
);
findDepPids
(
newPids
,
process
);
}
}
//console.log('processes:', data.processes);
//console.log('processes:', data.processes);
}
}
return
newPids
;
return
JSON
.
stringify
(
newData
);
}
}
async
function
pageTemplate
(
data
,
options
,
version
)
{
async
function
pageTemplate
(
data
,
options
,
version
)
{
...
...
tests/project.js
View file @
519d7866
...
@@ -284,6 +284,10 @@ content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, u
...
@@ -284,6 +284,10 @@ content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, u
y
:
100
,
y
:
100
,
},
},
},
},
a3
:
{
uuid
:
'a3'
,
meta
:
'ddd'
}
}
}
},
},
{
{
...
...
tests/test.js
View file @
519d7866
...
@@ -26,6 +26,22 @@ function getProcesses(ids) {
...
@@ -26,6 +26,22 @@ function getProcesses(ids) {
script
:
"resolve({type: 'success', payload: args});"
,
script
:
"resolve({type: 'success', payload: args});"
,
output
:
[
'success'
],
output
:
[
'success'
],
}),
}),
JSON
.
stringify
({
id
:
'ddd'
,
name
:
'DDD'
,
props
:
{},
sub
:
{
1
:
{
uuid
:
1
,
meta
:
'eee'
,
}
}
}),
JSON
.
stringify
({
id
:
'eee'
,
name
:
'EEE'
,
props
:
{},
}),
]
]
}
}
...
...
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