mystmd 1.2.3__tar.gz → 1.2.4__tar.gz
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.
- {mystmd-1.2.3 → mystmd-1.2.4}/PKG-INFO +1 -1
- {mystmd-1.2.3 → mystmd-1.2.4}/_package.json +2 -2
- {mystmd-1.2.3 → mystmd-1.2.4}/src/mystmd_py/myst.cjs +221 -123
- {mystmd-1.2.3 → mystmd-1.2.4}/.gitignore +0 -0
- {mystmd-1.2.3 → mystmd-1.2.4}/LICENSE +0 -0
- {mystmd-1.2.3 → mystmd-1.2.4}/README.md +0 -0
- {mystmd-1.2.3 → mystmd-1.2.4}/pyproject.toml +0 -0
- {mystmd-1.2.3 → mystmd-1.2.4}/src/mystmd_py/__init__.py +0 -0
- {mystmd-1.2.3 → mystmd-1.2.4}/src/mystmd_py/main.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "mystmd",
|
3
|
-
"version": "1.2.
|
3
|
+
"version": "1.2.4",
|
4
4
|
"description": "Command line tools for MyST Markdown",
|
5
5
|
"author": "Rowan Cockett <rowan@curvenote.com>",
|
6
6
|
"license": "MIT",
|
@@ -45,6 +45,6 @@
|
|
45
45
|
"commander": "^10.0.1",
|
46
46
|
"core-js": "^3.31.1",
|
47
47
|
"js-yaml": "^4.1.0",
|
48
|
-
"myst-cli": "^1.2.
|
48
|
+
"myst-cli": "^1.2.4"
|
49
49
|
}
|
50
50
|
}
|
@@ -193279,7 +193279,7 @@ var {
|
|
193279
193279
|
} = import_index.default;
|
193280
193280
|
|
193281
193281
|
// src/version.ts
|
193282
|
-
var version = "1.2.
|
193282
|
+
var version = "1.2.4";
|
193283
193283
|
var version_default = version;
|
193284
193284
|
|
193285
193285
|
// ../myst-cli/dist/build/build.js
|
@@ -198359,30 +198359,33 @@ function validatePageFrontmatter(input3, opts) {
|
|
198359
198359
|
|
198360
198360
|
// ../myst-frontmatter/dist/utils/fillPageFrontmatter.js
|
198361
198361
|
function fillPageFrontmatter(pageFrontmatter, projectFrontmatter, opts) {
|
198362
|
+
return fillProjectFrontmatter(pageFrontmatter, projectFrontmatter, opts, USE_PROJECT_FALLBACK);
|
198363
|
+
}
|
198364
|
+
function fillProjectFrontmatter(base5, filler, opts, keys2) {
|
198362
198365
|
var _a6, _b, _c, _d2, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x2;
|
198363
|
-
const frontmatter = fillMissingKeys(
|
198364
|
-
if (
|
198365
|
-
frontmatter.numbering = fillNumbering(
|
198366
|
+
const frontmatter = fillMissingKeys(base5, filler, keys2 !== null && keys2 !== void 0 ? keys2 : Object.keys(filler));
|
198367
|
+
if (filler.numbering || base5.numbering) {
|
198368
|
+
frontmatter.numbering = fillNumbering(base5.numbering, filler.numbering);
|
198366
198369
|
}
|
198367
|
-
if (
|
198368
|
-
frontmatter.math = { ...(_a6 =
|
198370
|
+
if (filler.math || base5.math) {
|
198371
|
+
frontmatter.math = { ...(_a6 = filler.math) !== null && _a6 !== void 0 ? _a6 : {}, ...(_b = base5.math) !== null && _b !== void 0 ? _b : {} };
|
198369
198372
|
}
|
198370
|
-
if (
|
198373
|
+
if (filler.abbreviations || base5.abbreviations) {
|
198371
198374
|
frontmatter.abbreviations = {
|
198372
|
-
...(_c =
|
198373
|
-
...(_d2 =
|
198375
|
+
...(_c = filler.abbreviations) !== null && _c !== void 0 ? _c : {},
|
198376
|
+
...(_d2 = base5.abbreviations) !== null && _d2 !== void 0 ? _d2 : {}
|
198374
198377
|
};
|
198375
198378
|
}
|
198376
|
-
if (
|
198379
|
+
if (filler.options || base5.options) {
|
198377
198380
|
frontmatter.options = {
|
198378
|
-
...(_e =
|
198379
|
-
...(_f =
|
198381
|
+
...(_e = filler.options) !== null && _e !== void 0 ? _e : {},
|
198382
|
+
...(_f = base5.options) !== null && _f !== void 0 ? _f : {}
|
198380
198383
|
};
|
198381
198384
|
}
|
198382
|
-
if (
|
198385
|
+
if (filler.settings || base5.settings) {
|
198383
198386
|
frontmatter.settings = {
|
198384
|
-
...(_g =
|
198385
|
-
...(_h =
|
198387
|
+
...(_g = filler.settings) !== null && _g !== void 0 ? _g : {},
|
198388
|
+
...(_h = base5.settings) !== null && _h !== void 0 ? _h : {}
|
198386
198389
|
};
|
198387
198390
|
}
|
198388
198391
|
const contributorIds = /* @__PURE__ */ new Set();
|
@@ -198410,10 +198413,10 @@ function fillPageFrontmatter(pageFrontmatter, projectFrontmatter, opts) {
|
|
198410
198413
|
});
|
198411
198414
|
if (((_m = frontmatter.authors) === null || _m === void 0 ? void 0 : _m.length) || contributorIds.size) {
|
198412
198415
|
const people = [
|
198413
|
-
...(_o =
|
198414
|
-
...(_p =
|
198415
|
-
...(_q =
|
198416
|
-
...(_r =
|
198416
|
+
...(_o = base5.authors) !== null && _o !== void 0 ? _o : [],
|
198417
|
+
...(_p = filler.authors) !== null && _p !== void 0 ? _p : [],
|
198418
|
+
...(_q = base5.contributors) !== null && _q !== void 0 ? _q : [],
|
198419
|
+
...(_r = filler.contributors) !== null && _r !== void 0 ? _r : []
|
198417
198420
|
];
|
198418
198421
|
const peopleLookup = {};
|
198419
198422
|
people.forEach((auth) => {
|
@@ -198452,10 +198455,7 @@ function fillPageFrontmatter(pageFrontmatter, projectFrontmatter, opts) {
|
|
198452
198455
|
affiliationIds.add(aff.id);
|
198453
198456
|
});
|
198454
198457
|
if (affiliationIds.size) {
|
198455
|
-
const affiliations2 = [
|
198456
|
-
...(_w = pageFrontmatter.affiliations) !== null && _w !== void 0 ? _w : [],
|
198457
|
-
...(_x2 = projectFrontmatter.affiliations) !== null && _x2 !== void 0 ? _x2 : []
|
198458
|
-
];
|
198458
|
+
const affiliations2 = [...(_w = base5.affiliations) !== null && _w !== void 0 ? _w : [], ...(_x2 = filler.affiliations) !== null && _x2 !== void 0 ? _x2 : []];
|
198459
198459
|
const affiliationLookup = {};
|
198460
198460
|
affiliations2.forEach((aff) => {
|
198461
198461
|
if (!aff.id || isStashPlaceholder(aff))
|
@@ -236443,19 +236443,36 @@ var GithubTransformer = class {
|
|
236443
236443
|
};
|
236444
236444
|
|
236445
236445
|
// ../myst-transforms/dist/links/check.js
|
236446
|
-
function checkLinkTextTransform(mdast2, vfile2) {
|
236447
|
-
const linkNodes = selectAll("link,linkBlock,card
|
236448
|
-
|
236449
|
-
return;
|
236446
|
+
function checkLinkTextTransform(mdast2, externalReferences, vfile2) {
|
236447
|
+
const linkNodes = selectAll("link,linkBlock,card", mdast2);
|
236448
|
+
const xrefNodes = selectAll("crossReference", mdast2);
|
236450
236449
|
linkNodes.forEach((node3) => {
|
236451
236450
|
var _a6;
|
236452
|
-
if (
|
236451
|
+
if (node3.url.startsWith("xref:") || node3.url.startsWith("myst:")) {
|
236452
|
+
const key2 = node3.url.slice(5).split("/")[0].split("#")[0];
|
236453
|
+
if (externalReferences.map((ref) => ref.key).includes(key2)) {
|
236454
|
+
} else {
|
236455
|
+
fileError(vfile2, `Link did not resolve to valid cross-reference: ${node3.url}`, {
|
236456
|
+
node: node3,
|
236457
|
+
ruleId: RuleId.linkTextExists,
|
236458
|
+
note: key2 ? `You need an entry in your project references with key "${key2}"` : void 0
|
236459
|
+
});
|
236460
|
+
}
|
236461
|
+
} else if (!toText(node3.children) && !select("image", node3)) {
|
236453
236462
|
fileWarn(vfile2, `Link text is empty for <${(_a6 = node3.urlSource) !== null && _a6 !== void 0 ? _a6 : node3.url}${node3.identifier ? `#${node3.identifier}` : ""}>`, {
|
236454
236463
|
node: node3,
|
236455
236464
|
ruleId: RuleId.linkTextExists
|
236456
236465
|
});
|
236457
236466
|
}
|
236458
236467
|
});
|
236468
|
+
xrefNodes.forEach((node3) => {
|
236469
|
+
if (!toText(node3.children) && !select("image", node3)) {
|
236470
|
+
fileWarn(vfile2, `Cross reference text is empty for <${node3.urlSource}>`, {
|
236471
|
+
node: node3,
|
236472
|
+
ruleId: RuleId.linkTextExists
|
236473
|
+
});
|
236474
|
+
}
|
236475
|
+
});
|
236459
236476
|
}
|
236460
236477
|
|
236461
236478
|
// ../myst-transforms/dist/targets.js
|
@@ -237303,7 +237320,7 @@ var ReferenceState = class {
|
|
237303
237320
|
}
|
237304
237321
|
};
|
237305
237322
|
function addChildrenFromTargetNode(node3, targetNode, numbering, vfile2) {
|
237306
|
-
var _a6, _b, _c;
|
237323
|
+
var _a6, _b, _c, _d2, _e;
|
237307
237324
|
numbering = fillNumbering(numbering, DEFAULT_NUMBERING);
|
237308
237325
|
const kind = kindFromNode2(targetNode);
|
237309
237326
|
const noNodeChildren = !((_a6 = node3.children) === null || _a6 === void 0 ? void 0 : _a6.length);
|
@@ -237322,8 +237339,8 @@ function addChildrenFromTargetNode(node3, targetNode, numbering, vfile2) {
|
|
237322
237339
|
fillReferenceEnumerators2(vfile2, node3, template, targetNode, title);
|
237323
237340
|
}
|
237324
237341
|
node3.resolved = true;
|
237325
|
-
node3.identifier = targetNode.identifier;
|
237326
|
-
node3.html_id = targetNode.html_id;
|
237342
|
+
node3.identifier = (_d2 = targetNode.identifier) !== null && _d2 !== void 0 ? _d2 : node3.identifier;
|
237343
|
+
node3.html_id = (_e = targetNode.html_id) !== null && _e !== void 0 ? _e : node3.html_id;
|
237327
237344
|
}
|
237328
237345
|
function warnNodeTargetNotFound(node3, vfile2) {
|
237329
237346
|
if (!vfile2)
|
@@ -237661,6 +237678,7 @@ var selectors_exports = {};
|
|
237661
237678
|
__export(selectors_exports, {
|
237662
237679
|
selectAffiliation: () => selectAffiliation,
|
237663
237680
|
selectAllDependencies: () => selectAllDependencies,
|
237681
|
+
selectConfigExtensions: () => selectConfigExtensions,
|
237664
237682
|
selectCurrentProjectConfig: () => selectCurrentProjectConfig,
|
237665
237683
|
selectCurrentProjectFile: () => selectCurrentProjectFile,
|
237666
237684
|
selectCurrentProjectPath: () => selectCurrentProjectPath,
|
@@ -237735,6 +237753,10 @@ function selectLocalConfigFile(state, path42) {
|
|
237735
237753
|
function selectLocalRawConfig(state, path42) {
|
237736
237754
|
return mutableCopy(state.local.config.rawConfigs[(0, import_node_path4.resolve)(path42)]);
|
237737
237755
|
}
|
237756
|
+
function selectConfigExtensions(state) {
|
237757
|
+
var _a6;
|
237758
|
+
return [...(_a6 = state.local.config.configExtensions) !== null && _a6 !== void 0 ? _a6 : []];
|
237759
|
+
}
|
237738
237760
|
function selectReloadingState(state) {
|
237739
237761
|
const { reloading, reloadRequested } = state.local.watch;
|
237740
237762
|
return { reloading, reloadRequested };
|
@@ -239927,6 +239949,11 @@ var config = createSlice({
|
|
239927
239949
|
receiveProjectConfig(state, action) {
|
239928
239950
|
const { path: path42, ...payload } = action.payload;
|
239929
239951
|
state.projects[(0, import_node_path5.resolve)(path42)] = payload;
|
239952
|
+
},
|
239953
|
+
receiveConfigExtension(state, action) {
|
239954
|
+
var _a6;
|
239955
|
+
(_a6 = state.configExtensions) !== null && _a6 !== void 0 ? _a6 : state.configExtensions = [];
|
239956
|
+
state.configExtensions.push(action.payload.file);
|
239930
239957
|
}
|
239931
239958
|
}
|
239932
239959
|
});
|
@@ -240199,15 +240226,7 @@ function configFromPath(session, path42) {
|
|
240199
240226
|
return void 0;
|
240200
240227
|
return configs[0];
|
240201
240228
|
}
|
240202
|
-
function
|
240203
|
-
var _a6, _b, _c;
|
240204
|
-
const file = configFromPath(session, path42);
|
240205
|
-
if (!file) {
|
240206
|
-
session.log.debug(`No config loaded from path: ${path42}`);
|
240207
|
-
return;
|
240208
|
-
}
|
240209
|
-
const vfile2 = new VFile();
|
240210
|
-
vfile2.path = file;
|
240229
|
+
function loadConfigYaml(file) {
|
240211
240230
|
if (!import_node_fs2.default.existsSync(file))
|
240212
240231
|
throw Error(`Cannot find config file: ${file}`);
|
240213
240232
|
let rawConf;
|
@@ -240219,27 +240238,38 @@ function loadConfig(session, path42) {
|
|
240219
240238
|
${err.message}` : "";
|
240220
240239
|
throw Error(`Unable to read config file ${file} as YAML${suffix}`);
|
240221
240240
|
}
|
240222
|
-
|
240223
|
-
|
240224
|
-
|
240225
|
-
|
240226
|
-
|
240227
|
-
|
240228
|
-
property: "config",
|
240241
|
+
return rawConf;
|
240242
|
+
}
|
240243
|
+
function configValidationOpts(vfile2, property, ruleId) {
|
240244
|
+
return {
|
240245
|
+
file: vfile2.path,
|
240246
|
+
property,
|
240229
240247
|
messages: {},
|
240230
240248
|
errorLogFn: (message) => {
|
240231
|
-
fileError(vfile2, message, { ruleId
|
240249
|
+
fileError(vfile2, message, { ruleId });
|
240232
240250
|
},
|
240233
240251
|
warningLogFn: (message) => {
|
240234
|
-
fileWarn(vfile2, message, { ruleId
|
240252
|
+
fileWarn(vfile2, message, { ruleId });
|
240235
240253
|
}
|
240236
240254
|
};
|
240237
|
-
|
240238
|
-
|
240239
|
-
|
240240
|
-
|
240241
|
-
|
240242
|
-
|
240255
|
+
}
|
240256
|
+
function fillSiteConfig(base5, filler) {
|
240257
|
+
return fillMissingKeys(base5, filler, Object.keys(filler));
|
240258
|
+
}
|
240259
|
+
function getValidatedConfigsFromFile(session, file, vfile2, stack) {
|
240260
|
+
var _a6, _b, _c;
|
240261
|
+
if (!vfile2) {
|
240262
|
+
vfile2 = new VFile();
|
240263
|
+
vfile2.path = file;
|
240264
|
+
}
|
240265
|
+
const opts = configValidationOpts(vfile2, "config", RuleId.validConfigStructure);
|
240266
|
+
const conf = validateObjectKeys(loadConfigYaml(file), {
|
240267
|
+
required: ["version"],
|
240268
|
+
optional: ["site", "project", "extend"],
|
240269
|
+
alias: { extends: "extend" }
|
240270
|
+
}, opts);
|
240271
|
+
if (conf && conf.version !== VERSION) {
|
240272
|
+
validationError(`"${conf.version}" does not match ${VERSION}`, incrementOptions("version", opts));
|
240243
240273
|
}
|
240244
240274
|
logMessagesFromVFile(session, vfile2);
|
240245
240275
|
if (!conf || opts.messages.errors) {
|
@@ -240262,22 +240292,83 @@ ${err.message}` : "";
|
|
240262
240292
|
const { logoText, ...rest } = conf.site;
|
240263
240293
|
conf.site = { logo_text: logoText, ...rest };
|
240264
240294
|
}
|
240265
|
-
|
240266
|
-
|
240295
|
+
let site;
|
240296
|
+
let project;
|
240297
|
+
const projectOpts = configValidationOpts(vfile2, "config.project", RuleId.validProjectConfig);
|
240298
|
+
let extend5;
|
240299
|
+
if (conf.extend) {
|
240300
|
+
extend5 = validateList(conf.extend, { coerce: true, ...incrementOptions("extend", opts) }, (item, index4) => {
|
240301
|
+
const relativeFile = validateString(item, incrementOptions(`extend.${index4}`, opts));
|
240302
|
+
if (!relativeFile)
|
240303
|
+
return relativeFile;
|
240304
|
+
return resolveToAbsolute(session, (0, import_node_path7.dirname)(file), relativeFile);
|
240305
|
+
});
|
240306
|
+
stack = [...stack !== null && stack !== void 0 ? stack : [], file];
|
240307
|
+
extend5 === null || extend5 === void 0 ? void 0 : extend5.forEach((extFile) => {
|
240308
|
+
if (stack === null || stack === void 0 ? void 0 : stack.includes(extFile)) {
|
240309
|
+
fileError(vfile2, 'Circular dependency encountered during "config.extend" resolution', {
|
240310
|
+
ruleId: RuleId.validConfigStructure,
|
240311
|
+
note: [...stack, extFile].map((f3) => resolveToRelative(session, ".", f3)).join(" > ")
|
240312
|
+
});
|
240313
|
+
return;
|
240314
|
+
}
|
240315
|
+
const { site: extSite, project: extProject } = getValidatedConfigsFromFile(session, extFile, vfile2, stack);
|
240316
|
+
session.store.dispatch(config.actions.receiveConfigExtension({ file: extFile }));
|
240317
|
+
if (extSite) {
|
240318
|
+
site = site ? fillSiteConfig(extSite, site) : extSite;
|
240319
|
+
}
|
240320
|
+
if (extProject) {
|
240321
|
+
project = project ? fillProjectFrontmatter(extProject, project, projectOpts) : extProject;
|
240322
|
+
}
|
240323
|
+
});
|
240324
|
+
}
|
240325
|
+
const { site: rawSite, project: rawProject } = conf !== null && conf !== void 0 ? conf : {};
|
240326
|
+
const path42 = (0, import_node_path7.dirname)(file);
|
240327
|
+
if (rawSite) {
|
240328
|
+
site = fillSiteConfig(validateSiteConfigAndThrow(session, path42, vfile2, rawSite), site !== null && site !== void 0 ? site : {});
|
240329
|
+
}
|
240267
240330
|
if (site) {
|
240268
|
-
validateSiteConfigAndSave(session, path42, vfile2, site);
|
240269
240331
|
session.log.debug(`Loaded site config from ${file}`);
|
240270
240332
|
} else {
|
240271
240333
|
session.log.debug(`No site config in ${file}`);
|
240272
240334
|
}
|
240335
|
+
if (rawProject) {
|
240336
|
+
project = fillProjectFrontmatter(validateProjectConfigAndThrow(session, path42, vfile2, rawProject), project !== null && project !== void 0 ? project : {}, projectOpts);
|
240337
|
+
}
|
240273
240338
|
if (project) {
|
240274
|
-
validateProjectConfigAndSave(session, path42, vfile2, project);
|
240275
240339
|
session.log.debug(`Loaded project config from ${file}`);
|
240276
240340
|
} else {
|
240277
240341
|
session.log.debug(`No project config defined in ${file}`);
|
240278
240342
|
}
|
240279
240343
|
logMessagesFromVFile(session, vfile2);
|
240280
|
-
return
|
240344
|
+
return { site, project, extend: extend5 };
|
240345
|
+
}
|
240346
|
+
function loadConfig(session, path42, opts) {
|
240347
|
+
const file = configFromPath(session, path42);
|
240348
|
+
if (!file) {
|
240349
|
+
session.log.debug(`No config loaded from path: ${path42}`);
|
240350
|
+
return;
|
240351
|
+
}
|
240352
|
+
const rawConf = loadConfigYaml(file);
|
240353
|
+
if (!(opts === null || opts === void 0 ? void 0 : opts.reloadProject)) {
|
240354
|
+
const existingConf = selectors_exports.selectLocalRawConfig(session.store.getState(), path42);
|
240355
|
+
if (existingConf && JSON.stringify(rawConf) === JSON.stringify(existingConf.raw)) {
|
240356
|
+
return existingConf.validated;
|
240357
|
+
}
|
240358
|
+
}
|
240359
|
+
const { site, project, extend: extend5 } = getValidatedConfigsFromFile(session, file);
|
240360
|
+
const validated = { ...rawConf, site, project, extend: extend5 };
|
240361
|
+
session.store.dispatch(config.actions.receiveRawConfig({
|
240362
|
+
path: path42,
|
240363
|
+
file,
|
240364
|
+
raw: rawConf,
|
240365
|
+
validated
|
240366
|
+
}));
|
240367
|
+
if (site)
|
240368
|
+
saveSiteConfig(session, path42, site);
|
240369
|
+
if (project)
|
240370
|
+
saveProjectConfig(session, path42, project);
|
240371
|
+
return validated;
|
240281
240372
|
}
|
240282
240373
|
function resolveToAbsolute(session, basePath, relativePath, checkExists = true) {
|
240283
240374
|
let message;
|
@@ -240346,45 +240437,29 @@ function resolveProjectConfigPaths(session, path42, projectConfig, resolutionFn)
|
|
240346
240437
|
}
|
240347
240438
|
return { ...projectConfig, ...resolvedFields };
|
240348
240439
|
}
|
240349
|
-
function
|
240350
|
-
|
240351
|
-
file: vfile2.path,
|
240352
|
-
property: "site",
|
240353
|
-
messages: {},
|
240354
|
-
errorLogFn: (message) => {
|
240355
|
-
fileError(vfile2, message, { ruleId: RuleId.validSiteConfig });
|
240356
|
-
},
|
240357
|
-
warningLogFn: (message) => {
|
240358
|
-
fileWarn(vfile2, message, { ruleId: RuleId.validSiteConfig });
|
240359
|
-
}
|
240360
|
-
});
|
240440
|
+
function validateSiteConfigAndThrow(session, path42, vfile2, rawSite) {
|
240441
|
+
const site = validateSiteConfig(rawSite, configValidationOpts(vfile2, "config.site", RuleId.validSiteConfig));
|
240361
240442
|
logMessagesFromVFile(session, vfile2);
|
240362
|
-
if (!
|
240443
|
+
if (!site) {
|
240363
240444
|
const errorSuffix = vfile2.path ? ` in ${vfile2.path}` : "";
|
240364
240445
|
throw Error(`Please address invalid site config${errorSuffix}`);
|
240365
240446
|
}
|
240366
|
-
|
240367
|
-
session.store.dispatch(config.actions.receiveSiteConfig({ path: path42, ...siteConfig }));
|
240447
|
+
return resolveSiteConfigPaths(session, path42, site, resolveToAbsolute);
|
240368
240448
|
}
|
240369
|
-
function
|
240370
|
-
|
240371
|
-
|
240372
|
-
|
240373
|
-
|
240374
|
-
errorLogFn: (message) => {
|
240375
|
-
fileError(vfile2, message, { ruleId: RuleId.validProjectConfig });
|
240376
|
-
},
|
240377
|
-
warningLogFn: (message) => {
|
240378
|
-
fileWarn(vfile2, message, { ruleId: RuleId.validProjectConfig });
|
240379
|
-
}
|
240380
|
-
});
|
240449
|
+
function saveSiteConfig(session, path42, site) {
|
240450
|
+
session.store.dispatch(config.actions.receiveSiteConfig({ path: path42, ...site }));
|
240451
|
+
}
|
240452
|
+
function validateProjectConfigAndThrow(session, path42, vfile2, rawProject) {
|
240453
|
+
const project = validateProjectConfig(rawProject, configValidationOpts(vfile2, "config.project", RuleId.validProjectConfig));
|
240381
240454
|
logMessagesFromVFile(session, vfile2);
|
240382
|
-
if (!
|
240455
|
+
if (!project) {
|
240383
240456
|
const errorSuffix = vfile2.path ? ` in ${vfile2.path}` : "";
|
240384
240457
|
throw Error(`Please address invalid project config${errorSuffix}`);
|
240385
240458
|
}
|
240386
|
-
|
240387
|
-
|
240459
|
+
return resolveProjectConfigPaths(session, path42, project, resolveToAbsolute);
|
240460
|
+
}
|
240461
|
+
function saveProjectConfig(session, path42, project) {
|
240462
|
+
session.store.dispatch(config.actions.receiveProjectConfig({ path: path42, ...project }));
|
240388
240463
|
}
|
240389
240464
|
function writeConfigs(session, path42, newConfigs) {
|
240390
240465
|
var _a6;
|
@@ -240392,14 +240467,16 @@ function writeConfigs(session, path42, newConfigs) {
|
|
240392
240467
|
const file = configFromPath(session, path42) || defaultConfigFile(session, path42);
|
240393
240468
|
const vfile2 = new VFile();
|
240394
240469
|
vfile2.path = file;
|
240395
|
-
if (siteConfig)
|
240396
|
-
|
240470
|
+
if (siteConfig) {
|
240471
|
+
saveSiteConfig(session, path42, validateSiteConfigAndThrow(session, path42, vfile2, siteConfig));
|
240472
|
+
}
|
240397
240473
|
siteConfig = selectors_exports.selectLocalSiteConfig(session.store.getState(), path42);
|
240398
240474
|
if (siteConfig) {
|
240399
240475
|
siteConfig = resolveSiteConfigPaths(session, path42, siteConfig, resolveToRelative);
|
240400
240476
|
}
|
240401
|
-
if (projectConfig)
|
240402
|
-
|
240477
|
+
if (projectConfig) {
|
240478
|
+
saveProjectConfig(session, path42, validateProjectConfigAndThrow(session, path42, vfile2, projectConfig));
|
240479
|
+
}
|
240403
240480
|
projectConfig = selectors_exports.selectLocalProjectConfig(session.store.getState(), path42);
|
240404
240481
|
if (projectConfig) {
|
240405
240482
|
projectConfig = prepareToWrite(projectConfig);
|
@@ -240409,8 +240486,7 @@ function writeConfigs(session, path42, newConfigs) {
|
|
240409
240486
|
session.log.debug(`No new config to write to ${file}`);
|
240410
240487
|
return;
|
240411
240488
|
}
|
240412
|
-
const
|
240413
|
-
const validatedRawConfig = (_a6 = rawConfig === null || rawConfig === void 0 ? void 0 : rawConfig.validated) !== null && _a6 !== void 0 ? _a6 : emptyConfig();
|
240489
|
+
const validatedRawConfig = (_a6 = loadConfig(session, path42)) !== null && _a6 !== void 0 ? _a6 : emptyConfig();
|
240414
240490
|
let logContent;
|
240415
240491
|
if (siteConfig && projectConfig) {
|
240416
240492
|
logContent = "site and project configs";
|
@@ -287405,7 +287481,7 @@ var import_node_path17 = __toESM(require("path"), 1);
|
|
287405
287481
|
var import_nbtx = __toESM(require_cjs2(), 1);
|
287406
287482
|
|
287407
287483
|
// ../myst-cli/dist/version.js
|
287408
|
-
var version2 = "1.2.
|
287484
|
+
var version2 = "1.2.4";
|
287409
287485
|
var version_default2 = version2;
|
287410
287486
|
|
287411
287487
|
// ../myst-cli/dist/utils/headers.js
|
@@ -295338,6 +295414,7 @@ async function loadProjectFromDisk(session, path42, opts) {
|
|
295338
295414
|
if (cachedProject)
|
295339
295415
|
return cachedProject;
|
295340
295416
|
}
|
295417
|
+
loadConfig(session, path42, opts);
|
295341
295418
|
const projectConfig = selectors_exports.selectLocalProjectConfig(session.store.getState(), path42);
|
295342
295419
|
const file = (0, import_node_path22.join)(path42, session.configFiles[0]);
|
295343
295420
|
if (!projectConfig && (opts === null || opts === void 0 ? void 0 : opts.warnOnNoConfig)) {
|
@@ -299437,7 +299514,7 @@ async function checkLinksTransform(session, file, mdast2) {
|
|
299437
299514
|
}
|
299438
299515
|
|
299439
299516
|
// ../myst-cli/dist/transforms/embed.js
|
299440
|
-
function mutateEmbedNode(node3, targetNode) {
|
299517
|
+
function mutateEmbedNode(node3, targetNode, opts) {
|
299441
299518
|
if (targetNode && node3["remove-output"]) {
|
299442
299519
|
targetNode = filter2(targetNode, (n) => {
|
299443
299520
|
var _a6;
|
@@ -299457,6 +299534,13 @@ function mutateEmbedNode(node3, targetNode) {
|
|
299457
299534
|
delete idNode.label;
|
299458
299535
|
delete idNode.html_id;
|
299459
299536
|
});
|
299537
|
+
selectAll("crossReference", targetNode).forEach((targetXRef) => {
|
299538
|
+
if (!targetXRef.remote) {
|
299539
|
+
targetXRef.url = opts === null || opts === void 0 ? void 0 : opts.url;
|
299540
|
+
targetXRef.dataUrl = opts === null || opts === void 0 ? void 0 : opts.dataUrl;
|
299541
|
+
targetXRef.remote = true;
|
299542
|
+
}
|
299543
|
+
});
|
299460
299544
|
if (!targetNode) {
|
299461
299545
|
node3.children = [];
|
299462
299546
|
} else if (targetNode.type === "block") {
|
@@ -299465,11 +299549,17 @@ function mutateEmbedNode(node3, targetNode) {
|
|
299465
299549
|
node3.children = [targetNode];
|
299466
299550
|
}
|
299467
299551
|
}
|
299552
|
+
function targetsToTarget(targets) {
|
299553
|
+
if (targets.length === 1)
|
299554
|
+
return copyNode(targets[0]);
|
299555
|
+
return { type: "block", children: copyNode(targets) };
|
299556
|
+
}
|
299468
299557
|
async function embedTransform(session, mdast2, file, dependencies, state) {
|
299469
|
-
const
|
299558
|
+
const references = Object.values(castSession(session).$externalReferences);
|
299559
|
+
const mystTransformer = new MystTransformer(references);
|
299470
299560
|
const embedNodes = selectAll("embed", mdast2);
|
299471
299561
|
await Promise.all(embedNodes.map(async (node3) => {
|
299472
|
-
var _a6, _b, _c, _d2, _e, _f, _g
|
299562
|
+
var _a6, _b, _c, _d2, _e, _f, _g;
|
299473
299563
|
const vfile2 = state.vfile;
|
299474
299564
|
const label = (_a6 = node3.source) === null || _a6 === void 0 ? void 0 : _a6.label;
|
299475
299565
|
if (!label) {
|
@@ -299478,10 +299568,14 @@ async function embedTransform(session, mdast2, file, dependencies, state) {
|
|
299478
299568
|
}
|
299479
299569
|
if (label.startsWith("xref:") || label.startsWith("myst:")) {
|
299480
299570
|
if (!mystTransformer.test(label)) {
|
299481
|
-
|
299482
|
-
|
299483
|
-
|
299484
|
-
|
299571
|
+
let note;
|
299572
|
+
const sphinxTransformer = new SphinxTransformer(references);
|
299573
|
+
if (sphinxTransformer.test(label)) {
|
299574
|
+
note = "Embed target must be a MyST project, not intersphinx.";
|
299575
|
+
} else {
|
299576
|
+
note = "Embed target must be a MyST project and included in your project references.";
|
299577
|
+
}
|
299578
|
+
fileError(vfile2, `Cannot embed "${label}"`, { node: node3, note });
|
299485
299579
|
return;
|
299486
299580
|
}
|
299487
299581
|
const referenceLink = {
|
@@ -299509,16 +299603,13 @@ async function embedTransform(session, mdast2, file, dependencies, state) {
|
|
299509
299603
|
return;
|
299510
299604
|
targetNodes2 = data.mdast.children;
|
299511
299605
|
}
|
299512
|
-
|
299606
|
+
if (!(targetNodes2 === null || targetNodes2 === void 0 ? void 0 : targetNodes2.length))
|
299607
|
+
return;
|
299608
|
+
const targetNode = targetsToTarget(targetNodes2);
|
299513
299609
|
selectAll("crossReference", targetNode).forEach((targetXRef) => {
|
299514
299610
|
if (targetXRef.remoteBaseUrl)
|
299515
299611
|
return;
|
299516
299612
|
targetXRef.remoteBaseUrl = referenceXRef.remoteBaseUrl;
|
299517
|
-
if (!targetXRef.remote) {
|
299518
|
-
targetXRef.url = referenceXRef.url;
|
299519
|
-
targetXRef.dataUrl = referenceXRef.dataUrl;
|
299520
|
-
targetXRef.remote = true;
|
299521
|
-
}
|
299522
299613
|
});
|
299523
299614
|
selectAll("link", targetNode).forEach((targetLink) => {
|
299524
299615
|
if (!targetLink.internal)
|
@@ -299534,7 +299625,7 @@ async function embedTransform(session, mdast2, file, dependencies, state) {
|
|
299534
299625
|
return;
|
299535
299626
|
target2.source.remoteBaseUrl = referenceXRef.remoteBaseUrl;
|
299536
299627
|
});
|
299537
|
-
mutateEmbedNode(node3, targetNode);
|
299628
|
+
mutateEmbedNode(node3, targetNode, referenceXRef);
|
299538
299629
|
const source3 = {
|
299539
299630
|
url: referenceXRef.url,
|
299540
299631
|
remoteBaseUrl: referenceXRef.remoteBaseUrl,
|
@@ -299585,12 +299676,13 @@ async function embedTransform(session, mdast2, file, dependencies, state) {
|
|
299585
299676
|
fileError(vfile2, `Embed target for "${label}" not found`, { node: node3 });
|
299586
299677
|
return;
|
299587
299678
|
}
|
299588
|
-
const target =
|
299589
|
-
|
299590
|
-
|
299591
|
-
if (!multiState.states)
|
299679
|
+
const target = targetsToTarget(targetNodes);
|
299680
|
+
if (!state.states) {
|
299681
|
+
mutateEmbedNode(node3, target);
|
299592
299682
|
return;
|
299593
|
-
|
299683
|
+
}
|
299684
|
+
const { url, dataUrl, filePath } = stateProvider;
|
299685
|
+
mutateEmbedNode(node3, target, { url, dataUrl });
|
299594
299686
|
if (!url)
|
299595
299687
|
return;
|
299596
299688
|
const source2 = { url, label };
|
@@ -299599,7 +299691,7 @@ async function embedTransform(session, mdast2, file, dependencies, state) {
|
|
299599
299691
|
path: file,
|
299600
299692
|
dependency: filePath
|
299601
299693
|
}));
|
299602
|
-
const { kind, slug, frontmatter, location: location4 } = (
|
299694
|
+
const { kind, slug, frontmatter, location: location4 } = (_g = selectFile(session, filePath)) !== null && _g !== void 0 ? _g : {};
|
299603
299695
|
if (kind)
|
299604
299696
|
source2.kind = kind;
|
299605
299697
|
if (slug)
|
@@ -300905,6 +300997,7 @@ async function postProcessMdast(session, { file, checkLinks, pageReferenceStates
|
|
300905
300997
|
const { mdast: mdast2, dependencies, frontmatter } = mdastPost;
|
300906
300998
|
const fileState = cache.$internalReferences[file];
|
300907
300999
|
const state = pageReferenceStates ? new MultiPageReferenceResolver(pageReferenceStates, file, vfile2) : fileState;
|
301000
|
+
const externalReferences = Object.values(cache.$externalReferences);
|
300908
301001
|
const transformers = [
|
300909
301002
|
...extraLinkTransformers || [],
|
300910
301003
|
new WikiTransformer(),
|
@@ -300913,8 +301006,8 @@ async function postProcessMdast(session, { file, checkLinks, pageReferenceStates
|
|
300913
301006
|
new RORTransformer(),
|
300914
301007
|
new DOITransformer(),
|
300915
301008
|
// This also is picked up in the next transform
|
300916
|
-
new MystTransformer(
|
300917
|
-
new SphinxTransformer(
|
301009
|
+
new MystTransformer(externalReferences),
|
301010
|
+
new SphinxTransformer(externalReferences),
|
300918
301011
|
new StaticFileTransformer(session, file)
|
300919
301012
|
// Links static files and internally linked files
|
300920
301013
|
];
|
@@ -300935,7 +301028,7 @@ async function postProcessMdast(session, { file, checkLinks, pageReferenceStates
|
|
300935
301028
|
});
|
300936
301029
|
await pipe.run(mdast2, vfile2);
|
300937
301030
|
keysTransform(mdast2);
|
300938
|
-
checkLinkTextTransform(mdast2, vfile2);
|
301031
|
+
checkLinkTextTransform(mdast2, externalReferences, vfile2);
|
300939
301032
|
logMessagesFromVFile(session, fileState.vfile);
|
300940
301033
|
logMessagesFromVFile(session, vfile2);
|
300941
301034
|
log.debug(toc(`Transformed mdast cross references and links for "${file}" in %s`));
|
@@ -313315,9 +313408,11 @@ var import_chokidar2 = __toESM(require_chokidar(), 1);
|
|
313315
313408
|
var import_node_path53 = require("path");
|
313316
313409
|
function watchConfigAndPublic(session, serverReload, opts) {
|
313317
313410
|
const watchFiles = ["public"];
|
313318
|
-
const
|
313411
|
+
const state = session.store.getState();
|
313412
|
+
const siteConfigFile = selectors_exports.selectCurrentSiteFile(state);
|
313319
313413
|
if (siteConfigFile)
|
313320
313414
|
watchFiles.push(siteConfigFile);
|
313415
|
+
watchFiles.push(...selectors_exports.selectConfigExtensions(state));
|
313321
313416
|
return import_chokidar2.default.watch(watchFiles, {
|
313322
313417
|
ignoreInitial: true,
|
313323
313418
|
awaitWriteFinish: { stabilityThreshold: 100, pollInterval: 50 }
|
@@ -313326,6 +313421,8 @@ function watchConfigAndPublic(session, serverReload, opts) {
|
|
313326
313421
|
function triggerProjectReload(session, file, eventType, projectPath) {
|
313327
313422
|
const state = session.store.getState();
|
313328
313423
|
const projectConfigFile = projectPath ? selectors_exports.selectLocalConfigFile(state, projectPath) : selectors_exports.selectCurrentProjectFile(state);
|
313424
|
+
if (selectors_exports.selectConfigExtensions(state).includes(file))
|
313425
|
+
return true;
|
313329
313426
|
if (file === projectConfigFile || (0, import_node_path53.basename)(file) === "_toc.yml")
|
313330
313427
|
return true;
|
313331
313428
|
if (["add", "unlink"].includes(eventType))
|
@@ -313333,6 +313430,7 @@ function triggerProjectReload(session, file, eventType, projectPath) {
|
|
313333
313430
|
return false;
|
313334
313431
|
}
|
313335
313432
|
async function processorFn(session, file, eventType, siteProject, serverReload, opts) {
|
313433
|
+
var _a6;
|
313336
313434
|
if (file) {
|
313337
313435
|
changeFile(session, file, eventType);
|
313338
313436
|
if (KNOWN_FAST_BUILDS.has((0, import_node_path53.extname)(file)) && eventType === "unlink") {
|
@@ -313340,8 +313438,8 @@ async function processorFn(session, file, eventType, siteProject, serverReload,
|
|
313340
313438
|
}
|
313341
313439
|
}
|
313342
313440
|
if (!siteProject || !file || !KNOWN_FAST_BUILDS.has((0, import_node_path53.extname)(file)) || ["add", "unlink"].includes(eventType)) {
|
313343
|
-
let reloadProject = false;
|
313344
|
-
if (file && triggerProjectReload(session, file, eventType, siteProject === null || siteProject === void 0 ? void 0 : siteProject.path)) {
|
313441
|
+
let reloadProject = (_a6 = opts === null || opts === void 0 ? void 0 : opts.reloadProject) !== null && _a6 !== void 0 ? _a6 : false;
|
313442
|
+
if (reloadProject || file && triggerProjectReload(session, file, eventType, siteProject === null || siteProject === void 0 ? void 0 : siteProject.path)) {
|
313345
313443
|
session.log.info("\u{1F4A5} Triggered full project load and site rebuild");
|
313346
313444
|
reloadProject = true;
|
313347
313445
|
} else {
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|