@varlet/cli 2.0.6 → 2.1.0-alpha.1666877950844

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 (143) hide show
  1. package/README.en-US.md +2 -2
  2. package/README.md +2 -2
  3. package/cjs/babel.config.cjs +29 -0
  4. package/cjs/babel.sfc.transform.cjs +18 -0
  5. package/cjs/jest.config.cjs +33 -0
  6. package/cjs/jest.media.mock.cjs +1 -0
  7. package/cjs/jest.style.mock.cjs +1 -0
  8. package/client.d.ts +1 -0
  9. package/client.js +1 -0
  10. package/lib/client/appType.d.ts +4 -0
  11. package/lib/client/appType.js +7 -0
  12. package/lib/client/index.d.ts +17 -0
  13. package/lib/client/index.js +106 -0
  14. package/lib/{bin.d.ts → node/bin.d.ts} +2 -2
  15. package/lib/node/bin.js +122 -0
  16. package/lib/{commands → node/commands}/build.d.ts +1 -1
  17. package/lib/node/commands/build.js +15 -0
  18. package/lib/{commands → node/commands}/changelog.d.ts +6 -6
  19. package/lib/node/commands/changelog.js +20 -0
  20. package/lib/{commands → node/commands}/commitLint.d.ts +1 -1
  21. package/lib/node/commands/commitLint.js +45 -0
  22. package/lib/{commands → node/commands}/compile.d.ts +7 -7
  23. package/lib/node/commands/compile.js +35 -0
  24. package/lib/{commands → node/commands}/create.d.ts +8 -8
  25. package/lib/node/commands/create.js +91 -0
  26. package/lib/{commands → node/commands}/dev.d.ts +5 -5
  27. package/lib/node/commands/dev.js +38 -0
  28. package/lib/{commands → node/commands}/gen.d.ts +8 -8
  29. package/lib/node/commands/gen.js +75 -0
  30. package/lib/{commands → node/commands}/jest.d.ts +8 -8
  31. package/lib/node/commands/jest.js +27 -0
  32. package/lib/{commands → node/commands}/lint.d.ts +1 -1
  33. package/lib/node/commands/lint.js +41 -0
  34. package/lib/{commands → node/commands}/preview.d.ts +1 -1
  35. package/lib/node/commands/preview.js +18 -0
  36. package/lib/{commands → node/commands}/release.d.ts +5 -5
  37. package/lib/node/commands/release.js +146 -0
  38. package/lib/{commands → node/commands}/vite.d.ts +3 -3
  39. package/lib/node/commands/vite.js +13 -0
  40. package/lib/{compiler → node/compiler}/compileModule.d.ts +5 -5
  41. package/lib/node/compiler/compileModule.js +74 -0
  42. package/lib/{compiler → node/compiler}/compileSFC.d.ts +2 -2
  43. package/lib/node/compiler/compileSFC.js +79 -0
  44. package/lib/{compiler → node/compiler}/compileScript.d.ts +17 -17
  45. package/lib/node/compiler/compileScript.js +141 -0
  46. package/lib/{compiler → node/compiler}/compileSiteEntry.d.ts +13 -13
  47. package/lib/node/compiler/compileSiteEntry.js +128 -0
  48. package/lib/{compiler → node/compiler}/compileStyle.d.ts +11 -11
  49. package/lib/node/compiler/compileStyle.js +39 -0
  50. package/lib/{compiler → node/compiler}/compileTemplateHighlight.d.ts +10 -10
  51. package/lib/node/compiler/compileTemplateHighlight.js +133 -0
  52. package/lib/{compiler → node/compiler}/compileTypes.d.ts +2 -2
  53. package/lib/node/compiler/compileTypes.js +45 -0
  54. package/lib/{config → node/config}/varlet.config.d.ts +45 -44
  55. package/lib/node/config/varlet.config.js +27 -0
  56. package/lib/node/config/varlet.default.config.d.ts +2 -0
  57. package/lib/node/config/varlet.default.config.js +264 -0
  58. package/lib/node/config/vite.config.d.ts +6 -0
  59. package/lib/node/config/vite.config.js +144 -0
  60. package/lib/node/index.d.ts +1 -0
  61. package/lib/node/index.js +1 -0
  62. package/lib/{shared → node/shared}/constant.d.ts +42 -43
  63. package/lib/node/shared/constant.js +47 -0
  64. package/lib/{shared → node/shared}/fsUtils.d.ts +13 -12
  65. package/lib/node/shared/fsUtils.js +48 -0
  66. package/lib/{shared → node/shared}/logger.d.ts +8 -8
  67. package/lib/node/shared/logger.js +18 -0
  68. package/package.json +22 -19
  69. package/{preset.js → preset.cjs} +1 -1
  70. package/site/components/button/index.ts +10 -10
  71. package/site/components/cell/index.ts +10 -10
  72. package/site/components/code-example/CodeExample.vue +2 -1
  73. package/site/components/code-example/codeExample.less +41 -41
  74. package/site/components/code-example/index.ts +10 -10
  75. package/site/components/context/zIndex.ts +20 -20
  76. package/site/components/icon/icon.less +26 -26
  77. package/site/components/icon/index.ts +10 -10
  78. package/site/components/icon/props.ts +24 -24
  79. package/site/components/loading/index.ts +10 -10
  80. package/site/components/progress/index.ts +10 -10
  81. package/site/components/snackbar/snackbar.less +135 -135
  82. package/site/components/styles/common.less +64 -64
  83. package/site/components/styles/elevation.less +126 -126
  84. package/site/components/styles/var.less +27 -27
  85. package/site/components/utils/components.ts +1 -4
  86. package/site/components/utils/elements.ts +1 -1
  87. package/site/index.html +49 -49
  88. package/site/mobile/App.vue +27 -26
  89. package/site/mobile/components/AppHome.vue +2 -1
  90. package/site/mobile/components/app-bar/index.ts +10 -10
  91. package/site/mobile/components/app-bar/props.ts +25 -25
  92. package/site/mobile.html +41 -41
  93. package/site/module.d.ts +5 -5
  94. package/site/pc/App.vue +2 -1
  95. package/site/pc/Layout.vue +2 -1
  96. package/site/pc/components/AppHeader.vue +4 -2
  97. package/site/pc/pages/index/index.vue +8 -4
  98. package/site/tsconfig.json +11 -11
  99. package/site/useProgress.ts +2 -1
  100. package/site/utils.ts +6 -137
  101. package/template/generators/config/default/base/{varlet.config.js → varlet.config.mjs} +2 -2
  102. package/template/generators/config/i18n/base/{varlet.config.js → varlet.config.mjs} +2 -2
  103. package/tsconfig.json +2 -9
  104. package/lib/bin.js +0 -102
  105. package/lib/commands/build.js +0 -67
  106. package/lib/commands/changelog.js +0 -27
  107. package/lib/commands/commitLint.js +0 -21
  108. package/lib/commands/compile.js +0 -119
  109. package/lib/commands/create.js +0 -166
  110. package/lib/commands/dev.js +0 -123
  111. package/lib/commands/gen.js +0 -138
  112. package/lib/commands/jest.js +0 -85
  113. package/lib/commands/lint.js +0 -123
  114. package/lib/commands/preview.js +0 -74
  115. package/lib/commands/release.js +0 -305
  116. package/lib/commands/vite.js +0 -69
  117. package/lib/compiler/compileModule.js +0 -190
  118. package/lib/compiler/compileSFC.js +0 -135
  119. package/lib/compiler/compileScript.js +0 -194
  120. package/lib/compiler/compileSiteEntry.js +0 -237
  121. package/lib/compiler/compileStyle.js +0 -91
  122. package/lib/compiler/compileTemplateHighlight.js +0 -193
  123. package/lib/compiler/compileTypes.js +0 -85
  124. package/lib/config/babel.config.d.ts +0 -2
  125. package/lib/config/babel.config.js +0 -31
  126. package/lib/config/babel.sfc.transform.d.ts +0 -1
  127. package/lib/config/babel.sfc.transform.js +0 -18
  128. package/lib/config/jest.config.d.ts +0 -1
  129. package/lib/config/jest.config.js +0 -37
  130. package/lib/config/jest.media.mock.d.ts +0 -0
  131. package/lib/config/jest.media.mock.js +0 -2
  132. package/lib/config/jest.style.mock.d.ts +0 -0
  133. package/lib/config/jest.style.mock.js +0 -2
  134. package/lib/config/varlet.config.js +0 -35
  135. package/lib/config/vite.config.d.ts +0 -5
  136. package/lib/config/vite.config.js +0 -162
  137. package/lib/index.d.ts +0 -1
  138. package/lib/index.js +0 -5
  139. package/lib/shared/constant.js +0 -50
  140. package/lib/shared/fsUtils.js +0 -108
  141. package/lib/shared/logger.js +0 -23
  142. package/site/mobile/components/AppType.vue +0 -22
  143. package/varlet.default.config.js +0 -267
