@xyd-js/content 0.1.0-xyd.13 → 0.1.0-xyd.16

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.
Files changed (89) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/ISSUES.md +1 -0
  3. package/TODO.md +2 -0
  4. package/dist/index.d.ts +24 -5
  5. package/dist/index.js +1411 -21776
  6. package/dist/index.js.map +1 -1
  7. package/dist/md.d.ts +62 -7
  8. package/dist/md.js +18071 -15085
  9. package/dist/md.js.map +1 -1
  10. package/dist/{mdToc-CYxzibVZ.d.ts → mdToc-NBBxMJ4l.d.ts} +1 -0
  11. package/dist/vite.d.ts +81 -2
  12. package/dist/vite.js +9716 -10090
  13. package/dist/vite.js.map +1 -1
  14. package/example.txt +0 -0
  15. package/package.json +24 -6
  16. package/packages/md/index.ts +17 -8
  17. package/packages/md/plugins/component-directives/index.ts +3 -0
  18. package/packages/md/plugins/component-directives/mdComponentDirective.ts +524 -0
  19. package/packages/md/plugins/component-directives/types.ts +1 -0
  20. package/packages/md/plugins/component-directives/utils.ts +27 -0
  21. package/packages/md/plugins/composer/__fixtures__/1.single-example/input.md +7 -0
  22. package/packages/md/plugins/composer/__fixtures__/1.single-example/output.json +63 -0
  23. package/packages/md/plugins/composer/__fixtures__/2.single-example-with-name/input.md +7 -0
  24. package/packages/md/plugins/composer/__fixtures__/2.single-example-with-name/output.json +63 -0
  25. package/packages/md/plugins/composer/__fixtures__/3.multiple-examples/input.md +15 -0
  26. package/packages/md/plugins/composer/__fixtures__/3.multiple-examples/output.json +122 -0
  27. package/packages/md/plugins/composer/__fixtures__/4.example-groups/input.md +23 -0
  28. package/packages/md/plugins/composer/__fixtures__/4.example-groups/output.json +184 -0
  29. package/packages/md/plugins/composer/__tests__/mdComposer.test.ts +41 -0
  30. package/packages/md/plugins/composer/__tests__/testHelpers.ts +48 -0
  31. package/packages/md/plugins/composer/index.ts +1 -0
  32. package/packages/md/plugins/composer/mdComposer.ts +146 -0
  33. package/packages/md/plugins/developer-writing/index.ts +3 -0
  34. package/packages/md/plugins/developer-writing/mdCodeRehype.ts +78 -0
  35. package/packages/md/plugins/functions/__fixtures__/external.ts +4 -0
  36. package/packages/md/plugins/functions/__fixtures__/test.js +11 -0
  37. package/packages/md/plugins/functions/__fixtures__/test.py +9 -0
  38. package/packages/md/plugins/functions/__fixtures__/test.ts +18 -0
  39. package/packages/md/plugins/functions/__tests__/mdFunctionImportCode.test.ts +295 -0
  40. package/packages/md/plugins/functions/__tests__/parseFunctionCall.test.ts +47 -0
  41. package/packages/md/plugins/functions/__tests__/testHelpers.ts +71 -0
  42. package/packages/md/plugins/functions/index.ts +11 -0
  43. package/packages/md/plugins/functions/mdFunctionChangelog.ts +124 -0
  44. package/packages/md/plugins/functions/mdFunctionImportCode.ts +83 -0
  45. package/packages/md/plugins/functions/mdFunctionUniform.ts +79 -0
  46. package/packages/md/plugins/functions/types.ts +6 -0
  47. package/packages/md/plugins/functions/uniformProcessor.ts +349 -0
  48. package/packages/md/plugins/functions/utils.ts +423 -0
  49. package/packages/md/plugins/index.ts +56 -11
  50. package/packages/md/plugins/mdCode.ts +52 -4
  51. package/packages/md/plugins/mdHeadingId.ts +47 -0
  52. package/packages/md/plugins/mdPage.ts +3 -0
  53. package/packages/md/plugins/mdThemeSettings.ts +4 -0
  54. package/packages/md/plugins/mdToc.ts +108 -17
  55. package/packages/md/plugins/meta/index.ts +1 -0
  56. package/packages/md/plugins/meta/mdMeta.ts +189 -0
  57. package/packages/md/plugins/output-variables/__fixtures__/1.simple/input.md +22 -0
  58. package/packages/md/plugins/output-variables/__fixtures__/1.simple/output.json +191 -0
  59. package/packages/md/plugins/output-variables/__fixtures__/2.multiple-vars/input.md +21 -0
  60. package/packages/md/plugins/output-variables/__fixtures__/2.multiple-vars/output.json +127 -0
  61. package/packages/md/plugins/output-variables/__tests__/index.test.ts +28 -0
  62. package/packages/md/plugins/output-variables/__tests__/testHelpers.ts +36 -0
  63. package/packages/md/plugins/output-variables/index.ts +1 -0
  64. package/packages/md/plugins/output-variables/lib/const.ts +4 -0
  65. package/packages/md/plugins/output-variables/lib/factoryAttributes.ts +350 -0
  66. package/packages/md/plugins/output-variables/lib/factoryLabel.ts +135 -0
  67. package/packages/md/plugins/output-variables/lib/factoryName.ts +59 -0
  68. package/packages/md/plugins/output-variables/lib/index.ts +21 -0
  69. package/packages/md/plugins/output-variables/lib/outputVarsContainer.ts +328 -0
  70. package/packages/md/plugins/output-variables/lib/util.ts +494 -0
  71. package/packages/md/plugins/output-variables/remarkOutputVars.ts +22 -0
  72. package/packages/md/plugins/rehypeHeading.ts +50 -0
  73. package/packages/md/plugins/types.ts +15 -0
  74. package/packages/md/plugins/utils/componentLike.ts +72 -0
  75. package/packages/md/plugins/utils/index.ts +2 -0
  76. package/packages/md/plugins/utils/mdParameters.test.ts +114 -0
  77. package/packages/md/plugins/utils/mdParameters.ts +249 -0
  78. package/packages/md/plugins/utils/mdastTypes.ts +42 -0
  79. package/packages/md/search/index.ts +251 -0
  80. package/packages/md/search/types.ts +36 -0
  81. package/packages/vite/index.ts +8 -2
  82. package/src/fs.ts +51 -36
  83. package/src/index.ts +4 -4
  84. package/src/navigation.ts +50 -38
  85. package/src/types.ts +8 -0
  86. package/tsconfig.json +31 -8
  87. package/vitest.config.ts +17 -0
  88. package/packages/md/plugins/mdCodeGroup.ts +0 -40
  89. package/packages/md/plugins/mdComponentDirective.ts +0 -141
