@markuplint/file-resolver 5.0.0-alpha.3 → 5.0.0-rc.0

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,16 @@
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
+ # [5.0.0-rc.0](https://github.com/markuplint/markuplint/compare/v5.0.0-alpha.3...v5.0.0-rc.0) (2026-03-12)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **file-resolver:** resolve glob results to absolute paths for Windows compatibility ([79a7844](https://github.com/markuplint/markuplint/commit/79a7844823755d886466297f960c3b21f1feec8f))
11
+
12
+ ### Features
13
+
14
+ - **ml-config,file-resolver:** wire scan field into config pipeline ([76b042a](https://github.com/markuplint/markuplint/commit/76b042a159b4037d3fff4e7c9a5c9be4d6dba44c)), closes [#3335](https://github.com/markuplint/markuplint/issues/3335) [#3336](https://github.com/markuplint/markuplint/issues/3336) [-#3341](https://github.com/-/issues/3341) [#3335](https://github.com/markuplint/markuplint/issues/3335)
15
+
6
16
  # [5.0.0-alpha.3](https://github.com/markuplint/markuplint/compare/v5.0.0-alpha.2...v5.0.0-alpha.3) (2026-02-26)
7
17
 
8
18
  **Note:** Version bump only for package @markuplint/file-resolver
@@ -255,6 +255,12 @@ export class ConfigProvider {
255
255
  ? {
256
256
  ...optimizedConfig.pretenders,
257
257
  files: await relPathToNameOrAbsPath(dir, optimizedConfig.pretenders?.files),
258
+ scan: optimizedConfig.pretenders?.scan?.map(entry => ({
259
+ ...entry,
260
+ files: typeof entry.files === 'string'
261
+ ? path.resolve(dir, entry.files)
262
+ : entry.files.map(f => path.resolve(dir, f)),
263
+ })),
258
264
  }
259
265
  : undefined,
260
266
  overrides: await relPathToNameOrAbsPath(dir, optimizedConfig.overrides, undefined, true),
@@ -1,8 +1,17 @@
1
1
  import type { OptimizedConfig, Pretender } from '@markuplint/ml-config';
2
2
  type PretendersConfig = OptimizedConfig['pretenders'];
3
3
  /**
4
- * Resolves pretender definitions from files, imported modules, and inline data
5
- * in the configuration.
4
+ * Resolves pretender definitions from files, imported modules, inline data,
5
+ * and dynamic component scanning in the configuration.
6
+ *
7
+ * Resolution order:
8
+ * 1. `config.files` — direct import of pretender data files
9
+ * 2. `config.imports` — for each module, tries `<module>/package.json`
10
+ * (reads the `pretenders` field) first, then falls back to
11
+ * `<module>/pretenders.json`
12
+ * 3. `config.data` — inline pretender definitions
13
+ * 4. `config.scan` — dynamic component scanning via glob patterns
14
+ * (`files` accepts `string | string[]`)
6
15
  *
7
16
  * @param config - The pretenders configuration section from the optimized config
8
17
  * @returns An array of all resolved pretender definitions
@@ -1,7 +1,18 @@
1
+ import path from 'node:path';
2
+ import { glob } from 'glob';
1
3
  import { generalImport } from './general-import.js';
2
4
  /**
3
- * Resolves pretender definitions from files, imported modules, and inline data
4
- * in the configuration.
5
+ * Resolves pretender definitions from files, imported modules, inline data,
6
+ * and dynamic component scanning in the configuration.
7
+ *
8
+ * Resolution order:
9
+ * 1. `config.files` — direct import of pretender data files
10
+ * 2. `config.imports` — for each module, tries `<module>/package.json`
11
+ * (reads the `pretenders` field) first, then falls back to
12
+ * `<module>/pretenders.json`
13
+ * 3. `config.data` — inline pretender definitions
14
+ * 4. `config.scan` — dynamic component scanning via glob patterns
15
+ * (`files` accepts `string | string[]`)
5
16
  *
6
17
  * @param config - The pretenders configuration section from the optimized config
7
18
  * @returns An array of all resolved pretender definitions
@@ -35,5 +46,19 @@ export async function resolvePretenders(config) {
35
46
  if (config.data) {
36
47
  data.push(...config.data);
37
48
  }
49
+ if (config.scan) {
50
+ const { scan } = await import('@markuplint/pretenders');
51
+ for (const entry of config.scan) {
52
+ const patterns = typeof entry.files === 'string' ? [entry.files] : [...entry.files];
53
+ const globResults = await Promise.all(patterns.map(p => glob(p)));
54
+ const resolved = globResults.flat().map(f => path.resolve(f));
55
+ if (resolved.length > 0) {
56
+ const scanned = await scan(resolved, {
57
+ ignoreComponentNames: entry.ignoreComponentNames ? [...entry.ignoreComponentNames] : undefined,
58
+ });
59
+ data.push(...scanned);
60
+ }
61
+ }
62
+ }
38
63
  return data;
39
64
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/file-resolver",
3
- "version": "5.0.0-alpha.3",
3
+ "version": "5.0.0-rc.0",
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>",
@@ -30,15 +30,16 @@
30
30
  "@types/node": "24.5.1"
31
31
  },
32
32
  "dependencies": {
33
- "@markuplint/html-parser": "5.0.0-alpha.3",
34
- "@markuplint/ml-ast": "5.0.0-alpha.3",
35
- "@markuplint/ml-config": "5.0.0-alpha.3",
36
- "@markuplint/ml-core": "5.0.0-alpha.3",
37
- "@markuplint/ml-spec": "5.0.0-alpha.3",
38
- "@markuplint/parser-utils": "5.0.0-alpha.3",
39
- "@markuplint/selector": "5.0.0-alpha.3",
40
- "@markuplint/shared": "5.0.0-alpha.3",
41
- "cosmiconfig": "9.0.0",
33
+ "@markuplint/html-parser": "5.0.0-rc.0",
34
+ "@markuplint/ml-ast": "5.0.0-rc.0",
35
+ "@markuplint/ml-config": "5.0.0-rc.0",
36
+ "@markuplint/ml-core": "5.0.0-rc.0",
37
+ "@markuplint/ml-spec": "5.0.0-rc.0",
38
+ "@markuplint/parser-utils": "5.0.0-rc.0",
39
+ "@markuplint/pretenders": "5.0.0-rc.0",
40
+ "@markuplint/selector": "5.0.0-rc.0",
41
+ "@markuplint/shared": "5.0.0-rc.0",
42
+ "cosmiconfig": "9.0.1",
42
43
  "debug": "4.4.3",
43
44
  "glob": "13.0.6",
44
45
  "ignore": "7.0.5",
@@ -46,5 +47,5 @@
46
47
  "jsonc": "2.0.0",
47
48
  "minimatch": "10.2.4"
48
49
  },
49
- "gitHead": "2fbdf26daa3d021ac628ccc2f59f0eeae6ddd53d"
50
+ "gitHead": "ebf4d7cfca0c259aead3b292c6b8a202db4cd802"
50
51
  }