@rsbuild/plugin-vue2 0.6.4 → 0.6.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.js +45 -0
- package/dist/index.mjs +46 -0
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
9
|
var __export = (target, all) => {
|
|
9
10
|
for (var name in all)
|
|
10
11
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -26,6 +27,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
27
|
mod
|
|
27
28
|
));
|
|
28
29
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var __publicField = (obj, key, value) => {
|
|
31
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
32
|
+
return value;
|
|
33
|
+
};
|
|
29
34
|
|
|
30
35
|
// src/index.ts
|
|
31
36
|
var src_exports = {};
|
|
@@ -72,6 +77,45 @@ var applySplitChunksRule = (api, options = {
|
|
|
72
77
|
});
|
|
73
78
|
};
|
|
74
79
|
|
|
80
|
+
// src/VueLoader15PitchFixPlugin.ts
|
|
81
|
+
var VueLoader15PitchFixPlugin = class {
|
|
82
|
+
constructor() {
|
|
83
|
+
__publicField(this, "name", "VueLoader15PitchFixPlugin");
|
|
84
|
+
}
|
|
85
|
+
apply(compiler) {
|
|
86
|
+
const { NormalModule } = compiler.webpack;
|
|
87
|
+
compiler.hooks.compilation.tap(this.name, (compilation) => {
|
|
88
|
+
const isExpCssOn = compilation.compiler.options?.experiments?.css;
|
|
89
|
+
if (!isExpCssOn)
|
|
90
|
+
return;
|
|
91
|
+
NormalModule.getCompilationHooks(compilation).loader.tap(
|
|
92
|
+
this.name,
|
|
93
|
+
(loaderContext) => {
|
|
94
|
+
if (
|
|
95
|
+
// the related issue only happens for <style>
|
|
96
|
+
/[?&]type=style/.test(loaderContext.resourceQuery) && // the fix should be applied before `pitch` phase completed.
|
|
97
|
+
// once `pitch` phase completed, vue-loader will remove its pitcher loader.
|
|
98
|
+
/[\\/]vue-loader[\\/]lib[\\/]loaders[\\/]pitcher/.test(
|
|
99
|
+
loaderContext.loaders?.[0]?.path || ""
|
|
100
|
+
)
|
|
101
|
+
) {
|
|
102
|
+
const seen = /* @__PURE__ */ new Set();
|
|
103
|
+
const loaders = [];
|
|
104
|
+
for (const loader of loaderContext.loaders || []) {
|
|
105
|
+
const identifier = typeof loader === "string" ? loader : loader.path + loader.query;
|
|
106
|
+
if (!seen.has(identifier)) {
|
|
107
|
+
seen.add(identifier);
|
|
108
|
+
loaders.push(loader);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
loaderContext.loaders = loaders;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
75
119
|
// src/index.ts
|
|
76
120
|
function pluginVue2(options = {}) {
|
|
77
121
|
return {
|
|
@@ -93,6 +137,7 @@ function pluginVue2(options = {}) {
|
|
|
93
137
|
);
|
|
94
138
|
chain.module.rule(CHAIN_ID.RULE.VUE).test(/\.vue$/).use(CHAIN_ID.USE.VUE).loader(require.resolve("vue-loader")).options(vueLoaderOptions);
|
|
95
139
|
chain.plugin(CHAIN_ID.PLUGIN.VUE_LOADER_PLUGIN).use(import_vue_loader.VueLoaderPlugin);
|
|
140
|
+
chain.plugin(CHAIN_ID.PLUGIN.VUE_LOADER_15_PITCH_FIX_PLUGIN).use(VueLoader15PitchFixPlugin);
|
|
96
141
|
});
|
|
97
142
|
applySplitChunksRule(api, options.splitChunks);
|
|
98
143
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { createRequire } from 'module';
|
|
2
2
|
var require = createRequire(import.meta['url']);
|
|
3
3
|
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
6
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
5
7
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
6
8
|
}) : x)(function(x) {
|
|
@@ -8,6 +10,10 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
8
10
|
return require.apply(this, arguments);
|
|
9
11
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
10
12
|
});
|
|
13
|
+
var __publicField = (obj, key, value) => {
|
|
14
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15
|
+
return value;
|
|
16
|
+
};
|
|
11
17
|
|
|
12
18
|
// ../../node_modules/.pnpm/@modern-js+module-tools@2.49.0_eslint@8.57.0_typescript@5.4.5/node_modules/@modern-js/module-tools/shims/esm.js
|
|
13
19
|
import { fileURLToPath } from "url";
|
|
@@ -56,6 +62,45 @@ var applySplitChunksRule = (api, options = {
|
|
|
56
62
|
});
|
|
57
63
|
};
|
|
58
64
|
|
|
65
|
+
// src/VueLoader15PitchFixPlugin.ts
|
|
66
|
+
var VueLoader15PitchFixPlugin = class {
|
|
67
|
+
constructor() {
|
|
68
|
+
__publicField(this, "name", "VueLoader15PitchFixPlugin");
|
|
69
|
+
}
|
|
70
|
+
apply(compiler) {
|
|
71
|
+
const { NormalModule } = compiler.webpack;
|
|
72
|
+
compiler.hooks.compilation.tap(this.name, (compilation) => {
|
|
73
|
+
const isExpCssOn = compilation.compiler.options?.experiments?.css;
|
|
74
|
+
if (!isExpCssOn)
|
|
75
|
+
return;
|
|
76
|
+
NormalModule.getCompilationHooks(compilation).loader.tap(
|
|
77
|
+
this.name,
|
|
78
|
+
(loaderContext) => {
|
|
79
|
+
if (
|
|
80
|
+
// the related issue only happens for <style>
|
|
81
|
+
/[?&]type=style/.test(loaderContext.resourceQuery) && // the fix should be applied before `pitch` phase completed.
|
|
82
|
+
// once `pitch` phase completed, vue-loader will remove its pitcher loader.
|
|
83
|
+
/[\\/]vue-loader[\\/]lib[\\/]loaders[\\/]pitcher/.test(
|
|
84
|
+
loaderContext.loaders?.[0]?.path || ""
|
|
85
|
+
)
|
|
86
|
+
) {
|
|
87
|
+
const seen = /* @__PURE__ */ new Set();
|
|
88
|
+
const loaders = [];
|
|
89
|
+
for (const loader of loaderContext.loaders || []) {
|
|
90
|
+
const identifier = typeof loader === "string" ? loader : loader.path + loader.query;
|
|
91
|
+
if (!seen.has(identifier)) {
|
|
92
|
+
seen.add(identifier);
|
|
93
|
+
loaders.push(loader);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
loaderContext.loaders = loaders;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
59
104
|
// src/index.ts
|
|
60
105
|
function pluginVue2(options = {}) {
|
|
61
106
|
return {
|
|
@@ -77,6 +122,7 @@ function pluginVue2(options = {}) {
|
|
|
77
122
|
);
|
|
78
123
|
chain.module.rule(CHAIN_ID.RULE.VUE).test(/\.vue$/).use(CHAIN_ID.USE.VUE).loader(__require.resolve("vue-loader")).options(vueLoaderOptions);
|
|
79
124
|
chain.plugin(CHAIN_ID.PLUGIN.VUE_LOADER_PLUGIN).use(VueLoaderPlugin);
|
|
125
|
+
chain.plugin(CHAIN_ID.PLUGIN.VUE_LOADER_15_PITCH_FIX_PLUGIN).use(VueLoader15PitchFixPlugin);
|
|
80
126
|
});
|
|
81
127
|
applySplitChunksRule(api, options.splitChunks);
|
|
82
128
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/plugin-vue2",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"description": "Vue 2 plugin of Rsbuild",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"repository": {
|
|
@@ -25,16 +25,16 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"vue-loader": "^15.11.1",
|
|
27
27
|
"webpack": "^5.91.0",
|
|
28
|
-
"@rsbuild/shared": "0.6.
|
|
28
|
+
"@rsbuild/shared": "0.6.5"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"typescript": "^5.4.2",
|
|
32
32
|
"webpack": "^5.91.0",
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
33
|
+
"@rsbuild/core": "0.6.5",
|
|
34
|
+
"@scripts/test-helper": "0.6.5"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@rsbuild/core": "^0.6.
|
|
37
|
+
"@rsbuild/core": "^0.6.5"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public",
|