mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-05 18:02:26 +03:00
optimize repo
This commit is contained in:
@@ -20,8 +20,7 @@
|
||||
"rollup-plugin-scss": "^3.0.0",
|
||||
"rollup-plugin-serve": "^1.1.0",
|
||||
"rollup-plugin-styles": "^4.0.0",
|
||||
"rollup-plugin-summary": "^1.4.3",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"@rollup/plugin-virtual": "^3.0.1",
|
||||
"rollup-plugin-typescript2": "^0.32.1",
|
||||
"sass": "^1.54.0"
|
||||
},
|
||||
|
||||
@@ -1,17 +1,44 @@
|
||||
const path = require('path');
|
||||
const { terser: rollupTerser } = require('rollup-plugin-terser');
|
||||
const { rollupJson } = require('./plugins');
|
||||
const { rollupVirtual } = require('./plugins');
|
||||
|
||||
module.exports = (resolve, options) => {
|
||||
const { extractPackageJson, outDir, rollup } = options;
|
||||
module.exports = (_, options) => {
|
||||
const { extractPackageJson, outDir } = options;
|
||||
|
||||
const { input = './package.json', output = './package.json' } = extractPackageJson;
|
||||
const {
|
||||
input = './package.json',
|
||||
output = './package.json',
|
||||
json,
|
||||
} = typeof extractPackageJson === 'object' ? extractPackageJson : {};
|
||||
const resolvedInput = path.resolve(input);
|
||||
const inputPackageJson = require(resolvedInput);
|
||||
|
||||
return {
|
||||
input,
|
||||
input: resolvedInput,
|
||||
onwarn: (warning, warn) => {
|
||||
if (warning.code !== 'EMPTY_BUNDLE') {
|
||||
warn(warning);
|
||||
}
|
||||
},
|
||||
output: {
|
||||
file: path.resolve(outDir, output),
|
||||
},
|
||||
plugins: [rollupJson()],
|
||||
plugins: [
|
||||
rollupVirtual({
|
||||
[resolvedInput]: '',
|
||||
}),
|
||||
{
|
||||
generateBundle(__, bundle) {
|
||||
const bundleKeys = Object.keys(bundle);
|
||||
if (bundleKeys.length > 1) {
|
||||
throw new Error('Unexpected entries length.');
|
||||
}
|
||||
bundle[bundleKeys[0]].code = JSON.stringify(
|
||||
typeof json === 'function' ? json(inputPackageJson) : inputPackageJson,
|
||||
null,
|
||||
2
|
||||
);
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@ const rollupPluginScss = require('rollup-plugin-scss');
|
||||
const rollupPluginIgnoreImport = require('rollup-plugin-ignore-import');
|
||||
const rollupPluginCommonjs = require('@rollup/plugin-commonjs');
|
||||
const rollupPluginAlias = require('@rollup/plugin-alias');
|
||||
const rollupPluginJson = require('@rollup/plugin-json');
|
||||
const rollupPluginVirtual = require('@rollup/plugin-virtual');
|
||||
const rollupPluginTs = require('rollup-plugin-typescript2');
|
||||
const rollupPluginLicense = require('rollup-plugin-license');
|
||||
const rollupPluginEsBuild = require('../plugins/esbuild');
|
||||
@@ -128,5 +128,5 @@ module.exports = {
|
||||
commentStyle: 'ignored',
|
||||
},
|
||||
}),
|
||||
rollupJson: () => rollupPluginJson(),
|
||||
rollupVirtual: (modules) => rollupPluginVirtual(modules),
|
||||
};
|
||||
|
||||
@@ -8,10 +8,10 @@ module.exports = (resolve, options, esbuild) => {
|
||||
const { extractTypes, extractStyles, extractPackageJson } = options;
|
||||
const bundleScript = esbuild ? bundleScriptEsbuild : bundleScriptDefault;
|
||||
|
||||
const pkgJson = extractPackageJson && bundlePackageJson(resolve, options);
|
||||
const styles = extractStyles && bundleStyles(resolve, options);
|
||||
const types = extractTypes && bundleTypes(resolve, options);
|
||||
const js = bundleScript(resolve, options);
|
||||
const pkgJson = extractPackageJson && bundlePackageJson(resolve, options);
|
||||
|
||||
return [styles, types, js, pkgJson].flat().filter((build) => !!build);
|
||||
return [pkgJson, styles, types, js].flat().filter((build) => !!build);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user