@dcloudio/uni-cli-shared 3.0.0-alpha-4020320240703001 → 3.0.0-alpha-4020520240726001
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/LICENSE +202 -0
- package/dist/easycom.js +2 -9
- package/dist/json/app/manifest/nvue.d.ts +1 -1
- package/dist/json/pages.js +3 -5
- package/dist/json/theme.js +1 -1
- package/dist/platform.js +3 -0
- package/dist/resolve.js +6 -1
- package/dist/uni_modules.js +5 -3
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +34 -5
- package/dist/uts.d.ts +1 -0
- package/dist/uts.js +25 -5
- package/dist/vite/cloud.js +10 -1
- 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/plugins/uts/uni_modules.js +5 -0
- package/dist/vite/utils/url.d.ts +1 -1
- package/dist/watcher.d.ts +1 -3
- package/dist/watcher.js +4 -3
- package/license.md +1 -0
- package/package.json +5 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/dist/easycom.js
CHANGED
|
@@ -115,20 +115,13 @@ function initEasycom({ isX, dirs, rootDir, custom, extensions, }) {
|
|
|
115
115
|
if (path_1.default.isAbsolute(source) && source.startsWith(rootDir)) {
|
|
116
116
|
source = '@/' + (0, utils_1.normalizePath)(path_1.default.relative(rootDir, source));
|
|
117
117
|
}
|
|
118
|
-
let imported = '';
|
|
119
118
|
// 加密插件easycom类型导入
|
|
120
119
|
if (source.includes('?uts-proxy')) {
|
|
121
120
|
const moduleId = path_1.default.basename(source.split('?uts-proxy')[0]);
|
|
122
121
|
source = `uts.sdk.modules.${(0, shared_1.camelize)(moduleId)}`;
|
|
123
|
-
imported = genUTSComponentPublicInstanceImported(rootDir, `@/uni_modules/${moduleId}/components/${tagName}/${tagName}`);
|
|
124
122
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
addUTSEasyComAutoImports(source, [
|
|
129
|
-
imported,
|
|
130
|
-
genUTSComponentPublicInstanceIdent(tagName),
|
|
131
|
-
]);
|
|
123
|
+
const ident = genUTSComponentPublicInstanceIdent(tagName);
|
|
124
|
+
addUTSEasyComAutoImports(source, [ident, ident]);
|
|
132
125
|
});
|
|
133
126
|
}
|
|
134
127
|
(0, shared_1.extend)(easycomsObj, autoEasyComObj);
|
|
@@ -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/json/pages.js
CHANGED
|
@@ -377,14 +377,12 @@ const DEFAULT_TAB_BAR = {
|
|
|
377
377
|
iconWidth: '24px',
|
|
378
378
|
spacing: '3px',
|
|
379
379
|
height: uni_shared_1.TABBAR_HEIGHT + 'px',
|
|
380
|
+
list: [],
|
|
380
381
|
};
|
|
381
382
|
function normalizeTabBar(tabBar, platform) {
|
|
382
|
-
const {
|
|
383
|
-
if (!list || !list.length) {
|
|
384
|
-
return;
|
|
385
|
-
}
|
|
383
|
+
const { midButton } = tabBar;
|
|
386
384
|
tabBar = (0, shared_1.extend)({}, DEFAULT_TAB_BAR, tabBar);
|
|
387
|
-
list.forEach((item) => {
|
|
385
|
+
tabBar.list.forEach((item) => {
|
|
388
386
|
if (item.iconPath) {
|
|
389
387
|
item.iconPath = normalizeFilepath(item.iconPath);
|
|
390
388
|
}
|
package/dist/json/theme.js
CHANGED
|
@@ -47,7 +47,7 @@ const parseThemeJsonIconPath = (themeConfig, curPathThemeJsonKey) => {
|
|
|
47
47
|
function normalizeUniConfigThemeJsonIconPath(themeConfig, pagesJson) {
|
|
48
48
|
// 处理 tabbar 下 list -> item -> iconPath、selectedIconPath; midButton -> backgroundImage 路径 / 不开头的情况
|
|
49
49
|
const tabBar = pagesJson.tabBar;
|
|
50
|
-
if (tabBar) {
|
|
50
|
+
if (tabBar && tabBar.list && tabBar.list.length) {
|
|
51
51
|
tabBar.list.forEach((item) => {
|
|
52
52
|
if (item.iconPath && item.iconPath.indexOf('@') === 0) {
|
|
53
53
|
parseThemeJsonIconPath(themeConfig, item.iconPath.replace(/^@/, ''));
|
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() {
|
|
@@ -287,11 +287,13 @@ function genEncryptEasyComModuleIndex(platform, components) {
|
|
|
287
287
|
Object.keys(components).forEach((component) => {
|
|
288
288
|
const id = (0, exports.capitalize)((0, exports.camelize)(component));
|
|
289
289
|
ids.push(id);
|
|
290
|
+
let instance = '';
|
|
290
291
|
if (platform === 'app-android') {
|
|
292
|
+
instance = (0, easycom_1.genUTSComponentPublicInstanceIdent)(component);
|
|
291
293
|
// 类型
|
|
292
|
-
ids.push(
|
|
294
|
+
ids.push(instance);
|
|
293
295
|
}
|
|
294
|
-
imports.push(`import ${id} from './components/${component}/${component}${components[component]}'`);
|
|
296
|
+
imports.push(`import ${id}${instance ? `, { ${instance} }` : ''} from './components/${component}/${component}${components[component]}'`);
|
|
295
297
|
});
|
|
296
298
|
return `
|
|
297
299
|
${imports.join('\n')}
|
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; } });
|
|
@@ -146,9 +147,11 @@ function isAppVue(filename) {
|
|
|
146
147
|
}
|
|
147
148
|
exports.isAppVue = isAppVue;
|
|
148
149
|
function resolveAppVue(inputDir) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
if (process.env.UNI_APP_X === 'true') {
|
|
151
|
+
const appUVue = path_1.default.resolve(inputDir, 'App.uvue');
|
|
152
|
+
if (fs_1.default.existsSync(appUVue)) {
|
|
153
|
+
return normalizePath(appUVue);
|
|
154
|
+
}
|
|
152
155
|
}
|
|
153
156
|
return normalizePath(path_1.default.resolve(inputDir, 'App.vue'));
|
|
154
157
|
}
|
|
@@ -176,11 +179,37 @@ function requireUniHelpers() {
|
|
|
176
179
|
}
|
|
177
180
|
exports.requireUniHelpers = requireUniHelpers;
|
|
178
181
|
function normalizeEmitAssetFileName(fileName) {
|
|
182
|
+
const extname = path_1.default.extname(fileName);
|
|
179
183
|
if (process.env.UNI_APP_X_TSC === 'true') {
|
|
180
|
-
if (
|
|
184
|
+
if (extname !== '.ts') {
|
|
181
185
|
return fileName + '.ts';
|
|
182
186
|
}
|
|
183
187
|
}
|
|
188
|
+
else {
|
|
189
|
+
// logo.png、pages.json 等
|
|
190
|
+
if (!['.ts', '.uts', '.uvue', '.vue'].includes(extname)) {
|
|
191
|
+
fileName = fileName + '.uts';
|
|
192
|
+
}
|
|
193
|
+
}
|
|
184
194
|
return fileName;
|
|
185
195
|
}
|
|
186
196
|
exports.normalizeEmitAssetFileName = normalizeEmitAssetFileName;
|
|
197
|
+
function createIdent() {
|
|
198
|
+
if (process.env.UNI_INPUT_DIR) {
|
|
199
|
+
const manifestJson = (0, json_1.parseManifestJsonOnce)(process.env.UNI_INPUT_DIR);
|
|
200
|
+
const id = (manifestJson.appid || '').replace('__UNI__', '');
|
|
201
|
+
if (id) {
|
|
202
|
+
return Buffer.from(Buffer.from(id).toString('base64')).toString('hex');
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return '';
|
|
206
|
+
}
|
|
207
|
+
function createShadowImageUrl(cdn, type = 'grey') {
|
|
208
|
+
let identStr = '';
|
|
209
|
+
if (process.env.UNI_PLATFORM !== 'h5' && process.env.UNI_PLATFORM !== 'web') {
|
|
210
|
+
const ident = createIdent();
|
|
211
|
+
identStr = ident ? `${ident}/` : '';
|
|
212
|
+
}
|
|
213
|
+
return `https://cdn${(cdn || 0) + (process.env.UNI_APP_X === 'true' ? 1000 : 0) || ''}.dcloud.net.cn/${identStr}img/shadow-${type}.png`;
|
|
214
|
+
}
|
|
215
|
+
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
|
};
|
package/dist/vite/cloud.js
CHANGED
|
@@ -143,6 +143,15 @@ function uniEncryptUniModulesPlugin() {
|
|
|
143
143
|
const compiler = (0, uts_1.resolveUTSCompiler)();
|
|
144
144
|
for (const uniModule of tempUniModules) {
|
|
145
145
|
const pluginDir = path_1.default.resolve(tempUniModulesDir, uniModule);
|
|
146
|
+
// TODO 待优化autoImports,目前 uni-app x 的编译,autoImport 是在js层处理过,rust层基本不再使用
|
|
147
|
+
// 但uts插件目前还是使用的rust层的autoImports
|
|
148
|
+
const autoImports = {};
|
|
149
|
+
const allAutoImports = (0, easycom_1.getUTSEasyComAutoImports)();
|
|
150
|
+
Object.keys(allAutoImports).forEach((source) => {
|
|
151
|
+
if (!source.startsWith(`@/uni_modules/${uniModule}/components/`)) {
|
|
152
|
+
autoImports[source] = allAutoImports[source];
|
|
153
|
+
}
|
|
154
|
+
});
|
|
146
155
|
const result = await compiler.compile(pluginDir, {
|
|
147
156
|
isX: process.env.UNI_APP_X === 'true',
|
|
148
157
|
isSingleThread: true,
|
|
@@ -151,7 +160,7 @@ function uniEncryptUniModulesPlugin() {
|
|
|
151
160
|
uni_modules: [],
|
|
152
161
|
transform: {
|
|
153
162
|
uvueClassNamePrefix: 'Gen',
|
|
154
|
-
autoImports
|
|
163
|
+
autoImports,
|
|
155
164
|
},
|
|
156
165
|
});
|
|
157
166
|
if (result) {
|
|
@@ -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;
|
|
@@ -55,6 +55,11 @@ function uniUTSAppUniModulesPlugin(options = {}) {
|
|
|
55
55
|
return compiler.compileArkTS(pluginDir, {
|
|
56
56
|
isX: !!options.x,
|
|
57
57
|
isExtApi,
|
|
58
|
+
transform: {
|
|
59
|
+
uniExtApiProviderName: extApiProvider?.name,
|
|
60
|
+
uniExtApiProviderService: extApiProvider?.service,
|
|
61
|
+
uniExtApiProviderServicePlugin,
|
|
62
|
+
},
|
|
58
63
|
});
|
|
59
64
|
}
|
|
60
65
|
return compiler.compile(pluginDir, {
|
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/license.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[https://uniapp.dcloud.net.cn/license.html ](https://uniapp.dcloud.net.cn/license.html )
|
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-4020520240726001",
|
|
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-4020520240726001",
|
|
30
|
+
"@dcloudio/uni-shared": "3.0.0-alpha-4020520240726001",
|
|
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-4020520240726001",
|
|
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",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"@types/stylus": "^0.48.36",
|
|
88
88
|
"code-frame": "link:@types/@babel/code-frame",
|
|
89
89
|
"postcss": "^8.4.21",
|
|
90
|
-
"
|
|
90
|
+
"unimport": "^3.9.0",
|
|
91
91
|
"vue": "3.4.21"
|
|
92
92
|
}
|
|
93
93
|
}
|