@mokup/shared 1.1.4 → 2.0.0
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/README.md +58 -0
- package/dist/chokidar.d.mts +3 -8
- package/dist/chokidar.d.ts +3 -9
- package/dist/chokidar.mjs +2 -1
- package/dist/chunk-_iGcCiPk.mjs +28 -0
- package/dist/{config-core.d.cts → config-core-dqVMz7on.d.mts} +3 -2
- package/dist/config-core-dqVMz7on.d.ts +5 -0
- package/dist/config-core.d.mts +2 -4
- package/dist/config-core.d.ts +2 -4
- package/dist/config-core.mjs +3 -2
- package/dist/config-utils-DFu0_9tl.d.mts +59 -0
- package/dist/config-utils-DFu0_9tl.d.ts +59 -0
- package/dist/config-utils.d.mts +3 -62
- package/dist/config-utils.d.ts +3 -62
- package/dist/config-utils.mjs +143 -159
- package/dist/define-config-CzB1-X1m.d.mts +20 -0
- package/dist/define-config-CzB1-X1m.d.ts +20 -0
- package/dist/define-config.d.mts +2 -20
- package/dist/define-config.d.ts +2 -20
- package/dist/define-config.mjs +146 -162
- package/dist/diagnostic-types-DqAzUbgn.d.mts +39 -0
- package/dist/diagnostic-types-DqAzUbgn.d.ts +39 -0
- package/dist/diagnostic-types.d.mts +2 -0
- package/dist/diagnostic-types.d.ts +2 -0
- package/dist/diagnostic-types.mjs +29 -0
- package/dist/diagnostics-C3QaEtqE.d.mts +101 -0
- package/dist/diagnostics-C3QaEtqE.d.ts +101 -0
- package/dist/diagnostics.d.mts +2 -0
- package/dist/diagnostics.d.ts +2 -0
- package/dist/diagnostics.mjs +129 -0
- package/dist/hono.d.mts +4 -3
- package/dist/hono.d.ts +4 -3
- package/dist/hono.mjs +4 -3
- package/dist/index-5prVUGOX.d.mts +113 -0
- package/dist/index-5prVUGOX.d.ts +113 -0
- package/dist/index.d.mts +13 -10
- package/dist/index.d.ts +13 -10
- package/dist/index.mjs +13 -18
- package/dist/jsonc-parser.d.mts +1 -1
- package/dist/jsonc-parser.d.ts +1 -1
- package/dist/jsonc-parser.mjs +8 -1
- package/dist/jsonc-utils-_Hs6a39T.d.mts +7 -0
- package/dist/jsonc-utils-_Hs6a39T.d.ts +7 -0
- package/dist/jsonc-utils.d.mts +2 -7
- package/dist/jsonc-utils.d.ts +2 -7
- package/dist/jsonc-utils.mjs +20 -20
- package/dist/load-rules-D_kCpu9I.d.mts +14 -0
- package/dist/load-rules-D_kCpu9I.d.ts +14 -0
- package/dist/load-rules.d.mts +2 -14
- package/dist/load-rules.d.ts +2 -14
- package/dist/load-rules.mjs +16 -34
- package/dist/logger-types-BbqYCr6j.d.mts +50 -0
- package/dist/logger-types-BbqYCr6j.d.ts +50 -0
- package/dist/logger.browser.d.mts +4 -3
- package/dist/logger.browser.d.ts +4 -3
- package/dist/logger.browser.mjs +49 -48
- package/dist/logger.d.mts +4 -3
- package/dist/logger.d.ts +4 -3
- package/dist/logger.mjs +49 -48
- package/dist/{mock-files.d.cts → mock-files-DfGigWmY.d.mts} +5 -5
- package/dist/mock-files-DfGigWmY.d.ts +10 -0
- package/dist/mock-files.d.mts +2 -10
- package/dist/mock-files.d.ts +2 -10
- package/dist/mock-files.mjs +38 -50
- package/dist/{module-loader.d.cts → module-loader-nAQlwo3D.d.mts} +7 -6
- package/dist/module-loader-nAQlwo3D.d.ts +14 -0
- package/dist/module-loader.d.mts +2 -13
- package/dist/module-loader.d.ts +2 -13
- package/dist/module-loader.mjs +60 -69
- package/dist/path-utils.d.mts +3 -2
- package/dist/path-utils.d.ts +3 -2
- package/dist/path-utils.mjs +25 -35
- package/dist/pathe.d.mts +1 -1
- package/dist/pathe.d.ts +1 -1
- package/dist/pathe.mjs +8 -1
- package/dist/playground-grouping.d.mts +6 -6
- package/dist/playground-grouping.d.ts +6 -6
- package/dist/playground-grouping.mjs +57 -77
- package/dist/rolldown.d.mts +37 -0
- package/dist/rolldown.d.ts +37 -0
- package/dist/rolldown.mjs +81 -0
- package/dist/{route-constants.d.cts → route-constants-BUi36iYR.d.mts} +3 -2
- package/dist/route-constants-BUi36iYR.d.ts +8 -0
- package/dist/route-constants.d.mts +2 -7
- package/dist/route-constants.d.ts +2 -7
- package/dist/route-constants.mjs +25 -21
- package/dist/route-utils-BiWFUqo-.d.mts +42 -0
- package/dist/route-utils-BiWFUqo-.d.ts +42 -0
- package/dist/route-utils.d.mts +2 -42
- package/dist/route-utils.d.ts +2 -42
- package/dist/route-utils.mjs +94 -121
- package/dist/scan-utils.d.mts +2 -114
- package/dist/scan-utils.d.ts +2 -114
- package/dist/scan-utils.mjs +14 -25
- package/dist/timing.d.mts +3 -2
- package/dist/timing.d.ts +3 -2
- package/dist/timing.mjs +11 -12
- package/package.json +88 -128
- package/dist/chokidar.cjs +0 -11
- package/dist/chokidar.d.cts +0 -9
- package/dist/config-core.cjs +0 -9
- package/dist/config-utils.cjs +0 -179
- package/dist/config-utils.d.cts +0 -62
- package/dist/define-config.cjs +0 -169
- package/dist/define-config.d.cts +0 -20
- package/dist/esbuild.cjs +0 -16
- package/dist/esbuild.d.cts +0 -1
- package/dist/esbuild.d.mts +0 -1
- package/dist/esbuild.d.ts +0 -1
- package/dist/esbuild.mjs +0 -1
- package/dist/hono.cjs +0 -20
- package/dist/hono.d.cts +0 -3
- package/dist/index.cjs +0 -50
- package/dist/index.d.cts +0 -10
- package/dist/jsonc-parser.cjs +0 -16
- package/dist/jsonc-parser.d.cts +0 -1
- package/dist/jsonc-utils.cjs +0 -25
- package/dist/jsonc-utils.d.cts +0 -7
- package/dist/load-rules.cjs +0 -39
- package/dist/load-rules.d.cts +0 -14
- package/dist/logger.browser.cjs +0 -55
- package/dist/logger.browser.d.cts +0 -21
- package/dist/logger.cjs +0 -55
- package/dist/logger.d.cts +0 -21
- package/dist/mock-files.cjs +0 -65
- package/dist/module-loader.cjs +0 -93
- package/dist/path-utils.cjs +0 -57
- package/dist/path-utils.d.cts +0 -7
- package/dist/pathe.cjs +0 -16
- package/dist/pathe.d.cts +0 -1
- package/dist/playground-grouping.cjs +0 -95
- package/dist/playground-grouping.d.cts +0 -12
- package/dist/route-constants.cjs +0 -30
- package/dist/route-utils.cjs +0 -126
- package/dist/route-utils.d.cts +0 -42
- package/dist/scan-utils.cjs +0 -39
- package/dist/scan-utils.d.cts +0 -114
- package/dist/shared/shared.DazgCdsk.d.cts +0 -49
- package/dist/shared/shared.DazgCdsk.d.mts +0 -49
- package/dist/shared/shared.DazgCdsk.d.ts +0 -49
- package/dist/timing.cjs +0 -20
- package/dist/timing.d.cts +0 -4
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# @mokup/shared
|
|
2
|
+
|
|
3
|
+
Shared utilities and public helper exports used across Mokup packages.
|
|
4
|
+
|
|
5
|
+
## Highlights
|
|
6
|
+
|
|
7
|
+
- Shared diagnostics helpers for route-scan and service worker conflict reporting.
|
|
8
|
+
- Shared filesystem, path, config, and module-loader helpers.
|
|
9
|
+
- The shared `rolldown` wrapper used by Mokup build tooling.
|
|
10
|
+
|
|
11
|
+
## Diagnostics helpers
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import {
|
|
15
|
+
collectRouteDiagnosticWarning,
|
|
16
|
+
createRouteDiagnosticSections,
|
|
17
|
+
reportDiagnostics,
|
|
18
|
+
} from '@mokup/shared/diagnostics'
|
|
19
|
+
|
|
20
|
+
const unsupportedFields = new Set<string>()
|
|
21
|
+
const missingHandlers = new Set<string>()
|
|
22
|
+
const duplicateRoutes = new Set<string>()
|
|
23
|
+
|
|
24
|
+
collectRouteDiagnosticWarning({
|
|
25
|
+
message: 'Skip mock without handler: mock/users.get.ts',
|
|
26
|
+
onUnsupportedFields: value => unsupportedFields.add(value),
|
|
27
|
+
onMissingHandler: value => missingHandlers.add(value),
|
|
28
|
+
onDuplicateRoute: value => duplicateRoutes.add(value),
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const sections = createRouteDiagnosticSections({
|
|
32
|
+
unsupportedFields: [...unsupportedFields],
|
|
33
|
+
missingHandlers: [...missingHandlers],
|
|
34
|
+
duplicateRoutes: [...duplicateRoutes],
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
const { error, summaryLines } = reportDiagnostics({
|
|
38
|
+
sections,
|
|
39
|
+
errorOn: ['missing-handler'],
|
|
40
|
+
})
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
For service worker diagnostics, reuse
|
|
44
|
+
`collectSwConflictDiagnosticWarning(...)` and
|
|
45
|
+
`createSwConflictDiagnosticSections(...)`.
|
|
46
|
+
|
|
47
|
+
## Common entries
|
|
48
|
+
|
|
49
|
+
- `@mokup/shared`
|
|
50
|
+
- `@mokup/shared/diagnostics`
|
|
51
|
+
- `@mokup/shared/rolldown`
|
|
52
|
+
- `@mokup/shared/logger`
|
|
53
|
+
- `@mokup/shared/module-loader`
|
|
54
|
+
- `@mokup/shared/pathe`
|
|
55
|
+
|
|
56
|
+
## Node.js
|
|
57
|
+
|
|
58
|
+
- `^20.19.0 || >=22.12.0`
|
package/dist/chokidar.d.mts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
import 'hono';
|
|
5
|
-
import 'hono/router/pattern-router';
|
|
6
|
-
import 'hono/service-worker';
|
|
7
|
-
import 'pathe';
|
|
8
|
-
import 'jsonc-parser';
|
|
1
|
+
import chokidar_default from "chokidar";
|
|
2
|
+
export * from "chokidar";
|
|
3
|
+
export { chokidar_default as default };
|
package/dist/chokidar.d.ts
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
export * from
|
|
3
|
-
export
|
|
4
|
-
import 'esbuild';
|
|
5
|
-
import 'hono';
|
|
6
|
-
import 'hono/router/pattern-router';
|
|
7
|
-
import 'hono/service-worker';
|
|
8
|
-
import 'pathe';
|
|
9
|
-
import 'jsonc-parser';
|
|
1
|
+
import chokidar_default from "chokidar";
|
|
2
|
+
export * from "chokidar";
|
|
3
|
+
export { chokidar_default as default };
|
package/dist/chokidar.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import chokidar_default from "chokidar";
|
|
2
|
+
export { chokidar_default as default };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __exportAll = (all, no_symbols) => {
|
|
8
|
+
let target = {};
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
13
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
14
|
+
return target;
|
|
15
|
+
};
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
18
|
+
key = keys[i];
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
20
|
+
get: ((k) => from[k]).bind(null, key),
|
|
21
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
27
|
+
//#endregion
|
|
28
|
+
export { __reExport as n, __exportAll as t };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
//#region src/config-core.d.ts
|
|
1
2
|
declare const middlewareSymbol: unique symbol;
|
|
2
3
|
declare function isPromise<T = unknown>(value: T | Promise<T>): value is Promise<Awaited<T>>;
|
|
3
|
-
|
|
4
|
-
export {
|
|
4
|
+
//#endregion
|
|
5
|
+
export { middlewareSymbol as n, isPromise as t };
|
package/dist/config-core.d.mts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export { isPromise, middlewareSymbol };
|
|
1
|
+
import { n as middlewareSymbol, t as isPromise } from "./config-core-dqVMz7on.mjs";
|
|
2
|
+
export { isPromise, middlewareSymbol };
|
package/dist/config-core.d.ts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export { isPromise, middlewareSymbol };
|
|
1
|
+
import { n as middlewareSymbol, t as isPromise } from "./config-core-dqVMz7on.mjs";
|
|
2
|
+
export { isPromise, middlewareSymbol };
|
package/dist/config-core.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
//#region src/config-core.ts
|
|
1
2
|
const middlewareSymbol = Symbol.for("mokup.config.middlewares");
|
|
2
3
|
function isPromise(value) {
|
|
3
|
-
|
|
4
|
+
return !!value && typeof value.then === "function";
|
|
4
5
|
}
|
|
5
|
-
|
|
6
|
+
//#endregion
|
|
6
7
|
export { isPromise, middlewareSymbol };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
//#region src/config-utils.d.ts
|
|
2
|
+
type MiddlewarePosition = 'pre' | 'normal' | 'post';
|
|
3
|
+
interface MiddlewareMeta {
|
|
4
|
+
pre?: unknown[];
|
|
5
|
+
normal?: unknown[];
|
|
6
|
+
post?: unknown[];
|
|
7
|
+
}
|
|
8
|
+
interface ConfigSourceMap {
|
|
9
|
+
headers?: string;
|
|
10
|
+
status?: string;
|
|
11
|
+
delay?: string;
|
|
12
|
+
enabled?: string;
|
|
13
|
+
ignorePrefix?: string;
|
|
14
|
+
include?: string;
|
|
15
|
+
exclude?: string;
|
|
16
|
+
}
|
|
17
|
+
declare function readMiddlewareMeta(config: Record<symbol, unknown>): MiddlewareMeta | null;
|
|
18
|
+
declare function normalizeMiddlewareList<T>(params: {
|
|
19
|
+
value?: unknown;
|
|
20
|
+
source: string;
|
|
21
|
+
position: MiddlewarePosition;
|
|
22
|
+
warn?: ((message: string) => void) | undefined;
|
|
23
|
+
map: (handler: (...args: unknown[]) => unknown, index: number, position: MiddlewarePosition) => T;
|
|
24
|
+
}): T[];
|
|
25
|
+
declare function buildConfigChain(file: string, rootDir: string): string[];
|
|
26
|
+
declare function getConfigFileCandidates(dir: string, extensions: readonly string[]): string[];
|
|
27
|
+
declare function findConfigFile(dir: string, cache: Map<string, string | null>, extensions: readonly string[]): Promise<string | null>;
|
|
28
|
+
declare function resolveDirectoryConfig<TConfig extends {
|
|
29
|
+
headers?: Record<string, string>;
|
|
30
|
+
status?: number;
|
|
31
|
+
delay?: number;
|
|
32
|
+
enabled?: boolean;
|
|
33
|
+
ignorePrefix?: string | string[];
|
|
34
|
+
include?: RegExp | RegExp[];
|
|
35
|
+
exclude?: RegExp | RegExp[];
|
|
36
|
+
middleware?: unknown;
|
|
37
|
+
}, TMiddleware>(params: {
|
|
38
|
+
file: string;
|
|
39
|
+
rootDir: string;
|
|
40
|
+
configExtensions: readonly string[];
|
|
41
|
+
configCache: Map<string, TConfig | null>;
|
|
42
|
+
fileCache: Map<string, string | null>;
|
|
43
|
+
loadConfig: (file: string) => Promise<TConfig | null>;
|
|
44
|
+
warn?: (message: string) => void;
|
|
45
|
+
mapMiddleware: (handler: (...args: unknown[]) => unknown, index: number, position: MiddlewarePosition, source: string) => TMiddleware;
|
|
46
|
+
}): Promise<{
|
|
47
|
+
middlewares: TMiddleware[];
|
|
48
|
+
configChain: string[];
|
|
49
|
+
configSources: ConfigSourceMap;
|
|
50
|
+
headers?: Record<string, string>;
|
|
51
|
+
status?: number;
|
|
52
|
+
delay?: number;
|
|
53
|
+
enabled?: boolean;
|
|
54
|
+
ignorePrefix?: string | string[];
|
|
55
|
+
include?: RegExp | RegExp[];
|
|
56
|
+
exclude?: RegExp | RegExp[];
|
|
57
|
+
}>;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { findConfigFile as a, readMiddlewareMeta as c, buildConfigChain as i, resolveDirectoryConfig as l, MiddlewareMeta as n, getConfigFileCandidates as o, MiddlewarePosition as r, normalizeMiddlewareList as s, ConfigSourceMap as t };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
//#region src/config-utils.d.ts
|
|
2
|
+
type MiddlewarePosition = 'pre' | 'normal' | 'post';
|
|
3
|
+
interface MiddlewareMeta {
|
|
4
|
+
pre?: unknown[];
|
|
5
|
+
normal?: unknown[];
|
|
6
|
+
post?: unknown[];
|
|
7
|
+
}
|
|
8
|
+
interface ConfigSourceMap {
|
|
9
|
+
headers?: string;
|
|
10
|
+
status?: string;
|
|
11
|
+
delay?: string;
|
|
12
|
+
enabled?: string;
|
|
13
|
+
ignorePrefix?: string;
|
|
14
|
+
include?: string;
|
|
15
|
+
exclude?: string;
|
|
16
|
+
}
|
|
17
|
+
declare function readMiddlewareMeta(config: Record<symbol, unknown>): MiddlewareMeta | null;
|
|
18
|
+
declare function normalizeMiddlewareList<T>(params: {
|
|
19
|
+
value?: unknown;
|
|
20
|
+
source: string;
|
|
21
|
+
position: MiddlewarePosition;
|
|
22
|
+
warn?: ((message: string) => void) | undefined;
|
|
23
|
+
map: (handler: (...args: unknown[]) => unknown, index: number, position: MiddlewarePosition) => T;
|
|
24
|
+
}): T[];
|
|
25
|
+
declare function buildConfigChain(file: string, rootDir: string): string[];
|
|
26
|
+
declare function getConfigFileCandidates(dir: string, extensions: readonly string[]): string[];
|
|
27
|
+
declare function findConfigFile(dir: string, cache: Map<string, string | null>, extensions: readonly string[]): Promise<string | null>;
|
|
28
|
+
declare function resolveDirectoryConfig<TConfig extends {
|
|
29
|
+
headers?: Record<string, string>;
|
|
30
|
+
status?: number;
|
|
31
|
+
delay?: number;
|
|
32
|
+
enabled?: boolean;
|
|
33
|
+
ignorePrefix?: string | string[];
|
|
34
|
+
include?: RegExp | RegExp[];
|
|
35
|
+
exclude?: RegExp | RegExp[];
|
|
36
|
+
middleware?: unknown;
|
|
37
|
+
}, TMiddleware>(params: {
|
|
38
|
+
file: string;
|
|
39
|
+
rootDir: string;
|
|
40
|
+
configExtensions: readonly string[];
|
|
41
|
+
configCache: Map<string, TConfig | null>;
|
|
42
|
+
fileCache: Map<string, string | null>;
|
|
43
|
+
loadConfig: (file: string) => Promise<TConfig | null>;
|
|
44
|
+
warn?: (message: string) => void;
|
|
45
|
+
mapMiddleware: (handler: (...args: unknown[]) => unknown, index: number, position: MiddlewarePosition, source: string) => TMiddleware;
|
|
46
|
+
}): Promise<{
|
|
47
|
+
middlewares: TMiddleware[];
|
|
48
|
+
configChain: string[];
|
|
49
|
+
configSources: ConfigSourceMap;
|
|
50
|
+
headers?: Record<string, string>;
|
|
51
|
+
status?: number;
|
|
52
|
+
delay?: number;
|
|
53
|
+
enabled?: boolean;
|
|
54
|
+
ignorePrefix?: string | string[];
|
|
55
|
+
include?: RegExp | RegExp[];
|
|
56
|
+
exclude?: RegExp | RegExp[];
|
|
57
|
+
}>;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { findConfigFile as a, readMiddlewareMeta as c, buildConfigChain as i, resolveDirectoryConfig as l, MiddlewareMeta as n, getConfigFileCandidates as o, MiddlewarePosition as r, normalizeMiddlewareList as s, ConfigSourceMap as t };
|
package/dist/config-utils.d.mts
CHANGED
|
@@ -1,62 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
interface MiddlewareMeta {
|
|
5
|
-
pre?: unknown[];
|
|
6
|
-
normal?: unknown[];
|
|
7
|
-
post?: unknown[];
|
|
8
|
-
}
|
|
9
|
-
interface ConfigSourceMap {
|
|
10
|
-
headers?: string;
|
|
11
|
-
status?: string;
|
|
12
|
-
delay?: string;
|
|
13
|
-
enabled?: string;
|
|
14
|
-
ignorePrefix?: string;
|
|
15
|
-
include?: string;
|
|
16
|
-
exclude?: string;
|
|
17
|
-
}
|
|
18
|
-
declare function readMiddlewareMeta(config: Record<symbol, unknown>): MiddlewareMeta | null;
|
|
19
|
-
|
|
20
|
-
declare function normalizeMiddlewareList<T>(params: {
|
|
21
|
-
value?: unknown;
|
|
22
|
-
source: string;
|
|
23
|
-
position: MiddlewarePosition;
|
|
24
|
-
warn?: ((message: string) => void) | undefined;
|
|
25
|
-
map: (handler: (...args: unknown[]) => unknown, index: number, position: MiddlewarePosition) => T;
|
|
26
|
-
}): T[];
|
|
27
|
-
declare function buildConfigChain(file: string, rootDir: string): string[];
|
|
28
|
-
declare function getConfigFileCandidates(dir: string, extensions: readonly string[]): string[];
|
|
29
|
-
declare function findConfigFile(dir: string, cache: Map<string, string | null>, extensions: readonly string[]): Promise<string | null>;
|
|
30
|
-
declare function resolveDirectoryConfig<TConfig extends {
|
|
31
|
-
headers?: Record<string, string>;
|
|
32
|
-
status?: number;
|
|
33
|
-
delay?: number;
|
|
34
|
-
enabled?: boolean;
|
|
35
|
-
ignorePrefix?: string | string[];
|
|
36
|
-
include?: RegExp | RegExp[];
|
|
37
|
-
exclude?: RegExp | RegExp[];
|
|
38
|
-
middleware?: unknown;
|
|
39
|
-
}, TMiddleware>(params: {
|
|
40
|
-
file: string;
|
|
41
|
-
rootDir: string;
|
|
42
|
-
configExtensions: readonly string[];
|
|
43
|
-
configCache: Map<string, TConfig | null>;
|
|
44
|
-
fileCache: Map<string, string | null>;
|
|
45
|
-
loadConfig: (file: string) => Promise<TConfig | null>;
|
|
46
|
-
warn?: (message: string) => void;
|
|
47
|
-
mapMiddleware: (handler: (...args: unknown[]) => unknown, index: number, position: MiddlewarePosition, source: string) => TMiddleware;
|
|
48
|
-
}): Promise<{
|
|
49
|
-
middlewares: TMiddleware[];
|
|
50
|
-
configChain: string[];
|
|
51
|
-
configSources: ConfigSourceMap;
|
|
52
|
-
headers?: Record<string, string>;
|
|
53
|
-
status?: number;
|
|
54
|
-
delay?: number;
|
|
55
|
-
enabled?: boolean;
|
|
56
|
-
ignorePrefix?: string | string[];
|
|
57
|
-
include?: RegExp | RegExp[];
|
|
58
|
-
exclude?: RegExp | RegExp[];
|
|
59
|
-
}>;
|
|
60
|
-
|
|
61
|
-
export { buildConfigChain, findConfigFile, getConfigFileCandidates, normalizeMiddlewareList, readMiddlewareMeta, resolveDirectoryConfig };
|
|
62
|
-
export type { ConfigSourceMap, MiddlewareMeta, MiddlewarePosition };
|
|
1
|
+
import { n as middlewareSymbol, t as isPromise } from "./config-core-dqVMz7on.mjs";
|
|
2
|
+
import { a as findConfigFile, c as readMiddlewareMeta, i as buildConfigChain, l as resolveDirectoryConfig, n as MiddlewareMeta, o as getConfigFileCandidates, r as MiddlewarePosition, s as normalizeMiddlewareList, t as ConfigSourceMap } from "./config-utils-DFu0_9tl.mjs";
|
|
3
|
+
export { ConfigSourceMap, MiddlewareMeta, MiddlewarePosition, buildConfigChain, findConfigFile, getConfigFileCandidates, isPromise, middlewareSymbol, normalizeMiddlewareList, readMiddlewareMeta, resolveDirectoryConfig };
|
package/dist/config-utils.d.ts
CHANGED
|
@@ -1,62 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
interface MiddlewareMeta {
|
|
5
|
-
pre?: unknown[];
|
|
6
|
-
normal?: unknown[];
|
|
7
|
-
post?: unknown[];
|
|
8
|
-
}
|
|
9
|
-
interface ConfigSourceMap {
|
|
10
|
-
headers?: string;
|
|
11
|
-
status?: string;
|
|
12
|
-
delay?: string;
|
|
13
|
-
enabled?: string;
|
|
14
|
-
ignorePrefix?: string;
|
|
15
|
-
include?: string;
|
|
16
|
-
exclude?: string;
|
|
17
|
-
}
|
|
18
|
-
declare function readMiddlewareMeta(config: Record<symbol, unknown>): MiddlewareMeta | null;
|
|
19
|
-
|
|
20
|
-
declare function normalizeMiddlewareList<T>(params: {
|
|
21
|
-
value?: unknown;
|
|
22
|
-
source: string;
|
|
23
|
-
position: MiddlewarePosition;
|
|
24
|
-
warn?: ((message: string) => void) | undefined;
|
|
25
|
-
map: (handler: (...args: unknown[]) => unknown, index: number, position: MiddlewarePosition) => T;
|
|
26
|
-
}): T[];
|
|
27
|
-
declare function buildConfigChain(file: string, rootDir: string): string[];
|
|
28
|
-
declare function getConfigFileCandidates(dir: string, extensions: readonly string[]): string[];
|
|
29
|
-
declare function findConfigFile(dir: string, cache: Map<string, string | null>, extensions: readonly string[]): Promise<string | null>;
|
|
30
|
-
declare function resolveDirectoryConfig<TConfig extends {
|
|
31
|
-
headers?: Record<string, string>;
|
|
32
|
-
status?: number;
|
|
33
|
-
delay?: number;
|
|
34
|
-
enabled?: boolean;
|
|
35
|
-
ignorePrefix?: string | string[];
|
|
36
|
-
include?: RegExp | RegExp[];
|
|
37
|
-
exclude?: RegExp | RegExp[];
|
|
38
|
-
middleware?: unknown;
|
|
39
|
-
}, TMiddleware>(params: {
|
|
40
|
-
file: string;
|
|
41
|
-
rootDir: string;
|
|
42
|
-
configExtensions: readonly string[];
|
|
43
|
-
configCache: Map<string, TConfig | null>;
|
|
44
|
-
fileCache: Map<string, string | null>;
|
|
45
|
-
loadConfig: (file: string) => Promise<TConfig | null>;
|
|
46
|
-
warn?: (message: string) => void;
|
|
47
|
-
mapMiddleware: (handler: (...args: unknown[]) => unknown, index: number, position: MiddlewarePosition, source: string) => TMiddleware;
|
|
48
|
-
}): Promise<{
|
|
49
|
-
middlewares: TMiddleware[];
|
|
50
|
-
configChain: string[];
|
|
51
|
-
configSources: ConfigSourceMap;
|
|
52
|
-
headers?: Record<string, string>;
|
|
53
|
-
status?: number;
|
|
54
|
-
delay?: number;
|
|
55
|
-
enabled?: boolean;
|
|
56
|
-
ignorePrefix?: string | string[];
|
|
57
|
-
include?: RegExp | RegExp[];
|
|
58
|
-
exclude?: RegExp | RegExp[];
|
|
59
|
-
}>;
|
|
60
|
-
|
|
61
|
-
export { buildConfigChain, findConfigFile, getConfigFileCandidates, normalizeMiddlewareList, readMiddlewareMeta, resolveDirectoryConfig };
|
|
62
|
-
export type { ConfigSourceMap, MiddlewareMeta, MiddlewarePosition };
|
|
1
|
+
import { n as middlewareSymbol, t as isPromise } from "./config-core-dqVMz7on.mjs";
|
|
2
|
+
import { a as findConfigFile, c as readMiddlewareMeta, i as buildConfigChain, l as resolveDirectoryConfig, n as MiddlewareMeta, o as getConfigFileCandidates, r as MiddlewarePosition, s as normalizeMiddlewareList, t as ConfigSourceMap } from "./config-utils-DFu0_9tl.mjs";
|
|
3
|
+
export { ConfigSourceMap, MiddlewareMeta, MiddlewarePosition, buildConfigChain, findConfigFile, getConfigFileCandidates, isPromise, middlewareSymbol, normalizeMiddlewareList, readMiddlewareMeta, resolveDirectoryConfig };
|