@rsbuild/plugin-vue2 0.6.15 → 0.7.0-beta.1

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.
@@ -1,27 +1,45 @@
1
- import { createRequire } from 'module';
2
- var require = createRequire(import.meta['url']);
3
-
1
+ "use strict";
2
+ var __create = Object.create;
4
3
  var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
8
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
7
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
8
- }) : x)(function(x) {
9
- if (typeof require !== "undefined")
10
- return require.apply(this, arguments);
11
- throw Error('Dynamic require of "' + x + '" is not supported');
12
- });
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
13
30
  var __publicField = (obj, key, value) => {
14
31
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
15
32
  return value;
16
33
  };
17
34
 
18
- // ../../node_modules/.pnpm/@modern-js+module-tools@2.49.3_eslint@8.57.0_typescript@5.4.5/node_modules/@modern-js/module-tools/shims/esm.js
19
- import { fileURLToPath } from "url";
20
- import path from "path";
21
-
22
35
  // src/index.ts
23
- import { deepmerge } from "@rsbuild/shared";
24
- import { VueLoaderPlugin } from "vue-loader";
36
+ var src_exports = {};
37
+ __export(src_exports, {
38
+ pluginVue2: () => pluginVue2
39
+ });
40
+ module.exports = __toCommonJS(src_exports);
41
+ var import_shared2 = require("@rsbuild/shared");
42
+ var import_vue_loader = require("vue-loader");
25
43
 
26
44
  // src/VueLoader15PitchFixPlugin.ts
