mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-20 16:10:37 +03:00
update to rollup babel 5.3.0 and improve browser test coverage code
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
"@babel/plugin-transform-runtime": "^7.11.0",
|
"@babel/plugin-transform-runtime": "^7.11.0",
|
||||||
"@babel/preset-env": "^7.11.0",
|
"@babel/preset-env": "^7.11.0",
|
||||||
"@babel/preset-typescript": "^7.10.4",
|
"@babel/preset-typescript": "^7.10.4",
|
||||||
"@rollup/plugin-babel": "^5.2.2",
|
"@rollup/plugin-babel": "^5.3.0",
|
||||||
"@rollup/plugin-commonjs": "^17.0.0",
|
"@rollup/plugin-commonjs": "^17.0.0",
|
||||||
"@rollup/plugin-html": "^0.2.0",
|
"@rollup/plugin-html": "^0.2.0",
|
||||||
"@rollup/plugin-inject": "^4.0.2",
|
"@rollup/plugin-inject": "^4.0.2",
|
||||||
|
|||||||
+45
-64
@@ -12,7 +12,6 @@ const chalk = require('chalk');
|
|||||||
const resolve = require('./resolve.config.json');
|
const resolve = require('./resolve.config.json');
|
||||||
|
|
||||||
const isTestEnv = process.env.NODE_ENV === 'test';
|
const isTestEnv = process.env.NODE_ENV === 'test';
|
||||||
const sizeSnapshotFilename = 'rollup.sizeSnapshot.json';
|
|
||||||
|
|
||||||
const rollupConfigDefaults = {
|
const rollupConfigDefaults = {
|
||||||
input: './src/index',
|
input: './src/index',
|
||||||
@@ -57,34 +56,28 @@ const esmBabelConfig = {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
// workaround for https://github.com/rollup/plugins/issues/774
|
|
||||||
const rollupBabelIstanbulSourceMaps = {};
|
|
||||||
const rollupBabelIstanbulGenerateKey = (filename) => (filename ? filename.replace(/[\\/]+/g, '') : '');
|
|
||||||
const rollupBabelPlugin = isTestEnv
|
const rollupBabelPlugin = isTestEnv
|
||||||
? createBabelInputPluginFactory(() => {
|
? createBabelInputPluginFactory(() => {
|
||||||
return {
|
return {
|
||||||
config(cfg) {
|
config(cfg) {
|
||||||
const { options } = cfg;
|
const { options } = cfg;
|
||||||
const { filename, plugins } = options;
|
const { plugins } = options;
|
||||||
const istanbulSourceMap = rollupBabelIstanbulSourceMaps[rollupBabelIstanbulGenerateKey(filename)];
|
|
||||||
|
|
||||||
if (istanbulSourceMap) {
|
return this.meta.watchMode
|
||||||
return {
|
? options
|
||||||
...options,
|
: {
|
||||||
plugins: [
|
...options,
|
||||||
...(plugins || []),
|
plugins: [
|
||||||
[
|
...(plugins || []),
|
||||||
'babel-plugin-istanbul',
|
[
|
||||||
{
|
'babel-plugin-istanbul',
|
||||||
useInlineSourceMaps: false,
|
{
|
||||||
inputSourceMap: istanbulSourceMap,
|
useInlineSourceMaps: false,
|
||||||
},
|
inputSourceMap: { ...this.getCombinedSourcemap() },
|
||||||
|
},
|
||||||
|
],
|
||||||
],
|
],
|
||||||
],
|
};
|
||||||
};
|
|
||||||
} else {
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
@@ -229,29 +222,15 @@ const rollupConfig = (config = {}, { project = process.cwd(), overwrite = {}, si
|
|||||||
sourceMap: sourcemap,
|
sourceMap: sourcemap,
|
||||||
extensions: resolve.extensions,
|
extensions: resolve.extensions,
|
||||||
}),
|
}),
|
||||||
babel: [
|
babel: rollupBabelPlugin({
|
||||||
isTestEnv
|
...(esm ? esmBabelConfig : legacyBabelConfig),
|
||||||
? {
|
babelHelpers: 'runtime',
|
||||||
name: 'collect-bable-plugin-istanbul-input-source-maps',
|
extensions: resolve.extensions,
|
||||||
transform(code, filename) {
|
shouldPrintComment: () => false,
|
||||||
rollupBabelIstanbulSourceMaps[rollupBabelIstanbulGenerateKey(filename)] = { ...this.getCombinedSourcemap() };
|
caller: {
|
||||||
return {
|
name: 'babel-rollup-build',
|
||||||
code,
|
},
|
||||||
map: null,
|
}),
|
||||||
};
|
|
||||||
},
|
|
||||||
}
|
|
||||||
: {},
|
|
||||||
rollupBabelPlugin({
|
|
||||||
...(esm ? esmBabelConfig : legacyBabelConfig),
|
|
||||||
babelHelpers: 'runtime',
|
|
||||||
extensions: resolve.extensions,
|
|
||||||
shouldPrintComment: () => false,
|
|
||||||
caller: {
|
|
||||||
name: 'babel-rollup-build',
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const output = genOutputConfig(esm);
|
const output = genOutputConfig(esm);
|
||||||
@@ -259,26 +238,28 @@ const rollupConfig = (config = {}, { project = process.cwd(), overwrite = {}, si
|
|||||||
input: inputPath,
|
input: inputPath,
|
||||||
output: [output].concat(
|
output: [output].concat(
|
||||||
minVersions
|
minVersions
|
||||||
? {
|
? [
|
||||||
...output,
|
{
|
||||||
compact: true,
|
...output,
|
||||||
file: output.file.replace('.js', '.min.js'),
|
compact: true,
|
||||||
sourcemap: false,
|
file: output.file.replace('.js', '.min.js'),
|
||||||
plugins: [
|
sourcemap: false,
|
||||||
...(output.plugins || []),
|
plugins: [
|
||||||
rollupTerser({
|
...(output.plugins || []),
|
||||||
ecma: 8,
|
rollupTerser({
|
||||||
safari10: true,
|
ecma: 8,
|
||||||
mangle: {
|
|
||||||
safari10: true,
|
safari10: true,
|
||||||
properties: {
|
mangle: {
|
||||||
regex: /^_/,
|
safari10: true,
|
||||||
|
properties: {
|
||||||
|
regex: /^_/,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
}),
|
||||||
}),
|
],
|
||||||
],
|
},
|
||||||
}
|
]
|
||||||
: {}
|
: []
|
||||||
),
|
),
|
||||||
external: [...Object.keys(devDependencies), ...Object.keys(peerDependencies), ...((Array.isArray(external) && external) || [])],
|
external: [...Object.keys(devDependencies), ...Object.keys(peerDependencies), ...((Array.isArray(external) && external) || [])],
|
||||||
plugins: pipeline.reduce((arr, item) => {
|
plugins: pipeline.reduce((arr, item) => {
|
||||||
@@ -304,7 +285,7 @@ const rollupConfig = (config = {}, { project = process.cwd(), overwrite = {}, si
|
|||||||
.filter((build) => build !== null)
|
.filter((build) => build !== null)
|
||||||
.map((build, index, buildsArr) => {
|
.map((build, index, buildsArr) => {
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
existingDistFilesStats = { ...readFilesStats(distPath) };
|
existingDistFilesStats = readFilesStats(distPath);
|
||||||
buildsArr.forEach((build) => {
|
buildsArr.forEach((build) => {
|
||||||
const { output } = build;
|
const { output } = build;
|
||||||
outputs += Array.isArray(output) ? output.length : 1;
|
outputs += Array.isArray(output) ? output.length : 1;
|
||||||
|
|||||||
@@ -1221,10 +1221,10 @@
|
|||||||
"@nodelib/fs.scandir" "2.1.3"
|
"@nodelib/fs.scandir" "2.1.3"
|
||||||
fastq "^1.6.0"
|
fastq "^1.6.0"
|
||||||
|
|
||||||
"@rollup/plugin-babel@^5.2.2":
|
"@rollup/plugin-babel@^5.3.0":
|
||||||
version "5.2.2"
|
version "5.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/@rollup/plugin-babel/-/plugin-babel-5.2.2.tgz#e5623a01dd8e37e004ba87f2de218c611727d9b2"
|
resolved "https://registry.yarnpkg.com/@rollup/plugin-babel/-/plugin-babel-5.3.0.tgz#9cb1c5146ddd6a4968ad96f209c50c62f92f9879"
|
||||||
integrity sha512-MjmH7GvFT4TW8xFdIeFS3wqIX646y5tACdxkTO+khbHvS3ZcVJL6vkAHLw2wqPmkhwCfWHoNsp15VYNwW6JEJA==
|
integrity sha512-9uIC8HZOnVLrLHxayq/PTzw+uS25E14KPUBh5ktF+18Mjo5yK0ToMMx6epY0uEgkjwJw0aBW4x2horYXh8juWw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/helper-module-imports" "^7.10.4"
|
"@babel/helper-module-imports" "^7.10.4"
|
||||||
"@rollup/pluginutils" "^3.1.0"
|
"@rollup/pluginutils" "^3.1.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user