@pnpm/workspace.project-manifest-reader 1100.0.19 → 1100.0.20
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 +14 -0
- package/lib/index.d.ts +20 -0
- package/lib/readFile.d.ts +9 -0
- package/lib/readFile.js +35 -0
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @pnpm/read-project-manifest
|
|
2
2
|
|
|
3
|
+
## 1100.0.20
|
|
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/error@1100.1.0
|
|
11
|
+
- @pnpm/fs.graceful-fs@1100.1.1
|
|
12
|
+
- @pnpm/pkg-manifest.utils@1100.2.12
|
|
13
|
+
- @pnpm/text.comments-parser@1100.0.1
|
|
14
|
+
- @pnpm/types@1101.6.0
|
|
15
|
+
- @pnpm/workspace.project-manifest-writer@1100.0.11
|
|
16
|
+
|
|
3
17
|
## 1100.0.19
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ProjectManifest } from '@pnpm/types';
|
|
2
|
+
export type WriteProjectManifest = (manifest: ProjectManifest, force?: boolean) => Promise<void>;
|
|
3
|
+
export declare function safeReadProjectManifestOnly(projectDir: string): Promise<ProjectManifest | null>;
|
|
4
|
+
export declare function readProjectManifest(projectDir: string): Promise<{
|
|
5
|
+
fileName: string;
|
|
6
|
+
manifest: ProjectManifest;
|
|
7
|
+
writeProjectManifest: WriteProjectManifest;
|
|
8
|
+
}>;
|
|
9
|
+
export declare function readProjectManifestOnly(projectDir: string): Promise<ProjectManifest>;
|
|
10
|
+
export declare function tryReadProjectManifest(projectDir: string): Promise<{
|
|
11
|
+
fileName: string;
|
|
12
|
+
manifest: ProjectManifest | null;
|
|
13
|
+
writeProjectManifest: WriteProjectManifest;
|
|
14
|
+
}>;
|
|
15
|
+
interface ReadExactProjectManifestResult {
|
|
16
|
+
manifest: ProjectManifest;
|
|
17
|
+
writeProjectManifest: WriteProjectManifest;
|
|
18
|
+
}
|
|
19
|
+
export declare function readExactProjectManifest(manifestPath: string): Promise<ReadExactProjectManifestResult>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ProjectManifest } from '@pnpm/types';
|
|
2
|
+
export declare function readJson5File(filePath: string): Promise<{
|
|
3
|
+
data: ProjectManifest;
|
|
4
|
+
text: string;
|
|
5
|
+
}>;
|
|
6
|
+
export declare function readJsonFile(filePath: string): Promise<{
|
|
7
|
+
data: ProjectManifest;
|
|
8
|
+
text: string;
|
|
9
|
+
}>;
|
package/lib/readFile.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import gfs from '@pnpm/fs.graceful-fs';
|
|
2
|
+
import JSON5 from 'json5';
|
|
3
|
+
import parseJson from 'parse-json';
|
|
4
|
+
import stripBom from 'strip-bom';
|
|
5
|
+
export async function readJson5File(filePath) {
|
|
6
|
+
const text = await readFileWithoutBom(filePath);
|
|
7
|
+
try {
|
|
8
|
+
return {
|
|
9
|
+
data: JSON5.parse(text),
|
|
10
|
+
text,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
catch (err) { // eslint-disable-line
|
|
14
|
+
err.message = `${err.message} in ${filePath}`;
|
|
15
|
+
err['code'] = 'ERR_PNPM_JSON5_PARSE';
|
|
16
|
+
throw err;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export async function readJsonFile(filePath) {
|
|
20
|
+
const text = await readFileWithoutBom(filePath);
|
|
21
|
+
try {
|
|
22
|
+
return {
|
|
23
|
+
data: parseJson(text, filePath),
|
|
24
|
+
text,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
catch (err) { // eslint-disable-line
|
|
28
|
+
err['code'] = 'ERR_PNPM_JSON_PARSE';
|
|
29
|
+
throw err;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async function readFileWithoutBom(path) {
|
|
33
|
+
return stripBom(await gfs.readFile(path, 'utf8'));
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=readFile.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/workspace.project-manifest-reader",
|
|
3
|
-
"version": "1100.0.
|
|
3
|
+
"version": "1100.0.20",
|
|
4
4
|
"description": "Read a project manifest (called package.json in most cases)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
"!*.map"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@pnpm/error": "1100.0
|
|
31
|
-
"@pnpm/fs.graceful-fs": "1100.1.
|
|
32
|
-
"@pnpm/pkg-manifest.utils": "1100.2.
|
|
33
|
-
"@pnpm/text.comments-parser": "1100.0.
|
|
34
|
-
"@pnpm/types": "1101.
|
|
35
|
-
"@pnpm/workspace.project-manifest-writer": "1100.0.
|
|
30
|
+
"@pnpm/error": "1100.1.0",
|
|
31
|
+
"@pnpm/fs.graceful-fs": "1100.1.1",
|
|
32
|
+
"@pnpm/pkg-manifest.utils": "1100.2.12",
|
|
33
|
+
"@pnpm/text.comments-parser": "1100.0.1",
|
|
34
|
+
"@pnpm/types": "1101.6.0",
|
|
35
|
+
"@pnpm/workspace.project-manifest-writer": "1100.0.11",
|
|
36
36
|
"detect-indent": "7.0.2",
|
|
37
37
|
"fast-deep-equal": "^3.1.3",
|
|
38
38
|
"is-windows": "^1.0.2",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@jest/globals": "30.4.1",
|
|
50
|
-
"@pnpm/test-fixtures": "1100.0.
|
|
51
|
-
"@pnpm/workspace.project-manifest-reader": "1100.0.
|
|
50
|
+
"@pnpm/test-fixtures": "1100.0.1",
|
|
51
|
+
"@pnpm/workspace.project-manifest-reader": "1100.0.20",
|
|
52
52
|
"@types/is-windows": "^1.0.2",
|
|
53
53
|
"@types/parse-json": "^7.0.0",
|
|
54
54
|
"tempy": "3.0.0"
|