@dcloudio/uni-cli-shared 3.0.0-alpha-3061620221230002 → 3.0.0-alpha-3061620230109001
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/easycom.d.ts +1 -1
- package/dist/easycom.js +10 -26
- package/dist/hbx/log.js +2 -1
- package/dist/json/app/manifest/arguments.js +2 -1
- package/dist/json/app/manifest/confusion.js +4 -2
- package/dist/json/app/manifest/env.js +4 -2
- package/dist/json/app/manifest/launchwebview.js +1 -1
- package/dist/json/app/manifest/nvue.js +2 -1
- package/dist/json/app/manifest/plus.js +4 -2
- package/dist/json/app/manifest/safearea.js +2 -1
- package/dist/json/app/manifest/splashscreen.js +2 -1
- package/dist/json/app/manifest/tabBar.js +2 -1
- package/dist/json/app/pages/uniConfig.js +4 -2
- package/dist/json/manifest.js +16 -12
- package/dist/json/mp/jsonFile.js +2 -1
- package/dist/json/mp/pages.js +1 -1
- package/dist/json/pages.js +3 -2
- package/dist/logs/format.js +1 -1
- package/dist/mp/ast.d.ts +1 -2
- package/dist/postcss/plugins/uniapp.js +2 -1
- package/dist/scripts.js +3 -2
- package/dist/uni_modules.js +2 -2
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/dist/uts.d.ts +0 -2
- package/dist/uts.js +1 -64
- package/dist/vite/plugins/vitejs/plugins/asset.js +6 -5
- package/dist/vite/plugins/vitejs/plugins/css.js +48 -18
- package/dist/vite/plugins/vitejs/utils.js +1 -1
- package/package.json +9 -9
package/dist/easycom.d.ts
CHANGED
package/dist/easycom.js
CHANGED
|
@@ -13,7 +13,6 @@ const uni_shared_1 = require("@dcloudio/uni-shared");
|
|
|
13
13
|
const utils_1 = require("./utils");
|
|
14
14
|
const pages_1 = require("./json/pages");
|
|
15
15
|
const messages_1 = require("./messages");
|
|
16
|
-
const uts_1 = require("./uts");
|
|
17
16
|
const debugEasycom = (0, debug_1.default)('uni:easycom');
|
|
18
17
|
const easycoms = [];
|
|
19
18
|
const easycomsCache = new Map();
|
|
@@ -46,33 +45,18 @@ function initEasycoms(inputDir, { dirs, platform }) {
|
|
|
46
45
|
return easycomOptions;
|
|
47
46
|
};
|
|
48
47
|
const options = initEasycomOptions((0, pages_1.parsePagesJsonOnce)(inputDir, platform));
|
|
49
|
-
const initUTSEasycom = () => {
|
|
50
|
-
(0, uts_1.initUTSComponents)(inputDir, platform).forEach((item) => {
|
|
51
|
-
const index = easycoms.findIndex((easycom) => item.pattern.toString() === easycom.pattern.toString());
|
|
52
|
-
if (index > -1) {
|
|
53
|
-
easycoms.splice(index, 1, item);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
easycoms.push(item);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
48
|
initEasycom(options);
|
|
61
|
-
initUTSEasycom();
|
|
62
49
|
const res = {
|
|
63
50
|
options,
|
|
64
51
|
filter: (0, pluginutils_1.createFilter)([
|
|
65
52
|
'components/*/*.(vue|jsx|tsx)',
|
|
66
53
|
'uni_modules/*/components/*/*.(vue|jsx|tsx)',
|
|
67
|
-
'utssdk/*/**/*.vue',
|
|
68
|
-
'uni_modules/*/utssdk/*/*.vue',
|
|
69
54
|
], [], {
|
|
70
55
|
resolve: inputDir,
|
|
71
56
|
}),
|
|
72
57
|
refresh() {
|
|
73
58
|
res.options = initEasycomOptions();
|
|
74
59
|
initEasycom(res.options);
|
|
75
|
-
initUTSEasycom();
|
|
76
60
|
},
|
|
77
61
|
easycoms,
|
|
78
62
|
};
|
|
@@ -173,28 +157,28 @@ function initAutoScanEasycoms(dirs, rootDir, extensions) {
|
|
|
173
157
|
const curEasycoms = initAutoScanEasycom(dir, rootDir, extensions);
|
|
174
158
|
Object.keys(curEasycoms).forEach((name) => {
|
|
175
159
|
// Use the first component when name conflict
|
|
176
|
-
const
|
|
177
|
-
if (!
|
|
160
|
+
const compath = easycoms[name];
|
|
161
|
+
if (!compath) {
|
|
178
162
|
easycoms[name] = curEasycoms[name];
|
|
179
163
|
}
|
|
180
164
|
else {
|
|
181
165
|
;
|
|
182
|
-
(conflict[
|
|
166
|
+
(conflict[compath] || (conflict[compath] = [])).push(normalizeCompath(curEasycoms[name], rootDir));
|
|
183
167
|
}
|
|
184
168
|
});
|
|
185
169
|
return easycoms;
|
|
186
170
|
}, Object.create(null));
|
|
187
|
-
const
|
|
188
|
-
if (
|
|
171
|
+
const conflictComs = Object.keys(conflict);
|
|
172
|
+
if (conflictComs.length) {
|
|
189
173
|
console.warn(messages_1.M['easycom.conflict']);
|
|
190
|
-
|
|
191
|
-
console.warn([
|
|
174
|
+
conflictComs.forEach((com) => {
|
|
175
|
+
console.warn([normalizeCompath(com, rootDir), conflict[com]].join(','));
|
|
192
176
|
});
|
|
193
177
|
}
|
|
194
178
|
return res;
|
|
195
179
|
}
|
|
196
|
-
function
|
|
197
|
-
return (0, utils_1.normalizePath)(path_1.default.relative(rootDir,
|
|
180
|
+
function normalizeCompath(compath, rootDir) {
|
|
181
|
+
return (0, utils_1.normalizePath)(path_1.default.relative(rootDir, compath));
|
|
198
182
|
}
|
|
199
183
|
function addImportDeclaration(importDeclarations, local, source, imported) {
|
|
200
184
|
importDeclarations.push(createImportDeclaration(local, source, imported));
|
|
@@ -203,7 +187,7 @@ function addImportDeclaration(importDeclarations, local, source, imported) {
|
|
|
203
187
|
exports.addImportDeclaration = addImportDeclaration;
|
|
204
188
|
function createImportDeclaration(local, source, imported) {
|
|
205
189
|
if (imported) {
|
|
206
|
-
return `import {
|
|
190
|
+
return `import {${imported} as ${local}} from '${source}';`;
|
|
207
191
|
}
|
|
208
192
|
return `import ${local} from '${source}';`;
|
|
209
193
|
}
|
package/dist/hbx/log.js
CHANGED
|
@@ -107,6 +107,7 @@ exports.errorFormatter = {
|
|
|
107
107
|
},
|
|
108
108
|
};
|
|
109
109
|
function buildErrorMessage(err, args = [], includeStack = true) {
|
|
110
|
+
var _a, _b;
|
|
110
111
|
if (err.plugin) {
|
|
111
112
|
args.push(`${picocolors_1.default.magenta('[plugin:' + err.plugin + ']')} ${picocolors_1.default.red(err.message)}`);
|
|
112
113
|
if (err.loc &&
|
|
@@ -131,7 +132,7 @@ function buildErrorMessage(err, args = [], includeStack = true) {
|
|
|
131
132
|
args.push(picocolors_1.default.red(err.message));
|
|
132
133
|
}
|
|
133
134
|
if (err.id) {
|
|
134
|
-
args.push(formatAtFilename(err.id, err.loc
|
|
135
|
+
args.push(formatAtFilename(err.id, (_a = err.loc) === null || _a === void 0 ? void 0 : _a.line, (_b = err.loc) === null || _b === void 0 ? void 0 : _b.column));
|
|
135
136
|
}
|
|
136
137
|
if (err.frame) {
|
|
137
138
|
args.push(picocolors_1.default.yellow(pad(err.frame)));
|
|
@@ -9,6 +9,7 @@ function initArguments(manifestJson, pagesJson) {
|
|
|
9
9
|
}
|
|
10
10
|
exports.initArguments = initArguments;
|
|
11
11
|
function parseArguments(pagesJson) {
|
|
12
|
+
var _a;
|
|
12
13
|
if (process.env.NODE_ENV !== 'development') {
|
|
13
14
|
return;
|
|
14
15
|
}
|
|
@@ -20,7 +21,7 @@ function parseArguments(pagesJson) {
|
|
|
20
21
|
});
|
|
21
22
|
}
|
|
22
23
|
const condition = pagesJson.condition;
|
|
23
|
-
if (condition && condition.list
|
|
24
|
+
if (condition && ((_a = condition.list) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
24
25
|
const list = condition.list;
|
|
25
26
|
let current = condition.current || 0;
|
|
26
27
|
if (current < 0) {
|
|
@@ -23,9 +23,10 @@ function isConfusionFile(filename) {
|
|
|
23
23
|
}
|
|
24
24
|
exports.isConfusionFile = isConfusionFile;
|
|
25
25
|
function hasConfusionFile(inputDir) {
|
|
26
|
+
var _a, _b;
|
|
26
27
|
if (inputDir) {
|
|
27
28
|
const manifestJson = (0, manifest_1.parseManifestJsonOnce)(inputDir);
|
|
28
|
-
const resources = manifestJson['app-plus']
|
|
29
|
+
const resources = (_b = (_a = manifestJson['app-plus']) === null || _a === void 0 ? void 0 : _a.confusion) === null || _b === void 0 ? void 0 : _b.resources;
|
|
29
30
|
if (resources && parseConfusion(resources)[1].length) {
|
|
30
31
|
return true;
|
|
31
32
|
}
|
|
@@ -63,8 +64,9 @@ function parseConfusion(resources) {
|
|
|
63
64
|
return [res, dynamicJsFiles];
|
|
64
65
|
}
|
|
65
66
|
function initConfusion(manifestJson) {
|
|
67
|
+
var _a;
|
|
66
68
|
dynamicConfusionJsFiles.length = 0;
|
|
67
|
-
if (!manifestJson.plus.confusion
|
|
69
|
+
if (!((_a = manifestJson.plus.confusion) === null || _a === void 0 ? void 0 : _a.resources)) {
|
|
68
70
|
return;
|
|
69
71
|
}
|
|
70
72
|
const resources = manifestJson.plus.confusion.resources;
|
|
@@ -10,13 +10,15 @@ function getAppRenderer(manifestJson) {
|
|
|
10
10
|
}
|
|
11
11
|
exports.getAppRenderer = getAppRenderer;
|
|
12
12
|
function getAppCodeSpliting(manifestJson) {
|
|
13
|
-
|
|
13
|
+
var _a, _b;
|
|
14
|
+
if (((_b = (_a = manifestJson['app-plus']) === null || _a === void 0 ? void 0 : _a.optimization) === null || _b === void 0 ? void 0 : _b.codeSpliting) === true) {
|
|
14
15
|
return true;
|
|
15
16
|
}
|
|
16
17
|
return false;
|
|
17
18
|
}
|
|
18
19
|
exports.getAppCodeSpliting = getAppCodeSpliting;
|
|
19
20
|
function getAppStyleIsolation(manifestJson) {
|
|
20
|
-
|
|
21
|
+
var _a, _b, _c;
|
|
22
|
+
return ((_c = (_b = (_a = manifestJson['app-plus']) === null || _a === void 0 ? void 0 : _a.optimization) === null || _b === void 0 ? void 0 : _b.styleIsolation) !== null && _c !== void 0 ? _c : 'apply-shared');
|
|
21
23
|
}
|
|
22
24
|
exports.getAppStyleIsolation = getAppStyleIsolation;
|
|
@@ -21,7 +21,7 @@ function initLaunchwebview(manifestJson, pagesJson) {
|
|
|
21
21
|
});
|
|
22
22
|
// 首页为nvue
|
|
23
23
|
const entryPage = pagesJson.pages.find((p) => p.path === entryPagePath);
|
|
24
|
-
if (entryPage
|
|
24
|
+
if (entryPage === null || entryPage === void 0 ? void 0 : entryPage.style.isNVue) {
|
|
25
25
|
manifestJson.plus.launchwebview.uniNView = { path: entryPagePath + '.js' };
|
|
26
26
|
}
|
|
27
27
|
else {
|
|
@@ -30,8 +30,9 @@ function getNVueStyleCompiler(manifestJson) {
|
|
|
30
30
|
exports.getNVueStyleCompiler = getNVueStyleCompiler;
|
|
31
31
|
const flexDirs = ['row', 'row-reverse', 'column', 'column-reverse'];
|
|
32
32
|
function getNVueFlexDirection(manifestJson) {
|
|
33
|
+
var _a, _b;
|
|
33
34
|
let flexDir = 'column';
|
|
34
|
-
if (manifestJson['app-plus']
|
|
35
|
+
if ((_b = (_a = manifestJson['app-plus']) === null || _a === void 0 ? void 0 : _a.nvue) === null || _b === void 0 ? void 0 : _b['flex-direction']) {
|
|
35
36
|
flexDir = manifestJson['app-plus'].nvue['flex-direction'];
|
|
36
37
|
if (flexDirs.indexOf(flexDir) === -1) {
|
|
37
38
|
flexDir = 'column';
|
|
@@ -14,6 +14,7 @@ const wxPageOrientationMapping = {
|
|
|
14
14
|
landscape: ['landscape-primary', 'landscape-secondary'],
|
|
15
15
|
};
|
|
16
16
|
function initPlus(manifestJson, pagesJson) {
|
|
17
|
+
var _a;
|
|
17
18
|
initUniStatistics(manifestJson);
|
|
18
19
|
// 转换为老版本配置
|
|
19
20
|
if (manifestJson.plus.modules) {
|
|
@@ -49,7 +50,7 @@ function initPlus(manifestJson, pagesJson) {
|
|
|
49
50
|
manifestJson.screenOrientation = manifestJson.plus.screenOrientation;
|
|
50
51
|
delete manifestJson.plus.screenOrientation;
|
|
51
52
|
}
|
|
52
|
-
else if (pagesJson.globalStyle
|
|
53
|
+
else if ((_a = pagesJson.globalStyle) === null || _a === void 0 ? void 0 : _a.pageOrientation) {
|
|
53
54
|
// 兼容微信小程序
|
|
54
55
|
const pageOrientationValue = wxPageOrientationMapping[pagesJson.globalStyle
|
|
55
56
|
.pageOrientation];
|
|
@@ -92,6 +93,7 @@ function initPlus(manifestJson, pagesJson) {
|
|
|
92
93
|
}
|
|
93
94
|
exports.initPlus = initPlus;
|
|
94
95
|
function initUniStatistics(manifestJson) {
|
|
96
|
+
var _a;
|
|
95
97
|
// 根节点配置了统计
|
|
96
98
|
if (manifestJson.uniStatistics) {
|
|
97
99
|
manifestJson.plus.uniStatistics = (0, merge_1.recursive)(true, manifestJson.uniStatistics, manifestJson.plus.uniStatistics);
|
|
@@ -112,7 +114,7 @@ function initUniStatistics(manifestJson) {
|
|
|
112
114
|
if (!space) {
|
|
113
115
|
return;
|
|
114
116
|
}
|
|
115
|
-
const uniStatistics = manifestJson.plus
|
|
117
|
+
const uniStatistics = (_a = manifestJson.plus) === null || _a === void 0 ? void 0 : _a.uniStatistics;
|
|
116
118
|
if (!uniStatistics) {
|
|
117
119
|
return;
|
|
118
120
|
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.initSafearea = void 0;
|
|
4
4
|
function initSafearea(manifestJson, pagesJson) {
|
|
5
|
-
|
|
5
|
+
var _a, _b;
|
|
6
|
+
if ((_b = (_a = pagesJson.tabBar) === null || _a === void 0 ? void 0 : _a.list) === null || _b === void 0 ? void 0 : _b.length) {
|
|
6
7
|
// 安全区配置 仅包含 tabBar 的时候才配置
|
|
7
8
|
if (!manifestJson.plus.safearea) {
|
|
8
9
|
manifestJson.plus.safearea = {
|
|
@@ -34,7 +34,8 @@ function initSplashscreen(manifestJson, userManifestJson) {
|
|
|
34
34
|
}
|
|
35
35
|
exports.initSplashscreen = initSplashscreen;
|
|
36
36
|
function getSplashscreen(manifestJson) {
|
|
37
|
-
|
|
37
|
+
var _a;
|
|
38
|
+
const splashscreenOptions = ((_a = manifestJson['app-plus']) === null || _a === void 0 ? void 0 : _a.splashscreen) || {};
|
|
38
39
|
return {
|
|
39
40
|
autoclose: splashscreenOptions.autoclose !== false,
|
|
40
41
|
alwaysShowBeforeRender: splashscreenOptions.alwaysShowBeforeRender !== false,
|
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.initTabBar = void 0;
|
|
4
4
|
const uni_shared_1 = require("@dcloudio/uni-shared");
|
|
5
5
|
function initTabBar(entryPagePath, manifestJson, pagesJson) {
|
|
6
|
-
|
|
6
|
+
var _a, _b;
|
|
7
|
+
if (!((_b = (_a = pagesJson.tabBar) === null || _a === void 0 ? void 0 : _a.list) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
7
8
|
return;
|
|
8
9
|
}
|
|
9
10
|
const tabBar = JSON.parse(JSON.stringify(pagesJson.tabBar));
|
|
@@ -12,6 +12,7 @@ const arguments_1 = require("../manifest/arguments");
|
|
|
12
12
|
const splashscreen_1 = require("../manifest/splashscreen");
|
|
13
13
|
const theme_1 = require("../../theme");
|
|
14
14
|
function normalizeAppUniConfig(pagesJson, manifestJson) {
|
|
15
|
+
var _a;
|
|
15
16
|
const { autoclose, alwaysShowBeforeRender } = (0, splashscreen_1.getSplashscreen)(manifestJson);
|
|
16
17
|
const platformConfig = (0, manifest_1.getPlatformManifestJsonOnce)();
|
|
17
18
|
const config = {
|
|
@@ -22,7 +23,7 @@ function normalizeAppUniConfig(pagesJson, manifestJson) {
|
|
|
22
23
|
styleCompiler: (0, manifest_2.getNVueStyleCompiler)(manifestJson),
|
|
23
24
|
'flex-direction': (0, manifest_2.getNVueFlexDirection)(manifestJson),
|
|
24
25
|
},
|
|
25
|
-
renderer: manifestJson['app-plus']
|
|
26
|
+
renderer: ((_a = manifestJson['app-plus']) === null || _a === void 0 ? void 0 : _a.renderer) === 'native' ? 'native' : 'auto',
|
|
26
27
|
appname: manifestJson.name || '',
|
|
27
28
|
splashscreen: {
|
|
28
29
|
alwaysShowBeforeRender,
|
|
@@ -41,6 +42,7 @@ function normalizeAppUniConfig(pagesJson, manifestJson) {
|
|
|
41
42
|
}
|
|
42
43
|
exports.normalizeAppUniConfig = normalizeAppUniConfig;
|
|
43
44
|
function parseEntryPagePath(pagesJson) {
|
|
45
|
+
var _a;
|
|
44
46
|
const res = {
|
|
45
47
|
entryPagePath: '',
|
|
46
48
|
entryPageQuery: '',
|
|
@@ -60,7 +62,7 @@ function parseEntryPagePath(pagesJson) {
|
|
|
60
62
|
res.entryPagePath = entryPagePath;
|
|
61
63
|
res.entryPageQuery = args.query ? '?' + args.query : '';
|
|
62
64
|
// non tabBar page
|
|
63
|
-
if (!(pagesJson.tabBar
|
|
65
|
+
if (!(((_a = pagesJson.tabBar) === null || _a === void 0 ? void 0 : _a.list) || []).find((page) => page.pagePath === entryPagePath)) {
|
|
64
66
|
res.realEntryPagePath = realEntryPagePath;
|
|
65
67
|
}
|
|
66
68
|
}
|
package/dist/json/manifest.js
CHANGED
|
@@ -44,19 +44,17 @@ function normalizeNetworkTimeout(networkTimeout) {
|
|
|
44
44
|
exports.normalizeNetworkTimeout = normalizeNetworkTimeout;
|
|
45
45
|
function getUniStatistics(inputDir, platform) {
|
|
46
46
|
const manifest = (0, exports.parseManifestJsonOnce)(inputDir);
|
|
47
|
-
if (platform === 'app') {
|
|
48
|
-
platform = 'app-plus';
|
|
49
|
-
}
|
|
50
47
|
return (0, shared_1.extend)({}, manifest.uniStatistics, manifest[platform] && manifest[platform].uniStatistics);
|
|
51
48
|
}
|
|
52
49
|
exports.getUniStatistics = getUniStatistics;
|
|
53
50
|
function isEnableUniPushV1(inputDir, platform) {
|
|
51
|
+
var _a, _b, _c;
|
|
54
52
|
if (isEnableUniPushV2(inputDir, platform)) {
|
|
55
53
|
return false;
|
|
56
54
|
}
|
|
57
55
|
const manifest = (0, exports.parseManifestJsonOnce)(inputDir);
|
|
58
56
|
if (platform === 'app') {
|
|
59
|
-
const push = manifest['app-plus']
|
|
57
|
+
const push = (_c = (_b = (_a = 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;
|
|
60
58
|
if (push && (0, shared_1.hasOwn)(push, 'unipush')) {
|
|
61
59
|
return true;
|
|
62
60
|
}
|
|
@@ -65,38 +63,44 @@ function isEnableUniPushV1(inputDir, platform) {
|
|
|
65
63
|
}
|
|
66
64
|
exports.isEnableUniPushV1 = isEnableUniPushV1;
|
|
67
65
|
function isEnableUniPushV2(inputDir, platform) {
|
|
66
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
68
67
|
const manifest = (0, exports.parseManifestJsonOnce)(inputDir);
|
|
69
68
|
if (platform === 'app') {
|
|
70
|
-
return (manifest['app-plus']
|
|
69
|
+
return (((_e = (_d = (_c = (_b = (_a = 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.version) ==
|
|
71
70
|
'2');
|
|
72
71
|
}
|
|
73
|
-
return manifest[platform]
|
|
72
|
+
return ((_g = (_f = manifest[platform]) === null || _f === void 0 ? void 0 : _f.unipush) === null || _g === void 0 ? void 0 : _g.enable) === true;
|
|
74
73
|
}
|
|
75
74
|
exports.isEnableUniPushV2 = isEnableUniPushV2;
|
|
76
75
|
function isEnableSecureNetwork(inputDir, platform) {
|
|
76
|
+
var _a, _b, _c, _d;
|
|
77
77
|
const manifest = (0, exports.parseManifestJsonOnce)(inputDir);
|
|
78
78
|
if (platform === 'app') {
|
|
79
|
-
return !!manifest['app-plus']
|
|
79
|
+
return !!((_b = (_a = manifest['app-plus']) === null || _a === void 0 ? void 0 : _a.modules) === null || _b === void 0 ? void 0 : _b.SecureNetwork);
|
|
80
80
|
}
|
|
81
|
-
return manifest[platform]
|
|
81
|
+
return ((_d = (_c = manifest[platform]) === null || _c === void 0 ? void 0 : _c.secureNetwork) === null || _d === void 0 ? void 0 : _d.enable) === true;
|
|
82
82
|
}
|
|
83
83
|
exports.isEnableSecureNetwork = isEnableSecureNetwork;
|
|
84
84
|
function isUniPushOffline(inputDir) {
|
|
85
|
+
var _a, _b, _c, _d, _e;
|
|
85
86
|
const manifest = (0, exports.parseManifestJsonOnce)(inputDir);
|
|
86
|
-
return (manifest['app-plus']
|
|
87
|
+
return (((_e = (_d = (_c = (_b = (_a = 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.offline) ===
|
|
87
88
|
true);
|
|
88
89
|
}
|
|
89
90
|
exports.isUniPushOffline = isUniPushOffline;
|
|
90
91
|
function getRouterOptions(manifestJson) {
|
|
91
|
-
|
|
92
|
+
var _a;
|
|
93
|
+
return (0, shared_1.extend)({}, (_a = manifestJson.h5) === null || _a === void 0 ? void 0 : _a.router);
|
|
92
94
|
}
|
|
93
95
|
exports.getRouterOptions = getRouterOptions;
|
|
94
96
|
function isEnableTreeShaking(manifestJson) {
|
|
95
|
-
|
|
97
|
+
var _a, _b, _c;
|
|
98
|
+
return ((_c = (_b = (_a = manifestJson.h5) === null || _a === void 0 ? void 0 : _a.optimization) === null || _b === void 0 ? void 0 : _b.treeShaking) === null || _c === void 0 ? void 0 : _c.enable) !== false;
|
|
96
99
|
}
|
|
97
100
|
exports.isEnableTreeShaking = isEnableTreeShaking;
|
|
98
101
|
function getDevServerOptions(manifestJson) {
|
|
99
|
-
|
|
102
|
+
var _a;
|
|
103
|
+
return (0, shared_1.extend)({}, (_a = manifestJson.h5) === null || _a === void 0 ? void 0 : _a.devServer);
|
|
100
104
|
}
|
|
101
105
|
exports.getDevServerOptions = getDevServerOptions;
|
|
102
106
|
function getPlatformManifestJsonOnce() {
|
package/dist/json/mp/jsonFile.js
CHANGED
|
@@ -53,6 +53,7 @@ exports.normalizeJsonFilename = normalizeJsonFilename;
|
|
|
53
53
|
function findChangedJsonFiles(supportGlobalUsingComponents = true) {
|
|
54
54
|
const changedJsonFiles = new Map();
|
|
55
55
|
function findChangedFile(filename, json) {
|
|
56
|
+
var _a;
|
|
56
57
|
const newJson = JSON.parse(JSON.stringify(json));
|
|
57
58
|
if (!newJson.usingComponents) {
|
|
58
59
|
newJson.usingComponents = {};
|
|
@@ -62,7 +63,7 @@ function findChangedJsonFiles(supportGlobalUsingComponents = true) {
|
|
|
62
63
|
// app.json mp-baidu 在 win 不支持相对路径。所有平台改用绝对路径
|
|
63
64
|
if (filename !== 'app') {
|
|
64
65
|
let usingComponents = newJson.usingComponents;
|
|
65
|
-
const globalUsingComponents = appJsonCache
|
|
66
|
+
const globalUsingComponents = (_a = appJsonCache === null || appJsonCache === void 0 ? void 0 : appJsonCache.usingComponents) !== null && _a !== void 0 ? _a : {};
|
|
66
67
|
// 如果小程序不支持 global 的 usingComponents
|
|
67
68
|
if (!supportGlobalUsingComponents) {
|
|
68
69
|
// 从 appJsonCache 中读取全局的 usingComponents 并补充到子组件 usingComponents 中
|
package/dist/json/mp/pages.js
CHANGED
|
@@ -115,7 +115,7 @@ function parsePagesJson(jsonStr, platform, { debug, darkmode, networkTimeout, su
|
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
;
|
|
118
|
-
['preloadRule', 'workers', 'plugins'
|
|
118
|
+
['preloadRule', 'workers', 'plugins'].forEach((name) => {
|
|
119
119
|
if ((0, shared_1.hasOwn)(pagesJson, name)) {
|
|
120
120
|
appJson[name] = pagesJson[name];
|
|
121
121
|
}
|
package/dist/json/pages.js
CHANGED
|
@@ -305,7 +305,7 @@ function normalizeNavigationBar(pageStyle) {
|
|
|
305
305
|
return navigationBar;
|
|
306
306
|
}
|
|
307
307
|
function normalizeNavigationBarButton(btn, type, titleColor) {
|
|
308
|
-
btn.color = btn.color || titleColor;
|
|
308
|
+
btn.color = type === 'transparent' ? '#ffffff' : btn.color || titleColor;
|
|
309
309
|
if (!btn.fontSize) {
|
|
310
310
|
btn.fontSize =
|
|
311
311
|
type === 'transparent' || (btn.text && /\\u/.test(btn.text))
|
|
@@ -408,7 +408,8 @@ function normalizePagesRoute(pagesJson) {
|
|
|
408
408
|
}
|
|
409
409
|
exports.normalizePagesRoute = normalizePagesRoute;
|
|
410
410
|
function isEnablePullDownRefresh(pageStyle) {
|
|
411
|
-
|
|
411
|
+
var _a;
|
|
412
|
+
return pageStyle.enablePullDownRefresh || ((_a = pageStyle.pullToRefresh) === null || _a === void 0 ? void 0 : _a.support);
|
|
412
413
|
}
|
|
413
414
|
function normalizePullToRefresh(pageStyle) {
|
|
414
415
|
return pageStyle.pullToRefresh;
|
package/dist/logs/format.js
CHANGED
|
@@ -65,7 +65,7 @@ function formatInfoMsg(msg, options) {
|
|
|
65
65
|
if (formatter) {
|
|
66
66
|
return formatter.format(msg, options);
|
|
67
67
|
}
|
|
68
|
-
if (options
|
|
68
|
+
if (options === null || options === void 0 ? void 0 : options.nvue) {
|
|
69
69
|
initNVueInfoFormattersOnce();
|
|
70
70
|
const formatter = nvueInfoFormatters.find(({ test }) => test(msg, options));
|
|
71
71
|
if (formatter) {
|
package/dist/mp/ast.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Program } from '@babel/types';
|
|
2
1
|
import { ParserPlugin } from '@babel/parser';
|
|
3
2
|
export declare function parseProgram(code: string, importer: string, { babelParserPlugins }: {
|
|
4
3
|
babelParserPlugins?: ParserPlugin[];
|
|
5
|
-
}): Program;
|
|
4
|
+
}): import("@babel/types").Program;
|
|
@@ -57,8 +57,9 @@ function walkDecls(rpx2unit) {
|
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
function filterPrefersColorScheme(root) {
|
|
60
|
+
var _a;
|
|
60
61
|
if (process.env.VUE_APP_DARK_MODE !== 'true') {
|
|
61
|
-
const filePath = root.source
|
|
62
|
+
const filePath = (_a = root.source) === null || _a === void 0 ? void 0 : _a.input.file;
|
|
62
63
|
if (filePath && filePath.includes('@dcloudio')) {
|
|
63
64
|
root.walkAtRules((rule) => {
|
|
64
65
|
if (rule.params.includes('prefers-color-scheme')) {
|
package/dist/scripts.js
CHANGED
|
@@ -7,16 +7,17 @@ exports.parseScripts = void 0;
|
|
|
7
7
|
const shared_1 = require("@vue/shared");
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
9
|
function parseScripts(name, pkgPath) {
|
|
10
|
+
var _a, _b;
|
|
10
11
|
if (!fs_1.default.existsSync(pkgPath)) {
|
|
11
12
|
return;
|
|
12
13
|
}
|
|
13
14
|
const pkg = JSON.parse(fs_1.default.readFileSync(pkgPath, 'utf8'));
|
|
14
|
-
const scripts = pkg['uni-app']
|
|
15
|
+
const scripts = ((_a = pkg['uni-app']) === null || _a === void 0 ? void 0 : _a.scripts) || {};
|
|
15
16
|
const options = scripts[name];
|
|
16
17
|
if (!options) {
|
|
17
18
|
return;
|
|
18
19
|
}
|
|
19
|
-
if (!options.env
|
|
20
|
+
if (!((_b = options.env) === null || _b === void 0 ? void 0 : _b.UNI_PLATFORM)) {
|
|
20
21
|
console.error(`package.json->uni-app->scripts->${name}->env->UNI_PLATFORM is required`);
|
|
21
22
|
process.exit(0);
|
|
22
23
|
}
|
package/dist/uni_modules.js
CHANGED
|
@@ -14,6 +14,7 @@ function parseUniExtApis(vite = true) {
|
|
|
14
14
|
}
|
|
15
15
|
const injects = {};
|
|
16
16
|
fs_extra_1.default.readdirSync(uniModulesDir).forEach((uniModuleDir) => {
|
|
17
|
+
var _a, _b;
|
|
17
18
|
// 必须以 uni- 开头
|
|
18
19
|
if (!uniModuleDir.startsWith('uni-')) {
|
|
19
20
|
return;
|
|
@@ -23,8 +24,7 @@ function parseUniExtApis(vite = true) {
|
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
25
26
|
try {
|
|
26
|
-
const exports = JSON.parse(fs_extra_1.default.readFileSync(pkgPath, 'utf8'))
|
|
27
|
-
?.uni_modules?.['uni-ext-api'];
|
|
27
|
+
const exports = (_b = (_a = JSON.parse(fs_extra_1.default.readFileSync(pkgPath, 'utf8'))) === null || _a === void 0 ? void 0 : _a.uni_modules) === null || _b === void 0 ? void 0 : _b['uni-ext-api'];
|
|
28
28
|
if (exports) {
|
|
29
29
|
Object.assign(injects, parseInjects(vite, process.env.UNI_PLATFORM === 'h5'
|
|
30
30
|
? 'web'
|
package/dist/utils.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare function normalizePagePath(pagePath: string, platform: UniApp.PLA
|
|
|
11
11
|
export declare function removeExt(str: string): string;
|
|
12
12
|
export declare function normalizeNodeModules(str: string): string;
|
|
13
13
|
export declare function normalizeMiniProgramFilename(filename: string, inputDir?: string): string;
|
|
14
|
-
export declare function normalizeParsePlugins(importer: string, babelParserPlugins?: ParserPlugin[]):
|
|
14
|
+
export declare function normalizeParsePlugins(importer: string, babelParserPlugins?: ParserPlugin[]): ParserPlugin[];
|
|
15
15
|
export declare function pathToGlob(pathString: string, glob: string, options?: {
|
|
16
16
|
windows?: boolean;
|
|
17
17
|
escape?: boolean;
|
package/dist/utils.js
CHANGED
|
@@ -17,7 +17,7 @@ exports.version = require('../package.json').version;
|
|
|
17
17
|
try {
|
|
18
18
|
exports.isRunningWithYarnPnp = Boolean(require('pnpapi'));
|
|
19
19
|
}
|
|
20
|
-
catch { }
|
|
20
|
+
catch (_a) { }
|
|
21
21
|
exports.isWindows = os_1.default.platform() === 'win32';
|
|
22
22
|
function normalizePath(id) {
|
|
23
23
|
return exports.isWindows ? id.replace(/\\/g, '/') : id;
|
package/dist/uts.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as UTSCompiler from '@dcloudio/uni-uts-v1';
|
|
2
|
-
import type { EasycomMatcher } from './easycom';
|
|
3
2
|
/**
|
|
4
3
|
* 解析 app 平台的 uts 插件,任意平台(android|ios)存在即可
|
|
5
4
|
* @param id
|
|
@@ -9,4 +8,3 @@ import type { EasycomMatcher } from './easycom';
|
|
|
9
8
|
export declare function resolveUtsAppModule(id: string, importer: string): string | undefined;
|
|
10
9
|
export declare function resolveUtsModule(id: string, importer: string): string | undefined;
|
|
11
10
|
export declare function resolveUTSCompiler(): typeof UTSCompiler;
|
|
12
|
-
export declare function initUTSComponents(inputDir: string, platform: UniApp.PLATFORM): EasycomMatcher[];
|
package/dist/uts.js
CHANGED
|
@@ -3,10 +3,9 @@ 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.
|
|
6
|
+
exports.resolveUTSCompiler = exports.resolveUtsModule = exports.resolveUtsAppModule = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
10
9
|
const hbx_1 = require("./hbx");
|
|
11
10
|
const utils_1 = require("./utils");
|
|
12
11
|
/**
|
|
@@ -100,65 +99,3 @@ function resolveUTSCompiler() {
|
|
|
100
99
|
return require(compilerPath);
|
|
101
100
|
}
|
|
102
101
|
exports.resolveUTSCompiler = resolveUTSCompiler;
|
|
103
|
-
function initUTSComponents(inputDir, platform) {
|
|
104
|
-
const components = [];
|
|
105
|
-
if (platform !== 'app' && platform !== 'app-plus') {
|
|
106
|
-
return components;
|
|
107
|
-
}
|
|
108
|
-
const easycomsObj = Object.create(null);
|
|
109
|
-
const dirs = resolveUTSComponentDirs(inputDir);
|
|
110
|
-
dirs.forEach((dir) => {
|
|
111
|
-
const is_uni_modules_utssdk = dir.endsWith('utssdk');
|
|
112
|
-
const is_ussdk = !is_uni_modules_utssdk && path_1.default.dirname(dir).endsWith('utssdk');
|
|
113
|
-
if (is_uni_modules_utssdk || is_ussdk) {
|
|
114
|
-
fast_glob_1.default
|
|
115
|
-
.sync('**/*.vue', {
|
|
116
|
-
cwd: dir,
|
|
117
|
-
absolute: true,
|
|
118
|
-
})
|
|
119
|
-
.forEach((file) => {
|
|
120
|
-
let name = parseVueComponentName(file);
|
|
121
|
-
if (!name) {
|
|
122
|
-
if (file.endsWith('index.vue')) {
|
|
123
|
-
name = path_1.default.basename(is_uni_modules_utssdk ? path_1.default.dirname(dir) : dir);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
if (name) {
|
|
127
|
-
const importDir = (0, utils_1.normalizePath)(is_uni_modules_utssdk ? path_1.default.dirname(dir) : dir);
|
|
128
|
-
easycomsObj[`^${name}$`] = `\0${importDir}?uts-proxy`;
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
Object.keys(easycomsObj).forEach((name) => {
|
|
134
|
-
components.push({
|
|
135
|
-
pattern: new RegExp(name),
|
|
136
|
-
replacement: easycomsObj[name],
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
return components;
|
|
140
|
-
}
|
|
141
|
-
exports.initUTSComponents = initUTSComponents;
|
|
142
|
-
function resolveUTSComponentDirs(inputDir) {
|
|
143
|
-
const utssdkDir = path_1.default.resolve(inputDir, 'utssdk');
|
|
144
|
-
const uniModulesDir = path_1.default.resolve(inputDir, 'uni_modules');
|
|
145
|
-
return fast_glob_1.default
|
|
146
|
-
.sync('*', {
|
|
147
|
-
cwd: utssdkDir,
|
|
148
|
-
absolute: true,
|
|
149
|
-
onlyDirectories: true,
|
|
150
|
-
})
|
|
151
|
-
.concat(fast_glob_1.default.sync('*/utssdk', {
|
|
152
|
-
cwd: uniModulesDir,
|
|
153
|
-
absolute: true,
|
|
154
|
-
onlyDirectories: true,
|
|
155
|
-
}));
|
|
156
|
-
}
|
|
157
|
-
const nameRE = /name\s*:\s*['|"](.*)['|"]/;
|
|
158
|
-
function parseVueComponentName(file) {
|
|
159
|
-
const content = fs_1.default.readFileSync(file, 'utf8');
|
|
160
|
-
const matches = content.match(nameRE);
|
|
161
|
-
if (matches) {
|
|
162
|
-
return matches[1];
|
|
163
|
-
}
|
|
164
|
-
}
|
|
@@ -145,7 +145,8 @@ function fileToUrl(id, config, ctx, canInline = false) {
|
|
|
145
145
|
}
|
|
146
146
|
exports.fileToUrl = fileToUrl;
|
|
147
147
|
function getAssetFilename(hash, config) {
|
|
148
|
-
|
|
148
|
+
var _a;
|
|
149
|
+
return (_a = assetHashToFilenameMap.get(config)) === null || _a === void 0 ? void 0 : _a.get(hash);
|
|
149
150
|
}
|
|
150
151
|
exports.getAssetFilename = getAssetFilename;
|
|
151
152
|
/**
|
|
@@ -226,6 +227,7 @@ function sanitizeFileName(name) {
|
|
|
226
227
|
* and returns the resolved public URL
|
|
227
228
|
*/
|
|
228
229
|
function fileToBuiltUrl(id, config, pluginContext, skipPublicCheck = false, canInline = false) {
|
|
230
|
+
var _a, _b, _c, _d;
|
|
229
231
|
if (!skipPublicCheck && checkPublicFile(id, config)) {
|
|
230
232
|
return config.base + id.slice(1);
|
|
231
233
|
}
|
|
@@ -246,16 +248,15 @@ function fileToBuiltUrl(id, config, pluginContext, skipPublicCheck = false, canI
|
|
|
246
248
|
const contentHash = getAssetHash(content);
|
|
247
249
|
const { search, hash } = (0, url_1.parse)(id);
|
|
248
250
|
const postfix = (search || '') + (hash || '');
|
|
249
|
-
const output = config.build
|
|
251
|
+
const output = (_b = (_a = config.build) === null || _a === void 0 ? void 0 : _a.rollupOptions) === null || _b === void 0 ? void 0 : _b.output;
|
|
250
252
|
const defaultAssetFileNames = path_1.default.posix.join(config.build.assetsDir, '[name].[hash][extname]');
|
|
251
253
|
// Steps to determine which assetFileNames will be actually used.
|
|
252
254
|
// First, if output is an object or string, use assetFileNames in it.
|
|
253
255
|
// And a default assetFileNames as fallback.
|
|
254
|
-
let assetFileNames = (output && !Array.isArray(output) ? output.assetFileNames : undefined)
|
|
255
|
-
defaultAssetFileNames;
|
|
256
|
+
let assetFileNames = (_c = (output && !Array.isArray(output) ? output.assetFileNames : undefined)) !== null && _c !== void 0 ? _c : defaultAssetFileNames;
|
|
256
257
|
if (output && Array.isArray(output)) {
|
|
257
258
|
// Second, if output is an array, adopt assetFileNames in the first object.
|
|
258
|
-
assetFileNames = output[0].assetFileNames
|
|
259
|
+
assetFileNames = (_d = output[0].assetFileNames) !== null && _d !== void 0 ? _d : assetFileNames;
|
|
259
260
|
}
|
|
260
261
|
const inputDir = (0, utils_1.normalizePath)(process.env.UNI_INPUT_DIR);
|
|
261
262
|
let fileName = file.startsWith(inputDir) && file.includes('/static/')
|
|
@@ -37,6 +37,7 @@ const utils_1 = require("../utils");
|
|
|
37
37
|
const asset_1 = require("./asset");
|
|
38
38
|
const magic_string_1 = __importDefault(require("magic-string"));
|
|
39
39
|
const preprocess_1 = require("../../../../preprocess");
|
|
40
|
+
const constants_1 = require("../../../../constants");
|
|
40
41
|
const cleanString_1 = require("../cleanString");
|
|
41
42
|
const shared_1 = require("@vue/shared");
|
|
42
43
|
const cssLangs = `\\.(css|less|sass|scss|styl|stylus|pcss|postcss)($|\\?)`;
|
|
@@ -107,6 +108,34 @@ function cssPlugin(config) {
|
|
|
107
108
|
};
|
|
108
109
|
}
|
|
109
110
|
exports.cssPlugin = cssPlugin;
|
|
111
|
+
function findCssModuleIds(moduleId, cssModuleIds, seen) {
|
|
112
|
+
if (!cssModuleIds) {
|
|
113
|
+
cssModuleIds = new Set();
|
|
114
|
+
}
|
|
115
|
+
if (!seen) {
|
|
116
|
+
seen = new Set();
|
|
117
|
+
}
|
|
118
|
+
if (seen.has(moduleId)) {
|
|
119
|
+
return cssModuleIds;
|
|
120
|
+
}
|
|
121
|
+
seen.add(moduleId);
|
|
122
|
+
const moduleInfo = this.getModuleInfo(moduleId);
|
|
123
|
+
if (moduleInfo) {
|
|
124
|
+
moduleInfo.importedIds.forEach((id) => {
|
|
125
|
+
if (id.includes(constants_1.PAGES_JSON_JS)) {
|
|
126
|
+
// 查询main.js时,需要忽略pages.json.js,否则会把所有页面样式加进来
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
if (exports.cssLangRE.test(id) && !exports.commonjsProxyRE.test(id)) {
|
|
130
|
+
cssModuleIds.add(id);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
findCssModuleIds.call(this, id, cssModuleIds, seen);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
return cssModuleIds;
|
|
138
|
+
}
|
|
110
139
|
/**
|
|
111
140
|
* Plugin applied after user plugins
|
|
112
141
|
*/
|
|
@@ -135,18 +164,14 @@ function cssPostPlugin(config, { chunkCssFilename, chunkCssCode, }) {
|
|
|
135
164
|
moduleSideEffects: 'no-treeshake',
|
|
136
165
|
};
|
|
137
166
|
},
|
|
138
|
-
async
|
|
139
|
-
const
|
|
140
|
-
|
|
167
|
+
async generateBundle() {
|
|
168
|
+
const moduleIds = Array.from(this.getModuleIds());
|
|
169
|
+
moduleIds.forEach((id) => {
|
|
141
170
|
const filename = chunkCssFilename(id);
|
|
142
171
|
if (filename) {
|
|
143
|
-
|
|
144
|
-
cssChunks.set(filename, ids);
|
|
172
|
+
cssChunks.set(filename, findCssModuleIds.call(this, id));
|
|
145
173
|
}
|
|
146
|
-
}
|
|
147
|
-
return null;
|
|
148
|
-
},
|
|
149
|
-
async generateBundle() {
|
|
174
|
+
});
|
|
150
175
|
if (!cssChunks.size) {
|
|
151
176
|
return;
|
|
152
177
|
}
|
|
@@ -229,6 +254,7 @@ function getCssResolversKeys(resolvers) {
|
|
|
229
254
|
return Object.keys(resolvers);
|
|
230
255
|
}
|
|
231
256
|
async function compileCSS(id, code, config, urlReplacer, atImportResolvers, server) {
|
|
257
|
+
var _a;
|
|
232
258
|
const { modules: modulesOptions, preprocessorOptions, devSourcemap, } = config.css || {};
|
|
233
259
|
const isModule = modulesOptions !== false && cssModuleRE.test(id);
|
|
234
260
|
// although at serve time it can work without processing, we do need to
|
|
@@ -236,7 +262,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
236
262
|
const needInlineImport = code.includes('@import');
|
|
237
263
|
const hasUrl = exports.cssUrlRE.test(code) || cssImageSetRE.test(code);
|
|
238
264
|
const postcssConfig = await resolvePostcssConfig(config);
|
|
239
|
-
const lang = id.match(exports.cssLangRE)
|
|
265
|
+
const lang = (_a = id.match(exports.cssLangRE)) === null || _a === void 0 ? void 0 : _a[1];
|
|
240
266
|
// 1. plain css that needs no processing
|
|
241
267
|
if (lang === 'css' &&
|
|
242
268
|
!postcssConfig &&
|
|
@@ -273,7 +299,7 @@ async function compileCSS(id, code, config, urlReplacer, atImportResolvers, serv
|
|
|
273
299
|
}
|
|
274
300
|
// important: set this for relative import resolving
|
|
275
301
|
opts.filename = (0, utils_1.cleanUrl)(id);
|
|
276
|
-
opts.enableSourcemap = devSourcemap
|
|
302
|
+
opts.enableSourcemap = devSourcemap !== null && devSourcemap !== void 0 ? devSourcemap : false;
|
|
277
303
|
const preprocessResult = await preProcessor(code, config.root, opts, atImportResolvers, !!config.nvue);
|
|
278
304
|
if (preprocessResult.errors.length) {
|
|
279
305
|
throw preprocessResult.errors[0];
|
|
@@ -468,12 +494,13 @@ function combineSourcemapsIfExists(filename, map1, map2) {
|
|
|
468
494
|
: map1;
|
|
469
495
|
}
|
|
470
496
|
async function resolvePostcssConfig(config) {
|
|
497
|
+
var _a;
|
|
471
498
|
let result = postcssConfigCache.get(config);
|
|
472
499
|
if (result !== undefined) {
|
|
473
500
|
return result;
|
|
474
501
|
}
|
|
475
502
|
// inline postcss config via vite config
|
|
476
|
-
const inlineOptions = config.css
|
|
503
|
+
const inlineOptions = (_a = config.css) === null || _a === void 0 ? void 0 : _a.postcss;
|
|
477
504
|
if ((0, utils_1.isObject)(inlineOptions)) {
|
|
478
505
|
const options = { ...inlineOptions };
|
|
479
506
|
delete options.plugins;
|
|
@@ -525,7 +552,8 @@ const UrlRewritePostcssPlugin = (opts) => {
|
|
|
525
552
|
const isCssImageSet = cssImageSetRE.test(declaration.value);
|
|
526
553
|
if (isCssUrl || isCssImageSet) {
|
|
527
554
|
const replacerForDeclaration = (rawUrl) => {
|
|
528
|
-
|
|
555
|
+
var _a;
|
|
556
|
+
const importer = (_a = declaration.source) === null || _a === void 0 ? void 0 : _a.input.file;
|
|
529
557
|
return opts.replacer(rawUrl, importer);
|
|
530
558
|
};
|
|
531
559
|
const rewriterToUse = isCssImageSet
|
|
@@ -672,13 +700,14 @@ async function hoistAtRules(css) {
|
|
|
672
700
|
exports.hoistAtRules = hoistAtRules;
|
|
673
701
|
const loadedPreprocessors = {};
|
|
674
702
|
function loadPreprocessor(lang, root) {
|
|
703
|
+
var _a, _b;
|
|
675
704
|
if (lang in loadedPreprocessors) {
|
|
676
705
|
return loadedPreprocessors[lang];
|
|
677
706
|
}
|
|
678
707
|
try {
|
|
679
708
|
// Search for the preprocessor in the root directory first, and fall back
|
|
680
709
|
// to the default require paths.
|
|
681
|
-
const fallbackPaths = require.resolve.paths
|
|
710
|
+
const fallbackPaths = ((_b = (_a = require.resolve).paths) === null || _b === void 0 ? void 0 : _b.call(_a, lang)) || [];
|
|
682
711
|
const resolved = require.resolve(lang, { paths: [root, ...fallbackPaths] });
|
|
683
712
|
return (loadedPreprocessors[lang] = require(resolved));
|
|
684
713
|
}
|
|
@@ -693,11 +722,11 @@ const scss = async (source, root, options, resolvers, isNVue) => {
|
|
|
693
722
|
resolvers.sass(url, importer).then((resolved) => {
|
|
694
723
|
if (resolved) {
|
|
695
724
|
rebaseUrls(resolved, options.filename, options.alias, isNVue)
|
|
696
|
-
.then((data) => done
|
|
697
|
-
.catch((data) => done
|
|
725
|
+
.then((data) => done === null || done === void 0 ? void 0 : done(data))
|
|
726
|
+
.catch((data) => done === null || done === void 0 ? void 0 : done(data));
|
|
698
727
|
}
|
|
699
728
|
else {
|
|
700
|
-
done
|
|
729
|
+
done === null || done === void 0 ? void 0 : done(null);
|
|
701
730
|
}
|
|
702
731
|
});
|
|
703
732
|
};
|
|
@@ -908,13 +937,14 @@ function createViteLessPlugin(less, rootFile, alias, resolvers, isNVue) {
|
|
|
908
937
|
}
|
|
909
938
|
// .styl
|
|
910
939
|
const styl = async (source, root, options) => {
|
|
940
|
+
var _a;
|
|
911
941
|
const nodeStylus = loadPreprocessor("stylus" /* PreprocessLang.stylus */, root);
|
|
912
942
|
// Get source with preprocessor options.additionalData. Make sure a new line separator
|
|
913
943
|
// is added to avoid any render error, as added stylus content may not have semi-colon separators
|
|
914
944
|
const { content, map: additionalMap } = await getSource(source, options.filename, options.additionalData, options.enableSourcemap, '\n');
|
|
915
945
|
// Get preprocessor options.imports dependencies as stylus
|
|
916
946
|
// does not return them with its builtin `.deps()` method
|
|
917
|
-
const importsDeps = (options.imports
|
|
947
|
+
const importsDeps = ((_a = options.imports) !== null && _a !== void 0 ? _a : []).map((dep) => path_1.default.resolve(dep));
|
|
918
948
|
try {
|
|
919
949
|
const ref = nodeStylus(content, options);
|
|
920
950
|
if (options.enableSourcemap) {
|
|
@@ -113,7 +113,7 @@ async function processSrcSet(srcs, replacer) {
|
|
|
113
113
|
const [url] = imageSetUrlRE.exec(src) || [];
|
|
114
114
|
return {
|
|
115
115
|
url: url,
|
|
116
|
-
descriptor: src
|
|
116
|
+
descriptor: src === null || src === void 0 ? void 0 : src.slice(url.length).trim(),
|
|
117
117
|
};
|
|
118
118
|
})
|
|
119
119
|
.filter(({ url }) => !!url);
|
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-3061620230109001",
|
|
4
4
|
"description": "@dcloudio/uni-cli-shared",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@ampproject/remapping": "^2.1.2",
|
|
25
|
-
"@babel/core": "^7.
|
|
26
|
-
"@babel/parser": "^7.
|
|
27
|
-
"@babel/types": "^7.20.
|
|
28
|
-
"@dcloudio/uni-i18n": "3.0.0-alpha-
|
|
29
|
-
"@dcloudio/uni-shared": "3.0.0-alpha-
|
|
25
|
+
"@babel/core": "^7.19.6",
|
|
26
|
+
"@babel/parser": "^7.19.6",
|
|
27
|
+
"@babel/types": "^7.20.0",
|
|
28
|
+
"@dcloudio/uni-i18n": "3.0.0-alpha-3061620230109001",
|
|
29
|
+
"@dcloudio/uni-shared": "3.0.0-alpha-3061620230109001",
|
|
30
30
|
"@intlify/core-base": "9.1.9",
|
|
31
31
|
"@intlify/shared": "9.1.9",
|
|
32
32
|
"@intlify/vue-devtools": "9.1.9",
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
"compare-versions": "^3.6.0",
|
|
43
43
|
"debug": "^4.3.3",
|
|
44
44
|
"es-module-lexer": "^0.9.3",
|
|
45
|
-
"esbuild": "^0.
|
|
45
|
+
"esbuild": "^0.15.9",
|
|
46
46
|
"estree-walker": "^2.0.2",
|
|
47
47
|
"fast-glob": "^3.2.11",
|
|
48
48
|
"fs-extra": "^10.0.0",
|
|
49
49
|
"hash-sum": "^2.0.0",
|
|
50
50
|
"jsonc-parser": "^3.0.0",
|
|
51
|
-
"magic-string": "^0.
|
|
51
|
+
"magic-string": "^0.26.7",
|
|
52
52
|
"merge": "^2.1.1",
|
|
53
53
|
"mime": "^3.0.0",
|
|
54
54
|
"module-alias": "^2.2.2",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@dcloudio/uni-uts-v1": "3.0.0-alpha-
|
|
67
|
+
"@dcloudio/uni-uts-v1": "3.0.0-alpha-3061620230109001",
|
|
68
68
|
"@types/babel__core": "^7.1.19",
|
|
69
69
|
"@types/debug": "^4.1.7",
|
|
70
70
|
"@types/estree": "^0.0.51",
|