@varlet/cli 1.21.0 → 1.21.1-alpha.64
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.en-US.md +11 -0
- package/README.md +11 -0
- package/generators/sfc/package.json +3 -2
- package/generators/sfc/varlet.config.js +5 -0
- package/generators/tsx/package.json +3 -2
- package/generators/tsx/varlet.config.js +5 -0
- package/lib/commands/build.js +19 -15
- package/lib/commands/dev.d.ts +3 -2
- package/lib/commands/dev.js +23 -34
- package/lib/commands/jest.d.ts +3 -3
- package/lib/commands/preview.d.ts +1 -0
- package/lib/commands/preview.js +65 -0
- package/lib/compiler/compileModule.js +7 -14
- package/lib/compiler/compileSFC.js +7 -2
- package/lib/compiler/compileSiteEntry.d.ts +1 -4
- package/lib/compiler/compileSiteEntry.js +10 -20
- package/lib/compiler/compileStyle.js +1 -60
- package/lib/config/babel.config.js +0 -9
- package/lib/config/jest.config.js +1 -1
- package/lib/config/jest.lib.mock.d.ts +0 -0
- package/lib/config/jest.lib.mock.js +2 -0
- package/lib/config/varlet.config.d.ts +1 -1
- package/lib/config/vite.config.d.ts +4 -0
- package/lib/config/vite.config.js +128 -0
- package/lib/index.js +7 -2
- package/lib/shared/constant.d.ts +2 -8
- package/lib/shared/constant.js +3 -9
- package/lib/site/components/app-bar/index.d.ts +3 -0
- package/lib/site/components/app-bar/index.js +12 -0
- package/lib/site/components/app-bar/props.d.ts +21 -0
- package/lib/site/components/app-bar/props.js +28 -0
- package/lib/site/components/button/index.d.ts +3 -0
- package/lib/site/components/button/index.js +12 -0
- package/lib/site/components/button/props.d.ts +62 -0
- package/lib/site/components/button/props.js +69 -0
- package/lib/site/components/cell/index.d.ts +3 -0
- package/lib/site/components/cell/index.js +12 -0
- package/lib/site/components/cell/props.d.ts +27 -0
- package/lib/site/components/cell/props.js +30 -0
- package/lib/site/components/context/index.d.ts +15 -0
- package/lib/site/components/context/index.js +11 -0
- package/lib/site/components/context/lock.d.ts +10 -0
- package/lib/site/components/context/lock.js +94 -0
- package/lib/site/components/context/zIndex.d.ts +4 -0
- package/lib/site/components/context/zIndex.js +19 -0
- package/lib/site/components/icon/index.d.ts +3 -0
- package/lib/site/components/icon/index.js +12 -0
- package/lib/site/components/icon/props.d.ts +23 -0
- package/lib/site/components/icon/props.js +25 -0
- package/lib/site/components/loading/index.d.ts +3 -0
- package/lib/site/components/loading/index.js +12 -0
- package/lib/site/components/loading/props.d.ts +26 -0
- package/lib/site/components/loading/props.js +34 -0
- package/lib/site/components/menu/index.d.ts +3 -0
- package/lib/site/components/menu/index.js +12 -0
- package/lib/site/components/menu/props.d.ts +40 -0
- package/lib/site/components/menu/props.js +43 -0
- package/lib/site/components/progress/index.d.ts +3 -0
- package/lib/site/components/progress/index.js +12 -0
- package/lib/site/components/progress/props.d.ts +43 -0
- package/lib/site/components/progress/props.js +57 -0
- package/lib/site/components/ripple/index.d.ts +8 -0
- package/lib/site/components/ripple/index.js +125 -0
- package/lib/site/components/utils/components.d.ts +53 -0
- package/lib/site/components/utils/components.js +279 -0
- package/lib/site/components/utils/elements.d.ts +30 -0
- package/lib/site/components/utils/elements.js +240 -0
- package/lib/site/components/utils/shared.d.ts +36 -0
- package/lib/site/components/utils/shared.js +181 -0
- package/lib/site/mobile/main.d.ts +3 -0
- package/lib/site/mobile/main.js +93 -0
- package/lib/site/pc/main.d.ts +3 -0
- package/lib/site/pc/main.js +69 -0
- package/lib/site/useProgress.d.ts +4 -0
- package/lib/site/useProgress.js +58 -0
- package/lib/site/utils.d.ts +24 -0
- package/lib/site/utils.js +133 -0
- package/package.json +16 -30
- package/site/.DS_Store +0 -0
- package/site/components/app-bar/AppBar.vue +45 -0
- package/site/components/app-bar/appBar.less +66 -0
- package/site/components/app-bar/index.ts +10 -0
- package/site/components/app-bar/props.ts +25 -0
- package/site/components/button/Button.vue +84 -0
- package/site/components/button/button.less +183 -0
- package/site/components/button/index.ts +10 -0
- package/site/components/button/props.ts +70 -0
- package/site/components/cell/Cell.vue +42 -0
- package/site/components/cell/cell.less +74 -0
- package/site/components/cell/index.ts +10 -0
- package/site/components/cell/props.ts +27 -0
- package/site/components/context/index.ts +17 -0
- package/site/components/context/lock.ts +103 -0
- package/site/components/context/zIndex.ts +20 -0
- package/site/components/icon/Icon.vue +68 -0
- package/site/components/icon/icon.less +25 -0
- package/site/components/icon/index.ts +10 -0
- package/site/components/icon/props.ts +24 -0
- package/site/components/loading/Loading.vue +55 -0
- package/site/components/loading/index.ts +10 -0
- package/site/components/loading/loading.less +420 -0
- package/site/components/loading/props.ts +37 -0
- package/site/components/menu/Menu.vue +113 -0
- package/site/components/menu/index.ts +10 -0
- package/site/components/menu/menu.less +27 -0
- package/site/components/menu/props.ts +43 -0
- package/site/components/progress/Progress.vue +108 -0
- package/site/components/progress/index.ts +10 -0
- package/site/components/progress/progress.less +98 -0
- package/site/components/progress/props.ts +55 -0
- package/site/components/ripple/index.ts +167 -0
- package/site/components/ripple/ripple.less +17 -0
- package/site/components/styles/common.less +64 -0
- package/site/components/styles/elevation.less +126 -0
- package/site/components/styles/var.less +27 -0
- package/site/components/utils/components.ts +53 -0
- package/site/components/utils/elements.ts +83 -0
- package/site/components/utils/shared.ts +27 -0
- package/site/{pc/index.html → index.html} +6 -4
- package/site/mobile/App.vue +20 -18
- package/site/mobile/components/AppHome.vue +6 -8
- package/site/mobile/main.ts +17 -2
- package/site/{mobile/mobile.html → mobile.html} +6 -5
- package/site/pc/App.vue +16 -11
- package/site/pc/components/AppHeader.vue +15 -13
- package/site/pc/components/AppMobile.vue +3 -3
- package/site/pc/components/AppSidebar.vue +17 -23
- package/site/pc/main.ts +10 -2
- package/site/useProgress.ts +11 -9
- package/site/utils.ts +14 -3
- package/varlet.default.config.js +3 -2
- package/generators/sfc/yarn.lock +0 -11231
- package/generators/tsx/yarn.lock +0 -11231
package/README.en-US.md
CHANGED
|
@@ -66,11 +66,16 @@ subject to the theme of the `varlet` official document
|
|
|
66
66
|
| `color-link` |
|
|
67
67
|
| `color-type` |
|
|
68
68
|
| `color-progress` |
|
|
69
|
+
| `color-progress-track` |
|
|
69
70
|
| `color-side-bar` |
|
|
70
71
|
| `color-side-bar-active-background` |
|
|
71
72
|
| `color-app-bar` |
|
|
72
73
|
| `color-mobile-cell-hover` |
|
|
73
74
|
| `color-mobile-cell-hover-background` |
|
|
75
|
+
| `color-pc-language-active` |
|
|
76
|
+
| `color-pc-language-active-background` |
|
|
77
|
+
| `color-mobile-language-active` |
|
|
78
|
+
| `color-mobile-language-active-background` |
|
|
74
79
|
|
|
75
80
|
#### SiteHighlight
|
|
76
81
|
|
|
@@ -162,6 +167,12 @@ varlet-cli dev
|
|
|
162
167
|
varlet-cli build
|
|
163
168
|
```
|
|
164
169
|
|
|
170
|
+
#### Preview documentation site
|
|
171
|
+
|
|
172
|
+
```shell
|
|
173
|
+
varlet-cli preview
|
|
174
|
+
```
|
|
175
|
+
|
|
165
176
|
#### Build component library code
|
|
166
177
|
|
|
167
178
|
```shell
|
package/README.md
CHANGED
|
@@ -62,11 +62,16 @@ yarn dev
|
|
|
62
62
|
| `color-link` |
|
|
63
63
|
| `color-type` |
|
|
64
64
|
| `color-progress` |
|
|
65
|
+
| `color-progress-track` |
|
|
65
66
|
| `color-side-bar` |
|
|
66
67
|
| `color-side-bar-active-background` |
|
|
67
68
|
| `color-app-bar` |
|
|
68
69
|
| `color-mobile-cell-hover` |
|
|
69
70
|
| `color-mobile-cell-hover-background` |
|
|
71
|
+
| `color-pc-language-active` |
|
|
72
|
+
| `color-pc-language-active-background` |
|
|
73
|
+
| `color-mobile-language-active` |
|
|
74
|
+
| `color-mobile-language-active-background` |
|
|
70
75
|
|
|
71
76
|
#### SiteHighlight
|
|
72
77
|
|
|
@@ -157,6 +162,12 @@ varlet-cli dev
|
|
|
157
162
|
varlet-cli build
|
|
158
163
|
```
|
|
159
164
|
|
|
165
|
+
#### 预览文档站点
|
|
166
|
+
|
|
167
|
+
```shell
|
|
168
|
+
varlet-cli preview
|
|
169
|
+
```
|
|
170
|
+
|
|
160
171
|
#### 构建组件库代码
|
|
161
172
|
|
|
162
173
|
```shell
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"commit": "git-cz",
|
|
20
20
|
"dev": "varlet-cli dev",
|
|
21
21
|
"build": "varlet-cli build",
|
|
22
|
+
"preview": "varlet-cli preview",
|
|
22
23
|
"compile": "varlet-cli compile",
|
|
23
24
|
"create": "varlet-cli create",
|
|
24
25
|
"lint": "varlet-cli lint",
|
|
@@ -29,11 +30,11 @@
|
|
|
29
30
|
"test:watch": "varlet-cli jest -w"
|
|
30
31
|
},
|
|
31
32
|
"peerDependencies": {
|
|
32
|
-
"vue": "^3.
|
|
33
|
+
"vue": "^3.2.0"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@varlet/cli": "^1.20.0-alpha.0",
|
|
36
|
-
"vue": "3.
|
|
37
|
+
"vue": "3.2.16"
|
|
37
38
|
},
|
|
38
39
|
"release-it": {
|
|
39
40
|
"git": {
|
|
@@ -9,9 +9,14 @@ module.exports = {
|
|
|
9
9
|
'color-link': '#009688',
|
|
10
10
|
'color-type': '#009688',
|
|
11
11
|
'color-progress': '#009688',
|
|
12
|
+
'color-progress-track': '#fff',
|
|
12
13
|
'color-side-bar': '#009688',
|
|
13
14
|
'color-side-bar-active-background': '#00968821',
|
|
14
15
|
'color-app-bar': '#009688',
|
|
16
|
+
'color-pc-language-active': '#009688',
|
|
17
|
+
'color-pc-language-active-background': '#00968821',
|
|
18
|
+
'color-mobile-language-active': '#009688',
|
|
19
|
+
'color-mobile-language-active-background': '#00968821',
|
|
15
20
|
'color-mobile-cell-hover': '#009688',
|
|
16
21
|
'color-mobile-cell-hover-background': '#00968821',
|
|
17
22
|
},
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"commit": "git-cz",
|
|
20
20
|
"dev": "varlet-cli dev",
|
|
21
21
|
"build": "varlet-cli build",
|
|
22
|
+
"preview": "varlet-cli preview",
|
|
22
23
|
"compile": "varlet-cli compile",
|
|
23
24
|
"create": "varlet-cli create",
|
|
24
25
|
"lint": "varlet-cli lint",
|
|
@@ -29,11 +30,11 @@
|
|
|
29
30
|
"test:watch": "varlet-cli jest -w"
|
|
30
31
|
},
|
|
31
32
|
"peerDependencies": {
|
|
32
|
-
"vue": "^3.
|
|
33
|
+
"vue": "^3.2.0"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@varlet/cli": "^1.20.0-alpha.0",
|
|
36
|
-
"vue": "3.
|
|
37
|
+
"vue": "3.2.16"
|
|
37
38
|
},
|
|
38
39
|
"release-it": {
|
|
39
40
|
"git": {
|
|
@@ -9,9 +9,14 @@ module.exports = {
|
|
|
9
9
|
'color-link': '#009688',
|
|
10
10
|
'color-type': '#009688',
|
|
11
11
|
'color-progress': '#009688',
|
|
12
|
+
'color-progress-track': '#fff',
|
|
12
13
|
'color-side-bar': '#009688',
|
|
13
14
|
'color-side-bar-active-background': '#00968821',
|
|
14
15
|
'color-app-bar': '#009688',
|
|
16
|
+
'color-pc-language-active': '#009688',
|
|
17
|
+
'color-pc-language-active-background': '#00968821',
|
|
18
|
+
'color-mobile-language-active': '#009688',
|
|
19
|
+
'color-mobile-language-active-background': '#00968821',
|
|
15
20
|
'color-mobile-cell-hover': '#009688',
|
|
16
21
|
'color-mobile-cell-hover-background': '#00968821',
|
|
17
22
|
},
|
package/lib/commands/build.js
CHANGED
|
@@ -35,28 +35,32 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
39
|
exports.build = void 0;
|
|
43
|
-
var webpack_1 = __importDefault(require("webpack"));
|
|
44
|
-
var logger_1 = __importDefault(require("../shared/logger"));
|
|
45
40
|
var fs_extra_1 = require("fs-extra");
|
|
46
|
-
var webpack_build_config_1 = require("../config/webpack.build.config");
|
|
47
41
|
var constant_1 = require("../shared/constant");
|
|
42
|
+
var vite_1 = require("vite");
|
|
43
|
+
var vite_config_1 = require("../config/vite.config");
|
|
44
|
+
var varlet_config_1 = require("../config/varlet.config");
|
|
45
|
+
var compileSiteEntry_1 = require("../compiler/compileSiteEntry");
|
|
48
46
|
function build() {
|
|
49
47
|
return __awaiter(this, void 0, void 0, function () {
|
|
50
|
-
var
|
|
48
|
+
var varletConfig, buildConfig;
|
|
51
49
|
return __generator(this, function (_a) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
50
|
+
switch (_a.label) {
|
|
51
|
+
case 0:
|
|
52
|
+
process.env.NODE_ENV = 'production';
|
|
53
|
+
fs_extra_1.ensureDirSync(constant_1.SRC_DIR);
|
|
54
|
+
return [4 /*yield*/, compileSiteEntry_1.buildSiteEntry()];
|
|
55
|
+
case 1:
|
|
56
|
+
_a.sent();
|
|
57
|
+
varletConfig = varlet_config_1.getVarletConfig();
|
|
58
|
+
buildConfig = vite_config_1.getBuildConfig(varletConfig);
|
|
59
|
+
return [4 /*yield*/, vite_1.build(buildConfig)];
|
|
60
|
+
case 2:
|
|
61
|
+
_a.sent();
|
|
62
|
+
return [2 /*return*/];
|
|
63
|
+
}
|
|
60
64
|
});
|
|
61
65
|
});
|
|
62
66
|
}
|
package/lib/commands/dev.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export declare function
|
|
2
|
-
|
|
1
|
+
export declare function dev(cmd: {
|
|
2
|
+
force?: boolean;
|
|
3
|
+
}): Promise<void>;
|
package/lib/commands/dev.js
CHANGED
|
@@ -39,54 +39,43 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.dev =
|
|
43
|
-
var
|
|
44
|
-
var webpack_dev_server_1 = __importDefault(require("webpack-dev-server"));
|
|
42
|
+
exports.dev = void 0;
|
|
43
|
+
var address_1 = __importDefault(require("address"));
|
|
45
44
|
var logger_1 = __importDefault(require("../shared/logger"));
|
|
46
|
-
var
|
|
45
|
+
var vite_1 = require("vite");
|
|
47
46
|
var fs_extra_1 = require("fs-extra");
|
|
48
|
-
var webpack_dev_config_1 = require("../config/webpack.dev.config");
|
|
49
47
|
var constant_1 = require("../shared/constant");
|
|
48
|
+
var compileSiteEntry_1 = require("../compiler/compileSiteEntry");
|
|
49
|
+
var vite_config_1 = require("../config/vite.config");
|
|
50
50
|
var varlet_config_1 = require("../config/varlet.config");
|
|
51
51
|
var lodash_1 = require("lodash");
|
|
52
|
-
function
|
|
52
|
+
function dev(cmd) {
|
|
53
53
|
return __awaiter(this, void 0, void 0, function () {
|
|
54
|
-
var
|
|
54
|
+
var varletConfig, devConfig, inlineConfig, server, host, port, ipv4;
|
|
55
55
|
return __generator(this, function (_a) {
|
|
56
56
|
switch (_a.label) {
|
|
57
57
|
case 0:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return [4 /*yield*/, server.start()];
|
|
58
|
+
process.env.NODE_ENV = 'development';
|
|
59
|
+
fs_extra_1.ensureDirSync(constant_1.SRC_DIR);
|
|
60
|
+
return [4 /*yield*/, compileSiteEntry_1.buildSiteEntry()];
|
|
62
61
|
case 1:
|
|
63
62
|
_a.sent();
|
|
63
|
+
varletConfig = varlet_config_1.getVarletConfig();
|
|
64
|
+
devConfig = vite_config_1.getDevConfig(varletConfig);
|
|
65
|
+
inlineConfig = lodash_1.merge(devConfig, cmd.force ? { server: { force: true } } : {});
|
|
66
|
+
return [4 /*yield*/, vite_1.createServer(inlineConfig)];
|
|
67
|
+
case 2:
|
|
68
|
+
server = _a.sent();
|
|
69
|
+
return [4 /*yield*/, server.listen()];
|
|
70
|
+
case 3:
|
|
71
|
+
_a.sent();
|
|
72
|
+
host = lodash_1.get(varletConfig, 'host');
|
|
73
|
+
port = lodash_1.get(varletConfig, 'port');
|
|
74
|
+
ipv4 = address_1.default.ip();
|
|
75
|
+
logger_1.default.success("Server running at\nLocal: http://" + host + ":" + port + "\nNetwork: http://" + ipv4 + ":" + port);
|
|
64
76
|
return [2 /*return*/];
|
|
65
77
|
}
|
|
66
78
|
});
|
|
67
79
|
});
|
|
68
80
|
}
|
|
69
|
-
exports.runDevServer = runDevServer;
|
|
70
|
-
function dev() {
|
|
71
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
72
|
-
var varletConfig, config, port;
|
|
73
|
-
return __generator(this, function (_a) {
|
|
74
|
-
process.env.NODE_ENV = 'development';
|
|
75
|
-
fs_extra_1.ensureDirSync(constant_1.SRC_DIR);
|
|
76
|
-
varletConfig = varlet_config_1.getVarletConfig();
|
|
77
|
-
config = webpack_dev_config_1.getDevConfig();
|
|
78
|
-
port = lodash_1.get(varletConfig, 'port');
|
|
79
|
-
portfinder_1.getPort({
|
|
80
|
-
port: port,
|
|
81
|
-
}, function (err, port) {
|
|
82
|
-
if (err) {
|
|
83
|
-
logger_1.default.error(err.toString());
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
runDevServer(port, config);
|
|
87
|
-
});
|
|
88
|
-
return [2 /*return*/];
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
81
|
exports.dev = dev;
|
package/lib/commands/jest.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function preview(): Promise<void>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.preview = void 0;
|
|
43
|
+
var logger_1 = __importDefault(require("../shared/logger"));
|
|
44
|
+
var execa_1 = __importDefault(require("execa"));
|
|
45
|
+
var constant_1 = require("../shared/constant");
|
|
46
|
+
var fs_extra_1 = require("fs-extra");
|
|
47
|
+
function preview() {
|
|
48
|
+
var _a;
|
|
49
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
50
|
+
return __generator(this, function (_b) {
|
|
51
|
+
if (!fs_extra_1.pathExistsSync(constant_1.SITE_OUTPUT_PATH)) {
|
|
52
|
+
logger_1.default.warning('Cannot find the site folder, you must first run the build command to build the document site');
|
|
53
|
+
return [2 /*return*/];
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
(_a = execa_1.default.command('live-server --port=5500', { cwd: constant_1.SITE_OUTPUT_PATH }).stdout) === null || _a === void 0 ? void 0 : _a.pipe(process.stdout);
|
|
57
|
+
}
|
|
58
|
+
catch (e) {
|
|
59
|
+
logger_1.default.error(e);
|
|
60
|
+
}
|
|
61
|
+
return [2 /*return*/];
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
exports.preview = preview;
|
|
@@ -35,31 +35,24 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
39
|
exports.compileModule = exports.compileFile = exports.compileDir = exports.compileUMD = void 0;
|
|
43
|
-
var
|
|
40
|
+
var vite_1 = require("vite");
|
|
44
41
|
var path_1 = require("path");
|
|
45
42
|
var fs_extra_1 = require("fs-extra");
|
|
46
|
-
var logger_1 = __importDefault(require("../shared/logger"));
|
|
47
43
|
var constant_1 = require("../shared/constant");
|
|
48
44
|
var fsUtils_1 = require("../shared/fsUtils");
|
|
49
45
|
var compileSFC_1 = require("./compileSFC");
|
|
50
46
|
var compileScript_1 = require("./compileScript");
|
|
51
47
|
var compileStyle_1 = require("./compileStyle");
|
|
52
|
-
var
|
|
48
|
+
var vite_config_1 = require("../config/vite.config");
|
|
49
|
+
var varlet_config_1 = require("../config/varlet.config");
|
|
53
50
|
function compileUMD() {
|
|
54
51
|
return new Promise(function (resolve, reject) {
|
|
55
|
-
var config =
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
reject();
|
|
60
|
-
}
|
|
61
|
-
resolve();
|
|
62
|
-
});
|
|
52
|
+
var config = vite_config_1.getUMDConfig(varlet_config_1.getVarletConfig());
|
|
53
|
+
vite_1.build(config)
|
|
54
|
+
.then(function () { return resolve(); })
|
|
55
|
+
.catch(reject);
|
|
63
56
|
});
|
|
64
57
|
}
|
|
65
58
|
exports.compileUMD = compileUMD;
|
|
@@ -46,6 +46,7 @@ var compiler_sfc_1 = require("@vue/compiler-sfc");
|
|
|
46
46
|
var fsUtils_1 = require("../shared/fsUtils");
|
|
47
47
|
var compileScript_1 = require("./compileScript");
|
|
48
48
|
var compileStyle_1 = require("./compileStyle");
|
|
49
|
+
var logger_1 = __importDefault(require("../shared/logger"));
|
|
49
50
|
var NORMAL_EXPORT_START_RE = /export\s+default\s+{/;
|
|
50
51
|
var DEFINE_EXPORT_START_RE = /export\s+default\s+defineComponent\s*\(\s*{/;
|
|
51
52
|
function injectRender(script, render) {
|
|
@@ -60,14 +61,18 @@ function injectRender(script, render) {
|
|
|
60
61
|
exports.injectRender = injectRender;
|
|
61
62
|
function compileSFC(sfc) {
|
|
62
63
|
return __awaiter(this, void 0, void 0, function () {
|
|
63
|
-
var sources, descriptor, script, template, styles, hasScope, id, scopeId, render, content, code, index, style, file, code, _a;
|
|
64
|
+
var sources, descriptor, script, scriptSetup, template, styles, hasScope, id, scopeId, render, content, code, index, style, file, code, _a;
|
|
64
65
|
return __generator(this, function (_b) {
|
|
65
66
|
switch (_b.label) {
|
|
66
67
|
case 0: return [4 /*yield*/, fs_extra_1.readFile(sfc, 'utf-8')];
|
|
67
68
|
case 1:
|
|
68
69
|
sources = _b.sent();
|
|
69
70
|
descriptor = compiler_sfc_1.parse(sources, { sourceMap: false }).descriptor;
|
|
70
|
-
script = descriptor.script, template = descriptor.template, styles = descriptor.styles;
|
|
71
|
+
script = descriptor.script, scriptSetup = descriptor.scriptSetup, template = descriptor.template, styles = descriptor.styles;
|
|
72
|
+
if (scriptSetup) {
|
|
73
|
+
logger_1.default.warning("\n Varlet Cli does not support compiling script setup syntax \n The error in " + sfc);
|
|
74
|
+
return [2 /*return*/];
|
|
75
|
+
}
|
|
71
76
|
hasScope = styles.some(function (style) { return style.scoped; });
|
|
72
77
|
id = hash_sum_1.default(sources);
|
|
73
78
|
scopeId = hasScope ? "data-v-" + id : '';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Compiler } from 'webpack';
|
|
2
1
|
export declare function getExampleRoutePath(examplePath: string): string;
|
|
3
2
|
export declare function getComponentDocsRoutePath(componentDocsPath: string): string;
|
|
4
3
|
export declare function getRootDocsRoutePath(rootDocsPath: string): string;
|
|
@@ -7,7 +6,5 @@ export declare function findComponentDocsPaths(): Promise<string[]>;
|
|
|
7
6
|
export declare function findRootDocsPaths(): Promise<string[]>;
|
|
8
7
|
export declare function buildMobileSiteRoutes(): Promise<void>;
|
|
9
8
|
export declare function buildPcSiteRoutes(): Promise<void>;
|
|
9
|
+
export declare function buildSiteSource(): Promise<void>;
|
|
10
10
|
export declare function buildSiteEntry(): Promise<void>;
|
|
11
|
-
export declare class VarletSitePlugin {
|
|
12
|
-
apply(compiler: Compiler): void;
|
|
13
|
-
}
|
|
@@ -60,9 +60,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
60
60
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
61
61
|
};
|
|
62
62
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
63
|
-
exports.
|
|
63
|
+
exports.buildSiteEntry = exports.buildSiteSource = exports.buildPcSiteRoutes = exports.buildMobileSiteRoutes = exports.findRootDocsPaths = exports.findComponentDocsPaths = exports.findExamplePaths = exports.getRootDocsRoutePath = exports.getComponentDocsRoutePath = exports.getExampleRoutePath = void 0;
|
|
64
64
|
var slash_1 = __importDefault(require("slash"));
|
|
65
|
-
var chokidar_1 = __importDefault(require("chokidar"));
|
|
66
65
|
var constant_1 = require("../shared/constant");
|
|
67
66
|
var fs_extra_1 = require("fs-extra");
|
|
68
67
|
var path_1 = require("path");
|
|
@@ -187,13 +186,21 @@ function buildPcSiteRoutes() {
|
|
|
187
186
|
});
|
|
188
187
|
}
|
|
189
188
|
exports.buildPcSiteRoutes = buildPcSiteRoutes;
|
|
189
|
+
function buildSiteSource() {
|
|
190
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
191
|
+
return __generator(this, function (_a) {
|
|
192
|
+
return [2 /*return*/, fs_extra_1.copy(constant_1.SITE, constant_1.SITE_DIR)];
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
exports.buildSiteSource = buildSiteSource;
|
|
190
197
|
function buildSiteEntry() {
|
|
191
198
|
return __awaiter(this, void 0, void 0, function () {
|
|
192
199
|
return __generator(this, function (_a) {
|
|
193
200
|
switch (_a.label) {
|
|
194
201
|
case 0:
|
|
195
202
|
varlet_config_1.getVarletConfig();
|
|
196
|
-
return [4 /*yield*/, Promise.all([buildMobileSiteRoutes(), buildPcSiteRoutes()])];
|
|
203
|
+
return [4 /*yield*/, Promise.all([buildMobileSiteRoutes(), buildPcSiteRoutes(), buildSiteSource()])];
|
|
197
204
|
case 1:
|
|
198
205
|
_a.sent();
|
|
199
206
|
return [2 /*return*/];
|
|
@@ -202,20 +209,3 @@ function buildSiteEntry() {
|
|
|
202
209
|
});
|
|
203
210
|
}
|
|
204
211
|
exports.buildSiteEntry = buildSiteEntry;
|
|
205
|
-
var PLUGIN_NAME = 'VarletSitePlugin';
|
|
206
|
-
var VarletSitePlugin = /** @class */ (function () {
|
|
207
|
-
function VarletSitePlugin() {
|
|
208
|
-
}
|
|
209
|
-
VarletSitePlugin.prototype.apply = function (compiler) {
|
|
210
|
-
if (process.env.NODE_ENV === 'production') {
|
|
211
|
-
compiler.hooks.beforeCompile.tapPromise(PLUGIN_NAME, buildSiteEntry);
|
|
212
|
-
}
|
|
213
|
-
else {
|
|
214
|
-
var watcher = chokidar_1.default.watch([constant_1.SITE_EXAMPLE_GLOB, constant_1.SITE_DOCS_GLOB, constant_1.VARLET_CONFIG]);
|
|
215
|
-
watcher.on('add', buildSiteEntry).on('unlink', buildSiteEntry).on('change', buildSiteEntry);
|
|
216
|
-
compiler.hooks.watchRun.tapPromise(PLUGIN_NAME, buildSiteEntry);
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
return VarletSitePlugin;
|
|
220
|
-
}());
|
|
221
|
-
exports.VarletSitePlugin = VarletSitePlugin;
|
|
@@ -1,19 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -50,27 +35,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
50
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
36
|
}
|
|
52
37
|
};
|
|
53
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
54
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
55
|
-
if (!m) return o;
|
|
56
|
-
var i = m.call(o), r, ar = [], e;
|
|
57
|
-
try {
|
|
58
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
59
|
-
}
|
|
60
|
-
catch (error) { e = { error: error }; }
|
|
61
|
-
finally {
|
|
62
|
-
try {
|
|
63
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
64
|
-
}
|
|
65
|
-
finally { if (e) throw e.error; }
|
|
66
|
-
}
|
|
67
|
-
return ar;
|
|
68
|
-
};
|
|
69
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
70
|
-
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
|
|
71
|
-
to[j] = from[i];
|
|
72
|
-
return to;
|
|
73
|
-
};
|
|
74
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
75
39
|
exports.compileLess = exports.extractStyleDependencies = exports.normalizeStyleDependency = exports.clearEmptyLine = exports.STYLE_IMPORT_RE = exports.IMPORT_LESS_RE = exports.IMPORT_CSS_RE = exports.EMPTY_LINE_RE = exports.EMPTY_SPACE_RE = void 0;
|
|
76
40
|
var fs_extra_1 = require("fs-extra");
|
|
@@ -82,26 +46,6 @@ exports.EMPTY_LINE_RE = /[\n\r]*/g;
|
|
|
82
46
|
exports.IMPORT_CSS_RE = /(?<!['"`])import\s+['"](\.{1,2}\/.+\.css)['"]\s*;?(?!\s*['"`])/g;
|
|
83
47
|
exports.IMPORT_LESS_RE = /(?<!['"`])import\s+['"](\.{1,2}\/.+\.less)['"]\s*;?(?!\s*['"`])/g;
|
|
84
48
|
exports.STYLE_IMPORT_RE = /@import\s+['"](.+)['"]\s*;/g;
|
|
85
|
-
var TildeResolver = /** @class */ (function (_super) {
|
|
86
|
-
__extends(TildeResolver, _super);
|
|
87
|
-
function TildeResolver() {
|
|
88
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
89
|
-
}
|
|
90
|
-
TildeResolver.prototype.loadFile = function (filename) {
|
|
91
|
-
var args = [];
|
|
92
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
93
|
-
args[_i - 1] = arguments[_i];
|
|
94
|
-
}
|
|
95
|
-
filename = filename.replace('~', '');
|
|
96
|
-
return _super.prototype.loadFile.apply(this, __spreadArray([filename], __read(args)));
|
|
97
|
-
};
|
|
98
|
-
return TildeResolver;
|
|
99
|
-
}(less_1.FileManager));
|
|
100
|
-
var TildeResolverPlugin = {
|
|
101
|
-
install: function (lessInstance, pluginManager) {
|
|
102
|
-
pluginManager.addFileManager(new TildeResolver());
|
|
103
|
-
},
|
|
104
|
-
};
|
|
105
49
|
var clearEmptyLine = function (s) { return s.replace(exports.EMPTY_LINE_RE, '').replace(exports.EMPTY_SPACE_RE, ' '); };
|
|
106
50
|
exports.clearEmptyLine = clearEmptyLine;
|
|
107
51
|
function normalizeStyleDependency(styleImport, reg) {
|
|
@@ -138,10 +82,7 @@ function compileLess(file) {
|
|
|
138
82
|
switch (_a.label) {
|
|
139
83
|
case 0:
|
|
140
84
|
source = fs_extra_1.readFileSync(file, 'utf-8');
|
|
141
|
-
return [4 /*yield*/, less_1.render(source, {
|
|
142
|
-
filename: file,
|
|
143
|
-
plugins: [TildeResolverPlugin],
|
|
144
|
-
})];
|
|
85
|
+
return [4 /*yield*/, less_1.render(source, { filename: file })];
|
|
145
86
|
case 1:
|
|
146
87
|
css = (_a.sent()).css;
|
|
147
88
|
fs_extra_1.writeFileSync(fsUtils_1.replaceExt(file, '.css'), exports.clearEmptyLine(css), 'utf-8');
|
|
@@ -19,15 +19,6 @@ module.exports = function (api, options) {
|
|
|
19
19
|
require('./babel.sfc.transform'),
|
|
20
20
|
],
|
|
21
21
|
plugins: [
|
|
22
|
-
[
|
|
23
|
-
require.resolve('babel-plugin-import'),
|
|
24
|
-
{
|
|
25
|
-
libraryName: '@varlet/ui',
|
|
26
|
-
libraryDirectory: 'es',
|
|
27
|
-
style: true,
|
|
28
|
-
},
|
|
29
|
-
'@varlet/ui',
|
|
30
|
-
],
|
|
31
22
|
[
|
|
32
23
|
require.resolve('@vue/babel-plugin-jsx'),
|
|
33
24
|
{
|
|
@@ -18,5 +18,5 @@ module.exports = {
|
|
|
18
18
|
"!**/" + constant_1.TESTS_DIR_NAME + "/**",
|
|
19
19
|
],
|
|
20
20
|
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'vue'],
|
|
21
|
-
transformIgnorePatterns: ['/node_modules/(?!(@varlet/cli))'],
|
|
21
|
+
transformIgnorePatterns: ['/node_modules/(?!(@varlet/cli))/'],
|
|
22
22
|
};
|
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function getVarletConfig(): any
|
|
1
|
+
export declare function getVarletConfig(): Record<string, any>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { InlineConfig } from 'vite';
|
|
2
|
+
export declare function getDevConfig(varletConfig: Record<string, any>): InlineConfig;
|
|
3
|
+
export declare function getBuildConfig(varletConfig: Record<string, any>): InlineConfig;
|
|
4
|
+
export declare function getUMDConfig(varletConfig: Record<string, any>): InlineConfig;
|