@@ -5,6 +5,7 @@ type CustomTag = {
5
5
  interface RemarkMdxTocOptions {
6
6
  name?: string;
7
7
  customTags?: CustomTag[];
8
+ maxDepth?: number;
8
9
  minDepth?: number;
9
10
  }
10
11
 
package/dist/vite.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as estree from 'estree';
2
- import { R as RemarkMdxTocOptions } from './mdToc-CYxzibVZ.js';
2
+ import { Settings } from '@xyd-js/core';
3
+ import { R as RemarkMdxTocOptions } from './mdToc-NBBxMJ4l.js';
3
4
 
4
5
  declare module 'estree' {
5
6
  export interface Decorator extends estree.BaseNode {
@@ -238,6 +239,7 @@ interface PluginContext extends MinimalPluginContext {
238
239
  debug: LoggingFunction;
239
240
  emitFile: EmitFile;
240
241
  error: (error: RollupError | string) => never;
242
+ fs: RollupFsModule;
241
243
  getFileName: (fileReferenceId: string) => string;
242
244
  getModuleIds: () => IterableIterator<string>;
243
245
  getModuleInfo: GetModuleInfo;
@@ -523,7 +525,7 @@ type HookFilterExtension<K extends keyof FunctionPluginHooks> = K extends 'trans
523
525
  : K extends 'load'
524
526
  ? { filter?: Pick<HookFilter, 'id'> }
525
527
  : K extends 'resolveId'
526
- ? { filter?: { id: StringFilter<RegExp> } }
528
+ ? { filter?: { id?: StringFilter<RegExp> } }
527
529
  : // eslint-disable-next-line @typescript-eslint/no-empty-object-type
528
530
  {};
529
531
 
@@ -649,6 +651,7 @@ interface InputOptions {
649
651
  experimentalCacheExpiry?: number;
650
652
  experimentalLogSideEffects?: boolean;
651
653
  external?: ExternalOption;
654
+ fs?: RollupFsModule;
652
655
  input?: InputOption;
653
656
  jsx?: false | JsxPreset | JsxOptions;
654
657
  logLevel?: LogLevelOption;
@@ -673,6 +676,7 @@ interface NormalizedInputOptions {
673
676
  experimentalCacheExpiry: number;
674
677
  experimentalLogSideEffects: boolean;
675
678
  external: IsExternal;
679
+ fs: RollupFsModule;
676
680
  input: string[] | Record<string, string>;
677
681
  jsx: false | NormalizedJsxOptions;
678
682
  logLevel: LogLevelOption;
@@ -953,6 +957,7 @@ interface ChokidarOptions {
953
957
  }
954
958
 
955
959
  interface WatcherOptions {
960
+ allowInputInsideOutputPath?: boolean;
956
961
  buildDelay?: number;
957
962
  chokidar?: ChokidarOptions;
958
963
  clearScreen?: boolean;
@@ -979,8 +984,82 @@ type RollupAstNode<T> = Omit<T, OmittedEstreeKeys> & AstNodeLocation;
979
984
  type ProgramNode = RollupAstNode<estree.Program>;
980
985
  type AstNode = RollupAstNode<estree.Node>;
981
986
 
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;
1058
+ }
1059
+
982
1060
  interface VitePluginInterface {
983
1061
  toc: RemarkMdxTocOptions;
1062
+ settings: Settings;
984
1063
  }
985
1064
  declare function vitePlugins(options: VitePluginInterface): Plugin[];
986
1065