@dcloudio/uni-cli-shared 0.0.1-nvue3.3030820220125001

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.
Files changed (236) hide show
  1. package/dist/checkUpdate.d.ts +30 -0
  2. package/dist/checkUpdate.js +243 -0
  3. package/dist/constants.d.ts +19 -0
  4. package/dist/constants.js +43 -0
  5. package/dist/deps.d.ts +19 -0
  6. package/dist/deps.js +39 -0
  7. package/dist/easycom.d.ts +29 -0
  8. package/dist/easycom.js +202 -0
  9. package/dist/env/define.d.ts +15 -0
  10. package/dist/env/define.js +45 -0
  11. package/dist/env/index.d.ts +2 -0
  12. package/dist/env/index.js +8 -0
  13. package/dist/env/provide.d.ts +9 -0
  14. package/dist/env/provide.js +24 -0
  15. package/dist/esbuild.d.ts +3 -0
  16. package/dist/esbuild.js +42 -0
  17. package/dist/exports.d.ts +1 -0
  18. package/dist/exports.js +8 -0
  19. package/dist/filter.d.ts +16 -0
  20. package/dist/filter.js +60 -0
  21. package/dist/fs.d.ts +1 -0
  22. package/dist/fs.js +25 -0
  23. package/dist/hbx/alias.d.ts +5 -0
  24. package/dist/hbx/alias.js +75 -0
  25. package/dist/hbx/env.d.ts +6 -0
  26. package/dist/hbx/env.js +44 -0
  27. package/dist/hbx/index.d.ts +3 -0
  28. package/dist/hbx/index.js +36 -0
  29. package/dist/hbx/log.d.ts +6 -0
  30. package/dist/hbx/log.js +99 -0
  31. package/dist/i18n.d.ts +10 -0
  32. package/dist/i18n.js +94 -0
  33. package/dist/index.d.ts +25 -0
  34. package/dist/index.js +40 -0
  35. package/dist/json/app/index.d.ts +3 -0
  36. package/dist/json/app/index.js +17 -0
  37. package/dist/json/app/manifest/arguments.d.ts +2 -0
  38. package/dist/json/app/manifest/arguments.js +36 -0
  39. package/dist/json/app/manifest/confusion.d.ts +4 -0
  40. package/dist/json/app/manifest/confusion.js +77 -0
  41. package/dist/json/app/manifest/defaultManifestJson.d.ts +1 -0
  42. package/dist/json/app/manifest/defaultManifestJson.js +41 -0
  43. package/dist/json/app/manifest/env.d.ts +3 -0
  44. package/dist/json/app/manifest/env.js +24 -0
  45. package/dist/json/app/manifest/i18n.d.ts +1 -0
  46. package/dist/json/app/manifest/i18n.js +14 -0
  47. package/dist/json/app/manifest/index.d.ts +4 -0
  48. package/dist/json/app/manifest/index.js +49 -0
  49. package/dist/json/app/manifest/launchwebview.d.ts +1 -0
  50. package/dist/json/app/manifest/launchwebview.js +32 -0
  51. package/dist/json/app/manifest/merge.d.ts +1 -0
  52. package/dist/json/app/manifest/merge.js +17 -0
  53. package/dist/json/app/manifest/nvue.d.ts +4 -0
  54. package/dist/json/app/manifest/nvue.js +43 -0
  55. package/dist/json/app/manifest/plus.d.ts +1 -0
  56. package/dist/json/app/manifest/plus.js +83 -0
  57. package/dist/json/app/manifest/safearea.d.ts +1 -0
  58. package/dist/json/app/manifest/safearea.js +28 -0
  59. package/dist/json/app/manifest/splashscreen.d.ts +5 -0
  60. package/dist/json/app/manifest/splashscreen.js +44 -0
  61. package/dist/json/app/manifest/statusbar.d.ts +1 -0
  62. package/dist/json/app/manifest/statusbar.js +14 -0
  63. package/dist/json/app/manifest/tabBar.d.ts +1 -0
  64. package/dist/json/app/manifest/tabBar.js +27 -0
  65. package/dist/json/app/manifest/uniApp.d.ts +1 -0
  66. package/dist/json/app/manifest/uniApp.js +19 -0
  67. package/dist/json/app/pages/code.d.ts +3 -0
  68. package/dist/json/app/pages/code.js +44 -0
  69. package/dist/json/app/pages/definePage.d.ts +2 -0
  70. package/dist/json/app/pages/definePage.js +42 -0
  71. package/dist/json/app/pages/index.d.ts +3 -0
  72. package/dist/json/app/pages/index.js +28 -0
  73. package/dist/json/app/pages/uniConfig.d.ts +1 -0
  74. package/dist/json/app/pages/uniConfig.js +69 -0
  75. package/dist/json/app/pages/uniRoutes.d.ts +1 -0
  76. package/dist/json/app/pages/uniRoutes.js +8 -0
  77. package/dist/json/index.d.ts +5 -0
  78. package/dist/json/index.js +17 -0
  79. package/dist/json/json.d.ts +1 -0
  80. package/dist/json/json.js +9 -0
  81. package/dist/json/manifest.d.ts +28 -0
  82. package/dist/json/manifest.js +64 -0
  83. package/dist/json/mp/index.d.ts +4 -0
  84. package/dist/json/mp/index.js +19 -0
  85. package/dist/json/mp/jsonFile.d.ts +23 -0
  86. package/dist/json/mp/jsonFile.js +127 -0
  87. package/dist/json/mp/pages.d.ts +17 -0
  88. package/dist/json/mp/pages.js +126 -0
  89. package/dist/json/mp/project.d.ts +14 -0
  90. package/dist/json/mp/project.js +81 -0
  91. package/dist/json/mp/types.d.ts +118 -0
  92. package/dist/json/mp/types.js +2 -0
  93. package/dist/json/mp/utils.d.ts +3 -0
  94. package/dist/json/mp/utils.js +66 -0
  95. package/dist/json/pages.d.ts +30 -0
  96. package/dist/json/pages.js +383 -0
  97. package/dist/logs/console.d.ts +4 -0
  98. package/dist/logs/console.js +49 -0
  99. package/dist/logs/format.d.ts +11 -0
  100. package/dist/logs/format.js +82 -0
  101. package/dist/logs/index.d.ts +1 -0
  102. package/dist/logs/index.js +7 -0
  103. package/dist/messages/index.d.ts +20 -0
  104. package/dist/messages/index.js +23 -0
  105. package/dist/mp/ast.d.ts +4 -0
  106. package/dist/mp/ast.js +12 -0
  107. package/dist/mp/constants.d.ts +5 -0
  108. package/dist/mp/constants.js +8 -0
  109. package/dist/mp/event.d.ts +5 -0
  110. package/dist/mp/event.js +35 -0
  111. package/dist/mp/externalClasses.d.ts +5 -0
  112. package/dist/mp/externalClasses.js +42 -0
  113. package/dist/mp/imports.d.ts +12 -0
  114. package/dist/mp/imports.js +72 -0
  115. package/dist/mp/index.d.ts +11 -0
  116. package/dist/mp/index.js +38 -0
  117. package/dist/mp/nvue.d.ts +1 -0
  118. package/dist/mp/nvue.js +18 -0
  119. package/dist/mp/plugin.d.ts +2 -0
  120. package/dist/mp/plugin.js +13 -0
  121. package/dist/mp/style.d.ts +1 -0
  122. package/dist/mp/style.js +9 -0
  123. package/dist/mp/tags.d.ts +1 -0
  124. package/dist/mp/tags.js +117 -0
  125. package/dist/mp/template.d.ts +73 -0
  126. package/dist/mp/template.js +73 -0
  127. package/dist/mp/usingComponents.d.ts +65 -0
  128. package/dist/mp/usingComponents.js +402 -0
  129. package/dist/mp/wxs.d.ts +2 -0
  130. package/dist/mp/wxs.js +55 -0
  131. package/dist/platform.d.ts +2 -0
  132. package/dist/platform.js +31 -0
  133. package/dist/postcss/index.d.ts +10 -0
  134. package/dist/postcss/index.js +19 -0
  135. package/dist/postcss/plugins/stylePluginScoped.d.ts +3 -0
  136. package/dist/postcss/plugins/stylePluginScoped.js +176 -0
  137. package/dist/postcss/plugins/uniapp.d.ts +11 -0
  138. package/dist/postcss/plugins/uniapp.js +110 -0
  139. package/dist/preprocess/context.d.ts +3 -0
  140. package/dist/preprocess/context.js +81 -0
  141. package/dist/preprocess/index.d.ts +9 -0
  142. package/dist/preprocess/index.js +28 -0
  143. package/dist/resolve.d.ts +6 -0
  144. package/dist/resolve.js +102 -0
  145. package/dist/scripts.d.ts +10 -0
  146. package/dist/scripts.js +44 -0
  147. package/dist/ssr.d.ts +4 -0
  148. package/dist/ssr.js +20 -0
  149. package/dist/url.d.ts +2 -0
  150. package/dist/url.js +15 -0
  151. package/dist/utils.d.ts +13 -0
  152. package/dist/utils.js +80 -0
  153. package/dist/vite/features.d.ts +41 -0
  154. package/dist/vite/features.js +191 -0
  155. package/dist/vite/index.d.ts +36 -0
  156. package/dist/vite/index.js +17 -0
  157. package/dist/vite/plugins/console.d.ts +8 -0
  158. package/dist/vite/plugins/console.js +42 -0
  159. package/dist/vite/plugins/copy.d.ts +11 -0
  160. package/dist/vite/plugins/copy.js +51 -0
  161. package/dist/vite/plugins/cssScoped.d.ts +6 -0
  162. package/dist/vite/plugins/cssScoped.js +54 -0
  163. package/dist/vite/plugins/dynamicImportPolyfill.d.ts +2 -0
  164. package/dist/vite/plugins/dynamicImportPolyfill.js +15 -0
  165. package/dist/vite/plugins/index.d.ts +10 -0
  166. package/dist/vite/plugins/index.js +32 -0
  167. package/dist/vite/plugins/inject.d.ts +12 -0
  168. package/dist/vite/plugins/inject.js +207 -0
  169. package/dist/vite/plugins/jsonJs.d.ts +3 -0
  170. package/dist/vite/plugins/jsonJs.js +52 -0
  171. package/dist/vite/plugins/mainJs.d.ts +2 -0
  172. package/dist/vite/plugins/mainJs.js +29 -0
  173. package/dist/vite/plugins/vitejs/config.d.ts +1 -0
  174. package/dist/vite/plugins/vitejs/config.js +2 -0
  175. package/dist/vite/plugins/vitejs/constants.d.ts +8 -0
  176. package/dist/vite/plugins/vitejs/constants.js +11 -0
  177. package/dist/vite/plugins/vitejs/index.d.ts +1 -0
  178. package/dist/vite/plugins/vitejs/index.js +2 -0
  179. package/dist/vite/plugins/vitejs/plugin.d.ts +1 -0
  180. package/dist/vite/plugins/vitejs/plugin.js +2 -0
  181. package/dist/vite/plugins/vitejs/plugins/asset.d.ts +40 -0
  182. package/dist/vite/plugins/vitejs/plugins/asset.js +270 -0
  183. package/dist/vite/plugins/vitejs/plugins/css.d.ts +48 -0
  184. package/dist/vite/plugins/vitejs/plugins/css.js +760 -0
  185. package/dist/vite/plugins/vitejs/server/moduleGraph.d.ts +1 -0
  186. package/dist/vite/plugins/vitejs/server/moduleGraph.js +2 -0
  187. package/dist/vite/plugins/vitejs/utils.d.ts +29 -0
  188. package/dist/vite/plugins/vitejs/utils.js +129 -0
  189. package/dist/vite/utils/ast.d.ts +17 -0
  190. package/dist/vite/utils/ast.js +85 -0
  191. package/dist/vite/utils/index.d.ts +7 -0
  192. package/dist/vite/utils/index.js +23 -0
  193. package/dist/vite/utils/plugin.d.ts +11 -0
  194. package/dist/vite/utils/plugin.js +45 -0
  195. package/dist/vite/utils/url.d.ts +28 -0
  196. package/dist/vite/utils/url.js +69 -0
  197. package/dist/vite/utils/utils.d.ts +3 -0
  198. package/dist/vite/utils/utils.js +14 -0
  199. package/dist/vue/babel.d.ts +3 -0
  200. package/dist/vue/babel.js +17 -0
  201. package/dist/vue/index.d.ts +4 -0
  202. package/dist/vue/index.js +19 -0
  203. package/dist/vue/transforms/index.d.ts +13 -0
  204. package/dist/vue/transforms/index.js +48 -0
  205. package/dist/vue/transforms/templateTransformAssetUrl.d.ts +33 -0
  206. package/dist/vue/transforms/templateTransformAssetUrl.js +150 -0
  207. package/dist/vue/transforms/templateTransformSrcset.d.ts +4 -0
  208. package/dist/vue/transforms/templateTransformSrcset.js +122 -0
  209. package/dist/vue/transforms/templateUtils.d.ts +9 -0
  210. package/dist/vue/transforms/templateUtils.js +41 -0
  211. package/dist/vue/transforms/transformComponent.d.ts +3 -0
  212. package/dist/vue/transforms/transformComponent.js +26 -0
  213. package/dist/vue/transforms/transformEvent.d.ts +2 -0
  214. package/dist/vue/transforms/transformEvent.js +28 -0
  215. package/dist/vue/transforms/transformPageHead.d.ts +2 -0
  216. package/dist/vue/transforms/transformPageHead.js +11 -0
  217. package/dist/vue/transforms/transformRef.d.ts +2 -0
  218. package/dist/vue/transforms/transformRef.js +32 -0
  219. package/dist/vue/transforms/transformTag.d.ts +2 -0
  220. package/dist/vue/transforms/transformTag.js +18 -0
  221. package/dist/vue/transforms/vModel.d.ts +12 -0
  222. package/dist/vue/transforms/vModel.js +33 -0
  223. package/dist/vue/transforms/vOn.d.ts +15 -0
  224. package/dist/vue/transforms/vOn.js +88 -0
  225. package/dist/vue/utils.d.ts +31 -0
  226. package/dist/vue/utils.js +120 -0
  227. package/dist/watcher.d.ts +30 -0
  228. package/dist/watcher.js +92 -0
  229. package/lib/crypto.js +65 -0
  230. package/lib/nvue.css +34 -0
  231. package/lib/preprocess/LICENSE +13 -0
  232. package/lib/preprocess/README.md +410 -0
  233. package/lib/preprocess/lib/preprocess.js +437 -0
  234. package/lib/preprocess/lib/regexrules.js +121 -0
  235. package/lib/preprocess/package.json +68 -0
  236. package/package.json +68 -0
