unplugin-docubook 1.0.0 → 1.0.2

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 (110) hide show
  1. package/README.md +142 -2
  2. package/dist/astro.cjs +152 -0
  3. package/dist/astro.cjs.map +1 -0
  4. package/dist/astro.js +125 -12
  5. package/dist/astro.js.map +1 -1
  6. package/dist/bun.cjs +140 -0
  7. package/dist/bun.cjs.map +1 -0
  8. package/dist/bun.js +115 -5
  9. package/dist/bun.js.map +1 -1
  10. package/dist/components/index.cjs +829 -0
  11. package/dist/components/index.cjs.map +1 -0
  12. package/dist/components/index.js +720 -512
  13. package/dist/components/index.js.map +1 -1
  14. package/dist/esbuild.cjs +140 -0
  15. package/dist/esbuild.cjs.map +1 -0
  16. package/dist/esbuild.js +115 -5
  17. package/dist/esbuild.js.map +1 -1
  18. package/dist/farm.cjs +140 -0
  19. package/dist/farm.cjs.map +1 -0
  20. package/dist/farm.js +115 -5
  21. package/dist/farm.js.map +1 -1
  22. package/dist/index.cjs +143 -0
  23. package/dist/index.cjs.map +1 -0
  24. package/dist/index.js +116 -2
  25. package/dist/index.js.map +1 -0
  26. package/dist/next.cjs +140 -0
  27. package/dist/next.cjs.map +1 -0
  28. package/dist/next.js +119 -0
  29. package/dist/next.js.map +1 -0
  30. package/dist/nuxt.cjs +160 -0
  31. package/dist/nuxt.cjs.map +1 -0
  32. package/dist/nuxt.js +134 -16
  33. package/dist/nuxt.js.map +1 -1
  34. package/dist/rolldown.cjs +140 -0
  35. package/dist/rolldown.cjs.map +1 -0
  36. package/dist/rolldown.js +115 -5
  37. package/dist/rolldown.js.map +1 -1
  38. package/dist/rollup.cjs +140 -0
  39. package/dist/rollup.cjs.map +1 -0
  40. package/dist/rollup.js +115 -5
  41. package/dist/rollup.js.map +1 -1
  42. package/dist/rspack.cjs +140 -0
  43. package/dist/rspack.cjs.map +1 -0
  44. package/dist/rspack.js +115 -5
  45. package/dist/rspack.js.map +1 -1
  46. package/dist/types.cjs +19 -0
  47. package/dist/types.cjs.map +1 -0
  48. package/dist/types.js +1 -1
  49. package/dist/types.js.map +1 -0
  50. package/dist/vite.cjs +140 -0
  51. package/dist/vite.cjs.map +1 -0
  52. package/dist/vite.js +115 -5
  53. package/dist/vite.js.map +1 -1
  54. package/dist/webpack.cjs +140 -0
  55. package/dist/webpack.cjs.map +1 -0
  56. package/dist/webpack.js +115 -5
  57. package/dist/webpack.js.map +1 -1
  58. package/package.json +92 -33
  59. package/dist/adapters/next-DNQX7_ln.d.ts +0 -24
  60. package/dist/adapters/next-DNQX7_ln.d.ts.map +0 -1
  61. package/dist/adapters/next.js +0 -38
  62. package/dist/adapters/next.js.map +0 -1
  63. package/dist/adapters/react-C9Vk6aTD.d.ts +0 -24
  64. package/dist/adapters/react-C9Vk6aTD.d.ts.map +0 -1
  65. package/dist/adapters/react.js +0 -39
  66. package/dist/adapters/react.js.map +0 -1
  67. package/dist/adapters/svelte-C-dhzdmU.d.ts +0 -19
  68. package/dist/adapters/svelte-C-dhzdmU.d.ts.map +0 -1
  69. package/dist/adapters/svelte.js +0 -43
  70. package/dist/adapters/svelte.js.map +0 -1
  71. package/dist/adapters/vue-BWv1EZit.d.ts +0 -22
  72. package/dist/adapters/vue-BWv1EZit.d.ts.map +0 -1
  73. package/dist/adapters/vue.js +0 -41
  74. package/dist/adapters/vue.js.map +0 -1
  75. package/dist/astro-BcckVQ-2.d.ts +0 -19
  76. package/dist/astro-BcckVQ-2.d.ts.map +0 -1
  77. package/dist/bun-DYPhytPs.d.ts +0 -7
  78. package/dist/bun-DYPhytPs.d.ts.map +0 -1
  79. package/dist/components/index-LWFtIGRd.d.ts +0 -265
  80. package/dist/components/index-LWFtIGRd.d.ts.map +0 -1
  81. package/dist/context-BKx0jIwX.js +0 -49
  82. package/dist/context-BKx0jIwX.js.map +0 -1
  83. package/dist/esbuild-BD42nX0_.d.ts +0 -8
  84. package/dist/esbuild-BD42nX0_.d.ts.map +0 -1
  85. package/dist/farm-C3XYk4nf.d.ts +0 -7
  86. package/dist/farm-C3XYk4nf.d.ts.map +0 -1
  87. package/dist/framework/index-98dEoo0g.d.ts +0 -11
  88. package/dist/framework/index-98dEoo0g.d.ts.map +0 -1
  89. package/dist/framework/index.js +0 -29
  90. package/dist/framework/index.js.map +0 -1
  91. package/dist/index-2f48-Fxc.d.ts +0 -10
  92. package/dist/index-2f48-Fxc.d.ts.map +0 -1
  93. package/dist/nuxt-BidHgMAG.d.ts +0 -5
  94. package/dist/nuxt-BidHgMAG.d.ts.map +0 -1
  95. package/dist/rolldown-CrcgSKP1.d.ts +0 -8
  96. package/dist/rolldown-CrcgSKP1.d.ts.map +0 -1
  97. package/dist/rollup-DDEc1C_K.d.ts +0 -8
  98. package/dist/rollup-DDEc1C_K.d.ts.map +0 -1
  99. package/dist/rspack-QbbymFlY.d.ts +0 -7
  100. package/dist/rspack-QbbymFlY.d.ts.map +0 -1
  101. package/dist/src-KZV_M01u.js +0 -165
  102. package/dist/src-KZV_M01u.js.map +0 -1
  103. package/dist/types-BQhWL5Qs.d.ts +0 -34
  104. package/dist/types-BQhWL5Qs.d.ts.map +0 -1
  105. package/dist/types-uxY1cMXO.d.ts +0 -28
  106. package/dist/types-uxY1cMXO.d.ts.map +0 -1
  107. package/dist/vite-9CqZQPO-.d.ts +0 -8
  108. package/dist/vite-9CqZQPO-.d.ts.map +0 -1
  109. package/dist/webpack-CBuuXltg.d.ts +0 -7
  110. package/dist/webpack-CBuuXltg.d.ts.map +0 -1
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/rolldown.ts
21
+ var rolldown_exports = {};
22
+ __export(rolldown_exports, {
23
+ default: () => rolldown_default
24
+ });
25
+ module.exports = __toCommonJS(rolldown_exports);
26
+ var import_unplugin2 = require("unplugin");
27
+
28
+ // src/index.ts
29
+ var import_unplugin = require("unplugin");
30
+
31
+ // src/core/registry.ts
32
+ var FRAMEWORK_PATHS = {
33
+ react: "/react",
34
+ vue: "/vue",
35
+ svelte: "/svelte"
36
+ };
37
+ function createRegistry(framework) {
38
+ const basePath = FRAMEWORK_PATHS[framework];
39
+ return {
40
+ Note: { exports: ["Note"], path: basePath },
41
+ Card: { exports: ["Card"], path: basePath },
42
+ CardGroup: { exports: ["CardGroup"], path: basePath },
43
+ Accordion: { exports: ["Accordion"], path: basePath },
44
+ AccordionGroup: { exports: ["AccordionGroup"], path: basePath },
45
+ Stepper: { exports: ["Stepper", "StepperItem"], path: basePath },
46
+ Kbd: { exports: ["Kbd"], path: basePath },
47
+ Tooltip: { exports: ["Tooltip"], path: basePath },
48
+ Youtube: { exports: ["Youtube"], path: basePath },
49
+ Button: { exports: ["Button"], path: basePath },
50
+ DocuLink: { exports: ["DocuLink"], path: basePath },
51
+ DocuImage: { exports: ["DocuImage"], path: basePath },
52
+ Files: { exports: ["Files"], path: basePath },
53
+ Folder: { exports: ["Folder"], path: basePath },
54
+ File: { exports: ["File"], path: basePath },
55
+ Release: { exports: ["Release"], path: basePath },
56
+ Changes: { exports: ["Changes"], path: basePath },
57
+ Pre: { exports: ["Pre"], path: basePath },
58
+ Copy: { exports: ["Copy"], path: basePath },
59
+ DocuBookProvider: { exports: ["DocuBookProvider"], path: basePath }
60
+ };
61
+ }
62
+ function getComponentRegistry(framework = "react") {
63
+ return createRegistry(framework);
64
+ }
65
+ function buildComponentDetectionRegex(framework = "react") {
66
+ const registry = getComponentRegistry(framework);
67
+ const names = Object.keys(registry);
68
+ return new RegExp(`<(${names.join("|")})(?=[\\s/>])`, "g");
69
+ }
70
+
71
+ // src/core/transform.ts
72
+ var DEFAULT_IMPORT_SOURCE = "unplugin-docubook/components";
73
+ var DEFAULT_FRAMEWORK = "react";
74
+ function detectComponents(code, framework = DEFAULT_FRAMEWORK) {
75
+ const regex = buildComponentDetectionRegex(framework);
76
+ const registry = getComponentRegistry(framework);
77
+ const found = /* @__PURE__ */ new Set();
78
+ let match;
79
+ while ((match = regex.exec(code)) !== null) {
80
+ const name = match[1];
81
+ if (name && registry[name]) {
82
+ found.add(name);
83
+ }
84
+ }
85
+ return Array.from(found);
86
+ }
87
+ function generateImports(componentNames, importSource, framework = DEFAULT_FRAMEWORK) {
88
+ const registry = getComponentRegistry(framework);
89
+ const pathToExports = /* @__PURE__ */ new Map();
90
+ for (const name of componentNames) {
91
+ const meta = registry[name];
92
+ if (!meta) continue;
93
+ const fullPath = `${importSource}${meta.path}`;
94
+ if (!pathToExports.has(fullPath)) {
95
+ pathToExports.set(fullPath, /* @__PURE__ */ new Set());
96
+ }
97
+ for (const exp of meta.exports) {
98
+ pathToExports.get(fullPath).add(exp);
99
+ }
100
+ }
101
+ const lines = [];
102
+ for (const [path, exports2] of pathToExports) {
103
+ const names = Array.from(exports2).sort().join(", ");
104
+ lines.push(`import { ${names} } from '${path}'`);
105
+ }
106
+ return lines.join("\n");
107
+ }
108
+ function transformMdx(code, options = {}) {
109
+ var _a, _b;
110
+ const framework = (_a = options.framework) != null ? _a : DEFAULT_FRAMEWORK;
111
+ const usedComponents = detectComponents(code, framework);
112
+ if (usedComponents.length === 0) {
113
+ return { code, hasTransformed: false };
114
+ }
115
+ const importSource = (_b = options.importSource) != null ? _b : DEFAULT_IMPORT_SOURCE;
116
+ const importStatements = generateImports(usedComponents, importSource, framework);
117
+ return {
118
+ code: `${importStatements}
119
+
120
+ ${code}`,
121
+ hasTransformed: true
122
+ };
123
+ }
124
+
125
+ // src/index.ts
126
+ var unpluginFactory = (options) => ({
127
+ name: "unplugin-docubook",
128
+ transformInclude(id) {
129
+ return /\.mdx?$/.test(id);
130
+ },
131
+ transform(code, _id) {
132
+ const result = transformMdx(code, options);
133
+ if (!result.hasTransformed) return;
134
+ return result.code;
135
+ }
136
+ });
137
+
138
+ // src/rolldown.ts
139
+ var rolldown_default = (0, import_unplugin2.createRolldownPlugin)(unpluginFactory);
140
+ //# sourceMappingURL=rolldown.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/rolldown.ts","../src/index.ts","../src/core/registry.ts","../src/core/transform.ts"],"sourcesContent":["import { createRolldownPlugin } from 'unplugin'\nimport { unpluginFactory } from '.'\n\nexport default createRolldownPlugin(unpluginFactory)\n","import type { UnpluginFactory } from 'unplugin'\nimport type { Options } from './types'\nimport { createUnplugin } from 'unplugin'\nimport { transformMdx } from './core/transform'\n\nexport const unpluginFactory: UnpluginFactory<Options | undefined> = (\n options,\n) => ({\n name: 'unplugin-docubook',\n\n transformInclude(id) {\n // Only process .mdx and .md files\n return /\\.mdx?$/.test(id)\n },\n\n transform(code, _id) {\n const result = transformMdx(code, options)\n if (!result.hasTransformed) return\n return result.code\n },\n})\n\nexport const unplugin = /* #__PURE__ */ createUnplugin(unpluginFactory)\n\nexport default unplugin\n","import type { Framework } from '../types'\n\nexport interface ComponentMeta {\n exports: string[]\n path: string\n}\n\nconst FRAMEWORK_PATHS: Record<Framework, string> = {\n react: '/react',\n vue: '/vue',\n svelte: '/svelte',\n}\n\nfunction createRegistry(framework: Framework): Record<string, ComponentMeta> {\n const basePath = FRAMEWORK_PATHS[framework]\n\n return {\n Note: { exports: ['Note'], path: basePath },\n Card: { exports: ['Card'], path: basePath },\n CardGroup: { exports: ['CardGroup'], path: basePath },\n Accordion: { exports: ['Accordion'], path: basePath },\n AccordionGroup: { exports: ['AccordionGroup'], path: basePath },\n Stepper: { exports: ['Stepper', 'StepperItem'], path: basePath },\n Kbd: { exports: ['Kbd'], path: basePath },\n Tooltip: { exports: ['Tooltip'], path: basePath },\n Youtube: { exports: ['Youtube'], path: basePath },\n Button: { exports: ['Button'], path: basePath },\n DocuLink: { exports: ['DocuLink'], path: basePath },\n DocuImage: { exports: ['DocuImage'], path: basePath },\n Files: { exports: ['Files'], path: basePath },\n Folder: { exports: ['Folder'], path: basePath },\n File: { exports: ['File'], path: basePath },\n Release: { exports: ['Release'], path: basePath },\n Changes: { exports: ['Changes'], path: basePath },\n Pre: { exports: ['Pre'], path: basePath },\n Copy: { exports: ['Copy'], path: basePath },\n DocuBookProvider: { exports: ['DocuBookProvider'], path: basePath },\n }\n}\n\nexport function getComponentRegistry(framework: Framework = 'react'): Record<string, ComponentMeta> {\n return createRegistry(framework)\n}\n\nexport function buildComponentDetectionRegex(framework: Framework = 'react'): RegExp {\n const registry = getComponentRegistry(framework)\n const names = Object.keys(registry)\n return new RegExp(`<(${names.join('|')})(?=[\\\\s/>])`, 'g')\n}\n","import type { Options, Framework } from '../types'\nimport { getComponentRegistry, buildComponentDetectionRegex } from './registry'\n\nconst DEFAULT_IMPORT_SOURCE = 'unplugin-docubook/components'\nconst DEFAULT_FRAMEWORK: Framework = 'react'\n\nexport function detectComponents(code: string, framework: Framework = DEFAULT_FRAMEWORK): string[] {\n const regex = buildComponentDetectionRegex(framework)\n const registry = getComponentRegistry(framework)\n const found = new Set<string>()\n let match: RegExpExecArray | null\n\n while ((match = regex.exec(code)) !== null) {\n const name = match[1]\n if (name && registry[name]) {\n found.add(name)\n }\n }\n\n return Array.from(found)\n}\n\nexport function generateImports(\n componentNames: string[],\n importSource: string,\n framework: Framework = DEFAULT_FRAMEWORK,\n): string {\n const registry = getComponentRegistry(framework)\n const pathToExports = new Map<string, Set<string>>()\n\n for (const name of componentNames) {\n const meta = registry[name]\n if (!meta) continue\n\n const fullPath = `${importSource}${meta.path}`\n if (!pathToExports.has(fullPath)) {\n pathToExports.set(fullPath, new Set())\n }\n for (const exp of meta.exports) {\n pathToExports.get(fullPath)!.add(exp)\n }\n }\n\n const lines: string[] = []\n for (const [path, exports] of pathToExports) {\n const names = Array.from(exports).sort().join(', ')\n lines.push(`import { ${names} } from '${path}'`)\n }\n\n return lines.join('\\n')\n}\n\nexport function transformMdx(\n code: string,\n options: Options = {},\n): { code: string; hasTransformed: boolean } {\n const framework = options.framework ?? DEFAULT_FRAMEWORK\n const usedComponents = detectComponents(code, framework)\n\n if (usedComponents.length === 0) {\n return { code, hasTransformed: false }\n }\n\n const importSource = options.importSource ?? DEFAULT_IMPORT_SOURCE\n const importStatements = generateImports(usedComponents, importSource, framework)\n\n return {\n code: `${importStatements}\\n\\n${code}`,\n hasTransformed: true,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,mBAAqC;;;ACErC,sBAA+B;;;ACK/B,IAAM,kBAA6C;AAAA,EAC/C,OAAO;AAAA,EACP,KAAK;AAAA,EACL,QAAQ;AACZ;AAEA,SAAS,eAAe,WAAqD;AACzE,QAAM,WAAW,gBAAgB,SAAS;AAE1C,SAAO;AAAA,IACH,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,SAAS;AAAA,IAC1C,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,SAAS;AAAA,IAC1C,WAAW,EAAE,SAAS,CAAC,WAAW,GAAG,MAAM,SAAS;AAAA,IACpD,WAAW,EAAE,SAAS,CAAC,WAAW,GAAG,MAAM,SAAS;AAAA,IACpD,gBAAgB,EAAE,SAAS,CAAC,gBAAgB,GAAG,MAAM,SAAS;AAAA,IAC9D,SAAS,EAAE,SAAS,CAAC,WAAW,aAAa,GAAG,MAAM,SAAS;AAAA,IAC/D,KAAK,EAAE,SAAS,CAAC,KAAK,GAAG,MAAM,SAAS;AAA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AO;AAAA,IACH,MAAM,GAAG,gBAAgB;AAAA;AAAA,EAAO,IAAI;AAAA,IACpC,gBAAgB;AAAA,EACpB;AACJ;;;AFjEO,IAAM,kBAAwD,CACjE,aACE;AAAA,EACF,MAAM;AAAA,EAEN,iBAAiB,IAAI;AAEjB,WAAO,UAAU,KAAK,EAAE;AAAA,EAC5B;AAAA,EAEA,UAAU,MAAM,KAAK;AACjB,UAAM,SAAS,aAAa,MAAM,OAAO;AACzC,QAAI,CAAC,OAAO,eAAgB;AAC5B,WAAO,OAAO;AAAA,EAClB;AACJ;;;ADjBA,IAAO,uBAAQ,uCAAqB,eAAe;","names":["import_unplugin","exports"]}
package/dist/rolldown.js CHANGED
@@ -1,9 +1,119 @@
1
- import { n as unpluginFactory } from "./src-KZV_M01u.js";
1
+ // src/rolldown.ts
2
2
  import { createRolldownPlugin } from "unplugin";
