metascope 0.7.0 → 0.7.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.
Files changed (80) hide show
  1. package/dist/bin/chunk-Bdh3yLIe.js +1 -0
  2. package/dist/bin/cli.js +308 -284
  3. package/dist/bin/dns-CUigd8AG.js +1 -0
  4. package/dist/bin/{jiti-D2Njwwqq.js → jiti-BTBDwj9g.js} +2 -2
  5. package/dist/bin/renovate-DxDKd5Ft.js +1 -0
  6. package/dist/bin/shared-CTlQdTfh.js +5 -0
  7. package/dist/lib/file-matching.js +20 -13
  8. package/dist/lib/log.d.ts +6 -4
  9. package/dist/lib/log.js +5 -3
  10. package/dist/lib/metadata-types.d.ts +33 -21
  11. package/dist/lib/metadata-types.js +8 -9
  12. package/dist/lib/metadata.js +7 -7
  13. package/dist/lib/package.js +1 -1
  14. package/dist/lib/parsers/gemspec-parser.js +16 -14
  15. package/dist/lib/parsers/go-mod-parser.js +13 -10
  16. package/dist/lib/parsers/makefile-config-parser.js +20 -17
  17. package/dist/lib/parsers/properties-parser.js +3 -3
  18. package/dist/lib/parsers/rfc822-header-parser.js +4 -4
  19. package/dist/lib/parsers/setup-py-parser.js +3 -4
  20. package/dist/lib/source.d.ts +1 -0
  21. package/dist/lib/source.js +5 -4
  22. package/dist/lib/sources/arduino-library-properties.d.ts +10 -10
  23. package/dist/lib/sources/arduino-library-properties.js +32 -15
  24. package/dist/lib/sources/cinder-cinderblock-xml.d.ts +11 -11
  25. package/dist/lib/sources/cinder-cinderblock-xml.js +21 -9
  26. package/dist/lib/sources/codemeta-json.d.ts +66 -66
  27. package/dist/lib/sources/codemeta-json.js +27 -23
  28. package/dist/lib/sources/git-stats.js +1 -1
  29. package/dist/lib/sources/github-actions.js +9 -2
  30. package/dist/lib/sources/github.js +1 -1
  31. package/dist/lib/sources/go-go-mod.d.ts +4 -4
  32. package/dist/lib/sources/go-goreleaser-yaml.d.ts +8 -8
  33. package/dist/lib/sources/go-goreleaser-yaml.js +5 -4
  34. package/dist/lib/sources/java-pom-xml.d.ts +12 -12
  35. package/dist/lib/sources/java-pom-xml.js +38 -19
  36. package/dist/lib/sources/metadata-file.d.ts +4 -4
  37. package/dist/lib/sources/metadata-file.js +15 -12
  38. package/dist/lib/sources/node-npm-registry.js +1 -1
  39. package/dist/lib/sources/openframeworks-addon-config-mk.d.ts +7 -7
  40. package/dist/lib/sources/openframeworks-addon-config-mk.js +7 -0
  41. package/dist/lib/sources/openframeworks-install-xml.d.ts +10 -10
  42. package/dist/lib/sources/openframeworks-install-xml.js +24 -14
  43. package/dist/lib/sources/processing-library-properties.d.ts +8 -8
  44. package/dist/lib/sources/processing-library-properties.js +25 -10
  45. package/dist/lib/sources/processing-sketch-properties.d.ts +16 -16
  46. package/dist/lib/sources/processing-sketch-properties.js +51 -7
  47. package/dist/lib/sources/publiccode-yaml.d.ts +23 -23
  48. package/dist/lib/sources/publiccode-yaml.js +37 -5
  49. package/dist/lib/sources/python-pkg-info.d.ts +18 -18
  50. package/dist/lib/sources/python-pkg-info.js +2 -2
  51. package/dist/lib/sources/python-setup-cfg.d.ts +14 -14
  52. package/dist/lib/sources/python-setup-cfg.js +2 -2
  53. package/dist/lib/sources/python-setup-py.d.ts +14 -14
  54. package/dist/lib/sources/readme-file.js +9 -2
  55. package/dist/lib/sources/ruby-gemspec.d.ts +22 -22
  56. package/dist/lib/sources/ruby-gemspec.js +1 -0
  57. package/dist/lib/sources/rust-cargo-toml.d.ts +14 -14
  58. package/dist/lib/sources/rust-cargo-toml.js +29 -10
  59. package/dist/lib/sources/xcode-info-plist.d.ts +12 -12
  60. package/dist/lib/sources/xcode-info-plist.js +48 -24
  61. package/dist/lib/sources/xcode-project-pbxproj.d.ts +8 -8
  62. package/dist/lib/sources/xcode-project-pbxproj.js +22 -12
  63. package/dist/lib/templates/codemeta-json.d.ts +4 -5
  64. package/dist/lib/templates/codemeta-json.js +4 -5
  65. package/dist/lib/templates/codemeta.js +30 -30
  66. package/dist/lib/templates/metadata.d.ts +2 -2
  67. package/dist/lib/templates/metadata.js +3 -3
  68. package/dist/lib/utilities/codemeta-helpers.d.ts +3 -2
  69. package/dist/lib/utilities/codemeta-helpers.js +14 -12
  70. package/dist/lib/utilities/fetch.js +2 -2
  71. package/dist/lib/utilities/formatting.js +4 -3
  72. package/dist/lib/utilities/github.js +3 -3
  73. package/dist/lib/utilities/license-identification.d.ts +3 -1
  74. package/dist/lib/utilities/license-identification.js +21 -25
  75. package/dist/lib/utilities/schema-primitives.js +16 -13
  76. package/dist/lib/utilities/template-helpers.js +3 -3
  77. package/package.json +14 -14
  78. package/readme.md +7 -3
  79. package/dist/.DS_Store +0 -0
  80. package/dist/bin/chunk-BjEoQXZ0.js +0 -1
