@rsdoctor/core 1.0.2-beta.0 → 1.0.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/common/module-graph/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAqB,MAAM,iBAAiB,CAAC;AAqCjE,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,CAAC,WAAW,EAAE,EAC7B,gBAAgB,EAAE,MAAM,CAAC,WAAW,EAAE,QAKvC;AAaD;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,gBAAgB,EAC5C,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,GAAG,CAAC,kBAAkB,eAwKnC"}
1
+ {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/common/module-graph/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAqB,MAAM,iBAAiB,CAAC;AAqCjE,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,CAAC,WAAW,EAAE,EAC7B,gBAAgB,EAAE,MAAM,CAAC,WAAW,EAAE,QAKvC;AAaD;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,gBAAgB,EAC5C,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,GAAG,CAAC,kBAAkB,eA2MnC"}
@@ -95,6 +95,9 @@ function getModuleGraphByStats({ modules, chunks }, root, chunkGraph) {
95
95
  data.id ? String(data.id) : void 0,
96
96
  data.layer
97
97
  );
98
+ if (data.issuerPath) {
99
+ concatenatedModule.addIssuerPath(data.issuerPath);
100
+ }
98
101
  data.chunks?.forEach((_chunkId) => {
99
102
  const chunk = chunkGraph.getChunkById(String(_chunkId));
100
103
  chunk && concatenatedModule.addChunk(chunk);
@@ -117,14 +120,23 @@ function getModuleGraphByStats({ modules, chunks }, root, chunkGraph) {
117
120
  }
118
121
  allModules.push(normal);
119
122
  const webpackId = normal.identifier;
120
- const normalModule = moduleGraph.getModuleByWebpackId(webpackId) ?? new import_graph.Module(
121
- webpackId,
122
- getGetModuleName(root, normal),
123
- normal.depth === 0,
124
- import_types.SDK.ModuleKind.Normal,
125
- normal.id ? String(normal.id) : void 0,
126
- normal.layer
127
- );
123
+ const registeredModule = moduleGraph.getModuleByWebpackId(webpackId);
124
+ let normalModule;
125
+ if (registeredModule) {
126
+ normalModule = registeredModule;
127
+ } else {
128
+ normalModule = moduleGraph.getModuleByWebpackId(webpackId) ?? new import_graph.Module(
129
+ webpackId,
130
+ getGetModuleName(root, normal),
131
+ normal.depth === 0,
132
+ import_types.SDK.ModuleKind.Normal,
133
+ normal.id ? String(normal.id) : void 0,
134
+ normal.layer
135
+ );
136
+ }
137
+ if (normal.issuerPath) {
138
+ normalModule.addIssuerPath(normal.issuerPath);
139
+ }
128
140
  if (normal.chunks?.length) {
129
141
  normal.chunks?.forEach((_chunkId) => {
130
142
  const chunk = chunkGraph.getChunkById(String(_chunkId));
@@ -195,6 +207,24 @@ function getModuleGraphByStats({ modules, chunks }, root, chunkGraph) {
195
207
  }
196
208
  }
197
209
  }
210
+ const moduleCache = /* @__PURE__ */ new Map();
211
+ moduleGraph.getModules().forEach((module2) => {
212
+ if (module2.issuerPath) {
213
+ module2.issuerPath.forEach((issuer) => {
214
+ let moduleInstance = moduleCache.get(issuer.identifier);
215
+ if (!moduleInstance) {
216
+ moduleInstance = moduleGraph.getModuleByWebpackId(issuer.identifier);
217
+ if (moduleInstance) {
218
+ moduleCache.set(issuer.identifier, moduleInstance);
219
+ }
220
+ }
221
+ if (moduleInstance) {
222
+ issuer.moduleId = moduleInstance.id;
223
+ issuer.identifier = "";
224
+ }
225
+ });
226
+ }
227
+ });
198
228
  return moduleGraph;
199
229
  }
200
230
  // Annotate the CommonJS export names for ESM import in node:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/core",
3
- "version": "1.0.2-beta.0",
3
+ "version": "1.0.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",
@@ -73,13 +73,13 @@
73
73
  "webpack-bundle-analyzer": "^4.10.2",
74
74
  "@rsbuild/plugin-check-syntax": "1.3.0",
75
75
  "browserslist-load-config": "^1.0.0",
76
- "@rsdoctor/graph": "1.0.2-beta.0",
77
- "@rsdoctor/sdk": "1.0.2-beta.0",
78
- "@rsdoctor/utils": "1.0.2-beta.0",
79
- "@rsdoctor/types": "1.0.2-beta.0"
76
+ "@rsdoctor/graph": "1.0.2",
77
+ "@rsdoctor/sdk": "1.0.2",
78
+ "@rsdoctor/utils": "1.0.2",
79
+ "@rsdoctor/types": "1.0.2"
80
80
  },
81
81
  "devDependencies": {
82
- "@rspack/core": "^1.2.8",
82
+ "@rspack/core": "1.3.5",
83
83
  "@types/fs-extra": "^11.0.4",
84
84
  "@types/lodash": "^4.17.16",
85
85
  "@types/node": "^16",