Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

myst-frontmatter

Package Overview
Dependencies
Maintainers
3
Versions
78
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.3.0 to 1.4.0

dist/references/index.d.ts

2

dist/affiliations/validators.js

@@ -24,3 +24,3 @@ import { defined, incrementOptions, validateBoolean, validateEmail, validateNumber, validateObjectKeys, validateString, validateUrl, validationWarning, } from 'simple-validators';

export const AFFILIATION_ALIASES = {
ref: 'id',
ref: 'id', // Used in QMD to reference an affiliation
region: 'state',

@@ -27,0 +27,0 @@ province: 'state',

@@ -28,3 +28,3 @@ import { credit } from 'credit-roles';

const PERSON_ALIASES = {
ref: 'id',
ref: 'id', // Used in QMD to reference a contributor
role: 'roles',

@@ -31,0 +31,0 @@ 'equal-contributor': 'equal_contributor',

@@ -12,4 +12,5 @@ export * from './affiliations/index.js';

export * from './page/index.js';
export * from './project/index.js';
export * from './references/index.js';
export * from './settings/index.js';
export * from './project/index.js';
export * from './site/index.js';

@@ -16,0 +17,0 @@ export * from './thebe/index.js';

@@ -12,4 +12,5 @@ export * from './affiliations/index.js';

export * from './page/index.js';
export * from './project/index.js';
export * from './references/index.js';
export * from './settings/index.js';
export * from './project/index.js';
export * from './site/index.js';

@@ -16,0 +17,0 @@ export * from './thebe/index.js';

@@ -7,2 +7,3 @@ import type { Jupytext } from '../jupytext/types.js';

export type PageFrontmatter = ProjectAndPageFrontmatter & {
label?: string;
kernelspec?: KernelSpec;

@@ -9,0 +10,0 @@ jupytext?: Jupytext;

@@ -14,2 +14,3 @@ import { PROJECT_AND_PAGE_FRONTMATTER_KEYS } from '../project/types.js';

// These keys only exist on the page
'label',
'kernelspec',

@@ -16,0 +17,0 @@ 'jupytext',

@@ -30,2 +30,5 @@ import { defined, incrementOptions, validateList, validateObjectKeys, validateString, validationError, validateBoolean, } from 'simple-validators';

const output = validateProjectAndPageFrontmatterKeys(value, opts);
if (defined(value.label)) {
output.label = validateString(value.label, incrementOptions('label', opts));
}
if (defined(value.kernelspec)) {

@@ -82,4 +85,4 @@ output.kernelspec = validateKernelSpec(value.kernelspec, incrementOptions('kernelspec', opts));

export function validatePageFrontmatter(input, opts) {
const value = validateObjectKeys(input, { optional: PAGE_FRONTMATTER_KEYS, alias: FRONTMATTER_ALIASES }, opts) || {};
const value = validateObjectKeys(input, { optional: PAGE_FRONTMATTER_KEYS, alias: { ...FRONTMATTER_ALIASES, name: 'label' } }, opts) || {};
return validatePageFrontmatterKeys(value, opts);
}

@@ -6,2 +6,3 @@ import type { Biblio } from '../biblio/types.js';

import type { Numbering } from '../numbering/types.js';
import type { ExternalReferences } from '../references/types.js';
import type { ProjectSettings } from '../settings/types.js';

@@ -14,3 +15,2 @@ import type { SiteFrontmatter } from '../site/types.js';

date?: string;
name?: string;
doi?: string;

@@ -38,6 +38,4 @@ arxiv?: string;

id?: string;
/** Intersphinx and cross-project references */
references?: Record<string, {
url: string;
}>;
/** Intersphinx and MyST cross-project references */
references?: ExternalReferences;
requirements?: string[];

@@ -44,0 +42,0 @@ resources?: string[];

import { SITE_FRONTMATTER_KEYS } from '../site/types.js';
export const PROJECT_AND_PAGE_FRONTMATTER_KEYS = [
'date',
'name',
'doi',

@@ -20,3 +19,3 @@ 'arxiv',

'downloads',
'settings',
'settings', // We maybe want to move this into site frontmatter in the future
// Do not add any project specific keys here!

@@ -23,0 +22,0 @@ ...SITE_FRONTMATTER_KEYS,

@@ -7,2 +7,3 @@ import { defined, filterKeys, incrementOptions, validateBoolean, validateDate, validateList, validateObject, validateObjectKeys, validateString, validateUrl, } from 'simple-validators';

import { validateNumbering } from '../numbering/validators.js';
import { validateExternalReferences } from '../references/validators.js';
import { validateSiteFrontmatterKeys } from '../site/validators.js';

@@ -19,5 +20,2 @@ import { validateThebe } from '../thebe/validators.js';

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

@@ -135,14 +133,3 @@ output.doi = validateDoi(value.doi, incrementOptions('doi', opts));

if (defined(value.references)) {
const referencesOpts = incrementOptions('references', opts);
const references = validateObject(value.references, referencesOpts);
if (references) {
output.references = Object.fromEntries(Object.keys(references)
.map((key) => {
const url = validateUrl(references[key], incrementOptions(key, referencesOpts));
if (!url)
return undefined;
return [key, { url }];
})
.filter((exists) => !!exists));
}
output.references = validateExternalReferences(value.references, incrementOptions('references', opts));
}

@@ -174,4 +161,4 @@ if (defined(value.thebe)) {

export function validateProjectFrontmatter(input, opts) {
const value = validateObjectKeys(input, { optional: PROJECT_FRONTMATTER_KEYS, alias: FRONTMATTER_ALIASES }, opts) || {};
const value = validateObjectKeys(input, { optional: PROJECT_FRONTMATTER_KEYS, alias: { ...FRONTMATTER_ALIASES, name: 'label' } }, opts) || {};
return validateProjectFrontmatterKeys(value, opts);
}
{
"name": "myst-frontmatter",
"version": "1.3.0",
"version": "1.4.0",
"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

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