@@ -1,8 +1,8 @@
1
- declare const _default: {
2
- info(text: string): void;
3
- success(text: string): void;
4
- warning(text: string): void;
5
- error(text: string): void;
6
- title(text: string): void;
7
- };
8
- export default _default;
1
+ declare const _default: {
2
+ info(text: string): void;
3
+ success(text: string): void;
4
+ warning(text: string): void;
5
+ error(text: string): void;
6
+ title(text: string): void;
7
+ };
8
+ export default _default;
@@ -0,0 +1,18 @@
1
+ import chalk from 'chalk';
2
+ export default {
3
+ info(text) {
4
+ console.log(text);
5
+ },
6
+ success(text) {
7
+ console.log(chalk.hex('#00c48f')(text));
8
+ },
9
+ warning(text) {
10
+ console.log(chalk.hex('#ff9800')(text));
11
+ },
12
+ error(text) {
13
+ console.log(chalk.hex('#f44336')(text));
14
+ },
15
+ title(text) {
16
+ console.log(chalk.cyan(text));
17
+ },
18
+ };
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@varlet/cli",
3
- "version": "2.0.6",
3
+ "version": "2.1.0-alpha.1666877950844",
4
+ "type": "module",
4
5
  "description": "cli of varlet",
5
6
  "bin": {
6
- "varlet-cli": "./lib/bin.js"
7
+ "varlet-cli": "./lib/node/bin.js"
7
8
  },
