@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.
Files changed (79) hide show
  1. package/README.md +0 -7
  2. package/README.zh-CN.md +0 -7
  3. package/lib/client/index.d.ts +1 -1
  4. package/lib/client/index.js +3 -3
  5. package/lib/node/bin.js +0 -7
  6. package/lib/node/commands/build.js +3 -3
  7. package/lib/node/commands/checklist.d.ts +1 -1
  8. package/lib/node/commands/checklist.js +3 -3
  9. package/lib/node/commands/compile.js +2 -2
  10. package/lib/node/commands/create.js +6 -6
  11. package/lib/node/commands/dev.js +6 -6
  12. package/lib/node/commands/gen.js +3 -3
  13. package/lib/node/commands/icons.js +5 -5
  14. package/lib/node/commands/preview.js +1 -1
  15. package/lib/node/compiler/compileModule.js +6 -6
  16. package/lib/node/compiler/compileSFC.js +5 -5
  17. package/lib/node/compiler/compileScript.js +6 -7
  18. package/lib/node/compiler/compileSiteEntry.js +7 -5
  19. package/lib/node/compiler/compileStyle.js +3 -3
  20. package/lib/node/compiler/compileStyleVars.js +2 -2
  21. package/lib/node/compiler/compileTemplateHighlight.js +3 -3
  22. package/lib/node/compiler/compileTypes.js +3 -3
  23. package/lib/node/config/varlet.config.js +3 -3
  24. package/lib/node/config/vite.config.js +4 -4
  25. package/lib/node/config/vitest.config.js +1 -1
  26. package/lib/node/index.d.ts +0 -1
  27. package/lib/node/index.js +0 -1
  28. package/lib/node/shared/constant.d.ts +0 -1
  29. package/lib/node/shared/constant.js +0 -1
  30. package/lib/node/shared/fsUtils.js +3 -3
  31. package/package.json +9 -9
  32. package/site/index.html +3 -2
  33. package/site/mobile/App.vue +8 -6
  34. package/site/mobile/AppHome.vue +2 -2
  35. package/site/mobile/main.ts +3 -4
  36. package/site/mobile.html +3 -2
  37. package/site/pc/App.vue +8 -4
  38. package/site/pc/Layout.vue +16 -10
  39. package/site/pc/components/AppAd.vue +1 -1
  40. package/site/pc/components/AppHeader.vue +5 -5
  41. package/site/pc/components/AppSidebar.vue +1 -1
  42. package/site/pc/components/code-example/CodeExample.vue +6 -6
  43. package/site/pc/main.ts +4 -5
  44. package/site/pc/pages/index/index.vue +13 -7
  45. package/template/create/example/locale/_index.ts +1 -1
  46. package/template/create/example/locale/index.ts +3 -3
  47. package/template/generators/base/{.eslintrc → eslint.config.js} +6 -7
  48. package/template/generators/base/package.json +5 -3
  49. package/template/generators/base/prettier.config.js +3 -0
  50. package/template/generators/config/default/sfc/src/button/__tests__/index.spec.js +1 -1
  51. package/template/generators/config/default/sfc/src/button/example/index.vue +1 -1
  52. package/template/generators/config/default/sfc/src/button/index.ts +1 -1
  53. package/template/generators/config/default/sfc/src/utils/components.ts +1 -1
  54. package/template/generators/config/default/tsx/src/button/Button.tsx +0 -1
  55. package/template/generators/config/default/tsx/src/button/__tests__/index.spec.js +1 -1
  56. package/template/generators/config/default/tsx/src/button/example/index.vue +1 -1
  57. package/template/generators/config/default/tsx/src/button/index.ts +1 -1
  58. package/template/generators/config/default/tsx/src/utils/components.ts +1 -1
  59. package/template/generators/config/i18n/sfc/src/button/Button.vue +1 -2
  60. package/template/generators/config/i18n/sfc/src/button/__tests__/index.spec.js +1 -1
  61. package/template/generators/config/i18n/sfc/src/button/example/BasicUse.vue +1 -1
  62. package/template/generators/config/i18n/sfc/src/button/example/ModifyColor.vue +1 -1
  63. package/template/generators/config/i18n/sfc/src/button/example/index.vue +1 -1
  64. package/template/generators/config/i18n/sfc/src/button/example/locale/index.ts +3 -3
  65. package/template/generators/config/i18n/sfc/src/button/index.ts +1 -1
  66. package/template/generators/config/i18n/sfc/src/locale/__tests__/index.spec.js +1 -1
  67. package/template/generators/config/i18n/sfc/src/utils/components.ts +1 -1
  68. package/template/generators/config/i18n/tsx/src/button/Button.tsx +0 -2
  69. package/template/generators/config/i18n/tsx/src/button/__tests__/index.spec.js +1 -1
  70. package/template/generators/config/i18n/tsx/src/button/example/BasicUse.vue +1 -1
  71. package/template/generators/config/i18n/tsx/src/button/example/ModifyColor.vue +1 -1
  72. package/template/generators/config/i18n/tsx/src/button/example/index.vue +1 -1
  73. package/template/generators/config/i18n/tsx/src/button/example/locale/index.ts +3 -3
  74. package/template/generators/config/i18n/tsx/src/button/index.ts +1 -1
  75. package/template/generators/config/i18n/tsx/src/locale/__tests__/index.spec.js +1 -1
  76. package/template/generators/config/i18n/tsx/src/utils/components.ts +1 -1
  77. package/lib/node/commands/lint.d.ts +0 -1
  78. package/lib/node/commands/lint.js +0 -42
  79. package/template/generators/base/.prettierrc +0 -5
package/README.md CHANGED
@@ -207,13 +207,6 @@ varlet-cli test -w
207
207
  varlet-cli test -cov
208
208
  ```
209
209
 
210
- #### Lint the code
211
-
212
- ```shell
213
- # playground-ignore
214
- varlet-cli lint
215
- ```
216
-
217
210
  #### Lint git commit message
218
211
 
219
212
  ```shell
package/README.zh-CN.md CHANGED
@@ -206,13 +206,6 @@ varlet-cli test -w
206
206
  varlet-cli test -cov
207
207
  ```
208
208
 
209
- #### 检查代码
210
-
211
- ```shell
212
- # playground-ignore
213
- varlet-cli lint
214
- ```
215
-
216
209
  #### 校验提交信息
217
210
 
218
211
  ```shell
@@ -1,5 +1,5 @@
1
- import AppType from './appType';
2
1
  import { StyleProvider } from '@varlet/ui';
2
+ import AppType from './appType';
3
3
  interface PCLocationInfo {
4
4
  language: string;
5
5
  menuName: string;
@@ -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';
@@ -3,4 +3,4 @@ export interface CheckBlock {
3
3
  list: string[];
4
4
  }
5
5
  export declare function getCheckBlocks(html: string): CheckBlock[];
6
- export declare function checklist(gitParams: string): Promise<void>;
6
+ export declare function checklist(gitParams: string): void;
@@ -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 { COMMIT_MESSAGE_RE, isVersionCommitMessage, getCommitMessage } from '@varlet/release';
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 async function checklist(gitParams) {
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 { SRC_DIR, dirname } from '../shared/constant.js';
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`);
@@ -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 { ES_DIR, SRC, SRC_DIR, VARLET_CONFIG } from '../shared/constant.js';
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 { resolve } from 'path';
10
- import { generateEsEntryTemplate, getScriptExtname } from '../compiler/compileScript.js';
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 { kebabCase } from '@varlet/shared';
12
+ import logger from '../shared/logger.js';
13
13
  const { ensureDirSync, pathExistsSync, readFileSync, outputFileSync, removeSync } = fse;
14
14
  let server;
15
15
  let watcher;
@@ -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
- async function clearPngOutputs(pngDir) {
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 { resolve } from 'path';
4
- import { EXAMPLE_DIR_NAME, TESTS_DIR_NAME, DOCS_DIR_NAME, SRC_DIR, ES_DIR, STYLE_DIR_NAME, LIB_DIR, UMD_DIR, } from '../shared/constant.js';
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 { parse, resolve } from 'path';
4
- import { parse as parseSFC, compileTemplate, compileStyle, compileScript as compileScriptSFC, registerTS, } from '@vue/compiler-sfc';
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 ts from 'typescript';
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 { ES_DIR } from '../shared/constant.js';
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]; // eslint-disable-line
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 async function buildSiteSource() {
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 glob from 'glob';
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 { getCliVersion, isDir, isMD } from '../shared/fsUtils.js';
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 fse from 'fs-extra';
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 { resolve, relative } from 'path';
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 { VARLET_CONFIG, SITE_CONFIG } from '../shared/constant.js';
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: {
@@ -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.8.2",
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.8.2",
65
- "@varlet/vite-plugins": "3.8.2"
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/icons": "3.8.2",
78
- "@varlet/ui": "3.8.2",
79
- "@varlet/touch-emulator": "3.8.2"
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/icons": "3.8.2",
91
- "@varlet/touch-emulator": "3.8.2",
92
- "@varlet/ui": "3.8.2"
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",