metascope 0.7.5 → 0.8.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.
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
2
  var name = "metascope";
3
- var version = "0.7.5";
3
+ var version = "0.8.0";
4
4
  //#endregion
5
5
  export { name, version };
@@ -3,13 +3,21 @@ import { LicenseMatch } from "../utilities/license-identification.js";
3
3
 
4
4
  //#region src/lib/sources/license-file.d.ts
5
5
  /**
6
- * A license file record. `match` is `undefined` when a license file was
7
- * discovered on disk but its contents do not map to an SPDX template (e.g.
8
- * proprietary "All Rights Reserved" notices). The `source` path on the
9
- * surrounding record is still useful to downstream consumers preserve it.
6
+ * A license file record. The `type` discriminator is always present so the
7
+ * framework's deep-strip never collapses the record to a half-shape:
8
+ *
9
+ * - `type: 'spdx'` with a populated `match`the file contents map to a known
10
+ * SPDX template.
11
+ * - `type: 'unknown'` with no `match` — a license file was located on disk but
12
+ * its contents do not match any SPDX template (e.g. proprietary "All Rights
13
+ * Reserved" notices). The `source` path is still retained on the surrounding
14
+ * record. Downstream consumers that need to detect a proprietary project can
15
+ * either check `data.type === 'unknown'` or fall back to the package manifest
16
+ * sentinel (`license: "UNLICENSED"` in package.json).
10
17
  */
11
18
  type LicenseFileRecord = {
12
19
  match?: LicenseMatch;
20
+ type: 'spdx' | 'unknown';
13
21
  };
14
22
  type LicenseFileData = OneOrMany<SourceRecord<LicenseFileRecord>> | undefined;
15
23
  //#endregion
@@ -10,8 +10,12 @@ const licenseFileSource = defineSource({
10
10
  },
11
11
  key: "licenseFile",
12
12
  async parse(input, context) {
13
+ const match = identifyLicense(await readFile(resolve(context.options.path, input), "utf8"));
13
14
  return {
14
- data: { match: identifyLicense(await readFile(resolve(context.options.path, input), "utf8")) },
15
+ data: match === void 0 ? { type: "unknown" } : {
16
+ match,
17
+ type: "spdx"
18
+ },
15
19
  source: input
16
20
  };
17
21
  },
@@ -5,7 +5,7 @@ import { readFile } from "node:fs/promises";
5
5
  import { resolve } from "node:path";
6
6
  import is from "@sindresorhus/is";
7
7
  import { z } from "zod";
8
- import plist from "plist";
8
+ import { parse } from "plist";
9
9
  //#region src/lib/sources/xcode-info-plist.ts
10
10
  /**
11
11
  * Source and parser for Apple `Info.plist` files.
@@ -71,7 +71,7 @@ const PLATFORM_NAME_MAP = {
71
71
  * Parse an `Info.plist` content string into a structured object. Returns
72
72
  * undefined if the plist is malformed or not a dictionary.
73
73
  */
74
- function parse(content) {
74
+ function parse$1(content) {
75
75
  const data = tryParsePlist(content) ?? tryParsePlist(content.replaceAll(XML_COMMENT_RE, "").trimStart());
76
76
  if (!data) return;
77
77
  const name = getString(data, "CFBundleDisplayName") ?? getString(data, "CFBundleName") ?? getString(data, "name");
@@ -105,7 +105,7 @@ function parse(content) {
105
105
  */
106
106
  function tryParsePlist(content) {
107
107
  try {
108
- const parsed = plist.parse(content);
108
+ const parsed = parse(content);
109
109
  return is.plainObject(parsed) ? parsed : void 0;
110
110
  } catch {
111
111
  return;
@@ -216,7 +216,7 @@ const xcodeInfoPlistSource = defineSource({
216
216
  },
217
217
  key: "xcodeInfoPlist",
218
218
  async parse(input, context) {
219
- const data = parse(await readFile(resolve(context.options.path, input), "utf8"));
219
+ const data = parse$1(await readFile(resolve(context.options.path, input), "utf8"));
220
220
  if (data !== void 0) return {
221
221
  data,
222
222
  source: input
@@ -18,7 +18,7 @@ declare const frontmatter: Template<{
18
18
  Public: boolean;
19
19
  Fork: boolean;
20
20
  Published: boolean;
21
- Status: "unknown" | "maintainer" | "author" | "observer";
21
+ Status: "author" | "maintainer" | "unknown" | "observer";
22
22
  Tags: string[] | null;
23
23
  Aliases: (string | null | undefined)[] | null;
24
24
  License: string[] | null;
@@ -157,7 +157,7 @@ declare const templates: {
157
157
  Public: boolean;
158
158
  Fork: boolean;
159
159
  Published: boolean;
160
- Status: "unknown" | "maintainer" | "author" | "observer";
160
+ Status: "author" | "maintainer" | "unknown" | "observer";
161
161
  Tags: string[] | null;
162
162
  Aliases: (string | null | undefined)[] | null;
163
163
  License: string[] | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metascope",
3
- "version": "0.7.5",
3
+ "version": "0.8.0",
4
4
  "description": "A CLI tool and TypeScript library to easily extract metadata from all kinds of software repositories.",
5
5
  "keywords": [
6
6
  "metadata",
@@ -47,7 +47,6 @@
47
47
  "@sindresorhus/is": "^8.1.0",
48
48
  "@types/mdast": "^4.0.4",
49
49
  "@types/node": "~22.17.2",
50
- "@types/plist": "^3.0.5",
51
50
  "@types/yargs": "^17.0.35",
52
51
  "case-police": "^2.2.1",
53
52
  "defu": "^6.1.7",
@@ -61,7 +60,7 @@
61
60
  "package-json": "^10.0.1",
62
61
  "picomatch": "^4.0.4",
63
62
  "pkg-types": "^2.3.1",
64
- "plist": "^3.1.1",
63
+ "plist": "^5.0.0",
65
64
  "pretty-ms": "^9.3.0",
66
65
  "read-pkg": "^10.1.0",
67
66
  "read-pyproject": "^0.3.3",
@@ -96,8 +95,8 @@
96
95
  "tree-sitter-python": "^0.25.0",
97
96
  "tree-sitter-ruby": "^0.23.1",
98
97
  "tsdown": "^0.22.0",
99
- "tsx": "^4.22.0",
100
- "typescript": "~6.0.3",
98
+ "tsx": "^4.22.1",
99
+ "typescript": "~5.9.3",
101
100
  "vitest": "^4.1.6"
102
101
  },
103
102
  "engines": {