@@ -0,0 +1,25 @@
1
+ export * from './fs';
2
+ export * from './mp';
3
+ export * from './url';
4
+ export * from './env';
5
+ export * from './hbx';
6
+ export * from './ssr';
7
+ export * from './vue';
8
+ export * from './logs';
9
+ export * from './i18n';
10
+ export * from './deps';
11
+ export * from './json';
12
+ export * from './vite';
13
+ export * from './utils';
14
+ export * from './easycom';
15
+ export * from './constants';
16
+ export * from './preprocess';
17
+ export * from './postcss';
18
+ export * from './filter';
19
+ export * from './esbuild';
20
+ export * from './resolve';
21
+ export * from './scripts';
22
+ export * from './platform';
23
+ export { M } from './messages';
24
+ export * from './exports';
25
+ export { checkUpdate } from './checkUpdate';
package/dist/index.js ADDED
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.checkUpdate = exports.M = void 0;
14
+ __exportStar(require("./fs"), exports);
15
+ __exportStar(require("./mp"), exports);
16
+ __exportStar(require("./url"), exports);
17
+ __exportStar(require("./env"), exports);
18
+ __exportStar(require("./hbx"), exports);
19
+ __exportStar(require("./ssr"), exports);
20
+ __exportStar(require("./vue"), exports);
21
+ __exportStar(require("./logs"), exports);
22
+ __exportStar(require("./i18n"), exports);
23
+ __exportStar(require("./deps"), exports);
24
+ __exportStar(require("./json"), exports);
25
+ __exportStar(require("./vite"), exports);
26
+ __exportStar(require("./utils"), exports);
27
+ __exportStar(require("./easycom"), exports);
28
+ __exportStar(require("./constants"), exports);
29
+ __exportStar(require("./preprocess"), exports);
30
+ __exportStar(require("./postcss"), exports);
31
+ __exportStar(require("./filter"), exports);
32
+ __exportStar(require("./esbuild"), exports);
33
+ __exportStar(require("./resolve"), exports);
34
+ __exportStar(require("./scripts"), exports);
35
+ __exportStar(require("./platform"), exports);
36
+ var messages_1 = require("./messages");
37
+ Object.defineProperty(exports, "M", { enumerable: true, get: function () { return messages_1.M; } });
38
+ __exportStar(require("./exports"), exports);
39
+ var checkUpdate_1 = require("./checkUpdate");
40
+ Object.defineProperty(exports, "checkUpdate", { enumerable: true, get: function () { return checkUpdate_1.checkUpdate; } });
@@ -0,0 +1,3 @@
1
+ export * from './pages';
2
+ export * from './manifest';
3
+ export { polyfillCode } from './pages/code';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.polyfillCode = void 0;
14
+ __exportStar(require("./pages"), exports);
15
+ __exportStar(require("./manifest"), exports);
16
+ var code_1 = require("./pages/code");
17
+ Object.defineProperty(exports, "polyfillCode", { enumerable: true, get: function () { return code_1.polyfillCode; } });
@@ -0,0 +1,2 @@
1
+ export declare function initArguments(manifestJson: Record<string, any>, pagesJson: UniApp.PagesJson): void;
2
+ export declare function parseArguments(pagesJson: UniApp.PagesJson): string | undefined;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseArguments = exports.initArguments = void 0;
4
+ function initArguments(manifestJson, pagesJson) {
5
+ const args = parseArguments(pagesJson);
6
+ if (args) {
7
+ manifestJson.plus.arguments = args;
8
+ }
9
+ }
10
+ exports.initArguments = initArguments;
11
+ function parseArguments(pagesJson) {
12
+ var _a;
13
+ if (process.env.NODE_ENV !== 'development') {
14
+ return;
15
+ }
16
+ // 指定了入口
17
+ if (process.env.UNI_CLI_LAUNCH_PAGE_PATH) {
18
+ return JSON.stringify({
19
+ path: process.env.UNI_CLI_LAUNCH_PAGE_PATH,
20
+ query: process.env.UNI_CLI_LAUNCH_PAGE_QUERY,
21
+ });
22
+ }
23
+ const condition = pagesJson.condition;
24
+ if (condition && ((_a = condition.list) === null || _a === void 0 ? void 0 : _a.length)) {
25
+ const list = condition.list;
26
+ let current = condition.current || 0;
27
+ if (current < 0) {
28
+ current = 0;
29
+ }
30
+ if (current >= list.length) {
31
+ current = 0;
32
+ }
33
+ return JSON.stringify(list[current]);
34
+ }
35
+ }
36
+ exports.parseArguments = parseArguments;
@@ -0,0 +1,4 @@
1
+ export declare const APP_CONFUSION_FILENAME = "app-confusion.js";
2
+ export declare function isConfusionFile(filename: string): boolean;
3
+ export declare function hasConfusionFile(inputDir?: string): boolean;
4
+ export declare function initConfusion(manifestJson: Record<string, any>): void;
@@ -0,0 +1,77 @@
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.initConfusion = exports.hasConfusionFile = exports.isConfusionFile = exports.APP_CONFUSION_FILENAME = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const utils_1 = require("../../../utils");
9
+ const constants_1 = require("../../../constants");
10
+ const manifest_1 = require("../../manifest");
11
+ function isJsFile(filename) {
12
+ return constants_1.EXTNAME_JS_RE.test(filename);
13
+ }
14
+ function isStaticJsFile(filename) {
15
+ return (filename.indexOf('hybrid/html') === 0 ||
16
+ filename.indexOf('static/') === 0 ||
17
+ filename.indexOf('/static/') !== -1); // subpackages, uni_modules 中的 static 目录
18
+ }
19
+ const dynamicConfusionJsFiles = [];
20
+ exports.APP_CONFUSION_FILENAME = 'app-confusion.js';
21
+ function isConfusionFile(filename) {
22
+ return dynamicConfusionJsFiles.includes((0, utils_1.normalizePath)(filename));
23
+ }
24
+ exports.isConfusionFile = isConfusionFile;
25
+ function hasConfusionFile(inputDir) {
26
+ var _a, _b;
27
+ if (inputDir) {
28
+ const manifestJson = (0, manifest_1.parseManifestJsonOnce)(inputDir);
29
+ const resources = (_b = (_a = manifestJson['app-plus']) === null || _a === void 0 ? void 0 : _a.confusion) === null || _b === void 0 ? void 0 : _b.resources;
30
+ if (resources && parseConfusion(resources)[1].length) {
31
+ return true;
32
+ }
33
+ }
34
+ return !!dynamicConfusionJsFiles.length;
35
+ }
36
+ exports.hasConfusionFile = hasConfusionFile;
37
+ function parseConfusion(resources) {
38
+ const res = {};
39
+ const dynamicJsFiles = [];
40
+ Object.keys(resources).reduce((res, name) => {
41
+ const extname = path_1.default.extname(name);
42
+ if (extname === '.nvue') {
43
+ res[name.replace('.nvue', '.js')] = resources[name];
44
+ }
45
+ else if (isJsFile(name)) {
46
+ // 静态 js 加密
47
+ if (isStaticJsFile(name)) {
48
+ res[name] = resources[name];
49
+ }
50
+ else {
51
+ // 非静态 js 将被合并进 app-confusion.js
52
+ dynamicJsFiles.push(name);
53
+ }
54
+ }
55
+ else {
56
+ throw new Error(`原生混淆仅支持 nvue 页面,错误的页面路径:${name}`);
57
+ }
58
+ // TODO 旧编译器会检查要加密的 nvue 页面(包括subnvue)是否被使用?后续有时间再考虑支持吧,意义不太大
59
+ return res;
60
+ }, res);
61
+ if (dynamicJsFiles.length) {
62
+ res[exports.APP_CONFUSION_FILENAME] = {};
63
+ }
64
+ return [res, dynamicJsFiles];
65
+ }
66
+ function initConfusion(manifestJson) {
67
+ var _a;
68
+ dynamicConfusionJsFiles.length = 0;
69
+ if (!((_a = manifestJson.plus.confusion) === null || _a === void 0 ? void 0 : _a.resources)) {
70
+ return;
71
+ }
72
+ const resources = manifestJson.plus.confusion.resources;
73
+ const [res, dynamicJsFiles] = parseConfusion(resources);
74
+ manifestJson.plus.confusion.resources = res;
75
+ dynamicConfusionJsFiles.push(...dynamicJsFiles);
76
+ }
77
+ exports.initConfusion = initConfusion;
@@ -0,0 +1 @@
1
+ export declare function initDefaultManifestJson(): any;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initDefaultManifestJson = void 0;
4
+ function initDefaultManifestJson() {
5
+ return JSON.parse(defaultManifestJson);
6
+ }
7
+ exports.initDefaultManifestJson = initDefaultManifestJson;
8
+ const defaultManifestJson = `{
9
+ "@platforms": [
10
+ "android",
11
+ "iPhone",
12
+ "iPad"
13
+ ],
14
+ "id": "__WEAPP_ID",
15
+ "name": "__WEAPP_NAME",
16
+ "version": {
17
+ "name": "1.0",
18
+ "code": ""
19
+ },
20
+ "description": "",
21
+ "developer": {
22
+ "name": "",
23
+ "email": "",
24
+ "url": ""
25
+ },
26
+ "permissions": {},
27
+ "plus": {
28
+ "useragent": {
29
+ "value": "uni-app appservice",
30
+ "concatenate": true
31
+ },
32
+ "splashscreen": {
33
+ "target":"id:1",
34
+ "autoclose": true,
35
+ "waiting": true,
36
+ "alwaysShowBeforeRender":true
37
+ },
38
+ "popGesture": "close",
39
+ "launchwebview": {}
40
+ }
41
+ }`;
@@ -0,0 +1,3 @@
1
+ export declare function getAppRenderer(manifestJson: Record<string, any>): "" | "native";
2
+ export declare function getAppCodeSpliting(manifestJson: Record<string, any>): boolean;
3
+ export declare function getAppStyleIsolation(manifestJson: Record<string, any>): 'apply-shared' | 'isolated' | 'shared';
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAppStyleIsolation = exports.getAppCodeSpliting = exports.getAppRenderer = void 0;
4
+ function getAppRenderer(manifestJson) {
5
+ const platformOptions = manifestJson['app-plus'];
6
+ if (platformOptions && platformOptions.renderer === 'native') {
7
+ return 'native';
8
+ }
9
+ return '';
10
+ }
11
+ exports.getAppRenderer = getAppRenderer;
12
+ function getAppCodeSpliting(manifestJson) {
13
+ var _a, _b;
14
+ if (((_b = (_a = manifestJson['app-plus']) === null || _a === void 0 ? void 0 : _a.optimization) === null || _b === void 0 ? void 0 : _b.codeSpliting) === true) {
15
+ return true;
16
+ }
17
+ return false;
18
+ }
19
+ exports.getAppCodeSpliting = getAppCodeSpliting;
20
+ function getAppStyleIsolation(manifestJson) {
21
+ var _a, _b, _c;
22
+ return ((_c = (_b = (_a = manifestJson['app-plus']) === null || _a === void 0 ? void 0 : _a.optimization) === null || _b === void 0 ? void 0 : _b.styleIsolation) !== null && _c !== void 0 ? _c : 'apply-shared');
23
+ }
24
+ exports.getAppStyleIsolation = getAppStyleIsolation;
@@ -0,0 +1 @@
1
+ export declare function initI18n(manifestJson: Record<string, any>): Record<string, any>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initI18n = void 0;
4
+ const uni_i18n_1 = require("@dcloudio/uni-i18n");
5
+ const i18n_1 = require("../../../i18n");
6
+ function initI18n(manifestJson) {
7
+ const i18nOptions = (0, i18n_1.initI18nOptions)(process.env.UNI_PLATFORM, process.env.UNI_INPUT_DIR, true);
8
+ if (i18nOptions) {
9
+ manifestJson = JSON.parse((0, uni_i18n_1.compileI18nJsonStr)(JSON.stringify(manifestJson), i18nOptions));
10
+ manifestJson.fallbackLocale = i18nOptions.locale;
11
+ }
12
+ return manifestJson;
13
+ }
14
+ exports.initI18n = initI18n;
@@ -0,0 +1,4 @@
1
+ export declare function normalizeAppManifestJson(userManifestJson: Record<string, any>, pagesJson: UniApp.PagesJson): Record<string, any>;
2
+ export * from './env';
3
+ export { APP_CONFUSION_FILENAME, isConfusionFile, hasConfusionFile, } from './confusion';
4
+ export { getNVueCompiler, getNVueStyleCompiler, getNVueFlexDirection, } from './nvue';
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.getNVueFlexDirection = exports.getNVueStyleCompiler = exports.getNVueCompiler = exports.hasConfusionFile = exports.isConfusionFile = exports.APP_CONFUSION_FILENAME = exports.normalizeAppManifestJson = void 0;
14
+ const merge_1 = require("./merge");
15
+ const defaultManifestJson_1 = require("./defaultManifestJson");
16
+ const statusbar_1 = require("./statusbar");
17
+ const plus_1 = require("./plus");
18
+ const nvue_1 = require("./nvue");
19
+ const arguments_1 = require("./arguments");
20
+ const safearea_1 = require("./safearea");
21
+ const splashscreen_1 = require("./splashscreen");
22
+ const confusion_1 = require("./confusion");
23
+ const uniApp_1 = require("./uniApp");
24
+ const launchwebview_1 = require("./launchwebview");
25
+ const tabBar_1 = require("./tabBar");
26
+ const i18n_1 = require("./i18n");
27
+ function normalizeAppManifestJson(userManifestJson, pagesJson) {
28
+ const manifestJson = (0, merge_1.initRecursiveMerge)((0, statusbar_1.initAppStatusbar)((0, defaultManifestJson_1.initDefaultManifestJson)(), pagesJson), userManifestJson);
29
+ (0, arguments_1.initArguments)(manifestJson, pagesJson);
30
+ (0, plus_1.initPlus)(manifestJson, pagesJson);
31
+ (0, nvue_1.initNVue)(manifestJson, pagesJson);
32
+ (0, safearea_1.initSafearea)(manifestJson, pagesJson);
33
+ (0, splashscreen_1.initSplashscreen)(manifestJson, userManifestJson);
34
+ (0, confusion_1.initConfusion)(manifestJson);
35
+ (0, uniApp_1.initUniApp)(manifestJson);
36
+ // 依赖 initArguments 先执行
37
+ (0, tabBar_1.initTabBar)((0, launchwebview_1.initLaunchwebview)(manifestJson, pagesJson), manifestJson, pagesJson);
38
+ return (0, i18n_1.initI18n)(manifestJson);
39
+ }
40
+ exports.normalizeAppManifestJson = normalizeAppManifestJson;
41
+ __exportStar(require("./env"), exports);
42
+ var confusion_2 = require("./confusion");
43
+ Object.defineProperty(exports, "APP_CONFUSION_FILENAME", { enumerable: true, get: function () { return confusion_2.APP_CONFUSION_FILENAME; } });
44
+ Object.defineProperty(exports, "isConfusionFile", { enumerable: true, get: function () { return confusion_2.isConfusionFile; } });
45
+ Object.defineProperty(exports, "hasConfusionFile", { enumerable: true, get: function () { return confusion_2.hasConfusionFile; } });
46
+ var nvue_2 = require("./nvue");
47
+ Object.defineProperty(exports, "getNVueCompiler", { enumerable: true, get: function () { return nvue_2.getNVueCompiler; } });
48
+ Object.defineProperty(exports, "getNVueStyleCompiler", { enumerable: true, get: function () { return nvue_2.getNVueStyleCompiler; } });
49
+ Object.defineProperty(exports, "getNVueFlexDirection", { enumerable: true, get: function () { return nvue_2.getNVueFlexDirection; } });
@@ -0,0 +1 @@
1
+ export declare function initLaunchwebview(manifestJson: Record<string, any>, pagesJson: UniApp.PagesJson): string;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initLaunchwebview = void 0;
4
+ const shared_1 = require("@vue/shared");
5
+ function initLaunchwebview(manifestJson, pagesJson) {
6
+ let entryPagePath = pagesJson.pages[0].path;
7
+ // 依赖前置执行initArguments
8
+ if (manifestJson.plus.arguments) {
9
+ try {
10
+ const args = JSON.parse(manifestJson.plus.arguments);
11
+ if (args.path) {
12
+ entryPagePath = args.path;
13
+ }
14
+ }
15
+ catch (e) { }
16
+ }
17
+ manifestJson.plus.useragent.value = 'uni-app';
18
+ (0, shared_1.extend)(manifestJson.plus.launchwebview, {
19
+ id: '1',
20
+ kernel: 'WKWebview',
21
+ });
22
+ // 首页为nvue
23
+ const entryPage = pagesJson.pages.find((p) => p.path === entryPagePath);
24
+ if (entryPage === null || entryPage === void 0 ? void 0 : entryPage.style.isNVue) {
25
+ manifestJson.plus.launchwebview.uniNView = { path: entryPagePath + '.js' };
26
+ }
27
+ else {
28
+ manifestJson.launch_path = '__uniappview.html';
29
+ }
30
+ return entryPagePath;
31
+ }
32
+ exports.initLaunchwebview = initLaunchwebview;
@@ -0,0 +1 @@
1
+ export declare function initRecursiveMerge(manifestJson: Record<string, any>, userManifestJson: Record<string, any>): Record<string, any>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initRecursiveMerge = void 0;
4
+ const merge_1 = require("merge");
5
+ function initRecursiveMerge(manifestJson, userManifestJson) {
6
+ return (0, merge_1.recursive)(true, manifestJson, {
7
+ id: userManifestJson.appid || '',
8
+ name: userManifestJson.name || '',
9
+ description: userManifestJson.description || '',
10
+ version: {
11
+ name: userManifestJson.versionName,
12
+ code: userManifestJson.versionCode,
13
+ },
14
+ locale: userManifestJson.locale,
15
+ }, { plus: userManifestJson['app-plus'] });
16
+ }
17
+ exports.initRecursiveMerge = initRecursiveMerge;
@@ -0,0 +1,4 @@
1
+ export declare function initNVue(manifestJson: Record<string, any>, pagesJson: UniApp.PagesJson): void;
2
+ export declare function getNVueCompiler(manifestJson: Record<string, any>): "uni-app" | "weex" | "vue" | "vite";
3
+ export declare function getNVueStyleCompiler(manifestJson: Record<string, any>): "uni-app" | "weex";
4
+ export declare function getNVueFlexDirection(manifestJson: Record<string, any>): "row" | "row-reverse" | "column" | "column-reverse";
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getNVueFlexDirection = exports.getNVueStyleCompiler = exports.getNVueCompiler = exports.initNVue = void 0;
4
+ function initNVue(manifestJson, pagesJson) { }
5
+ exports.initNVue = initNVue;
6
+ function getNVueCompiler(manifestJson) {
7
+ const platformOptions = manifestJson['app-plus'];
8
+ if (platformOptions) {
9
+ const { nvueCompiler } = platformOptions;
10
+ if (nvueCompiler === 'weex') {
11
+ return 'weex';
12
+ }
13
+ if (nvueCompiler === 'vue') {
14
+ return 'vue';
15
+ }
16
+ if (nvueCompiler === 'vite') {
17
+ return 'vite';
18
+ }
19
+ }
20
+ return 'uni-app';
21
+ }
22
+ exports.getNVueCompiler = getNVueCompiler;
23
+ function getNVueStyleCompiler(manifestJson) {
24
+ const platformOptions = manifestJson['app-plus'];
25
+ if (platformOptions && platformOptions.nvueStyleCompiler === 'uni-app') {
26
+ return 'uni-app';
27
+ }
28
+ return 'weex';
29
+ }
30
+ exports.getNVueStyleCompiler = getNVueStyleCompiler;
31
+ const flexDirs = ['row', 'row-reverse', 'column', 'column-reverse'];
32
+ function getNVueFlexDirection(manifestJson) {
33
+ var _a, _b;
34
+ let flexDir = 'column';
35
+ if ((_b = (_a = manifestJson['app-plus']) === null || _a === void 0 ? void 0 : _a.nvue) === null || _b === void 0 ? void 0 : _b['flex-direction']) {
36
+ flexDir = manifestJson['app-plus'].nvue['flex-direction'];
37
+ if (flexDirs.indexOf(flexDir) === -1) {
38
+ flexDir = 'column';
39
+ }
40
+ }
41
+ return flexDir;
42
+ }
43
+ exports.getNVueFlexDirection = getNVueFlexDirection;
@@ -0,0 +1 @@
1
+ export declare function initPlus(manifestJson: Record<string, any>, pagesJson: UniApp.PagesJson): void;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initPlus = void 0;
4
+ const wxPageOrientationMapping = {
5
+ auto: [
6
+ 'portrait-primary',
7
+ 'portrait-secondary',
8
+ 'landscape-primary',
9
+ 'landscape-secondary',
10
+ ],
11
+ portrait: ['portrait-primary', 'portrait-secondary'],
12
+ landscape: ['landscape-primary', 'landscape-secondary'],
13
+ };
14
+ function initPlus(manifestJson, pagesJson) {
15
+ var _a;
16
+ // 转换为老版本配置
17
+ if (manifestJson.plus.modules) {
18
+ manifestJson.permissions = manifestJson.plus.modules;
19
+ delete manifestJson.plus.modules;
20
+ }
21
+ const distribute = manifestJson.plus.distribute;
22
+ if (distribute) {
23
+ if (distribute.android) {
24
+ manifestJson.plus.distribute.google = distribute.android;
25
+ delete manifestJson.plus.distribute.android;
26
+ }
27
+ if (distribute.ios) {
28
+ manifestJson.plus.distribute.apple = distribute.ios;
29
+ delete manifestJson.plus.distribute.ios;
30
+ }
31
+ if (distribute.sdkConfigs) {
32
+ manifestJson.plus.distribute.plugins = distribute.sdkConfigs;
33
+ delete manifestJson.plus.distribute.sdkConfigs;
34
+ }
35
+ }
36
+ // 屏幕启动方向
37
+ if (manifestJson.plus.screenOrientation) {
38
+ // app平台优先使用 manifest 配置
39
+ manifestJson.screenOrientation = manifestJson.plus.screenOrientation;
40
+ delete manifestJson.plus.screenOrientation;
41
+ }
42
+ else if ((_a = pagesJson.globalStyle) === null || _a === void 0 ? void 0 : _a.pageOrientation) {
43
+ // 兼容微信小程序
44
+ const pageOrientationValue = wxPageOrientationMapping[pagesJson.globalStyle
45
+ .pageOrientation];
46
+ if (pageOrientationValue) {
47
+ manifestJson.screenOrientation = pageOrientationValue;
48
+ }
49
+ }
50
+ // 全屏配置
51
+ manifestJson.fullscreen = manifestJson.plus.fullscreen;
52
+ // 地图坐标系
53
+ if (manifestJson.permissions && manifestJson.permissions.Maps) {
54
+ manifestJson.permissions.Maps.coordType = 'gcj02';
55
+ }
56
+ if (!manifestJson.permissions) {
57
+ manifestJson.permissions = {};
58
+ }
59
+ manifestJson.permissions.UniNView = {
60
+ description: 'UniNView原生渲染',
61
+ };
62
+ // 允许内联播放视频
63
+ manifestJson.plus.allowsInlineMediaPlayback = true;
64
+ if (!manifestJson.plus.distribute) {
65
+ manifestJson.plus.distribute = {
66
+ plugins: {},
67
+ };
68
+ }
69
+ if (!manifestJson.plus.distribute.plugins) {
70
+ manifestJson.plus.distribute.plugins = {};
71
+ }
72
+ // 录音支持 mp3
73
+ manifestJson.plus.distribute.plugins.audio = {
74
+ mp3: {
75
+ description: 'Android平台录音支持MP3格式文件',
76
+ },
77
+ };
78
+ // 有效值为 close,none
79
+ if (!['close', 'none'].includes(manifestJson.plus.popGesture)) {
80
+ manifestJson.plus.popGesture = 'close';
81
+ }
82
+ }
83
+ exports.initPlus = initPlus;
@@ -0,0 +1 @@
1
+ export declare function initSafearea(manifestJson: Record<string, any>, pagesJson: UniApp.PagesJson): void;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.initSafearea = void 0;
4
+ function initSafearea(manifestJson, pagesJson) {
5
+ var _a, _b;
6
+ if ((_b = (_a = pagesJson.tabBar) === null || _a === void 0 ? void 0 : _a.list) === null || _b === void 0 ? void 0 : _b.length) {
7
+ // 安全区配置 仅包含 tabBar 的时候才配置
8
+ if (!manifestJson.plus.safearea) {
9
+ manifestJson.plus.safearea = {
10
+ background: pagesJson.tabBar.backgroundColor || '#FFFFFF',
11
+ bottom: {
12
+ offset: 'auto',
13
+ },
14
+ };
15
+ }
16
+ }
17
+ else {
18
+ if (!manifestJson.plus.launchwebview) {
19
+ manifestJson.plus.launchwebview = {
20
+ render: 'always',
21
+ };
22
+ }
23
+ else if (!manifestJson.plus.launchwebview.render) {
24
+ manifestJson.plus.launchwebview.render = 'always';
25
+ }
26
+ }
27
+ }
28
+ exports.initSafearea = initSafearea;
@@ -0,0 +1,5 @@
1
+ export declare function initSplashscreen(manifestJson: Record<string, any>, userManifestJson: Record<string, any>): void;
2
+ export declare function getSplashscreen(manifestJson: Record<string, any>): {
3
+ autoclose: boolean;
4
+ alwaysShowBeforeRender: boolean;
5
+ };
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSplashscreen = exports.initSplashscreen = void 0;
4
+ const shared_1 = require("@vue/shared");
5
+ function initSplashscreen(manifestJson, userManifestJson) {
6
+ if (!manifestJson.plus.splashscreen) {
7
+ return;
8
+ }
9
+ // 强制白屏检测
10
+ const splashscreenOptions = userManifestJson['app-plus'] && userManifestJson['app-plus'].splashscreen;
11
+ const hasAlwaysShowBeforeRender = splashscreenOptions && (0, shared_1.hasOwn)(splashscreenOptions, 'alwaysShowBeforeRender');
12
+ if (!hasAlwaysShowBeforeRender &&
13
+ manifestJson.plus.splashscreen.autoclose === false) {
14
+ // 兼容旧版本仅配置了 autoclose 为 false
15
+ manifestJson.plus.splashscreen.alwaysShowBeforeRender = false;
16
+ }
17
+ if (manifestJson.plus.splashscreen.alwaysShowBeforeRender) {
18
+ // 白屏检测
19
+ if (!manifestJson.plus.splashscreen.target) {
20
+ manifestJson.plus.splashscreen.target = 'id:1';
21
+ }
22
+ manifestJson.plus.splashscreen.autoclose = true;
23
+ manifestJson.plus.splashscreen.delay = 0;
24
+ }
25
+ else {
26
+ // 不启用白屏检测
27
+ delete manifestJson.plus.splashscreen.target;
28
+ if (manifestJson.plus.splashscreen.autoclose) {
29
+ // 启用 uni-app 框架关闭 splash
30
+ manifestJson.plus.splashscreen.autoclose = false; // 原 5+ autoclose 改为 false
31
+ }
32
+ }
33
+ delete manifestJson.plus.splashscreen.alwaysShowBeforeRender;
34
+ }
35
+ exports.initSplashscreen = initSplashscreen;
36
+ function getSplashscreen(manifestJson) {
37
+ var _a;
38
+ const splashscreenOptions = (_a = manifestJson['app-plus']) === null || _a === void 0 ? void 0 : _a.splashscreen;
39
+ return {
40
+ autoclose: splashscreenOptions.autoclose !== false,
41
+ alwaysShowBeforeRender: splashscreenOptions.alwaysShowBeforeRender !== false,
42
+ };
43
+ }
44
+ exports.getSplashscreen = getSplashscreen;
@@ -0,0 +1 @@
1
+ export declare function initAppStatusbar(manifestJson: Record<string, any>, pagesJson: UniApp.PagesJson): Record<string, any>;