minidev 1.9.5 → 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/index.d.ts CHANGED
@@ -6,7 +6,7 @@ declare module 'minidev' {
6
6
  export type DeepPartial<T> = {
7
7
  [P in keyof T]?:T[P] extends Record<any, any> ? DeepPartial<T[P]> : T[P];
8
8
  };
9
-
9
+
10
10
 
11
11
  export interface IConfigInits {
12
12
  defaults: {
@@ -19,18 +19,18 @@ declare module 'minidev' {
19
19
  export interface IMinidevLibDefaults {
20
20
 
21
21
  name: string;
22
-
22
+
23
23
  description: string;
24
-
24
+
25
25
  config: IConfigInits;
26
26
  }
27
-
27
+
28
28
  /**
29
29
  * 配置默认项
30
- * @param overrides
30
+ * @param overrides
31
31
  */
32
32
  export function useDefaults(overrides: DeepPartial<IMinidevLibDefaults>): void;
33
-
33
+
34
34
  export function usePlugin(plugin: IMinidevPlugin): void;
35
35
 
36
36
  export function setSilent(boolean): void;
@@ -42,11 +42,11 @@ declare module 'minidev' {
42
42
  export type MaybePromise<T = void> = T | Promise<T>;
43
43
 
44
44
  export interface IMinidevPlugin {
45
-
45
+
46
46
  name: string,
47
47
 
48
48
  contribute(registry: IMinidevPluginRegistry, injector: { get: (token: any) => any}): void;
49
-
49
+
50
50
  }
51
51
 
52
52
  export interface IMinidevPluginRegistry {
@@ -69,17 +69,17 @@ declare module 'minidev' {
69
69
  * 端参数,用于查询多端版本,不传默认为支付宝端。 高德端:com.amap.app
70
70
  */
71
71
  bundleId?: string;
72
-
72
+
73
73
  appVersion: string;
74
-
74
+
75
75
  versionDescription: string;
76
-
76
+
77
77
  versionStatus: string;
78
-
78
+
79
79
  createTime: string;
80
-
80
+
81
81
  operateName: string;
82
-
82
+
83
83
  canRelease: any;
84
84
  }
85
85
 
@@ -94,33 +94,33 @@ declare module 'minidev' {
94
94
 
95
95
  /**
96
96
  * 构建编译小程序
97
- * @param opts
97
+ * @param opts
98
98
  */
99
99
  build(opts: IBuildArgs): Promise<ILocalBuildCompileBuild>;
100
100
 
101
101
 
102
102
  /**
103
103
  * 启动开发服务器 DevServer
104
- * @param opts
105
- * @param onDone
104
+ * @param opts
105
+ * @param onDone
106
106
  */
107
107
  dev(opts: IDevCommandArgs, onDone?: () => any): Promise<IDevServerCompileBuild>
108
108
 
109
109
  /**
110
110
  * 使用 DevServer 产物发起真机预览 (此模式仅整包, 无法验证分包可用性)
111
111
  * 需要在运行 dev 之后运行
112
- * @param opts
112
+ * @param opts
113
113
  */
114
114
  devPreview(opts: IDevPreviewArgs, build?: IDevServerCompileBuild): Promise<IGenerateDebugQRCodeResult>;
115
115
 
116
-
116
+
117
117
  devWebSimulator(opts:IDevWebSimulatorArgs, build?: IDevServerCompileBuild): Promise<IWebSimulatorLauncher>
118
-
118
+
119
119
 
120
120
  /**
121
121
  * 使用 DevServer 产物发起真机调试 (此模式仅整包, 无法验证分包可用性)
122
122
  * 需要在运行 dev 之后运行
123
- * @param opts
123
+ * @param opts
124
124
  */
125
125
  devRemoteDebug(opts: IDevRemoteDebugArgs, build?: IDevServerCompileBuild): Promise<IRemoteDebugReturn>
126
126
 
@@ -128,19 +128,19 @@ declare module 'minidev' {
128
128
  /**
129
129
  * 启动小程序开发者工具模拟器对 DevServer 产物进行调试
130
130
  * 需要在运行 dev 之后运行
131
- * @param opts
131
+ * @param opts
132
132
  */
133
133
  startIdeForDevServer(opts: IDevIDEOptions, build?: IDevServerCompileBuild): Promise<void>;
134
134
 
135
135
  /**
136
136
  * 进行工具授权
137
- * @param opts
137
+ * @param opts
138
138
  */
139
139
  login(opts: IClientTypeOptions, onCreateLoginTask?: (loginTask: ILoginTask) => void): Promise<void>;
140
140
 
141
141
  /**
142
142
  * 上传发布小程序
143
- * @param opts
143
+ * @param opts
144
144
  * @param @optional hooks
145
145
  */
146
146
  upload(opts: IUploadOptions, hooks?: IPublishHooks): Promise<IPublishResult>;
@@ -148,13 +148,13 @@ declare module 'minidev' {
148
148
 
149
149
  /**
150
150
  * 构建并发起真机预览
151
- * @param opts
151
+ * @param opts
152
152
  */
153
153
  preview(opts: IPreviewArgs): Promise<IGenerateDebugQRCodeResult>;
154
154
 
155
155
  /**
156
156
  * 构建并发起远程调试
157
- * @param opts
157
+ * @param opts
158
158
  */
159
159
  remoteDebug(opts: IRemoteDebugArgs): Promise<IRemoteDebugReturn>
160
160
 
@@ -165,13 +165,13 @@ declare module 'minidev' {
165
165
 
166
166
  /**
167
167
  * 打包源码
168
- * @param opts
168
+ * @param opts
169
169
  */
170
170
  pack(opts: IPackSourceOptions): Promise<void>;
171
171
 
172
172
  /**
173
173
  * 启动 IDE
174
- * @param opts
174
+ * @param opts
175
175
  */
176
176
  startIde(opts: IIDECommandOptions): Promise<void>;
177
177
 
@@ -185,21 +185,21 @@ declare module 'minidev' {
185
185
  * 小程序管理相关操作
186
186
  */
187
187
  app: IMinidevApp
188
-
188
+
189
189
  }
190
190
 
191
191
  export interface ILoginTask {
192
192
 
193
193
  on(event: 'qrcode-generated', listener: (qrCodeUrl: string) => any): any;
194
-
194
+
195
195
  on(event: 'success', listener: () => any): any;
196
-
196
+
197
197
  on(event: 'scan', listener: () => any): any;
198
-
198
+
199
199
  on(event: 'polling', listener: (remainingMs: number) => any): any;
200
-
200
+
201
201
  removeListener(event: string, listener: (...args) => any): any;
202
-
202
+
203
203
  }
204
204
 
205
205
  export interface IRemoteDebugReturn extends IGenerateDebugQRCodeResult{
@@ -211,15 +211,15 @@ declare module 'minidev' {
211
211
  * 停止调试服务
212
212
  */
213
213
  stopServer: () => Promise<void>;
214
-
214
+
215
215
  }
216
216
 
217
217
  export interface IPublishHooks {
218
218
 
219
219
  onLog?:(data: string) => void;
220
-
220
+
221
221
  onTaskCreated?: (taskId: string) => void;
222
-
222
+
223
223
  onVersionCreated?: (version: string) => void;
224
224
  }
225
225
 
@@ -228,7 +228,7 @@ declare module 'minidev' {
228
228
  get<T = any>(configName: string, opts?: IConfigOptions): Promise<T>;
229
229
 
230
230
  set<T = any>(configName: string, value: T, opts?: IConfigOptions): Promise<void>;
231
-
231
+
232
232
  /**
233
233
  * 设置 **RUNTIME** 的配置项
234
234
  */
@@ -239,16 +239,16 @@ declare module 'minidev' {
239
239
  export interface IAppInfo {
240
240
 
241
241
  appId: string;
242
-
242
+
243
243
  appName: string;
244
-
244
+
245
245
  logoUrl: string;
246
-
246
+
247
247
  subApplicationType: 'TINYAPP_NORMAL' | 'TINYAPP_PLUGIN' | 'TINYAPP_TEMPLATE'
248
248
  }
249
249
 
250
250
  export interface IGetAppUploadedVersionArgs extends IAppIdArgs, IClientTypeOptions, IAuthPathOptions {
251
-
251
+
252
252
  }
253
253
 
254
254
  export interface IVersionListOptions extends IAppIdArgs, IClientTypeOptions, IAuthPathOptions {
@@ -257,7 +257,7 @@ declare module 'minidev' {
257
257
  * 版本状态列表
258
258
  */
259
259
  versionStatus?: string;
260
-
260
+
261
261
  /**
262
262
  * 以 JSON 格式打印
263
263
  */
@@ -268,39 +268,39 @@ declare module 'minidev' {
268
268
 
269
269
  /**
270
270
  * 获取小程序列表
271
- * @param options
271
+ * @param options
272
272
  */
273
273
  getList(options: IClientTypeOptions): Promise<IAppInfo>;
274
274
 
275
275
  /**
276
276
  * 获取小程序的最新上传版本号
277
- * @param options
277
+ * @param options
278
278
  */
279
279
  getUploadedVersion(options: IGetAppUploadedVersionArgs): Promise<string>;
280
-
280
+
281
281
 
282
282
  /**
283
283
  * 获取小程序的上传版本列表
284
- * @param options
284
+ * @param options
285
285
  */
286
286
  getUploadedVersionList(options: IVersionListOptions): Promise<IVersionListResult>;
287
-
287
+
288
288
  /**
289
289
  * 删除指定版本
290
290
  * 如果该版本为体验版,会先取消该体验版
291
- * @param options
291
+ * @param options
292
292
  */
293
293
  deleteVersion(options: IAppIdAndVersionOptions): Promise<void>;
294
294
 
295
295
  /**
296
296
  * 取消体验版
297
- * @param options
297
+ * @param options
298
298
  */
299
299
  cancelExperience(options: IAppIdAndVersionOptions): Promise<void>;
300
300
 
301
301
  /**
302
302
  * 设置体验版
303
- * @param options
303
+ * @param options
304
304
  * @return qrCodeUrl 体验版二维码
305
305
  */
306
306
  setExperience(options: IAppIdAndVersionOptions): Promise<{qrCodeUrl: string}>;
@@ -313,9 +313,9 @@ declare module 'minidev' {
313
313
  }
314
314
 
315
315
  export interface IWebSimulatorLauncher {
316
-
316
+
317
317
  bundled: string;
318
-
318
+
319
319
  /**
320
320
  * 这里返回的 simulator 和 devtool 均为不含 uuid 的模板地址
321
321
  * 如何使用:
@@ -329,9 +329,9 @@ declare module 'minidev' {
329
329
  }
330
330
 
331
331
  export interface IConfigOptions extends IProjectArgs {
332
-
332
+
333
333
  scope?: ConfigScope.GLOBAL | ConfigScope.PROJECT;
334
-
334
+
335
335
  }
336
336
 
337
337
  export enum ConfigScope {
@@ -340,12 +340,12 @@ declare module 'minidev' {
340
340
  * 用户配置
341
341
  */
342
342
  GLOBAL = 'global',
343
-
343
+
344
344
  /**
345
345
  * 当前项目的配置
346
346
  */
347
347
  PROJECT = 'project',
348
-
348
+
349
349
  }
350
350
 
351
351
  export interface IDevPreviewArgs extends IGenerateQrCodeArgs, IAppIdArgs, IAuthPathOptions {
@@ -360,7 +360,7 @@ declare module 'minidev' {
360
360
  autoOpen?: boolean;
361
361
 
362
362
  lyraParams?: ILyraParams;
363
-
363
+
364
364
  }
365
365
 
366
366
  export interface ILyraParams {
@@ -373,27 +373,27 @@ declare module 'minidev' {
373
373
  * @deprecated 同 ignoreHttpDomainCheck
374
374
  */
375
375
  ignoreHttpReqPermission?: boolean;
376
-
376
+
377
377
  /**
378
378
  * 忽略 http 请求白名单校验
379
379
  */
380
380
  ignoreHttpDomainCheck?: boolean;
381
-
381
+
382
382
  /**
383
383
  * 忽略 webview 加载域名白名单校验
384
384
  */
385
385
  ignoreWebViewDomainCheck?: boolean;
386
-
386
+
387
387
  /**
388
388
  * 是否自动推送到客户端
389
389
  */
390
390
  autoPush?: boolean;
391
-
391
+
392
392
  /**
393
393
  * 自定义启动参数
394
394
  */
395
395
  launchParams?: any;
396
-
396
+
397
397
  }
398
398
 
399
399
  export interface ICompileModeOptions {
@@ -402,27 +402,27 @@ declare module 'minidev' {
402
402
  * 入口页面
403
403
  */
404
404
  page?: string;
405
-
405
+
406
406
  /**
407
407
  * 页面参数, 可在当前页面的 onLoad 中取得,如: name=vendor&color=black
408
408
  */
409
409
  pageQuery?: string;
410
-
410
+
411
411
  /**
412
- * 全局参数,app.js 的 onLaunch 中取得,如: name=vendor&color=black
412
+ * 全局参数,app.js 的 onLaunch 中取得,如: name=vendor&color=black
413
413
  */
414
414
  query?: string;
415
-
415
+
416
416
  /**
417
417
  * 场景值
418
418
  */
419
419
  scene?: string;
420
-
420
+
421
421
  /**
422
422
  * 模拟更新
423
423
  */
424
424
  simulateUpdate?: boolean;
425
-
425
+
426
426
  }
427
427
 
428
428
  export interface IAMPEOptions {
@@ -431,17 +431,17 @@ declare module 'minidev' {
431
431
  * 移动应用 ID
432
432
  */
433
433
  ampeProductId?: string;
434
-
434
+
435
435
  /**
436
436
  * 设备 ID
437
437
  */
438
438
  ampeDeviceId?: string;
439
-
439
+
440
440
  /**
441
441
  * 产品 ID
442
442
  */
443
443
  ampeHostAppId?: string;
444
-
444
+
445
445
  }
446
446
 
447
447
  export interface IClientTypeOptions {
@@ -458,45 +458,40 @@ declare module 'minidev' {
458
458
 
459
459
  }
460
460
 
461
-
461
+
462
462
  export interface IDevCommandArgs extends IBuildArgs {
463
463
 
464
-
464
+
465
465
  /**
466
466
  * 是否开启 HMR
467
467
  */
468
468
  hmr?: boolean;
469
-
469
+
470
470
  /**
471
471
  * 是否启用 https
472
472
  */
473
473
  // https?: boolean;
474
-
474
+
475
475
  /**
476
- * 指定 Host,默认 Host 为 127.0.0.1
476
+ * 指定 Host,默认 Host 为 127.0.0.1
477
477
  */
478
478
  host?: string,
479
-
479
+
480
480
  /**
481
481
  * devServer 的端口号
482
482
  */
483
483
  port?: number,
484
-
485
-
484
+
485
+
486
486
  /**
487
487
  * log 名,api 调用时使用
488
488
  */
489
489
  logName?: string;
490
-
490
+
491
491
  }
492
-
493
492
 
494
- export interface IBuildArgs extends IProjectArgs, IOptionalAppIdArgs {
495
- /**
496
- * 强制构建类别,可选值为 v1, v2
497
- */
498
- appxv?: 'v1' | 'v2' | 'legacy-v1';
499
493
 
494
+ export interface IBuildArgs extends IProjectArgs, IOptionalAppIdArgs {
500
495
  /**
501
496
  * 指定构建缓存路径, 默认为系统缓存路径
502
497
  */
@@ -527,12 +522,6 @@ declare module 'minidev' {
527
522
  */
528
523
  minify?: boolean;
529
524
 
530
- /**
531
- * @deprecated
532
- * 一键设置使用 Appx 2.0,--appxv 优先级更高
533
- */
534
- ng?: boolean;
535
-
536
525
  /**
537
526
  * 构建类型
538
527
  */
@@ -567,14 +556,14 @@ declare module 'minidev' {
567
556
  export interface IOptionalAppIdArgs {
568
557
 
569
558
  /**
570
- * 小程序应用 id
559
+ * 小程序应用 id
571
560
  */
572
561
  appId?: string;
573
562
 
574
563
  }
575
564
 
576
565
  export interface IDevServerCompileBuild {
577
-
566
+
578
567
  devServer: IDevServer;
579
568
 
580
569
  project: string;
@@ -586,7 +575,7 @@ declare module 'minidev' {
586
575
  export interface IAppIdArgs extends IOptionalAppIdArgs {
587
576
 
588
577
  /**
589
- * 小程序应用 id
578
+ * 小程序应用 id
590
579
  */
591
580
  appId: string;
592
581
 
@@ -609,74 +598,74 @@ declare module 'minidev' {
609
598
  * devServer 的产物路径
610
599
  */
611
600
  dist: string;
612
-
601
+
613
602
  /**
614
603
  * devServer 启动
615
- * @param event
616
- * @param listener
604
+ * @param event
605
+ * @param listener
617
606
  */
618
607
  on(event: 'start', listener: () => any): this;
619
608
 
620
609
  /**
621
610
  * 开始编译
622
- * @param event
623
- * @param listener
611
+ * @param event
612
+ * @param listener
624
613
  */
625
614
  on(event: 'compile', listener: () => any): this;
626
615
 
627
616
  /**
628
617
  * 编译成功完成
629
- * @param event
630
- * @param listener
618
+ * @param event
619
+ * @param listener
631
620
  */
632
621
  on(event: 'done', listener: (result: IDevDone) => any): this;
633
622
 
634
623
  /**
635
624
  * 编译出错
636
- * @param event
637
- * @param listener
625
+ * @param event
626
+ * @param listener
638
627
  */
639
628
  on(event: 'error', listener: (error: IDevError) => any): this;
640
-
629
+
641
630
  /**
642
631
  * devServer 进程被关闭
643
- * @param event
644
- * @param listener
632
+ * @param event
633
+ * @param listener
645
634
  */
646
635
  on(event: 'exit', listener: (code?: number) => any): this;
647
636
 
648
637
  /**
649
638
  * 开启 hmr 时,当 hmr 完成会发送这个事件
650
- * @param event
651
- * @param listener
639
+ * @param event
640
+ * @param listener
652
641
  */
653
642
  on(event: 'hmr-done', listener: () => any): this;
654
-
643
+
655
644
  /**
656
645
  * 开启 hmr 时,当 hmr 出错时会发送这个事件
657
- * @param event
658
- * @param listener
646
+ * @param event
647
+ * @param listener
659
648
  */
660
649
  on(event: 'hmr-error', listener: (error: IDevError) => any): this;
661
650
 
662
651
  /**
663
652
  * 发生在 mini.project.json 文件被变更的时候, 这种时机一般期望重新启动 devServer
664
- * @param event
653
+ * @param event
665
654
  */
666
655
  on(event: 'project-config-change', listener: () => any): this;
667
656
 
668
657
  /**
669
658
  * devServer 输出日志
670
- * @param event
659
+ * @param event
671
660
  */
672
661
  on(event: 'log', listener: (data: string) => any): this;
673
662
 
674
663
 
675
-
664
+
676
665
  once(event: 'start', listener: () => any): this;
677
666
  once(event: 'compile', listener: () => any): this;
678
667
  once(event: 'done', listener: (result: IDevDone) => any): this;
679
- once(event: 'error', listener: (error: IDevError) => any): this;
668
+ once(event: 'error', listener: (error: IDevError) => any): this;
680
669
  once(event: 'exit', listener: (code?: number) => any): this;
681
670
  once(event: 'hmr-done', listener: () => any): this;
682
671
  once(event: 'hmr-error', listener: (error: IDevError) => any): this;
@@ -702,45 +691,45 @@ declare module 'minidev' {
702
691
  message: string;
703
692
  stack?: any;
704
693
  }
705
-
694
+
706
695
  export interface IDevDone {
707
696
  success: boolean;
708
697
  }
709
-
698
+
710
699
 
711
700
  export interface IDevIDEOptions extends IOptionalAppIdArgs, IIDECommandOptions {
712
701
 
713
702
  }
714
703
 
715
704
  export interface IGenerateDebugQRCodeResult {
716
-
705
+
717
706
  /**
718
707
  * 二维码
719
708
  */
720
709
  qrcodeUrl: string;
721
710
  /**
722
- *
711
+ *
723
712
  */
724
713
  qrcodeSchema?: string;
725
-
714
+
726
715
  /**
727
716
  * 生成的版本号
728
717
  */
729
718
  version: string;
730
- }
731
-
719
+ }
720
+
732
721
  export interface IIDECommandOptions extends IProjectArgs {
733
722
 
734
723
  /**
735
724
  * lite 模式启动
736
725
  */
737
726
  lite?: boolean;
738
-
727
+
739
728
  /**
740
- * 项目类型
729
+ * 项目类型
741
730
  */
742
731
  projectType?: string
743
-
732
+
744
733
  /**
745
734
  * IDE 安装路径
746
735
  */
@@ -748,35 +737,35 @@ declare module 'minidev' {
748
737
  }
749
738
 
750
739
  export interface IDevRemoteDebugArgs extends IGenerateQrCodeArgs, IAppIdArgs, IAuthPathOptions {
751
-
740
+
752
741
  /**
753
742
  * 是否自动打开 devtool,cli 模式默认自动打开, jsApi 调用默认不打开
754
743
  */
755
744
  autoOpenDevtool?: boolean;
756
-
745
+
757
746
  }
758
-
747
+
759
748
  export interface IPublishResult {
760
749
 
761
750
  version: string;
762
-
751
+
763
752
  /**
764
753
  * 如果设置为体验版,则添加这个字段,为体验包二维码
765
754
  */
766
755
  experienceQrCodeUrl?: string;
767
-
756
+
768
757
  }
769
758
 
770
759
  export interface IUploadOptions extends IAppIdArgs, IClientTypeOptions, IProjectArgs, IAuthPathOptions {
771
-
760
+
772
761
  /**
773
762
  * 上传的版本号,如果不传入,会尝试从后台拉取版本后自动添加一位 patch 号 (例: 1.1.1 => 1.1.2)
774
763
  * 参考语义化版本:
775
764
  * [major].[minor].[patch]
776
765
  */
777
766
  version?: string;
778
-
779
-
767
+
768
+
780
769
  /**
781
770
  * 上传成功后,自动设置为体验版本 (需要对应权限)
782
771
  */
@@ -786,12 +775,12 @@ declare module 'minidev' {
786
775
  * 上传时删除指定版本号
787
776
  */
788
777
  deleteVersion?: string;
789
-
778
+
790
779
  /**
791
780
  * 是否小游戏
792
781
  */
793
782
  isGame?: boolean;
794
-
783
+
795
784
  /**
796
785
  * 版本描述,用于在开放平台显示
797
786
  */
@@ -801,22 +790,22 @@ declare module 'minidev' {
801
790
  export interface IPreviewArgs extends IBuildArgs, IGenerateQrCodeArgs, IAuthPathOptions {
802
791
 
803
792
  /**
804
- * 小程序应用 id
793
+ * 小程序应用 id
805
794
  */
806
795
  appId: string;
807
-
796
+
808
797
  }
809
798
 
810
799
  export interface ILocalBuildCompileBuild {
811
-
800
+
812
801
  result: TBuildPackResult
813
-
802
+
814
803
  project: string;
815
-
804
+
816
805
  dist: string;
817
-
806
+
818
807
  buildTarget: EBuildTarget;
819
-
808
+
820
809
  }
821
810
 
822
811
  export type TBuildPackResult = INormalBuildPackResult | ISubPackBuildPackResult | IPluginBuildPackResult;
@@ -887,9 +876,9 @@ declare module 'minidev' {
887
876
  }
888
877
 
889
878
  export interface IRemoteDebugArgs extends IBuildArgs, IGenerateQrCodeArgs, IAuthPathOptions {
890
-
879
+
891
880
  /**
892
- * 小程序应用 id
881
+ * 小程序应用 id
893
882
  */
894
883
  appId: string;
895
884
 
@@ -897,7 +886,7 @@ declare module 'minidev' {
897
886
  * 是否自动打开 devtool,cli 模式默认自动打开, jsApi 调用默认不打开
898
887
  */
899
888
  autoOpenDevtool?: boolean;
900
-
889
+
901
890
  }
902
891
 
903
892
  export interface IPackSourceOptions extends IProjectArgs {
@@ -906,12 +895,12 @@ declare module 'minidev' {
906
895
  * 输出文件夹
907
896
  */
908
897
  dir?: string;
909
-
898
+
910
899
  /**
911
900
  * 输出文件名
912
901
  */
913
902
  filename?: string;
914
-
903
+
915
904
  }
916
905
 
917
906
  }