@varlet/cli 2.1.0 → 2.2.0-alpha.1667668287880

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 (81) hide show
  1. package/README.en-US.md +7 -5
  2. package/README.md +7 -5
  3. package/lib/client/appType.d.ts +4 -4
  4. package/lib/client/appType.js +7 -7
  5. package/lib/client/index.d.ts +17 -17
  6. package/lib/client/index.js +106 -106
  7. package/lib/node/bin.d.ts +2 -2
  8. package/lib/node/bin.js +122 -122
  9. package/lib/node/commands/build.d.ts +1 -1
  10. package/lib/node/commands/build.js +15 -15
  11. package/lib/node/commands/changelog.d.ts +6 -6
  12. package/lib/node/commands/changelog.js +20 -20
  13. package/lib/node/commands/commitLint.d.ts +1 -1
  14. package/lib/node/commands/commitLint.js +16 -16
  15. package/lib/node/commands/compile.d.ts +7 -7
  16. package/lib/node/commands/compile.js +35 -35
  17. package/lib/node/commands/create.d.ts +8 -8
  18. package/lib/node/commands/create.js +91 -91
  19. package/lib/node/commands/dev.d.ts +5 -5
  20. package/lib/node/commands/dev.js +38 -38
  21. package/lib/node/commands/gen.d.ts +8 -8
  22. package/lib/node/commands/gen.js +68 -68
  23. package/lib/node/commands/jest.d.ts +8 -8
  24. package/lib/node/commands/jest.js +27 -27
  25. package/lib/node/commands/lint.d.ts +1 -1
  26. package/lib/node/commands/lint.js +42 -42
  27. package/lib/node/commands/preview.d.ts +1 -1
  28. package/lib/node/commands/preview.js +18 -18
  29. package/lib/node/commands/release.d.ts +5 -5
  30. package/lib/node/commands/release.js +146 -146
  31. package/lib/node/commands/vite.d.ts +3 -3
  32. package/lib/node/commands/vite.js +13 -13
  33. package/lib/node/compiler/compileModule.d.ts +5 -5
  34. package/lib/node/compiler/compileModule.js +74 -74
  35. package/lib/node/compiler/compileSFC.d.ts +2 -2
  36. package/lib/node/compiler/compileSFC.js +74 -74
  37. package/lib/node/compiler/compileScript.d.ts +17 -17
  38. package/lib/node/compiler/compileScript.js +95 -95
  39. package/lib/node/compiler/compileSiteEntry.d.ts +13 -13
  40. package/lib/node/compiler/compileSiteEntry.js +95 -95
  41. package/lib/node/compiler/compileStyle.d.ts +11 -11
  42. package/lib/node/compiler/compileStyle.js +39 -39
  43. package/lib/node/compiler/compileTemplateHighlight.d.ts +10 -10
  44. package/lib/node/compiler/compileTemplateHighlight.js +133 -133
  45. package/lib/node/compiler/compileTypes.d.ts +2 -2
  46. package/lib/node/compiler/compileTypes.js +30 -30
  47. package/lib/node/config/varlet.config.d.ts +45 -45
  48. package/lib/node/config/varlet.config.js +27 -27
  49. package/lib/node/config/varlet.default.config.d.ts +2 -2
  50. package/lib/node/config/varlet.default.config.js +264 -264
  51. package/lib/node/config/vite.config.d.ts +6 -6
  52. package/lib/node/config/vite.config.js +142 -142
  53. package/lib/node/index.d.ts +1 -1
  54. package/lib/node/index.js +1 -1
  55. package/lib/node/shared/constant.d.ts +42 -42
  56. package/lib/node/shared/constant.js +47 -47
  57. package/lib/node/shared/fsUtils.d.ts +13 -13
  58. package/lib/node/shared/fsUtils.js +48 -48
  59. package/lib/node/shared/logger.d.ts +8 -8
  60. package/lib/node/shared/logger.js +18 -18
  61. package/package.json +7 -7
  62. package/site/components/button/index.ts +10 -10
  63. package/site/components/cell/index.ts +10 -10
  64. package/site/components/code-example/codeExample.less +41 -41
  65. package/site/components/code-example/index.ts +10 -10
  66. package/site/components/context/zIndex.ts +20 -20
  67. package/site/components/icon/icon.less +26 -26
  68. package/site/components/icon/index.ts +10 -10
  69. package/site/components/icon/props.ts +24 -24
  70. package/site/components/loading/index.ts +10 -10
  71. package/site/components/progress/index.ts +10 -10
  72. package/site/components/snackbar/snackbar.less +135 -135
  73. package/site/components/styles/common.less +64 -64
  74. package/site/components/styles/elevation.less +126 -126
  75. package/site/components/styles/var.less +27 -27
  76. package/site/index.html +49 -49
  77. package/site/mobile/components/app-bar/index.ts +10 -10
  78. package/site/mobile/components/app-bar/props.ts +25 -25
  79. package/site/mobile.html +41 -41
  80. package/site/module.d.ts +5 -5
  81. package/site/tsconfig.json +11 -11
