@unocss/cli 0.64.1 → 0.65.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/dist/cli.mjs CHANGED
@@ -2,7 +2,7 @@ import process from 'node:process';
2
2
  import { loadConfig } from '@unocss/config';
3
3
  import { toArray } from '@unocss/core';
4
4
  import { cac } from 'cac';
5
- import { b as build, v as version, h as handleError } from './shared/cli.Cjm4-Agn.mjs';
5
+ import { b as build, v as version, h as handleError } from './shared/cli.DqV4r6yp.mjs';
6
6
  import 'node:fs';
7
7
  import 'colorette';
8
8
  import 'consola';
package/dist/index.mjs CHANGED
@@ -6,7 +6,7 @@ import 'consola';
6
6
  import 'pathe';
7
7
  import 'perfect-debounce';
8
8
  import 'tinyglobby';
9
- export { b as build, r as resolveOptions } from './shared/cli.Cjm4-Agn.mjs';
9
+ export { b as build, r as resolveOptions } from './shared/cli.DqV4r6yp.mjs';
10
10
  import '@rollup/pluginutils';
11
11
  import '@unocss/config';
12
12
  import '@ampproject/remapping';
@@ -45,7 +45,11 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
45
45
  let root = process$1.cwd();
46
46
  let rawConfig = {};
47
47
  let configFileList = [];
48
- const uno = createGenerator(rawConfig, defaults);
48
+ let uno;
49
+ const _uno = createGenerator(rawConfig, defaults).then((r) => {
50
+ uno = r;
51
+ return r;
52
+ });
49
53
  let rollupFilter = createFilter(
50
54
  defaultPipelineInclude,
51
55
  defaultPipelineExclude,
@@ -60,12 +64,13 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
60
64
  const loadConfig = createRecoveryConfigLoader();
61
65
  let ready = reloadConfig();
62
66
  async function reloadConfig() {
67
+ await _uno;
63
68
  const result = await loadConfig(root, configOrPath, extraConfigSources, defaults);
64
69
  resolveConfigResult(result);
65
70
  deprecationCheck(result.config);
66
71
  rawConfig = result.config;
67
72
  configFileList = result.sources;
68
- uno.setConfig(rawConfig);
73
+ await uno.setConfig(rawConfig);
69
74
  uno.config.envMode = "dev";
70
75
  rollupFilter = rawConfig.content?.pipeline === false ? () => false : createFilter(
71
76
  rawConfig.content?.pipeline?.include || rawConfig.include || defaultPipelineInclude,
@@ -92,10 +97,11 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
92
97
  reloadListeners.forEach((cb) => cb());
93
98
  }
94
99
  async function extract(code, id) {
100
+ const uno2 = await _uno;
95
101
  if (id)
96
102
  modules.set(id, code);
97
103
  const len = tokens.size;
98
- await uno.applyExtractors(code.replace(SKIP_COMMENT_RE, ""), id, tokens);
104
+ await uno2.applyExtractors(code.replace(SKIP_COMMENT_RE, ""), id, tokens);
99
105
  if (tokens.size > len)
100
106
  invalidate();
101
107
  }
@@ -132,7 +138,11 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
132
138
  onReload(fn) {
133
139
  reloadListeners.push(fn);
134
140
  },
135
- uno,
141
+ get uno() {
142
+ if (!uno)
143
+ throw new Error("Run `await context.ready` before accessing `context.uno`");
144
+ return uno;
145
+ },
136
146
  extract,
137
147
  getConfig,
138
148
  get root() {
@@ -205,7 +215,7 @@ async function applyTransformers(ctx, original, id, enforce = "default") {
205
215
  }
206
216
  }
207
217
 
208
- const version = "0.64.1";
218
+ const version = "0.65.0-beta.1";
209
219
 
210
220
  const defaultConfig = {
211
221
  envMode: "build",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/cli",
3
3
  "type": "module",
4
- "version": "0.64.1",
4
+ "version": "0.65.0-beta.1",
5
5
  "description": "CLI for UnoCSS",
6
6
  "author": {
7
7
  "name": "Johann Schopplich",
@@ -50,9 +50,9 @@
50
50
  "pathe": "^1.1.2",
51
51
  "perfect-debounce": "^1.0.0",
52
52
  "tinyglobby": "^0.2.10",
53
- "@unocss/config": "0.64.1",
54
- "@unocss/core": "0.64.1",
55
- "@unocss/preset-uno": "0.64.1"
53
+ "@unocss/config": "0.65.0-beta.1",
54
+ "@unocss/preset-uno": "0.65.0-beta.1",
55
+ "@unocss/core": "0.65.0-beta.1"
56
56
  },
57
57
  "scripts": {
58
58
  "build": "unbuild",