@dcloudio/uni-cli-shared 3.0.0-alpha-3030820220114005 → 3.0.0-alpha-3030820220114007

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.
@@ -19,6 +19,8 @@ export declare function normalizeNetworkTimeout(networkTimeout?: Partial<typeof
19
19
  downloadFile: number;
20
20
  };
21
21
  export declare function getUniStatistics(inputDir: string, platform: UniApp.PLATFORM): any;
22
+ export declare function getUniPush(inputDir: string, platform: UniApp.PLATFORM): any;
23
+ export declare function isUniPushOffline(inputDir: string): boolean;
22
24
  export declare function getRouterOptions(manifestJson: Record<string, any>): {
23
25
  mode?: 'history' | 'hash';
24
26
  base?: string;
@@ -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.getDevServerOptions = exports.isEnableTreeShaking = exports.getRouterOptions = exports.getUniStatistics = exports.normalizeNetworkTimeout = exports.parseCompatConfigOnce = exports.parseRpx2UnitOnce = exports.parseManifestJsonOnce = exports.parseManifestJson = void 0;
6
+ exports.getDevServerOptions = exports.isEnableTreeShaking = exports.getRouterOptions = exports.isUniPushOffline = exports.getUniPush = exports.getUniStatistics = exports.normalizeNetworkTimeout = exports.parseCompatConfigOnce = exports.parseRpx2UnitOnce = exports.parseManifestJsonOnce = exports.parseManifestJson = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const shared_1 = require("@vue/shared");
@@ -47,6 +47,18 @@ function getUniStatistics(inputDir, platform) {
47
47
  return (0, shared_1.extend)({}, manifest.uniStatistics, manifest[platform] && manifest[platform].uniStatistics);
48
48
  }
49
49
  exports.getUniStatistics = getUniStatistics;
50
+ function getUniPush(inputDir, platform) {
51
+ const manifest = (0, exports.parseManifestJsonOnce)(inputDir);
52
+ return (0, shared_1.extend)({}, manifest.unipush, manifest[platform] && manifest[platform].unipush);
53
+ }
54
+ exports.getUniPush = getUniPush;
55
+ function isUniPushOffline(inputDir) {
56
+ var _a, _b, _c, _d, _e;
57
+ const manifest = (0, exports.parseManifestJsonOnce)(inputDir);
58
+ return (((_e = (_d = (_c = (_b = (_a = manifest === null || manifest === void 0 ? void 0 : manifest['app-plus']) === null || _a === void 0 ? void 0 : _a.distribute) === null || _b === void 0 ? void 0 : _b.sdkConfigs) === null || _c === void 0 ? void 0 : _c.push) === null || _d === void 0 ? void 0 : _d.unipush) === null || _e === void 0 ? void 0 : _e.enable) ===
59
+ true);
60
+ }
61
+ exports.isUniPushOffline = isUniPushOffline;
50
62
  function getRouterOptions(manifestJson) {
51
63
  var _a;
52
64
  return (0, shared_1.extend)({}, (_a = manifestJson.h5) === null || _a === void 0 ? void 0 : _a.router);
@@ -60,12 +60,15 @@ function findChangedJsonFiles() {
60
60
  (0, shared_1.extend)(newJson.usingComponents, jsonUsingComponentsCache.get(filename));
61
61
  const usingComponents = newJson.usingComponents;
62
62
  // 格式化为相对路径,这样作为分包也可以直接运行
63
- Object.keys(usingComponents).forEach((name) => {
64
- const componentFilename = usingComponents[name];
65
- if (componentFilename.startsWith('/')) {
66
- usingComponents[name] = (0, resolve_1.relativeFile)(filename, componentFilename.slice(1));
67
- }
68
- });
63
+ // app.json mp-baidu 在 win 不支持相对路径。所有平台改用绝对路径
64
+ if (filename !== 'app') {
65
+ Object.keys(usingComponents).forEach((name) => {
66
+ const componentFilename = usingComponents[name];
67
+ if (componentFilename.startsWith('/')) {
68
+ usingComponents[name] = (0, resolve_1.relativeFile)(filename, componentFilename.slice(1));
69
+ }
70
+ });
71
+ }
69
72
  const jsonStr = JSON.stringify(newJson, null, 2);
70
73
  if (jsonFilesCache.get(filename) !== jsonStr) {
71
74
  changedJsonFiles.set(filename, jsonStr);
@@ -169,6 +169,12 @@ function normalizePageStyle(pagePath, pageStyle, platform) {
169
169
  pageStyle.enablePullDownRefresh = true;
170
170
  pageStyle.pullToRefresh = normalizePullToRefresh(pageStyle);
171
171
  }
172
+ if (platform === 'app') {
173
+ pageStyle.disableSwipeBack === true
174
+ ? (pageStyle.popGesture = 'none')
175
+ : delete pageStyle.popGesture;
176
+ delete pageStyle.disableSwipeBack;
177
+ }
172
178
  }
173
179
  pageStyle.isNVue = isNVue;
174
180
  removePlatformStyle(pageStyle);
@@ -1,4 +1,10 @@
1
+ import type { Plugin } from 'postcss';
2
+ import type { Options } from 'autoprefixer';
1
3
  import uniPostcssScopedPlugin from './plugins/stylePluginScoped';
2
- import uniPostcssPlugin from './plugins/uniapp';
4
+ import uniPostcssPlugin, { UniAppCssProcessorOptions } from './plugins/uniapp';
3
5
  export { uniPostcssPlugin };
4
6
  export { uniPostcssScopedPlugin };
7
+ export declare function initPostcssPlugin({ uniApp, autoprefixer, }?: {
8
+ uniApp?: UniAppCssProcessorOptions;
9
+ autoprefixer?: Options | false;
10
+ }): Plugin[];
@@ -3,8 +3,17 @@ 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.uniPostcssScopedPlugin = exports.uniPostcssPlugin = void 0;
6
+ exports.initPostcssPlugin = exports.uniPostcssScopedPlugin = exports.uniPostcssPlugin = void 0;
7
7
  const stylePluginScoped_1 = __importDefault(require("./plugins/stylePluginScoped"));
8
8
  exports.uniPostcssScopedPlugin = stylePluginScoped_1.default;
9
9
  const uniapp_1 = __importDefault(require("./plugins/uniapp"));
10
10
  exports.uniPostcssPlugin = uniapp_1.default;
11
+ function initPostcssPlugin({ uniApp, autoprefixer, } = {}) {
12
+ const plugins = [(0, uniapp_1.default)(uniApp)];
13
+ // nvue 不需要 autoprefixer
14
+ if (autoprefixer !== false) {
15
+ plugins.push(require('autoprefixer')(autoprefixer));
16
+ }
17
+ return plugins;
18
+ }
19
+ exports.initPostcssPlugin = initPostcssPlugin;
@@ -1,6 +1,5 @@
1
1
  import type { Plugin } from 'postcss';
2
- interface UniAppCssProcessorOptions {
3
- page?: string;
2
+ export interface UniAppCssProcessorOptions {
4
3
  unit?: string;
5
4
  unitRatio?: number;
6
5
  unitPrecision?: number;
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const shared_1 = require("@vue/shared");
7
7
  const postcss_selector_parser_1 = __importDefault(require("postcss-selector-parser"));
8
8
  const uni_shared_1 = require("@dcloudio/uni-shared");
9
- const manifest_1 = require("../../json/manifest");
10
9
  const defaultUniAppCssProcessorOptions = (0, shared_1.extend)({}, uni_shared_1.defaultRpx2Unit);
11
10
  const BG_PROPS = [
12
11
  'background',
@@ -88,11 +87,7 @@ const transforms = {
88
87
  };
89
88
  const uniapp = (opts) => {
90
89
  const platform = process.env.UNI_PLATFORM;
91
- if (!opts) {
92
- const inputDir = process.env.UNI_INPUT_DIR;
93
- opts = (0, shared_1.extend)((0, manifest_1.parseRpx2UnitOnce)(inputDir, platform));
94
- }
95
- const { unit, unitRatio, unitPrecision } = (0, shared_1.extend)({}, defaultUniAppCssProcessorOptions, opts || {});
90
+ const { unit, unitRatio, unitPrecision } = (0, shared_1.extend)({}, defaultUniAppCssProcessorOptions, opts);
96
91
  const rpx2unit = (0, uni_shared_1.createRpx2Unit)(unit, unitRatio, unitPrecision);
97
92
  return {
98
93
  postcssPlugin: 'uni-app',
@@ -1,2 +1,4 @@
1
- import type { ResolvedConfig } from 'vite';
1
+ import type { ConfigEnv, ResolvedConfig, UserConfig } from 'vite';
2
2
  export declare function withSourcemap(config: ResolvedConfig): boolean;
3
+ export declare function isInHybridNVue(config: UserConfig | ResolvedConfig): boolean;
4
+ export declare function isSsr(command: ConfigEnv['command'], config: UserConfig | ResolvedConfig): boolean;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.withSourcemap = void 0;
3
+ exports.isSsr = exports.isInHybridNVue = exports.withSourcemap = void 0;
4
4
  function withSourcemap(config) {
5
5
  if (config.command === 'serve') {
6
6
  return true;
@@ -8,3 +8,17 @@ function withSourcemap(config) {
8
8
  return !!config.build.sourcemap;
9
9
  }
10
10
  exports.withSourcemap = withSourcemap;
11
+ function isInHybridNVue(config) {
12
+ return config.nvue && process.env.UNI_RENDERER !== 'native';
13
+ }
14
+ exports.isInHybridNVue = isInHybridNVue;
15
+ function isSsr(command, config) {
16
+ if (command === 'serve') {
17
+ return !!(config.server && config.server.middlewareMode);
18
+ }
19
+ if (command === 'build') {
20
+ return !!(config.build && config.build.ssr);
21
+ }
22
+ return false;
23
+ }
24
+ exports.isSsr = isSsr;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "3.0.0-alpha-3030820220114005",
3
+ "version": "3.0.0-alpha-3030820220114007",
4
4
  "description": "@dcloudio/uni-cli-shared",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,14 +21,15 @@
21
21
  "@babel/core": "^7.16.5",
22
22
  "@babel/parser": "^7.16.4",
23
23
  "@babel/types": "^7.16.0",
24
- "@dcloudio/uni-i18n": "3.0.0-alpha-3030820220114005",
25
- "@dcloudio/uni-shared": "3.0.0-alpha-3030820220114005",
24
+ "@dcloudio/uni-i18n": "3.0.0-alpha-3030820220114007",
25
+ "@dcloudio/uni-shared": "3.0.0-alpha-3030820220114007",
26
26
  "@rollup/pluginutils": "^4.1.2",
27
- "@vue/compiler-core": "3.2.27",
28
- "@vue/compiler-dom": "3.2.27",
29
- "@vue/compiler-sfc": "3.2.27",
30
- "@vue/server-renderer": "3.2.27",
31
- "@vue/shared": "3.2.27",
27
+ "@vue/compiler-core": "3.2.30",
28
+ "@vue/compiler-dom": "3.2.30",
29
+ "@vue/compiler-sfc": "3.2.30",
30
+ "@vue/server-renderer": "3.2.30",
31
+ "@vue/shared": "3.2.30",
32
+ "autoprefixer": "^10.4.2",
32
33
  "base64url": "^3.0.1",
33
34
  "chokidar": "^3.5.2",
34
35
  "compare-versions": "^3.6.0",