myst-frontmatter
Advanced tools
Comparing version 1.1.4 to 1.1.5
@@ -67,7 +67,4 @@ import type { CreditRole } from 'credit-roles'; | ||
}; | ||
export declare enum BinderProviders { | ||
git = "git", | ||
github = "github", | ||
gitlab = "gitlab" | ||
} | ||
export type WellKnownRepoProviders = 'github' | 'gitlab' | 'git' | 'gist'; | ||
export type BinderProviders = WellKnownRepoProviders | string; | ||
export type BinderHubOptions = { | ||
@@ -74,0 +71,0 @@ url?: string; |
@@ -1,7 +0,1 @@ | ||
export var BinderProviders; | ||
(function (BinderProviders) { | ||
BinderProviders["git"] = "git"; | ||
BinderProviders["github"] = "github"; | ||
BinderProviders["gitlab"] = "gitlab"; | ||
})(BinderProviders || (BinderProviders = {})); | ||
export var ExportFormats; | ||
@@ -8,0 +2,0 @@ (function (ExportFormats) { |
@@ -6,3 +6,3 @@ import { doi } from 'doi-utils'; | ||
import { validateLicenses } from '../licenses/validators.js'; | ||
import { BinderProviders, ExportFormats } from './types.js'; | ||
import { ExportFormats } from './types.js'; | ||
export const SITE_FRONTMATTER_KEYS = [ | ||
@@ -566,2 +566,3 @@ 'title', | ||
export function validateBinderHubOptions(input, opts) { | ||
var _a; | ||
const value = validateObjectKeys(input, { optional: BINDER_HUB_OPTIONS_KEYS }, opts); | ||
@@ -574,17 +575,27 @@ if (value === undefined) | ||
} | ||
if (defined(value.ref)) { | ||
output.ref = validateString(value.ref, incrementOptions('ref', opts)); | ||
if (defined(value.provider)) { | ||
output.provider = validateString(value.provider, { | ||
...incrementOptions('provider', opts), | ||
regex: /.+/, | ||
}); | ||
} | ||
if (defined(value.repo)) { | ||
if (defined(value.provider) && !((_a = output.provider) === null || _a === void 0 ? void 0 : _a.match(/^(git|github|gitlab|gist)$/i))) { | ||
// repo can be any value, but must be present -> validate as any non empty string | ||
output.repo = validateString(value.repo, { | ||
...incrementOptions('repo', opts), | ||
regex: GITHUB_USERNAME_REPO_REGEX, | ||
regex: /.+/, | ||
}); | ||
} | ||
if (defined(value.provider)) { | ||
output.provider = validateEnum(value.provider, { | ||
...incrementOptions('provider', opts), | ||
enum: BinderProviders, | ||
}); | ||
else { | ||
// otherwise repo is optional, but must be a valid GitHub username/repo is defined | ||
if (defined(value.repo)) { | ||
output.repo = validateString(value.repo, { | ||
...incrementOptions('repo', opts), | ||
regex: GITHUB_USERNAME_REPO_REGEX, | ||
}); | ||
} | ||
} | ||
if (defined(value.ref)) { | ||
output.ref = validateString(value.ref, incrementOptions('ref', opts)); | ||
} | ||
return output; | ||
@@ -591,0 +602,0 @@ } |
{ | ||
"name": "myst-frontmatter", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"sideEffects": false, | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
116871
3482