@logto/js 4.1.1 → 4.1.3
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/lib/core/sign-in.cjs +10 -3
- package/lib/core/sign-in.d.ts +7 -1
- package/lib/core/sign-in.js +11 -4
- package/lib/index.cjs +2 -0
- package/lib/index.js +2 -2
- package/lib/utils/angular.cjs +2 -2
- package/lib/utils/angular.d.ts +6 -0
- package/lib/utils/angular.js +3 -3
- package/lib/utils/errors.cjs +14 -1
- package/lib/utils/errors.d.ts +11 -3
- package/lib/utils/errors.js +14 -2
- package/lib/utils/scopes.cjs +8 -1
- package/lib/utils/scopes.d.ts +6 -0
- package/lib/utils/scopes.js +8 -2
- package/package.json +10 -17
package/lib/core/sign-in.cjs
CHANGED
|
@@ -11,7 +11,7 @@ const buildPrompt = (prompt) => {
|
|
|
11
11
|
}
|
|
12
12
|
return prompt ?? index.Prompt.Consent;
|
|
13
13
|
};
|
|
14
|
-
const generateSignInUri = ({ authorizationEndpoint, clientId, redirectUri, codeChallenge, state, scopes: scopes$1, resources, prompt, firstScreen, interactionMode, loginHint, directSignIn, extraParams, }) => {
|
|
14
|
+
const generateSignInUri = ({ authorizationEndpoint, clientId, redirectUri, codeChallenge, state, scopes: scopes$1, resources, prompt, firstScreen, interactionMode, loginHint, directSignIn, extraParams, includeReservedScopes = true, }) => {
|
|
15
15
|
const urlSearchParameters = new URLSearchParams({
|
|
16
16
|
[index.QueryKey.ClientId]: clientId,
|
|
17
17
|
[index.QueryKey.RedirectUri]: redirectUri,
|
|
@@ -20,9 +20,11 @@ const generateSignInUri = ({ authorizationEndpoint, clientId, redirectUri, codeC
|
|
|
20
20
|
[index.QueryKey.State]: state,
|
|
21
21
|
[index.QueryKey.ResponseType]: responseType,
|
|
22
22
|
[index.QueryKey.Prompt]: buildPrompt(prompt),
|
|
23
|
-
[index.QueryKey.Scope]: scopes.withDefaultScopes(scopes$1),
|
|
24
|
-
...extraParams,
|
|
25
23
|
});
|
|
24
|
+
const computedScopes = includeReservedScopes ? scopes.withReservedScopes(scopes$1) : scopes$1?.join(' ');
|
|
25
|
+
if (computedScopes) {
|
|
26
|
+
urlSearchParameters.append(index.QueryKey.Scope, computedScopes);
|
|
27
|
+
}
|
|
26
28
|
if (loginHint) {
|
|
27
29
|
urlSearchParameters.append(index.QueryKey.LoginHint, loginHint);
|
|
28
30
|
}
|
|
@@ -39,6 +41,11 @@ const generateSignInUri = ({ authorizationEndpoint, clientId, redirectUri, codeC
|
|
|
39
41
|
else if (interactionMode) {
|
|
40
42
|
urlSearchParameters.append(index.QueryKey.InteractionMode, interactionMode);
|
|
41
43
|
}
|
|
44
|
+
if (extraParams) {
|
|
45
|
+
for (const [key, value] of Object.entries(extraParams)) {
|
|
46
|
+
urlSearchParameters.append(key, value);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
42
49
|
return `${authorizationEndpoint}?${urlSearchParameters.toString()}`;
|
|
43
50
|
};
|
|
44
51
|
|
package/lib/core/sign-in.d.ts
CHANGED
|
@@ -47,5 +47,11 @@ export type SignInUriParameters = {
|
|
|
47
47
|
* by the authorization server.
|
|
48
48
|
*/
|
|
49
49
|
extraParams?: Record<string, string>;
|
|
50
|
+
/**
|
|
51
|
+
* Whether to include reserved scopes (`openid`, `offline_access` and `profile`) in the scopes.
|
|
52
|
+
*
|
|
53
|
+
* @default true
|
|
54
|
+
*/
|
|
55
|
+
includeReservedScopes?: boolean;
|
|
50
56
|
};
|
|
51
|
-
export declare const generateSignInUri: ({ authorizationEndpoint, clientId, redirectUri, codeChallenge, state, scopes, resources, prompt, firstScreen, interactionMode, loginHint, directSignIn, extraParams, }: SignInUriParameters) => string;
|
|
57
|
+
export declare const generateSignInUri: ({ authorizationEndpoint, clientId, redirectUri, codeChallenge, state, scopes, resources, prompt, firstScreen, interactionMode, loginHint, directSignIn, extraParams, includeReservedScopes, }: SignInUriParameters) => string;
|
package/lib/core/sign-in.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { QueryKey, Prompt } from '../consts/index.js';
|
|
2
|
-
import {
|
|
2
|
+
import { withReservedScopes } from '../utils/scopes.js';
|
|
3
3
|
|
|
4
4
|
const codeChallengeMethod = 'S256';
|
|
5
5
|
const responseType = 'code';
|
|
@@ -9,7 +9,7 @@ const buildPrompt = (prompt) => {
|
|
|
9
9
|
}
|
|
10
10
|
return prompt ?? Prompt.Consent;
|
|
11
11
|
};
|
|
12
|
-
const generateSignInUri = ({ authorizationEndpoint, clientId, redirectUri, codeChallenge, state, scopes, resources, prompt, firstScreen, interactionMode, loginHint, directSignIn, extraParams, }) => {
|
|
12
|
+
const generateSignInUri = ({ authorizationEndpoint, clientId, redirectUri, codeChallenge, state, scopes, resources, prompt, firstScreen, interactionMode, loginHint, directSignIn, extraParams, includeReservedScopes = true, }) => {
|
|
13
13
|
const urlSearchParameters = new URLSearchParams({
|
|
14
14
|
[QueryKey.ClientId]: clientId,
|
|
15
15
|
[QueryKey.RedirectUri]: redirectUri,
|
|
@@ -18,9 +18,11 @@ const generateSignInUri = ({ authorizationEndpoint, clientId, redirectUri, codeC
|
|
|
18
18
|
[QueryKey.State]: state,
|
|
19
19
|
[QueryKey.ResponseType]: responseType,
|
|
20
20
|
[QueryKey.Prompt]: buildPrompt(prompt),
|
|
21
|
-
[QueryKey.Scope]: withDefaultScopes(scopes),
|
|
22
|
-
...extraParams,
|
|
23
21
|
});
|
|
22
|
+
const computedScopes = includeReservedScopes ? withReservedScopes(scopes) : scopes?.join(' ');
|
|
23
|
+
if (computedScopes) {
|
|
24
|
+
urlSearchParameters.append(QueryKey.Scope, computedScopes);
|
|
25
|
+
}
|
|
24
26
|
if (loginHint) {
|
|
25
27
|
urlSearchParameters.append(QueryKey.LoginHint, loginHint);
|
|
26
28
|
}
|
|
@@ -37,6 +39,11 @@ const generateSignInUri = ({ authorizationEndpoint, clientId, redirectUri, codeC
|
|
|
37
39
|
else if (interactionMode) {
|
|
38
40
|
urlSearchParameters.append(QueryKey.InteractionMode, interactionMode);
|
|
39
41
|
}
|
|
42
|
+
if (extraParams) {
|
|
43
|
+
for (const [key, value] of Object.entries(extraParams)) {
|
|
44
|
+
urlSearchParameters.append(key, value);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
40
47
|
return `${authorizationEndpoint}?${urlSearchParameters.toString()}`;
|
|
41
48
|
};
|
|
42
49
|
|
package/lib/index.cjs
CHANGED
|
@@ -32,9 +32,11 @@ exports.LogtoError = errors.LogtoError;
|
|
|
32
32
|
exports.LogtoRequestError = errors.LogtoRequestError;
|
|
33
33
|
exports.OidcError = errors.OidcError;
|
|
34
34
|
exports.isLogtoRequestError = errors.isLogtoRequestError;
|
|
35
|
+
exports.isLogtoRequestErrorJson = errors.isLogtoRequestErrorJson;
|
|
35
36
|
exports.decodeIdToken = idToken.decodeIdToken;
|
|
36
37
|
exports.decodeAccessToken = accessToken.decodeAccessToken;
|
|
37
38
|
exports.withDefaultScopes = scopes.withDefaultScopes;
|
|
39
|
+
exports.withReservedScopes = scopes.withReservedScopes;
|
|
38
40
|
exports.isArbitraryObject = arbitraryObject.isArbitraryObject;
|
|
39
41
|
exports.buildAngularAuthConfig = angular.buildAngularAuthConfig;
|
|
40
42
|
exports.ContentType = index.ContentType;
|
package/lib/index.js
CHANGED
|
@@ -5,10 +5,10 @@ export { generateSignInUri } from './core/sign-in.js';
|
|
|
5
5
|
export { generateSignOutUri } from './core/sign-out.js';
|
|
6
6
|
export { fetchUserInfo } from './core/user-info.js';
|
|
7
7
|
export { parseUriParameters, verifyAndParseCodeFromCallbackUri } from './utils/callback-uri.js';
|
|
8
|
-
export { LogtoError, LogtoRequestError, OidcError, isLogtoRequestError } from './utils/errors.js';
|
|
8
|
+
export { LogtoError, LogtoRequestError, OidcError, isLogtoRequestError, isLogtoRequestErrorJson } from './utils/errors.js';
|
|
9
9
|
export { decodeIdToken } from './utils/id-token.js';
|
|
10
10
|
export { decodeAccessToken } from './utils/access-token.js';
|
|
11
|
-
export { withDefaultScopes } from './utils/scopes.js';
|
|
11
|
+
export { withDefaultScopes, withReservedScopes } from './utils/scopes.js';
|
|
12
12
|
export { isArbitraryObject } from './utils/arbitrary-object.js';
|
|
13
13
|
export { buildAngularAuthConfig } from './utils/angular.js';
|
|
14
14
|
export { ContentType, Prompt, QueryKey, TokenGrantType } from './consts/index.js';
|
package/lib/utils/angular.cjs
CHANGED
|
@@ -28,8 +28,8 @@ var scopes = require('./scopes.cjs');
|
|
|
28
28
|
* about how to use the library.
|
|
29
29
|
*/
|
|
30
30
|
const buildAngularAuthConfig = (logtoConfig) => {
|
|
31
|
-
const { endpoint, appId: clientId, scopes: scopes$1, resource, redirectUri: redirectUrl, postLogoutRedirectUri, prompt = index.Prompt.Consent, } = logtoConfig;
|
|
32
|
-
const scope = scopes.
|
|
31
|
+
const { endpoint, appId: clientId, scopes: scopes$1, resource, redirectUri: redirectUrl, postLogoutRedirectUri, prompt = index.Prompt.Consent, includeReservedScopes = true, } = logtoConfig;
|
|
32
|
+
const scope = includeReservedScopes ? scopes.withReservedScopes(scopes$1) : scopes$1?.join(' ');
|
|
33
33
|
const customParameters = resource ? { resource } : undefined;
|
|
34
34
|
return {
|
|
35
35
|
authority: new URL('/oidc', endpoint).href,
|
package/lib/utils/angular.d.ts
CHANGED
|
@@ -42,6 +42,12 @@ export type LogtoAngularConfig = {
|
|
|
42
42
|
* @default Prompt.Consent
|
|
43
43
|
*/
|
|
44
44
|
prompt?: Prompt | Prompt[];
|
|
45
|
+
/**
|
|
46
|
+
* Whether to include reserved scopes (`openid`, `offline_access` and `profile`) in the scopes.
|
|
47
|
+
*
|
|
48
|
+
* @default true
|
|
49
|
+
*/
|
|
50
|
+
includeReservedScopes?: boolean;
|
|
45
51
|
};
|
|
46
52
|
/**
|
|
47
53
|
* A helper function to build the OpenID Connect configuration for `angular-auth-oidc-client`
|
package/lib/utils/angular.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Prompt } from '../consts/index.js';
|
|
2
|
-
import {
|
|
2
|
+
import { withReservedScopes } from './scopes.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* A helper function to build the OpenID Connect configuration for `angular-auth-oidc-client`
|
|
@@ -26,8 +26,8 @@ import { withDefaultScopes } from './scopes.js';
|
|
|
26
26
|
* about how to use the library.
|
|
27
27
|
*/
|
|
28
28
|
const buildAngularAuthConfig = (logtoConfig) => {
|
|
29
|
-
const { endpoint, appId: clientId, scopes, resource, redirectUri: redirectUrl, postLogoutRedirectUri, prompt = Prompt.Consent, } = logtoConfig;
|
|
30
|
-
const scope =
|
|
29
|
+
const { endpoint, appId: clientId, scopes, resource, redirectUri: redirectUrl, postLogoutRedirectUri, prompt = Prompt.Consent, includeReservedScopes = true, } = logtoConfig;
|
|
30
|
+
const scope = includeReservedScopes ? withReservedScopes(scopes) : scopes?.join(' ');
|
|
31
31
|
const customParameters = resource ? { resource } : undefined;
|
|
32
32
|
return {
|
|
33
33
|
authority: new URL('/oidc', endpoint).href,
|
package/lib/utils/errors.cjs
CHANGED
|
@@ -18,24 +18,36 @@ class LogtoError extends Error {
|
|
|
18
18
|
super(logtoErrorCodes[code]);
|
|
19
19
|
this.code = code;
|
|
20
20
|
this.data = data;
|
|
21
|
+
this.name = 'LogtoError';
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
const isLogtoRequestError = (data) => {
|
|
25
|
+
if (!arbitraryObject.isArbitraryObject(data)) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
return data instanceof Error && data.name === 'LogtoRequestError';
|
|
29
|
+
};
|
|
30
|
+
const isLogtoRequestErrorJson = (data) => {
|
|
24
31
|
if (!arbitraryObject.isArbitraryObject(data)) {
|
|
25
32
|
return false;
|
|
26
33
|
}
|
|
27
34
|
return typeof data.code === 'string' && typeof data.message === 'string';
|
|
28
35
|
};
|
|
29
36
|
class LogtoRequestError extends Error {
|
|
30
|
-
constructor(code, message
|
|
37
|
+
constructor(code, message,
|
|
38
|
+
/** The original response object from the server. */
|
|
39
|
+
cause) {
|
|
31
40
|
super(message);
|
|
32
41
|
this.code = code;
|
|
42
|
+
this.cause = cause;
|
|
43
|
+
this.name = 'LogtoRequestError';
|
|
33
44
|
}
|
|
34
45
|
}
|
|
35
46
|
class OidcError {
|
|
36
47
|
constructor(error, errorDescription) {
|
|
37
48
|
this.error = error;
|
|
38
49
|
this.errorDescription = errorDescription;
|
|
50
|
+
this.name = 'OidcError';
|
|
39
51
|
}
|
|
40
52
|
}
|
|
41
53
|
|
|
@@ -43,3 +55,4 @@ exports.LogtoError = LogtoError;
|
|
|
43
55
|
exports.LogtoRequestError = LogtoRequestError;
|
|
44
56
|
exports.OidcError = OidcError;
|
|
45
57
|
exports.isLogtoRequestError = isLogtoRequestError;
|
|
58
|
+
exports.isLogtoRequestErrorJson = isLogtoRequestErrorJson;
|
package/lib/utils/errors.d.ts
CHANGED
|
@@ -12,20 +12,28 @@ declare const logtoErrorCodes: Readonly<{
|
|
|
12
12
|
export type LogtoErrorCode = keyof typeof logtoErrorCodes;
|
|
13
13
|
export declare class LogtoError extends Error {
|
|
14
14
|
code: LogtoErrorCode;
|
|
15
|
-
data
|
|
15
|
+
data?: unknown;
|
|
16
|
+
name: string;
|
|
16
17
|
constructor(code: LogtoErrorCode, data?: unknown);
|
|
17
18
|
}
|
|
18
|
-
export declare const isLogtoRequestError: (data: unknown) => data is
|
|
19
|
+
export declare const isLogtoRequestError: (data: unknown) => data is LogtoRequestError;
|
|
20
|
+
export declare const isLogtoRequestErrorJson: (data: unknown) => data is {
|
|
19
21
|
code: string;
|
|
20
22
|
message: string;
|
|
21
23
|
};
|
|
22
24
|
export declare class LogtoRequestError extends Error {
|
|
23
25
|
code: string;
|
|
24
|
-
|
|
26
|
+
/** The original response object from the server. */
|
|
27
|
+
cause?: Response | undefined;
|
|
28
|
+
name: string;
|
|
29
|
+
constructor(code: string, message: string,
|
|
30
|
+
/** The original response object from the server. */
|
|
31
|
+
cause?: Response | undefined);
|
|
25
32
|
}
|
|
26
33
|
export declare class OidcError {
|
|
27
34
|
error: string;
|
|
28
35
|
errorDescription?: string | undefined;
|
|
36
|
+
name: string;
|
|
29
37
|
constructor(error: string, errorDescription?: string | undefined);
|
|
30
38
|
}
|
|
31
39
|
export {};
|
package/lib/utils/errors.js
CHANGED
|
@@ -16,25 +16,37 @@ class LogtoError extends Error {
|
|
|
16
16
|
super(logtoErrorCodes[code]);
|
|
17
17
|
this.code = code;
|
|
18
18
|
this.data = data;
|
|
19
|
+
this.name = 'LogtoError';
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
22
|
const isLogtoRequestError = (data) => {
|
|
23
|
+
if (!isArbitraryObject(data)) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
return data instanceof Error && data.name === 'LogtoRequestError';
|
|
27
|
+
};
|
|
28
|
+
const isLogtoRequestErrorJson = (data) => {
|
|
22
29
|
if (!isArbitraryObject(data)) {
|
|
23
30
|
return false;
|
|
24
31
|
}
|
|
25
32
|
return typeof data.code === 'string' && typeof data.message === 'string';
|
|
26
33
|
};
|
|
27
34
|
class LogtoRequestError extends Error {
|
|
28
|
-
constructor(code, message
|
|
35
|
+
constructor(code, message,
|
|
36
|
+
/** The original response object from the server. */
|
|
37
|
+
cause) {
|
|
29
38
|
super(message);
|
|
30
39
|
this.code = code;
|
|
40
|
+
this.cause = cause;
|
|
41
|
+
this.name = 'LogtoRequestError';
|
|
31
42
|
}
|
|
32
43
|
}
|
|
33
44
|
class OidcError {
|
|
34
45
|
constructor(error, errorDescription) {
|
|
35
46
|
this.error = error;
|
|
36
47
|
this.errorDescription = errorDescription;
|
|
48
|
+
this.name = 'OidcError';
|
|
37
49
|
}
|
|
38
50
|
}
|
|
39
51
|
|
|
40
|
-
export { LogtoError, LogtoRequestError, OidcError, isLogtoRequestError };
|
|
52
|
+
export { LogtoError, LogtoRequestError, OidcError, isLogtoRequestError, isLogtoRequestErrorJson };
|
package/lib/utils/scopes.cjs
CHANGED
|
@@ -7,10 +7,17 @@ var openid = require('../consts/openid.cjs');
|
|
|
7
7
|
* @param originalScopes
|
|
8
8
|
* @return scopes should contain all default scopes (`openid`, `offline_access` and `profile`)
|
|
9
9
|
*/
|
|
10
|
-
const
|
|
10
|
+
const withReservedScopes = (originalScopes) => {
|
|
11
11
|
const reservedScopes = Object.values(openid.ReservedScope);
|
|
12
12
|
const uniqueScopes = new Set([...reservedScopes, openid.UserScope.Profile, ...(originalScopes ?? [])]);
|
|
13
13
|
return Array.from(uniqueScopes).join(' ');
|
|
14
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Alias of {@link withReservedScopes}.
|
|
17
|
+
*
|
|
18
|
+
* @deprecated Use {@link withReservedScopes} instead.
|
|
19
|
+
*/
|
|
20
|
+
const withDefaultScopes = withReservedScopes;
|
|
15
21
|
|
|
16
22
|
exports.withDefaultScopes = withDefaultScopes;
|
|
23
|
+
exports.withReservedScopes = withReservedScopes;
|
package/lib/utils/scopes.d.ts
CHANGED
|
@@ -2,4 +2,10 @@
|
|
|
2
2
|
* @param originalScopes
|
|
3
3
|
* @return scopes should contain all default scopes (`openid`, `offline_access` and `profile`)
|
|
4
4
|
*/
|
|
5
|
+
export declare const withReservedScopes: (originalScopes?: string[]) => string;
|
|
6
|
+
/**
|
|
7
|
+
* Alias of {@link withReservedScopes}.
|
|
8
|
+
*
|
|
9
|
+
* @deprecated Use {@link withReservedScopes} instead.
|
|
10
|
+
*/
|
|
5
11
|
export declare const withDefaultScopes: (originalScopes?: string[]) => string;
|
package/lib/utils/scopes.js
CHANGED
|
@@ -5,10 +5,16 @@ import { ReservedScope, UserScope } from '../consts/openid.js';
|
|
|
5
5
|
* @param originalScopes
|
|
6
6
|
* @return scopes should contain all default scopes (`openid`, `offline_access` and `profile`)
|
|
7
7
|
*/
|
|
8
|
-
const
|
|
8
|
+
const withReservedScopes = (originalScopes) => {
|
|
9
9
|
const reservedScopes = Object.values(ReservedScope);
|
|
10
10
|
const uniqueScopes = new Set([...reservedScopes, UserScope.Profile, ...(originalScopes ?? [])]);
|
|
11
11
|
return Array.from(uniqueScopes).join(' ');
|
|
12
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Alias of {@link withReservedScopes}.
|
|
15
|
+
*
|
|
16
|
+
* @deprecated Use {@link withReservedScopes} instead.
|
|
17
|
+
*/
|
|
18
|
+
const withDefaultScopes = withReservedScopes;
|
|
13
19
|
|
|
14
|
-
export { withDefaultScopes };
|
|
20
|
+
export { withDefaultScopes, withReservedScopes };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logto/js",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./lib/index.cjs",
|
|
6
6
|
"module": "./lib/index.js",
|
|
@@ -24,26 +24,19 @@
|
|
|
24
24
|
"camelcase-keys": "^7.0.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@
|
|
28
|
-
"@silverhand/
|
|
29
|
-
"@silverhand/ts-config": "^5.0.0",
|
|
30
|
-
"@swc/core": "^1.3.50",
|
|
31
|
-
"@swc/jest": "^0.2.24",
|
|
32
|
-
"@types/jest": "^29.5.1",
|
|
27
|
+
"@silverhand/eslint-config": "^6.0.1",
|
|
28
|
+
"@silverhand/ts-config": "^6.0.0",
|
|
33
29
|
"@types/node": "^20.11.19",
|
|
30
|
+
"@vitest/coverage-v8": "^1.4.0",
|
|
34
31
|
"angular-auth-oidc-client": "^17.0.0",
|
|
35
|
-
"eslint": "^8.
|
|
36
|
-
"
|
|
37
|
-
"jest-environment-jsdom": "^29.5.0",
|
|
38
|
-
"jest-matcher-specific-error": "^1.0.0",
|
|
32
|
+
"eslint": "^8.57.0",
|
|
33
|
+
"happy-dom": "^14.0.0",
|
|
39
34
|
"jose": "^5.2.2",
|
|
40
35
|
"lint-staged": "^15.0.0",
|
|
41
|
-
"nock": "^13.3.0",
|
|
42
36
|
"prettier": "^3.0.0",
|
|
43
37
|
"rollup": "^4.0.0",
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"typescript": "^5.3.3"
|
|
38
|
+
"typescript": "^5.3.3",
|
|
39
|
+
"vitest": "^1.4.0"
|
|
47
40
|
},
|
|
48
41
|
"eslintConfig": {
|
|
49
42
|
"extends": "@silverhand"
|
|
@@ -58,7 +51,7 @@
|
|
|
58
51
|
"check": "tsc --noEmit",
|
|
59
52
|
"build": "rm -rf lib/ && tsc -p tsconfig.build.json --noEmit && rollup -c",
|
|
60
53
|
"lint": "eslint --ext .ts src",
|
|
61
|
-
"test": "
|
|
62
|
-
"test:coverage": "
|
|
54
|
+
"test": "vitest",
|
|
55
|
+
"test:coverage": "vitest --silent --no-watch --environment=happy-dom && vitest --silent --coverage"
|
|
63
56
|
}
|
|
64
57
|
}
|