Skip to content

Commit 547f4ef

Browse files
committed
[New] add subpath-imports-slash category for #/ subpath imports
Added in v25.4. Ref: nodejs/node#60864
1 parent 6cc5123 commit 547f4ef

4 files changed

Lines changed: 11 additions & 5 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ Info about node `exports` field support: version ranges, categories, etc.
2121
- `pattern-trailers-no-dir-slash`: support for directory exports (ending in `./`) was removed for these versions (`17.0`)
2222
- `pattern-trailers-no-dir-slash+json-imports`: `pattern-trailers-no-dir-slash`, and JSON can be `import`ed (`17.1 - 19 || 20 - 20.18 || ^21 || 22 - 22.11`)
2323
- `require-esm`: ESM files can be `require`d (`23 - 23.5 || 22.12 - 22.17 || ^20.19`)
24-
- `strips-types`: these versions also automatically strip types from typescript files, for both `require` and `import` (`>= 23.6 || ^22.18`)
24+
- `strips-types`: these versions also automatically strip types from typescript files, for both `require` and `import` (`23.6 - 25.3 || ^22.18`)
25+
- `subpath-imports-slash`: these versions support `#/` subpath imports patterns in the `imports` field, e.g. `"#/*": "./src/*.js"` (`>= 25.4`)
2526

2627
## Entry points
2728
- `node-exports-info/getCategoriesForRange`: takes a node semver version range; returns an array of categories that overlap it

getConditionsForCategory.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,17 @@ var nodeAddonsCategories = {
8282
'pattern-trailers-no-dir-slash': true,
8383
'pattern-trailers-no-dir-slash+json-imports': true,
8484
'require-esm': true,
85-
'strips-types': true
85+
'strips-types': true,
86+
'subpath-imports-slash': true
8687
};
8788

8889
// categories that support module-sync condition (added in v22.12)
8990
/** @type {{ [k: string]: boolean | null | undefined }} */
9091
var moduleSyncCategories = {
9192
__proto__: null,
9293
'require-esm': true,
93-
'strips-types': true
94+
'strips-types': true,
95+
'subpath-imports-slash': true
9496
};
9597

9698
/** @type {import('./getConditionsForCategory')} */

ranges.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
/** @type {import('./ranges.d.ts')} */
44
module.exports = {
55
__proto__: null,
6-
'>= 23.6 || ^22.18': 'strips-types', // added in 23.6, backported to 22.18
6+
'>= 25.4': 'subpath-imports-slash', // added in 25.4
7+
'23.6 - 25.3 || ^22.18': 'strips-types', // added in 23.6, backported to 22.18
78
'23 - 23.5 || 22.12 - 22.17 || ^20.19': 'require-esm', // added in 23.0, 22.12, 20.19
89
'17.1 - 19 || 20 - 20.18 || ^21 || 22 - 22.11': 'pattern-trailers-no-dir-slash+json-imports',
910
'17.0': 'pattern-trailers-no-dir-slash',

test/versions.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,7 @@ module.exports = [
3636
'v22.999.999',
3737
'v23.0.0',
3838
'v23.5.999',
39-
'v23.6.0'
39+
'v23.6.0',
40+
'v25.3.999',
41+
'v25.4.0'
4042
];

0 commit comments

Comments
 (0)