@empjs/plugin-vue3 3.0.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.
@@ -0,0 +1,12 @@
1
+ import type { GlobalStore } from '@empjs/cli';
2
+ declare const _default: () => {
3
+ name: string;
4
+ rsConfig(store: GlobalStore): Promise<void>;
5
+ };
6
+ export default _default;
7
+ /**
8
+ * @vue/compiler-sfc
9
+ * Note: as of 3.2.13+, this package is included as a dependency of the main vue package and can be accessed as vue/compiler-sfc.
10
+ * This means you no longer need to explicitly install this package and ensure its version match that of vue's.
11
+ * Just use the main vue/compiler-sfc deep import instead.
12
+ */
package/dist/index.js ADDED
@@ -0,0 +1,84 @@
1
+ import { VueLoaderPlugin } from 'vue-loader';
2
+ //
3
+ export default () => {
4
+ return {
5
+ name: '@empjs/plugin-vue3',
6
+ async rsConfig(store) {
7
+ const { importResolve, chain } = store;
8
+ //
9
+ // reset
10
+ chain.module.rule('javascript').uses.clear().end();
11
+ chain.module.rule('typescript').uses.clear().end();
12
+ // plugin
13
+ chain.plugin('vue-loader-plugin').use(VueLoaderPlugin, []);
14
+ // module
15
+ chain.module
16
+ .rule('vue-loader')
17
+ .test(/\.vue$/)
18
+ .use('vue-loader')
19
+ .loader(importResolve('vue-loader', import.meta.url))
20
+ .options({
21
+ compilerOptions: {
22
+ preserveWhitespace: false,
23
+ },
24
+ experimentalInlineMatchResource: true,
25
+ })
26
+ .end();
27
+ //jsx and tsx compile
28
+ chain.module
29
+ .rule('vue-jsx-tsx')
30
+ // .test(/\.(js|jsx|ts|tsx)$/)
31
+ .test(/\.(jsx|tsx)$/)
32
+ .use('babel-loader')
33
+ .loader(importResolve('babel-loader'))
34
+ .options({
35
+ presets: [
36
+ [
37
+ importResolve('@babel/preset-typescript', import.meta.url),
38
+ {
39
+ isTSX: true,
40
+ allExtensions: true, // 支持所有文件扩展名
41
+ },
42
+ ],
43
+ ],
44
+ plugins: [[importResolve('@vue/babel-plugin-jsx', import.meta.url), { optimize: true }]],
45
+ })
46
+ .end();
47
+ // chain config
48
+ store.chain.merge({
49
+ module: {
50
+ rule: {
51
+ svg: {
52
+ type: 'asset/resource',
53
+ },
54
+ // vue js and ts compile
55
+ vuejs: {
56
+ test: /\.(js|ts)$/,
57
+ use: [
58
+ {
59
+ loader: 'builtin:swc-loader',
60
+ options: {
61
+ jsc: {
62
+ parser: {
63
+ syntax: 'typescript',
64
+ decorators: true,
65
+ tsx: true,
66
+ dynamicImport: true,
67
+ },
68
+ },
69
+ },
70
+ },
71
+ ],
72
+ },
73
+ },
74
+ },
75
+ });
76
+ },
77
+ };
78
+ };
79
+ /**
80
+ * @vue/compiler-sfc
81
+ * Note: as of 3.2.13+, this package is included as a dependency of the main vue package and can be accessed as vue/compiler-sfc.
82
+ * This means you no longer need to explicitly install this package and ensure its version match that of vue's.
83
+ * Just use the main vue/compiler-sfc deep import instead.
84
+ */
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@empjs/plugin-vue3",
3
+ "version": "3.0.0-beta.1",
4
+ "description": "emp vue3 plugin",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "maintainers": [
11
+ "xuhongbin",
12
+ "ckken"
13
+ ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/empjs/emp.git",
17
+ "directory": "packages/plugin-vue3"
18
+ },
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "keywords": [
23
+ "vue",
24
+ "vue3"
25
+ ],
26
+ "main": "dist/index.js",
27
+ "types": "dist/index.d.ts",
28
+ "exports": {
29
+ ".": "./dist/index.js"
30
+ },
31
+ "scripts": {
32
+ "dev": "rimraf dist && pnpm run /^esdev:.*/",
33
+ "esdev:tsc": "tsc -w",
34
+ "esdev:tsc-alias": "tsc-alias -w",
35
+ "build": "rimraf dist && pnpm run /^esbuild:.*/",
36
+ "esbuild:ts": "tsc && tsc-alias"
37
+ },
38
+ "engines": {
39
+ "node": ">=20.0.0"
40
+ },
41
+ "author": "Ken",
42
+ "devDependencies": {
43
+ "@empjs/cli": "workspace:*",
44
+ "rimraf": "^5.0.5",
45
+ "tsc-alias": "^1.8.8"
46
+ },
47
+ "dependencies": {
48
+ "@babel/preset-typescript": "^7.23.3",
49
+ "@vue/babel-plugin-jsx": "^1.2.1",
50
+ "babel-loader": "^9.1.3",
51
+ "swc-plugin-vue-jsx": "^0.3.0",
52
+ "vue": "^3.4.20",
53
+ "vue-loader": "^17.4.2"
54
+ }
55
+ }