@dcloudio/uni-cli-shared 3.0.0-alpha-3031220220222001 → 3.0.0-alpha-3031120220221001
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/constants.d.ts +6 -0
- package/dist/constants.js +7 -1
- package/dist/hbx/log.js +5 -5
- package/dist/json/manifest.d.ts +2 -0
- package/dist/json/manifest.js +13 -1
- package/dist/json/mp/jsonFile.d.ts +5 -1
- package/dist/json/mp/jsonFile.js +22 -16
- package/dist/json/pages.js +6 -0
- package/dist/mp/event.js +5 -0
- package/dist/mp/index.d.ts +1 -0
- package/dist/mp/index.js +1 -0
- package/dist/mp/usingComponents.js +15 -1
- package/dist/mp/wxs.d.ts +2 -0
- package/dist/mp/wxs.js +55 -0
- package/dist/postcss/index.d.ts +7 -1
- package/dist/postcss/index.js +10 -1
- package/dist/postcss/plugins/uniapp.d.ts +1 -2
- package/dist/postcss/plugins/uniapp.js +1 -6
- package/dist/vite/features.js +2 -2
- package/dist/vite/plugins/jsonJs.js +5 -2
- package/dist/vite/plugins/vitejs/plugins/css.js +5 -4
- package/dist/vite/utils/url.d.ts +11 -0
- package/dist/vite/utils/url.js +21 -2
- package/dist/vite/utils/utils.d.ts +3 -1
- package/dist/vite/utils/utils.js +15 -1
- package/dist/vue/transforms/index.js +7 -1
- package/dist/vue/transforms/transformEvent.d.ts +2 -2
- package/dist/vue/transforms/transformEvent.js +7 -1
- package/dist/watcher.d.ts +2 -2
- package/package.json +20 -19
package/dist/constants.d.ts
CHANGED
|
@@ -7,6 +7,12 @@ export declare const EXTNAME_VUE_RE: RegExp;
|
|
|
7
7
|
export declare const EXTNAME_JS_RE: RegExp;
|
|
8
8
|
export declare const EXTNAME_TS_RE: RegExp;
|
|
9
9
|
export declare const extensions: string[];
|
|
10
|
+
export declare const PAGES_JSON_JS = "pages-json-js";
|
|
11
|
+
export declare const MANIFEST_JSON_JS = "manifest-json-js";
|
|
12
|
+
export declare const JSON_JS_MAP: {
|
|
13
|
+
readonly 'pages.json': "pages-json-js";
|
|
14
|
+
readonly 'manifest.json': "manifest-json-js";
|
|
15
|
+
};
|
|
10
16
|
export declare const ASSETS_INLINE_LIMIT: number;
|
|
11
17
|
export declare const APP_SERVICE_FILENAME = "app-service.js";
|
|
12
18
|
export declare const BINDING_COMPONENTS = "__BINDING_COMPONENTS__";
|
package/dist/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.COMMON_EXCLUDE = exports.BASE_COMPONENTS_STYLE_PATH = exports.H5_COMPONENTS_STYLE_PATH = exports.H5_FRAMEWORK_STYLE_PATH = exports.H5_API_STYLE_PATH = exports.PAGE_EXTNAME = exports.PAGE_EXTNAME_APP = exports.BINDING_COMPONENTS = exports.APP_SERVICE_FILENAME = exports.ASSETS_INLINE_LIMIT = exports.extensions = exports.EXTNAME_TS_RE = exports.EXTNAME_JS_RE = exports.EXTNAME_VUE_RE = exports.EXTNAME_VUE_TEMPLATE = exports.EXTNAME_VUE = exports.EXTNAME_TS = exports.EXTNAME_JS = exports.PUBLIC_DIR = void 0;
|
|
3
|
+
exports.COMMON_EXCLUDE = exports.BASE_COMPONENTS_STYLE_PATH = exports.H5_COMPONENTS_STYLE_PATH = exports.H5_FRAMEWORK_STYLE_PATH = exports.H5_API_STYLE_PATH = exports.PAGE_EXTNAME = exports.PAGE_EXTNAME_APP = exports.BINDING_COMPONENTS = exports.APP_SERVICE_FILENAME = exports.ASSETS_INLINE_LIMIT = exports.JSON_JS_MAP = exports.MANIFEST_JSON_JS = exports.PAGES_JSON_JS = exports.extensions = exports.EXTNAME_TS_RE = exports.EXTNAME_JS_RE = exports.EXTNAME_VUE_RE = exports.EXTNAME_VUE_TEMPLATE = exports.EXTNAME_VUE = exports.EXTNAME_TS = exports.EXTNAME_JS = exports.PUBLIC_DIR = void 0;
|
|
4
4
|
exports.PUBLIC_DIR = 'static';
|
|
5
5
|
exports.EXTNAME_JS = ['.js', '.ts', '.jsx', '.tsx'];
|
|
6
6
|
exports.EXTNAME_TS = ['.ts', '.tsx'];
|
|
@@ -17,6 +17,12 @@ exports.extensions = [
|
|
|
17
17
|
'.tsx',
|
|
18
18
|
'.json',
|
|
19
19
|
].concat(exports.EXTNAME_VUE);
|
|
20
|
+
exports.PAGES_JSON_JS = 'pages-json-js';
|
|
21
|
+
exports.MANIFEST_JSON_JS = 'manifest-json-js';
|
|
22
|
+
exports.JSON_JS_MAP = {
|
|
23
|
+
'pages.json': exports.PAGES_JSON_JS,
|
|
24
|
+
'manifest.json': exports.MANIFEST_JSON_JS,
|
|
25
|
+
};
|
|
20
26
|
exports.ASSETS_INLINE_LIMIT = 40 * 1024;
|
|
21
27
|
exports.APP_SERVICE_FILENAME = 'app-service.js';
|
|
22
28
|
exports.BINDING_COMPONENTS = '__BINDING_COMPONENTS__';
|
package/dist/hbx/log.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.errorFormatter = exports.removeWarnFormatter = exports.removeInfoFormatter = exports.h5ServeFormatter = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const
|
|
8
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
9
9
|
const utils_1 = require("../utils");
|
|
10
10
|
const SIGNAL_H5_LOCAL = ' > Local:';
|
|
11
11
|
const SIGNAL_H5_NETWORK = ' > Network:';
|
|
@@ -66,20 +66,20 @@ exports.errorFormatter = {
|
|
|
66
66
|
function buildErrorMessage(err, args = [], includeStack = true) {
|
|
67
67
|
var _a, _b;
|
|
68
68
|
if (err.plugin) {
|
|
69
|
-
args.push(`${
|
|
69
|
+
args.push(`${picocolors_1.default.magenta('[plugin:' + err.plugin + ']')} ${picocolors_1.default.red(err.message)}`);
|
|
70
70
|
}
|
|
71
71
|
else {
|
|
72
|
-
args.push(
|
|
72
|
+
args.push(picocolors_1.default.red(err.message));
|
|
73
73
|
}
|
|
74
74
|
if (err.id) {
|
|
75
|
-
args.push(`at ${
|
|
75
|
+
args.push(`at ${picocolors_1.default.cyan((0, utils_1.normalizePath)(path_1.default.relative(process.env.UNI_INPUT_DIR, err.id.split('?')[0])) +
|
|
76
76
|
':' +
|
|
77
77
|
(((_a = err.loc) === null || _a === void 0 ? void 0 : _a.line) || 1) +
|
|
78
78
|
':' +
|
|
79
79
|
(((_b = err.loc) === null || _b === void 0 ? void 0 : _b.column) || 0))}`);
|
|
80
80
|
}
|
|
81
81
|
if (err.frame) {
|
|
82
|
-
args.push(
|
|
82
|
+
args.push(picocolors_1.default.yellow(pad(err.frame)));
|
|
83
83
|
}
|
|
84
84
|
if (includeStack && err.stack) {
|
|
85
85
|
args.push(pad(cleanStack(err.stack)));
|
package/dist/json/manifest.d.ts
CHANGED
|
@@ -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;
|
package/dist/json/manifest.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.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);
|
|
@@ -16,8 +16,12 @@ export declare function isMiniProgramUsingComponent(name: string, options: {
|
|
|
16
16
|
inputDir: string;
|
|
17
17
|
componentsDir?: string;
|
|
18
18
|
}): boolean;
|
|
19
|
+
interface MiniProgramComponents {
|
|
20
|
+
[name: string]: 'plugin' | 'component';
|
|
21
|
+
}
|
|
19
22
|
export declare function findMiniProgramUsingComponents({ filename, inputDir, componentsDir, }: {
|
|
20
23
|
filename: string;
|
|
21
24
|
inputDir: string;
|
|
22
25
|
componentsDir?: string;
|
|
23
|
-
}):
|
|
26
|
+
}): MiniProgramComponents;
|
|
27
|
+
export {};
|
package/dist/json/mp/jsonFile.js
CHANGED
|
@@ -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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
usingComponents[name]
|
|
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);
|
|
@@ -100,28 +103,31 @@ function addMiniProgramUsingComponents(filename, json) {
|
|
|
100
103
|
}
|
|
101
104
|
exports.addMiniProgramUsingComponents = addMiniProgramUsingComponents;
|
|
102
105
|
function isMiniProgramUsingComponent(name, options) {
|
|
103
|
-
return findMiniProgramUsingComponents(options)
|
|
106
|
+
return !!findMiniProgramUsingComponents(options)[name];
|
|
104
107
|
}
|
|
105
108
|
exports.isMiniProgramUsingComponent = isMiniProgramUsingComponent;
|
|
106
109
|
function findMiniProgramUsingComponents({ filename, inputDir, componentsDir, }) {
|
|
107
|
-
if (!componentsDir) {
|
|
108
|
-
return [];
|
|
109
|
-
}
|
|
110
110
|
const globalUsingComponents = appJsonCache && appJsonCache.usingComponents;
|
|
111
|
-
const miniProgramComponents =
|
|
111
|
+
const miniProgramComponents = {};
|
|
112
112
|
if (globalUsingComponents) {
|
|
113
|
-
|
|
113
|
+
(0, shared_1.extend)(miniProgramComponents, findMiniProgramUsingComponent(globalUsingComponents, componentsDir));
|
|
114
114
|
}
|
|
115
115
|
const jsonFile = findJsonFile((0, utils_1.removeExt)((0, utils_1.normalizeMiniProgramFilename)(filename, inputDir)));
|
|
116
116
|
if (jsonFile === null || jsonFile === void 0 ? void 0 : jsonFile.usingComponents) {
|
|
117
|
-
|
|
117
|
+
(0, shared_1.extend)(miniProgramComponents, findMiniProgramUsingComponent(jsonFile.usingComponents, componentsDir));
|
|
118
118
|
}
|
|
119
119
|
return miniProgramComponents;
|
|
120
120
|
}
|
|
121
121
|
exports.findMiniProgramUsingComponents = findMiniProgramUsingComponents;
|
|
122
122
|
function findMiniProgramUsingComponent(usingComponents, componentsDir) {
|
|
123
|
-
return Object.keys(usingComponents).
|
|
123
|
+
return Object.keys(usingComponents).reduce((res, name) => {
|
|
124
124
|
const path = usingComponents[name];
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
if (componentsDir && path.includes(componentsDir + '/')) {
|
|
126
|
+
res[name] = 'component';
|
|
127
|
+
}
|
|
128
|
+
else if (path.includes('plugin://')) {
|
|
129
|
+
res[name] = 'plugin';
|
|
130
|
+
}
|
|
131
|
+
return res;
|
|
132
|
+
}, {});
|
|
127
133
|
}
|
package/dist/json/pages.js
CHANGED
|
@@ -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);
|
package/dist/mp/event.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.formatMiniProgramEvent = void 0;
|
|
4
|
+
const uni_shared_1 = require("@dcloudio/uni-shared");
|
|
4
5
|
function formatMiniProgramEvent(eventName, { isCatch, isCapture, isComponent, }) {
|
|
6
|
+
if (isComponent) {
|
|
7
|
+
// 自定义组件的自定义事件需要格式化,因为 triggerEvent 时也会格式化
|
|
8
|
+
eventName = (0, uni_shared_1.customizeEvent)(eventName);
|
|
9
|
+
}
|
|
5
10
|
if (!isComponent && eventName === 'click') {
|
|
6
11
|
eventName = 'tap';
|
|
7
12
|
}
|
package/dist/mp/index.d.ts
CHANGED
package/dist/mp/index.js
CHANGED
|
@@ -12,6 +12,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.updateMiniProgramComponentExternalClasses = exports.findMiniProgramComponentExternalClasses = exports.parseExternalClasses = exports.hasExternalClasses = exports.updateMiniProgramComponentsByTemplateFilename = exports.updateMiniProgramComponentsByScriptFilename = exports.updateMiniProgramComponentsByMainFilename = exports.updateMiniProgramGlobalComponents = exports.transformDynamicImports = exports.parseTemplateDescriptor = exports.parseScriptDescriptor = exports.parseMainDescriptor = exports.copyMiniProgramPluginJson = exports.HTML_TO_MINI_PROGRAM_TAGS = void 0;
|
|
14
14
|
__exportStar(require("./ast"), exports);
|
|
15
|
+
__exportStar(require("./wxs"), exports);
|
|
15
16
|
__exportStar(require("./nvue"), exports);
|
|
16
17
|
__exportStar(require("./event"), exports);
|
|
17
18
|
__exportStar(require("./style"), exports);
|
|
@@ -130,8 +130,22 @@ function findBindingComponent(tag, bindingComponents) {
|
|
|
130
130
|
return tag === componentTag || tag === camelName || tag === PascalName;
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
|
+
function normalizeComponentId(id) {
|
|
134
|
+
// _unref(test) => test
|
|
135
|
+
if (id.includes('_unref(')) {
|
|
136
|
+
return id.replace('_unref(', '').replace(')', '');
|
|
137
|
+
}
|
|
138
|
+
// $setup["test"] => test
|
|
139
|
+
if (id.includes('$setup[')) {
|
|
140
|
+
return id.replace('$setup["', '').replace('"', '');
|
|
141
|
+
}
|
|
142
|
+
return id;
|
|
143
|
+
}
|
|
133
144
|
function parseBindingComponents(templateBindingComponents, scriptBindingComponents) {
|
|
134
|
-
const bindingComponents = {
|
|
145
|
+
const bindingComponents = {};
|
|
146
|
+
Object.keys(templateBindingComponents).forEach((id) => {
|
|
147
|
+
bindingComponents[normalizeComponentId(id)] = templateBindingComponents[id];
|
|
148
|
+
});
|
|
135
149
|
Object.keys(scriptBindingComponents).forEach((id) => {
|
|
136
150
|
const { tag } = scriptBindingComponents[id];
|
|
137
151
|
const name = findBindingComponent(tag, templateBindingComponents);
|
package/dist/mp/wxs.d.ts
ADDED
package/dist/mp/wxs.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.genWxsCallMethodsCode = exports.parseWxsCallMethods = void 0;
|
|
4
|
+
const types_1 = require("@babel/types");
|
|
5
|
+
const estree_walker_1 = require("estree-walker");
|
|
6
|
+
const ast_1 = require("./ast");
|
|
7
|
+
function parseWxsCallMethods(code) {
|
|
8
|
+
if (!code.includes('callMethod')) {
|
|
9
|
+
return [];
|
|
10
|
+
}
|
|
11
|
+
const ast = (0, ast_1.parseProgram)(code, '', {});
|
|
12
|
+
const wxsCallMethods = new Set();
|
|
13
|
+
estree_walker_1.walk(ast, {
|
|
14
|
+
enter(child) {
|
|
15
|
+
if (!(0, types_1.isCallExpression)(child)) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const { callee } = child;
|
|
19
|
+
// .callMethod
|
|
20
|
+
if (!(0, types_1.isMemberExpression)(callee) ||
|
|
21
|
+
!(0, types_1.isIdentifier)(callee.property) ||
|
|
22
|
+
callee.property.name !== 'callMethod') {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
// .callMethod('test',...)
|
|
26
|
+
const args = child.arguments;
|
|
27
|
+
if (!args.length) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const [name] = args;
|
|
31
|
+
if (!(0, types_1.isStringLiteral)(name)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
wxsCallMethods.add(name.value);
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
return [...wxsCallMethods];
|
|
38
|
+
}
|
|
39
|
+
exports.parseWxsCallMethods = parseWxsCallMethods;
|
|
40
|
+
function genWxsCallMethodsCode(code) {
|
|
41
|
+
const wxsCallMethods = parseWxsCallMethods(code);
|
|
42
|
+
if (!wxsCallMethods.length) {
|
|
43
|
+
return `export default {}`;
|
|
44
|
+
}
|
|
45
|
+
return `export default (Component) => {
|
|
46
|
+
if(!Component.wxsCallMethods){
|
|
47
|
+
Component.wxsCallMethods = []
|
|
48
|
+
}
|
|
49
|
+
Component.wxsCallMethods.push(${wxsCallMethods
|
|
50
|
+
.map((m) => `'${m}'`)
|
|
51
|
+
.join(', ')})
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
54
|
+
}
|
|
55
|
+
exports.genWxsCallMethodsCode = genWxsCallMethodsCode;
|
package/dist/postcss/index.d.ts
CHANGED
|
@@ -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[];
|
package/dist/postcss/index.js
CHANGED
|
@@ -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;
|
|
@@ -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
|
-
|
|
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',
|
package/dist/vite/features.js
CHANGED
|
@@ -131,8 +131,8 @@ function initManifestFeature({ manifestJson, command, platform, }) {
|
|
|
131
131
|
};
|
|
132
132
|
if (command === 'build') {
|
|
133
133
|
// TODO 需要预编译一遍?
|
|
134
|
-
features.wxs = false
|
|
135
|
-
features.longpress = false
|
|
134
|
+
// features.wxs = false
|
|
135
|
+
// features.longpress = false
|
|
136
136
|
}
|
|
137
137
|
if (manifestJson.h5 &&
|
|
138
138
|
manifestJson.h5.router &&
|
|
@@ -6,11 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.defineUniManifestJsonPlugin = exports.defineUniPagesJsonPlugin = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const constants_1 = require("../../constants");
|
|
9
10
|
const utils_1 = require("../../utils");
|
|
10
11
|
exports.defineUniPagesJsonPlugin = createDefineJsonJsPlugin('pages.json');
|
|
11
12
|
exports.defineUniManifestJsonPlugin = createDefineJsonJsPlugin('manifest.json');
|
|
12
13
|
function createDefineJsonJsPlugin(name) {
|
|
13
|
-
const JSON_JS = name
|
|
14
|
+
const JSON_JS = constants_1.JSON_JS_MAP[name];
|
|
14
15
|
return function (createVitePlugin) {
|
|
15
16
|
const opts = {
|
|
16
17
|
resolvedConfig: {},
|
|
@@ -23,18 +24,20 @@ function createDefineJsonJsPlugin(name) {
|
|
|
23
24
|
const origResolveId = plugin.resolveId;
|
|
24
25
|
const origConfigResolved = plugin.configResolved;
|
|
25
26
|
let jsonPath = '';
|
|
27
|
+
let jsonJsPath = '';
|
|
26
28
|
plugin.resolveId = function (id, importer, options) {
|
|
27
29
|
const res = origResolveId && origResolveId.call(this, id, importer, options);
|
|
28
30
|
if (res) {
|
|
29
31
|
return res;
|
|
30
32
|
}
|
|
31
33
|
if (id.endsWith(JSON_JS)) {
|
|
32
|
-
return
|
|
34
|
+
return jsonJsPath;
|
|
33
35
|
}
|
|
34
36
|
};
|
|
35
37
|
plugin.configResolved = function (config) {
|
|
36
38
|
opts.resolvedConfig = config;
|
|
37
39
|
jsonPath = (0, utils_1.normalizePath)(path_1.default.join(process.env.UNI_INPUT_DIR, name));
|
|
40
|
+
jsonJsPath = (0, utils_1.normalizePath)(path_1.default.join(process.env.UNI_INPUT_DIR, JSON_JS));
|
|
38
41
|
return origConfigResolved && origConfigResolved(config);
|
|
39
42
|
};
|
|
40
43
|
plugin.load = function (id, ssr) {
|
|
@@ -26,13 +26,14 @@ exports.minifyCSS = exports.cssUrlRE = exports.cssPostPlugin = exports.cssPlugin
|
|
|
26
26
|
const fs_1 = __importDefault(require("fs"));
|
|
27
27
|
const path_1 = __importDefault(require("path"));
|
|
28
28
|
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
29
|
-
const
|
|
29
|
+
const picocolors_1 = __importDefault(require("picocolors"));
|
|
30
30
|
const postcss_load_config_1 = __importDefault(require("postcss-load-config"));
|
|
31
31
|
const pluginutils_1 = require("@rollup/pluginutils");
|
|
32
32
|
const utils_1 = require("../utils");
|
|
33
33
|
const asset_1 = require("./asset");
|
|
34
34
|
const esbuild_1 = require("esbuild");
|
|
35
35
|
const preprocess_1 = require("../../../../preprocess");
|
|
36
|
+
const constants_1 = require("../../../../constants");
|
|
36
37
|
const cssLangs = `\\.(css|less|sass|scss|styl|stylus|pcss|postcss)($|\\?)`;
|
|
37
38
|
exports.cssLangRE = new RegExp(cssLangs);
|
|
38
39
|
const cssModuleRE = new RegExp(`\\.module${cssLangs}`);
|
|
@@ -114,7 +115,7 @@ function findCssModuleIds(moduleId, cssModuleIds, seen) {
|
|
|
114
115
|
const moduleInfo = this.getModuleInfo(moduleId);
|
|
115
116
|
if (moduleInfo) {
|
|
116
117
|
moduleInfo.importedIds.forEach((id) => {
|
|
117
|
-
if (id.includes(
|
|
118
|
+
if (id.includes(constants_1.PAGES_JSON_JS)) {
|
|
118
119
|
// 查询main.js时,需要忽略pages.json.js,否则会把所有页面样式加进来
|
|
119
120
|
return;
|
|
120
121
|
}
|
|
@@ -396,7 +397,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
396
397
|
column: message.column,
|
|
397
398
|
})}`;
|
|
398
399
|
}
|
|
399
|
-
config.logger.warn(
|
|
400
|
+
config.logger.warn(picocolors_1.default.yellow(msg));
|
|
400
401
|
}
|
|
401
402
|
}
|
|
402
403
|
return {
|
|
@@ -505,7 +506,7 @@ async function minifyCSS(css, config) {
|
|
|
505
506
|
});
|
|
506
507
|
if (warnings.length) {
|
|
507
508
|
const msgs = await (0, esbuild_1.formatMessages)(warnings, { kind: 'warning' });
|
|
508
|
-
config.logger.warn(
|
|
509
|
+
config.logger.warn(picocolors_1.default.yellow(`warnings when minifying css:\n${msgs.join('\n')}`));
|
|
509
510
|
}
|
|
510
511
|
return code;
|
|
511
512
|
}
|
package/dist/vite/utils/url.d.ts
CHANGED
|
@@ -11,6 +11,17 @@ export declare function parseVueRequest(id: string): {
|
|
|
11
11
|
query: VueQuery;
|
|
12
12
|
};
|
|
13
13
|
export declare const isImportRequest: (url: string) => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Prefix for resolved fs paths, since windows paths may not be valid as URLs.
|
|
16
|
+
*/
|
|
17
|
+
export declare const FS_PREFIX = "/@fs/";
|
|
18
|
+
/**
|
|
19
|
+
* Prefix for resolved Ids that are not valid browser import specifiers
|
|
20
|
+
*/
|
|
21
|
+
export declare const VALID_ID_PREFIX = "/@id/";
|
|
22
|
+
export declare const CLIENT_PUBLIC_PATH = "/@vite/client";
|
|
23
|
+
export declare const ENV_PUBLIC_PATH = "/@vite/env";
|
|
24
|
+
export declare const isInternalRequest: (url: string) => boolean;
|
|
14
25
|
export declare const queryRE: RegExp;
|
|
15
26
|
export declare const hashRE: RegExp;
|
|
16
27
|
export declare const cleanUrl: (url: string) => string;
|
package/dist/vite/utils/url.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.isJsFile = exports.cleanUrl = exports.hashRE = exports.queryRE = exports.isImportRequest = exports.parseVueRequest = void 0;
|
|
6
|
+
exports.isJsFile = exports.cleanUrl = exports.hashRE = exports.queryRE = exports.isInternalRequest = exports.ENV_PUBLIC_PATH = exports.CLIENT_PUBLIC_PATH = exports.VALID_ID_PREFIX = exports.FS_PREFIX = exports.isImportRequest = exports.parseVueRequest = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const querystring_1 = __importDefault(require("querystring"));
|
|
9
9
|
const constants_1 = require("../../constants");
|
|
@@ -28,9 +28,28 @@ function parseVueRequest(id) {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
exports.parseVueRequest = parseVueRequest;
|
|
31
|
-
const importQueryRE = /(\?|&)import(?:&|$)/;
|
|
31
|
+
const importQueryRE = /(\?|&)import=?(?:&|$)/;
|
|
32
32
|
const isImportRequest = (url) => importQueryRE.test(url);
|
|
33
33
|
exports.isImportRequest = isImportRequest;
|
|
34
|
+
/**
|
|
35
|
+
* Prefix for resolved fs paths, since windows paths may not be valid as URLs.
|
|
36
|
+
*/
|
|
37
|
+
exports.FS_PREFIX = `/@fs/`;
|
|
38
|
+
/**
|
|
39
|
+
* Prefix for resolved Ids that are not valid browser import specifiers
|
|
40
|
+
*/
|
|
41
|
+
exports.VALID_ID_PREFIX = `/@id/`;
|
|
42
|
+
exports.CLIENT_PUBLIC_PATH = `/@vite/client`;
|
|
43
|
+
exports.ENV_PUBLIC_PATH = `/@vite/env`;
|
|
44
|
+
const internalPrefixes = [
|
|
45
|
+
exports.FS_PREFIX,
|
|
46
|
+
exports.VALID_ID_PREFIX,
|
|
47
|
+
exports.CLIENT_PUBLIC_PATH,
|
|
48
|
+
exports.ENV_PUBLIC_PATH,
|
|
49
|
+
];
|
|
50
|
+
const InternalPrefixRE = new RegExp(`^(?:${internalPrefixes.join('|')})`);
|
|
51
|
+
const isInternalRequest = (url) => InternalPrefixRE.test(url);
|
|
52
|
+
exports.isInternalRequest = isInternalRequest;
|
|
34
53
|
exports.queryRE = /\?.*$/;
|
|
35
54
|
exports.hashRE = /#.*$/;
|
|
36
55
|
const cleanUrl = (url) => url.replace(exports.hashRE, '').replace(exports.queryRE, '');
|
|
@@ -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;
|
package/dist/vite/utils/utils.js
CHANGED
|
@@ -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;
|
|
@@ -37,6 +37,12 @@ exports.transformMatchMedia = (0, transformTag_1.createTransformTag)({
|
|
|
37
37
|
'match-media': 'uni-match-media',
|
|
38
38
|
});
|
|
39
39
|
exports.transformTapToClick = (0, transformEvent_1.createTransformEvent)({
|
|
40
|
-
tap:
|
|
40
|
+
tap: (node) => {
|
|
41
|
+
// 地图组件有自己特定的 tap 事件
|
|
42
|
+
if (node.tag === 'map' || node.tag === 'v-uni-map') {
|
|
43
|
+
return 'tap';
|
|
44
|
+
}
|
|
45
|
+
return 'click';
|
|
46
|
+
},
|
|
41
47
|
});
|
|
42
48
|
exports.transformComponentLink = (0, transformComponent_1.createTransformComponentLink)(constants_1.COMPONENT_BIND_LINK);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { NodeTransform } from '@vue/compiler-core';
|
|
2
|
-
export declare function createTransformEvent(options: Record<string, string>): NodeTransform;
|
|
1
|
+
import { DirectiveNode, ElementNode, NodeTransform } from '@vue/compiler-core';
|
|
2
|
+
export declare function createTransformEvent(options: Record<string, string | ((node: ElementNode, dir: DirectiveNode) => string)>): NodeTransform;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createTransformEvent = void 0;
|
|
4
|
+
const shared_1 = require("@vue/shared");
|
|
4
5
|
const ast_1 = require("../../vite/utils/ast");
|
|
5
6
|
function createTransformEvent(options) {
|
|
6
7
|
return function transformEvent(node) {
|
|
@@ -13,7 +14,12 @@ function createTransformEvent(options) {
|
|
|
13
14
|
const eventType = options[arg.content];
|
|
14
15
|
if (eventType) {
|
|
15
16
|
// e.g tap => click
|
|
16
|
-
|
|
17
|
+
if ((0, shared_1.isFunction)(eventType)) {
|
|
18
|
+
arg.content = eventType(node, prop);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
arg.content = eventType;
|
|
22
|
+
}
|
|
17
23
|
}
|
|
18
24
|
}
|
|
19
25
|
});
|
package/dist/watcher.d.ts
CHANGED
|
@@ -18,8 +18,8 @@ export declare class FileWatcher {
|
|
|
18
18
|
watch(watchOptions: WatchOptions & {
|
|
19
19
|
cwd: string;
|
|
20
20
|
}, onReady?: (watcher: FSWatcher) => void, onChange?: () => void): FSWatcher;
|
|
21
|
-
add(paths: string | ReadonlyArray<string>):
|
|
22
|
-
unwatch(paths: string | ReadonlyArray<string>):
|
|
21
|
+
add(paths: string | ReadonlyArray<string>): FSWatcher;
|
|
22
|
+
unwatch(paths: string | ReadonlyArray<string>): FSWatcher;
|
|
23
23
|
close(): Promise<void>;
|
|
24
24
|
copy(from: string): Promise<void | undefined>;
|
|
25
25
|
remove(from: string): Promise<void | undefined>;
|
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-3031120220221001",
|
|
4
4
|
"description": "@dcloudio/uni-cli-shared",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,26 +18,26 @@
|
|
|
18
18
|
"url": "https://github.com/dcloudio/uni-app/issues"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@babel/core": "^7.
|
|
21
|
+
"@babel/core": "^7.17.2",
|
|
22
22
|
"@babel/parser": "^7.16.4",
|
|
23
|
-
"@babel/types": "^7.16.
|
|
24
|
-
"@dcloudio/uni-i18n": "3.0.0-alpha-
|
|
25
|
-
"@dcloudio/uni-shared": "3.0.0-alpha-
|
|
23
|
+
"@babel/types": "^7.16.8",
|
|
24
|
+
"@dcloudio/uni-i18n": "3.0.0-alpha-3031120220221001",
|
|
25
|
+
"@dcloudio/uni-shared": "3.0.0-alpha-3031120220221001",
|
|
26
26
|
"@rollup/pluginutils": "^4.1.2",
|
|
27
|
-
"@vue/compiler-core": "3.2.
|
|
28
|
-
"@vue/compiler-dom": "3.2.
|
|
29
|
-
"@vue/compiler-sfc": "3.2.
|
|
30
|
-
"@vue/server-renderer": "3.2.
|
|
31
|
-
"@vue/shared": "3.2.
|
|
27
|
+
"@vue/compiler-core": "3.2.31",
|
|
28
|
+
"@vue/compiler-dom": "3.2.31",
|
|
29
|
+
"@vue/compiler-sfc": "3.2.31",
|
|
30
|
+
"@vue/server-renderer": "3.2.31",
|
|
31
|
+
"@vue/shared": "3.2.31",
|
|
32
|
+
"autoprefixer": "^10.4.2",
|
|
32
33
|
"base64url": "^3.0.1",
|
|
33
|
-
"
|
|
34
|
-
"chokidar": "^3.5.2",
|
|
34
|
+
"chokidar": "^3.5.3",
|
|
35
35
|
"compare-versions": "^3.6.0",
|
|
36
|
-
"debug": "^4.3.
|
|
36
|
+
"debug": "^4.3.3",
|
|
37
37
|
"es-module-lexer": "^0.9.3",
|
|
38
|
-
"esbuild": "^0.
|
|
38
|
+
"esbuild": "^0.14.14",
|
|
39
39
|
"estree-walker": "^2.0.2",
|
|
40
|
-
"fast-glob": "^3.2.
|
|
40
|
+
"fast-glob": "^3.2.11",
|
|
41
41
|
"fs-extra": "^10.0.0",
|
|
42
42
|
"hash-sum": "^2.0.0",
|
|
43
43
|
"jsonc-parser": "^3.0.0",
|
|
@@ -45,11 +45,12 @@
|
|
|
45
45
|
"merge": "^2.1.1",
|
|
46
46
|
"mime": "^3.0.0",
|
|
47
47
|
"module-alias": "^2.2.2",
|
|
48
|
+
"picocolors": "^1.0.0",
|
|
48
49
|
"postcss-import": "^14.0.2",
|
|
49
|
-
"postcss-load-config": "^3.1.
|
|
50
|
-
"postcss-modules": "^4.
|
|
50
|
+
"postcss-load-config": "^3.1.1",
|
|
51
|
+
"postcss-modules": "^4.3.0",
|
|
51
52
|
"postcss-selector-parser": "^6.0.6",
|
|
52
|
-
"resolve": "^1.
|
|
53
|
+
"resolve": "^1.22.0",
|
|
53
54
|
"tapable": "^2.2.0",
|
|
54
55
|
"xregexp": "3.1.0"
|
|
55
56
|
},
|
|
@@ -62,6 +63,6 @@
|
|
|
62
63
|
"@types/mime": "^2.0.3",
|
|
63
64
|
"@types/module-alias": "^2.0.1",
|
|
64
65
|
"@types/stylus": "^0.48.36",
|
|
65
|
-
"postcss": "^8.4.
|
|
66
|
+
"postcss": "^8.4.6"
|
|
66
67
|
}
|
|
67
68
|
}
|