@dcloudio/uni-cli-shared 3.0.0-alpha-3060420220922003 → 3.0.0-alpha-3060420220922005

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/resolve.js CHANGED
@@ -116,11 +116,12 @@ function resolveUtsAppModule(id, importer) {
116
116
  const parts = (0, utils_1.normalizePath)(id).split('/');
117
117
  const parentDir = parts[parts.length - 2];
118
118
  if (parentDir === 'uni_modules' || parentDir === 'utssdk') {
119
- if (fs_1.default.existsSync(path_1.default.resolve(id, 'index.uts'))) {
119
+ const basedir = parentDir === 'uni_modules' ? 'utssdk' : '';
120
+ if (fs_1.default.existsSync(path_1.default.resolve(id, basedir, 'index.uts'))) {
120
121
  return id;
121
122
  }
122
123
  const resolvePlatformDir = (p) => {
123
- return path_1.default.resolve(id, parentDir === 'uni_modules' ? 'utssdk' : '', p);
124
+ return path_1.default.resolve(id, basedir, p);
124
125
  };
125
126
  const extname = ['.uts'];
126
127
  if (resolveUtsFile(resolvePlatformDir('app-android'), extname)) {
@@ -150,14 +151,15 @@ function resolveUtsModule(id, importer, platform) {
150
151
  const parts = (0, utils_1.normalizePath)(id).split('/');
151
152
  const parentDir = parts[parts.length - 2];
152
153
  if (parentDir === 'uni_modules' || parentDir === 'utssdk') {
154
+ const basedir = parentDir === 'uni_modules' ? 'utssdk' : '';
153
155
  const resolvePlatformDir = (p) => {
154
- return path_1.default.resolve(id, parentDir === 'uni_modules' ? 'utssdk' : '', p);
156
+ return path_1.default.resolve(id, basedir, p);
155
157
  };
156
158
  let index = resolveUtsFile(resolvePlatformDir(platform));
157
159
  if (index) {
158
160
  return index;
159
161
  }
160
- index = path_1.default.resolve(id, 'index.uts');
162
+ index = path_1.default.resolve(id, basedir, 'index.uts');
161
163
  if (fs_1.default.existsSync(index)) {
162
164
  return index;
163
165
  }
@@ -26,36 +26,37 @@ function uniModulesExportsPlugin({ enable, }) {
26
26
  if (!enable) {
27
27
  return '';
28
28
  }
29
- const uniModulesDir = path_1.default.resolve(process.env.UNI_INPUT_DIR, 'uni_modules');
30
- if (!fs_extra_1.default.existsSync(uniModulesDir)) {
31
- return '';
32
- }
33
- const importCodes = [];
34
- const assignCodes = [];
35
- fs_extra_1.default.readdirSync(uniModulesDir).forEach((uniModuleDir) => {
36
- var _a, _b;
37
- const pkgPath = path_1.default.resolve(uniModulesDir, uniModuleDir, 'package.json');
38
- if (!fs_extra_1.default.existsSync(pkgPath)) {
39
- return;
40
- }
41
- const exports = (_b = (_a = (0, json_1.parseJson)(fs_extra_1.default.readFileSync(pkgPath, 'utf8'))) === null || _a === void 0 ? void 0 : _a.uni_modules) === null || _b === void 0 ? void 0 : _b.exports;
42
- if (exports) {
43
- const [exportsImportCodes, exportsAssignCodes] = parseExports(process.env.UNI_PLATFORM === 'h5'
44
- ? 'web'
45
- : process.env.UNI_PLATFORM, `@/uni_modules/${uniModuleDir}`, exports);
46
- importCodes.push(...exportsImportCodes);
47
- assignCodes.push(...exportsAssignCodes);
48
- }
49
- });
50
- if (!importCodes.length) {
51
- return '';
52
- }
53
- return `${importCodes.join('\n')}
54
- ${assignCodes.join('\n')}`;
29
+ return genUniModulesExports();
55
30
  },
56
31
  };
57
32
  }
58
33
  exports.uniModulesExportsPlugin = uniModulesExportsPlugin;
34
+ function genUniModulesExports() {
35
+ const uniModulesDir = path_1.default.resolve(process.env.UNI_INPUT_DIR, 'uni_modules');
36
+ if (!fs_extra_1.default.existsSync(uniModulesDir)) {
37
+ return '';
38
+ }
39
+ const importCodes = [];
40
+ const assignCodes = [];
41
+ fs_extra_1.default.readdirSync(uniModulesDir).forEach((uniModuleDir) => {
42
+ var _a, _b;
43
+ const pkgPath = path_1.default.resolve(uniModulesDir, uniModuleDir, 'package.json');
44
+ if (!fs_extra_1.default.existsSync(pkgPath)) {
45
+ return;
46
+ }
47
+ const exports = (_b = (_a = (0, json_1.parseJson)(fs_extra_1.default.readFileSync(pkgPath, 'utf8'))) === null || _a === void 0 ? void 0 : _a.uni_modules) === null || _b === void 0 ? void 0 : _b.exports;
48
+ if (exports) {
49
+ const [exportsImportCodes, exportsAssignCodes] = parseExports(process.env.UNI_PLATFORM === 'h5' ? 'web' : process.env.UNI_PLATFORM, `@/uni_modules/${uniModuleDir}`, exports);
50
+ importCodes.push(...exportsImportCodes);
51
+ assignCodes.push(...exportsAssignCodes);
52
+ }
53
+ });
54
+ if (!importCodes.length) {
55
+ return '';
56
+ }
57
+ return `${importCodes.join('\n')}
58
+ ${assignCodes.join('\n')}`;
59
+ }
59
60
  function parseExports(platform, source, exports = {}) {
60
61
  const rootDefines = {};
61
62
  Object.keys(exports).forEach((name) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "3.0.0-alpha-3060420220922003",
3
+ "version": "3.0.0-alpha-3060420220922005",
4
4
  "description": "@dcloudio/uni-cli-shared",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -25,17 +25,17 @@
25
25
  "@babel/core": "^7.18.13",
26
26
  "@babel/parser": "^7.18.13",
27
27
  "@babel/types": "^7.17.0",
28
- "@dcloudio/uni-i18n": "3.0.0-alpha-3060420220922003",
29
- "@dcloudio/uni-shared": "3.0.0-alpha-3060420220922003",
28
+ "@dcloudio/uni-i18n": "3.0.0-alpha-3060420220922005",
29
+ "@dcloudio/uni-shared": "3.0.0-alpha-3060420220922005",
30
30
  "@intlify/core-base": "9.1.9",
31
31
  "@intlify/shared": "9.1.9",
32
32
  "@intlify/vue-devtools": "9.1.9",
33
33
  "@rollup/pluginutils": "^4.2.0",
34
- "@vue/compiler-core": "3.2.39",
35
- "@vue/compiler-dom": "3.2.39",
36
- "@vue/compiler-sfc": "3.2.39",
37
- "@vue/server-renderer": "3.2.39",
38
- "@vue/shared": "3.2.39",
34
+ "@vue/compiler-core": "3.2.40",
35
+ "@vue/compiler-dom": "3.2.40",
36
+ "@vue/compiler-sfc": "3.2.40",
37
+ "@vue/server-renderer": "3.2.40",
38
+ "@vue/shared": "3.2.40",
39
39
  "autoprefixer": "^10.4.12",
40
40
  "base64url": "^3.0.1",
41
41
  "chokidar": "^3.5.3",
@@ -76,6 +76,6 @@
76
76
  "@types/sass": "^1.43.1",
77
77
  "@types/stylus": "^0.48.36",
78
78
  "postcss": "^8.4.16",
79
- "vue": "3.2.39"
79
+ "vue": "3.2.40"
80
80
  }
81
81
  }