@varlet/cli 2.22.2 → 2.22.3
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.
|
@@ -3,5 +3,4 @@ export declare function replaceExportToDeclare(script: string): string;
|
|
|
3
3
|
export declare function injectExport(script: string): string;
|
|
4
4
|
export declare function injectScopeId(script: string, scopeId: string): string;
|
|
5
5
|
export declare function injectRender(script: string, render: string): string;
|
|
6
|
-
export declare function getFsPath(sfc: string, fsFile: string): string;
|
|
7
6
|
export declare function compileSFC(sfc: string): Promise<void>;
|
|
@@ -3,7 +3,7 @@ import hash from 'hash-sum';
|
|
|
3
3
|
import { parse, resolve } from 'path';
|
|
4
4
|
import { parse as parseSFC, compileTemplate, compileStyle, compileScript as compileScriptSFC, registerTS, } from '@vue/compiler-sfc';
|
|
5
5
|
import { replaceExt, smartAppendFileSync } from '../shared/fsUtils.js';
|
|
6
|
-
import {
|
|
6
|
+
import { SRC_DIR, ES_DIR } from '../shared/constant.js';
|
|
7
7
|
import { compileScript, getScriptExtname } from './compileScript.js';
|
|
8
8
|
import ts from 'typescript';
|
|
9
9
|
import { clearEmptyLine, compileLess, extractStyleDependencies, normalizeStyleDependency, STYLE_IMPORT_RE, } from './compileStyle.js';
|
|
@@ -34,16 +34,10 @@ export function injectRender(script, render) {
|
|
|
34
34
|
script += `\n${SFC}.render = ${RENDER}`;
|
|
35
35
|
return script;
|
|
36
36
|
}
|
|
37
|
-
export function getFsPath(sfc, fsFile) {
|
|
38
|
-
if (fsFile === 'tsconfig.json' || fsFile.startsWith('node_modules')) {
|
|
39
|
-
return resolve(CWD, fsFile);
|
|
40
|
-
}
|
|
41
|
-
return resolve(sfc.replace(ES_DIR, SRC_DIR), '..', fsFile);
|
|
42
|
-
}
|
|
43
37
|
export async function compileSFC(sfc) {
|
|
44
38
|
const sources = await readFile(sfc, 'utf-8');
|
|
45
39
|
const id = hash(sources);
|
|
46
|
-
const { descriptor } = parseSFC(sources, { sourceMap: false });
|
|
40
|
+
const { descriptor } = parseSFC(sources, { filename: sfc, sourceMap: false });
|
|
47
41
|
const { script, scriptSetup, template, styles } = descriptor;
|
|
48
42
|
let scriptContent;
|
|
49
43
|
let bindingMetadata;
|
|
@@ -53,8 +47,8 @@ export async function compileSFC(sfc) {
|
|
|
53
47
|
id,
|
|
54
48
|
// issue https://github.com/varletjs/varlet/issues/1458
|
|
55
49
|
fs: {
|
|
56
|
-
fileExists: (file) => existsSync(
|
|
57
|
-
readFile: (file) => readFileSync(
|
|
50
|
+
fileExists: (file) => existsSync(file.replace(ES_DIR, SRC_DIR)),
|
|
51
|
+
readFile: (file) => readFileSync(file.replace(ES_DIR, SRC_DIR), 'utf-8'),
|
|
58
52
|
},
|
|
59
53
|
});
|
|
60
54
|
scriptContent = content;
|
|
@@ -113,9 +113,9 @@ export async function compileScript(script, file) {
|
|
|
113
113
|
code = resolveDependence(file, code);
|
|
114
114
|
code = extractStyleDependencies(file, code, IMPORT_CSS_RE);
|
|
115
115
|
code = extractStyleDependencies(file, code, IMPORT_LESS_RE);
|
|
116
|
-
removeSync(file);
|
|
117
|
-
writeFileSync(replaceExt(file, getScriptExtname()), code, 'utf8');
|
|
118
116
|
}
|
|
117
|
+
removeSync(file);
|
|
118
|
+
writeFileSync(replaceExt(file, getScriptExtname()), code, 'utf8');
|
|
119
119
|
}
|
|
120
120
|
export async function compileScriptFile(file) {
|
|
121
121
|
const sources = readFileSync(file, 'utf-8');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varlet/cli",
|
|
3
|
-
"version": "2.22.
|
|
3
|
+
"version": "2.22.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "cli of varlet",
|
|
6
6
|
"bin": {
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"@varlet/release": "^0.2.1",
|
|
38
38
|
"@babel/core": "^7.22.5",
|
|
39
39
|
"@babel/preset-typescript": "^7.22.5",
|
|
40
|
-
"@vitejs/plugin-vue": "5.0.
|
|
40
|
+
"@vitejs/plugin-vue": "5.0.3",
|
|
41
41
|
"@vitejs/plugin-vue-jsx": "3.1.0",
|
|
42
|
-
"@vue/babel-plugin-jsx": "1.1
|
|
43
|
-
"@vue/compiler-sfc": "3.4.
|
|
44
|
-
"@vue/runtime-core": "3.4.
|
|
45
|
-
"vue": "3.4.
|
|
42
|
+
"@vue/babel-plugin-jsx": "1.2.1",
|
|
43
|
+
"@vue/compiler-sfc": "3.4.15",
|
|
44
|
+
"@vue/runtime-core": "3.4.15",
|
|
45
|
+
"vue": "3.4.15",
|
|
46
46
|
"vite": "5.0.10",
|
|
47
47
|
"esbuild": "0.19.3",
|
|
48
48
|
"vitest": "1.1.0",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"slash": "^3.0.0",
|
|
65
65
|
"typescript": "^5.1.5",
|
|
66
66
|
"webfont": "11.2.26",
|
|
67
|
-
"@varlet/shared": "2.22.
|
|
68
|
-
"@varlet/vite-plugins": "2.22.
|
|
67
|
+
"@varlet/shared": "2.22.3",
|
|
68
|
+
"@varlet/vite-plugins": "2.22.3"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@types/babel__core": "^7.20.1",
|
|
@@ -80,12 +80,12 @@
|
|
|
80
80
|
"@types/semver": "^7.3.9",
|
|
81
81
|
"@types/sharp": "0.31.1",
|
|
82
82
|
"rimraf": "^5.0.1",
|
|
83
|
-
"@varlet/
|
|
84
|
-
"@varlet/touch-emulator": "2.22.
|
|
85
|
-
"@varlet/
|
|
83
|
+
"@varlet/ui": "2.22.3",
|
|
84
|
+
"@varlet/touch-emulator": "2.22.3",
|
|
85
|
+
"@varlet/icons": "2.22.3"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
|
-
"@vue/runtime-core": "3.4.
|
|
88
|
+
"@vue/runtime-core": "3.4.15",
|
|
89
89
|
"@vue/test-utils": "2.4.1",
|
|
90
90
|
"@vitest/coverage-istanbul": "1.1.0",
|
|
91
91
|
"vitest": "1.1.0",
|
|
@@ -93,11 +93,11 @@
|
|
|
93
93
|
"clipboard": "^2.0.6",
|
|
94
94
|
"live-server": "^1.2.1",
|
|
95
95
|
"lodash-es": "^4.17.21",
|
|
96
|
-
"vue": "3.4.
|
|
96
|
+
"vue": "3.4.15",
|
|
97
97
|
"vue-router": "4.2.0",
|
|
98
|
-
"@varlet/
|
|
99
|
-
"@varlet/
|
|
100
|
-
"@varlet/
|
|
98
|
+
"@varlet/ui": "2.22.3",
|
|
99
|
+
"@varlet/icons": "2.22.3",
|
|
100
|
+
"@varlet/touch-emulator": "2.22.3"
|
|
101
101
|
},
|
|
102
102
|
"scripts": {
|
|
103
103
|
"dev": "tsc --watch",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@varlet/shared": "workspace:*",
|
|
45
45
|
"@varlet/ui": "workspace:*",
|
|
46
46
|
"@vue/test-utils": "2.4.1",
|
|
47
|
-
"@vue/runtime-core": "3.4.
|
|
47
|
+
"@vue/runtime-core": "3.4.15",
|
|
48
48
|
"@vitest/coverage-istanbul": "1.1.0",
|
|
49
49
|
"jsdom": "22.1.0",
|
|
50
50
|
"vitest": "1.1.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"prettier": "^2.8.8",
|
|
57
57
|
"simple-git-hooks": "^2.8.0",
|
|
58
58
|
"typescript": "^5.1.5",
|
|
59
|
-
"vue": "3.4.
|
|
59
|
+
"vue": "3.4.15",
|
|
60
60
|
"vue-router": "4.2.0"
|
|
61
61
|
},
|
|
62
62
|
"lint-staged": {
|