@eggjs/watcher 5.0.0-beta.15 → 5.0.0-beta.17
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/dist/config/config.default.d.ts +13 -3
- package/dist/config/config.default.js +2 -3
- package/dist/config/config.local.d.ts +2 -4
- package/dist/config/config.unittest.d.ts +2 -4
- package/dist/index.d.ts +2 -3
- package/dist/lib/utils.d.ts +1 -2
- package/dist/lib/utils.js +1 -7
- package/dist/lib/watcher.d.ts +11 -2
- package/dist/types.d.ts +12 -0
- package/package.json +7 -7
- package/dist/lib/types.d.ts +0 -35
- /package/dist/{lib/types.js → types.js} +0 -0
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
import { WatcherConfig } from "../lib/types.js";
|
|
2
|
-
|
|
3
1
|
//#region src/config/config.default.d.ts
|
|
2
|
+
interface WatcherConfig {
|
|
3
|
+
/**
|
|
4
|
+
* event source type, default is `default`
|
|
5
|
+
* can be `default` or `development`
|
|
6
|
+
*/
|
|
7
|
+
type: string;
|
|
8
|
+
/**
|
|
9
|
+
* event sources
|
|
10
|
+
* key is event source type, value is event source module path
|
|
11
|
+
*/
|
|
12
|
+
eventSources: Record<string, string>;
|
|
13
|
+
}
|
|
4
14
|
declare const _default: {
|
|
5
15
|
/**
|
|
6
16
|
* watcher options
|
|
@@ -10,4 +20,4 @@ declare const _default: {
|
|
|
10
20
|
watcher: WatcherConfig;
|
|
11
21
|
};
|
|
12
22
|
//#endregion
|
|
13
|
-
export { _default as default };
|
|
23
|
+
export { WatcherConfig, _default as default };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { getSourceDirname } from "../lib/utils.js";
|
|
2
1
|
import path from "node:path";
|
|
3
2
|
|
|
4
3
|
//#region src/config/config.default.ts
|
|
5
4
|
var config_default_default = { watcher: {
|
|
6
5
|
type: "default",
|
|
7
6
|
eventSources: {
|
|
8
|
-
default: path.join(
|
|
9
|
-
development: path.join(
|
|
7
|
+
default: path.join(import.meta.dirname, "../lib/event-sources/default"),
|
|
8
|
+
development: path.join(import.meta.dirname, "../lib/event-sources/development")
|
|
10
9
|
}
|
|
11
10
|
} };
|
|
12
11
|
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PartialEggConfig } from "egg";
|
|
2
2
|
|
|
3
3
|
//#region src/config/config.local.d.ts
|
|
4
|
-
declare const _default:
|
|
5
|
-
watcher: WatcherConfig;
|
|
6
|
-
};
|
|
4
|
+
declare const _default: PartialEggConfig;
|
|
7
5
|
//#endregion
|
|
8
6
|
export { _default as default };
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PartialEggConfig } from "egg";
|
|
2
2
|
|
|
3
3
|
//#region src/config/config.unittest.d.ts
|
|
4
|
-
declare const _default:
|
|
5
|
-
watcher: WatcherConfig;
|
|
6
|
-
};
|
|
4
|
+
declare const _default: PartialEggConfig;
|
|
7
5
|
//#endregion
|
|
8
6
|
export { _default as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { WatchListener, Watcher } from "./lib/watcher.js";
|
|
2
|
-
import { ChangeInfo, WatcherConfig } from "./lib/types.js";
|
|
1
|
+
import { ChangeInfo, WatchListener, Watcher } from "./lib/watcher.js";
|
|
3
2
|
import { BaseEventSource } from "./lib/event-sources/base.js";
|
|
4
3
|
import DefaultEventSource from "./lib/event-sources/default.js";
|
|
5
4
|
import DevelopmentEventSource from "./lib/event-sources/development.js";
|
|
6
|
-
export { BaseEventSource, ChangeInfo, DefaultEventSource, DevelopmentEventSource, WatchListener, Watcher
|
|
5
|
+
export { BaseEventSource, ChangeInfo, DefaultEventSource, DevelopmentEventSource, WatchListener, Watcher };
|
package/dist/lib/utils.d.ts
CHANGED
package/dist/lib/utils.js
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { fileURLToPath } from "node:url";
|
|
3
2
|
|
|
4
3
|
//#region src/lib/utils.ts
|
|
5
4
|
function isEqualOrParentPath(parent, child) {
|
|
6
5
|
return !path.relative(parent, child).startsWith("..");
|
|
7
6
|
}
|
|
8
|
-
function getSourceDirname() {
|
|
9
|
-
if (typeof __dirname === "string") return path.dirname(__dirname);
|
|
10
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
11
|
-
return path.dirname(path.dirname(__filename));
|
|
12
|
-
}
|
|
13
7
|
|
|
14
8
|
//#endregion
|
|
15
|
-
export {
|
|
9
|
+
export { isEqualOrParentPath };
|
package/dist/lib/watcher.d.ts
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
import { ChangeInfo } from "./types.js";
|
|
2
1
|
import { Base } from "sdk-base";
|
|
2
|
+
import { Stats, WatchEventType } from "node:fs";
|
|
3
3
|
import { EggAppConfig } from "egg";
|
|
4
4
|
|
|
5
5
|
//#region src/lib/watcher.d.ts
|
|
6
|
+
interface ChangeInfo extends Record<string, any> {
|
|
7
|
+
event: WatchEventType;
|
|
8
|
+
/**
|
|
9
|
+
* file stat if path exists
|
|
10
|
+
*/
|
|
11
|
+
stat?: Stats;
|
|
12
|
+
path: string;
|
|
13
|
+
isDirectory?: boolean;
|
|
14
|
+
}
|
|
6
15
|
type WatchListener = (info: ChangeInfo) => void;
|
|
7
16
|
declare class Watcher extends Base {
|
|
8
17
|
#private;
|
|
@@ -11,4 +20,4 @@ declare class Watcher extends Base {
|
|
|
11
20
|
watch(path: string | string[], listener: WatchListener): void;
|
|
12
21
|
}
|
|
13
22
|
//#endregion
|
|
14
|
-
export { WatchListener, Watcher };
|
|
23
|
+
export { ChangeInfo, WatchListener, Watcher };
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { WatcherConfig } from "./config/config.default.js";
|
|
2
|
+
import { Watcher } from "./lib/watcher.js";
|
|
3
|
+
|
|
4
|
+
//#region src/types.d.ts
|
|
5
|
+
declare module 'egg' {
|
|
6
|
+
interface EggApplicationCore {
|
|
7
|
+
watcher: Watcher;
|
|
8
|
+
}
|
|
9
|
+
interface EggAppConfig {
|
|
10
|
+
watcher?: WatcherConfig;
|
|
11
|
+
}
|
|
12
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eggjs/watcher",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.17",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -26,18 +26,18 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"camelcase": "^8.0.0",
|
|
28
28
|
"sdk-base": "^5.0.1",
|
|
29
|
-
"@eggjs/utils": "5.0.0-beta.
|
|
29
|
+
"@eggjs/utils": "5.0.0-beta.17"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"egg": "4.1.0-beta.
|
|
32
|
+
"egg": "4.1.0-beta.17"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"tsdown": "^0.15.4",
|
|
36
36
|
"typescript": "5.9.2",
|
|
37
37
|
"vitest": "4.0.0-beta.13",
|
|
38
|
-
"@eggjs/tsconfig": "3.1.0-beta.
|
|
39
|
-
"@eggjs/mock": "7.0.0-beta.
|
|
40
|
-
"@eggjs/utils": "5.0.0-beta.
|
|
38
|
+
"@eggjs/tsconfig": "3.1.0-beta.17",
|
|
39
|
+
"@eggjs/mock": "7.0.0-beta.17",
|
|
40
|
+
"@eggjs/utils": "5.0.0-beta.17"
|
|
41
41
|
},
|
|
42
42
|
"type": "module",
|
|
43
43
|
"exports": {
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"./lib/event-sources/base": "./dist/lib/event-sources/base.js",
|
|
53
53
|
"./lib/event-sources/default": "./dist/lib/event-sources/default.js",
|
|
54
54
|
"./lib/event-sources/development": "./dist/lib/event-sources/development.js",
|
|
55
|
-
"./lib/types": "./dist/lib/types.js",
|
|
56
55
|
"./lib/utils": "./dist/lib/utils.js",
|
|
57
56
|
"./lib/watcher": "./dist/lib/watcher.js",
|
|
57
|
+
"./types": "./dist/types.js",
|
|
58
58
|
"./package.json": "./package.json"
|
|
59
59
|
},
|
|
60
60
|
"files": [
|
package/dist/lib/types.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Watcher } from "./watcher.js";
|
|
2
|
-
import { Stats, WatchEventType } from "node:fs";
|
|
3
|
-
|
|
4
|
-
//#region src/lib/types.d.ts
|
|
5
|
-
interface WatcherConfig {
|
|
6
|
-
/**
|
|
7
|
-
* event source type, default is `default`
|
|
8
|
-
* can be `default` or `development`
|
|
9
|
-
*/
|
|
10
|
-
type: string;
|
|
11
|
-
/**
|
|
12
|
-
* event sources
|
|
13
|
-
* key is event source type, value is event source module path
|
|
14
|
-
*/
|
|
15
|
-
eventSources: Record<string, string>;
|
|
16
|
-
}
|
|
17
|
-
interface ChangeInfo extends Record<string, any> {
|
|
18
|
-
event: WatchEventType;
|
|
19
|
-
/**
|
|
20
|
-
* file stat if path exists
|
|
21
|
-
*/
|
|
22
|
-
stat?: Stats;
|
|
23
|
-
path: string;
|
|
24
|
-
isDirectory?: boolean;
|
|
25
|
-
}
|
|
26
|
-
declare module 'egg' {
|
|
27
|
-
interface EggApplicationCore {
|
|
28
|
-
watcher: Watcher;
|
|
29
|
-
}
|
|
30
|
-
interface EggAppConfig {
|
|
31
|
-
watcher?: WatcherConfig;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
//#endregion
|
|
35
|
-
export { ChangeInfo, WatcherConfig };
|
|
File without changes
|