@varlet/cli 1.21.0 → 1.22.0-alpha.5
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/generators/sfc/package.json +2 -1
- package/generators/tsx/package.json +2 -1
- package/lib/commands/build.js +19 -15
- package/lib/commands/dev.d.ts +3 -2
- package/lib/commands/dev.js +16 -38
- package/lib/commands/jest.d.ts +3 -3
- package/lib/compiler/compileModule.js +7 -14
- package/lib/compiler/compileSFC.js +7 -2
- package/lib/compiler/compileStyle.js +1 -60
- package/lib/config/babel.config.js +0 -9
- package/lib/config/jest.config.js +2 -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 +5 -2
- package/lib/shared/constant.d.ts +2 -0
- package/lib/shared/constant.js +3 -1
- package/package.json +14 -28
- package/site/{pc/index.html → index.html} +6 -4
- package/site/mobile/App.vue +1 -3
- package/site/mobile/components/AppHome.vue +0 -2
- package/site/mobile/main.ts +9 -1
- package/site/{mobile/mobile.html → mobile.html} +6 -5
- package/site/pc/App.vue +2 -2
- package/site/pc/components/AppHeader.vue +1 -3
- package/site/pc/components/AppSidebar.vue +1 -3
- package/site/pc/main.ts +6 -1
- package/site/useProgress.ts +1 -1
- package/site/utils.ts +1 -1
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
|
@@ -35,58 +35,36 @@ 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
|
-
exports.dev =
|
|
43
|
-
var
|
|
44
|
-
var webpack_dev_server_1 = __importDefault(require("webpack-dev-server"));
|
|
45
|
-
var logger_1 = __importDefault(require("../shared/logger"));
|
|
46
|
-
var portfinder_1 = require("portfinder");
|
|
39
|
+
exports.dev = void 0;
|
|
40
|
+
var vite_1 = require("vite");
|
|
47
41
|
var fs_extra_1 = require("fs-extra");
|
|
48
|
-
var webpack_dev_config_1 = require("../config/webpack.dev.config");
|
|
49
42
|
var constant_1 = require("../shared/constant");
|
|
43
|
+
var compileSiteEntry_1 = require("../compiler/compileSiteEntry");
|
|
44
|
+
var vite_config_1 = require("../config/vite.config");
|
|
50
45
|
var varlet_config_1 = require("../config/varlet.config");
|
|
51
46
|
var lodash_1 = require("lodash");
|
|
52
|
-
function
|
|
47
|
+
function dev(cmd) {
|
|
53
48
|
return __awaiter(this, void 0, void 0, function () {
|
|
54
|
-
var
|
|
49
|
+
var devConfig, server;
|
|
55
50
|
return __generator(this, function (_a) {
|
|
56
51
|
switch (_a.label) {
|
|
57
52
|
case 0:
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return [4 /*yield*/, server.start()];
|
|
53
|
+
process.env.NODE_ENV = 'development';
|
|
54
|
+
fs_extra_1.ensureDirSync(constant_1.SRC_DIR);
|
|
55
|
+
return [4 /*yield*/, compileSiteEntry_1.buildSiteEntry()];
|
|
62
56
|
case 1:
|
|
57
|
+
_a.sent();
|
|
58
|
+
devConfig = vite_config_1.getDevConfig(varlet_config_1.getVarletConfig());
|
|
59
|
+
return [4 /*yield*/, vite_1.createServer(lodash_1.merge(devConfig, cmd.force ? { server: { force: true } } : {}))];
|
|
60
|
+
case 2:
|
|
61
|
+
server = _a.sent();
|
|
62
|
+
return [4 /*yield*/, server.listen()];
|
|
63
|
+
case 3:
|
|
63
64
|
_a.sent();
|
|
64
65
|
return [2 /*return*/];
|
|
65
66
|
}
|
|
66
67
|
});
|
|
67
68
|
});
|
|
68
69
|
}
|
|
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
70
|
exports.dev = dev;
|
package/lib/commands/jest.d.ts
CHANGED
|
@@ -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,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
|
{
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
var constant_1 = require("../shared/constant");
|
|
4
4
|
module.exports = {
|
|
5
5
|
moduleNameMapper: {
|
|
6
|
+
'@varlet/ui': constant_1.JEST_LIB_MOCK,
|
|
6
7
|
'\\.(css|less)$': constant_1.JEST_STYLE_MOCK,
|
|
7
8
|
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': constant_1.JEST_MEDIA_MOCK,
|
|
8
9
|
},
|
|
@@ -18,5 +19,5 @@ module.exports = {
|
|
|
18
19
|
"!**/" + constant_1.TESTS_DIR_NAME + "/**",
|
|
19
20
|
],
|
|
20
21
|
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'vue'],
|
|
21
|
-
transformIgnorePatterns: ['/node_modules/(?!(@varlet/cli))'],
|
|
22
|
+
transformIgnorePatterns: ['/node_modules/(?!(@varlet/cli))/'],
|
|
22
23
|
};
|
|
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;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.getUMDConfig = exports.getBuildConfig = exports.getDevConfig = void 0;
|
|
18
|
+
var plugin_vue_1 = __importDefault(require("@vitejs/plugin-vue"));
|
|
19
|
+
var markdown_vite_plugin_1 = __importDefault(require("@varlet/markdown-vite-plugin"));
|
|
20
|
+
var plugin_vue_jsx_1 = __importDefault(require("@vitejs/plugin-vue-jsx"));
|
|
21
|
+
var vite_plugin_html_1 = require("vite-plugin-html");
|
|
22
|
+
var constant_1 = require("../shared/constant");
|
|
23
|
+
var lodash_1 = require("lodash");
|
|
24
|
+
var path_1 = require("path");
|
|
25
|
+
var fs_extra_1 = require("fs-extra");
|
|
26
|
+
function getDevConfig(varletConfig) {
|
|
27
|
+
var defaultLanguage = lodash_1.get(varletConfig, 'defaultLanguage');
|
|
28
|
+
var host = lodash_1.get(varletConfig, 'host');
|
|
29
|
+
return {
|
|
30
|
+
root: constant_1.SITE,
|
|
31
|
+
resolve: {
|
|
32
|
+
extensions: constant_1.VITE_RESOLVE_EXTENSIONS,
|
|
33
|
+
alias: {
|
|
34
|
+
'@config': constant_1.SITE_CONFIG,
|
|
35
|
+
'@pc-routes': constant_1.SITE_PC_ROUTES,
|
|
36
|
+
'@mobile-routes': constant_1.SITE_MOBILE_ROUTES,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
server: {
|
|
40
|
+
port: lodash_1.get(varletConfig, 'port'),
|
|
41
|
+
host: host === 'localhost' ? '0.0.0.0' : host,
|
|
42
|
+
},
|
|
43
|
+
publicDir: constant_1.SITE_PUBLIC_PATH,
|
|
44
|
+
plugins: [
|
|
45
|
+
plugin_vue_1.default({
|
|
46
|
+
include: [/\.vue$/, /\.md$/],
|
|
47
|
+
}),
|
|
48
|
+
markdown_vite_plugin_1.default({ style: lodash_1.get(varletConfig, 'highlight.style') }),
|
|
49
|
+
plugin_vue_jsx_1.default(),
|
|
50
|
+
vite_plugin_html_1.injectHtml({
|
|
51
|
+
data: {
|
|
52
|
+
pcTitle: lodash_1.get(varletConfig, "title[" + defaultLanguage + "]"),
|
|
53
|
+
mobileTitle: lodash_1.get(varletConfig, "title[" + defaultLanguage + "]"),
|
|
54
|
+
logo: lodash_1.get(varletConfig, "logo"),
|
|
55
|
+
baidu: lodash_1.get(varletConfig, "analysis.baidu", ''),
|
|
56
|
+
},
|
|
57
|
+
}),
|
|
58
|
+
],
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
exports.getDevConfig = getDevConfig;
|
|
62
|
+
function getBuildConfig(varletConfig) {
|
|
63
|
+
var devConfig = getDevConfig(varletConfig);
|
|
64
|
+
return __assign(__assign({}, devConfig), { build: {
|
|
65
|
+
outDir: constant_1.SITE_OUTPUT_PATH,
|
|
66
|
+
brotliSize: false,
|
|
67
|
+
emptyOutDir: true,
|
|
68
|
+
rollupOptions: {
|
|
69
|
+
input: {
|
|
70
|
+
main: path_1.resolve(constant_1.SITE, 'index.html'),
|
|
71
|
+
nested: path_1.resolve(constant_1.SITE, 'mobile.html'),
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
} });
|
|
75
|
+
}
|
|
76
|
+
exports.getBuildConfig = getBuildConfig;
|
|
77
|
+
function inlineCSS(fileName, dir) {
|
|
78
|
+
return {
|
|
79
|
+
name: 'varlet-inline-css-vite-plugin',
|
|
80
|
+
apply: 'build',
|
|
81
|
+
closeBundle: function () {
|
|
82
|
+
var cssFile = path_1.resolve(dir, 'style.css');
|
|
83
|
+
var jsFile = path_1.resolve(dir, fileName);
|
|
84
|
+
var cssCode = fs_extra_1.readFileSync(cssFile, 'utf-8');
|
|
85
|
+
var jsCode = fs_extra_1.readFileSync(jsFile, 'utf-8');
|
|
86
|
+
var injectCode = ";(function(){var style=document.createElement('style');style.type='text/css';style.rel='stylesheet';style.appendChild(document.createTextNode(`" + cssCode.replace(/\\/g, '\\\\') + "`));var head=document.querySelector('head');head.appendChild(style)})();";
|
|
87
|
+
fs_extra_1.removeSync(cssFile);
|
|
88
|
+
fs_extra_1.writeFileSync(jsFile, "" + injectCode + jsCode);
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function clear() {
|
|
93
|
+
return {
|
|
94
|
+
name: 'varlet-clear-vite-plugin',
|
|
95
|
+
apply: 'build',
|
|
96
|
+
closeBundle: function () {
|
|
97
|
+
fs_extra_1.removeSync(path_1.resolve(constant_1.CWD, 'dist'));
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function getUMDConfig(varletConfig) {
|
|
102
|
+
var name = lodash_1.get(varletConfig, 'name');
|
|
103
|
+
var fileName = lodash_1.kebabCase(name) + ".js";
|
|
104
|
+
return {
|
|
105
|
+
logLevel: 'silent',
|
|
106
|
+
build: {
|
|
107
|
+
emptyOutDir: true,
|
|
108
|
+
lib: {
|
|
109
|
+
name: name,
|
|
110
|
+
formats: ['umd'],
|
|
111
|
+
fileName: function () { return fileName; },
|
|
112
|
+
entry: path_1.resolve(constant_1.ES_DIR, 'umdIndex.js'),
|
|
113
|
+
},
|
|
114
|
+
rollupOptions: {
|
|
115
|
+
external: ['vue'],
|
|
116
|
+
output: {
|
|
117
|
+
dir: constant_1.UMD_DIR,
|
|
118
|
+
exports: 'named',
|
|
119
|
+
globals: {
|
|
120
|
+
vue: 'Vue',
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
plugins: [inlineCSS(fileName, constant_1.UMD_DIR), clear()],
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
exports.getUMDConfig = getUMDConfig;
|
package/lib/index.js
CHANGED
|
@@ -20,6 +20,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
20
20
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
var logger_1 = __importDefault(require("./shared/logger"));
|
|
23
24
|
var commander_1 = require("commander");
|
|
24
25
|
var dev_1 = require("./commands/dev");
|
|
25
26
|
var build_1 = require("./commands/build");
|
|
@@ -28,9 +29,11 @@ var create_1 = require("./commands/create");
|
|
|
28
29
|
var jest_1 = require("./commands/jest");
|
|
29
30
|
var lint_1 = require("./commands/lint");
|
|
30
31
|
var gen_1 = require("./commands/gen");
|
|
31
|
-
var logger_1 = __importDefault(require("./shared/logger"));
|
|
32
32
|
commander_1.version("varlet-cli " + require('../package.json').version).usage('<command> [options]');
|
|
33
|
-
commander_1.command('dev')
|
|
33
|
+
commander_1.command('dev')
|
|
34
|
+
.option('-f --force', 'Force dep pre-optimization regardless of whether deps have changed')
|
|
35
|
+
.description('Run varlet development environment')
|
|
36
|
+
.action(dev_1.dev);
|
|
34
37
|
commander_1.command('build').description('Build varlet site for production').action(build_1.build);
|
|
35
38
|
commander_1.command('compile')
|
|
36
39
|
.description('Compile varlet components library code')
|
package/lib/shared/constant.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare const TYPES_DIR: string;
|
|
|
9
9
|
export declare const ROOT_DOCS_DIR: string;
|
|
10
10
|
export declare const ESLINT_EXTENSIONS: string[];
|
|
11
11
|
export declare const WEBPACK_RESOLVE_EXTENSIONS: string[];
|
|
12
|
+
export declare const VITE_RESOLVE_EXTENSIONS: string[];
|
|
12
13
|
export declare const SCRIPTS_EXTENSIONS: string[];
|
|
13
14
|
export declare const PUBLIC_DIR_INDEXES: string[];
|
|
14
15
|
export declare const STYLE_DIR_NAME = "style";
|
|
@@ -43,3 +44,4 @@ export declare const HL_WEB_TYPES_JSON: string;
|
|
|
43
44
|
export declare const JEST_CONFIG: string;
|
|
44
45
|
export declare const JEST_MEDIA_MOCK: string;
|
|
45
46
|
export declare const JEST_STYLE_MOCK: string;
|
|
47
|
+
export declare const JEST_LIB_MOCK: string;
|
package/lib/shared/constant.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JEST_STYLE_MOCK = exports.JEST_MEDIA_MOCK = exports.JEST_CONFIG = exports.HL_WEB_TYPES_JSON = exports.HL_ATTRIBUTES_JSON = exports.HL_TAGS_JSON = exports.HL_DIR = exports.HL_MD = exports.HL_TITLE_SLOTS_RE = exports.HL_TITLE_EVENTS_RE = exports.HL_TITLE_ATTRIBUTES_RE = exports.HL_API_RE = exports.HL_COMPONENT_NAME_RE = exports.SITE_EXAMPLE_GLOB = exports.SITE_DOCS_GLOB = exports.SITE_CONFIG = exports.SITE_MOBILE_ROUTES = exports.SITE_PC_ROUTES = exports.SITE_PUBLIC_PATH = exports.SITE_OUTPUT_PATH = exports.SITE = exports.SITE_PC_MAIN = exports.SITE_MOBILE_MAIN = exports.PRIMARY_COLOR = exports.CLI_PACKAGE_JSON = exports.GENERATORS_DIR = exports.TESTS_DIR_NAME = exports.EXAMPLE_DIR_INDEX = exports.DOCS_DIR_NAME = exports.EXAMPLE_LOCALE_DIR_NAME = exports.EXAMPLE_DIR_NAME = exports.STYLE_DIR_NAME = exports.PUBLIC_DIR_INDEXES = exports.SCRIPTS_EXTENSIONS = exports.WEBPACK_RESOLVE_EXTENSIONS = exports.ESLINT_EXTENSIONS = exports.ROOT_DOCS_DIR = exports.TYPES_DIR = exports.UMD_DIR = exports.ES_DIR = exports.SRC_DIR = exports.VARLET_CONFIG = exports.TS_CONFIG = exports.POSTCSS_CONFIG = exports.CWD = void 0;
|
|
3
|
+
exports.JEST_LIB_MOCK = exports.JEST_STYLE_MOCK = exports.JEST_MEDIA_MOCK = exports.JEST_CONFIG = exports.HL_WEB_TYPES_JSON = exports.HL_ATTRIBUTES_JSON = exports.HL_TAGS_JSON = exports.HL_DIR = exports.HL_MD = exports.HL_TITLE_SLOTS_RE = exports.HL_TITLE_EVENTS_RE = exports.HL_TITLE_ATTRIBUTES_RE = exports.HL_API_RE = exports.HL_COMPONENT_NAME_RE = exports.SITE_EXAMPLE_GLOB = exports.SITE_DOCS_GLOB = exports.SITE_CONFIG = exports.SITE_MOBILE_ROUTES = exports.SITE_PC_ROUTES = exports.SITE_PUBLIC_PATH = exports.SITE_OUTPUT_PATH = exports.SITE = exports.SITE_PC_MAIN = exports.SITE_MOBILE_MAIN = exports.PRIMARY_COLOR = exports.CLI_PACKAGE_JSON = exports.GENERATORS_DIR = exports.TESTS_DIR_NAME = exports.EXAMPLE_DIR_INDEX = exports.DOCS_DIR_NAME = exports.EXAMPLE_LOCALE_DIR_NAME = exports.EXAMPLE_DIR_NAME = exports.STYLE_DIR_NAME = exports.PUBLIC_DIR_INDEXES = exports.SCRIPTS_EXTENSIONS = exports.VITE_RESOLVE_EXTENSIONS = exports.WEBPACK_RESOLVE_EXTENSIONS = exports.ESLINT_EXTENSIONS = exports.ROOT_DOCS_DIR = exports.TYPES_DIR = exports.UMD_DIR = exports.ES_DIR = exports.SRC_DIR = exports.VARLET_CONFIG = exports.TS_CONFIG = exports.POSTCSS_CONFIG = exports.CWD = void 0;
|
|
4
4
|
var path_1 = require("path");
|
|
5
5
|
exports.CWD = process.cwd();
|
|
6
6
|
exports.POSTCSS_CONFIG = path_1.resolve(exports.CWD, 'postcss.config.js');
|
|
@@ -13,6 +13,7 @@ exports.TYPES_DIR = path_1.resolve(exports.CWD, 'types');
|
|
|
13
13
|
exports.ROOT_DOCS_DIR = path_1.resolve(exports.CWD, 'docs');
|
|
14
14
|
exports.ESLINT_EXTENSIONS = ['.vue', '.ts', '.js', '.mjs', '.tsx', '.jsx'];
|
|
15
15
|
exports.WEBPACK_RESOLVE_EXTENSIONS = ['.js', '.jsx', '.vue', '.ts', '.tsx', '.css', '.less'];
|
|
16
|
+
exports.VITE_RESOLVE_EXTENSIONS = ['.vue', '.tsx', '.ts', '.jsx', '.js', '.less', '.css'];
|
|
16
17
|
exports.SCRIPTS_EXTENSIONS = ['.tsx', '.ts', '.jsx', '.js'];
|
|
17
18
|
exports.PUBLIC_DIR_INDEXES = ['index.vue', 'index.tsx', 'index.ts', 'index.jsx', 'index.js'];
|
|
18
19
|
exports.STYLE_DIR_NAME = 'style';
|
|
@@ -50,3 +51,4 @@ exports.HL_WEB_TYPES_JSON = path_1.resolve(exports.HL_DIR, 'web-types.json');
|
|
|
50
51
|
exports.JEST_CONFIG = path_1.resolve(__dirname, '../config/jest.config.js');
|
|
51
52
|
exports.JEST_MEDIA_MOCK = path_1.resolve(__dirname, '../config/jest.media.mock.js');
|
|
52
53
|
exports.JEST_STYLE_MOCK = path_1.resolve(__dirname, '../config/jest.style.mock.js');
|
|
54
|
+
exports.JEST_LIB_MOCK = path_1.resolve(__dirname, '../config/jest.lib.mock.js');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varlet/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.0-alpha.5+92fc6bb7",
|
|
4
4
|
"description": "cli of varlet",
|
|
5
5
|
"bin": {
|
|
6
6
|
"varlet-cli": "./lib/index.js"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dev": "tsc --watch",
|
|
32
32
|
"build": "tsc"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "92fc6bb770a969a984707921b66f616d606f1d58",
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@babel/core": "^7.14.8",
|
|
37
37
|
"@babel/preset-env": "^7.14.8",
|
|
@@ -41,69 +41,55 @@
|
|
|
41
41
|
"@release-it/conventional-changelog": "^3.3.0",
|
|
42
42
|
"@varlet/eslint-config": "^1.13.0",
|
|
43
43
|
"@varlet/icons": "^1.0.0",
|
|
44
|
-
"@varlet/markdown-
|
|
44
|
+
"@varlet/markdown-vite-plugin": "^1.20.0",
|
|
45
45
|
"@varlet/stylelint-config": "^1.9.0",
|
|
46
46
|
"@varlet/touch-emulator": "^1.0.1",
|
|
47
|
-
"@varlet/ui": "^1.
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
47
|
+
"@varlet/ui": "^1.22.0-alpha.5+92fc6bb7",
|
|
48
|
+
"@vitejs/plugin-vue": "1.9.2",
|
|
49
|
+
"@vitejs/plugin-vue-jsx": "1.1.8",
|
|
50
|
+
"@vue/babel-plugin-jsx": "^1.0.7",
|
|
50
51
|
"@vue/test-utils": "^2.0.0-rc.6",
|
|
51
52
|
"babel-jest": "26.6.3",
|
|
52
|
-
"babel-loader": "^8.2.2",
|
|
53
|
-
"babel-plugin-import": "^1.13.3",
|
|
54
53
|
"chalk": "^4.1.0",
|
|
55
54
|
"chokidar": "^3.5.2",
|
|
56
|
-
"clean-webpack-plugin": "^3.0.0",
|
|
57
55
|
"clipboard": "^2.0.6",
|
|
58
56
|
"commander": "^6.2.0",
|
|
59
57
|
"commitizen": "^4.2.2",
|
|
60
58
|
"conventional-changelog-cli": "^2.1.1",
|
|
61
|
-
"copy-webpack-plugin": "^9.0.1",
|
|
62
|
-
"css-loader": "^5.2.7",
|
|
63
59
|
"cz-conventional-changelog": "^3.3.0",
|
|
64
60
|
"eslint": "^7.30.0",
|
|
65
61
|
"execa": "^5.0.0",
|
|
66
|
-
"fork-ts-checker-webpack-plugin": "^5.2.1",
|
|
67
62
|
"fs-extra": "^9.0.1",
|
|
68
63
|
"hash-sum": "^2.0.0",
|
|
69
|
-
"html-webpack-plugin": "^5.1.0",
|
|
70
64
|
"husky": "^7.0.1",
|
|
71
65
|
"inquirer": "^8.1.2",
|
|
72
66
|
"jest": "^26.6.3",
|
|
73
67
|
"less": "^3.12.2",
|
|
74
|
-
"less-loader": "^7.0.2",
|
|
75
68
|
"lint-staged": "^10.5.0",
|
|
76
69
|
"lodash": "^4.17.21",
|
|
70
|
+
"lodash-es": "^4.17.21",
|
|
77
71
|
"ora": "^5.4.0",
|
|
78
|
-
"portfinder": "^1.0.28",
|
|
79
|
-
"postcss": "^8.3.7",
|
|
80
|
-
"postcss-loader": "^4.0.4",
|
|
81
|
-
"postcss-preset-env": "^6.7.0",
|
|
82
72
|
"prettier": "^2.3.2",
|
|
83
73
|
"release-it": "^14.11.5",
|
|
84
74
|
"slash": "^3.0.0",
|
|
85
|
-
"style-loader": "^2.0.0",
|
|
86
75
|
"stylelint": "^13.13.1",
|
|
87
76
|
"ts-jest": "^26.5.1",
|
|
88
77
|
"typescript": "^4.3.5",
|
|
78
|
+
"vite": "2.5.10",
|
|
79
|
+
"vite-plugin-html": "^2.1.0",
|
|
89
80
|
"vue-jest": "^5.0.0-alpha.8",
|
|
90
81
|
"vue-loader": "16.5.0",
|
|
91
|
-
"vue-router": "4.0.0-rc.1"
|
|
92
|
-
"webpack": "^5.23.0",
|
|
93
|
-
"webpack-dev-server": "^4.2.0",
|
|
94
|
-
"webpack-merge": "^5.3.0",
|
|
95
|
-
"webpackbar": "^5.0.0-3"
|
|
82
|
+
"vue-router": "4.0.0-rc.1"
|
|
96
83
|
},
|
|
97
84
|
"devDependencies": {
|
|
98
85
|
"@types/babel__core": "^7.1.12",
|
|
99
|
-
"@types/copy-webpack-plugin": "^8.0.1",
|
|
100
86
|
"@types/fs-extra": "^9.0.2",
|
|
101
87
|
"@types/hash-sum": "^1.0.0",
|
|
102
88
|
"@types/jest": "^26.0.15",
|
|
103
|
-
"@types/lodash": "^4.14.
|
|
104
|
-
"@types/webpack-dev-server": "^4.1.0"
|
|
89
|
+
"@types/lodash": "^4.14.174"
|
|
105
90
|
},
|
|
106
91
|
"peerDependencies": {
|
|
107
|
-
"vue": "3.
|
|
92
|
+
"@vue/compiler-sfc": "3.2.17",
|
|
93
|
+
"vue": "3.2.17"
|
|
108
94
|
}
|
|
109
95
|
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
|
-
<title><%=
|
|
5
|
+
<title><%= pcTitle %></title>
|
|
6
6
|
<meta http-equiv="Cache-Control" content="no-cache">
|
|
7
7
|
<meta http-equiv="Pragma" content="no-cache">
|
|
8
8
|
<meta http-equiv="Expires" content="0">
|
|
9
|
-
<link href="<%=
|
|
9
|
+
<link href="<%= logo %>" rel="icon" type="image/png" />
|
|
10
10
|
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"
|
|
11
11
|
name="viewport" />
|
|
12
12
|
<style>
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
}
|
|
20
20
|
</style>
|
|
21
21
|
<script>
|
|
22
|
-
if ('<%=
|
|
22
|
+
if ('<%= baidu %>') {
|
|
23
23
|
var _hmt = _hmt || [];
|
|
24
24
|
(function() {
|
|
25
25
|
var hm = document.createElement('script')
|
|
26
|
-
hm.src = '<%=
|
|
26
|
+
hm.src = '<%= baidu %>'
|
|
27
27
|
var s = document.getElementsByTagName('script')[0]
|
|
28
28
|
s.parentNode.insertBefore(hm, s)
|
|
29
29
|
})()
|
|
@@ -32,5 +32,7 @@
|
|
|
32
32
|
</head>
|
|
33
33
|
<body>
|
|
34
34
|
<div id="app"></div>
|
|
35
|
+
|
|
36
|
+
<script type="module" src="/pc/main.ts"></script>
|
|
35
37
|
</body>
|
|
36
38
|
</html>
|
package/site/mobile/App.vue
CHANGED
|
@@ -53,7 +53,7 @@ import config from '@config'
|
|
|
53
53
|
import { computed, ComputedRef, defineComponent, ref, Ref, watch } from 'vue'
|
|
54
54
|
import { useRoute } from 'vue-router'
|
|
55
55
|
import { bigCamelize, removeEmpty, setThemes, watchLang } from '../utils'
|
|
56
|
-
import { get } from 'lodash'
|
|
56
|
+
import { get } from 'lodash-es'
|
|
57
57
|
|
|
58
58
|
type Language = Record<string, string>
|
|
59
59
|
|
|
@@ -107,8 +107,6 @@ export default defineComponent({
|
|
|
107
107
|
</script>
|
|
108
108
|
|
|
109
109
|
<style lang="less">
|
|
110
|
-
@import '~@varlet/ui/es/styles/var';
|
|
111
|
-
|
|
112
110
|
body {
|
|
113
111
|
margin: 0;
|
|
114
112
|
padding: 0;
|
package/site/mobile/main.ts
CHANGED
|
@@ -6,8 +6,16 @@ import App from './App.vue'
|
|
|
6
6
|
import '@varlet/touch-emulator'
|
|
7
7
|
import { createApp } from 'vue'
|
|
8
8
|
import { createRouter, createWebHashHistory } from 'vue-router'
|
|
9
|
+
|
|
9
10
|
import { Icon, AppBar, Button, Menu, Cell, Ripple } from '@varlet/ui'
|
|
10
|
-
import
|
|
11
|
+
import '@varlet/ui/es/icon/style'
|
|
12
|
+
import '@varlet/ui/es/app-bar/style'
|
|
13
|
+
import '@varlet/ui/es/button/style'
|
|
14
|
+
import '@varlet/ui/es/menu/style'
|
|
15
|
+
import '@varlet/ui/es/cell/style'
|
|
16
|
+
import '@varlet/ui/es/ripple/style'
|
|
17
|
+
|
|
18
|
+
import { get } from 'lodash-es'
|
|
11
19
|
import { inIframe, isPhone } from '../utils'
|
|
12
20
|
|
|
13
21
|
const redirect = get(config, 'mobile.redirect')
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
|
-
<title><%=
|
|
5
|
+
<title><%= mobileTitle %></title>
|
|
6
6
|
<meta http-equiv="Cache-Control" content="no-cache">
|
|
7
7
|
<meta http-equiv="Pragma" content="no-cache">
|
|
8
8
|
<meta http-equiv="Expires" content="0">
|
|
9
|
-
<
|
|
10
|
-
<link href="<%= htmlWebpackPlugin.options.logo %>" rel="icon" type="image/png" />
|
|
9
|
+
<link href="<%= logo %>" rel="icon" type="image/png" />
|
|
11
10
|
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"
|
|
12
11
|
name="viewport" />
|
|
13
12
|
<style>
|
|
@@ -20,11 +19,11 @@
|
|
|
20
19
|
}
|
|
21
20
|
</style>
|
|
22
21
|
<script>
|
|
23
|
-
if ('<%=
|
|
22
|
+
if ('<%= baidu %>') {
|
|
24
23
|
var _hmt = _hmt || [];
|
|
25
24
|
(function() {
|
|
26
25
|
var hm = document.createElement('script')
|
|
27
|
-
hm.src = '<%=
|
|
26
|
+
hm.src = '<%= baidu %>'
|
|
28
27
|
var s = document.getElementsByTagName('script')[0]
|
|
29
28
|
s.parentNode.insertBefore(hm, s)
|
|
30
29
|
})()
|
|
@@ -33,5 +32,7 @@
|
|
|
33
32
|
</head>
|
|
34
33
|
<body>
|
|
35
34
|
<div id="app"></div>
|
|
35
|
+
|
|
36
|
+
<script type="module" src="/mobile/main.ts"></script>
|
|
36
37
|
</body>
|
|
37
38
|
</html>
|
package/site/pc/App.vue
CHANGED
|
@@ -36,7 +36,7 @@ import AppHeader from './components/AppHeader'
|
|
|
36
36
|
import AppSidebar from './components/AppSidebar'
|
|
37
37
|
import { defineComponent, nextTick, onMounted, ref, Ref, watch } from 'vue'
|
|
38
38
|
import { useRoute } from 'vue-router'
|
|
39
|
-
import { get } from 'lodash'
|
|
39
|
+
import { get } from 'lodash-es'
|
|
40
40
|
import { getPCLocationInfo, isPhone, MenuTypes, setThemes } from '../utils'
|
|
41
41
|
|
|
42
42
|
type Language = Record<string, string>
|
|
@@ -142,7 +142,7 @@ export default defineComponent({
|
|
|
142
142
|
</style>
|
|
143
143
|
|
|
144
144
|
<style lang="less">
|
|
145
|
-
@import '
|
|
145
|
+
@import '@varlet/ui/es/progress/progress';
|
|
146
146
|
|
|
147
147
|
@doc-active: {
|
|
148
148
|
display: inline;
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
// @ts-ignore
|
|
49
49
|
import config from '@config'
|
|
50
50
|
import { ref, computed } from 'vue'
|
|
51
|
-
import { get } from 'lodash'
|
|
51
|
+
import { get } from 'lodash-es'
|
|
52
52
|
import { getPCLocationInfo, removeEmpty } from '../../utils'
|
|
53
53
|
import { useRouter } from 'vue-router'
|
|
54
54
|
import type { Ref, ComputedRef } from 'vue'
|
|
@@ -91,8 +91,6 @@ export default {
|
|
|
91
91
|
</script>
|
|
92
92
|
|
|
93
93
|
<style scoped lang="less">
|
|
94
|
-
@import '~@varlet/ui/es/styles/var';
|
|
95
|
-
|
|
96
94
|
.fade-enter-active {
|
|
97
95
|
animation-name: fade-in;
|
|
98
96
|
animation-duration: 0.3s;
|
|
@@ -30,7 +30,7 @@ import { MenuTypes } from '../../utils'
|
|
|
30
30
|
import { reactive, ref } from 'vue'
|
|
31
31
|
import type { PropType } from 'vue'
|
|
32
32
|
import type { Menu } from '../App'
|
|
33
|
-
import { get } from 'lodash'
|
|
33
|
+
import { get } from 'lodash-es'
|
|
34
34
|
|
|
35
35
|
export default {
|
|
36
36
|
name: 'AppSidebar',
|
|
@@ -68,8 +68,6 @@ export default {
|
|
|
68
68
|
</script>
|
|
69
69
|
|
|
70
70
|
<style scoped lang="less">
|
|
71
|
-
@import '~@varlet/ui/es/styles/var';
|
|
72
|
-
|
|
73
71
|
.varlet-site-sidebar {
|
|
74
72
|
padding: 0 0 15px;
|
|
75
73
|
position: sticky;
|
package/site/pc/main.ts
CHANGED
|
@@ -4,10 +4,15 @@ import '@varlet/touch-emulator'
|
|
|
4
4
|
import routes from '@pc-routes'
|
|
5
5
|
// @ts-ignore
|
|
6
6
|
import config from '@config'
|
|
7
|
+
|
|
7
8
|
import { Cell, Ripple, Icon } from '@varlet/ui'
|
|
9
|
+
import '@varlet/ui/es/cell/style'
|
|
10
|
+
import '@varlet/ui/es/ripple/style'
|
|
11
|
+
import '@varlet/ui/es/icon/style'
|
|
12
|
+
|
|
8
13
|
import { createApp } from 'vue'
|
|
9
14
|
import { createRouter, createWebHashHistory } from 'vue-router'
|
|
10
|
-
import { get } from 'lodash'
|
|
15
|
+
import { get } from 'lodash-es'
|
|
11
16
|
import { useProgress } from '../useProgress'
|
|
12
17
|
|
|
13
18
|
const defaultLanguage = get(config, 'defaultLanguage')
|
package/site/useProgress.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Progress } from '@varlet/ui'
|
|
|
4
4
|
import config from '@config'
|
|
5
5
|
// @ts-ignore
|
|
6
6
|
import { mountInstance } from '@varlet/ui/es/utils/components'
|
|
7
|
-
import { get } from 'lodash'
|
|
7
|
+
import { get } from 'lodash-es'
|
|
8
8
|
|
|
9
9
|
export function useProgress() {
|
|
10
10
|
const props = reactive({
|
package/site/utils.ts
CHANGED