@xyd-js/content 0.1.0-xyd.5 → 0.1.0-xyd.55
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.
- package/CHANGELOG.md +619 -0
- package/ISSUES.md +1 -0
- package/LICENSE +21 -0
- package/TODO.md +2 -0
- package/dist/index.d.ts +24 -5
- package/dist/index.js +212 -565
- package/dist/index.js.map +1 -1
- package/dist/md.d.ts +69 -0
- package/dist/md.js +23396 -0
- package/dist/md.js.map +1 -0
- package/dist/mdToc-NBBxMJ4l.d.ts +12 -0
- package/dist/vite.d.ts +129 -11
- package/dist/vite.js +19992 -169
- package/dist/vite.js.map +1 -1
- package/package.json +26 -7
- package/packages/md/index.ts +17 -8
- package/packages/md/plugins/component-directives/index.ts +3 -0
- package/packages/md/plugins/component-directives/mdComponentDirective.ts +524 -0
- package/packages/md/plugins/component-directives/types.ts +1 -0
- package/packages/md/plugins/component-directives/utils.ts +27 -0
- package/packages/md/plugins/composer/__fixtures__/1.single-example/input.md +7 -0
- package/packages/md/plugins/composer/__fixtures__/1.single-example/output.json +63 -0
- package/packages/md/plugins/composer/__fixtures__/2.single-example-with-name/input.md +7 -0
- package/packages/md/plugins/composer/__fixtures__/2.single-example-with-name/output.json +63 -0
- package/packages/md/plugins/composer/__fixtures__/3.multiple-examples/input.md +15 -0
- package/packages/md/plugins/composer/__fixtures__/3.multiple-examples/output.json +122 -0
- package/packages/md/plugins/composer/__fixtures__/4.example-groups/input.md +23 -0
- package/packages/md/plugins/composer/__fixtures__/4.example-groups/output.json +184 -0
- package/packages/md/plugins/composer/__tests__/mdComposer.test.ts +41 -0
- package/packages/md/plugins/composer/__tests__/testHelpers.ts +48 -0
- package/packages/md/plugins/composer/index.ts +1 -0
- package/packages/md/plugins/composer/mdComposer.ts +146 -0
- package/packages/md/plugins/developer-writing/index.ts +3 -0
- package/packages/md/plugins/developer-writing/mdCodeRehype.ts +78 -0
- package/packages/md/plugins/functions/__fixtures__/external.ts +4 -0
- package/packages/md/plugins/functions/__fixtures__/test.js +11 -0
- package/packages/md/plugins/functions/__fixtures__/test.py +9 -0
- package/packages/md/plugins/functions/__fixtures__/test.ts +18 -0
- package/packages/md/plugins/functions/__tests__/mdFunctionImportCode.test.ts +295 -0
- package/packages/md/plugins/functions/__tests__/parseFunctionCall.test.ts +47 -0
- package/packages/md/plugins/functions/__tests__/testHelpers.ts +71 -0
- package/packages/md/plugins/functions/index.ts +11 -0
- package/packages/md/plugins/functions/mdFunctionChangelog.ts +124 -0
- package/packages/md/plugins/functions/mdFunctionImportCode.ts +83 -0
- package/packages/md/plugins/functions/mdFunctionUniform.ts +79 -0
- package/packages/md/plugins/functions/types.ts +6 -0
- package/packages/md/plugins/functions/uniformProcessor.ts +349 -0
- package/packages/md/plugins/functions/utils.ts +423 -0
- package/packages/md/plugins/index.ts +56 -9
- package/packages/md/plugins/mdCode.ts +67 -0
- package/packages/md/plugins/mdHeadingId.ts +47 -0
- package/packages/md/plugins/mdPage.ts +35 -0
- package/packages/md/plugins/{md-themeSettings.ts → mdThemeSettings.ts} +8 -0
- package/packages/md/plugins/mdToc.ts +224 -0
- package/packages/md/plugins/meta/index.ts +1 -0
- package/packages/md/plugins/meta/mdMeta.ts +189 -0
- package/packages/md/plugins/output-variables/__fixtures__/1.simple/input.md +22 -0
- package/packages/md/plugins/output-variables/__fixtures__/1.simple/output.json +191 -0
- package/packages/md/plugins/output-variables/__fixtures__/2.multiple-vars/input.md +21 -0
- package/packages/md/plugins/output-variables/__fixtures__/2.multiple-vars/output.json +127 -0
- package/packages/md/plugins/output-variables/__tests__/index.test.ts +28 -0
- package/packages/md/plugins/output-variables/__tests__/testHelpers.ts +36 -0
- package/packages/md/plugins/output-variables/index.ts +1 -0
- package/packages/md/plugins/output-variables/lib/const.ts +4 -0
- package/packages/md/plugins/output-variables/lib/factoryAttributes.ts +350 -0
- package/packages/md/plugins/output-variables/lib/factoryLabel.ts +135 -0
- package/packages/md/plugins/output-variables/lib/factoryName.ts +59 -0
- package/packages/md/plugins/output-variables/lib/index.ts +21 -0
- package/packages/md/plugins/output-variables/lib/outputVarsContainer.ts +328 -0
- package/packages/md/plugins/output-variables/lib/util.ts +494 -0
- package/packages/md/plugins/output-variables/remarkOutputVars.ts +22 -0
- package/packages/md/plugins/rehypeHeading.ts +50 -0
- package/packages/md/plugins/types.ts +15 -0
- package/packages/md/plugins/utils/componentLike.ts +72 -0
- package/packages/md/plugins/utils/index.ts +2 -0
- package/packages/md/plugins/utils/mdParameters.test.ts +114 -0
- package/packages/md/plugins/utils/mdParameters.ts +249 -0
- package/packages/md/plugins/utils/mdastTypes.ts +42 -0
- package/packages/md/search/index.ts +251 -0
- package/packages/md/search/types.ts +36 -0
- package/packages/vite/index.ts +8 -2
- package/src/fs.ts +51 -36
- package/src/index.ts +4 -4
- package/src/navigation.ts +50 -38
- package/src/types.ts +8 -0
- package/tsconfig.json +31 -8
- package/tsup.config.ts +2 -0
- package/vitest.config.ts +17 -0
- package/packages/md/plugins/md-code.ts +0 -15
- package/packages/md/plugins/md-codegroup.ts +0 -36
- package/packages/md/plugins/md-page.ts +0 -22
- package/packages/md/plugins/md-toc.ts +0 -132
package/dist/index.js
CHANGED
|
@@ -24,9 +24,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
mod
|
|
25
25
|
));
|
|
26
26
|
|
|
27
|
-
// ../../node_modules/.pnpm/react@19.
|
|
27
|
+
// ../../node_modules/.pnpm/react@19.1.0/node_modules/react/cjs/react.production.js
|
|
28
28
|
var require_react_production = __commonJS({
|
|
29
|
-
"../../node_modules/.pnpm/react@19.
|
|
29
|
+
"../../node_modules/.pnpm/react@19.1.0/node_modules/react/cjs/react.production.js"(exports) {
|
|
30
30
|
"use strict";
|
|
31
31
|
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element");
|
|
32
32
|
var REACT_PORTAL_TYPE = Symbol.for("react.portal");
|
|
@@ -89,7 +89,7 @@ var require_react_production = __commonJS({
|
|
|
89
89
|
assign(pureComponentPrototype, Component.prototype);
|
|
90
90
|
pureComponentPrototype.isPureReactComponent = true;
|
|
91
91
|
var isArrayImpl = Array.isArray;
|
|
92
|
-
var ReactSharedInternals = { H: null, A: null, T: null, S: null };
|
|
92
|
+
var ReactSharedInternals = { H: null, A: null, T: null, S: null, V: null };
|
|
93
93
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
94
94
|
function ReactElement(type, key, self, source, owner, props) {
|
|
95
95
|
self = props.ref;
|
|
@@ -305,8 +305,11 @@ var require_react_production = __commonJS({
|
|
|
305
305
|
exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
306
306
|
exports.Suspense = REACT_SUSPENSE_TYPE;
|
|
307
307
|
exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
|
|
308
|
-
exports.
|
|
309
|
-
|
|
308
|
+
exports.__COMPILER_RUNTIME = {
|
|
309
|
+
__proto__: null,
|
|
310
|
+
c: function(size) {
|
|
311
|
+
return ReactSharedInternals.H.useMemoCache(size);
|
|
312
|
+
}
|
|
310
313
|
};
|
|
311
314
|
exports.cache = function(fn) {
|
|
312
315
|
return function() {
|
|
@@ -418,8 +421,13 @@ var require_react_production = __commonJS({
|
|
|
418
421
|
exports.useDeferredValue = function(value, initialValue) {
|
|
419
422
|
return ReactSharedInternals.H.useDeferredValue(value, initialValue);
|
|
420
423
|
};
|
|
421
|
-
exports.useEffect = function(create,
|
|
422
|
-
|
|
424
|
+
exports.useEffect = function(create, createDeps, update) {
|
|
425
|
+
var dispatcher = ReactSharedInternals.H;
|
|
426
|
+
if ("function" === typeof update)
|
|
427
|
+
throw Error(
|
|
428
|
+
"useEffect CRUD overload is not enabled in this build of React."
|
|
429
|
+
);
|
|
430
|
+
return dispatcher.useEffect(create, createDeps);
|
|
423
431
|
};
|
|
424
432
|
exports.useId = function() {
|
|
425
433
|
return ReactSharedInternals.H.useId();
|
|
@@ -458,13 +466,13 @@ var require_react_production = __commonJS({
|
|
|
458
466
|
exports.useTransition = function() {
|
|
459
467
|
return ReactSharedInternals.H.useTransition();
|
|
460
468
|
};
|
|
461
|
-
exports.version = "19.
|
|
469
|
+
exports.version = "19.1.0";
|
|
462
470
|
}
|
|
463
471
|
});
|
|
464
472
|
|
|
465
|
-
// ../../node_modules/.pnpm/react@19.
|
|
473
|
+
// ../../node_modules/.pnpm/react@19.1.0/node_modules/react/cjs/react.development.js
|
|
466
474
|
var require_react_development = __commonJS({
|
|
467
|
-
"../../node_modules/.pnpm/react@19.
|
|
475
|
+
"../../node_modules/.pnpm/react@19.1.0/node_modules/react/cjs/react.development.js"(exports, module) {
|
|
468
476
|
"use strict";
|
|
469
477
|
"production" !== process.env.NODE_ENV && function() {
|
|
470
478
|
function defineDeprecationWarning(methodName, info) {
|
|
@@ -532,13 +540,11 @@ var require_react_development = __commonJS({
|
|
|
532
540
|
function getComponentNameFromType(type) {
|
|
533
541
|
if (null == type) return null;
|
|
534
542
|
if ("function" === typeof type)
|
|
535
|
-
return type.$$typeof === REACT_CLIENT_REFERENCE
|
|
543
|
+
return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
|
|
536
544
|
if ("string" === typeof type) return type;
|
|
537
545
|
switch (type) {
|
|
538
546
|
case REACT_FRAGMENT_TYPE:
|
|
539
547
|
return "Fragment";
|
|
540
|
-
case REACT_PORTAL_TYPE:
|
|
541
|
-
return "Portal";
|
|
542
548
|
case REACT_PROFILER_TYPE:
|
|
543
549
|
return "Profiler";
|
|
544
550
|
case REACT_STRICT_MODE_TYPE:
|
|
@@ -547,11 +553,15 @@ var require_react_development = __commonJS({
|
|
|
547
553
|
return "Suspense";
|
|
548
554
|
case REACT_SUSPENSE_LIST_TYPE:
|
|
549
555
|
return "SuspenseList";
|
|
556
|
+
case REACT_ACTIVITY_TYPE:
|
|
557
|
+
return "Activity";
|
|
550
558
|
}
|
|
551
559
|
if ("object" === typeof type)
|
|
552
560
|
switch ("number" === typeof type.tag && console.error(
|
|
553
561
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
554
562
|
), type.$$typeof) {
|
|
563
|
+
case REACT_PORTAL_TYPE:
|
|
564
|
+
return "Portal";
|
|
555
565
|
case REACT_CONTEXT_TYPE:
|
|
556
566
|
return (type.displayName || "Context") + ".Provider";
|
|
557
567
|
case REACT_CONSUMER_TYPE:
|
|
@@ -573,207 +583,24 @@ var require_react_development = __commonJS({
|
|
|
573
583
|
}
|
|
574
584
|
return null;
|
|
575
585
|
}
|
|
576
|
-
function
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
}
|
|
581
|
-
function disableLogs() {
|
|
582
|
-
if (0 === disabledDepth) {
|
|
583
|
-
prevLog = console.log;
|
|
584
|
-
prevInfo = console.info;
|
|
585
|
-
prevWarn = console.warn;
|
|
586
|
-
prevError = console.error;
|
|
587
|
-
prevGroup = console.group;
|
|
588
|
-
prevGroupCollapsed = console.groupCollapsed;
|
|
589
|
-
prevGroupEnd = console.groupEnd;
|
|
590
|
-
var props = {
|
|
591
|
-
configurable: true,
|
|
592
|
-
enumerable: true,
|
|
593
|
-
value: disabledLog,
|
|
594
|
-
writable: true
|
|
595
|
-
};
|
|
596
|
-
Object.defineProperties(console, {
|
|
597
|
-
info: props,
|
|
598
|
-
log: props,
|
|
599
|
-
warn: props,
|
|
600
|
-
error: props,
|
|
601
|
-
group: props,
|
|
602
|
-
groupCollapsed: props,
|
|
603
|
-
groupEnd: props
|
|
604
|
-
});
|
|
605
|
-
}
|
|
606
|
-
disabledDepth++;
|
|
607
|
-
}
|
|
608
|
-
function reenableLogs() {
|
|
609
|
-
disabledDepth--;
|
|
610
|
-
if (0 === disabledDepth) {
|
|
611
|
-
var props = { configurable: true, enumerable: true, writable: true };
|
|
612
|
-
Object.defineProperties(console, {
|
|
613
|
-
log: assign({}, props, { value: prevLog }),
|
|
614
|
-
info: assign({}, props, { value: prevInfo }),
|
|
615
|
-
warn: assign({}, props, { value: prevWarn }),
|
|
616
|
-
error: assign({}, props, { value: prevError }),
|
|
617
|
-
group: assign({}, props, { value: prevGroup }),
|
|
618
|
-
groupCollapsed: assign({}, props, { value: prevGroupCollapsed }),
|
|
619
|
-
groupEnd: assign({}, props, { value: prevGroupEnd })
|
|
620
|
-
});
|
|
621
|
-
}
|
|
622
|
-
0 > disabledDepth && console.error(
|
|
623
|
-
"disabledDepth fell below zero. This is a bug in React. Please file an issue."
|
|
624
|
-
);
|
|
625
|
-
}
|
|
626
|
-
function describeBuiltInComponentFrame(name) {
|
|
627
|
-
if (void 0 === prefix)
|
|
628
|
-
try {
|
|
629
|
-
throw Error();
|
|
630
|
-
} catch (x) {
|
|
631
|
-
var match = x.stack.trim().match(/\n( *(at )?)/);
|
|
632
|
-
prefix = match && match[1] || "";
|
|
633
|
-
suffix = -1 < x.stack.indexOf("\n at") ? " (<anonymous>)" : -1 < x.stack.indexOf("@") ? "@unknown:0:0" : "";
|
|
634
|
-
}
|
|
635
|
-
return "\n" + prefix + name + suffix;
|
|
636
|
-
}
|
|
637
|
-
function describeNativeComponentFrame(fn, construct) {
|
|
638
|
-
if (!fn || reentry) return "";
|
|
639
|
-
var frame = componentFrameCache.get(fn);
|
|
640
|
-
if (void 0 !== frame) return frame;
|
|
641
|
-
reentry = true;
|
|
642
|
-
frame = Error.prepareStackTrace;
|
|
643
|
-
Error.prepareStackTrace = void 0;
|
|
644
|
-
var previousDispatcher = null;
|
|
645
|
-
previousDispatcher = ReactSharedInternals.H;
|
|
646
|
-
ReactSharedInternals.H = null;
|
|
647
|
-
disableLogs();
|
|
586
|
+
function getTaskName(type) {
|
|
587
|
+
if (type === REACT_FRAGMENT_TYPE) return "<>";
|
|
588
|
+
if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE)
|
|
589
|
+
return "<...>";
|
|
648
590
|
try {
|
|
649
|
-
var
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
var Fake = function() {
|
|
654
|
-
throw Error();
|
|
655
|
-
};
|
|
656
|
-
Object.defineProperty(Fake.prototype, "props", {
|
|
657
|
-
set: function() {
|
|
658
|
-
throw Error();
|
|
659
|
-
}
|
|
660
|
-
});
|
|
661
|
-
if ("object" === typeof Reflect && Reflect.construct) {
|
|
662
|
-
try {
|
|
663
|
-
Reflect.construct(Fake, []);
|
|
664
|
-
} catch (x) {
|
|
665
|
-
var control = x;
|
|
666
|
-
}
|
|
667
|
-
Reflect.construct(fn, [], Fake);
|
|
668
|
-
} else {
|
|
669
|
-
try {
|
|
670
|
-
Fake.call();
|
|
671
|
-
} catch (x$0) {
|
|
672
|
-
control = x$0;
|
|
673
|
-
}
|
|
674
|
-
fn.call(Fake.prototype);
|
|
675
|
-
}
|
|
676
|
-
} else {
|
|
677
|
-
try {
|
|
678
|
-
throw Error();
|
|
679
|
-
} catch (x$1) {
|
|
680
|
-
control = x$1;
|
|
681
|
-
}
|
|
682
|
-
(Fake = fn()) && "function" === typeof Fake.catch && Fake.catch(function() {
|
|
683
|
-
});
|
|
684
|
-
}
|
|
685
|
-
} catch (sample) {
|
|
686
|
-
if (sample && control && "string" === typeof sample.stack)
|
|
687
|
-
return [sample.stack, control.stack];
|
|
688
|
-
}
|
|
689
|
-
return [null, null];
|
|
690
|
-
}
|
|
691
|
-
};
|
|
692
|
-
RunInRootFrame.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot";
|
|
693
|
-
var namePropDescriptor = Object.getOwnPropertyDescriptor(
|
|
694
|
-
RunInRootFrame.DetermineComponentFrameRoot,
|
|
695
|
-
"name"
|
|
696
|
-
);
|
|
697
|
-
namePropDescriptor && namePropDescriptor.configurable && Object.defineProperty(
|
|
698
|
-
RunInRootFrame.DetermineComponentFrameRoot,
|
|
699
|
-
"name",
|
|
700
|
-
{ value: "DetermineComponentFrameRoot" }
|
|
701
|
-
);
|
|
702
|
-
var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(), sampleStack = _RunInRootFrame$Deter[0], controlStack = _RunInRootFrame$Deter[1];
|
|
703
|
-
if (sampleStack && controlStack) {
|
|
704
|
-
var sampleLines = sampleStack.split("\n"), controlLines = controlStack.split("\n");
|
|
705
|
-
for (_RunInRootFrame$Deter = namePropDescriptor = 0; namePropDescriptor < sampleLines.length && !sampleLines[namePropDescriptor].includes(
|
|
706
|
-
"DetermineComponentFrameRoot"
|
|
707
|
-
); )
|
|
708
|
-
namePropDescriptor++;
|
|
709
|
-
for (; _RunInRootFrame$Deter < controlLines.length && !controlLines[_RunInRootFrame$Deter].includes(
|
|
710
|
-
"DetermineComponentFrameRoot"
|
|
711
|
-
); )
|
|
712
|
-
_RunInRootFrame$Deter++;
|
|
713
|
-
if (namePropDescriptor === sampleLines.length || _RunInRootFrame$Deter === controlLines.length)
|
|
714
|
-
for (namePropDescriptor = sampleLines.length - 1, _RunInRootFrame$Deter = controlLines.length - 1; 1 <= namePropDescriptor && 0 <= _RunInRootFrame$Deter && sampleLines[namePropDescriptor] !== controlLines[_RunInRootFrame$Deter]; )
|
|
715
|
-
_RunInRootFrame$Deter--;
|
|
716
|
-
for (; 1 <= namePropDescriptor && 0 <= _RunInRootFrame$Deter; namePropDescriptor--, _RunInRootFrame$Deter--)
|
|
717
|
-
if (sampleLines[namePropDescriptor] !== controlLines[_RunInRootFrame$Deter]) {
|
|
718
|
-
if (1 !== namePropDescriptor || 1 !== _RunInRootFrame$Deter) {
|
|
719
|
-
do
|
|
720
|
-
if (namePropDescriptor--, _RunInRootFrame$Deter--, 0 > _RunInRootFrame$Deter || sampleLines[namePropDescriptor] !== controlLines[_RunInRootFrame$Deter]) {
|
|
721
|
-
var _frame = "\n" + sampleLines[namePropDescriptor].replace(
|
|
722
|
-
" at new ",
|
|
723
|
-
" at "
|
|
724
|
-
);
|
|
725
|
-
fn.displayName && _frame.includes("<anonymous>") && (_frame = _frame.replace("<anonymous>", fn.displayName));
|
|
726
|
-
"function" === typeof fn && componentFrameCache.set(fn, _frame);
|
|
727
|
-
return _frame;
|
|
728
|
-
}
|
|
729
|
-
while (1 <= namePropDescriptor && 0 <= _RunInRootFrame$Deter);
|
|
730
|
-
}
|
|
731
|
-
break;
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
} finally {
|
|
735
|
-
reentry = false, ReactSharedInternals.H = previousDispatcher, reenableLogs(), Error.prepareStackTrace = frame;
|
|
591
|
+
var name = getComponentNameFromType(type);
|
|
592
|
+
return name ? "<" + name + ">" : "<...>";
|
|
593
|
+
} catch (x) {
|
|
594
|
+
return "<...>";
|
|
736
595
|
}
|
|
737
|
-
sampleLines = (sampleLines = fn ? fn.displayName || fn.name : "") ? describeBuiltInComponentFrame(sampleLines) : "";
|
|
738
|
-
"function" === typeof fn && componentFrameCache.set(fn, sampleLines);
|
|
739
|
-
return sampleLines;
|
|
740
|
-
}
|
|
741
|
-
function describeUnknownElementTypeFrameInDEV(type) {
|
|
742
|
-
if (null == type) return "";
|
|
743
|
-
if ("function" === typeof type) {
|
|
744
|
-
var prototype = type.prototype;
|
|
745
|
-
return describeNativeComponentFrame(
|
|
746
|
-
type,
|
|
747
|
-
!(!prototype || !prototype.isReactComponent)
|
|
748
|
-
);
|
|
749
|
-
}
|
|
750
|
-
if ("string" === typeof type) return describeBuiltInComponentFrame(type);
|
|
751
|
-
switch (type) {
|
|
752
|
-
case REACT_SUSPENSE_TYPE:
|
|
753
|
-
return describeBuiltInComponentFrame("Suspense");
|
|
754
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
755
|
-
return describeBuiltInComponentFrame("SuspenseList");
|
|
756
|
-
}
|
|
757
|
-
if ("object" === typeof type)
|
|
758
|
-
switch (type.$$typeof) {
|
|
759
|
-
case REACT_FORWARD_REF_TYPE:
|
|
760
|
-
return type = describeNativeComponentFrame(type.render, false), type;
|
|
761
|
-
case REACT_MEMO_TYPE:
|
|
762
|
-
return describeUnknownElementTypeFrameInDEV(type.type);
|
|
763
|
-
case REACT_LAZY_TYPE:
|
|
764
|
-
prototype = type._payload;
|
|
765
|
-
type = type._init;
|
|
766
|
-
try {
|
|
767
|
-
return describeUnknownElementTypeFrameInDEV(type(prototype));
|
|
768
|
-
} catch (x) {
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
return "";
|
|
772
596
|
}
|
|
773
597
|
function getOwner() {
|
|
774
598
|
var dispatcher = ReactSharedInternals.A;
|
|
775
599
|
return null === dispatcher ? null : dispatcher.getOwner();
|
|
776
600
|
}
|
|
601
|
+
function UnknownOwner() {
|
|
602
|
+
return Error("react-stack-top-frame");
|
|
603
|
+
}
|
|
777
604
|
function hasValidKey(config) {
|
|
778
605
|
if (hasOwnProperty.call(config, "key")) {
|
|
779
606
|
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
@@ -802,7 +629,7 @@ var require_react_development = __commonJS({
|
|
|
802
629
|
componentName = this.props.ref;
|
|
803
630
|
return void 0 !== componentName ? componentName : null;
|
|
804
631
|
}
|
|
805
|
-
function ReactElement(type, key, self, source, owner, props) {
|
|
632
|
+
function ReactElement(type, key, self, source, owner, props, debugStack, debugTask) {
|
|
806
633
|
self = props.ref;
|
|
807
634
|
type = {
|
|
808
635
|
$$typeof: REACT_ELEMENT_TYPE,
|
|
@@ -828,6 +655,18 @@ var require_react_development = __commonJS({
|
|
|
828
655
|
writable: true,
|
|
829
656
|
value: null
|
|
830
657
|
});
|
|
658
|
+
Object.defineProperty(type, "_debugStack", {
|
|
659
|
+
configurable: false,
|
|
660
|
+
enumerable: false,
|
|
661
|
+
writable: true,
|
|
662
|
+
value: debugStack
|
|
663
|
+
});
|
|
664
|
+
Object.defineProperty(type, "_debugTask", {
|
|
665
|
+
configurable: false,
|
|
666
|
+
enumerable: false,
|
|
667
|
+
writable: true,
|
|
668
|
+
value: debugTask
|
|
669
|
+
});
|
|
831
670
|
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
832
671
|
return type;
|
|
833
672
|
}
|
|
@@ -838,53 +677,16 @@ var require_react_development = __commonJS({
|
|
|
838
677
|
void 0,
|
|
839
678
|
void 0,
|
|
840
679
|
oldElement._owner,
|
|
841
|
-
oldElement.props
|
|
680
|
+
oldElement.props,
|
|
681
|
+
oldElement._debugStack,
|
|
682
|
+
oldElement._debugTask
|
|
842
683
|
);
|
|
843
|
-
newKey._store.validated = oldElement._store.validated;
|
|
684
|
+
oldElement._store && (newKey._store.validated = oldElement._store.validated);
|
|
844
685
|
return newKey;
|
|
845
686
|
}
|
|
846
|
-
function validateChildKeys(node, parentType) {
|
|
847
|
-
if ("object" === typeof node && node && node.$$typeof !== REACT_CLIENT_REFERENCE) {
|
|
848
|
-
if (isArrayImpl(node))
|
|
849
|
-
for (var i = 0; i < node.length; i++) {
|
|
850
|
-
var child = node[i];
|
|
851
|
-
isValidElement(child) && validateExplicitKey(child, parentType);
|
|
852
|
-
}
|
|
853
|
-
else if (isValidElement(node))
|
|
854
|
-
node._store && (node._store.validated = 1);
|
|
855
|
-
else if (i = getIteratorFn(node), "function" === typeof i && i !== node.entries && (i = i.call(node), i !== node))
|
|
856
|
-
for (; !(node = i.next()).done; )
|
|
857
|
-
isValidElement(node.value) && validateExplicitKey(node.value, parentType);
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
687
|
function isValidElement(object) {
|
|
861
688
|
return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
862
689
|
}
|
|
863
|
-
function validateExplicitKey(element, parentType) {
|
|
864
|
-
if (element._store && !element._store.validated && null == element.key && (element._store.validated = 1, parentType = getCurrentComponentErrorInfo(parentType), !ownerHasKeyUseWarning[parentType])) {
|
|
865
|
-
ownerHasKeyUseWarning[parentType] = true;
|
|
866
|
-
var childOwner = "";
|
|
867
|
-
element && null != element._owner && element._owner !== getOwner() && (childOwner = null, "number" === typeof element._owner.tag ? childOwner = getComponentNameFromType(element._owner.type) : "string" === typeof element._owner.name && (childOwner = element._owner.name), childOwner = " It was passed a child from " + childOwner + ".");
|
|
868
|
-
var prevGetCurrentStack = ReactSharedInternals.getCurrentStack;
|
|
869
|
-
ReactSharedInternals.getCurrentStack = function() {
|
|
870
|
-
var stack = describeUnknownElementTypeFrameInDEV(element.type);
|
|
871
|
-
prevGetCurrentStack && (stack += prevGetCurrentStack() || "");
|
|
872
|
-
return stack;
|
|
873
|
-
};
|
|
874
|
-
console.error(
|
|
875
|
-
'Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',
|
|
876
|
-
parentType,
|
|
877
|
-
childOwner
|
|
878
|
-
);
|
|
879
|
-
ReactSharedInternals.getCurrentStack = prevGetCurrentStack;
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
function getCurrentComponentErrorInfo(parentType) {
|
|
883
|
-
var info = "", owner = getOwner();
|
|
884
|
-
owner && (owner = getComponentNameFromType(owner.type)) && (info = "\n\nCheck the render method of `" + owner + "`.");
|
|
885
|
-
info || (parentType = getComponentNameFromType(parentType)) && (info = "\n\nCheck the top-level render call using <" + parentType + ">.");
|
|
886
|
-
return info;
|
|
887
|
-
}
|
|
888
690
|
function escape(key) {
|
|
889
691
|
var escaperLookup = { "=": "=0", ":": "=2" };
|
|
890
692
|
return "$" + key.replace(/[=:]/g, function(match) {
|
|
@@ -1119,7 +921,7 @@ var require_react_development = __commonJS({
|
|
|
1119
921
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
1120
922
|
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
|
1121
923
|
Symbol.for("react.provider");
|
|
1122
|
-
var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"),
|
|
924
|
+
var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), MAYBE_ITERATOR_SYMBOL = Symbol.iterator, didWarnStateUpdateForUnmountedComponent = {}, ReactNoopUpdateQueue = {
|
|
1123
925
|
isMounted: function() {
|
|
1124
926
|
return false;
|
|
1125
927
|
},
|
|
@@ -1162,24 +964,32 @@ var require_react_development = __commonJS({
|
|
|
1162
964
|
deprecatedAPIs.constructor = PureComponent;
|
|
1163
965
|
assign(deprecatedAPIs, Component.prototype);
|
|
1164
966
|
deprecatedAPIs.isPureReactComponent = true;
|
|
1165
|
-
var isArrayImpl = Array.isArray, REACT_CLIENT_REFERENCE
|
|
967
|
+
var isArrayImpl = Array.isArray, REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = {
|
|
1166
968
|
H: null,
|
|
1167
969
|
A: null,
|
|
1168
970
|
T: null,
|
|
1169
971
|
S: null,
|
|
972
|
+
V: null,
|
|
1170
973
|
actQueue: null,
|
|
1171
974
|
isBatchingLegacy: false,
|
|
1172
975
|
didScheduleLegacyUpdate: false,
|
|
1173
976
|
didUsePromise: false,
|
|
1174
977
|
thrownErrors: [],
|
|
1175
|
-
getCurrentStack: null
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
978
|
+
getCurrentStack: null,
|
|
979
|
+
recentlyCreatedOwnerStacks: 0
|
|
980
|
+
}, hasOwnProperty = Object.prototype.hasOwnProperty, createTask = console.createTask ? console.createTask : function() {
|
|
981
|
+
return null;
|
|
982
|
+
};
|
|
983
|
+
deprecatedAPIs = {
|
|
984
|
+
"react-stack-bottom-frame": function(callStackForError) {
|
|
985
|
+
return callStackForError();
|
|
986
|
+
}
|
|
987
|
+
};
|
|
988
|
+
var specialPropKeyWarningShown, didWarnAboutOldJSXRuntime;
|
|
1181
989
|
var didWarnAboutElementRef = {};
|
|
1182
|
-
var
|
|
990
|
+
var unknownOwnerDebugStack = deprecatedAPIs["react-stack-bottom-frame"].bind(deprecatedAPIs, UnknownOwner)();
|
|
991
|
+
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
992
|
+
var didWarnAboutMaps = false, userProvidedKeyEscapeRegex = /\/+/g, reportGlobalError = "function" === typeof reportError ? reportError : function(error) {
|
|
1183
993
|
if ("object" === typeof window && "function" === typeof window.ErrorEvent) {
|
|
1184
994
|
var event = new window.ErrorEvent("error", {
|
|
1185
995
|
bubbles: true,
|
|
@@ -1198,6 +1008,12 @@ var require_react_development = __commonJS({
|
|
|
1198
1008
|
return queueMicrotask(callback);
|
|
1199
1009
|
});
|
|
1200
1010
|
} : enqueueTask;
|
|
1011
|
+
deprecatedAPIs = Object.freeze({
|
|
1012
|
+
__proto__: null,
|
|
1013
|
+
c: function(size) {
|
|
1014
|
+
return resolveDispatcher().useMemoCache(size);
|
|
1015
|
+
}
|
|
1016
|
+
});
|
|
1201
1017
|
exports.Children = {
|
|
1202
1018
|
map: mapChildren,
|
|
1203
1019
|
forEach: function(children, forEachFunc, forEachContext) {
|
|
@@ -1236,6 +1052,7 @@ var require_react_development = __commonJS({
|
|
|
1236
1052
|
exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
1237
1053
|
exports.Suspense = REACT_SUSPENSE_TYPE;
|
|
1238
1054
|
exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = ReactSharedInternals;
|
|
1055
|
+
exports.__COMPILER_RUNTIME = deprecatedAPIs;
|
|
1239
1056
|
exports.act = function(callback) {
|
|
1240
1057
|
var prevActQueue = ReactSharedInternals.actQueue, prevActScopeDepth = actScopeDepth;
|
|
1241
1058
|
actScopeDepth++;
|
|
@@ -1269,8 +1086,8 @@ var require_react_development = __commonJS({
|
|
|
1269
1086
|
reject
|
|
1270
1087
|
);
|
|
1271
1088
|
});
|
|
1272
|
-
} catch (error$
|
|
1273
|
-
ReactSharedInternals.thrownErrors.push(error$
|
|
1089
|
+
} catch (error$0) {
|
|
1090
|
+
ReactSharedInternals.thrownErrors.push(error$0);
|
|
1274
1091
|
}
|
|
1275
1092
|
if (0 < ReactSharedInternals.thrownErrors.length) {
|
|
1276
1093
|
var _thrownError = aggregateErrors(
|
|
@@ -1318,6 +1135,10 @@ var require_react_development = __commonJS({
|
|
|
1318
1135
|
return fn.apply(null, arguments);
|
|
1319
1136
|
};
|
|
1320
1137
|
};
|
|
1138
|
+
exports.captureOwnerStack = function() {
|
|
1139
|
+
var getCurrentStack = ReactSharedInternals.getCurrentStack;
|
|
1140
|
+
return null === getCurrentStack ? null : getCurrentStack();
|
|
1141
|
+
};
|
|
1321
1142
|
exports.cloneElement = function(element, config, children) {
|
|
1322
1143
|
if (null === element || void 0 === element)
|
|
1323
1144
|
throw Error(
|
|
@@ -1349,9 +1170,18 @@ var require_react_development = __commonJS({
|
|
|
1349
1170
|
JSCompiler_inline_result[i] = arguments[i + 2];
|
|
1350
1171
|
props.children = JSCompiler_inline_result;
|
|
1351
1172
|
}
|
|
1352
|
-
props = ReactElement(
|
|
1173
|
+
props = ReactElement(
|
|
1174
|
+
element.type,
|
|
1175
|
+
key,
|
|
1176
|
+
void 0,
|
|
1177
|
+
void 0,
|
|
1178
|
+
owner,
|
|
1179
|
+
props,
|
|
1180
|
+
element._debugStack,
|
|
1181
|
+
element._debugTask
|
|
1182
|
+
);
|
|
1353
1183
|
for (key = 2; key < arguments.length; key++)
|
|
1354
|
-
|
|
1184
|
+
owner = arguments[key], isValidElement(owner) && owner._store && (owner._store.validated = 1);
|
|
1355
1185
|
return props;
|
|
1356
1186
|
};
|
|
1357
1187
|
exports.createContext = function(defaultValue) {
|
|
@@ -1373,29 +1203,16 @@ var require_react_development = __commonJS({
|
|
|
1373
1203
|
return defaultValue;
|
|
1374
1204
|
};
|
|
1375
1205
|
exports.createElement = function(type, config, children) {
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
else {
|
|
1380
|
-
i = "";
|
|
1381
|
-
if (void 0 === type || "object" === typeof type && null !== type && 0 === Object.keys(type).length)
|
|
1382
|
-
i += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.";
|
|
1383
|
-
if (null === type) var typeString = "null";
|
|
1384
|
-
else
|
|
1385
|
-
isArrayImpl(type) ? typeString = "array" : void 0 !== type && type.$$typeof === REACT_ELEMENT_TYPE ? (typeString = "<" + (getComponentNameFromType(type.type) || "Unknown") + " />", i = " Did you accidentally export a JSX literal instead of a component?") : typeString = typeof type;
|
|
1386
|
-
console.error(
|
|
1387
|
-
"React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",
|
|
1388
|
-
typeString,
|
|
1389
|
-
i
|
|
1390
|
-
);
|
|
1206
|
+
for (var i = 2; i < arguments.length; i++) {
|
|
1207
|
+
var node = arguments[i];
|
|
1208
|
+
isValidElement(node) && node._store && (node._store.validated = 1);
|
|
1391
1209
|
}
|
|
1392
|
-
var propName;
|
|
1393
1210
|
i = {};
|
|
1394
|
-
|
|
1211
|
+
node = null;
|
|
1395
1212
|
if (null != config)
|
|
1396
1213
|
for (propName in didWarnAboutOldJSXRuntime || !("__self" in config) || "key" in config || (didWarnAboutOldJSXRuntime = true, console.warn(
|
|
1397
1214
|
"Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform"
|
|
1398
|
-
)), hasValidKey(config) && (checkKeyStringCoercion(config.key),
|
|
1215
|
+
)), hasValidKey(config) && (checkKeyStringCoercion(config.key), node = "" + config.key), config)
|
|
1399
1216
|
hasOwnProperty.call(config, propName) && "key" !== propName && "__self" !== propName && "__source" !== propName && (i[propName] = config[propName]);
|
|
1400
1217
|
var childrenLength = arguments.length - 2;
|
|
1401
1218
|
if (1 === childrenLength) i.children = children;
|
|
@@ -1408,11 +1225,21 @@ var require_react_development = __commonJS({
|
|
|
1408
1225
|
if (type && type.defaultProps)
|
|
1409
1226
|
for (propName in childrenLength = type.defaultProps, childrenLength)
|
|
1410
1227
|
void 0 === i[propName] && (i[propName] = childrenLength[propName]);
|
|
1411
|
-
|
|
1228
|
+
node && defineKeyPropWarningGetter(
|
|
1412
1229
|
i,
|
|
1413
1230
|
"function" === typeof type ? type.displayName || type.name || "Unknown" : type
|
|
1414
1231
|
);
|
|
1415
|
-
|
|
1232
|
+
var propName = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
1233
|
+
return ReactElement(
|
|
1234
|
+
type,
|
|
1235
|
+
node,
|
|
1236
|
+
void 0,
|
|
1237
|
+
void 0,
|
|
1238
|
+
getOwner(),
|
|
1239
|
+
i,
|
|
1240
|
+
propName ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
|
|
1241
|
+
propName ? createTask(getTaskName(type)) : unknownOwnerDebugTask
|
|
1242
|
+
);
|
|
1416
1243
|
};
|
|
1417
1244
|
exports.createRef = function() {
|
|
1418
1245
|
var refObject = { current: null };
|
|
@@ -1455,7 +1282,7 @@ var require_react_development = __commonJS({
|
|
|
1455
1282
|
};
|
|
1456
1283
|
};
|
|
1457
1284
|
exports.memo = function(type, compare) {
|
|
1458
|
-
|
|
1285
|
+
null == type && console.error(
|
|
1459
1286
|
"memo: The first argument must be a component. Instead received: %s",
|
|
1460
1287
|
null === type ? "null" : typeof type
|
|
1461
1288
|
);
|
|
@@ -1523,8 +1350,16 @@ var require_react_development = __commonJS({
|
|
|
1523
1350
|
exports.useDeferredValue = function(value, initialValue) {
|
|
1524
1351
|
return resolveDispatcher().useDeferredValue(value, initialValue);
|
|
1525
1352
|
};
|
|
1526
|
-
exports.useEffect = function(create,
|
|
1527
|
-
|
|
1353
|
+
exports.useEffect = function(create, createDeps, update) {
|
|
1354
|
+
null == create && console.warn(
|
|
1355
|
+
"React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"
|
|
1356
|
+
);
|
|
1357
|
+
var dispatcher = resolveDispatcher();
|
|
1358
|
+
if ("function" === typeof update)
|
|
1359
|
+
throw Error(
|
|
1360
|
+
"useEffect CRUD overload is not enabled in this build of React."
|
|
1361
|
+
);
|
|
1362
|
+
return dispatcher.useEffect(create, createDeps);
|
|
1528
1363
|
};
|
|
1529
1364
|
exports.useId = function() {
|
|
1530
1365
|
return resolveDispatcher().useId();
|
|
@@ -1533,9 +1368,15 @@ var require_react_development = __commonJS({
|
|
|
1533
1368
|
return resolveDispatcher().useImperativeHandle(ref, create, deps);
|
|
1534
1369
|
};
|
|
1535
1370
|
exports.useInsertionEffect = function(create, deps) {
|
|
1371
|
+
null == create && console.warn(
|
|
1372
|
+
"React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"
|
|
1373
|
+
);
|
|
1536
1374
|
return resolveDispatcher().useInsertionEffect(create, deps);
|
|
1537
1375
|
};
|
|
1538
1376
|
exports.useLayoutEffect = function(create, deps) {
|
|
1377
|
+
null == create && console.warn(
|
|
1378
|
+
"React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"
|
|
1379
|
+
);
|
|
1539
1380
|
return resolveDispatcher().useLayoutEffect(create, deps);
|
|
1540
1381
|
};
|
|
1541
1382
|
exports.useMemo = function(create, deps) {
|
|
@@ -1563,15 +1404,15 @@ var require_react_development = __commonJS({
|
|
|
1563
1404
|
exports.useTransition = function() {
|
|
1564
1405
|
return resolveDispatcher().useTransition();
|
|
1565
1406
|
};
|
|
1566
|
-
exports.version = "19.
|
|
1407
|
+
exports.version = "19.1.0";
|
|
1567
1408
|
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
1568
1409
|
}();
|
|
1569
1410
|
}
|
|
1570
1411
|
});
|
|
1571
1412
|
|
|
1572
|
-
// ../../node_modules/.pnpm/react@19.
|
|
1413
|
+
// ../../node_modules/.pnpm/react@19.1.0/node_modules/react/index.js
|
|
1573
1414
|
var require_react = __commonJS({
|
|
1574
|
-
"../../node_modules/.pnpm/react@19.
|
|
1415
|
+
"../../node_modules/.pnpm/react@19.1.0/node_modules/react/index.js"(exports, module) {
|
|
1575
1416
|
"use strict";
|
|
1576
1417
|
if (process.env.NODE_ENV === "production") {
|
|
1577
1418
|
module.exports = require_react_production();
|
|
@@ -1582,266 +1423,32 @@ var require_react = __commonJS({
|
|
|
1582
1423
|
});
|
|
1583
1424
|
|
|
1584
1425
|
// src/fs.ts
|
|
1426
|
+
import fs2 from "fs/promises";
|
|
1427
|
+
import { VFile as VFile2 } from "vfile";
|
|
1428
|
+
import { compile as mdxCompile2 } from "@mdx-js/mdx";
|
|
1429
|
+
|
|
1430
|
+
// src/navigation.ts
|
|
1431
|
+
var import_react = __toESM(require_react(), 1);
|
|
1585
1432
|
import { promises as fs } from "fs";
|
|
1586
1433
|
import path from "path";
|
|
1587
|
-
import { VFile } from "vfile";
|
|
1588
|
-
import { compile as mdxCompile } from "@mdx-js/mdx";
|
|
1589
|
-
|
|
1590
|
-
// packages/md/plugins/index.ts
|
|
1591
1434
|
import remarkFrontmatter from "remark-frontmatter";
|
|
1592
1435
|
import remarkMdxFrontmatter from "remark-mdx-frontmatter";
|
|
1593
|
-
import
|
|
1594
|
-
import
|
|
1595
|
-
|
|
1596
|
-
// packages/md/plugins/md-toc.ts
|
|
1597
|
-
var remarkMdxToc = (options) => () => async (ast) => {
|
|
1598
|
-
const { visit: visit5 } = await import("unist-util-visit");
|
|
1599
|
-
const { toString } = await import("mdast-util-to-string");
|
|
1600
|
-
const { valueToEstree } = await import("estree-util-value-to-estree");
|
|
1601
|
-
const { name: isIdentifierName } = await import("estree-util-is-identifier-name");
|
|
1602
|
-
const mdast = ast;
|
|
1603
|
-
const name = options.name ?? "toc";
|
|
1604
|
-
if (!isIdentifierName(name)) {
|
|
1605
|
-
throw new Error(`Invalid name for an identifier: ${name}`);
|
|
1606
|
-
}
|
|
1607
|
-
const toc = [];
|
|
1608
|
-
const flatToc = [];
|
|
1609
|
-
const createEntry = (node, depth) => {
|
|
1610
|
-
let attributes = node.data || {};
|
|
1611
|
-
if (node.type === "mdxJsxFlowElement") {
|
|
1612
|
-
attributes = Object.fromEntries(
|
|
1613
|
-
node.attributes.filter((attribute) => attribute.type === "mdxJsxAttribute" && typeof attribute.value === "string").map((attribute) => [attribute.name, attribute.value])
|
|
1614
|
-
);
|
|
1615
|
-
}
|
|
1616
|
-
return {
|
|
1617
|
-
depth,
|
|
1618
|
-
value: toString(node, { includeImageAlt: false }),
|
|
1619
|
-
attributes,
|
|
1620
|
-
children: []
|
|
1621
|
-
};
|
|
1622
|
-
};
|
|
1623
|
-
visit5(mdast, ["heading", "mdxJsxFlowElement"], (node) => {
|
|
1624
|
-
let depth = 0;
|
|
1625
|
-
if (node.type === "mdxJsxFlowElement") {
|
|
1626
|
-
let valid = false;
|
|
1627
|
-
if (/^h[1-6]$/.test(node.name || "")) {
|
|
1628
|
-
valid = true;
|
|
1629
|
-
depth = parseInt(node.name.substring(1));
|
|
1630
|
-
} else if (options.customTags) {
|
|
1631
|
-
for (const tag of options.customTags) {
|
|
1632
|
-
if (tag.name.test(node.name || "")) {
|
|
1633
|
-
valid = true;
|
|
1634
|
-
depth = tag.depth(node.name || "");
|
|
1635
|
-
break;
|
|
1636
|
-
}
|
|
1637
|
-
}
|
|
1638
|
-
}
|
|
1639
|
-
if (!valid) {
|
|
1640
|
-
return;
|
|
1641
|
-
}
|
|
1642
|
-
} else if (node.type === "heading") {
|
|
1643
|
-
depth = node.depth;
|
|
1644
|
-
} else {
|
|
1645
|
-
return;
|
|
1646
|
-
}
|
|
1647
|
-
if (depth && ((options == null ? void 0 : options.minDepth) && options.minDepth > depth)) {
|
|
1648
|
-
return;
|
|
1649
|
-
}
|
|
1650
|
-
const entry = createEntry(node, depth);
|
|
1651
|
-
flatToc.push(entry);
|
|
1652
|
-
let parent = toc;
|
|
1653
|
-
for (let i = flatToc.length - 1; i >= 0; --i) {
|
|
1654
|
-
const current = flatToc[i];
|
|
1655
|
-
if (current.depth < entry.depth) {
|
|
1656
|
-
parent = current.children;
|
|
1657
|
-
break;
|
|
1658
|
-
}
|
|
1659
|
-
}
|
|
1660
|
-
parent.push(entry);
|
|
1661
|
-
});
|
|
1662
|
-
const tocExport = {
|
|
1663
|
-
type: "mdxjsEsm",
|
|
1664
|
-
value: "",
|
|
1665
|
-
data: {
|
|
1666
|
-
estree: {
|
|
1667
|
-
type: "Program",
|
|
1668
|
-
sourceType: "module",
|
|
1669
|
-
body: [
|
|
1670
|
-
{
|
|
1671
|
-
type: "ExportNamedDeclaration",
|
|
1672
|
-
specifiers: [],
|
|
1673
|
-
source: null,
|
|
1674
|
-
declaration: {
|
|
1675
|
-
type: "VariableDeclaration",
|
|
1676
|
-
kind: "const",
|
|
1677
|
-
declarations: [
|
|
1678
|
-
{
|
|
1679
|
-
type: "VariableDeclarator",
|
|
1680
|
-
id: {
|
|
1681
|
-
type: "Identifier",
|
|
1682
|
-
name
|
|
1683
|
-
},
|
|
1684
|
-
init: valueToEstree(toc)
|
|
1685
|
-
}
|
|
1686
|
-
]
|
|
1687
|
-
}
|
|
1688
|
-
}
|
|
1689
|
-
]
|
|
1690
|
-
}
|
|
1691
|
-
}
|
|
1692
|
-
};
|
|
1693
|
-
mdast.children.unshift(tocExport);
|
|
1694
|
-
};
|
|
1695
|
-
|
|
1696
|
-
// packages/md/plugins/md-code.ts
|
|
1697
|
-
import { visit } from "unist-util-visit";
|
|
1698
|
-
function remarkInjectCodeMeta() {
|
|
1699
|
-
return (tree) => {
|
|
1700
|
-
visit(tree, "code", (node) => {
|
|
1701
|
-
if (node.meta) {
|
|
1702
|
-
node.data = node.data || {};
|
|
1703
|
-
node.data.hProperties = {
|
|
1704
|
-
...node.data.hProperties || {},
|
|
1705
|
-
meta: node.meta
|
|
1706
|
-
};
|
|
1707
|
-
}
|
|
1708
|
-
});
|
|
1709
|
-
};
|
|
1710
|
-
}
|
|
1711
|
-
|
|
1712
|
-
// packages/md/plugins/md-themeSettings.ts
|
|
1713
|
-
import { visit as visit2 } from "unist-util-visit";
|
|
1714
|
-
var extractThemeSettings = () => {
|
|
1715
|
-
return (tree) => {
|
|
1716
|
-
visit2(tree, "exportNamedDeclaration", (node) => {
|
|
1717
|
-
const declaration = node.declaration;
|
|
1718
|
-
if (declaration && declaration.declarations) {
|
|
1719
|
-
declaration.declarations.forEach((decl) => {
|
|
1720
|
-
if (decl.id.name === "themeSettings") {
|
|
1721
|
-
global.themeSettings = decl.init;
|
|
1722
|
-
}
|
|
1723
|
-
});
|
|
1724
|
-
}
|
|
1725
|
-
});
|
|
1726
|
-
};
|
|
1727
|
-
};
|
|
1728
|
-
|
|
1729
|
-
// packages/md/plugins/md-page.ts
|
|
1730
|
-
import { visit as visit3 } from "unist-util-visit";
|
|
1731
|
-
var extractPage = () => {
|
|
1732
|
-
return (tree) => {
|
|
1733
|
-
visit3(tree, "exportNamedDeclaration", (node) => {
|
|
1734
|
-
const declaration = node.declaration;
|
|
1735
|
-
if (declaration && declaration.declarations) {
|
|
1736
|
-
declaration.declarations.forEach((decl) => {
|
|
1737
|
-
if (decl.id.name === "page") {
|
|
1738
|
-
global.page = decl.init;
|
|
1739
|
-
}
|
|
1740
|
-
});
|
|
1741
|
-
}
|
|
1742
|
-
});
|
|
1743
|
-
};
|
|
1744
|
-
};
|
|
1745
|
-
|
|
1746
|
-
// packages/md/plugins/md-codegroup.ts
|
|
1747
|
-
import { visit as visit4 } from "unist-util-visit";
|
|
1748
|
-
function mdCodeGroup() {
|
|
1749
|
-
return (tree) => {
|
|
1750
|
-
visit4(tree, "containerDirective", (node) => {
|
|
1751
|
-
var _a;
|
|
1752
|
-
if (node.name !== "code-group") return;
|
|
1753
|
-
const description = ((_a = node.attributes) == null ? void 0 : _a.title) || "";
|
|
1754
|
-
const codeblocks = [];
|
|
1755
|
-
for (const child of node.children) {
|
|
1756
|
-
if (child.type === "code") {
|
|
1757
|
-
const meta = child.meta || "";
|
|
1758
|
-
const value = child.value || "";
|
|
1759
|
-
const lang = child.lang || "";
|
|
1760
|
-
codeblocks.push({ value, lang, meta });
|
|
1761
|
-
}
|
|
1762
|
-
}
|
|
1763
|
-
node.data = {
|
|
1764
|
-
hName: "DirectiveCodeSample",
|
|
1765
|
-
hProperties: {
|
|
1766
|
-
description,
|
|
1767
|
-
codeblocks: JSON.stringify(codeblocks)
|
|
1768
|
-
}
|
|
1769
|
-
};
|
|
1770
|
-
node.children = [];
|
|
1771
|
-
});
|
|
1772
|
-
};
|
|
1773
|
-
}
|
|
1774
|
-
|
|
1775
|
-
// packages/md/plugins/index.ts
|
|
1776
|
-
function defaultPlugins(toc) {
|
|
1777
|
-
return [
|
|
1778
|
-
remarkFrontmatter,
|
|
1779
|
-
remarkMdxFrontmatter,
|
|
1780
|
-
remarkGfm,
|
|
1781
|
-
remarkDirective,
|
|
1782
|
-
remarkMdxToc(toc),
|
|
1783
|
-
remarkInjectCodeMeta,
|
|
1784
|
-
extractThemeSettings,
|
|
1785
|
-
extractPage,
|
|
1786
|
-
mdCodeGroup
|
|
1787
|
-
];
|
|
1788
|
-
}
|
|
1789
|
-
|
|
1790
|
-
// packages/md/index.ts
|
|
1791
|
-
function mdOptions(toc) {
|
|
1792
|
-
return {
|
|
1793
|
-
remarkPlugins: [
|
|
1794
|
-
...defaultPlugins(toc)
|
|
1795
|
-
],
|
|
1796
|
-
rehypePlugins: []
|
|
1797
|
-
};
|
|
1798
|
-
}
|
|
1799
|
-
|
|
1800
|
-
// src/fs.ts
|
|
1801
|
-
async function compileBySlug(slug, mdx) {
|
|
1802
|
-
const filePath = path.join(process.cwd(), `${slug}.${mdx ? "mdx" : "md"}`);
|
|
1803
|
-
await fs.access(filePath);
|
|
1804
|
-
const content = await fs.readFile(filePath, "utf-8");
|
|
1805
|
-
return await compile(content, filePath);
|
|
1806
|
-
}
|
|
1807
|
-
async function compile(content, filePath) {
|
|
1808
|
-
const vfile = new VFile({
|
|
1809
|
-
path: filePath,
|
|
1810
|
-
value: content,
|
|
1811
|
-
contents: content
|
|
1812
|
-
});
|
|
1813
|
-
const opt = mdOptions({
|
|
1814
|
-
minDepth: 2
|
|
1815
|
-
// TODO: configurable?
|
|
1816
|
-
});
|
|
1817
|
-
const compiled = await mdxCompile(vfile, {
|
|
1818
|
-
remarkPlugins: opt.remarkPlugins,
|
|
1819
|
-
rehypePlugins: opt.rehypePlugins,
|
|
1820
|
-
recmaPlugins: [],
|
|
1821
|
-
outputFormat: "function-body",
|
|
1822
|
-
development: false
|
|
1823
|
-
});
|
|
1824
|
-
return String(compiled);
|
|
1825
|
-
}
|
|
1826
|
-
|
|
1827
|
-
// src/navigation.ts
|
|
1828
|
-
var import_react = __toESM(require_react(), 1);
|
|
1829
|
-
import { promises as fs2 } from "fs";
|
|
1830
|
-
import path2 from "path";
|
|
1831
|
-
import remarkFrontmatter2 from "remark-frontmatter";
|
|
1832
|
-
import remarkMdxFrontmatter2 from "remark-mdx-frontmatter";
|
|
1833
|
-
import { VFile as VFile2 } from "vfile";
|
|
1834
|
-
import { compile as mdxCompile2 } from "@mdx-js/mdx";
|
|
1835
|
-
async function pageFrontMatters(navigation) {
|
|
1436
|
+
import { VFile } from "vfile";
|
|
1437
|
+
import { compile as mdxCompile } from "@mdx-js/mdx";
|
|
1438
|
+
async function pageFrontMatters(navigation, pagePathMapping) {
|
|
1836
1439
|
const frontmatters = {};
|
|
1837
1440
|
const promises = [];
|
|
1838
1441
|
function mapPages(page) {
|
|
1839
1442
|
var _a;
|
|
1840
1443
|
if (typeof page !== "string") {
|
|
1841
|
-
(
|
|
1444
|
+
if ("virtual" in page) {
|
|
1445
|
+
promises.push(job(page, frontmatters, pagePathMapping));
|
|
1446
|
+
} else if ("pages" in page) {
|
|
1447
|
+
(_a = page.pages) == null ? void 0 : _a.forEach(mapPages);
|
|
1448
|
+
}
|
|
1842
1449
|
return;
|
|
1843
1450
|
}
|
|
1844
|
-
promises.push(job(page, frontmatters));
|
|
1451
|
+
promises.push(job(page, frontmatters, pagePathMapping));
|
|
1845
1452
|
}
|
|
1846
1453
|
navigation.map(async (nav) => {
|
|
1847
1454
|
var _a;
|
|
@@ -1853,7 +1460,7 @@ async function pageFrontMatters(navigation) {
|
|
|
1853
1460
|
function filterNavigationByLevels(headers, slug) {
|
|
1854
1461
|
const topLevelTabMatcher = headers == null ? void 0 : headers.reduce((acc, header) => {
|
|
1855
1462
|
var _a, _b;
|
|
1856
|
-
const tabLevel = (_b = (_a = header == null ? void 0 : header.
|
|
1463
|
+
const tabLevel = (_b = (_a = header == null ? void 0 : header.page) == null ? void 0 : _a.split("/")) == null ? void 0 : _b.length;
|
|
1857
1464
|
if (!tabLevel) {
|
|
1858
1465
|
return {
|
|
1859
1466
|
...acc
|
|
@@ -1862,12 +1469,12 @@ function filterNavigationByLevels(headers, slug) {
|
|
|
1862
1469
|
if (!acc[tabLevel]) {
|
|
1863
1470
|
return {
|
|
1864
1471
|
...acc,
|
|
1865
|
-
[tabLevel]: (/* @__PURE__ */ new Set()).add(header == null ? void 0 : header.
|
|
1472
|
+
[tabLevel]: (/* @__PURE__ */ new Set()).add(header == null ? void 0 : header.page)
|
|
1866
1473
|
};
|
|
1867
1474
|
}
|
|
1868
1475
|
return {
|
|
1869
1476
|
...acc,
|
|
1870
|
-
[tabLevel]: acc[tabLevel].add(header == null ? void 0 : header.
|
|
1477
|
+
[tabLevel]: acc[tabLevel].add(header == null ? void 0 : header.page)
|
|
1871
1478
|
};
|
|
1872
1479
|
}, {});
|
|
1873
1480
|
return (nav) => {
|
|
@@ -1882,9 +1489,16 @@ function filterNavigationByLevels(headers, slug) {
|
|
|
1882
1489
|
function findMatchedPage(page) {
|
|
1883
1490
|
var _a2;
|
|
1884
1491
|
if (typeof page !== "string") {
|
|
1885
|
-
(
|
|
1492
|
+
if ("virtual" in page && page.virtual) {
|
|
1493
|
+
return matchPage(page.virtual);
|
|
1494
|
+
} else if ("pages" in page) {
|
|
1495
|
+
(_a2 = page.pages) == null ? void 0 : _a2.forEach(findMatchedPage);
|
|
1496
|
+
}
|
|
1886
1497
|
return;
|
|
1887
1498
|
}
|
|
1499
|
+
return matchPage(page);
|
|
1500
|
+
}
|
|
1501
|
+
function matchPage(page) {
|
|
1888
1502
|
const findThisPage = page.split("/").filter((p) => !!p).slice(0, level).join("/");
|
|
1889
1503
|
const set = topLevelTabMatcher[level];
|
|
1890
1504
|
if (set.has(findThisPage) && findThisPage === findThisSlug) {
|
|
@@ -1908,16 +1522,16 @@ function mdxExport(code) {
|
|
|
1908
1522
|
return fn(scope);
|
|
1909
1523
|
}
|
|
1910
1524
|
async function getFrontmatter(filePath) {
|
|
1911
|
-
const body = await
|
|
1912
|
-
const vfile = new
|
|
1525
|
+
const body = await fs.readFile(filePath, "utf-8");
|
|
1526
|
+
const vfile = new VFile({
|
|
1913
1527
|
path: filePath,
|
|
1914
1528
|
value: body,
|
|
1915
1529
|
contents: body
|
|
1916
1530
|
});
|
|
1917
|
-
const compiled = await
|
|
1531
|
+
const compiled = await mdxCompile(vfile, {
|
|
1918
1532
|
remarkPlugins: [
|
|
1919
|
-
|
|
1920
|
-
|
|
1533
|
+
remarkFrontmatter,
|
|
1534
|
+
remarkMdxFrontmatter
|
|
1921
1535
|
],
|
|
1922
1536
|
rehypePlugins: [],
|
|
1923
1537
|
recmaPlugins: [],
|
|
@@ -1931,37 +1545,70 @@ async function getFrontmatter(filePath) {
|
|
|
1931
1545
|
frontmatter
|
|
1932
1546
|
} = mdxExport(code);
|
|
1933
1547
|
const matter = frontmatter;
|
|
1548
|
+
if (!matter) {
|
|
1549
|
+
throw new Error(`Frontmatter not found in ${filePath}`);
|
|
1550
|
+
}
|
|
1934
1551
|
let title = "";
|
|
1935
1552
|
if (typeof matter.title === "string") {
|
|
1936
1553
|
title = matter.title;
|
|
1937
1554
|
}
|
|
1938
1555
|
if (reactFrontmatter) {
|
|
1939
|
-
|
|
1940
|
-
matter.title = {
|
|
1941
|
-
title,
|
|
1942
|
-
code: reactFrontmatter.title.toString()
|
|
1943
|
-
};
|
|
1944
|
-
}
|
|
1556
|
+
console.error("currently react frontmatter is not supported");
|
|
1945
1557
|
}
|
|
1946
1558
|
return matter;
|
|
1947
1559
|
}
|
|
1948
|
-
async function job(page, frontmatters) {
|
|
1949
|
-
let
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
}
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
}
|
|
1560
|
+
async function job(page, frontmatters, pagePathMapping) {
|
|
1561
|
+
let pageName = "";
|
|
1562
|
+
if (typeof page === "string") {
|
|
1563
|
+
pageName = page;
|
|
1564
|
+
} else if (page.page) {
|
|
1565
|
+
pageName = page.page;
|
|
1566
|
+
}
|
|
1567
|
+
if (!pageName || !pagePathMapping[pageName]) {
|
|
1568
|
+
console.log(`\u26A0\uFE0F "${pageName}" is defined in the docs.json navigation but the file does not exist.`);
|
|
1569
|
+
return;
|
|
1959
1570
|
}
|
|
1571
|
+
const filePath = path.join(process.cwd(), pagePathMapping[pageName]);
|
|
1960
1572
|
const matter = await getFrontmatter(filePath);
|
|
1961
|
-
frontmatters[
|
|
1573
|
+
frontmatters[pageName] = matter;
|
|
1962
1574
|
}
|
|
1575
|
+
|
|
1576
|
+
// src/fs.ts
|
|
1577
|
+
var ContentFS = class {
|
|
1578
|
+
constructor(settings, remarkPlugins, rehypePlugins) {
|
|
1579
|
+
this.settings = settings;
|
|
1580
|
+
this.remarkPlugins = remarkPlugins;
|
|
1581
|
+
this.rehypePlugins = rehypePlugins;
|
|
1582
|
+
}
|
|
1583
|
+
async compile(filePath) {
|
|
1584
|
+
await fs2.access(filePath);
|
|
1585
|
+
const content = await fs2.readFile(filePath, "utf-8");
|
|
1586
|
+
return await this.compileContent(content, filePath);
|
|
1587
|
+
}
|
|
1588
|
+
async compileContent(content, filePath) {
|
|
1589
|
+
const vfile = new VFile2({
|
|
1590
|
+
path: filePath,
|
|
1591
|
+
value: content,
|
|
1592
|
+
contents: content
|
|
1593
|
+
});
|
|
1594
|
+
const compiled = await mdxCompile2(vfile, {
|
|
1595
|
+
remarkPlugins: this.remarkPlugins,
|
|
1596
|
+
rehypePlugins: this.rehypePlugins,
|
|
1597
|
+
recmaPlugins: [],
|
|
1598
|
+
outputFormat: "function-body",
|
|
1599
|
+
development: false,
|
|
1600
|
+
jsx: false
|
|
1601
|
+
});
|
|
1602
|
+
return String(compiled);
|
|
1603
|
+
}
|
|
1604
|
+
async readRaw(filePath) {
|
|
1605
|
+
await fs2.access(filePath);
|
|
1606
|
+
const content = await fs2.readFile(filePath, "utf-8");
|
|
1607
|
+
return content;
|
|
1608
|
+
}
|
|
1609
|
+
};
|
|
1963
1610
|
export {
|
|
1964
|
-
|
|
1611
|
+
ContentFS,
|
|
1965
1612
|
filterNavigationByLevels,
|
|
1966
1613
|
pageFrontMatters
|
|
1967
1614
|
};
|