@unocss/webpack 0.32.7 → 0.32.11
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/LICENSE +1 -1
- package/README.md +4 -0
- package/dist/index.cjs +9 -6
- package/dist/index.mjs +10 -7
- package/package.json +4 -5
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2021 Anthony Fu <https://github.com/antfu>
|
|
3
|
+
Copyright (c) 2021-PRESENT Anthony Fu <https://github.com/antfu>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -7,17 +7,13 @@ const WebpackSources = require('webpack-sources');
|
|
|
7
7
|
const core = require('@unocss/core');
|
|
8
8
|
const pluginutils = require('@rollup/pluginutils');
|
|
9
9
|
const config = require('@unocss/config');
|
|
10
|
+
require('crypto');
|
|
10
11
|
|
|
11
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
|
|
12
13
|
|
|
13
14
|
const WebpackSources__default = /*#__PURE__*/_interopDefaultLegacy(WebpackSources);
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
return id.replace(/\?.*$/, "");
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const regexCssId = /\.(css|postcss|sass|scss|less|stylus|styl)$/;
|
|
20
|
-
const defaultExclude = [regexCssId];
|
|
16
|
+
const defaultExclude = [core.cssIdRE];
|
|
21
17
|
const defaultInclude = [/\.vue$/, /\.vue\?vue/, /\.svelte$/, /\.[jt]sx$/, /\.mdx?$/, /\.astro$/, /\.elm$/];
|
|
22
18
|
|
|
23
19
|
const VIRTUAL_ENTRY_ALIAS = [
|
|
@@ -44,6 +40,7 @@ function getLayerPlaceholder(layer) {
|
|
|
44
40
|
}
|
|
45
41
|
|
|
46
42
|
const INCLUDE_COMMENT = "@unocss-include";
|
|
43
|
+
const IGNORE_COMMENT = "@unocss-ignore";
|
|
47
44
|
const CSS_PLACEHOLDER = "@unocss-placeholder";
|
|
48
45
|
|
|
49
46
|
function createContext(configOrPath, defaults = {}, extraConfigSources = [], resolveConfigResult = () => {
|
|
@@ -87,6 +84,8 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
|
|
|
87
84
|
invalidate();
|
|
88
85
|
}
|
|
89
86
|
const filter = (code, id) => {
|
|
87
|
+
if (code.includes(IGNORE_COMMENT))
|
|
88
|
+
return false;
|
|
90
89
|
return code.includes(INCLUDE_COMMENT) || code.includes(CSS_PLACEHOLDER) || rollupFilter(id);
|
|
91
90
|
};
|
|
92
91
|
async function getConfig() {
|
|
@@ -113,6 +112,10 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
|
|
|
113
112
|
};
|
|
114
113
|
}
|
|
115
114
|
|
|
115
|
+
function getPath(id) {
|
|
116
|
+
return id.replace(/\?.*$/, "");
|
|
117
|
+
}
|
|
118
|
+
|
|
116
119
|
const PLUGIN_NAME = "unocss:webpack";
|
|
117
120
|
const UPDATE_DEBOUNCE = 10;
|
|
118
121
|
function defineConfig(config) {
|
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { createUnplugin } from 'unplugin';
|
|
2
2
|
import WebpackSources from 'webpack-sources';
|
|
3
|
-
import { createGenerator, BetterMap } from '@unocss/core';
|
|
3
|
+
import { cssIdRE, createGenerator, BetterMap } from '@unocss/core';
|
|
4
4
|
import { createFilter } from '@rollup/pluginutils';
|
|
5
5
|
import { loadConfig } from '@unocss/config';
|
|
6
|
+
import 'crypto';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
return id.replace(/\?.*$/, "");
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const regexCssId = /\.(css|postcss|sass|scss|less|stylus|styl)$/;
|
|
12
|
-
const defaultExclude = [regexCssId];
|
|
8
|
+
const defaultExclude = [cssIdRE];
|
|
13
9
|
const defaultInclude = [/\.vue$/, /\.vue\?vue/, /\.svelte$/, /\.[jt]sx$/, /\.mdx?$/, /\.astro$/, /\.elm$/];
|
|
14
10
|
|
|
15
11
|
const VIRTUAL_ENTRY_ALIAS = [
|
|
@@ -36,6 +32,7 @@ function getLayerPlaceholder(layer) {
|
|
|
36
32
|
}
|
|
37
33
|
|
|
38
34
|
const INCLUDE_COMMENT = "@unocss-include";
|
|
35
|
+
const IGNORE_COMMENT = "@unocss-ignore";
|
|
39
36
|
const CSS_PLACEHOLDER = "@unocss-placeholder";
|
|
40
37
|
|
|
41
38
|
function createContext(configOrPath, defaults = {}, extraConfigSources = [], resolveConfigResult = () => {
|
|
@@ -79,6 +76,8 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
|
|
|
79
76
|
invalidate();
|
|
80
77
|
}
|
|
81
78
|
const filter = (code, id) => {
|
|
79
|
+
if (code.includes(IGNORE_COMMENT))
|
|
80
|
+
return false;
|
|
82
81
|
return code.includes(INCLUDE_COMMENT) || code.includes(CSS_PLACEHOLDER) || rollupFilter(id);
|
|
83
82
|
};
|
|
84
83
|
async function getConfig() {
|
|
@@ -105,6 +104,10 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
|
|
|
105
104
|
};
|
|
106
105
|
}
|
|
107
106
|
|
|
107
|
+
function getPath(id) {
|
|
108
|
+
return id.replace(/\?.*$/, "");
|
|
109
|
+
}
|
|
110
|
+
|
|
108
111
|
const PLUGIN_NAME = "unocss:webpack";
|
|
109
112
|
const UPDATE_DEBOUNCE = 10;
|
|
110
113
|
function defineConfig(config) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/webpack",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.11",
|
|
4
4
|
"description": "The Webpack plugin for UnoCSS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"unocss",
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@rollup/pluginutils": "^4.2.1",
|
|
40
|
-
"@unocss/config": "0.32.
|
|
41
|
-
"@unocss/core": "0.32.
|
|
40
|
+
"@unocss/config": "0.32.11",
|
|
41
|
+
"@unocss/core": "0.32.11",
|
|
42
42
|
"unplugin": "^0.6.2",
|
|
43
43
|
"webpack-sources": "^3.2.3"
|
|
44
44
|
},
|
|
@@ -50,6 +50,5 @@
|
|
|
50
50
|
"scripts": {
|
|
51
51
|
"build": "unbuild",
|
|
52
52
|
"stub": "unbuild --stub"
|
|
53
|
-
}
|
|
54
|
-
"readme": "# @unocss/webpack\n\nThe Webpack plugin for UnoCSS.\n\n> This plugin does not come with any default presets.\n\nCurrently, this plugin only supports [the `global` mode](https://github.com/unocss/unocss/blob/main/packages/vite/src/types.ts#L11-L21)\n\n## Installation\n\n```bash\nnpm i -D @unocss/webpack\n```\n\n```ts\n// webpack.config.js\nconst UnoCSS = require('@unocss/webpack').default\n\nmodule.exports = {\n plugins: [\n UnoCSS({ /* options */ }),\n ],\n}\n```\n\nOr you can have the config file in `unocss.config.js` or `unocss.config.ts`.\n"
|
|
53
|
+
}
|
|
55
54
|
}
|