New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

myst-frontmatter

Package Overview
Dependencies
Maintainers
3
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

myst-frontmatter - npm Package Compare versions

Comparing version 1.1.8 to 1.1.9

4

dist/frontmatter/types.d.ts

@@ -18,2 +18,3 @@ import type { CreditRole } from 'credit-roles';

ror?: string;
doi?: string;
url?: string;

@@ -75,3 +76,3 @@ email?: string;

binder?: boolean | BinderHubOptions;
server?: boolean | JupyterServerOptions;
server?: JupyterServerOptions;
kernelName?: string;

@@ -82,3 +83,2 @@ sessionName?: string;

mathjaxConfig?: string;
local?: boolean | JupyterLocalOptions;
};

@@ -85,0 +85,0 @@ export type WellKnownRepoProviders = 'github' | 'gitlab' | 'git' | 'gist';

import type { ValidationOptions } from 'simple-validators';
import type { Contributor, Biblio, Export, Jupytext, KernelSpec, Numbering, PageFrontmatter, ProjectFrontmatter, SiteFrontmatter, Venue, Thebe, BinderHubOptions, JupyterServerOptions, JupyterLocalOptions, ReferenceStash, Affiliation, Name } from './types.js';
import type { Contributor, Biblio, Export, Jupytext, KernelSpec, Numbering, PageFrontmatter, ProjectFrontmatter, SiteFrontmatter, Venue, Thebe, BinderHubOptions, JupyterServerOptions, ReferenceStash, Affiliation, Name } from './types.js';
export declare const SITE_FRONTMATTER_KEYS: string[];

@@ -59,5 +59,4 @@ export declare const PROJECT_FRONTMATTER_KEYS: string[];

