@unocss/postcss 0.50.3 → 0.50.5

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 CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const promises = require('fs/promises');
3
+ const promises = require('node:fs/promises');
4
+ const node_path = require('node:path');
4
5
  const fg = require('fast-glob');
5
6
  const postcss = require('postcss');
6
7
  const core = require('@unocss/core');
@@ -164,15 +165,15 @@ function unocss(options = {}) {
164
165
  );
165
166
  const {
166
167
  cwd = process.cwd(),
167
- directiveMap = {
168
- apply: "apply",
169
- theme: "theme",
170
- screen: "screen",
171
- unocss: "unocss"
172
- },
173
168
  content,
174
169
  configOrPath
175
170
  } = options;
171
+ const directiveMap = Object.assign({
172
+ apply: "apply",
173
+ theme: "theme",
174
+ screen: "screen",
175
+ unocss: "unocss"
176
+ }, options.directiveMap || {});
176
177
  const fileMap = /* @__PURE__ */ new Map();
177
178
  const fileClassMap = /* @__PURE__ */ new Map();
178
179
  const classes = /* @__PURE__ */ new Set();
@@ -256,7 +257,7 @@ function unocss(options = {}) {
256
257
  result.messages.push({
257
258
  type: "dependency",
258
259
  plugin: directiveMap.unocss,
259
- file,
260
+ file: node_path.normalize(file),
260
261
  parent: result.opts.from
261
262
  });
262
263
  if (fileMap.has(file) && mtimeMs <= fileMap.get(file))
@@ -308,5 +309,6 @@ function unocss(options = {}) {
308
309
  };
309
310
  }
310
311
  unocss.postcss = true;
312
+ unocss.default = unocss;
311
313
 
312
314
  module.exports = unocss;
package/dist/index.d.ts CHANGED
@@ -7,10 +7,10 @@ interface UnoPostcssPluginOptions {
7
7
  extension: string;
8
8
  })[];
9
9
  directiveMap?: {
10
- apply: string;
11
- screen: string;
12
- theme: string;
13
- unocss: string;
10
+ apply?: string;
11
+ screen?: string;
12
+ theme?: string;
13
+ unocss?: string;
14
14
  };
15
15
  cwd?: string;
16
16
  configOrPath?: string | UserConfig;
@@ -21,7 +21,9 @@ declare function unocss(options?: UnoPostcssPluginOptions): {
21
21
  plugins: ((root: Root, result: Result) => Promise<void>)[];
22
22
  };
23
23
  declare namespace unocss {
24
- var postcss: boolean;
24
+ export var postcss: boolean;
25
+ var _a: typeof unocss;
26
+ export { _a as default };
25
27
  }
26
28
 
27
29
  export { UnoPostcssPluginOptions, unocss as default };
package/dist/index.mjs CHANGED
@@ -1,4 +1,5 @@
1
- import { stat, readFile } from 'fs/promises';
1
+ import { stat, readFile } from 'node:fs/promises';
2
+ import { normalize } from 'node:path';
2
3
  import fg from 'fast-glob';
3
4
  import postcss from 'postcss';
4
5
  import { expandVariantGroup, notNull, regexScopePlaceholder, warnOnce, createGenerator } from '@unocss/core';
@@ -156,15 +157,15 @@ function unocss(options = {}) {
156
157
  );
157
158
  const {
158
159
  cwd = process.cwd(),
159
- directiveMap = {
160
- apply: "apply",
161
- theme: "theme",
162
- screen: "screen",
163
- unocss: "unocss"
164
- },
165
160
  content,
166
161
  configOrPath
167
162
  } = options;
163
+ const directiveMap = Object.assign({
164
+ apply: "apply",
165
+ theme: "theme",
166
+ screen: "screen",
167
+ unocss: "unocss"
168
+ }, options.directiveMap || {});
168
169
  const fileMap = /* @__PURE__ */ new Map();
169
170
  const fileClassMap = /* @__PURE__ */ new Map();
170
171
  const classes = /* @__PURE__ */ new Set();
@@ -248,7 +249,7 @@ function unocss(options = {}) {
248
249
  result.messages.push({
249
250
  type: "dependency",
250
251
  plugin: directiveMap.unocss,
251
- file,
252
+ file: normalize(file),
252
253
  parent: result.opts.from
253
254
  });
254
255
  if (fileMap.has(file) && mtimeMs <= fileMap.get(file))
@@ -300,5 +301,6 @@ function unocss(options = {}) {
300
301
  };
301
302
  }
302
303
  unocss.postcss = true;
304
+ unocss.default = unocss;
303
305
 
304
306
  export { unocss as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/postcss",
3
- "version": "0.50.3",
3
+ "version": "0.50.5",
4
4
  "description": "PostCSS plugin for UnoCSS",
5
5
  "author": "sibbng <sibbngheid@gmail.com>",
6
6
  "license": "MIT",
@@ -36,12 +36,12 @@
36
36
  "postcss": "^8.4.21"
37
37
  },
38
38
  "dependencies": {
39
- "@unocss/config": "0.50.3",
40
- "@unocss/core": "0.50.3",
41
39
  "css-tree": "^2.3.1",
42
40
  "fast-glob": "^3.2.12",
43
41
  "magic-string": "^0.30.0",
44
- "postcss": "^8.4.21"
42
+ "postcss": "^8.4.21",
43
+ "@unocss/config": "0.50.5",
44
+ "@unocss/core": "0.50.5"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "unbuild",