@es-plus/vue2 1.0.1 → 1.0.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.
@@ -1,18 +1,20 @@
1
1
  /**
2
- * Vue 2 兼容层 —— 单点 re-export
2
+ * Vue 2 兼容层 —— 直接从 @vue/composition-api 导入
3
3
  *
4
- * 设计目标:
5
- * - 源码统一 `import { ref } from './vue-compat'`,不直接从 'vue' 导入
6
- * - 这样 Vue 2.6 / Vue 2.7 / 未来切换 vue-demi 都只改这一个文件
4
+ * @vue/composition-api 在不同环境下的行为:
5
+ * - Vue 2.7+:@vue/composition-api@1.7+ postinstall 会自动 redirect vue 原生 Composition API
6
+ * - Vue 2.6:提供完整的 Composition API polyfill
7
7
  *
8
- * 当前实现:从 'vue' 直接 re-export
9
- * - Vue 2.7+:原生支持 Composition API,开箱即用
10
- * - Vue 2.6:用户需在 main.js 调用 Vue.use(VueCompositionAPI)
11
- * 并配置 bundler resolve.alias('vue', '@vue/composition-api')
12
- * (或直接升级到 2.7+,更省事)
8
+ * 用户只需:
9
+ * 1. npm install @vue/composition-api
10
+ * 2. main.js Vue.use(VueCompositionAPI)(Vue 2.6 必须,Vue 2.7 可选)
13
11
  *
14
- * Vue 实例本身(Vue.extend / Vue.component)也由本文件暴露,供 useDialog 编程式弹窗使用。
12
+ * 不使用 vue-demi 的原因:
13
+ * vue-demi 在嵌套 node_modules 安装时(monorepo / npm workspace),其 postinstall
14
+ * 会解析到 @es-plus/vue2 的 devDependency vue@2.7 而非用户项目的 vue@2.6,
15
+ * 导致生成了错误的 lib 版本(尝试从 vue 导入 getCurrentInstance),
16
+ * 在 Vue 2.6 环境下产生 "export 'xxx' was not found in 'vue'" 错误。
15
17
  */
16
- export { default as Vue, ref, reactive, computed, watch, watchEffect, onMounted, onUnmounted, onBeforeUnmount, onBeforeMount, onUpdated, onActivated, onDeactivated, defineComponent, inject, provide, nextTick, getCurrentInstance, toRefs, toRef, unref, isRef, h, } from 'vue';
17
- export type { PropType, Ref, ComputedRef, WatchSource } from 'vue';
18
+ export { default as Vue, ref, reactive, computed, watch, watchEffect, onMounted, onUnmounted, onBeforeUnmount, onBeforeMount, onUpdated, onActivated, onDeactivated, defineComponent, inject, provide, nextTick, getCurrentInstance, toRefs, toRef, unref, isRef, h, } from '@vue/composition-api';
19
+ export type { PropType, Ref, ComputedRef, WatchSource } from '@vue/composition-api';
18
20
  //# sourceMappingURL=vue-compat.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"vue-compat.d.ts","sourceRoot":"","sources":["../src/vue-compat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,OAAO,IAAI,GAAG,EACd,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,eAAe,EACf,aAAa,EACb,SAAS,EACT,WAAW,EACX,aAAa,EACb,eAAe,EACf,MAAM,EACN,OAAO,EACP,QAAQ,EACR,kBAAkB,EAClB,MAAM,EACN,KAAK,EACL,KAAK,EACL,KAAK,EACL,CAAC,GACF,MAAM,KAAK,CAAA;AAEZ,YAAY,EAAE,QAAQ,EAAE,GAAG,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,KAAK,CAAA"}
