load-oxfmt-config 0.12.0 → 0.12.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/README.md CHANGED
@@ -415,6 +415,8 @@ export default {
415
415
  }
416
416
  ```
417
417
 
418
+ > JavaScript and TypeScript config files are executed while loading config. Only load them from repositories you trust.
419
+
418
420
  When `configPath` is passed explicitly, extensions `.json`, `.jsonc`, `.ts`, `.mts`, `.cts`, `.js`, `.mjs`, and `.cjs` are supported. Extensionless paths are also accepted and parsed as JSON.
419
421
 
420
422
  ## `.editorconfig` Support
package/dist/index.mjs CHANGED
@@ -110,7 +110,10 @@ async function resolveOxfmtrcPath(cwd, configPath) {
110
110
  const configFilePath = join(currentDir, filename);
111
111
  try {
112
112
  if ((await stat(configFilePath)).isFile()) return configFilePath;
113
- } catch {}
113
+ } catch (error) {
114
+ const code = error.code;
115
+ if (code !== "ENOENT" && code !== "ENOTDIR") throw error;
116
+ }
114
117
  }
115
118
  const parentDir = join(currentDir, "..");
116
119
  if (parentDir === currentDir) break;
@@ -247,7 +250,10 @@ async function resolveEditorconfigPath(startDir, onlyCwd = false) {
247
250
  const editorconfigPath = join(currentDir, EDITORCONFIG_FILE);
248
251
  try {
249
252
  if ((await stat(editorconfigPath)).isFile()) return editorconfigPath;
250
- } catch {}
253
+ } catch (error) {
254
+ const code = error.code;
255
+ if (code !== "ENOENT" && code !== "ENOTDIR") throw error;
256
+ }
251
257
  if (onlyCwd) break;
252
258
  const parentDir = join(currentDir, "..");
253
259
  if (parentDir === currentDir) break;
@@ -408,7 +414,7 @@ async function loadOxfmtConfig(options = {}) {
408
414
  const editorconfigCwd = isEditorconfigOptionsObject && editorconfig.cwd ? resolve(editorconfig.cwd) : void 0;
409
415
  const resolveKey = getResolveCacheKey(configLookupCwd, options.configPath);
410
416
  const editorconfigSearchDir = editorconfigCwd || getEditorconfigSearchDir(configLookupCwd, options.configPath);
411
- const editorconfigResolveKey = editorconfigCwd ? getEditorconfigResolveCacheKey(`${editorconfigCwd}::${options.configPath || ""}`) : getEditorconfigResolveCacheKey(resolveKey);
417
+ const editorconfigResolveKey = editorconfigCwd ? getEditorconfigResolveCacheKey(`${editorconfigCwd}::${options.configPath || ""}::onlyCwd=${String(onlyCwd)}`) : getEditorconfigResolveCacheKey(`${resolveKey}::onlyCwd=${String(onlyCwd)}`);
412
418
  const resolvedPath = useCache ? await cachePromise(resolveCache, resolveKey, () => resolveOxfmtrcPath(configLookupCwd, options.configPath)) : await resolveOxfmtrcPath(configLookupCwd, options.configPath);
413
419
  const editorconfigPath = useEditorconfig ? await (useCache ? cachePromise(resolveCache, editorconfigResolveKey, () => resolveEditorconfigPath(editorconfigSearchDir, onlyCwd)) : resolveEditorconfigPath(editorconfigSearchDir, onlyCwd)) : void 0;
414
420
  const anchorDir = dirname(resolvedPath || editorconfigPath || cwd);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "load-oxfmt-config",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "Load and resolve oxfmt configuration files, including explicit JS/TS config paths, and merge supported `.editorconfig` settings for Oxfmt.",
5
5
  "keywords": [
6
6
  "editorconfig",