@rsbuild/plugin-vue 1.2.2 → 2.0.0-alpha.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 +16 -6
- package/dist/index.js +37 -28
- package/dist/splitChunks.d.ts +1 -1
- package/package.json +9 -9
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const __rslib_import_meta_url__ =
|
|
2
|
+
const __rslib_import_meta_url__ = "u" < typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
3
3
|
var __webpack_require__ = {};
|
|
4
4
|
__webpack_require__.d = (exports1, definition)=>{
|
|
5
5
|
for(var key in definition)__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key) && Object.defineProperty(exports1, key, {
|
|
@@ -7,7 +7,7 @@ __webpack_require__.d = (exports1, definition)=>{
|
|
|
7
7
|
get: definition[key]
|
|
8
8
|
});
|
|
9
9
|
}, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports1)=>{
|
|
10
|
-
|
|
10
|
+
"u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
11
11
|
value: 'Module'
|
|
12
12
|
}), Object.defineProperty(exports1, '__esModule', {
|
|
13
13
|
value: !0
|
|
@@ -18,10 +18,11 @@ __webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_expo
|
|
|
18
18
|
PLUGIN_VUE_NAME: ()=>PLUGIN_VUE_NAME,
|
|
19
19
|
pluginVue: ()=>pluginVue
|
|
20
20
|
});
|
|
21
|
-
const external_node_module_namespaceObject = require("node:module"), external_rspack_vue_loader_namespaceObject = require("rspack-vue-loader"), isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && '[object Object]' === Object.prototype.toString.call(obj)
|
|
21
|
+
const external_node_module_namespaceObject = require("node:module"), external_rspack_vue_loader_namespaceObject = require("rspack-vue-loader"), isPlainObject = (obj)=>null !== obj && 'object' == typeof obj && '[object Object]' === Object.prototype.toString.call(obj);
|
|
22
|
+
function applySplitChunksRule(api, options = {
|
|
22
23
|
vue: !0,
|
|
23
24
|
router: !0
|
|
24
|
-
})
|
|
25
|
+
}) {
|
|
25
26
|
api.modifyBundlerChain((chain, { environment })=>{
|
|
26
27
|
let { config } = environment;
|
|
27
28
|
if ('split-by-experience' !== config.performance.chunkSplit.strategy) return;
|
|
@@ -44,7 +45,8 @@ const external_node_module_namespaceObject = require("node:module"), external_rs
|
|
|
44
45
|
}
|
|
45
46
|
});
|
|
46
47
|
});
|
|
47
|
-
}
|
|
48
|
+
}
|
|
49
|
+
const src_require = (0, external_node_module_namespaceObject.createRequire)(__rslib_import_meta_url__), PLUGIN_VUE_NAME = 'rsbuild:vue';
|
|
48
50
|
function pluginVue(options = {}) {
|
|
49
51
|
return {
|
|
50
52
|
name: PLUGIN_VUE_NAME,
|
|
@@ -63,7 +65,15 @@ function pluginVue(options = {}) {
|
|
|
63
65
|
]
|
|
64
66
|
}
|
|
65
67
|
}, config);
|
|
66
|
-
return !0 === merged.output.cssModules.auto && (merged.output.cssModules.auto = (path, query)=>
|
|
68
|
+
return !0 === merged.output.cssModules.auto && (merged.output.cssModules.auto = (path, query)=>{
|
|
69
|
+
if ((VUE_REGEXP.test(path) || path.includes('.vue.css')) && query) try {
|
|
70
|
+
let params = new URLSearchParams(query);
|
|
71
|
+
return 'style' === params.get('type') && params.has('module');
|
|
72
|
+
} catch {
|
|
73
|
+
return !1;
|
|
74
|
+
}
|
|
75
|
+
return CSS_MODULES_REGEX.test(path);
|
|
76
|
+
}), merged;
|
|
67
77
|
}), api.modifyBundlerChain((chain, { CHAIN_ID })=>{
|
|
68
78
|
chain.resolve.extensions.add('.vue');
|
|
69
79
|
let userLoaderOptions = options.vueLoaderOptions ?? {}, compilerOptions = {
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { VueLoaderPlugin } from "rspack-vue-loader";
|
|
3
|
+
function applySplitChunksRule(api, options = {
|
|
4
|
+
vue: !0,
|
|
5
|
+
router: !0
|
|
6
|
+
}) {
|
|
7
|
+
api.modifyBundlerChain((chain, { environment })=>{
|
|
8
|
+
let { config } = environment;
|
|
9
|
+
if ('split-by-experience' !== config.performance.chunkSplit.strategy) return;
|
|
10
|
+
let currentConfig = chain.optimization.splitChunks.values();
|
|
11
|
+
if (null === currentConfig || 'object' != typeof currentConfig || '[object Object]' !== Object.prototype.toString.call(currentConfig)) return;
|
|
12
|
+
let extraGroups = {};
|
|
13
|
+
options.vue && (extraGroups.vue = {
|
|
14
|
+
name: 'lib-vue',
|
|
15
|
+
test: /node_modules[\\/](?:vue|rspack-vue-loader|@vue[\\/]shared|@vue[\\/]reactivity|@vue[\\/]runtime-dom|@vue[\\/]runtime-core)[\\/]/,
|
|
16
|
+
priority: 0
|
|
17
|
+
}), options.router && (extraGroups.router = {
|
|
18
|
+
name: 'lib-router',
|
|
19
|
+
test: /node_modules[\\/]vue-router[\\/]/,
|
|
20
|
+
priority: 0
|
|
21
|
+
}), Object.keys(extraGroups).length && chain.optimization.splitChunks({
|
|
22
|
+
...currentConfig,
|
|
23
|
+
cacheGroups: {
|
|
24
|
+
...extraGroups,
|
|
25
|
+
...currentConfig.cacheGroups
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
3
30
|
let src_require = createRequire(import.meta.url), PLUGIN_VUE_NAME = 'rsbuild:vue';
|
|
4
31
|
function pluginVue(options = {}) {
|
|
5
32
|
return {
|
|
@@ -19,7 +46,15 @@ function pluginVue(options = {}) {
|
|
|
19
46
|
]
|
|
20
47
|
}
|
|
21
48
|
}, config);
|
|
22
|
-
return !0 === merged.output.cssModules.auto && (merged.output.cssModules.auto = (path, query)=>
|
|
49
|
+
return !0 === merged.output.cssModules.auto && (merged.output.cssModules.auto = (path, query)=>{
|
|
50
|
+
if ((VUE_REGEXP.test(path) || path.includes('.vue.css')) && query) try {
|
|
51
|
+
let params = new URLSearchParams(query);
|
|
52
|
+
return 'style' === params.get('type') && params.has('module');
|
|
53
|
+
} catch {
|
|
54
|
+
return !1;
|
|
55
|
+
}
|
|
56
|
+
return CSS_MODULES_REGEX.test(path);
|
|
57
|
+
}), merged;
|
|
23
58
|
}), api.modifyBundlerChain((chain, { CHAIN_ID })=>{
|
|
24
59
|
chain.resolve.extensions.add('.vue');
|
|
25
60
|
let userLoaderOptions = options.vueLoaderOptions ?? {}, compilerOptions = {
|
|
@@ -32,33 +67,7 @@ function pluginVue(options = {}) {
|
|
|
32
67
|
compilerOptions
|
|
33
68
|
};
|
|
34
69
|
chain.module.rule(CHAIN_ID.RULE.VUE).test(test).use(CHAIN_ID.USE.VUE).loader(src_require.resolve('rspack-vue-loader')).options(vueLoaderOptions), chain.module.rule(CHAIN_ID.RULE.CSS).test(/\.(?:css|postcss|pcss)$/), chain.plugin(CHAIN_ID.PLUGIN.VUE_LOADER_PLUGIN).before(CHAIN_ID.PLUGIN.REACT_FAST_REFRESH).use(VueLoaderPlugin);
|
|
35
|
-
}), (
|
|
36
|
-
vue: !0,
|
|
37
|
-
router: !0
|
|
38
|
-
})=>{
|
|
39
|
-
api.modifyBundlerChain((chain, { environment })=>{
|
|
40
|
-
let { config } = environment;
|
|
41
|
-
if ('split-by-experience' !== config.performance.chunkSplit.strategy) return;
|
|
42
|
-
let currentConfig = chain.optimization.splitChunks.values();
|
|
43
|
-
if (null === currentConfig || 'object' != typeof currentConfig || '[object Object]' !== Object.prototype.toString.call(currentConfig)) return;
|
|
44
|
-
let extraGroups = {};
|
|
45
|
-
options.vue && (extraGroups.vue = {
|
|
46
|
-
name: 'lib-vue',
|
|
47
|
-
test: /node_modules[\\/](?:vue|rspack-vue-loader|@vue[\\/]shared|@vue[\\/]reactivity|@vue[\\/]runtime-dom|@vue[\\/]runtime-core)[\\/]/,
|
|
48
|
-
priority: 0
|
|
49
|
-
}), options.router && (extraGroups.router = {
|
|
50
|
-
name: 'lib-router',
|
|
51
|
-
test: /node_modules[\\/]vue-router[\\/]/,
|
|
52
|
-
priority: 0
|
|
53
|
-
}), Object.keys(extraGroups).length && chain.optimization.splitChunks({
|
|
54
|
-
...currentConfig,
|
|
55
|
-
cacheGroups: {
|
|
56
|
-
...extraGroups,
|
|
57
|
-
...currentConfig.cacheGroups
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
})(api, options.splitChunks);
|
|
70
|
+
}), applySplitChunksRule(api, options.splitChunks);
|
|
62
71
|
}
|
|
63
72
|
};
|
|
64
73
|
}
|
package/dist/splitChunks.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { RsbuildPluginAPI } from '@rsbuild/core';
|
|
2
2
|
import type { SplitVueChunkOptions } from './index.js';
|
|
3
|
-
export declare
|
|
3
|
+
export declare function applySplitChunksRule(api: RsbuildPluginAPI, options?: SplitVueChunkOptions): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-vue",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.3",
|
|
4
4
|
"description": "Vue 3 plugin of Rsbuild",
|
|
5
5
|
"homepage": "https://rsbuild.rs",
|
|
6
6
|
"repository": {
|
|
@@ -23,19 +23,19 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"rspack-vue-loader": "^17.4.
|
|
27
|
-
"webpack": "^5.
|
|
26
|
+
"rspack-vue-loader": "^17.4.5",
|
|
27
|
+
"webpack": "^5.104.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@rslib/core": "0.
|
|
31
|
-
"@types/node": "^24.10.
|
|
30
|
+
"@rslib/core": "0.19.3",
|
|
31
|
+
"@types/node": "^24.10.9",
|
|
32
32
|
"typescript": "^5.9.3",
|
|
33
|
-
"vue": "^3.5.
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
33
|
+
"vue": "^3.5.27",
|
|
34
|
+
"@scripts/test-helper": "1.0.1",
|
|
35
|
+
"@rsbuild/core": "2.0.0-alpha.3"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@rsbuild/core": "
|
|
38
|
+
"@rsbuild/core": "^2.0.0-0"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public",
|