1
+ {"version":3,"file":"vue-compat.d.ts","sourceRoot":"","sources":["../src/vue-compat.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,OAAO,IAAI,GAAG,EACd,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,eAAe,EACf,aAAa,EACb,SAAS,EACT,WAAW,EACX,aAAa,EACb,eAAe,EACf,MAAM,EACN,OAAO,EACP,QAAQ,EACR,kBAAkB,EAClB,MAAM,EACN,KAAK,EACL,KAAK,EACL,KAAK,EACL,CAAC,GACF,MAAM,sBAAsB,CAAA;AAE7B,YAAY,EAAE,QAAQ,EAAE,GAAG,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA"}
package/package.json CHANGED
@@ -1,86 +1,82 @@
1
- {
2
- "name": "@es-plus/vue2",
3
- "version": "1.0.1",
4
- "description": "es-plus for Vue 2 + Element UI: configuration-driven enterprise components, sharing the same JSON config schema as @es-plus/vue3 (Vue 3 + Element Plus)",
5
- "main": "./dist/es-plus-vue2.umd.cjs",
6
- "module": "./dist/es-plus-vue2.js",
7
- "types": "./dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "import": "./dist/es-plus-vue2.js",
11
- "require": "./dist/es-plus-vue2.umd.cjs",
12
- "types": "./dist/index.d.ts"
13
- },
14
- "./dist/style.css": "./dist/style.css"
15
- },
16
- "files": [
17
- "dist",
18
- "README.md"
19
- ],
20
- "sideEffects": [
21
- "**/*.css"
22
- ],
23
- "scripts": {
24
- "typecheck": "tsc --noEmit -p tsconfig.build.json",
25
- "build": "vite build",
26
- "prepublishOnly": "npm run typecheck && npm run build",
27
- "pretest": "vite build",
28
- "test": "vitest run",
29
- "test:watch": "vitest"
30
- },
31
- "keywords": [
32
- "vue2",
33
- "vue",
34
- "element-ui",
35
- "component-library",
36
- "form",
37
- "table",
38
- "dialog",
39
- "es-plus",
40
- "typescript",
41
- "enterprise",
42
- "config-driven",
43
- "crud",
44
- "json-schema"
45
- ],
46
- "author": "liujiaao <303363554@qq.com>",
47
- "license": "MIT",
48
- "repository": {
49
- "type": "git",
50
- "url": "https://github.com/liujiaao/es-plus.git",
51
- "directory": "packages/vue2"
52
- },
53
- "homepage": "https://liujiaao.github.io/es-plus/",
54
- "bugs": {
55
- "url": "https://github.com/liujiaao/es-plus/issues"
56
- },
57
- "publishConfig": {
58
- "access": "public",
59
- "registry": "https://registry.npmjs.org/"
60
- },
61
- "peerDependencies": {
62
- "@vue/composition-api": "^1.7.0",
63
- "element-ui": "^2.15.0",
64
- "vue": "^2.6.14"
65
- },
66
- "peerDependenciesMeta": {
67
- "@vue/composition-api": {
68
- "optional": true
69
- }
70
- },
71
- "dependencies": {
72
- "@es-plus/core": "^1.0.0"
73
- },
74
- "devDependencies": {
75
- "@types/node": "^20.0.0",
76
- "@vitejs/plugin-vue2": "^2.3.0",
77
- "element-ui": "^2.15.14",
78
- "sass": "^1.70.0",
79
- "typescript": "^5.3.0",
80
- "vite": "^5.0.0",
81
- "vite-plugin-dts": "^3.7.0",
82
- "vitest": "^1.2.0",
83
- "vue": "^2.7.16",
84
- "vue-template-compiler": "^2.7.16"
85
- }
86
- }
1
+ {
2
+ "name": "@es-plus/vue2",
3
+ "version": "1.0.3",
4
+ "description": "es-plus for Vue 2 + Element UI: configuration-driven enterprise components, sharing the same JSON config schema as @es-plus/vue3 (Vue 3 + Element Plus)",
5
+ "main": "./dist/es-plus-vue2.umd.cjs",
6
+ "module": "./dist/es-plus-vue2.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/es-plus-vue2.js",
11
+ "require": "./dist/es-plus-vue2.umd.cjs",
12
+ "types": "./dist/index.d.ts"
13
+ },
14
+ "./dist/style.css": "./dist/style.css"
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "README.md"
19
+ ],
20
+ "sideEffects": [
21
+ "**/*.css"
22
+ ],
23
+ "scripts": {
24
+ "typecheck": "tsc --noEmit -p tsconfig.build.json",
25
+ "build": "vite build",
26
+ "prepublishOnly": "npm run typecheck && npm run build",
27
+ "pretest": "vite build",
28
+ "test": "vitest run",
29
+ "test:watch": "vitest"
30
+ },
31
+ "keywords": [
32
+ "vue2",
33
+ "vue",
34
+ "element-ui",
35
+ "component-library",
36
+ "form",
37
+ "table",
38
+ "dialog",
39
+ "es-plus",
40
+ "typescript",
41
+ "enterprise",
42
+ "config-driven",
43
+ "crud",
44
+ "json-schema"
45
+ ],
46
+ "author": "liujiaao <303363554@qq.com>",
47
+ "license": "MIT",
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "https://github.com/liujiaao/es-plus.git",
51
+ "directory": "packages/vue2"
52
+ },
53
+ "homepage": "https://liujiaao.github.io/es-plus/",
54
+ "bugs": {
55
+ "url": "https://github.com/liujiaao/es-plus/issues"
56
+ },
57
+ "publishConfig": {
58
+ "access": "public",
59
+ "registry": "https://registry.npmjs.org/"
60
+ },
61
+ "peerDependencies": {
62
+ "@vue/composition-api": "^1.7.0",
63
+ "element-ui": "^2.15.0",
64
+ "vue": "^2.6.14"
65
+ },
66
+ "dependencies": {
67
+ "@es-plus/core": "^1.0.0"
68
+ },
69
+ "devDependencies": {
70
+ "@types/node": "^20.0.0",
71
+ "@vue/composition-api": "^1.7.2",
72
+ "@vitejs/plugin-vue2": "^2.3.0",
73
+ "element-ui": "^2.15.14",
74
+ "sass": "^1.70.0",
75
+ "typescript": "^5.3.0",
76
+ "vite": "^5.0.0",
77
+ "vite-plugin-dts": "^3.7.0",
78
+ "vitest": "^1.2.0",
79
+ "vue": "^2.7.16",
80
+ "vue-template-compiler": "^2.7.16"
81
+ }
82
+ }