@rsdoctor/graph 1.1.9 → 1.2.0-beta.0

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.
Files changed (79) hide show
  1. package/dist/cjs/graph/chunk-graph/asset.js +67 -57
  2. package/dist/cjs/graph/chunk-graph/chunk.js +116 -112
  3. package/dist/cjs/graph/chunk-graph/entrypoint.js +67 -61
  4. package/dist/cjs/graph/chunk-graph/graph.js +104 -89
  5. package/dist/cjs/graph/chunk-graph/index.js +84 -25
  6. package/dist/cjs/graph/index.js +75 -23
  7. package/dist/cjs/graph/module-graph/dependency.js +94 -88
  8. package/dist/cjs/graph/module-graph/graph.js +292 -352
  9. package/dist/cjs/graph/module-graph/index.js +102 -29
  10. package/dist/cjs/graph/module-graph/module.js +321 -333
  11. package/dist/cjs/graph/module-graph/statement.js +83 -73
  12. package/dist/cjs/graph/module-graph/tree-shaking/export.js +87 -92
  13. package/dist/cjs/graph/module-graph/tree-shaking/index.js +93 -27
  14. package/dist/cjs/graph/module-graph/tree-shaking/module.js +92 -90
  15. package/dist/cjs/graph/module-graph/tree-shaking/sideEffect.js +78 -83
  16. package/dist/cjs/graph/module-graph/tree-shaking/types.js +17 -15
  17. package/dist/cjs/graph/module-graph/tree-shaking/variable.js +62 -56
  18. package/dist/cjs/graph/module-graph/types.js +17 -15
  19. package/dist/cjs/graph/module-graph/utils.js +50 -52
  20. package/dist/cjs/graph/package-graph/dependency.js +58 -50
  21. package/dist/cjs/graph/package-graph/graph.js +155 -165
  22. package/dist/cjs/graph/package-graph/index.js +84 -25
  23. package/dist/cjs/graph/package-graph/package.js +112 -117
  24. package/dist/cjs/graph/package-graph/types.js +17 -15
  25. package/dist/cjs/graph/package-graph/utils.js +54 -55
  26. package/dist/cjs/index.js +57 -19
  27. package/dist/esm/graph/chunk-graph/asset.mjs +38 -0
  28. package/dist/esm/graph/chunk-graph/chunk.mjs +87 -0
  29. package/dist/esm/graph/chunk-graph/entrypoint.mjs +39 -0
  30. package/dist/esm/graph/chunk-graph/graph.mjs +75 -0
  31. package/dist/esm/graph/chunk-graph/index.mjs +4 -0
  32. package/dist/esm/graph/index.mjs +3 -0
  33. package/dist/esm/graph/module-graph/dependency.mjs +66 -0
  34. package/dist/esm/graph/module-graph/graph.mjs +285 -0
  35. package/dist/esm/graph/module-graph/index.mjs +6 -0
  36. package/dist/esm/graph/module-graph/module.mjs +284 -0
  37. package/dist/esm/graph/module-graph/statement.mjs +58 -0
  38. package/dist/esm/graph/module-graph/tree-shaking/export.mjs +68 -0
  39. package/dist/esm/graph/module-graph/tree-shaking/index.mjs +5 -0
  40. package/dist/esm/graph/module-graph/tree-shaking/module.mjs +66 -0
  41. package/dist/esm/graph/module-graph/tree-shaking/sideEffect.mjs +55 -0
  42. package/dist/esm/graph/module-graph/tree-shaking/variable.mjs +35 -0
  43. package/dist/esm/graph/module-graph/utils.mjs +23 -0
  44. package/dist/esm/graph/package-graph/dependency.mjs +30 -0
  45. package/dist/esm/graph/package-graph/graph.mjs +123 -0
  46. package/dist/esm/graph/package-graph/index.mjs +4 -0
  47. package/dist/esm/graph/package-graph/package.mjs +91 -0
  48. package/dist/esm/graph/package-graph/utils.mjs +24 -0
  49. package/dist/esm/index.mjs +1 -0
  50. package/dist/type/graph/module-graph/module.d.ts +1 -0
  51. package/dist/type/graph/module-graph/module.d.ts.map +1 -1
  52. package/dist/type/graph/package-graph/package.d.ts.map +1 -1
  53. package/package.json +7 -6
  54. package/dist/esm/graph/chunk-graph/asset.js +0 -38
  55. package/dist/esm/graph/chunk-graph/chunk.js +0 -93
  56. package/dist/esm/graph/chunk-graph/entrypoint.js +0 -43
  57. package/dist/esm/graph/chunk-graph/graph.js +0 -70
  58. package/dist/esm/graph/chunk-graph/index.js +0 -4
  59. package/dist/esm/graph/index.js +0 -3
  60. package/dist/esm/graph/module-graph/dependency.js +0 -70
  61. package/dist/esm/graph/module-graph/graph.js +0 -360
  62. package/dist/esm/graph/module-graph/index.js +0 -6
  63. package/dist/esm/graph/module-graph/module.js +0 -306
  64. package/dist/esm/graph/module-graph/statement.js +0 -58
  65. package/dist/esm/graph/module-graph/tree-shaking/export.js +0 -83
  66. package/dist/esm/graph/module-graph/tree-shaking/index.js +0 -5
  67. package/dist/esm/graph/module-graph/tree-shaking/module.js +0 -74
  68. package/dist/esm/graph/module-graph/tree-shaking/sideEffect.js +0 -70
  69. package/dist/esm/graph/module-graph/tree-shaking/variable.js +0 -39
  70. package/dist/esm/graph/module-graph/utils.js +0 -39
  71. package/dist/esm/graph/package-graph/dependency.js +0 -32
  72. package/dist/esm/graph/package-graph/graph.js +0 -145
  73. package/dist/esm/graph/package-graph/index.js +0 -4
  74. package/dist/esm/graph/package-graph/package.js +0 -106
  75. package/dist/esm/graph/package-graph/utils.js +0 -37
  76. package/dist/esm/index.js +0 -1
  77. /package/dist/esm/graph/module-graph/tree-shaking/{types.js → types.mjs} +0 -0
  78. /package/dist/esm/graph/module-graph/{types.js → types.mjs} +0 -0
  79. /package/dist/esm/graph/package-graph/{types.js → types.mjs} +0 -0
