@pnpm/releasing.exportable-manifest 1100.2.4 → 1100.3.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 +23 -0
- package/lib/index.d.ts +5 -1
- package/lib/index.js +18 -7
- package/package.json +12 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @pnpm/exportable-manifest
|
|
2
2
|
|
|
3
|
+
## 1100.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Catalogs can now resolve workspace dependencies through the `workspace:` protocol.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies:
|
|
12
|
+
- @pnpm/catalogs.resolver@1100.1.0
|
|
13
|
+
- @pnpm/error@1100.1.4
|
|
14
|
+
- @pnpm/resolving.jsr-specifier-parser@1100.0.7
|
|
15
|
+
- @pnpm/workspace.project-manifest-reader@1100.0.27
|
|
16
|
+
|
|
17
|
+
## 1100.2.5
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies:
|
|
22
|
+
- @pnpm/bins.resolver@1100.0.16
|
|
23
|
+
- @pnpm/types@1102.1.0
|
|
24
|
+
- @pnpm/workspace.project-manifest-reader@1100.0.26
|
|
25
|
+
|
|
3
26
|
## 1100.2.4
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
package/lib/index.d.ts
CHANGED
|
@@ -12,7 +12,11 @@ export interface MakePublishManifestOptions {
|
|
|
12
12
|
}
|
|
13
13
|
export declare function createExportableManifest(dir: string, originalManifest: ProjectManifest, opts: MakePublishManifestOptions): Promise<ExportedManifest>;
|
|
14
14
|
export declare function readReadmeFile(projectDir: string): Promise<string | undefined>;
|
|
15
|
-
export type PublishDependencyConverter = (depName: string, depSpec: string,
|
|
15
|
+
export type PublishDependencyConverter = (depName: string, depSpec: string, context: PublishDependencyConverterContext) => Promise<string> | string;
|
|
16
|
+
export interface PublishDependencyConverterContext {
|
|
17
|
+
dir: string;
|
|
18
|
+
modulesDir?: string;
|
|
19
|
+
}
|
|
16
20
|
export interface MakePublishDependenciesOpts {
|
|
17
21
|
readonly modulesDir?: string;
|
|
18
22
|
readonly convertDependencyForPublish: PublishDependencyConverter;
|
package/lib/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import { resolveFromCatalog } from '@pnpm/catalogs.resolver';
|
|
|
5
5
|
import { PnpmError } from '@pnpm/error';
|
|
6
6
|
import { parseJsrSpecifier } from '@pnpm/resolving.jsr-specifier-parser';
|
|
7
7
|
import { tryReadProjectManifest } from '@pnpm/workspace.project-manifest-reader';
|
|
8
|
+
import { WorkspaceSpec } from '@pnpm/workspace.spec-parser';
|
|
8
9
|
import { clone, omit } from 'ramda';
|
|
9
10
|
import { overridePublishConfig } from './overridePublishConfig.js';
|
|
10
11
|
import { transform } from './transform/index.js';
|
|
@@ -30,7 +31,7 @@ export async function createExportableManifest(dir, originalManifest, opts) {
|
|
|
30
31
|
}
|
|
31
32
|
const catalogResolver = resolveFromCatalog.bind(null, opts.catalogs);
|
|
32
33
|
const replaceCatalogProtocol = resolveCatalogProtocol.bind(null, catalogResolver);
|
|
33
|
-
const convertDependencyForPublish = combineConverters(
|
|
34
|
+
const convertDependencyForPublish = combineConverters(replaceCatalogProtocol, replaceWorkspaceProtocol, replaceJsrProtocol);
|
|
34
35
|
await Promise.all(['dependencies', 'devDependencies', 'optionalDependencies'].map(async (depsField) => {
|
|
35
36
|
const deps = await makePublishDependencies(dir, originalManifest[depsField], {
|
|
36
37
|
modulesDir: opts?.modulesDir,
|
|
@@ -42,7 +43,7 @@ export async function createExportableManifest(dir, originalManifest, opts) {
|
|
|
42
43
|
}));
|
|
43
44
|
const peerDependencies = originalManifest.peerDependencies;
|
|
44
45
|
if (peerDependencies) {
|
|
45
|
-
const convertPeersForPublish = combineConverters(
|
|
46
|
+
const convertPeersForPublish = combineConverters(replaceCatalogProtocol, replaceWorkspaceProtocolPeerDependency, replaceJsrProtocol);
|
|
46
47
|
publishManifest.peerDependencies = await makePublishDependencies(dir, peerDependencies, {
|
|
47
48
|
modulesDir: opts?.modulesDir,
|
|
48
49
|
convertDependencyForPublish: convertPeersForPublish,
|
|
@@ -89,11 +90,11 @@ export async function readReadmeFile(projectDir) {
|
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
92
|
function combineConverters(...converters) {
|
|
92
|
-
return async (depName, depSpec,
|
|
93
|
+
return async (depName, depSpec, context) => {
|
|
93
94
|
let bareSpecifier = depSpec;
|
|
94
95
|
for (const converter of converters) {
|
|
95
96
|
// eslint-disable-next-line no-await-in-loop
|
|
96
|
-
bareSpecifier = await converter(depName, bareSpecifier,
|
|
97
|
+
bareSpecifier = await converter(depName, bareSpecifier, context);
|
|
97
98
|
}
|
|
98
99
|
return bareSpecifier;
|
|
99
100
|
};
|
|
@@ -101,7 +102,7 @@ function combineConverters(...converters) {
|
|
|
101
102
|
async function makePublishDependencies(dir, dependencies, { modulesDir, convertDependencyForPublish }) {
|
|
102
103
|
if (dependencies == null)
|
|
103
104
|
return dependencies;
|
|
104
|
-
const publishDependencies = await Promise.all(Object.entries(dependencies).map(async ([depName, depSpec]) => [depName, await convertDependencyForPublish(depName, depSpec, dir, modulesDir)]));
|
|
105
|
+
const publishDependencies = await Promise.all(Object.entries(dependencies).map(async ([depName, depSpec]) => [depName, await convertDependencyForPublish(depName, depSpec, { dir, modulesDir })]));
|
|
105
106
|
return Object.fromEntries(publishDependencies);
|
|
106
107
|
}
|
|
107
108
|
async function readAndCheckManifest(depName, dependencyDir) {
|
|
@@ -120,7 +121,7 @@ function resolveCatalogProtocol(catalogResolver, alias, bareSpecifier) {
|
|
|
120
121
|
case 'misconfiguration': throw result.error;
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
|
-
async function replaceWorkspaceProtocol(depName, depSpec, dir, modulesDir) {
|
|
124
|
+
async function replaceWorkspaceProtocol(depName, depSpec, { dir, modulesDir }) {
|
|
124
125
|
if (!depSpec.startsWith('workspace:')) {
|
|
125
126
|
return depSpec;
|
|
126
127
|
}
|
|
@@ -148,10 +149,20 @@ async function replaceWorkspaceProtocol(depName, depSpec, dir, modulesDir) {
|
|
|
148
149
|
}
|
|
149
150
|
return depSpec;
|
|
150
151
|
}
|
|
151
|
-
async function replaceWorkspaceProtocolPeerDependency(depName, depSpec, dir, modulesDir) {
|
|
152
|
+
async function replaceWorkspaceProtocolPeerDependency(depName, depSpec, { dir, modulesDir }) {
|
|
152
153
|
if (!depSpec.includes('workspace:')) {
|
|
153
154
|
return depSpec;
|
|
154
155
|
}
|
|
156
|
+
const workspaceSpec = WorkspaceSpec.parse(depSpec);
|
|
157
|
+
if (workspaceSpec?.alias != null) {
|
|
158
|
+
const version = workspaceSpec.version === '^' || workspaceSpec.version === '~' || workspaceSpec.version === ''
|
|
159
|
+
? '*'
|
|
160
|
+
: workspaceSpec.version;
|
|
161
|
+
return `npm:${workspaceSpec.alias}@${version}`;
|
|
162
|
+
}
|
|
163
|
+
if (workspaceSpec?.version.startsWith('./') || workspaceSpec?.version.startsWith('../')) {
|
|
164
|
+
return replaceWorkspaceProtocol(depName, depSpec, { dir, modulesDir });
|
|
165
|
+
}
|
|
155
166
|
// Dependencies with bare "*", "^", "~",">=",">","<=", "<", version
|
|
156
167
|
const workspaceSemverRegex = /workspace:([\^~*]|>=|>|<=|<)?((\d+|[xX*])(\.(\d+|[xX*])){0,2})?/;
|
|
157
168
|
const versionAliasSpecParts = workspaceSemverRegex.exec(depSpec);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/releasing.exportable-manifest",
|
|
3
|
-
"version": "1100.
|
|
3
|
+
"version": "1100.3.0",
|
|
4
4
|
"description": "Creates an exportable manifest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -28,21 +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.1.
|
|
34
|
-
"@pnpm/resolving.jsr-specifier-parser": "1100.0.
|
|
35
|
-
"@pnpm/types": "1102.
|
|
36
|
-
"@pnpm/workspace.project-manifest-reader": "1100.0.
|
|
31
|
+
"@pnpm/bins.resolver": "1100.0.16",
|
|
32
|
+
"@pnpm/catalogs.resolver": "1100.1.0",
|
|
33
|
+
"@pnpm/error": "1100.1.4",
|
|
34
|
+
"@pnpm/resolving.jsr-specifier-parser": "1100.0.7",
|
|
35
|
+
"@pnpm/types": "1102.1.0",
|
|
36
|
+
"@pnpm/workspace.project-manifest-reader": "1100.0.27",
|
|
37
|
+
"@pnpm/workspace.spec-parser": "1100.0.1",
|
|
37
38
|
"ramda": "npm:@pnpm/ramda@0.28.1"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"@jest/globals": "30.4.1",
|
|
41
|
-
"@pnpm/catalogs.config": "1100.0.
|
|
42
|
+
"@pnpm/catalogs.config": "1100.0.7",
|
|
42
43
|
"@pnpm/catalogs.types": "1100.0.1",
|
|
43
|
-
"@pnpm/hooks.pnpmfile": "1100.0.
|
|
44
|
-
"@pnpm/prepare": "1100.0.
|
|
45
|
-
"@pnpm/releasing.exportable-manifest": "1100.
|
|
44
|
+
"@pnpm/hooks.pnpmfile": "1100.0.30",
|
|
45
|
+
"@pnpm/prepare": "1100.0.29",
|
|
46
|
+
"@pnpm/releasing.exportable-manifest": "1100.3.0",
|
|
46
47
|
"@types/cross-spawn": "^6.0.6",
|
|
47
48
|
"@types/ramda": "0.32.0",
|
|
48
49
|
"cross-spawn": "^7.0.6",
|