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
Hide 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,24 +280,26 @@ async function execute$1(psdFile, options) {
...
@@ -280,24 +280,26 @@ async function execute$1(psdFile, options) {
const
uuid
=
generateUUID
();
const
uuid
=
generateUUID
();
const
ext
=
'.png'
;
const
ext
=
'.png'
;
properties
.
source
=
'asset://'
+
uuid
;
const
imageFilePath
=
path
.
join
(
imagesPath
,
uuid
+
ext
);
const
imageFilePath
=
path
.
join
(
imagesPath
,
uuid
+
ext
);
await
fs
.
ensureDir
(
path
.
dirname
(
imageFilePath
));
await
fs
.
ensureDir
(
path
.
dirname
(
imageFilePath
));
let
png
=
node
.
origin
.
toPng
();
let
png
=
node
.
origin
.
toPng
();
let
buffer
=
await
savePng
(
png
,
imageFilePath
);
let
buffer
=
await
savePng
(
png
,
imageFilePath
)
.
catch
(
e
=>
{})
;
//await node.origin.saveAsPng(imageFilePath);
//await node.origin.saveAsPng(imageFilePath);
const
hashFileName
=
hash
(
buffer
);
if
(
buffer
){
const
hashFilePath
=
path
.
join
(
imagesPath
,
hashFileName
+
ext
);
properties
.
source
=
'asset://'
+
uuid
;
await
fs
.
rename
(
imageFilePath
,
hashFilePath
);
const
hashFileName
=
hash
(
buffer
);
const
hashFilePath
=
path
.
join
(
imagesPath
,
hashFileName
+
ext
);
await
fs
.
rename
(
imageFilePath
,
hashFilePath
);
assets
.
push
({
assets
.
push
({
name
,
name
,
ext
,
ext
,
uuid
,
uuid
,
hash
:
hashFileName
,
hash
:
hashFileName
,
});
});
}
}
}
}
}
...
...
dist/index.es.js.map
View file @
8417141f
This diff is collapsed.
Click to expand it.
dist/index.js
View file @
8417141f
...
@@ -286,24 +286,26 @@ async function execute$1(psdFile, options) {
...
@@ -286,24 +286,26 @@ async function execute$1(psdFile, options) {
const
uuid
=
generateUUID
();
const
uuid
=
generateUUID
();
const
ext
=
'.png'
;
const
ext
=
'.png'
;
properties
.
source
=
'asset://'
+
uuid
;
const
imageFilePath
=
path
.
join
(
imagesPath
,
uuid
+
ext
);
const
imageFilePath
=
path
.
join
(
imagesPath
,
uuid
+
ext
);
await
fs
.
ensureDir
(
path
.
dirname
(
imageFilePath
));
await
fs
.
ensureDir
(
path
.
dirname
(
imageFilePath
));
let
png
=
node
.
origin
.
toPng
();
let
png
=
node
.
origin
.
toPng
();
let
buffer
=
await
savePng
(
png
,
imageFilePath
);
let
buffer
=
await
savePng
(
png
,
imageFilePath
)
.
catch
(
e
=>
{})
;
//await node.origin.saveAsPng(imageFilePath);
//await node.origin.saveAsPng(imageFilePath);
const
hashFileName
=
hash
(
buffer
);
if
(
buffer
){
const
hashFilePath
=
path
.
join
(
imagesPath
,
hashFileName
+
ext
);
properties
.
source
=
'asset://'
+
uuid
;
await
fs
.
rename
(
imageFilePath
,
hashFilePath
);
const
hashFileName
=
hash
(
buffer
);
const
hashFilePath
=
path
.
join
(
imagesPath
,
hashFileName
+
ext
);
await
fs
.
rename
(
imageFilePath
,
hashFilePath
);
assets
.
push
({
assets
.
push
({
name
,
name
,
ext
,
ext
,
uuid
,
uuid
,
hash
:
hashFileName
,
hash
:
hashFileName
,
});
});
}
}
}
}
}
...
...
dist/index.js.map
View file @
8417141f
This diff is collapsed.
Click to expand it.
dist/index.umd.js
View file @
8417141f
...
@@ -286,24 +286,26 @@
...
@@ -286,24 +286,26 @@
const
uuid
=
generateUUID
();
const
uuid
=
generateUUID
();
const
ext
=
'.png'
;
const
ext
=
'.png'
;
properties
.
source
=
'asset://'
+
uuid
;
const
imageFilePath
=
path
.
join
(
imagesPath
,
uuid
+
ext
);
const
imageFilePath
=
path
.
join
(
imagesPath
,
uuid
+
ext
);
await
fs
.
ensureDir
(
path
.
dirname
(
imageFilePath
));
await
fs
.
ensureDir
(
path
.
dirname
(
imageFilePath
));
let
png
=
node
.
origin
.
toPng
();
let
png
=
node
.
origin
.
toPng
();
let
buffer
=
await
savePng
(
png
,
imageFilePath
);
let
buffer
=
await
savePng
(
png
,
imageFilePath
)
.
catch
(
e
=>
{})
;
//await node.origin.saveAsPng(imageFilePath);
//await node.origin.saveAsPng(imageFilePath);
const
hashFileName
=
hash
(
buffer
);
if
(
buffer
){
const
hashFilePath
=
path
.
join
(
imagesPath
,
hashFileName
+
ext
);
properties
.
source
=
'asset://'
+
uuid
;
await
fs
.
rename
(
imageFilePath
,
hashFilePath
);
const
hashFileName
=
hash
(
buffer
);
const
hashFilePath
=
path
.
join
(
imagesPath
,
hashFileName
+
ext
);
await
fs
.
rename
(
imageFilePath
,
hashFilePath
);
assets
.
push
({
assets
.
push
({
name
,
name
,
ext
,
ext
,
uuid
,
uuid
,
hash
:
hashFileName
,
hash
:
hashFileName
,
});
});
}
}
}
}
}
...
...
dist/index.umd.js.map
View file @
8417141f
This diff is collapsed.
Click to expand it.
src/zeroing.js
View file @
8417141f
...
@@ -73,24 +73,26 @@ export async function execute(psdFile, options) {
...
@@ -73,24 +73,26 @@ export async function execute(psdFile, options) {
const
uuid
=
generateUUID
();
const
uuid
=
generateUUID
();
const
ext
=
'.png'
;
const
ext
=
'.png'
;
properties
.
source
=
'asset://'
+
uuid
;
const
imageFilePath
=
path
.
join
(
imagesPath
,
uuid
+
ext
);
const
imageFilePath
=
path
.
join
(
imagesPath
,
uuid
+
ext
);
await
fs
.
ensureDir
(
path
.
dirname
(
imageFilePath
));
await
fs
.
ensureDir
(
path
.
dirname
(
imageFilePath
));
let
png
=
node
.
origin
.
toPng
();
let
png
=
node
.
origin
.
toPng
();
let
buffer
=
await
savePng
(
png
,
imageFilePath
);
let
buffer
=
await
savePng
(
png
,
imageFilePath
)
.
catch
(
e
=>
{})
;
//await node.origin.saveAsPng(imageFilePath);
//await node.origin.saveAsPng(imageFilePath);
const
hashFileName
=
hash
(
buffer
);
if
(
buffer
){
const
hashFilePath
=
path
.
join
(
imagesPath
,
hashFileName
+
ext
);
properties
.
source
=
'asset://'
+
uuid
;
await
fs
.
rename
(
imageFilePath
,
hashFilePath
);
const
hashFileName
=
hash
(
buffer
);
const
hashFilePath
=
path
.
join
(
imagesPath
,
hashFileName
+
ext
);
await
fs
.
rename
(
imageFilePath
,
hashFilePath
);
assets
.
push
({
assets
.
push
({
name
,
name
,
ext
,
ext
,
uuid
,
uuid
,
hash
:
hashFileName
,
hash
:
hashFileName
,
});
});
}
}
}
}
}
...
...
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