ag-psd 17.0.4 → 17.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist-es/psd.d.ts CHANGED
@@ -1311,10 +1311,10 @@ export interface LayerAdditionalInfo {
1311
1311
  description: string;
1312
1312
  reason: string;
1313
1313
  engine: string;
1314
- enableCompCore: string;
1315
- enableCompCoreGPU: string;
1316
- compCoreSupport: string;
1317
- compCoreGPUSupport: string;
1314
+ enableCompCore?: string;
1315
+ enableCompCoreGPU?: string;
1316
+ compCoreSupport?: string;
1317
+ compCoreGPUSupport?: string;
1318
1318
  };
1319
1319
  artboard?: {
1320
1320
  rect: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ag-psd",
3
- "version": "17.0.4",
3
+ "version": "17.0.5",
4
4
  "description": "Library for reading and writing PSD files",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist-es/index.js",
@@ -3328,6 +3328,44 @@ if (MOCK_HANDLERS) {
3328
3328
  );
3329
3329
  }
3330
3330
 
3331
+ /*
3332
+ interface CAIDesc {
3333
+ enab: boolean;
3334
+ generationalGuid: string;
3335
+ }
3336
+
3337
+ addHandler(
3338
+ 'CAI ', // content credentials ? something to do with generative tech
3339
+ () => false,
3340
+ (reader, _target, left) => {
3341
+ const version = readUint32(reader); // 3
3342
+ const desc = readVersionAndDescriptor(reader) as CAIDesc;
3343
+ console.log('CAI', require('util').inspect(desc, false, 99, true));
3344
+ console.log('CAI', { version });
3345
+ console.log('CAI left', readBytes(reader, left())); // 8 bytes left, all zeroes
3346
+ },
3347
+ (_writer, _target) => {
3348
+ },
3349
+ );
3350
+ */
3351
+
3352
+ /*
3353
+ interface GenIDesc {
3354
+ isUsingGenTech: number;
3355
+ }
3356
+
3357
+ addHandler(
3358
+ 'GenI', // generative tech
3359
+ () => false,
3360
+ (reader, _target, left) => {
3361
+ const desc = readVersionAndDescriptor(reader) as GenIDesc;
3362
+ console.log('GenI', require('util').inspect(desc, false, 99, true));
3363
+ },
3364
+ (_writer, _target) => {
3365
+ },
3366
+ );
3367
+ */
3368
+
3331
3369
  function readRect(reader: PsdReader) {
3332
3370
  const top = readInt32(reader);
3333
3371
  const left = readInt32(reader);
@@ -3454,6 +3492,9 @@ addHandler(
3454
3492
  let size = readLength64(reader); // size
3455
3493
  const startOffset = reader.offset;
3456
3494
  const type = readSignature(reader) as 'liFD' | 'liFE' | 'liFA';
3495
+ // liFD - linked file data
3496
+ // liFE - linked file external
3497
+ // liFA - linked file alias
3457
3498
  const version = readInt32(reader);
3458
3499
  const id = readPascalString(reader, 1);
3459
3500
  const name = readUnicodeString(reader);
@@ -3463,7 +3504,7 @@ addHandler(
3463
3504
  const hasFileOpenDescriptor = readUint8(reader);
3464
3505
  const fileOpenDescriptor = hasFileOpenDescriptor ? readVersionAndDescriptor(reader) as FileOpenDescriptor : undefined;
3465
3506
  const linkedFileDescriptor = type === 'liFE' ? readVersionAndDescriptor(reader) : undefined;
3466
- const file: LinkedFile = { id, name, data: undefined };
3507
+ const file: LinkedFile = { id, name };
3467
3508
 
3468
3509
  if (fileType) file.type = fileType;
3469
3510
  if (fileCreator) file.creator = fileCreator;
@@ -3491,11 +3532,11 @@ addHandler(
3491
3532
 
3492
3533
  const fileSize = type === 'liFE' ? readLength64(reader) : 0;
3493
3534
  if (type === 'liFA') skipBytes(reader, 8);
3494
- if (type === 'liFD') file.data = readBytes(reader, dataSize);
3535
+ if (type === 'liFD') file.data = readBytes(reader, dataSize); // seems to be a typo in docs
3495
3536
  if (version >= 5) file.childDocumentID = readUnicodeString(reader);
3496
3537
  if (version >= 6) file.assetModTime = readFloat64(reader);
3497
3538
  if (version >= 7) file.assetLockedState = readUint8(reader);
3498
- if (type === 'liFE') file.data = readBytes(reader, fileSize);
3539
+ if (type === 'liFE' && version === 2) file.data = readBytes(reader, fileSize);
3499
3540
 
3500
3541
  if (options.skipLinkedFilesData) file.data = undefined;
3501
3542
 
@@ -4707,11 +4748,11 @@ interface CinfDescriptor {
4707
4748
  description: string;
4708
4749
  reason: string;
4709
4750
  Engn: string; // 'Engn.compCore';
4710
- enableCompCore: string; // 'enable.feature';
4711
- enableCompCoreGPU: string; // 'enable.feature';
4751
+ enableCompCore?: string; // 'enable.feature';
4752
+ enableCompCoreGPU?: string; // 'enable.feature';
4712
4753
  enableCompCoreThreads?: string; // 'enable.feature';
4713
- compCoreSupport: string; // 'reason.supported';
4714
- compCoreGPUSupport: string; // 'reason.featureDisabled';
4754
+ compCoreSupport?: string; // 'reason.supported';
4755
+ compCoreGPUSupport?: string; // 'reason.featureDisabled';
4715
4756
  }
4716
4757
 
4717
4758
  addHandler(
@@ -4728,13 +4769,14 @@ addHandler(
4728
4769
  target.compositorUsed = {
4729
4770
  description: desc.description,
4730
4771
  reason: desc.reason,
4731
- engine: enumValue(desc.Engn),
4732
- enableCompCore: enumValue(desc.enableCompCore),
4733
- enableCompCoreGPU: enumValue(desc.enableCompCoreGPU),
4734
- compCoreSupport: enumValue(desc.compCoreSupport),
4735
- compCoreGPUSupport: enumValue(desc.compCoreGPUSupport),
4772
+ engine: enumValue(desc.Engn)!,
4736
4773
  };
4737
4774
 
4775
+ if (desc.enableCompCore) target.compositorUsed.enableCompCore = enumValue(desc.enableCompCore);
4776
+ if (desc.enableCompCoreGPU) target.compositorUsed.enableCompCoreGPU = enumValue(desc.enableCompCoreGPU);
4777
+ if (desc.compCoreSupport) target.compositorUsed.compCoreSupport = enumValue(desc.compCoreSupport);
4778
+ if (desc.compCoreGPUSupport) target.compositorUsed.compCoreGPUSupport = enumValue(desc.compCoreGPUSupport);
4779
+
4738
4780
  skipBytes(reader, left());
4739
4781
  },
4740
4782
  (writer, target) => {
@@ -4745,12 +4787,14 @@ addHandler(
4745
4787
  description: cinf.description,
4746
4788
  reason: cinf.reason,
4747
4789
  Engn: `Engn.${cinf.engine}`,
4748
- enableCompCore: `enable.${cinf.enableCompCore}`,
4749
- enableCompCoreGPU: `enable.${cinf.enableCompCoreGPU}`,
4750
- // enableCompCoreThreads: `enable.feature`, // TESTING
4751
- compCoreSupport: `reason.${cinf.compCoreSupport}`,
4752
- compCoreGPUSupport: `reason.${cinf.compCoreGPUSupport}`,
4753
4790
  };
4791
+
4792
+ if (cinf.enableCompCore) desc.enableCompCore = `enable.${cinf.enableCompCore}`;
4793
+ if (cinf.enableCompCoreGPU) desc.enableCompCoreGPU = `enable.${cinf.enableCompCoreGPU}`;
4794
+ // desc.enableCompCoreThreads = `enable.feature`; // TESTING
4795
+ if (cinf.compCoreSupport) desc.compCoreSupport = `reason.${cinf.compCoreSupport}`;
4796
+ if (cinf.compCoreGPUSupport) desc.compCoreGPUSupport = `reason.${cinf.compCoreGPUSupport}`;
4797
+
4754
4798
  writeVersionAndDescriptor(writer, '', 'null', desc);
4755
4799
  },
4756
4800
  );
package/src/psd.ts CHANGED
@@ -1345,10 +1345,10 @@ export interface LayerAdditionalInfo {
1345
1345
  description: string;
1346
1346
  reason: string;
1347
1347
  engine: string;
1348
- enableCompCore: string;
1349
- enableCompCoreGPU: string;
1350
- compCoreSupport: string;
1351
- compCoreGPUSupport: string;
1348
+ enableCompCore?: string;
1349
+ enableCompCoreGPU?: string;
1350
+ compCoreSupport?: string;
1351
+ compCoreGPUSupport?: string;
1352
1352
  };
1353
1353
  artboard?: {
1354
1354
  rect: { top: number; left: number; bottom: number; right: number; };