@dcloudio/uni-cli-shared 3.0.0-alpha-3020920210927001 → 3.0.0-alpha-3021020210930001

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 (41) hide show
  1. package/dist/checkUpdate.js +9 -9
  2. package/dist/easycom.js +9 -9
  3. package/dist/env/define.js +2 -2
  4. package/dist/hbx/alias.js +1 -1
  5. package/dist/hbx/env.js +3 -3
  6. package/dist/i18n.js +5 -5
  7. package/dist/json/app/manifest/i18n.js +2 -2
  8. package/dist/json/app/manifest/index.js +10 -10
  9. package/dist/json/app/manifest/launchwebview.js +1 -1
  10. package/dist/json/app/manifest/merge.js +1 -1
  11. package/dist/json/app/manifest/splashscreen.js +1 -1
  12. package/dist/json/app/manifest/uniApp.js +2 -2
  13. package/dist/json/app/pages/definePage.js +2 -2
  14. package/dist/json/app/pages/index.js +3 -3
  15. package/dist/json/app/pages/nvue.js +3 -3
  16. package/dist/json/app/pages/uniConfig.js +5 -5
  17. package/dist/json/app/pages/uniRoutes.js +1 -1
  18. package/dist/json/json.js +1 -1
  19. package/dist/json/manifest.js +9 -9
  20. package/dist/json/pages.js +34 -32
  21. package/dist/logs/console.js +1 -1
  22. package/dist/logs/format.js +4 -4
  23. package/dist/postcss/plugins/stylePluginScoped.js +1 -1
  24. package/dist/postcss/plugins/uniapp.js +6 -6
  25. package/dist/preprocess/context.js +2 -2
  26. package/dist/preprocess/index.js +4 -4
  27. package/dist/renderjs.js +2 -2
  28. package/dist/utils.js +2 -2
  29. package/dist/vite/features.js +4 -4
  30. package/dist/vite/plugins/console.js +5 -5
  31. package/dist/vite/plugins/css.js +3 -3
  32. package/dist/vite/plugins/cssScoped.js +4 -4
  33. package/dist/vite/plugins/inject.js +11 -11
  34. package/dist/vite/plugins/jsonJs.js +1 -1
  35. package/dist/vite/plugins/mainJs.js +1 -1
  36. package/dist/vite/plugins/vitejs/plugins/asset.js +9 -9
  37. package/dist/vite/plugins/vitejs/plugins/css.js +17 -17
  38. package/dist/vite/utils/ast.js +8 -8
  39. package/dist/vite/utils/plugin.js +3 -3
  40. package/dist/watcher.js +1 -1
  41. package/package.json +2 -2
@@ -14,14 +14,14 @@ const compare_versions_1 = __importDefault(require("compare-versions"));
14
14
  const shared_1 = require("@vue/shared");
15
15
  const json_1 = require("./json");
16
16
  const hbx_1 = require("./hbx");
17
- const debugCheckUpdate = debug_1.default('uni:check-update');
17
+ const debugCheckUpdate = (0, debug_1.default)('uni:check-update');
18
18
  const INTERVAL = 1000 * 60 * 60 * 24;