3
3
 
4
- //#region src/rolldown.ts
5
- var rolldown_default = createRolldownPlugin(unpluginFactory);
4
+ // src/index.ts
5
+ import { createUnplugin } from "unplugin";
6
+
7
+ // src/core/registry.ts
8
+ var FRAMEWORK_PATHS = {
9
+ react: "/react",
10
+ vue: "/vue",
11
+ svelte: "/svelte"
12
+ };
13
+ function createRegistry(framework) {
14
+ const basePath = FRAMEWORK_PATHS[framework];
15
+ return {
16
+ Note: { exports: ["Note"], path: basePath },
17
+ Card: { exports: ["Card"], path: basePath },
18
+ CardGroup: { exports: ["CardGroup"], path: basePath },
19
+ Accordion: { exports: ["Accordion"], path: basePath },
20
+ AccordionGroup: { exports: ["AccordionGroup"], path: basePath },
21
+ Stepper: { exports: ["Stepper", "StepperItem"], path: basePath },
22
+ Kbd: { exports: ["Kbd"], path: basePath },
23
+ Tooltip: { exports: ["Tooltip"], path: basePath },
24
+ Youtube: { exports: ["Youtube"], path: basePath },
25
+ Button: { exports: ["Button"], path: basePath },
26
+ DocuLink: { exports: ["DocuLink"], path: basePath },
27
+ DocuImage: { exports: ["DocuImage"], path: basePath },
28
+ Files: { exports: ["Files"], path: basePath },
29
+ Folder: { exports: ["Folder"], path: basePath },
30
+ File: { exports: ["File"], path: basePath },
31
+ Release: { exports: ["Release"], path: basePath },
32
+ Changes: { exports: ["Changes"], path: basePath },
33
+ Pre: { exports: ["Pre"], path: basePath },
34
+ Copy: { exports: ["Copy"], path: basePath },
35
+ DocuBookProvider: { exports: ["DocuBookProvider"], path: basePath }
36
+ };
37
+ }
38
+ function getComponentRegistry(framework = "react") {
39
+ return createRegistry(framework);
40
+ }
41
+ function buildComponentDetectionRegex(framework = "react") {
42
+ const registry = getComponentRegistry(framework);
43
+ const names = Object.keys(registry);
44
+ return new RegExp(`<(${names.join("|")})(?=[\\s/>])`, "g");
45
+ }
46
+
47
+ // src/core/transform.ts
48
+ var DEFAULT_IMPORT_SOURCE = "unplugin-docubook/components";
49
+ var DEFAULT_FRAMEWORK = "react";
50
+ function detectComponents(code, framework = DEFAULT_FRAMEWORK) {
51
+ const regex = buildComponentDetectionRegex(framework);
52
+ const registry = getComponentRegistry(framework);
53
+ const found = /* @__PURE__ */ new Set();
54
+ let match;
55
+ while ((match = regex.exec(code)) !== null) {
56
+ const name = match[1];
57
+ if (name && registry[name]) {
58
+ found.add(name);
59
+ }
60
+ }
61
+ return Array.from(found);
62
+ }
63
+ function generateImports(componentNames, importSource, framework = DEFAULT_FRAMEWORK) {
64
+ const registry = getComponentRegistry(framework);
65
+ const pathToExports = /* @__PURE__ */ new Map();
66
+ for (const name of componentNames) {
67
+ const meta = registry[name];
68
+ if (!meta) continue;
69
+ const fullPath = `${importSource}${meta.path}`;
70
+ if (!pathToExports.has(fullPath)) {
71
+ pathToExports.set(fullPath, /* @__PURE__ */ new Set());
72
+ }
73
+ for (const exp of meta.exports) {
74
+ pathToExports.get(fullPath).add(exp);
75
+ }
76
+ }
77
+ const lines = [];
78
+ for (const [path, exports] of pathToExports) {
79
+ const names = Array.from(exports).sort().join(", ");
80
+ lines.push(`import { ${names} } from '${path}'`);
81
+ }
82
+ return lines.join("\n");
83
+ }
84
+ function transformMdx(code, options = {}) {
85
+ var _a, _b;
86
+ const framework = (_a = options.framework) != null ? _a : DEFAULT_FRAMEWORK;
87
+ const usedComponents = detectComponents(code, framework);
88
+ if (usedComponents.length === 0) {
89
+ return { code, hasTransformed: false };
90
+ }
91
+ const importSource = (_b = options.importSource) != null ? _b : DEFAULT_IMPORT_SOURCE;
92
+ const importStatements = generateImports(usedComponents, importSource, framework);
93
+ return {
94
+ code: `${importStatements}
6
95
 
7
- //#endregion
8
- export { rolldown_default as default };
96
+ ${code}`,
97
+ hasTransformed: true
98
+ };
99
+ }
100
+
101
+ // src/index.ts
102
+ var unpluginFactory = (options) => ({
103
+ name: "unplugin-docubook",
104
+ transformInclude(id) {
105
+ return /\.mdx?$/.test(id);
106
+ },
107
+ transform(code, _id) {
108
+ const result = transformMdx(code, options);
109
+ if (!result.hasTransformed) return;
110
+ return result.code;
111
+ }
112
+ });
113
+
114
+ // src/rolldown.ts
115
+ var rolldown_default = createRolldownPlugin(unpluginFactory);
116
+ export {
117
+ rolldown_default as default
118
+ };
9
119
  //# sourceMappingURL=rolldown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rolldown.js","names":[],"sources":["../src/rolldown.ts"],"sourcesContent":["import { createRolldownPlugin } from 'unplugin'\nimport { unpluginFactory } from '.'\n\nexport default createRolldownPlugin(unpluginFactory)\n"],"mappings":";;;;AAGA,uBAAe,qBAAqB,gBAAgB"}
