@unocss/config 0.58.9 → 0.59.0-beta.1

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/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/config",
3
- "version": "0.58.9",
3
+ "type": "module",
4
+ "version": "0.59.0-beta.1",
4
5
  "description": "Config loader for UnoCSS",
5
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
7
  "license": "MIT",
@@ -18,12 +19,11 @@
18
19
  "sideEffects": false,
19
20
  "exports": {
20
21
  ".": {
21
- "types": "./dist/index.d.ts",
22
- "import": "./dist/index.mjs",
23
- "require": "./dist/index.cjs"
22
+ "types": "./dist/index.d.mts",
23
+ "default": "./dist/index.mjs"
24
24
  }
25
25
  },
26
- "main": "dist/index.cjs",
26
+ "main": "dist/index.mjs",
27
27
  "module": "dist/index.mjs",
28
28
  "types": "dist/index.d.ts",
29
29
  "files": [
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "unconfig": "^0.3.11",
37
- "@unocss/core": "0.58.9"
37
+ "@unocss/core": "0.59.0-beta.1"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "unbuild",
package/dist/index.cjs DELETED
@@ -1,61 +0,0 @@
1
- 'use strict';
2
-
3
- const node_path = require('node:path');
4
- const fs = require('node:fs');
5
- const process = require('node:process');
6
- const unconfig = require('unconfig');
7
-
8
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
9
-
10
- const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
11
- const process__default = /*#__PURE__*/_interopDefaultCompat(process);
12
-
13
- async function loadConfig(cwd = process__default.cwd(), configOrPath = cwd, extraConfigSources = [], defaults = {}) {
14
- let inlineConfig = {};
15
- if (typeof configOrPath !== "string") {
16
- inlineConfig = configOrPath;
17
- if (inlineConfig.configFile === false) {
18
- return {
19
- config: inlineConfig,
20
- sources: []
21
- };
22
- } else {
23
- configOrPath = inlineConfig.configFile || process__default.cwd();
24
- }
25
- }
26
- const resolved = node_path.resolve(configOrPath);
27
- let isFile = false;
28
- if (fs__default.existsSync(resolved) && fs__default.statSync(resolved).isFile()) {
29
- isFile = true;
30
- cwd = node_path.dirname(resolved);
31
- }
32
- const loader = unconfig.createConfigLoader({
33
- sources: isFile ? [
34
- {
35
- files: resolved,
36
- extensions: []
37
- }
38
- ] : [
39
- {
40
- files: [
41
- "unocss.config",
42
- "uno.config"
43
- ]
44
- },
45
- ...extraConfigSources
46
- ],
47
- cwd,
48
- defaults: inlineConfig
49
- });
50
- const result = await loader.load();
51
- result.config = Object.assign(defaults, result.config || inlineConfig);
52
- if (result.config.configDeps) {
53
- result.sources = [
54
- ...result.sources,
55
- ...result.config.configDeps.map((i) => node_path.resolve(cwd, i))
56
- ];
57
- }
58
- return result;
59
- }
60
-
61
- exports.loadConfig = loadConfig;
package/dist/index.d.cts DELETED
@@ -1,7 +0,0 @@
1
- import { UserConfig, UserConfigDefaults } from '@unocss/core';
2
- import { LoadConfigSource, LoadConfigResult } from 'unconfig';
3
- export { LoadConfigResult, LoadConfigSource } from 'unconfig';
4
-
5
- declare function loadConfig<U extends UserConfig>(cwd?: string, configOrPath?: string | U, extraConfigSources?: LoadConfigSource[], defaults?: UserConfigDefaults): Promise<LoadConfigResult<U>>;
6
-
7
- export { loadConfig };