prettier 1.11.0 → 1.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin-prettier.js +332 -259
- package/index.js +50 -15
- package/package.json +2 -2
- package/parser-typescript.js +1 -1
- package/prettier-1.11.1.tgz +0 -0
- package/prettier-1.11.0.tgz +0 -0
package/index.js
CHANGED
|
@@ -187,7 +187,7 @@ function printKeyValues(key, valueOrArray) {
|
|
|
187
187
|
unwrapExports(build);
|
|
188
188
|
|
|
189
189
|
var name = "prettier";
|
|
190
|
-
var version$1 = "1.11.
|
|
190
|
+
var version$1 = "1.11.1";
|
|
191
191
|
var description = "Prettier is an opinionated code formatter";
|
|
192
192
|
var bin = {"prettier":"./bin/prettier.js"};
|
|
193
193
|
var repository = "prettier/prettier";
|
|
@@ -197,7 +197,7 @@ var license = "MIT";
|
|
|
197
197
|
var main = "./index.js";
|
|
198
198
|
var engines = {"node":">=4"};
|
|
199
199
|
var dependencies = {"@babel/code-frame":"7.0.0-beta.35","@glimmer/syntax":"0.30.3","babylon":"7.0.0-beta.34","camelcase":"4.1.0","chalk":"2.1.0","cjk-regex":"1.0.2","cosmiconfig":"3.1.0","dashify":"0.2.2","dedent":"0.7.0","diff":"3.2.0","editorconfig":"0.14.2","editorconfig-to-prettier":"0.0.6","emoji-regex":"6.5.1","escape-string-regexp":"1.0.5","esutils":"2.0.2","find-project-root":"1.1.1","flow-parser":"0.64.0","get-stream":"3.0.0","globby":"6.1.0","graphql":"0.12.3","gray-matter":"3.1.1","html-tag-names":"1.1.1","ignore":"3.3.7","jest-docblock":"22.2.2","json-stable-stringify":"1.0.1","leven":"2.1.0","mem":"1.1.0","minimatch":"3.0.4","minimist":"1.2.0","parse5":"3.0.3","postcss-less":"1.1.3","postcss-media-query-parser":"0.2.3","postcss-scss":"1.0.2","postcss-selector-parser":"2.2.3","postcss-values-parser":"1.3.2","read-pkg-up":"3.0.0","remark-frontmatter":"1.1.0","remark-parse":"5.0.0","resolve":"1.5.0","semver":"5.4.1","string-width":"2.1.1","typescript":"2.8.0-dev.20180222","typescript-eslint-parser":"14.0.0","unicode-regex":"1.0.1","unified":"6.1.6"};
|
|
200
|
-
var devDependencies = {"babel-cli":"6.24.1","babel-preset-es2015":"6.24.1","codecov":"2.2.0","cross-env":"5.0.5","eslint":"4.1.1","eslint-config-prettier":"2.9.0","eslint-friendly-formatter":"3.0.0","eslint-plugin-import":"2.6.1","eslint-plugin-prettier":"2.4.0","eslint-plugin-react":"7.1.0","jest":"21.1.0","mkdirp":"0.5.1","prettier":"1.
|
|
200
|
+
var devDependencies = {"babel-cli":"6.24.1","babel-preset-es2015":"6.24.1","codecov":"2.2.0","cross-env":"5.0.5","eslint":"4.1.1","eslint-config-prettier":"2.9.0","eslint-friendly-formatter":"3.0.0","eslint-plugin-import":"2.6.1","eslint-plugin-prettier":"2.4.0","eslint-plugin-react":"7.1.0","jest":"21.1.0","mkdirp":"0.5.1","prettier":"1.11.0","prettylint":"1.0.0","rimraf":"2.6.2","rollup":"0.47.6","rollup-plugin-commonjs":"8.2.6","rollup-plugin-json":"2.1.1","rollup-plugin-node-builtins":"2.0.0","rollup-plugin-node-globals":"1.1.0","rollup-plugin-node-resolve":"2.0.0","rollup-plugin-replace":"1.2.1","shelljs":"0.8.1","snapshot-diff":"0.2.2","strip-ansi":"4.0.0","sw-toolbox":"3.6.0","tempy":"0.2.1","uglify-es":"3.0.28","webpack":"2.6.1"};
|
|
201
201
|
var scripts = {"prepublishOnly":"echo \"Error: must publish from dist/\" && exit 1","prepare-release":"yarn && yarn build && yarn test:dist","test":"jest","test:dist":"node ./scripts/test-dist.js","test-integration":"jest tests_integration","lint":"cross-env EFF_NO_LINK_RULES=true eslint . --format node_modules/eslint-friendly-formatter","lint-docs":"prettylint {.,docs,website,website/blog}/*.md","build":"node ./scripts/build/build.js","build-docs":"node ./scripts/build/build-docs.js","check-deps":"node ./scripts/check-deps.js"};
|
|
202
202
|
var _package = {
|
|
203
203
|
name: name,
|
|
@@ -19377,7 +19377,7 @@ function loadPlugins(plugins) {
|
|
|
19377
19377
|
}
|
|
19378
19378
|
|
|
19379
19379
|
const pluginPath = resolve.sync(plugin, { basedir: process.cwd() });
|
|
19380
|
-
return require(pluginPath);
|
|
19380
|
+
return Object.assign({ name: plugin }, require(pluginPath));
|
|
19381
19381
|
});
|
|
19382
19382
|
|
|
19383
19383
|
return deduplicate(internalPlugins.concat(externalPlugins));
|
|
@@ -19858,6 +19858,16 @@ function getSupportInfo$1(version, opts) {
|
|
|
19858
19858
|
}
|
|
19859
19859
|
|
|
19860
19860
|
return newOption;
|
|
19861
|
+
})
|
|
19862
|
+
.map(option => {
|
|
19863
|
+
const filteredPlugins = plugins.filter(
|
|
19864
|
+
plugin => plugin.defaultOptions && plugin.defaultOptions[option.name]
|
|
19865
|
+
);
|
|
19866
|
+
const pluginDefaults = filteredPlugins.reduce((reduced, plugin) => {
|
|
19867
|
+
reduced[plugin.name] = plugin.defaultOptions[option.name];
|
|
19868
|
+
return reduced;
|
|
19869
|
+
}, {});
|
|
19870
|
+
return Object.assign(option, { pluginDefaults });
|
|
19861
19871
|
});
|
|
19862
19872
|
|
|
19863
19873
|
const usePostCssParser = semver.lt(version, "1.7.1");
|
|
@@ -23132,25 +23142,23 @@ function parse$4(text, opts) {
|
|
|
23132
23142
|
|
|
23133
23143
|
var parser$3 = { parse: parse$4, resolveParser: resolveParser$1 };
|
|
23134
23144
|
|
|
23135
|
-
function
|
|
23145
|
+
function getPlugin(options) {
|
|
23136
23146
|
const astFormat = options.astFormat;
|
|
23137
23147
|
|
|
23138
23148
|
if (!astFormat) {
|
|
23139
|
-
throw new Error("
|
|
23149
|
+
throw new Error("getPlugin() requires astFormat to be set");
|
|
23140
23150
|
}
|
|
23141
23151
|
const printerPlugin = options.plugins.find(
|
|
23142
23152
|
plugin => plugin.printers[astFormat]
|
|
23143
23153
|
);
|
|
23144
23154
|
if (!printerPlugin) {
|
|
23145
|
-
throw new Error(
|
|
23146
|
-
`Couldn't find printer plugin for AST format "${astFormat}"`
|
|
23147
|
-
);
|
|
23155
|
+
throw new Error(`Couldn't find plugin for AST format "${astFormat}"`);
|
|
23148
23156
|
}
|
|
23149
23157
|
|
|
23150
|
-
return printerPlugin
|
|
23158
|
+
return printerPlugin;
|
|
23151
23159
|
}
|
|
23152
23160
|
|
|
23153
|
-
var
|
|
23161
|
+
var getPlugin_1 = getPlugin;
|
|
23154
23162
|
|
|
23155
23163
|
const getSupportInfo$2 = support.getSupportInfo;
|
|
23156
23164
|
|
|
@@ -23177,7 +23185,8 @@ function normalize$2(options, opts) {
|
|
|
23177
23185
|
const supportOptions = getSupportInfo$2(null, {
|
|
23178
23186
|
plugins,
|
|
23179
23187
|
pluginsLoaded: true,
|
|
23180
|
-
showUnreleased: true
|
|
23188
|
+
showUnreleased: true,
|
|
23189
|
+
showDeprecated: true
|
|
23181
23190
|
}).options;
|
|
23182
23191
|
const defaults = supportOptions.reduce(
|
|
23183
23192
|
(reduced, optionInfo) =>
|
|
@@ -23200,15 +23209,41 @@ function normalize$2(options, opts) {
|
|
|
23200
23209
|
}
|
|
23201
23210
|
}
|
|
23202
23211
|
|
|
23203
|
-
const parser = resolveParser(
|
|
23212
|
+
const parser = resolveParser(
|
|
23213
|
+
!rawOptions.parser
|
|
23214
|
+
? rawOptions
|
|
23215
|
+
: // handle deprecated parsers
|
|
23216
|
+
optionsNormalizer.normalizeApiOptions(
|
|
23217
|
+
rawOptions,
|
|
23218
|
+
[supportOptions.find(x => x.name === "parser")],
|
|
23219
|
+
{ passThrough: true, logger: false }
|
|
23220
|
+
)
|
|
23221
|
+
);
|
|
23204
23222
|
rawOptions.astFormat = parser.astFormat;
|
|
23205
23223
|
rawOptions.locEnd = parser.locEnd;
|
|
23206
23224
|
rawOptions.locStart = parser.locStart;
|
|
23207
|
-
rawOptions.printer = getPrinter_1(rawOptions);
|
|
23208
23225
|
|
|
23209
|
-
|
|
23226
|
+
const plugin = getPlugin_1(rawOptions);
|
|
23227
|
+
rawOptions.printer = plugin.printers[rawOptions.astFormat];
|
|
23228
|
+
|
|
23229
|
+
const pluginDefaults = supportOptions
|
|
23230
|
+
.filter(
|
|
23231
|
+
optionInfo =>
|
|
23232
|
+
optionInfo.pluginDefaults && optionInfo.pluginDefaults[plugin.name]
|
|
23233
|
+
)
|
|
23234
|
+
.reduce(
|
|
23235
|
+
(reduced, optionInfo) =>
|
|
23236
|
+
Object.assign(reduced, {
|
|
23237
|
+
[optionInfo.name]: optionInfo.pluginDefaults[plugin.name]
|
|
23238
|
+
}),
|
|
23239
|
+
{}
|
|
23240
|
+
);
|
|
23241
|
+
|
|
23242
|
+
const mixedDefaults = Object.assign({}, defaults, pluginDefaults);
|
|
23243
|
+
|
|
23244
|
+
Object.keys(mixedDefaults).forEach(k => {
|
|
23210
23245
|
if (rawOptions[k] == null) {
|
|
23211
|
-
rawOptions[k] =
|
|
23246
|
+
rawOptions[k] = mixedDefaults[k];
|
|
23212
23247
|
}
|
|
23213
23248
|
});
|
|
23214
23249
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prettier",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.1",
|
|
4
4
|
"description": "Prettier is an opinionated code formatter",
|
|
5
5
|
"bin": "./bin-prettier.js",
|
|
6
6
|
"repository": "prettier/prettier",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"eslint-plugin-react": "7.1.0",
|
|
25
25
|
"jest": "21.1.0",
|
|
26
26
|
"mkdirp": "0.5.1",
|
|
27
|
-
"prettier": "1.
|
|
27
|
+
"prettier": "1.11.0",
|
|
28
28
|
"prettylint": "1.0.0",
|
|
29
29
|
"rimraf": "2.6.2",
|
|
30
30
|
"rollup": "0.47.6",
|