FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
webpack/lib/Module.js at master · codeinvain/webpack · GitHub
codeinvain
webpack
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
webpack
/
lib
/
Module.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
187 lines (164 loc) · 4.62 KB
Breadcrumbs
webpack
/
lib
/
Module.js
Copy path
File metadata and controls
187 lines (164 loc) · 4.62 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var
DependenciesBlock
=
require
(
"./DependenciesBlock"
)
;
var
ModuleReason
=
require
(
"./ModuleReason"
)
;
var
Template
=
require
(
"./Template"
)
;
var
HarmonyModulesHelpers
=
require
(
"./dependencies/HarmonyModulesHelpers"
)
;
var
debugId
=
1000
;
function
Module
(
)
{
DependenciesBlock
.
call
(
this
)
;
this
.
context
=
null
;
this
.
reasons
=
[
]
;
this
.
debugId
=
debugId
++
;
this
.
lastId
=
-
1
;
this
.
id
=
null
;
this
.
portableId
=
null
;
this
.
index
=
null
;
this
.
index2
=
null
;
this
.
depth
=
null
;
this
.
used
=
null
;
this
.
usedExports
=
null
;
this
.
providedExports
=
null
;
this
.
chunks
=
[
]
;
this
.
warnings
=
[
]
;
this
.
dependenciesWarnings
=
[
]
;
this
.
errors
=
[
]
;
this
.
dependenciesErrors
=
[
]
;
this
.
strict
=
false
;
this
.
meta
=
{
}
;
}
module
.
exports
=
Module
;
Module
.
prototype
=
Object
.
create
(
DependenciesBlock
.
prototype
)
;
Module
.
prototype
.
constructor
=
Module
;
Object
.
defineProperty
(
Module
.
prototype
,
"entry"
,
{
configurable
:
false
,
get
:
function
(
)
{
throw
new
Error
(
"Module.entry was removed. Use Chunk.entryModule"
)
;
}
,
set
:
function
(
)
{
throw
new
Error
(
"Module.entry was removed. Use Chunk.entryModule"
)
;
}
}
)
;
Module
.
prototype
.
disconnect
=
function
(
)
{
this
.
reasons
.
length
=
0
;
this
.
lastId
=
this
.
id
;
this
.
id
=
null
;
this
.
index
=
null
;
this
.
index2
=
null
;
this
.
depth
=
null
;
this
.
used
=
null
;
this
.
usedExports
=
null
;
this
.
providedExports
=
null
;
this
.
chunks
.
length
=
0
;
DependenciesBlock
.
prototype
.
disconnect
.
call
(
this
)
;
}
;
Module
.
prototype
.
unseal
=
function
(
)
{
this
.
lastId
=
this
.
id
;
this
.
id
=
null
;
this
.
index
=
null
;
this
.
index2
=
null
;
this
.
depth
=
null
;
this
.
chunks
.
length
=
0
;
DependenciesBlock
.
prototype
.
unseal
.
call
(
this
)
;
}
;
Module
.
prototype
.
addChunk
=
function
(
chunk
)
{
var
idx
=
this
.
chunks
.
indexOf
(
chunk
)
;
if
(
idx
<
0
)
this
.
chunks
.
push
(
chunk
)
;
}
;
Module
.
prototype
.
_removeAndDo
=
require
(
"./removeAndDo"
)
;
Module
.
prototype
.
removeChunk
=
function
(
chunk
)
{
return
this
.
_removeAndDo
(
"chunks"
,
chunk
,
"removeModule"
)
;
}
;
Module
.
prototype
.
addReason
=
function
(
module
,
dependency
)
{
this
.
reasons
.
push
(
new
ModuleReason
(
module
,
dependency
)
)
;
}
;
Module
.
prototype
.
removeReason
=
function
(
module
,
dependency
)
{
for
(
var
i
=
0
;
i
<
this
.
reasons
.
length
;
i
++
)
{
var
r
=
this
.
reasons
[
i
]
;
if
(
r
.
module
===
module
&&
r
.
dependency
===
dependency
)
{
this
.
reasons
.
splice
(
i
,
1
)
;
return
true
;
}
}
return
false
;
}
;
Module
.
prototype
.
hasReasonForChunk
=
function
(
chunk
)
{
for
(
var
i
=
0
;
i
<
this
.
reasons
.
length
;
i
++
)
{
var
r
=
this
.
reasons
[
i
]
;
if
(
r
.
chunks
)
{
if
(
r
.
chunks
.
indexOf
(
chunk
)
>=
0
)
return
true
;
}
else
if
(
r
.
module
.
chunks
.
indexOf
(
chunk
)
>=
0
)
return
true
;
}
return
false
;
}
;
function
addToSet
(
set
,
items
)
{
items
.
forEach
(
function
(
item
)
{
if
(
set
.
indexOf
(
item
)
<
0
)
set
.
push
(
item
)
;
}
)
;
}
Module
.
prototype
.
rewriteChunkInReasons
=
function
(
oldChunk
,
newChunks
)
{
this
.
reasons
.
forEach
(
function
(
r
)
{
if
(
!
r
.
chunks
)
{
if
(
r
.
module
.
chunks
.
indexOf
(
oldChunk
)
<
0
)
return
;
r
.
chunks
=
r
.
module
.
chunks
;
}
r
.
chunks
=
r
.
chunks
.
reduce
(
function
(
arr
,
c
)
{
addToSet
(
arr
,
c
!==
oldChunk
?
[
c
]
:
newChunks
)
;
return
arr
;
}
,
[
]
)
;
}
)
;
}
;
Module
.
prototype
.
isUsed
=
function
(
exportName
)
{
if
(
this
.
used
===
null
)
return
exportName
;
if
(
!
exportName
)
return
this
.
used
?
true
:
false
;
if
(
!
this
.
used
)
return
false
;
if
(
!
this
.
usedExports
)
return
false
;
if
(
this
.
usedExports
===
true
)
return
exportName
;
var
idx
=
this
.
usedExports
.
indexOf
(
exportName
)
;
if
(
idx
<
0
)
return
false
;
if
(
this
.
isProvided
(
exportName
)
)
return
Template
.
numberToIdentifer
(
idx
)
;
return
exportName
;
}
;
Module
.
prototype
.
isProvided
=
function
(
exportName
)
{
if
(
!
Array
.
isArray
(
this
.
providedExports
)
)
return
null
;
return
this
.
providedExports
.
indexOf
(
exportName
)
>=
0
;
}
;
Module
.
prototype
.
toString
=
function
(
)
{
return
"Module["
+
(
this
.
id
||
this
.
debugId
)
+
"]"
;
}
;
Module
.
prototype
.
needRebuild
=
function
(
/* fileTimestamps, contextTimestamps */
)
{
return
true
;
}
;
Module
.
prototype
.
updateHash
=
function
(
hash
)
{
hash
.
update
(
this
.
id
+
""
+
this
.
used
)
;
hash
.
update
(
JSON
.
stringify
(
this
.
usedExports
)
)
;
DependenciesBlock
.
prototype
.
updateHash
.
call
(
this
,
hash
)
;
}
;
function
byId
(
a
,
b
)
{
return
a
.
id
-
b
.
id
;
}
Module
.
prototype
.
sortItems
=
function
(
)
{
DependenciesBlock
.
prototype
.
sortItems
.
call
(
this
)
;
this
.
chunks
.
sort
(
byId
)
;
this
.
reasons
.
sort
(
function
(
a
,
b
)
{
return
byId
(
a
.
module
,
b
.
module
)
;
}
)
;
}
;
Module
.
prototype
.
unbuild
=
function
(
)
{
this
.
disconnect
(
)
;
}
;
Module
.
prototype
.
identifier
=
null
;
Module
.
prototype
.
readableIdentifier
=
null
;
Module
.
prototype
.
build
=
null
;
Module
.
prototype
.
source
=
null
;
Module
.
prototype
.
size
=
null
;
Module
.
prototype
.
nameForCondition
=
null
;
Back
|
FazBrowse Home
|
New Git URL