@shard-for-obsidian/lib 0.3.2 → 0.3.3
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/marketplace/oci-to-markdown.d.ts.map +1 -1
- package/dist/marketplace/oci-to-markdown.js +8 -8
- package/dist/oci/tags.d.ts +1 -0
- package/dist/oci/tags.d.ts.map +1 -1
- package/dist/oci/tags.js +3 -0
- package/dist/schemas/annotations.d.ts +5 -1
- package/dist/schemas/annotations.d.ts.map +1 -1
- package/dist/schemas/annotations.js +4 -2
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +1 -1
- package/dist/schemas/transforms.d.ts +3 -10
- package/dist/schemas/transforms.d.ts.map +1 -1
- package/dist/schemas/transforms.js +11 -23
- package/package.json +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oci-to-markdown.d.ts","sourceRoot":"","sources":["../../src/marketplace/oci-to-markdown.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oci-to-markdown.d.ts","sourceRoot":"","sources":["../../src/marketplace/oci-to-markdown.ts"],"names":[],"mappings":"AAqBA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACnC,WAAW,EAAE,MAAM,GAClB,iBAAiB,CA2BnB"}
|
|
@@ -6,18 +6,15 @@ const OciAnnotationsSchema = z
|
|
|
6
6
|
.object({
|
|
7
7
|
'org.opencontainers.image.title': z.string().optional(),
|
|
8
8
|
'org.opencontainers.image.description': z.string().optional(),
|
|
9
|
-
'org.opencontainers.image.version': z.string().optional(),
|
|
10
9
|
'org.opencontainers.image.created': z.string().optional(),
|
|
11
|
-
'org.opencontainers.image.authors': z.string().optional(),
|
|
12
|
-
'org.opencontainers.image.url': z.string().optional(),
|
|
13
10
|
'org.opencontainers.image.source': z.string().optional(),
|
|
14
11
|
'org.opencontainers.image.licenses': z.string().optional(),
|
|
15
12
|
'vnd.obsidianmd.plugin.id': z.string(),
|
|
16
13
|
'vnd.obsidianmd.plugin.name': z.string(),
|
|
17
14
|
'vnd.obsidianmd.plugin.author': z.string(),
|
|
18
15
|
'vnd.obsidianmd.plugin.description': z.string(),
|
|
19
|
-
'vnd.obsidianmd.plugin.
|
|
20
|
-
'vnd.obsidianmd.plugin.
|
|
16
|
+
'vnd.obsidianmd.plugin.source': z.string().optional(),
|
|
17
|
+
'vnd.obsidianmd.plugin.min-app-version': z.string().optional(),
|
|
21
18
|
})
|
|
22
19
|
.passthrough();
|
|
23
20
|
/**
|
|
@@ -35,14 +32,17 @@ export function ociAnnotationsToFrontmatter(annotations, registryUrl) {
|
|
|
35
32
|
registryUrl,
|
|
36
33
|
};
|
|
37
34
|
// Add optional fields
|
|
38
|
-
if (validated['
|
|
35
|
+
if (validated['vnd.obsidianmd.plugin.source']) {
|
|
36
|
+
frontmatter.repository = validated['vnd.obsidianmd.plugin.source'];
|
|
37
|
+
}
|
|
38
|
+
else if (validated['org.opencontainers.image.source']) {
|
|
39
39
|
frontmatter.repository = validated['org.opencontainers.image.source'];
|
|
40
40
|
}
|
|
41
41
|
if (validated['org.opencontainers.image.licenses']) {
|
|
42
42
|
frontmatter.license = validated['org.opencontainers.image.licenses'];
|
|
43
43
|
}
|
|
44
|
-
if (validated['vnd.obsidianmd.plugin.
|
|
45
|
-
frontmatter.minObsidianVersion = validated['vnd.obsidianmd.plugin.
|
|
44
|
+
if (validated['vnd.obsidianmd.plugin.min-app-version']) {
|
|
45
|
+
frontmatter.minObsidianVersion = validated['vnd.obsidianmd.plugin.min-app-version'];
|
|
46
46
|
}
|
|
47
47
|
return frontmatter;
|
|
48
48
|
}
|
package/dist/oci/tags.d.ts
CHANGED
package/dist/oci/tags.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../../src/oci/tags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAG9D,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,YAAY,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,YAAY,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAQD,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAyED;;GAEG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,mBAAmB,GACxB,OAAO,CAAC,MAAM,EAAE,CAAC,CAsCnB;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,uBAAuB,GAC5B,OAAO,CAAC,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../../src/oci/tags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAG9D,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,YAAY,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,YAAY,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAQD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAyED;;GAEG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,mBAAmB,GACxB,OAAO,CAAC,MAAM,EAAE,CAAC,CAsCnB;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,uBAAuB,GAC5B,OAAO,CAAC,WAAW,CAAC,CAyDtB"}
|
package/dist/oci/tags.js
CHANGED
|
@@ -121,12 +121,15 @@ export async function queryTagMetadata(opts) {
|
|
|
121
121
|
throw new Error(`Failed to query tag metadata: ${response.status} ${response.statusText}`);
|
|
122
122
|
}
|
|
123
123
|
const manifest = (await response.json());
|
|
124
|
+
// Extract digest from Docker-Content-Digest header
|
|
125
|
+
const digest = response.headers.get("docker-content-digest") || "";
|
|
124
126
|
// Extract metadata
|
|
125
127
|
const publishedAt = manifest.created || new Date().toISOString();
|
|
126
128
|
const layerSizes = manifest.layers?.map((l) => l.size) || [];
|
|
127
129
|
const size = layerSizes.reduce((sum, s) => sum + s, 0);
|
|
128
130
|
const annotations = manifest.annotations || {};
|
|
129
131
|
return {
|
|
132
|
+
digest,
|
|
130
133
|
publishedAt,
|
|
131
134
|
size,
|
|
132
135
|
annotations,
|
|
@@ -14,7 +14,7 @@ export declare const PluginAnnotationsSchema: z.ZodObject<{
|
|
|
14
14
|
"vnd.obsidianmd.plugin.description": z.ZodString;
|
|
15
15
|
/** Plugin author */
|
|
16
16
|
"vnd.obsidianmd.plugin.author": z.ZodString;
|
|
17
|
-
/**
|
|
17
|
+
/** Source URL (e.g., https://github.com/owner/repo) */
|
|
18
18
|
"vnd.obsidianmd.plugin.source": z.ZodString;
|
|
19
19
|
/** Publication timestamp (ISO 8601) */
|
|
20
20
|
"vnd.obsidianmd.plugin.published-at": z.ZodString;
|
|
@@ -34,6 +34,8 @@ export declare const PluginAnnotationsSchema: z.ZodObject<{
|
|
|
34
34
|
"org.opencontainers.image.source": z.ZodString;
|
|
35
35
|
/** OCI standard: Plugin title */
|
|
36
36
|
"org.opencontainers.image.title": z.ZodString;
|
|
37
|
+
/** OCI standard: Plugin description */
|
|
38
|
+
"org.opencontainers.image.description": z.ZodOptional<z.ZodString>;
|
|
37
39
|
/** OCI standard: Creation timestamp (RFC 3339) */
|
|
38
40
|
"org.opencontainers.image.created": z.ZodString;
|
|
39
41
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -53,6 +55,7 @@ export declare const PluginAnnotationsSchema: z.ZodObject<{
|
|
|
53
55
|
"vnd.obsidianmd.plugin.funding-url"?: string | undefined;
|
|
54
56
|
"vnd.obsidianmd.plugin.converted"?: string | undefined;
|
|
55
57
|
"vnd.obsidianmd.plugin.author-url"?: string | undefined;
|
|
58
|
+
"org.opencontainers.image.description"?: string | undefined;
|
|
56
59
|
}, {
|
|
57
60
|
"org.opencontainers.image.title": string;
|
|
58
61
|
"vnd.obsidianmd.plugin.id": string;
|
|
@@ -70,6 +73,7 @@ export declare const PluginAnnotationsSchema: z.ZodObject<{
|
|
|
70
73
|
"vnd.obsidianmd.plugin.funding-url"?: string | undefined;
|
|
71
74
|
"vnd.obsidianmd.plugin.converted"?: string | undefined;
|
|
72
75
|
"vnd.obsidianmd.plugin.author-url"?: string | undefined;
|
|
76
|
+
"org.opencontainers.image.description"?: string | undefined;
|
|
73
77
|
}>;
|
|
74
78
|
/**
|
|
75
79
|
* Inferred TypeScript type from schema
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../src/schemas/annotations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,uBAAuB;IAClC,gBAAgB;;IAEhB,mBAAmB;;IAEnB,qBAAqB;;IAErB,yBAAyB;;IAEzB,oBAAoB;;IAEpB,
|
|
1
|
+
{"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../src/schemas/annotations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,uBAAuB;IAClC,gBAAgB;;IAEhB,mBAAmB;;IAEnB,qBAAqB;;IAErB,yBAAyB;;IAEzB,oBAAoB;;IAEpB,uDAAuD;;IAEvD,uCAAuC;;IAEvC,iEAAiE;;IAEjE,gEAAgE;;IAEhE,oEAAoE;;IAEpE,wDAAwD;;IAExD,iBAAiB;;IAEjB,mDAAmD;;IAEnD,sCAAsC;;IAEtC,iCAAiC;;IAEjC,uCAAuC;;IAEvC,kDAAkD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAElD,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
|
|
@@ -14,8 +14,8 @@ export const PluginAnnotationsSchema = z.object({
|
|
|
14
14
|
"vnd.obsidianmd.plugin.description": z.string(),
|
|
15
15
|
/** Plugin author */
|
|
16
16
|
"vnd.obsidianmd.plugin.author": z.string(),
|
|
17
|
-
/**
|
|
18
|
-
"vnd.obsidianmd.plugin.source": z.string().
|
|
17
|
+
/** Source URL (e.g., https://github.com/owner/repo) */
|
|
18
|
+
"vnd.obsidianmd.plugin.source": z.string().url(),
|
|
19
19
|
/** Publication timestamp (ISO 8601) */
|
|
20
20
|
"vnd.obsidianmd.plugin.published-at": z.string().datetime(),
|
|
21
21
|
/** Plugin introduction from community-plugins.json (required) */
|
|
@@ -34,6 +34,8 @@ export const PluginAnnotationsSchema = z.object({
|
|
|
34
34
|
"org.opencontainers.image.source": z.string().url(),
|
|
35
35
|
/** OCI standard: Plugin title */
|
|
36
36
|
"org.opencontainers.image.title": z.string(),
|
|
37
|
+
/** OCI standard: Plugin description */
|
|
38
|
+
"org.opencontainers.image.description": z.string().optional(),
|
|
37
39
|
/** OCI standard: Creation timestamp (RFC 3339) */
|
|
38
40
|
"org.opencontainers.image.created": z.string().datetime(),
|
|
39
41
|
});
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ObsidianManifestSchema, type ObsidianManifest } from "./manifest.js";
|
|
2
2
|
export { PluginAnnotationsSchema, type PluginAnnotations, } from "./annotations.js";
|
|
3
3
|
export { PluginVersionSchema, MarketplacePluginSchema, MarketplaceIndexSchema, CachedMarketplaceDataSchema, type PluginVersion, type MarketplacePlugin, type MarketplaceIndex, type CachedMarketplaceData, } from "./marketplace.js";
|
|
4
|
-
export {
|
|
4
|
+
export { repoToGitHubUrl, ghcrUrlToGitHubRepo, manifestToAnnotations, manifestToAnnotationsLegacy, annotationsToMarketplacePlugin, type CommunityPluginMetadata, } from "./transforms.js";
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EACL,uBAAuB,EACvB,KAAK,iBAAiB,GACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,2BAA2B,EAC3B,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,GAC3B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE9E,OAAO,EACL,uBAAuB,EACvB,KAAK,iBAAiB,GACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,2BAA2B,EAC3B,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,GAC3B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,2BAA2B,EAC3B,8BAA8B,EAC9B,KAAK,uBAAuB,GAC7B,MAAM,iBAAiB,CAAC"}
|
package/dist/schemas/index.js
CHANGED
|
@@ -3,4 +3,4 @@ export { ObsidianManifestSchema } from "./manifest.js";
|
|
|
3
3
|
export { PluginAnnotationsSchema, } from "./annotations.js";
|
|
4
4
|
export { PluginVersionSchema, MarketplacePluginSchema, MarketplaceIndexSchema, CachedMarketplaceDataSchema, } from "./marketplace.js";
|
|
5
5
|
// Transform utilities
|
|
6
|
-
export {
|
|
6
|
+
export { repoToGitHubUrl, ghcrUrlToGitHubRepo, manifestToAnnotations, manifestToAnnotationsLegacy, annotationsToMarketplacePlugin, } from "./transforms.js";
|
|
@@ -2,19 +2,12 @@ import type { ObsidianManifest } from "./manifest.js";
|
|
|
2
2
|
import type { PluginAnnotations } from "./annotations.js";
|
|
3
3
|
import type { MarketplacePlugin } from "./marketplace.js";
|
|
4
4
|
/**
|
|
5
|
-
* Convert GitHub repo format to
|
|
5
|
+
* Convert GitHub repo format to GitHub URL
|
|
6
6
|
* @param repo - Repository in "owner/repo" format
|
|
7
|
-
* @returns VCS URL in "git+https://github.com/owner/repo.git" format
|
|
8
|
-
* @throws Error if repo format is invalid
|
|
9
|
-
*/
|
|
10
|
-
export declare function repoToVcsUrl(repo: string): string;
|
|
11
|
-
/**
|
|
12
|
-
* Extract GitHub URL from VCS URL
|
|
13
|
-
* @param vcsUrl - VCS URL in "git+https://..." format
|
|
14
7
|
* @returns GitHub URL in "https://github.com/owner/repo" format
|
|
15
|
-
* @throws Error if
|
|
8
|
+
* @throws Error if repo format is invalid
|
|
16
9
|
*/
|
|
17
|
-
export declare function
|
|
10
|
+
export declare function repoToGitHubUrl(repo: string): string;
|
|
18
11
|
/**
|
|
19
12
|
* Extract GitHub repository URL from GHCR registry URL
|
|
20
13
|
* @param registryUrl - GHCR URL (e.g., "ghcr.io/owner/repo/path")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transforms.d.ts","sourceRoot":"","sources":["../../src/schemas/transforms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D;;;;;GAKG;AACH,wBAAgB,
|
|
1
|
+
{"version":3,"file":"transforms.d.ts","sourceRoot":"","sources":["../../src/schemas/transforms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKpD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAc/D;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,gBAAgB,EAC1B,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,iBAAiB,CAAC,CA+B5B;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,gBAAgB,EAC1B,eAAe,EAAE,uBAAuB,EACxC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,iBAAiB,CAiCnB;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC5C,WAAW,EAAE,iBAAiB,EAC9B,WAAW,EAAE,MAAM,GAClB,iBAAiB,CAyBnB"}
|
|
@@ -1,28 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Convert GitHub repo format to
|
|
2
|
+
* Convert GitHub repo format to GitHub URL
|
|
3
3
|
* @param repo - Repository in "owner/repo" format
|
|
4
|
-
* @returns
|
|
4
|
+
* @returns GitHub URL in "https://github.com/owner/repo" format
|
|
5
5
|
* @throws Error if repo format is invalid
|
|
6
6
|
*/
|
|
7
|
-
export function
|
|
7
|
+
export function repoToGitHubUrl(repo) {
|
|
8
8
|
if (!repo.includes("/")) {
|
|
9
9
|
throw new Error(`Invalid repo format: ${repo}. Expected "owner/repo"`);
|
|
10
10
|
}
|
|
11
|
-
return `
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Extract GitHub URL from VCS URL
|
|
15
|
-
* @param vcsUrl - VCS URL in "git+https://..." format
|
|
16
|
-
* @returns GitHub URL in "https://github.com/owner/repo" format
|
|
17
|
-
* @throws Error if VCS URL format is invalid
|
|
18
|
-
*/
|
|
19
|
-
export function vcsUrlToGitHubUrl(vcsUrl) {
|
|
20
|
-
if (!vcsUrl.startsWith("git+")) {
|
|
21
|
-
throw new Error(`Invalid VCS URL format: ${vcsUrl}. Expected "git+https://..."`);
|
|
22
|
-
}
|
|
23
|
-
// Remove "git+" prefix and optional ".git" suffix
|
|
24
|
-
const url = vcsUrl.slice(4).replace(/\.git$/, "");
|
|
25
|
-
return url;
|
|
11
|
+
return `https://github.com/${repo}`;
|
|
26
12
|
}
|
|
27
13
|
/**
|
|
28
14
|
* Extract GitHub repository URL from GHCR registry URL
|
|
@@ -55,8 +41,9 @@ export function manifestToAnnotationsLegacy(manifest, ownerRepo, registryUrl) {
|
|
|
55
41
|
"vnd.obsidianmd.plugin.name": manifest.name,
|
|
56
42
|
"vnd.obsidianmd.plugin.version": manifest.version,
|
|
57
43
|
"vnd.obsidianmd.plugin.description": manifest.description,
|
|
44
|
+
"org.opencontainers.image.description": manifest.description,
|
|
58
45
|
"vnd.obsidianmd.plugin.author": manifest.author,
|
|
59
|
-
"vnd.obsidianmd.plugin.source":
|
|
46
|
+
"vnd.obsidianmd.plugin.source": repoToGitHubUrl(ownerRepo),
|
|
60
47
|
"vnd.obsidianmd.plugin.is-desktop-only": String(manifest.isDesktopOnly ?? false),
|
|
61
48
|
"vnd.obsidianmd.plugin.min-app-version": manifest.minAppVersion,
|
|
62
49
|
"org.opencontainers.image.source": ghcrUrlToGitHubRepo(registryUrl),
|
|
@@ -92,10 +79,11 @@ export function manifestToAnnotations(manifest, communityPlugin, registryUrl, pu
|
|
|
92
79
|
"vnd.obsidianmd.plugin.name": manifest.name,
|
|
93
80
|
"vnd.obsidianmd.plugin.version": manifest.version,
|
|
94
81
|
"vnd.obsidianmd.plugin.description": manifest.description,
|
|
82
|
+
"org.opencontainers.image.description": manifest.description,
|
|
95
83
|
"vnd.obsidianmd.plugin.author": manifest.author,
|
|
96
|
-
"vnd.obsidianmd.plugin.source":
|
|
84
|
+
"vnd.obsidianmd.plugin.source": repoToGitHubUrl(communityPlugin.repo),
|
|
97
85
|
"vnd.obsidianmd.plugin.published-at": publishedAt,
|
|
98
|
-
"vnd.obsidianmd.plugin.introduction": communityPlugin.
|
|
86
|
+
"vnd.obsidianmd.plugin.introduction": communityPlugin.description,
|
|
99
87
|
"vnd.obsidianmd.plugin.is-desktop-only": String(manifest.isDesktopOnly ?? false),
|
|
100
88
|
"vnd.obsidianmd.plugin.min-app-version": manifest.minAppVersion,
|
|
101
89
|
"org.opencontainers.image.source": ghcrUrlToGitHubRepo(registryUrl),
|
|
@@ -139,10 +127,10 @@ export function annotationsToMarketplacePlugin(annotations, registryUrl) {
|
|
|
139
127
|
plugin.minObsidianVersion =
|
|
140
128
|
annotations["vnd.obsidianmd.plugin.min-app-version"];
|
|
141
129
|
}
|
|
142
|
-
//
|
|
130
|
+
// Source is already a GitHub URL
|
|
143
131
|
const source = annotations["vnd.obsidianmd.plugin.source"];
|
|
144
132
|
if (source) {
|
|
145
|
-
plugin.repository =
|
|
133
|
+
plugin.repository = source;
|
|
146
134
|
}
|
|
147
135
|
return plugin;
|
|
148
136
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shard-for-obsidian/lib",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Core library for Shard plugin management",
|
|
6
6
|
"author": "Andrew Gillis",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"zod": "^3.24.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
42
43
|
"@vitest/ui": "^4.0.18",
|
|
43
44
|
"vitest": "^4.0.18"
|
|
44
45
|
},
|
|
@@ -48,6 +49,7 @@
|
|
|
48
49
|
"ts-check": "tsc --noEmit",
|
|
49
50
|
"lint": "eslint .",
|
|
50
51
|
"test": "vitest run",
|
|
52
|
+
"test:coverage": "vitest run --coverage",
|
|
51
53
|
"test:watch": "vitest",
|
|
52
54
|
"test:ui": "vitest --ui"
|
|
53
55
|
}
|