@@ -43,7 +43,8 @@ function isNonEmptyString(value) {
43
43
  }
44
44
  /**
45
45
  * Get the first non-empty string value of a given field from an array of
46
- * package-manager section entries. Skips Go template strings (containing `{{`).
46
+ * package-manager section entries. Skips Go template strings (containing
47
+ * `{{`).
47
48
  */
48
49
  function firstString(sections, field) {
49
50
  for (const section of sections) if (isPlainObject(section)) {
@@ -52,8 +53,8 @@ function firstString(sections, field) {
52
53
  }
53
54
  }
54
55
  /**
55
- * Collect all section entries for a given key, handling both v1 singular
56
- * and v2 plural forms.
56
+ * Collect all section entries for a given key, handling both v1 singular and v2
57
+ * plural forms.
57
58
  */
58
59
  function collectSections(data, ...keys) {
59
60
  const result = [];
@@ -78,7 +79,7 @@ function parse$1(source) {
78
79
  } catch {
79
80
  return;
80
81
  }
81
- if (!isPlainObject(data)) return void 0;
82
+ if (!isPlainObject(data)) return;
82
83
  const result = {
83
84
  description: void 0,
84
85
  homepage: void 0,
@@ -3,8 +3,8 @@ import { z } from "zod";
3
3
 
4
4
  //#region src/lib/sources/java-pom-xml.d.ts
5
5
  declare const pomXmlSchema: z.ZodObject<{
6
- artifactId: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
7
- ciManagementUrl: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
6
+ artifactId: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
7
+ ciManagementUrl: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
8
8
  contributors: z.ZodArray<z.ZodObject<{
9
9
  email: z.ZodOptional<z.ZodString>;
10
10
  name: z.ZodString;
@@ -16,7 +16,7 @@ declare const pomXmlSchema: z.ZodObject<{
16
16
  groupId: z.ZodString;
17
17
  version: z.ZodOptional<z.ZodString>;
18
18
  }, z.core.$strip>>;
19
- description: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
19
+ description: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
20
20
  devDependencies: z.ZodArray<z.ZodObject<{
21
21
  artifactId: z.ZodString;
22
22
  groupId: z.ZodString;
@@ -28,23 +28,23 @@ declare const pomXmlSchema: z.ZodObject<{
28
28
  organization: z.ZodOptional<z.ZodString>;
29
29
  url: z.ZodOptional<z.ZodString>;
30
30
  }, z.core.$strip>>;
31
- groupId: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
32
- identifier: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
33
- inceptionYear: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
34
- issueManagementUrl: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
35
- javaVersion: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
31
+ groupId: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
32
+ identifier: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
33
+ inceptionYear: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
34
+ issueManagementUrl: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
35
+ javaVersion: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
36
36
  licenses: z.ZodArray<z.ZodObject<{
37
37
  name: z.ZodOptional<z.ZodString>;
38
38
  url: z.ZodOptional<z.ZodString>;
39
39
  }, z.core.$strip>>;
40
- name: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
40
+ name: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
41
41
  organization: z.ZodOptional<z.ZodObject<{
42
42
  name: z.ZodString;
43
43
  url: z.ZodOptional<z.ZodString>;
44
44
  }, z.core.$strip>>;
45
- scmUrl: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
46
- url: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
47
- version: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
45
+ scmUrl: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
46
+ url: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
47
+ version: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
48
48
  }, z.core.$strip>;
49
49
  type PomXml = z.infer<typeof pomXmlSchema>;
50
50
  type JavaPomXmlData = OneOrMany<SourceRecord<PomXml>> | undefined;
@@ -38,28 +38,46 @@ const pomXmlOrganizationSchema = z.object({
38
38
  url: z.string().optional()
39
39
  });
40
40
  const pomXmlSchema = z.object({
41
+ /** Maven artifactId. */
41
42
  artifactId: nonEmptyString,
43
+ /** CI management URL. */
42
44
  ciManagementUrl: optionalUrl,
45
+ /** Project contributors. */
43
46
  contributors: z.array(pomXmlPersonEntrySchema),
47
+ /** Runtime dependencies (non-test scope). */
44
48
  dependencies: z.array(pomXmlDependencyEntrySchema),
49
+ /** Project description. */
45
50
  description: nonEmptyString,
51
+ /** Test-scope dependencies. */
46
52
  devDependencies: z.array(pomXmlDependencyEntrySchema),
53
+ /** Project developers / authors. */
47
54
  developers: z.array(pomXmlPersonEntrySchema),
55
+ /** Maven groupId. */
48
56
  groupId: nonEmptyString,
57
+ /** Combined identifier (groupId.artifactId). */
49
58
  identifier: nonEmptyString,
59
+ /** Year of project inception. */
50
60
  inceptionYear: nonEmptyString,
61
+ /** Issue tracker URL. */
51
62
  issueManagementUrl: optionalUrl,
63
+ /** Java version from properties. */
52
64
  javaVersion: nonEmptyString,
65
+ /** Project licenses. */
53
66
  licenses: z.array(pomXmlLicenseEntrySchema),
67
+ /** Project name (with Maven variables resolved). */
54
68
  name: nonEmptyString,
69
+ /** Producer organization. */
55
70
  organization: pomXmlOrganizationSchema.optional(),
71
+ /** SCM (source code management) URL. */
56
72
  scmUrl: optionalUrl,
73
+ /** Project URL / homepage. */
57
74
  url: optionalUrl,
75
+ /** Project version. */
58
76
  version: nonEmptyString
59
77
  });
60
78
  /**
61
- * Parse a Maven `pom.xml` content string into a structured object.
62
- * Returns undefined if the XML is malformed or missing the `<project>` root element.
79
+ * Parse a Maven `pom.xml` content string into a structured object. Returns
80
+ * undefined if the XML is malformed or missing the `<project>` root element.
63
81
  */
64
82
  function parse(content) {
65
83
  const parser = new XMLParser({
@@ -70,12 +88,12 @@ function parse(content) {
70
88
  let data;
71
89
  try {
72
90
  const parsed = parser.parse(content);
73
- if (!is.plainObject(parsed)) return void 0;
91
+ if (!is.plainObject(parsed)) return;
74
92
  data = parsed;
75
93
  } catch {
76
94
  return;
77
95
  }
78
- if (!is.plainObject(data.project)) return void 0;
96
+ if (!is.plainObject(data.project)) return;
79
97
  const { project } = data;
80
98
  const groupId = getString(project.groupId);
81
99
  const artifactId = getString(project.artifactId);
@@ -102,13 +120,13 @@ function parse(content) {
102
120
  });
103
121
  }
104
122
  /**
105
- * Get a trimmed non-empty string from a parsed XML value.
106
- * Returns undefined for empty strings, non-strings, whitespace-only, or Maven variable references.
123
+ * Get a trimmed non-empty string from a parsed XML value. Returns undefined for
124
+ * empty strings, non-strings, whitespace-only, or Maven variable references.
107
125
  */
108
126
  function getString(value) {
109
- if (typeof value !== "string") return void 0;
127
+ if (typeof value !== "string") return;
110
128
  const trimmed = value.trim();
111
- if (trimmed.length === 0) return void 0;
129
+ if (trimmed.length === 0) return;
112
130
  return trimmed;
113
131
  }
114
132
  /**
@@ -116,7 +134,7 @@ function getString(value) {
116
134
  */
117
135
  function getCleanString(value) {
118
136
  const s = getString(value);
119
- if (s?.includes("$")) return void 0;
137
+ if (s?.includes("$")) return;
120
138
  return s;
121
139
  }
122
140
  /**
@@ -124,18 +142,19 @@ function getCleanString(value) {
124
142
  */
125
143
  function resolveName(project, groupId, artifactId) {
126
144
  const name = getString(project.name);
127
- if (!name) return void 0;
145
+ if (!name) return;
128
146
  let resolved = name;
129
147
  if (groupId) resolved = resolved.replaceAll("${project.groupId}", groupId);
130
148
  if (artifactId) resolved = resolved.replaceAll("${project.artifactId}", artifactId);
131
149
  return resolved;
132
150
  }
133
151
  /**
134
- * Extract a URL from a nested object (e.g. `<ciManagement><url>...</url></ciManagement>`).
135
- * Filters out Maven variable references.
152
+ * Extract a URL from a nested object (e.g.
153
+ * `<ciManagement><url>...</url></ciManagement>`). Filters out Maven variable
154
+ * references.
136
155
  */
137
156
  function getNestedUrl(container) {
138
- if (!is.plainObject(container)) return void 0;
157
+ if (!is.plainObject(container)) return;
139
158
  return getCleanString(container.url);
140
159
  }
141
160
  /**
@@ -207,27 +226,27 @@ function parseDependencies(project) {
207
226
  * Parse SCM URL, filtering out Maven variable references.
208
227
  */
209
228
  function parseScmUrl(project) {
210
- if (!is.plainObject(project.scm)) return void 0;
229
+ if (!is.plainObject(project.scm)) return;
211
230
  return getCleanString(project.scm.url);
212
231
  }
213
232
  /**
214
233
  * Parse organization from `<organization>` element.
215
234
  */
216
235
  function parseOrganization(project) {
217
- if (!is.plainObject(project.organization)) return void 0;
236
+ if (!is.plainObject(project.organization)) return;
218
237
  const name = getString(project.organization.name);
219
- if (!name) return void 0;
238
+ if (!name) return;
220
239
  return {
221
240
  name,
222
241
  url: getString(project.organization.url)
223
242
  };
224
243
  }
225
244
  /**
226
- * Extract Java version from project properties.
227
- * Checks `java.version`, `maven.compiler.source`, and `java.compiler.source`.
245
+ * Extract Java version from project properties. Checks `java.version`,
246
+ * `maven.compiler.source`, and `java.compiler.source`.
228
247
  */
229
248
  function parseJavaVersion(project) {
230
- if (!is.plainObject(project.properties)) return void 0;
249
+ if (!is.plainObject(project.properties)) return;
231
250
  return getCleanString(project.properties["java.version"]) ?? getCleanString(project.properties["maven.compiler.source"]) ?? getCleanString(project.properties["java.compiler.source"]);
232
251
  }
233
252
  const javaPomXmlSource = defineSource({
@@ -3,10 +3,10 @@ import { z } from "zod";
3
3
 
4
4
  //#region src/lib/sources/metadata-file.d.ts
5
5
  declare const metadataSchema: z.ZodObject<{
6
- description: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
7
- homepage: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
8
- keywords: z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>;
9
- repository: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
6
+ description: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
7
+ homepage: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
8
+ keywords: z.ZodDefault<z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>>;
9
+ repository: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
10
10
  }, z.core.$strip>;
11
11
  type Metadata = z.infer<typeof metadataSchema>;
12
12
  type MetadataFileData = OneOrMany<SourceRecord<Metadata>> | undefined;
@@ -9,27 +9,30 @@ import { z } from "zod";
9
9
  import { parse } from "yaml";
10
10
  //#region src/lib/sources/metadata-file.ts
11
11
  /**
12
- * Source and parser for custom `metadata.json` / `metadata.yaml` / `metadata.yml` files.
12
+ * Source and parser for custom `metadata.json` / `metadata.yaml` /
13
+ * `metadata.yml` files.
13
14
  *
14
- * This is a simple custom format with synonymous field names for common
15
- * project metadata. It supports JSON and YAML formats.
15
+ * This is a simple custom format with synonymous field names for common project
16
+ * metadata. It supports JSON and YAML formats.
16
17
  *
17
- * Field mapping (with fallback chains):
18
- * description description
19
- * homepage | url | repository (normalized) | website homepage
20
- * keywords | tags | topics → keywords
21
- * repository (normalized) → repository
18
+ * Field mapping (with fallback chains): description → description homepage |
19
+ * url | repository (normalized) | website homepage keywords | tags | topics →
20
+ * keywords repository (normalized) → repository
22
21
  */
23
22
  const metadataSchema = z.object({
23
+ /** Project description. */
24
24
  description: nonEmptyString,
25
+ /** Project homepage URL (resolved from homepage, url, repository, or website). */
25
26
  homepage: optionalUrl,
27
+ /** Keyword list (resolved from keywords, tags, or topics). */
26
28
  keywords: stringArray,
29
+ /** Repository URL (normalized, stripped of git+ prefix and .git suffix). */
27
30
  repository: optionalUrl
28
31
  });
29
32
  /**
30
- * Parse a metadata file content string into a structured object.
31
- * The `format` parameter determines whether to parse as JSON or YAML.
32
- * Returns undefined if the content is malformed or not an object.
33
+ * Parse a metadata file content string into a structured object. The `format`
34
+ * parameter determines whether to parse as JSON or YAML. Returns undefined if
35
+ * the content is malformed or not an object.
33
36
  */
34
37
  function parse$1(content, format) {
35
38
  let data;
@@ -53,7 +56,7 @@ function parse$1(content, format) {
53
56
  }
54
57
  /** Return a trimmed string if the value is a non-empty string, else undefined. */
55
58
  function nonEmpty(value) {
56
- if (typeof value !== "string") return void 0;
59
+ if (typeof value !== "string") return;
57
60
  const trimmed = value.trim();
58
61
  return trimmed.length > 0 ? trimmed : void 0;
59
62
  }
@@ -64,7 +64,7 @@ const npmDownloadsSchema = z.object({ downloads: z.number() });
64
64
  async function fetchDownloads(packageName, period) {
65
65
  try {
66
66
  const response = await fetchWithRetry(`https://api.npmjs.org/downloads/point/${period}/${encodeURIComponent(packageName)}`);
67
- if (!response.ok) return void 0;
67
+ if (!response.ok) return;
68
68
  return npmDownloadsSchema.parse(await response.json()).downloads;
69
69
  } catch {
70
70
  return;
@@ -3,13 +3,13 @@ import { z } from "zod";
3
3
 
4
4
  //#region src/lib/sources/openframeworks-addon-config-mk.d.ts
5
5
  declare const openframeworksAddonConfigSchema: z.ZodObject<{
6
- author: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
7
- dependencies: z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>;
8
- description: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
9
- name: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
10
- platformSections: z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>;
11
- tags: z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>;
12
- url: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
6
+ author: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
7
+ dependencies: z.ZodDefault<z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>>;
8
+ description: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
9
+ name: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
10
+ platformSections: z.ZodDefault<z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>>;
11
+ tags: z.ZodDefault<z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>>;
12
+ url: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
13
13
  }, z.core.$strip>;
14
14
  type OpenframeworksAddonConfig = z.infer<typeof openframeworksAddonConfigSchema>;
15
15
  type OpenframeworksAddonConfigMkData = OneOrMany<SourceRecord<OpenframeworksAddonConfig>> | undefined;
@@ -7,12 +7,19 @@ import { resolve } from "node:path";
7
7
  import { z } from "zod";
8
8
  //#region src/lib/sources/openframeworks-addon-config-mk.ts
9
9
  const openframeworksAddonConfigSchema = z.object({
10
+ /** `ADDON_AUTHOR` from `meta:` section. */
10
11
  author: nonEmptyString,
12
+ /** `ADDON_DEPENDENCIES` from `common:` section (space-separated addon names). */
11
13
  dependencies: stringArray,
14
+ /** `ADDON_DESCRIPTION` from `meta:` section. */
12
15
  description: nonEmptyString,
16
+ /** `ADDON_NAME` from `meta:` section. */
13
17
  name: nonEmptyString,
18
+ /** Platform section names that contain at least one variable assignment. */
14
19
  platformSections: stringArray,
20
+ /** `ADDON_TAGS` from `meta:` section (quote-aware tokenized). */
15
21
  tags: stringArray,
22
+ /** `ADDON_URL` from `meta:` section. */
16
23
  url: optionalUrl
17
24
  });
18
25
  /**
@@ -3,16 +3,16 @@ import { z } from "zod";
3
3
 
4
4
  //#region src/lib/sources/openframeworks-install-xml.d.ts
5
5
  declare const openframeworksInstallXmlSchema: z.ZodObject<{
6
- author: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
7
- codeUrl: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
8
- description: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
9
- downloadUrl: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
10
- name: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
11
- operatingSystems: z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>;
12
- requirements: z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>;
13
- siteUrl: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
14
- url: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
15
- version: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
6
+ author: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
7
+ codeUrl: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
8
+ description: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
9
+ downloadUrl: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
10
+ name: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
11
+ operatingSystems: z.ZodDefault<z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>>;
12
+ requirements: z.ZodDefault<z.ZodPipe<z.ZodTransform<string[], unknown>, z.ZodArray<z.ZodString>>>;
13
+ siteUrl: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
14
+ url: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
15
+ version: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
16
16
  }, z.core.$strip>;
17
17
  type OpenframeworksInstallXml = z.infer<typeof openframeworksInstallXmlSchema>;
18
18
  type OpenframeworksInstallXmlData = OneOrMany<SourceRecord<OpenframeworksInstallXml>> | undefined;
@@ -19,19 +19,29 @@ import { XMLParser } from "fast-xml-parser";
19
19
  * content is actually an openFrameworks addon by checking for the `<install>`
20
20
  * root element and the presence of "addons" in the file content.
21
21
  *
22
- * Uses `fast-xml-parser` with attribute parsing enabled to read `<lib os="...">`
23
- * attributes for operating system inference.
22
+ * Uses `fast-xml-parser` with attribute parsing enabled to read `<lib
23
+ * os="...">` attributes for operating system inference.
24
24
  */
25
25
  const openframeworksInstallXmlSchema = z.object({
26
+ /** Addon author name. */
26
27
  author: nonEmptyString,
28
+ /** Source code repository URL. */
27
29
  codeUrl: optionalUrl,
30
+ /** Description of the addon. */
28
31
  description: nonEmptyString,
32
+ /** Download URL. */
29
33
  downloadUrl: optionalUrl,
34
+ /** Addon display name. */
30
35
  name: nonEmptyString,
36
+ /** Supported operating systems from `<lib os="...">` attributes. */
31
37
  operatingSystems: stringArray,
38
+ /** Software dependencies from `<requires>` elements. */
32
39
  requirements: stringArray,
40
+ /** Website URL. */
33
41
  siteUrl: optionalUrl,
42
+ /** Generic URL (used when no code_url / site_url provided). */
34
43
  url: optionalUrl,
44
+ /** Version string. */
35
45
  version: nonEmptyString
36
46
  });
37
47
  /**
@@ -43,9 +53,9 @@ const LIB_OS_MAP = {
43
53
  win32: "Windows"
44
54
  };
45
55
  /**
46
- * Parse a legacy openFrameworks `install.xml` content string into a structured object.
47
- * Returns undefined if the XML is malformed, missing the `<install>` root element,
48
- * or does not appear to be an openFrameworks addon.
56
+ * Parse a legacy openFrameworks `install.xml` content string into a structured
57
+ * object. Returns undefined if the XML is malformed, missing the `<install>`
58
+ * root element, or does not appear to be an openFrameworks addon.
49
59
  */
50
60
  function parse(content) {
51
61
  if (!content.toLowerCase().includes("addons")) return;
@@ -58,12 +68,12 @@ function parse(content) {
58
68
  let data;
59
69
  try {
60
70
  const parsed = parser.parse(fixedContent);
61
- if (!is.plainObject(parsed)) return void 0;
71
+ if (!is.plainObject(parsed)) return;
62
72
  data = parsed;
63
73
  } catch {
64
74
  return;
65
75
  }
66
- if (!is.plainObject(data.install)) return void 0;
76
+ if (!is.plainObject(data.install)) return;
67
77
  const { install } = data;
68
78
  return openframeworksInstallXmlSchema.parse({
69
79
  author: getString(install.author),
@@ -79,17 +89,17 @@ function parse(content) {
79
89
  });
80
90
  }
81
91
  /**
82
- * Get a trimmed non-empty string from a parsed XML value.
83
- * Returns undefined for empty strings, non-strings, or whitespace-only values.
92
+ * Get a trimmed non-empty string from a parsed XML value. Returns undefined for
93
+ * empty strings, non-strings, or whitespace-only values.
84
94
  */
85
95
  function getString(value) {
86
- if (typeof value !== "string") return void 0;
96
+ if (typeof value !== "string") return;
87
97
  const trimmed = value.trim();
88
98
  return trimmed.length > 0 ? trimmed : void 0;
89
99
  }
90
100
  /**
91
- * Extract software requirements from `<requires>`.
92
- * Handles three variants:
101
+ * Extract software requirements from `<requires>`. Handles three variants:
102
+ *
93
103
  * 1. Empty — skip
94
104
  * 2. Free text — emit as-is
95
105
  * 3. Structured `<addon>` children — emit each separately
@@ -112,8 +122,8 @@ function parseRequirements(install) {
112
122
  return [];
113
123
  }
114
124
  /**
115
- * Extract operating system information from `<lib os="...">` attributes
116
- * found within `<add><link>` sections.
125
+ * Extract operating system information from `<lib os="...">` attributes found
126
+ * within `<add><link>` sections.
117
127
  */
118
128
  function parseOperatingSystems(install) {
119
129
  if (!is.plainObject(install.add)) return [];
@@ -25,17 +25,17 @@ declare const processingLibraryPropertiesSchema: z.ZodObject<{
25
25
  Typography: "Typography";
26
26
  "Video & Vision": "Video & Vision";
27
27
  }>>;
28
- download: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
29
- id: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
28
+ download: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
29
+ id: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
30
30
  maxRevision: z.ZodNumber;
31
31
  minRevision: z.ZodNumber;
32
- name: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
33
- paragraph: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
34
- prettyVersion: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
32
+ name: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
33
+ paragraph: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
34
+ prettyVersion: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
35
35
  raw: z.ZodRecord<z.ZodString, z.ZodString>;
36
- sentence: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
37
- type: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
38
- url: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
36
+ sentence: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
37
+ type: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
38
+ url: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
39
39
  version: z.ZodNumber;
40
40
  }, z.core.$strip>;
41
41
  type ProcessingLibraryProperties = z.infer<typeof processingLibraryPropertiesSchema>;
@@ -35,23 +35,38 @@ const CANONICAL_CATEGORIES = [
35
35
  const CATEGORY_MAP = new Map(CANONICAL_CATEGORIES.map((cat) => [cat.replaceAll(/[^a-z]/gi, "").toLowerCase(), cat]));
36
36
  CATEGORY_MAP.set("3d", "3D");
37
37
  const processingLibraryPropertiesSchema = z.object({
38
+ /** Parsed author entries with optional URLs. */
38
39
  authors: z.array(processingLibraryPropertiesAuthorEntrySchema),
40
+ /** Normalized categories. */
39
41
  categories: z.array(z.enum(CANONICAL_CATEGORIES)),
42
+ /** Direct download URL for the .zip distribution. */
40
43
  download: optionalUrl,
44
+ /** Numeric identifier assigned by Processing contribution manager. */
41
45
  id: nonEmptyString,
46
+ /** Maximum Processing revision, or 0 for no upper constraint. */
42
47
  maxRevision: z.number(),
48
+ /** Minimum Processing revision, or 0 for no lower constraint. */
43
49
  minRevision: z.number(),
50
+ /** Library name. */
44
51
  name: nonEmptyString,
52
+ /** Extended description paragraph. */
45
53
  paragraph: nonEmptyString,
54
+ /** Human-readable version string. */
46
55
  prettyVersion: nonEmptyString,
56
+ /** Raw key-value pairs. */
47
57
  raw: z.record(z.string(), z.string()),
58
+ /** One-sentence description. */
48
59
  sentence: nonEmptyString,
60
+ /** Contribution type (library, tool, mode, examples). */
49
61
  type: nonEmptyString,
62
+ /** Project URL. */
50
63
  url: optionalUrl,
64
+ /** Integer release counter. */
51
65
  version: z.number()
52
66
  });
53
67
  /**
54
- * Parse a Processing `library.properties` content string into a structured object.
68
+ * Parse a Processing `library.properties` content string into a structured
69
+ * object.
55
70
  */
56
71
  function parse(content) {
57
72
  const raw = parseProperties(content);
@@ -86,28 +101,28 @@ function get(raw, key) {
86
101
  }
87
102
  /** Return a trimmed string, or undefined if empty/whitespace-only. */
88
103
  function nonEmpty(value) {
89
- if (value === void 0) return void 0;
104
+ if (value === void 0) return;
90
105
  const trimmed = value.trim();
91
106
  return trimmed.length > 0 ? trimmed : void 0;
92
107
  }
93
108
  /**
94
- * Strip trailing inline comments from a value.
95
- * Matches the pattern ` # comment text` (space-hash-space).
109
+ * Strip trailing inline comments from a value. Matches the pattern ` # comment
110
+ * text` (space-hash-space).
96
111
  */
97
112
  function stripInlineComment(value) {
98
113
  const index = value.indexOf(" # ");
99
114
  return index === -1 ? value : value.slice(0, index).trim();
100
115
  }
101
116
  /**
102
- * Unescape backslash-escaped colons in URLs.
103
- * Some Processing fixtures use `https\://` instead of `https://`.
117
+ * Unescape backslash-escaped colons in URLs. Some Processing fixtures use
118
+ * `https\://` instead of `https://`.
104
119
  */
105
120
  function unescapeUrl(value) {
106
121
  return value.replaceAll(String.raw`\:`, ":");
107
122
  }
108
123
  /**
109
- * Parse a Processing authors/authorList value into AuthorEntry[].
110
- * Preserves original order of appearance.
124
+ * Parse a Processing authors/authorList value into AuthorEntry[]. Preserves
125
+ * original order of appearance.
111
126
  */
112
127
  function parseAuthors(value) {
113
128
  const trimmed = value.trim();
@@ -149,8 +164,8 @@ function parseAuthors(value) {
149
164
  return results;
150
165
  }
151
166
  /**
152
- * Split plain text on ` and `, `,`, `&` to extract author names.
153
- * Filters out bare "others" entries.
167
+ * Split plain text on `and`, `,`, `&` to extract author names. Filters out bare
168
+ * "others" entries.
154
169
  */
155
170
  function addPlainAuthors(text, results) {
156
171
  const parts = text.split(AUTHOR_SEPARATOR_REGEX).map((s) => s.trim()).filter((s) => s.length > 0 && s.toLowerCase() !== "others");
@@ -7,30 +7,30 @@ declare const processingSketchPropertiesSchema: z.ZodObject<{
7
7
  name: z.ZodString;
8
8
  url: z.ZodOptional<z.ZodString>;
9
9
  }, z.core.$strip>>;
10
- component: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
11
- download: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
12
- main: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
13
- manifestLabel: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
14
- manifestOrientation: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
15
- manifestPackage: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
10
+ component: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
11
+ download: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
12
+ main: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
13
+ manifestLabel: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
14
+ manifestOrientation: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
15
+ manifestPackage: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
16
16
  manifestPermissions: z.ZodArray<z.ZodString>;
17
17
  manifestSdkMin: z.ZodOptional<z.ZodNumber>;
18
18
  manifestSdkTarget: z.ZodOptional<z.ZodNumber>;
19
19
  manifestVersionCode: z.ZodOptional<z.ZodNumber>;
20
- manifestVersionName: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
20
+ manifestVersionName: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
21
21
  maxRevision: z.ZodNumber;
22
22
  minRevision: z.ZodNumber;
23
- mode: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
24
- modeId: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
25
- name: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
26
- paragraph: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
27
- prettyVersion: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
23
+ mode: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
24
+ modeId: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
25
+ name: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
26
+ paragraph: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
27
+ prettyVersion: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
28
28
  raw: z.ZodRecord<z.ZodString, z.ZodString>;
29
- sentence: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
30
- templates: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
31
- url: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
29
+ sentence: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
30
+ templates: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
31
+ url: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
32
32
  version: z.ZodNumber;
33
- zipfilename: z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>;
33
+ zipfilename: z.ZodOptional<z.ZodPipe<z.ZodTransform<string | undefined, unknown>, z.ZodOptional<z.ZodString>>>;
34
34
  }, z.core.$strip>;
35
35
  type ProcessingSketchProperties = z.infer<typeof processingSketchPropertiesSchema>;
36
36
  type ProcessingSketchPropertiesData = OneOrMany<SourceRecord<ProcessingSketchProperties>> | undefined;