19
19
  async function checkUpdate(options) {
20
20
  if (process.env.CI) {
21
21
  debugCheckUpdate('isInCI');
22
22
  return;
23
23
  }
24
- if (hbx_1.isInHBuilderX()) {
24
+ if ((0, hbx_1.isInHBuilderX)()) {
25
25
  debugCheckUpdate('isInHBuilderX');
26
26
  return;
27
27
  }
@@ -29,13 +29,13 @@ async function checkUpdate(options) {
29
29
  const updateCache = readCheckUpdateCache(inputDir);
30
30
  const res = checkLocalCache(updateCache, compilerVersion);
31
31
  if (res) {
32
- if (shared_1.isString(res)) {
32
+ if ((0, shared_1.isString)(res)) {
33
33
  console.log();
34
34
  console.log(res);
35
35
  }
36
36
  }
37
37
  else {
38
- await checkVersion(options, normalizeUpdateCache(updateCache, json_1.parseManifestJsonOnce(inputDir)));
38
+ await checkVersion(options, normalizeUpdateCache(updateCache, (0, json_1.parseManifestJsonOnce)(inputDir)));
39
39
  }
40
40
  writeCheckUpdateCache(inputDir, statUpdateCache(normalizeUpdateCache(updateCache)));
41
41
  }
@@ -111,7 +111,7 @@ function checkLocalCache(updateCache, compilerVersion, interval = INTERVAL) {
111
111
  return false;
112
112
  }
113
113
  if (updateCache.newVersion &&
114
- compare_versions_1.default(updateCache.newVersion, compilerVersion) > 0) {
114
+ (0, compare_versions_1.default)(updateCache.newVersion, compilerVersion) > 0) {
115
115
  debugCheckUpdate('cache: find new version');
116
116
  return updateCache.note;
117
117
  }
@@ -164,8 +164,8 @@ function createPostData({ versionType, compilerVersion }, manifestJson, updateCa
164
164
  }
165
165
  Object.keys(updateCache).forEach((name) => {
166
166
  const value = updateCache[name];
167
- if (shared_1.isPlainObject(value) &&
168
- (shared_1.hasOwn(value, 'dev') || shared_1.hasOwn(value, 'build'))) {
167
+ if ((0, shared_1.isPlainObject)(value) &&
168
+ ((0, shared_1.hasOwn)(value, 'dev') || (0, shared_1.hasOwn)(value, 'build'))) {
169
169
  data[name] = value;
170
170
  }
171
171
  });
@@ -194,9 +194,9 @@ function handleCheckVersion({ code, isUpdate, newVersion, note }, updateCache) {
194
194
  const HOSTNAME = 'uniapp.dcloud.net.cn';
195
195
  const PATH = '/update/cli';
196
196
  function checkVersion(options, updateCache) {
197
- const postData = createPostData(options, json_1.parseManifestJsonOnce(options.inputDir), updateCache);
197
+ const postData = createPostData(options, (0, json_1.parseManifestJsonOnce)(options.inputDir), updateCache);
198
198
  let responseData = '';
199
- const req = https_1.request({
199
+ const req = (0, https_1.request)({
200
200
  hostname: HOSTNAME,
201
201
  path: PATH,
202
202
  port: 443,
package/dist/easycom.js CHANGED
@@ -13,7 +13,7 @@ const uni_shared_1 = require("@dcloudio/uni-shared");
13
13
  const utils_1 = require("./utils");
14
14
  const pages_1 = require("./json/pages");
15
15
  const messages_1 = require("./messages");
16
- const debugEasycom = debug_1.default('uni:easycom');
16
+ const debugEasycom = (0, debug_1.default)('uni:easycom');
17
17
  const easycoms = [];
18
18
  const easycomsCache = new Map();
19
19
  const easycomsInvalidCache = new Set();
@@ -29,7 +29,7 @@ function initEasycoms(inputDir, platform) {
29
29
  const uniModulesDir = path_1.default.resolve(inputDir, 'uni_modules');
30
30
  const initEasycomOptions = (pagesJson) => {
31
31
  // 初始化时,从once中读取缓存,refresh时,实时读取
32
- const { easycom } = pagesJson || pages_1.parsePagesJson(inputDir, platform, false);
32
+ const { easycom } = pagesJson || (0, pages_1.parsePagesJson)(inputDir, platform, false);
33
33
  const easycomOptions = {
34
34
  dirs: easycom && easycom.autoscan === false
35
35
  ? [buildInComponentsDir] // 禁止自动扫描
@@ -45,11 +45,11 @@ function initEasycoms(inputDir, platform) {
45
45
  debugEasycom(easycomOptions);
46
46
  return easycomOptions;
47
47
  };
48
- const options = initEasycomOptions(pages_1.parsePagesJsonOnce(inputDir, platform));
48
+ const options = initEasycomOptions((0, pages_1.parsePagesJsonOnce)(inputDir, platform));
49
49
  initEasycom(options);
50
50
  const res = {
51
51
  options,
52
- filter: pluginutils_1.createFilter(['components/*/*.vue', 'uni_modules/*/components/*/*.vue'], [], {
52
+ filter: (0, pluginutils_1.createFilter)(['components/*/*.vue', 'uni_modules/*/components/*/*.vue'], [], {
53
53
  resolve: inputDir,
54
54
  }),
55
55
  refresh() {
@@ -61,7 +61,7 @@ function initEasycoms(inputDir, platform) {
61
61
  return res;
62
62
  }
63
63
  exports.initEasycoms = initEasycoms;
64
- exports.initEasycomsOnce = uni_shared_1.once(initEasycoms);
64
+ exports.initEasycomsOnce = (0, uni_shared_1.once)(initEasycoms);
65
65
  function initUniModulesEasycomDirs(uniModulesDir) {
66
66
  if (!fs_1.default.existsSync(uniModulesDir)) {
67
67
  return [];
@@ -80,13 +80,13 @@ function initEasycom({ dirs, rootDir, custom, extensions = ['.vue'], }) {
80
80
  clearEasycom();
81
81
  const easycomsObj = Object.create(null);
82
82
  if (dirs && dirs.length && rootDir) {
83
- shared_1.extend(easycomsObj, initAutoScanEasycoms(dirs, rootDir, extensions));
83
+ (0, shared_1.extend)(easycomsObj, initAutoScanEasycoms(dirs, rootDir, extensions));
84
84
  }
85
85
  if (custom) {
86
86
  Object.keys(custom).forEach((name) => {
87
87
  const componentPath = custom[name];
88
88
  easycomsObj[name] = componentPath.startsWith('@/')
89
- ? utils_1.normalizePath(path_1.default.join(rootDir, componentPath.substr(2)))
89
+ ? (0, utils_1.normalizePath)(path_1.default.join(rootDir, componentPath.substr(2)))
90
90
  : componentPath;
91
91
  });
92
92
  }
@@ -136,7 +136,7 @@ function initAutoScanEasycom(dir, rootDir, extensions) {
136
136
  if (!isDir(folder)) {
137
137
  return;
138
138
  }
139
- const importDir = utils_1.normalizePath(folder);
139
+ const importDir = (0, utils_1.normalizePath)(folder);
140
140
  const files = fs_1.default.readdirSync(folder);
141
141
  // 读取文件夹文件列表,比对文件名(fs.existsSync在大小写不敏感的系统会匹配不准确)
142
142
  for (let i = 0; i < extensions.length; i++) {
@@ -176,5 +176,5 @@ function initAutoScanEasycoms(dirs, rootDir, extensions) {
176
176
  return res;
177
177
  }
178
178
  function normalizeCompath(compath, rootDir) {
179
- return utils_1.normalizePath(path_1.default.relative(rootDir, compath));
179
+ return (0, utils_1.normalizePath)(path_1.default.relative(rootDir, compath));
180
180
  }
@@ -4,8 +4,8 @@ exports.initDefine = void 0;
4
4
  const env_1 = require("../hbx/env");
5
5
  const json_1 = require("../json");
6
6
  function initDefine(stringifyBoolean = false) {
7
- const manifestJson = json_1.parseManifestJsonOnce(process.env.UNI_INPUT_DIR);
8
- const isRunByHBuilderX = env_1.runByHBuilderX();
7
+ const manifestJson = (0, json_1.parseManifestJsonOnce)(process.env.UNI_INPUT_DIR);
8
+ const isRunByHBuilderX = (0, env_1.runByHBuilderX)();
9
9
  return {
10
10
  'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
11
11
  'process.env.UNI_APP_ID': JSON.stringify(manifestJson.appid || ''),
package/dist/hbx/alias.js CHANGED
@@ -15,7 +15,7 @@ const hbxPlugins = {
15
15
  // pug: 'compile-pug-cli/node_modules/pug',
16
16
  };
17
17
  function initModuleAlias() {
18
- if (env_1.isInHBuilderX()) {
18
+ if ((0, env_1.isInHBuilderX)()) {
19
19
  Object.keys(hbxPlugins).forEach((name) => {
20
20
  module_alias_1.default.addAlias(name, path_1.default.resolve(process.env.UNI_HBUILDERX_PLUGINS, hbxPlugins[name]));
21
21
  });
package/dist/hbx/env.js CHANGED
@@ -7,7 +7,7 @@ exports.initModulePaths = exports.runByHBuilderX = exports.isInHBuilderX = void
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const module_1 = __importDefault(require("module"));
9
9
  const uni_shared_1 = require("@dcloudio/uni-shared");
10
- exports.isInHBuilderX = uni_shared_1.once(() => {
10
+ exports.isInHBuilderX = (0, uni_shared_1.once)(() => {
11
11
  try {
12
12
  const { name } = require(path_1.default.resolve(process.cwd(), '../about/package.json'));
13
13
  return name === 'about';
@@ -17,14 +17,14 @@ exports.isInHBuilderX = uni_shared_1.once(() => {
17
17
  }
18
18
  return false;
19
19
  });
20
- exports.runByHBuilderX = uni_shared_1.once(() => {
20
+ exports.runByHBuilderX = (0, uni_shared_1.once)(() => {
21
21
  return !!process.env.UNI_HBUILDERX_PLUGINS;
22
22
  });
23
23
  /**
24
24
  * 增加 node_modules
25
25
  */
26
26
  function initModulePaths() {
27
- if (!exports.isInHBuilderX()) {
27
+ if (!(0, exports.isInHBuilderX)()) {
28
28
  return;
29
29
  }
30
30
  const Module = module.constructor.length > 1 ? module.constructor : module_1.default;
package/dist/i18n.js CHANGED
@@ -16,7 +16,7 @@ function initI18nOptions(platform, inputDir, warning = false, withMessages = tru
16
16
  if (!Object.keys(locales).length) {
17
17
  return;
18
18
  }
19
- const manifestJson = json_1.parseManifestJsonOnce(inputDir);
19
+ const manifestJson = (0, json_1.parseManifestJsonOnce)(inputDir);
20
20
  const fallbackLocale = manifestJson.fallbackLocale || manifestJson.locale;
21
21
  const locale = resolveI18nLocale(platform, Object.keys(locales), fallbackLocale);
22
22
  if (warning) {
@@ -34,7 +34,7 @@ function initI18nOptions(platform, inputDir, warning = false, withMessages = tru
34
34
  };
35
35
  }
36
36
  exports.initI18nOptions = initI18nOptions;
37
- exports.initI18nOptionsOnce = uni_shared_1.once(initI18nOptions);
37
+ exports.initI18nOptionsOnce = (0, uni_shared_1.once)(initI18nOptions);
38
38
  const localeJsonRE = /uni-app.*.json/;
39
39
  function isUniAppLocaleFile(filepath) {
40
40
  if (!filepath) {
@@ -44,14 +44,14 @@ function isUniAppLocaleFile(filepath) {
44
44
  }
45
45
  exports.isUniAppLocaleFile = isUniAppLocaleFile;
46
46
  function parseLocaleJson(filepath) {
47
- let jsonObj = json_1.parseJson(fs_1.default.readFileSync(filepath, 'utf8'));
47
+ let jsonObj = (0, json_1.parseJson)(fs_1.default.readFileSync(filepath, 'utf8'));
48
48
  if (isUniAppLocaleFile(filepath)) {
49
49
  jsonObj = jsonObj.common || {};
50
50
  }
51
51
  return jsonObj;
52
52
  }
53
53
  function getLocaleFiles(cwd) {
54
- return fast_glob_1.sync('*.json', { cwd, absolute: true });
54
+ return (0, fast_glob_1.sync)('*.json', { cwd, absolute: true });
55
55
  }
56
56
  exports.getLocaleFiles = getLocaleFiles;
57
57
  function initLocales(dir, withMessages = true) {
@@ -65,7 +65,7 @@ function initLocales(dir, withMessages = true) {
65
65
  .basename(filename)
66
66
  .replace(/(uni-app.)?(.*).json/, '$2');
67
67
  if (withMessages) {
68
- shared_1.extend(res[locale] || (res[locale] = {}), parseLocaleJson(path_1.default.join(dir, filename)));
68
+ (0, shared_1.extend)(res[locale] || (res[locale] = {}), parseLocaleJson(path_1.default.join(dir, filename)));
69
69
  }
70
70
  else {
71
71
  res[locale] = {};
@@ -4,9 +4,9 @@ exports.initI18n = void 0;
4
4
  const uni_i18n_1 = require("@dcloudio/uni-i18n");
5
5
  const i18n_1 = require("../../../i18n");
6
6
  function initI18n(manifestJson) {
7
- const i18nOptions = i18n_1.initI18nOptions(process.env.UNI_PLATFORM, process.env.UNI_INPUT_DIR, true);
7
+ const i18nOptions = (0, i18n_1.initI18nOptions)(process.env.UNI_PLATFORM, process.env.UNI_INPUT_DIR, true);
8
8
  if (i18nOptions) {
9
- manifestJson = JSON.parse(uni_i18n_1.compileI18nJsonStr(JSON.stringify(manifestJson), i18nOptions));
9
+ manifestJson = JSON.parse((0, uni_i18n_1.compileI18nJsonStr)(JSON.stringify(manifestJson), i18nOptions));
10
10
  manifestJson.fallbackLocale = i18nOptions.locale;
11
11
  }
12
12
  return manifestJson;
@@ -25,17 +25,17 @@ const launchwebview_1 = require("./launchwebview");
25
25
  const tabBar_1 = require("./tabBar");
26
26
  const i18n_1 = require("./i18n");
27
27
  function normalizeAppManifestJson(userManifestJson, pagesJson) {
28
- const manifestJson = merge_1.initRecursiveMerge(statusbar_1.initAppStatusbar(defaultManifestJson_1.initDefaultManifestJson(), pagesJson), userManifestJson);
29
- arguments_1.initArguments(manifestJson, pagesJson);
30
- plus_1.initPlus(manifestJson, pagesJson);
31
- nvue_1.initNVue(manifestJson, pagesJson);
32
- safearea_1.initSafearea(manifestJson, pagesJson);
33
- splashscreen_1.initSplashscreen(manifestJson, userManifestJson);
34
- confusion_1.initConfusion(manifestJson);
35
- uniApp_1.initUniApp(manifestJson);
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
36
  // 依赖 initArguments 先执行
37
- tabBar_1.initTabBar(launchwebview_1.initLaunchwebview(manifestJson, pagesJson), manifestJson, pagesJson);
38
- return i18n_1.initI18n(manifestJson);
37
+ (0, tabBar_1.initTabBar)((0, launchwebview_1.initLaunchwebview)(manifestJson, pagesJson), manifestJson, pagesJson);
38
+ return (0, i18n_1.initI18n)(manifestJson);
39
39
  }
40
40
  exports.normalizeAppManifestJson = normalizeAppManifestJson;
41
41
  __exportStar(require("./env"), exports);
@@ -15,7 +15,7 @@ function initLaunchwebview(manifestJson, pagesJson) {
15
15
  catch (e) { }
16
16
  }
17
17
  manifestJson.plus.useragent.value = 'uni-app';
18
- shared_1.extend(manifestJson.plus.launchwebview, {
18
+ (0, shared_1.extend)(manifestJson.plus.launchwebview, {
19
19
  id: '1',
20
20
  kernel: 'WKWebview',
21
21
  });
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.initRecursiveMerge = void 0;
4
4
  const merge_1 = require("merge");
5
5
  function initRecursiveMerge(manifestJson, userManifestJson) {
6
- return merge_1.recursive(true, manifestJson, {
6
+ return (0, merge_1.recursive)(true, manifestJson, {
7
7
  id: userManifestJson.appid || '',
8
8
  name: userManifestJson.name || '',
9
9
  description: userManifestJson.description || '',
@@ -8,7 +8,7 @@ function initSplashscreen(manifestJson, userManifestJson) {
8
8
  }
9
9
  // 强制白屏检测
10
10
  const splashscreenOptions = userManifestJson['app-plus'] && userManifestJson['app-plus'].splashscreen;
11
- const hasAlwaysShowBeforeRender = splashscreenOptions && shared_1.hasOwn(splashscreenOptions, 'alwaysShowBeforeRender');
11
+ const hasAlwaysShowBeforeRender = splashscreenOptions && (0, shared_1.hasOwn)(splashscreenOptions, 'alwaysShowBeforeRender');
12
12
  if (!hasAlwaysShowBeforeRender &&
13
13
  manifestJson.plus.splashscreen.autoclose === false) {
14
14
  // 兼容旧版本仅配置了 autoclose 为 false
@@ -7,10 +7,10 @@ function initUniApp(manifestJson) {
7
7
  control: 'uni-v3',
8
8
  vueVersion: '3',
9
9
  compilerVersion: process.env.UNI_COMPILER_VERSION,
10
- nvueCompiler: nvue_1.getNVueCompiler(manifestJson),
10
+ nvueCompiler: (0, nvue_1.getNVueCompiler)(manifestJson),
11
11
  renderer: 'auto',
12
12
  nvue: {
13
- 'flex-direction': nvue_1.getNVueFlexDirection(manifestJson),
13
+ 'flex-direction': (0, nvue_1.getNVueFlexDirection)(manifestJson),
14
14
  },
15
15
  nvueLaunchMode: manifestJson.plus.nvueLaunchMode === 'fast' ? 'fast' : 'normal',
16
16
  };
@@ -10,8 +10,8 @@ function definePageCode(pagesJson) {
10
10
  return;
11
11
  }
12
12
  const pagePath = page.path;
13
- const pageIdentifier = utils_1.normalizeIdentifier(pagePath);
14
- const pagePathWithExtname = utils_1.normalizePagePath(pagePath, 'app');
13
+ const pageIdentifier = (0, utils_1.normalizeIdentifier)(pagePath);
14
+ const pagePathWithExtname = (0, utils_1.normalizePagePath)(pagePath, 'app');
15
15
  if (pagePathWithExtname) {
16
16
  if (process.env.UNI_APP_CODE_SPLITING) {
17
17
  // 拆分页面
@@ -17,15 +17,15 @@ const uniConfig_1 = require("./uniConfig");
17
17
  const uniRoutes_1 = require("./uniRoutes");
18
18
  __exportStar(require("./nvue"), exports);
19
19
  function normalizeAppPagesJson(pagesJson) {
20
- return code_1.polyfillCode + code_1.restoreGlobalCode + definePage_1.definePageCode(pagesJson);
20
+ return code_1.polyfillCode + code_1.restoreGlobalCode + (0, definePage_1.definePageCode)(pagesJson);
21
21
  }
22
22
  exports.normalizeAppPagesJson = normalizeAppPagesJson;
23
23
  function normalizeAppConfigService(pagesJson, manifestJson) {
24
24
  return `
25
25
  ;(function(){
26
26
  let u=void 0,isReady=false,onReadyCallbacks=[],isServiceReady=false,onServiceReadyCallbacks=[];
27
- const __uniConfig = ${uniConfig_1.normalizeAppUniConfig(pagesJson, manifestJson)};
28
- const __uniRoutes = ${uniRoutes_1.normalizeAppUniRoutes(pagesJson)}.map(uniRoute=>(uniRoute.meta.route=uniRoute.path,__uniConfig.pages.push(uniRoute.path),uniRoute.path='/'+uniRoute.path,uniRoute));
27
+ const __uniConfig = ${(0, uniConfig_1.normalizeAppUniConfig)(pagesJson, manifestJson)};
28
+ const __uniRoutes = ${(0, uniRoutes_1.normalizeAppUniRoutes)(pagesJson)}.map(uniRoute=>(uniRoute.meta.route=uniRoute.path,__uniConfig.pages.push(uniRoute.path),uniRoute.path='/'+uniRoute.path,uniRoute));
29
29
  __uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
30
30
  __uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
31
31
  service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,${code_1.globalCode}}}}});
@@ -20,7 +20,7 @@ function initWebpackNVueEntry(pages) {
20
20
  if (!path) {
21
21
  return;
22
22
  }
23
- const subNVuePath = utils_1.removeExt(path.split('?')[0]);
23
+ const subNVuePath = (0, utils_1.removeExt)(path.split('?')[0]);
24
24
  process.UNI_NVUE_ENTRY[subNVuePath] = genWebpackBase64Code(genNVueEntryCode(subNVuePath));
25
25
  });
26
26
  });
@@ -31,7 +31,7 @@ function genWebpackBase64Code(code) {
31
31
  }
32
32
  function genNVueEntryCode(route) {
33
33
  return `import '${genWebpackBase64Code(genNVueAppStyle())}'
34
- import App from '${utils_1.normalizePath(path_1.default.resolve(process.env.UNI_INPUT_DIR, route))}.nvue?mpType=page'
34
+ import App from '${(0, utils_1.normalizePath)(path_1.default.resolve(process.env.UNI_INPUT_DIR, route))}.nvue?mpType=page'
35
35
  if (typeof Promise !== 'undefined' && !Promise.prototype.finally) {
36
36
  Promise.prototype.finally = function(callback) {
37
37
  var promise = this.constructor
@@ -70,7 +70,7 @@ function genNVueAppStyle() {
70
70
  const stringifyRequest = (r) => loaderUtils.stringifyRequest({}, r);
71
71
  styles.forEach((style, index) => {
72
72
  if (!style.src) {
73
- style.src = utils_1.normalizePath(appVuePath);
73
+ style.src = (0, utils_1.normalizePath)(appVuePath);
74
74
  }
75
75
  code =
76
76
  code +
@@ -14,9 +14,9 @@ function normalizeAppUniConfig(pagesJson, manifestJson) {
14
14
  pages: [],
15
15
  globalStyle: pagesJson.globalStyle,
16
16
  nvue: {
17
- compiler: manifest_2.getNVueCompiler(manifestJson),
18
- styleCompiler: manifest_2.getNVueStyleCompiler(manifestJson),
19
- 'flex-direction': manifest_2.getNVueFlexDirection(manifestJson),
17
+ compiler: (0, manifest_2.getNVueCompiler)(manifestJson),
18
+ styleCompiler: (0, manifest_2.getNVueStyleCompiler)(manifestJson),
19
+ 'flex-direction': (0, manifest_2.getNVueFlexDirection)(manifestJson),
20
20
  },
21
21
  renderer: ((_a = manifestJson['app-plus']) === null || _a === void 0 ? void 0 : _a.renderer) === 'native' ? 'native' : 'auto',
22
22
  appname: manifestJson.name || '',
@@ -29,9 +29,9 @@ function normalizeAppUniConfig(pagesJson, manifestJson) {
29
29
  },
30
30
  compilerVersion: process.env.UNI_COMPILER_VERSION,
31
31
  entryPagePath: pagesJson.pages[0].path,
32
- networkTimeout: manifest_1.normalizeNetworkTimeout(manifestJson.networkTimeout),
32
+ networkTimeout: (0, manifest_1.normalizeNetworkTimeout)(manifestJson.networkTimeout),
33
33
  tabBar: pagesJson.tabBar,
34
- locales: i18n_1.initLocales(path_1.default.join(process.env.UNI_INPUT_DIR, 'locale')),
34
+ locales: (0, i18n_1.initLocales)(path_1.default.join(process.env.UNI_INPUT_DIR, 'locale')),
35
35
  };
36
36
  // TODO 待支持分包
37
37
  return JSON.stringify(config);
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeAppUniRoutes = void 0;
4
4
  const pages_1 = require("../../pages");
5
5
  function normalizeAppUniRoutes(pagesJson) {
6
- return JSON.stringify(pages_1.normalizePagesRoute(pagesJson));
6
+ return JSON.stringify((0, pages_1.normalizePagesRoute)(pagesJson));
7
7
  }
8
8
  exports.normalizeAppUniRoutes = normalizeAppUniRoutes;
package/dist/json/json.js CHANGED
@@ -4,6 +4,6 @@ exports.parseJson = void 0;
4
4
  const jsonc_parser_1 = require("jsonc-parser");
5
5
  const preprocess_1 = require("../preprocess");
6
6
  function parseJson(jsonStr, shouldPre = false) {
7
- return jsonc_parser_1.parse(shouldPre ? preprocess_1.preJson(jsonStr) : jsonStr);
7
+ return (0, jsonc_parser_1.parse)(shouldPre ? (0, preprocess_1.preJson)(jsonStr) : jsonStr);
8
8
  }
9
9
  exports.parseJson = parseJson;
@@ -10,19 +10,19 @@ const shared_1 = require("@vue/shared");
10
10
  const uni_shared_1 = require("@dcloudio/uni-shared");
11
11
  const json_1 = require("./json");
12
12
  const parseManifestJson = (inputDir) => {
13
- return json_1.parseJson(fs_1.default.readFileSync(path_1.default.join(inputDir, 'manifest.json'), 'utf8'));
13
+ return (0, json_1.parseJson)(fs_1.default.readFileSync(path_1.default.join(inputDir, 'manifest.json'), 'utf8'));
14
14
  };
15
15
  exports.parseManifestJson = parseManifestJson;
16
- exports.parseManifestJsonOnce = uni_shared_1.once(exports.parseManifestJson);
17
- exports.parseRpx2UnitOnce = uni_shared_1.once((inputDir) => {
18
- const { h5 } = exports.parseManifestJsonOnce(inputDir);
19
- return shared_1.extend({}, uni_shared_1.defaultRpx2Unit, (h5 && h5.rpx) || {});
16
+ exports.parseManifestJsonOnce = (0, uni_shared_1.once)(exports.parseManifestJson);
17
+ exports.parseRpx2UnitOnce = (0, uni_shared_1.once)((inputDir) => {
18
+ const { h5 } = (0, exports.parseManifestJsonOnce)(inputDir);
19
+ return (0, shared_1.extend)({}, uni_shared_1.defaultRpx2Unit, (h5 && h5.rpx) || {});
20
20
  });
21
21
  function parseCompatConfig(_inputDir) {
22
22
  // 不支持 mode:2
23
23
  return { MODE: 3 }; //parseManifestJsonOnce(inputDir).compatConfig || {}
24
24
  }
25
- exports.parseCompatConfigOnce = uni_shared_1.once(parseCompatConfig);
25
+ exports.parseCompatConfigOnce = (0, uni_shared_1.once)(parseCompatConfig);
26
26
  const defaultNetworkTimeout = {
27
27
  request: 60000,
28
28
  connectSocket: 60000,
@@ -37,12 +37,12 @@ function normalizeNetworkTimeout(networkTimeout) {
37
37
  }
38
38
  exports.normalizeNetworkTimeout = normalizeNetworkTimeout;
39
39
  function getUniStatistics(inputDir, platform) {
40
- const manifest = exports.parseManifestJsonOnce(inputDir);
41
- return shared_1.extend({}, manifest.uniStatistics, manifest[platform] && manifest[platform].uniStatistics);
40
+ const manifest = (0, exports.parseManifestJsonOnce)(inputDir);
41
+ return (0, shared_1.extend)({}, manifest.uniStatistics, manifest[platform] && manifest[platform].uniStatistics);
42
42
  }
43
43
  exports.getUniStatistics = getUniStatistics;
44
44
  function getRouterOptions(manifestJson) {
45
45
  var _a;
46
- return shared_1.extend({}, (_a = manifestJson.h5) === null || _a === void 0 ? void 0 : _a.router);
46
+ return (0, shared_1.extend)({}, (_a = manifestJson.h5) === null || _a === void 0 ? void 0 : _a.router);
47
47
  }
48
48
  exports.getRouterOptions = getRouterOptions;
@@ -16,10 +16,10 @@ const parsePagesJson = (inputDir, platform, normalize = true) => {
16
16
  if (normalize) {
17
17
  return normalizePagesJson(jsonStr, platform);
18
18
  }
19
- return json_1.parseJson(jsonStr, true);
19
+ return (0, json_1.parseJson)(jsonStr, true);
20
20
  };
21
21
  exports.parsePagesJson = parsePagesJson;
22
- exports.parsePagesJsonOnce = uni_shared_1.once(exports.parsePagesJson);
22
+ exports.parsePagesJsonOnce = (0, uni_shared_1.once)(exports.parsePagesJson);
23
23
  function normalizePagesJson(jsonStr, platform) {
24
24
  let pagesJson = {
25
25
  pages: [],
@@ -29,7 +29,7 @@ function normalizePagesJson(jsonStr, platform) {
29
29
  };
30
30
  // preprocess
31
31
  try {
32
- pagesJson = json_1.parseJson(jsonStr, true);
32
+ pagesJson = (0, json_1.parseJson)(jsonStr, true);
33
33
  }
34
34
  catch (e) {
35
35
  console.error(`[vite] Error: pages.json parse failed.\n`, jsonStr, e);
@@ -41,13 +41,13 @@ function normalizePagesJson(jsonStr, platform) {
41
41
  // pageStyle
42
42
  normalizePages(pagesJson.pages, platform);
43
43
  if (platform === 'app' && process.env.UNI_NVUE_COMPILER !== 'vue') {
44
- pages_1.initWebpackNVueEntry(pagesJson.pages);
44
+ (0, pages_1.initWebpackNVueEntry)(pagesJson.pages);
45
45
  }
46
46
  // globalStyle
47
47
  pagesJson.globalStyle = normalizePageStyle(null, pagesJson.globalStyle, platform);
48
48
  // tabBar
49
49
  if (pagesJson.tabBar) {
50
- const tabBar = normalizeTabBar(pagesJson.tabBar);
50
+ const tabBar = normalizeTabBar(pagesJson.tabBar, platform);
51
51
  if (tabBar) {
52
52
  pagesJson.tabBar = tabBar;
53
53
  }
@@ -79,7 +79,7 @@ function normalizeSubpackages(subpackages) {
79
79
  subpackages.forEach(({ root, pages: subPages }) => {
80
80
  if (root && subPages.length) {
81
81
  subPages.forEach((subPage) => {
82
- subPage.path = utils_1.normalizePath(path_1.default.join(root, subPage.path));
82
+ subPage.path = (0, utils_1.normalizePath)(path_1.default.join(root, subPage.path));
83
83
  subPage.style = normalizeSubpackageSubNVues(root, subPage.style);
84
84
  pages.push(subPage);
85
85
  });
@@ -96,7 +96,7 @@ function normalizeSubpackageSubNVues(root, style) {
96
96
  if (Array.isArray(platformStyle.subNVues)) {
97
97
  platformStyle.subNVues.forEach((subNVue) => {
98
98
  if (subNVue.path) {
99
- subNVue.path = utils_1.normalizePath(path_1.default.join(root, subNVue.path));
99
+ subNVue.path = (0, utils_1.normalizePath)(path_1.default.join(root, subNVue.path));
100
100
  }
101
101
  });
102
102
  }
@@ -111,13 +111,13 @@ function normalizePageStyle(pagePath, pageStyle, platform) {
111
111
  : undefined;
112
112
  if (pageStyle) {
113
113
  if (platform === 'h5') {
114
- shared_1.extend(pageStyle, pageStyle['app'] || pageStyle['app-plus']);
114
+ (0, shared_1.extend)(pageStyle, pageStyle['app'] || pageStyle['app-plus']);
115
115
  }
116
116
  if (platform === 'app') {
117
- shared_1.extend(pageStyle, pageStyle['app'] || pageStyle['app-plus']);
117
+ (0, shared_1.extend)(pageStyle, pageStyle['app'] || pageStyle['app-plus']);
118
118
  }
119
119
  else {
120
- shared_1.extend(pageStyle, pageStyle[platform]);
120
+ (0, shared_1.extend)(pageStyle, pageStyle[platform]);
121
121
  }
122
122
  if (['h5', 'app'].includes(platform)) {
123
123
  pageStyle.navigationBar = normalizeNavigationBar(pageStyle);
@@ -143,21 +143,21 @@ const navigationBarMaps = {
143
143
  function normalizeNavigationBar(pageStyle) {
144
144
  const navigationBar = Object.create(null);
145
145
  Object.keys(navigationBarMaps).forEach((name) => {
146
- if (shared_1.hasOwn(pageStyle, name)) {
146
+ if ((0, shared_1.hasOwn)(pageStyle, name)) {
147
147
  navigationBar[navigationBarMaps[name]] =
148
148
  pageStyle[name];
149
149
  delete pageStyle[name];
150
150
  }
151
151
  });
152
152
  const { titleNView } = pageStyle;
153
- if (shared_1.isPlainObject(titleNView)) {
154
- shared_1.extend(navigationBar, titleNView);
153
+ if ((0, shared_1.isPlainObject)(titleNView)) {
154
+ (0, shared_1.extend)(navigationBar, titleNView);
155
155
  delete pageStyle.titleNView;
156
156
  }
157
157
  else if (titleNView === false) {
158
158
  navigationBar.style = 'custom';
159
159
  }
160
- if (shared_1.hasOwn(navigationBar, 'transparentTitle')) {
160
+ if ((0, shared_1.hasOwn)(navigationBar, 'transparentTitle')) {
161
161
  const transparentTitle = navigationBar.transparentTitle;
162
162
  if (transparentTitle === 'always') {
163
163
  navigationBar.style = 'custom';
@@ -174,7 +174,7 @@ function normalizeNavigationBar(pageStyle) {
174
174
  if (navigationBar.titleImage && navigationBar.titleText) {
175
175
  delete navigationBar.titleText;
176
176
  }
177
- if (!navigationBar.titleColor && shared_1.hasOwn(navigationBar, 'textStyle')) {
177
+ if (!navigationBar.titleColor && (0, shared_1.hasOwn)(navigationBar, 'textStyle')) {
178
178
  navigationBar.titleColor =
179
179
  navigationBar.textStyle === 'black' ? '#000000' : '#ffffff';
180
180
  delete navigationBar.textStyle;
@@ -184,10 +184,10 @@ function normalizeNavigationBar(pageStyle) {
184
184
  navigationBar.shadowColorType = pageStyle.navigationBarShadow.colorType;
185
185
  delete pageStyle.navigationBarShadow;
186
186
  }
187
- if (shared_1.isArray(navigationBar.buttons)) {
187
+ if ((0, shared_1.isArray)(navigationBar.buttons)) {
188
188
  navigationBar.buttons = navigationBar.buttons.map((btn) => normalizeNavigationBarButton(btn, navigationBar.type, navigationBar.titleColor));
189
189
  }
190
- if (shared_1.isPlainObject(navigationBar.searchInput)) {
190
+ if ((0, shared_1.isPlainObject)(navigationBar.searchInput)) {
191
191
  navigationBar.searchInput = normalizeNavigationBarSearchInput(navigationBar.searchInput);
192
192
  }
193
193
  if (navigationBar.type === 'transparent') {
@@ -210,7 +210,7 @@ function normalizeNavigationBarButton(btn, type, titleColor) {
210
210
  return btn;
211
211
  }
212
212
  function normalizeNavigationBarSearchInput(searchInput) {
213
- return shared_1.extend({
213
+ return (0, shared_1.extend)({
214
214
  autoFocus: false,
215
215
  align: 'center',
216
216
  color: '#000',
@@ -232,23 +232,25 @@ const DEFAULT_TAB_BAR = {
232
232
  spacing: '3px',
233
233
  height: uni_shared_1.TABBAR_HEIGHT + 'px',
234
234
  };
235
- function normalizeTabBar(tabBar) {
235
+ function normalizeTabBar(tabBar, platform) {
236
236
  const { list, midButton } = tabBar;
237
237
  if (!list || !list.length) {
238
238
  return;
239
239
  }
240
- tabBar = shared_1.extend({}, DEFAULT_TAB_BAR, tabBar);
241
- const len = list.length;
242
- if (len % 2 === 0 && shared_1.isPlainObject(midButton)) {
243
- list.splice(Math.floor(len / 2), 0, shared_1.extend({
244
- type: 'midButton',
245
- width: '50px',
246
- height: '50px',
247
- iconWidth: '24px',
248
- }, midButton));
249
- }
250
- else {
251
- delete tabBar.midButton;
240
+ tabBar = (0, shared_1.extend)({}, DEFAULT_TAB_BAR, tabBar);
241
+ if (platform === 'h5') {
242
+ const len = list.length;
243
+ if (len % 2 === 0 && (0, shared_1.isPlainObject)(midButton)) {
244
+ list.splice(Math.floor(len / 2), 0, (0, shared_1.extend)({
245
+ type: 'midButton',
246
+ width: '50px',
247
+ height: '50px',
248
+ iconWidth: '24px',
249
+ }, midButton));
250
+ }
251
+ else {
252
+ delete tabBar.midButton;
253
+ }
252
254
  }
253
255
  list.forEach((item) => {
254
256
  if (item.iconPath) {
@@ -292,7 +294,7 @@ function normalizePagesRoute(pagesJson) {
292
294
  const tabBarIndex = tabBarList.findIndex((tabBarPage) => tabBarPage.pagePath === pagePath);
293
295
  const isTabBar = tabBarIndex !== -1 ? true : undefined;
294
296
  let windowTop = 0;
295
- const meta = shared_1.extend({
297
+ const meta = (0, shared_1.extend)({
296
298
  isQuit: isEntry || isTabBar ? true : undefined,
297
299
  isEntry: isEntry || undefined,
298
300
  isTabBar: isTabBar || undefined,