1
+ {"version":3,"sources":["../src/rolldown.ts","../src/index.ts","../src/core/registry.ts","../src/core/transform.ts"],"sourcesContent":["import { createRolldownPlugin } from 'unplugin'\nimport { unpluginFactory } from '.'\n\nexport default createRolldownPlugin(unpluginFactory)\n","import type { UnpluginFactory } from 'unplugin'\nimport type { Options } from './types'\nimport { createUnplugin } from 'unplugin'\nimport { transformMdx } from './core/transform'\n\nexport const unpluginFactory: UnpluginFactory<Options | undefined> = (\n options,\n) => ({\n name: 'unplugin-docubook',\n\n transformInclude(id) {\n // Only process .mdx and .md files\n return /\\.mdx?$/.test(id)\n },\n\n transform(code, _id) {\n const result = transformMdx(code, options)\n if (!result.hasTransformed) return\n return result.code\n },\n})\n\nexport const unplugin = /* #__PURE__ */ createUnplugin(unpluginFactory)\n\nexport default unplugin\n","import type { Framework } from '../types'\n\nexport interface ComponentMeta {\n exports: string[]\n path: string\n}\n\nconst FRAMEWORK_PATHS: Record<Framework, string> = {\n react: '/react',\n vue: '/vue',\n svelte: '/svelte',\n}\n\nfunction createRegistry(framework: Framework): Record<string, ComponentMeta> {\n const basePath = FRAMEWORK_PATHS[framework]\n\n return {\n Note: { exports: ['Note'], path: basePath },\n Card: { exports: ['Card'], path: basePath },\n CardGroup: { exports: ['CardGroup'], path: basePath },\n Accordion: { exports: ['Accordion'], path: basePath },\n AccordionGroup: { exports: ['AccordionGroup'], path: basePath },\n Stepper: { exports: ['Stepper', 'StepperItem'], path: basePath },\n Kbd: { exports: ['Kbd'], path: basePath },\n Tooltip: { exports: ['Tooltip'], path: basePath },\n Youtube: { exports: ['Youtube'], path: basePath },\n Button: { exports: ['Button'], path: basePath },\n DocuLink: { exports: ['DocuLink'], path: basePath },\n DocuImage: { exports: ['DocuImage'], path: basePath },\n Files: { exports: ['Files'], path: basePath },\n Folder: { exports: ['Folder'], path: basePath },\n File: { exports: ['File'], path: basePath },\n Release: { exports: ['Release'], path: basePath },\n Changes: { exports: ['Changes'], path: basePath },\n Pre: { exports: ['Pre'], path: basePath },\n Copy: { exports: ['Copy'], path: basePath },\n DocuBookProvider: { exports: ['DocuBookProvider'], path: basePath },\n }\n}\n\nexport function getComponentRegistry(framework: Framework = 'react'): Record<string, ComponentMeta> {\n return createRegistry(framework)\n}\n\nexport function buildComponentDetectionRegex(framework: Framework = 'react'): RegExp {\n const registry = getComponentRegistry(framework)\n const names = Object.keys(registry)\n return new RegExp(`<(${names.join('|')})(?=[\\\\s/>])`, 'g')\n}\n","import type { Options, Framework } from '../types'\nimport { getComponentRegistry, buildComponentDetectionRegex } from './registry'\n\nconst DEFAULT_IMPORT_SOURCE = 'unplugin-docubook/components'\nconst DEFAULT_FRAMEWORK: Framework = 'react'\n\nexport function detectComponents(code: string, framework: Framework = DEFAULT_FRAMEWORK): string[] {\n const regex = buildComponentDetectionRegex(framework)\n const registry = getComponentRegistry(framework)\n const found = new Set<string>()\n let match: RegExpExecArray | null\n\n while ((match = regex.exec(code)) !== null) {\n const name = match[1]\n if (name && registry[name]) {\n found.add(name)\n }\n }\n\n return Array.from(found)\n}\n\nexport function generateImports(\n componentNames: string[],\n importSource: string,\n framework: Framework = DEFAULT_FRAMEWORK,\n): string {\n const registry = getComponentRegistry(framework)\n const pathToExports = new Map<string, Set<string>>()\n\n for (const name of componentNames) {\n const meta = registry[name]\n if (!meta) continue\n\n const fullPath = `${importSource}${meta.path}`\n if (!pathToExports.has(fullPath)) {\n pathToExports.set(fullPath, new Set())\n }\n for (const exp of meta.exports) {\n pathToExports.get(fullPath)!.add(exp)\n }\n }\n\n const lines: string[] = []\n for (const [path, exports] of pathToExports) {\n const names = Array.from(exports).sort().join(', ')\n lines.push(`import { ${names} } from '${path}'`)\n }\n\n return lines.join('\\n')\n}\n\nexport function transformMdx(\n code: string,\n options: Options = {},\n): { code: string; hasTransformed: boolean } {\n const framework = options.framework ?? DEFAULT_FRAMEWORK\n const usedComponents = detectComponents(code, framework)\n\n if (usedComponents.length === 0) {\n return { code, hasTransformed: false }\n }\n\n const importSource = options.importSource ?? DEFAULT_IMPORT_SOURCE\n const importStatements = generateImports(usedComponents, importSource, framework)\n\n return {\n code: `${importStatements}\\n\\n${code}`,\n hasTransformed: true,\n }\n}\n"],"mappings":";AAAA,SAAS,4BAA4B;;;ACErC,SAAS,sBAAsB;;;ACK/B,IAAM,kBAA6C;AAAA,EAC/C,OAAO;AAAA,EACP,KAAK;AAAA,EACL,QAAQ;AACZ;AAEA,SAAS,eAAe,WAAqD;AACzE,QAAM,WAAW,gBAAgB,SAAS;AAE1C,SAAO;AAAA,IACH,MAAM,EAAE,SAAS,C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UAAM,KAAK,YAAY,KAAK,YAAY,IAAI,GAAG;AAAA,EACnD;AAEA,SAAO,MAAM,KAAK,IAAI;AAC1B;AAEO,SAAS,aACZ,MACA,UAAmB,CAAC,GACqB;AAvD7C;AAwDI,QAAM,aAAY,aAAQ,cAAR,YAAqB;AACvC,QAAM,iBAAiB,iBAAiB,MAAM,SAAS;AAEvD,MAAI,eAAe,WAAW,GAAG;AAC7B,WAAO,EAAE,MAAM,gBAAgB,MAAM;AAAA,EACzC;AAEA,QAAM,gBAAe,aAAQ,iBAAR,YAAwB;AAC7C,QAAM,mBAAmB,gBAAgB,gBAAgB,cAAc,SAAS;AAEhF,SAAO;AAAA,IACH,MAAM,GAAG,gBAAgB;AAAA;AAAA,EAAO,IAAI;AAAA,IACpC,gBAAgB;AAAA,EACpB;AACJ;;;AFjEO,IAAM,kBAAwD,CACjE,aACE;AAAA,EACF,MAAM;AAAA,EAEN,iBAAiB,IAAI;AAEjB,WAAO,UAAU,KAAK,EAAE;AAAA,EAC5B;AAAA,EAEA,UAAU,MAAM,KAAK;AACjB,UAAM,SAAS,aAAa,MAAM,OAAO;AACzC,QAAI,CAAC,OAAO,eAAgB;AAC5B,WAAO,OAAO;AAAA,EAClB;AACJ;;;ADjBA,IAAO,mBAAQ,qBAAqB,eAAe;","names":[]}
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/rollup.ts
21
+ var rollup_exports = {};
22
+ __export(rollup_exports, {
23
+ default: () => rollup_default
24
+ });
25
+ module.exports = __toCommonJS(rollup_exports);
26
+ var import_unplugin2 = require("unplugin");
27
+
28
+ // src/index.ts
29
+ var import_unplugin = require("unplugin");
30
+
31
+ // src/core/registry.ts
32
+ var FRAMEWORK_PATHS = {
33
+ react: "/react",
34
+ vue: "/vue",
35
+ svelte: "/svelte"
36
+ };
37
+ function createRegistry(framework) {
38
+ const basePath = FRAMEWORK_PATHS[framework];
39
+ return {
40
+ Note: { exports: ["Note"], path: basePath },
41
+ Card: { exports: ["Card"], path: basePath },
42
+ CardGroup: { exports: ["CardGroup"], path: basePath },
43
+ Accordion: { exports: ["Accordion"], path: basePath },
44
+ AccordionGroup: { exports: ["AccordionGroup"], path: basePath },
45
+ Stepper: { exports: ["Stepper", "StepperItem"], path: basePath },
46
+ Kbd: { exports: ["Kbd"], path: basePath },
47
+ Tooltip: { exports: ["Tooltip"], path: basePath },
48
+ Youtube: { exports: ["Youtube"], path: basePath },
49
+ Button: { exports: ["Button"], path: basePath },
50
+ DocuLink: { exports: ["DocuLink"], path: basePath },
51
+ DocuImage: { exports: ["DocuImage"], path: basePath },
52
+ Files: { exports: ["Files"], path: basePath },
53
+ Folder: { exports: ["Folder"], path: basePath },
54
+ File: { exports: ["File"], path: basePath },
55
+ Release: { exports: ["Release"], path: basePath },
56
+ Changes: { exports: ["Changes"], path: basePath },
57
+ Pre: { exports: ["Pre"], path: basePath },
58
+ Copy: { exports: ["Copy"], path: basePath },
59
+ DocuBookProvider: { exports: ["DocuBookProvider"], path: basePath }
60
+ };
61
+ }
62
+ function getComponentRegistry(framework = "react") {
63
+ return createRegistry(framework);
64
+ }
65
+ function buildComponentDetectionRegex(framework = "react") {
66
+ const registry = getComponentRegistry(framework);
67
+ const names = Object.keys(registry);
68
+ return new RegExp(`<(${names.join("|")})(?=[\\s/>])`, "g");
69
+ }
70
+
71
+ // src/core/transform.ts
72
+ var DEFAULT_IMPORT_SOURCE = "unplugin-docubook/components";
73
+ var DEFAULT_FRAMEWORK = "react";
74
+ function detectComponents(code, framework = DEFAULT_FRAMEWORK) {
75
+ const regex = buildComponentDetectionRegex(framework);
76
+ const registry = getComponentRegistry(framework);
77
+ const found = /* @__PURE__ */ new Set();
78
+ let match;
79
+ while ((match = regex.exec(code)) !== null) {
80
+ const name = match[1];
81
+ if (name && registry[name]) {
82
+ found.add(name);
83
+ }
84
+ }
85
+ return Array.from(found);
86
+ }
87
+ function generateImports(componentNames, importSource, framework = DEFAULT_FRAMEWORK) {
88
+ const registry = getComponentRegistry(framework);
89
+ const pathToExports = /* @__PURE__ */ new Map();
90
+ for (const name of componentNames) {
91
+ const meta = registry[name];
92
+ if (!meta) continue;
93
+ const fullPath = `${importSource}${meta.path}`;
94
+ if (!pathToExports.has(fullPath)) {
95
+ pathToExports.set(fullPath, /* @__PURE__ */ new Set());
96
+ }
97
+ for (const exp of meta.exports) {
98
+ pathToExports.get(fullPath).add(exp);
99
+ }
100
+ }
101
+ const lines = [];
102
+ for (const [path, exports2] of pathToExports) {
103
+ const names = Array.from(exports2).sort().join(", ");
104
+ lines.push(`import { ${names} } from '${path}'`);
105
+ }
106
+ return lines.join("\n");
107
+ }
108
+ function transformMdx(code, options = {}) {
109
+ var _a, _b;
110
+ const framework = (_a = options.framework) != null ? _a : DEFAULT_FRAMEWORK;
111
+ const usedComponents = detectComponents(code, framework);
112
+ if (usedComponents.length === 0) {
113
+ return { code, hasTransformed: false };
114
+ }
115
+ const importSource = (_b = options.importSource) != null ? _b : DEFAULT_IMPORT_SOURCE;
116
+ const importStatements = generateImports(usedComponents, importSource, framework);
117
+ return {
118
+ code: `${importStatements}
119
+
120
+ ${code}`,
121
+ hasTransformed: true
122
+ };
123
+ }
124
+
125
+ // src/index.ts
126
+ var unpluginFactory = (options) => ({
127
+ name: "unplugin-docubook",
128
+ transformInclude(id) {
129
+ return /\.mdx?$/.test(id);
130
+ },
131
+ transform(code, _id) {
132
+ const result = transformMdx(code, options);
133
+ if (!result.hasTransformed) return;
134
+ return result.code;
135
+ }
136
+ });
137
+
138
+ // src/rollup.ts
139
+ var rollup_default = (0, import_unplugin2.createRollupPlugin)(unpluginFactory);
140
+ //# sourceMappingURL=rollup.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/rollup.ts","../src/index.ts","../src/core/registry.ts","../src/core/transform.ts"],"sourcesContent":["import { createRollupPlugin } from 'unplugin'\nimport { unpluginFactory } from '.'\n\nexport default createRollupPlugin(unpluginFactory)\n","import type { UnpluginFactory } from 'unplugin'\nimport type { Options } from './types'\nimport { createUnplugin } from 'unplugin'\nimport { transformMdx } from './core/transform'\n\nexport const unpluginFactory: UnpluginFactory<Options | undefined> = (\n options,\n) => ({\n name: 'unplugin-docubook',\n\n transformInclude(id) {\n // Only process .mdx and .md files\n return /\\.mdx?$/.test(id)\n },\n\n transform(code, _id) {\n const result = transformMdx(code, options)\n if (!result.hasTransformed) return\n return result.code\n },\n})\n\nexport const unplugin = /* #__PURE__ */ createUnplugin(unpluginFactory)\n\nexport default unplugin\n","import type { Framework } from '../types'\n\nexport interface ComponentMeta {\n exports: string[]\n path: string\n}\n\nconst FRAMEWORK_PATHS: Record<Framework, string> = {\n react: '/react',\n vue: '/vue',\n svelte: '/svelte',\n}\n\nfunction createRegistry(framework: Framework): Record<string, ComponentMeta> {\n const basePath = FRAMEWORK_PATHS[framework]\n\n return {\n Note: { exports: ['Note'], path: basePath },\n Card: { exports: ['Card'], path: basePath },\n CardGroup: { exports: ['CardGroup'], path: basePath },\n Accordion: { exports: ['Accordion'], path: basePath },\n AccordionGroup: { exports: ['AccordionGroup'], path: basePath },\n Stepper: { exports: ['Stepper', 'StepperItem'], path: basePath },\n Kbd: { exports: ['Kbd'], path: basePath },\n Tooltip: { exports: ['Tooltip'], path: basePath },\n Youtube: { exports: ['Youtube'], path: basePath },\n Button: { exports: ['Button'], path: basePath },\n DocuLink: { exports: ['DocuLink'], path: basePath },\n DocuImage: { exports: ['DocuImage'], path: basePath },\n Files: { exports: ['Files'], path: basePath },\n Folder: { exports: ['Folder'], path: basePath },\n File: { exports: ['File'], path: basePath },\n Release: { exports: ['Release'], path: basePath },\n Changes: { exports: ['Changes'], path: basePath },\n Pre: { exports: ['Pre'], path: basePath },\n Copy: { exports: ['Copy'], path: basePath },\n DocuBookProvider: { exports: ['DocuBookProvider'], path: basePath },\n }\n}\n\nexport function getComponentRegistry(framework: Framework = 'react'): Record<string, ComponentMeta> {\n return createRegistry(framework)\n}\n\nexport function buildComponentDetectionRegex(framework: Framework = 'react'): RegExp {\n const registry = getComponentRegistry(framework)\n const names = Object.keys(registry)\n return new RegExp(`<(${names.join('|')})(?=[\\\\s/>])`, 'g')\n}\n","import type { Options, Framework } from '../types'\nimport { getComponentRegistry, buildComponentDetectionRegex } from './registry'\n\nconst DEFAULT_IMPORT_SOURCE = 'unplugin-docubook/components'\nconst DEFAULT_FRAMEWORK: Framework = 'react'\n\nexport function detectComponents(code: string, framework: Framework = DEFAULT_FRAMEWORK): string[] {\n const regex = buildComponentDetectionRegex(framework)\n const registry = getComponentRegistry(framework)\n const found = new Set<string>()\n let match: RegExpExecArray | null\n\n while ((match = regex.exec(code)) !== null) {\n const name = match[1]\n if (name && registry[name]) {\n found.add(name)\n }\n }\n\n return Array.from(found)\n}\n\nexport function generateImports(\n componentNames: string[],\n importSource: string,\n framework: Framework = DEFAULT_FRAMEWORK,\n): string {\n const registry = getComponentRegistry(framework)\n const pathToExports = new Map<string, Set<string>>()\n\n for (const name of componentNames) {\n const meta = registry[name]\n if (!meta) continue\n\n const fullPath = `${importSource}${meta.path}`\n if (!pathToExports.has(fullPath)) {\n pathToExports.set(fullPath, new Set())\n }\n for (const exp of meta.exports) {\n pathToExports.get(fullPath)!.add(exp)\n }\n }\n\n const lines: string[] = []\n for (const [path, exports] of pathToExports) {\n const names = Array.from(exports).sort().join(', ')\n lines.push(`import { ${names} } from '${path}'`)\n }\n\n return lines.join('\\n')\n}\n\nexport function transformMdx(\n code: string,\n options: Options = {},\n): { code: string; hasTransformed: boolean } {\n const framework = options.framework ?? DEFAULT_FRAMEWORK\n const usedComponents = detectComponents(code, framework)\n\n if (usedComponents.length === 0) {\n return { code, hasTransformed: false }\n }\n\n const importSource = options.importSource ?? DEFAULT_IMPORT_SOURCE\n const importStatements = generateImports(usedComponents, importSource, framework)\n\n return {\n code: `${importStatements}\\n\\n${code}`,\n hasTransformed: true,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,mBAAmC;;;ACEnC,sBAA+B;;;ACK/B,IAAM,kBAA6C;AAAA,EAC/C,OAAO;AAAA,EACP,KAAK;AAAA,EACL,QAAQ;AACZ;AAEA,SAAS,eAAe,WAAqD;AACzE,QAAM,WAAW,gBAAgB,SAAS;AAE1C,SAAO;AAAA,IACH,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,SAAS;AAAA,IAC1C,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,SAAS;AAAA,IAC1C,WAAW,EAAE,SAAS,CAAC,WAAW,GAAG,MAAM,SAAS;AAAA,IACpD,WAAW,EAAE,SAAS,CAAC,WAAW,GAAG,MAAM,SAAS;AAAA,IACpD,gBAAgB,EAAE,SAAS,CAAC,gBAAgB,GAAG,MAAM,SAAS;AAAA,IAC9D,SAAS,EAAE,SAAS,CAAC,WAAW,aAAa,GAAG,MAAM,SAAS;AAAA,IAC/D,KAAK,EAAE,SAAS,CAAC,KAAK,GAAG,MAAM,SAAS;AAAA,IACxC,SAAS,EAAE,SAAS,CAAC,SAAS,GAAG,MAAM,SAAS;AAAA,IAChD,SAAS,EAAE,SAAS,CAAC,SAAS,GAAG,MAAM,SAAS;AAAA,IAChD,QAAQ,EAA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ACF,MAAM;AAAA,EAEN,iBAAiB,IAAI;AAEjB,WAAO,UAAU,KAAK,EAAE;AAAA,EAC5B;AAAA,EAEA,UAAU,MAAM,KAAK;AACjB,UAAM,SAAS,aAAa,MAAM,OAAO;AACzC,QAAI,CAAC,OAAO,eAAgB;AAC5B,WAAO,OAAO;AAAA,EAClB;AACJ;;;ADjBA,IAAO,qBAAQ,qCAAmB,eAAe;","names":["import_unplugin","exports"]}
package/dist/rollup.js CHANGED
@@ -1,9 +1,119 @@
1
- import { n as unpluginFactory } from "./src-KZV_M01u.js";
1
+ // src/rollup.ts
2
2
  import { createRollupPlugin } from "unplugin";
