@varlet/cli 1.27.14-alpha.1655710081377 → 1.27.16

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.
@@ -66,7 +66,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
66
66
  Object.defineProperty(exports, "__esModule", { value: true });
67
67
  exports.create = void 0;
68
68
  var logger_1 = __importDefault(require("../shared/logger"));
69
- var fsUtils_1 = require("../shared/fsUtils");
69
+ var shared_1 = require("@varlet/shared");
70
70
  var fs_extra_1 = require("fs-extra");
71
71
  var path_1 = require("path");
72
72
  var constant_1 = require("../shared/constant");
@@ -80,8 +80,8 @@ function create(name, cmd) {
80
80
  case 0:
81
81
  i18nFiles = [];
82
82
  namespace = (0, lodash_1.get)((0, varlet_config_1.getVarletConfig)(), 'namespace');
83
- bigCamelizeName = (0, fsUtils_1.bigCamelize)(name);
84
- vueTemplate = "<template>\n <div class=\"".concat(namespace, "-").concat(name, "\"></div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\n\nexport default defineComponent({\n name: '").concat((0, fsUtils_1.bigCamelize)(namespace)).concat(bigCamelizeName, "'\n})\n</script>\n\n<style lang=\"less\">\n.").concat(namespace, "-").concat(name, " {\n display: flex;\n}\n</style>\n");
83
+ bigCamelizeName = (0, shared_1.bigCamelize)(name);
84
+ vueTemplate = "<template>\n <div class=\"".concat(namespace, "-").concat(name, "\"></div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\n\nexport default defineComponent({\n name: '").concat((0, shared_1.bigCamelize)(namespace)).concat(bigCamelizeName, "'\n})\n</script>\n\n<style lang=\"less\">\n.").concat(namespace, "-").concat(name, " {\n display: flex;\n}\n</style>\n");
85
85
  indexTemplate = "import ".concat(bigCamelizeName, " from './").concat(bigCamelizeName, ".vue'\nimport type { App } from 'vue'\n\n").concat(bigCamelizeName, ".install = function(app: App) {\n app.component(").concat(bigCamelizeName, ".name, ").concat(bigCamelizeName, ")\n}\n\nexport const _").concat(bigCamelizeName, "Component = ").concat(bigCamelizeName, "\n\nexport default ").concat(bigCamelizeName, "\n");
86
86
  testsTemplate = "import ".concat(bigCamelizeName, " from '..'\nimport { createApp } from 'vue'\nimport { mount } from '@vue/test-utils'\n\ntest('test ").concat(name, " use', () => {\n const app = createApp({}).use(").concat(bigCamelizeName, ")\n expect(app.component(").concat(bigCamelizeName, ".name)).toBeTruthy()\n})\n");
87
87
  exampleTemplate = "<script setup>\nimport ".concat(bigCamelizeName, " from '..'\nimport AppType from '@varlet/cli/site/mobile/components/AppType'\n</script>\n\n<template>\n <app-type></app-type>\n <").concat(namespace, "-").concat(name, "/>\n</template>\n");
@@ -38,6 +38,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.compileCommonJSEntry = exports.compileESEntry = exports.compileScriptFile = exports.compileScript = exports.moduleCompatible = exports.replaceTSXExt = exports.replaceJSXExt = exports.replaceTSExt = exports.replaceVueExt = exports.REQUIRE_TSX_PATH_RE = exports.REQUIRE_JSX_PATH_RE = exports.REQUIRE_TS_PATH_RE = exports.REQUIRE_VUE_PATH_RE = exports.IMPORT_TSX_PATH_RE = exports.IMPORT_JSX_PATH_RE = exports.IMPORT_TS_PATH_RE = exports.IMPORT_VUE_PATH_RE = void 0;
40
40
  var core_1 = require("@babel/core");
41
+ var shared_1 = require("@varlet/shared");
41
42
  var fsUtils_1 = require("../shared/fsUtils");
42
43
  var fs_extra_1 = require("fs-extra");
43
44
  var compileStyle_1 = require("./compileStyle");
@@ -136,7 +137,7 @@ function compileESEntry(dir, publicDirs) {
136
137
  lessImports = [];
137
138
  publicComponents = [];
138
139
  publicDirs.forEach(function (dirname) {
139
- var publicComponent = (0, fsUtils_1.bigCamelize)(dirname);
140
+ var publicComponent = (0, shared_1.bigCamelize)(dirname);
140
141
  publicComponents.push(publicComponent);
141
142
  imports.push("import ".concat(publicComponent, ", * as ").concat(publicComponent, "Module from './").concat(dirname, "'"));
142
143
  constInternalComponents.push("export const _".concat(publicComponent, "Component = ").concat(publicComponent, "Module._").concat(publicComponent, "Component || {}"));
@@ -175,7 +176,7 @@ function compileCommonJSEntry(dir, publicDirs) {
175
176
  lessRequires = [];
176
177
  publicComponents = [];
177
178
  publicDirs.forEach(function (dirname) {
178
- var publicComponent = (0, fsUtils_1.bigCamelize)(dirname);
179
+ var publicComponent = (0, shared_1.bigCamelize)(dirname);
179
180
  publicComponents.push(publicComponent);
180
181
  requires.push("var ".concat(publicComponent, " = require('./").concat(dirname, "')['default']"));
181
182
  plugins.push("".concat(publicComponent, ".install && app.use(").concat(publicComponent, ")"));
@@ -39,7 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.compileTypes = exports.generateReference = void 0;
40
40
  var fs_extra_1 = require("fs-extra");
41
41
  var constant_1 = require("../shared/constant");
42
- var fsUtils_1 = require("../shared/fsUtils");
42
+ var shared_1 = require("@varlet/shared");
43
43
  var path_1 = require("path");
44
44
  var varlet_config_1 = require("../config/varlet.config");
45
45
  var lodash_1 = require("lodash");
@@ -69,7 +69,7 @@ function compileTypes() {
69
69
  var componentName = filename.slice(0, filename.indexOf('.d.ts'));
70
70
  exports.push("export * from './".concat(componentName, "'"));
71
71
  if (!componentName.startsWith(namespace)) {
72
- declares.push("".concat((0, fsUtils_1.bigCamelize)(namespace)).concat((0, fsUtils_1.bigCamelize)(componentName), ": typeof import('").concat(name, "')['_").concat((0, fsUtils_1.bigCamelize)(componentName), "Component']"));
72
+ declares.push("".concat((0, shared_1.bigCamelize)(namespace)).concat((0, shared_1.bigCamelize)(componentName), ": typeof import('").concat(name, "')['_").concat((0, shared_1.bigCamelize)(componentName), "Component']"));
73
73
  }
74
74
  });
75
75
  template = "import type { App } from 'vue'\n\nexport const install: (app: App) => void\n\n".concat(exports.join('\n'), "\n");
@@ -2,15 +2,11 @@ export declare function getPublicDirs(): Promise<string[]>;
2
2
  export declare const isMD: (file: string) => boolean;
3
3
  export declare const isDir: (file: string) => boolean;
4
4
  export declare const isSFC: (file: string) => boolean;
5
- export declare const isJSX: (file: string) => boolean;
6
- export declare const isTSX: (file: string) => boolean;
7
5
  export declare const isDTS: (file: string) => boolean;
8
6
  export declare const isScript: (file: string) => boolean;
9
7
  export declare const isLess: (file: string) => boolean;
10
8
  export declare const isPublicDir: (dir: string) => boolean;
11
9
  export declare const replaceExt: (file: string, ext: string) => string;
12
- export declare const bigCamelize: (s: string) => string;
13
- export declare const camelize: (s: string) => string;
14
10
  export declare function smartAppendFileSync(file: string, code: string): void;
15
11
  export declare function outputFileSyncOnChange(path: string, code: string): void;
16
12
  export declare function glob(pattern: string): Promise<string[]>;
@@ -39,7 +39,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
39
39
  return (mod && mod.__esModule) ? mod : { "default": mod };
40
40
  };
41
41
  Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.glob = exports.outputFileSyncOnChange = exports.smartAppendFileSync = exports.camelize = exports.bigCamelize = exports.replaceExt = exports.isPublicDir = exports.isLess = exports.isScript = exports.isDTS = exports.isTSX = exports.isJSX = exports.isSFC = exports.isDir = exports.isMD = exports.getPublicDirs = void 0;
42
+ exports.glob = exports.outputFileSyncOnChange = exports.smartAppendFileSync = exports.replaceExt = exports.isPublicDir = exports.isLess = exports.isScript = exports.isDTS = exports.isSFC = exports.isDir = exports.isMD = exports.getPublicDirs = void 0;
43
43
  var path_1 = require("path");
44
44
  var fs_extra_1 = require("fs-extra");
45
45
  var constant_1 = require("./constant");
@@ -64,10 +64,6 @@ var isDir = function (file) { return (0, fs_extra_1.pathExistsSync)(file) && (0,
64
64
  exports.isDir = isDir;
65
65
  var isSFC = function (file) { return (0, fs_extra_1.pathExistsSync)(file) && (0, path_1.extname)(file) === '.vue'; };
66
66
  exports.isSFC = isSFC;
67
- var isJSX = function (file) { return (0, fs_extra_1.pathExistsSync)(file) && (0, path_1.extname)(file) === '.jsx'; };
68
- exports.isJSX = isJSX;
69
- var isTSX = function (file) { return (0, fs_extra_1.pathExistsSync)(file) && (0, path_1.extname)(file) === '.tsx'; };
70
- exports.isTSX = isTSX;
71
67
  var isDTS = function (file) { return (0, fs_extra_1.pathExistsSync)(file) && file.endsWith('.d.ts'); };
72
68
  exports.isDTS = isDTS;
73
69
  var isScript = function (file) { return (0, fs_extra_1.pathExistsSync)(file) && constant_1.SCRIPTS_EXTENSIONS.includes((0, path_1.extname)(file)); };
@@ -80,10 +76,6 @@ var isPublicDir = function (dir) {
80
76
  exports.isPublicDir = isPublicDir;
81
77
  var replaceExt = function (file, ext) { return file.replace((0, path_1.extname)(file), ext); };
82
78
  exports.replaceExt = replaceExt;
83
- var bigCamelize = function (s) { return (0, exports.camelize)(s).replace(s.charAt(0), s.charAt(0).toUpperCase()); };
84
- exports.bigCamelize = bigCamelize;
85
- var camelize = function (s) { return s.replace(/-(\w)/g, function (_, p) { return p.toUpperCase(); }); };
86
- exports.camelize = camelize;
87
79
  function smartAppendFileSync(file, code) {
88
80
  if ((0, fs_extra_1.pathExistsSync)(file)) {
89
81
  var content = (0, fs_extra_1.readFileSync)(file, 'utf-8');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/cli",
3
- "version": "1.27.14-alpha.1655710081377",
3
+ "version": "1.27.16",
4
4
  "description": "cli of varlet",
5
5
  "bin": {
6
6
  "varlet-cli": "./lib/index.js"
@@ -28,10 +28,10 @@
28
28
  "url": "https://github.com/varletjs/varlet/issues"
29
29
  },
30
30
  "dependencies": {
31
- "@varlet/icons": "1.27.14-alpha.1655710081377",
32
- "@varlet/shared": "1.27.14-alpha.1655710081377",
33
- "@varlet/markdown-vite-plugin": "1.27.14-alpha.1655710081377",
34
- "@varlet/touch-emulator": "1.27.14-alpha.1655710081377",
31
+ "@varlet/icons": "1.27.16",
32
+ "@varlet/shared": "1.27.16",
33
+ "@varlet/markdown-vite-plugin": "1.27.16",
34
+ "@varlet/touch-emulator": "1.27.16",
35
35
  "@babel/core": "^7.14.8",
36
36
  "@babel/helper-plugin-utils": "^7.14.5",
37
37
  "@babel/preset-env": "^7.14.8",
@@ -76,7 +76,7 @@
76
76
  "@types/semver": "^7.3.9"
77
77
  },
78
78
  "peerDependencies": {
79
- "@varlet/touch-emulator": "1.27.14-alpha.1655710081377",
79
+ "@varlet/touch-emulator": "1.27.16",
80
80
  "@vue/test-utils": "^2.0.0-rc.6",
81
81
  "clipboard": "^2.0.6",
82
82
  "live-server": "^1.2.1",
@@ -21,7 +21,7 @@
21
21
 
22
22
  <script lang="ts">
23
23
  import { defineComponent, watch, ref, nextTick } from 'vue'
24
- import { isURL, toNumber } from '../utils/shared'
24
+ import { isURL, toNumber } from '@varlet/shared'
25
25
  import { toSizeUnit } from '../utils/elements'
26
26
  import { props } from './props'
27
27
  import type { Ref } from 'vue'
@@ -60,7 +60,7 @@
60
60
  <script lang="ts">
61
61
  import { defineComponent, computed } from 'vue'
62
62
  import { props } from './props'
63
- import { toNumber } from '../utils/shared'
63
+ import { toNumber } from '@varlet/shared'
64
64
 
65
65
  export default defineComponent({
66
66
  name: 'VarSiteProgress',
@@ -3,7 +3,7 @@ import VarSiteSnackbar from './Snackbar.vue'
3
3
  import context from '../context'
4
4
  import { reactive, TransitionGroup } from 'vue'
5
5
  import { mountInstance } from '../utils/components'
6
- import { isPlainObject, toNumber } from '../utils/shared'
6
+ import { isPlainObject, toNumber } from '@varlet/shared'
7
7
  import type { LoadingType, LoadingSize } from '../loading/props'
8
8
  import type { App, Component, TeleportProps } from 'vue'
9
9
 
@@ -1,4 +1,4 @@
1
- import { isNumber, isString, toNumber, kebabCase } from './shared'
1
+ import { isNumber, isString, toNumber, kebabCase } from '@varlet/shared'
2
2
  import type { StyleVars } from '../../utils'
3
3
 
4
4
  export function getLeft(element: HTMLElement): number {
@@ -76,7 +76,6 @@ import config from '@config'
76
76
  import { computed, ComputedRef, defineComponent, ref, Ref, watch } from 'vue'
77
77
  import { useRoute } from 'vue-router'
78
78
  import {
79
- bigCamelize,
80
79
  getBrowserThemes,
81
80
  inIframe,
82
81
  isPhone,
@@ -85,6 +84,7 @@ import {
85
84
  watchLang,
86
85
  watchThemes,
87
86
  } from '../utils'
87
+ import { bigCamelize } from '@varlet/shared'
88
88
  import { get } from 'lodash-es'
89
89
 
90
90
  export default defineComponent({
package/site/utils.ts CHANGED
@@ -4,7 +4,6 @@ import { formatStyleVars } from './components/utils/elements'
4
4
 
5
5
  export * from './components/utils/components'
6
6
  export * from './components/utils/elements'
7
- export * from './components/utils/shared'
8
7
 
9
8
  export type StyleVars = Record<string, string>
10
9
 
@@ -21,14 +20,6 @@ function StyleProvider(styleVars: StyleVars | null = {}) {
21
20
  })
22
21
  }
23
22
 
24
- export function camelize(str: string): string {
25
- return str.replace(/-(\w)/g, (_: any, p: string) => p.toUpperCase())
26
- }
27
-
28
- export function bigCamelize(str: string): string {
29
- return camelize(str).replace(str.charAt(0), str.charAt(0).toUpperCase())
30
- }
31
-
32
23
  export interface PCLocationInfo {
33
24
  language: string
34
25
  menuName: string
@@ -1,29 +0,0 @@
1
- export const toNumber = (val: number | string | boolean | undefined | null): number => {
2
- if (val == null) return 0
3
-
4
- if (isString(val)) {
5
- val = parseFloat(val)
6
- val = Number.isNaN(val) ? 0 : val
7
- return val
8
- }
9
-
10
- if (isBool(val)) return Number(val)
11
-
12
- return val
13
- }
14
-
15
- export const isPlainObject = (val: unknown): val is Record<string, any> =>
16
- Object.prototype.toString.call(val) === '[object Object]'
17
-
18
- export function kebabCase(str: string): string {
19
- const ret = str.replace(/([A-Z])/g, ' $1').trim()
20
- return ret.split(' ').join('-').toLowerCase()
21
- }
22
-
23
- export const isString = (val: unknown): val is string => typeof val === 'string'
24
-
25
- export const isBool = (val: unknown): val is boolean => typeof val === 'boolean'
26
-
27
- export const isNumber = (val: unknown): val is number => typeof val === 'number'
28
-
29
- export const isURL = (val: string) => /^(http)|(\.*\/)/.test(val)