@xyd-js/content 0.1.0-xyd.9 → 0.1.0-xyd.97
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 +1149 -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 -566
- 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 +103 -9
- package/dist/vite.js +19992 -170
- 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 -133
package/dist/vite.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as estree from 'estree';
|
|
2
|
+
import { Settings } from '@xyd-js/core';
|
|
3
|
+
import { R as RemarkMdxTocOptions } from './mdToc-NBBxMJ4l.js';
|
|
2
4
|
|
|
3
5
|
declare module 'estree' {
|
|
4
6
|
export interface Decorator extends estree.BaseNode {
|
|
@@ -18,6 +20,7 @@ declare module 'estree' {
|
|
|
18
20
|
|
|
19
21
|
// utils
|
|
20
22
|
type NullValue = null | undefined | void;
|
|
23
|
+
type MaybeArray<T> = T | T[];
|
|
21
24
|
type MaybePromise<T> = T | Promise<T>;
|
|
22
25
|
|
|
23
26
|
type PartialNull<T> = {
|
|
@@ -236,6 +239,7 @@ interface PluginContext extends MinimalPluginContext {
|
|
|
236
239
|
debug: LoggingFunction;
|
|
237
240
|
emitFile: EmitFile;
|
|
238
241
|
error: (error: RollupError | string) => never;
|
|
242
|
+
fs: RollupFsModule;
|
|
239
243
|
getFileName: (fileReferenceId: string) => string;
|
|
240
244
|
getModuleIds: () => IterableIterator<string>;
|
|
241
245
|
getModuleInfo: GetModuleInfo;
|
|
@@ -264,6 +268,20 @@ interface PluginContextMeta {
|
|
|
264
268
|
watchMode: boolean;
|
|
265
269
|
}
|
|
266
270
|
|
|
271
|
+
type StringOrRegExp = string | RegExp;
|
|
272
|
+
|
|
273
|
+
type StringFilter<Value = StringOrRegExp> =
|
|
274
|
+
| MaybeArray<Value>
|
|
275
|
+
| {
|
|
276
|
+
include?: MaybeArray<Value>;
|
|
277
|
+
exclude?: MaybeArray<Value>;
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
interface HookFilter {
|
|
281
|
+
id?: StringFilter;
|
|
282
|
+
code?: StringFilter;
|
|
283
|
+
}
|
|
284
|
+
|
|
267
285
|
interface ResolvedId extends ModuleOptions {
|
|
268
286
|
external: boolean | 'absolute';
|
|
269
287
|
id: string;
|
|
@@ -502,11 +520,20 @@ type MakeAsync<Function_> = Function_ extends (
|
|
|
502
520
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
503
521
|
type ObjectHook<T, O = {}> = T | ({ handler: T; order?: 'pre' | 'post' | null } & O);
|
|
504
522
|
|
|
523
|
+
type HookFilterExtension<K extends keyof FunctionPluginHooks> = K extends 'transform'
|
|
524
|
+
? { filter?: HookFilter }
|
|
525
|
+
: K extends 'load'
|
|
526
|
+
? { filter?: Pick<HookFilter, 'id'> }
|
|
527
|
+
: K extends 'resolveId'
|
|
528
|
+
? { filter?: { id?: StringFilter<RegExp> } }
|
|
529
|
+
: // eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
530
|
+
{};
|
|
531
|
+
|
|
505
532
|
type PluginHooks = {
|
|
506
533
|
[K in keyof FunctionPluginHooks]: ObjectHook<
|
|
507
534
|
K extends AsyncPluginHooks ? MakeAsync<FunctionPluginHooks[K]> : FunctionPluginHooks[K],
|
|
508
535
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
509
|
-
K extends ParallelPluginHooks ? { sequential?: boolean } : {}
|
|
536
|
+
HookFilterExtension<K> & (K extends ParallelPluginHooks ? { sequential?: boolean } : {})
|
|
510
537
|
>;
|
|
511
538
|
};
|
|
512
539
|
|
|
@@ -624,6 +651,7 @@ interface InputOptions {
|
|
|
624
651
|
experimentalCacheExpiry?: number;
|
|
625
652
|
experimentalLogSideEffects?: boolean;
|
|
626
653
|
external?: ExternalOption;
|
|
654
|
+
fs?: RollupFsModule;
|
|
627
655
|
input?: InputOption;
|
|
628
656
|
jsx?: false | JsxPreset | JsxOptions;
|
|
629
657
|
logLevel?: LogLevelOption;
|
|
@@ -648,6 +676,7 @@ interface NormalizedInputOptions {
|
|
|
648
676
|
experimentalCacheExpiry: number;
|
|
649
677
|
experimentalLogSideEffects: boolean;
|
|
650
678
|
external: IsExternal;
|
|
679
|
+
fs: RollupFsModule;
|
|
651
680
|
input: string[] | Record<string, string>;
|
|
652
681
|
jsx: false | NormalizedJsxOptions;
|
|
653
682
|
logLevel: LogLevelOption;
|
|
@@ -928,6 +957,7 @@ interface ChokidarOptions {
|
|
|
928
957
|
}
|
|
929
958
|
|
|
930
959
|
interface WatcherOptions {
|
|
960
|
+
allowInputInsideOutputPath?: boolean;
|
|
931
961
|
buildDelay?: number;
|
|
932
962
|
chokidar?: ChokidarOptions;
|
|
933
963
|
clearScreen?: boolean;
|
|
@@ -954,18 +984,82 @@ type RollupAstNode<T> = Omit<T, OmittedEstreeKeys> & AstNodeLocation;
|
|
|
954
984
|
type ProgramNode = RollupAstNode<estree.Program>;
|
|
955
985
|
type AstNode = RollupAstNode<estree.Node>;
|
|
956
986
|
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
987
|
+
interface RollupFsModule {
|
|
988
|
+
appendFile(
|
|
989
|
+
path: string,
|
|
990
|
+
data: string | Uint8Array,
|
|
991
|
+
options?: { encoding?: BufferEncoding | null; mode?: string | number; flag?: string | number }
|
|
992
|
+
): Promise<void>;
|
|
993
|
+
|
|
994
|
+
copyFile(source: string, destination: string, mode?: string | number): Promise<void>;
|
|
995
|
+
|
|
996
|
+
mkdir(path: string, options?: { recursive?: boolean; mode?: string | number }): Promise<void>;
|
|
997
|
+
|
|
998
|
+
mkdtemp(prefix: string): Promise<string>;
|
|
999
|
+
|
|
1000
|
+
readdir(path: string, options?: { withFileTypes?: false }): Promise<string[]>;
|
|
1001
|
+
readdir(path: string, options?: { withFileTypes: true }): Promise<RollupDirectoryEntry[]>;
|
|
1002
|
+
|
|
1003
|
+
readFile(
|
|
1004
|
+
path: string,
|
|
1005
|
+
options?: { encoding?: null; flag?: string | number; signal?: AbortSignal }
|
|
1006
|
+
): Promise<Uint8Array>;
|
|
1007
|
+
readFile(
|
|
1008
|
+
path: string,
|
|
1009
|
+
options?: { encoding: BufferEncoding; flag?: string | number; signal?: AbortSignal }
|
|
1010
|
+
): Promise<string>;
|
|
1011
|
+
|
|
1012
|
+
realpath(path: string): Promise<string>;
|
|
1013
|
+
|
|
1014
|
+
rename(oldPath: string, newPath: string): Promise<void>;
|
|
1015
|
+
|
|
1016
|
+
rmdir(path: string, options?: { recursive?: boolean }): Promise<void>;
|
|
1017
|
+
|
|
1018
|
+
stat(path: string): Promise<RollupFileStats>;
|
|
1019
|
+
|
|
1020
|
+
lstat(path: string): Promise<RollupFileStats>;
|
|
1021
|
+
|
|
1022
|
+
unlink(path: string): Promise<void>;
|
|
1023
|
+
|
|
1024
|
+
writeFile(
|
|
1025
|
+
path: string,
|
|
1026
|
+
data: string | Uint8Array,
|
|
1027
|
+
options?: { encoding?: BufferEncoding | null; mode?: string | number; flag?: string | number }
|
|
1028
|
+
): Promise<void>;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
type BufferEncoding =
|
|
1032
|
+
| 'ascii'
|
|
1033
|
+
| 'utf8'
|
|
1034
|
+
| 'utf16le'
|
|
1035
|
+
| 'ucs2'
|
|
1036
|
+
| 'base64'
|
|
1037
|
+
| 'base64url'
|
|
1038
|
+
| 'latin1'
|
|
1039
|
+
| 'binary'
|
|
1040
|
+
| 'hex';
|
|
1041
|
+
|
|
1042
|
+
interface RollupDirectoryEntry {
|
|
1043
|
+
isFile(): boolean;
|
|
1044
|
+
isDirectory(): boolean;
|
|
1045
|
+
isSymbolicLink(): boolean;
|
|
1046
|
+
name: string;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
interface RollupFileStats {
|
|
1050
|
+
isFile(): boolean;
|
|
1051
|
+
isDirectory(): boolean;
|
|
1052
|
+
isSymbolicLink(): boolean;
|
|
1053
|
+
size: number;
|
|
1054
|
+
mtime: Date;
|
|
1055
|
+
ctime: Date;
|
|
1056
|
+
atime: Date;
|
|
1057
|
+
birthtime: Date;
|
|
965
1058
|
}
|
|
966
1059
|
|
|
967
1060
|
interface VitePluginInterface {
|
|
968
1061
|
toc: RemarkMdxTocOptions;
|
|
1062
|
+
settings: Settings;
|
|
969
1063
|
}
|
|
970
1064
|
declare function vitePlugins(options: VitePluginInterface): Plugin[];
|
|
971
1065
|
|