Socket
Socket
Sign inDemoInstall

@jsdocs-io/extractor

Package Overview
Dependencies
85
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0-1 to 1.0.0-2

162

dist/index.d.ts
import { SourceFile, ModuleDeclaration, Project } from 'ts-morph';
import { ResultAsync, Result } from 'neverthrow';
import * as effect_Scope from 'effect/Scope';
import { Effect } from 'effect';
import * as read_pkg from 'read-pkg';
import { NormalizedPackageJson } from 'read-pkg';

@@ -244,49 +246,8 @@ import { DocComment } from '@microsoft/tsdoc';

/**
`ExtractorError` is the union of all possible errors that can happen when
analyzing a package and extracting its API.
*/
type ExtractorError = FsError | InstallPackageError | PackageNameError | PackageJsonError | PackageTypesError | PackageDeclarationsError | ProjectError;
/**
`FsError` is thrown when an operation involving the file system fails.
*/
declare class FsError extends Error {
constructor(message: string, options?: ErrorOptions);
/** @internal */
declare class ProjectError {
readonly cause?: unknown;
readonly _tag = "ProjectError";
constructor(cause?: unknown);
}
/**
`InstallPackageError` is thrown when installing a package fails.
*/
declare class InstallPackageError extends Error {
constructor(message: string, options?: ErrorOptions);
}
/**
`PackageNameError` is thrown when a package name is not valid.
*/
declare class PackageNameError extends Error {
constructor(message: string, options?: ErrorOptions);
}
/**
`PackageJsonError` is thrown when reading `package.json` fails.
*/
declare class PackageJsonError extends Error {
constructor(message: string, options?: ErrorOptions);
}
/**
`PackageTypesError` is thrown when resolving the types entrypoint file fails.
*/
declare class PackageTypesError extends Error {
constructor(message: string, options?: ErrorOptions);
}
/**
`PackageDeclarationsError` is thrown when extracting declarations fails.
*/
declare class PackageDeclarationsError extends Error {
constructor(message: string, options?: ErrorOptions);
}
/**
`ProjectError` is thrown when creating a TypeScript project fails.
*/
declare class ProjectError extends Error {
constructor(message: string, options?: ErrorOptions);
}

@@ -381,6 +342,4 @@ /**

`extractPackageApi` returns a {@link https://github.com/supermacro/neverthrow?tab=readme-ov-file#asynchronous-api-resultasync | `ResultAsync`}
which can be `await`ed to get a {@link https://github.com/supermacro/neverthrow?tab=readme-ov-file#synchronous-api-result | `Result`}.
If the extraction succeeds, the `Result` will be `Ok` and contain the data described in {@link PackageApi}.
Otherwise, the `Result` will be `Err` and contain an {@link ExtractorError}.
If the extraction succeeds, `extractPackageApi` returns a {@link PackageApi} object.
If the extraction fails, `extractPackageApi` throws an error.

@@ -391,15 +350,9 @@ Warning: The extraction process is slow and blocks the main thread, using workers is recommended.

```ts
const result = await extractPackageApi({
pkg: "foo", // Extract API from package `foo` [Required]
subpath: ".", // Select subpath `.` (root subpath) [Optional]
maxDepth: 5, // Maximum depth for analyzing nested namespaces [Optional]
const packageApi = await extractPackageApi({
pkg: "foo", // Extract API from npm package `foo` [Required]
subpath: ".", // Select subpath `.` (root subpath) [Optional]
maxDepth: 5, // Maximum depth for analyzing nested namespaces [Optional]
bunPath: "bun" // Absolute path to the `bun` executable [Optional]
});
if (result.isOk()) {
const packageApi = result.value; // Successfully extracted API
console.log(JSON.stringify(packageApi, null, 2));
} else {
const extractorError = result.error; // Error extracting API
console.error(extractorError);
}
console.log(JSON.stringify(packageApi, null, 2));
```

@@ -409,7 +362,27 @@

@see {@link https://github.com/supermacro/neverthrow/wiki/Accessing-The-Value-Inside-A-Result | Accessing the value inside a Result}
@see {@link https://github.com/supermacro/neverthrow/wiki/Basic-Usage-Examples#asynchronous-api | Result and ResultAsync usage}
@returns A {@link PackageApi} object
*/
declare const extractPackageApi: ({ pkg, subpath, maxDepth, bunPath, }: ExtractPackageApiOptions) => ResultAsync<PackageApi, ExtractorError>;
declare const extractPackageApi: ({ pkg, subpath, maxDepth, bunPath, }: ExtractPackageApiOptions) => Promise<PackageApi>;
/** @internal */
type WorkDir = {
readonly path: string;
readonly close: () => Promise<void>;
};
/** @internal */
declare class WorkDirError {
readonly cause?: unknown;
readonly _tag = "WorkDirError";
constructor(cause?: unknown);
}
/** @internal */
declare const workDir: Effect.Effect<{
path: string;
close: () => Promise<void>;
}, WorkDirError, effect_Scope.Scope>;
/** @internal */
declare class PackageTypesError {
readonly _tag = "PackageTypesError";
}
/**

@@ -419,8 +392,59 @@ `packageTypes` resolves the types entrypoint file (e.g., `index.d.ts`).

@param pkgJson - the contents of `package.json`
@param pkgSubpath - the selected subpath from the `exports` property of `package.json`
@param subpath - the selected subpath from the `exports` property of `package.json`
@internal
*/
declare const packageTypes: (pkgJson: Partial<NormalizedPackageJson>, pkgSubpath: string) => Result<string, PackageTypesError>;
declare const packageTypes: (pkgJson: Partial<NormalizedPackageJson>, subpath: string) => Effect.Effect<string, PackageTypesError, never>;
/** @internal */
declare class PackageNameError {
readonly _tag = "PackageNameError";
}
/** @internal */
declare const packageName: (pkg: string) => Effect.Effect<string, PackageNameError, never>;
/** @internal */
declare class PackageJsonError {
readonly cause?: unknown;
readonly _tag = "PackageJsonError";
constructor(cause?: unknown);
}
/** @internal */
declare const packageJson: (pkgDir: string) => Effect.Effect<read_pkg.NormalizedPackageJson, PackageJsonError, never>;
/** @internal */
declare class PackageDeclarationsError {
readonly cause?: unknown;
readonly _tag = "PackageDeclarationsError";
constructor(cause?: unknown);
}
/** @internal */
type InstallPackageOptions = {
pkg: string;
cwd: string;
bunPath?: string;
};
/** @internal */
declare class InstallPackageError {
readonly cause?: unknown;
readonly _tag = "InstallPackageError";
constructor(cause?: unknown);
}
/** @internal */
declare const installPackage: ({ pkg, cwd, bunPath, }: InstallPackageOptions) => Effect.Effect<string[], InstallPackageError, never>;
/** @internal */
declare const extractPackageApiEffect: ({ pkg, subpath, maxDepth, bunPath, }: ExtractPackageApiOptions) => Effect.Effect<{
name: string;
version: string;
subpath: string;
types: string;
overview: string | undefined;
declarations: ExtractedDeclaration[];
packages: string[];
analyzedAt: string;
analyzedIn: number;
}, ProjectError | InstallPackageError | PackageDeclarationsError | PackageJsonError | PackageNameError | PackageTypesError | WorkDirError, never>;
/**

@@ -437,2 +461,2 @@ `parseDocComment` parses a JSDoc comment using `@microsoft/tsdoc`.

export { type AllExtractedDeclaration, type AllExtractedDeclarationKind, type ExtractDeclarationsOptions, type ExtractPackageApiOptions, type ExtractedClass, type ExtractedClassConstructor, type ExtractedClassMethod, type ExtractedClassProperty, type ExtractedDeclaration, type ExtractedDeclarationKind, type ExtractedEnum, type ExtractedEnumMember, type ExtractedFunction, type ExtractedInterface, type ExtractedInterfaceCallSignature, type ExtractedInterfaceConstructSignature, type ExtractedInterfaceGetAccessor, type ExtractedInterfaceIndexSignature, type ExtractedInterfaceMethod, type ExtractedInterfaceProperty, type ExtractedInterfaceSetAccessor, type ExtractedNamespace, type ExtractedTypeAlias, type ExtractedVariable, type ExtractorError, FsError, InstallPackageError, type PackageApi, PackageDeclarationsError, PackageJsonError, PackageNameError, PackageTypesError, ProjectError, extractDeclarations, extractPackageApi, packageTypes, parseDocComment };
export { type AllExtractedDeclaration, type AllExtractedDeclarationKind, type ExtractDeclarationsOptions, type ExtractPackageApiOptions, type ExtractedClass, type ExtractedClassConstructor, type ExtractedClassMethod, type ExtractedClassProperty, type ExtractedDeclaration, type ExtractedDeclarationKind, type ExtractedEnum, type ExtractedEnumMember, type ExtractedFunction, type ExtractedInterface, type ExtractedInterfaceCallSignature, type ExtractedInterfaceConstructSignature, type ExtractedInterfaceGetAccessor, type ExtractedInterfaceIndexSignature, type ExtractedInterfaceMethod, type ExtractedInterfaceProperty, type ExtractedInterfaceSetAccessor, type ExtractedNamespace, type ExtractedTypeAlias, type ExtractedVariable, InstallPackageError, type InstallPackageOptions, type PackageApi, PackageDeclarationsError, PackageJsonError, PackageNameError, PackageTypesError, ProjectError, type WorkDir, WorkDirError, extractDeclarations, extractPackageApi, extractPackageApiEffect, installPackage, packageJson, packageName, packageTypes, parseDocComment, workDir };

@@ -1,44 +0,39 @@

// src/errors.ts
var FsError = class extends Error {
constructor(message, options) {
super(message, options);
this.name = this.constructor.name;
// src/create-project.ts
import { Effect } from "effect";
import {
ModuleKind,
ModuleResolutionKind,
Project,
ScriptTarget
} from "ts-morph";
var ProjectError = class {
constructor(cause) {
this.cause = cause;
}
_tag = "ProjectError";
};
var InstallPackageError = class extends Error {
constructor(message, options) {
super(message, options);
this.name = this.constructor.name;
}
};
var PackageNameError = class extends Error {
constructor(message, options) {
super(message, options);
this.name = this.constructor.name;
}
};
var PackageJsonError = class extends Error {
constructor(message, options) {
super(message, options);
this.name = this.constructor.name;
}
};
var PackageTypesError = class extends Error {
constructor(message, options) {
super(message, options);
this.name = this.constructor.name;
}
};
var PackageDeclarationsError = class extends Error {
constructor(message, options) {
super(message, options);
this.name = this.constructor.name;
}
};
var ProjectError = class extends Error {
constructor(message, options) {
super(message, options);
this.name = this.constructor.name;
}
};
var createProject = ({ indexFilePath, cwd }) => Effect.try({
try: () => {
const project = new Project({
compilerOptions: {
// See https://github.com/dsherret/ts-morph/issues/938
// and https://github.com/microsoft/TypeScript/blob/master/lib/lib.esnext.full.d.ts
lib: ["lib.esnext.full.d.ts"],
target: ScriptTarget.ESNext,
module: ModuleKind.ESNext,
moduleResolution: ModuleResolutionKind.Bundler,
// By default, ts-morph creates a project rooted in the current working directory.
// We must change the `typeRoots` directory to the temporary directory
// where the packages are installed, otherwise TypeScript will discover
// `@types` packages from our local `node_modules` directory.
// See https://www.typescriptlang.org/tsconfig#typeRoots.
typeRoots: [cwd]
}
});
const indexFile = project.addSourceFileAtPath(indexFilePath);
project.resolveSourceFileDependencies();
return { project, indexFile };
},
catch: (e) => new ProjectError(e)
});

@@ -1033,55 +1028,18 @@ // src/extract-declarations.ts

// src/extract-package-api.ts
import { ok as ok4, okAsync } from "neverthrow";
import { Effect as Effect9 } from "effect";
// src/extract-package-api-effect.ts
import { Effect as Effect8 } from "effect";
import { performance } from "perf_hooks";
import { join } from "pathe";
// src/create-project.ts
import { err, ok } from "neverthrow";
import process from "process";
import {
ModuleKind,
ModuleResolutionKind,
Project,
ScriptTarget
} from "ts-morph";
var createProject = ({
indexFilePath,
cwd
}) => {
try {
const startDir = process.cwd();
process.chdir(cwd);
const res = _createProject(indexFilePath);
process.chdir(startDir);
return res;
} catch (e) {
return err(new ProjectError("failed to change directories", { cause: e }));
// src/install-package.ts
import { Effect as Effect2 } from "effect";
import { execa } from "execa";
var InstallPackageError = class {
constructor(cause) {
this.cause = cause;
}
_tag = "InstallPackageError";
};
var _createProject = (indexFilePath) => {
try {
const project = new Project({
compilerOptions: {
// See https://github.com/dsherret/ts-morph/issues/938
// and https://github.com/microsoft/TypeScript/blob/master/lib/lib.esnext.full.d.ts
lib: ["lib.esnext.full.d.ts"],
target: ScriptTarget.ESNext,
module: ModuleKind.ESNext,
moduleResolution: ModuleResolutionKind.Bundler
}
});
const indexFile = project.addSourceFileAtPath(indexFilePath);
project.resolveSourceFileDependencies();
return ok({
project,
indexFile
});
} catch (e) {
return err(new ProjectError("failed to create project", { cause: e }));
}
};
// src/install-package.ts
import { execa } from "execa";
import { ResultAsync } from "neverthrow";
var installPackage = ({

@@ -1091,6 +1049,11 @@ pkg,

bunPath = "bun"
}) => ResultAsync.fromPromise(
execa(bunPath, ["add", pkg, "--verbose"], { cwd }),
(e) => new InstallPackageError("failed to install package", { cause: e })
).map(({ stdout }) => {
}) => Effect2.gen(function* (_) {
const { stdout } = yield* _(bunAdd({ pkg, cwd, bunPath }));
return installedPackages(stdout);
});
var bunAdd = ({ pkg, cwd, bunPath }) => Effect2.tryPromise({
try: () => execa(bunPath, ["add", pkg, "--verbose"], { cwd }),
catch: (e) => new InstallPackageError(e)
});
var installedPackages = (stdout) => {
const lines = stdout.split("\n");

@@ -1101,8 +1064,14 @@ const beginHash = lines.findIndex(

const endHash = lines.findIndex((line) => line.startsWith("-- END HASH"));
const installedPackages = lines.slice(beginHash + 1, endHash);
return installedPackages;
});
const installedPackages2 = lines.slice(beginHash + 1, endHash);
return installedPackages2;
};
// src/package-declarations.ts
import { ResultAsync as ResultAsync2 } from "neverthrow";
import { Effect as Effect3 } from "effect";
var PackageDeclarationsError = class {
constructor(cause) {
this.cause = cause;
}
_tag = "PackageDeclarationsError";
};
var packageDeclarations = ({

@@ -1113,4 +1082,4 @@ pkgName,

maxDepth
}) => ResultAsync2.fromPromise(
extractDeclarations({
}) => Effect3.tryPromise({
try: () => extractDeclarations({
containerName: "",

@@ -1122,28 +1091,33 @@ container: indexFile,

}),
(e) => new PackageDeclarationsError("failed to extract package declarations", {
cause: e
})
);
catch: (e) => new PackageDeclarationsError(e)
});
// src/package-json.ts
import { ResultAsync as ResultAsync3 } from "neverthrow";
import { Effect as Effect4 } from "effect";
import { readPackage } from "read-pkg";
var packageJson = (pkgDir) => ResultAsync3.fromPromise(
readPackage({ cwd: pkgDir }),
(e) => new PackageJsonError("failed to read package.json", { cause: e })
);
var PackageJsonError = class {
constructor(cause) {
this.cause = cause;
}
_tag = "PackageJsonError";
};
var packageJson = (pkgDir) => Effect4.tryPromise({
try: () => readPackage({ cwd: pkgDir }),
catch: (e) => new PackageJsonError(e)
});
// src/package-name.ts
import { err as err2, ok as ok2 } from "neverthrow";
import { Effect as Effect5 } from "effect";
import validate from "validate-npm-package-name";
var packageName = (pkg) => {
var PackageNameError = class {
_tag = "PackageNameError";
};
var packageName = (pkg) => Effect5.suspend(() => {
const versionMarker = pkg.lastIndexOf("@");
const name = pkg.slice(0, versionMarker > 0 ? versionMarker : void 0);
if (validate(name).validForNewPackages) {
return ok2(name);
if (!validate(name).validForNewPackages) {
return Effect5.fail(new PackageNameError());
}
return err2(
new PackageNameError("invalid npm package name", { cause: { name } })
);
};
return Effect5.succeed(name);
});

@@ -1157,46 +1131,31 @@ // src/package-overview.ts

// src/package-types.ts
import { err as err3, ok as ok3 } from "neverthrow";
import { Effect as Effect6 } from "effect";
import { exports } from "resolve.exports";
var packageTypes = (pkgJson, pkgSubpath) => {
const isRootSubpath = [".", pkgJson.name].includes(pkgSubpath);
const resolvedTypes = resolveTypes(pkgJson, pkgSubpath);
if (!isRootSubpath || resolvedTypes.isOk()) {
return resolvedTypes;
var PackageTypesError = class {
_tag = "PackageTypesError";
};
var packageTypes = (pkgJson, subpath) => Effect6.gen(function* (_) {
const resolvedPaths = yield* _(resolveExports(pkgJson, subpath));
const firstPath = resolvedPaths[0];
if (firstPath && isTypesFile(firstPath)) {
return firstPath;
}
if (pkgJson.types && isTypesFile(pkgJson.types)) {
return ok3(pkgJson.types);
const isRootSubpath = [".", pkgJson.name].includes(subpath);
if (isRootSubpath && pkgJson.types && isTypesFile(pkgJson.types)) {
return pkgJson.types;
}
if (pkgJson.typings && isTypesFile(pkgJson.typings)) {
return ok3(pkgJson.typings);
if (isRootSubpath && pkgJson.typings && isTypesFile(pkgJson.typings)) {
return pkgJson.typings;
}
return err3(
new PackageTypesError(
"no types files in `exports` field or fallback fields"
)
);
};
var resolveTypes = (pkgJson, subpath) => {
return yield* _(Effect6.fail(new PackageTypesError()));
});
var resolveExports = (pkgJson, subpath) => {
try {
const resolved = exports(pkgJson, subpath, {
const resolvedPaths = exports(pkgJson, subpath, {
conditions: ["types"],
unsafe: true
});
if (!Array.isArray(resolved)) {
return err3(new PackageTypesError("resolved types are not an array"));
}
const resolvedPath = resolved[0];
if (!resolvedPath || !isTypesFile(resolvedPath)) {
return err3(
new PackageTypesError("resolved types are not a types file", {
cause: { resolvedPath }
})
);
}
return ok3(resolvedPath);
} catch (e) {
return err3(
new PackageTypesError("failed to resolve types from `exports` field", {
cause: e
})
);
}) ?? [];
return Effect6.succeed(resolvedPaths);
} catch {
return Effect6.succeed([]);
}

@@ -1206,16 +1165,65 @@ };

// src/remove-dir.ts
import { ResultAsync as ResultAsync4 } from "neverthrow";
import fs from "fs/promises";
var removeDir = (path) => ResultAsync4.fromPromise(
fs.rm(path, { force: true, recursive: true, maxRetries: 3 }),
(e) => new FsError("failed to remove directory", { cause: e })
);
// src/work-dir.ts
import { Effect as Effect7 } from "effect";
import { rm } from "fs/promises";
import { temporaryDirectory } from "tempy";
var WorkDirError = class {
constructor(cause) {
this.cause = cause;
}
_tag = "WorkDirError";
};
var acquire = Effect7.try({
try: () => {
const path = temporaryDirectory();
return {
path,
close: async () => {
try {
await rm(path, { force: true, recursive: true, maxRetries: 3 });
} catch {
}
}
};
},
catch: (e) => new WorkDirError(e)
});
var release = (workDir2) => Effect7.promise(() => workDir2.close());
var workDir = Effect7.acquireRelease(acquire, release);
// src/temp-dir.ts
import { Result as Result4 } from "neverthrow";
import { temporaryDirectory } from "tempy";
var tempDir = Result4.fromThrowable(
temporaryDirectory,
(e) => new FsError("failed to create temporary directory", { cause: e })
// src/extract-package-api-effect.ts
var extractPackageApiEffect = ({
pkg,
subpath = ".",
maxDepth = 5,
bunPath = "bun"
}) => Effect8.scoped(
Effect8.gen(function* (_) {
const startTime = performance.now();
const pkgName = yield* _(packageName(pkg));
const { path: cwd } = yield* _(workDir);
const packages = yield* _(installPackage({ pkg, cwd, bunPath }));
const pkgDir = join(cwd, "node_modules", pkgName);
const pkgJson = yield* _(packageJson(pkgDir));
const types = yield* _(packageTypes(pkgJson, subpath));
const indexFilePath = join(pkgDir, types);
const { project, indexFile } = yield* _(
createProject({ indexFilePath, cwd })
);
const overview = packageOverview(indexFile);
const declarations = yield* _(
packageDeclarations({ pkgName, project, indexFile, maxDepth })
);
return {
name: pkgJson.name,
version: pkgJson.version,
subpath,
types,
overview,
declarations,
packages,
analyzedAt: (/* @__PURE__ */ new Date()).toISOString(),
analyzedIn: Math.round(performance.now() - startTime)
};
})
);

