@unocss/webpack 0.55.1 → 0.55.3
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 +15 -10
- package/dist/index.d.cts +9 -0
- package/dist/index.d.mts +9 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +7 -2
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
const process$1 = require('node:process');
|
|
5
6
|
const unplugin = require('unplugin');
|
|
6
7
|
const WebpackSources = require('webpack-sources');
|
|
7
|
-
const process$1 = require('node:process');
|
|
8
8
|
const pluginutils = require('@rollup/pluginutils');
|
|
9
9
|
const config = require('@unocss/config');
|
|
10
10
|
const core = require('@unocss/core');
|
|
@@ -15,14 +15,14 @@ const MagicString = require('magic-string');
|
|
|
15
15
|
const remapping = require('@ampproject/remapping');
|
|
16
16
|
const node_crypto = require('node:crypto');
|
|
17
17
|
|
|
18
|
-
function
|
|
18
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
19
19
|
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const fs__default = /*#__PURE__*/
|
|
23
|
-
const fg__default = /*#__PURE__*/
|
|
24
|
-
const MagicString__default = /*#__PURE__*/
|
|
25
|
-
const remapping__default = /*#__PURE__*/
|
|
20
|
+
const process__default = /*#__PURE__*/_interopDefaultCompat(process$1);
|
|
21
|
+
const WebpackSources__default = /*#__PURE__*/_interopDefaultCompat(WebpackSources);
|
|
22
|
+
const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
23
|
+
const fg__default = /*#__PURE__*/_interopDefaultCompat(fg);
|
|
24
|
+
const MagicString__default = /*#__PURE__*/_interopDefaultCompat(MagicString);
|
|
25
|
+
const remapping__default = /*#__PURE__*/_interopDefaultCompat(remapping);
|
|
26
26
|
|
|
27
27
|
const INCLUDE_COMMENT = "@unocss-include";
|
|
28
28
|
const IGNORE_COMMENT = "@unocss-ignore";
|
|
@@ -307,7 +307,10 @@ function defineConfig(config) {
|
|
|
307
307
|
}
|
|
308
308
|
function WebpackPlugin(configOrPath, defaults) {
|
|
309
309
|
return unplugin.createUnplugin(() => {
|
|
310
|
-
const ctx = createContext(configOrPath,
|
|
310
|
+
const ctx = createContext(configOrPath, {
|
|
311
|
+
envMode: process__default.env.NODE_ENV === "development" ? "dev" : "build",
|
|
312
|
+
...defaults
|
|
313
|
+
});
|
|
311
314
|
const { uno, tokens, filter, extract, onInvalidate, tasks, flushTasks } = ctx;
|
|
312
315
|
let timer;
|
|
313
316
|
onInvalidate(() => {
|
|
@@ -317,6 +320,7 @@ function WebpackPlugin(configOrPath, defaults) {
|
|
|
317
320
|
const nonPreTransformers = ctx.uno.config.transformers?.filter((i) => i.enforce !== "pre");
|
|
318
321
|
if (nonPreTransformers?.length) {
|
|
319
322
|
console.warn(
|
|
323
|
+
// eslint-disable-next-line prefer-template
|
|
320
324
|
'[unocss] webpack integration only supports "pre" enforce transformers currently.the following transformers will be ignored\n' + nonPreTransformers.map((i) => ` - ${i.name}`).join("\n")
|
|
321
325
|
);
|
|
322
326
|
}
|
|
@@ -356,6 +360,7 @@ function WebpackPlugin(configOrPath, defaults) {
|
|
|
356
360
|
const layer = getLayer(id);
|
|
357
361
|
return !!layer;
|
|
358
362
|
},
|
|
363
|
+
// serve the placeholders in virtual module
|
|
359
364
|
load(id) {
|
|
360
365
|
const layer = getLayer(id);
|
|
361
366
|
const hash = hashes.get(id);
|
|
@@ -424,5 +429,5 @@ function getLayer(id) {
|
|
|
424
429
|
return layer;
|
|
425
430
|
}
|
|
426
431
|
|
|
427
|
-
exports
|
|
432
|
+
exports.default = WebpackPlugin;
|
|
428
433
|
exports.defineConfig = defineConfig;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as webpack from 'webpack';
|
|
2
|
+
import { UserConfig, UserConfigDefaults } from '@unocss/core';
|
|
3
|
+
|
|
4
|
+
interface WebpackPluginOptions<Theme extends object = object> extends UserConfig<Theme> {
|
|
5
|
+
}
|
|
6
|
+
declare function defineConfig<Theme extends object>(config: WebpackPluginOptions<Theme>): WebpackPluginOptions<Theme>;
|
|
7
|
+
declare function WebpackPlugin<Theme extends object>(configOrPath?: WebpackPluginOptions<Theme> | string, defaults?: UserConfigDefaults): webpack.WebpackPluginInstance;
|
|
8
|
+
|
|
9
|
+
export { type WebpackPluginOptions, WebpackPlugin as default, defineConfig };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as webpack from 'webpack';
|
|
2
|
+
import { UserConfig, UserConfigDefaults } from '@unocss/core';
|
|
3
|
+
|
|
4
|
+
interface WebpackPluginOptions<Theme extends object = object> extends UserConfig<Theme> {
|
|
5
|
+
}
|
|
6
|
+
declare function defineConfig<Theme extends object>(config: WebpackPluginOptions<Theme>): WebpackPluginOptions<Theme>;
|
|
7
|
+
declare function WebpackPlugin<Theme extends object>(configOrPath?: WebpackPluginOptions<Theme> | string, defaults?: UserConfigDefaults): webpack.WebpackPluginInstance;
|
|
8
|
+
|
|
9
|
+
export { type WebpackPluginOptions, WebpackPlugin as default, defineConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ interface WebpackPluginOptions<Theme extends object = object> extends UserConfig
|
|
|
6
6
|
declare function defineConfig<Theme extends object>(config: WebpackPluginOptions<Theme>): WebpackPluginOptions<Theme>;
|
|
7
7
|
declare function WebpackPlugin<Theme extends object>(configOrPath?: WebpackPluginOptions<Theme> | string, defaults?: UserConfigDefaults): webpack.WebpackPluginInstance;
|
|
8
8
|
|
|
9
|
-
export { WebpackPluginOptions, WebpackPlugin as default, defineConfig };
|
|
9
|
+
export { type WebpackPluginOptions, WebpackPlugin as default, defineConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import process$1 from 'node:process';
|
|
1
2
|
import { createUnplugin } from 'unplugin';
|
|
2
3
|
import WebpackSources from 'webpack-sources';
|
|
3
|
-
import process$1 from 'node:process';
|
|
4
4
|
import { createFilter } from '@rollup/pluginutils';
|
|
5
5
|
import { loadConfig } from '@unocss/config';
|
|
6
6
|
import { cssIdRE, createGenerator, BetterMap } from '@unocss/core';
|
|
@@ -294,7 +294,10 @@ function defineConfig(config) {
|
|
|
294
294
|
}
|
|
295
295
|
function WebpackPlugin(configOrPath, defaults) {
|
|
296
296
|
return createUnplugin(() => {
|
|
297
|
-
const ctx = createContext(configOrPath,
|
|
297
|
+
const ctx = createContext(configOrPath, {
|
|
298
|
+
envMode: process$1.env.NODE_ENV === "development" ? "dev" : "build",
|
|
299
|
+
...defaults
|
|
300
|
+
});
|
|
298
301
|
const { uno, tokens, filter, extract, onInvalidate, tasks, flushTasks } = ctx;
|
|
299
302
|
let timer;
|
|
300
303
|
onInvalidate(() => {
|
|
@@ -304,6 +307,7 @@ function WebpackPlugin(configOrPath, defaults) {
|
|
|
304
307
|
const nonPreTransformers = ctx.uno.config.transformers?.filter((i) => i.enforce !== "pre");
|
|
305
308
|
if (nonPreTransformers?.length) {
|
|
306
309
|
console.warn(
|
|
310
|
+
// eslint-disable-next-line prefer-template
|
|
307
311
|
'[unocss] webpack integration only supports "pre" enforce transformers currently.the following transformers will be ignored\n' + nonPreTransformers.map((i) => ` - ${i.name}`).join("\n")
|
|
308
312
|
);
|
|
309
313
|
}
|
|
@@ -343,6 +347,7 @@ function WebpackPlugin(configOrPath, defaults) {
|
|
|
343
347
|
const layer = getLayer(id);
|
|
344
348
|
return !!layer;
|
|
345
349
|
},
|
|
350
|
+
// serve the placeholders in virtual module
|
|
346
351
|
load(id) {
|
|
347
352
|
const layer = getLayer(id);
|
|
348
353
|
const hash = hashes.get(id);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/webpack",
|
|
3
|
-
"version": "0.55.
|
|
3
|
+
"version": "0.55.3",
|
|
4
4
|
"description": "The Webpack plugin for UnoCSS",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
"@rollup/pluginutils": "^5.0.3",
|
|
41
41
|
"chokidar": "^3.5.3",
|
|
42
42
|
"fast-glob": "^3.3.1",
|
|
43
|
-
"magic-string": "^0.30.
|
|
43
|
+
"magic-string": "^0.30.3",
|
|
44
44
|
"unplugin": "^1.4.0",
|
|
45
45
|
"webpack-sources": "^3.2.3",
|
|
46
|
-
"@unocss/config": "0.55.
|
|
47
|
-
"@unocss/core": "0.55.
|
|
46
|
+
"@unocss/config": "0.55.3",
|
|
47
|
+
"@unocss/core": "0.55.3"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@types/webpack": "^5.28.
|
|
50
|
+
"@types/webpack": "^5.28.2",
|
|
51
51
|
"@types/webpack-sources": "^3.2.0",
|
|
52
52
|
"webpack": "^5.88.2"
|
|
53
53
|
},
|