@docusaurus/plugin-css-cascade-layers 3.8.0 → 3.8.1-canary-6343
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/lib/options.js +5 -1
- package/package.json +6 -5
- package/src/options.ts +5 -1
package/lib/options.js
CHANGED
|
@@ -9,11 +9,15 @@ exports.validateOptions = validateOptions;
|
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
10
|
*/
|
|
11
11
|
const utils_validation_1 = require("@docusaurus/utils-validation");
|
|
12
|
+
const utils_1 = require("@docusaurus/utils");
|
|
12
13
|
const layers_1 = require("./layers");
|
|
13
14
|
// Not ideal to compute layers using "filePath.includes()"
|
|
14
15
|
// But this is mostly temporary until we add first-class layers everywhere
|
|
15
16
|
function layerFor(...params) {
|
|
16
|
-
return (filePath) =>
|
|
17
|
+
return (filePath) => {
|
|
18
|
+
const posixFilePath = (0, utils_1.posixPath)(filePath);
|
|
19
|
+
return params.some((p) => posixFilePath.includes(p));
|
|
20
|
+
};
|
|
17
21
|
}
|
|
18
22
|
// Object order matters, it defines the layer order
|
|
19
23
|
exports.DEFAULT_LAYERS = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-css-cascade-layers",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.1-canary-6343",
|
|
4
4
|
"description": "CSS Cascade Layer plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -18,13 +18,14 @@
|
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@docusaurus/core": "3.8.
|
|
22
|
-
"@docusaurus/types": "3.8.
|
|
23
|
-
"@docusaurus/utils
|
|
21
|
+
"@docusaurus/core": "3.8.1-canary-6343",
|
|
22
|
+
"@docusaurus/types": "3.8.1-canary-6343",
|
|
23
|
+
"@docusaurus/utils": "3.8.1-canary-6343",
|
|
24
|
+
"@docusaurus/utils-validation": "3.8.1-canary-6343",
|
|
24
25
|
"tslib": "^2.6.0"
|
|
25
26
|
},
|
|
26
27
|
"engines": {
|
|
27
28
|
"node": ">=18.0"
|
|
28
29
|
},
|
|
29
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "05002e682b155d8d0d809c1c2feea283b998b013"
|
|
30
31
|
}
|
package/src/options.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import {Joi} from '@docusaurus/utils-validation';
|
|
8
|
+
import {posixPath} from '@docusaurus/utils';
|
|
8
9
|
import {isValidLayerName} from './layers';
|
|
9
10
|
import type {OptionValidationContext} from '@docusaurus/types';
|
|
10
11
|
|
|
@@ -20,7 +21,10 @@ export type Options = {
|
|
|
20
21
|
// Not ideal to compute layers using "filePath.includes()"
|
|
21
22
|
// But this is mostly temporary until we add first-class layers everywhere
|
|
22
23
|
function layerFor(...params: string[]) {
|
|
23
|
-
return (filePath: string) =>
|
|
24
|
+
return (filePath: string) => {
|
|
25
|
+
const posixFilePath = posixPath(filePath);
|
|
26
|
+
return params.some((p) => posixFilePath.includes(p));
|
|
27
|
+
};
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
// Object order matters, it defines the layer order
|