@@ -1229,80 +1237,6 @@

bunPath = "bun"
}) => okAsync({
pkg,
pkgSubpath: subpath,
maxDepth,
startTime: performance.now(),
bunPath
}).andThen(
(ctx) => packageName(ctx.pkg).map((pkgName) => ({
...ctx,
pkgName
}))
).andThen(
(ctx) => tempDir().map((workDir) => ({
...ctx,
workDir
}))
).andThen(
(ctx) => installPackage({
pkg: ctx.pkg,
cwd: ctx.workDir,
bunPath: ctx.bunPath
}).map((installedPackages) => ({
...ctx,
pkgDir: join(ctx.workDir, "node_modules", ctx.pkgName),
installedPackages
}))
).andThen(
(ctx) => packageJson(ctx.pkgDir).map((pkgJson) => ({
...ctx,
pkgJson
}))
).andThen(
(ctx) => packageTypes(ctx.pkgJson, ctx.pkgSubpath).map((pkgTypes) => ({
...ctx,
pkgTypes,
typesFilePath: join(ctx.pkgDir, pkgTypes)
}))
).andThen(
(ctx) => createProject({
indexFilePath: ctx.typesFilePath,
cwd: ctx.workDir
}).map(({ project, indexFile }) => ({
...ctx,
project,
indexFile
}))
).andThen(
(ctx) => ok4(packageOverview(ctx.indexFile)).map((pkgOverview) => ({
...ctx,
pkgOverview
}))
).andThen(
(ctx) => packageDeclarations({
pkgName: ctx.pkgName,
project: ctx.project,
indexFile: ctx.indexFile,
maxDepth: ctx.maxDepth
}).map((pkgDeclarations) => ({
...ctx,
pkgDeclarations
}))
).andThen(
(ctx) => removeDir(ctx.workDir).map(() => ctx).orElse(() => ok4(ctx))
).andThen(
(ctx) => ok4({
name: ctx.pkgJson.name,
version: ctx.pkgJson.version,
subpath: ctx.pkgSubpath,
types: ctx.pkgTypes,
overview: ctx.pkgOverview,
declarations: ctx.pkgDeclarations,
packages: ctx.installedPackages,
analyzedAt: (/* @__PURE__ */ new Date()).toISOString(),
analyzedIn: Math.round(performance.now() - ctx.startTime)
})
}) => Effect9.runPromise(
extractPackageApiEffect({ pkg, subpath, maxDepth, bunPath })
);
export {
FsError,
InstallPackageError,

@@ -1314,6 +1248,12 @@ PackageDeclarationsError,

ProjectError,
WorkDirError,
extractDeclarations,
extractPackageApi,
extractPackageApiEffect,
installPackage,
packageJson,
packageName,
packageTypes,
parseDocComment
parseDocComment,
workDir
};
{
"name": "@jsdocs-io/extractor",
"version": "1.0.0-1",
"version": "1.0.0-2",
"description": "The API extractor for npm packages powering jsdocs.io",

@@ -48,19 +48,8 @@ "license": "AGPL-3.0-or-later",

},
"scripts": {
"check": "tsc --noEmit",
"build": "tsc --noEmit && tsup",
"attw": "attw --pack . --ignore-rules cjs-resolves-to-esm",
"test": "vitest run src test/declarations --coverage --bail 1",
"test:ci": "vitest run src test/declarations test/packages --coverage --bail 1",
"lint": "prettier --check .",
"format": "prettier --write .",
"pre-push": "pnpm i && pnpm lint && pnpm build && pnpm test:ci",
"release": "np"
},
"dependencies": {
"@microsoft/tsdoc": "^0.14.2",
"effect": "^2.4.1",
"execa": "^8.0.1",
"memoize": "^10.0.0",
"natural-orderby": "^3.0.2",
"neverthrow": "^6.1.0",
"pathe": "^1.1.2",

@@ -75,3 +64,3 @@ "prettier": "^3.2.5",

"devDependencies": {
"@arethetypeswrong/cli": "^0.14.1",
"@arethetypeswrong/cli": "^0.15.0",
"@total-typescript/shoehorn": "^0.1.1",

@@ -81,3 +70,3 @@ "@types/node": "^20.11.20",

"@vitest/coverage-v8": "^1.3.1",
"np": "^9.2.0",
"np": "^10.0.0",
"ts-dedent": "^2.2.0",

@@ -88,3 +77,14 @@ "tsup": "^8.0.2",

"vitest": "^1.3.1"
},
"scripts": {
"check": "tsc --noEmit",
"build": "tsc --noEmit && tsup",
"attw": "attw --pack . --ignore-rules cjs-resolves-to-esm",
"test": "vitest run src test/declarations --coverage --bail 1",
"test:ci": "vitest run src test/declarations test/packages --coverage --bail 1",
"lint": "prettier --check .",
"format": "prettier --write .",
"pre-push": "pnpm i && pnpm lint && pnpm build && pnpm test:ci",
"release": "np"
}
}
}

@@ -37,10 +37,4 @@ # @jsdocs-io/extractor

(async () => {
const result = await extractPackageApi({ pkg: "preact" });
if (result.isOk()) {
const packageApi = result.value; // Successfully extracted API
console.log(JSON.stringify(packageApi, null, 2));
} else {
const extractorError = result.error; // Error extracting API
console.error(extractorError);
}
const packageApi = await extractPackageApi({ pkg: "preact" });
console.log(JSON.stringify(packageApi, null, 2));
})();

@@ -55,10 +49,4 @@ ```

(async () => {
const result = await extractPackageApi({ pkg: "preact", subpath: "hooks" });
if (result.isOk()) {
const packageApi = result.value; // Successfully extracted API
console.log(JSON.stringify(packageApi, null, 2));
} else {
const extractorError = result.error; // Error extracting API
console.error(extractorError);
}
const result = await extractPackageApi({ pkg: "preact", subpath: "hooks" });
console.log(JSON.stringify(packageApi, null, 2));
})();

@@ -65,0 +53,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc