0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 15:30:56 +01:00
nodejs/tools/node-lint-md-cli-rollup/rollup.config.js
Rich Trott 82afd85a31 tools: update lint-md task to lint for possessives of Node.js
Add a markdown lint rule to prohibit "Node.js'" and "Node.js's".
Instead, of "Node.js' module system", use "the Node.js module system".

Refs: https://github.com/nodejs/node/pull/31748#issuecomment-585087745

PR-URL: https://github.com/nodejs/node/pull/31862
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2020-02-20 21:37:29 -08:00

51 lines
1.2 KiB
JavaScript

'use strict';
const resolve = require('@rollup/plugin-node-resolve');
const commonjs = require('@rollup/plugin-commonjs');
const json = require('@rollup/plugin-json');
module.exports = {
input: 'src/cli-entry.js',
output: {
file: 'dist/index.js',
format: 'cjs',
sourcemap: false,
},
external: [
'stream',
'path',
'module',
'util',
'tty',
'os',
'fs',
'fsevents',
'events',
'assert',
],
plugins: [
{
name: 'brute-replace',
transform(code, id) {
const normID = id.replace(__dirname, '').replace(/\\+/g, '/');
if (normID === '/node_modules/concat-stream/index.js') {
return code.replace('\'readable-stream\'', '\'stream\'');
}
if (normID === '/node_modules/unified-args/lib/options.js') {
return code.replace('\'./schema\'', '\'./schema.json\'');
}
if (normID === '/node_modules/chokidar/lib/fsevents-handler.js') {
return code.replace(
'fsevents = require(\'fsevents\');', 'fsevents = undefined;'
);
}
}
},
json({
preferConst: true
}),
resolve(), // tells Rollup how to find date-fns in node_modules
commonjs(), // Converts date-fns to ES modules
]
};