vue-aurora-x-resolver 1.0.0
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/README.md +0 -0
- package/dist/index.d.mts +36 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +78 -0
- package/dist/index.mjs +53 -0
- package/package.json +18 -0
package/README.md
ADDED
File without changes
|
package/dist/index.d.mts
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
interface AuroraXResolverOptions {
|
2
|
+
/**
|
3
|
+
* 排除不需要自动导入的组件
|
4
|
+
*
|
5
|
+
* @default []
|
6
|
+
*/
|
7
|
+
exclude?: string[];
|
8
|
+
/**
|
9
|
+
* 自定义包名
|
10
|
+
*
|
11
|
+
* @default 'aurora-x'
|
12
|
+
*/
|
13
|
+
packageName?: string;
|
14
|
+
/**
|
15
|
+
* 自定义组件前缀
|
16
|
+
*
|
17
|
+
* @default 'Au'
|
18
|
+
*/
|
19
|
+
prefix?: string;
|
20
|
+
}
|
21
|
+
/**
|
22
|
+
* Aurora-X 组件解析器
|
23
|
+
* 用于 unplugin-vue-components 等自动导入工具
|
24
|
+
*/
|
25
|
+
declare function AuroraXResolver(options?: AuroraXResolverOptions): (name: string) => {
|
26
|
+
name: string;
|
27
|
+
from: string;
|
28
|
+
sideEffects: string;
|
29
|
+
};
|
30
|
+
declare function AuroraXNoPrefix(options?: Omit<AuroraXResolverOptions, 'prefix'>): (name: string) => {
|
31
|
+
name: string;
|
32
|
+
from: string;
|
33
|
+
sideEffects: string;
|
34
|
+
};
|
35
|
+
|
36
|
+
export { AuroraXNoPrefix, AuroraXResolver, type AuroraXResolverOptions };
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
interface AuroraXResolverOptions {
|
2
|
+
/**
|
3
|
+
* 排除不需要自动导入的组件
|
4
|
+
*
|
5
|
+
* @default []
|
6
|
+
*/
|
7
|
+
exclude?: string[];
|
8
|
+
/**
|
9
|
+
* 自定义包名
|
10
|
+
*
|
11
|
+
* @default 'aurora-x'
|
12
|
+
*/
|
13
|
+
packageName?: string;
|
14
|
+
/**
|
15
|
+
* 自定义组件前缀
|
16
|
+
*
|
17
|
+
* @default 'Au'
|
18
|
+
*/
|
19
|
+
prefix?: string;
|
20
|
+
}
|
21
|
+
/**
|
22
|
+
* Aurora-X 组件解析器
|
23
|
+
* 用于 unplugin-vue-components 等自动导入工具
|
24
|
+
*/
|
25
|
+
declare function AuroraXResolver(options?: AuroraXResolverOptions): (name: string) => {
|
26
|
+
name: string;
|
27
|
+
from: string;
|
28
|
+
sideEffects: string;
|
29
|
+
};
|
30
|
+
declare function AuroraXNoPrefix(options?: Omit<AuroraXResolverOptions, 'prefix'>): (name: string) => {
|
31
|
+
name: string;
|
32
|
+
from: string;
|
33
|
+
sideEffects: string;
|
34
|
+
};
|
35
|
+
|
36
|
+
export { AuroraXNoPrefix, AuroraXResolver, type AuroraXResolverOptions };
|
package/dist/index.js
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
5
|
+
var __export = (target, all) => {
|
6
|
+
for (var name in all)
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
8
|
+
};
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
11
|
+
for (let key of __getOwnPropNames(from))
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
14
|
+
}
|
15
|
+
return to;
|
16
|
+
};
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
18
|
+
|
19
|
+
// src/index.ts
|
20
|
+
var src_exports = {};
|
21
|
+
__export(src_exports, {
|
22
|
+
AuroraXNoPrefix: () => AuroraXNoPrefix,
|
23
|
+
AuroraXResolver: () => AuroraXResolver
|
24
|
+
});
|
25
|
+
module.exports = __toCommonJS(src_exports);
|
26
|
+
var primitiveNames = /* @__PURE__ */ new Set([
|
27
|
+
"Attachments",
|
28
|
+
"Bubble",
|
29
|
+
"BubbleList",
|
30
|
+
"Config",
|
31
|
+
"Typewriter"
|
32
|
+
// 在这里添加其他组件...
|
33
|
+
]);
|
34
|
+
function isAuroraXComponent(name) {
|
35
|
+
return primitiveNames.has(name);
|
36
|
+
}
|
37
|
+
function AuroraXResolver(options = {}) {
|
38
|
+
const {
|
39
|
+
prefix = "Au",
|
40
|
+
packageName = "aurora-x",
|
41
|
+
exclude = []
|
42
|
+
} = options;
|
43
|
+
return (name) => {
|
44
|
+
if (!name.startsWith(prefix))
|
45
|
+
return;
|
46
|
+
const componentName = name.slice(prefix.length);
|
47
|
+
if (!isAuroraXComponent(componentName) || exclude.includes(componentName))
|
48
|
+
return;
|
49
|
+
return {
|
50
|
+
// 返回组件信息
|
51
|
+
name: `Au${componentName}`,
|
52
|
+
// 从包中导入带前缀的组件
|
53
|
+
from: packageName,
|
54
|
+
sideEffects: `${packageName}/dist/es/${componentName}/index.css`
|
55
|
+
// 自动导入对应的CSS
|
56
|
+
};
|
57
|
+
};
|
58
|
+
}
|
59
|
+
function AuroraXNoPrefix(options = {}) {
|
60
|
+
const {
|
61
|
+
packageName = "aurora-x",
|
62
|
+
exclude = []
|
63
|
+
} = options;
|
64
|
+
return (name) => {
|
65
|
+
if (!isAuroraXComponent(name) || exclude.includes(name))
|
66
|
+
return;
|
67
|
+
return {
|
68
|
+
name,
|
69
|
+
from: packageName,
|
70
|
+
sideEffects: `${packageName}/dist/es/${name}/index.css`
|
71
|
+
};
|
72
|
+
};
|
73
|
+
}
|
74
|
+
// Annotate the CommonJS export names for ESM import in node:
|
75
|
+
0 && (module.exports = {
|
76
|
+
AuroraXNoPrefix,
|
77
|
+
AuroraXResolver
|
78
|
+
});
|
package/dist/index.mjs
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
// src/index.ts
|
2
|
+
var primitiveNames = /* @__PURE__ */ new Set([
|
3
|
+
"Attachments",
|
4
|
+
"Bubble",
|
5
|
+
"BubbleList",
|
6
|
+
"Config",
|
7
|
+
"Typewriter"
|
8
|
+
// 在这里添加其他组件...
|
9
|
+
]);
|
10
|
+
function isAuroraXComponent(name) {
|
11
|
+
return primitiveNames.has(name);
|
12
|
+
}
|
13
|
+
function AuroraXResolver(options = {}) {
|
14
|
+
const {
|
15
|
+
prefix = "Au",
|
16
|
+
packageName = "aurora-x",
|
17
|
+
exclude = []
|
18
|
+
} = options;
|
19
|
+
return (name) => {
|
20
|
+
if (!name.startsWith(prefix))
|
21
|
+
return;
|
22
|
+
const componentName = name.slice(prefix.length);
|
23
|
+
if (!isAuroraXComponent(componentName) || exclude.includes(componentName))
|
24
|
+
return;
|
25
|
+
return {
|
26
|
+
// 返回组件信息
|
27
|
+
name: `Au${componentName}`,
|
28
|
+
// 从包中导入带前缀的组件
|
29
|
+
from: packageName,
|
30
|
+
sideEffects: `${packageName}/dist/es/${componentName}/index.css`
|
31
|
+
// 自动导入对应的CSS
|
32
|
+
};
|
33
|
+
};
|
34
|
+
}
|
35
|
+
function AuroraXNoPrefix(options = {}) {
|
36
|
+
const {
|
37
|
+
packageName = "aurora-x",
|
38
|
+
exclude = []
|
39
|
+
} = options;
|
40
|
+
return (name) => {
|
41
|
+
if (!isAuroraXComponent(name) || exclude.includes(name))
|
42
|
+
return;
|
43
|
+
return {
|
44
|
+
name,
|
45
|
+
from: packageName,
|
46
|
+
sideEffects: `${packageName}/dist/es/${name}/index.css`
|
47
|
+
};
|
48
|
+
};
|
49
|
+
}
|
50
|
+
export {
|
51
|
+
AuroraXNoPrefix,
|
52
|
+
AuroraXResolver
|
53
|
+
};
|
package/package.json
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
{
|
2
|
+
"name": "vue-aurora-x-resolver",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"main": "dist/index.js",
|
5
|
+
"module": "dist/index.mjs",
|
6
|
+
"types": "dist/index.d.ts",
|
7
|
+
"files": ["dist"],
|
8
|
+
"scripts": {
|
9
|
+
"build": "tsup src/index.ts --format cjs,esm --dts"
|
10
|
+
},
|
11
|
+
"peerDependencies": {
|
12
|
+
"vue-aurora-x": "^1.0.0"
|
13
|
+
},
|
14
|
+
"devDependencies": {
|
15
|
+
"typescript": "~5.8.2",
|
16
|
+
"tsup": "^7.2.0"
|
17
|
+
}
|
18
|
+
}
|