houwenjian 1.0.5 → 1.0.8
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/dist/houwenjian.es.js +22 -0
- package/dist/houwenjian.umd.js +1 -0
- package/package.json +29 -17
- package/src/index.js +1 -4
- package/src/test.vue +9 -0
- package/test/index.test.js +29 -0
- package/vite.config.js +10 -8
- package/src/components/RichEditor.vue +0 -11
- package/src/components/coloreditor.vue +0 -14
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { openBlock as l, createElementBlock as s, createElementVNode as o } from "vue";
|
|
2
|
+
const i = (t, e) => {
|
|
3
|
+
const n = t.__vccOpts || t;
|
|
4
|
+
for (const [r, c] of e)
|
|
5
|
+
n[r] = c;
|
|
6
|
+
return n;
|
|
7
|
+
}, d = {};
|
|
8
|
+
function m(t, e) {
|
|
9
|
+
return l(), s("div", null, [...e[0] || (e[0] = [
|
|
10
|
+
o("h2", null, "npm module test", -1),
|
|
11
|
+
o("h2", null, "作者 侯文建", -1)
|
|
12
|
+
])]);
|
|
13
|
+
}
|
|
14
|
+
const u = /* @__PURE__ */ i(d, [["render", m]]), a = {
|
|
15
|
+
install(t) {
|
|
16
|
+
t.component("RichEditor", u);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
u as RichEditor,
|
|
21
|
+
a as default
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.houwenjian={},e.Vue))})(this,function(e,t){"use strict";const d=(n,o)=>{const c=n.__vccOpts||n;for(const[s,f]of o)c[s]=f;return c},r={};function u(n,o){return t.openBlock(),t.createElementBlock("div",null,[...o[0]||(o[0]=[t.createElementVNode("h2",null,"npm module test",-1),t.createElementVNode("h2",null,"作者 侯文建",-1)])])}const i=d(r,[["render",u]]),l={install(n){n.component("RichEditor",i)}};e.RichEditor=i,e.default=l,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -1,24 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "houwenjian",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"
|
|
3
|
+
"version": "1.0.8",
|
|
4
|
+
"description": "Vue-based npm package built with Vite (JavaScript version)",
|
|
5
|
+
"main": "dist/houwenjian.umd.js",
|
|
6
|
+
"module": "dist/houwenjian.es.js",
|
|
7
|
+
"types": "dist/houwenjian.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"dev": "vite build --watch",
|
|
10
|
+
"build": "vite build",
|
|
11
|
+
"test": "vitest --environment jsdom",
|
|
12
|
+
"prepublishOnly": "npm run build && npm test"
|
|
13
|
+
},
|
|
5
14
|
"dependencies": {
|
|
6
|
-
"
|
|
7
|
-
"entities": "^7.0.0",
|
|
8
|
-
"estree-walker": "^2.0.2",
|
|
9
|
-
"magic-string": "^0.30.21",
|
|
10
|
-
"nanoid": "^3.3.11",
|
|
11
|
-
"picocolors": "^1.1.1",
|
|
12
|
-
"postcss": "^8.5.6",
|
|
13
|
-
"source-map-js": "^1.2.1",
|
|
14
|
-
"vue": "^3.5.26",
|
|
15
|
-
"rollup-plugin-peer-deps-external": "^2.2.4"
|
|
15
|
+
"vue": "^3.2.0"
|
|
16
16
|
},
|
|
17
|
-
"devDependencies": {
|
|
18
|
-
|
|
19
|
-
"test": "
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@vitejs/plugin-vue": "^4.0.0",
|
|
19
|
+
"@vue/test-utils": "^2.4.6",
|
|
20
|
+
"jsdom": "^22.1.0",
|
|
21
|
+
"vite": "^4.0.0",
|
|
22
|
+
"vitest": "^0.34.6"
|
|
20
23
|
},
|
|
21
|
-
"author": "",
|
|
24
|
+
"author": "HOU WEN JIAN",
|
|
22
25
|
"license": "ISC",
|
|
23
|
-
"
|
|
26
|
+
"vitest": {
|
|
27
|
+
"coverage": {
|
|
28
|
+
"reporter": ["text", "json", "html"],
|
|
29
|
+
"thresholds": {
|
|
30
|
+
"functions": 100,
|
|
31
|
+
"branches": 100,
|
|
32
|
+
"lines": 100
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
24
36
|
}
|
package/src/index.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import RichEditor from './
|
|
1
|
+
import RichEditor from './test.vue';
|
|
2
2
|
|
|
3
3
|
// 定义插件安装方法(Vue3标准方式)
|
|
4
4
|
export default {
|
|
5
5
|
install(app) {
|
|
6
6
|
// 注册全局组件
|
|
7
7
|
app.component('RichEditor', RichEditor);
|
|
8
|
-
|
|
9
|
-
// 可选:暴露其他功能(如指令、服务等)
|
|
10
|
-
// app.config.globalProperties.$editor = ...;
|
|
11
8
|
}
|
|
12
9
|
};
|
|
13
10
|
|
package/src/test.vue
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { mount } from '@vue/test-utils';
|
|
3
|
+
import { RichEditor } from '../src/index';
|
|
4
|
+
|
|
5
|
+
describe('RichEditor', () => {
|
|
6
|
+
// 基础渲染测试
|
|
7
|
+
it('renders correctly', () => {
|
|
8
|
+
const wrapper = mount(RichEditor);
|
|
9
|
+
|
|
10
|
+
// 获取所有h2元素
|
|
11
|
+
const h2Elements = wrapper.findAll('h2');
|
|
12
|
+
|
|
13
|
+
// 验证组件渲染的DOM结构
|
|
14
|
+
expect(h2Elements[0].text()).toContain('npm module test');
|
|
15
|
+
expect(h2Elements[1].text()).toContain('作者 侯文建');
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// 组件属性测试
|
|
19
|
+
it('handles props correctly', async () => {
|
|
20
|
+
// 如果有需要测试的props,在这里添加具体用例
|
|
21
|
+
const wrapper = mount(RichEditor);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// 组件事件测试
|
|
25
|
+
it('emits events correctly', async () => {
|
|
26
|
+
// 如果有需要测试的事件,在这里添加具体用例
|
|
27
|
+
const wrapper = mount(RichEditor);
|
|
28
|
+
});
|
|
29
|
+
});
|
package/vite.config.js
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import { defineConfig } from 'vite';
|
|
2
2
|
import vue from '@vitejs/plugin-vue';
|
|
3
|
-
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
|
|
4
3
|
|
|
5
4
|
export default defineConfig({
|
|
5
|
+
plugins: [vue()],
|
|
6
6
|
build: {
|
|
7
7
|
lib: {
|
|
8
|
-
entry: './src/index.js',
|
|
9
|
-
name: '
|
|
10
|
-
fileName: (format) => `
|
|
8
|
+
entry: './src/index.js',
|
|
9
|
+
name: 'houwenjian',
|
|
10
|
+
fileName: (format) => `houwenjian.${format}.js`
|
|
11
11
|
},
|
|
12
12
|
rollupOptions: {
|
|
13
|
-
external: ['vue'],
|
|
14
|
-
plugins: [peerDepsExternal()],
|
|
13
|
+
external: ['vue'],
|
|
15
14
|
output: {
|
|
16
15
|
globals: {
|
|
17
|
-
vue: 'Vue'
|
|
16
|
+
vue: 'Vue'
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
19
|
}
|
|
21
20
|
},
|
|
22
|
-
|
|
21
|
+
test: {
|
|
22
|
+
environment: 'jsdom', // 配置测试环境为JSDOM
|
|
23
|
+
globals: true
|
|
24
|
+
}
|
|
23
25
|
});
|