@modern-js/devtools-kit 0.0.0-nightly-20240220170629 → 0.0.0-nightly-20240222170629

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/dist/client.d.ts CHANGED
@@ -26,10 +26,15 @@ export declare class AnnouncementDefinition {
26
26
  src: string;
27
27
  fallback: string;
28
28
  }
29
+ export declare class DoctorDefinition {
30
+ home: string;
31
+ quickStart: string;
32
+ }
29
33
  export declare class ClientDefinition {
30
34
  name: NameDefinition;
31
35
  packages: PackageDefinition;
32
36
  assets: AssetDefinition;
37
+ doctor: DoctorDefinition;
33
38
  announcement: AnnouncementDefinition;
34
39
  }
35
40
  export interface IframeTabView {
package/dist/client.js CHANGED
@@ -31,6 +31,7 @@ __export(client_exports, {
31
31
  AnnouncementDefinition: () => AnnouncementDefinition,
32
32
  AssetDefinition: () => AssetDefinition,
33
33
  ClientDefinition: () => ClientDefinition,
34
+ DoctorDefinition: () => DoctorDefinition,
34
35
  NameDefinition: () => NameDefinition,
35
36
  PackageDefinition: () => PackageDefinition
36
37
  });
@@ -59,11 +60,18 @@ class AnnouncementDefinition {
59
60
  this.fallback = "https://modernjs.dev/";
60
61
  }
61
62
  }
63
+ class DoctorDefinition {
64
+ constructor() {
65
+ this.home = "https://rsdoctor.dev";
66
+ this.quickStart = "https://rsdoctor.dev/guide/start/quick-start";
67
+ }
68
+ }
62
69
  class ClientDefinition {
63
70
  constructor() {
64
71
  this.name = new NameDefinition();
65
72
  this.packages = new PackageDefinition();
66
73
  this.assets = new AssetDefinition();
74
+ this.doctor = new DoctorDefinition();
67
75
  this.announcement = new AnnouncementDefinition();
68
76
  }
69
77
  }
@@ -72,6 +80,7 @@ class ClientDefinition {
72
80
  AnnouncementDefinition,
73
81
  AssetDefinition,
74
82
  ClientDefinition,
83
+ DoctorDefinition,
75
84
  NameDefinition,
76
85
  PackageDefinition
77
86
  });
package/dist/node.d.ts CHANGED
@@ -4,3 +4,4 @@ export * from './mount-point';
4
4
  export * from './utils';
5
5
  export * from './constants';
6
6
  export * from './channel';
7
+ export * from './rsdoctor';
package/dist/node.js CHANGED
@@ -21,6 +21,7 @@ __reExport(node_exports, require("./mount-point"), module.exports);
21
21
  __reExport(node_exports, require("./utils"), module.exports);
22
22
  __reExport(node_exports, require("./constants"), module.exports);
23
23
  __reExport(node_exports, require("./channel"), module.exports);
24
+ __reExport(node_exports, require("./rsdoctor"), module.exports);
24
25
  // Annotate the CommonJS export names for ESM import in node:
25
26
  0 && (module.exports = {
26
27
  ...require("./server"),
@@ -28,5 +29,6 @@ __reExport(node_exports, require("./channel"), module.exports);
28
29
  ...require("./mount-point"),
29
30
  ...require("./utils"),
30
31
  ...require("./constants"),
31
- ...require("./channel")
32
+ ...require("./channel"),
33
+ ...require("./rsdoctor")
32
34
  });
