suncy-my-npm-test 1.0.0 → 1.0.2

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,43 @@
1
+ import { defineComponent as r, ref as i } from "vue-demi";
2
+ import { openBlock as s, createElementBlock as a, toDisplayString as p } from "vue";
3
+ const k = (t, n) => {
4
+ const e = t.__vccOpts || t;
5
+ for (const [o, c] of n)
6
+ e[o] = c;
7
+ return e;
8
+ }, m = r({
9
+ name: "MyComponent",
10
+ props: {
11
+ label: {
12
+ type: String,
13
+ default: "Click me"
14
+ }
15
+ },
16
+ emits: ["click"],
17
+ // Vue3 的 emits,Vue2 会自动忽略
18
+ setup(t, { emit: n }) {
19
+ const e = i(0);
20
+ return {
21
+ count: e,
22
+ handleClick: () => {
23
+ e.value++, n("click", e.value);
24
+ }
25
+ };
26
+ },
27
+ // Vue2 选项式 API 兼容
28
+ methods: {
29
+ // 如果需要支持 Vue2 的 $emit 调用
30
+ onClick() {
31
+ this.$emit("click", this.count);
32
+ }
33
+ }
34
+ });
35
+ function u(t, n, e, o, c, d) {
36
+ return s(), a("div", {
37
+ onClick: n[0] || (n[0] = (...l) => t.handleClick && t.handleClick(...l))
38
+ }, " aaaaa=" + p(t.count), 1);
39
+ }
40
+ const h = /* @__PURE__ */ k(m, [["render", u]]);
41
+ export {
42
+ h as default
43
+ };
@@ -0,0 +1 @@
1
+ (function(e,t){typeof exports=="object"&&typeof module<"u"?module.exports=t(require("vue-demi"),require("vue")):typeof define=="function"&&define.amd?define(["vue-demi","vue"],t):(e=typeof globalThis<"u"?globalThis:e||self,e.MyTest=t(e.VueDemi,e.Vue))})(this,(function(e,t){"use strict";const r=(n,o)=>{const i=n.__vccOpts||n;for(const[s,c]of o)i[s]=c;return i},u=e.defineComponent({name:"MyComponent",props:{label:{type:String,default:"Click me"}},emits:["click"],setup(n,{emit:o}){const i=e.ref(0);return{count:i,handleClick:()=>{i.value++,o("click",i.value)}}},methods:{onClick(){this.$emit("click",this.count)}}});function d(n,o,i,s,c,f){return t.openBlock(),t.createElementBlock("div",{onClick:o[0]||(o[0]=(...l)=>n.handleClick&&n.handleClick(...l))}," aaaaa="+t.toDisplayString(n.count),1)}return r(u,[["render",d]])}));
package/package.json CHANGED
@@ -1,25 +1,49 @@
1
1
  {
2
- "type": "module",
3
- "version": "1.0.0",
4
2
  "name": "suncy-my-npm-test",
5
- "description": "A simple Vue 3 Button component",
6
- "main": "dist/test.es.js",
7
- "module": "dist/test.es.js",
8
- "unpkg": "dist/test.umd.js",
3
+ "version": "1.0.2",
4
+ "type": "module",
5
+ "description": "A Vue component compatible with Vue 2 & 3",
6
+ "main": "dist/index.umd.js",
7
+ "module": "dist/index.esm.js",
8
+ "unpkg": "dist/index.umd.js",
9
+ "jsdelivr": "dist/index.umd.js",
10
+ "types": "dist/index.d.ts",
9
11
  "files": ["dist"],
12
+ "exports": {
13
+ ".": {
14
+ "import": "./dist/index.esm.js",
15
+ "require": "./dist/index.umd.js",
16
+ "types": "./dist/index.d.ts"
17
+ }
18
+ },
10
19
  "scripts": {
11
- "test": "echo \"Error: no test specified\" && exit 1",
20
+ "dev": "vite",
12
21
  "build": "vite build",
13
- "prepublishOnly": "npm run build"
22
+ "build:vue2": "npm run switch:vue2 && npm run build",
23
+ "build:vue3": "npm run switch:vue3 && npm run build",
24
+ "build:all": "npm run build:vue2 && npm run build:vue3",
25
+ "switch:vue2": "vue-demi-switch 2",
26
+ "switch:vue3": "vue-demi-switch 3",
27
+ "prepublishOnly": "npm run build:all",
28
+ "postinstall": "vue-demi-switch 3"
29
+ },
30
+ "peerDependencies": {
31
+ "vue": "^2.6.0 || ^3.0.0"
32
+ },
33
+ "peerDependenciesMeta": {
34
+ "@vue/composition-api": {
35
+ "optional": true
36
+ }
14
37
  },
15
- "keywords": [],
16
- "author": "",
17
- "license": "ISC",
18
38
  "dependencies": {
19
- "vue": "3.5.12"
39
+ "vue-demi": "^0.14.0"
20
40
  },
21
41
  "devDependencies": {
22
42
  "@vitejs/plugin-vue": "^6.0.1",
23
- "vite": "^7.1.2"
43
+ "@vue/composition-api": "^1.7.2",
44
+ "typescript": "^5.0.0",
45
+ "vite": "^7.1.2",
46
+ "vue": "^3.5.12",
47
+ "vue-tsc": "^2.0.0"
24
48
  }
25
- }
49
+ }
package/dist/test.es.js DELETED
@@ -1,14 +0,0 @@
1
- import { createElementBlock as r, openBlock as a } from "vue";
2
- const s = (t, e) => {
3
- const c = t.__vccOpts || t;
4
- for (const [n, o] of e)
5
- c[n] = o;
6
- return c;
7
- }, _ = {};
8
- function f(t, e) {
9
- return a(), r("div", null, " aaaaa ");
10
- }
11
- const p = /* @__PURE__ */ s(_, [["render", f]]);
12
- export {
13
- p as default
14
- };
package/dist/test.umd.js DELETED
@@ -1 +0,0 @@
1
- (function(e,t){typeof exports=="object"&&typeof module<"u"?module.exports=t(require("vue")):typeof define=="function"&&define.amd?define(["vue"],t):(e=typeof globalThis<"u"?globalThis:e||self,e.MyTest=t(e.Vue))})(this,(function(e){"use strict";const t=(n,o)=>{const c=n.__vccOpts||n;for(const[f,i]of o)c[f]=i;return c},s={};function r(n,o){return e.openBlock(),e.createElementBlock("div",null," aaaaa ")}return t(s,[["render",r]])}));