@dcloudio/uni-cli-shared 3.0.0-alpha-3061220221207002 → 3.0.0-alpha-3061420221219001

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/easycom.js CHANGED
@@ -7,6 +7,7 @@ exports.UNI_EASYCOM_EXCLUDE = exports.genResolveEasycomCode = exports.addImportD
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const debug_1 = __importDefault(require("debug"));
10
+ const fast_glob_1 = __importDefault(require("fast-glob"));
10
11
  const shared_1 = require("@vue/shared");
11
12
  const pluginutils_1 = require("@rollup/pluginutils");
12
13
  const uni_shared_1 = require("@dcloudio/uni-shared");
@@ -25,6 +26,7 @@ function clearEasycom() {
25
26
  }
26
27
  function initEasycoms(inputDir, { dirs, platform }) {
27
28
  const componentsDir = path_1.default.resolve(inputDir, 'components');
29
+ const utssdkDir = path_1.default.resolve(inputDir, 'utssdk');
28
30
  const uniModulesDir = path_1.default.resolve(inputDir, 'uni_modules');
29
31
  const initEasycomOptions = (pagesJson) => {
30
32
  // 初始化时,从once中读取缓存,refresh时,实时读取
@@ -36,7 +38,17 @@ function initEasycoms(inputDir, { dirs, platform }) {
36
38
  ...dirs,
37
39
  componentsDir,
38
40
  ...initUniModulesEasycomDirs(uniModulesDir),
39
- ],
41
+ ]
42
+ .concat(platform === 'app'
43
+ ? initUniModulesUTSSDKDirs(uniModulesDir)
44
+ : [])
45
+ .concat(platform === 'app' && fs_1.default.existsSync(utssdkDir)
46
+ ? fast_glob_1.default.sync('*', {
47
+ cwd: utssdkDir,
48
+ absolute: true,
49
+ onlyDirectories: true,
50
+ })
51
+ : []),
40
52
  rootDir: inputDir,
41
53
  autoscan: !!(easycom && easycom.autoscan),
42
54
  custom: (easycom && easycom.custom) || {},
@@ -51,6 +63,8 @@ function initEasycoms(inputDir, { dirs, platform }) {
51
63
  filter: (0, pluginutils_1.createFilter)([
52
64
  'components/*/*.(vue|jsx|tsx)',
53
65
  'uni_modules/*/components/*/*.(vue|jsx|tsx)',
66
+ 'utssdk/*/**/*.vue',
67
+ 'uni_modules/*/utssdk/*/*.vue',
54
68
  ], [], {
55
69
  resolve: inputDir,
56
70
  }),
@@ -78,6 +92,20 @@ function initUniModulesEasycomDirs(uniModulesDir) {
78
92
  })
79
93
  .filter(Boolean);
80
94
  }