8
- "main": "./lib/index.js",
9
- "module": "./lib/index.js",
9
+ "main": "./lib/node/index.js",
10
+ "module": "./lib/node/index.js",
10
11
  "keywords": [
11
12
  "cli",
12
13
  "varlet"
@@ -15,13 +16,18 @@
15
16
  "license": "MIT",
16
17
  "files": [
17
18
  "lib",
19
+ "cjs",
20
+ "client.js",
21
+ "client.d.ts",
18
22
  "template",
19
23
  "site",
20
24
  "tsconfig.json",
21
- "varlet.default.config.js",
22
- "preset.js",
25
+ "preset.cjs",
23
26
  "CHANGELOG.md"
24
27
  ],
28
+ "engines": {
29
+ "node": "^14.18.0 || >=16.0.0"
30
+ },
25
31
  "repository": {
26
32
  "type": "git",
27
33
  "url": "https://github.com/varletjs/varlet.git"
@@ -34,8 +40,9 @@
34
40
  "@babel/helper-plugin-utils": "^7.14.5",
35
41
  "@babel/preset-env": "^7.14.8",
36
42
  "@babel/preset-typescript": "^7.14.5",
37
- "@varlet/markdown-vite-plugin": "2.0.6",
38
- "@varlet/shared": "2.0.6",
43
+ "@types/inquirer": "^9.0.2",
44
+ "@varlet/markdown-vite-plugin": "2.1.0-alpha.1666877950844",
45
+ "@varlet/shared": "2.1.0-alpha.1666877950844",
39
46
  "@vitejs/plugin-vue": "3.0.1",
40
47
  "@vitejs/plugin-vue-jsx": "2.0.0",
41
48
  "@vue/babel-plugin-jsx": "1.1.1",
@@ -51,10 +58,9 @@
51
58
  "fs-extra": "^9.0.1",
52
59
  "glob": "^7.2.0",
53
60
  "hash-sum": "^2.0.0",
54
- "inquirer": "^8.1.2",
61
+ "inquirer": "^9.1.4",
55
62
  "jest": "^26.6.3",
56
63
  "less": "^3.12.2",
57
- "lodash": "^4.17.21",
58
64
  "lodash-es": "^4.17.21",
59
65
  "ora": "^5.4.0",
60
66
  "semver": "^7.3.5",
@@ -67,23 +73,20 @@
67
73
  "vue-jest": "^5.0.0-alpha.8"
68
74
  },
69
75
  "devDependencies": {
70
- "@varlet/icons": "2.0.6",
71
- "@varlet/touch-emulator": "2.0.6",
72
- "@types/node": "^18.7.20",
73
76
  "@types/babel__core": "^7.1.12",
74
77
  "@types/ejs": "^3.1.1",
75
78
  "@types/fs-extra": "^9.0.2",
76
79
  "@types/glob": "^7.1.3",
77
80
  "@types/hash-sum": "^1.0.0",
78
- "@types/inquirer": "8.1.2",
79
- "@types/jest": "^26.0.15",
80
- "@types/lodash": "^4.14.174",
81
81
  "@types/lodash-es": "^4.17.5",
82
- "@types/semver": "^7.3.9"
82
+ "@types/node": "^18.7.20",
83
+ "@types/semver": "^7.3.9",
84
+ "@varlet/icons": "2.1.0-alpha.1666877950844",
85
+ "@varlet/touch-emulator": "2.1.0-alpha.1666877950844"
83
86
  },
84
87
  "peerDependencies": {
85
- "@varlet/icons": "2.0.6",
86
- "@varlet/touch-emulator": "2.0.6",
88
+ "@varlet/icons": "2.1.0-alpha.1666877950844",
89
+ "@varlet/touch-emulator": "2.1.0-alpha.1666877950844",
87
90
  "@vue/runtime-core": "3.2.16",
88
91
  "@vue/test-utils": "^2.0.2",
89
92
  "clipboard": "^2.0.6",
@@ -1,3 +1,3 @@
1
- const babelConfig = require('./lib/config/babel.config')
1
+ const babelConfig = require('./cjs/babel.config.cjs')
2
2
 
3
3
  module.exports = (api, options) => babelConfig(api, options)
@@ -1,10 +1,10 @@
1
- import type { App } from 'vue'
2
- import Button from './Button.vue'
3
-
4
- Button.install = function (app: App) {
5
- app.component(Button.name, Button)
6
- }
7
-
8
- export const _ButtonComponent = Button
9
-
10
- export default Button
1
+ import type { App } from 'vue'
2
+ import Button from './Button.vue'
3
+
4
+ Button.install = function (app: App) {
5
+ app.component(Button.name, Button)
6
+ }
7
+
8
+ export const _ButtonComponent = Button
9
+
10
+ export default Button
@@ -1,10 +1,10 @@
1
- import type { App } from 'vue'
2
- import Cell from './Cell.vue'
3
-
4
- Cell.install = function (app: App) {
5
- app.component(Cell.name, Cell)
6
- }
7
-
8
- export const _CellComponent = Cell
9
-
10
- export default Cell
1
+ import type { App } from 'vue'
2
+ import Cell from './Cell.vue'
3
+
4
+ Cell.install = function (app: App) {
5
+ app.component(Cell.name, Cell)
6
+ }
7
+
8
+ export const _CellComponent = Cell
9
+
10
+ export default Cell
@@ -43,7 +43,8 @@ import config from '@config'
43
43
  import { defineComponent, nextTick, ref, onMounted } from 'vue'
44
44
  import { doubleRaf } from '../utils/elements'
45
45
  import { get } from 'lodash-es'
46
- import { getBrowserTheme, getPCLocationInfo, utoa } from '../../utils'
46
+ import { getBrowserTheme, getPCLocationInfo } from '@varlet/cli/client'
47
+ import { utoa } from '../../utils'
47
48
  import type { Ref } from 'vue'
48
49
 
49
50
  let clipId = 0
@@ -1,41 +1,41 @@
1
- .var-site-code-example {
2
- margin-top: 16px;
3
- margin-bottom: 4px;
4
- position: relative;
5
- border: thin solid var(--site-config-color-hl-border);
6
- border-radius: 4px;
7
- transition: border .25s;
8
-
9
- &:hover {
10
- .var-site-code-example__toolbar {
11
- opacity: 1;
12
- }
13
- }
14
-
15
- &__toolbar {
16
- display: flex;
17
- align-items: center;
18
- position: absolute;
19
- z-index: 1;
20
- right: 10px;
21
- top: 10px;
22
- opacity: 0;
23
- transition: .25s all;
24
-
25
- button {
26
- color: var(--site-config-color-hl-code) !important;
27
- }
28
- }
29
-
30
- &__code {
31
- transition: all .25s;
32
- overflow: hidden;
33
- border-radius: 4px;
34
- }
35
-
36
- &--scroller {
37
- code {
38
- white-space: nowrap;
39
- }
40
- }
41
- }
1
+ .var-site-code-example {
2
+ margin-top: 16px;
3
+ margin-bottom: 4px;
4
+ position: relative;
5
+ border: thin solid var(--site-config-color-hl-border);
6
+ border-radius: 4px;
7
+ transition: border .25s;
8
+
9
+ &:hover {
10
+ .var-site-code-example__toolbar {
11
+ opacity: 1;
12
+ }
13
+ }
14
+
15
+ &__toolbar {
16
+ display: flex;
17
+ align-items: center;
18
+ position: absolute;
19
+ z-index: 1;
20
+ right: 10px;
21
+ top: 10px;
22
+ opacity: 0;
23
+ transition: .25s all;
24
+
25
+ button {
26
+ color: var(--site-config-color-hl-code) !important;
27
+ }
28
+ }
29
+
30
+ &__code {
31
+ transition: all .25s;
32
+ overflow: hidden;
33
+ border-radius: 4px;
34
+ }
35
+
36
+ &--scroller {
37
+ code {
38
+ white-space: nowrap;
39
+ }
40
+ }
41
+ }
@@ -1,10 +1,10 @@
1
- import type { App } from 'vue'
2
- import CodeExample from './CodeExample.vue'
3
-
4
- CodeExample.install = function (app: App) {
5
- app.component(CodeExample.name, CodeExample)
6
- }
7
-
8
- export const _CodeExampleComponent = CodeExample
9
-
10
- export default CodeExample
1
+ import type { App } from 'vue'
2
+ import CodeExample from './CodeExample.vue'
3
+
4
+ CodeExample.install = function (app: App) {
5
+ app.component(CodeExample.name, CodeExample)
6
+ }
7
+
8
+ export const _CodeExampleComponent = CodeExample
9
+
10
+ export default CodeExample
@@ -1,20 +1,20 @@
1
- import context from './index'
2
- import { watch, ref } from 'vue'
3
- import type { Ref } from 'vue'
4
-
5
- export function useZIndex(source: any, count: number) {
6
- const zIndex: Ref<number> = ref(context.zIndex)
7
-
8
- watch(
9
- source,
10
- (newValue) => {
11
- if (newValue) {
12
- context.zIndex += count
13
- zIndex.value = context.zIndex
14
- }
15
- },
16
- { immediate: true }
17
- )
18
-
19
- return { zIndex }
20
- }
1
+ import context from './index'
2
+ import { watch, ref } from 'vue'
3
+ import type { Ref } from 'vue'
4
+
5
+ export function useZIndex(source: any, count: number) {
6
+ const zIndex: Ref<number> = ref(context.zIndex)
7
+
8
+ watch(
9
+ source,
10
+ (newValue) => {
11
+ if (newValue) {
12
+ context.zIndex += count
13
+ zIndex.value = context.zIndex
14
+ }
15
+ },
16
+ { immediate: true }
17
+ )
18
+
19
+ return { zIndex }
20
+ }
@@ -1,26 +1,26 @@
1
- @import '@varlet/icons/dist/css/varlet-icons.less';
2
-
3
- @site-icon-size: 20px;
4
-
5
- :root {
6
- --site-icon-size: @site-icon-size;
7
- }
8
-
9
- .var-site-icon {
10
- display: inline-flex;
11
- justify-content: center;
12
- align-items: center;
13
- font-size: var(--site-icon-size);
14
- color: inherit;
15
- vertical-align: bottom;
16
-
17
- &--shrinking {
18
- transform: scale(0);
19
- }
20
-
21
- &__image {
22
- width: var(--site-icon-size);
23
- height: var(--site-icon-size);
24
- object-fit: cover;
25
- }
26
- }
1
+ @import '@varlet/icons/dist/css/varlet-icons.less';
2
+
3
+ @site-icon-size: 20px;
4
+
5
+ :root {
6
+ --site-icon-size: @site-icon-size;
7
+ }
8
+
9
+ .var-site-icon {
10
+ display: inline-flex;
11
+ justify-content: center;
12
+ align-items: center;
13
+ font-size: var(--site-icon-size);
14
+ color: inherit;
15
+ vertical-align: bottom;
16
+
17
+ &--shrinking {
18
+ transform: scale(0);
19
+ }
20
+
21
+ &__image {
22
+ width: var(--site-icon-size);
23
+ height: var(--site-icon-size);
24
+ object-fit: cover;
25
+ }
26
+ }
@@ -1,10 +1,10 @@
1
- import type { App } from 'vue'
2
- import Icon from './Icon.vue'
3
-
4
- Icon.install = function (app: App) {
5
- app.component(Icon.name, Icon)
6
- }
7
-
8
- export const _IconComponent = Icon
9
-
10
- export default Icon
1
+ import type { App } from 'vue'
2
+ import Icon from './Icon.vue'
3
+
4
+ Icon.install = function (app: App) {
5
+ app.component(Icon.name, Icon)
6
+ }
7
+
8
+ export const _IconComponent = Icon
9
+
10
+ export default Icon
@@ -1,24 +1,24 @@
1
- import type { PropType } from 'vue'
2
-
3
- export const props = {
4
- name: {
5
- type: String,
6
- },
7
- size: {
8
- type: [Number, String],
9
- },
10
- color: {
11
- type: String,
12
- },
13
- namespace: {
14
- type: String,
15
- default: 'var-icon',
16
- },
17
- transition: {
18
- type: [Number, String],
19
- default: 0,
20
- },
21
- onClick: {
22
- type: Function as PropType<(event: Event) => void>,
23
- },
24
- }
1
+ import type { PropType } from 'vue'
2
+
3
+ export const props = {
4
+ name: {
5
+ type: String,
6
+ },
7
+ size: {
8
+ type: [Number, String],
9
+ },
10
+ color: {
11
+ type: String,
12
+ },
13
+ namespace: {
14
+ type: String,
15
+ default: 'var-icon',
16
+ },
17
+ transition: {
18
+ type: [Number, String],
19
+ default: 0,
20
+ },
21
+ onClick: {
22
+ type: Function as PropType<(event: Event) => void>,
23
+ },
24
+ }
@@ -1,10 +1,10 @@
1
- import type { App } from 'vue'
2
- import Loading from './Loading.vue'
3
-
4
- Loading.install = function (app: App) {
5
- app.component(Loading.name, Loading)
6
- }
7
-
8
- export const _LoadingComponent = Loading
9
-
10
- export default Loading
1
+ import type { App } from 'vue'
2
+ import Loading from './Loading.vue'
3
+
4
+ Loading.install = function (app: App) {
5
+ app.component(Loading.name, Loading)
6
+ }
7
+
8
+ export const _LoadingComponent = Loading
9
+
10
+ export default Loading
@@ -1,10 +1,10 @@
1
- import type { App } from 'vue'
2
- import Progress from './Progress.vue'
3
-
4
- Progress.install = function (app: App) {
5
- app.component(Progress.name, Progress)
6
- }
7
-
8
- export const _ProgressComponent = Progress
9
-
10
- export default Progress
1
+ import type { App } from 'vue'
2
+ import Progress from './Progress.vue'
3
+
4
+ Progress.install = function (app: App) {
5
+ app.component(Progress.name, Progress)
6
+ }
7
+
8
+ export const _ProgressComponent = Progress
9
+
10
+ export default Progress