xhs-mp-compiler-cli 1.5.0 → 1.5.1-beta.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.
@@ -0,0 +1,78 @@
1
+ property targetTab: null
2
+ property targetTabIndex: -1
3
+ property targetWindow: null
4
+
5
+ on run argv
6
+ set theURL to item 1 of argv
7
+
8
+ with timeout of 2 seconds
9
+ tell application "Chrome"
10
+
11
+ if (count every window) = 0 then
12
+ make new window
13
+ end if
14
+
15
+ -- 1: Looking for tab running debugger
16
+ -- then, Reload debugging tab if found
17
+ -- then return
18
+ set found to my lookupTabWithUrl(theURL)
19
+ if found then
20
+ set targetWindow's active tab index to targetTabIndex
21
+ tell targetTab to reload
22
+ tell targetWindow to activate
23
+ set index of targetWindow to 1
24
+ return
25
+ end if
26
+
27
+ -- 2: Looking for Empty tab
28
+ -- In case debugging tab was not found
29
+ -- We try to find an empty tab instead
30
+ set found to my lookupTabWithUrl("chrome://newtab/")
31
+ if found then
32
+ set targetWindow's active tab index to targetTabIndex
33
+ set URL of targetTab to theURL
34
+ tell targetWindow to activate
35
+ return
36
+ end if
37
+
38
+ -- 3: Create new tab
39
+ -- both debugging and empty tab were not found
40
+ -- make a new tab with url
41
+ tell window 1
42
+ activate
43
+ make new tab with properties {URL:theURL}
44
+ end tell
45
+ end tell
46
+ end timeout
47
+ end run
48
+
49
+ -- Function:
50
+ -- Lookup tab with given url
51
+ -- if found, store tab, index, and window in properties
52
+ -- (properties were declared on top of file)
53
+ on lookupTabWithUrl(lookupUrl)
54
+ tell application "Chrome"
55
+ -- Find a tab with the given url
56
+ set found to false
57
+ set theTabIndex to -1
58
+ repeat with theWindow in every window
59
+ set theTabIndex to 0
60
+ repeat with theTab in every tab of theWindow
61
+ set theTabIndex to theTabIndex + 1
62
+ if (theTab's URL as string) contains lookupUrl then
63
+ -- assign tab, tab index, and window to properties
64
+ set targetTab to theTab
65
+ set targetTabIndex to theTabIndex
66
+ set targetWindow to theWindow
67
+ set found to true
68
+ exit repeat
69
+ end if
70
+ end repeat
71
+
72
+ if found then
73
+ exit repeat
74
+ end if
75
+ end repeat
76
+ end tell
77
+ return found
78
+ end lookupTabWithUrl
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xhs-mp-compiler-cli",
3
- "version": "1.5.0",
3
+ "version": "1.5.1-beta.0",
4
4
  "description": "xhs mp command tool.",
5
5
  "preferGlobal": true,
6
6
  "category": "esm",
@@ -82,11 +82,11 @@
82
82
  "webpack-bundle-analyzer": "^4.4.0",
83
83
  "webpack-chain": "^6.5.1",
84
84
  "webpack-sources": "^3.2.2",
85
- "xhs-mp-compiler-ml-loader": "1.5.0",
86
- "xhs-mp-compiler-utils": "1.3.0",
87
- "xhs-mp-pack": "^1.3.0",
88
- "xhs-mp-project": "^1.3.0",
89
- "xhs-mp-utils": "^1.5.0"
85
+ "xhs-mp-compiler-ml-loader": "1.5.1-beta.0",
86
+ "xhs-mp-compiler-utils": "1.3.1-beta.0",
87
+ "xhs-mp-pack": "^1.3.1-beta.0",
88
+ "xhs-mp-project": "^1.3.1-beta.0",
89
+ "xhs-mp-utils": "^1.5.1-beta.0"
90
90
  },
91
91
  "devDependencies": {
92
92
  "@types/babel__generator": "7.6.3",