95
+ function initUniModulesUTSSDKDirs(uniModulesDir) {
96
+ if (!fs_1.default.existsSync(uniModulesDir)) {
97
+ return [];
98
+ }
99
+ return fs_1.default
100
+ .readdirSync(uniModulesDir)
101
+ .map((uniModuleDir) => {
102
+ const uniModuleComponentsDir = path_1.default.resolve(uniModulesDir, uniModuleDir, 'utssdk');
103
+ if (fs_1.default.existsSync(uniModuleComponentsDir)) {
104
+ return uniModuleComponentsDir;
105
+ }
106
+ })
107
+ .filter(Boolean);
108
+ }
81
109
  function initEasycom({ dirs, rootDir, custom, extensions = ['.vue', '.jsx', '.tsx'], }) {
82
110
  clearEasycom();
83
111
  const easycomsObj = Object.create(null);
@@ -133,24 +161,55 @@ function initAutoScanEasycom(dir, rootDir, extensions) {
133
161
  if (!fs_1.default.existsSync(dir)) {
134
162
  return easycoms;
135
163
  }
136
- fs_1.default.readdirSync(dir).forEach((name) => {
137
- const folder = path_1.default.resolve(dir, name);
138
- if (!isDir(folder)) {
139
- return;
140
- }
141
- const importDir = (0, utils_1.normalizePath)(folder);
142
- const files = fs_1.default.readdirSync(folder);
143
- // 读取文件夹文件列表,比对文件名(fs.existsSync在大小写不敏感的系统会匹配不准确)
144
- for (let i = 0; i < extensions.length; i++) {
145
- const ext = extensions[i];
146
- if (files.includes(name + ext)) {
147
- easycoms[`^${name}$`] = `${importDir}/${name}${ext}`;
148
- break;
164
+ const is_uni_modules_utssdk = dir.endsWith('utssdk');
165
+ const is_ussdk = !is_uni_modules_utssdk && path_1.default.dirname(dir).endsWith('utssdk');
166
+ if (is_uni_modules_utssdk || is_ussdk) {
167
+ fast_glob_1.default
168
+ .sync('**/*.vue', {
169
+ cwd: dir,
170
+ absolute: true,
171
+ })
172
+ .forEach((file) => {
173
+ let name = parseVueComponentName(file);
174
+ if (!name) {
175
+ if (file.endsWith('index.vue')) {
176
+ name = path_1.default.basename(is_uni_modules_utssdk ? path_1.default.dirname(dir) : dir);
177
+ }
149
178
  }
150
- }
151
- });
179
+ if (name) {
180
+ const importDir = (0, utils_1.normalizePath)(is_uni_modules_utssdk ? path_1.default.dirname(dir) : dir);
181
+ easycoms[`^${name}$`] = `\0${importDir}?uts-proxy`;
182
+ }
183
+ });
184
+ }
185
+ else {
186
+ fs_1.default.readdirSync(dir).forEach((name) => {
187
+ const folder = path_1.default.resolve(dir, name);
188
+ if (!isDir(folder)) {
189
+ return;
190
+ }
191
+ const importDir = (0, utils_1.normalizePath)(folder);
192
+ const files = fs_1.default.readdirSync(folder);
193
+ // 读取文件夹文件列表,比对文件名(fs.existsSync在大小写不敏感的系统会匹配不准确)
194
+ for (let i = 0; i < extensions.length; i++) {
195
+ const ext = extensions[i];
196
+ if (files.includes(name + ext)) {
197
+ easycoms[`^${name}$`] = `${importDir}/${name}${ext}`;
198
+ break;
199
+ }
200
+ }
201
+ });
202
+ }
152
203
  return easycoms;
153
204
  }
205
+ const nameRE = /name\s*:\s*['|"](.*)['|"]/;
206
+ function parseVueComponentName(file) {
207
+ const content = fs_1.default.readFileSync(file, 'utf8');
208
+ const matches = content.match(nameRE);
209
+ if (matches) {
210
+ return matches[1];
211
+ }
212
+ }
154
213
  function initAutoScanEasycoms(dirs, rootDir, extensions) {
155
214
  const conflict = {};
156
215
  const res = dirs.reduce((easycoms, dir) => {
@@ -187,7 +246,7 @@ function addImportDeclaration(importDeclarations, local, source, imported) {
187
246
  exports.addImportDeclaration = addImportDeclaration;
188
247
  function createImportDeclaration(local, source, imported) {
189
248
  if (imported) {
190
- return `import {${imported} as ${local}} from '${source}';`;
249
+ return `import { ${imported} as ${local} } from '${source}';`;
191
250
  }
192
251
  return `import ${local} from '${source}';`;
193
252
  }
@@ -114,7 +114,7 @@ function parsePagesJson(jsonStr, platform, { debug, darkmode, networkTimeout, su
114
114
  }
115
115
  }
116
116
  ;
117
- ['preloadRule', 'workers', 'plugins'].forEach((name) => {
117
+ ['preloadRule', 'workers', 'plugins', 'entryPagePath'].forEach((name) => {
118
118
  if ((0, shared_1.hasOwn)(pagesJson, name)) {
119
119
  appJson[name] = pagesJson[name];
120
120
  }
@@ -305,7 +305,7 @@ function normalizeNavigationBar(pageStyle) {
305
305
  return navigationBar;
306
306
  }
307
307
  function normalizeNavigationBarButton(btn, type, titleColor) {
308
- btn.color = type === 'transparent' ? '#ffffff' : btn.color || titleColor;
308
+ btn.color = btn.color || titleColor;
309
309
  if (!btn.fontSize) {
310
310
  btn.fontSize =
311
311
  type === 'transparent' || (btn.text && /\\u/.test(btn.text))
package/lib/.DS_Store ADDED
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "3.0.0-alpha-3061220221207002",
3
+ "version": "3.0.0-alpha-3061420221219001",
4
4
  "description": "@dcloudio/uni-cli-shared",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -25,8 +25,8 @@
25
25
  "@babel/core": "^7.19.6",
26
26
  "@babel/parser": "^7.19.6",
27
27
  "@babel/types": "^7.20.0",
28
- "@dcloudio/uni-i18n": "3.0.0-alpha-3061220221207002",
29
- "@dcloudio/uni-shared": "3.0.0-alpha-3061220221207002",
28
+ "@dcloudio/uni-i18n": "3.0.0-alpha-3061420221219001",
29
+ "@dcloudio/uni-shared": "3.0.0-alpha-3061420221219001",
30
30
  "@intlify/core-base": "9.1.9",
31
31
  "@intlify/shared": "9.1.9",
32
32
  "@intlify/vue-devtools": "9.1.9",
@@ -64,7 +64,7 @@
64
64
  },
65
65
  "gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
66
66
  "devDependencies": {
67
- "@dcloudio/uni-uts-v1": "3.0.0-alpha-3061220221207002",
67
+ "@dcloudio/uni-uts-v1": "3.0.0-alpha-3061420221219001",
68
68
  "@types/babel__core": "^7.1.19",
69
69
  "@types/debug": "^4.1.7",
70
70
  "@types/estree": "^0.0.51",