@pnpm/releasing.exportable-manifest 1100.1.13 → 1100.1.15
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 +23 -0
- package/lib/index.d.ts +19 -0
- package/lib/overridePublishConfig.d.ts +2 -0
- package/lib/overridePublishConfig.js +42 -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 +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @pnpm/exportable-manifest
|
|
2
2
|
|
|
3
|
+
## 1100.1.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 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).
|
|
8
|
+
|
|
9
|
+
- Updated dependencies:
|
|
10
|
+
- @pnpm/bins.resolver@1100.0.11
|
|
11
|
+
- @pnpm/catalogs.resolver@1100.0.1
|
|
12
|
+
- @pnpm/error@1100.1.0
|
|
13
|
+
- @pnpm/resolving.jsr-specifier-parser@1100.0.3
|
|
14
|
+
- @pnpm/types@1101.6.0
|
|
15
|
+
- @pnpm/workspace.project-manifest-reader@1100.0.20
|
|
16
|
+
|
|
17
|
+
## 1100.1.14
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies:
|
|
22
|
+
- @pnpm/bins.resolver@1100.0.10
|
|
23
|
+
- @pnpm/types@1101.5.0
|
|
24
|
+
- @pnpm/workspace.project-manifest-reader@1100.0.19
|
|
25
|
+
|
|
3
26
|
## 1100.1.13
|
|
4
27
|
|
|
5
28
|
### 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,42 @@
|
|
|
1
|
+
import { isEmpty } from 'ramda';
|
|
2
|
+
// property keys that are copied from publishConfig into the manifest
|
|
3
|
+
const PUBLISH_CONFIG_WHITELIST = new Set([
|
|
4
|
+
// manifest fields that may make sense to overwrite
|
|
5
|
+
'bin',
|
|
6
|
+
'engines',
|
|
7
|
+
'type',
|
|
8
|
+
'imports',
|
|
9
|
+
// https://github.com/stereobooster/package.json#package-bundlers
|
|
10
|
+
'main',
|
|
11
|
+
'module',
|
|
12
|
+
'typings',
|
|
13
|
+
'types',
|
|
14
|
+
'exports',
|
|
15
|
+
'browser',
|
|
16
|
+
'esnext',
|
|
17
|
+
'es2015',
|
|
18
|
+
'unpkg',
|
|
19
|
+
'umd:main',
|
|
20
|
+
// These are useful to hide in order to avoid warnings during local development
|
|
21
|
+
'os',
|
|
22
|
+
'cpu',
|
|
23
|
+
'libc',
|
|
24
|
+
// https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html#version-selection-with-typesversions
|
|
25
|
+
'typesVersions',
|
|
26
|
+
]);
|
|
27
|
+
export function overridePublishConfig(publishManifest) {
|
|
28
|
+
const { publishConfig } = publishManifest;
|
|
29
|
+
if (!publishConfig)
|
|
30
|
+
return;
|
|
31
|
+
for (const key in publishConfig) {
|
|
32
|
+
if (!PUBLISH_CONFIG_WHITELIST.has(key))
|
|
33
|
+
continue;
|
|
34
|
+
const value = publishConfig[key];
|
|
35
|
+
publishManifest[key] = value; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
36
|
+
delete publishConfig[key];
|
|
37
|
+
}
|
|
38
|
+
if (isEmpty(publishConfig)) {
|
|
39
|
+
delete publishManifest.publishConfig;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# 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.1.
|
|
3
|
+
"version": "1100.1.15",
|
|
4
4
|
"description": "Creates an exportable manifest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -28,22 +28,22 @@
|
|
|
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.11",
|
|
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.6.0",
|
|
36
|
+
"@pnpm/workspace.project-manifest-reader": "1100.0.20",
|
|
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.1.
|
|
42
|
+
"@pnpm/catalogs.config": "1100.0.3",
|
|
43
|
+
"@pnpm/catalogs.types": "1100.0.1",
|
|
44
|
+
"@pnpm/hooks.pnpmfile": "1100.0.22",
|
|
45
|
+
"@pnpm/prepare": "1100.0.22",
|
|
46
|
+
"@pnpm/releasing.exportable-manifest": "1100.1.15",
|
|
47
47
|
"@types/cross-spawn": "^6.0.6",
|
|
48
48
|
"@types/ramda": "0.31.1",
|
|
49
49
|
"cross-spawn": "^7.0.6",
|