@rsdoctor/graph
Advanced tools
Comparing version
@@ -25,4 +25,9 @@ "use strict"; | ||
var import_types = require("@rsdoctor/types"); | ||
let id = 1; | ||
class Asset { | ||
static init() { | ||
id = 1; | ||
} | ||
constructor(path, size, chunks, content) { | ||
this.id = id++; | ||
this.path = path; | ||
@@ -35,2 +40,3 @@ this.size = size; | ||
return { | ||
id: this.id, | ||
path: this.path, | ||
@@ -42,2 +48,9 @@ size: this.size, | ||
} | ||
/* native asset */ | ||
setChunks(chunks) { | ||
this.chunks = chunks; | ||
} | ||
setId(id2) { | ||
this.id = id2; | ||
} | ||
} | ||
@@ -44,0 +57,0 @@ // Annotate the CommonJS export names for ESM import in node: |
@@ -101,2 +101,14 @@ "use strict"; | ||
} | ||
setDependencies(dependencies) { | ||
this._dependencies = dependencies; | ||
} | ||
setImported(imported) { | ||
this._imported = imported; | ||
} | ||
setModules(modules) { | ||
this._modules = modules; | ||
} | ||
setAssets(assets) { | ||
this._assets = assets; | ||
} | ||
} | ||
@@ -103,0 +115,0 @@ // Annotate the CommonJS export names for ESM import in node: |
@@ -24,2 +24,3 @@ "use strict"; | ||
module.exports = __toCommonJS(entrypoint_exports); | ||
let id = 1; | ||
class EntryPoint { | ||
@@ -30,3 +31,7 @@ constructor(name) { | ||
this._assets = []; | ||
this.id = id++; | ||
} | ||
static init() { | ||
id = 1; | ||
} | ||
addChunk(chunk) { | ||
@@ -44,2 +49,3 @@ if (this._chunks.includes(chunk)) | ||
return { | ||
id: this.id, | ||
name: this.name, | ||
@@ -51,2 +57,11 @@ chunks: this._chunks.map((e) => e.id), | ||
} | ||
setChunks(chunks) { | ||
this._chunks = chunks; | ||
} | ||
setAssets(assets) { | ||
this._assets = assets; | ||
} | ||
setId(id2) { | ||
this.id = id2; | ||
} | ||
} | ||
@@ -53,0 +68,0 @@ // Annotate the CommonJS export names for ESM import in node: |
@@ -27,2 +27,3 @@ "use strict"; | ||
this._assetMap = /* @__PURE__ */ new Map(); | ||
this._assetPathMap = /* @__PURE__ */ new Map(); | ||
this._chunkMap = /* @__PURE__ */ new Map(); | ||
@@ -39,3 +40,4 @@ this._entrypointMap = /* @__PURE__ */ new Map(); | ||
assets.forEach((asset) => { | ||
this._assetMap.set(asset.path, asset); | ||
this._assetMap.set(asset.id, asset); | ||
this._assetPathMap.set(asset.path, asset); | ||
}); | ||
@@ -52,13 +54,16 @@ } | ||
getAssetByPath(path) { | ||
return this._assetMap.get(path); | ||
return this._assetPathMap.get(path); | ||
} | ||
getAssetById(id) { | ||
return this._assetMap.get(id); | ||
} | ||
getEntryPoints() { | ||
return Array.from(this._entrypointMap.values()); | ||
} | ||
getEntryPointByName(name) { | ||
return this._entrypointMap.get(name); | ||
getEntryPointById(id) { | ||
return this._entrypointMap.get(id); | ||
} | ||
addEntryPoint(...entrypoints) { | ||
entrypoints.forEach((entrypoint) => { | ||
this._entrypointMap.set(entrypoint.name, entrypoint); | ||
this._entrypointMap.set(entrypoint.id, entrypoint); | ||
}); | ||
@@ -78,2 +83,12 @@ } | ||
} | ||
setChunks(chunks) { | ||
this._chunkMap = new Map(chunks.map((item) => [item.id, item])); | ||
} | ||
setEntrypoints(entrypoints) { | ||
this._entrypointMap = new Map(entrypoints.map((item) => [item.id, item])); | ||
} | ||
setAssets(assets) { | ||
this._assetMap = new Map(assets.map((item) => [item.id, item])); | ||
this._assetPathMap = new Map(assets.map((item) => [item.path, item])); | ||
} | ||
} | ||
@@ -80,0 +95,0 @@ // Annotate the CommonJS export names for ESM import in node: |
@@ -86,2 +86,5 @@ "use strict"; | ||
} | ||
setId(id2) { | ||
this.id = id2; | ||
} | ||
} | ||
@@ -88,0 +91,0 @@ Dependency.kind = import_types.SDK.DependencyKind; |
@@ -365,2 +365,12 @@ "use strict"; | ||
} | ||
setModules(modules) { | ||
this._moduleIdMap = new Map(modules.map((m) => [m.id, m])); | ||
this._moduleWebpackIdMap = new Map(modules.map((m) => [m.webpackId, m])); | ||
this._layers = new Map( | ||
modules.filter((m) => m.layer).map((m) => [m.layer, 1]) | ||
); | ||
} | ||
setDependencies(dependencies) { | ||
this._dependenciesIdMap = new Map(dependencies.map((d) => [d.id, d])); | ||
} | ||
} | ||
@@ -367,0 +377,0 @@ // Annotate the CommonJS export names for ESM import in node: |
@@ -296,2 +296,23 @@ "use strict"; | ||
} | ||
setId(id2) { | ||
this.id = id2; | ||
} | ||
setRenderId(renderId) { | ||
this.renderId = renderId; | ||
} | ||
setChunks(chunks) { | ||
this.chunks = chunks; | ||
} | ||
setDependencies(dependencies) { | ||
this.dependencies = dependencies; | ||
} | ||
setImported(imported) { | ||
this.imported = imported; | ||
} | ||
setModules(modules) { | ||
this.modules = modules; | ||
} | ||
setConcatenationModules(modules) { | ||
this.concatenationModules = modules; | ||
} | ||
} | ||
@@ -298,0 +319,0 @@ Module.kind = import_types.SDK.ModuleKind; |
import { SDK } from "@rsdoctor/types"; | ||
let id = 1; | ||
class Asset { | ||
static init() { | ||
id = 1; | ||
} | ||
constructor(path, size, chunks, content) { | ||
this.id = id++; | ||
this.path = path; | ||
@@ -11,2 +16,3 @@ this.size = size; | ||
return { | ||
id: this.id, | ||
path: this.path, | ||
@@ -18,2 +24,9 @@ size: this.size, | ||
} | ||
/* native asset */ | ||
setChunks(chunks) { | ||
this.chunks = chunks; | ||
} | ||
setId(id2) { | ||
this.id = id2; | ||
} | ||
} | ||
@@ -20,0 +33,0 @@ export { |
@@ -78,2 +78,14 @@ class Chunk { | ||
} | ||
setDependencies(dependencies) { | ||
this._dependencies = dependencies; | ||
} | ||
setImported(imported) { | ||
this._imported = imported; | ||
} | ||
setModules(modules) { | ||
this._modules = modules; | ||
} | ||
setAssets(assets) { | ||
this._assets = assets; | ||
} | ||
} | ||
@@ -80,0 +92,0 @@ export { |
@@ -0,1 +1,2 @@ | ||
let id = 1; | ||
class EntryPoint { | ||
@@ -6,3 +7,7 @@ constructor(name) { | ||
this._assets = []; | ||
this.id = id++; | ||
} | ||
static init() { | ||
id = 1; | ||
} | ||
addChunk(chunk) { | ||
@@ -20,2 +25,3 @@ if (this._chunks.includes(chunk)) | ||
return { | ||
id: this.id, | ||
name: this.name, | ||
@@ -27,2 +33,11 @@ chunks: this._chunks.map((e) => e.id), | ||
} | ||
setChunks(chunks) { | ||
this._chunks = chunks; | ||
} | ||
setAssets(assets) { | ||
this._assets = assets; | ||
} | ||
setId(id2) { | ||
this.id = id2; | ||
} | ||
} | ||
@@ -29,0 +44,0 @@ export { |
class ChunkGraph { | ||
constructor() { | ||
this._assetMap = /* @__PURE__ */ new Map(); | ||
this._assetPathMap = /* @__PURE__ */ new Map(); | ||
this._chunkMap = /* @__PURE__ */ new Map(); | ||
@@ -15,3 +16,4 @@ this._entrypointMap = /* @__PURE__ */ new Map(); | ||
assets.forEach((asset) => { | ||
this._assetMap.set(asset.path, asset); | ||
this._assetMap.set(asset.id, asset); | ||
this._assetPathMap.set(asset.path, asset); | ||
}); | ||
@@ -28,13 +30,16 @@ } | ||
getAssetByPath(path) { | ||
return this._assetMap.get(path); | ||
return this._assetPathMap.get(path); | ||
} | ||
getAssetById(id) { | ||
return this._assetMap.get(id); | ||
} | ||
getEntryPoints() { | ||
return Array.from(this._entrypointMap.values()); | ||
} | ||
getEntryPointByName(name) { | ||
return this._entrypointMap.get(name); | ||
getEntryPointById(id) { | ||
return this._entrypointMap.get(id); | ||
} | ||
addEntryPoint(...entrypoints) { | ||
entrypoints.forEach((entrypoint) => { | ||
this._entrypointMap.set(entrypoint.name, entrypoint); | ||
this._entrypointMap.set(entrypoint.id, entrypoint); | ||
}); | ||
@@ -54,2 +59,12 @@ } | ||
} | ||
setChunks(chunks) { | ||
this._chunkMap = new Map(chunks.map((item) => [item.id, item])); | ||
} | ||
setEntrypoints(entrypoints) { | ||
this._entrypointMap = new Map(entrypoints.map((item) => [item.id, item])); | ||
} | ||
setAssets(assets) { | ||
this._assetMap = new Map(assets.map((item) => [item.id, item])); | ||
this._assetPathMap = new Map(assets.map((item) => [item.path, item])); | ||
} | ||
} | ||
@@ -56,0 +71,0 @@ export { |
@@ -63,2 +63,5 @@ import { SDK } from "@rsdoctor/types"; | ||
} | ||
setId(id2) { | ||
this.id = id2; | ||
} | ||
} | ||
@@ -65,0 +68,0 @@ Dependency.kind = SDK.DependencyKind; |
@@ -347,2 +347,12 @@ import { SDK } from "@rsdoctor/types"; | ||
} | ||
setModules(modules) { | ||
this._moduleIdMap = new Map(modules.map((m) => [m.id, m])); | ||
this._moduleWebpackIdMap = new Map(modules.map((m) => [m.webpackId, m])); | ||
this._layers = new Map( | ||
modules.filter((m) => m.layer).map((m) => [m.layer, 1]) | ||
); | ||
} | ||
setDependencies(dependencies) { | ||
this._dependenciesIdMap = new Map(dependencies.map((d) => [d.id, d])); | ||
} | ||
} | ||
@@ -349,0 +359,0 @@ export { |
@@ -263,2 +263,23 @@ import { SDK } from "@rsdoctor/types"; | ||
} | ||
setId(id2) { | ||
this.id = id2; | ||
} | ||
setRenderId(renderId) { | ||
this.renderId = renderId; | ||
} | ||
setChunks(chunks) { | ||
this.chunks = chunks; | ||
} | ||
setDependencies(dependencies) { | ||
this.dependencies = dependencies; | ||
} | ||
setImported(imported) { | ||
this.imported = imported; | ||
} | ||
setModules(modules) { | ||
this.modules = modules; | ||
} | ||
setConcatenationModules(modules) { | ||
this.concatenationModules = modules; | ||
} | ||
} | ||
@@ -265,0 +286,0 @@ Module.kind = SDK.ModuleKind; |
import { SDK } from '@rsdoctor/types'; | ||
export declare class Asset implements SDK.AssetInstance { | ||
static init(): void; | ||
id: number; | ||
path: string; | ||
@@ -9,3 +11,5 @@ size: number; | ||
toData(types: SDK.ToDataType): SDK.AssetData; | ||
setChunks(chunks: SDK.ChunkInstance[]): void; | ||
setId(id: number): void; | ||
} | ||
//# sourceMappingURL=asset.d.ts.map |
@@ -28,3 +28,7 @@ import { SDK } from '@rsdoctor/types'; | ||
toData(): SDK.ChunkData; | ||
setDependencies(dependencies: SDK.ChunkInstance[]): void; | ||
setImported(imported: SDK.ChunkInstance[]): void; | ||
setModules(modules: SDK.ModuleInstance[]): void; | ||
setAssets(assets: SDK.AssetInstance[]): void; | ||
} | ||
//# sourceMappingURL=chunk.d.ts.map |
import { SDK } from '@rsdoctor/types'; | ||
export declare class EntryPoint implements SDK.EntryPointInstance { | ||
readonly name: string; | ||
static init(): void; | ||
constructor(name: string); | ||
id: number; | ||
private _chunks; | ||
private _assets; | ||
constructor(name: string); | ||
addChunk(chunk: SDK.ChunkInstance): void; | ||
addAsset(asset: SDK.AssetInstance): void; | ||
toData(): SDK.EntryPointData; | ||
setChunks(chunks: SDK.ChunkInstance[]): void; | ||
setAssets(assets: SDK.AssetInstance[]): void; | ||
setId(id: number): void; | ||
} | ||
//# sourceMappingURL=entrypoint.d.ts.map |
import { SDK } from '@rsdoctor/types'; | ||
export declare class ChunkGraph implements SDK.ChunkGraphInstance { | ||
private _assetMap; | ||
private _assetPathMap; | ||
private _chunkMap; | ||
@@ -12,8 +13,12 @@ private _entrypointMap; | ||
getAssetByPath(path: string): SDK.AssetInstance | undefined; | ||
getAssetById(id: number): SDK.AssetInstance | undefined; | ||
getEntryPoints(): SDK.EntryPointInstance[]; | ||
getEntryPointByName(name: string): SDK.EntryPointInstance | undefined; | ||
getEntryPointById(id: number): SDK.EntryPointInstance | undefined; | ||
addEntryPoint(...entrypoints: SDK.EntryPointInstance[]): void; | ||
/** output the chunk graph data */ | ||
toData(type: SDK.ToDataType): SDK.ChunkGraphData; | ||
setChunks(chunks: SDK.ChunkInstance[]): void; | ||
setEntrypoints(entrypoints: SDK.EntryPointInstance[]): void; | ||
setAssets(assets: SDK.AssetInstance[]): void; | ||
} | ||
//# sourceMappingURL=graph.d.ts.map |
@@ -5,3 +5,3 @@ import { SDK } from '@rsdoctor/types'; | ||
static init(): void; | ||
readonly id: number; | ||
id: number; | ||
readonly request: string; | ||
@@ -24,3 +24,4 @@ readonly module: SDK.ModuleInstance; | ||
toData(): SDK.DependencyData; | ||
setId(id: number): void; | ||
} | ||
//# sourceMappingURL=dependency.d.ts.map |
@@ -38,3 +38,5 @@ import { SDK } from '@rsdoctor/types'; | ||
toCodeData(type?: SDK.ToDataType): SDK.ModuleCodeData; | ||
setModules(modules: SDK.ModuleInstance[]): void; | ||
setDependencies(dependencies: SDK.DependencyInstance[]): void; | ||
} | ||
//# sourceMappingURL=graph.d.ts.map |
@@ -9,4 +9,4 @@ import { SDK } from '@rsdoctor/types'; | ||
static init(): void; | ||
readonly id: number; | ||
readonly renderId: string | undefined; | ||
id: number; | ||
renderId: string | undefined; | ||
readonly webpackId: string; | ||
@@ -66,3 +66,10 @@ readonly path: string; | ||
toData(contextPath?: string): SDK.ModuleData; | ||
setId(id: number): void; | ||
setRenderId(renderId: string): void; | ||
setChunks(chunks: SDK.ChunkInstance[]): void; | ||
setDependencies(dependencies: SDK.DependencyInstance[]): void; | ||
setImported(imported: SDK.ModuleInstance[]): void; | ||
setModules(modules: SDK.ModuleInstance[]): void; | ||
setConcatenationModules(modules: SDK.ModuleInstance[]): void; | ||
} | ||
//# sourceMappingURL=module.d.ts.map |
{ | ||
"name": "@rsdoctor/graph", | ||
"version": "1.0.0-beta.1", | ||
"version": "1.0.0-beta.2", | ||
"repository": { | ||
@@ -20,4 +20,4 @@ "type": "git", | ||
"source-map": "^0.7.4", | ||
"@rsdoctor/types": "1.0.0-beta.1", | ||
"@rsdoctor/utils": "1.0.0-beta.1" | ||
"@rsdoctor/types": "1.0.0-beta.2", | ||
"@rsdoctor/utils": "1.0.0-beta.2" | ||
}, | ||
@@ -24,0 +24,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
159859
4.25%4366
4.95%+ Added
+ Added
- Removed
- Removed
Updated
Updated