@dcloudio/uni-cli-shared 3.0.0-alpha-4000420240315001 → 3.0.0-alpha-4000620240320001
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/deps.d.ts +2 -0
- package/dist/deps.js +3 -0
- package/dist/easycom.js +3 -2
- package/dist/hbx/alias.js +20 -3
- package/dist/hbx/log.js +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -1
- package/dist/json/app/pages/code.d.ts +1 -1
- package/dist/json/mp/index.d.ts +1 -1
- package/dist/json/mp/project.js +2 -2
- package/dist/json/mp/types.d.ts +1 -1
- package/dist/json/uni-x/uniConfig.js +4 -0
- package/dist/mp/tags.js +5 -5
- package/dist/uni_modules.d.ts +20 -0
- package/dist/uni_modules.js +71 -12
- package/dist/utils.d.ts +0 -2
- package/dist/utils.js +7 -7
- package/dist/uts.d.ts +1 -3
- package/dist/uts.js +23 -44
- package/dist/utsUtils.d.ts +2 -0
- package/dist/utsUtils.js +44 -0
- package/dist/vite/features.js +27 -27
- package/dist/vite/index.d.ts +1 -0
- package/dist/vite/plugins/inject.js +2 -2
- package/dist/vite/plugins/uts/ext-api.d.ts +2 -1
- package/dist/vite/plugins/uts/ext-api.js +4 -5
- package/dist/vite/plugins/uts/uni_modules.js +11 -2
- package/dist/vite/plugins/vitejs/plugins/asset.js +1 -1
- package/dist/vite/plugins/vitejs/plugins/css.js +10 -1
- package/dist/vite/utils/ast.js +7 -6
- package/dist/vue/index.d.ts +1 -0
- package/dist/vue/index.js +3 -1
- package/dist/vue/parse.js +8 -7
- package/dist/vue/polyfill.d.ts +3 -0
- package/dist/vue/polyfill.js +24 -0
- package/dist/vue/transforms/index.d.ts +1 -0
- package/dist/vue/transforms/index.js +1 -0
- package/dist/vue/transforms/templateTransformAssetUrl.js +8 -8
- package/dist/vue/transforms/templateTransformSrcset.js +7 -7
- package/dist/vue/transforms/transformComponent.js +7 -3
- package/dist/vue/transforms/transformRef.js +1 -1
- package/dist/vue/transforms/transformRefresherSlot.d.ts +8 -0
- package/dist/vue/transforms/transformRefresherSlot.js +58 -0
- package/dist/vue/transforms/transformUTSComponent.js +2 -2
- package/dist/vue/transforms/vOn.js +4 -4
- package/dist/vue/utils.d.ts +4 -1
- package/dist/vue/utils.js +47 -8
- package/package.json +16 -16
package/dist/deps.d.ts
CHANGED
package/dist/deps.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.COMPONENT_DEPS_CSS = exports.API_DEPS_CSS = void 0;
|
|
4
4
|
const constants_1 = require("./constants");
|
|
5
5
|
const RESIZE_SENSOR_CSS = constants_1.BASE_COMPONENTS_STYLE_PATH + 'resize-sensor.css';
|
|
6
|
+
const REFRESHER_CSS = constants_1.BASE_COMPONENTS_STYLE_PATH + 'refresher.css';
|
|
6
7
|
exports.API_DEPS_CSS = {
|
|
7
8
|
showModal: [`${constants_1.H5_API_STYLE_PATH}modal.css`],
|
|
8
9
|
showToast: [`${constants_1.H5_API_STYLE_PATH}toast.css`],
|
|
@@ -36,4 +37,6 @@ exports.COMPONENT_DEPS_CSS = {
|
|
|
36
37
|
`${constants_1.BASE_COMPONENTS_STYLE_PATH}picker-view.css`,
|
|
37
38
|
`${constants_1.BASE_COMPONENTS_STYLE_PATH}picker-view-column.css`,
|
|
38
39
|
],
|
|
40
|
+
'scroll-view': [REFRESHER_CSS],
|
|
41
|
+
'list-view': [RESIZE_SENSOR_CSS, REFRESHER_CSS],
|
|
39
42
|
};
|
package/dist/easycom.js
CHANGED
|
@@ -14,6 +14,7 @@ const utils_1 = require("./utils");
|
|
|
14
14
|
const pages_1 = require("./json/pages");
|
|
15
15
|
const messages_1 = require("./messages");
|
|
16
16
|
const uts_1 = require("./uts");
|
|
17
|
+
const utsUtils_1 = require("./utsUtils");
|
|
17
18
|
const debugEasycom = (0, debug_1.default)('uni:easycom');
|
|
18
19
|
const easycoms = [];
|
|
19
20
|
const easycomsCache = new Map();
|
|
@@ -265,8 +266,8 @@ function genUTSComponentPublicInstanceImported(root, fileName) {
|
|
|
265
266
|
fileName = (0, utils_1.normalizePath)(path_1.default.relative(root, fileName));
|
|
266
267
|
}
|
|
267
268
|
if (fileName.startsWith('@/')) {
|
|
268
|
-
return ((0,
|
|
269
|
+
return ((0, utsUtils_1.genUTSClassName)(fileName.replace('@/', '')) + 'ComponentPublicInstance');
|
|
269
270
|
}
|
|
270
|
-
return (0,
|
|
271
|
+
return (0, utsUtils_1.genUTSClassName)(fileName) + 'ComponentPublicInstance';
|
|
271
272
|
}
|
|
272
273
|
exports.genUTSComponentPublicInstanceImported = genUTSComponentPublicInstanceImported;
|
package/dist/hbx/alias.js
CHANGED
|
@@ -34,8 +34,21 @@ function initModuleAlias() {
|
|
|
34
34
|
}
|
|
35
35
|
if ((0, env_1.isInHBuilderX)()) {
|
|
36
36
|
// 又是为了复用 HBuilderX 的插件逻辑,硬编码映射
|
|
37
|
-
Object.keys(hbxPlugins).forEach((
|
|
38
|
-
|
|
37
|
+
Object.keys(hbxPlugins).forEach((lang) => {
|
|
38
|
+
const realPath = path_1.default.resolve(process.env.UNI_HBUILDERX_PLUGINS, hbxPlugins[lang]);
|
|
39
|
+
module_alias_1.default.addAlias(lang,
|
|
40
|
+
// @ts-expect-error
|
|
41
|
+
() => {
|
|
42
|
+
try {
|
|
43
|
+
require.resolve(realPath);
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
const msg = exports.moduleAliasFormatter.format(`Preprocessor dependency "${lang}" not found. Did you install it?`);
|
|
47
|
+
console.error(msg);
|
|
48
|
+
process.exit(0);
|
|
49
|
+
}
|
|
50
|
+
return realPath;
|
|
51
|
+
});
|
|
39
52
|
});
|
|
40
53
|
// web 平台用了 vite 内置 css 插件,该插件会加载预编译器如scss、less等,需要转向到 HBuilderX 的对应编译器插件
|
|
41
54
|
if (process.env.UNI_PLATFORM === 'h5' ||
|
|
@@ -91,7 +104,11 @@ exports.moduleAliasFormatter = {
|
|
|
91
104
|
format(msg) {
|
|
92
105
|
let lang = '';
|
|
93
106
|
let preprocessor = '';
|
|
94
|
-
if (msg.includes(`"
|
|
107
|
+
if (msg.includes(`"pug"`)) {
|
|
108
|
+
lang = 'pug';
|
|
109
|
+
preprocessor = 'compile-pug-cli';
|
|
110
|
+
}
|
|
111
|
+
else if (msg.includes(`"sass"`)) {
|
|
95
112
|
lang = 'sass';
|
|
96
113
|
preprocessor = 'compile-dart-sass';
|
|
97
114
|
}
|
package/dist/hbx/log.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.errorFormatter = exports.removeWarnFormatter = exports.removeInfoFormatt
|
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const picocolors_1 = __importDefault(require("picocolors"));
|
|
10
|
+
const compiler_core_1 = require("@vue/compiler-core");
|
|
10
11
|
const shared_1 = require("@vue/shared");
|
|
11
12
|
const utils_1 = require("../utils");
|
|
12
13
|
const constants_1 = require("../constants");
|
|
@@ -117,7 +118,7 @@ function buildErrorMessage(err, args = [], includeStack = true) {
|
|
|
117
118
|
constants_1.EXTNAME_VUE_RE.test(err.id)) {
|
|
118
119
|
try {
|
|
119
120
|
const ast = (0, ast_1.parseVue)(fs_1.default.readFileSync(err.id, 'utf8'), []);
|
|
120
|
-
const scriptNode = ast.children.find((node) => node.type ===
|
|
121
|
+
const scriptNode = ast.children.find((node) => node.type === compiler_core_1.NodeTypes.ELEMENT && node.tag === 'script');
|
|
121
122
|
if (scriptNode) {
|
|
122
123
|
const scriptLoc = scriptNode.loc;
|
|
123
124
|
args.push(picocolors_1.default.yellow(pad((0, utils_2.generateCodeFrame)(scriptLoc.source, err.loc))));
|
package/dist/index.d.ts
CHANGED
|
@@ -21,7 +21,8 @@ export * from './esbuild';
|
|
|
21
21
|
export * from './resolve';
|
|
22
22
|
export * from './scripts';
|
|
23
23
|
export * from './platform';
|
|
24
|
-
export
|
|
24
|
+
export * from './utsUtils';
|
|
25
|
+
export { parseUniExtApis, parseInjects, Define, DefineOptions, Defines, getUniExtApiProviderRegisters, } from './uni_modules';
|
|
25
26
|
export { M } from './messages';
|
|
26
27
|
export * from './exports';
|
|
27
28
|
export { checkUpdate } from './checkUpdate';
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.checkUpdate = exports.M = exports.parseInjects = exports.parseUniExtApis = void 0;
|
|
17
|
+
exports.checkUpdate = exports.M = exports.getUniExtApiProviderRegisters = exports.parseInjects = exports.parseUniExtApis = void 0;
|
|
18
18
|
__exportStar(require("./fs"), exports);
|
|
19
19
|
__exportStar(require("./mp"), exports);
|
|
20
20
|
__exportStar(require("./url"), exports);
|
|
@@ -38,9 +38,11 @@ __exportStar(require("./esbuild"), exports);
|
|
|
38
38
|
__exportStar(require("./resolve"), exports);
|
|
39
39
|
__exportStar(require("./scripts"), exports);
|
|
40
40
|
__exportStar(require("./platform"), exports);
|
|
41
|
+
__exportStar(require("./utsUtils"), exports);
|
|
41
42
|
var uni_modules_1 = require("./uni_modules");
|
|
42
43
|
Object.defineProperty(exports, "parseUniExtApis", { enumerable: true, get: function () { return uni_modules_1.parseUniExtApis; } });
|
|
43
44
|
Object.defineProperty(exports, "parseInjects", { enumerable: true, get: function () { return uni_modules_1.parseInjects; } });
|
|
45
|
+
Object.defineProperty(exports, "getUniExtApiProviderRegisters", { enumerable: true, get: function () { return uni_modules_1.getUniExtApiProviderRegisters; } });
|
|
44
46
|
var messages_1 = require("./messages");
|
|
45
47
|
Object.defineProperty(exports, "M", { enumerable: true, get: function () { return messages_1.M; } });
|
|
46
48
|
__exportStar(require("./exports"), exports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const arrayBufferCode = "\nif (typeof uni !== 'undefined' && uni && uni.requireGlobal) {\n const global = uni.requireGlobal()\n ArrayBuffer = global.ArrayBuffer\n Int8Array = global.Int8Array\n Uint8Array = global.Uint8Array\n Uint8ClampedArray = global.Uint8ClampedArray\n Int16Array = global.Int16Array\n Uint16Array = global.Uint16Array\n Int32Array = global.Int32Array\n Uint32Array = global.Uint32Array\n Float32Array = global.Float32Array\n Float64Array = global.Float64Array\n BigInt64Array = global.BigInt64Array\n BigUint64Array = global.BigUint64Array\n};\n";
|
|
2
|
-
export declare const polyfillCode
|
|
2
|
+
export declare const polyfillCode = "\nif (typeof Promise !== 'undefined' && !Promise.prototype.finally) {\n Promise.prototype.finally = function(callback) {\n const promise = this.constructor\n return this.then(\n value => promise.resolve(callback()).then(() => value),\n reason => promise.resolve(callback()).then(() => {\n throw reason\n })\n )\n }\n};\n\nif (typeof uni !== 'undefined' && uni && uni.requireGlobal) {\n const global = uni.requireGlobal()\n ArrayBuffer = global.ArrayBuffer\n Int8Array = global.Int8Array\n Uint8Array = global.Uint8Array\n Uint8ClampedArray = global.Uint8ClampedArray\n Int16Array = global.Int16Array\n Uint16Array = global.Uint16Array\n Int32Array = global.Int32Array\n Uint32Array = global.Uint32Array\n Float32Array = global.Float32Array\n Float64Array = global.Float64Array\n BigInt64Array = global.BigInt64Array\n BigUint64Array = global.BigUint64Array\n};\n\n";
|
|
3
3
|
export declare const restoreGlobalCode = "\nif(uni.restoreGlobal){\n uni.restoreGlobal(Vue,weex,plus,setTimeout,clearTimeout,setInterval,clearInterval)\n}\n";
|
|
4
4
|
export declare const globalCode: string;
|
package/dist/json/mp/index.d.ts
CHANGED
package/dist/json/mp/project.js
CHANGED
|
@@ -83,8 +83,8 @@ function parseMiniProgramCondition(pagesJson) {
|
|
|
83
83
|
list: [
|
|
84
84
|
{
|
|
85
85
|
id: 0,
|
|
86
|
-
name: launchPagePath,
|
|
87
|
-
pathName: launchPagePath,
|
|
86
|
+
name: launchPagePath, // 模式名称
|
|
87
|
+
pathName: launchPagePath, // 启动页面,必选
|
|
88
88
|
query: process.env.UNI_CLI_LAUNCH_PAGE_QUERY || '', // 启动参数,在页面的onLoad函数里面得到。
|
|
89
89
|
},
|
|
90
90
|
],
|
package/dist/json/mp/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export interface ComponentJson {
|
|
|
2
2
|
component: true;
|
|
3
3
|
usingComponents?: UsingComponents;
|
|
4
4
|
usingSwanComponents?: UsingComponents;
|
|
5
|
-
styleIsolation?: 'apply-shared' | 'shared';
|
|
5
|
+
styleIsolation?: 'apply-shared' | 'shared' | 'isolated';
|
|
6
6
|
}
|
|
7
7
|
interface ShareWindowOptions {
|
|
8
8
|
navigationBarBackgroundColor?: string;
|
|
@@ -12,6 +12,10 @@ function normalizeAppXUniConfig(pagesJson, manifestJson) {
|
|
|
12
12
|
tabBar: pagesJson.tabBar,
|
|
13
13
|
fallbackLocale: manifestJson.fallbackLocale,
|
|
14
14
|
};
|
|
15
|
+
if (config.realEntryPagePath) {
|
|
16
|
+
config.conditionUrl = config.entryPagePath;
|
|
17
|
+
config.entryPagePath = config.realEntryPagePath;
|
|
18
|
+
}
|
|
15
19
|
// TODO 待支持分包
|
|
16
20
|
return JSON.stringify(config);
|
|
17
21
|
}
|
package/dist/mp/tags.js
CHANGED
|
@@ -103,12 +103,12 @@ exports.HTML_TO_MINI_PROGRAM_TAGS = {
|
|
|
103
103
|
dialog: 'view',
|
|
104
104
|
summary: 'view',
|
|
105
105
|
// progress: 'progress',
|
|
106
|
-
meter: 'progress',
|
|
107
|
-
head: 'view',
|
|
108
|
-
meta: 'view',
|
|
109
|
-
base: 'text',
|
|
106
|
+
meter: 'progress', // todo
|
|
107
|
+
head: 'view', // todo
|
|
108
|
+
meta: 'view', // todo
|
|
109
|
+
base: 'text', // todo
|
|
110
110
|
// 'map': 'image', // TODO不是很恰当
|
|
111
|
-
area: 'navigator',
|
|
111
|
+
area: 'navigator', // j结合map使用
|
|
112
112
|
script: 'view',
|
|
113
113
|
noscript: 'view',
|
|
114
114
|
embed: 'view',
|
package/dist/uni_modules.d.ts
CHANGED
|
@@ -21,6 +21,11 @@ export declare function getUniExtApiProviders(): {
|
|
|
21
21
|
name?: string | undefined;
|
|
22
22
|
servicePlugin?: string | undefined;
|
|
23
23
|
}[];
|
|
24
|
+
export declare function getUniExtApiProviderRegisters(): {
|
|
25
|
+
name: string;
|
|
26
|
+
service: string;
|
|
27
|
+
class: string;
|
|
28
|
+
}[];
|
|
24
29
|
export declare function parseUniExtApis(vite: boolean | undefined, platform: typeof process.env.UNI_UTS_PLATFORM, language?: UTSTargetLanguage): Injects;
|
|
25
30
|
export type Injects = {
|
|
26
31
|
[name: string]: string | [string, string] | [string, string, DefineOptions['app']] | false;
|
|
@@ -47,3 +52,18 @@ export type Injects = {
|
|
|
47
52
|
* @returns
|
|
48
53
|
*/
|
|
49
54
|
export declare function parseInjects(vite: boolean | undefined, platform: typeof process.env.UNI_UTS_PLATFORM, language: UTSTargetLanguage, source: string, uniModuleRootDir: string, exports?: Exports): Injects;
|
|
55
|
+
/**
|
|
56
|
+
* @private
|
|
57
|
+
*/
|
|
58
|
+
export declare const camelize: (str: string) => string;
|
|
59
|
+
/**
|
|
60
|
+
* @private
|
|
61
|
+
*/
|
|
62
|
+
export declare const capitalize: (str: string) => string;
|
|
63
|
+
/**
|
|
64
|
+
* 解析 UTS 类型的模块依赖列表
|
|
65
|
+
* @param deps
|
|
66
|
+
* @param inputDir
|
|
67
|
+
* @returns
|
|
68
|
+
*/
|
|
69
|
+
export declare function parseUTSModuleDeps(deps: string[], inputDir: string): string[];
|
package/dist/uni_modules.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.parseInjects = exports.parseUniExtApis = exports.getUniExtApiProviders = void 0;
|
|
6
|
+
exports.parseUTSModuleDeps = exports.capitalize = exports.camelize = exports.parseInjects = exports.parseUniExtApis = exports.getUniExtApiProviderRegisters = exports.getUniExtApiProviders = void 0;
|
|
7
7
|
// 重要:此文件编译后的js,需同步至 vue2 编译器中 uni-cli-shared/lib/uts/uni_modules.js
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
@@ -12,6 +12,24 @@ function getUniExtApiProviders() {
|
|
|
12
12
|
return extApiProviders;
|
|
13
13
|
}
|
|
14
14
|
exports.getUniExtApiProviders = getUniExtApiProviders;
|
|
15
|
+
function getUniExtApiProviderRegisters() {
|
|
16
|
+
const result = [];
|
|
17
|
+
extApiProviders.forEach((provider) => {
|
|
18
|
+
if (provider.name && provider.service) {
|
|
19
|
+
result.push({
|
|
20
|
+
name: provider.name,
|
|
21
|
+
service: provider.service,
|
|
22
|
+
class: `uts.sdk.modules.${(0, exports.camelize)(provider.plugin)}.${(0, exports.capitalize)((0, exports.camelize)('uni-ext-api-' +
|
|
23
|
+
provider.service +
|
|
24
|
+
'-' +
|
|
25
|
+
provider.name +
|
|
26
|
+
'-provider'))}`,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
return result;
|
|
31
|
+
}
|
|
32
|
+
exports.getUniExtApiProviderRegisters = getUniExtApiProviderRegisters;
|
|
15
33
|
function parseUniExtApis(vite = true, platform, language = 'javascript') {
|
|
16
34
|
if (!process.env.UNI_INPUT_DIR) {
|
|
17
35
|
return {};
|
|
@@ -109,6 +127,11 @@ function parseInjects(vite = true, platform, language, source, uniModuleRootDir,
|
|
|
109
127
|
source = `${source}/utssdk/index.uts`;
|
|
110
128
|
}
|
|
111
129
|
}
|
|
130
|
+
else if (process.env.UNI_APP_X_UVUE_SCRIPT_ENGINE === 'js') {
|
|
131
|
+
if (fs_extra_1.default.existsSync(path_1.default.resolve(uniModuleRootDir, 'utssdk', 'app-js', 'index.uts'))) {
|
|
132
|
+
source = `${source}/utssdk/app-js/index.uts`;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
112
135
|
for (const key in rootDefines) {
|
|
113
136
|
Object.assign(injects, parseInject(vite, platform, language, source, 'uni', rootDefines[key], hasPlatformFile));
|
|
114
137
|
}
|
|
@@ -157,19 +180,24 @@ function parseInject(vite = true, platform, language, source, globalObject, defi
|
|
|
157
180
|
if (p === 'app') {
|
|
158
181
|
const appOptions = defineOptions.app;
|
|
159
182
|
if (isPlainObject(appOptions)) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
183
|
+
// js engine 下且存在 app-js,不检查
|
|
184
|
+
const skipCheck = process.env.UNI_APP_X_UVUE_SCRIPT_ENGINE === 'js' &&
|
|
185
|
+
source.includes('app-js');
|
|
186
|
+
if (!skipCheck) {
|
|
187
|
+
if (language === 'javascript') {
|
|
188
|
+
if (appOptions.js === false) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
163
191
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
192
|
+
else if (language === 'kotlin') {
|
|
193
|
+
if (appOptions.kotlin === false) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
168
196
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
197
|
+
else if (language === 'swift') {
|
|
198
|
+
if (appOptions.swift === false) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
173
201
|
}
|
|
174
202
|
}
|
|
175
203
|
}
|
|
@@ -197,3 +225,34 @@ const toTypeString = (value) => objectToString.call(value);
|
|
|
197
225
|
function isPlainObject(val) {
|
|
198
226
|
return toTypeString(val) === '[object Object]';
|
|
199
227
|
}
|
|
228
|
+
const cacheStringFunction = (fn) => {
|
|
229
|
+
const cache = Object.create(null);
|
|
230
|
+
return ((str) => {
|
|
231
|
+
const hit = cache[str];
|
|
232
|
+
return hit || (cache[str] = fn(str));
|
|
233
|
+
});
|
|
234
|
+
};
|
|
235
|
+
const camelizeRE = /-(\w)/g;
|
|
236
|
+
/**
|
|
237
|
+
* @private
|
|
238
|
+
*/
|
|
239
|
+
exports.camelize = cacheStringFunction((str) => {
|
|
240
|
+
return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : ''));
|
|
241
|
+
});
|
|
242
|
+
/**
|
|
243
|
+
* @private
|
|
244
|
+
*/
|
|
245
|
+
exports.capitalize = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
|
|
246
|
+
/**
|
|
247
|
+
* 解析 UTS 类型的模块依赖列表
|
|
248
|
+
* @param deps
|
|
249
|
+
* @param inputDir
|
|
250
|
+
* @returns
|
|
251
|
+
*/
|
|
252
|
+
function parseUTSModuleDeps(deps, inputDir) {
|
|
253
|
+
const modulesDir = path_1.default.resolve(inputDir, 'uni_modules');
|
|
254
|
+
return deps.filter((dep) => {
|
|
255
|
+
return fs_extra_1.default.existsSync(path_1.default.resolve(modulesDir, dep, 'utssdk'));
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
exports.parseUTSModuleDeps = parseUTSModuleDeps;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
export { default as hash } from 'hash-sum';
|
|
2
2
|
import { ElementNode, RootNode, TemplateChildNode } from '@vue/compiler-core';
|
|
3
3
|
import { ParserPlugin } from '@babel/parser';
|
|
4
|
-
export declare const version: any;
|
|
5
4
|
export { camelize, capitalize, isArray } from '@vue/shared';
|
|
6
|
-
export declare let isRunningWithYarnPnp: boolean;
|
|
7
5
|
export declare const isWindows: boolean;
|
|
8
6
|
export declare function normalizePath(id: string): string;
|
|
9
7
|
export declare function checkElementNodeTag(node: RootNode | TemplateChildNode | null | undefined, tag: string): node is ElementNode;
|
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.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.
|
|
6
|
+
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"));
|
|
@@ -12,25 +12,25 @@ const shared_1 = require("@vue/shared");
|
|
|
12
12
|
var hash_sum_1 = require("hash-sum");
|
|
13
13
|
Object.defineProperty(exports, "hash", { enumerable: true, get: function () { return __importDefault(hash_sum_1).default; } });
|
|
14
14
|
const constants_1 = require("./constants");
|
|
15
|
+
const compiler_core_1 = require("@vue/compiler-core");
|
|
15
16
|
const platform_1 = require("./platform");
|
|
16
17
|
const hbx_1 = require("./hbx");
|
|
17
|
-
exports.version = require('../package.json').version;
|
|
18
18
|
// 专为 uts.ts 服务
|
|
19
19
|
var shared_2 = require("@vue/shared");
|
|
20
20
|
Object.defineProperty(exports, "camelize", { enumerable: true, get: function () { return shared_2.camelize; } });
|
|
21
21
|
Object.defineProperty(exports, "capitalize", { enumerable: true, get: function () { return shared_2.capitalize; } });
|
|
22
22
|
Object.defineProperty(exports, "isArray", { enumerable: true, get: function () { return shared_2.isArray; } });
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
catch {
|
|
23
|
+
// export let isRunningWithYarnPnp: boolean
|
|
24
|
+
// try {
|
|
25
|
+
// isRunningWithYarnPnp = Boolean(require('pnpapi'))
|
|
26
|
+
// } catch {}
|
|
27
27
|
exports.isWindows = os_1.default.platform() === 'win32';
|
|
28
28
|
function normalizePath(id) {
|
|
29
29
|
return exports.isWindows ? id.replace(/\\/g, '/') : id;
|
|
30
30
|
}
|
|
31
31
|
exports.normalizePath = normalizePath;
|
|
32
32
|
function checkElementNodeTag(node, tag) {
|
|
33
|
-
return !!node && node.type ===
|
|
33
|
+
return !!node && node.type === compiler_core_1.NodeTypes.ELEMENT && node.tag === tag;
|
|
34
34
|
}
|
|
35
35
|
exports.checkElementNodeTag = checkElementNodeTag;
|
|
36
36
|
function normalizeIdentifier(str) {
|
package/dist/uts.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import * as UTSCompiler from '@dcloudio/uni-uts-v1';
|
|
4
|
-
import {
|
|
4
|
+
import type { EasycomMatcher } from './easycom';
|
|
5
5
|
/**
|
|
6
6
|
* 解析 app 平台的 uts 插件,任意平台(android|ios)存在即可
|
|
7
7
|
* @param id
|
|
@@ -23,5 +23,3 @@ export declare function parseSwiftPackageWithPluginId(id: string, is_uni_modules
|
|
|
23
23
|
export type UTSTargetLanguage = typeof process.env.UNI_UTS_TARGET_LANGUAGE;
|
|
24
24
|
export declare const parseUniExtApiNamespacesOnce: (platform: typeof process.env.UNI_UTS_PLATFORM, language: UTSTargetLanguage) => Record<string, [string, string]>;
|
|
25
25
|
export declare const parseUniExtApiNamespacesJsOnce: (platform: typeof process.env.UNI_UTS_PLATFORM, language: UTSTargetLanguage) => Record<string, [string, string]>;
|
|
26
|
-
export declare function matchUTSComponent(tag: string): boolean;
|
|
27
|
-
export declare function genUTSClassName(fileName: string, prefix?: string): string;
|
package/dist/uts.js
CHANGED
|
@@ -3,15 +3,14 @@ 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.
|
|
6
|
+
exports.parseUniExtApiNamespacesJsOnce = exports.parseUniExtApiNamespacesOnce = exports.parseSwiftPackageWithPluginId = exports.parseKotlinPackageWithPluginId = exports.initUTSComponents = exports.parseUTSComponent = exports.isUTSComponent = exports.resolveUTSCompiler = exports.resolveUTSModule = exports.resolveUTSAppModule = void 0;
|
|
7
|
+
// 重要,该文件编译后的 js 需要同步到 vue2 编译器 uni-cli-shared/lib/uts
|
|
7
8
|
const fs_1 = __importDefault(require("fs"));
|
|
8
9
|
const path_1 = __importDefault(require("path"));
|
|
9
10
|
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
10
11
|
const hbx_1 = require("./hbx");
|
|
11
12
|
const utils_1 = require("./utils");
|
|
12
|
-
const easycom_1 = require("./easycom");
|
|
13
13
|
const uni_modules_1 = require("./uni_modules");
|
|
14
|
-
// 重要,该文件编译后的 js 需要同步到 vue2 编译器 uni-cli-shared/lib/uts
|
|
15
14
|
function once(fn, ctx = null) {
|
|
16
15
|
let res;
|
|
17
16
|
return ((...args) => {
|
|
@@ -36,6 +35,15 @@ function resolveUTSAppModule(id, importer, includeUTSSDK = true) {
|
|
|
36
35
|
if (parentDir === 'uni_modules' ||
|
|
37
36
|
(includeUTSSDK && parentDir === 'utssdk')) {
|
|
38
37
|
const basedir = parentDir === 'uni_modules' ? 'utssdk' : '';
|
|
38
|
+
if (process.env.UNI_APP_X_UVUE_SCRIPT_ENGINE === 'js') {
|
|
39
|
+
// js engine
|
|
40
|
+
if (parentDir === 'uni_modules') {
|
|
41
|
+
const appJsIndex = path_1.default.resolve(id, basedir, 'app-js', 'index.uts');
|
|
42
|
+
if (fs_1.default.existsSync(appJsIndex)) {
|
|
43
|
+
return appJsIndex;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
39
47
|
if (fs_1.default.existsSync(path_1.default.resolve(id, basedir, 'index.uts'))) {
|
|
40
48
|
return id;
|
|
41
49
|
}
|
|
@@ -104,8 +112,18 @@ function resolveUTSCompiler() {
|
|
|
104
112
|
});
|
|
105
113
|
}
|
|
106
114
|
catch (e) {
|
|
107
|
-
let utsCompilerVersion =
|
|
108
|
-
|
|
115
|
+
let utsCompilerVersion = '';
|
|
116
|
+
try {
|
|
117
|
+
utsCompilerVersion = require('../package.json').version;
|
|
118
|
+
}
|
|
119
|
+
catch (e) {
|
|
120
|
+
try {
|
|
121
|
+
// vue2
|
|
122
|
+
utsCompilerVersion = require('../../package.json').version;
|
|
123
|
+
}
|
|
124
|
+
catch (e) { }
|
|
125
|
+
}
|
|
126
|
+
if (utsCompilerVersion.startsWith('2.0.')) {
|
|
109
127
|
utsCompilerVersion = '^3.0.0-alpha-3060920221117001';
|
|
110
128
|
}
|
|
111
129
|
console.error((0, utils_1.installDepTips)('devDependencies', '@dcloudio/uni-uts-v1', utsCompilerVersion));
|
|
@@ -254,42 +272,3 @@ exports.parseUniExtApiNamespacesJsOnce = once((platform, language) => {
|
|
|
254
272
|
});
|
|
255
273
|
return namespaces;
|
|
256
274
|
});
|
|
257
|
-
function matchUTSComponent(tag) {
|
|
258
|
-
const source = (0, easycom_1.matchEasycom)(tag);
|
|
259
|
-
return !!(source && source.includes('uts-proxy'));
|
|
260
|
-
}
|
|
261
|
-
exports.matchUTSComponent = matchUTSComponent;
|
|
262
|
-
function genUTSClassName(fileName, prefix = 'Gen') {
|
|
263
|
-
return (prefix +
|
|
264
|
-
(0, utils_1.capitalize)((0, utils_1.camelize)(verifySymbol((0, utils_1.removeExt)((0, utils_1.normalizeNodeModules)(fileName)
|
|
265
|
-
.replace(/[\/|_]/g, '-')
|
|
266
|
-
.replace(/-+/g, '-'))))));
|
|
267
|
-
}
|
|
268
|
-
exports.genUTSClassName = genUTSClassName;
|
|
269
|
-
function isValidStart(c) {
|
|
270
|
-
return !!c.match(/^[A-Za-z_-]$/);
|
|
271
|
-
}
|
|
272
|
-
function isValidContinue(c) {
|
|
273
|
-
return !!c.match(/^[A-Za-z0-9_-]$/);
|
|
274
|
-
}
|
|
275
|
-
function verifySymbol(s) {
|
|
276
|
-
const chars = Array.from(s);
|
|
277
|
-
if (isValidStart(chars[0]) && chars.slice(1).every(isValidContinue)) {
|
|
278
|
-
return s;
|
|
279
|
-
}
|
|
280
|
-
const buf = [];
|
|
281
|
-
let hasStart = false;
|
|
282
|
-
for (const c of chars) {
|
|
283
|
-
if (!hasStart && isValidStart(c)) {
|
|
284
|
-
hasStart = true;
|
|
285
|
-
buf.push(c);
|
|
286
|
-
}
|
|
287
|
-
else if (isValidContinue(c)) {
|
|
288
|
-
buf.push(c);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
if (buf.length === 0) {
|
|
292
|
-
buf.push('_');
|
|
293
|
-
}
|
|
294
|
-
return buf.join('');
|
|
295
|
-
}
|
package/dist/utsUtils.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.genUTSClassName = exports.matchUTSComponent = void 0;
|
|
4
|
+
const easycom_1 = require("./easycom");
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
function matchUTSComponent(tag) {
|
|
7
|
+
const source = (0, easycom_1.matchEasycom)(tag);
|
|
8
|
+
return !!(source && source.includes('uts-proxy'));
|
|
9
|
+
}
|
|
10
|
+
exports.matchUTSComponent = matchUTSComponent;
|
|
11
|
+
function genUTSClassName(fileName, prefix = 'Gen') {
|
|
12
|
+
return (prefix +
|
|
13
|
+
(0, utils_1.capitalize)((0, utils_1.camelize)(verifySymbol((0, utils_1.removeExt)((0, utils_1.normalizeNodeModules)(fileName)
|
|
14
|
+
.replace(/[\/|_]/g, '-')
|
|
15
|
+
.replace(/-+/g, '-'))))));
|
|
16
|
+
}
|
|
17
|
+
exports.genUTSClassName = genUTSClassName;
|
|
18
|
+
function isValidStart(c) {
|
|
19
|
+
return !!c.match(/^[A-Za-z_-]$/);
|
|
20
|
+
}
|
|
21
|
+
function isValidContinue(c) {
|
|
22
|
+
return !!c.match(/^[A-Za-z0-9_-]$/);
|
|
23
|
+
}
|
|
24
|
+
function verifySymbol(s) {
|
|
25
|
+
const chars = Array.from(s);
|
|
26
|
+
if (isValidStart(chars[0]) && chars.slice(1).every(isValidContinue)) {
|
|
27
|
+
return s;
|
|
28
|
+
}
|
|
29
|
+
const buf = [];
|
|
30
|
+
let hasStart = false;
|
|
31
|
+
for (const c of chars) {
|
|
32
|
+
if (!hasStart && isValidStart(c)) {
|
|
33
|
+
hasStart = true;
|
|
34
|
+
buf.push(c);
|
|
35
|
+
}
|
|
36
|
+
else if (isValidContinue(c)) {
|
|
37
|
+
buf.push(c);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (buf.length === 0) {
|
|
41
|
+
buf.push('_');
|
|
42
|
+
}
|
|
43
|
+
return buf.join('');
|
|
44
|
+
}
|
package/dist/vite/features.js
CHANGED
|
@@ -146,35 +146,35 @@ function initFeatures(options) {
|
|
|
146
146
|
const { wx, wxs, rpx, nvue, uniCloud, i18nEn, i18nEs, i18nFr, i18nZhHans, i18nZhHant, i18nLocale, vueOptionsApi, vueProdDevTools, pages, tabBar, tabBarMidButton, promise, longpress, routerMode, topWindow, leftWindow, rightWindow, navigationBar, pullDownRefresh, navigationBarButtons, navigationBarSearchInput, navigationBarTransparent, } = (0, shared_1.extend)(initManifestFeature(options), initPagesFeature(options), initProjectFeature(options));
|
|
147
147
|
const features = {
|
|
148
148
|
// vue
|
|
149
|
-
__VUE_OPTIONS_API__: vueOptionsApi,
|
|
150
|
-
__VUE_PROD_DEVTOOLS__: vueProdDevTools,
|
|
149
|
+
__VUE_OPTIONS_API__: vueOptionsApi, // enable/disable Options API support, default: true
|
|
150
|
+
__VUE_PROD_DEVTOOLS__: vueProdDevTools, // enable/disable devtools support in production, default: false
|
|
151
151
|
// uni
|
|
152
|
-
__UNI_FEATURE_WX__: wx,
|
|
153
|
-
__UNI_FEATURE_WXS__: wxs,
|
|
154
|
-
__UNI_FEATURE_RPX__: rpx,
|
|
155
|
-
__UNI_FEATURE_PROMISE__: promise,
|
|
156
|
-
__UNI_FEATURE_LONGPRESS__: longpress,
|
|
157
|
-
__UNI_FEATURE_I18N_EN__: i18nEn,
|
|
158
|
-
__UNI_FEATURE_I18N_ES__: i18nEs,
|
|
159
|
-
__UNI_FEATURE_I18N_FR__: i18nFr,
|
|
160
|
-
__UNI_FEATURE_I18N_ZH_HANS__: i18nZhHans,
|
|
161
|
-
__UNI_FEATURE_I18N_ZH_HANT__: i18nZhHant,
|
|
152
|
+
__UNI_FEATURE_WX__: wx, // 是否启用小程序的组件实例 API,如:selectComponent 等(uni-core/src/service/plugin/appConfig)
|
|
153
|
+
__UNI_FEATURE_WXS__: wxs, // 是否启用 wxs 支持,如:getComponentDescriptor 等(uni-core/src/view/plugin/appConfig)
|
|
154
|
+
__UNI_FEATURE_RPX__: rpx, // 是否启用运行时 rpx 支持
|
|
155
|
+
__UNI_FEATURE_PROMISE__: promise, // 是否启用旧版本的 promise 支持(即返回[err,res]的格式),默认返回标准
|
|
156
|
+
__UNI_FEATURE_LONGPRESS__: longpress, // 是否启用longpress
|
|
157
|
+
__UNI_FEATURE_I18N_EN__: i18nEn, // 是否启用en
|
|
158
|
+
__UNI_FEATURE_I18N_ES__: i18nEs, // 是否启用es
|
|
159
|
+
__UNI_FEATURE_I18N_FR__: i18nFr, // 是否启用fr
|
|
160
|
+
__UNI_FEATURE_I18N_ZH_HANS__: i18nZhHans, // 是否启用zh_Hans
|
|
161
|
+
__UNI_FEATURE_I18N_ZH_HANT__: i18nZhHant, // 是否启用zh_Hant
|
|
162
162
|
// 以下特性,编译器已自动识别是否需要启用
|
|
163
|
-
__UNI_FEATURE_UNI_CLOUD__: uniCloud,
|
|
164
|
-
__UNI_FEATURE_I18N_LOCALE__: i18nLocale,
|
|
165
|
-
__UNI_FEATURE_NVUE__: nvue,
|
|
166
|
-
__UNI_FEATURE_ROUTER_MODE__: routerMode,
|
|
167
|
-
__UNI_FEATURE_PAGES__: pages,
|
|
168
|
-
__UNI_FEATURE_TABBAR__: tabBar,
|
|
169
|
-
__UNI_FEATURE_TABBAR_MIDBUTTON__: tabBarMidButton,
|
|
170
|
-
__UNI_FEATURE_TOPWINDOW__: topWindow,
|
|
171
|
-
__UNI_FEATURE_LEFTWINDOW__: leftWindow,
|
|
172
|
-
__UNI_FEATURE_RIGHTWINDOW__: rightWindow,
|
|
173
|
-
__UNI_FEATURE_RESPONSIVE__: topWindow || leftWindow || rightWindow,
|
|
174
|
-
__UNI_FEATURE_NAVIGATIONBAR__: navigationBar,
|
|
175
|
-
__UNI_FEATURE_PULL_DOWN_REFRESH__: pullDownRefresh,
|
|
176
|
-
__UNI_FEATURE_NAVIGATIONBAR_BUTTONS__: navigationBarButtons,
|
|
177
|
-
__UNI_FEATURE_NAVIGATIONBAR_SEARCHINPUT__: navigationBarSearchInput,
|
|
163
|
+
__UNI_FEATURE_UNI_CLOUD__: uniCloud, // 是否启用uniCloud
|
|
164
|
+
__UNI_FEATURE_I18N_LOCALE__: i18nLocale, // 是否启用i18n
|
|
165
|
+
__UNI_FEATURE_NVUE__: nvue, // 是否启用nvue
|
|
166
|
+
__UNI_FEATURE_ROUTER_MODE__: routerMode, // 路由模式
|
|
167
|
+
__UNI_FEATURE_PAGES__: pages, // 是否多页面
|
|
168
|
+
__UNI_FEATURE_TABBAR__: tabBar, // 是否包含tabBar
|
|
169
|
+
__UNI_FEATURE_TABBAR_MIDBUTTON__: tabBarMidButton, // 是否包含midButton
|
|
170
|
+
__UNI_FEATURE_TOPWINDOW__: topWindow, // 是否包含topWindow
|
|
171
|
+
__UNI_FEATURE_LEFTWINDOW__: leftWindow, // 是否包含leftWindow
|
|
172
|
+
__UNI_FEATURE_RIGHTWINDOW__: rightWindow, // 是否包含rightWindow
|
|
173
|
+
__UNI_FEATURE_RESPONSIVE__: topWindow || leftWindow || rightWindow, // 是否启用响应式
|
|
174
|
+
__UNI_FEATURE_NAVIGATIONBAR__: navigationBar, // 是否启用标题栏
|
|
175
|
+
__UNI_FEATURE_PULL_DOWN_REFRESH__: pullDownRefresh, // 是否启用下拉刷新
|
|
176
|
+
__UNI_FEATURE_NAVIGATIONBAR_BUTTONS__: navigationBarButtons, // 是否启用标题栏按钮
|
|
177
|
+
__UNI_FEATURE_NAVIGATIONBAR_SEARCHINPUT__: navigationBarSearchInput, // 是否启用标题栏搜索框
|
|
178
178
|
__UNI_FEATURE_NAVIGATIONBAR_TRANSPARENT__: navigationBarTransparent, // 是否启用透明标题栏
|
|
179
179
|
};
|
|
180
180
|
// ssr nodejs features
|
package/dist/vite/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ interface UniVitePluginUniOptions {
|
|
|
22
22
|
isCustomElement?: ParserOptions['isCustomElement'];
|
|
23
23
|
directiveTransforms?: CompilerOptions['directiveTransforms'];
|
|
24
24
|
nodeTransforms?: CompilerOptions['nodeTransforms'];
|
|
25
|
+
whitespace?: CompilerOptions['whitespace'];
|
|
25
26
|
};
|
|
26
27
|
jsxOptions?: {
|
|
27
28
|
babelPlugins?: any[];
|