@we-debug/gulp-tool 0.31.4 → 0.31.6

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
@@ -3,6 +3,29 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.31.6](https://github.com/dlhandsome/we-debug/compare/v0.31.5...v0.31.6) (2024-01-17)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **gulp-tool:** fixed typo ([7eb90c3](https://github.com/dlhandsome/we-debug/commit/7eb90c31376cc27bcbbccdee6c273058256549a7))
12
+
13
+
14
+
15
+
16
+
17
+ ## [0.31.5](https://github.com/dlhandsome/we-debug/compare/v0.31.4...v0.31.5) (2024-01-16)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * fixed type ([ca4ad26](https://github.com/dlhandsome/we-debug/commit/ca4ad26a6b8e208a6597aca0b1ce5661ac8d502b))
23
+ * **gulp-tool:** fixed type ([5b9f2f0](https://github.com/dlhandsome/we-debug/commit/5b9f2f0bb93c2340e0f0871c509706c06a79673e))
24
+
25
+
26
+
27
+
28
+
6
29
  ## [0.31.4](https://github.com/dlhandsome/we-debug/compare/v0.31.3...v0.31.4) (2024-01-16)
7
30
 
8
31
 
package/dist/plugin.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { IRegistration, IPackageOption, IAnyObject, IPlugin, PackageParam } from './types';
1
+ import { IRegistration, ICompilerPluginOption, IPlugin, ICompilerPluginPackageOption, Meta } from './types';
2
2
  import File from 'vinyl';
3
3
  declare class Plugin implements IPlugin {
4
4
  lifecycles: IRegistration[];
5
- meta: IAnyObject;
5
+ meta: Meta;
6
6
  getLifecycles(): IRegistration[];
7
7
  register(options: IRegistration): void;
8
8
  execLifecycle(lifetime: keyof IRegistration, file: File): void;
9
- loadPlugin(pkg: PackageParam): any;
10
- initPlugin(packges: IPackageOption[], meta: IAnyObject): void;
9
+ loadPlugin(pkg: ICompilerPluginPackageOption): any;
10
+ initPlugin(packges: ICompilerPluginOption[], meta: Meta): void;
11
11
  }
12
12
  declare const _default: Plugin;
13
13
  export default _default;
package/dist/plugin.js CHANGED
@@ -8,7 +8,9 @@ var PLUGIN_NAME = '@we-debug/gulp-tool';
8
8
  var Plugin = (function () {
9
9
  function Plugin() {
10
10
  this.lifecycles = [];
11
- this.meta = {};
11
+ this.meta = {
12
+ pages: []
13
+ };
12
14
  }
13
15
  Plugin.prototype.getLifecycles = function () {
14
16
  return this.lifecycles;
package/dist/types.d.ts CHANGED
@@ -27,27 +27,30 @@ export interface IRegistration {
27
27
  afterInsertScript?: ProcessDefine;
28
28
  }
29
29
  export type FilterOption = string | Function | RegExp;
30
- export interface IPlugin {
30
+ export type Meta<T extends IAnyObject = IAnyObject> = ICompilerOption<T> & {
31
+ pages: string[];
32
+ };
33
+ export interface IPlugin<T extends IAnyObject = IAnyObject> {
31
34
  lifecycles: IRegistration[];
32
- meta: IAnyObject;
35
+ meta: Meta<T>;
33
36
  register(options: IRegistration): void;
34
37
  getLifecycles(): IRegistration[];
35
38
  execLifecycle(lifetime: keyof IRegistration, file: File): void;
36
- loadPlugin(pkg: string | PackageFunc): void;
37
- initPlugin(packges: IPackageOption[], meta: IAnyObject): void;
39
+ loadPlugin(pkg: string | ICompilerPluginPackage): void;
40
+ initPlugin(packges: ICompilerPluginOption<T>[], meta: Meta): void;
38
41
  }
39
- export type PackageFunc = (register: IPlugin, options: IAnyObject) => void;
40
- export type PackageParam = string | PackageFunc;
41
- export interface IPackageOption {
42
- package: PackageParam;
43
- options: IAnyObject;
42
+ export type ICompilerPluginPackage<T extends IAnyObject = IAnyObject> = (register: IPlugin, options: T) => void;
43
+ export type ICompilerPluginPackageOption<T extends IAnyObject = IAnyObject> = string | ICompilerPluginPackage<T>;
44
+ export interface ICompilerPluginOption<T extends IAnyObject = IAnyObject> {
45
+ package: ICompilerPluginPackageOption<T>;
46
+ options: T;
44
47
  }
45
- export interface ICompilerOption {
48
+ export interface ICompilerOption<T extends IAnyObject = IAnyObject> {
46
49
  baseDir?: string;
47
50
  wxml?: string;
48
51
  filter?: FilterOption;
49
52
  compName?: string;
50
53
  compPath?: string;
51
54
  entryFile?: string;
52
- plugins?: IPackageOption[];
55
+ plugins?: ICompilerPluginOption<T>[];
53
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@we-debug/gulp-tool",
3
- "version": "0.31.4",
3
+ "version": "0.31.6",
4
4
  "description": "we-debug, gulp",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/types.d.ts",
@@ -32,5 +32,5 @@
32
32
  "readme": "ERROR: No README data found!",
33
33
  "_id": "@we-debug/gulp-tool@0.1.3",
34
34
  "_commitid": "f35f53c",
35
- "gitHead": "0026a166d249576c2f1fb351b5229c605f8251b4"
35
+ "gitHead": "4f1d347d1c23c71efd2cea0e6635395f0d0e72b0"
36
36
  }
package/src/plugin.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import PluginError from 'plugin-error';
2
2
  import {
3
3
  IRegistration,
4
- IPackageOption,
5
- IAnyObject,
4
+ ICompilerPluginOption,
6
5
  IPlugin,
7
- PackageParam
6
+ ICompilerPluginPackageOption,
7
+ Meta
8
8
  } from './types';
9
9
  import File from 'vinyl';
10
10
 
@@ -14,7 +14,9 @@ class Plugin implements IPlugin {
14
14
  /** 子插件生命周期 */
15
15
  lifecycles: IRegistration[] = [];
16
16
  /** 插件元信息 */
17
- meta: IAnyObject = {};
17
+ meta: Meta = {
18
+ pages: []
19
+ };
18
20
 
19
21
  getLifecycles() {
20
22
  return this.lifecycles;
@@ -33,7 +35,7 @@ class Plugin implements IPlugin {
33
35
  });
34
36
  }
35
37
 
36
- loadPlugin(pkg: PackageParam) {
38
+ loadPlugin(pkg: ICompilerPluginPackageOption) {
37
39
  if (typeof pkg === 'string') {
38
40
  return require(pkg);
39
41
  }
@@ -43,7 +45,7 @@ class Plugin implements IPlugin {
43
45
  }
44
46
  }
45
47
 
46
- initPlugin(packges: IPackageOption[], meta: IAnyObject) {
48
+ initPlugin(packges: ICompilerPluginOption[], meta: Meta) {
47
49
  this.meta = meta;
48
50
 
49
51
  packges.map(p => {
package/src/types.ts CHANGED
@@ -44,11 +44,13 @@ export interface IRegistration {
44
44
 
45
45
  export type FilterOption = string | Function | RegExp;
46
46
 
47
- export interface IPlugin {
47
+ export type Meta<T extends IAnyObject = IAnyObject> = ICompilerOption<T> & { pages: string[] };
48
+
49
+ export interface IPlugin<T extends IAnyObject = IAnyObject> {
48
50
  /** 插件生命周期钩子声明 */
49
51
  lifecycles: IRegistration[];
50
52
  /** 插件元信息 */
51
- meta: IAnyObject;
53
+ meta: Meta<T>;
52
54
  /** 注册插件 */
53
55
  register(options: IRegistration): void;
54
56
  /** 获取插件生命周期钩子声明 */
@@ -56,30 +58,30 @@ export interface IPlugin {
56
58
  /** 执行插件生命周期钩子声明 */
57
59
  execLifecycle(lifetime: keyof IRegistration, file: File): void;
58
60
  /** 加载插件 */
59
- loadPlugin(pkg: string | PackageFunc): void;
61
+ loadPlugin(pkg: string | ICompilerPluginPackage): void;
60
62
  /** 初始化插件列表 */
61
- initPlugin(packges: IPackageOption[], meta: IAnyObject): void;
63
+ initPlugin(packges: ICompilerPluginOption<T>[], meta: Meta): void;
62
64
  }
63
65
 
64
- export type PackageFunc = (register: IPlugin, options: IAnyObject) => void;
66
+ export type ICompilerPluginPackage<T extends IAnyObject = IAnyObject> = (register: IPlugin, options: T) => void;
65
67
 
66
68
  /**
67
69
  * 插件
68
70
  */
69
- export type PackageParam = string | PackageFunc;
71
+ export type ICompilerPluginPackageOption<T extends IAnyObject = IAnyObject> = string | ICompilerPluginPackage<T>;
70
72
 
71
73
  /**
72
74
  * 插件参数
73
75
  */
74
- export interface IPackageOption {
75
- package: PackageParam;
76
- options: IAnyObject;
76
+ export interface ICompilerPluginOption<T extends IAnyObject = IAnyObject> {
77
+ package: ICompilerPluginPackageOption<T>;
78
+ options: T;
77
79
  }
78
80
 
79
81
  /**
80
82
  * 编译函数入口参数
81
83
  */
82
- export interface ICompilerOption {
84
+ export interface ICompilerOption<T extends IAnyObject = IAnyObject> {
83
85
  /** */
84
86
  baseDir?: string;
85
87
  wxml?: string;
@@ -87,5 +89,5 @@ export interface ICompilerOption {
87
89
  compName?: string;
88
90
  compPath?: string;
89
91
  entryFile?: string;
90
- plugins?: IPackageOption[];
92
+ plugins?: ICompilerPluginOption<T>[];
91
93
  }