webpack_q/
graphs.rs

1/*
2 * Copyright [2022] [Kevin Velasco]
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17pub mod ser;
18
19use meshed::graph::GraphDefinition;
20use webpack_stats::chunk::{
21    ChunkChild, ChunkChildren, ChunkId, ChunkInitial, ChunkModules, ChunkParentOrSibling, Files,
22};
23use webpack_stats::import::{ImportType, ResolvedModule};
24use webpack_stats::module::{ModuleChunks, ModuleIdentifier, ModuleName};
25use webpack_stats::SizeBytes;
26
27pub struct ModuleParentGraph;
28
29impl GraphDefinition for ModuleParentGraph {
30    type Id = ModuleIdentifier;
31    type Label = ModuleName;
32    type EdgeMeta = (ImportType, ResolvedModule);
33    type NodeData = ModuleChunks;
34}
35
36pub struct ChunkGraph;
37
38impl GraphDefinition for ChunkGraph {
39    type Id = ChunkId;
40    type Label = ChunkId;
41    type EdgeMeta = ChunkChild;
42    type NodeData = ChunkModules;
43}
44pub struct ChunkImportPathGraph;
45
46impl GraphDefinition for ChunkImportPathGraph {
47    type Id = ChunkId;
48    type Label = ChunkId;
49    type EdgeMeta = ChunkParentOrSibling;
50    type NodeData = ();
51}
52
53pub struct ChunkLoadGraph;
54
55impl GraphDefinition for ChunkLoadGraph {
56    type Id = ChunkId;
57    type Label = ChunkId;
58    type EdgeMeta = ChunkChild;
59    type NodeData = (ChunkChildren, SizeBytes, ChunkInitial, Files);
60}