@dcloudio/uni-cli-shared 3.0.0-alpha-3060020220830002 → 3.0.0-alpha-3060020220901002

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,4 +1,4 @@
1
1
  export { formatAtFilename } from './log';
2
2
  export * from './env';
3
3
  export { initModuleAlias, installHBuilderXPlugin, formatInstallHBuilderXPluginTips, } from './alias';
4
- export declare function uniHBuilderXConsolePlugin(): import("vite").Plugin;
4
+ export declare function uniHBuilderXConsolePlugin(method?: string): import("vite").Plugin;
package/dist/hbx/index.js CHANGED
@@ -28,8 +28,9 @@ var alias_1 = require("./alias");
28
28
  Object.defineProperty(exports, "initModuleAlias", { enumerable: true, get: function () { return alias_1.initModuleAlias; } });
29
29
  Object.defineProperty(exports, "installHBuilderXPlugin", { enumerable: true, get: function () { return alias_1.installHBuilderXPlugin; } });
30
30
  Object.defineProperty(exports, "formatInstallHBuilderXPluginTips", { enumerable: true, get: function () { return alias_1.formatInstallHBuilderXPluginTips; } });
31
- function uniHBuilderXConsolePlugin() {
31
+ function uniHBuilderXConsolePlugin(method = '__f__') {
32
32
  return (0, console_1.uniConsolePlugin)({
33
+ method,
33
34
  filename(filename) {
34
35
  filename = path_1.default.relative(process.env.UNI_INPUT_DIR, filename);
35
36
  if (filename.startsWith('.') || path_1.default.isAbsolute(filename)) {
@@ -1,4 +1,4 @@
1
- export declare function rewriteConsoleExpr(id: string, filename: string, code: string, sourceMap?: boolean): {
1
+ export declare function rewriteConsoleExpr(method: string, id: string, filename: string, code: string, sourceMap?: boolean): {
2
2
  code: string;
3
3
  map: import("magic-string").SourceMap | null;
4
4
  };
@@ -6,8 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.rewriteConsoleExpr = void 0;
7
7
  const magic_string_1 = __importDefault(require("magic-string"));
8
8
  const utils_1 = require("../utils");
9
- const F = '__f__';
10
- function rewriteConsoleExpr(id, filename, code, sourceMap = false) {
9
+ function rewriteConsoleExpr(method, id, filename, code, sourceMap = false) {
11
10
  filename = (0, utils_1.normalizePath)(filename);
12
11
  const re = /(console\.(log|info|debug|warn|error))\(([^)]+)\)/g;
13
12
  const locate = getLocator(code);
@@ -15,7 +14,7 @@ function rewriteConsoleExpr(id, filename, code, sourceMap = false) {
15
14
  let match;
16
15
  while ((match = re.exec(code))) {
17
16
  const [, expr, type] = match;
18
- s.overwrite(match.index, match.index + expr.length + 1, F + `('${type}','at ${filename}:${locate(match.index).line + 1}',`);
17
+ s.overwrite(match.index, match.index + expr.length + 1, method + `('${type}','at ${filename}:${locate(match.index).line + 1}',`);
19
18
  }
20
19
  return {
21
20
  code: s.toString(),
@@ -27,6 +27,7 @@ const DEFAULT_KEYS = [
27
27
  'QUICKAPP_WEBVIEW_UNION',
28
28
  'VUE2',
29
29
  'VUE3',
30
+ 'WEB',
30
31
  ];
31
32
  const preVueContext = Object.create(null);
32
33
  const preNVueContext = Object.create(null);
@@ -71,6 +72,9 @@ function initPreContext(platform, userPreContext) {
71
72
  else if (platform.startsWith('quickapp-webview')) {
72
73
  defaultContext.QUICKAPP_WEBVIEW = true;
73
74
  }
75
+ else if (platform === 'h5') {
76
+ defaultContext.WEB = true;
77
+ }
74
78
  if (userPreContext) {
75
79
  if ((0, shared_1.isString)(userPreContext)) {
76
80
  try {
package/dist/resolve.js CHANGED
@@ -122,7 +122,7 @@ function resolveUtsModule(id, importer, platform) {
122
122
  }
123
123
  const platformDir = path_1.default.resolve(id, parentDir === 'uni_modules' ? 'utssdk' : '', platform);
124
124
  // App平台仅支持 uts
125
- if (platform === 'app-android' || platform === 'app-ios') {
125
+ if (platform === 'app-android') {
126
126
  return resolveUtsFile(platformDir, ['.uts']);
127
127
  }
128
128
  return resolveUtsFile(platformDir);
@@ -1,6 +1,7 @@
1
1
  import { Plugin } from 'vite';
2
2
  import { FilterPattern } from '@rollup/pluginutils';
3
3
  export interface ConsoleOptions {
4
+ method: string;
4
5
  filename?: (filename: string) => string;
5
6
  include?: FilterPattern;
6
7
  exclude?: FilterPattern;
@@ -35,7 +35,7 @@ function uniConsolePlugin(options) {
35
35
  return null;
36
36
  }
37
37
  debugConsole(id);
38
- return (0, console_1.rewriteConsoleExpr)(id, filename, code, (0, utils_2.withSourcemap)(resolvedConfig));
38
+ return (0, console_1.rewriteConsoleExpr)(options.method, id, filename, code, (0, utils_2.withSourcemap)(resolvedConfig));
39
39
  },
40
40
  };
41
41
  }
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-3060020220830002",
3
+ "version": "3.0.0-alpha-3060020220901002",
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-3060020220830002",
26
- "@dcloudio/uni-shared": "3.0.0-alpha-3060020220830002",
25
+ "@dcloudio/uni-i18n": "3.0.0-alpha-3060020220901002",
26
+ "@dcloudio/uni-shared": "3.0.0-alpha-3060020220901002",
27
27
  "@intlify/core-base": "9.1.9",
28
28
  "@intlify/shared": "9.1.9",
29
29
  "@intlify/vue-devtools": "9.1.9",