@brydio/manifest 0.1.0-alpha.4 → 0.1.0-alpha.40

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/src/validate.js CHANGED
@@ -1,6 +1,8 @@
1
- import { appManifestSchema } from "./schema.js";
2
- export function validateManifest(source) {
3
- const parsed = appManifestSchema.safeParse(source);
1
+ import { appManifestSchema, newAppManifestSchema } from "./schema.js";
2
+ export function validateManifest(source,
3
+ /** `retired`: a manifest being written now, which may not use a retired kind such as `project-tab`. */
4
+ options = {}) {
5
+ const parsed = (options.retired ? newAppManifestSchema : appManifestSchema).safeParse(source);
4
6
  if (parsed.success)
5
7
  return { ok: true, manifest: parsed.data, problems: [] };
6
8
  return {
@@ -14,7 +16,7 @@ export function validateManifest(source) {
14
16
  };
15
17
  }
16
18
  /** Parses the text of `.brydio/app.json` and validates it. */
17
- export function validateManifestText(text) {
19
+ export function validateManifestText(text, options = {}) {
18
20
  let json;
19
21
  try {
20
22
  json = JSON.parse(text);
@@ -25,5 +27,5 @@ export function validateManifestText(text) {
25
27
  problems: [{ code: 'manifest_not_json', message: `The manifest is not valid JSON: ${error instanceof Error ? error.message : String(error)}` }],
26
28
  };
27
29
  }
28
- return validateManifest(json);
30
+ return validateManifest(json, options);
29
31
  }