webext-schema 5.1.13 → 5.1.15
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/modules/browser.js +0 -59
- package/modules/commander.js +0 -2
- package/modules/common.js +0 -7
- package/modules/file-util.js +0 -14
- package/modules/schema.js +0 -13
- package/modules/update.js +0 -10
- package/package.json +10 -10
- package/schemas/beta/webext.json +11 -10
- package/schemas/central/webext.json +11 -10
- package/schemas/mail/mailext.json +274 -23
- package/schemas/release/webext.json +43 -8
package/modules/browser.js
CHANGED
|
@@ -10,7 +10,6 @@ const { permissions, runtime, tabs, windows } = browser;
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* check if permission is granted
|
|
13
|
-
*
|
|
14
13
|
* @param {object} perm - permissions.Permission
|
|
15
14
|
* @returns {Promise.<boolean>} - result
|
|
16
15
|
*/
|
|
@@ -22,7 +21,6 @@ export const isPermissionGranted = async perm => {
|
|
|
22
21
|
/* bookmarks */
|
|
23
22
|
/**
|
|
24
23
|
* create bookmark
|
|
25
|
-
*
|
|
26
24
|
* @param {object} opt - bookmarks.CreateDetails
|
|
27
25
|
* @returns {Promise.<object>} - bookmarks.BookmarkTreeNode
|
|
28
26
|
*/
|
|
@@ -40,7 +38,6 @@ export const createBookmark = async opt => {
|
|
|
40
38
|
|
|
41
39
|
/**
|
|
42
40
|
* get bookmark tree node
|
|
43
|
-
*
|
|
44
41
|
* @param {string|Array} [id] - bookmark ID or array of bookmark IDs
|
|
45
42
|
* @returns {Promise.<?Array>} - array of bookmarks.BookmarkTreeNode
|
|
46
43
|
*/
|
|
@@ -65,7 +62,6 @@ export const getBookmarkTreeNode = async id => {
|
|
|
65
62
|
/* browserSettings */
|
|
66
63
|
/**
|
|
67
64
|
* get closeTabsByDoubleClick user value
|
|
68
|
-
*
|
|
69
65
|
* @returns {Promise.<object>} - user value
|
|
70
66
|
*/
|
|
71
67
|
export const getCloseTabsByDoubleClickValue = async () => {
|
|
@@ -82,7 +78,6 @@ export const getCloseTabsByDoubleClickValue = async () => {
|
|
|
82
78
|
|
|
83
79
|
/**
|
|
84
80
|
* set context menu on mouseup
|
|
85
|
-
*
|
|
86
81
|
* @returns {Promise.<boolean>} - result
|
|
87
82
|
*/
|
|
88
83
|
export const setContextMenuOnMouseup = async () => {
|
|
@@ -106,7 +101,6 @@ export const setContextMenuOnMouseup = async () => {
|
|
|
106
101
|
|
|
107
102
|
/**
|
|
108
103
|
* clear context menu on mouseup
|
|
109
|
-
*
|
|
110
104
|
* @returns {Promise.<boolean>} - result
|
|
111
105
|
*/
|
|
112
106
|
export const clearContextMenuOnMouseup = async () => {
|
|
@@ -123,7 +117,6 @@ export const clearContextMenuOnMouseup = async () => {
|
|
|
123
117
|
|
|
124
118
|
/**
|
|
125
119
|
* get new tab position value
|
|
126
|
-
*
|
|
127
120
|
* @returns {Promise.<object>} - result
|
|
128
121
|
*/
|
|
129
122
|
export const getNewTabPositionValue = async () => {
|
|
@@ -141,7 +134,6 @@ export const getNewTabPositionValue = async () => {
|
|
|
141
134
|
/* commands */
|
|
142
135
|
/**
|
|
143
136
|
* is command customizable
|
|
144
|
-
*
|
|
145
137
|
* @returns {Promise.<boolean>} - result
|
|
146
138
|
*/
|
|
147
139
|
export const isCommandCustomizable = async () => {
|
|
@@ -159,7 +151,6 @@ export const isCommandCustomizable = async () => {
|
|
|
159
151
|
|
|
160
152
|
/**
|
|
161
153
|
* update command
|
|
162
|
-
*
|
|
163
154
|
* @param {string} id - command ID
|
|
164
155
|
* @param {string} value - key value
|
|
165
156
|
* @returns {Promise.<?void>} - commands.update() | commands.reset()
|
|
@@ -191,7 +182,6 @@ export const updateCommand = async (id, value = '') => {
|
|
|
191
182
|
/* contextualIdentities */
|
|
192
183
|
/**
|
|
193
184
|
* get all contextual identities
|
|
194
|
-
*
|
|
195
185
|
* @returns {Promise.<?Array>} - array of contextualIdentities.ContextualIdentity
|
|
196
186
|
*/
|
|
197
187
|
export const getAllContextualIdentities = async () => {
|
|
@@ -208,7 +198,6 @@ export const getAllContextualIdentities = async () => {
|
|
|
208
198
|
|
|
209
199
|
/**
|
|
210
200
|
* get contextual identities
|
|
211
|
-
*
|
|
212
201
|
* @param {string} cookieStoreId - cookie store ID
|
|
213
202
|
* @returns {Promise.<object>} - contextualIdentities.ContextualIdentity
|
|
214
203
|
*/
|
|
@@ -230,7 +219,6 @@ export const getContextualId = async cookieStoreId => {
|
|
|
230
219
|
/* management */
|
|
231
220
|
/**
|
|
232
221
|
* get enabled theme
|
|
233
|
-
*
|
|
234
222
|
* @returns {Promise.<?Array>} - array of management.ExtensionInfo
|
|
235
223
|
*/
|
|
236
224
|
export const getEnabledTheme = async () => {
|
|
@@ -250,7 +238,6 @@ export const getEnabledTheme = async () => {
|
|
|
250
238
|
|
|
251
239
|
/**
|
|
252
240
|
* get extension info
|
|
253
|
-
*
|
|
254
241
|
* @param {string} id - extension ID
|
|
255
242
|
* @returns {Promise.<object>} - management.extensionInfo
|
|
256
243
|
*/
|
|
@@ -271,7 +258,6 @@ export const getExtensionInfo = async id => {
|
|
|
271
258
|
|
|
272
259
|
/**
|
|
273
260
|
* get external extensions
|
|
274
|
-
*
|
|
275
261
|
* @returns {Promise.<?Array|boolean>} - array of management.extensionInfo
|
|
276
262
|
*/
|
|
277
263
|
export const getExternalExtensions = async () => {
|
|
@@ -292,7 +278,6 @@ export const getExternalExtensions = async () => {
|
|
|
292
278
|
/* notifications */
|
|
293
279
|
/**
|
|
294
280
|
* clear notification
|
|
295
|
-
*
|
|
296
281
|
* @param {string} id - notification ID
|
|
297
282
|
* @returns {Promise.<?boolean>} - notifications.clear()
|
|
298
283
|
*/
|
|
@@ -313,7 +298,6 @@ export const clearNotification = async id => {
|
|
|
313
298
|
|
|
314
299
|
/**
|
|
315
300
|
* create notification
|
|
316
|
-
*
|
|
317
301
|
* @param {string} id - notification ID
|
|
318
302
|
* @param {object} opt - options
|
|
319
303
|
* @returns {Promise.<?string>} - notifications.create()
|
|
@@ -339,7 +323,6 @@ export const createNotification = async (id, opt) => {
|
|
|
339
323
|
/* permissions */
|
|
340
324
|
/**
|
|
341
325
|
* remove permission
|
|
342
|
-
*
|
|
343
326
|
* @param {string|Array} perm - permission
|
|
344
327
|
* @returns {Promise.<boolean>} - result
|
|
345
328
|
*/
|
|
@@ -362,7 +345,6 @@ export const removePermission = async perm => {
|
|
|
362
345
|
|
|
363
346
|
/**
|
|
364
347
|
* request permission
|
|
365
|
-
*
|
|
366
348
|
* @param {string|Array} perm - permission
|
|
367
349
|
* @returns {Promise.<boolean>} - result
|
|
368
350
|
*/
|
|
@@ -386,7 +368,6 @@ export const requestPermission = async perm => {
|
|
|
386
368
|
/* runtime */
|
|
387
369
|
/**
|
|
388
370
|
* get manifest icons
|
|
389
|
-
*
|
|
390
371
|
* @returns {object|string} - icons
|
|
391
372
|
*/
|
|
392
373
|
export const getManifestIcons = () => {
|
|
@@ -396,7 +377,6 @@ export const getManifestIcons = () => {
|
|
|
396
377
|
|
|
397
378
|
/**
|
|
398
379
|
* get manifest version
|
|
399
|
-
*
|
|
400
380
|
* @returns {number} - version
|
|
401
381
|
*/
|
|
402
382
|
export const getManifestVersion = () => {
|
|
@@ -406,7 +386,6 @@ export const getManifestVersion = () => {
|
|
|
406
386
|
|
|
407
387
|
/**
|
|
408
388
|
* get OS
|
|
409
|
-
*
|
|
410
389
|
* @returns {Promise.<string>} - OS
|
|
411
390
|
*/
|
|
412
391
|
export const getOs = async () => {
|
|
@@ -416,7 +395,6 @@ export const getOs = async () => {
|
|
|
416
395
|
|
|
417
396
|
/**
|
|
418
397
|
* make a connection
|
|
419
|
-
*
|
|
420
398
|
* @param {number|string} [id] - tab ID / extension ID / host name
|
|
421
399
|
* @param {object|boolean} [info] - connection info / connect to native app
|
|
422
400
|
* @returns {Promise.<object>} - runtime.Port
|
|
@@ -449,7 +427,6 @@ export const makeConnection = async (id, info) => {
|
|
|
449
427
|
|
|
450
428
|
/**
|
|
451
429
|
* send message
|
|
452
|
-
*
|
|
453
430
|
* @param {number|string} id - tab ID / extension ID
|
|
454
431
|
* @param {*} msg - message
|
|
455
432
|
* @param {object} opt - options
|
|
@@ -475,7 +452,6 @@ export const sendMessage = async (id, msg, opt) => {
|
|
|
475
452
|
/* scripting */
|
|
476
453
|
/**
|
|
477
454
|
* is scripting available
|
|
478
|
-
*
|
|
479
455
|
* @returns {Promise.<boolean>} - result
|
|
480
456
|
*/
|
|
481
457
|
export const isScriptingAvailable = async () => {
|
|
@@ -492,7 +468,6 @@ export const isScriptingAvailable = async () => {
|
|
|
492
468
|
|
|
493
469
|
/**
|
|
494
470
|
* execute script to tab
|
|
495
|
-
*
|
|
496
471
|
* @param {object} opt - options
|
|
497
472
|
* @returns {Promise.<?Array|boolean>} - array of InjectionResult object
|
|
498
473
|
*/
|
|
@@ -523,7 +498,6 @@ export const executeScriptToTab = async (opt = {}) => {
|
|
|
523
498
|
/* search */
|
|
524
499
|
/**
|
|
525
500
|
* search with a search engine
|
|
526
|
-
*
|
|
527
501
|
* @param {string} query - search query
|
|
528
502
|
* @param {object} opt - options
|
|
529
503
|
* @returns {Promise.<void>} - void
|
|
@@ -545,7 +519,6 @@ export const searchWithSearchEngine = async (query, opt = {}) => {
|
|
|
545
519
|
/* sessions */
|
|
546
520
|
/**
|
|
547
521
|
* get recently closed tab
|
|
548
|
-
*
|
|
549
522
|
* @param {number} [windowId] - window ID
|
|
550
523
|
* @returns {Promise.<object>} - tabs.Tab
|
|
551
524
|
*/
|
|
@@ -578,7 +551,6 @@ export const getRecentlyClosedTab = async windowId => {
|
|
|
578
551
|
|
|
579
552
|
/**
|
|
580
553
|
* get session window value
|
|
581
|
-
*
|
|
582
554
|
* @param {string} key - key
|
|
583
555
|
* @param {number} [windowId] - window ID
|
|
584
556
|
* @returns {Promise.<?string>} - value
|
|
@@ -603,7 +575,6 @@ export const getSessionWindowValue = async (key, windowId) => {
|
|
|
603
575
|
|
|
604
576
|
/**
|
|
605
577
|
* restore session
|
|
606
|
-
*
|
|
607
578
|
* @param {string} sessionId - session ID
|
|
608
579
|
* @returns {Promise.<object>} - sessions.Session
|
|
609
580
|
*/
|
|
@@ -624,7 +595,6 @@ export const restoreSession = async sessionId => {
|
|
|
624
595
|
|
|
625
596
|
/**
|
|
626
597
|
* set session window value
|
|
627
|
-
*
|
|
628
598
|
* @param {string} key - key
|
|
629
599
|
* @param {string|object} value - value
|
|
630
600
|
* @param {number} [windowId] - window ID
|
|
@@ -649,7 +619,6 @@ export const setSessionWindowValue = async (key, value, windowId) => {
|
|
|
649
619
|
/* storage */
|
|
650
620
|
/**
|
|
651
621
|
* clear storage
|
|
652
|
-
*
|
|
653
622
|
* @param {string} area - storage area
|
|
654
623
|
* @returns {Promise.<void>} - void
|
|
655
624
|
*/
|
|
@@ -666,7 +635,6 @@ export const clearStorage = async (area = 'local') => {
|
|
|
666
635
|
|
|
667
636
|
/**
|
|
668
637
|
* get all storage
|
|
669
|
-
*
|
|
670
638
|
* @param {string} area - storage area
|
|
671
639
|
* @returns {Promise.<object>} - stored data
|
|
672
640
|
*/
|
|
@@ -685,7 +653,6 @@ export const getAllStorage = async (area = 'local') => {
|
|
|
685
653
|
|
|
686
654
|
/**
|
|
687
655
|
* get storage
|
|
688
|
-
*
|
|
689
656
|
* @param {*} key - key
|
|
690
657
|
* @param {string} area - storage area
|
|
691
658
|
* @returns {Promise.<object>} - stored data
|
|
@@ -705,7 +672,6 @@ export const getStorage = async (key, area = 'local') => {
|
|
|
705
672
|
|
|
706
673
|
/**
|
|
707
674
|
* remove storage
|
|
708
|
-
*
|
|
709
675
|
* @param {*} key - key
|
|
710
676
|
* @param {string} area - storage area
|
|
711
677
|
* @returns {Promise.<void>} - void
|
|
@@ -723,7 +689,6 @@ export const removeStorage = async (key, area = 'local') => {
|
|
|
723
689
|
|
|
724
690
|
/**
|
|
725
691
|
* set storage
|
|
726
|
-
*
|
|
727
692
|
* @param {object} obj - object to store
|
|
728
693
|
* @param {string} area - storage area
|
|
729
694
|
* @returns {Promise.<void>} - void
|
|
@@ -742,7 +707,6 @@ export const setStorage = async (obj, area = 'local') => {
|
|
|
742
707
|
/* tabs */
|
|
743
708
|
/**
|
|
744
709
|
* create tab
|
|
745
|
-
*
|
|
746
710
|
* @param {object} opt - options
|
|
747
711
|
* @returns {Promise.<object>} - tabs.Tab
|
|
748
712
|
*/
|
|
@@ -753,7 +717,6 @@ export const createTab = async (opt = {}) => {
|
|
|
753
717
|
|
|
754
718
|
/**
|
|
755
719
|
* duplicate tab
|
|
756
|
-
*
|
|
757
720
|
* @param {number} tabId - tab ID
|
|
758
721
|
* @param {object} opt - options
|
|
759
722
|
* @returns {Promise.<object>} - tabs.Tab
|
|
@@ -768,7 +731,6 @@ export const duplicateTab = async (tabId, opt) => {
|
|
|
768
731
|
|
|
769
732
|
/**
|
|
770
733
|
* query tabs
|
|
771
|
-
*
|
|
772
734
|
* @param {object} opt - options
|
|
773
735
|
* @returns {Promise.<?Array>} - result
|
|
774
736
|
*/
|
|
@@ -779,7 +741,6 @@ export const queryTabs = async opt => {
|
|
|
779
741
|
|
|
780
742
|
/**
|
|
781
743
|
* execute content script to existing tab
|
|
782
|
-
*
|
|
783
744
|
* @param {number|object} tabId - tab ID or options
|
|
784
745
|
* @param {object} opt - options
|
|
785
746
|
* @returns {Promise.<?Array|boolean>} - result
|
|
@@ -804,7 +765,6 @@ export const execScriptToTab = async (tabId, opt = {}) => {
|
|
|
804
765
|
|
|
805
766
|
/**
|
|
806
767
|
* execute content script to existing tabs
|
|
807
|
-
*
|
|
808
768
|
* @param {object} opt - options
|
|
809
769
|
* @returns {Promise.<Array>} - results of each handler
|
|
810
770
|
*/
|
|
@@ -826,7 +786,6 @@ export const execScriptToTabs = async (opt = {}) => {
|
|
|
826
786
|
|
|
827
787
|
/**
|
|
828
788
|
* execute scripts to tab in order
|
|
829
|
-
*
|
|
830
789
|
* @param {number|Array} tabId - tabId or array of options
|
|
831
790
|
* @param {Array} opts - array of options
|
|
832
791
|
* @returns {Promise.<*>} - result of the last executed script
|
|
@@ -858,7 +817,6 @@ export const execScriptsToTabInOrder = async (tabId, opts = []) => {
|
|
|
858
817
|
|
|
859
818
|
/**
|
|
860
819
|
* get active tab
|
|
861
|
-
*
|
|
862
820
|
* @param {number} [windowId] - window ID
|
|
863
821
|
* @returns {Promise.<object>} - tabs.Tab
|
|
864
822
|
*/
|
|
@@ -876,7 +834,6 @@ export const getActiveTab = async windowId => {
|
|
|
876
834
|
|
|
877
835
|
/**
|
|
878
836
|
* get active tab ID
|
|
879
|
-
*
|
|
880
837
|
* @param {number} [windowId] - window ID
|
|
881
838
|
* @returns {Promise.<?number>} - tab ID
|
|
882
839
|
*/
|
|
@@ -894,7 +851,6 @@ export const getActiveTabId = async windowId => {
|
|
|
894
851
|
|
|
895
852
|
/**
|
|
896
853
|
* get all tabs in window
|
|
897
|
-
*
|
|
898
854
|
* @param {number} [windowId] - window ID
|
|
899
855
|
* @returns {Promise.<?Array>} - array of tabs.Tab
|
|
900
856
|
*/
|
|
@@ -911,7 +867,6 @@ export const getAllTabsInWindow = async windowId => {
|
|
|
911
867
|
|
|
912
868
|
/**
|
|
913
869
|
* get highlighted tab
|
|
914
|
-
*
|
|
915
870
|
* @param {number} [windowId] - window ID
|
|
916
871
|
* @returns {Promise.<?Array>} - array of tabs.Tab
|
|
917
872
|
*/
|
|
@@ -929,7 +884,6 @@ export const getHighlightedTab = async windowId => {
|
|
|
929
884
|
|
|
930
885
|
/**
|
|
931
886
|
* get tab
|
|
932
|
-
*
|
|
933
887
|
* @param {number} tabId - tab ID
|
|
934
888
|
* @returns {Promise.<object>} - tabs.Tab
|
|
935
889
|
*/
|
|
@@ -943,7 +897,6 @@ export const getTab = async tabId => {
|
|
|
943
897
|
|
|
944
898
|
/**
|
|
945
899
|
* highlight tab
|
|
946
|
-
*
|
|
947
900
|
* @param {number|Array} index - tab index
|
|
948
901
|
* @param {number} [windowId] - window ID
|
|
949
902
|
* @returns {Promise.<object>} - windows.Window
|
|
@@ -965,7 +918,6 @@ export const highlightTab = async (index, windowId) => {
|
|
|
965
918
|
|
|
966
919
|
/**
|
|
967
920
|
* move tab
|
|
968
|
-
*
|
|
969
921
|
* @param {number|Array} tabId - tab ID
|
|
970
922
|
* @param {object} [opt] - options
|
|
971
923
|
* @returns {Promise.<?Array>} - array of tabs.Tab
|
|
@@ -983,7 +935,6 @@ export const moveTab = async (tabId, opt) => {
|
|
|
983
935
|
|
|
984
936
|
/**
|
|
985
937
|
* reload tab
|
|
986
|
-
*
|
|
987
938
|
* @param {number} tabId - tab ID
|
|
988
939
|
* @param {object} opt - options
|
|
989
940
|
* @returns {Promise.<void>} - void
|
|
@@ -997,7 +948,6 @@ export const reloadTab = async (tabId, opt) => {
|
|
|
997
948
|
|
|
998
949
|
/**
|
|
999
950
|
* remove tab
|
|
1000
|
-
*
|
|
1001
951
|
* @param {number|Array} arg - tab ID or array of tab ID
|
|
1002
952
|
* @returns {Promise.<void>} - void
|
|
1003
953
|
*/
|
|
@@ -1013,7 +963,6 @@ export const removeTab = async arg => {
|
|
|
1013
963
|
|
|
1014
964
|
/**
|
|
1015
965
|
* update tab
|
|
1016
|
-
*
|
|
1017
966
|
* @param {number} tabId - tab ID
|
|
1018
967
|
* @param {object} opt - options
|
|
1019
968
|
* @returns {Promise.<object>} - tabs.Tab
|
|
@@ -1028,7 +977,6 @@ export const updateTab = async (tabId, opt) => {
|
|
|
1028
977
|
|
|
1029
978
|
/**
|
|
1030
979
|
* warmup tab
|
|
1031
|
-
*
|
|
1032
980
|
* @param {number} tabId - tab ID
|
|
1033
981
|
* @returns {Promise.<void>} - void
|
|
1034
982
|
*/
|
|
@@ -1043,7 +991,6 @@ export const warmupTab = async tabId => {
|
|
|
1043
991
|
|
|
1044
992
|
/**
|
|
1045
993
|
* is tab
|
|
1046
|
-
*
|
|
1047
994
|
* @param {*} tabId - tab ID
|
|
1048
995
|
* @returns {Promise.<boolean>} - result
|
|
1049
996
|
*/
|
|
@@ -1065,7 +1012,6 @@ export const isTab = async tabId => {
|
|
|
1065
1012
|
/* theme */
|
|
1066
1013
|
/**
|
|
1067
1014
|
* get current theme
|
|
1068
|
-
*
|
|
1069
1015
|
* @param {number} [windowId] - window ID
|
|
1070
1016
|
* @returns {Promise.<object>} - theme.Theme
|
|
1071
1017
|
*/
|
|
@@ -1085,7 +1031,6 @@ export const getCurrentTheme = async windowId => {
|
|
|
1085
1031
|
/* windows */
|
|
1086
1032
|
/**
|
|
1087
1033
|
* create new window
|
|
1088
|
-
*
|
|
1089
1034
|
* @param {object} opt - options
|
|
1090
1035
|
* @returns {Promise.<object>} - windows.Window
|
|
1091
1036
|
*/
|
|
@@ -1096,7 +1041,6 @@ export const createNewWindow = async opt => {
|
|
|
1096
1041
|
|
|
1097
1042
|
/**
|
|
1098
1043
|
* get all windows
|
|
1099
|
-
*
|
|
1100
1044
|
* @param {boolean} populate - populate tabs
|
|
1101
1045
|
* @returns {Promise.<Array>} - array of windows.Window
|
|
1102
1046
|
*/
|
|
@@ -1110,7 +1054,6 @@ export const getAllNormalWindows = async (populate = false) => {
|
|
|
1110
1054
|
|
|
1111
1055
|
/**
|
|
1112
1056
|
* get current window
|
|
1113
|
-
*
|
|
1114
1057
|
* @param {object} opt - options
|
|
1115
1058
|
* @returns {Promise.<object>} - windows.Window
|
|
1116
1059
|
*/
|
|
@@ -1121,7 +1064,6 @@ export const getCurrentWindow = async opt => {
|
|
|
1121
1064
|
|
|
1122
1065
|
/**
|
|
1123
1066
|
* get window
|
|
1124
|
-
*
|
|
1125
1067
|
* @param {number} windowId - window ID
|
|
1126
1068
|
* @param {object} opt - options
|
|
1127
1069
|
* @returns {Promise.<object>} - windows.Window
|
|
@@ -1136,7 +1078,6 @@ export const getWindow = async (windowId, opt) => {
|
|
|
1136
1078
|
|
|
1137
1079
|
/**
|
|
1138
1080
|
* check whether incognito window exists
|
|
1139
|
-
*
|
|
1140
1081
|
* @returns {Promise.<boolean>} - result
|
|
1141
1082
|
*/
|
|
1142
1083
|
export const checkIncognitoWindowExists = async () => {
|
package/modules/commander.js
CHANGED
|
@@ -14,7 +14,6 @@ const DIR_CWD = process.cwd();
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* clean directory
|
|
17
|
-
*
|
|
18
17
|
* @param {object} cmdOpts - command options
|
|
19
18
|
* @returns {void}
|
|
20
19
|
*/
|
|
@@ -30,7 +29,6 @@ export const cleanDirectory = (cmdOpts = {}) => {
|
|
|
30
29
|
|
|
31
30
|
/**
|
|
32
31
|
* parse command
|
|
33
|
-
*
|
|
34
32
|
* @param {Array} args - process.argv
|
|
35
33
|
* @returns {void}
|
|
36
34
|
*/
|
package/modules/common.js
CHANGED
|
@@ -8,7 +8,6 @@ const TYPE_TO = -1;
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* throw error
|
|
11
|
-
*
|
|
12
11
|
* @param {!object} e - Error
|
|
13
12
|
* @throws - Error
|
|
14
13
|
*/
|
|
@@ -18,7 +17,6 @@ export const throwErr = e => {
|
|
|
18
17
|
|
|
19
18
|
/**
|
|
20
19
|
* log error
|
|
21
|
-
*
|
|
22
20
|
* @param {!object} e - Error
|
|
23
21
|
* @returns {boolean} - false
|
|
24
22
|
*/
|
|
@@ -29,7 +27,6 @@ export const logErr = e => {
|
|
|
29
27
|
|
|
30
28
|
/**
|
|
31
29
|
* log warn
|
|
32
|
-
*
|
|
33
30
|
* @param {*} msg - message
|
|
34
31
|
* @returns {boolean} - false
|
|
35
32
|
*/
|
|
@@ -40,7 +37,6 @@ export const logWarn = msg => {
|
|
|
40
37
|
|
|
41
38
|
/**
|
|
42
39
|
* log message
|
|
43
|
-
*
|
|
44
40
|
* @param {*} msg - message
|
|
45
41
|
* @returns {*} - message
|
|
46
42
|
*/
|
|
@@ -51,7 +47,6 @@ export const logMsg = msg => {
|
|
|
51
47
|
|
|
52
48
|
/**
|
|
53
49
|
* get type
|
|
54
|
-
*
|
|
55
50
|
* @param {*} o - object to check
|
|
56
51
|
* @returns {string} - type of object
|
|
57
52
|
*/
|
|
@@ -60,7 +55,6 @@ export const getType = o =>
|
|
|
60
55
|
|
|
61
56
|
/**
|
|
62
57
|
* is object, and not an empty object
|
|
63
|
-
*
|
|
64
58
|
* @param {*} o - object to check;
|
|
65
59
|
* @returns {boolean} - result
|
|
66
60
|
*/
|
|
@@ -71,7 +65,6 @@ export const isObjectNotEmpty = o => {
|
|
|
71
65
|
|
|
72
66
|
/**
|
|
73
67
|
* is string
|
|
74
|
-
*
|
|
75
68
|
* @param {*} o - object to check
|
|
76
69
|
* @returns {boolean} - result
|
|
77
70
|
*/
|
package/modules/file-util.js
CHANGED
|
@@ -17,7 +17,6 @@ const SUBST = 'index';
|
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* convert URI to native file path
|
|
20
|
-
*
|
|
21
20
|
* @param {string} uri - URI
|
|
22
21
|
* @returns {?string} - file path
|
|
23
22
|
*/
|
|
@@ -35,7 +34,6 @@ export const convertUriToFilePath = uri => {
|
|
|
35
34
|
|
|
36
35
|
/**
|
|
37
36
|
* get absolute path
|
|
38
|
-
*
|
|
39
37
|
* @param {string} file - file path
|
|
40
38
|
* @returns {?string} - absolute file path
|
|
41
39
|
*/
|
|
@@ -49,7 +47,6 @@ export const getAbsPath = file => {
|
|
|
49
47
|
|
|
50
48
|
/**
|
|
51
49
|
* get stat
|
|
52
|
-
*
|
|
53
50
|
* @param {string} file - file path
|
|
54
51
|
* @returns {object} - file stat
|
|
55
52
|
*/
|
|
@@ -58,7 +55,6 @@ export const getStat = file =>
|
|
|
58
55
|
|
|
59
56
|
/**
|
|
60
57
|
* the directory is a directory
|
|
61
|
-
*
|
|
62
58
|
* @param {string} dir - directory path
|
|
63
59
|
* @returns {boolean} - result
|
|
64
60
|
*/
|
|
@@ -69,7 +65,6 @@ export const isDir = dir => {
|
|
|
69
65
|
|
|
70
66
|
/**
|
|
71
67
|
* the directory is a subdirectory of a certain directory
|
|
72
|
-
*
|
|
73
68
|
* @param {string} dir - directory path
|
|
74
69
|
* @param {string} baseDir - base directory path
|
|
75
70
|
* @returns {boolean} - result
|
|
@@ -79,7 +74,6 @@ export const isSubDir = (dir, baseDir) =>
|
|
|
79
74
|
|
|
80
75
|
/**
|
|
81
76
|
* the file is a file
|
|
82
|
-
*
|
|
83
77
|
* @param {string} file - file path
|
|
84
78
|
* @returns {boolean} - result
|
|
85
79
|
*/
|
|
@@ -92,7 +86,6 @@ export const isFile = file => {
|
|
|
92
86
|
* the file is executable
|
|
93
87
|
* NOTE: On Windows, fs.statSync(file).mode returns 33206 for executable
|
|
94
88
|
* files like `.exe`, which is 100666 in octal.
|
|
95
|
-
*
|
|
96
89
|
* @param {string} file - file path
|
|
97
90
|
* @param {number} [mask] - mask bit
|
|
98
91
|
* @returns {boolean} - result
|
|
@@ -109,7 +102,6 @@ export const isExecutable = (file, mask = MASK_BIT) => {
|
|
|
109
102
|
|
|
110
103
|
/**
|
|
111
104
|
* get file timestamp
|
|
112
|
-
*
|
|
113
105
|
* @param {string} file - file path
|
|
114
106
|
* @returns {number} - timestamp
|
|
115
107
|
*/
|
|
@@ -120,7 +112,6 @@ export const getFileTimestamp = file => {
|
|
|
120
112
|
|
|
121
113
|
/**
|
|
122
114
|
* get file name from native file path
|
|
123
|
-
*
|
|
124
115
|
* @param {string} file - file path
|
|
125
116
|
* @param {string} [subst] - substitute file name
|
|
126
117
|
* @returns {string} - file name
|
|
@@ -136,7 +127,6 @@ export const getFileNameFromFilePath = (file, subst = SUBST) => {
|
|
|
136
127
|
|
|
137
128
|
/**
|
|
138
129
|
* remove the directory and it's files synchronously
|
|
139
|
-
*
|
|
140
130
|
* @param {string} dir - directory path
|
|
141
131
|
* @param {string} baseDir - base directory path
|
|
142
132
|
* @returns {void}
|
|
@@ -155,7 +145,6 @@ export const removeDir = (dir, baseDir) => {
|
|
|
155
145
|
|
|
156
146
|
/**
|
|
157
147
|
* remove the directory and it's files
|
|
158
|
-
*
|
|
159
148
|
* @param {string} dir - directory path
|
|
160
149
|
* @param {string} baseDir - base directory path
|
|
161
150
|
* @returns {Promise.<void>} - void
|
|
@@ -174,7 +163,6 @@ export const removeDirectory = async (dir, baseDir) => {
|
|
|
174
163
|
|
|
175
164
|
/**
|
|
176
165
|
* create a directory
|
|
177
|
-
*
|
|
178
166
|
* @param {string} dir - directory path to create
|
|
179
167
|
* @param {number} [mode] - permission
|
|
180
168
|
* @returns {Promise.<string>} - directory path
|
|
@@ -197,7 +185,6 @@ export const createDirectory = async (dir, mode = PERM_DIR) => {
|
|
|
197
185
|
|
|
198
186
|
/**
|
|
199
187
|
* create a file
|
|
200
|
-
*
|
|
201
188
|
* @param {string} file - file path to create
|
|
202
189
|
* @param {string|Buffer|Uint8Array} value - value to write
|
|
203
190
|
* @param {object} [opt] - options
|
|
@@ -225,7 +212,6 @@ export const createFile = async (file, value, opt = {
|
|
|
225
212
|
|
|
226
213
|
/**
|
|
227
214
|
* read a file
|
|
228
|
-
*
|
|
229
215
|
* @param {string} file - file path
|
|
230
216
|
* @param {object} [opt] - options
|
|
231
217
|
* @param {string} [opt.encoding] - encoding
|
package/modules/schema.js
CHANGED
|
@@ -18,7 +18,6 @@ export class Schema {
|
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* construct
|
|
21
|
-
*
|
|
22
21
|
* @param {...(string|object)} [args] - optional arguments
|
|
23
22
|
* {string} - release channel.
|
|
24
23
|
* one of "beta", "central",
|
|
@@ -54,7 +53,6 @@ export class Schema {
|
|
|
54
53
|
|
|
55
54
|
/**
|
|
56
55
|
* get target from namespace key
|
|
57
|
-
*
|
|
58
56
|
* @param {string} key - namespace key
|
|
59
57
|
* @returns {object} - target object
|
|
60
58
|
*/
|
|
@@ -81,7 +79,6 @@ export class Schema {
|
|
|
81
79
|
|
|
82
80
|
/**
|
|
83
81
|
* assign imported values
|
|
84
|
-
*
|
|
85
82
|
* @returns {void}
|
|
86
83
|
*/
|
|
87
84
|
_assignImportMap() {
|
|
@@ -108,7 +105,6 @@ export class Schema {
|
|
|
108
105
|
|
|
109
106
|
/**
|
|
110
107
|
* assign referred values
|
|
111
|
-
*
|
|
112
108
|
* @returns {void}
|
|
113
109
|
*/
|
|
114
110
|
_assignRefMap() {
|
|
@@ -135,7 +131,6 @@ export class Schema {
|
|
|
135
131
|
|
|
136
132
|
/**
|
|
137
133
|
* mock events
|
|
138
|
-
*
|
|
139
134
|
* @param {object} target - target object
|
|
140
135
|
* @param {Array} events - events
|
|
141
136
|
* @returns {object} - target object
|
|
@@ -161,7 +156,6 @@ export class Schema {
|
|
|
161
156
|
|
|
162
157
|
/**
|
|
163
158
|
* mock functions
|
|
164
|
-
*
|
|
165
159
|
* @param {object} target - target object
|
|
166
160
|
* @param {Array} funcs - functions
|
|
167
161
|
* @returns {object} - target object
|
|
@@ -184,7 +178,6 @@ export class Schema {
|
|
|
184
178
|
|
|
185
179
|
/**
|
|
186
180
|
* mock properties
|
|
187
|
-
*
|
|
188
181
|
* @param {object} target - target object
|
|
189
182
|
* @param {object} props - properties
|
|
190
183
|
* @param {string} namespace - namespace
|
|
@@ -225,7 +218,6 @@ export class Schema {
|
|
|
225
218
|
|
|
226
219
|
/**
|
|
227
220
|
* mock types
|
|
228
|
-
*
|
|
229
221
|
* @param {object} target - target object
|
|
230
222
|
* @param {Array} types - types
|
|
231
223
|
* @param {string} namespace - namespace
|
|
@@ -263,7 +255,6 @@ export class Schema {
|
|
|
263
255
|
|
|
264
256
|
/**
|
|
265
257
|
* parse schema content
|
|
266
|
-
*
|
|
267
258
|
* @returns {object} - schema
|
|
268
259
|
*/
|
|
269
260
|
_parseSchemaContent() {
|
|
@@ -280,7 +271,6 @@ export class Schema {
|
|
|
280
271
|
|
|
281
272
|
/**
|
|
282
273
|
* get schema
|
|
283
|
-
*
|
|
284
274
|
* @param {string} name - API name or file name
|
|
285
275
|
* @returns {Array} - schema
|
|
286
276
|
*/
|
|
@@ -303,7 +293,6 @@ export class Schema {
|
|
|
303
293
|
|
|
304
294
|
/**
|
|
305
295
|
* get all schemas
|
|
306
|
-
*
|
|
307
296
|
* @returns {object} - schemas
|
|
308
297
|
*/
|
|
309
298
|
getAll() {
|
|
@@ -313,7 +302,6 @@ export class Schema {
|
|
|
313
302
|
|
|
314
303
|
/**
|
|
315
304
|
* list schemas
|
|
316
|
-
*
|
|
317
305
|
* @returns {Array} - file list
|
|
318
306
|
*/
|
|
319
307
|
list() {
|
|
@@ -328,7 +316,6 @@ export class Schema {
|
|
|
328
316
|
|
|
329
317
|
/**
|
|
330
318
|
* mock browser api
|
|
331
|
-
*
|
|
332
319
|
* @returns {object} - stubbed browser api
|
|
333
320
|
*/
|
|
334
321
|
mock() {
|