@dcloudio/uni-cli-shared 3.0.0-alpha-3060920221111002 → 3.0.0-alpha-3060920221117001
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.
- package/dist/esbuild.d.ts +1 -1
- package/dist/hbx/env.d.ts +1 -0
- package/dist/hbx/env.js +22 -1
- package/dist/json/app/manifest/statusbar.js +4 -2
- package/dist/platform.d.ts +1 -0
- package/dist/platform.js +5 -1
- package/dist/resolve.js +1 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +20 -1
- package/dist/uts.js +7 -9
- package/dist/vite/plugins/vitejs/plugins/css.js +12 -7
- package/package.json +10 -10
package/dist/esbuild.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { BuildOptions } from 'esbuild';
|
|
1
|
+
import type { BuildOptions } from 'esbuild';
|
|
2
2
|
export declare function transformWithEsbuild(code: string, filename: string, options: BuildOptions): Promise<import("esbuild").BuildResult>;
|
|
3
3
|
export declare function esbuild(options: BuildOptions): Promise<import("esbuild").BuildResult>;
|
package/dist/hbx/env.d.ts
CHANGED
package/dist/hbx/env.js
CHANGED
|
@@ -3,10 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.initModulePaths = exports.runByHBuilderX = exports.isInHBuilderX = void 0;
|
|
6
|
+
exports.fixBinaryPath = exports.initModulePaths = exports.runByHBuilderX = exports.isInHBuilderX = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const module_1 = __importDefault(require("module"));
|
|
9
9
|
const uni_shared_1 = require("@dcloudio/uni-shared");
|
|
10
|
+
const resolve_1 = require("../resolve");
|
|
11
|
+
const utils_1 = require("../utils");
|
|
10
12
|
exports.isInHBuilderX = (0, uni_shared_1.once)(() => {
|
|
11
13
|
try {
|
|
12
14
|
const { name } = require(path_1.default.resolve(process.cwd(), '../about/package.json'));
|
|
@@ -43,3 +45,22 @@ function initModulePaths() {
|
|
|
43
45
|
};
|
|
44
46
|
}
|
|
45
47
|
exports.initModulePaths = initModulePaths;
|
|
48
|
+
function fixBinaryPath() {
|
|
49
|
+
// cli 工程在 HBuilderX 中运行
|
|
50
|
+
if (!(0, exports.isInHBuilderX)() && (0, exports.runByHBuilderX)()) {
|
|
51
|
+
if (!utils_1.isWindows) {
|
|
52
|
+
process.env.ESBUILD_BINARY_PATH = path_1.default.join((0, resolve_1.resolveBuiltIn)('esbuild/package.json'), '../bin/esbuild');
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
if (utils_1.isWindows) {
|
|
56
|
+
process.env.UTS_BINARY_PATH = (0, resolve_1.resolveBuiltIn)('@dcloudio/uts-win32-x64-msvc');
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
// 强制使用 arm64 也不行,会报错:have 'arm64', need 'x86_64'
|
|
60
|
+
// process.env.UTS_BINARY_PATH = resolveBuiltIn('@dcloudio/uts-darwin-arm64')
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (e) { }
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.fixBinaryPath = fixBinaryPath;
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.initAppStatusbar = void 0;
|
|
4
4
|
function initAppStatusbar(manifestJson, pagesJson) {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const titleColor = pagesJson.pages[0].style.navigationBar.titleColor ||
|
|
6
|
+
pagesJson.globalStyle.navigationBar.titleColor ||
|
|
7
|
+
'#ffffff';
|
|
8
|
+
const backgroundColor = pagesJson.globalStyle.navigationBar.backgroundColor || '#000000';
|
|
7
9
|
manifestJson.plus.statusbar = {
|
|
8
10
|
immersed: 'supportedDevice',
|
|
9
11
|
style: titleColor === '#000000' ? 'dark' : 'light',
|
package/dist/platform.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare function registerPlatform(platform: string): void;
|
|
2
2
|
export declare function getPlatforms(): string[];
|
|
3
3
|
export declare function getPlatformDir(): "quickapp-webview-huawei" | "quickapp-webview-union";
|
|
4
|
+
export declare function isMiniProgramPlatform(): boolean;
|
package/dist/platform.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPlatformDir = exports.getPlatforms = exports.registerPlatform = void 0;
|
|
3
|
+
exports.isMiniProgramPlatform = exports.getPlatformDir = exports.getPlatforms = exports.registerPlatform = void 0;
|
|
4
4
|
const BUILT_IN_PLATFORMS = [
|
|
5
5
|
'app',
|
|
6
6
|
'app-plus',
|
|
@@ -33,3 +33,7 @@ function getPlatformDir() {
|
|
|
33
33
|
return process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM;
|
|
34
34
|
}
|
|
35
35
|
exports.getPlatformDir = getPlatformDir;
|
|
36
|
+
function isMiniProgramPlatform() {
|
|
37
|
+
return !['app', 'app-plus', 'h5', 'web'].includes(process.env.UNI_PLATFORM);
|
|
38
|
+
}
|
|
39
|
+
exports.isMiniProgramPlatform = isMiniProgramPlatform;
|
package/dist/resolve.js
CHANGED
|
@@ -51,7 +51,7 @@ function resolveNodeModulePath(modulePath) {
|
|
|
51
51
|
return nodeModulesPaths;
|
|
52
52
|
}
|
|
53
53
|
function initPaths() {
|
|
54
|
-
const cliContext = process.env.UNI_CLI_CONTEXT;
|
|
54
|
+
const cliContext = process.env.UNI_CLI_CONTEXT || process.cwd();
|
|
55
55
|
if (cliContext) {
|
|
56
56
|
const pathSet = new Set();
|
|
57
57
|
pathSet.add(path_1.default.join(cliContext, 'node_modules'));
|
package/dist/utils.d.ts
CHANGED
|
@@ -16,3 +16,4 @@ export declare function pathToGlob(pathString: string, glob: string, options?: {
|
|
|
16
16
|
escape?: boolean;
|
|
17
17
|
}): string;
|
|
18
18
|
export declare function resolveSourceMapPath(outputDir?: string, platform?: UniApp.PLATFORM): string;
|
|
19
|
+
export declare function installDepTips(type: 'dependencies' | 'devDependencies', module: string, version?: string): string;
|
package/dist/utils.js
CHANGED
|
@@ -3,10 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.resolveSourceMapPath = exports.pathToGlob = exports.normalizeParsePlugins = exports.normalizeMiniProgramFilename = exports.normalizeNodeModules = exports.removeExt = exports.normalizePagePath = exports.normalizeIdentifier = exports.checkElementNodeTag = exports.normalizePath = exports.isWindows = exports.isRunningWithYarnPnp = exports.hash = void 0;
|
|
6
|
+
exports.installDepTips = exports.resolveSourceMapPath = exports.pathToGlob = exports.normalizeParsePlugins = exports.normalizeMiniProgramFilename = exports.normalizeNodeModules = exports.removeExt = exports.normalizePagePath = exports.normalizeIdentifier = exports.checkElementNodeTag = exports.normalizePath = exports.isWindows = exports.isRunningWithYarnPnp = exports.hash = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const os_1 = __importDefault(require("os"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
10
11
|
const shared_1 = require("@vue/shared");
|
|
11
12
|
var hash_sum_1 = require("hash-sum");
|
|
12
13
|
Object.defineProperty(exports, "hash", { enumerable: true, get: function () { return __importDefault(hash_sum_1).default; } });
|
|
@@ -91,3 +92,21 @@ function resolveSourceMapPath(outputDir, platform) {
|
|
|
91
92
|
return path_1.default.resolve(outputDir || process.env.UNI_OUTPUT_DIR, '../.sourcemap/' + (platform || (0, platform_1.getPlatformDir)()));
|
|
92
93
|
}
|
|
93
94
|
exports.resolveSourceMapPath = resolveSourceMapPath;
|
|
95
|
+
function hasProjectYarn(cwd) {
|
|
96
|
+
return fs_1.default.existsSync(path_1.default.join(cwd, 'yarn.lock'));
|
|
97
|
+
}
|
|
98
|
+
function hasProjectPnpm(cwd) {
|
|
99
|
+
return fs_1.default.existsSync(path_1.default.join(cwd, 'pnpm-lock.yaml'));
|
|
100
|
+
}
|
|
101
|
+
function getInstallCommand(cwd) {
|
|
102
|
+
return hasProjectYarn(cwd)
|
|
103
|
+
? 'yarn add'
|
|
104
|
+
: hasProjectPnpm(cwd)
|
|
105
|
+
? 'pnpm i'
|
|
106
|
+
: 'npm i';
|
|
107
|
+
}
|
|
108
|
+
function installDepTips(type, module, version) {
|
|
109
|
+
return `Cannot find module: ${module}
|
|
110
|
+
Please run \`${picocolors_1.default.cyan(`${getInstallCommand(process.cwd())} ${module + (version ? '@' + version : '')}${type === 'devDependencies' ? ' -D' : ''}`)}\` and try again.`;
|
|
111
|
+
}
|
|
112
|
+
exports.installDepTips = installDepTips;
|
package/dist/uts.js
CHANGED
|
@@ -81,16 +81,14 @@ function resolveUTSCompiler() {
|
|
|
81
81
|
}
|
|
82
82
|
catch (e) { }
|
|
83
83
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
catch (e) { }
|
|
84
|
+
try {
|
|
85
|
+
compilerPath = require.resolve('@dcloudio/uni-uts-v1', {
|
|
86
|
+
paths: [process.env.UNI_CLI_CONTEXT],
|
|
87
|
+
});
|
|
91
88
|
}
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
catch (e) {
|
|
90
|
+
console.error((0, utils_1.installDepTips)('devDependencies', '@dcloudio/uni-uts-v1', require('@dcloudio/uni-cli-shared/package.json').version));
|
|
91
|
+
process.exit(0);
|
|
94
92
|
}
|
|
95
93
|
return require(compilerPath);
|
|
96
94
|
}
|
|
@@ -36,7 +36,6 @@ const pluginutils_1 = require("@rollup/pluginutils");
|
|
|
36
36
|
const utils_1 = require("../utils");
|
|
37
37
|
const asset_1 = require("./asset");
|
|
38
38
|
const magic_string_1 = __importDefault(require("magic-string"));
|
|
39
|
-
const esbuild_1 = require("esbuild");
|
|
40
39
|
const preprocess_1 = require("../../../../preprocess");
|
|
41
40
|
const constants_1 = require("../../../../constants");
|
|
42
41
|
const cleanString_1 = require("../cleanString");
|
|
@@ -644,20 +643,26 @@ async function doImportCSSReplace(rawUrl, matched, replacer) {
|
|
|
644
643
|
}
|
|
645
644
|
async function minifyCSS(css, config) {
|
|
646
645
|
try {
|
|
647
|
-
const { code, warnings } = await (
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
646
|
+
const { code, warnings } = await Promise.resolve().then(() => __importStar(require('esbuild'))).then(({ transform }) => {
|
|
647
|
+
return transform(css, {
|
|
648
|
+
loader: 'css',
|
|
649
|
+
minify: true,
|
|
650
|
+
target: config.build.cssTarget || undefined,
|
|
651
|
+
});
|
|
651
652
|
});
|
|
652
653
|
if (warnings.length) {
|
|
653
|
-
const msgs = await (
|
|
654
|
+
const msgs = await Promise.resolve().then(() => __importStar(require('esbuild'))).then(({ formatMessages }) => {
|
|
655
|
+
return formatMessages(warnings, { kind: 'warning' });
|
|
656
|
+
});
|
|
654
657
|
config.logger.warn(picocolors_1.default.yellow(`warnings when minifying css:\n${msgs.join('\n')}`));
|
|
655
658
|
}
|
|
656
659
|
return code;
|
|
657
660
|
}
|
|
658
661
|
catch (e) {
|
|
659
662
|
if (e.errors) {
|
|
660
|
-
const msgs = await (
|
|
663
|
+
const msgs = await Promise.resolve().then(() => __importStar(require('esbuild'))).then(({ formatMessages }) => {
|
|
664
|
+
return formatMessages(e.errors, { kind: 'error' });
|
|
665
|
+
});
|
|
661
666
|
e.frame = '\n' + msgs.join('\n');
|
|
662
667
|
e.loc = e.errors[0].location;
|
|
663
668
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/uni-cli-shared",
|
|
3
|
-
"version": "3.0.0-alpha-
|
|
3
|
+
"version": "3.0.0-alpha-3060920221117001",
|
|
4
4
|
"description": "@dcloudio/uni-cli-shared",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -25,17 +25,17 @@
|
|
|
25
25
|
"@babel/core": "^7.19.6",
|
|
26
26
|
"@babel/parser": "^7.19.6",
|
|
27
27
|
"@babel/types": "^7.20.0",
|
|
28
|
-
"@dcloudio/uni-i18n": "3.0.0-alpha-
|
|
29
|
-
"@dcloudio/uni-shared": "3.0.0-alpha-
|
|
28
|
+
"@dcloudio/uni-i18n": "3.0.0-alpha-3060920221117001",
|
|
29
|
+
"@dcloudio/uni-shared": "3.0.0-alpha-3060920221117001",
|
|
30
30
|
"@intlify/core-base": "9.1.9",
|
|
31
31
|
"@intlify/shared": "9.1.9",
|
|
32
32
|
"@intlify/vue-devtools": "9.1.9",
|
|
33
33
|
"@rollup/pluginutils": "^4.2.0",
|
|
34
|
-
"@vue/compiler-core": "3.2.
|
|
35
|
-
"@vue/compiler-dom": "3.2.
|
|
36
|
-
"@vue/compiler-sfc": "3.2.
|
|
37
|
-
"@vue/server-renderer": "3.2.
|
|
38
|
-
"@vue/shared": "3.2.
|
|
34
|
+
"@vue/compiler-core": "3.2.45",
|
|
35
|
+
"@vue/compiler-dom": "3.2.45",
|
|
36
|
+
"@vue/compiler-sfc": "3.2.45",
|
|
37
|
+
"@vue/server-renderer": "3.2.45",
|
|
38
|
+
"@vue/shared": "3.2.45",
|
|
39
39
|
"autoprefixer": "^10.4.13",
|
|
40
40
|
"base64url": "^3.0.1",
|
|
41
41
|
"chokidar": "^3.5.3",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@dcloudio/uni-uts-v1": "3.0.0-alpha-
|
|
67
|
+
"@dcloudio/uni-uts-v1": "3.0.0-alpha-3060920221117001",
|
|
68
68
|
"@types/babel__core": "^7.1.19",
|
|
69
69
|
"@types/debug": "^4.1.7",
|
|
70
70
|
"@types/estree": "^0.0.51",
|
|
@@ -77,6 +77,6 @@
|
|
|
77
77
|
"@types/sass": "^1.43.1",
|
|
78
78
|
"@types/stylus": "^0.48.36",
|
|
79
79
|
"postcss": "^8.4.16",
|
|
80
|
-
"vue": "3.2.
|
|
80
|
+
"vue": "3.2.45"
|
|
81
81
|
}
|
|
82
82
|
}
|