mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-05-29 01:39:15 +08:00
chore(@vant/cli): remove TildeResolver
This commit is contained in:
parent
032737ba06
commit
5a395c27c1
@ -15,7 +15,7 @@
|
|||||||
"*.{vue,css,less}": "stylelint --fix"
|
"*.{vue,css,less}": "stylelint --fix"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vant/cli": "^4.0.0-beta.1",
|
"@vant/cli": "^4.0.0-beta.3",
|
||||||
"@vue/compiler-sfc": "3.2.8",
|
"@vue/compiler-sfc": "3.2.8",
|
||||||
"vue": "3.2.8"
|
"vue": "3.2.8"
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
## v4.0.0-beta.2
|
## v4.0.0-beta.3
|
||||||
|
|
||||||
### 不兼容更新
|
### 不兼容更新
|
||||||
|
|
||||||
@ -9,6 +9,7 @@
|
|||||||
- 不再支持 webpack.config.js 配置文件
|
- 不再支持 webpack.config.js 配置文件
|
||||||
- 不再支持 build 命令的 --watch 参数
|
- 不再支持 build 命令的 --watch 参数
|
||||||
- 不再内置 babel-plugin-import 插件
|
- 不再内置 babel-plugin-import 插件
|
||||||
|
- 不再支持 less import 语法中使用波浪号
|
||||||
- 不再内置 sass 依赖,如果使用 sass,需要手动安装:
|
- 不再内置 sass 依赖,如果使用 sass,需要手动安装:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vant/cli",
|
"name": "@vant/cli",
|
||||||
"version": "4.0.0-beta.3",
|
"version": "4.0.0-beta.4",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"typings": "lib/index.d.ts",
|
"typings": "lib/index.d.ts",
|
||||||
"bin": {
|
"bin": {
|
||||||
@ -33,6 +33,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/fs-extra": "^9.0.12",
|
"@types/fs-extra": "^9.0.12",
|
||||||
|
"@types/less": "^3.0.3",
|
||||||
"@types/lodash": "^4.14.172",
|
"@types/lodash": "^4.14.172",
|
||||||
"@types/postcss-load-config": "^3.0.1"
|
"@types/postcss-load-config": "^3.0.1"
|
||||||
},
|
},
|
||||||
|
@ -1,25 +1,13 @@
|
|||||||
import { render, FileManager } from 'less';
|
import { join } from 'path';
|
||||||
|
import { render } from 'less';
|
||||||
import { readFileSync } from 'fs-extra';
|
import { readFileSync } from 'fs-extra';
|
||||||
|
import { CWD } from '../common/constant';
|
||||||
// less plugin to resolve tilde
|
|
||||||
class TildeResolver extends FileManager {
|
|
||||||
loadFile(filename: string, ...args: any[]) {
|
|
||||||
filename = filename.replace('~', '');
|
|
||||||
return FileManager.prototype.loadFile.apply(this, [filename, ...args]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const TildeResolverPlugin = {
|
|
||||||
install(lessInstance: unknown, pluginManager: any) {
|
|
||||||
pluginManager.addFileManager(new TildeResolver());
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export async function compileLess(filePath: string) {
|
export async function compileLess(filePath: string) {
|
||||||
const source = readFileSync(filePath, 'utf-8');
|
const source = readFileSync(filePath, 'utf-8');
|
||||||
const { css } = await render(source, {
|
const { css } = await render(source, {
|
||||||
filename: filePath,
|
filename: filePath,
|
||||||
plugins: [TildeResolverPlugin],
|
paths: [join(CWD, 'node_modules')],
|
||||||
});
|
});
|
||||||
|
|
||||||
return css;
|
return css;
|
||||||
|
1
packages/vant-cli/src/module.d.ts
vendored
1
packages/vant-cli/src/module.d.ts
vendored
@ -1,5 +1,4 @@
|
|||||||
// some modules with missing type definitions
|
// some modules with missing type definitions
|
||||||
declare module 'less';
|
|
||||||
declare module 'execa';
|
declare module 'execa';
|
||||||
declare module 'hash-sum';
|
declare module 'hash-sum';
|
||||||
declare module 'clean-css';
|
declare module 'clean-css';
|
||||||
|
@ -1596,6 +1596,11 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@types/node" "*"
|
"@types/node" "*"
|
||||||
|
|
||||||
|
"@types/less@^3.0.3":
|
||||||
|
version "3.0.3"
|
||||||
|
resolved "https://registry.npmjs.org/@types/less/-/less-3.0.3.tgz#f9451dbb9548d25391107d65d6401a0cfb15db92"
|
||||||
|
integrity sha512-1YXyYH83h6We1djyoUEqTlVyQtCfJAFXELSKW2ZRtjHD4hQ82CC4lvrv5D0l0FLcKBaiPbXyi3MpMsI9ZRgKsw==
|
||||||
|
|
||||||
"@types/lodash@^4.14.172":
|
"@types/lodash@^4.14.172":
|
||||||
version "4.14.172"
|
version "4.14.172"
|
||||||
resolved "https://registry.nlark.com/@types/lodash/download/@types/lodash-4.14.172.tgz?cache=0&sync_timestamp=1627979710007&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Flodash%2Fdownload%2F%40types%2Flodash-4.14.172.tgz#aad774c28e7bfd7a67de25408e03ee5a8c3d028a"
|
resolved "https://registry.nlark.com/@types/lodash/download/@types/lodash-4.14.172.tgz?cache=0&sync_timestamp=1627979710007&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40types%2Flodash%2Fdownload%2F%40types%2Flodash-4.14.172.tgz#aad774c28e7bfd7a67de25408e03ee5a8c3d028a"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user