Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
cb195ce6
Commit
cb195ce6
authored
Feb 11, 2023
by
Tim Neutkens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bring file back to original
parent
1fe82751
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
index.js
packages/next/src/compiled/compression/index.js
+1
-1
No files found.
packages/next/src/compiled/compression/index.js
View file @
cb195ce6
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2014-2015 Douglas Christopher Wilson
* Copyright(c) 2014-2015 Douglas Christopher Wilson
* MIT Licensed
* MIT Licensed
*/
var
n
=
i
(
909
);
var
s
=
i
(
291
).
Buffer
;
var
o
=
i
(
666
);
var
c
=
i
(
876
);
var
t
=
i
(
937
)(
"compression"
);
var
p
=
i
(
849
);
var
r
=
i
(
850
);
var
l
=
i
(
796
);
e
.
exports
=
compression
;
e
.
exports
.
filter
=
shouldCompress
;
var
u
=
/
(?:
^|,
)\s
*
?
no-transform
\s
*
?(?:
,|$
)
/
;
function
compression
(
e
){
var
a
=
e
||
{};
var
i
=
a
.
filter
||
shouldCompress
;
var
s
=
o
.
parse
(
a
.
threshold
);
if
(
s
==
null
){
s
=
1024
}
return
function
compression
(
e
,
o
,
c
){
var
u
=
false
;
var
m
;
var
d
=
[];
var
x
;
var
v
=
o
.
end
;
var
f
=
o
.
on
;
var
b
=
o
.
write
;
o
.
flush
=
function
flush
(){
if
(
x
){
x
.
flush
()}};
o
.
write
=
function
write
(
e
,
a
){
if
(
u
){
return
false
}
if
(
!
this
.
_header
){
this
.
_implicitHeader
()}
return
x
?
x
.
write
(
toBuffer
(
e
,
a
)):
b
.
call
(
this
,
e
,
a
)};
o
.
end
=
function
end
(
e
,
a
){
if
(
u
){
return
false
}
if
(
!
this
.
_header
){
if
(
!
this
.
getHeader
(
"Content-Length"
)){
m
=
chunkLength
(
e
,
a
)}
this
.
_implicitHeader
()}
if
(
!
x
){
return
v
.
call
(
this
,
e
,
a
)}
u
=
true
;
return
e
?
x
.
end
(
toBuffer
(
e
,
a
)):
x
.
end
()};
o
.
on
=
function
on
(
e
,
a
){
if
(
!
d
||
e
!==
"drain"
){
return
f
.
call
(
this
,
e
,
a
)}
if
(
x
){
return
x
.
on
(
e
,
a
)}
d
.
push
([
e
,
a
]);
return
this
};
function
nocompress
(
e
){
t
(
"no compression: %s"
,
e
);
addListeners
(
o
,
f
,
d
);
d
=
null
}
p
(
o
,(
function
onResponseHeaders
(){
if
(
!
i
(
e
,
o
)){
nocompress
(
"filtered"
);
return
}
if
(
!
shouldTransform
(
e
,
o
)){
nocompress
(
"no transform"
);
return
}
r
(
o
,
"Accept-Encoding"
);
if
(
Number
(
o
.
getHeader
(
"Content-Length"
))
<
s
||
m
<
s
){
nocompress
(
"size below threshold"
);
return
}
var
c
=
o
.
getHeader
(
"Content-Encoding"
)
||
"identity"
;
if
(
c
!==
"identity"
){
nocompress
(
"already encoded"
);
return
}
if
(
e
.
method
===
"HEAD"
){
nocompress
(
"HEAD request"
);
return
}
var
p
=
n
(
e
);
var
u
=
p
.
encoding
([
"gzip"
,
"deflate"
,
"identity"
]);
if
(
u
===
"deflate"
&&
p
.
encoding
([
"gzip"
])){
u
=
p
.
encoding
([
"gzip"
,
"identity"
])}
if
(
!
u
||
u
===
"identity"
){
nocompress
(
"not acceptable"
);
return
}
t
(
"%s compression"
,
u
);
x
=
u
===
"gzip"
?
l
.
createGzip
(
a
):
l
.
createDeflate
(
a
);
addListeners
(
x
,
x
.
on
,
d
);
o
.
setHeader
(
"Content-Encoding"
,
u
);
o
.
removeHeader
(
"Content-Length"
);
x
.
on
(
"data"
,(
function
onStreamData
(
e
){
if
(
b
.
call
(
o
,
e
)
===
false
){
x
.
pause
()}}));
x
.
on
(
"end"
,(
function
onStreamEnd
(){
v
.
call
(
o
)}));
f
.
call
(
o
,
"drain"
,(
function
onResponseDrain
(){
x
.
resume
()}))}));
c
()}}
function
addListeners
(
e
,
a
,
i
){
for
(
var
n
=
0
;
n
<
i
.
length
;
n
++
){
a
.
apply
(
e
,
i
[
n
])}}
function
chunkLength
(
e
,
a
){
if
(
!
e
){
return
0
}
return
!
s
.
isBuffer
(
e
)?
s
.
byteLength
(
e
,
a
):
e
.
length
}
function
shouldCompress
(
e
,
a
){
var
i
=
a
.
getHeader
(
"Content-Type"
);
console
.
log
(
e
.
url
,
i
,
c
(
i
));
if
(
i
===
undefined
||!
c
(
i
)){
t
(
"%s not compressible"
,
i
);
return
false
}
return
true
}
function
shouldTransform
(
e
,
a
){
var
i
=
a
.
getHeader
(
"Cache-Control"
);
return
!
i
||!
u
.
test
(
i
)}
function
toBuffer
(
e
,
a
){
return
!
s
.
isBuffer
(
e
)?
s
.
from
(
e
,
a
):
e
}},
183
:(
e
,
a
,
i
)
=>
{
*/
var
n
=
i
(
909
);
var
s
=
i
(
291
).
Buffer
;
var
o
=
i
(
666
);
var
c
=
i
(
876
);
var
t
=
i
(
937
)(
"compression"
);
var
p
=
i
(
849
);
var
r
=
i
(
850
);
var
l
=
i
(
796
);
e
.
exports
=
compression
;
e
.
exports
.
filter
=
shouldCompress
;
var
u
=
/
(?:
^|,
)\s
*
?
no-transform
\s
*
?(?:
,|$
)
/
;
function
compression
(
e
){
var
a
=
e
||
{};
var
i
=
a
.
filter
||
shouldCompress
;
var
s
=
o
.
parse
(
a
.
threshold
);
if
(
s
==
null
){
s
=
1024
}
return
function
compression
(
e
,
o
,
c
){
var
u
=
false
;
var
m
;
var
d
=
[];
var
x
;
var
v
=
o
.
end
;
var
f
=
o
.
on
;
var
b
=
o
.
write
;
o
.
flush
=
function
flush
(){
if
(
x
){
x
.
flush
()}};
o
.
write
=
function
write
(
e
,
a
){
if
(
u
){
return
false
}
if
(
!
this
.
_header
){
this
.
_implicitHeader
()}
return
x
?
x
.
write
(
toBuffer
(
e
,
a
)):
b
.
call
(
this
,
e
,
a
)};
o
.
end
=
function
end
(
e
,
a
){
if
(
u
){
return
false
}
if
(
!
this
.
_header
){
if
(
!
this
.
getHeader
(
"Content-Length"
)){
m
=
chunkLength
(
e
,
a
)}
this
.
_implicitHeader
()}
if
(
!
x
){
return
v
.
call
(
this
,
e
,
a
)}
u
=
true
;
return
e
?
x
.
end
(
toBuffer
(
e
,
a
)):
x
.
end
()};
o
.
on
=
function
on
(
e
,
a
){
if
(
!
d
||
e
!==
"drain"
){
return
f
.
call
(
this
,
e
,
a
)}
if
(
x
){
return
x
.
on
(
e
,
a
)}
d
.
push
([
e
,
a
]);
return
this
};
function
nocompress
(
e
){
t
(
"no compression: %s"
,
e
);
addListeners
(
o
,
f
,
d
);
d
=
null
}
p
(
o
,(
function
onResponseHeaders
(){
if
(
!
i
(
e
,
o
)){
nocompress
(
"filtered"
);
return
}
if
(
!
shouldTransform
(
e
,
o
)){
nocompress
(
"no transform"
);
return
}
r
(
o
,
"Accept-Encoding"
);
if
(
Number
(
o
.
getHeader
(
"Content-Length"
))
<
s
||
m
<
s
){
nocompress
(
"size below threshold"
);
return
}
var
c
=
o
.
getHeader
(
"Content-Encoding"
)
||
"identity"
;
if
(
c
!==
"identity"
){
nocompress
(
"already encoded"
);
return
}
if
(
e
.
method
===
"HEAD"
){
nocompress
(
"HEAD request"
);
return
}
var
p
=
n
(
e
);
var
u
=
p
.
encoding
([
"gzip"
,
"deflate"
,
"identity"
]);
if
(
u
===
"deflate"
&&
p
.
encoding
([
"gzip"
])){
u
=
p
.
encoding
([
"gzip"
,
"identity"
])}
if
(
!
u
||
u
===
"identity"
){
nocompress
(
"not acceptable"
);
return
}
t
(
"%s compression"
,
u
);
x
=
u
===
"gzip"
?
l
.
createGzip
(
a
):
l
.
createDeflate
(
a
);
addListeners
(
x
,
x
.
on
,
d
);
o
.
setHeader
(
"Content-Encoding"
,
u
);
o
.
removeHeader
(
"Content-Length"
);
x
.
on
(
"data"
,(
function
onStreamData
(
e
){
if
(
b
.
call
(
o
,
e
)
===
false
){
x
.
pause
()}}));
x
.
on
(
"end"
,(
function
onStreamEnd
(){
v
.
call
(
o
)}));
f
.
call
(
o
,
"drain"
,(
function
onResponseDrain
(){
x
.
resume
()}))}));
c
()}}
function
addListeners
(
e
,
a
,
i
){
for
(
var
n
=
0
;
n
<
i
.
length
;
n
++
){
a
.
apply
(
e
,
i
[
n
])}}
function
chunkLength
(
e
,
a
){
if
(
!
e
){
return
0
}
return
!
s
.
isBuffer
(
e
)?
s
.
byteLength
(
e
,
a
):
e
.
length
}
function
shouldCompress
(
e
,
a
){
var
i
=
a
.
getHeader
(
"Content-Type"
);
if
(
i
===
undefined
||!
c
(
i
)){
t
(
"%s not compressible"
,
i
);
return
false
}
return
true
}
function
shouldTransform
(
e
,
a
){
var
i
=
a
.
getHeader
(
"Cache-Control"
);
return
!
i
||!
u
.
test
(
i
)}
function
toBuffer
(
e
,
a
){
return
!
s
.
isBuffer
(
e
)?
s
.
from
(
e
,
a
):
e
}},
183
:(
e
,
a
,
i
)
=>
{
/*!
/*!
* mime-db
* mime-db
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2014 Jonathan Ong
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment