load-populate-files 1.1.1 → 1.1.2

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.
@@ -1,3 +1,3 @@
1
1
  import type { PopulateFileParams } from 'populate-files';
2
- export declare const isPopulateFileParams: (x: unknown) => x is PopulateFileParams[] | PopulateFileParams;
2
+ export declare const populateFileParamsValidator: import("juniper-validator").JuniperValidator<PopulateFileParams[] | PopulateFileParams>;
3
3
  //# sourceMappingURL=populate-files-validator.d.ts.map
@@ -4,7 +4,10 @@ const populateFileParam = objectSchema({
4
4
  properties: {
5
5
  filePath: stringSchema(),
6
6
  content: mergeSchema().cast(),
7
- signed: booleanSchema()
7
+ signed: booleanSchema(),
8
+ manifestInputs: objectSchema({
9
+ additionalProperties: stringSchema()
10
+ })
8
11
  },
9
12
  required: [
10
13
  'filePath',
@@ -17,6 +20,6 @@ const populateFileParams = mergeSchema().oneOf([
17
20
  items: populateFileParam
18
21
  })
19
22
  ]);
20
- export const isPopulateFileParams = makeValidator(populateFileParams).is;
23
+ export const populateFileParamsValidator = makeValidator(populateFileParams);
21
24
 
22
25
  //# sourceMappingURL=populate-files-validator.js.map
@@ -1,6 +1,10 @@
1
1
  import { defaultImport } from 'default-import';
2
2
  import { hasCode } from 'unknown-error';
3
- import { isPopulateFileParams } from './lib/populate-files-validator.js';
3
+ import { populateFileParamsValidator } from './lib/populate-files-validator.js';
4
+ const formatIssue = ({ path, message })=>{
5
+ const at = path.map(String).join('.');
6
+ return at ? `- ${at}: ${message}` : `- ${message}`;
7
+ };
4
8
  export const loadFile = async (filePath)=>{
5
9
  let mod;
6
10
  try {
@@ -14,12 +18,16 @@ export const loadFile = async (filePath)=>{
14
18
  throw err;
15
19
  }
16
20
  const params = defaultImport(mod);
17
- if (isPopulateFileParams(params)) {
21
+ const result = populateFileParamsValidator.validate(params);
22
+ if (!result.issues) {
18
23
  return [
19
- params
24
+ result.value
20
25
  ].flat();
21
26
  }
22
- throw new Error(`File content does not fulfill populate-file input at: ${filePath}`);
27
+ throw new Error([
28
+ `File content does not fulfill populate-file input at: ${filePath}`,
29
+ ...result.issues.map((issue)=>formatIssue(issue))
30
+ ].join('\n'));
23
31
  };
24
32
 
25
33
  //# sourceMappingURL=loader.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "load-populate-files",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Load and dynamically populate file content",
5
5
  "engines": {
6
6
  "node": ">=24"
@@ -39,13 +39,13 @@
39
39
  "dependencies": {
40
40
  "ci-info": "^4.4.0",
41
41
  "default-import": "^3.0.1",
42
- "entry-script": "^4.1.0",
43
- "haywire": "^2.0.1",
44
- "haywire-launcher": "^1.0.3",
45
- "juniper": "^2.4.0",
46
- "juniper-validator": "^0.4.0",
42
+ "entry-script": "^4.1.1",
43
+ "haywire": "^2.0.2",
44
+ "haywire-launcher": "^1.1.0",
45
+ "juniper": "^2.4.1",
46
+ "juniper-validator": "^0.5.0",
47
47
  "parse-cwd": "^2.0.2",
48
- "populate-files": "^1.1.1",
48
+ "populate-files": "^1.1.2",
49
49
  "unknown-error": "^0.1.0",
50
50
  "yargs": "^18.2.0"
51
51
  },
@@ -61,7 +61,7 @@
61
61
  "@typescript/native": "npm:typescript@^7.0.2",
62
62
  "c8": "^12.0.0",
63
63
  "eslint": "^10.12.0",
64
- "generated-signature": "^0.1.0",
64
+ "generated-signature": "^0.1.1",
65
65
  "mocha": "^12.0.2",
66
66
  "mocha-chain": "^1.0.1",
67
67
  "tmp-promise": "^3.0.3",