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
cf163742
Unverified
Commit
cf163742
authored
Feb 24, 2023
by
Sukka
Committed by
GitHub
Feb 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(cssnano-simple): merge into next repo (#46380)
parent
e91de8e0
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
595 additions
and
90 deletions
+595
-90
package.json
packages/next/package.json
+1
-1
cssnano-preset-simple.js
.../next/src/bundles/cssnano-simple/cssnano-preset-simple.js
+16
-0
index.js
packages/next/src/bundles/cssnano-simple/index.js
+68
-0
index.js
packages/next/src/bundles/postcss-plugin-stub/index.js
+25
-0
index.js
packages/next/src/compiled/cssnano-simple/index.js
+31
-31
package.json
packages/next/src/compiled/cssnano-simple/package.json
+0
-1
index.js
.../compiled/postcss-plugin-stub-for-cssnano-simple/index.js
+1
-0
cjs.js
packages/next/src/compiled/sass-loader/cjs.js
+1
-1
taskfile.js
packages/next/taskfile.js
+30
-11
pnpm-lock.yaml
pnpm-lock.yaml
+422
-45
No files found.
packages/next/package.json
View file @
cf163742
...
...
@@ -211,7 +211,7 @@
"cross-spawn"
:
"7.0.3"
,
"crypto-browserify"
:
"3.12.0"
,
"css.escape"
:
"1.5.1"
,
"cssnano-
simple"
:
"3.0.1
"
,
"cssnano-
preset-default"
:
"5.2.14
"
,
"data-uri-to-buffer"
:
"3.0.1"
,
"debug"
:
"4.1.1"
,
"devalue"
:
"2.0.1"
,
...
...
packages/next/src/bundles/cssnano-simple/cssnano-preset-simple.js
0 → 100644
View file @
cf163742
// Originated from https://github.com/Timer/cssnano-preset-simple/blob/master/src/index.js
/**
* We will not try to override "postcss-svgo" here. Instead we will alias "postcss-svgo" to a stub
* plugin (located at "next/dist/compiled/postcss-plugin-stub-for-cssnano-simple") during pre-compilation
*/
module
.
exports
=
function
(
opts
=
{})
{
const
options
=
Object
.
assign
(
{},
{
cssDeclarationSorter
:
{
exclude
:
true
},
calc
:
{
exclude
:
true
}
},
opts
)
// eslint-disable-next-line import/no-extraneous-dependencies
return
require
(
'cssnano-preset-default'
)(
options
)
}
packages/next/src/bundles/cssnano-simple/index.js
0 → 100644
View file @
cf163742
// Originated from https://github.com/Timer/cssnano-simple/blob/master/src/index.js
/**
* This file is the actual "cssnano-simple" implementation, which will eventually be used
* by "next/src/build/cssnano-simple"
*/
const
createSimplePreset
=
require
(
'./cssnano-preset-simple'
)
module
.
exports
=
(
opts
=
{},
postcss
=
require
(
'postcss'
))
=>
{
const
excludeAll
=
Boolean
(
opts
&&
opts
.
excludeAll
)
const
userOpts
=
Object
.
assign
({},
opts
)
if
(
excludeAll
)
{
for
(
const
userOption
in
userOpts
)
{
if
(
!
userOpts
.
hasOwnProperty
(
userOption
))
continue
const
val
=
userOpts
[
userOption
]
if
(
!
Boolean
(
val
))
{
continue
}
if
(
Object
.
prototype
.
toString
.
call
(
val
)
===
'[object Object]'
)
{
userOpts
[
userOption
]
=
Object
.
assign
({},
{
exclude
:
false
},
val
)
}
}
}
const
options
=
Object
.
assign
(
{},
excludeAll
?
{
rawCache
:
true
}
:
undefined
,
userOpts
)
const
plugins
=
[]
createSimplePreset
(
options
).
plugins
.
forEach
((
plugin
)
=>
{
if
(
Array
.
isArray
(
plugin
))
{
let
[
processor
,
pluginOpts
]
=
plugin
processor
=
processor
.
default
||
processor
const
isEnabled
=
// No options:
(
!
excludeAll
&&
typeof
pluginOpts
===
'undefined'
)
||
// Short-hand enabled:
(
typeof
pluginOpts
===
'boolean'
&&
pluginOpts
)
||
// Include all plugins:
(
!
excludeAll
&&
pluginOpts
&&
typeof
pluginOpts
===
'object'
&&
!
pluginOpts
.
exclude
)
||
// Exclude all plugins:
(
excludeAll
&&
pluginOpts
&&
typeof
pluginOpts
===
'object'
&&
pluginOpts
.
exclude
===
false
)
if
(
isEnabled
)
{
plugins
.
push
(
processor
(
pluginOpts
))
}
}
else
{
plugins
.
push
(
plugin
)
}
})
return
postcss
(
plugins
)
}
module
.
exports
.
postcss
=
true
packages/next/src/bundles/postcss-plugin-stub/index.js
0 → 100644
View file @
cf163742
// Originated from https://github.com/Timer/cssnano-preset-simple/blob/master/postcss-plugin-stub/index.js
/**
* This file creates a stub postcss plugin
*
* It will be pre-compiled into "src/compiled/postcss-plugin-stub-for-cssnano-simple",
* which "postcss-svgo" will be aliased to when creating "cssnano-preset-simple"
*/
function
pluginCreator
()
{
return
{
postcssPlugin
:
'postcss-plugin-stub'
,
prepare
()
{
return
{}
},
}
}
pluginCreator
.
postcss
=
true
Object
.
defineProperty
(
exports
,
'__esModule'
,
{
value
:
true
,
})
module
.
exports
=
pluginCreator
module
.
exports
.
default
=
pluginCreator
packages/next/src/compiled/cssnano-simple/index.js
View file @
cf163742
This diff is collapsed.
Click to expand it.
packages/next/src/compiled/cssnano-simple/package.json
deleted
100644 → 0
View file @
e91de8e0
{
"name"
:
"cssnano-simple"
,
"main"
:
"index.js"
,
"author"
:
"Joe Haddad <timer150@gmail.com>"
,
"license"
:
"MIT"
}
packages/next/src/compiled/postcss-plugin-stub-for-cssnano-simple/index.js
0 → 100644
View file @
cf163742
(()
=>
{
var
e
=
{
233
:(
e
,
r
)
=>
{
function
pluginCreator
(){
return
{
postcssPlugin
:
"postcss-plugin-stub"
,
prepare
(){
return
{}}}}
pluginCreator
.
postcss
=
true
;
Object
.
defineProperty
(
r
,
"__esModule"
,{
value
:
true
});
e
.
exports
=
pluginCreator
;
e
.
exports
[
"default"
]
=
pluginCreator
}};
var
r
=
{};
function
__nccwpck_require__
(
t
){
var
_
=
r
[
t
];
if
(
_
!==
undefined
){
return
_
.
exports
}
var
u
=
r
[
t
]
=
{
exports
:{}};
var
p
=
true
;
try
{
e
[
t
](
u
,
u
.
exports
,
__nccwpck_require__
);
p
=
false
}
finally
{
if
(
p
)
delete
r
[
t
]}
return
u
.
exports
}
if
(
typeof
__nccwpck_require__
!==
"undefined"
)
__nccwpck_require__
.
ab
=
__dirname
+
"/"
;
var
t
=
__nccwpck_require__
(
233
);
module
.
exports
=
t
})();
\ No newline at end of file
packages/next/src/compiled/sass-loader/cjs.js
View file @
cf163742
This diff is collapsed.
Click to expand it.
packages/next/taskfile.js
View file @
cf163742
...
...
@@ -61,7 +61,6 @@ const externals = {
postcss
:
'postcss'
,
// Ensure latest version is used
'postcss-safe-parser'
:
'next/dist/compiled/postcss-safe-parser'
,
'cssnano-simple'
:
'next/dist/build/cssnano-simple'
,
// sass-loader
// (also responsible for these dependencies in package.json)
...
...
@@ -688,15 +687,6 @@ export async function ncc_napirs_triples(task, opts) {
.
target
(
'src/compiled/@napi-rs/triples'
)
}
// eslint-disable-next-line camelcase
externals
[
'cssnano-simple'
]
=
'next/dist/compiled/cssnano-simple'
export
async
function
ncc_cssnano_simple
(
task
,
opts
)
{
await
task
.
source
(
relative
(
__dirname
,
require
.
resolve
(
'cssnano-simple'
)))
.
ncc
({
packageName
:
'cssnano-simple'
,
externals
})
.
target
(
'src/compiled/cssnano-simple'
)
}
// eslint-disable-next-line camelcase
externals
[
'p-limit'
]
=
'next/dist/compiled/p-limit'
export
async
function
ncc_p_limit
(
task
,
opts
)
{
...
...
@@ -1106,6 +1096,18 @@ export async function ncc_segment_ajv_human_errors(task, opts) {
.
target
(
'src/compiled/@segment/ajv-human-errors'
)
}
externals
[
'postcss-plugin-stub-for-cssnano-simple'
]
=
'next/dist/compiled/postcss-plugin-stub-for-cssnano-simple'
// eslint-disable-next-line camelcase
export
async
function
ncc_postcss_plugin_stub_for_cssnano_simple
(
task
,
opts
)
{
await
task
.
source
(
'src/bundles/postcss-plugin-stub/index.js'
)
.
ncc
({
externals
,
})
.
target
(
'src/compiled/postcss-plugin-stub-for-cssnano-simple'
)
}
const
babelCorePackages
=
{
'code-frame'
:
'next/dist/compiled/babel/code-frame'
,
'@babel/generator'
:
'next/dist/compiled/babel/generator'
,
...
...
@@ -1176,6 +1178,22 @@ export async function ncc_babel_bundle_packages(task, opts) {
await
task
.
source
(
'src/bundles/babel/packages/*'
).
target
(
'src/compiled/babel'
)
}
externals
[
'cssnano-simple'
]
=
'next/dist/compiled/cssnano-simple'
// eslint-disable-next-line camelcase
export
async
function
ncc_cssnano_simple_bundle
(
task
,
opts
)
{
const
bundleExternals
=
{
...
externals
,
'postcss-svgo'
:
'next/dist/compiled/postcss-plugin-stub-for-cssnano-simple'
,
}
await
task
.
source
(
'src/bundles/cssnano-simple/index.js'
)
.
ncc
({
externals
:
bundleExternals
,
})
.
target
(
'src/compiled/cssnano-simple'
)
}
// eslint-disable-next-line camelcase
externals
[
'bytes'
]
=
'next/dist/compiled/bytes'
export
async
function
ncc_bytes
(
task
,
opts
)
{
...
...
@@ -2035,7 +2053,6 @@ export async function ncc(task, opts) {
'ncc_napirs_triples'
,
'ncc_p_limit'
,
'ncc_raw_body'
,
'ncc_cssnano_simple'
,
'ncc_image_size'
,
'ncc_get_orientation'
,
'ncc_hapi_accept'
,
...
...
@@ -2053,6 +2070,7 @@ export async function ncc(task, opts) {
'ncc_async_retry'
,
'ncc_async_sema'
,
'ncc_segment_ajv_human_errors'
,
'ncc_postcss_plugin_stub_for_cssnano_simple'
,
'ncc_assert'
,
'ncc_browser_zlib'
,
'ncc_buffer'
,
...
...
@@ -2147,6 +2165,7 @@ export async function ncc(task, opts) {
await
task
.
serial
(
[
'ncc_browserslist'
,
'ncc_cssnano_simple_bundle'
,
'copy_regenerator_runtime'
,
'copy_babel_runtime'
,
'copy_constants_browserify'
,
...
...
pnpm-lock.yaml
View file @
cf163742
This diff is collapsed.
Click to expand it.
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