@dcloudio/uni-cli-shared 3.0.0-alpha-3060320220919001 → 3.0.0-alpha-3060320220919002

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.
@@ -1,3 +1,3 @@
1
1
  export declare function registerPlatform(platform: string): void;
2
2
  export declare function getPlatforms(): string[];
3
- export declare function getPlatformDir(): string;
3
+ export declare function getPlatformDir(): "quickapp-webview-huawei" | "quickapp-webview-union";
package/dist/platform.js CHANGED
@@ -30,9 +30,6 @@ function getPlatforms() {
30
30
  }
31
31
  exports.getPlatforms = getPlatforms;
32
32
  function getPlatformDir() {
33
- if (process.env.UNI_PLATFORM === 'app' && process.env.UNI_APP_PLATFORM) {
34
- return process.env.UNI_PLATFORM + '-' + process.env.UNI_APP_PLATFORM;
35
- }
36
33
  return process.env.UNI_SUB_PLATFORM || process.env.UNI_PLATFORM;
37
34
  }
38
35
  exports.getPlatformDir = getPlatformDir;
@@ -55,16 +55,6 @@ function initPreContext(platform, userPreContext) {
55
55
  vueContext.APP_VUE = true;
56
56
  nvueContext.APP_NVUE = true;
57
57
  nvueContext.APP_PLUS_NVUE = true;
58
- if (process.env.UNI_APP_PLATFORM === 'android') {
59
- defaultContext.APP_ANDROID = true;
60
- }
61
- else if (process.env.UNI_APP_PLATFORM === 'ios') {
62
- defaultContext.APP_IOS = true;
63
- }
64
- else {
65
- defaultContext.APP_ANDROID = true;
66
- defaultContext.APP_IOS = true;
67
- }
68
58
  }
