@varlet/import-resolver 3.14.2 → 3.15.0-alpha.1776572752298
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/lib/index.cjs +44 -79
- package/lib/index.d.cts +35 -34
- package/lib/index.d.ts +35 -34
- package/lib/index.js +41 -52
- package/package.json +7 -7
package/lib/index.cjs
CHANGED
|
@@ -1,84 +1,49 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var src_exports = {};
|
|
22
|
-
__export(src_exports, {
|
|
23
|
-
VarletImportResolver: () => VarletImportResolver,
|
|
24
|
-
getResolved: () => getResolved
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(src_exports);
|
|
27
|
-
var import_shared = require("@varlet/shared");
|
|
28
|
-
var varFunctions = [
|
|
29
|
-
"ImagePreview",
|
|
30
|
-
"Snackbar",
|
|
31
|
-
"Picker",
|
|
32
|
-
"ActionSheet",
|
|
33
|
-
"Dialog",
|
|
34
|
-
"Locale",
|
|
35
|
-
"StyleProvider",
|
|
36
|
-
"LoadingBar"
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let _varlet_shared = require("@varlet/shared");
|
|
3
|
+
//#region src/index.ts
|
|
4
|
+
const varFunctions = [
|
|
5
|
+
"ImagePreview",
|
|
6
|
+
"Snackbar",
|
|
7
|
+
"Picker",
|
|
8
|
+
"ActionSheet",
|
|
9
|
+
"Dialog",
|
|
10
|
+
"Locale",
|
|
11
|
+
"StyleProvider",
|
|
12
|
+
"LoadingBar"
|
|
13
|
+
];
|
|
14
|
+
const varDirectives = [
|
|
15
|
+
"Ripple",
|
|
16
|
+
"Lazy",
|
|
17
|
+
"Hover"
|
|
37
18
|
];
|
|
38
|
-
var varDirectives = ["Ripple", "Lazy", "Hover"];
|
|
39
19
|
function getResolved(name, options) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
sideEffects
|
|
49
|
-
};
|
|
20
|
+
const { importStyle = true, autoImport = false } = options;
|
|
21
|
+
const sideEffects = [];
|
|
22
|
+
if (importStyle) sideEffects.push(`@varlet/ui/es/${(0, _varlet_shared.kebabCase)(name)}/style/index.mjs`);
|
|
23
|
+
return {
|
|
24
|
+
from: "@varlet/ui",
|
|
25
|
+
name: autoImport ? name : `_${name}Component`,
|
|
26
|
+
sideEffects
|
|
27
|
+
};
|
|
50
28
|
}
|
|
51
29
|
function VarletImportResolver(options = {}) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const { directives = true } = options;
|
|
69
|
-
if (!directives) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
if (!varDirectives.includes(name)) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
return getResolved(name, options);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
];
|
|
30
|
+
return [{
|
|
31
|
+
type: "component",
|
|
32
|
+
resolve: (name) => {
|
|
33
|
+
const { autoImport = false } = options;
|
|
34
|
+
if (autoImport && varFunctions.includes(name)) return getResolved(name, options);
|
|
35
|
+
if (name.startsWith("Var")) return getResolved(name.slice(3), options);
|
|
36
|
+
}
|
|
37
|
+
}, {
|
|
38
|
+
type: "directive",
|
|
39
|
+
resolve: (name) => {
|
|
40
|
+
const { directives = true } = options;
|
|
41
|
+
if (!directives) return;
|
|
42
|
+
if (!varDirectives.includes(name)) return;
|
|
43
|
+
return getResolved(name, options);
|
|
44
|
+
}
|
|
45
|
+
}];
|
|
79
46
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
getResolved
|
|
84
|
-
});
|
|
47
|
+
//#endregion
|
|
48
|
+
exports.VarletImportResolver = VarletImportResolver;
|
|
49
|
+
exports.getResolved = getResolved;
|
package/lib/index.d.cts
CHANGED
|
@@ -1,42 +1,43 @@
|
|
|
1
|
+
//#region src/index.d.ts
|
|
1
2
|
interface VarletImportResolverOptions {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
3
|
+
/**
|
|
4
|
+
* compatible with unplugin-auto-import
|
|
5
|
+
*
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
autoImport?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* whether to import style
|
|
11
|
+
*
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
importStyle?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* auto import for directives
|
|
17
|
+
*
|
|
18
|
+
* @default true
|
|
19
|
+
*/
|
|
20
|
+
directives?: boolean;
|
|
20
21
|
}
|
|
21
22
|
declare function getResolved(name: string, options: VarletImportResolverOptions): {
|
|
23
|
+
from: string;
|
|
24
|
+
name: string;
|
|
25
|
+
sideEffects: string[];
|
|
26
|
+
};
|
|
27
|
+
declare function VarletImportResolver(options?: VarletImportResolverOptions): ({
|
|
28
|
+
type: "component";
|
|
29
|
+
resolve: (name: string) => {
|
|
22
30
|
from: string;
|
|
23
31
|
name: string;
|
|
24
32
|
sideEffects: string[];
|
|
25
|
-
};
|
|
26
|
-
declare function VarletImportResolver(options?: VarletImportResolverOptions): ({
|
|
27
|
-
type: "component";
|
|
28
|
-
resolve: (name: string) => {
|
|
29
|
-
from: string;
|
|
30
|
-
name: string;
|
|
31
|
-
sideEffects: string[];
|
|
32
|
-
} | undefined;
|
|
33
|
+
} | undefined;
|
|
33
34
|
} | {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
type: "directive";
|
|
36
|
+
resolve: (name: string) => {
|
|
37
|
+
from: string;
|
|
38
|
+
name: string;
|
|
39
|
+
sideEffects: string[];
|
|
40
|
+
} | undefined;
|
|
40
41
|
})[];
|
|
41
|
-
|
|
42
|
-
export { VarletImportResolver, VarletImportResolverOptions, getResolved };
|
|
42
|
+
//#endregion
|
|
43
|
+
export { VarletImportResolver, VarletImportResolverOptions, getResolved };
|
package/lib/index.d.ts
CHANGED
|
@@ -1,42 +1,43 @@
|
|
|
1
|
+
//#region src/index.d.ts
|
|
1
2
|
interface VarletImportResolverOptions {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
3
|
+
/**
|
|
4
|
+
* compatible with unplugin-auto-import
|
|
5
|
+
*
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
autoImport?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* whether to import style
|
|
11
|
+
*
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
importStyle?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* auto import for directives
|
|
17
|
+
*
|
|
18
|
+
* @default true
|
|
19
|
+
*/
|
|
20
|
+
directives?: boolean;
|
|
20
21
|
}
|
|
21
22
|
declare function getResolved(name: string, options: VarletImportResolverOptions): {
|
|
23
|
+
from: string;
|
|
24
|
+
name: string;
|
|
25
|
+
sideEffects: string[];
|
|
26
|
+
};
|
|
27
|
+
declare function VarletImportResolver(options?: VarletImportResolverOptions): ({
|
|
28
|
+
type: "component";
|
|
29
|
+
resolve: (name: string) => {
|
|
22
30
|
from: string;
|
|
23
31
|
name: string;
|
|
24
32
|
sideEffects: string[];
|
|
25
|
-
};
|
|
26
|
-
declare function VarletImportResolver(options?: VarletImportResolverOptions): ({
|
|
27
|
-
type: "component";
|
|
28
|
-
resolve: (name: string) => {
|
|
29
|
-
from: string;
|
|
30
|
-
name: string;
|
|
31
|
-
sideEffects: string[];
|
|
32
|
-
} | undefined;
|
|
33
|
+
} | undefined;
|
|
33
34
|
} | {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
type: "directive";
|
|
36
|
+
resolve: (name: string) => {
|
|
37
|
+
from: string;
|
|
38
|
+
name: string;
|
|
39
|
+
sideEffects: string[];
|
|
40
|
+
} | undefined;
|
|
40
41
|
})[];
|
|
41
|
-
|
|
42
|
-
export { VarletImportResolver, VarletImportResolverOptions, getResolved };
|
|
42
|
+
//#endregion
|
|
43
|
+
export { VarletImportResolver, VarletImportResolverOptions, getResolved };
|
package/lib/index.js
CHANGED
|
@@ -1,58 +1,47 @@
|
|
|
1
|
-
// src/index.ts
|
|
2
1
|
import { kebabCase } from "@varlet/shared";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
//#region src/index.ts
|
|
3
|
+
const varFunctions = [
|
|
4
|
+
"ImagePreview",
|
|
5
|
+
"Snackbar",
|
|
6
|
+
"Picker",
|
|
7
|
+
"ActionSheet",
|
|
8
|
+
"Dialog",
|
|
9
|
+
"Locale",
|
|
10
|
+
"StyleProvider",
|
|
11
|
+
"LoadingBar"
|
|
12
|
+
];
|
|
13
|
+
const varDirectives = [
|
|
14
|
+
"Ripple",
|
|
15
|
+
"Lazy",
|
|
16
|
+
"Hover"
|
|
12
17
|
];
|
|
13
|
-
var varDirectives = ["Ripple", "Lazy", "Hover"];
|
|
14
18
|
function getResolved(name, options) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
sideEffects
|
|
24
|
-
};
|
|
19
|
+
const { importStyle = true, autoImport = false } = options;
|
|
20
|
+
const sideEffects = [];
|
|
21
|
+
if (importStyle) sideEffects.push(`@varlet/ui/es/${kebabCase(name)}/style/index.mjs`);
|
|
22
|
+
return {
|
|
23
|
+
from: "@varlet/ui",
|
|
24
|
+
name: autoImport ? name : `_${name}Component`,
|
|
25
|
+
sideEffects
|
|
26
|
+
};
|
|
25
27
|
}
|
|
26
28
|
function VarletImportResolver(options = {}) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const { directives = true } = options;
|
|
44
|
-
if (!directives) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
if (!varDirectives.includes(name)) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
return getResolved(name, options);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
];
|
|
29
|
+
return [{
|
|
30
|
+
type: "component",
|
|
31
|
+
resolve: (name) => {
|
|
32
|
+
const { autoImport = false } = options;
|
|
33
|
+
if (autoImport && varFunctions.includes(name)) return getResolved(name, options);
|
|
34
|
+
if (name.startsWith("Var")) return getResolved(name.slice(3), options);
|
|
35
|
+
}
|
|
36
|
+
}, {
|
|
37
|
+
type: "directive",
|
|
38
|
+
resolve: (name) => {
|
|
39
|
+
const { directives = true } = options;
|
|
40
|
+
if (!directives) return;
|
|
41
|
+
if (!varDirectives.includes(name)) return;
|
|
42
|
+
return getResolved(name, options);
|
|
43
|
+
}
|
|
44
|
+
}];
|
|
54
45
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
getResolved
|
|
58
|
-
};
|
|
46
|
+
//#endregion
|
|
47
|
+
export { VarletImportResolver, getResolved };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varlet/import-resolver",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.15.0-alpha.1776572752298",
|
|
4
4
|
"description": "varlet import resolver for unplugin-vue-components and unplugin-auto-import",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"varlet",
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
"lib"
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@varlet/shared": "3.
|
|
38
|
+
"@varlet/shared": "3.15.0-alpha.1776572752298"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@types/node": "^
|
|
42
|
-
"
|
|
43
|
-
"
|
|
41
|
+
"@types/node": "^20.19.0",
|
|
42
|
+
"typescript": "5.6.3",
|
|
43
|
+
"vite-plus": "0.1.18"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
|
-
"build": "
|
|
47
|
-
"dev": "
|
|
46
|
+
"build": "vp pack",
|
|
47
|
+
"dev": "vp pack --watch"
|
|
48
48
|
}
|
|
49
49
|
}
|