@@ -1,37 +1,37 @@
1
- import fse from 'fs-extra';
2
- import { TYPES_DIR, UI_PACKAGE_JSON } from '../shared/constant.js';
3
- import { bigCamelize } from '@varlet/shared';
4
- import { resolve, relative } from 'path';
5
- import { getVarletConfig } from '../config/varlet.config.js';
6
- import { get } from 'lodash-es';
7
- const { ensureDir, writeFileSync, readdir, writeFile, readJSONSync } = fse;
8
- export function generateReference(moduleDir) {
1
+ import fse from 'fs-extra';
2
+ import { TYPES_DIR, UI_PACKAGE_JSON } from '../shared/constant.js';
3
+ import { bigCamelize } from '@varlet/shared';
4
+ import { resolve, relative } from 'path';
5
+ import { getVarletConfig } from '../config/varlet.config.js';
6
+ import { get } from 'lodash-es';
7
+ const { ensureDir, writeFileSync, readdir, writeFile, readJSONSync } = fse;
8
+ export function generateReference(moduleDir) {
9
9
  writeFileSync(resolve(moduleDir, 'index.d.ts'), `\
10
10
  export * from '${relative(moduleDir, TYPES_DIR)}'
11
- `);
12
- }
13
- export async function compileTypes() {
14
- const varletConfig = await getVarletConfig();
15
- const namespace = get(varletConfig, 'namespace');
16
- const { name } = readJSONSync(UI_PACKAGE_JSON);
17
- await ensureDir(TYPES_DIR);
18
- const dir = await readdir(TYPES_DIR);
19
- const ignoreEntryDir = dir.filter((filename) => filename !== 'index.d.ts' && filename !== 'global.d.ts');
20
- const exports = [];
21
- const declares = [];
22
- ignoreEntryDir.forEach((filename) => {
23
- const componentName = filename.slice(0, filename.indexOf('.d.ts'));
24
- exports.push(`export * from './${componentName}'`);
25
- if (!componentName.startsWith(namespace)) {
26
- declares.push(`${bigCamelize(namespace)}${bigCamelize(componentName)}: typeof import('${name}')['_${bigCamelize(componentName)}Component']`);
27
- }
28
- });
11
+ `);
12
+ }
13
+ export async function compileTypes() {
14
+ const varletConfig = await getVarletConfig();
15
+ const namespace = get(varletConfig, 'namespace');
16
+ const { name } = readJSONSync(UI_PACKAGE_JSON);
17
+ await ensureDir(TYPES_DIR);
18
+ const dir = await readdir(TYPES_DIR);
19
+ const ignoreEntryDir = dir.filter((filename) => filename !== 'index.d.ts' && filename !== 'global.d.ts');
20
+ const exports = [];
21
+ const declares = [];
22
+ ignoreEntryDir.forEach((filename) => {
23
+ const componentName = filename.slice(0, filename.indexOf('.d.ts'));
24
+ exports.push(`export * from './${componentName}'`);
25
+ if (!componentName.startsWith(namespace)) {
26
+ declares.push(`${bigCamelize(namespace)}${bigCamelize(componentName)}: typeof import('${name}')['_${bigCamelize(componentName)}Component']`);
27
+ }
28
+ });
29
29
  const globalDeclares = `\
30
30
  declare module 'vue' {
31
31
  export interface GlobalComponents {
32
32
  ${declares.join('\n ')}
33
33
  }
34
- }`;
34
+ }`;
35
35
  const template = `\
36
36
  import type { App } from 'vue'
37
37
 
@@ -40,6 +40,6 @@ export const install: (app: App) => void
40
40
  ${exports.join('\n')}
41
41
 
42
42
  ${globalDeclares}
43
- `;
44
- await Promise.all([writeFile(resolve(TYPES_DIR, 'index.d.ts'), template)]);
45
- }
43
+ `;
44
+ await Promise.all([writeFile(resolve(TYPES_DIR, 'index.d.ts'), template)]);
45
+ }
@@ -1,45 +1,45 @@
1
- export interface VarletConfig {
2
- /**
3
- * @default `Varlet`
4
- * UI library name.
5
- */
6
- name?: string;
7
- /**
8
- * @default `var`
9
- * Component name prefix
10
- */
11
- namespace?: string;
12
- /**
13
- * @default `localhost`
14
- * Local dev server host
15
- */
16
- host?: string;
17
- /**
18
- * @default `8080`
19
- * Local dev server port
20
- */
21
- port?: number;
22
- title?: string;
23
- logo?: string;
24
- themeKey?: string;
25
- defaultLanguage?: 'zh-CN' | 'en-US';
26
- /**
27
- * @default `false`
28
- * Show mobile component on the right.
29
- */
30
- useMobile?: boolean;
31
- lightTheme?: Record<string, string>;
32
- darkTheme?: Record<string, string>;
33
- highlight?: {
34
- style: string;
35
- };
36
- analysis?: {
37
- baidu: string;
38
- };
39
- pc?: Record<string, any>;
40
- mobile?: Record<string, any>;
41
- moduleCompatible?: Record<string, string>;
42
- }
43
- export declare function defineConfig(config: VarletConfig): VarletConfig;
44
- export declare function mergeStrategy(value: any, srcValue: any, key: string): any[] | undefined;
45
- export declare function getVarletConfig(emit?: boolean): Promise<Required<VarletConfig>>;
1
+ export interface VarletConfig {
2
+ /**
3
+ * @default `Varlet`
4
+ * UI library name.
5
+ */
6
+ name?: string;
7
+ /**
8
+ * @default `var`
9
+ * Component name prefix
10
+ */
11
+ namespace?: string;
12
+ /**
13
+ * @default `localhost`
14
+ * Local dev server host
15
+ */
16
+ host?: string;
17
+ /**
18
+ * @default `8080`
19
+ * Local dev server port
20
+ */
21
+ port?: number;
22
+ title?: string;
23
+ logo?: string;
24
+ themeKey?: string;
25
+ defaultLanguage?: 'zh-CN' | 'en-US';
26
+ /**
27
+ * @default `false`
28
+ * Show mobile component on the right.
29
+ */
30
+ useMobile?: boolean;
31
+ lightTheme?: Record<string, string>;
32
+ darkTheme?: Record<string, string>;
33
+ highlight?: {
34
+ style: string;
35
+ };
36
+ analysis?: {
37
+ baidu: string;
38
+ };
39
+ pc?: Record<string, any>;
40
+ mobile?: Record<string, any>;
41
+ moduleCompatible?: Record<string, string>;
42
+ }
43
+ export declare function defineConfig(config: VarletConfig): VarletConfig;
44
+ export declare function mergeStrategy(value: any, srcValue: any, key: string): any[] | undefined;
45
+ export declare function getVarletConfig(emit?: boolean): Promise<Required<VarletConfig>>;
@@ -1,27 +1,27 @@
1
- import fse from 'fs-extra';
2
- import { mergeWith } from 'lodash-es';
3
- import { VARLET_CONFIG, SITE_CONFIG } from '../shared/constant.js';
4
- import { outputFileSyncOnChange } from '../shared/fsUtils.js';
5
- import { isArray } from '@varlet/shared';
6
- import { pathToFileURL } from 'url';
7
- const { pathExistsSync, statSync } = fse;
8
- export function defineConfig(config) {
9
- return config;
10
- }
11
- export function mergeStrategy(value, srcValue, key) {
12
- if (key === 'features' && isArray(srcValue)) {
13
- return srcValue;
14
- }
15
- }
16
- export async function getVarletConfig(emit = false) {
17
- const defaultConfig = (await import('./varlet.default.config.js')).default;
18
- const config = pathExistsSync(VARLET_CONFIG)
19
- ? (await import(`${pathToFileURL(VARLET_CONFIG).href}?_t=${statSync(VARLET_CONFIG).mtimeMs}`)).default
20
- : {};
21
- const mergedConfig = mergeWith(defaultConfig, config, mergeStrategy);
22
- if (emit) {
23
- const source = JSON.stringify(mergedConfig, null, 2);
24
- outputFileSyncOnChange(SITE_CONFIG, source);
25
- }
26
- return mergedConfig;
27
- }
1
+ import fse from 'fs-extra';
2
+ import { mergeWith } from 'lodash-es';
3
+ import { VARLET_CONFIG, SITE_CONFIG } from '../shared/constant.js';
4
+ import { outputFileSyncOnChange } from '../shared/fsUtils.js';
5
+ import { isArray } from '@varlet/shared';
6
+ import { pathToFileURL } from 'url';
7
+ const { pathExistsSync, statSync } = fse;
8
+ export function defineConfig(config) {
9
+ return config;
10
+ }
11
+ export function mergeStrategy(value, srcValue, key) {
12
+ if (key === 'features' && isArray(srcValue)) {
13
+ return srcValue;
14
+ }
15
+ }
16
+ export async function getVarletConfig(emit = false) {
17
+ const defaultConfig = (await import('./varlet.default.config.js')).default;
18
+ const config = pathExistsSync(VARLET_CONFIG)
19
+ ? (await import(`${pathToFileURL(VARLET_CONFIG).href}?_t=${statSync(VARLET_CONFIG).mtimeMs}`)).default
20
+ : {};
21
+ const mergedConfig = mergeWith(defaultConfig, config, mergeStrategy);
22
+ if (emit) {
23
+ const source = JSON.stringify(mergedConfig, null, 2);
24
+ outputFileSyncOnChange(SITE_CONFIG, source);
25
+ }
26
+ return mergedConfig;
27
+ }
@@ -1,2 +1,2 @@
1
- declare const _default: import("./varlet.config.js").VarletConfig;
2
- export default _default;
1
+ declare const _default: import("./varlet.config.js").VarletConfig;
2
+ export default _default;