@unocss/webpack 66.6.7 → 66.7.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/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/rspack.cjs +1 -1
- package/dist/rspack.d.mts +1 -1
- package/dist/rspack.mjs +1 -1
- package/dist/{unplugin-DTW9QSY6.mjs → unplugin-BfiNmoS_.mjs} +34 -10
- package/dist/{unplugin-CUhZqib4.cjs → unplugin-CarAr1-8.cjs} +40 -16
- package/package.json +8 -8
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-
|
|
5
|
+
const require_unplugin = require("./unplugin-CarAr1-8.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
package/dist/rspack.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_unplugin = require("./unplugin-
|
|
2
|
+
const require_unplugin = require("./unplugin-CarAr1-8.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.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WebpackPluginOptions } from "./index.mjs";
|
|
2
|
-
import { UserConfigDefaults } from "@unocss/core";
|
|
3
2
|
import { RspackPluginInstance } from "unplugin";
|
|
3
|
+
import { UserConfigDefaults } from "@unocss/core";
|
|
4
4
|
|
|
5
5
|
//#region src/rspack.d.ts
|
|
6
6
|
declare function UnoCSSRspackPlugin<Theme extends object>(configOrPath?: WebpackPluginOptions<Theme> | string, defaults?: UserConfigDefaults): RspackPluginInstance;
|
package/dist/rspack.mjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { isAbsolute, normalize, resolve } from "node:path";
|
|
2
2
|
import process from "node:process";
|
|
3
|
+
import { createUnplugin } from "unplugin";
|
|
4
|
+
import WebpackSources from "webpack-sources";
|
|
3
5
|
import fs from "node:fs/promises";
|
|
4
6
|
import { glob } from "tinyglobby";
|
|
5
7
|
import remapping from "@jridgewell/remapping";
|
|
@@ -9,8 +11,6 @@ import { createRecoveryConfigLoader } from "@unocss/config";
|
|
|
9
11
|
import { createFilter } from "unplugin-utils";
|
|
10
12
|
import crypto from "node:crypto";
|
|
11
13
|
import { resolve as resolve$1 } from "pathe";
|
|
12
|
-
import { createUnplugin } from "unplugin";
|
|
13
|
-
import WebpackSources from "webpack-sources";
|
|
14
14
|
const SKIP_START_COMMENT = "@unocss-skip-start";
|
|
15
15
|
const SKIP_END_COMMENT = "@unocss-skip-end";
|
|
16
16
|
const SKIP_COMMENT_RE = new RegExp(`(\/\/\\s*?${SKIP_START_COMMENT}\\s*?|\\/\\*\\s*?${SKIP_START_COMMENT}\\s*?\\*\\/|<!--\\s*?${SKIP_START_COMMENT}\\s*?-->)[\\s\\S]*?(\/\/\\s*?${SKIP_END_COMMENT}\\s*?|\\/\\*\\s*?${SKIP_END_COMMENT}\\s*?\\*\\/|<!--\\s*?${SKIP_END_COMMENT}\\s*?-->)`, "g");
|
|
@@ -308,17 +308,23 @@ function unplugin(configOrPath, defaults) {
|
|
|
308
308
|
tasks.push(setupContentExtractor(ctx, typeof configOrPath === "object" && configOrPath?.watch));
|
|
309
309
|
const entries = /* @__PURE__ */ new Set();
|
|
310
310
|
const hashes = /* @__PURE__ */ new Map();
|
|
311
|
+
let RESOLVED_ID_RE;
|
|
311
312
|
const plugin = {
|
|
312
313
|
name: "unocss:webpack",
|
|
313
314
|
enforce: "pre",
|
|
314
|
-
async
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
315
|
+
async buildStart() {
|
|
316
|
+
({RESOLVED_ID_RE} = await ctx.getVMPRegexes());
|
|
317
|
+
},
|
|
318
|
+
transform: {
|
|
319
|
+
filter: { id: { exclude: /\.html$/ } },
|
|
320
|
+
async handler(code, id) {
|
|
321
|
+
if (!filter("", id)) return;
|
|
322
|
+
const result = await applyTransformers(ctx, code, id, "pre");
|
|
323
|
+
if (isCssId(id)) return result;
|
|
324
|
+
if (result == null) tasks.push(extract(code, id));
|
|
325
|
+
else tasks.push(extract(result.code, id));
|
|
326
|
+
return result;
|
|
327
|
+
}
|
|
322
328
|
},
|
|
323
329
|
async resolveId(id) {
|
|
324
330
|
const entry = await resolveId(ctx, id);
|
|
@@ -344,6 +350,24 @@ function unplugin(configOrPath, defaults) {
|
|
|
344
350
|
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
351
|
});
|
|
346
352
|
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
353
|
+
if (compiler.options.cache) compilation.hooks.finishModules.tapPromise(PLUGIN_NAME, async (modules) => {
|
|
354
|
+
const promises = [];
|
|
355
|
+
for (const module of modules) {
|
|
356
|
+
const resource = module.resource;
|
|
357
|
+
if (resource && isCssId(resource)) continue;
|
|
358
|
+
if (resource && !RESOLVED_ID_RE.test(resource) && filter("", resource)) promises.push((async () => {
|
|
359
|
+
if (!compiler.inputFileSystem) return;
|
|
360
|
+
const content = await new Promise((resolve, reject) => {
|
|
361
|
+
compiler.inputFileSystem.readFile(resource, (err, data) => {
|
|
362
|
+
if (err) reject(err);
|
|
363
|
+
else resolve(data);
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
if (content != null) await ctx.extract(content.toString(), resource);
|
|
367
|
+
})());
|
|
368
|
+
}
|
|
369
|
+
await Promise.all(promises);
|
|
370
|
+
});
|
|
347
371
|
(compilation.hooks.processAssets || compilation.hooks.optimizeAssets).tapPromise(PLUGIN_NAME, async () => {
|
|
348
372
|
await ctx.ready;
|
|
349
373
|
const files = Object.keys(compilation.assets);
|
|
@@ -22,23 +22,23 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
//#endregion
|
|
23
23
|
let node_path = require("node:path");
|
|
24
24
|
let node_process = require("node:process");
|
|
25
|
-
node_process = __toESM(node_process);
|
|
25
|
+
node_process = __toESM(node_process, 1);
|
|
26
|
+
let unplugin = require("unplugin");
|
|
27
|
+
let webpack_sources = require("webpack-sources");
|
|
28
|
+
webpack_sources = __toESM(webpack_sources, 1);
|
|
26
29
|
let node_fs_promises = require("node:fs/promises");
|
|
27
|
-
node_fs_promises = __toESM(node_fs_promises);
|
|
30
|
+
node_fs_promises = __toESM(node_fs_promises, 1);
|
|
28
31
|
let tinyglobby = require("tinyglobby");
|
|
29
32
|
let _jridgewell_remapping = require("@jridgewell/remapping");
|
|
30
|
-
_jridgewell_remapping = __toESM(_jridgewell_remapping);
|
|
33
|
+
_jridgewell_remapping = __toESM(_jridgewell_remapping, 1);
|
|
31
34
|
let magic_string = require("magic-string");
|
|
32
|
-
magic_string = __toESM(magic_string);
|
|
35
|
+
magic_string = __toESM(magic_string, 1);
|
|
33
36
|
let _unocss_core = require("@unocss/core");
|
|
34
37
|
let _unocss_config = require("@unocss/config");
|
|
35
38
|
let unplugin_utils = require("unplugin-utils");
|
|
36
39
|
let node_crypto = require("node:crypto");
|
|
37
|
-
node_crypto = __toESM(node_crypto);
|
|
40
|
+
node_crypto = __toESM(node_crypto, 1);
|
|
38
41
|
let pathe = require("pathe");
|
|
39
|
-
let unplugin = require("unplugin");
|
|
40
|
-
let webpack_sources = require("webpack-sources");
|
|
41
|
-
webpack_sources = __toESM(webpack_sources);
|
|
42
42
|
const SKIP_START_COMMENT = "@unocss-skip-start";
|
|
43
43
|
const SKIP_END_COMMENT = "@unocss-skip-end";
|
|
44
44
|
const SKIP_COMMENT_RE = new RegExp(`(\/\/\\s*?${SKIP_START_COMMENT}\\s*?|\\/\\*\\s*?${SKIP_START_COMMENT}\\s*?\\*\\/|<!--\\s*?${SKIP_START_COMMENT}\\s*?-->)[\\s\\S]*?(\/\/\\s*?${SKIP_END_COMMENT}\\s*?|\\/\\*\\s*?${SKIP_END_COMMENT}\\s*?\\*\\/|<!--\\s*?${SKIP_END_COMMENT}\\s*?-->)`, "g");
|
|
@@ -336,17 +336,23 @@ function unplugin$1(configOrPath, defaults) {
|
|
|
336
336
|
tasks.push(setupContentExtractor(ctx, typeof configOrPath === "object" && configOrPath?.watch));
|
|
337
337
|
const entries = /* @__PURE__ */ new Set();
|
|
338
338
|
const hashes = /* @__PURE__ */ new Map();
|
|
339
|
+
let RESOLVED_ID_RE;
|
|
339
340
|
const plugin = {
|
|
340
341
|
name: "unocss:webpack",
|
|
341
342
|
enforce: "pre",
|
|
342
|
-
async
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
343
|
+
async buildStart() {
|
|
344
|
+
({RESOLVED_ID_RE} = await ctx.getVMPRegexes());
|
|
345
|
+
},
|
|
346
|
+
transform: {
|
|
347
|
+
filter: { id: { exclude: /\.html$/ } },
|
|
348
|
+
async handler(code, id) {
|
|
349
|
+
if (!filter("", id)) return;
|
|
350
|
+
const result = await applyTransformers(ctx, code, id, "pre");
|
|
351
|
+
if (isCssId(id)) return result;
|
|
352
|
+
if (result == null) tasks.push(extract(code, id));
|
|
353
|
+
else tasks.push(extract(result.code, id));
|
|
354
|
+
return result;
|
|
355
|
+
}
|
|
350
356
|
},
|
|
351
357
|
async resolveId(id) {
|
|
352
358
|
const entry = await resolveId(ctx, id);
|
|
@@ -372,6 +378,24 @@ function unplugin$1(configOrPath, defaults) {
|
|
|
372
378
|
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
379
|
});
|
|
374
380
|
compiler.hooks.compilation.tap(PLUGIN_NAME, (compilation) => {
|
|
381
|
+
if (compiler.options.cache) compilation.hooks.finishModules.tapPromise(PLUGIN_NAME, async (modules) => {
|
|
382
|
+
const promises = [];
|
|
383
|
+
for (const module of modules) {
|
|
384
|
+
const resource = module.resource;
|
|
385
|
+
if (resource && isCssId(resource)) continue;
|
|
386
|
+
if (resource && !RESOLVED_ID_RE.test(resource) && filter("", resource)) promises.push((async () => {
|
|
387
|
+
if (!compiler.inputFileSystem) return;
|
|
388
|
+
const content = await new Promise((resolve, reject) => {
|
|
389
|
+
compiler.inputFileSystem.readFile(resource, (err, data) => {
|
|
390
|
+
if (err) reject(err);
|
|
391
|
+
else resolve(data);
|
|
392
|
+
});
|
|
393
|
+
});
|
|
394
|
+
if (content != null) await ctx.extract(content.toString(), resource);
|
|
395
|
+
})());
|
|
396
|
+
}
|
|
397
|
+
await Promise.all(promises);
|
|
398
|
+
});
|
|
375
399
|
(compilation.hooks.processAssets || compilation.hooks.optimizeAssets).tapPromise(PLUGIN_NAME, async () => {
|
|
376
400
|
await ctx.ready;
|
|
377
401
|
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.
|
|
4
|
+
"version": "66.7.0-beta.1",
|
|
5
5
|
"description": "The Webpack plugin for UnoCSS",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -46,22 +46,22 @@
|
|
|
46
46
|
"dist"
|
|
47
47
|
],
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"webpack": "^
|
|
49
|
+
"webpack": "^5"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@jridgewell/remapping": "^2.3.5",
|
|
53
53
|
"chokidar": "^5.0.0",
|
|
54
54
|
"magic-string": "^0.30.21",
|
|
55
55
|
"pathe": "^2.0.3",
|
|
56
|
-
"tinyglobby": "^0.2.
|
|
57
|
-
"unplugin": "^
|
|
56
|
+
"tinyglobby": "^0.2.16",
|
|
57
|
+
"unplugin": "^3.0.0",
|
|
58
58
|
"unplugin-utils": "^0.3.1",
|
|
59
|
-
"webpack-sources": "^3.
|
|
60
|
-
"@unocss/config": "66.
|
|
61
|
-
"@unocss/core": "66.
|
|
59
|
+
"webpack-sources": "^3.4.1",
|
|
60
|
+
"@unocss/config": "66.7.0-beta.1",
|
|
61
|
+
"@unocss/core": "66.7.0-beta.1"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"webpack": "^5.
|
|
64
|
+
"webpack": "^5.106.2"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"build": "tsdown --config-loader unrun",
|