@dcloudio/uni-cli-shared 3.0.0-alpha-3050420220804007 → 3.0.0-alpha-3050520220824002
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/preprocess/context.js +12 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +13 -1
- package/dist/watcher.js +4 -1
- package/package.json +4 -4
|
@@ -8,6 +8,8 @@ const DEFAULT_KEYS = [
|
|
|
8
8
|
'APP_PLUS',
|
|
9
9
|
'APP_PLUS_NVUE',
|
|
10
10
|
'APP_VUE',
|
|
11
|
+
'APP_ANDROID',
|
|
12
|
+
'APP_IOS',
|
|
11
13
|
'H5',
|
|
12
14
|
'MP',
|
|
13
15
|
'MP_360',
|
|
@@ -52,6 +54,16 @@ function initPreContext(platform, userPreContext) {
|
|
|
52
54
|
vueContext.APP_VUE = true;
|
|
53
55
|
nvueContext.APP_NVUE = true;
|
|
54
56
|
nvueContext.APP_PLUS_NVUE = true;
|
|
57
|
+
if (process.env.UNI_APP_PLATFORM === 'app-android') {
|
|
58
|
+
defaultContext.APP_ANDROID = true;
|
|
59
|
+
}
|
|
60
|
+
else if (process.env.UNI_APP_PLATFORM === 'app-ios') {
|
|
61
|
+
defaultContext.APP_IOS = true;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
defaultContext.APP_ANDROID = true;
|
|
65
|
+
defaultContext.APP_IOS = true;
|
|
66
|
+
}
|
|
55
67
|
}
|
|
56
68
|
else if (platform.startsWith('mp-')) {
|
|
57
69
|
defaultContext.MP = true;
|
package/dist/utils.d.ts
CHANGED
|
@@ -11,3 +11,8 @@ export declare function removeExt(str: string): string;
|
|
|
11
11
|
export declare function normalizeNodeModules(str: string): string;
|
|
12
12
|
export declare function normalizeMiniProgramFilename(filename: string, inputDir?: string): string;
|
|
13
13
|
export declare function normalizeParsePlugins(importer: string, babelParserPlugins?: ParserPlugin[]): ParserPlugin[];
|
|
14
|
+
export declare function pathToGlob(pathString: string, glob: string, options?: {
|
|
15
|
+
windows?: boolean;
|
|
16
|
+
escape?: boolean;
|
|
17
|
+
}): string;
|
|
18
|
+
export declare function resolveSourceMapPath(dir: string, platform: UniApp.PLATFORM): string;
|
package/dist/utils.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.normalizeParsePlugins = exports.normalizeMiniProgramFilename = exports.normalizeNodeModules = exports.removeExt = exports.normalizePagePath = exports.normalizeIdentifier = exports.checkElementNodeTag = exports.normalizePath = exports.isWindows = exports.isRunningWithYarnPnp = exports.hash = void 0;
|
|
6
|
+
exports.resolveSourceMapPath = exports.pathToGlob = exports.normalizeParsePlugins = exports.normalizeMiniProgramFilename = exports.normalizeNodeModules = exports.removeExt = exports.normalizePagePath = exports.normalizeIdentifier = exports.checkElementNodeTag = exports.normalizePath = exports.isWindows = exports.isRunningWithYarnPnp = exports.hash = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const os_1 = __importDefault(require("os"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
@@ -78,3 +78,15 @@ function normalizeParsePlugins(importer, babelParserPlugins) {
|
|
|
78
78
|
return plugins;
|
|
79
79
|
}
|
|
80
80
|
exports.normalizeParsePlugins = normalizeParsePlugins;
|
|
81
|
+
function pathToGlob(pathString, glob, options = {}) {
|
|
82
|
+
const isWindows = 'windows' in options ? options.windows : /^win/.test(process.platform);
|
|
83
|
+
const useEscape = options.escape;
|
|
84
|
+
const str = isWindows ? pathString.replace(/\\/g, '/') : pathString;
|
|
85
|
+
let safeStr = str.replace(/[\\*?[\]{}()!]/g, isWindows || !useEscape ? '[$&]' : '\\$&');
|
|
86
|
+
return path_1.default.posix.join(safeStr, glob);
|
|
87
|
+
}
|
|
88
|
+
exports.pathToGlob = pathToGlob;
|
|
89
|
+
function resolveSourceMapPath(dir, platform) {
|
|
90
|
+
return path_1.default.resolve(dir, '../.sourcemap/' + platform);
|
|
91
|
+
}
|
|
92
|
+
exports.resolveSourceMapPath = resolveSourceMapPath;
|
package/dist/watcher.js
CHANGED
|
@@ -8,6 +8,7 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const chokidar_1 = require("chokidar");
|
|
10
10
|
const shared_1 = require("@vue/shared");
|
|
11
|
+
const utils_1 = require("./utils");
|
|
11
12
|
class FileWatcher {
|
|
12
13
|
constructor({ src, dest, transform, verbose }) {
|
|
13
14
|
this.src = !(0, shared_1.isArray)(src) ? [src] : src;
|
|
@@ -19,7 +20,9 @@ class FileWatcher {
|
|
|
19
20
|
if (!this.watcher) {
|
|
20
21
|
const copy = this.copy.bind(this);
|
|
21
22
|
const remove = this.remove.bind(this);
|
|
22
|
-
|
|
23
|
+
// escape chokidar cwd
|
|
24
|
+
const src = this.src.map((src) => (0, utils_1.pathToGlob)(path_1.default.resolve(watchOptions.cwd), src));
|
|
25
|
+
this.watcher = (0, chokidar_1.watch)(src, watchOptions)
|
|
23
26
|
.on('add', copy)
|
|
24
27
|
.on('addDir', copy)
|
|
25
28
|
.on('change', copy)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcloudio/uni-cli-shared",
|
|
3
|
-
"version": "3.0.0-alpha-
|
|
3
|
+
"version": "3.0.0-alpha-3050520220824002",
|
|
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-
|
|
26
|
-
"@dcloudio/uni-shared": "3.0.0-alpha-
|
|
25
|
+
"@dcloudio/uni-i18n": "3.0.0-alpha-3050520220824002",
|
|
26
|
+
"@dcloudio/uni-shared": "3.0.0-alpha-3050520220824002",
|
|
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.37",
|
|
34
34
|
"@vue/server-renderer": "3.2.37",
|
|
35
35
|
"@vue/shared": "3.2.37",
|
|
36
|
-
"autoprefixer": "^10.4.
|
|
36
|
+
"autoprefixer": "^10.4.8",
|
|
37
37
|
"base64url": "^3.0.1",
|
|
38
38
|
"chokidar": "^3.5.3",
|
|
39
39
|
"compare-versions": "^3.6.0",
|