@dcloudio/uni-cli-shared 3.0.0-alpha-4070520250704003 → 3.0.0-alpha-4070620250731001
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/env/define.d.ts +1 -0
- package/dist/env/define.js +5 -1
- package/dist/vite/plugins/vitejs/plugins/asset.d.ts +3 -2
- package/dist/vite/plugins/vitejs/plugins/asset.js +7 -0
- package/dist/vite/plugins/vitejs/plugins/static.d.ts +3 -2
- package/dist/vite/plugins/vitejs/plugins/static.js +5 -1
- package/package.json +4 -4
package/dist/env/define.d.ts
CHANGED
package/dist/env/define.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.initDefine = void 0;
|
|
4
|
+
const utils_1 = require("../utils");
|
|
4
5
|
const env_1 = require("../hbx/env");
|
|
5
6
|
const json_1 = require("../json");
|
|
6
7
|
function initDefine(stringifyBoolean = false) {
|
|
@@ -9,7 +10,7 @@ function initDefine(stringifyBoolean = false) {
|
|
|
9
10
|
const isRunByHBuilderX = (0, env_1.runByHBuilderX)();
|
|
10
11
|
const isDebug = !!manifestJson.debug;
|
|
11
12
|
const isX = process.env.UNI_APP_X === 'true';
|
|
12
|
-
const isMP = process.env.UNI_PLATFORM.startsWith('mp');
|
|
13
|
+
const isMP = process.env.UNI_PLATFORM && process.env.UNI_PLATFORM.startsWith('mp-');
|
|
13
14
|
process.env['UNI_APP_ID'] = manifestJson.appid;
|
|
14
15
|
let mpXDefine = isX && isMP
|
|
15
16
|
? {
|
|
@@ -47,6 +48,9 @@ function initDefine(stringifyBoolean = false) {
|
|
|
47
48
|
// 兼容旧版本
|
|
48
49
|
'process.env.VUE_APP_PLATFORM': JSON.stringify(process.env.UNI_PLATFORM || ''),
|
|
49
50
|
'process.env.VUE_APP_DARK_MODE': JSON.stringify(platformManifestJson.darkmode || false),
|
|
51
|
+
__UNI_PRELOAD_SHADOW_IMAGE__: JSON.stringify(process.env.UNI_PLATFORM === 'mp-weixin'
|
|
52
|
+
? (0, utils_1.createShadowImageUrl)(1, 'grey').slice(5)
|
|
53
|
+
: ''),
|
|
50
54
|
...mpXDefine,
|
|
51
55
|
};
|
|
52
56
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type { OutputOptions, PluginContext, RenderedChunk } from 'rollup';
|
|
3
3
|
import type { Plugin } from '../plugin';
|
|
4
4
|
import type { ResolvedConfig } from '../config';
|
|
5
|
+
import { type IsStaticFile } from './static';
|
|
5
6
|
export declare const assetUrlRE: RegExp;
|
|
6
7
|
export declare const chunkToEmittedAssetsMap: WeakMap<RenderedChunk, Set<string>>;
|
|
7
8
|
/**
|
|
@@ -13,7 +14,7 @@ export declare function assetPlugin(config: ResolvedConfig, options?: {
|
|
|
13
14
|
export declare function parseAssets(config: ResolvedConfig, code: string): string;
|
|
14
15
|
export declare function registerAssetToChunk(chunk: RenderedChunk, file: string): void;
|
|
15
16
|
export declare function checkPublicFile(url: string, { publicDir }: ResolvedConfig): string | undefined;
|
|
16
|
-
export declare function fileToUrl(id: string, config: ResolvedConfig, ctx: PluginContext, canInline: boolean | undefined, isStaticFile:
|
|
17
|
+
export declare function fileToUrl(id: string, config: ResolvedConfig, ctx: PluginContext, canInline: boolean | undefined, isStaticFile: IsStaticFile): string;
|
|
17
18
|
export declare function getAssetFilename(hash: string, config: ResolvedConfig): string | undefined;
|
|
18
19
|
/**
|
|
19
20
|
* converts the source filepath of the asset to the output filename based on the assetFileNames option. \
|
|
@@ -40,4 +41,4 @@ export declare function getAssetFilename(hash: string, config: ResolvedConfig):
|
|
|
40
41
|
*/
|
|
41
42
|
export declare function assetFileNamesToFileName(assetFileNames: Exclude<OutputOptions['assetFileNames'], undefined>, file: string, contentHash: string, content: string | Buffer): string;
|
|
42
43
|
export declare function getAssetHash(content: Buffer | string): string;
|
|
43
|
-
export declare function urlToBuiltUrl(url: string, importer: string, config: ResolvedConfig, pluginContext: PluginContext, isStaticFile:
|
|
44
|
+
export declare function urlToBuiltUrl(url: string, importer: string, config: ResolvedConfig, pluginContext: PluginContext, isStaticFile: IsStaticFile): string;
|
|
@@ -281,6 +281,13 @@ function fileToBuiltUrl(id, config, pluginContext, skipPublicCheck = false, canI
|
|
|
281
281
|
url = `data:${lite_1.default.getType(file)};base64,${content.toString('base64')}`;
|
|
282
282
|
}
|
|
283
283
|
else {
|
|
284
|
+
// 小程序平台如果是子包中的静态资源,跳过Vite默认的哈希处理流程,避免被编译成同一个路径
|
|
285
|
+
if (process.env.UNI_PLATFORM &&
|
|
286
|
+
process.env.UNI_PLATFORM.startsWith('mp-') &&
|
|
287
|
+
isStaticFile(file, true)) {
|
|
288
|
+
return (config.base +
|
|
289
|
+
(0, utils_1.normalizePath)(path_1.default.relative(process.env.UNI_INPUT_DIR, id)));
|
|
290
|
+
}
|
|
284
291
|
const map = assetHashToFilenameMap.get(config);
|
|
285
292
|
const contentHash = getAssetHash(content);
|
|
286
293
|
const { search, hash } = (0, url_1.parse)(id);
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export declare function createIsStaticFile(): (relativeFile: string) => boolean;
|
|
2
|
-
export
|
|
1
|
+
export declare function createIsStaticFile(): (relativeFile: string, onlySubPackages?: boolean) => boolean;
|
|
2
|
+
export type IsStaticFile = (file: string, onlySubPackages?: boolean) => boolean;
|
|
3
|
+
export declare function getIsStaticFile(): IsStaticFile;
|
|
@@ -20,10 +20,14 @@ function createIsStaticFile() {
|
|
|
20
20
|
return (0, utils_1.normalizePath)(path_1.default.join(subPackage.root, 'static')) + '/';
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
return function isStaticFile(relativeFile
|
|
23
|
+
return function isStaticFile(relativeFile, onlySubPackages = false // 是否只判断子包 static 下的文件
|
|
24
|
+
) {
|
|
24
25
|
if (path_1.default.isAbsolute(relativeFile)) {
|
|
25
26
|
relativeFile = (0, utils_1.normalizePath)(path_1.default.relative(process.env.UNI_INPUT_DIR, relativeFile));
|
|
26
27
|
}
|
|
28
|
+
if (onlySubPackages) {
|
|
29
|
+
return subPackageStatics.some((s) => relativeFile.startsWith(s));
|
|
30
|
+
}
|
|
27
31
|
return (relativeFile.startsWith('static/') ||
|
|
28
32
|
uniModulesStaticRe.test(relativeFile) ||
|
|
29
33
|
subPackageStatics.some((s) => relativeFile.startsWith(s)));
|
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-4070620250731001",
|
|
4
4
|
"description": "@dcloudio/uni-cli-shared",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"unimport": "4.1.1",
|
|
69
69
|
"unplugin-auto-import": "19.1.0",
|
|
70
70
|
"xregexp": "3.1.0",
|
|
71
|
-
"@dcloudio/uni-i18n": "3.0.0-alpha-
|
|
72
|
-
"@dcloudio/uni-shared": "3.0.0-alpha-
|
|
71
|
+
"@dcloudio/uni-i18n": "3.0.0-alpha-4070620250731001",
|
|
72
|
+
"@dcloudio/uni-shared": "3.0.0-alpha-4070620250731001"
|
|
73
73
|
},
|
|
74
74
|
"gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
|
|
75
75
|
"devDependencies": {
|
|
@@ -89,6 +89,6 @@
|
|
|
89
89
|
"code-frame": "link:@types/@babel/code-frame",
|
|
90
90
|
"postcss": "^8.4.21",
|
|
91
91
|
"vue": "3.4.21",
|
|
92
|
-
"@dcloudio/uni-uts-v1": "3.0.0-alpha-
|
|
92
|
+
"@dcloudio/uni-uts-v1": "3.0.0-alpha-4070620250731001"
|
|
93
93
|
}
|
|
94
94
|
}
|