@initx-plugin/core
Advanced tools
Comparing version 0.0.27 to 0.0.28
@@ -1,34 +0,5 @@ | ||
type MaybeArray<T> = T | T[]; | ||
import { MatcherRules } from 'matchinitx'; | ||
type MaybePromise<T> = T | Promise<T>; | ||
interface MatcherSetup { | ||
/** | ||
* Matching string or RegExp | ||
* | ||
* The key that was used to match the handler | ||
*/ | ||
matching: MaybeArray<string | RegExp>; | ||
} | ||
type BaseMatchers<TMatcher> = TMatcher & MatcherSetup; | ||
type TypeMatchers<TMatcher> = Record<string, BaseMatchers<TMatcher>>; | ||
type ResultFunction<TResult, TMatcher> = (matcher: TMatcher, ...others: string[]) => TResult; | ||
type Matchers<TMatcher extends object = object> = MaybeArray<BaseMatchers<TMatcher>> | TypeMatchers<TMatcher>; | ||
declare class InitxMatcher$1<TResult, TMatcher extends object> { | ||
private resultFunction; | ||
constructor(fn: ResultFunction<TResult, TMatcher>); | ||
match(matchers: Matchers<TMatcher>, key: string, ...others: string[]): TResult[]; | ||
private matchBaseMatchers; | ||
private matchArrayBaseMatchers; | ||
private matchTypeMatchers; | ||
private isBaseMatchers; | ||
private isArrayBaseMatchers; | ||
private alwaysArray; | ||
private isObject; | ||
private isPassed; | ||
private omit; | ||
private buildResultMatcher; | ||
private buildResultFunction; | ||
} | ||
declare function useInitxMatcher<TResult, TMatcher extends object = object>(fn: ResultFunction<TResult, TMatcher>): InitxMatcher$1<TResult, TMatcher>; | ||
interface PackageInfo { | ||
@@ -63,3 +34,3 @@ root: string; | ||
type InitxMatcher<TMatcher extends object = object> = TMatcher & { | ||
type InitxRuleFields<TRule extends object = object> = TRule & { | ||
/** | ||
@@ -72,3 +43,3 @@ * Description of the handler | ||
}; | ||
type InitxMatchers<TMatcher extends object = object> = Matchers<InitxMatcher<TMatcher>>; | ||
type InitxMatcherRules<TRule extends object = object> = MatcherRules<InitxRuleFields<TRule>>; | ||
interface HandlerInfo { | ||
@@ -105,3 +76,3 @@ handler: () => MaybePromise<void>; | ||
} | ||
interface InitxContext<TStore extends object = object, TMatcher extends object = object> extends InitxRunContext { | ||
interface InitxContext<TStore extends object = object, TRule extends object = object> extends InitxRunContext { | ||
/** | ||
@@ -114,10 +85,10 @@ * Store | ||
/** | ||
* Matcher | ||
* Rule | ||
* | ||
* Matched matcher object, you can get custom fields, excluded `matching` | ||
* Matched rule object, you can get custom fields, excluded `matching` | ||
*/ | ||
matcher: InitxMatcher<TMatcher>; | ||
rule: InitxRuleFields<TRule>; | ||
} | ||
declare abstract class InitxPlugin<TStore extends object = object> { | ||
abstract matchers: InitxMatchers; | ||
abstract rules: InitxMatcherRules; | ||
abstract handle(context: InitxContext, ...others: string[]): MaybePromise<void>; | ||
@@ -132,2 +103,2 @@ defaultStore?: TStore; | ||
export { type HandlerInfo, type InitxBaseContext, type InitxContext, type InitxMatchers, InitxPlugin, type InitxPluginInfo, type LoadPluginResult, type MatchedPlugin, type Matchers, type PackageInfo, createStore, fetchPlugins, loadPlugins, matchPlugins, useInitxMatcher, writeStore }; | ||
export { type HandlerInfo, type InitxBaseContext, type InitxContext, type InitxMatcherRules as InitxMatchers, InitxPlugin, type InitxPluginInfo, type LoadPluginResult, type MatchedPlugin, type PackageInfo, createStore, fetchPlugins, loadPlugins, matchPlugins, writeStore }; |
{ | ||
"name": "@initx-plugin/core", | ||
"type": "module", | ||
"version": "0.0.27", | ||
"version": "0.0.28", | ||
"description": "core module for initx plugins", | ||
@@ -27,4 +27,5 @@ "license": "MIT", | ||
"fs-extra": "^11.2.0", | ||
"importx": "^0.5.0", | ||
"@initx-plugin/utils": "0.0.27" | ||
"importx": "^0.5.1", | ||
"matchinitx": "^0.0.2", | ||
"@initx-plugin/utils": "0.0.28" | ||
}, | ||
@@ -31,0 +32,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
10069
5
103
1
+ Addedmatchinitx@^0.0.2
+ Added@initx-plugin/utils@0.0.28(transitive)
+ Addedmatchinitx@0.0.2(transitive)
- Removed@initx-plugin/utils@0.0.27(transitive)
Updated@initx-plugin/utils@0.0.28
Updatedimportx@^0.5.1