@@ -1,62 +1,72 @@
1
1
  "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var asset_exports = {};
20
- __export(asset_exports, {
21
- Asset: () => Asset
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ Asset: ()=>Asset
22
28
  });
23
- module.exports = __toCommonJS(asset_exports);
24
- var import_types = require("@rsdoctor/types");
25
- var import_node_zlib = require("node:zlib");
26
- let id = 1;
29
+ const types_namespaceObject = require("@rsdoctor/types");
30
+ const external_node_zlib_namespaceObject = require("node:zlib");
31
+ let asset_id = 1;
27
32
  class Asset {
28
- static init() {
29
- id = 1;
30
- }
31
- constructor(path, size, chunks, content) {
32
- this.id = id++;
33
- this.path = path;
34
- this.size = size;
35
- this.chunks = chunks;
36
- this.content = content;
37
- }
38
- toData(types) {
39
- return {
40
- id: this.id,
41
- path: this.path,
42
- size: this.size,
43
- gzipSize: this.gzipSize,
44
- chunks: this.chunks?.map((ck) => ck.id),
45
- content: types === import_types.SDK.ToDataType.NoSourceAndAssets || types === import_types.SDK.ToDataType.NoCode ? "" : this.content
46
- };
47
- }
48
- /* native asset */
49
- setChunks(chunks) {
50
- this.chunks = chunks;
51
- }
52
- setId(id2) {
53
- this.id = id2;
54
- }
55
- setGzipSize(content) {
56
- this.gzipSize = (0, import_node_zlib.gzipSync)(content, { level: 9 }).length;
57
- }
33
+ static init() {
34
+ asset_id = 1;
35
+ }
36
+ toData(types) {
37
+ var _this_chunks;
38
+ return {
39
+ id: this.id,
40
+ path: this.path,
41
+ size: this.size,
42
+ gzipSize: this.gzipSize,
43
+ chunks: null == (_this_chunks = this.chunks) ? void 0 : _this_chunks.map((ck)=>ck.id),
44
+ content: types === types_namespaceObject.SDK.ToDataType.NoSourceAndAssets || types === types_namespaceObject.SDK.ToDataType.NoCode ? '' : this.content
45
+ };
46
+ }
47
+ setChunks(chunks) {
48
+ this.chunks = chunks;
49
+ }
50
+ setId(id) {
51
+ this.id = id;
52
+ }
53
+ setGzipSize(content) {
54
+ this.gzipSize = (0, external_node_zlib_namespaceObject.gzipSync)(content, {
55
+ level: 9
56
+ }).length;
57
+ }
58
+ constructor(path, size, chunks, content){
59
+ this.id = asset_id++;
60
+ this.path = path;
61
+ this.size = size;
62
+ this.chunks = chunks;
63
+ this.content = content;
64
+ }
58
65
  }
