@pnpm/releasing.exportable-manifest 1000.1.7
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 +22 -0
- package/README.md +15 -0
- package/lib/index.d.ts +17 -0
- package/lib/index.js +147 -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/engines.d.ts +12 -0
- package/lib/transform/engines.js +23 -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/requiredFields.d.ts +12 -0
- package/lib/transform/requiredFields.js +16 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015-2016 Rico Sta. Cruz and other contributors
|
|
4
|
+
Copyright (c) 2016-2026 Zoltan Kochan and other contributors
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @pnpm/exportable-manifest
|
|
2
|
+
|
|
3
|
+
> Creates an exportable manifest
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@pnpm/exportable-manifest)
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm add @pnpm/exportable-manifest
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## License
|
|
14
|
+
|
|
15
|
+
MIT
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
readmeFile?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function createExportableManifest(dir: string, originalManifest: ProjectManifest, opts: MakePublishManifestOptions): Promise<ExportedManifest>;
|
|
13
|
+
export type PublishDependencyConverter = (depName: string, depSpec: string, dir: string, modulesDir?: string) => Promise<string> | string;
|
|
14
|
+
export interface MakePublishDependenciesOpts {
|
|
15
|
+
readonly modulesDir?: string;
|
|
16
|
+
readonly convertDependencyForPublish: PublishDependencyConverter;
|
|
17
|
+
}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { resolveFromCatalog } from '@pnpm/catalogs.resolver';
|
|
3
|
+
import { PnpmError } from '@pnpm/error';
|
|
4
|
+
import { parseJsrSpecifier } from '@pnpm/resolving.jsr-specifier-parser';
|
|
5
|
+
import { tryReadProjectManifest } from '@pnpm/workspace.project-manifest-reader';
|
|
6
|
+
import { pMapValues } from 'p-map-values';
|
|
7
|
+
import { omit } from 'ramda';
|
|
8
|
+
import { overridePublishConfig } from './overridePublishConfig.js';
|
|
9
|
+
import { transform } from './transform/index.js';
|
|
10
|
+
export {};
|
|
11
|
+
const PREPUBLISH_SCRIPTS = [
|
|
12
|
+
'prepublishOnly',
|
|
13
|
+
'prepack',
|
|
14
|
+
'prepare',
|
|
15
|
+
'postpack',
|
|
16
|
+
'publish',
|
|
17
|
+
'postpublish',
|
|
18
|
+
];
|
|
19
|
+
export async function createExportableManifest(dir, originalManifest, opts) {
|
|
20
|
+
let publishManifest = omit(['scripts', 'packageManager', 'pnpm'], originalManifest);
|
|
21
|
+
if (originalManifest.scripts != null) {
|
|
22
|
+
publishManifest.scripts = omit(PREPUBLISH_SCRIPTS, originalManifest.scripts);
|
|
23
|
+
}
|
|
24
|
+
const catalogResolver = resolveFromCatalog.bind(null, opts.catalogs);
|
|
25
|
+
const replaceCatalogProtocol = resolveCatalogProtocol.bind(null, catalogResolver);
|
|
26
|
+
const convertDependencyForPublish = combineConverters(replaceWorkspaceProtocol, replaceCatalogProtocol, replaceJsrProtocol);
|
|
27
|
+
await Promise.all(['dependencies', 'devDependencies', 'optionalDependencies'].map(async (depsField) => {
|
|
28
|
+
const deps = await makePublishDependencies(dir, originalManifest[depsField], {
|
|
29
|
+
modulesDir: opts?.modulesDir,
|
|
30
|
+
convertDependencyForPublish,
|
|
31
|
+
});
|
|
32
|
+
if (deps != null) {
|
|
33
|
+
publishManifest[depsField] = deps;
|
|
34
|
+
}
|
|
35
|
+
}));
|
|
36
|
+
const peerDependencies = originalManifest.peerDependencies;
|
|
37
|
+
if (peerDependencies) {
|
|
38
|
+
const convertPeersForPublish = combineConverters(replaceWorkspaceProtocolPeerDependency, replaceCatalogProtocol, replaceJsrProtocol);
|
|
39
|
+
publishManifest.peerDependencies = await makePublishDependencies(dir, peerDependencies, {
|
|
40
|
+
modulesDir: opts?.modulesDir,
|
|
41
|
+
convertDependencyForPublish: convertPeersForPublish,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
overridePublishConfig(publishManifest);
|
|
45
|
+
if (opts?.readmeFile) {
|
|
46
|
+
publishManifest.readme ??= opts.readmeFile;
|
|
47
|
+
}
|
|
48
|
+
for (const hook of opts?.hooks?.beforePacking ?? []) {
|
|
49
|
+
// eslint-disable-next-line no-await-in-loop
|
|
50
|
+
publishManifest = await hook(publishManifest, dir) ?? publishManifest;
|
|
51
|
+
}
|
|
52
|
+
return transform(publishManifest);
|
|
53
|
+
}
|
|
54
|
+
function combineConverters(...converters) {
|
|
55
|
+
return async (depName, depSpec, dir, modulesDir) => {
|
|
56
|
+
let bareSpecifier = depSpec;
|
|
57
|
+
for (const converter of converters) {
|
|
58
|
+
// eslint-disable-next-line no-await-in-loop
|
|
59
|
+
bareSpecifier = await converter(depName, bareSpecifier, dir, modulesDir);
|
|
60
|
+
}
|
|
61
|
+
return bareSpecifier;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
async function makePublishDependencies(dir, dependencies, { modulesDir, convertDependencyForPublish }) {
|
|
65
|
+
if (dependencies == null)
|
|
66
|
+
return dependencies;
|
|
67
|
+
const publishDependencies = await pMapValues(async (depSpec, depName) => convertDependencyForPublish(depName, depSpec, dir, modulesDir), dependencies);
|
|
68
|
+
return publishDependencies;
|
|
69
|
+
}
|
|
70
|
+
async function readAndCheckManifest(depName, dependencyDir) {
|
|
71
|
+
const { manifest } = await tryReadProjectManifest(dependencyDir);
|
|
72
|
+
if (!manifest?.name || !manifest?.version) {
|
|
73
|
+
throw new PnpmError('CANNOT_RESOLVE_WORKSPACE_PROTOCOL', `Cannot resolve workspace protocol of dependency "${depName}" ` +
|
|
74
|
+
'because this dependency is not installed. Try running "pnpm install".');
|
|
75
|
+
}
|
|
76
|
+
return manifest;
|
|
77
|
+
}
|
|
78
|
+
function resolveCatalogProtocol(catalogResolver, alias, bareSpecifier) {
|
|
79
|
+
const result = catalogResolver({ alias, bareSpecifier });
|
|
80
|
+
switch (result.type) {
|
|
81
|
+
case 'found': return result.resolution.specifier;
|
|
82
|
+
case 'unused': return bareSpecifier;
|
|
83
|
+
case 'misconfiguration': throw result.error;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
async function replaceWorkspaceProtocol(depName, depSpec, dir, modulesDir) {
|
|
87
|
+
if (!depSpec.startsWith('workspace:')) {
|
|
88
|
+
return depSpec;
|
|
89
|
+
}
|
|
90
|
+
// Dependencies with bare "*", "^", "~" versions, or no version (workspace:)
|
|
91
|
+
const versionAliasSpecParts = /^workspace:(?:(.+)@)?([\^~*])?$/.exec(depSpec);
|
|
92
|
+
if (versionAliasSpecParts != null) {
|
|
93
|
+
modulesDir = modulesDir ?? path.join(dir, 'node_modules');
|
|
94
|
+
const manifest = await readAndCheckManifest(depName, path.join(modulesDir, depName));
|
|
95
|
+
const specifierSuffix = versionAliasSpecParts[2];
|
|
96
|
+
const semverRangeToken = specifierSuffix === '^' || specifierSuffix === '~' ? specifierSuffix : '';
|
|
97
|
+
if (depName !== manifest.name) {
|
|
98
|
+
return `npm:${manifest.name}@${semverRangeToken}${manifest.version}`;
|
|
99
|
+
}
|
|
100
|
+
return `${semverRangeToken}${manifest.version}`;
|
|
101
|
+
}
|
|
102
|
+
if (depSpec.startsWith('workspace:./') || depSpec.startsWith('workspace:../')) {
|
|
103
|
+
const manifest = await readAndCheckManifest(depName, path.join(dir, depSpec.slice(10)));
|
|
104
|
+
if (manifest.name === depName)
|
|
105
|
+
return `${manifest.version}`;
|
|
106
|
+
return `npm:${manifest.name}@${manifest.version}`;
|
|
107
|
+
}
|
|
108
|
+
depSpec = depSpec.slice(10);
|
|
109
|
+
if (depSpec.includes('@')) {
|
|
110
|
+
return `npm:${depSpec}`;
|
|
111
|
+
}
|
|
112
|
+
return depSpec;
|
|
113
|
+
}
|
|
114
|
+
async function replaceWorkspaceProtocolPeerDependency(depName, depSpec, dir, modulesDir) {
|
|
115
|
+
if (!depSpec.includes('workspace:')) {
|
|
116
|
+
return depSpec;
|
|
117
|
+
}
|
|
118
|
+
// Dependencies with bare "*", "^", "~",">=",">","<=", "<", version
|
|
119
|
+
const workspaceSemverRegex = /workspace:([\^~*]|>=|>|<=|<)?((\d+|[xX*])(\.(\d+|[xX*])){0,2})?/;
|
|
120
|
+
const versionAliasSpecParts = workspaceSemverRegex.exec(depSpec);
|
|
121
|
+
if (versionAliasSpecParts != null) {
|
|
122
|
+
const [, semverRangGroup = '', version] = versionAliasSpecParts;
|
|
123
|
+
if (version) {
|
|
124
|
+
return depSpec.replace('workspace:', '');
|
|
125
|
+
}
|
|
126
|
+
modulesDir = modulesDir ?? path.join(dir, 'node_modules');
|
|
127
|
+
const manifest = await readAndCheckManifest(depName, path.join(modulesDir, depName));
|
|
128
|
+
const semverRangeToken = semverRangGroup !== '*' ? semverRangGroup : '';
|
|
129
|
+
return depSpec.replace(workspaceSemverRegex, `${semverRangeToken}${manifest.version}`);
|
|
130
|
+
}
|
|
131
|
+
return depSpec.replace('workspace:', '');
|
|
132
|
+
}
|
|
133
|
+
async function replaceJsrProtocol(depName, depSpec) {
|
|
134
|
+
const spec = parseJsrSpecifier(depSpec, depName);
|
|
135
|
+
if (spec == null) {
|
|
136
|
+
return depSpec;
|
|
137
|
+
}
|
|
138
|
+
return createNpmAliasedSpecifier(spec.npmPkgName, spec.versionSelector);
|
|
139
|
+
}
|
|
140
|
+
function createNpmAliasedSpecifier(npmPkgName, versionSelector) {
|
|
141
|
+
const npmPkgSpecifier = `npm:${npmPkgName}`;
|
|
142
|
+
if (!versionSelector) {
|
|
143
|
+
return npmPkgSpecifier;
|
|
144
|
+
}
|
|
145
|
+
return `${npmPkgSpecifier}@${versionSelector}`;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -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,12 @@
|
|
|
1
|
+
import { PnpmError } from '@pnpm/error';
|
|
2
|
+
import type { ProjectManifest } from '@pnpm/types';
|
|
3
|
+
import type { ExportedManifest } from './index.js';
|
|
4
|
+
type EnginesField = 'engines' | 'devEngines';
|
|
5
|
+
type Input = Pick<ProjectManifest, EnginesField>;
|
|
6
|
+
type Omitted<Manifest extends Input> = Omit<Manifest, EnginesField>;
|
|
7
|
+
type Output<Manifest extends Input> = Omitted<Manifest> & Pick<ExportedManifest, EnginesField>;
|
|
8
|
+
export declare function transformEngines<Manifest extends Input>(manifest: Manifest): Output<Manifest>;
|
|
9
|
+
export declare class DevEnginesRuntimeConflictError extends PnpmError {
|
|
10
|
+
constructor();
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { PnpmError } from '@pnpm/error';
|
|
2
|
+
export function transformEngines(manifest) {
|
|
3
|
+
if (!manifest.engines?.runtime)
|
|
4
|
+
return manifest;
|
|
5
|
+
if (manifest.engines.runtime && manifest.devEngines?.runtime) {
|
|
6
|
+
throw new DevEnginesRuntimeConflictError();
|
|
7
|
+
}
|
|
8
|
+
const { engines: { runtime, ...engines }, ...rest } = manifest;
|
|
9
|
+
return {
|
|
10
|
+
...rest,
|
|
11
|
+
engines,
|
|
12
|
+
devEngines: {
|
|
13
|
+
...rest.devEngines,
|
|
14
|
+
runtime,
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export class DevEnginesRuntimeConflictError extends PnpmError {
|
|
19
|
+
constructor() {
|
|
20
|
+
super('DEV_ENGINES_RUNTIME_CONFLICT', '.devEngines.runtime and .engines.runtime were both defined');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=engines.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 { transformEngines } from './engines.js';
|
|
4
|
+
import { transformPeerDependenciesMeta } from './peerDependenciesMeta.js';
|
|
5
|
+
import { transformRequiredFields } from './requiredFields.js';
|
|
6
|
+
export {};
|
|
7
|
+
export const transform = pipe(transformRequiredFields, transformBin, transformEngines, transformPeerDependenciesMeta);
|
|
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,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
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pnpm/releasing.exportable-manifest",
|
|
3
|
+
"version": "1000.1.7",
|
|
4
|
+
"description": "Creates an exportable manifest",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pnpm",
|
|
7
|
+
"pnpm11"
|
|
8
|
+
],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"funding": "https://opencollective.com/pnpm",
|
|
11
|
+
"repository": "https://github.com/pnpm/pnpm/tree/main/releasing/exportable-manifest",
|
|
12
|
+
"homepage": "https://github.com/pnpm/pnpm/tree/main/releasing/exportable-manifest#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/pnpm/pnpm/issues"
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"main": "lib/index.js",
|
|
18
|
+
"types": "lib/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": "./lib/index.js"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"lib",
|
|
24
|
+
"!*.map"
|
|
25
|
+
],
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@npm/types": "^2.1.0",
|
|
28
|
+
"p-map-values": "^0.1.0",
|
|
29
|
+
"ramda": "npm:@pnpm/ramda@0.28.1",
|
|
30
|
+
"@pnpm/bins.resolver": "1000.0.11",
|
|
31
|
+
"@pnpm/catalogs.resolver": "1000.0.5",
|
|
32
|
+
"@pnpm/workspace.project-manifest-reader": "1001.1.4",
|
|
33
|
+
"@pnpm/error": "1000.0.5",
|
|
34
|
+
"@pnpm/resolving.jsr-specifier-parser": "1000.0.3",
|
|
35
|
+
"@pnpm/types": "1000.9.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/cross-spawn": "^6.0.6",
|
|
39
|
+
"@types/ramda": "0.29.12",
|
|
40
|
+
"cross-spawn": "^7.0.6",
|
|
41
|
+
"write-yaml-file": "^6.0.0",
|
|
42
|
+
"@pnpm/catalogs.config": "1000.0.5",
|
|
43
|
+
"@pnpm/hooks.pnpmfile": "1002.1.3",
|
|
44
|
+
"@pnpm/catalogs.types": "1000.0.0",
|
|
45
|
+
"@pnpm/releasing.exportable-manifest": "1000.1.7",
|
|
46
|
+
"@pnpm/prepare": "1000.0.4"
|
|
47
|
+
},
|
|
48
|
+
"engines": {
|
|
49
|
+
"node": ">=22.13"
|
|
50
|
+
},
|
|
51
|
+
"jest": {
|
|
52
|
+
"preset": "@pnpm/jest-config"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"lint": "eslint \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
56
|
+
"test": "pnpm run compile && pnpm run _test",
|
|
57
|
+
"compile": "tsgo --build && pnpm run lint --fix",
|
|
58
|
+
"_test": "cross-env NODE_OPTIONS=\"$NODE_OPTIONS --experimental-vm-modules --disable-warning=ExperimentalWarning --disable-warning=DEP0169\" jest"
|
|
59
|
+
}
|
|
60
|
+
}
|