mystmd 1.2.1__py3-none-any.whl → 1.2.3__py3-none-any.whl
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.1.dist-info → mystmd-1.2.3.dist-info}/METADATA +1 -1
- mystmd-1.2.3.dist-info/RECORD +8 -0
- mystmd_py/myst.cjs +1261 -847
- mystmd-1.2.1.dist-info/RECORD +0 -8
- {mystmd-1.2.1.dist-info → mystmd-1.2.3.dist-info}/WHEEL +0 -0
- {mystmd-1.2.1.dist-info → mystmd-1.2.3.dist-info}/entry_points.txt +0 -0
- {mystmd-1.2.1.dist-info → mystmd-1.2.3.dist-info}/licenses/LICENSE +0 -0
mystmd_py/myst.cjs
CHANGED
@@ -884,7 +884,7 @@ var require_make_built_in = __commonJS({
|
|
884
884
|
var defineProperty = Object.defineProperty;
|
885
885
|
var stringSlice = uncurryThis("".slice);
|
886
886
|
var replace = uncurryThis("".replace);
|
887
|
-
var
|
887
|
+
var join19 = uncurryThis([].join);
|
888
888
|
var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails(function() {
|
889
889
|
return defineProperty(function() {
|
890
890
|
}, "length", { value: 8 }).length !== 8;
|
@@ -917,7 +917,7 @@ var require_make_built_in = __commonJS({
|
|
917
917
|
}
|
918
918
|
var state = enforceInternalState(value);
|
919
919
|
if (!hasOwn(state, "source")) {
|
920
|
-
state.source =
|
920
|
+
state.source = join19(TEMPLATE, typeof name3 == "string" ? name3 : "");
|
921
921
|
}
|
922
922
|
return value;
|
923
923
|
};
|
@@ -3920,7 +3920,7 @@ var require_es_array_join = __commonJS({
|
|
3920
3920
|
var ES3_STRINGS = IndexedObject != Object;
|
3921
3921
|
var FORCED = ES3_STRINGS || !arrayMethodIsStrict("join", ",");
|
3922
3922
|
$2({ target: "Array", proto: true, forced: FORCED }, {
|
3923
|
-
join: function
|
3923
|
+
join: function join19(separator) {
|
3924
3924
|
return nativeJoin(toIndexedObject(this), separator === void 0 ? "," : separator);
|
3925
3925
|
}
|
3926
3926
|
});
|
@@ -5796,13 +5796,13 @@ var require_function_bind = __commonJS({
|
|
5796
5796
|
var NATIVE_BIND = require_function_bind_native();
|
5797
5797
|
var $Function = Function;
|
5798
5798
|
var concat2 = uncurryThis([].concat);
|
5799
|
-
var
|
5799
|
+
var join19 = uncurryThis([].join);
|
5800
5800
|
var factories = {};
|
5801
5801
|
var construct = function(C, argsLength, args) {
|
5802
5802
|
if (!hasOwn(factories, argsLength)) {
|
5803
5803
|
for (var list6 = [], i2 = 0; i2 < argsLength; i2++)
|
5804
5804
|
list6[i2] = "a[" + i2 + "]";
|
5805
|
-
factories[argsLength] = $Function("C,a", "return new C(" +
|
5805
|
+
factories[argsLength] = $Function("C,a", "return new C(" + join19(list6, ",") + ")");
|
5806
5806
|
}
|
5807
5807
|
return factories[argsLength](C, args);
|
5808
5808
|
};
|
@@ -9991,7 +9991,7 @@ var require_es_string_from_code_point = __commonJS({
|
|
9991
9991
|
var $RangeError = RangeError;
|
9992
9992
|
var fromCharCode = String.fromCharCode;
|
9993
9993
|
var $fromCodePoint = String.fromCodePoint;
|
9994
|
-
var
|
9994
|
+
var join19 = uncurryThis([].join);
|
9995
9995
|
var INCORRECT_LENGTH = !!$fromCodePoint && $fromCodePoint.length != 1;
|
9996
9996
|
$2({ target: "String", stat: true, arity: 1, forced: INCORRECT_LENGTH }, {
|
9997
9997
|
// eslint-disable-next-line no-unused-vars -- required for `.length`
|
@@ -10006,7 +10006,7 @@ var require_es_string_from_code_point = __commonJS({
|
|
10006
10006
|
throw $RangeError(code7 + " is not a valid code point");
|
10007
10007
|
elements[i2] = code7 < 65536 ? fromCharCode(code7) : fromCharCode(((code7 -= 65536) >> 10) + 55296, code7 % 1024 + 56320);
|
10008
10008
|
}
|
10009
|
-
return
|
10009
|
+
return join19(elements, "");
|
10010
10010
|
}
|
10011
10011
|
});
|
10012
10012
|
}
|
@@ -10397,7 +10397,7 @@ var require_es_string_raw = __commonJS({
|
|
10397
10397
|
var toString6 = require_to_string();
|
10398
10398
|
var lengthOfArrayLike = require_length_of_array_like();
|
10399
10399
|
var push = uncurryThis([].push);
|
10400
|
-
var
|
10400
|
+
var join19 = uncurryThis([].join);
|
10401
10401
|
$2({ target: "String", stat: true }, {
|
10402
10402
|
raw: function raw2(template) {
|
10403
10403
|
var rawTemplate = toIndexedObject(toObject(template).raw);
|
@@ -10410,7 +10410,7 @@ var require_es_string_raw = __commonJS({
|
|
10410
10410
|
while (true) {
|
10411
10411
|
push(elements, toString6(rawTemplate[i2++]));
|
10412
10412
|
if (i2 === literalSegments)
|
10413
|
-
return
|
10413
|
+
return join19(elements, "");
|
10414
10414
|
if (i2 < argumentsLength)
|
10415
10415
|
push(elements, toString6(arguments[i2]));
|
10416
10416
|
}
|
@@ -10940,7 +10940,7 @@ var require_es_string_to_well_formed = __commonJS({
|
|
10940
10940
|
var $Array = Array;
|
10941
10941
|
var charAt = uncurryThis("".charAt);
|
10942
10942
|
var charCodeAt = uncurryThis("".charCodeAt);
|
10943
|
-
var
|
10943
|
+
var join19 = uncurryThis([].join);
|
10944
10944
|
var $toWellFormed = "".toWellFormed;
|
10945
10945
|
var REPLACEMENT_CHARACTER2 = "\uFFFD";
|
10946
10946
|
var TO_STRING_CONVERSION_BUG = $toWellFormed && fails(function() {
|
@@ -10964,7 +10964,7 @@ var require_es_string_to_well_formed = __commonJS({
|
|
10964
10964
|
result[++i2] = charAt(S3, i2);
|
10965
10965
|
}
|
10966
10966
|
}
|
10967
|
-
return
|
10967
|
+
return join19(result, "");
|
10968
10968
|
}
|
10969
10969
|
});
|
10970
10970
|
}
|
@@ -12021,7 +12021,7 @@ var require_es_typed_array_join = __commonJS({
|
|
12021
12021
|
var aTypedArray = ArrayBufferViewCore.aTypedArray;
|
12022
12022
|
var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
|
12023
12023
|
var $join = uncurryThis([].join);
|
12024
|
-
exportTypedArrayMethod("join", function
|
12024
|
+
exportTypedArrayMethod("join", function join19(separator) {
|
12025
12025
|
return $join(aTypedArray(this), separator);
|
12026
12026
|
});
|
12027
12027
|
}
|
@@ -12392,12 +12392,12 @@ var require_es_typed_array_to_string = __commonJS({
|
|
12392
12392
|
var Uint8Array2 = global2.Uint8Array;
|
12393
12393
|
var Uint8ArrayPrototype = Uint8Array2 && Uint8Array2.prototype || {};
|
12394
12394
|
var arrayToString = [].toString;
|
12395
|
-
var
|
12395
|
+
var join19 = uncurryThis([].join);
|
12396
12396
|
if (fails(function() {
|
12397
12397
|
arrayToString.call({});
|
12398
12398
|
})) {
|
12399
12399
|
arrayToString = function toString6() {
|
12400
|
-
return
|
12400
|
+
return join19(this);
|
12401
12401
|
};
|
12402
12402
|
}
|
12403
12403
|
var IS_NOT_ARRAY_METHOD = Uint8ArrayPrototype.toString != arrayToString;
|
@@ -13419,12 +13419,12 @@ var require_structured_clone_proper_transfer = __commonJS({
|
|
13419
13419
|
var IS_BROWSER = require_engine_is_browser();
|
13420
13420
|
var IS_DENO = require_engine_is_deno();
|
13421
13421
|
var IS_NODE = require_engine_is_node();
|
13422
|
-
var
|
13423
|
-
module2.exports = !!
|
13422
|
+
var structuredClone2 = global2.structuredClone;
|
13423
|
+
module2.exports = !!structuredClone2 && !fails(function() {
|
13424
13424
|
if (IS_DENO && V8 > 92 || IS_NODE && V8 > 94 || IS_BROWSER && V8 > 97)
|
13425
13425
|
return false;
|
13426
13426
|
var buffer2 = new ArrayBuffer(8);
|
13427
|
-
var clone4 =
|
13427
|
+
var clone4 = structuredClone2(buffer2, { transfer: [buffer2] });
|
13428
13428
|
return buffer2.byteLength != 0 || clone4.byteLength != 8;
|
13429
13429
|
});
|
13430
13430
|
}
|
@@ -13983,7 +13983,7 @@ var require_web_structured_clone = __commonJS({
|
|
13983
13983
|
}
|
13984
13984
|
};
|
13985
13985
|
$2({ global: true, enumerable: true, sham: !PROPER_TRANSFER, forced: FORCED_REPLACEMENT }, {
|
13986
|
-
structuredClone: function
|
13986
|
+
structuredClone: function structuredClone2(value) {
|
13987
13987
|
var options = validateArgumentsLength(arguments.length, 1) > 1 && !isNullOrUndefined(arguments[1]) ? anObject(arguments[1]) : void 0;
|
13988
13988
|
var transfer = options ? options.transfer : void 0;
|
13989
13989
|
var transferredBuffers = false;
|
@@ -14085,7 +14085,7 @@ var require_string_punycode_to_ascii = __commonJS({
|
|
14085
14085
|
var floor = Math.floor;
|
14086
14086
|
var fromCharCode = String.fromCharCode;
|
14087
14087
|
var charCodeAt = uncurryThis("".charCodeAt);
|
14088
|
-
var
|
14088
|
+
var join19 = uncurryThis([].join);
|
14089
14089
|
var push = uncurryThis([].push);
|
14090
14090
|
var replace = uncurryThis("".replace);
|
14091
14091
|
var split2 = uncurryThis("".split);
|
@@ -14183,7 +14183,7 @@ var require_string_punycode_to_ascii = __commonJS({
|
|
14183
14183
|
delta++;
|
14184
14184
|
n++;
|
14185
14185
|
}
|
14186
|
-
return
|
14186
|
+
return join19(output2, "");
|
14187
14187
|
};
|
14188
14188
|
module2.exports = function(input3) {
|
14189
14189
|
var encoded = [];
|
@@ -14193,7 +14193,7 @@ var require_string_punycode_to_ascii = __commonJS({
|
|
14193
14193
|
label = labels[i2];
|
14194
14194
|
push(encoded, exec3(regexNonASCII, label) ? "xn--" + encode(label) : label);
|
14195
14195
|
}
|
14196
|
-
return
|
14196
|
+
return join19(encoded, ".");
|
14197
14197
|
};
|
14198
14198
|
}
|
14199
14199
|
});
|
@@ -14253,7 +14253,7 @@ var require_web_url_search_params_constructor = __commonJS({
|
|
14253
14253
|
var decodeURIComponent2 = global2.decodeURIComponent;
|
14254
14254
|
var encodeURIComponent2 = global2.encodeURIComponent;
|
14255
14255
|
var charAt = uncurryThis("".charAt);
|
14256
|
-
var
|
14256
|
+
var join19 = uncurryThis([].join);
|
14257
14257
|
var push = uncurryThis([].push);
|
14258
14258
|
var replace = uncurryThis("".replace);
|
14259
14259
|
var shift = uncurryThis([].shift);
|
@@ -14361,7 +14361,7 @@ var require_web_url_search_params_constructor = __commonJS({
|
|
14361
14361
|
entry = split2(attribute2, "=");
|
14362
14362
|
push(this.entries, {
|
14363
14363
|
key: deserialize(shift(entry)),
|
14364
|
-
value: deserialize(
|
14364
|
+
value: deserialize(join19(entry, "="))
|
14365
14365
|
});
|
14366
14366
|
}
|
14367
14367
|
}
|
@@ -14376,7 +14376,7 @@ var require_web_url_search_params_constructor = __commonJS({
|
|
14376
14376
|
entry = entries2[index4++];
|
14377
14377
|
push(result, serialize3(entry.key) + "=" + serialize3(entry.value));
|
14378
14378
|
}
|
14379
|
-
return
|
14379
|
+
return join19(result, "&");
|
14380
14380
|
},
|
14381
14381
|
update: function() {
|
14382
14382
|
this.entries.length = 0;
|
@@ -14635,7 +14635,7 @@ var require_web_url_constructor = __commonJS({
|
|
14635
14635
|
var pow = Math.pow;
|
14636
14636
|
var charAt = uncurryThis("".charAt);
|
14637
14637
|
var exec3 = uncurryThis(/./.exec);
|
14638
|
-
var
|
14638
|
+
var join19 = uncurryThis([].join);
|
14639
14639
|
var numberToString = uncurryThis(1 .toString);
|
14640
14640
|
var pop = uncurryThis([].pop);
|
14641
14641
|
var push = uncurryThis([].push);
|
@@ -14828,7 +14828,7 @@ var require_web_url_constructor = __commonJS({
|
|
14828
14828
|
unshift(result, host % 256);
|
14829
14829
|
host = floor(host / 256);
|
14830
14830
|
}
|
14831
|
-
return
|
14831
|
+
return join19(result, ".");
|
14832
14832
|
} else if (typeof host == "object") {
|
14833
14833
|
result = "";
|
14834
14834
|
compress = findLongestZeroSequence(host);
|
@@ -15219,7 +15219,7 @@ var require_web_url_constructor = __commonJS({
|
|
15219
15219
|
url.fragment = "";
|
15220
15220
|
state = FRAGMENT;
|
15221
15221
|
} else {
|
15222
|
-
if (!startsWithWindowsDriveLetter(
|
15222
|
+
if (!startsWithWindowsDriveLetter(join19(arraySlice(codePoints, pointer), ""))) {
|
15223
15223
|
url.host = base5.host;
|
15224
15224
|
url.path = arraySlice(base5.path);
|
15225
15225
|
url.shortenPath();
|
@@ -15237,7 +15237,7 @@ var require_web_url_constructor = __commonJS({
|
|
15237
15237
|
state = FILE_HOST;
|
15238
15238
|
break;
|
15239
15239
|
}
|
15240
|
-
if (base5 && base5.scheme == "file" && !startsWithWindowsDriveLetter(
|
15240
|
+
if (base5 && base5.scheme == "file" && !startsWithWindowsDriveLetter(join19(arraySlice(codePoints, pointer), ""))) {
|
15241
15241
|
if (isWindowsDriveLetter(base5.path[0], true))
|
15242
15242
|
push(url.path, base5.path[0]);
|
15243
15243
|
else
|
@@ -15425,7 +15425,7 @@ var require_web_url_constructor = __commonJS({
|
|
15425
15425
|
output2 += ":" + port;
|
15426
15426
|
} else if (scheme == "file")
|
15427
15427
|
output2 += "//";
|
15428
|
-
output2 += url.cannotBeABaseURL ? path42[0] : path42.length ? "/" +
|
15428
|
+
output2 += url.cannotBeABaseURL ? path42[0] : path42.length ? "/" + join19(path42, "/") : "";
|
15429
15429
|
if (query !== null)
|
15430
15430
|
output2 += "?" + query;
|
15431
15431
|
if (fragment !== null)
|
@@ -15524,7 +15524,7 @@ var require_web_url_constructor = __commonJS({
|
|
15524
15524
|
// https://url.spec.whatwg.org/#dom-url-pathname
|
15525
15525
|
getPathname: function() {
|
15526
15526
|
var path42 = this.path;
|
15527
|
-
return this.cannotBeABaseURL ? path42[0] : path42.length ? "/" +
|
15527
|
+
return this.cannotBeABaseURL ? path42[0] : path42.length ? "/" + join19(path42, "/") : "";
|
15528
15528
|
},
|
15529
15529
|
setPathname: function(pathname) {
|
15530
15530
|
if (this.cannotBeABaseURL)
|
@@ -16712,7 +16712,7 @@ var require_array_buffer_transfer = __commonJS({
|
|
16712
16712
|
var arrayBufferByteLength = require_array_buffer_byte_length();
|
16713
16713
|
var PROPER_TRANSFER = require_structured_clone_proper_transfer();
|
16714
16714
|
var TypeError2 = global2.TypeError;
|
16715
|
-
var
|
16715
|
+
var structuredClone2 = global2.structuredClone;
|
16716
16716
|
var ArrayBuffer2 = global2.ArrayBuffer;
|
16717
16717
|
var DataView2 = global2.DataView;
|
16718
16718
|
var min = Math.min;
|
@@ -16729,7 +16729,7 @@ var require_array_buffer_transfer = __commonJS({
|
|
16729
16729
|
var fixedLength = !isResizable || !isResizable(arrayBuffer);
|
16730
16730
|
if (isDetached(arrayBuffer))
|
16731
16731
|
throw TypeError2("ArrayBuffer is detached");
|
16732
|
-
var newBuffer =
|
16732
|
+
var newBuffer = structuredClone2(arrayBuffer, { transfer: [arrayBuffer] });
|
16733
16733
|
if (byteLength2 == newByteLength && (preserveResizability || fixedLength))
|
16734
16734
|
return newBuffer;
|
16735
16735
|
if (byteLength2 >= newByteLength && (!preserveResizability || fixedLength))
|
@@ -44282,7 +44282,7 @@ var require_util2 = __commonJS({
|
|
44282
44282
|
return path42;
|
44283
44283
|
});
|
44284
44284
|
exports2.normalize = normalize6;
|
44285
|
-
function
|
44285
|
+
function join19(aRoot, aPath) {
|
44286
44286
|
if (aRoot === "") {
|
44287
44287
|
aRoot = ".";
|
44288
44288
|
}
|
@@ -44314,7 +44314,7 @@ var require_util2 = __commonJS({
|
|
44314
44314
|
}
|
44315
44315
|
return joined;
|
44316
44316
|
}
|
44317
|
-
exports2.join =
|
44317
|
+
exports2.join = join19;
|
44318
44318
|
exports2.isAbsolute = function(aPath) {
|
44319
44319
|
return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
|
44320
44320
|
};
|
@@ -44528,7 +44528,7 @@ var require_util2 = __commonJS({
|
|
44528
44528
|
parsed.path = parsed.path.substring(0, index4 + 1);
|
44529
44529
|
}
|
44530
44530
|
}
|
44531
|
-
sourceURL =
|
44531
|
+
sourceURL = join19(urlGenerate(parsed), sourceURL);
|
44532
44532
|
}
|
44533
44533
|
return normalize6(sourceURL);
|
44534
44534
|
}
|
@@ -45976,7 +45976,7 @@ var require_previous_map = __commonJS({
|
|
45976
45976
|
"use strict";
|
45977
45977
|
var { SourceMapConsumer, SourceMapGenerator } = require_source_map();
|
45978
45978
|
var { existsSync: existsSync2, readFileSync: readFileSync2 } = require("fs");
|
45979
|
-
var { dirname:
|
45979
|
+
var { dirname: dirname7, join: join19 } = require("path");
|
45980
45980
|
function fromBase64(str2) {
|
45981
45981
|
if (Buffer) {
|
45982
45982
|
return Buffer.from(str2, "base64").toString();
|
@@ -45996,7 +45996,7 @@ var require_previous_map = __commonJS({
|
|
45996
45996
|
this.mapFile = opts.from;
|
45997
45997
|
}
|
45998
45998
|
if (this.mapFile)
|
45999
|
-
this.root =
|
45999
|
+
this.root = dirname7(this.mapFile);
|
46000
46000
|
if (text7)
|
46001
46001
|
this.text = text7;
|
46002
46002
|
}
|
@@ -46039,7 +46039,7 @@ var require_previous_map = __commonJS({
|
|
46039
46039
|
}
|
46040
46040
|
}
|
46041
46041
|
loadFile(path42) {
|
46042
|
-
this.root =
|
46042
|
+
this.root = dirname7(path42);
|
46043
46043
|
if (existsSync2(path42)) {
|
46044
46044
|
this.mapFile = path42;
|
46045
46045
|
return readFileSync2(path42, "utf-8").toString().trim();
|
@@ -46078,7 +46078,7 @@ var require_previous_map = __commonJS({
|
|
46078
46078
|
} else if (this.annotation) {
|
46079
46079
|
let map14 = this.annotation;
|
46080
46080
|
if (file)
|
46081
|
-
map14 =
|
46081
|
+
map14 = join19(dirname7(file), map14);
|
46082
46082
|
return this.loadFile(map14);
|
46083
46083
|
}
|
46084
46084
|
}
|
@@ -46314,11 +46314,11 @@ var require_map_generator = __commonJS({
|
|
46314
46314
|
"../../node_modules/postcss/lib/map-generator.js"(exports2, module2) {
|
46315
46315
|
"use strict";
|
46316
46316
|
var { SourceMapConsumer, SourceMapGenerator } = require_source_map();
|
46317
|
-
var { dirname:
|
46317
|
+
var { dirname: dirname7, relative: relative4, resolve: resolve7, sep: sep5 } = require("path");
|
46318
46318
|
var { pathToFileURL } = require("url");
|
46319
46319
|
var Input = require_input4();
|
46320
46320
|
var sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
|
46321
|
-
var pathAvailable = Boolean(
|
46321
|
+
var pathAvailable = Boolean(dirname7 && resolve7 && relative4 && sep5);
|
46322
46322
|
var MapGenerator = class {
|
46323
46323
|
constructor(stringify4, root6, opts, cssString) {
|
46324
46324
|
this.stringify = stringify4;
|
@@ -46351,7 +46351,7 @@ var require_map_generator = __commonJS({
|
|
46351
46351
|
applyPrevMaps() {
|
46352
46352
|
for (let prev of this.previous()) {
|
46353
46353
|
let from4 = this.toUrl(this.path(prev.file));
|
46354
|
-
let root6 = prev.root ||
|
46354
|
+
let root6 = prev.root || dirname7(prev.file);
|
46355
46355
|
let map14;
|
46356
46356
|
if (this.mapOpts.sourcesContent === false) {
|
46357
46357
|
map14 = new SourceMapConsumer(prev.text);
|
@@ -46539,9 +46539,9 @@ var require_map_generator = __commonJS({
|
|
46539
46539
|
let cached = this.memoizedPaths.get(file);
|
46540
46540
|
if (cached)
|
46541
46541
|
return cached;
|
46542
|
-
let from4 = this.opts.to ?
|
46542
|
+
let from4 = this.opts.to ? dirname7(this.opts.to) : ".";
|
46543
46543
|
if (typeof this.mapOpts.annotation === "string") {
|
46544
|
-
from4 =
|
46544
|
+
from4 = dirname7(resolve7(from4, this.mapOpts.annotation));
|
46545
46545
|
}
|
46546
46546
|
let path42 = relative4(from4, file);
|
46547
46547
|
this.memoizedPaths.set(file, path42);
|
@@ -66213,19 +66213,19 @@ var require_citeproc_commonjs = __commonJS({
|
|
66213
66213
|
for (var i3 = 0, ilen2 = this.variables.length; i3 < ilen2; i3++) {
|
66214
66214
|
var variable = this.variables[i3];
|
66215
66215
|
if (["authority", "committee"].indexOf(variable) > -1 && "string" === typeof Item[variable] && "names" === this.name) {
|
66216
|
-
var
|
66216
|
+
var isValid3 = true;
|
66217
66217
|
var rawNames = Item[variable].split(/\s*;\s*/);
|
66218
66218
|
var rawMultiNames = {};
|
66219
66219
|
if (Item.multi && Item.multi._keys[variable]) {
|
66220
66220
|
for (var langTag in Item.multi._keys[variable]) {
|
66221
66221
|
rawMultiNames[langTag] = Item.multi._keys[variable][langTag].split(/\s*;\s*/);
|
66222
66222
|
if (rawMultiNames[langTag].length !== rawNames.length) {
|
66223
|
-
|
66223
|
+
isValid3 = false;
|
66224
66224
|
break;
|
66225
66225
|
}
|
66226
66226
|
}
|
66227
66227
|
}
|
66228
|
-
if (!
|
66228
|
+
if (!isValid3) {
|
66229
66229
|
rawNames = [Item[variable]];
|
66230
66230
|
rawMultiNames = Item.multi._keys[variable];
|
66231
66231
|
}
|
@@ -91378,7 +91378,7 @@ var require_isexe = __commonJS({
|
|
91378
91378
|
var require_lib15 = __commonJS({
|
91379
91379
|
"../../node_modules/which/lib/index.js"(exports2, module2) {
|
91380
91380
|
var isexe = require_isexe();
|
91381
|
-
var { join:
|
91381
|
+
var { join: join19, delimiter: delimiter2, sep: sep5, posix: posix2 } = require("path");
|
91382
91382
|
var isWindows = process.platform === "win32";
|
91383
91383
|
var rSlash = new RegExp(`[${posix2.sep}${sep5 === posix2.sep ? "" : sep5}]`.replace(/(\\)/g, "\\$1"));
|
91384
91384
|
var rRel = new RegExp(`^\\.${rSlash.source}`);
|
@@ -91411,7 +91411,7 @@ var require_lib15 = __commonJS({
|
|
91411
91411
|
var getPathPart = (raw2, cmd) => {
|
91412
91412
|
const pathPart = /^".*"$/.test(raw2) ? raw2.slice(1, -1) : raw2;
|
91413
91413
|
const prefix2 = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
|
91414
|
-
return prefix2 +
|
91414
|
+
return prefix2 + join19(pathPart, cmd);
|
91415
91415
|
};
|
91416
91416
|
var which6 = async (cmd, opt = {}) => {
|
91417
91417
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
@@ -95906,14 +95906,14 @@ var require_node_domexception = __commonJS({
|
|
95906
95906
|
});
|
95907
95907
|
|
95908
95908
|
// ../../node_modules/fetch-blob/from.js
|
95909
|
-
var
|
95909
|
+
var import_node_fs17, import_node_domexception, stat, _path2, _start, _BlobDataItem, BlobDataItem;
|
95910
95910
|
var init_from = __esm({
|
95911
95911
|
"../../node_modules/fetch-blob/from.js"() {
|
95912
|
-
|
95912
|
+
import_node_fs17 = require("fs");
|
95913
95913
|
import_node_domexception = __toESM(require_node_domexception(), 1);
|
95914
95914
|
init_file();
|
95915
95915
|
init_fetch_blob();
|
95916
|
-
({ stat } =
|
95916
|
+
({ stat } = import_node_fs17.promises);
|
95917
95917
|
_BlobDataItem = class {
|
95918
95918
|
constructor(options) {
|
95919
95919
|
__privateAdd(this, _path2, void 0);
|
@@ -95940,7 +95940,7 @@ var init_from = __esm({
|
|
95940
95940
|
if (mtimeMs > this.lastModified) {
|
95941
95941
|
throw new import_node_domexception.default("The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.", "NotReadableError");
|
95942
95942
|
}
|
95943
|
-
yield* (0,
|
95943
|
+
yield* (0, import_node_fs17.createReadStream)(__privateGet(this, _path2), {
|
95944
95944
|
start: __privateGet(this, _start),
|
95945
95945
|
end: __privateGet(this, _start) + this.size - 1
|
95946
95946
|
});
|
@@ -98082,8 +98082,8 @@ var require_adm_zip = __commonJS({
|
|
98082
98082
|
return null;
|
98083
98083
|
}
|
98084
98084
|
function fixPath(zipPath) {
|
98085
|
-
const { join:
|
98086
|
-
return
|
98085
|
+
const { join: join19, normalize: normalize6, sep: sep5 } = pth.posix;
|
98086
|
+
return join19(".", normalize6(sep5 + zipPath.split("\\").join(sep5) + sep5));
|
98087
98087
|
}
|
98088
98088
|
return {
|
98089
98089
|
/**
|
@@ -98976,7 +98976,7 @@ var require_cjs3 = __commonJS({
|
|
98976
98976
|
var require_lib16 = __commonJS({
|
98977
98977
|
"../myst-execute/node_modules/which/lib/index.js"(exports2, module2) {
|
98978
98978
|
var { isexe, sync: isexeSync } = require_cjs3();
|
98979
|
-
var { join:
|
98979
|
+
var { join: join19, delimiter: delimiter2, sep: sep5, posix: posix2 } = require("path");
|
98980
98980
|
var isWindows = process.platform === "win32";
|
98981
98981
|
var rSlash = new RegExp(`[${posix2.sep}${sep5 === posix2.sep ? "" : sep5}]`.replace(/(\\)/g, "\\$1"));
|
98982
98982
|
var rRel = new RegExp(`^\\.${rSlash.source}`);
|
@@ -99005,7 +99005,7 @@ var require_lib16 = __commonJS({
|
|
99005
99005
|
var getPathPart = (raw2, cmd) => {
|
99006
99006
|
const pathPart = /^".*"$/.test(raw2) ? raw2.slice(1, -1) : raw2;
|
99007
99007
|
const prefix2 = !pathPart && rRel.test(cmd) ? cmd.slice(0, 2) : "";
|
99008
|
-
return prefix2 +
|
99008
|
+
return prefix2 + join19(pathPart, cmd);
|
99009
99009
|
};
|
99010
99010
|
var which6 = async (cmd, opt = {}) => {
|
99011
99011
|
const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
|
@@ -102799,9 +102799,9 @@ var require_nodefs_handler = __commonJS({
|
|
102799
102799
|
if (this.fsw.closed) {
|
102800
102800
|
return;
|
102801
102801
|
}
|
102802
|
-
const
|
102802
|
+
const dirname7 = sysPath.dirname(file);
|
102803
102803
|
const basename3 = sysPath.basename(file);
|
102804
|
-
const parent2 = this.fsw._getWatchedDir(
|
102804
|
+
const parent2 = this.fsw._getWatchedDir(dirname7);
|
102805
102805
|
let prevStats = stats;
|
102806
102806
|
if (parent2.has(basename3))
|
102807
102807
|
return;
|
@@ -102826,7 +102826,7 @@ var require_nodefs_handler = __commonJS({
|
|
102826
102826
|
prevStats = newStats2;
|
102827
102827
|
}
|
102828
102828
|
} catch (error) {
|
102829
|
-
this.fsw._remove(
|
102829
|
+
this.fsw._remove(dirname7, basename3);
|
102830
102830
|
}
|
102831
102831
|
} else if (parent2.has(basename3)) {
|
102832
102832
|
const at = newStats.atimeMs;
|
@@ -108220,7 +108220,7 @@ var require_filters = __commonJS({
|
|
108220
108220
|
return r2.copySafeness(str2, res);
|
108221
108221
|
}
|
108222
108222
|
_exports.indent = indent2;
|
108223
|
-
function
|
108223
|
+
function join19(arr, del2, attr) {
|
108224
108224
|
del2 = del2 || "";
|
108225
108225
|
if (attr) {
|
108226
108226
|
arr = lib.map(arr, function(v) {
|
@@ -108229,7 +108229,7 @@ var require_filters = __commonJS({
|
|
108229
108229
|
}
|
108230
108230
|
return arr.join(del2);
|
108231
108231
|
}
|
108232
|
-
_exports.join =
|
108232
|
+
_exports.join = join19;
|
108233
108233
|
function last(arr) {
|
108234
108234
|
return arr[arr.length - 1];
|
108235
108235
|
}
|
@@ -134349,10 +134349,10 @@ var require_view = __commonJS({
|
|
134349
134349
|
var debug = require_src3()("express:view");
|
134350
134350
|
var path42 = require("path");
|
134351
134351
|
var fs45 = require("fs");
|
134352
|
-
var
|
134352
|
+
var dirname7 = path42.dirname;
|
134353
134353
|
var basename3 = path42.basename;
|
134354
134354
|
var extname7 = path42.extname;
|
134355
|
-
var
|
134355
|
+
var join19 = path42.join;
|
134356
134356
|
var resolve7 = path42.resolve;
|
134357
134357
|
module2.exports = View;
|
134358
134358
|
function View(name3, options) {
|
@@ -134388,7 +134388,7 @@ var require_view = __commonJS({
|
|
134388
134388
|
for (var i2 = 0; i2 < roots.length && !path43; i2++) {
|
134389
134389
|
var root6 = roots[i2];
|
134390
134390
|
var loc = resolve7(root6, name3);
|
134391
|
-
var dir =
|
134391
|
+
var dir = dirname7(loc);
|
134392
134392
|
var file = basename3(loc);
|
134393
134393
|
path43 = this.resolve(dir, file);
|
134394
134394
|
}
|
@@ -134400,12 +134400,12 @@ var require_view = __commonJS({
|
|
134400
134400
|
};
|
134401
134401
|
View.prototype.resolve = function resolve8(dir, file) {
|
134402
134402
|
var ext2 = this.ext;
|
134403
|
-
var path43 =
|
134403
|
+
var path43 = join19(dir, file);
|
134404
134404
|
var stat2 = tryStat(path43);
|
134405
134405
|
if (stat2 && stat2.isFile()) {
|
134406
134406
|
return path43;
|
134407
134407
|
}
|
134408
|
-
path43 =
|
134408
|
+
path43 = join19(dir, basename3(file, ext2), "index" + ext2);
|
134409
134409
|
stat2 = tryStat(path43);
|
134410
134410
|
if (stat2 && stat2.isFile()) {
|
134411
134411
|
return path43;
|
@@ -135472,7 +135472,7 @@ var require_send = __commonJS({
|
|
135472
135472
|
var Stream4 = require("stream");
|
135473
135473
|
var util3 = require("util");
|
135474
135474
|
var extname7 = path42.extname;
|
135475
|
-
var
|
135475
|
+
var join19 = path42.join;
|
135476
135476
|
var normalize6 = path42.normalize;
|
135477
135477
|
var resolve7 = path42.resolve;
|
135478
135478
|
var sep5 = path42.sep;
|
@@ -135691,7 +135691,7 @@ var require_send = __commonJS({
|
|
135691
135691
|
return res;
|
135692
135692
|
}
|
135693
135693
|
parts = path43.split(sep5);
|
135694
|
-
path43 = normalize6(
|
135694
|
+
path43 = normalize6(join19(root6, path43));
|
135695
135695
|
} else {
|
135696
135696
|
if (UP_PATH_REGEXP.test(path43)) {
|
135697
135697
|
debug('malicious path "%s"', path43);
|
@@ -135832,7 +135832,7 @@ var require_send = __commonJS({
|
|
135832
135832
|
return self2.onStatError(err);
|
135833
135833
|
return self2.error(404);
|
135834
135834
|
}
|
135835
|
-
var p5 =
|
135835
|
+
var p5 = join19(path43, self2._index[i2]);
|
135836
135836
|
debug('stat "%s"', p5);
|
135837
135837
|
fs45.stat(p5, function(err2, stat2) {
|
135838
135838
|
if (err2)
|
@@ -162165,7 +162165,7 @@ var require_buffer_list = __commonJS({
|
|
162165
162165
|
}
|
162166
162166
|
}, {
|
162167
162167
|
key: "join",
|
162168
|
-
value: function
|
162168
|
+
value: function join19(s5) {
|
162169
162169
|
if (this.length === 0)
|
162170
162170
|
return "";
|
162171
162171
|
var p5 = this.head;
|
@@ -175686,7 +175686,7 @@ var require_minimist = __commonJS({
|
|
175686
175686
|
var require_rc = __commonJS({
|
175687
175687
|
"../../node_modules/rc/index.js"(exports2, module2) {
|
175688
175688
|
var cc = require_utils15();
|
175689
|
-
var
|
175689
|
+
var join19 = require("path").join;
|
175690
175690
|
var deepExtend = require_deep_extend();
|
175691
175691
|
var etc = "/etc";
|
175692
175692
|
var win = process.platform === "win32";
|
@@ -175712,15 +175712,15 @@ var require_rc = __commonJS({
|
|
175712
175712
|
}
|
175713
175713
|
if (!win)
|
175714
175714
|
[
|
175715
|
-
|
175716
|
-
|
175715
|
+
join19(etc, name3, "config"),
|
175716
|
+
join19(etc, name3 + "rc")
|
175717
175717
|
].forEach(addConfigFile);
|
175718
175718
|
if (home)
|
175719
175719
|
[
|
175720
|
-
|
175721
|
-
|
175722
|
-
|
175723
|
-
|
175720
|
+
join19(home, ".config", name3, "config"),
|
175721
|
+
join19(home, ".config", name3),
|
175722
|
+
join19(home, "." + name3, "config"),
|
175723
|
+
join19(home, "." + name3 + "rc")
|
175724
175724
|
].forEach(addConfigFile);
|
175725
175725
|
addConfigFile(cc.find("." + name3 + "rc"));
|
175726
175726
|
if (env7.config)
|
@@ -177098,11 +177098,11 @@ var require_util6 = __commonJS({
|
|
177098
177098
|
if (files.includes("node_modules") || files.includes("package.json") || files.includes("package.json5") || files.includes("package.yaml") || files.includes("pnpm-workspace.yaml")) {
|
177099
177099
|
return name4;
|
177100
177100
|
}
|
177101
|
-
const
|
177102
|
-
if (
|
177101
|
+
const dirname7 = path42.dirname(name4);
|
177102
|
+
if (dirname7 === name4) {
|
177103
177103
|
return original;
|
177104
177104
|
}
|
177105
|
-
return find2(
|
177105
|
+
return find2(dirname7, original);
|
177106
177106
|
} catch (error) {
|
177107
177107
|
if (name4 === original) {
|
177108
177108
|
if (error.code === "ENOENT") {
|
@@ -184004,7 +184004,7 @@ var require_url = __commonJS({
|
|
184004
184004
|
return url && parse13(url).toString();
|
184005
184005
|
}
|
184006
184006
|
URLExt2.normalize = normalize6;
|
184007
|
-
function
|
184007
|
+
function join19(...parts) {
|
184008
184008
|
let u3 = (0, url_parse_1.default)(parts[0], {});
|
184009
184009
|
const isSchemaLess = u3.protocol === "" && u3.slashes;
|
184010
184010
|
if (isSchemaLess) {
|
@@ -184014,9 +184014,9 @@ var require_url = __commonJS({
|
|
184014
184014
|
const path42 = path_1.posix.join(`${!!prefix2 && u3.pathname[0] !== "/" ? "/" : ""}${u3.pathname}`, ...parts.slice(1));
|
184015
184015
|
return `${prefix2}${path42 === "." ? "" : path42}`;
|
184016
184016
|
}
|
184017
|
-
URLExt2.join =
|
184017
|
+
URLExt2.join = join19;
|
184018
184018
|
function encodeParts(url) {
|
184019
|
-
return
|
184019
|
+
return join19(...url.split("/").map(encodeURIComponent));
|
184020
184020
|
}
|
184021
184021
|
URLExt2.encodeParts = encodeParts;
|
184022
184022
|
function objectToQueryString(value) {
|
@@ -184236,11 +184236,11 @@ var require_path2 = __commonJS({
|
|
184236
184236
|
var path_1 = require("path");
|
184237
184237
|
var PathExt;
|
184238
184238
|
(function(PathExt2) {
|
184239
|
-
function
|
184239
|
+
function join19(...paths) {
|
184240
184240
|
const path42 = path_1.posix.join(...paths);
|
184241
184241
|
return path42 === "." ? "" : removeSlash(path42);
|
184242
184242
|
}
|
184243
|
-
PathExt2.join =
|
184243
|
+
PathExt2.join = join19;
|
184244
184244
|
function joinWithLeadingSlash(...paths) {
|
184245
184245
|
const path42 = path_1.posix.join(...paths);
|
184246
184246
|
return path42 === "." ? "" : path42;
|
@@ -184250,11 +184250,11 @@ var require_path2 = __commonJS({
|
|
184250
184250
|
return path_1.posix.basename(path42, ext2);
|
184251
184251
|
}
|
184252
184252
|
PathExt2.basename = basename3;
|
184253
|
-
function
|
184253
|
+
function dirname7(path42) {
|
184254
184254
|
const dir = removeSlash(path_1.posix.dirname(path42));
|
184255
184255
|
return dir === "." ? "" : dir;
|
184256
184256
|
}
|
184257
|
-
PathExt2.dirname =
|
184257
|
+
PathExt2.dirname = dirname7;
|
184258
184258
|
function extname7(path42) {
|
184259
184259
|
return path_1.posix.extname(path42);
|
184260
184260
|
}
|
@@ -193279,11 +193279,11 @@ var {
|
|
193279
193279
|
} = import_index.default;
|
193280
193280
|
|
193281
193281
|
// src/version.ts
|
193282
|
-
var version = "1.2.
|
193282
|
+
var version = "1.2.3";
|
193283
193283
|
var version_default = version;
|
193284
193284
|
|
193285
193285
|
// ../myst-cli/dist/build/build.js
|
193286
|
-
var
|
193286
|
+
var import_node_path56 = __toESM(require("path"), 1);
|
193287
193287
|
|
193288
193288
|
// ../myst-cli/node_modules/chalk/source/vendor/ansi-styles/index.js
|
193289
193289
|
var ANSI_BACKGROUND_OFFSET = 10;
|
@@ -194138,6 +194138,15 @@ var zenodo = {
|
|
194138
194138
|
return `10.5281/zenodo.${url.pathname.replace(/^\/(?:record|badge\/latestdoi)\//, "")}`;
|
194139
194139
|
}
|
194140
194140
|
};
|
194141
|
+
var biorxiv = {
|
194142
|
+
test(url) {
|
194143
|
+
return url.hostname.endsWith("biorxiv.org") && !!clumpParts(url).find(validatePart);
|
194144
|
+
},
|
194145
|
+
parse(url) {
|
194146
|
+
var _a6;
|
194147
|
+
return (_a6 = clumpParts(url).find(validatePart)) === null || _a6 === void 0 ? void 0 : _a6.replace(/v([\d]*)$/, "");
|
194148
|
+
}
|
194149
|
+
};
|
194141
194150
|
function clumpParts(url) {
|
194142
194151
|
const parts = url.pathname.split("/").filter((p5) => !!p5);
|
194143
194152
|
return parts.slice(0, -1).map((a2, i2) => `${a2}/${parts[i2 + 1]}`);
|
@@ -194160,7 +194169,7 @@ var idInQuery = {
|
|
194160
194169
|
}
|
194161
194170
|
};
|
194162
194171
|
var STRICT_RESOLVERS = [doiOrg];
|
194163
|
-
var DEFAULT_RESOLVERS = [doiOrg, pathParts, elife, zenodo, idInQuery];
|
194172
|
+
var DEFAULT_RESOLVERS = [doiOrg, biorxiv, pathParts, elife, zenodo, idInQuery];
|
194164
194173
|
|
194165
194174
|
// ../../node_modules/doi-utils/dist/index.js
|
194166
194175
|
var OPEN_FUNDER_REGISTRY_PREFIX = "10.13039";
|
@@ -202004,7 +202013,7 @@ function toText(content3) {
|
|
202004
202013
|
}).join("");
|
202005
202014
|
}
|
202006
202015
|
function copyNode(node3) {
|
202007
|
-
return
|
202016
|
+
return structuredClone(node3);
|
202008
202017
|
}
|
202009
202018
|
function mergeTextNodes(node3) {
|
202010
202019
|
var _a6;
|
@@ -202894,6 +202903,7 @@ var RuleId;
|
|
202894
202903
|
RuleId2["mystLinkValid"] = "myst-link-valid";
|
202895
202904
|
RuleId2["sphinxLinkValid"] = "sphinx-link-valid";
|
202896
202905
|
RuleId2["rridLinkValid"] = "rrid-link-valid";
|
202906
|
+
RuleId2["rorLinkValid"] = "ror-link-valid";
|
202897
202907
|
RuleId2["wikipediaLinkValid"] = "wikipedia-link-valid";
|
202898
202908
|
RuleId2["doiLinkValid"] = "doi-link-valid";
|
202899
202909
|
RuleId2["linkResolves"] = "link-resolves";
|
@@ -202924,6 +202934,191 @@ var RuleId;
|
|
202924
202934
|
RuleId2["containerChildrenValid"] = "contianer-children-valid";
|
202925
202935
|
})(RuleId || (RuleId = {}));
|
202926
202936
|
|
202937
|
+
// ../../node_modules/unist-util-visit-parents/lib/color.js
|
202938
|
+
function color(d) {
|
202939
|
+
return "\x1B[33m" + d + "\x1B[39m";
|
202940
|
+
}
|
202941
|
+
|
202942
|
+
// ../../node_modules/unist-util-visit-parents/lib/index.js
|
202943
|
+
var CONTINUE = true;
|
202944
|
+
var EXIT = false;
|
202945
|
+
var SKIP = "skip";
|
202946
|
+
var visitParents = (
|
202947
|
+
/**
|
202948
|
+
* @type {(
|
202949
|
+
* (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: BuildVisitor<Tree, Check>, reverse?: boolean | null | undefined) => void) &
|
202950
|
+
* (<Tree extends Node>(tree: Tree, visitor: BuildVisitor<Tree>, reverse?: boolean | null | undefined) => void)
|
202951
|
+
* )}
|
202952
|
+
*/
|
202953
|
+
/**
|
202954
|
+
* @param {Node} tree
|
202955
|
+
* @param {Test} test
|
202956
|
+
* @param {Visitor<Node>} visitor
|
202957
|
+
* @param {boolean | null | undefined} [reverse]
|
202958
|
+
* @returns {void}
|
202959
|
+
*/
|
202960
|
+
function(tree, test2, visitor, reverse) {
|
202961
|
+
if (typeof test2 === "function" && typeof visitor !== "function") {
|
202962
|
+
reverse = visitor;
|
202963
|
+
visitor = test2;
|
202964
|
+
test2 = null;
|
202965
|
+
}
|
202966
|
+
const is4 = convert(test2);
|
202967
|
+
const step = reverse ? -1 : 1;
|
202968
|
+
factory(tree, void 0, [])();
|
202969
|
+
function factory(node3, index4, parents) {
|
202970
|
+
const value = node3 && typeof node3 === "object" ? node3 : {};
|
202971
|
+
if (typeof value.type === "string") {
|
202972
|
+
const name3 = (
|
202973
|
+
// `hast`
|
202974
|
+
typeof value.tagName === "string" ? value.tagName : (
|
202975
|
+
// `xast`
|
202976
|
+
typeof value.name === "string" ? value.name : void 0
|
202977
|
+
)
|
202978
|
+
);
|
202979
|
+
Object.defineProperty(visit3, "name", {
|
202980
|
+
value: "node (" + color(node3.type + (name3 ? "<" + name3 + ">" : "")) + ")"
|
202981
|
+
});
|
202982
|
+
}
|
202983
|
+
return visit3;
|
202984
|
+
function visit3() {
|
202985
|
+
let result = [];
|
202986
|
+
let subresult;
|
202987
|
+
let offset;
|
202988
|
+
let grandparents;
|
202989
|
+
if (!test2 || is4(node3, index4, parents[parents.length - 1] || null)) {
|
202990
|
+
result = toResult(visitor(node3, parents));
|
202991
|
+
if (result[0] === EXIT) {
|
202992
|
+
return result;
|
202993
|
+
}
|
202994
|
+
}
|
202995
|
+
if (node3.children && result[0] !== SKIP) {
|
202996
|
+
offset = (reverse ? node3.children.length : -1) + step;
|
202997
|
+
grandparents = parents.concat(node3);
|
202998
|
+
while (offset > -1 && offset < node3.children.length) {
|
202999
|
+
subresult = factory(node3.children[offset], offset, grandparents)();
|
203000
|
+
if (subresult[0] === EXIT) {
|
203001
|
+
return subresult;
|
203002
|
+
}
|
203003
|
+
offset = typeof subresult[1] === "number" ? subresult[1] : offset + step;
|
203004
|
+
}
|
203005
|
+
}
|
203006
|
+
return result;
|
203007
|
+
}
|
203008
|
+
}
|
203009
|
+
}
|
203010
|
+
);
|
203011
|
+
function toResult(value) {
|
203012
|
+
if (Array.isArray(value)) {
|
203013
|
+
return value;
|
203014
|
+
}
|
203015
|
+
if (typeof value === "number") {
|
203016
|
+
return [CONTINUE, value];
|
203017
|
+
}
|
203018
|
+
return [value];
|
203019
|
+
}
|
203020
|
+
|
203021
|
+
// ../../node_modules/unist-util-visit/lib/index.js
|
203022
|
+
var visit = (
|
203023
|
+
/**
|
203024
|
+
* @type {(
|
203025
|
+
* (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: BuildVisitor<Tree, Check>, reverse?: boolean | null | undefined) => void) &
|
203026
|
+
* (<Tree extends Node>(tree: Tree, visitor: BuildVisitor<Tree>, reverse?: boolean | null | undefined) => void)
|
203027
|
+
* )}
|
203028
|
+
*/
|
203029
|
+
/**
|
203030
|
+
* @param {Node} tree
|
203031
|
+
* @param {Test} test
|
203032
|
+
* @param {Visitor} visitor
|
203033
|
+
* @param {boolean | null | undefined} [reverse]
|
203034
|
+
* @returns {void}
|
203035
|
+
*/
|
203036
|
+
function(tree, test2, visitor, reverse) {
|
203037
|
+
if (typeof test2 === "function" && typeof visitor !== "function") {
|
203038
|
+
reverse = visitor;
|
203039
|
+
visitor = test2;
|
203040
|
+
test2 = null;
|
203041
|
+
}
|
203042
|
+
visitParents(tree, test2, overload, reverse);
|
203043
|
+
function overload(node3, parents) {
|
203044
|
+
const parent2 = parents[parents.length - 1];
|
203045
|
+
return visitor(
|
203046
|
+
node3,
|
203047
|
+
parent2 ? parent2.children.indexOf(node3) : null,
|
203048
|
+
parent2
|
203049
|
+
);
|
203050
|
+
}
|
203051
|
+
}
|
203052
|
+
);
|
203053
|
+
|
203054
|
+
// ../myst-common/dist/selectNodes.js
|
203055
|
+
function isTargetIdentifierNode(node3) {
|
203056
|
+
const nonTargetTypes = ["crossReference", "cite", "footnoteDefinition", "footnoteReference"];
|
203057
|
+
return !nonTargetTypes.includes(node3.type);
|
203058
|
+
}
|
203059
|
+
var hiddenNodes = /* @__PURE__ */ new Set(["comment", "mystComment"]);
|
203060
|
+
function selectHeadingNodes(mdast2, identifier, maxNodes) {
|
203061
|
+
let begin = false;
|
203062
|
+
let htmlId = void 0;
|
203063
|
+
const nodes = [];
|
203064
|
+
visit(mdast2, (node3) => {
|
203065
|
+
if (begin && node3.type === "heading" || maxNodes && nodes.length >= maxNodes) {
|
203066
|
+
return EXIT;
|
203067
|
+
}
|
203068
|
+
if (node3.identifier === identifier && node3.type === "heading") {
|
203069
|
+
begin = true;
|
203070
|
+
htmlId = node3.html_id || node3.identifier;
|
203071
|
+
}
|
203072
|
+
if (begin) {
|
203073
|
+
if (!hiddenNodes.has(node3.type))
|
203074
|
+
nodes.push(node3);
|
203075
|
+
return SKIP;
|
203076
|
+
}
|
203077
|
+
});
|
203078
|
+
return { htmlId, nodes };
|
203079
|
+
}
|
203080
|
+
function selectDefinitionTerm(mdast2, identifier, maxNodes) {
|
203081
|
+
var _a6, _b;
|
203082
|
+
let begin = false;
|
203083
|
+
const nodes = [];
|
203084
|
+
visit(mdast2, (node3) => {
|
203085
|
+
if (begin && node3.type === "definitionTerm") {
|
203086
|
+
if (nodes.length > 1)
|
203087
|
+
return EXIT;
|
203088
|
+
} else if (begin && node3.type !== "definitionDescription") {
|
203089
|
+
return EXIT;
|
203090
|
+
}
|
203091
|
+
if (node3.identifier === identifier && node3.type === "definitionTerm") {
|
203092
|
+
nodes.push(node3);
|
203093
|
+
begin = true;
|
203094
|
+
}
|
203095
|
+
if (begin) {
|
203096
|
+
if (node3.type === "definitionDescription")
|
203097
|
+
nodes.push(node3);
|
203098
|
+
return SKIP;
|
203099
|
+
}
|
203100
|
+
});
|
203101
|
+
return {
|
203102
|
+
htmlId: ((_a6 = nodes === null || nodes === void 0 ? void 0 : nodes[0]) === null || _a6 === void 0 ? void 0 : _a6.html_id) || ((_b = nodes === null || nodes === void 0 ? void 0 : nodes[0]) === null || _b === void 0 ? void 0 : _b.identifier),
|
203103
|
+
nodes: [{ type: "definitionList", key: "dl", children: nodes.slice(0, maxNodes) }]
|
203104
|
+
};
|
203105
|
+
}
|
203106
|
+
function selectMdastNodes(mdast2, identifier, maxNodes) {
|
203107
|
+
if (maxNodes === 0)
|
203108
|
+
return { nodes: [] };
|
203109
|
+
const node3 = selectAll(`[identifier=${identifier}],[key=${identifier}]`, mdast2).find((n) => isTargetIdentifierNode(n));
|
203110
|
+
if (!node3)
|
203111
|
+
return { nodes: [] };
|
203112
|
+
switch (node3.type) {
|
203113
|
+
case "heading":
|
203114
|
+
return selectHeadingNodes(mdast2, identifier, maxNodes);
|
203115
|
+
case "definitionTerm":
|
203116
|
+
return selectDefinitionTerm(mdast2, identifier, maxNodes);
|
203117
|
+
default:
|
203118
|
+
return { htmlId: node3.html_id || node3.identifier, nodes: [node3] };
|
203119
|
+
}
|
203120
|
+
}
|
203121
|
+
|
202927
203122
|
// ../myst-common/dist/templates.js
|
202928
203123
|
var TemplateKind;
|
202929
203124
|
(function(TemplateKind2) {
|
@@ -203433,9 +203628,9 @@ var VFile = class {
|
|
203433
203628
|
*
|
203434
203629
|
* Cannot be set if there’s no `path` yet.
|
203435
203630
|
*/
|
203436
|
-
set dirname(
|
203631
|
+
set dirname(dirname7) {
|
203437
203632
|
assertPath(this.basename, "dirname");
|
203438
|
-
this.path = import_path.default.join(
|
203633
|
+
this.path = import_path.default.join(dirname7 || "", this.basename);
|
203439
203634
|
}
|
203440
203635
|
/**
|
203441
203636
|
* Get the basename (including extname) (example: `'index.min.js'`).
|
@@ -203692,123 +203887,6 @@ function admonitionBlockquoteTransform(tree) {
|
|
203692
203887
|
});
|
203693
203888
|
}
|
203694
203889
|
|
203695
|
-
// ../../node_modules/unist-util-visit-parents/lib/color.js
|
203696
|
-
function color(d) {
|
203697
|
-
return "\x1B[33m" + d + "\x1B[39m";
|
203698
|
-
}
|
203699
|
-
|
203700
|
-
// ../../node_modules/unist-util-visit-parents/lib/index.js
|
203701
|
-
var CONTINUE = true;
|
203702
|
-
var EXIT = false;
|
203703
|
-
var SKIP = "skip";
|
203704
|
-
var visitParents = (
|
203705
|
-
/**
|
203706
|
-
* @type {(
|
203707
|
-
* (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: BuildVisitor<Tree, Check>, reverse?: boolean | null | undefined) => void) &
|
203708
|
-
* (<Tree extends Node>(tree: Tree, visitor: BuildVisitor<Tree>, reverse?: boolean | null | undefined) => void)
|
203709
|
-
* )}
|
203710
|
-
*/
|
203711
|
-
/**
|
203712
|
-
* @param {Node} tree
|
203713
|
-
* @param {Test} test
|
203714
|
-
* @param {Visitor<Node>} visitor
|
203715
|
-
* @param {boolean | null | undefined} [reverse]
|
203716
|
-
* @returns {void}
|
203717
|
-
*/
|
203718
|
-
function(tree, test2, visitor, reverse) {
|
203719
|
-
if (typeof test2 === "function" && typeof visitor !== "function") {
|
203720
|
-
reverse = visitor;
|
203721
|
-
visitor = test2;
|
203722
|
-
test2 = null;
|
203723
|
-
}
|
203724
|
-
const is4 = convert(test2);
|
203725
|
-
const step = reverse ? -1 : 1;
|
203726
|
-
factory(tree, void 0, [])();
|
203727
|
-
function factory(node3, index4, parents) {
|
203728
|
-
const value = node3 && typeof node3 === "object" ? node3 : {};
|
203729
|
-
if (typeof value.type === "string") {
|
203730
|
-
const name3 = (
|
203731
|
-
// `hast`
|
203732
|
-
typeof value.tagName === "string" ? value.tagName : (
|
203733
|
-
// `xast`
|
203734
|
-
typeof value.name === "string" ? value.name : void 0
|
203735
|
-
)
|
203736
|
-
);
|
203737
|
-
Object.defineProperty(visit3, "name", {
|
203738
|
-
value: "node (" + color(node3.type + (name3 ? "<" + name3 + ">" : "")) + ")"
|
203739
|
-
});
|
203740
|
-
}
|
203741
|
-
return visit3;
|
203742
|
-
function visit3() {
|
203743
|
-
let result = [];
|
203744
|
-
let subresult;
|
203745
|
-
let offset;
|
203746
|
-
let grandparents;
|
203747
|
-
if (!test2 || is4(node3, index4, parents[parents.length - 1] || null)) {
|
203748
|
-
result = toResult(visitor(node3, parents));
|
203749
|
-
if (result[0] === EXIT) {
|
203750
|
-
return result;
|
203751
|
-
}
|
203752
|
-
}
|
203753
|
-
if (node3.children && result[0] !== SKIP) {
|
203754
|
-
offset = (reverse ? node3.children.length : -1) + step;
|
203755
|
-
grandparents = parents.concat(node3);
|
203756
|
-
while (offset > -1 && offset < node3.children.length) {
|
203757
|
-
subresult = factory(node3.children[offset], offset, grandparents)();
|
203758
|
-
if (subresult[0] === EXIT) {
|
203759
|
-
return subresult;
|
203760
|
-
}
|
203761
|
-
offset = typeof subresult[1] === "number" ? subresult[1] : offset + step;
|
203762
|
-
}
|
203763
|
-
}
|
203764
|
-
return result;
|
203765
|
-
}
|
203766
|
-
}
|
203767
|
-
}
|
203768
|
-
);
|
203769
|
-
function toResult(value) {
|
203770
|
-
if (Array.isArray(value)) {
|
203771
|
-
return value;
|
203772
|
-
}
|
203773
|
-
if (typeof value === "number") {
|
203774
|
-
return [CONTINUE, value];
|
203775
|
-
}
|
203776
|
-
return [value];
|
203777
|
-
}
|
203778
|
-
|
203779
|
-
// ../../node_modules/unist-util-visit/lib/index.js
|
203780
|
-
var visit = (
|
203781
|
-
/**
|
203782
|
-
* @type {(
|
203783
|
-
* (<Tree extends Node, Check extends Test>(tree: Tree, test: Check, visitor: BuildVisitor<Tree, Check>, reverse?: boolean | null | undefined) => void) &
|
203784
|
-
* (<Tree extends Node>(tree: Tree, visitor: BuildVisitor<Tree>, reverse?: boolean | null | undefined) => void)
|
203785
|
-
* )}
|
203786
|
-
*/
|
203787
|
-
/**
|
203788
|
-
* @param {Node} tree
|
203789
|
-
* @param {Test} test
|
203790
|
-
* @param {Visitor} visitor
|
203791
|
-
* @param {boolean | null | undefined} [reverse]
|
203792
|
-
* @returns {void}
|
203793
|
-
*/
|
203794
|
-
function(tree, test2, visitor, reverse) {
|
203795
|
-
if (typeof test2 === "function" && typeof visitor !== "function") {
|
203796
|
-
reverse = visitor;
|
203797
|
-
visitor = test2;
|
203798
|
-
test2 = null;
|
203799
|
-
}
|
203800
|
-
visitParents(tree, test2, overload, reverse);
|
203801
|
-
function overload(node3, parents) {
|
203802
|
-
const parent2 = parents[parents.length - 1];
|
203803
|
-
return visitor(
|
203804
|
-
node3,
|
203805
|
-
parent2 ? parent2.children.indexOf(node3) : null,
|
203806
|
-
parent2
|
203807
|
-
);
|
203808
|
-
}
|
203809
|
-
}
|
203810
|
-
);
|
203811
|
-
|
203812
203890
|
// ../myst-transforms/dist/caption.js
|
203813
203891
|
function captionParagraphTransform(tree) {
|
203814
203892
|
visit(tree, "caption", (node3) => {
|
@@ -206224,9 +206302,6 @@ function fillReferenceEnumerators(node3, enumerator) {
|
|
206224
206302
|
const num = String(enumerator);
|
206225
206303
|
findAndReplace(node3, { "%s": num, "{number}": num });
|
206226
206304
|
}
|
206227
|
-
function copyNode2(node3) {
|
206228
|
-
return JSON.parse(JSON.stringify(node3));
|
206229
|
-
}
|
206230
206305
|
function kindFromNode(node3) {
|
206231
206306
|
return node3.type === "container" ? node3.kind : node3.type;
|
206232
206307
|
}
|
@@ -206262,7 +206337,7 @@ var State2 = class {
|
|
206262
206337
|
}
|
206263
206338
|
if (node3.identifier) {
|
206264
206339
|
this.targets[node3.identifier] = {
|
206265
|
-
node:
|
206340
|
+
node: structuredClone(node3),
|
206266
206341
|
kind
|
206267
206342
|
};
|
206268
206343
|
}
|
@@ -206319,13 +206394,13 @@ var State2 = class {
|
|
206319
206394
|
node3.resolved = true;
|
206320
206395
|
} else if (kinds.ref.ref && kinds.target.heading) {
|
206321
206396
|
if (noNodeChildren) {
|
206322
|
-
node3.children =
|
206397
|
+
node3.children = structuredClone(target.node).children;
|
206323
206398
|
}
|
206324
206399
|
node3.resolved = true;
|
206325
206400
|
} else if (kinds.ref.ref && (kinds.target.figure || kinds.target.table)) {
|
206326
206401
|
if (noNodeChildren) {
|
206327
206402
|
const caption3 = select("caption > paragraph", target.node);
|
206328
|
-
node3.children =
|
206403
|
+
node3.children = structuredClone(caption3).children;
|
206329
206404
|
}
|
206330
206405
|
node3.resolved = true;
|
206331
206406
|
} else if (kinds.ref.numref && kinds.target.figure && target.node.enumerator) {
|
@@ -208886,16 +208961,16 @@ function collectText(node3, info) {
|
|
208886
208961
|
start = end + 1;
|
208887
208962
|
}
|
208888
208963
|
let index4 = -1;
|
208889
|
-
let
|
208964
|
+
let join19;
|
208890
208965
|
while (++index4 < lines.length) {
|
208891
208966
|
if (lines[index4].charCodeAt(lines[index4].length - 1) === 8203 || index4 < lines.length - 1 && lines[index4 + 1].charCodeAt(0) === 8203) {
|
208892
208967
|
result.push(lines[index4]);
|
208893
|
-
|
208968
|
+
join19 = void 0;
|
208894
208969
|
} else if (lines[index4]) {
|
208895
|
-
if (typeof
|
208896
|
-
result.push(
|
208970
|
+
if (typeof join19 === "number")
|
208971
|
+
result.push(join19);
|
208897
208972
|
result.push(lines[index4]);
|
208898
|
-
|
208973
|
+
join19 = 0;
|
208899
208974
|
} else if (index4 === 0 || index4 === lines.length - 1) {
|
208900
208975
|
result.push(0);
|
208901
208976
|
}
|
@@ -219747,9 +219822,9 @@ var VFile2 = class {
|
|
219747
219822
|
* @returns {undefined}
|
219748
219823
|
* Nothing.
|
219749
219824
|
*/
|
219750
|
-
set dirname(
|
219825
|
+
set dirname(dirname7) {
|
219751
219826
|
assertPath2(this.basename, "dirname");
|
219752
|
-
this.path = import_node_path3.default.join(
|
219827
|
+
this.path = import_node_path3.default.join(dirname7 || "", this.basename);
|
219753
219828
|
}
|
219754
219829
|
/**
|
219755
219830
|
* Get the extname (including dot) (example: `'.js'`).
|
@@ -235876,13 +235951,13 @@ function linksTransform(mdast2, file, opts) {
|
|
235876
235951
|
var _a6;
|
235877
235952
|
const linkNodes = selectAll((_a6 = opts.selector) !== null && _a6 !== void 0 ? _a6 : "link,card", mdast2);
|
235878
235953
|
linkNodes.forEach((link4) => {
|
235879
|
-
formatLinkText(link4);
|
235880
235954
|
if (!link4.urlSource)
|
235881
235955
|
link4.urlSource = link4.url;
|
235882
235956
|
const transform3 = opts.transformers.find((t2) => t2.test(link4.urlSource));
|
235883
|
-
|
235957
|
+
const result = transform3 === null || transform3 === void 0 ? void 0 : transform3.transform(link4, file);
|
235958
|
+
formatLinkText(link4);
|
235959
|
+
if (!transform3 || result === void 0)
|
235884
235960
|
return;
|
235885
|
-
const result = transform3.transform(link4, file);
|
235886
235961
|
if (result) {
|
235887
235962
|
delete link4.error;
|
235888
235963
|
if (transform3.protocol) {
|
@@ -235927,7 +236002,7 @@ var MystTransformer = class {
|
|
235927
236002
|
return !!this.mystXRefsList.find((m2) => m2.key && normalizedUri.startsWith(`xref:${m2.key}`));
|
235928
236003
|
}
|
235929
236004
|
transform(link4, file) {
|
235930
|
-
var _a6;
|
236005
|
+
var _a6, _b;
|
235931
236006
|
const urlSource = removeMystPrefix(link4.urlSource || link4.url, file, link4, TRANSFORM_SOURCE3);
|
235932
236007
|
let url;
|
235933
236008
|
try {
|
@@ -235978,15 +236053,20 @@ var MystTransformer = class {
|
|
235978
236053
|
});
|
235979
236054
|
return false;
|
235980
236055
|
}
|
235981
|
-
link4.
|
235982
|
-
|
235983
|
-
|
236056
|
+
if (((_b = link4.children) === null || _b === void 0 ? void 0 : _b.length) === 1 && link4.children[0].type === "text" && link4.children[0].value === link4.urlSource) {
|
236057
|
+
link4.children = [];
|
236058
|
+
}
|
235984
236059
|
if (match3.kind === "page") {
|
235985
|
-
link4.
|
236060
|
+
link4.url = `${mystXRefs.url}${match3.url}`;
|
236061
|
+
link4.dataUrl = `${mystXRefs.url}${match3.data}`;
|
236062
|
+
link4.internal = false;
|
235986
236063
|
} else {
|
235987
236064
|
const xref = link4;
|
235988
236065
|
xref.type = "crossReference";
|
235989
236066
|
xref.remote = true;
|
236067
|
+
xref.remoteBaseUrl = mystXRefs.url;
|
236068
|
+
xref.url = match3.url;
|
236069
|
+
xref.dataUrl = match3.data;
|
235990
236070
|
xref.identifier = match3.identifier;
|
235991
236071
|
xref.label = match3.identifier;
|
235992
236072
|
xref.html_id = match3.html_id;
|
@@ -236151,6 +236231,7 @@ var WikiTransformer = class {
|
|
236151
236231
|
page = page.replace(/[\s]+/g, "_").replace(/_[_]+/, "_").replace(/(?:^_)|(?:_$)/g, "");
|
236152
236232
|
link4.url = `${result.wiki}wiki/${page}`;
|
236153
236233
|
link4.data = {
|
236234
|
+
...link4.data,
|
236154
236235
|
page,
|
236155
236236
|
wiki: result.wiki,
|
236156
236237
|
lang: result.lang
|
@@ -236200,15 +236281,60 @@ var RRIDTransformer = class {
|
|
236200
236281
|
return false;
|
236201
236282
|
}
|
236202
236283
|
link4.url = `${RESOLVER}${rrid}`;
|
236203
|
-
link4.data = { rrid };
|
236284
|
+
link4.data = { ...link4.data, rrid };
|
236204
236285
|
link4.internal = false;
|
236205
236286
|
updateLinkTextIfEmpty(link4, rrid);
|
236206
236287
|
return true;
|
236207
236288
|
}
|
236208
236289
|
};
|
236209
236290
|
|
236291
|
+
// ../myst-transforms/dist/links/ror.js
|
236292
|
+
var RESOLVER2 = "https://ror.org/";
|
236293
|
+
var TRANSFORM_SOURCE7 = "LinkTransform:RORTransformer";
|
236294
|
+
function isValid2(rrid) {
|
236295
|
+
return !!rrid;
|
236296
|
+
}
|
236297
|
+
function getROR(uri) {
|
236298
|
+
if (uri.startsWith("ror:")) {
|
236299
|
+
return uri.replace(/^ror:/, "").trim();
|
236300
|
+
}
|
236301
|
+
if (withoutHttp(uri).startsWith(withoutHttp(RESOLVER2))) {
|
236302
|
+
return withoutHttp(uri).replace(withoutHttp(RESOLVER2), "").trim();
|
236303
|
+
}
|
236304
|
+
return uri.trim();
|
236305
|
+
}
|
236306
|
+
var RORTransformer = class {
|
236307
|
+
constructor() {
|
236308
|
+
this.protocol = "ror";
|
236309
|
+
}
|
236310
|
+
test(uri) {
|
236311
|
+
if (!uri)
|
236312
|
+
return false;
|
236313
|
+
if (uri.startsWith("ror:"))
|
236314
|
+
return true;
|
236315
|
+
return withoutHttp(uri).startsWith(withoutHttp(RESOLVER2));
|
236316
|
+
}
|
236317
|
+
transform(link4, file) {
|
236318
|
+
const urlSource = link4.urlSource || link4.url;
|
236319
|
+
const ror = getROR(urlSource);
|
236320
|
+
if (!isValid2(ror)) {
|
236321
|
+
fileWarn(file, `ROR is not valid: ${urlSource}`, {
|
236322
|
+
node: link4,
|
236323
|
+
source: TRANSFORM_SOURCE7,
|
236324
|
+
ruleId: RuleId.rorLinkValid
|
236325
|
+
});
|
236326
|
+
return false;
|
236327
|
+
}
|
236328
|
+
link4.url = `${RESOLVER2}${ror}`;
|
236329
|
+
link4.data = { ...link4.data, ror };
|
236330
|
+
link4.internal = false;
|
236331
|
+
updateLinkTextIfEmpty(link4, ror);
|
236332
|
+
return true;
|
236333
|
+
}
|
236334
|
+
};
|
236335
|
+
|
236210
236336
|
// ../myst-transforms/dist/links/doi.js
|
236211
|
-
var
|
236337
|
+
var TRANSFORM_SOURCE8 = "LinkTransform:DOITransformer";
|
236212
236338
|
var DOITransformer = class {
|
236213
236339
|
constructor() {
|
236214
236340
|
this.protocol = "doi";
|
@@ -236227,13 +236353,13 @@ var DOITransformer = class {
|
|
236227
236353
|
if (!doiUrl2) {
|
236228
236354
|
fileError(file, `DOI is not valid: ${urlSource}`, {
|
236229
236355
|
node: link4,
|
236230
|
-
source:
|
236356
|
+
source: TRANSFORM_SOURCE8,
|
236231
236357
|
ruleId: RuleId.doiLinkValid
|
236232
236358
|
});
|
236233
236359
|
return false;
|
236234
236360
|
}
|
236235
236361
|
link4.url = doiUrl2;
|
236236
|
-
link4.data = { doi: doi.normalize(doiUrl2) };
|
236362
|
+
link4.data = { ...link4.data, doi: doi.normalize(doiUrl2) };
|
236237
236363
|
link4.internal = false;
|
236238
236364
|
updateLinkTextIfEmpty(link4, "");
|
236239
236365
|
return true;
|
@@ -236241,7 +236367,7 @@ var DOITransformer = class {
|
|
236241
236367
|
};
|
236242
236368
|
|
236243
236369
|
// ../myst-transforms/dist/links/github.js
|
236244
|
-
var
|
236370
|
+
var RESOLVER3 = "https://github.com/";
|
236245
236371
|
function safeUrlParse(urlSource) {
|
236246
236372
|
try {
|
236247
236373
|
return new URL(`https://${withoutHttp(urlSource)}`);
|
@@ -236300,7 +236426,7 @@ var GithubTransformer = class {
|
|
236300
236426
|
test(uri) {
|
236301
236427
|
if (!uri)
|
236302
236428
|
return false;
|
236303
|
-
return withoutHttp(uri).startsWith(withoutHttp(
|
236429
|
+
return withoutHttp(uri).startsWith(withoutHttp(RESOLVER3));
|
236304
236430
|
}
|
236305
236431
|
transform(link4, file) {
|
236306
236432
|
const urlSource = link4.urlSource || link4.url;
|
@@ -236309,7 +236435,7 @@ var GithubTransformer = class {
|
|
236309
236435
|
return false;
|
236310
236436
|
}
|
236311
236437
|
const [defaultText, data] = parsed;
|
236312
|
-
link4.data = data;
|
236438
|
+
link4.data = { ...link4.data, ...data };
|
236313
236439
|
link4.internal = false;
|
236314
236440
|
updateLinkTextIfEmpty(link4, defaultText);
|
236315
236441
|
return true;
|
@@ -236324,7 +236450,7 @@ function checkLinkTextTransform(mdast2, vfile2) {
|
|
236324
236450
|
linkNodes.forEach((node3) => {
|
236325
236451
|
var _a6;
|
236326
236452
|
if (!toText(node3.children) && !select("image", node3)) {
|
236327
|
-
fileWarn(vfile2, `Link text is empty for <${(_a6 = node3.urlSource) !== null && _a6 !== void 0 ? _a6 : node3.url}>`, {
|
236453
|
+
fileWarn(vfile2, `Link text is empty for <${(_a6 = node3.urlSource) !== null && _a6 !== void 0 ? _a6 : node3.url}${node3.identifier ? `#${node3.identifier}` : ""}>`, {
|
236328
236454
|
node: node3,
|
236329
236455
|
ruleId: RuleId.linkTextExists
|
236330
236456
|
});
|
@@ -236892,7 +237018,7 @@ function getDefaultNumberedReferenceTemplate(kind) {
|
|
236892
237018
|
const domain = kind.includes(":") ? kind.split(":")[1] : kind;
|
236893
237019
|
return `${domain.slice(0, 1).toUpperCase()}${domain.slice(1)}\xA0%s`;
|
236894
237020
|
}
|
236895
|
-
function getDefaultNamedReferenceTemplate(kind, hasTitle) {
|
237021
|
+
function getDefaultNamedReferenceTemplate(kind = "unknown", hasTitle) {
|
236896
237022
|
const domain = kind.includes(":") ? kind.split(":")[1] : kind;
|
236897
237023
|
const name3 = `${domain.slice(0, 1).toUpperCase()}${domain.slice(1)}`;
|
236898
237024
|
switch (kind) {
|
@@ -237046,23 +237172,21 @@ function initializeTargetCounts(numbering, initialCounts, tree) {
|
|
237046
237172
|
}
|
237047
237173
|
var ReferenceState = class {
|
237048
237174
|
constructor(filePath, opts) {
|
237049
|
-
var _a6;
|
237175
|
+
var _a6, _b;
|
237050
237176
|
this.numbering = fillNumbering(opts === null || opts === void 0 ? void 0 : opts.numbering, DEFAULT_NUMBERING);
|
237051
237177
|
this.initialCounts = opts === null || opts === void 0 ? void 0 : opts.targetCounts;
|
237052
237178
|
this.targetCounts = initializeTargetCounts(this.numbering, this.initialCounts);
|
237053
237179
|
this.identifiers = (_a6 = opts === null || opts === void 0 ? void 0 : opts.identifiers) !== null && _a6 !== void 0 ? _a6 : [];
|
237054
237180
|
this.targets = {};
|
237055
|
-
this.vfile = opts === null || opts === void 0 ? void 0 : opts.vfile;
|
237181
|
+
this.vfile = (_b = opts === null || opts === void 0 ? void 0 : opts.vfile) !== null && _b !== void 0 ? _b : new VFile();
|
237056
237182
|
this.filePath = filePath;
|
237057
237183
|
this.url = opts === null || opts === void 0 ? void 0 : opts.url;
|
237058
237184
|
this.dataUrl = opts === null || opts === void 0 ? void 0 : opts.dataUrl;
|
237059
237185
|
this.title = opts === null || opts === void 0 ? void 0 : opts.title;
|
237060
237186
|
}
|
237061
237187
|
addTarget(node3) {
|
237062
|
-
|
237063
|
-
if (possibleIncorrectNode.type === "crossReference" || possibleIncorrectNode.type === "cite" || possibleIncorrectNode.type === "footnoteDefinition" || possibleIncorrectNode.type === "footnoteReference") {
|
237188
|
+
if (!isTargetIdentifierNode(node3))
|
237064
237189
|
return;
|
237065
|
-
}
|
237066
237190
|
const kind = kindFromNode2(node3);
|
237067
237191
|
const numberNode = shouldEnumerate(node3, kind, this.numbering);
|
237068
237192
|
if (numberNode && !node3.enumerator) {
|
@@ -237134,6 +237258,12 @@ var ReferenceState = class {
|
|
237134
237258
|
node3.enumerator = enumerator;
|
237135
237259
|
return enumerator;
|
237136
237260
|
}
|
237261
|
+
resolveStateProvider(identifier, page) {
|
237262
|
+
if (!identifier || !page || page !== this.filePath)
|
237263
|
+
return;
|
237264
|
+
if (this.getTarget(identifier) || this.getFileTarget(identifier))
|
237265
|
+
return this;
|
237266
|
+
}
|
237137
237267
|
getIdentifiers() {
|
237138
237268
|
return [...this.identifiers, ...Object.keys(this.targets)];
|
237139
237269
|
}
|
@@ -237205,7 +237335,7 @@ function warnNodeTargetNotFound(node3, vfile2) {
|
|
237205
237335
|
});
|
237206
237336
|
}
|
237207
237337
|
var MultiPageReferenceResolver = class {
|
237208
|
-
constructor(states, filePath, vfile2) {
|
237338
|
+
constructor(states, filePath, vfile2 = new VFile()) {
|
237209
237339
|
this.states = states;
|
237210
237340
|
this.filePath = filePath;
|
237211
237341
|
this.vfile = vfile2;
|
@@ -237213,19 +237343,19 @@ var MultiPageReferenceResolver = class {
|
|
237213
237343
|
resolveStateProvider(identifier, page) {
|
237214
237344
|
if (!identifier)
|
237215
237345
|
return void 0;
|
237216
|
-
const
|
237346
|
+
const resolvedState = this.states.find((state) => {
|
237217
237347
|
if (page && page !== state.filePath)
|
237218
237348
|
return false;
|
237219
237349
|
return !!state.getTarget(identifier) || !!state.getFileTarget(identifier);
|
237220
237350
|
});
|
237221
|
-
return
|
237351
|
+
return resolvedState;
|
237222
237352
|
}
|
237223
237353
|
getIdentifiers() {
|
237224
237354
|
return this.states.map((state) => state.getIdentifiers()).flat();
|
237225
237355
|
}
|
237226
237356
|
getTarget(identifier, page) {
|
237227
|
-
const
|
237228
|
-
return
|
237357
|
+
const state = this.resolveStateProvider(identifier, page);
|
237358
|
+
return state === null || state === void 0 ? void 0 : state.getTarget(identifier);
|
237229
237359
|
}
|
237230
237360
|
getFileTarget(identifier) {
|
237231
237361
|
if (!identifier)
|
@@ -237233,16 +237363,16 @@ var MultiPageReferenceResolver = class {
|
|
237233
237363
|
return this.states.map((state) => state.getFileTarget(identifier)).find((file) => !!file);
|
237234
237364
|
}
|
237235
237365
|
resolveReferenceContent(node3) {
|
237236
|
-
const
|
237237
|
-
if (!
|
237366
|
+
const state = this.resolveStateProvider(node3.identifier);
|
237367
|
+
if (!state) {
|
237238
237368
|
warnNodeTargetNotFound(node3, this.vfile);
|
237239
237369
|
return;
|
237240
237370
|
}
|
237241
|
-
|
237242
|
-
if (node3.resolved && (
|
237371
|
+
state === null || state === void 0 ? void 0 : state.resolveReferenceContent(node3);
|
237372
|
+
if (node3.resolved && (state === null || state === void 0 ? void 0 : state.filePath) !== this.filePath) {
|
237243
237373
|
node3.remote = true;
|
237244
|
-
node3.url =
|
237245
|
-
node3.dataUrl =
|
237374
|
+
node3.url = state.url || void 0;
|
237375
|
+
node3.dataUrl = state.dataUrl || void 0;
|
237246
237376
|
}
|
237247
237377
|
}
|
237248
237378
|
};
|
@@ -237359,30 +237489,40 @@ var resolveReferenceLinksTransform = (tree, opts) => {
|
|
237359
237489
|
};
|
237360
237490
|
var resolveUnlinkedCitations = (tree, opts) => {
|
237361
237491
|
selectAll("cite", tree).forEach((node3) => {
|
237362
|
-
var _a6;
|
237492
|
+
var _a6, _b;
|
237363
237493
|
const cite3 = node3;
|
237364
237494
|
if (!cite3.error)
|
237365
237495
|
return;
|
237366
237496
|
const reference = normalizeLabel(cite3.label);
|
237367
|
-
|
237368
|
-
|
237369
|
-
|
237370
|
-
if (
|
237497
|
+
if (reference) {
|
237498
|
+
const target = (_a6 = opts.state.getTarget(cite3.label)) !== null && _a6 !== void 0 ? _a6 : opts.state.getTarget(reference.identifier);
|
237499
|
+
const fileTarget = opts.state.getFileTarget(reference.identifier);
|
237500
|
+
if (target || fileTarget) {
|
237501
|
+
const xref = cite3;
|
237502
|
+
xref.type = "crossReference";
|
237503
|
+
xref.identifier = reference.identifier;
|
237504
|
+
xref.label = reference.label;
|
237505
|
+
delete cite3.error;
|
237506
|
+
if (target)
|
237507
|
+
implicitTargetWarning(target, node3, opts);
|
237371
237508
|
return;
|
237372
|
-
|
237373
|
-
|
237374
|
-
|
237375
|
-
|
237376
|
-
|
237509
|
+
}
|
237510
|
+
}
|
237511
|
+
const transformer = (_b = opts.transformers) === null || _b === void 0 ? void 0 : _b.find((t2) => t2.test(cite3.label));
|
237512
|
+
if (transformer) {
|
237513
|
+
const link4 = cite3;
|
237514
|
+
link4.type = "link";
|
237515
|
+
link4.url = cite3.label;
|
237516
|
+
delete cite3.error;
|
237377
237517
|
return;
|
237378
237518
|
}
|
237379
|
-
|
237380
|
-
|
237381
|
-
|
237382
|
-
|
237383
|
-
|
237384
|
-
|
237385
|
-
|
237519
|
+
if (!opts.state.vfile)
|
237520
|
+
return;
|
237521
|
+
fileWarn(opts.state.vfile, `Could not link citation with label "${cite3.label}".`, {
|
237522
|
+
node: node3,
|
237523
|
+
source: TRANSFORM_NAME2,
|
237524
|
+
ruleId: RuleId.referenceTargetResolves
|
237525
|
+
});
|
237386
237526
|
});
|
237387
237527
|
};
|
237388
237528
|
function unnestCrossReferencesTransform(tree) {
|
@@ -237403,14 +237543,17 @@ function unnestCrossReferencesTransform(tree) {
|
|
237403
237543
|
}
|
237404
237544
|
var resolveCrossReferencesTransform = (tree, opts) => {
|
237405
237545
|
visit(tree, "crossReference", (node3) => {
|
237406
|
-
|
237546
|
+
const { protocol } = node3;
|
237547
|
+
if (protocol && protocol !== "file")
|
237407
237548
|
return;
|
237408
237549
|
opts.state.resolveReferenceContent(node3);
|
237409
237550
|
});
|
237410
237551
|
};
|
237411
|
-
var
|
237552
|
+
var resolveLinksAndCitationsTransform = (tree, opts) => {
|
237412
237553
|
resolveReferenceLinksTransform(tree, opts);
|
237413
237554
|
resolveUnlinkedCitations(tree, opts);
|
237555
|
+
};
|
237556
|
+
var resolveReferencesTransform = (tree, file, opts) => {
|
237414
237557
|
resolveCrossReferencesTransform(tree, opts);
|
237415
237558
|
addContainerCaptionNumbersTransform(tree, file, opts);
|
237416
237559
|
unnestCrossReferencesTransform(tree);
|
@@ -240340,11 +240483,11 @@ function reloadAllConfigsForCurrentSite(session) {
|
|
240340
240483
|
}
|
240341
240484
|
|
240342
240485
|
// ../myst-cli/dist/project/load.js
|
240343
|
-
var
|
240486
|
+
var import_node_fs16 = __toESM(require("fs"), 1);
|
240344
240487
|
var import_node_path22 = require("path");
|
240345
240488
|
|
240346
240489
|
// ../myst-cli/dist/process/citations.js
|
240347
|
-
var
|
240490
|
+
var import_node_fs4 = __toESM(require("fs"), 1);
|
240348
240491
|
|
240349
240492
|
// ../citation-js-utils/dist/index.js
|
240350
240493
|
var import_core4 = __toESM(require_lib6(), 1);
|
@@ -240554,6 +240697,7 @@ async function getCitationRenderers(data) {
|
|
240554
240697
|
}
|
240555
240698
|
|
240556
240699
|
// ../myst-cli/dist/session/cache.js
|
240700
|
+
var import_node_fs3 = __toESM(require("fs"), 1);
|
240557
240701
|
var import_node_path8 = __toESM(require("path"), 1);
|
240558
240702
|
function castSession(session) {
|
240559
240703
|
const cache = session;
|
@@ -240577,6 +240721,35 @@ function castSession(session) {
|
|
240577
240721
|
};
|
240578
240722
|
return cache;
|
240579
240723
|
}
|
240724
|
+
function cachePath(session, filename) {
|
240725
|
+
return import_node_path8.default.join(session.buildPath(), "cache", filename);
|
240726
|
+
}
|
240727
|
+
function writeToCache(session, filename, data) {
|
240728
|
+
const file = cachePath(session, filename);
|
240729
|
+
session.log.debug(`Writing cache file: ${file}`);
|
240730
|
+
writeFileToFolder(file, data);
|
240731
|
+
}
|
240732
|
+
function checkCache(session, filename, opts) {
|
240733
|
+
const file = cachePath(session, filename);
|
240734
|
+
if (!import_node_fs3.default.existsSync(file)) {
|
240735
|
+
session.log.debug(`Cache file not found: ${file}`);
|
240736
|
+
return false;
|
240737
|
+
}
|
240738
|
+
const { ctimeMs } = import_node_fs3.default.lstatSync(file);
|
240739
|
+
const age = (Date.now() - ctimeMs) / (1e3 * 60 * 60 * 24);
|
240740
|
+
if ((opts === null || opts === void 0 ? void 0 : opts.maxAge) != null && age > opts.maxAge) {
|
240741
|
+
session.log.debug(`Cache file has expired (age: ${age.toFixed(3)} days, max: ${opts.maxAge} days): ${file}`);
|
240742
|
+
return false;
|
240743
|
+
}
|
240744
|
+
return true;
|
240745
|
+
}
|
240746
|
+
function loadFromCache(session, filename, opts) {
|
240747
|
+
if (!checkCache(session, filename, opts))
|
240748
|
+
return;
|
240749
|
+
const file = cachePath(session, filename);
|
240750
|
+
session.log.debug(`Loading cache file: ${file}`);
|
240751
|
+
return import_node_fs3.default.readFileSync(file).toString();
|
240752
|
+
}
|
240580
240753
|
|
240581
240754
|
// ../myst-cli/dist/process/citations.js
|
240582
240755
|
async function loadBibTeXCitationRenderers(session, path42) {
|
@@ -240592,7 +240765,7 @@ async function loadBibTeXCitationRenderers(session, path42) {
|
|
240592
240765
|
session.log.debug(`Fetched citations from "${path42}" successfully.`);
|
240593
240766
|
} else {
|
240594
240767
|
session.log.debug(`Loading citations at "${path42}"`);
|
240595
|
-
data =
|
240768
|
+
data = import_node_fs4.default.readFileSync(path42).toString();
|
240596
240769
|
}
|
240597
240770
|
const csl = parseBibTeX(data);
|
240598
240771
|
const renderer = await getCitationRenderers(csl);
|
@@ -240624,7 +240797,7 @@ function combineProjectCitationRenderers(session, projectPath) {
|
|
240624
240797
|
}
|
240625
240798
|
|
240626
240799
|
// ../myst-cli/dist/process/file.js
|
240627
|
-
var
|
240800
|
+
var import_node_fs12 = __toESM(require("fs"), 1);
|
240628
240801
|
var import_node_path18 = __toESM(require("path"), 1);
|
240629
240802
|
var import_node_crypto2 = require("crypto");
|
240630
240803
|
|
@@ -279263,7 +279436,7 @@ function colon_fence_rule(state, startLine, endLine, silent) {
|
|
279263
279436
|
}
|
279264
279437
|
|
279265
279438
|
// ../../node_modules/markdown-it-dollarmath/dist/index.js
|
279266
|
-
var
|
279439
|
+
var import_utils38 = __toESM(require_utils2(), 1);
|
279267
279440
|
var OptionDefaults = {
|
279268
279441
|
allow_space: true,
|
279269
279442
|
allow_digits: true,
|
@@ -279273,7 +279446,7 @@ var OptionDefaults = {
|
|
279273
279446
|
return label.replace(/[\s]+/g, "-");
|
279274
279447
|
},
|
279275
279448
|
renderer(content3) {
|
279276
|
-
return (0,
|
279449
|
+
return (0, import_utils38.escapeHtml)(content3);
|
279277
279450
|
},
|
279278
279451
|
labelRenderer(label) {
|
279279
279452
|
return `<a href="#${label}" class="mathlabel" title="Permalink to this equation">\xB6</a>`;
|
@@ -279975,10 +280148,12 @@ var embedDirective = {
|
|
279975
280148
|
},
|
279976
280149
|
options: {
|
279977
280150
|
"remove-input": {
|
279978
|
-
type: Boolean
|
280151
|
+
type: Boolean,
|
280152
|
+
doc: "If embedding a Jupyter Notebook cell, remove the input of the cell."
|
279979
280153
|
},
|
279980
280154
|
"remove-output": {
|
279981
|
-
type: Boolean
|
280155
|
+
type: Boolean,
|
280156
|
+
doc: "If embedding a Jupyter Notebook cell, remove the output of the cell."
|
279982
280157
|
}
|
279983
280158
|
},
|
279984
280159
|
run(data) {
|
@@ -287224,13 +287399,13 @@ function parseMyst(session, content3, file, opts) {
|
|
287224
287399
|
var import_nbtx2 = __toESM(require_cjs2(), 1);
|
287225
287400
|
|
287226
287401
|
// ../myst-cli/dist/transforms/images.js
|
287227
|
-
var
|
287402
|
+
var import_node_fs11 = __toESM(require("fs"), 1);
|
287228
287403
|
var import_mime_types = __toESM(require_mime_types(), 1);
|
287229
287404
|
var import_node_path17 = __toESM(require("path"), 1);
|
287230
287405
|
var import_nbtx = __toESM(require_cjs2(), 1);
|
287231
287406
|
|
287232
287407
|
// ../myst-cli/dist/version.js
|
287233
|
-
var version2 = "1.2.
|
287408
|
+
var version2 = "1.2.3";
|
287234
287409
|
var version_default2 = version2;
|
287235
287410
|
|
287236
287411
|
// ../myst-cli/dist/utils/headers.js
|
@@ -287240,7 +287415,7 @@ var EXT_REQUEST_HEADERS = {
|
|
287240
287415
|
};
|
287241
287416
|
|
287242
287417
|
// ../myst-cli/dist/utils/resolveExtension.js
|
287243
|
-
var
|
287418
|
+
var import_node_fs5 = __toESM(require("fs"), 1);
|
287244
287419
|
var import_node_path9 = __toESM(require("path"), 1);
|
287245
287420
|
var ImageExtensions;
|
287246
287421
|
(function(ImageExtensions2) {
|
@@ -287263,10 +287438,10 @@ function isValidFile(file) {
|
|
287263
287438
|
return VALID_FILE_EXTENSIONS.includes(import_node_path9.default.extname(file).toLowerCase());
|
287264
287439
|
}
|
287265
287440
|
function resolveExtension(file) {
|
287266
|
-
if (
|
287441
|
+
if (import_node_fs5.default.existsSync(file) && !isDirectory(file))
|
287267
287442
|
return file;
|
287268
287443
|
const extensions = VALID_FILE_EXTENSIONS.concat(VALID_FILE_EXTENSIONS.map((ext2) => ext2.toUpperCase()));
|
287269
|
-
return extensions.map((ext2) => `${file}${ext2}`).find((fileExt) =>
|
287444
|
+
return extensions.map((ext2) => `${file}${ext2}`).find((fileExt) => import_node_fs5.default.existsSync(fileExt));
|
287270
287445
|
}
|
287271
287446
|
|
287272
287447
|
// ../myst-cli/dist/utils/check.js
|
@@ -287342,27 +287517,27 @@ async function checkNodeVersion(session) {
|
|
287342
287517
|
}
|
287343
287518
|
|
287344
287519
|
// ../myst-cli/dist/utils/createTempFolder.js
|
287345
|
-
var
|
287520
|
+
var import_node_fs6 = __toESM(require("fs"), 1);
|
287346
287521
|
var import_node_path10 = __toESM(require("path"), 1);
|
287347
287522
|
var import_os = __toESM(require("os"), 1);
|
287348
287523
|
function createTempFolder(session) {
|
287349
287524
|
if (!session)
|
287350
|
-
return
|
287525
|
+
return import_node_fs6.default.mkdtempSync(import_node_path10.default.join(import_os.default.tmpdir(), "myst"));
|
287351
287526
|
const tempLocation = import_node_path10.default.join(session.buildPath(), "temp");
|
287352
|
-
|
287353
|
-
return
|
287527
|
+
import_node_fs6.default.mkdirSync(tempLocation, { recursive: true });
|
287528
|
+
return import_node_fs6.default.mkdtempSync(import_node_path10.default.join(tempLocation, "myst"));
|
287354
287529
|
}
|
287355
287530
|
|
287356
287531
|
// ../myst-cli/dist/utils/fileInfo.js
|
287357
287532
|
var import_node_path11 = __toESM(require("path"), 1);
|
287358
|
-
function input2name(input3, allowed,
|
287359
|
-
let name3 = `\xB6${input3}`.toLowerCase().split("").map((char) => allowed.test(char) ? char : "\xB6").join("").split("").reduce((p5, n) => p5.charAt(p5.length - 1) === "\xB6" && n === "\xB6" ? p5 : p5 + n).slice(1).replace(/¶/g,
|
287360
|
-
if (
|
287361
|
-
name3 = name3.replace(new RegExp(`${
|
287533
|
+
function input2name(input3, allowed, join19) {
|
287534
|
+
let name3 = `\xB6${input3}`.toLowerCase().split("").map((char) => allowed.test(char) ? char : "\xB6").join("").split("").reduce((p5, n) => p5.charAt(p5.length - 1) === "\xB6" && n === "\xB6" ? p5 : p5 + n).slice(1).replace(/¶/g, join19);
|
287535
|
+
if (join19) {
|
287536
|
+
name3 = name3.replace(new RegExp(`${join19}+`, "g"), join19);
|
287362
287537
|
}
|
287363
|
-
if (name3.charAt(0) ===
|
287538
|
+
if (name3.charAt(0) === join19)
|
287364
287539
|
name3 = name3.slice(1);
|
287365
|
-
if (name3.charAt(name3.length - 1) ===
|
287540
|
+
if (name3.charAt(name3.length - 1) === join19)
|
287366
287541
|
name3 = name3.slice(0, name3.length - 1);
|
287367
287542
|
return name3;
|
287368
287543
|
}
|
@@ -287399,7 +287574,7 @@ function fileInfo2(file, pageSlugs) {
|
|
287399
287574
|
}
|
287400
287575
|
|
287401
287576
|
// ../myst-cli/dist/utils/getAllBibtexFiles.js
|
287402
|
-
var
|
287577
|
+
var import_node_fs7 = __toESM(require("fs"), 1);
|
287403
287578
|
var import_node_path12 = __toESM(require("path"), 1);
|
287404
287579
|
|
287405
287580
|
// ../myst-cli/dist/utils/shouldIgnoreFile.js
|
@@ -287411,7 +287586,7 @@ function shouldIgnoreFile(session, file) {
|
|
287411
287586
|
// ../myst-cli/dist/utils/getAllBibtexFiles.js
|
287412
287587
|
function getAllBibTexFilesOnPath(session, dir) {
|
287413
287588
|
let bibFiles = [];
|
287414
|
-
const content3 =
|
287589
|
+
const content3 = import_node_fs7.default.readdirSync(dir);
|
287415
287590
|
content3.map((file) => import_node_path12.default.join(dir, file)).filter((file) => {
|
287416
287591
|
const isDir = isDirectory(file);
|
287417
287592
|
if (!isDir && import_node_path12.default.extname(file) === ".bib") {
|
@@ -287442,7 +287617,7 @@ function removeExtension(file) {
|
|
287442
287617
|
}
|
287443
287618
|
|
287444
287619
|
// ../myst-cli/dist/utils/toc.js
|
287445
|
-
var
|
287620
|
+
var import_node_fs8 = __toESM(require("fs"), 1);
|
287446
287621
|
var import_node_path14 = require("path");
|
287447
287622
|
var TOC_FORMAT = "jb-book";
|
287448
287623
|
var TOC_FORMAT_ARTICLE = "jb-article";
|
@@ -287465,7 +287640,7 @@ function upgradeOldJupyterBookTOC(oldTOC) {
|
|
287465
287640
|
}
|
287466
287641
|
function readTOC(log, opts) {
|
287467
287642
|
const filename = (0, import_node_path14.join)((opts === null || opts === void 0 ? void 0 : opts.path) || ".", (opts === null || opts === void 0 ? void 0 : opts.filename) || "_toc.yml");
|
287468
|
-
const toc = js_yaml_default.load(
|
287643
|
+
const toc = js_yaml_default.load(import_node_fs8.default.readFileSync(filename).toString());
|
287469
287644
|
if (Array.isArray(toc)) {
|
287470
287645
|
try {
|
287471
287646
|
const old = upgradeOldJupyterBookTOC(toc);
|
@@ -287489,7 +287664,7 @@ function readTOC(log, opts) {
|
|
287489
287664
|
function validateTOC(session, path42) {
|
287490
287665
|
const filename = tocFile(path42);
|
287491
287666
|
const { dir, base: base5 } = (0, import_node_path14.parse)(filename);
|
287492
|
-
if (!
|
287667
|
+
if (!import_node_fs8.default.existsSync(filename))
|
287493
287668
|
return false;
|
287494
287669
|
try {
|
287495
287670
|
readTOC(silentLogger(), { filename: base5, path: dir });
|
@@ -287523,7 +287698,7 @@ __export(imagemagick_exports, {
|
|
287523
287698
|
isImageMagickAvailable: () => isImageMagickAvailable,
|
287524
287699
|
isWebpAvailable: () => isWebpAvailable
|
287525
287700
|
});
|
287526
|
-
var
|
287701
|
+
var import_node_fs9 = __toESM(require("fs"), 1);
|
287527
287702
|
var import_node_path15 = __toESM(require("path"), 1);
|
287528
287703
|
var import_which = __toESM(require_lib15(), 1);
|
287529
287704
|
function isImageMagickAvailable() {
|
@@ -287559,14 +287734,14 @@ function createImagemagikLogger(session) {
|
|
287559
287734
|
return logger;
|
287560
287735
|
}
|
287561
287736
|
async function extractFirstFrameOfGif(session, gif, writeFolder) {
|
287562
|
-
if (!
|
287737
|
+
if (!import_node_fs9.default.existsSync(gif))
|
287563
287738
|
return null;
|
287564
287739
|
const { name: name3, ext: ext2 } = import_node_path15.default.parse(gif);
|
287565
287740
|
if (ext2 !== ".gif")
|
287566
287741
|
return null;
|
287567
287742
|
const pngFile = `${name3}.png`;
|
287568
287743
|
const png = import_node_path15.default.join(writeFolder, pngFile);
|
287569
|
-
if (
|
287744
|
+
if (import_node_fs9.default.existsSync(png)) {
|
287570
287745
|
session.log.debug(`Cached file found for extracted GIF: ${gif}`);
|
287571
287746
|
} else {
|
287572
287747
|
const executable = `convert -density 600 -colorspace RGB ${gif}[0] ${png}`;
|
@@ -287584,7 +287759,7 @@ async function extractFirstFrameOfGif(session, gif, writeFolder) {
|
|
287584
287759
|
return pngFile;
|
287585
287760
|
}
|
287586
287761
|
async function convert2(inputExtension, outputExtension, session, input3, writeFolder, options) {
|
287587
|
-
if (!
|
287762
|
+
if (!import_node_fs9.default.existsSync(input3))
|
287588
287763
|
return null;
|
287589
287764
|
const { name: name3, ext: ext2 } = import_node_path15.default.parse(input3);
|
287590
287765
|
if (ext2 !== inputExtension)
|
@@ -287593,7 +287768,7 @@ async function convert2(inputExtension, outputExtension, session, input3, writeF
|
|
287593
287768
|
const output2 = import_node_path15.default.join(writeFolder, filename);
|
287594
287769
|
const inputFormatUpper = inputExtension.slice(1).toUpperCase();
|
287595
287770
|
const outputFormatUpper = outputExtension.slice(1).toUpperCase();
|
287596
|
-
if (
|
287771
|
+
if (import_node_fs9.default.existsSync(output2)) {
|
287597
287772
|
session.log.debug(`Cached file found for converted ${inputFormatUpper}: ${input3}`);
|
287598
287773
|
return filename;
|
287599
287774
|
} else {
|
@@ -287608,18 +287783,18 @@ async function convert2(inputExtension, outputExtension, session, input3, writeF
|
|
287608
287783
|
});
|
287609
287784
|
return null;
|
287610
287785
|
}
|
287611
|
-
if (
|
287786
|
+
if (import_node_fs9.default.existsSync(output2))
|
287612
287787
|
return filename;
|
287613
287788
|
const maybeNumbered = output2.replace(new RegExp(`\\${outputExtension}$`), `-0${outputExtension}`);
|
287614
|
-
if (
|
287615
|
-
|
287789
|
+
if (import_node_fs9.default.existsSync(maybeNumbered)) {
|
287790
|
+
import_node_fs9.default.renameSync(maybeNumbered, output2);
|
287616
287791
|
return filename;
|
287617
287792
|
}
|
287618
287793
|
}
|
287619
287794
|
return null;
|
287620
287795
|
}
|
287621
287796
|
async function convertImageToWebp(session, image6, { quality = 80, overwrite = false, maxSize = LARGE_IMAGE }) {
|
287622
|
-
if (!
|
287797
|
+
if (!import_node_fs9.default.existsSync(image6)) {
|
287623
287798
|
session.log.debug(`Image does not exist: "${image6}"`);
|
287624
287799
|
return null;
|
287625
287800
|
}
|
@@ -287629,7 +287804,7 @@ async function convertImageToWebp(session, image6, { quality = 80, overwrite = f
|
|
287629
287804
|
session.log.debug(`Skipping webp conversion of "${image6}"`);
|
287630
287805
|
return null;
|
287631
287806
|
}
|
287632
|
-
const { size } =
|
287807
|
+
const { size } = import_node_fs9.default.statSync(image6);
|
287633
287808
|
if (size > maxSize && !(imageExt === ".pdf" || imageExt === ".tiff")) {
|
287634
287809
|
const inMB = (size / (1024 * 1024)).toLocaleString(void 0, {
|
287635
287810
|
minimumFractionDigits: 2,
|
@@ -287638,11 +287813,11 @@ async function convertImageToWebp(session, image6, { quality = 80, overwrite = f
|
|
287638
287813
|
addWarningForFile(session, image6, `Image is too large (${inMB} MB) to convert to webp (build will be slow).`, "warn", { ruleId: RuleId.imageFormatOptimizes });
|
287639
287814
|
return null;
|
287640
287815
|
}
|
287641
|
-
const
|
287816
|
+
const dirname7 = import_node_path15.default.dirname(image6);
|
287642
287817
|
const basename3 = import_node_path15.default.basename(image6, imageExt);
|
287643
|
-
const png = import_node_path15.default.join(
|
287644
|
-
const webp = import_node_path15.default.join(
|
287645
|
-
if (!overwrite &&
|
287818
|
+
const png = import_node_path15.default.join(dirname7, `${basename3}.png`);
|
287819
|
+
const webp = import_node_path15.default.join(dirname7, `${basename3}.webp`);
|
287820
|
+
if (!overwrite && import_node_fs9.default.existsSync(webp)) {
|
287646
287821
|
session.log.debug(`Image is already converted ${webp}`);
|
287647
287822
|
return `${basename3}.webp`;
|
287648
287823
|
}
|
@@ -287706,7 +287881,7 @@ __export(inkscape_exports, {
|
|
287706
287881
|
convert: () => convert3,
|
287707
287882
|
isInkscapeAvailable: () => isInkscapeAvailable
|
287708
287883
|
});
|
287709
|
-
var
|
287884
|
+
var import_node_fs10 = __toESM(require("fs"), 1);
|
287710
287885
|
var import_node_path16 = __toESM(require("path"), 1);
|
287711
287886
|
var import_which2 = __toESM(require_lib15(), 1);
|
287712
287887
|
function createInkscpapeLogger(session) {
|
@@ -287732,7 +287907,7 @@ function isInkscapeAvailable() {
|
|
287732
287907
|
return import_which2.default.sync("inkscape", { nothrow: true });
|
287733
287908
|
}
|
287734
287909
|
async function convert3(inputExtension, outputExtension, session, input3, writeFolder) {
|
287735
|
-
if (!
|
287910
|
+
if (!import_node_fs10.default.existsSync(input3))
|
287736
287911
|
return null;
|
287737
287912
|
const { name: name3, ext: ext2 } = import_node_path16.default.parse(input3);
|
287738
287913
|
if (ext2 !== inputExtension)
|
@@ -287741,7 +287916,7 @@ async function convert3(inputExtension, outputExtension, session, input3, writeF
|
|
287741
287916
|
const output2 = import_node_path16.default.join(writeFolder, filename);
|
287742
287917
|
const inputFormatUpper = inputExtension.slice(1).toUpperCase();
|
287743
287918
|
const outputFormat = outputExtension.slice(1);
|
287744
|
-
if (
|
287919
|
+
if (import_node_fs10.default.existsSync(output2)) {
|
287745
287920
|
session.log.debug(`Cached file found for converted ${inputFormatUpper}: ${input3}`);
|
287746
287921
|
} else {
|
287747
287922
|
const inkscapeCommand = `inkscape ${input3} --export-area-drawing --export-type=${outputFormat} --export-filename=${output2}`;
|
@@ -287776,16 +287951,16 @@ async function writeBase64(session, writeFolder, data, contentType) {
|
|
287776
287951
|
const file = `${hash}${ext2}`;
|
287777
287952
|
const filePath = import_node_path17.default.join(writeFolder, file);
|
287778
287953
|
session.log.debug(`Writing binary output file ${justData.length} bytes to ${filePath}`);
|
287779
|
-
if (!
|
287780
|
-
|
287781
|
-
|
287954
|
+
if (!import_node_fs11.default.existsSync(writeFolder))
|
287955
|
+
import_node_fs11.default.mkdirSync(writeFolder, { recursive: true });
|
287956
|
+
import_node_fs11.default.writeFileSync(filePath, justData, {
|
287782
287957
|
encoding: "base64"
|
287783
287958
|
});
|
287784
287959
|
return file;
|
287785
287960
|
}
|
287786
287961
|
async function downloadAndSaveImage(session, url, file, fileFolder) {
|
287787
|
-
const exists2 =
|
287788
|
-
const fileMatch = exists2 &&
|
287962
|
+
const exists2 = import_node_fs11.default.existsSync(fileFolder);
|
287963
|
+
const fileMatch = exists2 && import_node_fs11.default.readdirSync(fileFolder).find((f3) => import_node_path17.default.parse(f3).name === file);
|
287789
287964
|
if (exists2 && fileMatch) {
|
287790
287965
|
session.log.debug(`Cached image found for: ${url}...`);
|
287791
287966
|
return fileMatch;
|
@@ -287803,9 +287978,9 @@ async function downloadAndSaveImage(session, url, file, fileFolder) {
|
|
287803
287978
|
if (!contentType.startsWith("image/")) {
|
287804
287979
|
throw new Error(`ContentType "${contentType}" is not an image`);
|
287805
287980
|
}
|
287806
|
-
if (!
|
287807
|
-
|
287808
|
-
const fileStream =
|
287981
|
+
if (!import_node_fs11.default.existsSync(fileFolder))
|
287982
|
+
import_node_fs11.default.mkdirSync(fileFolder, { recursive: true });
|
287983
|
+
const fileStream = import_node_fs11.default.createWriteStream(`${filePath}.${extension}`);
|
287809
287984
|
await new Promise((resolve7, reject) => {
|
287810
287985
|
if (!res.body) {
|
287811
287986
|
reject(`no response body from ${url}`);
|
@@ -287844,7 +288019,7 @@ async function saveImageInStaticFolder(session, urlSource, sourceFile, writeFold
|
|
287844
288019
|
let file;
|
287845
288020
|
if (isUrl(urlSource)) {
|
287846
288021
|
file = await downloadAndSaveImage(session, urlSource, computeHash(urlSource), writeFolder);
|
287847
|
-
} else if (
|
288022
|
+
} else if (import_node_fs11.default.existsSync(imageLocalFile)) {
|
287848
288023
|
if (import_node_path17.default.resolve(import_node_path17.default.dirname(imageLocalFile)) === import_node_path17.default.resolve(writeFolder)) {
|
287849
288024
|
file = import_node_path17.default.basename(imageLocalFile);
|
287850
288025
|
} else {
|
@@ -287871,9 +288046,9 @@ function transformImagesToEmbed(mdast2) {
|
|
287871
288046
|
const images = selectAll("image", mdast2);
|
287872
288047
|
images.forEach((image6) => {
|
287873
288048
|
var _a6;
|
287874
|
-
if (image6.url.startsWith("#")) {
|
288049
|
+
if (image6.url.startsWith("xref:") || image6.url.startsWith("#")) {
|
287875
288050
|
image6.type = "embed";
|
287876
|
-
image6.source = { label: image6.url.substring(1) };
|
288051
|
+
image6.source = { label: image6.url.startsWith("xref:") ? image6.url : image6.url.substring(1) };
|
287877
288052
|
image6["remove-input"] = (_a6 = image6["remove-input"]) !== null && _a6 !== void 0 ? _a6 : true;
|
287878
288053
|
delete image6.url;
|
287879
288054
|
return;
|
@@ -287886,7 +288061,7 @@ function transformImagesWithoutExt(session, mdast2, file, opts) {
|
|
287886
288061
|
var _a6;
|
287887
288062
|
const wildcardRegex = /\.\*$/;
|
287888
288063
|
const imagePath = import_node_path17.default.join(import_node_path17.default.dirname(file), image6.url).replace(wildcardRegex, "");
|
287889
|
-
if (!
|
288064
|
+
if (!import_node_fs11.default.existsSync(imagePath)) {
|
287890
288065
|
const sortedExtensions = [
|
287891
288066
|
// Valid extensions
|
287892
288067
|
...(_a6 = opts === null || opts === void 0 ? void 0 : opts.imageExtensions) !== null && _a6 !== void 0 ? _a6 : [],
|
@@ -287895,7 +288070,7 @@ function transformImagesWithoutExt(session, mdast2, file, opts) {
|
|
287895
288070
|
// All known extensions
|
287896
288071
|
...KNOWN_IMAGE_EXTENSIONS
|
287897
288072
|
];
|
287898
|
-
const extension = sortedExtensions.find((ext2) =>
|
288073
|
+
const extension = sortedExtensions.find((ext2) => import_node_fs11.default.existsSync(imagePath + ext2));
|
287899
288074
|
if (extension) {
|
287900
288075
|
const replacement = image6.url.replace(wildcardRegex, "") + extension;
|
287901
288076
|
session.log.debug(`Resolving ${image6.url} to ${replacement}`);
|
@@ -288127,9 +288302,9 @@ async function transformWebp(session, opts) {
|
|
288127
288302
|
const postData = (_a6 = cache.$getMdast(opts.file)) === null || _a6 === void 0 ? void 0 : _a6.post;
|
288128
288303
|
if (!postData)
|
288129
288304
|
throw new Error(`Expected mdast to be processed and transformed for ${file}`);
|
288130
|
-
if (!
|
288305
|
+
if (!import_node_fs11.default.existsSync(imageWriteFolder))
|
288131
288306
|
return;
|
288132
|
-
const writeFolderContents =
|
288307
|
+
const writeFolderContents = import_node_fs11.default.readdirSync(imageWriteFolder);
|
288133
288308
|
const { mdast: mdast2, frontmatter } = postData;
|
288134
288309
|
const images = selectAll("image", mdast2);
|
288135
288310
|
await Promise.all(images.map(async (image6) => {
|
@@ -288376,7 +288551,7 @@ async function processNotebook(session, file, content3) {
|
|
288376
288551
|
}
|
288377
288552
|
|
288378
288553
|
// ../myst-cli/dist/process/file.js
|
288379
|
-
function
|
288554
|
+
function checkCache2(cache, content3, file) {
|
288380
288555
|
const sha256 = (0, import_node_crypto2.createHash)("sha256").update(content3).digest("hex");
|
288381
288556
|
cache.store.dispatch(watch.actions.markFileChanged({ path: file, sha256 }));
|
288382
288557
|
const mdast2 = cache.$getMdast(file);
|
@@ -288428,8 +288603,8 @@ async function loadFile(session, file, projectPath, extension, opts) {
|
|
288428
288603
|
}
|
288429
288604
|
location4 = location4.replaceAll("\\", "/");
|
288430
288605
|
try {
|
288431
|
-
const content3 =
|
288432
|
-
const { sha256, useCache } =
|
288606
|
+
const content3 = import_node_fs12.default.readFileSync(file).toString();
|
288607
|
+
const { sha256, useCache } = checkCache2(cache, content3, file);
|
288433
288608
|
if (useCache) {
|
288434
288609
|
session.log.debug(toc(`loadFile: ${file} already loaded.`));
|
288435
288610
|
return (_a6 = cache.$getMdast(file)) === null || _a6 === void 0 ? void 0 : _a6.pre;
|
@@ -288483,7 +288658,7 @@ ${error === null || error === void 0 ? void 0 : error.stack}
|
|
288483
288658
|
return (_b = cache.$getMdast(file)) === null || _b === void 0 ? void 0 : _b.pre;
|
288484
288659
|
}
|
288485
288660
|
async function bibFilesInDir(session, dir, load2 = true) {
|
288486
|
-
const bibFiles = await Promise.all(
|
288661
|
+
const bibFiles = await Promise.all(import_node_fs12.default.readdirSync(dir).map(async (f3) => {
|
288487
288662
|
if (import_node_path18.default.extname(f3).toLowerCase() === ".bib") {
|
288488
288663
|
const bibFile = import_node_path18.default.join(dir, f3);
|
288489
288664
|
if (load2)
|
@@ -288526,7 +288701,7 @@ async function getRawFrontmatterFromFile(session, file, projectPath) {
|
|
288526
288701
|
}
|
288527
288702
|
|
288528
288703
|
// ../myst-cli/dist/project/fromPath.js
|
288529
|
-
var
|
288704
|
+
var import_node_fs14 = __toESM(require("fs"), 1);
|
288530
288705
|
var import_node_path20 = require("path");
|
288531
288706
|
|
288532
288707
|
// ../../node_modules/glob/node_modules/minimatch/dist/mjs/index.js
|
@@ -294911,7 +295086,7 @@ var glob = Object.assign(glob_, {
|
|
294911
295086
|
glob.glob = glob;
|
294912
295087
|
|
294913
295088
|
// ../myst-cli/dist/project/fromTOC.js
|
294914
|
-
var
|
295089
|
+
var import_node_fs13 = __toESM(require("fs"), 1);
|
294915
295090
|
var import_node_path19 = require("path");
|
294916
295091
|
function pagesFromChapters(session, path42, chapters, pages = [], level = 1, pageSlugs) {
|
294917
295092
|
const filename = tocFile(path42);
|
@@ -294936,7 +295111,7 @@ function pagesFromChapters(session, path42, chapters, pages = [], level = 1, pag
|
|
294936
295111
|
}
|
294937
295112
|
function projectFromTOC(session, path42, level = 1) {
|
294938
295113
|
const filename = tocFile(path42);
|
294939
|
-
if (!
|
295114
|
+
if (!import_node_fs13.default.existsSync(filename)) {
|
294940
295115
|
throw new Error(`Could not find TOC "${filename}". Please create a '_toc.yml'.`);
|
294941
295116
|
}
|
294942
295117
|
const { dir, base: base5 } = (0, import_node_path19.parse)(filename);
|
@@ -294988,7 +295163,7 @@ function sortByNumber(a2, b) {
|
|
294988
295163
|
}
|
294989
295164
|
function projectPagesFromPath(session, path42, level, pageSlugs, opts) {
|
294990
295165
|
const { ignore: ignore3, suppressWarnings } = opts || {};
|
294991
|
-
const contents =
|
295166
|
+
const contents = import_node_fs14.default.readdirSync(path42).filter((file) => !shouldIgnoreFile(session, file)).map((file) => (0, import_node_path20.join)(path42, file)).filter((file) => !ignore3 || !ignore3.includes(file)).sort(sortByNumber);
|
294992
295167
|
if (session.configFiles.filter((file) => contents.includes((0, import_node_path20.join)(path42, file))).length) {
|
294993
295168
|
session.log.debug(`\u{1F50D} Found config file, ignoring subdirectory: ${path42}`);
|
294994
295169
|
return [];
|
@@ -295054,7 +295229,7 @@ async function projectFromPath(session, path42, indexFile) {
|
|
295054
295229
|
if (indexFile) {
|
295055
295230
|
if (!isValidFile(indexFile))
|
295056
295231
|
throw Error(`Index file ${indexFile} has invalid extension; must be ${ext_string}}`);
|
295057
|
-
if (!
|
295232
|
+
if (!import_node_fs14.default.existsSync(indexFile))
|
295058
295233
|
throw Error(`Index file ${indexFile} not found`);
|
295059
295234
|
}
|
295060
295235
|
const rootConfigYamls = session.configFiles.map((file) => (0, import_node_path20.join)(path42, file));
|
@@ -295085,7 +295260,7 @@ async function projectFromPath(session, path42, indexFile) {
|
|
295085
295260
|
}
|
295086
295261
|
|
295087
295262
|
// ../myst-cli/dist/project/toTOC.js
|
295088
|
-
var
|
295263
|
+
var import_node_fs15 = __toESM(require("fs"), 1);
|
295089
295264
|
var import_node_path21 = require("path");
|
295090
295265
|
function getRelativeDocumentLink(file, path42) {
|
295091
295266
|
if (path42 === ".")
|
@@ -295152,7 +295327,7 @@ function tocFromProject(project, path42 = ".") {
|
|
295152
295327
|
function writeTOCFromProject(project, path42) {
|
295153
295328
|
const filename = (0, import_node_path21.join)(path42, "_toc.yml");
|
295154
295329
|
const content3 = `${GENERATED_TOC_HEADER}${js_yaml_default.dump(tocFromProject(project, path42))}`;
|
295155
|
-
|
295330
|
+
import_node_fs15.default.writeFileSync(filename, content3);
|
295156
295331
|
}
|
295157
295332
|
|
295158
295333
|
// ../myst-cli/dist/project/load.js
|
@@ -295205,7 +295380,7 @@ Consider running "myst init --project" in that directory`, "warn", { ruleId: Rul
|
|
295205
295380
|
return true;
|
295206
295381
|
if (isUrl(bib))
|
295207
295382
|
return true;
|
295208
|
-
if (
|
295383
|
+
if (import_node_fs16.default.existsSync(bib)) {
|
295209
295384
|
allBibFiles.push(bib);
|
295210
295385
|
return true;
|
295211
295386
|
}
|
@@ -295240,7 +295415,7 @@ function filterPages(project) {
|
|
295240
295415
|
var import_node_fs30 = __toESM(require("fs"), 1);
|
295241
295416
|
|
295242
295417
|
// ../myst-cli/dist/process/site.js
|
295243
|
-
var
|
295418
|
+
var import_node_path38 = require("path");
|
295244
295419
|
|
295245
295420
|
// ../../node_modules/intersphinx/dist/intersphinx.js
|
295246
295421
|
var import_fs2 = __toESM(require("fs"), 1);
|
@@ -296697,19 +296872,19 @@ var Domains;
|
|
296697
296872
|
})(Domains || (Domains = {}));
|
296698
296873
|
|
296699
296874
|
// ../myst-cli/dist/build/site/manifest.js
|
296700
|
-
var
|
296875
|
+
var import_node_fs23 = __toESM(require("fs"), 1);
|
296701
296876
|
var import_node_path29 = __toESM(require("path"), 1);
|
296702
296877
|
|
296703
296878
|
// ../myst-cli/dist/build/site/template.js
|
296704
|
-
var
|
296879
|
+
var import_node_fs21 = __toESM(require("fs"), 1);
|
296705
296880
|
var import_node_path26 = require("path");
|
296706
296881
|
|
296707
296882
|
// ../myst-templates/dist/template.js
|
296708
|
-
var
|
296883
|
+
var import_node_fs20 = __toESM(require("fs"), 1);
|
296709
296884
|
var import_node_path25 = require("path");
|
296710
296885
|
|
296711
296886
|
// ../myst-templates/dist/download.js
|
296712
|
-
var
|
296887
|
+
var import_node_fs18 = __toESM(require("fs"), 1);
|
296713
296888
|
var import_node_path23 = require("path");
|
296714
296889
|
var import_node_crypto3 = require("crypto");
|
296715
296890
|
var import_adm_zip = __toESM(require_adm_zip(), 1);
|
@@ -296775,12 +296950,12 @@ function defaultPath(template, hash, opts) {
|
|
296775
296950
|
function resolveInputs(session, opts) {
|
296776
296951
|
let templateUrl;
|
296777
296952
|
let templatePath;
|
296778
|
-
if (opts.template &&
|
296953
|
+
if (opts.template && import_node_fs18.default.existsSync(opts.template)) {
|
296779
296954
|
const { base: base5, dir } = (0, import_node_path23.parse)(opts.template);
|
296780
296955
|
if (base5 === TEMPLATE_YML || Object.values(KIND_TO_EXT).filter(Boolean).includes((0, import_node_path23.extname)(base5))) {
|
296781
296956
|
templatePath = dir;
|
296782
|
-
} else if (
|
296783
|
-
if (
|
296957
|
+
} else if (import_node_fs18.default.lstatSync(opts.template).isDirectory()) {
|
296958
|
+
if (import_node_fs18.default.existsSync((0, import_node_path23.join)(opts.template, TEMPLATE_YML))) {
|
296784
296959
|
templatePath = opts.template;
|
296785
296960
|
}
|
296786
296961
|
}
|
@@ -296803,21 +296978,21 @@ function resolveInputs(session, opts) {
|
|
296803
296978
|
}
|
296804
296979
|
async function unnestTemplate(session, path42) {
|
296805
296980
|
var _a6;
|
296806
|
-
const content3 =
|
296981
|
+
const content3 = import_node_fs18.default.readdirSync(path42);
|
296807
296982
|
if (content3.includes(TEMPLATE_YML))
|
296808
296983
|
return;
|
296809
296984
|
let nestedPath;
|
296810
296985
|
content3.forEach((dir) => {
|
296811
296986
|
const templateYmlFile2 = (0, import_node_path23.join)(path42, dir, TEMPLATE_YML);
|
296812
|
-
if (!nestedPath &&
|
296987
|
+
if (!nestedPath && import_node_fs18.default.existsSync(templateYmlFile2)) {
|
296813
296988
|
nestedPath = (0, import_node_path23.join)(path42, dir);
|
296814
296989
|
}
|
296815
296990
|
});
|
296816
296991
|
if (!nestedPath)
|
296817
296992
|
return;
|
296818
296993
|
const templateYmlFile = (0, import_node_path23.join)(nestedPath, TEMPLATE_YML);
|
296819
|
-
|
296820
|
-
const templateYml = js_yaml_default.load(
|
296994
|
+
import_node_fs18.default.copyFileSync(templateYmlFile, (0, import_node_path23.join)(path42, TEMPLATE_YML));
|
296995
|
+
const templateYml = js_yaml_default.load(import_node_fs18.default.readFileSync(templateYmlFile).toString());
|
296821
296996
|
if ((_a6 = templateYml.files) === null || _a6 === void 0 ? void 0 : _a6.length) {
|
296822
296997
|
await Promise.all(templateYml.files.map(async (file) => {
|
296823
296998
|
const resolvedEntry = [...nestedPath.split(import_node_path23.sep), file].join("/");
|
@@ -296871,8 +297046,8 @@ async function downloadAndUnzipTemplate(session, downloadUrl, opts) {
|
|
296871
297046
|
}
|
296872
297047
|
const { templatePath } = opts;
|
296873
297048
|
const zipFile = (0, import_node_path23.join)(templatePath, "template.zip");
|
296874
|
-
(0,
|
296875
|
-
const fileStream = (0,
|
297049
|
+
(0, import_node_fs18.mkdirSync)(templatePath, { recursive: true });
|
297050
|
+
const fileStream = (0, import_node_fs18.createWriteStream)(zipFile);
|
296876
297051
|
await new Promise((resolve7, reject) => {
|
296877
297052
|
var _a6, _b;
|
296878
297053
|
(_a6 = res.body) === null || _a6 === void 0 ? void 0 : _a6.pipe(fileStream);
|
@@ -297015,7 +297190,7 @@ function debugLogger(session) {
|
|
297015
297190
|
}
|
297016
297191
|
|
297017
297192
|
// ../myst-templates/dist/validators.js
|
297018
|
-
var
|
297193
|
+
var import_node_fs19 = __toESM(require("fs"), 1);
|
297019
297194
|
var import_node_path24 = __toESM(require("path"), 1);
|
297020
297195
|
function validateFile(session, input3, opts) {
|
297021
297196
|
const filename = validateString(input3, opts);
|
@@ -297027,7 +297202,7 @@ function validateFile(session, input3, opts) {
|
|
297027
297202
|
} else {
|
297028
297203
|
resolvedFile = import_node_path24.default.resolve(filename);
|
297029
297204
|
}
|
297030
|
-
if (!
|
297205
|
+
if (!import_node_fs19.default.existsSync(resolvedFile)) {
|
297031
297206
|
return validationError(`unable to resolve file: ${filename}`, opts);
|
297032
297207
|
}
|
297033
297208
|
const { copyFolder, relativePathFrom } = opts;
|
@@ -297570,10 +297745,10 @@ var MystTemplate = class {
|
|
297570
297745
|
}
|
297571
297746
|
getTemplateYml() {
|
297572
297747
|
const templateYmlPath = this.getTemplateYmlPath();
|
297573
|
-
if (!
|
297748
|
+
if (!import_node_fs20.default.existsSync(templateYmlPath)) {
|
297574
297749
|
throw new Error(`The template yml at "${templateYmlPath}" does not exist`);
|
297575
297750
|
}
|
297576
|
-
const content3 =
|
297751
|
+
const content3 = import_node_fs20.default.readFileSync(templateYmlPath).toString();
|
297577
297752
|
return js_yaml_default.load(content3);
|
297578
297753
|
}
|
297579
297754
|
getValidatedTemplateYml() {
|
@@ -297654,7 +297829,7 @@ var MystTemplate = class {
|
|
297654
297829
|
return validatedDoc;
|
297655
297830
|
}
|
297656
297831
|
async ensureTemplateExistsOnPath(force) {
|
297657
|
-
if (!force &&
|
297832
|
+
if (!force && import_node_fs20.default.existsSync((0, import_node_path25.join)(this.templatePath, TEMPLATE_YML))) {
|
297658
297833
|
this.session.log.debug(`Template found: ${this.templatePath}`);
|
297659
297834
|
} else if (!this.templateUrl) {
|
297660
297835
|
throw new Error(`No template on path and no download URL to fetch from: ${this.templatePath}`);
|
@@ -297677,7 +297852,7 @@ To list valid templates, try the command "myst templates list"`);
|
|
297677
297852
|
}
|
297678
297853
|
}
|
297679
297854
|
prepare(opts) {
|
297680
|
-
if (!
|
297855
|
+
if (!import_node_fs20.default.existsSync((0, import_node_path25.join)(this.templatePath, TEMPLATE_YML))) {
|
297681
297856
|
throw new Error(`The template at "${(0, import_node_path25.join)(this.templatePath, TEMPLATE_YML)}" does not exist`);
|
297682
297857
|
}
|
297683
297858
|
const fileOpts = { copyFolder: opts.filesPath };
|
@@ -297698,15 +297873,15 @@ To list valid templates, try the command "myst templates list"`);
|
|
297698
297873
|
return;
|
297699
297874
|
const source2 = (0, import_node_path25.join)(this.templatePath, ...file.split("/"));
|
297700
297875
|
const dest = (0, import_node_path25.join)(outputDir, ...file.split("/"));
|
297701
|
-
if (
|
297876
|
+
if (import_node_fs20.default.existsSync(dest)) {
|
297702
297877
|
if (!(opts === null || opts === void 0 ? void 0 : opts.force)) {
|
297703
297878
|
this.session.log.debug(`Template files ${file} already exists, not copying.`);
|
297704
297879
|
return;
|
297705
297880
|
}
|
297706
|
-
|
297881
|
+
import_node_fs20.default.rmSync(dest);
|
297707
297882
|
}
|
297708
|
-
|
297709
|
-
|
297883
|
+
import_node_fs20.default.mkdirSync((0, import_node_path25.dirname)(dest), { recursive: true });
|
297884
|
+
import_node_fs20.default.copyFileSync(source2, dest);
|
297710
297885
|
});
|
297711
297886
|
}
|
297712
297887
|
};
|
@@ -297746,7 +297921,7 @@ async function getMystTemplate(session, opts) {
|
|
297746
297921
|
}
|
297747
297922
|
async function installSiteTemplate(session, mystTemplate) {
|
297748
297923
|
var _a6, _b;
|
297749
|
-
if (
|
297924
|
+
if (import_node_fs21.default.existsSync((0, import_node_path26.join)(mystTemplate.templatePath, "node_modules")))
|
297750
297925
|
return;
|
297751
297926
|
const toc = tic();
|
297752
297927
|
session.log.info("\u2935\uFE0F Installing web libraries (can take up to 60 s)");
|
@@ -297757,7 +297932,7 @@ async function installSiteTemplate(session, mystTemplate) {
|
|
297757
297932
|
}
|
297758
297933
|
|
297759
297934
|
// ../myst-cli/dist/build/utils/collectExportOptions.js
|
297760
|
-
var
|
297935
|
+
var import_node_fs22 = __toESM(require("fs"), 1);
|
297761
297936
|
var import_node_path28 = __toESM(require("path"), 1);
|
297762
297937
|
|
297763
297938
|
// ../myst-cli/dist/build/utils/defaultNames.js
|
@@ -297817,7 +297992,7 @@ function resolveTemplate(sourceFile, exp, disableTemplate) {
|
|
297817
297992
|
return null;
|
297818
297993
|
if (exp.template) {
|
297819
297994
|
const resolvedTemplatePath = import_node_path28.default.resolve(import_node_path28.default.dirname(sourceFile), exp.template);
|
297820
|
-
if (
|
297995
|
+
if (import_node_fs22.default.existsSync(resolvedTemplatePath)) {
|
297821
297996
|
return resolvedTemplatePath;
|
297822
297997
|
}
|
297823
297998
|
}
|
@@ -297844,8 +298019,8 @@ function resolveFormat(vfile2, exp) {
|
|
297844
298019
|
return ExportFormats.typst;
|
297845
298020
|
if ((_c = exp.template) === null || _c === void 0 ? void 0 : _c.endsWith("-docx"))
|
297846
298021
|
return ExportFormats.docx;
|
297847
|
-
if (exp.template &&
|
297848
|
-
const templateFiles =
|
298022
|
+
if (exp.template && import_node_fs22.default.existsSync(exp.template)) {
|
298023
|
+
const templateFiles = import_node_fs22.default.readdirSync(exp.template);
|
297849
298024
|
const templateTexFiles = templateFiles.filter((file) => file.endsWith(".tex"));
|
297850
298025
|
const templateTypFiles = templateFiles.filter((file) => file.endsWith(".typ"));
|
297851
298026
|
if (templateTexFiles.length && !templateTypFiles.length)
|
@@ -297893,7 +298068,7 @@ function resolveArticles(session, sourceFile, vfile2, exp, projectPath) {
|
|
297893
298068
|
if (!article.file)
|
297894
298069
|
return article;
|
297895
298070
|
const resolvedFile = import_node_path28.default.resolve(import_node_path28.default.dirname(sourceFile), article.file);
|
297896
|
-
if (!
|
298071
|
+
if (!import_node_fs22.default.existsSync(resolvedFile)) {
|
297897
298072
|
fileError(vfile2, `Invalid export article - '${article.file}' does not exist`, {
|
297898
298073
|
ruleId: RuleId.exportArticleExists
|
297899
298074
|
});
|
@@ -297903,7 +298078,7 @@ function resolveArticles(session, sourceFile, vfile2, exp, projectPath) {
|
|
297903
298078
|
}).filter((article) => !!article);
|
297904
298079
|
resolved.sub_articles = (_d2 = resolved.sub_articles) === null || _d2 === void 0 ? void 0 : _d2.map((file) => {
|
297905
298080
|
const resolvedFile = import_node_path28.default.resolve(import_node_path28.default.dirname(sourceFile), file);
|
297906
|
-
if (!
|
298081
|
+
if (!import_node_fs22.default.existsSync(resolvedFile)) {
|
297907
298082
|
fileError(vfile2, `Invalid export sub_article - '${file}' does not exist`, {
|
297908
298083
|
ruleId: RuleId.exportArticleExists
|
297909
298084
|
});
|
@@ -298045,7 +298220,7 @@ async function resolvePageExports(session, file) {
|
|
298045
298220
|
], {})).filter((exp) => {
|
298046
298221
|
return [".docx", ".pdf", ".zip", ".xml"].includes(import_node_path29.default.extname(exp.output));
|
298047
298222
|
}).filter((exp) => {
|
298048
|
-
return
|
298223
|
+
return import_node_fs23.default.existsSync(exp.output);
|
298049
298224
|
});
|
298050
298225
|
const exportsAsDownloads = exports2.map((exp) => {
|
298051
298226
|
const { format, output: output2 } = exp;
|
@@ -298210,7 +298385,7 @@ function resolveSiteAction(session, action, file, property) {
|
|
298210
298385
|
};
|
298211
298386
|
}
|
298212
298387
|
const resolvedFile = import_node_path29.default.resolve(import_node_path29.default.dirname(file), action.url);
|
298213
|
-
if (!
|
298388
|
+
if (!import_node_fs23.default.existsSync(resolvedFile)) {
|
298214
298389
|
if (action.static) {
|
298215
298390
|
addWarningForFile(session, file, `Could not find static resource at "${action.url}" in ${property}`, "error", { ruleId: RuleId.staticActionFileCopied });
|
298216
298391
|
return void 0;
|
@@ -298279,16 +298454,109 @@ async function getSiteManifest(session, opts) {
|
|
298279
298454
|
}
|
298280
298455
|
|
298281
298456
|
// ../myst-cli/dist/process/loadReferences.js
|
298282
|
-
var
|
298457
|
+
var import_node_fs24 = __toESM(require("fs"), 1);
|
298458
|
+
|
298459
|
+
// ../myst-cli/dist/transforms/crossReferences.js
|
298460
|
+
var XREF_MAX_AGE = 1;
|
298461
|
+
function mystDataFilename(dataUrl) {
|
298462
|
+
return `myst-${computeHash(dataUrl)}.json`;
|
298463
|
+
}
|
298464
|
+
async function fetchMystData(session, dataUrl, urlSource, vfile2) {
|
298465
|
+
var _a6;
|
298466
|
+
let note;
|
298467
|
+
if (dataUrl) {
|
298468
|
+
const filename = mystDataFilename(dataUrl);
|
298469
|
+
const cacheData = loadFromCache(session, filename, { maxAge: XREF_MAX_AGE });
|
298470
|
+
if (cacheData) {
|
298471
|
+
return JSON.parse(cacheData);
|
298472
|
+
}
|
298473
|
+
try {
|
298474
|
+
const resp = await session.fetch(dataUrl);
|
298475
|
+
if (resp.ok) {
|
298476
|
+
const data = await resp.json();
|
298477
|
+
writeToCache(session, filename, JSON.stringify(data));
|
298478
|
+
return data;
|
298479
|
+
}
|
298480
|
+
} catch {
|
298481
|
+
}
|
298482
|
+
note = "Could not load data from external project";
|
298483
|
+
} else {
|
298484
|
+
note = "Data source URL unavailable";
|
298485
|
+
}
|
298486
|
+
fileWarn(vfile2, `Unable to resolve link text from external MyST reference: ${(_a6 = urlSource !== null && urlSource !== void 0 ? urlSource : dataUrl) !== null && _a6 !== void 0 ? _a6 : ""}`, {
|
298487
|
+
ruleId: RuleId.mystLinkValid,
|
298488
|
+
note
|
298489
|
+
});
|
298490
|
+
return;
|
298491
|
+
}
|
298492
|
+
async function fetchMystLinkData(session, node3, vfile2) {
|
298493
|
+
return fetchMystData(session, node3.dataUrl, node3.urlSource, vfile2);
|
298494
|
+
}
|
298495
|
+
async function fetchMystXRefData(session, node3, vfile2) {
|
298496
|
+
let dataUrl;
|
298497
|
+
if (node3.remoteBaseUrl && node3.dataUrl) {
|
298498
|
+
dataUrl = `${node3.remoteBaseUrl}${node3.dataUrl}`;
|
298499
|
+
}
|
298500
|
+
return fetchMystData(session, dataUrl, node3.urlSource, vfile2);
|
298501
|
+
}
|
298502
|
+
function nodesFromMystXRefData(data, identifier, vfile2, opts) {
|
298503
|
+
const targetNodes = selectMdastNodes(data.mdast, identifier, opts === null || opts === void 0 ? void 0 : opts.maxNodes).nodes;
|
298504
|
+
if (!(targetNodes === null || targetNodes === void 0 ? void 0 : targetNodes.length)) {
|
298505
|
+
fileWarn(vfile2, `Unable to resolve content from external MyST reference: ${opts === null || opts === void 0 ? void 0 : opts.urlSource}`, {
|
298506
|
+
ruleId: RuleId.mystLinkValid,
|
298507
|
+
note: `Could not locate identifier ${identifier} in page content`
|
298508
|
+
});
|
298509
|
+
return;
|
298510
|
+
}
|
298511
|
+
return targetNodes;
|
298512
|
+
}
|
298513
|
+
async function transformMystXRefs(session, vfile2, mdast2, frontmatter) {
|
298514
|
+
const toc = tic();
|
298515
|
+
const nodes = selectAll("link,crossReference", mdast2).filter((node3) => {
|
298516
|
+
return node3.protocol === "xref:myst" && node3.dataUrl;
|
298517
|
+
}).filter((node3) => {
|
298518
|
+
var _a6;
|
298519
|
+
if (!((_a6 = node3.children) === null || _a6 === void 0 ? void 0 : _a6.length))
|
298520
|
+
return true;
|
298521
|
+
return !!node3.identifier;
|
298522
|
+
});
|
298523
|
+
if (nodes.length === 0)
|
298524
|
+
return;
|
298525
|
+
session.log.debug(`Updating link text for ${plural("%s external MyST reference(s)", nodes)}`);
|
298526
|
+
let number2 = 0;
|
298527
|
+
await Promise.all([
|
298528
|
+
...nodes.map(async (node3) => {
|
298529
|
+
var _a6, _b, _c;
|
298530
|
+
if (!node3.identifier) {
|
298531
|
+
const data = await fetchMystLinkData(session, node3, vfile2);
|
298532
|
+
if (!data)
|
298533
|
+
return;
|
298534
|
+
node3.children = [{ type: "text", value: (_c = (_b = (_a6 = data.frontmatter) === null || _a6 === void 0 ? void 0 : _a6.title) !== null && _b !== void 0 ? _b : data.slug) !== null && _c !== void 0 ? _c : "" }];
|
298535
|
+
} else {
|
298536
|
+
const data = await fetchMystXRefData(session, node3, vfile2);
|
298537
|
+
if (!data)
|
298538
|
+
return;
|
298539
|
+
const targets = nodesFromMystXRefData(data, node3.identifier, vfile2, {
|
298540
|
+
urlSource: node3.urlSource,
|
298541
|
+
maxNodes: 1
|
298542
|
+
});
|
298543
|
+
if (targets === null || targets === void 0 ? void 0 : targets.length) {
|
298544
|
+
addChildrenFromTargetNode(node3, targets[0], frontmatter.numbering, vfile2);
|
298545
|
+
}
|
298546
|
+
}
|
298547
|
+
number2 += 1;
|
298548
|
+
})
|
298549
|
+
]);
|
298550
|
+
const denominator = number2 === nodes.length ? "" : `/${nodes.length}`;
|
298551
|
+
session.log.info(toc(`\u{1FA84} Updated link text for ${plural(`%s${denominator} external MyST reference(s)`, number2)} in %s seconds`));
|
298552
|
+
}
|
298553
|
+
|
298554
|
+
// ../myst-cli/dist/process/loadReferences.js
|
298283
298555
|
var import_node_path30 = require("path");
|
298284
|
-
function
|
298556
|
+
function inventoryCacheFilename(refKind, id, path42) {
|
298285
298557
|
const hashcontent = `${id}${path42}`;
|
298286
298558
|
const ext2 = refKind === "intersphinx" ? "inv" : "json";
|
298287
|
-
|
298288
|
-
const cacheFolder = (0, import_node_path30.join)(session.buildPath(), "cache");
|
298289
|
-
if (!import_node_fs23.default.existsSync(cacheFolder))
|
298290
|
-
import_node_fs23.default.mkdirSync(cacheFolder, { recursive: true });
|
298291
|
-
return (0, import_node_path30.join)(cacheFolder, filename);
|
298559
|
+
return `xrefs-${refKind}-${computeHash(hashcontent)}.${ext2}`;
|
298292
298560
|
}
|
298293
298561
|
async function preloadReference(session, key2, reference) {
|
298294
298562
|
const ref = {
|
@@ -298296,26 +298564,31 @@ async function preloadReference(session, key2, reference) {
|
|
298296
298564
|
url: reference.url,
|
298297
298565
|
kind: reference.kind
|
298298
298566
|
};
|
298299
|
-
const
|
298300
|
-
const
|
298301
|
-
|
298302
|
-
|
298303
|
-
|
298304
|
-
|
298305
|
-
|
298567
|
+
const toc = tic();
|
298568
|
+
const mystXRefFilename = inventoryCacheFilename("myst", key2, reference.url);
|
298569
|
+
const mystXRefData = loadFromCache(session, mystXRefFilename, {
|
298570
|
+
maxAge: XREF_MAX_AGE
|
298571
|
+
});
|
298572
|
+
const intersphinxFilename = inventoryCacheFilename("intersphinx", key2, reference.url);
|
298573
|
+
if ((!ref.kind || ref.kind === "myst") && !!mystXRefData) {
|
298574
|
+
session.log.debug(`Loading cached inventory file for ${reference.url}: ${mystXRefFilename}`);
|
298575
|
+
const xrefs = JSON.parse(mystXRefData);
|
298576
|
+
session.log.info(toc(`\u{1F3EB} Read ${xrefs.references.length} myst references for "${key2}" in %s (cached).`));
|
298306
298577
|
ref.kind = "myst";
|
298307
298578
|
ref.value = xrefs;
|
298308
|
-
} else if ((!ref.kind || ref.kind === "intersphinx") &&
|
298579
|
+
} else if ((!ref.kind || ref.kind === "intersphinx") && checkCache(session, intersphinxFilename, { maxAge: XREF_MAX_AGE })) {
|
298309
298580
|
const inventory = new Inventory({ id: key2, path: reference.url });
|
298310
|
-
const localInventory = new Inventory({
|
298311
|
-
|
298312
|
-
|
298581
|
+
const localInventory = new Inventory({
|
298582
|
+
id: key2,
|
298583
|
+
path: cachePath(session, intersphinxFilename)
|
298584
|
+
});
|
298585
|
+
session.log.debug(`Loading cached inventory file for ${reference.url}: ${intersphinxFilename}`);
|
298313
298586
|
await localInventory.load();
|
298314
298587
|
inventory.project = localInventory.project;
|
298315
298588
|
inventory.version = localInventory.version;
|
298316
298589
|
inventory.data = localInventory.data;
|
298317
298590
|
inventory._loaded = true;
|
298318
|
-
session.log.info(toc(`\u{1F3EB} Read ${inventory.numEntries} references
|
298591
|
+
session.log.info(toc(`\u{1F3EB} Read ${inventory.numEntries} intersphinx references for "${key2}" in %s (cached).`));
|
298319
298592
|
ref.kind = "intersphinx";
|
298320
298593
|
ref.value = inventory;
|
298321
298594
|
}
|
@@ -298333,15 +298606,19 @@ async function loadReference(session, vfile2, reference) {
|
|
298333
298606
|
const mystXRefsUrl = `${reference.url}/myst.xref.json`;
|
298334
298607
|
session.log.debug(`Attempting to load MyST xref file: ${mystXRefsUrl}`);
|
298335
298608
|
const toc = tic();
|
298336
|
-
|
298337
|
-
|
298609
|
+
let mystXRefsResp;
|
298610
|
+
try {
|
298611
|
+
mystXRefsResp = await session.fetch(mystXRefsUrl);
|
298612
|
+
} catch {
|
298613
|
+
session.log.debug(`Request to ${mystXRefsUrl} failed`);
|
298614
|
+
}
|
298615
|
+
if ((mystXRefsResp === null || mystXRefsResp === void 0 ? void 0 : mystXRefsResp.status) === 200) {
|
298338
298616
|
reference.kind = "myst";
|
298339
|
-
const mystXRefs = await mystXRefsResp.json();
|
298617
|
+
const mystXRefs = await (mystXRefsResp === null || mystXRefsResp === void 0 ? void 0 : mystXRefsResp.json());
|
298618
|
+
session.log.debug(`Saving remote myst xref file to cache: ${reference.url}`);
|
298619
|
+
writeToCache(session, inventoryCacheFilename("myst", reference.key, reference.url), JSON.stringify(mystXRefs));
|
298340
298620
|
reference.value = mystXRefs;
|
298341
|
-
|
298342
|
-
session.log.debug(`Saving remote myst xref file to cache ${reference.url}: ${cachePath}`);
|
298343
|
-
writeFileToFolder(cachePath, JSON.stringify(mystXRefs));
|
298344
|
-
session.log.info(toc(`\u{1F3EB} Read ${mystXRefs.references.length} references for "${reference.key}" in %s.`));
|
298621
|
+
session.log.info(toc(`\u{1F3EB} Read ${mystXRefs.references.length} myst references for "${reference.key}" in %s.`));
|
298345
298622
|
return reference;
|
298346
298623
|
} else if (reference.kind === "myst") {
|
298347
298624
|
fileError(vfile2, `Problem fetching references entry: ${reference.key} (${mystXRefsUrl})`, {
|
@@ -298371,15 +298648,24 @@ ${error === null || error === void 0 ? void 0 : error.stack}
|
|
298371
298648
|
} else {
|
298372
298649
|
session.log.debug(`Unable to load reference "${reference.key}" as intersphinx`);
|
298373
298650
|
}
|
298374
|
-
return
|
298651
|
+
return;
|
298375
298652
|
}
|
298376
|
-
|
298377
|
-
|
298378
|
-
|
298379
|
-
inventory.
|
298653
|
+
reference.kind = "intersphinx";
|
298654
|
+
reference.value = inventory;
|
298655
|
+
if (inventory.id && inventory.path && isUrl(inventory.path)) {
|
298656
|
+
const intersphinxPath = cachePath(session, inventoryCacheFilename("intersphinx", inventory.id, inventory.path));
|
298657
|
+
if (!import_node_fs24.default.existsSync(intersphinxPath)) {
|
298658
|
+
session.log.debug(`Saving remote inventory file to cache: ${inventory.path}`);
|
298659
|
+
import_node_fs24.default.mkdirSync((0, import_node_path30.dirname)(intersphinxPath), { recursive: true });
|
298660
|
+
inventory.write(intersphinxPath);
|
298661
|
+
}
|
298380
298662
|
}
|
298381
|
-
session.log.info(toc(`\u{1F3EB} Read ${inventory.numEntries} references for "${inventory.id}" in %s.`));
|
298663
|
+
session.log.info(toc(`\u{1F3EB} Read ${inventory.numEntries} intersphinx references for "${inventory.id}" in %s.`));
|
298664
|
+
return reference;
|
298382
298665
|
}
|
298666
|
+
fileError(vfile2, `Unable to resolve references: ${reference.key} (${reference.url})`, {
|
298667
|
+
ruleId: RuleId.intersphinxReferencesResolve
|
298668
|
+
});
|
298383
298669
|
}
|
298384
298670
|
async function loadReferences(session, opts) {
|
298385
298671
|
const state = session.store.getState();
|
@@ -298402,7 +298688,7 @@ async function loadReferences(session, opts) {
|
|
298402
298688
|
}
|
298403
298689
|
|
298404
298690
|
// ../myst-cli/dist/process/mdast.js
|
298405
|
-
var
|
298691
|
+
var import_node_path37 = __toESM(require("path"), 1);
|
298406
298692
|
|
298407
298693
|
// ../myst-cli/dist/transforms/citations.js
|
298408
298694
|
function pushCite(references, citeRenderer, label) {
|
@@ -298656,77 +298942,14 @@ function transformLiftCodeBlocksInJupytext(mdast2) {
|
|
298656
298942
|
mdast2.children = flattened;
|
298657
298943
|
}
|
298658
298944
|
|
298659
|
-
// ../myst-cli/dist/transforms/crossReferences.js
|
298660
|
-
async function transformMystXRefs(session, vfile2, mdast2, frontmatter) {
|
298661
|
-
const toc = tic();
|
298662
|
-
const nodes = selectAll("link,crossReference", mdast2).filter((node3) => {
|
298663
|
-
return node3.protocol === "xref:myst" && node3.dataUrl;
|
298664
|
-
}).filter((node3) => {
|
298665
|
-
var _a6;
|
298666
|
-
if (!((_a6 = node3.children) === null || _a6 === void 0 ? void 0 : _a6.length))
|
298667
|
-
return true;
|
298668
|
-
return !!node3.identifier;
|
298669
|
-
});
|
298670
|
-
if (nodes.length === 0)
|
298671
|
-
return;
|
298672
|
-
session.log.debug(`Updating link text for ${plural("%s external MyST reference(s)", nodes)}`);
|
298673
|
-
let number2 = 0;
|
298674
|
-
let data;
|
298675
|
-
await Promise.all([
|
298676
|
-
...nodes.map(async (node3) => {
|
298677
|
-
var _a6, _b, _c;
|
298678
|
-
try {
|
298679
|
-
const resp = await fetch(node3.dataUrl);
|
298680
|
-
if (resp.ok) {
|
298681
|
-
data = await resp.json();
|
298682
|
-
}
|
298683
|
-
} catch {
|
298684
|
-
}
|
298685
|
-
if (!data) {
|
298686
|
-
fileWarn(vfile2, `Unable to resolve link text from external MyST reference: ${node3.urlSource}`, { ruleId: RuleId.mystLinkValid, note: "Could not load data from external project" });
|
298687
|
-
return;
|
298688
|
-
}
|
298689
|
-
if (!node3.identifier) {
|
298690
|
-
node3.children = [{ type: "text", value: (_c = (_b = (_a6 = data.frontmatter) === null || _a6 === void 0 ? void 0 : _a6.title) !== null && _b !== void 0 ? _b : data.slug) !== null && _c !== void 0 ? _c : "" }];
|
298691
|
-
} else {
|
298692
|
-
const targets = selectAll(`[identifier=${node3.identifier}]`, data.mdast);
|
298693
|
-
const target = targets.find((t2) => {
|
298694
|
-
return !["crossReference", "cite", "footnoteDefinition", "footnoteReference"].includes(t2.type);
|
298695
|
-
});
|
298696
|
-
if (!target) {
|
298697
|
-
fileWarn(vfile2, `Unable to resolve link text from external MyST reference: ${node3.urlSource}`, {
|
298698
|
-
ruleId: RuleId.mystLinkValid,
|
298699
|
-
note: `Could not locate identifier ${node3.identifier} in page content`
|
298700
|
-
});
|
298701
|
-
return;
|
298702
|
-
}
|
298703
|
-
addChildrenFromTargetNode(node3, target, frontmatter.numbering, vfile2);
|
298704
|
-
}
|
298705
|
-
number2 += 1;
|
298706
|
-
})
|
298707
|
-
]);
|
298708
|
-
const denominator = number2 === nodes.length ? "" : `/${nodes.length}`;
|
298709
|
-
session.log.info(toc(`\u{1FA84} Updated link text for ${plural(`%s${denominator} external MyST reference(s)`, number2)} in %s seconds`));
|
298710
|
-
}
|
298711
|
-
|
298712
298945
|
// ../myst-cli/dist/transforms/dois.js
|
298713
|
-
var import_node_fs24 = __toESM(require("fs"), 1);
|
298714
|
-
var import_node_path31 = require("path");
|
298715
298946
|
var CSL_JSON_MIMETYPE = "application/vnd.citationstyles.csl+json";
|
298716
298947
|
var BIBTEX_MIMETYPE = "application/x-bibtex";
|
298717
|
-
function
|
298718
|
-
|
298719
|
-
|
298720
|
-
|
298721
|
-
|
298722
|
-
return (0, import_node_path31.join)(cacheFolder, filename);
|
298723
|
-
}
|
298724
|
-
function doiResolvesCacheFile(session, normalizedDoi) {
|
298725
|
-
const filename = `doi-${computeHash(normalizedDoi)}.txt`;
|
298726
|
-
const cacheFolder = (0, import_node_path31.join)(session.buildPath(), "cache");
|
298727
|
-
if (!import_node_fs24.default.existsSync(cacheFolder))
|
298728
|
-
import_node_fs24.default.mkdirSync(cacheFolder, { recursive: true });
|
298729
|
-
return (0, import_node_path31.join)(cacheFolder, filename);
|
298948
|
+
function doiCSLJSONCacheFilename(normalizedDoi) {
|
298949
|
+
return `doi-${computeHash(normalizedDoi)}.csl.json`;
|
298950
|
+
}
|
298951
|
+
function doiResolvesCacheFilename(normalizedDoi) {
|
298952
|
+
return `doi-${computeHash(normalizedDoi)}.txt`;
|
298730
298953
|
}
|
298731
298954
|
async function resolveDOIAsBibTeX(session, url) {
|
298732
298955
|
session.log.debug("Fetching DOI BibTeX from doi.org");
|
@@ -298763,9 +298986,9 @@ async function resolveDoiOrg(session, doiString) {
|
|
298763
298986
|
const url = doi.buildUrl(doiString);
|
298764
298987
|
if (!doi.validate(doiString) || !normalizedDoi || !url)
|
298765
298988
|
return void 0;
|
298766
|
-
const
|
298767
|
-
|
298768
|
-
|
298989
|
+
const filename = doiCSLJSONCacheFilename(normalizedDoi);
|
298990
|
+
const cached = loadFromCache(session, filename);
|
298991
|
+
if (cached) {
|
298769
298992
|
session.log.debug(`Loaded cached reference CSL-JSON for doi:${normalizedDoi}`);
|
298770
298993
|
return JSON.parse(cached);
|
298771
298994
|
}
|
@@ -298795,8 +299018,8 @@ async function resolveDoiOrg(session, doiString) {
|
|
298795
299018
|
}
|
298796
299019
|
if (!data)
|
298797
299020
|
return void 0;
|
298798
|
-
session.log.debug(`Saving DOI CSL-JSON to cache ${
|
298799
|
-
|
299021
|
+
session.log.debug(`Saving DOI CSL-JSON to cache ${filename}`);
|
299022
|
+
writeToCache(session, filename, JSON.stringify(data));
|
298800
299023
|
return data;
|
298801
299024
|
}
|
298802
299025
|
async function doiOrgResolves(session, doiString) {
|
@@ -298804,8 +299027,9 @@ async function doiOrgResolves(session, doiString) {
|
|
298804
299027
|
const url = doi.buildUrl(doiString);
|
298805
299028
|
if (!doi.validate(doiString) || !normalizedDoi || !url)
|
298806
299029
|
return false;
|
298807
|
-
const
|
298808
|
-
|
299030
|
+
const filename = doiResolvesCacheFilename(normalizedDoi);
|
299031
|
+
const cached = loadFromCache(session, filename);
|
299032
|
+
if (cached) {
|
298809
299033
|
session.log.debug(`Loaded cached resolution result for doi:${normalizedDoi}`);
|
298810
299034
|
return true;
|
298811
299035
|
}
|
@@ -298820,8 +299044,8 @@ async function doiOrgResolves(session, doiString) {
|
|
298820
299044
|
return false;
|
298821
299045
|
}
|
298822
299046
|
session.log.debug(toc(`Resolved doi existence for doi:${normalizedDoi} in %s`));
|
298823
|
-
session.log.debug(`Saving resolution result to cache ${
|
298824
|
-
|
299047
|
+
session.log.debug(`Saving resolution result to cache ${filename}`);
|
299048
|
+
writeToCache(session, filename, "ok");
|
298825
299049
|
return true;
|
298826
299050
|
}
|
298827
299051
|
async function getCitation(session, vfile2, doiString, node3) {
|
@@ -298929,6 +299153,81 @@ async function transformLinkedDOIs(session, vfile2, mdast2, doiRenderer, path42)
|
|
298929
299153
|
return renderer;
|
298930
299154
|
}
|
298931
299155
|
|
299156
|
+
// ../myst-cli/dist/transforms/ror.js
|
299157
|
+
var ROR_MAX_AGE = 30;
|
299158
|
+
function rorCacheFilename(ror) {
|
299159
|
+
return `ror-${computeHash(ror)}.json`;
|
299160
|
+
}
|
299161
|
+
async function resolveRORAsJSON(session, ror) {
|
299162
|
+
const url = `https://api.ror.org/organizations/${ror}`;
|
299163
|
+
session.log.debug(`Fetching ROR JSON from ${url}`);
|
299164
|
+
const response = await session.fetch(url).catch(() => {
|
299165
|
+
session.log.debug(`Request to ${url} failed.`);
|
299166
|
+
return void 0;
|
299167
|
+
});
|
299168
|
+
if (!response || !response.ok) {
|
299169
|
+
session.log.debug(`ROR fetch failed for ${url}`);
|
299170
|
+
return void 0;
|
299171
|
+
}
|
299172
|
+
const data = await response.json();
|
299173
|
+
return data;
|
299174
|
+
}
|
299175
|
+
async function resolveROR(session, vfile2, node3, ror) {
|
299176
|
+
if (!ror)
|
299177
|
+
return void 0;
|
299178
|
+
const filename = rorCacheFilename(ror);
|
299179
|
+
const cached = loadFromCache(session, filename, { maxAge: ROR_MAX_AGE });
|
299180
|
+
if (cached)
|
299181
|
+
return JSON.parse(cached);
|
299182
|
+
const toc = tic();
|
299183
|
+
let data;
|
299184
|
+
try {
|
299185
|
+
data = await resolveRORAsJSON(session, ror);
|
299186
|
+
if (data) {
|
299187
|
+
session.log.debug(toc(`Fetched ROR JSON for ror:${ror} in %s`));
|
299188
|
+
} else {
|
299189
|
+
fileError(vfile2, `Could not find ROR "${ror}" from https://ror.org/${ror}`, {
|
299190
|
+
node: node3,
|
299191
|
+
ruleId: RuleId.rorLinkValid,
|
299192
|
+
note: `Please check the ROR is correct and has a page at https://ror.org/${ror}`
|
299193
|
+
});
|
299194
|
+
session.log.debug(`JSON not available from ror.org for ror:${ror}`);
|
299195
|
+
}
|
299196
|
+
} catch (error) {
|
299197
|
+
session.log.debug(`JSON from ror.org was malformed for ror:${ror}`);
|
299198
|
+
}
|
299199
|
+
if (!data)
|
299200
|
+
return void 0;
|
299201
|
+
writeToCache(session, filename, JSON.stringify(data));
|
299202
|
+
return data;
|
299203
|
+
}
|
299204
|
+
async function transformLinkedRORs(session, vfile2, mdast2, path42) {
|
299205
|
+
const toc = tic();
|
299206
|
+
const linkedRORs = selectAll("link[protocol=ror]", mdast2);
|
299207
|
+
if (linkedRORs.length === 0)
|
299208
|
+
return;
|
299209
|
+
session.log.debug(`Found ${plural("%s ROR(s)", linkedRORs.length)} to auto link.`);
|
299210
|
+
let number2 = 0;
|
299211
|
+
await Promise.all([
|
299212
|
+
...linkedRORs.map(async (node3) => {
|
299213
|
+
var _a6;
|
299214
|
+
const ror = (_a6 = node3.data) === null || _a6 === void 0 ? void 0 : _a6.ror;
|
299215
|
+
if (!ror)
|
299216
|
+
return;
|
299217
|
+
number2 += 1;
|
299218
|
+
const rorData = await resolveROR(session, vfile2, node3, ror);
|
299219
|
+
if (rorData && toText(node3.children) === ror) {
|
299220
|
+
node3.children = [{ type: "text", value: rorData.name }];
|
299221
|
+
}
|
299222
|
+
return true;
|
299223
|
+
})
|
299224
|
+
]);
|
299225
|
+
if (number2 > 0) {
|
299226
|
+
session.log.info(toc(`\u{1FA84} Linked ${plural("%s ROR(s)", number2)} in %s for ${path42}`));
|
299227
|
+
}
|
299228
|
+
return;
|
299229
|
+
}
|
299230
|
+
|
298932
299231
|
// ../../node_modules/unist-util-filter/lib/index.js
|
298933
299232
|
var own16 = {}.hasOwnProperty;
|
298934
299233
|
var filter2 = (
|
@@ -298980,146 +299279,11 @@ var filter2 = (
|
|
298980
299279
|
}
|
298981
299280
|
);
|
298982
299281
|
|
298983
|
-
// ../myst-cli/dist/transforms/embed.js
|
298984
|
-
function embedTransform(session, mdast2, file, dependencies, state) {
|
298985
|
-
const embedNodes = selectAll("embed", mdast2);
|
298986
|
-
embedNodes.forEach((node3) => {
|
298987
|
-
var _a6, _b, _c, _d2;
|
298988
|
-
const normalized = normalizeLabel((_a6 = node3.source) === null || _a6 === void 0 ? void 0 : _a6.label);
|
298989
|
-
if (!normalized)
|
298990
|
-
return;
|
298991
|
-
const target = state.getTarget(normalized.identifier);
|
298992
|
-
if (!target)
|
298993
|
-
return;
|
298994
|
-
let newNode = copyNode(target.node);
|
298995
|
-
if (newNode && node3["remove-output"]) {
|
298996
|
-
newNode = filter2(newNode, (n) => {
|
298997
|
-
var _a7;
|
298998
|
-
return n.type !== "output" && ((_a7 = n.data) === null || _a7 === void 0 ? void 0 : _a7.type) !== "output";
|
298999
|
-
});
|
299000
|
-
}
|
299001
|
-
if (newNode && node3["remove-input"]) {
|
299002
|
-
newNode = filter2(newNode, (n) => {
|
299003
|
-
var _a7;
|
299004
|
-
return n.type !== "code" || ((_a7 = n.data) === null || _a7 === void 0 ? void 0 : _a7.type) === "output";
|
299005
|
-
});
|
299006
|
-
}
|
299007
|
-
selectAll("[identifier],[label],[html_id]", newNode).forEach((idNode) => {
|
299008
|
-
delete idNode.identifier;
|
299009
|
-
delete idNode.label;
|
299010
|
-
delete idNode.html_id;
|
299011
|
-
});
|
299012
|
-
if (!newNode) {
|
299013
|
-
node3.children = [];
|
299014
|
-
} else if (newNode.type === "block") {
|
299015
|
-
node3.children = newNode.children;
|
299016
|
-
} else {
|
299017
|
-
node3.children = [newNode];
|
299018
|
-
}
|
299019
|
-
const multiState = state;
|
299020
|
-
if (!multiState.states)
|
299021
|
-
return;
|
299022
|
-
const { url, filePath } = (_b = multiState.resolveStateProvider(normalized.identifier)) !== null && _b !== void 0 ? _b : {};
|
299023
|
-
if (!url)
|
299024
|
-
return;
|
299025
|
-
const source2 = { url, label: (_c = node3.source) === null || _c === void 0 ? void 0 : _c.label };
|
299026
|
-
if (filePath) {
|
299027
|
-
session.store.dispatch(watch.actions.addLocalDependency({
|
299028
|
-
path: file,
|
299029
|
-
dependency: filePath
|
299030
|
-
}));
|
299031
|
-
const { kind, slug, frontmatter, location: location4 } = (_d2 = selectFile(session, filePath)) !== null && _d2 !== void 0 ? _d2 : {};
|
299032
|
-
if (kind)
|
299033
|
-
source2.kind = kind;
|
299034
|
-
if (slug)
|
299035
|
-
source2.slug = slug;
|
299036
|
-
if (location4)
|
299037
|
-
source2.location = location4;
|
299038
|
-
if (frontmatter === null || frontmatter === void 0 ? void 0 : frontmatter.title)
|
299039
|
-
source2.title = frontmatter.title;
|
299040
|
-
if (frontmatter === null || frontmatter === void 0 ? void 0 : frontmatter.short_title)
|
299041
|
-
source2.short_title = frontmatter.short_title;
|
299042
|
-
}
|
299043
|
-
node3.source = source2;
|
299044
|
-
if (!dependencies.map((dep) => dep.url).includes(url))
|
299045
|
-
dependencies.push(source2);
|
299046
|
-
});
|
299047
|
-
const containerNodes = selectAll("container", mdast2);
|
299048
|
-
containerNodes.forEach((node3) => {
|
299049
|
-
var _a6, _b;
|
299050
|
-
const containerEmbeds = (_a6 = node3.children) === null || _a6 === void 0 ? void 0 : _a6.filter((child) => child.type === "embed");
|
299051
|
-
if ((containerEmbeds === null || containerEmbeds === void 0 ? void 0 : containerEmbeds.length) === 1) {
|
299052
|
-
node3.source = { ...containerEmbeds[0].source };
|
299053
|
-
containerEmbeds[0].type = "_lift";
|
299054
|
-
if (((_b = containerEmbeds[0].children) === null || _b === void 0 ? void 0 : _b.length) === 1 && containerEmbeds[0].children[0].type === "container") {
|
299055
|
-
containerEmbeds[0].children[0].type = "_lift";
|
299056
|
-
remove(containerEmbeds[0].children[0], "caption");
|
299057
|
-
remove(containerEmbeds[0].children[0], "legend");
|
299058
|
-
}
|
299059
|
-
}
|
299060
|
-
});
|
299061
|
-
const remainingEmbedNodes = selectAll("embed", mdast2);
|
299062
|
-
remainingEmbedNodes.forEach((node3) => {
|
299063
|
-
var _a6;
|
299064
|
-
if (((_a6 = node3.children) === null || _a6 === void 0 ? void 0 : _a6.length) === 1 && node3.children[0].type === "container") {
|
299065
|
-
node3.children[0].source = { ...node3.source };
|
299066
|
-
node3.type = "_lift";
|
299067
|
-
}
|
299068
|
-
});
|
299069
|
-
liftChildren(mdast2, "_lift");
|
299070
|
-
}
|
299071
|
-
|
299072
|
-
// ../myst-cli/dist/transforms/include.js
|
299073
|
-
var import_node_path32 = __toESM(require("path"), 1);
|
299074
|
-
var import_node_fs25 = __toESM(require("fs"), 1);
|
299075
|
-
var makeFileResolver = (baseFile) => (relativeFile, sourceFile, vfile2) => {
|
299076
|
-
const base5 = sourceFile.toLowerCase().endsWith(".tex") ? baseFile : sourceFile;
|
299077
|
-
const fullFile = import_node_path32.default.resolve(import_node_path32.default.dirname(base5), relativeFile);
|
299078
|
-
if (!import_node_fs25.default.existsSync(fullFile)) {
|
299079
|
-
fileError(vfile2, `Include Directive: Could not find "${relativeFile}" relative to "${base5}"`, {
|
299080
|
-
ruleId: RuleId.includeContentLoads
|
299081
|
-
});
|
299082
|
-
return;
|
299083
|
-
}
|
299084
|
-
return fullFile;
|
299085
|
-
};
|
299086
|
-
var makeFileLoader = (session, baseFile) => (fullFile) => {
|
299087
|
-
session.store.dispatch(watch.actions.addLocalDependency({
|
299088
|
-
path: baseFile,
|
299089
|
-
dependency: fullFile
|
299090
|
-
}));
|
299091
|
-
return import_node_fs25.default.readFileSync(fullFile).toString();
|
299092
|
-
};
|
299093
|
-
var makeContentParser = (session, file) => async (filename, content3) => {
|
299094
|
-
if (filename.toLowerCase().endsWith(".html")) {
|
299095
|
-
const mdast2 = { type: "root", children: [{ type: "html", value: content3 }] };
|
299096
|
-
return { mdast: mdast2, kind: SourceFileKind.Article };
|
299097
|
-
}
|
299098
|
-
const opts = { keepTitleNode: true };
|
299099
|
-
if (filename.toLowerCase().endsWith(".tex")) {
|
299100
|
-
return loadTexFile(session, content3, file, opts);
|
299101
|
-
}
|
299102
|
-
if (filename.toLowerCase().endsWith(".ipynb")) {
|
299103
|
-
return loadNotebookFile(session, content3, file, opts);
|
299104
|
-
}
|
299105
|
-
return loadMdFile(session, content3, file, opts);
|
299106
|
-
};
|
299107
|
-
async function includeFilesTransform(session, baseFile, tree, frontmatter, vfile2) {
|
299108
|
-
const parseContent = makeContentParser(session, baseFile);
|
299109
|
-
const loadFile2 = makeFileLoader(session, baseFile);
|
299110
|
-
const resolveFile = makeFileResolver(baseFile);
|
299111
|
-
await includeDirectiveTransform(tree, frontmatter, vfile2, {
|
299112
|
-
resolveFile,
|
299113
|
-
loadFile: loadFile2,
|
299114
|
-
parseContent,
|
299115
|
-
sourceFile: baseFile
|
299116
|
-
});
|
299117
|
-
}
|
299118
|
-
|
299119
299282
|
// ../myst-cli/dist/transforms/links.js
|
299120
|
-
var
|
299121
|
-
var
|
299283
|
+
var import_node_fs25 = __toESM(require("fs"), 1);
|
299284
|
+
var import_node_path31 = __toESM(require("path"), 1);
|
299122
299285
|
var import_p_limit = __toESM(require_p_limit(), 1);
|
299286
|
+
var LINK_MAX_AGE = 30;
|
299123
299287
|
var skippedDomains = [
|
299124
299288
|
"www.linkedin.com",
|
299125
299289
|
"linkedin.com",
|
@@ -299127,20 +299291,8 @@ var skippedDomains = [
|
|
299127
299291
|
"twitter.com",
|
299128
299292
|
"en.wikipedia.org"
|
299129
299293
|
];
|
299130
|
-
function
|
299131
|
-
|
299132
|
-
return import_node_path33.default.join(session.buildPath(), "cache", filename);
|
299133
|
-
}
|
299134
|
-
function writeLinkCache(session, link4) {
|
299135
|
-
session.log.debug(`Writing successful link check to cache file for "${link4.url}"`);
|
299136
|
-
writeFileToFolder(checkLinkCacheFile(session, link4.url), JSON.stringify(link4, null, 2));
|
299137
|
-
}
|
299138
|
-
function loadLinkCache(session, url) {
|
299139
|
-
const cacheFile = checkLinkCacheFile(session, url);
|
299140
|
-
if (!import_node_fs26.default.existsSync(cacheFile))
|
299141
|
-
return;
|
299142
|
-
session.log.debug(`Using cached success for "${url}"`);
|
299143
|
-
return JSON.parse(import_node_fs26.default.readFileSync(cacheFile).toString());
|
299294
|
+
function checkLinkCacheFilename(url) {
|
299295
|
+
return `checkLink-${computeHash(url)}.json`;
|
299144
299296
|
}
|
299145
299297
|
async function checkLink(session, url) {
|
299146
299298
|
const cached = selectors_exports.selectLinkStatus(session.store.getState(), url);
|
@@ -299164,13 +299316,14 @@ async function checkLink(session, url) {
|
|
299164
299316
|
return link4;
|
299165
299317
|
}
|
299166
299318
|
session.log.debug(`Checking that "${url}" exists`);
|
299167
|
-
const
|
299168
|
-
const
|
299319
|
+
const filename = checkLinkCacheFilename(url);
|
299320
|
+
const linkCache = loadFromCache(session, filename, { maxAge: LINK_MAX_AGE });
|
299321
|
+
const resp = linkCache ? JSON.parse(linkCache) : await session.fetch(url, { headers: EXT_REQUEST_HEADERS });
|
299169
299322
|
link4.ok = resp.ok;
|
299170
299323
|
link4.status = resp.status;
|
299171
299324
|
link4.statusText = resp.statusText;
|
299172
299325
|
if (link4.ok && !linkCache) {
|
299173
|
-
|
299326
|
+
writeToCache(session, filename, JSON.stringify(link4));
|
299174
299327
|
}
|
299175
299328
|
} catch (error) {
|
299176
299329
|
session.log.debug(`
|
@@ -299184,22 +299337,20 @@ ${error === null || error === void 0 ? void 0 : error.stack}
|
|
299184
299337
|
session.store.dispatch(links.actions.updateLink(link4));
|
299185
299338
|
return link4;
|
299186
299339
|
}
|
299187
|
-
function fileFromRelativePath(pathFromLink, file
|
299340
|
+
function fileFromRelativePath(pathFromLink, file) {
|
299188
299341
|
let target;
|
299189
299342
|
[pathFromLink, ...target] = pathFromLink.split("#");
|
299190
299343
|
pathFromLink = decodeURIComponent(pathFromLink);
|
299191
|
-
if (!sitePath)
|
299192
|
-
sitePath = ".";
|
299193
299344
|
if (file) {
|
299194
|
-
pathFromLink =
|
299345
|
+
pathFromLink = import_node_path31.default.resolve(import_node_path31.default.dirname(file), pathFromLink);
|
299195
299346
|
}
|
299196
|
-
if (
|
299347
|
+
if (import_node_fs25.default.existsSync(pathFromLink) && import_node_fs25.default.lstatSync(pathFromLink).isDirectory()) {
|
299197
299348
|
return void 0;
|
299198
299349
|
}
|
299199
|
-
if (!
|
299200
|
-
if (
|
299350
|
+
if (!import_node_fs25.default.existsSync(pathFromLink)) {
|
299351
|
+
if (import_node_fs25.default.existsSync(`${pathFromLink}.md`)) {
|
299201
299352
|
pathFromLink = `${pathFromLink}.md`;
|
299202
|
-
} else if (
|
299353
|
+
} else if (import_node_fs25.default.existsSync(`${pathFromLink}.ipynb`)) {
|
299203
299354
|
pathFromLink = `${pathFromLink}.ipynb`;
|
299204
299355
|
} else {
|
299205
299356
|
return void 0;
|
@@ -299225,13 +299376,25 @@ var StaticFileTransformer = class {
|
|
299225
299376
|
if (!linkFileWithTarget) {
|
299226
299377
|
return false;
|
299227
299378
|
}
|
299228
|
-
const [linkFile
|
299379
|
+
const [linkFile] = linkFileWithTarget.split("#");
|
299380
|
+
const target = linkFileWithTarget.slice(linkFile.length + 1);
|
299381
|
+
const reference = normalizeLabel(target);
|
299229
299382
|
const { url, title, dataUrl } = selectors_exports.selectFileInfo(this.session.store.getState(), linkFile) || {};
|
299230
299383
|
if (url != null && link4.static !== true) {
|
299231
|
-
link4.url = [url, ...target || []].join("#");
|
299232
|
-
link4.internal = true;
|
299233
299384
|
if (dataUrl)
|
299234
299385
|
link4.dataUrl = dataUrl;
|
299386
|
+
if (reference) {
|
299387
|
+
const xref = link4;
|
299388
|
+
xref.type = "crossReference";
|
299389
|
+
xref.identifier = reference.identifier;
|
299390
|
+
xref.label = reference.label;
|
299391
|
+
xref.url = url;
|
299392
|
+
xref.remote = true;
|
299393
|
+
return true;
|
299394
|
+
} else {
|
299395
|
+
link4.url = [url, ...target || []].join("#");
|
299396
|
+
link4.internal = true;
|
299397
|
+
}
|
299235
299398
|
} else {
|
299236
299399
|
const copiedFile = hashAndCopyStaticFile(this.session, linkFile, this.session.publicPath(), (m2) => {
|
299237
299400
|
fileError(file, m2, {
|
@@ -299245,7 +299408,7 @@ var StaticFileTransformer = class {
|
|
299245
299408
|
link4.url = `/${copiedFile}`;
|
299246
299409
|
link4.static = true;
|
299247
299410
|
}
|
299248
|
-
updateLinkTextIfEmpty(link4, title ||
|
299411
|
+
updateLinkTextIfEmpty(link4, title || import_node_path31.default.basename(linkFile));
|
299249
299412
|
return true;
|
299250
299413
|
}
|
299251
299414
|
};
|
@@ -299273,19 +299436,270 @@ async function checkLinksTransform(session, file, mdast2) {
|
|
299273
299436
|
return linkResults;
|
299274
299437
|
}
|
299275
299438
|
|
299439
|
+
// ../myst-cli/dist/transforms/embed.js
|
299440
|
+
function mutateEmbedNode(node3, targetNode) {
|
299441
|
+
if (targetNode && node3["remove-output"]) {
|
299442
|
+
targetNode = filter2(targetNode, (n) => {
|
299443
|
+
var _a6;
|
299444
|
+
return n.type !== "output" && ((_a6 = n.data) === null || _a6 === void 0 ? void 0 : _a6.type) !== "output";
|
299445
|
+
});
|
299446
|
+
}
|
299447
|
+
if (targetNode && node3["remove-input"]) {
|
299448
|
+
targetNode = filter2(targetNode, (n) => {
|
299449
|
+
var _a6;
|
299450
|
+
return n.type !== "code" || ((_a6 = n.data) === null || _a6 === void 0 ? void 0 : _a6.type) === "output";
|
299451
|
+
});
|
299452
|
+
}
|
299453
|
+
selectAll("[identifier],[label],[html_id]", targetNode).forEach((idNode) => {
|
299454
|
+
if (!isTargetIdentifierNode(idNode))
|
299455
|
+
return;
|
299456
|
+
delete idNode.identifier;
|
299457
|
+
delete idNode.label;
|
299458
|
+
delete idNode.html_id;
|
299459
|
+
});
|
299460
|
+
if (!targetNode) {
|
299461
|
+
node3.children = [];
|
299462
|
+
} else if (targetNode.type === "block") {
|
299463
|
+
node3.children = targetNode.children;
|
299464
|
+
} else {
|
299465
|
+
node3.children = [targetNode];
|
299466
|
+
}
|
299467
|
+
}
|
299468
|
+
async function embedTransform(session, mdast2, file, dependencies, state) {
|
299469
|
+
const mystTransformer = new MystTransformer(Object.values(castSession(session).$externalReferences));
|
299470
|
+
const embedNodes = selectAll("embed", mdast2);
|
299471
|
+
await Promise.all(embedNodes.map(async (node3) => {
|
299472
|
+
var _a6, _b, _c, _d2, _e, _f, _g, _h;
|
299473
|
+
const vfile2 = state.vfile;
|
299474
|
+
const label = (_a6 = node3.source) === null || _a6 === void 0 ? void 0 : _a6.label;
|
299475
|
+
if (!label) {
|
299476
|
+
fileError(vfile2, "Embed node does not have a label", { node: node3 });
|
299477
|
+
return;
|
299478
|
+
}
|
299479
|
+
if (label.startsWith("xref:") || label.startsWith("myst:")) {
|
299480
|
+
if (!mystTransformer.test(label)) {
|
299481
|
+
fileError(vfile2, `Cannot embed "${label}"`, {
|
299482
|
+
node: node3,
|
299483
|
+
note: "The target must be a MyST project and be included in your project references.\nEmbed does not work with intersphinx."
|
299484
|
+
});
|
299485
|
+
return;
|
299486
|
+
}
|
299487
|
+
const referenceLink = {
|
299488
|
+
type: "link",
|
299489
|
+
url: label,
|
299490
|
+
urlSource: label,
|
299491
|
+
children: []
|
299492
|
+
};
|
299493
|
+
const transformed = mystTransformer.transform(referenceLink, vfile2);
|
299494
|
+
const referenceXRef = referenceLink;
|
299495
|
+
if (transformed) {
|
299496
|
+
let data;
|
299497
|
+
let targetNodes2;
|
299498
|
+
if (referenceXRef.identifier) {
|
299499
|
+
data = await fetchMystXRefData(session, referenceXRef, vfile2);
|
299500
|
+
if (!data)
|
299501
|
+
return;
|
299502
|
+
targetNodes2 = nodesFromMystXRefData(data, referenceXRef.identifier, vfile2, {
|
299503
|
+
urlSource: label
|
299504
|
+
// TODO: maxNodes - settable via embed directive
|
299505
|
+
});
|
299506
|
+
} else {
|
299507
|
+
data = await fetchMystLinkData(session, referenceLink, vfile2);
|
299508
|
+
if (!data)
|
299509
|
+
return;
|
299510
|
+
targetNodes2 = data.mdast.children;
|
299511
|
+
}
|
299512
|
+
const targetNode = { type: "block", children: targetNodes2 };
|
299513
|
+
selectAll("crossReference", targetNode).forEach((targetXRef) => {
|
299514
|
+
if (targetXRef.remoteBaseUrl)
|
299515
|
+
return;
|
299516
|
+
targetXRef.remoteBaseUrl = referenceXRef.remoteBaseUrl;
|
299517
|
+
if (!targetXRef.remote) {
|
299518
|
+
targetXRef.url = referenceXRef.url;
|
299519
|
+
targetXRef.dataUrl = referenceXRef.dataUrl;
|
299520
|
+
targetXRef.remote = true;
|
299521
|
+
}
|
299522
|
+
});
|
299523
|
+
selectAll("link", targetNode).forEach((targetLink) => {
|
299524
|
+
if (!targetLink.internal)
|
299525
|
+
return;
|
299526
|
+
targetLink.internal = false;
|
299527
|
+
targetLink.url = `${referenceXRef.remoteBaseUrl}${targetLink.url}`;
|
299528
|
+
if (targetLink.dataUrl) {
|
299529
|
+
targetLink.dataUrl = `${referenceXRef.remoteBaseUrl}${targetLink.dataUrl}`;
|
299530
|
+
}
|
299531
|
+
});
|
299532
|
+
selectAll("[source]", targetNode).forEach((target2) => {
|
299533
|
+
if (!target2.source)
|
299534
|
+
return;
|
299535
|
+
target2.source.remoteBaseUrl = referenceXRef.remoteBaseUrl;
|
299536
|
+
});
|
299537
|
+
mutateEmbedNode(node3, targetNode);
|
299538
|
+
const source3 = {
|
299539
|
+
url: referenceXRef.url,
|
299540
|
+
remoteBaseUrl: referenceXRef.remoteBaseUrl,
|
299541
|
+
label
|
299542
|
+
};
|
299543
|
+
if (data.kind)
|
299544
|
+
source3.kind = data.kind;
|
299545
|
+
if (data.slug)
|
299546
|
+
source3.slug = data.slug;
|
299547
|
+
if (data.location)
|
299548
|
+
source3.location = data.location;
|
299549
|
+
if ((_b = data.frontmatter) === null || _b === void 0 ? void 0 : _b.title)
|
299550
|
+
source3.title = data.frontmatter.title;
|
299551
|
+
if ((_c = data.frontmatter) === null || _c === void 0 ? void 0 : _c.short_title)
|
299552
|
+
source3.short_title = data.frontmatter.short_title;
|
299553
|
+
node3.source = source3;
|
299554
|
+
}
|
299555
|
+
return;
|
299556
|
+
}
|
299557
|
+
let hash = label;
|
299558
|
+
let linkFile;
|
299559
|
+
if (label.includes("#")) {
|
299560
|
+
const linkFileWithTarget = fileFromRelativePath(label, file);
|
299561
|
+
if (!linkFileWithTarget)
|
299562
|
+
return;
|
299563
|
+
linkFile = linkFileWithTarget.split("#")[0];
|
299564
|
+
hash = linkFileWithTarget.slice(linkFile.length + 1);
|
299565
|
+
}
|
299566
|
+
const { identifier } = (_d2 = normalizeLabel(hash)) !== null && _d2 !== void 0 ? _d2 : {};
|
299567
|
+
if (!identifier) {
|
299568
|
+
fileError(vfile2, "Embed node does not have label", { node: node3 });
|
299569
|
+
return;
|
299570
|
+
}
|
299571
|
+
const stateProvider = state.resolveStateProvider(identifier, linkFile);
|
299572
|
+
if (!stateProvider)
|
299573
|
+
return;
|
299574
|
+
const cache = castSession(session);
|
299575
|
+
const pageMdast = (_f = (_e = cache.$getMdast(stateProvider.filePath)) === null || _e === void 0 ? void 0 : _e.post) === null || _f === void 0 ? void 0 : _f.mdast;
|
299576
|
+
if (!pageMdast)
|
299577
|
+
return;
|
299578
|
+
let targetNodes;
|
299579
|
+
if (stateProvider.getFileTarget(identifier)) {
|
299580
|
+
targetNodes = pageMdast.children;
|
299581
|
+
} else {
|
299582
|
+
targetNodes = selectMdastNodes(pageMdast, identifier).nodes;
|
299583
|
+
}
|
299584
|
+
if (!(targetNodes === null || targetNodes === void 0 ? void 0 : targetNodes.length)) {
|
299585
|
+
fileError(vfile2, `Embed target for "${label}" not found`, { node: node3 });
|
299586
|
+
return;
|
299587
|
+
}
|
299588
|
+
const target = { type: "block", children: copyNode(targetNodes) };
|
299589
|
+
mutateEmbedNode(node3, target);
|
299590
|
+
const multiState = state;
|
299591
|
+
if (!multiState.states)
|
299592
|
+
return;
|
299593
|
+
const { url, filePath } = (_g = multiState.resolveStateProvider(identifier, linkFile)) !== null && _g !== void 0 ? _g : {};
|
299594
|
+
if (!url)
|
299595
|
+
return;
|
299596
|
+
const source2 = { url, label };
|
299597
|
+
if (filePath) {
|
299598
|
+
session.store.dispatch(watch.actions.addLocalDependency({
|
299599
|
+
path: file,
|
299600
|
+
dependency: filePath
|
299601
|
+
}));
|
299602
|
+
const { kind, slug, frontmatter, location: location4 } = (_h = selectFile(session, filePath)) !== null && _h !== void 0 ? _h : {};
|
299603
|
+
if (kind)
|
299604
|
+
source2.kind = kind;
|
299605
|
+
if (slug)
|
299606
|
+
source2.slug = slug;
|
299607
|
+
if (location4)
|
299608
|
+
source2.location = location4;
|
299609
|
+
if (frontmatter === null || frontmatter === void 0 ? void 0 : frontmatter.title)
|
299610
|
+
source2.title = frontmatter.title;
|
299611
|
+
if (frontmatter === null || frontmatter === void 0 ? void 0 : frontmatter.short_title)
|
299612
|
+
source2.short_title = frontmatter.short_title;
|
299613
|
+
}
|
299614
|
+
node3.source = source2;
|
299615
|
+
if (!dependencies.map((dep) => dep.url).includes(url))
|
299616
|
+
dependencies.push(source2);
|
299617
|
+
}));
|
299618
|
+
const containerNodes = selectAll("container", mdast2);
|
299619
|
+
containerNodes.forEach((node3) => {
|
299620
|
+
var _a6, _b;
|
299621
|
+
const containerEmbeds = (_a6 = node3.children) === null || _a6 === void 0 ? void 0 : _a6.filter((child) => child.type === "embed");
|
299622
|
+
if ((containerEmbeds === null || containerEmbeds === void 0 ? void 0 : containerEmbeds.length) === 1) {
|
299623
|
+
node3.source = { ...containerEmbeds[0].source };
|
299624
|
+
containerEmbeds[0].type = "_lift";
|
299625
|
+
if (((_b = containerEmbeds[0].children) === null || _b === void 0 ? void 0 : _b.length) === 1 && containerEmbeds[0].children[0].type === "container") {
|
299626
|
+
containerEmbeds[0].children[0].type = "_lift";
|
299627
|
+
remove(containerEmbeds[0].children[0], "caption");
|
299628
|
+
remove(containerEmbeds[0].children[0], "legend");
|
299629
|
+
}
|
299630
|
+
}
|
299631
|
+
});
|
299632
|
+
const remainingEmbedNodes = selectAll("embed", mdast2);
|
299633
|
+
remainingEmbedNodes.forEach((node3) => {
|
299634
|
+
var _a6;
|
299635
|
+
if (((_a6 = node3.children) === null || _a6 === void 0 ? void 0 : _a6.length) === 1 && node3.children[0].type === "container") {
|
299636
|
+
node3.children[0].source = { ...node3.source };
|
299637
|
+
node3.type = "_lift";
|
299638
|
+
}
|
299639
|
+
});
|
299640
|
+
liftChildren(mdast2, "_lift");
|
299641
|
+
}
|
299642
|
+
|
299643
|
+
// ../myst-cli/dist/transforms/include.js
|
299644
|
+
var import_node_path32 = __toESM(require("path"), 1);
|
299645
|
+
var import_node_fs26 = __toESM(require("fs"), 1);
|
299646
|
+
var makeFileResolver = (baseFile) => (relativeFile, sourceFile, vfile2) => {
|
299647
|
+
const base5 = sourceFile.toLowerCase().endsWith(".tex") ? baseFile : sourceFile;
|
299648
|
+
const fullFile = import_node_path32.default.resolve(import_node_path32.default.dirname(base5), relativeFile);
|
299649
|
+
if (!import_node_fs26.default.existsSync(fullFile)) {
|
299650
|
+
fileError(vfile2, `Include Directive: Could not find "${relativeFile}" relative to "${base5}"`, {
|
299651
|
+
ruleId: RuleId.includeContentLoads
|
299652
|
+
});
|
299653
|
+
return;
|
299654
|
+
}
|
299655
|
+
return fullFile;
|
299656
|
+
};
|
299657
|
+
var makeFileLoader = (session, baseFile) => (fullFile) => {
|
299658
|
+
session.store.dispatch(watch.actions.addLocalDependency({
|
299659
|
+
path: baseFile,
|
299660
|
+
dependency: fullFile
|
299661
|
+
}));
|
299662
|
+
return import_node_fs26.default.readFileSync(fullFile).toString();
|
299663
|
+
};
|
299664
|
+
var makeContentParser = (session, file) => async (filename, content3) => {
|
299665
|
+
if (filename.toLowerCase().endsWith(".html")) {
|
299666
|
+
const mdast2 = { type: "root", children: [{ type: "html", value: content3 }] };
|
299667
|
+
return { mdast: mdast2, kind: SourceFileKind.Article };
|
299668
|
+
}
|
299669
|
+
const opts = { keepTitleNode: true };
|
299670
|
+
if (filename.toLowerCase().endsWith(".tex")) {
|
299671
|
+
return loadTexFile(session, content3, file, opts);
|
299672
|
+
}
|
299673
|
+
if (filename.toLowerCase().endsWith(".ipynb")) {
|
299674
|
+
return loadNotebookFile(session, content3, file, opts);
|
299675
|
+
}
|
299676
|
+
return loadMdFile(session, content3, file, opts);
|
299677
|
+
};
|
299678
|
+
async function includeFilesTransform(session, baseFile, tree, frontmatter, vfile2) {
|
299679
|
+
const parseContent = makeContentParser(session, baseFile);
|
299680
|
+
const loadFile2 = makeFileLoader(session, baseFile);
|
299681
|
+
const resolveFile = makeFileResolver(baseFile);
|
299682
|
+
await includeDirectiveTransform(tree, frontmatter, vfile2, {
|
299683
|
+
resolveFile,
|
299684
|
+
loadFile: loadFile2,
|
299685
|
+
parseContent,
|
299686
|
+
sourceFile: baseFile
|
299687
|
+
});
|
299688
|
+
}
|
299689
|
+
|
299276
299690
|
// ../myst-cli/dist/transforms/mdast.js
|
299277
299691
|
var import_node_fs27 = __toESM(require("fs"), 1);
|
299278
|
-
var
|
299692
|
+
var import_node_path33 = require("path");
|
299279
299693
|
function importMdastFromJson(session, filename, mdast2) {
|
299280
299694
|
const mdastNodes = selectAll("mdast", mdast2);
|
299281
299695
|
const loadedData = {};
|
299282
|
-
const dir = (0,
|
299696
|
+
const dir = (0, import_node_path33.dirname)(filename);
|
299283
299697
|
mdastNodes.forEach((node3) => {
|
299284
299698
|
const [mdastFilename, id] = node3.id.split("#");
|
299285
299699
|
let data = loadedData[mdastFilename];
|
299286
299700
|
if (!data) {
|
299287
299701
|
try {
|
299288
|
-
data = JSON.parse(import_node_fs27.default.readFileSync((0,
|
299702
|
+
data = JSON.parse(import_node_fs27.default.readFileSync((0, import_node_path33.join)(dir, mdastFilename)).toString());
|
299289
299703
|
loadedData[mdastFilename] = data;
|
299290
299704
|
} catch {
|
299291
299705
|
addWarningForFile(session, filename, `Mdast Node import: Could not load ${mdastFilename}`, "error", { ruleId: RuleId.mdastSnippetImports });
|
@@ -299305,7 +299719,7 @@ function importMdastFromJson(session, filename, mdast2) {
|
|
299305
299719
|
|
299306
299720
|
// ../myst-cli/dist/transforms/outputs.js
|
299307
299721
|
var import_node_fs28 = __toESM(require("fs"), 1);
|
299308
|
-
var
|
299722
|
+
var import_node_path34 = require("path");
|
299309
299723
|
|
299310
299724
|
// ../../node_modules/ansi-regex/index.js
|
299311
299725
|
function ansiRegex({ onlyFirst = false } = {}) {
|
@@ -299331,7 +299745,7 @@ function getFilename(hash, contentType) {
|
|
299331
299745
|
return `${hash}${(0, import_nbtx3.extFromMimeType)(contentType)}`;
|
299332
299746
|
}
|
299333
299747
|
function getWriteDestination(hash, contentType, writeFolder) {
|
299334
|
-
return (0,
|
299748
|
+
return (0, import_node_path34.join)(writeFolder, getFilename(hash, contentType));
|
299335
299749
|
}
|
299336
299750
|
async function transformOutputsToCache(session, mdast2, kind, opts) {
|
299337
299751
|
const outputs = selectAll("output", mdast2);
|
@@ -299511,7 +299925,7 @@ function reduceOutputs(session, mdast2, file, writeFolder, opts) {
|
|
299511
299925
|
});
|
299512
299926
|
if (!path42)
|
299513
299927
|
return void 0;
|
299514
|
-
const relativePath = (0,
|
299928
|
+
const relativePath = (0, import_node_path34.relative)((0, import_node_path34.dirname)(file), path42);
|
299515
299929
|
return {
|
299516
299930
|
type: "image",
|
299517
299931
|
data: { type: "output" },
|
@@ -299555,7 +299969,7 @@ function frontmatterPartsTransform(session, file, mdast2, frontmatter) {
|
|
299555
299969
|
}
|
299556
299970
|
|
299557
299971
|
// ../myst-execute/dist/execute.js
|
299558
|
-
var
|
299972
|
+
var import_node_path35 = __toESM(require("path"), 1);
|
299559
299973
|
var import_node_assert = __toESM(require("assert"), 1);
|
299560
299974
|
var import_node_crypto4 = require("crypto");
|
299561
299975
|
function IOPubAsOutput(msg) {
|
@@ -299709,9 +300123,9 @@ async function kernelExecutionTransform(tree, vfile2, opts) {
|
|
299709
300123
|
} else {
|
299710
300124
|
let sessionConnection;
|
299711
300125
|
const sessionOpts = {
|
299712
|
-
path:
|
300126
|
+
path: import_node_path35.default.relative(opts.basePath, vfile2.path),
|
299713
300127
|
type: "notebook",
|
299714
|
-
name:
|
300128
|
+
name: import_node_path35.default.basename(vfile2.path),
|
299715
300129
|
kernel: {
|
299716
300130
|
name: (_d2 = (_c = (_b = opts.frontmatter) === null || _b === void 0 ? void 0 : _b.kernelspec) === null || _c === void 0 ? void 0 : _c.name) !== null && _d2 !== void 0 ? _d2 : "python3"
|
299717
300131
|
}
|
@@ -300314,16 +300728,16 @@ async function launchJupyterServer(contentPath, log) {
|
|
300314
300728
|
|
300315
300729
|
// ../myst-execute/dist/cache.js
|
300316
300730
|
var import_node_fs29 = require("fs");
|
300317
|
-
var
|
300731
|
+
var import_node_path36 = __toESM(require("path"), 1);
|
300318
300732
|
var LocalDiskCache = class {
|
300319
|
-
constructor(
|
300320
|
-
this._cachePath =
|
300321
|
-
if (!(0, import_node_fs29.existsSync)(
|
300322
|
-
(0, import_node_fs29.mkdirSync)(
|
300733
|
+
constructor(cachePath2) {
|
300734
|
+
this._cachePath = cachePath2;
|
300735
|
+
if (!(0, import_node_fs29.existsSync)(cachePath2)) {
|
300736
|
+
(0, import_node_fs29.mkdirSync)(cachePath2, { recursive: true });
|
300323
300737
|
}
|
300324
300738
|
}
|
300325
300739
|
_makeKeyPath(key2) {
|
300326
|
-
return
|
300740
|
+
return import_node_path36.default.join(this._cachePath, `${key2}.json`);
|
300327
300741
|
}
|
300328
300742
|
test(key2) {
|
300329
300743
|
return (0, import_node_fs29.existsSync)(this._makeKeyPath(key2));
|
@@ -300386,7 +300800,7 @@ async function transformMdast(session, opts) {
|
|
300386
300800
|
log.debug(`Processing "${file}"`);
|
300387
300801
|
const vfile2 = new VFile();
|
300388
300802
|
vfile2.path = file;
|
300389
|
-
const mdast2 =
|
300803
|
+
const mdast2 = structuredClone(mdastPre);
|
300390
300804
|
const frontmatter = processPageFrontmatter(session, preFrontmatter !== null && preFrontmatter !== void 0 ? preFrontmatter : {}, {
|
300391
300805
|
property: "frontmatter",
|
300392
300806
|
file,
|
@@ -300419,31 +300833,20 @@ async function transformMdast(session, opts) {
|
|
300419
300833
|
});
|
300420
300834
|
await pipe.run(mdast2, vfile2);
|
300421
300835
|
propagateBlockDataToCode(session, vfile2, mdast2);
|
300422
|
-
const transformers = [
|
300423
|
-
new WikiTransformer(),
|
300424
|
-
new GithubTransformer(),
|
300425
|
-
new RRIDTransformer(),
|
300426
|
-
new DOITransformer(),
|
300427
|
-
// This also is picked up in the next transform
|
300428
|
-
new MystTransformer(Object.values(cache.$externalReferences)),
|
300429
|
-
new SphinxTransformer(Object.values(cache.$externalReferences))
|
300430
|
-
];
|
300431
|
-
linksTransform(mdast2, vfile2, { transformers, selector: LINKS_SELECTOR });
|
300432
|
-
await transformMystXRefs(session, vfile2, mdast2, frontmatter);
|
300433
300836
|
cache.$citationRenderers[file] = await transformLinkedDOIs(session, vfile2, mdast2, cache.$doiRenderers, file);
|
300434
300837
|
const rendererFiles = [file];
|
300435
300838
|
if (projectPath) {
|
300436
300839
|
rendererFiles.unshift(projectPath);
|
300437
300840
|
} else {
|
300438
|
-
const localFiles = await bibFilesInDir(session,
|
300841
|
+
const localFiles = await bibFilesInDir(session, import_node_path37.default.dirname(file)) || [];
|
300439
300842
|
rendererFiles.push(...localFiles);
|
300440
300843
|
}
|
300441
300844
|
const fileCitationRenderer = combineCitationRenderers(cache, ...rendererFiles);
|
300442
300845
|
if (execute) {
|
300443
|
-
const
|
300846
|
+
const cachePath2 = import_node_path37.default.join(session.buildPath(), "execute");
|
300444
300847
|
await kernelExecutionTransform(mdast2, vfile2, {
|
300445
300848
|
basePath: session.sourcePath(),
|
300446
|
-
cache: new LocalDiskCache(
|
300849
|
+
cache: new LocalDiskCache(cachePath2),
|
300447
300850
|
sessionFactory: () => session.jupyterSessionManager(),
|
300448
300851
|
frontmatter,
|
300449
300852
|
ignoreCache: false,
|
@@ -300499,20 +300902,31 @@ async function postProcessMdast(session, { file, checkLinks, pageReferenceStates
|
|
300499
300902
|
return;
|
300500
300903
|
const vfile2 = new VFile();
|
300501
300904
|
vfile2.path = file;
|
300502
|
-
const { mdast: mdast2, dependencies } = mdastPost;
|
300905
|
+
const { mdast: mdast2, dependencies, frontmatter } = mdastPost;
|
300503
300906
|
const fileState = cache.$internalReferences[file];
|
300504
300907
|
const state = pageReferenceStates ? new MultiPageReferenceResolver(pageReferenceStates, file, vfile2) : fileState;
|
300505
300908
|
const transformers = [
|
300506
300909
|
...extraLinkTransformers || [],
|
300910
|
+
new WikiTransformer(),
|
300911
|
+
new GithubTransformer(),
|
300912
|
+
new RRIDTransformer(),
|
300913
|
+
new RORTransformer(),
|
300914
|
+
new DOITransformer(),
|
300915
|
+
// This also is picked up in the next transform
|
300916
|
+
new MystTransformer(Object.values(cache.$externalReferences)),
|
300917
|
+
new SphinxTransformer(Object.values(cache.$externalReferences)),
|
300507
300918
|
new StaticFileTransformer(session, file)
|
300508
300919
|
// Links static files and internally linked files
|
300509
300920
|
];
|
300921
|
+
resolveLinksAndCitationsTransform(mdast2, { state, transformers });
|
300510
300922
|
linksTransform(mdast2, state.vfile, {
|
300511
300923
|
transformers,
|
300512
300924
|
selector: LINKS_SELECTOR
|
300513
300925
|
});
|
300514
|
-
|
300515
|
-
|
300926
|
+
await transformLinkedRORs(session, vfile2, mdast2, file);
|
300927
|
+
resolveReferencesTransform(mdast2, state.vfile, { state, transformers });
|
300928
|
+
await transformMystXRefs(session, vfile2, mdast2, frontmatter);
|
300929
|
+
await embedTransform(session, mdast2, file, dependencies, state);
|
300516
300930
|
const pipe = unified();
|
300517
300931
|
(_a6 = session.plugins) === null || _a6 === void 0 ? void 0 : _a6.transforms.forEach((t2) => {
|
300518
300932
|
if (t2.stage !== "project")
|
@@ -300582,13 +300996,13 @@ async function finalizeMdast(session, mdast2, frontmatter, file, { imageWriteFol
|
|
300582
300996
|
|
300583
300997
|
// ../myst-cli/dist/process/site.js
|
300584
300998
|
var WEB_IMAGE_EXTENSIONS = [
|
300999
|
+
ImageExtensions.mp4,
|
300585
301000
|
ImageExtensions.webp,
|
300586
301001
|
ImageExtensions.svg,
|
300587
301002
|
ImageExtensions.gif,
|
300588
301003
|
ImageExtensions.png,
|
300589
301004
|
ImageExtensions.jpg,
|
300590
|
-
ImageExtensions.jpeg
|
300591
|
-
ImageExtensions.mp4
|
301005
|
+
ImageExtensions.jpeg
|
300592
301006
|
];
|
300593
301007
|
function changeFile(session, path42, eventType) {
|
300594
301008
|
session.log.debug(`File modified: "${path42}" (${eventType})`);
|
@@ -300598,7 +301012,7 @@ function changeFile(session, path42, eventType) {
|
|
300598
301012
|
delete cache.$citationRenderers[path42];
|
300599
301013
|
}
|
300600
301014
|
async function writeSiteManifest(session, opts) {
|
300601
|
-
const configPath = (0,
|
301015
|
+
const configPath = (0, import_node_path38.join)(session.sitePath(), "config.json");
|
300602
301016
|
session.log.debug("Writing site config.json");
|
300603
301017
|
const siteManifest = await getSiteManifest(session, opts);
|
300604
301018
|
writeFileToFolder(configPath, JSON.stringify(siteManifest));
|
@@ -300639,7 +301053,7 @@ async function writeMystXRefJson(session, states) {
|
|
300639
301053
|
return [pageRef, ...pageIdRefs, ...targetRefs];
|
300640
301054
|
}).flat()
|
300641
301055
|
};
|
300642
|
-
const filename = (0,
|
301056
|
+
const filename = (0, import_node_path38.join)(session.sitePath(), "myst.xref.json");
|
300643
301057
|
session.log.debug(`Writing myst.xref.json file: ${filename}`);
|
300644
301058
|
writeFileToFolder(filename, JSON.stringify(mystXRefs));
|
300645
301059
|
}
|
@@ -300670,7 +301084,7 @@ async function writeObjectsInv(session, states, siteConfig) {
|
|
300670
301084
|
});
|
300671
301085
|
});
|
300672
301086
|
});
|
300673
|
-
const filename = (0,
|
301087
|
+
const filename = (0, import_node_path38.join)(session.sitePath(), "objects.inv");
|
300674
301088
|
session.log.debug(`Writing objects.inv file: ${filename}`);
|
300675
301089
|
inv.write(filename);
|
300676
301090
|
}
|
@@ -300729,7 +301143,7 @@ async function resolvePageSource(session, file) {
|
|
300729
301143
|
ruleId: RuleId.sourceFileCopied
|
300730
301144
|
});
|
300731
301145
|
});
|
300732
|
-
return { format: (0,
|
301146
|
+
return { format: (0, import_node_path38.extname)(file).substring(1), filename: (0, import_node_path38.basename)(file), url: `/${fileHash}` };
|
300733
301147
|
}
|
300734
301148
|
async function writeFile(session, { file, pageSlug, projectSlug, projectPath }) {
|
300735
301149
|
const toc = tic();
|
@@ -300747,7 +301161,7 @@ async function writeFile(session, { file, pageSlug, projectSlug, projectPath })
|
|
300747
301161
|
if (projectSlug)
|
300748
301162
|
jsonFilenameParts.push(projectSlug);
|
300749
301163
|
jsonFilenameParts.push(`${pageSlug}.json`);
|
300750
|
-
writeFileToFolder((0,
|
301164
|
+
writeFileToFolder((0, import_node_path38.join)(...jsonFilenameParts), JSON.stringify({
|
300751
301165
|
kind,
|
300752
301166
|
sha256,
|
300753
301167
|
slug,
|
@@ -300948,7 +301362,7 @@ async function buildSite(session, opts) {
|
|
300948
301362
|
}
|
300949
301363
|
|
300950
301364
|
// ../myst-cli/dist/build/utils/localArticleExport.js
|
300951
|
-
var
|
301365
|
+
var import_node_path52 = __toESM(require("path"), 1);
|
300952
301366
|
var import_chokidar = __toESM(require_chokidar(), 1);
|
300953
301367
|
|
300954
301368
|
// ../myst-cli/dist/build/utils/resolveAndLogErrors.js
|
@@ -300970,10 +301384,10 @@ ${e2 === null || e2 === void 0 ? void 0 : e2.stack}
|
|
300970
301384
|
|
300971
301385
|
// ../myst-cli/dist/build/tex/single.js
|
300972
301386
|
var import_adm_zip2 = __toESM(require_adm_zip(), 1);
|
300973
|
-
var
|
301387
|
+
var import_node_path44 = __toESM(require("path"), 1);
|
300974
301388
|
|
300975
301389
|
// ../jtex/dist/tex/export.js
|
300976
|
-
var
|
301390
|
+
var import_node_path39 = __toESM(require("path"), 1);
|
300977
301391
|
|
300978
301392
|
// ../jtex/dist/utils.js
|
300979
301393
|
function createCommand2(baseCommand, logFile) {
|
@@ -300989,7 +301403,7 @@ function pdfTexExportCommand(texFile, logFile, template) {
|
|
300989
301403
|
return createCommand2(baseCommand, logFile);
|
300990
301404
|
}
|
300991
301405
|
function texMakeGlossariesCommand(texFile, logFile) {
|
300992
|
-
const fileNameNoExt =
|
301406
|
+
const fileNameNoExt = import_node_path39.default.basename(texFile, ".tex");
|
300993
301407
|
const baseCommand = `makeglossaries ${fileNameNoExt}`;
|
300994
301408
|
return createCommand2(baseCommand, logFile);
|
300995
301409
|
}
|
@@ -301041,7 +301455,7 @@ function mergeTexTemplateImports(current2, next) {
|
|
301041
301455
|
}
|
301042
301456
|
|
301043
301457
|
// ../jtex/dist/typst/imports.js
|
301044
|
-
var
|
301458
|
+
var import_node_path40 = __toESM(require("path"), 1);
|
301045
301459
|
function renderTypstImports(output2, templateImports, preamble) {
|
301046
301460
|
const { macros: macros18, commands } = templateImports !== null && templateImports !== void 0 ? templateImports : {};
|
301047
301461
|
const importStatements = [];
|
@@ -301049,7 +301463,7 @@ function renderTypstImports(output2, templateImports, preamble) {
|
|
301049
301463
|
if (hasMacros)
|
301050
301464
|
importStatements.push('#import "myst.typ": *');
|
301051
301465
|
if (output2 && hasMacros) {
|
301052
|
-
const mystTypst =
|
301466
|
+
const mystTypst = import_node_path40.default.join(import_node_path40.default.dirname(output2), "myst.typ");
|
301053
301467
|
writeFileToFolder(mystTypst, macros18.join("\n\n"));
|
301054
301468
|
}
|
301055
301469
|
if (commands && Object.keys(commands).length > 0) {
|
@@ -301072,7 +301486,7 @@ function mergeTypstTemplateImports(current2, next) {
|
|
301072
301486
|
|
301073
301487
|
// ../jtex/dist/jtex.js
|
301074
301488
|
var import_node_fs31 = __toESM(require("fs"), 1);
|
301075
|
-
var
|
301489
|
+
var import_node_path41 = require("path");
|
301076
301490
|
var import_nunjucks = __toESM(require_nunjucks(), 1);
|
301077
301491
|
|
301078
301492
|
// ../jtex/dist/render.js
|
@@ -301119,7 +301533,7 @@ function renderTemplate(template, opts) {
|
|
301119
301533
|
if (!ext2) {
|
301120
301534
|
throw new Error(`Cannot render template of kind: ${template.kind}`);
|
301121
301535
|
}
|
301122
|
-
if ((0,
|
301536
|
+
if ((0, import_node_path41.extname)(opts.outputPath) !== ext2) {
|
301123
301537
|
throw new Error(`outputPath must be a "${ext2}" file, not "${opts.outputPath}"`);
|
301124
301538
|
}
|
301125
301539
|
let content3;
|
@@ -301140,9 +301554,9 @@ function renderTemplate(template, opts) {
|
|
301140
301554
|
};
|
301141
301555
|
const env7 = getDefaultEnv(template);
|
301142
301556
|
const rendered = env7.render(template.getTemplateFilename(), renderer);
|
301143
|
-
const outputDirectory = (0,
|
301557
|
+
const outputDirectory = (0, import_node_path41.dirname)(opts.outputPath);
|
301144
301558
|
ensureDirectoryExists(outputDirectory);
|
301145
|
-
template.copyTemplateFiles((0,
|
301559
|
+
template.copyTemplateFiles((0, import_node_path41.dirname)(opts.outputPath), { force: opts.force });
|
301146
301560
|
import_node_fs31.default.writeFileSync(opts.outputPath, opts.removeVersionComment ? rendered : `${commentSymbol(template.kind)} Created with jtex v.${version_default3}
|
301147
301561
|
${rendered}`);
|
301148
301562
|
}
|
@@ -302527,11 +302941,11 @@ var plugin2 = function(opts) {
|
|
302527
302941
|
var dist_default3 = plugin2;
|
302528
302942
|
|
302529
302943
|
// ../myst-cli/dist/build/utils/getFileContent.js
|
302530
|
-
var
|
302944
|
+
var import_node_path42 = require("path");
|
302531
302945
|
async function getFileContent(session, files, { projectPath, imageExtensions, extraLinkTransformers, extraTransforms, titleDepths, preFrontmatters }) {
|
302532
302946
|
const toc = tic();
|
302533
|
-
files = files.map((file) => (0,
|
302534
|
-
projectPath = projectPath !== null && projectPath !== void 0 ? projectPath : (0,
|
302947
|
+
files = files.map((file) => (0, import_node_path42.resolve)(file));
|
302948
|
+
projectPath = projectPath !== null && projectPath !== void 0 ? projectPath : (0, import_node_path42.resolve)(".");
|
302535
302949
|
const { project, pages } = await loadProject(session, projectPath);
|
302536
302950
|
const projectFiles = pages.map((page) => page.file).filter((file) => !files.includes(file));
|
302537
302951
|
const allFiles = [...files, ...projectFiles];
|
@@ -302593,7 +303007,7 @@ function cleanOutput(session, output2) {
|
|
302593
303007
|
|
302594
303008
|
// ../myst-cli/dist/build/utils/bibtex.js
|
302595
303009
|
var import_node_fs33 = __toESM(require("fs"), 1);
|
302596
|
-
var
|
303010
|
+
var import_node_path43 = __toESM(require("path"), 1);
|
302597
303011
|
function writeBibtexFromCitationRenderers(session, output2, content3) {
|
302598
303012
|
const order3 = content3.map(({ references }) => {
|
302599
303013
|
var _a6, _b;
|
@@ -302621,7 +303035,7 @@ function writeBibtexFromCitationRenderers(session, output2, content3) {
|
|
302621
303035
|
if (!bibtexContent.length)
|
302622
303036
|
return false;
|
302623
303037
|
if (!import_node_fs33.default.existsSync(output2))
|
302624
|
-
import_node_fs33.default.mkdirSync(
|
303038
|
+
import_node_fs33.default.mkdirSync(import_node_path43.default.dirname(output2), { recursive: true });
|
302625
303039
|
import_node_fs33.default.writeFileSync(output2, bibtexContent.join("\n"));
|
302626
303040
|
return true;
|
302627
303041
|
}
|
@@ -302695,7 +303109,7 @@ async function localArticleToTexRaw(session, templateOptions, opts) {
|
|
302695
303109
|
const toc = tic();
|
302696
303110
|
const results = await Promise.all(content3.map(async ({ mdast: mdast2, frontmatter, references }, ind) => {
|
302697
303111
|
await finalizeMdast(session, mdast2, frontmatter, fileArticles[ind].file, {
|
302698
|
-
imageWriteFolder:
|
303112
|
+
imageWriteFolder: import_node_path44.default.join(import_node_path44.default.dirname(output2), "files"),
|
302699
303113
|
imageAltOutputFolder: "files/",
|
302700
303114
|
imageExtensions: TEX_IMAGE_EXTENSIONS,
|
302701
303115
|
simplifyFigures: true
|
@@ -302708,12 +303122,12 @@ async function localArticleToTexRaw(session, templateOptions, opts) {
|
|
302708
303122
|
} else {
|
302709
303123
|
let includeContent = "";
|
302710
303124
|
let fileInd = 0;
|
302711
|
-
const { dir, name: name3, ext: ext2 } =
|
303125
|
+
const { dir, name: name3, ext: ext2 } = import_node_path44.default.parse(output2);
|
302712
303126
|
articles.forEach((article) => {
|
302713
303127
|
var _a6, _b, _c, _d2, _e;
|
302714
303128
|
if (article.file) {
|
302715
303129
|
const base5 = `${name3}-${(_b = (_a6 = content3[fileInd]) === null || _a6 === void 0 ? void 0 : _a6.slug) !== null && _b !== void 0 ? _b : fileInd}${ext2}`;
|
302716
|
-
const includeFile =
|
303130
|
+
const includeFile = import_node_path44.default.format({ dir, ext: ext2, base: base5 });
|
302717
303131
|
let part = "";
|
302718
303132
|
const { title, content_includes_title } = (_d2 = (_c = content3[fileInd]) === null || _c === void 0 ? void 0 : _c.frontmatter) !== null && _d2 !== void 0 ? _d2 : {};
|
302719
303133
|
if (title && !content_includes_title) {
|
@@ -302740,7 +303154,7 @@ async function localArticleToTexTemplated(session, file, templateOptions, opts)
|
|
302740
303154
|
var _a6;
|
302741
303155
|
const { output: output2, articles, template } = templateOptions;
|
302742
303156
|
const { projectPath, extraLinkTransformers, clean: clean3, ci } = opts !== null && opts !== void 0 ? opts : {};
|
302743
|
-
const filesPath =
|
303157
|
+
const filesPath = import_node_path44.default.join(import_node_path44.default.dirname(output2), "files");
|
302744
303158
|
const fileArticles = articlesWithFile(articles);
|
302745
303159
|
const content3 = await getFileContent(session, fileArticles.map((article) => article.file), {
|
302746
303160
|
projectPath,
|
@@ -302749,7 +303163,7 @@ async function localArticleToTexTemplated(session, file, templateOptions, opts)
|
|
302749
303163
|
titleDepths: fileArticles.map((article) => article.level),
|
302750
303164
|
preFrontmatters: fileArticles.map((article) => filterKeys(article, [...PAGE_FRONTMATTER_KEYS, ...Object.keys(FRONTMATTER_ALIASES)]))
|
302751
303165
|
});
|
302752
|
-
const bibtexWritten = writeBibtexFromCitationRenderers(session,
|
303166
|
+
const bibtexWritten = writeBibtexFromCitationRenderers(session, import_node_path44.default.join(import_node_path44.default.dirname(output2), DEFAULT_BIB_FILENAME), content3);
|
302753
303167
|
const warningLogFn = (message) => {
|
302754
303168
|
addWarningForFile(session, file, message, "warn", {
|
302755
303169
|
ruleId: RuleId.texRenders
|
@@ -302815,14 +303229,14 @@ async function localArticleToTexTemplated(session, file, templateOptions, opts)
|
|
302815
303229
|
} else {
|
302816
303230
|
const state = session.store.getState();
|
302817
303231
|
frontmatter = (_a6 = selectors_exports.selectLocalProjectConfig(state, projectPath !== null && projectPath !== void 0 ? projectPath : ".")) !== null && _a6 !== void 0 ? _a6 : {};
|
302818
|
-
const { dir, name: name3, ext: ext2 } =
|
303232
|
+
const { dir, name: name3, ext: ext2 } = import_node_path44.default.parse(output2);
|
302819
303233
|
texContent = "";
|
302820
303234
|
let fileInd = 0;
|
302821
303235
|
articles.forEach((article) => {
|
302822
303236
|
var _a7, _b, _c, _d2;
|
302823
303237
|
if (article.file) {
|
302824
303238
|
const includeFilename = `${name3}-${(_b = (_a7 = content3[fileInd]) === null || _a7 === void 0 ? void 0 : _a7.slug) !== null && _b !== void 0 ? _b : fileInd}`;
|
302825
|
-
const includeFile =
|
303239
|
+
const includeFile = import_node_path44.default.format({ dir, ext: ext2, base: `${includeFilename}${ext2}` });
|
302826
303240
|
let part = "";
|
302827
303241
|
const { title, content_includes_title } = (_d2 = (_c = content3[fileInd]) === null || _c === void 0 ? void 0 : _c.frontmatter) !== null && _d2 !== void 0 ? _d2 : {};
|
302828
303242
|
if (title && !content_includes_title) {
|
@@ -302882,7 +303296,7 @@ async function runTexZipExport(session, file, exportOptions, opts) {
|
|
302882
303296
|
cleanOutput(session, exportOptions.output);
|
302883
303297
|
const zipOutput = exportOptions.output;
|
302884
303298
|
const texFolder = createTempFolder(session);
|
302885
|
-
exportOptions.output =
|
303299
|
+
exportOptions.output = import_node_path44.default.join(texFolder, `${import_node_path44.default.basename(zipOutput, import_node_path44.default.extname(zipOutput))}.tex`);
|
302886
303300
|
await runTexExport(session, file, exportOptions, opts);
|
302887
303301
|
session.log.info(`\u{1F910} Zipping tex outputs to ${zipOutput}`);
|
302888
303302
|
const zip2 = new import_adm_zip2.default();
|
@@ -302898,7 +303312,7 @@ function hasGlossary(mdast2) {
|
|
302898
303312
|
// ../myst-cli/dist/build/typst.js
|
302899
303313
|
var import_adm_zip3 = __toESM(require_adm_zip(), 1);
|
302900
303314
|
var import_node_fs34 = __toESM(require("fs"), 1);
|
302901
|
-
var
|
303315
|
+
var import_node_path45 = __toESM(require("path"), 1);
|
302902
303316
|
var import_which4 = __toESM(require_lib15(), 1);
|
302903
303317
|
|
302904
303318
|
// ../myst-to-typst/dist/container.js
|
@@ -304094,7 +304508,7 @@ async function runTypstExecutable(session, typstFile) {
|
|
304094
304508
|
if (!isTypstAvailable()) {
|
304095
304509
|
throw new Error("The typst CLI must be installed to build PDFs with typst");
|
304096
304510
|
}
|
304097
|
-
if (
|
304511
|
+
if (import_node_path45.default.extname(typstFile) !== ".typ") {
|
304098
304512
|
throw new Error(`invalid input file for typst executable: ${typstFile}`);
|
304099
304513
|
}
|
304100
304514
|
session.log.debug("Running typst compile");
|
@@ -304160,7 +304574,7 @@ async function localArticleToTypstRaw(session, templateOptions, opts) {
|
|
304160
304574
|
const toc = tic();
|
304161
304575
|
const results = await Promise.all(content3.map(async ({ mdast: mdast2, frontmatter, references }, ind) => {
|
304162
304576
|
await finalizeMdast(session, mdast2, frontmatter, fileArticles[ind].file, {
|
304163
|
-
imageWriteFolder:
|
304577
|
+
imageWriteFolder: import_node_path45.default.join(import_node_path45.default.dirname(output2), "files"),
|
304164
304578
|
imageAltOutputFolder: "files/",
|
304165
304579
|
imageExtensions: TYPST_IMAGE_EXTENSIONS,
|
304166
304580
|
simplifyFigures: true
|
@@ -304171,14 +304585,14 @@ async function localArticleToTypstRaw(session, templateOptions, opts) {
|
|
304171
304585
|
if (results.length === 1) {
|
304172
304586
|
writeFileToFolder(output2, results[0].value);
|
304173
304587
|
} else {
|
304174
|
-
const { dir, name: name3, ext: ext2 } =
|
304588
|
+
const { dir, name: name3, ext: ext2 } = import_node_path45.default.parse(output2);
|
304175
304589
|
let includeContent = "";
|
304176
304590
|
let fileInd = 0;
|
304177
304591
|
articles.forEach((article) => {
|
304178
304592
|
var _a6, _b, _c, _d2;
|
304179
304593
|
if (article.file) {
|
304180
304594
|
const base5 = `${name3}-${(_b = (_a6 = content3[fileInd]) === null || _a6 === void 0 ? void 0 : _a6.slug) !== null && _b !== void 0 ? _b : fileInd}${ext2}`;
|
304181
|
-
const includeFile =
|
304595
|
+
const includeFile = import_node_path45.default.format({ dir, ext: ext2, base: base5 });
|
304182
304596
|
let part = "";
|
304183
304597
|
const { title, content_includes_title } = (_d2 = (_c = content3[fileInd]) === null || _c === void 0 ? void 0 : _c.frontmatter) !== null && _d2 !== void 0 ? _d2 : {};
|
304184
304598
|
if (title && !content_includes_title) {
|
@@ -304205,7 +304619,7 @@ async function localArticleToTypstTemplated(session, file, templateOptions, opts
|
|
304205
304619
|
var _a6;
|
304206
304620
|
const { output: output2, articles, template } = templateOptions;
|
304207
304621
|
const { projectPath, extraLinkTransformers, clean: clean3, ci } = opts !== null && opts !== void 0 ? opts : {};
|
304208
|
-
const filesPath =
|
304622
|
+
const filesPath = import_node_path45.default.join(import_node_path45.default.dirname(output2), "files");
|
304209
304623
|
const fileArticles = articlesWithFile(articles);
|
304210
304624
|
const content3 = await getFileContent(session, fileArticles.map((article) => article.file), {
|
304211
304625
|
projectPath,
|
@@ -304214,7 +304628,7 @@ async function localArticleToTypstTemplated(session, file, templateOptions, opts
|
|
304214
304628
|
titleDepths: fileArticles.map((article) => article.level),
|
304215
304629
|
preFrontmatters: fileArticles.map((article) => filterKeys(article, [...PAGE_FRONTMATTER_KEYS, ...Object.keys(FRONTMATTER_ALIASES)]))
|
304216
304630
|
});
|
304217
|
-
const bibtexWritten = writeBibtexFromCitationRenderers(session,
|
304631
|
+
const bibtexWritten = writeBibtexFromCitationRenderers(session, import_node_path45.default.join(import_node_path45.default.dirname(output2), DEFAULT_BIB_FILENAME2), content3);
|
304218
304632
|
const warningLogFn = (message) => {
|
304219
304633
|
addWarningForFile(session, file, message, "warn", {
|
304220
304634
|
ruleId: RuleId.texRenders
|
@@ -304278,14 +304692,14 @@ async function localArticleToTypstTemplated(session, file, templateOptions, opts
|
|
304278
304692
|
} else {
|
304279
304693
|
const state = session.store.getState();
|
304280
304694
|
frontmatter = (_a6 = selectors_exports.selectLocalProjectConfig(state, projectPath !== null && projectPath !== void 0 ? projectPath : ".")) !== null && _a6 !== void 0 ? _a6 : {};
|
304281
|
-
const { dir, name: name3, ext: ext2 } =
|
304695
|
+
const { dir, name: name3, ext: ext2 } = import_node_path45.default.parse(output2);
|
304282
304696
|
typstContent = "";
|
304283
304697
|
let fileInd = 0;
|
304284
304698
|
articles.forEach((article) => {
|
304285
304699
|
var _a7, _b, _c, _d2;
|
304286
304700
|
if (article.file) {
|
304287
304701
|
const base5 = `${name3}-${(_b = (_a7 = content3[fileInd]) === null || _a7 === void 0 ? void 0 : _a7.slug) !== null && _b !== void 0 ? _b : fileInd}${ext2}`;
|
304288
|
-
const includeFile =
|
304702
|
+
const includeFile = import_node_path45.default.format({ dir, ext: ext2, base: base5 });
|
304289
304703
|
const exports2 = renderTypstImports(false, collected);
|
304290
304704
|
let part = "";
|
304291
304705
|
const { title, content_includes_title } = (_d2 = (_c = content3[fileInd]) === null || _c === void 0 ? void 0 : _c.frontmatter) !== null && _d2 !== void 0 ? _d2 : {};
|
@@ -304348,7 +304762,7 @@ async function runTypstZipExport(session, file, exportOptions, opts) {
|
|
304348
304762
|
cleanOutput(session, exportOptions.output);
|
304349
304763
|
const zipOutput = exportOptions.output;
|
304350
304764
|
const typFolder = createTempFolder(session);
|
304351
|
-
exportOptions.output =
|
304765
|
+
exportOptions.output = import_node_path45.default.join(typFolder, `${import_node_path45.default.basename(zipOutput, import_node_path45.default.extname(zipOutput))}.typ`);
|
304352
304766
|
await runTypstExport(session, file, exportOptions, { ...opts !== null && opts !== void 0 ? opts : {}, clean: false });
|
304353
304767
|
session.log.info(`\u{1F910} Zipping typst outputs to ${zipOutput}`);
|
304354
304768
|
const zip2 = new import_adm_zip3.default();
|
@@ -304361,9 +304775,9 @@ async function runTypstPdfExport(session, file, exportOptions, opts) {
|
|
304361
304775
|
cleanOutput(session, exportOptions.output);
|
304362
304776
|
const pdfOutput = exportOptions.output;
|
304363
304777
|
const typFolder = createTempFolder(session);
|
304364
|
-
exportOptions.output =
|
304778
|
+
exportOptions.output = import_node_path45.default.join(typFolder, `${import_node_path45.default.basename(pdfOutput, import_node_path45.default.extname(pdfOutput))}.typ`);
|
304365
304779
|
await runTypstExport(session, file, exportOptions, { ...opts !== null && opts !== void 0 ? opts : {}, clean: false });
|
304366
|
-
const writeFolder =
|
304780
|
+
const writeFolder = import_node_path45.default.dirname(pdfOutput);
|
304367
304781
|
session.log.info(`\u{1F5A8} Rendering typst pdf to ${pdfOutput}`);
|
304368
304782
|
if (!import_node_fs34.default.existsSync(writeFolder))
|
304369
304783
|
import_node_fs34.default.mkdirSync(writeFolder, { recursive: true });
|
@@ -304373,7 +304787,7 @@ async function runTypstPdfExport(session, file, exportOptions, opts) {
|
|
304373
304787
|
|
304374
304788
|
// ../myst-cli/dist/build/docx/single.js
|
304375
304789
|
var import_node_fs36 = __toESM(require("fs"), 1);
|
304376
|
-
var
|
304790
|
+
var import_node_path46 = __toESM(require("path"), 1);
|
304377
304791
|
|
304378
304792
|
// ../myst-to-docx/dist/serializer.js
|
304379
304793
|
var import_docx4 = __toESM(require_build(), 1);
|
@@ -305099,9 +305513,9 @@ function defaultWordRenderer(session, data, doc, opts, staticPath, vfile2) {
|
|
305099
305513
|
selectAll("footnoteDefinition", mdast2).forEach((footnote2) => {
|
305100
305514
|
serializer.render(footnote2);
|
305101
305515
|
});
|
305102
|
-
const logo =
|
305516
|
+
const logo = import_node_path46.default.join(staticPath, "logo.png");
|
305103
305517
|
const docfooter = import_node_fs36.default.existsSync(logo) && !opts.hideFooter ? createFooter(logo) : void 0;
|
305104
|
-
const styles16 =
|
305518
|
+
const styles16 = import_node_path46.default.join(staticPath, "styles.xml");
|
305105
305519
|
const docstyles = import_node_fs36.default.existsSync(styles16) ? import_node_fs36.default.readFileSync(styles16).toString() : void 0;
|
305106
305520
|
return createDocFromState(serializer, docfooter, docstyles);
|
305107
305521
|
}
|
@@ -305161,7 +305575,7 @@ async function runWordExport(session, file, exportOptions, opts) {
|
|
305161
305575
|
}
|
305162
305576
|
|
305163
305577
|
// ../myst-cli/dist/build/jats/single.js
|
305164
|
-
var
|
305578
|
+
var import_node_path47 = __toESM(require("path"), 1);
|
305165
305579
|
|
305166
305580
|
// ../myst-to-jats/dist/index.js
|
305167
305581
|
var import_xml_js2 = __toESM(require_lib19(), 1);
|
@@ -307651,7 +308065,7 @@ async function runJatsExport(session, sourceFile, exportOptions, opts) {
|
|
307651
308065
|
});
|
307652
308066
|
await Promise.all(processedContents.map(({ mdast: mdast2, frontmatter, file }) => {
|
307653
308067
|
return finalizeMdast(session, mdast2, frontmatter, file, {
|
307654
|
-
imageWriteFolder:
|
308068
|
+
imageWriteFolder: import_node_path47.default.join(import_node_path47.default.dirname(output2), "files"),
|
307655
308069
|
imageAltOutputFolder: "files/",
|
307656
308070
|
imageExtensions: KNOWN_IMAGE_EXTENSIONS,
|
307657
308071
|
simplifyFigures: false
|
@@ -307694,11 +308108,11 @@ async function runJatsExport(session, sourceFile, exportOptions, opts) {
|
|
307694
308108
|
}
|
307695
308109
|
|
307696
308110
|
// ../myst-cli/dist/build/pdf/single.js
|
307697
|
-
var
|
308111
|
+
var import_node_path49 = __toESM(require("path"), 1);
|
307698
308112
|
|
307699
308113
|
// ../myst-cli/dist/build/pdf/create.js
|
307700
308114
|
var import_node_fs37 = __toESM(require("fs"), 1);
|
307701
|
-
var
|
308115
|
+
var import_node_path48 = __toESM(require("path"), 1);
|
307702
308116
|
var import_util5 = __toESM(require("util"), 1);
|
307703
308117
|
|
307704
308118
|
// ../myst-cli/dist/build/pdf/utils.js
|
@@ -307714,8 +308128,8 @@ function isMakeglossariesAvailable() {
|
|
307714
308128
|
var copyFile = import_util5.default.promisify(import_node_fs37.default.copyFile);
|
307715
308129
|
function copyContents(srcFolder, destFolder) {
|
307716
308130
|
import_node_fs37.default.readdirSync(srcFolder).forEach((item) => {
|
307717
|
-
const srcItemPath =
|
307718
|
-
const destItemPath =
|
308131
|
+
const srcItemPath = import_node_path48.default.join(srcFolder, item);
|
308132
|
+
const destItemPath = import_node_path48.default.join(destFolder, item);
|
307719
308133
|
if (import_node_fs37.default.lstatSync(srcItemPath).isDirectory()) {
|
307720
308134
|
import_node_fs37.default.mkdirSync(destItemPath);
|
307721
308135
|
copyContents(srcItemPath, destItemPath);
|
@@ -307725,12 +308139,12 @@ function copyContents(srcFolder, destFolder) {
|
|
307725
308139
|
});
|
307726
308140
|
}
|
307727
308141
|
function getLogOutputFolder(pdfOutput) {
|
307728
|
-
const pdfBasename =
|
307729
|
-
return
|
308142
|
+
const pdfBasename = import_node_path48.default.basename(pdfOutput, import_node_path48.default.extname(pdfOutput));
|
308143
|
+
return import_node_path48.default.join(import_node_path48.default.dirname(pdfOutput), `${pdfBasename}_pdf_logs`);
|
307730
308144
|
}
|
307731
308145
|
function getTexOutputFolder(pdfOutput) {
|
307732
|
-
const pdfBasename =
|
307733
|
-
return
|
308146
|
+
const pdfBasename = import_node_path48.default.basename(pdfOutput, import_node_path48.default.extname(pdfOutput));
|
308147
|
+
return import_node_path48.default.join(import_node_path48.default.dirname(pdfOutput), `${pdfBasename}_pdf_tex`);
|
307734
308148
|
}
|
307735
308149
|
async function createPdfGivenTexExport(session, texExportOptions, pdfOutput, copyLogs, clean3, glossaries) {
|
307736
308150
|
if (clean3)
|
@@ -307773,8 +308187,8 @@ async function createPdfGivenTexExport(session, texExportOptions, pdfOutput, cop
|
|
307773
308187
|
const pdfBuildExists = import_node_fs37.default.existsSync(pdfBuild);
|
307774
308188
|
const logBuildExists = import_node_fs37.default.existsSync(logBuild);
|
307775
308189
|
const texLogBuildExists = import_node_fs37.default.existsSync(texLogBuild);
|
307776
|
-
if (pdfBuildExists && !import_node_fs37.default.existsSync(
|
307777
|
-
import_node_fs37.default.mkdirSync(
|
308190
|
+
if (pdfBuildExists && !import_node_fs37.default.existsSync(import_node_path48.default.dirname(pdfOutput))) {
|
308191
|
+
import_node_fs37.default.mkdirSync(import_node_path48.default.dirname(pdfOutput), { recursive: true });
|
307778
308192
|
}
|
307779
308193
|
if (pdfBuildExists) {
|
307780
308194
|
session.log.info(toc(`\u{1F4C4} Exported PDF ${templateLogString} in %s, copying to ${pdfOutput}`));
|
@@ -307784,8 +308198,8 @@ async function createPdfGivenTexExport(session, texExportOptions, pdfOutput, cop
|
|
307784
308198
|
fileError(vfile2, `Could not find ${pdfBuild} as expected`, { ruleId: RuleId.pdfBuilds });
|
307785
308199
|
}
|
307786
308200
|
if (copyLogs) {
|
307787
|
-
if ((logBuildExists || texLogBuildExists) && !import_node_fs37.default.existsSync(
|
307788
|
-
import_node_fs37.default.mkdirSync(
|
308201
|
+
if ((logBuildExists || texLogBuildExists) && !import_node_fs37.default.existsSync(import_node_path48.default.dirname(logOutput))) {
|
308202
|
+
import_node_fs37.default.mkdirSync(import_node_path48.default.dirname(logOutput), { recursive: true });
|
307789
308203
|
}
|
307790
308204
|
if (logBuildExists) {
|
307791
308205
|
session.log.debug(`Copying log file: ${logOutput}`);
|
@@ -307807,23 +308221,23 @@ async function createPdfGivenTexExport(session, texExportOptions, pdfOutput, cop
|
|
307807
308221
|
}
|
307808
308222
|
function ensurePaths(session, texOutput, pdfOutput) {
|
307809
308223
|
const buildPath = createTempFolder(session);
|
307810
|
-
const texFile =
|
307811
|
-
const texBuild =
|
307812
|
-
copyContents(
|
308224
|
+
const texFile = import_node_path48.default.basename(texOutput);
|
308225
|
+
const texBuild = import_node_path48.default.join(buildPath, texFile);
|
308226
|
+
copyContents(import_node_path48.default.dirname(texOutput), buildPath);
|
307813
308227
|
if (!import_node_fs37.default.existsSync(texBuild)) {
|
307814
308228
|
throw Error(`Error exporting: ${pdfOutput}
|
307815
308229
|
Could not find tex file: ${texOutput}`);
|
307816
308230
|
}
|
307817
|
-
const pdfBasename =
|
308231
|
+
const pdfBasename = import_node_path48.default.basename(pdfOutput, import_node_path48.default.extname(pdfOutput));
|
307818
308232
|
const pdfFile = `${pdfBasename}.pdf`;
|
307819
|
-
const pdfBuild =
|
308233
|
+
const pdfBuild = import_node_path48.default.join(buildPath, pdfFile);
|
307820
308234
|
const logFile = `${pdfBasename}.log`;
|
307821
308235
|
const texLogFile = `${pdfBasename}.shell.log`;
|
307822
|
-
const logBuild =
|
307823
|
-
const texLogBuild =
|
308236
|
+
const logBuild = import_node_path48.default.join(buildPath, logFile);
|
308237
|
+
const texLogBuild = import_node_path48.default.join(buildPath, texLogFile);
|
307824
308238
|
const logOutputFolder = getLogOutputFolder(pdfOutput);
|
307825
|
-
const logOutput =
|
307826
|
-
const texLogOutput =
|
308239
|
+
const logOutput = import_node_path48.default.join(logOutputFolder, logFile);
|
308240
|
+
const texLogOutput = import_node_path48.default.join(logOutputFolder, texLogFile);
|
307827
308241
|
return {
|
307828
308242
|
buildPath,
|
307829
308243
|
texFile,
|
@@ -307911,23 +308325,23 @@ ${docLinks.installLatex}`);
|
|
307911
308325
|
|
307912
308326
|
// ../myst-cli/dist/build/pdf/single.js
|
307913
308327
|
function texExportOptionsFromPdf(session, pdfExp, keepTex, clean3) {
|
307914
|
-
const basename3 =
|
308328
|
+
const basename3 = import_node_path49.default.basename(pdfExp.output, import_node_path49.default.extname(pdfExp.output));
|
307915
308329
|
const outputTexFile = `${basename3}.tex`;
|
307916
308330
|
let output2;
|
307917
308331
|
if (keepTex) {
|
307918
308332
|
const texOutputFolder = getTexOutputFolder(pdfExp.output);
|
307919
308333
|
if (clean3)
|
307920
308334
|
cleanOutput(session, texOutputFolder);
|
307921
|
-
output2 =
|
308335
|
+
output2 = import_node_path49.default.join(texOutputFolder, outputTexFile);
|
307922
308336
|
} else {
|
307923
|
-
output2 =
|
308337
|
+
output2 = import_node_path49.default.join(createTempFolder(session), outputTexFile);
|
307924
308338
|
}
|
307925
308339
|
return { ...pdfExp, format: ExportFormats.tex, output: output2 };
|
307926
308340
|
}
|
307927
308341
|
|
307928
308342
|
// ../myst-cli/dist/build/meca/index.js
|
307929
308343
|
var import_node_fs38 = __toESM(require("fs"), 1);
|
307930
|
-
var
|
308344
|
+
var import_node_path50 = __toESM(require("path"), 1);
|
307931
308345
|
var import_adm_zip4 = __toESM(require_adm_zip(), 1);
|
307932
308346
|
var import_mime_types2 = __toESM(require_mime_types(), 1);
|
307933
308347
|
|
@@ -308011,7 +308425,7 @@ function mediaTypeFromFile(file) {
|
|
308011
308425
|
const mediaType = import_mime_types2.default.lookup(file);
|
308012
308426
|
if (mediaType)
|
308013
308427
|
return mediaType;
|
308014
|
-
const ext2 =
|
308428
|
+
const ext2 = import_node_path50.default.extname(file);
|
308015
308429
|
if (ext2 === ".ipynb")
|
308016
308430
|
return "application/x-ipynb+json";
|
308017
308431
|
if (ext2 === ".bib")
|
@@ -308021,7 +308435,7 @@ function mediaTypeFromFile(file) {
|
|
308021
308435
|
function addManifestItem(manifestItems, itemType, mecaFolder, file, mediaType) {
|
308022
308436
|
if (!file)
|
308023
308437
|
return;
|
308024
|
-
const hrefPath =
|
308438
|
+
const hrefPath = import_node_path50.default.relative(mecaFolder, file).split(import_node_path50.default.sep).join("/");
|
308025
308439
|
const hrefTrail = isDirectory(file) ? "/" : "";
|
308026
308440
|
manifestItems.push({
|
308027
308441
|
href: `${hrefPath}${hrefTrail}`,
|
@@ -308030,7 +308444,7 @@ function addManifestItem(manifestItems, itemType, mecaFolder, file, mediaType) {
|
|
308030
308444
|
});
|
308031
308445
|
}
|
308032
308446
|
function bundleFolder(folder) {
|
308033
|
-
return
|
308447
|
+
return import_node_path50.default.join(folder, "bundle");
|
308034
308448
|
}
|
308035
308449
|
async function copyFilesFromConfig(session, projectPath, mecaFolder, manifestItems, errorLogFn) {
|
308036
308450
|
var _a6, _b;
|
@@ -308045,9 +308459,9 @@ async function copyFilesFromConfig(session, projectPath, mecaFolder, manifestIte
|
|
308045
308459
|
];
|
308046
308460
|
if (entries2.length) {
|
308047
308461
|
await Promise.all(entries2.map(async ({ itemType, entry }) => {
|
308048
|
-
const resolvedEntry = [...projectPath.split(
|
308462
|
+
const resolvedEntry = [...projectPath.split(import_node_path50.default.sep), entry].join("/");
|
308049
308463
|
const matches4 = await glob(resolvedEntry);
|
308050
|
-
matches4.map((match3) => match3.split("/").join(
|
308464
|
+
matches4.map((match3) => match3.split("/").join(import_node_path50.default.sep)).filter((match3) => !isDirectory(match3)).forEach((match3) => {
|
308051
308465
|
const destination = copyFileMaintainPath(session, match3, projectPath, bundleFolder(mecaFolder), errorLogFn);
|
308052
308466
|
addManifestItem(manifestItems, itemType, mecaFolder, destination);
|
308053
308467
|
});
|
@@ -308070,7 +308484,7 @@ async function copyDependentFiles(session, sourceFile, projectPath, mecaFolder,
|
|
308070
308484
|
...urlNodes.map((node3) => node3.url),
|
308071
308485
|
...fileNodes.map((node3) => node3.file),
|
308072
308486
|
frontmatter === null || frontmatter === void 0 ? void 0 : frontmatter.thumbnail
|
308073
|
-
].filter((file) => !!file).map((file) =>
|
308487
|
+
].filter((file) => !!file).map((file) => import_node_path50.default.resolve(import_node_path50.default.dirname(sourceFile), file)).filter((file) => import_node_fs38.default.existsSync(file));
|
308074
308488
|
filesToCopy.forEach((file) => {
|
308075
308489
|
const dependency = copyFileMaintainPath(session, file, projectPath, bundleFolder(mecaFolder), errorLogFn);
|
308076
308490
|
addManifestItem(manifestItems, "article-source", mecaFolder, dependency);
|
@@ -308078,7 +308492,7 @@ async function copyDependentFiles(session, sourceFile, projectPath, mecaFolder,
|
|
308078
308492
|
}
|
308079
308493
|
function writeMecaManifest(manifestItems, mecaFolder) {
|
308080
308494
|
const manifest = createManifestXml(manifestItems);
|
308081
|
-
import_node_fs38.default.writeFileSync(
|
308495
|
+
import_node_fs38.default.writeFileSync(import_node_path50.default.join(mecaFolder, "manifest.xml"), manifest);
|
308082
308496
|
}
|
308083
308497
|
async function runMecaExport(session, sourceFile, exportOptions, opts) {
|
308084
308498
|
var _a6;
|
@@ -308099,13 +308513,13 @@ async function runMecaExport(session, sourceFile, exportOptions, opts) {
|
|
308099
308513
|
projectPath
|
308100
308514
|
});
|
308101
308515
|
if (jatsExports.length === 0 && articleFile) {
|
308102
|
-
const jatsOutput =
|
308516
|
+
const jatsOutput = import_node_path50.default.join(mecaFolder, "article.xml");
|
308103
308517
|
await runJatsExport(session, sourceFile, { ...exportOptions, output: jatsOutput }, { projectPath, clean: clean3, extraLinkTransformers });
|
308104
308518
|
addManifestItem(manifestItems, "article-metadata", mecaFolder, jatsOutput);
|
308105
|
-
const jatsFiles =
|
308519
|
+
const jatsFiles = import_node_path50.default.join(mecaFolder, "files");
|
308106
308520
|
if (import_node_fs38.default.existsSync(jatsFiles)) {
|
308107
308521
|
import_node_fs38.default.readdirSync(jatsFiles).forEach((file) => {
|
308108
|
-
addManifestItem(manifestItems, "article-supporting-file", mecaFolder,
|
308522
|
+
addManifestItem(manifestItems, "article-supporting-file", mecaFolder, import_node_path50.default.join(mecaFolder, "files", file));
|
308109
308523
|
});
|
308110
308524
|
}
|
308111
308525
|
} else if (jatsExports.length === 0) {
|
@@ -308129,11 +308543,11 @@ To resolve this, run: myst build --all`, {
|
|
308129
308543
|
if (jatsDest) {
|
308130
308544
|
addManifestItem(manifestItems, "article-metadata", mecaFolder, jatsDest);
|
308131
308545
|
}
|
308132
|
-
const jatsFiles =
|
308546
|
+
const jatsFiles = import_node_path50.default.join(import_node_path50.default.dirname(jatsOutput), "files");
|
308133
308547
|
if (import_node_fs38.default.existsSync(jatsFiles)) {
|
308134
308548
|
import_node_fs38.default.readdirSync(jatsFiles).forEach((file) => {
|
308135
|
-
const src =
|
308136
|
-
const fileDest = copyFileToFolder(session, src,
|
308549
|
+
const src = import_node_path50.default.join(jatsFiles, file);
|
308550
|
+
const fileDest = copyFileToFolder(session, src, import_node_path50.default.join(mecaFolder, "files"), fileCopyErrorLogFn);
|
308137
308551
|
addManifestItem(manifestItems, "article-supporting-file", mecaFolder, fileDest);
|
308138
308552
|
});
|
308139
308553
|
}
|
@@ -308141,7 +308555,7 @@ To resolve this, run: myst build --all`, {
|
|
308141
308555
|
const manuscriptExports = (await collectExportOptions(session, articleFile ? [articleFile] : [], [ExportFormats.docx, ExportFormats.pdf, ExportFormats.tex], {
|
308142
308556
|
projectPath
|
308143
308557
|
})).filter((exp) => {
|
308144
|
-
return exp.format !== ExportFormats.tex ||
|
308558
|
+
return exp.format !== ExportFormats.tex || import_node_path50.default.extname(exp.output) === ".zip";
|
308145
308559
|
});
|
308146
308560
|
manuscriptExports.forEach(({ output: manuscriptOutput }) => {
|
308147
308561
|
if (!import_node_fs38.default.existsSync(manuscriptOutput)) {
|
@@ -308162,12 +308576,12 @@ To resolve this, run: myst build --all`, {
|
|
308162
308576
|
addManifestItem(manifestItems, "article-source", mecaFolder, configDest);
|
308163
308577
|
await copyFilesFromConfig(session, projectPath, mecaFolder, manifestItems, fileCopyErrorLogFn);
|
308164
308578
|
}
|
308165
|
-
if (import_node_fs38.default.existsSync(
|
308166
|
-
copyFileToFolder(session,
|
308579
|
+
if (import_node_fs38.default.existsSync(import_node_path50.default.join(projectPath, "_toc.yml"))) {
|
308580
|
+
copyFileToFolder(session, import_node_path50.default.join(projectPath, "_toc.yml"), bundle, fileCopyErrorLogFn);
|
308167
308581
|
} else {
|
308168
308582
|
writeTOCFromProject(project, bundle);
|
308169
308583
|
}
|
308170
|
-
addManifestItem(manifestItems, "article-source", mecaFolder,
|
308584
|
+
addManifestItem(manifestItems, "article-source", mecaFolder, import_node_path50.default.join(bundle, "_toc.yml"));
|
308171
308585
|
const projectPages = [
|
308172
308586
|
{ page: project.file, itemType: "article-source" },
|
308173
308587
|
...project.pages.filter((page) => {
|
@@ -308189,7 +308603,7 @@ To resolve this, run: myst build --all`, {
|
|
308189
308603
|
addManifestItem(manifestItems, "article-source", mecaFolder, articleDest);
|
308190
308604
|
}
|
308191
308605
|
if (import_node_fs38.default.existsSync(bundle)) {
|
308192
|
-
addManifestItem(manifestItems, "article-source-directory", mecaFolder,
|
308606
|
+
addManifestItem(manifestItems, "article-source-directory", mecaFolder, import_node_path50.default.join(bundle, ""), "application/x-directory");
|
308193
308607
|
}
|
308194
308608
|
writeMecaManifest(manifestItems, mecaFolder);
|
308195
308609
|
const zip2 = new import_adm_zip4.default();
|
@@ -308201,7 +308615,7 @@ To resolve this, run: myst build --all`, {
|
|
308201
308615
|
}
|
308202
308616
|
|
308203
308617
|
// ../myst-cli/dist/build/md/index.js
|
308204
|
-
var
|
308618
|
+
var import_node_path51 = __toESM(require("path"), 1);
|
308205
308619
|
|
308206
308620
|
// ../../node_modules/character-entities/index.js
|
308207
308621
|
var characterEntities = {
|
@@ -311776,7 +312190,7 @@ var handle5 = {
|
|
311776
312190
|
};
|
311777
312191
|
|
311778
312192
|
// ../../node_modules/mdast-util-to-markdown/lib/join.js
|
311779
|
-
var
|
312193
|
+
var join15 = [joinDefaults];
|
311780
312194
|
function joinDefaults(left2, right2, parent2, state) {
|
311781
312195
|
if (right2.type === "code" && formatCodeAsIndented(right2, state) && (left2.type === "list" || left2.type === right2.type && formatCodeAsIndented(left2, state))) {
|
311782
312196
|
return false;
|
@@ -311948,7 +312362,7 @@ function toMarkdown(tree, options = {}) {
|
|
311948
312362
|
// @ts-expect-error: we’ll add `handle` later.
|
311949
312363
|
handle: void 0
|
311950
312364
|
};
|
311951
|
-
configure(state, { unsafe, join:
|
312365
|
+
configure(state, { unsafe, join: join15, handlers: handle5 });
|
311952
312366
|
configure(state, options);
|
311953
312367
|
if (state.options.tightDefinitions) {
|
311954
312368
|
configure(state, { join: [joinDefinition] });
|
@@ -312591,7 +313005,7 @@ async function runMdExport(session, sourceFile, exportOptions, opts) {
|
|
312591
313005
|
]
|
312592
313006
|
});
|
312593
313007
|
await finalizeMdast(session, mdast2, frontmatter, article.file, {
|
312594
|
-
imageWriteFolder:
|
313008
|
+
imageWriteFolder: import_node_path51.default.join(import_node_path51.default.dirname(output2), "files"),
|
312595
313009
|
imageAltOutputFolder: "files/",
|
312596
313010
|
imageExtensions: KNOWN_IMAGE_EXTENSIONS,
|
312597
313011
|
simplifyFigures: false,
|
@@ -312645,21 +313059,21 @@ async function _localArticleExport(session, exportOptionsList, opts) {
|
|
312645
313059
|
const { $file, $project, ...exportOptions } = exportOptionsWithFile;
|
312646
313060
|
const { format, output: output2 } = exportOptions;
|
312647
313061
|
const sessionClone = session.clone();
|
312648
|
-
const fileProjectPath = (_a6 = projectPath !== null && projectPath !== void 0 ? projectPath : $project) !== null && _a6 !== void 0 ? _a6 : findCurrentProjectAndLoad(sessionClone,
|
313062
|
+
const fileProjectPath = (_a6 = projectPath !== null && projectPath !== void 0 ? projectPath : $project) !== null && _a6 !== void 0 ? _a6 : findCurrentProjectAndLoad(sessionClone, import_node_path52.default.dirname($file));
|
312649
313063
|
if (fileProjectPath) {
|
312650
313064
|
await loadProjectFromDisk(sessionClone, fileProjectPath);
|
312651
313065
|
}
|
312652
313066
|
let exportFn;
|
312653
313067
|
if (format === ExportFormats.tex) {
|
312654
|
-
if (
|
313068
|
+
if (import_node_path52.default.extname(output2) === ".zip") {
|
312655
313069
|
exportFn = runTexZipExport;
|
312656
313070
|
} else {
|
312657
313071
|
exportFn = runTexExport;
|
312658
313072
|
}
|
312659
313073
|
} else if (format === ExportFormats.typst) {
|
312660
|
-
if (
|
313074
|
+
if (import_node_path52.default.extname(output2) === ".zip") {
|
312661
313075
|
exportFn = runTypstZipExport;
|
312662
|
-
} else if (
|
313076
|
+
} else if (import_node_path52.default.extname(output2) === ".pdf") {
|
312663
313077
|
exportFn = runTypstPdfExport;
|
312664
313078
|
} else {
|
312665
313079
|
exportFn = runTypstExport;
|
@@ -312697,7 +313111,7 @@ async function localArticleExport(session, exportOptionsList, opts) {
|
|
312697
313111
|
|
312698
313112
|
// ../myst-cli/dist/build/html/index.js
|
312699
313113
|
var import_fs_extra = __toESM(require_lib20(), 1);
|
312700
|
-
var
|
313114
|
+
var import_node_path55 = __toESM(require("path"), 1);
|
312701
313115
|
|
312702
313116
|
// ../myst-cli/dist/build/site/start.js
|
312703
313117
|
var import_cors = __toESM(require_lib21(), 1);
|
@@ -312838,7 +313252,7 @@ function portNumbers(from4, to) {
|
|
312838
313252
|
}
|
312839
313253
|
|
312840
313254
|
// ../myst-cli/dist/build/site/start.js
|
312841
|
-
var
|
313255
|
+
var import_node_path54 = require("path");
|
312842
313256
|
|
312843
313257
|
// ../../node_modules/ws/wrapper.mjs
|
312844
313258
|
var import_stream = __toESM(require_stream(), 1);
|
@@ -312898,7 +313312,7 @@ function createServerLogger(session, ready) {
|
|
312898
313312
|
|
312899
313313
|
// ../myst-cli/dist/build/site/watch.js
|
312900
313314
|
var import_chokidar2 = __toESM(require_chokidar(), 1);
|
312901
|
-
var
|
313315
|
+
var import_node_path53 = require("path");
|
312902
313316
|
function watchConfigAndPublic(session, serverReload, opts) {
|
312903
313317
|
const watchFiles = ["public"];
|
312904
313318
|
const siteConfigFile = selectors_exports.selectCurrentSiteFile(session.store.getState());
|
@@ -312912,7 +313326,7 @@ function watchConfigAndPublic(session, serverReload, opts) {
|
|
312912
313326
|
function triggerProjectReload(session, file, eventType, projectPath) {
|
312913
313327
|
const state = session.store.getState();
|
312914
313328
|
const projectConfigFile = projectPath ? selectors_exports.selectLocalConfigFile(state, projectPath) : selectors_exports.selectCurrentProjectFile(state);
|
312915
|
-
if (file === projectConfigFile || (0,
|
313329
|
+
if (file === projectConfigFile || (0, import_node_path53.basename)(file) === "_toc.yml")
|
312916
313330
|
return true;
|
312917
313331
|
if (["add", "unlink"].includes(eventType))
|
312918
313332
|
return true;
|
@@ -312921,11 +313335,11 @@ function triggerProjectReload(session, file, eventType, projectPath) {
|
|
312921
313335
|
async function processorFn(session, file, eventType, siteProject, serverReload, opts) {
|
312922
313336
|
if (file) {
|
312923
313337
|
changeFile(session, file, eventType);
|
312924
|
-
if (KNOWN_FAST_BUILDS.has((0,
|
313338
|
+
if (KNOWN_FAST_BUILDS.has((0, import_node_path53.extname)(file)) && eventType === "unlink") {
|
312925
313339
|
session.log.info(`\u{1F6AE} File ${file} deleted...`);
|
312926
313340
|
}
|
312927
313341
|
}
|
312928
|
-
if (!siteProject || !file || !KNOWN_FAST_BUILDS.has((0,
|
313342
|
+
if (!siteProject || !file || !KNOWN_FAST_BUILDS.has((0, import_node_path53.extname)(file)) || ["add", "unlink"].includes(eventType)) {
|
312929
313343
|
let reloadProject = false;
|
312930
313344
|
if (file && triggerProjectReload(session, file, eventType, siteProject === null || siteProject === void 0 ? void 0 : siteProject.path)) {
|
312931
313345
|
session.log.info("\u{1F4A5} Triggered full project load and site rebuild");
|
@@ -313010,7 +313424,7 @@ function watchContent(session, serverReload, opts) {
|
|
313010
313424
|
return Boolean(proj.path);
|
313011
313425
|
});
|
313012
313426
|
localProjects.forEach((proj) => {
|
313013
|
-
const ignored = proj.path === "." ? localProjects.filter(({ path: path42 }) => path42 !== ".").map(({ path: path42 }) => (0,
|
313427
|
+
const ignored = proj.path === "." ? localProjects.filter(({ path: path42 }) => path42 !== ".").map(({ path: path42 }) => (0, import_node_path53.join)(path42, "*")) : [];
|
313014
313428
|
if (siteConfigFile)
|
313015
313429
|
ignored.push(siteConfigFile);
|
313016
313430
|
const projectConfig = selectors_exports.selectLocalProjectConfig(state, proj.path);
|
@@ -313043,9 +313457,9 @@ async function startContentServer(session, opts) {
|
|
313043
313457
|
});
|
313044
313458
|
app.use("/", import_express.default.static(session.publicPath()));
|
313045
313459
|
app.use("/content", import_express.default.static(session.contentPath()));
|
313046
|
-
app.use("/config.json", import_express.default.static((0,
|
313047
|
-
app.use("/objects.inv", import_express.default.static((0,
|
313048
|
-
app.use("/myst.xref.json", import_express.default.static((0,
|
313460
|
+
app.use("/config.json", import_express.default.static((0, import_node_path54.join)(session.sitePath(), "config.json")));
|
313461
|
+
app.use("/objects.inv", import_express.default.static((0, import_node_path54.join)(session.sitePath(), "objects.inv")));
|
313462
|
+
app.use("/myst.xref.json", import_express.default.static((0, import_node_path54.join)(session.sitePath(), "myst.xref.json")));
|
313049
313463
|
const server = app.listen(port, () => {
|
313050
313464
|
session.log.debug(`Content server listening on port ${port}`);
|
313051
313465
|
});
|
@@ -313160,24 +313574,24 @@ async function currentSiteRoutes(session, host, baseurl, opts) {
|
|
313160
313574
|
const siteIndex = baseurl ? `/${proj.index}` : "";
|
313161
313575
|
const pages = proj.pages.filter((page) => !!page.slug);
|
313162
313576
|
return [
|
313163
|
-
{ url: `${host}${projSlug}${siteIndex}`, path:
|
313577
|
+
{ url: `${host}${projSlug}${siteIndex}`, path: import_node_path55.default.join((_a7 = proj.slug) !== null && _a7 !== void 0 ? _a7 : "", "index.html") },
|
313164
313578
|
...pages.map((page) => {
|
313165
313579
|
var _a8;
|
313166
313580
|
return {
|
313167
313581
|
url: `${host}${projSlug}/${page.slug}`,
|
313168
|
-
path:
|
313582
|
+
path: import_node_path55.default.join((_a8 = proj.slug) !== null && _a8 !== void 0 ? _a8 : "", `${page.slug}.html`)
|
313169
313583
|
};
|
313170
313584
|
}),
|
313171
313585
|
// Download all of the configured JSON
|
313172
313586
|
{
|
313173
313587
|
url: `${host}${projSlug}/${proj.index}.json`,
|
313174
|
-
path:
|
313588
|
+
path: import_node_path55.default.join((_b2 = proj.slug) !== null && _b2 !== void 0 ? _b2 : "", `${proj.index}.json`)
|
313175
313589
|
},
|
313176
313590
|
...pages.map((page) => {
|
313177
313591
|
var _a8;
|
313178
313592
|
return {
|
313179
313593
|
url: `${host}${projSlug}/${page.slug}.json`,
|
313180
|
-
path:
|
313594
|
+
path: import_node_path55.default.join((_a8 = proj.slug) !== null && _a8 !== void 0 ? _a8 : "", `${page.slug}.json`)
|
313181
313595
|
};
|
313182
313596
|
}),
|
313183
313597
|
// Download other assets
|
@@ -313191,16 +313605,16 @@ async function currentSiteRoutes(session, host, baseurl, opts) {
|
|
313191
313605
|
var ASSETS_FOLDER = "myst_assets_folder";
|
313192
313606
|
function rewriteAssetsFolder(directory, baseurl) {
|
313193
313607
|
import_fs_extra.default.readdirSync(directory).forEach((filename) => {
|
313194
|
-
const file =
|
313608
|
+
const file = import_node_path55.default.join(directory, filename);
|
313195
313609
|
if (import_fs_extra.default.statSync(file).isDirectory()) {
|
313196
313610
|
rewriteAssetsFolder(file, baseurl);
|
313197
313611
|
return;
|
313198
313612
|
}
|
313199
|
-
if (
|
313613
|
+
if (import_node_path55.default.extname(file) === ".map") {
|
313200
313614
|
import_fs_extra.default.rmSync(file);
|
313201
313615
|
return;
|
313202
313616
|
}
|
313203
|
-
if (![".html", ".js", ".json"].includes(
|
313617
|
+
if (![".html", ".js", ".json"].includes(import_node_path55.default.extname(file)))
|
313204
313618
|
return;
|
313205
313619
|
const data = import_fs_extra.default.readFileSync(file).toString();
|
313206
313620
|
const modified = data.replace(new RegExp(`\\/${ASSETS_FOLDER}\\/`, "g"), `${baseurl || ""}/build/`);
|
@@ -313225,7 +313639,7 @@ function get_baseurl(session) {
|
|
313225
313639
|
async function buildHtml(session, opts) {
|
313226
313640
|
const template = await getMystTemplate(session, opts);
|
313227
313641
|
const baseurl = get_baseurl(session);
|
313228
|
-
const htmlDir =
|
313642
|
+
const htmlDir = import_node_path55.default.join(session.buildPath(), "html");
|
313229
313643
|
import_fs_extra.default.rmSync(htmlDir, { recursive: true, force: true });
|
313230
313644
|
import_fs_extra.default.mkdirSync(htmlDir, { recursive: true });
|
313231
313645
|
const appServer = await startServer(session, { ...opts, buildStatic: true, baseurl });
|
@@ -313240,15 +313654,15 @@ async function buildHtml(session, opts) {
|
|
313240
313654
|
return;
|
313241
313655
|
}
|
313242
313656
|
const content3 = await resp.text();
|
313243
|
-
writeFileToFolder(
|
313657
|
+
writeFileToFolder(import_node_path55.default.join(htmlDir, page.path), content3);
|
313244
313658
|
}));
|
313245
313659
|
appServer.stop();
|
313246
|
-
const templateBuildDir =
|
313660
|
+
const templateBuildDir = import_node_path55.default.join(template.templatePath, "public");
|
313247
313661
|
import_fs_extra.default.copySync(templateBuildDir, htmlDir);
|
313248
|
-
import_fs_extra.default.copySync(session.publicPath(),
|
313249
|
-
import_fs_extra.default.copySync(
|
313250
|
-
import_fs_extra.default.copySync(
|
313251
|
-
import_fs_extra.default.copySync(
|
313662
|
+
import_fs_extra.default.copySync(session.publicPath(), import_node_path55.default.join(htmlDir, "build"));
|
313663
|
+
import_fs_extra.default.copySync(import_node_path55.default.join(session.sitePath(), "config.json"), import_node_path55.default.join(htmlDir, "config.json"));
|
313664
|
+
import_fs_extra.default.copySync(import_node_path55.default.join(session.sitePath(), "objects.inv"), import_node_path55.default.join(htmlDir, "objects.inv"));
|
313665
|
+
import_fs_extra.default.copySync(import_node_path55.default.join(session.sitePath(), "myst.xref.json"), import_node_path55.default.join(htmlDir, "myst.xref.json"));
|
313252
313666
|
rewriteAssetsFolder(htmlDir, baseurl);
|
313253
313667
|
process.exit(0);
|
313254
313668
|
}
|
@@ -313309,7 +313723,7 @@ function getProjectPaths(session) {
|
|
313309
313723
|
var _a6, _b, _c;
|
313310
313724
|
const siteConfig = selectors_exports.selectCurrentSiteConfig(session.store.getState());
|
313311
313725
|
const projectPaths = [
|
313312
|
-
(_a6 = selectors_exports.selectCurrentProjectPath(session.store.getState())) !== null && _a6 !== void 0 ? _a6 :
|
313726
|
+
(_a6 = selectors_exports.selectCurrentProjectPath(session.store.getState())) !== null && _a6 !== void 0 ? _a6 : import_node_path56.default.resolve("."),
|
313313
313727
|
...(_c = (_b = siteConfig === null || siteConfig === void 0 ? void 0 : siteConfig.projects) === null || _b === void 0 ? void 0 : _b.map((proj) => proj.path).filter((projectPath) => !!projectPath)) !== null && _c !== void 0 ? _c : []
|
313314
313728
|
];
|
313315
313729
|
return uniqueArray(projectPaths);
|
@@ -313317,7 +313731,7 @@ function getProjectPaths(session) {
|
|
313317
313731
|
async function collectAllBuildExportOptions(session, files, opts) {
|
313318
313732
|
var _a6;
|
313319
313733
|
const { output: output2 } = opts;
|
313320
|
-
files = files.map((file) =>
|
313734
|
+
files = files.map((file) => import_node_path56.default.resolve(file));
|
313321
313735
|
if (output2 && files.length !== 1) {
|
313322
313736
|
throw new Error("When specifying a named output for export, you must list exactly one file.");
|
313323
313737
|
}
|
@@ -313326,16 +313740,16 @@ async function collectAllBuildExportOptions(session, files, opts) {
|
|
313326
313740
|
throw new Error(`When specifying output, you can only request one format`);
|
313327
313741
|
}
|
313328
313742
|
let exportOptionsList;
|
313329
|
-
const projectPath = findCurrentProjectAndLoad(session, files[0] ?
|
313743
|
+
const projectPath = findCurrentProjectAndLoad(session, files[0] ? import_node_path56.default.dirname(files[0]) : ".");
|
313330
313744
|
if (projectPath)
|
313331
313745
|
await loadProjectFromDisk(session, projectPath);
|
313332
313746
|
if (output2) {
|
313333
313747
|
session.log.debug(`Exporting formats: "${requestedFormats.join('", "')}"`);
|
313334
|
-
const format = (_a6 = requestedFormats[0]) !== null && _a6 !== void 0 ? _a6 : EXT_TO_FORMAT[
|
313748
|
+
const format = (_a6 = requestedFormats[0]) !== null && _a6 !== void 0 ? _a6 : EXT_TO_FORMAT[import_node_path56.default.extname(output2)];
|
313335
313749
|
if (!format) {
|
313336
313750
|
throw new Error(`Cannot specify format from output "${output2}" - please specify format option, e.g. --pdf`);
|
313337
313751
|
}
|
313338
|
-
exportOptionsList = resolveExportListArticles(session, files[0], [{ format, output:
|
313752
|
+
exportOptionsList = resolveExportListArticles(session, files[0], [{ format, output: import_node_path56.default.join(import_node_path56.default.resolve("."), output2) }], projectPath, opts).map((exp) => {
|
313339
313753
|
return { ...exp, $file: files[0], $project: projectPath };
|
313340
313754
|
});
|
313341
313755
|
} else if (files.length) {
|
@@ -313395,7 +313809,7 @@ async function build(session, files, opts) {
|
|
313395
313809
|
exports: exportOptionsList
|
313396
313810
|
};
|
313397
313811
|
const exportLogList = exportOptionsList.map((exportOptions) => {
|
313398
|
-
return `${
|
313812
|
+
return `${import_node_path56.default.relative(".", exportOptions.$file)} -> ${exportOptions.output}`;
|
313399
313813
|
});
|
313400
313814
|
if (exportLogList.length === 0) {
|
313401
313815
|
if (!(site || performSiteBuild)) {
|
@@ -313442,7 +313856,7 @@ exports:
|
|
313442
313856
|
|
313443
313857
|
// ../myst-cli/dist/build/clean.js
|
313444
313858
|
var import_node_fs39 = __toESM(require("fs"), 1);
|
313445
|
-
var
|
313859
|
+
var import_node_path57 = __toESM(require("path"), 1);
|
313446
313860
|
|
313447
313861
|
// ../../node_modules/inquirer/node_modules/chalk/source/vendor/ansi-styles/index.js
|
313448
313862
|
var ANSI_BACKGROUND_OFFSET4 = 10;
|
@@ -314410,7 +314824,7 @@ var Prompt = class {
|
|
314410
314824
|
(filteredValue) => {
|
314411
314825
|
this.startSpinner(filteredValue, this.opt.validatingText);
|
314412
314826
|
return validate5(filteredValue, self2.answers).then(
|
314413
|
-
(
|
314827
|
+
(isValid3) => ({ isValid: isValid3, value: filteredValue }),
|
314414
314828
|
(err) => ({ isValid: err, value: filteredValue })
|
314415
314829
|
);
|
314416
314830
|
},
|
@@ -314658,10 +315072,10 @@ var InputPrompt = class extends Prompt {
|
|
314658
315072
|
this.screen.done();
|
314659
315073
|
this.done(state.value);
|
314660
315074
|
}
|
314661
|
-
onError({ value = "", isValid:
|
315075
|
+
onError({ value = "", isValid: isValid3 }) {
|
314662
315076
|
this.rl.line += value;
|
314663
315077
|
this.rl.cursor += value.length;
|
314664
|
-
this.render(
|
315078
|
+
this.render(isValid3);
|
314665
315079
|
}
|
314666
315080
|
/**
|
314667
315081
|
* When user press a key
|
@@ -315800,8 +316214,8 @@ function coerceOpts(opts) {
|
|
315800
316214
|
function isSubpath(item, folder) {
|
315801
316215
|
if (item === folder)
|
315802
316216
|
return false;
|
315803
|
-
const itemParts = item.split(
|
315804
|
-
const folderParts = folder.split(
|
316217
|
+
const itemParts = item.split(import_node_path57.default.sep);
|
316218
|
+
const folderParts = folder.split(import_node_path57.default.sep);
|
315805
316219
|
let subpath = true;
|
315806
316220
|
folderParts.forEach((part, index4) => {
|
315807
316221
|
if (itemParts[index4] !== part)
|
@@ -315842,7 +316256,7 @@ async function clean2(session, files, opts) {
|
|
315842
316256
|
...exportOptionsList.map((exp) => exp.$project)
|
315843
316257
|
];
|
315844
316258
|
projectPaths.filter((projPath) => Boolean(projPath)).forEach((projPath) => {
|
315845
|
-
buildFolders.push(
|
316259
|
+
buildFolders.push(import_node_path57.default.join(projPath, "_build"));
|
315846
316260
|
});
|
315847
316261
|
buildFolders.push(session.buildPath());
|
315848
316262
|
}
|
@@ -315850,19 +316264,19 @@ async function clean2(session, files, opts) {
|
|
315850
316264
|
if (temp || logs || cache || exports2 || templates || execute || html7) {
|
315851
316265
|
buildFolders.forEach((folder) => {
|
315852
316266
|
if (temp)
|
315853
|
-
pathsToDelete.push(
|
316267
|
+
pathsToDelete.push(import_node_path57.default.join(folder, "temp"));
|
315854
316268
|
if (logs)
|
315855
|
-
pathsToDelete.push(
|
316269
|
+
pathsToDelete.push(import_node_path57.default.join(folder, "logs"));
|
315856
316270
|
if (cache)
|
315857
|
-
pathsToDelete.push(
|
316271
|
+
pathsToDelete.push(import_node_path57.default.join(folder, "cache"));
|
315858
316272
|
if (exports2)
|
315859
|
-
pathsToDelete.push(
|
316273
|
+
pathsToDelete.push(import_node_path57.default.join(folder, "exports"));
|
315860
316274
|
if (templates)
|
315861
|
-
pathsToDelete.push(
|
316275
|
+
pathsToDelete.push(import_node_path57.default.join(folder, "templates"));
|
315862
316276
|
if (html7)
|
315863
|
-
pathsToDelete.push(
|
316277
|
+
pathsToDelete.push(import_node_path57.default.join(folder, "html"));
|
315864
316278
|
if (execute)
|
315865
|
-
pathsToDelete.push(
|
316279
|
+
pathsToDelete.push(import_node_path57.default.join(folder, "execute"));
|
315866
316280
|
});
|
315867
316281
|
}
|
315868
316282
|
if (site) {
|
@@ -315894,7 +316308,7 @@ async function clean2(session, files, opts) {
|
|
315894
316308
|
|
315895
316309
|
// ../myst-cli/dist/build/init.js
|
315896
316310
|
var import_node_fs41 = __toESM(require("fs"), 1);
|
315897
|
-
var
|
316311
|
+
var import_node_path59 = __toESM(require("path"), 1);
|
315898
316312
|
|
315899
316313
|
// ../../node_modules/uuid/dist/esm-node/rng.js
|
315900
316314
|
var import_crypto2 = __toESM(require("crypto"));
|
@@ -315950,7 +316364,7 @@ var v4_default = v4;
|
|
315950
316364
|
|
315951
316365
|
// ../myst-cli/dist/build/gh-actions/index.js
|
315952
316366
|
var import_node_fs40 = __toESM(require("fs"), 1);
|
315953
|
-
var
|
316367
|
+
var import_node_path58 = __toESM(require("path"), 1);
|
315954
316368
|
|
315955
316369
|
// ../myst-cli/dist/build/utils/github.js
|
315956
316370
|
async function getGithubUrl() {
|
@@ -316090,7 +316504,7 @@ var workflowQuestions = [
|
|
316090
316504
|
validate(input3) {
|
316091
316505
|
if (!input3.endsWith(".yml"))
|
316092
316506
|
return "The GitHub Action name must end in `.yml`";
|
316093
|
-
const exists2 = import_node_fs40.default.existsSync(
|
316507
|
+
const exists2 = import_node_fs40.default.existsSync(import_node_path58.default.join(".github", "workflows", input3));
|
316094
316508
|
if (exists2)
|
316095
316509
|
return "The workflow file already exists, please choose another name.";
|
316096
316510
|
return true;
|
@@ -316108,7 +316522,7 @@ async function githubPagesAction(session) {
|
|
316108
316522
|
username: org,
|
316109
316523
|
defaultBranch: prompt2.branch
|
316110
316524
|
});
|
316111
|
-
const filename =
|
316525
|
+
const filename = import_node_path58.default.join(".github", "workflows", prompt2.name);
|
316112
316526
|
writeFileToFolder(filename, action);
|
316113
316527
|
const githubPagesUrl = githubUrl ? `https://${org}.github.io/${repo}` : void 0;
|
316114
316528
|
session.log.info(`
|
@@ -316142,7 +316556,7 @@ async function githubCurvenoteAction(session) {
|
|
316142
316556
|
`);
|
316143
316557
|
const prompt2 = await inquirer_default.prompt(workflowQuestions);
|
316144
316558
|
const action = createGithubCurvenoteAction({ defaultBranch: prompt2.branch });
|
316145
|
-
const filename =
|
316559
|
+
const filename = import_node_path58.default.join(".github", "workflows", prompt2.name);
|
316146
316560
|
writeFileToFolder(filename, action);
|
316147
316561
|
session.log.info(`
|
316148
316562
|
\u{1F389} GitHub Action is configured:
|
@@ -316269,7 +316683,7 @@ async function init2(session, opts) {
|
|
316269
316683
|
configData2 = `${VERSION_CONFIG}${createProjectConfig({ github })}${SITE_CONFIG}`;
|
316270
316684
|
configDoc = "project and site";
|
316271
316685
|
}
|
316272
|
-
session.log.info(`\u{1F4BE} Writing new ${configDoc} config file: ${source_default.blue(
|
316686
|
+
session.log.info(`\u{1F4BE} Writing new ${configDoc} config file: ${source_default.blue(import_node_path59.default.resolve(configFile))}`);
|
316273
316687
|
import_node_fs41.default.writeFileSync(configFile, configData2);
|
316274
316688
|
}
|
316275
316689
|
if (writeTOC) {
|
@@ -316485,7 +316899,7 @@ ${error === null || error === void 0 ? void 0 : error.stack}
|
|
316485
316899
|
}
|
316486
316900
|
|
316487
316901
|
// ../myst-cli/dist/session/session.js
|
316488
|
-
var
|
316902
|
+
var import_node_path60 = __toESM(require("path"), 1);
|
316489
316903
|
|
316490
316904
|
// ../../node_modules/package-json/index.js
|
316491
316905
|
var import_node_http5 = require("http");
|
@@ -323143,19 +323557,19 @@ var Session = class {
|
|
323143
323557
|
const sitePath = selectors_exports.selectCurrentSitePath(state);
|
323144
323558
|
const projectPath = selectors_exports.selectCurrentProjectPath(state);
|
323145
323559
|
const root6 = (_a6 = sitePath !== null && sitePath !== void 0 ? sitePath : projectPath) !== null && _a6 !== void 0 ? _a6 : ".";
|
323146
|
-
return
|
323560
|
+
return import_node_path60.default.resolve(root6);
|
323147
323561
|
}
|
323148
323562
|
buildPath() {
|
323149
|
-
return
|
323563
|
+
return import_node_path60.default.join(this.sourcePath(), "_build");
|
323150
323564
|
}
|
323151
323565
|
sitePath() {
|
323152
|
-
return
|
323566
|
+
return import_node_path60.default.join(this.buildPath(), "site");
|
323153
323567
|
}
|
323154
323568
|
contentPath() {
|
323155
|
-
return
|
323569
|
+
return import_node_path60.default.join(this.sitePath(), "content");
|
323156
323570
|
}
|
323157
323571
|
publicPath() {
|
323158
|
-
return
|
323572
|
+
return import_node_path60.default.join(this.sitePath(), "public");
|
323159
323573
|
}
|
323160
323574
|
clone() {
|
323161
323575
|
const cloneSession = new Session({ logger: this.log });
|
@@ -323808,7 +324222,7 @@ function makeStartCLI(program3) {
|
|
323808
324222
|
|
323809
324223
|
// src/templates.ts
|
323810
324224
|
var import_node_fs43 = __toESM(require("fs"), 1);
|
323811
|
-
var
|
324225
|
+
var import_node_path61 = require("path");
|
323812
324226
|
var allTemplates = [TemplateKind.tex, TemplateKind.typst, TemplateKind.docx, TemplateKind.site];
|
323813
324227
|
function getKindFromName(name3) {
|
323814
324228
|
var _a6;
|
@@ -323865,7 +324279,7 @@ async function listTemplatesCLI(session, name3, opts) {
|
|
323865
324279
|
if (kinds && (kinds == null ? void 0 : kinds.length) > 1) {
|
323866
324280
|
throw new Error("Cannot lookup a template with more than one kind.");
|
323867
324281
|
}
|
323868
|
-
const isLocal = import_node_fs43.default.existsSync(name3) ? name3.endsWith(".yml") ? name3 : (0,
|
324282
|
+
const isLocal = import_node_fs43.default.existsSync(name3) ? name3.endsWith(".yml") ? name3 : (0, import_node_path61.join)(name3, TEMPLATE_YML) : false;
|
323869
324283
|
const template = isLocal ? js_yaml_default.load(import_node_fs43.default.readFileSync(isLocal).toString()) : await fetchPublicTemplate(session, name3, kinds == null ? void 0 : kinds[0]);
|
323870
324284
|
if (!template.id)
|
323871
324285
|
template.id = name3;
|