59
- // Annotate the CommonJS export names for ESM import in node:
60
- 0 && (module.exports = {
61
- Asset
66
+ exports.Asset = __webpack_exports__.Asset;
67
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
68
+ "Asset"
69
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
70
+ Object.defineProperty(exports, '__esModule', {
71
+ value: true
62
72
  });
@@ -1,117 +1,121 @@
1
1
  "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var chunk_exports = {};
20
- __export(chunk_exports, {
21
- Chunk: () => Chunk
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ Chunk: ()=>Chunk
22
28
  });
23
- module.exports = __toCommonJS(chunk_exports);
24
29
  class Chunk {
25
- constructor(id, name, size, initial, entry) {
26
- this._assets = [];
27
- this._modules = [];
28
- this._dependencies = [];
29
- this._imported = [];
30
- this.id = id;
31
- this.name = name;
32
- this.size = size;
33
- this.initial = initial;
34
- this.entry = entry;
35
- }
36
- isEntry() {
37
- return this.entry;
38
- }
39
- isChunkEntryModule(module2) {
40
- return module2.isEntry || module2.getImported().every((item) => !this.hasModule(item));
41
- }
42
- hasModule(module2) {
43
- return this._modules.includes(module2);
44
- }
45
- addModule(module2) {
46
- if (!this.hasModule(module2)) {
47
- this._modules.push(module2);
48
- module2.addChunk(this);
49
- }
50
- }
51
- addAsset(asset) {
52
- this._assets.push(asset);
53
- }
54
- addModules(modules) {
55
- modules.forEach((module2) => {
56
- if (!this.hasModule(module2)) {
57
- this._modules.push(module2);
58
- module2.addChunk(this);
59
- }
60
- });
61
- }
62
- addDependency(dep) {
63
- if (!this._dependencies.includes(dep)) {
64
- this._dependencies.push(dep);
65
- }
66
- }
67
- addImported(imported) {
68
- if (!this._imported.includes(imported)) {
69
- this._imported.push(imported);
70
- }
71
- }
72
- getAssets() {
73
- return this._assets.slice();
74
- }
75
- getModules() {
76
- return this._modules.slice();
77
- }
78
- getDependencies() {
79
- return this._dependencies.slice();
80
- }
81
- getImported() {
82
- return this._imported.slice();
83
- }
84
- setParsedSize(parsedSize) {
85
- this._parsedSize = parsedSize;
86
- }
87
- toData() {
88
- return {
89
- id: this.id,
90
- name: this.name,
91
- initial: this.initial,
92
- size: this.size,
93
- parsedSize: this._parsedSize || 0,
94
- entry: this.isEntry(),
95
- assets: this._assets.map(({ path }) => path),
96
- modules: this._modules.map(({ id }) => id),
97
- dependencies: this._dependencies.map(({ id }) => id),
98
- imported: this._imported.map(({ id }) => id)
99
- };
100
- }
101
- setDependencies(dependencies) {
102
- this._dependencies = dependencies;
103
- }
104
- setImported(imported) {
105
- this._imported = imported;
106
- }
107
- setModules(modules) {
108
- this._modules = modules;
109
- }
110
- setAssets(assets) {
111
- this._assets = assets;
112
- }
30
+ isEntry() {
31
+ return this.entry;
32
+ }
33
+ isChunkEntryModule(module) {
34
+ return module.isEntry || module.getImported().every((item)=>!this.hasModule(item));
35
+ }
36
+ hasModule(module) {
37
+ return this._modules.includes(module);
38
+ }
39
+ addModule(module) {
40
+ if (!this.hasModule(module)) {
41
+ this._modules.push(module);
42
+ module.addChunk(this);
43
+ }
44
+ }
45
+ addAsset(asset) {
46
+ this._assets.push(asset);
47
+ }
48
+ addModules(modules) {
49
+ modules.forEach((module)=>{
50
+ if (!this.hasModule(module)) {
51
+ this._modules.push(module);
52
+ module.addChunk(this);
53
+ }
54
+ });
55
+ }
56
+ addDependency(dep) {
57
+ if (!this._dependencies.includes(dep)) this._dependencies.push(dep);
58
+ }
59
+ addImported(imported) {
60
+ if (!this._imported.includes(imported)) this._imported.push(imported);
61
+ }
62
+ getAssets() {
63
+ return this._assets.slice();
64
+ }
65
+ getModules() {
66
+ return this._modules.slice();
67
+ }
68
+ getDependencies() {
69
+ return this._dependencies.slice();
70
+ }
71
+ getImported() {
72
+ return this._imported.slice();
73
+ }
74
+ setParsedSize(parsedSize) {
75
+ this._parsedSize = parsedSize;
76
+ }
77
+ toData() {
78
+ return {
79
+ id: this.id,
80
+ name: this.name,
81
+ initial: this.initial,
82
+ size: this.size,
83
+ parsedSize: this._parsedSize || 0,
84
+ entry: this.isEntry(),
85
+ assets: this._assets.map(({ path })=>path),
86
+ modules: this._modules.map(({ id })=>id),
87
+ dependencies: this._dependencies.map(({ id })=>id),
88
+ imported: this._imported.map(({ id })=>id)
89
+ };
90
+ }
91
+ setDependencies(dependencies) {
92
+ this._dependencies = dependencies;
93
+ }
94
+ setImported(imported) {
95
+ this._imported = imported;
96
+ }
97
+ setModules(modules) {
98
+ this._modules = modules;
99
+ }
100
+ setAssets(assets) {
101
+ this._assets = assets;
102
+ }
103
+ constructor(id, name, size, initial, entry){
104
+ this._assets = [];
105
+ this._modules = [];
106
+ this._dependencies = [];
107
+ this._imported = [];
108
+ this.id = id;
109
+ this.name = name;
110
+ this.size = size;
111
+ this.initial = initial;
112
+ this.entry = entry;
113
+ }
113
114
  }
114
- // Annotate the CommonJS export names for ESM import in node:
115
- 0 && (module.exports = {
116
- Chunk
115
+ exports.Chunk = __webpack_exports__.Chunk;
116
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
117
+ "Chunk"
118
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
119
+ Object.defineProperty(exports, '__esModule', {
120
+ value: true
117
121
  });
@@ -1,67 +1,73 @@
1
1
  "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var entrypoint_exports = {};
20
- __export(entrypoint_exports, {
21
- EntryPoint: () => EntryPoint
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ EntryPoint: ()=>EntryPoint
22
28
  });
23
- module.exports = __toCommonJS(entrypoint_exports);
24
29
  let id = 1;
25
30
  class EntryPoint {
26
- constructor(name) {
27
- this.name = name;
28
- this._chunks = [];
29
- this._assets = [];
30
- this.id = id++;
31
- }
32
- static init() {
33
- id = 1;
34
- }
35
- addChunk(chunk) {
36
- if (this._chunks.includes(chunk))
37
- return;
38
- this._chunks.push(chunk);
39
- }
40
- addAsset(asset) {
41
- if (this._assets.includes(asset))
42
- return;
43
- this._assets.push(asset);
44
- }
45
- toData() {
46
- return {
47
- id: this.id,
48
- name: this.name,
49
- chunks: this._chunks.map((e) => e.id),
50
- assets: this._assets.map((e) => e.path),
51
- size: this._assets.length ? this._assets.reduce((t, e) => t + e.size, 0) : 0
52
- };
53
- }
54
- setChunks(chunks) {
55
- this._chunks = chunks;
56
- }
57
- setAssets(assets) {
58
- this._assets = assets;
59
- }
60
- setId(id2) {
61
- this.id = id2;
62
- }
31
+ static init() {
32
+ id = 1;
33
+ }
34
+ addChunk(chunk) {
35
+ if (this._chunks.includes(chunk)) return;
36
+ this._chunks.push(chunk);
37
+ }
38
+ addAsset(asset) {
39
+ if (this._assets.includes(asset)) return;
40
+ this._assets.push(asset);
41
+ }
42
+ toData() {
43
+ return {
44
+ id: this.id,
45
+ name: this.name,
46
+ chunks: this._chunks.map((e)=>e.id),
47
+ assets: this._assets.map((e)=>e.path),
48
+ size: this._assets.length ? this._assets.reduce((t, e)=>t + e.size, 0) : 0
49
+ };
50
+ }
51
+ setChunks(chunks) {
52
+ this._chunks = chunks;
53
+ }
54
+ setAssets(assets) {
55
+ this._assets = assets;
56
+ }
57
+ setId(id) {
58
+ this.id = id;
59
+ }
60
+ constructor(name){
61
+ this.name = name;
62
+ this._chunks = [];
63
+ this._assets = [];
64
+ this.id = id++;
65
+ }
63
66
  }
64
- // Annotate the CommonJS export names for ESM import in node:
65
- 0 && (module.exports = {
66
- EntryPoint
67
+ exports.EntryPoint = __webpack_exports__.EntryPoint;
68
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
69
+ "EntryPoint"
70
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
71
+ Object.defineProperty(exports, '__esModule', {
72
+ value: true
67
73
  });