@rsdoctor/sdk 0.4.5 → 0.4.7

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.
@@ -128,20 +128,20 @@ class SDKCore {
128
128
  });
129
129
  continue;
130
130
  }
131
- const jsonstr = await (async () => {
131
+ const jsonStr = await (async () => {
132
132
  try {
133
133
  return JSON.stringify(data);
134
134
  } catch (error) {
135
135
  return import_build.Json.stringify(data);
136
136
  }
137
137
  })();
138
- if (Array.isArray(jsonstr)) {
139
- const urls = jsonstr.map((str, index) => {
138
+ if (Array.isArray(jsonStr)) {
139
+ const urls = jsonStr.map((str, index) => {
140
140
  return this.writeToFolder(str, outputDir, key, index + 1);
141
141
  });
142
142
  urlsPromiseList.push(...urls);
143
143
  } else {
144
- urlsPromiseList.push(this.writeToFolder(jsonstr, outputDir, key));
144
+ urlsPromiseList.push(this.writeToFolder(jsonStr, outputDir, key));
145
145
  }
146
146
  }
147
147
  const dataUrls = await Promise.all(urlsPromiseList);
@@ -176,8 +176,8 @@ class SDKCore {
176
176
  });
177
177
  return manifestDiskPath;
178
178
  }
179
- writeToFolder(jsonstr, dir, key, index) {
180
- const sharding = new import_build.File.FileSharding(import_common.Algorithm.compressText(jsonstr));
179
+ writeToFolder(jsonStr, dir, key, index) {
180
+ const sharding = new import_build.File.FileSharding(import_common.Algorithm.compressText(jsonStr));
181
181
  const folder = import_path.default.resolve(dir, key);
182
182
  const writer = sharding.writeStringToFolder(folder, "", index);
183
183
  return writer.then((item) => {
@@ -418,7 +418,7 @@ class RsdoctorWebpackSDK extends import_core.SDKCore {
418
418
  let compressTextScripts = `<script>window.${import_types.Constants.WINDOW_RSDOCTOR_TAG}={}</script>`;
419
419
  for (let key of Object.keys(storeData)) {
420
420
  const data = storeData[key];
421
- const jsonstrFn = () => {
421
+ const jsonStrFn = () => {
422
422
  try {
423
423
  return JSON.stringify(data);
424
424
  } catch (error) {
@@ -426,7 +426,7 @@ class RsdoctorWebpackSDK extends import_core.SDKCore {
426
426
  return "";
427
427
  }
428
428
  };
429
- const compressText = import_common.Algorithm.compressText(jsonstrFn());
429
+ const compressText = import_common.Algorithm.compressText(jsonStrFn());
430
430
  compressTextScripts = `${compressTextScripts} <script>window.${import_types.Constants.WINDOW_RSDOCTOR_TAG}.${key}=${JSON.stringify(compressText)}</script>`;
431
431
  }
432
432
  compressTextScripts = `${compressTextScripts} <script>window.${import_types.Constants.WINDOW_RSDOCTOR_TAG}.enableRoutes=${JSON.stringify(this.getClientRoutes())}</script>`;
@@ -45,7 +45,7 @@ class BundleDiffAPI extends import_base.BaseAPI {
45
45
  packageGraph,
46
46
  configs,
47
47
  moduleCodeMap,
48
- // Just usedby bytedance's inner Rsdoctor
48
+ // Just used by bytedance's inner Rsdoctor
49
49
  cloudManifestUrl
50
50
  } = sdk.getStoreData();
51
51
  let outputFilename = "";
@@ -61,7 +61,7 @@ class BundleDiffAPI extends import_base.BaseAPI {
61
61
  packageGraph,
62
62
  outputFilename,
63
63
  moduleCodeMap,
64
- // Just usedby bytedance's inner Rsdoctor
64
+ // Just used by bytedance's inner Rsdoctor
65
65
  cloudManifestUrl
66
66
  };
67
67
  }
@@ -104,7 +104,7 @@ const _Router = class _Router {
104
104
  };
105
105
  _Router.routes = {
106
106
  /**
107
- * - `key` is the constuctor of object which used to match the API class
107
+ * - `key` is the constructor of object which used to match the API class
108
108
  */
109
109
  get: /* @__PURE__ */ new Map(),
110
110
  post: /* @__PURE__ */ new Map()
@@ -95,20 +95,20 @@ class SDKCore {
95
95
  });
96
96
  continue;
97
97
  }
98
- const jsonstr = await (async () => {
98
+ const jsonStr = await (async () => {
99
99
  try {
100
100
  return JSON.stringify(data);
101
101
  } catch (error) {
102
102
  return Json.stringify(data);
103
103
  }
104
104
  })();
105
- if (Array.isArray(jsonstr)) {
106
- const urls = jsonstr.map((str, index) => {
105
+ if (Array.isArray(jsonStr)) {
106
+ const urls = jsonStr.map((str, index) => {
107
107
  return this.writeToFolder(str, outputDir, key, index + 1);
108
108
  });
109
109
  urlsPromiseList.push(...urls);
110
110
  } else {
111
- urlsPromiseList.push(this.writeToFolder(jsonstr, outputDir, key));
111
+ urlsPromiseList.push(this.writeToFolder(jsonStr, outputDir, key));
112
112
  }
113
113
  }
114
114
  const dataUrls = await Promise.all(urlsPromiseList);
@@ -143,8 +143,8 @@ class SDKCore {
143
143
  });
144
144
  return manifestDiskPath;
145
145
  }
146
- writeToFolder(jsonstr, dir, key, index) {
147
- const sharding = new File.FileSharding(Algorithm.compressText(jsonstr));
146
+ writeToFolder(jsonStr, dir, key, index) {
147
+ const sharding = new File.FileSharding(Algorithm.compressText(jsonStr));
148
148
  const folder = path.resolve(dir, key);
149
149
  const writer = sharding.writeStringToFolder(folder, "", index);
150
150
  return writer.then((item) => {
@@ -384,7 +384,7 @@ class RsdoctorWebpackSDK extends SDKCore {
384
384
  let compressTextScripts = `<script>window.${Constants.WINDOW_RSDOCTOR_TAG}={}</script>`;
385
385
  for (let key of Object.keys(storeData)) {
386
386
  const data = storeData[key];
387
- const jsonstrFn = () => {
387
+ const jsonStrFn = () => {
388
388
  try {
389
389
  return JSON.stringify(data);
390
390
  } catch (error) {
@@ -392,7 +392,7 @@ class RsdoctorWebpackSDK extends SDKCore {
392
392
  return "";
393
393
  }
394
394
  };
395
- const compressText = Algorithm.compressText(jsonstrFn());
395
+ const compressText = Algorithm.compressText(jsonStrFn());
396
396
  compressTextScripts = `${compressTextScripts} <script>window.${Constants.WINDOW_RSDOCTOR_TAG}.${key}=${JSON.stringify(compressText)}</script>`;
397
397
  }
398
398
  compressTextScripts = `${compressTextScripts} <script>window.${Constants.WINDOW_RSDOCTOR_TAG}.enableRoutes=${JSON.stringify(this.getClientRoutes())}</script>`;
@@ -24,7 +24,7 @@ class BundleDiffAPI extends BaseAPI {
24
24
  packageGraph,
25
25
  configs,
26
26
  moduleCodeMap,
27
- // Just usedby bytedance's inner Rsdoctor
27
+ // Just used by bytedance's inner Rsdoctor
28
28
  cloudManifestUrl
29
29
  } = sdk.getStoreData();
30
30
  let outputFilename = "";
@@ -40,7 +40,7 @@ class BundleDiffAPI extends BaseAPI {
40
40
  packageGraph,
41
41
  outputFilename,
42
42
  moduleCodeMap,
43
- // Just usedby bytedance's inner Rsdoctor
43
+ // Just used by bytedance's inner Rsdoctor
44
44
  cloudManifestUrl
45
45
  };
46
46
  }
@@ -81,7 +81,7 @@ const _Router = class _Router {
81
81
  };
82
82
  _Router.routes = {
83
83
  /**
84
- * - `key` is the constuctor of object which used to match the API class
84
+ * - `key` is the constructor of object which used to match the API class
85
85
  */
86
86
  get: /* @__PURE__ */ new Map(),
87
87
  post: /* @__PURE__ */ new Map()
@@ -28,7 +28,7 @@ export declare abstract class SDKCore<T extends RsdoctorSDKOptions> implements S
28
28
  /** Upload manifest file */
29
29
  protected writeManifest(): Promise<string>;
30
30
  saveManifest(data: Common.PlainObject, options: SDK.WriteStoreOptionsType): Promise<string>;
31
- protected writeToFolder(jsonstr: string, dir: string, key: string, index?: number): Promise<DataWithUrl>;
31
+ protected writeToFolder(jsonStr: string, dir: string, key: string, index?: number): Promise<DataWithUrl>;
32
32
  abstract onDataReport(): void | Promise<void>;
33
33
  }
34
34
  //# sourceMappingURL=core.d.ts.map
@@ -10,7 +10,7 @@ export declare class Router {
10
10
  protected options: RouterOptions;
11
11
  static routes: {
12
12
  /**
13
- * - `key` is the constuctor of object which used to match the API class
13
+ * - `key` is the constructor of object which used to match the API class
14
14
  */
15
15
  get: Map<Function, [apiKey: PropertyKey, pathname: string][]>;
16
16
  post: Map<Function, [apiKey: PropertyKey, pathname: string][]>;
@@ -10,7 +10,7 @@ export declare class SocketAPILoader implements Manifest.ManifestDataLoader {
10
10
  loadManifest(): Promise<Manifest.RsdoctorManifestWithShardingFiles>;
11
11
  loadData<T extends Manifest.RsdoctorManifestMappingKeys>(key: T): Promise<Manifest.InferManifestDataValue<T>>;
12
12
  loadData(key: string): Promise<void>;
13
- get loadAPIData(): <T extends SDK.ServerAPI.API, B extends SDK.ServerAPI.InferRequestBodyType<T> = import("@rsdoctor/types/dist/common").Get<SDK.ServerAPI.ResquestBodyTypes, T, void>, R extends SDK.ServerAPI.InferResponseType<T> = import("@rsdoctor/types/dist/common").Get<SDK.ServerAPI.ResponseTypes, T, void>>(...args: B extends void ? [api: T] : [api: T, body: B]) => Promise<SDK.ServerAPI.InferResponseType<T>>;
13
+ get loadAPIData(): <T extends SDK.ServerAPI.API, B extends SDK.ServerAPI.InferRequestBodyType<T> = import("@rsdoctor/types/dist/common").Get<SDK.ServerAPI.RequestBodyTypes, T, void>, R extends SDK.ServerAPI.InferResponseType<T> = import("@rsdoctor/types/dist/common").Get<SDK.ServerAPI.ResponseTypes, T, void>>(...args: B extends void ? [api: T] : [api: T, body: B]) => Promise<SDK.ServerAPI.InferResponseType<T>>;
14
14
  }
15
15
  export {};
16
16
  //# sourceMappingURL=api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/server/socket/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEhD,UAAU,sBAAsB;IAC9B,GAAG,EAAE,GAAG,CAAC,0BAA0B,CAAC;CACrC;AAED,qBAAa,eAAgB,YAAW,QAAQ,CAAC,kBAAkB;IAGrD,SAAS,CAAC,OAAO,EAAE,sBAAsB;IAFrD,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC;gBAEnB,OAAO,EAAE,sBAAsB;IAIxC,YAAY;IAIZ,QAAQ,CAAC,CAAC,SAAS,QAAQ,CAAC,2BAA2B,EAClE,GAAG,EAAE,CAAC,GACL,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;IAEjC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBjD,IAAI,WAAW,eA5BS,IAAK,SAAS,CAAC,GAAG,YAAW,IACnD,SAAM,CAAC,oBAAoB,qGAGH,IACxB,SAAM,CAAC,iBAAiB,0JAIlB,IACR,SAAS,CAAC,iBAAiB,KAoB1B;CACF"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/server/socket/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEhD,UAAU,sBAAsB;IAC9B,GAAG,EAAE,GAAG,CAAC,0BAA0B,CAAC;CACrC;AAED,qBAAa,eAAgB,YAAW,QAAQ,CAAC,kBAAkB;IAGrD,SAAS,CAAC,OAAO,EAAE,sBAAsB;IAFrD,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC;gBAEnB,OAAO,EAAE,sBAAsB;IAIxC,YAAY;IAIZ,QAAQ,CAAC,CAAC,SAAS,QAAQ,CAAC,2BAA2B,EAClE,GAAG,EAAE,CAAC,GACL,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;IAEjC,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBjD,IAAI,WAAW,+YAEd;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/sdk",
3
- "version": "0.4.5",
3
+ "version": "0.4.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",
@@ -26,15 +26,15 @@
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.5",
30
- "@rsdoctor/graph": "0.4.5",
31
- "@rsdoctor/types": "0.4.5",
32
- "@rsdoctor/utils": "0.4.5"
29
+ "@rsdoctor/client": "0.4.7",
30
+ "@rsdoctor/graph": "0.4.7",
31
+ "@rsdoctor/types": "0.4.7",
32
+ "@rsdoctor/utils": "0.4.7"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/body-parser": "1.19.5",
36
36
  "@types/cors": "2.8.17",
37
- "@types/lodash": "^4.17.9",
37
+ "@types/lodash": "^4.17.10",
38
38
  "@types/node": "^16",
39
39
  "@types/serve-static": "1.15.7",
40
40
  "tslib": "2.7.0",