Files
test-repo/scripts/build/rollup.docs.config.js
T
Ika 1062f2a889 feat: support JSON.stringify formatting (#4450)
* test: move tests

* feat: support legacy JSON formatting

* fix: add missing assertion

* test: fix coverage

* fix: same output as JSON.stringify

* refactor: fix linting

* refactor: rename to json-stringify

* refactor: fix linting

* fix: should fix the production build

* docs: remove outdated name

* fix(playgound): add lib/parser-json-stringify.js

* feat(playgound): add example for json-stringify

* fix: no error on singleQuote string

* fix(playground): correctly load json-stringify

* fix: identifier is only allowed in ObjectProperty.key

* refactor: clearer
2018-05-14 09:12:25 +08:00

22 lines
788 B
JavaScript

import baseConfig from "./rollup.base.config.js";
import resolve from "rollup-plugin-node-resolve";
import commonjs from "rollup-plugin-commonjs";
import globals from "rollup-plugin-node-globals";
import json from "rollup-plugin-json";
const filepath = process.env.filepath;
const filename = filepath.replace(/.+\//, "");
const basename = filename.replace(/\..+/, "");
export default Object.assign(baseConfig, {
entry: "node_modules/prettier/" + filepath,
dest: "website/static/lib/" + filename,
format: "iife",
plugins: [json(), resolve({ preferBuiltins: true }), commonjs(), globals()],
useStrict: false,
moduleName: basename
.replace(/^parser-/, "")
.replace(/-/g, "_") /* `json-stringify` is not a valid identifier */,
external: ["assert", "fs", "module"]
});