Skip to content

Commit

Permalink
Upgrade unbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
joshwooding committed Oct 6, 2023
1 parent 2d5877e commit 7abc609
Show file tree
Hide file tree
Showing 7 changed files with 441 additions and 695 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@types/react": "^18.0.0",
"react": "^18.0.0",
"typescript": "^4.3.0",
"unbuild": "^1.0.2",
"unbuild": "^2.0.0",
"vite": "^5.0.0-beta.1",
"vitest": "^0.25.8"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/vite-plugin-react-docgen-typescript/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as path from "path";
import { isAbsolute, join } from "node:path";
import glob from "glob-promise";
import { type FileParser } from "react-docgen-typescript";
import { type Plugin } from "vite";
Expand Down Expand Up @@ -53,9 +53,9 @@ const getProgram = async (config: Options, oldProgram?: any) => {
const files = (config.include ?? ["**/**.tsx"])
.map((filePath) =>
glob.sync(
path.isAbsolute(filePath)
isAbsolute(filePath)
? filePath
: path.join(process.cwd(), filePath),
: join(process.cwd(), filePath),
),
)
.reduce((carry, files) => carry.concat(files), []);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropFilter } from "react-docgen-typescript/lib/parser";
import type { PropFilter } from "react-docgen-typescript/lib/parser";

export const defaultPropFilter: PropFilter = (prop) => {
return !prop.parent?.fileName.includes("node_modules");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import MagicString, { SourceMap } from "magic-string";
import type { ComponentDoc, PropItem } from "react-docgen-typescript";
import * as ts from "typescript";
import ts from "typescript";

export interface GeneratorOptions {
filename: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as docGen from "react-docgen-typescript";
import type * as ts from "typescript";
import type { ParserOptions } from "react-docgen-typescript";
import type { CompilerOptions } from "typescript";
import { GeneratorOptions } from "./generate";

interface LoaderOptions {
Expand Down Expand Up @@ -35,10 +35,10 @@ interface TypescriptOptions {
**/
tsconfigPath?: string;
/** Specify TypeScript compiler options. Can not be used with tsconfigPath. */
compilerOptions?: ts.CompilerOptions;
compilerOptions?: CompilerOptions;
}

export type DocGenOptions = docGen.ParserOptions & {
export type DocGenOptions = ParserOptions & {
/** Glob patterns to ignore */
exclude?: string[];
/** Glob patterns to include. defaults to ts|tsx */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import * as path from "path";
import * as ts from "typescript";
import { dirname } from "node:path";
import ts from "typescript";

/** Get the contents of the tsconfig in the system */

export function getTSConfigFile(
tsconfigPath: string,
): Partial<ts.ParsedCommandLine> {
try {
const basePath = path.dirname(tsconfigPath);
const basePath = dirname(tsconfigPath);
const configFile = ts.readConfigFile(tsconfigPath, ts.sys.readFile);

return ts.parseJsonConfigFileContent(
Expand Down
Loading

0 comments on commit 7abc609

Please sign in to comment.