@pnpm/fs.packlist 1.0.0 → 1.0.2

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/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.js CHANGED
@@ -4,12 +4,15 @@ 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
8
  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);
9
+ const files = await (0, npm_packlist_1.default)({ path: pkgDir });
10
+ // There's a bug in the npm-packlist version that we use,
11
+ // it sometimes returns duplicates.
12
+ // Related issue: https://github.com/pnpm/pnpm/issues/6997
13
+ // Unfortunately, we cannot upgrade the library
14
+ // newer versions of npm-packlist are very slow.
15
+ return Array.from(new Set(files.map((file) => file.replace(/^\.[/\\]/, ''))));
13
16
  }
14
17
  exports.packlist = packlist;
15
18
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/fs.packlist",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
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": "7.2.0",
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.0"
28
+ "@pnpm/fs.packlist": "1.0.2"
32
29
  },
33
30
  "exports": {
34
31
  ".": "./lib/index.js"
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
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"}