@rsbuild/plugin-vue2 0.0.0-nightly-20231017160746

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023-present Bytedance, Inc. and its affiliates.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,24 @@
1
+ <p align="center">
2
+ <a href="https://rsbuild.dev" target="blank"><img src="https://github.com/web-infra-dev/rsbuild/assets/7237365/84abc13e-b620-468f-a90b-dbf28e7e9427" alt="Rsbuild Logo" /></a>
3
+ </p>
4
+
5
+ # Rsbuild
6
+
7
+ Unleash the power of Rspack with the out-of-the-box build tool.
8
+
9
+ ## Getting Started
10
+
11
+ Please follow [Quick Start](https://rsbuild.dev/guides/get-started/quick-start) to get started with Rsbuild.
12
+
13
+ ## Documentation
14
+
15
+ - [English Documentation](https://rsbuild.dev/)
16
+ - [中文文档](https://rsbuild.dev/zh)
17
+
18
+ ## Contributing
19
+
20
+ Please read the [Contributing Guide](https://github.com/web-infra-dev/rsbuild/blob/main/CONTRIBUTING.md).
21
+
22
+ ## License
23
+
24
+ Rsbuild is [MIT licensed](https://github.com/web-infra-dev/rsbuild/blob/main/LICENSE).
@@ -0,0 +1,16 @@
1
+ import type { BuilderPlugin } from '@rsbuild/core';
2
+ import type { BuilderPluginAPI } from '@modern-js/builder-webpack-provider';
3
+ import type { VueLoaderOptions } from 'vue-loader';
4
+ type VueJSXPresetOptions = {
5
+ compositionAPI?: boolean | string;
6
+ functional?: boolean;
7
+ injectH?: boolean;
8
+ vModel?: boolean;
9
+ vOn?: boolean;
10
+ };
11
+ export type PluginVueOptions = {
12
+ vueJsxOptions?: VueJSXPresetOptions;
13
+ vueLoaderOptions?: VueLoaderOptions;
14
+ };
15
+ export declare function builderPluginVue2(options?: PluginVueOptions): BuilderPlugin<BuilderPluginAPI>;
16
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ var __create = Object.create;
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;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var src_exports = {};
30
+ __export(src_exports, {
31
+ builderPluginVue2: () => builderPluginVue2
32
+ });
33
+ module.exports = __toCommonJS(src_exports);
34
+ var import_deepmerge = require("@rsbuild/shared/deepmerge");
35
+ var import_vue_loader = require("vue-loader");
36
+ function builderPluginVue2(options = {}) {
37
+ return {
38
+ name: "builder-plugin-vue2",
39
+ // Remove built-in react plugins.
40
+ // These plugins should be moved to a separate package in the next major version.
41
+ remove: [
42
+ "builder-plugin-react",
43
+ "builder-plugin-antd",
44
+ "builder-plugin-arco"
45
+ ],
46
+ async setup(api) {
47
+ api.modifyBuilderConfig((config, { mergeBuilderConfig }) => {
48
+ const builderConfig = {
49
+ output: {
50
+ disableSvgr: true
51
+ },
52
+ tools: {
53
+ babel(_, { addPresets }) {
54
+ addPresets([
55
+ [
56
+ require.resolve("@vue/babel-preset-jsx"),
57
+ {
58
+ injectH: true,
59
+ ...options.vueJsxOptions
60
+ }
61
+ ]
62
+ ]);
63
+ }
64
+ }
65
+ };
66
+ if (api.context.bundlerType === "rspack") {
67
+ builderConfig.output.disableCssExtract = true;
68
+ }
69
+ return mergeBuilderConfig(config, builderConfig);
70
+ });
71
+ api.modifyBundlerChain(async (chain, { CHAIN_ID }) => {
72
+ var _a;
73
+ chain.resolve.extensions.add(".vue");
74
+ const vueLoaderOptions = (0, import_deepmerge.deepmerge)(
75
+ {
76
+ compilerOptions: {
77
+ preserveWhitespace: false
78
+ }
79
+ },
80
+ (_a = options.vueLoaderOptions) != null ? _a : {}
81
+ );
82
+ chain.module.rule(CHAIN_ID.RULE.VUE).test(/\.vue$/).use(CHAIN_ID.USE.VUE).loader(require.resolve("vue-loader")).options(vueLoaderOptions);
83
+ chain.plugin(CHAIN_ID.PLUGIN.VUE_LOADER_PLUGIN).use(import_vue_loader.VueLoaderPlugin);
84
+ });
85
+ }
86
+ };
87
+ }
88
+ // Annotate the CommonJS export names for ESM import in node:
89
+ 0 && (module.exports = {
90
+ builderPluginVue2
91
+ });
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@rsbuild/plugin-vue2",
3
+ "description": "Vue 2 plugin of Rsbuild",
4
+ "homepage": "https://rsbuild.dev",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/web-infra-dev/rsbuild",
8
+ "directory": "packages/plugin-vue"
9
+ },
10
+ "license": "MIT",
11
+ "version": "0.0.0-nightly-20231017160746",
12
+ "types": "./dist/index.d.ts",
13
+ "main": "./dist/index.js",
14
+ "module": "./dist/index.js",
15
+ "exports": {
16
+ ".": {
17
+ "default": "./dist/index.js"
18
+ }
19
+ },
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "dependencies": {
24
+ "@vue/babel-preset-jsx": "^1.4.0",
25
+ "vue-loader": "^15.10.1",
26
+ "@rsbuild/shared": "0.0.0-nightly-20231017160746"
27
+ },
28
+ "devDependencies": {
29
+ "@babel/core": "^7.22.15",
30
+ "@modern-js/builder-webpack-provider": "^2.36.0",
31
+ "@modern-js/builder-rspack-provider": "^2.36.0",
32
+ "typescript": "^5",
33
+ "webpack": "^5.88.1",
34
+ "@rsbuild/core": "0.0.0-nightly-20231017160746"
35
+ },
36
+ "peerDependencies": {
37
+ "@modern-js/builder-webpack-provider": "^2.36.0",
38
+ "@modern-js/builder-rspack-provider": "^2.36.0"
39
+ },
40
+ "peerDependenciesMeta": {
41
+ "@modern-js/builder-webpack-provider": {
42
+ "optional": true
43
+ },
44
+ "@modern-js/builder-rspack-provider": {
45
+ "optional": true
46
+ }
47
+ },
48
+ "sideEffects": false,
49
+ "publishConfig": {
50
+ "registry": "https://registry.npmjs.org/",
51
+ "access": "public",
52
+ "provenance": true
53
+ },
54
+ "scripts": {
55
+ "dev": "modern build --watch",
56
+ "build": "modern build"
57
+ }
58
+ }