@rsdoctor/sdk 0.4.2 → 0.4.4

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.
@@ -182,9 +182,10 @@ class RsdoctorServer {
182
182
  const relativeUrl = this.getClientUrl(
183
183
  ...args
184
184
  );
185
+ const needEncodeURI = arguments[0] === import_types.Client.RsdoctorClientRoutes.BundleDiff;
185
186
  const url = `http://${this.host}:${this.port}${relativeUrl}`;
186
187
  const localhostUrl = `http://localhost:${this.port}${relativeUrl}`;
187
- await (0, import_openBrowser.openBrowser)(localhostUrl);
188
+ await (0, import_openBrowser.openBrowser)(localhostUrl, !needEncodeURI);
188
189
  if (this._printServerUrl) {
189
190
  import_logger.logger.info(`Rsdoctor analyze server running on: ${import_logger.chalk.cyan(url)}`);
190
191
  import_logger.logger.info(
@@ -55,16 +55,14 @@ const getTargetBrowser = async () => {
55
55
  }
56
56
  return targetBrowser;
57
57
  };
58
- async function openBrowser(url) {
58
+ async function openBrowser(url, needEncodeURI = true) {
59
59
  const shouldTryOpenChromeWithAppleScript = process.platform === "darwin" || process.platform === "win32";
60
60
  if (shouldTryOpenChromeWithAppleScript) {
61
61
  try {
62
62
  const targetBrowser = await getTargetBrowser();
63
63
  if (targetBrowser) {
64
64
  await execAsync(
65
- `osascript openChrome.applescript "${encodeURI(
66
- url
67
- )}" "${targetBrowser}"`,
65
+ `osascript openChrome.applescript "${needEncodeURI ? encodeURI(url) : url}" "${targetBrowser}"`,
68
66
  {
69
67
  cwd: (0, import_node_path.join)(__dirname, "../../../../static")
70
68
  }
@@ -148,9 +148,10 @@ class RsdoctorServer {
148
148
  const relativeUrl = this.getClientUrl(
149
149
  ...args
150
150
  );
151
+ const needEncodeURI = arguments[0] === Client.RsdoctorClientRoutes.BundleDiff;
151
152
  const url = `http://${this.host}:${this.port}${relativeUrl}`;
152
153
  const localhostUrl = `http://localhost:${this.port}${relativeUrl}`;
153
- await openBrowser(localhostUrl);
154
+ await openBrowser(localhostUrl, !needEncodeURI);
154
155
  if (this._printServerUrl) {
155
156
  logger.info(`Rsdoctor analyze server running on: ${chalk.cyan(url)}`);
156
157
  logger.info(
@@ -22,16 +22,14 @@ const getTargetBrowser = async () => {
22
22
  }
23
23
  return targetBrowser;
24
24
  };
25
- async function openBrowser(url) {
25
+ async function openBrowser(url, needEncodeURI = true) {
26
26
  const shouldTryOpenChromeWithAppleScript = process.platform === "darwin" || process.platform === "win32";
27
27
  if (shouldTryOpenChromeWithAppleScript) {
28
28
  try {
29
29
  const targetBrowser = await getTargetBrowser();
30
30
  if (targetBrowser) {
31
31
  await execAsync(
32
- `osascript openChrome.applescript "${encodeURI(
33
- url
34
- )}" "${targetBrowser}"`,
32
+ `osascript openChrome.applescript "${needEncodeURI ? encodeURI(url) : url}" "${targetBrowser}"`,
35
33
  {
36
34
  cwd: join(__dirname, "../../../../static")
37
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sdk/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAgBlE,cAAc,SAAS,CAAC;AAExB,qBAAa,cAAe,YAAW,GAAG,CAAC,sBAAsB;IAgB7D,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,0BAA0B;IAf/C,OAAO,CAAC,OAAO,CAAwD;IAEhE,IAAI,EAAE,MAAM,CAAC;IAEpB,OAAO,CAAC,OAAO,CAAC,CAAS;IAEzB,OAAO,CAAC,QAAQ,CAAQ;IAExB,OAAO,CAAC,OAAO,CAAS;IAExB,OAAO,CAAC,gBAAgB,CAAS;IAEjC,OAAO,CAAC,eAAe,CAAU;gBAGrB,GAAG,EAAE,GAAG,CAAC,0BAA0B,EAC7C,IAAI,SAAqB,EACzB,MAAM,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,OAAO,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AO,CAAC,kBAAkB,CAAC,KACvD,MAAM,CAAC,WAAW,GAAG,MAAM,GAC/B,UAAU,CAAC,OAAO,CAAC,kBAAkB;IAqCjC,KAAK,CACV,GAAG,EAAE,GAAG,CAAC,SAAS,CAAC,GAAG,EACtB,MAAM,EAAE,KAAK,GAAG,MAAM,EACtB,EAAE,EAAE,CACF,GAAG,IAAI,EAAE,UAAU,CAAC,UAAU,CAAC,OAAO,CAAC,kBAAkB,CAAC,KACvD,MAAM,CAAC,WAAW,GAAG,MAAM;IAY3B,GAAG,EAAE,GAAG,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAI3C;IAEK,IAAI,EAAE,GAAG,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAI7C;IAEK,YAAY,CACjB,KAAK,EAAE,MAAM,CAAC,oBAAoB,EAClC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,GACjB,MAAM;IAEF,YAAY,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,MAAM;IAgBlC,cAAc,CACzB,KAAK,EAAE,MAAM,CAAC,oBAAoB,EAClC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC;IAEH,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAoBvD,mBAAmB,CACxB,CAAC,SAAS,GAAG,CAAC,SAAS,CAAC,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC,UAAU,EACtD,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAIrC,SAAS;IAItB,OAAO,sBAYL;CACH"}
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Reads the BROWSER environment variable and decides what to do with it.
3
3
  */
4
- export declare function openBrowser(url: string): Promise<boolean | undefined>;
4
+ export declare function openBrowser(url: string, needEncodeURI?: boolean): Promise<boolean | undefined>;
5
5
  //# sourceMappingURL=openBrowser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"openBrowser.d.ts","sourceRoot":"","sources":["../../../../src/sdk/utils/openBrowser.ts"],"names":[],"mappings":"AAuCA;;GAEG;AACH,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAwC3E"}
1
+ {"version":3,"file":"openBrowser.d.ts","sourceRoot":"","sources":["../../../../src/sdk/utils/openBrowser.ts"],"names":[],"mappings":"AAuCA;;GAEG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,MAAM,EACX,aAAa,UAAO,GACnB,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAwC9B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/sdk",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",
@@ -16,20 +16,20 @@
16
16
  ],
17
17
  "dependencies": {
18
18
  "@types/fs-extra": "^11.0.4",
19
- "body-parser": "1.20.2",
19
+ "body-parser": "1.20.3",
20
20
  "cors": "2.8.5",
21
21
  "dayjs": "1.11.13",
22
22
  "fs-extra": "^11.1.1",
23
23
  "lodash": "^4.17.21",
24
24
  "open": "^8.4.2",
25
- "serve-static": "1.15.0",
25
+ "serve-static": "1.16.0",
26
26
  "socket.io": "4.7.2",
27
27
  "source-map": "^0.7.4",
28
28
  "tapable": "2.2.1",
29
- "@rsdoctor/client": "0.4.2",
30
- "@rsdoctor/graph": "0.4.2",
31
- "@rsdoctor/types": "0.4.2",
32
- "@rsdoctor/utils": "0.4.2"
29
+ "@rsdoctor/client": "0.4.4",
30
+ "@rsdoctor/graph": "0.4.4",
31
+ "@rsdoctor/types": "0.4.4",
32
+ "@rsdoctor/utils": "0.4.4"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/body-parser": "1.19.5",
@@ -37,7 +37,7 @@
37
37
  "@types/lodash": "^4.17.7",
38
38
  "@types/node": "^16",
39
39
  "@types/serve-static": "1.15.7",
40
- "tslib": "2.4.1",
40
+ "tslib": "2.7.0",
41
41
  "typescript": "^5.2.2"
42
42
  },
43
43
  "publishConfig": {