@markuplint/file-resolver 4.9.14 → 4.9.16

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/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.9.16](https://github.com/markuplint/markuplint/compare/@markuplint/file-resolver@4.9.15...@markuplint/file-resolver@4.9.16) (2025-08-24)
7
+
8
+ **Note:** Version bump only for package @markuplint/file-resolver
9
+
10
+
11
+
12
+
13
+
14
+ ## [4.9.15](https://github.com/markuplint/markuplint/compare/@markuplint/file-resolver@4.9.14...@markuplint/file-resolver@4.9.15) (2025-08-13)
15
+
16
+ ### Bug Fixes
17
+
18
+ - ensure that each `clean` command correctly removes build files ([110b78e](https://github.com/markuplint/markuplint/commit/110b78e85379d29a84ca68325127344a87a570b6))
19
+ - **file-resolver:** change error handling in JSON import and update error message test ([4feb736](https://github.com/markuplint/markuplint/commit/4feb736aac43c339f1a9892f001a84b9e85d3276))
20
+ - **file-resolver:** resolve Windows path issue when importing plugins ([33a006a](https://github.com/markuplint/markuplint/commit/33a006abb6f9436f48e6a91640cdc299ba047558))
21
+ - resolve import compatibility issues in cosmiconfig ([d2d6413](https://github.com/markuplint/markuplint/commit/d2d6413353641a4c27580a01269c791d1e3d4df0))
22
+ - revert toReversed usage for Node.js v18 compatibility ([36b0453](https://github.com/markuplint/markuplint/commit/36b0453a7bf850c035e82c6fccc2f9567a5d4674))
23
+
6
24
  ## [4.9.14](https://github.com/markuplint/markuplint/compare/@markuplint/file-resolver@4.9.13...@markuplint/file-resolver@4.9.14) (2025-04-13)
7
25
 
8
26
  **Note:** Version bump only for package @markuplint/file-resolver
@@ -32,9 +32,12 @@ export async function search(filePath, cacheClear) {
32
32
  if (!result || result.isEmpty) {
33
33
  return null;
34
34
  }
35
+ const config = result.config;
35
36
  return {
36
37
  filePath: result.filepath,
37
- config: result.config,
38
+ config: config && typeof config === 'object' && 'default' in config && typeof config.default === 'object'
39
+ ? config.default
40
+ : config,
38
41
  };
39
42
  }
40
43
  export async function load(filePath, cacheClear, referrer) {
@@ -45,9 +48,12 @@ export async function load(filePath, cacheClear, referrer) {
45
48
  if (!result || result.isEmpty) {
46
49
  return new ConfigLoadError('Config file is empty', filePath, referrer);
47
50
  }
51
+ const config = result.config;
48
52
  return {
49
53
  filePath: result.filepath,
50
- config: result.config,
54
+ config: config && typeof config === 'object' && 'default' in config && typeof config.default === 'object'
55
+ ? config.default
56
+ : config,
51
57
  };
52
58
  }
53
59
  function cacheConfigError(fileOrDirPath, referrer) {
@@ -7,16 +7,16 @@ export async function forceImportJsonInModule(modPath) {
7
7
  if (error instanceof Error) {
8
8
  fLog('Error in forceImportJsonInModule: %O', error);
9
9
  if (!('code' in error)) {
10
- throw error;
10
+ return error;
11
11
  }
12
12
  if (error.code !== 'ERR_IMPORT_ASSERTION_TYPE_MISSING' && error.code !== 'ERR_IMPORT_ATTRIBUTE_MISSING') {
13
- throw error;
13
+ return error;
14
14
  }
15
15
  const searchPath = /module\s"([^"]+)"\sneeds/i.exec(error.message);
16
16
  const absPath = searchPath?.[1] ?? null;
17
17
  fLog('Extract path: %s', absPath);
18
18
  if (!absPath) {
19
- throw error;
19
+ return error;
20
20
  }
21
21
  const normalizePath = absPath
22
22
  .replace(/^file:\/\//, '')
@@ -1,6 +1,7 @@
1
1
  import fs from 'node:fs/promises';
2
2
  import { createRequire } from 'node:module';
3
3
  import path from 'node:path';
4
+ import { pathToFileURL } from 'node:url';
4
5
  import { resolve } from 'import-meta-resolve';
5
6
  import { log } from './debug.js';
6
7
  const gLog = log.extend('general-import');
@@ -13,9 +14,16 @@ export async function generalImport(name) {
13
14
  return cache.get(name);
14
15
  }
15
16
  try {
16
- const imported = await import(name);
17
+ // Convert absolute paths to file:// URL format
18
+ let importPath = name;
19
+ if (path.isAbsolute(name)) {
20
+ // Use Node.js pathToFileURL function to convert to a proper URL
21
+ importPath = pathToFileURL(name).href;
22
+ gLog('Converted to file URL: %s', importPath);
23
+ }
24
+ const imported = await import(importPath);
17
25
  const mod = imported?.default ?? imported ?? null;
18
- gLogSuccess('Success by import("%s"): %O', name, mod);
26
+ gLogSuccess('Success by import("%s"): %O', importPath, mod);
19
27
  cache.set(name, mod);
20
28
  return mod;
21
29
  }
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "@markuplint/file-resolver",
3
- "version": "4.9.14",
3
+ "version": "4.9.16",
4
4
  "description": "The file resolver of markuplint",
5
5
  "repository": "git@github.com:markuplint/markuplint.git",
6
6
  "author": "Yusuke Hirao <yusukehirao@me.com>",
7
7
  "license": "MIT",
8
- "private": false,
9
8
  "type": "module",
10
9
  "exports": {
11
10
  ".": {
@@ -25,24 +24,24 @@
25
24
  "clean": "tsc --build --clean"
26
25
  },
27
26
  "devDependencies": {
28
- "@types/node": "22.14.1"
27
+ "@types/node": "24.3.0"
29
28
  },
30
29
  "dependencies": {
31
- "@markuplint/html-parser": "4.6.19",
32
- "@markuplint/ml-ast": "4.4.9",
33
- "@markuplint/ml-config": "4.8.11",
34
- "@markuplint/ml-core": "4.12.4",
35
- "@markuplint/ml-spec": "4.9.6",
36
- "@markuplint/parser-utils": "4.8.7",
37
- "@markuplint/selector": "4.7.4",
38
- "@markuplint/shared": "4.4.11",
30
+ "@markuplint/html-parser": "4.6.21",
31
+ "@markuplint/ml-ast": "4.4.10",
32
+ "@markuplint/ml-config": "4.8.13",
33
+ "@markuplint/ml-core": "4.13.1",
34
+ "@markuplint/ml-spec": "4.10.0",
35
+ "@markuplint/parser-utils": "4.8.9",
36
+ "@markuplint/selector": "4.7.6",
37
+ "@markuplint/shared": "4.4.12",
39
38
  "cosmiconfig": "9.0.0",
40
- "debug": "4.4.0",
41
- "glob": "11.0.1",
42
- "ignore": "7.0.3",
39
+ "debug": "4.4.1",
40
+ "glob": "11.0.3",
41
+ "ignore": "7.0.5",
43
42
  "import-meta-resolve": "4.1.0",
44
43
  "jsonc": "2.0.0",
45
- "minimatch": "10.0.1"
44
+ "minimatch": "10.0.3"
46
45
  },
47
- "gitHead": "eb36d59f7e13d4e59ff3f3c4eabb5ec06c070eb0"
46
+ "gitHead": "ae97eb2d31ecedf4f0800fbbf18588aad4ebca04"
48
47
  }