27
45
  var VueLoader15PitchFixPlugin = class {
@@ -63,10 +81,7 @@ var VueLoader15PitchFixPlugin = class {
63
81
  };
64
82
 
65
83
  // src/splitChunks.ts
66
- import {
67
- createCacheGroups,
68
- isPlainObject
69
- } from "@rsbuild/shared";
84
+ var import_shared = require("@rsbuild/shared");
70
85
  var applySplitChunksRule = (api, options = {
71
86
  vue: true,
72
87
  router: true
@@ -77,7 +92,7 @@ var applySplitChunksRule = (api, options = {
77
92
  return;
78
93
  }
79
94
  const currentConfig = chain.optimization.splitChunks.values();
80
- if (!isPlainObject(currentConfig)) {
95
+ if (!(0, import_shared.isPlainObject)(currentConfig)) {
81
96
  return;
82
97
  }
83
98
  const extraGroups = {};
@@ -95,7 +110,7 @@ var applySplitChunksRule = (api, options = {
95
110
  // @ts-expect-error Rspack and Webpack uses different cacheGroups type
96
111
  cacheGroups: {
97
112
  ...currentConfig.cacheGroups,
98
- ...createCacheGroups(extraGroups)
113
+ ...(0, import_shared.createCacheGroups)(extraGroups)
99
114
  }
100
115
  });
101
116
  });
@@ -111,7 +126,7 @@ function pluginVue2(options = {}) {
111
126
  if (!chain.resolve.alias.get("vue$")) {
112
127
  chain.resolve.alias.set("vue$", "vue/dist/vue.runtime.esm.js");
113
128
  }
114
- const vueLoaderOptions = deepmerge(
129
+ const vueLoaderOptions = (0, import_shared2.deepmerge)(
115
130
  {
116
131
  compilerOptions: {
117
132
  preserveWhitespace: false
@@ -120,14 +135,15 @@ function pluginVue2(options = {}) {
120
135
  },
121
136
  options.vueLoaderOptions ?? {}
122
137
  );
123
- chain.module.rule(CHAIN_ID.RULE.VUE).test(/\.vue$/).use(CHAIN_ID.USE.VUE).loader(__require.resolve("vue-loader")).options(vueLoaderOptions);
124
- chain.plugin(CHAIN_ID.PLUGIN.VUE_LOADER_PLUGIN).use(VueLoaderPlugin);
138
+ chain.module.rule(CHAIN_ID.RULE.VUE).test(/\.vue$/).use(CHAIN_ID.USE.VUE).loader(require.resolve("vue-loader")).options(vueLoaderOptions);
139
+ chain.plugin(CHAIN_ID.PLUGIN.VUE_LOADER_PLUGIN).use(import_vue_loader.VueLoaderPlugin);
125
140
  chain.plugin(CHAIN_ID.PLUGIN.VUE_LOADER_15_PITCH_FIX_PLUGIN).use(VueLoader15PitchFixPlugin);
126
141
  });
127
142
  applySplitChunksRule(api, options.splitChunks);
128
143
  }
129
144
  };
130
145
  }
131
- export {
146
+ // Annotate the CommonJS export names for ESM import in node:
147
+ 0 && (module.exports = {
132
148
  pluginVue2
133
- };
149
+ });
package/dist/index.js CHANGED
@@ -1,45 +1,27 @@
1
- "use strict";
2
- var __create = Object.create;
1
+ import { createRequire } from 'module';
2
+ var require = createRequire(import.meta['url']);
3
+
3
4
  var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
5
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
- var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
6
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
7
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
8
+ }) : x)(function(x) {
9
+ if (typeof require !== "undefined")
10
+ return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
30
13
  var __publicField = (obj, key, value) => {
31
14
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
32
15
  return value;
33
16
  };
34
17
 
18
+ // ../../node_modules/.pnpm/@modern-js+module-tools@2.49.3_eslint@8.57.0_typescript@5.4.5/node_modules/@modern-js/module-tools/shims/esm.js
19
+ import { fileURLToPath } from "url";
20
+ import path from "path";
21
+
35
22
  // src/index.ts
36
- var src_exports = {};
37
- __export(src_exports, {
38
- pluginVue2: () => pluginVue2
39
- });
40
- module.exports = __toCommonJS(src_exports);
41
- var import_shared2 = require("@rsbuild/shared");
42
- var import_vue_loader = require("vue-loader");
23
+ import { deepmerge } from "@rsbuild/shared";
24
+ import { VueLoaderPlugin } from "vue-loader";
43
25
 
44
26
  // src/VueLoader15PitchFixPlugin.ts
45
27
  var VueLoader15PitchFixPlugin = class {
@@ -81,7 +63,10 @@ var VueLoader15PitchFixPlugin = class {
81
63
  };
82
64
 
83
65
  // src/splitChunks.ts
84
- var import_shared = require("@rsbuild/shared");
66
+ import {
67
+ createCacheGroups,
68
+ isPlainObject
69
+ } from "@rsbuild/shared";
85
70
  var applySplitChunksRule = (api, options = {
86
71
  vue: true,
87
72
  router: true
@@ -92,7 +77,7 @@ var applySplitChunksRule = (api, options = {
92
77
  return;
93
78
  }
94
79
  const currentConfig = chain.optimization.splitChunks.values();
95
- if (!(0, import_shared.isPlainObject)(currentConfig)) {
80
+ if (!isPlainObject(currentConfig)) {
96
81
  return;
97
82
  }
98
83
  const extraGroups = {};
@@ -110,7 +95,7 @@ var applySplitChunksRule = (api, options = {
110
95
  // @ts-expect-error Rspack and Webpack uses different cacheGroups type
111
96
  cacheGroups: {
112
97
  ...currentConfig.cacheGroups,
113
- ...(0, import_shared.createCacheGroups)(extraGroups)
98
+ ...createCacheGroups(extraGroups)
114
99
  }
115
100
  });
116
101
  });
@@ -126,7 +111,7 @@ function pluginVue2(options = {}) {
126
111
  if (!chain.resolve.alias.get("vue$")) {
127
112
  chain.resolve.alias.set("vue$", "vue/dist/vue.runtime.esm.js");
128
113
  }
129
- const vueLoaderOptions = (0, import_shared2.deepmerge)(
114
+ const vueLoaderOptions = deepmerge(
130
115
  {
131
116
  compilerOptions: {
132
117
  preserveWhitespace: false
@@ -135,15 +120,14 @@ function pluginVue2(options = {}) {
135
120
  },
136
121
  options.vueLoaderOptions ?? {}
137
122
  );
138
- chain.module.rule(CHAIN_ID.RULE.VUE).test(/\.vue$/).use(CHAIN_ID.USE.VUE).loader(require.resolve("vue-loader")).options(vueLoaderOptions);
139
- chain.plugin(CHAIN_ID.PLUGIN.VUE_LOADER_PLUGIN).use(import_vue_loader.VueLoaderPlugin);
123
+ chain.module.rule(CHAIN_ID.RULE.VUE).test(/\.vue$/).use(CHAIN_ID.USE.VUE).loader(__require.resolve("vue-loader")).options(vueLoaderOptions);
124
+ chain.plugin(CHAIN_ID.PLUGIN.VUE_LOADER_PLUGIN).use(VueLoaderPlugin);
140
125
  chain.plugin(CHAIN_ID.PLUGIN.VUE_LOADER_15_PITCH_FIX_PLUGIN).use(VueLoader15PitchFixPlugin);
141
126
  });
142
127
  applySplitChunksRule(api, options.splitChunks);
143
128
  }
144
129
  };
145
130
  }
146
- // Annotate the CommonJS export names for ESM import in node:
147
- 0 && (module.exports = {
131
+ export {
148
132
  pluginVue2
149
- });
133
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/plugin-vue2",
3
- "version": "0.6.15",
3
+ "version": "0.7.0-beta.1",
4
4
  "description": "Vue 2 plugin of Rsbuild",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "repository": {
@@ -9,15 +9,15 @@
9
9
  "directory": "packages/plugin-vue2"
10
10
  },
11
11
  "license": "MIT",
12
- "type": "commonjs",
12
+ "type": "module",
13
13
  "exports": {
14
14
  ".": {
15
15
  "types": "./dist/index.d.ts",
16
- "import": "./dist/index.mjs",
17
- "default": "./dist/index.js"
16
+ "import": "./dist/index.js",
17
+ "require": "./dist/index.cjs"
18
18
  }
19
19
  },
20
- "main": "./dist/index.js",
20
+ "main": "./dist/index.cjs",
21
21
  "types": "./dist/index.d.ts",
22
22
  "files": [
23
23
  "dist"
@@ -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.15"
28
+ "@rsbuild/shared": "0.7.0-beta.1"
29
29
  },
30
30
  "devDependencies": {
31
31
  "typescript": "^5.4.2",
32
32
  "webpack": "^5.91.0",
33
- "@rsbuild/core": "0.6.15",
34
- "@scripts/test-helper": "0.6.15"
33
+ "@rsbuild/core": "0.7.0-beta.1",
34
+ "@scripts/test-helper": "0.7.0-beta.1"
35
35
  },
36
36
  "peerDependencies": {
37
- "@rsbuild/core": "^0.6.15"
37
+ "@rsbuild/core": "^0.7.0-beta.1"
38
38
  },
39
39
  "publishConfig": {
40
40
  "access": "public",