export declare function validateThebe(input: any, opts: ValidationOptions): Thebe | undefined;
export declare function validateBinderHubOptions(input: any, opts: ValidationOptions): BinderHubOptions | undefined;
export declare function validateBinderHubOptions(input: BinderHubOptions, opts: ValidationOptions): BinderHubOptions | undefined;
export declare function validateJupyterServerOptions(input: any, opts: ValidationOptions): JupyterServerOptions | undefined;
export declare function validateJupyterLocalOptions(input: any, opts: ValidationOptions): JupyterLocalOptions | undefined;
/**

@@ -64,0 +63,0 @@ * Validate Numbering object

@@ -80,2 +80,3 @@ import { doi } from 'doi-utils';

'ror',
'doi',
'url',

@@ -108,2 +109,3 @@ 'email',

role: 'roles',
'equal-contributor': 'equal_contributor',
affiliation: 'affiliations',

@@ -150,3 +152,2 @@ website: 'url',

const JUPYTER_SERVER_OPTIONS_KEYS = ['url', 'token'];
const JUPYTER_LOCAL_OPTIONS_KEYS = ['url', 'token', 'kernelName', 'sessionName'];
const NUMBERING_KEYS = [

@@ -232,2 +233,14 @@ 'enumerator',

}
function validateDoi(value, opts) {
const doiString = validateString(value, opts);
if (doiString !== undefined) {
if (doi.validate(doiString, { strict: true })) {
return doiString;
}
else {
validationError('must be valid DOI', opts);
}
}
return undefined;
}
/**

@@ -369,2 +382,5 @@ * Update stash of authors/affiliations based on input value

}
if (defined(value.doi)) {
output.doi = validateDoi(value.doi, incrementOptions('doi', opts));
}
if (defined(value.collaboration)) {

@@ -622,9 +638,13 @@ output.collaboration = validateBoolean(value.collaboration, incrementOptions('collaboration', opts));

return undefined;
if (input === true || input === 'server')
return { server: true };
if (input === 'lite')
return { lite: true };
if (input === 'binder')
return { binder: true };
const value = validateObjectKeys(input, { optional: THEBE_KEYS }, opts);
if (typeof input === 'string' && input !== 'binder') {
return validationError(`thebe must be a boolean, an object, "lite" or "binder", not a string: ${input}`, opts);
}
let inputObject = input;
if (input === true || input === 'binder') {
// expand boolean methods to object
inputObject = { binder: true };
}
const value = validateObjectKeys(inputObject, { optional: THEBE_KEYS }, opts);
if (value === undefined)

@@ -636,7 +656,17 @@ return undefined;

}
if (defined(value.binder)) {
output.binder = validateBooleanOrObject(value.binder, incrementOptions('binder', opts), validateBinderHubOptions);
if (value.binder) {
output.binder = validateBinderHubOptions(value.binder === true ? {} : value.binder, {
...incrementOptions('binder', opts),
errorLogFn: (msg) => validationError(msg.split('object').join('an object or boolean'), opts),
});
}
if (defined(value.server)) {
output.server = validateBooleanOrObject(value.server, incrementOptions('server', opts), validateJupyterServerOptions);
const serverOpts = incrementOptions('server', opts);
const server = validateObject(value.server, serverOpts);
if (server) {
output.server = validateJupyterServerOptions(server, serverOpts);
}
else {
return undefined;
}
}

@@ -658,9 +688,8 @@ if (defined(value.kernelName)) {

}
if (defined(value.local)) {
output.local = validateBooleanOrObject(value.local, incrementOptions('local', opts), validateJupyterLocalOptions);
}
return output;
}
export function validateBinderHubOptions(input, opts) {
var _a;
var _a, _b;
// input expected to be resolved to an object at this stage.
// missing fields should be replaced by defaults
const value = validateObjectKeys(input, { optional: BINDER_HUB_OPTIONS_KEYS }, opts);

@@ -670,13 +699,37 @@ if (value === undefined)

const output = {};
if (defined(value.url)) {
output.url = validateUrl(value.url, incrementOptions('url', opts));
}
if (defined(value.provider)) {
output.provider = validateString(value.provider, {
output.url = validateUrl((_a = value.url) !== null && _a !== void 0 ? _a : 'https://mybinder.org/', incrementOptions('url', opts));
// if there is no provider, set it to github
// if there is a provider, validate it as a non empty string
output.provider = value.provider
? validateString(value.provider, {
...incrementOptions('provider', opts),
regex: /.+/,
});
})
: 'github';
// if our resolved provider is a git-like repo, we should validate repo and ref if
// provided, otherwise we supply defaults
if ((_b = output.provider) === null || _b === void 0 ? void 0 : _b.match(/^(git|github|gitlab|gist)$/i)) {
// first try to validate repo as a github username/repo string
output.repo = value.repo
? validateString(value.repo, {
...incrementOptions('repo', opts),
regex: GITHUB_USERNAME_REPO_REGEX,
suppressErrors: true,
suppressWarnings: true,
})
: 'executablebooks/thebe-binder-base';
// then if not, validate as a url and report errors based on url validation
// this will encourage use of fully qualified urls
if (!output.repo) {
output.repo = validateUrl(value.repo, incrementOptions('repo', opts));
}
// validate ref as a string
output.ref = value.ref ? validateString(value.ref, incrementOptions('ref', opts)) : 'HEAD';
}
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
else {
// we are in a custom provider and repo can be any string value, but must be present
// -> validate as any non empty string
// do not validate ref but ensure that is at least an empty string, to prevent thebe
// from setting it to 'HEAD'
// this ensures a non empty string
output.repo = validateString(value.repo, {

@@ -686,19 +739,8 @@ ...incrementOptions('repo', opts),

});
output.ref = value.ref ? validateString(value.ref, incrementOptions('ref', opts)) : '';
}
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;
}
export function validateJupyterServerOptions(input, opts) {
const value = validateObjectKeys(input, { optional: JUPYTER_SERVER_OPTIONS_KEYS }, opts);
const value = validateObjectKeys(input, { required: JUPYTER_SERVER_OPTIONS_KEYS }, opts);
if (value === undefined)

@@ -713,23 +755,4 @@ return undefined;

}
return output;
return output.url && output.token ? output : undefined;
}
export function validateJupyterLocalOptions(input, opts) {
const value = validateObjectKeys(input, { optional: JUPYTER_LOCAL_OPTIONS_KEYS }, opts);
if (value === undefined)
return undefined;
const output = {};
if (defined(value.url)) {
output.url = validateUrl(value.url, incrementOptions('url', opts));
}
if (defined(value.token)) {
output.token = validateString(value.token, incrementOptions('token', opts));
}
if (defined(value.kernelName)) {
output.kernelName = validateString(value.kernelName, incrementOptions('kernelName', opts));
}
if (defined(value.sessionName)) {
output.sessionName = validateString(value.sessionName, incrementOptions('sessionName', opts));
}
return output;
}
/**

@@ -916,6 +939,3 @@ * Validate Numbering object

if (defined(value.short_title)) {
output.short_title = validateString(value.short_title, {
...incrementOptions('short_title', opts),
maxLength: 40,
});
output.short_title = validateString(value.short_title, incrementOptions('short_title', opts));
}

@@ -1019,12 +1039,3 @@ if (defined(value.subtitle)) {

if (defined(value.doi)) {
const doiOpts = incrementOptions('doi', opts);
const doiString = validateString(value.doi, doiOpts);
if (doiString !== undefined) {
if (doi.validate(doiString, { strict: true })) {
output.doi = doiString;
}
else {
validationError('must be valid DOI', doiOpts);
}
}
output.doi = validateDoi(value.doi, incrementOptions('doi', opts));
}

@@ -1140,4 +1151,6 @@ if (defined(value.arxiv)) {

const result = validateThebe(value.thebe, incrementOptions('thebe', opts));
if (result)
if (result && Object.keys(result).length > 0)
output.thebe = result;
else
delete output.thebe;
}

@@ -1144,0 +1157,0 @@ if (defined(value.requirements)) {

@@ -19,3 +19,3 @@ import { defined, incrementOptions, validateKeys, validateList, validateObject, validateObjectKeys, validateString, } from 'simple-validators';

if (defined(value.id)) {
output.id = validateString(value.id, incrementOptions('id', opts));
output.id = validateString(value.id, { ...incrementOptions('id', opts), coerceNumber: true });
}

@@ -22,0 +22,0 @@ if (defined(value.name)) {

@@ -25,2 +25,5 @@ // This file can be updated by:

},
'Adobe-Utopia': {
name: 'Adobe Utopia Font License',
},
ADSL: {

@@ -226,2 +229,8 @@ name: 'Amazon Digital Services License',

},
'BSD-3-Clause-flex': {
name: 'BSD 3-Clause Flex variant',
},
'BSD-3-Clause-HP': {
name: 'Hewlett-Packard BSD variant license',
},
'BSD-3-Clause-LBNL': {

@@ -249,2 +258,5 @@ name: 'Lawrence Berkeley National Labs BSD variant license',

},
'BSD-3-Clause-Sun': {
name: 'BSD 3-Clause Sun Microsystems',
},
'BSD-4-Clause': {

@@ -272,2 +284,5 @@ name: 'BSD 4-Clause "Original" or "Old" License',

},
'BSD-Inferno-Nettverk': {
name: 'BSD-Inferno-Nettverk',
},
'BSD-Protection': {

@@ -279,2 +294,5 @@ name: 'BSD Protection License',

},
'BSD-Systemics': {
name: 'Systemics BSD variant license',
},
'BSL-1.0': {

@@ -583,2 +601,5 @@ name: 'Boost Software License 1.0',

},
'check-cvs': {
name: 'check-cvs License',
},
checkmk: {

@@ -639,2 +660,5 @@ name: 'Checkmk License',

},
Cronyx: {
name: 'Cronyx License',
},
Crossword: {

@@ -665,2 +689,5 @@ name: 'Crossword License',

},
'DL-DE-ZERO-2.0': {
name: 'Data licence Germany – zero – version 2.0',
},
DOC: {

@@ -756,5 +783,11 @@ name: 'DOC License',

},
FBM: {
name: 'Fuzzy Bitmap License',
},
'FDK-AAC': {
name: 'Fraunhofer FDK AAC Codec Library',
},
'Ferguson-Twofish': {
name: 'Ferguson Twofish License',
},
'Frameworx-1.0': {

@@ -787,2 +820,8 @@ name: 'Frameworx Open License 1.0',

},
Furuseth: {
name: 'Furuseth License',
},
fwlw: {
name: 'fwlw License',
},
GD: {

@@ -911,2 +950,5 @@ name: 'GD License',

},
'HP-1989': {
name: 'Hewlett-Packard 1989 License',
},
HPND: {

@@ -917,8 +959,26 @@ name: 'Historical Permission Notice and Disclaimer',

},
'HPND-DEC': {
name: 'Historical Permission Notice and Disclaimer - DEC variant',
},
'HPND-doc': {
name: 'Historical Permission Notice and Disclaimer - documentation variant',
},
'HPND-doc-sell': {
name: 'Historical Permission Notice and Disclaimer - documentation sell variant',
},
'HPND-export-US': {
name: 'HPND with US Government export control warning',
},
'HPND-export-US-modify': {
name: 'HPND with US Government export control warning and modification rqmt',
},
'HPND-Markus-Kuhn': {
name: 'Historical Permission Notice and Disclaimer - Markus Kuhn variant',
},
'HPND-Pbmplus': {
name: 'Historical Permission Notice and Disclaimer - Pbmplus variant',
},
'HPND-sell-regexpr': {
name: 'Historical Permission Notice and Disclaimer - sell regexpr variant',
},
'HPND-sell-variant': {

@@ -930,2 +990,5 @@ name: 'Historical Permission Notice and Disclaimer - sell variant',

},
'HPND-UC': {
name: 'Historical Permission Notice and Disclaimer - University of California variant',
},
HTMLTIDY: {

@@ -1009,2 +1072,5 @@ name: 'HTML Tidy License',

},
Kastrup: {
name: 'Kastrup License',
},
Kazlib: {

@@ -1134,2 +1200,8 @@ name: 'Kazlib License',

},
lsof: {
name: 'lsof License',
},
'Lucida-Bitmap-Fonts': {
name: 'Lucida Bitmap Fonts License',
},
'LZMA-SDK-9.11-to-9.20': {

@@ -1141,2 +1213,5 @@ name: 'LZMA SDK License (versions 9.11 to 9.20)',

},
magaz: {
name: 'magaz License',
},
MakeIndex: {

@@ -1148,2 +1223,5 @@ name: 'MakeIndex License',

},
'McPhee-slideshow': {
name: 'McPhee Slideshow License',
},
metamail: {

@@ -1190,2 +1268,5 @@ name: 'metamail License',

},
'MIT-testregex': {
name: 'MIT testregex Variant',
},
'MIT-Wu': {

@@ -1197,2 +1278,5 @@ name: 'MIT Tom Wu Variant',

},
MMIXware: {
name: 'MMIXware License',
},
Motosoto: {

@@ -1202,2 +1286,5 @@ name: 'Motosoto License',

},
'MPEG-SSG': {
name: 'MPEG Software Simulation',
},
'mpi-permissive': {

@@ -1517,2 +1604,5 @@ name: 'mpi Permissive License',

},
PADL: {
name: 'PADL License',
},
'Parity-6.0.0': {

@@ -1539,2 +1629,5 @@ name: 'The Parity Public License 6.0.0',

},
pnmstitch: {
name: 'pnmstitch License',
},
'PolyForm-Noncommercial-1.0.0': {

@@ -1567,2 +1660,5 @@ name: 'PolyForm Noncommercial License 1.0.0',

},
'python-ldap': {
name: 'Python ldap License',
},
Qhull: {

@@ -1637,2 +1733,5 @@ name: 'Qhull License',

},
'SGI-OpenGL': {
name: 'SGI OpenGL License',
},
SGP4: {

@@ -1659,2 +1758,5 @@ name: 'SGP4 Permission Notice',

},
SL: {
name: 'SL License',
},
Sleepycat: {

@@ -1678,2 +1780,5 @@ name: 'Sleepycat License',

},
Soundex: {
name: 'Soundex License',
},
'Spencer-86': {

@@ -1693,2 +1798,5 @@ name: 'Spencer License 86',

},
'ssh-keyscan': {
name: 'ssh-keyscan License',
},
'SSH-OpenSSH': {

@@ -1712,2 +1820,5 @@ name: 'SSH OpenSSH license',

},
swrule: {
name: 'swrule License',
},
Symlinks: {

@@ -1746,2 +1857,5 @@ name: 'Symlinks License',

},
TTYP0: {
name: 'TTYP0 License',
},
'TU-Berlin-1.0': {

@@ -1760,2 +1874,5 @@ name: 'Technische Universitaet Berlin License 1.0',

},
ulem: {
name: 'ulem License',
},
'Unicode-DFS-2015': {

@@ -1784,2 +1901,5 @@ name: 'Unicode License Agreement - Data Files and Software (2015)',

},
'URT-RLE': {
name: 'Utah Raster Toolkit Run Length Encoded License',
},
Vim: {

@@ -1871,2 +1991,5 @@ name: 'Vim License',

},
Zeeff: {
name: 'Zeeff License',
},
'Zend-2.0': {

@@ -1873,0 +1996,0 @@ name: 'Zend License v2.0',

{
"name": "myst-frontmatter",
"version": "1.1.8",
"version": "1.1.9",
"sideEffects": false,

@@ -28,3 +28,3 @@ "license": "MIT",

"test:watch": "vitest watch",
"build:esm": "tsc --project ./tsconfig.json --module es2015 --outDir dist --declaration",
"build:esm": "tsc",
"build": "npm-run-all -l clean -p build:esm"

@@ -39,3 +39,3 @@ },

"orcid": "^1.0.0",
"simple-validators": "^1.0.1",
"simple-validators": "^1.0.2",
"spdx-correct": "^3.2.0"

@@ -42,0 +42,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc