@varlet/cli 3.8.2 → 3.9.0-alpha.1736270797421
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.md +0 -7
- package/README.zh-CN.md +0 -7
- package/lib/client/index.d.ts +1 -1
- package/lib/client/index.js +3 -3
- package/lib/node/bin.js +0 -7
- package/lib/node/commands/build.js +3 -3
- package/lib/node/commands/checklist.d.ts +1 -1
- package/lib/node/commands/checklist.js +3 -3
- package/lib/node/commands/compile.js +2 -2
- package/lib/node/commands/create.js +6 -6
- package/lib/node/commands/dev.js +6 -6
- package/lib/node/commands/gen.js +3 -3
- package/lib/node/commands/icons.js +5 -5
- package/lib/node/commands/preview.js +1 -1
- package/lib/node/compiler/compileModule.js +6 -6
- package/lib/node/compiler/compileSFC.js +5 -5
- package/lib/node/compiler/compileScript.js +6 -7
- package/lib/node/compiler/compileSiteEntry.js +7 -5
- package/lib/node/compiler/compileStyle.js +3 -3
- package/lib/node/compiler/compileStyleVars.js +2 -2
- package/lib/node/compiler/compileTemplateHighlight.js +3 -3
- package/lib/node/compiler/compileTypes.js +3 -3
- package/lib/node/config/varlet.config.js +3 -3
- package/lib/node/config/vite.config.js +4 -4
- package/lib/node/config/vitest.config.js +1 -1
- package/lib/node/index.d.ts +0 -1
- package/lib/node/index.js +0 -1
- package/lib/node/shared/constant.d.ts +0 -1
- package/lib/node/shared/constant.js +0 -1
- package/lib/node/shared/fsUtils.js +3 -3
- package/package.json +9 -9
- package/site/index.html +3 -2
- package/site/mobile/App.vue +8 -6
- package/site/mobile/AppHome.vue +2 -2
- package/site/mobile/main.ts +3 -4
- package/site/mobile.html +3 -2
- package/site/pc/App.vue +8 -4
- package/site/pc/Layout.vue +16 -10
- package/site/pc/components/AppAd.vue +1 -1
- package/site/pc/components/AppHeader.vue +5 -5
- package/site/pc/components/AppSidebar.vue +1 -1
- package/site/pc/components/code-example/CodeExample.vue +6 -6
- package/site/pc/main.ts +4 -5
- package/site/pc/pages/index/index.vue +13 -7
- package/template/create/example/locale/_index.ts +1 -1
- package/template/create/example/locale/index.ts +3 -3
- package/template/generators/base/{.eslintrc → eslint.config.js} +6 -7
- package/template/generators/base/package.json +5 -3
- package/template/generators/base/prettier.config.js +3 -0
- package/template/generators/config/default/sfc/src/button/__tests__/index.spec.js +1 -1
- package/template/generators/config/default/sfc/src/button/example/index.vue +1 -1
- package/template/generators/config/default/sfc/src/button/index.ts +1 -1
- package/template/generators/config/default/sfc/src/utils/components.ts +1 -1
- package/template/generators/config/default/tsx/src/button/Button.tsx +0 -1
- package/template/generators/config/default/tsx/src/button/__tests__/index.spec.js +1 -1
- package/template/generators/config/default/tsx/src/button/example/index.vue +1 -1
- package/template/generators/config/default/tsx/src/button/index.ts +1 -1
- package/template/generators/config/default/tsx/src/utils/components.ts +1 -1
- package/template/generators/config/i18n/sfc/src/button/Button.vue +1 -2
- package/template/generators/config/i18n/sfc/src/button/__tests__/index.spec.js +1 -1
- package/template/generators/config/i18n/sfc/src/button/example/BasicUse.vue +1 -1
- package/template/generators/config/i18n/sfc/src/button/example/ModifyColor.vue +1 -1
- package/template/generators/config/i18n/sfc/src/button/example/index.vue +1 -1
- package/template/generators/config/i18n/sfc/src/button/example/locale/index.ts +3 -3
- package/template/generators/config/i18n/sfc/src/button/index.ts +1 -1
- package/template/generators/config/i18n/sfc/src/locale/__tests__/index.spec.js +1 -1
- package/template/generators/config/i18n/sfc/src/utils/components.ts +1 -1
- package/template/generators/config/i18n/tsx/src/button/Button.tsx +0 -2
- package/template/generators/config/i18n/tsx/src/button/__tests__/index.spec.js +1 -1
- package/template/generators/config/i18n/tsx/src/button/example/BasicUse.vue +1 -1
- package/template/generators/config/i18n/tsx/src/button/example/ModifyColor.vue +1 -1
- package/template/generators/config/i18n/tsx/src/button/example/index.vue +1 -1
- package/template/generators/config/i18n/tsx/src/button/example/locale/index.ts +3 -3
- package/template/generators/config/i18n/tsx/src/button/index.ts +1 -1
- package/template/generators/config/i18n/tsx/src/locale/__tests__/index.spec.js +1 -1
- package/template/generators/config/i18n/tsx/src/utils/components.ts +1 -1
- package/lib/node/commands/lint.d.ts +0 -1
- package/lib/node/commands/lint.js +0 -42
- package/template/generators/base/.prettierrc +0 -5
package/README.md
CHANGED
package/README.zh-CN.md
CHANGED
package/lib/client/index.d.ts
CHANGED
package/lib/client/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { onMounted, onUnmounted } from 'vue';
|
|
1
2
|
import config from '@config';
|
|
3
|
+
import { StyleProvider, Themes } from '@varlet/ui';
|
|
2
4
|
import AppType from './appType';
|
|
3
|
-
import { Themes, StyleProvider } from '@varlet/ui';
|
|
4
|
-
import { onMounted, onUnmounted } from 'vue';
|
|
5
5
|
export function getPCLocationInfo() {
|
|
6
6
|
const [, language, path] = window.location.hash.split('/');
|
|
7
7
|
const [menuName, hash = ''] = path?.split('#') ?? [];
|
|
@@ -32,7 +32,7 @@ export function getBrowserTheme() {
|
|
|
32
32
|
}
|
|
33
33
|
export function watchLang(cb, platform = 'mobile') {
|
|
34
34
|
const handleHashchange = () => {
|
|
35
|
-
const language = platform === 'mobile' ? getHashSearch().get('language') ?? 'zh-CN' : getPCLocationInfo().language;
|
|
35
|
+
const language = platform === 'mobile' ? (getHashSearch().get('language') ?? 'zh-CN') : getPCLocationInfo().language;
|
|
36
36
|
cb(language);
|
|
37
37
|
};
|
|
38
38
|
useRouteListener(handleHashchange);
|
package/lib/node/bin.js
CHANGED
|
@@ -77,13 +77,6 @@ program
|
|
|
77
77
|
const { styleVars } = await import('./commands/styleVars.js');
|
|
78
78
|
return styleVars();
|
|
79
79
|
});
|
|
80
|
-
program
|
|
81
|
-
.command('lint')
|
|
82
|
-
.description('Lint code')
|
|
83
|
-
.action(async () => {
|
|
84
|
-
const { lint } = await import('./commands/lint.js');
|
|
85
|
-
return lint();
|
|
86
|
-
});
|
|
87
80
|
program
|
|
88
81
|
.command('create')
|
|
89
82
|
.description('Create a component directory')
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import fse from 'fs-extra';
|
|
2
|
-
import { SRC_DIR } from '../shared/constant.js';
|
|
3
2
|
import { build as buildVite } from 'vite';
|
|
4
|
-
import { getBuildConfig } from '../config/vite.config.js';
|
|
5
|
-
import { getVarletConfig } from '../config/varlet.config.js';
|
|
6
3
|
import { buildSiteEntry } from '../compiler/compileSiteEntry.js';
|
|
4
|
+
import { getVarletConfig } from '../config/varlet.config.js';
|
|
5
|
+
import { getBuildConfig } from '../config/vite.config.js';
|
|
6
|
+
import { SRC_DIR } from '../shared/constant.js';
|
|
7
7
|
const { ensureDirSync } = fse;
|
|
8
8
|
export async function build() {
|
|
9
9
|
process.env.NODE_ENV = 'production';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { COMMIT_MESSAGE_RE, getCommitMessage, isVersionCommitMessage } from '@varlet/release';
|
|
1
2
|
import fse from 'fs-extra';
|
|
2
3
|
import markdownIt from 'markdown-it';
|
|
3
|
-
import logger from '../shared/logger.js';
|
|
4
4
|
import { CHECKLIST_FILE } from '../shared/constant.js';
|
|
5
|
-
import
|
|
5
|
+
import logger from '../shared/logger.js';
|
|
6
6
|
const { readFileSync, existsSync } = fse;
|
|
7
7
|
const blockRE = /<h3>(.|\n|\r)+?<\/ul>/g;
|
|
8
8
|
const typeRE = /<h3>(.+)<\/h3>/;
|
|
@@ -34,7 +34,7 @@ export function getCheckBlocks(html) {
|
|
|
34
34
|
});
|
|
35
35
|
return checkBlocks;
|
|
36
36
|
}
|
|
37
|
-
export
|
|
37
|
+
export function checklist(gitParams) {
|
|
38
38
|
const commitMessage = getCommitMessage(gitParams);
|
|
39
39
|
if (isVersionCommitMessage(commitMessage) || !existsSync(CHECKLIST_FILE)) {
|
|
40
40
|
return;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import logger from '../shared/logger.js';
|
|
2
1
|
import fse from 'fs-extra';
|
|
3
2
|
import { createSpinner } from 'nanospinner';
|
|
4
|
-
import { ES_DIR, HL_DIR, LIB_DIR, UMD_DIR } from '../shared/constant.js';
|
|
5
3
|
import { compileBundle, compileModule } from '../compiler/compileModule.js';
|
|
6
4
|
import { compileTemplateHighlight } from '../compiler/compileTemplateHighlight.js';
|
|
7
5
|
import { compileTypes } from '../compiler/compileTypes.js';
|
|
6
|
+
import { ES_DIR, HL_DIR, LIB_DIR, UMD_DIR } from '../shared/constant.js';
|
|
7
|
+
import logger from '../shared/logger.js';
|
|
8
8
|
const { remove } = fse;
|
|
9
9
|
export function removeDir() {
|
|
10
10
|
return Promise.all([remove(ES_DIR), remove(LIB_DIR), remove(HL_DIR), remove(UMD_DIR)]);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { resolve } from 'path';
|
|
2
|
+
import { confirm, input, select } from '@inquirer/prompts';
|
|
3
|
+
import { camelize, kebabCase, pascalCase } from '@varlet/shared';
|
|
1
4
|
import ejs from 'ejs';
|
|
2
5
|
import fse from 'fs-extra';
|
|
3
|
-
import logger from '../shared/logger.js';
|
|
4
|
-
import { pascalCase, camelize, kebabCase } from '@varlet/shared';
|
|
5
|
-
import { input, confirm, select } from '@inquirer/prompts';
|
|
6
|
-
import { resolve } from 'path';
|
|
7
|
-
import { glob } from '../shared/fsUtils.js';
|
|
8
6
|
import { getVarletConfig } from '../config/varlet.config.js';
|
|
9
|
-
import {
|
|
7
|
+
import { dirname, SRC_DIR } from '../shared/constant.js';
|
|
8
|
+
import { glob } from '../shared/fsUtils.js';
|
|
9
|
+
import logger from '../shared/logger.js';
|
|
10
10
|
const { removeSync, readFileSync, copySync, pathExistsSync, writeFileSync, renameSync } = fse;
|
|
11
11
|
async function renderTemplates(componentFolder, componentFolderName, renderData) {
|
|
12
12
|
const templates = await glob(`${componentFolder}/**/*.ejs`);
|
package/lib/node/commands/dev.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { resolve } from 'path';
|
|
2
|
+
import { kebabCase } from '@varlet/shared';
|
|
1
3
|
import chokidar from 'chokidar';
|
|
2
4
|
import fse from 'fs-extra';
|
|
3
|
-
import logger from '../shared/logger.js';
|
|
4
5
|
import { createServer } from 'vite';
|
|
5
|
-
import {
|
|
6
|
+
import { generateEsEntryTemplate, getScriptExtname } from '../compiler/compileScript.js';
|
|
6
7
|
import { buildSiteEntry } from '../compiler/compileSiteEntry.js';
|
|
7
|
-
import { getDevConfig } from '../config/vite.config.js';
|
|
8
8
|
import { getVarletConfig } from '../config/varlet.config.js';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { getDevConfig } from '../config/vite.config.js';
|
|
10
|
+
import { ES_DIR, SRC, SRC_DIR, VARLET_CONFIG } from '../shared/constant.js';
|
|
11
11
|
import { getPublicDirs } from '../shared/fsUtils.js';
|
|
12
|
-
import
|
|
12
|
+
import logger from '../shared/logger.js';
|
|
13
13
|
const { ensureDirSync, pathExistsSync, readFileSync, outputFileSync, removeSync } = fse;
|
|
14
14
|
let server;
|
|
15
15
|
let watcher;
|
package/lib/node/commands/gen.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import logger from '../shared/logger.js';
|
|
2
|
-
import fse from 'fs-extra';
|
|
3
|
-
import { input, confirm, select } from '@inquirer/prompts';
|
|
4
1
|
import { resolve } from 'path';
|
|
2
|
+
import { confirm, input, select } from '@inquirer/prompts';
|
|
3
|
+
import fse from 'fs-extra';
|
|
5
4
|
import { CLI_PACKAGE_JSON, CWD, GENERATORS_DIR } from '../shared/constant.js';
|
|
5
|
+
import logger from '../shared/logger.js';
|
|
6
6
|
const { copy, pathExistsSync, readFileSync, writeFileSync, rename } = fse;
|
|
7
7
|
function syncVersion(name) {
|
|
8
8
|
const file = resolve(CWD, name, 'package.json');
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { parse, resolve } from 'path';
|
|
2
|
+
import { buildIcons, getIo } from '@varlet/icon-builder';
|
|
3
|
+
import chokidar from 'chokidar';
|
|
1
4
|
import fse from 'fs-extra';
|
|
2
5
|
import sharp from 'sharp';
|
|
3
|
-
import chokidar from 'chokidar';
|
|
4
|
-
import logger from '../shared/logger.js';
|
|
5
|
-
import { parse, resolve } from 'path';
|
|
6
6
|
import { getVarletConfig } from '../config/varlet.config.js';
|
|
7
|
-
import { buildIcons, getIo } from '@varlet/icon-builder';
|
|
8
7
|
import { ICONS_PNG_DIR_NAME } from '../shared/constant.js';
|
|
8
|
+
import logger from '../shared/logger.js';
|
|
9
9
|
const { removeSync, ensureDirSync, readdirSync } = fse;
|
|
10
|
-
|
|
10
|
+
function clearPngOutputs(pngDir) {
|
|
11
11
|
removeSync(pngDir);
|
|
12
12
|
ensureDirSync(pngDir);
|
|
13
13
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fse from 'fs-extra';
|
|
2
|
-
import logger from '../shared/logger.js';
|
|
3
2
|
import { x } from 'tinyexec';
|
|
4
3
|
import { SITE_OUTPUT_PATH } from '../shared/constant.js';
|
|
4
|
+
import logger from '../shared/logger.js';
|
|
5
5
|
const { pathExistsSync } = fse;
|
|
6
6
|
export async function preview(options) {
|
|
7
7
|
const { port = 5500 } = options;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { resolve } from 'path';
|
|
2
|
+
import { kebabCase } from '@varlet/shared';
|
|
1
3
|
import fse from 'fs-extra';
|
|
2
4
|
import { build } from 'vite';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
+
import { getVarletConfig } from '../config/varlet.config.js';
|
|
6
|
+
import { getBundleConfig } from '../config/vite.config.js';
|
|
7
|
+
import { DOCS_DIR_NAME, ES_DIR, EXAMPLE_DIR_NAME, LIB_DIR, SRC_DIR, STYLE_DIR_NAME, TESTS_DIR_NAME, UMD_DIR, } from '../shared/constant.js';
|
|
5
8
|
import { getPublicDirs, isDir, isDTS, isLess, isScript, isScss, isSFC } from '../shared/fsUtils.js';
|
|
6
|
-
import { compileSFC } from './compileSFC.js';
|
|
7
9
|
import { compileESEntry, compileScriptFile, getScriptExtname } from './compileScript.js';
|
|
10
|
+
import { compileSFC } from './compileSFC.js';
|
|
8
11
|
import { clearLessFiles, clearScssFiles, compileLess, compileScss } from './compileStyle.js';
|
|
9
|
-
import { getBundleConfig } from '../config/vite.config.js';
|
|
10
|
-
import { getVarletConfig } from '../config/varlet.config.js';
|
|
11
12
|
import { generateReference } from './compileTypes.js';
|
|
12
|
-
import { kebabCase } from '@varlet/shared';
|
|
13
13
|
const { copy, ensureFileSync, readdir, removeSync } = fse;
|
|
14
14
|
export async function compileBundle() {
|
|
15
15
|
const varletConfig = await getVarletConfig();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { parse, resolve } from 'path';
|
|
2
|
+
import { compileScript as compileScriptSFC, compileStyle, compileTemplate, parse as parseSFC, registerTS, } from '@vue/compiler-sfc';
|
|
1
3
|
import fse from 'fs-extra';
|
|
2
4
|
import hash from 'hash-sum';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
+
import ts from 'typescript';
|
|
6
|
+
import { ES_DIR, SRC_DIR } from '../shared/constant.js';
|
|
5
7
|
import { replaceExt, smartAppendFileSync } from '../shared/fsUtils.js';
|
|
6
|
-
import { SRC_DIR, ES_DIR } from '../shared/constant.js';
|
|
7
8
|
import { compileScript, getScriptExtname } from './compileScript.js';
|
|
8
|
-
import
|
|
9
|
-
import { compressCss, compileLess, compileScss, extractStyleDependencies, normalizeStyleDependency, STYLE_IMPORT_RE, } from './compileStyle.js';
|
|
9
|
+
import { compileLess, compileScss, compressCss, extractStyleDependencies, normalizeStyleDependency, STYLE_IMPORT_RE, } from './compileStyle.js';
|
|
10
10
|
const { readFile, existsSync, readFileSync, writeFileSync } = fse;
|
|
11
11
|
registerTS(() => ts);
|
|
12
12
|
const EXPORT = 'export default';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { dirname, extname, relative, resolve } from 'path';
|
|
2
2
|
import { transformAsync } from '@babel/core';
|
|
3
3
|
import { pascalCase } from '@varlet/shared';
|
|
4
|
-
import { getVersion, isDir, isJsx, isTsx, replaceExt } from '../shared/fsUtils.js';
|
|
5
|
-
import { extractStyleDependencies, IMPORT_CSS_RE, IMPORT_LESS_RE, IMPORT_SCSS_RE } from './compileStyle.js';
|
|
6
|
-
import { resolve, relative, extname, dirname } from 'path';
|
|
7
|
-
import { getVarletConfig } from '../config/varlet.config.js';
|
|
8
4
|
import jsx from '@vue/babel-plugin-jsx';
|
|
9
|
-
import fse from 'fs-extra';
|
|
10
5
|
import esbuild from 'esbuild';
|
|
6
|
+
import fse from 'fs-extra';
|
|
7
|
+
import { getVarletConfig } from '../config/varlet.config.js';
|
|
8
|
+
import { ES_DIR } from '../shared/constant.js';
|
|
9
|
+
import { getVersion, isDir, isJsx, isTsx, replaceExt } from '../shared/fsUtils.js';
|
|
10
|
+
import { extractStyleDependencies, IMPORT_CSS_RE, IMPORT_LESS_RE, IMPORT_SCSS_RE } from './compileStyle.js';
|
|
11
11
|
const { writeFileSync, readdirSync, readFileSync, removeSync, writeFile, pathExistsSync } = fse;
|
|
12
12
|
// https://regexr.com/765a4
|
|
13
13
|
export const IMPORT_FROM_DEPENDENCE_RE = /import\s+?[\w\s{},$*]+\s+from\s+?(".*?"|'.*?')/g;
|
|
@@ -20,7 +20,6 @@ export const styleExtNames = ['.less', '.scss', '.css'];
|
|
|
20
20
|
export const scriptIndexes = ['index.mjs', 'index.vue', 'index.ts', 'index.tsx', 'index.js', 'index.jsx'];
|
|
21
21
|
export const styleIndexes = ['index.less', 'index.scss', 'index.css'];
|
|
22
22
|
export const tryMatchExtname = (file, extname) => {
|
|
23
|
-
// eslint-disable-next-line no-restricted-syntax
|
|
24
23
|
for (const ext of extname) {
|
|
25
24
|
const matched = `${file}${ext}`;
|
|
26
25
|
if (pathExistsSync(matched)) {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import fse from 'fs-extra';
|
|
2
1
|
import { slash } from '@varlet/shared';
|
|
2
|
+
import fse from 'fs-extra';
|
|
3
|
+
import { getVarletConfig } from '../config/varlet.config.js';
|
|
3
4
|
import { DOCS_DIR_NAME, EXAMPLE_DIR_NAME, LOCALE_DIR_NAME, ROOT_DOCS_DIR, ROOT_PAGES_DIR, SITE, SITE_DIR, SITE_MOBILE_ROUTES, SITE_PC_DIR, SITE_PC_ROUTES, SRC_DIR, } from '../shared/constant.js';
|
|
4
5
|
import { glob, isDir, outputFileSyncOnChange } from '../shared/fsUtils.js';
|
|
5
|
-
import { getVarletConfig } from '../config/varlet.config.js';
|
|
6
6
|
const { copy } = fse;
|
|
7
7
|
const ROOT_DOCS_RE = /\/docs\/([-\w]+)\.([-\w]+)(?:.draft)?\.md/;
|
|
8
8
|
const PAGE_LOCALE_RE = /\/pages\/([-\w]+)\/locale\/([-\w]+)\.ts/;
|
|
9
9
|
const EXAMPLE_INDEX_RE = /\/([-\w]+)\/example\/index(?:.draft)?\.vue/;
|
|
10
10
|
const COMPONENT_DOCS_RE = /\/([-\w]+)\/docs\/([-\w]+)(?:.draft)?\.md/;
|
|
11
11
|
export function getExampleRoutePath(examplePath) {
|
|
12
|
-
return '/' + examplePath.match(EXAMPLE_INDEX_RE)?.[1];
|
|
12
|
+
return '/' + examplePath.match(EXAMPLE_INDEX_RE)?.[1];
|
|
13
13
|
}
|
|
14
14
|
export function getComponentDocRoutePath(componentDocsPath) {
|
|
15
15
|
const [, routePath, language] = componentDocsPath.match(COMPONENT_DOCS_RE) ?? [];
|
|
@@ -64,8 +64,10 @@ export async function findPageLocales() {
|
|
|
64
64
|
const userLocales = await userPages.reduce(async (userLocales, page) => {
|
|
65
65
|
if (isDir(page)) {
|
|
66
66
|
const locales = await glob(`${page}/${LOCALE_DIR_NAME}/*.ts`);
|
|
67
|
-
if (!locales.length)
|
|
67
|
+
if (!locales.length) {
|
|
68
68
|
locales.push(`${page}/${LOCALE_DIR_NAME}/${defaultLanguage}.ts`);
|
|
69
|
+
}
|
|
70
|
+
;
|
|
69
71
|
(await userLocales).push(...locales);
|
|
70
72
|
}
|
|
71
73
|
return userLocales;
|
|
@@ -134,7 +136,7 @@ export async function buildPcSiteRoutes(draftMode) {
|
|
|
134
136
|
]`;
|
|
135
137
|
outputFileSyncOnChange(SITE_PC_ROUTES, source);
|
|
136
138
|
}
|
|
137
|
-
export
|
|
139
|
+
export function buildSiteSource() {
|
|
138
140
|
return copy(SITE, SITE_DIR);
|
|
139
141
|
}
|
|
140
142
|
export async function buildSiteEntry(draftMode) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { parse, resolve } from 'path';
|
|
1
2
|
import fse from 'fs-extra';
|
|
3
|
+
import glob from 'glob';
|
|
2
4
|
import less from 'less';
|
|
3
5
|
import * as sass from 'sass';
|
|
4
|
-
import
|
|
6
|
+
import { CWD } from '../shared/constant.js';
|
|
5
7
|
import { replaceExt, smartAppendFileSync } from '../shared/fsUtils.js';
|
|
6
|
-
import { parse, resolve } from 'path';
|
|
7
8
|
import { getScriptExtname } from './compileScript.js';
|
|
8
|
-
import { CWD } from '../shared/constant.js';
|
|
9
9
|
const { render: renderLess } = less;
|
|
10
10
|
const { readFileSync, writeFileSync, unlinkSync } = fse;
|
|
11
11
|
export const EMPTY_SPACE_RE = /[\s]+/g;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { resolve } from 'path';
|
|
1
2
|
import fse from 'fs-extra';
|
|
3
|
+
import { getVarletConfig } from '../config/varlet.config.js';
|
|
2
4
|
import { SRC_DIR, TYPES_DIR } from '../shared/constant.js';
|
|
3
|
-
import { resolve } from 'path';
|
|
4
5
|
import { isDir, isMD } from '../shared/fsUtils.js';
|
|
5
|
-
import { getVarletConfig } from '../config/varlet.config.js';
|
|
6
6
|
const { ensureDirSync, readdirSync, readFileSync, writeFileSync } = fse;
|
|
7
7
|
export function compileMD(path, keys) {
|
|
8
8
|
const content = readFileSync(path, 'utf-8');
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import fse from 'fs-extra';
|
|
2
|
-
import { SRC_DIR, HL_DIR, HL_API_RE, HL_COMPONENT_NAME_RE, HL_EN_MD, HL_EN_TITLE_ATTRIBUTES_RE, HL_EN_TITLE_EVENTS_RE, HL_EN_TITLE_SLOTS_RE, HL_EN_WEB_TYPES_JSON, HL_ZH_MD, HL_ZH_TITLE_ATTRIBUTES_RE, HL_ZH_TITLE_EVENTS_RE, HL_ZH_TITLE_SLOTS_RE, HL_ZH_WEB_TYPES_JSON, } from '../shared/constant.js';
|
|
3
1
|
import { resolve } from 'path';
|
|
4
|
-
import
|
|
2
|
+
import fse from 'fs-extra';
|
|
5
3
|
import { getVarletConfig } from '../config/varlet.config.js';
|
|
4
|
+
import { HL_API_RE, HL_COMPONENT_NAME_RE, HL_DIR, HL_EN_MD, HL_EN_TITLE_ATTRIBUTES_RE, HL_EN_TITLE_EVENTS_RE, HL_EN_TITLE_SLOTS_RE, HL_EN_WEB_TYPES_JSON, HL_ZH_MD, HL_ZH_TITLE_ATTRIBUTES_RE, HL_ZH_TITLE_EVENTS_RE, HL_ZH_TITLE_SLOTS_RE, HL_ZH_WEB_TYPES_JSON, SRC_DIR, } from '../shared/constant.js';
|
|
5
|
+
import { getCliVersion, isDir, isMD } from '../shared/fsUtils.js';
|
|
6
6
|
const { ensureDir, readdirSync, readFileSync, writeFileSync } = fse;
|
|
7
7
|
const TABLE_HEAD_RE = /\s*\|.*\|\s*\n\s*\|.*-+\s*\|\s*\n+/;
|
|
8
8
|
const TABLE_FOOT_RE = /(\|\s*$)|(\|\s*\n(?!\s*\|))/;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { TYPES_DIR, UI_PACKAGE_JSON } from '../shared/constant.js';
|
|
1
|
+
import { relative, resolve } from 'path';
|
|
3
2
|
import { pascalCase } from '@varlet/shared';
|
|
4
|
-
import
|
|
3
|
+
import fse from 'fs-extra';
|
|
5
4
|
import { getVarletConfig } from '../config/varlet.config.js';
|
|
5
|
+
import { TYPES_DIR, UI_PACKAGE_JSON } from '../shared/constant.js';
|
|
6
6
|
import { compileStyleVars } from './compileStyleVars.js';
|
|
7
7
|
const { ensureDir, writeFileSync, readdir, writeFile, readJSONSync } = fse;
|
|
8
8
|
export function generateReference(moduleDir) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { pathToFileURL } from 'url';
|
|
2
|
+
import { isArray, mergeWith } from '@varlet/shared';
|
|
1
3
|
import fse from 'fs-extra';
|
|
2
|
-
import {
|
|
4
|
+
import { SITE_CONFIG, VARLET_CONFIG } from '../shared/constant.js';
|
|
3
5
|
import { outputFileSyncOnChange } from '../shared/fsUtils.js';
|
|
4
|
-
import { isArray, mergeWith } from '@varlet/shared';
|
|
5
|
-
import { pathToFileURL } from 'url';
|
|
6
6
|
const { pathExistsSync, statSync } = fse;
|
|
7
7
|
export function defineConfig(config) {
|
|
8
8
|
return config;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import vue from '@vitejs/plugin-vue';
|
|
2
|
-
import jsx from '@vitejs/plugin-vue-jsx';
|
|
3
|
-
import { SRC_DIR, ES_DIR, SITE_CONFIG, SITE_DIR, SITE_MOBILE_ROUTES, SITE_OUTPUT_PATH, SITE_PC_ROUTES, SITE_PUBLIC_PATH, VITE_RESOLVE_EXTENSIONS, EXTENSION_ENTRY, } from '../shared/constant.js';
|
|
4
|
-
import { markdown, html, inlineCss, copy } from '@varlet/vite-plugins';
|
|
5
1
|
import { resolve } from 'path';
|
|
6
2
|
import { isArray } from '@varlet/shared';
|
|
3
|
+
import { copy, html, inlineCss, markdown } from '@varlet/vite-plugins';
|
|
4
|
+
import vue from '@vitejs/plugin-vue';
|
|
5
|
+
import jsx from '@vitejs/plugin-vue-jsx';
|
|
6
|
+
import { ES_DIR, EXTENSION_ENTRY, SITE_CONFIG, SITE_DIR, SITE_MOBILE_ROUTES, SITE_OUTPUT_PATH, SITE_PC_ROUTES, SITE_PUBLIC_PATH, SRC_DIR, VITE_RESOLVE_EXTENSIONS, } from '../shared/constant.js';
|
|
7
7
|
export function getHtmlInject(inject) {
|
|
8
8
|
const getContent = (injectKey, position) => inject[injectKey]?.filter((point) => point.position === position).map((point) => point.content) ?? [];
|
|
9
9
|
return {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { cpus } from 'os';
|
|
1
2
|
import vue from '@vitejs/plugin-vue';
|
|
2
3
|
import jsx from '@vitejs/plugin-vue-jsx';
|
|
3
4
|
import { defineConfig } from 'vitest/config';
|
|
4
5
|
import { VITE_RESOLVE_EXTENSIONS } from '../shared/constant.js';
|
|
5
|
-
import { cpus } from 'os';
|
|
6
6
|
const cpuNum = Math.max(cpus().length - 1, 1);
|
|
7
7
|
export default defineConfig({
|
|
8
8
|
resolve: {
|
package/lib/node/index.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ export * from './commands/compile.js';
|
|
|
6
6
|
export * from './commands/gen.js';
|
|
7
7
|
export * from './commands/test.js';
|
|
8
8
|
export * from './commands/create.js';
|
|
9
|
-
export * from './commands/lint.js';
|
|
10
9
|
export * from './commands/preview.js';
|
|
11
10
|
export * from './commands/vite.js';
|
|
12
11
|
export * from './commands/extension.js';
|
package/lib/node/index.js
CHANGED
|
@@ -6,7 +6,6 @@ export * from './commands/compile.js';
|
|
|
6
6
|
export * from './commands/gen.js';
|
|
7
7
|
export * from './commands/test.js';
|
|
8
8
|
export * from './commands/create.js';
|
|
9
|
-
export * from './commands/lint.js';
|
|
10
9
|
export * from './commands/preview.js';
|
|
11
10
|
export * from './commands/vite.js';
|
|
12
11
|
export * from './commands/extension.js';
|
|
@@ -10,7 +10,6 @@ export declare const UMD_DIR: string;
|
|
|
10
10
|
export declare const TYPES_DIR: string;
|
|
11
11
|
export declare const ROOT_DOCS_DIR: string;
|
|
12
12
|
export declare const ROOT_PAGES_DIR: string;
|
|
13
|
-
export declare const ESLINT_EXTENSIONS: string[];
|
|
14
13
|
export declare const VITE_RESOLVE_EXTENSIONS: string[];
|
|
15
14
|
export declare const SCRIPTS_EXTENSIONS: string[];
|
|
16
15
|
export declare const PUBLIC_DIR_INDEXES: string[];
|
|
@@ -12,7 +12,6 @@ export const UMD_DIR = resolve(CWD, 'umd');
|
|
|
12
12
|
export const TYPES_DIR = resolve(CWD, 'types');
|
|
13
13
|
export const ROOT_DOCS_DIR = resolve(CWD, 'docs');
|
|
14
14
|
export const ROOT_PAGES_DIR = resolve(CWD, 'pages');
|
|
15
|
-
export const ESLINT_EXTENSIONS = ['.vue', '.tsx', '.ts', '.jsx', '.js', '.mjs', '.cjs'];
|
|
16
15
|
export const VITE_RESOLVE_EXTENSIONS = ['.vue', '.tsx', '.ts', '.jsx', '.js', '.mjs', '.cjs', '.less', '.scss', '.css'];
|
|
17
16
|
export const SCRIPTS_EXTENSIONS = ['.tsx', '.ts', '.jsx', '.js', '.mjs', '.cjs'];
|
|
18
17
|
export const PUBLIC_DIR_INDEXES = ['index.vue', 'index.tsx', 'index.ts', 'index.jsx', 'index.js'];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import globSync from 'glob';
|
|
2
|
-
import fse from 'fs-extra';
|
|
3
1
|
import { extname, resolve } from 'path';
|
|
4
|
-
import { CLI_PACKAGE_JSON, PUBLIC_DIR_INDEXES, SCRIPTS_EXTENSIONS, SRC_DIR, UI_PACKAGE_JSON } from './constant.js';
|
|
5
2
|
import { fileURLToPath } from 'url';
|
|
3
|
+
import fse from 'fs-extra';
|
|
4
|
+
import globSync from 'glob';
|
|
5
|
+
import { CLI_PACKAGE_JSON, PUBLIC_DIR_INDEXES, SCRIPTS_EXTENSIONS, SRC_DIR, UI_PACKAGE_JSON } from './constant.js';
|
|
6
6
|
const { appendFileSync, ensureFileSync, lstatSync, outputFileSync, pathExistsSync, readdir, readFileSync, readJSONSync, } = fse;
|
|
7
7
|
export async function getPublicDirs() {
|
|
8
8
|
const srcDir = await readdir(SRC_DIR);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varlet/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0-alpha.1736270797421",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "cli of varlet",
|
|
6
6
|
"bin": {
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"vite": "5.4.6",
|
|
62
62
|
"vitest": "2.1.1",
|
|
63
63
|
"vue": "3.4.21",
|
|
64
|
-
"@varlet/shared": "3.
|
|
65
|
-
"@varlet/vite-plugins": "3.
|
|
64
|
+
"@varlet/shared": "3.9.0-alpha.1736270797421",
|
|
65
|
+
"@varlet/vite-plugins": "3.9.0-alpha.1736270797421"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@types/babel__core": "^7.20.1",
|
|
@@ -74,9 +74,9 @@
|
|
|
74
74
|
"@types/node": "^18.7.20",
|
|
75
75
|
"@types/sharp": "0.31.1",
|
|
76
76
|
"rimraf": "^5.0.1",
|
|
77
|
-
"@varlet/
|
|
78
|
-
"@varlet/
|
|
79
|
-
"@varlet/
|
|
77
|
+
"@varlet/ui": "3.9.0-alpha.1736270797421",
|
|
78
|
+
"@varlet/touch-emulator": "3.9.0-alpha.1736270797421",
|
|
79
|
+
"@varlet/icons": "3.9.0-alpha.1736270797421"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
82
|
"@vitest/coverage-istanbul": "2.0.5",
|
|
@@ -87,9 +87,9 @@
|
|
|
87
87
|
"live-server": "^1.2.1",
|
|
88
88
|
"vue": "3.4.21",
|
|
89
89
|
"vue-router": "4.2.0",
|
|
90
|
-
"@varlet/
|
|
91
|
-
"@varlet/
|
|
92
|
-
"@varlet/
|
|
90
|
+
"@varlet/ui": "3.9.0-alpha.1736270797421",
|
|
91
|
+
"@varlet/icons": "3.9.0-alpha.1736270797421",
|
|
92
|
+
"@varlet/touch-emulator": "3.9.0-alpha.1736270797421"
|
|
93
93
|
},
|
|
94
94
|
"scripts": {
|
|
95
95
|
"dev": "tsc --watch",
|