@rsbuild/plugin-vue2 1.0.3 → 1.0.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 +6 -5
- package/dist/index.js +10 -9
- package/package.json +14 -15
package/dist/index.cjs
CHANGED
|
@@ -46,12 +46,10 @@ class VueLoader15PitchFixPlugin {
|
|
|
46
46
|
apply(compiler) {
|
|
47
47
|
const { NormalModule } = compiler.webpack;
|
|
48
48
|
compiler.hooks.compilation.tap(this.name, (compilation)=>{
|
|
49
|
-
|
|
50
|
-
const isExpCssOn = null === (_compilation_compiler_options = compilation.compiler.options) || void 0 === _compilation_compiler_options ? void 0 : null === (_compilation_compiler_options_experiments = _compilation_compiler_options.experiments) || void 0 === _compilation_compiler_options_experiments ? void 0 : _compilation_compiler_options_experiments.css;
|
|
49
|
+
const isExpCssOn = compilation.compiler.options?.experiments?.css;
|
|
51
50
|
if (!isExpCssOn) return;
|
|
52
51
|
NormalModule.getCompilationHooks(compilation).loader.tap(this.name, (loaderContext)=>{
|
|
53
|
-
|
|
54
|
-
if (/[?&]type=style/.test(loaderContext.resourceQuery) && /[\\/]vue-loader[\\/]lib[\\/]loaders[\\/]pitcher/.test((null === (_loaderContext_loaders = loaderContext.loaders) || void 0 === _loaderContext_loaders ? void 0 : null === (_loaderContext_loaders_ = _loaderContext_loaders[0]) || void 0 === _loaderContext_loaders_ ? void 0 : _loaderContext_loaders_.path) || '')) {
|
|
52
|
+
if (/[?&]type=style/.test(loaderContext.resourceQuery) && /[\\/]vue-loader[\\/]lib[\\/]loaders[\\/]pitcher/.test(loaderContext.loaders?.[0]?.path || '')) {
|
|
55
53
|
const seen = new Set();
|
|
56
54
|
const loaders = [];
|
|
57
55
|
for (const loader of loaderContext.loaders || []){
|
|
@@ -111,7 +109,10 @@ function pluginVue2(options = {}) {
|
|
|
111
109
|
const CSS_MODULES_REGEX = /\.modules?\.\w+$/i;
|
|
112
110
|
api.modifyEnvironmentConfig((config, { mergeEnvironmentConfig })=>{
|
|
113
111
|
if (true === config.output.cssModules.auto) config.output.cssModules.auto = (path, query)=>{
|
|
114
|
-
if (VUE_REGEXP.test(path))
|
|
112
|
+
if (VUE_REGEXP.test(path)) {
|
|
113
|
+
const params = new URLSearchParams(query || '');
|
|
114
|
+
return 'style' === params.get('type') && params.has('module');
|
|
115
|
+
}
|
|
115
116
|
return CSS_MODULES_REGEX.test(path);
|
|
116
117
|
};
|
|
117
118
|
const extraConfig = {
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { VueLoaderPlugin } from "vue-loader";
|
|
3
3
|
function _define_property(obj, key, value) {
|
|
4
4
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
5
5
|
value: value,
|
|
@@ -14,12 +14,10 @@ class VueLoader15PitchFixPlugin {
|
|
|
14
14
|
apply(compiler) {
|
|
15
15
|
const { NormalModule } = compiler.webpack;
|
|
16
16
|
compiler.hooks.compilation.tap(this.name, (compilation)=>{
|
|
17
|
-
|
|
18
|
-
const isExpCssOn = null === (_compilation_compiler_options = compilation.compiler.options) || void 0 === _compilation_compiler_options ? void 0 : null === (_compilation_compiler_options_experiments = _compilation_compiler_options.experiments) || void 0 === _compilation_compiler_options_experiments ? void 0 : _compilation_compiler_options_experiments.css;
|
|
17
|
+
const isExpCssOn = compilation.compiler.options?.experiments?.css;
|
|
19
18
|
if (!isExpCssOn) return;
|
|
20
19
|
NormalModule.getCompilationHooks(compilation).loader.tap(this.name, (loaderContext)=>{
|
|
21
|
-
|
|
22
|
-
if (/[?&]type=style/.test(loaderContext.resourceQuery) && /[\\/]vue-loader[\\/]lib[\\/]loaders[\\/]pitcher/.test((null === (_loaderContext_loaders = loaderContext.loaders) || void 0 === _loaderContext_loaders ? void 0 : null === (_loaderContext_loaders_ = _loaderContext_loaders[0]) || void 0 === _loaderContext_loaders_ ? void 0 : _loaderContext_loaders_.path) || '')) {
|
|
20
|
+
if (/[?&]type=style/.test(loaderContext.resourceQuery) && /[\\/]vue-loader[\\/]lib[\\/]loaders[\\/]pitcher/.test(loaderContext.loaders?.[0]?.path || '')) {
|
|
23
21
|
const seen = new Set();
|
|
24
22
|
const loaders = [];
|
|
25
23
|
for (const loader of loaderContext.loaders || []){
|
|
@@ -69,7 +67,7 @@ const applySplitChunksRule = (api, options = {
|
|
|
69
67
|
});
|
|
70
68
|
});
|
|
71
69
|
};
|
|
72
|
-
const src_require =
|
|
70
|
+
const src_require = createRequire(import.meta.url);
|
|
73
71
|
const PLUGIN_VUE2_NAME = 'rsbuild:vue2';
|
|
74
72
|
function pluginVue2(options = {}) {
|
|
75
73
|
return {
|
|
@@ -79,7 +77,10 @@ function pluginVue2(options = {}) {
|
|
|
79
77
|
const CSS_MODULES_REGEX = /\.modules?\.\w+$/i;
|
|
80
78
|
api.modifyEnvironmentConfig((config, { mergeEnvironmentConfig })=>{
|
|
81
79
|
if (true === config.output.cssModules.auto) config.output.cssModules.auto = (path, query)=>{
|
|
82
|
-
if (VUE_REGEXP.test(path))
|
|
80
|
+
if (VUE_REGEXP.test(path)) {
|
|
81
|
+
const params = new URLSearchParams(query || '');
|
|
82
|
+
return 'style' === params.get('type') && params.has('module');
|
|
83
|
+
}
|
|
83
84
|
return CSS_MODULES_REGEX.test(path);
|
|
84
85
|
};
|
|
85
86
|
const extraConfig = {
|
|
@@ -108,7 +109,7 @@ function pluginVue2(options = {}) {
|
|
|
108
109
|
rule.test(VUE_REGEXP).use(CHAIN_ID.USE.VUE).loader(src_require.resolve('vue-loader')).options(vueLoaderOptions);
|
|
109
110
|
if (chain.module.rules.has(CHAIN_ID.RULE.JS)) applyResolveConfig(rule, chain.module.rule(CHAIN_ID.RULE.JS));
|
|
110
111
|
chain.module.rule(CHAIN_ID.RULE.CSS).test(/\.(?:css|postcss|pcss)$/);
|
|
111
|
-
chain.plugin(CHAIN_ID.PLUGIN.VUE_LOADER_PLUGIN).use(
|
|
112
|
+
chain.plugin(CHAIN_ID.PLUGIN.VUE_LOADER_PLUGIN).use(VueLoaderPlugin);
|
|
112
113
|
chain.plugin('vue-loader-15-pitch-fix').use(VueLoader15PitchFixPlugin);
|
|
113
114
|
});
|
|
114
115
|
applySplitChunksRule(api, options.splitChunks);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-vue2",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"repository": "https://github.com/
|
|
3
|
+
"version": "1.0.5",
|
|
4
|
+
"repository": "https://github.com/rstackjs/rsbuild-plugin-vue2",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -36,19 +36,19 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"vue-loader": "^15.11.1",
|
|
39
|
-
"webpack": "^5.
|
|
39
|
+
"webpack": "^5.103.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@biomejs/biome": "^1.9.4",
|
|
43
|
-
"@playwright/test": "^1.
|
|
44
|
-
"@rsbuild/core": "^1.
|
|
45
|
-
"@rsbuild/plugin-less": "1.
|
|
46
|
-
"@rslib/core": "^0.
|
|
47
|
-
"@types/node": "^22.
|
|
48
|
-
"nano-staged": "^0.
|
|
49
|
-
"playwright": "^1.
|
|
50
|
-
"simple-git-hooks": "^2.
|
|
51
|
-
"typescript": "^5.
|
|
43
|
+
"@playwright/test": "^1.57.0",
|
|
44
|
+
"@rsbuild/core": "^1.6.10",
|
|
45
|
+
"@rsbuild/plugin-less": "1.5.0",
|
|
46
|
+
"@rslib/core": "^0.18.2",
|
|
47
|
+
"@types/node": "^22.19.1",
|
|
48
|
+
"nano-staged": "^0.9.0",
|
|
49
|
+
"playwright": "^1.57.0",
|
|
50
|
+
"simple-git-hooks": "^2.13.1",
|
|
51
|
+
"typescript": "^5.9.3",
|
|
52
52
|
"vue": "^2.7.16"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
@@ -59,10 +59,9 @@
|
|
|
59
59
|
"optional": true
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
|
-
"packageManager": "pnpm@10.
|
|
62
|
+
"packageManager": "pnpm@10.24.0",
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public",
|
|
65
|
-
"registry": "https://registry.npmjs.org/"
|
|
66
|
-
"provenance": true
|
|
65
|
+
"registry": "https://registry.npmjs.org/"
|
|
67
66
|
}
|
|
68
67
|
}
|