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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-lib-tools",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "type": "module",
5
5
  "author": "Brian Vaughn <brian.david.vaughn@gmail.com> (https://github.com/bvaughn/)",
6
6
  "contributors": [
@@ -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
- compilerOptions: compilerOptionsParam,
14
- componentNames,
15
- imperativeHandleNames,
14
+ analyserOptions: analyserOptionsParam,
15
+ componentNames = [],
16
+ imperativeHandleNames = [],
16
17
  outputDirName = "docs"
17
18
  }: {
18
- compilerOptions?: Partial<CompilerOptions>;
19
- componentNames: string[];
20
- imperativeHandleNames: string[];
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
- ...compilerOptionsParam
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
- compilerOptions,
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) => file.endsWith(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 { parseFromProject, type InterfaceNode } from "@ts-ast-parser/core";
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
- compilerOptions,
11
+ analyserOptions,
9
12
  names,
10
13
  outputDirName
11
14
  }: {
12
- compilerOptions: Partial<CompilerOptions>;
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({ compilerOptions });
21
+ const result = await parseFromProject(analyserOptions);
19
22
  const reflectedModules = result.project?.getModules() ?? [];
20
23
 
21
24
  const nodes: {
package/styles.css CHANGED
@@ -106,6 +106,7 @@ code {
106
106
  .tok-operator {
107
107
  color: var(--color-slate-400);
108
108
  }
109
+ .tok-labelName,
109
110
  .tok-propertyName {
110
111
  color: var(--color-sky-300);
111
112
  }