@modern-js/utils 1.1.4 → 1.1.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @modern-js/utils
2
2
 
3
+ ## 1.1.5
4
+
5
+ ### Patch Changes
6
+
7
+ - ca7dcb32: change watch logic
8
+
3
9
  ## 1.1.4
4
10
 
5
11
  ### Patch Changes
@@ -8,7 +8,7 @@ export const WatchChangeType = {
8
8
  };
9
9
  export const watch = (watchDir, runTask, ignored = []) => {
10
10
  let ready = false;
11
- const watcher = chokidar.watch(`${watchDir}/**/*.{js,jsx,ts,tsx}`, {
11
+ const watcher = chokidar.watch(watchDir, {
12
12
  ignored
13
13
  });
14
14
  watcher.on('ready', () => ready = true);
@@ -24,7 +24,7 @@ exports.WatchChangeType = WatchChangeType;
24
24
 
25
25
  const watch = (watchDir, runTask, ignored = []) => {
26
26
  let ready = false;
27
- const watcher = chokidar.watch(`${watchDir}/**/*.{js,jsx,ts,tsx}`, {
27
+ const watcher = chokidar.watch(watchDir, {
28
28
  ignored
29
29
  });
30
30
  watcher.on('ready', () => ready = true);
@@ -15,7 +15,7 @@ export var WatchChangeType = {
15
15
  export var watch = function watch(watchDir, runTask) {
16
16
  var ignored = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
17
17
  var ready = false;
18
- var watcher = chokidar.watch("".concat(watchDir, "/**/*.{js,jsx,ts,tsx}"), {
18
+ var watcher = chokidar.watch(watchDir, {
19
19
  ignored: ignored
20
20
  });
21
21
  watcher.on('ready', function () {
@@ -4,5 +4,5 @@ declare type RunTaskType = (option: {
4
4
  changedFilePath: string;
5
5
  changeType: WatchChangeTypeValueT;
6
6
  }) => void | Promise<void>;
7
- export declare const watch: (watchDir: string, runTask: RunTaskType, ignored?: string[]) => import("chokidar").FSWatcher;
7
+ export declare const watch: (watchDir: string | string[], runTask: RunTaskType, ignored?: string[]) => import("chokidar").FSWatcher;
8
8
  export {};
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.1.4",
14
+ "version": "1.1.5",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -66,7 +66,7 @@
66
66
  "typescript": "^4",
67
67
  "webpack": "^5.54.0",
68
68
  "@modern-js/plugin-testing": "^1.1.1",
69
- "@modern-js/module-tools": "^1.1.1"
69
+ "@modern-js/module-tools": "^1.1.2"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "typescript": "^4.4.3"
package/src/watch.ts CHANGED
@@ -20,12 +20,12 @@ type RunTaskType = (option: {
20
20
  }) => void | Promise<void>;
21
21
 
22
22
  export const watch = (
23
- watchDir: string,
23
+ watchDir: string | string[],
24
24
  runTask: RunTaskType,
25
25
  ignored: string[] = [],
26
26
  ) => {
27
27
  let ready = false;
28
- const watcher = chokidar.watch(`${watchDir}/**/*.{js,jsx,ts,tsx}`, {
28
+ const watcher = chokidar.watch(watchDir, {
29
29
  ignored,
30
30
  });
31
31