Skip to content

Commit 320e56a

Browse files
authored
Merge branch 'main' into tweaks/parse-module
2 parents a6ff38c + 00b6e11 commit 320e56a

File tree

6 files changed

+41
-14
lines changed

6 files changed

+41
-14
lines changed

packages/ai/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"directory": "packages/ai"
88
},
99
"license": "MIT",
10-
"main": "./dist/server/index.js",
11-
"types": "./dist/server/index.d.ts",
10+
"main": "./dist/index.js",
11+
"types": "./dist/index.d.ts",
1212
"files": [
1313
"dist",
1414
"bin"

packages/ai/src/server/tools.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ export const getModuleById = async (
138138
moduleId: string,
139139
): Promise<{
140140
module: {
141-
id: string;
142-
renderId: string;
143-
webpackId: string | number;
141+
id: number;
142+
renderId?: string;
143+
webpackId: string;
144144
path: string;
145145
isPreferSource: boolean;
146146
imported: number[];
@@ -216,11 +216,11 @@ export const getPackageDependency = async () => {
216216
};
217217

218218
export const getRuleInfo = async () => {
219-
return await sendRequest(SDK.ServerAPI.API.GetOverlayAlerts, {});
219+
return await sendRequest(SDK.ServerAPI.API.GetBundleAlerts, {});
220220
};
221221

222222
export const getDuplicatePackages = async () => {
223-
const ruleInfo = await sendRequest(SDK.ServerAPI.API.GetOverlayAlerts, {});
223+
const ruleInfo = await sendRequest(SDK.ServerAPI.API.GetBundleAlerts, {});
224224

225225
if (!ruleInfo) {
226226
return {
@@ -233,9 +233,7 @@ export const getDuplicatePackages = async () => {
233233

234234
// Assuming ruleInfo contains a 'rules' array
235235
// @ts-ignore
236-
const e1001Rule = ruleInfo?.find((rule) =>
237-
rule.description?.includes('E1001'),
238-
);
236+
const e1001Rule = ruleInfo?.find((rule) => rule.code?.includes('E1001'));
239237

240238
if (e1001Rule) {
241239
return {

packages/types/src/sdk/server/apis/alerts.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ export interface AlertsAPIResponse {
1818
* get the alerts list which use to display in overlay at the client page
1919
*/
2020
[API.GetOverlayAlerts]: OverlayRuleStoreData[];
21+
22+
/**
23+
* get the alerts list which use to display in category bundle at the client page
24+
*/
25+
[API.GetBundleAlerts]: OverlayRuleStoreData[];
2126
}
2227

2328
export interface AlertsAPIRequestBody {

packages/types/src/sdk/server/apis/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export enum API {
7979
/** Alerts API */
8080
GetPackageRelationAlertDetails = '/api/alerts/details/package/relation',
8181
GetOverlayAlerts = '/api/alerts/overlay',
82+
GetBundleAlerts = '/api/alerts/bundle',
8283

8384
/** BundleDiff API */
8485
BundleDiffManifest = '/api/bundle_diff/manifest.json',

packages/utils/src/common/data/index.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -405,9 +405,18 @@ export class APIDataLoader {
405405

406406
case SDK.ServerAPI.API.GetOverlayAlerts:
407407
return this.loader.loadData('errors').then((res) => {
408-
return (res || []).filter(
408+
const results = (res || []).filter(
409409
(e) => e.code === Rule.RuleMessageCodeEnumerated.Overlay,
410-
) as R;
410+
) as Rule.OverlayRuleStoreData[];
411+
return results as R;
412+
});
413+
414+
case SDK.ServerAPI.API.GetBundleAlerts:
415+
return this.loader.loadData('errors').then((res) => {
416+
const results = (res || []).filter(
417+
(e) => e.category === Rule.RuleMessageCategory.Bundle,
418+
) as Rule.OverlayRuleStoreData[];
419+
return results as R;
411420
});
412421

413422
/** Bundle Diff API */
@@ -523,8 +532,8 @@ export class APIDataLoader {
523532

524533
case SDK.ServerAPI.API.GetChunkGraphAI:
525534
return this.loader.loadData('chunkGraph').then((res) => {
526-
const { chunks = [] } = res || {};
527-
const filteredChunks = chunks.map(({ modules, ...rest }) => rest);
535+
const { assets = [] } = res || {};
536+
const filteredChunks = assets.map(({ content, ...rest }) => rest);
528537
return filteredChunks as R;
529538
});
530539

pnpm-lock.yaml

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)