3
3
 
4
- //#region src/rollup.ts
5
- var rollup_default = createRollupPlugin(unpluginFactory);
4
+ // src/index.ts
5
+ import { createUnplugin } from "unplugin";
6
+
7
+ // src/core/registry.ts
8
+ var FRAMEWORK_PATHS = {
9
+ react: "/react",
10
+ vue: "/vue",
11
+ svelte: "/svelte"
12
+ };
13
+ function createRegistry(framework) {
14
+ const basePath = FRAMEWORK_PATHS[framework];
15
+ return {
16
+ Note: { exports: ["Note"], path: basePath },
17
+ Card: { exports: ["Card"], path: basePath },
18
+ CardGroup: { exports: ["CardGroup"], path: basePath },
19
+ Accordion: { exports: ["Accordion"], path: basePath },
20
+ AccordionGroup: { exports: ["AccordionGroup"], path: basePath },
21
+ Stepper: { exports: ["Stepper", "StepperItem"], path: basePath },
22
+ Kbd: { exports: ["Kbd"], path: basePath },
23
+ Tooltip: { exports: ["Tooltip"], path: basePath },
24
+ Youtube: { exports: ["Youtube"], path: basePath },
25
+ Button: { exports: ["Button"], path: basePath },
26
+ DocuLink: { exports: ["DocuLink"], path: basePath },
27
+ DocuImage: { exports: ["DocuImage"], path: basePath },
28
+ Files: { exports: ["Files"], path: basePath },
29
+ Folder: { exports: ["Folder"], path: basePath },
30
+ File: { exports: ["File"], path: basePath },
31
+ Release: { exports: ["Release"], path: basePath },
32
+ Changes: { exports: ["Changes"], path: basePath },
33
+ Pre: { exports: ["Pre"], path: basePath },
34
+ Copy: { exports: ["Copy"], path: basePath },
35
+ DocuBookProvider: { exports: ["DocuBookProvider"], path: basePath }
36
+ };
37
+ }
38
+ function getComponentRegistry(framework = "react") {
39
+ return createRegistry(framework);
40
+ }
41
+ function buildComponentDetectionRegex(framework = "react") {
42
+ const registry = getComponentRegistry(framework);
43
+ const names = Object.keys(registry);
44
+ return new RegExp(`<(${names.join("|")})(?=[\\s/>])`, "g");
45
+ }
46
+
47
+ // src/core/transform.ts
48
+ var DEFAULT_IMPORT_SOURCE = "unplugin-docubook/components";
49
+ var DEFAULT_FRAMEWORK = "react";
50
+ function detectComponents(code, framework = DEFAULT_FRAMEWORK) {
51
+ const regex = buildComponentDetectionRegex(framework);
52
+ const registry = getComponentRegistry(framework);
53
+ const found = /* @__PURE__ */ new Set();
54
+ let match;
55
+ while ((match = regex.exec(code)) !== null) {
56
+ const name = match[1];
57
+ if (name && registry[name]) {
58
+ found.add(name);
59
+ }
60
+ }
61
+ return Array.from(found);
62
+ }
63
+ function generateImports(componentNames, importSource, framework = DEFAULT_FRAMEWORK) {
64
+ const registry = getComponentRegistry(framework);
65
+ const pathToExports = /* @__PURE__ */ new Map();
66
+ for (const name of componentNames) {
67
+ const meta = registry[name];
68
+ if (!meta) continue;
69
+ const fullPath = `${importSource}${meta.path}`;
70
+ if (!pathToExports.has(fullPath)) {
71
+ pathToExports.set(fullPath, /* @__PURE__ */ new Set());
72
+ }
73
+ for (const exp of meta.exports) {
74
+ pathToExports.get(fullPath).add(exp);
75
+ }
76
+ }
77
+ const lines = [];
78
+ for (const [path, exports] of pathToExports) {
79
+ const names = Array.from(exports).sort().join(", ");
80
+ lines.push(`import { ${names} } from '${path}'`);
81
+ }
82
+ return lines.join("\n");
83
+ }
84
+ function transformMdx(code, options = {}) {
85
+ var _a, _b;
86
+ const framework = (_a = options.framework) != null ? _a : DEFAULT_FRAMEWORK;
87
+ const usedComponents = detectComponents(code, framework);
88
+ if (usedComponents.length === 0) {
89
+ return { code, hasTransformed: false };
90
+ }
91
+ const importSource = (_b = options.importSource) != null ? _b : DEFAULT_IMPORT_SOURCE;
92
+ const importStatements = generateImports(usedComponents, importSource, framework);
93
+ return {
94
+ code: `${importStatements}
6
95
 
7
- //#endregion
8
- export { rollup_default as default };
96
+ ${code}`,
97
+ hasTransformed: true
98
+ };
99
+ }
100
+
101
+ // src/index.ts
102
+ var unpluginFactory = (options) => ({
103
+ name: "unplugin-docubook",
104
+ transformInclude(id) {
105
+ return /\.mdx?$/.test(id);
106
+ },
107
+ transform(code, _id) {
108
+ const result = transformMdx(code, options);
109
+ if (!result.hasTransformed) return;
110
+ return result.code;
111
+ }
112
+ });
113
+
114
+ // src/rollup.ts
115
+ var rollup_default = createRollupPlugin(unpluginFactory);
116
+ export {
117
+ rollup_default as default
118
+ };
9
119
  //# sourceMappingURL=rollup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rollup.js","names":[],"sources":["../src/rollup.ts"],"sourcesContent":["import { createRollupPlugin } from 'unplugin'\nimport { unpluginFactory } from '.'\n\nexport default createRollupPlugin(unpluginFactory)\n"],"mappings":";;;;AAGA,qBAAe,mBAAmB,gBAAgB"}
