prettier 3.0.0-alpha.9-for-vscode → 3.0.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/LICENSE +66 -149
- package/README.md +2 -2
- package/bin/prettier.cjs +0 -0
- package/doc.d.ts +7 -7
- package/doc.js +35 -86
- package/doc.mjs +48 -94
- package/index.cjs +440 -20576
- package/index.d.ts +55 -55
- package/index.mjs +7272 -6575
- package/internal/cli.mjs +52 -45
- package/internal/internal.mjs +171 -77
- package/package.json +4 -7
- package/plugins/acorn.js +12 -12
- package/plugins/acorn.mjs +12 -12
- package/plugins/angular.d.ts +1 -1
- package/plugins/angular.js +2 -2
- package/plugins/angular.mjs +2 -2
- package/plugins/babel.js +12 -12
- package/plugins/babel.mjs +12 -12
- package/plugins/estree.d.ts +1 -0
- package/plugins/estree.js +30 -30
- package/plugins/estree.mjs +30 -30
- package/plugins/flow.js +17 -17
- package/plugins/flow.mjs +17 -17
- package/plugins/glimmer.js +22 -22
- package/plugins/glimmer.mjs +22 -22
- package/plugins/graphql.js +26 -15
- package/plugins/graphql.mjs +26 -15
- package/plugins/html.d.ts +2 -2
- package/plugins/html.js +16 -16
- package/plugins/html.mjs +16 -16
- package/plugins/markdown.d.ts +1 -1
- package/plugins/markdown.js +49 -49
- package/plugins/markdown.mjs +49 -49
- package/plugins/meriyah.js +5 -5
- package/plugins/meriyah.mjs +5 -5
- package/plugins/postcss.js +46 -46
- package/plugins/postcss.mjs +46 -46
- package/plugins/typescript.js +20 -22
- package/plugins/typescript.mjs +20 -22
- package/plugins/yaml.js +104 -104
- package/plugins/yaml.mjs +104 -104
- package/standalone.d.ts +1 -1
- package/standalone.js +31 -30
- package/standalone.mjs +31 -30
- package/internal/internal.cjs +0 -6430
package/internal/internal.mjs
CHANGED
|
@@ -16,7 +16,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
16
16
|
}) : x)(function(x) {
|
|
17
17
|
if (typeof require !== "undefined")
|
|
18
18
|
return require.apply(this, arguments);
|
|
19
|
-
throw
|
|
19
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
20
20
|
});
|
|
21
21
|
var __commonJS = (cb, mod) => function __require2() {
|
|
22
22
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
@@ -68,6 +68,29 @@ var require_cacheWrapper = __commonJS({
|
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
70
|
|
|
71
|
+
// node_modules/cosmiconfig/dist/getPropertyByPath.js
|
|
72
|
+
var require_getPropertyByPath = __commonJS({
|
|
73
|
+
"node_modules/cosmiconfig/dist/getPropertyByPath.js"(exports) {
|
|
74
|
+
"use strict";
|
|
75
|
+
Object.defineProperty(exports, "__esModule", {
|
|
76
|
+
value: true
|
|
77
|
+
});
|
|
78
|
+
exports.getPropertyByPath = getPropertyByPath;
|
|
79
|
+
function getPropertyByPath(source, path) {
|
|
80
|
+
if (typeof path === "string" && Object.prototype.hasOwnProperty.call(source, path)) {
|
|
81
|
+
return source[path];
|
|
82
|
+
}
|
|
83
|
+
const parsedPath = typeof path === "string" ? path.split(".") : path;
|
|
84
|
+
return parsedPath.reduce((previous, key) => {
|
|
85
|
+
if (previous === void 0) {
|
|
86
|
+
return previous;
|
|
87
|
+
}
|
|
88
|
+
return previous[key];
|
|
89
|
+
}, source);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
71
94
|
// node_modules/import-fresh/node_modules/resolve-from/index.js
|
|
72
95
|
var require_resolve_from = __commonJS({
|
|
73
96
|
"node_modules/import-fresh/node_modules/resolve-from/index.js"(exports, module) {
|
|
@@ -5362,14 +5385,25 @@ var require_loaders = __commonJS({
|
|
|
5362
5385
|
value: true
|
|
5363
5386
|
});
|
|
5364
5387
|
exports.loaders = void 0;
|
|
5388
|
+
var _url = __require("url");
|
|
5365
5389
|
var importFresh;
|
|
5366
|
-
var
|
|
5390
|
+
var loadJsSync = function loadJsSync2(filepath) {
|
|
5367
5391
|
if (importFresh === void 0) {
|
|
5368
5392
|
importFresh = require_import_fresh();
|
|
5369
5393
|
}
|
|
5370
5394
|
const result = importFresh(filepath);
|
|
5371
5395
|
return result;
|
|
5372
5396
|
};
|
|
5397
|
+
var loadJs = async function loadJs2(filepath) {
|
|
5398
|
+
try {
|
|
5399
|
+
const {
|
|
5400
|
+
href
|
|
5401
|
+
} = (0, _url.pathToFileURL)(filepath);
|
|
5402
|
+
return (await import(href)).default;
|
|
5403
|
+
} catch (error) {
|
|
5404
|
+
return loadJsSync(filepath, "");
|
|
5405
|
+
}
|
|
5406
|
+
};
|
|
5373
5407
|
var parseJson;
|
|
5374
5408
|
var loadJson = function loadJson2(filepath, content) {
|
|
5375
5409
|
if (parseJson === void 0) {
|
|
@@ -5400,6 +5434,7 @@ ${error.message}`;
|
|
|
5400
5434
|
};
|
|
5401
5435
|
var loaders = {
|
|
5402
5436
|
loadJs,
|
|
5437
|
+
loadJsSync,
|
|
5403
5438
|
loadJson,
|
|
5404
5439
|
loadYaml
|
|
5405
5440
|
};
|
|
@@ -5407,29 +5442,6 @@ ${error.message}`;
|
|
|
5407
5442
|
}
|
|
5408
5443
|
});
|
|
5409
5444
|
|
|
5410
|
-
// node_modules/cosmiconfig/dist/getPropertyByPath.js
|
|
5411
|
-
var require_getPropertyByPath = __commonJS({
|
|
5412
|
-
"node_modules/cosmiconfig/dist/getPropertyByPath.js"(exports) {
|
|
5413
|
-
"use strict";
|
|
5414
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5415
|
-
value: true
|
|
5416
|
-
});
|
|
5417
|
-
exports.getPropertyByPath = getPropertyByPath;
|
|
5418
|
-
function getPropertyByPath(source, path) {
|
|
5419
|
-
if (typeof path === "string" && Object.prototype.hasOwnProperty.call(source, path)) {
|
|
5420
|
-
return source[path];
|
|
5421
|
-
}
|
|
5422
|
-
const parsedPath = typeof path === "string" ? path.split(".") : path;
|
|
5423
|
-
return parsedPath.reduce((previous, key) => {
|
|
5424
|
-
if (previous === void 0) {
|
|
5425
|
-
return previous;
|
|
5426
|
-
}
|
|
5427
|
-
return previous[key];
|
|
5428
|
-
}, source);
|
|
5429
|
-
}
|
|
5430
|
-
}
|
|
5431
|
-
});
|
|
5432
|
-
|
|
5433
5445
|
// node_modules/cosmiconfig/dist/ExplorerBase.js
|
|
5434
5446
|
var require_ExplorerBase = __commonJS({
|
|
5435
5447
|
"node_modules/cosmiconfig/dist/ExplorerBase.js"(exports) {
|
|
@@ -5440,14 +5452,14 @@ var require_ExplorerBase = __commonJS({
|
|
|
5440
5452
|
exports.ExplorerBase = void 0;
|
|
5441
5453
|
exports.getExtensionDescription = getExtensionDescription;
|
|
5442
5454
|
var _path = _interopRequireDefault(__require("path"));
|
|
5443
|
-
var _loaders = require_loaders();
|
|
5444
5455
|
var _getPropertyByPath = require_getPropertyByPath();
|
|
5456
|
+
var _loaders = require_loaders();
|
|
5445
5457
|
function _interopRequireDefault(obj) {
|
|
5446
5458
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
5447
5459
|
}
|
|
5448
5460
|
var ExplorerBase = class {
|
|
5449
5461
|
constructor(options) {
|
|
5450
|
-
if (options.cache
|
|
5462
|
+
if (options.cache) {
|
|
5451
5463
|
this.loadCache = /* @__PURE__ */ new Map();
|
|
5452
5464
|
this.searchCache = /* @__PURE__ */ new Map();
|
|
5453
5465
|
}
|
|
@@ -5484,9 +5496,7 @@ var require_ExplorerBase = __commonJS({
|
|
|
5484
5496
|
shouldSearchStopWithResult(result) {
|
|
5485
5497
|
if (result === null)
|
|
5486
5498
|
return false;
|
|
5487
|
-
|
|
5488
|
-
return false;
|
|
5489
|
-
return true;
|
|
5499
|
+
return !(result.isEmpty && this.config.ignoreEmptySearchPlaces);
|
|
5490
5500
|
}
|
|
5491
5501
|
nextDirectoryToSearch(currentDir, currentResult) {
|
|
5492
5502
|
if (this.shouldSearchStopWithResult(currentResult)) {
|
|
@@ -5505,8 +5515,7 @@ var require_ExplorerBase = __commonJS({
|
|
|
5505
5515
|
}
|
|
5506
5516
|
getLoaderEntryForFile(filepath) {
|
|
5507
5517
|
if (_path.default.basename(filepath) === "package.json") {
|
|
5508
|
-
|
|
5509
|
-
return loader2;
|
|
5518
|
+
return this.loadPackageProp.bind(this);
|
|
5510
5519
|
}
|
|
5511
5520
|
const loaderKey = _path.default.extname(filepath) || "noExt";
|
|
5512
5521
|
const loader = this.config.loaders[loaderKey];
|
|
@@ -5515,7 +5524,7 @@ var require_ExplorerBase = __commonJS({
|
|
|
5515
5524
|
}
|
|
5516
5525
|
return loader;
|
|
5517
5526
|
}
|
|
5518
|
-
loadedContentToCosmiconfigResult(filepath, loadedContent) {
|
|
5527
|
+
loadedContentToCosmiconfigResult(filepath, loadedContent, forceProp) {
|
|
5519
5528
|
if (loadedContent === null) {
|
|
5520
5529
|
return null;
|
|
5521
5530
|
}
|
|
@@ -5526,6 +5535,16 @@ var require_ExplorerBase = __commonJS({
|
|
|
5526
5535
|
isEmpty: true
|
|
5527
5536
|
};
|
|
5528
5537
|
}
|
|
5538
|
+
if (this.config.usePackagePropInConfigFiles || forceProp) {
|
|
5539
|
+
loadedContent = (0, _getPropertyByPath.getPropertyByPath)(loadedContent, this.config.packageProp);
|
|
5540
|
+
}
|
|
5541
|
+
if (loadedContent === void 0) {
|
|
5542
|
+
return {
|
|
5543
|
+
filepath,
|
|
5544
|
+
config: void 0,
|
|
5545
|
+
isEmpty: true
|
|
5546
|
+
};
|
|
5547
|
+
}
|
|
5529
5548
|
return {
|
|
5530
5549
|
config: loadedContent,
|
|
5531
5550
|
filepath
|
|
@@ -5695,9 +5714,13 @@ var require_Explorer = __commonJS({
|
|
|
5695
5714
|
super(options);
|
|
5696
5715
|
}
|
|
5697
5716
|
async search(searchFrom = process.cwd()) {
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5717
|
+
if (this.config.metaConfigFilePath) {
|
|
5718
|
+
const config = await this._loadFile(this.config.metaConfigFilePath, true);
|
|
5719
|
+
if (config && !config.isEmpty) {
|
|
5720
|
+
return config;
|
|
5721
|
+
}
|
|
5722
|
+
}
|
|
5723
|
+
return await this.searchFromDirectory(await (0, _getDirectory.getDirectory)(searchFrom));
|
|
5701
5724
|
}
|
|
5702
5725
|
async searchFromDirectory(dir) {
|
|
5703
5726
|
const absoluteDir = _path.default.resolve(process.cwd(), dir);
|
|
@@ -5707,8 +5730,7 @@ var require_Explorer = __commonJS({
|
|
|
5707
5730
|
if (nextDir) {
|
|
5708
5731
|
return this.searchFromDirectory(nextDir);
|
|
5709
5732
|
}
|
|
5710
|
-
|
|
5711
|
-
return transformResult;
|
|
5733
|
+
return await this.config.transform(result);
|
|
5712
5734
|
};
|
|
5713
5735
|
if (this.searchCache) {
|
|
5714
5736
|
return (0, _cacheWrapper.cacheWrapper)(this.searchCache, absoluteDir, run);
|
|
@@ -5718,7 +5740,7 @@ var require_Explorer = __commonJS({
|
|
|
5718
5740
|
async searchDirectory(dir) {
|
|
5719
5741
|
for await (const place of this.config.searchPlaces) {
|
|
5720
5742
|
const placeResult = await this.loadSearchPlace(dir, place);
|
|
5721
|
-
if (this.shouldSearchStopWithResult(placeResult)
|
|
5743
|
+
if (this.shouldSearchStopWithResult(placeResult)) {
|
|
5722
5744
|
return placeResult;
|
|
5723
5745
|
}
|
|
5724
5746
|
}
|
|
@@ -5727,8 +5749,7 @@ var require_Explorer = __commonJS({
|
|
|
5727
5749
|
async loadSearchPlace(dir, place) {
|
|
5728
5750
|
const filepath = _path.default.join(dir, place);
|
|
5729
5751
|
const fileContents = await (0, _readFile.readFile)(filepath);
|
|
5730
|
-
|
|
5731
|
-
return result;
|
|
5752
|
+
return await this.createCosmiconfigResult(filepath, fileContents, false);
|
|
5732
5753
|
}
|
|
5733
5754
|
async loadFileContent(filepath, content) {
|
|
5734
5755
|
if (content === null) {
|
|
@@ -5745,21 +5766,22 @@ var require_Explorer = __commonJS({
|
|
|
5745
5766
|
throw e;
|
|
5746
5767
|
}
|
|
5747
5768
|
}
|
|
5748
|
-
async createCosmiconfigResult(filepath, content) {
|
|
5769
|
+
async createCosmiconfigResult(filepath, content, forceProp) {
|
|
5749
5770
|
const fileContent = await this.loadFileContent(filepath, content);
|
|
5750
|
-
|
|
5751
|
-
return result;
|
|
5771
|
+
return this.loadedContentToCosmiconfigResult(filepath, fileContent, forceProp);
|
|
5752
5772
|
}
|
|
5753
5773
|
async load(filepath) {
|
|
5774
|
+
return this._loadFile(filepath, false);
|
|
5775
|
+
}
|
|
5776
|
+
async _loadFile(filepath, forceProp) {
|
|
5754
5777
|
this.validateFilePath(filepath);
|
|
5755
5778
|
const absoluteFilePath = _path.default.resolve(process.cwd(), filepath);
|
|
5756
5779
|
const runLoad = async () => {
|
|
5757
5780
|
const fileContents = await (0, _readFile.readFile)(absoluteFilePath, {
|
|
5758
5781
|
throwNotFound: true
|
|
5759
5782
|
});
|
|
5760
|
-
const result = await this.createCosmiconfigResult(absoluteFilePath, fileContents);
|
|
5761
|
-
|
|
5762
|
-
return transformResult;
|
|
5783
|
+
const result = await this.createCosmiconfigResult(absoluteFilePath, fileContents, forceProp);
|
|
5784
|
+
return await this.config.transform(result);
|
|
5763
5785
|
};
|
|
5764
5786
|
if (this.loadCache) {
|
|
5765
5787
|
return (0, _cacheWrapper.cacheWrapper)(this.loadCache, absoluteFilePath, runLoad);
|
|
@@ -5792,9 +5814,13 @@ var require_ExplorerSync = __commonJS({
|
|
|
5792
5814
|
super(options);
|
|
5793
5815
|
}
|
|
5794
5816
|
searchSync(searchFrom = process.cwd()) {
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5817
|
+
if (this.config.metaConfigFilePath) {
|
|
5818
|
+
const config = this._loadFileSync(this.config.metaConfigFilePath, true);
|
|
5819
|
+
if (config && !config.isEmpty) {
|
|
5820
|
+
return config;
|
|
5821
|
+
}
|
|
5822
|
+
}
|
|
5823
|
+
return this.searchFromDirectorySync((0, _getDirectory.getDirectorySync)(searchFrom));
|
|
5798
5824
|
}
|
|
5799
5825
|
searchFromDirectorySync(dir) {
|
|
5800
5826
|
const absoluteDir = _path.default.resolve(process.cwd(), dir);
|
|
@@ -5804,8 +5830,7 @@ var require_ExplorerSync = __commonJS({
|
|
|
5804
5830
|
if (nextDir) {
|
|
5805
5831
|
return this.searchFromDirectorySync(nextDir);
|
|
5806
5832
|
}
|
|
5807
|
-
|
|
5808
|
-
return transformResult;
|
|
5833
|
+
return this.config.transform(result);
|
|
5809
5834
|
};
|
|
5810
5835
|
if (this.searchCache) {
|
|
5811
5836
|
return (0, _cacheWrapper.cacheWrapperSync)(this.searchCache, absoluteDir, run);
|
|
@@ -5815,7 +5840,7 @@ var require_ExplorerSync = __commonJS({
|
|
|
5815
5840
|
searchDirectorySync(dir) {
|
|
5816
5841
|
for (const place of this.config.searchPlaces) {
|
|
5817
5842
|
const placeResult = this.loadSearchPlaceSync(dir, place);
|
|
5818
|
-
if (this.shouldSearchStopWithResult(placeResult)
|
|
5843
|
+
if (this.shouldSearchStopWithResult(placeResult)) {
|
|
5819
5844
|
return placeResult;
|
|
5820
5845
|
}
|
|
5821
5846
|
}
|
|
@@ -5824,8 +5849,7 @@ var require_ExplorerSync = __commonJS({
|
|
|
5824
5849
|
loadSearchPlaceSync(dir, place) {
|
|
5825
5850
|
const filepath = _path.default.join(dir, place);
|
|
5826
5851
|
const content = (0, _readFile.readFileSync)(filepath);
|
|
5827
|
-
|
|
5828
|
-
return result;
|
|
5852
|
+
return this.createCosmiconfigResultSync(filepath, content, false);
|
|
5829
5853
|
}
|
|
5830
5854
|
loadFileContentSync(filepath, content) {
|
|
5831
5855
|
if (content === null) {
|
|
@@ -5842,21 +5866,22 @@ var require_ExplorerSync = __commonJS({
|
|
|
5842
5866
|
throw e;
|
|
5843
5867
|
}
|
|
5844
5868
|
}
|
|
5845
|
-
createCosmiconfigResultSync(filepath, content) {
|
|
5869
|
+
createCosmiconfigResultSync(filepath, content, forceProp) {
|
|
5846
5870
|
const fileContent = this.loadFileContentSync(filepath, content);
|
|
5847
|
-
|
|
5848
|
-
return result;
|
|
5871
|
+
return this.loadedContentToCosmiconfigResult(filepath, fileContent, forceProp);
|
|
5849
5872
|
}
|
|
5850
5873
|
loadSync(filepath) {
|
|
5874
|
+
return this._loadFileSync(filepath, false);
|
|
5875
|
+
}
|
|
5876
|
+
_loadFileSync(filepath, forceProp) {
|
|
5851
5877
|
this.validateFilePath(filepath);
|
|
5852
5878
|
const absoluteFilePath = _path.default.resolve(process.cwd(), filepath);
|
|
5853
5879
|
const runLoadSync = () => {
|
|
5854
5880
|
const content = (0, _readFile.readFileSync)(absoluteFilePath, {
|
|
5855
5881
|
throwNotFound: true
|
|
5856
5882
|
});
|
|
5857
|
-
const cosmiconfigResult = this.createCosmiconfigResultSync(absoluteFilePath, content);
|
|
5858
|
-
|
|
5859
|
-
return transformResult;
|
|
5883
|
+
const cosmiconfigResult = this.createCosmiconfigResultSync(absoluteFilePath, content, forceProp);
|
|
5884
|
+
return this.config.transform(cosmiconfigResult);
|
|
5860
5885
|
};
|
|
5861
5886
|
if (this.loadCache) {
|
|
5862
5887
|
return (0, _cacheWrapper.cacheWrapperSync)(this.loadCache, absoluteFilePath, runLoadSync);
|
|
@@ -5887,7 +5912,7 @@ var require_dist = __commonJS({
|
|
|
5887
5912
|
});
|
|
5888
5913
|
exports.cosmiconfig = cosmiconfig2;
|
|
5889
5914
|
exports.cosmiconfigSync = cosmiconfigSync;
|
|
5890
|
-
exports.defaultLoaders = void 0;
|
|
5915
|
+
exports.metaSearchPlaces = exports.defaultLoadersSync = exports.defaultLoaders = void 0;
|
|
5891
5916
|
var _os = _interopRequireDefault(__require("os"));
|
|
5892
5917
|
var _Explorer = require_Explorer();
|
|
5893
5918
|
var _ExplorerSync = require_ExplorerSync();
|
|
@@ -5896,8 +5921,66 @@ var require_dist = __commonJS({
|
|
|
5896
5921
|
function _interopRequireDefault(obj) {
|
|
5897
5922
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
5898
5923
|
}
|
|
5924
|
+
var metaSearchPlaces = ["package.json", ".config.json", ".config.yaml", ".config.yml", ".config.js", ".config.cjs", ".config.mjs"];
|
|
5925
|
+
exports.metaSearchPlaces = metaSearchPlaces;
|
|
5926
|
+
var defaultLoaders = Object.freeze({
|
|
5927
|
+
".mjs": _loaders.loaders.loadJs,
|
|
5928
|
+
".cjs": _loaders.loaders.loadJs,
|
|
5929
|
+
".js": _loaders.loaders.loadJs,
|
|
5930
|
+
".json": _loaders.loaders.loadJson,
|
|
5931
|
+
".yaml": _loaders.loaders.loadYaml,
|
|
5932
|
+
".yml": _loaders.loaders.loadYaml,
|
|
5933
|
+
noExt: _loaders.loaders.loadYaml
|
|
5934
|
+
});
|
|
5935
|
+
exports.defaultLoaders = defaultLoaders;
|
|
5936
|
+
var defaultLoadersSync = Object.freeze({
|
|
5937
|
+
".cjs": _loaders.loaders.loadJsSync,
|
|
5938
|
+
".js": _loaders.loaders.loadJsSync,
|
|
5939
|
+
".json": _loaders.loaders.loadJson,
|
|
5940
|
+
".yaml": _loaders.loaders.loadYaml,
|
|
5941
|
+
".yml": _loaders.loaders.loadYaml,
|
|
5942
|
+
noExt: _loaders.loaders.loadYaml
|
|
5943
|
+
});
|
|
5944
|
+
exports.defaultLoadersSync = defaultLoadersSync;
|
|
5945
|
+
var identity = function identity2(x) {
|
|
5946
|
+
return x;
|
|
5947
|
+
};
|
|
5948
|
+
function replaceMetaPlaceholders(paths, moduleName) {
|
|
5949
|
+
return paths.map((path) => path.replace("{name}", moduleName));
|
|
5950
|
+
}
|
|
5951
|
+
function getExplorerOptions(moduleName, options) {
|
|
5952
|
+
var _metaConfig$config;
|
|
5953
|
+
const metaExplorer = new _ExplorerSync.ExplorerSync({
|
|
5954
|
+
packageProp: "cosmiconfig",
|
|
5955
|
+
stopDir: process.cwd(),
|
|
5956
|
+
searchPlaces: metaSearchPlaces,
|
|
5957
|
+
ignoreEmptySearchPlaces: false,
|
|
5958
|
+
usePackagePropInConfigFiles: true,
|
|
5959
|
+
loaders: defaultLoaders,
|
|
5960
|
+
transform: identity,
|
|
5961
|
+
cache: true,
|
|
5962
|
+
metaConfigFilePath: null
|
|
5963
|
+
});
|
|
5964
|
+
const metaConfig = metaExplorer.searchSync();
|
|
5965
|
+
if (!metaConfig) {
|
|
5966
|
+
return options;
|
|
5967
|
+
}
|
|
5968
|
+
if ((_metaConfig$config = metaConfig.config) !== null && _metaConfig$config !== void 0 && _metaConfig$config.loaders) {
|
|
5969
|
+
throw new Error("Can not specify loaders in meta config file");
|
|
5970
|
+
}
|
|
5971
|
+
const overrideOptions = metaConfig.config ?? {};
|
|
5972
|
+
if (overrideOptions.searchPlaces) {
|
|
5973
|
+
overrideOptions.searchPlaces = replaceMetaPlaceholders(overrideOptions.searchPlaces, moduleName);
|
|
5974
|
+
}
|
|
5975
|
+
overrideOptions.metaConfigFilePath = metaConfig.filepath;
|
|
5976
|
+
return {
|
|
5977
|
+
...options,
|
|
5978
|
+
...overrideOptions
|
|
5979
|
+
};
|
|
5980
|
+
}
|
|
5899
5981
|
function cosmiconfig2(moduleName, options = {}) {
|
|
5900
|
-
const
|
|
5982
|
+
const explorerOptions = getExplorerOptions(moduleName, options);
|
|
5983
|
+
const normalizedOptions = normalizeOptions(moduleName, explorerOptions);
|
|
5901
5984
|
const explorer = new _Explorer.Explorer(normalizedOptions);
|
|
5902
5985
|
return {
|
|
5903
5986
|
search: explorer.search.bind(explorer),
|
|
@@ -5908,7 +5991,8 @@ var require_dist = __commonJS({
|
|
|
5908
5991
|
};
|
|
5909
5992
|
}
|
|
5910
5993
|
function cosmiconfigSync(moduleName, options = {}) {
|
|
5911
|
-
const
|
|
5994
|
+
const explorerOptions = getExplorerOptions(moduleName, options);
|
|
5995
|
+
const normalizedOptions = normalizeOptionsSync(moduleName, explorerOptions);
|
|
5912
5996
|
const explorerSync = new _ExplorerSync.ExplorerSync(normalizedOptions);
|
|
5913
5997
|
return {
|
|
5914
5998
|
search: explorerSync.searchSync.bind(explorerSync),
|
|
@@ -5918,19 +6002,28 @@ var require_dist = __commonJS({
|
|
|
5918
6002
|
clearCaches: explorerSync.clearCaches.bind(explorerSync)
|
|
5919
6003
|
};
|
|
5920
6004
|
}
|
|
5921
|
-
var defaultLoaders = Object.freeze({
|
|
5922
|
-
".cjs": _loaders.loaders.loadJs,
|
|
5923
|
-
".js": _loaders.loaders.loadJs,
|
|
5924
|
-
".json": _loaders.loaders.loadJson,
|
|
5925
|
-
".yaml": _loaders.loaders.loadYaml,
|
|
5926
|
-
".yml": _loaders.loaders.loadYaml,
|
|
5927
|
-
noExt: _loaders.loaders.loadYaml
|
|
5928
|
-
});
|
|
5929
|
-
exports.defaultLoaders = defaultLoaders;
|
|
5930
|
-
var identity = function identity2(x) {
|
|
5931
|
-
return x;
|
|
5932
|
-
};
|
|
5933
6005
|
function normalizeOptions(moduleName, options) {
|
|
6006
|
+
const defaults = {
|
|
6007
|
+
packageProp: moduleName,
|
|
6008
|
+
searchPlaces: ["package.json", `.${moduleName}rc`, `.${moduleName}rc.json`, `.${moduleName}rc.yaml`, `.${moduleName}rc.yml`, `.${moduleName}rc.js`, `.${moduleName}rc.cjs`, `.${moduleName}rc.mjs`, `.config/${moduleName}rc`, `.config/${moduleName}rc.json`, `.config/${moduleName}rc.yaml`, `.config/${moduleName}rc.yml`, `.config/${moduleName}rc.js`, `.config/${moduleName}rc.cjs`, `.config/${moduleName}rc.mjs`, `${moduleName}.config.js`, `${moduleName}.config.cjs`, `${moduleName}.config.mjs`].filter(Boolean),
|
|
6009
|
+
ignoreEmptySearchPlaces: true,
|
|
6010
|
+
stopDir: _os.default.homedir(),
|
|
6011
|
+
cache: true,
|
|
6012
|
+
transform: identity,
|
|
6013
|
+
loaders: defaultLoaders,
|
|
6014
|
+
metaConfigFilePath: null
|
|
6015
|
+
};
|
|
6016
|
+
const normalizedOptions = {
|
|
6017
|
+
...defaults,
|
|
6018
|
+
...options,
|
|
6019
|
+
loaders: {
|
|
6020
|
+
...defaults.loaders,
|
|
6021
|
+
...options.loaders
|
|
6022
|
+
}
|
|
6023
|
+
};
|
|
6024
|
+
return normalizedOptions;
|
|
6025
|
+
}
|
|
6026
|
+
function normalizeOptionsSync(moduleName, options) {
|
|
5934
6027
|
const defaults = {
|
|
5935
6028
|
packageProp: moduleName,
|
|
5936
6029
|
searchPlaces: ["package.json", `.${moduleName}rc`, `.${moduleName}rc.json`, `.${moduleName}rc.yaml`, `.${moduleName}rc.yml`, `.${moduleName}rc.js`, `.${moduleName}rc.cjs`, `.config/${moduleName}rc`, `.config/${moduleName}rc.json`, `.config/${moduleName}rc.yaml`, `.config/${moduleName}rc.yml`, `.config/${moduleName}rc.js`, `.config/${moduleName}rc.cjs`, `${moduleName}.config.js`, `${moduleName}.config.cjs`],
|
|
@@ -5938,7 +6031,8 @@ var require_dist = __commonJS({
|
|
|
5938
6031
|
stopDir: _os.default.homedir(),
|
|
5939
6032
|
cache: true,
|
|
5940
6033
|
transform: identity,
|
|
5941
|
-
loaders:
|
|
6034
|
+
loaders: defaultLoadersSync,
|
|
6035
|
+
metaConfigFilePath: null
|
|
5942
6036
|
};
|
|
5943
6037
|
const normalizedOptions = {
|
|
5944
6038
|
...defaults,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prettier",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Prettier is an opinionated code formatter",
|
|
5
5
|
"bin": "./bin/prettier.cjs",
|
|
6
6
|
"repository": "prettier/prettier",
|
|
@@ -143,9 +143,9 @@
|
|
|
143
143
|
"doc.mjs",
|
|
144
144
|
"index.cjs",
|
|
145
145
|
"index.d.ts",
|
|
146
|
+
"index.d.ts",
|
|
146
147
|
"index.mjs",
|
|
147
148
|
"internal/cli.mjs",
|
|
148
|
-
"internal/internal.cjs",
|
|
149
149
|
"internal/internal.mjs",
|
|
150
150
|
"package.json",
|
|
151
151
|
"plugins/acorn.d.ts",
|
|
@@ -190,8 +190,5 @@
|
|
|
190
190
|
"standalone.d.ts",
|
|
191
191
|
"standalone.js",
|
|
192
192
|
"standalone.mjs"
|
|
193
|
-
]
|
|
194
|
-
|
|
195
|
-
"prepublishOnly": "node -e \"assert.equal(require('.').version, require('..').version)\""
|
|
196
|
-
}
|
|
197
|
-
}
|
|
193
|
+
]
|
|
194
|
+
}
|