@unocss/config 0.31.9 → 0.31.10
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/dist/index.cjs +37 -37
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +37 -37
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -10,45 +10,45 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
10
10
|
|
|
11
11
|
const fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
|
12
12
|
|
|
13
|
-
function createConfigLoader(
|
|
13
|
+
function createConfigLoader(_configOrPath, extraConfigSources = []) {
|
|
14
14
|
let inlineConfig = {};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
const resolved = path.resolve(configOrPath);
|
|
27
|
-
let cwd = resolved;
|
|
28
|
-
let isFile = false;
|
|
29
|
-
if (fs__default.existsSync(resolved) && fs__default.statSync(resolved).isFile()) {
|
|
30
|
-
isFile = true;
|
|
31
|
-
cwd = path.dirname(resolved);
|
|
32
|
-
}
|
|
33
|
-
const loader = unconfig.createConfigLoader({
|
|
34
|
-
sources: isFile ? [
|
|
35
|
-
{
|
|
36
|
-
files: resolved,
|
|
37
|
-
extensions: []
|
|
15
|
+
return async (configOrPath = _configOrPath) => {
|
|
16
|
+
if (typeof configOrPath !== "string") {
|
|
17
|
+
inlineConfig = configOrPath;
|
|
18
|
+
if (inlineConfig.configFile === false) {
|
|
19
|
+
return {
|
|
20
|
+
config: inlineConfig,
|
|
21
|
+
sources: []
|
|
22
|
+
};
|
|
23
|
+
} else {
|
|
24
|
+
configOrPath = inlineConfig.configFile || process.cwd();
|
|
38
25
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
26
|
+
}
|
|
27
|
+
const resolved = path.resolve(configOrPath);
|
|
28
|
+
let cwd = resolved;
|
|
29
|
+
let isFile = false;
|
|
30
|
+
if (fs__default.existsSync(resolved) && fs__default.statSync(resolved).isFile()) {
|
|
31
|
+
isFile = true;
|
|
32
|
+
cwd = path.dirname(resolved);
|
|
33
|
+
}
|
|
34
|
+
const loader = unconfig.createConfigLoader({
|
|
35
|
+
sources: isFile ? [
|
|
36
|
+
{
|
|
37
|
+
files: resolved,
|
|
38
|
+
extensions: []
|
|
39
|
+
}
|
|
40
|
+
] : [
|
|
41
|
+
{
|
|
42
|
+
files: [
|
|
43
|
+
"unocss.config",
|
|
44
|
+
"uno.config"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
...extraConfigSources
|
|
48
|
+
],
|
|
49
|
+
cwd,
|
|
50
|
+
defaults: inlineConfig
|
|
51
|
+
});
|
|
52
52
|
const result = await loader.load();
|
|
53
53
|
result.config = result.config || inlineConfig;
|
|
54
54
|
if (result.config.configDeps) {
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { UserConfig } from '@unocss/core';
|
|
|
2
2
|
import { LoadConfigSource, LoadConfigResult } from 'unconfig';
|
|
3
3
|
export { LoadConfigResult, LoadConfigSource } from 'unconfig';
|
|
4
4
|
|
|
5
|
-
declare function createConfigLoader<U extends UserConfig>(
|
|
5
|
+
declare function createConfigLoader<U extends UserConfig>(_configOrPath: string | U, extraConfigSources?: LoadConfigSource[]): (configOrPath?: string | U) => Promise<LoadConfigResult<U>>;
|
|
6
6
|
declare function loadConfig<U extends UserConfig>(dirOrPath: string | U): Promise<LoadConfigResult<U>>;
|
|
7
7
|
|
|
8
8
|
export { createConfigLoader, loadConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -2,45 +2,45 @@ import { resolve, dirname } from 'path';
|
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import { createConfigLoader as createConfigLoader$1 } from 'unconfig';
|
|
4
4
|
|
|
5
|
-
function createConfigLoader(
|
|
5
|
+
function createConfigLoader(_configOrPath, extraConfigSources = []) {
|
|
6
6
|
let inlineConfig = {};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
const resolved = resolve(configOrPath);
|
|
19
|
-
let cwd = resolved;
|
|
20
|
-
let isFile = false;
|
|
21
|
-
if (fs.existsSync(resolved) && fs.statSync(resolved).isFile()) {
|
|
22
|
-
isFile = true;
|
|
23
|
-
cwd = dirname(resolved);
|
|
24
|
-
}
|
|
25
|
-
const loader = createConfigLoader$1({
|
|
26
|
-
sources: isFile ? [
|
|
27
|
-
{
|
|
28
|
-
files: resolved,
|
|
29
|
-
extensions: []
|
|
7
|
+
return async (configOrPath = _configOrPath) => {
|
|
8
|
+
if (typeof configOrPath !== "string") {
|
|
9
|
+
inlineConfig = configOrPath;
|
|
10
|
+
if (inlineConfig.configFile === false) {
|
|
11
|
+
return {
|
|
12
|
+
config: inlineConfig,
|
|
13
|
+
sources: []
|
|
14
|
+
};
|
|
15
|
+
} else {
|
|
16
|
+
configOrPath = inlineConfig.configFile || process.cwd();
|
|
30
17
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
18
|
+
}
|
|
19
|
+
const resolved = resolve(configOrPath);
|
|
20
|
+
let cwd = resolved;
|
|
21
|
+
let isFile = false;
|
|
22
|
+
if (fs.existsSync(resolved) && fs.statSync(resolved).isFile()) {
|
|
23
|
+
isFile = true;
|
|
24
|
+
cwd = dirname(resolved);
|
|
25
|
+
}
|
|
26
|
+
const loader = createConfigLoader$1({
|
|
27
|
+
sources: isFile ? [
|
|
28
|
+
{
|
|
29
|
+
files: resolved,
|
|
30
|
+
extensions: []
|
|
31
|
+
}
|
|
32
|
+
] : [
|
|
33
|
+
{
|
|
34
|
+
files: [
|
|
35
|
+
"unocss.config",
|
|
36
|
+
"uno.config"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
...extraConfigSources
|
|
40
|
+
],
|
|
41
|
+
cwd,
|
|
42
|
+
defaults: inlineConfig
|
|
43
|
+
});
|
|
44
44
|
const result = await loader.load();
|
|
45
45
|
result.config = result.config || inlineConfig;
|
|
46
46
|
if (result.config.configDeps) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/config",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.10",
|
|
4
4
|
"description": "Config loader for UnoCSS",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://github.com/unocss/unocss/tree/main/packages/config#readme",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"node": ">=14"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@unocss/core": "0.31.
|
|
35
|
+
"@unocss/core": "0.31.10",
|
|
36
36
|
"unconfig": "^0.3.3"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|