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
2eb0fe6d
Commit
2eb0fe6d
authored
Dec 10, 2019
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复内联过程代码没有抽离的问题
parent
4e592f36
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
63 additions
and
63 deletions
+63
-63
index.es.js
dist/index.es.js
+15
-15
index.es.js.map
dist/index.es.js.map
+1
-1
index.js
dist/index.js
+15
-15
index.js.map
dist/index.js.map
+1
-1
index.umd.js
dist/index.umd.js
+15
-15
index.umd.js.map
dist/index.umd.js.map
+1
-1
ProcessManager.js
src/ProcessManager.js
+7
-8
index.js
src/index.js
+8
-7
No files found.
dist/index.es.js
View file @
2eb0fe6d
...
...
@@ -56,10 +56,7 @@ class ProcessManager {
}
if
(
process
.
metas
)
{
for
(
let
subProcess
of
process
.
metas
)
{
let
hash
=
this
.
put
(
subProcess
);
if
(
hash
)
{
subProcess
.
script
=
'link://'
+
hash
;
}
this
.
deal
(
subProcess
);
}
}
}
...
...
@@ -83,7 +80,9 @@ class ProcessManager {
let
scripts
=
''
;
for
(
let
hash
in
this
.
pool
)
{
let
{
script
,
ids
}
=
this
.
pool
[
hash
];
let
idsComment
=
ids
.
map
(
id
=>
{
return
`/*==
${
id
}
==*/`
}).
join
(
'
\
n'
);
let
idsComment
=
ids
.
map
(
id
=>
{
return
`/*==
${
id
}
==*/`
}).
join
(
'
\
n'
);
scripts
+=
`
exports['
${
hash
}
'] = function(args, props, target, global, vm){
return new Promise(function(resolve, reject){
...
...
@@ -100,11 +99,11 @@ ${script}
this
.
pool
=
{};
}
async
compile
(){
async
compile
()
{
try
{
const
{
code
,
sourcemap
}
=
await
compile
(
this
.
scripts
,
true
);
const
{
code
,
sourcemap
}
=
await
compile
(
this
.
scripts
,
true
);
this
.
scripts
=
code
;
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'编译失败'
,
e
);
}
}
...
...
@@ -348,19 +347,20 @@ async function packData(data, {debug, packedAssets, getProcesses, getScripts, ge
}
const
unusedFields
=
[
'design'
];
function
deleteUnusedData
(
processes
){
for
(
let
process
of
processes
){
if
(
process
.
sub
){
for
(
let
uuid
in
process
.
sub
){
function
deleteUnusedData
(
processes
)
{
for
(
let
process
of
processes
)
{
if
(
process
.
sub
)
{
for
(
let
uuid
in
process
.
sub
)
{
let
subProcess
=
process
.
sub
[
uuid
];
for
(
let
field
of
unusedFields
)
{
if
(
subProcess
.
hasOwnProperty
(
field
))
{
for
(
let
field
of
unusedFields
)
{
if
(
subProcess
.
hasOwnProperty
(
field
))
{
delete
subProcess
[
field
];
}
}
}
}
if
(
process
.
metas
&&
process
.
metas
.
length
>
0
)
{
if
(
process
.
metas
&&
process
.
metas
.
length
>
0
)
{
deleteUnusedData
(
process
.
metas
);
}
}
...
...
dist/index.es.js.map
View file @
2eb0fe6d
This diff is collapsed.
Click to expand it.
dist/index.js
View file @
2eb0fe6d
...
...
@@ -62,10 +62,7 @@ class ProcessManager {
}
if
(
process
.
metas
)
{
for
(
let
subProcess
of
process
.
metas
)
{
let
hash
=
this
.
put
(
subProcess
);
if
(
hash
)
{
subProcess
.
script
=
'link://'
+
hash
;
}
this
.
deal
(
subProcess
);
}
}
}
...
...
@@ -89,7 +86,9 @@ class ProcessManager {
let
scripts
=
''
;
for
(
let
hash
in
this
.
pool
)
{
let
{
script
,
ids
}
=
this
.
pool
[
hash
];
let
idsComment
=
ids
.
map
(
id
=>
{
return
`/*==
${
id
}
==*/`
}).
join
(
'
\
n'
);
let
idsComment
=
ids
.
map
(
id
=>
{
return
`/*==
${
id
}
==*/`
}).
join
(
'
\
n'
);
scripts
+=
`
exports['
${
hash
}
'] = function(args, props, target, global, vm){
return new Promise(function(resolve, reject){
...
...
@@ -106,11 +105,11 @@ ${script}
this
.
pool
=
{};
}
async
compile
(){
async
compile
()
{
try
{
const
{
code
,
sourcemap
}
=
await
compile
(
this
.
scripts
,
true
);
const
{
code
,
sourcemap
}
=
await
compile
(
this
.
scripts
,
true
);
this
.
scripts
=
code
;
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'编译失败'
,
e
);
}
}
...
...
@@ -354,19 +353,20 @@ async function packData(data, {debug, packedAssets, getProcesses, getScripts, ge
}
const
unusedFields
=
[
'design'
];
function
deleteUnusedData
(
processes
){
for
(
let
process
of
processes
){
if
(
process
.
sub
){
for
(
let
uuid
in
process
.
sub
){
function
deleteUnusedData
(
processes
)
{
for
(
let
process
of
processes
)
{
if
(
process
.
sub
)
{
for
(
let
uuid
in
process
.
sub
)
{
let
subProcess
=
process
.
sub
[
uuid
];
for
(
let
field
of
unusedFields
)
{
if
(
subProcess
.
hasOwnProperty
(
field
))
{
for
(
let
field
of
unusedFields
)
{
if
(
subProcess
.
hasOwnProperty
(
field
))
{
delete
subProcess
[
field
];
}
}
}
}
if
(
process
.
metas
&&
process
.
metas
.
length
>
0
)
{
if
(
process
.
metas
&&
process
.
metas
.
length
>
0
)
{
deleteUnusedData
(
process
.
metas
);
}
}
...
...
dist/index.js.map
View file @
2eb0fe6d
This diff is collapsed.
Click to expand it.
dist/index.umd.js
View file @
2eb0fe6d
...
...
@@ -62,10 +62,7 @@
}
if
(
process
.
metas
)
{
for
(
let
subProcess
of
process
.
metas
)
{
let
hash
=
this
.
put
(
subProcess
);
if
(
hash
)
{
subProcess
.
script
=
'link://'
+
hash
;
}
this
.
deal
(
subProcess
);
}
}
}
...
...
@@ -89,7 +86,9 @@
let
scripts
=
''
;
for
(
let
hash
in
this
.
pool
)
{
let
{
script
,
ids
}
=
this
.
pool
[
hash
];
let
idsComment
=
ids
.
map
(
id
=>
{
return
`/*==
${
id
}
==*/`
}).
join
(
'
\
n'
);
let
idsComment
=
ids
.
map
(
id
=>
{
return
`/*==
${
id
}
==*/`
}).
join
(
'
\
n'
);
scripts
+=
`
exports['
${
hash
}
'] = function(args, props, target, global, vm){
return new Promise(function(resolve, reject){
...
...
@@ -106,11 +105,11 @@ ${script}
this
.
pool
=
{};
}
async
compile
(){
async
compile
()
{
try
{
const
{
code
,
sourcemap
}
=
await
compile
(
this
.
scripts
,
true
);
const
{
code
,
sourcemap
}
=
await
compile
(
this
.
scripts
,
true
);
this
.
scripts
=
code
;
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'编译失败'
,
e
);
}
}
...
...
@@ -354,19 +353,20 @@ ${scripts}
}
const
unusedFields
=
[
'design'
];
function
deleteUnusedData
(
processes
){
for
(
let
process
of
processes
){
if
(
process
.
sub
){
for
(
let
uuid
in
process
.
sub
){
function
deleteUnusedData
(
processes
)
{
for
(
let
process
of
processes
)
{
if
(
process
.
sub
)
{
for
(
let
uuid
in
process
.
sub
)
{
let
subProcess
=
process
.
sub
[
uuid
];
for
(
let
field
of
unusedFields
)
{
if
(
subProcess
.
hasOwnProperty
(
field
))
{
for
(
let
field
of
unusedFields
)
{
if
(
subProcess
.
hasOwnProperty
(
field
))
{
delete
subProcess
[
field
];
}
}
}
}
if
(
process
.
metas
&&
process
.
metas
.
length
>
0
)
{
if
(
process
.
metas
&&
process
.
metas
.
length
>
0
)
{
deleteUnusedData
(
process
.
metas
);
}
}
...
...
dist/index.umd.js.map
View file @
2eb0fe6d
This diff is collapsed.
Click to expand it.
src/ProcessManager.js
View file @
2eb0fe6d
...
...
@@ -23,10 +23,7 @@ export default class ProcessManager {
}
if
(
process
.
metas
)
{
for
(
let
subProcess
of
process
.
metas
)
{
let
hash
=
this
.
put
(
subProcess
);
if
(
hash
)
{
subProcess
.
script
=
'link://'
+
hash
;
}
this
.
deal
(
subProcess
);
}
}
}
...
...
@@ -50,7 +47,9 @@ export default class ProcessManager {
let
scripts
=
''
;
for
(
let
hash
in
this
.
pool
)
{
let
{
script
,
ids
}
=
this
.
pool
[
hash
];
let
idsComment
=
ids
.
map
(
id
=>
{
return
`/*==
${
id
}
==*/`
}).
join
(
'
\
n'
);
let
idsComment
=
ids
.
map
(
id
=>
{
return
`/*==
${
id
}
==*/`
}).
join
(
'
\
n'
);
scripts
+=
`
exports['
${
hash
}
'] = function(args, props, target, global, vm){
return new Promise(function(resolve, reject){
...
...
@@ -67,11 +66,11 @@ ${script}
this
.
pool
=
{};
}
async
compile
(){
async
compile
()
{
try
{
const
{
code
,
sourcemap
}
=
await
compile
(
this
.
scripts
,
true
);
const
{
code
,
sourcemap
}
=
await
compile
(
this
.
scripts
,
true
);
this
.
scripts
=
code
;
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'编译失败'
,
e
);
}
}
...
...
src/index.js
View file @
2eb0fe6d
...
...
@@ -151,19 +151,20 @@ async function packData(data, {debug, packedAssets, getProcesses, getScripts, ge
}
const
unusedFields
=
[
'design'
];
function
deleteUnusedData
(
processes
){
for
(
let
process
of
processes
){
if
(
process
.
sub
){
for
(
let
uuid
in
process
.
sub
){
function
deleteUnusedData
(
processes
)
{
for
(
let
process
of
processes
)
{
if
(
process
.
sub
)
{
for
(
let
uuid
in
process
.
sub
)
{
let
subProcess
=
process
.
sub
[
uuid
];
for
(
let
field
of
unusedFields
)
{
if
(
subProcess
.
hasOwnProperty
(
field
))
{
for
(
let
field
of
unusedFields
)
{
if
(
subProcess
.
hasOwnProperty
(
field
))
{
delete
subProcess
[
field
];
}
}
}
}
if
(
process
.
metas
&&
process
.
metas
.
length
>
0
)
{
if
(
process
.
metas
&&
process
.
metas
.
length
>
0
)
{
deleteUnusedData
(
process
.
metas
);
}
}
...
...
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