react-lib-tools 0.0.11 → 0.0.12
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/dist/GettingStartedRoute-Da-KZIf6.cjs +2 -0
- package/dist/GettingStartedRoute-Da-KZIf6.cjs.map +1 -0
- package/dist/GettingStartedRoute-n1iZy0On.js +38 -0
- package/dist/GettingStartedRoute-n1iZy0On.js.map +1 -0
- package/dist/PageNotFound-BbBqPkkF.js +24 -0
- package/dist/PageNotFound-BbBqPkkF.js.map +1 -0
- package/dist/PageNotFound-BhQMB2FT.cjs +2 -0
- package/dist/PageNotFound-BhQMB2FT.cjs.map +1 -0
- package/dist/SupportRoute-CmcE6ZZa.cjs +2 -0
- package/dist/SupportRoute-CmcE6ZZa.cjs.map +1 -0
- package/dist/SupportRoute-DuPMzYIe.js +44 -0
- package/dist/SupportRoute-DuPMzYIe.js.map +1 -0
- package/dist/index-BiL6y7tb.cjs +8 -0
- package/dist/index-BiL6y7tb.cjs.map +1 -0
- package/dist/index-CUStiGoe.js +9403 -0
- package/dist/index-CUStiGoe.js.map +1 -0
- package/dist/react-lib-tools.cjs +1 -7
- package/dist/react-lib-tools.cjs.map +1 -1
- package/dist/react-lib-tools.d.ts +26 -1
- package/dist/react-lib-tools.js +25 -9388
- package/dist/react-lib-tools.js.map +1 -1
- package/package.json +1 -1
- package/scripts/compile-docs.ts +16 -9
- package/scripts/utils/docs/compileComponents.ts +3 -1
- package/scripts/utils/docs/compileImperativeHandles.ts +8 -5
- package/styles.css +1 -0
package/package.json
CHANGED
package/scripts/compile-docs.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AnalyserOptions } from "@ts-ast-parser/core";
|
|
1
2
|
import { compileComponents } from "./utils/docs/compileComponents.ts";
|
|
2
3
|
import { compileImperativeHandles } from "./utils/docs/compileImperativeHandles.ts";
|
|
3
4
|
import type { CompilerOptions } from "typescript";
|
|
@@ -10,19 +11,25 @@ import {
|
|
|
10
11
|
} from "typescript";
|
|
11
12
|
|
|
12
13
|
export async function compileDocs({
|
|
13
|
-
|
|
14
|
-
componentNames,
|
|
15
|
-
imperativeHandleNames,
|
|
14
|
+
analyserOptions: analyserOptionsParam,
|
|
15
|
+
componentNames = [],
|
|
16
|
+
imperativeHandleNames = [],
|
|
16
17
|
outputDirName = "docs"
|
|
17
18
|
}: {
|
|
18
|
-
|
|
19
|
-
componentNames
|
|
20
|
-
imperativeHandleNames
|
|
19
|
+
analyserOptions?: Partial<AnalyserOptions>;
|
|
20
|
+
componentNames?: string[] | undefined;
|
|
21
|
+
imperativeHandleNames?: string[] | undefined;
|
|
21
22
|
outputDirName?: string | undefined;
|
|
22
23
|
}) {
|
|
23
|
-
const compilerOptions = {
|
|
24
|
+
const compilerOptions: Partial<CompilerOptions> = {
|
|
24
25
|
...defaultCompilerOptions,
|
|
25
|
-
...
|
|
26
|
+
...(analyserOptionsParam?.compilerOptions as CompilerOptions)
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const analyserOptions: Partial<AnalyserOptions> = {
|
|
30
|
+
...analyserOptionsParam,
|
|
31
|
+
compilerOptions,
|
|
32
|
+
include: ["lib"]
|
|
26
33
|
};
|
|
27
34
|
|
|
28
35
|
await compileComponents({
|
|
@@ -32,7 +39,7 @@ export async function compileDocs({
|
|
|
32
39
|
});
|
|
33
40
|
|
|
34
41
|
await compileImperativeHandles({
|
|
35
|
-
|
|
42
|
+
analyserOptions,
|
|
36
43
|
names: imperativeHandleNames,
|
|
37
44
|
outputDirName
|
|
38
45
|
});
|
|
@@ -26,7 +26,9 @@ export async function compileComponents({
|
|
|
26
26
|
const { files, outputDir } = await initialize({
|
|
27
27
|
fileExtensions: [".ts", ".tsx"],
|
|
28
28
|
fileFilter: (file) =>
|
|
29
|
-
componentNames.some((componentName) =>
|
|
29
|
+
componentNames.some((componentName) =>
|
|
30
|
+
file.includes(`${componentName}.ts`)
|
|
31
|
+
),
|
|
30
32
|
inputPath: ["lib", "components"],
|
|
31
33
|
outputDirName
|
|
32
34
|
});
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
parseFromProject,
|
|
3
|
+
type AnalyserOptions,
|
|
4
|
+
type InterfaceNode
|
|
5
|
+
} from "@ts-ast-parser/core";
|
|
2
6
|
import { join } from "node:path";
|
|
3
7
|
import { cwd } from "node:process";
|
|
4
|
-
import type { CompilerOptions } from "typescript";
|
|
5
8
|
import { compileImperativeHandle } from "./compileImperativeHandle.ts";
|
|
6
9
|
|
|
7
10
|
export async function compileImperativeHandles({
|
|
8
|
-
|
|
11
|
+
analyserOptions,
|
|
9
12
|
names,
|
|
10
13
|
outputDirName
|
|
11
14
|
}: {
|
|
12
|
-
|
|
15
|
+
analyserOptions: Partial<AnalyserOptions>;
|
|
13
16
|
names: string[];
|
|
14
17
|
outputDirName: string;
|
|
15
18
|
}) {
|
|
16
19
|
const outputDir = join(cwd(), "public", "generated", outputDirName);
|
|
17
20
|
|
|
18
|
-
const result = await parseFromProject(
|
|
21
|
+
const result = await parseFromProject(analyserOptions);
|
|
19
22
|
const reflectedModules = result.project?.getModules() ?? [];
|
|
20
23
|
|
|
21
24
|
const nodes: {
|