Skip to content

Commit 1c3f6b3

Browse files
authored
chore(apidom-error): use API Extractor for TypeScript rollup (#4422)
Refs #4382
1 parent bdc0145 commit 1c3f6b3

12 files changed

+868
-16
lines changed

api-extractor.json

Lines changed: 458 additions & 0 deletions
Large diffs are not rendered by default.

package-lock.json

Lines changed: 383 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
"lerna": "=8.1.8",
8787
"lint-staged": "=15.2.10",
8888
"microtime": "=3.1.1",
89+
"@microsoft/api-extractor": "^7.47.11",
8990
"mocha": "=10.7.3",
9091
"mocha-chai-jest-snapshot": "^1.1.6",
9192
"node-gyp": "=10.2.0",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3+
"extends": "../../../../api-extractor.json"
4+
}

packages/apidom-error/config/rollup/types.dist.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

packages/apidom-error/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
"unpkg": "./dist/apidom-error.browser.min.js",
1212
"main": "./src/index.cjs",
1313
"exports": {
14-
"types": "./types/dist.d.ts",
14+
"types": "./types/apidom-error.d.ts",
1515
"import": "./src/index.mjs",
1616
"require": "./src/index.cjs"
1717
},
18-
"types": "./types/dist.d.ts",
18+
"types": "./types/apidom-error.d.ts",
1919
"scripts": {
2020
"build": "npm run clean && run-p --max-parallel ${CPU_CORES:-2} typescript:declaration build:es build:cjs build:umd:browser",
2121
"build:es": "cross-env BABEL_ENV=es babel src --out-dir src --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward'",
@@ -25,7 +25,7 @@
2525
"lint:fix": "eslint ./ --fix",
2626
"clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' 'test/**/*.mjs' ./dist ./types",
2727
"typescript:check-types": "tsc --noEmit",
28-
"typescript:declaration": "copyfiles -u 1 'src/**/*.d.ts' ./types && tsc -p declaration.tsconfig.json && rollup -c config/rollup/types.dist.js",
28+
"typescript:declaration": "copyfiles -u 1 'src/**/*.d.ts' ./types && tsc -p declaration.tsconfig.json && api-extractor run -l -c ./config/api-extractor/api-extractor.json",
2929
"test": "npm run build:es && cross-env BABEL_ENV=es babel test --out-dir test --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward' && cross-env NODE_ENV=test mocha",
3030
"prepack": "copyfiles -u 3 ../../LICENSES/* LICENSES && copyfiles -u 2 ../../NOTICE .",
3131
"postpack": "rimraf NOTICE LICENSES"
@@ -43,7 +43,7 @@
4343
"src/**/*.mjs",
4444
"src/**/*.cjs",
4545
"dist/",
46-
"types/dist.d.ts",
46+
"types/apidom-error.d.ts",
4747
"LICENSES",
4848
"NOTICE",
4949
"README.md",

packages/apidom-error/src/ApiDOMAggregateError.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import type ApiDOMErrorOptions from './ApiDOMErrorOptions.ts';
22

3+
/**
4+
* @public
5+
*/
36
class ApiDOMAggregateError extends AggregateError {
47
constructor(errors: Iterable<unknown>, message?: string, options?: ApiDOMErrorOptions) {
58
super(errors, message, options);

packages/apidom-error/src/ApiDOMError.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import ApiDOMAggregateError from './ApiDOMAggregateError.ts';
22
import type ApiDOMErrorOptions from './ApiDOMErrorOptions.ts';
33

4+
/**
5+
* @public
6+
*/
47
class ApiDOMError extends Error {
58
public static [Symbol.hasInstance](instance: unknown) {
69
// we want to ApiDOMAggregateError to act as if ApiDOMError was its superclass

packages/apidom-error/src/ApiDOMErrorOptions.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/**
2+
* @public
3+
*/
14
export default interface ApiDOMErrorOptions extends ErrorOptions {
25
readonly cause?: unknown;
36
readonly [key: string]: unknown;

packages/apidom-error/src/ApiDOMStructuredError.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import ApiDOMError from './ApiDOMError.ts';
22
import type ApiDOMErrorOptions from './ApiDOMErrorOptions.ts';
33

4+
/**
5+
* @public
6+
*/
47
class ApiDOMStructuredError extends ApiDOMError {
58
constructor(message?: string, structuredOptions?: ApiDOMErrorOptions) {
69
super(message, structuredOptions);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import UnsupportedOperationError from './UnsupportedOperationError.ts';
22

3+
/**
4+
* @public
5+
*/
36
class NotImplementedError extends UnsupportedOperationError {}
47

58
export default NotImplementedError;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import ApiDOMError from './ApiDOMError.ts';
22

3+
/**
4+
* @public
5+
*/
36
class UnsupportedOperationError extends ApiDOMError {}
47

58
export default UnsupportedOperationError;

0 commit comments

Comments
 (0)