@pnpm/releasing.exportable-manifest 1100.1.14 → 1100.2.0
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 +27 -0
- package/lib/index.d.ts +19 -0
- package/lib/overridePublishConfig.d.ts +2 -0
- package/lib/overridePublishConfig.js +47 -0
- package/lib/transform/bin.d.ts +16 -0
- package/lib/transform/bin.js +37 -0
- package/lib/transform/index.d.ts +5 -0
- package/lib/transform/index.js +8 -0
- package/lib/transform/peerDependenciesMeta.d.ts +7 -0
- package/lib/transform/peerDependenciesMeta.js +18 -0
- package/lib/transform/repository.d.ts +15 -0
- package/lib/transform/repository.js +21 -0
- package/lib/transform/requiredFields.d.ts +12 -0
- package/lib/transform/requiredFields.js +16 -0
- package/package.json +13 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @pnpm/exportable-manifest
|
|
2
2
|
|
|
3
|
+
## 1100.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added support for `publishConfig.name`, which publishes a package under a different name than the one its manifest carries in the workspace. It is for a project whose published name is already taken by a sibling project, which otherwise has to be renamed by a build step just before publishing. Only the published artifact is renamed — dependents, `pnpm-lock.yaml`, and release tooling keep addressing the project by its manifest name — and the new name reaches the packed manifest, the tarball filename, and everything that addresses the package at the registry: the already-published check of `pnpm publish -r`, its registry selection, and the release-planning probes of `pnpm change status` and `pnpm version -r` [#13345](https://github.com/pnpm/pnpm/issues/13345).
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies:
|
|
12
|
+
- @pnpm/bins.resolver@1100.0.12
|
|
13
|
+
- @pnpm/types@1101.7.0
|
|
14
|
+
- @pnpm/workspace.project-manifest-reader@1100.0.21
|
|
15
|
+
|
|
16
|
+
## 1100.1.15
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Republished every package: the tarballs published by the v11.13.1 through v11.16.0 releases were missing most of their compiled files due to a packing bug [#13164](https://github.com/pnpm/pnpm/issues/13164).
|
|
21
|
+
|
|
22
|
+
- Updated dependencies:
|
|
23
|
+
- @pnpm/bins.resolver@1100.0.11
|
|
24
|
+
- @pnpm/catalogs.resolver@1100.0.1
|
|
25
|
+
- @pnpm/error@1100.1.0
|
|
26
|
+
- @pnpm/resolving.jsr-specifier-parser@1100.0.3
|
|
27
|
+
- @pnpm/types@1101.6.0
|
|
28
|
+
- @pnpm/workspace.project-manifest-reader@1100.0.20
|
|
29
|
+
|
|
3
30
|
## 1100.1.14
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Catalogs } from '@pnpm/catalogs.types';
|
|
2
|
+
import type { Hooks } from '@pnpm/hooks.pnpmfile';
|
|
3
|
+
import type { ProjectManifest } from '@pnpm/types';
|
|
4
|
+
import { type ExportedManifest } from './transform/index.js';
|
|
5
|
+
export { type ExportedManifest };
|
|
6
|
+
export interface MakePublishManifestOptions {
|
|
7
|
+
catalogs: Catalogs;
|
|
8
|
+
hooks?: Hooks;
|
|
9
|
+
modulesDir?: string;
|
|
10
|
+
skipManifestObfuscation?: boolean;
|
|
11
|
+
embedReadme?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function createExportableManifest(dir: string, originalManifest: ProjectManifest, opts: MakePublishManifestOptions): Promise<ExportedManifest>;
|
|
14
|
+
export declare function readReadmeFile(projectDir: string): Promise<string | undefined>;
|
|
15
|
+
export type PublishDependencyConverter = (depName: string, depSpec: string, dir: string, modulesDir?: string) => Promise<string> | string;
|
|
16
|
+
export interface MakePublishDependenciesOpts {
|
|
17
|
+
readonly modulesDir?: string;
|
|
18
|
+
readonly convertDependencyForPublish: PublishDependencyConverter;
|
|
19
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { isEmpty } from 'ramda';
|
|
2
|
+
// property keys that are copied from publishConfig into the manifest
|
|
3
|
+
const PUBLISH_CONFIG_WHITELIST = new Set([
|
|
4
|
+
// Lets a package be published under a name it cannot carry in the workspace
|
|
5
|
+
// — typically because a sibling project already owns that name. Nothing else
|
|
6
|
+
// in the workspace observes the rename: dependents, pnpm-lock.yaml, and the
|
|
7
|
+
// changeset ledger all keep addressing the project by its manifest name.
|
|
8
|
+
'name',
|
|
9
|
+
// manifest fields that may make sense to overwrite
|
|
10
|
+
'bin',
|
|
11
|
+
'engines',
|
|
12
|
+
'type',
|
|
13
|
+
'imports',
|
|
14
|
+
// https://github.com/stereobooster/package.json#package-bundlers
|
|
15
|
+
'main',
|
|
16
|
+
'module',
|
|
17
|
+
'typings',
|
|
18
|
+
'types',
|
|
19
|
+
'exports',
|
|
20
|
+
'browser',
|
|
21
|
+
'esnext',
|
|
22
|
+
'es2015',
|
|
23
|
+
'unpkg',
|
|
24
|
+
'umd:main',
|
|
25
|
+
// These are useful to hide in order to avoid warnings during local development
|
|
26
|
+
'os',
|
|
27
|
+
'cpu',
|
|
28
|
+
'libc',
|
|
29
|
+
// https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html#version-selection-with-typesversions
|
|
30
|
+
'typesVersions',
|
|
31
|
+
]);
|
|
32
|
+
export function overridePublishConfig(publishManifest) {
|
|
33
|
+
const { publishConfig } = publishManifest;
|
|
34
|
+
if (!publishConfig)
|
|
35
|
+
return;
|
|
36
|
+
for (const key in publishConfig) {
|
|
37
|
+
if (!PUBLISH_CONFIG_WHITELIST.has(key))
|
|
38
|
+
continue;
|
|
39
|
+
const value = publishConfig[key];
|
|
40
|
+
publishManifest[key] = value; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
41
|
+
delete publishConfig[key];
|
|
42
|
+
}
|
|
43
|
+
if (isEmpty(publishConfig)) {
|
|
44
|
+
delete publishManifest.publishConfig;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=overridePublishConfig.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PnpmError } from '@pnpm/error';
|
|
2
|
+
import type { ProjectManifest } from '@pnpm/types';
|
|
3
|
+
import type { ExportedManifest } from './index.js';
|
|
4
|
+
type Input = Pick<ProjectManifest, 'bin'> & Pick<ExportedManifest, 'name'>;
|
|
5
|
+
type Output<Manifest extends Input> = Omit<Manifest, 'bin'> & Pick<ExportedManifest, 'bin'>;
|
|
6
|
+
export declare function transformBin<Manifest extends Input>(manifest: Manifest): Output<Manifest>;
|
|
7
|
+
/**
|
|
8
|
+
* The property `"bin"` of a `package.json` could be either an object or a string.
|
|
9
|
+
* This function normalizes either forms into an object.
|
|
10
|
+
*/
|
|
11
|
+
export declare function normalizeBinObject(pkgName: string, bin: string | Record<string, string>): Record<string, string>;
|
|
12
|
+
export declare class InvalidScopedPackageNameError extends PnpmError {
|
|
13
|
+
readonly invalidName: string;
|
|
14
|
+
constructor(invalidName: string);
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { PnpmError } from '@pnpm/error';
|
|
2
|
+
export function transformBin(manifest) {
|
|
3
|
+
if (manifest.bin == null || typeof manifest.bin === 'object')
|
|
4
|
+
return manifest;
|
|
5
|
+
const { bin, ...rest } = manifest;
|
|
6
|
+
return {
|
|
7
|
+
...rest,
|
|
8
|
+
bin: normalizeBinObject(manifest.name, bin),
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The property `"bin"` of a `package.json` could be either an object or a string.
|
|
13
|
+
* This function normalizes either forms into an object.
|
|
14
|
+
*/
|
|
15
|
+
export function normalizeBinObject(pkgName, bin) {
|
|
16
|
+
if (typeof bin === 'object')
|
|
17
|
+
return bin;
|
|
18
|
+
const binName = normalizeBinName(pkgName);
|
|
19
|
+
return { [binName]: bin };
|
|
20
|
+
}
|
|
21
|
+
function normalizeBinName(name) {
|
|
22
|
+
if (name[0] !== '@')
|
|
23
|
+
return name;
|
|
24
|
+
const slashIndex = name.indexOf('/');
|
|
25
|
+
if (slashIndex < 0) {
|
|
26
|
+
throw new InvalidScopedPackageNameError(name);
|
|
27
|
+
}
|
|
28
|
+
return name.slice(slashIndex + 1);
|
|
29
|
+
}
|
|
30
|
+
export class InvalidScopedPackageNameError extends PnpmError {
|
|
31
|
+
invalidName;
|
|
32
|
+
constructor(invalidName) {
|
|
33
|
+
super('INVALID_SCOPED_PACKAGE_NAME', `The name ${JSON.stringify(invalidName)} is not a valid scoped package name`);
|
|
34
|
+
this.invalidName = invalidName;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=bin.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PackageJSON as ExportedManifest } from '@npm/types';
|
|
2
|
+
import type { ProjectManifest } from '@pnpm/types';
|
|
3
|
+
export { type ExportedManifest };
|
|
4
|
+
export type Transform = (manifest: ProjectManifest) => ExportedManifest;
|
|
5
|
+
export declare const transform: Transform;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { pipe } from 'ramda';
|
|
2
|
+
import { transformBin } from './bin.js';
|
|
3
|
+
import { transformPeerDependenciesMeta } from './peerDependenciesMeta.js';
|
|
4
|
+
import { transformRepository } from './repository.js';
|
|
5
|
+
import { transformRequiredFields } from './requiredFields.js';
|
|
6
|
+
export {};
|
|
7
|
+
export const transform = pipe(transformRequiredFields, transformBin, transformPeerDependenciesMeta, transformRepository);
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ProjectManifest } from '@pnpm/types';
|
|
2
|
+
import type { ExportedManifest } from './index.js';
|
|
3
|
+
type Input = Pick<ProjectManifest, 'peerDependenciesMeta'>;
|
|
4
|
+
type Omitted<Manifest extends Input> = Omit<Manifest, 'peerDependenciesMeta'>;
|
|
5
|
+
type Output<Manifest extends Input> = Omitted<Manifest> & Pick<ExportedManifest, 'peerDependenciesMeta'>;
|
|
6
|
+
export declare function transformPeerDependenciesMeta<Manifest extends Input>(manifest: Manifest): Output<Manifest>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function transformPeerDependenciesMeta(manifest) {
|
|
2
|
+
if (!manifest.peerDependenciesMeta)
|
|
3
|
+
return manifest;
|
|
4
|
+
const inputPeerDepsMeta = manifest.peerDependenciesMeta;
|
|
5
|
+
const outputPeerDepsMeta = {};
|
|
6
|
+
for (const key in inputPeerDepsMeta) {
|
|
7
|
+
const { optional, ...rest } = inputPeerDepsMeta[key];
|
|
8
|
+
outputPeerDepsMeta[key] = {
|
|
9
|
+
...rest,
|
|
10
|
+
optional: optional ?? false,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
...manifest,
|
|
15
|
+
peerDependenciesMeta: outputPeerDepsMeta,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=peerDependenciesMeta.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ProjectManifest } from '@pnpm/types';
|
|
2
|
+
import type { ExportedManifest } from './index.js';
|
|
3
|
+
type Input = Pick<ProjectManifest, 'repository'>;
|
|
4
|
+
type Output<Manifest extends Input> = Omit<Manifest, 'repository'> & Pick<ExportedManifest, 'repository'>;
|
|
5
|
+
/**
|
|
6
|
+
* Normalizes a string `repository` into the object form `{ type: 'git', url }`.
|
|
7
|
+
*
|
|
8
|
+
* npm's `normalize-package-data` performs this conversion before publishing, so a
|
|
9
|
+
* package whose `repository` is a bare URL string still reaches the registry as an
|
|
10
|
+
* object. Some registries (e.g. Gitea) reject a string `repository` with a 500
|
|
11
|
+
* because they decode it into an object-typed struct. Matching npm keeps
|
|
12
|
+
* `pnpm publish` compatible with them. See https://github.com/pnpm/pnpm/issues/12099.
|
|
13
|
+
*/
|
|
14
|
+
export declare function transformRepository<Manifest extends Input>(manifest: Manifest): Output<Manifest>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalizes a string `repository` into the object form `{ type: 'git', url }`.
|
|
3
|
+
*
|
|
4
|
+
* npm's `normalize-package-data` performs this conversion before publishing, so a
|
|
5
|
+
* package whose `repository` is a bare URL string still reaches the registry as an
|
|
6
|
+
* object. Some registries (e.g. Gitea) reject a string `repository` with a 500
|
|
7
|
+
* because they decode it into an object-typed struct. Matching npm keeps
|
|
8
|
+
* `pnpm publish` compatible with them. See https://github.com/pnpm/pnpm/issues/12099.
|
|
9
|
+
*/
|
|
10
|
+
export function transformRepository(manifest) {
|
|
11
|
+
if (typeof manifest.repository !== 'string')
|
|
12
|
+
return manifest;
|
|
13
|
+
return {
|
|
14
|
+
...manifest,
|
|
15
|
+
repository: {
|
|
16
|
+
type: 'git',
|
|
17
|
+
url: manifest.repository,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=repository.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PnpmError } from '@pnpm/error';
|
|
2
|
+
import type { ProjectManifest } from '@pnpm/types';
|
|
3
|
+
import type { ExportedManifest } from './index.js';
|
|
4
|
+
type RequiredField = 'name' | 'version';
|
|
5
|
+
type Input = Pick<ProjectManifest, RequiredField>;
|
|
6
|
+
type Output<Manifest extends Input> = Omit<Manifest, RequiredField> & Pick<ExportedManifest, RequiredField>;
|
|
7
|
+
export declare function transformRequiredFields<Manifest extends Input>(manifest: Manifest): Output<Manifest>;
|
|
8
|
+
export declare class MissingRequiredFieldError<Field extends RequiredField> extends PnpmError {
|
|
9
|
+
readonly field: Field;
|
|
10
|
+
constructor(field: Field);
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PnpmError } from '@pnpm/error';
|
|
2
|
+
export function transformRequiredFields(manifest) {
|
|
3
|
+
if (!manifest.name)
|
|
4
|
+
throw new MissingRequiredFieldError('name');
|
|
5
|
+
if (!manifest.version)
|
|
6
|
+
throw new MissingRequiredFieldError('version');
|
|
7
|
+
return manifest;
|
|
8
|
+
}
|
|
9
|
+
export class MissingRequiredFieldError extends PnpmError {
|
|
10
|
+
field;
|
|
11
|
+
constructor(field) {
|
|
12
|
+
super('MISSING_REQUIRED_FIELD', `Missing required field ${JSON.stringify(field)}`);
|
|
13
|
+
this.field = field;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=requiredFields.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/releasing.exportable-manifest",
|
|
3
|
-
"version": "1100.
|
|
3
|
+
"version": "1100.2.0",
|
|
4
4
|
"description": "Creates an exportable manifest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -28,24 +28,24 @@
|
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@npm/types": "^2.1.0",
|
|
31
|
-
"@pnpm/bins.resolver": "1100.0.
|
|
32
|
-
"@pnpm/catalogs.resolver": "1100.0.
|
|
33
|
-
"@pnpm/error": "1100.0
|
|
34
|
-
"@pnpm/resolving.jsr-specifier-parser": "1100.0.
|
|
35
|
-
"@pnpm/types": "1101.
|
|
36
|
-
"@pnpm/workspace.project-manifest-reader": "1100.0.
|
|
31
|
+
"@pnpm/bins.resolver": "1100.0.12",
|
|
32
|
+
"@pnpm/catalogs.resolver": "1100.0.1",
|
|
33
|
+
"@pnpm/error": "1100.1.0",
|
|
34
|
+
"@pnpm/resolving.jsr-specifier-parser": "1100.0.3",
|
|
35
|
+
"@pnpm/types": "1101.7.0",
|
|
36
|
+
"@pnpm/workspace.project-manifest-reader": "1100.0.21",
|
|
37
37
|
"p-map-values": "^0.1.0",
|
|
38
38
|
"ramda": "npm:@pnpm/ramda@0.28.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@jest/globals": "30.4.1",
|
|
42
|
-
"@pnpm/catalogs.config": "1100.0.
|
|
43
|
-
"@pnpm/catalogs.types": "1100.0.
|
|
44
|
-
"@pnpm/hooks.pnpmfile": "1100.0.
|
|
45
|
-
"@pnpm/prepare": "1100.0.
|
|
46
|
-
"@pnpm/releasing.exportable-manifest": "1100.
|
|
42
|
+
"@pnpm/catalogs.config": "1100.0.3",
|
|
43
|
+
"@pnpm/catalogs.types": "1100.0.1",
|
|
44
|
+
"@pnpm/hooks.pnpmfile": "1100.0.23",
|
|
45
|
+
"@pnpm/prepare": "1100.0.23",
|
|
46
|
+
"@pnpm/releasing.exportable-manifest": "1100.2.0",
|
|
47
47
|
"@types/cross-spawn": "^6.0.6",
|
|
48
|
-
"@types/ramda": "0.
|
|
48
|
+
"@types/ramda": "0.32.0",
|
|
49
49
|
"cross-spawn": "^7.0.6",
|
|
50
50
|
"write-yaml-file": "^6.0.0"
|
|
51
51
|
},
|