@unocss/webpack 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
@@ -7,12 +7,12 @@ const WebpackSources = require('webpack-sources');
7
7
  const pluginutils = require('@rollup/pluginutils');
8
8
  const config = require('@unocss/config');
9
9
  const core = require('@unocss/core');
10
- const fs = require('fs/promises');
11
- const path = require('path');
10
+ const fs = require('node:fs/promises');
11
+ const node_path = require('node:path');
12
12
  const fg = require('fast-glob');
13
13
  const MagicString = require('magic-string');
14
14
  const remapping = require('@ampproject/remapping');
15
- const crypto = require('crypto');
15
+ const node_crypto = require('node:crypto');
16
16
 
17
17
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
18
18
 
@@ -195,7 +195,7 @@ async function setupExtraContent(ctx, shouldWatch = false) {
195
195
  });
196
196
  watcher.on("all", (type, file) => {
197
197
  if (type === "add" || type === "change") {
198
- const absolutePath = path.resolve(root, file);
198
+ const absolutePath = node_path.resolve(root, file);
199
199
  tasks.push(extractFile(absolutePath));
200
200
  }
201
201
  });
@@ -205,22 +205,22 @@ async function setupExtraContent(ctx, shouldWatch = false) {
205
205
  }
206
206
 
207
207
  function getHash(input, length = 8) {
208
- return crypto.createHash("sha256").update(input).digest("hex").slice(0, length);
208
+ return node_crypto.createHash("sha256").update(input).digest("hex").slice(0, length);
209
209
  }
210
210
 
211
211
  const VIRTUAL_ENTRY_ALIAS = [
212
212
  /^(?:virtual:)?uno(?::(.+))?\.css(\?.*)?$/
213
213
  ];
214
214
  const LAYER_MARK_ALL = "__ALL__";
215
- const RESOLVED_ID_WITH_QUERY_RE = /[\/\\]__uno(?:(_.*?))?\.css(\?.*)?$/;
216
- const RESOLVED_ID_RE = /[\/\\]__uno(?:(_.*?))?\.css$/;
215
+ const RESOLVED_ID_WITH_QUERY_RE = /\0?[\/\\]__uno(?:(_.*?))?\.css(\?.*)?$/;
216
+ const RESOLVED_ID_RE = /\0?[\/\\]__uno(?:(_.*?))?\.css$/;
217
217
  function resolveId(id) {
218
218
  if (id.match(RESOLVED_ID_WITH_QUERY_RE))
219
219
  return id;
220
220
  for (const alias of VIRTUAL_ENTRY_ALIAS) {
221
221
  const match = id.match(alias);
222
222
  if (match) {
223
- return match[1] ? `/__uno_${match[1]}.css` : "/__uno.css";
223
+ return match[1] ? `\0/__uno_${match[1]}.css` : "\0/__uno.css";
224
224
  }
225
225
  }
226
226
  }
@@ -346,7 +346,7 @@ function WebpackPlugin(configOrPath, defaults) {
346
346
  return;
347
347
  lastTokenSize = tokens.size;
348
348
  Array.from(plugin.__vfsModules).forEach((id) => {
349
- const path = id.slice(plugin.__virtualModulePrefix.length).replace(/\\/g, "/");
349
+ const path = decodeURIComponent(id.slice(plugin.__virtualModulePrefix.length));
350
350
  const layer = resolveLayer(path);
351
351
  if (!layer)
352
352
  return;
package/dist/index.mjs CHANGED
@@ -3,12 +3,12 @@ import WebpackSources from 'webpack-sources';
3
3
  import { createFilter } from '@rollup/pluginutils';
4
4
  import { loadConfig } from '@unocss/config';
5
5
  import { cssIdRE, createGenerator, BetterMap } from '@unocss/core';
6
- import fs from 'fs/promises';
7
- import { resolve } from 'path';
6
+ import fs from 'node:fs/promises';
7
+ import { resolve } from 'node:path';
8
8
  import fg from 'fast-glob';
9
9
  import MagicString from 'magic-string';
10
10
  import remapping from '@ampproject/remapping';
11
- import { createHash } from 'crypto';
11
+ import { createHash } from 'node:crypto';
12
12
 
13
13
  const INCLUDE_COMMENT = "@unocss-include";
14
14
  const IGNORE_COMMENT = "@unocss-ignore";
@@ -200,15 +200,15 @@ const VIRTUAL_ENTRY_ALIAS = [
200
200
  /^(?:virtual:)?uno(?::(.+))?\.css(\?.*)?$/
201
201
  ];
202
202
  const LAYER_MARK_ALL = "__ALL__";
203
- const RESOLVED_ID_WITH_QUERY_RE = /[\/\\]__uno(?:(_.*?))?\.css(\?.*)?$/;
204
- const RESOLVED_ID_RE = /[\/\\]__uno(?:(_.*?))?\.css$/;
203
+ const RESOLVED_ID_WITH_QUERY_RE = /\0?[\/\\]__uno(?:(_.*?))?\.css(\?.*)?$/;
204
+ const RESOLVED_ID_RE = /\0?[\/\\]__uno(?:(_.*?))?\.css$/;
205
205
  function resolveId(id) {
206
206
  if (id.match(RESOLVED_ID_WITH_QUERY_RE))
207
207
  return id;
208
208
  for (const alias of VIRTUAL_ENTRY_ALIAS) {
209
209
  const match = id.match(alias);
210
210
  if (match) {
211
- return match[1] ? `/__uno_${match[1]}.css` : "/__uno.css";
211
+ return match[1] ? `\0/__uno_${match[1]}.css` : "\0/__uno.css";
212
212
  }
213
213
  }
214
214
  }
@@ -334,7 +334,7 @@ function WebpackPlugin(configOrPath, defaults) {
334
334
  return;
335
335
  lastTokenSize = tokens.size;
336
336
  Array.from(plugin.__vfsModules).forEach((id) => {
337
- const path = id.slice(plugin.__virtualModulePrefix.length).replace(/\\/g, "/");
337
+ const path = decodeURIComponent(id.slice(plugin.__virtualModulePrefix.length));
338
338
  const layer = resolveLayer(path);
339
339
  if (!layer)
340
340
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/webpack",
3
- "version": "0.50.3",
3
+ "version": "0.50.5",
4
4
  "description": "The Webpack plugin for UnoCSS",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -38,18 +38,18 @@
38
38
  "dependencies": {
39
39
  "@ampproject/remapping": "^2.2.0",
40
40
  "@rollup/pluginutils": "^5.0.2",
41
- "@unocss/config": "0.50.3",
42
- "@unocss/core": "0.50.3",
43
41
  "chokidar": "^3.5.3",
44
42
  "fast-glob": "^3.2.12",
45
43
  "magic-string": "^0.30.0",
46
- "unplugin": "^1.1.0",
47
- "webpack-sources": "^3.2.3"
44
+ "unplugin": "^1.3.1",
45
+ "webpack-sources": "^3.2.3",
46
+ "@unocss/config": "0.50.5",
47
+ "@unocss/core": "0.50.5"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/webpack": "^5.28.0",
51
51
  "@types/webpack-sources": "^3.2.0",
52
- "webpack": "^5.75.0"
52
+ "webpack": "^5.76.2"
53
53
  },
54
54
  "scripts": {
55
55
  "build": "unbuild",