@esmate/prettier 1.0.5 → 1.0.6
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/dist/index.js +9 -2
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +7 -1
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_globby__ from "globby";
|
|
1
3
|
import * as __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__ from "./utils.js";
|
|
2
4
|
function defineConfig(options, config) {
|
|
3
5
|
const defaultConfig = {
|
|
@@ -16,10 +18,15 @@ function defineConfig(options, config) {
|
|
|
16
18
|
const plugins = config?.plugins || [];
|
|
17
19
|
const overrides = config?.overrides || [];
|
|
18
20
|
{
|
|
21
|
+
const rootDir = (0, __WEBPACK_EXTERNAL_MODULE__utils_js_d88b7fe1__.findRootDir)();
|
|
19
22
|
const ignores = [
|
|
20
|
-
"pnpm-lock.yaml"
|
|
23
|
+
"pnpm-lock.yaml",
|
|
24
|
+
"package-lock.json"
|
|
21
25
|
];
|
|
22
|
-
if (options?.ignores)
|
|
26
|
+
if (options?.ignores) for (const pattern of options.ignores){
|
|
27
|
+
const files = (0, __WEBPACK_EXTERNAL_MODULE_globby__.globbySync)(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(rootDir, pattern)).map((file)=>file.replace(rootDir + __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].sep, ""));
|
|
28
|
+
ignores.push(...files);
|
|
29
|
+
}
|
|
23
30
|
overrides.push({
|
|
24
31
|
files: ignores,
|
|
25
32
|
options: {
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
2
2
|
import * as __WEBPACK_EXTERNAL_MODULE_make_synchronized_25569d3e__ from "make-synchronized";
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE_prettier__ from "prettier";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_find_up_69e9ea2b__ from "find-up";
|
|
4
5
|
const utils = (0, __WEBPACK_EXTERNAL_MODULE_make_synchronized_25569d3e__["default"])(import.meta, async (defaultConfig = {})=>{
|
|
5
6
|
const configFile = await (0, __WEBPACK_EXTERNAL_MODULE_prettier__.resolveConfigFile)();
|
|
6
7
|
if (configFile) {
|
|
@@ -16,4 +17,9 @@ function importPlugin(plugin) {
|
|
|
16
17
|
const __dirname = new URL(".", import.meta.url).pathname;
|
|
17
18
|
return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].join(__dirname, "plugins", `${plugin}.js`);
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
+
function findRootDir() {
|
|
21
|
+
const pkgPath = (0, __WEBPACK_EXTERNAL_MODULE_find_up_69e9ea2b__.findUpSync)("package.json");
|
|
22
|
+
if (pkgPath) return __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__["default"].parse(pkgPath).dir;
|
|
23
|
+
throw new Error("Could not find root directory where package.json is located");
|
|
24
|
+
}
|
|
25
|
+
export { utils as default, findRootDir, importPlugin };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esmate/prettier",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.6",
|
|
5
5
|
"description": "Prettier configuration for humans.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -29,6 +29,8 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
+
"find-up": "^7.0.0",
|
|
33
|
+
"globby": "^14.1.0",
|
|
32
34
|
"make-synchronized": "^0.7.2",
|
|
33
35
|
"prettier-plugin-astro": "^0.14.1",
|
|
34
36
|
"prettier-plugin-svelte": "^3.4.0",
|