Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
psd-parse
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
劳工
psd-parse
Commits
8417141f
Commit
8417141f
authored
Nov 28, 2019
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复png内容为空的情况
parent
45dacb44
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
59 additions
and
51 deletions
+59
-51
index.es.js
dist/index.es.js
+14
-12
index.es.js.map
dist/index.es.js.map
+1
-1
index.js
dist/index.js
+14
-12
index.js.map
dist/index.js.map
+1
-1
index.umd.js
dist/index.umd.js
+14
-12
index.umd.js.map
dist/index.umd.js.map
+1
-1
zeroing.js
src/zeroing.js
+14
-12
No files found.
dist/index.es.js
View file @
8417141f
...
...
@@ -280,14 +280,15 @@ async function execute$1(psdFile, options) {
const
uuid
=
generateUUID
();
const
ext
=
'.png'
;
properties
.
source
=
'asset://'
+
uuid
;
const
imageFilePath
=
path
.
join
(
imagesPath
,
uuid
+
ext
);
await
fs
.
ensureDir
(
path
.
dirname
(
imageFilePath
));
let
png
=
node
.
origin
.
toPng
();
let
buffer
=
await
savePng
(
png
,
imageFilePath
);
let
buffer
=
await
savePng
(
png
,
imageFilePath
)
.
catch
(
e
=>
{})
;
//await node.origin.saveAsPng(imageFilePath);
if
(
buffer
){
properties
.
source
=
'asset://'
+
uuid
;
const
hashFileName
=
hash
(
buffer
);
const
hashFilePath
=
path
.
join
(
imagesPath
,
hashFileName
+
ext
);
await
fs
.
rename
(
imageFilePath
,
hashFilePath
);
...
...
@@ -300,6 +301,7 @@ async function execute$1(psdFile, options) {
});
}
}
}
let
viewParent
=
parent
.
view
||
viewRoot
;
if
(
!
viewParent
.
hasOwnProperty
(
'children'
))
{
...
...
dist/index.es.js.map
View file @
8417141f
This diff is collapsed.
Click to expand it.
dist/index.js
View file @
8417141f
...
...
@@ -286,14 +286,15 @@ async function execute$1(psdFile, options) {
const
uuid
=
generateUUID
();
const
ext
=
'.png'
;
properties
.
source
=
'asset://'
+
uuid
;
const
imageFilePath
=
path
.
join
(
imagesPath
,
uuid
+
ext
);
await
fs
.
ensureDir
(
path
.
dirname
(
imageFilePath
));
let
png
=
node
.
origin
.
toPng
();
let
buffer
=
await
savePng
(
png
,
imageFilePath
);
let
buffer
=
await
savePng
(
png
,
imageFilePath
)
.
catch
(
e
=>
{})
;
//await node.origin.saveAsPng(imageFilePath);
if
(
buffer
){
properties
.
source
=
'asset://'
+
uuid
;
const
hashFileName
=
hash
(
buffer
);
const
hashFilePath
=
path
.
join
(
imagesPath
,
hashFileName
+
ext
);
await
fs
.
rename
(
imageFilePath
,
hashFilePath
);
...
...
@@ -306,6 +307,7 @@ async function execute$1(psdFile, options) {
});
}
}
}
let
viewParent
=
parent
.
view
||
viewRoot
;
if
(
!
viewParent
.
hasOwnProperty
(
'children'
))
{
...
...
dist/index.js.map
View file @
8417141f
This diff is collapsed.
Click to expand it.
dist/index.umd.js
View file @
8417141f
...
...
@@ -286,14 +286,15 @@
const
uuid
=
generateUUID
();
const
ext
=
'.png'
;
properties
.
source
=
'asset://'
+
uuid
;
const
imageFilePath
=
path
.
join
(
imagesPath
,
uuid
+
ext
);
await
fs
.
ensureDir
(
path
.
dirname
(
imageFilePath
));
let
png
=
node
.
origin
.
toPng
();
let
buffer
=
await
savePng
(
png
,
imageFilePath
);
let
buffer
=
await
savePng
(
png
,
imageFilePath
)
.
catch
(
e
=>
{})
;
//await node.origin.saveAsPng(imageFilePath);
if
(
buffer
){
properties
.
source
=
'asset://'
+
uuid
;
const
hashFileName
=
hash
(
buffer
);
const
hashFilePath
=
path
.
join
(
imagesPath
,
hashFileName
+
ext
);
await
fs
.
rename
(
imageFilePath
,
hashFilePath
);
...
...
@@ -306,6 +307,7 @@
});
}
}
}
let
viewParent
=
parent
.
view
||
viewRoot
;
if
(
!
viewParent
.
hasOwnProperty
(
'children'
))
{
...
...
dist/index.umd.js.map
View file @
8417141f
This diff is collapsed.
Click to expand it.
src/zeroing.js
View file @
8417141f
...
...
@@ -73,14 +73,15 @@ export async function execute(psdFile, options) {
const
uuid
=
generateUUID
();
const
ext
=
'.png'
;
properties
.
source
=
'asset://'
+
uuid
;
const
imageFilePath
=
path
.
join
(
imagesPath
,
uuid
+
ext
);
await
fs
.
ensureDir
(
path
.
dirname
(
imageFilePath
));
let
png
=
node
.
origin
.
toPng
();
let
buffer
=
await
savePng
(
png
,
imageFilePath
);
let
buffer
=
await
savePng
(
png
,
imageFilePath
)
.
catch
(
e
=>
{})
;
//await node.origin.saveAsPng(imageFilePath);
if
(
buffer
){
properties
.
source
=
'asset://'
+
uuid
;
const
hashFileName
=
hash
(
buffer
);
const
hashFilePath
=
path
.
join
(
imagesPath
,
hashFileName
+
ext
);
await
fs
.
rename
(
imageFilePath
,
hashFilePath
);
...
...
@@ -93,6 +94,7 @@ export async function execute(psdFile, options) {
});
}
}
}
let
viewParent
=
parent
.
view
||
viewRoot
;
if
(
!
viewParent
.
hasOwnProperty
(
'children'
))
{
...
...
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