@statoscope/webpack-model
Advanced tools
Comparing version 5.28.0 to 5.28.1
@@ -1,18 +0,10 @@ | ||
import { Webpack } from '../webpack'; | ||
import type { Webpack } from '../webpack'; | ||
import type { EntrypointItem } from '../types'; | ||
import Module = Webpack.Module; | ||
import RawModule = Webpack.RawModule; | ||
import Compilation = Webpack.Compilation; | ||
import Chunk = Webpack.Chunk; | ||
import Asset = Webpack.Asset; | ||
import Reason = Webpack.Reason; | ||
import RawReason = Webpack.RawReason; | ||
import RawAsset = Webpack.RawAsset; | ||
export declare function collector<TResult, TID, TEntry = TResult>(from: TEntry[], isItem: (entry: TEntry) => boolean, getChildren: (entry: TEntry) => TEntry[], getId: (item: TResult) => TID): Map<TID, TResult>; | ||
export declare function collectRawModules(compilation: Compilation): RawModule[]; | ||
export declare function collectRawModulesFromArray(modules: Module[]): Map<string, RawModule>; | ||
export declare function collectRawAssetsFromArray(assets: Asset[]): Map<string, RawAsset>; | ||
export declare function collectRawReasonsFromArray(modules: Reason[]): Map<number, RawReason>; | ||
export declare function collectRawChunks(compilation: Compilation): Chunk[]; | ||
export declare function collectRawAssets(compilation: Compilation): RawAsset[]; | ||
export declare function collectRawEntrypoints(compilation: Compilation): EntrypointItem[]; | ||
export declare function collectRawModules(compilation: Webpack.Compilation): Webpack.RawModule[]; | ||
export declare function collectRawModulesFromArray(modules: Webpack.Module[]): Map<string, Webpack.RawModule>; | ||
export declare function collectRawAssetsFromArray(assets: Webpack.Asset[]): Map<string, Webpack.RawAsset>; | ||
export declare function collectRawReasonsFromArray(modules: Webpack.Reason[]): Map<number, Webpack.RawReason>; | ||
export declare function collectRawChunks(compilation: Webpack.Compilation): Webpack.Chunk[]; | ||
export declare function collectRawAssets(compilation: Webpack.Compilation): Webpack.RawAsset[]; | ||
export declare function collectRawEntrypoints(compilation: Webpack.Compilation): EntrypointItem[]; |
@@ -1,6 +0,4 @@ | ||
import { NormalizationData, Webpack } from '../webpack'; | ||
import Compilation = Webpack.Compilation; | ||
import RawModule = Webpack.RawModule; | ||
export declare type ModulesMap = Map<number, RawModule>; | ||
export declare type CompilationData = { | ||
import { NormalizationData, type Webpack } from '../webpack'; | ||
export type ModulesMap = Map<number, Webpack.RawModule>; | ||
export type CompilationData = { | ||
id: string; | ||
@@ -11,3 +9,3 @@ data: { | ||
}; | ||
export declare type DenormalizationData = { | ||
export type DenormalizationData = { | ||
links: NormalizationData['links']; | ||
@@ -18,2 +16,2 @@ data: { | ||
}; | ||
export default function denormalizeCompilation<T extends Compilation>(json: T): T; | ||
export default function denormalizeCompilation<T extends Webpack.Compilation>(json: T): T; |
@@ -1,6 +0,5 @@ | ||
import { Webpack } from '../webpack'; | ||
import type { Webpack } from '../webpack'; | ||
import { HandledCompilation, HandledFileContext, ProcessingContext } from '../types'; | ||
import { NormalizedFile, RawStatsFileDescriptor } from '../types'; | ||
import Compilation = Webpack.Compilation; | ||
export default function handleCompilations(rawStatsFileDescriptor: RawStatsFileDescriptor, file: NormalizedFile, fileContext: HandledFileContext): HandledCompilation[]; | ||
export declare function extractPackages(compilation: Compilation, context: ProcessingContext): void; | ||
export declare function extractPackages(compilation: Webpack.Compilation, context: ProcessingContext): void; |
@@ -91,3 +91,2 @@ "use strict"; | ||
function handleCompilation(compilation, file, parent, fileContext) { | ||
var _a; | ||
const normalized = { | ||
@@ -123,3 +122,2 @@ time: compilation.time, | ||
}), | ||
chunkAssets: new Map(), | ||
}; | ||
@@ -146,13 +144,2 @@ const resolvers = { | ||
for (const asset of (0, collector_1.collectRawAssets)(compilation)) { | ||
for (let chunkOrId of (_a = asset.chunks) !== null && _a !== void 0 ? _a : []) { | ||
if (chunkOrId && typeof chunkOrId !== 'string' && typeof chunkOrId !== 'number') { | ||
chunkOrId = chunkOrId.id; | ||
} | ||
let assets = processingContext.rawIndexes.chunkAssets.get(chunkOrId); | ||
if (!assets) { | ||
assets = new Set(); | ||
processingContext.rawIndexes.chunkAssets.set(chunkOrId, assets); | ||
} | ||
assets.add(asset); | ||
} | ||
processingContext.rawIndexes.assets.add(asset); | ||
@@ -325,3 +312,2 @@ } | ||
function prepareChunk(chunk, context) { | ||
var _a, _b; | ||
if (chunk == null) { | ||
@@ -342,17 +328,9 @@ return; | ||
if (chunk.files) { | ||
const assets = chunk.files | ||
normalizedChunk.files = chunk.files | ||
.filter(Boolean) // to skip null files, issue #158 | ||
.map((f) => context.rawIndexes.assets.get(typeof f === 'string' ? f : f.name)) | ||
.filter(Boolean); | ||
const assetsUniq = new Set(assets); | ||
for (const asset of (_a = context.rawIndexes.chunkAssets.get(chunk.id)) !== null && _a !== void 0 ? _a : []) { | ||
assetsUniq.add(asset); | ||
} | ||
normalizedChunk.files = [...assetsUniq]; | ||
} | ||
else { | ||
chunk.files = []; | ||
for (const asset of (_b = context.rawIndexes.chunkAssets.get(chunk.id)) !== null && _b !== void 0 ? _b : []) { | ||
chunk.files.push(asset); | ||
} | ||
} | ||
@@ -359,0 +337,0 @@ if (chunk.sizes) { |
@@ -6,5 +6,5 @@ import { Options } from '@statoscope/helpers/dist/jora'; | ||
export * as module from './module'; | ||
export { StatsExtensionWebpackAdapter } from './stats-extension-webpack-adapter'; | ||
export type { StatsExtensionWebpackAdapter } from './stats-extension-webpack-adapter'; | ||
export { joraHelpers, normalize }; | ||
export declare type Prepared = { | ||
export type Prepared = { | ||
files: NormalizedFile[]; | ||
@@ -11,0 +11,0 @@ compilations: NormalizedCompilation[]; |
@@ -8,12 +8,11 @@ import type { Size } from '@statoscope/stats-extension-compressed/dist/generator'; | ||
import { Report } from '@statoscope/types/types/custom-report'; | ||
import { Webpack } from '../webpack'; | ||
import type { Webpack } from '../webpack'; | ||
import { ModuleGraphNodeData, NodeModuleInstance, NormalizedAsset, NormalizedChunk, NormalizedCompilation, NormalizedEntrypointItem, NormalizedExtension, NormalizedModule, NormalizedPackage, NormalizeResult, NormalizedFile } from '../types'; | ||
import { moduleNameResource, moduleReasonResource, moduleResource, nodeModule } from './module'; | ||
import { Node as FoamTreeNode } from './modules-to-foam-tree'; | ||
import ChunkID = Webpack.ChunkID; | ||
export declare type ResolvedStats = { | ||
export type ResolvedStats = { | ||
file: NormalizedFile; | ||
compilation: NormalizedCompilation; | ||
}; | ||
export declare type ResolvedRelatedItem = { | ||
export type ResolvedRelatedItem = { | ||
type: 'module'; | ||
@@ -49,3 +48,3 @@ item: NormalizedModule | null; | ||
resolveCompilationByEntrypoint(entrypoint: NormalizedEntrypointItem, fileName: string): NormalizedCompilation | null; | ||
resolveChunk(id: ChunkID, compilationHash: string): NormalizedChunk | null; | ||
resolveChunk(id: Webpack.ChunkID, compilationHash: string): NormalizedChunk | null; | ||
resolveAsset(id: string, compilationHash: string): NormalizedAsset | null; | ||
@@ -52,0 +51,0 @@ resolveModule(id: string, compilationHash: string): NormalizedModule | null; |
@@ -1,5 +0,3 @@ | ||
import { Webpack } from '../webpack'; | ||
import type { Webpack } from '../webpack'; | ||
import { NormalizedModule, NormalizedReason } from '../types'; | ||
import RawModule = Webpack.RawModule; | ||
import RawReason = Webpack.RawReason; | ||
export declare const extractFileRx: RegExp; | ||
@@ -9,5 +7,5 @@ export declare const concatenatedIdRx: RegExp; | ||
export declare function moduleNameResource(name: string | null): string | null; | ||
export declare function moduleResource(module: RawModule | NormalizedModule | null): string | null; | ||
export declare function moduleReasonResource(reason: RawReason | NormalizedReason | null): string | null; | ||
export declare type NodeModule = { | ||
export declare function moduleResource(module: Webpack.RawModule | NormalizedModule | null): string | null; | ||
export declare function moduleReasonResource(reason: Webpack.RawReason | NormalizedReason | null): string | null; | ||
export type NodeModule = { | ||
path: string; | ||
@@ -14,0 +12,0 @@ name: string; |
@@ -65,3 +65,7 @@ "use strict"; | ||
cached = name | ||
? { path: input, name: [namespace, name].filter(Boolean).join('/'), isRoot } | ||
? { | ||
path: input, | ||
name: [namespace, name].filter(Boolean).join('/'), | ||
isRoot, | ||
} | ||
: null; | ||
@@ -68,0 +72,0 @@ nodeModuleNameCache.set(path, cached); |
import { Compressor, Size } from '@statoscope/stats-extension-compressed/dist/generator'; | ||
import { NormalizedModule } from '../types'; | ||
export declare type NodeLink = { | ||
export type NodeLink = { | ||
page: string; | ||
@@ -14,7 +14,7 @@ id: string; | ||
}; | ||
export declare type NodeData = { | ||
export type NodeData = { | ||
label: string; | ||
link?: string | NodeLink; | ||
}; | ||
export declare type Node = { | ||
export type Node = { | ||
label: string; | ||
@@ -27,3 +27,3 @@ weight: number; | ||
}; | ||
export declare type GetModuleSizeFN = (module: NormalizedModule) => Size; | ||
export type GetModuleSizeFN = (module: NormalizedModule) => Size; | ||
export default function modulesToFoamTree(modules: NormalizedModule[], getModuleSize: GetModuleSizeFN): Node; |
@@ -19,3 +19,4 @@ "use strict"; | ||
} | ||
const parts = resource.split(/[/\\]/).map((label) => ({ label })); | ||
const partsLabels = resource.split(/[/\\]/); | ||
const parts = partsLabels.map((label) => ({ label })); | ||
let currentPackage = null; | ||
@@ -45,6 +46,3 @@ for (const [i, part] of parts.entries()) { | ||
params: { | ||
instance: parts | ||
.map((part) => part.label) | ||
.slice(0, i + 1) | ||
.join('/'), | ||
instance: partsLabels.slice(0, i + 1).join('/'), | ||
}, | ||
@@ -51,0 +49,0 @@ }; |
{ | ||
"name": "@statoscope/webpack-model", | ||
"version": "5.28.0", | ||
"version": "5.28.1", | ||
"description": "This package contains helpers to process webpack stats", | ||
"main": "./dist/index.js", | ||
"scripts": { | ||
"build": "../../node_modules/.bin/tsc", | ||
"prepublishOnly": "npm run build" | ||
"build": "../../node_modules/.bin/tsc" | ||
}, | ||
@@ -21,18 +20,18 @@ "repository": "https://github.com/statoscope/statoscope.git", | ||
"dependencies": { | ||
"@statoscope/extensions": "5.14.1", | ||
"@statoscope/helpers": "5.28.0", | ||
"@statoscope/stats": "5.14.1", | ||
"@statoscope/stats-extension-compressed": "5.28.0", | ||
"@statoscope/stats-extension-custom-reports": "5.28.0", | ||
"@statoscope/stats-extension-package-info": "5.28.0", | ||
"@statoscope/stats-extension-stats-validation-result": "5.28.0", | ||
"@statoscope/types": "5.27.0", | ||
"@statoscope/extensions": "5.28.1", | ||
"@statoscope/helpers": "5.28.1", | ||
"@statoscope/stats": "5.28.1", | ||
"@statoscope/stats-extension-compressed": "5.28.1", | ||
"@statoscope/stats-extension-custom-reports": "5.28.1", | ||
"@statoscope/stats-extension-package-info": "5.28.1", | ||
"@statoscope/stats-extension-stats-validation-result": "5.28.1", | ||
"@statoscope/types": "5.28.1", | ||
"@types/md5": "^2.3.2", | ||
"@types/webpack": "^5.0.0", | ||
"md5": "^2.3.0" | ||
}, | ||
"devDependencies": { | ||
"@types/md5": "^2.3.0", | ||
"@types/webpack": "^5.0.0", | ||
"flatted": "^3.1.1" | ||
"flatted": "^3.2.7" | ||
}, | ||
"gitHead": "8593d1728fba7201855ba496eb5c01d28333c60b" | ||
"gitHead": "a89f68a6251a1c914791e22b643dd94ca2a70253" | ||
} |
@@ -7,14 +7,6 @@ import { ResolverFn } from '@statoscope/helpers/dist/entity-resolver'; | ||
import { Webpack } from './webpack'; | ||
import ChunkID = Webpack.ChunkID; | ||
import Entrypoint = Webpack.Entrypoint; | ||
import RawModule = Webpack.RawModule; | ||
import RawAsset = Webpack.RawAsset; | ||
import Chunk = Webpack.Chunk; | ||
import IssuerPathItem = Webpack.IssuerPathItem; | ||
import Compilation = Webpack.Compilation; | ||
import RawReason = Webpack.RawReason; | ||
export type CompilationResolvers = { | ||
resolveModule: ResolverFn<string, NormalizedModule>; | ||
resolveChunk: ResolverFn<ChunkID, NormalizedChunk>; | ||
resolveChunk: ResolverFn<Webpack.ChunkID, NormalizedChunk>; | ||
resolveAsset: ResolverFn<string, NormalizedAsset>; | ||
@@ -26,3 +18,3 @@ resolvePackage: ResolverFn<string, NormalizedPackage>; | ||
export type NormalizedChunk = Omit< | ||
Chunk, | ||
Webpack.Chunk, | ||
'modules' | 'files' | 'children' | 'parents' | 'siblings' | ||
@@ -38,3 +30,3 @@ > & { | ||
export type NormalizedEntrypointItem = { name: string; data: NormalizedEntrypoint }; | ||
export type NormalizedEntrypoint = Omit<Entrypoint, 'chunks' | 'assets'> & { | ||
export type NormalizedEntrypoint = Omit<Webpack.Entrypoint, 'chunks' | 'assets'> & { | ||
chunks: NormalizedChunk[]; | ||
@@ -44,7 +36,7 @@ assets: NormalizedAsset[]; | ||
}; | ||
export type NormalizedAsset = Omit<RawAsset, 'chunks' | 'files'> & { | ||
export type NormalizedAsset = Omit<Webpack.RawAsset, 'chunks' | 'files'> & { | ||
chunks: NormalizedChunk[]; | ||
files: File[]; | ||
}; | ||
export type NormalizedIssuerPathItem = IssuerPathItem & { | ||
export type NormalizedIssuerPathItem = Webpack.IssuerPathItem & { | ||
resolvedModule: NormalizedModule | null; | ||
@@ -54,3 +46,3 @@ resolvedEntry?: NormalizedEntrypointItem | null; | ||
}; | ||
export type NormalizedReason = RawReason & { | ||
export type NormalizedReason = Webpack.RawReason & { | ||
resolvedModule: NormalizedModule | null; | ||
@@ -66,3 +58,3 @@ resolvedEntry?: NormalizedEntrypointItem | null; | ||
export type NormalizedModule = Omit< | ||
RawModule, | ||
Webpack.RawModule, | ||
'chunks' | 'reasons' | 'modules' | 'issuerPath' | ||
@@ -111,3 +103,3 @@ > & { | ||
modules: IndexAPI<string, NormalizedModule>; | ||
chunks: IndexAPI<ChunkID, NormalizedChunk>; | ||
chunks: IndexAPI<Webpack.ChunkID, NormalizedChunk>; | ||
assets: IndexAPI<string, NormalizedAsset>; | ||
@@ -120,10 +112,9 @@ packages: IndexAPI<string, NormalizedPackage>; | ||
name: string; | ||
data: Entrypoint; | ||
data: Webpack.Entrypoint; | ||
}; | ||
export type RawIndexes = { | ||
modules: IndexAPI<string, RawModule>; | ||
chunks: IndexAPI<ChunkID, Chunk>; | ||
assets: IndexAPI<string, RawAsset>; | ||
chunkAssets: Map<ChunkID, Set<RawAsset>>; | ||
modules: IndexAPI<string, Webpack.RawModule>; | ||
chunks: IndexAPI<Webpack.ChunkID, Webpack.Chunk>; | ||
assets: IndexAPI<string, Webpack.RawAsset>; | ||
entrypoints: IndexAPI<string, EntrypointItem>; | ||
@@ -170,3 +161,3 @@ }; | ||
resolveCompilationByEntrypoint( | ||
entrypoint: NormalizedEntrypointItem | ||
entrypoint: NormalizedEntrypointItem, | ||
): NormalizedCompilation | null; | ||
@@ -176,3 +167,3 @@ }; | ||
export type RawStatsFileDescriptor = { name: string; data: Compilation }; | ||
export type RawStatsFileDescriptor = { name: string; data: Webpack.Compilation }; | ||
@@ -179,0 +170,0 @@ export type NormalizedFile = { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1
86065
11
1947
+ Added@types/md5@^2.3.2
+ Added@types/webpack@^5.0.0
+ Added@jridgewell/gen-mapping@0.3.8(transitive)
+ Added@jridgewell/resolve-uri@3.1.2(transitive)
+ Added@jridgewell/set-array@1.2.1(transitive)
+ Added@jridgewell/source-map@0.3.6(transitive)
+ Added@jridgewell/sourcemap-codec@1.5.0(transitive)
+ Added@jridgewell/trace-mapping@0.3.25(transitive)
+ Added@statoscope/extensions@5.28.1(transitive)
+ Added@statoscope/helpers@5.28.1(transitive)
+ Added@statoscope/stats@5.28.1(transitive)
+ Added@statoscope/stats-extension-compressed@5.28.1(transitive)
+ Added@statoscope/stats-extension-custom-reports@5.28.1(transitive)
+ Added@statoscope/stats-extension-package-info@5.28.1(transitive)
+ Added@statoscope/stats-extension-stats-validation-result@5.28.1(transitive)
+ Added@statoscope/types@5.28.1(transitive)
+ Added@types/eslint@9.6.1(transitive)
+ Added@types/eslint-scope@3.7.7(transitive)
+ Added@types/estree@1.0.6(transitive)
+ Added@types/json-schema@7.0.15(transitive)
+ Added@types/md5@2.3.5(transitive)
+ Added@types/node@22.10.5(transitive)
+ Added@types/webpack@5.28.5(transitive)
+ Added@webassemblyjs/ast@1.14.1(transitive)
+ Added@webassemblyjs/floating-point-hex-parser@1.13.2(transitive)
+ Added@webassemblyjs/helper-api-error@1.13.2(transitive)
+ Added@webassemblyjs/helper-buffer@1.14.1(transitive)
+ Added@webassemblyjs/helper-numbers@1.13.2(transitive)
+ Added@webassemblyjs/helper-wasm-bytecode@1.13.2(transitive)
+ Added@webassemblyjs/helper-wasm-section@1.14.1(transitive)
+ Added@webassemblyjs/ieee754@1.13.2(transitive)
+ Added@webassemblyjs/leb128@1.13.2(transitive)
+ Added@webassemblyjs/utf8@1.13.2(transitive)
+ Added@webassemblyjs/wasm-edit@1.14.1(transitive)
+ Added@webassemblyjs/wasm-gen@1.14.1(transitive)
+ Added@webassemblyjs/wasm-opt@1.14.1(transitive)
+ Added@webassemblyjs/wasm-parser@1.14.1(transitive)
+ Added@webassemblyjs/wast-printer@1.14.1(transitive)
+ Added@xtuc/ieee754@1.2.0(transitive)
+ Added@xtuc/long@4.2.2(transitive)
+ Addedacorn@8.14.0(transitive)
+ Addedajv@6.12.68.17.1(transitive)
+ Addedajv-formats@2.1.1(transitive)
+ Addedajv-keywords@3.5.25.1.0(transitive)
+ Addedbrowserslist@4.24.3(transitive)
+ Addedbuffer-from@1.1.2(transitive)
+ Addedcaniuse-lite@1.0.30001690(transitive)
+ Addedchrome-trace-event@1.0.4(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedelectron-to-chromium@1.5.79(transitive)
+ Addedenhanced-resolve@5.18.0(transitive)
+ Addedes-module-lexer@1.6.0(transitive)
+ Addedescalade@3.2.0(transitive)
+ Addedeslint-scope@5.1.1(transitive)
+ Addedesrecurse@4.3.0(transitive)
+ Addedestraverse@4.3.05.3.0(transitive)
+ Addedevents@3.3.0(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedfast-uri@3.0.5(transitive)
+ Addedglob-to-regexp@0.4.1(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhas-flag@4.0.0(transitive)
+ Addedjest-worker@27.5.1(transitive)
+ Addedjson-parse-even-better-errors@2.3.1(transitive)
+ Addedjson-schema-traverse@0.4.11.0.0(transitive)
+ Addedloader-runner@4.3.0(transitive)
+ Addedmerge-stream@2.0.0(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
+ Addedneo-async@2.6.2(transitive)
+ Addednode-releases@2.0.19(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedrandombytes@2.1.0(transitive)
+ Addedrequire-from-string@2.0.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedschema-utils@3.3.04.3.0(transitive)
+ Addedserialize-javascript@6.0.2(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedsource-map-support@0.5.21(transitive)
+ Addedsupports-color@8.1.1(transitive)
+ Addedtapable@2.2.1(transitive)
+ Addedterser@5.37.0(transitive)
+ Addedterser-webpack-plugin@5.3.11(transitive)
+ Addedundici-types@6.20.0(transitive)
+ Addedupdate-browserslist-db@1.1.1(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addedwatchpack@2.4.2(transitive)
+ Addedwebpack@5.97.1(transitive)
+ Addedwebpack-sources@3.2.3(transitive)
- Removed@statoscope/extensions@5.14.1(transitive)
- Removed@statoscope/helpers@5.28.0(transitive)
- Removed@statoscope/stats@5.14.1(transitive)
- Removed@statoscope/stats-extension-compressed@5.28.0(transitive)
- Removed@statoscope/stats-extension-custom-reports@5.28.0(transitive)
- Removed@statoscope/stats-extension-package-info@5.28.0(transitive)
- Removed@statoscope/stats-extension-stats-validation-result@5.28.0(transitive)
- Removed@statoscope/types@5.27.0(transitive)
Updated@statoscope/helpers@5.28.1
Updated@statoscope/stats@5.28.1
Updated@statoscope/stats-extension-stats-validation-result@5.28.1
Updated@statoscope/types@5.28.1