@nuvio/shared 0.5.5 → 1.1.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/dist/chunk-3R2WM7JQ.js +133 -0
- package/dist/coverage-contract-BN9lnw9L.d.ts +3088 -0
- package/dist/index.d.ts +167 -2746
- package/dist/index.js +1989 -177
- package/dist/load-pcc-manifest.d.ts +20 -0
- package/dist/load-pcc-manifest.js +62 -0
- package/package.json +7 -2
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { d as PccManifest, a3 as PccManifestParseError } from './coverage-contract-BN9lnw9L.js';
|
|
2
|
+
import 'zod';
|
|
3
|
+
|
|
4
|
+
declare const PCC_PAGES_DIR: "nuvio/pages";
|
|
5
|
+
declare function listPccManifestFiles(projectRoot: string): string[];
|
|
6
|
+
declare function loadPccManifestFromFile(filePath: string): {
|
|
7
|
+
ok: true;
|
|
8
|
+
manifest: PccManifest;
|
|
9
|
+
path: string;
|
|
10
|
+
} | {
|
|
11
|
+
ok: false;
|
|
12
|
+
error: PccManifestParseError;
|
|
13
|
+
path: string;
|
|
14
|
+
};
|
|
15
|
+
declare function resolvePccManifestPath(projectRoot: string, opts: {
|
|
16
|
+
page?: string;
|
|
17
|
+
manifest?: string;
|
|
18
|
+
}): string;
|
|
19
|
+
|
|
20
|
+
export { PCC_PAGES_DIR, listPccManifestFiles, loadPccManifestFromFile, resolvePccManifestPath };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defaultPccManifestPath,
|
|
3
|
+
parsePccManifest
|
|
4
|
+
} from "./chunk-3R2WM7JQ.js";
|
|
5
|
+
|
|
6
|
+
// src/load-pcc-manifest.ts
|
|
7
|
+
import { readFileSync, readdirSync, existsSync } from "fs";
|
|
8
|
+
import { join } from "path";
|
|
9
|
+
import { parse as parseYaml } from "yaml";
|
|
10
|
+
var PCC_PAGES_DIR = "nuvio/pages";
|
|
11
|
+
function listPccManifestFiles(projectRoot) {
|
|
12
|
+
const dir = join(projectRoot.replace(/\/$/, ""), PCC_PAGES_DIR);
|
|
13
|
+
if (!existsSync(dir)) {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
return readdirSync(dir).filter((name) => name.endsWith(".pcc.yaml") || name.endsWith(".pcc.yml")).map((name) => join(dir, name)).sort();
|
|
17
|
+
}
|
|
18
|
+
function loadPccManifestFromFile(filePath) {
|
|
19
|
+
let raw;
|
|
20
|
+
try {
|
|
21
|
+
raw = readFileSync(filePath, "utf8");
|
|
22
|
+
} catch {
|
|
23
|
+
return {
|
|
24
|
+
ok: false,
|
|
25
|
+
path: filePath,
|
|
26
|
+
error: { code: "invalid_manifest", message: `Could not read manifest: ${filePath}` }
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
let parsed;
|
|
30
|
+
try {
|
|
31
|
+
parsed = parseYaml(raw);
|
|
32
|
+
} catch (e) {
|
|
33
|
+
return {
|
|
34
|
+
ok: false,
|
|
35
|
+
path: filePath,
|
|
36
|
+
error: {
|
|
37
|
+
code: "invalid_manifest",
|
|
38
|
+
message: `Invalid YAML: ${e instanceof Error ? e.message : String(e)}`
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const result = parsePccManifest(parsed);
|
|
43
|
+
if (!result.ok) {
|
|
44
|
+
return { ok: false, path: filePath, error: result.error };
|
|
45
|
+
}
|
|
46
|
+
return { ok: true, path: filePath, manifest: result.manifest };
|
|
47
|
+
}
|
|
48
|
+
function resolvePccManifestPath(projectRoot, opts) {
|
|
49
|
+
if (opts.manifest) {
|
|
50
|
+
return opts.manifest;
|
|
51
|
+
}
|
|
52
|
+
if (!opts.page) {
|
|
53
|
+
throw new Error("Either --page or --manifest is required");
|
|
54
|
+
}
|
|
55
|
+
return defaultPccManifestPath(projectRoot, opts.page);
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
PCC_PAGES_DIR,
|
|
59
|
+
listPccManifestFiles,
|
|
60
|
+
loadPccManifestFromFile,
|
|
61
|
+
resolvePccManifestPath
|
|
62
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuvio/shared",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Nuvio wire protocol (Zod), shared types, and path helpers for dev tooling.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -32,12 +32,17 @@
|
|
|
32
32
|
"./secure-path": {
|
|
33
33
|
"types": "./dist/secure-path.d.ts",
|
|
34
34
|
"import": "./dist/secure-path.js"
|
|
35
|
+
},
|
|
36
|
+
"./load-pcc-manifest": {
|
|
37
|
+
"types": "./dist/load-pcc-manifest.d.ts",
|
|
38
|
+
"import": "./dist/load-pcc-manifest.js"
|
|
35
39
|
}
|
|
36
40
|
},
|
|
37
41
|
"engines": {
|
|
38
42
|
"node": ">=20"
|
|
39
43
|
},
|
|
40
44
|
"dependencies": {
|
|
45
|
+
"yaml": "^2.8.0",
|
|
41
46
|
"zod": "^3.24.2"
|
|
42
47
|
},
|
|
43
48
|
"devDependencies": {
|
|
@@ -47,7 +52,7 @@
|
|
|
47
52
|
"vitest": "^3.0.6"
|
|
48
53
|
},
|
|
49
54
|
"scripts": {
|
|
50
|
-
"build": "tsup src/index.ts src/secure-path.ts --format esm --dts --clean",
|
|
55
|
+
"build": "tsup src/index.ts src/secure-path.ts src/load-pcc-manifest.ts --format esm --dts --clean",
|
|
51
56
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
52
57
|
"test": "vitest run"
|
|
53
58
|
}
|