load-oxfmt-config 0.11.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 +2 -0
- package/dist/index.mjs +9 -3
- package/package.json +9 -9
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.
|
|
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",
|
|
@@ -51,20 +51,20 @@
|
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@ntnyq/tsconfig": "^3.1.0",
|
|
54
|
-
"@types/node": "^
|
|
54
|
+
"@types/node": "^26.0.0",
|
|
55
55
|
"@types/picomatch": "^4.0.3",
|
|
56
|
-
"@typescript/native-preview": "^7.0.0-dev.
|
|
56
|
+
"@typescript/native-preview": "^7.0.0-dev.20260622.1",
|
|
57
57
|
"bumpp": "^11.1.0",
|
|
58
58
|
"husky": "^9.1.7",
|
|
59
59
|
"nano-staged": "^1.0.2",
|
|
60
|
-
"npm-run-all2": "^9.0.
|
|
61
|
-
"oxfmt": "^0.
|
|
62
|
-
"oxlint": "^1.
|
|
63
|
-
"tsdown": "^0.22.
|
|
64
|
-
"vitest": "^4.1.
|
|
60
|
+
"npm-run-all2": "^9.0.2",
|
|
61
|
+
"oxfmt": "^0.56.0",
|
|
62
|
+
"oxlint": "^1.71.0",
|
|
63
|
+
"tsdown": "^0.22.3",
|
|
64
|
+
"vitest": "^4.1.9"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
|
-
"oxfmt": ">=0.
|
|
67
|
+
"oxfmt": ">=0.56.0"
|
|
68
68
|
},
|
|
69
69
|
"nano-staged": {
|
|
70
70
|
"*.{js,ts,mjs,tsx}": "oxlint --fix",
|