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.1.14 to 1.1.15

dist/settings/index.d.ts

2

dist/exports/types.d.ts

@@ -14,3 +14,3 @@ export declare enum ExportFormats {

output?: string;
article?: string;
articles?: string[];
/** sub_articles are only for jats xml export */

@@ -17,0 +17,0 @@ sub_articles?: string[];

@@ -1,12 +0,15 @@

import { defined, incrementOptions, validateEnum, validateKeys, validateList, validateObject, validateString, validationError, } from 'simple-validators';
import { defined, incrementOptions, validateEnum, validateList, validateObjectKeys, validateString, validationError, } from 'simple-validators';
import { ExportFormats } from './types.js';
const EXPORT_KEY_OBJECT = {
required: ['format'],
optional: ['template', 'output', 'id', 'name', 'renderer', 'articles', 'sub_articles'],
alias: {
article: 'articles',
sub_article: 'sub_articles',
},
};
export const RESERVED_EXPORT_KEYS = [
'format',
'template',
'output',
'id',
'name',
'renderer',
'article',
'sub_articles',
...EXPORT_KEY_OBJECT.required,
...EXPORT_KEY_OBJECT.optional,
...Object.keys(EXPORT_KEY_OBJECT.alias),
];

@@ -34,3 +37,2 @@ export function validateExportsList(input, opts) {

export function validateExport(input, opts) {
let value;
if (typeof input === 'string') {

@@ -40,10 +42,11 @@ const format = validateExportFormat(input, opts);

return undefined;
value = { format };
input = { format };
}
else {
value = validateObject(input, opts);
}
const value = validateObjectKeys(input, EXPORT_KEY_OBJECT, {
...opts,
suppressWarnings: true,
keepExtraKeys: true,
});
if (value === undefined)
return undefined;
validateKeys(value, { required: ['format'], optional: RESERVED_EXPORT_KEYS }, { ...opts, suppressWarnings: true });
const format = validateExportFormat(value.format, incrementOptions('format', opts));

@@ -64,11 +67,26 @@ if (format === undefined)

}
if (defined(value.article)) {
output.article = validateString(value.article, incrementOptions('article', opts));
if (defined(value.articles)) {
const articles = validateList(value.articles, { coerce: true, ...incrementOptions('articles', opts) }, (item, ind) => validateString(item, incrementOptions(`articles.${ind}`, opts)));
if ((articles === null || articles === void 0 ? void 0 : articles.length) &&
articles.length > 1 &&
![ExportFormats.pdf, ExportFormats.tex, ExportFormats.pdftex].includes(output.format)) {
if (output.format === ExportFormats.xml && !defined(value.sub_articles)) {
validationError("multiple articles are not supported for 'jats' export - instead specify one article with additional sub_articles", opts);
}
else {
validationError("multiple articles are only supported for 'tex' and 'pdf' exports", opts);
}
output.articles = [articles[0]];
}
else {
output.articles = articles;
}
}
if (defined(value.sub_articles)) {
if (output.format !== ExportFormats.xml) {
validationError("sub_articles are only supported for exports of format 'jats'", opts);
validationError("sub_articles are only supported for 'jats' export", opts);
output.sub_articles = undefined;
}
else {
output.sub_articles = validateList(value.sub_articles, incrementOptions('sub_articles', opts), (file, ind) => {
output.sub_articles = validateList(value.sub_articles, { coerce: true, ...incrementOptions('sub_articles', opts) }, (file, ind) => {
return validateString(file, incrementOptions(`sub_articles.${ind}`, opts));

@@ -75,0 +93,0 @@ });

@@ -11,2 +11,3 @@ export * from './affiliations/index.js';

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

@@ -13,0 +14,0 @@ export * from './site/index.js';

@@ -11,2 +11,3 @@ export * from './affiliations/index.js';

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

@@ -13,0 +14,0 @@ export * from './site/index.js';

@@ -5,10 +5,5 @@ import type { Biblio } from '../biblio/types.js';

import type { Numbering } from '../numbering/types.js';
import type { ProjectSettings } from '../settings/types.js';
import type { SiteFrontmatter } from '../site/types.js';
import type { Thebe } from '../thebe/types.js';
type OutputRemovalOptions = 'show' | 'remove' | 'remove-warn' | 'remove-error' | 'warn' | 'error';
export type ProjectSettings = {
output_stderr?: OutputRemovalOptions;
output_stdout?: OutputRemovalOptions;
output_matplotlib_strings?: OutputRemovalOptions;
};
export type ProjectAndPageFrontmatter = SiteFrontmatter & {

@@ -45,3 +40,2 @@ date?: string;

};
export {};
//# sourceMappingURL=types.d.ts.map
import type { ValidationOptions } from 'simple-validators';
import type { ProjectAndPageFrontmatter, ProjectFrontmatter, ProjectSettings } from './types.js';
export declare const PROJECT_SETTINGS: string[];
export declare const PROJECT_SETTINGS_ALIAS: {
stderr_output: string;
stdout_output: string;
};
import type { ProjectAndPageFrontmatter, ProjectFrontmatter } from './types.js';
export declare const PROJECT_AND_PAGE_FRONTMATTER_KEYS: string[];
export declare const PROJECT_FRONTMATTER_KEYS: string[];
export declare function validateProjectAndPageSettings(value: Record<string, any>, opts: ValidationOptions): ProjectSettings | undefined;
export declare function validateProjectAndPageFrontmatterKeys(value: Record<string, any>, opts: ValidationOptions): ProjectAndPageFrontmatter;

@@ -12,0 +6,0 @@ export declare function validateProjectFrontmatterKeys(value: Record<string, any>, opts: ValidationOptions): ProjectFrontmatter;

@@ -1,2 +0,2 @@

import { defined, filterKeys, incrementOptions, validateBoolean, validateChoice, validateDate, validateList, validateObject, validateObjectKeys, validateString, validateUrl, } from 'simple-validators';
import { defined, filterKeys, incrementOptions, validateBoolean, validateDate, validateList, validateObject, validateObjectKeys, validateString, validateUrl, } from 'simple-validators';
import { validateBiblio } from '../biblio/validators.js';

@@ -9,15 +9,3 @@ import { validateExportsList } from '../exports/validators.js';

import { validateBooleanOrObject, validateDoi } from '../utils/validators.js';
const OUTPUT_REMOVAL_OPTIONS = [
'show',
'remove',
'remove-warn',
'remove-error',
'warn',
'error',
];
export const PROJECT_SETTINGS = ['output_stderr', 'output_stdout', 'output_matplotlib_strings'];
export const PROJECT_SETTINGS_ALIAS = {
stderr_output: 'output_stderr',
stdout_output: 'output_stdout',
};
import { validateProjectAndPageSettings } from '../settings/validators.js';
export const PROJECT_AND_PAGE_FRONTMATTER_KEYS = [

@@ -52,35 +40,2 @@ 'date',

];
export function validateProjectAndPageSettings(value, opts) {
const output = {};
const settings = validateObjectKeys(value, { optional: PROJECT_SETTINGS, alias: PROJECT_SETTINGS_ALIAS }, opts);
if (!settings)
return undefined;
if (defined(settings.output_stderr)) {
const output_stderr = validateChoice(settings.output_stderr, {
...incrementOptions('output_stderr', opts),
choices: OUTPUT_REMOVAL_OPTIONS,
});
if (output_stderr)
output.output_stderr = output_stderr;
}
if (defined(settings.output_stdout)) {
const output_stdout = validateChoice(settings.output_stdout, {
...incrementOptions('output_stdout', opts),
choices: OUTPUT_REMOVAL_OPTIONS,
});
if (output_stdout)
output.output_stdout = output_stdout;
}
if (defined(settings.output_matplotlib_strings)) {
const output_matplotlib_strings = validateChoice(settings.output_matplotlib_strings, {
...incrementOptions('output_matplotlib_strings', opts),
choices: OUTPUT_REMOVAL_OPTIONS,
});
if (output_matplotlib_strings)
output.output_matplotlib_strings = output_matplotlib_strings;
}
if (Object.keys(output).length === 0)
return undefined;
return output;
}
export function validateProjectAndPageFrontmatterKeys(value, opts) {

@@ -87,0 +42,0 @@ const output = validateSiteFrontmatterKeys(value, opts);

{
"name": "myst-frontmatter",
"version": "1.1.14",
"version": "1.1.15",
"sideEffects": false,

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

"orcid": "^1.0.0",
"simple-validators": "^1.0.3",
"simple-validators": "^1.0.4",
"spdx-correct": "^3.2.0"

@@ -41,0 +41,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

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