1
+ {"version":3,"sources":["../src/rollup.ts","../src/index.ts","../src/core/registry.ts","../src/core/transform.ts"],"sourcesContent":["import { createRollupPlugin } from 'unplugin'\nimport { unpluginFactory } from '.'\n\nexport default createRollupPlugin(unpluginFactory)\n","import type { UnpluginFactory } from 'unplugin'\nimport type { Options } from './types'\nimport { createUnplugin } from 'unplugin'\nimport { transformMdx } from './core/transform'\n\nexport const unpluginFactory: UnpluginFactory<Options | undefined> = (\n options,\n) => ({\n name: 'unplugin-docubook',\n\n transformInclude(id) {\n // Only process .mdx and .md files\n return /\\.mdx?$/.test(id)\n },\n\n transform(code, _id) {\n const result = transformMdx(code, options)\n if (!result.hasTransformed) return\n return result.code\n },\n})\n\nexport const unplugin = /* #__PURE__ */ createUnplugin(unpluginFactory)\n\nexport default unplugin\n","import type { Framework } from '../types'\n\nexport interface ComponentMeta {\n exports: string[]\n path: string\n}\n\nconst FRAMEWORK_PATHS: Record<Framework, string> = {\n react: '/react',\n vue: '/vue',\n svelte: '/svelte',\n}\n\nfunction createRegistry(framework: Framework): Record<string, ComponentMeta> {\n const basePath = FRAMEWORK_PATHS[framework]\n\n return {\n Note: { exports: ['Note'], path: basePath },\n Card: { exports: ['Card'], path: basePath },\n CardGroup: { exports: ['CardGroup'], path: basePath },\n Accordion: { exports: ['Accordion'], path: basePath },\n AccordionGroup: { exports: ['AccordionGroup'], path: basePath },\n Stepper: { exports: ['Stepper', 'StepperItem'], path: basePath },\n Kbd: { exports: ['Kbd'], path: basePath },\n Tooltip: { exports: ['Tooltip'], path: basePath },\n Youtube: { exports: ['Youtube'], path: basePath },\n Button: { exports: ['Button'], path: basePath },\n DocuLink: { exports: ['DocuLink'], path: basePath },\n DocuImage: { exports: ['DocuImage'], path: basePath },\n Files: { exports: ['Files'], path: basePath },\n Folder: { exports: ['Folder'], path: basePath },\n File: { exports: ['File'], path: basePath },\n Release: { exports: ['Release'], path: basePath },\n Changes: { exports: ['Changes'], path: basePath },\n Pre: { exports: ['Pre'], path: basePath },\n Copy: { exports: ['Copy'], path: basePath },\n DocuBookProvider: { exports: ['DocuBookProvider'], path: basePath },\n }\n}\n\nexport function getComponentRegistry(framework: Framework = 'react'): Record<string, ComponentMeta> {\n return createRegistry(framework)\n}\n\nexport function buildComponentDetectionRegex(framework: Framework = 'react'): RegExp {\n const registry = getComponentRegistry(framework)\n const names = Object.keys(registry)\n return new RegExp(`<(${names.join('|')})(?=[\\\\s/>])`, 'g')\n}\n","import type { Options, Framework } from '../types'\nimport { getComponentRegistry, buildComponentDetectionRegex } from './registry'\n\nconst DEFAULT_IMPORT_SOURCE = 'unplugin-docubook/components'\nconst DEFAULT_FRAMEWORK: Framework = 'react'\n\nexport function detectComponents(code: string, framework: Framework = DEFAULT_FRAMEWORK): string[] {\n const regex = buildComponentDetectionRegex(framework)\n const registry = getComponentRegistry(framework)\n const found = new Set<string>()\n let match: RegExpExecArray | null\n\n while ((match = regex.exec(code)) !== null) {\n const name = match[1]\n if (name && registry[name]) {\n found.add(name)\n }\n }\n\n return Array.from(found)\n}\n\nexport function generateImports(\n componentNames: string[],\n importSource: string,\n framework: Framework = DEFAULT_FRAMEWORK,\n): string {\n const registry = getComponentRegistry(framework)\n const pathToExports = new Map<string, Set<string>>()\n\n for (const name of componentNames) {\n const meta = registry[name]\n if (!meta) continue\n\n const fullPath = `${importSource}${meta.path}`\n if (!pathToExports.has(fullPath)) {\n pathToExports.set(fullPath, new Set())\n }\n for (const exp of meta.exports) {\n pathToExports.get(fullPath)!.add(exp)\n }\n }\n\n const lines: string[] = []\n for (const [path, exports] of pathToExports) {\n const names = Array.from(exports).sort().join(', ')\n lines.push(`import { ${names} } from '${path}'`)\n }\n\n return lines.join('\\n')\n}\n\nexport function transformMdx(\n code: string,\n options: Options = {},\n): { code: string; hasTransformed: boolean } {\n const framework = options.framework ?? DEFAULT_FRAMEWORK\n const usedComponents = detectComponents(code, framework)\n\n if (usedComponents.length === 0) {\n return { code, hasTransformed: false }\n }\n\n const importSource = options.importSource ?? DEFAULT_IMPORT_SOURCE\n const importStatements = generateImports(usedComponents, importSource, framework)\n\n return {\n code: `${importStatements}\\n\\n${code}`,\n hasTransformed: true,\n }\n}\n"],"mappings":";AAAA,SAAS,0BAA0B;;;ACEnC,SAAS,sBAAsB;;;ACK/B,IAAM,kBAA6C;AAAA,EAC/C,OAAO;AAAA,EACP,KAAK;AAAA,EACL,QAAQ;AACZ;AAEA,SAAS,eAAe,WAAqD;AACzE,QAAM,WAAW,gBAAgB,SAAS;AAE1C,SAAO;AAAA,IACH,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,SAAS;AAAA,IAC1C,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,SAAS;AAAA,IAC1C,WAAW,EAAE,SAAS,CAAC,WAAW,GAAG,MAAM,SAAS;AAAA,IACp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