@pnpm/fs.packlist 1.0.1 → 1.0.3

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/LICENSE CHANGED
@@ -1,7 +1,7 @@
1
1
  The MIT License (MIT)
2
2
 
3
3
  Copyright (c) 2015-2016 Rico Sta. Cruz and other contributors
4
- Copyright (c) 2016-2023 Zoltan Kochan and other contributors
4
+ Copyright (c) 2016-2024 Zoltan Kochan and other contributors
5
5
 
6
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
7
7
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -15,7 +15,7 @@ pnpm add @pnpm/fs.packlist
15
15
  ## Usage
16
16
 
17
17
  ```js
18
- const { packlist } = require('path')
18
+ const { packlist } = require('@pnpm/fs.packlist')
19
19
 
20
20
  const files = packlist('/package-dir')
21
21
  ```
package/lib/index.d.ts CHANGED
@@ -1 +1,3 @@
1
- export declare function packlist(pkgDir: string): Promise<string[]>;
1
+ export declare function packlist(pkgDir: string, opts?: {
2
+ packageJsonCache?: Record<string, Record<string, unknown>>;
3
+ }): Promise<string[]>;
package/lib/index.js CHANGED
@@ -4,12 +4,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.packlist = void 0;
7
- const arborist_1 = __importDefault(require("@npmcli/arborist"));
8
7
  const npm_packlist_1 = __importDefault(require("npm-packlist"));
9
- async function packlist(pkgDir) {
10
- const arborist = new arborist_1.default(({ path: pkgDir }));
11
- const tree = await arborist.loadActual();
12
- return (0, npm_packlist_1.default)(tree);
8
+ async function packlist(pkgDir, opts) {
9
+ const packageJsonCacheMap = opts?.packageJsonCache
10
+ ? new Map(Object.entries(opts.packageJsonCache))
11
+ : undefined;
12
+ const files = await (0, npm_packlist_1.default)({ path: pkgDir, packageJsonCache: packageJsonCacheMap });
13
+ // There's a bug in the npm-packlist version that we use,
14
+ // it sometimes returns duplicates.
15
+ // Related issue: https://github.com/pnpm/pnpm/issues/6997
16
+ // Unfortunately, we cannot upgrade the library
17
+ // newer versions of npm-packlist are very slow.
18
+ return Array.from(new Set(files.map((file) => file.replace(/^\.[/\\]/, ''))));
13
19
  }
14
20
  exports.packlist = packlist;
15
21
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAuC;AACvC,gEAAsC;AAE/B,KAAK,UAAU,QAAQ,CAAE,MAAc;IAC5C,MAAM,QAAQ,GAAG,IAAI,kBAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAA;IACjD,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAA;IACxC,OAAO,IAAA,sBAAW,EAAC,IAAI,CAAC,CAAA;AAC1B,CAAC;AAJD,4BAIC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAsC;AAE/B,KAAK,UAAU,QAAQ,CAAE,MAAc,EAAE,IAE/C;IACC,MAAM,mBAAmB,GAAG,IAAI,EAAE,gBAAgB;QAChD,CAAC,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAChD,CAAC,CAAC,SAAS,CAAA;IACb,MAAM,KAAK,GAAG,MAAM,IAAA,sBAAW,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,CAAC,CAAA;IACxF,yDAAyD;IACzD,mCAAmC;IACnC,0DAA0D;IAC1D,+CAA+C;IAC/C,gDAAgD;IAChD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;AAC/E,CAAC;AAbD,4BAaC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/fs.packlist",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Get a list of the files to add from a directory into an npm package",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -21,14 +21,11 @@
21
21
  },
22
22
  "homepage": "https://github.com/pnpm/pnpm/blob/main/fs/packlist#readme",
23
23
  "dependencies": {
24
- "@npmcli/arborist": "npm:@pnpm/arborist__fork@7.2.1",
25
- "npm-packlist": "^8.0.0"
24
+ "npm-packlist": "5.1.3"
26
25
  },
27
26
  "funding": "https://opencollective.com/pnpm",
28
27
  "devDependencies": {
29
- "@types/npm-packlist": "^7.0.2",
30
- "@types/npmcli__arborist": "5.6.4",
31
- "@pnpm/fs.packlist": "1.0.1"
28
+ "@pnpm/fs.packlist": "1.0.3"
32
29
  },
33
30
  "exports": {
34
31
  ".": "./lib/index.js"