@dcloudio/uni-cli-shared 3.0.0-alpha-4020320240629001 → 3.0.0-alpha-4020520240719001
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/json/app/manifest/nvue.d.ts +1 -1
- package/dist/platform.js +3 -0
- package/dist/resolve.js +6 -1
- package/dist/uni_modules.js +1 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +29 -2
- package/dist/uts.d.ts +1 -0
- package/dist/uts.js +25 -5
- package/dist/vite/plugins/copy.d.ts +1 -2
- package/dist/vite/plugins/copy.js +1 -2
- package/dist/vite/plugins/index.d.ts +1 -0
- package/dist/vite/plugins/index.js +1 -0
- package/dist/vite/plugins/json.d.ts +2 -0
- package/dist/vite/plugins/json.js +26 -0
- package/dist/vite/utils/url.d.ts +1 -1
- package/dist/watcher.d.ts +1 -3
- package/dist/watcher.js +4 -3
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare function initNVue(manifestJson: Record<string, any>, pagesJson: UniApp.PagesJson): void;
|
|
2
|
-
export declare function getNVueCompiler(manifestJson: Record<string, any>): "uni-app" | "
|
|
2
|
+
export declare function getNVueCompiler(manifestJson: Record<string, any>): "uni-app" | "vue" | "weex" | "vite";
|
|
3
3
|
export declare function getNVueStyleCompiler(manifestJson: Record<string, any>): "uni-app" | "weex";
|
|
4
4
|
export declare function getNVueFlexDirection(manifestJson: Record<string, any>): "column" | "row" | "row-reverse" | "column-reverse";
|
package/dist/platform.js
CHANGED
package/dist/resolve.js
CHANGED
|
@@ -111,7 +111,12 @@ function resolveComponentsLibPath() {
|
|
|
111
111
|
componentsLibPath = path_1.default.join(resolveWithSymlinks('@dcloudio/uni-components/package.json', process.env.UNI_INPUT_DIR), dir);
|
|
112
112
|
}
|
|
113
113
|
catch (e) {
|
|
114
|
-
|
|
114
|
+
try {
|
|
115
|
+
componentsLibPath = path_1.default.join(resolveWithSymlinks('@dcloudio/uni-components/package.json', process.cwd()), dir);
|
|
116
|
+
}
|
|
117
|
+
catch (e) {
|
|
118
|
+
console.log(e);
|
|
119
|
+
}
|
|
115
120
|
}
|
|
116
121
|
}
|
|
117
122
|
}
|
package/dist/uni_modules.js
CHANGED
|
@@ -27,7 +27,7 @@ function formatExtApiProviderName(service, name) {
|
|
|
27
27
|
if (service === 'oauth') {
|
|
28
28
|
service = 'OAuth';
|
|
29
29
|
}
|
|
30
|
-
return `Uni${(0, exports.capitalize)((0, exports.camelize)(service))}${(0, exports.capitalize)((0, exports.camelize)(name))}
|
|
30
|
+
return `Uni${(0, exports.capitalize)((0, exports.camelize)(service))}${(0, exports.capitalize)((0, exports.camelize)(name))}ProviderImpl`;
|
|
31
31
|
}
|
|
32
32
|
exports.formatExtApiProviderName = formatExtApiProviderName;
|
|
33
33
|
function getUniExtApiProviderRegisters() {
|
package/dist/utils.d.ts
CHANGED
|
@@ -34,3 +34,4 @@ export declare function createResolveErrorMsg(source: string, importer: string):
|
|
|
34
34
|
export declare function enableSourceMap(): boolean;
|
|
35
35
|
export declare function requireUniHelpers(): any;
|
|
36
36
|
export declare function normalizeEmitAssetFileName(fileName: string): string;
|
|
37
|
+
export declare function createShadowImageUrl(cdn: number, type?: string): string;
|
package/dist/utils.js
CHANGED
|
@@ -3,7 +3,7 @@ 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.normalizeEmitAssetFileName = exports.requireUniHelpers = exports.enableSourceMap = exports.createResolveErrorMsg = exports.parseImporter = exports.resolveAppVue = exports.isAppVue = 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.isArray = exports.capitalize = exports.camelize = exports.hash = void 0;
|
|
6
|
+
exports.createShadowImageUrl = exports.normalizeEmitAssetFileName = exports.requireUniHelpers = exports.enableSourceMap = exports.createResolveErrorMsg = exports.parseImporter = exports.resolveAppVue = exports.isAppVue = 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.isArray = exports.capitalize = exports.camelize = 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"));
|
|
@@ -15,6 +15,7 @@ const constants_1 = require("./constants");
|
|
|
15
15
|
const compiler_core_1 = require("@vue/compiler-core");
|
|
16
16
|
const platform_1 = require("./platform");
|
|
17
17
|
const hbx_1 = require("./hbx");
|
|
18
|
+
const json_1 = require("./json");
|
|
18
19
|
// 专为 uts.ts 服务
|
|
19
20
|
var shared_2 = require("@vue/shared");
|
|
20
21
|
Object.defineProperty(exports, "camelize", { enumerable: true, get: function () { return shared_2.camelize; } });
|
|
@@ -176,11 +177,37 @@ function requireUniHelpers() {
|
|
|
176
177
|
}
|
|
177
178
|
exports.requireUniHelpers = requireUniHelpers;
|
|
178
179
|
function normalizeEmitAssetFileName(fileName) {
|
|
180
|
+
const extname = path_1.default.extname(fileName);
|
|
179
181
|
if (process.env.UNI_APP_X_TSC === 'true') {
|
|
180
|
-
if (
|
|
182
|
+
if (extname !== '.ts') {
|
|
181
183
|
return fileName + '.ts';
|
|
182
184
|
}
|
|
183
185
|
}
|
|
186
|
+
else {
|
|
187
|
+
// logo.png、pages.json 等
|
|
188
|
+
if (!['.ts', '.uts', '.uvue', '.vue'].includes(extname)) {
|
|
189
|
+
fileName = fileName + '.uts';
|
|
190
|
+
}
|
|
191
|
+
}
|
|
184
192
|
return fileName;
|
|
185
193
|
}
|
|
186
194
|
exports.normalizeEmitAssetFileName = normalizeEmitAssetFileName;
|
|
195
|
+
function createIdent() {
|
|
196
|
+
if (process.env.UNI_INPUT_DIR) {
|
|
197
|
+
const manifestJson = (0, json_1.parseManifestJsonOnce)(process.env.UNI_INPUT_DIR);
|
|
198
|
+
const id = (manifestJson.appid || '').replace('__UNI__', '');
|
|
199
|
+
if (id) {
|
|
200
|
+
return Buffer.from(Buffer.from(id).toString('base64')).toString('hex');
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return '';
|
|
204
|
+
}
|
|
205
|
+
function createShadowImageUrl(cdn, type = 'grey') {
|
|
206
|
+
let identStr = '';
|
|
207
|
+
if (process.env.UNI_PLATFORM !== 'h5' && process.env.UNI_PLATFORM !== 'web') {
|
|
208
|
+
const ident = createIdent();
|
|
209
|
+
identStr = ident ? `${ident}/` : '';
|
|
210
|
+
}
|
|
211
|
+
return `https://cdn${(cdn || 0) + (process.env.UNI_APP_X === 'true' ? 1000 : 0) || ''}.dcloud.net.cn/${identStr}img/shadow-${type}.png`;
|
|
212
|
+
}
|
|
213
|
+
exports.createShadowImageUrl = createShadowImageUrl;
|
package/dist/uts.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare function resolveUTSAppModule(platform: typeof process.env.UNI_UTS
|
|
|
12
12
|
export declare function resolveUTSModule(id: string, importer: string, includeUTSSDK?: boolean): string | undefined;
|
|
13
13
|
export declare function resolveUTSCompiler(): typeof UTSCompiler;
|
|
14
14
|
export declare function isUTSComponent(name: string): boolean;
|
|
15
|
+
export declare function getUTSComponentAutoImports(): Record<string, [[string]]>;
|
|
15
16
|
export declare function parseUTSComponent(name: string, type: 'kotlin' | 'swift'): {
|
|
16
17
|
className: string;
|
|
17
18
|
namespace: string;
|
package/dist/uts.js
CHANGED
|
@@ -3,7 +3,7 @@ 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.resolveUniTypeScript = exports.parseUniExtApiNamespacesJsOnce = exports.parseUniExtApiNamespacesOnce = exports.parseSwiftPackageWithPluginId = exports.parseKotlinPackageWithPluginId = exports.initUTSComponents = exports.parseUTSComponent = exports.isUTSComponent = exports.resolveUTSCompiler = exports.resolveUTSModule = exports.resolveUTSAppModule = void 0;
|
|
6
|
+
exports.resolveUniTypeScript = exports.parseUniExtApiNamespacesJsOnce = exports.parseUniExtApiNamespacesOnce = exports.parseSwiftPackageWithPluginId = exports.parseKotlinPackageWithPluginId = exports.initUTSComponents = exports.parseUTSComponent = exports.getUTSComponentAutoImports = exports.isUTSComponent = exports.resolveUTSCompiler = exports.resolveUTSModule = exports.resolveUTSAppModule = void 0;
|
|
7
7
|
// 重要,该文件编译后的 js 需要同步到 vue2 编译器 uni-cli-shared/lib/uts
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
@@ -47,10 +47,11 @@ function resolveUTSAppModule(platform, id, importer, includeUTSSDK = true) {
|
|
|
47
47
|
if (fs_1.default.existsSync(path_1.default.resolve(id, basedir, 'index.uts'))) {
|
|
48
48
|
return id;
|
|
49
49
|
}
|
|
50
|
+
const fileName = id.split('?')[0];
|
|
50
51
|
const resolvePlatformDir = (p) => {
|
|
51
|
-
return path_1.default.resolve(
|
|
52
|
+
return path_1.default.resolve(fileName, basedir, p);
|
|
52
53
|
};
|
|
53
|
-
const extname = ['.uts'];
|
|
54
|
+
const extname = ['.uts', '.vue', '.uvue'];
|
|
54
55
|
if (platform === 'app-harmony') {
|
|
55
56
|
if (resolveUTSFile(resolvePlatformDir(platform), extname)) {
|
|
56
57
|
return id;
|
|
@@ -145,6 +146,22 @@ function isUTSComponent(name) {
|
|
|
145
146
|
return utsComponents.has(name);
|
|
146
147
|
}
|
|
147
148
|
exports.isUTSComponent = isUTSComponent;
|
|
149
|
+
function getUTSComponentAutoImports() {
|
|
150
|
+
const utsComponentAutoImports = {};
|
|
151
|
+
utsComponents.forEach(({ kotlinPackage }, name) => {
|
|
152
|
+
const className = (0, utils_1.capitalize)((0, utils_1.camelize)(name)) + 'Element';
|
|
153
|
+
if (!utsComponentAutoImports[kotlinPackage]) {
|
|
154
|
+
utsComponentAutoImports[kotlinPackage] = [[className]];
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
if (!utsComponentAutoImports[kotlinPackage].find((item) => item[0] === className)) {
|
|
158
|
+
utsComponentAutoImports[kotlinPackage].push([className]);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
return utsComponentAutoImports;
|
|
163
|
+
}
|
|
164
|
+
exports.getUTSComponentAutoImports = getUTSComponentAutoImports;
|
|
148
165
|
function parseUTSComponent(name, type) {
|
|
149
166
|
const meta = utsComponents.get(name);
|
|
150
167
|
if (meta) {
|
|
@@ -184,9 +201,12 @@ function initUTSComponents(inputDir, platform) {
|
|
|
184
201
|
}
|
|
185
202
|
}
|
|
186
203
|
if (name) {
|
|
187
|
-
const
|
|
204
|
+
const source = '@/' +
|
|
205
|
+
(0, utils_1.normalizePath)(isApp
|
|
206
|
+
? path_1.default.relative(inputDir, is_uni_modules_utssdk ? path_1.default.dirname(dir) : dir)
|
|
207
|
+
: path_1.default.relative(inputDir, file));
|
|
188
208
|
easycomsObj[`^${name}$`] = {
|
|
189
|
-
source: isApp ? `${
|
|
209
|
+
source: isApp ? `${source}?uts-proxy` : source,
|
|
190
210
|
kotlinPackage: parseKotlinPackageWithPluginId(pluginId, is_uni_modules_utssdk),
|
|
191
211
|
swiftModule: parseSwiftPackageWithPluginId(pluginId, is_uni_modules_utssdk),
|
|
192
212
|
};
|
|
@@ -6,6 +6,5 @@ export type UniViteCopyPluginTarget = Omit<FileWatcherOptions, 'verbose'> & {
|
|
|
6
6
|
};
|
|
7
7
|
export interface UniViteCopyPluginOptions {
|
|
8
8
|
targets: UniViteCopyPluginTarget[];
|
|
9
|
-
verbose: boolean;
|
|
10
9
|
}
|
|
11
|
-
export declare function uniViteCopyPlugin({ targets,
|
|
10
|
+
export declare function uniViteCopyPlugin({ targets, }: UniViteCopyPluginOptions): Plugin;
|
|
@@ -5,7 +5,7 @@ const watcher_1 = require("../../watcher");
|
|
|
5
5
|
const messages_1 = require("../../messages");
|
|
6
6
|
const logs_1 = require("../../logs");
|
|
7
7
|
const uni_shared_1 = require("@dcloudio/uni-shared");
|
|
8
|
-
function uniViteCopyPlugin({ targets,
|
|
8
|
+
function uniViteCopyPlugin({ targets, }) {
|
|
9
9
|
let resolvedConfig;
|
|
10
10
|
let initialized = false;
|
|
11
11
|
return {
|
|
@@ -31,7 +31,6 @@ function uniViteCopyPlugin({ targets, verbose, }) {
|
|
|
31
31
|
(0, logs_1.output)('log', messages_1.M['dev.watching.end']);
|
|
32
32
|
}, 100, { setTimeout, clearTimeout });
|
|
33
33
|
new watcher_1.FileWatcher({
|
|
34
|
-
verbose,
|
|
35
34
|
...target,
|
|
36
35
|
}).watch({
|
|
37
36
|
cwd: process.env.UNI_INPUT_DIR,
|
|
@@ -9,6 +9,7 @@ export * from './uts/uni_modules';
|
|
|
9
9
|
export * from './uts/uvue';
|
|
10
10
|
export * from './uts/ext-api';
|
|
11
11
|
export * from './easycom';
|
|
12
|
+
export * from './json';
|
|
12
13
|
export { uniViteSfcSrcImportPlugin } from './sfc';
|
|
13
14
|
export { assetPlugin, parseAssets, getAssetHash } from './vitejs/plugins/asset';
|
|
14
15
|
export { isCSSRequest, cssPlugin, cssPostPlugin, minifyCSS, cssLangRE, commonjsProxyRE, rewriteScssReadFileSync, } from './vitejs/plugins/css';
|
|
@@ -26,6 +26,7 @@ __exportStar(require("./uts/uni_modules"), exports);
|
|
|
26
26
|
__exportStar(require("./uts/uvue"), exports);
|
|
27
27
|
__exportStar(require("./uts/ext-api"), exports);
|
|
28
28
|
__exportStar(require("./easycom"), exports);
|
|
29
|
+
__exportStar(require("./json"), exports);
|
|
29
30
|
var sfc_1 = require("./sfc");
|
|
30
31
|
Object.defineProperty(exports, "uniViteSfcSrcImportPlugin", { enumerable: true, get: function () { return sfc_1.uniViteSfcSrcImportPlugin; } });
|
|
31
32
|
var asset_1 = require("./vitejs/plugins/asset");
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.uniJsonPlugin = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const json_1 = require("../../json");
|
|
9
|
+
const preprocess_1 = require("../../preprocess");
|
|
10
|
+
const utils_1 = require("../utils");
|
|
11
|
+
function uniJsonPlugin() {
|
|
12
|
+
return {
|
|
13
|
+
name: 'uni:json',
|
|
14
|
+
enforce: 'pre',
|
|
15
|
+
transform(code, id) {
|
|
16
|
+
if (path_1.default.extname((0, utils_1.parseVueRequest)(id).filename) !== '.json') {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
code: JSON.stringify((0, json_1.parseJson)((0, preprocess_1.preJson)(code)), null, 2),
|
|
21
|
+
map: null,
|
|
22
|
+
};
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
exports.uniJsonPlugin = uniJsonPlugin;
|
package/dist/vite/utils/url.d.ts
CHANGED
package/dist/watcher.d.ts
CHANGED
|
@@ -5,16 +5,14 @@ export interface FileWatcherOptions {
|
|
|
5
5
|
src: string | string[];
|
|
6
6
|
dest: string;
|
|
7
7
|
transform?: FileTransform;
|
|
8
|
-
verbose?: boolean;
|
|
9
8
|
}
|
|
10
9
|
export declare class FileWatcher {
|
|
11
10
|
private src;
|
|
12
11
|
private dest;
|
|
13
12
|
private transform?;
|
|
14
|
-
private verbose?;
|
|
15
13
|
private watcher;
|
|
16
14
|
private onChange?;
|
|
17
|
-
constructor({ src, dest, transform
|
|
15
|
+
constructor({ src, dest, transform }: FileWatcherOptions);
|
|
18
16
|
watch(watchOptions: WatchOptions & {
|
|
19
17
|
cwd: string;
|
|
20
18
|
}, onReady?: (watcher: FSWatcher) => void, onChange?: () => void): FSWatcher;
|
package/dist/watcher.js
CHANGED
|
@@ -6,15 +6,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.FileWatcher = void 0;
|
|
7
7
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const debug_1 = __importDefault(require("debug"));
|
|
9
10
|
const chokidar_1 = require("chokidar");
|
|
10
11
|
const shared_1 = require("@vue/shared");
|
|
11
12
|
const utils_1 = require("./utils");
|
|
13
|
+
const debugWatcher = (0, debug_1.default)('uni:watcher');
|
|
12
14
|
class FileWatcher {
|
|
13
|
-
constructor({ src, dest, transform
|
|
15
|
+
constructor({ src, dest, transform }) {
|
|
14
16
|
this.src = !(0, shared_1.isArray)(src) ? [src] : src;
|
|
15
17
|
this.dest = dest;
|
|
16
18
|
this.transform = transform;
|
|
17
|
-
this.verbose = verbose;
|
|
18
19
|
}
|
|
19
20
|
watch(watchOptions, onReady, onChange) {
|
|
20
21
|
if (!this.watcher) {
|
|
@@ -84,7 +85,7 @@ class FileWatcher {
|
|
|
84
85
|
.then(() => this.onChange && this.onChange());
|
|
85
86
|
}
|
|
86
87
|
info(type, msg) {
|
|
87
|
-
|
|
88
|
+
debugWatcher.enabled && debugWatcher(type, msg);
|
|
88
89
|
}
|
|
89
90
|
from(from) {
|
|
90
91
|
return path_1.default.join(this.watcher.options.cwd, from);
|
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-4020520240719001",
|
|
4
4
|
"description": "@dcloudio/uni-cli-shared",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"@babel/core": "^7.23.3",
|
|
27
27
|
"@babel/parser": "^7.23.9",
|
|
28
28
|
"@babel/types": "^7.20.7",
|
|
29
|
-
"@dcloudio/uni-i18n": "3.0.0-alpha-
|
|
30
|
-
"@dcloudio/uni-shared": "3.0.0-alpha-
|
|
29
|
+
"@dcloudio/uni-i18n": "3.0.0-alpha-4020520240719001",
|
|
30
|
+
"@dcloudio/uni-shared": "3.0.0-alpha-4020520240719001",
|
|
31
31
|
"@intlify/core-base": "9.1.9",
|
|
32
32
|
"@intlify/shared": "9.1.9",
|
|
33
33
|
"@intlify/vue-devtools": "9.1.9",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
},
|
|
72
72
|
"gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@dcloudio/uni-uts-v1": "3.0.0-alpha-
|
|
74
|
+
"@dcloudio/uni-uts-v1": "3.0.0-alpha-4020520240719001",
|
|
75
75
|
"@types/adm-zip": "^0.5.5",
|
|
76
76
|
"@types/babel__code-frame": "^7.0.6",
|
|
77
77
|
"@types/babel__core": "^7.1.19",
|