move rollup to devDeps

This commit is contained in:
syuilo 2022-07-14 23:54:52 +09:00
parent ddc899938a
commit a4b5a0072d
2 changed files with 27 additions and 27 deletions

View file

@ -56,7 +56,6 @@
"random-seed": "0.3.0", "random-seed": "0.3.0",
"reflect-metadata": "0.1.13", "reflect-metadata": "0.1.13",
"rndstr": "1.0.0", "rndstr": "1.0.0",
"rollup": "2.76.0",
"s-age": "1.1.2", "s-age": "1.1.2",
"sass": "1.53.0", "sass": "1.53.0",
"seedrandom": "3.0.5", "seedrandom": "3.0.5",
@ -102,6 +101,7 @@
"@types/ws": "8.5.3", "@types/ws": "8.5.3",
"@typescript-eslint/eslint-plugin": "5.30.6", "@typescript-eslint/eslint-plugin": "5.30.6",
"@typescript-eslint/parser": "5.30.6", "@typescript-eslint/parser": "5.30.6",
"rollup": "2.76.0",
"cross-env": "7.0.3", "cross-env": "7.0.3",
"cypress": "10.3.0", "cypress": "10.3.0",
"eslint": "8.19.0", "eslint": "8.19.0",

View file

@ -6,33 +6,33 @@ import { createFilter, dataToEsm } from '@rollup/pluginutils';
import { RollupJsonOptions } from '@rollup/plugin-json'; import { RollupJsonOptions } from '@rollup/plugin-json';
export default function json5(options: RollupJsonOptions = {}): Plugin { export default function json5(options: RollupJsonOptions = {}): Plugin {
const filter = createFilter(options.include, options.exclude); const filter = createFilter(options.include, options.exclude);
const indent = 'indent' in options ? options.indent : '\t'; const indent = 'indent' in options ? options.indent : '\t';
return { return {
name: 'json5', name: 'json5',
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
transform(json, id) { transform(json, id) {
if (id.slice(-6) !== '.json5' || !filter(id)) return null; if (id.slice(-6) !== '.json5' || !filter(id)) return null;
try { try {
const parsed = JSON5.parse(json); const parsed = JSON5.parse(json);
return { return {
code: dataToEsm(parsed, { code: dataToEsm(parsed, {
preferConst: options.preferConst, preferConst: options.preferConst,
compact: options.compact, compact: options.compact,
namedExports: options.namedExports, namedExports: options.namedExports,
indent indent,
}), }),
map: { mappings: '' } map: { mappings: '' },
}; };
} catch (err) { } catch (err) {
const message = 'Could not parse JSON file'; const message = 'Could not parse JSON file';
const position = parseInt(/[\d]/.exec(err.message)[0], 10); const position = parseInt(/[\d]/.exec(err.message)[0], 10);
this.warn({ message, id, position }); this.warn({ message, id, position });
return null; return null;
} }
} },
}; };
} }