@pnpm/fs.packlist 1100.0.1 → 1100.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/CHANGELOG.md ADDED
@@ -0,0 +1,58 @@
1
+ # @pnpm/fs.packlist
2
+
3
+ ## 1100.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - Fixed `pnpm pack` applying workspace-root ignore rules when a workspace package has its own `.npmignore` file.
8
+
9
+ ## 1100.0.2
10
+
11
+ ### Patch Changes
12
+
13
+ - `pnpm pack` now respects workspace-root `.npmignore` and `.gitignore` files when packing workspace packages.
14
+
15
+ ## 1100.0.1
16
+
17
+ ### Patch Changes
18
+
19
+ - dd8d5d7: Fix `pnpm pack` not bundling dependencies listed in `bundleDependencies` (or `bundledDependencies`). The npm-packlist upgrade in pnpm 11 changed its API to require the caller to pre-populate the dependency tree, which the wrapper was not doing — `bundleDependencies` were silently dropped from the tarball [#11519](https://github.com/pnpm/pnpm/issues/11519).
20
+
21
+ ## 1001.0.0
22
+
23
+ ### Major Changes
24
+
25
+ - 491a84f: This package is now pure ESM.
26
+ - 7d2fd48: Node.js v18, 19, 20, and 21 support discontinued.
27
+
28
+ ## 2.0.0
29
+
30
+ ### Major Changes
31
+
32
+ - 43cdd87: Node.js v16 support dropped. Use at least Node.js v18.12.
33
+
34
+ ## 1.0.3
35
+
36
+ ### Patch Changes
37
+
38
+ - 9fb45d0fc: `pnpm publish` should pack "main" file or "bin" files defined in "publishConfig" [#4195](https://github.com/pnpm/pnpm/issues/4195).
39
+
40
+ ## 1.0.2
41
+
42
+ ### Patch Changes
43
+
44
+ - 74432d605: Downgraded `npm-packlist` because the newer version significantly slows down the installation of local directory dependencies, making it unbearably slow.
45
+
46
+ `npm-packlist` was upgraded in [this PR](https://github.com/pnpm/pnpm/pull/7250) to fix [#6997](https://github.com/pnpm/pnpm/issues/6997). We added our own file deduplication to fix the issue of duplicate file entries.
47
+
48
+ ## 1.0.1
49
+
50
+ ### Patch Changes
51
+
52
+ - c7f1359b6: After upgrading one of our dependencies, we started to sometimes have an error on publish. We have forked `@npmcli/arborist` to patch it with a fix [#7269](https://github.com/pnpm/pnpm/pull/7269).
53
+
54
+ ## 1.0.0
55
+
56
+ ### Major Changes
57
+
58
+ - 500363647: Initial release.
package/lib/index.js CHANGED
@@ -1,11 +1,28 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import util from 'node:util';
4
+ import { isSubdir } from 'is-subdir';
4
5
  import npmPacklist from 'npm-packlist';
5
6
  export async function packlist(pkgDir, opts) {
6
- const pkg = opts?.manifest ?? readPackageJson(pkgDir);
7
- const tree = buildRootTree(pkgDir, pkg);
8
- const files = await npmPacklist(tree);
7
+ const resolvedPkgDir = path.resolve(pkgDir);
8
+ const workspaceDir = opts?.workspaceDir == null ? undefined : path.resolve(opts.workspaceDir);
9
+ const pkg = opts?.manifest ?? readPackageJson(resolvedPkgDir);
10
+ const tree = buildRootTree(resolvedPkgDir, pkg);
11
+ const hasWorkspaceContext = workspaceDir != null && workspaceDir !== resolvedPkgDir && isSubdir(workspaceDir, resolvedPkgDir);
12
+ let hasNpmIgnore = false;
13
+ if (hasWorkspaceContext) {
14
+ try {
15
+ hasNpmIgnore = (await fs.promises.stat(path.join(resolvedPkgDir, '.npmignore'))).isFile();
16
+ }
17
+ catch (err) {
18
+ if (!util.types.isNativeError(err) || !('code' in err) || err.code !== 'ENOENT')
19
+ throw err;
20
+ }
21
+ }
22
+ const packlistOpts = hasWorkspaceContext && !hasNpmIgnore
23
+ ? { prefix: workspaceDir, workspaces: [resolvedPkgDir] }
24
+ : undefined;
25
+ const files = await npmPacklist(tree, packlistOpts);
9
26
  return files.map((file) => file.replace(/^\.[/\\]/, ''));
10
27
  }
11
28
  function buildRootTree(pkgDir, pkg) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnpm/fs.packlist",
3
- "version": "1100.0.1",
3
+ "version": "1100.0.3",
4
4
  "description": "Get a list of the files to add from a directory into an npm package",
5
5
  "keywords": [
6
6
  "pnpm",
@@ -8,8 +8,11 @@
8
8
  ],
9
9
  "license": "MIT",
10
10
  "funding": "https://opencollective.com/pnpm",
11
- "repository": "https://github.com/pnpm/pnpm/tree/main/fs/packlist",
12
- "homepage": "https://github.com/pnpm/pnpm/tree/main/fs/packlist#readme",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/pnpm/pnpm/tree/main/pnpm11/fs/packlist"
14
+ },
15
+ "homepage": "https://github.com/pnpm/pnpm/tree/main/pnpm11/fs/packlist#readme",
13
16
  "bugs": {
14
17
  "url": "https://github.com/pnpm/pnpm/issues"
15
18
  },
@@ -24,10 +27,11 @@
24
27
  "!*.map"
25
28
  ],
26
29
  "dependencies": {
30
+ "is-subdir": "^2.0.0",
27
31
  "npm-packlist": "10.0.4"
28
32
  },
29
33
  "devDependencies": {
30
- "@pnpm/fs.packlist": "1100.0.1"
34
+ "@pnpm/fs.packlist": "1100.0.3"
31
35
  },
32
36
  "engines": {
33
37
  "node": ">=22.13"
package/lib/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export declare function packlist(pkgDir: string, opts?: {
2
- manifest?: Record<string, unknown>;
3
- }): Promise<string[]>;