@rsbuild/plugin-vue2 1.1.1 → 1.2.0
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/README.md +2 -2
- package/dist/index.cjs +30 -5
- package/dist/index.js +21 -0
- package/dist/patchWebpackRuleSetCompiler.d.ts +5 -0
- package/package.json +30 -32
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ Add plugin to your `rsbuild.config.ts`:
|
|
|
23
23
|
|
|
24
24
|
```ts
|
|
25
25
|
// rsbuild.config.ts
|
|
26
|
-
import { pluginVue2 } from
|
|
26
|
+
import { pluginVue2 } from '@rsbuild/plugin-vue2';
|
|
27
27
|
|
|
28
28
|
export default {
|
|
29
29
|
plugins: [pluginVue2()],
|
|
@@ -46,7 +46,7 @@ Options passed to `vue-loader`, please refer to the [vue-loader documentation](h
|
|
|
46
46
|
```js
|
|
47
47
|
const defaultOptions = {
|
|
48
48
|
compilerOptions: {
|
|
49
|
-
whitespace:
|
|
49
|
+
whitespace: 'condense',
|
|
50
50
|
},
|
|
51
51
|
experimentalInlineMatchResource: true,
|
|
52
52
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -4,11 +4,15 @@ const __rslib_import_meta_url__ = /*#__PURE__*/ function() {
|
|
|
4
4
|
}();
|
|
5
5
|
var __webpack_require__ = {};
|
|
6
6
|
(()=>{
|
|
7
|
-
__webpack_require__.d = (exports1,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
8
|
+
var define = (defs, kind)=>{
|
|
9
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
[kind]: defs[key]
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
define(getters, "get");
|
|
15
|
+
define(values, "value");
|
|
12
16
|
};
|
|
13
17
|
})();
|
|
14
18
|
(()=>{
|
|
@@ -68,6 +72,26 @@ class VueLoader15PitchFixPlugin {
|
|
|
68
72
|
_define_property(this, "name", 'VueLoader15PitchFixPlugin');
|
|
69
73
|
}
|
|
70
74
|
}
|
|
75
|
+
const patchWebpackRuleSetCompiler_require = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__);
|
|
76
|
+
const PATCHED_RULE_SET_COMPILER = '__rsbuildPluginVue2PatchedWithRule';
|
|
77
|
+
function patchWebpackRuleSetCompiler() {
|
|
78
|
+
const ruleSetCompilerPath = patchWebpackRuleSetCompiler_require.resolve('webpack/lib/rules/RuleSetCompiler');
|
|
79
|
+
const ObjectMatcherRulePlugin = patchWebpackRuleSetCompiler_require('webpack/lib/rules/ObjectMatcherRulePlugin');
|
|
80
|
+
const RuleSetCompiler = patchWebpackRuleSetCompiler_require(ruleSetCompilerPath);
|
|
81
|
+
if (RuleSetCompiler[PATCHED_RULE_SET_COMPILER]) return;
|
|
82
|
+
class PatchedRuleSetCompiler extends RuleSetCompiler {
|
|
83
|
+
constructor(plugins = []){
|
|
84
|
+
const hasWithRule = plugins.some((plugin)=>plugin?.ruleProperty === 'with');
|
|
85
|
+
super(hasWithRule ? plugins : [
|
|
86
|
+
...plugins,
|
|
87
|
+
new ObjectMatcherRulePlugin('with', 'attributes', (value)=>Boolean(value && !value._isLegacyAssert))
|
|
88
|
+
]);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
PatchedRuleSetCompiler[PATCHED_RULE_SET_COMPILER] = true;
|
|
92
|
+
const cachedModule = patchWebpackRuleSetCompiler_require.cache[ruleSetCompilerPath];
|
|
93
|
+
if (cachedModule) cachedModule.exports = PatchedRuleSetCompiler;
|
|
94
|
+
}
|
|
71
95
|
const isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && '[object Object]' === Object.prototype.toString.call(obj);
|
|
72
96
|
const isDefaultPreset = (config)=>{
|
|
73
97
|
const { performance, splitChunks } = config;
|
|
@@ -147,6 +171,7 @@ function pluginVue2(options = {}) {
|
|
|
147
171
|
rule.test(VUE_REGEXP).use(CHAIN_ID.USE.VUE).loader(src_require.resolve('vue-loader')).options(vueLoaderOptions);
|
|
148
172
|
if (chain.module.rules.has(CHAIN_ID.RULE.JS)) applyResolveConfig(rule, chain.module.rule(CHAIN_ID.RULE.JS));
|
|
149
173
|
chain.module.rule(CHAIN_ID.RULE.CSS).test(/\.(?:css|postcss|pcss)$/);
|
|
174
|
+
patchWebpackRuleSetCompiler();
|
|
150
175
|
chain.plugin(CHAIN_ID.PLUGIN.VUE_LOADER_PLUGIN).use(external_vue_loader_namespaceObject.VueLoaderPlugin);
|
|
151
176
|
chain.plugin('vue-loader-15-pitch-fix').use(VueLoader15PitchFixPlugin);
|
|
152
177
|
});
|
package/dist/index.js
CHANGED
|
@@ -36,6 +36,26 @@ class VueLoader15PitchFixPlugin {
|
|
|
36
36
|
_define_property(this, "name", 'VueLoader15PitchFixPlugin');
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
+
const patchWebpackRuleSetCompiler_require = createRequire(import.meta.url);
|
|
40
|
+
const PATCHED_RULE_SET_COMPILER = '__rsbuildPluginVue2PatchedWithRule';
|
|
41
|
+
function patchWebpackRuleSetCompiler() {
|
|
42
|
+
const ruleSetCompilerPath = patchWebpackRuleSetCompiler_require.resolve('webpack/lib/rules/RuleSetCompiler');
|
|
43
|
+
const ObjectMatcherRulePlugin = patchWebpackRuleSetCompiler_require('webpack/lib/rules/ObjectMatcherRulePlugin');
|
|
44
|
+
const RuleSetCompiler = patchWebpackRuleSetCompiler_require(ruleSetCompilerPath);
|
|
45
|
+
if (RuleSetCompiler[PATCHED_RULE_SET_COMPILER]) return;
|
|
46
|
+
class PatchedRuleSetCompiler extends RuleSetCompiler {
|
|
47
|
+
constructor(plugins = []){
|
|
48
|
+
const hasWithRule = plugins.some((plugin)=>plugin?.ruleProperty === 'with');
|
|
49
|
+
super(hasWithRule ? plugins : [
|
|
50
|
+
...plugins,
|
|
51
|
+
new ObjectMatcherRulePlugin('with', 'attributes', (value)=>Boolean(value && !value._isLegacyAssert))
|
|
52
|
+
]);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
PatchedRuleSetCompiler[PATCHED_RULE_SET_COMPILER] = true;
|
|
56
|
+
const cachedModule = patchWebpackRuleSetCompiler_require.cache[ruleSetCompilerPath];
|
|
57
|
+
if (cachedModule) cachedModule.exports = PatchedRuleSetCompiler;
|
|
58
|
+
}
|
|
39
59
|
const isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && '[object Object]' === Object.prototype.toString.call(obj);
|
|
40
60
|
const isDefaultPreset = (config)=>{
|
|
41
61
|
const { performance, splitChunks } = config;
|
|
@@ -115,6 +135,7 @@ function pluginVue2(options = {}) {
|
|
|
115
135
|
rule.test(VUE_REGEXP).use(CHAIN_ID.USE.VUE).loader(src_require.resolve('vue-loader')).options(vueLoaderOptions);
|
|
116
136
|
if (chain.module.rules.has(CHAIN_ID.RULE.JS)) applyResolveConfig(rule, chain.module.rule(CHAIN_ID.RULE.JS));
|
|
117
137
|
chain.module.rule(CHAIN_ID.RULE.CSS).test(/\.(?:css|postcss|pcss)$/);
|
|
138
|
+
patchWebpackRuleSetCompiler();
|
|
118
139
|
chain.plugin(CHAIN_ID.PLUGIN.VUE_LOADER_PLUGIN).use(VueLoaderPlugin);
|
|
119
140
|
chain.plugin('vue-loader-15-pitch-fix').use(VueLoader15PitchFixPlugin);
|
|
120
141
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-vue2",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"repository":
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/rstackjs/rsbuild-plugin-vue2"
|
|
7
|
+
},
|
|
8
|
+
"homepage": "https://github.com/rstackjs/rsbuild-plugin-vue2#readme",
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/rstackjs/rsbuild-plugin-vue2/issues"
|
|
11
|
+
},
|
|
5
12
|
"license": "MIT",
|
|
6
13
|
"type": "module",
|
|
7
14
|
"exports": {
|
|
@@ -11,57 +18,48 @@
|
|
|
11
18
|
"require": "./dist/index.cjs"
|
|
12
19
|
}
|
|
13
20
|
},
|
|
14
|
-
"main": "./dist/index.js",
|
|
15
|
-
"module": "./dist/index.mjs",
|
|
16
21
|
"types": "./dist/index.d.ts",
|
|
17
22
|
"files": [
|
|
18
23
|
"dist"
|
|
19
24
|
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "rslib build",
|
|
22
|
-
"dev": "rslib build --watch",
|
|
23
|
-
"lint": "biome check .",
|
|
24
|
-
"lint:write": "biome check . --write",
|
|
25
|
-
"prepare": "simple-git-hooks && npm run build",
|
|
26
|
-
"test": "playwright test",
|
|
27
|
-
"bump": "npx bumpp"
|
|
28
|
-
},
|
|
29
25
|
"simple-git-hooks": {
|
|
30
|
-
"pre-commit": "
|
|
31
|
-
},
|
|
32
|
-
"nano-staged": {
|
|
33
|
-
"*.{js,jsx,ts,tsx,mjs,cjs}": [
|
|
34
|
-
"biome check --write --no-errors-on-unmatched"
|
|
35
|
-
]
|
|
26
|
+
"pre-commit": "pnpm run lint:write"
|
|
36
27
|
},
|
|
37
28
|
"dependencies": {
|
|
38
29
|
"vue-loader": "^15.11.1",
|
|
39
|
-
"webpack": "^5.
|
|
30
|
+
"webpack": "^5.108.3"
|
|
40
31
|
},
|
|
41
32
|
"devDependencies": {
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
44
|
-
"@rsbuild/
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
47
|
-
"@types/node": "^24.
|
|
48
|
-
"
|
|
49
|
-
"
|
|
33
|
+
"@playwright/test": "^1.61.1",
|
|
34
|
+
"@rsbuild/core": "2.1.3",
|
|
35
|
+
"@rsbuild/plugin-less": "^1.6.4",
|
|
36
|
+
"@rslib/core": "^0.23.1",
|
|
37
|
+
"@rslint/core": "^0.6.4",
|
|
38
|
+
"@types/node": "^24.13.2",
|
|
39
|
+
"playwright": "^1.61.1",
|
|
40
|
+
"prettier": "^3.9.4",
|
|
50
41
|
"simple-git-hooks": "^2.13.1",
|
|
51
|
-
"typescript": "^
|
|
42
|
+
"typescript": "^6.0.3",
|
|
52
43
|
"vue": "^2.7.16"
|
|
53
44
|
},
|
|
54
45
|
"peerDependencies": {
|
|
55
|
-
"@rsbuild/core": "^1.0.0 || ^2.0.0
|
|
46
|
+
"@rsbuild/core": "^1.0.0 || ^2.0.0"
|
|
56
47
|
},
|
|
57
48
|
"peerDependenciesMeta": {
|
|
58
49
|
"@rsbuild/core": {
|
|
59
50
|
"optional": true
|
|
60
51
|
}
|
|
61
52
|
},
|
|
62
|
-
"packageManager": "pnpm@10.28.2",
|
|
63
53
|
"publishConfig": {
|
|
64
54
|
"access": "public",
|
|
65
55
|
"registry": "https://registry.npmjs.org/"
|
|
56
|
+
},
|
|
57
|
+
"scripts": {
|
|
58
|
+
"build": "rslib",
|
|
59
|
+
"dev": "rslib -w",
|
|
60
|
+
"lint": "rslint && prettier -c .",
|
|
61
|
+
"lint:write": "rslint --fix && prettier -w .",
|
|
62
|
+
"test": "playwright test",
|
|
63
|
+
"bump": "pnpx bumpp"
|
|
66
64
|
}
|
|
67
|
-
}
|
|
65
|
+
}
|