@varlet/cli 1.23.3-alpha.1 → 1.23.4-alpha.2
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/CHANGELOG.md +11 -0
- package/generators/sfc/.gitignore +1 -0
- package/generators/sfc/package.json +3 -0
- package/generators/tsx/.gitignore +1 -0
- package/generators/tsx/package.json +3 -0
- package/lib/commands/compile.d.ts +1 -1
- package/lib/commands/compile.js +12 -10
- package/lib/commands/gen.js +1 -1
- package/lib/compiler/compileModule.d.ts +1 -1
- package/lib/compiler/compileModule.js +17 -14
- package/lib/compiler/compileScript.d.ts +2 -1
- package/lib/compiler/compileScript.js +43 -6
- package/lib/compiler/compileStyle.d.ts +2 -0
- package/lib/compiler/compileStyle.js +12 -5
- package/lib/config/babel.config.js +2 -2
- package/lib/shared/constant.d.ts +1 -0
- package/lib/shared/constant.js +2 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.23.3](https://github.com/haoziqaq/varlet/compare/v1.23.2...v1.23.3) (2021-11-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **cli/jest:** add watchAll mode ([84ebb4e](https://github.com/haoziqaq/varlet/commit/84ebb4efe823cb9d7f22995d429b82d8fc3e05c8))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [1.23.0](https://github.com/haoziqaq/varlet/compare/v1.22.10...v1.23.0) (2021-11-19)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"name": "basic-ui",
|
|
3
3
|
"version": "0.0.0",
|
|
4
4
|
"description": "A basic components library",
|
|
5
|
+
"main": "lib/index.js",
|
|
5
6
|
"module": "es/index.js",
|
|
6
7
|
"typings": "types/index.d.ts",
|
|
7
8
|
"vetur": {
|
|
@@ -64,6 +65,7 @@
|
|
|
64
65
|
"eslintConfig": {
|
|
65
66
|
"root": true,
|
|
66
67
|
"ignorePatterns": [
|
|
68
|
+
"lib/**",
|
|
67
69
|
"es/**",
|
|
68
70
|
"umd/**",
|
|
69
71
|
"site/**",
|
|
@@ -80,6 +82,7 @@
|
|
|
80
82
|
"@varlet/stylelint-config"
|
|
81
83
|
],
|
|
82
84
|
"ignoreFiles": [
|
|
85
|
+
"lib/**",
|
|
83
86
|
"es/**",
|
|
84
87
|
"umd/**",
|
|
85
88
|
"site/**",
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"name": "basic-ui",
|
|
3
3
|
"version": "0.0.0",
|
|
4
4
|
"description": "A basic components library",
|
|
5
|
+
"main": "lib/index.js",
|
|
5
6
|
"module": "es/index.js",
|
|
6
7
|
"typings": "types/index.d.ts",
|
|
7
8
|
"vetur": {
|
|
@@ -64,6 +65,7 @@
|
|
|
64
65
|
"eslintConfig": {
|
|
65
66
|
"root": true,
|
|
66
67
|
"ignorePatterns": [
|
|
68
|
+
"lib/**",
|
|
67
69
|
"es/**",
|
|
68
70
|
"umd/**",
|
|
69
71
|
"site/**",
|
|
@@ -80,6 +82,7 @@
|
|
|
80
82
|
"@varlet/stylelint-config"
|
|
81
83
|
],
|
|
82
84
|
"ignoreFiles": [
|
|
85
|
+
"lib/**",
|
|
83
86
|
"es/**",
|
|
84
87
|
"umd/**",
|
|
85
88
|
"site/**",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function removeDir(): Promise<[void, void, void]>;
|
|
1
|
+
export declare function removeDir(): Promise<[void, void, void, void]>;
|
|
2
2
|
export declare function runTask(taskName: string, task: () => any): Promise<void>;
|
|
3
3
|
export declare function compile(cmd: {
|
|
4
4
|
noUmd: boolean;
|
package/lib/commands/compile.js
CHANGED
|
@@ -48,7 +48,7 @@ var compileModule_1 = require("../compiler/compileModule");
|
|
|
48
48
|
var compileTemplateHighlight_1 = require("../compiler/compileTemplateHighlight");
|
|
49
49
|
var compileTypes_1 = require("../compiler/compileTypes");
|
|
50
50
|
function removeDir() {
|
|
51
|
-
return Promise.all([(0, fs_extra_1.remove)(constant_1.ES_DIR), (0, fs_extra_1.remove)(constant_1.HL_DIR), (0, fs_extra_1.remove)(constant_1.UMD_DIR)]);
|
|
51
|
+
return Promise.all([(0, fs_extra_1.remove)(constant_1.ES_DIR), (0, fs_extra_1.remove)(constant_1.LIB_DIR), (0, fs_extra_1.remove)(constant_1.HL_DIR), (0, fs_extra_1.remove)(constant_1.UMD_DIR)]);
|
|
52
52
|
}
|
|
53
53
|
exports.removeDir = removeDir;
|
|
54
54
|
function runTask(taskName, task) {
|
|
@@ -87,20 +87,22 @@ function compile(cmd) {
|
|
|
87
87
|
return [4 /*yield*/, removeDir()];
|
|
88
88
|
case 1:
|
|
89
89
|
_b.sent();
|
|
90
|
-
return [4 /*yield*/, Promise.all([
|
|
91
|
-
runTask('types', compileTypes_1.compileTypes),
|
|
92
|
-
runTask('template highlight', compileTemplateHighlight_1.compileTemplateHighlight),
|
|
93
|
-
runTask('module', compileModule_1.compileModule),
|
|
94
|
-
])];
|
|
90
|
+
return [4 /*yield*/, Promise.all([runTask('types', compileTypes_1.compileTypes), runTask('template highlight', compileTemplateHighlight_1.compileTemplateHighlight)])];
|
|
95
91
|
case 2:
|
|
92
|
+
_b.sent();
|
|
93
|
+
return [4 /*yield*/, runTask('module', compileModule_1.compileModule)];
|
|
94
|
+
case 3:
|
|
95
|
+
_b.sent();
|
|
96
|
+
return [4 /*yield*/, runTask('commonjs', function () { return (0, compileModule_1.compileModule)('commonjs'); })];
|
|
97
|
+
case 4:
|
|
96
98
|
_b.sent();
|
|
97
99
|
_a = !cmd.noUmd;
|
|
98
|
-
if (!_a) return [3 /*break*/,
|
|
100
|
+
if (!_a) return [3 /*break*/, 6];
|
|
99
101
|
return [4 /*yield*/, runTask('umd', function () { return (0, compileModule_1.compileModule)('umd'); })];
|
|
100
|
-
case
|
|
102
|
+
case 5:
|
|
101
103
|
_a = (_b.sent());
|
|
102
|
-
_b.label =
|
|
103
|
-
case
|
|
104
|
+
_b.label = 6;
|
|
105
|
+
case 6:
|
|
104
106
|
_a;
|
|
105
107
|
return [2 /*return*/];
|
|
106
108
|
}
|
package/lib/commands/gen.js
CHANGED
|
@@ -54,7 +54,7 @@ function syncVersion(name) {
|
|
|
54
54
|
var pkg = JSON.parse((0, fs_extra_1.readFileSync)(file, 'utf-8'));
|
|
55
55
|
var cliPkg = JSON.parse((0, fs_extra_1.readFileSync)(constant_1.CLI_PACKAGE_JSON, 'utf-8'));
|
|
56
56
|
pkg.devDependencies['@varlet/cli'] = "^" + cliPkg.version;
|
|
57
|
-
pkg.files = ['es', 'umd', 'highlight', 'types', 'README.md'];
|
|
57
|
+
pkg.files = ['es', 'lib', 'umd', 'highlight', 'types', 'README.md'];
|
|
58
58
|
(0, fs_extra_1.writeFileSync)(file, JSON.stringify(pkg, null, 2));
|
|
59
59
|
}
|
|
60
60
|
function gen(name) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare function compileUMD(): Promise<void>;
|
|
2
2
|
export declare function compileDir(dir: string): Promise<void>;
|
|
3
3
|
export declare function compileFile(file: string): Promise<void>;
|
|
4
|
-
export declare function compileModule(modules?:
|
|
4
|
+
export declare function compileModule(modules?: 'umd' | 'commonjs' | boolean): Promise<void>;
|
|
@@ -127,23 +127,26 @@ exports.compileFile = compileFile;
|
|
|
127
127
|
function compileModule(modules) {
|
|
128
128
|
if (modules === void 0) { modules = false; }
|
|
129
129
|
return __awaiter(this, void 0, void 0, function () {
|
|
130
|
-
var
|
|
131
|
-
return __generator(this, function (
|
|
132
|
-
switch (
|
|
130
|
+
var dest, moduleDir, publicDirs;
|
|
131
|
+
return __generator(this, function (_a) {
|
|
132
|
+
switch (_a.label) {
|
|
133
133
|
case 0:
|
|
134
134
|
if (!(modules === 'umd')) return [3 /*break*/, 2];
|
|
135
135
|
return [4 /*yield*/, compileUMD()];
|
|
136
136
|
case 1:
|
|
137
|
-
|
|
137
|
+
_a.sent();
|
|
138
138
|
return [2 /*return*/];
|
|
139
|
-
case 2:
|
|
139
|
+
case 2:
|
|
140
|
+
process.env.BABEL_MODULE = modules === 'commonjs' ? 'commonjs' : 'module';
|
|
141
|
+
dest = modules === 'commonjs' ? constant_1.LIB_DIR : constant_1.ES_DIR;
|
|
142
|
+
return [4 /*yield*/, (0, fs_extra_1.copy)(constant_1.SRC_DIR, dest)];
|
|
140
143
|
case 3:
|
|
141
|
-
|
|
142
|
-
return [4 /*yield*/, (0, fs_extra_1.readdir)(
|
|
144
|
+
_a.sent();
|
|
145
|
+
return [4 /*yield*/, (0, fs_extra_1.readdir)(dest)];
|
|
143
146
|
case 4:
|
|
144
|
-
moduleDir =
|
|
147
|
+
moduleDir = _a.sent();
|
|
145
148
|
return [4 /*yield*/, Promise.all(moduleDir.map(function (filename) {
|
|
146
|
-
var file = (0, path_1.resolve)(
|
|
149
|
+
var file = (0, path_1.resolve)(dest, filename);
|
|
147
150
|
if ((0, fsUtils_1.isDir)(file)) {
|
|
148
151
|
(0, fs_extra_1.ensureFileSync)((0, path_1.resolve)(file, './style/index.js'));
|
|
149
152
|
(0, fs_extra_1.ensureFileSync)((0, path_1.resolve)(file, './style/less.js'));
|
|
@@ -151,13 +154,13 @@ function compileModule(modules) {
|
|
|
151
154
|
return (0, fsUtils_1.isDir)(file) ? compileDir(file) : null;
|
|
152
155
|
}))];
|
|
153
156
|
case 5:
|
|
154
|
-
|
|
155
|
-
_a = compileScript_1.compileLibraryEntry;
|
|
156
|
-
_b = [constant_1.ES_DIR];
|
|
157
|
+
_a.sent();
|
|
157
158
|
return [4 /*yield*/, (0, fsUtils_1.getPublicDirs)()];
|
|
158
|
-
case 6:
|
|
159
|
+
case 6:
|
|
160
|
+
publicDirs = _a.sent();
|
|
161
|
+
return [4 /*yield*/, (modules === 'commonjs' ? (0, compileScript_1.compileCommonJSEntry)(dest, publicDirs) : (0, compileScript_1.compileESEntry)(dest, publicDirs))];
|
|
159
162
|
case 7:
|
|
160
|
-
|
|
163
|
+
_a.sent();
|
|
161
164
|
return [2 /*return*/];
|
|
162
165
|
}
|
|
163
166
|
});
|
|
@@ -8,4 +8,5 @@ export declare const replaceJSXExt: (script: string) => string;
|
|
|
8
8
|
export declare const replaceTSXExt: (script: string) => string;
|
|
9
9
|
export declare function compileScript(script: string, file: string): Promise<void>;
|
|
10
10
|
export declare function compileScriptFile(file: string): Promise<void>;
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function compileESEntry(dir: string, publicDirs: string[]): Promise<void>;
|
|
12
|
+
export declare function compileCommonJSEntry(dir: string, publicDirs: string[]): Promise<void>;
|
|
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.compileCommonJSEntry = exports.compileESEntry = exports.compileScriptFile = exports.compileScript = exports.replaceTSXExt = exports.replaceJSXExt = exports.replaceTSExt = exports.replaceVueExt = exports.IMPORT_TSX_PATH_RE = exports.IMPORT_JSX_PATH_RE = exports.IMPORT_TS_PATH_RE = exports.IMPORT_VUE_PATH_RE = void 0;
|
|
40
40
|
var core_1 = require("@babel/core");
|
|
41
41
|
var fsUtils_1 = require("../shared/fsUtils");
|
|
42
42
|
var fs_extra_1 = require("fs-extra");
|
|
@@ -57,7 +57,7 @@ var replaceTSXExt = function (script) { return script.replace(exports.IMPORT_TSX
|
|
|
57
57
|
exports.replaceTSXExt = replaceTSXExt;
|
|
58
58
|
function compileScript(script, file) {
|
|
59
59
|
return __awaiter(this, void 0, void 0, function () {
|
|
60
|
-
var code;
|
|
60
|
+
var code, modules;
|
|
61
61
|
return __generator(this, function (_a) {
|
|
62
62
|
switch (_a.label) {
|
|
63
63
|
case 0: return [4 /*yield*/, (0, core_1.transformAsync)(script, {
|
|
@@ -65,8 +65,9 @@ function compileScript(script, file) {
|
|
|
65
65
|
})];
|
|
66
66
|
case 1:
|
|
67
67
|
code = (_a.sent()).code;
|
|
68
|
-
|
|
69
|
-
code = (0, compileStyle_1.extractStyleDependencies)(file, code, compileStyle_1.
|
|
68
|
+
modules = process.env.BABEL_MODULE;
|
|
69
|
+
code = (0, compileStyle_1.extractStyleDependencies)(file, code, modules === 'commonjs' ? compileStyle_1.REQUIRE_CSS_RE : compileStyle_1.IMPORT_CSS_RE, 'css', false);
|
|
70
|
+
code = (0, compileStyle_1.extractStyleDependencies)(file, code, modules === 'commonjs' ? compileStyle_1.REQUIRE_LESS_RE : compileStyle_1.IMPORT_LESS_RE, 'less', false);
|
|
70
71
|
code = (0, exports.replaceVueExt)(code);
|
|
71
72
|
code = (0, exports.replaceTSXExt)(code);
|
|
72
73
|
code = (0, exports.replaceJSXExt)(code);
|
|
@@ -95,7 +96,7 @@ function compileScriptFile(file) {
|
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
98
|
exports.compileScriptFile = compileScriptFile;
|
|
98
|
-
function
|
|
99
|
+
function compileESEntry(dir, publicDirs) {
|
|
99
100
|
return __awaiter(this, void 0, void 0, function () {
|
|
100
101
|
var imports, plugins, constInternalComponents, cssImports, lessImports, publicComponents, install, indexTemplate, styleTemplate, umdTemplate, lessTemplate;
|
|
101
102
|
return __generator(this, function (_a) {
|
|
@@ -134,4 +135,40 @@ function compileLibraryEntry(dir, publicDirs) {
|
|
|
134
135
|
});
|
|
135
136
|
});
|
|
136
137
|
}
|
|
137
|
-
exports.
|
|
138
|
+
exports.compileESEntry = compileESEntry;
|
|
139
|
+
function compileCommonJSEntry(dir, publicDirs) {
|
|
140
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
141
|
+
var requires, plugins, cssRequires, lessRequires, publicComponents, install, indexTemplate, styleTemplate, lessTemplate;
|
|
142
|
+
return __generator(this, function (_a) {
|
|
143
|
+
switch (_a.label) {
|
|
144
|
+
case 0:
|
|
145
|
+
requires = [];
|
|
146
|
+
plugins = [];
|
|
147
|
+
cssRequires = [];
|
|
148
|
+
lessRequires = [];
|
|
149
|
+
publicComponents = [];
|
|
150
|
+
publicDirs.forEach(function (dirname) {
|
|
151
|
+
var publicComponent = (0, fsUtils_1.bigCamelize)(dirname);
|
|
152
|
+
publicComponents.push(publicComponent);
|
|
153
|
+
requires.push("const " + publicComponent + " = require('./" + dirname + "')");
|
|
154
|
+
plugins.push(publicComponent + ".install && app.use(" + publicComponent + ")");
|
|
155
|
+
cssRequires.push("require('./" + dirname + "/style')");
|
|
156
|
+
lessRequires.push("require('./" + dirname + "/style/less')");
|
|
157
|
+
});
|
|
158
|
+
install = "\nfunction install(app) {\n " + plugins.join('\n ') + "\n}\n";
|
|
159
|
+
indexTemplate = requires.join('\n') + "\n\n" + install + "\n\nmodule.exports = {\n install,\n " + publicComponents.join(',\n ') + "\n}\n";
|
|
160
|
+
styleTemplate = cssRequires.join('\n') + "\n";
|
|
161
|
+
lessTemplate = lessRequires.join('\n') + "\n";
|
|
162
|
+
return [4 /*yield*/, Promise.all([
|
|
163
|
+
(0, fs_extra_1.writeFile)((0, path_1.resolve)(dir, 'index.js'), indexTemplate, 'utf-8'),
|
|
164
|
+
(0, fs_extra_1.writeFile)((0, path_1.resolve)(dir, 'style.js'), styleTemplate, 'utf-8'),
|
|
165
|
+
(0, fs_extra_1.writeFile)((0, path_1.resolve)(dir, 'less.js'), lessTemplate, 'utf-8'),
|
|
166
|
+
])];
|
|
167
|
+
case 1:
|
|
168
|
+
_a.sent();
|
|
169
|
+
return [2 /*return*/];
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
exports.compileCommonJSEntry = compileCommonJSEntry;
|
|
@@ -2,6 +2,8 @@ export declare const EMPTY_SPACE_RE: RegExp;
|
|
|
2
2
|
export declare const EMPTY_LINE_RE: RegExp;
|
|
3
3
|
export declare const IMPORT_CSS_RE: RegExp;
|
|
4
4
|
export declare const IMPORT_LESS_RE: RegExp;
|
|
5
|
+
export declare const REQUIRE_CSS_RE: RegExp;
|
|
6
|
+
export declare const REQUIRE_LESS_RE: RegExp;
|
|
5
7
|
export declare const STYLE_IMPORT_RE: RegExp;
|
|
6
8
|
export declare const clearEmptyLine: (s: string) => string;
|
|
7
9
|
export declare function normalizeStyleDependency(styleImport: string, reg: RegExp): string;
|
|
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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;
|
|
39
|
+
exports.compileLess = exports.extractStyleDependencies = exports.normalizeStyleDependency = exports.clearEmptyLine = exports.STYLE_IMPORT_RE = exports.REQUIRE_LESS_RE = exports.REQUIRE_CSS_RE = exports.IMPORT_LESS_RE = exports.IMPORT_CSS_RE = exports.EMPTY_LINE_RE = exports.EMPTY_SPACE_RE = void 0;
|
|
40
40
|
var fs_extra_1 = require("fs-extra");
|
|
41
41
|
var less_1 = require("less");
|
|
42
42
|
var fsUtils_1 = require("../shared/fsUtils");
|
|
@@ -45,6 +45,8 @@ exports.EMPTY_SPACE_RE = /[\s]+/g;
|
|
|
45
45
|
exports.EMPTY_LINE_RE = /[\n\r]*/g;
|
|
46
46
|
exports.IMPORT_CSS_RE = /(?<!['"`])import\s+['"](\.{1,2}\/.+\.css)['"]\s*;?(?!\s*['"`])/g;
|
|
47
47
|
exports.IMPORT_LESS_RE = /(?<!['"`])import\s+['"](\.{1,2}\/.+\.less)['"]\s*;?(?!\s*['"`])/g;
|
|
48
|
+
exports.REQUIRE_CSS_RE = /(?<!['"`])require\(\s*['"](\.{1,2}\/.+\.css)['"]\s*\);?(?!\s*['"`])/g;
|
|
49
|
+
exports.REQUIRE_LESS_RE = /(?<!['"`])require\(\s*['"](\.{1,2}\/.+\.less)['"]\s*\);?(?!\s*['"`])/g;
|
|
48
50
|
exports.STYLE_IMPORT_RE = /@import\s+['"](.+)['"]\s*;/g;
|
|
49
51
|
var clearEmptyLine = function (s) { return s.replace(exports.EMPTY_LINE_RE, '').replace(exports.EMPTY_SPACE_RE, ' '); };
|
|
50
52
|
exports.clearEmptyLine = clearEmptyLine;
|
|
@@ -63,14 +65,19 @@ function extractStyleDependencies(file, code, reg, expect, self) {
|
|
|
63
65
|
var styleImports = (_a = code.match(reg)) !== null && _a !== void 0 ? _a : [];
|
|
64
66
|
var cssFile = (0, path_1.resolve)(dir, './style/index.js');
|
|
65
67
|
var lessFile = (0, path_1.resolve)(dir, './style/less.js');
|
|
68
|
+
var modules = process.env.BABEL_MODULE;
|
|
66
69
|
styleImports.forEach(function (styleImport) {
|
|
67
70
|
var normalizedPath = normalizeStyleDependency(styleImport, reg);
|
|
68
|
-
(0, fsUtils_1.smartAppendFileSync)(cssFile, "import '" + normalizedPath + ".css'\n");
|
|
69
|
-
(0, fsUtils_1.smartAppendFileSync)(lessFile, "import '" + normalizedPath + "." + expect + "'\n");
|
|
71
|
+
(0, fsUtils_1.smartAppendFileSync)(cssFile, modules === 'commonjs' ? "require('" + normalizedPath + ".css')\n" : "import '" + normalizedPath + ".css'\n");
|
|
72
|
+
(0, fsUtils_1.smartAppendFileSync)(lessFile, modules === 'commonjs' ? "require('" + normalizedPath + "." + expect + "')\n" : "import '" + normalizedPath + "." + expect + "'\n");
|
|
70
73
|
});
|
|
71
74
|
if (self) {
|
|
72
|
-
(0, fsUtils_1.smartAppendFileSync)(cssFile,
|
|
73
|
-
|
|
75
|
+
(0, fsUtils_1.smartAppendFileSync)(cssFile, modules === 'commonjs'
|
|
76
|
+
? "require('" + normalizeStyleDependency(base, reg) + ".css')\n"
|
|
77
|
+
: "import '" + normalizeStyleDependency(base, reg) + ".css'\n");
|
|
78
|
+
(0, fsUtils_1.smartAppendFileSync)(lessFile, modules === 'commonjs'
|
|
79
|
+
? "require('" + normalizeStyleDependency(base, reg) + "." + expect + "')\n"
|
|
80
|
+
: "import '" + normalizeStyleDependency(base, reg) + "." + expect + "'\n");
|
|
74
81
|
}
|
|
75
82
|
return code.replace(reg, '');
|
|
76
83
|
}
|
|
@@ -5,13 +5,13 @@ module.exports = function (api, options) {
|
|
|
5
5
|
if (api) {
|
|
6
6
|
api.cache.never();
|
|
7
7
|
}
|
|
8
|
-
var
|
|
8
|
+
var isCommonJS = process.env.NODE_ENV === 'test' || process.env.BABEL_MODULE === 'commonjs';
|
|
9
9
|
return {
|
|
10
10
|
presets: [
|
|
11
11
|
[
|
|
12
12
|
require.resolve('@babel/preset-env'),
|
|
13
13
|
{
|
|
14
|
-
modules:
|
|
14
|
+
modules: isCommonJS ? 'commonjs' : false,
|
|
15
15
|
loose: options.loose,
|
|
16
16
|
},
|
|
17
17
|
],
|
package/lib/shared/constant.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export declare const CWD: string;
|
|
|
2
2
|
export declare const VARLET_CONFIG: string;
|
|
3
3
|
export declare const SRC_DIR: string;
|
|
4
4
|
export declare const ES_DIR: string;
|
|
5
|
+
export declare const LIB_DIR: string;
|
|
5
6
|
export declare const UMD_DIR: string;
|
|
6
7
|
export declare const TYPES_DIR: string;
|
|
7
8
|
export declare const ROOT_DOCS_DIR: string;
|
package/lib/shared/constant.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
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_CONFIG = exports.SITE_MOBILE_ROUTES = exports.SITE_PC_ROUTES = exports.SITE_DIR = exports.SITE_PUBLIC_PATH = exports.SITE_OUTPUT_PATH = exports.SITE = exports.CLI_PACKAGE_JSON = exports.UI_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.ESLINT_EXTENSIONS = exports.ROOT_DOCS_DIR = exports.TYPES_DIR = exports.UMD_DIR = exports.ES_DIR = exports.SRC_DIR = exports.VARLET_CONFIG = exports.CWD = void 0;
|
|
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_CONFIG = exports.SITE_MOBILE_ROUTES = exports.SITE_PC_ROUTES = exports.SITE_DIR = exports.SITE_PUBLIC_PATH = exports.SITE_OUTPUT_PATH = exports.SITE = exports.CLI_PACKAGE_JSON = exports.UI_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.ESLINT_EXTENSIONS = exports.ROOT_DOCS_DIR = exports.TYPES_DIR = exports.UMD_DIR = exports.LIB_DIR = exports.ES_DIR = exports.SRC_DIR = exports.VARLET_CONFIG = exports.CWD = void 0;
|
|
4
4
|
var path_1 = require("path");
|
|
5
5
|
exports.CWD = process.cwd();
|
|
6
6
|
exports.VARLET_CONFIG = (0, path_1.resolve)(exports.CWD, 'varlet.config.js');
|
|
7
7
|
exports.SRC_DIR = (0, path_1.resolve)(exports.CWD, 'src');
|
|
8
8
|
exports.ES_DIR = (0, path_1.resolve)(exports.CWD, 'es');
|
|
9
|
+
exports.LIB_DIR = (0, path_1.resolve)(exports.CWD, 'lib');
|
|
9
10
|
exports.UMD_DIR = (0, path_1.resolve)(exports.CWD, 'umd');
|
|
10
11
|
exports.TYPES_DIR = (0, path_1.resolve)(exports.CWD, 'types');
|
|
11
12
|
exports.ROOT_DOCS_DIR = (0, path_1.resolve)(exports.CWD, 'docs');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varlet/cli",
|
|
3
|
-
"version": "1.23.
|
|
3
|
+
"version": "1.23.4-alpha.2+9c3ad084",
|
|
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": "9c3ad08410009e50b288f033b8fdbe10a8c01160",
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@babel/core": "^7.14.8",
|
|
37
37
|
"@babel/preset-env": "^7.14.8",
|