corvée(dépendances) ajoute Carbon Fields
This commit is contained in:
parent
135cc65eed
commit
62368587e5
459 changed files with 72750 additions and 26 deletions
9
web/vendor/htmlburger/carbon-fields/bin/paths.js
vendored
Normal file
9
web/vendor/htmlburger/carbon-fields/bin/paths.js
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/**
|
||||
* External dependencies.
|
||||
*/
|
||||
const path = require( 'path' );
|
||||
|
||||
module.exports = {
|
||||
classicBuildPath: path.resolve( __dirname, '..', 'build', 'classic' ),
|
||||
gutenbergBuildPath: path.resolve( __dirname, '..', 'build', 'gutenberg' ),
|
||||
};
|
||||
85
web/vendor/htmlburger/carbon-fields/bin/webpack.base.js
vendored
Normal file
85
web/vendor/htmlburger/carbon-fields/bin/webpack.base.js
vendored
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
/**
|
||||
* External dependencies.
|
||||
*/
|
||||
const path = require( 'path' );
|
||||
const MiniCssExtractPlugin = require( 'mini-css-extract-plugin' );
|
||||
const OptimizeCssAssetsPlugin = require( 'optimize-css-assets-webpack-plugin' );
|
||||
const TerserPlugin = require( 'terser-webpack-plugin' );
|
||||
|
||||
/**
|
||||
* Indicates if we're running the build process in production mode.
|
||||
*
|
||||
* @type {Boolean}
|
||||
*/
|
||||
const isProduction = process.env.NODE_ENV === 'production';
|
||||
|
||||
module.exports = {
|
||||
output: {
|
||||
filename: isProduction ? '[name].min.js' : '[name].js'
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
cacheDirectory: true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.scss$/,
|
||||
use: [
|
||||
MiniCssExtractPlugin.loader,
|
||||
{
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
importLoaders: 3
|
||||
}
|
||||
},
|
||||
{
|
||||
loader: 'postcss-loader'
|
||||
},
|
||||
{
|
||||
loader: 'sass-loader'
|
||||
},
|
||||
{
|
||||
loader: 'sass-resources-loader',
|
||||
options: {
|
||||
resources: path.resolve( __dirname, '../assets/styles/*.scss' )
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new MiniCssExtractPlugin( {
|
||||
filename: isProduction ? '[name].min.css' : '[name].css'
|
||||
} ),
|
||||
|
||||
...(
|
||||
isProduction
|
||||
? [
|
||||
new OptimizeCssAssetsPlugin( {
|
||||
cssProcessorPluginOptions: {
|
||||
preset: [ 'default', { discardComments: { removeAll: true } } ]
|
||||
}
|
||||
} ),
|
||||
new TerserPlugin( {
|
||||
cache: true,
|
||||
parallel: true
|
||||
} )
|
||||
]
|
||||
: []
|
||||
)
|
||||
],
|
||||
stats: {
|
||||
modules: false,
|
||||
hash: false,
|
||||
builtAt: false,
|
||||
children: false
|
||||
}
|
||||
};
|
||||
36
web/vendor/htmlburger/carbon-fields/bin/webpack.blocks.js
vendored
Normal file
36
web/vendor/htmlburger/carbon-fields/bin/webpack.blocks.js
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/**
|
||||
* External dependencies.
|
||||
*/
|
||||
const { merge } = require( 'webpack-merge' );
|
||||
|
||||
/**
|
||||
* Internal dependencies.
|
||||
*/
|
||||
const base = require( './webpack.base' );
|
||||
const paths = require( './paths' );
|
||||
const wpPackages = require( './wp-packages' );
|
||||
|
||||
module.exports = [
|
||||
merge( base, {
|
||||
entry: {
|
||||
blocks: './packages/blocks/index.js'
|
||||
},
|
||||
output: {
|
||||
path: paths.gutenbergBuildPath,
|
||||
},
|
||||
externals: Object.assign( {}, wpPackages.externals, {
|
||||
'react': [ 'cf', 'vendor', 'react' ],
|
||||
'react-dom': [ 'cf', 'vendor', 'react-dom' ],
|
||||
'nanoid': [ 'cf', 'vendor', 'nanoid' ],
|
||||
'immer': [ 'cf', 'vendor', 'immer' ],
|
||||
'@wordpress/api-fetch': [ 'wp', 'apiFetch' ],
|
||||
'@wordpress/components': [ 'wp', 'components' ],
|
||||
'@wordpress/blocks': [ 'wp', 'blocks' ],
|
||||
'@wordpress/editor': [ 'wp', 'editor' ],
|
||||
'@wordpress/i18n': [ 'wp', 'i18n' ],
|
||||
'@wordpress/date': [ 'wp', 'date' ],
|
||||
'@carbon-fields/core': 'cf.core',
|
||||
'lodash': [ 'lodash' ]
|
||||
} )
|
||||
} )
|
||||
];
|
||||
54
web/vendor/htmlburger/carbon-fields/bin/webpack.core.js
vendored
Normal file
54
web/vendor/htmlburger/carbon-fields/bin/webpack.core.js
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/**
|
||||
* External dependencies.
|
||||
*/
|
||||
const webpack = require( 'webpack' );
|
||||
const { merge } = require( 'webpack-merge' );
|
||||
|
||||
/**
|
||||
* Internal dependencies.
|
||||
*/
|
||||
const base = require( './webpack.base' );
|
||||
const paths = require( './paths' );
|
||||
const wpPackages = require( './wp-packages' );
|
||||
|
||||
const config = {
|
||||
entry: {
|
||||
core: './packages/core/index.js'
|
||||
},
|
||||
output: {
|
||||
library: [ 'cf', '[name]' ],
|
||||
libraryTarget: 'this'
|
||||
},
|
||||
externals: {
|
||||
'react': [ 'cf', 'vendor', 'react' ],
|
||||
'react-dom': [ 'cf', 'vendor', 'react-dom' ],
|
||||
'refract-callbag': [ 'cf', 'vendor', 'refract-callbag' ],
|
||||
'callbag-basics': [ 'cf', 'vendor', 'callbag-basics' ],
|
||||
'classnames': [ 'cf', 'vendor', 'classnames' ],
|
||||
'immer': [ 'cf', 'vendor', 'immer' ]
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = [
|
||||
merge( base, config, {
|
||||
output: {
|
||||
path: paths.gutenbergBuildPath
|
||||
},
|
||||
externals: Object.assign( {}, wpPackages.externals, {
|
||||
'lodash': [ 'lodash' ]
|
||||
} )
|
||||
} ),
|
||||
merge( base, config, {
|
||||
output: {
|
||||
path: paths.classicBuildPath
|
||||
},
|
||||
externals: Object.assign( {}, wpPackages.proxyExternals, {
|
||||
'lodash': [ 'cf', 'vendor', 'lodash' ]
|
||||
} ),
|
||||
plugins: [
|
||||
new webpack.ProvidePlugin( {
|
||||
'wp.element': '@wordpress/element'
|
||||
} )
|
||||
]
|
||||
} )
|
||||
];
|
||||
56
web/vendor/htmlburger/carbon-fields/bin/webpack.metaboxes.js
vendored
Normal file
56
web/vendor/htmlburger/carbon-fields/bin/webpack.metaboxes.js
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/**
|
||||
* External dependencies.
|
||||
*/
|
||||
const webpack = require( 'webpack' );
|
||||
const { merge } = require( 'webpack-merge' );
|
||||
|
||||
/**
|
||||
* Internal dependencies.
|
||||
*/
|
||||
const base = require( './webpack.base' );
|
||||
const paths = require( './paths' );
|
||||
const wpPackages = require( './wp-packages' );
|
||||
|
||||
const config = {
|
||||
entry: {
|
||||
metaboxes: './packages/metaboxes/index.js'
|
||||
},
|
||||
output: {
|
||||
library: [ 'cf', '[name]' ],
|
||||
libraryTarget: 'this'
|
||||
},
|
||||
externals: {
|
||||
'react': [ 'cf', 'vendor', 'react' ],
|
||||
'react-dom': [ 'cf', 'vendor', 'react-dom' ],
|
||||
'nanoid': [ 'cf', 'vendor', 'nanoid' ],
|
||||
'refract-callbag': [ 'cf', 'vendor', 'refract-callbag' ],
|
||||
'callbag-basics': [ 'cf', 'vendor', 'callbag-basics' ],
|
||||
'classnames': [ 'cf', 'vendor', 'classnames' ],
|
||||
'immer': [ 'cf', 'vendor', 'immer' ],
|
||||
'@carbon-fields/core': [ 'cf', 'core' ]
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = [
|
||||
merge( base, config, {
|
||||
output: {
|
||||
path: paths.gutenbergBuildPath
|
||||
},
|
||||
externals: Object.assign( {}, wpPackages.externals, {
|
||||
'lodash': [ 'lodash' ]
|
||||
} )
|
||||
} ),
|
||||
merge( base, config, {
|
||||
output: {
|
||||
path: paths.classicBuildPath
|
||||
},
|
||||
externals: Object.assign( {}, wpPackages.proxyExternals, {
|
||||
'lodash': [ 'cf', 'vendor', 'lodash' ]
|
||||
} ),
|
||||
plugins: [
|
||||
new webpack.ProvidePlugin( {
|
||||
'wp.element': '@wordpress/element'
|
||||
} )
|
||||
]
|
||||
} )
|
||||
];
|
||||
40
web/vendor/htmlburger/carbon-fields/bin/webpack.vendor.js
vendored
Normal file
40
web/vendor/htmlburger/carbon-fields/bin/webpack.vendor.js
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/**
|
||||
* External dependencies.
|
||||
*/
|
||||
const webpack = require( 'webpack' );
|
||||
const { merge } = require( 'webpack-merge' );
|
||||
|
||||
/**
|
||||
* Internal dependencies.
|
||||
*/
|
||||
const base = require( './webpack.base' );
|
||||
const paths = require( './paths' );
|
||||
const wpPackages = require( './wp-packages' );
|
||||
|
||||
const config = {
|
||||
entry: {
|
||||
vendor: './packages/vendor/index.js'
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = [
|
||||
merge( base, config, {
|
||||
output: {
|
||||
path: paths.gutenbergBuildPath
|
||||
},
|
||||
externals: Object.assign( {}, wpPackages.externals, {
|
||||
'lodash': 'lodash',
|
||||
'react': 'React',
|
||||
'react-dom': 'ReactDOM',
|
||||
'jquery': 'jQuery',
|
||||
} )
|
||||
} ),
|
||||
merge( base, config, {
|
||||
output: {
|
||||
path: paths.classicBuildPath
|
||||
},
|
||||
plugins: [
|
||||
new webpack.ProvidePlugin( wpPackages.providers )
|
||||
]
|
||||
} )
|
||||
];
|
||||
55
web/vendor/htmlburger/carbon-fields/bin/wp-packages.js
vendored
Normal file
55
web/vendor/htmlburger/carbon-fields/bin/wp-packages.js
vendored
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* The WordPress packages used across the code and exposed globally on `cf.vendor` variable.
|
||||
*
|
||||
* @type {string[]}
|
||||
*/
|
||||
module.exports.packages = [
|
||||
'@wordpress/compose',
|
||||
'@wordpress/element',
|
||||
'@wordpress/hooks',
|
||||
'@wordpress/data',
|
||||
'@wordpress/i18n'
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the packages as an external configuration.
|
||||
*
|
||||
* @type {string[]}
|
||||
*/
|
||||
module.exports.externals = module.exports.packages.reduce( ( externals, package ) => {
|
||||
externals[ package ] = [
|
||||
'wp',
|
||||
package.replace( '@wordpress/', '' )
|
||||
];
|
||||
|
||||
return externals;
|
||||
}, {} );
|
||||
|
||||
/**
|
||||
* Get the packages as an external configuration.
|
||||
* This variant is useful for the classic bundles where we
|
||||
* provide those dependencies manually.
|
||||
*
|
||||
* @type {string[]}
|
||||
*/
|
||||
module.exports.proxyExternals = module.exports.packages.reduce( ( externals, package ) => {
|
||||
externals[ package ] = [
|
||||
'cf',
|
||||
'vendor',
|
||||
package
|
||||
];
|
||||
|
||||
return externals;
|
||||
}, {} );
|
||||
|
||||
/**
|
||||
* Get the packages as a provider configuration.
|
||||
* The providers should be used in combination with `proxyExternals` configuration.
|
||||
*
|
||||
* @type {Object}
|
||||
*/
|
||||
module.exports.providers = module.exports.packages.reduce( ( providers, package ) => {
|
||||
providers[ module.exports.externals[ package ].join( '.' ) ] = package;
|
||||
|
||||
return providers;
|
||||
}, {} );
|
||||
Loading…
Add table
Add a link
Reference in a new issue