@@ -0,0 +1,7 @@
1
+ import type { Manifest } from '@rsdoctor/types';
2
+ export declare function fetchShardingFile(url: string): Promise<string>;
3
+ export declare function parseManifest(json: Manifest.RsdoctorManifestWithShardingFiles): Promise<Manifest.RsdoctorManifest>;
4
+ /**
5
+ * @throws {Error} Cannot find manifest.json in ${rootPath}
6
+ */
7
+ export declare function findManifest(dirname: string, silent?: boolean): Promise<string>;
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var rsdoctor_exports = {};
30
+ __export(rsdoctor_exports, {
31
+ fetchShardingFile: () => fetchShardingFile,
32
+ findManifest: () => findManifest,
33
+ parseManifest: () => parseManifest
34
+ });
35
+ module.exports = __toCommonJS(rsdoctor_exports);
36
+ var import_path = __toESM(require("path"));
37
+ var import_fs_extra = __toESM(require("@modern-js/utils/fs-extra"));
38
+ var utils = __toESM(require("@rsdoctor/utils/common"));
39
+ async function fetchShardingFile(url) {
40
+ const { Url } = await Promise.resolve().then(() => __toESM(require("@rsdoctor/utils/common")));
41
+ if (Url.isUrl(url)) {
42
+ const resp = await fetch(url);
43
+ return resp.text();
44
+ }
45
+ return url;
46
+ }
47
+ async function parseManifest(json) {
48
+ if ("cloudManifestUrl" in json && "cloudData" in json) {
49
+ try {
50
+ const data2 = await utils.Manifest.fetchShardingFiles(json.data, fetchShardingFile);
51
+ return {
52
+ ...json,
53
+ data: data2
54
+ };
55
+ } catch (err) {
56
+ console.error(err);
57
+ }
58
+ }
59
+ const data = await utils.Manifest.fetchShardingFiles(json.data, (url) => import_fs_extra.default.readFile(url, "utf-8"));
60
+ return {
61
+ ...json,
62
+ data
63
+ };
64
+ }
65
+ const MANIFEST_DIRS = [
66
+ ".rsdoctor",
67
+ ".web-doctor"
68
+ ];
69
+ const MANIFEST_NAME = "manifest.json";
70
+ async function findManifest(dirname, silent = false) {
71
+ for (const dir of MANIFEST_DIRS) {
72
+ const manifestPath = import_path.default.resolve(dirname, dir, MANIFEST_NAME);
73
+ if (import_fs_extra.default.existsSync(manifestPath)) {
74
+ return manifestPath;
75
+ }
76
+ }
77
+ if (silent) {
78
+ return "";
79
+ } else {
80
+ throw new Error(`Cannot find manifest.json in ${dirname}`);
81
+ }
82
+ }
83
+ // Annotate the CommonJS export names for ESM import in node:
84
+ 0 && (module.exports = {
85
+ fetchShardingFile,
86
+ findManifest,
87
+ parseManifest
88
+ });
package/dist/runtime.d.ts CHANGED
@@ -4,3 +4,4 @@ export * from './mount-point';
4
4
  export * from './utils';
5
5
  export * from './constants';
6
6
  export * from './channel';
7
+ export type * from './rsdoctor';
package/dist/server.d.ts CHANGED
@@ -2,6 +2,7 @@ import type { AppTools, IAppContext, UserConfig } from '@modern-js/app-tools';
2
2
  import type { RsbuildContext, NormalizedConfig as NormalizedBuilderConfig, RsbuildConfig, webpack, Rspack, WebpackConfig, RspackConfig } from '@modern-js/uni-builder';
3
3
  import { NormalizedConfig } from '@modern-js/core';
4
4
  import { RouteLegacy, NestedRouteForCli, PageRoute } from '@modern-js/types';
5
+ import type { Manifest } from '@rsdoctor/types';
5
6
  import type { ClientDefinition } from './client';
6
7
  export type BuilderContext = RsbuildContext;
7
8
  export type FrameworkConfig = UserConfig<AppTools>;
@@ -13,6 +14,13 @@ export type BundlerConfig = WebpackConfig | RspackConfig;
13
14
  export type Compiler = webpack.Compiler | Rspack.Compiler | webpack.MultiCompiler | Rspack.MultiCompiler;
14
15
  export type AppContext = Omit<IAppContext, 'builder' | 'serverInternalPlugins'>;
15
16
  export type FileSystemRoutes = RouteLegacy[] | (NestedRouteForCli | PageRoute)[];
