Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(reference): use API Extractor for TypeScript rollup #4538

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
"extends": "../../../../api-extractor.json"
}
11 changes: 0 additions & 11 deletions packages/apidom-reference/config/rollup/types.dist.js

This file was deleted.

10 changes: 5 additions & 5 deletions packages/apidom-reference/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@
"./src/resolve/resolvers/file/index-node.mjs": "./src/resolve/resolvers/file/index-browser.mjs"
},
"main": "./src/configuration/saturated.cjs",
"types": "./types/dist.d.ts",
"types": "./types/apidom-reference.d.ts",
"exports": {
".": {
"import": "./src/configuration/saturated.mjs",
"require": "./src/configuration/saturated.cjs",
"types": "./types/dist.d.ts"
"types": "./types/apidom-reference.d.ts"
},
"./configuration/saturated": {
"import": "./src/configuration/saturated.mjs",
"require": "./src/configuration/saturated.cjs",
"types": "./types/dist.d.ts"
"types": "./types/apidom-reference.d.ts"
},
"./configuration/empty": {
"import": "./src/configuration/empty.mjs",
"require": "./src/configuration/empty.cjs",
"types": "./types/dist.d.ts"
"types": "./types/apidom-reference.d.ts"
},
"./resolve/resolvers/file": {
"browser": {
Expand Down Expand Up @@ -246,7 +246,7 @@
"perf": "cross-env BABEL_ENV=es babel ./test/perf/index.ts --out-file ./test/perf/index.mjs --root-mode 'upward' && cross-env NODE_ENV=test node ./test/perf/index.mjs",
"perf:openapi-3-1-dereference": "cross-env BABEL_ENV=es babel ./test/perf/openapi-3-1-dereference.ts --out-file ./test/perf/openapi-3-1-dereference.mjs --root-mode 'upward' && cross-env NODE_ENV=test node ./test/perf/openapi-3-1-dereference.mjs",
"typescript:check-types": "tsc --noEmit && tsc -p ./test/tsconfig.json --noEmit",
"typescript:declaration": "tsc -p tsconfig.declaration.json && rollup -c config/rollup/types.dist.js",
"typescript:declaration": "tsc -p tsconfig.declaration.json && api-extractor run -l -c ./config/api-extractor/api-extractor.json",
"prepack": "copyfiles -u 3 ../../LICENSES/* LICENSES && copyfiles -u 2 ../../NOTICE .",
"postpack": "rimraf NOTICE LICENSES"
},
Expand Down
4 changes: 4 additions & 0 deletions packages/apidom-reference/src/File.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as url from './util/url.ts';

/**
* This class represents a File object with url and data.
* @public
*/

export interface FileOptions {
Expand All @@ -15,6 +16,9 @@ export interface FileOptions {
readonly parseResult?: ParseResultElement;
}

/**
* @public
*/
class File {
public uri: string;

Expand Down
6 changes: 6 additions & 0 deletions packages/apidom-reference/src/Reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@ import { Element } from '@swagger-api/apidom-core';

import ReferenceSet from './ReferenceSet.ts';

/**
* @public
*/
export interface ReferenceOptions<T = Element> {
readonly uri: string;
readonly depth?: number;
readonly refSet?: ReferenceSet;
readonly value: T;
}

/**
* @public
*/
class Reference<T = Element> {
public readonly uri: string;

Expand Down
6 changes: 6 additions & 0 deletions packages/apidom-reference/src/ReferenceSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ import { isNotUndefined, isString } from 'ramda-adjunct';

import type Reference from './Reference.ts';

/**
* @public
*/
export interface ReferenceSetOptions {
readonly refs?: Reference[];
readonly circular?: boolean;
}

/**
* @public
*/
class ReferenceSet {
public rootRef?: Reference;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@ import { ParseResultElement } from '@swagger-api/apidom-core';
import File from '../../File.ts';
import type { ReferenceOptions } from '../../options/index.ts';

/**
* @public
*/
export interface BundleStrategyOptions {
readonly name: string;
}

/**
* @public
*/
abstract class BundleStrategy {
public readonly name: string;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@ import { Element } from 'minim';
import File from '../../File.ts';
import type { ReferenceOptions } from '../../options/index.ts';

/**
* @public
*/
export interface DereferenceStrategyOptions {
readonly name: string;
}

/**
* @public
*/
abstract class DereferenceStrategy {
public readonly name: string;

Expand Down
3 changes: 3 additions & 0 deletions packages/apidom-reference/src/dereference/util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { Element, isElement } from '@swagger-api/apidom-core';

/**
* @public
*/
// eslint-disable-next-line import/prefer-default-export
export class AncestorLineage<T extends Element> extends Array<Set<T>> {
includesCycle(element: T) {
Expand Down
3 changes: 3 additions & 0 deletions packages/apidom-reference/src/errors/BundleError.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { ApiDOMError } from '@swagger-api/apidom-error';

/**
* @public
*/
class BundleError extends ApiDOMError {}

export default BundleError;
3 changes: 3 additions & 0 deletions packages/apidom-reference/src/errors/DereferenceError.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { ApiDOMError } from '@swagger-api/apidom-error';

/**
* @public
*/
class DereferenceError extends ApiDOMError {}

export default DereferenceError;
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { ApiDOMError } from '@swagger-api/apidom-error';

/**
* @public
*/
class EvaluationElementIdError extends ApiDOMError {}

export default EvaluationElementIdError;
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import JsonSchema$anchorError from './JsonSchema$anchorError.ts';

/**
* @public
*/
class EvaluationJsonSchema$anchorError extends JsonSchema$anchorError {}

export default EvaluationJsonSchema$anchorError;
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import JsonSchemaUriError from './JsonSchemaUriError.ts';

/**
* @public
*/
class EvaluationJsonSchemaUriError extends JsonSchemaUriError {}

export default EvaluationJsonSchemaUriError;
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import JsonSchema$anchorError from './JsonSchema$anchorError.ts';

/**
* @public
*/
class InvalidJsonSchema$anchorError extends JsonSchema$anchorError {
constructor(anchor: string) {
super(`Invalid JSON Schema $anchor "${anchor}".`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { ApiDOMError } from '@swagger-api/apidom-error';

/**
* @public
*/
class JsonSchema$anchorError extends ApiDOMError {}

export default JsonSchema$anchorError;
3 changes: 3 additions & 0 deletions packages/apidom-reference/src/errors/JsonSchemaUriError.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { ApiDOMError } from '@swagger-api/apidom-error';

/**
* @public
*/
class JsonSchemaUriError extends ApiDOMError {}

export default JsonSchemaUriError;
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import BundleError from './BundleError.ts';

/**
* @public
*/
class MaximumBundleDepthError extends BundleError {}

export default MaximumBundleDepthError;
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import DereferenceError from './DereferenceError.ts';

/**
* @public
*/
class MaximumDereferenceDepthError extends DereferenceError {}

export default MaximumDereferenceDepthError;
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import ResolveError from './ResolveError.ts';

/**
* @public
*/
class MaximumResolveDepthError extends ResolveError {}

export default MaximumResolveDepthError;
3 changes: 3 additions & 0 deletions packages/apidom-reference/src/errors/ParseError.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { ApiDOMError } from '@swagger-api/apidom-error';

/**
* @public
*/
class ParseError extends ApiDOMError {}

export default ParseError;
3 changes: 3 additions & 0 deletions packages/apidom-reference/src/errors/ParserError.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import ParseError from './ParseError.ts';

/**
* @public
*/
class ParserError extends ParseError {}

export default ParserError;
3 changes: 3 additions & 0 deletions packages/apidom-reference/src/errors/PluginError.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { ApiDOMError } from '@swagger-api/apidom-error';

/**
* @public
*/
class PluginError extends ApiDOMError {
public plugin: any;

Expand Down
3 changes: 3 additions & 0 deletions packages/apidom-reference/src/errors/ResolveError.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { ApiDOMError } from '@swagger-api/apidom-error';

/**
* @public
*/
class ResolveError extends ApiDOMError {}

export default ResolveError;
3 changes: 3 additions & 0 deletions packages/apidom-reference/src/errors/ResolverError.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import ResolveError from './ResolveError.ts';

/**
* @public
*/
class ResolverError extends ResolveError {}

export default ResolverError;
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import BundleError from './BundleError.ts';

/**
* @public
*/
class UnmatchedBundleStrategyError extends BundleError {}

export default UnmatchedBundleStrategyError;
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import DereferenceError from './DereferenceError.ts';

/**
* @public
*/
class UnmatchedDereferenceStrategyError extends DereferenceError {}

export default UnmatchedDereferenceStrategyError;
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import ResolveError from './ResolveError.ts';

/**
* @public
*/
class UnmatchedResolveStrategyError extends ResolveError {}

export default UnmatchedResolveStrategyError;
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import ResolverError from './ResolverError.ts';

/**
* @public
*/
class UnmatchedResolverError extends ResolverError {}

export default UnmatchedResolverError;
Loading