@unocss/cli 0.60.3 → 0.61.0

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 { cac } from 'cac';
3
3
  import { loadConfig } from '@unocss/config';
4
4
  import { toArray } from '@unocss/core';
5
- import { b as build, v as version, h as handleError } from './shared/cli.BaBiPj_j.mjs';
5
+ import { b as build, v as version, h as handleError } from './shared/cli.Bv0vZZqq.mjs';
6
6
  import 'node:fs';
7
7
  import 'pathe';
8
8
  import 'fast-glob';
@@ -12,7 +12,6 @@ import 'perfect-debounce';
12
12
  import '@rollup/pluginutils';
13
13
  import 'magic-string';
14
14
  import '@ampproject/remapping';
15
- import 'node:crypto';
16
15
  import '@unocss/preset-uno';
17
16
 
18
17
  async function startCli(cwd = process.cwd(), argv = process.argv, options = {}) {
package/dist/index.mjs CHANGED
@@ -6,10 +6,9 @@ import 'consola';
6
6
  import 'colorette';
7
7
  import 'perfect-debounce';
8
8
  import '@unocss/core';
9
- export { b as build, r as resolveOptions } from './shared/cli.BaBiPj_j.mjs';
9
+ export { b as build, r as resolveOptions } from './shared/cli.Bv0vZZqq.mjs';
10
10
  import '@rollup/pluginutils';
11
11
  import '@unocss/config';
12
12
  import 'magic-string';
13
13
  import '@ampproject/remapping';
14
- import 'node:crypto';
15
14
  import '@unocss/preset-uno';
@@ -10,7 +10,6 @@ import { createFilter } from '@rollup/pluginutils';
10
10
  import { loadConfig } from '@unocss/config';
11
11
  import MagicString from 'magic-string';
12
12
  import remapping from '@ampproject/remapping';
13
- import 'node:crypto';
14
13
  import presetUno from '@unocss/preset-uno';
15
14
 
16
15
  const INCLUDE_COMMENT = "@unocss-include";
@@ -161,6 +160,22 @@ function hash(str) {
161
160
  }
162
161
  return `00000${(hval >>> 0).toString(36)}`.slice(-6);
163
162
  }
163
+ function transformSkipCode(code, map, SKIP_RULES_RE, keyFlag) {
164
+ for (const item of Array.from(code.matchAll(SKIP_RULES_RE))) {
165
+ if (item != null) {
166
+ const matched = item[0];
167
+ const withHashKey = `${keyFlag}${hash(matched)}`;
168
+ map.set(withHashKey, matched);
169
+ code = code.replace(matched, withHashKey);
170
+ }
171
+ }
172
+ return code;
173
+ }
174
+ function restoreSkipCode(code, map) {
175
+ for (const [withHashKey, matched] of map.entries())
176
+ code = code.replaceAll(withHashKey, matched);
177
+ return code;
178
+ }
164
179
 
165
180
  async function applyTransformers(ctx, original, id, enforce = "default") {
166
181
  if (original.includes(IGNORE_COMMENT))
@@ -170,7 +185,7 @@ async function applyTransformers(ctx, original, id, enforce = "default") {
170
185
  return;
171
186
  const skipMap = /* @__PURE__ */ new Map();
172
187
  let code = original;
173
- let s = new MagicString(transformSkipCode(code, skipMap));
188
+ let s = new MagicString(transformSkipCode(code, skipMap, SKIP_COMMENT_RE, "@unocss-skip-placeholder-"));
174
189
  const maps = [];
175
190
  for (const t of transformers) {
176
191
  if (t.idFilter) {
@@ -196,24 +211,8 @@ async function applyTransformers(ctx, original, id, enforce = "default") {
196
211
  };
197
212
  }
198
213
  }
199
- function transformSkipCode(code, map) {
200
- for (const item of Array.from(code.matchAll(SKIP_COMMENT_RE))) {
201
- if (item != null) {
202
- const matched = item[0];
203
- const withHashKey = `@unocss-skip-placeholder-${hash(matched)}`;
204
- map.set(withHashKey, matched);
205
- code = code.replace(matched, withHashKey);
206
- }
207
- }
208
- return code;
209
- }
210
- function restoreSkipCode(code, map) {
211
- for (const [withHashKey, matched] of map.entries())
212
- code = code.replace(withHashKey, matched);
213
- return code;
214
- }
215
214
 
216
- const version = "0.60.3";
215
+ const version = "0.61.0";
217
216
 
218
217
  const defaultConfig = {
219
218
  envMode: "build",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/cli",
3
3
  "type": "module",
4
- "version": "0.60.3",
4
+ "version": "0.61.0",
5
5
  "description": "CLI for UnoCSS",
6
6
  "author": {
7
7
  "name": "Johann Schopplich",
@@ -50,9 +50,9 @@
50
50
  "magic-string": "^0.30.10",
51
51
  "pathe": "^1.1.2",
52
52
  "perfect-debounce": "^1.0.0",
53
- "@unocss/config": "0.60.3",
54
- "@unocss/core": "0.60.3",
55
- "@unocss/preset-uno": "0.60.3"
53
+ "@unocss/config": "0.61.0",
54
+ "@unocss/core": "0.61.0",
55
+ "@unocss/preset-uno": "0.61.0"
56
56
  },
57
57
  "scripts": {
58
58
  "build": "unbuild",