@unocss/webpack 66.6.7 → 66.6.8

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
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_unplugin = require("./unplugin-CUhZqib4.cjs");
5
+ const require_unplugin = require("./unplugin-BgIIUSL0.cjs");
6
6
  //#region src/index.ts
7
7
  function WebpackPlugin(configOrPath, defaults) {
8
8
  return require_unplugin.unplugin(configOrPath, defaults).webpack();
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as unplugin } from "./unplugin-DTW9QSY6.mjs";
1
+ import { t as unplugin } from "./unplugin-CnhSCQ5U.mjs";
2
2
  //#region src/index.ts
3
3
  function WebpackPlugin(configOrPath, defaults) {
4
4
  return unplugin(configOrPath, defaults).webpack();
package/dist/rspack.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_unplugin = require("./unplugin-CUhZqib4.cjs");
2
+ const require_unplugin = require("./unplugin-BgIIUSL0.cjs");
3
3
  //#region src/rspack.ts
4
4
  function UnoCSSRspackPlugin(configOrPath, defaults) {
5
5
  return require_unplugin.unplugin(configOrPath, defaults).rspack();
package/dist/rspack.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as unplugin } from "./unplugin-DTW9QSY6.mjs";
1
+ import { t as unplugin } from "./unplugin-CnhSCQ5U.mjs";
2
2
  //#region src/rspack.ts
3
3
  function UnoCSSRspackPlugin(configOrPath, defaults) {
4
4
  return unplugin(configOrPath, defaults).rspack();
@@ -372,6 +372,25 @@ function unplugin$1(configOrPath, defaults) {
372
372
  if (nonPreTransformers?.length) console.warn("[unocss] webpack integration only supports \"pre\" enforce transformers currently.the following transformers will be ignored\n" + nonPreTransformers.map((i) => ` - ${i.name}`).join("\n"));
373
373
  });
374
374
  compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
375
+ if (compiler.options.cache) compilation.hooks.finishModules.tapPromise(PLUGIN_NAME, async (modules) => {
376
+ const { RESOLVED_ID_RE } = await ctx.getVMPRegexes();
377
+ const promises = [];
378
+ for (const module of modules) {
379
+ const resource = module.resource;
380
+ if (resource && isCssId(resource)) continue;
381
+ if (resource && !RESOLVED_ID_RE.test(resource) && filter("", resource)) promises.push((async () => {
382
+ if (!compiler.inputFileSystem) return;
383
+ const content = await new Promise((resolve, reject) => {
384
+ compiler.inputFileSystem.readFile(resource, (err, data) => {
385
+ if (err) reject(err);
386
+ else resolve(data);
387
+ });
388
+ });
389
+ if (content != null) await ctx.extract(content.toString(), resource);
390
+ })());
391
+ }
392
+ await Promise.all(promises);
393
+ });
375
394
  (compilation.hooks.processAssets || compilation.hooks.optimizeAssets).tapPromise(PLUGIN_NAME, async () => {
376
395
  await ctx.ready;
377
396
  const files = Object.keys(compilation.assets);
@@ -344,6 +344,25 @@ function unplugin(configOrPath, defaults) {
344
344
  if (nonPreTransformers?.length) console.warn("[unocss] webpack integration only supports \"pre\" enforce transformers currently.the following transformers will be ignored\n" + nonPreTransformers.map((i) => ` - ${i.name}`).join("\n"));
345
345
  });
346
346
  compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
347
+ if (compiler.options.cache) compilation.hooks.finishModules.tapPromise(PLUGIN_NAME, async (modules) => {
348
+ const { RESOLVED_ID_RE } = await ctx.getVMPRegexes();
349
+ const promises = [];
350
+ for (const module of modules) {
351
+ const resource = module.resource;
352
+ if (resource && isCssId(resource)) continue;
353
+ if (resource && !RESOLVED_ID_RE.test(resource) && filter("", resource)) promises.push((async () => {
354
+ if (!compiler.inputFileSystem) return;
355
+ const content = await new Promise((resolve, reject) => {
356
+ compiler.inputFileSystem.readFile(resource, (err, data) => {
357
+ if (err) reject(err);
358
+ else resolve(data);
359
+ });
360
+ });
361
+ if (content != null) await ctx.extract(content.toString(), resource);
362
+ })());
363
+ }
364
+ await Promise.all(promises);
365
+ });
347
366
  (compilation.hooks.processAssets || compilation.hooks.optimizeAssets).tapPromise(PLUGIN_NAME, async () => {
348
367
  await ctx.ready;
349
368
  const files = Object.keys(compilation.assets);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/webpack",
3
3
  "type": "module",
4
- "version": "66.6.7",
4
+ "version": "66.6.8",
5
5
  "description": "The Webpack plugin for UnoCSS",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -53,15 +53,15 @@
53
53
  "chokidar": "^5.0.0",
54
54
  "magic-string": "^0.30.21",
55
55
  "pathe": "^2.0.3",
56
- "tinyglobby": "^0.2.15",
57
- "unplugin": "^2.3.11",
56
+ "tinyglobby": "^0.2.16",
57
+ "unplugin": "^3.0.0",
58
58
  "unplugin-utils": "^0.3.1",
59
59
  "webpack-sources": "^3.3.4",
60
- "@unocss/config": "66.6.7",
61
- "@unocss/core": "66.6.7"
60
+ "@unocss/config": "66.6.8",
61
+ "@unocss/core": "66.6.8"
62
62
  },
63
63
  "devDependencies": {
64
- "webpack": "^5.105.2"
64
+ "webpack": "^5.105.4"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "tsdown --config-loader unrun",