17
+ export interface DoctorManifestOverview {
18
+ numModules: number;
19
+ numChunks: number;
20
+ numPackages: number;
21
+ summary: Manifest.RsdoctorManifest['data']['summary'];
22
+ errors: Manifest.RsdoctorManifest['data']['errors'];
23
+ }
16
24
  export interface ServerFunctions {
17
25
  getFrameworkConfig: () => Promise<FrameworkConfig>;
18
26
  getTransformedFrameworkConfig: () => Promise<TransformedFrameworkConfig>;
@@ -26,5 +34,6 @@ export interface ServerFunctions {
26
34
  getDependencies: () => Promise<Record<string, string>>;
27
35
  getCompileTimeCost: () => Promise<number>;
28
36
  getClientDefinition: () => Promise<ClientDefinition>;
37
+ getDoctorOverview: () => Promise<DoctorManifestOverview>;
29
38
  echo: (content: string) => string;
30
39
  }
package/package.json CHANGED
@@ -21,7 +21,7 @@
21
21
  "modern",
22
22
  "modern.js"
23
23
  ],
24
- "version": "0.0.0-nightly-20240220170629",
24
+ "version": "0.0.0-nightly-20240222170629",
25
25
  "jsnext:source": "./src/index.ts",
26
26
  "types": "./dist/index.d.ts",
27
27
  "main": "./dist/index.js",
@@ -61,8 +61,10 @@
61
61
  "ufo": "^1.3.0",
62
62
  "flatted": "^3.2.9",
63
63
  "ws": "^8.13.0",
64
- "@modern-js/types": "0.0.0-nightly-20240220170629",
65
- "@modern-js/utils": "0.0.0-nightly-20240220170629"
64
+ "@rsdoctor/types": "^0.1.3",
65
+ "@rsdoctor/utils": "^0.1.3",
66
+ "@modern-js/types": "0.0.0-nightly-20240222170629",
67
+ "@modern-js/utils": "0.0.0-nightly-20240222170629"
66
68
  },
67
69
  "devDependencies": {
68
70
  "@babel/core": "^7.23.2",
@@ -77,28 +79,16 @@
77
79
  "react": "~18.2.0",
78
80
  "type-fest": "^4.1.0",
79
81
  "typescript": "^5",
80
- "@rsdoctor/types": "^0.1.0",
81
- "@rsdoctor/utils": "^0.1.0",
82
- "@modern-js/app-tools": "0.0.0-nightly-20240220170629",
83
- "@modern-js/core": "0.0.0-nightly-20240220170629",
84
- "@modern-js/module-tools": "0.0.0-nightly-20240220170629",
85
- "@modern-js/uni-builder": "0.0.0-nightly-20240220170629",
86
- "@modern-js/types": "0.0.0-nightly-20240220170629",
87
- "@scripts/build": "0.0.0-nightly-20240220170629",
88
- "@scripts/jest-config": "0.0.0-nightly-20240220170629"
82
+ "@modern-js/core": "0.0.0-nightly-20240222170629",
83
+ "@modern-js/app-tools": "0.0.0-nightly-20240222170629",
84
+ "@modern-js/module-tools": "0.0.0-nightly-20240222170629",
85
+ "@modern-js/types": "0.0.0-nightly-20240222170629",
86
+ "@modern-js/uni-builder": "0.0.0-nightly-20240222170629",
87
+ "@scripts/build": "0.0.0-nightly-20240222170629",
88
+ "@scripts/jest-config": "0.0.0-nightly-20240222170629"
89
89
  },
90
90
  "peerDependencies": {
91
- "react": "~18.2.0",
92
- "@rsdoctor/types": "^0.1.0",
93
- "@rsdoctor/utils": "^0.1.0"
94
- },
95
- "peerDependenciesMeta": {
96
- "@rsdoctor/types": {
97
- "optional": true
98
- },
99
- "@rsdoctor/utils": {
100
- "optional": true
101
- }
91
+ "react": "~18.2.0"
102
92
  },
103
93
  "sideEffects": false,
104
94
  "publishConfig": {