@diquattro/cfnassets 0.6.4 → 0.6.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.
@@ -1 +1 @@
1
- {"version":3,"file":"getFolderEntries.d.ts","sourceRoot":"","sources":["../../../src/core/zip/getFolderEntries.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,WAAW,oBAAoB;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAuB,gBAAgB,CAAC,EACtC,WAAW,EAAE,eAAqB,EAClC,MAAM,EACN,MAAM,EAAE,WAAW,GACpB,EAAE,oBAAoB,GAAG,qBAAqB,CAAC,aAAa,CAAC,CA8B7D"}
1
+ {"version":3,"file":"getFolderEntries.d.ts","sourceRoot":"","sources":["../../../src/core/zip/getFolderEntries.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,WAAW,oBAAoB;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAuB,gBAAgB,CAAC,EACtC,WAAW,EAAE,eAAqB,EAClC,MAAM,EACN,MAAM,EAAE,WAAW,GACpB,EAAE,oBAAoB,GAAG,qBAAqB,CAAC,aAAa,CAAC,CAuC7D"}
@@ -1,5 +1,5 @@
1
1
  import { createReadStream } from 'fs';
2
- import { readdir } from 'fs/promises';
2
+ import { readdir, stat } from 'fs/promises';
3
3
  import ignore from 'ignore';
4
4
  import { join, relative, resolve } from 'path';
5
5
  export async function* getFolderEntries({ archivePath: archiveBasePath = '/', source, ignore: ignorePaths, }) {
@@ -10,17 +10,25 @@ export async function* getFolderEntries({ archivePath: archiveBasePath = '/', so
10
10
  const entries = await readdir(curr, { withFileTypes: true });
11
11
  for (const entry of entries) {
12
12
  const entryPath = join(curr, entry.name);
13
+ // For symlinks, follow them to get the real type
14
+ let isDir = entry.isDirectory();
15
+ let isFile = entry.isFile();
16
+ if (entry.isSymbolicLink()) {
17
+ const realStat = await stat(entryPath);
18
+ isDir = realStat.isDirectory();
19
+ isFile = realStat.isFile();
20
+ }
13
21
  let archivePath = relative(source, entryPath);
14
- if (entry.isDirectory()) {
22
+ if (isDir) {
15
23
  archivePath += '/';
16
24
  }
17
25
  if (ig.ignores(archivePath)) {
18
26
  continue;
19
27
  }
20
- if (entry.isDirectory()) {
28
+ if (isDir) {
21
29
  work.push(entryPath);
22
30
  }
23
- else if (entry.isFile()) {
31
+ else if (isFile) {
24
32
  yield {
25
33
  archivePath: join(archiveBasePath, archivePath),
26
34
  content: () => createReadStream(entryPath),
@@ -1 +1 @@
1
- {"version":3,"file":"getFolderEntries.js","sourceRoot":"","sources":["../../../src/core/zip/getFolderEntries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAS/C,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,gBAAgB,CAAC,EACtC,WAAW,EAAE,eAAe,GAAG,GAAG,EAClC,MAAM,EACN,MAAM,EAAE,WAAW,GACE;IACrB,MAAM,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/B,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;IAEnD,OAAO,IAAI,CAAC,MAAM,EAAE;QAClB,MAAM,IAAI,GAAG,IAAI,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,CAAC;iBAC3C,CAAC;aACH;SACF;KACF;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diquattro/cfnassets",
3
- "version": "0.6.4",
3
+ "version": "0.6.5",
4
4
  "description": "Build asset zip packages for deployment. Fork of @awboost/cfnassets with pnpm support.",
5
5
  "type": "module",
6
6
  "repository": {
@@ -1,5 +1,5 @@
1
1
  import { createReadStream } from 'fs';
2
- import { readdir } from 'fs/promises';
2
+ import { readdir, stat } from 'fs/promises';
3
3
  import ignore from 'ignore';
4
4
  import { join, relative, resolve } from 'path';
5
5
  import { ZipAssetEntry } from './ZipAssetEntry.js';
@@ -26,17 +26,26 @@ export async function* getFolderEntries({
26
26
  for (const entry of entries) {
27
27
  const entryPath = join(curr, entry.name);
28
28
 
29
+ // For symlinks, follow them to get the real type
30
+ let isDir = entry.isDirectory();
31
+ let isFile = entry.isFile();
32
+ if (entry.isSymbolicLink()) {
33
+ const realStat = await stat(entryPath);
34
+ isDir = realStat.isDirectory();
35
+ isFile = realStat.isFile();
36
+ }
37
+
29
38
  let archivePath = relative(source, entryPath);
30
- if (entry.isDirectory()) {
39
+ if (isDir) {
31
40
  archivePath += '/';
32
41
  }
33
42
  if (ig.ignores(archivePath)) {
34
43
  continue;
35
44
  }
36
45
 
37
- if (entry.isDirectory()) {
46
+ if (isDir) {
38
47
  work.push(entryPath);
39
- } else if (entry.isFile()) {
48
+ } else if (isFile) {
40
49
  yield {
41
50
  archivePath: join(archiveBasePath, archivePath),
42
51
  content: () => createReadStream(entryPath),