69
59
  else if (platform.startsWith('mp-')) {
70
60
  defaultContext.MP = true;
package/dist/resolve.d.ts CHANGED
@@ -5,4 +5,11 @@ export declare function getBuiltInPaths(): string[];
5
5
  export declare function resolveBuiltIn(path: string): string;
6
6
  export declare function resolveVueI18nRuntime(): string;
7
7
  export declare function resolveComponentsLibPath(): string;
8
+ /**
9
+ * 解析 app 平台的 uts 插件,任意平台(android|ios)存在即可
10
+ * @param id
11
+ * @param importer
12
+ * @returns
13
+ */
14
+ export declare function resolveUtsAppModule(id: string, importer: string): string | undefined;
8
15
  export declare function resolveUtsModule(id: string, importer: string, platform: typeof process.env.UNI_UTS_PLATFORM): string | undefined;
package/dist/resolve.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.resolveUtsModule = exports.resolveComponentsLibPath = exports.resolveVueI18nRuntime = exports.resolveBuiltIn = exports.getBuiltInPaths = exports.resolveMainPathOnce = exports.relativeFile = exports.requireResolve = void 0;
6
+ exports.resolveUtsModule = exports.resolveUtsAppModule = exports.resolveComponentsLibPath = exports.resolveVueI18nRuntime = exports.resolveBuiltIn = exports.getBuiltInPaths = exports.resolveMainPathOnce = exports.relativeFile = exports.requireResolve = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const debug_1 = __importDefault(require("debug"));
@@ -104,24 +104,56 @@ function resolveComponentsLibPath() {
104
104
  return componentsLibPath;
105
105
  }
106
106
  exports.resolveComponentsLibPath = resolveComponentsLibPath;
107
+ /**
108
+ * 解析 app 平台的 uts 插件,任意平台(android|ios)存在即可
109
+ * @param id
110
+ * @param importer
111
+ * @returns
112
+ */
113
+ function resolveUtsAppModule(id, importer) {
114
+ id = path_1.default.resolve(importer, id);
115
+ if (id.includes('utssdk') || id.includes('uni_modules')) {
116
+ const parts = (0, utils_1.normalizePath)(id).split('/');
117
+ const parentDir = parts[parts.length - 2];
118
+ if (parentDir === 'uni_modules' || parentDir === 'utssdk') {
119
+ if (fs_1.default.existsSync(path_1.default.resolve(id, 'index.uts'))) {
120
+ return id;
121
+ }
122
+ const resolvePlatformDir = (p) => {
123
+ return path_1.default.resolve(id, parentDir === 'uni_modules' ? 'utssdk' : '', p);
124
+ };
125
+ const extname = ['.uts'];
126
+ if (resolveUtsFile(resolvePlatformDir('app-android'), extname)) {
127
+ return id;
128
+ }
129
+ if (resolveUtsFile(resolvePlatformDir('app-ios'), extname)) {
130
+ return id;
131
+ }
132
+ }
133
+ }
134
+ }
135
+ exports.resolveUtsAppModule = resolveUtsAppModule;
107
136
  // 仅限 root/uni_modules/test-plugin | root/utssdk/test-plugin 格式
108
137
  function resolveUtsModule(id, importer, platform) {
138
+ if (process.env.UNI_PLATFORM === 'app') {
139
+ return;
140
+ }
109
141
  id = path_1.default.resolve(importer, id);
110
142
  if (id.includes('utssdk') || id.includes('uni_modules')) {
111
143
  const parts = (0, utils_1.normalizePath)(id).split('/');
112
144
  const parentDir = parts[parts.length - 2];
113
145
  if (parentDir === 'uni_modules' || parentDir === 'utssdk') {
114
- const index = path_1.default.resolve(id, 'index.uts');
115
- if (fs_1.default.existsSync(index)) {
146
+ const resolvePlatformDir = (p) => {
147
+ return path_1.default.resolve(id, parentDir === 'uni_modules' ? 'utssdk' : '', p);
148
+ };
149
+ let index = resolveUtsFile(resolvePlatformDir(platform));
150
+ if (index) {
116
151
  return index;
117
152
  }
118
- if (parentDir === 'uni_modules' &&
119
- !fs_1.default.existsSync(path_1.default.join(id, 'utssdk'))) {
120
- // uni_modules/test-plugin/utssdk不存在
121
- return;
153
+ index = path_1.default.resolve(id, 'index.uts');
154
+ if (fs_1.default.existsSync(index)) {
155
+ return index;
122
156
  }
123
- const platformDir = path_1.default.resolve(id, parentDir === 'uni_modules' ? 'utssdk' : '', platform);
124
- return resolveUtsFile(platformDir);
125
157
  }
126
158
  }
127
159
  }
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-3060320220919001",
3
+ "version": "3.0.0-alpha-3060320220919002",
4
4
  "description": "@dcloudio/uni-cli-shared",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,8 +22,8 @@
22
22
  "@babel/core": "^7.17.9",
23
23
  "@babel/parser": "^7.17.9",
24
24
  "@babel/types": "^7.17.0",
25
- "@dcloudio/uni-i18n": "3.0.0-alpha-3060320220919001",
26
- "@dcloudio/uni-shared": "3.0.0-alpha-3060320220919001",
25
+ "@dcloudio/uni-i18n": "3.0.0-alpha-3060320220919002",
26
+ "@dcloudio/uni-shared": "3.0.0-alpha-3060320220919002",
27
27
  "@intlify/core-base": "9.1.9",
28
28
  "@intlify/shared": "9.1.9",
29
29
  "@intlify/vue-devtools": "9.1.9",
@@ -33,7 +33,7 @@
33
33
  "@vue/compiler-sfc": "3.2.39",
34
34
  "@vue/server-renderer": "3.2.39",
35
35
  "@vue/shared": "3.2.39",
36
- "autoprefixer": "^10.4.9",
36
+ "autoprefixer": "^10.4.11",
37
37
  "base64url": "^3.0.1",
38
38
  "chokidar": "^3.5.3",
39
39
  "compare-versions": "^3.6.0",